Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function StoresRoute({ selected, onChange }) {
const { t } = useTranslations();
return (
<div data-test-org-settings-stores="">
<h2>{t('org.storesTitle')}</h2>
<h3>{t('org.storeSelectTitle')}</h3>
</div>
);
}
export default compose(
withOrbit((passedProps) => {
const { organization } = passedProps;
return {
organizationStores: (q) => q.findRelatedRecords(organization, 'organizationStores'),
};
}),
mapProps(({ organizationStores, updateOrganizationStore }) => {
const { isSuperAdmin } = getPermissions();
return {
selected: organizationStores,
onChange(store) {
// if not superadmin, this onChange handler is a noop
if (isSuperAdmin) {
updateOrganizationStore(store);
}
interface IPendingUpdates {
[itemId: string]: boolean;
}
interface IComposedProps {
selectedItemJoinsWith: string;
emptyListLabel: string;
displayProductIcon: boolean;
list: ProductDefinitionResource[];
}
type IProps = INeededProps & i18nProps & IComposedProps;
export default compose(
withTranslations,
withOrbit(),
withRelationships(({ organization }: INeededProps) => {
return {
list: [organization, 'organizationProductDefinitions', 'productDefinition'],
};
}),
withProps(({ t, list }: IProps) => {
return {
selectedItemJoinsWith: 'productDefinition',
emptyListLabel: t('project.products.popup.empty'),
displayProductIcon: true,
list: list.sort(compareVia((pd) => attributesFor(pd).name)),
};
})
)(
class extends React.Component {
pendingUpdates: IPendingUpdates = {};
const props = {
...this.props,
updateAttributes: this.updateAttributes,
updateAttribute: this.updateAttribute,
updateGroup: this.updateGroup,
updateOwner: this.updateOwner,
updateProduct: this.updateProduct,
productForProductDefinition: this.productForProductDefinition,
};
return ;
}
}
return compose(
withOrbit((passedProps) => {
const { project } = passedProps;
return {
products: (q) => q.findRelatedRecords(project, 'products'),
};
}),
requireProps('project')
)(ProjectDataActionWrapper);
}