From d5c9a3dae88849544e9da87611cdde2bfc79bd9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dro=C5=84?= Date: Tue, 21 Jun 2022 11:36:55 +0200 Subject: [PATCH] Add trailing commas (#2062) * Require trailing commas * Add trailing commas * Add trailing commas in testUtils dir * Add trailing commas --- .eslintrc.json | 2 +- .prettierrc | 2 +- src/apps/apolloMocks.ts | 8 +- .../AppActivateDialog.stories.tsx | 2 +- .../AppActivateDialog/AppActivateDialog.tsx | 8 +- .../AppDeactivateDialog.stories.tsx | 4 +- .../AppDeactivateDialog.tsx | 8 +- .../AppDeactivateDialog/messages.ts | 10 +- .../AppDeleteDialog.stories.tsx | 2 +- .../AppDeleteDialog/AppDeleteDialog.tsx | 8 +- .../AppDetailsPage/AppDetailsPage.stories.tsx | 2 +- .../AppDetailsPage/AppDetailsPage.tsx | 8 +- src/apps/components/AppDialog/AppDialog.tsx | 2 +- src/apps/components/AppDialog/styles.ts | 8 +- src/apps/components/AppFrame/AppFrame.tsx | 6 +- src/apps/components/AppFrame/styles.ts | 6 +- src/apps/components/AppFrame/useAppActions.ts | 16 +- .../AppInProgressDeleteDialog.stories.tsx | 4 +- .../AppInProgressDeleteDialog.tsx | 6 +- .../AppInstallErrorPage.tsx | 2 +- .../components/AppInstallErrorPage/styles.ts | 16 +- .../AppInstallPage/AppInstallPage.stories.tsx | 2 +- .../AppInstallPage/AppInstallPage.tsx | 10 +- .../components/AppPage/AppPage.stories.tsx | 2 +- src/apps/components/AppPage/AppPage.tsx | 4 +- src/apps/components/AppPage/styles.ts | 32 +- .../AppPage/useSettingsBreadcrumbs.ts | 8 +- .../AppPermissions/AppPermissions.tsx | 8 +- .../AppsInProgress/AppsInProgress.tsx | 10 +- .../AppsListPage/AppListPage.stories.tsx | 6 +- .../CustomAppCreatePage.tsx | 12 +- .../CustomAppDefaultToken.tsx | 2 +- .../CustomAppDefaultToken/styles.ts | 18 +- .../CustomAppDetailsPage.tsx | 14 +- .../CustomAppInformation.tsx | 6 +- .../CustomAppTokens/CustomAppTokens.tsx | 6 +- src/apps/components/CustomAppTokens/styles.ts | 14 +- src/apps/components/CustomApps/CustomApps.tsx | 6 +- src/apps/components/DeactivatedText/styles.ts | 8 +- .../HorizontalSpacer/HorizontalSpacer.tsx | 6 +- .../InstalledApps/InstalledApps.tsx | 6 +- .../components/Marketplace/Marketplace.tsx | 2 +- .../TokenCreateDialog/TokenCreateDialog.tsx | 6 +- .../components/TokenCreateDialog/styles.ts | 12 +- .../TokenDeleteDialog.stories.tsx | 2 +- .../TokenDeleteDialog/TokenDeleteDialog.tsx | 6 +- .../VerticalSpacer/VerticalSpacer.tsx | 6 +- src/apps/fixtures.ts | 58 +- src/apps/index.tsx | 8 +- src/apps/messages.ts | 8 +- src/apps/styles.ts | 112 +- src/apps/urls.ts | 10 +- src/apps/useExtensions.ts | 38 +- src/apps/views/App/App.tsx | 8 +- src/apps/views/AppDetails/AppDetails.tsx | 22 +- src/apps/views/AppInstall/AppInstall.tsx | 24 +- src/apps/views/AppInstall/messages.ts | 4 +- src/apps/views/AppSettings/AppSettings.tsx | 4 +- src/apps/views/AppsList/AppsList.tsx | 88 +- src/apps/views/AppsList/messages.ts | 14 +- .../views/CustomAppCreate/CustomAppCreate.tsx | 16 +- src/apps/views/CustomAppCreate/messages.ts | 4 +- .../CustomAppDetails/CustomAppDetails.tsx | 66 +- .../AttributeBulkDeleteDialog.tsx | 6 +- .../AttributeDeleteDialog.tsx | 6 +- .../AttributeDetails/AttributeDetails.tsx | 48 +- .../AttributeDetails/NumericUnits.tsx | 30 +- .../components/AttributeDetails/messages.tsx | 68 +- .../components/AttributeDetails/utils.ts | 54 +- .../AttributeList/AttributeList.tsx | 36 +- .../AttributeListPage/AttributeListPage.tsx | 10 +- .../components/AttributeListPage/filters.ts | 40 +- .../AttributeOrganization.tsx | 24 +- .../AttributePage/AttributePage.tsx | 20 +- .../AttributeProperties.tsx | 28 +- .../AttributeSwatchField.tsx | 18 +- .../AttributeSwatchField/messages.ts | 6 +- .../components/AttributeSwatchField/styles.ts | 6 +- .../AttributeValueDeleteDialog.tsx | 8 +- .../AttributeValueEditDialog.tsx | 14 +- .../AttributeValues/AttributeValues.tsx | 34 +- src/attributes/errors.ts | 10 +- src/attributes/fixtures.ts | 260 +-- src/attributes/index.tsx | 6 +- src/attributes/urls.ts | 6 +- src/attributes/utils/data.ts | 131 +- src/attributes/utils/handlers.test.ts | 112 +- src/attributes/utils/handlers.ts | 80 +- .../views/AttributeCreate/AttributeCreate.tsx | 50 +- .../AttributeDetails/AttributeDetails.tsx | 116 +- .../views/AttributeList/AttributeList.tsx | 38 +- .../views/AttributeList/filters.test.ts | 16 +- src/attributes/views/AttributeList/filters.ts | 38 +- src/attributes/views/AttributeList/sort.ts | 4 +- src/auth/AuthProvider.test.tsx | 16 +- src/auth/components/Layout.tsx | 36 +- .../components/LoginLoading/LoginLoading.tsx | 6 +- .../LoginPage/LoginPage.stories.tsx | 6 +- src/auth/components/LoginPage/LoginPage.tsx | 10 +- src/auth/components/LoginPage/form.tsx | 6 +- src/auth/components/LoginPage/messages.ts | 10 +- .../NewPasswordPage.stories.tsx | 2 +- .../NewPasswordPage/NewPasswordPage.tsx | 14 +- .../ResetPasswordPage.stories.tsx | 2 +- .../ResetPasswordPage/ResetPasswordPage.tsx | 4 +- src/auth/components/styles.ts | 28 +- src/auth/errors.ts | 2 +- src/auth/hooks/useAuthProvider.ts | 34 +- src/auth/index.tsx | 4 +- src/auth/misc.ts | 4 +- src/auth/types.ts | 6 +- src/auth/utils.ts | 20 +- src/auth/views/Login.tsx | 14 +- src/auth/views/NewPassword.tsx | 4 +- src/auth/views/ResetPassword.tsx | 18 +- .../CategoryBackground/CategoryBackground.tsx | 14 +- .../CategoryCreatePage/CategoryCreatePage.tsx | 6 +- .../components/CategoryCreatePage/form.tsx | 28 +- .../CategoryDeleteDialog.tsx | 14 +- .../CategoryDetailsForm.tsx | 10 +- .../components/CategoryList/CategoryList.tsx | 24 +- .../CategoryListPage/CategoryListPage.tsx | 8 +- .../CategoryProductList.tsx | 28 +- .../CategoryProducts/CategoryProducts.tsx | 8 +- .../components/CategoryProducts/styles.ts | 6 +- .../CategoryUpdatePage/CategoryUpdatePage.tsx | 10 +- .../components/CategoryUpdatePage/form.tsx | 32 +- src/categories/fixtures.ts | 340 ++-- src/categories/index.tsx | 4 +- src/categories/urls.ts | 6 +- src/categories/views/CategoryCreate.tsx | 24 +- src/categories/views/CategoryDetails.tsx | 94 +- .../views/CategoryList/CategoryList.tsx | 50 +- src/categories/views/CategoryList/filter.ts | 14 +- src/categories/views/CategoryList/sort.ts | 4 +- ...nnelWithVariantAvailabilityItemWrapper.tsx | 38 +- ...lsWithVariantsAvailabilityCard.stories.tsx | 38 +- .../ChannelsWithVariantsAvailabilityCard.tsx | 14 +- .../CannotDefineChannelsAvailabilityCard.tsx | 6 +- .../ChannelDeleteDialog.stories.tsx | 4 +- .../ChannelDeleteDialog.tsx | 20 +- .../ChannelForm/ChannelForm.stories.tsx | 4 +- .../components/ChannelForm/ChannelForm.tsx | 30 +- .../ChannelPickerDialog.stories.tsx | 4 +- .../ChannelPickerDialog.tsx | 8 +- .../ChannelStatus/ChannelStatus.stories.tsx | 2 +- .../ChannelStatus/ChannelStatus.tsx | 4 +- ...WithVariantsAvailabilityDialog.stories.tsx | 28 +- ...ChannelsWithVariantsAvailabilityDialog.tsx | 18 +- ...sWithVariantsAvailabilityDialogContent.tsx | 52 +- .../ShippingZonesCard/ShippingZoneItem.tsx | 2 +- .../ShippingZonesCard.stories.tsx | 10 +- .../ShippingZonesCard/ShippingZonesCard.tsx | 18 +- .../ShippingZonesCardListFooter.tsx | 8 +- .../ShippingZonesListHeader.tsx | 22 +- .../components/ShippingZonesCard/styles.ts | 18 +- src/channels/components/styles.ts | 14 +- src/channels/fixtures.ts | 98 +- src/channels/index.tsx | 4 +- .../ChannelDetailsPage.stories.tsx | 16 +- .../ChannelDetailsPage/ChannelDetailsPage.tsx | 34 +- .../ChannelsListPage.stories.tsx | 2 +- .../ChannelsListPage/ChannelsListPage.tsx | 14 +- src/channels/pages/ChannelsListPage/styles.ts | 24 +- src/channels/urls.ts | 4 +- src/channels/utils.ts | 92 +- .../views/ChannelCreate/ChannelCreate.tsx | 32 +- .../views/ChannelDetails/ChannelDetails.tsx | 58 +- .../views/ChannelsList/ChannelsList.tsx | 28 +- .../CollectionCreatePage.tsx | 28 +- .../components/CollectionCreatePage/form.tsx | 40 +- .../CollectionDetails/CollectionDetails.tsx | 6 +- .../CollectionDetailsPage.tsx | 10 +- .../components/CollectionDetailsPage/form.tsx | 40 +- .../CollectionImage/CollectionImage.tsx | 20 +- .../CollectionList/CollectionList.tsx | 36 +- .../components/CollectionList/messages.ts | 8 +- .../CollectionListPage/CollectionListPage.tsx | 10 +- .../components/CollectionListPage/filters.ts | 26 +- .../CollectionProducts/CollectionProducts.tsx | 32 +- src/collections/fixtures.ts | 162 +- src/collections/index.tsx | 4 +- src/collections/urls.ts | 6 +- src/collections/utils.ts | 6 +- src/collections/views/CollectionCreate.tsx | 46 +- src/collections/views/CollectionDetails.tsx | 126 +- .../views/CollectionList/CollectionList.tsx | 54 +- .../views/CollectionList/filters.test.ts | 14 +- .../views/CollectionList/filters.ts | 30 +- src/collections/views/CollectionList/sort.ts | 6 +- src/components/Accordion/Accordion.tsx | 16 +- .../AccountPermissionGroups.stories.tsx | 22 +- .../AccountPermissionGroups.tsx | 10 +- .../AccountPermissions/AccountPermissions.tsx | 38 +- src/components/AccountPermissions/utils.ts | 10 +- src/components/ActionDialog/ActionDialog.tsx | 2 +- src/components/ActionDialog/DialogButtons.tsx | 4 +- src/components/AddressEdit/AddressEdit.tsx | 48 +- .../AddressFormatter/AddressFormatter.tsx | 2 +- src/components/Alert/InlineAlert.tsx | 6 +- .../AppLayout/AppChannelContext.tsx | 6 +- src/components/AppLayout/AppChannelSelect.tsx | 16 +- src/components/AppLayout/AppLayout.tsx | 60 +- src/components/AppLayout/menuStructure.ts | 90 +- src/components/AppLayout/utils.ts | 16 +- .../AssignAttributeDialog.stories.tsx | 4 +- .../AssignAttributeDialog.tsx | 38 +- .../AssignAttributeDialog/messages.ts | 12 +- .../AssignAttributeValueDialog.tsx | 16 +- .../AssignCategoryDialog.tsx | 6 +- .../AssignCategoryDialog/messages.ts | 10 +- .../AssignCollectionDialog.tsx | 6 +- .../AssignCollectionDialog/messages.ts | 10 +- .../AssignContainerDialog.tsx | 18 +- .../AssignContainerDialog/messages.ts | 4 +- .../AssignContainerDialog/styles.ts | 12 +- .../AssignProductDialog.tsx | 14 +- .../AssignProductDialog/messages.ts | 10 +- src/components/AssignProductDialog/styles.ts | 12 +- .../AssignVariantDialog.tsx | 41 +- .../AssignVariantDialog/messages.ts | 12 +- src/components/AssignVariantDialog/styles.ts | 30 +- .../AttributeUnassignDialog.stories.tsx | 4 +- .../AttributeUnassignDialog.tsx | 4 +- .../AttributeUnassignDialog/messages.ts | 6 +- src/components/Attributes/AttributeRow.tsx | 14 +- .../Attributes/Attributes.stories.tsx | 4 +- src/components/Attributes/Attributes.tsx | 46 +- .../Attributes/BasicAttributeRow.tsx | 22 +- .../Attributes/ExtendedAttributeRow.tsx | 12 +- src/components/Attributes/SwatchRow.tsx | 8 +- src/components/Attributes/fixtures.ts | 134 +- src/components/Attributes/messages.ts | 8 +- src/components/Attributes/styles.ts | 12 +- src/components/Attributes/types.ts | 4 +- src/components/Attributes/utils.ts | 40 +- .../AutocompleteSelectMenu.tsx | 26 +- .../BulkAttributeUnassignDialog.stories.tsx | 4 +- .../BulkAttributeUnassignDialog.tsx | 4 +- .../BulkAttributeUnassignDialog/messages.ts | 6 +- .../ButtonWithSelect/ButtonWithSelect.tsx | 4 +- src/components/ButtonWithSelect/styles.ts | 12 +- src/components/CardMenu/CardMenu.tsx | 18 +- src/components/CardMenu/messages.ts | 4 +- src/components/CardSpacer.tsx | 8 +- src/components/ChannelsAvailability/styles.ts | 40 +- .../ChannelAvailabilityItemContent.tsx | 46 +- .../ChannelAvailabilityItemWrapper.tsx | 24 +- .../ChannelsAvailabilityCard.stories.tsx | 14 +- .../ChannelsAvailabilityCard.tsx | 6 +- .../ChannelsAvailabilityCardWrapper.tsx | 12 +- .../ChannelsAvailabilityCard/styles.ts | 48 +- .../ChannelsAvailabilityCard/types.tsx | 2 +- .../ChannelsAvailabilityCard/utils.ts | 42 +- .../ChannelsAvailabilityContent.tsx | 4 +- .../ChannelsAvailabilityContent/styles.ts | 30 +- .../ChannelsAvailabilityDialog.stories.tsx | 4 +- .../ChannelsAvailabilityDialog.tsx | 4 +- .../ChannelsAvailabilityDialog/utils.ts | 2 +- ...ChannelsAvailabilityDialogChannelsList.tsx | 14 +- .../ChannelsAvailabilityDialogWrapper.tsx | 38 +- .../ChannelsAvailabilityDropdown.stories.tsx | 4 +- .../ChannelsAvailabilityDropdown.tsx | 8 +- .../ChannelsAvailabilityDropdown/messages.ts | 19 +- .../ChannelsAvailabilityDropdown/utils.ts | 6 +- .../ChannelsAvailabilityMenuContent.tsx | 2 +- .../ChannelsAvailabilityMenuContent/styles.ts | 18 +- src/components/Checkbox/Checkbox.tsx | 8 +- src/components/Chip/Chip.stories.tsx | 2 +- src/components/Chip/Chip.tsx | 10 +- .../CollectionWithDividers.tsx | 4 +- .../ColorPicker/ColorPicker.stories.tsx | 2 +- src/components/ColorPicker/ColorPicker.tsx | 22 +- src/components/ColumnPicker/ColumnPicker.tsx | 22 +- .../ColumnPicker/ColumnPickerButton.tsx | 20 +- .../ColumnPicker/ColumnPickerContent.tsx | 16 +- src/components/ColumnPicker/messages.ts | 8 +- .../CompanyAddressForm.tsx | 44 +- .../CompanyAddressInput.tsx | 8 +- src/components/ConfirmButton.tsx | 6 +- src/components/Container.tsx | 12 +- src/components/ControlledSwitch.tsx | 8 +- src/components/CountryList/CountryList.tsx | 40 +- src/components/CreatorSteps/CreatorSteps.tsx | 20 +- src/components/Date/Date.test.tsx | 12 +- src/components/Date/DateProvider.tsx | 4 +- src/components/DateTimeField.tsx | 4 +- src/components/DateTimeTimezoneField.tsx | 12 +- src/components/DebounceForm.tsx | 2 +- src/components/DeleteButton/DeleteButton.tsx | 2 +- .../DeleteFilterTabDialog.tsx | 6 +- src/components/DemoBanner/DemoBanner.tsx | 4 +- src/components/DemoBanner/styles.ts | 20 +- .../DiscountedPrice/DiscountedPrice.tsx | 2 +- src/components/DiscountedPrice/styles.ts | 6 +- .../EditableTableCell/EditableTableCell.tsx | 20 +- .../ErrorNoticeBar/ErrorNoticeBar.tsx | 8 +- src/components/ErrorPage/messages.ts | 12 +- src/components/ErrorPage/styles.ts | 24 +- .../ExtendedPageHeader/ExtendedPageHeader.tsx | 30 +- src/components/ExternalLink/ExternalLink.tsx | 6 +- .../FileUploadField.stories.tsx | 10 +- .../FileUploadField/FileUploadField.tsx | 16 +- src/components/FileUploadField/fixtures.ts | 2 +- src/components/Filter/Filter.tsx | 50 +- .../Filter/FilterAutocompleteField.tsx | 38 +- .../Filter/FilterContent/FilterContent.tsx | 56 +- .../FilterContent/FilterContentBody.tsx | 30 +- .../FilterContentBodyNameField.tsx | 16 +- .../FilterContent/FilterContentHeader.tsx | 12 +- .../FilterContent/FilterDateTimeField.tsx | 32 +- .../Filter/FilterContent/FilterErrorsList.tsx | 16 +- .../Filter/FilterContent/FilterGroupLabel.tsx | 16 +- .../FilterContent/FilterNumericField.tsx | 16 +- .../Filter/FilterContent/FilterRangeField.tsx | 22 +- .../FilterContent/FilterSingleSelectField.tsx | 14 +- .../Filter/FilterContent/FilterTextField.tsx | 12 +- .../Filter/FilterContent/messages.ts | 6 +- src/components/Filter/FilterContent/styles.ts | 18 +- src/components/Filter/FilterContent/utils.ts | 32 +- src/components/Filter/FilterKeyValueField.tsx | 44 +- src/components/Filter/FilterOptionField.tsx | 16 +- src/components/Filter/messages.ts | 16 +- src/components/Filter/reducer.ts | 16 +- src/components/Filter/types.ts | 12 +- src/components/Filter/useFilter.ts | 16 +- src/components/Filter/utils.ts | 16 +- src/components/FilterBar/FilterBar.tsx | 14 +- src/components/FilterCard/FilterCard.tsx | 2 +- src/components/Form/ExitFormDialog.tsx | 18 +- .../Form/ExitFormDialogProvider.tsx | 18 +- src/components/Form/Form.tsx | 2 +- src/components/Form/messages.ts | 12 +- .../Form/useExitFormDialog.test.tsx | 26 +- src/components/Form/useExitFormDialog.ts | 8 +- src/components/FormSpacer.tsx | 6 +- src/components/Grid/Grid.tsx | 24 +- src/components/Hr.tsx | 6 +- src/components/IconButton/IconButton.tsx | 6 +- .../IconButtonTableCell.tsx | 8 +- src/components/ImageUpload/ImageUpload.tsx | 22 +- src/components/InternalLink/styles.ts | 6 +- .../LanguageSwitch/LanguageSwitch.tsx | 26 +- src/components/LimitReachedAlert.tsx | 6 +- src/components/Link.tsx | 20 +- .../LinkChoice/LinkChoice.stories.tsx | 2 +- src/components/LinkChoice/LinkChoice.tsx | 38 +- src/components/Locale/Locale.test.ts | 2 +- src/components/Locale/Locale.tsx | 10 +- src/components/MediaTile/MediaTile.tsx | 28 +- src/components/MenuToggle.tsx | 4 +- src/components/Metadata/Metadata.test.tsx | 20 +- src/components/Metadata/Metadata.tsx | 12 +- src/components/Metadata/MetadataCard.tsx | 28 +- src/components/Metadata/fixtures.ts | 12 +- src/components/Metadata/styles.ts | 44 +- src/components/Metadata/types.ts | 4 +- src/components/Metadata/utils.ts | 2 +- src/components/Money/Money.tsx | 10 +- src/components/Money/index.ts | 6 +- src/components/MoneyRange/MoneyRange.tsx | 18 +- .../MultiAutocompleteSelectField.stories.tsx | 8 +- .../MultiAutocompleteSelectField.tsx | 58 +- .../MultiAutocompleteSelectFieldContent.tsx | 62 +- .../MultiSelectField/MultiSelectField.tsx | 18 +- src/components/Navigator/Navigator.tsx | 44 +- src/components/Navigator/NavigatorInput.tsx | 34 +- src/components/Navigator/NavigatorSection.tsx | 24 +- src/components/Navigator/modes/catalog.ts | 14 +- .../Navigator/modes/commands/actions.ts | 24 +- src/components/Navigator/modes/customers.ts | 8 +- .../Navigator/modes/default/default.ts | 4 +- .../Navigator/modes/default/views.ts | 50 +- src/components/Navigator/modes/help.ts | 20 +- src/components/Navigator/modes/index.ts | 6 +- src/components/Navigator/modes/messages.ts | 44 +- src/components/Navigator/modes/orders.ts | 8 +- src/components/Navigator/modes/types.ts | 2 +- src/components/Navigator/modes/utils.ts | 6 +- .../Navigator/queries/useCatalogSearch.ts | 6 +- .../queries/useCheckIfOrderExists.ts | 8 +- src/components/Navigator/useQuickSearch.ts | 20 +- .../NavigatorButton/NavigatorButton.tsx | 24 +- src/components/NotFoundPage/NotFoundPage.tsx | 22 +- src/components/PageHeader/PageHeader.tsx | 22 +- src/components/Percent/Percent.tsx | 2 +- src/components/PhoneField/PhoneField.tsx | 8 +- src/components/PreviewPill/messages.ts | 6 +- src/components/PreviewPill/styles.ts | 10 +- src/components/PriceField/PriceField.tsx | 30 +- src/components/PriceField/utils.ts | 8 +- .../RadioGroupField/RadioGroupField.tsx | 14 +- src/components/RadioGroupField/styles.ts | 26 +- .../RadioSwitchField/RadioSwitchField.tsx | 26 +- src/components/RequirePermissions.tsx | 6 +- .../ResponsiveTable/ResponsiveTable.tsx | 14 +- .../RichTextEditor/RichTextEditor.stories.tsx | 2 +- .../RichTextEditor/RichTextEditor.tsx | 2 +- .../__mocks__/RichTextEditor.tsx | 2 +- src/components/RichTextEditor/consts.ts | 16 +- src/components/RichTextEditor/styles.ts | 62 +- .../RowNumberSelect/RowNumberSelect.tsx | 20 +- .../SaveFilterTabDialog.tsx | 8 +- src/components/Savebar.tsx | 6 +- src/components/SearchBar/SearchBar.tsx | 14 +- src/components/SearchBar/SearchInput.tsx | 12 +- src/components/SeoForm/SeoForm.tsx | 54 +- src/components/Shop/index.tsx | 2 +- src/components/Shop/queries.ts | 10 +- .../SingleAutocompleteSelectField.stories.tsx | 14 +- .../SingleAutocompleteSelectField.tsx | 44 +- .../SingleAutocompleteSelectFieldContent.tsx | 52 +- .../SingleSelectField/SingleSelectField.tsx | 28 +- src/components/Skeleton.tsx | 18 +- .../SortableChip/SortableChip.stories.tsx | 4 +- src/components/SortableChip/SortableChip.tsx | 12 +- .../SortableChip/SortableHandle.tsx | 6 +- .../SortableChipsField.stories.tsx | 6 +- .../SortableChipsField/SortableChipsField.tsx | 12 +- .../SortableTable/SortableHandle.tsx | 8 +- .../SortableTable/SortableTableBody.tsx | 10 +- .../SortableTable/SortableTableRow.tsx | 2 +- src/components/Tab/Tab.tsx | 16 +- src/components/Tab/TabContainer.tsx | 6 +- src/components/Tab/Tabs.tsx | 4 +- .../TableButtonWrapper/TableButtonWrapper.tsx | 2 +- src/components/TableCellAvatar/Avatar.tsx | 20 +- .../TableCellAvatar/TableCellAvatar.tsx | 8 +- .../TableCellHeader.stories.tsx | 6 +- .../TableCellHeader/TableCellHeader.tsx | 42 +- src/components/TableFilter/FilterTab.tsx | 18 +- src/components/TableFilter/FilterTabs.tsx | 6 +- src/components/TableHead/TableHead.tsx | 28 +- .../TablePagination/TablePagination.tsx | 10 +- .../TablePaginationActions.tsx | 32 +- .../TablePaginationWithContext.tsx | 2 +- src/components/TableRowLink/TableRowLink.tsx | 6 +- .../TextFieldWithChoice.tsx | 20 +- .../TextWithSelectField.tsx | 24 +- src/components/TextWithSelectField/styles.ts | 22 +- src/components/Timeline/Timeline.tsx | 32 +- src/components/Timeline/TimelineEvent.tsx | 28 +- .../Timeline/TimelineEventHeader.tsx | 14 +- src/components/Timeline/TimelineNote.tsx | 20 +- src/components/Timezone/Timezone.tsx | 2 +- .../TooltipTableCellHeader/messages.ts | 4 +- .../DeleteWarningDialogConsentContent.tsx | 2 +- .../TypeDeleteWarningDialog.stories.tsx | 4 +- .../TypeDeleteWarningDialog.tsx | 10 +- .../TypeDeleteWarningDialogContent.tsx | 4 +- .../TypeDeleteWarningDialog/styles.ts | 12 +- src/components/UserChip/UserChip.tsx | 16 +- src/components/VersionInfo/VersionInfo.tsx | 2 +- src/components/VersionInfo/styles.ts | 14 +- .../VisibilityCard/DateVisibilitySelector.tsx | 12 +- .../VisibilityCard/VisibilityCard.tsx | 58 +- src/components/WeightRange/WeightRange.tsx | 2 +- .../messages/MessageManagerProvider.tsx | 32 +- src/components/messages/Transition.tsx | 6 +- src/components/messages/index.ts | 2 +- src/components/messages/messages.ts | 6 +- src/components/messages/styles.ts | 8 +- src/config.ts | 46 +- src/configuration/ConfigurationPage.tsx | 32 +- src/configuration/index.tsx | 98 +- src/configuration/utils.ts | 6 +- src/containers/AppState/AppState.tsx | 8 +- src/containers/AppState/reducer.ts | 12 +- src/containers/AppState/state.ts | 2 +- .../BackgroundTasksProvider.test.tsx | 38 +- .../BackgroundTasksProvider.tsx | 24 +- src/containers/BackgroundTasks/messages.ts | 14 +- src/containers/BackgroundTasks/tasks.ts | 34 +- src/containers/BackgroundTasks/types.ts | 4 +- .../ServiceWorker/ServiceWorker.tsx | 4 +- src/containers/ServiceWorker/messages.ts | 8 +- .../CustomerAddress/CustomerAddress.tsx | 38 +- .../CustomerAddressChoiceCard.tsx | 2 +- .../CustomerAddressChoiceCard/styles.ts | 20 +- .../CustomerAddressDialog.tsx | 22 +- .../CustomerAddressListPage.tsx | 32 +- .../CustomerAddresses/CustomerAddresses.tsx | 10 +- .../CustomerCreateAddress.tsx | 10 +- .../CustomerCreateDetails.tsx | 14 +- .../CustomerCreateNote/CustomerCreateNote.tsx | 6 +- .../CustomerCreatePage/CustomerCreatePage.tsx | 26 +- .../CustomerDetails/CustomerDetails.tsx | 18 +- .../CustomerDetailsPage.tsx | 12 +- .../components/CustomerInfo/CustomerInfo.tsx | 10 +- .../components/CustomerList/CustomerList.tsx | 22 +- .../CustomerListPage/CustomerListPage.tsx | 10 +- .../components/CustomerListPage/filters.ts | 22 +- .../CustomerOrders/CustomerOrders.tsx | 16 +- .../CustomerStats/CustomerStats.tsx | 10 +- src/customers/fixtures.ts | 302 ++-- src/customers/index.tsx | 4 +- .../providers/CustomerDetailsProvider.tsx | 8 +- src/customers/urls.ts | 8 +- src/customers/views/CustomerAddresses.tsx | 52 +- src/customers/views/CustomerCreate.tsx | 22 +- src/customers/views/CustomerDetails.tsx | 40 +- .../views/CustomerList/CustomerList.tsx | 48 +- .../views/CustomerList/filters.test.ts | 24 +- src/customers/views/CustomerList/filters.ts | 46 +- src/customers/views/CustomerList/sort.ts | 4 +- .../DiscountCategories/DiscountCategories.tsx | 8 +- .../components/DiscountCategories/messages.ts | 12 +- .../components/DiscountCategories/styles.ts | 12 +- .../DiscountCollections.tsx | 10 +- .../DiscountCollections/messages.ts | 12 +- .../components/DiscountCollections/styles.ts | 12 +- .../DiscountCountrySelectDialog.tsx | 27 +- .../DiscountCountrySelectDialog/styles.ts | 8 +- .../DiscountDates/DiscountDates.tsx | 14 +- .../DiscountProducts/DiscountProducts.tsx | 8 +- .../components/DiscountProducts/messages.ts | 14 +- .../components/DiscountProducts/styles.ts | 18 +- .../DiscountVariants/DiscountVariants.tsx | 10 +- .../components/DiscountVariants/messages.ts | 14 +- .../components/DiscountVariants/styles.ts | 20 +- .../SaleCreatePage/SaleCreatePage.tsx | 14 +- .../SaleDetailsPage/SaleDetailsPage.tsx | 46 +- .../components/SaleInfo/SaleInfo.tsx | 4 +- .../components/SaleList/SaleList.tsx | 34 +- .../components/SaleListPage/SaleListPage.tsx | 8 +- .../components/SaleListPage/filters.ts | 58 +- .../components/SaleSummary/SaleSummary.tsx | 10 +- .../components/SaleSummary/styles.ts | 6 +- .../components/SaleType/SaleType.tsx | 24 +- .../components/SaleValue/SaleValue.tsx | 10 +- .../SaleValue/SaleValueTextField.tsx | 8 +- src/discounts/components/SaleValue/styles.ts | 26 +- src/discounts/components/SaleValue/types.ts | 2 +- .../VoucherCreatePage/VoucherCreatePage.tsx | 20 +- .../components/VoucherDates/VoucherDates.tsx | 14 +- .../VoucherDetailsPage/VoucherDetailsPage.tsx | 50 +- .../components/VoucherInfo/VoucherInfo.tsx | 8 +- .../VoucherLimits/VoucherLimits.tsx | 8 +- .../components/VoucherLimits/messages.ts | 14 +- .../components/VoucherLimits/styles.ts | 8 +- .../components/VoucherList/VoucherList.tsx | 48 +- .../VoucherListPage/VoucherListPage.tsx | 8 +- .../components/VoucherListPage/filters.ts | 66 +- .../VoucherRequirements.tsx | 34 +- .../components/VoucherRequirements/styles.ts | 16 +- .../VoucherSummary/VoucherSummary.tsx | 14 +- .../components/VoucherSummary/styles.ts | 6 +- .../components/VoucherTypes/VoucherTypes.tsx | 18 +- .../components/VoucherValue/VoucherValue.tsx | 24 +- .../components/VoucherValue/styles.ts | 18 +- src/discounts/fixtures.ts | 248 +-- src/discounts/handlers.ts | 44 +- src/discounts/index.tsx | 8 +- src/discounts/translations.ts | 10 +- src/discounts/types.ts | 4 +- src/discounts/urls.ts | 14 +- src/discounts/views/SaleCreate/SaleCreate.tsx | 26 +- src/discounts/views/SaleCreate/handlers.ts | 18 +- .../views/SaleDetails/SaleDetails.tsx | 162 +- src/discounts/views/SaleDetails/handlers.ts | 16 +- src/discounts/views/SaleDetails/messages.ts | 36 +- src/discounts/views/SaleList/SaleList.tsx | 48 +- src/discounts/views/SaleList/filters.test.ts | 22 +- src/discounts/views/SaleList/filters.ts | 50 +- src/discounts/views/SaleList/sort.ts | 4 +- .../views/VoucherCreate/VoucherCreate.tsx | 29 +- src/discounts/views/VoucherCreate/handlers.ts | 18 +- .../views/VoucherDetails/VoucherDetails.tsx | 163 +- .../views/VoucherDetails/handlers.ts | 14 +- .../views/VoucherList/VoucherList.tsx | 52 +- .../views/VoucherList/filters.test.ts | 26 +- src/discounts/views/VoucherList/filters.ts | 66 +- src/discounts/views/VoucherList/sort.ts | 6 +- src/fixtures.ts | 120 +- .../GiftCardBulkCreateDialog.tsx | 38 +- .../GiftCardBulkCreateDialogForm.tsx | 20 +- .../GiftCardBulkCreateDialog/messages.ts | 8 +- .../GiftCardBulkCreateDialog/types.ts | 2 +- .../GiftCardBulkCreateDialog/utils.ts | 12 +- .../ContentWithProgress.tsx | 8 +- .../GiftCardBulkCreateSuccessDialog.tsx | 4 +- .../GiftCardCreateDialogCodeContent.tsx | 4 +- .../GiftCardCreateDialogContent.tsx | 22 +- .../GiftCardCreateDialogForm.tsx | 24 +- .../GiftCardCreateExpirySelect.tsx | 18 +- .../GiftCardCreateExpirySelect/messages.ts | 10 +- .../GiftCardCreateExpirySelect/styles.ts | 10 +- .../GiftCardCreateMoneyInput.tsx | 12 +- ...iftCardCreateRequiresActivationSection.tsx | 4 +- .../GiftCardCustomerSelectField.tsx | 8 +- .../GiftCardCreateDialog/messages.ts | 38 +- src/giftCards/GiftCardCreateDialog/styles.ts | 18 +- src/giftCards/GiftCardCreateDialog/utils.ts | 22 +- .../GiftCardExportDialogContent.tsx | 40 +- .../GiftCardExportDialogContent/messages.ts | 14 +- .../GiftCardExportDialogContent/styles.ts | 6 +- .../GiftCardExportDialogContent/utils.ts | 6 +- .../GiftCardExpirySettingsCard.tsx | 4 +- .../GiftCardExpirySettingsCard/messages.ts | 6 +- .../GiftCardSettings/GiftCardSettingsPage.tsx | 10 +- src/giftCards/GiftCardSettings/messages.ts | 6 +- src/giftCards/GiftCardSettings/utils.ts | 8 +- .../GiftCardHistory/GiftCardHistory.tsx | 10 +- .../GiftCardHistory/GiftCardTimelineEvent.tsx | 18 +- .../hooks/useGiftCardHistoryEvents.ts | 2 +- .../GiftCardHistory/messages.ts | 42 +- .../GiftCardUpdate/GiftCardHistory/styles.ts | 6 +- .../GiftCardResendCodeDialog.tsx | 26 +- .../GiftCardResendCodeDialog/messages.ts | 17 +- .../GiftCardResendCodeDialog/utils.ts | 2 +- .../GiftCardUpdateBalanceDialog.tsx | 34 +- .../GiftCardUpdateBalanceDialog/messages.ts | 10 +- .../GiftCardUpdateBalanceDialog/styles.ts | 8 +- .../GiftCardUpdateDetailsBalanceSection.tsx | 2 +- .../GiftCardUpdateDetailsCard.tsx | 2 +- .../GiftCardUpdateDetailsCard/messages.ts | 10 +- .../GiftCardUpdateDetailsCard/styles.ts | 12 +- .../GiftCardUpdateExpirySelect.tsx | 10 +- .../GiftCardUpdateExpirySelect/messages.ts | 8 +- .../GiftCardUpdateExpirySelect/styles.ts | 10 +- .../GiftCardUpdateInfoCardContent.tsx | 16 +- .../GiftCardUpdateInfoCard/messages.ts | 18 +- .../GiftCardUpdate/GiftCardUpdatePage.tsx | 4 +- .../GiftCardEnableDisableSection.tsx | 8 +- .../GiftCardUpdatePageHeader.tsx | 2 +- .../hooks/useGiftCardActivateToggle.ts | 20 +- .../GiftCardUpdatePageHeader/messages.ts | 14 +- .../GiftCardUpdatePageHeader/styles.ts | 6 +- src/giftCards/GiftCardUpdate/messages.ts | 12 +- .../GiftCardDetailsProvider.tsx | 6 +- .../hooks/useGiftCardDetails.ts | 2 +- .../GiftCardDetailsProvider/utils.ts | 6 +- .../GiftCardUpdateDialogsProvider.tsx | 8 +- .../hooks/useGiftCardUpdateDialogs.ts | 2 +- .../GiftCardUpdateFormProvider.tsx | 44 +- .../hooks/useGiftCardUpdate.ts | 2 +- .../hooks/useGiftCardUpdateForm.ts | 2 +- src/giftCards/GiftCardUpdate/types.ts | 2 +- .../GiftCardListSearchAndFilters.tsx | 44 +- .../GiftCardListSearchAndFilters/filters.ts | 126 +- .../GiftCardListSearchAndFilters/messages.ts | 12 +- .../GiftCardListSearchAndFilters/types.ts | 10 +- .../GiftCardsListHeader.tsx | 10 +- .../GiftCardsListHeaderAlert.tsx | 2 +- .../GiftCardsListHeaderAlertContent.tsx | 8 +- .../GiftCardsListHeader/styles.ts | 8 +- .../GiftCardsListOrderInfoCard.tsx | 2 +- .../GiftCardsListOrderInfoCard/messages.ts | 4 +- .../GiftCardsListTable/GiftCardsListTable.tsx | 14 +- .../GiftCardsListTableFooter.tsx | 4 +- .../BulkEnableDisableSection.tsx | 26 +- .../GiftCardsListTableHeader.tsx | 26 +- .../GiftCardsListTableHeader/messages.ts | 16 +- src/giftCards/GiftCardsList/messages.ts | 46 +- .../GiftCardListDialogsProvider.tsx | 6 +- .../GiftCardListProvider.tsx | 26 +- .../providers/GiftCardListProvider/sort.ts | 4 +- src/giftCards/GiftCardsList/sort.ts | 2 +- src/giftCards/GiftCardsList/styles.ts | 28 +- src/giftCards/GiftCardsList/types.ts | 6 +- .../CustomerGiftCardsCard.tsx | 12 +- .../CustomerGiftCardsCardListItem.tsx | 30 +- .../GiftCardCustomerCard/messages.ts | 12 +- .../GiftCardCustomerCard/queries.ts | 2 +- .../components/GiftCardCustomerCard/styles.ts | 16 +- .../GiftCardDeleteDialogContent.tsx | 12 +- .../GiftCardListPageDeleteDialog.tsx | 14 +- .../GiftCardUpdatePageDeleteDialog.tsx | 4 +- .../GiftCardDeleteDialog/messages.ts | 12 +- .../components/GiftCardDeleteDialog/styles.ts | 6 +- .../useGiftCardBulkDelete.tsx | 18 +- .../useGiftCardSingleDelete.tsx | 16 +- .../GiftCardSendToCustomer.tsx | 4 +- .../GiftCardSendToCustomer/messages.ts | 10 +- .../GiftCardSettingsExpirySelect.tsx | 6 +- .../GiftCardSettingsExpirySelect/messages.ts | 6 +- .../GiftCardStatusChip/GiftCardStatusChip.tsx | 6 +- .../GiftCardTagInput/GiftCardTagInput.tsx | 10 +- .../components/GiftCardTagInput/messages.ts | 4 +- .../components/GiftCardTagInput/utils.ts | 4 +- .../TimePeriodField/TimePeriodField.tsx | 16 +- .../components/TimePeriodField/messages.ts | 10 +- src/giftCards/index.tsx | 6 +- src/giftCards/urls.ts | 2 +- src/graphql/client.ts | 20 +- .../HomeActivityCard/HomeActivityCard.tsx | 14 +- .../HomeActivityCard/activityMessages.ts | 20 +- .../HomeAnalyticsCard/HomeAnalyticsCard.tsx | 22 +- src/home/components/HomeHeader/HomeHeader.tsx | 12 +- .../HomeNotificationTable.tsx | 18 +- .../HomeNotificationTable/messages.ts | 16 +- src/home/components/HomePage/HomePage.tsx | 18 +- .../HomeProductListCard.tsx | 30 +- src/home/components/HomeScreen.tsx | 6 +- src/home/fixtures.ts | 114 +- src/home/views/index.tsx | 10 +- src/hooks/makeMutation.ts | 26 +- src/hooks/makeQuery.ts | 40 +- src/hooks/makeSearch.ts | 12 +- .../makeTopLevelSearch/makeTopLevelSearch.ts | 8 +- src/hooks/makeTopLevelSearch/utils.ts | 4 +- src/hooks/useAddressValidation.ts | 14 +- src/hooks/useBulkActions.ts | 4 +- src/hooks/useChannels.test.ts | 24 +- src/hooks/useChannels.ts | 10 +- src/hooks/useChannelsSearch.ts | 2 +- src/hooks/useChannelsSearchWithLoadMore.ts | 8 +- src/hooks/useChoiceSearch.ts | 2 +- src/hooks/useDebounce.ts | 2 +- src/hooks/useElementScroll.ts | 6 +- src/hooks/useForm.ts | 28 +- src/hooks/useFormset.ts | 14 +- src/hooks/useHandleFormSubmit.ts | 4 +- src/hooks/useListActions.ts | 6 +- src/hooks/useListSettings.test.ts | 22 +- src/hooks/useListSettings.ts | 14 +- src/hooks/useLocalPageInfo.ts | 4 +- src/hooks/useLocalPaginator.ts | 28 +- src/hooks/useLocalStorage.test.ts | 14 +- src/hooks/useLocalStorage.ts | 2 +- .../useModalDialogErrors.test.ts | 14 +- .../useModalDialogErrors.ts | 4 +- .../useModalDialogOpen.test.ts | 16 +- .../useModalDialogOpen/useModalDialogOpen.ts | 2 +- src/hooks/useMultiAutocomplete.ts | 8 +- src/hooks/useNavigator.ts | 6 +- src/hooks/useNotifier/useNotifier.ts | 2 +- src/hooks/useNotifier/utils.ts | 6 +- src/hooks/useOnSetDefaultVariant.ts | 18 +- src/hooks/usePaginationReset.ts | 14 +- src/hooks/usePaginator.ts | 25 +- src/hooks/useScroll.ts | 2 +- src/hooks/useSearchQuery.ts | 6 +- src/hooks/useServiceWorker.ts | 2 +- src/hooks/useStateFromProps.test.ts | 4 +- src/hooks/useStateFromProps.ts | 2 +- src/hooks/useWindowScroll.ts | 2 +- src/hooks/useWizard.ts | 6 +- src/icons/AccountCircle.tsx | 2 +- src/icons/ArrowDropdown.tsx | 2 +- src/icons/ArrowSort.tsx | 2 +- src/icons/Attributes.tsx | 2 +- src/icons/Ballot.tsx | 2 +- src/icons/BoldIcon.tsx | 2 +- src/icons/Bot.tsx | 2 +- src/icons/Calendar.tsx | 2 +- src/icons/Channels.tsx | 2 +- src/icons/Checkbox.tsx | 2 +- src/icons/CheckboxChecked.tsx | 2 +- src/icons/CheckboxIndeterminate.tsx | 2 +- src/icons/CheckboxSemiChecked.tsx | 2 +- src/icons/ChevronUp.tsx | 2 +- src/icons/Draggable.tsx | 4 +- src/icons/ErrorExclamationCircle.tsx | 2 +- src/icons/Folder.tsx | 2 +- src/icons/HeaderOne.tsx | 2 +- src/icons/HeaderThree.tsx | 2 +- src/icons/HeaderTwo.tsx | 2 +- src/icons/Home.tsx | 2 +- src/icons/Image.tsx | 2 +- src/icons/ItalicIcon.tsx | 2 +- src/icons/LinkIcon.tsx | 2 +- src/icons/LocalShipping.tsx | 2 +- src/icons/Monetization.tsx | 2 +- src/icons/Moon.tsx | 2 +- src/icons/Navigation.tsx | 2 +- src/icons/NoPhoto.tsx | 2 +- src/icons/OrderedListIcon.tsx | 2 +- src/icons/Orders.tsx | 2 +- src/icons/PageTypes.tsx | 2 +- src/icons/Pages.tsx | 2 +- src/icons/PermissionGroups.tsx | 2 +- src/icons/Plugins.tsx | 2 +- src/icons/ProductTypes.tsx | 2 +- src/icons/QuotationIcon.tsx | 2 +- src/icons/Sales.tsx | 2 +- src/icons/ShippingMethods.tsx | 2 +- src/icons/Shop.tsx | 2 +- src/icons/SiteSettings.tsx | 2 +- src/icons/StaffMembers.tsx | 2 +- src/icons/StoreMall.tsx | 2 +- src/icons/Sun.tsx | 2 +- src/icons/Taxes.tsx | 2 +- src/icons/Trash.tsx | 2 +- src/icons/Truck.tsx | 2 +- src/icons/UnorderedListIcon.tsx | 2 +- src/icons/Unstyled.tsx | 2 +- src/icons/Warehouses.tsx | 2 +- src/icons/Webhooks.tsx | 2 +- src/index.tsx | 12 +- src/intl.ts | 251 +-- src/marketplace/styles.ts | 8 +- src/misc.ts | 94 +- .../MenuCreateDialog/MenuCreateDialog.tsx | 8 +- .../MenuDetailsPage/MenuDetailsPage.tsx | 8 +- .../components/MenuDetailsPage/tree.test.ts | 370 ++--- .../components/MenuDetailsPage/tree.ts | 30 +- .../MenuItemDialog/MenuItemDialog.tsx | 58 +- .../components/MenuItems/MenuItems.tsx | 84 +- .../components/MenuItems/tree.test.ts | 24 +- src/navigation/components/MenuItems/tree.ts | 28 +- .../components/MenuList/MenuList.tsx | 24 +- .../components/MenuListPage/MenuListPage.tsx | 2 +- .../MenuProperties/MenuProperties.tsx | 4 +- src/navigation/fixtures.ts | 36 +- src/navigation/index.tsx | 4 +- src/navigation/urls.ts | 2 +- src/navigation/views/MenuDetails/index.tsx | 72 +- .../views/MenuDetails/successHandlers.ts | 22 +- src/navigation/views/MenuDetails/utils.ts | 12 +- src/navigation/views/MenuList/MenuList.tsx | 64 +- src/navigation/views/MenuList/sort.ts | 2 +- .../DraftOrderChannelSectionCard.stories.tsx | 4 +- .../DraftOrderChannelSectionCard.tsx | 4 +- .../OrderAddressFields/OrderAddressFields.tsx | 10 +- .../OrderBulkCancelDialog.tsx | 6 +- .../OrderCancelDialog/OrderCancelDialog.tsx | 6 +- .../OrderCannotCancelOrderDialog.tsx | 12 +- .../OrderCardTitle/OrderCardTitle.tsx | 44 +- .../OrderChangeWarehouseDialog.stories.tsx | 14 +- .../OrderChangeWarehouseDialog.tsx | 26 +- .../OrderChangeWarehouseDialog/messages.ts | 16 +- .../OrderChangeWarehouseDialog/styles.ts | 20 +- .../OrderChannelSectionCard.stories.tsx | 2 +- .../OrderChannelSectionCard.tsx | 4 +- .../OrderCustomer/OrderCustomer.tsx | 28 +- .../components/OrderCustomer/messages.ts | 6 +- .../OrderCustomerAddressEdit.tsx | 6 +- ...derCustomerAddressesEditDialog.stories.tsx | 10 +- .../OrderCustomerAddressesEditDialog.tsx | 74 +- .../OrderCustomerAddressesSearch.tsx | 18 +- .../OrderCustomerAddressesEditDialog/form.tsx | 66 +- .../messages.ts | 36 +- .../styles.ts | 14 +- .../OrderCustomerAddressesEditDialog/types.ts | 2 +- .../OrderCustomerAddressesEditDialog/utils.ts | 20 +- .../OrderCustomerChangeDialog.stories.tsx | 4 +- .../OrderCustomerChangeDialog.tsx | 4 +- .../OrderCustomerChangeDialog/form.tsx | 14 +- .../OrderCustomerChangeDialog/messages.ts | 10 +- .../OrderCustomerChangeDialog/styles.ts | 10 +- .../OrderCustomerNote/OrderCustomerNote.tsx | 4 +- .../OrderDetailsPage/OrderDetailsPage.tsx | 46 +- .../components/OrderDetailsPage/Title.tsx | 10 +- .../OrderDetailsPage/utils.test.tsx | 18 +- .../components/OrderDetailsPage/utils.ts | 2 +- .../OrderDiscountCommonModal/ModalTitle.tsx | 8 +- .../OrderDiscountCommonModal.stories.tsx | 12 +- .../OrderDiscountCommonModal.tsx | 60 +- .../OrderDraftCancelDialog.tsx | 6 +- .../OrderDraftDetails/OrderDraftDetails.tsx | 10 +- .../OrderDraftDetailsProducts.tsx | 30 +- .../OrderDraftDetailsProducts/TableLine.tsx | 28 +- .../TableLineForm.tsx | 14 +- .../OrderDraftDetailsSummary.tsx | 24 +- .../OrderDraftDetailsSummary/messages.ts | 18 +- .../OrderDraftList/OrderDraftList.tsx | 26 +- .../OrderDraftListPage/OrderDraftListPage.tsx | 14 +- .../components/OrderDraftListPage/filters.ts | 20 +- .../OrderDraftPage/OrderDraftPage.tsx | 22 +- .../OrderFulfillLine/OrderFulfillLine.tsx | 20 +- .../components/OrderFulfillLine/messages.ts | 6 +- .../components/OrderFulfillLine/styles.ts | 24 +- .../OrderFulfillPage.stories.tsx | 6 +- .../OrderFulfillPage/OrderFulfillPage.tsx | 44 +- .../components/OrderFulfillPage/fixtures.ts | 70 +- .../components/OrderFulfillPage/messages.ts | 34 +- .../components/OrderFulfillPage/styles.ts | 24 +- .../OrderFulfillStockExceededDialog.tsx | 8 +- .../messages.ts | 20 +- .../OrderFulfillStockExceededDialog/styles.ts | 16 +- .../OrderFulfillStockExceededDialogLine.tsx | 4 +- .../ActionButtons.tsx | 4 +- .../ExtraInfoLines.tsx | 6 +- .../OrderFulfilledProductsCard.tsx | 6 +- .../OrderFulfilledProductsCard/messages.ts | 16 +- .../OrderFulfilledProductsCard/styles.ts | 20 +- .../OrderFulfillmentApproveDialog.tsx | 2 +- .../OrderFulfillmentApproveDialog/messages.ts | 8 +- .../OrderFulfillmentCancelDialog.tsx | 22 +- .../OrderFulfillmentSettings.tsx | 4 +- .../OrderFulfillmentTrackingDialog.tsx | 10 +- .../ExtendedDiscountTimelineEvent.tsx | 14 +- .../MoneySection.tsx | 24 +- .../OrderHistory/ExtendedTimelineEvent.tsx | 70 +- src/orders/components/OrderHistory/Label.tsx | 2 +- .../OrderHistory/LinkedTimelineEvent.tsx | 30 +- .../components/OrderHistory/OrderHistory.tsx | 124 +- src/orders/components/OrderHistory/utils.tsx | 30 +- .../OrderInvoiceEmailSendDialog.tsx | 8 +- .../OrderInvoiceList/OrderInvoiceList.tsx | 28 +- src/orders/components/OrderLimitReached.tsx | 2 +- src/orders/components/OrderList/OrderList.tsx | 32 +- .../OrderListPage/OrderListPage.tsx | 30 +- .../components/OrderListPage/filters.ts | 114 +- .../OrderMarkAsPaidDialog.tsx | 6 +- .../components/OrderPayment/OrderPayment.tsx | 26 +- .../components/OrderPayment/messages.ts | 50 +- src/orders/components/OrderPayment/utils.ts | 14 +- .../OrderPaymentDialog/OrderPaymentDialog.tsx | 12 +- .../OrderPaymentVoidDialog.tsx | 4 +- .../components/OrderPriceLabel/styles.ts | 6 +- .../OrderProductAddDialog.tsx | 96 +- .../OrderProductsCardHeader.tsx | 28 +- .../OrderProductsTableRow.tsx | 30 +- .../components/OrderRefund/OrderRefund.tsx | 18 +- .../OrderRefundFulfilledProducts.tsx | 40 +- .../OrderRefundFulfilledProducts/messages.ts | 10 +- .../OrderRefundPage.stories.tsx | 2 +- .../OrderRefundPage/OrderRefundPage.tsx | 30 +- .../components/OrderRefundPage/fixtures.ts | 82 +- .../components/OrderRefundPage/form.tsx | 54 +- .../OrderRefundReturnAmount.tsx | 60 +- .../OrderRefundReturnAmountValues.tsx | 38 +- .../RefundAmountInput.tsx | 30 +- .../OrderRefundReturnAmount/utils.ts | 52 +- .../OrderRefundUnfulfilledProducts.tsx | 40 +- .../OrderReturnPage/OrderReturnPage.tsx | 20 +- .../MaximalButton.tsx | 6 +- .../ProductErrorCell.tsx | 20 +- .../ReturnItemsCard.tsx | 48 +- .../components/OrderReturnPage/form.tsx | 64 +- .../components/OrderReturnPage/utils.tsx | 38 +- .../OrderSettings/OrderSettings.tsx | 4 +- .../OrderSettingsPage.stories.tsx | 4 +- .../OrderSettingsPage/OrderSettingsPage.tsx | 4 +- .../components/OrderSettingsPage/form.tsx | 20 +- .../OrderShippingMethodEditDialog.tsx | 24 +- .../OrderUnfulfilledProductsCard.tsx | 28 +- src/orders/containers/OrderOperations.tsx | 48 +- src/orders/fixtures.ts | 830 +++++----- src/orders/index.tsx | 10 +- src/orders/urls.ts | 20 +- src/orders/utils/data.test.ts | 940 +++++------ src/orders/utils/data.ts | 98 +- .../views/OrderDetails/OrderDetails.tsx | 22 +- .../OrderDetails/OrderDetailsMessages.tsx | 104 +- .../OrderDetails/OrderDraftDetails/index.tsx | 60 +- .../OrderDetails/OrderNormalDetails/index.tsx | 82 +- .../OrderNormalDetails/useDefaultWarehouse.ts | 12 +- .../OrderUnconfirmedDetails/index.tsx | 88 +- .../views/OrderDraftList/OrderDraftList.tsx | 64 +- .../views/OrderDraftList/filters.test.ts | 14 +- src/orders/views/OrderDraftList/filters.ts | 38 +- src/orders/views/OrderDraftList/sort.ts | 4 +- .../views/OrderFulfill/OrderFulfill.tsx | 44 +- src/orders/views/OrderList/OrderList.tsx | 42 +- src/orders/views/OrderList/filters.test.ts | 44 +- src/orders/views/OrderList/filters.ts | 80 +- src/orders/views/OrderList/sort.ts | 2 +- src/orders/views/OrderRefund/OrderRefund.tsx | 56 +- src/orders/views/OrderReturn/OrderReturn.tsx | 32 +- src/orders/views/OrderReturn/utils.tsx | 16 +- src/orders/views/OrderSettings.tsx | 24 +- .../PageTypeAttributes/PageTypeAttributes.tsx | 24 +- .../PageTypeBulkDeleteDialog.tsx | 8 +- .../PageTypeCreatePage.stories.tsx | 8 +- .../PageTypeCreatePage/PageTypeCreatePage.tsx | 14 +- .../PageTypeDetails/PageTypeDetails.tsx | 4 +- .../PageTypeDetailsPage.stories.tsx | 10 +- .../PageTypeDetailsPage.tsx | 20 +- .../components/PageTypeList/PageTypeList.tsx | 12 +- .../PageTypeListPage.stories.tsx | 6 +- .../PageTypeListPage/PageTypeListPage.tsx | 8 +- src/pageTypes/fixtures.ts | 24 +- .../hooks/usePageTypeDelete/messages.ts | 27 +- .../usePageTypeDelete/usePageTypeDelete.tsx | 18 +- src/pageTypes/index.tsx | 4 +- src/pageTypes/urls.ts | 6 +- src/pageTypes/views/PageTypeCreate.tsx | 22 +- src/pageTypes/views/PageTypeDetails.tsx | 98 +- .../views/PageTypeList/PageTypeList.tsx | 46 +- src/pageTypes/views/PageTypeList/filters.ts | 14 +- src/pageTypes/views/PageTypeList/sort.ts | 4 +- .../PageDetailsPage/PageDetailsPage.tsx | 32 +- src/pages/components/PageDetailsPage/form.tsx | 64 +- src/pages/components/PageInfo/PageInfo.tsx | 14 +- src/pages/components/PageList/PageList.tsx | 26 +- .../components/PageListPage/PageListPage.tsx | 2 +- .../PageListPage/PageListSearchAndFilters.tsx | 24 +- src/pages/components/PageListPage/filters.ts | 38 +- src/pages/components/PageListPage/messages.ts | 4 +- .../PageOrganizeContent.tsx | 16 +- src/pages/fixtures.ts | 124 +- src/pages/index.tsx | 4 +- src/pages/urls.ts | 8 +- src/pages/utils/data.ts | 14 +- src/pages/utils/handlers.ts | 2 +- src/pages/views/PageCreate.tsx | 62 +- src/pages/views/PageDetails.tsx | 70 +- src/pages/views/PageList/PageList.tsx | 64 +- src/pages/views/PageList/sort.ts | 6 +- .../AssignMembersDialog.stories.tsx | 6 +- .../AssignMembersDialog.tsx | 66 +- .../AssignMembersDialog/messages.ts | 14 +- .../MembersErrorDialog.stories.tsx | 6 +- .../MembersErrorDialog/MembersErrorDialog.tsx | 4 +- .../PermissionGroupCreatePage.stories.tsx | 4 +- .../PermissionGroupCreatePage.tsx | 10 +- .../PermissionGroupDeleteDialog.stories.tsx | 10 +- .../PermissionGroupDeleteDialog.tsx | 10 +- .../PermissionGroupDetailsPage.stories.tsx | 6 +- .../PermissionGroupDetailsPage.tsx | 14 +- .../PermissionGroupInfo.tsx | 4 +- .../PermissionGroupList.tsx | 30 +- .../PermissionGroupListPage.stories.tsx | 8 +- .../PermissionGroupListPage.tsx | 2 +- .../PermissionGroupMemberList.tsx | 44 +- .../UnassignMembersDialog.stories.tsx | 6 +- .../UnassignMembersDialog.tsx | 6 +- src/permissionGroups/fixtures.ts | 94 +- src/permissionGroups/index.tsx | 8 +- src/permissionGroups/sort.ts | 2 +- src/permissionGroups/urls.ts | 10 +- src/permissionGroups/utils.ts | 16 +- .../PermissionGroupCreate.tsx | 26 +- .../PermissionGroupDetails.tsx | 44 +- .../PermissionGroupList.tsx | 32 +- .../views/PermissionGroupList/sort.ts | 4 +- .../PluginAuthorization.tsx | 18 +- .../PluginDetailsChannelsCard.tsx | 2 +- .../PluginDetailsChannelsCardContent.tsx | 10 +- .../PluginDetailsChannelsCard/messages.ts | 4 +- .../components/PluginInfo/PluginInfo.tsx | 20 +- .../PluginSecretFieldDialog.stories.tsx | 8 +- .../PluginSecretFieldDialog.tsx | 12 +- .../PluginSettings/PluginSettings.tsx | 28 +- .../PluginsDetailsPage/PluginsDetailsPage.tsx | 25 +- .../PluginsList/PluginAvailabilityStatus.tsx | 10 +- .../GlobalConfigPluginPopupBody.tsx | 6 +- .../PluginAvailabilityStatusPopup.tsx | 8 +- .../ScrollableContent.tsx | 6 +- .../PluginChannelAvailabilityCell.tsx | 2 +- .../PluginChannelConfigurationCell.tsx | 2 +- .../PluginsList/PluginListTableHead.tsx | 2 +- .../components/PluginsList/PluginsList.tsx | 12 +- .../components/PluginsList/messages.ts | 34 +- src/plugins/components/PluginsList/utils.ts | 12 +- .../PluginsListPage/PluginsListPage.tsx | 8 +- .../components/PluginsListPage/filters.ts | 48 +- .../components/PluginsListPage/messages.ts | 6 +- src/plugins/fixtures.ts | 44 +- src/plugins/index.tsx | 4 +- src/plugins/urls.ts | 6 +- src/plugins/utils.ts | 6 +- src/plugins/views/PluginDetails.test.ts | 32 +- src/plugins/views/PluginList/PluginList.tsx | 26 +- src/plugins/views/PluginList/filters.test.ts | 24 +- src/plugins/views/PluginList/filters.ts | 40 +- src/plugins/views/PluginList/sort.ts | 4 +- src/plugins/views/PluginsDetails.tsx | 48 +- src/plugins/views/utils.ts | 4 +- .../ProductTypeAttributes.tsx | 24 +- .../ProductTypeCreatePage.tsx | 19 +- .../ProductTypeDetails/ProductTypeDetails.tsx | 20 +- .../components/ProductTypeDetails/messages.ts | 10 +- .../ProductTypeDetailsPage.tsx | 25 +- .../ProductTypeList/ProductTypeList.tsx | 26 +- .../ProductTypeListPage.tsx | 10 +- .../components/ProductTypeListPage/filters.ts | 36 +- .../ProductTypeShipping.tsx | 10 +- .../ProductTypeTaxes/ProductTypeTaxes.tsx | 14 +- .../ProductTypeVariantAttributes.tsx | 52 +- src/productTypes/fixtures.ts | 322 ++-- src/productTypes/handlers.ts | 2 +- .../hooks/useProductTypeDelete/messages.ts | 26 +- .../useProductTypeDelete.tsx | 22 +- .../hooks/useProductTypeOperations.ts | 30 +- src/productTypes/index.tsx | 4 +- src/productTypes/urls.ts | 8 +- src/productTypes/views/ProductTypeCreate.tsx | 36 +- .../views/ProductTypeList/ProductTypeList.tsx | 46 +- .../views/ProductTypeList/filters.test.ts | 12 +- .../views/ProductTypeList/filters.ts | 34 +- .../views/ProductTypeList/sort.ts | 4 +- .../views/ProductTypeUpdate/index.tsx | 146 +- .../OrderDiscountProvider.tsx | 26 +- .../OrderLineDiscountProvider.tsx | 26 +- .../OrderDiscountProviders/types.ts | 2 +- .../OrderDiscountProviders/utils.ts | 12 +- .../ProductCategoryAndCollectionsForm.tsx | 8 +- .../ProductCreatePage/ProductCreatePage.tsx | 34 +- .../components/ProductCreatePage/form.tsx | 94 +- .../ProductDetailsForm/ProductDetailsForm.tsx | 8 +- .../ExportDialogSettings.tsx | 42 +- .../ProductExportDialog.stories.tsx | 10 +- .../ProductExportDialog.tsx | 84 +- .../ProductExportDialogInfo.tsx | 124 +- .../ProductExportDialog/messages.ts | 34 +- .../components/ProductExportDialog/types.ts | 4 +- .../ProductExternalMediaDialog.tsx | 10 +- .../components/ProductList/ProductList.tsx | 76 +- .../ProductListAttribute.stories.tsx | 28 +- .../ProductList/ProductListAttribute.tsx | 4 +- .../components/ProductList/messages.ts | 18 +- .../ProductListPage/ProductListPage.tsx | 62 +- .../components/ProductListPage/filters.ts | 108 +- .../components/ProductMedia/ProductMedia.tsx | 60 +- .../ProductMediaNavigation.tsx | 20 +- .../ProductMediaPage/ProductMediaPage.tsx | 24 +- .../ProductMediaPopper/ProductMediaPopper.tsx | 10 +- .../ProductOrganization.tsx | 30 +- .../ProductShipping/ProductShipping.tsx | 10 +- .../ProductStocks/CardAddItemsFooter.tsx | 8 +- .../ProductStocks/ProductStocks.tsx | 112 +- .../components/ProductTaxes/ProductTaxes.tsx | 24 +- .../ProductUpdatePage.test.tsx | 12 +- .../ProductUpdatePage/ProductUpdatePage.tsx | 52 +- .../components/ProductUpdatePage/form.tsx | 102 +- .../ProductVariantAttributes.tsx | 24 +- .../ProductVariantCheckoutSettings.tsx | 4 +- .../messages.ts | 8 +- .../ProductVariantCheckoutSettings/styles.ts | 6 +- .../ProductVariantCreateDialog.tsx | 12 +- .../ProductVariantCreateDialog/messages.ts | 14 +- .../ProductVariantCreateDialog/styles.ts | 8 +- .../ProductVariantCreateDialog/types.ts | 2 +- .../ProductVariantCreatePage.tsx | 38 +- .../ProductVariantCreatePage/form.tsx | 60 +- .../ProductVariantCreator.stories.tsx | 56 +- .../ProductVariantCreatorContent.tsx | 62 +- .../ProductVariantCreatorPage.tsx | 54 +- .../ProductVariantCreatorPriceAndSku.tsx | 12 +- .../ProductVariantCreatorPrices.tsx | 50 +- .../ProductVariantCreatorStock.tsx | 76 +- .../ProductVariantCreatorSummary.tsx | 76 +- .../ProductVariantCreatorTabs.tsx | 16 +- .../ProductVariantCreatorValues.tsx | 56 +- .../createVariants.test.ts | 90 +- .../createVariants.ts | 58 +- .../ProductVariantCreatorPage/fixtures.ts | 88 +- .../ProductVariantCreatorPage/form.ts | 14 +- .../ProductVariantCreatorPage/reducer.test.ts | 134 +- .../ProductVariantCreatorPage/reducer.ts | 190 +-- .../ProductVariantCreatorPage/types.ts | 2 +- .../ProductVariantCreatorPage/utils.ts | 30 +- .../ProductVariantDeleteDialog.tsx | 12 +- .../ProductVariantEndPreorderDialog.tsx | 10 +- .../messages.ts | 8 +- .../ProductVariantMediaSelectDialog.tsx | 20 +- .../ProductVariantMedia.tsx | 24 +- .../ProductVariantNavigation.tsx | 44 +- .../ProductVariantPage/ProductVariantPage.tsx | 48 +- ...tailsChannelsAvailabilityCardContainer.tsx | 2 +- .../index.tsx | 46 +- .../components/ProductVariantPage/form.tsx | 80 +- .../components/ProductVariantPage/messages.ts | 12 +- .../ProductVariantPrice.tsx | 50 +- .../ProductVariantSetDefault.tsx | 8 +- .../ProductVariants/ProductVariants.tsx | 102 +- src/products/fixtures.ts | 1414 ++++++++--------- src/products/index.tsx | 12 +- src/products/urls.ts | 20 +- src/products/utils/data.ts | 76 +- src/products/utils/handlers.ts | 38 +- .../views/ProductCreate/ProductCreate.tsx | 94 +- src/products/views/ProductCreate/handlers.ts | 54 +- src/products/views/ProductImage.tsx | 26 +- .../views/ProductList/ProductList.tsx | 148 +- .../views/ProductList/filters.test.ts | 6 +- src/products/views/ProductList/filters.ts | 126 +- src/products/views/ProductList/fixtures.ts | 52 +- src/products/views/ProductList/messages.ts | 6 +- src/products/views/ProductList/sort.ts | 12 +- .../views/ProductList/useSortRedirects.ts | 12 +- src/products/views/ProductList/utils.ts | 8 +- .../views/ProductUpdate/ProductUpdate.tsx | 179 +-- src/products/views/ProductUpdate/consts.ts | 2 +- .../views/ProductUpdate/handlers/index.ts | 84 +- .../views/ProductUpdate/handlers/utils.ts | 70 +- .../useChannelVariantListings.ts | 14 +- .../useChannelsWithProductVariants.test.ts | 78 +- .../useChannelsWithProductVariants.ts | 18 +- src/products/views/ProductUpdate/utils.ts | 55 +- src/products/views/ProductVariant.tsx | 106 +- src/products/views/ProductVariantCreate.tsx | 70 +- .../ProductVariantCreator.tsx | 30 +- src/products/views/messages.ts | 4 +- src/searches/useAttributeSearch.ts | 2 +- src/searches/useAttributeValueSearch.ts | 14 +- .../useAvailableInGridAttributesSearch.ts | 12 +- .../useAvailablePageAttributesSearch.ts | 16 +- .../useAvailableProductAttributeSearch.ts | 16 +- src/searches/useCategorySearch.ts | 2 +- src/searches/useCollectionSearch.ts | 2 +- src/searches/useCustomerSearch.ts | 2 +- src/searches/useGiftCardTagsSearch.ts | 2 +- src/searches/useOrderVariantSearch.ts | 2 +- src/searches/usePageSearch.ts | 4 +- src/searches/usePageTypeSearch.ts | 2 +- src/searches/usePermissionGroupSearch.ts | 2 +- src/searches/useProductSearch.ts | 2 +- src/searches/useProductTypeSearch.ts | 2 +- src/searches/useShippingZonesSearch.ts | 2 +- src/searches/useStaffMemberSearch.ts | 2 +- src/searches/useWarehouseSearch.ts | 2 +- src/services/errorTracking/adapters/Sentry.ts | 4 +- src/services/errorTracking/index.ts | 4 +- .../errorTracking/trackerFactory.test.ts | 8 +- src/services/errorTracking/trackerFactory.ts | 10 +- src/services/errorTracking/types.ts | 2 +- .../DeleteShippingRateDialog.stories.tsx | 4 +- .../DeleteShippingRateDialog.tsx | 6 +- .../OrderValue/OrderValue.stories.tsx | 4 +- .../components/OrderValue/OrderValue.tsx | 24 +- src/shipping/components/OrderValue/styles.ts | 20 +- .../OrderWeight/OrderWeight.stories.tsx | 4 +- .../components/OrderWeight/OrderWeight.tsx | 20 +- src/shipping/components/OrderWeight/styles.ts | 8 +- .../PricingCard/PricingCard.stories.tsx | 4 +- .../components/PricingCard/PricingCard.tsx | 14 +- src/shipping/components/PricingCard/styles.ts | 18 +- .../ShippingMethodProducts.stories.tsx | 6 +- .../ShippingMethodProducts.tsx | 20 +- ...hippingMethodProductsAddDialog.stories.tsx | 4 +- .../ShippingMethodProductsAddDialog.tsx | 48 +- .../ShippingRateInfo/ShippingRateInfo.tsx | 28 +- .../ShippingWeightUnitForm.tsx | 10 +- .../ShippingZoneAddWarehouseDialog.tsx | 24 +- .../ShippingZoneCountriesAssignDialog.tsx | 24 +- .../handlers.ts | 20 +- .../messages.ts | 20 +- .../styles.ts | 12 +- .../ShippingZoneCreatePage.tsx | 24 +- .../ShippingZoneDetailsPage.tsx | 28 +- .../ShippingZoneDetailsPage/utils.ts | 4 +- .../ShippingZoneInfo/ShippingZoneInfo.tsx | 28 +- .../ShippingZonePostalCodeRangeDialog.tsx | 18 +- .../ShippingZonePostalCodes.tsx | 44 +- .../ShippingZoneRates/ShippingZoneRates.tsx | 34 +- .../ShippingZoneRatesCreatePage.stories.tsx | 22 +- .../ShippingZoneRatesCreatePage.tsx | 26 +- .../ShippingZoneRatesPage.stories.tsx | 14 +- .../ShippingZoneRatesPage.tsx | 28 +- .../ChannelsSection.tsx | 12 +- .../ShippingZoneSettingsCard.stories.tsx | 24 +- .../ShippingZoneSettingsCard.tsx | 6 +- .../WarehousesSection.tsx | 16 +- .../ShippingZonesList/ShippingZonesList.tsx | 26 +- .../ShippingZonesListPage.tsx | 4 +- .../UnassignDialog/UnassignDialog.stories.tsx | 2 +- .../UnassignDialog/UnassignDialog.tsx | 8 +- src/shipping/errors.ts | 12 +- src/shipping/fixtures.ts | 762 ++++----- src/shipping/handlers.ts | 80 +- src/shipping/index.tsx | 4 +- src/shipping/urls.ts | 8 +- src/shipping/views/RateCreate.tsx | 32 +- src/shipping/views/RateUpdate.tsx | 88 +- src/shipping/views/ShippingZoneCreate.tsx | 22 +- .../views/ShippingZoneDetails/index.tsx | 112 +- src/shipping/views/ShippingZonesList.tsx | 64 +- src/shipping/views/reducer.tsx | 4 +- src/shipping/views/utils.tsx | 6 +- .../SiteCheckoutSettingsCard.tsx | 20 +- .../SiteCheckoutSettingsCard/messages.ts | 18 +- .../SiteSettingsPage/SiteSettingsPage.tsx | 28 +- .../components/SiteSettingsPage/messages.ts | 10 +- src/siteSettings/fixtures.ts | 12 +- src/siteSettings/views/index.tsx | 26 +- .../StaffAddMemberDialog.tsx | 18 +- .../StaffDetailsPage.stories.tsx | 4 +- .../StaffDetailsPage/StaffDetailsPage.tsx | 20 +- .../components/StaffDetailsPage/messages.ts | 4 +- .../components/StaffDetailsPage/styles.ts | 8 +- src/staff/components/StaffList/StaffList.tsx | 38 +- .../StaffListPage/StaffListPage.stories.tsx | 10 +- .../StaffListPage/StaffListPage.tsx | 16 +- src/staff/components/StaffListPage/filters.ts | 24 +- .../StaffPassword/StaffPassword.tsx | 2 +- .../StaffPasswordResetDialog.tsx | 16 +- .../StaffPreferences/StaffPreferences.tsx | 10 +- .../StaffProperties/StaffProperties.tsx | 38 +- .../components/UserStatus/UserStatus.tsx | 2 +- src/staff/components/UserStatus/messages.ts | 6 +- src/staff/fixtures.ts | 54 +- src/staff/index.tsx | 6 +- src/staff/urls.ts | 8 +- src/staff/utils.ts | 4 +- src/staff/views/StaffDetails.tsx | 82 +- src/staff/views/StaffList/StaffList.tsx | 52 +- src/staff/views/StaffList/filters.test.ts | 10 +- src/staff/views/StaffList/filters.ts | 26 +- src/staff/views/StaffList/sort.ts | 2 +- src/storybook/CardDecorator.tsx | 2 +- src/storybook/CentralPlacementDecorator.tsx | 2 +- src/storybook/Decorator.tsx | 4 +- src/storybook/Stories.test.ts | 4 +- src/storybook/UserDecorator.tsx | 2 +- src/storybook/misc.ts | 4 +- src/storybook/mock.tsx | 20 +- .../attributes/AttributeBulkDeleteDialog.tsx | 4 +- .../attributes/AttributeDeleteDialog.tsx | 4 +- .../stories/attributes/AttributeListPage.tsx | 18 +- .../stories/attributes/AttributePage.tsx | 10 +- .../attributes/AttributeValueDeleteDialog.tsx | 4 +- .../attributes/AttributeValueEditDialog.tsx | 8 +- .../stories/categories/CategoryCreatePage.tsx | 12 +- .../stories/categories/CategoryListPage.tsx | 8 +- .../stories/categories/CategoryUpdatePage.tsx | 14 +- .../collections/CollectionCreatePage.tsx | 12 +- .../collections/CollectionDetailsPage.tsx | 18 +- .../collections/CollectionListPage.tsx | 10 +- .../stories/components/AddressEdit.tsx | 2 +- .../components/AssignProductDialog.tsx | 4 +- .../components/AutocompleteSelectMenu.tsx | 30 +- src/storybook/stories/components/CardMenu.tsx | 2 +- src/storybook/stories/components/Checkbox.tsx | 6 +- .../stories/components/ColumnPicker.tsx | 8 +- .../components/DeleteFilterTabDialog.tsx | 4 +- .../stories/components/ErrorPage.tsx | 2 +- src/storybook/stories/components/Filter.tsx | 38 +- src/storybook/stories/components/Money.tsx | 4 +- .../stories/components/MoneyRange.tsx | 6 +- .../stories/components/MultiSelectField.tsx | 2 +- .../components/SaveFilterTabDialog.tsx | 4 +- .../stories/components/SingleSelectField.tsx | 6 +- src/storybook/stories/components/Timeline.tsx | 2 +- src/storybook/stories/components/Weight.tsx | 4 +- .../stories/components/WeightRange.tsx | 6 +- src/storybook/stories/components/messages.tsx | 6 +- .../configuration/ConfigurationPage.tsx | 8 +- .../customers/CustomerAddressDialog.tsx | 6 +- .../customers/CustomerAddressListPage.tsx | 4 +- .../stories/customers/CustomerCreatePage.tsx | 10 +- .../stories/customers/CustomerDetailsPage.tsx | 22 +- .../stories/customers/CustomerListPage.tsx | 18 +- .../stories/customers/MockedUserProvider.tsx | 4 +- .../discounts/DiscountCountrySelectDialog.tsx | 6 +- .../stories/discounts/SaleCreatePage.tsx | 6 +- .../stories/discounts/SaleDetailsPage.tsx | 6 +- .../stories/discounts/SaleListPage.tsx | 24 +- .../stories/discounts/VoucherCreatePage.tsx | 8 +- .../stories/discounts/VoucherDetailsPage.tsx | 10 +- .../stories/discounts/VoucherListPage.tsx | 30 +- src/storybook/stories/home/HomePage.tsx | 8 +- .../stories/navigation/MenuCreateDialog.tsx | 6 +- .../stories/navigation/MenuDetailsPage.tsx | 8 +- .../stories/navigation/MenuItemDialog.tsx | 14 +- .../stories/navigation/MenuListPage.tsx | 8 +- .../stories/orders/OrderBulkCancelDialog.tsx | 4 +- .../stories/orders/OrderCancelDialog.tsx | 8 +- .../stories/orders/OrderCustomer.tsx | 6 +- .../stories/orders/OrderDetailsPage.tsx | 34 +- .../stories/orders/OrderDraftCancelDialog.tsx | 8 +- .../stories/orders/OrderDraftListPage.tsx | 16 +- .../orders/OrderDraftPage/OrderDraftPage.tsx | 4 +- .../stories/orders/OrderDraftPage/utils.tsx | 12 +- .../orders/OrderFulfillmentCancelDialog.tsx | 8 +- .../orders/OrderFulfillmentTrackingDialog.tsx | 10 +- .../stories/orders/OrderInvoiceList.tsx | 4 +- .../stories/orders/OrderListPage.tsx | 36 +- .../stories/orders/OrderMarkAsPaidDialog.tsx | 8 +- .../stories/orders/OrderPaymentDialog.tsx | 10 +- .../stories/orders/OrderPaymentVoidDialog.tsx | 8 +- .../stories/orders/OrderProductAddDialog.tsx | 8 +- .../orders/OrderShippingMethodEditDialog.tsx | 10 +- .../stories/pages/PageDetailsPage.tsx | 8 +- src/storybook/stories/pages/PageListPage.tsx | 12 +- .../stories/plugins/PluginDetailsPage.tsx | 12 +- .../stories/plugins/PluginsListPage.tsx | 18 +- .../productTypes/ProductTypeCreatePage.tsx | 4 +- .../productTypes/ProductTypeDetailsPage.tsx | 6 +- .../productTypes/ProductTypeListPage.tsx | 14 +- .../stories/products/ProductCreatePage.tsx | 8 +- .../stories/products/ProductImagePage.tsx | 2 +- .../stories/products/ProductListPage.tsx | 12 +- .../stories/products/ProductUpdatePage.tsx | 40 +- .../products/ProductVariantCreatePage.tsx | 12 +- .../ProductVariantImageSelectDialog.tsx | 2 +- .../stories/products/ProductVariantPage.tsx | 14 +- .../ShippingZoneCountriesAssignDialog.tsx | 6 +- .../shipping/ShippingZoneCreatePage.tsx | 18 +- .../shipping/ShippingZoneDetailsPage.tsx | 6 +- .../shipping/ShippingZonesListPage.tsx | 6 +- .../stories/siteSettings/SiteSettingsPage.tsx | 8 +- .../stories/taxes/CountryListPage.tsx | 6 +- .../stories/taxes/CountryTaxesPage.tsx | 4 +- src/storybook/stories/taxes/fixtures.ts | 1068 ++++++------- .../TranslationsEntitiesListPage.tsx | 14 +- .../TranslationsLanguageListPage.tsx | 4 +- src/storybook/webpack.config.js | 14 +- src/styles/mixins.ts | 2 +- src/styles/useScrollableDialogStyle.ts | 16 +- src/sw.js | 28 +- .../components/CountryList/CountryList.tsx | 16 +- .../CountryListPage/CountryListPage.tsx | 6 +- .../CountryTaxesPage/CountryTaxesPage.tsx | 18 +- .../TaxConfiguration/TaxConfiguration.tsx | 12 +- src/taxes/index.tsx | 4 +- src/taxes/views/CountryList.tsx | 30 +- src/taxes/views/CountryTaxes.tsx | 2 +- src/themeOverrides.ts | 10 +- .../ProductContextSwitcher.tsx | 44 +- .../TranslationFields/TranslationFields.tsx | 48 +- .../TranslationFieldsLong.tsx | 4 +- .../TranslationFieldsRich.tsx | 10 +- .../TranslationFieldsSave.tsx | 12 +- .../TranslationFieldsShort.tsx | 4 +- .../TranslationsAttributesPage.tsx | 26 +- .../TranslationsAttributesPage/messages.ts | 6 +- .../TranslationsCategoriesPage.tsx | 36 +- .../TranslationsCollectionsPage.tsx | 38 +- .../TranslationsEntitiesList.tsx | 22 +- .../TranslationsEntitiesListPage.tsx | 26 +- .../TranslationsLanguageList.tsx | 14 +- .../TranslationsLanguageListPage.tsx | 4 +- .../TranslationsPagesPage.tsx | 44 +- .../TranslationsProductVariantsPage.tsx | 30 +- .../TranslationsProductsPage.tsx | 46 +- .../TranslationsSalesPage.tsx | 20 +- .../TranslationsShippingMethodPage.tsx | 28 +- .../TranslationsVouchersPage.tsx | 22 +- src/translations/fixtures.ts | 10 +- src/translations/index.tsx | 76 +- src/translations/types.ts | 6 +- src/translations/urls.ts | 8 +- src/translations/utils.ts | 16 +- .../EntityLists/TranslationsAttributeList.tsx | 14 +- .../EntityLists/TranslationsCategoryList.tsx | 18 +- .../TranslationsCollectionList.tsx | 18 +- .../EntityLists/TranslationsPageList.tsx | 16 +- .../EntityLists/TranslationsProductList.tsx | 20 +- .../EntityLists/TranslationsSaleList.tsx | 14 +- .../TranslationsShippingMethodList.tsx | 18 +- .../EntityLists/TranslationsVoucherList.tsx | 16 +- .../views/TranslationsAttributes.tsx | 52 +- .../views/TranslationsCategories.tsx | 26 +- .../views/TranslationsCollections.tsx | 26 +- .../views/TranslationsEntities.tsx | 48 +- src/translations/views/TranslationsPages.tsx | 38 +- .../views/TranslationsProductVariants.tsx | 38 +- .../views/TranslationsProducts.tsx | 38 +- src/translations/views/TranslationsSales.tsx | 26 +- .../views/TranslationsShippingMethod.tsx | 24 +- .../views/TranslationsVouchers.tsx | 26 +- src/types.ts | 6 +- src/utils/api.ts | 4 +- src/utils/arrays/arrays.test.ts | 8 +- src/utils/arrays/arrays.ts | 2 +- src/utils/columns/DisplayColumn.tsx | 4 +- src/utils/credentialsManagement.ts | 6 +- src/utils/data/getPublicationData.ts | 4 +- src/utils/errors/account.ts | 18 +- src/utils/errors/app.ts | 18 +- src/utils/errors/attribute.ts | 10 +- src/utils/errors/channels.ts | 10 +- src/utils/errors/common.ts | 10 +- src/utils/errors/discounts.ts | 6 +- src/utils/errors/export.ts | 2 +- src/utils/errors/index.ts | 10 +- src/utils/errors/invoice.ts | 16 +- src/utils/errors/menu.ts | 2 +- src/utils/errors/order.ts | 30 +- src/utils/errors/page.ts | 12 +- src/utils/errors/permissionGroups.ts | 16 +- src/utils/errors/plugins.ts | 8 +- src/utils/errors/product.ts | 38 +- src/utils/errors/shipping.ts | 8 +- src/utils/errors/shop.ts | 6 +- src/utils/errors/staff.ts | 2 +- src/utils/errors/stock.ts | 10 +- src/utils/errors/warehouse.ts | 8 +- src/utils/errors/webhooks.ts | 2 +- src/utils/filters/fields.ts | 44 +- src/utils/filters/filters.ts | 41 +- src/utils/filters/storage.ts | 14 +- .../handlers/attributeValueSearchHandler.ts | 16 +- src/utils/handlers/dialogActionHandlers.ts | 10 +- src/utils/handlers/filterHandlers.ts | 14 +- src/utils/handlers/metadataCreateHandler.ts | 16 +- src/utils/handlers/metadataUpdateHandler.ts | 22 +- src/utils/handlers/metadataUpdateHelpers.ts | 4 +- .../multiAutocompleteSelectChangeHandler.ts | 2 +- .../handlers/multiFileUploadHandler.test.ts | 10 +- src/utils/handlers/multiFileUploadHandler.ts | 6 +- src/utils/handlers/queryChangeHandler.ts | 2 +- .../singleAutocompleteSelectChangeHandler.ts | 2 +- src/utils/handlers/sortHandler.ts | 6 +- src/utils/limits.ts | 4 +- src/utils/lists/lists.test.ts | 10 +- src/utils/lists/lists.ts | 14 +- src/utils/maps.ts | 36 +- src/utils/menu/menu.test.ts | 52 +- src/utils/menu/menu.ts | 38 +- src/utils/metadata/getMetadata.ts | 4 +- .../metadata/useMetadataChangeTrigger.ts | 6 +- src/utils/objects/useMap.ts | 6 +- src/utils/richText/__mocks__/useRichText.ts | 4 +- src/utils/richText/context.ts | 2 +- src/utils/richText/misc.ts | 2 +- src/utils/richText/useMultipleRichText.ts | 18 +- src/utils/richText/useRichText.test.ts | 20 +- src/utils/richText/useRichText.ts | 4 +- src/utils/sort.ts | 20 +- src/utils/tables.ts | 2 +- src/utils/urls.ts | 2 +- .../WarehouseCreatePage.stories.tsx | 10 +- .../WarehouseCreatePage.tsx | 14 +- .../WarehouseDeleteDialog.tsx | 6 +- .../WarehouseDetailsPage.stories.tsx | 10 +- .../WarehouseDetailsPage.tsx | 16 +- .../WarehouseInfo/WarehouseInfo.tsx | 8 +- .../WarehouseList/WarehouseList.tsx | 30 +- .../WarehouseListPage.stories.tsx | 8 +- .../WarehouseListPage/WarehouseListPage.tsx | 18 +- .../WarehouseSettings/WarehouseSettings.tsx | 36 +- .../components/WarehouseSettings/messages.ts | 28 +- src/warehouses/fixtures.ts | 32 +- src/warehouses/index.tsx | 6 +- src/warehouses/urls.ts | 6 +- .../views/WarehouseCreate/WarehouseCreate.tsx | 20 +- .../WarehouseDetails/WarehouseDetails.tsx | 32 +- .../views/WarehouseList/WarehouseList.tsx | 38 +- src/warehouses/views/WarehouseList/filters.ts | 14 +- src/warehouses/views/WarehouseList/sort.ts | 4 +- .../WebhookDeleteDialog.stories.tsx | 4 +- .../WebhookDeleteDialog.tsx | 6 +- .../WebhookDetailsPage.stories.tsx | 6 +- .../WebhookDetailsPage/WebhookDetailsPage.tsx | 16 +- .../components/WebhookDetailsPage/messages.ts | 12 +- .../WebhookEvents/WebhookEvents.tsx | 10 +- .../components/WebhookEvents/messages.ts | 14 +- .../components/WebhookInfo/WebhookInfo.tsx | 2 +- .../components/WebhookInfo/messages.ts | 14 +- .../WebhookStatus/WebhookStatus.tsx | 2 +- .../components/WebhookStatus/messages.ts | 8 +- .../WebhooksDetailsPage.tsx | 16 +- .../WebhooksDetailsPage/messages.ts | 12 +- .../components/WebhooksList/WebhooksList.tsx | 16 +- .../components/WebhooksList/styles.ts | 24 +- src/webhooks/fixtures.ts | 4 +- src/webhooks/handlers.ts | 14 +- src/webhooks/utils.ts | 16 +- src/webhooks/views/WebhooksCreate.tsx | 18 +- src/webhooks/views/WebhooksDetails.tsx | 18 +- testUtils/api.ts | 14 +- testUtils/intl.ts | 2 +- testUtils/wrapper.tsx | 2 +- 1539 files changed, 18628 insertions(+), 18574 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index da51dffa0..e2a18d0e2 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -76,7 +76,7 @@ "camelcase": "off", "capitalized-comments": "off", "chai-friendly/no-unused-expressions": "error", - "comma-dangle": "off", + "comma-dangle": ["error", "always-multiline"], "complexity": "off", "constructor-super": "error", "curly": "error", diff --git a/.prettierrc b/.prettierrc index 1f5e5d140..87bc023e0 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,4 +1,4 @@ { "arrowParens": "avoid", - "trailingComma": "none" + "trailingComma": "all" } diff --git a/src/apps/apolloMocks.ts b/src/apps/apolloMocks.ts index 7b8a5a01d..4ce95f11b 100644 --- a/src/apps/apolloMocks.ts +++ b/src/apps/apolloMocks.ts @@ -5,10 +5,10 @@ import { extensionList } from "./queries"; export const mocks: MockedResponse[] = [ { request: { - query: extensionList + query: extensionList, }, result: { - data: [] - } - } + data: [], + }, + }, ]; diff --git a/src/apps/components/AppActivateDialog/AppActivateDialog.stories.tsx b/src/apps/components/AppActivateDialog/AppActivateDialog.stories.tsx index cd54d8776..27816d680 100644 --- a/src/apps/components/AppActivateDialog/AppActivateDialog.stories.tsx +++ b/src/apps/components/AppActivateDialog/AppActivateDialog.stories.tsx @@ -9,7 +9,7 @@ const props: AppActivateDialogProps = { name: "App", onClose: () => undefined, onConfirm: () => undefined, - open: true + open: true, }; storiesOf("Views / Apps / Activate app", module) diff --git a/src/apps/components/AppActivateDialog/AppActivateDialog.tsx b/src/apps/components/AppActivateDialog/AppActivateDialog.tsx index c65189e70..02a4bffa5 100644 --- a/src/apps/components/AppActivateDialog/AppActivateDialog.tsx +++ b/src/apps/components/AppActivateDialog/AppActivateDialog.tsx @@ -18,7 +18,7 @@ const AppActivateDialog: React.FC = ({ open, name, onClose, - onConfirm + onConfirm, }) => { const intl = useIntl(); @@ -27,7 +27,7 @@ const AppActivateDialog: React.FC = ({ confirmButtonLabel={intl.formatMessage({ id: "D3E2b5", defaultMessage: "Activate", - description: "button label" + description: "button label", })} confirmButtonState={confirmButtonState} open={open} @@ -36,7 +36,7 @@ const AppActivateDialog: React.FC = ({ title={intl.formatMessage({ id: "YHNozE", defaultMessage: "Activate App", - description: "dialog header" + description: "dialog header", })} variant="default" > @@ -53,7 +53,7 @@ const AppActivateDialog: React.FC = ({ defaultMessage="Are you sure you want to activate {name}? Activating will start gathering events." description="activate app" values={{ - name: {getStringOrPlaceholder(name)} + name: {getStringOrPlaceholder(name)}, }} /> )} diff --git a/src/apps/components/AppDeactivateDialog/AppDeactivateDialog.stories.tsx b/src/apps/components/AppDeactivateDialog/AppDeactivateDialog.stories.tsx index 00cb9a903..456e1db3c 100644 --- a/src/apps/components/AppDeactivateDialog/AppDeactivateDialog.stories.tsx +++ b/src/apps/components/AppDeactivateDialog/AppDeactivateDialog.stories.tsx @@ -3,7 +3,7 @@ import { storiesOf } from "@storybook/react"; import React from "react"; import AppDeactivateDialog, { - AppDeactivateDialogProps + AppDeactivateDialogProps, } from "./AppDeactivateDialog"; const props: AppDeactivateDialogProps = { @@ -11,7 +11,7 @@ const props: AppDeactivateDialogProps = { name: "App", onClose: () => undefined, onConfirm: () => undefined, - open: true + open: true, }; storiesOf("Views / Apps / Deactivate app", module) diff --git a/src/apps/components/AppDeactivateDialog/AppDeactivateDialog.tsx b/src/apps/components/AppDeactivateDialog/AppDeactivateDialog.tsx index db503c044..0491498ee 100644 --- a/src/apps/components/AppDeactivateDialog/AppDeactivateDialog.tsx +++ b/src/apps/components/AppDeactivateDialog/AppDeactivateDialog.tsx @@ -22,7 +22,7 @@ const AppDeactivateDialog: React.FC = ({ name, thirdParty = true, onClose, - onConfirm + onConfirm, }) => { const intl = useIntl(); @@ -31,7 +31,7 @@ const AppDeactivateDialog: React.FC = ({ confirmButtonLabel={intl.formatMessage({ id: "W+AFZY", defaultMessage: "Deactivate", - description: "button label" + description: "button label", })} confirmButtonState={confirmButtonState} open={open} @@ -40,7 +40,7 @@ const AppDeactivateDialog: React.FC = ({ title={intl.formatMessage({ id: "yMi8I8", defaultMessage: "Dectivate App", - description: "dialog header" + description: "dialog header", })} variant="delete" > @@ -55,7 +55,7 @@ const AppDeactivateDialog: React.FC = ({ ? msgs.deactivateNamedApp : msgs.deactivateLocalNamedApp)} values={{ - name: {getStringOrPlaceholder(name)} + name: {getStringOrPlaceholder(name)}, }} /> )} diff --git a/src/apps/components/AppDeactivateDialog/messages.ts b/src/apps/components/AppDeactivateDialog/messages.ts index bf229e083..bb0157435 100644 --- a/src/apps/components/AppDeactivateDialog/messages.ts +++ b/src/apps/components/AppDeactivateDialog/messages.ts @@ -5,24 +5,24 @@ export default defineMessages({ id: "73RU3R", defaultMessage: "Are you sure you want to disable this app? Your data will be kept until you reactivate the app. You will be still billed for the app.", - description: "deactivate app" + description: "deactivate app", }, deactivateNamedApp: { id: "w6Gau0", defaultMessage: "Are you sure you want to disable {name}? Your data will be kept until you reactivate the app. You will be still billed for the app.", - description: "deactivate named app" + description: "deactivate named app", }, deactivateLocalApp: { id: "7O2EsY", defaultMessage: "Are you sure you want to disable this app? Your data will be kept until you reactivate the app.", - description: "deactivate local app" + description: "deactivate local app", }, deactivateLocalNamedApp: { id: "Np7J92", defaultMessage: "Are you sure you want to disable {name}? Your data will be kept until you reactivate the app.", - description: "deactivate local named app" - } + description: "deactivate local named app", + }, }); diff --git a/src/apps/components/AppDeleteDialog/AppDeleteDialog.stories.tsx b/src/apps/components/AppDeleteDialog/AppDeleteDialog.stories.tsx index 43f19486a..cf9e00eba 100644 --- a/src/apps/components/AppDeleteDialog/AppDeleteDialog.stories.tsx +++ b/src/apps/components/AppDeleteDialog/AppDeleteDialog.stories.tsx @@ -10,7 +10,7 @@ const props: AppDeleteDialogProps = { onClose: () => undefined, onConfirm: () => undefined, open: true, - type: "EXTERNAL" + type: "EXTERNAL", }; storiesOf("Views / Apps / Delete app", module) diff --git a/src/apps/components/AppDeleteDialog/AppDeleteDialog.tsx b/src/apps/components/AppDeleteDialog/AppDeleteDialog.tsx index 04b3d3c67..71c9d0c98 100644 --- a/src/apps/components/AppDeleteDialog/AppDeleteDialog.tsx +++ b/src/apps/components/AppDeleteDialog/AppDeleteDialog.tsx @@ -20,7 +20,7 @@ const AppDeleteDialog: React.FC = ({ name, onClose, onConfirm, - type + type, }) => { const intl = useIntl(); @@ -33,7 +33,7 @@ const AppDeleteDialog: React.FC = ({ title={intl.formatMessage({ id: "zQX6xO", defaultMessage: "Delete App", - description: "dialog header" + description: "dialog header", })} variant="delete" > @@ -50,7 +50,7 @@ const AppDeleteDialog: React.FC = ({ defaultMessage="Deleting {name}, you will remove installation of the app. If you are paying for app subscription, remember to unsubscribe from the app in Saleor Marketplace. Are you sure you want to delete the app?" description="delete app" values={{ - name: {getStringOrPlaceholder(name)} + name: {getStringOrPlaceholder(name)}, }} /> ) : ( @@ -59,7 +59,7 @@ const AppDeleteDialog: React.FC = ({ defaultMessage="Deleting {name}, you will delete all the data and webhooks regarding this app. Are you sure you want to do that?" description="delete custom app" values={{ - name: {getStringOrPlaceholder(name)} + name: {getStringOrPlaceholder(name)}, }} /> )} diff --git a/src/apps/components/AppDetailsPage/AppDetailsPage.stories.tsx b/src/apps/components/AppDetailsPage/AppDetailsPage.stories.tsx index 644e6faf4..2b8f8d13e 100644 --- a/src/apps/components/AppDetailsPage/AppDetailsPage.stories.tsx +++ b/src/apps/components/AppDetailsPage/AppDetailsPage.stories.tsx @@ -10,7 +10,7 @@ const props: AppDetailsPageProps = { loading: false, navigateToApp: () => undefined, onAppActivateOpen: () => undefined, - onAppDeactivateOpen: () => undefined + onAppDeactivateOpen: () => undefined, }; storiesOf("Views / Apps / App details", module) diff --git a/src/apps/components/AppDetailsPage/AppDetailsPage.tsx b/src/apps/components/AppDetailsPage/AppDetailsPage.tsx index 7c25ec3bb..a433b10cb 100644 --- a/src/apps/components/AppDetailsPage/AppDetailsPage.tsx +++ b/src/apps/components/AppDetailsPage/AppDetailsPage.tsx @@ -33,7 +33,7 @@ export const AppDetailsPage: React.FC = ({ loading, navigateToApp, onAppActivateOpen, - onAppDeactivateOpen + onAppDeactivateOpen, }) => { const intl = useIntl(); const classes = useStyles({}); @@ -105,7 +105,7 @@ export const AppDetailsPage: React.FC = ({ title={intl.formatMessage({ id: "jDIRQV", defaultMessage: "About this app", - description: "section header" + description: "section header", })} /> @@ -118,7 +118,7 @@ export const AppDetailsPage: React.FC = ({ title={intl.formatMessage({ id: "VsGcdP", defaultMessage: "App permissions", - description: "section header" + description: "section header", })} /> @@ -152,7 +152,7 @@ export const AppDetailsPage: React.FC = ({ title={intl.formatMessage({ id: "a55zOn", defaultMessage: "Data privacy", - description: "section header" + description: "section header", })} /> diff --git a/src/apps/components/AppDialog/AppDialog.tsx b/src/apps/components/AppDialog/AppDialog.tsx index 9e0325514..d2cddc4a7 100644 --- a/src/apps/components/AppDialog/AppDialog.tsx +++ b/src/apps/components/AppDialog/AppDialog.tsx @@ -4,7 +4,7 @@ import { DialogProps, DialogTitle, IconButton, - Typography + Typography, } from "@material-ui/core"; import CloseIcon from "@material-ui/icons/Close"; import React from "react"; diff --git a/src/apps/components/AppDialog/styles.ts b/src/apps/components/AppDialog/styles.ts index c66b0f9a8..2066b06c9 100644 --- a/src/apps/components/AppDialog/styles.ts +++ b/src/apps/components/AppDialog/styles.ts @@ -5,15 +5,15 @@ export const useStyles = makeStyles( header: { display: "flex", justifyContent: "space-between", - alignItems: "center" + alignItems: "center", }, content: { margin: 0, padding: 0, overflow: "hidden", width: 600, - height: 600 - } + height: 600, + }, }), - { name: "AppDialog" } + { name: "AppDialog" }, ); diff --git a/src/apps/components/AppFrame/AppFrame.tsx b/src/apps/components/AppFrame/AppFrame.tsx index acf50dd79..8f846657e 100644 --- a/src/apps/components/AppFrame/AppFrame.tsx +++ b/src/apps/components/AppFrame/AppFrame.tsx @@ -24,7 +24,7 @@ export const AppFrame: React.FC = ({ appId, className, onLoad, - onError + onError, }) => { const shop = useShop(); const frameRef = React.useRef(); @@ -38,8 +38,8 @@ export const AppFrame: React.FC = ({ type: "handshake", payload: { token: appToken, - version: 1 - } + version: 1, + }, }); sendThemeToExtension(); diff --git a/src/apps/components/AppFrame/styles.ts b/src/apps/components/AppFrame/styles.ts index 10a03739b..74445c16e 100644 --- a/src/apps/components/AppFrame/styles.ts +++ b/src/apps/components/AppFrame/styles.ts @@ -5,8 +5,8 @@ export const useStyles = makeStyles( iframe: { width: "100%", height: "100%", - border: "none" - } + border: "none", + }, }), - { name: "AppFrame" } + { name: "AppFrame" }, ); diff --git a/src/apps/components/AppFrame/useAppActions.ts b/src/apps/components/AppFrame/useAppActions.ts index 12761bfdd..16f387536 100644 --- a/src/apps/components/AppFrame/useAppActions.ts +++ b/src/apps/components/AppFrame/useAppActions.ts @@ -7,25 +7,25 @@ import { useExternalApp } from "../ExternalAppContext"; const sendResponseStatus = ( actionId: string, - ok: boolean + ok: boolean, ): DispatchResponseEvent => ({ type: "response", payload: { actionId, - ok - } + ok, + }, }); export const useAppActions = ( frameEl: React.MutableRefObject, - appOrigin: string + appOrigin: string, ) => { const navigate = useNavigator(); const { closeApp } = useExternalApp(); const intl = useIntl(); const actionReducer = ( - action: Actions | undefined + action: Actions | undefined, ): DispatchResponseEvent => { switch (action?.type) { case "redirect": { @@ -48,8 +48,8 @@ export const useAppActions = ( intl.formatMessage({ id: "MSItJD", defaultMessage: - "You are about to leave the Dashboard. Do you want to continue?" - }) + "You are about to leave the Dashboard. Do you want to continue?", + }), ); } @@ -92,6 +92,6 @@ export const useAppActions = ( }, []); return { - postToExtension + postToExtension, }; }; diff --git a/src/apps/components/AppInProgressDeleteDialog/AppInProgressDeleteDialog.stories.tsx b/src/apps/components/AppInProgressDeleteDialog/AppInProgressDeleteDialog.stories.tsx index fc8598add..c72c53cd1 100644 --- a/src/apps/components/AppInProgressDeleteDialog/AppInProgressDeleteDialog.stories.tsx +++ b/src/apps/components/AppInProgressDeleteDialog/AppInProgressDeleteDialog.stories.tsx @@ -3,7 +3,7 @@ import { storiesOf } from "@storybook/react"; import React from "react"; import AppInProgressDeleteDialog, { - AppInProgressDeleteDialogProps + AppInProgressDeleteDialogProps, } from "./AppInProgressDeleteDialog"; const props: AppInProgressDeleteDialogProps = { @@ -11,7 +11,7 @@ const props: AppInProgressDeleteDialogProps = { name: "App", onClose: () => undefined, onConfirm: () => undefined, - open: true + open: true, }; storiesOf("Views / Apps / Delete app failed installation", module) diff --git a/src/apps/components/AppInProgressDeleteDialog/AppInProgressDeleteDialog.tsx b/src/apps/components/AppInProgressDeleteDialog/AppInProgressDeleteDialog.tsx index cea329ac8..ad3e0992b 100644 --- a/src/apps/components/AppInProgressDeleteDialog/AppInProgressDeleteDialog.tsx +++ b/src/apps/components/AppInProgressDeleteDialog/AppInProgressDeleteDialog.tsx @@ -18,7 +18,7 @@ const AppInProgressDeleteDialog: React.FC = ({ open, name, onClose, - onConfirm + onConfirm, }) => { const intl = useIntl(); @@ -31,7 +31,7 @@ const AppInProgressDeleteDialog: React.FC = ({ title={intl.formatMessage({ id: "zQX6xO", defaultMessage: "Delete App", - description: "dialog header" + description: "dialog header", })} variant="delete" > @@ -48,7 +48,7 @@ const AppInProgressDeleteDialog: React.FC = ({ defaultMessage="Deleting {name}, you will remove installation of the app. If you are paying for app subscription, remember to unsubscribe from the app in Saleor Marketplace. Are you sure you want to delete the app?" description="delete app" values={{ - name: {getStringOrPlaceholder(name)} + name: {getStringOrPlaceholder(name)}, }} /> )} diff --git a/src/apps/components/AppInstallErrorPage/AppInstallErrorPage.tsx b/src/apps/components/AppInstallErrorPage/AppInstallErrorPage.tsx index a5754d99e..26b009ed6 100644 --- a/src/apps/components/AppInstallErrorPage/AppInstallErrorPage.tsx +++ b/src/apps/components/AppInstallErrorPage/AppInstallErrorPage.tsx @@ -12,7 +12,7 @@ interface AppInstallErrorPageProps { } export const AppInstallErrorPage: React.FC = ({ - onBack + onBack, }) => { const classes = useStyles({}); diff --git a/src/apps/components/AppInstallErrorPage/styles.ts b/src/apps/components/AppInstallErrorPage/styles.ts index a71dc440e..270150971 100644 --- a/src/apps/components/AppInstallErrorPage/styles.ts +++ b/src/apps/components/AppInstallErrorPage/styles.ts @@ -4,23 +4,23 @@ export const useStyles = makeStyles( theme => ({ button: { marginTop: theme.spacing(2), - padding: theme.spacing(1.5, 2) + padding: theme.spacing(1.5, 2), }, root: { "& > div": { - minHeight: "80vh" + minHeight: "80vh", }, "& h3": { fontWeight: 600, marginBottom: theme.spacing(3), - maxWidth: theme.spacing(60) + maxWidth: theme.spacing(60), }, "& img": { - maxWidth: "100%" - } - } + maxWidth: "100%", + }, + }, }), { - name: "AppInstallErrorPage" - } + name: "AppInstallErrorPage", + }, ); diff --git a/src/apps/components/AppInstallPage/AppInstallPage.stories.tsx b/src/apps/components/AppInstallPage/AppInstallPage.stories.tsx index 4847c70b0..532c93f70 100644 --- a/src/apps/components/AppInstallPage/AppInstallPage.stories.tsx +++ b/src/apps/components/AppInstallPage/AppInstallPage.stories.tsx @@ -9,7 +9,7 @@ const props: AppInstallPageProps = { data: installApp, loading: false, navigateToAppsList: () => undefined, - onSubmit: () => undefined + onSubmit: () => undefined, }; storiesOf("Views / Apps / Install App", module) diff --git a/src/apps/components/AppInstallPage/AppInstallPage.tsx b/src/apps/components/AppInstallPage/AppInstallPage.tsx index 36125000c..6c30ba76b 100644 --- a/src/apps/components/AppInstallPage/AppInstallPage.tsx +++ b/src/apps/components/AppInstallPage/AppInstallPage.tsx @@ -27,7 +27,7 @@ export const AppInstallPage: React.FC = ({ data, loading, navigateToAppsList, - onSubmit + onSubmit, }) => { const intl = useIntl(); const classes = useStyles({}); @@ -47,9 +47,9 @@ export const AppInstallPage: React.FC = ({ { id: "Id7C0X", defaultMessage: `You are about to install {name}`, - description: "section header" + description: "section header", }, - { name } + { name }, ) ) } @@ -62,7 +62,7 @@ export const AppInstallPage: React.FC = ({
@@ -81,7 +81,7 @@ export const AppInstallPage: React.FC = ({ title={intl.formatMessage({ id: "VsGcdP", defaultMessage: "App permissions", - description: "section header" + description: "section header", })} /> diff --git a/src/apps/components/AppPage/AppPage.stories.tsx b/src/apps/components/AppPage/AppPage.stories.tsx index 9b7e49bc6..4ef7c2cde 100644 --- a/src/apps/components/AppPage/AppPage.stories.tsx +++ b/src/apps/components/AppPage/AppPage.stories.tsx @@ -9,7 +9,7 @@ const props: AppPageProps = { data: appDetails, url: appDetails.appUrl, aboutHref: "", - onError: () => undefined + onError: () => undefined, }; storiesOf("Views / Apps / App", module) diff --git a/src/apps/components/AppPage/AppPage.tsx b/src/apps/components/AppPage/AppPage.tsx index 9394178fe..3b0443c2d 100644 --- a/src/apps/components/AppPage/AppPage.tsx +++ b/src/apps/components/AppPage/AppPage.tsx @@ -27,7 +27,7 @@ export const AppPage: React.FC = ({ data, url, aboutHref, - onError + onError, }) => { const intl = useIntl(); const classes = useStyles({}); @@ -44,7 +44,7 @@ export const AppPage: React.FC = ({ diff --git a/src/apps/components/AppPage/styles.ts b/src/apps/components/AppPage/styles.ts index ff4427a94..6421a170b 100644 --- a/src/apps/components/AppPage/styles.ts +++ b/src/apps/components/AppPage/styles.ts @@ -5,12 +5,12 @@ export const useStyles = makeStyles( appSettingsHeader: { "& > button, & > a": { "&:last-child": { - marginRight: 0 + marginRight: 0, }, - marginRight: theme.spacing(2) + marginRight: theme.spacing(2), }, display: "flex", - justifyContent: "flex-end" + justifyContent: "flex-end", }, breadcrumb: { "&:not(:last-child)": { @@ -19,28 +19,28 @@ export const useStyles = makeStyles( display: "block", position: "absolute", right: theme.spacing(-2), - top: 0 + top: 0, }, "&:not(:first-child):hover": { cursor: "pointer", - textDecoration: "underline" - } + textDecoration: "underline", + }, }, marginRight: theme.spacing(3), - position: "relative" + position: "relative", }, breadcrumbContainer: { alignItems: "center", - display: "flex" + display: "flex", }, breadcrumbDisabled: { "&:hover": { - textDecoration: "none" + textDecoration: "none", }, - color: theme.palette.text.disabled + color: theme.palette.text.disabled, }, breadcrumbs: { - display: "flex" + display: "flex", }, hr: { border: "none", @@ -48,15 +48,15 @@ export const useStyles = makeStyles( height: 0, marginBottom: 0, marginTop: 0, - width: "100%" + width: "100%", }, iframeContainer: { "& > iframe": { border: "none", minHeight: "75vh", - width: "100%" - } - } + width: "100%", + }, + }, }), - { name: "AppPage" } + { name: "AppPage" }, ); diff --git a/src/apps/components/AppPage/useSettingsBreadcrumbs.ts b/src/apps/components/AppPage/useSettingsBreadcrumbs.ts index 8db5f7bf1..057104ed2 100644 --- a/src/apps/components/AppPage/useSettingsBreadcrumbs.ts +++ b/src/apps/components/AppPage/useSettingsBreadcrumbs.ts @@ -5,7 +5,7 @@ import { ExtensionMessageEvent, ExtensionMessageType, sendMessageToExtension, - useExtensionMessage + useExtensionMessage, } from "@saleor/macaw-ui"; import { useState } from "react"; @@ -14,7 +14,7 @@ function useSettingsBreadcrumbs(): UseSettingsBreadcrumbs { const [breadcrumbs, setBreadcrumbs] = useState([]); const handleBreadcrumbSet = ( - event: ExtensionMessageEvent + event: ExtensionMessageEvent, ) => { if (event.data.type === ExtensionMessageType.BREADCRUMB_SET) { setBreadcrumbs(event.data.breadcrumbs); @@ -27,9 +27,9 @@ function useSettingsBreadcrumbs(): UseSettingsBreadcrumbs { sendMessageToExtension( { breadcrumb: value, - type: ExtensionMessageType.BREADCRUMB_CLICK + type: ExtensionMessageType.BREADCRUMB_CLICK, }, - "*" + "*", ); return [breadcrumbs, handleBreadcrumbClick]; diff --git a/src/apps/components/AppPermissions/AppPermissions.tsx b/src/apps/components/AppPermissions/AppPermissions.tsx index 4a388acf8..a18e8bc89 100644 --- a/src/apps/components/AppPermissions/AppPermissions.tsx +++ b/src/apps/components/AppPermissions/AppPermissions.tsx @@ -3,7 +3,7 @@ import { IconButton, makeStyles, PermissionsIcon, - Tooltip + Tooltip, } from "@saleor/macaw-ui"; import React from "react"; import { FormattedMessage } from "react-intl"; @@ -12,10 +12,10 @@ const useStyles = makeStyles( () => ({ list: { margin: 0, - paddingLeft: "16px" - } + paddingLeft: "16px", + }, }), - { name: "AppPermissions" } + { name: "AppPermissions" }, ); interface AppPermissionsProps { diff --git a/src/apps/components/AppsInProgress/AppsInProgress.tsx b/src/apps/components/AppsInProgress/AppsInProgress.tsx index e9aa9c4e1..2f4a58409 100644 --- a/src/apps/components/AppsInProgress/AppsInProgress.tsx +++ b/src/apps/components/AppsInProgress/AppsInProgress.tsx @@ -4,7 +4,7 @@ import { TableBody, TableCell, TableRow, - Typography + Typography, } from "@material-ui/core"; import { Button } from "@saleor/components/Button"; import CardTitle from "@saleor/components/CardTitle"; @@ -16,7 +16,7 @@ import { Indicator, ResponsiveTable, Tooltip, - TooltipMountWrapper + TooltipMountWrapper, } from "@saleor/macaw-ui"; import { renderCollection } from "@saleor/misc"; import classNames from "classnames"; @@ -48,7 +48,7 @@ const AppsInProgress: React.FC = ({ title={intl.formatMessage({ id: "nIrjSR", defaultMessage: "Ongoing Installations", - description: "section header" + description: "section header", })} /> @@ -62,7 +62,7 @@ const AppsInProgress: React.FC = ({ @@ -81,7 +81,7 @@ const AppsInProgress: React.FC = ({ diff --git a/src/apps/components/AppsListPage/AppListPage.stories.tsx b/src/apps/components/AppsListPage/AppListPage.stories.tsx index bd182c9fc..5a4de8b26 100644 --- a/src/apps/components/AppsListPage/AppListPage.stories.tsx +++ b/src/apps/components/AppsListPage/AppListPage.stories.tsx @@ -4,7 +4,7 @@ import { pageListProps, searchPageProps, sortPageProps, - tabPageProps + tabPageProps, } from "@saleor/fixtures"; import Decorator from "@saleor/storybook/Decorator"; import { PaginatorContextDecorator } from "@saleor/storybook/PaginatorContextDecorator"; @@ -22,7 +22,7 @@ const props: AppsListPageProps = { ...tabPageProps, appsInProgressList: { __typename: "Query", - appsInstallations: appsInProgress + appsInstallations: appsInProgress, }, customAppsList, disabled: false, @@ -32,7 +32,7 @@ const props: AppsListPageProps = { onAppInProgressRemove: () => undefined, onAppInstallRetry: () => undefined, onCustomAppRemove: () => undefined, - onInstalledAppRemove: () => undefined + onInstalledAppRemove: () => undefined, }; storiesOf("Views / Apps / Apps list", module) diff --git a/src/apps/components/CustomAppCreatePage/CustomAppCreatePage.tsx b/src/apps/components/CustomAppCreatePage/CustomAppCreatePage.tsx index d8424c101..ec4dd0ed3 100644 --- a/src/apps/components/CustomAppCreatePage/CustomAppCreatePage.tsx +++ b/src/apps/components/CustomAppCreatePage/CustomAppCreatePage.tsx @@ -9,7 +9,7 @@ import Savebar from "@saleor/components/Savebar"; import { AppErrorFragment, PermissionEnum, - PermissionFragment + PermissionFragment, } from "@saleor/graphql"; import { SubmitPromise } from "@saleor/hooks/useForm"; import useNavigator from "@saleor/hooks/useNavigator"; @@ -33,7 +33,7 @@ export interface CustomAppCreatePageProps { permissions: PermissionFragment[]; saveButtonBarState: ConfirmButtonTransitionState; onSubmit: ( - data: CustomAppCreatePageFormData + data: CustomAppCreatePageFormData, ) => SubmitPromise; } @@ -45,7 +45,7 @@ const CustomAppCreatePage: React.FC = props => { const initialForm: CustomAppCreatePageFormData = { hasFullAccess: false, name: "", - permissions: [] + permissions: [], }; const formErrors = getFormErrors(["permissions"], errors || []); @@ -67,7 +67,7 @@ const CustomAppCreatePage: React.FC = props => { title={intl.formatMessage({ id: "GjH9uy", defaultMessage: "Create New App", - description: "header" + description: "header", })} /> @@ -89,13 +89,13 @@ const CustomAppCreatePage: React.FC = props => { fullAccessLabel={intl.formatMessage({ id: "D4nzdD", defaultMessage: "Grant this app full access to the store", - description: "checkbox label" + description: "checkbox label", })} description={intl.formatMessage({ id: "flP8Hj", defaultMessage: "Expand or restrict app permissions to access certain part of Saleor system.", - description: "card description" + description: "card description", })} /> diff --git a/src/apps/components/CustomAppDefaultToken/CustomAppDefaultToken.tsx b/src/apps/components/CustomAppDefaultToken/CustomAppDefaultToken.tsx index 4f36f4fc1..9d7b7b2de 100644 --- a/src/apps/components/CustomAppDefaultToken/CustomAppDefaultToken.tsx +++ b/src/apps/components/CustomAppDefaultToken/CustomAppDefaultToken.tsx @@ -41,7 +41,7 @@ const CustomAppDefaultToken: React.FC = props => { {apiUri} - ) + ), }} /> diff --git a/src/apps/components/CustomAppDefaultToken/styles.ts b/src/apps/components/CustomAppDefaultToken/styles.ts index d06118db4..885657036 100644 --- a/src/apps/components/CustomAppDefaultToken/styles.ts +++ b/src/apps/components/CustomAppDefaultToken/styles.ts @@ -4,35 +4,35 @@ import { makeStyles } from "@saleor/macaw-ui"; export const useStyles = makeStyles( theme => ({ cancel: { - marginRight: theme.spacing(1) + marginRight: theme.spacing(1), }, closeContainer: { display: "flex", justifyContent: "flex-end", position: "relative", right: theme.spacing(-1), - top: theme.spacing(-1) + top: theme.spacing(-1), }, content: { display: "grid", gridColumnGap: theme.spacing(3), gridTemplateColumns: "1fr 60px", - marginBottom: theme.spacing(3) + marginBottom: theme.spacing(3), }, copy: { marginTop: theme.spacing(), position: "relative", - right: theme.spacing(1) + right: theme.spacing(1), }, paper: { background: fade(theme.palette.primary.main, 0.05), - padding: theme.spacing(2, 3) + padding: theme.spacing(2, 3), }, root: { - boxShadow: "0px 5px 10px rgba(0, 0, 0, 0.05)" - } + boxShadow: "0px 5px 10px rgba(0, 0, 0, 0.05)", + }, }), { - name: "CustomAppTokenCreateDialog" - } + name: "CustomAppTokenCreateDialog", + }, ); diff --git a/src/apps/components/CustomAppDetailsPage/CustomAppDetailsPage.tsx b/src/apps/components/CustomAppDetailsPage/CustomAppDetailsPage.tsx index 49c25f6f7..b67677f98 100644 --- a/src/apps/components/CustomAppDetailsPage/CustomAppDetailsPage.tsx +++ b/src/apps/components/CustomAppDetailsPage/CustomAppDetailsPage.tsx @@ -11,7 +11,7 @@ import { AppErrorFragment, AppUpdateMutation, PermissionEnum, - ShopInfoQuery + ShopInfoQuery, } from "@saleor/graphql"; import { SubmitPromise } from "@saleor/hooks/useForm"; import useNavigator from "@saleor/hooks/useNavigator"; @@ -48,7 +48,7 @@ export interface CustomAppDetailsPageProps { onTokenClose: () => void; onTokenCreate: () => void; onSubmit: ( - data: CustomAppDetailsPageFormData + data: CustomAppDetailsPageFormData, ) => SubmitPromise; webhookCreateHref: string; onWebhookRemove: (id: string) => void; @@ -73,7 +73,7 @@ const CustomAppDetailsPage: React.FC = props => { webhookCreateHref, onWebhookRemove, onAppActivateOpen, - onAppDeactivateOpen + onAppDeactivateOpen, } = props; const intl = useIntl(); const classes = useStyles({}); @@ -89,11 +89,11 @@ const CustomAppDetailsPage: React.FC = props => { permissions?.filter( perm => app?.permissions?.filter(userPerm => userPerm.code === perm.code) - .length === 0 + .length === 0, ).length === 0 || false, isActive: !!app?.isActive, name: app?.name || "", - permissions: app?.permissions?.map(perm => perm.code) || [] + permissions: app?.permissions?.map(perm => perm.code) || [], }; return ( @@ -174,13 +174,13 @@ const CustomAppDetailsPage: React.FC = props => { fullAccessLabel={intl.formatMessage({ id: "D4nzdD", defaultMessage: "Grant this app full access to the store", - description: "checkbox label" + description: "checkbox label", })} description={intl.formatMessage({ id: "flP8Hj", defaultMessage: "Expand or restrict app permissions to access certain part of Saleor system.", - description: "card description" + description: "card description", })} />
diff --git a/src/apps/components/CustomAppInformation/CustomAppInformation.tsx b/src/apps/components/CustomAppInformation/CustomAppInformation.tsx index a59bc3c2c..210af82b6 100644 --- a/src/apps/components/CustomAppInformation/CustomAppInformation.tsx +++ b/src/apps/components/CustomAppInformation/CustomAppInformation.tsx @@ -20,7 +20,7 @@ const CustomAppInformation: React.FC = ({ data, disabled, errors, - onChange + onChange, }) => { const intl = useIntl(); @@ -32,7 +32,7 @@ const CustomAppInformation: React.FC = ({ title={intl.formatMessage({ id: "imYxM9", defaultMessage: "App Information", - description: "header" + description: "header", })} /> @@ -42,7 +42,7 @@ const CustomAppInformation: React.FC = ({ label={intl.formatMessage({ id: "foNlhn", defaultMessage: "App Name", - description: "custom app name" + description: "custom app name", })} helperText={getAppErrorMessage(formErrors.name, intl)} fullWidth diff --git a/src/apps/components/CustomAppTokens/CustomAppTokens.tsx b/src/apps/components/CustomAppTokens/CustomAppTokens.tsx index 5a00be5a3..6a95ec376 100644 --- a/src/apps/components/CustomAppTokens/CustomAppTokens.tsx +++ b/src/apps/components/CustomAppTokens/CustomAppTokens.tsx @@ -3,7 +3,7 @@ import { TableBody, TableCell, TableHead, - TableRow + TableRow, } from "@material-ui/core"; import { Button } from "@saleor/components/Button"; import CardTitle from "@saleor/components/CardTitle"; @@ -36,7 +36,7 @@ const CustomAppTokens: React.FC = props => { title={intl.formatMessage({ id: "0Mg8o5", defaultMessage: "Tokens", - description: "header" + description: "header", })} toolbar={ diff --git a/src/components/ColumnPicker/ColumnPickerContent.tsx b/src/components/ColumnPicker/ColumnPickerContent.tsx index fc7d8dcd9..e3ff92948 100644 --- a/src/components/ColumnPicker/ColumnPickerContent.tsx +++ b/src/components/ColumnPicker/ColumnPickerContent.tsx @@ -4,7 +4,7 @@ import { CardContent, CardHeader, MenuItem, - Typography + Typography, } from "@material-ui/core"; import { Button } from "@saleor/components/Button"; import { FormChange } from "@saleor/hooks/useForm"; @@ -14,7 +14,7 @@ import { CloseIcon, IconButton, makeStyles, - MultipleValueAutocomplete + MultipleValueAutocomplete, } from "@saleor/macaw-ui"; import { FetchMoreProps } from "@saleor/types"; import React from "react"; @@ -37,20 +37,20 @@ const useStyles = makeStyles( actions: { flexDirection: "row-reverse", gap: theme.spacing(1), - paddingBottom: theme.spacing(2) + paddingBottom: theme.spacing(2), }, content: { paddingBottom: theme.spacing(2), - width: 450 + width: 450, }, subHeader: { fontWeight: 500, letterSpacing: "0.1rem", textTransform: "uppercase", - marginBottom: theme.spacing(1) - } + marginBottom: theme.spacing(1), + }, }), - { name: "ColumnPickerContent" } + { name: "ColumnPickerContent" }, ); const ColumnPickerContent: React.FC = props => { @@ -63,7 +63,7 @@ const ColumnPickerContent: React.FC = props => { onReset, onFetchMore, onSave, - onQueryChange + onQueryChange, } = props; const classes = useStyles(); const intl = useIntl(); diff --git a/src/components/ColumnPicker/messages.ts b/src/components/ColumnPicker/messages.ts index 9cb30bed0..d0b876303 100644 --- a/src/components/ColumnPicker/messages.ts +++ b/src/components/ColumnPicker/messages.ts @@ -4,18 +4,18 @@ const messages = defineMessages({ title: { defaultMessage: "Customize list", id: "p+HM56", - description: "header" + description: "header", }, columnSubheader: { defaultMessage: "Column settings", id: "dS+SOT", - description: "header" + description: "header", }, columnLabel: { defaultMessage: "Selected columns", id: "IHtOda", - description: "input label" - } + description: "input label", + }, }); export default messages; diff --git a/src/components/CompanyAddressInput/CompanyAddressForm.tsx b/src/components/CompanyAddressInput/CompanyAddressForm.tsx index 3773632f9..ca05622e9 100644 --- a/src/components/CompanyAddressInput/CompanyAddressForm.tsx +++ b/src/components/CompanyAddressInput/CompanyAddressForm.tsx @@ -2,13 +2,13 @@ import { TextField } from "@material-ui/core"; import FormSpacer from "@saleor/components/FormSpacer"; import Grid from "@saleor/components/Grid"; import SingleAutocompleteSelectField, { - SingleAutocompleteChoiceType + SingleAutocompleteChoiceType, } from "@saleor/components/SingleAutocompleteSelectField"; import { AddressTypeInput } from "@saleor/customers/types"; import { AccountErrorFragment, ShopErrorFragment, - WarehouseErrorFragment + WarehouseErrorFragment, } from "@saleor/graphql"; import { ChangeEvent } from "@saleor/hooks/useForm"; import { makeStyles } from "@saleor/macaw-ui"; @@ -33,14 +33,14 @@ export interface CompanyAddressFormProps { const useStyles = makeStyles( { - root: {} + root: {}, }, - { name: "CompanyAddressForm" } + { name: "CompanyAddressForm" }, ); function getErrorMessage( err: AccountErrorFragment | ShopErrorFragment | WarehouseErrorFragment, - intl: IntlShape + intl: IntlShape, ): string { switch (err?.__typename) { case "AccountError": @@ -60,7 +60,7 @@ const CompanyAddressForm: React.FC = props => { displayCountry, errors, onChange, - onCountryChange + onCountryChange, } = props; const classes = useStyles(props); @@ -75,7 +75,7 @@ const CompanyAddressForm: React.FC = props => { "country", "countryArea", "companyArea", - "phone" + "phone", ]; const formErrors = getFormErrors(formFields, errors); @@ -87,14 +87,14 @@ const CompanyAddressForm: React.FC = props => { helperText={getErrorMessage(formErrors.companyName, intl)} label={intl.formatMessage({ id: "9YazHG", - defaultMessage: "Company" + defaultMessage: "Company", })} name={"companyName" as keyof AddressTypeInput} onChange={onChange} value={data.companyName} fullWidth InputProps={{ - autoComplete: "organization" + autoComplete: "organization", }} /> @@ -104,14 +104,14 @@ const CompanyAddressForm: React.FC = props => { helperText={getErrorMessage(formErrors.streetAddress1, intl)} label={intl.formatMessage({ id: "B52Em/", - defaultMessage: "Address line 1" + defaultMessage: "Address line 1", })} name={"streetAddress1" as keyof AddressTypeInput} onChange={onChange} value={data.streetAddress1} fullWidth InputProps={{ - autoComplete: "address-line1" + autoComplete: "address-line1", }} /> @@ -121,14 +121,14 @@ const CompanyAddressForm: React.FC = props => { helperText={getErrorMessage(formErrors.streetAddress2, intl)} label={intl.formatMessage({ id: "oQY0a2", - defaultMessage: "Address line 2" + defaultMessage: "Address line 2", })} name={"streetAddress2" as keyof AddressTypeInput} onChange={onChange} value={data.streetAddress2} fullWidth InputProps={{ - autoComplete: "address-line2" + autoComplete: "address-line2", }} /> @@ -139,14 +139,14 @@ const CompanyAddressForm: React.FC = props => { helperText={getErrorMessage(formErrors.city, intl)} label={intl.formatMessage({ id: "TE4fIS", - defaultMessage: "City" + defaultMessage: "City", })} name={"city" as keyof AddressTypeInput} onChange={onChange} value={data.city} fullWidth InputProps={{ - autoComplete: "address-level2" + autoComplete: "address-level2", }} /> = props => { helperText={getErrorMessage(formErrors.postalCode, intl)} label={intl.formatMessage({ id: "oYGfnY", - defaultMessage: "ZIP / Postal code" + defaultMessage: "ZIP / Postal code", })} name={"postalCode" as keyof AddressTypeInput} onChange={onChange} value={data.postalCode} fullWidth InputProps={{ - autoComplete: "postal-code" + autoComplete: "postal-code", }} /> @@ -176,7 +176,7 @@ const CompanyAddressForm: React.FC = props => { helperText={getErrorMessage(formErrors.country, intl)} label={intl.formatMessage({ id: "vONi+O", - defaultMessage: "Country" + defaultMessage: "Country", })} name={"country" as keyof AddressTypeInput} onChange={onCountryChange} @@ -189,14 +189,14 @@ const CompanyAddressForm: React.FC = props => { helperText={getErrorMessage(formErrors.countryArea, intl)} label={intl.formatMessage({ id: "AuwpCm", - defaultMessage: "Country area" + defaultMessage: "Country area", })} name={"countryArea" as keyof AddressTypeInput} onChange={onChange} value={data.countryArea} fullWidth InputProps={{ - autoComplete: "address-level1" + autoComplete: "address-level1", }} /> @@ -208,13 +208,13 @@ const CompanyAddressForm: React.FC = props => { helperText={getErrorMessage(formErrors.phone, intl)} label={intl.formatMessage({ id: "O95R3Z", - defaultMessage: "Phone" + defaultMessage: "Phone", })} name={"phone" as keyof AddressTypeInput} value={data.phone} onChange={onChange} InputProps={{ - autoComplete: "tel" + autoComplete: "tel", }} /> diff --git a/src/components/CompanyAddressInput/CompanyAddressInput.tsx b/src/components/CompanyAddressInput/CompanyAddressInput.tsx index 53ce5024d..bbf59b649 100644 --- a/src/components/CompanyAddressInput/CompanyAddressInput.tsx +++ b/src/components/CompanyAddressInput/CompanyAddressInput.tsx @@ -5,7 +5,7 @@ import React from "react"; import CardTitle from "../CardTitle"; import CompanyAddressForm, { - CompanyAddressFormProps + CompanyAddressFormProps, } from "./CompanyAddressForm"; interface CompanyAddressInputProps extends CompanyAddressFormProps { @@ -16,10 +16,10 @@ interface CompanyAddressInputProps extends CompanyAddressFormProps { const useStyles = makeStyles( { root: { - overflow: "visible" - } + overflow: "visible", + }, }, - { name: "CompanyAddressInput" } + { name: "CompanyAddressInput" }, ); const CompanyAddressInput: React.FC = props => { diff --git a/src/components/ConfirmButton.tsx b/src/components/ConfirmButton.tsx index d31bed0e9..c9e7bae4e 100644 --- a/src/components/ConfirmButton.tsx +++ b/src/components/ConfirmButton.tsx @@ -2,7 +2,7 @@ import { buttonMessages, commonMessages } from "@saleor/intl"; import { ConfirmButton as MacawConfirmButton, ConfirmButtonLabels, - ConfirmButtonProps as MacawConfirmButtonProps + ConfirmButtonProps as MacawConfirmButtonProps, } from "@saleor/macaw-ui"; import React from "react"; import { useIntl } from "react-intl"; @@ -20,11 +20,11 @@ export const ConfirmButton: React.FC = ({ const defaultLabels: ConfirmButtonLabels = { confirm: intl.formatMessage(buttonMessages.save), - error: intl.formatMessage(commonMessages.error) + error: intl.formatMessage(commonMessages.error), }; const componentLabels: ConfirmButtonLabels = { ...defaultLabels, - ...labels + ...labels, }; return ; diff --git a/src/components/Container.tsx b/src/components/Container.tsx index 91f67c3a2..221804cef 100644 --- a/src/components/Container.tsx +++ b/src/components/Container.tsx @@ -8,18 +8,18 @@ const useStyles = makeStyles( [theme.breakpoints.up("lg")]: { marginLeft: "auto", marginRight: "auto", - maxWidth: theme.breakpoints.width("lg") + maxWidth: theme.breakpoints.width("lg"), }, [theme.breakpoints.up("sm")]: { - padding: theme.spacing(0, 3) + padding: theme.spacing(0, 3), }, padding: theme.spacing(0, 1), - position: "relative" - } + position: "relative", + }, }), { - name: "Container" - } + name: "Container", + }, ); interface ContainerProps { diff --git a/src/components/ControlledSwitch.tsx b/src/components/ControlledSwitch.tsx index 46b98bd0c..468e3c21e 100644 --- a/src/components/ControlledSwitch.tsx +++ b/src/components/ControlledSwitch.tsx @@ -5,10 +5,10 @@ import React from "react"; const useStyles = makeStyles( () => ({ labelText: { - fontSize: 14 - } + fontSize: 14, + }, }), - { name: "ControlledSwitch" } + { name: "ControlledSwitch" }, ); interface ControlledSwitchProps { @@ -29,7 +29,7 @@ export const ControlledSwitch: React.FC = props => { label, name, secondLabel, - uncheckedLabel + uncheckedLabel, } = props; const classes = useStyles(props); diff --git a/src/components/CountryList/CountryList.tsx b/src/components/CountryList/CountryList.tsx index 9a286aed6..de6d8ce9c 100644 --- a/src/components/CountryList/CountryList.tsx +++ b/src/components/CountryList/CountryList.tsx @@ -25,48 +25,48 @@ const useStyles = makeStyles( theme => ({ iconCell: { "&:last-child": { - paddingRight: theme.spacing(2) + paddingRight: theme.spacing(2), }, - width: `calc(48px + ${theme.spacing(4)})` + width: `calc(48px + ${theme.spacing(4)})`, }, indicator: { color: theme.palette.text.disabled, display: "inline-block", left: 0, marginRight: theme.spacing(0.5), - position: "absolute" + position: "absolute", }, offsetCell: { "&:first-child": { - paddingLeft: theme.spacing(3) + paddingLeft: theme.spacing(3), }, - position: "relative" + position: "relative", }, pointer: { - cursor: "pointer" + cursor: "pointer", }, root: { "&:last-child": { - paddingBottom: 0 + paddingBottom: 0, }, - paddingTop: 0 + paddingTop: 0, }, rotate: { - transform: "rotate(180deg)" + transform: "rotate(180deg)", }, textRight: { - textAlign: "right" + textAlign: "right", }, toLeft: { "&:first-child": { - paddingLeft: 0 - } + paddingLeft: 0, + }, }, wideColumn: { - width: "100%" - } + width: "100%", + }, }), - { name: "CountryList" } + { name: "CountryList" }, ); const CountryList: React.FC = props => { @@ -76,7 +76,7 @@ const CountryList: React.FC = props => { emptyText, title, onCountryAssign, - onCountryUnassign + onCountryUnassign, } = props; const classes = useStyles(props); @@ -116,7 +116,7 @@ const CountryList: React.FC = props => { defaultMessage="{number} Countries" description="number of countries" values={{ - number: getStringOrPlaceholder(countries?.length.toString()) + number: getStringOrPlaceholder(countries?.length.toString()), }} /> @@ -127,7 +127,7 @@ const CountryList: React.FC = props => { @@ -152,7 +152,7 @@ const CountryList: React.FC = props => { {country.country} ), - + , )} = props => { {emptyText} - ) + ), )} diff --git a/src/components/CreatorSteps/CreatorSteps.tsx b/src/components/CreatorSteps/CreatorSteps.tsx index 172b789c8..d118aab12 100644 --- a/src/components/CreatorSteps/CreatorSteps.tsx +++ b/src/components/CreatorSteps/CreatorSteps.tsx @@ -12,30 +12,30 @@ const useStyles = makeStyles( theme => ({ label: { fontSize: 14, - textAlign: "center" + textAlign: "center", }, root: { borderBottom: `1px solid ${theme.palette.divider}`, display: "flex", justifyContent: "space-between", - marginBottom: theme.spacing(3) + marginBottom: theme.spacing(3), }, tab: { flex: 1, paddingBottom: theme.spacing(), - userSelect: "none" + userSelect: "none", }, tabActive: { - fontWeight: 600 + fontWeight: 600, }, tabVisited: { borderBottom: `3px solid ${theme.palette.primary.main}`, - cursor: "pointer" - } + cursor: "pointer", + }, }), { - name: "CreatorSteps" - } + name: "CreatorSteps", + }, ); export interface CreatorStepsProps { @@ -48,7 +48,7 @@ function makeCreatorSteps() { const CreatorSteps: React.FC> = ({ currentStep, steps, - onStepClick + onStepClick, }) => { const classes = useStyles({}); @@ -62,7 +62,7 @@ function makeCreatorSteps() {
onStepClick(step.value) : undefined} key={step.value} diff --git a/src/components/Date/Date.test.tsx b/src/components/Date/Date.test.tsx index 476df8a7d..26772cc5d 100644 --- a/src/components/Date/Date.test.tsx +++ b/src/components/Date/Date.test.tsx @@ -11,7 +11,7 @@ test("Render plain date with timezone GMT-11", () => { const date = renderer.create( - + , ); expect(date.toJSON()).toEqual(expectedDate); }); @@ -20,7 +20,7 @@ test("Render plain date with timezone GMT+13", () => { const date = renderer.create( - + , ); expect(date.toJSON()).toEqual(expectedDate); }); @@ -29,10 +29,10 @@ test("Render humanized date with timezone GMT-11", () => { const date = renderer.create( - + , ); expect((date.toJSON() as ReactTestRendererJSON).props.dateTime).toEqual( - testDate + testDate, ); }); @@ -40,9 +40,9 @@ test("Render humanized date with timezone GMT+13", () => { const date = renderer.create( - + , ); expect((date.toJSON() as ReactTestRendererJSON).props.dateTime).toEqual( - testDate + testDate, ); }); diff --git a/src/components/Date/DateProvider.tsx b/src/components/Date/DateProvider.tsx index 802b3f4a3..8a21b00b3 100644 --- a/src/components/Date/DateProvider.tsx +++ b/src/components/Date/DateProvider.tsx @@ -12,13 +12,13 @@ export class DateProvider extends React.Component<{}, DateProviderState> { intervalId: number; state = { - date: Date.now() + date: Date.now(), }; componentDidMount() { this.intervalId = window.setInterval( () => this.setState({ date: Date.now() }), - 10000 + 10000, ); } diff --git a/src/components/DateTimeField.tsx b/src/components/DateTimeField.tsx index 04a72d876..fb20feb4b 100644 --- a/src/components/DateTimeField.tsx +++ b/src/components/DateTimeField.tsx @@ -3,7 +3,7 @@ import { TextFieldProps } from "@material-ui/core/TextField"; import { getErrorMessage } from "@saleor/components/Attributes/utils"; import { PageErrorWithAttributesFragment, - ProductErrorWithAttributesFragment + ProductErrorWithAttributesFragment, } from "@saleor/graphql"; import { commonMessages } from "@saleor/intl"; import { joinDateTime, splitDateTime } from "@saleor/misc"; @@ -21,7 +21,7 @@ export const DateTimeField: React.FC = ({ error, name, onChange, - value + value, }) => { const intl = useIntl(); diff --git a/src/components/DateTimeTimezoneField.tsx b/src/components/DateTimeTimezoneField.tsx index 31168b57c..cf0236262 100644 --- a/src/components/DateTimeTimezoneField.tsx +++ b/src/components/DateTimeTimezoneField.tsx @@ -19,13 +19,13 @@ type DateTimeFieldProps = Omit & { const useStyles = makeStyles( theme => ({ dateInput: { - marginRight: theme.spacing(2) + marginRight: theme.spacing(2), }, errorNoticeBar: { - marginTop: theme.spacing(2) - } + marginTop: theme.spacing(2), + }, }), - { name: "DateTimeTimezoneField" } + { name: "DateTimeTimezoneField" }, ); export const DateTimeTimezoneField: React.FC = ({ @@ -34,12 +34,12 @@ export const DateTimeTimezoneField: React.FC = ({ onChange, error, fullWidth, - value: initialValue + value: initialValue, }) => { const classes = useStyles({}); const intl = useIntl(); const [value, setValue] = useState( - initialValue ? splitDateTime(initialValue) : { date: "", time: "" } + initialValue ? splitDateTime(initialValue) : { date: "", time: "" }, ); useEffect(() => { diff --git a/src/components/DebounceForm.tsx b/src/components/DebounceForm.tsx index 5e446afa9..1f133b782 100644 --- a/src/components/DebounceForm.tsx +++ b/src/components/DebounceForm.tsx @@ -13,7 +13,7 @@ export const DebounceForm: React.FC = ({ change, children, submit, - time + time, }) => ( {debounceFn => diff --git a/src/components/DeleteButton/DeleteButton.tsx b/src/components/DeleteButton/DeleteButton.tsx index ac2011330..405dec7d8 100644 --- a/src/components/DeleteButton/DeleteButton.tsx +++ b/src/components/DeleteButton/DeleteButton.tsx @@ -14,7 +14,7 @@ const DeleteButton: React.FC = ({ onClick, label, testId, - disabled = false + disabled = false, }) => { const intl = useIntl(); diff --git a/src/components/DeleteFilterTabDialog/DeleteFilterTabDialog.tsx b/src/components/DeleteFilterTabDialog/DeleteFilterTabDialog.tsx index f0b339703..8786c9019 100644 --- a/src/components/DeleteFilterTabDialog/DeleteFilterTabDialog.tsx +++ b/src/components/DeleteFilterTabDialog/DeleteFilterTabDialog.tsx @@ -18,7 +18,7 @@ const DeleteFilterTabDialog: React.FC = ({ onClose, onSubmit, open, - tabName + tabName, }) => { const intl = useIntl(); @@ -31,7 +31,7 @@ const DeleteFilterTabDialog: React.FC = ({ title={intl.formatMessage({ id: "7NfoiJ", defaultMessage: "Delete Search", - description: "custom search delete, dialog header" + description: "custom search delete, dialog header", })} variant="delete" > @@ -40,7 +40,7 @@ const DeleteFilterTabDialog: React.FC = ({ id="UaYJJ8" defaultMessage="Are you sure you want to delete {name} search tab?" values={{ - name: {tabName} + name: {tabName}, }} /> diff --git a/src/components/DemoBanner/DemoBanner.tsx b/src/components/DemoBanner/DemoBanner.tsx index 422c8a469..78bf25aec 100644 --- a/src/components/DemoBanner/DemoBanner.tsx +++ b/src/components/DemoBanner/DemoBanner.tsx @@ -25,7 +25,7 @@ export const DemoBanner: React.FC = () => { values={{ emphasis: (children: any) => ( {children} - ) + ), }} /> ) : ( @@ -43,7 +43,7 @@ export const DemoBanner: React.FC = () => { values={{ emphasis: (children: any) => ( {children} - ) + ), }} /> ) : ( diff --git a/src/components/DemoBanner/styles.ts b/src/components/DemoBanner/styles.ts index 725e1b657..f9675f7b8 100644 --- a/src/components/DemoBanner/styles.ts +++ b/src/components/DemoBanner/styles.ts @@ -8,7 +8,7 @@ const useStyles = makeStyles( width: "100%", backgroundColor: "inherit", padding: `0 13px`, - fontSize: theme.spacing(1.5) + fontSize: theme.spacing(1.5), }, borderedWrapper: { display: "flex", @@ -21,35 +21,35 @@ const useStyles = makeStyles( backgroundImage: `linear-gradient(to right, ${greyDark} 13%, rgba(255, 255, 255, 0) 0%)`, backgroundPosition: "bottom", backgroundSize: theme.spacing(1.5, 0.125), - backgroundRepeat: "repeat-x" + backgroundRepeat: "repeat-x", }, logoWrapper: { - lineHeight: 0 + lineHeight: 0, }, linkList: { display: "flex", - alignItems: "center" + alignItems: "center", }, link: { display: "flex", padding: theme.spacing(2), - color: textColor + color: textColor, }, textEmphasis: { color: emphasisedTextBlue, textTransform: "uppercase", fontWeight: 600, fontStyle: "normal", - paddingLeft: "5px" + paddingLeft: "5px", }, divider: { borderRight: `1px solid ${greyDark}`, - height: theme.spacing(2) - } + height: theme.spacing(2), + }, }), { - name: "DemoBanner" - } + name: "DemoBanner", + }, ); export default useStyles; diff --git a/src/components/DiscountedPrice/DiscountedPrice.tsx b/src/components/DiscountedPrice/DiscountedPrice.tsx index 15409bd0e..d764eff2b 100644 --- a/src/components/DiscountedPrice/DiscountedPrice.tsx +++ b/src/components/DiscountedPrice/DiscountedPrice.tsx @@ -11,7 +11,7 @@ interface DiscountedPriceProps { const DiscountedPrice: React.FC = ({ regularPrice, - discountedPrice + discountedPrice, }) => { const classes = useStyles(); diff --git a/src/components/DiscountedPrice/styles.ts b/src/components/DiscountedPrice/styles.ts index 35b07bed4..456af6581 100644 --- a/src/components/DiscountedPrice/styles.ts +++ b/src/components/DiscountedPrice/styles.ts @@ -5,8 +5,8 @@ export const useStyles = makeStyles( strike: { textDecoration: "line-through", color: theme.palette.grey[400], - fontSize: "smaller" - } + fontSize: "smaller", + }, }), - { name: "DiscountedPrice" } + { name: "DiscountedPrice" }, ); diff --git a/src/components/EditableTableCell/EditableTableCell.tsx b/src/components/EditableTableCell/EditableTableCell.tsx index b17a14f74..29c7e3da7 100644 --- a/src/components/EditableTableCell/EditableTableCell.tsx +++ b/src/components/EditableTableCell/EditableTableCell.tsx @@ -3,7 +3,7 @@ import { CardContent, TableCell, TextField, - Typography + Typography, } from "@material-ui/core"; import { TextFieldProps } from "@material-ui/core/TextField"; import useForm from "@saleor/hooks/useForm"; @@ -14,10 +14,10 @@ import React from "react"; const useStyles = makeStyles( theme => ({ card: { - border: `1px solid ${theme.palette.divider}` + border: `1px solid ${theme.palette.divider}`, }, container: { - position: "relative" + position: "relative", }, overlay: { cursor: "pointer", @@ -26,7 +26,7 @@ const useStyles = makeStyles( position: "fixed", top: 0, width: "100vw", - zIndex: 1 + zIndex: 1, }, root: { left: 0, @@ -34,14 +34,14 @@ const useStyles = makeStyles( position: "absolute", top: 0, width: `calc(100% + ${theme.spacing(4)}px)`, - zIndex: 2 + zIndex: 2, }, text: { cursor: "pointer", - fontSize: "0.8125rem" - } + fontSize: "0.8125rem", + }, }), - { name: "EditableTableCell" } + { name: "EditableTableCell" }, ); interface EditableTableCellProps { @@ -59,7 +59,7 @@ export const EditableTableCell: React.FC = props => { defaultValue, focused, InputProps, - value + value, // onConfirm } = props; const classes = useStyles(props); @@ -71,7 +71,7 @@ export const EditableTableCell: React.FC = props => { const [opened, setOpenStatus] = React.useState(focused); const { change, data } = useForm( - { value } /* commenting out temporarily handleConfirm */ + { value } /* commenting out temporarily handleConfirm */, ); const enable = () => setOpenStatus(true); const disable = () => setOpenStatus(false); diff --git a/src/components/ErrorNoticeBar/ErrorNoticeBar.tsx b/src/components/ErrorNoticeBar/ErrorNoticeBar.tsx index 18f1e6913..0115cca7f 100644 --- a/src/components/ErrorNoticeBar/ErrorNoticeBar.tsx +++ b/src/components/ErrorNoticeBar/ErrorNoticeBar.tsx @@ -10,12 +10,12 @@ interface ErrorNoticeBarProps { const useStyles = makeStyles( theme => ({ root: { - background: theme.palette.alert.paper.error - } + background: theme.palette.alert.paper.error, + }, }), { - name: "ErrorNoticeBar" - } + name: "ErrorNoticeBar", + }, ); const ErrorNoticeBar: React.FC = props => { diff --git a/src/components/ErrorPage/messages.ts b/src/components/ErrorPage/messages.ts index 33e8005d9..367add1b9 100644 --- a/src/components/ErrorPage/messages.ts +++ b/src/components/ErrorPage/messages.ts @@ -3,29 +3,29 @@ import { defineMessages } from "react-intl"; const messages = defineMessages({ header: { id: "AQ+9Ez", - defaultMessage: "We’ve encountered an unexpected error" + defaultMessage: "We’ve encountered an unexpected error", }, content: { id: "p0SUJj", defaultMessage: - "Don’t worry we will fix it soon. Try to refresh the page or go back to dashboard." + "Don’t worry we will fix it soon. Try to refresh the page or go back to dashboard.", }, btnDashboard: { id: "9mGA/Q", defaultMessage: "Dashboard", - description: "button linking to dashboard" + description: "button linking to dashboard", }, btnRefresh: { id: "ypW4Mi", defaultMessage: "Refresh page", - description: "button refreshing page" + description: "button refreshing page", }, or: { id: "OA+fw+", defaultMessage: "or", description: - "conjunction, choice between going to dashboard or refreshing page" - } + "conjunction, choice between going to dashboard or refreshing page", + }, }); export default messages; diff --git a/src/components/ErrorPage/styles.ts b/src/components/ErrorPage/styles.ts index f0a2f73cb..32e35bdd9 100644 --- a/src/components/ErrorPage/styles.ts +++ b/src/components/ErrorPage/styles.ts @@ -3,52 +3,52 @@ import { makeStyles } from "@saleor/macaw-ui"; const useStyles = makeStyles( theme => ({ buttonContainer: { - marginTop: theme.spacing(2) + marginTop: theme.spacing(2), }, container: { [theme.breakpoints.down("sm")]: { gridTemplateColumns: "1fr", padding: theme.spacing(3), - width: "100%" + width: "100%", }, display: "grid", gridTemplateColumns: "1fr 487px", margin: "0 auto", gap: theme.spacing(5), - width: `calc(480px * 2 + ${theme.spacing(5)})` + width: `calc(480px * 2 + ${theme.spacing(5)})`, }, conjunction: { display: "inline-block", - margin: theme.spacing(0, 1) + margin: theme.spacing(0, 1), }, errorId: { marginTop: theme.spacing(3), letterSpacing: "0.1rem", textTransform: "uppercase", - fontWeight: 500 + fontWeight: 500, }, innerContainer: { [theme.breakpoints.down("sm")]: { order: 1, - textAlign: "center" + textAlign: "center", }, display: "flex", flexDirection: "column", - justifyContent: "center" + justifyContent: "center", }, notFoundImage: { - width: "100%" + width: "100%", }, root: { alignItems: "center", display: "flex", - height: "calc(100vh - 180px)" + height: "calc(100vh - 180px)", }, header: { - marginBottom: theme.spacing(2) - } + marginBottom: theme.spacing(2), + }, }), - { name: "ErrorPage" } + { name: "ErrorPage" }, ); export default useStyles; diff --git a/src/components/ExtendedPageHeader/ExtendedPageHeader.tsx b/src/components/ExtendedPageHeader/ExtendedPageHeader.tsx index 7ae98dafb..48ec41067 100644 --- a/src/components/ExtendedPageHeader/ExtendedPageHeader.tsx +++ b/src/components/ExtendedPageHeader/ExtendedPageHeader.tsx @@ -6,37 +6,37 @@ import React from "react"; const useStyles = makeStyles( theme => ({ action: { - flex: "0 0 auto" + flex: "0 0 auto", }, block: { [theme.breakpoints.down("xs")]: { "&&": { - display: "block" - } - } + display: "block", + }, + }, }, underline: { - marginBottom: theme.spacing(4) + marginBottom: theme.spacing(4), }, grid: { - padding: theme.spacing(2) + padding: theme.spacing(2), }, menuButton: { flex: "0 0 auto", marginLeft: theme.spacing(-2), marginRight: theme.spacing(3), - marginTop: theme.spacing(-2) + marginTop: theme.spacing(-2), }, root: { alignItems: "center", display: "flex", marginBottom: theme.spacing(3), - wordBreak: "break-all" + wordBreak: "break-all", }, subtitle: { alignItems: "center", display: "flex", - marginBottom: theme.spacing(2) + marginBottom: theme.spacing(2), }, titleRow: { flex: 1, @@ -45,12 +45,12 @@ const useStyles = makeStyles( alignItems: "center", justifyContent: "space-between", minWidth: 0, - textOverflow: "ellipsis" - } + textOverflow: "ellipsis", + }, }), { - name: "ExtendedPageHeader" - } + name: "ExtendedPageHeader", + }, ); interface ExtendedPageHeaderProps { @@ -71,7 +71,7 @@ const ExtendedPageHeader: React.FC = props => { inline, underline, title, - testId + testId, } = props; const classes = useStyles(props); @@ -82,7 +82,7 @@ const ExtendedPageHeader: React.FC = props => { data-test-id={testId} className={classNames(classes.root, className, { [classes.block]: !inline, - [classes.underline]: underline + [classes.underline]: underline, })} >
{title}
diff --git a/src/components/ExternalLink/ExternalLink.tsx b/src/components/ExternalLink/ExternalLink.tsx index f645858bf..58570c3de 100644 --- a/src/components/ExternalLink/ExternalLink.tsx +++ b/src/components/ExternalLink/ExternalLink.tsx @@ -6,10 +6,10 @@ import React from "react"; const useStyles = makeStyles( { link: { - textDecoration: "none" - } + textDecoration: "none", + }, }, - { name: "ExternalLink" } + { name: "ExternalLink" }, ); interface ExternalLinkProps extends React.HTMLProps { diff --git a/src/components/FileUploadField/FileUploadField.stories.tsx b/src/components/FileUploadField/FileUploadField.stories.tsx index 1bc53f01f..703d81fa7 100644 --- a/src/components/FileUploadField/FileUploadField.stories.tsx +++ b/src/components/FileUploadField/FileUploadField.stories.tsx @@ -11,11 +11,11 @@ const props: FileUploadFieldProps = { file: { label: undefined, value: undefined }, inputProps: { name: "country", - placeholder: "Select country" + placeholder: "Select country", }, loading: false, onFileDelete: () => undefined, - onFileUpload: () => undefined + onFileUpload: () => undefined, }; const InteractiveStory: React.FC = () => { @@ -27,7 +27,7 @@ const InteractiveStory: React.FC = () => { loading={false} file={{ label: file?.name, - value: file?.name + value: file?.name, }} onFileUpload={file => setFile(file)} onFileDelete={() => setFile(null)} @@ -44,7 +44,7 @@ storiesOf("Generics / File upload field", module) {...props} file={{ label: "some_file.png", - value: "some_file.png" + value: "some_file.png", }} /> )) @@ -54,7 +54,7 @@ storiesOf("Generics / File upload field", module) file={{ file: fixtures.UPLOADED_FILE, label: "some_file_with_link.png", - value: "some_file_with_link.png" + value: "some_file_with_link.png", }} /> )) diff --git a/src/components/FileUploadField/FileUploadField.tsx b/src/components/FileUploadField/FileUploadField.tsx index aeb83b07c..57ea9f3c0 100644 --- a/src/components/FileUploadField/FileUploadField.tsx +++ b/src/components/FileUploadField/FileUploadField.tsx @@ -32,26 +32,26 @@ export interface FileUploadFieldProps { const useStyles = makeStyles( theme => ({ errorText: { - color: theme.palette.error.light + color: theme.palette.error.light, }, fileField: { - display: "none" + display: "none", }, fileUrl: { color: theme.palette.primary.main, - textDecoration: "none" + textDecoration: "none", }, uploadFileContent: { alignItems: "center", color: theme.palette.primary.main, display: "flex", - fontSize: theme.typography.body1.fontSize + fontSize: theme.typography.body1.fontSize, }, uploadFileName: { - minWidth: "6rem" - } + minWidth: "6rem", + }, }), - { name: "FileUploadField" } + { name: "FileUploadField" }, ); const FileUploadField: React.FC = props => { @@ -64,7 +64,7 @@ const FileUploadField: React.FC = props => { helperText, onFileUpload, onFileDelete, - inputProps + inputProps, } = props; const classes = useStyles({}); const intl = useIntl(); diff --git a/src/components/FileUploadField/fixtures.ts b/src/components/FileUploadField/fixtures.ts index 6b11f2db0..e7e151547 100644 --- a/src/components/FileUploadField/fixtures.ts +++ b/src/components/FileUploadField/fixtures.ts @@ -3,5 +3,5 @@ import { FileFragment } from "@saleor/graphql"; export const UPLOADED_FILE: FileFragment = { __typename: "File", contentType: "image/png", - url: "some_url_to_image.png" + url: "some_url_to_image.png", }; diff --git a/src/components/Filter/Filter.tsx b/src/components/Filter/Filter.tsx index babdd0fb3..1cf5be23a 100644 --- a/src/components/Filter/Filter.tsx +++ b/src/components/Filter/Filter.tsx @@ -3,7 +3,7 @@ import { ClickAwayListener, Grow, Popper, - Typography + Typography, } from "@material-ui/core"; import { fade } from "@material-ui/core/styles/colorManipulator"; import { makeStyles } from "@saleor/macaw-ui"; @@ -16,7 +16,7 @@ import { FilterElement, FilterErrorMessages, IFilter, - InvalidFilters + InvalidFilters, } from "./types"; import useFilter from "./useFilter"; import { extractInvalidFilters } from "./utils"; @@ -34,7 +34,7 @@ const useStyles = makeStyles( addFilterButton: { "&$filterButton": { "&:hover, &:focus": { - backgroundColor: fade(theme.palette.primary.main, 0.1) + backgroundColor: fade(theme.palette.primary.main, 0.1), }, backgroundColor: theme.palette.background.paper, border: `1px solid ${theme.palette.primary.main}`, @@ -42,22 +42,22 @@ const useStyles = makeStyles( marginBottom: 0, marginRight: theme.spacing(2), marginTop: 0, - transition: theme.transitions.duration.short + "ms" - } + transition: theme.transitions.duration.short + "ms", + }, }, addFilterButtonActive: { "&$addFilterButton": { - backgroundColor: fade(theme.palette.primary.main, 0.1) - } + backgroundColor: fade(theme.palette.primary.main, 0.1), + }, }, addFilterIcon: { - transition: theme.transitions.duration.short + "ms" + transition: theme.transitions.duration.short + "ms", }, addFilterText: { color: theme.palette.primary.main, fontSize: 14, fontWeight: 600 as 600, - textTransform: "uppercase" + textTransform: "uppercase", }, filterButton: { alignItems: "center", @@ -69,32 +69,32 @@ const useStyles = makeStyles( margin: theme.spacing(2, 1), marginLeft: 0, padding: theme.spacing(0, 2), - position: "relative" + position: "relative", }, paper: { "& p": { - paddingBottom: 10 + paddingBottom: 10, }, marginTop: theme.spacing(2), padding: theme.spacing(2), - width: 240 + width: 240, }, popover: { width: 376, - zIndex: 3 + zIndex: 3, }, rotate: { - transform: "rotate(180deg)" + transform: "rotate(180deg)", }, separator: { backgroundColor: theme.palette.primary.main, display: "inline-block", height: 28, margin: theme.spacing(0, 1.5, 0, 1), - width: 1 - } + width: 1, + }, }), - { name: "Filter" } + { name: "Filter" }, ); const Filter: React.FC = props => { const { @@ -102,7 +102,7 @@ const Filter: React.FC = props => { menu, onFilterAdd, onFilterAttributeFocus, - errorMessages + errorMessages, } = props; const classes = useStyles(props); @@ -144,7 +144,7 @@ const Filter: React.FC = props => { setFilterMenuOpened(!isFilterMenuOpened)} data-test-id="show-filters-button" @@ -162,7 +162,7 @@ const Filter: React.FC = props => { {menu.reduce((acc, filterElement) => { const dataFilterElement = data.find( - ({ name }) => name === filterElement.name + ({ name }) => name === filterElement.name, ); if (!dataFilterElement) { @@ -184,15 +184,15 @@ const Filter: React.FC = props => { placement="bottom-start" modifiers={{ flip: { - enabled: false + enabled: false, }, hide: { - enabled: false + enabled: false, }, preventOverflow: { boundariesElement: "scrollParent", - enabled: false - } + enabled: false, + }, }} > {({ TransitionProps, placement }) => ( @@ -200,7 +200,7 @@ const Filter: React.FC = props => { {...TransitionProps} style={{ transformOrigin: - placement === "bottom" ? "right top" : "right bottom" + placement === "bottom" ? "right top" : "right bottom", }} > ({ hr: { backgroundColor: theme.palette.primary.light, - margin: theme.spacing(1, 0) + margin: theme.spacing(1, 0), }, input: { - padding: "12px 0 9px 12px" + padding: "12px 0 9px 12px", }, inputContainer: { marginBottom: theme.spacing(1), - paddingTop: theme.spacing(1) + paddingTop: theme.spacing(1), }, noResults: { - marginTop: theme.spacing(1) + marginTop: theme.spacing(1), }, option: { left: theme.spacing(-0.5), - position: "relative" + position: "relative", }, showMore: { display: "inline-block", - marginTop: theme.spacing(1) - } + marginTop: theme.spacing(1), + }, }), - { name: "FilterAutocompleteField" } + { name: "FilterAutocompleteField" }, ); const FilterAutocompleteField: React.FC = ({ @@ -64,8 +64,8 @@ const FilterAutocompleteField: React.FC = ({ const initialFieldDisplayValues = initialDisplayValues[filter.name]; const availableOptions = filter.options.filter(option => fieldDisplayValues.every( - displayValue => displayValue.value !== option.value - ) + displayValue => displayValue.value !== option.value, + ), ); const displayNoResults = availableOptions.length === 0 && fieldDisplayValues.length === 0; @@ -84,10 +84,10 @@ const FilterAutocompleteField: React.FC = ({ name: filter.name, update: { active: true, - value: getUpdatedFilterValue(option) - } + value: getUpdatedFilterValue(option), + }, }, - type: "set-property" + type: "set-property", }); if (filter.multiple) { @@ -96,8 +96,8 @@ const FilterAutocompleteField: React.FC = ({ [filter.name]: toggle( option, fieldDisplayValues, - (a, b) => a.value === b.value - ) + (a, b) => a.value === b.value, + ), }); } }; @@ -106,11 +106,11 @@ const FilterAutocompleteField: React.FC = ({ filter.value.includes(displayValue.value); const filteredValuesChecked = initialFieldDisplayValues.filter( - isValueChecked + isValueChecked, ); const filteredValuesUnchecked = fieldDisplayValues.filter( - displayValue => !isValueChecked(displayValue) + displayValue => !isValueChecked(displayValue), ); const displayHr = !!filteredValuesChecked.length; @@ -125,8 +125,8 @@ const FilterAutocompleteField: React.FC = ({ name={filter.name + "_autocomplete"} InputProps={{ classes: { - input: classes.input - } + input: classes.input, + }, }} onChange={event => filter.onSearchChange(event.target.value)} /> diff --git a/src/components/Filter/FilterContent/FilterContent.tsx b/src/components/Filter/FilterContent/FilterContent.tsx index eaf43a59a..433d77b4f 100644 --- a/src/components/Filter/FilterContent/FilterContent.tsx +++ b/src/components/Filter/FilterContent/FilterContent.tsx @@ -3,7 +3,7 @@ import { AccordionSummary, makeStyles, Paper, - Typography + Typography, } from "@material-ui/core"; import CollectionWithDividers from "@saleor/components/CollectionWithDividers"; import Hr from "@saleor/components/Hr"; @@ -18,7 +18,7 @@ import { FilterElement, FilterErrorMessages, IFilter, - InvalidFilters + InvalidFilters, } from "../types"; import FilterContentBody, { FilterContentBodyProps } from "./FilterContentBody"; import FilterContentBodyNameField from "./FilterContentBodyNameField"; @@ -29,7 +29,7 @@ const useExpanderStyles = makeStyles( theme => ({ btn: { border: "none", - marginRight: theme.spacing(1) + marginRight: theme.spacing(1), }, expanded: {}, @@ -39,16 +39,16 @@ const useExpanderStyles = makeStyles( padding: 0, "&:before": { - content: "none" + content: "none", }, "&$expanded": { margin: 0, - border: "none" - } - } + border: "none", + }, + }, }), - { name: "FilterContentExpander" } + { name: "FilterContentExpander" }, ); const useSummaryStyles = makeStyles( @@ -63,24 +63,24 @@ const useSummaryStyles = makeStyles( paddingRight: theme.spacing(2), "&$expanded": { - minHeight: 0 - } + minHeight: 0, + }, }, content: { margin: 0, "&$expanded": { - margin: 0 - } - } + margin: 0, + }, + }, }), - { name: "FilterContentExpanderSummary" } + { name: "FilterContentExpanderSummary" }, ); export interface FilterContentProps { filters: IFilter; onFilterPropertyChange: ( - value: FilterReducerAction + value: FilterReducerAction, ) => void; onFilterAttributeFocus?: (id?: string) => void; onClear: () => void; @@ -100,7 +100,7 @@ const FilterContent: React.FC = ({ onFilterPropertyChange, onFilterAttributeFocus, onSubmit, - dataStructure + dataStructure, }) => { const expanderClasses = useExpanderStyles({}); const summaryClasses = useSummaryStyles({}); @@ -109,12 +109,12 @@ const FilterContent: React.FC = ({ const getAutocompleteValuesWithNewValues = ( autocompleteDisplayValues: FilterAutocompleteDisplayValues, - filterField: FilterElement + filterField: FilterElement, ) => { if (filterField.type === FieldType.autocomplete) { return { ...autocompleteDisplayValues, - [filterField.name]: filterField.options + [filterField.name]: filterField.options, }; } @@ -126,20 +126,20 @@ const FilterContent: React.FC = ({ if (filterField.multipleFields) { return filterField.multipleFields.reduce( getAutocompleteValuesWithNewValues, - acc + acc, ); } return getAutocompleteValuesWithNewValues(acc, filterField); }, - {} + {}, ); const [ autocompleteDisplayValues, - setAutocompleteDisplayValues + setAutocompleteDisplayValues, ] = useStateFromProps( - initialAutocompleteDisplayValues + initialAutocompleteDisplayValues, ); const commonFilterBodyProps: Omit< @@ -149,7 +149,7 @@ const FilterContent: React.FC = ({ currencySymbol, autocompleteDisplayValues, setAutocompleteDisplayValues, - initialAutocompleteDisplayValues + initialAutocompleteDisplayValues, }; const handleFilterAttributeFocus = (filter?: FilterElement) => { @@ -190,12 +190,12 @@ const FilterContent: React.FC = ({ const { update } = action.payload; onFilterPropertyChange({ ...action, - payload: { ...action.payload, update: { ...update, active: true } } + payload: { ...action.payload, update: { ...update, active: true } }, }); }; const getFilterFromCurrentData = function( - filter: FilterElement + filter: FilterElement, ) { return filters.find(({ name }) => filter.name === name); }; @@ -225,9 +225,9 @@ const FilterContent: React.FC = ({ } classes={summaryClasses} @@ -260,7 +260,7 @@ const FilterContent: React.FC = ({ } filter={{ ...getFilterFromCurrentData(filterField), - active: currentFilter?.active + active: currentFilter?.active, }} > {filterField.label} diff --git a/src/components/Filter/FilterContent/FilterContentBody.tsx b/src/components/Filter/FilterContent/FilterContentBody.tsx index d62ab7889..7c80cd3a8 100644 --- a/src/components/Filter/FilterContent/FilterContentBody.tsx +++ b/src/components/Filter/FilterContent/FilterContentBody.tsx @@ -11,7 +11,7 @@ import classNames from "classnames"; import React from "react"; import FilterAutocompleteField, { - FilterAutocompleteDisplayValues + FilterAutocompleteDisplayValues, } from "../FilterAutocompleteField"; import { FilterKeyValueField } from "../FilterKeyValueField"; import FilterOptionField from "../FilterOptionField"; @@ -21,25 +21,25 @@ import { FilterElement, isFilterDateType, isFilterNumericType, - isFilterType + isFilterType, } from "../types"; const useStyles = makeStyles( theme => ({ filterSettings: { background: fade(theme.palette.primary.main, 0.1), - padding: theme.spacing(2, 3) + padding: theme.spacing(2, 3), }, option: { left: -theme.spacing(0.5), - position: "relative" + position: "relative", }, optionRadio: { - left: -theme.spacing(0.25) - } + left: -theme.spacing(0.25), + }, }), - { name: "FilterContentBody" } + { name: "FilterContentBody" }, ); const filterTestingContext = "filter-field-"; @@ -50,7 +50,7 @@ export interface FilterContentBodyProps { currencySymbol?: string; initialAutocompleteDisplayValues: FilterAutocompleteDisplayValues; onFilterPropertyChange: ( - value: FilterReducerAction + value: FilterReducerAction, ) => void; autocompleteDisplayValues: FilterAutocompleteDisplayValues; setAutocompleteDisplayValues: React.Dispatch< @@ -65,7 +65,7 @@ const FilterContentBody = ({ onFilterPropertyChange, autocompleteDisplayValues, setAutocompleteDisplayValues, - initialAutocompleteDisplayValues + initialAutocompleteDisplayValues, }: FilterContentBodyProps) => { const classes = useStyles({}); const commonClasses = useCommonStyles({}); @@ -89,10 +89,10 @@ const FilterContentBody = ({ payload: { name: filter.name, update: { - value: [event.target.value, filter.value[1]] - } + value: [event.target.value, filter.value[1]], + }, }, - type: "set-property" + type: "set-property", }) } /> @@ -152,10 +152,10 @@ const FilterContentBody = ({ payload: { name: filter.name, update: { - value: [option.value] - } + value: [option.value], + }, }, - type: "set-property" + type: "set-property", }) } /> diff --git a/src/components/Filter/FilterContent/FilterContentBodyNameField.tsx b/src/components/Filter/FilterContent/FilterContentBodyNameField.tsx index 2f9f88a68..c12b307e5 100644 --- a/src/components/Filter/FilterContent/FilterContentBodyNameField.tsx +++ b/src/components/Filter/FilterContent/FilterContentBodyNameField.tsx @@ -9,12 +9,12 @@ const useStyles = makeStyles( theme => ({ container: { "&:not(:last-of-type)": { - borderBottom: `1px solid ${theme.palette.divider}` + borderBottom: `1px solid ${theme.palette.divider}`, }, - padding: theme.spacing(1, 2.5) - } + padding: theme.spacing(1, 2.5), + }, }), - { name: "FilterContentBodyNameField" } + { name: "FilterContentBodyNameField" }, ); export interface FilterContentBodyNameFieldProps { @@ -24,7 +24,7 @@ export interface FilterContentBodyNameFieldProps { const FilterContentBodyNameField: React.FC = ({ filter, - onFilterPropertyChange + onFilterPropertyChange, }) => { const classes = useStyles({}); @@ -44,10 +44,10 @@ const FilterContentBodyNameField: React.FC = ({ payload: { name: filter.name, update: { - active: !filter.active - } + active: !filter.active, + }, }, - type: "set-property" + type: "set-property", }) } /> diff --git a/src/components/Filter/FilterContent/FilterContentHeader.tsx b/src/components/Filter/FilterContent/FilterContentHeader.tsx index 42c443a11..db3ff430e 100644 --- a/src/components/Filter/FilterContent/FilterContentHeader.tsx +++ b/src/components/Filter/FilterContent/FilterContentHeader.tsx @@ -11,16 +11,16 @@ const useStyles = makeStyles( alignItems: "center", display: "flex", justifyContent: "space-between", - padding: theme.spacing(1, 3) + padding: theme.spacing(1, 3), }, clear: { - marginRight: theme.spacing(1) + marginRight: theme.spacing(1), }, label: { - fontWeight: 600 - } + fontWeight: 600, + }, }), - { name: "FilterContentHeader" } + { name: "FilterContentHeader" }, ); interface FilterContentHeaderProps { @@ -28,7 +28,7 @@ interface FilterContentHeaderProps { } const FilterContentHeader: React.FC = ({ - onClear + onClear, }) => { const classes = useStyles({}); diff --git a/src/components/Filter/FilterContent/FilterDateTimeField.tsx b/src/components/Filter/FilterContent/FilterDateTimeField.tsx index 6d5117e5a..06b8aa36d 100644 --- a/src/components/Filter/FilterContent/FilterDateTimeField.tsx +++ b/src/components/Filter/FilterContent/FilterDateTimeField.tsx @@ -9,7 +9,7 @@ import { filterTestingContext, getDateFilterValue, getDateTimeFilterValue, - useCommonStyles + useCommonStyles, } from "./utils"; type FilterDateTimeFieldProps = FilterFieldBaseProps< @@ -19,7 +19,7 @@ type FilterDateTimeFieldProps = FilterFieldBaseProps< export const FilterDateTimeField: React.FC = ({ filter, - onFilterPropertyChange + onFilterPropertyChange, }) => { const classes = useCommonStyles({}); const isDateTime = filter.type === FieldType.dateTime; @@ -30,10 +30,10 @@ export const FilterDateTimeField: React.FC = ({ payload: { name: filter.name, update: { - value - } + value, + }, }, - type: "set-property" + type: "set-property", }); return ( @@ -49,16 +49,16 @@ export const FilterDateTimeField: React.FC = ({ name={filter.name + (isMultiple ? "_min" : "")} InputProps={{ classes: { - input: classes.input + input: classes.input, }, - type: "date" + type: "date", }} value={splitDateTime(filter.value[0]).date} onChange={event => { const value = getDateFilterValue( event.target.value, filter.value[0], - isDateTime + isDateTime, ); handleChange(isMultiple ? [value, filter.value[1]] : [value]); }} @@ -71,13 +71,13 @@ export const FilterDateTimeField: React.FC = ({ name={filter.name + (isMultiple ? "_time_min" : "")} InputProps={{ classes: { input: classes.input }, - type: "time" + type: "time", }} value={splitDateTime(filter.value[0]).time} onChange={event => { const value = getDateTimeFilterValue( filter.value[0], - event.target.value + event.target.value, ); handleChange(isMultiple ? [value, filter.value[1]] : [value]); }} @@ -105,9 +105,9 @@ export const FilterDateTimeField: React.FC = ({ name={filter.name + "_max"} InputProps={{ classes: { - input: classes.input + input: classes.input, }, - type: "date" + type: "date", }} value={splitDateTime(filter.value[1]).date} onChange={event => @@ -116,8 +116,8 @@ export const FilterDateTimeField: React.FC = ({ getDateFilterValue( event.target.value, filter.value[1], - isDateTime - ) + isDateTime, + ), ]) } /> @@ -129,13 +129,13 @@ export const FilterDateTimeField: React.FC = ({ name={filter.name + "_time_max"} InputProps={{ classes: { input: classes.input }, - type: "time" + type: "time", }} value={splitDateTime(filter.value[1]).time} onChange={event => handleChange([ filter.value[0], - getDateTimeFilterValue(filter.value[1], event.target.value) + getDateTimeFilterValue(filter.value[1], event.target.value), ]) } /> diff --git a/src/components/Filter/FilterContent/FilterErrorsList.tsx b/src/components/Filter/FilterContent/FilterErrorsList.tsx index 27f9bf0af..52e5a8f62 100644 --- a/src/components/Filter/FilterContent/FilterErrorsList.tsx +++ b/src/components/Filter/FilterContent/FilterErrorsList.tsx @@ -12,10 +12,10 @@ const useStyles = makeStyles( theme => ({ container: { backgroundColor: fade(theme.palette.primary.main, 0.1), - padding: theme.spacing(3, 3, 0, 3) + padding: theme.spacing(3, 3, 0, 3), }, listItemTitle: { - color: theme.palette.primary.contrastText + color: theme.palette.primary.contrastText, }, dot: { backgroundColor: theme.palette.primary.contrastText, @@ -24,14 +24,14 @@ const useStyles = makeStyles( height: 8, minHeight: 8, width: 8, - minWidth: 8 + minWidth: 8, }, itemContainer: { display: "flex", - alignItems: "center" - } + alignItems: "center", + }, }), - { name: "FilterErrorsList" } + { name: "FilterErrorsList" }, ); interface FilterErrorsListProps { @@ -43,7 +43,7 @@ interface FilterErrorsListProps { const FilterErrorsList: React.FC = ({ filter: { dependencies }, errors = [], - errorMessages + errorMessages, }) => { const classes = useStyles({}); const intl = useIntl(); @@ -52,7 +52,7 @@ const FilterErrorsList: React.FC = ({ try { return intl.formatMessage( errorMessages?.[code] || validationMessages[code], - { dependencies: dependencies?.join() } + { dependencies: dependencies?.join() }, ); } catch (e) { errorTracker.captureException(e); diff --git a/src/components/Filter/FilterContent/FilterGroupLabel.tsx b/src/components/Filter/FilterContent/FilterGroupLabel.tsx index 3507ae5d5..3b8e0473d 100644 --- a/src/components/Filter/FilterContent/FilterGroupLabel.tsx +++ b/src/components/Filter/FilterContent/FilterGroupLabel.tsx @@ -8,12 +8,12 @@ const useStyles = makeStyles( theme => ({ container: { "&:not(:last-of-type)": { - borderBottom: `1px solid ${theme.palette.divider}` + borderBottom: `1px solid ${theme.palette.divider}`, }, - padding: theme.spacing(1, 2.5) - } + padding: theme.spacing(1, 2.5), + }, }), - { name: "FilterGroupLabel" } + { name: "FilterGroupLabel" }, ); export type FilterGroupLabelProps< @@ -22,7 +22,7 @@ export type FilterGroupLabelProps< const FilterGroupLabel: React.FC = ({ filter, - onFilterPropertyChange + onFilterPropertyChange, }) => { const classes = useStyles({}); @@ -46,10 +46,10 @@ const FilterGroupLabel: React.FC = ({ payload: { name: filter.name, update: { - active: !filter.active - } + active: !filter.active, + }, }, - type: "set-property" + type: "set-property", }) } /> diff --git a/src/components/Filter/FilterContent/FilterNumericField.tsx b/src/components/Filter/FilterContent/FilterNumericField.tsx index 383f379fd..6c8bf5eca 100644 --- a/src/components/Filter/FilterContent/FilterNumericField.tsx +++ b/src/components/Filter/FilterContent/FilterNumericField.tsx @@ -16,7 +16,7 @@ type FilterNumericFieldProps = FilterFieldBaseProps< export const FilterNumericField: React.FC = ({ filter, onFilterPropertyChange, - currencySymbol + currencySymbol, }) => { const classes = useCommonStyles({}); const isMultiple = filter.multiple; @@ -26,10 +26,10 @@ export const FilterNumericField: React.FC = ({ payload: { name: filter.name, update: { - value - } + value, + }, }, - type: "set-property" + type: "set-property", }); return ( @@ -45,10 +45,10 @@ export const FilterNumericField: React.FC = ({ name={filter.name + (isMultiple ? "_min" : "")} InputProps={{ classes: { - input: classes.input + input: classes.input, }, type: "number", - endAdornment: filter.type === FieldType.price && currencySymbol + endAdornment: filter.type === FieldType.price && currencySymbol, }} value={filter.value[0]} onChange={({ target: { value } }) => @@ -77,10 +77,10 @@ export const FilterNumericField: React.FC = ({ name={filter.name + "_max"} InputProps={{ classes: { - input: classes.input + input: classes.input, }, type: "number", - endAdornment: filter.type === FieldType.price && currencySymbol + endAdornment: filter.type === FieldType.price && currencySymbol, }} value={filter.value[1]} onChange={event => diff --git a/src/components/Filter/FilterContent/FilterRangeField.tsx b/src/components/Filter/FilterContent/FilterRangeField.tsx index 7b9d38a45..88af403aa 100644 --- a/src/components/Filter/FilterContent/FilterRangeField.tsx +++ b/src/components/Filter/FilterContent/FilterRangeField.tsx @@ -16,7 +16,7 @@ export type FilterRangeFieldProps = FilterFieldBaseProps< const FilterRangeField: React.FC = ({ currencySymbol, filter, - onFilterPropertyChange + onFilterPropertyChange, }) => { const classes = useStyles(); @@ -29,10 +29,10 @@ const FilterRangeField: React.FC = ({ name={filter.name + "_min"} InputProps={{ classes: { - input: classes.fieldInput + input: classes.fieldInput, }, endAdornment: filter.type === FieldType.price && currencySymbol, - type: filter.type === FieldType.date ? "date" : "number" + type: filter.type === FieldType.date ? "date" : "number", }} value={filter.value[0]} onChange={event => @@ -40,10 +40,10 @@ const FilterRangeField: React.FC = ({ payload: { name: filter.name, update: { - value: [event.target.value, filter.value[1]] - } + value: [event.target.value, filter.value[1]], + }, }, - type: "set-property" + type: "set-property", }) } /> @@ -61,10 +61,10 @@ const FilterRangeField: React.FC = ({ name={filter.name + "_max"} InputProps={{ classes: { - input: classes.fieldInput + input: classes.fieldInput, }, endAdornment: filter.type === FieldType.price && currencySymbol, - type: filter.type === FieldType.date ? "date" : "number" + type: filter.type === FieldType.date ? "date" : "number", }} value={filter.value[1]} onChange={event => @@ -72,10 +72,10 @@ const FilterRangeField: React.FC = ({ payload: { name: filter.name, update: { - value: [filter.value[0], event.target.value] - } + value: [filter.value[0], event.target.value], + }, }, - type: "set-property" + type: "set-property", }) } /> diff --git a/src/components/Filter/FilterContent/FilterSingleSelectField.tsx b/src/components/Filter/FilterContent/FilterSingleSelectField.tsx index 90cf69f0d..44f216c3f 100644 --- a/src/components/Filter/FilterContent/FilterSingleSelectField.tsx +++ b/src/components/Filter/FilterContent/FilterSingleSelectField.tsx @@ -1,7 +1,7 @@ import { FilterFieldBaseProps, FilterType } from "@saleor/components/Filter"; import { getIsFilterMultipleChoices, - useCommonStyles + useCommonStyles, } from "@saleor/components/Filter/FilterContent/utils"; import FormSpacer from "@saleor/components/FormSpacer"; import React from "react"; @@ -13,7 +13,7 @@ type FilterSingleSelectFieldProps = FilterFieldBaseProps; export const FilterSingleSelectField: React.FC = ({ filter, - onFilterPropertyChange + onFilterPropertyChange, }) => { const classes = useCommonStyles({}); const intl = useIntl(); @@ -26,18 +26,18 @@ export const FilterSingleSelectField: React.FC = ( value={filter.multiple ? FilterType.MULTIPLE : FilterType.SINGULAR} InputProps={{ classes: { - input: classes.input - } + input: classes.input, + }, }} onChange={event => onFilterPropertyChange({ payload: { name: filter.name, update: { - multiple: event.target.value === FilterType.MULTIPLE - } + multiple: event.target.value === FilterType.MULTIPLE, + }, }, - type: "set-property" + type: "set-property", }) } /> diff --git a/src/components/Filter/FilterContent/FilterTextField.tsx b/src/components/Filter/FilterContent/FilterTextField.tsx index e797a6afe..a97028f21 100644 --- a/src/components/Filter/FilterContent/FilterTextField.tsx +++ b/src/components/Filter/FilterContent/FilterTextField.tsx @@ -14,7 +14,7 @@ export type FilterTextFieldProps = FilterFieldBaseProps< const FilterTextField: React.FC = ({ currencySymbol, filter, - onFilterPropertyChange + onFilterPropertyChange, }) => { const classes = useStyles(); @@ -25,7 +25,7 @@ const FilterTextField: React.FC = ({ name={filter.name} InputProps={{ classes: { - input: classes.fieldInput + input: classes.fieldInput, }, endAdornment: filter.type === FieldType.price && currencySymbol, type: @@ -33,7 +33,7 @@ const FilterTextField: React.FC = ({ ? "date" : [FieldType.number, FieldType.price].includes(filter.type) ? "number" - : "text" + : "text", }} value={filter.value[0]} onChange={event => @@ -41,10 +41,10 @@ const FilterTextField: React.FC = ({ payload: { name: filter.name, update: { - value: [event.target.value, filter.value[1]] - } + value: [event.target.value, filter.value[1]], + }, }, - type: "set-property" + type: "set-property", }) } /> diff --git a/src/components/Filter/FilterContent/messages.ts b/src/components/Filter/FilterContent/messages.ts index acea0706e..5cf7583ab 100644 --- a/src/components/Filter/FilterContent/messages.ts +++ b/src/components/Filter/FilterContent/messages.ts @@ -4,13 +4,13 @@ const messages = defineMessages({ key: { defaultMessage: "Key", id: "q1shey", - description: "key-value field input" + description: "key-value field input", }, value: { defaultMessage: "Value", id: "Pnj+JH", - description: "key-value field input" - } + description: "key-value field input", + }, }); export default messages; diff --git a/src/components/Filter/FilterContent/styles.ts b/src/components/Filter/FilterContent/styles.ts index edf9def3a..f8cb4aa8a 100644 --- a/src/components/Filter/FilterContent/styles.ts +++ b/src/components/Filter/FilterContent/styles.ts @@ -4,33 +4,33 @@ import { makeStyles } from "@saleor/macaw-ui"; const useStyles = makeStyles( theme => ({ andLabel: { - margin: theme.spacing(0, 2) + margin: theme.spacing(0, 2), }, arrow: { - marginRight: theme.spacing(2) + marginRight: theme.spacing(2), }, filterSettings: { background: fade(theme.palette.primary.main, 0.1), - padding: theme.spacing(2, 3) + padding: theme.spacing(2, 3), }, inputRange: { alignItems: "center", - display: "flex" + display: "flex", }, option: { left: theme.spacing(-0.5), - position: "relative" + position: "relative", }, optionRadio: { - left: theme.spacing(-0.25) + left: theme.spacing(-0.25), }, fieldInput: { - padding: "12px 0 9px 12px" - } + padding: "12px 0 9px 12px", + }, }), - { name: "Filter" } + { name: "Filter" }, ); export default useStyles; diff --git a/src/components/Filter/FilterContent/utils.ts b/src/components/Filter/FilterContent/utils.ts index 6b4c8ae4a..ada947f69 100644 --- a/src/components/Filter/FilterContent/utils.ts +++ b/src/components/Filter/FilterContent/utils.ts @@ -10,56 +10,56 @@ export const filterTestingContext = "filter-field-"; export const useCommonStyles = makeStyles( theme => ({ andLabel: { - margin: theme.spacing(1, 2, 1, 0) + margin: theme.spacing(1, 2, 1, 0), }, arrow: { - marginRight: theme.spacing(2) + marginRight: theme.spacing(2), }, input: { - padding: "12px 0 9px 12px" + padding: "12px 0 9px 12px", }, inputRange: { alignItems: "center", - display: "flex" + display: "flex", }, inputTime: { marginLeft: theme.spacing(1), - width: "150px" + width: "150px", }, spacer: { - paddingRight: theme.spacing(4) - } + paddingRight: theme.spacing(4), + }, }), - { name: "FilterContentBodyCommon" } + { name: "FilterContentBodyCommon" }, ); export function getIsFilterMultipleChoices( - intl: IntlShape + intl: IntlShape, ): SingleAutocompleteChoiceType[] { return [ { label: intl.formatMessage({ id: "I+UwqI", defaultMessage: "equal to", - description: "is filter range or value" + description: "is filter range or value", }), - value: FilterType.SINGULAR + value: FilterType.SINGULAR, }, { label: intl.formatMessage({ id: "QBxN6z", defaultMessage: "between", - description: "is filter range or value" + description: "is filter range or value", }), - value: FilterType.MULTIPLE - } + value: FilterType.MULTIPLE, + }, ]; } export const getDateFilterValue = ( dateTime: string, dateTimeString: string | null, - dateTimeFormat: boolean + dateTimeFormat: boolean, ) => { const { date } = splitDateTime(dateTime); if (!dateTimeFormat) { @@ -71,7 +71,7 @@ export const getDateFilterValue = ( export const getDateTimeFilterValue = ( dateTimeString: string | null, - timeString: string + timeString: string, ) => { const { date } = splitDateTime(dateTimeString || new Date().toISOString()); return joinDateTime(date, timeString); diff --git a/src/components/Filter/FilterKeyValueField.tsx b/src/components/Filter/FilterKeyValueField.tsx index e47591ae5..3919f69d5 100644 --- a/src/components/Filter/FilterKeyValueField.tsx +++ b/src/components/Filter/FilterKeyValueField.tsx @@ -12,39 +12,39 @@ const useStyles = makeStyles( metadataField: { display: "flex", alignItems: "center", - gap: theme.spacing(0.5) + gap: theme.spacing(0.5), }, fieldsWrapper: { display: "flex", flexDirection: "column", gap: theme.spacing(0.5), - marginBottom: theme.spacing(1) + marginBottom: theme.spacing(1), }, formWrapper: { display: "flex", - flexDirection: "column" + flexDirection: "column", }, addButton: { - alignSelf: "flex-end" + alignSelf: "flex-end", }, deleteButton: { marginLeft: "0.25rem", - marginRight: "-0.75rem" - } + marginRight: "-0.75rem", + }, }), - { name: "FilterKeyValueField" } + { name: "FilterKeyValueField" }, ); const getUpdateArrayFn = (key: "key" | "value") => ( array: T[], index: number, - value: string + value: string, ) => { const item = array[index]; return [ ...array.slice(0, index), { ...item, [key]: value }, - ...array.slice(index + 1) + ...array.slice(index + 1), ]; }; @@ -59,7 +59,7 @@ type FilterKeyValueFieldProps = FilterFieldBaseProps< export const FilterKeyValueField = ({ filter, - onFilterPropertyChange + onFilterPropertyChange, }: FilterKeyValueFieldProps) => { const intl = useIntl(); const classes = useStyles(); @@ -83,10 +83,10 @@ export const FilterKeyValueField = ({ payload: { name: filter.name, update: { - value: updateKeyFn(values, index, event.target.value) - } + value: updateKeyFn(values, index, event.target.value), + }, }, - type: "set-property" + type: "set-property", }) } /> @@ -100,10 +100,10 @@ export const FilterKeyValueField = ({ payload: { name: filter.name, update: { - value: updateValueFn(values, index, event.target.value) - } + value: updateValueFn(values, index, event.target.value), + }, }, - type: "set-property" + type: "set-property", }) } /> @@ -115,10 +115,10 @@ export const FilterKeyValueField = ({ payload: { name: filter.name, update: { - value: values.filter((_, i) => i !== index) - } + value: values.filter((_, i) => i !== index), + }, }, - type: "set-property" + type: "set-property", }); }} > @@ -135,10 +135,10 @@ export const FilterKeyValueField = ({ payload: { name: filter.name, update: { - value: createEmptyPair(values) - } + value: createEmptyPair(values), + }, }, - type: "set-property" + type: "set-property", }); }} > diff --git a/src/components/Filter/FilterOptionField.tsx b/src/components/Filter/FilterOptionField.tsx index 84bc52cd3..7fe6dcb3a 100644 --- a/src/components/Filter/FilterOptionField.tsx +++ b/src/components/Filter/FilterOptionField.tsx @@ -11,14 +11,14 @@ const useStyles = makeStyles( theme => ({ option: { left: theme.spacing(-0.5), - position: "relative" + position: "relative", }, optionRadio: { - left: theme.spacing(-0.25) + left: theme.spacing(-0.25), }, - root: {} + root: {}, }), - { name: "FilterOptionField" } + { name: "FilterOptionField" }, ); const FilterOptionField: React.FC a === b) - : [value] - } + : [value], + }, }, - type: "set-property" + type: "set-property", }); return ( @@ -45,7 +45,7 @@ const FilterOptionField: React.FC (
diff --git a/src/components/Filter/messages.ts b/src/components/Filter/messages.ts index e5ec3fa6b..59299c946 100644 --- a/src/components/Filter/messages.ts +++ b/src/components/Filter/messages.ts @@ -6,34 +6,34 @@ export const validationMessages = defineMessages({ VALUE_REQUIRED: { id: "XkX56I", defaultMessage: "Choose a value", - description: "filters error messages value required" + description: "filters error messages value required", }, DEPENDENCIES_MISSING: { id: "erC44f", defaultMessage: "Filter requires other filters: {dependencies}", - description: "filters error messages dependencies missing" + description: "filters error messages dependencies missing", }, UNKNOWN_ERROR: { id: "USS3Q7", defaultMessage: "Unknown error occurred", - description: "filters error messages unknown error" - } + description: "filters error messages unknown error", + }, }); export const keyValueMessages = defineMessages({ key: { defaultMessage: "Key", id: "q1shey", - description: "key-value field input" + description: "key-value field input", }, value: { defaultMessage: "Value", id: "Pnj+JH", - description: "key-value field input" + description: "key-value field input", }, add: { defaultMessage: "Add more", id: "ILgbKN", - description: "key-value field button add more key-value pairs" - } + description: "key-value field button add more key-value pairs", + }, }); diff --git a/src/components/Filter/reducer.ts b/src/components/Filter/reducer.ts index 37bb53897..8ee318141 100644 --- a/src/components/Filter/reducer.ts +++ b/src/components/Filter/reducer.ts @@ -18,22 +18,22 @@ export interface FilterReducerAction { export type UpdateStateFunction = < T extends FieldType >( - value: FilterReducerAction + value: FilterReducerAction, ) => void; function merge( prevState: IFilter, - newState: IFilter + newState: IFilter, ): IFilter { return newState.map(newFilter => { const prevFilter = prevState.find( - prevFilter => prevFilter.name === newFilter.name + prevFilter => prevFilter.name === newFilter.name, ); if (!!prevFilter) { return { ...newFilter, active: prevFilter.active, - value: prevFilter.value + value: prevFilter.value, }; } @@ -44,12 +44,12 @@ function merge( function setProperty( prevState: IFilter, filter: K, - updateData: Partial> + updateData: Partial>, ): IFilter { const field = prevState.find(f => f.name === filter); const updatedField = { ...field, - ...updateData + ...updateData, }; return update(updatedField, prevState, (a, b) => a.name === b.name); @@ -57,14 +57,14 @@ function setProperty( function reduceFilter( prevState: IFilter, - action: FilterReducerAction + action: FilterReducerAction, ): IFilter { switch (action.type) { case "set-property": return setProperty( prevState, action.payload.name, - action.payload.update + action.payload.update, ); case "merge": return merge(prevState, action.payload.new); diff --git a/src/components/Filter/types.ts b/src/components/Filter/types.ts index a111369b7..77dda09cb 100644 --- a/src/components/Filter/types.ts +++ b/src/components/Filter/types.ts @@ -14,7 +14,7 @@ export enum FieldType { price = "price", options = "options", text = "text", - keyValue = "keyValue" + keyValue = "keyValue", } interface FilterElementCommonData { @@ -84,18 +84,18 @@ export type FilterElementGeneric< : FilterElementRegular & { type: T }; export const isFilterDateType = ( - filter: FilterElement + filter: FilterElement, ): filter is FilterElementGeneric => filter.type === FieldType.date || filter.type === FieldType.dateTime; export const isFilterNumericType = ( - filter: FilterElement + filter: FilterElement, ): filter is FilterElementGeneric => filter.type === FieldType.number || filter.type === FieldType.price; export const isFilterType = ( filter: FilterElement, - type: T + type: T, ): filter is FilterElementGeneric => filter.type === type; export interface FilterFieldBaseProps< @@ -124,13 +124,13 @@ export type IFilter< export enum FilterType { MULTIPLE = "MULTIPLE", - SINGULAR = "SINGULAR" + SINGULAR = "SINGULAR", } export enum ValidationErrorCode { VALUE_REQUIRED = "VALUE_REQUIRED", DEPENDENCIES_MISSING = "DEPENDENCIES_MISSING", - UNKNOWN_ERROR = "UNKNOWN_ERROR" + UNKNOWN_ERROR = "UNKNOWN_ERROR", } export type InvalidFilters = Record; diff --git a/src/components/Filter/useFilter.ts b/src/components/Filter/useFilter.ts index 17e11b781..daafd04e1 100644 --- a/src/components/Filter/useFilter.ts +++ b/src/components/Filter/useFilter.ts @@ -6,17 +6,17 @@ import { FieldType, FilterElement, IFilter } from "./types"; export type FilterDispatchFunction = < T extends FieldType >( - value: FilterReducerAction + value: FilterReducerAction, ) => void; export type UseFilter = [ Array>, FilterDispatchFunction, - () => void + () => void, ]; function getParsedInitialFilter( - initialFilter: IFilter + initialFilter: IFilter, ): IFilter { return initialFilter.reduce((resultFilter, filterField) => { if (filterField.multipleFields) { @@ -42,18 +42,18 @@ function useFilter(initialFilter: IFilter): UseFilter { new: parsedInitialFilter.map(each => ({ ...each, active: false, - value: [] - })) + value: [], + })), }, - type: "reset" + type: "reset", }); const refresh = () => dispatchFilterAction({ payload: { - new: parsedInitialFilter + new: parsedInitialFilter, }, - type: "merge" + type: "merge", }); useEffect(refresh, [initialFilter]); diff --git a/src/components/Filter/utils.ts b/src/components/Filter/utils.ts index 40086a091..7142f4465 100644 --- a/src/components/Filter/utils.ts +++ b/src/components/Filter/utils.ts @@ -4,20 +4,20 @@ import { FieldType, FilterElement, InvalidFilters, - ValidationErrorCode + ValidationErrorCode, } from "./types"; export const getByName = (nameToCompare: string) => (obj: { name: string }) => obj.name === nameToCompare; export const isAutocompleteFilterFieldValid = function({ - value + value, }: FilterElement) { return !!compact(value).length; }; export const isNumberFilterFieldValid = function({ - value + value, }: FilterElement) { const [min, max] = value; @@ -29,7 +29,7 @@ export const isNumberFilterFieldValid = function({ }; export const isFilterFieldValid = function( - filter: FilterElement + filter: FilterElement, ) { const { type } = filter; @@ -48,7 +48,7 @@ export const isFilterFieldValid = function( }; export const isFilterValid = function( - filter: FilterElement + filter: FilterElement, ) { const { required, active } = filter; @@ -61,7 +61,7 @@ export const isFilterValid = function( export const extractInvalidFilters = function( filtersData: Array>, - filtersDataStructure: Array> + filtersDataStructure: Array>, ): InvalidFilters { return filtersDataStructure.reduce( (invalidFilters, { name, multipleFields, dependencies }) => { @@ -112,9 +112,9 @@ export const extractInvalidFilters = function( return { ...invalidFilters, - [name]: errors + [name]: errors, }; }, - {} as InvalidFilters + {} as InvalidFilters, ); }; diff --git a/src/components/FilterBar/FilterBar.tsx b/src/components/FilterBar/FilterBar.tsx index 05f4613b8..90e0e7453 100644 --- a/src/components/FilterBar/FilterBar.tsx +++ b/src/components/FilterBar/FilterBar.tsx @@ -23,17 +23,17 @@ const useStyles = makeStyles( borderBottom: `1px solid ${theme.palette.divider}`, display: "flex", flexWrap: "wrap", - padding: theme.spacing(1, 4) + padding: theme.spacing(1, 4), }, tabActionButton: { marginLeft: theme.spacing(2), paddingLeft: theme.spacing(4), - paddingRight: theme.spacing(4) - } + paddingRight: theme.spacing(4), + }, }), { - name: "FilterBar" - } + name: "FilterBar", + }, ); const FilterBar: React.FC = props => { @@ -52,7 +52,7 @@ const FilterBar: React.FC = props => { onTabChange, onTabDelete, onTabSave, - errorMessages + errorMessages, } = props; const classes = useStyles(props); @@ -81,7 +81,7 @@ const FilterBar: React.FC = props => { onClick={() => undefined} label={intl.formatMessage({ id: "qIgdO6", - defaultMessage: "Custom Filter" + defaultMessage: "Custom Filter", })} /> )} diff --git a/src/components/FilterCard/FilterCard.tsx b/src/components/FilterCard/FilterCard.tsx index 86a16bceb..37d3ff2b0 100644 --- a/src/components/FilterCard/FilterCard.tsx +++ b/src/components/FilterCard/FilterCard.tsx @@ -22,7 +22,7 @@ const FilterCard: React.FC = ({ children, handleClear }) => { } title={intl.formatMessage({ id: "zSOvI0", - defaultMessage: "Filters" + defaultMessage: "Filters", })} /> {children} diff --git a/src/components/Form/ExitFormDialog.tsx b/src/components/Form/ExitFormDialog.tsx index 71188cfb6..f48587b62 100644 --- a/src/components/Form/ExitFormDialog.tsx +++ b/src/components/Form/ExitFormDialog.tsx @@ -13,20 +13,20 @@ const useStyles = makeStyles( height: "100vh", display: "flex", justifyContent: "center", - alignItems: "center" + alignItems: "center", }, buttonsContainer: { display: "flex", - justifyContent: "flex-end" + justifyContent: "flex-end", }, dialogContent: { "@media (min-width: 800px)": { - minWidth: 500 + minWidth: 500, }, - paddingTop: 0 - } + paddingTop: 0, + }, }), - { name: "ExitFormPrompt" } + { name: "ExitFormPrompt" }, ); interface ExitFormDialogProps { @@ -42,7 +42,7 @@ const ExitFormDialog: React.FC = ({ onLeave, onClose, isOpen, - isSubmitDisabled + isSubmitDisabled, }) => { const classes = useStyles(); const intl = useIntl(); @@ -51,7 +51,7 @@ const ExitFormDialog: React.FC = ({ @@ -69,7 +69,7 @@ const ExitFormDialog: React.FC = ({ {intl.formatMessage( isSubmitDisabled ? messages.continueEditingButton - : messages.confirmButton + : messages.confirmButton, )}
diff --git a/src/components/Form/ExitFormDialogProvider.tsx b/src/components/Form/ExitFormDialogProvider.tsx index 591600e54..572622748 100644 --- a/src/components/Form/ExitFormDialogProvider.tsx +++ b/src/components/Form/ExitFormDialogProvider.tsx @@ -43,7 +43,7 @@ export const ExitFormDialogContext = React.createContext({ setIsSubmitting: () => undefined, submit: () => Promise.resolve([]), leave: () => undefined, - setIsSubmitDisabled: () => undefined + setIsSubmitDisabled: () => undefined, }); const defaultValues = { @@ -54,7 +54,7 @@ const defaultValues = { submit: null, enableExitDialog: false, isSubmitting: false, - formsData: {} + formsData: {}, }; export function useExitFormDialogProvider() { @@ -102,7 +102,7 @@ export function useExitFormDialogProvider() { formsData.current = { ...formsData.current, - [id]: updatedFormData + [id]: updatedFormData, }; }; @@ -110,7 +110,7 @@ export function useExitFormDialogProvider() { // but doesn't cause re-renders const setSubmitRef = SubmitPromise>( id: symbol, - submitFn: T + submitFn: T, ) => { setFormData(id, { submitFn }); }; @@ -144,7 +144,7 @@ export function useExitFormDialogProvider() { const getFormsDataValuesArray = () => Object.getOwnPropertySymbols(formsData.current).map( - key => formsData.current[key] + key => formsData.current[key], ); const hasAnyFormsDirty = () => @@ -218,7 +218,7 @@ export function useExitFormDialogProvider() { setIsSubmitting(true); const errors = await Promise.all( - getDirtyFormsSubmitFn().map(submitFn => submitFn()) + getDirtyFormsSubmitFn().map(submitFn => submitFn()), ); setIsSubmitting(false); @@ -253,7 +253,7 @@ export function useExitFormDialogProvider() { setIsSubmitting, submit: handleSubmit, setIsSubmitDisabled, - leave: handleLeave + leave: handleLeave, }; return { @@ -263,7 +263,7 @@ export function useExitFormDialogProvider() { handleLeave, handleClose, shouldBlockNav, - isSubmitDisabled + isSubmitDisabled, }; } @@ -275,7 +275,7 @@ const ExitFormDialogProvider = ({ children }) => { providerData, showDialog, shouldBlockNav, - isSubmitDisabled + isSubmitDisabled, } = useExitFormDialogProvider(); useBeforeUnload(e => { diff --git a/src/components/Form/Form.tsx b/src/components/Form/Form.tsx index 013219042..14b5e36ec 100644 --- a/src/components/Form/Form.tsx +++ b/src/components/Form/Form.tsx @@ -31,7 +31,7 @@ function Form({ confirmLeave, formId, checkIfSaveIsDisabled, - disabled + disabled, }); function handleSubmit(event?: React.FormEvent, cb?: () => void) { diff --git a/src/components/Form/messages.ts b/src/components/Form/messages.ts index c09e89f5a..0246e3f35 100644 --- a/src/components/Form/messages.ts +++ b/src/components/Form/messages.ts @@ -4,26 +4,26 @@ export const exitFormPromptMessages = defineMessages({ title: { id: "TtZg/K", defaultMessage: "Would you like to save changes?", - description: "ExitFormPrompt title" + description: "ExitFormPrompt title", }, unableToSaveTitle: { id: "FWWliu", defaultMessage: "You have unsaved changes", - description: "ExitFormPrompt title" + description: "ExitFormPrompt title", }, cancelButton: { id: "sn2awN", defaultMessage: "Discard changes", - description: "ExitFormPrompt cancel button" + description: "ExitFormPrompt cancel button", }, confirmButton: { id: "MPOj0I", defaultMessage: "Save changes", - description: "ExitFormPrompt confirm button" + description: "ExitFormPrompt confirm button", }, continueEditingButton: { id: "1eEyJv", defaultMessage: "Continue editing", - description: "ExitFormPrompt continue editing button" - } + description: "ExitFormPrompt continue editing button", + }, }); diff --git a/src/components/Form/useExitFormDialog.test.tsx b/src/components/Form/useExitFormDialog.test.tsx index c634e1ea6..5ae3c7da7 100644 --- a/src/components/Form/useExitFormDialog.test.tsx +++ b/src/components/Form/useExitFormDialog.test.tsx @@ -6,7 +6,7 @@ import { MemoryRouter } from "react-router-dom"; import { ExitFormDialogContext, - useExitFormDialogProvider + useExitFormDialogProvider, } from "./ExitFormDialogProvider"; import { useExitFormDialog } from "./useExitFormDialog"; @@ -34,7 +34,7 @@ const setup = (submitFn: () => SubmitPromise, confirmLeave = true) => return { form, exit, - history + history, }; }, { @@ -42,8 +42,8 @@ const setup = (submitFn: () => SubmitPromise, confirmLeave = true) => {children} - ) - } + ), + }, ); describe("useExitFormDialog", () => { @@ -55,7 +55,7 @@ describe("useExitFormDialog", () => { // When act(() => { result.current.form.change({ - target: { name: "field", value: "something" } + target: { name: "field", value: "something" }, }); }); act(() => { @@ -75,7 +75,7 @@ describe("useExitFormDialog", () => { // When act(() => { result.current.form.change({ - target: { name: "field", value: "something" } + target: { name: "field", value: "something" }, }); }); act(() => { @@ -90,14 +90,14 @@ describe("useExitFormDialog", () => { it("blocks navigation if an error occured", async () => { // Given const submitFn = jest.fn(() => - Promise.resolve([{ field: "field", code: "code" }]) + Promise.resolve([{ field: "field", code: "code" }]), ); const { result } = setup(submitFn); // When act(() => { result.current.form.change({ - target: { name: "field", value: "something" } + target: { name: "field", value: "something" }, }); result.current.history.push(targetPath); }); @@ -110,14 +110,14 @@ describe("useExitFormDialog", () => { it("allows navigation if an error occured, but confirmation is not needed", async () => { // Given const submitFn = jest.fn(() => - Promise.resolve([{ field: "field", code: "code" }]) + Promise.resolve([{ field: "field", code: "code" }]), ); const { result } = setup(submitFn, false); // When act(() => { result.current.form.change({ - target: { name: "field", value: "something" } + target: { name: "field", value: "something" }, }); result.current.history.push(targetPath); }); @@ -130,14 +130,14 @@ describe("useExitFormDialog", () => { it("blocks navigation if an error occured and user tries to leave anyway", async () => { // Given const submitFn = jest.fn(() => - Promise.resolve([{ field: "field", code: "code" }]) + Promise.resolve([{ field: "field", code: "code" }]), ); const { result } = setup(submitFn); // When act(() => { result.current.form.change({ - target: { name: "field", value: "something" } + target: { name: "field", value: "something" }, }); result.current.history.push(targetPath); }); @@ -161,7 +161,7 @@ describe("useExitFormDialog", () => { // When act(() => { result.current.form.change({ - target: { name: "field", value: "something" } + target: { name: "field", value: "something" }, }); }); act(() => { diff --git a/src/components/Form/useExitFormDialog.ts b/src/components/Form/useExitFormDialog.ts index fc14221ae..7478642fc 100644 --- a/src/components/Form/useExitFormDialog.ts +++ b/src/components/Form/useExitFormDialog.ts @@ -4,7 +4,7 @@ import { ExitFormDialogContext, ExitFormDialogData, SubmitFn, - WithFormId + WithFormId, } from "./ExitFormDialogProvider"; export interface UseExitFormDialogResult @@ -20,7 +20,7 @@ export interface UseExitFormDialogProps { } export const useExitFormDialog = ( - { formId, isDisabled }: UseExitFormDialogProps = { formId: undefined } + { formId, isDisabled }: UseExitFormDialogProps = { formId: undefined }, ): UseExitFormDialogResult => { const id = useRef(formId || Symbol()).current; @@ -28,7 +28,7 @@ export const useExitFormDialog = ( const { setIsDirty, setIsSubmitDisabled, - setExitDialogSubmitRef + setExitDialogSubmitRef, } = exitDialogProps; React.useEffect(() => { @@ -42,6 +42,6 @@ export const useExitFormDialog = ( formId: id, setIsDirty: (value: boolean) => setIsDirty(id, value), setExitDialogSubmitRef: (submitFn: SubmitFn) => - setExitDialogSubmitRef(id, submitFn) + setExitDialogSubmitRef(id, submitFn), }; }; diff --git a/src/components/FormSpacer.tsx b/src/components/FormSpacer.tsx index 377d1dd0f..e84aa1996 100644 --- a/src/components/FormSpacer.tsx +++ b/src/components/FormSpacer.tsx @@ -4,10 +4,10 @@ import React from "react"; const useStyles = makeStyles( theme => ({ spacer: { - marginTop: theme.spacing(3) - } + marginTop: theme.spacing(3), + }, }), - { name: "FormSpacer" } + { name: "FormSpacer" }, ); interface FormSpacerProps { diff --git a/src/components/Grid/Grid.tsx b/src/components/Grid/Grid.tsx index d192e8121..47f671394 100644 --- a/src/components/Grid/Grid.tsx +++ b/src/components/Grid/Grid.tsx @@ -13,33 +13,33 @@ export interface GridProps { const useStyles = makeStyles( theme => ({ default: { - gridTemplateColumns: "9fr 4fr" + gridTemplateColumns: "9fr 4fr", }, inverted: { - gridTemplateColumns: "4fr 9fr" + gridTemplateColumns: "4fr 9fr", }, root: { "& > div": { - overflow: "hidden" + overflow: "hidden", }, display: "grid", gridColumnGap: theme.spacing(3), gridRowGap: theme.spacing(3), [theme.breakpoints.down("sm")]: { gridRowGap: theme.spacing(1), - gridTemplateColumns: "1fr" - } + gridTemplateColumns: "1fr", + }, }, uniform: { - gridTemplateColumns: "1fr 1fr" + gridTemplateColumns: "1fr 1fr", }, richText: { "&& > div": { - overflow: "visible" - } - } + overflow: "visible", + }, + }, }), - { name: "Grid" } + { name: "Grid" }, ); export const Grid: React.FC = props => { @@ -53,7 +53,7 @@ export const Grid: React.FC = props => { [classes.default]: variant === "default", [classes.inverted]: variant === "inverted", [classes.uniform]: variant === "uniform", - [classes.richText]: richText + [classes.richText]: richText, })} > {children} @@ -62,6 +62,6 @@ export const Grid: React.FC = props => { }; Grid.displayName = "Grid"; Grid.defaultProps = { - variant: "default" + variant: "default", }; export default Grid; diff --git a/src/components/Hr.tsx b/src/components/Hr.tsx index 9aa6ccb26..2d98ff43f 100644 --- a/src/components/Hr.tsx +++ b/src/components/Hr.tsx @@ -14,10 +14,10 @@ const useStyles = makeStyles( display: "block", height: 1, margin: 0, - width: "100%" - } + width: "100%", + }, }), - { name: "Hr" } + { name: "Hr" }, ); export const Hr: React.FC = props => { diff --git a/src/components/IconButton/IconButton.tsx b/src/components/IconButton/IconButton.tsx index 96fd88732..bfb9ffa01 100644 --- a/src/components/IconButton/IconButton.tsx +++ b/src/components/IconButton/IconButton.tsx @@ -1,6 +1,6 @@ import { IconButton as MacawIconButton, - IconButtonProps + IconButtonProps, } from "@saleor/macaw-ui"; import { isExternalURL } from "@saleor/utils/urls"; import React from "react"; @@ -15,11 +15,11 @@ const _IconButton: React.FC = React.forwardRef( } return ; - } + }, ); export const IconButton = _IconButton as < T extends React.ElementType = "button" >( - props: IconButtonProps + props: IconButtonProps, ) => ReturnType; diff --git a/src/components/IconButtonTableCell/IconButtonTableCell.tsx b/src/components/IconButtonTableCell/IconButtonTableCell.tsx index c69d4fa3a..e4295bff9 100644 --- a/src/components/IconButtonTableCell/IconButtonTableCell.tsx +++ b/src/components/IconButtonTableCell/IconButtonTableCell.tsx @@ -16,13 +16,13 @@ const useStyles = makeStyles( theme => ({ root: { "&:last-child": { - paddingRight: 0 + paddingRight: 0, }, paddingRight: 0, - width: `calc(${ICONBUTTON_SIZE}px + ${theme.spacing(0.5)})` - } + width: `calc(${ICONBUTTON_SIZE}px + ${theme.spacing(0.5)})`, + }, }), - { name: "IconButtonTableCell" } + { name: "IconButtonTableCell" }, ); const IconButtonTableCell: React.FC = props => { const { children, className, disabled, onClick } = props; diff --git a/src/components/ImageUpload/ImageUpload.tsx b/src/components/ImageUpload/ImageUpload.tsx index d2f5f2964..5b9030c11 100644 --- a/src/components/ImageUpload/ImageUpload.tsx +++ b/src/components/ImageUpload/ImageUpload.tsx @@ -22,10 +22,10 @@ const useStyles = makeStyles( theme => ({ backdrop: { background: fade(theme.palette.primary.main, 0.1), - color: theme.palette.primary.main + color: theme.palette.primary.main, }, fileField: { - display: "none" + display: "none", }, imageContainer: { background: "#ffffff", @@ -37,25 +37,25 @@ const useStyles = makeStyles( padding: theme.spacing(2), position: "relative", transition: theme.transitions.duration.standard + "s", - width: 148 + width: 148, }, photosIcon: { height: 32, margin: "0 auto", - width: 32 + width: 32, }, photosIconContainer: { padding: theme.spacing(5, 0), - textAlign: "center" + textAlign: "center", }, uploadText: { color: theme.typography.body1.color, fontSize: 12, fontWeight: 600, - textTransform: "uppercase" - } + textTransform: "uppercase", + }, }), - { name: "ImageUpload" } + { name: "ImageUpload" }, ); export const ImageUpload: React.FC = props => { @@ -67,7 +67,7 @@ export const ImageUpload: React.FC = props => { iconContainerClassName, isActiveClassName, hideUploadIcon, - onImageUpload + onImageUpload, } = props; const classes = useStyles(props); @@ -80,13 +80,13 @@ export const ImageUpload: React.FC = props => { {...getRootProps()} className={classNames(className, classes.photosIconContainer, { [classes.backdrop]: isDragActive, - [isActiveClassName]: isDragActive + [isActiveClassName]: isDragActive, })} > {!hideUploadIcon && (
({ root: { - textDecoration: "none" - } + textDecoration: "none", + }, }), - { name: "InternalLink" } + { name: "InternalLink" }, ); diff --git a/src/components/LanguageSwitch/LanguageSwitch.tsx b/src/components/LanguageSwitch/LanguageSwitch.tsx index 2f1380be2..f2873384f 100644 --- a/src/components/LanguageSwitch/LanguageSwitch.tsx +++ b/src/components/LanguageSwitch/LanguageSwitch.tsx @@ -6,7 +6,7 @@ import { MenuList as Menu, Paper, Popper, - Typography + Typography, } from "@material-ui/core"; import ArrowDropDown from "@material-ui/icons/ArrowDropDown"; import { LanguageCodeEnum, LanguageFragment } from "@saleor/graphql"; @@ -26,10 +26,10 @@ const useStyles = makeStyles( theme => ({ arrow: { color: theme.palette.primary.main, - transition: theme.transitions.duration.standard + "ms" + transition: theme.transitions.duration.standard + "ms", }, container: { - paddingBottom: theme.spacing(1) + paddingBottom: theme.spacing(1), }, menuContainer: { cursor: "pointer", @@ -37,23 +37,23 @@ const useStyles = makeStyles( justifyContent: "space-between", minWidth: 90, padding: theme.spacing(), - position: "relative" + position: "relative", }, menuItem: { - textAlign: "justify" + textAlign: "justify", }, menuPaper: { maxHeight: 600, - overflow: "scroll" + overflow: "scroll", }, popover: { - zIndex: 1 + zIndex: 1, }, rotate: { - transform: "rotate(180deg)" - } + transform: "rotate(180deg)", + }, }), - { name: "LanguageSwitch" } + { name: "LanguageSwitch" }, ); const LanguageSwitch: React.FC = props => { @@ -72,7 +72,7 @@ const LanguageSwitch: React.FC = props => { {currentLanguage} @@ -88,7 +88,7 @@ const LanguageSwitch: React.FC = props => { {...TransitionProps} style={{ transformOrigin: - placement === "bottom" ? "right top" : "right bottom" + placement === "bottom" ? "right top" : "right bottom", }} > @@ -112,7 +112,7 @@ const LanguageSwitch: React.FC = props => { description="button" values={{ languageCode: lang.code, - languageName: lang.language + languageName: lang.language, }} /> diff --git a/src/components/LimitReachedAlert.tsx b/src/components/LimitReachedAlert.tsx index 6277fcbdc..3051a5a13 100644 --- a/src/components/LimitReachedAlert.tsx +++ b/src/components/LimitReachedAlert.tsx @@ -4,10 +4,10 @@ import React from "react"; const useStyles = makeStyles( theme => ({ root: { - marginBottom: theme.spacing(3) - } + marginBottom: theme.spacing(3), + }, }), - { name: "LimitReachedAlert" } + { name: "LimitReachedAlert" }, ); export type LimitReachedAlertProps = Omit; diff --git a/src/components/Link.tsx b/src/components/Link.tsx index 68053c84e..98705f13b 100644 --- a/src/components/Link.tsx +++ b/src/components/Link.tsx @@ -9,27 +9,27 @@ import { Link as RouterLink } from "react-router-dom"; const useStyles = makeStyles( theme => ({ primary: { - color: theme.palette.textHighlighted.active + color: theme.palette.textHighlighted.active, }, root: { cursor: "pointer", - display: "inline" + display: "inline", }, secondary: { - color: theme.palette.primary.main + color: theme.palette.primary.main, }, underline: { - textDecoration: "underline" + textDecoration: "underline", }, noUnderline: { - textDecoration: "none" + textDecoration: "none", }, disabled: { cursor: "default", - color: theme.palette.textHighlighted.inactive - } + color: theme.palette.textHighlighted.inactive, + }, }), - { name: "Link" } + { name: "Link" }, ); interface LinkProps extends React.AnchorHTMLAttributes { @@ -61,7 +61,7 @@ const Link: React.FC = props => { [classes[color]]: true, [classes.underline]: underline, [classes.noUnderline]: !underline, - [classes.disabled]: disabled + [classes.disabled]: disabled, }), onClick: event => { if (disabled || !onClick) { @@ -71,7 +71,7 @@ const Link: React.FC = props => { event.preventDefault(); onClick(event); }, - ...linkProps + ...linkProps, }; return ( diff --git a/src/components/LinkChoice/LinkChoice.stories.tsx b/src/components/LinkChoice/LinkChoice.stories.tsx index 8589b34f8..7d4dc0a00 100644 --- a/src/components/LinkChoice/LinkChoice.stories.tsx +++ b/src/components/LinkChoice/LinkChoice.stories.tsx @@ -11,7 +11,7 @@ const suggestions = countries.map(c => ({ label: c.name, value: c.code })); const props: Omit = { choices: suggestions.slice(0, 10), - name: "country" + name: "country", }; storiesOf("Generics / Link with choices", module) diff --git a/src/components/LinkChoice/LinkChoice.tsx b/src/components/LinkChoice/LinkChoice.tsx index 9459f5231..c18b02e89 100644 --- a/src/components/LinkChoice/LinkChoice.tsx +++ b/src/components/LinkChoice/LinkChoice.tsx @@ -14,38 +14,38 @@ const useStyles = makeStyles( arrow: { position: "relative", top: 6, - transition: theme.transitions.duration.short + "ms" + transition: theme.transitions.duration.short + "ms", }, highlighted: { - background: theme.palette.background.default + background: theme.palette.background.default, }, menuItem: { "&:not(:last-of-type)": { - marginBottom: theme.spacing() + marginBottom: theme.spacing(), }, - borderRadius: 4 + borderRadius: 4, }, paper: { - padding: theme.spacing() + padding: theme.spacing(), }, popper: { marginTop: theme.spacing(1), - zIndex: 2 + zIndex: 2, }, root: { "&:focus": { - textDecoration: "underline" + textDecoration: "underline", }, outline: 0, - position: "relative" + position: "relative", }, rotate: { - transform: "rotate(180deg)" - } + transform: "rotate(180deg)", + }, }), { - name: "LinkChoice" - } + name: "LinkChoice", + }, ); export interface LinkChoiceProps { @@ -61,7 +61,7 @@ const LinkChoice: React.FC = ({ choices, name, value, - onChange + onChange, }) => { const classes = useStyles({}); const [open, setOpen] = React.useState(false); @@ -74,8 +74,8 @@ const LinkChoice: React.FC = ({ onChange({ target: { name, - value - } + value, + }, }); }; @@ -83,14 +83,14 @@ const LinkChoice: React.FC = ({ switch (event.keyCode) { case codes.down: setHighlightedIndex( - highlightedIndex => (highlightedIndex + 1) % choices.length + highlightedIndex => (highlightedIndex + 1) % choices.length, ); break; case codes.up: setHighlightedIndex(highlightedIndex => highlightedIndex === 0 ? choices.length - 1 - : (highlightedIndex - 1) % choices.length + : (highlightedIndex - 1) % choices.length, ); break; case codes.enter: @@ -114,7 +114,7 @@ const LinkChoice: React.FC = ({ {current.label} @@ -136,7 +136,7 @@ const LinkChoice: React.FC = ({ {choices.map((choice, choiceIndex) => ( { const locales = [ "does-not-exist-1", "does-not-exist-2", - "does-not-exist-3" + "does-not-exist-3", ]; expect(getMatchingLocale(locales)).toBe(undefined); diff --git a/src/components/Locale/Locale.tsx b/src/components/Locale/Locale.tsx index 165062c60..835a4c478 100644 --- a/src/components/Locale/Locale.tsx +++ b/src/components/Locale/Locale.tsx @@ -44,7 +44,7 @@ export enum Locale { UK = "uk", VI = "vi", ZH_HANS = "zh-Hans", - ZH_HANT = "zh-Hant" + ZH_HANT = "zh-Hant", } interface StructuredMessage { @@ -95,7 +95,7 @@ export const localeNames: Record = { [Locale.UK]: "Українська", [Locale.VI]: "Tiếng Việt", [Locale.ZH_HANS]: "简体中文", - [Locale.ZH_HANT]: "繁體中文" + [Locale.ZH_HANT]: "繁體中文", }; const dotSeparator = "_dot_"; @@ -133,7 +133,7 @@ export interface LocaleContextType { } export const LocaleContext = React.createContext({ locale: defaultLocale, - setLocale: () => undefined + setLocale: () => undefined, }); const { Consumer: LocaleConsumer, Provider: RawLocaleProvider } = LocaleContext; @@ -141,7 +141,7 @@ const { Consumer: LocaleConsumer, Provider: RawLocaleProvider } = LocaleContext; const LocaleProvider: React.FC = ({ children }) => { const [locale, setLocale] = useLocalStorage( "locale", - getMatchingLocale(navigator.languages) || defaultLocale + getMatchingLocale(navigator.languages) || defaultLocale, ); const [messages, setMessages] = React.useState(undefined); @@ -174,7 +174,7 @@ const LocaleProvider: React.FC = ({ children }) => { {children} diff --git a/src/components/MediaTile/MediaTile.tsx b/src/components/MediaTile/MediaTile.tsx index be57db4f2..d94f227a0 100644 --- a/src/components/MediaTile/MediaTile.tsx +++ b/src/components/MediaTile/MediaTile.tsx @@ -10,13 +10,13 @@ const useStyles = makeStyles( height: "100%", objectFit: "contain", userSelect: "none", - width: "100%" + width: "100%", }, mediaContainer: { "&:hover, &.dragged": { "& $mediaOverlay": { - display: "block" - } + display: "block", + }, }, background: theme.palette.background.paper, border: `1px solid ${theme.palette.divider}`, @@ -25,7 +25,7 @@ const useStyles = makeStyles( overflow: "hidden", padding: theme.spacing(2), position: "relative", - width: 148 + width: 148, }, mediaOverlay: { background: theme.palette.background.default, @@ -36,18 +36,18 @@ const useStyles = makeStyles( left: 0, position: "absolute", top: 0, - width: 148 + width: 148, }, mediaOverlayShadow: { "&mediaOverlay": { alignItems: "center", display: "flex", - justifyContent: "center" - } + justifyContent: "center", + }, }, mediaOverlayToolbar: { display: "flex", - justifyContent: "flex-end" + justifyContent: "flex-end", }, controlButton: { color: theme.palette.saleor.main[1], @@ -58,14 +58,14 @@ const useStyles = makeStyles( padding: 0, "&:hover": { - color: theme.palette.saleor.active[1] + color: theme.palette.saleor.active[1], }, "&:first-child": { - marginRight: 0 - } - } + marginRight: 0, + }, + }, }), - { name: "MediaTile" } + { name: "MediaTile" }, ); interface MediaTileBaseProps { @@ -104,7 +104,7 @@ const MediaTile: React.FC = props => {
{loading ? ( diff --git a/src/components/MenuToggle.tsx b/src/components/MenuToggle.tsx index ea08fb68f..3cb02c3ec 100644 --- a/src/components/MenuToggle.tsx +++ b/src/components/MenuToggle.tsx @@ -17,7 +17,7 @@ interface MenuToggleState { class MenuToggle extends React.Component { state = { - open: false + open: false, }; handleClick = () => { @@ -34,7 +34,7 @@ class MenuToggle extends React.Component { return children({ actions: { close: this.handleClose, open: this.handleClick }, - open + open, }); } } diff --git a/src/components/Metadata/Metadata.test.tsx b/src/components/Metadata/Metadata.test.tsx index 2ffb5b1c0..b1e80ccae 100644 --- a/src/components/Metadata/Metadata.test.tsx +++ b/src/components/Metadata/Metadata.test.tsx @@ -31,7 +31,7 @@ describe("Metadata editor", () => { wrapper .find(`[${expandDataEl}]`) .first() - .prop(expandDataEl) + .prop(expandDataEl), ).toEqual(false); wrapper .find(`[${expandButton}]`) @@ -41,7 +41,7 @@ describe("Metadata editor", () => { wrapper .find(`[${expandDataEl}]`) .first() - .prop(expandDataEl) + .prop(expandDataEl), ).toEqual(true); }); @@ -60,7 +60,7 @@ describe("Metadata editor", () => { wrapper .find(inputNameSelector) .first() - .prop("value") + .prop("value"), ).toEqual(props.data.metadata[1].key); wrapper @@ -72,7 +72,7 @@ describe("Metadata editor", () => { wrapper .find(inputNameSelector) .first() - .prop("value") + .prop("value"), ).toEqual("x"); }); @@ -91,7 +91,7 @@ describe("Metadata editor", () => { wrapper .find(inputNameSelector) .first() - .prop("value") + .prop("value"), ).toEqual(props.data.metadata[1].value); wrapper @@ -103,7 +103,7 @@ describe("Metadata editor", () => { wrapper .find(inputNameSelector) .first() - .prop("value") + .prop("value"), ).toEqual("x"); }); @@ -120,7 +120,7 @@ describe("Metadata editor", () => { .simulate("click"); expect(wrapper.find(fieldSelector).length).toEqual( - props.data.metadata.length + props.data.metadata.length, ); wrapper @@ -129,7 +129,7 @@ describe("Metadata editor", () => { .simulate("click"); expect(wrapper.find(fieldSelector).length).toEqual( - props.data.metadata.length - 1 + props.data.metadata.length - 1, ); }); @@ -146,7 +146,7 @@ describe("Metadata editor", () => { .simulate("click"); expect(wrapper.find(fieldSelector).length).toEqual( - props.data.metadata.length + props.data.metadata.length, ); wrapper @@ -155,7 +155,7 @@ describe("Metadata editor", () => { .simulate("click"); expect(wrapper.find(fieldSelector).length).toEqual( - props.data.metadata.length + 1 + props.data.metadata.length + 1, ); }); }); diff --git a/src/components/Metadata/Metadata.tsx b/src/components/Metadata/Metadata.tsx index 0f78d1dd2..09b31ff7d 100644 --- a/src/components/Metadata/Metadata.tsx +++ b/src/components/Metadata/Metadata.tsx @@ -34,21 +34,21 @@ const Metadata: React.FC = ({ data, onChange }) => { value: field === EventDataField.value ? value - : dataToUpdate[fieldIndex].value + : dataToUpdate[fieldIndex].value, }, dataToUpdate, - fieldIndex + fieldIndex, ) : action === EventDataAction.add ? [ ...dataToUpdate, { key: "", - value: "" - } + value: "", + }, ] - : removeAtIndex(dataToUpdate, fieldIndex) - } + : removeAtIndex(dataToUpdate, fieldIndex), + }, }); }; diff --git a/src/components/Metadata/MetadataCard.tsx b/src/components/Metadata/MetadataCard.tsx index 44d6218ed..d792fb971 100644 --- a/src/components/Metadata/MetadataCard.tsx +++ b/src/components/Metadata/MetadataCard.tsx @@ -8,7 +8,7 @@ import { TableHead, TableRow, TextField, - Typography + Typography, } from "@material-ui/core"; import { Button } from "@saleor/components/Button"; import { MetadataInput } from "@saleor/graphql"; @@ -36,7 +36,7 @@ export const valueInputPrefix = EventDataField.value; const MetadataCard: React.FC = ({ data, isPrivate, - onChange + onChange, }) => { const intl = useIntl(); const loaded = React.useRef(false); @@ -66,16 +66,16 @@ const MetadataCard: React.FC = ({ ? intl.formatMessage({ id: "ETHnjq", defaultMessage: "Private Metadata", - description: "header" + description: "header", }) : intl.formatMessage({ id: "VcI+Zh", defaultMessage: "Metadata", - description: "header" + description: "header", })} = ({ defaultMessage="{number,plural,one{{number} string} other{{number} strings}}" description="number of metadata fields in model" values={{ - number: data.length + number: data.length, }} /> @@ -153,8 +153,8 @@ const MetadataCard: React.FC = ({ = ({ = ({ onChange({ target: { name: EventDataAction.delete, - value: fieldIndex - } + value: fieldIndex, + }, }) } > @@ -205,8 +205,8 @@ const MetadataCard: React.FC = ({ onChange({ target: { name: EventDataAction.add, - value: null - } + value: null, + }, }) } > diff --git a/src/components/Metadata/fixtures.ts b/src/components/Metadata/fixtures.ts index 970116c99..b809aedc5 100644 --- a/src/components/Metadata/fixtures.ts +++ b/src/components/Metadata/fixtures.ts @@ -5,18 +5,18 @@ export const props: MetadataProps = { metadata: [ { key: "key", - value: "value" + value: "value", }, { key: "key2", - value: '{\n "jsonValue": "some-value"\n}' + value: '{\n "jsonValue": "some-value"\n}', }, { key: "key3", - value: "some-value" - } + value: "some-value", + }, ], - privateMetadata: [] + privateMetadata: [], }, - onChange: () => undefined + onChange: () => undefined, }; diff --git a/src/components/Metadata/styles.ts b/src/components/Metadata/styles.ts index df7aff0e6..e2948b813 100644 --- a/src/components/Metadata/styles.ts +++ b/src/components/Metadata/styles.ts @@ -4,75 +4,75 @@ const useStyles = makeStyles( theme => { const colAction: React.CSSProperties = { textAlign: "right", - width: 130 + width: 130, }; const colName: React.CSSProperties = { - width: 220 + width: 220, }; return { colAction: { "&:last-child": { ...colAction, - paddingRight: theme.spacing(3) - } + paddingRight: theme.spacing(3), + }, }, colActionHeader: { - ...colAction + ...colAction, }, colName: { ...colName, - verticalAlign: "top" + verticalAlign: "top", }, colNameHeader: { - ...colName + ...colName, }, colValue: {}, actions: { "&&": { paddingBottom: theme.spacing(2), - paddingTop: theme.spacing(2) - } + paddingTop: theme.spacing(2), + }, }, content: { paddingBottom: 0, - paddingTop: theme.spacing() + paddingTop: theme.spacing(), }, emptyContainer: { paddingBottom: 0, - paddingTop: 0 + paddingTop: 0, }, expandBtn: { position: "relative", left: theme.spacing(1), top: -2, transition: theme.transitions.create("transform", { - duration: theme.transitions.duration.shorter - }) + duration: theme.transitions.duration.shorter, + }), }, header: { "&&": { - paddingBottom: theme.spacing(1) - } + paddingBottom: theme.spacing(1), + }, }, input: { - padding: theme.spacing(0.5, 2) + padding: theme.spacing(0.5, 2), }, nameInput: { - padding: `13px 16px` + padding: `13px 16px`, }, table: { marginTop: theme.spacing(2), - tableLayout: "fixed" + tableLayout: "fixed", }, rotate: { - transform: "rotate(-180deg)" - } + transform: "rotate(-180deg)", + }, }; }, { - name: "Metadata" - } + name: "Metadata", + }, ); export default useStyles; diff --git a/src/components/Metadata/types.ts b/src/components/Metadata/types.ts index d68a8baf6..58c2f0c7e 100644 --- a/src/components/Metadata/types.ts +++ b/src/components/Metadata/types.ts @@ -3,11 +3,11 @@ import { MetadataInput } from "@saleor/graphql"; export enum EventDataAction { add = "add", delete = "delete", - update = "update" + update = "update", } export enum EventDataField { name = "name", - value = "value" + value = "value", } export interface EventData { action: EventDataAction; diff --git a/src/components/Metadata/utils.ts b/src/components/Metadata/utils.ts index b1a30d33b..f074653bf 100644 --- a/src/components/Metadata/utils.ts +++ b/src/components/Metadata/utils.ts @@ -33,7 +33,7 @@ export function parseEventData(event: ChangeEvent): EventData { action, field, fieldIndex, - value + value, }; } diff --git a/src/components/Money/Money.tsx b/src/components/Money/Money.tsx index a5d167738..6818fe9c7 100644 --- a/src/components/Money/Money.tsx +++ b/src/components/Money/Money.tsx @@ -6,10 +6,10 @@ const useStyles = makeStyles( { currency: { fontSize: "0.875em", - marginRight: "0.5rem" - } + marginRight: "0.5rem", + }, }, - { name: "Money" } + { name: "Money" }, ); export interface IMoney { @@ -31,12 +31,12 @@ export const Money: React.FC = ({ money }) => { const currencyFractionDigits = new Intl.NumberFormat(locale, { style: "currency", - currency: money.currency + currency: money.currency, }).resolvedOptions().maximumFractionDigits; const amount = money.amount.toLocaleString(locale, { maximumFractionDigits: currencyFractionDigits, - minimumFractionDigits: currencyFractionDigits + minimumFractionDigits: currencyFractionDigits, }); return ( diff --git a/src/components/Money/index.ts b/src/components/Money/index.ts index dfd638702..0db7e5226 100644 --- a/src/components/Money/index.ts +++ b/src/components/Money/index.ts @@ -6,13 +6,13 @@ export * from "./Money"; export function addMoney(init: IMoney, ...args: IMoney[]): IMoney { return { amount: args.reduce((acc, curr) => acc + curr.amount, init.amount), - currency: init.currency + currency: init.currency, }; } export function subtractMoney(init: IMoney, ...args: IMoney[]): IMoney { return { amount: args.reduce((acc, curr) => acc - curr.amount, init.amount), - currency: init.currency + currency: init.currency, }; } @@ -20,7 +20,7 @@ export const formatMoney = (money: IMoney, locale: string) => { try { const formattedMoney = money.amount.toLocaleString(locale, { currency: money.currency, - style: "currency" + style: "currency", }); return formattedMoney; } catch (error) { diff --git a/src/components/MoneyRange/MoneyRange.tsx b/src/components/MoneyRange/MoneyRange.tsx index 63e850fa4..be66e24f1 100644 --- a/src/components/MoneyRange/MoneyRange.tsx +++ b/src/components/MoneyRange/MoneyRange.tsx @@ -20,34 +20,34 @@ export const MoneyRange: React.FC = ({ from, to }) => { { id: "zTdwWM", defaultMessage: "{fromMoney} - {toMoney}", - description: "money" + description: "money", }, { fromMoney: formatMoney(from, locale), - toMoney: formatMoney(to, locale) - } + toMoney: formatMoney(to, locale), + }, ) : from && !to ? intl.formatMessage( { id: "lW5uJO", defaultMessage: "from {money}", - description: "money" + description: "money", }, { - money: formatMoney(from, locale) - } + money: formatMoney(from, locale), + }, ) : !from && to ? intl.formatMessage( { id: "hptDxW", defaultMessage: "to {money}", - description: "money" + description: "money", }, { - money: formatMoney(to, locale) - } + money: formatMoney(to, locale), + }, ) : "-" } diff --git a/src/components/MultiAutocompleteSelectField/MultiAutocompleteSelectField.stories.tsx b/src/components/MultiAutocompleteSelectField/MultiAutocompleteSelectField.stories.tsx index 98d665139..be18a95af 100644 --- a/src/components/MultiAutocompleteSelectField/MultiAutocompleteSelectField.stories.tsx +++ b/src/components/MultiAutocompleteSelectField/MultiAutocompleteSelectField.stories.tsx @@ -7,10 +7,10 @@ import { storiesOf } from "@storybook/react"; import React from "react"; import MultiAutocompleteSelectField, { - MultiAutocompleteSelectFieldProps + MultiAutocompleteSelectFieldProps, } from "./MultiAutocompleteSelectField"; import MultiAutocompleteSelectFieldContent, { - MultiAutocompleteSelectFieldContentProps + MultiAutocompleteSelectFieldContentProps, } from "./MultiAutocompleteSelectFieldContent"; const suggestions = countries.map(c => ({ label: c.name, value: c.code })); @@ -23,7 +23,7 @@ const props: MultiAutocompleteSelectFieldProps = { name: "country", onChange: () => undefined, placeholder: "Select country", - value: undefined + value: undefined, }; const Story: React.FC undefined + onFetchMore: () => undefined, }; storiesOf("Generics / Multiple select with autocomplete", module) diff --git a/src/components/MultiAutocompleteSelectField/MultiAutocompleteSelectField.tsx b/src/components/MultiAutocompleteSelectField/MultiAutocompleteSelectField.tsx index 3b1ef75bb..c8b2a2043 100644 --- a/src/components/MultiAutocompleteSelectField/MultiAutocompleteSelectField.tsx +++ b/src/components/MultiAutocompleteSelectField/MultiAutocompleteSelectField.tsx @@ -2,7 +2,7 @@ import { Popper, PopperPlacementType, TextField, - Typography + Typography, } from "@material-ui/core"; import { fade } from "@material-ui/core/styles/colorManipulator"; import CloseIcon from "@material-ui/icons/Close"; @@ -16,27 +16,27 @@ import React from "react"; import MultiAutocompleteSelectFieldContent, { MultiAutocompleteActionType, - MultiAutocompleteChoiceType + MultiAutocompleteChoiceType, } from "./MultiAutocompleteSelectFieldContent"; const useStyles = makeStyles( theme => ({ chip: { - width: "100%" + width: "100%", }, chipClose: { height: 32, padding: 0, - width: 32 + width: 32, }, chipContainer: { display: "flex", flexDirection: "column", - marginTop: theme.spacing(1) + marginTop: theme.spacing(1), }, chipInner: { "& svg": { - color: theme.palette.primary.contrastText + color: theme.palette.primary.contrastText, }, alignItems: "center", background: fade(theme.palette.primary.main, 0.8), @@ -46,18 +46,18 @@ const useStyles = makeStyles( justifyContent: "space-between", margin: theme.spacing(1, 0), paddingLeft: theme.spacing(2), - paddingRight: theme.spacing(1) + paddingRight: theme.spacing(1), }, chipLabel: { - color: theme.palette.primary.contrastText + color: theme.palette.primary.contrastText, }, container: { flexGrow: 1, - position: "relative" + position: "relative", }, disabledChipInner: { "& svg": { - color: theme.palette.grey[200] + color: theme.palette.grey[200], }, alignItems: "center", background: fade(theme.palette.grey[400], 0.8), @@ -67,7 +67,7 @@ const useStyles = makeStyles( justifyContent: "space-between", margin: theme.spacing(1, 0), paddingLeft: theme.spacing(2), - paddingRight: theme.spacing(1) + paddingRight: theme.spacing(1), }, adornment: { color: theme.palette.saleor.main[3], @@ -76,16 +76,16 @@ const useStyles = makeStyles( display: "flex", alignItems: "center", "& svg": { - transition: theme.transitions.duration.shorter + "ms" - } + transition: theme.transitions.duration.shorter + "ms", + }, }, adornmentRotate: { "& svg": { - transform: "rotate(180deg)" - } - } + transform: "rotate(180deg)", + }, + }, }), - { name: "MultiAutocompleteSelectField" } + { name: "MultiAutocompleteSelectField" }, ); export interface MultiAutocompleteSelectFieldProps @@ -145,13 +145,13 @@ const MultiAutocompleteSelectFieldComponent: React.FC + downshiftOpts?: ControllerStateAndHelpers, ) => { if (downshiftOpts) { downshiftOpts.reset({ inputValue: "", isOpen: true }); } onChange({ - target: { name, value: item } + target: { name, value: item }, } as any); }; @@ -181,7 +181,7 @@ const MultiAutocompleteSelectFieldComponent: React.FC { const displayCustomValue = inputValue && @@ -189,7 +189,7 @@ const MultiAutocompleteSelectFieldComponent: React.FC - choice.label.toLowerCase() === inputValue.toLowerCase() + choice.label.toLowerCase() === inputValue.toLowerCase(), ); return ( @@ -200,7 +200,7 @@ const MultiAutocompleteSelectFieldComponent: React.FC {endAdornment} @@ -212,15 +212,15 @@ const MultiAutocompleteSelectFieldComponent: React.FC @@ -246,11 +246,11 @@ const MultiAutocompleteSelectFieldComponent: React.FC { add.onClick(); closeMenu(); - } + }, } } choices={choices?.filter( - choice => !value.includes(choice.value) + choice => !value.includes(choice.value), )} displayCustomValue={displayCustomValue} displayValues={displayValues} @@ -322,7 +322,7 @@ const MultiAutocompleteSelectField: React.FC setQuery(q || "")} choices={filter(choices, query, { - key: "label" + key: "label", })} {...props} /> diff --git a/src/components/MultiAutocompleteSelectField/MultiAutocompleteSelectFieldContent.tsx b/src/components/MultiAutocompleteSelectField/MultiAutocompleteSelectFieldContent.tsx index 388f78b77..81e59527e 100644 --- a/src/components/MultiAutocompleteSelectField/MultiAutocompleteSelectFieldContent.tsx +++ b/src/components/MultiAutocompleteSelectField/MultiAutocompleteSelectFieldContent.tsx @@ -3,12 +3,12 @@ import { CircularProgress, MenuItem, Paper, - Typography + Typography, } from "@material-ui/core"; import AddIcon from "@material-ui/icons/Add"; import Checkbox from "@saleor/components/Checkbox"; import useElementScroll, { - isScrolledToBottom + isScrolledToBottom, } from "@saleor/hooks/useElementScroll"; import { makeStyles } from "@saleor/macaw-ui"; import { FetchMoreProps } from "@saleor/types"; @@ -52,15 +52,15 @@ const useStyles = makeStyles( borderRadius: "100%", height: 24, margin: theme.spacing(), - width: 24 + width: 24, }, addIcon: { height: 24, margin: 9, - width: 20 + width: 20, }, arrowContainer: { - position: "relative" + position: "relative", }, arrowInnerContainer: { alignItems: "center", @@ -75,42 +75,42 @@ const useStyles = makeStyles( opacity: 1, position: "absolute", transition: theme.transitions.duration.short + "ms", - width: "100%" + width: "100%", }, checkbox: { height: 24, - width: 20 + width: 20, }, content: { maxHeight: `calc(${menuItemHeight * maxMenuItems}px + ${theme.spacing( - 2 + 2, )})`, overflowY: "scroll", - padding: 8 + padding: 8, }, hide: { opacity: 0, - zIndex: -1 + zIndex: -1, }, hr: { - margin: theme.spacing(1, 0) + margin: theme.spacing(1, 0), }, menuItem: { "&:focus": { backgroundColor: [ theme.palette.background.default, - "!important" + "!important", ] as any, color: theme.palette.primary.main, - fontWeight: 400 + fontWeight: 400, }, "&:hover": { backgroundColor: [ theme.palette.background.default, - "!important" + "!important", ] as any, color: theme.palette.primary.main, - fontWeight: 700 + fontWeight: 700, }, paddingLeft: theme.spacing(1.5), borderRadius: 4, @@ -120,35 +120,35 @@ const useStyles = makeStyles( height: "auto", marginBottom: theme.spacing(0.5), padding: 0, - whiteSpace: "normal" + whiteSpace: "normal", }, menuItemLabel: { - overflowWrap: "break-word" + overflowWrap: "break-word", }, progress: {}, progressContainer: { display: "flex", justifyContent: "center", - padding: theme.spacing(1, 0) + padding: theme.spacing(1, 0), }, root: { borderBottomLeftRadius: 8, borderBottomRightRadius: 8, margin: theme.spacing(1, 0), overflow: "hidden", - zIndex: 22 - } + zIndex: 22, + }, }), { - name: "MultiAutocompleteSelectFieldContent" - } + name: "MultiAutocompleteSelectFieldContent", + }, ); function getChoiceIndex( index: number, displayValues: MultiAutocompleteChoiceType[], displayCustomValue: boolean, - add: boolean + add: boolean, ) { let choiceIndex = index; if (add || displayCustomValue) { @@ -172,7 +172,7 @@ const MultiAutocompleteSelectFieldContent: React.FC @@ -239,7 +239,7 @@ const MultiAutocompleteSelectFieldContent: React.FC @@ -254,7 +254,7 @@ const MultiAutocompleteSelectFieldContent: React.FC @@ -275,7 +275,7 @@ const MultiAutocompleteSelectFieldContent: React.FC @@ -329,7 +329,7 @@ const MultiAutocompleteSelectFieldContent: React.FC diff --git a/src/components/MultiSelectField/MultiSelectField.tsx b/src/components/MultiSelectField/MultiSelectField.tsx index 1c24e9c7e..89e4e5ec2 100644 --- a/src/components/MultiSelectField/MultiSelectField.tsx +++ b/src/components/MultiSelectField/MultiSelectField.tsx @@ -4,7 +4,7 @@ import { FormHelperText, InputLabel, MenuItem, - Select + Select, } from "@material-ui/core"; import { SelectProps } from "@material-ui/core/Select"; import { makeStyles } from "@saleor/macaw-ui"; @@ -16,19 +16,19 @@ import Checkbox from "../Checkbox"; const useStyles = makeStyles( theme => ({ checkbox: { - marginRight: theme.spacing(-2) + marginRight: theme.spacing(-2), }, formControl: { - width: "100%" + width: "100%", }, menuItem: { alignItems: "center", display: "flex", justifyContent: "space-between", - width: "100%" - } + width: "100%", + }, }), - { name: "MultiSelectField" } + { name: "MultiSelectField" }, ); interface MultiSelectFieldProps { @@ -56,7 +56,7 @@ export const MultiSelectField: React.FC = props => { onChange, name, hint, - selectProps + selectProps, } = props; const classes = useStyles(props); @@ -91,7 +91,7 @@ export const MultiSelectField: React.FC = props => { {choices.length > 0 ? ( choices.map(choice => { const isSelected = !!value.find( - selectedChoice => selectedChoice === choice.value + selectedChoice => selectedChoice === choice.value, ); return ( @@ -119,7 +119,7 @@ export const MultiSelectField: React.FC = props => { ); }; MultiSelectField.defaultProps = { - value: [] + value: [], }; MultiSelectField.displayName = "MultiSelectField"; diff --git a/src/components/Navigator/Navigator.tsx b/src/components/Navigator/Navigator.tsx index 05d056148..daa3d3f0f 100644 --- a/src/components/Navigator/Navigator.tsx +++ b/src/components/Navigator/Navigator.tsx @@ -17,7 +17,7 @@ import { hasActions, hasCatalog, hasCustomers, - hasViews + hasViews, } from "./modes/utils"; import NavigatorInput from "./NavigatorInput"; import NavigatorSection from "./NavigatorSection"; @@ -29,7 +29,7 @@ const navigatorNotificationStorageKey = "notifiedAboutNavigator"; function getItemOffset( actions: QuickSearchAction[], - cbs: Array + cbs: Array, ): number { return cbs.reduce((acc, cb) => cb(actions).length + acc, 0); } @@ -40,24 +40,24 @@ const useStyles = makeStyles( alignItems: "center", display: "flex", justifyContent: "center", - padding: theme.spacing(3) + padding: theme.spacing(3), }, paper: { - overflow: "hidden" + overflow: "hidden", }, root: { [theme.breakpoints.down("sm")]: { - height: "auto" + height: "auto", }, height: 500, maxWidth: 900, outline: 0, - width: "100%" - } + width: "100%", + }, }), { - name: "Navigator" - } + name: "Navigator", + }, ); export interface NavigatorProps { @@ -72,7 +72,7 @@ const Navigator: React.FC = ({ visible, setVisibility }) => { const notify = useNotifier(); const [notifiedAboutNavigator, setNotifiedAboutNavigator] = useLocalStorage( navigatorNotificationStorageKey, - false + false, ); const classes = useStyles({}); const theme = useTheme(); @@ -91,20 +91,20 @@ const Navigator: React.FC = ({ visible, setVisibility }) => { id: "EM+30g", defaultMessage: "Our new feature to help you with your daily tasks. Run Navigator using {keyboardShortcut} shortcut.", - description: "navigator notification" + description: "navigator notification", }, { keyboardShortcut: navigator.platform.toLowerCase().indexOf("mac") >= 0 ? "⌘+K" - : "Ctrl+K" - } + : "Ctrl+K", + }, ), title: intl.formatMessage({ id: "Gxm7Qx", defaultMessage: "Navigator is here to help", - description: "navigator notification title" - }) + description: "navigator notification title", + }), }); setNotifiedAboutNavigator(true); } @@ -141,8 +141,8 @@ const Navigator: React.FC = ({ visible, setVisibility }) => { change({ target: { name: "query", - value - } + value, + }, }) } defaultHighlightedIndex={0} @@ -153,7 +153,7 @@ const Navigator: React.FC = ({ visible, setVisibility }) => { mode={mode} value={query} {...getInputProps({ - value: query + value: query, })} ref={input} /> @@ -163,7 +163,7 @@ const Navigator: React.FC = ({ visible, setVisibility }) => { label={intl.formatMessage({ id: "YYkkhx", defaultMessage: "Navigate to", - description: "navigator section header" + description: "navigator section header", })} getItemProps={getItemProps} highlightedIndex={highlightedIndex} @@ -176,7 +176,7 @@ const Navigator: React.FC = ({ visible, setVisibility }) => { label={intl.formatMessage({ id: "me585h", defaultMessage: "Quick Actions", - description: "navigator section header" + description: "navigator section header", })} getItemProps={getItemProps} highlightedIndex={highlightedIndex} @@ -189,7 +189,7 @@ const Navigator: React.FC = ({ visible, setVisibility }) => { label={intl.formatMessage({ id: "4gT3eD", defaultMessage: "Search in Customers", - description: "navigator section header" + description: "navigator section header", })} getItemProps={getItemProps} highlightedIndex={highlightedIndex} @@ -202,7 +202,7 @@ const Navigator: React.FC = ({ visible, setVisibility }) => { label={intl.formatMessage({ id: "7Oorx5", defaultMessage: "Search in Catalog", - description: "navigator section header" + description: "navigator section header", })} getItemProps={getItemProps} highlightedIndex={highlightedIndex} diff --git a/src/components/Navigator/NavigatorInput.tsx b/src/components/Navigator/NavigatorInput.tsx index d9383c7a3..f0d2ce15a 100644 --- a/src/components/Navigator/NavigatorInput.tsx +++ b/src/components/Navigator/NavigatorInput.tsx @@ -10,7 +10,7 @@ const useStyles = makeStyles( ...theme.typography.body1, color: theme.palette.saleor.main[1], fontWeight: 500, - letterSpacing: "0.02rem" + letterSpacing: "0.02rem", }; return { @@ -20,36 +20,36 @@ const useStyles = makeStyles( color: theme.palette.text.secondary, marginRight: theme.spacing(1), textAlign: "center", - width: 32 + width: 32, }, input: { "&::placeholder": { - color: theme.palette.saleor.main[3] + color: theme.palette.saleor.main[3], }, ...typography, background: "transparent", border: "none", outline: 0, padding: 0, - width: "100%" + width: "100%", }, root: { background: theme.palette.background.paper, display: "flex", padding: theme.spacing(2, 3), - height: 72 + height: 72, }, searchIcon: { alignSelf: "center", width: 32, height: 32, - marginRight: theme.spacing(1) - } + marginRight: theme.spacing(1), + }, }; }, { - name: "NavigatorInput" - } + name: "NavigatorInput", + }, ); interface NavigatorInputProps @@ -89,36 +89,36 @@ const NavigatorInput = React.forwardRef( ? intl.formatMessage({ id: "8B8E+3", defaultMessage: "Order Number", - description: "navigator placeholder" + description: "navigator placeholder", }) : mode === "commands" ? intl.formatMessage({ id: "NqxvFh", defaultMessage: "Type Command", - description: "navigator placeholder" + description: "navigator placeholder", }) : mode === "catalog" ? intl.formatMessage({ id: "AOI4LW", defaultMessage: "Search in Catalog", - description: "navigator placeholder" + description: "navigator placeholder", }) : mode === "customers" ? intl.formatMessage({ id: "TpPx7V", defaultMessage: "Search Customer", - description: "navigator placeholder" + description: "navigator placeholder", }) : mode === "default" ? intl.formatMessage( { id: "BooQvo", defaultMessage: "Type {key} to see available actions", - description: "navigator placeholder" + description: "navigator placeholder", }, { - key: "'?'" - } + key: "'?'", + }, ) : null } @@ -127,7 +127,7 @@ const NavigatorInput = React.forwardRef( />
); - } + }, ); NavigatorInput.displayName = "NavigatorInput"; diff --git a/src/components/Navigator/NavigatorSection.tsx b/src/components/Navigator/NavigatorSection.tsx index c4b6eeafa..678fdb3ba 100644 --- a/src/components/Navigator/NavigatorSection.tsx +++ b/src/components/Navigator/NavigatorSection.tsx @@ -18,36 +18,36 @@ const useStyles = makeStyles( item: { "&&&&": { color: theme.palette.text.secondary, - fontWeight: 400 + fontWeight: 400, }, display: "flex", - margin: theme.spacing(1, 0) + margin: theme.spacing(1, 0), }, itemLabel: { - display: "inline-block" + display: "inline-block", }, label: { paddingLeft: theme.spacing(2), - textTransform: "uppercase" + textTransform: "uppercase", }, root: { "&:last-child": { - marginBottom: 0 + marginBottom: 0, }, - margin: theme.spacing(2, 0) + margin: theme.spacing(2, 0), }, spacer: { - flex: 1 + flex: 1, }, symbol: { display: "inline-block", fontWeight: 600, - width: theme.spacing(4) - } + width: theme.spacing(4), + }, }), { - name: "NavigatorSection" - } + name: "NavigatorSection", + }, ); const NavigatorSection: React.FC = props => { @@ -68,7 +68,7 @@ const NavigatorSection: React.FC = props => { const index = offset + itemIndex; const itemProps = getItemProps({ index, - item + item, }); return ( diff --git a/src/components/Navigator/modes/catalog.ts b/src/components/Navigator/modes/catalog.ts index 3730c54ce..e8fd89a6e 100644 --- a/src/components/Navigator/modes/catalog.ts +++ b/src/components/Navigator/modes/catalog.ts @@ -17,7 +17,7 @@ export function searchInCatalog( search: string, intl: IntlShape, navigate: UseNavigatorResult, - catalog: SearchCatalogQuery + catalog: SearchCatalogQuery, ): QuickSearchAction[] { const categories: QuickSearchActionInput[] = ( mapEdgesToItems(catalog?.categories) || [] @@ -31,7 +31,7 @@ export function searchInCatalog( }, score: score(category.name, search), text: category.name, - type: "catalog" + type: "catalog", })) .sort(sortScores); @@ -47,7 +47,7 @@ export function searchInCatalog( }, score: score(collection.name, search), text: collection.name, - type: "catalog" + type: "catalog", })) .sort(sortScores); @@ -64,21 +64,21 @@ export function searchInCatalog( }, score: score(product.name, search), text: product.name, - type: "catalog" + type: "catalog", })) .sort(sortScores); const baseActions = [ ...categories.slice(0, 1), ...collections.slice(0, 1), - ...products.slice(0, 1) + ...products.slice(0, 1), ]; return [ ...baseActions, ...[...categories.slice(1), ...collections.slice(1), ...products.slice(1)] .sort(sortScores) - .slice(0, maxActions - baseActions.length) + .slice(0, maxActions - baseActions.length), ].sort(sortScores); } @@ -86,7 +86,7 @@ function getCatalogModeActions( query: string, intl: IntlShape, navigate: UseNavigatorResult, - catalog: SearchCatalogQuery + catalog: SearchCatalogQuery, ): QuickSearchAction[] { return searchInCatalog(query, intl, navigate, catalog); } diff --git a/src/components/Navigator/modes/commands/actions.ts b/src/components/Navigator/modes/commands/actions.ts index 4df4df8a2..353f736d5 100644 --- a/src/components/Navigator/modes/commands/actions.ts +++ b/src/components/Navigator/modes/commands/actions.ts @@ -26,7 +26,7 @@ export function searchInCommands( intl: IntlShape, navigate: UseNavigatorResult, createOrder: MutationFunction, - setMode: (mode: QuickSearchMode) => void + setMode: (mode: QuickSearchMode) => void, ): QuickSearchActionInput[] { const actions: Command[] = [ { @@ -34,57 +34,57 @@ export function searchInCommands( onClick: () => { navigate(categoryAddUrl()); return false; - } + }, }, { label: intl.formatMessage(messages.createCollection), onClick: () => { navigate(collectionAddUrl()); return false; - } + }, }, { label: intl.formatMessage(messages.createProduct), onClick: () => { navigate(productAddUrl()); return false; - } + }, }, { label: intl.formatMessage(messages.createPermissionGroup), onClick: () => { navigate(permissionGroupAddUrl); return false; - } + }, }, { label: intl.formatMessage(messages.createCustomer), onClick: () => { navigate(customerAddUrl); return false; - } + }, }, { label: intl.formatMessage(messages.createVoucher), onClick: () => { navigate(voucherAddUrl()); return false; - } + }, }, { label: intl.formatMessage(messages.createOrder), onClick: () => { createOrder(); return false; - } + }, }, { label: intl.formatMessage(messages.helpMode), onClick: () => { setMode("help"); return true; - } - } + }, + }, ]; return actions.map(action => ({ @@ -92,7 +92,7 @@ export function searchInCommands( onClick: action.onClick, score: score(action.label, search), text: action.label, - type: "action" + type: "action", })); } @@ -101,7 +101,7 @@ function getCommandModeActions( intl: IntlShape, navigate: UseNavigatorResult, createOrder: MutationFunction, - setMode: (mode: QuickSearchMode) => void + setMode: (mode: QuickSearchMode) => void, ): QuickSearchActionInput[] { return [...searchInCommands(query, intl, navigate, createOrder, setMode)] .filter(action => action.score >= threshold) diff --git a/src/components/Navigator/modes/customers.ts b/src/components/Navigator/modes/customers.ts index b9ad722cc..c192a87dc 100644 --- a/src/components/Navigator/modes/customers.ts +++ b/src/components/Navigator/modes/customers.ts @@ -10,7 +10,7 @@ import messages from "./messages"; export function searchInCustomers( intl: IntlShape, navigate: UseNavigatorResult, - customers: RelayToFlat + customers: RelayToFlat, ): QuickSearchAction[] { return customers.map(customer => ({ caption: customer.email, @@ -18,7 +18,7 @@ export function searchInCustomers( customer.firstName && customer.lastName ? intl.formatMessage(messages.customerWithName, { firstName: customer.firstName, - lastName: customer.lastName + lastName: customer.lastName, }) : customer.email, onClick: () => { @@ -26,14 +26,14 @@ export function searchInCustomers( return false; }, score: 1, - type: "customer" + type: "customer", })); } function getCustomersModeActions( intl: IntlShape, navigate: UseNavigatorResult, - customers: RelayToFlat + customers: RelayToFlat, ): QuickSearchAction[] { return searchInCustomers(intl, navigate, customers); } diff --git a/src/components/Navigator/modes/default/default.ts b/src/components/Navigator/modes/default/default.ts index 416e7576f..aed32c3e9 100644 --- a/src/components/Navigator/modes/default/default.ts +++ b/src/components/Navigator/modes/default/default.ts @@ -16,11 +16,11 @@ function getDefaultModeActions( intl: IntlShape, navigate: UseNavigatorResult, createOrder: MutationFunction, - setMode: (mode: QuickSearchMode) => void + setMode: (mode: QuickSearchMode) => void, ): QuickSearchAction[] { return [ ...searchInViews(query, intl, navigate), - ...searchInCommands(query, intl, navigate, createOrder, setMode) + ...searchInCommands(query, intl, navigate, createOrder, setMode), ] .filter(action => action.score >= threshold) .sort(sortScores) diff --git a/src/components/Navigator/modes/default/views.ts b/src/components/Navigator/modes/default/views.ts index 3e323d846..85015024c 100644 --- a/src/components/Navigator/modes/default/views.ts +++ b/src/components/Navigator/modes/default/views.ts @@ -31,97 +31,97 @@ interface View { function searchInViews( search: string, intl: IntlShape, - navigate: UseNavigatorResult + navigate: UseNavigatorResult, ): QuickSearchActionInput[] { const views: View[] = [ { label: intl.formatMessage(sectionNames.apps), - url: appsListUrl() + url: appsListUrl(), }, { label: intl.formatMessage(sectionNames.attributes), - url: attributeListUrl() + url: attributeListUrl(), }, { label: intl.formatMessage(sectionNames.categories), - url: categoryListUrl() + url: categoryListUrl(), }, { label: intl.formatMessage(sectionNames.collections), - url: collectionListUrl() + url: collectionListUrl(), }, { label: intl.formatMessage(sectionNames.customers), - url: customerListUrl() + url: customerListUrl(), }, { label: intl.formatMessage(sectionNames.draftOrders), - url: orderDraftListUrl() + url: orderDraftListUrl(), }, { label: intl.formatMessage(sectionNames.home), - url: "/" + url: "/", }, { label: intl.formatMessage(sectionNames.navigation), - url: menuListUrl() + url: menuListUrl(), }, { label: intl.formatMessage(sectionNames.orders), - url: orderListUrl() + url: orderListUrl(), }, { label: intl.formatMessage(sectionNames.pages), - url: pageListUrl() + url: pageListUrl(), }, { label: intl.formatMessage(sectionNames.permissionGroups), - url: permissionGroupListUrl() + url: permissionGroupListUrl(), }, { label: intl.formatMessage(sectionNames.plugins), - url: pluginListUrl() + url: pluginListUrl(), }, { label: intl.formatMessage(sectionNames.productTypes), - url: productTypeListUrl() + url: productTypeListUrl(), }, { label: intl.formatMessage(sectionNames.products), - url: productListUrl() + url: productListUrl(), }, { label: intl.formatMessage(sectionNames.sales), - url: saleListUrl() + url: saleListUrl(), }, { label: intl.formatMessage(sectionNames.shipping), - url: shippingZonesListUrl() + url: shippingZonesListUrl(), }, { label: intl.formatMessage(sectionNames.siteSettings), - url: siteSettingsUrl() + url: siteSettingsUrl(), }, { label: intl.formatMessage(sectionNames.staff), - url: staffListUrl() + url: staffListUrl(), }, { label: intl.formatMessage(sectionNames.taxes), - url: countryListUrl + url: countryListUrl, }, { label: intl.formatMessage(sectionNames.translations), - url: languageListUrl + url: languageListUrl, }, { label: intl.formatMessage(sectionNames.vouchers), - url: voucherListUrl() + url: voucherListUrl(), }, { label: intl.formatMessage(sectionNames.warehouses), - url: warehouseListUrl() - } + url: warehouseListUrl(), + }, ]; return views.map(view => ({ @@ -132,7 +132,7 @@ function searchInViews( }, score: score(view.label, search), text: view.label, - type: "view" + type: "view", })); } diff --git a/src/components/Navigator/modes/help.ts b/src/components/Navigator/modes/help.ts index 92cd110c2..3153107ac 100644 --- a/src/components/Navigator/modes/help.ts +++ b/src/components/Navigator/modes/help.ts @@ -6,15 +6,15 @@ import messages from "./messages"; function getHelpModeActions( query: string, intl: IntlShape, - setMode: (mode: QuickSearchMode) => void + setMode: (mode: QuickSearchMode) => void, ): QuickSearchAction[] { if (query !== "") { return [ { label: intl.formatMessage(messages.noResults), onClick: () => true, - type: "action" - } + type: "action", + }, ]; } @@ -26,7 +26,7 @@ function getHelpModeActions( return true; }, symbol: "...", - type: "action" + type: "action", }, { label: intl.formatMessage(messages.helpCommandsMode), @@ -35,7 +35,7 @@ function getHelpModeActions( return true; }, symbol: ">", - type: "action" + type: "action", }, { label: intl.formatMessage(messages.helpOrdersMode), @@ -44,7 +44,7 @@ function getHelpModeActions( return true; }, symbol: "#", - type: "action" + type: "action", }, { label: intl.formatMessage(messages.helpCustomersMode), @@ -53,7 +53,7 @@ function getHelpModeActions( return true; }, symbol: "@", - type: "action" + type: "action", }, { label: intl.formatMessage(messages.helpCatalogMode), @@ -62,7 +62,7 @@ function getHelpModeActions( return true; }, symbol: "$", - type: "action" + type: "action", }, { label: intl.formatMessage(messages.helpMode), @@ -71,8 +71,8 @@ function getHelpModeActions( return true; }, symbol: "?", - type: "action" - } + type: "action", + }, ]; } diff --git a/src/components/Navigator/modes/index.ts b/src/components/Navigator/modes/index.ts index 815a5742b..89ab8b249 100644 --- a/src/components/Navigator/modes/index.ts +++ b/src/components/Navigator/modes/index.ts @@ -21,7 +21,7 @@ function getModeActions( createOrder: MutationFunction; navigate: UseNavigatorResult; setMode: (mode: QuickSearchMode) => void; - } + }, ): QuickSearchAction[] { switch (mode) { case "catalog": @@ -32,7 +32,7 @@ function getModeActions( intl, cbs.navigate, cbs.createOrder, - cbs.setMode + cbs.setMode, ); case "customers": return getCustomersModeActions(intl, cbs.navigate, queries.customers); @@ -46,7 +46,7 @@ function getModeActions( intl, cbs.navigate, cbs.createOrder, - cbs.setMode + cbs.setMode, ); } } diff --git a/src/components/Navigator/modes/messages.ts b/src/components/Navigator/modes/messages.ts index d06426d4d..b352d60fc 100644 --- a/src/components/Navigator/modes/messages.ts +++ b/src/components/Navigator/modes/messages.ts @@ -3,104 +3,104 @@ import { defineMessages } from "react-intl"; const messages = defineMessages({ category: { id: "ccXLVi", - defaultMessage: "Category" + defaultMessage: "Category", }, collection: { id: "phAZoj", - defaultMessage: "Collection" + defaultMessage: "Collection", }, collectionPublished: { id: "lL3YJO", defaultMessage: "Published", - description: "collection" + description: "collection", }, collectionUnpublished: { id: "M1uijW", defaultMessage: "Not Published", - description: "collection" + description: "collection", }, createCategory: { id: "CjSRT1", defaultMessage: "Create Category", - description: "button" + description: "button", }, createCollection: { id: "VdDcxc", defaultMessage: "Create Collection", - description: "button" + description: "button", }, createCustomer: { id: "QooeI/", defaultMessage: "Create Customer", - description: "button" + description: "button", }, createOrder: { id: "cfQf0w", defaultMessage: "Create Order", - description: "button" + description: "button", }, createPermissionGroup: { id: "V1mqpZ", defaultMessage: "Create Permission Group", - description: "button" + description: "button", }, createProduct: { id: "JFmOfi", defaultMessage: "Create Product", - description: "button" + description: "button", }, createVoucher: { id: "y9cvqE", defaultMessage: "Create Voucher", - description: "button" + description: "button", }, customerWithName: { id: "1gzck6", - defaultMessage: "{firstName} {lastName}" + defaultMessage: "{firstName} {lastName}", }, goToOrder: { id: "IyHQr0", defaultMessage: "Go to order #{orderNumber}", - description: "navigator action" + description: "navigator action", }, helpCatalogMode: { id: "kbkjEc", defaultMessage: "Search in Catalog", - description: "navigator catalog mode description" + description: "navigator catalog mode description", }, helpCommandsMode: { id: "3TlhJS", defaultMessage: "Search Command", - description: "navigator command mode description" + description: "navigator command mode description", }, helpCustomersMode: { id: "DHBlFi", defaultMessage: "Search Customers", - description: "navigator customer mode description" + description: "navigator customer mode description", }, helpDefaultMode: { id: "Xel9C+", defaultMessage: "Search Views and Actions", - description: "navigator default mode description" + description: "navigator default mode description", }, helpMode: { id: "iAvKNf", defaultMessage: "Display Help", - description: "navigator help mode description" + description: "navigator help mode description", }, helpOrdersMode: { id: "usSkzP", defaultMessage: "Search Orders", - description: "navigator order mode description" + description: "navigator order mode description", }, noResults: { id: "k8bltk", - defaultMessage: "No Results" + defaultMessage: "No Results", }, product: { id: "x/ZVlU", - defaultMessage: "Product" - } + defaultMessage: "Product", + }, }); export default messages; diff --git a/src/components/Navigator/modes/orders.ts b/src/components/Navigator/modes/orders.ts index c26842279..75c479eb4 100644 --- a/src/components/Navigator/modes/orders.ts +++ b/src/components/Navigator/modes/orders.ts @@ -19,7 +19,7 @@ function getOrdersModeActions( query: string, intl: IntlShape, navigate: UseNavigatorResult, - order: CheckIfOrderExistsQuery["order"] + order: CheckIfOrderExistsQuery["order"], ): QuickSearchAction[] { const gqlId = getGqlOrderId(query); @@ -28,14 +28,14 @@ function getOrdersModeActions( { extraInfo: transformOrderStatus(order.status, intl).localized, label: intl.formatMessage(messages.goToOrder, { - orderNumber: query + orderNumber: query, }), onClick: () => { navigate(orderUrl(gqlId)); return false; }, - type: "action" - } + type: "action", + }, ]; } diff --git a/src/components/Navigator/modes/types.ts b/src/components/Navigator/modes/types.ts index b1b19d53a..e67bc36c8 100644 --- a/src/components/Navigator/modes/types.ts +++ b/src/components/Navigator/modes/types.ts @@ -1,7 +1,7 @@ import { CheckIfOrderExistsQuery, SearchCatalogQuery, - SearchCustomersQuery + SearchCustomersQuery, } from "@saleor/graphql"; import { RelayToFlat } from "@saleor/types"; diff --git a/src/components/Navigator/modes/utils.ts b/src/components/Navigator/modes/utils.ts index 2c0f599e1..b3119ef31 100644 --- a/src/components/Navigator/modes/utils.ts +++ b/src/components/Navigator/modes/utils.ts @@ -1,7 +1,7 @@ import { QuickSearchAction, QuickSearchActionInput, - QuickSearchMode + QuickSearchMode, } from "../types"; export function getActions(actions: QuickSearchAction[]): QuickSearchAction[] { @@ -19,7 +19,7 @@ export function hasViews(actions: QuickSearchAction[]): boolean { } export function getCustomers( - actions: QuickSearchAction[] + actions: QuickSearchAction[], ): QuickSearchAction[] { return actions.filter(action => action.type === "customer"); } @@ -36,7 +36,7 @@ export function hasCatalog(actions: QuickSearchAction[]): boolean { export function sortScores( a: QuickSearchActionInput, - b: QuickSearchActionInput + b: QuickSearchActionInput, ) { return a.score <= b.score ? 1 : -1; } diff --git a/src/components/Navigator/queries/useCatalogSearch.ts b/src/components/Navigator/queries/useCatalogSearch.ts index e546ffb82..3418aaaab 100644 --- a/src/components/Navigator/queries/useCatalogSearch.ts +++ b/src/components/Navigator/queries/useCatalogSearch.ts @@ -1,6 +1,6 @@ import { SearchCatalogQueryHookResult, - useSearchCatalogQuery + useSearchCatalogQuery, } from "@saleor/graphql"; import useDebounce from "@saleor/hooks/useDebounce"; import { useState } from "react"; @@ -13,8 +13,8 @@ function useSearchCatalog(first: number): UseSearchCatalog { skip: query === "", variables: { first, - query - } + query, + }, }); return [result, setQueryDebounced]; diff --git a/src/components/Navigator/queries/useCheckIfOrderExists.ts b/src/components/Navigator/queries/useCheckIfOrderExists.ts index 4d19355d2..39af2b805 100644 --- a/src/components/Navigator/queries/useCheckIfOrderExists.ts +++ b/src/components/Navigator/queries/useCheckIfOrderExists.ts @@ -1,21 +1,21 @@ import { CheckIfOrderExistsQueryHookResult, - useCheckIfOrderExistsQuery + useCheckIfOrderExistsQuery, } from "@saleor/graphql"; import useDebounce from "@saleor/hooks/useDebounce"; import { useState } from "react"; function useCheckIfOrderExists(): [ CheckIfOrderExistsQueryHookResult, - (query: string) => void + (query: string) => void, ] { const [id, setId] = useState(""); const setIdDebounced = useDebounce(setId); const result = useCheckIfOrderExistsQuery({ skip: id === "", variables: { - id - } + id, + }, }); return [result, setIdDebounced]; diff --git a/src/components/Navigator/useQuickSearch.ts b/src/components/Navigator/useQuickSearch.ts index dc087dc7f..31212d1b3 100644 --- a/src/components/Navigator/useQuickSearch.ts +++ b/src/components/Navigator/useQuickSearch.ts @@ -21,11 +21,11 @@ type UseQuickSearch = [ string, QuickSearchMode, FormChange, - QuickSearchAction[] + QuickSearchAction[], ]; function useQuickSearch( open: boolean, - input: RefObject + input: RefObject, ): UseQuickSearch { const [query, setQuery] = useState(""); const [mode, setMode] = useState("default"); @@ -35,9 +35,9 @@ function useQuickSearch( const { result: customers, search: searchCustomers } = useCustomerSearch({ variables: { ...DEFAULT_INITIAL_SEARCH_DATA, - first: 5 + first: 5, }, - skip: !query + skip: !query, }); const [{ data: catalog }, searchCatalog] = useSearchCatalog(5); const [createOrder] = useOrderDraftCreateMutation({ @@ -45,14 +45,14 @@ function useQuickSearch( if (result.draftOrderCreate.errors.length === 0) { navigate(orderUrl(result.draftOrderCreate.order.id)); } - } + }, }); useModalDialogOpen(open, { onClose: () => { setMode("default"); setQuery(""); - } + }, }); const handleBack = (event: KeyboardEvent) => { @@ -110,14 +110,14 @@ function useQuickSearch( { catalog, customers: mapEdgesToItems(customers?.data?.search) || [], - order: maybe(() => orderData.order) + order: maybe(() => orderData.order), }, { createOrder, navigate, - setMode - } - ) + setMode, + }, + ), ]; } diff --git a/src/components/NavigatorButton/NavigatorButton.tsx b/src/components/NavigatorButton/NavigatorButton.tsx index 9f385dc39..2e2426571 100644 --- a/src/components/NavigatorButton/NavigatorButton.tsx +++ b/src/components/NavigatorButton/NavigatorButton.tsx @@ -10,7 +10,7 @@ const useStyles = makeStyles( theme => ({ keyTile: { "&:first-child": { - marginLeft: theme.spacing() + marginLeft: theme.spacing(), }, alignItems: "center", background: theme.palette.background.default, @@ -20,10 +20,10 @@ const useStyles = makeStyles( justifyContent: "center", marginLeft: theme.spacing(0.5), padding: theme.spacing(), - width: 32 + width: 32, }, keyTileLabel: { - verticalAlign: "middle" + verticalAlign: "middle", }, paper: { "&:after": { @@ -31,33 +31,33 @@ const useStyles = makeStyles( content: "''", left: 18, position: "absolute", - top: -7 + top: -7, }, "&:before": { ...triangle(theme.palette.divider, 8), content: "''", left: `calc(1px + ${theme.spacing(2)})`, position: "absolute", - top: theme.spacing(-1) + top: theme.spacing(-1), }, border: `1px solid ${theme.palette.divider}`, borderRadius: 6, marginTop: theme.spacing(2), padding: theme.spacing(2), - position: "relative" + position: "relative", }, root: { "&:hover path": { - color: theme.palette.primary.main + color: theme.palette.primary.main, }, marginRight: theme.spacing(2), - width: 40 - } + width: 40, + }, }), { - name: "NavigatorButton" - } + name: "NavigatorButton", + }, ); export interface NavigatorButtonProps extends IconButtonProps { @@ -109,7 +109,7 @@ const NavigatorButton: React.FC = ({ {...TransitionProps} style={{ transformOrigin: - placement === "bottom" ? "right top" : "right bottom" + placement === "bottom" ? "right top" : "right bottom", }} > diff --git a/src/components/NotFoundPage/NotFoundPage.tsx b/src/components/NotFoundPage/NotFoundPage.tsx index 91bb7d125..3b00016cc 100644 --- a/src/components/NotFoundPage/NotFoundPage.tsx +++ b/src/components/NotFoundPage/NotFoundPage.tsx @@ -10,43 +10,43 @@ const useStyles = makeStyles( theme => ({ button: { marginTop: theme.spacing(2), - padding: 20 + padding: 20, }, container: { [theme.breakpoints.down("sm")]: { gridTemplateColumns: "1fr", padding: theme.spacing(3), - width: "100%" + width: "100%", }, display: "grid", gridTemplateColumns: "1fr 487px", margin: "0 auto", - width: 830 + width: 830, }, header: { - fontWeight: 600 as 600 + fontWeight: 600 as 600, }, innerContainer: { [theme.breakpoints.down("sm")]: { order: 1, - textAlign: "center" + textAlign: "center", }, display: "flex", flexDirection: "column", - justifyContent: "center" + justifyContent: "center", }, notFoundImage: { "& svg": { - width: "100%" - } + width: "100%", + }, }, root: { alignItems: "center", display: "flex", - height: "calc(100vh - 180px)" - } + height: "calc(100vh - 180px)", + }, }), - { name: "NotFoundPage" } + { name: "NotFoundPage" }, ); type NotFoundPageProps = diff --git a/src/components/PageHeader/PageHeader.tsx b/src/components/PageHeader/PageHeader.tsx index bbee3a1b3..9a48cc3c0 100644 --- a/src/components/PageHeader/PageHeader.tsx +++ b/src/components/PageHeader/PageHeader.tsx @@ -9,11 +9,11 @@ import Skeleton from "../Skeleton"; const useStyles = makeStyles( theme => ({ limit: { - marginRight: theme.spacing(4) + marginRight: theme.spacing(4), }, preview: { position: "absolute", - top: theme.spacing(-4) + top: theme.spacing(-4), }, root: { alignItems: "center", @@ -22,26 +22,26 @@ const useStyles = makeStyles( flexDirection: "column", alignItems: "flex-start", "& > *": { - width: "100%" + width: "100%", }, "& > *:not(first-child)": { - marginTop: theme.spacing(2) - } - } + marginTop: theme.spacing(2), + }, + }, }, title: { [theme.breakpoints.down("sm")]: { fontSize: 20, - padding: 0 + padding: 0, }, fontWeight: 700, flex: 1, whiteSpace: "nowrap", overflow: "hidden", - textOverflow: "ellipsis" - } + textOverflow: "ellipsis", + }, }), - { name: "PageHeader" } + { name: "PageHeader" }, ); interface PageHeaderProps { @@ -64,7 +64,7 @@ const PageHeader: React.FC = props => { limitText, title, cardMenu, - preview + preview, } = props; const classes = useStyles(props); diff --git a/src/components/Percent/Percent.tsx b/src/components/Percent/Percent.tsx index d0876ed24..b1ff6e982 100644 --- a/src/components/Percent/Percent.tsx +++ b/src/components/Percent/Percent.tsx @@ -12,7 +12,7 @@ const Percent: React.FC = ({ amount }) => ( amount ? (amount / 100).toLocaleString(locale, { maximumFractionDigits: 2, - style: "percent" + style: "percent", }) : "-" } diff --git a/src/components/PhoneField/PhoneField.tsx b/src/components/PhoneField/PhoneField.tsx index a67b21ec6..5f9bf38c8 100644 --- a/src/components/PhoneField/PhoneField.tsx +++ b/src/components/PhoneField/PhoneField.tsx @@ -8,10 +8,10 @@ const useStyles = makeStyles( root: { display: "grid", gridColumnGap: theme.spacing(2), - gridTemplateColumns: "5rem 1fr" - } + gridTemplateColumns: "5rem 1fr", + }, }), - { name: "PhoneField" } + { name: "PhoneField" }, ); interface PhoneFieldProps { @@ -30,7 +30,7 @@ const PhoneField: React.FC = props => { prefix, prefixes, label, - onChange + onChange, } = props; const classes = useStyles(props); diff --git a/src/components/PreviewPill/messages.ts b/src/components/PreviewPill/messages.ts index 42b800bed..9d85f78de 100644 --- a/src/components/PreviewPill/messages.ts +++ b/src/components/PreviewPill/messages.ts @@ -4,14 +4,14 @@ const messages = defineMessages({ label: { id: "p3eRUm", defaultMessage: "Preview", - description: "indicator that feature is in preview mode" + description: "indicator that feature is in preview mode", }, tooltip: { id: "KGsaGO", defaultMessage: "This feature is in a preview state and can be subject to changes at later point", - description: "tooltip" - } + description: "tooltip", + }, }); export default messages; diff --git a/src/components/PreviewPill/styles.ts b/src/components/PreviewPill/styles.ts index b706a873d..a07ba4279 100644 --- a/src/components/PreviewPill/styles.ts +++ b/src/components/PreviewPill/styles.ts @@ -3,7 +3,7 @@ import { makeStyles } from "@saleor/macaw-ui"; const useStyles = makeStyles( theme => ({ popper: { - zIndex: 11 + zIndex: 11, }, tooltip: { // TO-FIX @@ -20,13 +20,13 @@ const useStyles = makeStyles( marginTop: theme.spacing(1.5), padding: theme.spacing(2.5), maxWidth: 400, - position: "relative" + position: "relative", }, tooltipText: { - color: theme.palette.common.black - } + color: theme.palette.common.black, + }, }), - { name: "PreviewPill" } + { name: "PreviewPill" }, ); export default useStyles; diff --git a/src/components/PriceField/PriceField.tsx b/src/components/PriceField/PriceField.tsx index f716b7a74..523cdbc02 100644 --- a/src/components/PriceField/PriceField.tsx +++ b/src/components/PriceField/PriceField.tsx @@ -11,25 +11,25 @@ import { findPriceSeparator, getCurrencyDecimalPoints } from "./utils"; const useStyles = makeStyles( theme => ({ currencySymbol: { - fontSize: "0.875rem" + fontSize: "0.875rem", }, inputContainer: { display: "grid", - gridTemplateColumns: "1fr 2rem 1fr" + gridTemplateColumns: "1fr 2rem 1fr", }, pullDown: { - marginTop: theme.spacing(2) + marginTop: theme.spacing(2), }, separator: { marginTop: theme.spacing(3), textAlign: "center", - width: "100%" + width: "100%", }, widgetContainer: { - marginTop: theme.spacing(2) - } + marginTop: theme.spacing(2), + }, }), - { name: "PriceField" } + { name: "PriceField" }, ); interface PriceFieldProps { @@ -60,7 +60,7 @@ export const PriceField: React.FC = props => { required, value, InputProps, - inputProps + inputProps, } = props; const classes = useStyles(props); @@ -68,7 +68,7 @@ export const PriceField: React.FC = props => { const maxDecimalLength = useMemo( () => getCurrencyDecimalPoints(currencySymbol), - [currencySymbol] + [currencySymbol], ); const handleChange: FormChange = e => { @@ -89,8 +89,8 @@ export const PriceField: React.FC = props => { onChange({ target: { name: e.target.name, - value - } + value, + }, }); }; @@ -139,14 +139,14 @@ export const PriceField: React.FC = props => { inputProps: { min: 0, step: 1 / Math.pow(10, maxDecimalLength), - ...InputProps?.inputProps + ...InputProps?.inputProps, }, - type: "number" + type: "number", }} inputProps={{ min: minValue, type: "number", - ...inputProps + ...inputProps, }} name={name} disabled={disabled} @@ -157,7 +157,7 @@ export const PriceField: React.FC = props => { ); }; PriceField.defaultProps = { - name: "price" + name: "price", }; PriceField.displayName = "PriceField"; diff --git a/src/components/PriceField/utils.ts b/src/components/PriceField/utils.ts index 228b25a0d..af093f125 100644 --- a/src/components/PriceField/utils.ts +++ b/src/components/PriceField/utils.ts @@ -4,21 +4,21 @@ const getNumberFormatting = (currency: string = "USD") => { try { return new Intl.NumberFormat("en-GB", { style: "currency", - currency + currency, }); } catch (e) { try { // fallback to "USD" if currency wasn't recognised return new Intl.NumberFormat("en-GB", { style: "currency", - currency: "USD" + currency: "USD", }); } catch { // everything is broken - try to return something that makes sense return { resolvedOptions: () => ({ - maximumFractionDigits: 2 - }) + maximumFractionDigits: 2, + }), }; } } diff --git a/src/components/RadioGroupField/RadioGroupField.tsx b/src/components/RadioGroupField/RadioGroupField.tsx index 598d35043..ed3444266 100644 --- a/src/components/RadioGroupField/RadioGroupField.tsx +++ b/src/components/RadioGroupField/RadioGroupField.tsx @@ -4,7 +4,7 @@ import { FormHelperText, MenuItem, Radio, - RadioGroup + RadioGroup, } from "@material-ui/core"; import classNames from "classnames"; import React from "react"; @@ -48,14 +48,14 @@ export const RadioGroupField: React.FC = props => { name, hint, variant = "block", - innerContainerClassName + innerContainerClassName, } = props; const classes = useStyles(props); return ( = props => { onChange={onChange} className={classNames({ [classes.radioGroupInline]: variant === "inline", - [innerContainerClassName]: !!innerContainerClassName + [innerContainerClassName]: !!innerContainerClassName, })} > {choices.length > 0 ? ( @@ -78,15 +78,15 @@ export const RadioGroupField: React.FC = props => { value={choice.value} className={classNames({ [classes.radioLabel]: variant !== "inline", - [classes.radioLabelInline]: variant === "inline" + [classes.radioLabelInline]: variant === "inline", })} classes={{ - label: classes.label + label: classes.label, }} control={ diff --git a/src/components/RadioGroupField/styles.ts b/src/components/RadioGroupField/styles.ts index 220cb996b..079c5369b 100644 --- a/src/components/RadioGroupField/styles.ts +++ b/src/components/RadioGroupField/styles.ts @@ -5,40 +5,40 @@ export const useStyles = makeStyles( alignTop: { alignSelf: "baseline", position: "relative", - top: -6 + top: -6, }, formLabel: { ...theme.typography.body1, - marginBottom: theme.spacing(1) + marginBottom: theme.spacing(1), }, radioGroupInline: { - flexDirection: "row" + flexDirection: "row", }, radioLabel: { alignItems: "start", - marginBottom: theme.spacing(-0.5) + marginBottom: theme.spacing(-0.5), }, radioLabelInline: { alignItems: "start", - marginRight: theme.spacing(4) + marginRight: theme.spacing(4), }, label: { - marginTop: theme.spacing(1.5) + marginTop: theme.spacing(1.5), }, root: { "& $radioLabel": { "&:last-of-type": { - marginBottom: 0 - } + marginBottom: 0, + }, }, padding: 0, - width: "100%" + width: "100%", }, rootNoLabel: { - marginTop: theme.spacing(-1.5) - } + marginTop: theme.spacing(-1.5), + }, }), { - name: "RadioGroupField" - } + name: "RadioGroupField", + }, ); diff --git a/src/components/RadioSwitchField/RadioSwitchField.tsx b/src/components/RadioSwitchField/RadioSwitchField.tsx index f4942e97c..c0602a86f 100644 --- a/src/components/RadioSwitchField/RadioSwitchField.tsx +++ b/src/components/RadioSwitchField/RadioSwitchField.tsx @@ -2,7 +2,7 @@ import { FormControl, FormControlLabel, Radio, - RadioGroup + RadioGroup, } from "@material-ui/core"; import { makeStyles } from "@saleor/macaw-ui"; import classNames from "classnames"; @@ -12,24 +12,24 @@ const useStyles = makeStyles( theme => ({ formControl: { padding: 0, - width: "100%" + width: "100%", }, formLabel: { marginLeft: "-5px", - paddingBottom: "10px" + paddingBottom: "10px", }, radioLabel: { "& > span": { paddingTop: theme.spacing(), - paddingBottom: theme.spacing() - } + paddingBottom: theme.spacing(), + }, }, secondLabel: { display: "block", - fontSize: "12px" - } + fontSize: "12px", + }, }), - { name: "RadioSwitchField" } + { name: "RadioSwitchField" }, ); interface RadioSwitchFieldProps { @@ -54,7 +54,7 @@ export const RadioSwitchField: React.FC = props => { onChange, name, secondOptionLabel, - value + value, } = props; const classes = useStyles(props); @@ -64,8 +64,8 @@ export const RadioSwitchField: React.FC = props => { onChange({ target: { name: event.target.name, - value: event.target.value === "true" ? true : false - } + value: event.target.value === "true" ? true : false, + }, } as any); }; @@ -85,7 +85,7 @@ export const RadioSwitchField: React.FC = props => { value="true" className={classNames( classes.radioLabel, - overrideClasses?.radioLabel + overrideClasses?.radioLabel, )} control={} label={firstOptionLabel} @@ -95,7 +95,7 @@ export const RadioSwitchField: React.FC = props => { value="false" className={classNames( classes.radioLabel, - overrideClasses?.radioLabel + overrideClasses?.radioLabel, )} control={} label={secondOptionLabel} diff --git a/src/components/RequirePermissions.tsx b/src/components/RequirePermissions.tsx index f3b65245d..03b0e5111 100644 --- a/src/components/RequirePermissions.tsx +++ b/src/components/RequirePermissions.tsx @@ -4,12 +4,12 @@ import React from "react"; export function hasPermissions( userPermissions: UserPermissionFragment[], - requiredPermissions: PermissionEnum[] + requiredPermissions: PermissionEnum[], ): boolean { return requiredPermissions.reduce( (acc, perm) => acc && !!userPermissions.find(userPerm => userPerm.code === perm), - true + true, ); } @@ -20,7 +20,7 @@ export interface RequirePermissionsProps { const RequirePermissions: React.FC = ({ children, - requiredPermissions + requiredPermissions, }) => { const userPermissions = useUserPermissions(); diff --git a/src/components/ResponsiveTable/ResponsiveTable.tsx b/src/components/ResponsiveTable/ResponsiveTable.tsx index 2f870a1d8..e3b58fc39 100644 --- a/src/components/ResponsiveTable/ResponsiveTable.tsx +++ b/src/components/ResponsiveTable/ResponsiveTable.tsx @@ -7,19 +7,19 @@ const useStyles = makeStyles( root: { [theme.breakpoints.up("md")]: { "&& table": { - tableLayout: "fixed" - } + tableLayout: "fixed", + }, }, "& table": { - tableLayout: "auto" + tableLayout: "auto", }, overflowX: "auto", - width: "100%" - } + width: "100%", + }, }), { - name: "ResponsiveTable" - } + name: "ResponsiveTable", + }, ); interface ResponsiveTableProps { diff --git a/src/components/RichTextEditor/RichTextEditor.stories.tsx b/src/components/RichTextEditor/RichTextEditor.stories.tsx index db2629c9f..de73cf477 100644 --- a/src/components/RichTextEditor/RichTextEditor.stories.tsx +++ b/src/components/RichTextEditor/RichTextEditor.stories.tsx @@ -18,7 +18,7 @@ const props: RichTextEditorProps = { helperText: "Lorem ipsum dolor sit amet, consectetur adipiscing elit", label: "Content", name: "content", - editorRef: null + editorRef: null, }; storiesOf("Generics / Rich text editor", module) diff --git a/src/components/RichTextEditor/RichTextEditor.tsx b/src/components/RichTextEditor/RichTextEditor.tsx index e1e2a7409..c4b286282 100644 --- a/src/components/RichTextEditor/RichTextEditor.tsx +++ b/src/components/RichTextEditor/RichTextEditor.tsx @@ -95,7 +95,7 @@ const RichTextEditor: React.FC = ({ className={classNames(classes.editor, classes.root, { [classes.rootActive]: isFocused, [classes.rootDisabled]: disabled, - [classes.rootError]: error + [classes.rootError]: error, })} onFocus={() => setIsFocused(true)} onBlur={() => setIsFocused(false)} diff --git a/src/components/RichTextEditor/__mocks__/RichTextEditor.tsx b/src/components/RichTextEditor/__mocks__/RichTextEditor.tsx index 3f8f74954..a05f02e42 100644 --- a/src/components/RichTextEditor/__mocks__/RichTextEditor.tsx +++ b/src/components/RichTextEditor/__mocks__/RichTextEditor.tsx @@ -10,7 +10,7 @@ const RichTextEditor: React.FC = ({ error, label, name, - helperText + helperText, }) => ( = { class: Header, config: { defaultLevel: 1, - levels: [1, 2, 3] + levels: [1, 2, 3], }, - inlineToolbar + inlineToolbar, }, list: { class: List, - inlineToolbar + inlineToolbar, }, quote: { class: Quote, - inlineToolbar + inlineToolbar, }, paragraph: { class: Paragraph, - inlineToolbar + inlineToolbar, }, strikethrough: createGenericInlineTool({ sanitize: { - s: {} + s: {}, }, shortcut: "CMD+S", tagName: "s", - toolboxIcon: strikethroughIcon - }) + toolboxIcon: strikethroughIcon, + }), }; diff --git a/src/components/RichTextEditor/styles.ts b/src/components/RichTextEditor/styles.ts index 726e9e66a..562a1fb17 100644 --- a/src/components/RichTextEditor/styles.ts +++ b/src/components/RichTextEditor/styles.ts @@ -5,86 +5,86 @@ const useStyles = makeStyles( theme => { const hover = { "&:hover": { - background: fade(theme.palette.primary.main, 0.1) - } + background: fade(theme.palette.primary.main, 0.1), + }, }; return { editor: { "& .codex-editor": { - zIndex: 2 + zIndex: 2, }, "& .cdx-quote__text": { - minHeight: 24 + minHeight: 24, }, "& .ce-block--selected .ce-block__content": { - background: `${fade(theme.palette.primary.main, 0.2)} !important` + background: `${fade(theme.palette.primary.main, 0.2)} !important`, }, "& .ce-block__content": { margin: 0, - maxWidth: "unset" + maxWidth: "unset", }, "& .ce-conversion-tool": { - ...hover + ...hover, }, "& .ce-conversion-tool--focused": { - background: `${fade(theme.palette.primary.main, 0.1)} !important` + background: `${fade(theme.palette.primary.main, 0.1)} !important`, }, "& .ce-conversion-tool__icon": { - background: "none" + background: "none", }, "& .ce-conversion-toolbar": { - background: theme.palette.background.paper + background: theme.palette.background.paper, }, "& .ce-header": { marginBottom: 0, - paddingBottom: theme.spacing(1) + paddingBottom: theme.spacing(1), }, "& .ce-inline-tool": { ...hover, color: theme.palette.text.primary, height: 32, transition: theme.transitions.duration.short + "ms", - width: 32 + width: 32, }, "& .ce-inline-toolbar": { "& input": { - background: "none" + background: "none", }, background: theme.palette.background.paper, - color: theme.palette.text.primary + color: theme.palette.text.primary, }, "& .ce-inline-toolbar__dropdown": { ...hover, height: 32, - marginRight: 0 + marginRight: 0, }, "& .ce-inline-toolbar__toggler-and-button-wrapper": { - paddingRight: 0 + paddingRight: 0, }, "& .ce-toolbar__actions": { right: 0, - top: 0 + top: 0, }, "& .ce-toolbar__content": { - maxWidth: "unset" + maxWidth: "unset", }, "& .ce-toolbar__plus": { - left: -9 + left: -9, }, "& .ce-toolbox.ce-toolbox--opened": { - left: 16 + left: 16, }, "& .codex-editor__redactor": { marginRight: `${theme.spacing(4)}px !important`, - paddingBottom: "0 !important" + paddingBottom: "0 !important", }, "& a": { - color: theme.palette.primary.light + color: theme.palette.primary.light, }, "&:not($rootDisabled):hover": { - borderColor: theme.palette.primary.main - } + borderColor: theme.palette.primary.main, + }, }, root: { border: `1px solid ${fade(theme.palette.text.secondary, 0.4)}`, @@ -96,25 +96,25 @@ const useStyles = makeStyles( paddingBottom: theme.spacing(), paddingLeft: 10, position: "relative", - transition: theme.transitions.duration.short + "ms" + transition: theme.transitions.duration.short + "ms", }, rootActive: { - boxShadow: `inset 0px 0px 0 2px ${theme.palette.primary.main}` + boxShadow: `inset 0px 0px 0 2px ${theme.palette.primary.main}`, }, rootDisabled: { ...theme.overrides.MuiOutlinedInput.root["&$disabled"]["& fieldset"], background: theme.palette.background.default, - color: theme.palette.saleor.main[4] + color: theme.palette.saleor.main[4], }, rootError: { - borderColor: theme.palette.error.main + borderColor: theme.palette.error.main, }, rootStatic: { - fontSize: theme.typography.body1.fontSize - } + fontSize: theme.typography.body1.fontSize, + }, }; }, - { name: "RichTextEditor" } + { name: "RichTextEditor" }, ); export default useStyles; diff --git a/src/components/RowNumberSelect/RowNumberSelect.tsx b/src/components/RowNumberSelect/RowNumberSelect.tsx index 085e0dbdc..6861767a3 100644 --- a/src/components/RowNumberSelect/RowNumberSelect.tsx +++ b/src/components/RowNumberSelect/RowNumberSelect.tsx @@ -6,27 +6,27 @@ import { FormattedMessage } from "react-intl"; const useStyles = makeStyles( theme => ({ label: { - fontSize: 14 + fontSize: 14, }, select: { "& div": { "&:focus": { - background: "none" + background: "none", }, color: theme.palette.primary.main, - marginLeft: theme.spacing(1) + marginLeft: theme.spacing(1), }, "& svg": { - color: theme.palette.primary.main + color: theme.palette.primary.main, }, "&:after, &:before, &:hover": { - border: "none !important" - } - } + border: "none !important", + }, + }, }), { - name: "RowNumberSelect" - } + name: "RowNumberSelect", + }, ); interface RowNumberSelectProps { @@ -40,7 +40,7 @@ const RowNumberSelect: React.FC = ({ className, choices, rowNumber, - onChange + onChange, }) => { const classes = useStyles({}); diff --git a/src/components/SaveFilterTabDialog/SaveFilterTabDialog.tsx b/src/components/SaveFilterTabDialog/SaveFilterTabDialog.tsx index 39a50df8b..339763e30 100644 --- a/src/components/SaveFilterTabDialog/SaveFilterTabDialog.tsx +++ b/src/components/SaveFilterTabDialog/SaveFilterTabDialog.tsx @@ -3,7 +3,7 @@ import { DialogActions, DialogContent, DialogTitle, - TextField + TextField, } from "@material-ui/core"; import { buttonMessages } from "@saleor/intl"; import { ConfirmButtonTransitionState } from "@saleor/macaw-ui"; @@ -19,7 +19,7 @@ export interface SaveFilterTabDialogFormData { } const initialForm: SaveFilterTabDialogFormData = { - name: "" + name: "", }; export interface SaveFilterTabDialogProps { @@ -33,7 +33,7 @@ const SaveFilterTabDialog: React.FC = ({ confirmButtonState, onClose, onSubmit, - open + open, }) => { const intl = useIntl(); const [errors, setErrors] = React.useState(false); @@ -65,7 +65,7 @@ const SaveFilterTabDialog: React.FC = ({ label={intl.formatMessage({ id: "QcIFCs", defaultMessage: "Search Name", - description: "save search tab" + description: "save search tab", })} name={"name" as keyof SaveFilterTabDialogFormData} value={data.name} diff --git a/src/components/Savebar.tsx b/src/components/Savebar.tsx index 309a7774a..928591c9a 100644 --- a/src/components/Savebar.tsx +++ b/src/components/Savebar.tsx @@ -2,7 +2,7 @@ import { buttonMessages, commonMessages } from "@saleor/intl"; import { Savebar as MacawSavebar, SavebarLabels, - SavebarProps as MacawSavebarProps + SavebarProps as MacawSavebarProps, } from "@saleor/macaw-ui"; import React from "react"; import { useIntl } from "react-intl"; @@ -18,11 +18,11 @@ export const Savebar: React.FC = ({ labels = {}, ...rest }) => { cancel: intl.formatMessage(buttonMessages.back), confirm: intl.formatMessage(buttonMessages.save), delete: intl.formatMessage(buttonMessages.delete), - error: intl.formatMessage(commonMessages.error) + error: intl.formatMessage(commonMessages.error), }; const componentLabels: SavebarLabels = { ...defaultLabels, - ...labels + ...labels, }; return ; diff --git a/src/components/SearchBar/SearchBar.tsx b/src/components/SearchBar/SearchBar.tsx index d4692726f..ed9dbcf92 100644 --- a/src/components/SearchBar/SearchBar.tsx +++ b/src/components/SearchBar/SearchBar.tsx @@ -18,17 +18,17 @@ const useStyles = makeStyles( borderBottom: `1px solid ${theme.palette.divider}`, display: "flex", flexWrap: "wrap", - padding: theme.spacing(1, 4) + padding: theme.spacing(1, 4), }, tabActionButton: { marginLeft: theme.spacing(2), paddingLeft: theme.spacing(3), - paddingRight: theme.spacing(3) - } + paddingRight: theme.spacing(3), + }, }), { - name: "SearchBar" - } + name: "SearchBar", + }, ); const SearchBar: React.FC = props => { @@ -42,7 +42,7 @@ const SearchBar: React.FC = props => { onAll, onTabChange, onTabDelete, - onTabSave + onTabSave, } = props; const classes = useStyles(props); @@ -71,7 +71,7 @@ const SearchBar: React.FC = props => { onClick={() => undefined} label={intl.formatMessage({ id: "qIgdO6", - defaultMessage: "Custom Filter" + defaultMessage: "Custom Filter", })} /> )} diff --git a/src/components/SearchBar/SearchInput.tsx b/src/components/SearchBar/SearchInput.tsx index 8778aefd9..c581ec2c3 100644 --- a/src/components/SearchBar/SearchInput.tsx +++ b/src/components/SearchBar/SearchInput.tsx @@ -12,15 +12,15 @@ export interface SearchInputProps extends SearchPageProps { const useStyles = makeStyles( { input: { - padding: "10.5px 12px" + padding: "10.5px 12px", }, root: { - flex: 1 - } + flex: 1, + }, }, { - name: "SearchInput" - } + name: "SearchInput", + }, ); const SearchInput: React.FC = props => { @@ -45,7 +45,7 @@ const SearchInput: React.FC = props => { className={classes.root} inputProps={{ className: classes.input, - placeholder + placeholder, }} value={search} onChange={handleSearchChange} diff --git a/src/components/SeoForm/SeoForm.tsx b/src/components/SeoForm/SeoForm.tsx index 997dd0dc6..9cf86aede 100644 --- a/src/components/SeoForm/SeoForm.tsx +++ b/src/components/SeoForm/SeoForm.tsx @@ -3,7 +3,7 @@ import { Button } from "@saleor/components/Button"; import { CollectionErrorFragment, PageErrorFragment, - ProductErrorFragment + ProductErrorFragment, } from "@saleor/graphql"; import { makeStyles } from "@saleor/macaw-ui"; import { getFieldError, getProductErrorMessage } from "@saleor/utils/errors"; @@ -19,7 +19,7 @@ import FormSpacer from "../FormSpacer"; enum SeoField { slug = "slug", title = "seoTitle", - description = "seoDescription" + description = "seoDescription", } const SLUG_REGEX = /^[a-zA-Z0-9\-\_]+$/; @@ -36,34 +36,34 @@ const useStyles = makeStyles( marginBottom: "2px", overflow: "hidden", textOverflow: "ellipsis", - whiteSpace: "nowrap" + whiteSpace: "nowrap", }, container: { - width: "100%" + width: "100%", }, descriptionBar: { color: "#545454", fontSize: "13px", lineHeight: "18px", - overflowWrap: "break-word" + overflowWrap: "break-word", }, helperText: { - marginBottom: theme.spacing(3) + marginBottom: theme.spacing(3), }, label: { - flex: 1 + flex: 1, }, labelContainer: { "& span": { - paddingRight: 30 + paddingRight: 30, }, - display: "flex" + display: "flex", }, preview: { - minHeight: theme.spacing(10) + minHeight: theme.spacing(10), }, title: { - padding: 0 + padding: 0, }, titleBar: { color: "#1a0dab", @@ -71,10 +71,10 @@ const useStyles = makeStyles( lineHeight: "21px", overflowWrap: "break-word", textDecoration: "none", - wordWrap: "break-word" - } + wordWrap: "break-word", + }, }), - { name: "SeoForm" } + { name: "SeoForm" }, ); interface SeoFormProps { @@ -108,7 +108,7 @@ const SeoForm: React.FC = props => { slug, slugPlaceholder, titlePlaceholder, - onChange + onChange, } = props; const classes = useStyles(props); @@ -123,8 +123,8 @@ const SeoForm: React.FC = props => { const { seoFieldMessage } = defineMessages({ seoFieldMessage: { id: "s/sTT6", - defaultMessage: "If empty, the preview shows what will be autogenerated." - } + defaultMessage: "If empty, the preview shows what will be autogenerated.", + }, }); const getSlugHelperMessage = () => { @@ -161,7 +161,7 @@ const SeoForm: React.FC = props => { = props => { description="character limit" values={{ maxCharacters: maxSlugLength, - numberOfCharacters: slug?.length + numberOfCharacters: slug?.length, }} /> @@ -212,8 +212,8 @@ const SeoForm: React.FC = props => { } InputProps={{ inputProps: { - maxLength: maxSlugLength - } + maxLength: maxSlugLength, + }, }} helperText={getSlugHelperMessage()} value={slug} @@ -242,7 +242,7 @@ const SeoForm: React.FC = props => { description="character limit" values={{ maxCharacters: maxTitleLength, - numberOfCharacters: title.length + numberOfCharacters: title.length, }} /> @@ -251,8 +251,8 @@ const SeoForm: React.FC = props => { } InputProps={{ inputProps: { - maxLength: maxTitleLength - } + maxLength: maxTitleLength, + }, }} helperText={intl.formatMessage(seoFieldMessage)} value={title ?? ""} @@ -281,7 +281,7 @@ const SeoForm: React.FC = props => { description="character limit" values={{ maxCharacters: maxDescriptionLength, - numberOfCharacters: description.length + numberOfCharacters: description.length, }} /> @@ -291,8 +291,8 @@ const SeoForm: React.FC = props => { helperText={intl.formatMessage(seoFieldMessage)} InputProps={{ inputProps: { - maxLength: maxDescriptionLength - } + maxLength: maxDescriptionLength, + }, }} value={description ?? ""} onChange={onChange} diff --git a/src/components/Shop/index.tsx b/src/components/Shop/index.tsx index 188a57575..063439dba 100644 --- a/src/components/Shop/index.tsx +++ b/src/components/Shop/index.tsx @@ -14,7 +14,7 @@ export const ShopContext = React.createContext(undefined); export const ShopProvider: React.FC = ({ children }) => { const { authenticated } = useUser(); const { data } = useShopInfoQuery({ - skip: !authenticated + skip: !authenticated, }); return ( diff --git a/src/components/Shop/queries.ts b/src/components/Shop/queries.ts index 84de5018c..8cbef1071 100644 --- a/src/components/Shop/queries.ts +++ b/src/components/Shop/queries.ts @@ -2,7 +2,7 @@ import { gql } from "@apollo/client"; import { RefreshLimitsQuery, RefreshLimitsQueryVariables, - useRefreshLimitsQuery + useRefreshLimitsQuery, } from "@saleor/graphql"; import { QueryHookOptions } from "@saleor/hooks/graphql"; @@ -52,7 +52,7 @@ const limitVariables: Record = { orders: false, productVariants: false, staffUsers: false, - warehouses: false + warehouses: false, }; export const limitInfo = gql` @@ -72,12 +72,12 @@ export const useShopLimitsQuery = ( opts: QueryHookOptions< RefreshLimitsQuery, Partial - > + >, ) => useRefreshLimitsQuery({ ...opts, variables: { ...limitVariables, - ...opts.variables - } + ...opts.variables, + }, }); diff --git a/src/components/SingleAutocompleteSelectField/SingleAutocompleteSelectField.stories.tsx b/src/components/SingleAutocompleteSelectField/SingleAutocompleteSelectField.stories.tsx index b1f39f559..35c32690e 100644 --- a/src/components/SingleAutocompleteSelectField/SingleAutocompleteSelectField.stories.tsx +++ b/src/components/SingleAutocompleteSelectField/SingleAutocompleteSelectField.stories.tsx @@ -8,10 +8,10 @@ import { storiesOf } from "@storybook/react"; import React from "react"; import SingleAutocompleteSelectField, { - SingleAutocompleteSelectFieldProps + SingleAutocompleteSelectFieldProps, } from "./SingleAutocompleteSelectField"; import SingleAutocompleteSelectFieldContent, { - SingleAutocompleteSelectFieldContentProps + SingleAutocompleteSelectFieldContentProps, } from "./SingleAutocompleteSelectFieldContent"; const suggestions = countries.map(c => ({ label: c.name, value: c.code })); @@ -24,7 +24,7 @@ const props: SingleAutocompleteSelectFieldProps = { name: "country", onChange: () => undefined, placeholder: "Select country", - value: suggestions[0].value + value: suggestions[0].value, }; const Story: React.FC { const [displayValue, setDisplayValue] = React.useState(suggestions[0].label); @@ -48,7 +48,7 @@ const Story: React.FC undefined, - selectedItem: suggestions[0].value + selectedItem: suggestions[0].value, }; storiesOf("Generics / Select with autocomplete", module) @@ -102,7 +102,7 @@ storiesOf("Generics / Select with autocomplete", module) {...contentProps} add={{ label: "Add New Collection", - onClick: () => undefined + onClick: () => undefined, }} /> )) diff --git a/src/components/SingleAutocompleteSelectField/SingleAutocompleteSelectField.tsx b/src/components/SingleAutocompleteSelectField/SingleAutocompleteSelectField.tsx index 0419bfe8f..6d9cd3509 100644 --- a/src/components/SingleAutocompleteSelectField/SingleAutocompleteSelectField.tsx +++ b/src/components/SingleAutocompleteSelectField/SingleAutocompleteSelectField.tsx @@ -2,7 +2,7 @@ import { InputBase, Popper, PopperPlacementType, - TextField + TextField, } from "@material-ui/core"; import { InputProps } from "@material-ui/core/Input"; import { ExtendedFormHelperTextProps } from "@saleor/channels/components/ChannelForm/types"; @@ -16,33 +16,33 @@ import React from "react"; import Debounce, { DebounceProps } from "../Debounce"; import SingleAutocompleteSelectFieldContent, { SingleAutocompleteActionType, - SingleAutocompleteChoiceType + SingleAutocompleteChoiceType, } from "./SingleAutocompleteSelectFieldContent"; const useStyles = makeStyles( theme => ({ container: { flexGrow: 1, - position: "relative" + position: "relative", }, nakedInput: { - padding: theme.spacing(2, 0) + padding: theme.spacing(2, 0), }, adornment: { color: theme.palette.saleor.main[3], cursor: "pointer", userSelect: "none", "& svg": { - transition: theme.transitions.duration.shorter + "ms" - } + transition: theme.transitions.duration.shorter + "ms", + }, }, adornmentRotate: { "& svg": { - transform: "rotate(180deg)" - } - } + transform: "rotate(180deg)", + }, + }, }), - { name: "SingleAutocompleteSelectField" } + { name: "SingleAutocompleteSelectField" }, ); export interface SingleAutocompleteSelectFieldProps @@ -110,8 +110,8 @@ const SingleAutocompleteSelectFieldComponent: React.FC { const isCustomValueSelected = choices && selectedItem @@ -150,13 +150,13 @@ const SingleAutocompleteSelectFieldComponent: React.FC choiceId === inputValue + ({ value: choiceId }) => choiceId === inputValue, ); const isValueInValues = !!choiceFromInputValue; const isValueInLabels = !!choices.find( - choice => choice.label === inputValue + choice => choice.label === inputValue, ); const ensureProperValues = (alwaysCheck: boolean = false) => { @@ -195,7 +195,7 @@ const SingleAutocompleteSelectFieldComponent: React.FC @@ -208,7 +208,7 @@ const SingleAutocompleteSelectFieldComponent: React.FC { add.onClick(); closeMenu(); - } + }, } } choices={choices} @@ -313,7 +313,7 @@ const SingleAutocompleteSelectField: React.FC setQuery(q || "")} choices={filter(choices, query, { - key: "label" + key: "label", })} {...rest} /> diff --git a/src/components/SingleAutocompleteSelectField/SingleAutocompleteSelectFieldContent.tsx b/src/components/SingleAutocompleteSelectField/SingleAutocompleteSelectFieldContent.tsx index 2e88cc86b..73fece3d0 100644 --- a/src/components/SingleAutocompleteSelectField/SingleAutocompleteSelectFieldContent.tsx +++ b/src/components/SingleAutocompleteSelectField/SingleAutocompleteSelectFieldContent.tsx @@ -3,11 +3,11 @@ import { CircularProgress, MenuItem, Paper, - Typography + Typography, } from "@material-ui/core"; import Add from "@material-ui/icons/Add"; import useElementScroll, { - isScrolledToBottom + isScrolledToBottom, } from "@saleor/hooks/useElementScroll"; import { makeStyles } from "@saleor/macaw-ui"; import { FetchMoreProps } from "@saleor/types"; @@ -57,10 +57,10 @@ const useStyles = makeStyles( borderRadius: "100%", height: 24, marginRight: theme.spacing(), - width: 24 + width: 24, }, arrowContainer: { - position: "relative" + position: "relative", }, arrowInnerContainer: { alignItems: "center", @@ -76,53 +76,53 @@ const useStyles = makeStyles( opacity: 1, position: "absolute", transition: theme.transitions.duration.short + "ms", - width: "100%" + width: "100%", }, content: { maxHeight: `calc(${menuItemHeight * maxMenuItems}px + ${theme.spacing( - 2 + 2, )})`, overflow: "scroll", - padding: 8 + padding: 8, }, hide: { opacity: 0, - zIndex: -1 + zIndex: -1, }, hr: { - margin: theme.spacing(1, 0) + margin: theme.spacing(1, 0), }, menuItem: { height: "auto", whiteSpace: "normal", '&[aria-selected="true"]': { - backgroundColor: theme.palette.background.default - } + backgroundColor: theme.palette.background.default, + }, }, progress: {}, progressContainer: { display: "flex", justifyContent: "center", - padding: theme.spacing(1, 0) + padding: theme.spacing(1, 0), }, root: { borderBottomLeftRadius: 8, borderBottomRightRadius: 8, margin: theme.spacing(1, 0), overflow: "hidden", - zIndex: 22 - } + zIndex: 22, + }, }), { - name: "SingleAutocompleteSelectFieldContent" - } + name: "SingleAutocompleteSelectFieldContent", + }, ); function getChoiceIndex( index: number, emptyValue: boolean, customValue: boolean, - add: boolean + add: boolean, ) { let choiceIndex = index; if (emptyValue) { @@ -150,7 +150,7 @@ const SingleAutocompleteSelectFieldContent: React.FC @@ -270,7 +270,7 @@ const SingleAutocompleteSelectFieldContent: React.FC diff --git a/src/components/SingleSelectField/SingleSelectField.tsx b/src/components/SingleSelectField/SingleSelectField.tsx index f4af67767..6bfbf7e25 100644 --- a/src/components/SingleSelectField/SingleSelectField.tsx +++ b/src/components/SingleSelectField/SingleSelectField.tsx @@ -5,7 +5,7 @@ import { MenuItem, OutlinedInput, OutlinedInputProps, - Select + Select, } from "@material-ui/core"; import { SelectProps } from "@material-ui/core/Select"; import { makeStyles } from "@saleor/macaw-ui"; @@ -20,24 +20,24 @@ const useStyles = makeStyles( theme => ({ formControl: { "& label": { - top: "-3px" + top: "-3px", }, - width: "100%" + width: "100%", }, label: { - zIndex: 3 + zIndex: 3, }, noLabel: { - padding: theme.spacing(2, 1.5) + padding: theme.spacing(2, 1.5), }, paper: { - maxHeight: `calc(${singleSelectFieldItemHeight}px * 10 + ${singleSelectFieldItemHeight}px * 0.5)` + maxHeight: `calc(${singleSelectFieldItemHeight}px * 10 + ${singleSelectFieldItemHeight}px * 0.5)`, }, disabledMenuItem: { - pointerEvents: "none" - } + pointerEvents: "none", + }, }), - { name: "SingleSelectField" } + { name: "SingleSelectField" }, ); export interface Choice { @@ -77,7 +77,7 @@ export const SingleSelectField: React.FC = props => { selectProps, placeholder, InputProps, - testId + testId, } = props; const classes = useStyles(props); @@ -115,16 +115,16 @@ export const SingleSelectField: React.FC = props => { classes={{ ...(InputProps?.classes || {}), input: classNames(InputProps?.classes?.input, { - [classes.noLabel]: !label - }) + [classes.noLabel]: !label, + }), }} /> } {...selectProps} MenuProps={{ classes: { - paper: classes.paper - } + paper: classes.paper, + }, }} > {choices.length > 0 ? ( diff --git a/src/components/Skeleton.tsx b/src/components/Skeleton.tsx index d6ba349a6..0e0619d46 100644 --- a/src/components/Skeleton.tsx +++ b/src/components/Skeleton.tsx @@ -6,16 +6,16 @@ const useStyles = makeStyles( theme => ({ "@keyframes skeleton-animation": { "0%": { - opacity: 0.6 + opacity: 0.6, }, "100%": { - opacity: 1 - } + opacity: 1, + }, }, primary: { "&$skeleton": { - background: theme.palette.primary.main - } + background: theme.palette.primary.main, + }, }, skeleton: { animation: "skeleton-animation .75s linear infinite forwards alternate", @@ -23,10 +23,10 @@ const useStyles = makeStyles( borderRadius: 4, display: "block", height: "0.8em", - margin: "0.2em 0" - } + margin: "0.2em 0", + }, }), - { name: "Skeleton" } + { name: "Skeleton" }, ); interface SkeletonProps { @@ -44,7 +44,7 @@ const Skeleton: React.FC = props => { diff --git a/src/components/SortableChip/SortableChip.stories.tsx b/src/components/SortableChip/SortableChip.stories.tsx index 30b82ea4c..97d6f9bd1 100644 --- a/src/components/SortableChip/SortableChip.stories.tsx +++ b/src/components/SortableChip/SortableChip.stories.tsx @@ -1,5 +1,5 @@ import SortableChip, { - SortableChipProps + SortableChipProps, } from "@saleor/components/SortableChip"; import CardDecorator from "@saleor/storybook/CardDecorator"; import Decorator from "@saleor/storybook/Decorator"; @@ -11,7 +11,7 @@ const Container = SortableContainer(props => props.children); const props: SortableChipProps = { index: 0, - label: "Lorem Ipsum" + label: "Lorem Ipsum", }; storiesOf("Generics / Sortable chip", module) diff --git a/src/components/SortableChip/SortableChip.tsx b/src/components/SortableChip/SortableChip.tsx index 8c71295a5..2b41e3590 100644 --- a/src/components/SortableChip/SortableChip.tsx +++ b/src/components/SortableChip/SortableChip.tsx @@ -19,24 +19,24 @@ const useStyles = makeStyles( cursor: "pointer", fontSize: 16, marginLeft: theme.spacing(), - verticalAlign: "middle" + verticalAlign: "middle", }, content: { alignItems: "center", - display: "flex" + display: "flex", }, root: { border: `1px solid ${theme.palette.divider}`, borderRadius: 18, display: "inline-block", marginRight: theme.spacing(2), - padding: "6px 12px" + padding: "6px 12px", }, sortableHandle: { - marginRight: theme.spacing(1) - } + marginRight: theme.spacing(1), + }, }), - { name: "SortableChip" } + { name: "SortableChip" }, ); const SortableChip = SortableElement(props => { diff --git a/src/components/SortableChip/SortableHandle.tsx b/src/components/SortableChip/SortableHandle.tsx index e8a4462a7..59828d4b8 100644 --- a/src/components/SortableChip/SortableHandle.tsx +++ b/src/components/SortableChip/SortableHandle.tsx @@ -6,10 +6,10 @@ import { SortableHandle as SortableHandleHoc } from "react-sortable-hoc"; const useStyles = makeStyles( { drag: { - cursor: "grab" - } + cursor: "grab", + }, }, - { name: "SortableHandle" } + { name: "SortableHandle" }, ); interface SortableHandle { diff --git a/src/components/SortableChipsField/SortableChipsField.stories.tsx b/src/components/SortableChipsField/SortableChipsField.stories.tsx index b8e41e69b..720581362 100644 --- a/src/components/SortableChipsField/SortableChipsField.stories.tsx +++ b/src/components/SortableChipsField/SortableChipsField.stories.tsx @@ -4,7 +4,7 @@ import { storiesOf } from "@storybook/react"; import React from "react"; import SortableChipsField, { - SortableChipsFieldProps + SortableChipsFieldProps, } from "./SortableChipsField"; const props: SortableChipsFieldProps = { @@ -16,8 +16,8 @@ const props: SortableChipsFieldProps = { { label: "Item 3", value: "item-3" }, { label: "Item 4", value: "item-4" }, { label: "Item 5", value: "item-5" }, - { label: "Item 6", value: "item-6" } - ] + { label: "Item 6", value: "item-6" }, + ], }; storiesOf("Generics / Sortable chips field", module) diff --git a/src/components/SortableChipsField/SortableChipsField.tsx b/src/components/SortableChipsField/SortableChipsField.tsx index 163b422f1..3cabbb43b 100644 --- a/src/components/SortableChipsField/SortableChipsField.tsx +++ b/src/components/SortableChipsField/SortableChipsField.tsx @@ -13,15 +13,15 @@ const useStyles = makeStyles( chip: { background: theme.palette.background.paper, color: theme.palette.primary.dark, - marginBottom: theme.spacing(1) + marginBottom: theme.spacing(1), }, errorText: { - color: theme.palette.error.light - } + color: theme.palette.error.light, + }, }), { - name: "SortableChipsField" - } + name: "SortableChipsField", + }, ); export interface SortableChipsFieldValueType { @@ -45,7 +45,7 @@ const SortableChipsField: React.FC = props => { error, helperText, onValueDelete, - onValueReorder + onValueReorder, } = props; const classes = useStyles(props); diff --git a/src/components/SortableTable/SortableHandle.tsx b/src/components/SortableTable/SortableHandle.tsx index 5cc863022..7009e2e23 100644 --- a/src/components/SortableTable/SortableHandle.tsx +++ b/src/components/SortableTable/SortableHandle.tsx @@ -8,13 +8,13 @@ const useStyles = makeStyles( columnDrag: { "&&&": { paddingLeft: theme.spacing(3), - paddingRight: theme.spacing(2) + paddingRight: theme.spacing(2), }, cursor: "grab", - width: `calc(48px + ${theme.spacing(1.5)})` - } + width: `calc(48px + ${theme.spacing(1.5)})`, + }, }), - { name: "SortableHandle" } + { name: "SortableHandle" }, ); const SortableHandle = SortableHandleHoc(() => { diff --git a/src/components/SortableTable/SortableTableBody.tsx b/src/components/SortableTable/SortableTableBody.tsx index f7ac455fc..c9b628b5e 100644 --- a/src/components/SortableTable/SortableTableBody.tsx +++ b/src/components/SortableTable/SortableTableBody.tsx @@ -6,7 +6,7 @@ import React from "react"; import { SortableContainer } from "react-sortable-hoc"; const InnerSortableTableBody = SortableContainer( - ({ children, ...props }) => {children} + ({ children, ...props }) => {children}, ); export interface SortableTableBodyProps { @@ -17,16 +17,16 @@ const useStyles = makeStyles( theme => ({ ghost: { "& td": { - borderBottom: "none" + borderBottom: "none", }, background: theme.palette.background.paper, fontFamily: theme.typography.fontFamily, // FIXME: you damn know what // fontSize: theme.overrides.MuiTableCell.root.fontSize, - opacity: 0.5 - } + opacity: 0.5, + }, }), - { name: "SortableTableBody" } + { name: "SortableTableBody" }, ); const SortableTableBody: React.FC(({ children, ...props }) => ( {children} )) as unknown) as ( - props: SortableElementProps & SortableTableRowProps + props: SortableElementProps & SortableTableRowProps, ) => JSX.Element; export default SortableTableRow; diff --git a/src/components/Tab/Tab.tsx b/src/components/Tab/Tab.tsx index e7ef8ce51..45fca4584 100644 --- a/src/components/Tab/Tab.tsx +++ b/src/components/Tab/Tab.tsx @@ -7,18 +7,18 @@ import React from "react"; const useStyles = makeStyles( theme => ({ active: { - color: theme.palette.text.secondary + color: theme.palette.text.secondary, }, root: { "&$active": { borderBottomColor: theme.palette.primary.main, - color: theme.typography.body1.color + color: theme.typography.body1.color, }, "&:focus": { - color: theme.palette.primary.main + color: theme.palette.primary.main, }, "&:hover": { - color: theme.palette.primary.main + color: theme.palette.primary.main, }, borderBottom: "1px solid transparent", color: fade(theme.palette.text.secondary, 0.6), @@ -28,10 +28,10 @@ const useStyles = makeStyles( marginRight: theme.spacing(2), minWidth: 40, padding: theme.spacing(1), - transition: theme.transitions.duration.short + "ms" - } + transition: theme.transitions.duration.short + "ms", + }, }), - { name: "Tab" } + { name: "Tab" }, ); interface TabProps { @@ -53,7 +53,7 @@ export function Tab(value: T) { data-test-id={testId} className={classNames({ [classes.root]: true, - [classes.active]: isActive + [classes.active]: isActive, })} onClick={() => changeTab(value)} > diff --git a/src/components/Tab/TabContainer.tsx b/src/components/Tab/TabContainer.tsx index 1755ab828..a9c7c4ac2 100644 --- a/src/components/Tab/TabContainer.tsx +++ b/src/components/Tab/TabContainer.tsx @@ -8,10 +8,10 @@ export interface TabContainerProps { const useStyles = makeStyles( theme => ({ root: { - borderBottom: `1px solid ${theme.palette.divider}` - } + borderBottom: `1px solid ${theme.palette.divider}`, + }, }), - { name: "TabContainer" } + { name: "TabContainer" }, ); const TabContainer: React.FC = props => { diff --git a/src/components/Tab/Tabs.tsx b/src/components/Tab/Tabs.tsx index 5c4b90202..5c052c0bd 100644 --- a/src/components/Tab/Tabs.tsx +++ b/src/components/Tab/Tabs.tsx @@ -13,7 +13,7 @@ interface TabsState { class Tabs extends React.Component { state: TabsState = { - currentTab: 0 + currentTab: 0, }; changeTab = (index: number) => this.setState({ currentTab: index }); @@ -21,7 +21,7 @@ class Tabs extends React.Component { render() { return this.props.children({ changeTab: this.changeTab, - currentTab: this.state.currentTab + currentTab: this.state.currentTab, }); } } diff --git a/src/components/TableButtonWrapper/TableButtonWrapper.tsx b/src/components/TableButtonWrapper/TableButtonWrapper.tsx index 41e0b3149..3ace74ef1 100644 --- a/src/components/TableButtonWrapper/TableButtonWrapper.tsx +++ b/src/components/TableButtonWrapper/TableButtonWrapper.tsx @@ -18,7 +18,7 @@ interface TableButtonWrapper { * ``` */ export const TableButtonWrapper = ({ - children + children, }: TableButtonWrapper) => { const onClick = (e: React.MouseEvent) => { if (!children.props.href) { diff --git a/src/components/TableCellAvatar/Avatar.tsx b/src/components/TableCellAvatar/Avatar.tsx index b9d5157a9..970fd58b1 100644 --- a/src/components/TableCellAvatar/Avatar.tsx +++ b/src/components/TableCellAvatar/Avatar.tsx @@ -8,7 +8,7 @@ export const AVATAR_MARGIN = 40; const useStyles = makeStyles( theme => ({ alignRight: { - justifyContent: "flex-end" + justifyContent: "flex-end", }, avatar: { background: "none", @@ -16,26 +16,26 @@ const useStyles = makeStyles( borderRadius: 2, color: "#bdbdbd", display: "inline-flex", - padding: theme.spacing(0.5) + padding: theme.spacing(0.5), }, children: { alignSelf: "center", marginLeft: theme.spacing(2), - width: "100%" + width: "100%", }, content: { alignItems: "center", - display: "flex" + display: "flex", }, root: { "&:not(first-child)": { - paddingLeft: 0 + paddingLeft: 0, }, paddingRight: theme.spacing(3), - width: "1%" - } + width: "1%", + }, }), - { name: "Avatar" } + { name: "Avatar" }, ); export interface AvatarProps { @@ -51,14 +51,14 @@ const Avatar: React.FC = ({ alignRight, thumbnail, avatarProps, - badge + badge, }) => { const classes = useStyles({}); return (
{badge} diff --git a/src/components/TableCellAvatar/TableCellAvatar.tsx b/src/components/TableCellAvatar/TableCellAvatar.tsx index cdb5dd86f..f7503bfdc 100644 --- a/src/components/TableCellAvatar/TableCellAvatar.tsx +++ b/src/components/TableCellAvatar/TableCellAvatar.tsx @@ -10,13 +10,13 @@ const useStyles = makeStyles( theme => ({ root: { "&:not(first-child)": { - paddingLeft: 0 + paddingLeft: 0, }, paddingRight: theme.spacing(3), - width: "1%" - } + width: "1%", + }, }), - { name: "TableCellAvatar" } + { name: "TableCellAvatar" }, ); interface TableCellAvatarProps extends AvatarProps, TableCellProps { diff --git a/src/components/TableCellHeader/TableCellHeader.stories.tsx b/src/components/TableCellHeader/TableCellHeader.stories.tsx index 4c5be3cc5..63ae23d7e 100644 --- a/src/components/TableCellHeader/TableCellHeader.stories.tsx +++ b/src/components/TableCellHeader/TableCellHeader.stories.tsx @@ -3,7 +3,7 @@ import { TableBody, TableCell, TableHead, - TableRow + TableRow, } from "@material-ui/core"; import ResponsiveTable from "@saleor/components/ResponsiveTable"; import { storiesOf } from "@storybook/react"; @@ -11,7 +11,7 @@ import React from "react"; import Decorator from "../../storybook/Decorator"; import TableCellHeader, { - TableCellHeaderArrowDirection + TableCellHeaderArrowDirection, } from "./TableCellHeader"; type Field = "name" | "type"; @@ -24,7 +24,7 @@ interface StoryProps { const Story: React.FC = ({ direction, field = "name", - onHeaderClick = () => undefined + onHeaderClick = () => undefined, }) => ( diff --git a/src/components/TableCellHeader/TableCellHeader.tsx b/src/components/TableCellHeader/TableCellHeader.tsx index d7f896db6..9d013e69e 100644 --- a/src/components/TableCellHeader/TableCellHeader.tsx +++ b/src/components/TableCellHeader/TableCellHeader.tsx @@ -9,49 +9,49 @@ import ArrowSort from "../../icons/ArrowSort"; const useStyles = makeStyles( theme => ({ arrow: { - transition: theme.transitions.duration.short + "ms" + transition: theme.transitions.duration.short + "ms", }, arrowLeft: { - marginLeft: -24 + marginLeft: -24, }, arrowUp: { - transform: "rotate(180deg)" + transform: "rotate(180deg)", }, disabled: { opacity: 0.7, "&&": { - cursor: "unset" - } + cursor: "unset", + }, }, label: { alignSelf: "center", display: "inline-block", - userSelect: "none" + userSelect: "none", }, labelContainer: { "&:hover": { - color: theme.palette.text.primary + color: theme.palette.text.primary, }, display: "flex", - height: 24 + height: 24, }, labelContainerActive: { - color: theme.palette.text.primary + color: theme.palette.text.primary, }, labelContainerCenter: { - justifyContent: "center" + justifyContent: "center", }, labelContainerRight: { - justifyContent: "flex-end" + justifyContent: "flex-end", }, root: { - cursor: "pointer" + cursor: "pointer", }, notSortable: { - cursor: "unset" - } + cursor: "unset", + }, }), - { name: "TableCellHeader" } + { name: "TableCellHeader" }, ); export type TableCellHeaderArrowDirection = "asc" | "desc"; @@ -91,20 +91,20 @@ const TableCellHeader = React.forwardRef( }} className={classNames(classes.root, className, { [classes.disabled]: disabled, - [classes.notSortable]: !onClick + [classes.notSortable]: !onClick, })} >
{!!direction && arrowPosition === "left" && ( )} @@ -112,19 +112,19 @@ const TableCellHeader = React.forwardRef( {!!direction && arrowPosition === "right" && ( )}
); - } + }, ); TableCellHeader.displayName = "TableCellHeader"; TableCellHeader.defaultProps = { arrowPosition: "left", - textAlign: "left" + textAlign: "left", }; export default TableCellHeader; diff --git a/src/components/TableFilter/FilterTab.tsx b/src/components/TableFilter/FilterTab.tsx index 0a432b42b..afb58b18b 100644 --- a/src/components/TableFilter/FilterTab.tsx +++ b/src/components/TableFilter/FilterTab.tsx @@ -7,25 +7,25 @@ const useStyles = makeStyles( theme => ({ selectedTabLabel: { "&$tabLabel": { - color: theme.typography.body1.color - } + color: theme.typography.body1.color, + }, }, tabLabel: { "&:hover": { - color: theme.typography.body1.color + color: theme.typography.body1.color, }, color: theme.typography.caption.color, fontSize: theme.typography.body1.fontSize, - fontWeight: 400 + fontWeight: 400, }, tabRoot: { minWidth: "80px", opacity: 1, paddingTop: theme.spacing(1), - textTransform: "initial" as "initial" - } + textTransform: "initial" as "initial", + }, }), - { name: "FilterTab" } + { name: "FilterTab" }, ); interface FilterTabProps { @@ -47,8 +47,8 @@ export const FilterTab: React.FC = props => { classes={{ root: classes.tabRoot, wrapper: classNames(classes.tabLabel, { - [classes.selectedTabLabel]: selected - }) + [classes.selectedTabLabel]: selected, + }), }} onClick={onClick} value={value} diff --git a/src/components/TableFilter/FilterTabs.tsx b/src/components/TableFilter/FilterTabs.tsx index d84fe0170..363bf4165 100644 --- a/src/components/TableFilter/FilterTabs.tsx +++ b/src/components/TableFilter/FilterTabs.tsx @@ -6,10 +6,10 @@ const useStyles = makeStyles( theme => ({ tabsRoot: { borderBottom: `1px solid ${theme.palette.divider}`, - paddingLeft: theme.spacing(4) - } + paddingLeft: theme.spacing(4), + }, }), - { name: "FilterTabs" } + { name: "FilterTabs" }, ); interface FilterTabsProps { diff --git a/src/components/TableHead/TableHead.tsx b/src/components/TableHead/TableHead.tsx index d96ab934d..2dd5493cb 100644 --- a/src/components/TableHead/TableHead.tsx +++ b/src/components/TableHead/TableHead.tsx @@ -2,7 +2,7 @@ import { TableCell, TableHead as MuiTableHead, TableRow, - Typography + Typography, } from "@material-ui/core"; import { TableHeadProps as MuiTableHeadProps } from "@material-ui/core/TableHead"; import { makeStyles } from "@saleor/macaw-ui"; @@ -26,38 +26,38 @@ export interface TableHeadProps extends MuiTableHeadProps { const useStyles = makeStyles( theme => ({ cell: { - height: 56 + height: 56, }, container: { alignItems: "center", display: "flex", height: 47, - marginRight: theme.spacing(-2) + marginRight: theme.spacing(-2), }, dragRows: { padding: 0, - width: 52 + width: 52, }, padding: { "&:last-child": { - padding: 0 - } + padding: 0, + }, }, root: { paddingLeft: 0, - paddingRight: theme.spacing(4) + paddingRight: theme.spacing(4), }, spacer: { - flex: 1 + flex: 1, }, toolbar: { "& > *": { - marginLeft: theme.spacing(1) + marginLeft: theme.spacing(1), }, - marginRight: theme.spacing(1.5) - } + marginRight: theme.spacing(1.5), + }, }), - { name: "TableHead" } + { name: "TableHead" }, ); function getColSpan(colSpan: number, dragRows: boolean): number { @@ -90,7 +90,7 @@ const TableHead: React.FC = props => { = props => { id="qu/hXD" defaultMessage="Selected {number} items" values={{ - number: selected + number: selected, }} /> diff --git a/src/components/TablePagination/TablePagination.tsx b/src/components/TablePagination/TablePagination.tsx index 615440ce7..dcaecb17a 100644 --- a/src/components/TablePagination/TablePagination.tsx +++ b/src/components/TablePagination/TablePagination.tsx @@ -1,7 +1,7 @@ import { TableCell } from "@material-ui/core"; import { Pagination, - PaginationProps as MacawPaginationProps + PaginationProps as MacawPaginationProps, } from "@saleor/macaw-ui"; import React from "react"; import { defineMessages, useIntl } from "react-intl"; @@ -11,15 +11,15 @@ import { ListSettings } from "../../types"; export type ListSettingsUpdate = ( key: T, - value: ListSettings[T] + value: ListSettings[T], ) => void; const messages = defineMessages({ noOfRows: { id: "2HfSiT", defaultMessage: "No. of rows", - description: "pagination" - } + description: "pagination", + }, }); export interface PaginationProps @@ -57,7 +57,7 @@ export const TablePagination: React.FC = ({ hasNextPage={hasNextPage && !disabled} hasPreviousPage={hasPreviousPage && !disabled} labels={{ - noOfRows: intl.formatMessage(messages.noOfRows) + noOfRows: intl.formatMessage(messages.noOfRows), }} rowNumber={settings?.rowNumber} onRowNumberUpdate={ diff --git a/src/components/TablePagination/TablePaginationActions.tsx b/src/components/TablePagination/TablePaginationActions.tsx index 5e3b4d83b..5f067e1d6 100644 --- a/src/components/TablePagination/TablePaginationActions.tsx +++ b/src/components/TablePagination/TablePaginationActions.tsx @@ -10,45 +10,45 @@ const useStyles = makeStyles( theme => ({ dark: { "& svg": { - color: theme.palette.primary.main + color: theme.palette.primary.main, }, "&$disabled": { "& svg": { - color: fade(theme.palette.primary.main, 0.2) - } + color: fade(theme.palette.primary.main, 0.2), + }, }, "&:focus, &:hover": { "& > span:first-of-type": { - backgroundColor: fade(theme.palette.primary.main, 0.2) - } - } + backgroundColor: fade(theme.palette.primary.main, 0.2), + }, + }, }, disabled: {}, iconButton: { "& > span:first-of-type": { backgroundColor: theme.palette.background.default, borderRadius: "100%", - transition: theme.transitions.duration.standard + "ms" + transition: theme.transitions.duration.standard + "ms", }, "& svg": { border: `solid 1px #BDBDBD`, - borderRadius: "50%" + borderRadius: "50%", }, "&:focus, &:hover": { "& > span:first-of-type": { - backgroundColor: fade(theme.palette.primary.main, 0.2) + backgroundColor: fade(theme.palette.primary.main, 0.2), }, - backgroundColor: "transparent" + backgroundColor: "transparent", }, - padding: 6 + padding: 6, }, root: { color: theme.palette.text.secondary, flexShrink: 0, - margin: theme.spacing(0, 2.5) - } + margin: theme.spacing(0, 2.5), + }, }), - { name: "TablePaginationActions" } + { name: "TablePaginationActions" }, ); export interface TablePaginationActionsProps { @@ -84,7 +84,7 @@ export const TablePaginationActions: React.FC = pro variant="secondary" className={classNames(classes.iconButton, { [classes.dark]: isDark, - [classes.disabled]: !hasPreviousPage + [classes.disabled]: !hasPreviousPage, })} onClick={onPreviousPage} disabled={!hasPreviousPage} @@ -96,7 +96,7 @@ export const TablePaginationActions: React.FC = pro ; export const TablePaginationWithContext = ( - props: TablePaginationWithContextProps + props: TablePaginationWithContextProps, ) => { const { hasNextPage, diff --git a/src/components/TableRowLink/TableRowLink.tsx b/src/components/TableRowLink/TableRowLink.tsx index 26401d5eb..795c02d72 100644 --- a/src/components/TableRowLink/TableRowLink.tsx +++ b/src/components/TableRowLink/TableRowLink.tsx @@ -19,10 +19,10 @@ const useStyles = makeStyles( { link: { all: "inherit", - display: "contents" - } + display: "contents", + }, }, - { name: "TableRowLink" } + { name: "TableRowLink" }, ); const TableRowLink = ({ diff --git a/src/components/TextFieldWithChoice/TextFieldWithChoice.tsx b/src/components/TextFieldWithChoice/TextFieldWithChoice.tsx index e45efe377..da177e4d7 100644 --- a/src/components/TextFieldWithChoice/TextFieldWithChoice.tsx +++ b/src/components/TextFieldWithChoice/TextFieldWithChoice.tsx @@ -6,7 +6,7 @@ import { Paper, Popper, TextField, - Typography + Typography, } from "@material-ui/core"; import { TextFieldProps } from "@material-ui/core/TextField"; import DropdownIcon from "@material-ui/icons/ArrowDropDown"; @@ -31,13 +31,13 @@ const useStyles = makeStyles( adornment: { alignItems: "center", cursor: "pointer", - display: "flex" + display: "flex", }, menu: { - zIndex: 10 - } + zIndex: 10, + }, }, - { name: "TextFieldWithChoice" } + { name: "TextFieldWithChoice" }, ); const TextFieldWithChoice: React.FC = props => { @@ -56,14 +56,14 @@ const TextFieldWithChoice: React.FC = props => { {({ open: menuOpen, - actions: { open: openMenu, close: closeMenu } + actions: { open: openMenu, close: closeMenu }, }) => { const handleSelect = value => { onChange({ target: { name: ChoiceProps.name, - value - } + value, + }, } as any); closeMenu(); }; @@ -95,7 +95,7 @@ const TextFieldWithChoice: React.FC = props => { transformOrigin: placement === "bottom" ? "right top" - : "right bottom" + : "right bottom", }} > @@ -122,7 +122,7 @@ const TextFieldWithChoice: React.FC = props => { ); }} - ) + ), }} /> ); diff --git a/src/components/TextWithSelectField/TextWithSelectField.tsx b/src/components/TextWithSelectField/TextWithSelectField.tsx index aca119f4c..b38416bc2 100644 --- a/src/components/TextWithSelectField/TextWithSelectField.tsx +++ b/src/components/TextWithSelectField/TextWithSelectField.tsx @@ -1,6 +1,6 @@ import { TextField } from "@material-ui/core"; import SingleSelectField, { - Choices + Choices, } from "@saleor/components/SingleSelectField"; import { ChangeEvent, FormChange } from "@saleor/hooks/useForm"; import classNames from "classnames"; @@ -35,7 +35,7 @@ const TextWithSelectField: React.FC = ({ textFieldProps, selectFieldProps, helperText, - isError + isError, }) => { const classes = useStyles(); @@ -44,13 +44,13 @@ const TextWithSelectField: React.FC = ({ value: textFieldValue, label: textFieldLabel, type: textFieldType, - minValue: textFieldMinValue + minValue: textFieldMinValue, } = textFieldProps; const { name: selectFieldName, value: selectFieldValue, - className: selectFieldClassName + className: selectFieldClassName, } = selectFieldProps; const handleSelectChange = (event: ChangeEvent) => { @@ -58,7 +58,7 @@ const TextWithSelectField: React.FC = ({ // we need to save the other part of the field as well const inputTarget = { value: textFieldValue, - name: textFieldName + name: textFieldName, }; change(event); @@ -70,7 +70,7 @@ const TextWithSelectField: React.FC = ({ const otherTarget = { value: selectFieldValue, - name: selectFieldName + name: selectFieldName, }; // handle parsing in case of text field of type number @@ -81,7 +81,7 @@ const TextWithSelectField: React.FC = ({ change({ ...event, - target: { ...event.target, value: parsedValue, name: event.target.name } + target: { ...event.target, value: parsedValue, name: event.target.name }, }); change({ target: otherTarget }); }; @@ -96,11 +96,11 @@ const TextWithSelectField: React.FC = ({ name={textFieldName} label={textFieldLabel} inputProps={{ - min: textFieldMinValue + min: textFieldMinValue, }} InputProps={{ className: classNames(classes.textField, { - [classes.textFieldCentered]: !textFieldLabel + [classes.textFieldCentered]: !textFieldLabel, }), endAdornment: ( = ({ classes: { input: classes.noBackground, root: classes.input, - notchedOutline: classes.noBorder - } + notchedOutline: classes.noBorder, + }, }} choices={choices} /> - ) + ), }} onChange={handleTextChange} value={textFieldValue} diff --git a/src/components/TextWithSelectField/styles.ts b/src/components/TextWithSelectField/styles.ts index aaf192d50..5109af709 100644 --- a/src/components/TextWithSelectField/styles.ts +++ b/src/components/TextWithSelectField/styles.ts @@ -3,23 +3,23 @@ import { makeStyles } from "@saleor/macaw-ui"; export const useStyles = makeStyles( () => ({ container: { - width: 400 + width: 400, }, innerContainer: { - width: "100%" + width: "100%", }, textField: { width: "100%", paddingRight: 0, "& input": { - maxWidth: "100%" - } + maxWidth: "100%", + }, }, textFieldCentered: { "& input": { paddingTop: 17, - paddingBottom: 16 - } + paddingBottom: 16, + }, }, // It may seem lazy to set these CSS properties with !important tags, but @@ -29,14 +29,14 @@ export const useStyles = makeStyles( // to enforce these styles with !important. input: { boxShadow: "none !important", - border: "none" + border: "none", }, noBorder: { - borderColor: "transparent !important" + borderColor: "transparent !important", }, noBackground: { - backgroundColor: "transparent !important" - } + backgroundColor: "transparent !important", + }, }), - { name: "TextWithSelectField" } + { name: "TextWithSelectField" }, ); diff --git a/src/components/Timeline/Timeline.tsx b/src/components/Timeline/Timeline.tsx index f25aa0a81..0715f8547 100644 --- a/src/components/Timeline/Timeline.tsx +++ b/src/components/Timeline/Timeline.tsx @@ -11,54 +11,54 @@ const useStyles = makeStyles( avatar: { "& span": { height: "100%", - width: "100%" + width: "100%", }, alignSelf: "flex-start", - marginRight: theme.spacing(3.5) + marginRight: theme.spacing(3.5), }, button: { - zIndex: 2 + zIndex: 2, }, cardActionsExpanded: { - maxHeight: theme.spacing(6) + maxHeight: theme.spacing(6), }, input: { "& > div": { - padding: "0 14px" + padding: "0 14px", }, "& textarea": { "&::placeholder": { - opacity: [[1], "!important"] as any + opacity: [[1], "!important"] as any, }, - zIndex: 2 + zIndex: 2, }, - background: theme.palette.background.paper + background: theme.palette.background.paper, }, noteRoot: { left: theme.spacing(-8.5), marginBottom: theme.spacing(3), position: "relative", - width: `calc(100% + ${theme.spacing(8.5)})` + width: `calc(100% + ${theme.spacing(8.5)})`, }, noteTitle: { "&:last-child": { paddingBottom: 0, - paddingRight: 0 + paddingRight: 0, }, alignItems: "center", background: theme.palette.background.default, display: "flex", - paddingLeft: theme.spacing(3) + paddingLeft: theme.spacing(3), }, root: { borderColor: theme.palette.divider, borderStyle: "solid", borderWidth: "0 0 0 2px", marginLeft: 20, - paddingLeft: theme.spacing(3) - } + paddingLeft: theme.spacing(3), + }, }), - { name: "Timeline" } + { name: "Timeline" }, ); interface TimelineProps { @@ -106,7 +106,7 @@ export const TimelineAddNote: React.FC = props => { className={classes.input} placeholder={intl.formatMessage({ id: "3evXPj", - defaultMessage: "Leave your note here..." + defaultMessage: "Leave your note here...", })} onChange={onChange} value={message} @@ -126,7 +126,7 @@ export const TimelineAddNote: React.FC = props => { description="add order note, button" /> - ) + ), }} variant="outlined" /> diff --git a/src/components/Timeline/TimelineEvent.tsx b/src/components/Timeline/TimelineEvent.tsx index 1fe15632c..115abbd5d 100644 --- a/src/components/Timeline/TimelineEvent.tsx +++ b/src/components/Timeline/TimelineEvent.tsx @@ -2,7 +2,7 @@ import { Accordion, AccordionDetails, AccordionSummary, - Typography + Typography, } from "@material-ui/core"; import ExpandMoreIcon from "@material-ui/icons/ExpandMore"; import { makeStyles } from "@saleor/macaw-ui"; @@ -19,41 +19,41 @@ const useStyles = makeStyles( left: -29, position: "absolute", top: 6, - width: 8 + width: 8, }, panel: { "& .MuiAccordionDetails-root": { padding: 0, - paddingTop: theme.spacing(2) + paddingTop: theme.spacing(2), }, "&.Mui-expanded": { margin: 0, - minHeight: 0 + minHeight: 0, }, "&:before": { - display: "none" + display: "none", }, background: "none", display: "", margin: 0, minHeight: 0, - width: "100%" + width: "100%", }, panelExpander: { "&.MuiAccordionSummary-root.Mui-expanded": { - minHeight: 0 + minHeight: 0, }, "&> .MuiAccordionSummary-content": { - margin: 0 + margin: 0, }, "&> .MuiAccordionSummary-expandIcon": { padding: 0, position: "absolute", - right: theme.spacing(20) + right: theme.spacing(20), }, margin: 0, minHeight: 0, - padding: 0 + padding: 0, }, root: { "&:last-child:after": { @@ -63,17 +63,17 @@ const useStyles = makeStyles( left: -26, position: "absolute", top: "calc(50% + 4px)", - width: "2px" + width: "2px", }, alignItems: "center", display: "flex", marginBottom: theme.spacing(3), marginTop: 0, position: "relative", - width: "100%" - } + width: "100%", + }, }), - { name: "TimelineEvent" } + { name: "TimelineEvent" }, ); export interface TimelineEventProps { diff --git a/src/components/Timeline/TimelineEventHeader.tsx b/src/components/Timeline/TimelineEventHeader.tsx index 1b5f61373..605f866fc 100644 --- a/src/components/Timeline/TimelineEventHeader.tsx +++ b/src/components/Timeline/TimelineEventHeader.tsx @@ -13,28 +13,28 @@ const useStyles = makeStyles( display: "flex", flexDirection: "row", justifyContent: "space-between", - width: "100%" + width: "100%", }, date: { color: theme.typography.caption.color, - paddingLeft: 24 + paddingLeft: 24, }, elementsContainer: { alignItems: "center", display: "flex", flexDirection: "row", - flexWrap: "wrap" + flexWrap: "wrap", }, secondaryTitle: { color: "#9e9e9e", fontSize: 14, - marginTop: theme.spacing(2) + marginTop: theme.spacing(2), }, titleElement: { - marginRight: theme.spacing(0.5) - } + marginRight: theme.spacing(0.5), + }, }), - { name: "TimelineEventHeader" } + { name: "TimelineEventHeader" }, ); export interface TitleElement { diff --git a/src/components/Timeline/TimelineNote.tsx b/src/components/Timeline/TimelineNote.tsx index 948d94ed5..1927f1781 100644 --- a/src/components/Timeline/TimelineNote.tsx +++ b/src/components/Timeline/TimelineNote.tsx @@ -23,7 +23,7 @@ const palette = [ colors.purple, colors.red, colors.teal, - colors.yellow + colors.yellow, ].map(color => color[500]); const useStyles = makeStyles( @@ -31,33 +31,33 @@ const useStyles = makeStyles( avatar: { left: -45, position: "absolute", - top: 0 + top: 0, }, card: { marginBottom: theme.spacing(3), marginLeft: theme.spacing(3), - position: "relative" + position: "relative", }, cardContent: { "&:last-child": { - padding: 16 - } + padding: 16, + }, }, root: { - position: "relative" + position: "relative", }, title: { "& p": { - fontSize: "14px" + fontSize: "14px", }, alignItems: "center", display: "flex", justifyContent: "space-between", marginBottom: theme.spacing(), - paddingLeft: theme.spacing(3) - } + paddingLeft: theme.spacing(3), + }, }), - { name: "TimelineNote" } + { name: "TimelineNote" }, ); interface TimelineNoteProps { diff --git a/src/components/Timezone/Timezone.tsx b/src/components/Timezone/Timezone.tsx index 4891be902..9697795d4 100644 --- a/src/components/Timezone/Timezone.tsx +++ b/src/components/Timezone/Timezone.tsx @@ -3,7 +3,7 @@ import React from "react"; export const TimezoneContext = React.createContext(undefined); const { Consumer: TimezoneConsumer, - Provider: TimezoneProvider + Provider: TimezoneProvider, } = TimezoneContext; export { TimezoneConsumer, TimezoneProvider }; diff --git a/src/components/TooltipTableCellHeader/messages.ts b/src/components/TooltipTableCellHeader/messages.ts index ac27be69f..cb94543fd 100644 --- a/src/components/TooltipTableCellHeader/messages.ts +++ b/src/components/TooltipTableCellHeader/messages.ts @@ -4,6 +4,6 @@ export const commonTooltipMessages = defineMessages({ noFilterSelected: { id: "zyXcBP", defaultMessage: - "Sorting by this column requires active filter: {filterName}" - } + "Sorting by this column requires active filter: {filterName}", + }, }); diff --git a/src/components/TypeDeleteWarningDialog/DeleteWarningDialogConsentContent.tsx b/src/components/TypeDeleteWarningDialog/DeleteWarningDialogConsentContent.tsx index 8125c398b..af30a9b91 100644 --- a/src/components/TypeDeleteWarningDialog/DeleteWarningDialogConsentContent.tsx +++ b/src/components/TypeDeleteWarningDialog/DeleteWarningDialogConsentContent.tsx @@ -16,7 +16,7 @@ const DeleteWarningDialogConsentContent: React.FC { const classes = useStyles(); diff --git a/src/components/TypeDeleteWarningDialog/TypeDeleteWarningDialog.stories.tsx b/src/components/TypeDeleteWarningDialog/TypeDeleteWarningDialog.stories.tsx index 129a9fa17..c073fc418 100644 --- a/src/components/TypeDeleteWarningDialog/TypeDeleteWarningDialog.stories.tsx +++ b/src/components/TypeDeleteWarningDialog/TypeDeleteWarningDialog.stories.tsx @@ -6,7 +6,7 @@ import React from "react"; import * as messages from "../../pageTypes/hooks/usePageTypeDelete/messages"; import TypeDeleteWarningDialog, { TypeBaseData, - TypeDeleteWarningDialogProps + TypeDeleteWarningDialogProps, } from "./TypeDeleteWarningDialog"; const props: TypeDeleteWarningDialogProps = { @@ -19,7 +19,7 @@ const props: TypeDeleteWarningDialogProps = { assignedItemsCount: 4, typesToDelete: ["id-1"], viewAssignedItemsUrl: "some-url", - deleteButtonState: "default" + deleteButtonState: "default", }; storiesOf("TypeDeleteWarningDialog.stories", module) diff --git a/src/components/TypeDeleteWarningDialog/TypeDeleteWarningDialog.tsx b/src/components/TypeDeleteWarningDialog/TypeDeleteWarningDialog.tsx index 94e900721..c9a5785ea 100644 --- a/src/components/TypeDeleteWarningDialog/TypeDeleteWarningDialog.tsx +++ b/src/components/TypeDeleteWarningDialog/TypeDeleteWarningDialog.tsx @@ -9,7 +9,7 @@ import { useTypeDeleteWarningDialogStyles as useStyles } from "./styles"; import ProductTypeDeleteWarningDialogContent from "./TypeDeleteWarningDialogContent"; import { CommonTypeDeleteWarningMessages, - TypeDeleteWarningMessages + TypeDeleteWarningMessages, } from "./types"; export interface TypeBaseData { @@ -54,7 +54,7 @@ function TypeDeleteWarningDialog({ viewAssignedItemsUrl, typesToDelete, typesData, - showViewAssignedItemsButton = true + showViewAssignedItemsButton = true, }: TypeDeleteWarningDialogProps) { const intl = useIntl(); const classes = useStyles({}); @@ -70,7 +70,7 @@ function TypeDeleteWarningDialog({ : multipleWithoutItemsMessages; return { - ...multipleMessages + ...multipleMessages, }; } @@ -79,7 +79,7 @@ function TypeDeleteWarningDialog({ : singleWithoutItemsMessages; return { - ...singleMessages + ...singleMessages, }; }; @@ -96,7 +96,7 @@ function TypeDeleteWarningDialog({ { const classes = useStyles({}); const intl = useIntl(); @@ -53,7 +53,7 @@ const TypeDeleteWarningDialogContent: React.FC {chunks} + b: (...chunks) => {chunks}, })} consentLabel={consentLabel && intl.formatMessage(consentLabel)} isConsentChecked={isConsentChecked} diff --git a/src/components/TypeDeleteWarningDialog/styles.ts b/src/components/TypeDeleteWarningDialog/styles.ts index 87bffe23b..ea40ac068 100644 --- a/src/components/TypeDeleteWarningDialog/styles.ts +++ b/src/components/TypeDeleteWarningDialog/styles.ts @@ -6,18 +6,18 @@ export const useTypeDeleteWarningDialogStyles = makeStyles( display: "flex", alignItems: "center", justifyContent: "center", - height: "100%" + height: "100%", }, content: { - width: 600 + width: 600, }, consentLabel: { - color: theme.palette.primary.main + color: theme.palette.primary.main, }, buttonsSection: { display: "flex", - justifyContent: "flex-end" - } + justifyContent: "flex-end", + }, }), - { name: "ProductTypeDeleteWarningDialog" } + { name: "ProductTypeDeleteWarningDialog" }, ); diff --git a/src/components/UserChip/UserChip.tsx b/src/components/UserChip/UserChip.tsx index 6a79c3e95..024c50f35 100644 --- a/src/components/UserChip/UserChip.tsx +++ b/src/components/UserChip/UserChip.tsx @@ -11,13 +11,13 @@ const useStyles = makeStyles( () => ({ switch: { "&&:hover": { - background: "transparent" - } - } + background: "transparent", + }, + }, }), { - name: "UserChip" - } + name: "UserChip", + }, ); export interface UserChipProps { @@ -31,7 +31,7 @@ const UserChip: React.FC = ({ isDarkThemeEnabled, user, onLogout, - onThemeToggle + onThemeToggle, }) => { const classes = useStyles({}); const intl = useIntl(); @@ -67,7 +67,7 @@ const UserChip: React.FC = ({ control={ = ({ label={intl.formatMessage({ id: "2r4cTE", defaultMessage: "Enable Dark Mode", - description: "button" + description: "button", })} onChange={onThemeToggle} /> diff --git a/src/components/VersionInfo/VersionInfo.tsx b/src/components/VersionInfo/VersionInfo.tsx index de540ea13..a8beb4616 100644 --- a/src/components/VersionInfo/VersionInfo.tsx +++ b/src/components/VersionInfo/VersionInfo.tsx @@ -9,7 +9,7 @@ interface VersionInfoProps { const VersionInfo: React.FC = ({ dashboardVersion, - coreVersion + coreVersion, }) => { const classes = useStyles({}); diff --git a/src/components/VersionInfo/styles.ts b/src/components/VersionInfo/styles.ts index 086b550d6..e822c762f 100644 --- a/src/components/VersionInfo/styles.ts +++ b/src/components/VersionInfo/styles.ts @@ -4,23 +4,23 @@ export const useStyles = makeStyles( theme => ({ container: { display: "flex", - justifyContent: "flex-end" + justifyContent: "flex-end", }, versionItem: { [theme.breakpoints.down("md")]: { - fontSize: theme.spacing(1.75) + fontSize: theme.spacing(1.75), }, [theme.breakpoints.up("md")]: { - fontSize: theme.spacing(2) + fontSize: theme.spacing(2), }, color: theme.palette.saleor.main[3], lineHeight: theme.spacing(3.2), fontSize: theme.spacing(2), marginLeft: theme.spacing(1.5), - letterSpacing: "0.02em" - } + letterSpacing: "0.02em", + }, }), { - name: "VersionInfo" - } + name: "VersionInfo", + }, ); diff --git a/src/components/VisibilityCard/DateVisibilitySelector.tsx b/src/components/VisibilityCard/DateVisibilitySelector.tsx index 97dd11ccf..cc9d58484 100644 --- a/src/components/VisibilityCard/DateVisibilitySelector.tsx +++ b/src/components/VisibilityCard/DateVisibilitySelector.tsx @@ -15,20 +15,20 @@ const useStyles = makeStyles( fontSize: 14, margin: theme.spacing(1, 0), paddingBottom: 10, - paddingTop: 0 + paddingTop: 0, }, container: { alignItems: "baseline", display: "flex", flexDirection: "row", - justifyContent: "space-between" + justifyContent: "space-between", }, icon: { cursor: "pointer", - marginLeft: theme.spacing(2) - } + marginLeft: theme.spacing(2), + }, }), - { name: "DateVisibilitySelector" } + { name: "DateVisibilitySelector" }, ); interface Props { @@ -40,7 +40,7 @@ interface Props { const DateVisibilitySelector = ({ buttonText, children, - onInputClose + onInputClose, }: Props) => { const classes = useStyles({}); diff --git a/src/components/VisibilityCard/VisibilityCard.tsx b/src/components/VisibilityCard/VisibilityCard.tsx index 80821c30c..e8ba96728 100644 --- a/src/components/VisibilityCard/VisibilityCard.tsx +++ b/src/components/VisibilityCard/VisibilityCard.tsx @@ -20,40 +20,40 @@ const useStyles = makeStyles( theme => ({ checkbox: { alignItems: "flex-start", - marginTop: 10 + marginTop: 10, }, children: { "& button": { - margin: "0 9px" + margin: "0 9px", }, "& label": { - marginTop: theme.spacing(2.5) - } + marginTop: theme.spacing(2.5), + }, }, date: { "& svg": { - fill: theme.palette.primary.main + fill: theme.palette.primary.main, }, - marginTop: theme.spacing(1) + marginTop: theme.spacing(1), }, label: { lineHeight: 1.2, marginBottom: 5, - marginTop: 0 + marginTop: 0, }, listingLabel: { - marginTop: 9 + marginTop: 9, }, secondLabel: { color: theme.palette.text.hint, fontSize: 12, - marginBottom: theme.spacing(2) + marginBottom: theme.spacing(2), }, switchField: { - marginTop: theme.spacing(1) - } + marginTop: theme.spacing(1), + }, }), - { name: "VisibilityCard" } + { name: "VisibilityCard" }, ); interface Message { @@ -93,12 +93,12 @@ export const VisibilityCard: React.FC = props => { isAvailableForPurchase: isAvailable, isPublished, publicationDate, - visibleInListings + visibleInListings, }, errors, disabled, messages, - onChange + onChange, } = props; const classes = useStyles(props); const intl = useIntl(); @@ -112,23 +112,23 @@ export const VisibilityCard: React.FC = props => { { id: "UjsI4o", defaultMessage: "since {date}", - description: "date" + description: "date", }, { - date: localizeDate(date, "L") - } + date: localizeDate(date, "L"), + }, ); const handleRadioFieldChange = (type: keyof DateFields) => ( - e: ChangeEvent + e: ChangeEvent, ) => { const { value } = e.target; if (!value) { onChange({ target: { name: type, - value: null - } + value: null, + }, }); } return onChange(e); @@ -140,7 +140,7 @@ export const VisibilityCard: React.FC = props => { title={intl.formatMessage({ id: "akXDST", defaultMessage: "Visibility", - description: "section header" + description: "section header", })} /> @@ -180,7 +180,7 @@ export const VisibilityCard: React.FC = props => { onChange({ target: { name: "publicationDate", value: null } }) @@ -192,7 +192,7 @@ export const VisibilityCard: React.FC = props => { label={intl.formatMessage({ id: "Jt3DwJ", defaultMessage: "Publish on", - description: "publish on date" + description: "publish on date", })} name="publicationDate" type="date" @@ -202,7 +202,7 @@ export const VisibilityCard: React.FC = props => { onChange={onChange} className={classes.date} InputLabelProps={{ - shrink: true + shrink: true, }} /> @@ -253,7 +253,7 @@ export const VisibilityCard: React.FC = props => { buttonText={messages.setAvailabilityDateLabel} onInputClose={() => onChange({ - target: { name: "availableForPurchase", value: null } + target: { name: "availableForPurchase", value: null }, }) } > @@ -263,7 +263,7 @@ export const VisibilityCard: React.FC = props => { label={intl.formatMessage({ id: "Y7Vy19", defaultMessage: "Set available on", - description: "available on date" + description: "available on date", })} name="availableForPurchase" type="date" @@ -273,7 +273,7 @@ export const VisibilityCard: React.FC = props => { onChange={onChange} className={classes.date} InputLabelProps={{ - shrink: true + shrink: true, }} /> @@ -303,7 +303,7 @@ export const VisibilityCard: React.FC = props => { > {intl.formatMessage({ id: "0cVk9I", - defaultMessage: "Show in product listings" + defaultMessage: "Show in product listings", })}

@@ -311,7 +311,7 @@ export const VisibilityCard: React.FC = props => { {intl.formatMessage({ id: "5ukAFZ", defaultMessage: - "Disabling this checkbox will remove product from search and category pages. It will be available on collection pages." + "Disabling this checkbox will remove product from search and category pages. It will be available on collection pages.", })} diff --git a/src/components/WeightRange/WeightRange.tsx b/src/components/WeightRange/WeightRange.tsx index 27b8ac96c..6bc30b6be 100644 --- a/src/components/WeightRange/WeightRange.tsx +++ b/src/components/WeightRange/WeightRange.tsx @@ -18,7 +18,7 @@ const WeightRange: React.FC = ({ from, to }) => fromUnit: from.unit, fromValue: from.value, toUnit: to.unit, - toValue: to.value + toValue: to.value, }} /> ) : from && !to ? ( diff --git a/src/components/messages/MessageManagerProvider.tsx b/src/components/messages/MessageManagerProvider.tsx index 6ff992cee..6b93c8272 100644 --- a/src/components/messages/MessageManagerProvider.tsx +++ b/src/components/messages/MessageManagerProvider.tsx @@ -29,21 +29,21 @@ const MessageManagerProvider = ({ children }) => { const timerCallback = (notification: INotification) => { remove(notification.id); timersArr.current = timersArr.current.filter( - timer => timer.id !== notification.id + timer => timer.id !== notification.id, ); }; const remove = useCallback(notificationId => { setNotifications(currentNotifications => - currentNotifications.filter(n => n.id !== notificationId) + currentNotifications.filter(n => n.id !== notificationId), ); }, []); const clearErrorNotifications = useCallback(() => { setNotifications(notifications => notifications.filter( - notification => notification.message.status !== "error" - ) + notification => notification.message.status !== "error", + ), ); }, []); @@ -55,7 +55,7 @@ const MessageManagerProvider = ({ children }) => { close: () => remove(id), id, message, - timeout + timeout, }; if (timeout !== null) { const timeoutId = window.setTimeout(() => { @@ -67,7 +67,7 @@ const MessageManagerProvider = ({ children }) => { notification, remaining: timeout, start: new Date().getTime(), - timeoutId + timeoutId, }); } @@ -75,12 +75,12 @@ const MessageManagerProvider = ({ children }) => { return notification; }, - [] + [], ); const getCurrentTimer = (notification: INotification) => { const currentTimerIndex = timersArr.current.findIndex( - timer => timer.id === notification.id + timer => timer.id === notification.id, ); return timersArr.current[currentTimerIndex]; }; @@ -99,7 +99,7 @@ const MessageManagerProvider = ({ children }) => { currentTimer.start = new Date().getTime(); currentTimer.timeoutId = window.setTimeout( () => timerCallback(notification), - currentTimer.remaining + currentTimer.remaining, ); } }; @@ -123,7 +123,7 @@ const MessageManagerProvider = ({ children }) => { {...(!!notification.timeout ? { onMouseEnter: () => pauseTimer(notification), - onMouseLeave: () => resumeTimer(notification) + onMouseLeave: () => resumeTimer(notification), } : {})} onClose={notification.close} @@ -140,26 +140,26 @@ const MessageManagerProvider = ({ children }) => {
                         {notification.message.apiMessage}
                       
), hideApiLabel: intl.formatMessage( - notificationMessages.hideError + notificationMessages.hideError, ), showApiLabel: intl.formatMessage( - notificationMessages.seeError - ) + notificationMessages.seeError, + ), } } {...(!!notification.message.actionBtn ? { action: { label: notification.message.actionBtn.label, - onClick: notification.message.actionBtn.action - } + onClick: notification.message.actionBtn.action, + }, } : {})} className={classes.notification} diff --git a/src/components/messages/Transition.tsx b/src/components/messages/Transition.tsx index e14c12483..10ebc963b 100644 --- a/src/components/messages/Transition.tsx +++ b/src/components/messages/Transition.tsx @@ -5,12 +5,12 @@ const duration = 250; const defaultStyle = { opacity: 0, - transition: `opacity ${duration}ms ease` + transition: `opacity ${duration}ms ease`, }; const transitionStyles = { entered: { opacity: 1 }, - entering: { opacity: 0 } + entering: { opacity: 0 }, }; const Transition = ({ children, ...props }) => ( @@ -19,7 +19,7 @@ const Transition = ({ children, ...props }) => (
{children} diff --git a/src/components/messages/index.ts b/src/components/messages/index.ts index e6dded9d9..891b15ef2 100644 --- a/src/components/messages/index.ts +++ b/src/components/messages/index.ts @@ -34,7 +34,7 @@ export const types = { ERROR: "error", INFO: "info", SUCCESS: "success", - WARNING: "warning" + WARNING: "warning", }; export interface INotificationContext { show: (message: IMessage, timeout?: number | null) => void; diff --git a/src/components/messages/messages.ts b/src/components/messages/messages.ts index f497cce14..4928db958 100644 --- a/src/components/messages/messages.ts +++ b/src/components/messages/messages.ts @@ -4,11 +4,11 @@ export const messages = defineMessages({ seeError: { id: "w9xgN9", defaultMessage: "See error log", - description: "see error log label in notification" + description: "see error log label in notification", }, hideError: { id: "s8FlDW", defaultMessage: "Hide log", - description: "hide error log label in notification" - } + description: "hide error log label in notification", + }, }); diff --git a/src/components/messages/styles.ts b/src/components/messages/styles.ts index 0fccd3774..07658bda2 100644 --- a/src/components/messages/styles.ts +++ b/src/components/messages/styles.ts @@ -12,14 +12,14 @@ export const useStyles = makeStyles( width: "auto", maxHeight: "100vh", overflowY: "auto", - zIndex: 10000 + zIndex: 10000, }, notification: { // Parent container has disabled pointer events so we need to turn them on // for action and timer pausing to work pointerEvents: "all", - margin: theme.spacing(2) - } + margin: theme.spacing(2), + }, }), - { name: "MessageManager" } + { name: "MessageManager" }, ); diff --git a/src/config.ts b/src/config.ts index 9b0de7d8c..82f61f663 100644 --- a/src/config.ts +++ b/src/config.ts @@ -13,12 +13,12 @@ export const MARKETPLACE_URL = process.env.MARKETPLACE_URL; export const DEFAULT_INITIAL_SEARCH_DATA: SearchVariables = { after: null, first: 20, - query: "" + query: "", }; export const DEFAULT_INITIAL_PAGINATION_DATA: Pagination = { after: undefined, - before: undefined + before: undefined, }; export const PAGINATE_BY = 20; @@ -55,66 +55,66 @@ export interface AppListViewSettings { export const defaultListSettings: AppListViewSettings = { [ListViews.APPS_LIST]: { - rowNumber: 100 + rowNumber: 100, }, [ListViews.ATTRIBUTE_VALUE_LIST]: { - rowNumber: 10 + rowNumber: 10, }, [ListViews.CATEGORY_LIST]: { - rowNumber: PAGINATE_BY + rowNumber: PAGINATE_BY, }, [ListViews.COLLECTION_LIST]: { - rowNumber: PAGINATE_BY + rowNumber: PAGINATE_BY, }, [ListViews.CUSTOMER_LIST]: { - rowNumber: PAGINATE_BY + rowNumber: PAGINATE_BY, }, [ListViews.DRAFT_LIST]: { - rowNumber: PAGINATE_BY + rowNumber: PAGINATE_BY, }, [ListViews.NAVIGATION_LIST]: { - rowNumber: PAGINATE_BY + rowNumber: PAGINATE_BY, }, [ListViews.ORDER_LIST]: { - rowNumber: PAGINATE_BY + rowNumber: PAGINATE_BY, }, [ListViews.PAGES_LIST]: { - rowNumber: PAGINATE_BY + rowNumber: PAGINATE_BY, }, [ListViews.PLUGINS_LIST]: { - rowNumber: PAGINATE_BY + rowNumber: PAGINATE_BY, }, [ListViews.PRODUCT_LIST]: { columns: ["availability", "price", "productType", "date"], - rowNumber: PAGINATE_BY + rowNumber: PAGINATE_BY, }, [ListViews.SALES_LIST]: { - rowNumber: PAGINATE_BY + rowNumber: PAGINATE_BY, }, [ListViews.SHIPPING_METHODS_LIST]: { - rowNumber: PAGINATE_BY + rowNumber: PAGINATE_BY, }, [ListViews.STAFF_MEMBERS_LIST]: { - rowNumber: PAGINATE_BY + rowNumber: PAGINATE_BY, }, [ListViews.PERMISSION_GROUP_LIST]: { - rowNumber: PAGINATE_BY + rowNumber: PAGINATE_BY, }, [ListViews.VOUCHER_LIST]: { - rowNumber: PAGINATE_BY + rowNumber: PAGINATE_BY, }, [ListViews.WAREHOUSE_LIST]: { - rowNumber: PAGINATE_BY + rowNumber: PAGINATE_BY, }, [ListViews.WEBHOOK_LIST]: { - rowNumber: PAGINATE_BY + rowNumber: PAGINATE_BY, }, [ListViews.TRANSLATION_ATTRIBUTE_VALUE_LIST]: { - rowNumber: 10 + rowNumber: 10, }, [ListViews.GIFT_CARD_LIST]: { - rowNumber: PAGINATE_BY - } + rowNumber: PAGINATE_BY, + }, }; export const APP_VERSION = packageInfo.version; diff --git a/src/configuration/ConfigurationPage.tsx b/src/configuration/ConfigurationPage.tsx index f7ec36c95..d68cfcbf7 100644 --- a/src/configuration/ConfigurationPage.tsx +++ b/src/configuration/ConfigurationPage.tsx @@ -37,45 +37,45 @@ const useStyles = makeStyles( theme => ({ configurationCategory: { [theme.breakpoints.down("md")]: { - gridTemplateColumns: "1fr" + gridTemplateColumns: "1fr", }, borderTop: `solid 1px ${theme.palette.divider}`, display: "grid", gap: theme.spacing(4), gridTemplateColumns: "1fr 3fr", - padding: theme.spacing(4, 0) + padding: theme.spacing(4, 0), }, configurationItem: { [theme.breakpoints.down("md")]: { - gridTemplateColumns: "1fr" + gridTemplateColumns: "1fr", }, display: "grid", gap: theme.spacing(4), - gridTemplateColumns: "1fr 1fr" + gridTemplateColumns: "1fr 1fr", }, configurationLabel: { - paddingBottom: 20 + paddingBottom: 20, }, header: { - margin: 0 + margin: 0, }, link: { display: "contents", - marginBottom: theme.spacing(4) + marginBottom: theme.spacing(4), }, icon: { "& path": { - fill: theme.palette.primary.main + fill: theme.palette.primary.main, }, - fontSize: 48 + fontSize: 48, }, sectionDescription: {}, sectionTitle: { fontSize: 20, - fontWeight: 600 as 600 - } + fontWeight: 600 as 600, + }, }), - { name: "ConfigurationPage" } + { name: "ConfigurationPage" }, ); export interface ConfigurationPageProps { @@ -88,7 +88,7 @@ export const ConfigurationPage: React.FC = props => { const { menu: menus, user, - versionInfo: { dashboardVersion, coreVersion } + versionInfo: { dashboardVersion, coreVersion }, } = props; const classes = useStyles(props); const theme = useTheme(); @@ -115,8 +115,8 @@ export const ConfigurationPage: React.FC = props => { {menus .filter(menu => menu.menuItems.some(menuItem => - hasAnyPermissions(menuItem.permissions, user) - ) + hasAnyPermissions(menuItem.permissions, user), + ), ) .map((menu, menuIndex) => (
@@ -126,7 +126,7 @@ export const ConfigurationPage: React.FC = props => {
{menu.menuItems .filter(menuItem => - hasAnyPermissions(menuItem.permissions, user) + hasAnyPermissions(menuItem.permissions, user), ) .map((item, itemIndex) => ( diff --git a/src/configuration/index.tsx b/src/configuration/index.tsx index f353f288f..674306485 100644 --- a/src/configuration/index.tsx +++ b/src/configuration/index.tsx @@ -39,189 +39,189 @@ export function createConfigurationMenu(intl: IntlShape): MenuSection[] { { label: intl.formatMessage({ id: "HP6m+q", - defaultMessage: "Attributes and Product Types" + defaultMessage: "Attributes and Product Types", }), menuItems: [ { description: intl.formatMessage({ id: "19/lwV", - defaultMessage: "Determine attributes used to create product types" + defaultMessage: "Determine attributes used to create product types", }), icon: , permissions: [ PermissionEnum.MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES, - PermissionEnum.MANAGE_PAGE_TYPES_AND_ATTRIBUTES + PermissionEnum.MANAGE_PAGE_TYPES_AND_ATTRIBUTES, ], title: intl.formatMessage(sectionNames.attributes), url: attributeListUrl(), - testId: "configuration-menu-attributes" + testId: "configuration-menu-attributes", }, { description: intl.formatMessage({ id: "n0RwMK", - defaultMessage: "Define types of products you sell" + defaultMessage: "Define types of products you sell", }), icon: , permissions: [PermissionEnum.MANAGE_PRODUCT_TYPES_AND_ATTRIBUTES], title: intl.formatMessage(sectionNames.productTypes), url: productTypeListUrl(), - testId: "configuration-menu-product-types" - } - ] + testId: "configuration-menu-product-types", + }, + ], }, { label: intl.formatMessage({ id: "jFrdB5", - defaultMessage: "Product Settings" + defaultMessage: "Product Settings", }), menuItems: [ { description: intl.formatMessage({ id: "EIULpW", - defaultMessage: "Manage how your store charges tax" + defaultMessage: "Manage how your store charges tax", }), icon: , permissions: [PermissionEnum.MANAGE_SETTINGS], title: intl.formatMessage(sectionNames.taxes), url: taxSection, - testId: "configuration-menu-taxes" - } - ] + testId: "configuration-menu-taxes", + }, + ], }, { label: intl.formatMessage({ id: "UN+yTt", - defaultMessage: "Staff Settings" + defaultMessage: "Staff Settings", }), menuItems: [ { description: intl.formatMessage({ id: "RQUkVW", - defaultMessage: "Manage your employees and their permissions" + defaultMessage: "Manage your employees and their permissions", }), icon: , permissions: [PermissionEnum.MANAGE_STAFF], title: intl.formatMessage(sectionNames.staff), url: staffListUrl(), - testId: "configuration-menu-staff" + testId: "configuration-menu-staff", }, { description: intl.formatMessage({ id: "ivJ1qt", defaultMessage: - "Manage your permission groups and their permissions" + "Manage your permission groups and their permissions", }), icon: , permissions: [PermissionEnum.MANAGE_STAFF], title: intl.formatMessage(sectionNames.permissionGroups), url: permissionGroupListUrl(), - testId: "configuration-menu-permission-groups" - } - ] + testId: "configuration-menu-permission-groups", + }, + ], }, { label: intl.formatMessage({ id: "gTr0qE", - defaultMessage: "Shipping Settings" + defaultMessage: "Shipping Settings", }), menuItems: [ { description: intl.formatMessage({ id: "zxs6G3", - defaultMessage: "Manage how you ship out orders" + defaultMessage: "Manage how you ship out orders", }), icon: , permissions: [PermissionEnum.MANAGE_SHIPPING], title: intl.formatMessage(sectionNames.shipping), url: shippingZonesListUrl(), - testId: "configurationMenuShipping" + testId: "configurationMenuShipping", }, { description: intl.formatMessage({ id: "5RmuD+", - defaultMessage: "Manage and update your warehouse information" + defaultMessage: "Manage and update your warehouse information", }), icon: , permissions: [PermissionEnum.MANAGE_PRODUCTS], title: intl.formatMessage(sectionNames.warehouses), url: warehouseSection, - testId: "configuration-menu-warehouses" - } - ] + testId: "configuration-menu-warehouses", + }, + ], }, { label: intl.formatMessage({ id: "MWSacl", - defaultMessage: "Multichannel" + defaultMessage: "Multichannel", }), menuItems: [ { description: intl.formatMessage({ id: "8vJCJ4", - defaultMessage: "Define and manage your sales channels" + defaultMessage: "Define and manage your sales channels", }), icon: , permissions: [PermissionEnum.MANAGE_CHANNELS], title: intl.formatMessage(sectionNames.channels), url: channelsListUrl(), - testId: "configuration-menu-channels" - } - ] + testId: "configuration-menu-channels", + }, + ], }, { label: intl.formatMessage({ id: "HjXnIf", - defaultMessage: "Content Management" + defaultMessage: "Content Management", }), menuItems: [ { description: intl.formatMessage({ id: "JPH/uP", - defaultMessage: "Define types of content pages used in your store" + defaultMessage: "Define types of content pages used in your store", }), icon: , permissions: [ PermissionEnum.MANAGE_PAGES, - PermissionEnum.MANAGE_PAGE_TYPES_AND_ATTRIBUTES + PermissionEnum.MANAGE_PAGE_TYPES_AND_ATTRIBUTES, ], title: intl.formatMessage(sectionNames.pageTypes), url: pageTypeListUrl(), - testId: "configuration-menu-page-types" - } - ] + testId: "configuration-menu-page-types", + }, + ], }, { label: intl.formatMessage({ id: "YZl6cv", - defaultMessage: "Miscellaneous" + defaultMessage: "Miscellaneous", }), menuItems: [ { description: intl.formatMessage({ id: "hpMcW8", - defaultMessage: "Define how users can navigate through your store" + defaultMessage: "Define how users can navigate through your store", }), icon: , permissions: [PermissionEnum.MANAGE_MENUS], title: intl.formatMessage(sectionNames.navigation), url: menuListUrl(), - testId: "configuration-menu-navigation" + testId: "configuration-menu-navigation", }, { description: intl.formatMessage({ id: "5BajZK", - defaultMessage: "View and update your site settings" + defaultMessage: "View and update your site settings", }), icon: , permissions: [PermissionEnum.MANAGE_SETTINGS], title: intl.formatMessage(sectionNames.siteSettings), url: siteSettingsUrl(), - testId: "configuration-menu-site-settings" + testId: "configuration-menu-site-settings", }, { description: intl.formatMessage({ id: "m19JfL", - defaultMessage: "View and update your plugins and their settings." + defaultMessage: "View and update your plugins and their settings.", }), icon: ( { const versions = { dashboardVersion, - coreVersion: shop?.version ?? "" + coreVersion: shop?.version ?? "", }; const user = useUser(); diff --git a/src/configuration/utils.ts b/src/configuration/utils.ts index 4b0d45f20..b1071ab99 100644 --- a/src/configuration/utils.ts +++ b/src/configuration/utils.ts @@ -4,14 +4,14 @@ import { IntlShape } from "react-intl"; import { createConfigurationMenu } from "."; export const getConfigMenuItemsPermissions = ( - intl: IntlShape + intl: IntlShape, ): PermissionEnum[] => createConfigurationMenu(intl) .reduce( (prev, { menuItems }) => [ ...prev, - ...menuItems.map(({ permissions }) => permissions) + ...menuItems.map(({ permissions }) => permissions), ], - [] + [], ) .flat(); diff --git a/src/containers/AppState/AppState.tsx b/src/containers/AppState/AppState.tsx index a8d3238e8..b6ffb1644 100644 --- a/src/containers/AppState/AppState.tsx +++ b/src/containers/AppState/AppState.tsx @@ -6,11 +6,11 @@ import IAppState, { initialAppState } from "./state"; export type AppStateContextType = [ IAppState, - React.Dispatch + React.Dispatch, ]; export const AppStateContext = React.createContext([ initialAppState, - () => undefined + () => undefined, ]); const AppStateProvider: React.FC = ({ children }) => { const { location } = useRouter(); @@ -21,9 +21,9 @@ const AppStateProvider: React.FC = ({ children }) => { if (!!state.error) { dispatch({ payload: { - error: undefined + error: undefined, }, - type: "displayError" + type: "displayError", }); } }, [location]); diff --git a/src/containers/AppState/reducer.ts b/src/containers/AppState/reducer.ts index a6b90948b..b46bbac42 100644 --- a/src/containers/AppState/reducer.ts +++ b/src/containers/AppState/reducer.ts @@ -14,35 +14,35 @@ export interface AppStateReducerAction { function displayError( prevState: IAppState, errorType: AppError["type"], - errorId?: AppError["id"] + errorId?: AppError["id"], ): IAppState { return { ...prevState, error: { id: errorId, - type: errorType + type: errorType, }, - loading: false + loading: false, }; } function displayLoader(prevState: IAppState, value: boolean): IAppState { return { ...prevState, - loading: value + loading: value, }; } function reduceAppState( prevState: IAppState, - action: AppStateReducerAction + action: AppStateReducerAction, ): IAppState { switch (action.type) { case "displayError": return displayError( prevState, action.payload.error, - action.payload.errorId + action.payload.errorId, ); case "displayLoader": return displayLoader(prevState, action.payload.value); diff --git a/src/containers/AppState/state.ts b/src/containers/AppState/state.ts index 0214bac0a..29e4eeaf5 100644 --- a/src/containers/AppState/state.ts +++ b/src/containers/AppState/state.ts @@ -10,7 +10,7 @@ interface IAppState { export const initialAppState: IAppState = { error: null, - loading: false + loading: false, }; export default IAppState; diff --git a/src/containers/BackgroundTasks/BackgroundTasksProvider.test.tsx b/src/containers/BackgroundTasks/BackgroundTasksProvider.test.tsx index 9b2b47421..0cef5417c 100644 --- a/src/containers/BackgroundTasks/BackgroundTasksProvider.test.tsx +++ b/src/containers/BackgroundTasks/BackgroundTasksProvider.test.tsx @@ -4,7 +4,7 @@ import { renderHook } from "@testing-library/react-hooks"; import { backgroundTasksRefreshTime, - useBackgroundTasks + useBackgroundTasks, } from "./BackgroundTasksProvider"; import { checkExportFileStatus } from "./queries"; import { Task, TaskData, TaskStatus } from "./types"; @@ -16,35 +16,35 @@ function renderBackgroundTasks() { [ { request: { - query: checkExportFileStatus + query: checkExportFileStatus, }, result: { data: { exportFile: { __typename: "ExportFile", id: "123", - status: JobStatusEnum.SUCCESS - } - } - } - } + status: JobStatusEnum.SUCCESS, + }, + }, + }, + }, ], - checkExportFileStatus + checkExportFileStatus, ); const intl = { - formatMessage: ({ defaultMessage }) => defaultMessage + formatMessage: ({ defaultMessage }) => defaultMessage, }; return renderHook(() => - useBackgroundTasks(mockClient, jest.fn(), intl as any) + useBackgroundTasks(mockClient, jest.fn(), intl as any), ); } describe("Background task provider", () => { it("can queue a task", done => { const handle = jest.fn, []>( - () => new Promise(resolve => resolve(TaskStatus.SUCCESS)) + () => new Promise(resolve => resolve(TaskStatus.SUCCESS)), ); const onCompleted = jest.fn(); const onError = jest.fn(); @@ -54,7 +54,7 @@ describe("Background task provider", () => { const taskId = result.current.queue(Task.CUSTOM, { handle, onCompleted, - onError + onError, }); expect(taskId).toBe(1); expect(handle).toHaveBeenCalledTimes(0); @@ -77,7 +77,7 @@ describe("Background task provider", () => { () => new Promise(() => { throw new Error("dummy error"); - }) + }), ); const onCompleted = jest.fn(); const onError = jest.fn(); @@ -87,7 +87,7 @@ describe("Background task provider", () => { result.current.queue(Task.CUSTOM, { handle, onCompleted, - onError + onError, }); jest.runOnlyPendingTimers(); @@ -108,7 +108,7 @@ describe("Background task provider", () => { const taskId = result.current.queue(Task.CUSTOM, { handle: () => new Promise(resolve => resolve(TaskStatus.SUCCESS)), - onCompleted + onCompleted, }); // Cancel task before executing it @@ -130,17 +130,17 @@ describe("Background task provider", () => { // Completed in two cycles const shortTask = { handle: jest.fn(() => - Promise.resolve(cycle > 1 ? TaskStatus.SUCCESS : TaskStatus.PENDING) + Promise.resolve(cycle > 1 ? TaskStatus.SUCCESS : TaskStatus.PENDING), ), - onCompleted: jest.fn() + onCompleted: jest.fn(), }; // Completed in three cycles const longTask = { handle: jest.fn(() => - Promise.resolve(cycle > 2 ? TaskStatus.SUCCESS : TaskStatus.PENDING) + Promise.resolve(cycle > 2 ? TaskStatus.SUCCESS : TaskStatus.PENDING), ), - onCompleted: jest.fn() + onCompleted: jest.fn(), }; const tasks: TaskData[] = [shortTask, longTask]; diff --git a/src/containers/BackgroundTasks/BackgroundTasksProvider.tsx b/src/containers/BackgroundTasks/BackgroundTasksProvider.tsx index 43ba5dc01..caf2be8c9 100644 --- a/src/containers/BackgroundTasks/BackgroundTasksProvider.tsx +++ b/src/containers/BackgroundTasks/BackgroundTasksProvider.tsx @@ -10,7 +10,7 @@ import { handleTask, queueCustom, queueExport, - queueInvoiceGenerate + queueInvoiceGenerate, } from "./tasks"; import { QueuedTask, Task, TaskData, TaskStatus } from "./types"; @@ -19,7 +19,7 @@ export const backgroundTasksRefreshTime = 15 * 1000; export function useBackgroundTasks( apolloClient: Pick, "query">, notify: IMessageContext, - intl: IntlShape + intl: IntlShape, ) { const idCounter = React.useRef(0); const tasks = React.useRef([]); @@ -40,12 +40,12 @@ export function useBackgroundTasks( } if (status !== TaskStatus.PENDING) { const taskIndex = tasks.current.findIndex( - t => t.id === task.id + t => t.id === task.id, ); tasks.current[taskIndex].status = status; } } - }) + }), ); } catch (error) { throw error; @@ -78,11 +78,11 @@ export function useBackgroundTasks( fetchPolicy: "network-only", query: checkOrderInvoicesStatus, variables: { - id: data.generateInvoice.orderId - } + id: data.generateInvoice.orderId, + }, }), notify, - intl + intl, ); break; case Task.EXPORT: @@ -94,11 +94,11 @@ export function useBackgroundTasks( fetchPolicy: "network-only", query: checkExportFileStatus, variables: { - id: data.id - } + id: data.id, + }, }), notify, - intl + intl, ); break; } @@ -108,7 +108,7 @@ export function useBackgroundTasks( return { cancel, - queue + queue, }; } @@ -122,7 +122,7 @@ const BackgroundTasksProvider: React.FC = ({ children }) => { {children} diff --git a/src/containers/BackgroundTasks/messages.ts b/src/containers/BackgroundTasks/messages.ts index b021dff97..3030fe431 100644 --- a/src/containers/BackgroundTasks/messages.ts +++ b/src/containers/BackgroundTasks/messages.ts @@ -3,31 +3,31 @@ import { defineMessages } from "react-intl"; export default defineMessages({ exportFailedTitle: { id: "yHeZRQ", - defaultMessage: "Product Export Failed" + defaultMessage: "Product Export Failed", }, exportFinishedText: { id: "CJEIRC", defaultMessage: - "Product export has finished and was sent to your email address." + "Product export has finished and was sent to your email address.", }, exportFinishedTitle: { id: "JTcz2G", defaultMessage: "Exporting CSV finished", - description: "csv file exporting has finished, header" + description: "csv file exporting has finished, header", }, invoiceGenerateFinishedText: { id: "ryAyPr", defaultMessage: - "Requested Invoice was generated. It was added to the top of the invoice list on this view. Enjoy!" + "Requested Invoice was generated. It was added to the top of the invoice list on this view. Enjoy!", }, invoiceGenerateFinishedTitle: { id: "i+Vox0", defaultMessage: "Invoice Generated", - description: "invoice generating has finished, header" + description: "invoice generating has finished, header", }, invoiceGenerationFailedTitle: { id: "Dhherd", defaultMessage: "Invoice Generation", - description: "dialog header, title" - } + description: "dialog header, title", + }, }); diff --git a/src/containers/BackgroundTasks/tasks.ts b/src/containers/BackgroundTasks/tasks.ts index baffabe4a..a8ba656dd 100644 --- a/src/containers/BackgroundTasks/tasks.ts +++ b/src/containers/BackgroundTasks/tasks.ts @@ -3,7 +3,7 @@ import { IMessageContext } from "@saleor/components/messages"; import { CheckExportFileStatusQuery, CheckOrderInvoicesStatusQuery, - JobStatusEnum + JobStatusEnum, } from "@saleor/graphql"; import { commonMessages } from "@saleor/intl"; import { IntlShape } from "react-intl"; @@ -13,7 +13,7 @@ import { InvoiceGenerateParams, QueuedTask, TaskData, - TaskStatus + TaskStatus, } from "./types"; function getTaskStatus(jobStatus: JobStatusEnum): TaskStatus { @@ -33,7 +33,7 @@ export async function handleTask(task: QueuedTask): Promise { status = await task.handle(); if (status !== TaskStatus.PENDING) { task.onCompleted({ - status + status, }); } } catch (error) { @@ -50,7 +50,7 @@ export function handleError(error: Error) { export function queueCustom( id: number, tasks: React.MutableRefObject, - data: TaskData + data: TaskData, ) { (["handle", "onCompleted"] as Array) .filter(field => !data[field]) @@ -64,8 +64,8 @@ export function queueCustom( id, onCompleted: data.onCompleted, onError: data.onError || handleError, - status: TaskStatus.PENDING - } + status: TaskStatus.PENDING, + }, ]; } @@ -75,7 +75,7 @@ export function queueInvoiceGenerate( tasks: React.MutableRefObject, fetch: () => Promise>, notify: IMessageContext, - intl: IntlShape + intl: IntlShape, ) { if (!generateInvoice) { throw new Error("generateInvoice is required when creating custom task"); @@ -86,7 +86,7 @@ export function queueInvoiceGenerate( handle: async () => { const result = await fetch(); const status = result.data.order.invoices.find( - invoice => invoice.id === generateInvoice.invoiceId + invoice => invoice.id === generateInvoice.invoiceId, ).status; return getTaskStatus(status); @@ -97,16 +97,16 @@ export function queueInvoiceGenerate( ? notify({ status: "success", text: intl.formatMessage(messages.invoiceGenerateFinishedText), - title: intl.formatMessage(messages.invoiceGenerateFinishedTitle) + title: intl.formatMessage(messages.invoiceGenerateFinishedTitle), }) : notify({ status: "error", text: intl.formatMessage(commonMessages.somethingWentWrong), - title: intl.formatMessage(messages.invoiceGenerationFailedTitle) + title: intl.formatMessage(messages.invoiceGenerationFailedTitle), }), onError: handleError, - status: TaskStatus.PENDING - } + status: TaskStatus.PENDING, + }, ]; } @@ -115,7 +115,7 @@ export function queueExport( tasks: React.MutableRefObject, fetch: () => Promise>, notify: IMessageContext, - intl: IntlShape + intl: IntlShape, ) { tasks.current = [ ...tasks.current, @@ -132,15 +132,15 @@ export function queueExport( ? notify({ status: "success", text: intl.formatMessage(messages.exportFinishedText), - title: intl.formatMessage(messages.exportFinishedTitle) + title: intl.formatMessage(messages.exportFinishedTitle), }) : notify({ status: "error", text: intl.formatMessage(commonMessages.somethingWentWrong), - title: intl.formatMessage(messages.exportFailedTitle) + title: intl.formatMessage(messages.exportFailedTitle), }), onError: handleError, - status: TaskStatus.PENDING - } + status: TaskStatus.PENDING, + }, ]; } diff --git a/src/containers/BackgroundTasks/types.ts b/src/containers/BackgroundTasks/types.ts index 269fd3791..bec347020 100644 --- a/src/containers/BackgroundTasks/types.ts +++ b/src/containers/BackgroundTasks/types.ts @@ -1,12 +1,12 @@ export enum Task { CUSTOM, EXPORT, - INVOICE_GENERATE + INVOICE_GENERATE, } export enum TaskStatus { FAILURE, PENDING, - SUCCESS + SUCCESS, } export interface InvoiceGenerateParams { orderId: string; diff --git a/src/containers/ServiceWorker/ServiceWorker.tsx b/src/containers/ServiceWorker/ServiceWorker.tsx index 76438367c..e1b9e78c1 100644 --- a/src/containers/ServiceWorker/ServiceWorker.tsx +++ b/src/containers/ServiceWorker/ServiceWorker.tsx @@ -18,10 +18,10 @@ const ServiceWorker: React.FC = () => { text: formatMessage(messages.newVersionContent), actionBtn: { label: formatMessage(messages.refresh), - action: update + action: update, }, autohide: null, - status: "warning" + status: "warning", }); } }, [updateAvailable]); diff --git a/src/containers/ServiceWorker/messages.ts b/src/containers/ServiceWorker/messages.ts index 2efb462c7..52a0998c9 100644 --- a/src/containers/ServiceWorker/messages.ts +++ b/src/containers/ServiceWorker/messages.ts @@ -4,19 +4,19 @@ const messages = defineMessages({ newVersionTitle: { id: "tEdFmZ", defaultMessage: "System update required", - description: "notification title" + description: "notification title", }, newVersionContent: { id: "8aV98y", defaultMessage: "You need to update Saleor to the newest version. Before doing so - save all changes to prevent loss of data. To update use the button below.", - description: "new version notification content" + description: "new version notification content", }, refresh: { id: "XCIV8H", defaultMessage: "Refresh", - description: "button" - } + description: "button", + }, }); export default messages; diff --git a/src/customers/components/CustomerAddress/CustomerAddress.tsx b/src/customers/components/CustomerAddress/CustomerAddress.tsx index 554793706..ed8067780 100644 --- a/src/customers/components/CustomerAddress/CustomerAddress.tsx +++ b/src/customers/components/CustomerAddress/CustomerAddress.tsx @@ -22,55 +22,55 @@ export interface CustomerAddressProps { const messages = defineMessages({ defaultAddress: { id: "hMRP6J", - defaultMessage: "Default Address" + defaultMessage: "Default Address", }, defaultBillingAddress: { id: "VyzsWZ", - defaultMessage: "Default Billing Address" + defaultMessage: "Default Billing Address", }, defaultShippingAddress: { id: "nLML8Y", - defaultMessage: "Default Shipping Address" + defaultMessage: "Default Shipping Address", }, deleteAddress: { id: "puikeb", defaultMessage: "Delete Address", - description: "button" + description: "button", }, editAddress: { id: "w+8BfK", defaultMessage: "Edit Address", - description: "button" + description: "button", }, setDefaultBilling: { id: "hLOEeb", defaultMessage: "Set as default billing address", - description: "button" + description: "button", }, setDefaultShipping: { id: "+7OsyM", defaultMessage: "Set as default shipping address", - description: "button" - } + description: "button", + }, }); const useStyles = makeStyles( { actions: { - flexDirection: "row" + flexDirection: "row", }, actionsContainer: { display: "flex", flexDirection: "column", height: "100%", - justifyContent: "flex-end" + justifyContent: "flex-end", }, card: { display: "flex", - flexDirection: "column" - } + flexDirection: "column", + }, }, - { name: "CustomerAddress" } + { name: "CustomerAddress" }, ); const CustomerAddress: React.FC = props => { const { @@ -80,7 +80,7 @@ const CustomerAddress: React.FC = props => { isDefaultShippingAddress, onEdit, onRemove, - onSetAsDefault + onSetAsDefault, } = props; const classes = useStyles(props); @@ -112,23 +112,23 @@ const CustomerAddress: React.FC = props => { { label: intl.formatMessage(messages.setDefaultShipping), onSelect: () => onSetAsDefault(AddressTypeEnum.SHIPPING), - testId: "set-default-shipping-address" + testId: "set-default-shipping-address", }, { label: intl.formatMessage(messages.setDefaultBilling), onSelect: () => onSetAsDefault(AddressTypeEnum.BILLING), - testId: "set-default-billing-address" + testId: "set-default-billing-address", }, { label: intl.formatMessage(messages.editAddress), onSelect: () => onEdit(), - testId: "edit-address" + testId: "edit-address", }, { label: intl.formatMessage(messages.deleteAddress), onSelect: () => onRemove(), - testId: "delete-address" - } + testId: "delete-address", + }, ]} /> } diff --git a/src/customers/components/CustomerAddressChoiceCard/CustomerAddressChoiceCard.tsx b/src/customers/components/CustomerAddressChoiceCard/CustomerAddressChoiceCard.tsx index f845b982b..90ea00615 100644 --- a/src/customers/components/CustomerAddressChoiceCard/CustomerAddressChoiceCard.tsx +++ b/src/customers/components/CustomerAddressChoiceCard/CustomerAddressChoiceCard.tsx @@ -27,7 +27,7 @@ const CustomerAddressChoiceCard: React.FC = prop diff --git a/src/customers/components/CustomerAddressChoiceCard/styles.ts b/src/customers/components/CustomerAddressChoiceCard/styles.ts index 846e5df64..0601738f1 100644 --- a/src/customers/components/CustomerAddressChoiceCard/styles.ts +++ b/src/customers/components/CustomerAddressChoiceCard/styles.ts @@ -6,37 +6,37 @@ export const useStyles = makeStyles( padding: "1px", borderColor: theme.palette.saleor.main[5], borderStyle: "solid", - borderWidth: "2px" + borderWidth: "2px", }, cardSelected: { borderColor: theme.palette.primary.main, - cursor: "pointer" + cursor: "pointer", }, cardContent: { display: "flex", flexDirection: "row", justifyContent: "space-between", - alignItems: "flex-start" + alignItems: "flex-start", }, selectableCard: { "&:hover": { cursor: "pointer", - borderColor: theme.palette.saleor.active[3] - } + borderColor: theme.palette.saleor.active[3], + }, }, selectedLabel: { fontSize: "1.4rem", lineHeight: "1.75", fontWeight: 600, - textTransform: "uppercase" + textTransform: "uppercase", }, editIcon: { color: theme.palette.grey[600], "&:hover": { color: theme.palette.primary.main, - cursor: "pointer" - } - } + cursor: "pointer", + }, + }, }), - { name: "CustomerAddressChoiceCard" } + { name: "CustomerAddressChoiceCard" }, ); diff --git a/src/customers/components/CustomerAddressDialog/CustomerAddressDialog.tsx b/src/customers/components/CustomerAddressDialog/CustomerAddressDialog.tsx index fc5ef865c..d7c7c63e8 100644 --- a/src/customers/components/CustomerAddressDialog/CustomerAddressDialog.tsx +++ b/src/customers/components/CustomerAddressDialog/CustomerAddressDialog.tsx @@ -2,7 +2,7 @@ import { Dialog, DialogActions, DialogContent, - DialogTitle + DialogTitle, } from "@material-ui/core"; import AddressEdit from "@saleor/components/AddressEdit"; import BackButton from "@saleor/components/BackButton"; @@ -12,7 +12,7 @@ import { AccountErrorFragment, AddressFragment, AddressInput, - CountryWithCodeFragment + CountryWithCodeFragment, } from "@saleor/graphql"; import useAddressValidation from "@saleor/hooks/useAddressValidation"; import useModalDialogErrors from "@saleor/hooks/useModalDialogErrors"; @@ -40,10 +40,10 @@ export interface CustomerAddressDialogProps { const useStyles = makeStyles( { overflow: { - overflowY: "visible" - } + overflowY: "visible", + }, }, - { name: "CustomerAddressDialog" } + { name: "CustomerAddressDialog" }, ); const CustomerAddressDialog: React.FC = ({ @@ -54,19 +54,19 @@ const CustomerAddressDialog: React.FC = ({ open, variant, onClose, - onConfirm + onConfirm, }) => { const classes = useStyles(); const [countryDisplayName, setCountryDisplayName] = useStateFromProps( - address?.country.country || "" + address?.country.country || "", ); const { errors: validationErrors, - submit: handleSubmit + submit: handleSubmit, } = useAddressValidation(onConfirm); const dialogErrors = useModalDialogErrors( [...errors, ...validationErrors], - open + open, ); const initialForm: AddressTypeInput = { @@ -80,7 +80,7 @@ const CustomerAddressDialog: React.FC = ({ phone: address?.phone || "", postalCode: address?.postalCode || "", streetAddress1: address?.streetAddress1 || "", - streetAddress2: address?.streetAddress2 || "" + streetAddress2: address?.streetAddress2 || "", }; const countryChoices = mapCountriesToChoices(countries || []); @@ -98,7 +98,7 @@ const CustomerAddressDialog: React.FC = ({ const handleCountrySelect = createSingleAutocompleteSelectHandler( change, setCountryDisplayName, - countryChoices + countryChoices, ); return ( diff --git a/src/customers/components/CustomerAddressListPage/CustomerAddressListPage.tsx b/src/customers/components/CustomerAddressListPage/CustomerAddressListPage.tsx index bbce215b6..7f00cec3e 100644 --- a/src/customers/components/CustomerAddressListPage/CustomerAddressListPage.tsx +++ b/src/customers/components/CustomerAddressListPage/CustomerAddressListPage.tsx @@ -25,61 +25,61 @@ const messages = defineMessages({ addAddress: { id: "rjy9/k", defaultMessage: "Add address", - description: "button" + description: "button", }, doesntHaveAddresses: { id: "kErneR", defaultMessage: - "This customer doesn’t have any adresses added to his address book. You can add address using the button below." + "This customer doesn’t have any adresses added to his address book. You can add address using the button below.", }, fullNameAddress: { id: "n5vskv", defaultMessage: "{fullName}'s Address Book", - description: "customer's address book, header" + description: "customer's address book, header", }, noNameToShow: { id: "CWqmRU", defaultMessage: "Address Book", description: - "customer's address book when no customer name is available, header" + "customer's address book when no customer name is available, header", }, fullNameDetail: { id: "MpR4zK", defaultMessage: "{fullName} Details", - description: "customer details, header" + description: "customer details, header", }, noAddressToShow: { id: "y/UWBR", - defaultMessage: "There is no address to show for this customer" - } + defaultMessage: "There is no address to show for this customer", + }, }); const useStyles = makeStyles( theme => ({ addButton: { - marginTop: theme.spacing(2) + marginTop: theme.spacing(2), }, description: { - marginTop: theme.spacing(1) + marginTop: theme.spacing(1), }, empty: { margin: `${theme.spacing(13)}px auto 0`, textAlign: "center", - width: 600 + width: 600, }, root: { display: "grid", gap: theme.spacing(3), gridTemplateColumns: "repeat(3, 1fr)", [theme.breakpoints.down("md")]: { - gridTemplateColumns: "repeat(2, 1fr)" + gridTemplateColumns: "repeat(2, 1fr)", }, [theme.breakpoints.down("sm")]: { - gridTemplateColumns: "repeat(1, 1fr)" - } - } + gridTemplateColumns: "repeat(1, 1fr)", + }, + }, }), - { name: "CustomerAddressListPage" } + { name: "CustomerAddressListPage" }, ); const CustomerAddressListPage: React.FC = props => { @@ -90,7 +90,7 @@ const CustomerAddressListPage: React.FC = props => const isEmpty = customer?.addresses?.length === 0; const fullName = getStringOrPlaceholder( - customer && [customer.firstName, customer.lastName].join(" ") + customer && [customer.firstName, customer.lastName].join(" "), ); return ( diff --git a/src/customers/components/CustomerAddresses/CustomerAddresses.tsx b/src/customers/components/CustomerAddresses/CustomerAddresses.tsx index 104ac8efd..ba595aac6 100644 --- a/src/customers/components/CustomerAddresses/CustomerAddresses.tsx +++ b/src/customers/components/CustomerAddresses/CustomerAddresses.tsx @@ -15,10 +15,10 @@ const useStyles = makeStyles( theme => ({ label: { fontWeight: 600, - marginBottom: theme.spacing(1) - } + marginBottom: theme.spacing(1), + }, }), - { name: "CustomerAddresses" } + { name: "CustomerAddresses" }, ); export interface CustomerAddressesProps { @@ -39,7 +39,7 @@ const CustomerAddresses: React.FC = props => { title={intl.formatMessage({ id: "BfJGij", defaultMessage: "Address Information", - description: "header" + description: "header", })} toolbar={
diff --git a/src/giftCards/GiftCardCreateDialog/GiftCardCreateExpirySelect/messages.ts b/src/giftCards/GiftCardCreateDialog/GiftCardCreateExpirySelect/messages.ts index b4d329414..dd3958ebd 100644 --- a/src/giftCards/GiftCardCreateDialog/GiftCardCreateExpirySelect/messages.ts +++ b/src/giftCards/GiftCardCreateDialog/GiftCardCreateExpirySelect/messages.ts @@ -4,21 +4,21 @@ export const giftCardCreateExpirySelectMessages = defineMessages({ expirySelectedLabel: { id: "rzhcpD", defaultMessage: "Set gift card expiry date", - description: "set expiry date selected label" + description: "set expiry date selected label", }, expiryPeriodLabel: { id: "rl1t+o", defaultMessage: "Expires in", - description: "expires in label" + description: "expires in label", }, expiryDateLabel: { id: "YBqLHs", defaultMessage: "Exact date", - description: "expiry date label" + description: "expiry date label", }, expiryOnLabel: { id: "fzl482", defaultMessage: "Will expire on:", - description: "expires on label" - } + description: "expires on label", + }, }); diff --git a/src/giftCards/GiftCardCreateDialog/GiftCardCreateExpirySelect/styles.ts b/src/giftCards/GiftCardCreateDialog/GiftCardCreateExpirySelect/styles.ts index d8168bd58..720e10dc3 100644 --- a/src/giftCards/GiftCardCreateDialog/GiftCardCreateExpirySelect/styles.ts +++ b/src/giftCards/GiftCardCreateDialog/GiftCardCreateExpirySelect/styles.ts @@ -4,16 +4,16 @@ export const useGiftCardCreateExpirySelectStyles = makeStyles( theme => ({ radioGroupContainer: { display: "flex", - flexDirection: "row" + flexDirection: "row", }, dateField: { - width: 400 + width: 400, }, periodField: { alignItems: "center", display: "flex", - gap: theme.spacing(2) - } + gap: theme.spacing(2), + }, }), - { name: "GiftCardExpirySelect" } + { name: "GiftCardExpirySelect" }, ); diff --git a/src/giftCards/GiftCardCreateDialog/GiftCardCreateMoneyInput.tsx b/src/giftCards/GiftCardCreateDialog/GiftCardCreateMoneyInput.tsx index 27bd5970c..c5f6b380c 100644 --- a/src/giftCards/GiftCardCreateDialog/GiftCardCreateMoneyInput.tsx +++ b/src/giftCards/GiftCardCreateDialog/GiftCardCreateMoneyInput.tsx @@ -9,7 +9,7 @@ import { useIntl } from "react-intl"; import { GiftCardBulkCreateFormErrors, - GiftCardCreateCommonFormData + GiftCardCreateCommonFormData, } from "../GiftCardBulkCreateDialog/types"; import { getGiftCardErrorMessage } from "../GiftCardUpdate/messages"; import { giftCardCreateMessages as messages } from "./messages"; @@ -26,7 +26,7 @@ const GiftCardCreateMoneyInput: React.FC = ({ errors, data: { balanceAmount, balanceCurrency }, change, - set + set, }) => { const intl = useIntl(); const classes = useStyles({}); @@ -37,7 +37,7 @@ const GiftCardCreateMoneyInput: React.FC = ({ const [savedCurrency, setCurrency] = useLocalStorage( "giftCardCreateCurrency", - undefined + undefined, ); const getInitialCurrency = () => { @@ -53,7 +53,7 @@ const GiftCardCreateMoneyInput: React.FC = ({ useEffect(() => { set({ - balanceCurrency: getInitialCurrency() + balanceCurrency: getInitialCurrency(), }); }, []); @@ -77,12 +77,12 @@ const GiftCardCreateMoneyInput: React.FC = ({ label: intl.formatMessage(messages.amountLabel), name: "balanceAmount", value: balanceAmount, - minValue: 0 + minValue: 0, }} selectFieldProps={{ name: "balanceCurrency", value: balanceCurrency, - className: classes.currencySelectField + className: classes.currencySelectField, }} /> ); diff --git a/src/giftCards/GiftCardCreateDialog/GiftCardCreateRequiresActivationSection.tsx b/src/giftCards/GiftCardCreateDialog/GiftCardCreateRequiresActivationSection.tsx index df5dd2df7..9f30cc2e3 100644 --- a/src/giftCards/GiftCardCreateDialog/GiftCardCreateRequiresActivationSection.tsx +++ b/src/giftCards/GiftCardCreateDialog/GiftCardCreateRequiresActivationSection.tsx @@ -1,6 +1,6 @@ import { Typography } from "@material-ui/core"; import ControlledCheckbox, { - ControlledCheckboxProps + ControlledCheckboxProps, } from "@saleor/components/ControlledCheckbox"; import React from "react"; import { FormattedMessage } from "react-intl"; @@ -14,7 +14,7 @@ type GiftCardCreateRequiresActivationSectionProps = Pick< const GiftCardCreateRequiresActivationSection: React.FC = ({ checked, - onChange + onChange, }) => ( = ({ selectedCustomer, setSelectedCustomer, - disabled = false + disabled = false, }) => { const intl = useIntl(); const { loadMore, search, result } = useCustomerSearch({ - variables: DEFAULT_INITIAL_SEARCH_DATA + variables: DEFAULT_INITIAL_SEARCH_DATA, }); const customers = mapEdgesToItems(result?.data?.search); const choices = customers?.map(({ email, firstName, lastName }) => ({ value: email, - label: getFullName({ firstName, lastName }) + label: getFullName({ firstName, lastName }), })); const handleSelect = (event: React.ChangeEvent) => { @@ -42,7 +42,7 @@ const GiftCardCustomerSelectField: React.FC = }; const label = `${intl.formatMessage( - messages.customerLabel + messages.customerLabel, )} *${intl.formatMessage(commonMessages.optionalField)}`; return ( diff --git a/src/giftCards/GiftCardCreateDialog/messages.ts b/src/giftCards/GiftCardCreateDialog/messages.ts index 9fdceebe5..38d1c90df 100644 --- a/src/giftCards/GiftCardCreateDialog/messages.ts +++ b/src/giftCards/GiftCardCreateDialog/messages.ts @@ -4,94 +4,94 @@ export const giftCardCreateMessages = defineMessages({ title: { id: "JftRtx", defaultMessage: "Issue gift card", - description: "issue gift card dialog title" + description: "issue gift card dialog title", }, amountLabel: { id: "n9JOI3", defaultMessage: "Enter amount", - description: "money amount input label" + description: "money amount input label", }, issueButtonLabel: { id: "PilTI6", defaultMessage: "Issue", - description: "issue gift card button label" + description: "issue gift card button label", }, customerLabel: { id: "MgdgpT", defaultMessage: "Customer", - description: "customer input label" + description: "customer input label", }, noteLabel: { id: "UKgP89", defaultMessage: "Note", - description: "note input label" + description: "note input label", }, noteSubtitle: { id: "ZuqkSp", defaultMessage: "Why was this gift card issued. This note will not be shown to the customer. Note will be stored in gift card history", - description: "note input subtitle" + description: "note input subtitle", }, createdGiftCardLabel: { id: "zjZuhM", defaultMessage: "This is the code of a created gift card:", - description: "created gift card code label" + description: "created gift card code label", }, copyCodeLabel: { id: "RXbkle", defaultMessage: "Copy code", - description: "copy code button label" + description: "copy code button label", }, copiedToClipboardTitle: { id: "hnBvH7", defaultMessage: "Copied to clipboard", - description: "copied to clipboard alert title" + description: "copied to clipboard alert title", }, createdSuccessAlertTitle: { id: "WzHfj8", defaultMessage: "Successfully created gift card", - description: "successfully created gift card alert title" + description: "successfully created gift card alert title", }, requiresActivationLabel: { id: "vCw7BP", defaultMessage: "Requires activation", - description: "requires activation checkbox label" + description: "requires activation checkbox label", }, requiresActivationCaption: { id: "ArctEg", defaultMessage: "All issued cards require activation by staff before use.", - description: "requires activation checkbox caption" + description: "requires activation checkbox caption", }, giftCardsAmountLabel: { id: "uilt7q", defaultMessage: "Cards Issued", - description: "issued cards amount label" + description: "issued cards amount label", }, bulkCreateExplanation: { id: "45aV8u", defaultMessage: "After creation Saleor will create a list of gift card codes that you will be able to download. ", - description: "gift card bulk create modal bottom explanation" + description: "gift card bulk create modal bottom explanation", }, bulkCreateIssuedTitle: { id: "WyPitj", defaultMessage: "Bulk Issue Gift Cards", - description: "gift card bulk create success dialog title" + description: "gift card bulk create success dialog title", }, bulkCreateIssuedExplanation: { id: "NZtcLb", defaultMessage: "We have issued all of your requested gift cards. You can download the list of new gift cards using the button below.", - description: "gift card bulk create success dialog content" + description: "gift card bulk create success dialog content", }, bulkCreateIssuedAccept: { id: "vDnheO", defaultMessage: "Ok", - description: "gift card bulk create success dialog accept button" + description: "gift card bulk create success dialog accept button", }, bulkCreateIssuedExportToEmail: { id: "IVOjqW", defaultMessage: "Export To Email", - description: "gift card bulk create success dialog export button" - } + description: "gift card bulk create success dialog export button", + }, }); diff --git a/src/giftCards/GiftCardCreateDialog/styles.ts b/src/giftCards/GiftCardCreateDialog/styles.ts index 0a0da24a4..90efcfe7a 100644 --- a/src/giftCards/GiftCardCreateDialog/styles.ts +++ b/src/giftCards/GiftCardCreateDialog/styles.ts @@ -4,30 +4,30 @@ import { CSSProperties } from "react"; const contentStyles: CSSProperties = { maxHeight: "calc(100vh - 230px)", overflowY: "auto", - overflowX: "hidden" + overflowX: "hidden", }; export const useGiftCardCreateDialogCodeContentStyles = makeStyles( () => ({ content: { - ...contentStyles - } + ...contentStyles, + }, }), - { name: "GiftCardCreateDialogCodeContent" } + { name: "GiftCardCreateDialogCodeContent" }, ); export const useGiftCardCreateFormStyles = makeStyles( () => ({ noteField: { - width: "100%" + width: "100%", }, currencySelectField: { - width: 100 + width: 100, }, fullWidthContainer: { width: "100%" }, dialogContent: { - ...contentStyles - } + ...contentStyles, + }, }), - { name: "GiftCardCreateDialogForm" } + { name: "GiftCardCreateDialogForm" }, ); diff --git a/src/giftCards/GiftCardCreateDialog/utils.ts b/src/giftCards/GiftCardCreateDialog/utils.ts index 568aa7ec4..35cf50430 100644 --- a/src/giftCards/GiftCardCreateDialog/utils.ts +++ b/src/giftCards/GiftCardCreateDialog/utils.ts @@ -11,13 +11,13 @@ import { giftCardCreateMessages as messages } from "./messages"; const addToCurrentDate = ( currentDate: number, expiryPeriodAmount: number, - unit: moment.unitOfTime.DurationConstructor + unit: moment.unitOfTime.DurationConstructor, ) => moment(currentDate).add(expiryPeriodAmount, unit); export const getExpiryPeriodTerminationDate = ( currentDate: number, expiryPeriodType: TimePeriodTypeEnum, - expiryPeriodAmount: number = 0 + expiryPeriodAmount: number = 0, ): moment.Moment | null => { switch (expiryPeriodType) { case TimePeriodTypeEnum.DAY: @@ -35,23 +35,23 @@ export const getExpiryPeriodTerminationDate = ( export const getGiftCardExpiryError = (intl: IntlShape): IMessage => ({ title: intl.formatMessage( - giftCardUpdateFormMessages.giftCardInvalidExpiryDateHeader + giftCardUpdateFormMessages.giftCardInvalidExpiryDateHeader, ), text: intl.formatMessage( - giftCardUpdateFormMessages.giftCardInvalidExpiryDateContent + giftCardUpdateFormMessages.giftCardInvalidExpiryDateContent, ), - status: "error" + status: "error", }); export const getGiftCardCreateOnCompletedMessage = ( errors: GiftCardCreateMutation["giftCardCreate"]["errors"], intl: IntlShape, - successMessage?: IMessage + successMessage?: IMessage, ): IMessage => { const hasExpiryError = errors.some(error => error.field === "expiryDate"); const successGiftCardMessage = successMessage || { status: "success", - text: intl.formatMessage(messages.createdSuccessAlertTitle) + text: intl.formatMessage(messages.createdSuccessAlertTitle), }; if (hasExpiryError) { @@ -61,7 +61,7 @@ export const getGiftCardCreateOnCompletedMessage = ( return !!errors?.length ? { status: "error", - text: intl.formatMessage(commonErrorMessages.unknownError) + text: intl.formatMessage(commonErrorMessages.unknownError), } : successGiftCardMessage; }; @@ -72,9 +72,9 @@ export const getGiftCardExpiryInputData = ( expiryType, expiryDate, expiryPeriodAmount, - expiryPeriodType + expiryPeriodType, }: GiftCardCreateCommonFormData, - currentDate: number + currentDate: number, ): string => { if (!expirySelected) { return; @@ -84,7 +84,7 @@ export const getGiftCardExpiryInputData = ( return getExpiryPeriodTerminationDate( currentDate, expiryPeriodType, - expiryPeriodAmount + expiryPeriodAmount, )?.format("YYYY-MM-DD"); } diff --git a/src/giftCards/GiftCardExportDialogContent/GiftCardExportDialogContent.tsx b/src/giftCards/GiftCardExportDialogContent/GiftCardExportDialogContent.tsx index 4195562b4..5357e22df 100644 --- a/src/giftCards/GiftCardExportDialogContent/GiftCardExportDialogContent.tsx +++ b/src/giftCards/GiftCardExportDialogContent/GiftCardExportDialogContent.tsx @@ -2,13 +2,13 @@ import { DialogActions, DialogContent, DialogTitle, - Typography + Typography, } from "@material-ui/core"; import ConfirmButton from "@saleor/components/ConfirmButton"; import { Task } from "@saleor/containers/BackgroundTasks/types"; import { useExportGiftCardsMutation, - useGiftCardTotalCountQuery + useGiftCardTotalCountQuery, } from "@saleor/graphql"; import useBackgroundTask from "@saleor/hooks/useBackgroundTask"; import useForm from "@saleor/hooks/useForm"; @@ -17,7 +17,7 @@ import ExportDialogSettings from "@saleor/products/components/ProductExportDialo import { ExportSettingsFormData, exportSettingsInitialFormData, - exportSettingsInitialFormDataWithIds + exportSettingsInitialFormDataWithIds, } from "@saleor/products/components/ProductExportDialog/types"; import { DialogProps } from "@saleor/types"; import React from "react"; @@ -42,14 +42,14 @@ const GiftCardExportDialog: React.FC & { const { loading: loadingGiftCardList, totalCount: filteredGiftCardsCount, - listElements + listElements, } = useGiftCardList(); const selectedIds = idsToExport ?? listElements; const { data: allGiftCardsCountData, - loading: loadingGiftCardCount + loading: loadingGiftCardCount, } = useGiftCardTotalCountQuery(); const loading = loadingGiftCardList || loadingGiftCardCount; @@ -61,16 +61,16 @@ const GiftCardExportDialog: React.FC & { if (!errors.length) { notify({ text: intl.formatMessage(messages.successAlertDescription), - title: intl.formatMessage(messages.successAlertTitle) + title: intl.formatMessage(messages.successAlertTitle), }); queue(Task.EXPORT, { - id: data.exportGiftCards.exportFile.id + id: data.exportGiftCards.exportFile.id, }); onClose(); } - } + }, }); const handleSubmit = (data: ExportSettingsFormData) => { @@ -78,9 +78,9 @@ const GiftCardExportDialog: React.FC & { variables: { input: getExportGiftCardsInput({ data, - ids: selectedIds - }) - } + ids: selectedIds, + }), + }, }); }; @@ -88,7 +88,7 @@ const GiftCardExportDialog: React.FC & { hasIdsToExport ? exportSettingsInitialFormDataWithIds : exportSettingsInitialFormData, - handleSubmit + handleSubmit, ); const allGiftCardsCount = allGiftCardsCountData?.giftCards?.totalCount; @@ -97,22 +97,22 @@ const GiftCardExportDialog: React.FC & { { id: "uQk8gB", defaultMessage: "All gift cards ({number})", - description: "export all items to csv file" + description: "export all items to csv file", }, { - number: allGiftCardsCount || "..." - } + number: allGiftCardsCount || "...", + }, ), selectedItems: intl.formatMessage( { id: "n97Ii0", defaultMessage: "Selected giftCards ({number})", - description: "export selected items to csv file" + description: "export selected items to csv file", }, { - number: listElements.length - } - ) + number: listElements.length, + }, + ), }; return ( @@ -133,7 +133,7 @@ const GiftCardExportDialog: React.FC & { allowScopeSelection={!hasIdsToExport} itemsQuantity={{ filter: filteredGiftCardsCount, - all: allGiftCardsCount + all: allGiftCardsCount, }} /> diff --git a/src/giftCards/GiftCardExportDialogContent/messages.ts b/src/giftCards/GiftCardExportDialogContent/messages.ts index 3de5a322d..75dba5ed6 100644 --- a/src/giftCards/GiftCardExportDialogContent/messages.ts +++ b/src/giftCards/GiftCardExportDialogContent/messages.ts @@ -4,32 +4,32 @@ export const giftCardExportDialogMessages = defineMessages({ title: { id: "DQJnB4", defaultMessage: "Export Gift Card Codes", - description: "gift card export dialog title" + description: "gift card export dialog title", }, exportTypeLabel: { id: "3kwdxJ", defaultMessage: "gift cards", - description: "gift card export type label" + description: "gift card export type label", }, confirmButtonLabel: { id: "CRAfpd", defaultMessage: "Export codes", - description: "gift card export dialog confirm button label" + description: "gift card export dialog confirm button label", }, successAlertDescription: { id: "bDHiYK", defaultMessage: "We are currently exporting your gift card codes. As soon as your file is available it will be sent to your email address", - description: "gift card export success alert description" + description: "gift card export success alert description", }, successAlertTitle: { id: "YEpYMB", defaultMessage: "Exporting CSV", - description: "gift card export csv success alert title" + description: "gift card export csv success alert title", }, exportNote: { id: "dsJ+Wv", defaultMessage: "Note: Only active and not used gift cards will be expored", - description: "note on export gift cards" - } + description: "note on export gift cards", + }, }); diff --git a/src/giftCards/GiftCardExportDialogContent/styles.ts b/src/giftCards/GiftCardExportDialogContent/styles.ts index dec793932..8490be9cb 100644 --- a/src/giftCards/GiftCardExportDialogContent/styles.ts +++ b/src/giftCards/GiftCardExportDialogContent/styles.ts @@ -3,10 +3,10 @@ import { makeStyles } from "@saleor/macaw-ui"; const useStyles = makeStyles( theme => ({ note: { - marginTop: theme.spacing(3) - } + marginTop: theme.spacing(3), + }, }), - { name: "GiftCardExportDialogContent" } + { name: "GiftCardExportDialogContent" }, ); export default useStyles; diff --git a/src/giftCards/GiftCardExportDialogContent/utils.ts b/src/giftCards/GiftCardExportDialogContent/utils.ts index 43eeaade0..0999cf779 100644 --- a/src/giftCards/GiftCardExportDialogContent/utils.ts +++ b/src/giftCards/GiftCardExportDialogContent/utils.ts @@ -8,7 +8,7 @@ interface ExportGiftCardsInputProps { export const getExportGiftCardsInput = ({ data, - ids + ids, }: ExportGiftCardsInputProps) => { const { scope, fileType } = data; @@ -16,12 +16,12 @@ export const getExportGiftCardsInput = ({ return { fileType, scope, - ids + ids, }; } return { fileType, - scope + scope, }; }; diff --git a/src/giftCards/GiftCardSettings/GiftCardExpirySettingsCard/GiftCardExpirySettingsCard.tsx b/src/giftCards/GiftCardSettings/GiftCardExpirySettingsCard/GiftCardExpirySettingsCard.tsx index d04f768a7..ffd39b4ce 100644 --- a/src/giftCards/GiftCardSettings/GiftCardExpirySettingsCard/GiftCardExpirySettingsCard.tsx +++ b/src/giftCards/GiftCardSettings/GiftCardExpirySettingsCard/GiftCardExpirySettingsCard.tsx @@ -1,7 +1,7 @@ import { Card, CardContent } from "@material-ui/core"; import CardTitle from "@saleor/components/CardTitle"; import GiftCardSettingsExpirySelect, { - GiftCardSettingsExpirySelectProps + GiftCardSettingsExpirySelectProps, } from "@saleor/giftCards/components/GiftCardSettingsExpirySelect"; import React from "react"; import { useIntl } from "react-intl"; @@ -20,7 +20,7 @@ const GiftCardExpirySettingsCard: React.FC = ({ data, disabled, errors, - onChange + onChange, }) => { const intl = useIntl(); diff --git a/src/giftCards/GiftCardSettings/GiftCardExpirySettingsCard/messages.ts b/src/giftCards/GiftCardSettings/GiftCardExpirySettingsCard/messages.ts index 9bfa052cf..fc9ca3eb6 100644 --- a/src/giftCards/GiftCardSettings/GiftCardExpirySettingsCard/messages.ts +++ b/src/giftCards/GiftCardSettings/GiftCardExpirySettingsCard/messages.ts @@ -5,11 +5,11 @@ export const giftCardExpirySettingsCard = defineMessages({ id: "KqbfFa", defaultMessage: "You can set gift cards to expire after a certain time after their purchase. Remember that in some countries, gift cards expiry is prohibited by law.", - description: "expiry date selection info message" + description: "expiry date selection info message", }, expiryDateTitle: { id: "1J/bhZ", defaultMessage: "Expiry date", - description: "expiry date section header" - } + description: "expiry date section header", + }, }); diff --git a/src/giftCards/GiftCardSettings/GiftCardSettingsPage.tsx b/src/giftCards/GiftCardSettings/GiftCardSettingsPage.tsx index 5d015ae28..b5969e1cc 100644 --- a/src/giftCards/GiftCardSettings/GiftCardSettingsPage.tsx +++ b/src/giftCards/GiftCardSettings/GiftCardSettingsPage.tsx @@ -9,7 +9,7 @@ import { GiftCardSettingsExpiryTypeEnum, TimePeriodTypeEnum, useGiftCardSettingsQuery, - useGiftCardSettingsUpdateMutation + useGiftCardSettingsUpdateMutation, } from "@saleor/graphql"; import useNavigator from "@saleor/hooks/useNavigator"; import { sectionNames } from "@saleor/intl"; @@ -38,19 +38,19 @@ const GiftCardSettingsPage: React.FC = () => { settingsData?.expiryType === GiftCardSettingsExpiryTypeEnum.EXPIRY_PERIOD, expiryPeriodType: settingsData?.expiryPeriod?.type || TimePeriodTypeEnum.YEAR, - expiryPeriodAmount: settingsData?.expiryPeriod?.amount || 1 + expiryPeriodAmount: settingsData?.expiryPeriod?.amount || 1, }; const [ updateGiftCardSettings, - updateGiftCardSettingsOpts + updateGiftCardSettingsOpts, ] = useGiftCardSettingsUpdateMutation({}); const handleSubmit = (formData: GiftCardSettingsFormData) => { updateGiftCardSettings({ variables: { - input: getGiftCardSettingsInputData(formData) - } + input: getGiftCardSettingsInputData(formData), + }, }); }; diff --git a/src/giftCards/GiftCardSettings/messages.ts b/src/giftCards/GiftCardSettings/messages.ts index d693075b8..a921a2d42 100644 --- a/src/giftCards/GiftCardSettings/messages.ts +++ b/src/giftCards/GiftCardSettings/messages.ts @@ -6,13 +6,13 @@ export const giftCardSettingsPageMessages = defineMessages({ title: { id: "xHj9Qe", defaultMessage: "Gift Cards Settings", - description: "gift card settings header" - } + description: "gift card settings header", + }, }); export function getGiftCardSettingsErrorMessage( error: Omit | undefined, - intl: IntlShape + intl: IntlShape, ): string { return getCommonFormFieldErrorMessage(error, intl); } diff --git a/src/giftCards/GiftCardSettings/utils.ts b/src/giftCards/GiftCardSettings/utils.ts index e85aa925a..81d8b79df 100644 --- a/src/giftCards/GiftCardSettings/utils.ts +++ b/src/giftCards/GiftCardSettings/utils.ts @@ -1,6 +1,6 @@ import { GiftCardSettingsExpiryTypeEnum, - GiftCardSettingsUpdateInput + GiftCardSettingsUpdateInput, } from "@saleor/graphql"; import { GiftCardSettingsFormData } from "./types"; @@ -8,7 +8,7 @@ import { GiftCardSettingsFormData } from "./types"; export const getGiftCardSettingsInputData = ({ expiryPeriodActive, expiryPeriodType, - expiryPeriodAmount + expiryPeriodAmount, }: Pick< GiftCardSettingsFormData, "expiryPeriodActive" | "expiryPeriodType" | "expiryPeriodAmount" @@ -21,12 +21,12 @@ export const getGiftCardSettingsInputData = ({ expiryPeriodActive && expiryPeriodType && expiryPeriodAmount ? { type: expiryPeriodType, - amount: expiryPeriodAmount + amount: expiryPeriodAmount, } : undefined; return { expiryType, - expiryPeriod + expiryPeriod, }; }; diff --git a/src/giftCards/GiftCardUpdate/GiftCardHistory/GiftCardHistory.tsx b/src/giftCards/GiftCardUpdate/GiftCardHistory/GiftCardHistory.tsx index 87b9f5f0a..71a042cb6 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardHistory/GiftCardHistory.tsx +++ b/src/giftCards/GiftCardUpdate/GiftCardHistory/GiftCardHistory.tsx @@ -4,11 +4,11 @@ import Hr from "@saleor/components/Hr"; import Skeleton from "@saleor/components/Skeleton"; import Timeline, { TimelineAddNote, - TimelineNote + TimelineNote, } from "@saleor/components/Timeline"; import { GiftCardEventsEnum, - useGiftCardAddNoteMutation + useGiftCardAddNoteMutation, } from "@saleor/graphql"; import useNotifier from "@saleor/hooks/useNotifier"; import React from "react"; @@ -38,15 +38,15 @@ const GiftCardHistory: React.FC = () => { if (errors.length > 0) { notify({ status: "error", - text: intl.formatMessage(messages.noteAddError) + text: intl.formatMessage(messages.noteAddError), }); } else { notify({ status: "success", - text: intl.formatMessage(messages.noteAddedSuccessfully) + text: intl.formatMessage(messages.noteAddedSuccessfully), }); } - } + }, }); const onNoteAdd = (data: FormData) => { diff --git a/src/giftCards/GiftCardUpdate/GiftCardHistory/GiftCardTimelineEvent.tsx b/src/giftCards/GiftCardUpdate/GiftCardHistory/GiftCardTimelineEvent.tsx index 134fbe0d5..9024f10c6 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardHistory/GiftCardTimelineEvent.tsx +++ b/src/giftCards/GiftCardUpdate/GiftCardHistory/GiftCardTimelineEvent.tsx @@ -46,37 +46,37 @@ const getEventMessage = (event: GiftCardEventFragment, intl: IntlShape) => { case GiftCardEventsEnum.ACTIVATED: return user ? intl.formatMessage(timelineMessages.activated, { - activatedBy: {user} + activatedBy: {user}, }) : intl.formatMessage(timelineMessages.activatedAnonymous); case GiftCardEventsEnum.BALANCE_RESET: return user ? intl.formatMessage(timelineMessages.balanceReset, { - resetBy: {user} + resetBy: {user}, }) : intl.formatMessage(timelineMessages.balanceResetAnonymous); case GiftCardEventsEnum.BOUGHT: return intl.formatMessage(timelineMessages.bought, { orderNumber: ( #{event.orderNumber} - ) + ), }); case GiftCardEventsEnum.DEACTIVATED: return user ? intl.formatMessage(timelineMessages.deactivated, { - deactivatedBy: {user} + deactivatedBy: {user}, }) : intl.formatMessage(timelineMessages.deactivatedAnonymous); case GiftCardEventsEnum.EXPIRY_DATE_UPDATED: return user ? intl.formatMessage(timelineMessages.expiryDateUpdate, { - expiryUpdatedBy: {user} + expiryUpdatedBy: {user}, }) : intl.formatMessage(timelineMessages.expiryDateUpdateAnonymous); case GiftCardEventsEnum.ISSUED: return user ? intl.formatMessage(timelineMessages.issued, { - issuedBy: {user} + issuedBy: {user}, }) : intl.formatMessage(timelineMessages.issuedAnonymous); case GiftCardEventsEnum.RESENT: @@ -102,12 +102,12 @@ const getEventMessage = (event: GiftCardEventFragment, intl: IntlShape) => { : appPath(event.app.id) } >{`${content} ${user}`} - ) + ), }) : intl.formatMessage(timelineMessages.usedInOrderAnonymous, { orderLink: ( #{event.orderNumber} - ) + ), }); } }; @@ -119,7 +119,7 @@ export interface GiftCardTimelineEventProps { const GiftCardTimelineEvent: React.FC = ({ date, - event + event, }) => { const intl = useIntl(); return ; diff --git a/src/giftCards/GiftCardUpdate/GiftCardHistory/hooks/useGiftCardHistoryEvents.ts b/src/giftCards/GiftCardUpdate/GiftCardHistory/hooks/useGiftCardHistoryEvents.ts index 28f9a8068..99448be82 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardHistory/hooks/useGiftCardHistoryEvents.ts +++ b/src/giftCards/GiftCardUpdate/GiftCardHistory/hooks/useGiftCardHistoryEvents.ts @@ -7,7 +7,7 @@ const useGiftCardHistoryEvents = () => { return { id: giftCard?.id, - events: giftCard?.events + events: giftCard?.events, }; }; diff --git a/src/giftCards/GiftCardUpdate/GiftCardHistory/messages.ts b/src/giftCards/GiftCardUpdate/GiftCardHistory/messages.ts index 4bee19590..c0efa6ddf 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardHistory/messages.ts +++ b/src/giftCards/GiftCardUpdate/GiftCardHistory/messages.ts @@ -4,103 +4,103 @@ const giftCardHistoryMessages = defineMessages({ noteAddedSuccessfully: { id: "WS4ov0", defaultMessage: "Note was added sucessfully", - description: "notifier message" + description: "notifier message", }, noteAddError: { id: "JgNb8X", defaultMessage: "There was an error adding a note", - description: "notifier message" + description: "notifier message", }, historyHeaderTitle: { id: "4Z0O2B", defaultMessage: "Gift Card Timeline", - description: "section header title" - } + description: "section header title", + }, }); const giftCardHistoryTimelineMessages = defineMessages({ activated: { id: "fExm0/", defaultMessage: "Gift card was activated by {activatedBy}", - description: "gift card history message" + description: "gift card history message", }, activatedAnonymous: { id: "pCy5EP", defaultMessage: "Gift card was activated", - description: "gift card history message" + description: "gift card history message", }, balanceReset: { id: "aEc9Ar", defaultMessage: "Gift card balance was reset by {resetBy}", - description: "gift card history message" + description: "gift card history message", }, balanceResetAnonymous: { id: "aEc9Ar", defaultMessage: "Gift card balance was reset by {resetBy}", - description: "gift card history message" + description: "gift card history message", }, bought: { id: "PcQRxi", defaultMessage: "Gift card was bought in order {orderNumber}", - description: "gift card history message" + description: "gift card history message", }, deactivated: { id: "gAqkrG", defaultMessage: "Gift card was deactivated by {deactivatedBy}", - description: "gift card history message" + description: "gift card history message", }, deactivatedAnonymous: { id: "NvwS/N", defaultMessage: "Gift card was deactivated", - description: "gift card history message" + description: "gift card history message", }, expiryDateUpdate: { id: "vQunFc", defaultMessage: "Gift card expiry date was updated by {expiryUpdatedBy}", - description: "gift card history message" + description: "gift card history message", }, expiryDateUpdateAnonymous: { id: "fLhj3a", defaultMessage: "Gift card expiry date was updated", - description: "gift card history message" + description: "gift card history message", }, issued: { id: "30X9S8", defaultMessage: "Gift card was issued by {issuedBy}", - description: "gift card history message" + description: "gift card history message", }, issuedAnonymous: { id: "jDovoJ", defaultMessage: "Gift card was issued", - description: "gift card history message" + description: "gift card history message", }, resent: { id: "gj3MUg", defaultMessage: "Gift card was resent", - description: "gift card history message" + description: "gift card history message", }, sentToCustomer: { id: "tsL3IW", defaultMessage: "Gift card was sent to customer", - description: "gift card history message" + description: "gift card history message", }, tagsUpdated: { id: "vkAWwY", defaultMessage: "Gift card tags were updated", - description: "gift card history message" + description: "gift card history message", }, usedInOrder: { id: "Uu2B2G", defaultMessage: "Gift card was used as a payment method on order {orderLink} by", - description: "gift card history message" + description: "gift card history message", }, usedInOrderAnonymous: { id: "408KSO", defaultMessage: "Gift card was used as a payment method on order {orderLink}", - description: "gift card history message" - } + description: "gift card history message", + }, }); export { giftCardHistoryMessages, giftCardHistoryTimelineMessages }; diff --git a/src/giftCards/GiftCardUpdate/GiftCardHistory/styles.ts b/src/giftCards/GiftCardUpdate/GiftCardHistory/styles.ts index 5c0124562..4a859b861 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardHistory/styles.ts +++ b/src/giftCards/GiftCardUpdate/GiftCardHistory/styles.ts @@ -4,11 +4,11 @@ const useStyles = makeStyles( theme => ({ header: { fontWeight: 500, - marginBottom: theme.spacing(1) + marginBottom: theme.spacing(1), }, - root: { marginTop: theme.spacing(4) } + root: { marginTop: theme.spacing(4) }, }), - { name: "GiftCardHistory" } + { name: "GiftCardHistory" }, ); export default useStyles; diff --git a/src/giftCards/GiftCardUpdate/GiftCardResendCodeDialog/GiftCardResendCodeDialog.tsx b/src/giftCards/GiftCardUpdate/GiftCardResendCodeDialog/GiftCardResendCodeDialog.tsx index 4f3bb2101..e629a19b9 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardResendCodeDialog/GiftCardResendCodeDialog.tsx +++ b/src/giftCards/GiftCardUpdate/GiftCardResendCodeDialog/GiftCardResendCodeDialog.tsx @@ -34,7 +34,7 @@ const GiftCardResendCodeDialog: React.FC = ({ open, onClose }) => { const progressClasses = useProgressStyles(); const { - giftCard: { boughtInChannel: initialChannelSlug } + giftCard: { boughtInChannel: initialChannelSlug }, } = useGiftCardDetails(); const [consentSelected, setConsentSelected] = useState(false); @@ -49,25 +49,25 @@ const GiftCardResendCodeDialog: React.FC = ({ open, onClose }) => { const initialFormData: GiftCardResendCodeFormData = { email: "", - channelSlug: initialChannelSlug || "" + channelSlug: initialChannelSlug || "", }; const { - giftCard: { id } + giftCard: { id }, } = useGiftCardDetails(); const handleSubmit = async ({ email, - channelSlug + channelSlug, }: GiftCardResendCodeFormData) => { const result = await resendGiftCardCode({ variables: { input: { id, email: email ? email : null, - channel: channelSlug - } - } + channel: channelSlug, + }, + }, }); return result?.data?.giftCardResend?.errors; @@ -75,12 +75,12 @@ const GiftCardResendCodeDialog: React.FC = ({ open, onClose }) => { const { data, change, submit, reset } = useForm( initialFormData, - handleSubmit + handleSubmit, ); const [ resendGiftCardCode, - resendGiftCardCodeOpts + resendGiftCardCodeOpts, ] = useGiftCardResendMutation({ onCompleted: data => { const errors = data?.giftCardResend?.errors; @@ -88,11 +88,11 @@ const GiftCardResendCodeDialog: React.FC = ({ open, onClose }) => { const notifierData: IMessage = !!errors?.length ? { status: "error", - text: intl.formatMessage(commonErrorMessages.unknownError) + text: intl.formatMessage(commonErrorMessages.unknownError), } : { status: "success", - text: intl.formatMessage(messages.successResendAlertText) + text: intl.formatMessage(messages.successResendAlertText), }; notify(notifierData); @@ -101,7 +101,7 @@ const GiftCardResendCodeDialog: React.FC = ({ open, onClose }) => { onClose(); reset(); } - } + }, }); const { loading, status, data: submitData } = resendGiftCardCodeOpts; @@ -110,7 +110,7 @@ const GiftCardResendCodeDialog: React.FC = ({ open, onClose }) => { open, reset, apiErrors: submitData?.giftCardResend?.errors, - keys: ["email"] + keys: ["email"], }); useEffect(reset, [consentSelected]); diff --git a/src/giftCards/GiftCardUpdate/GiftCardResendCodeDialog/messages.ts b/src/giftCards/GiftCardUpdate/GiftCardResendCodeDialog/messages.ts index 5d03b9533..9bf494264 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardResendCodeDialog/messages.ts +++ b/src/giftCards/GiftCardUpdate/GiftCardResendCodeDialog/messages.ts @@ -4,37 +4,38 @@ export const giftCardResendCodeDialogMessages = defineMessages({ title: { id: "mslSpp", defaultMessage: "Resend code to customer", - description: "resend code to customer title" + description: "resend code to customer title", }, description: { id: "ttk0w7", defaultMessage: "Gift Card Code will be resent to email provided during checkout. You can provide a different email address if you want to:", - description: "resend code to customer description" + description: "resend code to customer description", }, consentCheckboxLabel: { id: "v01/tY", defaultMessage: "Yes, I want to send gift card to different address", - description: "consent to send gift card to different address checkbox label" + description: + "consent to send gift card to different address checkbox label", }, submitButtonLabel: { id: "s1IQuN", defaultMessage: "Resend", - description: "resend button label" + description: "resend button label", }, emailInputPlaceholder: { id: "AqHafs", defaultMessage: "Provided email address", - description: "provided email input placeholder" + description: "provided email input placeholder", }, successResendAlertText: { id: "JQH+Iy", defaultMessage: "Successfully resent code to customer!", - description: "resent code success message" + description: "resent code success message", }, sendToChannelSelectLabel: { id: "NLNonj", defaultMessage: "Send to channel", - description: "send to channel select label" - } + description: "send to channel select label", + }, }); diff --git a/src/giftCards/GiftCardUpdate/GiftCardResendCodeDialog/utils.ts b/src/giftCards/GiftCardUpdate/GiftCardResendCodeDialog/utils.ts index 21d6c836c..6816f5deb 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardResendCodeDialog/utils.ts +++ b/src/giftCards/GiftCardUpdate/GiftCardResendCodeDialog/utils.ts @@ -9,7 +9,7 @@ export function useDialogFormReset< reset, apiErrors, keys, - open + open, }: { reset: () => void; apiErrors: TError[]; diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdateBalanceDialog/GiftCardUpdateBalanceDialog.tsx b/src/giftCards/GiftCardUpdate/GiftCardUpdateBalanceDialog/GiftCardUpdateBalanceDialog.tsx index e9050082e..8bbb7ab6f 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardUpdateBalanceDialog/GiftCardUpdateBalanceDialog.tsx +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdateBalanceDialog/GiftCardUpdateBalanceDialog.tsx @@ -23,7 +23,7 @@ export interface GiftCardBalanceUpdateFormData { const GiftCardUpdateBalanceDialog: React.FC = ({ open, - onClose + onClose, }) => { const intl = useIntl(); const classes = useStyles({}); @@ -32,17 +32,17 @@ const GiftCardUpdateBalanceDialog: React.FC = ({ const { giftCard: { id, - currentBalance: { amount, currency } - } + currentBalance: { amount, currency }, + }, } = useGiftCardDetails(); const initialFormData: GiftCardBalanceUpdateFormData = { - balanceAmount: amount + balanceAmount: amount, }; const [ updateGiftCardBalance, - updateGiftCardBalanceOpts + updateGiftCardBalanceOpts, ] = useGiftCardUpdateMutation({ onCompleted: data => { const errors = data?.giftCardUpdate?.errors; @@ -50,11 +50,11 @@ const GiftCardUpdateBalanceDialog: React.FC = ({ const notifierData: IMessage = !!errors?.length ? { status: "error", - text: intl.formatMessage(commonErrorMessages.unknownError) + text: intl.formatMessage(commonErrorMessages.unknownError), } : { status: "success", - text: intl.formatMessage(messages.updatedSuccessAlertTitle) + text: intl.formatMessage(messages.updatedSuccessAlertTitle), }; notify(notifierData); @@ -62,19 +62,19 @@ const GiftCardUpdateBalanceDialog: React.FC = ({ if (!errors.length) { onClose(); } - } + }, }); const handleSubmit = async ({ - balanceAmount + balanceAmount, }: GiftCardBalanceUpdateFormData) => { const result = await updateGiftCardBalance({ variables: { id, input: { - balanceAmount - } - } + balanceAmount, + }, + }, }); return result?.data?.giftCardUpdate?.errors; @@ -82,7 +82,7 @@ const GiftCardUpdateBalanceDialog: React.FC = ({ const { data, change, submit, reset } = useForm( initialFormData, - handleSubmit + handleSubmit, ); const { loading, status, data: submitData } = updateGiftCardBalanceOpts; @@ -91,7 +91,7 @@ const GiftCardUpdateBalanceDialog: React.FC = ({ open, reset, keys: ["initialBalanceAmount"], - apiErrors: submitData?.giftCardUpdate?.errors + apiErrors: submitData?.giftCardUpdate?.errors, }); return ( @@ -112,14 +112,14 @@ const GiftCardUpdateBalanceDialog: React.FC = ({ error={!!formErrors?.initialBalanceAmount} helperText={getGiftCardErrorMessage( formErrors?.initialBalanceAmount, - intl + intl, )} name="balanceAmount" value={data.balanceAmount} onChange={change} className={classes.inputContainer} label={intl.formatMessage( - tableMessages.giftCardsTableColumnBalanceTitle + tableMessages.giftCardsTableColumnBalanceTitle, )} type="float" InputProps={{ @@ -127,7 +127,7 @@ const GiftCardUpdateBalanceDialog: React.FC = ({
{currency}
- ) + ), }} /> diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdateBalanceDialog/messages.ts b/src/giftCards/GiftCardUpdate/GiftCardUpdateBalanceDialog/messages.ts index d1994fe32..8c0f51119 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardUpdateBalanceDialog/messages.ts +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdateBalanceDialog/messages.ts @@ -4,22 +4,22 @@ export const giftCardUpdateBalanceDialogMessages = defineMessages({ title: { id: "tKxCld", defaultMessage: "Set balance", - description: "set balance dialog title label" + description: "set balance dialog title label", }, subtitle: { id: "kFkMoG", defaultMessage: "What would you like to set cards balance to. When you change the balance both values will be changed", - description: "set balance dialog subtitle" + description: "set balance dialog subtitle", }, updatedSuccessAlertTitle: { id: "XAPFHP", defaultMessage: "Successfully updated card balance", - description: "card update success alert title" + description: "card update success alert title", }, changeButtonLabel: { id: "STJx8N", defaultMessage: "Change", - description: "change button label" - } + description: "change button label", + }, }); diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdateBalanceDialog/styles.ts b/src/giftCards/GiftCardUpdate/GiftCardUpdateBalanceDialog/styles.ts index f5e74413d..f2b5350b5 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardUpdateBalanceDialog/styles.ts +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdateBalanceDialog/styles.ts @@ -3,15 +3,15 @@ import { makeStyles } from "@saleor/macaw-ui"; export const useUpdateBalanceDialogStyles = makeStyles( theme => ({ inputContainer: { - width: "100%" + width: "100%", }, currencyCodeContainer: { height: 35, display: "flex", flexDirection: "column", justifyContent: "flex-end", - marginRight: theme.spacing(1) - } + marginRight: theme.spacing(1), + }, }), - { name: "GiftCardUpdateBalanceDialog" } + { name: "GiftCardUpdateBalanceDialog" }, ); diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/GiftCardUpdateDetailsBalanceSection.tsx b/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/GiftCardUpdateDetailsBalanceSection.tsx index 147496251..c78421daa 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/GiftCardUpdateDetailsBalanceSection.tsx +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/GiftCardUpdateDetailsBalanceSection.tsx @@ -15,7 +15,7 @@ const GiftCardUpdateDetailsBalanceSection: React.FC = () => { const intl = useIntl(); const { - giftCard: { currentBalance, initialBalance } + giftCard: { currentBalance, initialBalance }, } = useGiftCardDetails(); const progressBarWidth = !!currentBalance.amount diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/GiftCardUpdateDetailsCard.tsx b/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/GiftCardUpdateDetailsCard.tsx index 04b5d04e1..1648e119d 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/GiftCardUpdateDetailsCard.tsx +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/GiftCardUpdateDetailsCard.tsx @@ -23,7 +23,7 @@ const GiftCardUpdateDetailsCard: React.FC = () => { const { toggleValue, data: { tags }, - formErrors + formErrors, } = useGiftCardUpdateForm(); return ( diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/messages.ts b/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/messages.ts index a2569141b..4eee88f16 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/messages.ts +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/messages.ts @@ -4,21 +4,21 @@ export const giftCardUpdateDetailsCardMessages = defineMessages({ title: { id: "Zj/7QZ", defaultMessage: "Details", - description: "details title" + description: "details title", }, setBalanceButtonLabel: { id: "PJDcQs", defaultMessage: "Set Balance", - description: "set balance button label" + description: "set balance button label", }, cardBalanceLabel: { id: "Z/7hyu", defaultMessage: "Card Balance", - description: "card balance label" + description: "card balance label", }, tagInputLabel: { id: "a+kgkq", defaultMessage: "Card Tag", - description: "tag label" - } + description: "tag label", + }, }); diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/styles.ts b/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/styles.ts index e0e54d1a6..46939869b 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/styles.ts +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdateDetailsCard/styles.ts @@ -4,10 +4,10 @@ export const useGiftCardDetailsBalanceStyles = makeStyles( theme => ({ labelsContainer: { display: "flex", - alignItems: "baseline" + alignItems: "baseline", }, wideContainer: { - justifyContent: "space-between" + justifyContent: "space-between", }, balanceBar: { width: "100%", @@ -16,13 +16,13 @@ export const useGiftCardDetailsBalanceStyles = makeStyles( height: 36, padding: "0 4px", backgroundColor: theme.palette.background.default, - borderRadius: 18 + borderRadius: 18, }, balanceBarProgress: { height: 28, borderRadius: 14, - backgroundColor: theme.palette.primary.light - } + backgroundColor: theme.palette.primary.light, + }, }), - { name: "GiftCardUpdateDetailsBalanceSection" } + { name: "GiftCardUpdateDetailsBalanceSection" }, ); diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdateExpirySelect/GiftCardUpdateExpirySelect.tsx b/src/giftCards/GiftCardUpdate/GiftCardUpdateExpirySelect/GiftCardUpdateExpirySelect.tsx index da35c3fa9..ab5ad639d 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardUpdateExpirySelect/GiftCardUpdateExpirySelect.tsx +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdateExpirySelect/GiftCardUpdateExpirySelect.tsx @@ -17,11 +17,11 @@ const GiftCardUpdateExpirySelect: React.FC = () => { const { change, data: { expiryDate }, - formErrors + formErrors, } = useGiftCardUpdateForm(); const [cardExpiresSelected, setCardExpiresSelected] = useStateFromProps( - !!expiryDate + !!expiryDate, ); useEffect(() => { @@ -29,8 +29,8 @@ const GiftCardUpdateExpirySelect: React.FC = () => { change({ target: { name: "expiryDate", - value: null - } + value: null, + }, }); } }, [cardExpiresSelected]); @@ -57,7 +57,7 @@ const GiftCardUpdateExpirySelect: React.FC = () => { label={intl.formatMessage(messages.expiryDateLabel)} value={expiryDate} InputLabelProps={{ - shrink: true + shrink: true, }} type="date" /> diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdateExpirySelect/messages.ts b/src/giftCards/GiftCardUpdate/GiftCardUpdateExpirySelect/messages.ts index c76423158..f5588d715 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardUpdateExpirySelect/messages.ts +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdateExpirySelect/messages.ts @@ -4,16 +4,16 @@ export const giftCardExpirySelectMessages = defineMessages({ expiryDateCheckboxLabel: { id: "JKbpH9", defaultMessage: "Gift card expires", - description: "expiry date checkbox label" + description: "expiry date checkbox label", }, expiryDateLabel: { id: "nFTvQW", defaultMessage: "Expiration date", - description: "expiration date label" + description: "expiration date label", }, expiredOnLabel: { id: "//k1GX", defaultMessage: "Expired on {date}", - description: "expired on label" - } + description: "expired on label", + }, }); diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdateExpirySelect/styles.ts b/src/giftCards/GiftCardUpdate/GiftCardUpdateExpirySelect/styles.ts index 24bc860b7..b0ead3060 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardUpdateExpirySelect/styles.ts +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdateExpirySelect/styles.ts @@ -4,16 +4,16 @@ export const useGiftCardExpirySelectStyles = makeStyles( theme => ({ radioGroupContainer: { display: "flex", - flexDirection: "row" + flexDirection: "row", }, dateField: { display: "block", width: 400, - marginTop: theme.spacing(2) + marginTop: theme.spacing(2), }, periodField: { - display: "flex" - } + display: "flex", + }, }), - { name: "GiftCardUpdateDetailsExpirySection" } + { name: "GiftCardUpdateDetailsExpirySection" }, ); diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdateInfoCard/GiftCardUpdateInfoCardContent.tsx b/src/giftCards/GiftCardUpdate/GiftCardUpdateInfoCard/GiftCardUpdateInfoCardContent.tsx index 0b5fca8b8..195273255 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardUpdateInfoCard/GiftCardUpdateInfoCardContent.tsx +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdateInfoCard/GiftCardUpdateInfoCardContent.tsx @@ -31,7 +31,7 @@ const GiftCardUpdateInfoCardContent: React.FC = () => { usedByEmail, usedBy, product, - events + events, } = giftCard; const cardIssuedEvent = events.find(getByType(GiftCardEventsEnum.ISSUED)); @@ -51,7 +51,7 @@ const GiftCardUpdateInfoCardContent: React.FC = () => { return { label: messages.issuedByAppLabel, name: app?.name, - url: appUrl(app?.id) + url: appUrl(app?.id), }; } @@ -60,21 +60,21 @@ const GiftCardUpdateInfoCardContent: React.FC = () => { return { label: messages.issuedByLabel, name: userName || createdByEmail, - url: staffMemberDetailsUrl(createdBy?.id) + url: staffMemberDetailsUrl(createdBy?.id), }; } if (createdByEmail) { return { label: messages.boughtByLabel, - name: createdByEmail + name: createdByEmail, }; } return { label: messages.boughtByLabel, name: getFullName(createdBy), - url: customerUrl(createdBy?.id) + url: customerUrl(createdBy?.id), }; }; @@ -88,7 +88,7 @@ const GiftCardUpdateInfoCardContent: React.FC = () => { return getOrderNumberLinkObject({ id: orderId, - number: orderNumber + number: orderNumber, }); } @@ -97,7 +97,7 @@ const GiftCardUpdateInfoCardContent: React.FC = () => { return getOrderNumberLinkObject({ id: orderId, - number: orderNumber + number: orderNumber, }); } @@ -107,7 +107,7 @@ const GiftCardUpdateInfoCardContent: React.FC = () => { const { label: buyerLabelMessage, name: buyerName, - url: buyerUrl + url: buyerUrl, } = getBuyerFieldData(); const orderData = getOrderData(); diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdateInfoCard/messages.ts b/src/giftCards/GiftCardUpdate/GiftCardUpdateInfoCard/messages.ts index f850c37f7..99b3d705a 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardUpdateInfoCard/messages.ts +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdateInfoCard/messages.ts @@ -4,41 +4,41 @@ export const giftCardUpdateInfoCardMessages = defineMessages({ title: { id: "Eh6KYS", defaultMessage: "Card information", - description: "info card title" + description: "info card title", }, creationLabel: { id: "/AbHy4", defaultMessage: "Creation", - description: "creation label" + description: "creation label", }, orderNumberLabel: { id: "9TbDQD", defaultMessage: "Order number", - description: "order number label" + description: "order number label", }, productLabel: { id: "kc4c4d", defaultMessage: "Product bought to get gift card", - description: "product label" + description: "product label", }, issuedByLabel: { id: "V+h02n", defaultMessage: "Issued by", - description: "issued by label" + description: "issued by label", }, issuedByAppLabel: { id: "+pLi+M", defaultMessage: "Issued by app", - description: "issued by app label" + description: "issued by app label", }, boughtByLabel: { id: "Jo01VZ", defaultMessage: "Bought by", - description: "bought by label" + description: "bought by label", }, usedByLabel: { id: "kS5Qgk", defaultMessage: "Used by", - description: "used by label" - } + description: "used by label", + }, }); diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdatePage.tsx b/src/giftCards/GiftCardUpdate/GiftCardUpdatePage.tsx index e0a5ee53a..219462bd8 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardUpdatePage.tsx +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdatePage.tsx @@ -22,11 +22,11 @@ const GiftCardUpdatePage: React.FC = () => { const { submit, data, - handlers: { changeMetadata } + handlers: { changeMetadata }, } = useGiftCardUpdateForm(); const { - opts: { loading: loadingUpdate, status } + opts: { loading: loadingUpdate, status }, } = useGiftCardUpdate(); return ( diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdatePageHeader/GiftCardEnableDisableSection.tsx b/src/giftCards/GiftCardUpdate/GiftCardUpdatePageHeader/GiftCardEnableDisableSection.tsx index fa35b5f05..069a3d718 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardUpdatePageHeader/GiftCardEnableDisableSection.tsx +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdatePageHeader/GiftCardEnableDisableSection.tsx @@ -11,7 +11,7 @@ const GiftCardEnableDisableSection: React.FC = () => { const intl = useIntl(); const { - giftCard: { id, isActive, isExpired } + giftCard: { id, isActive, isExpired }, } = useGiftCardDetails(); if (isExpired) { @@ -21,9 +21,9 @@ const GiftCardEnableDisableSection: React.FC = () => { const { giftCardActivate, giftCardDeactivate, - currentOpts + currentOpts, } = useGiftCardActivateToggle({ - isActive + isActive, }); const handleClick = () => @@ -42,7 +42,7 @@ const GiftCardEnableDisableSection: React.FC = () => { transitionState={currentOpts?.status} labels={{ confirm: intl.formatMessage(buttonLabel), - error: intl.formatMessage(commonMessages.error) + error: intl.formatMessage(commonMessages.error), }} /> ); diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdatePageHeader/GiftCardUpdatePageHeader.tsx b/src/giftCards/GiftCardUpdate/GiftCardUpdatePageHeader/GiftCardUpdatePageHeader.tsx index bb86a69a9..e91c8b612 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardUpdatePageHeader/GiftCardUpdatePageHeader.tsx +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdatePageHeader/GiftCardUpdatePageHeader.tsx @@ -30,7 +30,7 @@ const GiftCardUpdatePageHeader: React.FC = () => { const { last4CodeChars, isExpired } = giftCard; const title = intl.formatMessage(tableMessages.codeEndingWithLabel, { - last4CodeChars + last4CodeChars, }); return ( diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdatePageHeader/hooks/useGiftCardActivateToggle.ts b/src/giftCards/GiftCardUpdate/GiftCardUpdatePageHeader/hooks/useGiftCardActivateToggle.ts index a81e7607d..644838fab 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardUpdatePageHeader/hooks/useGiftCardActivateToggle.ts +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdatePageHeader/hooks/useGiftCardActivateToggle.ts @@ -1,6 +1,6 @@ import { useGiftCardActivateMutation, - useGiftCardDeactivateMutation + useGiftCardDeactivateMutation, } from "@saleor/graphql"; import useNotifier from "@saleor/hooks/useNotifier"; import commonErrorMessages from "@saleor/utils/errors/common"; @@ -18,7 +18,7 @@ interface useGiftCardActivateToggleProps { const useGiftCardActivateToggle = ({ onActivateActionComplete, onDeactivateActionComplete, - isActive + isActive, }: useGiftCardActivateToggleProps) => { const intl = useIntl(); const notify = useNotifier(); @@ -30,7 +30,7 @@ const useGiftCardActivateToggle = ({ if (!!errors?.length) { notify({ status: "error", - text: intl.formatMessage(commonErrorMessages.unknownError) + text: intl.formatMessage(commonErrorMessages.unknownError), }); return; @@ -38,19 +38,19 @@ const useGiftCardActivateToggle = ({ notify({ status: "success", - text: intl.formatMessage(messages.successfullyEnabledTitle) + text: intl.formatMessage(messages.successfullyEnabledTitle), }); if (!!onActivateActionComplete) { onActivateActionComplete(); } }, - refetchQueries: [GIFT_CARD_DETAILS_QUERY] + refetchQueries: [GIFT_CARD_DETAILS_QUERY], }); const [ giftCardDeactivate, - giftCardDeactivateOpts + giftCardDeactivateOpts, ] = useGiftCardDeactivateMutation({ onCompleted: data => { const errors = data?.giftCardDeactivate?.errors; @@ -58,21 +58,21 @@ const useGiftCardActivateToggle = ({ if (!!errors?.length) { notify({ status: "error", - text: intl.formatMessage(commonErrorMessages.unknownError) + text: intl.formatMessage(commonErrorMessages.unknownError), }); return; } notify({ status: "success", - text: intl.formatMessage(messages.successfullyDisabledTitle) + text: intl.formatMessage(messages.successfullyDisabledTitle), }); if (!!onDeactivateActionComplete) { onDeactivateActionComplete(); } }, - refetchQueries: [GIFT_CARD_DETAILS_QUERY] + refetchQueries: [GIFT_CARD_DETAILS_QUERY], }); const currentOpts = isActive ? giftCardDeactivateOpts : giftCardActivateOpts; @@ -82,7 +82,7 @@ const useGiftCardActivateToggle = ({ giftCardActivateOpts, giftCardDeactivate, giftCardDeactivateOpts, - currentOpts + currentOpts, }; }; diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdatePageHeader/messages.ts b/src/giftCards/GiftCardUpdate/GiftCardUpdatePageHeader/messages.ts index ff409c6e4..8a1f5b192 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardUpdatePageHeader/messages.ts +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdatePageHeader/messages.ts @@ -4,29 +4,29 @@ export const giftCardEnableDisableSectionMessages = defineMessages({ successfullyEnabledTitle: { id: "bDO9DN", defaultMessage: "Successfully enabled gift card", - description: "success gift card enable message" + description: "success gift card enable message", }, successfullyDisabledTitle: { id: "GibKGn", defaultMessage: "Successfully disabled gift card", - description: "success gift card disable message" - } + description: "success gift card disable message", + }, }); export const giftCardUpdatePageHeaderMessages = defineMessages({ resendButtonLabel: { id: "lCPxtT", defaultMessage: "Resend code", - description: "resend code label" + description: "resend code label", }, expiredStatusLabel: { id: "aPYFO1", defaultMessage: "Expired", - description: "expired status label" + description: "expired status label", }, disabledStatusLabel: { id: "EA7rjI", defaultMessage: "Disabled", - description: "disabled status label" - } + description: "disabled status label", + }, }); diff --git a/src/giftCards/GiftCardUpdate/GiftCardUpdatePageHeader/styles.ts b/src/giftCards/GiftCardUpdate/GiftCardUpdatePageHeader/styles.ts index d3e75e505..543bcfb27 100644 --- a/src/giftCards/GiftCardUpdate/GiftCardUpdatePageHeader/styles.ts +++ b/src/giftCards/GiftCardUpdate/GiftCardUpdatePageHeader/styles.ts @@ -4,10 +4,10 @@ const useStyles = makeStyles( { title: { alignItems: "center", - display: "inline-flex" - } + display: "inline-flex", + }, }, - { name: "GiftCardUpdatePageHeader" } + { name: "GiftCardUpdatePageHeader" }, ); export default useStyles; diff --git a/src/giftCards/GiftCardUpdate/messages.ts b/src/giftCards/GiftCardUpdate/messages.ts index a2c5c36bd..d9db2aa33 100644 --- a/src/giftCards/GiftCardUpdate/messages.ts +++ b/src/giftCards/GiftCardUpdate/messages.ts @@ -1,6 +1,6 @@ import { GiftCardErrorCode, GiftCardErrorFragment } from "@saleor/graphql"; import commonErrorMessages, { - getCommonFormFieldErrorMessage + getCommonFormFieldErrorMessage, } from "@saleor/utils/errors/common"; import { defineMessages, IntlShape } from "react-intl"; @@ -8,21 +8,21 @@ export const giftCardUpdateDetailsCardMessages = defineMessages({ title: { id: "xPnZ0R", defaultMessage: "Details", - description: "title" - } + description: "title", + }, }); const giftCardErrorMessages = defineMessages({ notFound: { id: "29L5Yq", defaultMessage: "Couldn't find gift card", - description: "gift card not found message" - } + description: "gift card not found message", + }, }); export function getGiftCardErrorMessage( error: Omit | undefined, - intl: IntlShape + intl: IntlShape, ): string { if (error) { switch (error.code) { diff --git a/src/giftCards/GiftCardUpdate/providers/GiftCardDetailsProvider/GiftCardDetailsProvider.tsx b/src/giftCards/GiftCardUpdate/providers/GiftCardDetailsProvider/GiftCardDetailsProvider.tsx index 2c84562b1..97e4b9879 100644 --- a/src/giftCards/GiftCardUpdate/providers/GiftCardDetailsProvider/GiftCardDetailsProvider.tsx +++ b/src/giftCards/GiftCardUpdate/providers/GiftCardDetailsProvider/GiftCardDetailsProvider.tsx @@ -20,16 +20,16 @@ export const GiftCardDetailsContext = createContext< const GiftCardDetailsProvider: React.FC = ({ children, - id + id, }) => { const { data, loading } = useGiftCardDetailsQuery({ displayLoader: true, - variables: { id } + variables: { id }, }); const providerValues: GiftCardDetailsConsumerProps = { giftCard: getExtendedGiftCard(data?.giftCard), - loading + loading, }; return ( diff --git a/src/giftCards/GiftCardUpdate/providers/GiftCardDetailsProvider/hooks/useGiftCardDetails.ts b/src/giftCards/GiftCardUpdate/providers/GiftCardDetailsProvider/hooks/useGiftCardDetails.ts index e69e12161..87deb74cd 100644 --- a/src/giftCards/GiftCardUpdate/providers/GiftCardDetailsProvider/hooks/useGiftCardDetails.ts +++ b/src/giftCards/GiftCardUpdate/providers/GiftCardDetailsProvider/hooks/useGiftCardDetails.ts @@ -2,7 +2,7 @@ import { useContext } from "react"; import { GiftCardDetailsConsumerProps, - GiftCardDetailsContext + GiftCardDetailsContext, } from "../GiftCardDetailsProvider"; const useGiftCardDetails = (): GiftCardDetailsConsumerProps => { diff --git a/src/giftCards/GiftCardUpdate/providers/GiftCardDetailsProvider/utils.ts b/src/giftCards/GiftCardUpdate/providers/GiftCardDetailsProvider/utils.ts index bd177865d..8fd2b76c2 100644 --- a/src/giftCards/GiftCardUpdate/providers/GiftCardDetailsProvider/utils.ts +++ b/src/giftCards/GiftCardUpdate/providers/GiftCardDetailsProvider/utils.ts @@ -3,7 +3,7 @@ import moment from "moment"; import { ExtendedGiftCard, GiftCardBase } from "./types"; export function isGiftCardExpired( - giftCard: T + giftCard: T, ): boolean { if (!giftCard?.expiryDate) { return false; @@ -13,7 +13,7 @@ export function isGiftCardExpired( } export function getExtendedGiftCard( - giftCard?: T + giftCard?: T, ): ExtendedGiftCard { if (!giftCard) { return undefined; @@ -21,6 +21,6 @@ export function getExtendedGiftCard( return { ...giftCard, - isExpired: isGiftCardExpired(giftCard) + isExpired: isGiftCardExpired(giftCard), }; } diff --git a/src/giftCards/GiftCardUpdate/providers/GiftCardUpdateDialogsProvider/GiftCardUpdateDialogsProvider.tsx b/src/giftCards/GiftCardUpdate/providers/GiftCardUpdateDialogsProvider/GiftCardUpdateDialogsProvider.tsx index 6e9a847af..bc19241b8 100644 --- a/src/giftCards/GiftCardUpdate/providers/GiftCardUpdateDialogsProvider/GiftCardUpdateDialogsProvider.tsx +++ b/src/giftCards/GiftCardUpdate/providers/GiftCardUpdateDialogsProvider/GiftCardUpdateDialogsProvider.tsx @@ -8,7 +8,7 @@ import GiftCardResendCodeDialog from "../../GiftCardResendCodeDialog"; import GiftCardUpdateBalanceDialog from "../../GiftCardUpdateBalanceDialog"; import { GiftCardUpdatePageActionParamsEnum, - GiftCardUpdatePageUrlQueryParams + GiftCardUpdatePageUrlQueryParams, } from "../../types"; import useGiftCardDetails from "../GiftCardDetailsProvider/hooks/useGiftCardDetails"; @@ -32,7 +32,7 @@ export const GiftCardUpdateDialogsContext = createContext< const GiftCardUpdateDialogsProvider: React.FC = ({ children, params, - id + id, }) => { const navigate = useNavigator(); @@ -41,7 +41,7 @@ const GiftCardUpdateDialogsProvider: React.FC openDialog(SET_BALANCE), openDeleteDialog: () => openDialog(DELETE), openResendCodeDialog: () => openDialog(RESEND_CODE), - onClose + onClose, }; return ( diff --git a/src/giftCards/GiftCardUpdate/providers/GiftCardUpdateDialogsProvider/hooks/useGiftCardUpdateDialogs.ts b/src/giftCards/GiftCardUpdate/providers/GiftCardUpdateDialogsProvider/hooks/useGiftCardUpdateDialogs.ts index 41dacb2e3..f11f6d661 100644 --- a/src/giftCards/GiftCardUpdate/providers/GiftCardUpdateDialogsProvider/hooks/useGiftCardUpdateDialogs.ts +++ b/src/giftCards/GiftCardUpdate/providers/GiftCardUpdateDialogsProvider/hooks/useGiftCardUpdateDialogs.ts @@ -2,7 +2,7 @@ import { useContext } from "react"; import { GiftCardUpdateDialogsConsumerProps, - GiftCardUpdateDialogsContext + GiftCardUpdateDialogsContext, } from "../GiftCardUpdateDialogsProvider"; const useGiftCardUpdateDialogs = (): GiftCardUpdateDialogsConsumerProps => { diff --git a/src/giftCards/GiftCardUpdate/providers/GiftCardUpdateFormProvider/GiftCardUpdateFormProvider.tsx b/src/giftCards/GiftCardUpdate/providers/GiftCardUpdateFormProvider/GiftCardUpdateFormProvider.tsx index 3e3b31d0d..908d91055 100644 --- a/src/giftCards/GiftCardUpdate/providers/GiftCardUpdateFormProvider/GiftCardUpdateFormProvider.tsx +++ b/src/giftCards/GiftCardUpdate/providers/GiftCardUpdateFormProvider/GiftCardUpdateFormProvider.tsx @@ -5,7 +5,7 @@ import { GiftCardUpdateMutation, useGiftCardUpdateMutation, useUpdateMetadataMutation, - useUpdatePrivateMetadataMutation + useUpdatePrivateMetadataMutation, } from "@saleor/graphql"; import { MutationResultWithOpts } from "@saleor/hooks/makeMutation"; import useForm, { FormChange, UseFormResult } from "@saleor/hooks/useForm"; @@ -23,7 +23,7 @@ import { useIntl } from "react-intl"; import { GiftCardCreateFormData, - initialData as emptyFormData + initialData as emptyFormData, } from "../../../GiftCardCreateDialog/GiftCardCreateDialogForm"; import useGiftCardDetails from "../GiftCardDetailsProvider/hooks/useGiftCardDetails"; @@ -55,19 +55,19 @@ export const GiftCardUpdateFormContext = createContext< const getGiftCardTagsAddRemoveData = ( initTags: string[], - changedTags: string[] + changedTags: string[], ) => { const removed = difference(initTags, changedTags); const added = difference(changedTags, initTags); return { addTags: added, - removeTags: removed + removeTags: removed, }; }; const GiftCardUpdateFormProvider: React.FC = ({ - children + children, }) => { const notify = useNotifier(); const intl = useIntl(); @@ -87,7 +87,7 @@ const GiftCardUpdateFormProvider: React.FC = ({ tags: tags.map(({ name }) => name), expiryDate, privateMetadata: privateMetadata?.map(mapMetadataItemToInput), - metadata: metadata?.map(mapMetadataItemToInput) + metadata: metadata?.map(mapMetadataItemToInput), }; }; @@ -100,16 +100,16 @@ const GiftCardUpdateFormProvider: React.FC = ({ hasExpiryError ? { title: intl.formatMessage( - giftCardUpdateFormMessages.giftCardInvalidExpiryDateHeader + giftCardUpdateFormMessages.giftCardInvalidExpiryDateHeader, ), text: intl.formatMessage( - giftCardUpdateFormMessages.giftCardInvalidExpiryDateContent + giftCardUpdateFormMessages.giftCardInvalidExpiryDateContent, ), - status: "error" + status: "error", } - : getDefaultNotifierSuccessErrorData(errors, intl) + : getDefaultNotifierSuccessErrorData(errors, intl), ); - } + }, }); const submit = async ({ tags, expiryDate }: GiftCardUpdateFormData) => { @@ -120,10 +120,10 @@ const GiftCardUpdateFormProvider: React.FC = ({ expiryDate, ...getGiftCardTagsAddRemoveData( giftCard.tags.map(el => el.name), - tags - ) - } - } + tags, + ), + }, + }, }); return result?.data?.giftCardUpdate?.errors; @@ -137,32 +137,32 @@ const GiftCardUpdateFormProvider: React.FC = ({ giftCard, submit, variables => updateMetadata({ variables }), - variables => updatePrivateMetadata({ variables }) + variables => updatePrivateMetadata({ variables }), ); const handleFormSubmit = useHandleFormSubmit({ formId, - onSubmit: handleSubmit + onSubmit: handleSubmit, }); const { isMetadataModified, isPrivateMetadataModified, - makeChangeHandler: makeMetadataChangeHandler + makeChangeHandler: makeMetadataChangeHandler, } = useMetadataChangeTrigger(); const changeMetadata = makeMetadataChangeHandler(change); const submitData: GiftCardUpdateFormData = { ...data, - ...getMetadata(data, isMetadataModified, isPrivateMetadataModified) + ...getMetadata(data, isMetadataModified, isPrivateMetadataModified), }; const formSubmit = () => handleFormSubmit(submitData); const formErrors = getFormErrors( ["tags", "expiryDate"], - updateGiftCardOpts?.data?.giftCardUpdate?.errors + updateGiftCardOpts?.data?.giftCardUpdate?.errors, ); const providerValues = { @@ -171,8 +171,8 @@ const GiftCardUpdateFormProvider: React.FC = ({ formErrors, submit: formSubmit, handlers: { - changeMetadata - } + changeMetadata, + }, }; return ( diff --git a/src/giftCards/GiftCardUpdate/providers/GiftCardUpdateFormProvider/hooks/useGiftCardUpdate.ts b/src/giftCards/GiftCardUpdate/providers/GiftCardUpdateFormProvider/hooks/useGiftCardUpdate.ts index 2acfacc57..20dd3eb89 100644 --- a/src/giftCards/GiftCardUpdate/providers/GiftCardUpdateFormProvider/hooks/useGiftCardUpdate.ts +++ b/src/giftCards/GiftCardUpdate/providers/GiftCardUpdateFormProvider/hooks/useGiftCardUpdate.ts @@ -2,7 +2,7 @@ import { useContext } from "react"; import { GiftCardUpdateFormConsumerData, - GiftCardUpdateFormContext + GiftCardUpdateFormContext, } from "../GiftCardUpdateFormProvider"; const useGiftCardUpdate = (): Pick => { diff --git a/src/giftCards/GiftCardUpdate/providers/GiftCardUpdateFormProvider/hooks/useGiftCardUpdateForm.ts b/src/giftCards/GiftCardUpdate/providers/GiftCardUpdateFormProvider/hooks/useGiftCardUpdateForm.ts index a8e083ec3..f1cc22d4f 100644 --- a/src/giftCards/GiftCardUpdate/providers/GiftCardUpdateFormProvider/hooks/useGiftCardUpdateForm.ts +++ b/src/giftCards/GiftCardUpdate/providers/GiftCardUpdateFormProvider/hooks/useGiftCardUpdateForm.ts @@ -5,7 +5,7 @@ import { useContext } from "react"; import { GiftCardUpdateFormContext, GiftCardUpdateFormData, - GiftCardUpdateFormErrors + GiftCardUpdateFormErrors, } from "../GiftCardUpdateFormProvider"; type UseGiftCardUpdateFormProps = UseFormResult & diff --git a/src/giftCards/GiftCardUpdate/types.ts b/src/giftCards/GiftCardUpdate/types.ts index d13994de0..cef6ef5fa 100644 --- a/src/giftCards/GiftCardUpdate/types.ts +++ b/src/giftCards/GiftCardUpdate/types.ts @@ -3,7 +3,7 @@ import { Dialog } from "@saleor/types"; export enum GiftCardUpdatePageActionParamsEnum { SET_BALANCE = "set-balance", DELETE = "delete", - RESEND_CODE = "resend-code" + RESEND_CODE = "resend-code", } export type GiftCardUpdatePageUrlQueryParams = Dialog< diff --git a/src/giftCards/GiftCardsList/GiftCardListSearchAndFilters/GiftCardListSearchAndFilters.tsx b/src/giftCards/GiftCardsList/GiftCardListSearchAndFilters/GiftCardListSearchAndFilters.tsx index 5e1000b12..550f4d0ff 100644 --- a/src/giftCards/GiftCardsList/GiftCardListSearchAndFilters/GiftCardListSearchAndFilters.tsx +++ b/src/giftCards/GiftCardsList/GiftCardListSearchAndFilters/GiftCardListSearchAndFilters.tsx @@ -1,7 +1,7 @@ import DeleteFilterTabDialog from "@saleor/components/DeleteFilterTabDialog"; import FilterBar from "@saleor/components/FilterBar"; import SaveFilterTabDialog, { - SaveFilterTabDialogFormData + SaveFilterTabDialogFormData, } from "@saleor/components/SaveFilterTabDialog"; import { DEFAULT_INITIAL_SEARCH_DATA } from "@saleor/config"; import { giftCardListUrl } from "@saleor/giftCards/urls"; @@ -29,11 +29,11 @@ import { getFilterQueryParam, getFiltersCurrentTab, getFilterTabs, - saveFilterTab + saveFilterTab, } from "./filters"; import { giftCardListFilterErrorMessages as errorMessages, - giftCardListSearchAndFiltersMessages as messages + giftCardListSearchAndFiltersMessages as messages, } from "./messages"; const GiftCardListSearchAndFilters: React.FC = () => { @@ -45,62 +45,62 @@ const GiftCardListSearchAndFilters: React.FC = () => { const { onClose, openSearchDeleteDialog, - openSearchSaveDialog + openSearchSaveDialog, } = useGiftCardListDialogs(); const defaultSearchVariables = { - variables: { ...DEFAULT_INITIAL_SEARCH_DATA, first: 5 } + variables: { ...DEFAULT_INITIAL_SEARCH_DATA, first: 5 }, }; const { loadMore: fetchMoreCustomers, search: searchCustomers, - result: searchCustomersResult + result: searchCustomersResult, } = useCustomerSearch(defaultSearchVariables); const { loadMore: fetchMoreProducts, search: searchProducts, - result: searchProductsResult + result: searchProductsResult, } = useProductSearch(defaultSearchVariables); const { loadMore: fetchMoreGiftCardTags, search: searchGiftCardTags, - result: searchGiftCardTagsResult + result: searchGiftCardTagsResult, } = useGiftCardTagsSearch(defaultSearchVariables); const { data: giftCardCurrenciesData, - loading: loadingGiftCardCurrencies + loading: loadingGiftCardCurrencies, } = useGiftCardCurrenciesQuery(); const filterOpts = getFilterOpts({ params, productSearchProps: { ...getSearchFetchMoreProps(searchProductsResult, fetchMoreProducts), - onSearchChange: searchProducts + onSearchChange: searchProducts, }, products: mapEdgesToItems(searchProductsResult?.data?.search), currencies: giftCardCurrenciesData?.giftCardCurrencies, loadingCurrencies: loadingGiftCardCurrencies, customerSearchProps: { ...getSearchFetchMoreProps(searchCustomersResult, fetchMoreCustomers), - onSearchChange: searchCustomers + onSearchChange: searchCustomers, }, customers: mapEdgesToItems(searchCustomersResult?.data?.search), tagSearchProps: { ...getSearchFetchMoreProps( searchGiftCardTagsResult, - fetchMoreGiftCardTags + fetchMoreGiftCardTags, ), - onSearchChange: searchGiftCardTags + onSearchChange: searchGiftCardTags, }, tags: compact( mapEdgesToItems(searchGiftCardTagsResult?.data?.search)?.map( - ({ name }) => name - ) - ) + ({ name }) => name, + ), + ), }); const filterStructure = createFilterStructure(intl, filterOpts); @@ -111,13 +111,13 @@ const GiftCardListSearchAndFilters: React.FC = () => { const [ changeFilters, resetFilters, - handleSearchChange + handleSearchChange, ] = createFilterHandlers({ createUrl: giftCardListUrl, getFilterQueryParam, navigate, params, - cleanupFn: reset + cleanupFn: reset, }); const handleTabChange = (tab: number) => { @@ -125,8 +125,8 @@ const GiftCardListSearchAndFilters: React.FC = () => { navigate( giftCardListUrl({ activeTab: tab.toString(), - ...getFilterTabs()[tab - 1].data - }) + ...getFilterTabs()[tab - 1].data, + }), ); }; @@ -148,7 +148,7 @@ const GiftCardListSearchAndFilters: React.FC = () => { initialBalanceAmount: errorMessages.balanceAmount, initialBalanceCurrency: errorMessages.balanceCurrency, currentBalanceAmount: errorMessages.balanceAmount, - currentBalanceCurrency: errorMessages.balanceCurrency + currentBalanceCurrency: errorMessages.balanceCurrency, }} tabs={tabs.map(tab => tab.name)} currentTab={currentTab} @@ -161,7 +161,7 @@ const GiftCardListSearchAndFilters: React.FC = () => { onTabDelete={openSearchDeleteDialog} onTabSave={openSearchSaveDialog} searchPlaceholder={intl.formatMessage(messages.searchPlaceholder, { - exampleGiftCardCode: "21F1-39DY-V4U2" + exampleGiftCardCode: "21F1-39DY-V4U2", })} allTabLabel={intl.formatMessage(messages.defaultTabLabel)} /> diff --git a/src/giftCards/GiftCardsList/GiftCardListSearchAndFilters/filters.ts b/src/giftCards/GiftCardsList/GiftCardListSearchAndFilters/filters.ts index 2b9874269..fe482dea9 100644 --- a/src/giftCards/GiftCardsList/GiftCardListSearchAndFilters/filters.ts +++ b/src/giftCards/GiftCardsList/GiftCardListSearchAndFilters/filters.ts @@ -2,7 +2,7 @@ import { FilterElement, IFilter } from "@saleor/components/Filter"; import { GiftCardFilterInput, SearchCustomersQuery, - SearchProductsQuery + SearchProductsQuery, } from "@saleor/graphql"; import { RelayToFlat } from "@saleor/types"; import { @@ -11,17 +11,17 @@ import { dedupeFilter, getMinMaxQueryParam, getMultipleValueQueryParam, - getSingleValueQueryParam + getSingleValueQueryParam, } from "@saleor/utils/filters"; import { createAutocompleteField, createNumberField, - createOptionsField + createOptionsField, } from "@saleor/utils/filters/fields"; import { mapNodeToChoice, mapPersonNodeToChoice, - mapSingleValueNodeToChoice + mapSingleValueNodeToChoice, } from "@saleor/utils/maps"; import { defineMessages, IntlShape } from "react-intl"; @@ -32,7 +32,7 @@ import { GiftCardListUrlFilters, GiftCardListUrlFiltersEnum, GiftCardStatusFilterEnum, - SearchWithFetchMoreProps + SearchWithFetchMoreProps, } from "./types"; export const GIFT_CARD_FILTERS_KEY = "giftCardFilters"; @@ -58,14 +58,14 @@ export const getFilterOpts = ({ customers, customerSearchProps, tags, - tagSearchProps + tagSearchProps, }: GiftCardFilterOptsProps): GiftCardListFilterOpts => ({ currency: { active: !!params?.currency, value: params?.currency, choices: mapSingleValueNodeToChoice(currencies), displayValues: mapSingleValueNodeToChoice(currencies), - loading: loadingCurrencies + loading: loadingCurrencies, }, product: { active: !!params?.product, @@ -76,7 +76,7 @@ export const getFilterOpts = ({ hasMore: productSearchProps.hasMore, loading: productSearchProps.loading, onFetchMore: productSearchProps.onFetchMore, - onSearchChange: productSearchProps.onSearchChange + onSearchChange: productSearchProps.onSearchChange, }, usedBy: { active: !!params?.usedBy, @@ -87,7 +87,7 @@ export const getFilterOpts = ({ hasMore: customerSearchProps.hasMore, loading: customerSearchProps.loading, onFetchMore: customerSearchProps.onFetchMore, - onSearchChange: customerSearchProps.onSearchChange + onSearchChange: customerSearchProps.onSearchChange, }, tag: { active: !!params?.tag, @@ -98,36 +98,36 @@ export const getFilterOpts = ({ hasMore: tagSearchProps.hasMore, loading: tagSearchProps.loading, onFetchMore: tagSearchProps.onFetchMore, - onSearchChange: tagSearchProps.onSearchChange + onSearchChange: tagSearchProps.onSearchChange, }, initialBalanceAmount: { active: [params.initialBalanceAmountFrom, params.initialBalanceAmountTo].some( - field => field !== undefined + field => field !== undefined, ) || false, value: { max: params.initialBalanceAmountTo || "", - min: params.initialBalanceAmountFrom || "" - } + min: params.initialBalanceAmountFrom || "", + }, }, currentBalanceAmount: { active: [params.currentBalanceAmountFrom, params.currentBalanceAmountTo].some( - field => field !== undefined + field => field !== undefined, ) || false, value: { max: params.currentBalanceAmountTo || "", - min: params.currentBalanceAmountFrom || "" - } + min: params.currentBalanceAmountFrom || "", + }, }, status: { active: !!params?.status, - value: params?.status - } + value: params?.status, + }, }); export function getFilterQueryParam( - filter: FilterElement + filter: FilterElement, ): GiftCardListUrlFilters { const { name } = filter; @@ -138,7 +138,7 @@ export function getFilterQueryParam( currency, usedBy, product, - status + status, } = GiftCardListFilterKeys; switch (name) { @@ -155,14 +155,14 @@ export function getFilterQueryParam( return getMinMaxQueryParam( filter, GiftCardListUrlFiltersEnum.initialBalanceAmountFrom, - GiftCardListUrlFiltersEnum.initialBalanceAmountTo + GiftCardListUrlFiltersEnum.initialBalanceAmountTo, ); case currentBalanceAmount: return getMinMaxQueryParam( filter, GiftCardListUrlFiltersEnum.currentBalanceAmountFrom, - GiftCardListUrlFiltersEnum.currentBalanceAmountTo + GiftCardListUrlFiltersEnum.currentBalanceAmountTo, ); } } @@ -171,84 +171,84 @@ export const messages = defineMessages({ balanceAmountLabel: { id: "bVbEZ/", defaultMessage: "Amount", - description: "amount filter label" + description: "amount filter label", }, tagLabel: { id: "mE+fru", defaultMessage: "Tags", - description: "tag filter label" + description: "tag filter label", }, currencyLabel: { id: "osPBn1", defaultMessage: "Currency", - description: "currency filter label" + description: "currency filter label", }, productLabel: { id: "Sjd7wm", defaultMessage: "Product", - description: "product filter label" + description: "product filter label", }, usedByLabel: { id: "WMGoqz", defaultMessage: "Used by", - description: "used by filter label" + description: "used by filter label", }, statusLabel: { id: "D4CsYK", defaultMessage: "Status", - description: "status filter label" + description: "status filter label", }, enabledOptionLabel: { id: "vC8vyb", defaultMessage: "Enabled", - description: "enabled status option label" + description: "enabled status option label", }, disabledOptionLabel: { id: "+WTmpr", defaultMessage: "Disabled", - description: "disabled status option label" + description: "disabled status option label", }, initialBalanceLabel: { id: "VceXrc", defaultMessage: "Initial balance", - description: "initial balance filter label" + description: "initial balance filter label", }, currentBalanceLabel: { id: "e/61NZ", defaultMessage: "Current balance", - description: "current balance filter label" - } + description: "current balance filter label", + }, }); export function createFilterStructure( intl: IntlShape, - opts: GiftCardListFilterOpts + opts: GiftCardListFilterOpts, ): IFilter { return [ { ...createNumberField( GiftCardListFilterKeys.initialBalanceAmount, intl.formatMessage(messages.initialBalanceLabel), - opts.initialBalanceAmount.value + opts.initialBalanceAmount.value, ), multiple: opts?.initialBalanceAmount?.value?.min !== opts?.initialBalanceAmount?.value?.max, active: opts.initialBalanceAmount.active, - dependencies: [GiftCardListFilterKeys.currency] + dependencies: [GiftCardListFilterKeys.currency], }, { ...createNumberField( GiftCardListFilterKeys.currentBalanceAmount, intl.formatMessage(messages.currentBalanceLabel), - opts.currentBalanceAmount.value + opts.currentBalanceAmount.value, ), multiple: opts?.currentBalanceAmount?.value?.min !== opts?.currentBalanceAmount?.value?.max, active: opts.currentBalanceAmount.active, - dependencies: [GiftCardListFilterKeys.currency] + dependencies: [GiftCardListFilterKeys.currency], }, { ...createOptionsField( @@ -256,9 +256,9 @@ export function createFilterStructure( intl.formatMessage(messages.currencyLabel), [opts.currency.value], false, - opts.currency.choices + opts.currency.choices, ), - active: opts.currency.active + active: opts.currency.active, }, { ...createAutocompleteField( @@ -273,10 +273,10 @@ export function createFilterStructure( initialSearch: "", loading: opts.tag.loading, onFetchMore: opts.tag.onFetchMore, - onSearchChange: opts.tag.onSearchChange - } + onSearchChange: opts.tag.onSearchChange, + }, ), - active: opts.tag.active + active: opts.tag.active, }, { ...createAutocompleteField( @@ -291,10 +291,10 @@ export function createFilterStructure( initialSearch: "", loading: opts.product.loading, onFetchMore: opts.product.onFetchMore, - onSearchChange: opts.product.onSearchChange - } + onSearchChange: opts.product.onSearchChange, + }, ), - active: opts.product.active + active: opts.product.active, }, { ...createAutocompleteField( @@ -309,10 +309,10 @@ export function createFilterStructure( initialSearch: "", loading: opts.usedBy.loading, onFetchMore: opts.usedBy.onFetchMore, - onSearchChange: opts.usedBy.onSearchChange - } + onSearchChange: opts.usedBy.onSearchChange, + }, ), - active: opts.usedBy.active + active: opts.usedBy.active, }, { ...createOptionsField( @@ -323,31 +323,31 @@ export function createFilterStructure( [ { label: intl.formatMessage(messages.enabledOptionLabel), - value: GiftCardStatusFilterEnum.enabled + value: GiftCardStatusFilterEnum.enabled, }, { label: intl.formatMessage(messages.disabledOptionLabel), - value: GiftCardStatusFilterEnum.disabled - } - ] + value: GiftCardStatusFilterEnum.disabled, + }, + ], ), - active: opts.status.active - } + active: opts.status.active, + }, ]; } export const { deleteFilterTab, getFilterTabs, - saveFilterTab + saveFilterTab, } = createFilterTabUtils(GIFT_CARD_FILTERS_KEY); export const { areFiltersApplied, getActiveFilters, - getFiltersCurrentTab + getFiltersCurrentTab, } = createFilterUtils( - GiftCardListUrlFiltersEnum + GiftCardListUrlFiltersEnum, ); export function getFilterVariables({ @@ -360,7 +360,7 @@ export function getFilterVariables({ currentBalanceAmountFrom, initialBalanceAmountTo, initialBalanceAmountFrom, - query + query, }: GiftCardListUrlQueryParams): GiftCardFilterInput { const balanceData = currency ? { @@ -368,16 +368,16 @@ export function getFilterVariables({ currentBalanceAmountFrom && currentBalanceAmountTo ? { gte: parseFloat(currentBalanceAmountFrom), - lte: parseFloat(currentBalanceAmountTo) + lte: parseFloat(currentBalanceAmountTo), } : undefined, initialBalance: initialBalanceAmountFrom && initialBalanceAmountTo ? { gte: parseFloat(initialBalanceAmountFrom), - lte: parseFloat(initialBalanceAmountTo) + lte: parseFloat(initialBalanceAmountTo), } - : undefined + : undefined, } : {}; @@ -388,6 +388,6 @@ export function getFilterVariables({ usedBy, products: product, currency, - ...balanceData + ...balanceData, }; } diff --git a/src/giftCards/GiftCardsList/GiftCardListSearchAndFilters/messages.ts b/src/giftCards/GiftCardsList/GiftCardListSearchAndFilters/messages.ts index cdcb3198a..77a03b1e9 100644 --- a/src/giftCards/GiftCardsList/GiftCardListSearchAndFilters/messages.ts +++ b/src/giftCards/GiftCardsList/GiftCardListSearchAndFilters/messages.ts @@ -4,24 +4,24 @@ export const giftCardListFilterErrorMessages = defineMessages({ balanceAmount: { id: "kcMVsB", defaultMessage: "Balance amount is missing", - description: "balance amound missing error message" + description: "balance amound missing error message", }, balanceCurrency: { id: "tXIgmR", defaultMessage: "Balance currency is missing", - description: "balance curreny missing error message" - } + description: "balance curreny missing error message", + }, }); export const giftCardListSearchAndFiltersMessages = defineMessages({ searchPlaceholder: { id: "labkPK", defaultMessage: "Search Gift Cards, e.g {exampleGiftCardCode}", - description: "search gift card placeholder" + description: "search gift card placeholder", }, defaultTabLabel: { id: "tTuCYj", defaultMessage: "All Gift Cards", - description: "all gift cards label" - } + description: "all gift cards label", + }, }); diff --git a/src/giftCards/GiftCardsList/GiftCardListSearchAndFilters/types.ts b/src/giftCards/GiftCardsList/GiftCardListSearchAndFilters/types.ts index 18c2c8ed1..fba72e673 100644 --- a/src/giftCards/GiftCardsList/GiftCardListSearchAndFilters/types.ts +++ b/src/giftCards/GiftCardsList/GiftCardListSearchAndFilters/types.ts @@ -6,7 +6,7 @@ import { FiltersWithMultipleValues, MinMax, Search, - SearchProps + SearchProps, } from "@saleor/types"; export enum GiftCardListUrlFiltersEnum { @@ -15,13 +15,13 @@ export enum GiftCardListUrlFiltersEnum { initialBalanceAmountTo = "initialBalanceAmountTo", currentBalanceAmountFrom = "currentBalanceAmountFrom", currentBalanceAmountTo = "currentBalanceAmountTo", - status = "status" + status = "status", } export enum GiftCardListUrlFiltersWithMultipleValuesEnum { tag = "tag", product = "product", - usedBy = "usedBy" + usedBy = "usedBy", } export enum GiftCardListFilterKeys { @@ -34,7 +34,7 @@ export enum GiftCardListFilterKeys { tag = "tag", product = "product", usedBy = "usedBy", - status = "status" + status = "status", } export type GiftCardListUrlFilters = Filters & @@ -54,5 +54,5 @@ export type SearchWithFetchMoreProps = FetchMoreProps & Search & SearchProps; export enum GiftCardStatusFilterEnum { enabled = "enabled", - disabled = "disabled" + disabled = "disabled", } diff --git a/src/giftCards/GiftCardsList/GiftCardsListHeader/GiftCardsListHeader.tsx b/src/giftCards/GiftCardsList/GiftCardsListHeader/GiftCardsListHeader.tsx index 7ec579b7f..7700801c9 100644 --- a/src/giftCards/GiftCardsList/GiftCardsListHeader/GiftCardsListHeader.tsx +++ b/src/giftCards/GiftCardsList/GiftCardsListHeader/GiftCardsListHeader.tsx @@ -19,7 +19,7 @@ const GiftCardsListHeader: React.FC = () => { const { openCreateDialog, openBulkCreateDialog, - openExportDialog + openExportDialog, } = useGiftCardListDialogs(); const openSettings = () => navigate(giftCardSettingsUrl); @@ -28,18 +28,18 @@ const GiftCardsListHeader: React.FC = () => { { label: intl.formatMessage(messages.settings), testId: "settingsMenuItem", - onSelect: openSettings + onSelect: openSettings, }, { label: intl.formatMessage(messages.bulkIssue), testId: "bulkIssueMenuItem", - onSelect: openBulkCreateDialog + onSelect: openBulkCreateDialog, }, { label: intl.formatMessage(messages.exportCodes), testId: "exportCodesMenuItem", - onSelect: openExportDialog - } + onSelect: openExportDialog, + }, ]; return ( diff --git a/src/giftCards/GiftCardsList/GiftCardsListHeader/GiftCardsListHeaderAlert.tsx b/src/giftCards/GiftCardsList/GiftCardsListHeader/GiftCardsListHeaderAlert.tsx index d7f52998c..95f6de140 100644 --- a/src/giftCards/GiftCardsList/GiftCardsListHeader/GiftCardsListHeaderAlert.tsx +++ b/src/giftCards/GiftCardsList/GiftCardsListHeader/GiftCardsListHeaderAlert.tsx @@ -11,7 +11,7 @@ const GiftCardsListHeaderAlert: React.FC = () => { const { data: giftCardProductsCount, - loading: giftCardProductsCountLoading + loading: giftCardProductsCountLoading, } = useGiftCardProductsCountQuery(); const giftCardProductTypesExist = diff --git a/src/giftCards/GiftCardsList/GiftCardsListHeader/GiftCardsListHeaderAlertContent.tsx b/src/giftCards/GiftCardsList/GiftCardsListHeader/GiftCardsListHeaderAlertContent.tsx index 419ca71e1..0ca2d4100 100644 --- a/src/giftCards/GiftCardsList/GiftCardsListHeader/GiftCardsListHeaderAlertContent.tsx +++ b/src/giftCards/GiftCardsList/GiftCardsListHeader/GiftCardsListHeaderAlertContent.tsx @@ -15,12 +15,12 @@ interface GiftCardsListHeaderAlertContentProps { const GiftCardsListHeaderAlertContent: React.FC = ({ giftCardProductTypesExist, - giftCardProductsExist + giftCardProductsExist, }) => { const classes = useStyles({}); const giftCardProductTypeUrl = productTypeAddUrl({ - kind: ProductTypeKindEnum.GIFT_CARD + kind: ProductTypeKindEnum.GIFT_CARD, }); const giftCardCreateGiftCardProductUrl = productAddUrl(); @@ -34,7 +34,7 @@ const GiftCardsListHeaderAlertContent: React.FC - ) + ), }} /> ); @@ -52,7 +52,7 @@ const GiftCardsListHeaderAlertContent: React.FC - ) + ), }} /> ); diff --git a/src/giftCards/GiftCardsList/GiftCardsListHeader/styles.ts b/src/giftCards/GiftCardsList/GiftCardsListHeader/styles.ts index fc1f5c010..290fb7143 100644 --- a/src/giftCards/GiftCardsList/GiftCardsListHeader/styles.ts +++ b/src/giftCards/GiftCardsList/GiftCardsListHeader/styles.ts @@ -4,13 +4,13 @@ const useStyles = makeStyles( theme => ({ preview: { position: "absolute", - top: theme.spacing(-4) + top: theme.spacing(-4), }, title: { - position: "relative" - } + position: "relative", + }, }), - { name: "GiftCardListHeader" } + { name: "GiftCardListHeader" }, ); export default useStyles; diff --git a/src/giftCards/GiftCardsList/GiftCardsListOrderInfoCard/GiftCardsListOrderInfoCard.tsx b/src/giftCards/GiftCardsList/GiftCardsListOrderInfoCard/GiftCardsListOrderInfoCard.tsx index 1f3288be8..7ae6ea915 100644 --- a/src/giftCards/GiftCardsList/GiftCardsListOrderInfoCard/GiftCardsListOrderInfoCard.tsx +++ b/src/giftCards/GiftCardsList/GiftCardsListOrderInfoCard/GiftCardsListOrderInfoCard.tsx @@ -15,7 +15,7 @@ const GiftCardsListOrderInfoCard: React.FC = () => ( values={{ link: content => ( {content} - ) + ), }} />
diff --git a/src/giftCards/GiftCardsList/GiftCardsListOrderInfoCard/messages.ts b/src/giftCards/GiftCardsList/GiftCardsListOrderInfoCard/messages.ts index 6c308def4..69a2bcaae 100644 --- a/src/giftCards/GiftCardsList/GiftCardsListOrderInfoCard/messages.ts +++ b/src/giftCards/GiftCardsList/GiftCardsListOrderInfoCard/messages.ts @@ -5,6 +5,6 @@ export const giftCardListOrderCardMessages = defineMessages({ id: "31hYP2", defaultMessage: "Gift cards will appear after their order is fullfilled. View Orders with Gift Cards", - description: "alert card message" - } + description: "alert card message", + }, }); diff --git a/src/giftCards/GiftCardsList/GiftCardsListTable/GiftCardsListTable.tsx b/src/giftCards/GiftCardsList/GiftCardsListTable/GiftCardsListTable.tsx index 88b0e6ad1..f6bc17024 100644 --- a/src/giftCards/GiftCardsList/GiftCardsListTable/GiftCardsListTable.tsx +++ b/src/giftCards/GiftCardsList/GiftCardsListTable/GiftCardsListTable.tsx @@ -3,7 +3,7 @@ import { TableBody, TableCell, TableRow, - Typography + Typography, } from "@material-ui/core"; import HorizontalSpacer from "@saleor/apps/components/HorizontalSpacer"; import Checkbox from "@saleor/components/Checkbox"; @@ -47,7 +47,7 @@ const GiftCardsListTable: React.FC = () => { isSelected, giftCards, numberOfColumns, - params + params, } = useGiftCardList(); const { openDeleteDialog } = useGiftCardListDialogs(); @@ -58,8 +58,8 @@ const GiftCardsListTable: React.FC = () => { navigate( giftCardListUrl({ ...params, - sort: GiftCardUrlSortField.usedBy - }) + sort: GiftCardUrlSortField.usedBy, + }), ); } }); @@ -101,7 +101,7 @@ const GiftCardsListTable: React.FC = () => { usedByEmail, tags, product, - currentBalance + currentBalance, } = giftCard; return ( @@ -125,7 +125,7 @@ const GiftCardsListTable: React.FC = () => {
{intl.formatMessage(messages.codeEndingWithLabel, { - last4CodeChars + last4CodeChars, })} <> @@ -185,7 +185,7 @@ const GiftCardsListTable: React.FC = () => { - ) + ), )} diff --git a/src/giftCards/GiftCardsList/GiftCardsListTable/GiftCardsListTableFooter.tsx b/src/giftCards/GiftCardsList/GiftCardsListTable/GiftCardsListTableFooter.tsx index 549d28b06..140e776cf 100644 --- a/src/giftCards/GiftCardsList/GiftCardsListTable/GiftCardsListTableFooter.tsx +++ b/src/giftCards/GiftCardsList/GiftCardsListTable/GiftCardsListTableFooter.tsx @@ -12,13 +12,13 @@ const GiftCardsListTableFooter: React.FC = () => { pageInfo: apiPageInfo, paginationState, params, - numberOfColumns + numberOfColumns, } = useGiftCardList(); const paginationValues = usePaginator({ pageInfo: apiPageInfo, paginationState, - queryString: params + queryString: params, }); return ( diff --git a/src/giftCards/GiftCardsList/GiftCardsListTable/GiftCardsListTableHeader/BulkEnableDisableSection.tsx b/src/giftCards/GiftCardsList/GiftCardsListTable/GiftCardsListTableHeader/BulkEnableDisableSection.tsx index ee2bc9a2f..4635493f9 100644 --- a/src/giftCards/GiftCardsList/GiftCardsListTable/GiftCardsListTableHeader/BulkEnableDisableSection.tsx +++ b/src/giftCards/GiftCardsList/GiftCardsListTable/GiftCardsListTableHeader/BulkEnableDisableSection.tsx @@ -2,7 +2,7 @@ import ConfirmButton from "@saleor/components/ConfirmButton"; import { IMessage } from "@saleor/components/messages"; import { useGiftCardBulkActivateMutation, - useGiftCardBulkDeactivateMutation + useGiftCardBulkDeactivateMutation, } from "@saleor/graphql"; import useNotifier from "@saleor/hooks/useNotifier"; import { getByIds } from "@saleor/orders/components/OrderReturnPage/utils"; @@ -37,7 +37,7 @@ const BulkEnableDisableSection: React.FC = () => { const [ activateGiftCards, - activateGiftCardsOpts + activateGiftCardsOpts, ] = useGiftCardBulkActivateMutation({ onCompleted: data => { const { errors, count } = data?.giftCardBulkActivate; @@ -45,13 +45,15 @@ const BulkEnableDisableSection: React.FC = () => { const notifierData: IMessage = !!errors?.length ? { status: "error", - text: intl.formatMessage(messages.errorActivateAlertText, { count }) + text: intl.formatMessage(messages.errorActivateAlertText, { + count, + }), } : { status: "success", text: intl.formatMessage(messages.successActivateAlertText, { - count - }) + count, + }), }; notify(notifierData); @@ -60,12 +62,12 @@ const BulkEnableDisableSection: React.FC = () => { reset(); } }, - refetchQueries: [GIFT_CARD_LIST_QUERY] + refetchQueries: [GIFT_CARD_LIST_QUERY], }); const [ deactivateGiftCards, - deactivateGiftCardsOpts + deactivateGiftCardsOpts, ] = useGiftCardBulkDeactivateMutation({ onCompleted: data => { const { errors, count } = data?.giftCardBulkDeactivate; @@ -74,14 +76,14 @@ const BulkEnableDisableSection: React.FC = () => { ? { status: "error", text: intl.formatMessage(messages.errorDeactivateAlertText, { - count - }) + count, + }), } : { status: "success", text: intl.formatMessage(messages.successDeactivateAlertText, { - count - }) + count, + }), }; notify(notifierData); @@ -90,7 +92,7 @@ const BulkEnableDisableSection: React.FC = () => { reset(); } }, - refetchQueries: [GIFT_CARD_LIST_QUERY] + refetchQueries: [GIFT_CARD_LIST_QUERY], }); const handleActivateGiftCards = () => diff --git a/src/giftCards/GiftCardsList/GiftCardsListTable/GiftCardsListTableHeader/GiftCardsListTableHeader.tsx b/src/giftCards/GiftCardsList/GiftCardsListTable/GiftCardsListTableHeader/GiftCardsListTableHeader.tsx index 274474828..c6494e70c 100644 --- a/src/giftCards/GiftCardsList/GiftCardsListTable/GiftCardsListTableHeader/GiftCardsListTableHeader.tsx +++ b/src/giftCards/GiftCardsList/GiftCardsListTable/GiftCardsListTableHeader/GiftCardsListTableHeader.tsx @@ -2,13 +2,13 @@ import { TableCell } from "@material-ui/core"; import DeleteIconButton from "@saleor/components/DeleteIconButton"; import TableCellHeader, { TableCellHeaderArrowDirection, - TableCellHeaderProps + TableCellHeaderProps, } from "@saleor/components/TableCellHeader"; import TableHead from "@saleor/components/TableHead"; import TooltipTableCellHeader from "@saleor/components/TooltipTableCellHeader"; import { commonTooltipMessages } from "@saleor/components/TooltipTableCellHeader/messages"; import Label, { - LabelSizes + LabelSizes, } from "@saleor/orders/components/OrderHistory/Label"; import { getArrowDirection } from "@saleor/utils/sort"; import React from "react"; @@ -35,7 +35,7 @@ interface GiftCardsListTableHeaderProps { } const GiftCardsListTableHeader: React.FC = ({ - isCurrencySelected + isCurrencySelected, }) => { const intl = useIntl(); const classes = useStyles({}); @@ -45,7 +45,7 @@ const GiftCardsListTableHeader: React.FC = ({ numberOfColumns, loading, toggleAll, - listElements + listElements, } = useGiftCardList(); const { openDeleteDialog } = useGiftCardListDialogs(); const { onSort, sort } = useGiftCardList(); @@ -58,22 +58,22 @@ const GiftCardsListTableHeader: React.FC = ({ title: messages.giftCardsTableColumnGiftCardTitle, options: { className: classes.colCardCode, - textAlign: "left" - } + textAlign: "left", + }, }, { - title: messages.giftCardsTableColumnTagTitle + title: messages.giftCardsTableColumnTagTitle, }, { title: messages.giftCardsTableColumnProductTitle, onClick: () => onSort(GiftCardUrlSortField.product), - direction: getDirection(GiftCardUrlSortField.product) + direction: getDirection(GiftCardUrlSortField.product), }, { title: messages.giftCardsTableColumnCustomerTitle, onClick: () => onSort(GiftCardUrlSortField.usedBy), - direction: getDirection(GiftCardUrlSortField.usedBy) - } + direction: getDirection(GiftCardUrlSortField.usedBy), + }, ]; const headerTooltipItem: HeaderItem & { @@ -83,14 +83,14 @@ const GiftCardsListTableHeader: React.FC = ({ title: messages.giftCardsTableColumnBalanceTitle, options: { className: classes.colBalance, - textAlign: "right" + textAlign: "right", }, onClick: () => onSort(GiftCardUrlSortField.balance), direction: getDirection(GiftCardUrlSortField.balance), disabled: !canBeSorted(GiftCardUrlSortField.balance, isCurrencySelected), tooltip: intl.formatMessage(commonTooltipMessages.noFilterSelected, { - filterName: {filterLabels.currencyLabel.defaultMessage} - }) + filterName: {filterLabels.currencyLabel.defaultMessage}, + }), }; const { title, ...headerTooltipItemProps } = headerTooltipItem; diff --git a/src/giftCards/GiftCardsList/GiftCardsListTable/GiftCardsListTableHeader/messages.ts b/src/giftCards/GiftCardsList/GiftCardsListTable/GiftCardsListTableHeader/messages.ts index 392ce60c2..818f1d967 100644 --- a/src/giftCards/GiftCardsList/GiftCardsListTable/GiftCardsListTableHeader/messages.ts +++ b/src/giftCards/GiftCardsList/GiftCardsListTable/GiftCardsListTableHeader/messages.ts @@ -4,40 +4,40 @@ export const bulkEnableDisableSectionMessages = defineMessages({ enableLabel: { id: "hz+9ES", defaultMessage: "Activate", - description: "bulk activate label" + description: "bulk activate label", }, disableLabel: { id: "IzEVek", defaultMessage: "Deactivate", - description: "bulk disable label" + description: "bulk disable label", }, deleteLabel: { id: "qkt/Km", defaultMessage: "Delete", - description: "bulk delete label" + description: "bulk delete label", }, successActivateAlertText: { id: "IwEQvz", defaultMessage: "Successfully activated gift {count,plural,one{card} other{cards}}", - description: "success activate alert message" + description: "success activate alert message", }, successDeactivateAlertText: { id: "SO56cv", defaultMessage: "Successfully deactivated gift {count,plural,one{card} other{cards}}", - description: "success deactivate alert message" + description: "success deactivate alert message", }, errorActivateAlertText: { id: "KcsJKm", defaultMessage: "Error activating gift {count,plural,one{card} other{cards}}", - description: "error with activatation alert message" + description: "error with activatation alert message", }, errorDeactivateAlertText: { id: "C90nKP", defaultMessage: "Errors deactivating gift {count,plural,one{card} other{cards}}", - description: "error with deactivatation alert message" - } + description: "error with deactivatation alert message", + }, }); diff --git a/src/giftCards/GiftCardsList/messages.ts b/src/giftCards/GiftCardsList/messages.ts index af031fc73..e570513c7 100644 --- a/src/giftCards/GiftCardsList/messages.ts +++ b/src/giftCards/GiftCardsList/messages.ts @@ -4,110 +4,110 @@ export const giftCardsListHeaderMenuItemsMessages = defineMessages({ settings: { id: "F69lwk", defaultMessage: "Settings", - description: "settings menu item" + description: "settings menu item", }, bulkIssue: { id: "9hab/1", defaultMessage: "Bulk Issue", - description: "bulk issue menu item" + description: "bulk issue menu item", }, exportCodes: { id: "exvX+Z", defaultMessage: "Export card codes", - description: "export card codes menu item" + description: "export card codes menu item", }, issueButtonLabel: { id: "RfPJ1E", defaultMessage: "Issue card", - description: "issue card button label" + description: "issue card button label", }, noGiftCardsAlertTitle: { id: "E22x4H", defaultMessage: "You haven’t defined a gift card product!", - description: "no card defuned alert message" + description: "no card defuned alert message", }, noGiftCardsProductsAndProductTypes: { id: "U9o2bV", defaultMessage: "{createGiftCardProductType} and {giftCardProduct} to start selling gift cards in your store.", - description: "no gift card products and types alert message" + description: "no gift card products and types alert message", }, noGiftCardsProductTypes: { id: "VI+X8H", defaultMessage: "{createGiftCardProductType} to start selling gift cards in your store.", - description: "no gift card product types alert message" + description: "no gift card product types alert message", }, noGiftCardsProducts: { id: "jmh0rV", defaultMessage: "{createGiftCardProduct} to start selling gift cards in your store.", - description: "no gift card products alert message" + description: "no gift card products alert message", }, createGiftCardProductType: { id: "8Hq18g", defaultMessage: "Create a gift card product type", - description: "create gift card product type alert message" + description: "create gift card product type alert message", }, createGiftCardProduct: { id: "HqeqEV", defaultMessage: "Create a gift card product", - description: "create gift card product alert message" + description: "create gift card product alert message", }, giftCardProduct: { id: "AJgl5u", defaultMessage: "gift card product", - description: "gift card product message" - } + description: "gift card product message", + }, }); export const giftCardsListTableMessages = defineMessages({ giftCardsTableColumnGiftCardTitle: { id: "eLJQSh", defaultMessage: "Gift Card", - description: "column title gift card" + description: "column title gift card", }, giftCardsTableColumnTagTitle: { id: "FEWgh/", defaultMessage: "Tag", - description: "column title tag" + description: "column title tag", }, giftCardsTableColumnProductTitle: { id: "bwJc6V", defaultMessage: "Product", - description: "column title product" + description: "column title product", }, giftCardsTableColumnCustomerTitle: { id: "MJBAqv", defaultMessage: "Used by", - description: "column title used by/customer" + description: "column title used by/customer", }, giftCardsTableColumnBalanceTitle: { id: "MbZHXE", defaultMessage: "Balance", - description: "column title balance" + description: "column title balance", }, codeEndingWithLabel: { id: "38dS1A", defaultMessage: "Code ending with {last4CodeChars}", - description: "code ending with label" + description: "code ending with label", }, noGiftCardsFound: { id: "Rd0s80", defaultMessage: "No gift cards found", - description: "no cards found title message" - } + description: "no cards found title message", + }, }); export const giftCardUpdateFormMessages = defineMessages({ giftCardInvalidExpiryDateHeader: { id: "l1/Hwb", defaultMessage: "Incorrect date entered", - description: "invalid date in expirydate field header" + description: "invalid date in expirydate field header", }, giftCardInvalidExpiryDateContent: { id: "rCy3Fe", defaultMessage: "Gift Card with past expiration date cannot be created", - description: "invalid date in expirydate field content" - } + description: "invalid date in expirydate field content", + }, }); diff --git a/src/giftCards/GiftCardsList/providers/GiftCardListDialogsProvider/GiftCardListDialogsProvider.tsx b/src/giftCards/GiftCardsList/providers/GiftCardListDialogsProvider/GiftCardListDialogsProvider.tsx index 314ca9d41..7a397128a 100644 --- a/src/giftCards/GiftCardsList/providers/GiftCardListDialogsProvider/GiftCardListDialogsProvider.tsx +++ b/src/giftCards/GiftCardsList/providers/GiftCardListDialogsProvider/GiftCardListDialogsProvider.tsx @@ -11,7 +11,7 @@ import React, { createContext, useContext } from "react"; import { GIFT_CARD_LIST_QUERY } from "../../queries"; import { GiftCardListActionParamsEnum, - GiftCardListUrlQueryParams + GiftCardListUrlQueryParams, } from "../../types"; interface GiftCardListDialogsProviderProps { @@ -39,7 +39,7 @@ export const useGiftCardListDialogs = () => const GiftCardListDialogsProvider: React.FC = ({ children, - params + params, }) => { const navigate = useNavigator(); @@ -76,7 +76,7 @@ const GiftCardListDialogsProvider: React.FC = openSearchSaveDialog, openSearchDeleteDialog, onClose, - id + id, }; return ( diff --git a/src/giftCards/GiftCardsList/providers/GiftCardListProvider/GiftCardListProvider.tsx b/src/giftCards/GiftCardsList/providers/GiftCardListProvider/GiftCardListProvider.tsx index 31861414f..2b4a9bcdd 100644 --- a/src/giftCards/GiftCardsList/providers/GiftCardListProvider/GiftCardListProvider.tsx +++ b/src/giftCards/GiftCardsList/providers/GiftCardListProvider/GiftCardListProvider.tsx @@ -5,13 +5,13 @@ import { giftCardListUrl } from "@saleor/giftCards/urls"; import { GiftCardListQuery, GiftCardListQueryVariables, - useGiftCardListQuery + useGiftCardListQuery, } from "@saleor/graphql"; import useBulkActions, { - UseBulkActionsProps + UseBulkActionsProps, } from "@saleor/hooks/useBulkActions"; import useListSettings, { - UseListSettings + UseListSettings, } from "@saleor/hooks/useListSettings"; import useNavigator from "@saleor/hooks/useNavigator"; import useNotifier from "@saleor/hooks/useNotifier"; @@ -19,7 +19,7 @@ import { usePaginationReset } from "@saleor/hooks/usePaginationReset"; import { createPaginationState, PageInfo, - PaginationState + PaginationState, } from "@saleor/hooks/usePaginator"; import { ListViews, SortPage } from "@saleor/types"; import createSortHandler from "@saleor/utils/handlers/sortHandler"; @@ -31,7 +31,7 @@ import { getFilterVariables } from "../../GiftCardListSearchAndFilters/filters"; import { GiftCardListColummns, GiftCardListUrlQueryParams, - GiftCardUrlSortField + GiftCardUrlSortField, } from "../../types"; import { getSortQueryVariables } from "./sort"; @@ -59,20 +59,20 @@ export interface GiftCardsListConsumerProps } export const GiftCardsListContext = createContext( - null + null, ); export const useGiftCardList = () => useContext(GiftCardsListContext); export const GiftCardsListProvider: React.FC = ({ children, - params + params, }) => { const navigate = useNavigator(); const notify = useNotifier(); const { isSelected, listElements, reset, toggle, toggleAll } = useBulkActions( - [] + [], ); const { updateListSettings, settings } = useListSettings< @@ -89,9 +89,9 @@ export const GiftCardsListProvider: React.FC = ({ () => ({ ...paginationState, filter: getFilterVariables(params), - sort: getSortQueryVariables(params) + sort: getSortQueryVariables(params), }), - [params, paginationState] + [params, paginationState], ); const handleGiftCardListError = (error: ApolloError) => { @@ -100,7 +100,7 @@ export const GiftCardsListProvider: React.FC = ({ if (!!message) { notify({ status: "error", - text: message + text: message, }); } }; @@ -108,7 +108,7 @@ export const GiftCardsListProvider: React.FC = ({ const { data, loading } = useGiftCardListQuery({ displayLoader: true, variables: queryVariables, - handleError: handleGiftCardListError + handleError: handleGiftCardListError, }); const giftCards = mapEdgesToItems(data?.giftCards)?.map(getExtendedGiftCard); @@ -130,7 +130,7 @@ export const GiftCardsListProvider: React.FC = ({ params, settings, updateListSettings, - numberOfColumns + numberOfColumns, }; return ( diff --git a/src/giftCards/GiftCardsList/providers/GiftCardListProvider/sort.ts b/src/giftCards/GiftCardsList/providers/GiftCardListProvider/sort.ts index 261f4d48b..efaf6c0de 100644 --- a/src/giftCards/GiftCardsList/providers/GiftCardListProvider/sort.ts +++ b/src/giftCards/GiftCardsList/providers/GiftCardListProvider/sort.ts @@ -4,7 +4,7 @@ import { createGetSortQueryVariables } from "@saleor/utils/sort"; import { GiftCardUrlSortField } from "../../types"; export const getSortQueryField = ( - sort: GiftCardUrlSortField + sort: GiftCardUrlSortField, ): GiftCardSortField => { switch (sort) { case GiftCardUrlSortField.balance: @@ -19,5 +19,5 @@ export const getSortQueryField = ( }; export const getSortQueryVariables = createGetSortQueryVariables( - getSortQueryField + getSortQueryField, ); diff --git a/src/giftCards/GiftCardsList/sort.ts b/src/giftCards/GiftCardsList/sort.ts index b39272480..6eeee4231 100644 --- a/src/giftCards/GiftCardsList/sort.ts +++ b/src/giftCards/GiftCardsList/sort.ts @@ -2,7 +2,7 @@ import { GiftCardUrlSortField } from "./types"; export function canBeSorted( sort: GiftCardUrlSortField, - isCurrencySelected: boolean + isCurrencySelected: boolean, ) { switch (sort) { case GiftCardUrlSortField.balance: diff --git a/src/giftCards/GiftCardsList/styles.ts b/src/giftCards/GiftCardsList/styles.ts index e217fba3f..ba4ed44c2 100644 --- a/src/giftCards/GiftCardsList/styles.ts +++ b/src/giftCards/GiftCardsList/styles.ts @@ -4,45 +4,45 @@ export const useTableStyles = makeStyles( theme => ({ cardCodeContainer: { display: "flex", - alignItems: "baseline" + alignItems: "baseline", }, colCardCode: { paddingLeft: 0, - width: 400 + width: 400, }, colDelete: { - width: 88 + width: 88, }, colBalance: { - width: 135 + width: 135, }, colBase: { - width: 150 + width: 150, }, row: { cursor: "pointer", height: 70, "& td, & th": { - height: "auto" - } + height: "auto", + }, }, skeleton: { - paddingLeft: 0 + paddingLeft: 0, }, toolbar: { display: "flex", gap: theme.spacing(), - marginRight: theme.spacing(-0.5) - } + marginRight: theme.spacing(-0.5), + }, }), - { name: "GiftCardsListTable" } + { name: "GiftCardsListTable" }, ); export const useHeaderStyles = makeStyles( theme => ({ alertLink: { - fontSize: theme.typography.body2.fontSize - } + fontSize: theme.typography.body2.fontSize, + }, }), - { name: "GiftCardsListHeader" } + { name: "GiftCardsListHeader" }, ); diff --git a/src/giftCards/GiftCardsList/types.ts b/src/giftCards/GiftCardsList/types.ts index 7f5c2d0f7..fff1db68b 100644 --- a/src/giftCards/GiftCardsList/types.ts +++ b/src/giftCards/GiftCardsList/types.ts @@ -4,7 +4,7 @@ import { Pagination, Search, SingleAction, - Sort + Sort, } from "@saleor/types"; import { GiftCardListUrlFilters } from "./GiftCardListSearchAndFilters/types"; @@ -19,7 +19,7 @@ export type GiftCardListColummns = export enum GiftCardUrlSortField { usedBy = "usedBy", balance = "balance", - product = "product" + product = "product", } export type GiftCardUrlSort = Sort; @@ -30,7 +30,7 @@ export enum GiftCardListActionParamsEnum { SAVE_SEARCH = "save-search", DELETE_SEARCH = "delete-search", BULK_CREATE = "gift-card-bulk-create", - EXPORT = "gift-card-export" + EXPORT = "gift-card-export", } export type GiftCardListUrlQueryParams = Pagination & diff --git a/src/giftCards/components/GiftCardCustomerCard/CustomerGiftCardsCard.tsx b/src/giftCards/components/GiftCardCustomerCard/CustomerGiftCardsCard.tsx index db2eff90b..7607afc50 100644 --- a/src/giftCards/components/GiftCardCustomerCard/CustomerGiftCardsCard.tsx +++ b/src/giftCards/components/GiftCardCustomerCard/CustomerGiftCardsCard.tsx @@ -33,10 +33,10 @@ const CustomerGiftCardsCard: React.FC = () => { variables: { first: 5, filter: { - usedBy: [id] - } + usedBy: [id], + }, }, - skip: !id + skip: !id, }); const closeCreateDialog = () => setOpenCreateDialog(false); @@ -44,11 +44,11 @@ const CustomerGiftCardsCard: React.FC = () => { const giftCards = mapEdgesToItems(data?.giftCards); const classes = useCardActionsStyles({ - buttonPosition: giftCards?.length > 0 ? "right" : "left" + buttonPosition: giftCards?.length > 0 ? "right" : "left", }); const viewAllGiftCardsUrl = giftCardListUrl({ - usedBy: [id] + usedBy: [id], }); const handleCreateNewCardButton = () => { @@ -111,7 +111,7 @@ const CustomerGiftCardsCard: React.FC = () => { refetchQueries={[CUSTOMER_GIFT_CARD_LIST_QUERY]} initialCustomer={{ email: customer?.email, - name: getFullName(customer) + name: getFullName(customer), }} /> diff --git a/src/giftCards/components/GiftCardCustomerCard/CustomerGiftCardsCardListItem.tsx b/src/giftCards/components/GiftCardCustomerCard/CustomerGiftCardsCardListItem.tsx index 1b79b319c..9546fc5d5 100644 --- a/src/giftCards/components/GiftCardCustomerCard/CustomerGiftCardsCardListItem.tsx +++ b/src/giftCards/components/GiftCardCustomerCard/CustomerGiftCardsCardListItem.tsx @@ -19,7 +19,7 @@ interface CustomerGiftCardsCardListItemProps { } const CustomerGiftCardsCardListItem: React.FC = ({ - giftCard + giftCard, }) => { const intl = useIntl(); const classes = useListWrapperStyles(); @@ -32,24 +32,24 @@ const CustomerGiftCardsCardListItem: React.FC { giftCardActivate({ variables: { - id: giftCard.id - } + id: giftCard.id, + }, }); }; const handleGiftCardDeactivate = () => { giftCardDeactivate({ variables: { - id: giftCard.id - } + id: giftCard.id, + }, }); }; @@ -59,8 +59,8 @@ const CustomerGiftCardsCardListItem: React.FC diff --git a/src/giftCards/components/GiftCardCustomerCard/messages.ts b/src/giftCards/components/GiftCardCustomerCard/messages.ts index cdeea6996..7b955f903 100644 --- a/src/giftCards/components/GiftCardCustomerCard/messages.ts +++ b/src/giftCards/components/GiftCardCustomerCard/messages.ts @@ -4,26 +4,26 @@ export const giftCardCustomerCardMessages = defineMessages({ customerGiftCardsPresentSubtitle: { id: "vzce9B", defaultMessage: "Only five newest gift cards are shown here", - description: "customer gift cards card subtitle" + description: "customer gift cards card subtitle", }, customerGiftCardsAbsentSubtitle: { id: "vWTM6Y", defaultMessage: "There are no gift cards assigned to this customer", - description: "customer gift cards card no cards subtitle" + description: "customer gift cards card no cards subtitle", }, customerGiftCardsViewAllButton: { id: "FQc5z6", defaultMessage: "View All", - description: "customer gift cards card view all button" + description: "customer gift cards card view all button", }, customerGiftCardsIssueNewCardButton: { id: "mbOuGl", defaultMessage: "Issue new card", - description: "customer gift cards card issue button" + description: "customer gift cards card issue button", }, customerGiftCardsCardTitle: { id: "Utq1fE", defaultMessage: "Gift Cards", - description: "customer gift cards card title" - } + description: "customer gift cards card title", + }, }); diff --git a/src/giftCards/components/GiftCardCustomerCard/queries.ts b/src/giftCards/components/GiftCardCustomerCard/queries.ts index 44420e680..874c593d2 100644 --- a/src/giftCards/components/GiftCardCustomerCard/queries.ts +++ b/src/giftCards/components/GiftCardCustomerCard/queries.ts @@ -14,5 +14,5 @@ export const customerGiftCardListQuery = gql` `; export const CUSTOMER_GIFT_CARD_LIST_QUERY = getOperationAST( - customerGiftCardListQuery + customerGiftCardListQuery, ).name.value; diff --git a/src/giftCards/components/GiftCardCustomerCard/styles.ts b/src/giftCards/components/GiftCardCustomerCard/styles.ts index c68b75b99..0ed885b8e 100644 --- a/src/giftCards/components/GiftCardCustomerCard/styles.ts +++ b/src/giftCards/components/GiftCardCustomerCard/styles.ts @@ -9,13 +9,13 @@ export const useCardActionsStyles = makeStyles( cardActions: { padding: `${theme.spacing(2)} ${theme.spacing(3)}`, flexDirection: ({ buttonPosition }: CustomerGiftCardsCardActionsProps) => - buttonPosition === "left" ? "row" : "row-reverse" + buttonPosition === "left" ? "row" : "row-reverse", }, previewPill: { - marginLeft: theme.spacing(1) - } + marginLeft: theme.spacing(1), + }, }), - { name: "CustomerGiftCardsCard" } + { name: "CustomerGiftCardsCard" }, ); export const useListWrapperStyles = makeStyles( @@ -25,11 +25,11 @@ export const useListWrapperStyles = makeStyles( gridTemplateColumns: "max-content 1fr min-content", margin: theme.spacing(2, 3), alignItems: "center", - justifyItems: "center" + justifyItems: "center", }, listingMenu: { - gridColumn: "3" - } + gridColumn: "3", + }, }), - { name: "CustomerGiftCardListCard" } + { name: "CustomerGiftCardListCard" }, ); diff --git a/src/giftCards/components/GiftCardDeleteDialog/GiftCardDeleteDialogContent.tsx b/src/giftCards/components/GiftCardDeleteDialog/GiftCardDeleteDialogContent.tsx index 8c4faf840..4bc858077 100644 --- a/src/giftCards/components/GiftCardDeleteDialog/GiftCardDeleteDialogContent.tsx +++ b/src/giftCards/components/GiftCardDeleteDialog/GiftCardDeleteDialogContent.tsx @@ -1,10 +1,10 @@ import { CircularProgress, DialogContentText, - Typography + Typography, } from "@material-ui/core"; import ActionDialog, { - ActionDialogProps + ActionDialogProps, } from "@saleor/components/ActionDialog"; import DeleteWarningDialogConsentContent from "@saleor/components/TypeDeleteWarningDialog/DeleteWarningDialogConsentContent"; import { GiftCardsListConsumerProps } from "@saleor/giftCards/GiftCardsList/providers/GiftCardListProvider"; @@ -55,7 +55,7 @@ function GiftCardDeleteDialogContent< listElements, giftCards, giftCard, - loading + loading, }: GiftCardDeleteDialogContentProps) { const intl = useIntl(); const classes = useStyles({}); @@ -109,17 +109,17 @@ function GiftCardDeleteDialogContent< isConsentChecked={isConsentChecked} onConsentChange={setConsentChecked} description={intl.formatMessage(messages.withBalanceDescription, { - selectedItemsCount + selectedItemsCount, })} consentLabel={intl.formatMessage(messages.consentLabel, { - selectedItemsCount + selectedItemsCount, })} /> ) : ( {intl.formatMessage(messages.defaultDescription, { - selectedItemsCount + selectedItemsCount, })} diff --git a/src/giftCards/components/GiftCardDeleteDialog/GiftCardListPageDeleteDialog.tsx b/src/giftCards/components/GiftCardDeleteDialog/GiftCardListPageDeleteDialog.tsx index cf6ebce54..ce236268a 100644 --- a/src/giftCards/components/GiftCardDeleteDialog/GiftCardListPageDeleteDialog.tsx +++ b/src/giftCards/components/GiftCardDeleteDialog/GiftCardListPageDeleteDialog.tsx @@ -6,7 +6,7 @@ import { DialogProps } from "@saleor/types"; import React from "react"; import GiftCardDeleteDialogContent, { - SINGLE + SINGLE, } from "./GiftCardDeleteDialogContent"; import useGiftCardBulkDelete from "./useGiftCardBulkDelete"; import useGiftCardSingleDelete from "./useGiftCardSingleDelete"; @@ -18,7 +18,7 @@ interface GiftCardDeleteDialogProps extends DialogProps { const GiftCardDeleteDialog: React.FC = ({ open, onClose, - refetchQueries = [] + refetchQueries = [], }) => { const listProps = useGiftCardList(); const { giftCards, loading, selectedItemsCount } = listProps; @@ -30,15 +30,15 @@ const GiftCardDeleteDialog: React.FC = ({ const { onDeleteGiftCard, deleteGiftCardOpts } = useGiftCardSingleDelete({ id, onClose, - refetchQueries: [GIFT_CARD_LIST_QUERY, ...refetchQueries] + refetchQueries: [GIFT_CARD_LIST_QUERY, ...refetchQueries], }); const { onBulkDeleteGiftCards, - bulkDeleteGiftCardOpts + bulkDeleteGiftCardOpts, } = useGiftCardBulkDelete({ onClose, - refetchQueries: [GIFT_CARD_LIST_QUERY, ...refetchQueries] + refetchQueries: [GIFT_CARD_LIST_QUERY, ...refetchQueries], }); const dialogProps: Pick< @@ -47,11 +47,11 @@ const GiftCardDeleteDialog: React.FC = ({ > = !!id ? { onConfirm: onDeleteGiftCard, - confirmButtonState: deleteGiftCardOpts?.status + confirmButtonState: deleteGiftCardOpts?.status, } : { onConfirm: onBulkDeleteGiftCards, - confirmButtonState: bulkDeleteGiftCardOpts?.status + confirmButtonState: bulkDeleteGiftCardOpts?.status, }; return ( diff --git a/src/giftCards/components/GiftCardDeleteDialog/GiftCardUpdatePageDeleteDialog.tsx b/src/giftCards/components/GiftCardDeleteDialog/GiftCardUpdatePageDeleteDialog.tsx index 488f6b43e..38027f0a3 100644 --- a/src/giftCards/components/GiftCardDeleteDialog/GiftCardUpdatePageDeleteDialog.tsx +++ b/src/giftCards/components/GiftCardDeleteDialog/GiftCardUpdatePageDeleteDialog.tsx @@ -13,7 +13,7 @@ type GiftCardUpdatePageDeleteDialogProps = DialogProps & { const GiftCardUpdatePageDeleteDialog: React.FC = ({ onClose, open, - onDelete + onDelete, }) => { const { giftCard } = useGiftCardDetails(); @@ -21,7 +21,7 @@ const GiftCardUpdatePageDeleteDialog: React.FC void; refetchQueries?: string[]; @@ -28,12 +28,12 @@ const useGiftCardBulkDelete = ({ const { listElements, selectedItemsCount, - reset: resetSelectedItems + reset: resetSelectedItems, } = useGiftCardList(); const [ bulkDeleteGiftCard, - bulkDeleteGiftCardOpts + bulkDeleteGiftCardOpts, ] = useBulkDeleteGiftCardMutation({ onCompleted: data => { const errors = data?.giftCardBulkDelete?.errors; @@ -42,8 +42,8 @@ const useGiftCardBulkDelete = ({ notify({ status: "success", text: intl.formatMessage(messages.deleteSuccessAlertText, { - selectedItemsCount - }) + selectedItemsCount, + }), }); onClose(); @@ -53,10 +53,10 @@ const useGiftCardBulkDelete = ({ notify({ status: "error", - text: intl.formatMessage(commonErrorMessages.unknownError) + text: intl.formatMessage(commonErrorMessages.unknownError), }); }, - refetchQueries + refetchQueries, }); const onBulkDeleteGiftCards = () => @@ -64,7 +64,7 @@ const useGiftCardBulkDelete = ({ return { onBulkDeleteGiftCards, - bulkDeleteGiftCardOpts + bulkDeleteGiftCardOpts, }; }; diff --git a/src/giftCards/components/GiftCardDeleteDialog/useGiftCardSingleDelete.tsx b/src/giftCards/components/GiftCardDeleteDialog/useGiftCardSingleDelete.tsx index 9b8a0ea08..608ac5c31 100644 --- a/src/giftCards/components/GiftCardDeleteDialog/useGiftCardSingleDelete.tsx +++ b/src/giftCards/components/GiftCardDeleteDialog/useGiftCardSingleDelete.tsx @@ -1,7 +1,7 @@ import { getGiftCardErrorMessage } from "@saleor/giftCards/GiftCardUpdate/messages"; import { DeleteGiftCardMutation, - useDeleteGiftCardMutation + useDeleteGiftCardMutation, } from "@saleor/graphql"; import { MutationResultWithOpts } from "@saleor/hooks/makeMutation"; import useNotifier from "@saleor/hooks/useNotifier"; @@ -18,7 +18,7 @@ const useGiftCardSingleDelete = ({ id, onClose, refetchQueries, - onSuccess + onSuccess, }: { id: string; onClose: () => void; @@ -36,8 +36,8 @@ const useGiftCardSingleDelete = ({ notify({ status: "success", text: intl.formatMessage(messages.deleteSuccessAlertText, { - selectedItemsCount: 1 - }) + selectedItemsCount: 1, + }), }); onClose(); @@ -52,18 +52,18 @@ const useGiftCardSingleDelete = ({ errors.map(error => notify({ status: "error", - text: getGiftCardErrorMessage(error, intl) - }) + text: getGiftCardErrorMessage(error, intl), + }), ); }, - refetchQueries + refetchQueries, }); const onDeleteGiftCard = () => deleteGiftCard({ variables: { id } }); return { onDeleteGiftCard, - deleteGiftCardOpts + deleteGiftCardOpts, }; }; diff --git a/src/giftCards/components/GiftCardSendToCustomer/GiftCardSendToCustomer.tsx b/src/giftCards/components/GiftCardSendToCustomer/GiftCardSendToCustomer.tsx index b14412293..75efaf466 100644 --- a/src/giftCards/components/GiftCardSendToCustomer/GiftCardSendToCustomer.tsx +++ b/src/giftCards/components/GiftCardSendToCustomer/GiftCardSendToCustomer.tsx @@ -27,7 +27,7 @@ const GiftCardSendToCustomer: React.FC = ({ selectedChannelSlug, selectedCustomer, setSelectedCustomer, - disabled = false + disabled = false, }) => { const { channel, availableChannels } = useAppChannel(false); @@ -35,7 +35,7 @@ const GiftCardSendToCustomer: React.FC = ({ useEffect( () => change({ target: { name: "channelSlug", value: channel?.slug } }), - [] + [], ); const intl = useIntl(); diff --git a/src/giftCards/components/GiftCardSendToCustomer/messages.ts b/src/giftCards/components/GiftCardSendToCustomer/messages.ts index 465dc798e..c342976c2 100644 --- a/src/giftCards/components/GiftCardSendToCustomer/messages.ts +++ b/src/giftCards/components/GiftCardSendToCustomer/messages.ts @@ -4,23 +4,23 @@ export const giftCardSendToCustomerMessages = defineMessages({ sendToCustomerSelectedLabel: { id: "Um3g00", defaultMessage: "Send gift card to customer", - description: "send to customer selected label" + description: "send to customer selected label", }, customerSubtitle: { id: "FRJRmi", defaultMessage: "Selected customer will be sent the generated gift card code. Someone else can redeem the gift card code. Gift card will be assigned to account which redeemed the code.", - description: "selected customer gift card is sent to subtitle" + description: "selected customer gift card is sent to subtitle", }, customerChannelSubtitle: { id: "0sd4ez", defaultMessage: "Customer will be sent the gift card code via this channels email address", - description: "selected customer channel subtitle" + description: "selected customer channel subtitle", }, channelSelectLabel: { id: "LA13a5", defaultMessage: "Channel", - description: "channel select label" - } + description: "channel select label", + }, }); diff --git a/src/giftCards/components/GiftCardSettingsExpirySelect/GiftCardSettingsExpirySelect.tsx b/src/giftCards/components/GiftCardSettingsExpirySelect/GiftCardSettingsExpirySelect.tsx index cde389b36..07a698e37 100644 --- a/src/giftCards/components/GiftCardSettingsExpirySelect/GiftCardSettingsExpirySelect.tsx +++ b/src/giftCards/components/GiftCardSettingsExpirySelect/GiftCardSettingsExpirySelect.tsx @@ -4,7 +4,7 @@ import ControlledCheckbox from "@saleor/components/ControlledCheckbox"; import { getGiftCardSettingsErrorMessage } from "@saleor/giftCards/GiftCardSettings/messages"; import { GiftCardSettingsErrorFragment, - TimePeriodTypeEnum + TimePeriodTypeEnum, } from "@saleor/graphql"; import { FormChange } from "@saleor/hooks/useForm"; import React from "react"; @@ -28,7 +28,7 @@ const GiftCardSettingsExpirySelect: React.FC disabled, expiryPeriodActive, expiryPeriodType, - expiryPeriodAmount + expiryPeriodAmount, }) => { const intl = useIntl(); @@ -57,7 +57,7 @@ const GiftCardSettingsExpirySelect: React.FC isError={!!errors?.expiryPeriod} helperText={getGiftCardSettingsErrorMessage( errors?.expiryPeriod, - intl + intl, )} change={change} periodType={expiryPeriodType} diff --git a/src/giftCards/components/GiftCardSettingsExpirySelect/messages.ts b/src/giftCards/components/GiftCardSettingsExpirySelect/messages.ts index d10b935aa..16e8e9731 100644 --- a/src/giftCards/components/GiftCardSettingsExpirySelect/messages.ts +++ b/src/giftCards/components/GiftCardSettingsExpirySelect/messages.ts @@ -4,12 +4,12 @@ export const giftCardSettingsExpirySelectMessages = defineMessages({ setExpirationPeriodTitle: { id: "j2l6cL", defaultMessage: "Set gift card expiration period", - description: "checkbox label" + description: "checkbox label", }, setExpirationPeriodDescription: { id: "ps+h1G", defaultMessage: "Expiration date will be automatically set, once gift card is issued", - description: "checkbox label description" - } + description: "checkbox label description", + }, }); diff --git a/src/giftCards/components/GiftCardStatusChip/GiftCardStatusChip.tsx b/src/giftCards/components/GiftCardStatusChip/GiftCardStatusChip.tsx index eff717fda..d9f09961b 100644 --- a/src/giftCards/components/GiftCardStatusChip/GiftCardStatusChip.tsx +++ b/src/giftCards/components/GiftCardStatusChip/GiftCardStatusChip.tsx @@ -1,6 +1,6 @@ import { ExtendedGiftCard, - GiftCardBase + GiftCardBase, } from "@saleor/giftCards/GiftCardUpdate/providers/GiftCardDetailsProvider/types"; import { Pill } from "@saleor/macaw-ui"; import React from "react"; @@ -25,7 +25,7 @@ function GiftCardStatusChip< ); @@ -36,7 +36,7 @@ function GiftCardStatusChip< ); diff --git a/src/giftCards/components/GiftCardTagInput/GiftCardTagInput.tsx b/src/giftCards/components/GiftCardTagInput/GiftCardTagInput.tsx index c3ed62b6b..41da6bad4 100644 --- a/src/giftCards/components/GiftCardTagInput/GiftCardTagInput.tsx +++ b/src/giftCards/components/GiftCardTagInput/GiftCardTagInput.tsx @@ -30,24 +30,24 @@ const GiftCardTagInput: React.FC = ({ values, error, optional = true, - loading + loading, }) => { const intl = useIntl(); const { loadMore, search, result } = useGiftCardTagsSearch({ - variables: DEFAULT_INITIAL_SEARCH_DATA + variables: DEFAULT_INITIAL_SEARCH_DATA, }); const choices = mapMultiValueNodeToChoice( uniq( - compact(mapEdgesToItems(result?.data?.search)?.map(({ name }) => name)) + compact(mapEdgesToItems(result?.data?.search)?.map(({ name }) => name)), ), - "tags" + "tags", ); const label = optional ? `${intl.formatMessage(messages.placeholder)} *${intl.formatMessage( - commonMessages.optionalField + commonMessages.optionalField, )}` : intl.formatMessage(messages.placeholder); diff --git a/src/giftCards/components/GiftCardTagInput/messages.ts b/src/giftCards/components/GiftCardTagInput/messages.ts index 703c8d47a..2486f8b3c 100644 --- a/src/giftCards/components/GiftCardTagInput/messages.ts +++ b/src/giftCards/components/GiftCardTagInput/messages.ts @@ -4,6 +4,6 @@ export const giftCardTagInputMessages = defineMessages({ placeholder: { id: "XFtKV5", defaultMessage: "Tag", - description: "input placeholder tag" - } + description: "input placeholder tag", + }, }); diff --git a/src/giftCards/components/GiftCardTagInput/utils.ts b/src/giftCards/components/GiftCardTagInput/utils.ts index 5579fa14f..c1b543749 100644 --- a/src/giftCards/components/GiftCardTagInput/utils.ts +++ b/src/giftCards/components/GiftCardTagInput/utils.ts @@ -1,9 +1,9 @@ import { MultiAutocompleteChoiceType } from "@saleor/components/MultiAutocompleteSelectField"; export const getMultiChoices = ( - values: string[] + values: string[], ): MultiAutocompleteChoiceType[] => values.map(tag => ({ label: tag, - value: tag + value: tag, })); diff --git a/src/giftCards/components/TimePeriodField/TimePeriodField.tsx b/src/giftCards/components/TimePeriodField/TimePeriodField.tsx index 612f1faa1..3e4f9f689 100644 --- a/src/giftCards/components/TimePeriodField/TimePeriodField.tsx +++ b/src/giftCards/components/TimePeriodField/TimePeriodField.tsx @@ -23,27 +23,27 @@ const TimePeriodField: React.FC = ({ amountFieldName, typeFieldName, helperText, - isError + isError, }) => { const intl = useIntl(); const options = [ { label: intl.formatMessage(messages.yearLabel), - value: TimePeriodTypeEnum.YEAR + value: TimePeriodTypeEnum.YEAR, }, { label: intl.formatMessage(messages.monthLabel), - value: TimePeriodTypeEnum.MONTH + value: TimePeriodTypeEnum.MONTH, }, { label: intl.formatMessage(messages.weekLabel), - value: TimePeriodTypeEnum.WEEK + value: TimePeriodTypeEnum.WEEK, }, { label: intl.formatMessage(messages.dayLabel), - value: TimePeriodTypeEnum.DAY - } + value: TimePeriodTypeEnum.DAY, + }, ]; return ( @@ -56,11 +56,11 @@ const TimePeriodField: React.FC = ({ type: "number", name: amountFieldName, value: periodAmount, - minValue: 0 + minValue: 0, }} selectFieldProps={{ name: typeFieldName, - value: periodType + value: periodType, }} /> ); diff --git a/src/giftCards/components/TimePeriodField/messages.ts b/src/giftCards/components/TimePeriodField/messages.ts index 6841cf7d4..ed7786511 100644 --- a/src/giftCards/components/TimePeriodField/messages.ts +++ b/src/giftCards/components/TimePeriodField/messages.ts @@ -4,21 +4,21 @@ export const timePeriodTextWithSelectFieldMessages = defineMessages({ yearLabel: { id: "Qe4XHv", defaultMessage: "years after issue", - description: "years after label" + description: "years after label", }, monthLabel: { id: "54KYgS", defaultMessage: "months after issue", - description: "months after label" + description: "months after label", }, weekLabel: { id: "15fg+o", defaultMessage: "weeks after issue", - description: "weeks after label" + description: "weeks after label", }, dayLabel: { id: "mzASqs", defaultMessage: "days after issue", - description: "days after label" - } + description: "days after label", + }, }); diff --git a/src/giftCards/index.tsx b/src/giftCards/index.tsx index bf424f984..e43f15bf8 100644 --- a/src/giftCards/index.tsx +++ b/src/giftCards/index.tsx @@ -10,14 +10,14 @@ import GiftCardSettings from "./GiftCardSettings"; import GiftCardListComponent from "./GiftCardsList"; import { GiftCardListUrlQueryParams, - GiftCardUrlSortField + GiftCardUrlSortField, } from "./GiftCardsList/types"; import GiftCardUpdateComponent from "./GiftCardUpdate"; import { GiftCardUpdatePageUrlQueryParams } from "./GiftCardUpdate/types"; import { giftCardPath, giftCardSettingsUrl, giftCardsListPath } from "./urls"; const GiftCardUpdatePage: React.FC> = ({ - match + match, }) => { const qs = parseQs(location.search.substr(1)); const params: GiftCardUpdatePageUrlQueryParams = qs; @@ -35,7 +35,7 @@ const GiftCardList: React.FC> = () => { const params: GiftCardListUrlQueryParams = asSortParams( qs, GiftCardUrlSortField, - GiftCardUrlSortField.usedBy + GiftCardUrlSortField.usedBy, ); return ; diff --git a/src/giftCards/urls.ts b/src/giftCards/urls.ts index 823f07e55..8c11f1913 100644 --- a/src/giftCards/urls.ts +++ b/src/giftCards/urls.ts @@ -15,7 +15,7 @@ export const giftCardPath = (id: string) => urlJoin(giftCardsListPath, id); export const giftCardUrl = ( id: string, - params?: GiftCardUpdatePageUrlQueryParams + params?: GiftCardUpdatePageUrlQueryParams, ) => giftCardPath(encodeURIComponent(id)) + "?" + stringifyQs(params); export const giftCardSettingsUrl = urlJoin(giftCardsListPath, "settings"); diff --git a/src/graphql/client.ts b/src/graphql/client.ts index 04b85658a..d5c7abb4a 100644 --- a/src/graphql/client.ts +++ b/src/graphql/client.ts @@ -11,7 +11,7 @@ import { TypedTypePolicies } from "./typePolicies.generated"; export const link = createUploadLink({ credentials: "include", uri: API_URI, - fetch: createFetch() + fetch: createFetch(), }); export const apolloClient = new ApolloClient({ @@ -19,26 +19,26 @@ export const apolloClient = new ApolloClient({ possibleTypes: introspectionQueryResultData.possibleTypes, typePolicies: { CountryDisplay: { - keyFields: ["code"] + keyFields: ["code"], }, Money: { - merge: false + merge: false, }, TaxedMoney: { - merge: false + merge: false, }, Weight: { - merge: false + merge: false, }, Shop: { - keyFields: [] - } - } as TypedTypePolicies + keyFields: [], + }, + } as TypedTypePolicies, }), - link + link, }); export const saleorClient = createSaleorClient({ apiUrl: API_URI, - channel: "" + channel: "", }); diff --git a/src/home/components/HomeActivityCard/HomeActivityCard.tsx b/src/home/components/HomeActivityCard/HomeActivityCard.tsx index 7c2041d46..08d76c850 100644 --- a/src/home/components/HomeActivityCard/HomeActivityCard.tsx +++ b/src/home/components/HomeActivityCard/HomeActivityCard.tsx @@ -3,7 +3,7 @@ import { List, ListItem, ListItemText, - Typography + Typography, } from "@material-ui/core"; import CardTitle from "@saleor/components/CardTitle"; import { DateTime } from "@saleor/components/Date"; @@ -21,14 +21,14 @@ const useStyles = makeStyles( { loadingProducts: { paddingBottom: "10px", - paddingTop: "10px" + paddingTop: "10px", }, noProducts: { paddingBottom: "16px", - paddingTop: "16px" - } + paddingTop: "16px", + }, }, - { name: "HomeActivityCard" } + { name: "HomeActivityCard" }, ); interface HomeActivityCardProps { @@ -48,7 +48,7 @@ const HomeActivityCard: React.FC = props => { title={intl.formatMessage({ id: "BXkF8Z", defaultMessage: "Activity", - description: "header" + description: "header", })} /> @@ -87,7 +87,7 @@ const HomeActivityCard: React.FC = props => { } /> - ) + ), )} diff --git a/src/home/components/HomeActivityCard/activityMessages.ts b/src/home/components/HomeActivityCard/activityMessages.ts index da9752ef6..368ab9dd0 100644 --- a/src/home/components/HomeActivityCard/activityMessages.ts +++ b/src/home/components/HomeActivityCard/activityMessages.ts @@ -4,44 +4,44 @@ import { defineMessages, IntlShape } from "react-intl"; const messages = defineMessages({ draft: { id: "sjRXXz", - defaultMessage: "Order #{orderId} was placed from draft by {userEmail}" + defaultMessage: "Order #{orderId} was placed from draft by {userEmail}", }, draft_no_email: { id: "BNTZLv", - defaultMessage: "Order #{orderId} was placed from draft" + defaultMessage: "Order #{orderId} was placed from draft", }, paid: { id: "5SPHkk", - defaultMessage: "Order #{orderId} was fully paid" + defaultMessage: "Order #{orderId} was fully paid", }, placed: { id: "0dPP8O", - defaultMessage: "Order #{orderId} was placed" - } + defaultMessage: "Order #{orderId} was placed", + }, }); export const getActivityMessage = ( activity: HomeQuery["activities"]["edges"][0]["node"], - intl: IntlShape + intl: IntlShape, ) => { switch (activity.type) { case OrderEventsEnum.ORDER_FULLY_PAID: return intl.formatMessage(messages.paid, { - orderId: activity.orderNumber + orderId: activity.orderNumber, }); case OrderEventsEnum.PLACED: return intl.formatMessage(messages.placed, { - orderId: activity.orderNumber + orderId: activity.orderNumber, }); case OrderEventsEnum.PLACED_FROM_DRAFT: if (!!activity.user?.email) { return intl.formatMessage(messages.draft, { orderId: activity.orderNumber, - userEmail: activity.user?.email + userEmail: activity.user?.email, }); } else { return intl.formatMessage(messages.draft_no_email, { - orderId: activity.orderNumber + orderId: activity.orderNumber, }); } diff --git a/src/home/components/HomeAnalyticsCard/HomeAnalyticsCard.tsx b/src/home/components/HomeAnalyticsCard/HomeAnalyticsCard.tsx index 04c344e80..929dcdd11 100644 --- a/src/home/components/HomeAnalyticsCard/HomeAnalyticsCard.tsx +++ b/src/home/components/HomeAnalyticsCard/HomeAnalyticsCard.tsx @@ -8,31 +8,31 @@ const useStyles = makeStyles( theme => ({ cardContent: { "&:last-child": { - padding: theme.spacing(2, 3) + padding: theme.spacing(2, 3), }, display: "grid", gridColumnGap: theme.spacing(3), - gridTemplateColumns: "1fr 64px" + gridTemplateColumns: "1fr 64px", }, cardSpacing: { [theme.breakpoints.down("sm")]: { - marginBottom: theme.spacing(1) + marginBottom: theme.spacing(1), }, - marginBottom: theme.spacing(3) + marginBottom: theme.spacing(3), }, cardSubtitle: { fontSize: 12, height: "20px", - lineHeight: 0.9 + lineHeight: 0.9, }, cardTitle: { fontSize: 20, - fontWeight: 500 as 500 + fontWeight: 500 as 500, }, icon: { color: theme.palette.primary.contrastText, fontSize: 54, - margin: ".5rem .3rem" + margin: ".5rem .3rem", }, iconBackground: { backgroundColor: theme.palette.background.default, @@ -41,13 +41,13 @@ const useStyles = makeStyles( fontSize: "54px", height: "100%", padding: "10px 5px 0px 5px", - width: "100%" + width: "100%", }, value: { - textAlign: "right" - } + textAlign: "right", + }, }), - { name: "HomeAnalyticsCard" } + { name: "HomeAnalyticsCard" }, ); interface HomeAnalyticsCardProps { diff --git a/src/home/components/HomeHeader/HomeHeader.tsx b/src/home/components/HomeHeader/HomeHeader.tsx index 6be90488e..798e05fb4 100644 --- a/src/home/components/HomeHeader/HomeHeader.tsx +++ b/src/home/components/HomeHeader/HomeHeader.tsx @@ -10,16 +10,16 @@ const useStyles = makeStyles( alignItems: "flex-end", display: "flex", justifyContent: "space-between", - marginBottom: theme.spacing(6) + marginBottom: theme.spacing(6), }, pageHeader: { - fontWeight: 600 as 600 + fontWeight: 600 as 600, }, subtitle: { - color: theme.typography.caption.color - } + color: theme.typography.caption.color, + }, }), - { name: "HomeHeader" } + { name: "HomeHeader" }, ); interface HomeOrdersCardProps { @@ -45,7 +45,7 @@ const HomeOrdersCard: React.FC = props => { defaultMessage="Hello there, {userName}" description="header" values={{ - userName + userName, }} /> ) : ( diff --git a/src/home/components/HomeNotificationTable/HomeNotificationTable.tsx b/src/home/components/HomeNotificationTable/HomeNotificationTable.tsx index 72feb8f0a..5f42d70a0 100644 --- a/src/home/components/HomeNotificationTable/HomeNotificationTable.tsx +++ b/src/home/components/HomeNotificationTable/HomeNotificationTable.tsx @@ -15,16 +15,16 @@ const useStyles = makeStyles( () => ({ arrowIcon: { textAlign: "right", - width: 100 + width: 100, }, tableCard: { - overflow: "hidden" + overflow: "hidden", }, tableRow: { - cursor: "pointer" - } + cursor: "pointer", + }, }), - { name: "HomeNotificationTable" } + { name: "HomeNotificationTable" }, ); interface HomeNotificationTableProps { @@ -47,7 +47,7 @@ const HomeNotificationTable: React.FC = props => { ordersToCapture, ordersToFulfill, productsOutOfStock, - noChannel + noChannel, } = props; const classes = useStyles(props); @@ -88,7 +88,7 @@ const HomeNotificationTable: React.FC = props => { ) : ( {intl.formatMessage(messages.orderReady, { - amount: {ordersToFulfill} + amount: {ordersToFulfill}, })} )} @@ -108,7 +108,7 @@ const HomeNotificationTable: React.FC = props => { ) : ( {intl.formatMessage(messages.paymentCapture, { - amount: {ordersToCapture} + amount: {ordersToCapture}, })} )} @@ -132,7 +132,7 @@ const HomeNotificationTable: React.FC = props => { ) : ( {intl.formatMessage(messages.productOut, { - amount: {productsOutOfStock} + amount: {productsOutOfStock}, })} )} diff --git a/src/home/components/HomeNotificationTable/messages.ts b/src/home/components/HomeNotificationTable/messages.ts index cb1dd269e..b5f3002b8 100644 --- a/src/home/components/HomeNotificationTable/messages.ts +++ b/src/home/components/HomeNotificationTable/messages.ts @@ -3,33 +3,33 @@ import { defineMessages } from "react-intl"; export const homeNotificationTableMessages = defineMessages({ createNewChannel: { id: "Nuq83+", - defaultMessage: "Create new channel" + defaultMessage: "Create new channel", }, noOrders: { id: "E9Jssl", - defaultMessage: "No orders ready to fulfill" + defaultMessage: "No orders ready to fulfill", }, noPaymentWaiting: { id: "5dyOs0", - defaultMessage: "No payments waiting for capture" + defaultMessage: "No payments waiting for capture", }, noProductsOut: { id: "bFhzRX", - defaultMessage: "No products are out of stock" + defaultMessage: "No products are out of stock", }, orderReady: { id: "c0H45L", defaultMessage: - "{amount, plural,one {One order is ready to fulfill} other {{amount} orders are ready to fulfill}}" + "{amount, plural,one {One order is ready to fulfill} other {{amount} orders are ready to fulfill}}", }, paymentCapture: { id: "md326v", defaultMessage: - "{amount, plural,one {One payment to capture}other {{amount} payments to capture}}" + "{amount, plural,one {One payment to capture}other {{amount} payments to capture}}", }, productOut: { id: "cdxwA8", defaultMessage: - "{amount, plural,one {One product out of stock}other {{amount} products out of stock}}" - } + "{amount, plural,one {One product out of stock}other {{amount} products out of stock}}", + }, }); diff --git a/src/home/components/HomePage/HomePage.tsx b/src/home/components/HomePage/HomePage.tsx index 85eb22dbb..079533d15 100644 --- a/src/home/components/HomePage/HomePage.tsx +++ b/src/home/components/HomePage/HomePage.tsx @@ -24,19 +24,19 @@ const useStyles = makeStyles( gridColumnGap: theme.spacing(3), gridTemplateColumns: "1fr 1fr", [theme.breakpoints.down("sm")]: { - gridColumnGap: theme.spacing(1) + gridColumnGap: theme.spacing(1), }, [theme.breakpoints.down("xs")]: { - gridTemplateColumns: "1fr" - } + gridTemplateColumns: "1fr", + }, }, icon: { "& path": { - fill: theme.palette.primary.main - } - } + fill: theme.palette.primary.main, + }, + }, }), - { name: "HomePage" } + { name: "HomePage" }, ); export interface HomePageProps { @@ -69,7 +69,7 @@ const HomePage: React.FC = props => { ordersToCapture = 0, ordersToFulfill = 0, productsOutOfStock = 0, - noChannel + noChannel, } = props; const classes = useStyles(props); @@ -139,7 +139,7 @@ const HomePage: React.FC = props => { ({ avatarProps: { height: 64, - width: 64 + width: 64, }, colAvatar: { paddingBottom: theme.spacing(2), paddingRight: theme.spacing(), paddingTop: theme.spacing(2), - width: 112 + width: 112, }, colName: { - width: "auto" + width: "auto", }, label: { - paddingLeft: 0 + paddingLeft: 0, }, noProducts: { paddingBottom: 20, - paddingTop: 20 + paddingTop: 20, }, tableRow: { - cursor: "pointer" - } + cursor: "pointer", + }, }), - { name: "HomeProductListCard" } + { name: "HomeProductListCard" }, ); interface HomeProductListProps { @@ -67,7 +67,7 @@ export const HomeProductList: React.FC = props => { title={intl.formatMessage({ id: "rr8fyf", defaultMessage: "Top Products", - description: "header" + description: "header", })} /> @@ -84,7 +84,7 @@ export const HomeProductList: React.FC = props => { key={variant ? variant.id : "skeleton"} hover={!!variant} className={classNames({ - [classes.tableRow]: !!variant + [classes.tableRow]: !!variant, })} href={productVariantEditUrl(variant.product.id, variant.id)} > @@ -104,7 +104,7 @@ export const HomeProductList: React.FC = props => { {maybe(() => variant.attributes .map(attribute => attribute.values[0].name) - .join(" / ") + .join(" / "), )} @@ -113,7 +113,7 @@ export const HomeProductList: React.FC = props => { defaultMessage="{amount, plural,one {One ordered}other {{amount} Ordered}}" description="number of ordered products" values={{ - amount: variant.quantityOrdered + amount: variant.quantityOrdered, }} /> @@ -129,7 +129,7 @@ export const HomeProductList: React.FC = props => { () => ( ), - + , )} @@ -146,7 +146,7 @@ export const HomeProductList: React.FC = props => { - ) + ), )} diff --git a/src/home/components/HomeScreen.tsx b/src/home/components/HomeScreen.tsx index 164e93046..dbb5b38f1 100644 --- a/src/home/components/HomeScreen.tsx +++ b/src/home/components/HomeScreen.tsx @@ -21,9 +21,9 @@ export const HomeScreen: React.FC = ({ user }) => { { id: "By5ZBp", defaultMessage: "Hello there, {userName}", - description: "header" + description: "header", }, - { userName: user.email } + { userName: user.email }, )} /> @@ -31,7 +31,7 @@ export const HomeScreen: React.FC = ({ user }) => { title={intl.formatMessage({ id: "6L6Fy2", defaultMessage: "Disclaimer", - description: "header" + description: "header", })} /> diff --git a/src/home/fixtures.ts b/src/home/fixtures.ts index 7f4940602..9512f4e28 100644 --- a/src/home/fixtures.ts +++ b/src/home/fixtures.ts @@ -1,7 +1,7 @@ import { HomeQuery, OrderEventsEnum } from "@saleor/graphql"; export const shop: (placeholderImage: string) => HomeQuery = ( - placeholderImage: string + placeholderImage: string, ) => ({ __typename: "Query", activities: { @@ -25,9 +25,9 @@ export const shop: (placeholderImage: string) => HomeQuery = ( user: { __typename: "User", email: "admin@example.com", - id: "VXNlcjoyMQ==" - } - } + id: "VXNlcjoyMQ==", + }, + }, }, { __typename: "OrderEventCountableEdge", @@ -44,8 +44,8 @@ export const shop: (placeholderImage: string) => HomeQuery = ( oversoldItems: null, quantity: null, type: OrderEventsEnum.PLACED, - user: null - } + user: null, + }, }, { __typename: "OrderEventCountableEdge", @@ -62,8 +62,8 @@ export const shop: (placeholderImage: string) => HomeQuery = ( oversoldItems: null, quantity: null, type: OrderEventsEnum.ORDER_FULLY_PAID, - user: null - } + user: null, + }, }, { __typename: "OrderEventCountableEdge", @@ -83,9 +83,9 @@ export const shop: (placeholderImage: string) => HomeQuery = ( user: { __typename: "User", email: "admin@example.com", - id: "VXNlcjoyMQ==" - } - } + id: "VXNlcjoyMQ==", + }, + }, }, { __typename: "OrderEventCountableEdge", @@ -105,9 +105,9 @@ export const shop: (placeholderImage: string) => HomeQuery = ( user: { __typename: "User", email: "admin@example.com", - id: "VXNlcjoyMQ==" - } - } + id: "VXNlcjoyMQ==", + }, + }, }, { __typename: "OrderEventCountableEdge", @@ -127,9 +127,9 @@ export const shop: (placeholderImage: string) => HomeQuery = ( user: { __typename: "User", email: "admin@example.com", - id: "VXNlcjoyMQ==" - } - } + id: "VXNlcjoyMQ==", + }, + }, }, { __typename: "OrderEventCountableEdge", @@ -149,9 +149,9 @@ export const shop: (placeholderImage: string) => HomeQuery = ( user: { __typename: "User", email: "admin@example.com", - id: "VXNlcjoyMQ==" - } - } + id: "VXNlcjoyMQ==", + }, + }, }, { __typename: "OrderEventCountableEdge", @@ -168,8 +168,8 @@ export const shop: (placeholderImage: string) => HomeQuery = ( oversoldItems: null, quantity: null, type: OrderEventsEnum.PLACED, - user: null - } + user: null, + }, }, { __typename: "OrderEventCountableEdge", @@ -189,9 +189,9 @@ export const shop: (placeholderImage: string) => HomeQuery = ( user: { __typename: "User", email: "admin@example.com", - id: "VXNlcjoyMQ==" - } - } + id: "VXNlcjoyMQ==", + }, + }, }, { __typename: "OrderEventCountableEdge", @@ -211,9 +211,9 @@ export const shop: (placeholderImage: string) => HomeQuery = ( user: { __typename: "User", email: null, - id: "VXNlcjoyMQ==" - } - } + id: "VXNlcjoyMQ==", + }, + }, }, { __typename: "OrderEventCountableEdge", @@ -230,8 +230,8 @@ export const shop: (placeholderImage: string) => HomeQuery = ( oversoldItems: null, quantity: null, type: OrderEventsEnum.PLACED, - user: null - } + user: null, + }, }, { __typename: "OrderEventCountableEdge", @@ -248,8 +248,8 @@ export const shop: (placeholderImage: string) => HomeQuery = ( oversoldItems: null, quantity: null, type: OrderEventsEnum.PLACED, - user: null - } + user: null, + }, }, { __typename: "OrderEventCountableEdge", @@ -266,8 +266,8 @@ export const shop: (placeholderImage: string) => HomeQuery = ( oversoldItems: null, quantity: null, type: OrderEventsEnum.ORDER_FULLY_PAID, - user: null - } + user: null, + }, }, { __typename: "OrderEventCountableEdge", @@ -284,22 +284,22 @@ export const shop: (placeholderImage: string) => HomeQuery = ( oversoldItems: null, quantity: null, type: OrderEventsEnum.ORDER_FULLY_PAID, - user: null - } - } - ] + user: null, + }, + }, + ], }, ordersToCapture: { __typename: "OrderCountableConnection", - totalCount: 0 + totalCount: 0, }, ordersToFulfill: { __typename: "OrderCountableConnection", - totalCount: 1 + totalCount: 1, }, ordersToday: { __typename: "OrderCountableConnection", - totalCount: 1 + totalCount: 1, }, productTopToday: { __typename: "ProductVariantCountableConnection", @@ -316,10 +316,10 @@ export const shop: (placeholderImage: string) => HomeQuery = ( __typename: "AttributeValue", id: "QXR0cmlidXRlVmFsdWU6OTI=", name: "XS", - sortOrder: 0 - } - ] - } + sortOrder: 0, + }, + ], + }, ], id: "UHJvZHVjdFZhcmlhbnQ6NDM=", product: { @@ -328,8 +328,8 @@ export const shop: (placeholderImage: string) => HomeQuery = ( name: "Gardner-Martin", thumbnail: { __typename: "Image", - url: placeholderImage - } + url: placeholderImage, + }, }, quantityOrdered: 1, revenue: { @@ -337,23 +337,23 @@ export const shop: (placeholderImage: string) => HomeQuery = ( gross: { __typename: "Money", amount: 37.65, - currency: "USD" - } - } - } - } - ] + currency: "USD", + }, + }, + }, + }, + ], }, productsOutOfStock: { __typename: "ProductCountableConnection", - totalCount: 0 + totalCount: 0, }, salesToday: { __typename: "TaxedMoney", gross: { __typename: "Money", amount: 57.15, - currency: "USD" - } - } + currency: "USD", + }, + }, }); diff --git a/src/home/views/index.tsx b/src/home/views/index.tsx index 03d210809..b29de931d 100644 --- a/src/home/views/index.tsx +++ b/src/home/views/index.tsx @@ -4,7 +4,7 @@ import useAppChannel from "@saleor/components/AppLayout/AppChannelContext"; import { OrderStatusFilter, StockAvailability, - useHomeQuery + useHomeQuery, } from "@saleor/graphql"; import { mapEdgesToItems } from "@saleor/utils/maps"; import React from "react"; @@ -23,7 +23,7 @@ const HomeSection = () => { const { data } = useHomeQuery({ displayLoader: true, skip: noChannel, - variables: { channel: channel?.slug, datePeriod: getDatePeriod(1) } + variables: { channel: channel?.slug, datePeriod: getDatePeriod(1) }, }); return ( @@ -35,15 +35,15 @@ const HomeSection = () => { createNewChannelHref={channelsListUrl()} ordersToCaptureHref={orderListUrl({ status: [OrderStatusFilter.READY_TO_CAPTURE], - channel: [channel?.id] + channel: [channel?.id], })} ordersToFulfillHref={orderListUrl({ status: [OrderStatusFilter.READY_TO_FULFILL], - channel: [channel?.id] + channel: [channel?.id], })} productsOutOfStockHref={productListUrl({ stockStatus: StockAvailability.OUT_OF_STOCK, - channel: channel?.slug + channel: channel?.slug, })} ordersToCapture={data?.ordersToCapture?.totalCount} ordersToFulfill={data?.ordersToFulfill?.totalCount} diff --git a/src/hooks/makeMutation.ts b/src/hooks/makeMutation.ts index 470d18a6e..e28d2c58f 100644 --- a/src/hooks/makeMutation.ts +++ b/src/hooks/makeMutation.ts @@ -3,12 +3,12 @@ import { MutationFunction, MutationHookOptions as BaseMutationHookOptions, MutationResult, - useMutation as useBaseMutation + useMutation as useBaseMutation, } from "@apollo/client"; import { handleNestedMutationErrors, showAllErrors, - useUser + useUser, } from "@saleor/auth"; import { isJwtError } from "@saleor/auth/errors"; import { commonMessages } from "@saleor/intl"; @@ -25,10 +25,10 @@ export type MutationResultWithOpts = MutationResult & export type UseMutation = [ MutationFunction, - MutationResultWithOpts + MutationResultWithOpts, ]; export type UseMutationHook = ( - cbs: MutationHookOptions + cbs: MutationHookOptions, ) => UseMutation; export type MutationHookOptions = BaseMutationHookOptions< @@ -38,7 +38,7 @@ export type MutationHookOptions = BaseMutationHookOptions< export function useMutation( mutation: DocumentNode, - { onCompleted, onError, ...opts }: MutationHookOptions + { onCompleted, onError, ...opts }: MutationHookOptions, ): UseMutation { const notify = useNotifier(); const intl = useIntl(); @@ -50,7 +50,7 @@ export function useMutation( handleNestedMutationErrors({ data, intl, - notify + notify, }); if (onCompleted) { @@ -62,19 +62,19 @@ export function useMutation( if (hasError(err, GqlErrors.ReadOnlyException)) { notify({ status: "error", - text: intl.formatMessage(commonMessages.readOnly) + text: intl.formatMessage(commonMessages.readOnly), }); } else if (err.graphQLErrors.some(isJwtError)) { user.logout(); notify({ status: "error", - text: intl.formatMessage(commonMessages.sessionExpired) + text: intl.formatMessage(commonMessages.sessionExpired), }); } else if (!hasError(err, GqlErrors.LimitReachedException)) { err.graphQLErrors.map(graphQLError => { notify({ status: "error", - apiMessage: graphQLError.message + apiMessage: graphQLError.message, }); }); } @@ -85,20 +85,20 @@ export function useMutation( if (onError) { onError(err); } - } + }, }); return [ mutateFn, { ...result, - status: getMutationStatus(result) - } + status: getMutationStatus(result), + }, ]; } function makeMutation( - mutation: DocumentNode + mutation: DocumentNode, ): UseMutationHook { return (opts: MutationHookOptions) => useMutation(mutation, opts); diff --git a/src/hooks/makeQuery.ts b/src/hooks/makeQuery.ts index def3e24f4..4ee88f287 100644 --- a/src/hooks/makeQuery.ts +++ b/src/hooks/makeQuery.ts @@ -3,13 +3,13 @@ import { ApolloQueryResult, QueryHookOptions as BaseQueryHookOptions, QueryResult, - useQuery as useBaseQuery + useQuery as useBaseQuery, } from "@apollo/client"; import { handleQueryAuthError, useUser } from "@saleor/auth"; import { PrefixedPermissions } from "@saleor/graphql/extendedTypes"; import { PermissionEnum, - UserPermissionFragment + UserPermissionFragment, } from "@saleor/graphql/types.generated"; import { RequireAtLeastOne } from "@saleor/misc"; import { DocumentNode } from "graphql"; @@ -24,30 +24,30 @@ const getPermissionKey = (permission: string) => `PERMISSION_${permission}` as PrefixedPermissions; export const allPermissions: Record = Object.keys( - PermissionEnum + PermissionEnum, ).reduce( (prev, code) => ({ ...prev, - [getPermissionKey(code)]: false + [getPermissionKey(code)]: false, }), - {} as Record + {} as Record, ); const getUserPermissions = ( - userPermissions: UserPermissionFragment[] + userPermissions: UserPermissionFragment[], ): Record => userPermissions.reduce( (prev, permission) => ({ ...prev, - [getPermissionKey(permission.code)]: true + [getPermissionKey(permission.code)]: true, }), - {} as Record + {} as Record, ); export interface LoadMore { loadMore: ( mergeFunc: (prev: TData, next: TData) => TData, - extraVariables: Partial + extraVariables: Partial, ) => Promise>; } @@ -61,7 +61,7 @@ export type QueryHookOptions = Partial< } >; type UseQueryHook = ( - opts?: QueryHookOptions> + opts?: QueryHookOptions>, ) => UseQueryResult; export function useQuery( @@ -73,7 +73,7 @@ export function useQuery( fetchPolicy, handleError, ...opts - }: QueryHookOptions = {} + }: QueryHookOptions = {}, ): UseQueryResult { const notify = useNotifier(); const intl = useIntl(); @@ -84,13 +84,13 @@ export function useQuery( const variablesWithPermissions = { ...variables, ...allPermissions, - ...userPermissions + ...userPermissions, } as TVariables & Record; const queryData = useBaseQuery(query, { ...opts, context: { - useBatching: true + useBatching: true, }, errorPolicy: "all", fetchPolicy: fetchPolicy ?? "cache-and-network", @@ -102,23 +102,23 @@ export function useQuery( } }, skip, - variables: variablesWithPermissions + variables: variablesWithPermissions, }); useEffect(() => { if (displayLoader) { dispatchAppState({ payload: { - value: queryData.loading + value: queryData.loading, }, - type: "displayLoader" + type: "displayLoader", }); } }, [queryData.loading]); const loadMore = ( mergeFunc: (previousResults: TData, fetchMoreResult: TData) => TData, - extraVariables: RequireAtLeastOne + extraVariables: RequireAtLeastOne, ) => queryData.fetchMore({ query, @@ -128,17 +128,17 @@ export function useQuery( } return mergeFunc(previousResults, fetchMoreResult); }, - variables: { ...variablesWithPermissions, ...extraVariables } + variables: { ...variablesWithPermissions, ...extraVariables }, }); return { ...queryData, - loadMore + loadMore, }; } function makeQuery( - query: DocumentNode + query: DocumentNode, ): UseQueryHook { return (opts: QueryHookOptions) => useQuery(query, opts); diff --git a/src/hooks/makeSearch.ts b/src/hooks/makeSearch.ts index 2056d9f6a..514e8d8f9 100644 --- a/src/hooks/makeSearch.ts +++ b/src/hooks/makeSearch.ts @@ -22,17 +22,17 @@ export type UseSearchOpts = Partial<{ variables: TVariables; }>; export type UseSearchHook = ( - opts: UseSearchOpts + opts: UseSearchOpts, ) => UseSearchResult; function makeSearch( query: DocumentNode, - loadMoreFn: (result: UseQueryResult) => void + loadMoreFn: (result: UseQueryResult) => void, ): UseSearchHook { const useSearchQuery = makeQuery(query); function useSearch( - opts: UseSearchOpts + opts: UseSearchOpts, ): UseSearchResult { const [searchQuery, setSearchQuery] = useState(""); const debouncedSearch = useDebounce(setSearchQuery); @@ -41,15 +41,15 @@ function makeSearch( displayLoader: true, variables: { ...opts.variables, - query: searchQuery - } + query: searchQuery, + }, }); return { query: searchQuery, loadMore: () => loadMoreFn(result), result, - search: debouncedSearch + search: debouncedSearch, }; } diff --git a/src/hooks/makeTopLevelSearch/makeTopLevelSearch.ts b/src/hooks/makeTopLevelSearch/makeTopLevelSearch.ts index 6a9df43c6..4f2765515 100644 --- a/src/hooks/makeTopLevelSearch/makeTopLevelSearch.ts +++ b/src/hooks/makeTopLevelSearch/makeTopLevelSearch.ts @@ -35,14 +35,14 @@ function makeTopLevelSearch< search: { ...prev.search, edges: [...prev.search.edges, ...next.search.edges], - pageInfo: next.search.pageInfo - } + pageInfo: next.search.pageInfo, + }, }; }, { ...result.variables, - after: result.data.search.pageInfo.endCursor - } + after: result.data.search.pageInfo.endCursor, + }, ); } }); diff --git a/src/hooks/makeTopLevelSearch/utils.ts b/src/hooks/makeTopLevelSearch/utils.ts index 6c4dd502b..fff7413f7 100644 --- a/src/hooks/makeTopLevelSearch/utils.ts +++ b/src/hooks/makeTopLevelSearch/utils.ts @@ -6,12 +6,12 @@ import { CommonSearchOpts } from "./types"; export const getSearchFetchMoreProps = ( { data, loading }: CommonSearchOpts, - onFetchMore: any + onFetchMore: any, ): FetchMoreProps => ({ hasMore: !!data?.search?.pageInfo?.hasNextPage, totalCount: data?.search?.totalCount, loading: !!loading, - onFetchMore + onFetchMore, }); export const getParsedSearchData = ({ data }: ResultSearchData) => diff --git a/src/hooks/useAddressValidation.ts b/src/hooks/useAddressValidation.ts index 5517685bb..58e0b7a7e 100644 --- a/src/hooks/useAddressValidation.ts +++ b/src/hooks/useAddressValidation.ts @@ -3,7 +3,7 @@ import { AccountErrorCode, AccountErrorFragment, AddressInput, - AddressTypeEnum + AddressTypeEnum, } from "@saleor/graphql"; import { transformFormToAddressInput } from "@saleor/misc"; import { add, remove } from "@saleor/utils/lists"; @@ -12,13 +12,13 @@ import { useState } from "react"; interface UseAddressValidation { errors: AccountErrorFragment[]; submit: ( - data: TInput & AddressTypeInput + data: TInput & AddressTypeInput, ) => TOutput | Promise; } function useAddressValidation( onSubmit: (address: TInput & AddressInput) => TOutput, - addressType?: AddressTypeEnum + addressType?: AddressTypeEnum, ): UseAddressValidation { const [validationErrors, setValidationErrors] = useState< AccountErrorFragment[] @@ -29,7 +29,7 @@ function useAddressValidation( code: AccountErrorCode.REQUIRED, field: "country", addressType, - message: "Country required" + message: "Country required", }; return { @@ -40,8 +40,8 @@ function useAddressValidation( remove( countryRequiredError, validationErrors, - (a, b) => a.field === b.field - ) + (a, b) => a.field === b.field, + ), ); return onSubmit(transformFormToAddressInput(data)); } catch { @@ -50,7 +50,7 @@ function useAddressValidation( // since every onSubmit must return Promise return Promise.resolve(errors); } - } + }, }; } diff --git a/src/hooks/useBulkActions.ts b/src/hooks/useBulkActions.ts index 601eedd5f..10787d7df 100644 --- a/src/hooks/useBulkActions.ts +++ b/src/hooks/useBulkActions.ts @@ -9,7 +9,7 @@ function useBulkActions(initial: string[] = []) { remove, reset, set, - toggle + toggle, } = useListActions(initial); function toggleAll(items: Node[], selected: number) { @@ -27,7 +27,7 @@ function useBulkActions(initial: string[] = []) { remove, reset, toggle, - toggleAll + toggleAll, }; } export default useBulkActions; diff --git a/src/hooks/useChannels.test.ts b/src/hooks/useChannels.test.ts index d57e42a62..aedcc51d4 100644 --- a/src/hooks/useChannels.test.ts +++ b/src/hooks/useChannels.test.ts @@ -7,13 +7,13 @@ const channels: ChannelData[] = [ { id: "channel1", name: "Channel 1", - variantsIds: ["variant1", "variant2"] + variantsIds: ["variant1", "variant2"], }, { id: "channel2", name: "Channel 2", - variantsIds: [] - } + variantsIds: [], + }, ]; describe("useChannels", () => { @@ -25,10 +25,10 @@ describe("useChannels", () => { "", { closeModal: jest.fn, - openModal: jest.fn + openModal: jest.fn, }, - { formId: Symbol() } - ) + { formId: Symbol() }, + ), ); // When @@ -52,10 +52,10 @@ describe("useChannels", () => { "", { closeModal: jest.fn, - openModal: jest.fn + openModal: jest.fn, }, - { formId: Symbol() } - ) + { formId: Symbol() }, + ), ); // When @@ -83,10 +83,10 @@ describe("useChannels", () => { "", { closeModal: jest.fn, - openModal: jest.fn + openModal: jest.fn, }, - { formId: Symbol() } - ) + { formId: Symbol() }, + ), ); // When diff --git a/src/hooks/useChannels.ts b/src/hooks/useChannels.ts index 2730a867a..4adffa8ef 100644 --- a/src/hooks/useChannels.ts +++ b/src/hooks/useChannels.ts @@ -14,12 +14,12 @@ function useChannels( channels: T[], action: A | ChannelsAction, { closeModal, openModal }: Modal, - opts: WithFormId + opts: WithFormId, ) { const { formId } = opts; const { setIsDirty } = useExitFormDialog({ - formId + formId, }); const [currentChannels, setCurrentChannels] = useStateFromProps(channels); @@ -28,7 +28,7 @@ function useChannels( isSelected: isChannelSelected, listElements: channelListElements, set: setChannels, - toggle: channelsToggle + toggle: channelsToggle, } = useListActions(currentChannels, (a, b) => a.id === b.id); const handleChannelsModalClose = () => { @@ -40,7 +40,7 @@ function useChannels( const handleChannelsConfirm = () => { const sortedChannelListElements = channelListElements.sort( - (channel, nextChannel) => channel.name.localeCompare(nextChannel.name) + (channel, nextChannel) => channel.name.localeCompare(nextChannel.name), ); setCurrentChannels(sortedChannelListElements); @@ -69,7 +69,7 @@ function useChannels( isChannelSelected, isChannelsModalOpen: action === "open-channels-picker", setCurrentChannels, - toggleAllChannels + toggleAllChannels, }; } diff --git a/src/hooks/useChannelsSearch.ts b/src/hooks/useChannelsSearch.ts index 15ac22dd0..bda4b83aa 100644 --- a/src/hooks/useChannelsSearch.ts +++ b/src/hooks/useChannelsSearch.ts @@ -4,7 +4,7 @@ import { filter } from "fuzzaldrin"; import React from "react"; export const useChannelsSearch = function( - channels: T[] + channels: T[], ) { const [query, onQueryChange] = React.useState(""); const filteredChannels = diff --git a/src/hooks/useChannelsSearchWithLoadMore.ts b/src/hooks/useChannelsSearchWithLoadMore.ts index 73341756e..b28ef81dd 100644 --- a/src/hooks/useChannelsSearchWithLoadMore.ts +++ b/src/hooks/useChannelsSearchWithLoadMore.ts @@ -6,21 +6,21 @@ import { useEffect, useState } from "react"; import { ChannelsWithLoadMoreProps, - useChannelsSearch + useChannelsSearch, } from "./useChannelsSearch"; const DEFAULT_ITEMS_PER_PAGE = 6; const INITIAL_INDEX = 0; export const useChannelsSearchWithLoadMore = ( - itemsPerPage: number = DEFAULT_ITEMS_PER_PAGE + itemsPerPage: number = DEFAULT_ITEMS_PER_PAGE, ): ChannelsWithLoadMoreProps => { const { data, loading } = useBaseChannelsQuery({}); const { query, onQueryChange: onSearchChange, - filteredChannels + filteredChannels, } = useChannelsSearch(data?.channels); const allChannelsChunks = chunk(filteredChannels, itemsPerPage); @@ -61,6 +61,6 @@ export const useChannelsSearchWithLoadMore = ( hasMore, totalCount, onFetchMore, - loading + loading, }; }; diff --git a/src/hooks/useChoiceSearch.ts b/src/hooks/useChoiceSearch.ts index 10e3e61e3..72f8856da 100644 --- a/src/hooks/useChoiceSearch.ts +++ b/src/hooks/useChoiceSearch.ts @@ -7,7 +7,7 @@ function useChoiceSearch(choices: Array>) { const sortedChoices = useMemo( () => filter(choices, query, { key: "label" }) || [], - [choices, query] + [choices, query], ); return { search: setQuery, result: sortedChoices }; diff --git a/src/hooks/useDebounce.ts b/src/hooks/useDebounce.ts index b228152f4..413b18b54 100644 --- a/src/hooks/useDebounce.ts +++ b/src/hooks/useDebounce.ts @@ -3,7 +3,7 @@ import { useEffect, useRef } from "react"; export type UseDebounceFn = (...args: T[]) => void; function useDebounce( debounceFn: UseDebounceFn, - time = 200 + time = 200, ): UseDebounceFn { const timer = useRef(null); useEffect(() => () => clearTimeout(timer.current), []); diff --git a/src/hooks/useElementScroll.ts b/src/hooks/useElementScroll.ts index f9df93b45..b21c10612 100644 --- a/src/hooks/useElementScroll.ts +++ b/src/hooks/useElementScroll.ts @@ -7,7 +7,7 @@ function getPosition(anchor?: HTMLElement): Position { if (!!anchor) { return { x: anchor.scrollLeft, - y: anchor.scrollTop + y: anchor.scrollTop, }; } return undefined; @@ -16,7 +16,7 @@ function getPosition(anchor?: HTMLElement): Position { export function isScrolledToBottom( anchor: MutableRefObject, position: Position, - offset: number = 0 + offset: number = 0, ) { return !!anchor.current && position ? position.y + anchor.current.clientHeight + offset >= @@ -31,7 +31,7 @@ function useElementScroll(anchor: MutableRefObject): Position { if (!!anchor.current) { const handleScroll = throttle( () => setScroll(getPosition(anchor.current)), - 100 + 100, ); anchor.current.addEventListener("scroll", handleScroll); diff --git a/src/hooks/useForm.ts b/src/hooks/useForm.ts index 7202aaf3b..f60f7e4bc 100644 --- a/src/hooks/useForm.ts +++ b/src/hooks/useForm.ts @@ -2,7 +2,7 @@ import { CheckIfSaveIsDisabledFnType } from "@saleor/components/Form"; import { FormId } from "@saleor/components/Form/ExitFormDialogProvider"; import { useExitFormDialog, - UseExitFormDialogResult + UseExitFormDialogResult, } from "@saleor/components/Form/useExitFormDialog"; import useHandleFormSubmit from "@saleor/hooks/useHandleFormSubmit"; import { toggle } from "@saleor/utils/lists"; @@ -22,7 +22,7 @@ export type SubmitPromise = Promise; export type FormChange = ( event: ChangeEvent, - cb?: () => void + cb?: () => void, ) => void; export type FormErrors = { @@ -73,24 +73,24 @@ function merge(prevData: T, prevState: T, data: T): T { return acc; }, - { ...prevState } + { ...prevState }, ); } function useForm( initialData: T, onSubmit?: (data: T) => SubmitPromise | void, - opts: UseFormOpts = { confirmLeave: false, formId: undefined } + opts: UseFormOpts = { confirmLeave: false, formId: undefined }, ): UseFormResult { const { confirmLeave, formId: propsFormId, checkIfSaveIsDisabled, - disabled + disabled, } = opts; const [errors, setErrors] = useState>({}); const [data, setData] = useStateFromProps(initialData, { - mergeFunc: merge + mergeFunc: merge, }); const isSaveDisabled = () => { @@ -106,15 +106,15 @@ function useForm( setExitDialogSubmitRef, setEnableExitDialog, setIsSubmitDisabled, - formId + formId, } = useExitFormDialog({ formId: propsFormId, - isDisabled: isSaveDisabled() + isDisabled: isSaveDisabled(), }); const handleFormSubmit = useHandleFormSubmit({ formId, - onSubmit + onSubmit, }); const handleSetChanged = (value: boolean = true) => { @@ -144,7 +144,7 @@ function useForm( setData({ ...data, - [name]: toggle(value, field, isEqual) + [name]: toggle(value, field, isEqual), }); } @@ -170,7 +170,7 @@ function useForm( } setData(data => ({ ...data, - [name]: value + [name]: value, })); } } @@ -182,7 +182,7 @@ function useForm( function set(newData: Partial) { setData(data => ({ ...data, - ...newData + ...newData, })); } @@ -202,7 +202,7 @@ function useForm( setErrors({}); } else { setErrors(errors => - omit>(errors, Array.isArray(field) ? field : [field]) + omit>(errors, Array.isArray(field) ? field : [field]), ); } }; @@ -221,7 +221,7 @@ function useForm( handleChange, triggerChange: handleSetChanged, setIsSubmitDisabled, - isSaveDisabled: isSaveDisabled() + isSaveDisabled: isSaveDisabled(), }; } diff --git a/src/hooks/useFormset.ts b/src/hooks/useFormset.ts index 75c12024b..604ef509d 100644 --- a/src/hooks/useFormset.ts +++ b/src/hooks/useFormset.ts @@ -22,10 +22,10 @@ export interface UseFormsetOutput { remove: (id: string) => void; } function useFormset( - initial: FormsetData + initial: FormsetData, ): UseFormsetOutput { const [data, setData] = useStateFromProps>( - initial || [] + initial || [], ); function addItem(itemData: FormsetAtomicData) { @@ -40,8 +40,8 @@ function useFormset( setData(prevData => removeAtIndex( prevData, - prevData.findIndex(item => item.id === id) - ) + prevData.findIndex(item => item.id === id), + ), ); } @@ -52,9 +52,9 @@ function useFormset( ...data.slice(0, itemIndex), { ...data[itemIndex], - value + value, }, - ...data.slice(itemIndex + 1) + ...data.slice(itemIndex + 1), ]; }); } @@ -65,7 +65,7 @@ function useFormset( data, get: getItem, remove: removeItem, - set: setData + set: setData, }; } diff --git a/src/hooks/useHandleFormSubmit.ts b/src/hooks/useHandleFormSubmit.ts index 1cc1cfd80..82d906f8d 100644 --- a/src/hooks/useHandleFormSubmit.ts +++ b/src/hooks/useHandleFormSubmit.ts @@ -11,10 +11,10 @@ interface UseHandleFormSubmitProps { function useHandleFormSubmit({ formId, - onSubmit + onSubmit, }: UseHandleFormSubmitProps) { const { setIsSubmitting } = useExitFormDialog({ - formId + formId, }); const messageContext = useContext(MessageContext); diff --git a/src/hooks/useListActions.ts b/src/hooks/useListActions.ts index aab9a8375..0eacff149 100644 --- a/src/hooks/useListActions.ts +++ b/src/hooks/useListActions.ts @@ -2,7 +2,7 @@ import useStateFromProps from "./useStateFromProps"; function useListActions( initial: TData[] = [], - compareFunc: (a: TData, b: TData) => boolean = (a, b) => a === b + compareFunc: (a: TData, b: TData) => boolean = (a, b) => a === b, ) { const [listElements, setListElements] = useStateFromProps(initial); @@ -16,7 +16,7 @@ function useListActions( function remove(data: TData) { setListElements( - listElements.filter(listElement => !compareFunc(listElement, data)) + listElements.filter(listElement => !compareFunc(listElement, data)), ); } @@ -43,7 +43,7 @@ function useListActions( remove, reset, set, - toggle + toggle, }; } export default useListActions; diff --git a/src/hooks/useListSettings.test.ts b/src/hooks/useListSettings.test.ts index fd2a318d6..03aa16322 100644 --- a/src/hooks/useListSettings.test.ts +++ b/src/hooks/useListSettings.test.ts @@ -9,18 +9,18 @@ const storedValue = { ...defaultListSettings, [key]: { ...defaultListSettings[key], - rowNumber: 100 - } + rowNumber: 100, + }, }; const valueWithoutKey = { ...defaultListSettings, - [key]: undefined + [key]: undefined, }; const valueWithoutSettings = { ...defaultListSettings, [key]: { - foo: "bar" - } + foo: "bar", + }, }; beforeEach(() => { @@ -39,7 +39,7 @@ describe("useListSettings", () => { it("omits init if value is present", () => { localStorage.setItem(listSettingsStorageKey, JSON.stringify(storedValue)); expect(localStorage.getItem(listSettingsStorageKey)).toBe( - JSON.stringify(storedValue) + JSON.stringify(storedValue), ); const { result } = renderHook(() => useListSettings(key)); @@ -50,10 +50,10 @@ describe("useListSettings", () => { it("properly merges new default values to saved ones", () => { localStorage.setItem( listSettingsStorageKey, - JSON.stringify(valueWithoutKey) + JSON.stringify(valueWithoutKey), ); expect(localStorage.getItem(listSettingsStorageKey)).toBe( - JSON.stringify(valueWithoutKey) + JSON.stringify(valueWithoutKey), ); const { result } = renderHook(() => useListSettings(key)); @@ -64,17 +64,17 @@ describe("useListSettings", () => { it("properly fills missing settings", () => { localStorage.setItem( listSettingsStorageKey, - JSON.stringify(valueWithoutSettings) + JSON.stringify(valueWithoutSettings), ); expect(localStorage.getItem(listSettingsStorageKey)).toBe( - JSON.stringify(valueWithoutSettings) + JSON.stringify(valueWithoutSettings), ); const { result } = renderHook(() => useListSettings(key)); expect(result.current.settings).toStrictEqual({ ...valueWithoutSettings[key], - ...defaultListSettings[key] + ...defaultListSettings[key], }); }); }); diff --git a/src/hooks/useListSettings.ts b/src/hooks/useListSettings.ts index 4d9705001..304ffc350 100644 --- a/src/hooks/useListSettings.ts +++ b/src/hooks/useListSettings.ts @@ -9,11 +9,11 @@ export interface UseListSettings { settings: ListSettings; updateListSettings: >( key: T, - value: ListSettings[T] + value: ListSettings[T], ) => void; } export default function useListSettings( - listName: ListViews + listName: ListViews, ): UseListSettings { const [settings, setListSettings] = useLocalStorage( listSettingsStorageKey, @@ -23,23 +23,23 @@ export default function useListSettings( } return merge({}, defaultListSettings, storedListSettings); - } + }, ); const updateListSettings = ( key: T, - value: ListSettings[T] + value: ListSettings[T], ) => setListSettings(settings => ({ ...settings, [listName]: { ...settings[listName], - [key]: value - } + [key]: value, + }, })); return { settings: settings[listName] as ListSettings, - updateListSettings + updateListSettings, }; } diff --git a/src/hooks/useLocalPageInfo.ts b/src/hooks/useLocalPageInfo.ts index 075c5605c..652187f71 100644 --- a/src/hooks/useLocalPageInfo.ts +++ b/src/hooks/useLocalPageInfo.ts @@ -40,12 +40,12 @@ function useLocalPageInfo(values: T[], paginateBy: number) { hasNextPage, hasPreviousPage, endCursor, - startCursor + startCursor, }, pageValues, loadNextPage, loadPreviousPage, - loadPage: setPage + loadPage: setPage, }; } export default useLocalPageInfo; diff --git a/src/hooks/useLocalPaginator.ts b/src/hooks/useLocalPaginator.ts index 041f2a060..e803e8174 100644 --- a/src/hooks/useLocalPaginator.ts +++ b/src/hooks/useLocalPaginator.ts @@ -20,26 +20,26 @@ export interface PaginationState { * @returns Pagination state and setter. */ export function useLocalPaginationState( - paginateBy: number + paginateBy: number, ): [PaginationState, (paginationState: PaginationState) => void] { const [state, setState] = useState({ - first: paginateBy + first: paginateBy, }); const setPaginationState = (paginationState: PaginationState) => { if (paginationState.after) { setState({ after: paginationState.after, - first: paginateBy + first: paginateBy, }); } else if (paginationState.before) { setState({ before: paginationState.before, - last: paginateBy + last: paginateBy, }); } else { setState({ - first: paginateBy + first: paginateBy, }); } }; @@ -59,15 +59,15 @@ export function useLocalPaginationState( */ export function useSectionLocalPaginationState( paginateBy: number, - section: string + section: string, ): [PaginationState, (paginationState: PaginationState) => void] { const [paginationSection, setPaginationSection] = useState(section); const [paginationState, setPaginationState] = useLocalPaginationState( - paginateBy + paginateBy, ); const fallbackPaginationState = { - first: paginateBy + first: paginateBy, }; useEffect(() => { @@ -84,33 +84,33 @@ export function useSectionLocalPaginationState( return [ section === paginationSection ? paginationState : fallbackPaginationState, - setPaginationState + setPaginationState, ]; } function useLocalPaginator( - setPaginationState: (paginationState: PaginationState) => void + setPaginationState: (paginationState: PaginationState) => void, ) { function paginate(pageInfo: PageInfo, paginationState: PaginationState) { const loadNextPage = () => setPaginationState({ ...paginationState, after: pageInfo.endCursor, - before: undefined + before: undefined, }); const loadPreviousPage = () => setPaginationState({ ...paginationState, after: undefined, - before: pageInfo.startCursor + before: pageInfo.startCursor, }); const newPageInfo = pageInfo ? { ...pageInfo, hasNextPage: !!paginationState.before || pageInfo.hasNextPage, - hasPreviousPage: !!paginationState.after || pageInfo.hasPreviousPage + hasPreviousPage: !!paginationState.after || pageInfo.hasPreviousPage, } : undefined; @@ -118,7 +118,7 @@ function useLocalPaginator( loadNextPage, loadPreviousPage, paginatorType: "click" as const, - pageInfo: newPageInfo + pageInfo: newPageInfo, }; } return paginate; diff --git a/src/hooks/useLocalStorage.test.ts b/src/hooks/useLocalStorage.test.ts index 64d704d2c..a2702485c 100644 --- a/src/hooks/useLocalStorage.test.ts +++ b/src/hooks/useLocalStorage.test.ts @@ -59,8 +59,8 @@ describe("useLocalStorage", () => { it("properly inits from callback if value is not found", () => { const { result } = renderHook(() => useLocalStorage(key, storedValue => - storedValue ? storedValue + postfix : initialValue - ) + storedValue ? storedValue + postfix : initialValue, + ), ); expect(result.current[0]).toBe(initialValue); @@ -71,8 +71,8 @@ describe("useLocalStorage", () => { const { result } = renderHook(() => useLocalStorage(key, storedValue => - storedValue ? storedValue + postfix : initialValue - ) + storedValue ? storedValue + postfix : initialValue, + ), ); expect(result.current[0]).toBe(savedValue + postfix); @@ -87,17 +87,17 @@ describe("useLocalStorage", () => { if (typeof storedValue === "object") { return { ...storedValue, - bar: "baz" + bar: "baz", }; } return objectValue; - }) + }), ); const newValue = { foo: numberValue, - bar: "baz" + bar: "baz", }; expect(result.current[0]).toStrictEqual(newValue); expect(localStorage.getItem(key)).toBe(JSON.stringify(newValue)); diff --git a/src/hooks/useLocalStorage.ts b/src/hooks/useLocalStorage.ts index 622097b74..19d48282f 100644 --- a/src/hooks/useLocalStorage.ts +++ b/src/hooks/useLocalStorage.ts @@ -3,7 +3,7 @@ import { Dispatch, SetStateAction, useState } from "react"; export type UseLocalStorage = [T, Dispatch>]; export default function useLocalStorage( key: string, - initialValue: SetStateAction + initialValue: SetStateAction, ): UseLocalStorage { const saveToLocalStorage = (valueToStore: T) => { try { diff --git a/src/hooks/useModalDialogErrors/useModalDialogErrors.test.ts b/src/hooks/useModalDialogErrors/useModalDialogErrors.test.ts index e61aafc0c..b559f7125 100644 --- a/src/hooks/useModalDialogErrors/useModalDialogErrors.test.ts +++ b/src/hooks/useModalDialogErrors/useModalDialogErrors.test.ts @@ -10,35 +10,35 @@ test("Does not render errors after close", () => { { initialProps: { errors: [] as string[], - open: false - } - } + open: false, + }, + }, ); // Open modal rerender({ errors: [], - open: true + open: true, }); expect(result.current.length).toBe(0); // Throw errors rerender({ errors, - open: true + open: true, }); expect(result.current.length).toBe(2); // Close modal rerender({ errors, - open: false + open: false, }); // Open modal rerender({ errors, - open: true + open: true, }); expect(result.current.length).toBe(0); }); diff --git a/src/hooks/useModalDialogErrors/useModalDialogErrors.ts b/src/hooks/useModalDialogErrors/useModalDialogErrors.ts index 54a393743..71979bcdf 100644 --- a/src/hooks/useModalDialogErrors/useModalDialogErrors.ts +++ b/src/hooks/useModalDialogErrors/useModalDialogErrors.ts @@ -3,12 +3,12 @@ import useStateFromProps from "../useStateFromProps"; function useModalDialogErrors( errors: TError[], - open: boolean + open: boolean, ): TError[] { const [state, setState] = useStateFromProps(errors); useModalDialogOpen(open, { - onClose: () => setState([]) + onClose: () => setState([]), }); return state; diff --git a/src/hooks/useModalDialogOpen/useModalDialogOpen.test.ts b/src/hooks/useModalDialogOpen/useModalDialogOpen.test.ts index 4df311372..d0de30795 100644 --- a/src/hooks/useModalDialogOpen/useModalDialogOpen.test.ts +++ b/src/hooks/useModalDialogOpen/useModalDialogOpen.test.ts @@ -7,7 +7,7 @@ const onOpen = jest.fn(); const cbs = { onClose, - onOpen + onOpen, }; test("Does not render errors after close", () => { @@ -16,15 +16,15 @@ test("Does not render errors after close", () => { { initialProps: { cbs, - open: false - } - } + open: false, + }, + }, ); // Open modal rerender({ cbs, - open: true + open: true, }); expect(onOpen).toBeCalledTimes(1); expect(onClose).toBeCalledTimes(0); @@ -32,7 +32,7 @@ test("Does not render errors after close", () => { // Rerender modal rerender({ cbs, - open: true + open: true, }); expect(onOpen).toBeCalledTimes(1); expect(onClose).toBeCalledTimes(0); @@ -40,7 +40,7 @@ test("Does not render errors after close", () => { // Close modal rerender({ cbs, - open: false + open: false, }); expect(onOpen).toBeCalledTimes(1); expect(onClose).toBeCalledTimes(1); @@ -48,7 +48,7 @@ test("Does not render errors after close", () => { // Open modal rerender({ cbs, - open: true + open: true, }); expect(onOpen).toBeCalledTimes(2); expect(onClose).toBeCalledTimes(1); diff --git a/src/hooks/useModalDialogOpen/useModalDialogOpen.ts b/src/hooks/useModalDialogOpen/useModalDialogOpen.ts index 8cfb88b2d..ff1c0ab27 100644 --- a/src/hooks/useModalDialogOpen/useModalDialogOpen.ts +++ b/src/hooks/useModalDialogOpen/useModalDialogOpen.ts @@ -5,7 +5,7 @@ function useModalDialogOpen( cbs: { onClose?: () => void; onOpen?: () => void; - } + }, ): void { const [prevOpen, setPrevOpen] = useState(open); diff --git a/src/hooks/useMultiAutocomplete.ts b/src/hooks/useMultiAutocomplete.ts index 01ad18a1b..4c9e3b1ef 100644 --- a/src/hooks/useMultiAutocomplete.ts +++ b/src/hooks/useMultiAutocomplete.ts @@ -6,23 +6,23 @@ import useListActions from "./useListActions"; function useMultiAutocomplete(initial: MultiAutocompleteChoiceType[] = []) { const { listElements, toggle } = useListActions( initial, - (a, b) => a.value === b.value + (a, b) => a.value === b.value, ); const handleSelect = ( event: React.ChangeEvent, - choices: MultiAutocompleteChoiceType[] + choices: MultiAutocompleteChoiceType[], ) => { const value: string = event.target.value; const match = choices.find(choice => choice.value === value); toggle({ label: maybe(() => match.label, value), - value + value, }); }; return { change: handleSelect, - data: listElements + data: listElements, }; } diff --git a/src/hooks/useNavigator.ts b/src/hooks/useNavigator.ts index 53dc3ae59..57ceb681c 100644 --- a/src/hooks/useNavigator.ts +++ b/src/hooks/useNavigator.ts @@ -8,19 +8,19 @@ export type UseNavigatorResult = ( replace?: boolean; preserveQs?: boolean; resetScroll?: boolean; - } + }, ) => void; function useNavigator(): UseNavigatorResult { const { location: { search }, - history + history, } = useRouter(); const { shouldBlockNavigation } = useContext(ExitFormDialogContext); return ( url: string, - { replace = false, preserveQs = false, resetScroll = false } = {} + { replace = false, preserveQs = false, resetScroll = false } = {}, ) => { if (shouldBlockNavigation()) { return; diff --git a/src/hooks/useNotifier/useNotifier.ts b/src/hooks/useNotifier/useNotifier.ts index 0f0e6257a..86cb9fd9b 100644 --- a/src/hooks/useNotifier/useNotifier.ts +++ b/src/hooks/useNotifier/useNotifier.ts @@ -1,7 +1,7 @@ import { IMessage, IMessageContext, - MessageContext + MessageContext, } from "@saleor/components/messages"; import { useContext } from "react"; diff --git a/src/hooks/useNotifier/utils.ts b/src/hooks/useNotifier/utils.ts index c0105c45b..b2b8f648c 100644 --- a/src/hooks/useNotifier/utils.ts +++ b/src/hooks/useNotifier/utils.ts @@ -5,14 +5,14 @@ import { IntlShape } from "react-intl"; export const getDefaultNotifierSuccessErrorData = ( errors: any[], - intl: IntlShape + intl: IntlShape, ): IMessage => !errors.length ? { status: "success", - text: intl.formatMessage(commonMessages.savedChanges) + text: intl.formatMessage(commonMessages.savedChanges), } : { status: "error", - text: intl.formatMessage(commonErrorMessages.unknownError) + text: intl.formatMessage(commonErrorMessages.unknownError), }; diff --git a/src/hooks/useOnSetDefaultVariant.ts b/src/hooks/useOnSetDefaultVariant.ts index 50946f4f7..1bc14e209 100644 --- a/src/hooks/useOnSetDefaultVariant.ts +++ b/src/hooks/useOnSetDefaultVariant.ts @@ -14,14 +14,14 @@ function useOnSetDefaultVariant(productId: string, variant: Node) { errors.map(error => notify({ status: "error", - text: getProductErrorMessage(error, intl) - }) + text: getProductErrorMessage(error, intl), + }), ); } else { const defaultVariant = data.productVariantSetDefault.product.variants.find( variant => variant.id === - data.productVariantSetDefault.product.defaultVariant.id + data.productVariantSetDefault.product.defaultVariant.id, ); if (defaultVariant) { notify({ @@ -29,22 +29,22 @@ function useOnSetDefaultVariant(productId: string, variant: Node) { text: intl.formatMessage( { id: "gSQ0Ge", - defaultMessage: "Variant {name} has been set as default." + defaultMessage: "Variant {name} has been set as default.", }, - { name: defaultVariant.name } - ) + { name: defaultVariant.name }, + ), }); } } - } + }, }); const onSetDefaultVariant = (selectedVariant = null) => { productVariantSetDefault({ variables: { productId, - variantId: variant ? variant.id : selectedVariant.id - } + variantId: variant ? variant.id : selectedVariant.id, + }, }); }; diff --git a/src/hooks/usePaginationReset.ts b/src/hooks/usePaginationReset.ts index 1a4d0d6d3..03a1f6e20 100644 --- a/src/hooks/usePaginationReset.ts +++ b/src/hooks/usePaginationReset.ts @@ -7,7 +7,7 @@ import useNavigator from "./useNavigator"; export function usePaginationReset( urlFunc: (params: T) => string, params: T, - rowNumber: number + rowNumber: number, ) { const navigate = useNavigator(); @@ -16,21 +16,21 @@ export function usePaginationReset( navigate( urlFunc({ ...params, - ...DEFAULT_INITIAL_PAGINATION_DATA + ...DEFAULT_INITIAL_PAGINATION_DATA, }), - { replace: true } + { replace: true }, ), - [rowNumber] + [rowNumber], ); useEffect( () => navigate( urlFunc({ - ...params + ...params, }), - { replace: true } + { replace: true }, ), - [params.before, params.after] + [params.before, params.after], ); } diff --git a/src/hooks/usePaginator.ts b/src/hooks/usePaginator.ts index e0dbce707..ac849887b 100644 --- a/src/hooks/usePaginator.ts +++ b/src/hooks/usePaginator.ts @@ -19,20 +19,20 @@ export interface PaginationState { export function createPaginationState( paginateBy: number, - queryString: Pagination + queryString: Pagination, ): PaginationState { return queryString && (queryString.before || queryString.after) ? queryString.after ? { after: queryString.after, - first: paginateBy + first: paginateBy, } : { before: queryString.before, - last: paginateBy + last: paginateBy, } : { - first: paginateBy + first: paginateBy, }; } @@ -45,7 +45,7 @@ interface UsePaginatorArgs { function usePaginator({ queryString, paginationState, - pageInfo + pageInfo, }: UsePaginatorArgs) { const newPageInfo = useMemo( () => @@ -53,10 +53,11 @@ function usePaginator({ ? { ...pageInfo, hasNextPage: !!paginationState.before || pageInfo.hasNextPage, - hasPreviousPage: !!paginationState.after || pageInfo.hasPreviousPage + hasPreviousPage: + !!paginationState.after || pageInfo.hasPreviousPage, } : undefined, - [paginationState, pageInfo] + [paginationState, pageInfo], ); const nextPageHref = useMemo(() => { @@ -69,7 +70,7 @@ function usePaginator({ stringifyQs({ ...queryString, after: pageInfo.endCursor, - before: undefined + before: undefined, }) ); }, [pageInfo?.endCursor, newPageInfo?.hasNextPage, queryString]); @@ -83,7 +84,7 @@ function usePaginator({ stringifyQs({ ...queryString, after: undefined, - before: pageInfo.startCursor + before: pageInfo.startCursor, }) ); }, [pageInfo?.startCursor, newPageInfo?.hasPreviousPage, queryString]); @@ -92,7 +93,7 @@ function usePaginator({ nextPageHref, prevPageHref, paginatorType: "link" as const, - ...newPageInfo + ...newPageInfo, }; } @@ -124,7 +125,7 @@ export type PaginatorContextValues = PaginatorContextValuesCommon & ); export const PaginatorContext = createContext( - null + null, ); export const usePaginatorContext = () => { @@ -132,7 +133,7 @@ export const usePaginatorContext = () => { if (context === null) { throw new Error( - "usePaginatorContext must be used within a PaginatorContext.Provider" + "usePaginatorContext must be used within a PaginatorContext.Provider", ); } diff --git a/src/hooks/useScroll.ts b/src/hooks/useScroll.ts index b9521ed90..61d1cb5b5 100644 --- a/src/hooks/useScroll.ts +++ b/src/hooks/useScroll.ts @@ -4,7 +4,7 @@ import { useEffect, useState } from "react"; function getPosition() { return { x: window.pageXOffset, - y: window.pageYOffset + y: window.pageYOffset, }; } diff --git a/src/hooks/useSearchQuery.ts b/src/hooks/useSearchQuery.ts index c12db30df..8543ad5ae 100644 --- a/src/hooks/useSearchQuery.ts +++ b/src/hooks/useSearchQuery.ts @@ -4,7 +4,7 @@ import React from "react"; export type UseSearchQuery = [string, (event: ChangeEvent) => void, () => void]; function useSearchQuery( onFetch: (query: string) => void, - initial?: string + initial?: string, ): UseSearchQuery { const [query, setQuery] = React.useState(initial || ""); const change = (event: ChangeEvent) => { @@ -18,8 +18,8 @@ function useSearchQuery( change({ target: { name: "", - value: initial || "" - } + value: initial || "", + }, }); return [query, change, reset]; diff --git a/src/hooks/useServiceWorker.ts b/src/hooks/useServiceWorker.ts index 5bebd2499..f75da1406 100644 --- a/src/hooks/useServiceWorker.ts +++ b/src/hooks/useServiceWorker.ts @@ -31,7 +31,7 @@ export const useServiceWorker = (timeout: number) => { useEffect(() => { register("/sw.js", { registered: onRegistered, - updated: onUpdate + updated: onUpdate, }); }, []); diff --git a/src/hooks/useStateFromProps.test.ts b/src/hooks/useStateFromProps.test.ts index 7069fbaa9..758e82ed2 100644 --- a/src/hooks/useStateFromProps.test.ts +++ b/src/hooks/useStateFromProps.test.ts @@ -5,8 +5,8 @@ import useStateFromProps from "./useStateFromProps"; function setupHook() { return renderHook(useStateFromProps, { initialProps: { - a: 0 - } + a: 0, + }, }); } diff --git a/src/hooks/useStateFromProps.ts b/src/hooks/useStateFromProps.ts index 9e8188849..66f5e23a6 100644 --- a/src/hooks/useStateFromProps.ts +++ b/src/hooks/useStateFromProps.ts @@ -8,7 +8,7 @@ export interface UseStateFromPropsOpts { function useStateFromProps( data: T, - opts: UseStateFromPropsOpts = {} + opts: UseStateFromPropsOpts = {}, ): [T, Dispatch>] { const [state, setState] = useState(data); const [prevData, setPrevData] = useState(data); diff --git a/src/hooks/useWindowScroll.ts b/src/hooks/useWindowScroll.ts index ccafe9e2e..883164ef4 100644 --- a/src/hooks/useWindowScroll.ts +++ b/src/hooks/useWindowScroll.ts @@ -4,7 +4,7 @@ import { useEffect, useState } from "react"; function getPosition() { return { x: window.pageXOffset, - y: window.pageYOffset + y: window.pageYOffset, }; } diff --git a/src/hooks/useWizard.ts b/src/hooks/useWizard.ts index 8e33d0d0b..e7ee9ff8a 100644 --- a/src/hooks/useWizard.ts +++ b/src/hooks/useWizard.ts @@ -12,7 +12,7 @@ export type UseWizard = [T, UseWizardActions]; function useWizard( initial: T, steps: T[], - opts?: UseWizardOpts + opts?: UseWizardOpts, ): UseWizard { const [stepIndex, setStepIndex] = useState(steps.indexOf(initial)); @@ -53,8 +53,8 @@ function useWizard( { next, prev, - set - } + set, + }, ]; } diff --git a/src/icons/AccountCircle.tsx b/src/icons/AccountCircle.tsx index 6e61fd5f5..1994d5ca4 100644 --- a/src/icons/AccountCircle.tsx +++ b/src/icons/AccountCircle.tsx @@ -15,7 +15,7 @@ const AccountCircle = createSvgIcon( , - "AccountCircle" + "AccountCircle", ); export default AccountCircle; diff --git a/src/icons/ArrowDropdown.tsx b/src/icons/ArrowDropdown.tsx index 5ab888a66..35acadfe0 100644 --- a/src/icons/ArrowDropdown.tsx +++ b/src/icons/ArrowDropdown.tsx @@ -5,7 +5,7 @@ const ArrowDropdown = createSvgIcon( , - "ArrowDropdown" + "ArrowDropdown", ); export default ArrowDropdown; diff --git a/src/icons/ArrowSort.tsx b/src/icons/ArrowSort.tsx index 2a424f531..837bcba85 100644 --- a/src/icons/ArrowSort.tsx +++ b/src/icons/ArrowSort.tsx @@ -11,7 +11,7 @@ const ArrowSort = createSvgIcon( fill="currentColor" /> , - "ArrowSort" + "ArrowSort", ); export default ArrowSort; diff --git a/src/icons/Attributes.tsx b/src/icons/Attributes.tsx index 28ed79a3a..8eac69714 100644 --- a/src/icons/Attributes.tsx +++ b/src/icons/Attributes.tsx @@ -8,7 +8,7 @@ const Attributes = createSvgIcon( d="M29 3C29.5523 3 30 3.44772 30 4V8C30 8.55229 29.5523 9 29 9C28.4477 9 28 8.55229 28 8V7L12 7V8C12 8.55229 11.5523 9 11 9C10.4477 9 10 8.55229 10 8V4C10 3.44772 10.4477 3 11 3C11.5523 3 12 3.44772 12 4V5L28 5V4C28 3.44772 28.4477 3 29 3ZM2 12C2 11.4477 2.44772 11 3 11H7C7.55228 11 8 11.4477 8 12C8 12.5523 7.55228 13 7 13H6V27H7C7.55228 27 8 27.4477 8 28C8 28.5523 7.55228 29 7 29H3C2.44772 29 2 28.5523 2 28C2 27.4477 2.44772 27 3 27H4V13H3C2.44772 13 2 12.5523 2 12ZM14.2997 11C13.1142 11 12.0398 11.6982 11.5583 12.7816L10.0862 16.0939C10.0294 16.2217 10 16.3601 10 16.5V26C10 27.6569 11.3431 29 13 29H27C28.6569 29 30 27.6569 30 26V16.5C30 16.3601 29.9706 16.2217 29.9138 16.0939L28.4417 12.7816C27.9602 11.6982 26.8858 11 25.7003 11H14.2997ZM13.3859 13.5939C13.5464 13.2327 13.9046 13 14.2997 13H25.7003C26.0954 13 26.4536 13.2327 26.6141 13.5939L27.4612 15.5H12.5388L13.3859 13.5939ZM23.5 17.5H28V26C28 26.5523 27.5523 27 27 27H13C12.4477 27 12 26.5523 12 26V17.5H16.5V23C16.5 23.3603 16.6938 23.6927 17.0073 23.8702C17.3208 24.0477 17.7056 24.0429 18.0145 23.8575L20 22.6662L21.9855 23.8575C22.2944 24.0429 22.6792 24.0477 22.9927 23.8702C23.3062 23.6927 23.5 23.3603 23.5 23V17.5ZM18.5 21.2338V17.5H21.5V21.2338L20.5145 20.6425C20.1978 20.4525 19.8022 20.4525 19.4855 20.6425L18.5 21.2338Z" fill="currentColor" />, - "Attributes" + "Attributes", ); export default (props: SvgIconProps) => ( diff --git a/src/icons/Ballot.tsx b/src/icons/Ballot.tsx index f8459a080..816b92060 100644 --- a/src/icons/Ballot.tsx +++ b/src/icons/Ballot.tsx @@ -12,7 +12,7 @@ const Ballot = createSvgIcon( , - "Ballot" + "Ballot", ); export default Ballot; diff --git a/src/icons/BoldIcon.tsx b/src/icons/BoldIcon.tsx index d2e905a32..a85bb8e7b 100644 --- a/src/icons/BoldIcon.tsx +++ b/src/icons/BoldIcon.tsx @@ -5,7 +5,7 @@ const BoldIcon = createSvgIcon( <> , - "BoldIcon" + "BoldIcon", ); export default BoldIcon; diff --git a/src/icons/Bot.tsx b/src/icons/Bot.tsx index 99eb38d5c..cbd9b13b2 100644 --- a/src/icons/Bot.tsx +++ b/src/icons/Bot.tsx @@ -8,7 +8,7 @@ const Bot = createSvgIcon( d="M22.1012 3.96887C22.1012 5.12931 21.1604 6.07004 20 6.07004C18.8396 6.07004 17.8988 5.12931 17.8988 3.96887C17.8988 2.80843 18.8396 1.8677 20 1.8677C21.1604 1.8677 22.1012 2.80843 22.1012 3.96887ZM20.856 7.84519C22.6365 7.45378 23.9689 5.86692 23.9689 3.96887C23.9689 1.77692 22.1919 0 20 0C17.8081 0 16.0311 1.77692 16.0311 3.96887C16.0311 5.81119 17.2864 7.36033 18.9883 7.80765V10.1167H5.29183V16.3424H0V28.7938H5.29183V35.0195H34.7082V28.7938H40V16.3424H34.7082V10.1167H20.856V7.84519ZM34.7082 26.9261V18.2101H38.1323V26.9261H34.7082ZM5.29183 18.2101H1.8677V26.9261H5.29183V18.2101ZM12.2986 26.3603H27.7916V33.1517H32.8405V11.9844H7.15953V33.1517H12.2986V26.3603ZM14.1663 33.1517V28.228H25.9239V33.1517H14.1663ZM16.6537 19.6887C16.6537 20.8151 15.7125 21.7899 14.4747 21.7899C13.2369 21.7899 12.2957 20.8151 12.2957 19.6887C12.2957 18.5623 13.2369 17.5875 14.4747 17.5875C15.7125 17.5875 16.6537 18.5623 16.6537 19.6887ZM18.5214 19.6887C18.5214 21.8807 16.7096 23.6576 14.4747 23.6576C12.2398 23.6576 10.428 21.8807 10.428 19.6887C10.428 17.4968 12.2398 15.7198 14.4747 15.7198C16.7096 15.7198 18.5214 17.4968 18.5214 19.6887ZM25.4475 21.7899C26.6079 21.7899 27.5486 20.8492 27.5486 19.6887C27.5486 18.5283 26.6079 17.5875 25.4475 17.5875C24.287 17.5875 23.3463 18.5283 23.3463 19.6887C23.3463 20.8492 24.287 21.7899 25.4475 21.7899ZM25.4475 23.6576C27.6394 23.6576 29.4163 21.8807 29.4163 19.6887C29.4163 17.4968 27.6394 15.7198 25.4475 15.7198C23.2555 15.7198 21.4786 17.4968 21.4786 19.6887C21.4786 21.8807 23.2555 23.6576 25.4475 23.6576Z" fill="#06847B" />, - "Bot" + "Bot", ); export default Bot; diff --git a/src/icons/Calendar.tsx b/src/icons/Calendar.tsx index dca2fced6..184ed1a47 100644 --- a/src/icons/Calendar.tsx +++ b/src/icons/Calendar.tsx @@ -23,6 +23,6 @@ export const Calendar = createSvgIcon( , - "Calendar" + "Calendar", ); export default Calendar; diff --git a/src/icons/Channels.tsx b/src/icons/Channels.tsx index 34d1792a4..a10f45903 100644 --- a/src/icons/Channels.tsx +++ b/src/icons/Channels.tsx @@ -8,7 +8,7 @@ const Channels = createSvgIcon( d="M22.2066 26.2723C20.3957 27.3688 18.2716 28 16 28C13.7284 28 11.6043 27.3688 9.7934 26.2723C9.9274 25.8726 10 25.4448 10 25C10 22.7909 8.20914 21 6 21C5.7019 21 5.41143 21.0326 5.13194 21.0945C4.4058 19.5481 4 17.8214 4 16C4 14.1786 4.4058 12.4519 5.13194 10.9055C5.41143 10.9674 5.7019 11 6 11C8.20914 11 10 9.20914 10 7C10 6.5552 9.9274 6.12736 9.7934 5.72768C11.6043 4.63116 13.7284 4 16 4C18.2716 4 20.3957 4.63116 22.2066 5.72768C22.0726 6.12736 22 6.5552 22 7C22 9.20914 23.7909 11 26 11C26.2981 11 26.5886 10.9674 26.8681 10.9055C27.5942 12.4519 28 14.1786 28 16C28 17.8214 27.5942 19.5481 26.8681 21.0945C26.5886 21.0326 26.2981 21 26 21C23.7909 21 22 22.7909 22 25C22 25.4448 22.0726 25.8726 22.2066 26.2723ZM23.2982 27.9496C21.173 29.2503 18.6741 30 16 30C13.3259 30 10.827 29.2503 8.70185 27.9496C7.9901 28.6019 7.04154 29 6 29C3.79086 29 2 27.2091 2 25C2 23.8076 2.52171 22.7371 3.34931 22.0043C2.48415 20.1847 2 18.1489 2 16C2 13.8511 2.48415 11.8153 3.34931 9.9957C2.52171 9.26286 2 8.19236 2 7C2 4.79086 3.79086 3 6 3C7.04154 3 7.99011 3.39808 8.70185 4.05039C10.827 2.7497 13.3259 2 16 2C18.6741 2 21.173 2.74971 23.2982 4.05039C24.0099 3.39808 24.9585 3 26 3C28.2091 3 30 4.79086 30 7C30 8.19236 29.4783 9.26286 28.6507 9.99569C29.5159 11.8153 30 13.8511 30 16C30 18.1489 29.5159 20.1847 28.6507 22.0043C29.4783 22.7371 30 23.8076 30 25C30 27.2091 28.2091 29 26 29C24.9585 29 24.0099 28.6019 23.2982 27.9496ZM6 9C7.10457 9 8 8.10457 8 7C8 5.89543 7.10457 5 6 5C4.89543 5 4 5.89543 4 7C4 8.10457 4.89543 9 6 9ZM26 9C27.1046 9 28 8.10457 28 7C28 5.89543 27.1046 5 26 5C24.8954 5 24 5.89543 24 7C24 8.10457 24.8954 9 26 9ZM28 25C28 26.1046 27.1046 27 26 27C24.8954 27 24 26.1046 24 25C24 23.8954 24.8954 23 26 23C27.1046 23 28 23.8954 28 25ZM6 27C7.10457 27 8 26.1046 8 25C8 23.8954 7.10457 23 6 23C4.89543 23 4 23.8954 4 25C4 26.1046 4.89543 27 6 27ZM17.6882 15C17.5151 13.5884 16.9729 12.0742 16 10.1898C15.0271 12.0742 14.4849 13.5884 14.3118 15H17.6882ZM18.3698 10.4862C20.2107 11.2784 21.5757 12.9657 21.917 15H19.7003C19.556 13.5436 19.1004 12.0837 18.3698 10.4862ZM19.7003 17H21.917C21.5757 19.0344 20.2107 20.7216 18.3697 21.5139C19.1003 19.9163 19.556 18.4564 19.7003 17ZM16 21.81C16.9729 19.9257 17.515 18.4115 17.6882 17H14.3118C14.485 18.4115 15.0271 19.9257 16 21.81ZM13.6302 10.4862C12.8996 12.0837 12.444 13.5436 12.2997 15H10.083C10.4243 12.9657 11.7893 11.2784 13.6302 10.4862ZM13.6303 21.5139C12.8997 19.9163 12.444 18.4564 12.2997 17H10.083C10.4243 19.0344 11.7893 20.7216 13.6303 21.5139ZM16 24C20.4183 24 24 20.4183 24 16C24 11.5817 20.4183 8 16 8C11.5817 8 8 11.5817 8 16C8 20.4183 11.5817 24 16 24Z" fill="currentColor" />, - "Channels" + "Channels", ); export default (props: SvgIconProps) => ( diff --git a/src/icons/Checkbox.tsx b/src/icons/Checkbox.tsx index d70977123..1b41e0351 100644 --- a/src/icons/Checkbox.tsx +++ b/src/icons/Checkbox.tsx @@ -12,7 +12,7 @@ const Checkbox = createSvgIcon( fill="none" /> , - "Checkbox" + "Checkbox", ); export default Checkbox; diff --git a/src/icons/CheckboxChecked.tsx b/src/icons/CheckboxChecked.tsx index 273b14a9e..177961d4e 100644 --- a/src/icons/CheckboxChecked.tsx +++ b/src/icons/CheckboxChecked.tsx @@ -11,7 +11,7 @@ const CheckboxChecked = createSvgIcon( fill="white" /> , - "CheckboxChecked" + "CheckboxChecked", ); export default CheckboxChecked; diff --git a/src/icons/CheckboxIndeterminate.tsx b/src/icons/CheckboxIndeterminate.tsx index 4cd8f8b99..c76da201c 100644 --- a/src/icons/CheckboxIndeterminate.tsx +++ b/src/icons/CheckboxIndeterminate.tsx @@ -13,7 +13,7 @@ const CheckboxIndeterminate = createSvgIcon( /> , - "CheckboxIndeterminate" + "CheckboxIndeterminate", ); export default CheckboxIndeterminate; diff --git a/src/icons/CheckboxSemiChecked.tsx b/src/icons/CheckboxSemiChecked.tsx index e90565604..3ca3f6154 100644 --- a/src/icons/CheckboxSemiChecked.tsx +++ b/src/icons/CheckboxSemiChecked.tsx @@ -6,7 +6,7 @@ const CheckboxSemiChecked = createSvgIcon( , - "CheckboxSemiChecked" + "CheckboxSemiChecked", ); export default CheckboxSemiChecked; diff --git a/src/icons/ChevronUp.tsx b/src/icons/ChevronUp.tsx index 04d45fb5f..7181f3b4d 100644 --- a/src/icons/ChevronUp.tsx +++ b/src/icons/ChevronUp.tsx @@ -10,7 +10,7 @@ const ChevronUp = createSvgIcon( stroke-width="2" /> , - "ChevronUp" + "ChevronUp", ); export default ChevronUp; diff --git a/src/icons/Draggable.tsx b/src/icons/Draggable.tsx index 181bd6f07..6a5e9419a 100644 --- a/src/icons/Draggable.tsx +++ b/src/icons/Draggable.tsx @@ -9,7 +9,7 @@ const Draggable = createSvgIcon( d="M3.5 2C3.5 2.82843 2.82843 3.5 2 3.5C1.17157 3.5 0.5 2.82843 0.5 2C0.5 1.17157 1.17157 0.5 2 0.5C2.82843 0.5 3.5 1.17157 3.5 2ZM4 2C4 3.10457 3.10457 4 2 4C0.895431 4 0 3.10457 0 2C0 0.895431 0.895431 0 2 0C3.10457 0 4 0.895431 4 2ZM9.5 2C9.5 2.82843 8.82843 3.5 8 3.5C7.17157 3.5 6.5 2.82843 6.5 2C6.5 1.17157 7.17157 0.5 8 0.5C8.82843 0.5 9.5 1.17157 9.5 2ZM10 2C10 3.10457 9.10457 4 8 4C6.89543 4 6 3.10457 6 2C6 0.895431 6.89543 0 8 0C9.10457 0 10 0.895431 10 2ZM8 9.5C8.82843 9.5 9.5 8.82843 9.5 8C9.5 7.17157 8.82843 6.5 8 6.5C7.17157 6.5 6.5 7.17157 6.5 8C6.5 8.82843 7.17157 9.5 8 9.5ZM8 10C9.10457 10 10 9.10457 10 8C10 6.89543 9.10457 6 8 6C6.89543 6 6 6.89543 6 8C6 9.10457 6.89543 10 8 10ZM3.5 8C3.5 8.82843 2.82843 9.5 2 9.5C1.17157 9.5 0.5 8.82843 0.5 8C0.5 7.17157 1.17157 6.5 2 6.5C2.82843 6.5 3.5 7.17157 3.5 8ZM4 8C4 9.10457 3.10457 10 2 10C0.895431 10 0 9.10457 0 8C0 6.89543 0.895431 6 2 6C3.10457 6 4 6.89543 4 8ZM2 15.5C2.82843 15.5 3.5 14.8284 3.5 14C3.5 13.1716 2.82843 12.5 2 12.5C1.17157 12.5 0.5 13.1716 0.5 14C0.5 14.8284 1.17157 15.5 2 15.5ZM2 16C3.10457 16 4 15.1046 4 14C4 12.8954 3.10457 12 2 12C0.895431 12 0 12.8954 0 14C0 15.1046 0.895431 16 2 16ZM9.5 14C9.5 14.8284 8.82843 15.5 8 15.5C7.17157 15.5 6.5 14.8284 6.5 14C6.5 13.1716 7.17157 12.5 8 12.5C8.82843 12.5 9.5 13.1716 9.5 14ZM10 14C10 15.1046 9.10457 16 8 16C6.89543 16 6 15.1046 6 14C6 12.8954 6.89543 12 8 12C9.10457 12 10 12.8954 10 14Z" fill="url(#paint0_linear)" style={{ - transform: "translate(7px, 4px)" + transform: "translate(7px, 4px)", }} /> @@ -26,7 +26,7 @@ const Draggable = createSvgIcon( , - "Draggable" + "Draggable", ); export default Draggable; diff --git a/src/icons/ErrorExclamationCircle.tsx b/src/icons/ErrorExclamationCircle.tsx index 59deb98ba..96b65f364 100644 --- a/src/icons/ErrorExclamationCircle.tsx +++ b/src/icons/ErrorExclamationCircle.tsx @@ -19,7 +19,7 @@ const ErrorExclamationCircle = createSvgIcon( /> , - "ErrorExclamationCircle" + "ErrorExclamationCircle", ); export default ErrorExclamationCircle; diff --git a/src/icons/Folder.tsx b/src/icons/Folder.tsx index 62b12d560..696b78b5e 100644 --- a/src/icons/Folder.tsx +++ b/src/icons/Folder.tsx @@ -7,7 +7,7 @@ const Folder = createSvgIcon( , - "Folder" + "Folder", ); export default Folder; diff --git a/src/icons/HeaderOne.tsx b/src/icons/HeaderOne.tsx index 43c830c72..0af6e9053 100644 --- a/src/icons/HeaderOne.tsx +++ b/src/icons/HeaderOne.tsx @@ -6,7 +6,7 @@ const HeaderOne = createSvgIcon( , - "HeaderOne" + "HeaderOne", ); export default HeaderOne; diff --git a/src/icons/HeaderThree.tsx b/src/icons/HeaderThree.tsx index 20b15f988..0cb0e9ab5 100644 --- a/src/icons/HeaderThree.tsx +++ b/src/icons/HeaderThree.tsx @@ -6,7 +6,7 @@ const HeaderThree = createSvgIcon( , - "HeaderThree" + "HeaderThree", ); export default HeaderThree; diff --git a/src/icons/HeaderTwo.tsx b/src/icons/HeaderTwo.tsx index 8da90be55..348482859 100644 --- a/src/icons/HeaderTwo.tsx +++ b/src/icons/HeaderTwo.tsx @@ -6,7 +6,7 @@ const HeaderTwo = createSvgIcon( , - "HeaderTwo" + "HeaderTwo", ); export default HeaderTwo; diff --git a/src/icons/Home.tsx b/src/icons/Home.tsx index 9bb63064e..af0f9f9cc 100644 --- a/src/icons/Home.tsx +++ b/src/icons/Home.tsx @@ -7,7 +7,7 @@ const Home = createSvgIcon( , - "Home" + "Home", ); export default Home; diff --git a/src/icons/Image.tsx b/src/icons/Image.tsx index d4172930b..3e3c11360 100644 --- a/src/icons/Image.tsx +++ b/src/icons/Image.tsx @@ -21,7 +21,7 @@ const Image = createSvgIcon( , - "Image" + "Image", ); export default Image; diff --git a/src/icons/ItalicIcon.tsx b/src/icons/ItalicIcon.tsx index 93eec7a9b..467d64c28 100644 --- a/src/icons/ItalicIcon.tsx +++ b/src/icons/ItalicIcon.tsx @@ -5,7 +5,7 @@ const ItalicIcon = createSvgIcon( <> , - "ItalicIcon" + "ItalicIcon", ); export default ItalicIcon; diff --git a/src/icons/LinkIcon.tsx b/src/icons/LinkIcon.tsx index bec755568..176b51d57 100644 --- a/src/icons/LinkIcon.tsx +++ b/src/icons/LinkIcon.tsx @@ -5,7 +5,7 @@ const LinkIcon = createSvgIcon( <> , - "LinkIcon" + "LinkIcon", ); export default LinkIcon; diff --git a/src/icons/LocalShipping.tsx b/src/icons/LocalShipping.tsx index f82297874..c96add146 100644 --- a/src/icons/LocalShipping.tsx +++ b/src/icons/LocalShipping.tsx @@ -7,7 +7,7 @@ const LocalShipping = createSvgIcon( , - "LocalShipping" + "LocalShipping", ); export default LocalShipping; diff --git a/src/icons/Monetization.tsx b/src/icons/Monetization.tsx index 81e6587be..9914a8864 100644 --- a/src/icons/Monetization.tsx +++ b/src/icons/Monetization.tsx @@ -9,7 +9,7 @@ const Monetization = createSvgIcon( , - "Monetization" + "Monetization", ); export default Monetization; diff --git a/src/icons/Moon.tsx b/src/icons/Moon.tsx index 02756b4bc..ce0c72d35 100644 --- a/src/icons/Moon.tsx +++ b/src/icons/Moon.tsx @@ -19,7 +19,7 @@ const Moon = createSvgIcon( d="M14.8213 10.155L15.1675 11.2692C15.2561 11.5543 15.3397 11.6951 15.4313 11.7839C15.5225 11.8722 15.6533 11.9399 15.9059 12.0123L16.9053 12.2987L15.9168 12.6207C15.6441 12.7096 15.5037 12.7913 15.4113 12.8848C15.3196 12.9776 15.2461 13.1115 15.1678 13.3662L14.8759 14.316L14.5618 13.3733C14.4791 13.1249 14.4002 12.9911 14.3039 12.8959C14.2052 12.7982 14.0616 12.7146 13.7979 12.6163L12.9004 12.2815L13.8199 12.0128C14.1052 11.9294 14.2479 11.8528 14.3373 11.7645C14.4227 11.6803 14.4923 11.5526 14.554 11.2907L14.8213 10.155ZM14.8759 12.1156C14.8477 12.151 14.8173 12.1849 14.7844 12.2174C14.7381 12.2631 14.6886 12.3042 14.636 12.3416C14.6762 12.3733 14.7147 12.4071 14.7514 12.4434C14.7883 12.4799 14.8224 12.5179 14.8542 12.5576C14.8862 12.5159 14.9208 12.4758 14.9586 12.4376C14.9986 12.3971 15.0409 12.3599 15.0855 12.3253C15.0521 12.2992 15.0197 12.2712 14.9885 12.2409C14.9479 12.2016 14.9106 12.1599 14.8759 12.1156Z" /> , - "Moon" + "Moon", ); export default Moon; diff --git a/src/icons/Navigation.tsx b/src/icons/Navigation.tsx index ceaae82b0..1aef06245 100644 --- a/src/icons/Navigation.tsx +++ b/src/icons/Navigation.tsx @@ -8,7 +8,7 @@ const Navigation = createSvgIcon( d="M28 16C28 22.6274 22.6274 28 16 28C9.37258 28 4 22.6274 4 16C4 9.37258 9.37258 4 16 4C22.6274 4 28 9.37258 28 16ZM30 16C30 23.732 23.732 30 16 30C8.26801 30 2 23.732 2 16C2 8.26801 8.26801 2 16 2C23.732 2 30 8.26801 30 16ZM23.1271 11.4417C23.7506 9.83112 22.1768 8.24068 20.5597 8.8471L8.83347 13.2444C7.18709 13.8618 7.08139 16.1506 8.66386 16.9171L12.4577 18.7547L14.8987 23.4842C15.6895 25.0163 17.9187 24.8968 18.5411 23.2889L23.1271 11.4417ZM9.53571 15.1171L21.262 10.7198L16.676 22.5669L14.235 17.8374C14.0366 17.4531 13.7189 17.1433 13.3296 16.9548L9.53571 15.1171Z" fill="currentColor" />, - "Navigation" + "Navigation", ); export default (props: SvgIconProps) => ( diff --git a/src/icons/NoPhoto.tsx b/src/icons/NoPhoto.tsx index 5948368d5..c37816d68 100644 --- a/src/icons/NoPhoto.tsx +++ b/src/icons/NoPhoto.tsx @@ -5,7 +5,7 @@ const NoPhoto = createSvgIcon( , - "NoPhoto" + "NoPhoto", ); export default NoPhoto; diff --git a/src/icons/OrderedListIcon.tsx b/src/icons/OrderedListIcon.tsx index 5bd973a85..c88f7ec73 100644 --- a/src/icons/OrderedListIcon.tsx +++ b/src/icons/OrderedListIcon.tsx @@ -5,7 +5,7 @@ const OrderedListIcon = createSvgIcon( <> , - "OrderedListIcon" + "OrderedListIcon", ); export default OrderedListIcon; diff --git a/src/icons/Orders.tsx b/src/icons/Orders.tsx index c68a81a9e..cd9e9a991 100644 --- a/src/icons/Orders.tsx +++ b/src/icons/Orders.tsx @@ -10,7 +10,7 @@ const Orders = createSvgIcon( fill="#06847B" /> , - "Orders" + "Orders", ); export default Orders; diff --git a/src/icons/PageTypes.tsx b/src/icons/PageTypes.tsx index 1e3e63b72..36366936a 100644 --- a/src/icons/PageTypes.tsx +++ b/src/icons/PageTypes.tsx @@ -8,7 +8,7 @@ const PageTypes = createSvgIcon( d="M9 4.00195C8.44772 4.00195 8 4.44967 8 5.00195V19.002C8 19.5542 8.44772 20.002 9 20.002H17C17.5523 20.002 18 19.5542 18 19.002V7.58038C18 7.31516 17.8946 7.06081 17.7071 6.87327L15.1287 4.29485C14.9411 4.10731 14.6868 4.00195 14.4216 4.00195H9ZM6 5.00195C6 3.3451 7.34315 2.00195 9 2.00195H14.4216C15.2172 2.00195 15.9803 2.31802 16.5429 2.88063L19.1213 5.45906C19.6839 6.02167 20 6.78473 20 7.58038V19.002C20 20.6588 18.6569 22.002 17 22.002H9C7.34315 22.002 6 20.6588 6 19.002V5.00195ZM4 6.00195C4.55228 6.00195 5 6.44967 5 7.00195V20.002C5 20.5542 4.55228 21.002 4 21.002C3.44772 21.002 3 20.5542 3 20.002V7.00195C3 6.44967 3.44772 6.00195 4 6.00195ZM10.5 13.002C10.2239 13.002 10 13.2258 10 13.502V14.502C10 14.7781 10.2239 15.002 10.5 15.002H15.5C15.7761 15.002 16 14.7781 16 14.502V13.502C16 13.2258 15.7761 13.002 15.5 13.002H10.5ZM10 10.502C10 10.2258 10.2239 10.002 10.5 10.002H15.5C15.7761 10.002 16 10.2258 16 10.502V11.502C16 11.7781 15.7761 12.002 15.5 12.002H10.5C10.2239 12.002 10 11.7781 10 11.502V10.502ZM10.5 16.002C10.2239 16.002 10 16.2258 10 16.502V17.502C10 17.7781 10.2239 18.002 10.5 18.002H15.5C15.7761 18.002 16 17.7781 16 17.502V16.502C16 16.2258 15.7761 16.002 15.5 16.002H10.5Z" fill="currentColor" />, - "PageTypes" + "PageTypes", ); export default (props: SvgIconProps) => ( diff --git a/src/icons/Pages.tsx b/src/icons/Pages.tsx index 97517da40..a9f2f0724 100644 --- a/src/icons/Pages.tsx +++ b/src/icons/Pages.tsx @@ -10,7 +10,7 @@ const Pages = createSvgIcon( fill="#06847B" /> , - "Pages" + "Pages", ); export default Pages; diff --git a/src/icons/PermissionGroups.tsx b/src/icons/PermissionGroups.tsx index 8f4efadb9..385122762 100644 --- a/src/icons/PermissionGroups.tsx +++ b/src/icons/PermissionGroups.tsx @@ -8,7 +8,7 @@ const PermissionGroups = createSvgIcon( d="M16 4C13.7909 4 12 5.79086 12 8V11.9355C13.205 11.3367 14.5632 11 16 11C17.4368 11 18.795 11.3367 20 11.9355V8C20 5.79086 18.2091 4 16 4ZM22 13.2917V8C22 4.68629 19.3137 2 16 2C12.6863 2 10 4.68629 10 8V13.2917C8.15875 14.9396 7 17.3345 7 20C7 24.9706 11.0294 29 16 29C20.9706 29 25 24.9706 25 20C25 17.3345 23.8412 14.9396 22 13.2917ZM14 18C14 17.4477 14.4477 17 15 17H17C17.5523 17 18 17.4477 18 18C18 18.5523 17.5523 19 17 19V22C17 22.5523 16.5523 23 16 23C15.4477 23 15 22.5523 15 22V19C14.4477 19 14 18.5523 14 18ZM23 20C23 23.866 19.866 27 16 27C12.134 27 9 23.866 9 20C9 16.134 12.134 13 16 13C19.866 13 23 16.134 23 20Z" fill="currentColor" />, - "PermissionGroups" + "PermissionGroups", ); export default (props: SvgIconProps) => ( diff --git a/src/icons/Plugins.tsx b/src/icons/Plugins.tsx index 6eede27d1..b17569626 100644 --- a/src/icons/Plugins.tsx +++ b/src/icons/Plugins.tsx @@ -12,7 +12,7 @@ const Plugins = createSvgIcon( /> , - "Plugins" + "Plugins", ); export default Plugins; diff --git a/src/icons/ProductTypes.tsx b/src/icons/ProductTypes.tsx index c6c317d34..14b71480f 100644 --- a/src/icons/ProductTypes.tsx +++ b/src/icons/ProductTypes.tsx @@ -10,7 +10,7 @@ const ProductTypes = createSvgIcon( fill="currentColor" /> , - "ProductTypes" + "ProductTypes", ); export default (props: SvgIconProps) => ( diff --git a/src/icons/QuotationIcon.tsx b/src/icons/QuotationIcon.tsx index cf2559bac..ea238a2a2 100644 --- a/src/icons/QuotationIcon.tsx +++ b/src/icons/QuotationIcon.tsx @@ -5,7 +5,7 @@ const QuotationIcon = createSvgIcon( <> , - "QuotationIcon" + "QuotationIcon", ); export default QuotationIcon; diff --git a/src/icons/Sales.tsx b/src/icons/Sales.tsx index deda25364..9e860b70b 100644 --- a/src/icons/Sales.tsx +++ b/src/icons/Sales.tsx @@ -10,7 +10,7 @@ const Sales = createSvgIcon( fill="#06847B" /> , - "Sales" + "Sales", ); export default Sales; diff --git a/src/icons/ShippingMethods.tsx b/src/icons/ShippingMethods.tsx index 04ce531fe..6433d0365 100644 --- a/src/icons/ShippingMethods.tsx +++ b/src/icons/ShippingMethods.tsx @@ -8,7 +8,7 @@ const ShippingMethods = createSvgIcon( d="M12.4476 8.88049C12.5081 8.37806 12.9344 8 13.4405 8H15.8867L15.4413 10.467C15.109 12.3074 16.5233 14 18.3936 14H20.8289C22.2801 14 23.5233 12.9612 23.7812 11.533L24.4191 8H26.7449C27.3446 8 27.8094 8.52414 27.7378 9.11951L26.0526 23.1195C25.9921 23.6219 25.5658 24 25.0598 24H11.7553C11.1556 24 10.6908 23.4759 10.7625 22.8805L12.4476 8.88049ZM17.4095 10.8223L17.9191 8H22.3867L21.813 11.1777C21.727 11.6537 21.3126 12 20.8289 12H18.3936C17.7702 12 17.2987 11.4358 17.4095 10.8223ZM13.4405 6C11.9223 6 10.6434 7.13417 10.462 8.64148L8.7768 22.6415C8.5618 24.4276 9.95629 26 11.7553 26H25.0598C26.5779 26 27.8568 24.8658 28.0383 23.3585L29.7234 9.35852C29.9384 7.57241 28.5439 6 26.7449 6H13.4405ZM3 9.78943C2.44772 9.78943 2 10.2371 2 10.7894C2 11.3417 2.44772 11.7894 3 11.7894H8.57143C9.12371 11.7894 9.57143 11.3417 9.57143 10.7894C9.57143 10.2371 9.12371 9.78943 8.57143 9.78943H3ZM2 15.5264C2 14.9741 2.44772 14.5264 3 14.5264H7.64286C8.19514 14.5264 8.64286 14.9741 8.64286 15.5264C8.64286 16.0787 8.19514 16.5264 7.64286 16.5264H3C2.44772 16.5264 2 16.0787 2 15.5264ZM3 19.2632C2.44772 19.2632 2 19.7109 2 20.2632C2 20.8155 2.44772 21.2632 3 21.2632H6.71429C7.26657 21.2632 7.71429 20.8155 7.71429 20.2632C7.71429 19.7109 7.26657 19.2632 6.71429 19.2632H3Z" fill="currentColor" />, - "ShippingMethods" + "ShippingMethods", ); export default (props: SvgIconProps) => ( diff --git a/src/icons/Shop.tsx b/src/icons/Shop.tsx index 8e3cdf021..90f3feea3 100644 --- a/src/icons/Shop.tsx +++ b/src/icons/Shop.tsx @@ -9,7 +9,7 @@ const Shop = createSvgIcon( , - "Shop" + "Shop", ); export default Shop; diff --git a/src/icons/SiteSettings.tsx b/src/icons/SiteSettings.tsx index 192b49ea4..8fe880a4f 100644 --- a/src/icons/SiteSettings.tsx +++ b/src/icons/SiteSettings.tsx @@ -16,7 +16,7 @@ const SiteSettings = createSvgIcon( fill="currentColor" /> , - "SiteSettings" + "SiteSettings", ); export default (props: SvgIconProps) => ( diff --git a/src/icons/StaffMembers.tsx b/src/icons/StaffMembers.tsx index 575a730b6..111554d55 100644 --- a/src/icons/StaffMembers.tsx +++ b/src/icons/StaffMembers.tsx @@ -8,7 +8,7 @@ const StaffMembers = createSvgIcon( d="M10 4C10 2.89543 10.8954 2 12 2H14C15.1046 2 16 2.89543 16 4V5.5H19C20.6569 5.5 22 6.84315 22 8.5V27C22 28.6569 20.6569 30 19 30H7C5.34315 30 4 28.6569 4 27V8.5C4 6.84315 5.34315 5.5 7 5.5H10V4ZM10 7.5H7C6.44772 7.5 6 7.94772 6 8.5V27C6 27.5523 6.44772 28 7 28H19C19.5523 28 20 27.5523 20 27V8.5C20 7.94772 19.5523 7.5 19 7.5H16V7.57143C16 8.676 15.1046 9.57143 14 9.57143H12C10.8954 9.57143 10 8.676 10 7.57143V7.5ZM14 4H12V7.57143L14 7.57143V4ZM8.5835 18.4762C8.5835 16.5563 10.1398 15 12.0597 15H14.4406C16.3605 15 17.9168 16.5563 17.9168 18.4762C17.9168 19.7123 16.9148 20.7143 15.6787 20.7143H10.8216C9.58553 20.7143 8.5835 19.7123 8.5835 18.4762ZM12.0597 17C11.2444 17 10.5835 17.6609 10.5835 18.4762C10.5835 18.6077 10.6901 18.7143 10.8216 18.7143H15.6787C15.8102 18.7143 15.9168 18.6077 15.9168 18.4762C15.9168 17.6609 15.2559 17 14.4406 17H12.0597ZM8.66675 21.5C8.11446 21.5 7.66675 21.9477 7.66675 22.5C7.66675 23.0523 8.11446 23.5 8.66675 23.5H17.8334C18.3857 23.5 18.8334 23.0523 18.8334 22.5C18.8334 21.9477 18.3857 21.5 17.8334 21.5H8.66675ZM7.66675 25.2858C7.66675 24.7335 8.11446 24.2858 8.66675 24.2858H11.4167C11.969 24.2858 12.4167 24.7335 12.4167 25.2858C12.4167 25.8381 11.969 26.2858 11.4167 26.2858H8.66675C8.11446 26.2858 7.66675 25.8381 7.66675 25.2858ZM16.0002 24.2858C15.448 24.2858 15.0002 24.7335 15.0002 25.2858C15.0002 25.8381 15.448 26.2858 16.0002 26.2858H17.8336C18.3859 26.2858 18.8336 25.8381 18.8336 25.2858C18.8336 24.7335 18.3859 24.2858 17.8336 24.2858H16.0002ZM15.0834 12.2857C15.0834 13.3114 14.2626 14.1429 13.2501 14.1429C12.2376 14.1429 11.4167 13.3114 11.4167 12.2857C11.4167 11.2601 12.2376 10.4286 13.2501 10.4286C14.2626 10.4286 15.0834 11.2601 15.0834 12.2857ZM21 2C20.4477 2 20 2.44772 20 3C20 3.55228 20.4477 4 21 4H25C25.5523 4 26 4.44772 26 5V25C26 25.5523 25.5523 26 25 26H24.4285C23.8763 26 23.4285 26.4477 23.4285 27C23.4285 27.5523 23.8763 28 24.4285 28H25C26.6569 28 28 26.6569 28 25V5C28 3.34314 26.6569 2 25 2H21Z" fill="currentColor" />, - "StaffMembers" + "StaffMembers", ); export default (props: SvgIconProps) => ( diff --git a/src/icons/StoreMall.tsx b/src/icons/StoreMall.tsx index 9c0955769..ba85bd44a 100644 --- a/src/icons/StoreMall.tsx +++ b/src/icons/StoreMall.tsx @@ -7,7 +7,7 @@ const StoreMall = createSvgIcon( , - "StoreMall" + "StoreMall", ); export default StoreMall; diff --git a/src/icons/Sun.tsx b/src/icons/Sun.tsx index 41265e83d..fc6431a26 100644 --- a/src/icons/Sun.tsx +++ b/src/icons/Sun.tsx @@ -9,7 +9,7 @@ const Sun = createSvgIcon( d="M12.6363 5V7.54545H11.3636V5H12.6363ZM11.9999 13.9091C13.0543 13.9091 13.909 13.0544 13.909 12C13.909 10.9456 13.0543 10.0909 11.9999 10.0909C10.9456 10.0909 10.0908 10.9456 10.0908 12C10.0908 13.0544 10.9456 13.9091 11.9999 13.9091ZM11.9999 15.1818C13.7572 15.1818 15.1817 13.7573 15.1817 12C15.1817 10.2427 13.7572 8.81818 11.9999 8.81818C10.2427 8.81818 8.8181 10.2427 8.8181 12C8.8181 13.7573 10.2427 15.1818 11.9999 15.1818ZM14.6998 8.40019L15.5997 9.30014L17.3996 7.50023L16.4997 6.60028L14.6998 8.40019ZM12.6363 16.4545V19H11.3636V16.4545H12.6363ZM6.60019 16.4998L7.50015 17.3997L9.30006 15.5998L8.4001 14.6999L6.60019 16.4998ZM14.6999 15.5998L15.5999 14.6998L17.3998 16.4997L16.4998 17.3997L14.6999 15.5998ZM6.60025 7.5002L8.40016 9.3001L9.30012 8.40015L7.50021 6.60024L6.60025 7.5002ZM19 12.6363H16.4545L16.4545 11.3636H19V12.6363ZM5 12.6364L7.54545 12.6364V11.3637H5V12.6364Z" /> , - "Sun" + "Sun", ); export default Sun; diff --git a/src/icons/Taxes.tsx b/src/icons/Taxes.tsx index 9905be6ec..99a8df051 100644 --- a/src/icons/Taxes.tsx +++ b/src/icons/Taxes.tsx @@ -8,7 +8,7 @@ const Taxes = createSvgIcon( d="M8 4C7.44772 4 7 4.44772 7 5V27C7 27.5523 7.44772 28 8 28H24C24.5523 28 25 27.5523 25 27V5C25 4.44772 24.5523 4 24 4H8ZM5 5C5 3.34315 6.34315 2 8 2H24C25.6569 2 27 3.34315 27 5V27C27 28.6569 25.6569 30 24 30H8C6.34315 30 5 28.6569 5 27V5ZM9 9C9 7.89543 9.89543 7 11 7L21 7C22.1046 7 23 7.89543 23 9V11C23 12.1046 22.1046 13 21 13H11C9.89543 13 9 12.1046 9 11V9ZM21 9L11 9V11H21V9ZM12 17C12.5523 17 13 16.5523 13 16C13 15.4477 12.5523 15 12 15C11.4477 15 11 15.4477 11 16C11 16.5523 11.4477 17 12 17ZM17 16C17 16.5523 16.5523 17 16 17C15.4477 17 15 16.5523 15 16C15 15.4477 15.4477 15 16 15C16.5523 15 17 15.4477 17 16ZM20 17C20.5523 17 21 16.5523 21 16C21 15.4477 20.5523 15 20 15C19.4477 15 19 15.4477 19 16C19 16.5523 19.4477 17 20 17ZM13 20C13 20.5523 12.5523 21 12 21C11.4477 21 11 20.5523 11 20C11 19.4477 11.4477 19 12 19C12.5523 19 13 19.4477 13 20ZM16 21C16.5523 21 17 20.5523 17 20C17 19.4477 16.5523 19 16 19C15.4477 19 15 19.4477 15 20C15 20.5523 15.4477 21 16 21ZM21 20C21 20.5523 20.5523 21 20 21C19.4477 21 19 20.5523 19 20C19 19.4477 19.4477 19 20 19C20.5523 19 21 19.4477 21 20ZM16 25C16.5523 25 17 24.5523 17 24C17 23.4477 16.5523 23 16 23C15.4477 23 15 23.4477 15 24C15 24.5523 15.4477 25 16 25Z" fill="currentColor" />, - "Taxes" + "Taxes", ); export default (props: SvgIconProps) => ( diff --git a/src/icons/Trash.tsx b/src/icons/Trash.tsx index b41cbcd79..15a459773 100644 --- a/src/icons/Trash.tsx +++ b/src/icons/Trash.tsx @@ -21,7 +21,7 @@ const Trash: React.FC = () => { fillOpacity="0.6" /> , - "Trash" + "Trash", ); return ; diff --git a/src/icons/Truck.tsx b/src/icons/Truck.tsx index 217b79a9a..9ccc2757d 100644 --- a/src/icons/Truck.tsx +++ b/src/icons/Truck.tsx @@ -8,7 +8,7 @@ const Truck = createSvgIcon( fill="#616161" /> , - "Truck" + "Truck", ); export default Truck; diff --git a/src/icons/UnorderedListIcon.tsx b/src/icons/UnorderedListIcon.tsx index 345b5a64d..aaf3e57fc 100644 --- a/src/icons/UnorderedListIcon.tsx +++ b/src/icons/UnorderedListIcon.tsx @@ -5,7 +5,7 @@ const UnorderedListIcon = createSvgIcon( <> , - "UnorderedListIcon" + "UnorderedListIcon", ); export default UnorderedListIcon; diff --git a/src/icons/Unstyled.tsx b/src/icons/Unstyled.tsx index e16d32fd7..bbb689740 100644 --- a/src/icons/Unstyled.tsx +++ b/src/icons/Unstyled.tsx @@ -9,7 +9,7 @@ const Unstyled = createSvgIcon( d="M17.5028 0H17.5027H15.0886H11.4673V2.41416L15.0886 2.41416V9.65714H5.43187V7.72803L0 10.8641L5.43187 14.0002V12.0713L17.5025 12.0713V12.0708H17.5028V0Z" /> , - "Unstyled" + "Unstyled", ); export default Unstyled; diff --git a/src/icons/Warehouses.tsx b/src/icons/Warehouses.tsx index 1d9f363e1..c62b2df59 100644 --- a/src/icons/Warehouses.tsx +++ b/src/icons/Warehouses.tsx @@ -8,7 +8,7 @@ const Warehouses = createSvgIcon( d="M10.5 5C10.5 4.44772 10.9477 4 11.5 4H13.1429V6.64286C13.1429 7.74743 14.0383 8.64286 15.1429 8.64286H16.8571C17.9617 8.64286 18.8571 7.74743 18.8571 6.64286V4H20.5C21.0523 4 21.5 4.44772 21.5 5V14C21.5 14.5523 21.0523 15 20.5 15H18H14H11.5C10.9477 15 10.5 14.5523 10.5 14V5ZM8.67071 15C8.56015 14.6872 8.5 14.3506 8.5 14V5C8.5 3.34315 9.84314 2 11.5 2H20.5C22.1569 2 23.5 3.34315 23.5 5V14C23.5 14.3506 23.4398 14.6872 23.3293 15H27C28.6569 15 30 16.3431 30 18V27C30 28.6569 28.6569 30 27 30H18C17.2316 30 16.5308 29.7111 16 29.2361C15.4692 29.7111 14.7684 30 14 30H5C3.34315 30 2 28.6569 2 27V18C2 16.3431 3.34315 15 5 15H8.67071ZM12.3571 17V19.6429C12.3571 20.7474 11.4617 21.6429 10.3571 21.6429H8.64286C7.53829 21.6429 6.64286 20.7474 6.64286 19.6429V17H5C4.44772 17 4 17.4477 4 18V27C4 27.5523 4.44772 28 5 28H14C14.5523 28 15 27.5523 15 27V18C15 17.4477 14.5523 17 14 17H12.3571ZM18 17C17.4477 17 17 17.4477 17 18V27C17 27.5523 17.4477 28 18 28H27C27.5523 28 28 27.5523 28 27V18C28 17.4477 27.5523 17 27 17H25.3571V19.6429C25.3571 20.7474 24.4617 21.6429 23.3571 21.6429H21.6429C20.5383 21.6429 19.6429 20.7474 19.6429 19.6429V17H18ZM15.1429 6.64286V4H16.8571V6.64286L15.1429 6.64286ZM8.64286 17V19.6429H10.3571V17H8.64286ZM21.6429 17V19.6429H23.3571V17H21.6429Z" fill="currentColor" />, - "Warehouses" + "Warehouses", ); export default (props: SvgIconProps) => ( diff --git a/src/icons/Webhooks.tsx b/src/icons/Webhooks.tsx index 6bffccbfd..4b221c4bf 100644 --- a/src/icons/Webhooks.tsx +++ b/src/icons/Webhooks.tsx @@ -10,7 +10,7 @@ const Webhooks = createSvgIcon( fill="#06847B" /> , - "Webhooks" + "Webhooks", ); export default Webhooks; diff --git a/src/index.tsx b/src/index.tsx index 9e63e48f5..b26255824 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -26,7 +26,7 @@ import { channelsSection } from "./channels/urls"; import CollectionSection from "./collections"; import AppLayout from "./components/AppLayout"; import useAppChannel, { - AppChannelProvider + AppChannelProvider, } from "./components/AppLayout/AppChannelContext"; import { DateProvider } from "./components/Date"; import ExitFormDialogProvider from "./components/Form/ExitFormDialogProvider"; @@ -134,9 +134,9 @@ const Routes: React.FC = () => { dispatchAppState({ payload: { error: "unhandled", - errorId + errorId, }, - type: "displayError" + type: "displayError", }); }} > @@ -175,7 +175,7 @@ const Routes: React.FC = () => { { /> { ({ iframe: { height: "100vh", - position: "sticky" - } + position: "sticky", + }, }), { - name: "marketplaceStyles" - } + name: "marketplaceStyles", + }, ); export { useStyles }; diff --git a/src/misc.ts b/src/misc.ts index 6107db075..59d1dfd90 100644 --- a/src/misc.ts +++ b/src/misc.ts @@ -4,7 +4,7 @@ import { CountryCode, DateRangeInput, OrderStatus, - PaymentChargeStatusEnum + PaymentChargeStatusEnum, } from "@saleor/graphql"; import { ConfirmButtonTransitionState, ThemeType } from "@saleor/macaw-ui"; import uniqBy from "lodash/uniqBy"; @@ -17,13 +17,13 @@ import { commonStatusMessages, errorMessages, orderStatusMessages, - paymentStatusMessages + paymentStatusMessages, } from "./intl"; import { MutationResultAdditionalProps, PartialMutationProviderOutput, StatusType, - UserError + UserError, } from "./types"; export type RequireAtLeastOne = Pick< @@ -46,9 +46,9 @@ export function renderCollection( renderItem: ( item: T | undefined, index: number | undefined, - collection: T[] + collection: T[], ) => any, - renderEmpty?: (collection: T[]) => any + renderEmpty?: (collection: T[]) => any, ) { if (collection === undefined) { return renderItem(undefined, undefined, collection); @@ -75,105 +75,105 @@ export const removeDoubleSlashes = (url: string) => export const transformPaymentStatus = ( status: string, - intl: IntlShape + intl: IntlShape, ): { localized: string; status: StatusType } => { switch (status) { case PaymentChargeStatusEnum.PARTIALLY_CHARGED: return { localized: intl.formatMessage(paymentStatusMessages.partiallyPaid), - status: StatusType.ERROR + status: StatusType.ERROR, }; case PaymentChargeStatusEnum.FULLY_CHARGED: return { localized: intl.formatMessage(paymentStatusMessages.paid), - status: StatusType.SUCCESS + status: StatusType.SUCCESS, }; case PaymentChargeStatusEnum.PARTIALLY_REFUNDED: return { localized: intl.formatMessage(paymentStatusMessages.partiallyRefunded), - status: StatusType.INFO + status: StatusType.INFO, }; case PaymentChargeStatusEnum.FULLY_REFUNDED: return { localized: intl.formatMessage(paymentStatusMessages.refunded), - status: StatusType.INFO + status: StatusType.INFO, }; case PaymentChargeStatusEnum.PENDING: return { localized: intl.formatMessage(paymentStatusMessages.pending), - status: StatusType.WARNING + status: StatusType.WARNING, }; case PaymentChargeStatusEnum.REFUSED: return { localized: intl.formatMessage(paymentStatusMessages.refused), - status: StatusType.ERROR + status: StatusType.ERROR, }; case PaymentChargeStatusEnum.CANCELLED: return { localized: intl.formatMessage(commonStatusMessages.cancelled), - status: StatusType.ERROR + status: StatusType.ERROR, }; case PaymentChargeStatusEnum.NOT_CHARGED: return { localized: intl.formatMessage(paymentStatusMessages.unpaid), - status: StatusType.ERROR + status: StatusType.ERROR, }; } return { localized: status, - status: StatusType.ERROR + status: StatusType.ERROR, }; }; export const transformOrderStatus = ( status: string, - intl: IntlShape + intl: IntlShape, ): { localized: string; status: StatusType } => { switch (status) { case OrderStatus.FULFILLED: return { localized: intl.formatMessage(orderStatusMessages.fulfilled), - status: StatusType.SUCCESS + status: StatusType.SUCCESS, }; case OrderStatus.PARTIALLY_FULFILLED: return { localized: intl.formatMessage(orderStatusMessages.partiallyFulfilled), - status: StatusType.WARNING + status: StatusType.WARNING, }; case OrderStatus.UNFULFILLED: return { localized: intl.formatMessage(orderStatusMessages.unfulfilled), - status: StatusType.ERROR + status: StatusType.ERROR, }; case OrderStatus.CANCELED: return { localized: intl.formatMessage(commonStatusMessages.cancelled), - status: StatusType.ERROR + status: StatusType.ERROR, }; case OrderStatus.DRAFT: return { localized: intl.formatMessage(orderStatusMessages.draft), - status: StatusType.INFO + status: StatusType.INFO, }; case OrderStatus.UNCONFIRMED: return { localized: intl.formatMessage(orderStatusMessages.unconfirmed), - status: StatusType.INFO + status: StatusType.INFO, }; case OrderStatus.PARTIALLY_RETURNED: return { localized: intl.formatMessage(orderStatusMessages.partiallyReturned), - status: StatusType.INFO + status: StatusType.INFO, }; case OrderStatus.RETURNED: return { localized: intl.formatMessage(orderStatusMessages.returned), - status: StatusType.INFO + status: StatusType.INFO, }; } return { localized: status, - status: StatusType.ERROR + status: StatusType.ERROR, }; }; @@ -188,7 +188,7 @@ export const transformAddressToForm = (data?: AddressType) => ({ phone: data?.phone || "", postalCode: data?.postalCode || "", streetAddress1: data?.streetAddress1 || "", - streetAddress2: data?.streetAddress2 || "" + streetAddress2: data?.streetAddress2 || "", }); export function maybe(exp: () => T): T | undefined; @@ -204,7 +204,7 @@ export function maybe(exp: any, d?: any) { export function only(obj: T, key: keyof T): boolean { return Object.keys(obj).every(objKey => - objKey === key ? obj[key] !== undefined : obj[key] === undefined + objKey === key ? obj[key] !== undefined : obj[key] === undefined, ); } @@ -247,7 +247,7 @@ export const extractMutationErrors = async < TPromise extends Promise>, TErrors extends ReturnType >( - submitPromise: TPromise + submitPromise: TPromise, ): Promise => { const result = await submitPromise; @@ -261,14 +261,14 @@ export const getMutationErrors = < TData extends T["data"], TErrors extends TData[keyof TData]["errors"] >( - result: T + result: T, ): TErrors[] => { if (!result?.data) { return [] as TErrors; } return Object.values(result.data).reduce( (acc: TErrors[], mut: TData) => [...acc, ...(mut.errors || [])], - [] as TErrors[] + [] as TErrors[], ) as TErrors; }; @@ -282,18 +282,18 @@ export function getMutationStatus< export function getMutationProviderData( mutateFn: MutationFunction, - opts: MutationResult & MutationResultAdditionalProps + opts: MutationResult & MutationResultAdditionalProps, ): PartialMutationProviderOutput { return { mutate: variables => mutateFn({ variables }), - opts + opts, }; } export const parseLogMessage = ({ intl, code, - field + field, }: { intl: IntlShape; code: string; @@ -304,8 +304,8 @@ export const parseLogMessage = ({ fieldError: field && intl.formatMessage(errorMessages.codeErrorFieldMessage, { - fieldName: field - }) + fieldName: field, + }), }); interface User { @@ -337,7 +337,7 @@ interface AnyEventWithPropagation { stopPropagation: () => void; } export function stopPropagation( - cb: (event?: T) => void + cb: (event?: T) => void, ) { return (event: T) => { event.stopPropagation(); @@ -349,7 +349,7 @@ interface AnyEventWithPreventDefault { preventDefault: () => void; } export function preventDefault( - cb: (event?: T) => void + cb: (event?: T) => void, ) { return (event: T) => { event.preventDefault(); @@ -375,7 +375,7 @@ export function splitDateTime(dateTime: string) { if (!dateTime) { return { date: "", - time: "" + time: "", }; } // Default html input format YYYY-MM-DD HH:mm @@ -384,7 +384,7 @@ export function splitDateTime(dateTime: string) { .split(" "); return { date: splitDateTime[0], - time: splitDateTime[1] + time: splitDateTime[1], }; } @@ -412,7 +412,7 @@ export function findInEnum(needle: string, haystack: TEnum) { export function findValueInEnum( needle: string, - haystack: TEnum + haystack: TEnum, ): TEnum[keyof TEnum] { const match = Object.entries(haystack).find(([_, value]) => value === needle); @@ -435,17 +435,17 @@ export function capitalize(s: string) { } export function transformFormToAddressInput( - address: T & AddressTypeInput + address: T & AddressTypeInput, ): T & AddressInput { return { ...address, - country: findInEnum(address.country, CountryCode) + country: findInEnum(address.country, CountryCode), }; } export function getStringOrPlaceholder( s: string | undefined, - placeholder?: string + placeholder?: string, ): string { return s || placeholder || "..."; } @@ -461,7 +461,7 @@ export const getDatePeriod = (days: number): DateRangeInput => { return { gte: start.format(format), - lte: end.format(format) + lte: end.format(format), }; }; @@ -478,11 +478,11 @@ export const transformAddressToAddressInput = (data?: AddressType) => ({ phone: data?.phone || "", postalCode: data?.postalCode || "", streetAddress1: data?.streetAddress1 || "", - streetAddress2: data?.streetAddress2 || "" + streetAddress2: data?.streetAddress2 || "", }); export function getFullName( - data: T + data: T, ) { if (!data || !data.firstName || !data.lastName) { return ""; @@ -523,7 +523,7 @@ export function PromiseQueue() { export const combinedMultiAutocompleteChoices = ( selected: MultiAutocompleteChoiceType[], - choices: MultiAutocompleteChoiceType[] + choices: MultiAutocompleteChoiceType[], ) => uniqBy([...selected, ...choices], "value"); export const isInDevelopment = diff --git a/src/navigation/components/MenuCreateDialog/MenuCreateDialog.tsx b/src/navigation/components/MenuCreateDialog/MenuCreateDialog.tsx index 13f8d89c3..52a13f0cc 100644 --- a/src/navigation/components/MenuCreateDialog/MenuCreateDialog.tsx +++ b/src/navigation/components/MenuCreateDialog/MenuCreateDialog.tsx @@ -3,7 +3,7 @@ import { DialogActions, DialogContent, DialogTitle, - TextField + TextField, } from "@material-ui/core"; import BackButton from "@saleor/components/BackButton"; import ConfirmButton from "@saleor/components/ConfirmButton"; @@ -30,7 +30,7 @@ export interface MenuCreateDialogProps { } const initialForm: MenuCreateDialogFormData = { - name: "" + name: "", }; const MenuCreateDialog: React.FC = ({ @@ -39,7 +39,7 @@ const MenuCreateDialog: React.FC = ({ errors, onClose, onConfirm, - open + open, }) => { const intl = useIntl(); @@ -65,7 +65,7 @@ const MenuCreateDialog: React.FC = ({ helperText={getMenuErrorMessage(formErrors.name, intl)} label={intl.formatMessage({ id: "jhh/D6", - defaultMessage: "Menu Title" + defaultMessage: "Menu Title", })} name={"name" as keyof MenuCreateDialogFormData} value={data.name} diff --git a/src/navigation/components/MenuDetailsPage/MenuDetailsPage.tsx b/src/navigation/components/MenuDetailsPage/MenuDetailsPage.tsx index b2cd6522f..539593c9b 100644 --- a/src/navigation/components/MenuDetailsPage/MenuDetailsPage.tsx +++ b/src/navigation/components/MenuDetailsPage/MenuDetailsPage.tsx @@ -48,17 +48,17 @@ const MenuDetailsPage: React.FC = ({ onItemAdd, onItemClick, onItemEdit, - onSubmit + onSubmit, }) => { const intl = useIntl(); const navigate = useNavigator(); const initialForm: MenuDetailsFormData = { - name: menu?.name ?? "" + name: menu?.name ?? "", }; const [treeOperations, setTreeOperations] = React.useState( - [] + [], ); const removeSimulatedMoves = (operations: TreeOperation[]) => @@ -67,7 +67,7 @@ const MenuDetailsPage: React.FC = ({ const handleSubmit = async (data: MenuDetailsFormData) => { const result = await onSubmit({ name: data.name, - operations: removeSimulatedMoves(treeOperations) + operations: removeSimulatedMoves(treeOperations), }); if (result) { diff --git a/src/navigation/components/MenuDetailsPage/tree.test.ts b/src/navigation/components/MenuDetailsPage/tree.test.ts index 2f55907e0..997e05bb3 100644 --- a/src/navigation/components/MenuDetailsPage/tree.test.ts +++ b/src/navigation/components/MenuDetailsPage/tree.test.ts @@ -12,7 +12,7 @@ const relativeOutput: Array = [ category: { __typename: "Category", id: "Q2F0ZWdvcnk6Nw==", - name: "Accessories" + name: "Accessories", }, children: [ { @@ -20,7 +20,7 @@ const relativeOutput: Array = [ category: { __typename: "Category", id: "Q2F0ZWdvcnk6OAX==", - name: "Jewelry" + name: "Jewelry", }, children: [], collection: null, @@ -28,14 +28,14 @@ const relativeOutput: Array = [ level: 0, name: "Jewelry", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OQX==", - name: "Glasses" + name: "Glasses", }, children: [], collection: null, @@ -43,22 +43,22 @@ const relativeOutput: Array = [ level: 0, name: "Glasses", page: null, - url: null - } + url: null, + }, ], collection: null, id: "2accessories", level: 0, name: "Accessories", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OA==", - name: "Groceries" + name: "Groceries", }, children: [], collection: null, @@ -66,14 +66,14 @@ const relativeOutput: Array = [ level: 0, name: "Groceries", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OQ==", - name: "Apparel" + name: "Apparel", }, children: [], collection: null, @@ -81,8 +81,8 @@ const relativeOutput: Array = [ level: 0, name: "Apparel", page: null, - url: null - } + url: null, + }, ], // moves one in root [ @@ -91,7 +91,7 @@ const relativeOutput: Array = [ category: { __typename: "Category", id: "Q2F0ZWdvcnk6Nw==", - name: "Accessories" + name: "Accessories", }, children: [ { @@ -99,7 +99,7 @@ const relativeOutput: Array = [ category: { __typename: "Category", id: "Q2F0ZWdvcnk6OAX==", - name: "Jewelry" + name: "Jewelry", }, children: [], collection: null, @@ -107,14 +107,14 @@ const relativeOutput: Array = [ level: 0, name: "Jewelry", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OQX==", - name: "Glasses" + name: "Glasses", }, children: [], collection: null, @@ -122,22 +122,22 @@ const relativeOutput: Array = [ level: 0, name: "Glasses", page: null, - url: null - } + url: null, + }, ], collection: null, id: "2accessories", level: 0, name: "Accessories", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OQ==", - name: "Apparel" + name: "Apparel", }, children: [], collection: null, @@ -145,14 +145,14 @@ const relativeOutput: Array = [ level: 0, name: "Apparel", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OA==", - name: "Groceries" + name: "Groceries", }, children: [], collection: null, @@ -160,8 +160,8 @@ const relativeOutput: Array = [ level: 0, name: "Groceries", page: null, - url: null - } + url: null, + }, ], // moves two in root [ @@ -170,7 +170,7 @@ const relativeOutput: Array = [ category: { __typename: "Category", id: "Q2F0ZWdvcnk6OQ==", - name: "Apparel" + name: "Apparel", }, children: [], collection: null, @@ -178,14 +178,14 @@ const relativeOutput: Array = [ level: 0, name: "Apparel", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OA==", - name: "Groceries" + name: "Groceries", }, children: [], collection: null, @@ -193,14 +193,14 @@ const relativeOutput: Array = [ level: 0, name: "Groceries", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6Nw==", - name: "Accessories" + name: "Accessories", }, children: [ { @@ -208,7 +208,7 @@ const relativeOutput: Array = [ category: { __typename: "Category", id: "Q2F0ZWdvcnk6OAX==", - name: "Jewelry" + name: "Jewelry", }, children: [], collection: null, @@ -216,14 +216,14 @@ const relativeOutput: Array = [ level: 0, name: "Jewelry", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OQX==", - name: "Glasses" + name: "Glasses", }, children: [], collection: null, @@ -231,16 +231,16 @@ const relativeOutput: Array = [ level: 0, name: "Glasses", page: null, - url: null - } + url: null, + }, ], collection: null, id: "2accessories", level: 0, name: "Accessories", page: null, - url: null - } + url: null, + }, ], // empty move [ @@ -249,7 +249,7 @@ const relativeOutput: Array = [ category: { __typename: "Category", id: "Q2F0ZWdvcnk6Nw==", - name: "Accessories" + name: "Accessories", }, children: [ { @@ -257,7 +257,7 @@ const relativeOutput: Array = [ category: { __typename: "Category", id: "Q2F0ZWdvcnk6OAX==", - name: "Jewelry" + name: "Jewelry", }, children: [], collection: null, @@ -265,14 +265,14 @@ const relativeOutput: Array = [ level: 0, name: "Jewelry", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OQX==", - name: "Glasses" + name: "Glasses", }, children: [], collection: null, @@ -280,22 +280,22 @@ const relativeOutput: Array = [ level: 0, name: "Glasses", page: null, - url: null - } + url: null, + }, ], collection: null, id: "2accessories", level: 0, name: "Accessories", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OA==", - name: "Groceries" + name: "Groceries", }, children: [], collection: null, @@ -303,14 +303,14 @@ const relativeOutput: Array = [ level: 0, name: "Groceries", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OQ==", - name: "Apparel" + name: "Apparel", }, children: [], collection: null, @@ -318,8 +318,8 @@ const relativeOutput: Array = [ level: 0, name: "Apparel", page: null, - url: null - } + url: null, + }, ], // moves every [ @@ -328,7 +328,7 @@ const relativeOutput: Array = [ category: { __typename: "Category", id: "Q2F0ZWdvcnk6OA==", - name: "Groceries" + name: "Groceries", }, children: [], collection: null, @@ -336,14 +336,14 @@ const relativeOutput: Array = [ level: 0, name: "Groceries", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OQ==", - name: "Apparel" + name: "Apparel", }, children: [], collection: null, @@ -351,7 +351,7 @@ const relativeOutput: Array = [ level: 0, name: "Apparel", page: null, - url: null + url: null, }, { @@ -359,7 +359,7 @@ const relativeOutput: Array = [ category: { __typename: "Category", id: "Q2F0ZWdvcnk6Nw==", - name: "Accessories" + name: "Accessories", }, children: [ { @@ -367,7 +367,7 @@ const relativeOutput: Array = [ category: { __typename: "Category", id: "Q2F0ZWdvcnk6OAX==", - name: "Jewelry" + name: "Jewelry", }, children: [], collection: null, @@ -375,14 +375,14 @@ const relativeOutput: Array = [ level: 0, name: "Jewelry", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OQX==", - name: "Glasses" + name: "Glasses", }, children: [], collection: null, @@ -390,16 +390,16 @@ const relativeOutput: Array = [ level: 0, name: "Glasses", page: null, - url: null - } + url: null, + }, ], collection: null, id: "2accessories", level: 0, name: "Accessories", page: null, - url: null - } + url: null, + }, ], // moves children [ @@ -408,7 +408,7 @@ const relativeOutput: Array = [ category: { __typename: "Category", id: "Q2F0ZWdvcnk6Nw==", - name: "Accessories" + name: "Accessories", }, children: [ { @@ -416,7 +416,7 @@ const relativeOutput: Array = [ category: { __typename: "Category", id: "Q2F0ZWdvcnk6OQX==", - name: "Glasses" + name: "Glasses", }, children: [], collection: null, @@ -424,14 +424,14 @@ const relativeOutput: Array = [ level: 0, name: "Glasses", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OAX==", - name: "Jewelry" + name: "Jewelry", }, children: [], collection: null, @@ -439,22 +439,22 @@ const relativeOutput: Array = [ level: 0, name: "Jewelry", page: null, - url: null - } + url: null, + }, ], collection: null, id: "2accessories", level: 0, name: "Accessories", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OA==", - name: "Groceries" + name: "Groceries", }, children: [], collection: null, @@ -462,14 +462,14 @@ const relativeOutput: Array = [ level: 0, name: "Groceries", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OQ==", - name: "Apparel" + name: "Apparel", }, children: [], collection: null, @@ -477,8 +477,8 @@ const relativeOutput: Array = [ level: 0, name: "Apparel", page: null, - url: null - } + url: null, + }, ], // moves child outside [ @@ -487,7 +487,7 @@ const relativeOutput: Array = [ category: { __typename: "Category", id: "Q2F0ZWdvcnk6OQX==", - name: "Glasses" + name: "Glasses", }, children: [], collection: null, @@ -495,14 +495,14 @@ const relativeOutput: Array = [ level: 0, name: "Glasses", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6Nw==", - name: "Accessories" + name: "Accessories", }, children: [ { @@ -510,7 +510,7 @@ const relativeOutput: Array = [ category: { __typename: "Category", id: "Q2F0ZWdvcnk6OAX==", - name: "Jewelry" + name: "Jewelry", }, children: [], collection: null, @@ -518,22 +518,22 @@ const relativeOutput: Array = [ level: 0, name: "Jewelry", page: null, - url: null - } + url: null, + }, ], collection: null, id: "2accessories", level: 0, name: "Accessories", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OA==", - name: "Groceries" + name: "Groceries", }, children: [], collection: null, @@ -541,14 +541,14 @@ const relativeOutput: Array = [ level: 0, name: "Groceries", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OQ==", - name: "Apparel" + name: "Apparel", }, children: [], collection: null, @@ -556,8 +556,8 @@ const relativeOutput: Array = [ level: 0, name: "Apparel", page: null, - url: null - } + url: null, + }, ], // moves child outside and puts it in location [ @@ -566,7 +566,7 @@ const relativeOutput: Array = [ category: { __typename: "Category", id: "Q2F0ZWdvcnk6Nw==", - name: "Accessories" + name: "Accessories", }, children: [ { @@ -574,7 +574,7 @@ const relativeOutput: Array = [ category: { __typename: "Category", id: "Q2F0ZWdvcnk6OAX==", - name: "Jewelry" + name: "Jewelry", }, children: [], collection: null, @@ -582,22 +582,22 @@ const relativeOutput: Array = [ level: 0, name: "Jewelry", page: null, - url: null - } + url: null, + }, ], collection: null, id: "2accessories", level: 0, name: "Accessories", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OA==", - name: "Groceries" + name: "Groceries", }, children: [], collection: null, @@ -605,14 +605,14 @@ const relativeOutput: Array = [ level: 0, name: "Groceries", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OQX==", - name: "Glasses" + name: "Glasses", }, children: [], collection: null, @@ -620,14 +620,14 @@ const relativeOutput: Array = [ level: 0, name: "Glasses", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OQ==", - name: "Apparel" + name: "Apparel", }, children: [], collection: null, @@ -635,8 +635,8 @@ const relativeOutput: Array = [ level: 0, name: "Apparel", page: null, - url: null - } + url: null, + }, ], // moves child inside [ @@ -645,7 +645,7 @@ const relativeOutput: Array = [ category: { __typename: "Category", id: "Q2F0ZWdvcnk6Nw==", - name: "Accessories" + name: "Accessories", }, children: [ { @@ -653,7 +653,7 @@ const relativeOutput: Array = [ category: { __typename: "Category", id: "Q2F0ZWdvcnk6OA==", - name: "Groceries" + name: "Groceries", }, children: [], collection: null, @@ -661,14 +661,14 @@ const relativeOutput: Array = [ level: 0, name: "Groceries", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OAX==", - name: "Jewelry" + name: "Jewelry", }, children: [], collection: null, @@ -676,14 +676,14 @@ const relativeOutput: Array = [ level: 0, name: "Jewelry", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OQX==", - name: "Glasses" + name: "Glasses", }, children: [], collection: null, @@ -691,22 +691,22 @@ const relativeOutput: Array = [ level: 0, name: "Glasses", page: null, - url: null - } + url: null, + }, ], collection: null, id: "2accessories", level: 0, name: "Accessories", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OQ==", - name: "Apparel" + name: "Apparel", }, children: [], collection: null, @@ -714,8 +714,8 @@ const relativeOutput: Array = [ level: 0, name: "Apparel", page: null, - url: null - } + url: null, + }, ], // moves child inside then outside then changes index [ @@ -724,7 +724,7 @@ const relativeOutput: Array = [ category: { __typename: "Category", id: "Q2F0ZWdvcnk6Nw==", - name: "Accessories" + name: "Accessories", }, children: [ { @@ -732,7 +732,7 @@ const relativeOutput: Array = [ category: { __typename: "Category", id: "Q2F0ZWdvcnk6OA==", - name: "Groceries" + name: "Groceries", }, children: [], collection: null, @@ -740,14 +740,14 @@ const relativeOutput: Array = [ level: 0, name: "Groceries", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OAX==", - name: "Jewelry" + name: "Jewelry", }, children: [], collection: null, @@ -755,14 +755,14 @@ const relativeOutput: Array = [ level: 0, name: "Jewelry", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OQX==", - name: "Glasses" + name: "Glasses", }, children: [], collection: null, @@ -770,22 +770,22 @@ const relativeOutput: Array = [ level: 0, name: "Glasses", page: null, - url: null - } + url: null, + }, ], collection: null, id: "2accessories", level: 0, name: "Accessories", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OQ==", - name: "Apparel" + name: "Apparel", }, children: [], collection: null, @@ -793,8 +793,8 @@ const relativeOutput: Array = [ level: 0, name: "Apparel", page: null, - url: null - } + url: null, + }, ], // moves item as last child and moves it up [ @@ -803,7 +803,7 @@ const relativeOutput: Array = [ category: { __typename: "Category", id: "Q2F0ZWdvcnk6Nw==", - name: "Accessories" + name: "Accessories", }, children: [ { @@ -811,7 +811,7 @@ const relativeOutput: Array = [ category: { __typename: "Category", id: "Q2F0ZWdvcnk6OAX==", - name: "Jewelry" + name: "Jewelry", }, children: [], collection: null, @@ -819,14 +819,14 @@ const relativeOutput: Array = [ level: 0, name: "Jewelry", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OA==", - name: "Groceries" + name: "Groceries", }, children: [], collection: null, @@ -834,14 +834,14 @@ const relativeOutput: Array = [ level: 0, name: "Groceries", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OQX==", - name: "Glasses" + name: "Glasses", }, children: [], collection: null, @@ -849,22 +849,22 @@ const relativeOutput: Array = [ level: 0, name: "Glasses", page: null, - url: null - } + url: null, + }, ], collection: null, id: "2accessories", level: 0, name: "Accessories", page: null, - url: null + url: null, }, { __typename: "MenuItem", category: { __typename: "Category", id: "Q2F0ZWdvcnk6OQ==", - name: "Apparel" + name: "Apparel", }, children: [], collection: null, @@ -872,9 +872,9 @@ const relativeOutput: Array = [ level: 0, name: "Apparel", page: null, - url: null - } - ] + url: null, + }, + ], ]; const secondTestTable: TreeOperation[][] = [ @@ -885,18 +885,18 @@ const secondTestTable: TreeOperation[][] = [ // moves two in root [ { id: "2accessories", sortOrder: 2, type: "move" }, - { id: "4apparel", sortOrder: -1, type: "move" } + { id: "4apparel", sortOrder: -1, type: "move" }, ], // empty move [ { id: "2accessories", sortOrder: 0, type: "move" }, - { id: "4apparel", sortOrder: 0, type: "move" } + { id: "4apparel", sortOrder: 0, type: "move" }, ], // move every [ { id: "2accessories", sortOrder: 1, type: "move" }, { id: "4apparel", sortOrder: -2, type: "move" }, - { id: "3groceries", sortOrder: -1, type: "move" } + { id: "3groceries", sortOrder: -1, type: "move" }, ], // moves children [ @@ -904,8 +904,8 @@ const secondTestTable: TreeOperation[][] = [ id: "1glasses", sortOrder: -1, type: "move", - parentId: "2accessories" - } + parentId: "2accessories", + }, ], // moves children outside [ @@ -913,13 +913,13 @@ const secondTestTable: TreeOperation[][] = [ id: "1glasses", sortOrder: 3, type: "move", - simulatedMove: true + simulatedMove: true, }, { id: "1glasses", sortOrder: 0 - 3, - type: "move" - } + type: "move", + }, ], // moves children outside and puts it in a location [ @@ -927,13 +927,13 @@ const secondTestTable: TreeOperation[][] = [ id: "1glasses", sortOrder: 3, type: "move", - simulatedMove: true + simulatedMove: true, }, { id: "1glasses", sortOrder: 2 - 3, - type: "move" - } + type: "move", + }, ], // moves child inside [ @@ -942,14 +942,14 @@ const secondTestTable: TreeOperation[][] = [ parentId: "2accessories", sortOrder: 2, type: "move", - simulatedMove: true + simulatedMove: true, }, { id: "3groceries", parentId: "2accessories", sortOrder: 0 - 2, - type: "move" - } + type: "move", + }, ], // moves child inside, moves it and puts it back [ @@ -957,29 +957,29 @@ const secondTestTable: TreeOperation[][] = [ id: "3groceries", parentId: "2accessories", sortOrder: 0, - type: "move" + type: "move", }, { id: "3groceries", sortOrder: 1, - type: "move" + type: "move", }, { id: "3groceries", sortOrder: 1, - type: "move" + type: "move", }, { id: "3groceries", sortOrder: -2, - type: "move" + type: "move", }, { id: "3groceries", parentId: "2accessories", sortOrder: 0, - type: "move" - } + type: "move", + }, ], // moves item as last child and moves it up [ @@ -987,15 +987,15 @@ const secondTestTable: TreeOperation[][] = [ id: "3groceries", parentId: "2accessories", sortOrder: 2, - type: "move" + type: "move", }, { id: "1glasses", parentId: "2accessories", sortOrder: 1, - type: "move" - } - ] + type: "move", + }, + ], ]; const testTable: TreeOperation[][] = [ @@ -1006,8 +1006,8 @@ const testTable: TreeOperation[][] = [ id: "2accessories", parentId: "3groceries", sortOrder: 0, - type: "move" - } + type: "move", + }, ], [ { id: "1glasses", parentId: "0jewelry", sortOrder: 0, type: "move" }, @@ -1015,14 +1015,14 @@ const testTable: TreeOperation[][] = [ id: "2accessories", parentId: "3groceries", sortOrder: 0, - type: "move" + type: "move", }, { id: "3groceries", parentId: "4apparel", sortOrder: 0, - type: "move" - } + type: "move", + }, ], [ { id: "0jewelry", sortOrder: 1, type: "move" }, @@ -1031,23 +1031,23 @@ const testTable: TreeOperation[][] = [ id: "4apparel", parentId: "3groceries", sortOrder: 0, - type: "move" + type: "move", }, { id: "3groceries", parentId: "0jewelry", sortOrder: 0, - type: "move" + type: "move", }, { id: "0jewelry", parentId: "1glasses", sortOrder: 0, type: "move" }, { id: "1glasses", parentId: "2accessories", sortOrder: 0, - type: "move" + type: "move", }, { id: "1glasses", sortOrder: 1, type: "move" }, - { id: "0jewelry", sortOrder: 2, type: "move" } + { id: "0jewelry", sortOrder: 2, type: "move" }, ], [ { id: "1glasses", sortOrder: 1, type: "move" }, @@ -1057,14 +1057,14 @@ const testTable: TreeOperation[][] = [ id: "0jewelry", parentId: "2accessories", sortOrder: 0, - type: "move" + type: "move", }, { id: "3groceries", sortOrder: 0, type: "move" }, { id: "2accessories", parentId: "3groceries", sortOrder: 0, - type: "move" + type: "move", }, { id: "2accessories", sortOrder: 1, type: "move" }, { id: "0jewelry", sortOrder: 2, type: "move" }, @@ -1076,62 +1076,62 @@ const testTable: TreeOperation[][] = [ id: "4apparel", parentId: "2accessories", sortOrder: 0, - type: "move" + type: "move", }, { id: "3groceries", parentId: "1glasses", sortOrder: 0, - type: "move" + type: "move", }, { id: "0jewelry", sortOrder: 0, type: "move" }, { id: "0jewelry", parentId: "2accessories", sortOrder: 0, - type: "move" + type: "move", }, { id: "4apparel", parentId: "2accessories", sortOrder: 0, - type: "move" + type: "move", }, { id: "0jewelry", parentId: "2accessories", sortOrder: 0, - type: "move" + type: "move", }, { id: "1glasses", parentId: "2accessories", sortOrder: 2, - type: "move" + type: "move", }, { id: "0jewelry", parentId: "2accessories", sortOrder: 2, - type: "move" + type: "move", }, { id: "1glasses", parentId: "2accessories", sortOrder: 2, - type: "move" + type: "move", }, { id: "4apparel", parentId: "2accessories", sortOrder: 2, - type: "move" + type: "move", }, { id: "3groceries", parentId: "0jewelry", sortOrder: 0, - type: "move" + type: "move", }, { id: "4apparel", parentId: "1glasses", sortOrder: 0, type: "move" }, { id: "1glasses", sortOrder: 1, type: "move" }, @@ -1140,21 +1140,21 @@ const testTable: TreeOperation[][] = [ id: "2accessories", parentId: "4apparel", sortOrder: 0, - type: "move" - } + type: "move", + }, ], [{ id: "2accessories", type: "remove" }], [ { id: "2accessories", type: "remove" }, { id: "4apparel", sortOrder: 0, type: "move" }, - { id: "3groceries", type: "remove" } - ] + { id: "3groceries", type: "remove" }, + ], ]; // Readability FTW function innerTreeToString( tree: MenuDetailsFragment["items"][0], - level: number + level: number, ): string { return ( "\n" + @@ -1162,7 +1162,7 @@ function innerTreeToString( tree.name + tree.children.reduce( (acc, node) => acc + innerTreeToString(node, level + 1), - "" + "", ) ); } @@ -1175,7 +1175,7 @@ describe("Properly computes trees", () => { it("#", () => { const computedTree = computeRelativeTree(menu.items, testData); expect(treeToString(computedTree)).toMatchSnapshot(); - }) + }), ); }); diff --git a/src/navigation/components/MenuDetailsPage/tree.ts b/src/navigation/components/MenuDetailsPage/tree.ts index 51815b759..2bfca78d6 100644 --- a/src/navigation/components/MenuDetailsPage/tree.ts +++ b/src/navigation/components/MenuDetailsPage/tree.ts @@ -4,7 +4,7 @@ import { TreeOperation } from "../MenuItems"; export function findNode( tree: MenuDetailsFragment["items"], - id: string + id: string, ): number[] { const foundNodeIndex = tree.findIndex(node => node.id === id); if (tree.length === 0) { @@ -15,14 +15,14 @@ export function findNode( } const nodeMap = tree.map((node, nodeIndex) => [ nodeIndex, - ...findNode(node.children, id) + ...findNode(node.children, id), ]); return nodeMap.find(path => path[path.length - 1] !== null) || [null]; } export function getNode( tree: MenuDetailsFragment["items"], - path: number[] + path: number[], ): MenuDetailsFragment["items"][0] { if (path.length === 1) { return tree[path[0]]; @@ -32,7 +32,7 @@ export function getNode( function removeNode( tree: MenuDetailsFragment["items"], - path: number[] + path: number[], ): MenuDetailsFragment["items"] { const removeIndex = path[0]; @@ -43,7 +43,7 @@ function removeNode( const newTree = [...tree]; newTree[removeIndex] = { ...tree[path[0]], - children: removeNode(tree[path[0]].children, path.slice(1)) + children: removeNode(tree[path[0]].children, path.slice(1)), }; return newTree; @@ -60,7 +60,7 @@ function insertNode({ tree, path, node, - position + position, }: InsertNodeInput): MenuDetailsFragment["items"] { if (path.length === 0) { return [...tree.slice(0, position), node, ...tree.slice(position)]; @@ -71,7 +71,7 @@ function insertNode({ tree: tree[path[0]].children, path: path.slice(1), node, - position + position, }); } return tree; @@ -79,7 +79,7 @@ function insertNode({ function removeNodeAndChildren( tree: MenuDetailsFragment["items"], - operation: TreeOperation + operation: TreeOperation, ): MenuDetailsFragment["items"] { const sourcePath = findNode(tree, operation.id); const node = getNode(tree, sourcePath); @@ -89,9 +89,9 @@ function removeNodeAndChildren( (acc, child) => removeNodeAndChildren(acc, { id: child.id, - type: "remove" + type: "remove", }), - tree + tree, ); return removeNode(treeAfterChildrenRemoval, sourcePath); @@ -102,7 +102,7 @@ function removeNodeAndChildren( function permuteRelativeNode( tree: MenuDetailsFragment["items"], - permutation: TreeOperation + permutation: TreeOperation, ): MenuDetailsFragment["items"] { const sourcePath = findNode(tree, permutation.id); const node = getNode(tree, sourcePath); @@ -121,7 +121,7 @@ function permuteRelativeNode( tree: treeAfterRemoval, path: targetPath, node, - position: position + permutation.sortOrder + position: position + permutation.sortOrder, }); return treeAfterInsertion; @@ -129,7 +129,7 @@ function permuteRelativeNode( function executeRelativeOperation( tree: MenuDetailsFragment["items"], - operation: TreeOperation + operation: TreeOperation, ): MenuDetailsFragment["items"] { return operation.type === "move" ? permuteRelativeNode(tree, operation) @@ -138,11 +138,11 @@ function executeRelativeOperation( export function computeRelativeTree( tree: MenuDetailsFragment["items"], - operations: TreeOperation[] + operations: TreeOperation[], ) { const newTree = operations.reduce( (acc, operation) => executeRelativeOperation(acc, operation), - JSON.parse(JSON.stringify(tree)) + JSON.parse(JSON.stringify(tree)), ); return newTree; } diff --git a/src/navigation/components/MenuItemDialog/MenuItemDialog.tsx b/src/navigation/components/MenuItemDialog/MenuItemDialog.tsx index 5950dd1f5..6b0d86be9 100644 --- a/src/navigation/components/MenuItemDialog/MenuItemDialog.tsx +++ b/src/navigation/components/MenuItemDialog/MenuItemDialog.tsx @@ -4,7 +4,7 @@ import { DialogContent, DialogTitle, TextField, - Typography + Typography, } from "@material-ui/core"; import AutocompleteSelectMenu from "@saleor/components/AutocompleteSelectMenu"; import BackButton from "@saleor/components/BackButton"; @@ -14,7 +14,7 @@ import { MenuErrorFragment, SearchCategoriesQuery, SearchCollectionsQuery, - SearchPagesQuery + SearchPagesQuery, } from "@saleor/graphql"; import useModalDialogErrors from "@saleor/hooks/useModalDialogErrors"; import useModalDialogOpen from "@saleor/hooks/useModalDialogOpen"; @@ -58,14 +58,14 @@ export interface MenuItemDialogProps { const defaultInitial: MenuItemDialogFormData = { id: "", name: "", - type: "category" + type: "category", }; function getMenuItemData(value: string): MenuItemData { const [type, ...idParts] = value.split(":"); return { id: idParts.join(":"), - type: type as MenuItemType + type: type as MenuItemType, }; } @@ -90,15 +90,15 @@ const MenuItemDialog: React.FC = ({ open, categories, collections, - pages + pages, }) => { const intl = useIntl(); const errors = useModalDialogErrors(apiErrors, open); const [displayValue, setDisplayValue] = React.useState( - initialDisplayValue || "" + initialDisplayValue || "", ); const [data, setData] = useStateFromProps( - initial || defaultInitial + initial || defaultInitial, ); const [url, setUrl] = React.useState(undefined); @@ -108,12 +108,12 @@ const MenuItemDialog: React.FC = ({ setData(initial || defaultInitial); setDisplayValue(initialDisplayValue); setUrl(undefined); - } + }, }); // Refresh initial display value if changed React.useEffect(() => setDisplayValue(initialDisplayValue), [ - initialDisplayValue + initialDisplayValue, ]); const mutationErrors = errors.filter(err => err.field === null); @@ -133,11 +133,11 @@ const MenuItemDialog: React.FC = ({ children: [], data: {}, label: category.name, - value: "category:" + category.id + value: "category:" + category.id, })), data: {}, - label: intl.formatMessage(sectionNames.categories) - } + label: intl.formatMessage(sectionNames.categories), + }, ]; } @@ -149,11 +149,11 @@ const MenuItemDialog: React.FC = ({ children: [], data: {}, label: collection.name, - value: "collection:" + collection.id + value: "collection:" + collection.id, })), data: {}, - label: intl.formatMessage(sectionNames.collections) - } + label: intl.formatMessage(sectionNames.collections), + }, ]; } @@ -165,11 +165,11 @@ const MenuItemDialog: React.FC = ({ children: [], data: {}, label: page.title, - value: "page:" + page.id + value: "page:" + page.id, })), data: {}, - label: intl.formatMessage(sectionNames.pages) - } + label: intl.formatMessage(sectionNames.pages), + }, ]; } @@ -184,12 +184,12 @@ const MenuItemDialog: React.FC = ({ defaultMessage="Link to: {url}" description="add link to navigation" values={{ - url: {url} + url: {url}, }} /> ), - value: "link:" + url - } + value: "link:" + url, + }, ]; } @@ -210,7 +210,7 @@ const MenuItemDialog: React.FC = ({ setData(value => ({ ...value, - ...menuItemData + ...menuItemData, })); setDisplayValue(getDisplayValue(options, value)); }; @@ -224,7 +224,7 @@ const MenuItemDialog: React.FC = ({ maxWidth="sm" fullWidth PaperProps={{ - style: { overflowY: "visible" } + style: { overflowY: "visible" }, }} > @@ -232,12 +232,12 @@ const MenuItemDialog: React.FC = ({ ? intl.formatMessage({ id: "KKQUMK", defaultMessage: "Edit Item", - description: "edit menu item, header" + description: "edit menu item, header", }) : intl.formatMessage({ id: "H3Uirw", defaultMessage: "Add Item", - description: "create new menu item, header" + description: "create new menu item, header", })} @@ -246,14 +246,14 @@ const MenuItemDialog: React.FC = ({ label={intl.formatMessage({ id: "0Vyr8h", defaultMessage: "Name", - description: "menu item name" + description: "menu item name", })} fullWidth value={data.name} onChange={event => setData(value => ({ ...value, - name: event.target.value + name: event.target.value, })) } name="name" @@ -268,7 +268,7 @@ const MenuItemDialog: React.FC = ({ label={intl.formatMessage({ id: "Urh2N3", defaultMessage: "Link", - description: "label" + description: "label", })} displayValue={displayValue} loading={loading} @@ -278,7 +278,7 @@ const MenuItemDialog: React.FC = ({ helperText={getMenuErrorMessage(idError, intl)} placeholder={intl.formatMessage({ id: "28GZnc", - defaultMessage: "Start typing to begin search..." + defaultMessage: "Start typing to begin search...", })} onInputChange={handleQueryChange} /> diff --git a/src/navigation/components/MenuItems/MenuItems.tsx b/src/navigation/components/MenuItems/MenuItems.tsx index 744ec619a..d7daf85a1 100644 --- a/src/navigation/components/MenuItems/MenuItems.tsx +++ b/src/navigation/components/MenuItems/MenuItems.tsx @@ -9,7 +9,7 @@ import { DeleteIcon, IconButton, makeStyles, - useTheme + useTheme, } from "@saleor/macaw-ui"; import classNames from "classnames"; import React from "react"; @@ -37,37 +37,37 @@ const useStyles = makeStyles( theme => ({ actions: { "&&": { - padding: theme.spacing(2, 4) + padding: theme.spacing(2, 4), }, - flexDirection: "row" + flexDirection: "row", }, container: { - background: theme.palette.grey[200] + background: theme.palette.grey[200], }, darkContainer: { - background: `${theme.palette.grey[800]} !important` + background: `${theme.palette.grey[800]} !important`, }, deleteButton: { - marginRight: theme.spacing(1) + marginRight: theme.spacing(1), }, dragIcon: { - cursor: "grab" + cursor: "grab", }, nodeTitle: { cursor: "pointer", - marginLeft: theme.spacing(7) + marginLeft: theme.spacing(7), }, root: { "& .rst__collapseButton": { - display: "none" + display: "none", }, "& .rst__node": { "&:first-of-type": { "& $row": { - borderTop: `1px ${theme.palette.divider} solid` - } - } - } + borderTop: `1px ${theme.palette.divider} solid`, + }, + }, + }, }, row: { alignItems: "center", @@ -78,14 +78,14 @@ const useStyles = makeStyles( flexDirection: "row", height: NODE_HEIGHT, justifyContent: "flex-start", - paddingLeft: theme.spacing(3) + paddingLeft: theme.spacing(3), }, rowContainer: { "& > *": { opacity: 1, - transition: `opacity ${theme.transitions.duration.standard}ms` + transition: `opacity ${theme.transitions.duration.standard}ms`, }, - transition: `margin ${theme.transitions.duration.standard}ms` + transition: `margin ${theme.transitions.duration.standard}ms`, }, rowContainerDragged: { "&$rowContainer": { @@ -98,22 +98,22 @@ const useStyles = makeStyles( left: 0, position: "absolute", top: -3, - width: 7 + width: 7, }, borderTop: `1px solid ${theme.palette.primary.main}`, height: 0, position: "relative", - top: -1 - } + top: -1, + }, }, rowContainerPlaceholder: { - opacity: 0 + opacity: 0, }, spacer: { - flex: 1 - } + flex: 1, + }, }), - { name: "MenuItems" } + { name: "MenuItems" }, ); const Placeholder: React.FC = props => { @@ -137,18 +137,18 @@ const Node: React.FC = props => { path, connectDragPreview, connectDragSource, - isDragging + isDragging, } = props; const classes = useStyles(props); const draggedClassName = classNames( classes.rowContainer, - classes.rowContainerDragged + classes.rowContainerDragged, ); const defaultClassName = isDragging ? draggedClassName : classes.rowContainer; const placeholderClassName = classNames( classes.rowContainer, - classes.rowContainerPlaceholder + classes.rowContainerPlaceholder, ); const [className, setClassName] = React.useState(defaultClassName); @@ -163,14 +163,14 @@ const Node: React.FC = props => {
{connectDragSource(
-
+
, )} {node.title} @@ -189,15 +189,15 @@ const Node: React.FC = props => { node.onChange([ { id: node.id, - type: "remove" - } + type: "remove", + }, ]) } > -
+
, ); }; @@ -210,7 +210,7 @@ const MenuItems: React.FC = props => { onItemAdd, onItemClick, onItemEdit, - onUndo + onUndo, } = props; const classes = useStyles(props); @@ -223,7 +223,7 @@ const MenuItems: React.FC = props => { title={intl.formatMessage({ id: "dEUZg2", defaultMessage: "Menu Items", - description: "header" + description: "header", })} toolbar={ @@ -343,7 +343,7 @@ const OrderRefundAmount: React.FC = props => { {intl.formatMessage( isReturn ? messages.returnCannotBeFulfilled - : messages.refundCannotBeFulfilled + : messages.refundCannotBeFulfilled, )} diff --git a/src/orders/components/OrderRefundReturnAmount/OrderRefundReturnAmountValues.tsx b/src/orders/components/OrderRefundReturnAmount/OrderRefundReturnAmountValues.tsx index 254656d03..108309521 100644 --- a/src/orders/components/OrderRefundReturnAmount/OrderRefundReturnAmountValues.tsx +++ b/src/orders/components/OrderRefundReturnAmount/OrderRefundReturnAmountValues.tsx @@ -11,20 +11,20 @@ const useStyles = makeStyles( container: { ...theme.typography.body1, lineHeight: 1.9, - width: "100%" + width: "100%", }, highlightedRow: { - fontWeight: 600 + fontWeight: 600, }, row: { display: "flex", flexDirection: "row", justifyContent: "space-between", marginBottom: theme.spacing(2), - textAlign: "right" - } + textAlign: "right", + }, }), - { name: "OrderRefundAmountValues" } + { name: "OrderRefundAmountValues" }, ); export interface OrderRefundAmountValuesProps { @@ -42,43 +42,43 @@ const messages = defineMessages({ authorizedAmount: { id: "L/O4LQ", defaultMessage: "Authorized Amount", - description: "order refund amount" + description: "order refund amount", }, maxRefund: { id: "I7HyJZ", defaultMessage: "Max Refund", - description: "order refund amount" + description: "order refund amount", }, previouslyRefunded: { id: "Q55cTG", defaultMessage: "Previously refunded", - description: "order refund amount" + description: "order refund amount", }, proposedRefundAmount: { id: "wDUBLR", defaultMessage: "Proposed refund amount", - description: "order refund amount" + description: "order refund amount", }, refundTotalAmount: { id: "C6bb6x", defaultMessage: "Refund total amount", - description: "order refund amount" + description: "order refund amount", }, replacedProductsValue: { id: "i56GGQ", defaultMessage: "Replaced Products Value", - description: "order refund amount" + description: "order refund amount", }, selectedProductsValue: { id: "kak5vT", defaultMessage: "Selected Products Value", - description: "order refund amount" + description: "order refund amount", }, shipmentCost: { id: "WGp+Fw", defaultMessage: "Shipment Cost", - description: "order refund amount" - } + description: "order refund amount", + }, }); const OrderRefundAmountValues: React.FC = props => { @@ -92,12 +92,12 @@ const OrderRefundAmountValues: React.FC = props => "previouslyRefunded", "replacedProductsValue", "maxRefund", - "refundTotalAmount" + "refundTotalAmount", ]; const highlightedItems: Array = [ "maxRefund", - "refundTotalAmount" + "refundTotalAmount", ]; const items = reduce( @@ -111,10 +111,10 @@ const OrderRefundAmountValues: React.FC = props => return [ ...result, - { data: value, highlighted: highlightedItems.includes(key), key } + { data: value, highlighted: highlightedItems.includes(key), key }, ]; }, - [] + [], ); return ( @@ -122,7 +122,7 @@ const OrderRefundAmountValues: React.FC = props => {items.map(({ key, data, highlighted }) => (
diff --git a/src/orders/components/OrderRefundReturnAmount/RefundAmountInput.tsx b/src/orders/components/OrderRefundReturnAmount/RefundAmountInput.tsx index 891779977..d3e1543ea 100644 --- a/src/orders/components/OrderRefundReturnAmount/RefundAmountInput.tsx +++ b/src/orders/components/OrderRefundReturnAmount/RefundAmountInput.tsx @@ -12,30 +12,30 @@ import { OrderRefundFormData } from "../OrderRefundPage/form"; const useStyles = makeStyles( theme => ({ hr: { - margin: theme.spacing(1, 0) + margin: theme.spacing(1, 0), }, maxRefundRow: { - fontWeight: 600 + fontWeight: 600, }, priceField: { - marginTop: theme.spacing(2) + marginTop: theme.spacing(2), }, refundButton: { - marginTop: theme.spacing(2) + marginTop: theme.spacing(2), }, refundCaution: { - marginTop: theme.spacing(1) + marginTop: theme.spacing(1), }, root: { ...theme.typography.body1, lineHeight: 1.9, - width: "100%" + width: "100%", }, textRight: { - textAlign: "right" - } + textAlign: "right", + }, }), - { name: "OrderRefundAmount" } + { name: "OrderRefundAmount" }, ); interface RefundAmountInputProps { @@ -53,18 +53,18 @@ const messages = defineMessages({ amountTooBig: { id: "fbH51z", defaultMessage: "Amount cannot be bigger than max refund", - description: "Amount error message" + description: "Amount error message", }, amountTooSmall: { id: "IKvOK+", defaultMessage: "Amount must be bigger than 0", - description: "Amount error message" + description: "Amount error message", }, label: { id: "lrq8O6", defaultMessage: "Amount", - description: "order refund amount, input label" - } + description: "order refund amount, input label", + }, }); const RefundAmountInput: React.FC = props => { @@ -76,7 +76,7 @@ const RefundAmountInput: React.FC = props => { currencySymbol, disabled, errors, - onChange + onChange, } = props; const intl = useIntl(); const classes = useStyles(props); @@ -96,7 +96,7 @@ const RefundAmountInput: React.FC = props => { InputProps={{ inputProps: { max: maxRefund?.amount } }} inputProps={{ "data-test-id": "amountInput", - max: maxRefund?.amount + max: maxRefund?.amount, }} error={isError} hint={ diff --git a/src/orders/components/OrderRefundReturnAmount/utils.ts b/src/orders/components/OrderRefundReturnAmount/utils.ts index 6ab94faff..2703b2ef7 100644 --- a/src/orders/components/OrderRefundReturnAmount/utils.ts +++ b/src/orders/components/OrderRefundReturnAmount/utils.ts @@ -6,7 +6,7 @@ import { getPreviouslyRefundedPrice, getRefundedLinesPriceSum, getReplacedProductsAmount, - getReturnSelectedProductsAmount + getReturnSelectedProductsAmount, } from "@saleor/orders/utils/data"; import { OrderRefundFormData } from "../OrderRefundPage/form"; @@ -14,7 +14,7 @@ import { LineItemData, OrderReturnFormData } from "../OrderReturnPage/form"; import { OrderRefundAmountValuesProps } from "./OrderRefundReturnAmountValues"; export const getMiscellaneousAmountValues = ( - order: OrderRefundDataQuery["order"] + order: OrderRefundDataQuery["order"], ): OrderRefundAmountValuesProps => { const authorizedAmount = order?.total?.gross; const previouslyRefunded = getPreviouslyRefundedPrice(order); @@ -23,7 +23,7 @@ export const getMiscellaneousAmountValues = ( return { authorizedAmount, maxRefund, - previouslyRefunded + previouslyRefunded, }; }; @@ -34,7 +34,7 @@ const getShipmentCost = (order: OrderRefundDataQuery["order"]) => getAuthorizedAmount(order)?.currency && (order?.shippingPrice?.gross || { amount: 0, - currency: getAuthorizedAmount(order)?.currency + currency: getAuthorizedAmount(order)?.currency, }); const getMaxRefund = (order: OrderRefundDataQuery["order"]) => @@ -45,7 +45,7 @@ export const getProductsAmountValues = ({ fulfilledItemsQuantities, waitingItemsQuantities, unfulfilledItemsQuantities, - refundShipmentCosts + refundShipmentCosts, }: { order: OrderRefundDataQuery["order"]; fulfilledItemsQuantities: FormsetData; @@ -60,15 +60,15 @@ export const getProductsAmountValues = ({ const maxRefund = getMaxRefund(order); const refundedLinesSum = getRefundedLinesPriceSum( order?.lines, - unfulfilledItemsQuantities as FormsetData + unfulfilledItemsQuantities as FormsetData, ); const waitingLinesSum = getAllFulfillmentLinesPriceSum( order?.fulfillments, - waitingItemsQuantities as FormsetData + waitingItemsQuantities as FormsetData, ); const allFulfillmentLinesSum = getAllFulfillmentLinesPriceSum( order?.fulfillments, - fulfilledItemsQuantities as FormsetData + fulfilledItemsQuantities as FormsetData, ); const allLinesSum = refundedLinesSum + allFulfillmentLinesSum + waitingLinesSum; @@ -77,21 +77,21 @@ export const getProductsAmountValues = ({ maxRefund, previouslyRefunded, shipmentCost, - shipmentCosts: refundShipmentCosts + shipmentCosts: refundShipmentCosts, }); const selectedProductsValue = authorizedAmount?.currency && { amount: allLinesSum, - currency: authorizedAmount.currency + currency: authorizedAmount.currency, }; const proposedRefundAmount = authorizedAmount?.currency && { amount: calculatedTotalAmount, - currency: authorizedAmount.currency + currency: authorizedAmount.currency, }; const refundTotalAmount = authorizedAmount?.currency && { amount: calculatedTotalAmount, - currency: authorizedAmount.currency + currency: authorizedAmount.currency, }; return { @@ -101,7 +101,7 @@ export const getProductsAmountValues = ({ proposedRefundAmount, refundTotalAmount, selectedProductsValue, - shipmentCost + shipmentCost, }; }; @@ -109,7 +109,7 @@ const getCalculatedTotalAmount = ({ shipmentCost, shipmentCosts, allLinesSum, - maxRefund + maxRefund, }: { shipmentCost: IMoney; shipmentCosts: IMoney; @@ -134,7 +134,7 @@ const getReturnTotalAmount = ({ selectedProductsValue, refundShipmentCosts, order, - maxRefund + maxRefund, }: { order: OrderDetailsFragment; selectedProductsValue: IMoney; @@ -156,7 +156,7 @@ const getReturnTotalAmount = ({ export const getReturnProductsAmountValues = ( order: OrderDetailsFragment, - formData: OrderReturnFormData + formData: OrderReturnFormData, ) => { const authorizedAmount = getAuthorizedAmount(order); @@ -164,17 +164,17 @@ export const getReturnProductsAmountValues = ( fulfilledItemsQuantities, waitingItemsQuantities, unfulfilledItemsQuantities, - refundShipmentCosts + refundShipmentCosts, } = formData; const replacedProductsValue = authorizedAmount?.currency && { amount: getReplacedProductsAmount(order, formData), - currency: authorizedAmount.currency + currency: authorizedAmount.currency, }; const selectedProductsValue = authorizedAmount?.currency && { amount: getReturnSelectedProductsAmount(order, formData), - currency: authorizedAmount.currency + currency: authorizedAmount.currency, }; const refundTotalAmount = authorizedAmount?.currency && { @@ -182,9 +182,9 @@ export const getReturnProductsAmountValues = ( maxRefund: getMaxRefund(order), order, refundShipmentCosts, - selectedProductsValue + selectedProductsValue, }), - currency: authorizedAmount.currency + currency: authorizedAmount.currency, }; return { @@ -193,11 +193,11 @@ export const getReturnProductsAmountValues = ( fulfilledItemsQuantities, waitingItemsQuantities, unfulfilledItemsQuantities, - refundShipmentCosts + refundShipmentCosts, }), refundTotalAmount, replacedProductsValue, - selectedProductsValue + selectedProductsValue, }; }; @@ -206,13 +206,13 @@ export const getRefundProductsAmountValues = ( { refundedFulfilledProductQuantities, refundShipmentCosts, - refundedProductQuantities - }: OrderRefundFormData + refundedProductQuantities, + }: OrderRefundFormData, ) => getProductsAmountValues({ order, fulfilledItemsQuantities: refundedFulfilledProductQuantities, waitingItemsQuantities: [], unfulfilledItemsQuantities: refundedProductQuantities, - refundShipmentCosts + refundShipmentCosts, }); diff --git a/src/orders/components/OrderRefundUnfulfilledProducts/OrderRefundUnfulfilledProducts.tsx b/src/orders/components/OrderRefundUnfulfilledProducts/OrderRefundUnfulfilledProducts.tsx index 030d1fc65..05e841b0b 100644 --- a/src/orders/components/OrderRefundUnfulfilledProducts/OrderRefundUnfulfilledProducts.tsx +++ b/src/orders/components/OrderRefundUnfulfilledProducts/OrderRefundUnfulfilledProducts.tsx @@ -7,7 +7,7 @@ import { TableHead, TableRow, TextField, - Typography + Typography, } from "@material-ui/core"; import { Button } from "@saleor/components/Button"; import CardTitle from "@saleor/components/CardTitle"; @@ -27,39 +27,39 @@ const useStyles = makeStyles( theme => { const inputPadding = { paddingBottom: theme.spacing(2), - paddingTop: theme.spacing(2) + paddingTop: theme.spacing(2), }; return { cartContent: { paddingBottom: 0, - paddingTop: 0 + paddingTop: 0, }, colQuantity: { textAlign: "right", - width: 210 + width: 210, }, notice: { marginBottom: theme.spacing(1), - marginTop: theme.spacing(2) + marginTop: theme.spacing(2), }, quantityInnerInput: { - ...inputPadding + ...inputPadding, }, quantityInnerInputNoRemaining: { - paddingRight: 0 + paddingRight: 0, }, remainingQuantity: { ...inputPadding, color: theme.palette.text.secondary, - whiteSpace: "nowrap" + whiteSpace: "nowrap", }, setMaximalQuantityButton: { - marginTop: theme.spacing(1) - } + marginTop: theme.spacing(1), + }, }; }, - { name: "OrderRefundUnfulfilledProducts" } + { name: "OrderRefundUnfulfilledProducts" }, ); interface OrderRefundUnfulfilledProductsProps { @@ -76,7 +76,7 @@ const OrderRefundUnfulfilledProducts: React.FC @@ -152,7 +152,7 @@ const OrderRefundUnfulfilledProducts: React.FC { const selectedLineQuantity = data.refundedProductQuantities.find( - refundedLine => refundedLine.id === line.id + refundedLine => refundedLine.id === line.id, ); const lineQuantity = line?.quantityToFulfill; const isError = @@ -181,14 +181,14 @@ const OrderRefundUnfulfilledProducts: React.FC onRefundedProductQuantityChange( line.id, - event.target.value + event.target.value, ) } InputProps={{ @@ -196,7 +196,7 @@ const OrderRefundUnfulfilledProducts: React.FC / {lineQuantity}
- ) + ), }} error={isError} helperText={ @@ -204,7 +204,7 @@ const OrderRefundUnfulfilledProducts: React.FC @@ -219,7 +219,7 @@ const OrderRefundUnfulfilledProducts: React.FC )) || } @@ -236,7 +236,7 @@ const OrderRefundUnfulfilledProducts: React.FC - ) + ), )} diff --git a/src/orders/components/OrderReturnPage/OrderReturnPage.tsx b/src/orders/components/OrderReturnPage/OrderReturnPage.tsx index cacf2ecf5..983565f36 100644 --- a/src/orders/components/OrderReturnPage/OrderReturnPage.tsx +++ b/src/orders/components/OrderReturnPage/OrderReturnPage.tsx @@ -18,20 +18,20 @@ import { getFulfilledFulfillemnts, getParsedLines, getUnfulfilledLines, - getWaitingFulfillments + getWaitingFulfillments, } from "./utils"; const messages = defineMessages({ appTitle: { id: "rVIlBs", defaultMessage: "Order #{orderNumber}", - description: "page header with order number" + description: "page header with order number", }, pageTitle: { id: "BBIQxQ", defaultMessage: "Order no. {orderNumber} - Replace/Return", - description: "page header" - } + description: "page header", + }, }); export interface OrderReturnPageProps { @@ -51,12 +51,12 @@ const OrderRefundPage: React.FC = props => { {intl.formatMessage(messages.appTitle, { - orderNumber: order?.number + orderNumber: order?.number, })} @@ -91,13 +91,13 @@ const OrderRefundPage: React.FC = props => { itemsSelections={data.itemsToBeReplaced} onChangeQuantity={handlers.changeWaitingItemsQuantity} onSetMaxQuantity={handlers.handleSetMaximalItemsQuantities( - id + id, )} onChangeSelected={handlers.changeItemsToBeReplaced} /> - ) + ), )} {renderCollection( getFulfilledFulfillemnts(order), @@ -112,13 +112,13 @@ const OrderRefundPage: React.FC = props => { itemsSelections={data.itemsToBeReplaced} onChangeQuantity={handlers.changeFulfiledItemsQuantity} onSetMaxQuantity={handlers.handleSetMaximalItemsQuantities( - id + id, )} onChangeSelected={handlers.changeItemsToBeReplaced} /> - ) + ), )}
diff --git a/src/orders/components/OrderReturnPage/OrderReturnRefundItemsCard/MaximalButton.tsx b/src/orders/components/OrderReturnPage/OrderReturnRefundItemsCard/MaximalButton.tsx index 1f8269538..ea7000dec 100644 --- a/src/orders/components/OrderReturnPage/OrderReturnRefundItemsCard/MaximalButton.tsx +++ b/src/orders/components/OrderReturnPage/OrderReturnRefundItemsCard/MaximalButton.tsx @@ -7,10 +7,10 @@ const useStyles = makeStyles( theme => ({ button: { marginBottom: theme.spacing(1), - marginTop: theme.spacing(3) - } + marginTop: theme.spacing(3), + }, }), - { name: "MaximalButton" } + { name: "MaximalButton" }, ); interface MaximalButtonProps { diff --git a/src/orders/components/OrderReturnPage/OrderReturnRefundItemsCard/ProductErrorCell.tsx b/src/orders/components/OrderReturnPage/OrderReturnRefundItemsCard/ProductErrorCell.tsx index a57735960..1fa00e121 100644 --- a/src/orders/components/OrderReturnPage/OrderReturnRefundItemsCard/ProductErrorCell.tsx +++ b/src/orders/components/OrderReturnPage/OrderReturnRefundItemsCard/ProductErrorCell.tsx @@ -7,7 +7,7 @@ import { defineMessages, useIntl } from "react-intl"; const useStyles = makeStyles( theme => ({ container: { - position: "relative" + position: "relative", }, errorBox: { backgroundColor: theme.palette.error.main, @@ -15,25 +15,25 @@ const useStyles = makeStyles( marginRight: theme.spacing(3), padding: theme.spacing(2, 3), width: 280, - zIndex: 1000 + zIndex: 1000, }, errorText: { color: "white", - fontSize: 14 + fontSize: 14, }, errorTextHighlighted: { color: theme.palette.error.main, fontSize: 12, - marginRight: theme.spacing(1) + marginRight: theme.spacing(1), }, titleContainer: { alignItems: "center", display: "flex", flexDirection: "row", - justifyContent: "flex-end" - } + justifyContent: "flex-end", + }, }), - { name: "ProductErrorCell" } + { name: "ProductErrorCell" }, ); const messages = defineMessages({ @@ -41,13 +41,13 @@ const messages = defineMessages({ id: "RlbhwF", defaultMessage: "This product is no longer in database so it can’t be replaced, nor returned", - description: "product no longer exists error description" + description: "product no longer exists error description", }, title: { id: "p4zuQp", defaultMessage: "Product no longer exists", - description: "product no longer exists error title" - } + description: "product no longer exists error title", + }, }); interface ProductErrorCellProps { diff --git a/src/orders/components/OrderReturnPage/OrderReturnRefundItemsCard/ReturnItemsCard.tsx b/src/orders/components/OrderReturnPage/OrderReturnRefundItemsCard/ReturnItemsCard.tsx index 143b2ec84..6f1846f0b 100644 --- a/src/orders/components/OrderReturnPage/OrderReturnRefundItemsCard/ReturnItemsCard.tsx +++ b/src/orders/components/OrderReturnPage/OrderReturnRefundItemsCard/ReturnItemsCard.tsx @@ -6,7 +6,7 @@ import { TableCell, TableHead, TableRow, - TextField + TextField, } from "@material-ui/core"; import Money from "@saleor/components/Money"; import Skeleton from "@saleor/components/Skeleton"; @@ -14,7 +14,7 @@ import TableCellAvatar from "@saleor/components/TableCellAvatar"; import { OrderDetailsFragment, OrderErrorFragment, - OrderLineFragment + OrderLineFragment, } from "@saleor/graphql"; import { FormsetChange } from "@saleor/hooks/useFormset"; import { makeStyles, ResponsiveTable } from "@saleor/macaw-ui"; @@ -32,61 +32,61 @@ const useStyles = makeStyles( theme => { const inputPadding: CSSProperties = { paddingBottom: theme.spacing(2), - paddingTop: theme.spacing(2) + paddingTop: theme.spacing(2), }; return { cartContent: { paddingBottom: 0, - paddingTop: 0 + paddingTop: 0, }, notice: { marginBottom: theme.spacing(1), - marginTop: theme.spacing(2) + marginTop: theme.spacing(2), }, quantityField: { - minWidth: "80px" + minWidth: "80px", }, quantityInnerInput: { - ...inputPadding + ...inputPadding, }, quantityInnerInputNoRemaining: { - paddingRight: 0 + paddingRight: 0, }, remainingQuantity: { ...inputPadding, color: theme.palette.text.secondary, - whiteSpace: "nowrap" + whiteSpace: "nowrap", }, setMaximalQuantityButton: { marginBottom: theme.spacing(1), marginTop: theme.spacing(2), - padding: 0 - } + padding: 0, + }, }; }, - { name: "ItemsCard" } + { name: "ItemsCard" }, ); const messages = defineMessages({ improperValue: { id: "xoyCZ/", defaultMessage: "Improper value", - description: "error message" + description: "error message", }, titleFulfilled: { id: "NxRsHQ", defaultMessage: "Fulfillment - #{fulfilmentId}", - description: "section header" + description: "section header", }, titleUnfulfilled: { id: "BkFke9", defaultMessage: "Unfulfilled Items", - description: "section header" - } + description: "section header", + }, }); interface OrderReturnRefundLinesCardProps { @@ -110,13 +110,13 @@ const ItemsCard: React.FC = ({ itemsSelections, itemsQuantities, fulfilmentId, - order + order, }) => { const classes = useStyles({}); const intl = useIntl(); const handleChangeQuantity = (id: string) => ( - event: React.ChangeEvent + event: React.ChangeEvent, ) => onChangeQuantity(id, parseInt(event.target.value, 10)); const fulfillment = order?.fulfillments.find(getById(fulfilmentId)); @@ -177,7 +177,7 @@ const ItemsCard: React.FC = ({ thumbnail, unitPrice, productName, - variant + variant, } = line; const isValueError = false; const isRefunded = itemsQuantities.find(getById(id)).data @@ -189,7 +189,7 @@ const ItemsCard: React.FC = ({ const isSelected = itemsSelections.find(getById(id))?.value; const currentQuantity = itemsQuantities.find(getById(id))?.value; const anyLineWithoutVariant = lines.some( - ({ variant }) => !variant + ({ variant }) => !variant, ); const productNameCellWidth = anyLineWithoutVariant ? "30%" @@ -208,7 +208,7 @@ const ItemsCard: React.FC = ({ @@ -223,7 +223,7 @@ const ItemsCard: React.FC = ({ "data-test-id": id, max: lineQuantity.toString(), min: 0, - style: { textAlign: "right" } + style: { textAlign: "right" }, }} fullWidth value={currentQuantity} @@ -233,7 +233,7 @@ const ItemsCard: React.FC = ({
/ {lineQuantity}
- ) + ), }} error={isValueError} helperText={ @@ -260,7 +260,7 @@ const ItemsCard: React.FC = ({ - ) + ), )} diff --git a/src/orders/components/OrderReturnPage/form.tsx b/src/orders/components/OrderReturnPage/form.tsx index b7e09cdc5..f0230860f 100644 --- a/src/orders/components/OrderReturnPage/form.tsx +++ b/src/orders/components/OrderReturnPage/form.tsx @@ -2,11 +2,11 @@ import { useExitFormDialog } from "@saleor/components/Form/useExitFormDialog"; import { FulfillmentStatus, OrderDetailsFragment } from "@saleor/graphql"; import useForm, { CommonUseFormResultWithHandlers, - SubmitPromise + SubmitPromise, } from "@saleor/hooks/useForm"; import useFormset, { FormsetChange, - FormsetData + FormsetData, } from "@saleor/hooks/useFormset"; import useHandleFormSubmit from "@saleor/hooks/useHandleFormSubmit"; import React, { useEffect } from "react"; @@ -17,7 +17,7 @@ import { getLineItem, getOrderUnfulfilledLines, getParsedLineData, - getParsedLineDataForFulfillmentStatus + getParsedLineDataForFulfillmentStatus, } from "./utils"; export interface LineItemOptions { @@ -72,47 +72,47 @@ interface OrderReturnProps { const getOrderRefundPageFormData = (): OrderReturnData => ({ amount: undefined, amountCalculationMode: OrderRefundAmountCalculationMode.AUTOMATIC, - refundShipmentCosts: false + refundShipmentCosts: false, }); function useOrderReturnForm( order: OrderDetailsFragment, - onSubmit: (data: OrderRefundSubmitData) => SubmitPromise + onSubmit: (data: OrderRefundSubmitData) => SubmitPromise, ): UseOrderRefundFormResult { const { handleChange, data: formData, triggerChange, formId, - setIsSubmitDisabled + setIsSubmitDisabled, } = useForm(getOrderRefundPageFormData(), undefined, { - confirmLeave: true + confirmLeave: true, }); const { setExitDialogSubmitRef } = useExitFormDialog({ - formId + formId, }); const unfulfiledItemsQuantites = useFormset( - getOrderUnfulfilledLines(order).map(getParsedLineData({ initialValue: 0 })) + getOrderUnfulfilledLines(order).map(getParsedLineData({ initialValue: 0 })), ); const getItemsFulfilled = () => { const commonOptions = { initialValue: 0, - isFulfillment: true + isFulfillment: true, }; const refundedFulfilmentsItems = getParsedLineDataForFulfillmentStatus( order, FulfillmentStatus.REFUNDED, - { ...commonOptions, isRefunded: true } + { ...commonOptions, isRefunded: true }, ); const fulfilledFulfillmentsItems = getParsedLineDataForFulfillmentStatus( order, FulfillmentStatus.FULFILLED, - commonOptions + commonOptions, ); return refundedFulfilmentsItems.concat(fulfilledFulfillmentsItems); @@ -121,22 +121,22 @@ function useOrderReturnForm( const getItemsWaiting = () => { const commonOptions = { initialValue: 0, - isFulfillment: true + isFulfillment: true, }; return getParsedLineDataForFulfillmentStatus( order, FulfillmentStatus.WAITING_FOR_APPROVAL, - commonOptions + commonOptions, ); }; const fulfiledItemsQuatities = useFormset( - getItemsFulfilled() + getItemsFulfilled(), ); const waitingItemsQuantities = useFormset( - getItemsWaiting() + getItemsWaiting(), ); const getItemsToBeReplaced = () => { @@ -145,37 +145,37 @@ function useOrderReturnForm( } const orderLinesItems = getOrderUnfulfilledLines(order).map( - getParsedLineData({ initialValue: false }) + getParsedLineData({ initialValue: false }), ); const refundedFulfilmentsItems = getParsedLineDataForFulfillmentStatus( order, FulfillmentStatus.REFUNDED, - { initialValue: false, isFulfillment: true } + { initialValue: false, isFulfillment: true }, ); const fulfilledFulfillmentsItems = getParsedLineDataForFulfillmentStatus( order, FulfillmentStatus.FULFILLED, - { initialValue: false, isFulfillment: true } + { initialValue: false, isFulfillment: true }, ); const waitingFulfillmentsItems = getParsedLineDataForFulfillmentStatus( order, FulfillmentStatus.WAITING_FOR_APPROVAL, - { initialValue: false, isFulfillment: true } + { initialValue: false, isFulfillment: true }, ); return [ ...orderLinesItems, ...refundedFulfilmentsItems, ...fulfilledFulfillmentsItems, - ...waitingFulfillmentsItems + ...waitingFulfillmentsItems, ]; }; const itemsToBeReplaced = useFormset( - getItemsToBeReplaced() + getItemsToBeReplaced(), ); const handleSetMaximalUnfulfiledItemsQuantities = () => { @@ -185,7 +185,7 @@ function useOrderReturnForm( const initialValue = line.quantityToFulfill; return getLineItem(line, { initialValue }); - } + }, ); triggerChange(); @@ -209,7 +209,7 @@ function useOrderReturnForm( return getLineItem(line, { initialValue: line.quantity, - isRefunded: item.data.isRefunded + isRefunded: item.data.isRefunded, }); }); @@ -222,12 +222,12 @@ function useOrderReturnForm( waitingItemsQuantities: waitingItemsQuantities.data, itemsToBeReplaced: itemsToBeReplaced.data, unfulfilledItemsQuantities: unfulfiledItemsQuantites.data, - ...formData + ...formData, }; const handleFormSubmit = useHandleFormSubmit({ formId, - onSubmit + onSubmit, }); const submit = () => handleFormSubmit(data); @@ -254,27 +254,27 @@ function useOrderReturnForm( data, handlers: { changeFulfiledItemsQuantity: handleHandlerChange( - fulfiledItemsQuatities.change + fulfiledItemsQuatities.change, ), changeWaitingItemsQuantity: handleHandlerChange( - waitingItemsQuantities.change + waitingItemsQuantities.change, ), changeItemsToBeReplaced: handleHandlerChange(itemsToBeReplaced.change), changeUnfulfiledItemsQuantity: handleHandlerChange( - unfulfiledItemsQuantites.change + unfulfiledItemsQuantites.change, ), handleSetMaximalItemsQuantities, - handleSetMaximalUnfulfiledItemsQuantities + handleSetMaximalUnfulfiledItemsQuantities, }, submit, - isSaveDisabled + isSaveDisabled, }; } const OrderReturnForm: React.FC = ({ children, order, - onSubmit + onSubmit, }) => { const props = useOrderReturnForm(order, onSubmit); diff --git a/src/orders/components/OrderReturnPage/utils.tsx b/src/orders/components/OrderReturnPage/utils.tsx index 661b74e00..740542954 100644 --- a/src/orders/components/OrderReturnPage/utils.tsx +++ b/src/orders/components/OrderReturnPage/utils.tsx @@ -5,7 +5,7 @@ import { LineItemOptions } from "./form"; const fulfiledStatuses = [ FulfillmentStatus.FULFILLED, - FulfillmentStatus.REFUNDED + FulfillmentStatus.REFUNDED, ]; export const getOrderUnfulfilledLines = (order: OrderDetailsFragment) => @@ -19,7 +19,7 @@ export const getFulfilledFulfillemnts = (order?: OrderDetailsFragment) => export const getWaitingFulfillments = (order: OrderDetailsFragment) => order?.fulfillments.filter( - f => f.status === FulfillmentStatus.WAITING_FOR_APPROVAL + f => f.status === FulfillmentStatus.WAITING_FOR_APPROVAL, ) || []; export const getUnfulfilledLines = (order?: OrderDetailsFragment) => @@ -28,13 +28,13 @@ export const getUnfulfilledLines = (order?: OrderDetailsFragment) => export const getAllOrderFulfilledLines = (order?: OrderDetailsFragment) => getFulfilledFulfillemnts(order).reduce( (result, { lines }) => [...result, ...getParsedLines(lines)], - [] + [], ); export const getAllOrderWaitingLines = (order?: OrderDetailsFragment) => getWaitingFulfillments(order).reduce( (result, { lines }) => [...result, ...getParsedLines(lines)], - [] + [], ); export function getLineItem( @@ -42,21 +42,21 @@ export function getLineItem( { initialValue, isFulfillment = false, - isRefunded = false - }: LineItemOptions + isRefunded = false, + }: LineItemOptions, ) { return { data: { isFulfillment, isRefunded }, id, label: null, - value: initialValue + value: initialValue, }; } export function getParsedLineData({ initialValue, isFulfillment = false, - isRefunded = false + isRefunded = false, }: LineItemOptions) { return (item: Node) => getLineItem(item, { initialValue, isFulfillment, isRefunded }); @@ -65,35 +65,35 @@ export function getParsedLineData({ export function getParsedLineDataForFulfillmentStatus( order: OrderDetailsFragment, fulfillmentStatus: FulfillmentStatus, - lineItemOptions: LineItemOptions + lineItemOptions: LineItemOptions, ) { return getParsedLinesOfFulfillments( - getFulfillmentsWithStatus(order, fulfillmentStatus) + getFulfillmentsWithStatus(order, fulfillmentStatus), ).map(getParsedLineData(lineItemOptions)); } export const getFulfillmentsWithStatus = ( order: OrderDetailsFragment, - fulfillmentStatus: FulfillmentStatus + fulfillmentStatus: FulfillmentStatus, ) => order?.fulfillments.filter(({ status }) => status === fulfillmentStatus) || []; export const getParsedLinesOfFulfillments = ( - fullfillments: OrderDetailsFragment["fulfillments"] + fullfillments: OrderDetailsFragment["fulfillments"], ) => fullfillments.reduce( (result, { lines }) => [...result, ...getParsedLines(lines)], - [] + [], ); export const getParsedLines = ( - lines: OrderDetailsFragment["fulfillments"][0]["lines"] + lines: OrderDetailsFragment["fulfillments"][0]["lines"], ) => lines.map(({ id, quantity, orderLine }) => ({ ...orderLine, id, - quantity + quantity, })); export const getById = (idToCompare: string) => (obj: Node) => @@ -105,10 +105,10 @@ export const getByUnmatchingId = (idToCompare: string) => (obj: { const isIncludedInIds = function( arrayToCompare: string[] | T[], - obj: Node + obj: Node, ) { const isSimpleIdsArray = (arrayToCompare as string[]).every( - value => typeof value === "string" + value => typeof value === "string", ); const idsToCompare = isSimpleIdsArray @@ -123,13 +123,13 @@ export function getByIds(arrayToCompare: string[] | T[]) { } export function getByUnmatchingIds( - arrayToCompare: string[] | T[] + arrayToCompare: string[] | T[], ) { return (obj: Node) => !isIncludedInIds(arrayToCompare, obj); } export function getByType( - typeToCompare: TType + typeToCompare: TType, ) { return (obj: TObject) => obj.type === typeToCompare; } diff --git a/src/orders/components/OrderSettings/OrderSettings.tsx b/src/orders/components/OrderSettings/OrderSettings.tsx index bac39faaf..78e63eb58 100644 --- a/src/orders/components/OrderSettings/OrderSettings.tsx +++ b/src/orders/components/OrderSettings/OrderSettings.tsx @@ -16,7 +16,7 @@ export interface OrderSettingsProps { const OrderSettings: React.FC = ({ data, disabled, - onChange + onChange, }) => { const intl = useIntl(); @@ -26,7 +26,7 @@ const OrderSettings: React.FC = ({ title={intl.formatMessage({ id: "CLYlsu", defaultMessage: "Settings", - description: "section header" + description: "section header", })} /> diff --git a/src/orders/components/OrderSettingsPage/OrderSettingsPage.stories.tsx b/src/orders/components/OrderSettingsPage/OrderSettingsPage.stories.tsx index 239390c9b..41aa2d8b8 100644 --- a/src/orders/components/OrderSettingsPage/OrderSettingsPage.stories.tsx +++ b/src/orders/components/OrderSettingsPage/OrderSettingsPage.stories.tsx @@ -1,6 +1,6 @@ import { orderSettings as orderSettingsFixture, - shopOrderSettings as shopOrderSettingsFixture + shopOrderSettings as shopOrderSettingsFixture, } from "@saleor/orders/fixtures"; import { storiesOf } from "@storybook/react"; import React from "react"; @@ -13,7 +13,7 @@ const props: OrderSettingsPageProps = { shop: shopOrderSettingsFixture, disabled: false, onSubmit: () => undefined, - saveButtonBarState: "default" + saveButtonBarState: "default", }; storiesOf("Views / Orders / Order settings", module) diff --git a/src/orders/components/OrderSettingsPage/OrderSettingsPage.tsx b/src/orders/components/OrderSettingsPage/OrderSettingsPage.tsx index 50c87cea3..1511c4e2f 100644 --- a/src/orders/components/OrderSettingsPage/OrderSettingsPage.tsx +++ b/src/orders/components/OrderSettingsPage/OrderSettingsPage.tsx @@ -6,7 +6,7 @@ import PageHeader from "@saleor/components/PageHeader"; import Savebar from "@saleor/components/Savebar"; import { OrderSettingsFragment, - ShopOrderSettingsFragment + ShopOrderSettingsFragment, } from "@saleor/graphql"; import { SubmitPromise } from "@saleor/hooks/useForm"; import useNavigator from "@saleor/hooks/useNavigator"; @@ -50,7 +50,7 @@ const OrderSettingsPage: React.FC = props => { title={intl.formatMessage({ id: "Vu9nol", defaultMessage: "Order settings", - description: "header" + description: "header", })} underline={true} /> diff --git a/src/orders/components/OrderSettingsPage/form.tsx b/src/orders/components/OrderSettingsPage/form.tsx index 4b3f5aba1..859842137 100644 --- a/src/orders/components/OrderSettingsPage/form.tsx +++ b/src/orders/components/OrderSettingsPage/form.tsx @@ -1,10 +1,10 @@ import { OrderSettingsFragment, - ShopOrderSettingsFragment + ShopOrderSettingsFragment, } from "@saleor/graphql"; import useForm, { CommonUseFormResult, - SubmitPromise + SubmitPromise, } from "@saleor/hooks/useForm"; import useHandleFormSubmit from "@saleor/hooks/useHandleFormSubmit"; import React from "react"; @@ -29,7 +29,7 @@ export interface OrderSettingsFormProps { function getOrderSeettingsFormData( orderSettings: OrderSettingsFragment, - shop: ShopOrderSettingsFragment + shop: ShopOrderSettingsFragment, ): OrderSettingsFormData { return { automaticallyFulfillNonShippableGiftCard: @@ -37,7 +37,7 @@ function getOrderSeettingsFormData( automaticallyConfirmAllNewOrders: orderSettings?.automaticallyConfirmAllNewOrders, fulfillmentAutoApprove: shop?.fulfillmentAutoApprove, - fulfillmentAllowUnpaid: shop?.fulfillmentAllowUnpaid + fulfillmentAllowUnpaid: shop?.fulfillmentAllowUnpaid, }; } @@ -45,19 +45,19 @@ function useOrderSettingsForm( orderSettings: OrderSettingsFragment, shop: ShopOrderSettingsFragment, onSubmit: (data: OrderSettingsFormData) => SubmitPromise, - disabled: boolean + disabled: boolean, ): UseOrderSettingsFormResult { const { data, handleChange, formId, setIsSubmitDisabled } = useForm( getOrderSeettingsFormData(orderSettings, shop), undefined, { - confirmLeave: true - } + confirmLeave: true, + }, ); const handleFormSubmit = useHandleFormSubmit({ formId, - onSubmit + onSubmit, }); const submit = () => handleFormSubmit(data); @@ -67,7 +67,7 @@ function useOrderSettingsForm( change: handleChange, data, submit, - isSaveDisabled: disabled + isSaveDisabled: disabled, }; } @@ -76,7 +76,7 @@ const OrderSettingsForm: React.FC = ({ orderSettings, shop, onSubmit, - disabled + disabled, }) => { const props = useOrderSettingsForm(orderSettings, shop, onSubmit, disabled); diff --git a/src/orders/components/OrderShippingMethodEditDialog/OrderShippingMethodEditDialog.tsx b/src/orders/components/OrderShippingMethodEditDialog/OrderShippingMethodEditDialog.tsx index 06072c59e..ecbd8d0bc 100644 --- a/src/orders/components/OrderShippingMethodEditDialog/OrderShippingMethodEditDialog.tsx +++ b/src/orders/components/OrderShippingMethodEditDialog/OrderShippingMethodEditDialog.tsx @@ -4,7 +4,7 @@ import { DialogContent, DialogContentText, DialogTitle, - Typography + Typography, } from "@material-ui/core"; import BackButton from "@saleor/components/BackButton"; import ConfirmButton from "@saleor/components/ConfirmButton"; @@ -28,32 +28,32 @@ export interface FormData { const useStyles = makeStyles( theme => ({ dialog: { - overflowY: "visible" + overflowY: "visible", }, menuItem: { display: "flex", width: "100%", - flexWrap: "wrap" + flexWrap: "wrap", }, price: { - marginRight: theme.spacing(3) + marginRight: theme.spacing(3), }, root: { overflowY: "visible", width: theme.breakpoints.values.sm, margin: 0, - padding: theme.spacing(3) + padding: theme.spacing(3), }, shippingMethodName: { flex: 1, overflowX: "hidden", - textOverflow: "ellipsis" + textOverflow: "ellipsis", }, message: { - width: "100%" - } + width: "100%", + }, }), - { name: "OrderShippingMethodEditDialog" } + { name: "OrderShippingMethodEditDialog" }, ); export interface OrderShippingMethodEditDialogProps { @@ -74,7 +74,7 @@ const OrderShippingMethodEditDialog: React.FC ), disabled: !s.active, - value: s.id + value: s.id, })) .sort((x, y) => (x.disabled === y.disabled ? 0 : x.disabled ? 1 : -1)) : []; const initialForm: FormData = { - shippingMethod + shippingMethod, }; return ( diff --git a/src/orders/components/OrderUnfulfilledProductsCard/OrderUnfulfilledProductsCard.tsx b/src/orders/components/OrderUnfulfilledProductsCard/OrderUnfulfilledProductsCard.tsx index 1bd961016..f3b3d5f1a 100644 --- a/src/orders/components/OrderUnfulfilledProductsCard/OrderUnfulfilledProductsCard.tsx +++ b/src/orders/components/OrderUnfulfilledProductsCard/OrderUnfulfilledProductsCard.tsx @@ -18,16 +18,16 @@ const useStyles = makeStyles( theme => ({ actions: { flexDirection: "row-reverse", - padding: theme.spacing(2, 3) + padding: theme.spacing(2, 3), }, table: { "& td, & th": { "&:not(:first-child):not(:last-child)": { paddingLeft: theme.spacing(1), - paddingRight: theme.spacing(1) - } + paddingRight: theme.spacing(1), + }, }, - tableLayout: "fixed" + tableLayout: "fixed", }, toolbar: { display: "flex", @@ -41,31 +41,31 @@ const useStyles = makeStyles( paddingLeft: theme.spacing(1.5), "&:hover": { backgroundColor: theme.palette.saleor.active[5], - color: theme.palette.saleor.active[1] + color: theme.palette.saleor.active[1], }, "& > div": { minWidth: 0, whiteSpace: "nowrap", overflow: "hidden", - textOverflow: "ellipsis" - } + textOverflow: "ellipsis", + }, }, cardTitle: { justifyContent: "space-between", "& > div": { "&:first-child": { flex: 0, - whiteSpace: "nowrap" + whiteSpace: "nowrap", }, "&:last-child": { flex: "0 1 auto", minWidth: 0, - marginLeft: theme.spacing(1) - } - } - } + marginLeft: theme.spacing(1), + }, + }, + }, }), - { name: "OrderUnfulfilledItems" } + { name: "OrderUnfulfilledItems" }, ); interface OrderUnfulfilledProductsCardProps { @@ -84,7 +84,7 @@ const OrderUnfulfilledProductsCard: React.FC lines, onFulfill, selectedWarehouse, - onWarehouseChange + onWarehouseChange, } = props; const classes = useStyles({}); diff --git a/src/orders/containers/OrderOperations.tsx b/src/orders/containers/OrderOperations.tsx index e9a34fadc..867fd0aa8 100644 --- a/src/orders/containers/OrderOperations.tsx +++ b/src/orders/containers/OrderOperations.tsx @@ -52,7 +52,7 @@ import { useOrderMarkAsPaidMutation, useOrderShippingMethodUpdateMutation, useOrderUpdateMutation, - useOrderVoidMutation + useOrderVoidMutation, } from "@saleor/graphql"; import React from "react"; @@ -138,7 +138,7 @@ interface OrderOperationsProps { onOrderFulfillmentApprove: (data: OrderFulfillmentApproveMutation) => void; onOrderFulfillmentCancel: (data: OrderFulfillmentCancelMutation) => void; onOrderFulfillmentUpdate: ( - data: OrderFulfillmentUpdateTrackingMutation + data: OrderFulfillmentUpdateTrackingMutation, ) => void; onOrderCancel: (data: OrderCancelMutation) => void; onOrderVoid: (data: OrderVoidMutation) => void; @@ -176,61 +176,61 @@ const OrderOperations: React.FC = ({ onOrderFulfillmentUpdate, onOrderMarkAsPaid, onInvoiceRequest, - onInvoiceSend + onInvoiceSend, }) => { const orderVoid = useOrderVoidMutation({ - onCompleted: onOrderVoid + onCompleted: onOrderVoid, }); const orderCancel = useOrderCancelMutation({ - onCompleted: onOrderCancel + onCompleted: onOrderCancel, }); const paymentCapture = useOrderCaptureMutation({ - onCompleted: onPaymentCapture + onCompleted: onPaymentCapture, }); const addNote = useOrderAddNoteMutation({ - onCompleted: onNoteAdd + onCompleted: onNoteAdd, }); const update = useOrderUpdateMutation({ - onCompleted: onUpdate + onCompleted: onUpdate, }); const updateDraft = useOrderDraftUpdateMutation({ - onCompleted: onDraftUpdate + onCompleted: onDraftUpdate, }); const updateShippingMethod = useOrderShippingMethodUpdateMutation({ - onCompleted: onShippingMethodUpdate + onCompleted: onShippingMethodUpdate, }); const deleteOrderLine = useOrderLineDeleteMutation({ - onCompleted: onOrderLineDelete + onCompleted: onOrderLineDelete, }); const addOrderLine = useOrderLinesAddMutation({ - onCompleted: onOrderLinesAdd + onCompleted: onOrderLinesAdd, }); const updateOrderLine = useOrderLineUpdateMutation({ - onCompleted: onOrderLineUpdate + onCompleted: onOrderLineUpdate, }); const approveFulfillment = useOrderFulfillmentApproveMutation({ - onCompleted: onOrderFulfillmentApprove + onCompleted: onOrderFulfillmentApprove, }); const cancelFulfillment = useOrderFulfillmentCancelMutation({ - onCompleted: onOrderFulfillmentCancel + onCompleted: onOrderFulfillmentCancel, }); const updateTrackingNumber = useOrderFulfillmentUpdateTrackingMutation({ - onCompleted: onOrderFulfillmentUpdate + onCompleted: onOrderFulfillmentUpdate, }); const finalizeDraft = useOrderDraftFinalizeMutation({ - onCompleted: onDraftFinalize + onCompleted: onDraftFinalize, }); const cancelDraft = useOrderDraftCancelMutation({ - onCompleted: onDraftCancel + onCompleted: onDraftCancel, }); const markAsPaid = useOrderMarkAsPaidMutation({ - onCompleted: onOrderMarkAsPaid + onCompleted: onOrderMarkAsPaid, }); const invoiceRequest = useInvoiceRequestMutation({ - onCompleted: onInvoiceRequest + onCompleted: onInvoiceRequest, }); const invoiceEmailSend = useInvoiceEmailSendMutation({ - onCompleted: onInvoiceSend + onCompleted: onInvoiceSend, }); return ( @@ -244,7 +244,7 @@ const OrderOperations: React.FC = ({ orderFulfillmentApprove: getMutationProviderData(...approveFulfillment), orderFulfillmentCancel: getMutationProviderData(...cancelFulfillment), orderFulfillmentUpdateTracking: getMutationProviderData( - ...updateTrackingNumber + ...updateTrackingNumber, ), orderInvoiceRequest: getMutationProviderData(...invoiceRequest), orderInvoiceSend: getMutationProviderData(...invoiceEmailSend), @@ -254,10 +254,10 @@ const OrderOperations: React.FC = ({ orderPaymentCapture: getMutationProviderData(...paymentCapture), orderPaymentMarkAsPaid: getMutationProviderData(...markAsPaid), orderShippingMethodUpdate: getMutationProviderData( - ...updateShippingMethod + ...updateShippingMethod, ), orderUpdate: getMutationProviderData(...update), - orderVoid: getMutationProviderData(...orderVoid) + orderVoid: getMutationProviderData(...orderVoid), })} ); diff --git a/src/orders/fixtures.ts b/src/orders/fixtures.ts index 8542a2a7f..5f29881f3 100644 --- a/src/orders/fixtures.ts +++ b/src/orders/fixtures.ts @@ -16,7 +16,7 @@ import { SearchOrderVariantQuery, SearchWarehousesQuery, ShopOrderSettingsFragment, - WeightUnitsEnum + WeightUnitsEnum, } from "@saleor/graphql"; import { RelayToFlat } from "@saleor/types"; import { warehouseForPickup, warehouseList } from "@saleor/warehouses/fixtures"; @@ -29,14 +29,14 @@ export const countries: CountryWithCodeFragment[] = [ { __typename: "CountryDisplay", code: "AX", country: "Åland Islands" }, { __typename: "CountryDisplay", code: "AL", country: "Albania" }, { __typename: "CountryDisplay", code: "DZ", country: "Algeria" }, - { __typename: "CountryDisplay", code: "AS", country: "American Samoa" } + { __typename: "CountryDisplay", code: "AS", country: "American Samoa" }, ]; export const shop: OrderDetailsQuery["shop"] = { __typename: "Shop", countries, defaultWeightUnit: WeightUnitsEnum.KG, fulfillmentAllowUnpaid: true, - fulfillmentAutoApprove: true + fulfillmentAutoApprove: true, }; export const clients: RelayToFlat = [ @@ -45,29 +45,29 @@ export const clients: RelayToFlat = [ email: "test.client1@example.com", firstName: "John", id: "c1", - lastName: "Doe" + lastName: "Doe", }, { __typename: "User" as "User", email: "test.client2@example.com", firstName: "Dough", id: "c2", - lastName: "Jones" + lastName: "Jones", }, { __typename: "User" as "User", email: "test.client3@example.com", firstName: "Jonas", id: "c3", - lastName: "Dough" + lastName: "Dough", }, { __typename: "User" as "User", email: "test.client4@example.com", firstName: "Bill", id: "c4", - lastName: "Jonas" - } + lastName: "Jonas", + }, ]; export const orders: RelayToFlat = [ { @@ -80,7 +80,7 @@ export const orders: RelayToFlat = [ country: { __typename: "CountryDisplay", code: "BE", - country: "Belgia" + country: "Belgia", }, countryArea: "", firstName: "Laura", @@ -89,7 +89,7 @@ export const orders: RelayToFlat = [ phone: "", postalCode: "88741", streetAddress1: "3678 John Course", - streetAddress2: "" + streetAddress2: "", }, created: "2018-09-11T09:37:30.376876+00:00", id: "T3JkZXI6MjA=", @@ -101,10 +101,10 @@ export const orders: RelayToFlat = [ gross: { __typename: "Money", amount: 305.17, - currency: "USD" - } + currency: "USD", + }, }, - userEmail: "laura.stone@example.com" + userEmail: "laura.stone@example.com", }, { __typename: "Order", @@ -116,7 +116,7 @@ export const orders: RelayToFlat = [ country: { __typename: "CountryDisplay", code: "SE", - country: "Szwecja" + country: "Szwecja", }, countryArea: "", firstName: "Elizabeth", @@ -125,7 +125,7 @@ export const orders: RelayToFlat = [ phone: "", postalCode: "52203", streetAddress1: "419 Ruiz Orchard Apt. 199", - streetAddress2: "" + streetAddress2: "", }, created: "2018-09-11T09:37:30.124154+00:00", id: "T3JkZXI6MTk=", @@ -137,10 +137,10 @@ export const orders: RelayToFlat = [ gross: { __typename: "Money", amount: 1215.89, - currency: "USD" - } + currency: "USD", + }, }, - userEmail: "elizabeth.vaughn@example.com" + userEmail: "elizabeth.vaughn@example.com", }, { __typename: "Order", @@ -155,10 +155,10 @@ export const orders: RelayToFlat = [ gross: { __typename: "Money", amount: 321.71, - currency: "USD" - } + currency: "USD", + }, }, - userEmail: "david.lawson@example.com" + userEmail: "david.lawson@example.com", }, { __typename: "Order", @@ -170,7 +170,7 @@ export const orders: RelayToFlat = [ country: { __typename: "CountryDisplay", code: "GR", - country: "Grecja" + country: "Grecja", }, countryArea: "", firstName: "Aaron", @@ -179,7 +179,7 @@ export const orders: RelayToFlat = [ phone: "", postalCode: "30356", streetAddress1: "326 Palmer Rapids Apt. 717", - streetAddress2: "" + streetAddress2: "", }, created: "2018-09-11T09:37:29.864391+00:00", id: "T3JkZXI6MTc=", @@ -191,10 +191,10 @@ export const orders: RelayToFlat = [ gross: { __typename: "Money", amount: 271.95, - currency: "USD" - } + currency: "USD", + }, }, - userEmail: "aaron.randall@example.com" + userEmail: "aaron.randall@example.com", }, { __typename: "Order", @@ -206,7 +206,7 @@ export const orders: RelayToFlat = [ country: { __typename: "CountryDisplay", code: "UG", - country: "Uganda" + country: "Uganda", }, countryArea: "", firstName: "Laura", @@ -215,7 +215,7 @@ export const orders: RelayToFlat = [ phone: "", postalCode: "77693", streetAddress1: "01504 Olson Springs Suite 920", - streetAddress2: "" + streetAddress2: "", }, created: "2018-09-11T09:37:29.610339+00:00", id: "T3JkZXI6MTY=", @@ -227,10 +227,10 @@ export const orders: RelayToFlat = [ gross: { __typename: "Money", amount: 335.84, - currency: "USD" - } + currency: "USD", + }, }, - userEmail: "laura.jensen@example.com" + userEmail: "laura.jensen@example.com", }, { __typename: "Order", @@ -242,7 +242,7 @@ export const orders: RelayToFlat = [ country: { __typename: "CountryDisplay", code: "PW", - country: "Palau" + country: "Palau", }, countryArea: "", firstName: "Jenna", @@ -251,7 +251,7 @@ export const orders: RelayToFlat = [ phone: "", postalCode: "65613", streetAddress1: "2031 Mcdonald Mill", - streetAddress2: "" + streetAddress2: "", }, created: "2018-09-11T09:37:29.336209+00:00", id: "T3JkZXI6MTU=", @@ -263,10 +263,10 @@ export const orders: RelayToFlat = [ gross: { __typename: "Money", amount: 1042.15, - currency: "USD" - } + currency: "USD", + }, }, - userEmail: "jenna.villa@example.com" + userEmail: "jenna.villa@example.com", }, { __typename: "Order", @@ -278,7 +278,7 @@ export const orders: RelayToFlat = [ country: { __typename: "CountryDisplay", code: "VA", - country: "Watykan" + country: "Watykan", }, countryArea: "", firstName: "Wesley", @@ -287,7 +287,7 @@ export const orders: RelayToFlat = [ phone: "", postalCode: "66203", streetAddress1: "667 Joseph Lights", - streetAddress2: "" + streetAddress2: "", }, created: "2018-09-11T09:37:29.103651+00:00", id: "T3JkZXI6MTQ=", @@ -299,10 +299,10 @@ export const orders: RelayToFlat = [ gross: { __typename: "Money", amount: 213.69, - currency: "USD" - } + currency: "USD", + }, }, - userEmail: "wesley.davis@example.com" + userEmail: "wesley.davis@example.com", }, { __typename: "Order", @@ -314,7 +314,7 @@ export const orders: RelayToFlat = [ country: { __typename: "CountryDisplay", code: "NL", - country: "Holandia" + country: "Holandia", }, countryArea: "", firstName: "Anthony", @@ -323,7 +323,7 @@ export const orders: RelayToFlat = [ phone: "", postalCode: "78701", streetAddress1: "402 Mason Viaduct Suite 592", - streetAddress2: "" + streetAddress2: "", }, created: "2018-09-11T09:37:28.921956+00:00", id: "T3JkZXI6MTM=", @@ -335,10 +335,10 @@ export const orders: RelayToFlat = [ gross: { __typename: "Money", amount: 367.03, - currency: "USD" - } + currency: "USD", + }, }, - userEmail: "anthony.gonzalez@example.com" + userEmail: "anthony.gonzalez@example.com", }, { __typename: "Order", @@ -350,7 +350,7 @@ export const orders: RelayToFlat = [ country: { __typename: "CountryDisplay", code: "TN", - country: "Tunezja" + country: "Tunezja", }, countryArea: "", firstName: "Denise", @@ -359,7 +359,7 @@ export const orders: RelayToFlat = [ phone: "", postalCode: "27744", streetAddress1: "8376 Linda Valley Apt. 934", - streetAddress2: "" + streetAddress2: "", }, created: "2018-09-11T09:37:28.750718+00:00", id: "T3JkZXI6MTI=", @@ -371,10 +371,10 @@ export const orders: RelayToFlat = [ gross: { __typename: "Money", amount: 298.76, - currency: "USD" - } + currency: "USD", + }, }, - userEmail: "denise.freeman@example.com" + userEmail: "denise.freeman@example.com", }, { __typename: "Order", @@ -386,7 +386,7 @@ export const orders: RelayToFlat = [ country: { __typename: "CountryDisplay", code: "DJ", - country: "Dżibuti" + country: "Dżibuti", }, countryArea: "", firstName: "James", @@ -395,7 +395,7 @@ export const orders: RelayToFlat = [ phone: "", postalCode: "70958", streetAddress1: "60049 Fisher Grove", - streetAddress2: "" + streetAddress2: "", }, created: "2018-09-11T09:37:28.598246+00:00", id: "T3JkZXI6MTE=", @@ -407,10 +407,10 @@ export const orders: RelayToFlat = [ gross: { __typename: "Money", amount: 663.69, - currency: "USD" - } + currency: "USD", + }, }, - userEmail: "james.ball@example.com" + userEmail: "james.ball@example.com", }, { __typename: "Order", @@ -422,7 +422,7 @@ export const orders: RelayToFlat = [ country: { __typename: "CountryDisplay", code: "MK", - country: "Macedonia" + country: "Macedonia", }, countryArea: "", firstName: "Michael", @@ -431,7 +431,7 @@ export const orders: RelayToFlat = [ phone: "", postalCode: "11343", streetAddress1: "843 Allen Ramp Suite 194", - streetAddress2: "" + streetAddress2: "", }, created: "2018-09-11T09:37:28.409836+00:00", id: "T3JkZXI6MTA=", @@ -443,10 +443,10 @@ export const orders: RelayToFlat = [ gross: { __typename: "Money", amount: 280.41, - currency: "USD" - } + currency: "USD", + }, }, - userEmail: "michael.martinez@example.com" + userEmail: "michael.martinez@example.com", }, { __typename: "Order", @@ -458,7 +458,7 @@ export const orders: RelayToFlat = [ country: { __typename: "CountryDisplay", code: "SB", - country: "Wyspy Salomona" + country: "Wyspy Salomona", }, countryArea: "", firstName: "Melissa", @@ -467,7 +467,7 @@ export const orders: RelayToFlat = [ phone: "", postalCode: "66272", streetAddress1: "487 Roberto Shores", - streetAddress2: "" + streetAddress2: "", }, created: "2018-09-11T09:37:28.185874+00:00", id: "T3JkZXI6OQ==", @@ -479,10 +479,10 @@ export const orders: RelayToFlat = [ gross: { __typename: "Money", amount: 234.93, - currency: "USD" - } + currency: "USD", + }, }, - userEmail: "melissa.simon@example.com" + userEmail: "melissa.simon@example.com", }, { __typename: "Order", @@ -494,7 +494,7 @@ export const orders: RelayToFlat = [ country: { __typename: "CountryDisplay", code: "CL", - country: "Chile" + country: "Chile", }, countryArea: "", firstName: "Justin", @@ -503,7 +503,7 @@ export const orders: RelayToFlat = [ phone: "", postalCode: "03826", streetAddress1: "74416 Jensen Gateway Suite 140", - streetAddress2: "" + streetAddress2: "", }, created: "2018-09-11T09:37:27.953588+00:00", id: "T3JkZXI6OA==", @@ -515,10 +515,10 @@ export const orders: RelayToFlat = [ gross: { __typename: "Money", amount: 485.19, - currency: "USD" - } + currency: "USD", + }, }, - userEmail: "justin.mccoy@example.com" + userEmail: "justin.mccoy@example.com", }, { __typename: "Order", @@ -530,7 +530,7 @@ export const orders: RelayToFlat = [ country: { __typename: "CountryDisplay", code: "NL", - country: "Holandia" + country: "Holandia", }, countryArea: "", firstName: "Anthony", @@ -539,7 +539,7 @@ export const orders: RelayToFlat = [ phone: "", postalCode: "78701", streetAddress1: "402 Mason Viaduct Suite 592", - streetAddress2: "" + streetAddress2: "", }, created: "2018-09-11T09:37:27.828033+00:00", id: "T3JkZXI6Nw==", @@ -551,10 +551,10 @@ export const orders: RelayToFlat = [ gross: { __typename: "Money", amount: 223.54, - currency: "USD" - } + currency: "USD", + }, }, - userEmail: "anthony.gonzalez@example.com" + userEmail: "anthony.gonzalez@example.com", }, { __typename: "Order", @@ -566,7 +566,7 @@ export const orders: RelayToFlat = [ country: { __typename: "CountryDisplay", code: "SN", - country: "Senegal" + country: "Senegal", }, countryArea: "", firstName: "Bradley", @@ -575,7 +575,7 @@ export const orders: RelayToFlat = [ phone: "", postalCode: "88661", streetAddress1: "56414 Ashley Gardens", - streetAddress2: "" + streetAddress2: "", }, created: "2018-09-11T09:37:27.636741+00:00", id: "T3JkZXI6Ng==", @@ -587,10 +587,10 @@ export const orders: RelayToFlat = [ gross: { __typename: "Money", amount: 237.55, - currency: "USD" - } + currency: "USD", + }, }, - userEmail: "bradley.ford@example.com" + userEmail: "bradley.ford@example.com", }, { __typename: "Order", @@ -602,7 +602,7 @@ export const orders: RelayToFlat = [ country: { __typename: "CountryDisplay", code: "CG", - country: "Kongo" + country: "Kongo", }, countryArea: "", firstName: "David", @@ -611,7 +611,7 @@ export const orders: RelayToFlat = [ phone: "", postalCode: "87510", streetAddress1: "151 Huang Pines", - streetAddress2: "" + streetAddress2: "", }, created: "2018-09-11T09:37:27.420590+00:00", id: "T3JkZXI6NQ==", @@ -623,10 +623,10 @@ export const orders: RelayToFlat = [ gross: { __typename: "Money", amount: 453.55, - currency: "USD" - } + currency: "USD", + }, }, - userEmail: "david.lawson@example.com" + userEmail: "david.lawson@example.com", }, { __typename: "Order", @@ -638,7 +638,7 @@ export const orders: RelayToFlat = [ country: { __typename: "CountryDisplay", code: "NA", - country: "Namibia" + country: "Namibia", }, countryArea: "", firstName: "Lauren", @@ -647,7 +647,7 @@ export const orders: RelayToFlat = [ phone: "", postalCode: "22102", streetAddress1: "340 Amanda Tunnel Suite 869", - streetAddress2: "" + streetAddress2: "", }, created: "2018-09-11T09:37:27.230990+00:00", id: "T3JkZXI6NA==", @@ -659,10 +659,10 @@ export const orders: RelayToFlat = [ gross: { __typename: "Money", amount: 812.67, - currency: "USD" - } + currency: "USD", + }, }, - userEmail: "lauren.watson@example.com" + userEmail: "lauren.watson@example.com", }, { __typename: "Order", @@ -674,7 +674,7 @@ export const orders: RelayToFlat = [ country: { __typename: "CountryDisplay", code: "CO", - country: "Kolumbia" + country: "Kolumbia", }, countryArea: "", firstName: "Mark", @@ -683,7 +683,7 @@ export const orders: RelayToFlat = [ phone: "", postalCode: "18829", streetAddress1: "34480 Daniel Centers Apt. 642", - streetAddress2: "" + streetAddress2: "", }, created: "2018-09-11T09:37:26.972507+00:00", id: "T3JkZXI6Mw==", @@ -695,10 +695,10 @@ export const orders: RelayToFlat = [ gross: { __typename: "Money", amount: 481.41, - currency: "USD" - } + currency: "USD", + }, }, - userEmail: "mark.lee@example.com" + userEmail: "mark.lee@example.com", }, { __typename: "Order", @@ -710,7 +710,7 @@ export const orders: RelayToFlat = [ country: { __typename: "CountryDisplay", code: "BJ", - country: "Benin" + country: "Benin", }, countryArea: "", firstName: "Kara", @@ -719,7 +719,7 @@ export const orders: RelayToFlat = [ phone: "", postalCode: "88138", streetAddress1: "0674 Kent Station Suite 395", - streetAddress2: "" + streetAddress2: "", }, created: "2018-09-11T09:37:26.751359+00:00", id: "T3JkZXI6Mg==", @@ -731,10 +731,10 @@ export const orders: RelayToFlat = [ gross: { __typename: "Money", amount: 569.19, - currency: "USD" - } + currency: "USD", + }, }, - userEmail: "kara.murphy@example.com" + userEmail: "kara.murphy@example.com", }, { __typename: "Order", @@ -746,7 +746,7 @@ export const orders: RelayToFlat = [ country: { __typename: "CountryDisplay", code: "CV", - country: "Republika Zielonego Przylądka" + country: "Republika Zielonego Przylądka", }, countryArea: "", firstName: "Curtis", @@ -755,7 +755,7 @@ export const orders: RelayToFlat = [ phone: "", postalCode: "84525", streetAddress1: "839 Scott Lake", - streetAddress2: "" + streetAddress2: "", }, created: "2018-09-11T09:37:26.314968+00:00", id: "T3JkZXI6MQ==", @@ -767,11 +767,11 @@ export const orders: RelayToFlat = [ gross: { __typename: "Money", amount: 557, - currency: "USD" - } + currency: "USD", + }, }, - userEmail: "curtis.bailey@example.com" - } + userEmail: "curtis.bailey@example.com", + }, ]; export const order = (placeholder: string): OrderDetailsFragment => ({ __typename: "Order", @@ -780,7 +780,7 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ OrderAction.CAPTURE, OrderAction.MARK_AS_PAID, OrderAction.REFUND, - OrderAction.VOID + OrderAction.VOID, ], shippingMethods: [ { @@ -790,10 +790,10 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ price: { __typename: "Money", amount: 12.41, - currency: "USD" + currency: "USD", }, active: false, - message: "shipping method is disactive" + message: "shipping method is disactive", }, { __typename: "ShippingMethod", @@ -802,10 +802,10 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ price: { __typename: "Money", amount: 9.12, - currency: "USD" + currency: "USD", }, active: true, - message: null + message: null, }, { __typename: "ShippingMethod", @@ -814,11 +814,11 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ price: { __typename: "Money", amount: 7.6, - currency: "USD" + currency: "USD", }, active: true, - message: null - } + message: null, + }, ], billingAddress: { __typename: "Address", @@ -828,7 +828,7 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ country: { __typename: "CountryDisplay", code: "SB", - country: "Wyspy Salomona" + country: "Wyspy Salomona", }, countryArea: "", firstName: "Melissa", @@ -837,7 +837,7 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ phone: "", postalCode: "66272", streetAddress1: "487 Roberto Shores", - streetAddress2: "" + streetAddress2: "", }, canFinalize: true, channel: { @@ -849,8 +849,8 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ name: "Default Channel", defaultCountry: { code: "CA", - __typename: "CountryDisplay" - } + __typename: "CountryDisplay", + }, }, created: "2018-09-11T09:37:28.185874+00:00", customerNote: "Lorem ipsum dolor sit amet", @@ -876,15 +876,15 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ id: "ZXCkcmVasdwoxTW==", __typename: "App", name: "Testapp", - appUrl: "https://www.google.com/" + appUrl: "https://www.google.com/", }, user: { __typename: "User", email: "admin@example.com", firstName: "John", id: "QWRkcmVzczoxNQ==", - lastName: "Doe" - } + lastName: "Doe", + }, }, { __typename: "OrderEvent", @@ -904,9 +904,9 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ __typename: "OrderLine", id: "h47gfncfgwegfehfhj", productName: "Milk", - variantName: "Cow's milk" + variantName: "Cow's milk", }, - quantity: 4 + quantity: 4, }, { __typename: "OrderEventOrderLineObject", @@ -916,10 +916,10 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ __typename: "OrderLine", id: "7846f857t4t84y8fgh", productName: "Milk", - variantName: "Goat's milk" + variantName: "Goat's milk", }, - quantity: 4 - } + quantity: 4, + }, ], message: null, quantity: 1, @@ -931,15 +931,15 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ id: "ZXCkcmVasdwoxTW==", __typename: "App", name: "Testapp", - appUrl: "https://www.google.com/" + appUrl: "https://www.google.com/", }, user: { __typename: "User", email: "admin@example.com", firstName: "Jane", id: "QWRkcmVzczoxNQ==", - lastName: "Doe" - } + lastName: "Doe", + }, }, { __typename: "OrderEvent", @@ -958,7 +958,7 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ transactionReference: "124", type: OrderEventsEnum.NOTE_ADDED, user: null, - app: null + app: null, }, { __typename: "OrderEvent", @@ -977,7 +977,7 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ transactionReference: "125", type: OrderEventsEnum.NOTE_ADDED, user: null, - app: null + app: null, }, { __typename: "OrderEvent", @@ -996,7 +996,7 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ transactionReference: "126", type: OrderEventsEnum.EXTERNAL_SERVICE_NOTIFICATION, user: null, - app: null + app: null, }, { __typename: "OrderEvent", @@ -1015,7 +1015,7 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ transactionReference: "127", type: OrderEventsEnum.EMAIL_SENT, user: null, - app: null + app: null, }, { __typename: "OrderEvent", @@ -1034,7 +1034,7 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ transactionReference: "128", type: OrderEventsEnum.EMAIL_SENT, user: null, - app: null + app: null, }, { __typename: "OrderEvent", @@ -1053,8 +1053,8 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ transactionReference: "129", type: OrderEventsEnum.PAYMENT_AUTHORIZED, user: null, - app: null - } + app: null, + }, ], fulfillments: [ { @@ -1080,15 +1080,15 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ warehouse: { id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 1, - __typename: "Allocation" - } + __typename: "Allocation", + }, ], thumbnail: { __typename: "Image" as "Image", - url: placeholder + url: placeholder, }, undiscountedUnitPrice: { __typename: "TaxedMoney", @@ -1096,18 +1096,18 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, unitDiscount: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, unitDiscountReason: null, unitDiscountType: null, @@ -1117,13 +1117,13 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, variant: { __typename: "ProductVariant", @@ -1137,11 +1137,11 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ name: "stock_warehouse1", id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" + __typename: "Stock", }, { id: "stock_test_id2", @@ -1149,21 +1149,21 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ name: "stock_warehouse2", id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" - } - ] - } + __typename: "Stock", + }, + ], + }, }, - quantity: 1 - } + quantity: 1, + }, ], status: FulfillmentStatus.FULFILLED, trackingNumber: "", - warehouse: warehouseList[1] + warehouse: warehouseList[1], }, { __typename: "Fulfillment", @@ -1188,15 +1188,15 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ warehouse: { id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 1, - __typename: "Allocation" - } + __typename: "Allocation", + }, ], thumbnail: { __typename: "Image" as "Image", - url: placeholder + url: placeholder, }, undiscountedUnitPrice: { __typename: "TaxedMoney", @@ -1204,18 +1204,18 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, unitDiscount: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, unitDiscountReason: null, unitDiscountType: null, @@ -1225,13 +1225,13 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, variant: { __typename: "ProductVariant", @@ -1245,11 +1245,11 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ name: "stock_warehouse1", id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" + __typename: "Stock", }, { id: "stock_test_id2", @@ -1257,22 +1257,22 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ name: "stock_warehouse2", id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" - } - ] - } + __typename: "Stock", + }, + ], + }, }, - quantity: 1 - } + quantity: 1, + }, ], status: FulfillmentStatus.FULFILLED, trackingNumber: "01nn12399su12nndfsy", - warehouse: warehouseList[0] - } + warehouse: warehouseList[0], + }, ], id: "T3JkZXI6OQ==", token: "e5cfc543-6a62-472f-8b80-6a2311f9ff14", @@ -1283,8 +1283,8 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ id: "SW52b2ljZTox", number: "1", status: JobStatusEnum.SUCCESS, - url: "invoice1" - } + url: "invoice1", + }, ], isPaid: true, isShippingRequired: false, @@ -1304,15 +1304,15 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ warehouse: { id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 1, - __typename: "Allocation" - } + __typename: "Allocation", + }, ], thumbnail: { __typename: "Image" as "Image", - url: placeholder + url: placeholder, }, undiscountedUnitPrice: { __typename: "TaxedMoney", @@ -1320,18 +1320,18 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ gross: { __typename: "Money", amount: 18.51, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 18.51, - currency: "USD" - } + currency: "USD", + }, }, unitDiscount: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, unitDiscountReason: null, unitDiscountType: null, @@ -1341,13 +1341,13 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ gross: { __typename: "Money", amount: 18.51, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 18.51, - currency: "USD" - } + currency: "USD", + }, }, variant: { __typename: "ProductVariant", @@ -1361,11 +1361,11 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ name: "stock_warehouse1", id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" + __typename: "Stock", }, { id: "stock_test_id2", @@ -1373,14 +1373,14 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ name: "stock_warehouse2", id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" - } - ] - } + __typename: "Stock", + }, + ], + }, }, { __typename: "OrderLine", @@ -1397,15 +1397,15 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ warehouse: { id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 1, - __typename: "Allocation" - } + __typename: "Allocation", + }, ], thumbnail: { __typename: "Image" as "Image", - url: placeholder + url: placeholder, }, undiscountedUnitPrice: { @@ -1414,18 +1414,18 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, unitDiscount: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, unitDiscountReason: null, unitDiscountType: null, @@ -1435,13 +1435,13 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, variant: { __typename: "ProductVariant", @@ -1455,11 +1455,11 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ name: "stock_warehouse1", id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" + __typename: "Stock", }, { id: "stock_test_id2", @@ -1467,22 +1467,22 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ name: "stock_warehouse2", id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" - } - ] - } - } + __typename: "Stock", + }, + ], + }, + }, ], metadata: [ { __typename: "MetadataItem", key: "integration.key", - value: "some-value" - } + value: "some-value", + }, ], number: "9", paymentStatus: PaymentChargeStatusEnum.NOT_CHARGED, @@ -1495,7 +1495,7 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ country: { __typename: "CountryDisplay", code: "SB", - country: "Wyspy Salomona" + country: "Wyspy Salomona", }, countryArea: "", firstName: "Melissa", @@ -1504,7 +1504,7 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ phone: "", postalCode: "66272", streetAddress1: "487 Roberto Shores", - streetAddress2: "" + streetAddress2: "", }, shippingMethod: null, shippingMethodName: "Registred priority", @@ -1515,8 +1515,8 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ gross: { __typename: "Money", amount: 19.98, - currency: "USD" - } + currency: "USD", + }, }, status: OrderStatus.PARTIALLY_FULFILLED, subtotal: { @@ -1524,57 +1524,57 @@ export const order = (placeholder: string): OrderDetailsFragment => ({ gross: { __typename: "Money", amount: 214.95, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 214.95, - currency: "USD" - } + currency: "USD", + }, }, total: { __typename: "TaxedMoney", gross: { __typename: "Money", amount: 234.93, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 234.93, - currency: "USD" + currency: "USD", }, tax: { __typename: "Money", amount: 0, - currency: "USD" - } + currency: "USD", + }, }, totalAuthorized: { __typename: "Money", amount: 234.93, - currency: "USD" + currency: "USD", }, totalCaptured: { __typename: "Money", amount: 0, - currency: "USD" + currency: "USD", }, undiscountedTotal: { __typename: "TaxedMoney", gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, user: null, - userEmail: "melissa.simon@example.com" + userEmail: "melissa.simon@example.com", }); export const draftOrder = (placeholder: string): OrderDetailsFragment => ({ __typename: "Order" as "Order", @@ -1592,8 +1592,8 @@ export const draftOrder = (placeholder: string): OrderDetailsFragment => ({ name: "Default Channel", defaultCountry: { code: "CA", - __typename: "CountryDisplay" - } + __typename: "CountryDisplay", + }, }, created: "2018-09-20T23:23:39.811428+00:00", customerNote: "Lorem ipsum dolor sit", @@ -1609,8 +1609,8 @@ export const draftOrder = (placeholder: string): OrderDetailsFragment => ({ id: "SW52b2ljZTox", number: "1", status: JobStatusEnum.SUCCESS, - url: "invoice1" - } + url: "invoice1", + }, ], isPaid: false, isShippingRequired: false, @@ -1630,15 +1630,15 @@ export const draftOrder = (placeholder: string): OrderDetailsFragment => ({ warehouse: { id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 1, - __typename: "Allocation" - } + __typename: "Allocation", + }, ], thumbnail: { __typename: "Image" as "Image", - url: placeholder + url: placeholder, }, undiscountedUnitPrice: { __typename: "TaxedMoney", @@ -1646,18 +1646,18 @@ export const draftOrder = (placeholder: string): OrderDetailsFragment => ({ gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, unitDiscount: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, unitDiscountReason: null, unitDiscountType: null, @@ -1667,13 +1667,13 @@ export const draftOrder = (placeholder: string): OrderDetailsFragment => ({ gross: { __typename: "Money" as "Money", amount: 65.95, - currency: "USD" + currency: "USD", }, net: { __typename: "Money" as "Money", amount: 65.95, - currency: "USD" - } + currency: "USD", + }, }, variant: { __typename: "ProductVariant", @@ -1687,11 +1687,11 @@ export const draftOrder = (placeholder: string): OrderDetailsFragment => ({ name: "stock_warehouse1", id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" + __typename: "Stock", }, { id: "stock_test_id2", @@ -1699,14 +1699,14 @@ export const draftOrder = (placeholder: string): OrderDetailsFragment => ({ name: "stock_warehouse2", id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" - } - ] - } + __typename: "Stock", + }, + ], + }, }, { __typename: "OrderLine" as "OrderLine", @@ -1723,15 +1723,15 @@ export const draftOrder = (placeholder: string): OrderDetailsFragment => ({ warehouse: { id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 1, - __typename: "Allocation" - } + __typename: "Allocation", + }, ], thumbnail: { __typename: "Image" as "Image", - url: placeholder + url: placeholder, }, undiscountedUnitPrice: { __typename: "TaxedMoney", @@ -1739,18 +1739,18 @@ export const draftOrder = (placeholder: string): OrderDetailsFragment => ({ gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, unitDiscount: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, unitDiscountReason: null, unitDiscountType: null, @@ -1760,13 +1760,13 @@ export const draftOrder = (placeholder: string): OrderDetailsFragment => ({ gross: { __typename: "Money" as "Money", amount: 68.2, - currency: "USD" + currency: "USD", }, net: { __typename: "Money" as "Money", amount: 68.2, - currency: "USD" - } + currency: "USD", + }, }, variant: { __typename: "ProductVariant", @@ -1780,11 +1780,11 @@ export const draftOrder = (placeholder: string): OrderDetailsFragment => ({ name: "stock_warehouse1", id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" + __typename: "Stock", }, { id: "stock_test_id2", @@ -1792,15 +1792,15 @@ export const draftOrder = (placeholder: string): OrderDetailsFragment => ({ name: "stock_warehouse2", id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" - } - ] - } - } + __typename: "Stock", + }, + ], + }, + }, ], metadata: [], number: "24", @@ -1816,8 +1816,8 @@ export const draftOrder = (placeholder: string): OrderDetailsFragment => ({ gross: { __typename: "Money" as "Money", amount: 0, - currency: "USD" - } + currency: "USD", + }, }, status: "DRAFT" as OrderStatus.DRAFT, subtotal: { @@ -1825,31 +1825,31 @@ export const draftOrder = (placeholder: string): OrderDetailsFragment => ({ gross: { __typename: "Money" as "Money", amount: 168.3, - currency: "USD" + currency: "USD", }, net: { __typename: "Money" as "Money", amount: 168.3, - currency: "USD" - } + currency: "USD", + }, }, total: { __typename: "TaxedMoney" as "TaxedMoney", gross: { __typename: "Money" as "Money", amount: 168.3, - currency: "USD" + currency: "USD", }, net: { __typename: "Money" as "Money", amount: 100, - currency: "USD" + currency: "USD", }, tax: { __typename: "Money" as "Money", amount: 68.3, - currency: "USD" - } + currency: "USD", + }, }, totalAuthorized: null, totalCaptured: null, @@ -1858,25 +1858,25 @@ export const draftOrder = (placeholder: string): OrderDetailsFragment => ({ gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, user: null, - userEmail: null + userEmail: null, }); export const flatOrders = orders.map(order => ({ ...order, orderStatus: transformOrderStatus(order.status, { - formatMessage: (message: MessageDescriptor) => message.defaultMessage + formatMessage: (message: MessageDescriptor) => message.defaultMessage, } as any), paymentStatus: transformPaymentStatus(order.paymentStatus, { - formatMessage: (message: MessageDescriptor) => message.defaultMessage - } as any) + formatMessage: (message: MessageDescriptor) => message.defaultMessage, + } as any), })); export const variants = [ { id: "p1", name: "Product 1: variant 1", sku: "12345", stockQuantity: 3 }, @@ -1885,15 +1885,15 @@ export const variants = [ { id: "p4", name: "Product 3: variant 1", sku: "12445", stockQuantity: 12 }, { id: "p5", name: "Product 3: variant 2", sku: "12545", stockQuantity: 7 }, { id: "p6", name: "Product 5: variant 1", sku: "13345", stockQuantity: 3 }, - { id: "p7", name: "Product 5: variant 2", sku: "14345", stockQuantity: 11 } + { id: "p7", name: "Product 5: variant 2", sku: "14345", stockQuantity: 11 }, ]; export const prefixes = ["01", "02", "41", "49"]; export const shippingMethods = [ { country: "whole world", id: "s1", name: "DHL", price: {} }, - { country: "Afghanistan", id: "s2", name: "UPS" } + { country: "Afghanistan", id: "s2", name: "UPS" }, ]; export const orderLineSearch = ( - placeholderImage: string + placeholderImage: string, ): RelayToFlat => [ { __typename: "Product" as "Product", @@ -1901,7 +1901,7 @@ export const orderLineSearch = ( name: "Apple Juice", thumbnail: { __typename: "Image" as "Image", - url: placeholderImage + url: placeholderImage, }, variants: [ { @@ -1914,13 +1914,13 @@ export const orderLineSearch = ( currencyCode: "USD", id: "123", isActive: true, - name: "Channel1" + name: "Channel1", }, price: { __typename: "Money", amount: 1, - currency: "USD" - } + currency: "USD", + }, }, { __typename: "ProductVariantChannelListing", @@ -1929,14 +1929,14 @@ export const orderLineSearch = ( currencyCode: "USD", id: "124", isActive: true, - name: "Channel2" + name: "Channel2", }, price: { __typename: "Money", amount: 1, - currency: "USD" - } - } + currency: "USD", + }, + }, ], id: "UHJvZHVjdFZhcmlhbnQ6MjAy", name: "500ml", @@ -1949,18 +1949,18 @@ export const orderLineSearch = ( gross: { amount: 1, currency: "USD", - __typename: "Money" - } + __typename: "Money", + }, }, priceUndiscounted: { __typename: "TaxedMoney", gross: { amount: 1, currency: "USD", - __typename: "Money" - } - } - } + __typename: "Money", + }, + }, + }, }, { __typename: "ProductVariant" as "ProductVariant", @@ -1972,13 +1972,13 @@ export const orderLineSearch = ( currencyCode: "USD", id: "123", isActive: true, - name: "Channel1" + name: "Channel1", }, price: { __typename: "Money", amount: 1, - currency: "USD" - } + currency: "USD", + }, }, { __typename: "ProductVariantChannelListing", @@ -1987,14 +1987,14 @@ export const orderLineSearch = ( currencyCode: "USD", id: "124", isActive: true, - name: "Channel2" + name: "Channel2", }, price: { __typename: "Money", amount: 1, - currency: "USD" - } - } + currency: "USD", + }, + }, ], id: "UHJvZHVjdFZhcmlhbnQ6MjAz", name: "1l", @@ -2007,18 +2007,18 @@ export const orderLineSearch = ( gross: { amount: 1, currency: "USD", - __typename: "Money" - } + __typename: "Money", + }, }, priceUndiscounted: { __typename: "TaxedMoney", gross: { amount: 1, currency: "USD", - __typename: "Money" - } - } - } + __typename: "Money", + }, + }, + }, }, { __typename: "ProductVariant" as "ProductVariant", @@ -2030,13 +2030,13 @@ export const orderLineSearch = ( currencyCode: "USD", id: "123", isActive: true, - name: "Channel1" + name: "Channel1", }, price: { __typename: "Money", amount: 1, - currency: "USD" - } + currency: "USD", + }, }, { __typename: "ProductVariantChannelListing", @@ -2045,14 +2045,14 @@ export const orderLineSearch = ( currencyCode: "USD", id: "124", isActive: true, - name: "Channel2" + name: "Channel2", }, price: { __typename: "Money", amount: 1, - currency: "USD" - } - } + currency: "USD", + }, + }, ], id: "UHJvZHVjdFZhcmlhbnQ6MjA0", name: "2l", @@ -2065,20 +2065,20 @@ export const orderLineSearch = ( gross: { amount: 1, currency: "USD", - __typename: "Money" - } + __typename: "Money", + }, }, priceUndiscounted: { __typename: "TaxedMoney", gross: { amount: 1, currency: "USD", - __typename: "Money" - } - } - } - } - ] + __typename: "Money", + }, + }, + }, + }, + ], }, { __typename: "Product" as "Product", @@ -2086,7 +2086,7 @@ export const orderLineSearch = ( name: "Pineapple Juice", thumbnail: { __typename: "Image" as "Image", - url: placeholderImage + url: placeholderImage, }, variants: [ { @@ -2099,13 +2099,13 @@ export const orderLineSearch = ( currencyCode: "USD", id: "123", isActive: true, - name: "Channel1" + name: "Channel1", }, price: { __typename: "Money", amount: 1, - currency: "USD" - } + currency: "USD", + }, }, { __typename: "ProductVariantChannelListing", @@ -2114,14 +2114,14 @@ export const orderLineSearch = ( currencyCode: "USD", id: "124", isActive: true, - name: "Channel2" + name: "Channel2", }, price: { __typename: "Money", amount: 1, - currency: "USD" - } - } + currency: "USD", + }, + }, ], id: "UHJvZHVjdFZhcmlhbnQ6MjEx", name: "500ml", @@ -2134,18 +2134,18 @@ export const orderLineSearch = ( gross: { amount: 1, currency: "USD", - __typename: "Money" - } + __typename: "Money", + }, }, priceUndiscounted: { __typename: "TaxedMoney", gross: { amount: 1, currency: "USD", - __typename: "Money" - } - } - } + __typename: "Money", + }, + }, + }, }, { __typename: "ProductVariant" as "ProductVariant", @@ -2157,13 +2157,13 @@ export const orderLineSearch = ( currencyCode: "USD", id: "123", isActive: true, - name: "Channel1" + name: "Channel1", }, price: { __typename: "Money", amount: 1, - currency: "USD" - } + currency: "USD", + }, }, { __typename: "ProductVariantChannelListing", @@ -2172,14 +2172,14 @@ export const orderLineSearch = ( currencyCode: "USD", id: "124", isActive: true, - name: "Channel2" + name: "Channel2", }, price: { __typename: "Money", amount: 1, - currency: "USD" - } - } + currency: "USD", + }, + }, ], id: "UHJvZHVjdFZhcmlhbnQ6MjEy", name: "1l", @@ -2192,18 +2192,18 @@ export const orderLineSearch = ( gross: { amount: 1, currency: "USD", - __typename: "Money" - } + __typename: "Money", + }, }, priceUndiscounted: { __typename: "TaxedMoney", gross: { amount: 1, currency: "USD", - __typename: "Money" - } - } - } + __typename: "Money", + }, + }, + }, }, { __typename: "ProductVariant" as "ProductVariant", @@ -2215,13 +2215,13 @@ export const orderLineSearch = ( currencyCode: "USD", id: "123", isActive: true, - name: "Channel1" + name: "Channel1", }, price: { __typename: "Money", amount: 1, - currency: "USD" - } + currency: "USD", + }, }, { __typename: "ProductVariantChannelListing", @@ -2230,14 +2230,14 @@ export const orderLineSearch = ( currencyCode: "USD", id: "124", isActive: true, - name: "Channel2" + name: "Channel2", }, price: { __typename: "Money", amount: 1, - currency: "USD" - } - } + currency: "USD", + }, + }, ], id: "UHJvZHVjdFZhcmlhbnQ6MjEz", name: "2l", @@ -2250,21 +2250,21 @@ export const orderLineSearch = ( gross: { amount: 1, currency: "USD", - __typename: "Money" - } + __typename: "Money", + }, }, priceUndiscounted: { __typename: "TaxedMoney", gross: { amount: 1, currency: "USD", - __typename: "Money" - } - } - } - } - ] - } + __typename: "Money", + }, + }, + }, + }, + ], + }, ]; export const invoices: InvoiceFragment[] = [ @@ -2275,7 +2275,7 @@ export const invoices: InvoiceFragment[] = [ number: "1/07/2020", status: JobStatusEnum.PENDING, url: - "http://localhost:8000/media/invoices/invoice-1/07/2020-order-20-1fef611b-7514-4dc6-aee3-09a8232b1d6a.pdf" + "http://localhost:8000/media/invoices/invoice-1/07/2020-order-20-1fef611b-7514-4dc6-aee3-09a8232b1d6a.pdf", }, { __typename: "Invoice", @@ -2284,7 +2284,7 @@ export const invoices: InvoiceFragment[] = [ number: "1/07/2020", status: JobStatusEnum.SUCCESS, url: - "http://localhost:8000/media/invoices/invoice-1/07/2020-order-20-8df26967-ad21-4075-a446-cef44ae05197.pdf" + "http://localhost:8000/media/invoices/invoice-1/07/2020-order-20-8df26967-ad21-4075-a446-cef44ae05197.pdf", }, { __typename: "Invoice", @@ -2293,7 +2293,7 @@ export const invoices: InvoiceFragment[] = [ number: "1/07/2020", status: JobStatusEnum.SUCCESS, url: - "http://localhost:8000/media/invoices/invoice-1/07/2020-order-20-5ebc85e0-e587-4386-8292-9b85839281e6.pdf" + "http://localhost:8000/media/invoices/invoice-1/07/2020-order-20-5ebc85e0-e587-4386-8292-9b85839281e6.pdf", }, { __typename: "Invoice", @@ -2302,20 +2302,20 @@ export const invoices: InvoiceFragment[] = [ number: "1/07/2020", status: JobStatusEnum.SUCCESS, url: - "http://localhost:8000/media/invoices/invoice-1/07/2020-order-20-0e449e10-ef4b-4066-bebe-361f670b6820.pdf" - } + "http://localhost:8000/media/invoices/invoice-1/07/2020-order-20-0e449e10-ef4b-4066-bebe-361f670b6820.pdf", + }, ]; export const orderSettings: OrderSettingsFragment = { __typename: "OrderSettings", automaticallyConfirmAllNewOrders: true, - automaticallyFulfillNonShippableGiftCard: false + automaticallyFulfillNonShippableGiftCard: false, }; export const shopOrderSettings: ShopOrderSettingsFragment = { __typename: "Shop", fulfillmentAutoApprove: true, - fulfillmentAllowUnpaid: true + fulfillmentAllowUnpaid: true, }; export const warehouseSearch: SearchWarehousesQuery["search"] = { @@ -2324,90 +2324,90 @@ export const warehouseSearch: SearchWarehousesQuery["search"] = { node: { id: "V2FyZWhvdXNlOmJiZTEwZjk1LTQyYjAtNDRlMS04Yjc5LWU5MjllMmViYTRjMQ==", name: "CyVou-97803", - __typename: "Warehouse" + __typename: "Warehouse", }, - __typename: "WarehouseCountableEdge" + __typename: "WarehouseCountableEdge", }, { node: { id: "V2FyZWhvdXNlOjdhOGViNThhLTYwN2QtNGMxNC04ODVmLTBiMWU3ZDcyMTIyNQ==", name: "CyWarehouse72715", - __typename: "Warehouse" + __typename: "Warehouse", }, - __typename: "WarehouseCountableEdge" + __typename: "WarehouseCountableEdge", }, { node: { id: "V2FyZWhvdXNlOjY2NWIxZWFmLTU5MDYtNGE0Mi1iYWVkLTc1ODQ3YWNhMWI1NQ==", name: "CyWarehouseCheckout70441", - __typename: "Warehouse" + __typename: "Warehouse", }, - __typename: "WarehouseCountableEdge" + __typename: "WarehouseCountableEdge", }, { node: { id: "V2FyZWhvdXNlOjdkNmVmNmFkLWY4NTMtNGVmNS1iMzQ5LTUyY2I2N2U3NmIwZQ==", name: "CyWeightRates-78849", - __typename: "Warehouse" + __typename: "Warehouse", }, - __typename: "WarehouseCountableEdge" + __typename: "WarehouseCountableEdge", }, { node: { id: "V2FyZWhvdXNlOjcwZjMyYTUyLWVlODQtNGExYi1iMjgzLTgwYjllMzgyNDlkNg==", name: "EditShipping-82885", - __typename: "Warehouse" + __typename: "Warehouse", }, - __typename: "WarehouseCountableEdge" + __typename: "WarehouseCountableEdge", }, { node: { id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==", name: "Europe for click and collect", - __typename: "Warehouse" + __typename: "Warehouse", }, - __typename: "WarehouseCountableEdge" + __typename: "WarehouseCountableEdge", }, { node: { id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==", name: "Oceania", - __typename: "Warehouse" + __typename: "Warehouse", }, - __typename: "WarehouseCountableEdge" + __typename: "WarehouseCountableEdge", }, { node: { id: "V2FyZWhvdXNlOjNiZDM0YjEyLTllNDktNDMwZC1iM2QyLTRkYmRhMjM1MGUyOQ==", name: "ProductsWithoutSkuInOrder", - __typename: "Warehouse" + __typename: "Warehouse", }, - __typename: "WarehouseCountableEdge" + __typename: "WarehouseCountableEdge", }, { node: { id: "V2FyZWhvdXNlOmU4M2U2NjQ2LTFhYjctNGNmNC05N2M4LTFiZjI2NGE2NjQ4Yw==", name: "StocksThreshold", - __typename: "Warehouse" + __typename: "Warehouse", }, - __typename: "WarehouseCountableEdge" + __typename: "WarehouseCountableEdge", }, { node: { id: "V2FyZWhvdXNlOmJkMmQ1NDFjLWQwMjMtNDAwNi05YmRjLWZhZTA4OWZlNzZiYg==", name: "UpdateProductsSku59844", - __typename: "Warehouse" + __typename: "Warehouse", }, - __typename: "WarehouseCountableEdge" + __typename: "WarehouseCountableEdge", }, { node: { id: "V2FyZWhvdXNlOjgzNDMwMzI4LTI2YWItNDNkZS1hNzdhLTVmNGNhMTljMDJhNg==", name: "WithoutShipmentCheckout-4505", - __typename: "Warehouse" + __typename: "Warehouse", }, - __typename: "WarehouseCountableEdge" - } + __typename: "WarehouseCountableEdge", + }, ], pageInfo: { endCursor: @@ -2415,7 +2415,7 @@ export const warehouseSearch: SearchWarehousesQuery["search"] = { hasNextPage: false, hasPreviousPage: true, startCursor: "WyJDeVZvdS05NzgwMyIsICJDeVZvdS05NzgwMyJd", - __typename: "PageInfo" + __typename: "PageInfo", }, - __typename: "WarehouseCountableConnection" + __typename: "WarehouseCountableConnection", }; diff --git a/src/orders/index.tsx b/src/orders/index.tsx index b4907b672..29acb005c 100644 --- a/src/orders/index.tsx +++ b/src/orders/index.tsx @@ -19,7 +19,7 @@ import { orderRefundPath, orderReturnPath, orderSettingsPath, - OrderUrlQueryParams + OrderUrlQueryParams, } from "./urls"; import OrderDetailsComponent from "./views/OrderDetails"; import OrderDraftListComponent from "./views/OrderDraftList"; @@ -35,7 +35,7 @@ const OrderList: React.FC> = ({ location }) => { qs, OrderListUrlSortField, OrderListUrlSortField.number, - false + false, ); return ; }; @@ -45,7 +45,7 @@ const OrderDraftList: React.FC> = ({ location }) => { qs, OrderDraftListUrlSortField, OrderDraftListUrlSortField.number, - false + false, ); return ; @@ -53,7 +53,7 @@ const OrderDraftList: React.FC> = ({ location }) => { const OrderDetails: React.FC> = ({ location, - match + match, }) => { const qs = parseQs(location.search.substr(1)); const params: OrderUrlQueryParams = qs; @@ -64,7 +64,7 @@ const OrderDetails: React.FC> = ({ const OrderFulfill: React.FC> = ({ location, - match + match, }) => { const qs = parseQs(location.search.substr(1)); const params: OrderFulfillUrlQueryParams = qs; diff --git a/src/orders/urls.ts b/src/orders/urls.ts index dabb0bae6..15a23d75b 100644 --- a/src/orders/urls.ts +++ b/src/orders/urls.ts @@ -11,7 +11,7 @@ import { Pagination, SingleAction, Sort, - TabActionDialog + TabActionDialog, } from "../types"; import { OrderFilterGiftCard } from "./components/OrderListPage"; @@ -27,16 +27,16 @@ export enum OrderListUrlFiltersEnum { payment = "payment", query = "query", clickAndCollect = "clickAndCollect", - preorder = "preorder" + preorder = "preorder", } export enum OrderListUrlFiltersWithMultipleValues { status = "status", paymentStatus = "paymentStatus", channel = "channel", - giftCard = "giftCard" + giftCard = "giftCard", } export enum OrderListFitersWithKeyValueValues { - metadata = "metadata" + metadata = "metadata", } export type OrderListUrlFilters = Filters & @@ -49,7 +49,7 @@ export enum OrderListUrlSortField { date = "date", fulfillment = "status", payment = "payment", - total = "total" + total = "total", } export type OrderListUrlSort = Sort; export type OrderListUrlQueryParams = BulkAction & @@ -72,7 +72,7 @@ export enum OrderDraftListUrlFiltersEnum { createdFrom = "createdFrom", createdTo = "createdTo", customer = "customer", - query = "query" + query = "query", } export type OrderDraftListUrlFilters = Filters; export type OrderDraftListUrlDialog = @@ -83,7 +83,7 @@ export enum OrderDraftListUrlSortField { number = "number", customer = "customer", date = "date", - total = "total" + total = "total", } export type OrderDraftListUrlSort = Sort; export type OrderDraftListUrlQueryParams = ActiveTab & @@ -93,7 +93,7 @@ export type OrderDraftListUrlQueryParams = ActiveTab & OrderDraftListUrlSort & Pagination; export const orderDraftListUrl = ( - params?: OrderDraftListUrlQueryParams + params?: OrderDraftListUrlQueryParams, ): string => { const orderDraftList = orderDraftListPath; if (params === undefined) { @@ -137,7 +137,7 @@ export const orderReturnPath = (id: string) => urlJoin(orderPath(id), "return"); export const orderFulfillUrl = ( id: string, - params?: OrderFulfillUrlQueryParams + params?: OrderFulfillUrlQueryParams, ) => orderFulfillPath(encodeURIComponent(id)) + "?" + stringifyQs(params); export const orderSettingsPath = urlJoin(orderSectionUrl, "settings"); @@ -152,5 +152,5 @@ export const orderReturnUrl = (id: string) => export const orderGiftCardBoughtPath = () => orderListUrl({ - giftCard: [OrderFilterGiftCard.paid] + giftCard: [OrderFilterGiftCard.paid], }); diff --git a/src/orders/utils/data.test.ts b/src/orders/utils/data.test.ts index 94db1ccf7..5acea2247 100644 --- a/src/orders/utils/data.test.ts +++ b/src/orders/utils/data.test.ts @@ -4,7 +4,7 @@ import { OrderLineFragment, OrderRefundDataQuery, OrderStatus, - PaymentChargeStatusEnum + PaymentChargeStatusEnum, } from "@saleor/graphql"; import { FormsetData } from "@saleor/hooks/useFormset"; @@ -18,7 +18,7 @@ import { getWarehousesFromOrderLines, mergeRepeatedOrderLines, OrderLineWithStockWarehouses, - OrderWithTotalAndTotalCaptured + OrderWithTotalAndTotalCaptured, } from "./data"; const orderBase: OrderDetailsFragment = { @@ -35,7 +35,7 @@ const orderBase: OrderDetailsFragment = { country: { __typename: "CountryDisplay", code: "SE", - country: "Szwecja" + country: "Szwecja", }, countryArea: "", firstName: "Elizabeth", @@ -44,7 +44,7 @@ const orderBase: OrderDetailsFragment = { phone: "", postalCode: "52203", streetAddress1: "419 Ruiz Orchard Apt. 199", - streetAddress2: "" + streetAddress2: "", }, created: "2018-09-11T09:37:30.124154+00:00", id: "T3JkZXI6MTk=", @@ -57,9 +57,9 @@ const orderBase: OrderDetailsFragment = { gross: { __typename: "Money", amount: 1215.89, - currency: "USD" - } - } + currency: "USD", + }, + }, }; describe("Get warehouses used in order", () => { @@ -72,18 +72,18 @@ describe("Get warehouses used in order", () => { warehouse: { __typename: "Warehouse", id: "warehouse-1", - name: "Warehouse 1" - } + name: "Warehouse 1", + }, }, { warehouse: { __typename: "Warehouse", id: "warehouse-2", - name: "Warehouse 2" - } - } - ] - } + name: "Warehouse 2", + }, + }, + ], + }, }, { variant: { @@ -92,18 +92,18 @@ describe("Get warehouses used in order", () => { warehouse: { __typename: "Warehouse", id: "warehouse-1", - name: "Warehouse 1" - } + name: "Warehouse 1", + }, }, { warehouse: { __typename: "Warehouse", id: "warehouse-2", - name: "Warehouse 2" - } - } - ] - } + name: "Warehouse 2", + }, + }, + ], + }, }, { variant: { @@ -112,19 +112,19 @@ describe("Get warehouses used in order", () => { warehouse: { __typename: "Warehouse", id: "warehouse-2", - name: "Warehouse 2" - } + name: "Warehouse 2", + }, }, { warehouse: { __typename: "Warehouse", id: "warehouse-3", - name: "Warehouse 3" - } - } - ] - } - } + name: "Warehouse 3", + }, + }, + ], + }, + }, ]; const orderWarehouses = getWarehousesFromOrderLines(lines); @@ -141,14 +141,14 @@ describe("Get previously refunded price", () => { gross: { __typename: "Money", amount: 160, - currency: "USD" - } + currency: "USD", + }, }, totalCaptured: { __typename: "Money", amount: 100, - currency: "USD" - } + currency: "USD", + }, }; const refundedPrice = getPreviouslyRefundedPrice(order); @@ -171,9 +171,9 @@ describe("Get refunded lines price sum", () => { gross: { __typename: "Money", amount: 10, - currency: "USD" - } - } + currency: "USD", + }, + }, }, { __typename: "OrderLine", @@ -187,9 +187,9 @@ describe("Get refunded lines price sum", () => { gross: { __typename: "Money", amount: 6, - currency: "USD" - } - } + currency: "USD", + }, + }, }, { __typename: "OrderLine", @@ -203,10 +203,10 @@ describe("Get refunded lines price sum", () => { gross: { __typename: "Money", amount: 4, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, ]; it("is able to sum lines prices", () => { @@ -215,25 +215,25 @@ describe("Get refunded lines price sum", () => { data: null, id: "1", label: null, - value: "1" + value: "1", }, { data: null, id: "2", label: null, - value: "1" + value: "1", }, { data: null, id: "3", label: null, - value: "1" - } + value: "1", + }, ]; const refundedLinesPriceSum = getRefundedLinesPriceSum( lines, - refundedProductQuantities + refundedProductQuantities, ); expect(refundedLinesPriceSum).toBe(20); @@ -245,25 +245,25 @@ describe("Get refunded lines price sum", () => { data: null, id: "1", label: null, - value: "0" + value: "0", }, { data: null, id: "2", label: null, - value: "2" + value: "2", }, { data: null, id: "3", label: null, - value: "4" - } + value: "4", + }, ]; const refundedLinesPriceSum = getRefundedLinesPriceSum( lines, - refundedProductQuantities + refundedProductQuantities, ); expect(refundedLinesPriceSum).toBe(28); @@ -291,14 +291,14 @@ describe("Get get all fulfillment lines price sum", () => { gross: { __typename: "Money", amount: 10, - currency: "USD" - } - } + currency: "USD", + }, + }, }, - quantity: 1 - } + quantity: 1, + }, ], - status: FulfillmentStatus.FULFILLED + status: FulfillmentStatus.FULFILLED, }, { __typename: "Fulfillment", @@ -319,11 +319,11 @@ describe("Get get all fulfillment lines price sum", () => { gross: { __typename: "Money", amount: 6, - currency: "USD" - } - } + currency: "USD", + }, + }, }, - quantity: 1 + quantity: 1, }, { __typename: "FulfillmentLine", @@ -339,14 +339,14 @@ describe("Get get all fulfillment lines price sum", () => { gross: { __typename: "Money", amount: 6, - currency: "USD" - } - } + currency: "USD", + }, + }, }, - quantity: 1 - } + quantity: 1, + }, ], - status: FulfillmentStatus.FULFILLED + status: FulfillmentStatus.FULFILLED, }, { __typename: "Fulfillment", @@ -367,11 +367,11 @@ describe("Get get all fulfillment lines price sum", () => { gross: { __typename: "Money", amount: 4, - currency: "USD" - } - } + currency: "USD", + }, + }, }, - quantity: 1 + quantity: 1, }, { __typename: "FulfillmentLine", @@ -387,11 +387,11 @@ describe("Get get all fulfillment lines price sum", () => { gross: { __typename: "Money", amount: 4, - currency: "USD" - } - } + currency: "USD", + }, + }, }, - quantity: 1 + quantity: 1, }, { __typename: "FulfillmentLine", @@ -407,15 +407,15 @@ describe("Get get all fulfillment lines price sum", () => { gross: { __typename: "Money", amount: 4, - currency: "USD" - } - } + currency: "USD", + }, + }, }, - quantity: 1 - } + quantity: 1, + }, ], - status: FulfillmentStatus.FULFILLED - } + status: FulfillmentStatus.FULFILLED, + }, ]; it("is able to sum fulfillment lines prices", () => { @@ -424,43 +424,43 @@ describe("Get get all fulfillment lines price sum", () => { data: null, id: "1-fulfillment-1", label: null, - value: "1" + value: "1", }, { data: null, id: "2-fulfillment-1", label: null, - value: "1" + value: "1", }, { data: null, id: "2-fulfillment-2", label: null, - value: "1" + value: "1", }, { data: null, id: "3-fulfillment-1", label: null, - value: "1" + value: "1", }, { data: null, id: "3-fulfillment-2", label: null, - value: "1" + value: "1", }, { data: null, id: "3-fulfillment-3", label: null, - value: "1" - } + value: "1", + }, ]; const allFulfillmentLinesPriceSum = getAllFulfillmentLinesPriceSum( fulfillments, - refundedFulfilledProductQuantities + refundedFulfilledProductQuantities, ); expect(allFulfillmentLinesPriceSum).toBe(34); @@ -472,43 +472,43 @@ describe("Get get all fulfillment lines price sum", () => { data: null, id: "1-fulfillment-1", label: null, - value: "0" + value: "0", }, { data: null, id: "2-fulfillment-1", label: null, - value: "2" + value: "2", }, { data: null, id: "2-fulfillment-2", label: null, - value: "2" + value: "2", }, { data: null, id: "3-fulfillment-1", label: null, - value: "4" + value: "4", }, { data: null, id: "3-fulfillment-2", label: null, - value: "4" + value: "4", }, { data: null, id: "3-fulfillment-3", label: null, - value: "4" - } + value: "4", + }, ]; const allFulfillmentLinesPriceSum = getAllFulfillmentLinesPriceSum( fulfillments, - refundedFulfilledProductQuantities + refundedFulfilledProductQuantities, ); expect(allFulfillmentLinesPriceSum).toBe(72); @@ -527,11 +527,11 @@ describe("Get the total value of all replaced products", () => { warehouse: { id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 1, - __typename: "Allocation" - } + __typename: "Allocation", + }, ], variant: { id: "UHJvZHVjdFZhcmlhbnQ6MzE3", @@ -545,11 +545,11 @@ describe("Get the total value of all replaced products", () => { name: "warehouse_stock1", id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" + __typename: "Stock", }, { id: "stock_test_id2", @@ -557,13 +557,13 @@ describe("Get the total value of all replaced products", () => { name: "warehouse_stock2", id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" - } - ] + __typename: "Stock", + }, + ], }, productName: "Lake Tunes", productSku: "lake-tunes-mp3", @@ -576,18 +576,18 @@ describe("Get the total value of all replaced products", () => { gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, unitDiscount: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, unitDiscountReason: null, unitDiscountType: null, @@ -596,21 +596,21 @@ describe("Get the total value of all replaced products", () => { gross: { amount: 9.99, currency: "USD", - __typename: "Money" + __typename: "Money", }, net: { amount: 9.99, currency: "USD", - __typename: "Money" + __typename: "Money", }, - __typename: "TaxedMoney" + __typename: "TaxedMoney", }, thumbnail: { url: "http://localhost:8000/media/__sized__/products/saleor-digital-03_2-thumbnail-255x255.png", - __typename: "Image" + __typename: "Image", }, - __typename: "OrderLine" + __typename: "OrderLine", }, { id: "2", @@ -621,11 +621,11 @@ describe("Get the total value of all replaced products", () => { warehouse: { id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 1, - __typename: "Allocation" - } + __typename: "Allocation", + }, ], variant: { id: "UHJvZHVjdFZhcmlhbnQ6MzE3", @@ -638,11 +638,11 @@ describe("Get the total value of all replaced products", () => { name: "warehouse_stock1", id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" + __typename: "Stock", }, { id: "stock_test_id2", @@ -650,14 +650,14 @@ describe("Get the total value of all replaced products", () => { name: "warehouse_stock2", id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" - } + __typename: "Stock", + }, ], - __typename: "ProductVariant" + __typename: "ProductVariant", }, productName: "Lake Tunes", productSku: "lake-tunes-mp3", @@ -670,18 +670,18 @@ describe("Get the total value of all replaced products", () => { gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, unitDiscount: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, unitDiscountReason: null, unitDiscountType: null, @@ -690,21 +690,21 @@ describe("Get the total value of all replaced products", () => { gross: { amount: 9.99, currency: "USD", - __typename: "Money" + __typename: "Money", }, net: { amount: 9.99, currency: "USD", - __typename: "Money" + __typename: "Money", }, - __typename: "TaxedMoney" + __typename: "TaxedMoney", }, thumbnail: { url: "http://localhost:8000/media/__sized__/products/saleor-digital-03_2-thumbnail-255x255.png", - __typename: "Image" + __typename: "Image", }, - __typename: "OrderLine" + __typename: "OrderLine", }, { id: "3", @@ -715,11 +715,11 @@ describe("Get the total value of all replaced products", () => { warehouse: { id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 1, - __typename: "Allocation" - } + __typename: "Allocation", + }, ], variant: { id: "UHJvZHVjdFZhcmlhbnQ6Mjg2", @@ -732,11 +732,11 @@ describe("Get the total value of all replaced products", () => { name: "warehouse_stock1", id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" + __typename: "Stock", }, { id: "stock_test_id2", @@ -744,14 +744,14 @@ describe("Get the total value of all replaced products", () => { name: "warehouse_stock2", id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" - } + __typename: "Stock", + }, ], - __typename: "ProductVariant" + __typename: "ProductVariant", }, productName: "T-shirt", productSku: "29810068", @@ -764,18 +764,18 @@ describe("Get the total value of all replaced products", () => { gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, unitDiscount: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, unitDiscountReason: null, unitDiscountType: null, @@ -784,22 +784,22 @@ describe("Get the total value of all replaced products", () => { gross: { amount: 2.5, currency: "USD", - __typename: "Money" + __typename: "Money", }, net: { amount: 2.5, currency: "USD", - __typename: "Money" + __typename: "Money", }, - __typename: "TaxedMoney" + __typename: "TaxedMoney", }, thumbnail: { url: "http://localhost:8000/media/__sized__/products/saleordemoproduct_cl_boot06_1-thumbnail-255x255.png", - __typename: "Image" + __typename: "Image", }, - __typename: "OrderLine" - } + __typename: "OrderLine", + }, ]; const fulfilledLines: OrderDetailsFragment["fulfillments"][0]["lines"] = [ @@ -815,11 +815,11 @@ describe("Get the total value of all replaced products", () => { warehouse: { id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 1, - __typename: "Allocation" - } + __typename: "Allocation", + }, ], variant: { id: "UHJvZHVjdFZhcmlhbnQ6MzE3", @@ -832,11 +832,11 @@ describe("Get the total value of all replaced products", () => { name: "warehouse_stock1", id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" + __typename: "Stock", }, { id: "stock_test_id2", @@ -844,14 +844,14 @@ describe("Get the total value of all replaced products", () => { name: "warehouse_stock2", id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" - } + __typename: "Stock", + }, ], - __typename: "ProductVariant" + __typename: "ProductVariant", }, productName: "Lake Tunes", productSku: "lake-tunes-mp3", @@ -864,18 +864,18 @@ describe("Get the total value of all replaced products", () => { gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, unitDiscount: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, unitDiscountReason: null, unitDiscountType: null, @@ -884,23 +884,23 @@ describe("Get the total value of all replaced products", () => { gross: { amount: 9.99, currency: "USD", - __typename: "Money" + __typename: "Money", }, net: { amount: 9.99, currency: "USD", - __typename: "Money" + __typename: "Money", }, - __typename: "TaxedMoney" + __typename: "TaxedMoney", }, thumbnail: { url: "http://localhost:8000/media/__sized__/products/saleor-digital-03_2-thumbnail-255x255.png", - __typename: "Image" + __typename: "Image", }, - __typename: "OrderLine" + __typename: "OrderLine", }, - __typename: "FulfillmentLine" + __typename: "FulfillmentLine", }, { id: "5", @@ -914,11 +914,11 @@ describe("Get the total value of all replaced products", () => { warehouse: { id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 1, - __typename: "Allocation" - } + __typename: "Allocation", + }, ], variant: { id: "UHJvZHVjdFZhcmlhbnQ6MzE3", @@ -931,11 +931,11 @@ describe("Get the total value of all replaced products", () => { name: "warehouse_stock1", id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" + __typename: "Stock", }, { id: "stock_test_id2", @@ -943,14 +943,14 @@ describe("Get the total value of all replaced products", () => { name: "warehouse_stock2", id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" - } + __typename: "Stock", + }, ], - __typename: "ProductVariant" + __typename: "ProductVariant", }, productName: "Lake Tunes", productSku: "lake-tunes-mp3", @@ -963,18 +963,18 @@ describe("Get the total value of all replaced products", () => { gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, unitDiscount: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, unitDiscountReason: null, unitDiscountType: null, @@ -983,23 +983,23 @@ describe("Get the total value of all replaced products", () => { gross: { amount: 9.99, currency: "USD", - __typename: "Money" + __typename: "Money", }, net: { amount: 9.99, currency: "USD", - __typename: "Money" + __typename: "Money", }, - __typename: "TaxedMoney" + __typename: "TaxedMoney", }, thumbnail: { url: "http://localhost:8000/media/__sized__/products/saleor-digital-03_2-thumbnail-255x255.png", - __typename: "Image" + __typename: "Image", }, - __typename: "OrderLine" + __typename: "OrderLine", }, - __typename: "FulfillmentLine" + __typename: "FulfillmentLine", }, { id: "6", @@ -1013,11 +1013,11 @@ describe("Get the total value of all replaced products", () => { warehouse: { id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 1, - __typename: "Allocation" - } + __typename: "Allocation", + }, ], variant: { id: "UHJvZHVjdFZhcmlhbnQ6Mjg2", @@ -1030,11 +1030,11 @@ describe("Get the total value of all replaced products", () => { name: "warehouse_stock1", id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" + __typename: "Stock", }, { id: "stock_test_id2", @@ -1042,14 +1042,14 @@ describe("Get the total value of all replaced products", () => { name: "warehouse_stock2", id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" - } + __typename: "Stock", + }, ], - __typename: "ProductVariant" + __typename: "ProductVariant", }, productName: "T-shirt", productSku: "29810068", @@ -1062,18 +1062,18 @@ describe("Get the total value of all replaced products", () => { gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, unitDiscount: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, unitDiscountReason: null, unitDiscountType: null, @@ -1082,23 +1082,23 @@ describe("Get the total value of all replaced products", () => { gross: { amount: 2.5, currency: "USD", - __typename: "Money" + __typename: "Money", }, net: { amount: 2.5, currency: "USD", - __typename: "Money" + __typename: "Money", }, - __typename: "TaxedMoney" + __typename: "TaxedMoney", }, thumbnail: { url: "http://localhost:8000/media/__sized__/products/saleordemoproduct_cl_boot06_1-thumbnail-255x255.png", - __typename: "Image" + __typename: "Image", }, - __typename: "OrderLine" + __typename: "OrderLine", }, - __typename: "FulfillmentLine" + __typename: "FulfillmentLine", }, { id: "7", @@ -1112,11 +1112,11 @@ describe("Get the total value of all replaced products", () => { warehouse: { id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 1, - __typename: "Allocation" - } + __typename: "Allocation", + }, ], variant: { id: "UHJvZHVjdFZhcmlhbnQ6MzE3", @@ -1129,11 +1129,11 @@ describe("Get the total value of all replaced products", () => { name: "warehouse_stock1", id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" + __typename: "Stock", }, { id: "stock_test_id2", @@ -1141,14 +1141,14 @@ describe("Get the total value of all replaced products", () => { name: "warehouse_stock2", id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" - } + __typename: "Stock", + }, ], - __typename: "ProductVariant" + __typename: "ProductVariant", }, productName: "Lake Tunes", productSku: "lake-tunes-mp3", @@ -1161,18 +1161,18 @@ describe("Get the total value of all replaced products", () => { gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, unitDiscount: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, unitDiscountReason: null, unitDiscountType: null, @@ -1181,23 +1181,23 @@ describe("Get the total value of all replaced products", () => { gross: { amount: 9.99, currency: "USD", - __typename: "Money" + __typename: "Money", }, net: { amount: 9.99, currency: "USD", - __typename: "Money" + __typename: "Money", }, - __typename: "TaxedMoney" + __typename: "TaxedMoney", }, thumbnail: { url: "http://localhost:8000/media/__sized__/products/saleor-digital-03_2-thumbnail-255x255.png", - __typename: "Image" + __typename: "Image", }, - __typename: "OrderLine" + __typename: "OrderLine", }, - __typename: "FulfillmentLine" + __typename: "FulfillmentLine", }, { id: "8", @@ -1211,11 +1211,11 @@ describe("Get the total value of all replaced products", () => { warehouse: { id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 1, - __typename: "Allocation" - } + __typename: "Allocation", + }, ], variant: { id: "UHJvZHVjdFZhcmlhbnQ6MzE3", @@ -1228,11 +1228,11 @@ describe("Get the total value of all replaced products", () => { name: "warehouse_stock1", id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" + __typename: "Stock", }, { id: "stock_test_id2", @@ -1240,14 +1240,14 @@ describe("Get the total value of all replaced products", () => { name: "warehouse_stock2", id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" - } + __typename: "Stock", + }, ], - __typename: "ProductVariant" + __typename: "ProductVariant", }, productName: "Lake Tunes", productSku: "lake-tunes-mp3", @@ -1260,18 +1260,18 @@ describe("Get the total value of all replaced products", () => { gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, unitDiscount: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, unitDiscountReason: null, unitDiscountType: null, @@ -1280,24 +1280,24 @@ describe("Get the total value of all replaced products", () => { gross: { amount: 9.99, currency: "USD", - __typename: "Money" + __typename: "Money", }, net: { amount: 9.99, currency: "USD", - __typename: "Money" + __typename: "Money", }, - __typename: "TaxedMoney" + __typename: "TaxedMoney", }, thumbnail: { url: "http://localhost:8000/media/__sized__/products/saleor-digital-03_2-thumbnail-255x255.png", - __typename: "Image" + __typename: "Image", }, - __typename: "OrderLine" + __typename: "OrderLine", }, - __typename: "FulfillmentLine" - } + __typename: "FulfillmentLine", + }, ]; const unfulfilledItemsQuantities: FormsetData = [ @@ -1305,20 +1305,20 @@ describe("Get the total value of all replaced products", () => { data: { isFulfillment: false, isRefunded: false }, id: "1", label: null, - value: 0 + value: 0, }, { data: { isFulfillment: false, isRefunded: false }, id: "2", label: null, - value: 2 + value: 2, }, { data: { isFulfillment: false, isRefunded: false }, id: "3", label: null, - value: 1 - } + value: 1, + }, ]; const fulfilledItemsQuantities: FormsetData = [ @@ -1326,32 +1326,32 @@ describe("Get the total value of all replaced products", () => { data: { isFulfillment: true, isRefunded: false }, id: "4", label: null, - value: 4 + value: 4, }, { data: { isFulfillment: true, isRefunded: false }, id: "5", label: null, - value: 0 + value: 0, }, { data: { isFulfillment: true, isRefunded: false }, id: "6", label: null, - value: 3 + value: 3, }, { data: { isFulfillment: true, isRefunded: true }, id: "7", label: null, - value: 4 + value: 4, }, { data: { isFulfillment: true, isRefunded: true }, id: "8", label: null, - value: 3 - } + value: 3, + }, ]; const itemsToBeReplaced: FormsetData = [ @@ -1359,50 +1359,50 @@ describe("Get the total value of all replaced products", () => { data: { isFulfillment: false, isRefunded: false }, id: "1", label: null, - value: true + value: true, }, { data: { isFulfillment: false, isRefunded: false }, id: "2", label: null, - value: false + value: false, }, { data: { isFulfillment: false, isRefunded: false }, id: "3", label: null, - value: true + value: true, }, { data: { isFulfillment: true, isRefunded: false }, id: "4", label: null, - value: false + value: false, }, { data: { isFulfillment: true, isRefunded: false }, id: "5", label: null, - value: true + value: true, }, { data: { isFulfillment: true, isRefunded: false }, id: "6", label: null, - value: true + value: true, }, { data: { isFulfillment: true, isRefunded: true }, id: "7", label: null, - value: false + value: false, }, { data: { isFulfillment: true, isRefunded: true }, id: "8", label: null, - value: true - } + value: true, + }, ]; const totalValue = getReplacedProductsAmount( @@ -1417,15 +1417,15 @@ describe("Get the total value of all replaced products", () => { warehouse: null, trackingNumber: "", lines: fulfilledLines, - __typename: "Fulfillment" - } - ] + __typename: "Fulfillment", + }, + ], }, { itemsToBeReplaced, unfulfilledItemsQuantities, - fulfilledItemsQuantities - } + fulfilledItemsQuantities, + }, ); expect(totalValue).toBe(10); @@ -1444,11 +1444,11 @@ describe("Get the total value of all selected products", () => { warehouse: { id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 1, - __typename: "Allocation" - } + __typename: "Allocation", + }, ], variant: { id: "UHJvZHVjdFZhcmlhbnQ6MzE3", @@ -1461,11 +1461,11 @@ describe("Get the total value of all selected products", () => { name: "warehouse_stock1", id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" + __typename: "Stock", }, { id: "stock_test_id2", @@ -1473,14 +1473,14 @@ describe("Get the total value of all selected products", () => { name: "warehouse_stock2", id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" - } + __typename: "Stock", + }, ], - __typename: "ProductVariant" + __typename: "ProductVariant", }, productName: "Lake Tunes", productSku: "lake-tunes-mp3", @@ -1493,18 +1493,18 @@ describe("Get the total value of all selected products", () => { gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, unitDiscount: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, unitDiscountReason: null, unitDiscountType: null, @@ -1513,21 +1513,21 @@ describe("Get the total value of all selected products", () => { gross: { amount: 9.99, currency: "USD", - __typename: "Money" + __typename: "Money", }, net: { amount: 9.99, currency: "USD", - __typename: "Money" + __typename: "Money", }, - __typename: "TaxedMoney" + __typename: "TaxedMoney", }, thumbnail: { url: "http://localhost:8000/media/__sized__/products/saleor-digital-03_2-thumbnail-255x255.png", - __typename: "Image" + __typename: "Image", }, - __typename: "OrderLine" + __typename: "OrderLine", }, { id: "2", @@ -1538,11 +1538,11 @@ describe("Get the total value of all selected products", () => { warehouse: { id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 1, - __typename: "Allocation" - } + __typename: "Allocation", + }, ], variant: { id: "UHJvZHVjdFZhcmlhbnQ6MzE3", @@ -1555,11 +1555,11 @@ describe("Get the total value of all selected products", () => { name: "warehouse_stock1", id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" + __typename: "Stock", }, { id: "stock_test_id2", @@ -1567,14 +1567,14 @@ describe("Get the total value of all selected products", () => { name: "warehouse_stock2", id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" - } + __typename: "Stock", + }, ], - __typename: "ProductVariant" + __typename: "ProductVariant", }, productName: "Lake Tunes", productSku: "lake-tunes-mp3", @@ -1587,18 +1587,18 @@ describe("Get the total value of all selected products", () => { gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, unitDiscount: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, unitDiscountReason: null, unitDiscountType: null, @@ -1607,21 +1607,21 @@ describe("Get the total value of all selected products", () => { gross: { amount: 9.99, currency: "USD", - __typename: "Money" + __typename: "Money", }, net: { amount: 9.99, currency: "USD", - __typename: "Money" + __typename: "Money", }, - __typename: "TaxedMoney" + __typename: "TaxedMoney", }, thumbnail: { url: "http://localhost:8000/media/__sized__/products/saleor-digital-03_2-thumbnail-255x255.png", - __typename: "Image" + __typename: "Image", }, - __typename: "OrderLine" + __typename: "OrderLine", }, { id: "3", @@ -1632,11 +1632,11 @@ describe("Get the total value of all selected products", () => { warehouse: { id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 1, - __typename: "Allocation" - } + __typename: "Allocation", + }, ], variant: { id: "UHJvZHVjdFZhcmlhbnQ6Mjg2", @@ -1649,11 +1649,11 @@ describe("Get the total value of all selected products", () => { name: "warehouse_stock1", id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" + __typename: "Stock", }, { id: "stock_test_id2", @@ -1661,14 +1661,14 @@ describe("Get the total value of all selected products", () => { name: "warehouse_stock2", id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" - } + __typename: "Stock", + }, ], - __typename: "ProductVariant" + __typename: "ProductVariant", }, productName: "T-shirt", productSku: "29810068", @@ -1681,18 +1681,18 @@ describe("Get the total value of all selected products", () => { gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, unitDiscount: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, unitDiscountReason: null, unitDiscountType: null, @@ -1701,22 +1701,22 @@ describe("Get the total value of all selected products", () => { gross: { amount: 2.5, currency: "USD", - __typename: "Money" + __typename: "Money", }, net: { amount: 2.5, currency: "USD", - __typename: "Money" + __typename: "Money", }, - __typename: "TaxedMoney" + __typename: "TaxedMoney", }, thumbnail: { url: "http://localhost:8000/media/__sized__/products/saleordemoproduct_cl_boot06_1-thumbnail-255x255.png", - __typename: "Image" + __typename: "Image", }, - __typename: "OrderLine" - } + __typename: "OrderLine", + }, ]; const fulfilledLines: OrderDetailsFragment["fulfillments"][0]["lines"] = [ @@ -1732,11 +1732,11 @@ describe("Get the total value of all selected products", () => { warehouse: { id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 1, - __typename: "Allocation" - } + __typename: "Allocation", + }, ], variant: { id: "UHJvZHVjdFZhcmlhbnQ6MzE3", @@ -1749,11 +1749,11 @@ describe("Get the total value of all selected products", () => { name: "warehouse_stock1", id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" + __typename: "Stock", }, { id: "stock_test_id2", @@ -1761,14 +1761,14 @@ describe("Get the total value of all selected products", () => { name: "warehouse_stock2", id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" - } + __typename: "Stock", + }, ], - __typename: "ProductVariant" + __typename: "ProductVariant", }, productName: "Lake Tunes", productSku: "lake-tunes-mp3", @@ -1781,18 +1781,18 @@ describe("Get the total value of all selected products", () => { gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, unitDiscount: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, unitDiscountReason: null, unitDiscountType: null, @@ -1801,23 +1801,23 @@ describe("Get the total value of all selected products", () => { gross: { amount: 9.99, currency: "USD", - __typename: "Money" + __typename: "Money", }, net: { amount: 9.99, currency: "USD", - __typename: "Money" + __typename: "Money", }, - __typename: "TaxedMoney" + __typename: "TaxedMoney", }, thumbnail: { url: "http://localhost:8000/media/__sized__/products/saleor-digital-03_2-thumbnail-255x255.png", - __typename: "Image" + __typename: "Image", }, - __typename: "OrderLine" + __typename: "OrderLine", }, - __typename: "FulfillmentLine" + __typename: "FulfillmentLine", }, { id: "5", @@ -1831,11 +1831,11 @@ describe("Get the total value of all selected products", () => { warehouse: { id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 1, - __typename: "Allocation" - } + __typename: "Allocation", + }, ], variant: { id: "UHJvZHVjdFZhcmlhbnQ6MzE3", @@ -1848,11 +1848,11 @@ describe("Get the total value of all selected products", () => { name: "warehouse_stock1", id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" + __typename: "Stock", }, { id: "stock_test_id2", @@ -1860,14 +1860,14 @@ describe("Get the total value of all selected products", () => { name: "warehouse_stock2", id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" - } + __typename: "Stock", + }, ], - __typename: "ProductVariant" + __typename: "ProductVariant", }, productName: "Lake Tunes", productSku: "lake-tunes-mp3", @@ -1880,18 +1880,18 @@ describe("Get the total value of all selected products", () => { gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, unitDiscount: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, unitDiscountReason: null, unitDiscountType: null, @@ -1900,23 +1900,23 @@ describe("Get the total value of all selected products", () => { gross: { amount: 9.99, currency: "USD", - __typename: "Money" + __typename: "Money", }, net: { amount: 9.99, currency: "USD", - __typename: "Money" + __typename: "Money", }, - __typename: "TaxedMoney" + __typename: "TaxedMoney", }, thumbnail: { url: "http://localhost:8000/media/__sized__/products/saleor-digital-03_2-thumbnail-255x255.png", - __typename: "Image" + __typename: "Image", }, - __typename: "OrderLine" + __typename: "OrderLine", }, - __typename: "FulfillmentLine" + __typename: "FulfillmentLine", }, { id: "6", @@ -1930,11 +1930,11 @@ describe("Get the total value of all selected products", () => { warehouse: { id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 1, - __typename: "Allocation" - } + __typename: "Allocation", + }, ], variant: { id: "UHJvZHVjdFZhcmlhbnQ6Mjg2", @@ -1947,11 +1947,11 @@ describe("Get the total value of all selected products", () => { name: "warehouse_stock1", id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" + __typename: "Stock", }, { id: "stock_test_id2", @@ -1959,14 +1959,14 @@ describe("Get the total value of all selected products", () => { name: "warehouse_stock2", id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" - } + __typename: "Stock", + }, ], - __typename: "ProductVariant" + __typename: "ProductVariant", }, productName: "T-shirt", productSku: "29810068", @@ -1979,18 +1979,18 @@ describe("Get the total value of all selected products", () => { gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, unitDiscount: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, unitDiscountReason: null, unitDiscountType: null, @@ -1999,24 +1999,24 @@ describe("Get the total value of all selected products", () => { gross: { amount: 2.5, currency: "USD", - __typename: "Money" + __typename: "Money", }, net: { amount: 2.5, currency: "USD", - __typename: "Money" + __typename: "Money", }, - __typename: "TaxedMoney" + __typename: "TaxedMoney", }, thumbnail: { url: "http://localhost:8000/media/__sized__/products/saleordemoproduct_cl_boot06_1-thumbnail-255x255.png", - __typename: "Image" + __typename: "Image", }, - __typename: "OrderLine" + __typename: "OrderLine", }, - __typename: "FulfillmentLine" - } + __typename: "FulfillmentLine", + }, ]; const unfulfilledItemsQuantities: FormsetData = [ @@ -2024,20 +2024,20 @@ describe("Get the total value of all selected products", () => { data: { isFulfillment: false, isRefunded: false }, id: "1", label: null, - value: 0 + value: 0, }, { data: { isFulfillment: false, isRefunded: false }, id: "2", label: null, - value: 2 + value: 2, }, { data: { isFulfillment: false, isRefunded: false }, id: "3", label: null, - value: 1 - } + value: 1, + }, ]; const fulfilledItemsQuantities: FormsetData = [ @@ -2045,20 +2045,20 @@ describe("Get the total value of all selected products", () => { data: { isFulfillment: true, isRefunded: false }, id: "4", label: null, - value: 4 + value: 4, }, { data: { isFulfillment: true, isRefunded: false }, id: "5", label: null, - value: 0 + value: 0, }, { data: { isFulfillment: true, isRefunded: false }, id: "6", label: null, - value: 3 - } + value: 3, + }, ]; const waitingItemsQuantities: FormsetData = []; @@ -2068,50 +2068,50 @@ describe("Get the total value of all selected products", () => { data: { isFulfillment: false, isRefunded: false }, id: "1", label: null, - value: true + value: true, }, { data: { isFulfillment: false, isRefunded: false }, id: "2", label: null, - value: false + value: false, }, { data: { isFulfillment: false, isRefunded: false }, id: "3", label: null, - value: true + value: true, }, { data: { isFulfillment: true, isRefunded: false }, id: "4", label: null, - value: false + value: false, }, { data: { isFulfillment: true, isRefunded: false }, id: "5", label: null, - value: true + value: true, }, { data: { isFulfillment: true, isRefunded: false }, id: "6", label: null, - value: true + value: true, }, { data: { isFulfillment: true, isRefunded: true }, id: "7", label: null, - value: true + value: true, }, { data: { isFulfillment: true, isRefunded: true }, id: "8", label: null, - value: true - } + value: true, + }, ]; const totalValue = getReturnSelectedProductsAmount( @@ -2126,16 +2126,16 @@ describe("Get the total value of all selected products", () => { warehouse: null, trackingNumber: "", lines: fulfilledLines, - __typename: "Fulfillment" - } - ] + __typename: "Fulfillment", + }, + ], }, { itemsToBeReplaced, waitingItemsQuantities, unfulfilledItemsQuantities, - fulfilledItemsQuantities - } + fulfilledItemsQuantities, + }, ); expect(totalValue).toBe(59.94); @@ -2157,11 +2157,11 @@ describe("Merge repeated order lines of fulfillment lines", () => { warehouse: { id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 1, - __typename: "Allocation" - } + __typename: "Allocation", + }, ], variant: { id: "UHJvZHVjdFZhcmlhbnQ6MzE3", @@ -2174,11 +2174,11 @@ describe("Merge repeated order lines of fulfillment lines", () => { name: "warehouse_stock1", id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" + __typename: "Stock", }, { id: "stock_test_id2", @@ -2186,14 +2186,14 @@ describe("Merge repeated order lines of fulfillment lines", () => { name: "warehouse_stock2", id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" - } + __typename: "Stock", + }, ], - __typename: "ProductVariant" + __typename: "ProductVariant", }, productName: "Lake Tunes", productSku: "lake-tunes-mp3", @@ -2206,18 +2206,18 @@ describe("Merge repeated order lines of fulfillment lines", () => { gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, unitDiscount: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, unitDiscountReason: null, unitDiscountType: null, @@ -2226,23 +2226,23 @@ describe("Merge repeated order lines of fulfillment lines", () => { gross: { amount: 9.99, currency: "USD", - __typename: "Money" + __typename: "Money", }, net: { amount: 9.99, currency: "USD", - __typename: "Money" + __typename: "Money", }, - __typename: "TaxedMoney" + __typename: "TaxedMoney", }, thumbnail: { url: "http://localhost:8000/media/__sized__/products/saleor-digital-03_2-thumbnail-255x255.png", - __typename: "Image" + __typename: "Image", }, - __typename: "OrderLine" + __typename: "OrderLine", }, - __typename: "FulfillmentLine" + __typename: "FulfillmentLine", }, { id: "RnVsZmlsbG1lbnRMaW5lOjMy", @@ -2256,11 +2256,11 @@ describe("Merge repeated order lines of fulfillment lines", () => { warehouse: { id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 1, - __typename: "Allocation" - } + __typename: "Allocation", + }, ], variant: { id: "UHJvZHVjdFZhcmlhbnQ6MzE3", @@ -2273,11 +2273,11 @@ describe("Merge repeated order lines of fulfillment lines", () => { name: "warehouse_stock1", id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" + __typename: "Stock", }, { id: "stock_test_id2", @@ -2285,14 +2285,14 @@ describe("Merge repeated order lines of fulfillment lines", () => { name: "warehouse_stock2", id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" - } + __typename: "Stock", + }, ], - __typename: "ProductVariant" + __typename: "ProductVariant", }, productName: "Lake Tunes", productSku: "lake-tunes-mp3", @@ -2305,18 +2305,18 @@ describe("Merge repeated order lines of fulfillment lines", () => { gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, unitDiscount: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, unitDiscountReason: null, unitDiscountType: null, @@ -2325,23 +2325,23 @@ describe("Merge repeated order lines of fulfillment lines", () => { gross: { amount: 9.99, currency: "USD", - __typename: "Money" + __typename: "Money", }, net: { amount: 9.99, currency: "USD", - __typename: "Money" + __typename: "Money", }, - __typename: "TaxedMoney" + __typename: "TaxedMoney", }, thumbnail: { url: "http://localhost:8000/media/__sized__/products/saleor-digital-03_2-thumbnail-255x255.png", - __typename: "Image" + __typename: "Image", }, - __typename: "OrderLine" + __typename: "OrderLine", }, - __typename: "FulfillmentLine" + __typename: "FulfillmentLine", }, { id: "RnVsZmlsbG1lbnRMaW5lOjMz", @@ -2355,11 +2355,11 @@ describe("Merge repeated order lines of fulfillment lines", () => { warehouse: { id: "V2FyZWhvdXNlOjk1NWY0ZDk2LWRmNTAtNGY0Zi1hOTM4LWM5MTYzYTA4YTViNg==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 1, - __typename: "Allocation" - } + __typename: "Allocation", + }, ], variant: { id: "UHJvZHVjdFZhcmlhbnQ6Mjg2", @@ -2372,11 +2372,11 @@ describe("Merge repeated order lines of fulfillment lines", () => { name: "warehouse_stock1", id: "V2FyZWhvdXNlOjc4OGUyMGRlLTlmYTAtNDI5My1iZDk2LWUwM2RjY2RhMzc0ZQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" + __typename: "Stock", }, { id: "stock_test_id2", @@ -2384,14 +2384,14 @@ describe("Merge repeated order lines of fulfillment lines", () => { name: "warehouse_stock2", id: "V2FyZWhvdXNlOjczYzI0OGNmLTliNzAtNDlmMi1hMDRlLTM4ZTYxMmQ5MDYwMQ==", - __typename: "Warehouse" + __typename: "Warehouse", }, quantity: 166, quantityAllocated: 0, - __typename: "Stock" - } + __typename: "Stock", + }, ], - __typename: "ProductVariant" + __typename: "ProductVariant", }, productName: "T-shirt", productSku: "29810068", @@ -2404,18 +2404,18 @@ describe("Merge repeated order lines of fulfillment lines", () => { gross: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, net: { __typename: "Money", amount: 79.71, - currency: "USD" - } + currency: "USD", + }, }, unitDiscount: { __typename: "Money", amount: 79.71, - currency: "USD" + currency: "USD", }, unitDiscountReason: null, unitDiscountType: null, @@ -2424,24 +2424,24 @@ describe("Merge repeated order lines of fulfillment lines", () => { gross: { amount: 2.5, currency: "USD", - __typename: "Money" + __typename: "Money", }, net: { amount: 2.5, currency: "USD", - __typename: "Money" + __typename: "Money", }, - __typename: "TaxedMoney" + __typename: "TaxedMoney", }, thumbnail: { url: "http://localhost:8000/media/__sized__/products/saleordemoproduct_cl_boot06_1-thumbnail-255x255.png", - __typename: "Image" + __typename: "Image", }, - __typename: "OrderLine" + __typename: "OrderLine", }, - __typename: "FulfillmentLine" - } + __typename: "FulfillmentLine", + }, ]; const mergedLines = mergeRepeatedOrderLines(lines); @@ -2449,8 +2449,8 @@ describe("Merge repeated order lines of fulfillment lines", () => { expect(mergedLines).toHaveLength(2); expect( mergedLines.find( - fulfillmentLine => fulfillmentLine.orderLine.id === "T3JkZXJMaW5lOjQ1" - ).quantity + fulfillmentLine => fulfillmentLine.orderLine.id === "T3JkZXJMaW5lOjQ1", + ).quantity, ).toBe(2); }); }); diff --git a/src/orders/utils/data.ts b/src/orders/utils/data.ts index 8c2edc3d3..c24f3ec58 100644 --- a/src/orders/utils/data.ts +++ b/src/orders/utils/data.ts @@ -12,19 +12,19 @@ import { OrderLineStockDataFragment, OrderRefundDataQuery, StockFragment, - WarehouseFragment + WarehouseFragment, } from "@saleor/graphql"; import { FormsetData } from "@saleor/hooks/useFormset"; import { findInEnum } from "@saleor/misc"; import { LineItemData, - OrderReturnFormData + OrderReturnFormData, } from "../components/OrderReturnPage/form"; import { getAllOrderFulfilledLines, getAllOrderWaitingLines, - getById + getById, } from "../components/OrderReturnPage/utils"; export type OrderWithTotalAndTotalCaptured = Pick< @@ -52,14 +52,14 @@ export function getWarehousesFromOrderLines< warehouses.some(getById(stock.warehouse.id)) ? warehouses : [...warehouses, stock.warehouse], - warehouses + warehouses, ), - [] as WarehouseFragment[] + [] as WarehouseFragment[], ); } export function getPreviouslyRefundedPrice( - order: OrderWithTotalAndTotalCaptured + order: OrderWithTotalAndTotalCaptured, ): IMoney { return ( order?.totalCaptured && @@ -71,7 +71,7 @@ export function getPreviouslyRefundedPrice( const getItemPriceAndQuantity = ({ orderLines, itemsQuantities, - id + id, }: { orderLines: OrderLineFragment[]; itemsQuantities: FormsetData; @@ -96,29 +96,29 @@ const selectItemPriceAndQuantity = ( { fulfilledItemsQuantities, waitingItemsQuantities, - unfulfilledItemsQuantities + unfulfilledItemsQuantities, }: Partial, id: string, - isFulfillment: boolean + isFulfillment: boolean, ) => { const fulfillment = getFulfillmentByFulfillmentLineId(order, id); if (fulfillment?.status === FulfillmentStatus.WAITING_FOR_APPROVAL) { return getItemPriceAndQuantity({ id, itemsQuantities: waitingItemsQuantities, - orderLines: getAllOrderWaitingLines(order) + orderLines: getAllOrderWaitingLines(order), }); } return isFulfillment ? getItemPriceAndQuantity({ id, itemsQuantities: fulfilledItemsQuantities, - orderLines: getAllOrderFulfilledLines(order) + orderLines: getAllOrderFulfilledLines(order), }) : getItemPriceAndQuantity({ id, itemsQuantities: unfulfilledItemsQuantities, - orderLines: order.lines + orderLines: order.lines, }); }; @@ -128,8 +128,8 @@ export const getReplacedProductsAmount = ( itemsToBeReplaced, unfulfilledItemsQuantities, waitingItemsQuantities, - fulfilledItemsQuantities - }: Partial + fulfilledItemsQuantities, + }: Partial, ) => { if (!order || !itemsToBeReplaced.length) { return 0; @@ -138,7 +138,7 @@ export const getReplacedProductsAmount = ( return itemsToBeReplaced.reduce( ( resultAmount: number, - { id, value: isItemToBeReplaced, data: { isFulfillment, isRefunded } } + { id, value: isItemToBeReplaced, data: { isFulfillment, isRefunded } }, ) => { if (!isItemToBeReplaced || isRefunded) { return resultAmount; @@ -149,15 +149,15 @@ export const getReplacedProductsAmount = ( { fulfilledItemsQuantities, waitingItemsQuantities, - unfulfilledItemsQuantities + unfulfilledItemsQuantities, }, id, - isFulfillment + isFulfillment, ); return resultAmount + unitPrice?.gross?.amount * selectedQuantity; }, - 0 + 0, ); }; @@ -167,8 +167,8 @@ export const getReturnSelectedProductsAmount = ( itemsToBeReplaced, waitingItemsQuantities, unfulfilledItemsQuantities, - fulfilledItemsQuantities - } + fulfilledItemsQuantities, + }, ) => { if (!order) { return 0; @@ -177,19 +177,19 @@ export const getReturnSelectedProductsAmount = ( const unfulfilledItemsValue = getPartialProductsValue({ itemsQuantities: unfulfilledItemsQuantities, itemsToBeReplaced, - orderLines: order.lines + orderLines: order.lines, }); const fulfiledItemsValue = getPartialProductsValue({ itemsQuantities: fulfilledItemsQuantities, itemsToBeReplaced, - orderLines: getAllOrderFulfilledLines(order) + orderLines: getAllOrderFulfilledLines(order), }); const waitingItemsValue = getPartialProductsValue({ itemsQuantities: waitingItemsQuantities, itemsToBeReplaced, - orderLines: getAllOrderWaitingLines(order) + orderLines: getAllOrderWaitingLines(order), }); return unfulfilledItemsValue + fulfiledItemsValue + waitingItemsValue; @@ -198,7 +198,7 @@ export const getReturnSelectedProductsAmount = ( const getPartialProductsValue = ({ orderLines, itemsQuantities, - itemsToBeReplaced + itemsToBeReplaced, }: { itemsToBeReplaced: FormsetData; itemsQuantities: FormsetData; @@ -215,21 +215,21 @@ const getPartialProductsValue = ({ const { selectedQuantity, unitPrice } = getItemPriceAndQuantity({ id, itemsQuantities, - orderLines + orderLines, }); return resultAmount + unitPrice.gross.amount * selectedQuantity; }, - 0 + 0, ); export function getRefundedLinesPriceSum( lines: OrderRefundDataQuery["order"]["lines"], - refundedProductQuantities: FormsetData + refundedProductQuantities: FormsetData, ): number { return lines?.reduce((sum, line) => { const refundedLine = refundedProductQuantities.find( - refundedLine => refundedLine.id === line.id + refundedLine => refundedLine.id === line.id, ); return sum + line.unitPrice.gross.amount * Number(refundedLine?.value || 0); }, 0); @@ -237,12 +237,12 @@ export function getRefundedLinesPriceSum( export function getAllFulfillmentLinesPriceSum( fulfillments: OrderRefundDataQuery["order"]["fulfillments"], - refundedFulfilledProductQuantities: FormsetData + refundedFulfilledProductQuantities: FormsetData, ): number { return fulfillments?.reduce((sum, fulfillment) => { const fulfilmentLinesSum = fulfillment?.lines.reduce((sum, line) => { const refundedLine = refundedFulfilledProductQuantities.find( - refundedLine => refundedLine.id === line.id + refundedLine => refundedLine.id === line.id, ); return ( sum + @@ -254,11 +254,11 @@ export function getAllFulfillmentLinesPriceSum( } export function mergeRepeatedOrderLines( - fulfillmentLines: OrderDetailsFragment["fulfillments"][0]["lines"] + fulfillmentLines: OrderDetailsFragment["fulfillments"][0]["lines"], ) { return fulfillmentLines.reduce((prev, curr) => { const existingOrderLineIndex = prev.findIndex( - prevLine => prevLine.orderLine.id === curr.orderLine.id + prevLine => prevLine.orderLine.id === curr.orderLine.id, ); if (existingOrderLineIndex === -1) { @@ -268,7 +268,7 @@ export function mergeRepeatedOrderLines( prev[existingOrderLineIndex] = { ...existingOrderLine, - quantity: existingOrderLine.quantity + curr.quantity + quantity: existingOrderLine.quantity + curr.quantity, }; } @@ -277,17 +277,17 @@ export function mergeRepeatedOrderLines( } export function addressToAddressInput( - address: T & AddressFragment + address: T & AddressFragment, ): AddressInput { const { id, __typename, ...rest } = address; return { ...rest, - country: findInEnum(address.country.code, CountryCode) + country: findInEnum(address.country.code, CountryCode), }; } export const getVariantSearchAddress = ( - order: OrderDetailsFragment + order: OrderDetailsFragment, ): AddressInput => { if (order.shippingAddress) { return addressToAddressInput(order.shippingAddress); @@ -302,24 +302,24 @@ export const getVariantSearchAddress = ( export const getAllocatedQuantityForLine = ( line: OrderLineStockDataFragment, - warehouseId: string + warehouseId: string, ) => { const warehouseAllocation = line.allocations.find( - allocation => allocation.warehouse.id === warehouseId + allocation => allocation.warehouse.id === warehouseId, ); return warehouseAllocation?.quantity || 0; }; export const getOrderLineAvailableQuantity = ( line: OrderLineStockDataFragment, - stock: StockFragment + stock: StockFragment, ) => { if (!stock) { return 0; } const allocatedQuantityForLine = getAllocatedQuantityForLine( line, - stock.warehouse.id + stock.warehouse.id, ); const availableQuantity = @@ -334,17 +334,17 @@ export type OrderFulfillStockInputFormsetData = Array< export const getFulfillmentFormsetQuantity = ( formsetData: OrderFulfillStockInputFormsetData, - line: OrderLineStockDataFragment + line: OrderLineStockDataFragment, ) => formsetData?.find(getById(line.id))?.value?.[0]?.quantity; export const getWarehouseStock = ( stocks: StockFragment[], - warehouseId: string + warehouseId: string, ) => stocks?.find(stock => stock.warehouse.id === warehouseId); export const isLineAvailableInWarehouse = ( line: OrderLineStockDataFragment, - warehouse: WarehouseFragment + warehouse: WarehouseFragment, ) => { if (!line?.variant?.stocks) { return false; @@ -358,7 +358,7 @@ export const isLineAvailableInWarehouse = ( export const transformFuflillmentLinesToStockInputFormsetData = ( lines: FulfillmentFragment["lines"], - warehouseId: string + warehouseId: string, ): OrderFulfillStockInputFormsetData => lines?.map(line => ({ data: null, @@ -366,16 +366,16 @@ export const transformFuflillmentLinesToStockInputFormsetData = ( value: [ { quantity: line.quantity, - warehouse: warehouseId - } - ] + warehouse: warehouseId, + }, + ], })); export const getAttributesCaption = ( - attributes: OrderFulfillLineFragment["variant"]["attributes"] + attributes: OrderFulfillLineFragment["variant"]["attributes"], ): string => attributes .map(attribute => - attribute.values.map(attributeValue => attributeValue.name).join(", ") + attribute.values.map(attributeValue => attributeValue.name).join(", "), ) .join(" / "); diff --git a/src/orders/views/OrderDetails/OrderDetails.tsx b/src/orders/views/OrderDetails/OrderDetails.tsx index d23c3a190..15a9ca0fa 100644 --- a/src/orders/views/OrderDetails/OrderDetails.tsx +++ b/src/orders/views/OrderDetails/OrderDetails.tsx @@ -7,7 +7,7 @@ import { useOrderConfirmMutation, useOrderDetailsQuery, useUpdateMetadataMutation, - useUpdatePrivateMetadataMutation + useUpdatePrivateMetadataMutation, } from "@saleor/graphql"; import useBackgroundTask from "@saleor/hooks/useBackgroundTask"; import useNavigator from "@saleor/hooks/useNavigator"; @@ -24,7 +24,7 @@ import { orderListUrl, orderUrl, OrderUrlDialog, - OrderUrlQueryParams + OrderUrlQueryParams, } from "../../urls"; import { OrderDetailsMessages } from "./OrderDetailsMessages"; import { OrderDraftDetails } from "./OrderDraftDetails"; @@ -44,7 +44,7 @@ export const OrderDetails: React.FC = ({ id, params }) => { const [updateMetadata, updateMetadataOpts] = useUpdateMetadataMutation({}); const [ updatePrivateMetadata, - updatePrivateMetadataOpts + updatePrivateMetadataOpts, ] = useUpdatePrivateMetadataMutation({}); const notify = useNotifier(); @@ -63,14 +63,14 @@ export const OrderDetails: React.FC = ({ id, params }) => { status: isError ? "error" : "success", text: isError ? getOrderErrorMessage(errors[0], intl) - : "Confirmed Order" + : "Confirmed Order", }); - } + }, }); const { data, loading } = useOrderDetailsQuery({ displayLoader: true, - variables: { id } + variables: { id }, }); const order = data?.order; @@ -90,7 +90,7 @@ export const OrderDetails: React.FC = ({ id, params }) => { order, () => Promise.resolve([]), variables => updateMetadata({ variables }), - variables => updatePrivateMetadata({ variables }) + variables => updatePrivateMetadata({ variables }), ); const result = await update(data); @@ -98,7 +98,7 @@ export const OrderDetails: React.FC = ({ id, params }) => { if (result.length === 0) { notify({ status: "success", - text: intl.formatMessage(commonMessages.savedChanges) + text: intl.formatMessage(commonMessages.savedChanges), }); } @@ -139,8 +139,8 @@ export const OrderDetails: React.FC = ({ id, params }) => { queue(Task.INVOICE_GENERATE, { generateInvoice: { invoiceId: data.invoiceRequest.invoice.id, - orderId: id - } + orderId: id, + }, }); } }} @@ -164,7 +164,7 @@ export const OrderDetails: React.FC = ({ id, params }) => { orderDraftFinalize, orderPaymentMarkAsPaid, orderInvoiceRequest, - orderInvoiceSend + orderInvoiceSend, }) => ( <> {!isOrderDraft && !isOrderUnconfirmed && ( diff --git a/src/orders/views/OrderDetails/OrderDetailsMessages.tsx b/src/orders/views/OrderDetails/OrderDetailsMessages.tsx index ac03ba238..5626d860c 100644 --- a/src/orders/views/OrderDetails/OrderDetailsMessages.tsx +++ b/src/orders/views/OrderDetails/OrderDetailsMessages.tsx @@ -17,7 +17,7 @@ import { OrderMarkAsPaidMutation, OrderShippingMethodUpdateMutation, OrderUpdateMutation, - OrderVoidMutation + OrderVoidMutation, } from "@saleor/graphql"; import useNavigator from "@saleor/hooks/useNavigator"; import useNotifier from "@saleor/hooks/useNotifier"; @@ -36,13 +36,13 @@ interface OrderDetailsMessages { handleNoteAdd: (data: OrderAddNoteMutation) => void; handleOrderCancel: (data: OrderCancelMutation) => void; handleOrderFulfillmentApprove: ( - data: OrderFulfillmentApproveMutation + data: OrderFulfillmentApproveMutation, ) => void; handleOrderFulfillmentCancel: ( - data: OrderFulfillmentCancelMutation + data: OrderFulfillmentCancelMutation, ) => void; handleOrderFulfillmentUpdate: ( - data: OrderFulfillmentUpdateTrackingMutation + data: OrderFulfillmentUpdateTrackingMutation, ) => void; handleOrderLinesAdd: (data: OrderLinesAddMutation) => void; handleOrderLineDelete: (data: OrderLineDeleteMutation) => void; @@ -51,7 +51,7 @@ interface OrderDetailsMessages { handleOrderVoid: (data: OrderVoidMutation) => void; handlePaymentCapture: (data: OrderCaptureMutation) => void; handleShippingMethodUpdate: ( - data: OrderShippingMethodUpdateMutation + data: OrderShippingMethodUpdateMutation, ) => void; handleUpdate: (data: OrderUpdateMutation) => void; handleInvoiceGeneratePending: (data: InvoiceRequestMutation) => void; @@ -65,7 +65,7 @@ interface OrderDetailsMessages { export const OrderDetailsMessages: React.FC = ({ children, id, - params + params, }) => { const navigate = useNavigator(); const pushMessage = useNotifier(); @@ -74,7 +74,7 @@ export const OrderDetailsMessages: React.FC = ({ const [, closeModal] = createDialogActionHandlers( navigate, params => orderUrl(id, params), - params + params, ); const handlePaymentCapture = (data: OrderCaptureMutation) => { @@ -84,8 +84,8 @@ export const OrderDetailsMessages: React.FC = ({ status: "success", text: intl.formatMessage({ id: "9RCuN3", - defaultMessage: "Payment successfully captured" - }) + defaultMessage: "Payment successfully captured", + }), }); closeModal(); } @@ -97,8 +97,8 @@ export const OrderDetailsMessages: React.FC = ({ status: "success", text: intl.formatMessage({ id: "lL1HTg", - defaultMessage: "Order marked as paid" - }) + defaultMessage: "Order marked as paid", + }), }); closeModal(); } @@ -110,8 +110,8 @@ export const OrderDetailsMessages: React.FC = ({ status: "success", text: intl.formatMessage({ id: "W/Es0H", - defaultMessage: "Order successfully cancelled" - }) + defaultMessage: "Order successfully cancelled", + }), }); closeModal(); } @@ -123,8 +123,8 @@ export const OrderDetailsMessages: React.FC = ({ status: "success", text: intl.formatMessage({ id: "W/Es0H", - defaultMessage: "Order successfully cancelled" - }) + defaultMessage: "Order successfully cancelled", + }), }); closeModal(); } @@ -136,8 +136,8 @@ export const OrderDetailsMessages: React.FC = ({ status: "success", text: intl.formatMessage({ id: "L87bp7", - defaultMessage: "Order payment successfully voided" - }) + defaultMessage: "Order payment successfully voided", + }), }); closeModal(); } @@ -149,8 +149,8 @@ export const OrderDetailsMessages: React.FC = ({ status: "success", text: intl.formatMessage({ id: "KmPicj", - defaultMessage: "Note successfully added" - }) + defaultMessage: "Note successfully added", + }), }); } }; @@ -161,8 +161,8 @@ export const OrderDetailsMessages: React.FC = ({ status: "success", text: intl.formatMessage({ id: "j2fPVo", - defaultMessage: "Order successfully updated" - }) + defaultMessage: "Order successfully updated", + }), }); closeModal(); } @@ -174,14 +174,14 @@ export const OrderDetailsMessages: React.FC = ({ status: "success", text: intl.formatMessage({ id: "j2fPVo", - defaultMessage: "Order successfully updated" - }) + defaultMessage: "Order successfully updated", + }), }); closeModal(); } }; const handleShippingMethodUpdate = ( - data: OrderShippingMethodUpdateMutation + data: OrderShippingMethodUpdateMutation, ) => { const errs = data.orderUpdateShipping?.errors; if (errs.length === 0) { @@ -189,8 +189,8 @@ export const OrderDetailsMessages: React.FC = ({ status: "success", text: intl.formatMessage({ id: "7U8GRy", - defaultMessage: "Shipping method successfully updated" - }) + defaultMessage: "Shipping method successfully updated", + }), }); closeModal(); } @@ -202,8 +202,8 @@ export const OrderDetailsMessages: React.FC = ({ status: "success", text: intl.formatMessage({ id: "9OtpHt", - defaultMessage: "Order line deleted" - }) + defaultMessage: "Order line deleted", + }), }); } }; @@ -214,8 +214,8 @@ export const OrderDetailsMessages: React.FC = ({ status: "success", text: intl.formatMessage({ id: "HlCkMT", - defaultMessage: "Order line added" - }) + defaultMessage: "Order line added", + }), }); closeModal(); } @@ -227,20 +227,20 @@ export const OrderDetailsMessages: React.FC = ({ status: "success", text: intl.formatMessage({ id: "Fn3bE0", - defaultMessage: "Order line updated" - }) + defaultMessage: "Order line updated", + }), }); } else { errs.forEach(error => pushMessage({ status: "error", - text: getOrderErrorMessage(error, intl) - }) + text: getOrderErrorMessage(error, intl), + }), ); } }; const handleOrderFulfillmentApprove = ( - data: OrderFulfillmentApproveMutation + data: OrderFulfillmentApproveMutation, ) => { const errs = data.orderFulfillmentApprove?.errors; if (errs.length === 0) { @@ -248,14 +248,14 @@ export const OrderDetailsMessages: React.FC = ({ status: "success", text: intl.formatMessage({ id: "+sX7yS", - defaultMessage: "Fulfillment successfully approved" - }) + defaultMessage: "Fulfillment successfully approved", + }), }); closeModal(); } }; const handleOrderFulfillmentCancel = ( - data: OrderFulfillmentCancelMutation + data: OrderFulfillmentCancelMutation, ) => { const errs = data.orderFulfillmentCancel?.errors; if (errs.length === 0) { @@ -263,14 +263,14 @@ export const OrderDetailsMessages: React.FC = ({ status: "success", text: intl.formatMessage({ id: "uMpv1v", - defaultMessage: "Fulfillment successfully cancelled" - }) + defaultMessage: "Fulfillment successfully cancelled", + }), }); closeModal(); } }; const handleOrderFulfillmentUpdate = ( - data: OrderFulfillmentUpdateTrackingMutation + data: OrderFulfillmentUpdateTrackingMutation, ) => { const errs = data.orderFulfillmentUpdateTracking?.errors; if (errs.length === 0) { @@ -278,8 +278,8 @@ export const OrderDetailsMessages: React.FC = ({ status: "success", text: intl.formatMessage({ id: "CZmloB", - defaultMessage: "Fulfillment successfully updated" - }) + defaultMessage: "Fulfillment successfully updated", + }), }); closeModal(); } @@ -291,8 +291,8 @@ export const OrderDetailsMessages: React.FC = ({ status: "success", text: intl.formatMessage({ id: "c4gbXr", - defaultMessage: "Draft order successfully finalized" - }) + defaultMessage: "Draft order successfully finalized", + }), }); } }; @@ -303,12 +303,12 @@ export const OrderDetailsMessages: React.FC = ({ text: intl.formatMessage({ id: "ND5x+V", defaultMessage: - "We’re generating the invoice you requested. Please wait a couple of moments" + "We’re generating the invoice you requested. Please wait a couple of moments", }), title: intl.formatMessage({ id: "PKJqcq", - defaultMessage: "Invoice is Generating" - }) + defaultMessage: "Invoice is Generating", + }), }); closeModal(); } @@ -319,7 +319,7 @@ export const OrderDetailsMessages: React.FC = ({ pushMessage({ status: "success", text: intl.formatMessage(messages.invoiceGenerateFinishedText), - title: intl.formatMessage(messages.invoiceGenerateFinishedTitle) + title: intl.formatMessage(messages.invoiceGenerateFinishedTitle), }); closeModal(); } @@ -330,8 +330,8 @@ export const OrderDetailsMessages: React.FC = ({ pushMessage({ text: intl.formatMessage({ id: "3u+4NZ", - defaultMessage: "Invoice email sent" - }) + defaultMessage: "Invoice email sent", + }), }); closeModal(); } @@ -356,6 +356,6 @@ export const OrderDetailsMessages: React.FC = ({ handleOrderVoid, handlePaymentCapture, handleShippingMethodUpdate, - handleUpdate + handleUpdate, }); }; diff --git a/src/orders/views/OrderDetails/OrderDraftDetails/index.tsx b/src/orders/views/OrderDetails/OrderDraftDetails/index.tsx index 20acf460f..9b9c813a3 100644 --- a/src/orders/views/OrderDetails/OrderDraftDetails/index.tsx +++ b/src/orders/views/OrderDetails/OrderDraftDetails/index.tsx @@ -7,14 +7,14 @@ import { OrderDraftUpdateMutation, OrderDraftUpdateMutationVariables, StockAvailability, - useCustomerAddressesQuery + useCustomerAddressesQuery, } from "@saleor/graphql"; import useNavigator from "@saleor/hooks/useNavigator"; import { CustomerEditData } from "@saleor/orders/components/OrderCustomer"; import { OrderCustomerAddressesEditDialogOutput } from "@saleor/orders/components/OrderCustomerAddressesEditDialog/types"; import { CustomerChangeActionEnum, - OrderCustomerChangeData + OrderCustomerChangeData, } from "@saleor/orders/components/OrderCustomerChangeDialog/form"; import OrderCustomerChangeDialog from "@saleor/orders/components/OrderCustomerChangeDialog/OrderCustomerChangeDialog"; import { getVariantSearchAddress } from "@saleor/orders/utils/data"; @@ -30,7 +30,7 @@ import { useIntl } from "react-intl"; import { customerUrl } from "../../../../customers/urls"; import { extractMutationErrors, - getStringOrPlaceholder + getStringOrPlaceholder, } from "../../../../misc"; import { productUrl } from "../../../../products/urls"; import OrderAddressFields from "../../../components/OrderAddressFields/OrderAddressFields"; @@ -41,7 +41,7 @@ import OrderShippingMethodEditDialog from "../../../components/OrderShippingMeth import { orderDraftListUrl, OrderUrlDialog, - OrderUrlQueryParams + OrderUrlQueryParams, } from "../../../urls"; interface OrderDraftDetailsProps { @@ -71,7 +71,7 @@ export const isAnyAddressEditModalOpen = (uri: string | undefined): boolean => [ "edit-customer-addresses", "edit-shipping-address", - "edit-billing-address" + "edit-billing-address", ].includes(uri); export const OrderDraftDetails: React.FC = ({ @@ -88,7 +88,7 @@ export const OrderDraftDetails: React.FC = ({ orderDraftCancel, orderDraftFinalize, openModal, - closeModal + closeModal, }) => { const order = data.order; const navigate = useNavigator(); @@ -96,33 +96,33 @@ export const OrderDraftDetails: React.FC = ({ const { loadMore, search: variantSearch, - result: variantSearchOpts + result: variantSearchOpts, } = useOrderVariantSearch({ variables: { ...DEFAULT_INITIAL_SEARCH_DATA, channel: order.channel.slug, address: getVariantSearchAddress(order), isPublished: true, - stockAvailability: StockAvailability.IN_STOCK - } + stockAvailability: StockAvailability.IN_STOCK, + }, }); const { loadMore: loadMoreCustomers, search: searchUsers, - result: users + result: users, } = useCustomerSearch({ - variables: DEFAULT_INITIAL_SEARCH_DATA + variables: DEFAULT_INITIAL_SEARCH_DATA, }); const { data: customerAddresses, - loading: customerAddressesLoading + loading: customerAddressesLoading, } = useCustomerAddressesQuery({ variables: { - id: order?.user?.id + id: order?.user?.id, }, - skip: !order?.user?.id || !isAnyAddressEditModalOpen(params.action) + skip: !order?.user?.id || !isAnyAddressEditModalOpen(params.action), }); const intl = useIntl(); @@ -131,7 +131,7 @@ export const OrderDraftDetails: React.FC = ({ user, userEmail, prevUser, - prevUserEmail + prevUserEmail, }: CustomerEditData) => { const sameUser = user && user === prevUser; const sameUserEmail = userEmail && userEmail === prevUserEmail; @@ -143,8 +143,8 @@ export const OrderDraftDetails: React.FC = ({ id, input: { user, - userEmail - } + userEmail, + }, }); if (result?.data?.draftOrderUpdate?.errors?.length) { @@ -164,11 +164,11 @@ export const OrderDraftDetails: React.FC = ({ }; const handleCustomerChangeAddresses = async ( - data: Partial + data: Partial, ): Promise => orderDraftUpdate.mutate({ id, - input: data + input: data, }); const handleOrderDraftCancel = async () => { @@ -186,11 +186,11 @@ export const OrderDraftDetails: React.FC = ({ { id: "TLNf6K", defaultMessage: "Draft Order #{orderNumber}", - description: "window title" + description: "window title", }, { - orderNumber: getStringOrPlaceholder(data?.order?.number) - } + orderNumber: getStringOrPlaceholder(data?.order?.number), + }, )} /> @@ -202,8 +202,8 @@ export const OrderDraftDetails: React.FC = ({ extractMutationErrors( orderAddNote.mutate({ input: variables, - order: id - }) + order: id, + }), ) } users={mapEdgesToItems(users?.data?.search)} @@ -226,7 +226,7 @@ export const OrderDraftDetails: React.FC = ({ onOrderLineChange={(id, data) => orderLineUpdate.mutate({ id, - input: data + input: data, }) } saveButtonBarState="default" @@ -255,8 +255,8 @@ export const OrderDraftDetails: React.FC = ({ orderShippingMethodUpdate.mutate({ id, input: { - shippingMethod: variables.shippingMethod - } + shippingMethod: variables.shippingMethod, + }, }) } /> @@ -277,9 +277,9 @@ export const OrderDraftDetails: React.FC = ({ id, input: variants.map(variant => ({ quantity: 1, - variantId: variant.id - })) - }) + variantId: variant.id, + })), + }), ) } /> diff --git a/src/orders/views/OrderDetails/OrderNormalDetails/index.tsx b/src/orders/views/OrderDetails/OrderNormalDetails/index.tsx index 5695f8720..668183db2 100644 --- a/src/orders/views/OrderDetails/OrderNormalDetails/index.tsx +++ b/src/orders/views/OrderDetails/OrderNormalDetails/index.tsx @@ -9,7 +9,7 @@ import { OrderUpdateMutationVariables, useCustomerAddressesQuery, useWarehouseListQuery, - WarehouseFragment + WarehouseFragment, } from "@saleor/graphql"; import useNavigator from "@saleor/hooks/useNavigator"; import OrderCannotCancelOrderDialog from "@saleor/orders/components/OrderCannotCancelOrderDialog"; @@ -29,7 +29,7 @@ import { customerUrl } from "../../../../customers/urls"; import { extractMutationErrors, getMutationState, - getStringOrPlaceholder + getStringOrPlaceholder, } from "../../../../misc"; import { productUrl } from "../../../../products/urls"; import OrderAddressFields from "../../../components/OrderAddressFields/OrderAddressFields"; @@ -45,7 +45,7 @@ import { orderRefundUrl, orderReturnUrl, orderUrl, - OrderUrlQueryParams + OrderUrlQueryParams, } from "../../../urls"; import { isAnyAddressEditModalOpen } from "../OrderDraftDetails"; import { useDefaultWarehouse } from "./useDefaultWarehouse"; @@ -101,7 +101,7 @@ export const OrderNormalDetails: React.FC = ({ updateMetadataOpts, updatePrivateMetadataOpts, openModal, - closeModal + closeModal, }) => { const order = data?.order; const shop = data?.shop; @@ -109,12 +109,12 @@ export const OrderNormalDetails: React.FC = ({ const { data: warehousesData, - loading: warehousesLoading + loading: warehousesLoading, } = useWarehouseListQuery({ displayLoader: true, variables: { - first: 30 - } + first: 30, + }, }); const warehouses = mapEdgesToItems(warehousesData?.warehouses); @@ -125,24 +125,24 @@ export const OrderNormalDetails: React.FC = ({ useDefaultWarehouse({ warehouses, order, setter: setFulfillmentWarehouse }, [ warehousesData, - warehousesLoading + warehousesLoading, ]); const { data: customerAddresses, - loading: customerAddressesLoading + loading: customerAddressesLoading, } = useCustomerAddressesQuery({ variables: { - id: order?.user?.id + id: order?.user?.id, }, - skip: !order?.user?.id || !isAnyAddressEditModalOpen(params.action) + skip: !order?.user?.id || !isAnyAddressEditModalOpen(params.action), }); const handleCustomerChangeAddresses = async ( - data: Partial + data: Partial, ): Promise => orderUpdate.mutate({ id, - input: data + input: data, }); const intl = useIntl(); @@ -150,7 +150,7 @@ export const OrderNormalDetails: React.FC = ({ const [ currentApproval, - setCurrentApproval + setCurrentApproval, ] = React.useState(null); const [stockExceeded, setStockExceeded] = React.useState(false); const approvalErrors = @@ -171,11 +171,11 @@ export const OrderNormalDetails: React.FC = ({ { id: "GbBCmr", defaultMessage: "Order #{orderNumber}", - description: "window title" + description: "window title", }, { - orderNumber: getStringOrPlaceholder(data?.order?.number) - } + orderNumber: getStringOrPlaceholder(data?.order?.number), + }, )} /> = ({ extractMutationErrors( orderAddNote.mutate({ input: variables, - order: id - }) + order: id, + }), ) } order={order} @@ -202,8 +202,8 @@ export const OrderNormalDetails: React.FC = ({ ...(updatePrivateMetadataOpts.data?.deletePrivateMetadata.errors || []), ...(updatePrivateMetadataOpts.data?.updatePrivateMetadata.errors || - []) - ] + []), + ], )} shippingMethods={data?.order?.shippingMethods || []} selectedWarehouse={fulfillmentWarehouse} @@ -215,24 +215,24 @@ export const OrderNormalDetails: React.FC = ({ navigate( orderUrl(id, { action: "approve-fulfillment", - id: fulfillmentId - }) + id: fulfillmentId, + }), ) } onFulfillmentCancel={fulfillmentId => navigate( orderUrl(id, { action: "cancel-fulfillment", - id: fulfillmentId - }) + id: fulfillmentId, + }), ) } onFulfillmentTrackingNumberUpdate={fulfillmentId => navigate( orderUrl(id, { action: "edit-fulfillment", - id: fulfillmentId - }) + id: fulfillmentId, + }), ) } onPaymentCapture={() => openModal("capture")} @@ -246,12 +246,12 @@ export const OrderNormalDetails: React.FC = ({ onInvoiceClick={id => window.open( order.invoices.find(invoice => invoice.id === id)?.url, - "_blank" + "_blank", ) } onInvoiceGenerate={() => orderInvoiceRequest.mutate({ - orderId: id + orderId: id, }) } onInvoiceSend={id => openModal("invoice-send", { id })} @@ -263,7 +263,7 @@ export const OrderNormalDetails: React.FC = ({ open={ params.action === "cancel" && order?.fulfillments.some( - fulfillment => fulfillment.status === FulfillmentStatus.FULFILLED + fulfillment => fulfillment.status === FulfillmentStatus.FULFILLED, ) } /> @@ -275,7 +275,7 @@ export const OrderNormalDetails: React.FC = ({ onClose={closeModal} onSubmit={() => orderCancel.mutate({ - id + id, }) } /> @@ -286,7 +286,7 @@ export const OrderNormalDetails: React.FC = ({ onConfirm={() => orderPaymentMarkAsPaid.mutate({ id, - transactionReference + transactionReference, }) } open={params.action === "mark-paid"} @@ -311,7 +311,7 @@ export const OrderNormalDetails: React.FC = ({ onSubmit={variables => orderPaymentCapture.mutate({ ...variables, - id + id, }) } /> @@ -325,11 +325,11 @@ export const OrderNormalDetails: React.FC = ({ onConfirm={({ notifyCustomer }) => { setCurrentApproval({ fulfillment: order?.fulfillments.find(getById(params.id)), - notifyCustomer + notifyCustomer, }); return orderFulfillmentApprove.mutate({ id: params.id, - notifyCustomer + notifyCustomer, }); }} onClose={closeModal} @@ -338,7 +338,7 @@ export const OrderNormalDetails: React.FC = ({ lines={currentApproval?.fulfillment.lines} formsetData={transformFuflillmentLinesToStockInputFormsetData( currentApproval?.fulfillment.lines, - currentApproval?.fulfillment.warehouse?.id + currentApproval?.fulfillment.warehouse?.id, )} open={stockExceeded} warehouseId={currentApproval?.fulfillment.warehouse?.id} @@ -349,7 +349,7 @@ export const OrderNormalDetails: React.FC = ({ return orderFulfillmentApprove.mutate({ id: params.id, notifyCustomer: currentApproval?.notifyCustomer, - allowStockToBeExceeded: true + allowStockToBeExceeded: true, }); }} /> @@ -363,7 +363,7 @@ export const OrderNormalDetails: React.FC = ({ onConfirm={variables => orderFulfillmentCancel.mutate({ id: params.id, - input: variables + input: variables, }) } onClose={closeModal} @@ -377,7 +377,7 @@ export const OrderNormalDetails: React.FC = ({ open={params.action === "edit-fulfillment"} trackingNumber={ data?.order?.fulfillments.find( - fulfillment => fulfillment.id === params.id + fulfillment => fulfillment.id === params.id, )?.trackingNumber } onConfirm={variables => @@ -385,8 +385,8 @@ export const OrderNormalDetails: React.FC = ({ id: params.id, input: { ...variables, - notifyCustomer: true - } + notifyCustomer: true, + }, }) } onClose={closeModal} diff --git a/src/orders/views/OrderDetails/OrderNormalDetails/useDefaultWarehouse.ts b/src/orders/views/OrderDetails/OrderNormalDetails/useDefaultWarehouse.ts index 2c2df8d11..54255b411 100644 --- a/src/orders/views/OrderDetails/OrderNormalDetails/useDefaultWarehouse.ts +++ b/src/orders/views/OrderDetails/OrderNormalDetails/useDefaultWarehouse.ts @@ -1,7 +1,7 @@ import { OrderDetailsFragment, WarehouseFragment } from "@saleor/graphql"; import { getToFulfillOrderLines, - isLineAvailableInWarehouse + isLineAvailableInWarehouse, } from "@saleor/orders/utils/data"; import React from "react"; @@ -18,7 +18,7 @@ interface WarehousesAvailibility { export function useDefaultWarehouse( { warehouses, order, setter }: UseDefaultWarehouseOpts, - deps: unknown[] + deps: unknown[], ) { React.useEffect(() => { const warehousesAvailability: WarehousesAvailibility[] = warehouses?.map( @@ -29,18 +29,18 @@ export function useDefaultWarehouse( const linesToFulfill = getToFulfillOrderLines(order.lines); const linesAvailable = linesToFulfill.filter(line => - isLineAvailableInWarehouse(line, warehouse) + isLineAvailableInWarehouse(line, warehouse), ).length; return { warehouse, - linesAvailable + linesAvailable, }; - } + }, ); const defaultWarehouse = order?.lines ? warehousesAvailability?.reduce((prev, curr) => - curr.linesAvailable > prev.linesAvailable ? curr : prev + curr.linesAvailable > prev.linesAvailable ? curr : prev, ).warehouse : undefined; setter(defaultWarehouse); diff --git a/src/orders/views/OrderDetails/OrderUnconfirmedDetails/index.tsx b/src/orders/views/OrderDetails/OrderUnconfirmedDetails/index.tsx index 4e5804e8e..7d7a651a5 100644 --- a/src/orders/views/OrderDetails/OrderUnconfirmedDetails/index.tsx +++ b/src/orders/views/OrderDetails/OrderUnconfirmedDetails/index.tsx @@ -7,7 +7,7 @@ import { OrderUpdateMutation, OrderUpdateMutationVariables, useCustomerAddressesQuery, - useWarehouseListQuery + useWarehouseListQuery, } from "@saleor/graphql"; import useNavigator from "@saleor/hooks/useNavigator"; import OrderCannotCancelOrderDialog from "@saleor/orders/components/OrderCannotCancelOrderDialog"; @@ -26,7 +26,7 @@ import { customerUrl } from "../../../../customers/urls"; import { extractMutationErrors, getMutationState, - getStringOrPlaceholder + getStringOrPlaceholder, } from "../../../../misc"; import { productUrl } from "../../../../products/urls"; import OrderAddressFields from "../../../components/OrderAddressFields/OrderAddressFields"; @@ -44,7 +44,7 @@ import { orderRefundUrl, orderReturnUrl, orderUrl, - OrderUrlQueryParams + OrderUrlQueryParams, } from "../../../urls"; import { isAnyAddressEditModalOpen } from "../OrderDraftDetails"; @@ -103,7 +103,7 @@ export const OrderUnconfirmedDetails: React.FC = ( updateMetadataOpts, updatePrivateMetadataOpts, openModal, - closeModal + closeModal, }) => { const order = data.order; const shop = data.shop; @@ -112,36 +112,36 @@ export const OrderUnconfirmedDetails: React.FC = ( const { loadMore, search: variantSearch, - result: variantSearchOpts + result: variantSearchOpts, } = useOrderVariantSearch({ variables: { ...DEFAULT_INITIAL_SEARCH_DATA, - channel: order.channel.slug - } + channel: order.channel.slug, + }, }); const warehouses = useWarehouseListQuery({ displayLoader: true, variables: { - first: 30 - } + first: 30, + }, }); const { data: customerAddresses, - loading: customerAddressesLoading + loading: customerAddressesLoading, } = useCustomerAddressesQuery({ variables: { - id: order?.user?.id + id: order?.user?.id, }, - skip: !order?.user?.id || !isAnyAddressEditModalOpen(params.action) + skip: !order?.user?.id || !isAnyAddressEditModalOpen(params.action), }); const handleCustomerChangeAddresses = async ( - data: Partial + data: Partial, ): Promise => orderUpdate.mutate({ id, - input: data + input: data, }); const intl = useIntl(); @@ -154,11 +154,11 @@ export const OrderUnconfirmedDetails: React.FC = ( { id: "GbBCmr", defaultMessage: "Order #{orderNumber}", - description: "window title" + description: "window title", }, { - orderNumber: getStringOrPlaceholder(order.number) - } + orderNumber: getStringOrPlaceholder(order.number), + }, )} /> @@ -172,8 +172,8 @@ export const OrderUnconfirmedDetails: React.FC = ( extractMutationErrors( orderAddNote.mutate({ input: variables, - order: id - }) + order: id, + }), ) } order={order} @@ -182,7 +182,7 @@ export const OrderUnconfirmedDetails: React.FC = ( onOrderLineChange={(id, data) => orderLineUpdate.mutate({ id, - input: data + input: data, }) } onOrderLineRemove={id => orderLineDelete.mutate({ id })} @@ -196,8 +196,8 @@ export const OrderUnconfirmedDetails: React.FC = ( ...(updatePrivateMetadataOpts.data?.deletePrivateMetadata .errors || []), ...(updatePrivateMetadataOpts.data?.updatePrivateMetadata - .errors || []) - ] + .errors || []), + ], )} shippingMethods={data?.order?.shippingMethods || []} onOrderCancel={() => openModal("cancel")} @@ -206,24 +206,24 @@ export const OrderUnconfirmedDetails: React.FC = ( navigate( orderUrl(id, { action: "approve-fulfillment", - id: fulfillmentId - }) + id: fulfillmentId, + }), ) } onFulfillmentCancel={fulfillmentId => navigate( orderUrl(id, { action: "cancel-fulfillment", - id: fulfillmentId - }) + id: fulfillmentId, + }), ) } onFulfillmentTrackingNumberUpdate={fulfillmentId => navigate( orderUrl(id, { action: "edit-fulfillment", - id: fulfillmentId - }) + id: fulfillmentId, + }), ) } onPaymentCapture={() => openModal("capture")} @@ -237,12 +237,12 @@ export const OrderUnconfirmedDetails: React.FC = ( onInvoiceClick={id => window.open( order.invoices.find(invoice => invoice.id === id)?.url, - "_blank" + "_blank", ) } onInvoiceGenerate={() => orderInvoiceRequest.mutate({ - orderId: id + orderId: id, }) } onInvoiceSend={id => openModal("invoice-send", { id })} @@ -255,7 +255,7 @@ export const OrderUnconfirmedDetails: React.FC = ( open={ params.action === "cancel" && order?.fulfillments.some( - fulfillment => fulfillment.status === FulfillmentStatus.FULFILLED + fulfillment => fulfillment.status === FulfillmentStatus.FULFILLED, ) } /> @@ -267,7 +267,7 @@ export const OrderUnconfirmedDetails: React.FC = ( onClose={closeModal} onSubmit={() => orderCancel.mutate({ - id + id, }) } /> @@ -285,9 +285,9 @@ export const OrderUnconfirmedDetails: React.FC = ( orderShippingMethodUpdate.mutate({ id, input: { - shippingMethod: variables.shippingMethod - } - }) + shippingMethod: variables.shippingMethod, + }, + }), ) } /> @@ -307,8 +307,8 @@ export const OrderUnconfirmedDetails: React.FC = ( id, input: variants.map(variant => ({ quantity: 1, - variantId: variant.id - })) + variantId: variant.id, + })), }) } /> @@ -319,7 +319,7 @@ export const OrderUnconfirmedDetails: React.FC = ( onConfirm={() => orderPaymentMarkAsPaid.mutate({ id, - transactionReference + transactionReference, }) } open={params.action === "mark-paid"} @@ -344,7 +344,7 @@ export const OrderUnconfirmedDetails: React.FC = ( onSubmit={variables => orderPaymentCapture.mutate({ ...variables, - id + id, }) } /> @@ -358,7 +358,7 @@ export const OrderUnconfirmedDetails: React.FC = ( onConfirm={({ notifyCustomer }) => orderFulfillmentApprove.mutate({ id: params.id, - notifyCustomer + notifyCustomer, }) } onClose={closeModal} @@ -373,7 +373,7 @@ export const OrderUnconfirmedDetails: React.FC = ( onConfirm={variables => orderFulfillmentCancel.mutate({ id: params.id, - input: variables + input: variables, }) } onClose={closeModal} @@ -387,7 +387,7 @@ export const OrderUnconfirmedDetails: React.FC = ( open={params.action === "edit-fulfillment"} trackingNumber={ data?.order?.fulfillments.find( - fulfillment => fulfillment.id === params.id + fulfillment => fulfillment.id === params.id, )?.trackingNumber } onConfirm={variables => @@ -395,8 +395,8 @@ export const OrderUnconfirmedDetails: React.FC = ( id: params.id, input: { ...variables, - notifyCustomer: true - } + notifyCustomer: true, + }, }) } onClose={closeModal} diff --git a/src/orders/views/OrderDraftList/OrderDraftList.tsx b/src/orders/views/OrderDraftList/OrderDraftList.tsx index eefb70d62..81fdbb9f0 100644 --- a/src/orders/views/OrderDraftList/OrderDraftList.tsx +++ b/src/orders/views/OrderDraftList/OrderDraftList.tsx @@ -4,13 +4,13 @@ import ActionDialog from "@saleor/components/ActionDialog"; import useAppChannel from "@saleor/components/AppLayout/AppChannelContext"; import DeleteFilterTabDialog from "@saleor/components/DeleteFilterTabDialog"; import SaveFilterTabDialog, { - SaveFilterTabDialogFormData + SaveFilterTabDialogFormData, } from "@saleor/components/SaveFilterTabDialog"; import { useShopLimitsQuery } from "@saleor/components/Shop/queries"; import { useOrderDraftBulkCancelMutation, useOrderDraftCreateMutation, - useOrderDraftListQuery + useOrderDraftListQuery, } from "@saleor/graphql"; import useBulkActions from "@saleor/hooks/useBulkActions"; import useListSettings from "@saleor/hooks/useListSettings"; @@ -19,7 +19,7 @@ import useNotifier from "@saleor/hooks/useNotifier"; import { usePaginationReset } from "@saleor/hooks/usePaginationReset"; import usePaginator, { createPaginationState, - PaginatorContext + PaginatorContext, } from "@saleor/hooks/usePaginator"; import { DeleteIcon, IconButton } from "@saleor/macaw-ui"; import { maybe } from "@saleor/misc"; @@ -37,7 +37,7 @@ import { orderDraftListUrl, OrderDraftListUrlDialog, OrderDraftListUrlQueryParams, - orderUrl + orderUrl, } from "../../urls"; import { deleteFilterTab, @@ -47,7 +47,7 @@ import { getFiltersCurrentTab, getFilterTabs, getFilterVariables, - saveFilterTab + saveFilterTab, } from "./filters"; import { getSortQueryVariables } from "./sort"; @@ -59,10 +59,10 @@ export const OrderDraftList: React.FC = ({ params }) => { const navigate = useNavigator(); const notify = useNotifier(); const { isSelected, listElements, reset, toggle, toggleAll } = useBulkActions( - params.ids + params.ids, ); const { updateListSettings, settings } = useListSettings( - ListViews.DRAFT_LIST + ListViews.DRAFT_LIST, ); usePaginationReset(orderDraftListUrl, params, settings.rowNumber); @@ -71,7 +71,7 @@ export const OrderDraftList: React.FC = ({ params }) => { const [ orderDraftBulkDelete, - orderDraftBulkDeleteOpts + orderDraftBulkDeleteOpts, ] = useOrderDraftBulkCancelMutation({ onCompleted: data => { if (data.draftOrderBulkDelete.errors.length === 0) { @@ -79,14 +79,14 @@ export const OrderDraftList: React.FC = ({ params }) => { status: "success", text: intl.formatMessage({ id: "ra2O4j", - defaultMessage: "Deleted draft orders" - }) + defaultMessage: "Deleted draft orders", + }), }); refetch(); reset(); closeModal(); } - } + }, }); const [createOrder] = useOrderDraftCreateMutation({ @@ -95,18 +95,18 @@ export const OrderDraftList: React.FC = ({ params }) => { status: "success", text: intl.formatMessage({ id: "6udlH+", - defaultMessage: "Order draft successfully created" - }) + defaultMessage: "Order draft successfully created", + }), }); navigate(orderUrl(data.draftOrderCreate.order.id)); - } + }, }); const { channel, availableChannels } = useAppChannel(false); const limitOpts = useShopLimitsQuery({ variables: { - orders: true - } + orders: true, + }, }); const tabs = getFilterTabs(); @@ -116,13 +116,13 @@ export const OrderDraftList: React.FC = ({ params }) => { const [ changeFilters, resetFilters, - handleSearchChange + handleSearchChange, ] = createFilterHandlers({ cleanupFn: reset, createUrl: orderDraftListUrl, getFilterQueryParam, navigate, - params + params, }); const [openModal, closeModal] = createDialogActionHandlers< @@ -135,8 +135,8 @@ export const OrderDraftList: React.FC = ({ params }) => { navigate( orderDraftListUrl({ activeTab: tab.toString(), - ...getFilterTabs()[tab - 1].data - }) + ...getFilterTabs()[tab - 1].data, + }), ); }; @@ -156,19 +156,19 @@ export const OrderDraftList: React.FC = ({ params }) => { () => ({ ...paginationState, filter: getFilterVariables(params), - sort: getSortQueryVariables(params) + sort: getSortQueryVariables(params), }), - [params, settings.rowNumber] + [params, settings.rowNumber], ); const { data, loading, refetch } = useOrderDraftListQuery({ displayLoader: true, - variables: queryVariables + variables: queryVariables, }); const paginationValues = usePaginator({ pageInfo: maybe(() => data.draftOrders.pageInfo), paginationState, - queryString: params + queryString: params, }); const handleSort = createSortHandler(navigate, orderDraftListUrl, params); @@ -176,8 +176,8 @@ export const OrderDraftList: React.FC = ({ params }) => { const onOrderDraftBulkDelete = () => orderDraftBulkDelete({ variables: { - ids: params.ids - } + ids: params.ids, + }, }); return ( @@ -211,7 +211,7 @@ export const OrderDraftList: React.FC = ({ params }) => { color="primary" onClick={() => openModal("remove", { - ids: listElements + ids: listElements, }) } > @@ -227,7 +227,7 @@ export const OrderDraftList: React.FC = ({ params }) => { title={intl.formatMessage({ id: "qbmeUI", defaultMessage: "Delete Order Drafts", - description: "dialog header" + description: "dialog header", })} variant="delete" > @@ -238,7 +238,9 @@ export const OrderDraftList: React.FC = ({ params }) => { description="dialog content" values={{ counter: maybe(() => params.ids.length), - displayQuantity: {maybe(() => params.ids.length)} + displayQuantity: ( + {maybe(() => params.ids.length)} + ), }} /> @@ -265,8 +267,8 @@ export const OrderDraftList: React.FC = ({ params }) => { onConfirm={channelId => createOrder({ variables: { - input: { channelId } - } + input: { channelId }, + }, }) } /> diff --git a/src/orders/views/OrderDraftList/filters.test.ts b/src/orders/views/OrderDraftList/filters.test.ts index 227edf2b8..0b8d2681b 100644 --- a/src/orders/views/OrderDraftList/filters.test.ts +++ b/src/orders/views/OrderDraftList/filters.test.ts @@ -21,7 +21,7 @@ describe("Filtering query params", () => { const params: OrderDraftListUrlFilters = { createdFrom: date.from, createdTo: date.to, - customer: "admin@example.com" + customer: "admin@example.com", }; const filterVariables = getFilterVariables(params); @@ -37,19 +37,19 @@ describe("Filtering URL params", () => { active: false, value: { max: date.to, - min: date.from - } + min: date.from, + }, }, customer: { active: false, - value: "admin@example.com" - } + value: "admin@example.com", + }, }); it("should be empty if no active filters", () => { const filterQueryParams = getFilterQueryParams( filters, - getFilterQueryParam + getFilterQueryParam, ); expect(getExistingKeys(filterQueryParams)).toHaveLength(0); @@ -58,7 +58,7 @@ describe("Filtering URL params", () => { it("should not be empty if active filters are present", () => { const filterQueryParams = getFilterQueryParams( setFilterOptsStatus(filters, true), - getFilterQueryParam + getFilterQueryParam, ); expect(filterQueryParams).toMatchSnapshot(); diff --git a/src/orders/views/OrderDraftList/filters.ts b/src/orders/views/OrderDraftList/filters.ts index da3d560a5..0e7085c63 100644 --- a/src/orders/views/OrderDraftList/filters.ts +++ b/src/orders/views/OrderDraftList/filters.ts @@ -3,7 +3,7 @@ import { OrderDraftFilterInput } from "@saleor/graphql"; import { maybe } from "@saleor/misc"; import { OrderDraftFilterKeys, - OrderDraftListFilterOpts + OrderDraftListFilterOpts, } from "@saleor/orders/components/OrderDraftListPage"; import { @@ -11,55 +11,55 @@ import { createFilterUtils, getGteLteVariables, getMinMaxQueryParam, - getSingleValueQueryParam + getSingleValueQueryParam, } from "../../../utils/filters"; import { OrderDraftListUrlFilters, OrderDraftListUrlFiltersEnum, - OrderDraftListUrlQueryParams + OrderDraftListUrlQueryParams, } from "../../urls"; export const ORDER_DRAFT_FILTERS_KEY = "orderDraftFilters"; export function getFilterOpts( - params: OrderDraftListUrlFilters + params: OrderDraftListUrlFilters, ): OrderDraftListFilterOpts { return { created: { active: maybe( () => [params.createdFrom, params.createdTo].some( - field => field !== undefined + field => field !== undefined, ), - false + false, ), value: { max: maybe(() => params.createdTo), - min: maybe(() => params.createdFrom) - } + min: maybe(() => params.createdFrom), + }, }, customer: { active: !!maybe(() => params.customer), - value: params.customer - } + value: params.customer, + }, }; } export function getFilterVariables( - params: OrderDraftListUrlFilters + params: OrderDraftListUrlFilters, ): OrderDraftFilterInput { return { created: getGteLteVariables({ gte: params.createdFrom, - lte: params.createdTo + lte: params.createdTo, }), customer: params.customer, - search: params.query + search: params.query, }; } export function getFilterQueryParam( - filter: FilterElement + filter: FilterElement, ): OrderDraftListUrlFilters { const { name } = filter; @@ -68,13 +68,13 @@ export function getFilterQueryParam( return getMinMaxQueryParam( filter, OrderDraftListUrlFiltersEnum.createdFrom, - OrderDraftListUrlFiltersEnum.createdTo + OrderDraftListUrlFiltersEnum.createdTo, ); case OrderDraftFilterKeys.customer: return getSingleValueQueryParam( filter, - OrderDraftListUrlFiltersEnum.customer + OrderDraftListUrlFiltersEnum.customer, ); } } @@ -82,13 +82,13 @@ export function getFilterQueryParam( export const { deleteFilterTab, getFilterTabs, - saveFilterTab + saveFilterTab, } = createFilterTabUtils(ORDER_DRAFT_FILTERS_KEY); export const { areFiltersApplied, getActiveFilters, - getFiltersCurrentTab + getFiltersCurrentTab, } = createFilterUtils( - OrderDraftListUrlFiltersEnum + OrderDraftListUrlFiltersEnum, ); diff --git a/src/orders/views/OrderDraftList/sort.ts b/src/orders/views/OrderDraftList/sort.ts index e256fb192..37e5fb7e6 100644 --- a/src/orders/views/OrderDraftList/sort.ts +++ b/src/orders/views/OrderDraftList/sort.ts @@ -3,7 +3,7 @@ import { OrderDraftListUrlSortField } from "@saleor/orders/urls"; import { createGetSortQueryVariables } from "@saleor/utils/sort"; export function getSortQueryField( - sort: OrderDraftListUrlSortField + sort: OrderDraftListUrlSortField, ): OrderSortField { switch (sort) { case OrderDraftListUrlSortField.number: @@ -18,5 +18,5 @@ export function getSortQueryField( } export const getSortQueryVariables = createGetSortQueryVariables( - getSortQueryField + getSortQueryField, ); diff --git a/src/orders/views/OrderFulfill/OrderFulfill.tsx b/src/orders/views/OrderFulfill/OrderFulfill.tsx index 79cba31d4..12aefe23c 100644 --- a/src/orders/views/OrderFulfill/OrderFulfill.tsx +++ b/src/orders/views/OrderFulfill/OrderFulfill.tsx @@ -4,13 +4,13 @@ import { useOrderFulfillDataQuery, useOrderFulfillmentUpdateTrackingMutation, useOrderFulfillSettingsQuery, - useWarehouseDetailsQuery + useWarehouseDetailsQuery, } from "@saleor/graphql"; import useNavigator from "@saleor/hooks/useNavigator"; import useNotifier from "@saleor/hooks/useNotifier"; import { getMutationErrors } from "@saleor/misc"; import OrderFulfillPage, { - OrderFulfillSubmitData + OrderFulfillSubmitData, } from "@saleor/orders/components/OrderFulfillPage"; import { OrderFulfillUrlQueryParams, orderUrl } from "@saleor/orders/urls"; import React from "react"; @@ -28,14 +28,14 @@ const OrderFulfill: React.FC = ({ orderId, params }) => { const { data: settings, - loading: settingsLoading + loading: settingsLoading, } = useOrderFulfillSettingsQuery({}); const { data, loading } = useOrderFulfillDataQuery({ displayLoader: true, variables: { - orderId - } + orderId, + }, }); const [updateTracking] = useOrderFulfillmentUpdateTrackingMutation(); @@ -49,17 +49,17 @@ const OrderFulfill: React.FC = ({ orderId, params }) => { text: intl.formatMessage({ id: "CYEnGq", defaultMessage: "Fulfilled Items", - description: "order fulfilled success message" - }) + description: "order fulfilled success message", + }), }); } - } + }, }); const { data: warehouseData } = useWarehouseDetailsQuery({ variables: { - id: params?.warehouse - } + id: params?.warehouse, + }, }); return ( @@ -71,16 +71,16 @@ const OrderFulfill: React.FC = ({ orderId, params }) => { { id: "2MKBk2", defaultMessage: "Fulfill Order #{orderNumber}", - description: "window title" + description: "window title", }, { - orderNumber: data.order.number - } + orderNumber: data.order.number, + }, ) : intl.formatMessage({ id: "NzifUg", defaultMessage: "Fulfill Order", - description: "window title" + description: "window title", }) } /> @@ -95,14 +95,14 @@ const OrderFulfill: React.FC = ({ orderId, params }) => { .filter(line => !!line?.value) .map(line => ({ orderLineId: line.id, - stocks: line.value + stocks: line.value, })), notifyCustomer: settings?.shop?.fulfillmentAutoApprove && formData.sendInfo, - allowStockToBeExceeded: formData.allowStockToBeExceeded + allowStockToBeExceeded: formData.allowStockToBeExceeded, }, - orderId - } + orderId, + }, }); const fulfillments = res?.data?.orderFulfill?.order?.fulfillments; @@ -112,12 +112,12 @@ const OrderFulfill: React.FC = ({ orderId, params }) => { id: fulfillments[fulfillments.length - 1].id, input: { ...(formData?.trackingNumber && { - trackingNumber: formData.trackingNumber + trackingNumber: formData.trackingNumber, }), notifyCustomer: - settings?.shop?.fulfillmentAutoApprove && formData.sendInfo - } - } + settings?.shop?.fulfillmentAutoApprove && formData.sendInfo, + }, + }, }); } return getMutationErrors(res); diff --git a/src/orders/views/OrderList/OrderList.tsx b/src/orders/views/OrderList/OrderList.tsx index d7ddce914..6174c24c9 100644 --- a/src/orders/views/OrderList/OrderList.tsx +++ b/src/orders/views/OrderList/OrderList.tsx @@ -2,12 +2,12 @@ import ChannelPickerDialog from "@saleor/channels/components/ChannelPickerDialog import useAppChannel from "@saleor/components/AppLayout/AppChannelContext"; import DeleteFilterTabDialog from "@saleor/components/DeleteFilterTabDialog"; import SaveFilterTabDialog, { - SaveFilterTabDialogFormData + SaveFilterTabDialogFormData, } from "@saleor/components/SaveFilterTabDialog"; import { useShopLimitsQuery } from "@saleor/components/Shop/queries"; import { useOrderDraftCreateMutation, - useOrderListQuery + useOrderListQuery, } from "@saleor/graphql"; import useListSettings from "@saleor/hooks/useListSettings"; import useNavigator from "@saleor/hooks/useNavigator"; @@ -15,7 +15,7 @@ import useNotifier from "@saleor/hooks/useNotifier"; import { usePaginationReset } from "@saleor/hooks/usePaginationReset"; import usePaginator, { createPaginationState, - PaginatorContext + PaginatorContext, } from "@saleor/hooks/usePaginator"; import { getStringOrPlaceholder } from "@saleor/misc"; import { ListViews } from "@saleor/types"; @@ -33,7 +33,7 @@ import { OrderListUrlDialog, OrderListUrlQueryParams, orderSettingsPath, - orderUrl + orderUrl, } from "../../urls"; import { deleteFilterTab, @@ -43,7 +43,7 @@ import { getFiltersCurrentTab, getFilterTabs, getFilterVariables, - saveFilterTab + saveFilterTab, } from "./filters"; import { getSortQueryVariables } from "./sort"; @@ -55,7 +55,7 @@ export const OrderList: React.FC = ({ params }) => { const navigate = useNavigator(); const notify = useNotifier(); const { updateListSettings, settings } = useListSettings( - ListViews.ORDER_LIST + ListViews.ORDER_LIST, ); usePaginationReset(orderListUrl, params, settings.rowNumber); @@ -68,18 +68,18 @@ export const OrderList: React.FC = ({ params }) => { status: "success", text: intl.formatMessage({ id: "6udlH+", - defaultMessage: "Order draft successfully created" - }) + defaultMessage: "Order draft successfully created", + }), }); navigate(orderUrl(data.draftOrderCreate.order.id)); - } + }, }); const { channel, availableChannels } = useAppChannel(false); const limitOpts = useShopLimitsQuery({ variables: { - orders: true - } + orders: true, + }, }); const noChannel = !channel && typeof channel !== "undefined"; @@ -94,12 +94,12 @@ export const OrderList: React.FC = ({ params }) => { const [ changeFilters, resetFilters, - handleSearchChange + handleSearchChange, ] = createFilterHandlers({ createUrl: orderListUrl, getFilterQueryParam, navigate, - params + params, }); const [openModal, closeModal] = createDialogActionHandlers< @@ -111,8 +111,8 @@ export const OrderList: React.FC = ({ params }) => { navigate( orderListUrl({ activeTab: tab.toString(), - ...getFilterTabs()[tab - 1].data - }) + ...getFilterTabs()[tab - 1].data, + }), ); const handleFilterTabDelete = () => { @@ -131,19 +131,19 @@ export const OrderList: React.FC = ({ params }) => { () => ({ ...paginationState, filter: getFilterVariables(params), - sort: getSortQueryVariables(params) + sort: getSortQueryVariables(params), }), - [params, settings.rowNumber] + [params, settings.rowNumber], ); const { data, loading } = useOrderListQuery({ displayLoader: true, - variables: queryVariables + variables: queryVariables, }); const paginationValues = usePaginator({ pageInfo: data?.orders?.pageInfo, paginationState, - queryString: params + queryString: params, }); const handleSort = createSortHandler(navigate, orderListUrl, params); @@ -194,8 +194,8 @@ export const OrderList: React.FC = ({ params }) => { onConfirm={channelId => createOrder({ variables: { - input: { channelId } - } + input: { channelId }, + }, }) } /> diff --git a/src/orders/views/OrderList/filters.test.ts b/src/orders/views/OrderList/filters.test.ts index c5a5fb0d1..deaec645c 100644 --- a/src/orders/views/OrderList/filters.test.ts +++ b/src/orders/views/OrderList/filters.test.ts @@ -2,7 +2,7 @@ import { date } from "@saleor/fixtures"; import { OrderStatusFilter, PaymentChargeStatusEnum } from "@saleor/graphql"; import { createFilterStructure, - OrderFilterGiftCard + OrderFilterGiftCard, } from "@saleor/orders/components/OrderListPage"; import { OrderListUrlFilters } from "@saleor/orders/urls"; import { getFilterQueryParams } from "@saleor/utils/filters"; @@ -28,8 +28,8 @@ describe("Filtering query params", () => { customer: "email@example.com", status: [ OrderStatusFilter.FULFILLED, - OrderStatusFilter.PARTIALLY_FULFILLED - ] + OrderStatusFilter.PARTIALLY_FULFILLED, + ], }; const filterVariables = getFilterVariables(params); @@ -43,65 +43,65 @@ describe("Filtering URL params", () => { const filters = createFilterStructure(intl, { preorder: { active: false, - value: false + value: false, }, clickAndCollect: { active: false, - value: false + value: false, }, channel: { active: false, value: [ { label: "Channel PLN", - value: "channelId" - } - ] + value: "channelId", + }, + ], }, created: { active: false, value: { max: date.to, - min: date.from - } + min: date.from, + }, }, customer: { active: false, - value: "email@example.com" + value: "email@example.com", }, status: { active: false, value: [ OrderStatusFilter.FULFILLED, - OrderStatusFilter.PARTIALLY_FULFILLED - ] + OrderStatusFilter.PARTIALLY_FULFILLED, + ], }, paymentStatus: { active: false, value: [ PaymentChargeStatusEnum.FULLY_CHARGED, - PaymentChargeStatusEnum.PARTIALLY_CHARGED - ] + PaymentChargeStatusEnum.PARTIALLY_CHARGED, + ], }, giftCard: { active: false, - value: [OrderFilterGiftCard.paid, OrderFilterGiftCard.bought] + value: [OrderFilterGiftCard.paid, OrderFilterGiftCard.bought], }, metadata: { active: false, value: [ { key: "", - value: "" - } - ] - } + value: "", + }, + ], + }, }); it("should be empty if no active filters", () => { const filterQueryParams = getFilterQueryParams( filters, - getFilterQueryParam + getFilterQueryParam, ); expect(getExistingKeys(filterQueryParams)).toHaveLength(0); @@ -110,7 +110,7 @@ describe("Filtering URL params", () => { it("should not be empty if active filters are present", () => { const filterQueryParams = getFilterQueryParams( setFilterOptsStatus(filters, true), - getFilterQueryParam + getFilterQueryParam, ); expect(filterQueryParams).toMatchSnapshot(); diff --git a/src/orders/views/OrderList/filters.ts b/src/orders/views/OrderList/filters.ts index 03228dce3..e2a0f0c38 100644 --- a/src/orders/views/OrderList/filters.ts +++ b/src/orders/views/OrderList/filters.ts @@ -2,19 +2,19 @@ import { MultiAutocompleteChoiceType } from "@saleor/components/MultiAutocomplet import { OrderFilterInput, OrderStatusFilter, - PaymentChargeStatusEnum + PaymentChargeStatusEnum, } from "@saleor/graphql"; import { findInEnum, findValueInEnum, parseBoolean } from "@saleor/misc"; import { OrderFilterGiftCard, OrderFilterKeys, - OrderListFilterOpts + OrderListFilterOpts, } from "@saleor/orders/components/OrderListPage/filters"; import { FilterElement, FilterElementKeyValue, - FilterElementRegular + FilterElementRegular, } from "../../../components/Filter"; import { createFilterTabUtils, @@ -25,101 +25,101 @@ import { getMinMaxQueryParam, getMultipleEnumValueQueryParam, getMultipleValueQueryParam, - getSingleValueQueryParam + getSingleValueQueryParam, } from "../../../utils/filters"; import { OrderListFitersWithKeyValueValues, OrderListUrlFilters, OrderListUrlFiltersEnum, OrderListUrlFiltersWithMultipleValues, - OrderListUrlQueryParams + OrderListUrlQueryParams, } from "../../urls"; export const ORDER_FILTERS_KEY = "orderFilters"; export function getFilterOpts( params: OrderListUrlFilters, - channels: MultiAutocompleteChoiceType[] + channels: MultiAutocompleteChoiceType[], ): OrderListFilterOpts { return { clickAndCollect: { active: params.clickAndCollect !== undefined, - value: parseBoolean(params.clickAndCollect, true) + value: parseBoolean(params.clickAndCollect, true), }, preorder: { active: params.preorder !== undefined, - value: parseBoolean(params.preorder, true) + value: parseBoolean(params.preorder, true), }, channel: channels ? { active: params?.channel !== undefined, - value: channels + value: channels, } : null, created: { active: [params?.createdFrom, params?.createdTo].some( - field => field !== undefined + field => field !== undefined, ), value: { max: params?.createdTo || "", - min: params?.createdFrom || "" - } + min: params?.createdFrom || "", + }, }, giftCard: { active: params?.giftCard !== undefined, value: params.giftCard?.length ? params.giftCard?.map(status => - findValueInEnum(status, OrderFilterGiftCard) + findValueInEnum(status, OrderFilterGiftCard), ) - : ([] as OrderFilterGiftCard[]) + : ([] as OrderFilterGiftCard[]), }, customer: { active: !!params?.customer, - value: params?.customer + value: params?.customer, }, status: { active: params?.status !== undefined, value: dedupeFilter( params.status?.map(status => - findValueInEnum(status, OrderStatusFilter) - ) || [] - ) + findValueInEnum(status, OrderStatusFilter), + ) || [], + ), }, paymentStatus: { active: params?.paymentStatus !== undefined, value: dedupeFilter( params.paymentStatus?.map(paymentStatus => - findValueInEnum(paymentStatus, PaymentChargeStatusEnum) - ) || [] - ) + findValueInEnum(paymentStatus, PaymentChargeStatusEnum), + ) || [], + ), }, metadata: { active: !!params?.metadata?.length, value: [ ...(params?.metadata ? params.metadata.filter(pair => pair?.key !== undefined) - : []) - ] - } + : []), + ], + }, }; } export function getFilterVariables( - params: OrderListUrlFilters + params: OrderListUrlFilters, ): OrderFilterInput { return { channels: (params.channel as unknown) as string[], created: getGteLteVariables({ gte: params.createdFrom, - lte: params.createdTo + lte: params.createdTo, }), customer: params.customer, search: params.query, status: params?.status?.map(status => - findInEnum(status, OrderStatusFilter) + findInEnum(status, OrderStatusFilter), ), paymentStatus: params?.paymentStatus?.map(paymentStatus => - findInEnum(paymentStatus, PaymentChargeStatusEnum) + findInEnum(paymentStatus, PaymentChargeStatusEnum), ), isClickAndCollect: params.clickAndCollect !== undefined @@ -135,12 +135,12 @@ export function getFilterVariables( giftCardUsed: params?.giftCard?.some(param => param === OrderFilterGiftCard.paid) || undefined, - metadata: params?.metadata + metadata: params?.metadata, }; } export function getFilterQueryParam( - filter: FilterElement + filter: FilterElement, ): OrderListUrlFilters { const { name } = filter; @@ -148,7 +148,7 @@ export function getFilterQueryParam( case OrderFilterKeys.clickAndCollect: return getSingleValueQueryParam( filter, - OrderListUrlFiltersEnum.clickAndCollect + OrderListUrlFiltersEnum.clickAndCollect, ); case OrderFilterKeys.preorder: return getSingleValueQueryParam(filter, OrderListUrlFiltersEnum.preorder); @@ -157,27 +157,27 @@ export function getFilterQueryParam( return getMinMaxQueryParam( filter, OrderListUrlFiltersEnum.createdFrom, - OrderListUrlFiltersEnum.createdTo + OrderListUrlFiltersEnum.createdTo, ); case OrderFilterKeys.status: return getMultipleEnumValueQueryParam( filter as FilterElementRegular, OrderListUrlFiltersWithMultipleValues.status, - OrderStatusFilter + OrderStatusFilter, ); case OrderFilterKeys.paymentStatus: return getMultipleEnumValueQueryParam( filter as FilterElementRegular, OrderListUrlFiltersWithMultipleValues.paymentStatus, - PaymentChargeStatusEnum + PaymentChargeStatusEnum, ); case OrderFilterKeys.channel: return getMultipleValueQueryParam( filter, - OrderListUrlFiltersWithMultipleValues.channel + OrderListUrlFiltersWithMultipleValues.channel, ); case OrderFilterKeys.customer: @@ -187,13 +187,13 @@ export function getFilterQueryParam( return getMultipleEnumValueQueryParam( filter as FilterElementRegular, OrderListUrlFiltersWithMultipleValues.giftCard, - OrderFilterGiftCard + OrderFilterGiftCard, ); case OrderFilterKeys.metadata: return getKeyValueQueryParam( filter as FilterElementKeyValue, - OrderListFitersWithKeyValueValues.metadata + OrderListFitersWithKeyValueValues.metadata, ); } } @@ -201,14 +201,14 @@ export function getFilterQueryParam( export const { deleteFilterTab, getFilterTabs, - saveFilterTab + saveFilterTab, } = createFilterTabUtils(ORDER_FILTERS_KEY); export const { areFiltersApplied, getActiveFilters, - getFiltersCurrentTab + getFiltersCurrentTab, } = createFilterUtils({ ...OrderListUrlFiltersEnum, - ...OrderListUrlFiltersWithMultipleValues + ...OrderListUrlFiltersWithMultipleValues, }); diff --git a/src/orders/views/OrderList/sort.ts b/src/orders/views/OrderList/sort.ts index 0cf8bc8a6..70a910364 100644 --- a/src/orders/views/OrderList/sort.ts +++ b/src/orders/views/OrderList/sort.ts @@ -20,5 +20,5 @@ export function getSortQueryField(sort: OrderListUrlSortField): OrderSortField { } export const getSortQueryVariables = createGetSortQueryVariables( - getSortQueryField + getSortQueryField, ); diff --git a/src/orders/views/OrderRefund/OrderRefund.tsx b/src/orders/views/OrderRefund/OrderRefund.tsx index 1ef961b97..165379d23 100644 --- a/src/orders/views/OrderRefund/OrderRefund.tsx +++ b/src/orders/views/OrderRefund/OrderRefund.tsx @@ -1,7 +1,7 @@ import { useOrderFulfillmentRefundProductsMutation, useOrderRefundDataQuery, - useOrderRefundMutation + useOrderRefundMutation, } from "@saleor/graphql"; import useNavigator from "@saleor/hooks/useNavigator"; import useNotifier from "@saleor/hooks/useNotifier"; @@ -10,46 +10,46 @@ import OrderRefundPage from "@saleor/orders/components/OrderRefundPage"; import { OrderRefundAmountCalculationMode, OrderRefundSubmitData, - OrderRefundType + OrderRefundType, } from "@saleor/orders/components/OrderRefundPage/form"; import { orderUrl } from "@saleor/orders/urls"; import React from "react"; import { useIntl } from "react-intl"; const getAutomaticallyCalculatedProductsRefundInput = ( - formData: OrderRefundSubmitData + formData: OrderRefundSubmitData, ) => ({ fulfillmentLines: formData.refundedFulfilledProductQuantities .filter(line => line.value !== "0") .map(line => ({ fulfillmentLineId: line.id, - quantity: Number(line.value) + quantity: Number(line.value), })), includeShippingCosts: formData.refundShipmentCosts, orderLines: formData.refundedProductQuantities .filter(line => line.value !== "0") .map(line => ({ orderLineId: line.id, - quantity: Number(line.value) - })) + quantity: Number(line.value), + })), }); const getManuallySetProductsRefundInput = ( - formData: OrderRefundSubmitData + formData: OrderRefundSubmitData, ) => ({ amountToRefund: formData.amount, fulfillmentLines: formData.refundedFulfilledProductQuantities .filter(line => line.value !== "0") .map(line => ({ fulfillmentLineId: line.id, - quantity: Number(line.value) + quantity: Number(line.value), })), includeShippingCosts: formData.refundShipmentCosts, orderLines: formData.refundedProductQuantities .filter(line => line.value !== "0") .map(line => ({ orderLineId: line.id, - quantity: Number(line.value) - })) + quantity: Number(line.value), + })), }); interface OrderRefundProps { @@ -64,8 +64,8 @@ const OrderRefund: React.FC = ({ orderId }) => { const { data, loading } = useOrderRefundDataQuery({ displayLoader: true, variables: { - orderId - } + orderId, + }, }); const [refundOrder, refundOrderOpts] = useOrderRefundMutation({ onCompleted: data => { @@ -76,15 +76,15 @@ const OrderRefund: React.FC = ({ orderId }) => { text: intl.formatMessage({ id: "XRf1Bi", defaultMessage: "Refunded Items", - description: "order refunded success message" - }) + description: "order refunded success message", + }), }); } - } + }, }); const [ refundOrderFulfillmentProducts, - refundOrderFulfillmentProductsOpts + refundOrderFulfillmentProductsOpts, ] = useOrderFulfillmentRefundProductsMutation({ onCompleted: data => { if (data.orderFulfillmentRefundProducts.errors.length === 0) { @@ -94,28 +94,28 @@ const OrderRefund: React.FC = ({ orderId }) => { text: intl.formatMessage({ id: "XRf1Bi", defaultMessage: "Refunded Items", - description: "order refunded success message" - }) + description: "order refunded success message", + }), }); } - } + }, }); const handleSubmitMiscellaneousRefund = async ( - formData: OrderRefundSubmitData + formData: OrderRefundSubmitData, ) => { extractMutationErrors( refundOrder({ variables: { amount: formData.amount, - id: orderId - } - }) + id: orderId, + }, + }), ); }; const handleSubmitProductsRefund = async ( - formData: OrderRefundSubmitData + formData: OrderRefundSubmitData, ) => { const input = formData.amountCalculationMode === @@ -127,9 +127,9 @@ const OrderRefund: React.FC = ({ orderId }) => { refundOrderFulfillmentProducts({ variables: { input, - order: orderId - } - }) + order: orderId, + }, + }), ); }; @@ -149,7 +149,7 @@ const OrderRefund: React.FC = ({ orderId }) => { errors={[ ...(refundOrderOpts.data?.orderRefund.errors || []), ...(refundOrderFulfillmentProductsOpts.data - ?.orderFulfillmentRefundProducts.errors || []) + ?.orderFulfillmentRefundProducts.errors || []), ]} onSubmit={handleSubmit} /> diff --git a/src/orders/views/OrderReturn/OrderReturn.tsx b/src/orders/views/OrderReturn/OrderReturn.tsx index 7dd71437b..618da795b 100644 --- a/src/orders/views/OrderReturn/OrderReturn.tsx +++ b/src/orders/views/OrderReturn/OrderReturn.tsx @@ -1,7 +1,7 @@ import { OrderErrorCode, useFulfillmentReturnProductsMutation, - useOrderDetailsQuery + useOrderDetailsQuery, } from "@saleor/graphql"; import useNavigator from "@saleor/hooks/useNavigator"; import useNotifier from "@saleor/hooks/useNotifier"; @@ -20,18 +20,18 @@ export const messages = defineMessages({ id: "XQBVEJ", defaultMessage: "We’ve encountered a problem while refunding the products. Product’s were not refunded. Please try again.", - description: "order return error description when cannot refund" + description: "order return error description when cannot refund", }, cannotRefundTitle: { id: "l9Lwjh", defaultMessage: "Couldn't refund products", - description: "order return error title when cannot refund" + description: "order return error title when cannot refund", }, successAlert: { id: "/z9uo1", defaultMessage: "Successfully returned products!", - description: "order returned success message" - } + description: "order returned success message", + }, }); interface OrderReturnProps { @@ -46,19 +46,19 @@ const OrderReturn: React.FC = ({ orderId }) => { const { data, loading } = useOrderDetailsQuery({ displayLoader: true, variables: { - id: orderId - } + id: orderId, + }, }); const [returnCreate, returnCreateOpts] = useFulfillmentReturnProductsMutation( { onCompleted: ({ - orderFulfillmentReturnProducts: { errors, replaceOrder } + orderFulfillmentReturnProducts: { errors, replaceOrder }, }) => { if (!errors.length) { notify({ status: "success", - text: intl.formatMessage(messages.successAlert) + text: intl.formatMessage(messages.successAlert), }); navigate(orderUrl(replaceOrder?.id || orderId)); @@ -71,7 +71,7 @@ const OrderReturn: React.FC = ({ orderId }) => { autohide: 5000, status: "error", text: intl.formatMessage(messages.cannotRefundDescription), - title: intl.formatMessage(messages.cannotRefundTitle) + title: intl.formatMessage(messages.cannotRefundTitle), }); return; @@ -80,10 +80,10 @@ const OrderReturn: React.FC = ({ orderId }) => { notify({ autohide: 5000, status: "error", - text: intl.formatMessage(commonMessages.somethingWentWrong) + text: intl.formatMessage(commonMessages.somethingWentWrong), }); - } - } + }, + }, ); const handleSubmit = async (formData: OrderReturnFormData) => { @@ -95,9 +95,9 @@ const OrderReturn: React.FC = ({ orderId }) => { returnCreate({ variables: { id: data.order.id, - input: new ReturnFormDataParser(data.order, formData).getParsedData() - } - }) + input: new ReturnFormDataParser(data.order, formData).getParsedData(), + }, + }), ); }; diff --git a/src/orders/views/OrderReturn/utils.tsx b/src/orders/views/OrderReturn/utils.tsx index f333e5b4a..4ec0ac001 100644 --- a/src/orders/views/OrderReturn/utils.tsx +++ b/src/orders/views/OrderReturn/utils.tsx @@ -2,12 +2,12 @@ import { OrderDetailsFragment, OrderReturnFulfillmentLineInput, OrderReturnLineInput, - OrderReturnProductsInput + OrderReturnProductsInput, } from "@saleor/graphql"; import { OrderRefundAmountCalculationMode } from "@saleor/orders/components/OrderRefundPage/form"; import { FormsetQuantityData, - OrderReturnFormData + OrderReturnFormData, } from "@saleor/orders/components/OrderReturnPage/form"; import { getById } from "@saleor/orders/components/OrderReturnPage/utils"; @@ -25,7 +25,7 @@ class ReturnFormDataParser { fulfilledItemsQuantities, waitingItemsQuantities, unfulfilledItemsQuantities, - refundShipmentCosts + refundShipmentCosts, } = this.formData; const fulfillmentLines = this.getParsedLineData< @@ -38,7 +38,7 @@ class ReturnFormDataParser { const orderLines = this.getParsedLineData( unfulfilledItemsQuantities, - "orderLineId" + "orderLineId", ); return { @@ -46,7 +46,7 @@ class ReturnFormDataParser { fulfillmentLines: fulfillmentLines.concat(waitingLines), includeShippingCosts: refundShipmentCosts, orderLines, - refund: this.getShouldRefund(orderLines, fulfillmentLines) + refund: this.getShouldRefund(orderLines, fulfillmentLines), }; }; @@ -60,7 +60,7 @@ class ReturnFormDataParser { T extends OrderReturnFulfillmentLineInput | OrderReturnLineInput >( itemsQuantities: FormsetQuantityData, - idKey: "fulfillmentLineId" | "orderLineId" + idKey: "fulfillmentLineId" | "orderLineId", ): T[] { const { itemsToBeReplaced } = this.formData; @@ -73,14 +73,14 @@ class ReturnFormDataParser { return [ ...result, - ({ [idKey]: id, quantity, replace: shouldReplace } as unknown) as T + ({ [idKey]: id, quantity, replace: shouldReplace } as unknown) as T, ]; }, []); }; private getShouldRefund = ( orderLines: OrderReturnLineInput[], - fulfillmentLines: OrderReturnFulfillmentLineInput[] + fulfillmentLines: OrderReturnFulfillmentLineInput[], ) => { if ( !this.order.totalCaptured?.amount || diff --git a/src/orders/views/OrderSettings.tsx b/src/orders/views/OrderSettings.tsx index b665c317b..6d93b2bea 100644 --- a/src/orders/views/OrderSettings.tsx +++ b/src/orders/views/OrderSettings.tsx @@ -1,6 +1,6 @@ import { useOrderSettingsQuery, - useOrderSettingsUpdateMutation + useOrderSettingsUpdateMutation, } from "@saleor/graphql"; import useNotifier from "@saleor/hooks/useNotifier"; import { commonMessages } from "@saleor/intl"; @@ -19,43 +19,43 @@ export const OrderSettings: React.FC = () => { const [ orderSettingsUpdate, - orderSettingsUpdateOpts + orderSettingsUpdateOpts, ] = useOrderSettingsUpdateMutation({ onCompleted: ({ orderSettingsUpdate: { errors } }) => { if (!errors.length) { notify({ status: "success", - text: intl.formatMessage(commonMessages.savedChanges) + text: intl.formatMessage(commonMessages.savedChanges), }); return; } notify({ status: "error", - text: intl.formatMessage(commonMessages.somethingWentWrong) + text: intl.formatMessage(commonMessages.somethingWentWrong), }); - } + }, }); const handleSubmit = async ({ automaticallyConfirmAllNewOrders, automaticallyFulfillNonShippableGiftCard, fulfillmentAutoApprove, - fulfillmentAllowUnpaid + fulfillmentAllowUnpaid, }: OrderSettingsFormData) => extractMutationErrors( orderSettingsUpdate({ variables: { orderSettingsInput: { automaticallyFulfillNonShippableGiftCard, - automaticallyConfirmAllNewOrders + automaticallyConfirmAllNewOrders, }, shopSettingsInput: { fulfillmentAutoApprove, - fulfillmentAllowUnpaid - } - } - }) + fulfillmentAllowUnpaid, + }, + }, + }), ); return ( @@ -67,7 +67,7 @@ export const OrderSettings: React.FC = () => { saveButtonBarState={getMutationState( orderSettingsUpdateOpts.called, orderSettingsUpdateOpts.loading, - [...(orderSettingsUpdateOpts.data?.orderSettingsUpdate.errors || [])] + [...(orderSettingsUpdateOpts.data?.orderSettingsUpdate.errors || [])], )} /> ); diff --git a/src/pageTypes/components/PageTypeAttributes/PageTypeAttributes.tsx b/src/pageTypes/components/PageTypeAttributes/PageTypeAttributes.tsx index f5beccba2..6c5fbcd1c 100644 --- a/src/pageTypes/components/PageTypeAttributes/PageTypeAttributes.tsx +++ b/src/pageTypes/components/PageTypeAttributes/PageTypeAttributes.tsx @@ -7,7 +7,7 @@ import ResponsiveTable from "@saleor/components/ResponsiveTable"; import Skeleton from "@saleor/components/Skeleton"; import { SortableTableBody, - SortableTableRow + SortableTableRow, } from "@saleor/components/SortableTable"; import { TableButtonWrapper } from "@saleor/components/TableButtonWrapper/TableButtonWrapper"; import TableHead from "@saleor/components/TableHead"; @@ -22,25 +22,25 @@ const useStyles = makeStyles( { colAction: { "&:last-child": { - paddingRight: 0 + paddingRight: 0, }, - width: 80 + width: 80, }, colGrab: { - width: 60 + width: 60, }, colName: {}, colSlug: { - width: 300 + width: 300, }, link: { - cursor: "pointer" + cursor: "pointer", }, textLeft: { - textAlign: "left" - } + textAlign: "left", + }, }, - { name: "PageTypeAttributes" } + { name: "PageTypeAttributes" }, ); interface PageTypeAttributesProps extends ListActions { @@ -66,7 +66,7 @@ const PageTypeAttributes: React.FC = props => { type, onAttributeAssign, onAttributeReorder, - onAttributeUnassign + onAttributeUnassign, } = props; const classes = useStyles(props); @@ -78,7 +78,7 @@ const PageTypeAttributes: React.FC = props => { title={intl.formatMessage({ id: "iQxjow", defaultMessage: "Content Attributes", - description: "section header" + description: "section header", })} toolbar={ - ) + ), }} /> @@ -265,13 +265,13 @@ export const PageTypeDetails: React.FC = ({ /> - getPageErrorMessage(err, intl) + getPageErrorMessage(err, intl), ) : [] } @@ -293,10 +293,10 @@ export const PageTypeDetails: React.FC = ({ ...params, ids: ids.includes(attributeId) ? params.ids.filter( - selectedId => selectedId !== attributeId + selectedId => selectedId !== attributeId, ) - : [...ids, attributeId] - }) + : [...ids, attributeId], + }), ); }} /> @@ -306,7 +306,7 @@ export const PageTypeDetails: React.FC = ({ title={intl.formatMessage({ id: "Rpfa+t", defaultMessage: "Unassign Attribute from Page Type", - description: "dialog header" + description: "dialog header", })} attributeQuantity={params.ids?.length} confirmButtonState={unassignAttributeOpts.status} @@ -319,12 +319,12 @@ export const PageTypeDetails: React.FC = ({ title={intl.formatMessage({ id: "/L8wzi", defaultMessage: "Unassign Attribute From Page Type", - description: "dialog header" + description: "dialog header", })} attributeName={getStringOrPlaceholder( data?.pageType.attributes.find( - attribute => attribute.id === params.id - )?.name + attribute => attribute.id === params.id, + )?.name, )} confirmButtonState={unassignAttributeOpts.status} onClose={closeModal} diff --git a/src/pageTypes/views/PageTypeList/PageTypeList.tsx b/src/pageTypes/views/PageTypeList/PageTypeList.tsx index 05b4fbed5..9d590d7d6 100644 --- a/src/pageTypes/views/PageTypeList/PageTypeList.tsx +++ b/src/pageTypes/views/PageTypeList/PageTypeList.tsx @@ -1,11 +1,11 @@ import DeleteFilterTabDialog from "@saleor/components/DeleteFilterTabDialog"; import SaveFilterTabDialog, { - SaveFilterTabDialogFormData + SaveFilterTabDialogFormData, } from "@saleor/components/SaveFilterTabDialog"; import TypeDeleteWarningDialog from "@saleor/components/TypeDeleteWarningDialog"; import { usePageTypeBulkDeleteMutation, - usePageTypeListQuery + usePageTypeListQuery, } from "@saleor/graphql"; import useBulkActions from "@saleor/hooks/useBulkActions"; import useListSettings from "@saleor/hooks/useListSettings"; @@ -14,7 +14,7 @@ import useNotifier from "@saleor/hooks/useNotifier"; import { usePaginationReset } from "@saleor/hooks/usePaginationReset"; import usePaginator, { createPaginationState, - PaginatorContext + PaginatorContext, } from "@saleor/hooks/usePaginator"; import { commonMessages } from "@saleor/intl"; import { DeleteIcon, IconButton } from "@saleor/macaw-ui"; @@ -33,7 +33,7 @@ import { pageTypeListUrl, PageTypeListUrlDialog, PageTypeListUrlFilters, - PageTypeListUrlQueryParams + PageTypeListUrlQueryParams, } from "../../urls"; import { deleteFilterTab, @@ -41,7 +41,7 @@ import { getFiltersCurrentTab, getFilterTabs, getFilterVariables, - saveFilterTab + saveFilterTab, } from "./filters"; import { getSortQueryVariables } from "./sort"; @@ -57,7 +57,7 @@ export const PageTypeList: React.FC = ({ params }) => { listElements: selectedPageTypes, reset, toggle, - toggleAll + toggleAll, } = useBulkActions(params.ids); const intl = useIntl(); const { settings } = useListSettings(ListViews.PAGES_LIST); @@ -69,13 +69,13 @@ export const PageTypeList: React.FC = ({ params }) => { () => ({ ...paginationState, filter: getFilterVariables(params), - sort: getSortQueryVariables(params) + sort: getSortQueryVariables(params), }), - [params, settings.rowNumber] + [params, settings.rowNumber], ); const { data, loading, refetch } = usePageTypeListQuery({ displayLoader: true, - variables: queryVariables + variables: queryVariables, }); const tabs = getFilterTabs(); @@ -88,8 +88,8 @@ export const PageTypeList: React.FC = ({ params }) => { pageTypeListUrl({ ...getActiveFilters(params), ...filter, - activeTab: undefined - }) + activeTab: undefined, + }), ); }; @@ -103,8 +103,8 @@ export const PageTypeList: React.FC = ({ params }) => { navigate( pageTypeListUrl({ activeTab: tab.toString(), - ...getFilterTabs()[tab - 1].data - }) + ...getFilterTabs()[tab - 1].data, + }), ); }; @@ -122,20 +122,20 @@ export const PageTypeList: React.FC = ({ params }) => { const paginationValues = usePaginator({ pageInfo: data?.pageTypes?.pageInfo, paginationState, - queryString: params + queryString: params, }); const handleSort = createSortHandler(navigate, pageTypeListUrl, params); const [ pageTypeBulkDelete, - pageTypeBulkDeleteOpts + pageTypeBulkDeleteOpts, ] = usePageTypeBulkDeleteMutation({ onCompleted: data => { if (data.pageTypeBulkDelete.errors.length === 0) { notify({ status: "success", - text: intl.formatMessage(commonMessages.savedChanges) + text: intl.formatMessage(commonMessages.savedChanges), }); reset(); refetch(); @@ -143,23 +143,23 @@ export const PageTypeList: React.FC = ({ params }) => { pageTypeListUrl({ ...params, action: undefined, - ids: undefined - }) + ids: undefined, + }), ); } - } + }, }); const hanldePageTypeBulkDelete = () => pageTypeBulkDelete({ variables: { - ids: params.ids - } + ids: params.ids, + }, }); const pageTypeDeleteData = usePageTypeDelete({ selectedTypes: selectedPageTypes, - params + params, }); const pageTypesData = mapEdgesToItems(data?.pageTypes); @@ -189,7 +189,7 @@ export const PageTypeList: React.FC = ({ params }) => { color="primary" onClick={() => openModal("remove", { - ids: selectedPageTypes + ids: selectedPageTypes, }) } > diff --git a/src/pageTypes/views/PageTypeList/filters.ts b/src/pageTypes/views/PageTypeList/filters.ts index da4332915..0d237a0f0 100644 --- a/src/pageTypes/views/PageTypeList/filters.ts +++ b/src/pageTypes/views/PageTypeList/filters.ts @@ -2,34 +2,34 @@ import { PageTypeFilterInput } from "@saleor/graphql"; import { createFilterTabUtils, - createFilterUtils + createFilterUtils, } from "../../../utils/filters"; import { PageTypeListUrlFilters, PageTypeListUrlFiltersEnum, - PageTypeListUrlQueryParams + PageTypeListUrlQueryParams, } from "../../urls"; export const PAGE_TYPE_FILTERS_KEY = "pageTypeFilters"; export function getFilterVariables( - params: PageTypeListUrlFilters + params: PageTypeListUrlFilters, ): PageTypeFilterInput { return { - search: params.query + search: params.query, }; } export const { deleteFilterTab, getFilterTabs, - saveFilterTab + saveFilterTab, } = createFilterTabUtils(PAGE_TYPE_FILTERS_KEY); export const { areFiltersApplied, getActiveFilters, - getFiltersCurrentTab + getFiltersCurrentTab, } = createFilterUtils( - PageTypeListUrlFiltersEnum + PageTypeListUrlFiltersEnum, ); diff --git a/src/pageTypes/views/PageTypeList/sort.ts b/src/pageTypes/views/PageTypeList/sort.ts index 7c47615b6..7b298c81f 100644 --- a/src/pageTypes/views/PageTypeList/sort.ts +++ b/src/pageTypes/views/PageTypeList/sort.ts @@ -3,7 +3,7 @@ import { PageTypeListUrlSortField } from "@saleor/pageTypes/urls"; import { createGetSortQueryVariables } from "@saleor/utils/sort"; export function getSortQueryField( - sort: PageTypeListUrlSortField + sort: PageTypeListUrlSortField, ): PageTypeSortField { switch (sort) { case PageTypeListUrlSortField.name: @@ -14,5 +14,5 @@ export function getSortQueryField( } export const getSortQueryVariables = createGetSortQueryVariables( - getSortQueryField + getSortQueryField, ); diff --git a/src/pages/components/PageDetailsPage/PageDetailsPage.tsx b/src/pages/components/PageDetailsPage/PageDetailsPage.tsx index bc7c19cf1..32dc060fd 100644 --- a/src/pages/components/PageDetailsPage/PageDetailsPage.tsx +++ b/src/pages/components/PageDetailsPage/PageDetailsPage.tsx @@ -1,6 +1,6 @@ import { getAttributeValuesFromReferences, - mergeAttributeValues + mergeAttributeValues, } from "@saleor/attributes/utils/data"; import AssignAttributeValueDialog from "@saleor/components/AssignAttributeValueDialog"; import Attributes, { AttributeInput } from "@saleor/components/Attributes"; @@ -19,7 +19,7 @@ import { SearchAttributeValuesQuery, SearchPagesQuery, SearchPageTypesQuery, - SearchProductsQuery + SearchProductsQuery, } from "@saleor/graphql"; import useDateLocalize from "@saleor/hooks/useDateLocalize"; import { SubmitPromise } from "@saleor/hooks/useForm"; @@ -90,7 +90,7 @@ const PageDetailsPage: React.FC = ({ fetchMoreAttributeValues, onCloseDialog, onSelectPageType, - onAttributeSelectBlur + onAttributeSelectBlur, }) => { const intl = useIntl(); const localizeDate = useDateLocalize(); @@ -107,15 +107,15 @@ const PageDetailsPage: React.FC = ({ const handleAssignReferenceAttribute = ( attributeValues: string[], data: PageData, - handlers: PageUpdateHandlers + handlers: PageUpdateHandlers, ) => { handlers.selectAttributeReference( assignReferencesAttributeId, mergeAttributeValues( assignReferencesAttributeId, attributeValues, - data.attributes - ) + data.attributes, + ), ); onCloseDialog(); }; @@ -145,7 +145,7 @@ const PageDetailsPage: React.FC = ({ handlers, submit, isSaveDisabled, - attributeRichTextGetters + attributeRichTextGetters, }) => ( @@ -157,7 +157,7 @@ const PageDetailsPage: React.FC = ({ ? intl.formatMessage({ id: "gr53VQ", defaultMessage: "Create Page", - description: "page header" + description: "page header", }) : page?.title } @@ -185,7 +185,7 @@ const PageDetailsPage: React.FC = ({ helperText={intl.formatMessage({ id: "jZbT0O", defaultMessage: - "Add search engine title and description to make this page easier to find" + "Add search engine title and description to make this page easier to find", })} /> @@ -221,23 +221,23 @@ const PageDetailsPage: React.FC = ({ hiddenLabel: intl.formatMessage({ id: "/TK7QD", defaultMessage: "Hidden", - description: "page label" + description: "page label", }), hiddenSecondLabel: intl.formatMessage( { id: "GZgjK7", defaultMessage: "will be visible from {date}", - description: "page" + description: "page", }, { - date: localizeDate(data.publicationDate, "L") - } + date: localizeDate(data.publicationDate, "L"), + }, ), visibleLabel: intl.formatMessage({ id: "X26jCC", defaultMessage: "Visible", - description: "page label" - }) + description: "page label", + }), }} onChange={change} /> @@ -269,7 +269,7 @@ const PageDetailsPage: React.FC = ({ assignReferencesAttributeId, data.attributes, referencePages, - referenceProducts + referenceProducts, )} hasMore={handlers.fetchMoreReferences?.hasMore} open={canOpenAssignReferencesAttributeDialog} diff --git a/src/pages/components/PageDetailsPage/form.tsx b/src/pages/components/PageDetailsPage/form.tsx index 274f6c002..a55f0012c 100644 --- a/src/pages/components/PageDetailsPage/form.tsx +++ b/src/pages/components/PageDetailsPage/form.tsx @@ -4,7 +4,7 @@ import { getRichTextAttributesFromMap, getRichTextDataFromAttributes, mergeAttributes, - RichTextProps + RichTextProps, } from "@saleor/attributes/utils/data"; import { createAttributeChangeHandler, @@ -13,7 +13,7 @@ import { createAttributeReferenceChangeHandler, createAttributeValueReorderHandler, createFetchMoreReferencesHandler, - createFetchReferencesHandler + createFetchReferencesHandler, } from "@saleor/attributes/utils/handlers"; import { AttributeInput } from "@saleor/components/Attributes"; import { useExitFormDialog } from "@saleor/components/Form/useExitFormDialog"; @@ -22,21 +22,21 @@ import { PageDetailsFragment, SearchPagesQuery, SearchPageTypesQuery, - SearchProductsQuery + SearchProductsQuery, } from "@saleor/graphql"; import useForm, { CommonUseFormResultWithHandlers, FormChange, - SubmitPromise + SubmitPromise, } from "@saleor/hooks/useForm"; import useFormset, { FormsetChange, - FormsetData + FormsetData, } from "@saleor/hooks/useFormset"; import useHandleFormSubmit from "@saleor/hooks/useHandleFormSubmit"; import { getAttributeInputFromPage, - getAttributeInputFromPageType + getAttributeInputFromPageType, } from "@saleor/pages/utils/data"; import { createPageTypeSelectHandler } from "@saleor/pages/utils/handlers"; import { FetchMoreProps, RelayToFlat, ReorderEvent } from "@saleor/types"; @@ -121,14 +121,14 @@ const getInitialFormData = (page?: PageDetailsFragment): PageFormData => ({ seoDescription: page?.seoDescription || "", seoTitle: page?.seoTitle || "", slug: page?.slug || "", - title: page?.title || "" + title: page?.title || "", }); function usePageForm( page: PageDetailsFragment, onSubmit: (data: PageData) => SubmitPromise, disabled: boolean, - opts: UsePageFormOpts + opts: UsePageFormOpts, ): UsePageUpdateFormOutput { const pageExists = page !== null; @@ -136,8 +136,8 @@ function usePageForm( getInitialFormData(page), undefined, { - confirmLeave: true - } + confirmLeave: true, + }, ); const attributes = useFormset( @@ -145,75 +145,75 @@ function usePageForm( ? getAttributeInputFromPage(page) : opts.selectedPageType ? getAttributeInputFromPageType(opts.selectedPageType) - : [] + : [], ); const { getters: attributeRichTextGetters, - getValues: getAttributeRichTextValues + getValues: getAttributeRichTextValues, } = useMultipleRichText({ initial: getRichTextDataFromAttributes(attributes.data), - triggerChange + triggerChange, }); const attributesWithNewFileValue = useFormset([]); const { setExitDialogSubmitRef, setIsSubmitDisabled } = useExitFormDialog({ - formId + formId, }); const richText = useRichText({ initial: pageExists ? page?.content : null, loading: pageExists ? !page : false, - triggerChange + triggerChange, }); const { isMetadataModified, isPrivateMetadataModified, - makeChangeHandler: makeMetadataChangeHandler + makeChangeHandler: makeMetadataChangeHandler, } = useMetadataChangeTrigger(); const changeMetadata = makeMetadataChangeHandler(handleChange); const handlePageTypeSelect = createPageTypeSelectHandler( opts.onSelectPageType, - triggerChange + triggerChange, ); const handleAttributeChange = createAttributeChangeHandler( attributes.change, - triggerChange + triggerChange, ); const handleAttributeMultiChange = createAttributeMultiChangeHandler( attributes.change, attributes.data, - triggerChange + triggerChange, ); const handleAttributeReferenceChange = createAttributeReferenceChangeHandler( attributes.change, - triggerChange + triggerChange, ); const handleFetchReferences = createFetchReferencesHandler( attributes.data, opts.assignReferencesAttributeId, opts.fetchReferencePages, - opts.fetchReferenceProducts + opts.fetchReferenceProducts, ); const handleFetchMoreReferences = createFetchMoreReferencesHandler( attributes.data, opts.assignReferencesAttributeId, opts.fetchMoreReferencePages, - opts.fetchMoreReferenceProducts + opts.fetchMoreReferenceProducts, ); const handleAttributeFileChange = createAttributeFileChangeHandler( attributes.change, attributesWithNewFileValue.data, attributesWithNewFileValue.add, attributesWithNewFileValue.change, - triggerChange + triggerChange, ); const handleAttributeValueReorder = createAttributeValueReorderHandler( attributes.change, attributes.data, - triggerChange + triggerChange, ); const data: PageData = { @@ -222,10 +222,10 @@ function usePageForm( attributes.data, attributesWithNewFileValue.data, opts.referencePages, - opts.referenceProducts + opts.referenceProducts, ), content: null, - pageType: pageExists ? page?.pageType : opts.selectedPageType + pageType: pageExists ? page?.pageType : opts.selectedPageType, }; const getSubmitData = async (): Promise => ({ @@ -237,10 +237,10 @@ function usePageForm( attributes.data, getRichTextAttributesFromMap( attributes.data, - await getAttributeRichTextValues() - ) + await getAttributeRichTextValues(), + ), ), - attributesWithNewFileValue: attributesWithNewFileValue.data + attributesWithNewFileValue: attributesWithNewFileValue.data, }); const handleSubmit = async (data: PageData) => { @@ -255,7 +255,7 @@ function usePageForm( const handleFormSubmit = useHandleFormSubmit({ formId, - onSubmit: handleSubmit + onSubmit: handleSubmit, }); const submit = async () => handleFormSubmit(await getSubmitData()); @@ -280,12 +280,12 @@ function usePageForm( selectAttributeFile: handleAttributeFileChange, selectAttributeMulti: handleAttributeMultiChange, selectAttributeReference: handleAttributeReferenceChange, - selectPageType: handlePageTypeSelect + selectPageType: handlePageTypeSelect, }, submit, isSaveDisabled, richText, - attributeRichTextGetters + attributeRichTextGetters, }; } diff --git a/src/pages/components/PageInfo/PageInfo.tsx b/src/pages/components/PageInfo/PageInfo.tsx index f4b7ca435..44d42e08c 100644 --- a/src/pages/components/PageInfo/PageInfo.tsx +++ b/src/pages/components/PageInfo/PageInfo.tsx @@ -24,10 +24,10 @@ export interface PageInfoProps { const useStyles = makeStyles( { root: { - overflow: "visible" - } + overflow: "visible", + }, }, - { name: "PageInfo" } + { name: "PageInfo" }, ); const PageInfo: React.FC = props => { @@ -40,7 +40,7 @@ const PageInfo: React.FC = props => { defaultValue, editorRef, isReadyForMount, - handleChange + handleChange, } = useRichTextContext(); const formErrors = getFormErrors(["title", "content"], errors); @@ -58,7 +58,7 @@ const PageInfo: React.FC = props => { label={intl.formatMessage({ id: "gr+oXW", defaultMessage: "Title", - description: "page title" + description: "page title", })} name={"title" as keyof PageData} value={data.title} @@ -76,7 +76,7 @@ const PageInfo: React.FC = props => { label={intl.formatMessage({ id: "gMwpNC", defaultMessage: "Content", - description: "page content" + description: "page content", })} name={"content" as keyof PageData} /> @@ -85,7 +85,7 @@ const PageInfo: React.FC = props => { label={intl.formatMessage({ id: "gMwpNC", defaultMessage: "Content", - description: "page content" + description: "page content", })} name={"content" as keyof PageData} /> diff --git a/src/pages/components/PageList/PageList.tsx b/src/pages/components/PageList/PageList.tsx index 9900f8ab9..0a397f143 100644 --- a/src/pages/components/PageList/PageList.tsx +++ b/src/pages/components/PageList/PageList.tsx @@ -3,7 +3,7 @@ import { TableBody, TableCell, TableFooter, - TableRow + TableRow, } from "@material-ui/core"; import Checkbox from "@saleor/components/Checkbox"; import ResponsiveTable from "@saleor/components/ResponsiveTable"; @@ -32,23 +32,23 @@ const useStyles = makeStyles( theme => ({ [theme.breakpoints.up("lg")]: { colSlug: { - width: 250 + width: 250, }, colTitle: {}, colVisibility: { - width: 200 - } + width: 200, + }, }, colSlug: {}, colTitle: { - paddingLeft: 0 + paddingLeft: 0, }, colVisibility: {}, link: { - cursor: "pointer" - } + cursor: "pointer", + }, }), - { name: "PageList" } + { name: "PageList" }, ); const numberOfColumns = 4; @@ -65,7 +65,7 @@ const PageList: React.FC = props => { sort, toggle, toggleAll, - toolbar + toolbar, } = props; const classes = useStyles(props); @@ -178,18 +178,18 @@ const PageList: React.FC = props => { ? intl.formatMessage({ id: "G1KzEx", defaultMessage: "Published", - description: "page status" + description: "page status", }) : intl.formatMessage({ id: "UN3qWD", defaultMessage: "Not Published", - description: "page status" + description: "page status", }) } color={page.isPublished ? "success" : "error"} /> ), - + , )} @@ -204,7 +204,7 @@ const PageList: React.FC = props => { /> - ) + ), )} diff --git a/src/pages/components/PageListPage/PageListPage.tsx b/src/pages/components/PageListPage/PageListPage.tsx index 67bc45a95..f939b220f 100644 --- a/src/pages/components/PageListPage/PageListPage.tsx +++ b/src/pages/components/PageListPage/PageListPage.tsx @@ -8,7 +8,7 @@ import { pageCreateUrl, PageListUrlDialog, PageListUrlQueryParams, - PageListUrlSortField + PageListUrlSortField, } from "@saleor/pages/urls"; import { ListActions, PageListProps, SortPage } from "@saleor/types"; import React from "react"; diff --git a/src/pages/components/PageListPage/PageListSearchAndFilters.tsx b/src/pages/components/PageListPage/PageListSearchAndFilters.tsx index 788e0f55f..46210ea98 100644 --- a/src/pages/components/PageListPage/PageListSearchAndFilters.tsx +++ b/src/pages/components/PageListPage/PageListSearchAndFilters.tsx @@ -1,7 +1,7 @@ import DeleteFilterTabDialog from "@saleor/components/DeleteFilterTabDialog"; import FilterBar from "@saleor/components/FilterBar"; import SaveFilterTabDialog, { - SaveFilterTabDialogFormData + SaveFilterTabDialogFormData, } from "@saleor/components/SaveFilterTabDialog"; import { DEFAULT_INITIAL_SEARCH_DATA } from "@saleor/config"; import { getSearchFetchMoreProps } from "@saleor/hooks/makeTopLevelSearch/utils"; @@ -22,7 +22,7 @@ import { getFilterQueryParam, getFiltersCurrentTab, getFilterTabs, - saveFilterTab + saveFilterTab, } from "./filters"; import { pagesListSearchAndFiltersMessages as messages } from "./messages"; import { PageListActionDialogOpts } from "./PageListPage"; @@ -34,7 +34,7 @@ interface PageListSearchAndFiltersProps { const PageListSearchAndFilters: React.FC = ({ params, - actionDialogOpts + actionDialogOpts, }) => { const navigate = useNavigator(); const intl = useIntl(); @@ -42,8 +42,8 @@ const PageListSearchAndFilters: React.FC = ({ const defaultSearchVariables = { variables: { ...DEFAULT_INITIAL_SEARCH_DATA, - first: 5 - } + first: 5, + }, }; const { reset } = useBulkActions(params.ids); @@ -51,7 +51,7 @@ const PageListSearchAndFilters: React.FC = ({ const { loadMore: fetchMorePageTypes, search: searchPageTypes, - result: searchPageTypesResult + result: searchPageTypesResult, } = usePageTypeSearch(defaultSearchVariables); const filterOpts = getFilterOpts({ @@ -59,20 +59,20 @@ const PageListSearchAndFilters: React.FC = ({ pageTypes: mapEdgesToItems(searchPageTypesResult?.data?.search), pageTypesProps: { ...getSearchFetchMoreProps(searchPageTypesResult, fetchMorePageTypes), - onSearchChange: searchPageTypes - } + onSearchChange: searchPageTypes, + }, }); const [ changeFilters, resetFilters, - handleSearchChange + handleSearchChange, ] = createFilterHandlers({ createUrl: pageListUrl, getFilterQueryParam, navigate, params, - cleanupFn: reset + cleanupFn: reset, }); const filterStrucutre = createFilterStructure(intl, filterOpts); @@ -83,8 +83,8 @@ const PageListSearchAndFilters: React.FC = ({ navigate( pageListUrl({ activeTab: tab.toString(), - ...getFilterTabs()[tab - 1].data - }) + ...getFilterTabs()[tab - 1].data, + }), ); }; diff --git a/src/pages/components/PageListPage/filters.ts b/src/pages/components/PageListPage/filters.ts index 15baa5889..1c1f96985 100644 --- a/src/pages/components/PageListPage/filters.ts +++ b/src/pages/components/PageListPage/filters.ts @@ -4,29 +4,29 @@ import { SearchPageTypesQuery } from "@saleor/graphql"; import { PageListUrlFilters, PageListUrlFiltersWithMultipleValues, - PageListUrlSort + PageListUrlSort, } from "@saleor/pages/urls"; import { ActiveTab, AutocompleteFilterOpts, FilterOpts, Pagination, - Search + Search, } from "@saleor/types"; import { createFilterTabUtils, createFilterUtils, - getMultipleValueQueryParam + getMultipleValueQueryParam, } from "@saleor/utils/filters"; import { createAutocompleteField } from "@saleor/utils/filters/fields"; import { mapNodeToChoice, - mapSingleValueNodeToChoice + mapSingleValueNodeToChoice, } from "@saleor/utils/maps"; import { defineMessages, IntlShape } from "react-intl"; export enum PageListFilterKeys { - pageTypes = "pageTypes" + pageTypes = "pageTypes", } export const PAGES_FILTERS_KEY = "pagesFilters"; @@ -39,8 +39,8 @@ const messages = defineMessages({ pageType: { id: "Of19Pn", defaultMessage: "Page Types", - description: "Types" - } + description: "Types", + }, }); interface PageListFilterOptsProps { @@ -52,7 +52,7 @@ interface PageListFilterOptsProps { export const getFilterOpts = ({ params, pageTypes, - pageTypesProps + pageTypesProps, }: PageListFilterOptsProps): PageListFilterOpts => ({ pageType: { active: !!params?.pageTypes, @@ -63,13 +63,13 @@ export const getFilterOpts = ({ hasMore: pageTypesProps.hasMore, loading: pageTypesProps.loading, onFetchMore: pageTypesProps.onFetchMore, - onSearchChange: pageTypesProps.onSearchChange - } + onSearchChange: pageTypesProps.onSearchChange, + }, }); export function createFilterStructure( intl: IntlShape, - opts: PageListFilterOpts + opts: PageListFilterOpts, ): IFilter { return [ { @@ -85,16 +85,16 @@ export function createFilterStructure( initialSearch: "", loading: opts.pageType.loading, onFetchMore: opts.pageType.onFetchMore, - onSearchChange: opts.pageType.onSearchChange - } + onSearchChange: opts.pageType.onSearchChange, + }, ), - active: opts.pageType.active - } + active: opts.pageType.active, + }, ]; } export function getFilterQueryParam( - filter: FilterElement + filter: FilterElement, ): PageListUrlFilters { const { name } = filter; @@ -115,13 +115,13 @@ export type PageListUrlQueryParams = Pagination & export const { deleteFilterTab, getFilterTabs, - saveFilterTab + saveFilterTab, } = createFilterTabUtils(PAGES_FILTERS_KEY); export const { areFiltersApplied, getActiveFilters, - getFiltersCurrentTab + getFiltersCurrentTab, } = createFilterUtils( - PageListUrlFiltersWithMultipleValues + PageListUrlFiltersWithMultipleValues, ); diff --git a/src/pages/components/PageListPage/messages.ts b/src/pages/components/PageListPage/messages.ts index 0a763287f..0335c511d 100644 --- a/src/pages/components/PageListPage/messages.ts +++ b/src/pages/components/PageListPage/messages.ts @@ -4,6 +4,6 @@ export const pagesListSearchAndFiltersMessages = defineMessages({ searchPlaceholder: { id: "UW1fLs", defaultMessage: "Search Pages", - description: "search pages placeholder" - } + description: "search pages placeholder", + }, }); diff --git a/src/pages/components/PageOrganizeContent/PageOrganizeContent.tsx b/src/pages/components/PageOrganizeContent/PageOrganizeContent.tsx index 88afc300a..50d663d3d 100644 --- a/src/pages/components/PageOrganizeContent/PageOrganizeContent.tsx +++ b/src/pages/components/PageOrganizeContent/PageOrganizeContent.tsx @@ -1,7 +1,7 @@ import { Card, CardContent, Typography } from "@material-ui/core"; import CardTitle from "@saleor/components/CardTitle"; import SingleAutocompleteSelectField, { - SingleAutocompleteChoiceType + SingleAutocompleteChoiceType, } from "@saleor/components/SingleAutocompleteSelectField"; import { PageDetailsFragment, PageErrorFragment } from "@saleor/graphql"; import { FormChange } from "@saleor/hooks/useForm"; @@ -30,10 +30,10 @@ export interface PageOrganizeContentProps { const useStyles = makeStyles( theme => ({ label: { - marginBottom: theme.spacing(0.5) - } + marginBottom: theme.spacing(0.5), + }, }), - { name: "PageOrganizeContent" } + { name: "PageOrganizeContent" }, ); const PageOrganizeContent: React.FC = props => { @@ -47,7 +47,7 @@ const PageOrganizeContent: React.FC = props => { pageTypes, onPageTypeChange, fetchPageTypes, - fetchMorePageTypes + fetchMorePageTypes, } = props; const classes = useStyles(props); @@ -61,7 +61,7 @@ const PageOrganizeContent: React.FC = props => { title={intl.formatMessage({ id: "jU9GPX", defaultMessage: "Organize Content", - description: "section header" + description: "section header", })} /> @@ -72,7 +72,7 @@ const PageOrganizeContent: React.FC = props => { displayValue={pageTypeInputDisplayValue} label={intl.formatMessage({ id: "W5SK5c", - defaultMessage: "Select content type" + defaultMessage: "Select content type", })} error={!!formErrors.pageType} helperText={getPageErrorMessage(formErrors.pageType, intl)} @@ -81,7 +81,7 @@ const PageOrganizeContent: React.FC = props => { value={data.pageType?.id} choices={pageTypes} InputProps={{ - autoComplete: "off" + autoComplete: "off", }} fetchChoices={fetchPageTypes} {...fetchMorePageTypes} diff --git a/src/pages/fixtures.ts b/src/pages/fixtures.ts index a98dfdc2a..121fb9925 100644 --- a/src/pages/fixtures.ts +++ b/src/pages/fixtures.ts @@ -1,7 +1,7 @@ import { AttributeInputTypeEnum, PageDetailsFragment, - PageFragment + PageFragment, } from "@saleor/graphql"; import * as richTextEditorFixtures from "../components/RichTextEditor/fixtures.json"; @@ -14,29 +14,29 @@ export const pageList: PageFragment[] = [ id: "Jzx123sEt==", isPublished: true, slug: "about", - title: "About" + title: "About", }, { __typename: "Page", id: "Jzx123sEx==", isPublished: false, slug: "about", - title: "About" + title: "About", }, { __typename: "Page", id: "Jzx123sEu==", isPublished: true, slug: "about", - title: "About" + title: "About", }, { __typename: "Page", id: "Jzx123sEm==", isPublished: true, slug: "about", - title: "About" - } + title: "About", + }, ]; export const page: PageDetailsFragment = { __typename: "Page", @@ -57,7 +57,7 @@ export const page: PageDetailsFragment = { endCursor: "", hasNextPage: false, hasPreviousPage: false, - startCursor: "" + startCursor: "", }, edges: [ { @@ -74,8 +74,8 @@ export const page: PageDetailsFragment = { boolean: null, date: null, dateTime: null, - value: null - } + value: null, + }, }, { __typename: "AttributeValueCountableEdge", @@ -91,8 +91,8 @@ export const page: PageDetailsFragment = { boolean: null, date: null, dateTime: null, - value: null - } + value: null, + }, }, { __typename: "AttributeValueCountableEdge", @@ -108,12 +108,12 @@ export const page: PageDetailsFragment = { boolean: null, date: null, dateTime: null, - value: null - } - } - ] + value: null, + }, + }, + ], }, - __typename: "Attribute" + __typename: "Attribute", }, values: [ { @@ -127,10 +127,10 @@ export const page: PageDetailsFragment = { boolean: null, date: null, dateTime: null, - value: null - } + value: null, + }, ], - __typename: "SelectedAttribute" + __typename: "SelectedAttribute", }, { attribute: { @@ -148,7 +148,7 @@ export const page: PageDetailsFragment = { endCursor: "", hasNextPage: false, hasPreviousPage: false, - startCursor: "" + startCursor: "", }, edges: [ { @@ -165,8 +165,8 @@ export const page: PageDetailsFragment = { boolean: null, date: null, dateTime: null, - value: null - } + value: null, + }, }, { __typename: "AttributeValueCountableEdge", @@ -182,8 +182,8 @@ export const page: PageDetailsFragment = { boolean: null, date: null, dateTime: null, - value: null - } + value: null, + }, }, { __typename: "AttributeValueCountableEdge", @@ -199,8 +199,8 @@ export const page: PageDetailsFragment = { boolean: null, date: null, dateTime: null, - value: null - } + value: null, + }, }, { __typename: "AttributeValueCountableEdge", @@ -216,12 +216,12 @@ export const page: PageDetailsFragment = { boolean: null, date: null, dateTime: null, - value: null - } - } - ] + value: null, + }, + }, + ], }, - __typename: "Attribute" + __typename: "Attribute", }, values: [ { @@ -235,11 +235,11 @@ export const page: PageDetailsFragment = { boolean: null, date: null, dateTime: null, - value: null - } + value: null, + }, ], - __typename: "SelectedAttribute" - } + __typename: "SelectedAttribute", + }, ], content: JSON.stringify(content), id: "Kzx152sEm==", @@ -248,8 +248,8 @@ export const page: PageDetailsFragment = { { __typename: "MetadataItem", key: "integration.id", - value: "100023123" - } + value: "100023123", + }, ], pageType: { __typename: "PageType", @@ -269,7 +269,7 @@ export const page: PageDetailsFragment = { endCursor: "", hasNextPage: false, hasPreviousPage: false, - startCursor: "" + startCursor: "", }, edges: [ { @@ -286,8 +286,8 @@ export const page: PageDetailsFragment = { boolean: null, date: null, dateTime: null, - value: null - } + value: null, + }, }, { __typename: "AttributeValueCountableEdge", @@ -303,8 +303,8 @@ export const page: PageDetailsFragment = { boolean: null, date: null, dateTime: null, - value: null - } + value: null, + }, }, { __typename: "AttributeValueCountableEdge", @@ -320,12 +320,12 @@ export const page: PageDetailsFragment = { boolean: null, date: null, dateTime: null, - value: null - } - } - ] + value: null, + }, + }, + ], }, - __typename: "Attribute" + __typename: "Attribute", }, { id: "QXR0cmlidXRlOjI5", @@ -340,7 +340,7 @@ export const page: PageDetailsFragment = { endCursor: "", hasNextPage: false, hasPreviousPage: false, - startCursor: "" + startCursor: "", }, edges: [ { @@ -357,8 +357,8 @@ export const page: PageDetailsFragment = { boolean: null, date: null, dateTime: null, - value: null - } + value: null, + }, }, { __typename: "AttributeValueCountableEdge", @@ -374,8 +374,8 @@ export const page: PageDetailsFragment = { boolean: null, date: null, dateTime: null, - value: null - } + value: null, + }, }, { __typename: "AttributeValueCountableEdge", @@ -391,8 +391,8 @@ export const page: PageDetailsFragment = { boolean: null, date: null, dateTime: null, - value: null - } + value: null, + }, }, { __typename: "AttributeValueCountableEdge", @@ -408,19 +408,19 @@ export const page: PageDetailsFragment = { boolean: null, date: null, dateTime: null, - value: null - } - } - ] + value: null, + }, + }, + ], }, - __typename: "Attribute" - } - ] + __typename: "Attribute", + }, + ], }, privateMetadata: [], publicationDate: "", seoDescription: "About", seoTitle: "About", slug: "about", - title: "About" + title: "About", }; diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 5d3e039f2..6b596b56c 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -12,7 +12,7 @@ import { PageListUrlQueryParams, PageListUrlSortField, pagePath, - PageUrlQueryParams + PageUrlQueryParams, } from "./urls"; import PageCreateComponent from "./views/PageCreate"; import PageDetailsComponent from "./views/PageDetails"; @@ -23,7 +23,7 @@ const PageList: React.FC> = ({ location }) => { const params: PageListUrlQueryParams = asSortParams( qs, PageListUrlSortField, - PageListUrlSortField.title + PageListUrlSortField.title, ); return ; }; diff --git a/src/pages/urls.ts b/src/pages/urls.ts index 1388ffc25..73ca45d43 100644 --- a/src/pages/urls.ts +++ b/src/pages/urls.ts @@ -10,7 +10,7 @@ import { Pagination, SingleAction, Sort, - TabActionDialog + TabActionDialog, } from "../types"; export const pagesSection = "/pages/"; @@ -24,15 +24,15 @@ export type PageListUrlDialog = export enum PageListUrlSortField { title = "title", slug = "slug", - visible = "visible" + visible = "visible", } export enum PageListUrlFiltersEnum { - query = "query" + query = "query", } export enum PageListUrlFiltersWithMultipleValues { - pageTypes = "pageTypes" + pageTypes = "pageTypes", } export type PageListUrlFilters = Filters & diff --git a/src/pages/utils/data.ts b/src/pages/utils/data.ts index dfe462152..813f51133 100644 --- a/src/pages/utils/data.ts +++ b/src/pages/utils/data.ts @@ -1,13 +1,13 @@ import { getSelectedAttributeValues, - mergeChoicesWithValues + mergeChoicesWithValues, } from "@saleor/attributes/utils/data"; import { AttributeInput } from "@saleor/components/Attributes"; import { PageDetailsFragment } from "@saleor/graphql"; import { mapEdgesToItems } from "@saleor/utils/maps"; export function getAttributeInputFromPage( - page: PageDetailsFragment + page: PageDetailsFragment, ): AttributeInput[] { return page?.attributes.map(attribute => ({ data: { @@ -16,26 +16,26 @@ export function getAttributeInputFromPage( isRequired: attribute.attribute.valueRequired, selectedValues: attribute.values, values: mergeChoicesWithValues(attribute), - unit: attribute.attribute.unit + unit: attribute.attribute.unit, }, id: attribute.attribute.id, label: attribute.attribute.name, - value: getSelectedAttributeValues(attribute) + value: getSelectedAttributeValues(attribute), })); } export function getAttributeInputFromPageType( - pageType: PageDetailsFragment["pageType"] + pageType: PageDetailsFragment["pageType"], ): AttributeInput[] { return pageType?.attributes.map(attribute => ({ data: { entityType: attribute.entityType, inputType: attribute.inputType, isRequired: attribute.valueRequired, - values: mapEdgesToItems(attribute.choices) || [] + values: mapEdgesToItems(attribute.choices) || [], }, id: attribute.id, label: attribute.name, - value: [] + value: [], })); } diff --git a/src/pages/utils/handlers.ts b/src/pages/utils/handlers.ts index 094c38701..f7c5d631b 100644 --- a/src/pages/utils/handlers.ts +++ b/src/pages/utils/handlers.ts @@ -2,7 +2,7 @@ import { FormChange } from "@saleor/hooks/useForm"; export function createPageTypeSelectHandler( setPageType: (pageTypeId: string) => void, - triggerChange: () => void + triggerChange: () => void, ): FormChange { return (event: React.ChangeEvent) => { const id = event.target.value; diff --git a/src/pages/views/PageCreate.tsx b/src/pages/views/PageCreate.tsx index 215197dde..e9b0ff683 100644 --- a/src/pages/views/PageCreate.tsx +++ b/src/pages/views/PageCreate.tsx @@ -1,20 +1,20 @@ import { getAttributesAfterFileAttributesUpdate } from "@saleor/attributes/utils/data"; import { handleUploadMultipleFiles, - prepareAttributesInput + prepareAttributesInput, } from "@saleor/attributes/utils/handlers"; import { AttributeInput } from "@saleor/components/Attributes"; import { WindowTitle } from "@saleor/components/WindowTitle"; import { DEFAULT_INITIAL_SEARCH_DATA, - VALUES_PAGINATE_BY + VALUES_PAGINATE_BY, } from "@saleor/config"; import { useFileUploadMutation, usePageCreateMutation, usePageTypeQuery, useUpdateMetadataMutation, - useUpdatePrivateMetadataMutation + useUpdatePrivateMetadataMutation, } from "@saleor/graphql"; import useNavigator from "@saleor/hooks/useNavigator"; import useNotifier from "@saleor/hooks/useNotifier"; @@ -50,37 +50,37 @@ export const PageCreate: React.FC = ({ params }) => { const { loadMore: loadMorePageTypes, search: searchPageTypes, - result: searchPageTypesOpts + result: searchPageTypesOpts, } = usePageTypeSearch({ - variables: DEFAULT_INITIAL_SEARCH_DATA + variables: DEFAULT_INITIAL_SEARCH_DATA, }); const { loadMore: loadMorePages, search: searchPages, - result: searchPagesOpts + result: searchPagesOpts, } = usePageSearch({ - variables: DEFAULT_INITIAL_SEARCH_DATA + variables: DEFAULT_INITIAL_SEARCH_DATA, }); const { loadMore: loadMoreProducts, search: searchProducts, - result: searchProductsOpts + result: searchProductsOpts, } = useProductSearch({ - variables: DEFAULT_INITIAL_SEARCH_DATA + variables: DEFAULT_INITIAL_SEARCH_DATA, }); const { loadMore: loadMoreAttributeValues, search: searchAttributeValues, result: searchAttributeValuesOpts, - reset: searchAttributeReset + reset: searchAttributeReset, } = useAttributeValueSearchHandler(DEFAULT_INITIAL_SEARCH_DATA); const { data: selectedPageType } = usePageTypeQuery({ variables: { id: selectedPageTypeId, - firstValues: VALUES_PAGINATE_BY + firstValues: VALUES_PAGINATE_BY, }, - skip: !selectedPageTypeId + skip: !selectedPageTypeId, }); const attributeValues = @@ -95,23 +95,23 @@ export const PageCreate: React.FC = ({ params }) => { status: "success", text: intl.formatMessage({ id: "JMbFNo", - defaultMessage: "Successfully created new page" - }) + defaultMessage: "Successfully created new page", + }), }); navigate(pageUrl(data.pageCreate.page.id)); } - } + }, }); const handleCreate = async (formData: PageSubmitData) => { const uploadFilesResult = await handleUploadMultipleFiles( formData.attributesWithNewFileValue, - variables => uploadFile({ variables }) + variables => uploadFile({ variables }), ); const updatedFileAttributes = getAttributesAfterFileAttributesUpdate( formData.attributesWithNewFileValue, - uploadFilesResult + uploadFilesResult, ); const result = await pageCreate({ @@ -120,7 +120,7 @@ export const PageCreate: React.FC = ({ params }) => { attributes: prepareAttributesInput({ attributes: formData.attributes, prevAttributes: null, - updatedFileAttributes + updatedFileAttributes, }), content: getParsedDataForJsonStringField(formData.content), isPublished: formData.isPublished, @@ -128,54 +128,54 @@ export const PageCreate: React.FC = ({ params }) => { publicationDate: formData.publicationDate, seo: { description: formData.seoDescription, - title: formData.seoTitle + title: formData.seoTitle, }, slug: formData.slug === "" ? null : formData.slug, - title: formData.title - } - } + title: formData.title, + }, + }, }); return { id: result.data.pageCreate.page?.id || null, - errors: getMutationErrors(result) + errors: getMutationErrors(result), }; }; const handleSubmit = createMetadataCreateHandler( handleCreate, updateMetadata, - updatePrivateMetadata + updatePrivateMetadata, ); const handleAssignAttributeReferenceClick = (attribute: AttributeInput) => navigate( pageCreateUrl({ action: "assign-attribute-value", - id: attribute.id - }) + id: attribute.id, + }), ); const fetchMorePageTypes = { hasMore: searchPageTypesOpts.data?.search?.pageInfo?.hasNextPage, loading: searchPageTypesOpts.loading, - onFetchMore: loadMorePageTypes + onFetchMore: loadMorePageTypes, }; const fetchMoreReferencePages = { hasMore: searchPagesOpts.data?.search?.pageInfo?.hasNextPage, loading: searchPagesOpts.loading, - onFetchMore: loadMorePages + onFetchMore: loadMorePages, }; const fetchMoreReferenceProducts = { hasMore: searchProductsOpts.data?.search?.pageInfo?.hasNextPage, loading: searchProductsOpts.loading, - onFetchMore: loadMoreProducts + onFetchMore: loadMoreProducts, }; const fetchMoreAttributeValues = { hasMore: !!searchAttributeValuesOpts.data?.attribute?.choices?.pageInfo ?.hasNextPage, loading: !!searchAttributeValuesOpts.loading, - onFetchMore: loadMoreAttributeValues + onFetchMore: loadMoreAttributeValues, }; return ( @@ -184,7 +184,7 @@ export const PageCreate: React.FC = ({ params }) => { title={intl.formatMessage({ id: "mX7zJJ", defaultMessage: "Create Page", - description: "header" + description: "header", })} /> ({ attributes: prepareAttributesInput({ attributes: data.attributes, prevAttributes: getAttributeInputFromPage(page), - updatedFileAttributes + updatedFileAttributes, }), content: getParsedDataForJsonStringField(data.content), isPublished: data.isPublished, publicationDate: data.publicationDate, seo: { description: data.seoDescription, - title: data.seoTitle + title: data.seoTitle, }, slug: data.slug === "" ? null : data.slug, - title: data.title + title: data.title, }); export const PageDetails: React.FC = ({ id, params }) => { @@ -85,8 +85,8 @@ export const PageDetails: React.FC = ({ id, params }) => { const pageDetails = usePageDetailsQuery({ variables: { id, - firstValues: VALUES_PAGINATE_BY - } + firstValues: VALUES_PAGINATE_BY, + }, }); const [uploadFile, uploadFileOpts] = useFileUploadMutation({}); @@ -95,7 +95,7 @@ export const PageDetails: React.FC = ({ id, params }) => { const [ deleteAttributeValue, - deleteAttributeValueOpts + deleteAttributeValueOpts, ] = useAttributeValueDeleteMutation({}); const [pageRemove, pageRemoveOpts] = usePageRemoveMutation({ @@ -103,19 +103,19 @@ export const PageDetails: React.FC = ({ id, params }) => { if (data.pageDelete.errors.length === 0) { notify({ status: "success", - text: intl.formatMessage(commonMessages.savedChanges) + text: intl.formatMessage(commonMessages.savedChanges), }); navigate(pageListUrl()); } - } + }, }); const handleAssignAttributeReferenceClick = (attribute: AttributeInput) => navigate( pageUrl(id, { action: "assign-attribute-value", - id: attribute.id - }) + id: attribute.id, + }), ); const handleUpdate = async (data: PageSubmitData) => { @@ -125,18 +125,18 @@ export const PageDetails: React.FC = ({ id, params }) => { const uploadFilesResult = await handleUploadMultipleFiles( data.attributesWithNewFileValue, - variables => uploadFile({ variables }) + variables => uploadFile({ variables }), ); const deleteAttributeValuesResult = await handleDeleteMultipleAttributeValues( data.attributesWithNewFileValue, pageDetails?.data?.page?.attributes, - variables => deleteAttributeValue({ variables }) + variables => deleteAttributeValue({ variables }), ); const updatedFileAttributes = getAttributesAfterFileAttributesUpdate( data.attributesWithNewFileValue, - uploadFilesResult + uploadFilesResult, ); const updateResult = await pageUpdate({ @@ -145,17 +145,17 @@ export const PageDetails: React.FC = ({ id, params }) => { input: createPageInput( data, pageDetails?.data?.page, - updatedFileAttributes + updatedFileAttributes, ), - firstValues: VALUES_PAGINATE_BY - } + firstValues: VALUES_PAGINATE_BY, + }, }); errors = [ ...errors, ...mergeFileUploadErrors(uploadFilesResult), ...mergeAttributeValueDeleteErrors(deleteAttributeValuesResult), - ...updateResult.data.pageUpdate.errors + ...updateResult.data.pageUpdate.errors, ]; return errors; @@ -165,28 +165,28 @@ export const PageDetails: React.FC = ({ id, params }) => { pageDetails.data?.page, handleUpdate, variables => updateMetadata({ variables }), - variables => updatePrivateMetadata({ variables }) + variables => updatePrivateMetadata({ variables }), ); const { loadMore: loadMorePages, search: searchPages, - result: searchPagesOpts + result: searchPagesOpts, } = usePageSearch({ - variables: DEFAULT_INITIAL_SEARCH_DATA + variables: DEFAULT_INITIAL_SEARCH_DATA, }); const { loadMore: loadMoreProducts, search: searchProducts, - result: searchProductsOpts + result: searchProductsOpts, } = useProductSearch({ - variables: DEFAULT_INITIAL_SEARCH_DATA + variables: DEFAULT_INITIAL_SEARCH_DATA, }); const { loadMore: loadMoreAttributeValues, search: searchAttributeValues, result: searchAttributeValuesOpts, - reset: searchAttributeReset + reset: searchAttributeReset, } = useAttributeValueSearchHandler(DEFAULT_INITIAL_SEARCH_DATA); const attributeValues = @@ -195,18 +195,18 @@ export const PageDetails: React.FC = ({ id, params }) => { const fetchMoreReferencePages = { hasMore: searchPagesOpts.data?.search?.pageInfo?.hasNextPage, loading: searchPagesOpts.loading, - onFetchMore: loadMorePages + onFetchMore: loadMorePages, }; const fetchMoreReferenceProducts = { hasMore: searchProductsOpts.data?.search?.pageInfo?.hasNextPage, loading: searchProductsOpts.loading, - onFetchMore: loadMoreProducts + onFetchMore: loadMoreProducts, }; const fetchMoreAttributeValues = { hasMore: !!searchAttributeValuesOpts.data?.attribute?.choices?.pageInfo ?.hasNextPage, loading: !!searchAttributeValuesOpts.loading, - onFetchMore: loadMoreAttributeValues + onFetchMore: loadMoreAttributeValues, }; return ( @@ -226,8 +226,8 @@ export const PageDetails: React.FC = ({ id, params }) => { onRemove={() => navigate( pageUrl(id, { - action: "remove" - }) + action: "remove", + }), ) } onSubmit={handleSubmit} @@ -254,7 +254,7 @@ export const PageDetails: React.FC = ({ id, params }) => { title={intl.formatMessage({ id: "C1luwg", defaultMessage: "Delete Page", - description: "dialog header" + description: "dialog header", })} onClose={() => navigate(pageUrl(id))} onConfirm={() => pageRemove({ variables: { id } })} @@ -270,7 +270,7 @@ export const PageDetails: React.FC = ({ id, params }) => { {getStringOrPlaceholder(pageDetails.data?.page?.title)} - ) + ), }} /> diff --git a/src/pages/views/PageList/PageList.tsx b/src/pages/views/PageList/PageList.tsx index 7cd0ac807..f96bac6bb 100644 --- a/src/pages/views/PageList/PageList.tsx +++ b/src/pages/views/PageList/PageList.tsx @@ -4,7 +4,7 @@ import { Button } from "@saleor/components/Button"; import { usePageBulkPublishMutation, usePageBulkRemoveMutation, - usePageListQuery + usePageListQuery, } from "@saleor/graphql"; import useBulkActions from "@saleor/hooks/useBulkActions"; import useListSettings from "@saleor/hooks/useListSettings"; @@ -13,7 +13,7 @@ import useNotifier from "@saleor/hooks/useNotifier"; import { usePaginationReset } from "@saleor/hooks/usePaginationReset"; import usePaginator, { createPaginationState, - PaginatorContext + PaginatorContext, } from "@saleor/hooks/usePaginator"; import { DeleteIcon, IconButton } from "@saleor/macaw-ui"; import { maybe } from "@saleor/misc"; @@ -29,7 +29,7 @@ import PageListPage from "../../components/PageListPage/PageListPage"; import { pageListUrl, PageListUrlDialog, - PageListUrlQueryParams + PageListUrlQueryParams, } from "../../urls"; import { getFilterVariables, getSortQueryVariables } from "./sort"; @@ -41,10 +41,10 @@ export const PageList: React.FC = ({ params }) => { const navigate = useNavigator(); const notify = useNotifier(); const { isSelected, listElements, reset, toggle, toggleAll } = useBulkActions( - params.ids + params.ids, ); const { updateListSettings, settings } = useListSettings( - ListViews.PAGES_LIST + ListViews.PAGES_LIST, ); usePaginationReset(pageListUrl, params, settings.rowNumber); @@ -56,19 +56,19 @@ export const PageList: React.FC = ({ params }) => { () => ({ ...paginationState, filter: getFilterVariables(params), - sort: getSortQueryVariables(params) + sort: getSortQueryVariables(params), }), - [params, settings.rowNumber] + [params, settings.rowNumber], ); const { data, loading, refetch } = usePageListQuery({ displayLoader: true, - variables: queryVariables + variables: queryVariables, }); const paginationValues = usePaginator({ pageInfo: maybe(() => data.pages.pageInfo), paginationState, - queryString: params + queryString: params, }); const [openModal, closeModal] = createDialogActionHandlers< @@ -85,13 +85,13 @@ export const PageList: React.FC = ({ params }) => { text: intl.formatMessage({ id: "41z2Qi", defaultMessage: "Removed pages", - description: "notification" - }) + description: "notification", + }), }); reset(); refetch(); } - } + }, }); const [bulkPagePublish, bulkPagePublishOpts] = usePageBulkPublishMutation({ @@ -103,13 +103,13 @@ export const PageList: React.FC = ({ params }) => { text: intl.formatMessage({ id: "AzshS2", defaultMessage: "Published pages", - description: "notification" - }) + description: "notification", + }), }); reset(); refetch(); } - } + }, }); const handleSort = createSortHandler(navigate, pageListUrl, params); @@ -124,7 +124,7 @@ export const PageList: React.FC = ({ params }) => { onSort={handleSort} actionDialogOpts={{ open: openModal, - close: closeModal + close: closeModal, }} params={params} toolbar={ @@ -132,7 +132,7 @@ export const PageList: React.FC = ({ params }) => {
diff --git a/src/permissionGroups/components/PermissionGroupDeleteDialog/PermissionGroupDeleteDialog.stories.tsx b/src/permissionGroups/components/PermissionGroupDeleteDialog/PermissionGroupDeleteDialog.stories.tsx index f7c5e5ce8..612038bb6 100644 --- a/src/permissionGroups/components/PermissionGroupDeleteDialog/PermissionGroupDeleteDialog.stories.tsx +++ b/src/permissionGroups/components/PermissionGroupDeleteDialog/PermissionGroupDeleteDialog.stories.tsx @@ -1,9 +1,9 @@ import { PermissionGroupErrorCode, - PermissionGroupErrorFragment + PermissionGroupErrorFragment, } from "@saleor/graphql"; import PermissionGroupDeleteDialog, { - PermissionDeleteDialogProps + PermissionDeleteDialogProps, } from "@saleor/permissionGroups/components/PermissionGroupDeleteDialog"; import Decorator from "@saleor/storybook/Decorator"; import { storiesOf } from "@storybook/react"; @@ -13,14 +13,14 @@ const permissionsError: PermissionGroupErrorFragment = { __typename: "PermissionGroupError", code: PermissionGroupErrorCode.OUT_OF_SCOPE_PERMISSION, field: null, - message: "Permission out of scope" + message: "Permission out of scope", }; const requiredError: PermissionGroupErrorFragment = { __typename: "PermissionGroupError", code: PermissionGroupErrorCode.REQUIRED, field: null, - message: "Permission required" + message: "Permission required", }; const props: PermissionDeleteDialogProps = { @@ -28,7 +28,7 @@ const props: PermissionDeleteDialogProps = { name: "Full Access", onClose: () => undefined, onConfirm: () => undefined, - open: true + open: true, }; storiesOf("Views / Permission Groups / Permission Group Delete", module) diff --git a/src/permissionGroups/components/PermissionGroupDeleteDialog/PermissionGroupDeleteDialog.tsx b/src/permissionGroups/components/PermissionGroupDeleteDialog/PermissionGroupDeleteDialog.tsx index 1657a6c10..10d26c681 100644 --- a/src/permissionGroups/components/PermissionGroupDeleteDialog/PermissionGroupDeleteDialog.tsx +++ b/src/permissionGroups/components/PermissionGroupDeleteDialog/PermissionGroupDeleteDialog.tsx @@ -2,7 +2,7 @@ import { DialogContentText, Typography } from "@material-ui/core"; import ActionDialog from "@saleor/components/ActionDialog"; import { PermissionGroupErrorCode, - PermissionGroupErrorFragment + PermissionGroupErrorFragment, } from "@saleor/graphql"; import { ConfirmButtonTransitionState } from "@saleor/macaw-ui"; import getPermissionGroupErrorMessage from "@saleor/utils/errors/permissionGroups"; @@ -24,7 +24,7 @@ const PermissionGroupDeleteDialog: React.FC = ({ name, onClose, onConfirm, - open + open, }) => { const intl = useIntl(); @@ -34,7 +34,7 @@ const PermissionGroupDeleteDialog: React.FC = ({ id: "O22NIZ", defaultMessage: "Cant's delete group which is out of your permission scope", - description: "deletion error message" + description: "deletion error message", }); } else if (!!error) { errorMessage = getPermissionGroupErrorMessage(error, intl); @@ -49,7 +49,7 @@ const PermissionGroupDeleteDialog: React.FC = ({ title={intl.formatMessage({ id: "L6+p8a", defaultMessage: "Delete permission group", - description: "dialog title" + description: "dialog title", })} variant="delete" > @@ -59,7 +59,7 @@ const PermissionGroupDeleteDialog: React.FC = ({ defaultMessage="Are you sure you want to delete {name}?" description="dialog content" values={{ - name: {name} + name: {name}, }} /> diff --git a/src/permissionGroups/components/PermissionGroupDetailsPage/PermissionGroupDetailsPage.stories.tsx b/src/permissionGroups/components/PermissionGroupDetailsPage/PermissionGroupDetailsPage.stories.tsx index f3593bbe1..0e872f43b 100644 --- a/src/permissionGroups/components/PermissionGroupDetailsPage/PermissionGroupDetailsPage.stories.tsx +++ b/src/permissionGroups/components/PermissionGroupDetailsPage/PermissionGroupDetailsPage.stories.tsx @@ -1,11 +1,11 @@ import { permissions } from "@saleor/fixtures"; import PermissionGroupDetailsPage, { - PermissionGroupDetailsPageProps + PermissionGroupDetailsPageProps, } from "@saleor/permissionGroups/components/PermissionGroupDetailsPage"; import { emptyPermissionGroup, permissionGroup, - users + users, } from "@saleor/permissionGroups/fixtures"; import Decorator from "@saleor/storybook/Decorator"; import { storiesOf } from "@storybook/react"; @@ -29,7 +29,7 @@ const props: PermissionGroupDetailsPageProps = { sort: null, toggle: () => undefined, toggleAll: () => undefined, - toolbar: null + toolbar: null, }; storiesOf("Views / Permission Groups / Permission Group Details", module) diff --git a/src/permissionGroups/components/PermissionGroupDetailsPage/PermissionGroupDetailsPage.tsx b/src/permissionGroups/components/PermissionGroupDetailsPage/PermissionGroupDetailsPage.tsx index e3009647d..580118077 100644 --- a/src/permissionGroups/components/PermissionGroupDetailsPage/PermissionGroupDetailsPage.tsx +++ b/src/permissionGroups/components/PermissionGroupDetailsPage/PermissionGroupDetailsPage.tsx @@ -10,7 +10,7 @@ import { PermissionEnum, PermissionGroupDetailsFragment, PermissionGroupErrorFragment, - UserPermissionFragment + UserPermissionFragment, } from "@saleor/graphql"; import { SubmitPromise } from "@saleor/hooks/useForm"; import useNavigator from "@saleor/hooks/useNavigator"; @@ -18,11 +18,11 @@ import { sectionNames } from "@saleor/intl"; import { ConfirmButtonTransitionState } from "@saleor/macaw-ui"; import { MembersListUrlSortField, - permissionGroupListUrl + permissionGroupListUrl, } from "@saleor/permissionGroups/urls"; import { extractPermissionCodes, - isGroupFullAccess + isGroupFullAccess, } from "@saleor/permissionGroups/utils"; import { ListActions, SortPage } from "@saleor/types"; import { getFormErrors } from "@saleor/utils/errors"; @@ -83,13 +83,13 @@ const PermissionGroupDetailsPage: React.FC = ({ isActive: false, name: permissionGroup?.name || "", permissions: extractPermissionCodes(permissionGroup), - users: members + users: members, }; const formErrors = getFormErrors(["addPermissions"], errors); const permissionsError = getPermissionGroupErrorMessage( formErrors.addPermissions, - intl + intl, ); return ( @@ -127,13 +127,13 @@ const PermissionGroupDetailsPage: React.FC = ({ fullAccessLabel={intl.formatMessage({ id: "mAabef", defaultMessage: "Group has full access to the store", - description: "checkbox label" + description: "checkbox label", })} description={intl.formatMessage({ id: "CYZse9", defaultMessage: "Expand or restrict group's permissions to access certain part of saleor system.", - description: "card description" + description: "card description", })} />
diff --git a/src/permissionGroups/components/PermissionGroupInfo/PermissionGroupInfo.tsx b/src/permissionGroups/components/PermissionGroupInfo/PermissionGroupInfo.tsx index 237466437..bc493c1d6 100644 --- a/src/permissionGroups/components/PermissionGroupInfo/PermissionGroupInfo.tsx +++ b/src/permissionGroups/components/PermissionGroupInfo/PermissionGroupInfo.tsx @@ -21,7 +21,7 @@ const PermissionGroupInfo: React.FC = ({ disabled, onChange, data, - errors + errors, }) => { const intl = useIntl(); @@ -38,7 +38,7 @@ const PermissionGroupInfo: React.FC = ({ label={intl.formatMessage({ id: "rs815i", defaultMessage: "Group name", - description: "text field label" + description: "text field label", })} value={data.name} onChange={onChange} diff --git a/src/permissionGroups/components/PermissionGroupList/PermissionGroupList.tsx b/src/permissionGroups/components/PermissionGroupList/PermissionGroupList.tsx index 7fddba57b..e13fd3306 100644 --- a/src/permissionGroups/components/PermissionGroupList/PermissionGroupList.tsx +++ b/src/permissionGroups/components/PermissionGroupList/PermissionGroupList.tsx @@ -3,7 +3,7 @@ import { TableCell, TableFooter, TableHead, - TableRow + TableRow, } from "@material-ui/core"; import ResponsiveTable from "@saleor/components/ResponsiveTable"; import Skeleton from "@saleor/components/Skeleton"; @@ -16,7 +16,7 @@ import { DeleteIcon, IconButton, makeStyles } from "@saleor/macaw-ui"; import { maybe, renderCollection, stopPropagation } from "@saleor/misc"; import { permissionGroupDetailsUrl, - PermissionGroupListUrlSortField + PermissionGroupListUrlSortField, } from "@saleor/permissionGroups/urls"; import { ListProps, SortPage } from "@saleor/types"; import { getArrowDirection } from "@saleor/utils/sort"; @@ -27,33 +27,33 @@ const useStyles = makeStyles( theme => ({ [theme.breakpoints.up("lg")]: { colActions: { - width: 180 + width: 180, }, colMembers: { - width: 180 + width: 180, }, colName: { - width: "auto" - } + width: "auto", + }, }, colActions: { paddingRight: theme.spacing(), - textAlign: "right" + textAlign: "right", }, colActionsHeader: { - textAlign: "right" + textAlign: "right", }, colMembers: { - textAlign: "right" + textAlign: "right", }, colName: { - paddingLeft: 0 + paddingLeft: 0, }, link: { - cursor: "pointer" - } + cursor: "pointer", + }, }), - { name: "PermissionGroupList" } + { name: "PermissionGroupList" }, ); const numberOfColumns = 3; @@ -143,7 +143,7 @@ const PermissionGroupList: React.FC = props => { data-test-id="delete-icon" color="primary" onClick={stopPropagation(() => - onDelete(permissionGroup.id) + onDelete(permissionGroup.id), )} > @@ -166,7 +166,7 @@ const PermissionGroupList: React.FC = props => { /> - ) + ), )} diff --git a/src/permissionGroups/components/PermissionGroupListPage/PermissionGroupListPage.stories.tsx b/src/permissionGroups/components/PermissionGroupListPage/PermissionGroupListPage.stories.tsx index 37a773007..2c6f4b607 100644 --- a/src/permissionGroups/components/PermissionGroupListPage/PermissionGroupListPage.stories.tsx +++ b/src/permissionGroups/components/PermissionGroupListPage/PermissionGroupListPage.stories.tsx @@ -1,10 +1,10 @@ import { listActionsProps, pageListProps, - sortPageProps + sortPageProps, } from "@saleor/fixtures"; import PermissionGroupListPage, { - PermissionGroupListPageProps + PermissionGroupListPageProps, } from "@saleor/permissionGroups/components/PermissionGroupListPage"; import { permissionGroups } from "@saleor/permissionGroups/fixtures"; import { PermissionGroupListUrlSortField } from "@saleor/permissionGroups/urls"; @@ -22,8 +22,8 @@ const props: PermissionGroupListPageProps = { onDelete: () => undefined, sort: { ...sortPageProps.sort, - sort: PermissionGroupListUrlSortField.name - } + sort: PermissionGroupListUrlSortField.name, + }, }; storiesOf("Views / Permission Groups / Permission Group List", module) diff --git a/src/permissionGroups/components/PermissionGroupListPage/PermissionGroupListPage.tsx b/src/permissionGroups/components/PermissionGroupListPage/PermissionGroupListPage.tsx index 10f97cae2..4ac699122 100644 --- a/src/permissionGroups/components/PermissionGroupListPage/PermissionGroupListPage.tsx +++ b/src/permissionGroups/components/PermissionGroupListPage/PermissionGroupListPage.tsx @@ -12,7 +12,7 @@ import { FormattedMessage, useIntl } from "react-intl"; import { PageListProps, SortPage } from "../../../types"; import { permissionGroupAddUrl, - PermissionGroupListUrlSortField + PermissionGroupListUrlSortField, } from "../../urls"; import PermissionGroupList from "../PermissionGroupList"; diff --git a/src/permissionGroups/components/PermissionGroupMemberList/PermissionGroupMemberList.tsx b/src/permissionGroups/components/PermissionGroupMemberList/PermissionGroupMemberList.tsx index 2c1340ae5..b1f388224 100644 --- a/src/permissionGroups/components/PermissionGroupMemberList/PermissionGroupMemberList.tsx +++ b/src/permissionGroups/components/PermissionGroupMemberList/PermissionGroupMemberList.tsx @@ -4,7 +4,7 @@ import { TableBody, TableCell, TableRow, - Typography + Typography, } from "@material-ui/core"; import { Button } from "@saleor/components/Button"; import CardTitle from "@saleor/components/CardTitle"; @@ -19,7 +19,7 @@ import { getUserInitials, getUserName, renderCollection, - stopPropagation + stopPropagation, } from "@saleor/misc"; import { sortMembers } from "@saleor/permissionGroups/sort"; import { MembersListUrlSortField } from "@saleor/permissionGroups/urls"; @@ -33,14 +33,14 @@ const useStyles = makeStyles( theme => ({ [theme.breakpoints.up("lg")]: { colActions: { - width: 120 + width: 120, }, colEmail: { - width: 300 + width: 300, }, colName: { - width: "auto" - } + width: "auto", + }, }, avatar: { alignItems: "center", @@ -51,35 +51,35 @@ const useStyles = makeStyles( justifyContent: "center", marginRight: theme.spacing(1), overflow: "hidden", - width: 47 + width: 47, }, avatarDefault: { "& div": { color: theme.palette.primary.contrastText, - lineHeight: "47px" + lineHeight: "47px", }, background: theme.palette.primary.main, height: 47, textAlign: "center", - width: 47 + width: 47, }, avatarImage: { pointerEvents: "none", - width: "100%" + width: "100%", }, colActions: { paddingRight: theme.spacing(), - textAlign: "right" + textAlign: "right", }, helperText: { - textAlign: "center" + textAlign: "center", }, statusText: { - color: "#9E9D9D" + color: "#9E9D9D", }, - tableRow: {} + tableRow: {}, }), - { name: "PermissionGroup" } + { name: "PermissionGroup" }, ); const numberOfColumns = 4; @@ -104,7 +104,7 @@ const PermissionGroupMemberList: React.FC = props => { isChecked, selected, toggleAll, - sort + sort, } = props; const classes = useStyles(props); @@ -118,7 +118,7 @@ const PermissionGroupMemberList: React.FC = props => { title={intl.formatMessage({ id: "lGlDEH", defaultMessage: "Group members", - description: "header" + description: "header", })} toolbar={ } @@ -196,7 +196,7 @@ export const PermissionGroupDetails: React.FC = ({ onSubmit={formData => { setMembersList([ ...membersList, - ...formData.filter(member => !membersList.includes(member)) + ...formData.filter(member => !membersList.includes(member)), ]); setMembersModified(true); closeModal(); diff --git a/src/permissionGroups/views/PermissionGroupList/PermissionGroupList.tsx b/src/permissionGroups/views/PermissionGroupList/PermissionGroupList.tsx index 2b4275f3f..c6d5e7b7a 100644 --- a/src/permissionGroups/views/PermissionGroupList/PermissionGroupList.tsx +++ b/src/permissionGroups/views/PermissionGroupList/PermissionGroupList.tsx @@ -1,7 +1,7 @@ import { PermissionGroupErrorFragment, usePermissionGroupDeleteMutation, - usePermissionGroupListQuery + usePermissionGroupListQuery, } from "@saleor/graphql"; import useListSettings from "@saleor/hooks/useListSettings"; import useNavigator from "@saleor/hooks/useNavigator"; @@ -9,7 +9,7 @@ import useNotifier from "@saleor/hooks/useNotifier"; import { usePaginationReset } from "@saleor/hooks/usePaginationReset"; import usePaginator, { createPaginationState, - PaginatorContext + PaginatorContext, } from "@saleor/hooks/usePaginator"; import { getStringOrPlaceholder } from "@saleor/misc"; import PermissionGroupDeleteDialog from "@saleor/permissionGroups/components/PermissionGroupDeleteDialog"; @@ -25,7 +25,7 @@ import PermissionGroupListPage from "../../components/PermissionGroupListPage"; import { permissionGroupListUrl, PermissionGroupListUrlDialog, - PermissionGroupListUrlQueryParams + PermissionGroupListUrlQueryParams, } from "../../urls"; import { getSortQueryVariables } from "./sort"; @@ -34,13 +34,13 @@ interface PermissionGroupListProps { } export const PermissionGroupList: React.FC = ({ - params + params, }) => { const navigate = useNavigator(); const notify = useNotifier(); const intl = useIntl(); const { updateListSettings, settings } = useListSettings( - ListViews.STAFF_MEMBERS_LIST + ListViews.STAFF_MEMBERS_LIST, ); usePaginationReset(permissionGroupListUrl, params, settings.rowNumber); @@ -49,25 +49,25 @@ export const PermissionGroupList: React.FC = ({ const queryVariables = React.useMemo( () => ({ ...paginationState, - sort: getSortQueryVariables(params) + sort: getSortQueryVariables(params), }), - [params, settings.rowNumber] + [params, settings.rowNumber], ); const { data, loading, refetch } = usePermissionGroupListQuery({ displayLoader: true, - variables: queryVariables + variables: queryVariables, }); const paginationValues = usePaginator({ pageInfo: data?.permissionGroups.pageInfo, paginationState, - queryString: params + queryString: params, }); const handleSort = createSortHandler( navigate, permissionGroupListUrl, - params + params, ); const [openModal, closeModal] = createDialogActionHandlers< @@ -87,8 +87,8 @@ export const PermissionGroupList: React.FC = ({ status: "success", text: intl.formatMessage({ id: "DovGIa", - defaultMessage: "Permission Group Deleted" - }) + defaultMessage: "Permission Group Deleted", + }), }); refetch(); setDeleteError(undefined); @@ -96,7 +96,7 @@ export const PermissionGroupList: React.FC = ({ } else { setDeleteError(data.permissionGroupDelete.errors[0]); } - } + }, }); return ( @@ -114,13 +114,13 @@ export const PermissionGroupList: React.FC = ({ onConfirm={() => permissionGroupDelete({ variables: { - id: params.id - } + id: params.id, + }, }) } error={deleteError} name={getStringOrPlaceholder( - permissionGroups?.find(group => group.id === params.id)?.name + permissionGroups?.find(group => group.id === params.id)?.name, )} confirmButtonState={"default"} open={params.action === "remove"} diff --git a/src/permissionGroups/views/PermissionGroupList/sort.ts b/src/permissionGroups/views/PermissionGroupList/sort.ts index 150394868..83f1aa5e9 100644 --- a/src/permissionGroups/views/PermissionGroupList/sort.ts +++ b/src/permissionGroups/views/PermissionGroupList/sort.ts @@ -3,7 +3,7 @@ import { PermissionGroupListUrlSortField } from "@saleor/permissionGroups/urls"; import { createGetSortQueryVariables } from "@saleor/utils/sort"; export function getSortQueryField( - sort: PermissionGroupListUrlSortField + sort: PermissionGroupListUrlSortField, ): PermissionGroupSortField { switch (sort) { case PermissionGroupListUrlSortField.name: @@ -14,5 +14,5 @@ export function getSortQueryField( } export const getSortQueryVariables = createGetSortQueryVariables( - getSortQueryField + getSortQueryField, ); diff --git a/src/plugins/components/PluginAuthorization/PluginAuthorization.tsx b/src/plugins/components/PluginAuthorization/PluginAuthorization.tsx index 355b4eab8..9e82ec805 100644 --- a/src/plugins/components/PluginAuthorization/PluginAuthorization.tsx +++ b/src/plugins/components/PluginAuthorization/PluginAuthorization.tsx @@ -4,7 +4,7 @@ import CardTitle from "@saleor/components/CardTitle"; import Hr from "@saleor/components/Hr"; import { ConfigurationItemFragment, - ConfigurationTypeFieldEnum + ConfigurationTypeFieldEnum, } from "@saleor/graphql"; import { buttonMessages } from "@saleor/intl"; import { makeStyles } from "@saleor/macaw-ui"; @@ -21,20 +21,20 @@ interface PluginAuthorizationProps { const useStyles = makeStyles( theme => ({ button: { - marginLeft: theme.spacing() + marginLeft: theme.spacing(), }, hr: { - margin: theme.spacing(2, 0) + margin: theme.spacing(2, 0), }, item: { alignItems: "center", - display: "flex" + display: "flex", }, spacer: { - flex: 1 - } + flex: 1, + }, }), - { name: "PluginAuthorization" } + { name: "PluginAuthorization" }, ); const PluginAuthorization: React.FC = props => { @@ -44,7 +44,7 @@ const PluginAuthorization: React.FC = props => { const intl = useIntl(); const secretFields = fields.filter(field => - isSecretField(fields, field.name) + isSecretField(fields, field.name), ); return ( @@ -53,7 +53,7 @@ const PluginAuthorization: React.FC = props => { title={intl.formatMessage({ id: "6aBkJm", defaultMessage: "Authorization", - description: "section header" + description: "section header", })} /> diff --git a/src/plugins/components/PluginDetailsChannelsCard/PluginDetailsChannelsCard.tsx b/src/plugins/components/PluginDetailsChannelsCard/PluginDetailsChannelsCard.tsx index 8802f3836..2c69d2b29 100644 --- a/src/plugins/components/PluginDetailsChannelsCard/PluginDetailsChannelsCard.tsx +++ b/src/plugins/components/PluginDetailsChannelsCard/PluginDetailsChannelsCard.tsx @@ -5,7 +5,7 @@ import React from "react"; import { useIntl } from "react-intl"; import PluginDetailsChannelsCardContent, { - PluginDetailsChannelsCardProps + PluginDetailsChannelsCardProps, } from "./PluginDetailsChannelsCardContent"; const PluginDetailsChannelsCard: React.FC = props => { diff --git a/src/plugins/components/PluginDetailsChannelsCard/PluginDetailsChannelsCardContent.tsx b/src/plugins/components/PluginDetailsChannelsCard/PluginDetailsChannelsCardContent.tsx index 42f142e92..5abb525ee 100644 --- a/src/plugins/components/PluginDetailsChannelsCard/PluginDetailsChannelsCardContent.tsx +++ b/src/plugins/components/PluginDetailsChannelsCard/PluginDetailsChannelsCardContent.tsx @@ -13,17 +13,17 @@ const useStyles = makeStyles( theme => ({ itemContainer: { position: "relative", - cursor: "pointer" + cursor: "pointer", }, itemActiveIndicator: { position: "absolute", left: 0, backgroundColor: theme.palette.primary.main, width: 2, - height: "100%" - } + height: "100%", + }, }), - { name: "PluginDetailsChannelsCardContent" } + { name: "PluginDetailsChannelsCardContent" }, ); export interface PluginDetailsChannelsCardProps { @@ -35,7 +35,7 @@ export interface PluginDetailsChannelsCardProps { const PluginDetailsChannelsCardContent: React.FC = ({ plugin, selectedChannelId, - setSelectedChannelId + setSelectedChannelId, }) => { const classes = useStyles({}); diff --git a/src/plugins/components/PluginDetailsChannelsCard/messages.ts b/src/plugins/components/PluginDetailsChannelsCard/messages.ts index eee2d7916..872c26c20 100644 --- a/src/plugins/components/PluginDetailsChannelsCard/messages.ts +++ b/src/plugins/components/PluginDetailsChannelsCard/messages.ts @@ -4,6 +4,6 @@ export const pluginDetailsChannelsCardMessages = defineMessages({ noChannelsSubtitle: { id: "Aeq79M", defaultMessage: "Plugin’s settings are set common across all channels", - description: "PluginDetailsChannelsCard no channels subtitle" - } + description: "PluginDetailsChannelsCard no channels subtitle", + }, }); diff --git a/src/plugins/components/PluginInfo/PluginInfo.tsx b/src/plugins/components/PluginInfo/PluginInfo.tsx index 78f8c528a..b03cf431b 100644 --- a/src/plugins/components/PluginInfo/PluginInfo.tsx +++ b/src/plugins/components/PluginInfo/PluginInfo.tsx @@ -23,14 +23,14 @@ interface PluginInfoProps { const useStyles = makeStyles( () => ({ status: { - paddingTop: 20 + paddingTop: 20, }, title: { fontSize: 14, - paddingTop: 10 - } + paddingTop: 10, + }, }), - { name: "PluginInfo" } + { name: "PluginInfo" }, ); const PluginInfo: React.FC = ({ @@ -38,13 +38,13 @@ const PluginInfo: React.FC = ({ description, errors, name, - onChange + onChange, }) => { const classes = useStyles({}); const intl = useIntl(); const misconfiguredError = errors.find( - err => err.code === PluginErrorCode.PLUGIN_MISCONFIGURED + err => err.code === PluginErrorCode.PLUGIN_MISCONFIGURED, ); return ( @@ -53,7 +53,7 @@ const PluginInfo: React.FC = ({ title={intl.formatMessage({ id: "w424P4", defaultMessage: "Plugin Information and Status", - description: "section header" + description: "section header", })} /> @@ -61,7 +61,7 @@ const PluginInfo: React.FC = ({ {intl.formatMessage({ id: "IUeGzv", defaultMessage: "Plugin Name", - description: "plugin name" + description: "plugin name", })} {name} @@ -79,14 +79,14 @@ const PluginInfo: React.FC = ({ {intl.formatMessage({ id: "bL/Wrc", defaultMessage: "Status", - description: "plugin status" + description: "plugin status", })} undefined, onConfirm: () => undefined, - open: true + open: true, }; storiesOf("Views / Plugins / Edit secret field", module) @@ -30,7 +30,7 @@ storiesOf("Views / Plugins / Edit secret field", module) {...props} field={{ ...props.field, - type: ConfigurationTypeFieldEnum.PASSWORD + type: ConfigurationTypeFieldEnum.PASSWORD, }} /> )); diff --git a/src/plugins/components/PluginSecretFieldDialog/PluginSecretFieldDialog.tsx b/src/plugins/components/PluginSecretFieldDialog/PluginSecretFieldDialog.tsx index b4b8a9996..8981e9f39 100644 --- a/src/plugins/components/PluginSecretFieldDialog/PluginSecretFieldDialog.tsx +++ b/src/plugins/components/PluginSecretFieldDialog/PluginSecretFieldDialog.tsx @@ -3,7 +3,7 @@ import { DialogActions, DialogContent, DialogTitle, - TextField + TextField, } from "@material-ui/core"; import BackButton from "@saleor/components/BackButton"; import ConfirmButton from "@saleor/components/ConfirmButton"; @@ -11,7 +11,7 @@ import Form from "@saleor/components/Form"; import Skeleton from "@saleor/components/Skeleton"; import { ConfigurationItemFragment, - ConfigurationTypeFieldEnum + ConfigurationTypeFieldEnum, } from "@saleor/graphql"; import { buttonMessages } from "@saleor/intl"; import { ConfirmButtonTransitionState } from "@saleor/macaw-ui"; @@ -34,12 +34,12 @@ const PluginSecretFieldDialog: React.FC = ({ field, onClose, onConfirm, - open + open, }) => { const intl = useIntl(); const initialForm: PluginSecretFieldDialogFormData = { - value: "" + value: "", }; return ( @@ -50,13 +50,13 @@ const PluginSecretFieldDialog: React.FC = ({ intl.formatMessage({ id: "qCH2eZ", defaultMessage: "Add Value to Authorization Field", - description: "header" + description: "header", }) ) : ( intl.formatMessage({ id: "Xy2T+y", defaultMessage: "Edit Authorization Field", - description: "header" + description: "header", }) ) ) : ( diff --git a/src/plugins/components/PluginSettings/PluginSettings.tsx b/src/plugins/components/PluginSettings/PluginSettings.tsx index c676dcbc4..b7ca847e1 100644 --- a/src/plugins/components/PluginSettings/PluginSettings.tsx +++ b/src/plugins/components/PluginSettings/PluginSettings.tsx @@ -3,14 +3,14 @@ import { CardContent, TextField, Tooltip, - Typography + Typography, } from "@material-ui/core"; import InfoIcon from "@material-ui/icons/Info"; import CardTitle from "@saleor/components/CardTitle"; import ControlledSwitch from "@saleor/components/ControlledSwitch"; import { ConfigurationItemFragment, - ConfigurationTypeFieldEnum + ConfigurationTypeFieldEnum, } from "@saleor/graphql"; import { makeStyles } from "@saleor/macaw-ui"; import { UserError } from "@saleor/types"; @@ -31,26 +31,26 @@ interface PluginSettingsProps { const useStyles = makeStyles( theme => ({ authItem: { - display: "flex" + display: "flex", }, button: { - marginRight: theme.spacing() + marginRight: theme.spacing(), }, item: { "&:not(:last-child)": { - marginBottom: theme.spacing(3) + marginBottom: theme.spacing(3), }, alignItems: "center", - display: "flex" + display: "flex", }, itemLabel: { - fontWeight: 500 + fontWeight: 500, }, spacer: { - flex: 1 - } + flex: 1, + }, }), - { name: "PluginSettings" } + { name: "PluginSettings" }, ); const PluginSettings: React.FC = ({ @@ -58,7 +58,7 @@ const PluginSettings: React.FC = ({ disabled, errors, onChange, - fields + fields, }) => { const classes = useStyles({}); const intl = useIntl(); @@ -69,13 +69,13 @@ const PluginSettings: React.FC = ({ title={intl.formatMessage({ id: "Egyh2T", defaultMessage: "Plugin Settings", - description: "section header" + description: "section header", })} /> {data.configuration.map(field => { const fieldData = fields.find( - configField => configField.name === field.name + configField => configField.name === field.name, ); return ( @@ -118,7 +118,7 @@ const PluginSettings: React.FC = ({ InputProps={{ rowsMax: 6, readOnly: - fieldData.type === ConfigurationTypeFieldEnum.OUTPUT + fieldData.type === ConfigurationTypeFieldEnum.OUTPUT, }} onFocus={event => { if (fieldData.type === ConfigurationTypeFieldEnum.OUTPUT) { diff --git a/src/plugins/components/PluginsDetailsPage/PluginsDetailsPage.tsx b/src/plugins/components/PluginsDetailsPage/PluginsDetailsPage.tsx index fe0eb2050..9fbf6cb24 100644 --- a/src/plugins/components/PluginsDetailsPage/PluginsDetailsPage.tsx +++ b/src/plugins/components/PluginsDetailsPage/PluginsDetailsPage.tsx @@ -9,7 +9,7 @@ import { ConfigurationItemInput, PluginConfigurationExtendedFragment, PluginErrorFragment, - PluginsDetailsFragment + PluginsDetailsFragment, } from "@saleor/graphql"; import { ChangeEvent, SubmitPromise } from "@saleor/hooks/useForm"; import useNavigator from "@saleor/hooks/useNavigator"; @@ -52,7 +52,7 @@ const PluginsDetailsPage: React.FC = ({ onEdit, onSubmit, selectedConfig, - setSelectedChannelId + setSelectedChannelId, }) => { const intl = useIntl(); const navigate = useNavigator(); @@ -61,12 +61,13 @@ const PluginsDetailsPage: React.FC = ({ active: selectedConfig?.active, configuration: selectedConfig?.configuration ?.filter( - field => !isSecretField(selectedConfig?.configuration || [], field.name) + field => + !isSecretField(selectedConfig?.configuration || [], field.name), ) .map(field => ({ ...field, - value: field.value || "" - })) + value: field.value || "", + })), }; const selectedChannelId = selectedConfig?.channel?.id; @@ -88,10 +89,10 @@ const PluginsDetailsPage: React.FC = ({ configItem.name === name ? { ...configItem, - value + value, } - : configItem - ) + : configItem, + ), }; set(newData); @@ -106,11 +107,11 @@ const PluginsDetailsPage: React.FC = ({ { id: "EtGDeK", defaultMessage: "{pluginName} Details", - description: "header" + description: "header", }, { - pluginName: getStringOrPlaceholder(plugin?.name) - } + pluginName: getStringOrPlaceholder(plugin?.name), + }, )} /> @@ -140,7 +141,7 @@ const PluginsDetailsPage: React.FC = ({ onChange={onChange} /> {selectedConfig?.configuration.some(field => - isSecretField(selectedConfig?.configuration, field.name) + isSecretField(selectedConfig?.configuration, field.name), ) && ( <> diff --git a/src/plugins/components/PluginsList/PluginAvailabilityStatus.tsx b/src/plugins/components/PluginsList/PluginAvailabilityStatus.tsx index 43e4f71d5..0a473eedd 100644 --- a/src/plugins/components/PluginsList/PluginAvailabilityStatus.tsx +++ b/src/plugins/components/PluginsList/PluginAvailabilityStatus.tsx @@ -6,7 +6,7 @@ import { useIntl } from "react-intl"; import { pluginAvailabilityStatusMessages as messages, - pluginStatusMessages + pluginStatusMessages, } from "./messages"; import { getActiveChannelConfigsCount } from "./utils"; @@ -15,14 +15,14 @@ interface PluginAvailabilityStatusProps { } const PluginAvailabilityStatus: React.FC = ({ - plugin: { globalConfiguration, channelConfigurations } + plugin: { globalConfiguration, channelConfigurations }, }) => { const intl = useIntl(); const isGlobalPlugin = isPluginGlobal(globalConfiguration); const activeChannelsCount = getActiveChannelConfigsCount( - channelConfigurations + channelConfigurations, ); const isStatusActive = isGlobalPlugin @@ -32,7 +32,7 @@ const PluginAvailabilityStatus: React.FC = ({ const globalPluginLabel = intl.formatMessage( isStatusActive ? pluginStatusMessages.active - : pluginStatusMessages.deactivated + : pluginStatusMessages.deactivated, ); return ( @@ -41,7 +41,7 @@ const PluginAvailabilityStatus: React.FC = ({ isGlobalPlugin ? globalPluginLabel : intl.formatMessage(messages.channelTitle, { - activeChannelsCount + activeChannelsCount, }) } color={isStatusActive ? "success" : "error"} diff --git a/src/plugins/components/PluginsList/PluginAvailabilityStatusPopup/GlobalConfigPluginPopupBody.tsx b/src/plugins/components/PluginsList/PluginAvailabilityStatusPopup/GlobalConfigPluginPopupBody.tsx index d728edf81..74985c610 100644 --- a/src/plugins/components/PluginsList/PluginAvailabilityStatusPopup/GlobalConfigPluginPopupBody.tsx +++ b/src/plugins/components/PluginsList/PluginAvailabilityStatusPopup/GlobalConfigPluginPopupBody.tsx @@ -7,7 +7,7 @@ import { useIntl } from "react-intl"; import { globalConfigPluginMessages as messages, - pluginStatusMessages + pluginStatusMessages, } from "../messages"; interface GlobalConfigPluginPopupBodyProps { @@ -15,7 +15,7 @@ interface GlobalConfigPluginPopupBodyProps { } const GlobalConfigPluginPopupBody: React.FC = ({ - plugin + plugin, }) => { const intl = useIntl(); @@ -35,7 +35,7 @@ const GlobalConfigPluginPopupBody: React.FC = label={intl.formatMessage( active ? pluginStatusMessages.active - : pluginStatusMessages.deactivated + : pluginStatusMessages.deactivated, )} /> diff --git a/src/plugins/components/PluginsList/PluginAvailabilityStatusPopup/PluginAvailabilityStatusPopup.tsx b/src/plugins/components/PluginsList/PluginAvailabilityStatusPopup/PluginAvailabilityStatusPopup.tsx index b0cf8b575..f1965c9f0 100644 --- a/src/plugins/components/PluginsList/PluginAvailabilityStatusPopup/PluginAvailabilityStatusPopup.tsx +++ b/src/plugins/components/PluginsList/PluginAvailabilityStatusPopup/PluginAvailabilityStatusPopup.tsx @@ -12,10 +12,10 @@ const useStyles = makeStyles( () => ({ container: { maxWidth: 500, - zIndex: 1000 - } + zIndex: 1000, + }, }), - { name: "PluginChannelsAvailabilityStatusPopup" } + { name: "PluginChannelsAvailabilityStatusPopup" }, ); interface PluginAvailabilityStatusPopupProps { @@ -27,7 +27,7 @@ interface PluginAvailabilityStatusPopupProps { const PluginAvailabilityStatusPopup: React.FC = ({ plugin, isOpen, - anchor + anchor, }) => { const classes = useStyles({}); diff --git a/src/plugins/components/PluginsList/PluginAvailabilityStatusPopup/ScrollableContent.tsx b/src/plugins/components/PluginsList/PluginAvailabilityStatusPopup/ScrollableContent.tsx index def7945ba..f788a65a6 100644 --- a/src/plugins/components/PluginsList/PluginAvailabilityStatusPopup/ScrollableContent.tsx +++ b/src/plugins/components/PluginsList/PluginAvailabilityStatusPopup/ScrollableContent.tsx @@ -6,10 +6,10 @@ const useStyles = makeStyles( () => ({ container: { maxHeight: 450, - overflow: "auto" - } + overflow: "auto", + }, }), - { name: "ScrollableContent" } + { name: "ScrollableContent" }, ); interface ScrollableContentProps { diff --git a/src/plugins/components/PluginsList/PluginChannelAvailabilityCell.tsx b/src/plugins/components/PluginsList/PluginChannelAvailabilityCell.tsx index 4547729b9..dfa9695d3 100644 --- a/src/plugins/components/PluginsList/PluginChannelAvailabilityCell.tsx +++ b/src/plugins/components/PluginsList/PluginChannelAvailabilityCell.tsx @@ -11,7 +11,7 @@ interface PluginChannelAvailabilityCellProps { } const PluginChannelAvailabilityCell: React.FC = ({ - plugin + plugin, }) => { const [isPopupOpen, setIsPopupOpen] = useState(false); const popupAnchor = useRef(null); diff --git a/src/plugins/components/PluginsList/PluginChannelConfigurationCell.tsx b/src/plugins/components/PluginsList/PluginChannelConfigurationCell.tsx index d988a6d62..f821dfaf4 100644 --- a/src/plugins/components/PluginsList/PluginChannelConfigurationCell.tsx +++ b/src/plugins/components/PluginsList/PluginChannelConfigurationCell.tsx @@ -11,7 +11,7 @@ interface PluginChannelConfigurationCellProps { } const PluginChannelConfigurationCell: React.FC = ({ - plugin + plugin, }) => { const message = isPluginGlobal(plugin.globalConfiguration) ? messages.globalLabel diff --git a/src/plugins/components/PluginsList/PluginListTableHead.tsx b/src/plugins/components/PluginsList/PluginListTableHead.tsx index 4e5d8a7ad..09dd6d142 100644 --- a/src/plugins/components/PluginsList/PluginListTableHead.tsx +++ b/src/plugins/components/PluginsList/PluginListTableHead.tsx @@ -12,7 +12,7 @@ type PluginListTableHeadProps = SortPage; const PluginListTableHead: React.FC = ({ sort, - onSort + onSort, }) => { const intl = useIntl(); diff --git a/src/plugins/components/PluginsList/PluginsList.tsx b/src/plugins/components/PluginsList/PluginsList.tsx index aa7c26359..a3e088de0 100644 --- a/src/plugins/components/PluginsList/PluginsList.tsx +++ b/src/plugins/components/PluginsList/PluginsList.tsx @@ -18,10 +18,10 @@ import PluginListTableHead from "./PluginListTableHead"; export const useStyles = makeStyles( () => ({ link: { - cursor: "pointer" - } + cursor: "pointer", + }, }), - { name: "PluginsList" } + { name: "PluginsList" }, ); export interface PluginListProps @@ -39,7 +39,7 @@ const PluginList: React.FC = props => { disabled, sort, onSort, - onUpdateListSettings + onUpdateListSettings, } = props; const classes = useStyles(props); const navigate = useNavigator(); @@ -91,11 +91,11 @@ const PluginList: React.FC = props => { {intl.formatMessage({ id: "Co2U4u", - defaultMessage: "No plugins found" + defaultMessage: "No plugins found", })} - ) + ), )} diff --git a/src/plugins/components/PluginsList/messages.ts b/src/plugins/components/PluginsList/messages.ts index 3d3f77fd3..5ebb18d2d 100644 --- a/src/plugins/components/PluginsList/messages.ts +++ b/src/plugins/components/PluginsList/messages.ts @@ -5,8 +5,8 @@ export const pluginAvailabilityStatusMessages = defineMessages({ id: "HedXnw", defaultMessage: "{activeChannelsCount,plural, =0 {Deactivated} other {Active in {activeChannelsCount}}}", - description: "plugin channel availability status title" - } + description: "plugin channel availability status title", + }, }); export const channelConfigPluginMessages = defineMessages({ @@ -14,64 +14,64 @@ export const channelConfigPluginMessages = defineMessages({ id: "8u7els", defaultMessage: "Assigned to {activeChannelsCount} of {allChannelsCount} channels", - description: "channel config plugin status popup title" - } + description: "channel config plugin status popup title", + }, }); export const globalConfigPluginMessages = defineMessages({ title: { id: "T4wa2Y", defaultMessage: "Global Plugin", - description: "global config plugin status popup title" + description: "global config plugin status popup title", }, description: { id: "reP5Uf", defaultMessage: "Global plugins are set across all channels in your ecommerce. Only status is shown for those types of plugins", - description: "global config plugin status popup description" - } + description: "global config plugin status popup description", + }, }); export const pluginsListTableHeadMessages = defineMessages({ nameLabel: { id: "QH74y5", defaultMessage: "Name", - description: "table header name col label" + description: "table header name col label", }, confLabel: { id: "AijtXU", defaultMessage: "Configuration", - description: "table header configuration col label" + description: "table header configuration col label", }, channelLabel: { id: "ycrTBX", defaultMessage: "Channel", - description: "table header channel col label" - } + description: "table header channel col label", + }, }); export const pluginChannelConfigurationCellMessages = defineMessages({ globalLabel: { id: "xTIKA/", defaultMessage: "Global", - description: "PluginChannelConfigurationCell global title" + description: "PluginChannelConfigurationCell global title", }, channelLabel: { id: "gz9v22", defaultMessage: "Per channel", - description: "PluginChannelConfigurationCell channel title" - } + description: "PluginChannelConfigurationCell channel title", + }, }); export const pluginStatusMessages = defineMessages({ active: { id: "rQOS7K", defaultMessage: "Active", - description: "status label active" + description: "status label active", }, deactivated: { id: "ho75Lr", defaultMessage: "Deactivated", - description: "status label deactivated" - } + description: "status label deactivated", + }, }); diff --git a/src/plugins/components/PluginsList/utils.ts b/src/plugins/components/PluginsList/utils.ts index 57559f3cc..96653f011 100644 --- a/src/plugins/components/PluginsList/utils.ts +++ b/src/plugins/components/PluginsList/utils.ts @@ -6,28 +6,28 @@ import { MessageDescriptor } from "react-intl"; import { pluginStatusMessages } from "./messages"; export const getAllChannelConfigsCount = ( - channelConfigurations: PluginConfigurationBaseFragment[] + channelConfigurations: PluginConfigurationBaseFragment[], ) => channelConfigurations?.length; export const getActiveChannelConfigsCount = ( - channelConfigurations: PluginConfigurationBaseFragment[] + channelConfigurations: PluginConfigurationBaseFragment[], ) => channelConfigurations?.filter(({ active }) => !!active).length; export const getPluginStatusLabel = ( - channelData: PluginConfigurationBaseFragment + channelData: PluginConfigurationBaseFragment, ): MessageDescriptor => channelData.active ? pluginStatusMessages.active : pluginStatusMessages.deactivated; export const getPluginStatusColor = ( - channelData: PluginConfigurationBaseFragment + channelData: PluginConfigurationBaseFragment, ): PillColor => (channelData.active ? "success" : "error"); export const mapPluginsToPills = ( - channelConfigurations: PluginConfigurationBaseFragment[] + channelConfigurations: PluginConfigurationBaseFragment[], ): Pill[] => channelConfigurations.map(channel => ({ channel: channel.channel, color: getPluginStatusColor(channel), - label: getPluginStatusLabel(channel) + label: getPluginStatusLabel(channel), })); diff --git a/src/plugins/components/PluginsListPage/PluginsListPage.tsx b/src/plugins/components/PluginsListPage/PluginsListPage.tsx index 6cde4621a..e23e70df6 100644 --- a/src/plugins/components/PluginsListPage/PluginsListPage.tsx +++ b/src/plugins/components/PluginsListPage/PluginsListPage.tsx @@ -11,7 +11,7 @@ import { FilterPageProps, PageListProps, SortPage, - TabPageProps + TabPageProps, } from "@saleor/types"; import React from "react"; import { useIntl } from "react-intl"; @@ -20,7 +20,7 @@ import PluginsList from "../PluginsList/PluginsList"; import { createFilterStructure, PluginFilterKeys, - PluginListFilterOpts + PluginListFilterOpts, } from "./filters"; import { pluginsFilterErrorMessages } from "./messages"; @@ -70,12 +70,12 @@ const PluginsListPage: React.FC = ({ allTabLabel={intl.formatMessage({ id: "aOelhW", defaultMessage: "All Plugins", - description: "tab name" + description: "tab name", })} filterStructure={filterStructure} searchPlaceholder={intl.formatMessage({ id: "BtErCZ", - defaultMessage: "Search Plugins..." + defaultMessage: "Search Plugins...", })} /> diff --git a/src/plugins/components/PluginsListPage/filters.ts b/src/plugins/components/PluginsListPage/filters.ts index 50422e81b..4eef0eb4e 100644 --- a/src/plugins/components/PluginsListPage/filters.ts +++ b/src/plugins/components/PluginsListPage/filters.ts @@ -5,20 +5,20 @@ import { AutocompleteFilterOpts, FilterOpts } from "@saleor/types"; import { createAutocompleteField, createBooleanField, - createOptionsField + createOptionsField, } from "@saleor/utils/filters/fields"; import { defineMessages, IntlShape } from "react-intl"; import { pluginChannelConfigurationCellMessages, - pluginStatusMessages + pluginStatusMessages, } from "../PluginsList/messages"; export enum PluginFilterKeys { active = "active", channels = "channels", status = "status", - type = "type" + type = "type", } export interface PluginListFilterOpts { @@ -32,23 +32,23 @@ const messages = defineMessages({ channelStatusSectionTitle: { id: "TC/EOG", defaultMessage: "Status in channel", - description: "status section title" + description: "status section title", }, channelStatusSectionSubtitle: { id: "zQnYKn", defaultMessage: "Channel status", - description: "status section subtitle" + description: "status section subtitle", }, configTypeSectionTitle: { id: "cwoN25", defaultMessage: "Configuration Type", - description: "config type section title" - } + description: "config type section title", + }, }); export function createFilterStructure( intl: IntlShape, - opts: PluginListFilterOpts + opts: PluginListFilterOpts, ): IFilter { return [ { @@ -65,9 +65,9 @@ export function createFilterStructure( opts.isActive.value, { negative: intl.formatMessage(pluginStatusMessages.deactivated), - positive: intl.formatMessage(pluginStatusMessages.active) - } - ) + positive: intl.formatMessage(pluginStatusMessages.active), + }, + ), }, { required: true, @@ -83,11 +83,11 @@ export function createFilterStructure( initialSearch: "", loading: opts.channels.loading, onFetchMore: opts.channels.onFetchMore, - onSearchChange: opts.channels.onSearchChange - } - ) - } - ] + onSearchChange: opts.channels.onSearchChange, + }, + ), + }, + ], }, { active: opts.type.active, @@ -101,17 +101,17 @@ export function createFilterStructure( { value: PluginConfigurationType.GLOBAL, label: intl.formatMessage( - pluginChannelConfigurationCellMessages.globalLabel - ) + pluginChannelConfigurationCellMessages.globalLabel, + ), }, { value: PluginConfigurationType.PER_CHANNEL, label: intl.formatMessage( - pluginChannelConfigurationCellMessages.channelLabel - ) - } - ] - ) - } + pluginChannelConfigurationCellMessages.channelLabel, + ), + }, + ], + ), + }, ]; } diff --git a/src/plugins/components/PluginsListPage/messages.ts b/src/plugins/components/PluginsListPage/messages.ts index ee3a397bf..f2ebf0448 100644 --- a/src/plugins/components/PluginsListPage/messages.ts +++ b/src/plugins/components/PluginsListPage/messages.ts @@ -4,11 +4,11 @@ export const pluginsFilterErrorMessages = defineMessages({ active: { id: "T/dYnE", defaultMessage: "Status is not selected", - description: "plugin filters error messages status" + description: "plugin filters error messages status", }, channels: { id: "gZHmaV", defaultMessage: "No channels selected", - description: "plugin filters error messages channels" - } + description: "plugin filters error messages channels", + }, }); diff --git a/src/plugins/fixtures.ts b/src/plugins/fixtures.ts index 9fc65ebb4..67fa26746 100644 --- a/src/plugins/fixtures.ts +++ b/src/plugins/fixtures.ts @@ -1,7 +1,7 @@ import { ConfigurationTypeFieldEnum, PluginBaseFragment, - PluginsDetailsFragment + PluginsDetailsFragment, } from "@saleor/graphql"; export const pluginList: PluginBaseFragment[] = [ @@ -16,14 +16,14 @@ export const pluginList: PluginBaseFragment[] = [ __typename: "Channel", id: "channel-1", name: "channel 1", - slug: "channel-1" - } - } + slug: "channel-1", + }, + }, ], description: "Lorem ipsum dolor sit amet enim. Etiam ullamcorper. Suspendisse a pellentesque dui, non felis. Maecenas malesuada elit lectus felis, malesuada ultricies. Curabitur et ligula. Ut molestie a, ultricies porta urna. Vestibulum commodo volutpat a, convallis ac, laoreet enim. Phasellus fermentum in, dolor. Pellentesque facilisis. Nulla imperdiet sit amet magna.", id: "Jzx123sEt==", - name: "Avalara" + name: "Avalara", }, { __typename: "Plugin", @@ -36,15 +36,15 @@ export const pluginList: PluginBaseFragment[] = [ __typename: "Channel", id: "channel-1", name: "channel 1", - slug: "channel-1" - } - } + slug: "channel-1", + }, + }, ], description: "Lorem ipsum dolor sit amet enim. Etiam ullamcorper. Suspendisse a pellentesque dui, non felis. Maecenas malesuada elit lectus felis, malesuada ultricies. Curabitur et ligula. Ut molestie a, ultricies porta urna. Vestibulum commodo volutpat a, convallis ac, laoreet enim. Phasellus fermentum in, dolor. Pellentesque facilisis. Nulla imperdiet sit amet magna.", id: "Jzx123sEt==", - name: "VatLayer" - } + name: "VatLayer", + }, ]; export const plugin: PluginsDetailsFragment = { __typename: "Plugin", @@ -57,7 +57,7 @@ export const plugin: PluginsDetailsFragment = { __typename: "Channel", id: "channel-1", name: "channel 1", - slug: "channel-1" + slug: "channel-1", }, configuration: [ { @@ -66,7 +66,7 @@ export const plugin: PluginsDetailsFragment = { label: "Username or account", name: "Username or account", type: ConfigurationTypeFieldEnum.STRING, - value: "avatax_user" + value: "avatax_user", }, { __typename: "ConfigurationItem", @@ -74,7 +74,7 @@ export const plugin: PluginsDetailsFragment = { label: "Password or license", name: "Password or license", type: ConfigurationTypeFieldEnum.STRING, - value: "TEM8S2-2ET83-CGKP1-DPSI2-EPZO1" + value: "TEM8S2-2ET83-CGKP1-DPSI2-EPZO1", }, { __typename: "ConfigurationItem", @@ -82,7 +82,7 @@ export const plugin: PluginsDetailsFragment = { label: "API key", name: "apiKey", type: ConfigurationTypeFieldEnum.SECRET, - value: "9ab9" + value: "9ab9", }, { __typename: "ConfigurationItem", @@ -90,7 +90,7 @@ export const plugin: PluginsDetailsFragment = { label: "Password", name: "password", type: ConfigurationTypeFieldEnum.PASSWORD, - value: "" + value: "", }, { __typename: "ConfigurationItem", @@ -98,7 +98,7 @@ export const plugin: PluginsDetailsFragment = { label: "Empty Password", name: "password-not-set", type: ConfigurationTypeFieldEnum.PASSWORD, - value: null + value: null, }, { __typename: "ConfigurationItem", @@ -106,7 +106,7 @@ export const plugin: PluginsDetailsFragment = { label: "Use sandbox", name: "Use sandbox", type: ConfigurationTypeFieldEnum.BOOLEAN, - value: "true" + value: "true", }, { __typename: "ConfigurationItem", @@ -115,13 +115,13 @@ export const plugin: PluginsDetailsFragment = { name: "multiline-field", type: ConfigurationTypeFieldEnum.MULTILINE, value: - "Lorem ipsum\ndolor sit\namet enim.\nEtiam ullamcorper.\nSuspendisse a\npellentesque dui,\nnon felis." - } - ] - } + "Lorem ipsum\ndolor sit\namet enim.\nEtiam ullamcorper.\nSuspendisse a\npellentesque dui,\nnon felis.", + }, + ], + }, ], description: "Lorem ipsum dolor sit amet enim. Etiam ullamcorper. Suspendisse a pellentesque dui, non felis. Maecenas malesuada elit lectus felis, malesuada ultricies. Curabitur et ligula. Ut molestie a, ultricies porta urna. Vestibulum commodo volutpat a, convallis ac, laoreet enim. Phasellus fermentum in, dolor. Pellentesque facilisis. Nulla imperdiet sit amet magna.", id: "UGx1Z2luQ29uZmlndXJhdGlvbjoy", - name: "Username or account" + name: "Username or account", }; diff --git a/src/plugins/index.tsx b/src/plugins/index.tsx index 844ec4f1c..edb74a77f 100644 --- a/src/plugins/index.tsx +++ b/src/plugins/index.tsx @@ -11,7 +11,7 @@ import { PluginListUrlQueryParams, PluginListUrlSortField, pluginPath, - PluginUrlQueryParams + PluginUrlQueryParams, } from "./urls"; import PluginsListComponent from "./views/PluginList"; import PluginsDetailsComponent from "./views/PluginsDetails"; @@ -20,7 +20,7 @@ const PluginList: React.FC> = ({ location }) => { const qs = parseQs(location.search.substr(1)); const params: PluginListUrlQueryParams = asSortParams( qs, - PluginListUrlSortField + PluginListUrlSortField, ); return ; }; diff --git a/src/plugins/urls.ts b/src/plugins/urls.ts index 1087f3400..19b295f50 100644 --- a/src/plugins/urls.ts +++ b/src/plugins/urls.ts @@ -8,7 +8,7 @@ import { Pagination, SingleAction, Sort, - TabActionDialog + TabActionDialog, } from "../types"; export const pluginSection = "/plugins/"; @@ -19,7 +19,7 @@ export enum PluginListUrlFiltersEnum { query = "query", active = "active", channels = "channels", - type = "type" + type = "type", } export type PluginListUrlFilters = Filters & { @@ -28,7 +28,7 @@ export type PluginListUrlFilters = Filters & { export type PluginListUrlDialog = TabActionDialog; export enum PluginListUrlSortField { name = "name", - active = "active" + active = "active", } export type PluginListUrlSort = Sort; export type PluginListUrlQueryParams = ActiveTab & diff --git a/src/plugins/utils.ts b/src/plugins/utils.ts index 4f9ef93ee..78e573db6 100644 --- a/src/plugins/utils.ts +++ b/src/plugins/utils.ts @@ -1,15 +1,15 @@ import { ConfigurationItemFragment, - ConfigurationTypeFieldEnum + ConfigurationTypeFieldEnum, } from "@saleor/graphql"; export function isSecretField( config: ConfigurationItemFragment[], - field: string + field: string, ) { return [ ConfigurationTypeFieldEnum.PASSWORD, ConfigurationTypeFieldEnum.SECRET, - ConfigurationTypeFieldEnum.SECRETMULTILINE + ConfigurationTypeFieldEnum.SECRETMULTILINE, ].includes(config.find(configField => configField.name === field).type); } diff --git a/src/plugins/views/PluginDetails.test.ts b/src/plugins/views/PluginDetails.test.ts index c3c5b89f3..4e902a3c8 100644 --- a/src/plugins/views/PluginDetails.test.ts +++ b/src/plugins/views/PluginDetails.test.ts @@ -1,7 +1,7 @@ import { ConfigurationItemFragment, ConfigurationItemInput, - ConfigurationTypeFieldEnum + ConfigurationTypeFieldEnum, } from "@saleor/graphql"; import { getConfigurationInput } from "./PluginsDetails"; @@ -9,7 +9,7 @@ import { getConfigurationInput } from "./PluginsDetails"; const baseConfig: Omit = { __typename: "ConfigurationItem", helpText: "", - label: "" + label: "", }; const config: ConfigurationItemFragment[] = [ @@ -17,45 +17,45 @@ const config: ConfigurationItemFragment[] = [ ...baseConfig, name: "field-1", type: ConfigurationTypeFieldEnum.STRING, - value: "val1" + value: "val1", }, { ...baseConfig, name: "field-2", type: ConfigurationTypeFieldEnum.STRING, - value: "val2" + value: "val2", }, { ...baseConfig, name: "field-3", type: ConfigurationTypeFieldEnum.PASSWORD, - value: "" + value: "", }, { ...baseConfig, name: "field-4", type: ConfigurationTypeFieldEnum.SECRET, - value: "val4" - } + value: "val4", + }, ]; const input: ConfigurationItemInput[] = [ { name: "field-1", - value: "value1" + value: "value1", }, { name: "field-2", - value: "value2" + value: "value2", }, { name: "field-3", - value: "value3" + value: "value3", }, { name: "field-4", - value: "value4" - } + value: "value4", + }, ]; test("Ensure that no secret is sent in input", () => { @@ -66,15 +66,15 @@ test("Ensure that no secret is sent in input", () => { output.find( field => config.find(configField => configField.name === field.name).type === - ConfigurationTypeFieldEnum.PASSWORD - ) + ConfigurationTypeFieldEnum.PASSWORD, + ), ).toBeFalsy(); expect( output.find( field => config.find(configField => configField.name === field.name).type === - ConfigurationTypeFieldEnum.SECRET - ) + ConfigurationTypeFieldEnum.SECRET, + ), ).toBeFalsy(); }); diff --git a/src/plugins/views/PluginList/PluginList.tsx b/src/plugins/views/PluginList/PluginList.tsx index eab05d0f7..fcd921bc6 100644 --- a/src/plugins/views/PluginList/PluginList.tsx +++ b/src/plugins/views/PluginList/PluginList.tsx @@ -1,6 +1,6 @@ import DeleteFilterTabDialog from "@saleor/components/DeleteFilterTabDialog"; import SaveFilterTabDialog, { - SaveFilterTabDialogFormData + SaveFilterTabDialogFormData, } from "@saleor/components/SaveFilterTabDialog"; import { usePluginsQuery } from "@saleor/graphql"; import { useChannelsSearchWithLoadMore } from "@saleor/hooks/useChannelsSearchWithLoadMore"; @@ -9,7 +9,7 @@ import useNavigator from "@saleor/hooks/useNavigator"; import { usePaginationReset } from "@saleor/hooks/usePaginationReset"; import usePaginator, { createPaginationState, - PaginatorContext + PaginatorContext, } from "@saleor/hooks/usePaginator"; import { maybe } from "@saleor/misc"; import { ListViews } from "@saleor/types"; @@ -24,7 +24,7 @@ import PluginsListPage from "../../components/PluginsListPage/PluginsListPage"; import { pluginListUrl, PluginListUrlDialog, - PluginListUrlQueryParams + PluginListUrlQueryParams, } from "../../urls"; import { deleteFilterTab, @@ -34,7 +34,7 @@ import { getFiltersCurrentTab, getFilterTabs, getFilterVariables, - saveFilterTab + saveFilterTab, } from "./filters"; import { getSortQueryVariables } from "./sort"; @@ -45,7 +45,7 @@ interface PluginsListProps { export const PluginsList: React.FC = ({ params }) => { const navigate = useNavigator(); const { updateListSettings, settings } = useListSettings( - ListViews.PLUGINS_LIST + ListViews.PLUGINS_LIST, ); usePaginationReset(pluginListUrl, params, settings.rowNumber); @@ -55,13 +55,13 @@ export const PluginsList: React.FC = ({ params }) => { () => ({ ...paginationState, filter: getFilterVariables(params), - sort: getSortQueryVariables(params) + sort: getSortQueryVariables(params), }), - [params, settings.rowNumber] + [params, settings.rowNumber], ); const { data, loading } = usePluginsQuery({ displayLoader: true, - variables: queryVariables + variables: queryVariables, }); const tabs = getFilterTabs(); @@ -71,12 +71,12 @@ export const PluginsList: React.FC = ({ params }) => { const [ changeFilters, resetFilters, - handleSearchChange + handleSearchChange, ] = createFilterHandlers({ createUrl: pluginListUrl, getFilterQueryParam, navigate, - params + params, }); const [openModal, closeModal] = createDialogActionHandlers< @@ -88,8 +88,8 @@ export const PluginsList: React.FC = ({ params }) => { navigate( pluginListUrl({ activeTab: tab.toString(), - ...getFilterTabs()[tab - 1].data - }) + ...getFilterTabs()[tab - 1].data, + }), ); }; @@ -106,7 +106,7 @@ export const PluginsList: React.FC = ({ params }) => { const paginationValues = usePaginator({ pageInfo: maybe(() => data.plugins.pageInfo), paginationState, - queryString: params + queryString: params, }); const handleSort = createSortHandler(navigate, pluginListUrl, params); diff --git a/src/plugins/views/PluginList/filters.test.ts b/src/plugins/views/PluginList/filters.test.ts index e21a7dbfd..423a4bc1c 100644 --- a/src/plugins/views/PluginList/filters.test.ts +++ b/src/plugins/views/PluginList/filters.test.ts @@ -2,7 +2,7 @@ import { FieldType } from "@saleor/components/Filter"; import { PluginConfigurationType } from "@saleor/graphql"; import { createFilterStructure, - PluginFilterKeys + PluginFilterKeys, } from "@saleor/plugins/components/PluginsListPage"; import { PluginListUrlFilters } from "@saleor/plugins/urls"; import { getFilterQueryParams } from "@saleor/utils/filters"; @@ -23,7 +23,7 @@ describe("Filtering query params", () => { it("should not be empty object if params given", () => { const params: PluginListUrlFilters = { - type: PluginConfigurationType.GLOBAL + type: PluginConfigurationType.GLOBAL, }; const filterVariables = getFilterVariables(params); @@ -37,7 +37,7 @@ describe("Filtering URL params", () => { const filters = createFilterStructure(intl, { isActive: { active: false, - value: true + value: true, }, channels: { active: false, @@ -48,22 +48,22 @@ describe("Filtering URL params", () => { loading: false, onFetchMore: () => undefined, onSearchChange: () => undefined, - value: [] + value: [], }, status: { active: false, - value: false + value: false, }, type: { active: false, - value: PluginConfigurationType.GLOBAL - } + value: PluginConfigurationType.GLOBAL, + }, }); it("should be empty if no active filters", () => { const filterQueryParams = getFilterQueryParams( filters, - getFilterQueryParam + getFilterQueryParam, ); expect(getExistingKeys(filterQueryParams)).toHaveLength(0); @@ -78,7 +78,7 @@ describe("Filtering URL params", () => { label: "Active", multiple: false, active: true, - value: ["true"] + value: ["true"], }, { name: PluginFilterKeys.type, @@ -86,10 +86,10 @@ describe("Filtering URL params", () => { label: "Configuration type", multiple: false, active: true, - value: [PluginConfigurationType.GLOBAL] - } + value: [PluginConfigurationType.GLOBAL], + }, ], - getFilterQueryParam + getFilterQueryParam, ); expect(filterQueryParams).toMatchSnapshot(); diff --git a/src/plugins/views/PluginList/filters.ts b/src/plugins/views/PluginList/filters.ts index 9028bf2fe..f2e8c5415 100644 --- a/src/plugins/views/PluginList/filters.ts +++ b/src/plugins/views/PluginList/filters.ts @@ -4,7 +4,7 @@ import { ChannelsWithLoadMoreProps } from "@saleor/hooks/useChannelsSearch"; import { maybe, parseBoolean } from "@saleor/misc"; import { PluginFilterKeys, - PluginListFilterOpts + PluginListFilterOpts, } from "@saleor/plugins/components/PluginsListPage"; import { mapNodeToChoice } from "@saleor/utils/maps"; @@ -14,12 +14,12 @@ import { dedupeFilter, getMultipleValueQueryParam, getSingleEnumValueQueryParam, - getSingleValueQueryParam + getSingleValueQueryParam, } from "../../../utils/filters"; import { PluginListUrlFilters, PluginListUrlFiltersEnum, - PluginListUrlQueryParams + PluginListUrlQueryParams, } from "../../urls"; export const PLUGIN_FILTERS_KEY = "pluginFilters"; @@ -31,8 +31,8 @@ export function getFilterOpts( hasMore, onFetchMore, onSearchChange, - loading - }: ChannelsWithLoadMoreProps + loading, + }: ChannelsWithLoadMoreProps, ): PluginListFilterOpts { return { isActive: { @@ -40,7 +40,7 @@ export function getFilterOpts( value: params.active === undefined ? undefined - : parseBoolean(params.active, true) + : parseBoolean(params.active, true), }, channels: { active: !!params.channels, @@ -51,18 +51,18 @@ export function getFilterOpts( loading, onFetchMore, onSearchChange, - value: dedupeFilter(params.channels || []) + value: dedupeFilter(params.channels || []), }, type: { active: !!params.type, - value: getParsedConfigType(params.type) + value: getParsedConfigType(params.type), }, status: { active: !!params.channels?.length && params.active !== undefined, value: !!dedupeFilter(params.channels || [])?.length && - params.active !== undefined - } + params.active !== undefined, + }, }; } @@ -70,11 +70,11 @@ const getParsedConfigType = (configTypeString?: string) => PluginConfigurationType[configTypeString] || undefined; export function getFilterVariables( - params: PluginListUrlFilters + params: PluginListUrlFilters, ): PluginFilterInput { const baseParams = { type: getParsedConfigType(params.type), - search: params.query + search: params.query, }; if (!!params.active && !!params.channels?.length) { @@ -82,8 +82,8 @@ export function getFilterVariables( ...baseParams, statusInChannels: { active: parseBoolean(params.active, true), - channels: params.channels - } + channels: params.channels, + }, }; } @@ -91,7 +91,7 @@ export function getFilterVariables( } export function getFilterQueryParam( - filter: FilterElement + filter: FilterElement, ): PluginListUrlFilters { const { name } = filter; @@ -99,7 +99,7 @@ export function getFilterQueryParam( case PluginFilterKeys.channels: return getMultipleValueQueryParam( filter, - PluginListUrlFiltersEnum.channels + PluginListUrlFiltersEnum.channels, ); case PluginFilterKeys.active: @@ -109,7 +109,7 @@ export function getFilterQueryParam( return getSingleEnumValueQueryParam( filter as FilterElementRegular, PluginListUrlFiltersEnum.type, - PluginConfigurationType + PluginConfigurationType, ); } } @@ -117,13 +117,13 @@ export function getFilterQueryParam( export const { deleteFilterTab, getFilterTabs, - saveFilterTab + saveFilterTab, } = createFilterTabUtils(PLUGIN_FILTERS_KEY); export const { areFiltersApplied, getActiveFilters, - getFiltersCurrentTab + getFiltersCurrentTab, } = createFilterUtils( - PluginListUrlFiltersEnum + PluginListUrlFiltersEnum, ); diff --git a/src/plugins/views/PluginList/sort.ts b/src/plugins/views/PluginList/sort.ts index e2074e072..7eadc5098 100644 --- a/src/plugins/views/PluginList/sort.ts +++ b/src/plugins/views/PluginList/sort.ts @@ -3,7 +3,7 @@ import { PluginListUrlSortField } from "@saleor/plugins/urls"; import { createGetSortQueryVariables } from "@saleor/utils/sort"; export function getSortQueryField( - sort: PluginListUrlSortField + sort: PluginListUrlSortField, ): PluginSortField { switch (sort) { case PluginListUrlSortField.name: @@ -16,5 +16,5 @@ export function getSortQueryField( } export const getSortQueryVariables = createGetSortQueryVariables( - getSortQueryField + getSortQueryField, ); diff --git a/src/plugins/views/PluginsDetails.tsx b/src/plugins/views/PluginsDetails.tsx index cc55e3747..d0fde0b64 100644 --- a/src/plugins/views/PluginsDetails.tsx +++ b/src/plugins/views/PluginsDetails.tsx @@ -5,7 +5,7 @@ import { ConfigurationItemFragment, ConfigurationItemInput, usePluginQuery, - usePluginUpdateMutation + usePluginUpdateMutation, } from "@saleor/graphql"; import useNavigator from "@saleor/hooks/useNavigator"; import useNotifier from "@saleor/hooks/useNotifier"; @@ -17,7 +17,7 @@ import React from "react"; import { FormattedMessage, useIntl } from "react-intl"; import PluginsDetailsPage, { - PluginDetailsPageFormData + PluginDetailsPageFormData, } from "../components/PluginsDetailsPage"; import PluginSecretFieldDialog from "../components/PluginSecretFieldDialog"; import { pluginUrl, PluginUrlDialog, PluginUrlQueryParams } from "../urls"; @@ -31,7 +31,7 @@ export interface PluginsDetailsProps { export function getConfigurationInput( config: ConfigurationItemFragment[] | null, - input: ConfigurationItemInput[] | null + input: ConfigurationItemInput[] | null, ): ConfigurationItemInput[] | null { if (config === null || input === null) { return null; @@ -41,13 +41,13 @@ export function getConfigurationInput( .filter(field => !isSecretField(config, field.name)) .map(field => ({ name: field.name, - value: field.value.toString() + value: field.value.toString(), })); } export const PluginsDetails: React.FC = ({ id, - params + params, }) => { const navigate = useNavigator(); const notify = useNotifier(); @@ -55,7 +55,7 @@ export const PluginsDetails: React.FC = ({ const { data: pluginData, loading } = usePluginQuery({ displayLoader: true, - variables: { id } + variables: { id }, }); const plugin = pluginData?.plugin; @@ -66,13 +66,13 @@ export const PluginsDetails: React.FC = ({ : null; const [selectedChannelId, setSelectedChannelId] = useStateFromProps( - initialSelectedChannelValue + initialSelectedChannelValue, ); const selectedConfig = isPluginGlobal(plugin?.globalConfiguration) ? plugin?.globalConfiguration : plugin?.channelConfigurations.find( - getConfigByChannelId(selectedChannelId) + getConfigByChannelId(selectedChannelId), ); const [openModal, closeModal] = createDialogActionHandlers< @@ -85,11 +85,11 @@ export const PluginsDetails: React.FC = ({ if (data.pluginUpdate.errors.length === 0) { notify({ status: "success", - text: intl.formatMessage(commonMessages.savedChanges) + text: intl.formatMessage(commonMessages.savedChanges), }); closeModal(); } - } + }, }); const formErrors = pluginUpdateOpts.data?.pluginUpdate.errors || []; @@ -103,11 +103,11 @@ export const PluginsDetails: React.FC = ({ configuration: [ { name: params.id, - value - } - ] - } - } + value, + }, + ], + }, + }, }); const handleSubmit = async (formData: PluginDetailsPageFormData) => @@ -120,11 +120,11 @@ export const PluginsDetails: React.FC = ({ active: formData.active, configuration: getConfigurationInput( selectedConfig?.configuration, - formData.configuration - ) - } - } - }) + formData.configuration, + ), + }, + }, + }), ); return ( @@ -139,12 +139,12 @@ export const PluginsDetails: React.FC = ({ plugin={plugin} onClear={id => openModal("clear", { - id + id, }) } onEdit={id => openModal("edit", { - id + id, }) } onSubmit={handleSubmit} @@ -162,7 +162,7 @@ export const PluginsDetails: React.FC = ({ title={intl.formatMessage({ id: "N6lfS/", defaultMessage: "Authorization Field Delete", - description: "header" + description: "header", })} onConfirm={() => handleFieldUpdate(null)} > @@ -178,7 +178,7 @@ export const PluginsDetails: React.FC = ({ !!params.action ? pluginUpdateOpts.status : "default" } field={selectedConfig?.configuration.find( - field => field.name === params.id + field => field.name === params.id, )} onClose={closeModal} onConfirm={formData => handleFieldUpdate(formData.value)} diff --git a/src/plugins/views/utils.ts b/src/plugins/views/utils.ts index 52399e56d..df0cad9f7 100644 --- a/src/plugins/views/utils.ts +++ b/src/plugins/views/utils.ts @@ -1,11 +1,11 @@ import { PluginConfigurationBaseFragment } from "@saleor/graphql"; export const isPluginGlobal = ( - globalConfiguration: PluginConfigurationBaseFragment + globalConfiguration: PluginConfigurationBaseFragment, ) => !!globalConfiguration; export const getConfigByChannelId = (channelIdToCompare: string) => ({ - channel + channel, }: { channel: { id: string }; }) => channel.id === channelIdToCompare; diff --git a/src/productTypes/components/ProductTypeAttributes/ProductTypeAttributes.tsx b/src/productTypes/components/ProductTypeAttributes/ProductTypeAttributes.tsx index 237844f3c..b06a37540 100644 --- a/src/productTypes/components/ProductTypeAttributes/ProductTypeAttributes.tsx +++ b/src/productTypes/components/ProductTypeAttributes/ProductTypeAttributes.tsx @@ -7,7 +7,7 @@ import ResponsiveTable from "@saleor/components/ResponsiveTable"; import Skeleton from "@saleor/components/Skeleton"; import { SortableTableBody, - SortableTableRow + SortableTableRow, } from "@saleor/components/SortableTable"; import { TableButtonWrapper } from "@saleor/components/TableButtonWrapper/TableButtonWrapper"; import TableHead from "@saleor/components/TableHead"; @@ -22,25 +22,25 @@ const useStyles = makeStyles( { colAction: { "&:last-child": { - paddingRight: 0 + paddingRight: 0, }, - width: 84 + width: 84, }, colGrab: { - width: 60 + width: 60, }, colName: {}, colSlug: { - width: 300 + width: 300, }, link: { - cursor: "pointer" + cursor: "pointer", }, textLeft: { - textAlign: "left" - } + textAlign: "left", + }, }, - { name: "ProductTypeAttributes" } + { name: "ProductTypeAttributes" }, ); interface ProductTypeAttributesProps extends ListActions { @@ -69,7 +69,7 @@ const ProductTypeAttributes: React.FC = props => { testId, onAttributeAssign, onAttributeReorder, - onAttributeUnassign + onAttributeUnassign, } = props; const classes = useStyles(props); @@ -81,7 +81,7 @@ const ProductTypeAttributes: React.FC = props => { title={intl.formatMessage({ id: "9scTQ0", defaultMessage: "Product Attributes", - description: "section header" + description: "section header", })} toolbar={
), - value: option.type + value: option.type, }))} name="kind" onChange={onKindChange} diff --git a/src/productTypes/components/ProductTypeDetails/messages.ts b/src/productTypes/components/ProductTypeDetails/messages.ts index f2550233a..8322fae13 100644 --- a/src/productTypes/components/ProductTypeDetails/messages.ts +++ b/src/productTypes/components/ProductTypeDetails/messages.ts @@ -4,21 +4,21 @@ export const messages = defineMessages({ productTypeName: { id: "H5yp8O", defaultMessage: "Product Type Name", - description: "label" + description: "label", }, optionNormalTitle: { id: "xRbqcg", defaultMessage: "Regular product type", - description: "option" + description: "option", }, optionGiftCardTitle: { id: "kp2IYP", defaultMessage: "Gift card product type", - description: "option" + description: "option", }, optionGiftCardDescription: { id: "7nKXni", defaultMessage: "This product will act as a payment method", - description: "option description" - } + description: "option description", + }, }); diff --git a/src/productTypes/components/ProductTypeDetailsPage/ProductTypeDetailsPage.tsx b/src/productTypes/components/ProductTypeDetailsPage/ProductTypeDetailsPage.tsx index cddaa1200..e03dc7f1c 100644 --- a/src/productTypes/components/ProductTypeDetailsPage/ProductTypeDetailsPage.tsx +++ b/src/productTypes/components/ProductTypeDetailsPage/ProductTypeDetailsPage.tsx @@ -12,7 +12,7 @@ import { ProductAttributeType, ProductTypeDetailsQuery, ProductTypeKindEnum, - WeightUnitsEnum + WeightUnitsEnum, } from "@saleor/graphql"; import { ChangeEvent, FormChange, SubmitPromise } from "@saleor/hooks/useForm"; import useNavigator from "@saleor/hooks/useNavigator"; @@ -73,11 +73,12 @@ function handleTaxTypeChange( event: ChangeEvent, taxTypes: ProductTypeDetailsQuery["taxTypes"], formChange: FormChange, - displayChange: (name: string) => void + displayChange: (name: string) => void, ) { formChange(event); displayChange( - taxTypes.find(taxType => taxType.taxCode === event.target.value).description + taxTypes.find(taxType => taxType.taxCode === event.target.value) + .description, ); } @@ -98,7 +99,7 @@ const ProductTypeDetailsPage: React.FC = ({ onHasVariantsToggle, onSubmit, setSelectedVariantAttributes, - selectedVariantAttributes + selectedVariantAttributes, }) => { const intl = useIntl(); const navigate = useNavigator(); @@ -106,11 +107,11 @@ const ProductTypeDetailsPage: React.FC = ({ const { isMetadataModified, isPrivateMetadataModified, - makeChangeHandler: makeMetadataChangeHandler + makeChangeHandler: makeMetadataChangeHandler, } = useMetadataChangeTrigger(); const [taxTypeDisplayName, setTaxTypeDisplayName] = useStateFromProps( - maybe(() => productType.taxType.description, "") + maybe(() => productType.taxType.description, ""), ); const formInitialData: ProductTypeForm = { hasVariants: @@ -129,7 +130,7 @@ const ProductTypeDetailsPage: React.FC = ({ maybe(() => productType.productAttributes) !== undefined ? productType.productAttributes.map(attribute => ({ label: attribute.name, - value: attribute.id + value: attribute.id, })) : [], taxType: maybe(() => productType.taxType.taxCode, ""), @@ -137,10 +138,10 @@ const ProductTypeDetailsPage: React.FC = ({ maybe(() => productType.variantAttributes) !== undefined ? productType.variantAttributes.map(attribute => ({ label: attribute.name, - value: attribute.id + value: attribute.id, })) : [], - weight: maybe(() => productType.weight.value) + weight: maybe(() => productType.weight.value), }; const handleSubmit = (data: ProductTypeForm) => { @@ -152,7 +153,7 @@ const ProductTypeDetailsPage: React.FC = ({ return onSubmit({ ...data, metadata, - privateMetadata + privateMetadata, }); }; @@ -192,7 +193,7 @@ const ProductTypeDetailsPage: React.FC = ({ event, taxTypes, change, - setTaxTypeDisplayName + setTaxTypeDisplayName, ) } /> @@ -216,7 +217,7 @@ const ProductTypeDetailsPage: React.FC = ({ label={intl.formatMessage({ id: "5pHBSU", defaultMessage: "Product type uses Variant Attributes", - description: "switch button" + description: "switch button", })} name="hasVariants" onChange={event => onHasVariantsToggle(event.target.value)} diff --git a/src/productTypes/components/ProductTypeList/ProductTypeList.tsx b/src/productTypes/components/ProductTypeList/ProductTypeList.tsx index dde9addb9..142923fbd 100644 --- a/src/productTypes/components/ProductTypeList/ProductTypeList.tsx +++ b/src/productTypes/components/ProductTypeList/ProductTypeList.tsx @@ -3,7 +3,7 @@ import { TableCell, TableFooter, TableRow, - Typography + Typography, } from "@material-ui/core"; import Checkbox from "@saleor/components/Checkbox"; import ResponsiveTable from "@saleor/components/ResponsiveTable"; @@ -16,7 +16,7 @@ import { ProductTypeFragment } from "@saleor/graphql"; import { makeStyles } from "@saleor/macaw-ui"; import { ProductTypeListUrlSortField, - productTypeUrl + productTypeUrl, } from "@saleor/productTypes/urls"; import { getArrowDirection } from "@saleor/utils/sort"; import React from "react"; @@ -30,22 +30,22 @@ const useStyles = makeStyles( [theme.breakpoints.up("lg")]: { colName: {}, colTax: { - width: 300 + width: 300, }, colType: { - width: 300 - } + width: 300, + }, }, colName: { - paddingLeft: 0 + paddingLeft: 0, }, colTax: {}, colType: {}, link: { - cursor: "pointer" - } + cursor: "pointer", + }, }), - { name: "ProductTypeList" } + { name: "ProductTypeList" }, ); interface ProductTypeListProps @@ -67,7 +67,7 @@ const ProductTypeList: React.FC = props => { sort, toggle, toggleAll, - toolbar + toolbar, } = props; const classes = useStyles(props); @@ -158,12 +158,12 @@ const ProductTypeList: React.FC = props => { ? intl.formatMessage({ id: "X90t9n", defaultMessage: "Configurable", - description: "product type" + description: "product type", }) : intl.formatMessage({ id: "yNb+dT", defaultMessage: "Simple product", - description: "product type" + description: "product type", })} @@ -213,7 +213,7 @@ const ProductTypeList: React.FC = props => { /> - ) + ), )} diff --git a/src/productTypes/components/ProductTypeListPage/ProductTypeListPage.tsx b/src/productTypes/components/ProductTypeListPage/ProductTypeListPage.tsx index 5b5aaebff..c03ce2db6 100644 --- a/src/productTypes/components/ProductTypeListPage/ProductTypeListPage.tsx +++ b/src/productTypes/components/ProductTypeListPage/ProductTypeListPage.tsx @@ -9,7 +9,7 @@ import { ProductTypeFragment } from "@saleor/graphql"; import { sectionNames } from "@saleor/intl"; import { productTypeAddUrl, - ProductTypeListUrlSortField + ProductTypeListUrlSortField, } from "@saleor/productTypes/urls"; import React from "react"; import { FormattedMessage, useIntl } from "react-intl"; @@ -19,13 +19,13 @@ import { ListActions, PageListProps, SortPage, - TabPageProps + TabPageProps, } from "../../../types"; import ProductTypeList from "../ProductTypeList"; import { createFilterStructure, ProductTypeFilterKeys, - ProductTypeListFilterOpts + ProductTypeListFilterOpts, } from "./filters"; export interface ProductTypeListPageProps @@ -77,14 +77,14 @@ const ProductTypeListPage: React.FC = ({ allTabLabel={intl.formatMessage({ id: "1KSqnn", defaultMessage: "All Product Types", - description: "tab name" + description: "tab name", })} currentTab={currentTab} filterStructure={structure} initialSearch={initialSearch} searchPlaceholder={intl.formatMessage({ id: "rpFdD1", - defaultMessage: "Search Product Type" + defaultMessage: "Search Product Type", })} tabs={tabs} onAll={onAll} diff --git a/src/productTypes/components/ProductTypeListPage/filters.ts b/src/productTypes/components/ProductTypeListPage/filters.ts index 365b29596..3e6e51da0 100644 --- a/src/productTypes/components/ProductTypeListPage/filters.ts +++ b/src/productTypes/components/ProductTypeListPage/filters.ts @@ -7,7 +7,7 @@ import { defineMessages, IntlShape } from "react-intl"; export enum ProductTypeFilterKeys { configurable = "configurable", - type = "type" + type = "type", } export interface ProductTypeListFilterOpts { @@ -19,28 +19,28 @@ const messages = defineMessages({ configurable: { id: "X90t9n", defaultMessage: "Configurable", - description: "product type" + description: "product type", }, digital: { id: "dS8Adx", defaultMessage: "Digital", - description: "product" + description: "product", }, shippable: { id: "U5aVd8", defaultMessage: "Shippable", - description: "product" + description: "product", }, type: { id: "Jsh6+U", defaultMessage: "Type", - description: "product type is digital or physical" - } + description: "product type is digital or physical", + }, }); export function createFilterStructure( intl: IntlShape, - opts: ProductTypeListFilterOpts + opts: ProductTypeListFilterOpts, ): IFilter { return [ { @@ -52,15 +52,15 @@ export function createFilterStructure( [ { label: intl.formatMessage(commonMessages.yes), - value: ProductTypeConfigurable.CONFIGURABLE + value: ProductTypeConfigurable.CONFIGURABLE, }, { label: intl.formatMessage(commonMessages.no), - value: ProductTypeConfigurable.SIMPLE - } - ] + value: ProductTypeConfigurable.SIMPLE, + }, + ], ), - active: opts.configurable.active + active: opts.configurable.active, }, { ...createOptionsField( @@ -71,15 +71,15 @@ export function createFilterStructure( [ { label: intl.formatMessage(messages.digital), - value: ProductTypeEnum.DIGITAL + value: ProductTypeEnum.DIGITAL, }, { label: intl.formatMessage(messages.shippable), - value: ProductTypeEnum.SHIPPABLE - } - ] + value: ProductTypeEnum.SHIPPABLE, + }, + ], ), - active: opts.type.active - } + active: opts.type.active, + }, ]; } diff --git a/src/productTypes/components/ProductTypeShipping/ProductTypeShipping.tsx b/src/productTypes/components/ProductTypeShipping/ProductTypeShipping.tsx index fc45e463a..7c73ebbaa 100644 --- a/src/productTypes/components/ProductTypeShipping/ProductTypeShipping.tsx +++ b/src/productTypes/components/ProductTypeShipping/ProductTypeShipping.tsx @@ -18,7 +18,7 @@ const ProductTypeShipping: React.FC = ({ data, weightUnit, disabled, - onChange + onChange, }) => { const intl = useIntl(); @@ -28,7 +28,7 @@ const ProductTypeShipping: React.FC = ({ title={intl.formatMessage({ id: "/2OOMe", defaultMessage: "Shipping", - description: "product type shipping settings, section header" + description: "product type shipping settings, section header", })} /> @@ -38,7 +38,7 @@ const ProductTypeShipping: React.FC = ({ label={intl.formatMessage({ id: "IBw72y", defaultMessage: "Is this product shippable?", - description: "switch button" + description: "switch button", })} name="isShippingRequired" onChange={onChange} @@ -49,13 +49,13 @@ const ProductTypeShipping: React.FC = ({ InputProps={{ endAdornment: weightUnit }} label={intl.formatMessage({ id: "zCb8fX", - defaultMessage: "Weight" + defaultMessage: "Weight", })} name="weight" helperText={intl.formatMessage({ id: "VOiUXQ", defaultMessage: - "Used to calculate rates for shipping for products of this product type, when specific weight is not given" + "Used to calculate rates for shipping for products of this product type, when specific weight is not given", })} type="number" value={data.weight} diff --git a/src/productTypes/components/ProductTypeTaxes/ProductTypeTaxes.tsx b/src/productTypes/components/ProductTypeTaxes/ProductTypeTaxes.tsx index df654a96c..2681fcfcc 100644 --- a/src/productTypes/components/ProductTypeTaxes/ProductTypeTaxes.tsx +++ b/src/productTypes/components/ProductTypeTaxes/ProductTypeTaxes.tsx @@ -22,10 +22,10 @@ interface ProductTypeTaxesProps { const useStyles = makeStyles( { root: { - overflow: "visible" - } + overflow: "visible", + }, }, - { name: "ProductTypeTaxes" } + { name: "ProductTypeTaxes" }, ); const ProductTypeTaxes: React.FC = props => { @@ -40,7 +40,7 @@ const ProductTypeTaxes: React.FC = props => { title={intl.formatMessage({ id: "mUb8Gt", defaultMessage: "Taxes", - description: "section header" + description: "section header", })} /> @@ -49,7 +49,7 @@ const ProductTypeTaxes: React.FC = props => { displayValue={taxTypeDisplayName} label={intl.formatMessage({ id: "9xUIAh", - defaultMessage: "Tax group" + defaultMessage: "Tax group", })} name={"taxType" as keyof ProductTypeForm} onChange={onChange} @@ -57,10 +57,10 @@ const ProductTypeTaxes: React.FC = props => { choices={maybe( () => taxTypes.map(c => ({ label: c.description, value: c.taxCode })), - [] + [], )} InputProps={{ - autoComplete: "off" + autoComplete: "off", }} /> diff --git a/src/productTypes/components/ProductTypeVariantAttributes/ProductTypeVariantAttributes.tsx b/src/productTypes/components/ProductTypeVariantAttributes/ProductTypeVariantAttributes.tsx index 1dfe01a6a..b376d101a 100644 --- a/src/productTypes/components/ProductTypeVariantAttributes/ProductTypeVariantAttributes.tsx +++ b/src/productTypes/components/ProductTypeVariantAttributes/ProductTypeVariantAttributes.tsx @@ -8,7 +8,7 @@ import ResponsiveTable from "@saleor/components/ResponsiveTable"; import Skeleton from "@saleor/components/Skeleton"; import { SortableTableBody, - SortableTableRow + SortableTableRow, } from "@saleor/components/SortableTable"; import { TableButtonWrapper } from "@saleor/components/TableButtonWrapper/TableButtonWrapper"; import TableHead from "@saleor/components/TableHead"; @@ -24,41 +24,41 @@ const useStyles = makeStyles( { colAction: { "&:last-child": { - paddingRight: 0 + paddingRight: 0, }, - width: 80 + width: 80, }, colGrab: { - width: 60 + width: 60, }, colName: { - width: 200 + width: 200, }, colSlug: { - width: 200 + width: 200, }, colVariant: { - width: 150 + width: 150, }, colVariantContent: { display: "flex", - alignItems: "center" + alignItems: "center", }, colVariantDisabled: { fill: "#28234A", fillOpacity: 0.6, "&:hover": { - fillOpacity: 1 - } + fillOpacity: 1, + }, }, link: { - cursor: "pointer" + cursor: "pointer", }, textLeft: { - textAlign: "left" - } + textAlign: "left", + }, }, - { name: "ProductTypeAttributes" } + { name: "ProductTypeAttributes" }, ); interface ProductTypeVariantAttributesProps extends ListActions { @@ -77,13 +77,13 @@ function handleContainerAssign( variantID: string, isSelected: boolean, selectedAttributes: string[], - setSelectedAttributes: (data: string[]) => void + setSelectedAttributes: (data: string[]) => void, ) { if (isSelected) { setSelectedAttributes( selectedAttributes.filter( - selectedContainer => selectedContainer !== variantID - ) + selectedContainer => selectedContainer !== variantID, + ), ); } else { setSelectedAttributes([...selectedAttributes, variantID]); @@ -107,7 +107,7 @@ const ProductTypeVariantAttributes: React.FC onAttributeReorder, onAttributeUnassign, setSelectedVariantAttributes, - selectedVariantAttributes + selectedVariantAttributes, } = props; const classes = useStyles(props); @@ -118,7 +118,7 @@ const ProductTypeVariantAttributes: React.FC setSelectedVariantAttributes( assignedVariantAttributes .map(elem => (elem.variantSelection ? elem.attribute.id : undefined)) - .filter(Boolean) || [] + .filter(Boolean) || [], ); }, []); @@ -128,7 +128,7 @@ const ProductTypeVariantAttributes: React.FC title={intl.formatMessage({ id: "skEK/i", defaultMessage: "Variant Attributes", - description: "section header" + description: "section header", })} toolbar={ - ) + ), }} variantAttributeList={{ isChecked: variantAttributeListActions.isSelected, @@ -385,8 +385,8 @@ export const ProductTypeUpdate: React.FC = ({ navigate( productTypeUrl(id, { action: "unassign-attributes", - ids: variantAttributeListActions.listElements - }) + ids: variantAttributeListActions.listElements, + }), ) } > @@ -396,7 +396,7 @@ export const ProductTypeUpdate: React.FC = ({ description="unassign attribute from product type, button" /> - ) + ), }} /> {!dataLoading && ( @@ -404,15 +404,15 @@ export const ProductTypeUpdate: React.FC = ({ {Object.keys(ProductAttributeType).map(key => ( assignAttribute.opts.data.productAttributeAssign.errors.map( - err => err.message + err => err.message, ), - [] + [], )} loading={result.loading} onClose={closeModal} @@ -424,7 +424,7 @@ export const ProductTypeUpdate: React.FC = ({ () => result.data.productType.availableAttributes.pageInfo .hasNextPage, - false + false, )} open={ params.action === "assign-attribute" && @@ -438,10 +438,10 @@ export const ProductTypeUpdate: React.FC = ({ ...params, ids: ids.includes(attributeId) ? params.ids.filter( - selectedId => selectedId !== attributeId + selectedId => selectedId !== attributeId, ) - : [...ids, attributeId] - }) + : [...ids, attributeId], + }), ); }} key={key} @@ -464,7 +464,7 @@ export const ProductTypeUpdate: React.FC = ({ title={intl.formatMessage({ id: "r1aQ2f", defaultMessage: "Unassign Attribute from Product Type", - description: "dialog header" + description: "dialog header", })} attributeQuantity={maybe(() => params.ids.length)} confirmButtonState={unassignAttribute.opts.status} @@ -477,15 +477,15 @@ export const ProductTypeUpdate: React.FC = ({ title={intl.formatMessage({ id: "UJnqdm", defaultMessage: "Unassign Attribute From Product Type", - description: "dialog header" + description: "dialog header", })} attributeName={maybe( () => [ ...data.productType.productAttributes, - ...data.productType.variantAttributes + ...data.productType.variantAttributes, ].find(attribute => attribute.id === params.id).name, - "..." + "...", )} confirmButtonState={unassignAttribute.opts.status} onClose={closeModal} diff --git a/src/products/components/OrderDiscountProviders/OrderDiscountProvider.tsx b/src/products/components/OrderDiscountProviders/OrderDiscountProvider.tsx index 053c39a6b..2164e7868 100644 --- a/src/products/components/OrderDiscountProviders/OrderDiscountProvider.tsx +++ b/src/products/components/OrderDiscountProviders/OrderDiscountProvider.tsx @@ -2,7 +2,7 @@ import { OrderDetailsFragment, useOrderDiscountAddMutation, useOrderDiscountDeleteMutation, - useOrderDiscountUpdateMutation + useOrderDiscountUpdateMutation, } from "@saleor/graphql"; import useNotifier from "@saleor/hooks/useNotifier"; import { getDefaultNotifierSuccessErrorData } from "@saleor/hooks/useNotifier/utils"; @@ -15,7 +15,7 @@ import { OrderDiscountConsumerCommonProps, OrderDiscountData } from "./types"; import { getManualOrderDiscount, getParsedDiscountData, - useDiscountDialog + useDiscountDialog, } from "./utils"; export interface OrderDiscountContextConsumerProps @@ -34,7 +34,7 @@ interface OrderDiscountProviderProps { export const OrderDiscountProvider: React.FC = ({ children, - order + order, }) => { const intl = useIntl(); const notify = useNotifier(); @@ -47,23 +47,23 @@ export const OrderDiscountProvider: React.FC = ({ const [orderDiscountAdd, orderDiscountAddOpts] = useOrderDiscountAddMutation({ onCompleted: ({ orderDiscountAdd: { errors } }) => - handleDiscountDataSubmission(errors) + handleDiscountDataSubmission(errors), }); const [ orderDiscountUpdate, - orderDiscountUpdateOpts + orderDiscountUpdateOpts, ] = useOrderDiscountUpdateMutation({ onCompleted: ({ orderDiscountUpdate: { errors } }) => - handleDiscountDataSubmission(errors) + handleDiscountDataSubmission(errors), }); const [ orderDiscountRemove, - orderDiscountRemoveOpts + orderDiscountRemoveOpts, ] = useOrderDiscountDeleteMutation({ onCompleted: ({ orderDiscountDelete: { errors } }) => - handleDiscountDataSubmission(errors) + handleDiscountDataSubmission(errors), }); const handleDiscountDataSubmission = (errors: any[]) => { @@ -75,8 +75,8 @@ export const OrderDiscountProvider: React.FC = ({ orderDiscountAdd({ variables: { orderId, - input: getParsedDiscountData(data) - } + input: getParsedDiscountData(data), + }, }); const updateOrderDiscount = (data: OrderDiscountCommonInput) => @@ -84,8 +84,8 @@ export const OrderDiscountProvider: React.FC = ({ orderDiscountUpdate({ variables: { discountId: orderDiscount?.id, - input: getParsedDiscountData(data) - } + input: getParsedDiscountData(data), + }, }); const removeOrderDiscount = () => @@ -110,7 +110,7 @@ export const OrderDiscountProvider: React.FC = ({ closeDialog, openDialog, discountedPrice: order.total.gross, - undiscountedPrice: order.undiscountedTotal.gross + undiscountedPrice: order.undiscountedTotal.gross, }; return ( diff --git a/src/products/components/OrderDiscountProviders/OrderLineDiscountProvider.tsx b/src/products/components/OrderDiscountProviders/OrderLineDiscountProvider.tsx index 6836eabad..3a01691f0 100644 --- a/src/products/components/OrderDiscountProviders/OrderLineDiscountProvider.tsx +++ b/src/products/components/OrderDiscountProviders/OrderLineDiscountProvider.tsx @@ -1,7 +1,7 @@ import { OrderDetailsFragment, useOrderLineDiscountRemoveMutation, - useOrderLineDiscountUpdateMutation + useOrderLineDiscountUpdateMutation, } from "@saleor/graphql"; import useNotifier from "@saleor/hooks/useNotifier"; import { getDefaultNotifierSuccessErrorData } from "@saleor/hooks/useNotifier/utils"; @@ -15,12 +15,12 @@ import { GetOrderLineDiscountContextConsumerProps, OrderDiscountConsumerCommonProps, OrderLineDiscountConsumerProps, - OrderLineDiscountData + OrderLineDiscountData, } from "./types"; import { getOrderLineDiscount, getParsedDiscountData, - useDiscountDialog + useDiscountDialog, } from "./utils"; export interface OrderLineDiscountContextConsumerProps @@ -43,7 +43,7 @@ export const OrderLineDiscountContext = createContext< export const OrderLineDiscountProvider: React.FC = ({ children, - order + order, }) => { const intl = useIntl(); const notify = useNotifier(); @@ -62,18 +62,18 @@ export const OrderLineDiscountProvider: React.FC = ({ const [ orderLineDiscountAddOrUpdate, - orderLineDiscountAddOrUpdateOpts + orderLineDiscountAddOrUpdateOpts, ] = useOrderLineDiscountUpdateMutation({ onCompleted: ({ orderLineDiscountUpdate: { errors } }) => - handleDiscountDataSubmission(errors) + handleDiscountDataSubmission(errors), }); const [ orderLineDiscountRemove, - orderLineDiscountRemoveOpts + orderLineDiscountRemoveOpts, ] = useOrderLineDiscountRemoveMutation({ onCompleted: ({ orderLineDiscountRemove: { errors } }) => - handleDiscountDataSubmission(errors) + handleDiscountDataSubmission(errors), }); const handleDiscountDataSubmission = (errors: any[]) => { @@ -82,10 +82,10 @@ export const OrderLineDiscountProvider: React.FC = ({ }; const addOrUpdateOrderLineDiscount = (orderLineId: string) => ( - input: OrderDiscountCommonInput + input: OrderDiscountCommonInput, ) => orderLineDiscountAddOrUpdate({ - variables: { orderLineId, input: getParsedDiscountData(input) } + variables: { orderLineId, input: getParsedDiscountData(input) }, }); const removeOrderLineDiscount = (orderLineId: string) => () => @@ -98,7 +98,7 @@ export const OrderLineDiscountProvider: React.FC = ({ order?.lines.find(getById(orderLineId)); const getDiscountProviderValues = ( - orderLineId: string + orderLineId: string, ): OrderLineDiscountContextConsumerProps => ({ addOrderLineDiscount: addOrUpdateOrderLineDiscount(orderLineId), removeOrderLineDiscount: removeOrderLineDiscount(orderLineId), @@ -109,7 +109,7 @@ export const OrderLineDiscountProvider: React.FC = ({ closeDialog: handleCloseDialog, openDialog: handleOpenDialog(orderLineId), discountedPrice: getOrderLine(orderLineId).unitPrice.gross, - undiscountedPrice: getOrderLine(orderLineId).undiscountedUnitPrice.gross + undiscountedPrice: getOrderLine(orderLineId).undiscountedUnitPrice.gross, }); return ( @@ -121,7 +121,7 @@ export const OrderLineDiscountProvider: React.FC = ({ export const OrderLineDiscountConsumer: React.FC = ({ children, - orderLineId + orderLineId, }) => ( {(getValues: GetOrderLineDiscountContextConsumerProps) => diff --git a/src/products/components/OrderDiscountProviders/types.ts b/src/products/components/OrderDiscountProviders/types.ts index 1359c50be..a4a3ee264 100644 --- a/src/products/components/OrderDiscountProviders/types.ts +++ b/src/products/components/OrderDiscountProviders/types.ts @@ -8,7 +8,7 @@ export interface OrderDiscountData extends OrderDiscountCommonInput { } export type GetOrderLineDiscountContextConsumerProps = ( - orderLineId: string + orderLineId: string, ) => OrderLineDiscountContextConsumerProps; export interface OrderLineDiscountData extends OrderDiscountCommonInput { diff --git a/src/products/components/OrderDiscountProviders/utils.ts b/src/products/components/OrderDiscountProviders/utils.ts index 278c3c597..fc8c5a106 100644 --- a/src/products/components/OrderDiscountProviders/utils.ts +++ b/src/products/components/OrderDiscountProviders/utils.ts @@ -17,22 +17,22 @@ export const getManualOrderDiscount = (order: OrderDetailsQuery["order"]) => export const getOrderDiscount = ( order: OrderDetailsQuery["order"], - discountType: OrderDiscountType + discountType: OrderDiscountType, ): OrderDetailsQuery["order"]["discounts"][0] => order.discounts.find(({ type }) => type === discountType); export const getOrderLineDiscount = ( order: OrderDetailsQuery["order"], - orderLineId: string + orderLineId: string, ): OrderLineDiscountData => { const { unitDiscount: moneyValue, unitDiscountReason: reason, unitDiscountValue: value, undiscountedUnitPrice: undiscountedPrice, - unitDiscountType: calculationMode + unitDiscountType: calculationMode, } = order.lines.find( - ({ id }: OrderDetailsQuery["order"]["lines"][0]) => id === orderLineId + ({ id }: OrderDetailsQuery["order"]["lines"][0]) => id === orderLineId, ); if (!value) { @@ -44,12 +44,12 @@ export const getOrderLineDiscount = ( moneyValue, reason, undiscountedPrice, - value + value, }; }; export const getParsedDiscountData = ({ value, calculationMode, - reason + reason, }: OrderDiscountCommonInput) => ({ reason, value, valueType: calculationMode }); diff --git a/src/products/components/ProductCategoryAndCollectionsForm/ProductCategoryAndCollectionsForm.tsx b/src/products/components/ProductCategoryAndCollectionsForm/ProductCategoryAndCollectionsForm.tsx index 420205526..17e2a52e9 100644 --- a/src/products/components/ProductCategoryAndCollectionsForm/ProductCategoryAndCollectionsForm.tsx +++ b/src/products/components/ProductCategoryAndCollectionsForm/ProductCategoryAndCollectionsForm.tsx @@ -23,7 +23,7 @@ const ProductCategoryAndCollectionsForm = ({ productCollections, category, loading, - onChange + onChange, }: ProductCategoryAndCollectionsFormProps) => { const intl = useIntl(); @@ -33,7 +33,7 @@ const ProductCategoryAndCollectionsForm = ({ title={intl.formatMessage({ id: "fyE8BN", defaultMessage: "Organization", - description: "product organization, header" + description: "product organization, header", })} /> @@ -43,7 +43,7 @@ const ProductCategoryAndCollectionsForm = ({ hint={errors.category} label={intl.formatMessage({ id: "ccXLVi", - defaultMessage: "Category" + defaultMessage: "Category", })} choices={loading ? [] : categories} name="category" @@ -57,7 +57,7 @@ const ProductCategoryAndCollectionsForm = ({ hint={errors.collections} label={intl.formatMessage({ id: "ulh3kf", - defaultMessage: "Collections" + defaultMessage: "Collections", })} choices={loading ? [] : collections} name="collections" diff --git a/src/products/components/ProductCreatePage/ProductCreatePage.tsx b/src/products/components/ProductCreatePage/ProductCreatePage.tsx index 2e41a8b7f..694b98033 100644 --- a/src/products/components/ProductCreatePage/ProductCreatePage.tsx +++ b/src/products/components/ProductCreatePage/ProductCreatePage.tsx @@ -1,6 +1,6 @@ import { getAttributeValuesFromReferences, - mergeAttributeValues + mergeAttributeValues, } from "@saleor/attributes/utils/data"; import CannotDefineChannelsAvailabilityCard from "@saleor/channels/components/CannotDefineChannelsAvailabilityCard/CannotDefineChannelsAvailabilityCard"; import { ChannelData } from "@saleor/channels/utils"; @@ -28,7 +28,7 @@ import { SearchProductsQuery, SearchProductTypesQuery, SearchWarehousesQuery, - TaxTypeFragment + TaxTypeFragment, } from "@saleor/graphql"; import useNavigator from "@saleor/hooks/useNavigator"; import useStateFromProps from "@saleor/hooks/useStateFromProps"; @@ -49,7 +49,7 @@ import ProductTaxes from "../ProductTaxes"; import ProductCreateForm, { ProductCreateData, ProductCreateFormData, - ProductCreateHandlers + ProductCreateHandlers, } from "./form"; interface ProductCreatePageProps { @@ -135,14 +135,14 @@ export const ProductCreatePage: React.FC = ({ fetchMoreAttributeValues, onCloseDialog, onSelectProductType, - onAttributeSelectBlur + onAttributeSelectBlur, }: ProductCreatePageProps) => { const intl = useIntl(); const navigate = useNavigator(); // Display values const [selectedCategory, setSelectedCategory] = useStateFromProps( - initial?.category || "" + initial?.category || "", ); const [selectedCollections, setSelectedCollections] = useStateFromProps< @@ -150,7 +150,7 @@ export const ProductCreatePage: React.FC = ({ >([]); const [selectedTaxType, setSelectedTaxType] = useStateFromProps( - initial?.taxCode || null + initial?.taxCode || null, ); const categories = getChoices(categoryChoiceList); @@ -159,7 +159,7 @@ export const ProductCreatePage: React.FC = ({ const taxTypeChoices = taxTypes?.map(taxType => ({ label: taxType.description, - value: taxType.taxCode + value: taxType.taxCode, })) || []; const canOpenAssignReferencesAttributeDialog = !!assignReferencesAttributeId; @@ -167,15 +167,15 @@ export const ProductCreatePage: React.FC = ({ const handleAssignReferenceAttribute = ( attributeValues: string[], data: ProductCreateData, - handlers: ProductCreateHandlers + handlers: ProductCreateHandlers, ) => { handlers.selectAttributeReference( assignReferencesAttributeId, mergeAttributeValues( assignReferencesAttributeId, attributeValues, - data.attributes - ) + data.attributes, + ), ); onCloseDialog(); }; @@ -213,7 +213,7 @@ export const ProductCreatePage: React.FC = ({ handlers, submit, isSaveDisabled, - attributeRichTextGetters + attributeRichTextGetters, }) => { // Comparing explicitly to false because `hasVariants` can be undefined const isSimpleProduct = data.productType?.hasVariants === false; @@ -293,7 +293,7 @@ export const ProductCreatePage: React.FC = ({ helperText={intl.formatMessage({ id: "LKoIB1", defaultMessage: - "Add search engine title and description to make this product easier to find" + "Add search engine title and description to make this product easier to find", })} title={data.seoTitle} slug={data.slug} @@ -338,14 +338,14 @@ export const ProductCreatePage: React.FC = ({ hiddenLabel: intl.formatMessage({ id: "saKXY3", defaultMessage: "Not published", - description: "product label" + description: "product label", }), visibleLabel: intl.formatMessage({ id: "qJedl0", defaultMessage: "Published", - description: "product label" - }) + description: "product label", + }), }} errors={channelsErrors} allChannelsCount={allChannelsCount} @@ -380,7 +380,7 @@ export const ProductCreatePage: React.FC = ({ assignReferencesAttributeId, data.attributes, referencePages, - referenceProducts + referenceProducts, )} hasMore={handlers.fetchMoreReferences?.hasMore} open={canOpenAssignReferencesAttributeDialog} @@ -392,7 +392,7 @@ export const ProductCreatePage: React.FC = ({ handleAssignReferenceAttribute( attributeValues, data, - handlers + handlers, ) } /> diff --git a/src/products/components/ProductCreatePage/form.tsx b/src/products/components/ProductCreatePage/form.tsx index 109951275..0601af7fb 100644 --- a/src/products/components/ProductCreatePage/form.tsx +++ b/src/products/components/ProductCreatePage/form.tsx @@ -4,7 +4,7 @@ import { getRichTextAttributesFromMap, getRichTextDataFromAttributes, mergeAttributes, - RichTextProps + RichTextProps, } from "@saleor/attributes/utils/data"; import { createAttributeChangeHandler, @@ -13,12 +13,12 @@ import { createAttributeReferenceChangeHandler, createAttributeValueReorderHandler, createFetchMoreReferencesHandler, - createFetchReferencesHandler + createFetchReferencesHandler, } from "@saleor/attributes/utils/handlers"; import { ChannelData, ChannelPriceArgs } from "@saleor/channels/utils"; import { AttributeInput, - AttributeInputData + AttributeInputData, } from "@saleor/components/Attributes"; import { useExitFormDialog } from "@saleor/components/Form/useExitFormDialog"; import { MetadataFormData } from "@saleor/components/Metadata"; @@ -29,32 +29,32 @@ import { SearchPagesQuery, SearchProductsQuery, SearchProductTypesQuery, - SearchWarehousesQuery + SearchWarehousesQuery, } from "@saleor/graphql"; import useForm, { CommonUseFormResultWithHandlers, FormChange, FormErrors, - SubmitPromise + SubmitPromise, } from "@saleor/hooks/useForm"; import useFormset, { FormsetChange, - FormsetData + FormsetData, } from "@saleor/hooks/useFormset"; import useHandleFormSubmit from "@saleor/hooks/useHandleFormSubmit"; import { errorMessages } from "@saleor/intl"; import { getAttributeInputFromProductType, - ProductType + ProductType, } from "@saleor/products/utils/data"; import { createChannelsChangeHandler, createChannelsPriceChangeHandler, - createProductTypeSelectHandler + createProductTypeSelectHandler, } from "@saleor/products/utils/handlers"; import { validateCostPrice, - validatePrice + validatePrice, } from "@saleor/products/utils/validation"; import { PRODUCT_CREATE_FORM_ID } from "@saleor/products/views/ProductCreate/consts"; import { FetchMoreProps, RelayToFlat, ReorderEvent } from "@saleor/types"; @@ -119,7 +119,7 @@ export interface ProductCreateHandlers "changeChannels", ( id: string, - data: Omit + data: Omit, ) => void >, Record<"selectAttributeReference", FormsetChange>, @@ -182,7 +182,7 @@ function useProductCreateForm( initial: Partial, onSubmit: (data: ProductCreateData) => SubmitPromise, loading: boolean, - opts: UseProductCreateFormOpts + opts: UseProductCreateFormOpts, ): UseProductCreateFormOutput { const intl = useIntl(); const defaultInitialFormData: ProductCreateFormData & @@ -211,16 +211,16 @@ function useProductCreateForm( globalThreshold: "", isPreorder: false, hasPreorderEndDate: false, - preorderEndDateTime: "" + preorderEndDateTime: "", }; const form = useForm( { ...initial, - ...defaultInitialFormData + ...defaultInitialFormData, }, undefined, - { confirmLeave: true, formId: PRODUCT_CREATE_FORM_ID } + { confirmLeave: true, formId: PRODUCT_CREATE_FORM_ID }, ); const { @@ -228,83 +228,83 @@ function useProductCreateForm( toggleValue, handleChange, data: formData, - formId + formId, } = form; const attributes = useFormset( opts.selectedProductType ? getAttributeInputFromProductType(opts.selectedProductType) - : [] + : [], ); const { getters: attributeRichTextGetters, - getValues: getAttributeRichTextValues + getValues: getAttributeRichTextValues, } = useMultipleRichText({ initial: getRichTextDataFromAttributes(attributes.data), - triggerChange + triggerChange, }); const attributesWithNewFileValue = useFormset([]); const stocks = useFormset([]); const richText = useRichText({ initial: null, - triggerChange + triggerChange, }); const { - makeChangeHandler: makeMetadataChangeHandler + makeChangeHandler: makeMetadataChangeHandler, } = useMetadataChangeTrigger(); const handleCollectionSelect = createMultiAutocompleteSelectHandler( toggleValue, opts.setSelectedCollections, opts.selectedCollections, - opts.collections + opts.collections, ); const handleCategorySelect = createSingleAutocompleteSelectHandler( handleChange, opts.setSelectedCategory, - opts.categories + opts.categories, ); const handleAttributeChange = createAttributeChangeHandler( attributes.change, - triggerChange + triggerChange, ); const handleAttributeMultiChange = createAttributeMultiChangeHandler( attributes.change, attributes.data, - triggerChange + triggerChange, ); const handleAttributeReferenceChange = createAttributeReferenceChangeHandler( attributes.change, - triggerChange + triggerChange, ); const handleFetchReferences = createFetchReferencesHandler( attributes.data, opts.assignReferencesAttributeId, opts.fetchReferencePages, - opts.fetchReferenceProducts + opts.fetchReferenceProducts, ); const handleFetchMoreReferences = createFetchMoreReferencesHandler( attributes.data, opts.assignReferencesAttributeId, opts.fetchMoreReferencePages, - opts.fetchMoreReferenceProducts + opts.fetchMoreReferenceProducts, ); const handleAttributeFileChange = createAttributeFileChangeHandler( attributes.change, attributesWithNewFileValue.data, attributesWithNewFileValue.add, attributesWithNewFileValue.change, - triggerChange + triggerChange, ); const handleAttributeValueReorder = createAttributeValueReorderHandler( attributes.change, attributes.data, - triggerChange + triggerChange, ); const handleProductTypeSelect = createProductTypeSelectHandler( opts.onSelectProductType, - triggerChange + triggerChange, ); const handleStockChange: FormsetChange = (id, value) => { triggerChange(); @@ -314,11 +314,11 @@ function useProductCreateForm( triggerChange(); stocks.add({ data: { - quantityAllocated: 0 + quantityAllocated: 0, }, id, label: opts.warehouses.find(warehouse => warehouse.id === id).name, - value: "0" + value: "0", }); }; const handleStockDelete = (id: string) => { @@ -328,24 +328,24 @@ function useProductCreateForm( const handleTaxTypeSelect = createSingleAutocompleteSelectHandler( handleChange, opts.setSelectedTaxType, - opts.taxTypes + opts.taxTypes, ); const changeMetadata = makeMetadataChangeHandler(handleChange); const handleChannelsChange = createChannelsChangeHandler( opts.currentChannels, opts.setChannels, - triggerChange + triggerChange, ); const handleChannelPriceChange = createChannelsPriceChangeHandler( opts.currentChannels, opts.setChannels, - triggerChange + triggerChange, ); const handlePreorderEndDateChange = createPreorderEndDateChangeHandler( form, triggerChange, - intl.formatMessage(errorMessages.preorderEndDateInFutureErrorText) + intl.formatMessage(errorMessages.preorderEndDateInFutureErrorText), ); const data: ProductCreateData = { @@ -354,12 +354,12 @@ function useProductCreateForm( attributes.data, attributesWithNewFileValue.data, opts.referencePages, - opts.referenceProducts + opts.referenceProducts, ), attributesWithNewFileValue: attributesWithNewFileValue.data, description: null, productType: opts.selectedProductType, - stocks: stocks.data + stocks: stocks.data, }; const getData = async (): Promise => ({ @@ -369,20 +369,20 @@ function useProductCreateForm( attributes.data, getRichTextAttributesFromMap( attributes.data, - await getAttributeRichTextValues() - ) - ) + await getAttributeRichTextValues(), + ), + ), }); const handleFormSubmit = useHandleFormSubmit({ formId, - onSubmit + onSubmit, }); const submit = async () => handleFormSubmit(await getData()); const { setExitDialogSubmitRef, setIsSubmitDisabled } = useExitFormDialog({ - formId: PRODUCT_CREATE_FORM_ID + formId: PRODUCT_CREATE_FORM_ID, }); useEffect(() => setExitDialogSubmitRef(submit), [submit]); @@ -406,7 +406,7 @@ function useProductCreateForm( const hasInvalidChannelListingPrices = data.channelListings.some( channel => - validatePrice(channel.price) || validateCostPrice(channel.costPrice) + validatePrice(channel.price) || validateCostPrice(channel.costPrice), ); if (hasInvalidChannelListingPrices) { @@ -441,12 +441,12 @@ function useProductCreateForm( selectCategory: handleCategorySelect, selectCollection: handleCollectionSelect, selectProductType: handleProductTypeSelect, - selectTaxRate: handleTaxTypeSelect + selectTaxRate: handleTaxTypeSelect, }, submit, isSaveDisabled, richText, - attributeRichTextGetters + attributeRichTextGetters, }; } @@ -461,7 +461,7 @@ const ProductCreateForm: React.FC = ({ initial || {}, onSubmit, loading, - rest + rest, ); return ( diff --git a/src/products/components/ProductDetailsForm/ProductDetailsForm.tsx b/src/products/components/ProductDetailsForm/ProductDetailsForm.tsx index 7600ac46b..ba167a782 100644 --- a/src/products/components/ProductDetailsForm/ProductDetailsForm.tsx +++ b/src/products/components/ProductDetailsForm/ProductDetailsForm.tsx @@ -29,14 +29,14 @@ export const ProductDetailsForm: React.FC = ({ data, disabled, errors, - onChange + onChange, }) => { const intl = useIntl(); const { editorRef, defaultValue, isReadyForMount, - handleChange + handleChange, } = useRichTextContext(); const formErrors = getFormErrors(["name", "description", "rating"], errors); @@ -54,7 +54,7 @@ export const ProductDetailsForm: React.FC = ({ label={intl.formatMessage({ id: "6AMFki", defaultMessage: "Name", - description: "product name" + description: "product name", })} name="name" value={data.name} @@ -90,7 +90,7 @@ export const ProductDetailsForm: React.FC = ({ label={intl.formatMessage({ id: "L7N+0y", defaultMessage: "Product Rating", - description: "product rating" + description: "product rating", })} name="rating" value={data.rating || ""} diff --git a/src/products/components/ProductExportDialog/ExportDialogSettings.tsx b/src/products/components/ProductExportDialog/ExportDialogSettings.tsx index 212428fb8..662d4c006 100644 --- a/src/products/components/ProductExportDialog/ExportDialogSettings.tsx +++ b/src/products/components/ProductExportDialog/ExportDialogSettings.tsx @@ -1,12 +1,12 @@ import Hr from "@saleor/components/Hr"; import RadioGroupField, { - RadioGroupFieldChoice + RadioGroupFieldChoice, } from "@saleor/components/RadioGroupField"; import { ExportErrorFragment, ExportProductsInput, ExportScope, - FileTypesEnum + FileTypesEnum, } from "@saleor/graphql"; import { ChangeEvent } from "@saleor/hooks/useForm"; import { makeStyles } from "@saleor/macaw-ui"; @@ -21,12 +21,12 @@ const useStyles = makeStyles( theme => ({ hr: { marginBottom: theme.spacing(3), - marginTop: theme.spacing(3) - } + marginTop: theme.spacing(3), + }, }), { - name: "ExportDialogSettings" - } + name: "ExportDialogSettings", + }, ); export type ExportItemsQuantity = Record<"all" | "filter", number>; @@ -55,7 +55,7 @@ const ExportDialogSettings: React.FC = ({ selectedItems, itemsQuantity, exportScopeLabels, - allowScopeSelection = true + allowScopeSelection = true, }) => { const classes = useStyles({}); const intl = useIntl(); @@ -69,43 +69,43 @@ const ExportDialogSettings: React.FC = ({ label: intl.formatMessage({ id: "9Tl/bT", defaultMessage: "Spreadsheet for Excel, Numbers etc.", - description: "export items as spreadsheet" + description: "export items as spreadsheet", }), - value: FileTypesEnum.XLSX + value: FileTypesEnum.XLSX, }, { label: intl.formatMessage({ id: "li1BBk", defaultMessage: "Plain CSV file", - description: "export items as csv file" + description: "export items as csv file", }), - value: FileTypesEnum.CSV - } + value: FileTypesEnum.CSV, + }, ]; const exportScopeChoices = [ { label: exportScopeLabels.allItems, - value: ExportScope.ALL + value: ExportScope.ALL, }, { disabled: selectedItems === 0, label: exportScopeLabels.selectedItems, - value: ExportScope.IDS + value: ExportScope.IDS, }, { label: intl.formatMessage( { id: "SZt9kC", defaultMessage: "Current search ({number})", - description: "export filtered items to csv file" + description: "export filtered items to csv file", }, { - number: itemsQuantity.filter || "..." - } + number: itemsQuantity.filter || "...", + }, ), - value: ExportScope.FILTER - } + value: ExportScope.FILTER, + }, ]; return ( @@ -119,7 +119,7 @@ const ExportDialogSettings: React.FC = ({ label={intl.formatMessage({ id: "g6yuk2", defaultMessage: "Export information for:", - description: "export items to csv file, choice field label" + description: "export items to csv file, choice field label", })} name={"scope" as keyof ExportProductsInput} onChange={onChange} @@ -135,7 +135,7 @@ const ExportDialogSettings: React.FC = ({ label={intl.formatMessage({ id: "z1puMb", defaultMessage: "Export as:", - description: "export items as csv or spreadsheet file" + description: "export items as csv or spreadsheet file", })} name={"fileType" as keyof ExportProductsInput} onChange={onChange} diff --git a/src/products/components/ProductExportDialog/ProductExportDialog.stories.tsx b/src/products/components/ProductExportDialog/ProductExportDialog.stories.tsx index 9b4932558..314d69d3c 100644 --- a/src/products/components/ProductExportDialog/ProductExportDialog.stories.tsx +++ b/src/products/components/ProductExportDialog/ProductExportDialog.stories.tsx @@ -7,14 +7,14 @@ import React from "react"; import { attributes } from "../../../attributes/fixtures"; import ProductExportDialog, { - ProductExportDialogProps + ProductExportDialogProps, } from "./ProductExportDialog"; const props: ProductExportDialogProps = { attributes: attributes.map(attr => ({ __typename: "Attribute", id: attr.id, - name: attr.name + name: attr.name, })), channels: channelsList, confirmButtonState: "default", @@ -28,10 +28,10 @@ const props: ProductExportDialogProps = { open: true, productQuantity: { all: 100, - filter: 32 + filter: 32, }, selectedProducts: 18, - warehouses: warehouseList + warehouses: warehouseList, }; storiesOf("Views / Products / Export / Export settings", module) @@ -49,7 +49,7 @@ storiesOf("Views / Products / Export / Export settings", module) __typename: "ExportError", code: ExportErrorCode.INVALID, field, - message: "Export invalid" + message: "Export invalid", }))} /> )); diff --git a/src/products/components/ProductExportDialog/ProductExportDialog.tsx b/src/products/components/ProductExportDialog/ProductExportDialog.tsx index dc05ab45f..315a71bea 100644 --- a/src/products/components/ProductExportDialog/ProductExportDialog.tsx +++ b/src/products/components/ProductExportDialog/ProductExportDialog.tsx @@ -3,7 +3,7 @@ import { DialogActions, DialogContent, DialogTitle, - Typography + Typography, } from "@material-ui/core"; import { Button } from "@saleor/components/Button"; import ConfirmButton from "@saleor/components/ConfirmButton"; @@ -14,7 +14,7 @@ import { ExportErrorFragment, ExportProductsInput, SearchAttributesQuery, - WarehouseFragment + WarehouseFragment, } from "@saleor/graphql"; import useForm, { FormChange } from "@saleor/hooks/useForm"; import useModalDialogErrors from "@saleor/hooks/useModalDialogErrors"; @@ -30,18 +30,18 @@ import React from "react"; import { FormattedMessage, useIntl } from "react-intl"; import ExportDialogSettings, { - ExportItemsQuantity + ExportItemsQuantity, } from "./ExportDialogSettings"; import { productExportDialogMessages as messages } from "./messages"; import ProductExportDialogInfo, { attributeNamePrefix, - warehouseNamePrefix + warehouseNamePrefix, } from "./ProductExportDialogInfo"; import { exportSettingsInitialFormData } from "./types"; export enum ProductExportStep { INFO, - SETTINGS + SETTINGS, } function useSteps(): Array> { @@ -52,18 +52,18 @@ function useSteps(): Array> { label: intl.formatMessage({ id: "/68iG8", defaultMessage: "Information exported", - description: "product export to csv file, header" + description: "product export to csv file, header", }), - value: ProductExportStep.INFO + value: ProductExportStep.INFO, }, { label: intl.formatMessage({ id: "ki7Mr8", defaultMessage: "Export Settings", - description: "product export to csv file, header" + description: "product export to csv file, header", }), - value: ProductExportStep.SETTINGS - } + value: ProductExportStep.SETTINGS, + }, ]; } @@ -72,9 +72,9 @@ const initialForm: ExportProductsInput = { attributes: [], channels: [], fields: [], - warehouses: [] + warehouses: [], }, - ...exportSettingsInitialFormData + ...exportSettingsInitialFormData, }; const ProductExportSteps = makeCreatorSteps(); @@ -106,7 +106,7 @@ const ProductExportDialog: React.FC = ({ }) => { const [step, { next, prev, set: setStep }] = useWizard( ProductExportStep.INFO, - [ProductExportStep.INFO, ProductExportStep.SETTINGS] + [ProductExportStep.INFO, ProductExportStep.SETTINGS], ); const steps = useSteps(); const dialogErrors = useModalDialogErrors(errors, open); @@ -122,7 +122,7 @@ const ProductExportDialog: React.FC = ({ onClose: () => { reset(); setStep(ProductExportStep.INFO); - } + }, }); const attributeChoices = mapNodeToChoice(attributes); @@ -136,15 +136,15 @@ const ProductExportDialog: React.FC = ({ name: "exportInfo", value: { ...data.exportInfo, - attributes: toggle(id, data.exportInfo.attributes, (a, b) => a === b) - } - } + attributes: toggle(id, data.exportInfo.attributes, (a, b) => a === b), + }, + }, }); const choice = attributeChoices.find(choice => choice.value === id); setSelectedAttributes( - toggle(choice, selectedAttributes, (a, b) => a.value === b.value) + toggle(choice, selectedAttributes, (a, b) => a.value === b.value), ); }; @@ -157,21 +157,21 @@ const ProductExportDialog: React.FC = ({ channels: toggle( option.id, data.exportInfo.channels, - (a, b) => a === b - ) - } - } + (a, b) => a === b, + ), + }, + }, }); const choice = channels.find(choice => choice.id === option.id); setSelectedChannels( - toggle(choice, selectedChannels, (a, b) => a.id === b.id) + toggle(choice, selectedChannels, (a, b) => a.id === b.id), ); }; const handleToggleAllChannels = ( items: ChannelFragment[], - selected: number + selected: number, ) => { setSelectedChannels(selected === items.length ? [] : channels); @@ -181,9 +181,11 @@ const ProductExportDialog: React.FC = ({ value: { ...data.exportInfo, channels: - selected === items.length ? [] : channels.map(channel => channel.id) - } - } + selected === items.length + ? [] + : channels.map(channel => channel.id), + }, + }, }); }; @@ -196,10 +198,10 @@ const ProductExportDialog: React.FC = ({ warehouses: toggle( event.target.name.substr(warehouseNamePrefix.length), data.exportInfo.warehouses, - (a, b) => a === b - ) - } - } + (a, b) => a === b, + ), + }, + }, }); const handleToggleAllWarehouses: FormChange = () => @@ -211,9 +213,9 @@ const ProductExportDialog: React.FC = ({ warehouses: data.exportInfo.warehouses.length === warehouses.length ? [] - : warehouses.map(warehouse => warehouse.id) - } - } + : warehouses.map(warehouse => warehouse.id), + }, + }, }); const exportScopeLabels = { @@ -221,22 +223,22 @@ const ProductExportDialog: React.FC = ({ { id: "xtUXnK", defaultMessage: "All products ({number})", - description: "export all items to csv file" + description: "export all items to csv file", }, { - number: productQuantity.all || "..." - } + number: productQuantity.all || "...", + }, ), selectedItems: intl.formatMessage( { id: "qEZ463", defaultMessage: "Selected products ({number})", - description: "export selected items to csv file" + description: "export selected items to csv file", }, { - number: selectedProducts - } - ) + number: selectedProducts, + }, + ), }; return ( diff --git a/src/products/components/ProductExportDialog/ProductExportDialogInfo.tsx b/src/products/components/ProductExportDialog/ProductExportDialogInfo.tsx index 383c41a62..1916867b1 100644 --- a/src/products/components/ProductExportDialog/ProductExportDialogInfo.tsx +++ b/src/products/components/ProductExportDialog/ProductExportDialogInfo.tsx @@ -3,7 +3,7 @@ import { CircularProgress, FormControlLabel, TextField, - Typography + Typography, } from "@material-ui/core"; import Accordion, { AccordionProps } from "@saleor/components/Accordion"; import { useChannelsSearch } from "@saleor/components/ChannelsAvailabilityDialog/utils"; @@ -16,7 +16,7 @@ import { MultiAutocompleteChoiceType } from "@saleor/components/MultiAutocomplet import { ChannelFragment, ExportProductsInput, - ProductFieldEnum + ProductFieldEnum, } from "@saleor/graphql"; import { ChangeEvent, FormChange } from "@saleor/hooks/useForm"; import useSearchQuery from "@saleor/hooks/useSearchQuery"; @@ -37,80 +37,80 @@ const inventoryFields = [ ProductFieldEnum.PRODUCT_WEIGHT, ProductFieldEnum.VARIANT_ID, ProductFieldEnum.VARIANT_SKU, - ProductFieldEnum.VARIANT_WEIGHT + ProductFieldEnum.VARIANT_WEIGHT, ]; const useStyles = makeStyles( theme => ({ accordion: { - marginBottom: theme.spacing(2) + marginBottom: theme.spacing(2), }, checkbox: { position: "relative", - right: theme.spacing(-1.5) + right: theme.spacing(-1.5), }, chip: { marginBottom: theme.spacing(1), - marginRight: theme.spacing() + marginRight: theme.spacing(), }, dialogLabel: { - marginBottom: theme.spacing(2) + marginBottom: theme.spacing(2), }, hr: { marginBottom: theme.spacing(3), - marginTop: theme.spacing(3) + marginTop: theme.spacing(3), }, hrWarehouses: { marginBottom: theme.spacing(3), - marginTop: theme.spacing(1) + marginTop: theme.spacing(1), }, label: { "&&": { - overflow: "visible" + overflow: "visible", }, "&:first-of-type": { - paddingTop: 0 + paddingTop: 0, }, "&:not(:last-of-type)": { - borderBottom: `1px solid ${theme.palette.divider}` + borderBottom: `1px solid ${theme.palette.divider}`, }, justifyContent: "space-between", margin: theme.spacing(0), padding: theme.spacing(1, 0), - width: "100%" + width: "100%", }, loadMoreContainer: { display: "flex", justifyContent: "center", - marginTop: theme.spacing(2) + marginTop: theme.spacing(2), }, moreLabel: { display: "inline-block", - marginBottom: theme.spacing() + marginBottom: theme.spacing(), }, optionLabel: { fontSize: 14, - marginLeft: 0 + marginLeft: 0, }, quickPeekContainer: { - marginBottom: theme.spacing(-1) + marginBottom: theme.spacing(-1), }, warehousesLabel: { - marginBottom: theme.spacing(2) + marginBottom: theme.spacing(2), }, scrollArea: { maxHeight: "calc(100vh - 350px)", minHeight: "auto", "@media (min-height: 800px)": { - minHeight: 440 + minHeight: 440, }, overflowY: "auto", - overflowX: "hidden" - } + overflowX: "hidden", + }, }), { - name: "ProductExportDialogInfo" - } + name: "ProductExportDialogInfo", + }, ); const Option: React.FC<{ @@ -123,7 +123,7 @@ const Option: React.FC<{ return ( - data.exportInfo.fields.includes(field) + data.exportInfo.fields.includes(field), ); const selectedFields = data.exportInfo.fields.filter(field => - fields.includes(field) + fields.includes(field), ); return ( @@ -171,8 +171,8 @@ const FieldAccordion: React.FC @@ -252,7 +252,7 @@ const ProductExportDialogInfo: React.FC = ({ onFetch, onFetchMore, onSelectAllChannels, - onSelectAllWarehouses + onSelectAllWarehouses, }) => { const classes = useStyles({}); const intl = useIntl(); @@ -261,7 +261,7 @@ const ProductExportDialogInfo: React.FC = ({ const { query: channelsQuery, onQueryChange: onChannelsQueryChange, - filteredChannels + filteredChannels, } = useChannelsSearch(channels); const handleFieldChange = (event: ChangeEvent) => @@ -273,10 +273,10 @@ const ProductExportDialogInfo: React.FC = ({ fields: toggle( event.target.name, data.exportInfo.fields, - (a, b) => a === b - ) - } - } + (a, b) => a === b, + ), + }, + }, }); const handleToggleAllFields = (fields: ProductFieldEnum[], setTo: boolean) => @@ -289,16 +289,16 @@ const ProductExportDialogInfo: React.FC = ({ ? [ ...data.exportInfo.fields, ...fields.filter( - field => !data.exportInfo.fields.includes(field) - ) + field => !data.exportInfo.fields.includes(field), + ), ] - : data.exportInfo.fields.filter(field => !fields.includes(field)) - } - } + : data.exportInfo.fields.filter(field => !fields.includes(field)), + }, + }, }); const selectedInventoryFields = data.exportInfo.fields.filter(field => - inventoryFields.includes(field) + inventoryFields.includes(field), ); const selectedAllInventoryFields = selectedInventoryFields.length === inventoryFields.length; @@ -337,7 +337,7 @@ const ProductExportDialogInfo: React.FC = ({ defaultMessage="and {number} more" description="there are more elements of list that are hidden" values={{ - number: selectedChannels.length - maxChips + number: selectedChannels.length - maxChips, }} /> @@ -368,13 +368,13 @@ const ProductExportDialogInfo: React.FC = ({ title={intl.formatMessage({ id: "64aYF0", defaultMessage: "Product Organization", - description: "informations about product organization, header" + description: "informations about product organization, header", })} data={data} fields={[ ProductFieldEnum.CATEGORY, ProductFieldEnum.COLLECTIONS, - ProductFieldEnum.PRODUCT_TYPE + ProductFieldEnum.PRODUCT_TYPE, ]} onChange={handleFieldChange} onToggleAll={handleToggleAllFields} @@ -394,8 +394,8 @@ const ProductExportDialogInfo: React.FC = ({ onAttrtibuteSelect({ target: { name: attributeNamePrefix + attribute.value, - value: undefined - } + value: undefined, + }, }) } key={attribute.value} @@ -408,7 +408,7 @@ const ProductExportDialogInfo: React.FC = ({ defaultMessage="and {number} more" description="there are more elements of list that are hidden" values={{ - number: selectedAttributes.length - maxChips + number: selectedAttributes.length - maxChips, }} /> @@ -424,17 +424,17 @@ const ProductExportDialogInfo: React.FC = ({ onChange={onQueryChange} label={intl.formatMessage({ id: "YicEbK", - defaultMessage: "Search Atrtibuttes" + defaultMessage: "Search Atrtibuttes", })} placeholder={intl.formatMessage({ id: "tIc2/h", defaultMessage: "Search by attribute name", - description: "input helper text, search attributes" + description: "input helper text, search attributes", })} fullWidth InputProps={{ autoComplete: "off", - endAdornment: loading && + endAdornment: loading && , }} />
@@ -468,7 +468,7 @@ const ProductExportDialogInfo: React.FC = ({ title={intl.formatMessage({ id: "jj3Cb8", defaultMessage: "Financial Information", - description: "informations about product prices etc, header" + description: "informations about product prices etc, header", })} data={data} fields={[ProductFieldEnum.CHARGE_TAXES]} @@ -481,7 +481,7 @@ const ProductExportDialogInfo: React.FC = ({ title={intl.formatMessage({ id: "xjpTLF", defaultMessage: "Inventory Information", - description: "informations about product stock, header" + description: "informations about product stock, header", })} quickPeek={ (data.exportInfo.warehouses.length > 0 || @@ -495,8 +495,8 @@ const ProductExportDialogInfo: React.FC = ({ onChange({ target: { name: field, - value: false - } + value: false, + }, }) } /> @@ -508,15 +508,15 @@ const ProductExportDialogInfo: React.FC = ({ className={classes.chip} label={ warehouses.find( - warehouse => warehouse.value === warehouseId + warehouse => warehouse.value === warehouseId, ).label } onClose={() => onWarehouseSelect({ target: { name: warehouseNamePrefix + warehouseId, - value: undefined - } + value: undefined, + }, }) } /> @@ -533,7 +533,7 @@ const ProductExportDialogInfo: React.FC = ({ number: data.exportInfo.warehouses.length + selectedInventoryFields.length - - maxChips + maxChips, }} /> @@ -550,7 +550,7 @@ const ProductExportDialogInfo: React.FC = ({ onChange={() => handleToggleAllFields( inventoryFields, - !selectedAllInventoryFields + !selectedAllInventoryFields, ) } > @@ -581,7 +581,7 @@ const ProductExportDialogInfo: React.FC = ({
- ) + ), ); interface ProductMediaProps { @@ -180,7 +180,7 @@ const ProductMedia: React.FC = props => { onImageDelete, onImageReorder, onImageUpload, - openMediaUrlModal + openMediaUrlModal, } = props; const classes = useStyles(props); @@ -208,13 +208,13 @@ const ProductMedia: React.FC = props => { sortOrder: fileIndex, type: ProductMediaType.IMAGE, url: event.target.result as string, - oembedData: null - } + oembedData: null, + }, ]); }; reader.readAsDataURL(file); }); - } + }, }); return ( @@ -282,7 +282,7 @@ const ProductMedia: React.FC = props => { onSortEnd={onImageReorder} className={classNames({ [classes.root]: true, - [classes.rootDragActive]: isDragActive + [classes.rootDragActive]: isDragActive, })} onDelete={onImageDelete} getEditHref={getImageEditUrl} diff --git a/src/products/components/ProductMediaNavigation/ProductMediaNavigation.tsx b/src/products/components/ProductMediaNavigation/ProductMediaNavigation.tsx index 5941636da..3231304a3 100644 --- a/src/products/components/ProductMediaNavigation/ProductMediaNavigation.tsx +++ b/src/products/components/ProductMediaNavigation/ProductMediaNavigation.tsx @@ -10,23 +10,23 @@ const messages = defineMessages({ allMedia: { id: "XUU9sU", defaultMessage: "All Media", - description: "section header" - } + description: "section header", + }, }); const useStyles = makeStyles( theme => ({ card: { - marginBottom: theme.spacing(2) + marginBottom: theme.spacing(2), }, highlightedImageContainer: { - borderColor: theme.palette.primary.main + borderColor: theme.palette.primary.main, }, image: { height: "100%", objectFit: "contain", userSelect: "none", - width: "100%" + width: "100%", }, imageContainer: { border: "2px solid #eaeaea", @@ -35,17 +35,17 @@ const useStyles = makeStyles( height: 48, overflow: "hidden", padding: theme.spacing(0.5), - position: "relative" + position: "relative", }, root: { display: "grid", gridColumnGap: theme.spacing(2), gridRowGap: theme.spacing(1), - gridTemplateColumns: "repeat(4, 1fr)" + gridTemplateColumns: "repeat(4, 1fr)", }, - toolbar: { marginTop: theme.spacing(-0.5) } + toolbar: { marginTop: theme.spacing(-0.5) }, }), - { name: "ProductMediaNavigation" } + { name: "ProductMediaNavigation" }, ); interface ProductMediaNavigationProps { @@ -84,7 +84,7 @@ const ProductMediaNavigation: React.FC = props => { className={classNames({ [classes.imageContainer]: true, [classes.highlightedImageContainer]: - mediaObj.id === highlighted + mediaObj.id === highlighted, })} onClick={onRowClick(mediaObj.id)} key={mediaObj.id} diff --git a/src/products/components/ProductMediaPage/ProductMediaPage.tsx b/src/products/components/ProductMediaPage/ProductMediaPage.tsx index fd87b8b5d..7a6c3c1b7 100644 --- a/src/products/components/ProductMediaPage/ProductMediaPage.tsx +++ b/src/products/components/ProductMediaPage/ProductMediaPage.tsx @@ -21,23 +21,23 @@ const messages = defineMessages({ editMedia: { id: "Ihp4D3", defaultMessage: "Edit Media", - description: "header" + description: "header", }, mediaInformation: { id: "9RvXNg", defaultMessage: "Media Information", - description: "section header" + description: "section header", }, mediaView: { id: "cW1RIo", defaultMessage: "Media View", - description: "section header" + description: "section header", }, optional: { id: "lzdvwp", defaultMessage: "Optional", - description: "field is optional" - } + description: "field is optional", + }, }); const useStyles = makeStyles( @@ -45,21 +45,21 @@ const useStyles = makeStyles( image: { height: "100%", objectFit: "contain", - width: "100%" + width: "100%", }, imageContainer: { "& iframe": { width: "100%", - maxHeight: 420 + maxHeight: 420, }, border: "1px solid #eaeaea", borderRadius: theme.spacing(), margin: `0 auto ${theme.spacing(2)}px`, width: "100%", - padding: theme.spacing(2) - } + padding: theme.spacing(2), + }, }), - { name: "ProductMediaPage" } + { name: "ProductMediaPage" }, ); interface ProductMediaPageProps { @@ -93,7 +93,7 @@ const ProductMediaPage: React.FC = props => { saveButtonBarState, onDelete, onRowClick, - onSubmit + onSubmit, } = props; const classes = useStyles(props); @@ -153,7 +153,7 @@ const ProductMediaPage: React.FC = props => {
) diff --git a/src/products/components/ProductMediaPopper/ProductMediaPopper.tsx b/src/products/components/ProductMediaPopper/ProductMediaPopper.tsx index 4258cac33..3df9500cc 100644 --- a/src/products/components/ProductMediaPopper/ProductMediaPopper.tsx +++ b/src/products/components/ProductMediaPopper/ProductMediaPopper.tsx @@ -4,7 +4,7 @@ import { MenuItem, MenuList as Menu, Paper, - Popper + Popper, } from "@material-ui/core"; import React from "react"; import { defineMessages, useIntl } from "react-intl"; @@ -21,13 +21,13 @@ const messages = defineMessages({ uploadImages: { id: "9CEu8k", defaultMessage: "Upload Images", - description: "modal button images upload" + description: "modal button images upload", }, uploadUrl: { id: "Q2UXlW", defaultMessage: "Upload URL", - description: "modal button url upload" - } + description: "modal button url upload", + }, }); export const ProductMediaPopper = ({ @@ -35,7 +35,7 @@ export const ProductMediaPopper = ({ imagesUploadRef, setPopperStatus, openMediaUrlModal, - popperStatus + popperStatus, }: ProductMediaPopperProps) => { const intl = useIntl(); diff --git a/src/products/components/ProductOrganization/ProductOrganization.tsx b/src/products/components/ProductOrganization/ProductOrganization.tsx index 7b7d3ac0f..8fcc13a19 100644 --- a/src/products/components/ProductOrganization/ProductOrganization.tsx +++ b/src/products/components/ProductOrganization/ProductOrganization.tsx @@ -5,10 +5,10 @@ import { FormSpacer } from "@saleor/components/FormSpacer"; import Hr from "@saleor/components/Hr"; import Link from "@saleor/components/Link"; import MultiAutocompleteSelectField, { - MultiAutocompleteChoiceType + MultiAutocompleteChoiceType, } from "@saleor/components/MultiAutocompleteSelectField"; import SingleAutocompleteSelectField, { - SingleAutocompleteChoiceType + SingleAutocompleteChoiceType, } from "@saleor/components/SingleAutocompleteSelectField"; import { ProductErrorFragment } from "@saleor/graphql"; import { ChangeEvent } from "@saleor/hooks/useForm"; @@ -30,17 +30,17 @@ interface ProductType { const useStyles = makeStyles( theme => ({ card: { - overflow: "visible" + overflow: "visible", }, cardSubtitle: { fontSize: theme.typography.body1.fontSize, - marginBottom: theme.spacing(0.5) + marginBottom: theme.spacing(0.5), }, label: { - marginBottom: theme.spacing(0.5) - } + marginBottom: theme.spacing(0.5), + }, }), - { name: "ProductOrganization" } + { name: "ProductOrganization" }, ); interface ProductOrganizationProps { @@ -91,7 +91,7 @@ const ProductOrganization: React.FC = props => { productTypes, onCategoryChange, onCollectionChange, - onProductTypeChange + onProductTypeChange, } = props; const classes = useStyles(props); @@ -99,7 +99,7 @@ const ProductOrganization: React.FC = props => { const formErrors = getFormErrors( ["productType", "category", "collections"], - errors + errors, ); return ( @@ -108,7 +108,7 @@ const ProductOrganization: React.FC = props => { title={intl.formatMessage({ id: "JjeZEG", defaultMessage: "Organize Product", - description: "section header" + description: "section header", })} /> @@ -121,7 +121,7 @@ const ProductOrganization: React.FC = props => { disabled={disabled} label={intl.formatMessage({ id: "anK7jD", - defaultMessage: "Product Type" + defaultMessage: "Product Type", })} choices={productTypes} value={data.productType?.id} @@ -153,7 +153,7 @@ const ProductOrganization: React.FC = props => { productType.hasVariants ? intl.formatMessage(commonMessages.yes) : intl.formatMessage(commonMessages.no), - "..." + "...", )} @@ -168,7 +168,7 @@ const ProductOrganization: React.FC = props => { disabled={disabled} label={intl.formatMessage({ id: "ccXLVi", - defaultMessage: "Category" + defaultMessage: "Category", })} choices={disabled ? [] : categories} name="category" @@ -186,7 +186,7 @@ const ProductOrganization: React.FC = props => { error={!!formErrors.collections} label={intl.formatMessage({ id: "ulh3kf", - defaultMessage: "Collections" + defaultMessage: "Collections", })} choices={disabled ? [] : collections} name="collections" @@ -197,7 +197,7 @@ const ProductOrganization: React.FC = props => { id: "v+Pkm+", defaultMessage: "*Optional. Adding product to collection helps users find it.", - description: "field is optional" + description: "field is optional", }) } onChange={onCollectionChange} diff --git a/src/products/components/ProductShipping/ProductShipping.tsx b/src/products/components/ProductShipping/ProductShipping.tsx index 493664081..be53369bb 100644 --- a/src/products/components/ProductShipping/ProductShipping.tsx +++ b/src/products/components/ProductShipping/ProductShipping.tsx @@ -2,7 +2,7 @@ import { Card, CardContent, InputAdornment, - TextField + TextField, } from "@material-ui/core"; import CardTitle from "@saleor/components/CardTitle"; import Grid from "@saleor/components/Grid"; @@ -36,7 +36,7 @@ const ProductShipping: React.FC = props => { title={intl.formatMessage({ id: "3rIMq/", defaultMessage: "Shipping", - description: "product shipping" + description: "product shipping", })} /> @@ -46,7 +46,7 @@ const ProductShipping: React.FC = props => { label={intl.formatMessage({ id: "SUbxSK", defaultMessage: "Weight", - description: "product weight" + description: "product weight", })} error={!!formErrors.weight} helperText={getProductErrorMessage(formErrors.weight, intl)} @@ -60,8 +60,8 @@ const ProductShipping: React.FC = props => { ), inputProps: { - min: 0 - } + min: 0, + }, }} /> diff --git a/src/products/components/ProductStocks/CardAddItemsFooter.tsx b/src/products/components/ProductStocks/CardAddItemsFooter.tsx index 5bd1a693d..dffc96de8 100644 --- a/src/products/components/ProductStocks/CardAddItemsFooter.tsx +++ b/src/products/components/ProductStocks/CardAddItemsFooter.tsx @@ -14,10 +14,10 @@ const useStyles = makeStyles( justifyContent: "space-between", alignItems: "center", width: "100%", - position: "relative" - } + position: "relative", + }, }), - { name: "CardAddItemsFooter" } + { name: "CardAddItemsFooter" }, ); interface CardAddItemsFooterProps { @@ -35,7 +35,7 @@ const CardAddItemsFooter: React.FC = ({ onAdd, testIds, ref, - children + children, }) => { const intl = useIntl(); const classes = useStyles({}); diff --git a/src/products/components/ProductStocks/ProductStocks.tsx b/src/products/components/ProductStocks/ProductStocks.tsx index b0bd93672..6584db22d 100644 --- a/src/products/components/ProductStocks/ProductStocks.tsx +++ b/src/products/components/ProductStocks/ProductStocks.tsx @@ -12,11 +12,11 @@ import { TableHead, TableRow, TextField, - Typography + Typography, } from "@material-ui/core"; import { ChannelData, - ChannelPriceAndPreorderArgs + ChannelPriceAndPreorderArgs, } from "@saleor/channels/utils"; import CardTitle from "@saleor/components/CardTitle"; import ControlledCheckbox from "@saleor/components/ControlledCheckbox"; @@ -34,7 +34,7 @@ import { IconButton, ICONBUTTON_SIZE, makeStyles, - PlusIcon + PlusIcon, } from "@saleor/macaw-ui"; import { renderCollection } from "@saleor/misc"; import { getFormErrors, getProductErrorMessage } from "@saleor/utils/errors"; @@ -79,7 +79,7 @@ export interface ProductStocksProps { warehouses: WarehouseFragment[]; onVariantChannelListingChange?: ( id: string, - data: Partial + data: Partial, ) => void; onChange: FormsetChange; onChangePreorderEndDate: FormChange; @@ -94,92 +94,92 @@ const useStyles = makeStyles( theme => ({ colAction: { padding: 0, - width: `calc(${ICONBUTTON_SIZE}px + ${theme.spacing(1)})` + width: `calc(${ICONBUTTON_SIZE}px + ${theme.spacing(1)})`, }, colName: {}, colQuantity: { textAlign: "right", - width: 150 + width: 150, }, colSoldUnits: { textAlign: "right", - width: 150 + width: 150, }, colThreshold: { textAlign: "right", - width: 180 + width: 180, }, editWarehouses: { - marginRight: theme.spacing(-1) + marginRight: theme.spacing(-1), }, input: { padding: theme.spacing(1.5), - textAlign: "right" + textAlign: "right", }, menuItem: { "&:not(:last-of-type)": { - marginBottom: theme.spacing(2) - } + marginBottom: theme.spacing(2), + }, }, noWarehouseInfo: { - marginTop: theme.spacing() + marginTop: theme.spacing(), }, paper: { - padding: theme.spacing(2) + padding: theme.spacing(2), }, popper: { marginTop: theme.spacing(1), - zIndex: 2 + zIndex: 2, }, quantityContainer: { - paddingTop: theme.spacing() + paddingTop: theme.spacing(), }, quantityHeader: { alignItems: "center", display: "flex", - justifyContent: "space-between" + justifyContent: "space-between", }, skuInputContainer: { display: "grid", gridColumnGap: theme.spacing(3), - gridTemplateColumns: "repeat(2, 1fr)" + gridTemplateColumns: "repeat(2, 1fr)", }, dateTimeInputs: { marginTop: theme.spacing(2), - marginBottom: theme.spacing(2) + marginBottom: theme.spacing(2), }, preorderInfo: { marginBottom: theme.spacing(2), marginTop: theme.spacing(2), - display: "block" + display: "block", }, caption: { - fontSize: 14 + fontSize: 14, }, thresholdRow: { display: "grid", gridColumnGap: theme.spacing(3), gridTemplateColumns: "3fr 1fr", - marginTop: theme.spacing(1) + marginTop: theme.spacing(1), }, thresholdInput: { - maxWidth: 400 + maxWidth: 400, }, preorderItemsLeftCount: { fontSize: 14, paddingTop: theme.spacing(2), - textAlign: "center" + textAlign: "center", }, preorderLimitInfo: { - marginTop: theme.spacing(3) + marginTop: theme.spacing(3), }, preview: { - marginLeft: theme.spacing(1) - } + marginLeft: theme.spacing(1), + }, }), { - name: "ProductStocks" - } + name: "ProductStocks", + }, ); const ProductStocks: React.FC = ({ @@ -198,7 +198,7 @@ const ProductStocks: React.FC = ({ onVariantChannelListingChange, onWarehouseStockAdd, onWarehouseStockDelete, - onWarehouseConfigure + onWarehouseConfigure, }) => { const classes = useStyles({}); const intl = useIntl(); @@ -208,12 +208,12 @@ const ProductStocks: React.FC = ({ const warehousesToAssign = warehouses?.filter( - warehouse => !stocks.some(stock => stock.id === warehouse.id) + warehouse => !stocks.some(stock => stock.id === warehouse.id), ) || []; const formErrors = getFormErrors(["sku"], errors); const onThresholdChange = createNonNegativeValueChangeHandler( - onFormDataChange + onFormDataChange, ); return ( @@ -222,7 +222,7 @@ const ProductStocks: React.FC = ({ title={intl.formatMessage({ id: "4qe6hO", defaultMessage: "Inventory", - description: "product stock, section header" + description: "product stock, section header", })} /> @@ -234,7 +234,7 @@ const ProductStocks: React.FC = ({ helperText={getProductErrorMessage(formErrors.sku, intl)} label={intl.formatMessage({ id: "xB7BTp", - defaultMessage: "SKU (Stock Keeping Unit)" + defaultMessage: "SKU (Stock Keeping Unit)", })} name="sku" onChange={onFormDataChange} @@ -318,7 +318,7 @@ const ProductStocks: React.FC = ({ values={{ a: chunks => ( {chunks} - ) + ), }} /> @@ -331,7 +331,7 @@ const ProductStocks: React.FC = ({ values={{ a: chunks => ( {chunks} - ) + ), }} /> @@ -376,7 +376,7 @@ const ProductStocks: React.FC = ({ {renderCollection(stocks, stock => { const handleQuantityChange = createNonNegativeValueChangeHandler( - event => onChange(stock.id, event.target.value) + event => onChange(stock.id, event.target.value), ); return ( @@ -395,7 +395,7 @@ const ProductStocks: React.FC = ({ inputProps={{ className: classes.input, min: 0, - type: "number" + type: "number", }} onChange={handleQuantityChange} value={stock.value} @@ -448,7 +448,7 @@ const ProductStocks: React.FC = ({ @@ -481,7 +481,7 @@ const ProductStocks: React.FC = ({ id: "REVk27", defaultMessage: "Set up an end date of preorder. When end date will be reached product will be automatically taken from preorder to standard selling", - description: "info text" + description: "info text", })} @@ -498,8 +498,8 @@ const ProductStocks: React.FC = ({ onChangePreorderEndDate({ target: { name: "preorderEndDateTime", - value: event - } + value: event, + }, }) } /> @@ -513,19 +513,19 @@ const ProductStocks: React.FC = ({ onFormDataChange({ target: { name: "hasPreorderEndDate", - value: !data.hasPreorderEndDate - } + value: !data.hasPreorderEndDate, + }, }) } > {data.hasPreorderEndDate ? intl.formatMessage({ id: "2qJc9y", - defaultMessage: "CANCEL END DATE" + defaultMessage: "CANCEL END DATE", }) : intl.formatMessage({ id: "7Ii5ZQ", - defaultMessage: "SETUP END DATE" + defaultMessage: "SETUP END DATE", })} @@ -533,24 +533,24 @@ const ProductStocks: React.FC = ({ id: "Gz+4CI", defaultMessage: "Preordered products will be available in all warehouses. You can set a threshold for sold quantity. Leaving input blank will be interpreted as no limit to sale. Sold items will be allocated at the warehouse assigned to chosen shipping zone.", - description: "info text" + description: "info text", })}
= ({ { id: "7wkGxW", defaultMessage: "{unitsLeft} units left", - description: "app has been installed" + description: "app has been installed", }, - { unitsLeft } + { unitsLeft }, ) : intl.formatMessage({ id: "CEavJt", defaultMessage: "Unlimited", - description: "section header" + description: "section header", })} )} @@ -636,11 +636,11 @@ const ProductStocks: React.FC = ({ inputProps={{ className: classes.input, min: 0, - type: "number" + type: "number", }} placeholder={intl.formatMessage({ id: "ekXood", - defaultMessage: "Unlimited" + defaultMessage: "Unlimited", })} onChange={e => { onVariantChannelListingChange(listing.id, { @@ -649,7 +649,7 @@ const ProductStocks: React.FC = ({ preorderThreshold: e.target.value === "" ? undefined - : Number(e.target.value) + : Number(e.target.value), }); }} value={listing?.preorderThreshold ?? ""} diff --git a/src/products/components/ProductTaxes/ProductTaxes.tsx b/src/products/components/ProductTaxes/ProductTaxes.tsx index ae5b1b19f..c260c8574 100644 --- a/src/products/components/ProductTaxes/ProductTaxes.tsx +++ b/src/products/components/ProductTaxes/ProductTaxes.tsx @@ -26,18 +26,18 @@ export interface ProductTaxesProps { const useStyles = makeStyles( theme => ({ content: { - paddingTop: theme.spacing(2) + paddingTop: theme.spacing(2), }, hr: { - margin: theme.spacing(2, 0) + margin: theme.spacing(2, 0), }, select: { - margin: theme.spacing(2, 0) - } + margin: theme.spacing(2, 0), + }, }), { - name: "ProductTaxes" - } + name: "ProductTaxes", + }, ); const ProductTaxes: React.FC = ({ @@ -46,7 +46,7 @@ const ProductTaxes: React.FC = ({ selectedTaxTypeDisplayName, taxTypes, onChange, - onTaxTypeChange + onTaxTypeChange, }) => { const intl = useIntl(); const classes = useStyles({}); @@ -62,7 +62,7 @@ const ProductTaxes: React.FC = ({ label={intl.formatMessage({ id: "iYH3Y7", defaultMessage: "Override the product type's tax rate", - description: "checkbox" + description: "checkbox", })} name="changeTaxCode" onChange={onChange} @@ -75,7 +75,7 @@ const ProductTaxes: React.FC = ({ label={intl.formatMessage({ id: "TfY/Pi", defaultMessage: "Charge taxes on this product", - description: "checkbox" + description: "checkbox", })} name="chargeTaxes" onChange={onChange} @@ -89,7 +89,7 @@ const ProductTaxes: React.FC = ({ label={intl.formatMessage({ id: "CdIHMu", defaultMessage: "Tax Rate", - description: "select tax ratte" + description: "select tax ratte", })} name="taxCode" onChange={onTaxTypeChange} @@ -97,11 +97,11 @@ const ProductTaxes: React.FC = ({ choices={ taxTypes?.map(taxType => ({ label: taxType.description, - value: taxType.taxCode + value: taxType.taxCode, })) || [] } InputProps={{ - autoComplete: "off" + autoComplete: "off", }} /> )} diff --git a/src/products/components/ProductUpdatePage/ProductUpdatePage.test.tsx b/src/products/components/ProductUpdatePage/ProductUpdatePage.test.tsx index b06a500d8..f1581f9bd 100644 --- a/src/products/components/ProductUpdatePage/ProductUpdatePage.test.tsx +++ b/src/products/components/ProductUpdatePage/ProductUpdatePage.test.tsx @@ -34,8 +34,8 @@ jest.mock("@saleor/utils/richText/useRichText"); setEnd: () => {}, commonAncestorContainer: { nodeName: "BODY", - ownerDocument: document - } + ownerDocument: document, + }, }); const props: ProductUpdatePageProps = { @@ -86,13 +86,13 @@ const props: ProductUpdatePageProps = { taxTypes, variants: product.variants, warehouses: warehouseList, - attributeValues: [] + attributeValues: [], }; const selectors = { dropdown: `[data-test-id="autocomplete-dropdown"]`, empty: `[data-test-type="empty"]`, - input: `[data-test-id="attribute-value"] input` + input: `[data-test-id="attribute-value"] input`, }; describe("Product details page", () => { @@ -103,7 +103,7 @@ describe("Product details page", () => { - + , ); expect(component.find(selectors.dropdown).exists()).toBeFalsy(); @@ -125,7 +125,7 @@ describe("Product details page", () => { component .find(selectors.input) .first() - .prop("value") + .prop("value"), ).toEqual(""); await act(async () => { diff --git a/src/products/components/ProductUpdatePage/ProductUpdatePage.tsx b/src/products/components/ProductUpdatePage/ProductUpdatePage.tsx index 392555e83..61cc871ec 100644 --- a/src/products/components/ProductUpdatePage/ProductUpdatePage.tsx +++ b/src/products/components/ProductUpdatePage/ProductUpdatePage.tsx @@ -2,11 +2,11 @@ import { OutputData } from "@editorjs/editorjs"; import { extensionMountPoints, mapToMenuItems, - useExtensions + useExtensions, } from "@saleor/apps/useExtensions"; import { getAttributeValuesFromReferences, - mergeAttributeValues + mergeAttributeValues, } from "@saleor/attributes/utils/data"; import { ChannelData } from "@saleor/channels/utils"; import AssignAttributeValueDialog from "@saleor/components/AssignAttributeValueDialog"; @@ -34,7 +34,7 @@ import { SearchPagesQuery, SearchProductsQuery, TaxTypeFragment, - WarehouseFragment + WarehouseFragment, } from "@saleor/graphql"; import { SubmitPromise } from "@saleor/hooks/useForm"; import { FormsetData } from "@saleor/hooks/useFormset"; @@ -52,7 +52,7 @@ import { FetchMoreProps, ListActions, RelayToFlat, - ReorderAction + ReorderAction, } from "@saleor/types"; import React from "react"; import { useIntl } from "react-intl"; @@ -68,7 +68,7 @@ import ProductTaxes from "../ProductTaxes"; import ProductVariants from "../ProductVariants"; import ProductUpdateForm, { ProductUpdateData, - ProductUpdateHandlers + ProductUpdateHandlers, } from "./form"; export interface ProductUpdatePageProps extends ListActions, ChannelProps { @@ -200,25 +200,25 @@ export const ProductUpdatePage: React.FC = ({ onCloseDialog, channelsWithVariantsData, onChannelsChange, - onAttributeSelectBlur + onAttributeSelectBlur, }) => { const intl = useIntl(); const navigate = useNavigator(); const [selectedCategory, setSelectedCategory] = useStateFromProps( - product?.category?.name || "" + product?.category?.name || "", ); const [mediaUrlModalStatus, setMediaUrlModalStatus] = useStateFromProps( - isMediaUrlModalVisible || false + isMediaUrlModalVisible || false, ); const [selectedCollections, setSelectedCollections] = useStateFromProps( - getChoices(maybe(() => product.collections, [])) + getChoices(maybe(() => product.collections, [])), ); const [selectedTaxType, setSelectedTaxType] = useStateFromProps( - product?.taxType.description + product?.taxType.description, ); const categories = getChoices(categoryChoiceList); @@ -227,7 +227,7 @@ export const ProductUpdatePage: React.FC = ({ const taxTypeChoices = taxTypes?.map(taxType => ({ label: taxType.description, - value: taxType.taxCode + value: taxType.taxCode, })) || []; const canOpenAssignReferencesAttributeDialog = !!assignReferencesAttributeId; @@ -235,21 +235,21 @@ export const ProductUpdatePage: React.FC = ({ const handleAssignReferenceAttribute = ( attributeValues: string[], data: ProductUpdateData, - handlers: ProductUpdateHandlers + handlers: ProductUpdateHandlers, ) => { handlers.selectAttributeReference( assignReferencesAttributeId, mergeAttributeValues( assignReferencesAttributeId, attributeValues, - data.attributes - ) + data.attributes, + ), ); onCloseDialog(); }; const { PRODUCT_DETAILS_MORE_ACTIONS } = useExtensions( - extensionMountPoints.PRODUCT_DETAILS + extensionMountPoints.PRODUCT_DETAILS, ); const extensionMenuItems = mapToMenuItems(PRODUCT_DETAILS_MORE_ACTIONS); @@ -289,7 +289,7 @@ export const ProductUpdatePage: React.FC = ({ handlers, submit, isSaveDisabled, - attributeRichTextGetters + attributeRichTextGetters, }) => { const availabilityCommonProps = { managePermissions: [PermissionEnum.MANAGE_PRODUCTS], @@ -297,20 +297,20 @@ export const ProductUpdatePage: React.FC = ({ hiddenLabel: intl.formatMessage({ id: "saKXY3", defaultMessage: "Not published", - description: "product label" + description: "product label", }), visibleLabel: intl.formatMessage({ id: "qJedl0", defaultMessage: "Published", - description: "product label" - }) + description: "product label", + }), }, errors: channelsErrors, allChannelsCount, disabled, onChange: handlers.changeChannels, - openModal: openChannelsModal + openModal: openChannelsModal, }; return ( @@ -447,7 +447,7 @@ export const ProductUpdatePage: React.FC = ({ helperText={intl.formatMessage({ id: "LKoIB1", defaultMessage: - "Add search engine title and description to make this product easier to find" + "Add search engine title and description to make this product easier to find", })} /> @@ -488,14 +488,14 @@ export const ProductUpdatePage: React.FC = ({ hiddenLabel: intl.formatMessage({ id: "saKXY3", defaultMessage: "Not published", - description: "product label" + description: "product label", }), visibleLabel: intl.formatMessage({ id: "qJedl0", defaultMessage: "Published", - description: "product label" - }) + description: "product label", + }), }} errors={channelsErrors} channels={data.channelsData} @@ -529,7 +529,7 @@ export const ProductUpdatePage: React.FC = ({ assignReferencesAttributeId, data.attributes, referencePages, - referenceProducts + referenceProducts, )} hasMore={handlers.fetchMoreReferences?.hasMore} open={canOpenAssignReferencesAttributeDialog} @@ -541,7 +541,7 @@ export const ProductUpdatePage: React.FC = ({ handleAssignReferenceAttribute( attributeValues, data, - handlers + handlers, ) } /> diff --git a/src/products/components/ProductUpdatePage/form.tsx b/src/products/components/ProductUpdatePage/form.tsx index 7c4ceb54e..c7179a2c4 100644 --- a/src/products/components/ProductUpdatePage/form.tsx +++ b/src/products/components/ProductUpdatePage/form.tsx @@ -4,7 +4,7 @@ import { getRichTextAttributesFromMap, getRichTextDataFromAttributes, mergeAttributes, - RichTextProps + RichTextProps, } from "@saleor/attributes/utils/data"; import { createAttributeChangeHandler, @@ -13,12 +13,12 @@ import { createAttributeReferenceChangeHandler, createAttributeValueReorderHandler, createFetchMoreReferencesHandler, - createFetchReferencesHandler + createFetchReferencesHandler, } from "@saleor/attributes/utils/handlers"; import { ChannelData, ChannelPreorderArgs, - ChannelPriceArgs + ChannelPriceArgs, } from "@saleor/channels/utils"; import { AttributeInput } from "@saleor/components/Attributes"; import { useExitFormDialog } from "@saleor/components/Form/useExitFormDialog"; @@ -29,35 +29,35 @@ import { ProductFragment, SearchPagesQuery, SearchProductsQuery, - SearchWarehousesQuery + SearchWarehousesQuery, } from "@saleor/graphql"; import useForm, { CommonUseFormResultWithHandlers, FormChange, FormErrors, - SubmitPromise + SubmitPromise, } from "@saleor/hooks/useForm"; import useFormset, { FormsetAtomicData, FormsetChange, - FormsetData + FormsetData, } from "@saleor/hooks/useFormset"; import useHandleFormSubmit from "@saleor/hooks/useHandleFormSubmit"; import { errorMessages } from "@saleor/intl"; import { getAttributeInputFromProduct, getProductUpdatePageFormData, - getStockInputFromProduct + getStockInputFromProduct, } from "@saleor/products/utils/data"; import { createChannelsChangeHandler, createChannelsPreorderChangeHandler, createChannelsPriceChangeHandler, - createPreorderEndDateChangeHandler + createPreorderEndDateChangeHandler, } from "@saleor/products/utils/handlers"; import { validateCostPrice, - validatePrice + validatePrice, } from "@saleor/products/utils/validation"; import { PRODUCT_UPDATE_FORM_ID } from "@saleor/products/views/ProductUpdate/consts"; import { ChannelsWithVariantsData } from "@saleor/products/views/ProductUpdate/types"; @@ -147,7 +147,7 @@ export interface ProductUpdateHandlers "changeChannels", ( id: string, - data: Omit + data: Omit, ) => void >, Record<"selectAttributeReference", FormsetChange>, @@ -210,7 +210,7 @@ export interface ProductUpdateFormProps extends UseProductUpdateFormOpts { const getStocksData = ( product: ProductFragment, - stocks: FormsetData + stocks: FormsetData, ) => { if (product?.productType?.hasVariants) { return { addStocks: [], removeStocks: [], updateStocks: [] }; @@ -223,12 +223,12 @@ const getStocksData = ( return { addStocks: stocks.filter(stock => - stockDiff.added.some(addedStock => addedStock === stock.id) + stockDiff.added.some(addedStock => addedStock === stock.id), ), removeStocks: stockDiff.removed, updateStocks: stocks.filter( - stock => !stockDiff.added.some(addedStock => addedStock === stock.id) - ) + stock => !stockDiff.added.some(addedStock => addedStock === stock.id), + ), }; }; @@ -236,7 +236,7 @@ function useProductUpdateForm( product: ProductFragment, onSubmit: (data: ProductUpdateSubmitData) => SubmitPromise, disabled: boolean, - opts: UseProductUpdateFormOpts + opts: UseProductUpdateFormOpts, ): UseProductUpdateFormOutput { const intl = useIntl(); const initial = useMemo( @@ -246,19 +246,19 @@ function useProductUpdateForm( product?.variants, opts.currentChannels, opts.channelsData, - opts.channelsWithVariants + opts.channelsWithVariants, ), [ product, opts.currentChannels, opts.channelsData, - opts.channelsWithVariants - ] + opts.channelsWithVariants, + ], ); const form = useForm(initial, undefined, { confirmLeave: true, - formId: PRODUCT_UPDATE_FORM_ID + formId: PRODUCT_UPDATE_FORM_ID, }); const { @@ -266,82 +266,82 @@ function useProductUpdateForm( triggerChange, toggleValue, data: formData, - setIsSubmitDisabled + setIsSubmitDisabled, } = form; const attributes = useFormset(getAttributeInputFromProduct(product)); const { getters: attributeRichTextGetters, - getValues: getAttributeRichTextValues + getValues: getAttributeRichTextValues, } = useMultipleRichText({ initial: getRichTextDataFromAttributes(attributes.data), - triggerChange + triggerChange, }); const attributesWithNewFileValue = useFormset([]); const stocks = useFormset(getStockInputFromProduct(product)); const richText = useRichText({ initial: product?.description, loading: !product, - triggerChange + triggerChange, }); const { setExitDialogSubmitRef } = useExitFormDialog({ - formId: PRODUCT_UPDATE_FORM_ID + formId: PRODUCT_UPDATE_FORM_ID, }); const { isMetadataModified, isPrivateMetadataModified, - makeChangeHandler: makeMetadataChangeHandler + makeChangeHandler: makeMetadataChangeHandler, } = useMetadataChangeTrigger(); const handleCollectionSelect = createMultiAutocompleteSelectHandler( event => toggleValue(event), opts.setSelectedCollections, opts.selectedCollections, - opts.collections + opts.collections, ); const handleCategorySelect = createSingleAutocompleteSelectHandler( handleChange, opts.setSelectedCategory, - opts.categories + opts.categories, ); const handleAttributeChange = createAttributeChangeHandler( attributes.change, - triggerChange + triggerChange, ); const handleAttributeMultiChange = createAttributeMultiChangeHandler( attributes.change, attributes.data, - triggerChange + triggerChange, ); const handleAttributeReferenceChange = createAttributeReferenceChangeHandler( attributes.change, - triggerChange + triggerChange, ); const handleFetchReferences = createFetchReferencesHandler( attributes.data, opts.assignReferencesAttributeId, opts.fetchReferencePages, - opts.fetchReferenceProducts + opts.fetchReferenceProducts, ); const handleFetchMoreReferences = createFetchMoreReferencesHandler( attributes.data, opts.assignReferencesAttributeId, opts.fetchMoreReferencePages, - opts.fetchMoreReferenceProducts + opts.fetchMoreReferenceProducts, ); const handleAttributeFileChange = createAttributeFileChangeHandler( attributes.change, attributesWithNewFileValue.data, attributesWithNewFileValue.add, attributesWithNewFileValue.change, - triggerChange + triggerChange, ); const handleAttributeValueReorder = createAttributeValueReorderHandler( attributes.change, attributes.data, - triggerChange + triggerChange, ); const handleStockChange: FormsetChange = (id, value) => { triggerChange(); @@ -351,11 +351,11 @@ function useProductUpdateForm( triggerChange(); stocks.add({ data: { - quantityAllocated: 0 + quantityAllocated: 0, }, id, label: opts.warehouses.find(warehouse => warehouse.id === id).name, - value: "0" + value: "0", }); }; const handleStockDelete = (id: string) => { @@ -365,32 +365,32 @@ function useProductUpdateForm( const handleTaxTypeSelect = createSingleAutocompleteSelectHandler( handleChange, opts.setSelectedTaxType, - opts.taxTypes + opts.taxTypes, ); const changeMetadata = makeMetadataChangeHandler(handleChange); const handleChannelsChange = createChannelsChangeHandler( opts.isSimpleProduct ? opts.currentChannels : opts.channelsData, opts.isSimpleProduct ? opts.setChannels : opts.setChannelsData, - triggerChange + triggerChange, ); const handleChannelPreorderChange = createChannelsPreorderChangeHandler( opts.isSimpleProduct ? opts.currentChannels : opts.channelsData, opts.isSimpleProduct ? opts.setChannels : opts.setChannelsData, - triggerChange + triggerChange, ); const handleChannelPriceChange = createChannelsPriceChangeHandler( opts.isSimpleProduct ? opts.currentChannels : opts.channelsData, opts.isSimpleProduct ? opts.setChannels : opts.setChannelsData, - triggerChange + triggerChange, ); const handlePreorderEndDateChange = createPreorderEndDateChangeHandler( form, triggerChange, - intl.formatMessage(errorMessages.preorderEndDateInFutureErrorText) + intl.formatMessage(errorMessages.preorderEndDateInFutureErrorText), ); const data: ProductUpdateData = { @@ -401,10 +401,10 @@ function useProductUpdateForm( attributes.data, attributesWithNewFileValue.data, opts.referencePages, - opts.referenceProducts + opts.referenceProducts, ), description: null, - stocks: stocks.data + stocks: stocks.data, }; const getSubmitData = async (): Promise => ({ @@ -415,11 +415,11 @@ function useProductUpdateForm( attributes.data, getRichTextAttributesFromMap( attributes.data, - await getAttributeRichTextValues() - ) + await getAttributeRichTextValues(), + ), ), attributesWithNewFileValue: attributesWithNewFileValue.data, - description: await richText.getValue() + description: await richText.getValue(), }); const handleSubmit = async (data: ProductUpdateSubmitData) => { @@ -434,7 +434,7 @@ function useProductUpdateForm( const handleFormSubmit = useHandleFormSubmit({ formId: form.formId, - onSubmit: handleSubmit + onSubmit: handleSubmit, }); const submit = async () => handleFormSubmit(await getSubmitData()); @@ -460,7 +460,7 @@ function useProductUpdateForm( const hasInvalidChannelListingPrices = data.channelListings.some( channel => - validatePrice(channel.price) || validateCostPrice(channel.costPrice) + validatePrice(channel.price) || validateCostPrice(channel.costPrice), ); if (hasInvalidChannelListingPrices) { @@ -497,12 +497,12 @@ function useProductUpdateForm( selectAttributeReference: handleAttributeReferenceChange, selectCategory: handleCategorySelect, selectCollection: handleCollectionSelect, - selectTaxRate: handleTaxTypeSelect + selectTaxRate: handleTaxTypeSelect, }, submit, isSaveDisabled, richText, - attributeRichTextGetters + attributeRichTextGetters, }; } @@ -517,7 +517,7 @@ const ProductUpdateForm: React.FC = ({ product, onSubmit, disabled, - rest + rest, ); return ( diff --git a/src/products/components/ProductVariantAttributes/ProductVariantAttributes.tsx b/src/products/components/ProductVariantAttributes/ProductVariantAttributes.tsx index eefb98e65..a90ae4a6a 100644 --- a/src/products/components/ProductVariantAttributes/ProductVariantAttributes.tsx +++ b/src/products/components/ProductVariantAttributes/ProductVariantAttributes.tsx @@ -3,12 +3,12 @@ import CardTitle from "@saleor/components/CardTitle"; import FormSpacer from "@saleor/components/FormSpacer"; import Grid from "@saleor/components/Grid"; import SingleAutocompleteSelectField, { - SingleAutocompleteChoiceType + SingleAutocompleteChoiceType, } from "@saleor/components/SingleAutocompleteSelectField"; import Skeleton from "@saleor/components/Skeleton"; import { ProductErrorWithAttributesFragment, - ProductVariantFragment + ProductVariantFragment, } from "@saleor/graphql"; import { FormsetAtomicData, FormsetChange } from "@saleor/hooks/useFormset"; import { commonMessages } from "@saleor/intl"; @@ -37,11 +37,11 @@ interface ProductVariantAttributesProps { function getAttributeDisplayValue( id: string, slug: string, - attributes: VariantAttributeInput[] + attributes: VariantAttributeInput[], ): string { const attribute = attributes.find(attr => attr.id === id); const attributeValue = attribute.data.values.find( - value => value.node.slug === slug + value => value.node.slug === slug, ); if (!!attributeValue) { return attributeValue.node.name; @@ -52,7 +52,7 @@ function getAttributeDisplayValue( function getAttributeValue( id: string, - attributes: VariantAttributeInput[] + attributes: VariantAttributeInput[], ): string { const attribute = attributes.find(attr => attr.id === id); return attribute?.value === null ? undefined : attribute.value; @@ -60,12 +60,12 @@ function getAttributeValue( function getAttributeValueChoices( id: string, - attributes: VariantAttributeInput[] + attributes: VariantAttributeInput[], ): SingleAutocompleteChoiceType[] { const attribute = attributes.find(attr => attr.id === id); return attribute.data.values.map(attributeValue => ({ label: attributeValue.node.name, - value: attributeValue.node.slug + value: attributeValue.node.slug, })); } @@ -73,7 +73,7 @@ const ProductVariantAttributes: React.FC = ({ attributes, disabled, errors, - onChange + onChange, }) => { const intl = useIntl(); @@ -89,7 +89,7 @@ const ProductVariantAttributes: React.FC = ({ ) : ( attributes.map(attribute => { const error = errors.find(err => - err.attributes?.includes(attribute.id) + err.attributes?.includes(attribute.id), ); return ( @@ -99,12 +99,12 @@ const ProductVariantAttributes: React.FC = ({ displayValue={getAttributeDisplayValue( attribute.id, attribute.value, - attributes + attributes, )} error={!!error} helperText={getProductVariantAttributeErrorMessage( error, - intl + intl, )} label={attribute.label} name={`attribute:${attribute.id}`} @@ -124,7 +124,7 @@ const ProductVariantAttributes: React.FC = ({ {errors .filter( error => - error.field === "attributes" && error.attributes === null + error.field === "attributes" && error.attributes === null, ) .map(error => ( diff --git a/src/products/components/ProductVariantCheckoutSettings/ProductVariantCheckoutSettings.tsx b/src/products/components/ProductVariantCheckoutSettings/ProductVariantCheckoutSettings.tsx index 0e094fd2d..84fa5e6eb 100644 --- a/src/products/components/ProductVariantCheckoutSettings/ProductVariantCheckoutSettings.tsx +++ b/src/products/components/ProductVariantCheckoutSettings/ProductVariantCheckoutSettings.tsx @@ -55,8 +55,8 @@ const ProductVariantCheckoutSettings: React.FC diff --git a/src/products/components/ProductVariantCheckoutSettings/messages.ts b/src/products/components/ProductVariantCheckoutSettings/messages.ts index 7ff6ff46d..754eac212 100644 --- a/src/products/components/ProductVariantCheckoutSettings/messages.ts +++ b/src/products/components/ProductVariantCheckoutSettings/messages.ts @@ -4,17 +4,17 @@ export const messages = defineMessages({ checkoutLimits: { id: "8uo4v1", defaultMessage: "Checkout limits", - description: "title" + description: "title", }, checkoutLineLimit: { id: "C7I2lg", defaultMessage: "Limit quantity per checkout (optional)", - description: "input label" + description: "input label", }, checkoutLimitsDescription: { id: "n3+6w5", defaultMessage: "Your customer won't be allowed to buy bigger quantity per checkout than shown here.", - description: "input helper text" - } + description: "input helper text", + }, }); diff --git a/src/products/components/ProductVariantCheckoutSettings/styles.ts b/src/products/components/ProductVariantCheckoutSettings/styles.ts index b0a63765c..fd035d19f 100644 --- a/src/products/components/ProductVariantCheckoutSettings/styles.ts +++ b/src/products/components/ProductVariantCheckoutSettings/styles.ts @@ -3,10 +3,10 @@ import { makeStyles } from "@saleor/macaw-ui"; const useStyles = makeStyles( theme => ({ preview: { - marginLeft: theme.spacing(1) - } + marginLeft: theme.spacing(1), + }, }), - { name: "ProductVariantCheckoutSettings" } + { name: "ProductVariantCheckoutSettings" }, ); export default useStyles; diff --git a/src/products/components/ProductVariantCreateDialog/ProductVariantCreateDialog.tsx b/src/products/components/ProductVariantCreateDialog/ProductVariantCreateDialog.tsx index 87bcfd4e2..f0229cb9a 100644 --- a/src/products/components/ProductVariantCreateDialog/ProductVariantCreateDialog.tsx +++ b/src/products/components/ProductVariantCreateDialog/ProductVariantCreateDialog.tsx @@ -3,7 +3,7 @@ import { DialogActions, DialogContent, DialogTitle, - Typography + Typography, } from "@material-ui/core"; import ConfirmButton from "@saleor/components/ConfirmButton"; import Form from "@saleor/components/Form"; @@ -33,7 +33,7 @@ const ProductVariantCreateDialog: React.FC = pr const classes = useStyles(props); const initialForm = { - option: ProductVariantCreateOptionEnum.MULTIPLE + option: ProductVariantCreateOptionEnum.MULTIPLE, }; const handleSubmit = (form: ProductVariantCreateDialogForm) => { @@ -44,13 +44,13 @@ const ProductVariantCreateDialog: React.FC = pr { title: messages.optionMultipleTitle, subtitle: messages.optionMultipleDescription, - type: ProductVariantCreateOptionEnum.MULTIPLE + type: ProductVariantCreateOptionEnum.MULTIPLE, }, { title: messages.optionSingleTitle, subtitle: messages.optionSingleDescription, - type: ProductVariantCreateOptionEnum.SINGLE - } + type: ProductVariantCreateOptionEnum.SINGLE, + }, ]; return ( @@ -81,7 +81,7 @@ const ProductVariantCreateDialog: React.FC = pr
), - value: option.type + value: option.type, }))} name="option" value={data.option} diff --git a/src/products/components/ProductVariantCreateDialog/messages.ts b/src/products/components/ProductVariantCreateDialog/messages.ts index 734645e97..180374458 100644 --- a/src/products/components/ProductVariantCreateDialog/messages.ts +++ b/src/products/components/ProductVariantCreateDialog/messages.ts @@ -4,32 +4,32 @@ export const messages = defineMessages({ title: { id: "XDeh5D", defaultMessage: "Create Variants", - description: "dialog header" + description: "dialog header", }, description: { id: "W3JbSQ", defaultMessage: "How would you like to create variants:", - description: "create product variants" + description: "create product variants", }, optionMultipleTitle: { id: "uxZZXx", defaultMessage: "Create multiple variant via variant creator", - description: "option" + description: "option", }, optionMultipleDescription: { id: "vXA5xU", defaultMessage: "Use variant creator to create matrix of selected attribute values to create variants", - description: "option description" + description: "option description", }, optionSingleTitle: { id: "9EMudJ", defaultMessage: "Create single variant", - description: "option" + description: "option", }, optionSingleDescription: { id: "EzU7KV", defaultMessage: "Create new variant using variant details view", - description: "option description" - } + description: "option description", + }, }); diff --git a/src/products/components/ProductVariantCreateDialog/styles.ts b/src/products/components/ProductVariantCreateDialog/styles.ts index b2f577e13..15b7fdbb9 100644 --- a/src/products/components/ProductVariantCreateDialog/styles.ts +++ b/src/products/components/ProductVariantCreateDialog/styles.ts @@ -4,11 +4,11 @@ export const useStyles = makeStyles( theme => ({ option: { marginBottom: theme.spacing(2), - width: 400 + width: 400, }, dialogContent: { - padding: 0 - } + padding: 0, + }, }), - { name: "ProductVariantCreateDialog" } + { name: "ProductVariantCreateDialog" }, ); diff --git a/src/products/components/ProductVariantCreateDialog/types.ts b/src/products/components/ProductVariantCreateDialog/types.ts index 83090fbcf..11d98b17a 100644 --- a/src/products/components/ProductVariantCreateDialog/types.ts +++ b/src/products/components/ProductVariantCreateDialog/types.ts @@ -1,4 +1,4 @@ export enum ProductVariantCreateOptionEnum { MULTIPLE = "multiple", - SINGLE = "single" + SINGLE = "single", } diff --git a/src/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx b/src/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx index 404967065..5c80d612d 100644 --- a/src/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx +++ b/src/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx @@ -1,11 +1,11 @@ import { getAttributeValuesFromReferences, - mergeAttributeValues + mergeAttributeValues, } from "@saleor/attributes/utils/data"; import AssignAttributeValueDialog from "@saleor/components/AssignAttributeValueDialog"; import Attributes, { AttributeInput, - VariantAttributeScope + VariantAttributeScope, } from "@saleor/components/Attributes"; import { Backlink } from "@saleor/components/Backlink"; import CardSpacer from "@saleor/components/CardSpacer"; @@ -20,7 +20,7 @@ import { SearchAttributeValuesQuery, SearchPagesQuery, SearchProductsQuery, - SearchWarehousesQuery + SearchWarehousesQuery, } from "@saleor/graphql"; import useNavigator from "@saleor/hooks/useNavigator"; import { ConfirmButtonTransitionState } from "@saleor/macaw-ui"; @@ -36,36 +36,36 @@ import ProductVariantNavigation from "../ProductVariantNavigation"; import ProductVariantPrice from "../ProductVariantPrice"; import ProductVariantCreateForm, { ProductVariantCreateData, - ProductVariantCreateHandlers + ProductVariantCreateHandlers, } from "./form"; const messages = defineMessages({ attributesHeader: { id: "f3B4tc", defaultMessage: "Variant Attributes", - description: "attributes, section header" + description: "attributes, section header", }, attributesSelectionHeader: { id: "o6260f", defaultMessage: "Variant Selection Attributes", - description: "attributes, section header" + description: "attributes, section header", }, deleteVariant: { id: "7hNjaI", defaultMessage: "Delete Variant", - description: "button" + description: "button", }, saveVariant: { id: "U9CIo7", defaultMessage: "Save variant", - description: "button" + description: "button", }, pricingCardSubtitle: { id: "sw8Wl2", defaultMessage: "There is no channel to define prices for. You need to first add variant to channels to define prices.", - description: "variant pricing section subtitle" - } + description: "variant pricing section subtitle", + }, }); interface ProductVariantCreatePageProps { @@ -122,7 +122,7 @@ const ProductVariantCreatePage: React.FC = ({ fetchMoreReferenceProducts, fetchMoreAttributeValues, onCloseDialog, - onAttributeSelectBlur + onAttributeSelectBlur, }) => { const intl = useIntl(); const navigate = useNavigator(); @@ -132,15 +132,15 @@ const ProductVariantCreatePage: React.FC = ({ const handleAssignReferenceAttribute = ( attributeValues: string[], data: ProductVariantCreateData, - handlers: ProductVariantCreateHandlers + handlers: ProductVariantCreateHandlers, ) => { handlers.selectAttributeReference( assignReferencesAttributeId, mergeAttributeValues( assignReferencesAttributeId, attributeValues, - data.attributes - ) + data.attributes, + ), ); onCloseDialog(); }; @@ -166,7 +166,7 @@ const ProductVariantCreatePage: React.FC = ({ handlers, submit, isSaveDisabled, - attributeRichTextGetters + attributeRichTextGetters, }) => ( {product?.name} @@ -186,7 +186,7 @@ const ProductVariantCreatePage: React.FC = ({ attributes={data.attributes.filter( attribute => attribute.data.variantAttributeScope === - VariantAttributeScope.NOT_VARIANT_SELECTION + VariantAttributeScope.NOT_VARIANT_SELECTION, )} attributeValues={attributeValues} loading={disabled} @@ -209,7 +209,7 @@ const ProductVariantCreatePage: React.FC = ({ attributes={data.attributes.filter( attribute => attribute.data.variantAttributeScope === - VariantAttributeScope.VARIANT_SELECTION + VariantAttributeScope.VARIANT_SELECTION, )} attributeValues={attributeValues} loading={disabled} @@ -269,7 +269,7 @@ const ProductVariantCreatePage: React.FC = ({ disabled={isSaveDisabled} labels={{ confirm: intl.formatMessage(messages.saveVariant), - delete: intl.formatMessage(messages.deleteVariant) + delete: intl.formatMessage(messages.deleteVariant), }} state={saveButtonBarState} onCancel={() => navigate(productUrl(productId))} @@ -281,7 +281,7 @@ const ProductVariantCreatePage: React.FC = ({ assignReferencesAttributeId, data.attributes, referencePages, - referenceProducts + referenceProducts, )} hasMore={handlers.fetchMoreReferences?.hasMore} open={canOpenAssignReferencesAttributeDialog} diff --git a/src/products/components/ProductVariantCreatePage/form.tsx b/src/products/components/ProductVariantCreatePage/form.tsx index 3a1242093..d8c02be3b 100644 --- a/src/products/components/ProductVariantCreatePage/form.tsx +++ b/src/products/components/ProductVariantCreatePage/form.tsx @@ -3,7 +3,7 @@ import { getRichTextAttributesFromMap, getRichTextDataFromAttributes, mergeAttributes, - RichTextProps + RichTextProps, } from "@saleor/attributes/utils/data"; import { createAttributeChangeHandler, @@ -12,7 +12,7 @@ import { createAttributeReferenceChangeHandler, createAttributeValueReorderHandler, createFetchMoreReferencesHandler, - createFetchReferencesHandler + createFetchReferencesHandler, } from "@saleor/attributes/utils/handlers"; import { AttributeInput } from "@saleor/components/Attributes"; import { useExitFormDialog } from "@saleor/components/Form/useExitFormDialog"; @@ -21,16 +21,16 @@ import { ProductVariantCreateDataQuery, SearchPagesQuery, SearchProductsQuery, - SearchWarehousesQuery + SearchWarehousesQuery, } from "@saleor/graphql"; import useForm, { CommonUseFormResultWithHandlers, FormChange, - FormErrors + FormErrors, } from "@saleor/hooks/useForm"; import useFormset, { FormsetChange, - FormsetData + FormsetData, } from "@saleor/hooks/useFormset"; import useHandleFormSubmit from "@saleor/hooks/useHandleFormSubmit"; import { errorMessages } from "@saleor/intl"; @@ -116,14 +116,14 @@ const initial: ProductVariantCreateFormData = { globalSoldUnits: 0, hasPreorderEndDate: false, preorderEndDateTime: "", - quantityLimitPerCustomer: null + quantityLimitPerCustomer: null, }; function useProductVariantCreateForm( product: ProductVariantCreateDataQuery["product"], onSubmit: (data: ProductVariantCreateData) => void, disabled: boolean, - opts: UseProductVariantCreateFormOpts + opts: UseProductVariantCreateFormOpts, ): UseProductVariantCreateFormOutput { const intl = useIntl(); const attributeInput = getVariantAttributeInputFromProduct(product); @@ -135,75 +135,75 @@ function useProductVariantCreateForm( handleChange, data: formData, formId, - setIsSubmitDisabled + setIsSubmitDisabled, } = form; const attributes = useFormset(attributeInput); const { getters: attributeRichTextGetters, - getValues: getAttributeRichTextValues + getValues: getAttributeRichTextValues, } = useMultipleRichText({ initial: getRichTextDataFromAttributes(attributes.data), - triggerChange + triggerChange, }); const attributesWithNewFileValue = useFormset([]); const stocks = useFormset([]); const { setExitDialogSubmitRef } = useExitFormDialog({ - formId + formId, }); const { - makeChangeHandler: makeMetadataChangeHandler + makeChangeHandler: makeMetadataChangeHandler, } = useMetadataChangeTrigger(); const changeMetadata = makeMetadataChangeHandler(handleChange); const handleAttributeChange = createAttributeChangeHandler( attributes.change, - triggerChange + triggerChange, ); const handleAttributeMultiChange = createAttributeMultiChangeHandler( attributes.change, attributes.data, - triggerChange + triggerChange, ); const handleAttributeReferenceChange = createAttributeReferenceChangeHandler( attributes.change, - triggerChange + triggerChange, ); const handleFetchReferences = createFetchReferencesHandler( attributes.data, opts.assignReferencesAttributeId, opts.fetchReferencePages, - opts.fetchReferenceProducts + opts.fetchReferenceProducts, ); const handleFetchMoreReferences = createFetchMoreReferencesHandler( attributes.data, opts.assignReferencesAttributeId, opts.fetchMoreReferencePages, - opts.fetchMoreReferenceProducts + opts.fetchMoreReferenceProducts, ); const handleAttributeFileChange = createAttributeFileChangeHandler( attributes.change, attributesWithNewFileValue.data, attributesWithNewFileValue.add, attributesWithNewFileValue.change, - triggerChange + triggerChange, ); const handleAttributeValueReorder = createAttributeValueReorderHandler( attributes.change, attributes.data, - triggerChange + triggerChange, ); const handleStockAdd = (id: string) => { triggerChange(); stocks.add({ data: { - quantityAllocated: 0 + quantityAllocated: 0, }, id, label: opts.warehouses.find(warehouse => warehouse.id === id).name, - value: "0" + value: "0", }); }; const handleStockChange = (id: string, value: string) => { @@ -218,7 +218,7 @@ function useProductVariantCreateForm( const handlePreorderEndDateChange = createPreorderEndDateChangeHandler( form, triggerChange, - intl.formatMessage(errorMessages.preorderEndDateInFutureErrorText) + intl.formatMessage(errorMessages.preorderEndDateInFutureErrorText), ); const data: ProductVariantCreateData = { @@ -227,10 +227,10 @@ function useProductVariantCreateForm( attributes.data, attributesWithNewFileValue.data, opts.referencePages, - opts.referenceProducts + opts.referenceProducts, ), attributesWithNewFileValue: attributesWithNewFileValue.data, - stocks: stocks.data + stocks: stocks.data, }; const getSubmitData = async (): Promise => ({ @@ -239,14 +239,14 @@ function useProductVariantCreateForm( attributes.data, getRichTextAttributesFromMap( attributes.data, - await getAttributeRichTextValues() - ) - ) + await getAttributeRichTextValues(), + ), + ), }); const handleFormSubmit = useHandleFormSubmit({ formId, - onSubmit + onSubmit, }); const submit = async () => handleFormSubmit(await getSubmitData()); @@ -278,11 +278,11 @@ function useProductVariantCreateForm( selectAttribute: handleAttributeChange, selectAttributeFile: handleAttributeFileChange, selectAttributeMultiple: handleAttributeMultiChange, - selectAttributeReference: handleAttributeReferenceChange + selectAttributeReference: handleAttributeReferenceChange, }, submit, isSaveDisabled, - attributeRichTextGetters + attributeRichTextGetters, }; } diff --git a/src/products/components/ProductVariantCreatorPage/ProductVariantCreator.stories.tsx b/src/products/components/ProductVariantCreatorPage/ProductVariantCreator.stories.tsx index ee7e3db20..4b8c7d81c 100644 --- a/src/products/components/ProductVariantCreatorPage/ProductVariantCreator.stories.tsx +++ b/src/products/components/ProductVariantCreatorPage/ProductVariantCreator.stories.tsx @@ -13,10 +13,10 @@ import { ChannelPrice, Price, ProductVariantCreateFormData, - Stock + Stock, } from "./form"; import ProductVariantCreatorContent, { - ProductVariantCreatorContentProps + ProductVariantCreatorContentProps, } from "./ProductVariantCreatorContent"; import ProductVariantCreatorPage from "./ProductVariantCreatorPage"; import { ProductVariantCreatorStep } from "./types"; @@ -26,7 +26,7 @@ const selectedWarehouses = [0, 1, 3].map(index => warehouseList[index]); const channels: ChannelPrice[] = productChannels.map(channel => ({ channelId: channel.channel.id, - price: channel.pricing?.priceRange?.start?.net.amount.toString() + price: channel.pricing?.priceRange?.start?.net.amount.toString(), })); const price: Price = { @@ -35,25 +35,25 @@ const price: Price = { mode: "attribute", values: selectedAttributes[0].choices.edges.map(attribute => ({ slug: attribute.node.slug, - value: channels - })) + value: channels, + })), }; const stock: Stock = { attribute: selectedAttributes[0].id, mode: "attribute", value: selectedWarehouses.map( - (_, warehouseIndex) => (warehouseIndex + 2) * 3 + (_, warehouseIndex) => (warehouseIndex + 2) * 3, ), values: selectedAttributes[0].choices.edges.map( (attribute, attributeIndex) => ({ slug: attribute.node.slug, value: selectedWarehouses.map( (_, warehouseIndex) => - selectedAttributes.length * 10 - attributeIndex - warehouseIndex * 3 - ) - }) - ) + selectedAttributes.length * 10 - attributeIndex - warehouseIndex * 3, + ), + }), + ), }; const dataAttributes = selectedAttributes.map(attribute => ({ @@ -62,9 +62,9 @@ const dataAttributes = selectedAttributes.map(attribute => ({ values: attribute.choices.edges .map(value => ({ slug: value.node.slug, - value: value.node + value: value.node, })) - .filter((_, valueIndex) => valueIndex % 2 !== 1) + .filter((_, valueIndex) => valueIndex % 2 !== 1), })); const errors: BulkProductErrorFragment[] = [ @@ -74,8 +74,8 @@ const errors: BulkProductErrorFragment[] = [ code: ProductErrorCode.UNIQUE, field: "sku", index: 3, - message: "Uniwue bulk product error" - } + message: "Uniwue bulk product error", + }, ]; const data: ProductVariantCreateFormData = { @@ -87,9 +87,9 @@ const data: ProductVariantCreateFormData = { price, stock, variants: [], - warehouses: selectedWarehouses.map(warehouse => warehouse.id) + warehouses: selectedWarehouses.map(warehouse => warehouse.id), }), - warehouses: selectedWarehouses.map(warehouse => warehouse.id) + warehouses: selectedWarehouses.map(warehouse => warehouse.id), }; const props: ProductVariantCreatorContentProps = { attributes: [0, 1, 4, 6].map(index => attributes[index]), @@ -100,18 +100,18 @@ const props: ProductVariantCreatorContentProps = { currency: listing.pricing?.priceRange?.start?.net.currency, id: listing.channel.id, name: listing.channel.name, - price: listing.pricing?.priceRange?.start?.net?.amount.toString() || "" + price: listing.pricing?.priceRange?.start?.net?.amount.toString() || "", })), data: { ...data, - variants: createVariants(data) + variants: createVariants(data), }, dispatchFormDataAction: () => undefined, errors: [], variantsLeft: 6, step: ProductVariantCreatorStep.values, warehouses: warehouseList, - onAttributeSelectBlur: () => undefined + onAttributeSelectBlur: () => undefined, }; storiesOf("Views / Products / Create multiple variants", module) @@ -121,7 +121,7 @@ storiesOf("Views / Products / Create multiple variants", module) storiesOf( "Views / Products / Create multiple variants / prices and SKUs", - module + module, ) .addDecorator(storyFn => {storyFn()}) .addDecorator(Decorator) @@ -132,8 +132,8 @@ storiesOf( ...data, stock: { ...data.stock, - mode: "all" - } + mode: "all", + }, }} step={ProductVariantCreatorStep.prices} /> @@ -145,9 +145,9 @@ storiesOf( ...data, stock: { ...data.stock, - mode: "all" + mode: "all", }, - warehouses: [data.warehouses[0]] + warehouses: [data.warehouses[0]], }} step={ProductVariantCreatorStep.prices} warehouses={[props.warehouses[0]]} @@ -164,7 +164,7 @@ storiesOf( {...props} data={{ ...data, - warehouses: [data.warehouses[0]] + warehouses: [data.warehouses[0]], }} step={ProductVariantCreatorStep.prices} warehouses={[props.warehouses[0]]} @@ -175,7 +175,7 @@ storiesOf( {...props} data={{ ...data, - warehouses: [] + warehouses: [], }} step={ProductVariantCreatorStep.prices} warehouses={[]} @@ -208,8 +208,8 @@ storiesOf("Views / Products / Create multiple variants", module) ...limitsReached, currentUsage: { ...limitsReached.currentUsage, - productVariants: limitsReached.currentUsage.productVariants - 6 - } + productVariants: limitsReached.currentUsage.productVariants - 6, + }, }} onSubmit={() => undefined} /> diff --git a/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorContent.tsx b/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorContent.tsx index 9bca40ecd..cd24ce612 100644 --- a/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorContent.tsx +++ b/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorContent.tsx @@ -3,7 +3,7 @@ import { BulkProductErrorFragment, ProductVariantAttributesFragment, SearchAttributeValuesQuery, - WarehouseFragment + WarehouseFragment, } from "@saleor/graphql"; import { FetchMoreProps, RelayToFlat } from "@saleor/types"; import { isSelected } from "@saleor/utils/lists"; @@ -15,7 +15,7 @@ import ProductVariantCreatorSummary from "./ProductVariantCreatorSummary"; import ProductVariantCreatorValues from "./ProductVariantCreatorValues"; import { ProductVariantCreateReducerAction, - ProductVariantCreateReducerActionType + ProductVariantCreateReducerActionType, } from "./reducer"; import { ProductVariantCreatorStep } from "./types"; @@ -48,14 +48,14 @@ const ProductVariantCreatorContent: React.FC step, variantsLeft, warehouses, - onAttributeSelectBlur + onAttributeSelectBlur, }) => { const selectedAttributes = attributes.filter(attribute => isSelected( attribute.id, data.attributes.map(dataAttribute => dataAttribute.id), - (a, b) => a === b - ) + (a, b) => a === b, + ), ); return ( @@ -72,9 +72,9 @@ const ProductVariantCreatorContent: React.FC dispatchFormDataAction({ selectValue: { attributeId, - value + value, }, - type: ProductVariantCreateReducerActionType.selectValue + type: ProductVariantCreateReducerActionType.selectValue, }) } onValueBlur={onAttributeSelectBlur} @@ -89,43 +89,43 @@ const ProductVariantCreatorContent: React.FC onApplyToAllChange={(mode, type) => dispatchFormDataAction({ applyPriceOrStockToAll: { - mode + mode, }, type: type === "price" ? ProductVariantCreateReducerActionType.applyPriceToAll - : ProductVariantCreateReducerActionType.applyStockToAll + : ProductVariantCreateReducerActionType.applyStockToAll, }) } onApplyToAllPriceChange={(channelId, price) => dispatchFormDataAction({ changeApplyPriceToAllValue: { channelId, - price + price, }, type: - ProductVariantCreateReducerActionType.changeApplyPriceToAllValue + ProductVariantCreateReducerActionType.changeApplyPriceToAllValue, }) } onApplyToAllStockChange={(quantity, warehouseIndex) => dispatchFormDataAction({ changeApplyStockToAllValue: { quantity, - warehouseIndex + warehouseIndex, }, type: - ProductVariantCreateReducerActionType.changeApplyStockToAllValue + ProductVariantCreateReducerActionType.changeApplyStockToAllValue, }) } onAttributeSelect={(attributeId, type) => dispatchFormDataAction({ changeApplyPriceOrStockToAttributeId: { - attributeId + attributeId, }, type: type === "price" ? ProductVariantCreateReducerActionType.changeApplyPriceToAttributeId - : ProductVariantCreateReducerActionType.changeApplyStockToAttributeId + : ProductVariantCreateReducerActionType.changeApplyStockToAttributeId, }) } onAttributePriceChange={(valueId, price, channelId) => @@ -133,10 +133,10 @@ const ProductVariantCreatorContent: React.FC changeAttributeValuePrice: { channelId, price, - valueId + valueId, }, type: - ProductVariantCreateReducerActionType.changeAttributeValuePrice + ProductVariantCreateReducerActionType.changeAttributeValuePrice, }) } onAttributeStockChange={(valueId, quantity, warehouseIndex) => @@ -144,18 +144,18 @@ const ProductVariantCreatorContent: React.FC changeAttributeValueStock: { quantity, valueId, - warehouseIndex + warehouseIndex, }, type: - ProductVariantCreateReducerActionType.changeAttributeValueStock + ProductVariantCreateReducerActionType.changeAttributeValueStock, }) } onWarehouseToggle={warehouseId => dispatchFormDataAction({ changeWarehouses: { - warehouseId + warehouseId, }, - type: ProductVariantCreateReducerActionType.changeWarehouses + type: ProductVariantCreateReducerActionType.changeWarehouses, }) } /> @@ -170,18 +170,19 @@ const ProductVariantCreatorContent: React.FC dispatchFormDataAction({ changeVariantSku: { value, - variantIndex + variantIndex, }, - type: ProductVariantCreateReducerActionType.changeVariantSku + type: ProductVariantCreateReducerActionType.changeVariantSku, }) } onVariantPriceDataChange={(variantIndex, value) => dispatchFormDataAction({ changeVariantPriceData: { value, - variantIndex + variantIndex, }, - type: ProductVariantCreateReducerActionType.changeVariantPriceData + type: + ProductVariantCreateReducerActionType.changeVariantPriceData, }) } onVariantStockDataChange={(variantIndex, warehouse, value) => @@ -189,19 +190,20 @@ const ProductVariantCreatorContent: React.FC changeVariantStockData: { stock: { quantity: parseInt(value, 10), - warehouse + warehouse, }, - variantIndex + variantIndex, }, - type: ProductVariantCreateReducerActionType.changeVariantStockData + type: + ProductVariantCreateReducerActionType.changeVariantStockData, }) } onVariantDelete={variantIndex => dispatchFormDataAction({ deleteVariant: { - variantIndex + variantIndex, }, - type: ProductVariantCreateReducerActionType.deleteVariant + type: ProductVariantCreateReducerActionType.deleteVariant, }) } warehouses={warehouses} diff --git a/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorPage.tsx b/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorPage.tsx index 943fbb834..b7fc5c692 100644 --- a/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorPage.tsx +++ b/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorPage.tsx @@ -5,7 +5,7 @@ import Hr from "@saleor/components/Hr"; import PageHeader from "@saleor/components/PageHeader"; import { ProductVariantBulkCreateInput, - RefreshLimitsQuery + RefreshLimitsQuery, } from "@saleor/graphql"; import { SubmitPromise } from "@saleor/hooks/useForm"; import useWizard from "@saleor/hooks/useWizard"; @@ -16,12 +16,12 @@ import { FormattedMessage, IntlShape, useIntl } from "react-intl"; import { createInitialForm, ProductVariantCreateFormData } from "./form"; import ProductVariantCreatorContent, { - ProductVariantCreatorContentProps + ProductVariantCreatorContentProps, } from "./ProductVariantCreatorContent"; import ProductVariantCreateTabs from "./ProductVariantCreatorTabs"; import { getVariantsNumber } from "./ProductVariantCreatorValues"; import reduceProductVariantCreateFormData, { - ProductVariantCreateReducerActionType + ProductVariantCreateReducerActionType, } from "./reducer"; import { ProductVariantCreatorStep } from "./types"; import { dedupeListings } from "./utils"; @@ -29,31 +29,31 @@ import { dedupeListings } from "./utils"; const useStyles = makeStyles( theme => ({ button: { - marginLeft: theme.spacing(2) + marginLeft: theme.spacing(2), }, content: { - overflowX: "visible" + overflowX: "visible", }, description: { - marginTop: theme.spacing() + marginTop: theme.spacing(), }, hr: { - margin: theme.spacing(3, 0) - } + margin: theme.spacing(3, 0), + }, }), - { name: "ProductVariantCreatePage" } + { name: "ProductVariantCreatePage" }, ); function canHitNext( step: ProductVariantCreatorStep, data: ProductVariantCreateFormData, - variantsLeft: number | null + variantsLeft: number | null, ): boolean { switch (step) { case ProductVariantCreatorStep.values: return ( data.attributes.every( - attribute => !attribute.valueRequired || attribute.values.length > 0 + attribute => !attribute.valueRequired || attribute.values.length > 0, ) && (variantsLeft === null || getVariantsNumber(data) <= variantsLeft) ); @@ -68,7 +68,7 @@ function canHitNext( data.price.values.some( attribute => attribute.value.length < data.price.channels.length || - attribute.value.some(channel => validatePrice(channel.price)) + attribute.value.some(channel => validatePrice(channel.price)), ) ) { return false; @@ -82,7 +82,7 @@ function canHitNext( return true; case ProductVariantCreatorStep.summary: return !data.variants.some(variant => - variant.channelListings.some(channel => validatePrice(channel.price)) + variant.channelListings.some(channel => validatePrice(channel.price)), ); default: @@ -105,45 +105,45 @@ function getTitle(step: ProductVariantCreatorStep, intl: IntlShape): string { return intl.formatMessage({ id: "NXpFlL", defaultMessage: "Choose Values", - description: "product attribute values, page title" + description: "product attribute values, page title", }); case ProductVariantCreatorStep.prices: return intl.formatMessage({ id: "7WEC+G", defaultMessage: "Price and SKUs", - description: "page title" + description: "page title", }); case ProductVariantCreatorStep.summary: return intl.formatMessage({ id: "g1WQlC", defaultMessage: "Summary", - description: "page title" + description: "page title", }); } } function getDescription( step: ProductVariantCreatorStep, - intl: IntlShape + intl: IntlShape, ): string { switch (step) { case ProductVariantCreatorStep.values: return intl.formatMessage({ id: "ClFzoD", defaultMessage: - "Selected values will be used to create variants for the configurable product." + "Selected values will be used to create variants for the configurable product.", }); case ProductVariantCreatorStep.prices: return intl.formatMessage({ id: "iigydN", defaultMessage: - "Based on your selections we will create 8 products. Use this step to customize price and stocks for your new products." + "Based on your selections we will create 8 products. Use this step to customize price and stocks for your new products.", }); case ProductVariantCreatorStep.summary: return intl.formatMessage({ id: "rHXF43", defaultMessage: - "Here is the summary of variants that will be created. You can change prices, stocks an SKU for each one created." + "Here is the summary of variants that will be created. You can change prices, stocks an SKU for each one created.", }); } } @@ -162,7 +162,7 @@ const ProductVariantCreatePage: React.FC = props const intl = useIntl(); const [wizardData, dispatchFormDataAction] = React.useReducer( reduceProductVariantCreateFormData, - createInitialForm(attributes, channelListings, warehouses) + createInitialForm(attributes, channelListings, warehouses), ); const [step, { next: nextStep, prev: prevStep, set: setStep }] = useWizard< ProductVariantCreatorStep @@ -171,24 +171,24 @@ const ProductVariantCreatePage: React.FC = props [ ProductVariantCreatorStep.values, ProductVariantCreatorStep.prices, - ProductVariantCreatorStep.summary + ProductVariantCreatorStep.summary, ], { onTransition: (_, nextStep) => { if (nextStep === ProductVariantCreatorStep.summary) { dispatchFormDataAction({ - type: ProductVariantCreateReducerActionType.rebuild + type: ProductVariantCreateReducerActionType.rebuild, }); } - } - } + }, + }, ); const reloadForm = () => dispatchFormDataAction({ reload: { - data: createInitialForm(attributes, channelListings, warehouses) + data: createInitialForm(attributes, channelListings, warehouses), }, - type: ProductVariantCreateReducerActionType.reload + type: ProductVariantCreateReducerActionType.reload, }); React.useEffect(reloadForm, [attributes.length, warehouses.length]); diff --git a/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorPriceAndSku.tsx b/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorPriceAndSku.tsx index 46589827b..c217f83c2 100644 --- a/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorPriceAndSku.tsx +++ b/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorPriceAndSku.tsx @@ -2,13 +2,13 @@ import { ChannelPriceData } from "@saleor/channels/utils"; import CardSpacer from "@saleor/components/CardSpacer"; import { ProductVariantAttributesFragment, - WarehouseFragment + WarehouseFragment, } from "@saleor/graphql"; import React from "react"; import { ProductVariantCreateFormData, - VariantCreatorPricesAndSkuMode + VariantCreatorPricesAndSkuMode, } from "./form"; import ProductVariantCreatorPrices from "./ProductVariantCreatorPrices"; import ProductVariantCreatorStock from "./ProductVariantCreatorStock"; @@ -21,7 +21,7 @@ export interface ProductVariantCreatorPriceAndSkuProps { warehouses: WarehouseFragment[]; onApplyToAllChange: ( value: VariantCreatorPricesAndSkuMode, - type: PriceOrStock + type: PriceOrStock, ) => void; onApplyToAllPriceChange: (channelId: string, value: string) => void; onApplyToAllStockChange: (quantity: number, warehouseIndex: number) => void; @@ -29,12 +29,12 @@ export interface ProductVariantCreatorPriceAndSkuProps { onAttributePriceChange: ( id: string, value: string, - channelId: string + channelId: string, ) => void; onAttributeStockChange: ( id: string, quantity: number, - warehouseIndex: number + warehouseIndex: number, ) => void; onWarehouseToggle: (id: string) => void; } @@ -50,7 +50,7 @@ const ProductVariantCreatorPriceAndSku: React.FC ( <> void; } @@ -87,14 +87,14 @@ const ProductVariantCreatorPrices: React.FC = onApplyToAllChange, onApplyToAllPriceChange, onAttributeSelect, - onAttributeValueChange + onAttributeValueChange, } = props; const classes = useStyles(props); const intl = useIntl(); const attributeChoices = attributes.map(attribute => ({ label: attribute.name, - value: attribute.id + value: attribute.id, })); const priceAttributeValues = getPriceAttributeValues(data, attributes); @@ -104,7 +104,7 @@ const ProductVariantCreatorPrices: React.FC = title={intl.formatMessage({ id: "TPCRKr", defaultMessage: "Price", - description: "variant price, header" + description: "variant price, header", })} /> @@ -114,7 +114,7 @@ const ProductVariantCreatorPrices: React.FC = control={} label={intl.formatMessage({ id: "lra7Ej", - defaultMessage: "Apply single price to all SKUs" + defaultMessage: "Apply single price to all SKUs", })} onChange={() => onApplyToAllChange("all")} /> @@ -134,7 +134,7 @@ const ProductVariantCreatorPrices: React.FC = name={`${listing.id}-variant-channel-price`} value={ data.price.channels.find( - channel => channel.channelId === listing.id + channel => channel.channelId === listing.id, )?.price } label={intl.formatMessage(messages.price)} @@ -154,7 +154,7 @@ const ProductVariantCreatorPrices: React.FC = control={} label={intl.formatMessage({ id: "EGG8f+", - defaultMessage: "Apply unique prices by attribute to each SKU" + defaultMessage: "Apply unique prices by attribute to each SKU", })} onChange={() => onApplyToAllChange("attribute")} /> @@ -177,7 +177,7 @@ const ProductVariantCreatorPrices: React.FC = label={intl.formatMessage({ id: "lVZ5n7", defaultMessage: "Attribute", - description: "variant attribute" + description: "variant attribute", })} value={data.price.attribute} onChange={event => onAttributeSelect(event.target.value)} @@ -187,7 +187,7 @@ const ProductVariantCreatorPrices: React.FC = {priceAttributeValues && priceAttributeValues.map(attributeValue => { const attributesChannels = data.price.values.find( - value => value.slug === attributeValue.slug + value => value.slug === attributeValue.slug, ).value; return ( @@ -211,14 +211,14 @@ const ProductVariantCreatorPrices: React.FC = value={ attributesChannels.find( attrChannel => - attrChannel.channelId === listing.id + attrChannel.channelId === listing.id, )?.price || "" } onChange={event => onAttributeValueChange( attributeValue.slug, event.target.value, - listing.id + listing.id, ) } /> @@ -236,7 +236,7 @@ const ProductVariantCreatorPrices: React.FC = control={} label={intl.formatMessage({ id: "J0UdxG", - defaultMessage: "Skip pricing for now" + defaultMessage: "Skip pricing for now", })} onChange={() => onApplyToAllChange("skip")} /> diff --git a/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorStock.tsx b/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorStock.tsx index 0fd0afadd..174dadd64 100644 --- a/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorStock.tsx +++ b/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorStock.tsx @@ -5,7 +5,7 @@ import { Radio, RadioGroup, TextField, - Typography + Typography, } from "@material-ui/core"; import CardSpacer from "@saleor/components/CardSpacer"; import CardTitle from "@saleor/components/CardTitle"; @@ -15,7 +15,7 @@ import Hr from "@saleor/components/Hr"; import SingleSelectField from "@saleor/components/SingleSelectField"; import { ProductVariantAttributesFragment, - WarehouseFragment + WarehouseFragment, } from "@saleor/graphql"; import { makeStyles } from "@saleor/macaw-ui"; import { isSelected } from "@saleor/utils/lists"; @@ -24,15 +24,15 @@ import { defineMessages, FormattedMessage, useIntl } from "react-intl"; import { ProductVariantCreateFormData, - VariantCreatorPricesAndSkuMode + VariantCreatorPricesAndSkuMode, } from "./form"; import { getStockAttributeValues } from "./utils"; const messages = defineMessages({ stock: { id: "vuKrlW", - defaultMessage: "Stock" - } + defaultMessage: "Stock", + }, }); const useStyles = makeStyles( @@ -42,52 +42,52 @@ const useStyles = makeStyles( display: "grid", gridTemplateColumns: ({ data }: ProductVariantCreatorStockProps) => `150px repeat(${data.warehouses.length}, 288px)`, - rowGap: theme.spacing(2) + rowGap: theme.spacing(2), }, attributeStockScroll: { overflowX: "scroll", - width: "100%" + width: "100%", }, hr: { marginBottom: theme.spacing(), - marginTop: theme.spacing(0.5) + marginTop: theme.spacing(0.5), }, hrAttribute: { - marginTop: theme.spacing(2) + marginTop: theme.spacing(2), }, label: { - alignSelf: "center" + alignSelf: "center", }, shortInput: { - width: "33%" + width: "33%", }, stockContainer: { columnGap: theme.spacing(3), display: "grid", gridTemplateColumns: "repeat(3, 288px)", marginTop: theme.spacing(2), - rowGap: theme.spacing(2) + rowGap: theme.spacing(2), }, stockHeader: { - marginBottom: theme.spacing() + marginBottom: theme.spacing(), }, warehouseContainer: { columnGap: theme.spacing(3), display: "grid", gridTemplateColumns: "repeat(4, 1fr)", - rowGap: theme.spacing(2) + rowGap: theme.spacing(2), }, warehouseHeader: { - marginBottom: theme.spacing() + marginBottom: theme.spacing(), }, warehouseName: { - marginBottom: theme.spacing() + marginBottom: theme.spacing(), }, warehouseSubheader: { - marginBottom: theme.spacing(2) - } + marginBottom: theme.spacing(2), + }, }), - { name: "ProductVariantCreatorStock" } + { name: "ProductVariantCreatorStock" }, ); export interface ProductVariantCreatorStockProps { @@ -100,7 +100,7 @@ export interface ProductVariantCreatorStockProps { onAttributeValueChange: ( id: string, quantity: number, - warehouseIndex: number + warehouseIndex: number, ) => void; onWarehouseToggle: (id: string) => void; } @@ -114,14 +114,14 @@ const ProductVariantCreatorStock: React.FC = pr onApplyToAllStockChange, onAttributeSelect, onAttributeValueChange, - onWarehouseToggle + onWarehouseToggle, } = props; const classes = useStyles(props); const intl = useIntl(); const attributeChoices = attributes.map(attribute => ({ label: attribute.name, - value: attribute.id + value: attribute.id, })); const stockAttributeValues = getStockAttributeValues(data, attributes); @@ -131,7 +131,7 @@ const ProductVariantCreatorStock: React.FC = pr title={intl.formatMessage({ id: "GQcp83", defaultMessage: "Stock and Warehousing", - description: "variant stock, header" + description: "variant stock, header", })} /> @@ -161,8 +161,8 @@ const ProductVariantCreatorStock: React.FC = pr values={{ numberOfProducts: data.attributes.reduce( (acc, attr) => acc + attr.values.length, - 0 - ) + 0, + ), }} /> @@ -172,7 +172,7 @@ const ProductVariantCreatorStock: React.FC = pr checked={isSelected( warehouse.id, data.warehouses, - (a, b) => a === b + (a, b) => a === b, )} name={`warehouse:${warehouse.id}`} label={warehouse.name} @@ -199,7 +199,7 @@ const ProductVariantCreatorStock: React.FC = pr control={} label={intl.formatMessage({ id: "STp3Hl", - defaultMessage: "Apply single stock to all SKUs" + defaultMessage: "Apply single stock to all SKUs", })} onChange={() => onApplyToAllChange("all")} /> @@ -210,7 +210,7 @@ const ProductVariantCreatorStock: React.FC = pr { warehouses.find( - warehouse => warehouse.id === warehouseId + warehouse => warehouse.id === warehouseId, ).name } @@ -219,14 +219,14 @@ const ProductVariantCreatorStock: React.FC = pr fullWidth inputProps={{ min: 0, - type: "number" + type: "number", }} label={intl.formatMessage(messages.stock)} value={data.stock.value[warehouseIndex]} onChange={event => onApplyToAllStockChange( parseInt(event.target.value, 10), - warehouseIndex + warehouseIndex, ) } /> @@ -240,7 +240,7 @@ const ProductVariantCreatorStock: React.FC = pr control={} label={intl.formatMessage({ id: "L5rthO", - defaultMessage: "Apply unique stock by attribute to each SKU" + defaultMessage: "Apply unique stock by attribute to each SKU", })} onChange={() => onApplyToAllChange("attribute")} /> @@ -253,7 +253,7 @@ const ProductVariantCreatorStock: React.FC = pr label={intl.formatMessage({ id: "TDXskW", defaultMessage: "Select Attribute", - description: "variant attribute" + description: "variant attribute", })} value={data.stock.attribute} onChange={event => onAttributeSelect(event.target.value)} @@ -273,7 +273,7 @@ const ProductVariantCreatorStock: React.FC = pr > { warehouses.find( - warehouse => warehouse.id === warehouseId + warehouse => warehouse.id === warehouseId, ).name } @@ -287,25 +287,25 @@ const ProductVariantCreatorStock: React.FC = pr fullWidth inputProps={{ min: 0, - type: "number" + type: "number", }} label={intl.formatMessage(messages.stock)} value={ data.stock.values.find( value => - value.slug === attributeValue.slug + value.slug === attributeValue.slug, ).value[warehouseIndex] } onChange={event => onAttributeValueChange( attributeValue.slug, parseInt(event.target.value, 10), - warehouseIndex + warehouseIndex, ) } key={warehouseId} /> - ) + ), )} ))} @@ -327,7 +327,7 @@ const ProductVariantCreatorStock: React.FC = pr control={} label={intl.formatMessage({ id: "BIqhVQ", - defaultMessage: "Skip stock for now" + defaultMessage: "Skip stock for now", })} onChange={() => onApplyToAllChange("skip")} /> diff --git a/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorSummary.tsx b/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorSummary.tsx index 24acc81a9..05c0112a3 100644 --- a/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorSummary.tsx +++ b/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorSummary.tsx @@ -12,7 +12,7 @@ import { BulkProductErrorFragment, ProductFragment, ProductVariantBulkCreateInput, - WarehouseFragment + WarehouseFragment, } from "@saleor/graphql"; import { DeleteIcon, IconButton, makeStyles } from "@saleor/macaw-ui"; import { getFormErrors } from "@saleor/utils/errors"; @@ -33,7 +33,7 @@ export interface ProductVariantCreatorSummaryProps { onVariantStockDataChange: ( variantIndex: number, warehouseId: string, - value: string + value: string, ) => void; onVariantDelete: (variantIndex: number) => void; onVariantPriceDataChange: (variantIndex: number, value: ChannelPrice) => void; @@ -58,42 +58,42 @@ const useStyles = makeStyles( theme => ({ attributeValue: { display: "inline-block", - marginRight: theme.spacing(1) + marginRight: theme.spacing(1), }, card: { - paddingBottom: theme.spacing() + paddingBottom: theme.spacing(), }, col: { ...theme.typography.body1, - fontSize: 14 + fontSize: 14, }, colHeader: { ...theme.typography.body1, fontSize: 14, - paddingTop: theme.spacing(3) + paddingTop: theme.spacing(3), }, colName: { "&:not($colHeader)": { - paddingTop: theme.spacing(2) + paddingTop: theme.spacing(2), }, - paddingLeft: theme.spacing(3) + paddingLeft: theme.spacing(3), }, colPrice: {}, colSku: {}, colStock: {}, delete: { - marginTop: theme.spacing(0.5) + marginTop: theme.spacing(0.5), }, hr: { gridColumn: props => `span ${4 + props.data.variants[0].stocks.length + - props.data.variants[0].channelListings.length}` + props.data.variants[0].channelListings.length}`, }, input: { "& input": { - padding: "16px 12px 17px" - } + padding: "16px 12px 17px", + }, }, summary: { columnGap: theme.spacing(3), @@ -105,32 +105,32 @@ const useStyles = makeStyles( .length}, minmax(180px, auto)) 220px 64px`, overflowX: "scroll", rowGap: theme.spacing(), - paddingBottom: 3 - } + paddingBottom: 3, + }, }), { - name: "ProductVariantCreatorSummary" - } + name: "ProductVariantCreatorSummary", + }, ); function getVariantName( variant: ProductVariantBulkCreateInput, - attributes: Attribute[] + attributes: Attribute[], ): string[] { return attributes.reduce( (acc, attribute) => [ ...acc, attribute.values?.find(value => { const variantAttributeValue = variant.attributes.find( - variantAttribute => variantAttribute.id === attribute.id + variantAttribute => variantAttribute.id === attribute.id, ); return ( variantAttributeValue.values?.[0] === value?.slug || variantAttributeValue.boolean === value.value.boolean ); - })?.value?.name + })?.value?.name, ], - [] + [], ); } @@ -143,7 +143,7 @@ const ProductVariantCreatorSummary: React.FC onVariantPriceDataChange, onVariantSkuChange, onVariantDelete, - onVariantStockDataChange + onVariantStockDataChange, } = props; const classes = useStyles(props); const intl = useIntl(); @@ -154,7 +154,7 @@ const ProductVariantCreatorSummary: React.FC title={intl.formatMessage({ id: "S5PVx1", defaultMessage: "Created Variants", - description: "variant creator summary card header" + description: "variant creator summary card header", })} />
@@ -162,7 +162,7 @@ const ProductVariantCreatorSummary: React.FC className={classNames( classes.col, classes.colHeader, - classes.colName + classes.colName, )} > className={classNames( classes.col, classes.colHeader, - classes.colPrice + classes.colPrice, )} > defaultMessage="{channel} Price" description="variant channel price" values={{ - channel: listing.name + channel: listing.name, }} />
@@ -197,7 +197,7 @@ const ProductVariantCreatorSummary: React.FC className={classNames( classes.col, classes.colHeader, - classes.colStock + classes.colStock, )} key={warehouseId} > @@ -213,11 +213,11 @@ const ProductVariantCreatorSummary: React.FC
{data.variants.map((variant, variantIndex) => { const variantErrors = errors.filter( - error => error.index === variantIndex + error => error.index === variantIndex, ); const variantFormErrors = getFormErrors( ["price", "quantity", "sku"], - variantErrors + variantErrors, ); return ( {value} - ) + ), )}
{channelListings.map(listing => { const error = variantFormErrors.price?.channels?.find( - id => id === listing.id + id => id === listing.id, ); return (
error ? getBulkProductErrorMessage( variantFormErrors.price, - intl + intl, ) : "" } value={ variant.channelListings?.find( - channel => channel.channelId === listing.id + channel => channel.channelId === listing.id, )?.price } required onChange={event => onVariantPriceDataChange(variantIndex, { channelId: listing.id, - price: event.target.value + price: event.target.value, }) } /> @@ -287,11 +287,11 @@ const ProductVariantCreatorSummary: React.FC error={!!variantFormErrors.quantity} helperText={getBulkProductErrorMessage( variantFormErrors.quantity, - intl + intl, )} inputProps={{ min: 0, - type: "number" + type: "number", }} fullWidth value={stock.quantity} @@ -299,7 +299,7 @@ const ProductVariantCreatorSummary: React.FC onVariantStockDataChange( variantIndex, stock.warehouse, - event.target.value + event.target.value, ) } /> @@ -312,7 +312,7 @@ const ProductVariantCreatorSummary: React.FC error={!!variantFormErrors.sku} helperText={getBulkProductErrorMessage( variantFormErrors.sku, - intl + intl, )} fullWidth value={variant.sku} diff --git a/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorTabs.tsx b/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorTabs.tsx index e018ff665..6e254efc9 100644 --- a/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorTabs.tsx +++ b/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorTabs.tsx @@ -12,26 +12,26 @@ function useSteps(): Array> { label: intl.formatMessage({ id: "rVaB7c", defaultMessage: "Select Values", - description: "attribute values, variant creation step" + description: "attribute values, variant creation step", }), - value: ProductVariantCreatorStep.values + value: ProductVariantCreatorStep.values, }, { label: intl.formatMessage({ id: "Sx7QVu", defaultMessage: "Prices and SKU", - description: "variant creation step" + description: "variant creation step", }), - value: ProductVariantCreatorStep.prices + value: ProductVariantCreatorStep.prices, }, { label: intl.formatMessage({ id: "slKV5G", defaultMessage: "Summary", - description: "variant creation step" + description: "variant creation step", }), - value: ProductVariantCreatorStep.summary - } + value: ProductVariantCreatorStep.summary, + }, ]; } @@ -46,7 +46,7 @@ export interface ProductVariantCreatorTabsProps { const ProductVariantCreatorTabs: React.FC = ({ step: currentStep, - onStepClick + onStepClick, }) => { const steps = useSteps(); diff --git a/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorValues.tsx b/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorValues.tsx index c15defae6..d232b44e2 100644 --- a/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorValues.tsx +++ b/src/products/components/ProductVariantCreatorPage/ProductVariantCreatorValues.tsx @@ -10,13 +10,13 @@ import { AttributeInputTypeEnum, AttributeValueFragment, ProductVariantAttributesFragment, - SearchAttributeValuesQuery + SearchAttributeValuesQuery, } from "@saleor/graphql"; import { commonMessages } from "@saleor/intl"; import { getById } from "@saleor/orders/components/OrderReturnPage/utils"; import { getBasicAttributeValue, - getBooleanAttributeValue + getBooleanAttributeValue, } from "@saleor/products/components/ProductVariantCreatorPage/utils"; import { FetchMoreProps, RelayToFlat } from "@saleor/types"; import React from "react"; @@ -24,33 +24,33 @@ import { defineMessages, FormattedMessage, IntlShape, - useIntl + useIntl, } from "react-intl"; import { Attribute, AttributeValue, - ProductVariantCreateFormData + ProductVariantCreateFormData, } from "./form"; const messages = defineMessages({ multipleValueLabel: { id: "j8PV7E", defaultMessage: "Values", - description: "attribute values" - } + description: "attribute values", + }, }); export function getVariantsNumber(data: ProductVariantCreateFormData): number { return data.attributes.reduce( (variants, attribute) => variants * attribute.values.length, - 1 + 1, ); } export function getMultiValues( attributes: Attribute[], - attribute: ProductVariantAttributesFragment["productType"]["variantAttributes"][0] + attribute: ProductVariantAttributesFragment["productType"]["variantAttributes"][0], ) { return attributes .find(getById(attribute.id)) @@ -59,17 +59,17 @@ export function getMultiValues( export function getMultiDisplayValues( attributes: Attribute[], - attribute: ProductVariantAttributesFragment["productType"]["variantAttributes"][0] + attribute: ProductVariantAttributesFragment["productType"]["variantAttributes"][0], ) { return attributes.find(getById(attribute.id))?.values.map(value => ({ label: value.value?.name, - value: value.slug + value: value.slug, })); } const getBooleanDisplayValues = ( intl: IntlShape, - values: Array>> + values: Array>>, ) => { if (!values.length) { return []; @@ -77,18 +77,18 @@ const getBooleanDisplayValues = ( const choices = getBooleanChoices(intl); return values.map(({ value: { boolean } }) => - choices.find(({ value }) => value === boolean) + choices.find(({ value }) => value === boolean), ); }; const getBooleanChoices = ( intl: IntlShape, - values?: Array>> + values?: Array>>, ) => { const selectedValues = values?.map(({ value }) => value.boolean) ?? []; const choices = [ { label: intl.formatMessage(commonMessages.yes), value: true }, - { label: intl.formatMessage(commonMessages.no), value: false } + { label: intl.formatMessage(commonMessages.no), value: false }, ]; return choices.filter(({ value }) => !selectedValues.includes(value)); @@ -105,7 +105,7 @@ export interface ProductVariantCreatorValuesProps { variantsLeft: number | null; onValueClick: ( attributeId: string, - value: AttributeValue> + value: AttributeValue>, ) => void; onValueBlur: () => void; } @@ -119,7 +119,7 @@ const ProductVariantCreatorValues: React.FC = data, variantsLeft, onValueClick, - onValueBlur + onValueBlur, } = props; const intl = useIntl(); const variantsNumber = getVariantsNumber(data); @@ -127,7 +127,7 @@ const ProductVariantCreatorValues: React.FC = const handleValueClick = ( attributeId: string, attributeName: string, - attributeValue: string | boolean + attributeValue: string | boolean, ) => onValueClick( attributeId, @@ -137,8 +137,8 @@ const ProductVariantCreatorValues: React.FC = attributeId, attributeValue, attributeValues, - data - ) + data, + ), ); return ( @@ -148,7 +148,7 @@ const ProductVariantCreatorValues: React.FC = title={intl.formatMessage({ id: "FwHWUm", defaultMessage: "SKU limit reached", - description: "alert" + description: "alert", })} > = defaultMessage="You choices will add {variantsNumber} SKUs to your catalog which will exceed your limit by {aboveLimitVariantsNumber}. If you would like to up your limit, contact your administration staff about raising your limits." values={{ variantsNumber, - aboveLimitVariantsNumber: variantsNumber - variantsLeft + aboveLimitVariantsNumber: variantsNumber - variantsLeft, }} /> @@ -170,7 +170,8 @@ const ProductVariantCreatorValues: React.FC = id === attribute.id).values + data.attributes.find(({ id }) => id === attribute.id) + .values, )} name={`attribute:${attribute.name}`} label={intl.formatMessage(messages.multipleValueLabel)} @@ -179,13 +180,14 @@ const ProductVariantCreatorValues: React.FC = handleValueClick( attribute.id, attribute.name, - event.target.value + event.target.value, ) } allowCustomValues={false} choices={getBooleanChoices( intl, - data.attributes.find(({ id }) => id === attribute.id).values + data.attributes.find(({ id }) => id === attribute.id) + .values, )} /> ) : ( @@ -193,7 +195,7 @@ const ProductVariantCreatorValues: React.FC = choices={getMultiChoices(attributeValues)} displayValues={getMultiDisplayValues( data.attributes, - attribute + attribute, )} name={`attribute:${attribute.name}`} label={intl.formatMessage(messages.multipleValueLabel)} @@ -202,14 +204,14 @@ const ProductVariantCreatorValues: React.FC = handleValueClick( attribute.id, attribute.name, - event.target.value + event.target.value, ) } endAdornment={ attribute.unit && getMeasurementUnitMessage( attribute.unit, - intl.formatMessage + intl.formatMessage, ) } fetchOnFocus={true} diff --git a/src/products/components/ProductVariantCreatorPage/createVariants.test.ts b/src/products/components/ProductVariantCreatorPage/createVariants.test.ts index 478e8bfae..351a373b3 100644 --- a/src/products/components/ProductVariantCreatorPage/createVariants.test.ts +++ b/src/products/components/ProductVariantCreatorPage/createVariants.test.ts @@ -1,6 +1,6 @@ import { createVariantFlatMatrixDimension, - createVariants + createVariants, } from "./createVariants"; import { attributes, channels, thirdStep } from "./fixtures"; import { ChannelPrice, ProductVariantCreateFormData } from "./form"; @@ -12,7 +12,7 @@ describe("Creates variant matrix", () => { const matrix = createVariantFlatMatrixDimension([[]], attributes); expect(matrix).toHaveLength( - attributes.reduce((acc, attribute) => acc * attribute.values.length, 1) + attributes.reduce((acc, attribute) => acc * attribute.values.length, 1), ); }); @@ -25,21 +25,21 @@ describe("Creates variant matrix", () => { price: { ...thirdStep.price, channels, - mode: "all" + mode: "all", }, stock: { ...thirdStep.stock, mode: "all", - value: stock - } + value: stock, + }, }; const variants = createVariants(data); expect(variants).toHaveLength( thirdStep.attributes.reduce( (acc, attribute) => acc * attribute.values.length, - 1 - ) + 1, + ), ); variants.forEach(variant => { @@ -53,7 +53,7 @@ describe("Creates variant matrix", () => { it("with constant stock and attribute dependent price", () => { const stock = [80, 40, 30]; const attribute = attributes.find( - attribute => attribute.id === thirdStep.attributes[0].id + attribute => attribute.id === thirdStep.attributes[0].id, ); const data: ProductVariantCreateFormData = { @@ -66,23 +66,23 @@ describe("Creates variant matrix", () => { slug: attributeValue.slug, value: channels.map(channel => ({ channelId: channel.id, - price: (channel.price + index).toString() - })) - })) + price: (channel.price + index).toString(), + })), + })), }, stock: { ...thirdStep.stock, mode: "all", - value: stock - } + value: stock, + }, }; const variants = createVariants(data); expect(variants).toHaveLength( thirdStep.attributes.reduce( (acc, attribute) => acc * attribute.values.length, - 1 - ) + 1, + ), ); variants.forEach(variant => { @@ -96,13 +96,13 @@ describe("Creates variant matrix", () => { .filter( variant => variant.attributes.find( - variantAttribute => variantAttribute.id === attribute.id - ).values[0] === attributeValue.slug + variantAttribute => variantAttribute.id === attribute.id, + ).values[0] === attributeValue.slug, ) .forEach(variant => { variant.channelListings.map((channel, index) => { expect(channel.price).toBe( - (channels[index].price + attributeValueIndex).toString() + (channels[index].price + attributeValueIndex).toString(), ); }); }); @@ -113,7 +113,7 @@ describe("Creates variant matrix", () => { const price: ChannelPrice[] = [{ channelId: "1", price: "2" }]; const stock = [80, 40, 30]; const attribute = attributes.find( - attribute => attribute.id === thirdStep.attributes[0].id + attribute => attribute.id === thirdStep.attributes[0].id, ); const data: ProductVariantCreateFormData = { @@ -121,7 +121,7 @@ describe("Creates variant matrix", () => { price: { ...thirdStep.price, channels: price, - mode: "all" + mode: "all", }, stock: { ...thirdStep.stock, @@ -130,18 +130,18 @@ describe("Creates variant matrix", () => { values: attribute.values.map((attributeValue, attributeValueIndex) => ({ slug: attributeValue.slug, value: stock.map( - (_, stockIndex) => stock[stockIndex] * (attributeValueIndex + 1) - ) - })) - } + (_, stockIndex) => stock[stockIndex] * (attributeValueIndex + 1), + ), + })), + }, }; const variants = createVariants(data); expect(variants).toHaveLength( thirdStep.attributes.reduce( (acc, attribute) => acc * attribute.values.length, - 1 - ) + 1, + ), ); variants.forEach(variant => { @@ -153,13 +153,13 @@ describe("Creates variant matrix", () => { .filter( variant => variant.attributes.find( - variantAttribute => variantAttribute.id === attribute.id - ).values[0] === attributeValue.slug + variantAttribute => variantAttribute.id === attribute.id, + ).values[0] === attributeValue.slug, ) .forEach(variant => { variant.stocks.forEach((_, stockIndex) => { expect(variant.stocks[stockIndex].quantity).toBe( - stock[stockIndex] * (attributeValueIndex + 1) + stock[stockIndex] * (attributeValueIndex + 1), ); }); }); @@ -169,7 +169,7 @@ describe("Creates variant matrix", () => { it("with attribute dependent price and stock", () => { const stock = [80, 40, 30]; const attribute = attributes.find( - attribute => attribute.id === thirdStep.attributes[0].id + attribute => attribute.id === thirdStep.attributes[0].id, ); const data: ProductVariantCreateFormData = { @@ -182,9 +182,9 @@ describe("Creates variant matrix", () => { slug: attributeValue.slug, value: channels.map(channel => ({ channelId: channel.id, - price: (channel.price + index).toString() - })) - })) + price: (channel.price + index).toString(), + })), + })), }, stock: { ...thirdStep.stock, @@ -193,18 +193,18 @@ describe("Creates variant matrix", () => { values: attribute.values.map((attributeValue, attributeValueIndex) => ({ slug: attributeValue.slug, value: stock.map( - (_, stockIndex) => stock[stockIndex] * (attributeValueIndex + 1) - ) - })) - } + (_, stockIndex) => stock[stockIndex] * (attributeValueIndex + 1), + ), + })), + }, }; const variants = createVariants(data); expect(variants).toHaveLength( thirdStep.attributes.reduce( (acc, attribute) => acc * attribute.values.length, - 1 - ) + 1, + ), ); attribute.values.forEach((attributeValue, attributeValueIndex) => { @@ -212,13 +212,13 @@ describe("Creates variant matrix", () => { .filter( variant => variant.attributes.find( - variantAttribute => variantAttribute.id === attribute.id - ).values[0] === attributeValue.slug + variantAttribute => variantAttribute.id === attribute.id, + ).values[0] === attributeValue.slug, ) .forEach(variant => { variant.channelListings.map((channel, index) => { expect(channel.price).toBe( - (channels[index].price + attributeValueIndex).toString() + (channels[index].price + attributeValueIndex).toString(), ); }); }); @@ -229,13 +229,13 @@ describe("Creates variant matrix", () => { .filter( variant => variant.attributes.find( - variantAttribute => variantAttribute.id === attribute.id - ).values[0] === attributeValue.slug + variantAttribute => variantAttribute.id === attribute.id, + ).values[0] === attributeValue.slug, ) .forEach(variant => { variant.stocks.forEach((_, stockIndex) => { expect(variant.stocks[stockIndex].quantity).toBe( - stock[stockIndex] * (attributeValueIndex + 1) + stock[stockIndex] * (attributeValueIndex + 1), ); }); }); diff --git a/src/products/components/ProductVariantCreatorPage/createVariants.ts b/src/products/components/ProductVariantCreatorPage/createVariants.ts index a4beb2cc4..b65331840 100644 --- a/src/products/components/ProductVariantCreatorPage/createVariants.ts +++ b/src/products/components/ProductVariantCreatorPage/createVariants.ts @@ -1,6 +1,6 @@ import { BulkAttributeValueInput, - ProductVariantBulkCreateInput + ProductVariantBulkCreateInput, } from "@saleor/graphql"; import { @@ -8,7 +8,7 @@ import { ChannelPrice, Price, ProductVariantCreateFormData, - Stock + Stock, } from "./form"; interface CreateVariantAttributeValueInput { @@ -21,21 +21,21 @@ type CreateVariantInput = CreateVariantAttributeValueInput[]; function findAttribute( attributes: CreateVariantInput, - stockOrPrice: Stock | Price + stockOrPrice: Stock | Price, ) { return attributes.find( - attribute => attribute.attributeId === stockOrPrice.attribute + attribute => attribute.attributeId === stockOrPrice.attribute, ); } function getAttributeValueStock( attributes: CreateVariantInput, - stock: Stock + stock: Stock, ): number[] { const attribute = findAttribute(attributes, stock); const attributeValue = stock.values.find( - attributeValue => attribute.attributeValueSlug === attributeValue.slug + attributeValue => attribute.attributeValueSlug === attributeValue.slug, ); return attributeValue.value; @@ -43,12 +43,12 @@ function getAttributeValueStock( function getAttributeValuePrice( attributes: CreateVariantInput, - price: Price + price: Price, ): ChannelPrice[] { const attribute = findAttribute(attributes, price); const attributeValue = price.values.find( - attributeValue => attribute.attributeValueSlug === attributeValue.slug + attributeValue => attribute.attributeValueSlug === attributeValue.slug, ); return attributeValue.value; @@ -57,7 +57,7 @@ function getAttributeValuePrice( function getStockFromMode( attributes: CreateVariantInput, stock: Stock, - skipValue: number[] + skipValue: number[], ): number[] { switch (stock.mode) { case "all": @@ -72,7 +72,7 @@ function getStockFromMode( function getPriceFromMode( attributes: CreateVariantInput, price: Price, - skipValue: ChannelPrice[] + skipValue: ChannelPrice[], ): ChannelPrice[] { switch (price.mode) { case "all": @@ -87,33 +87,33 @@ function getPriceFromMode( function getAttributeFromAttributeValueInput({ attributeId, attributeBooleanValue, - attributeValueSlug + attributeValueSlug, }: CreateVariantAttributeValueInput): BulkAttributeValueInput { if (attributeBooleanValue === null) { return { id: attributeId, - values: attributeValueSlug === null ? [] : [attributeValueSlug] + values: attributeValueSlug === null ? [] : [attributeValueSlug], }; } return { id: attributeId, - boolean: attributeBooleanValue + boolean: attributeBooleanValue, }; } function createVariant( data: ProductVariantCreateFormData, - attributes: CreateVariantInput + attributes: CreateVariantInput, ): ProductVariantBulkCreateInput { const price = getPriceFromMode( attributes, data.price, - data.price.channels.map(channel => ({ ...channel, price: "" })) + data.price.channels.map(channel => ({ ...channel, price: "" })), ); const stocks = getStockFromMode( attributes, data.stock, - data.warehouses.map(() => 0) + data.warehouses.map(() => 0), ); return { @@ -122,14 +122,14 @@ function createVariant( sku: "", stocks: stocks.map((quantity, stockIndex) => ({ quantity, - warehouse: data.warehouses[stockIndex] - })) + warehouse: data.warehouses[stockIndex], + })), }; } function addAttributeToVariant( attribute: Attribute, - variant: CreateVariantInput + variant: CreateVariantInput, ): CreateVariantInput[] { if (attribute.values.length === 0) { return [ @@ -138,9 +138,9 @@ function addAttributeToVariant( { attributeId: attribute.id, attributeValueSlug: null, - attributeBooleanValue: null - } - ] + attributeBooleanValue: null, + }, + ], ]; } return attribute.values.map(attributeValue => [ @@ -148,21 +148,21 @@ function addAttributeToVariant( { attributeId: attribute.id, attributeValueSlug: attributeValue.slug, - attributeBooleanValue: attributeValue.value?.boolean ?? null - } + attributeBooleanValue: attributeValue.value?.boolean ?? null, + }, ]); } export function createVariantFlatMatrixDimension( variants: CreateVariantInput[], - attributes: Attribute[] + attributes: Attribute[], ): CreateVariantInput[] { if (attributes.length > 0) { return createVariantFlatMatrixDimension( variants.flatMap(variant => - addAttributeToVariant(attributes[0], variant) + addAttributeToVariant(attributes[0], variant), ), - attributes.slice(1) + attributes.slice(1), ); } else { return variants; @@ -170,7 +170,7 @@ export function createVariantFlatMatrixDimension( } export function createVariants( - data: ProductVariantCreateFormData + data: ProductVariantCreateFormData, ): ProductVariantBulkCreateInput[] { if ( (data.price.mode === "attribute" && !data.price.attribute) || @@ -180,7 +180,7 @@ export function createVariants( } const variants = createVariantFlatMatrixDimension( [[]], - data.attributes + data.attributes, ).map(variant => createVariant(data, variant)); return variants; diff --git a/src/products/components/ProductVariantCreatorPage/fixtures.ts b/src/products/components/ProductVariantCreatorPage/fixtures.ts index 0bdf61b13..658501c04 100644 --- a/src/products/components/ProductVariantCreatorPage/fixtures.ts +++ b/src/products/components/ProductVariantCreatorPage/fixtures.ts @@ -6,13 +6,13 @@ import { createInitialForm, Price, ProductVariantCreateFormData, - Stock + Stock, } from "./form"; export const channels: ChannelPriceData[] = [ { currency: "USD", id: "channel-1", name: "Channel1", price: "1" }, { currency: "USD", id: "channel-2", name: "Channel2", price: "2" }, - { currency: "USD", id: "channel-3", name: "Channel3", price: "3" } + { currency: "USD", id: "channel-3", name: "Channel3", price: "3" }, ]; export const attributes = [ @@ -34,9 +34,9 @@ export const attributes = [ boolean: null, date: null, dateTime: null, - value: null - } - })) + value: null, + }, + })), }, { id: "attr-2", @@ -56,9 +56,9 @@ export const attributes = [ boolean: null, date: null, dateTime: null, - value: null - } - })) + value: null, + }, + })), }, { id: "attr-3", @@ -78,9 +78,9 @@ export const attributes = [ boolean: null, date: null, dateTime: null, - value: null - } - })) + value: null, + }, + })), }, { id: "attr-4", @@ -100,33 +100,33 @@ export const attributes = [ boolean: null, date: null, dateTime: null, - value: null - } - })) - } + value: null, + }, + })), + }, ]; export const warehouses: WarehouseFragment[] = [ { __typename: "Warehouse", id: "wh-1", - name: "Warehouse 1" + name: "Warehouse 1", }, { __typename: "Warehouse", id: "wh-2", - name: "Warehouse 2" + name: "Warehouse 2", }, { __typename: "Warehouse", id: "wh-3", - name: "Warehouse 3" + name: "Warehouse 3", }, { __typename: "Warehouse", id: "wh-4", - name: "Warehouse 4" - } + name: "Warehouse 4", + }, ]; export const secondStep: ProductVariantCreateFormData = { @@ -135,19 +135,19 @@ export const secondStep: ProductVariantCreateFormData = { { id: attributes[0].id, valueRequired: attributes[0].valueRequired, - values: [] + values: [], }, { id: attributes[1].id, valueRequired: attributes[1].valueRequired, - values: [] + values: [], }, { id: attributes[3].id, valueRequired: attributes[3].valueRequired, - values: [] - } - ] + values: [], + }, + ], }; export const thirdStep: ProductVariantCreateFormData = { @@ -156,24 +156,24 @@ export const thirdStep: ProductVariantCreateFormData = { { id: attributes[0].id, valueRequired: attributes[0].valueRequired, - values: [0, 6].map(index => attributes[0].values[index]) + values: [0, 6].map(index => attributes[0].values[index]), }, { id: attributes[1].id, valueRequired: attributes[1].valueRequired, - values: [1, 3].map(index => attributes[1].values[index]) + values: [1, 3].map(index => attributes[1].values[index]), }, { id: attributes[3].id, valueRequired: attributes[3].valueRequired, - values: [0, 4].map(index => attributes[3].values[index]) - } + values: [0, 4].map(index => attributes[3].values[index]), + }, ], stock: { ...secondStep.stock, - value: warehouses.map(() => 0) + value: warehouses.map(() => 0), }, - warehouses: warehouses.map(warehouse => warehouse.id) + warehouses: warehouses.map(warehouse => warehouse.id), }; const price: Price = { @@ -181,7 +181,7 @@ const price: Price = { channels: [ { channelId: channels[0].id, price: "0" }, { channelId: channels[1].id, price: "2" }, - { channelId: channels[2].id, price: "2" } + { channelId: channels[2].id, price: "2" }, ], mode: "attribute", values: [ @@ -190,18 +190,18 @@ const price: Price = { value: [ { channelId: channels[0].id, price: "0" }, { channelId: channels[1].id, price: "2" }, - { channelId: channels[2].id, price: "2" } - ] + { channelId: channels[2].id, price: "2" }, + ], }, { slug: thirdStep.attributes[1].values[1].slug, value: [ { channelId: channels[0].id, price: "0" }, { channelId: channels[1].id, price: "2" }, - { channelId: channels[2].id, price: "2" } - ] - } - ] + { channelId: channels[2].id, price: "2" }, + ], + }, + ], }; const stock: Stock = { attribute: thirdStep.attributes[2].id, @@ -210,13 +210,13 @@ const stock: Stock = { values: [ { slug: thirdStep.attributes[2].values[0].slug, - value: [50, 20, 45, 75] + value: [50, 20, 45, 75], }, { slug: thirdStep.attributes[2].values[1].slug, - value: [80, 50, 85, 105] - } - ] + value: [80, 50, 85, 105], + }, + ], }; export const fourthStep: ProductVariantCreateFormData = { ...thirdStep, @@ -225,6 +225,6 @@ export const fourthStep: ProductVariantCreateFormData = { variants: createVariants({ ...thirdStep, price, - stock - }) + stock, + }), }; diff --git a/src/products/components/ProductVariantCreatorPage/form.ts b/src/products/components/ProductVariantCreatorPage/form.ts index 3da6d1ea3..94fd75856 100644 --- a/src/products/components/ProductVariantCreatorPage/form.ts +++ b/src/products/components/ProductVariantCreatorPage/form.ts @@ -3,7 +3,7 @@ import { AttributeValueFragment, ProductVariantAttributesFragment, ProductVariantBulkCreateInput, - WarehouseFragment + WarehouseFragment, } from "@saleor/graphql"; export interface ChannelPrice { @@ -44,32 +44,32 @@ export interface ProductVariantCreateFormData { export const createInitialForm = ( attributes: ProductVariantAttributesFragment["productType"]["variantAttributes"], channels: ChannelPriceData[], - warehouses: WarehouseFragment[] + warehouses: WarehouseFragment[], ): ProductVariantCreateFormData => { const channelListings = channels?.map(channel => ({ channelId: channel.id, - price: channel.price?.toString() || "" + price: channel.price?.toString() || "", })) || []; return { attributes: attributes.map(attribute => ({ id: attribute.id, valueRequired: attribute.valueRequired, - values: [] + values: [], })), price: { attribute: undefined, channels: channelListings, mode: "all", - values: [] + values: [], }, stock: { attribute: undefined, mode: "all", value: warehouses.length === 1 ? [0] : [], - values: [] + values: [], }, variants: [], - warehouses: warehouses.length === 1 ? [warehouses[0].id] : [] + warehouses: warehouses.length === 1 ? [warehouses[0].id] : [], }; }; diff --git a/src/products/components/ProductVariantCreatorPage/reducer.test.ts b/src/products/components/ProductVariantCreatorPage/reducer.test.ts index bb1a7f76b..71ace0e19 100644 --- a/src/products/components/ProductVariantCreatorPage/reducer.test.ts +++ b/src/products/components/ProductVariantCreatorPage/reducer.test.ts @@ -4,7 +4,7 @@ import { fourthStep, secondStep, thirdStep, - warehouses + warehouses, } from "./fixtures"; import { ChannelPrice } from "./form"; import reducer, { ProductVariantCreateReducerActionType } from "./reducer"; @@ -12,7 +12,7 @@ import reducer, { ProductVariantCreateReducerActionType } from "./reducer"; function execActions( initialState: TState, reducer: (state: TState, action: TAction) => TState, - actions: TAction[] + actions: TAction[], ): TState { return actions.reduce((acc, action) => reducer(acc, action), initialState); } @@ -23,46 +23,46 @@ describe("Reducer is able to", () => { { selectValue: { attributeId: attributes[0].id, - value: attributes[0].values[0] + value: attributes[0].values[0], }, - type: ProductVariantCreateReducerActionType.selectValue + type: ProductVariantCreateReducerActionType.selectValue, }, { selectValue: { attributeId: attributes[0].id, - value: attributes[0].values[6] + value: attributes[0].values[6], }, - type: ProductVariantCreateReducerActionType.selectValue + type: ProductVariantCreateReducerActionType.selectValue, }, { selectValue: { attributeId: attributes[1].id, - value: attributes[1].values[1] + value: attributes[1].values[1], }, - type: ProductVariantCreateReducerActionType.selectValue + type: ProductVariantCreateReducerActionType.selectValue, }, { selectValue: { attributeId: attributes[1].id, - value: attributes[1].values[3] + value: attributes[1].values[3], }, - type: ProductVariantCreateReducerActionType.selectValue + type: ProductVariantCreateReducerActionType.selectValue, }, { selectValue: { attributeId: attributes[3].id, - value: attributes[3].values[0] + value: attributes[3].values[0], }, - type: ProductVariantCreateReducerActionType.selectValue + type: ProductVariantCreateReducerActionType.selectValue, }, { selectValue: { attributeId: attributes[3].id, - value: attributes[3].values[4] + value: attributes[3].values[4], }, - type: ProductVariantCreateReducerActionType.selectValue - } + type: ProductVariantCreateReducerActionType.selectValue, + }, ]); expect(state.attributes[0].values).toHaveLength(2); @@ -76,20 +76,20 @@ describe("Reducer is able to", () => { const state = execActions(thirdStep, reducer, [ { applyPriceOrStockToAll: { - mode: "all" + mode: "all", }, - type: ProductVariantCreateReducerActionType.applyPriceToAll + type: ProductVariantCreateReducerActionType.applyPriceToAll, }, { changeApplyPriceToAllValue: { channelId: channels[0].id, - price + price, }, - type: ProductVariantCreateReducerActionType.changeApplyPriceToAllValue + type: ProductVariantCreateReducerActionType.changeApplyPriceToAllValue, }, { - type: ProductVariantCreateReducerActionType.reload - } + type: ProductVariantCreateReducerActionType.reload, + }, ]); expect(state.price.mode).toBe("all"); expect(state.price.channels[0].price).toBe(price); @@ -100,16 +100,16 @@ describe("Reducer is able to", () => { const state = execActions(thirdStep, reducer, [ { changeWarehouses: { - warehouseId: warehouses[0].id + warehouseId: warehouses[0].id, }, - type: ProductVariantCreateReducerActionType.changeWarehouses + type: ProductVariantCreateReducerActionType.changeWarehouses, }, { changeWarehouses: { - warehouseId: warehouses[2].id + warehouseId: warehouses[2].id, }, - type: ProductVariantCreateReducerActionType.changeWarehouses - } + type: ProductVariantCreateReducerActionType.changeWarehouses, + }, ]); expect(state.warehouses).toHaveLength(2); @@ -122,20 +122,20 @@ describe("Reducer is able to", () => { const state = execActions(thirdStep, reducer, [ { applyPriceOrStockToAll: { - mode: "all" + mode: "all", }, - type: ProductVariantCreateReducerActionType.applyStockToAll + type: ProductVariantCreateReducerActionType.applyStockToAll, }, { changeApplyStockToAllValue: { quantity, - warehouseIndex + warehouseIndex, }, - type: ProductVariantCreateReducerActionType.changeApplyStockToAllValue + type: ProductVariantCreateReducerActionType.changeApplyStockToAllValue, }, { - type: ProductVariantCreateReducerActionType.reload - } + type: ProductVariantCreateReducerActionType.reload, + }, ]); expect(state.stock.mode).toBe("all"); @@ -149,42 +149,42 @@ describe("Reducer is able to", () => { const state = execActions(thirdStep, reducer, [ { applyPriceOrStockToAll: { - mode: "attribute" + mode: "attribute", }, - type: ProductVariantCreateReducerActionType.applyPriceToAll + type: ProductVariantCreateReducerActionType.applyPriceToAll, }, { changeApplyPriceOrStockToAttributeId: { - attributeId: attribute.id + attributeId: attribute.id, }, type: - ProductVariantCreateReducerActionType.changeApplyPriceToAttributeId + ProductVariantCreateReducerActionType.changeApplyPriceToAttributeId, }, { changeAttributeValuePrice: { channelId: channels[0].id, price: value.toString(), - valueId: attribute.values[0].slug + valueId: attribute.values[0].slug, }, - type: ProductVariantCreateReducerActionType.changeAttributeValuePrice + type: ProductVariantCreateReducerActionType.changeAttributeValuePrice, }, { changeAttributeValuePrice: { channelId: channels[1].id, price: (value + 6).toString(), - valueId: attribute.values[1].slug + valueId: attribute.values[1].slug, }, - type: ProductVariantCreateReducerActionType.changeAttributeValuePrice + type: ProductVariantCreateReducerActionType.changeAttributeValuePrice, }, { - type: ProductVariantCreateReducerActionType.reload - } + type: ProductVariantCreateReducerActionType.reload, + }, ]); expect(state.price.mode).toBe("attribute"); expect(state.price.values).toHaveLength( state.attributes.find(attribute => state.price.attribute === attribute.id) - .values.length + .values.length, ); expect(state).toMatchSnapshot(); }); @@ -195,42 +195,42 @@ describe("Reducer is able to", () => { const state = execActions(thirdStep, reducer, [ { applyPriceOrStockToAll: { - mode: "attribute" + mode: "attribute", }, - type: ProductVariantCreateReducerActionType.applyStockToAll + type: ProductVariantCreateReducerActionType.applyStockToAll, }, { changeApplyPriceOrStockToAttributeId: { - attributeId: attribute.id + attributeId: attribute.id, }, type: - ProductVariantCreateReducerActionType.changeApplyStockToAttributeId + ProductVariantCreateReducerActionType.changeApplyStockToAttributeId, }, { changeAttributeValueStock: { quantity, valueId: attribute.values[0].slug, - warehouseIndex: 0 + warehouseIndex: 0, }, - type: ProductVariantCreateReducerActionType.changeAttributeValueStock + type: ProductVariantCreateReducerActionType.changeAttributeValueStock, }, { changeAttributeValueStock: { quantity: quantity + 6, valueId: attribute.values[1].slug, - warehouseIndex: 0 + warehouseIndex: 0, }, - type: ProductVariantCreateReducerActionType.changeAttributeValueStock + type: ProductVariantCreateReducerActionType.changeAttributeValueStock, }, { - type: ProductVariantCreateReducerActionType.reload - } + type: ProductVariantCreateReducerActionType.reload, + }, ]); expect(state.stock.mode).toBe("attribute"); expect(state.stock.values).toHaveLength( state.attributes.find(attribute => state.stock.attribute === attribute.id) - .values.length + .values.length, ); expect(state).toMatchSnapshot(); }); @@ -243,17 +243,17 @@ describe("Reducer is able to", () => { { changeVariantPriceData: { value, - variantIndex + variantIndex, }, - type: ProductVariantCreateReducerActionType.changeVariantPriceData - } + type: ProductVariantCreateReducerActionType.changeVariantPriceData, + }, ]); expect(state.variants[variantIndex].channelListings[0].price).toBe( - value.price + value.price, ); expect(state.variants[variantIndex - 1].channelListings).toBe( - fourthStep.variants[variantIndex - 1].channelListings + fourthStep.variants[variantIndex - 1].channelListings, ); expect(state).toMatchSnapshot(); }); @@ -267,17 +267,17 @@ describe("Reducer is able to", () => { changeVariantStockData: { stock: { quantity, - warehouse: warehouses[0].id + warehouse: warehouses[0].id, }, - variantIndex + variantIndex, }, - type: ProductVariantCreateReducerActionType.changeVariantStockData - } + type: ProductVariantCreateReducerActionType.changeVariantStockData, + }, ]); expect(state.variants[variantIndex].stocks[0].quantity).toBe(quantity); expect(state.variants[variantIndex - 1].stocks[0].quantity).toBe( - fourthStep.variants[variantIndex - 1].stocks[0].quantity + fourthStep.variants[variantIndex - 1].stocks[0].quantity, ); expect(state).toMatchSnapshot(); }); @@ -288,10 +288,10 @@ describe("Reducer is able to", () => { const state = execActions(fourthStep, reducer, [ { deleteVariant: { - variantIndex + variantIndex, }, - type: ProductVariantCreateReducerActionType.deleteVariant - } + type: ProductVariantCreateReducerActionType.deleteVariant, + }, ]); expect(state.variants.length).toBe(fourthStep.variants.length - 1); diff --git a/src/products/components/ProductVariantCreatorPage/reducer.ts b/src/products/components/ProductVariantCreatorPage/reducer.ts index 61096b3d4..267f3cefa 100644 --- a/src/products/components/ProductVariantCreatorPage/reducer.ts +++ b/src/products/components/ProductVariantCreatorPage/reducer.ts @@ -1,7 +1,7 @@ import { AttributeValueFragment, ProductVariantBulkCreateInput, - StockInput + StockInput, } from "@saleor/graphql"; import { add, @@ -9,14 +9,14 @@ import { removeAtIndex, toggle, update, - updateAtIndex + updateAtIndex, } from "@saleor/utils/lists"; import { createVariants } from "./createVariants"; import { AttributeValue, ProductVariantCreateFormData, - VariantCreatorPricesAndSkuMode + VariantCreatorPricesAndSkuMode, } from "./form"; export enum ProductVariantCreateReducerActionType { @@ -37,7 +37,7 @@ export enum ProductVariantCreateReducerActionType { deleteVariant, reload, rebuild, - selectValue + selectValue, } export interface ProductVariantCreateReducerAction { applyPriceOrStockToAll?: { @@ -93,7 +93,7 @@ function getVariantId(variant: ProductVariantBulkCreateInput): string { function merge( prev: ProductVariantBulkCreateInput[], - update: ProductVariantBulkCreateInput[] + update: ProductVariantBulkCreateInput[], ): ProductVariantBulkCreateInput[] { const prevIds = prev.map(getVariantId); const updateIds = update.map(getVariantId); @@ -102,34 +102,34 @@ function merge( .filter(variant => updateIds.includes(getVariantId(variant))) .map(variant => { const updatedVariant = update.find( - v => getVariantId(v) === getVariantId(variant) + v => getVariantId(v) === getVariantId(variant), ); return { ...updatedVariant, - sku: variant.sku + sku: variant.sku, }; }), - ...update.filter(variant => !prevIds.includes(getVariantId(variant))) + ...update.filter(variant => !prevIds.includes(getVariantId(variant))), ]; } function rebuild( - state: ProductVariantCreateFormData + state: ProductVariantCreateFormData, ): ProductVariantCreateFormData { return { ...state, - variants: merge(state.variants, createVariants(state)) + variants: merge(state.variants, createVariants(state)), }; } function selectValue( prevState: ProductVariantCreateFormData, attributeId: string, - value: AttributeValue> + value: AttributeValue>, ): ProductVariantCreateFormData { const attribute = prevState.attributes.find( - attribute => attribute.id === attributeId + attribute => attribute.id === attributeId, ); const values = toggle(value, attribute.values, (a, b) => a.slug === b.slug); @@ -137,9 +137,9 @@ function selectValue( { id: attributeId, valueRequired: attribute.valueRequired, - values + values, }, - remove(attribute, prevState.attributes, (a, b) => a.id === b.id) + remove(attribute, prevState.attributes, (a, b) => a.id === b.id), ); const priceValues = @@ -147,10 +147,10 @@ function selectValue( ? toggle( { slug: value.slug, - value: [] + value: [], }, prevState.price.values, - (a, b) => a.slug === b.slug + (a, b) => a.slug === b.slug, ) : prevState.price.values; @@ -159,10 +159,10 @@ function selectValue( ? toggle( { slug: value.slug, - value: [] + value: [], }, prevState.stock.values, - (a, b) => a.slug === b.slug + (a, b) => a.slug === b.slug, ) : prevState.stock.values; @@ -171,38 +171,38 @@ function selectValue( attributes: updatedAttributes, price: { ...prevState.price, - values: priceValues + values: priceValues, }, stock: { ...prevState.stock, - values: stockValues - } + values: stockValues, + }, }; } function applyPriceToAll( state: ProductVariantCreateFormData, - mode: VariantCreatorPricesAndSkuMode + mode: VariantCreatorPricesAndSkuMode, ): ProductVariantCreateFormData { return { ...state, price: { ...state.price, - mode - } + mode, + }, }; } function applyStockToAll( state: ProductVariantCreateFormData, - mode: VariantCreatorPricesAndSkuMode + mode: VariantCreatorPricesAndSkuMode, ): ProductVariantCreateFormData { return { ...state, stock: { ...state.stock, - mode - } + mode, + }, }; } @@ -210,10 +210,10 @@ function changeAttributeValuePrice( state: ProductVariantCreateFormData, attributeValueSlug: string, price: string, - channelId: string + channelId: string, ): ProductVariantCreateFormData { const index = state.price.values.findIndex( - value => value.slug === attributeValueSlug + value => value.slug === attributeValueSlug, ); if (index === -1) { @@ -222,24 +222,24 @@ function changeAttributeValuePrice( const channels = state.price.values[index].value; const channelIndex = channels.findIndex( - channel => channel.channelId === channelId + channel => channel.channelId === channelId, ); const values = updateAtIndex( { slug: attributeValueSlug, - value: updateAtIndex({ channelId, price }, channels, channelIndex) + value: updateAtIndex({ channelId, price }, channels, channelIndex), }, state.price.values, - index + index, ); return { ...state, price: { ...state.price, - values - } + values, + }, }; } @@ -247,10 +247,10 @@ function changeAttributeValueStock( state: ProductVariantCreateFormData, attributeValueSlug: string, quantity: number, - warehouseIndex: number + warehouseIndex: number, ): ProductVariantCreateFormData { const index = state.stock.values.findIndex( - value => value.slug === attributeValueSlug + value => value.slug === attributeValueSlug, ); if (index === -1) { @@ -263,32 +263,32 @@ function changeAttributeValueStock( value: updateAtIndex( quantity, state.stock.values[index].value, - warehouseIndex - ) + warehouseIndex, + ), }, state.stock.values, - index + index, ); return { ...state, stock: { ...state.stock, - values - } + values, + }, }; } function changeApplyPriceToAttributeId( state: ProductVariantCreateFormData, - attributeId: string + attributeId: string, ): ProductVariantCreateFormData { const attribute = state.attributes.find( - attribute => attribute.id === attributeId + attribute => attribute.id === attributeId, ); const values = attribute.values.map(value => ({ slug: value.slug, - value: [] + value: [], })); return { @@ -296,21 +296,21 @@ function changeApplyPriceToAttributeId( price: { ...state.price, attribute: attributeId, - values - } + values, + }, }; } function changeApplyStockToAttributeId( state: ProductVariantCreateFormData, - attributeId: string + attributeId: string, ): ProductVariantCreateFormData { const attribute = state.attributes.find( - attribute => attribute.id === attributeId + attribute => attribute.id === attributeId, ); const values = attribute.values.map(value => ({ slug: value.slug, - value: [] + value: [], })); return { @@ -318,109 +318,109 @@ function changeApplyStockToAttributeId( stock: { ...state.stock, attribute: attributeId, - values - } + values, + }, }; } function changeApplyPriceToAllValue( state: ProductVariantCreateFormData, channelId: string, - price: string + price: string, ): ProductVariantCreateFormData { const prevChannels = [...state.price.channels]; const channelIndex = prevChannels?.findIndex( - channel => channelId === channel.channelId + channel => channelId === channel.channelId, ); prevChannels[channelIndex] = { channelId, price }; return { ...state, price: { ...state.price, - channels: prevChannels - } + channels: prevChannels, + }, }; } function changeApplyStockToAllValue( state: ProductVariantCreateFormData, warehouseIndex: number, - quantity: number + quantity: number, ): ProductVariantCreateFormData { return { ...state, stock: { ...state.stock, - value: updateAtIndex(quantity, state.stock.value, warehouseIndex) - } + value: updateAtIndex(quantity, state.stock.value, warehouseIndex), + }, }; } function changeVariantSku( state: ProductVariantCreateFormData, value: string, - variantIndex: number + variantIndex: number, ): ProductVariantCreateFormData { const variant = { - ...state.variants[variantIndex] + ...state.variants[variantIndex], }; variant.sku = value; return { ...state, - variants: updateAtIndex(variant, state.variants, variantIndex) + variants: updateAtIndex(variant, state.variants, variantIndex), }; } function changeVariantStockData( state: ProductVariantCreateFormData, stock: StockInput, - variantIndex: number + variantIndex: number, ): ProductVariantCreateFormData { const variant = { - ...state.variants[variantIndex] + ...state.variants[variantIndex], }; variant.stocks = update( stock, variant.stocks, - (a, b) => a.warehouse === b.warehouse + (a, b) => a.warehouse === b.warehouse, ); return { ...state, - variants: updateAtIndex(variant, state.variants, variantIndex) + variants: updateAtIndex(variant, state.variants, variantIndex), }; } function changeVariantPriceData( state: ProductVariantCreateFormData, value: { channelId: string; price: string }, - variantIndex: number + variantIndex: number, ): ProductVariantCreateFormData { const { channelId, price } = value; const variant = { - ...state.variants[variantIndex] + ...state.variants[variantIndex], }; const channelIndex = variant.channelListings.findIndex( - listing => listing.channelId === channelId + listing => listing.channelId === channelId, ); const updatedVariant = { ...variant, channelListings: updateAtIndex( { channelId, price }, [...variant.channelListings], - channelIndex - ) + channelIndex, + ), }; return { ...state, - variants: updateAtIndex(updatedVariant, [...state.variants], variantIndex) + variants: updateAtIndex(updatedVariant, [...state.variants], variantIndex), }; } function changeWarehouses( state: ProductVariantCreateFormData, - warehouseId: string + warehouseId: string, ): ProductVariantCreateFormData { const warehouses = toggle(warehouseId, state.warehouses, (a, b) => a === b); const added = warehouses.length > state.warehouses.length; @@ -433,10 +433,10 @@ function changeWarehouses( value: [...state.stock.value, 0], values: state.stock.values.map(stockValue => ({ ...stockValue, - value: [...stockValue.value, 0] - })) + value: [...stockValue.value, 0], + })), }, - warehouses + warehouses, }; } @@ -449,16 +449,16 @@ function changeWarehouses( value: removeAtIndex(state.stock.value, warehouseIndex), values: state.stock.values.map(stockValue => ({ ...stockValue, - value: removeAtIndex(stockValue.value, warehouseIndex) - })) + value: removeAtIndex(stockValue.value, warehouseIndex), + })), }, - warehouses + warehouses, }; } function deleteVariant( state: ProductVariantCreateFormData, - variantIndex: number + variantIndex: number, ): ProductVariantCreateFormData { const variants = removeAtIndex(state.variants, variantIndex); @@ -471,32 +471,32 @@ function deleteVariant( attributes: state.attributes.map(attribute => ({ id: attribute.id, valueRequired: attribute.valueRequired, - values: [] + values: [], })), - variants - }) + variants, + }), }; } function createVariantMatrix( - state: ProductVariantCreateFormData + state: ProductVariantCreateFormData, ): ProductVariantCreateFormData { return { ...state, - variants: createVariants(state) + variants: createVariants(state), }; } function reduceProductVariantCreateFormData( prevState: ProductVariantCreateFormData, - action: ProductVariantCreateReducerAction + action: ProductVariantCreateReducerAction, ) { switch (action.type) { case ProductVariantCreateReducerActionType.selectValue: return selectValue( prevState, action.selectValue.attributeId, - action.selectValue.value + action.selectValue.value, ); case ProductVariantCreateReducerActionType.applyPriceToAll: return applyPriceToAll(prevState, action.applyPriceOrStockToAll.mode); @@ -507,54 +507,54 @@ function reduceProductVariantCreateFormData( prevState, action.changeAttributeValuePrice.valueId, action.changeAttributeValuePrice.price, - action.changeAttributeValuePrice.channelId + action.changeAttributeValuePrice.channelId, ); case ProductVariantCreateReducerActionType.changeAttributeValueStock: return changeAttributeValueStock( prevState, action.changeAttributeValueStock.valueId, action.changeAttributeValueStock.quantity, - action.changeAttributeValueStock.warehouseIndex + action.changeAttributeValueStock.warehouseIndex, ); case ProductVariantCreateReducerActionType.changeApplyPriceToAttributeId: return changeApplyPriceToAttributeId( prevState, - action.changeApplyPriceOrStockToAttributeId.attributeId + action.changeApplyPriceOrStockToAttributeId.attributeId, ); case ProductVariantCreateReducerActionType.changeApplyStockToAttributeId: return changeApplyStockToAttributeId( prevState, - action.changeApplyPriceOrStockToAttributeId.attributeId + action.changeApplyPriceOrStockToAttributeId.attributeId, ); case ProductVariantCreateReducerActionType.changeApplyPriceToAllValue: return changeApplyPriceToAllValue( prevState, action.changeApplyPriceToAllValue.channelId, - action.changeApplyPriceToAllValue.price + action.changeApplyPriceToAllValue.price, ); case ProductVariantCreateReducerActionType.changeApplyStockToAllValue: return changeApplyStockToAllValue( prevState, action.changeApplyStockToAllValue.warehouseIndex, - action.changeApplyStockToAllValue.quantity + action.changeApplyStockToAllValue.quantity, ); case ProductVariantCreateReducerActionType.changeVariantSku: return changeVariantSku( prevState, action.changeVariantSku.value, - action.changeVariantSku.variantIndex + action.changeVariantSku.variantIndex, ); case ProductVariantCreateReducerActionType.changeVariantPriceData: return changeVariantPriceData( prevState, action.changeVariantPriceData.value, - action.changeVariantPriceData.variantIndex + action.changeVariantPriceData.variantIndex, ); case ProductVariantCreateReducerActionType.changeVariantStockData: return changeVariantStockData( prevState, action.changeVariantStockData.stock, - action.changeVariantStockData.variantIndex + action.changeVariantStockData.variantIndex, ); case ProductVariantCreateReducerActionType.changeWarehouses: return changeWarehouses(prevState, action.changeWarehouses.warehouseId); diff --git a/src/products/components/ProductVariantCreatorPage/types.ts b/src/products/components/ProductVariantCreatorPage/types.ts index baab8f3e7..865c79e64 100644 --- a/src/products/components/ProductVariantCreatorPage/types.ts +++ b/src/products/components/ProductVariantCreatorPage/types.ts @@ -1,5 +1,5 @@ export enum ProductVariantCreatorStep { values, prices, - summary + summary, } diff --git a/src/products/components/ProductVariantCreatorPage/utils.ts b/src/products/components/ProductVariantCreatorPage/utils.ts index ea9c22dab..d50b5426b 100644 --- a/src/products/components/ProductVariantCreatorPage/utils.ts +++ b/src/products/components/ProductVariantCreatorPage/utils.ts @@ -1,7 +1,7 @@ import { AttributeValueFragment, ProductVariantAttributesFragment, - SearchAttributeValuesQuery + SearchAttributeValuesQuery, } from "@saleor/graphql"; import { getById } from "@saleor/orders/components/OrderReturnPage/utils"; import { RelayToFlat } from "@saleor/types"; @@ -11,7 +11,7 @@ import { AttributeValue, ProductVariantCreateFormData } from "./form"; export function getPriceAttributeValues( data: ProductVariantCreateFormData, - attributes: ProductVariantAttributesFragment["productType"]["variantAttributes"] + attributes: ProductVariantAttributesFragment["productType"]["variantAttributes"], ): AttributeValueFragment[] { return data.price.mode === "all" ? null @@ -22,8 +22,8 @@ export function getPriceAttributeValues( data.attributes .find(attribute => attribute.id === data.price.attribute) .values.some( - attributeValue => attributeValue.slug === value.node.slug - ) + attributeValue => attributeValue.slug === value.node.slug, + ), ) .map(value => value.node) : []; @@ -31,7 +31,7 @@ export function getPriceAttributeValues( export function getStockAttributeValues( data: ProductVariantCreateFormData, - attributes: ProductVariantAttributesFragment["productType"]["variantAttributes"] + attributes: ProductVariantAttributesFragment["productType"]["variantAttributes"], ): AttributeValueFragment[] { return data.stock.mode === "all" ? null @@ -42,8 +42,8 @@ export function getStockAttributeValues( data.attributes .find(attribute => attribute.id === data.stock.attribute) .values.some( - attributeValue => attributeValue.slug === value.node.slug - ) + attributeValue => attributeValue.slug === value.node.slug, + ), ) .map(value => value.node) : []; @@ -54,13 +54,13 @@ export const getBySlug = (slugToCompare: string) => (obj: { slug: string }) => export const getBooleanAttributeValue = ( attributeName: string, - attributeValue: boolean + attributeValue: boolean, ): AttributeValue> => ({ slug: attributeValue.toString(), value: { boolean: attributeValue, - name: `${attributeName}: ${attributeValue ? "Yes" : "No"}` - } + name: `${attributeName}: ${attributeValue ? "Yes" : "No"}`, + }, }); export const getBasicAttributeValue = ( @@ -69,7 +69,7 @@ export const getBasicAttributeValue = ( attributeValues: RelayToFlat< SearchAttributeValuesQuery["attribute"]["choices"] >, - data: ProductVariantCreateFormData + data: ProductVariantCreateFormData, ): AttributeValue> => { const dataAttribute = data.attributes.find(getById(attributeId)); @@ -77,18 +77,18 @@ export const getBasicAttributeValue = ( slug: attributeValue, value: dataAttribute?.values.find(getBySlug(attributeValue))?.value || - attributeValues.find(getBySlug(attributeValue)) + attributeValues.find(getBySlug(attributeValue)), }; }; export function dedupeListings( - data: ProductVariantCreateFormData + data: ProductVariantCreateFormData, ): ProductVariantCreateFormData { return { ...data, variants: data.variants.map(variant => ({ ...variant, - channelListings: uniqBy(variant.channelListings, "channelId") - })) + channelListings: uniqBy(variant.channelListings, "channelId"), + })), }; } diff --git a/src/products/components/ProductVariantDeleteDialog/ProductVariantDeleteDialog.tsx b/src/products/components/ProductVariantDeleteDialog/ProductVariantDeleteDialog.tsx index d51d2732d..277a01911 100644 --- a/src/products/components/ProductVariantDeleteDialog/ProductVariantDeleteDialog.tsx +++ b/src/products/components/ProductVariantDeleteDialog/ProductVariantDeleteDialog.tsx @@ -3,7 +3,7 @@ import { DialogActions, DialogContent, DialogContentText, - DialogTitle + DialogTitle, } from "@material-ui/core"; import BackButton from "@saleor/components/BackButton"; import ConfirmButton from "@saleor/components/ConfirmButton"; @@ -15,13 +15,13 @@ const useStyles = makeStyles( theme => ({ deleteButton: { "&:hover": { - backgroundColor: theme.palette.error.main + backgroundColor: theme.palette.error.main, }, backgroundColor: theme.palette.error.main, - color: theme.palette.error.contrastText - } + color: theme.palette.error.contrastText, + }, }), - { name: "ProductVariantDeleteDialog" } + { name: "ProductVariantDeleteDialog" }, ); export interface ProductVariantDeleteDialogProps { @@ -53,7 +53,7 @@ const ProductVariantDeleteDialog: React.FC = pr defaultMessage="Are you sure you want to delete {name}?" description="delete product variant" values={{ - name + name, }} /> diff --git a/src/products/components/ProductVariantEndPreorderDialog/ProductVariantEndPreorderDialog.tsx b/src/products/components/ProductVariantEndPreorderDialog/ProductVariantEndPreorderDialog.tsx index 08a199fa8..80b41673a 100644 --- a/src/products/components/ProductVariantEndPreorderDialog/ProductVariantEndPreorderDialog.tsx +++ b/src/products/components/ProductVariantEndPreorderDialog/ProductVariantEndPreorderDialog.tsx @@ -19,21 +19,21 @@ const ProductVariantEndPreorderDialog: React.FC { const intl = useIntl(); return ( @@ -41,8 +41,8 @@ const ProductVariantEndPreorderDialog: React.FC diff --git a/src/products/components/ProductVariantEndPreorderDialog/messages.ts b/src/products/components/ProductVariantEndPreorderDialog/messages.ts index f6bdc4b20..0927b8bd0 100644 --- a/src/products/components/ProductVariantEndPreorderDialog/messages.ts +++ b/src/products/components/ProductVariantEndPreorderDialog/messages.ts @@ -4,16 +4,16 @@ export const productVariantEndPreorderDialogMessages = defineMessages({ dialogTitle: { id: "Y4cy0i", defaultMessage: "Ending preorder", - description: "dialog header" + description: "dialog header", }, dialogMessage: { id: "dTCWqt", defaultMessage: - "You are about to end your products preorder. You have sold {variantGlobalSoldUnits} units of this variant. Sold units will be allocated at appropriate warehouses. Remember to add remaining threshold stock to warehouses." + "You are about to end your products preorder. You have sold {variantGlobalSoldUnits} units of this variant. Sold units will be allocated at appropriate warehouses. Remember to add remaining threshold stock to warehouses.", }, dialogConfirmButtonLabel: { id: "XMvH/d", defaultMessage: "ACCEPT", - description: "button label" - } + description: "button label", + }, }); diff --git a/src/products/components/ProductVariantImageSelectDialog/ProductVariantMediaSelectDialog.tsx b/src/products/components/ProductVariantImageSelectDialog/ProductVariantMediaSelectDialog.tsx index c1afc6753..967298b1c 100644 --- a/src/products/components/ProductVariantImageSelectDialog/ProductVariantMediaSelectDialog.tsx +++ b/src/products/components/ProductVariantImageSelectDialog/ProductVariantMediaSelectDialog.tsx @@ -2,7 +2,7 @@ import { Dialog, DialogActions, DialogContent, - DialogTitle + DialogTitle, } from "@material-ui/core"; import BackButton from "@saleor/components/BackButton"; import { ProductMediaFragment } from "@saleor/graphql"; @@ -17,7 +17,7 @@ const useStyles = makeStyles( height: "100%", objectFit: "contain", userSelect: "none", - width: "100%" + width: "100%", }, imageContainer: { background: "transparent", @@ -28,7 +28,7 @@ const useStyles = makeStyles( overflow: "hidden", padding: theme.spacing(2), position: "relative", - transitionDuration: theme.transitions.duration.standard + "ms" + transitionDuration: theme.transitions.duration.standard + "ms", }, root: { display: "grid", @@ -38,15 +38,15 @@ const useStyles = makeStyles( maxWidth: "100%", width: theme.breakpoints.values.lg, [theme.breakpoints.down("sm")]: { - gridTemplateColumns: "repeat(2, 1fr)" - } + gridTemplateColumns: "repeat(2, 1fr)", + }, }, selectedImageContainer: { borderColor: theme.palette.primary.main, - borderWidth: "2px" - } + borderWidth: "2px", + }, }), - { name: "ProductVariantImageSelectDialog" } + { name: "ProductVariantImageSelectDialog" }, ); interface ProductVariantImageSelectDialogProps { @@ -84,8 +84,8 @@ const ProductVariantMediaSelectDialog: React.FC ({ gridElement: { "& img": { - width: "100%" - } + width: "100%", + }, }, helpText: { - gridColumnEnd: "span 4" + gridColumnEnd: "span 4", }, image: { objectFit: "contain", - width: "100%" + width: "100%", }, imageContainer: { background: "#ffffff", @@ -45,15 +45,15 @@ const useStyles = makeStyles( borderRadius: theme.spacing(), height: theme.spacing(17.5), marginBottom: theme.spacing(2), - padding: theme.spacing(2) + padding: theme.spacing(2), }, root: { display: "grid", gridColumnGap: theme.spacing(2), - gridTemplateColumns: "repeat(4, 1fr)" - } + gridTemplateColumns: "repeat(4, 1fr)", + }, }), - { name: "ProductVariantMedia" } + { name: "ProductVariantMedia" }, ); interface ProductVariantMediaProps { diff --git a/src/products/components/ProductVariantNavigation/ProductVariantNavigation.tsx b/src/products/components/ProductVariantNavigation/ProductVariantNavigation.tsx index 1249719e9..e9263d43e 100644 --- a/src/products/components/ProductVariantNavigation/ProductVariantNavigation.tsx +++ b/src/products/components/ProductVariantNavigation/ProductVariantNavigation.tsx @@ -6,17 +6,17 @@ import ResponsiveTable from "@saleor/components/ResponsiveTable"; import Skeleton from "@saleor/components/Skeleton"; import { SortableTableBody, - SortableTableRow + SortableTableRow, } from "@saleor/components/SortableTable"; import TableCellAvatar from "@saleor/components/TableCellAvatar"; import { ProductVariantCreateDataQuery, - ProductVariantDetailsQuery + ProductVariantDetailsQuery, } from "@saleor/graphql"; import { makeStyles } from "@saleor/macaw-ui"; import { productVariantAddUrl, - productVariantEditUrl + productVariantEditUrl, } from "@saleor/products/urls"; import { ReorderAction } from "@saleor/types"; import classNames from "classnames"; @@ -28,26 +28,26 @@ import { renderCollection } from "../../../misc"; const useStyles = makeStyles( theme => ({ colAvatar: { - width: 64 + width: 64, }, colName: { - paddingLeft: 0 + paddingLeft: 0, }, defaultVariant: { color: fade(theme.palette.text.secondary, 0.6), - display: "block" + display: "block", }, firstVariant: { - width: 104 + width: 104, }, link: { - cursor: "pointer" + cursor: "pointer", }, noHandle: { "&&&": { - paddingRight: theme.spacing(3) + paddingRight: theme.spacing(3), }, - textAlign: "right" + textAlign: "right", }, tabActive: { "& > td:first-child": { @@ -58,13 +58,13 @@ const useStyles = makeStyles( left: 0, position: "absolute", top: 0, - width: 2 + width: 2, }, - position: "relative" - } - } + position: "relative", + }, + }, }), - { name: "ProductVariantNavigation" } + { name: "ProductVariantNavigation" }, ); interface ProductVariantNavigationProps { @@ -87,7 +87,7 @@ const ProductVariantNavigation: React.FC = props productId, isCreate, variants, - onReorder + onReorder, } = props; const classes = useStyles(props); @@ -99,7 +99,7 @@ const ProductVariantNavigation: React.FC = props title={intl.formatMessage({ id: "1kdQdO", defaultMessage: "Variants", - description: "section header" + description: "section header", })} /> @@ -108,7 +108,7 @@ const ProductVariantNavigation: React.FC = props const isDefault = variant && variant.id === defaultVariantId; const isActive = variant && variant.id === current; const thumbnail = variant?.media?.filter( - mediaObj => mediaObj.type === "IMAGE" + mediaObj => mediaObj.type === "IMAGE", )[0]; return ( @@ -117,7 +117,7 @@ const ProductVariantNavigation: React.FC = props key={variant ? variant.id : "skeleton"} index={variantIndex || 0} className={classNames(classes.link, { - [classes.tabActive]: isActive + [classes.tabActive]: isActive, })} href={ variant @@ -136,7 +136,7 @@ const ProductVariantNavigation: React.FC = props {intl.formatMessage({ id: "vZMs8f", defaultMessage: "Default", - description: "default product variant indicator" + description: "default product variant indicator", })} )} @@ -168,8 +168,8 @@ const ProductVariantNavigation: React.FC = props classes.tabActive, classes.noHandle, { - [classes.firstVariant]: variants?.length === 0 - } + [classes.firstVariant]: variants?.length === 0, + }, )} thumbnail={null} colSpan={2} diff --git a/src/products/components/ProductVariantPage/ProductVariantPage.tsx b/src/products/components/ProductVariantPage/ProductVariantPage.tsx index d116cc8a6..4d6f9d4a4 100644 --- a/src/products/components/ProductVariantPage/ProductVariantPage.tsx +++ b/src/products/components/ProductVariantPage/ProductVariantPage.tsx @@ -1,12 +1,12 @@ import { getAttributeValuesFromReferences, - mergeAttributeValues + mergeAttributeValues, } from "@saleor/attributes/utils/data"; import { ChannelPriceData } from "@saleor/channels/utils"; import AssignAttributeValueDialog from "@saleor/components/AssignAttributeValueDialog"; import Attributes, { AttributeInput, - VariantAttributeScope + VariantAttributeScope, } from "@saleor/components/Attributes"; import { Backlink } from "@saleor/components/Backlink"; import CardSpacer from "@saleor/components/CardSpacer"; @@ -23,7 +23,7 @@ import { SearchAttributeValuesQuery, SearchPagesQuery, SearchProductsQuery, - WarehouseFragment + WarehouseFragment, } from "@saleor/graphql"; import useNavigator from "@saleor/hooks/useNavigator"; import { ConfirmButtonTransitionState } from "@saleor/macaw-ui"; @@ -44,7 +44,7 @@ import ProductVariantSetDefault from "../ProductVariantSetDefault"; import ProductVariantUpdateForm, { ProductVariantUpdateData, ProductVariantUpdateHandlers, - ProductVariantUpdateSubmitData + ProductVariantUpdateSubmitData, } from "./form"; import VariantDetailsChannelsAvailabilityCard from "./VariantDetailsChannelsAvailabilityCard"; @@ -52,13 +52,13 @@ const messages = defineMessages({ nonSelectionAttributes: { id: "f3B4tc", defaultMessage: "Variant Attributes", - description: "attributes, section header" + description: "attributes, section header", }, selectionAttributesHeader: { id: "o6260f", defaultMessage: "Variant Selection Attributes", - description: "attributes, section header" - } + description: "attributes, section header", + }, }); export interface ProductVariantPageFormData extends MetadataFormData { @@ -153,7 +153,7 @@ const ProductVariantPage: React.FC = ({ fetchMoreReferenceProducts, fetchMoreAttributeValues, onCloseDialog, - onAttributeSelectBlur + onAttributeSelectBlur, }) => { const intl = useIntl(); const navigate = useNavigator(); @@ -163,12 +163,12 @@ const ProductVariantPage: React.FC = ({ const [ isEndPreorderModalOpened, - setIsEndPreorderModalOpened + setIsEndPreorderModalOpened, ] = React.useState(false); const variantMedia = variant?.media?.map(image => image.id); const productMedia = [ - ...(variant?.product?.media ?? []) + ...(variant?.product?.media ?? []), ]?.sort((prev, next) => (prev.sortOrder > next.sortOrder ? 1 : -1)); const media = productMedia ?.filter(image => variantMedia.indexOf(image.id) !== -1) @@ -184,15 +184,15 @@ const ProductVariantPage: React.FC = ({ const handleAssignReferenceAttribute = ( attributeValues: string[], data: ProductVariantUpdateData, - handlers: ProductVariantUpdateHandlers + handlers: ProductVariantUpdateHandlers, ) => { handlers.selectAttributeReference( assignReferencesAttributeId, mergeAttributeValues( assignReferencesAttributeId, attributeValues, - data.attributes - ) + data.attributes, + ), ); onCloseDialog(); }; @@ -231,13 +231,13 @@ const ProductVariantPage: React.FC = ({ isSaveDisabled, handlers, submit, - attributeRichTextGetters + attributeRichTextGetters, }) => { const nonSelectionAttributes = data.attributes.filter( - byAttributeScope(VariantAttributeScope.NOT_VARIANT_SELECTION) + byAttributeScope(VariantAttributeScope.NOT_VARIANT_SELECTION), ); const selectionAttributes = data.attributes.filter( - byAttributeScope(VariantAttributeScope.VARIANT_SELECTION) + byAttributeScope(VariantAttributeScope.VARIANT_SELECTION), ); return ( @@ -259,7 +259,7 @@ const ProductVariantPage: React.FC = ({ <> = ({ <> = ({ ProductVariantChannelListings={data.channelListings.map( channel => ({ ...channel.data, - ...channel.value - }) + ...channel.value, + }), )} errors={channelErrors} loading={loading} @@ -345,8 +345,8 @@ const ProductVariantPage: React.FC = ({ productVariantChannelListings={data.channelListings.map( channel => ({ ...channel.data, - ...channel.value - }) + ...channel.value, + }), )} onVariantChannelListingChange={handlers.changeChannels} data={data} @@ -385,7 +385,7 @@ const ProductVariantPage: React.FC = ({ assignReferencesAttributeId, data.attributes, referencePages, - referenceProducts + referenceProducts, )} hasMore={handlers.fetchMoreReferences?.hasMore} open={canOpenAssignReferencesAttributeDialog} @@ -397,7 +397,7 @@ const ProductVariantPage: React.FC = ({ handleAssignReferenceAttribute( attributeValues, data, - handlers + handlers, ) } /> diff --git a/src/products/components/ProductVariantPage/VariantDetailsChannelsAvailabilityCard/VariantDetailsChannelsAvailabilityCardContainer.tsx b/src/products/components/ProductVariantPage/VariantDetailsChannelsAvailabilityCard/VariantDetailsChannelsAvailabilityCardContainer.tsx index 9e0fb7bd6..ce75d5078 100644 --- a/src/products/components/ProductVariantPage/VariantDetailsChannelsAvailabilityCard/VariantDetailsChannelsAvailabilityCardContainer.tsx +++ b/src/products/components/ProductVariantPage/VariantDetailsChannelsAvailabilityCard/VariantDetailsChannelsAvailabilityCardContainer.tsx @@ -11,7 +11,7 @@ interface VariantDetailsChannelsAvailabilityCardContainerProps { } const VariantDetailsChannelsAvailabilityCardContainer: React.FC = ({ - children + children, }) => ( <> diff --git a/src/products/components/ProductVariantPage/VariantDetailsChannelsAvailabilityCard/index.tsx b/src/products/components/ProductVariantPage/VariantDetailsChannelsAvailabilityCard/index.tsx index f89211ab4..c234f3495 100644 --- a/src/products/components/ProductVariantPage/VariantDetailsChannelsAvailabilityCard/index.tsx +++ b/src/products/components/ProductVariantPage/VariantDetailsChannelsAvailabilityCard/index.tsx @@ -3,7 +3,7 @@ import { AccordionSummary, CardContent, Divider, - Typography + Typography, } from "@material-ui/core"; import Skeleton from "@saleor/components/Skeleton"; import { ProductVariantFragment } from "@saleor/graphql"; @@ -25,16 +25,16 @@ const useExpanderStyles = makeStyles( padding: 0, "&:before": { - content: "none" + content: "none", }, "&$expanded": { margin: 0, - border: "none" - } - } + border: "none", + }, + }, }), - { name: "VariantDetailsChannelsAvailabilityCardExpander" } + { name: "VariantDetailsChannelsAvailabilityCardExpander" }, ); const useSummaryStyles = makeStyles( @@ -48,27 +48,27 @@ const useSummaryStyles = makeStyles( minHeight: 0, "&$expanded": { - minHeight: 0 - } + minHeight: 0, + }, }, content: { margin: 0, "&$expanded": { - margin: 0 - } - } + margin: 0, + }, + }, }), - { name: "VariantDetailsChannelsAvailabilityCardExpanderSummary" } + { name: "VariantDetailsChannelsAvailabilityCardExpanderSummary" }, ); const useStyles = makeStyles( () => ({ summaryContent: { - paddingTop: 0 - } + paddingTop: 0, + }, }), - { name: "VariantDetailsChannelsAvailabilityCard" } + { name: "VariantDetailsChannelsAvailabilityCard" }, ); interface VariantDetailsChannelsAvailabilityCardProps { @@ -76,7 +76,7 @@ interface VariantDetailsChannelsAvailabilityCardProps { } const VariantDetailsChannelsAvailabilityCard: React.FC = ({ - variant + variant, }) => { const classes = useStyles(); const expanderClasses = useExpanderStyles({}); @@ -86,13 +86,13 @@ const VariantDetailsChannelsAvailabilityCard: React.FC variant?.product.channelListings.find( - ({ channel }) => channel.id === channelId + ({ channel }) => channel.id === channelId, ); const getItemSubtitle = (channelId: string) => { const { isPublished, - publicationDate + publicationDate, } = getProductChannelListingByChannelId(channelId); if (!isPublished) { @@ -100,7 +100,7 @@ const VariantDetailsChannelsAvailabilityCard: React.FC id + ({ channel: { id } }) => id, ); const allAvailableChannelsListings = variant.product.channelListings.filter( - ({ channel }) => variantChannelListingsChannelsIds.includes(channel.id) + ({ channel }) => variantChannelListingsChannelsIds.includes(channel.id), ); const publishedInChannelsListings = allAvailableChannelsListings.filter( - ({ isPublished }) => isPublished + ({ isPublished }) => isPublished, ); if (!isAvailableInAnyChannels) { @@ -154,7 +154,7 @@ const VariantDetailsChannelsAvailabilityCard: React.FC {intl.formatMessage(messages.subtitle, { publishedInChannelsCount: publishedInChannelsListings.length, - availableChannelsCount: allAvailableChannelsListings.length + availableChannelsCount: allAvailableChannelsListings.length, })} diff --git a/src/products/components/ProductVariantPage/form.tsx b/src/products/components/ProductVariantPage/form.tsx index 2cd818360..91340568e 100644 --- a/src/products/components/ProductVariantPage/form.tsx +++ b/src/products/components/ProductVariantPage/form.tsx @@ -3,7 +3,7 @@ import { getRichTextAttributesFromMap, getRichTextDataFromAttributes, mergeAttributes, - RichTextProps + RichTextProps, } from "@saleor/attributes/utils/data"; import { createAttributeChangeHandler, @@ -12,11 +12,11 @@ import { createAttributeReferenceChangeHandler, createAttributeValueReorderHandler, createFetchMoreReferencesHandler, - createFetchReferencesHandler + createFetchReferencesHandler, } from "@saleor/attributes/utils/handlers"; import { ChannelPriceAndPreorderData, - IChannelPriceAndPreorderArgs + IChannelPriceAndPreorderArgs, } from "@saleor/channels/utils"; import { AttributeInput } from "@saleor/components/Attributes"; import { useExitFormDialog } from "@saleor/components/Form/useExitFormDialog"; @@ -25,31 +25,31 @@ import { ProductVariantFragment, SearchPagesQuery, SearchProductsQuery, - SearchWarehousesQuery + SearchWarehousesQuery, } from "@saleor/graphql"; import useForm, { CommonUseFormResultWithHandlers, FormChange, FormErrors, - SubmitPromise + SubmitPromise, } from "@saleor/hooks/useForm"; import useFormset, { FormsetChange, - FormsetData + FormsetData, } from "@saleor/hooks/useFormset"; import useHandleFormSubmit from "@saleor/hooks/useHandleFormSubmit"; import { errorMessages } from "@saleor/intl"; import { getAttributeInputFromVariant, - getStockInputFromVariant + getStockInputFromVariant, } from "@saleor/products/utils/data"; import { createPreorderEndDateChangeHandler, - getChannelsInput + getChannelsInput, } from "@saleor/products/utils/handlers"; import { validateCostPrice, - validatePrice + validatePrice, } from "@saleor/products/utils/validation"; import { FetchMoreProps, RelayToFlat, ReorderEvent } from "@saleor/types"; import { arrayDiff } from "@saleor/utils/arrays"; @@ -146,7 +146,7 @@ function useProductVariantUpdateForm( variant: ProductVariantFragment, onSubmit: (data: ProductVariantUpdateSubmitData) => SubmitPromise, loading: boolean, - opts: UseProductVariantUpdateFormOpts + opts: UseProductVariantUpdateFormOpts, ): UseProductVariantUpdateFormResult { const intl = useIntl(); const attributeInput = getAttributeInputFromVariant(variant); @@ -154,13 +154,13 @@ function useProductVariantUpdateForm( const currentChannelsWithPreorderInfo = opts.currentChannels?.map(channel => { const variantChannel = variant?.channelListings?.find( - channelListing => channelListing.channel.id === channel.id + channelListing => channelListing.channel.id === channel.id, ); return { ...channel, preorderThreshold: variantChannel?.preorderThreshold?.quantity, - soldUnits: variantChannel?.preorderThreshold?.soldUnits + soldUnits: variantChannel?.preorderThreshold?.soldUnits, }; }); @@ -177,11 +177,11 @@ function useProductVariantUpdateForm( hasPreorderEndDate: !!variant?.preorder?.endDate, preorderEndDateTime: variant?.preorder?.endDate, weight: variant?.weight?.value.toString() || "", - quantityLimitPerCustomer: variant?.quantityLimitPerCustomer || null + quantityLimitPerCustomer: variant?.quantityLimitPerCustomer || null, }; const form = useForm(initial, undefined, { - confirmLeave: true + confirmLeave: true, }); const { @@ -189,20 +189,20 @@ function useProductVariantUpdateForm( triggerChange, data: formData, formId, - setIsSubmitDisabled + setIsSubmitDisabled, } = form; const { setExitDialogSubmitRef } = useExitFormDialog({ - formId + formId, }); const attributes = useFormset(attributeInput); const { getters: attributeRichTextGetters, - getValues: getAttributeRichTextValues + getValues: getAttributeRichTextValues, } = useMultipleRichText({ initial: getRichTextDataFromAttributes(attributes.data), - triggerChange + triggerChange, }); const attributesWithNewFileValue = useFormset([]); const stocks = useFormset(stockInput); @@ -210,46 +210,46 @@ function useProductVariantUpdateForm( const { isMetadataModified, isPrivateMetadataModified, - makeChangeHandler: makeMetadataChangeHandler + makeChangeHandler: makeMetadataChangeHandler, } = useMetadataChangeTrigger(); const changeMetadata = makeMetadataChangeHandler(handleChange); const handleAttributeChange = createAttributeChangeHandler( attributes.change, - triggerChange + triggerChange, ); const handleAttributeMultiChange = createAttributeMultiChangeHandler( attributes.change, attributes.data, - triggerChange + triggerChange, ); const handleAttributeReferenceChange = createAttributeReferenceChangeHandler( attributes.change, - triggerChange + triggerChange, ); const handleFetchReferences = createFetchReferencesHandler( attributes.data, opts.assignReferencesAttributeId, opts.fetchReferencePages, - opts.fetchReferenceProducts + opts.fetchReferenceProducts, ); const handleFetchMoreReferences = createFetchMoreReferencesHandler( attributes.data, opts.assignReferencesAttributeId, opts.fetchMoreReferencePages, - opts.fetchMoreReferenceProducts + opts.fetchMoreReferenceProducts, ); const handleAttributeFileChange = createAttributeFileChangeHandler( attributes.change, attributesWithNewFileValue.data, attributesWithNewFileValue.add, attributesWithNewFileValue.change, - triggerChange + triggerChange, ); const handleAttributeValueReorder = createAttributeValueReorderHandler( attributes.change, attributes.data, - triggerChange + triggerChange, ); const handleStockAdd = (id: string) => { @@ -258,11 +258,11 @@ function useProductVariantUpdateForm( data: { quantityAllocated: variant?.stocks?.find(stock => stock.warehouse.id === id) - ?.quantityAllocated || 0 + ?.quantityAllocated || 0, }, id, label: opts.warehouses.find(warehouse => warehouse.id === id).name, - value: "0" + value: "0", }); }; const handleStockChange = (id: string, value: string) => { @@ -281,7 +281,7 @@ function useProductVariantUpdateForm( const handlePreorderEndDateChange = createPreorderEndDateChangeHandler( form, triggerChange, - intl.formatMessage(errorMessages.preorderEndDateInFutureErrorText) + intl.formatMessage(errorMessages.preorderEndDateInFutureErrorText), ); const dataStocks = stocks.data.map(stock => stock.id); @@ -289,10 +289,10 @@ function useProductVariantUpdateForm( const stockDiff = arrayDiff(variantStocks, dataStocks); const addStocks = stocks.data.filter(stock => - stockDiff.added.some(addedStock => addedStock === stock.id) + stockDiff.added.some(addedStock => addedStock === stock.id), ); const updateStocks = stocks.data.filter( - stock => !stockDiff.added.some(addedStock => addedStock === stock.id) + stock => !stockDiff.added.some(addedStock => addedStock === stock.id), ); const data: ProductVariantUpdateData = { @@ -301,17 +301,17 @@ function useProductVariantUpdateForm( attributes.data, attributesWithNewFileValue.data, opts.referencePages, - opts.referenceProducts + opts.referenceProducts, ), channelListings: channels.data, - stocks: stocks.data + stocks: stocks.data, }; const disabled = channels?.data.some( channelData => validatePrice(channelData.value.price) || - validateCostPrice(channelData.value.costPrice) + validateCostPrice(channelData.value.costPrice), ) || (data.isPreorder && data.hasPreorderEndDate && @@ -325,13 +325,13 @@ function useProductVariantUpdateForm( attributes.data, getRichTextAttributesFromMap( attributes.data, - await getAttributeRichTextValues() - ) + await getAttributeRichTextValues(), + ), ), attributesWithNewFileValue: attributesWithNewFileValue.data, channelListings: channels.data, removeStocks: stockDiff.removed, - updateStocks + updateStocks, }); const handleSubmit = async (data: ProductVariantUpdateSubmitData) => { @@ -346,7 +346,7 @@ function useProductVariantUpdateForm( const handleFormSubmit = useHandleFormSubmit({ formId, - onSubmit: handleSubmit + onSubmit: handleSubmit, }); const submit = async () => handleFormSubmit(await getSubmitData()); @@ -374,11 +374,11 @@ function useProductVariantUpdateForm( selectAttribute: handleAttributeChange, selectAttributeFile: handleAttributeFileChange, selectAttributeMultiple: handleAttributeMultiChange, - selectAttributeReference: handleAttributeReferenceChange + selectAttributeReference: handleAttributeReferenceChange, }, submit, isSaveDisabled, - attributeRichTextGetters + attributeRichTextGetters, }; } diff --git a/src/products/components/ProductVariantPage/messages.ts b/src/products/components/ProductVariantPage/messages.ts index 3c026b022..706744cdd 100644 --- a/src/products/components/ProductVariantPage/messages.ts +++ b/src/products/components/ProductVariantPage/messages.ts @@ -4,28 +4,28 @@ export const variantDetailsChannelsAvailabilityCardMessages = defineMessages({ title: { id: "sedoZ3", defaultMessage: "Availability", - description: "VariantDetailsChannelsAvailabilityCard title" + description: "VariantDetailsChannelsAvailabilityCard title", }, subtitle: { id: "3+KwtP", defaultMessage: "Available in {publishedInChannelsCount} out of {availableChannelsCount}", - description: "VariantDetailsChannelsAvailabilityCard subtitle" + description: "VariantDetailsChannelsAvailabilityCard subtitle", }, itemSubtitlePublished: { id: "rJ3lkW", defaultMessage: "Published since {publicationDate}", description: - "VariantDetailsChannelsAvailabilityCard item subtitle published" + "VariantDetailsChannelsAvailabilityCard item subtitle published", }, itemSubtitleHidden: { id: "EsZH44", defaultMessage: "Hidden", - description: "VariantDetailsChannelsAvailabilityCard item subtitle hidden" + description: "VariantDetailsChannelsAvailabilityCard item subtitle hidden", }, noItemsAvailable: { id: "jqJqdE", defaultMessage: "This variant is not available at any of the channels", - description: "VariantDetailsChannelsAvailabilityCard no items available" - } + description: "VariantDetailsChannelsAvailabilityCard no items available", + }, }); diff --git a/src/products/components/ProductVariantPrice/ProductVariantPrice.tsx b/src/products/components/ProductVariantPrice/ProductVariantPrice.tsx index 3952f34db..6e7be4e1a 100644 --- a/src/products/components/ProductVariantPrice/ProductVariantPrice.tsx +++ b/src/products/components/ProductVariantPrice/ProductVariantPrice.tsx @@ -5,12 +5,12 @@ import { TableCell, TableHead, TableRow, - Typography + Typography, } from "@material-ui/core"; import { ChannelData, ChannelPriceAndPreorderArgs, - ChannelPriceArgs + ChannelPriceArgs, } from "@saleor/channels/utils"; import CardTitle from "@saleor/components/CardTitle"; import PriceField from "@saleor/components/PriceField"; @@ -21,7 +21,7 @@ import { makeStyles } from "@saleor/macaw-ui"; import { renderCollection } from "@saleor/misc"; import { getFormChannelError, - getFormChannelErrors + getFormChannelErrors, } from "@saleor/utils/errors"; import getProductErrorMessage from "@saleor/utils/errors/product"; import React from "react"; @@ -32,28 +32,28 @@ const useStyles = makeStyles( colPrice: { textAlign: "right", verticalAlign: "top", - width: 200 + width: 200, }, colType: { fontSize: 14, textAlign: "right", - width: 200 + width: 200, }, input: { - textAlign: "left" + textAlign: "left", }, pricingContent: { "&:last-child": { - paddingBottom: 0 + paddingBottom: 0, }, paddingLeft: 0, - paddingRight: 0 + paddingRight: 0, }, table: { - tableLayout: "fixed" - } + tableLayout: "fixed", + }, }), - { name: "ProductVariantPrice" } + { name: "ProductVariantPrice" }, ); interface ProductVariantPriceProps { @@ -63,7 +63,7 @@ interface ProductVariantPriceProps { disabled?: boolean; onChange?: ( id: string, - data: ChannelPriceArgs | ChannelPriceAndPreorderArgs + data: ChannelPriceArgs | ChannelPriceAndPreorderArgs, ) => void; disabledMessage?: MessageDescriptor; } @@ -77,7 +77,7 @@ const ProductVariantPrice: React.FC = props => { ProductVariantChannelListings = [], loading, onChange, - disabledMessage + disabledMessage, } = props; const classes = useStyles(props); const intl = useIntl(); @@ -90,7 +90,7 @@ const ProductVariantPrice: React.FC = props => { title={intl.formatMessage({ id: "Xm9qOu", defaultMessage: "Pricing", - description: "product pricing, section header" + description: "product pricing, section header", })} /> @@ -100,8 +100,8 @@ const ProductVariantPrice: React.FC = props => { id: "e48Igh", defaultMessage: "Assign this variant to a channel in the product channel manager to define prices", - description: "variant pricing section subtitle" - } + description: "variant pricing section subtitle", + }, )} @@ -115,7 +115,7 @@ const ProductVariantPrice: React.FC = props => { title={intl.formatMessage({ id: "Xm9qOu", defaultMessage: "Pricing", - description: "product pricing, section header" + description: "product pricing, section header", })} /> @@ -124,7 +124,7 @@ const ProductVariantPrice: React.FC = props => { id: "VvA7ai", defaultMessage: "Channels that don’t have assigned prices will use their parent channel to define the price. Price will be converted to channel’s currency", - description: "info text" + description: "info text", })} @@ -160,11 +160,11 @@ const ProductVariantPrice: React.FC = props => { (listing, index) => { const priceError = getFormChannelError( formErrors.price, - listing.id + listing.id, ); const costPriceError = getFormChannelError( formErrors.costPrice, - listing.id + listing.id, ); return ( @@ -177,7 +177,7 @@ const ProductVariantPrice: React.FC = props => { error={!!priceError} label={intl.formatMessage({ id: "b1zuN9", - defaultMessage: "Price" + defaultMessage: "Price", })} name={`${listing.id}-channel-price`} value={listing.price || ""} @@ -186,7 +186,7 @@ const ProductVariantPrice: React.FC = props => { onChange(listing.id, { costPrice: listing.costPrice, price: e.target.value, - preorderThreshold: listing.preorderThreshold + preorderThreshold: listing.preorderThreshold, }) } disabled={loading} @@ -207,7 +207,7 @@ const ProductVariantPrice: React.FC = props => { label={intl.formatMessage({ id: "KQSONM", defaultMessage: "Cost", - description: "tabel column header" + description: "tabel column header", })} name={`${listing.id}-channel-costPrice`} value={listing.costPrice || ""} @@ -216,7 +216,7 @@ const ProductVariantPrice: React.FC = props => { onChange(listing.id, { costPrice: e.target.value, price: listing.price, - preorderThreshold: listing.preorderThreshold + preorderThreshold: listing.preorderThreshold, }) } disabled={loading} @@ -242,7 +242,7 @@ const ProductVariantPrice: React.FC = props => { /> - ) + ), )} diff --git a/src/products/components/ProductVariantSetDefault/ProductVariantSetDefault.tsx b/src/products/components/ProductVariantSetDefault/ProductVariantSetDefault.tsx index 360c40276..5f8ff29fc 100644 --- a/src/products/components/ProductVariantSetDefault/ProductVariantSetDefault.tsx +++ b/src/products/components/ProductVariantSetDefault/ProductVariantSetDefault.tsx @@ -7,7 +7,7 @@ interface ProductVariantSetDefaultProps { } const ProductVariantSetDefault: React.FC = ({ - onSetDefaultVariant + onSetDefaultVariant, }) => { const intl = useIntl(); @@ -18,11 +18,11 @@ const ProductVariantSetDefault: React.FC = ({ label: intl.formatMessage({ id: "SZH0fw", defaultMessage: "Set as default", - description: "set variant as default, button" + description: "set variant as default, button", }), onSelect: onSetDefaultVariant, - testId: "setDefault" - } + testId: "setDefault", + }, ]} data-test-id="menu" /> diff --git a/src/products/components/ProductVariants/ProductVariants.tsx b/src/products/components/ProductVariants/ProductVariants.tsx index 6b911f2d7..3899ed2b5 100644 --- a/src/products/components/ProductVariants/ProductVariants.tsx +++ b/src/products/components/ProductVariants/ProductVariants.tsx @@ -3,7 +3,7 @@ import { CardContent, Hidden, TableCell, - Typography + Typography, } from "@material-ui/core"; import { fade } from "@material-ui/core/styles/colorManipulator"; import { Button } from "@saleor/components/Button"; @@ -17,19 +17,19 @@ import { SingleAutocompleteChoiceType } from "@saleor/components/SingleAutocompl import Skeleton from "@saleor/components/Skeleton"; import { SortableTableBody, - SortableTableRow + SortableTableRow, } from "@saleor/components/SortableTable"; import { TableButtonWrapper } from "@saleor/components/TableButtonWrapper/TableButtonWrapper"; import TableHead from "@saleor/components/TableHead"; import { ProductDetailsVariantFragment, ProductFragment, - RefreshLimitsQuery + RefreshLimitsQuery, } from "@saleor/graphql"; import { makeStyles } from "@saleor/macaw-ui"; import { productVariantAddUrl, - productVariantEditUrl + productVariantEditUrl, } from "@saleor/products/urls"; import { isLimitReached } from "@saleor/utils/limits"; import React from "react"; @@ -43,16 +43,16 @@ type Warehouse = ProductDetailsVariantFragment[][0]["stocks"][0]["warehouse"]; function getWarehouseChoices( variants: ProductDetailsVariantFragment[], - intl: IntlShape + intl: IntlShape, ): SingleAutocompleteChoiceType[] { return [ { label: intl.formatMessage({ id: "JtZ71e", defaultMessage: "All Warehouses", - description: "filtering option" + description: "filtering option", }), - value: null + value: null, }, ...variants .reduce( @@ -64,14 +64,14 @@ function getWarehouseChoices( } return [...variantStocks, stock.warehouse]; - }, []) + }, []), ], - [] + [], ) .map(w => ({ label: w.name, - value: w.id - })) + value: w.id, + })), ]; } @@ -79,68 +79,68 @@ const useStyles = makeStyles( theme => ({ [theme.breakpoints.up("lg")]: { colActions: { - width: 80 + width: 80, }, colInventory: { - width: 200 + width: 200, }, colName: {}, colPrice: { - width: 135 + width: 135, }, colSku: { - width: 200 - } + width: 200, + }, }, alert: { - margin: theme.spacing(3, 3, 0) + margin: theme.spacing(3, 3, 0), }, colGrab: { - width: 60 + width: 60, }, colInventory: { - textAlign: "right" + textAlign: "right", }, colName: { - paddingLeft: 0 + paddingLeft: 0, }, colPrice: { - textAlign: "right" + textAlign: "right", }, colSku: {}, colStatus: {}, defaultVariant: { color: fade(theme.palette.text.secondary, 0.6), - display: "block" + display: "block", }, link: { - cursor: "pointer" + cursor: "pointer", }, select: { - display: "inline-block" + display: "inline-block", }, textLeft: { - textAlign: "left" as "left" + textAlign: "left" as "left", }, textRight: { - textAlign: "right" as "right" + textAlign: "right" as "right", }, warehouseLabel: { display: "inline-block", - marginRight: theme.spacing() + marginRight: theme.spacing(), }, warehouseSelectContainer: { - paddingTop: theme.spacing(2) - } + paddingTop: theme.spacing(2), + }, }), - { name: "ProductVariants" } + { name: "ProductVariants" }, ); function getAvailabilityLabel( intl: IntlShape, warehouse: string, variant: ProductDetailsVariantFragment[][0], - numAvailable: number + numAvailable: number, ): string { if (variant.preorder) { if (variant.preorder.globalThreshold) { @@ -148,18 +148,18 @@ function getAvailabilityLabel( { id: "80FeaT", defaultMessage: "{globalThreshold} Global threshold", - description: "product variant preorder threshold" + description: "product variant preorder threshold", }, { - globalThreshold: variant.preorder.globalThreshold - } + globalThreshold: variant.preorder.globalThreshold, + }, ); } return intl.formatMessage({ id: "qbqMpk", defaultMessage: "In preorder", - description: "product variant preorder threshold" + description: "product variant preorder threshold", }); } @@ -173,24 +173,24 @@ function getAvailabilityLabel( id: "uVssds", defaultMessage: "{stockQuantity,plural,one{{stockQuantity} available} other{{stockQuantity} available}}", - description: "product variant inventory" + description: "product variant inventory", }, { - stockQuantity: variantStock.quantity - } + stockQuantity: variantStock.quantity, + }, ); } else { return intl.formatMessage({ id: "7mK2vs", defaultMessage: "Unavailable", - description: "product variant inventory" + description: "product variant inventory", }); } } else { return intl.formatMessage({ id: "9PmyrU", defaultMessage: "Not stocked", - description: "product variant inventory" + description: "product variant inventory", }); } } else { @@ -200,18 +200,18 @@ function getAvailabilityLabel( id: "wWYYBR", defaultMessage: "{numLocations,plural,one{{numAvailable} available at {numLocations} location} other{{numAvailable} available at {numLocations} locations}}", - description: "product variant inventory" + description: "product variant inventory", }, { numAvailable, - numLocations: variant.stocks.length - } + numLocations: variant.stocks.length, + }, ); } else { return intl.formatMessage({ id: "6+sMz4", defaultMessage: "Unavailable in all locations", - description: "product variant inventory" + description: "product variant inventory", }); } } @@ -245,7 +245,7 @@ export const ProductVariants: React.FC = props => { selectedChannelId, toggle, toggleAll, - toolbar + toolbar, } = props; const classes = useStyles(props); @@ -260,7 +260,7 @@ export const ProductVariants: React.FC = props => { title={intl.formatMessage({ id: "1kdQdO", defaultMessage: "Variants", - description: "section header" + description: "section header", })} toolbar={ hasVariants ? ( @@ -299,7 +299,7 @@ export const ProductVariants: React.FC = props => { title={intl.formatMessage({ id: "FwHWUm", defaultMessage: "SKU limit reached", - description: "alert" + description: "alert", })} > = props => { variant && variant.stocks ? variant.stocks.reduce( (acc, s) => acc + s.quantity - s.quantityAllocated, - 0 + 0, ) : null; const channel = variant.channelListings.find( - listing => listing.channel.id === selectedChannelId + listing => listing.channel.id === selectedChannelId, ); return ( @@ -425,7 +425,7 @@ export const ProductVariants: React.FC = props => { {intl.formatMessage({ id: "vZMs8f", defaultMessage: "Default", - description: "default product variant indicator" + description: "default product variant indicator", })} )} @@ -456,7 +456,7 @@ export const ProductVariants: React.FC = props => { intl, warehouse, variant, - numAvailable + numAvailable, ) )} diff --git a/src/products/fixtures.ts b/src/products/fixtures.ts index 0ffc53e3b..0b8694ea4 100644 --- a/src/products/fixtures.ts +++ b/src/products/fixtures.ts @@ -5,7 +5,7 @@ import { ProductMediaType, ProductVariantCreateDataQuery, ProductVariantFragment, - WeightUnitsEnum + WeightUnitsEnum, } from "@saleor/graphql"; import { RelayToFlat } from "@saleor/types"; import { warehouseList } from "@saleor/warehouses/fixtures"; @@ -15,7 +15,7 @@ import * as richTextEditorFixtures from "../components/RichTextEditor/fixtures.j const content = richTextEditorFixtures.richTextEditor; export const product: ( - placeholderImage: string + placeholderImage: string, ) => ProductFragment & ProductVariantCreateDataQuery["product"] = placeholderImage => ({ __typename: "Product" as "Product", @@ -38,7 +38,7 @@ export const product: ( hasNextPage: false, hasPreviousPage: false, startCursor: "WyIwIiwgIjQ5Il0=", - __typename: "PageInfo" + __typename: "PageInfo", }, edges: [ { @@ -55,8 +55,8 @@ export const product: ( boolean: null, date: null, dateTime: null, - value: null - } + value: null, + }, }, { __typename: "AttributeValueCountableEdge", @@ -72,11 +72,11 @@ export const product: ( boolean: null, date: null, dateTime: null, - value: null - } - } - ] - } + value: null, + }, + }, + ], + }, }, values: [ { @@ -90,9 +90,9 @@ export const product: ( boolean: null, date: null, dateTime: null, - value: null - } - ] + value: null, + }, + ], }, { __typename: "SelectedAttribute", @@ -112,7 +112,7 @@ export const product: ( hasNextPage: false, hasPreviousPage: false, startCursor: "WyIwIiwgIjQ5Il0=", - __typename: "PageInfo" + __typename: "PageInfo", }, edges: [ { @@ -129,8 +129,8 @@ export const product: ( boolean: null, date: null, dateTime: null, - value: null - } + value: null, + }, }, { __typename: "AttributeValueCountableEdge", @@ -146,8 +146,8 @@ export const product: ( boolean: null, date: null, dateTime: null, - value: null - } + value: null, + }, }, { __typename: "AttributeValueCountableEdge", @@ -163,8 +163,8 @@ export const product: ( boolean: null, date: null, dateTime: null, - value: null - } + value: null, + }, }, { __typename: "AttributeValueCountableEdge", @@ -180,11 +180,11 @@ export const product: ( boolean: null, date: null, dateTime: null, - value: null - } - } - ] - } + value: null, + }, + }, + ], + }, }, values: [ { @@ -198,16 +198,16 @@ export const product: ( boolean: null, date: null, dateTime: null, - value: null - } - ] - } + value: null, + }, + ], + }, ], availableForPurchase: null, category: { __typename: "Category", id: "Q2F0ZWdvcnk6MQ==", - name: "Apparel" + name: "Apparel", }, channelListings: [ { @@ -217,7 +217,7 @@ export const product: ( __typename: "Channel", currencyCode: "USD", id: "123", - name: "Channel1" + name: "Channel1", }, isAvailableForPurchase: false, isPublished: true, @@ -230,21 +230,21 @@ export const product: ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-14", - visibleInListings: true + visibleInListings: true, }, { __typename: "ProductChannelListing", @@ -253,7 +253,7 @@ export const product: ( __typename: "Channel", currencyCode: "USD", id: "124", - name: "Channel2" + name: "Channel2", }, isAvailableForPurchase: false, isPublished: false, @@ -266,30 +266,30 @@ export const product: ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-30", - visibleInListings: true - } + visibleInListings: true, + }, ], chargeTaxes: true, collections: [ { __typename: "Collection", id: "Q29sbGVjdGlvbjoy", - name: "Winter sale" - } + name: "Winter sale", + }, ], defaultVariant: { __typename: "ProductVariant", id: "pv75934" }, description: JSON.stringify(content), @@ -306,7 +306,7 @@ export const product: ( sortOrder: 0, type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage + url: placeholderImage, }, { __typename: "ProductMedia", @@ -315,7 +315,7 @@ export const product: ( sortOrder: 2, type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage + url: placeholderImage, }, { __typename: "ProductMedia", @@ -324,7 +324,7 @@ export const product: ( sortOrder: 1, type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage + url: placeholderImage, }, { __typename: "ProductMedia", @@ -333,7 +333,7 @@ export const product: ( sortOrder: 3, type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage + url: placeholderImage, }, { __typename: "ProductMedia", @@ -342,15 +342,15 @@ export const product: ( sortOrder: 4, type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage - } + url: placeholderImage, + }, ], metadata: [ { __typename: "MetadataItem", key: "integration.id", - value: "100023123" - } + value: "100023123", + }, ], name: "Ergonomic Plastic Bacon", privateMetadata: [], @@ -376,7 +376,7 @@ export const product: ( hasNextPage: false, hasPreviousPage: false, startCursor: "WyIwIiwgIjQ5Il0=", - __typename: "PageInfo" + __typename: "PageInfo", }, edges: [ { @@ -387,7 +387,7 @@ export const product: ( file: { __typename: "File", contentType: "image/png", - url: "some-non-existing-url" + url: "some-non-existing-url", }, id: "gdghdgdhkkdae", name: "File First Value", @@ -397,12 +397,12 @@ export const product: ( boolean: null, date: null, dateTime: null, - value: null - } - } - ] - } - } + value: null, + }, + }, + ], + }, + }, ], selectionVariantAttributes: [ { @@ -421,7 +421,7 @@ export const product: ( hasNextPage: false, hasPreviousPage: false, startCursor: "WyIwIiwgIjQ5Il0=", - __typename: "PageInfo" + __typename: "PageInfo", }, edges: [ { @@ -438,8 +438,8 @@ export const product: ( boolean: null, date: null, dateTime: null, - value: null - } + value: null, + }, }, { __typename: "AttributeValueCountableEdge", @@ -455,17 +455,17 @@ export const product: ( boolean: null, date: null, dateTime: null, - value: null - } - } - ] - } - } + value: null, + }, + }, + ], + }, + }, ], taxType: { __typename: "TaxType", description: "standard", - taxCode: "standard" + taxCode: "standard", }, variantAttributes: [ { @@ -482,7 +482,7 @@ export const product: ( hasNextPage: false, hasPreviousPage: false, startCursor: "WyIwIiwgIjQ5Il0=", - __typename: "PageInfo" + __typename: "PageInfo", }, edges: [ { @@ -493,7 +493,7 @@ export const product: ( file: { __typename: "File", contentType: "image/png", - url: "some-non-existing-url" + url: "some-non-existing-url", }, id: "gdghdgdhkkdae", name: "File First Value", @@ -503,11 +503,11 @@ export const product: ( boolean: null, date: null, dateTime: null, - value: null - } - } - ] - } + value: null, + }, + }, + ], + }, }, { __typename: "Attribute", @@ -523,7 +523,7 @@ export const product: ( hasNextPage: false, hasPreviousPage: false, startCursor: "WyIwIiwgIjQ5Il0=", - __typename: "PageInfo" + __typename: "PageInfo", }, edges: [ { @@ -540,8 +540,8 @@ export const product: ( boolean: null, date: null, dateTime: null, - value: null - } + value: null, + }, }, { __typename: "AttributeValueCountableEdge", @@ -557,13 +557,13 @@ export const product: ( boolean: null, date: null, dateTime: null, - value: null - } - } - ] - } - } - ] + value: null, + }, + }, + ], + }, + }, + ], }, publicationDate: "2018-08-25T18:45:54.125Z", purchaseCost: { @@ -572,14 +572,14 @@ export const product: ( __typename: "Money", amount: 339.39, currency: "NZD", - localized: "339.39 NZD" + localized: "339.39 NZD", }, stop: { __typename: "Money", amount: 678.78, currency: "NZD", - localized: "678.78 NZD" - } + localized: "678.78 NZD", + }, }, rating: 100, seoDescription: "Seo description", @@ -589,7 +589,7 @@ export const product: ( taxType: { __typename: "TaxType", description: "standard", - taxCode: "standard" + taxCode: "standard", }, thumbnail: { __typename: "Image" as "Image", url: placeholderImage }, url: "/example-url", @@ -606,15 +606,15 @@ export const product: ( id: "pi92837", type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage + url: placeholderImage, }, { __typename: "ProductMedia", id: "pi92838", type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage - } + url: placeholderImage, + }, ], name: "Cordoba Oro", sku: "87192-94370", @@ -624,23 +624,23 @@ export const product: ( id: "1", quantity: 1, quantityAllocated: 0, - warehouse: warehouseList[0] + warehouse: warehouseList[0], }, { __typename: "Stock", id: "2", quantity: 4, quantityAllocated: 2, - warehouse: warehouseList[1] - } + warehouse: warehouseList[1], + }, ], trackInventory: true, preorder: { __typename: "PreorderData", endDate: null, globalSoldUnits: null, - globalThreshold: 0 - } + globalThreshold: 0, + }, }, { __typename: "ProductVariant", @@ -652,23 +652,23 @@ export const product: ( __typename: "Channel", currencyCode: "USD", id: "123", - name: "Channel1" + name: "Channel1", }, costPrice: { __typename: "Money", amount: 10, - currency: "USD" + currency: "USD", }, price: { __typename: "Money", amount: 1, - currency: "USD" + currency: "USD", }, preorderThreshold: { __typename: "PreorderThreshold", quantity: 0, - soldUnits: 0 - } + soldUnits: 0, + }, }, { __typename: "ProductVariantChannelListing", @@ -676,24 +676,24 @@ export const product: ( __typename: "Channel", currencyCode: "USD", id: "124", - name: "Channel2" + name: "Channel2", }, costPrice: { __typename: "Money", amount: 10, - currency: "USD" + currency: "USD", }, price: { __typename: "Money", amount: 1, - currency: "USD" + currency: "USD", }, preorderThreshold: { __typename: "PreorderThreshold", quantity: 0, - soldUnits: 0 - } - } + soldUnits: 0, + }, + }, ], id: "pv68615", margin: 7, @@ -703,15 +703,15 @@ export const product: ( id: "pi81234", type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage + url: placeholderImage, }, { __typename: "ProductMedia", id: "pi1236912", type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage - } + url: placeholderImage, + }, ], name: "silver", sku: "69055-15190", @@ -721,27 +721,27 @@ export const product: ( id: "1", quantity: 13, quantityAllocated: 2, - warehouse: warehouseList[0] - } + warehouse: warehouseList[0], + }, ], trackInventory: false, preorder: { __typename: "PreorderData", endDate: null, globalSoldUnits: null, - globalThreshold: 0 - } - } + globalThreshold: 0, + }, + }, ], visibleInListings: true, weight: { __typename: "Weight", unit: WeightUnitsEnum.KG, - value: 5 - } + value: 5, + }, }); export const products = ( - placeholderImage: string + placeholderImage: string, ): RelayToFlat => [ { __typename: "Product", @@ -755,7 +755,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "123", - name: "Channel1" + name: "Channel1", }, isAvailableForPurchase: false, isPublished: true, @@ -768,21 +768,21 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-14", - visibleInListings: true + visibleInListings: true, }, { __typename: "ProductChannelListing", @@ -791,7 +791,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "124", - name: "Channel2" + name: "Channel2", }, isAvailableForPurchase: false, isPublished: false, @@ -804,22 +804,22 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-30", - visibleInListings: true - } + visibleInListings: true, + }, ], id: "UHJvZHVjdDo2MQ==", name: "Nebula Night Sky Paint", @@ -827,12 +827,12 @@ export const products = ( __typename: "ProductType", hasVariants: true, id: "UHJvZHVjdFR5cGU6Nw==", - name: "Paint" + name: "Paint", }, thumbnail: { __typename: "Image", - url: placeholderImage - } + url: placeholderImage, + }, }, { __typename: "Product", @@ -846,7 +846,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "123", - name: "Channel1" + name: "Channel1", }, isAvailableForPurchase: false, isPublished: true, @@ -859,21 +859,21 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-14", - visibleInListings: false + visibleInListings: false, }, { __typename: "ProductChannelListing", @@ -882,7 +882,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "124", - name: "Channel2" + name: "Channel2", }, isAvailableForPurchase: false, isPublished: false, @@ -895,22 +895,22 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-30", - visibleInListings: false - } + visibleInListings: false, + }, ], id: "UHJvZHVjdDo2NA==", name: "Light Speed Yellow Paint", @@ -918,12 +918,12 @@ export const products = ( __typename: "ProductType", hasVariants: true, id: "UHJvZHVjdFR5cGU6Nw==", - name: "Paint" + name: "Paint", }, thumbnail: { __typename: "Image", - url: placeholderImage - } + url: placeholderImage, + }, }, { __typename: "Product", @@ -937,7 +937,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "123", - name: "Channel1" + name: "Channel1", }, isAvailableForPurchase: false, isPublished: true, @@ -950,21 +950,21 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-14", - visibleInListings: false + visibleInListings: false, }, { __typename: "ProductChannelListing", @@ -973,7 +973,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "124", - name: "Channel2" + name: "Channel2", }, isAvailableForPurchase: false, isPublished: false, @@ -986,22 +986,22 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-30", - visibleInListings: false - } + visibleInListings: false, + }, ], id: "UHJvZHVjdDo2NQ==", name: "Hyperspace Turquoise Paint", @@ -1009,12 +1009,12 @@ export const products = ( __typename: "ProductType", hasVariants: true, id: "UHJvZHVjdFR5cGU6Nw==", - name: "Paint" + name: "Paint", }, thumbnail: { __typename: "Image", - url: placeholderImage - } + url: placeholderImage, + }, }, { __typename: "Product", @@ -1024,7 +1024,7 @@ export const products = ( __typename: "SelectedAttribute", attribute: { __typename: "Attribute", - id: "QXR0cmlidXRlOjE2" + id: "QXR0cmlidXRlOjE2", }, values: [ { @@ -1037,10 +1037,10 @@ export const products = ( boolean: null, date: null, dateTime: null, - value: null - } - ] - } + value: null, + }, + ], + }, ], channelListings: [ { @@ -1050,7 +1050,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "123", - name: "Channel1" + name: "Channel1", }, isAvailableForPurchase: false, isPublished: true, @@ -1063,21 +1063,21 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-14", - visibleInListings: false + visibleInListings: false, }, { __typename: "ProductChannelListing", @@ -1086,7 +1086,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "124", - name: "Channel2" + name: "Channel2", }, isAvailableForPurchase: false, isPublished: false, @@ -1099,22 +1099,22 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-30", - visibleInListings: false - } + visibleInListings: false, + }, ], id: "UHJvZHVjdDo3NQ==", name: "Pineapple Juice", @@ -1122,12 +1122,12 @@ export const products = ( __typename: "ProductType", hasVariants: true, id: "UHJvZHVjdFR5cGU6OQ==", - name: "Juice" + name: "Juice", }, thumbnail: { __typename: "Image", - url: placeholderImage - } + url: placeholderImage, + }, }, { __typename: "Product", @@ -1137,7 +1137,7 @@ export const products = ( __typename: "SelectedAttribute", attribute: { __typename: "Attribute", - id: "QXR0cmlidXRlOjE2" + id: "QXR0cmlidXRlOjE2", }, values: [ { @@ -1150,10 +1150,10 @@ export const products = ( boolean: null, date: null, dateTime: null, - value: null - } - ] - } + value: null, + }, + ], + }, ], channelListings: [ { @@ -1163,7 +1163,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "123", - name: "Channel1" + name: "Channel1", }, isAvailableForPurchase: false, isPublished: true, @@ -1176,21 +1176,21 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-14", - visibleInListings: false + visibleInListings: false, }, { __typename: "ProductChannelListing", @@ -1199,7 +1199,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "124", - name: "Channel2" + name: "Channel2", }, isAvailableForPurchase: false, isPublished: false, @@ -1212,22 +1212,22 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-30", - visibleInListings: false - } + visibleInListings: false, + }, ], id: "UHJvZHVjdDo3Ng==", name: "Coconut Juice", @@ -1235,12 +1235,12 @@ export const products = ( __typename: "ProductType", hasVariants: true, id: "UHJvZHVjdFR5cGU6OQ==", - name: "Juice" + name: "Juice", }, thumbnail: { __typename: "Image", - url: placeholderImage - } + url: placeholderImage, + }, }, { __typename: "Product", @@ -1250,7 +1250,7 @@ export const products = ( __typename: "SelectedAttribute", attribute: { __typename: "Attribute", - id: "QXR0cmlidXRlOjE2" + id: "QXR0cmlidXRlOjE2", }, values: [ { @@ -1263,10 +1263,10 @@ export const products = ( boolean: null, date: null, dateTime: null, - value: null - } - ] - } + value: null, + }, + ], + }, ], channelListings: [ { @@ -1276,7 +1276,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "123", - name: "Channel1" + name: "Channel1", }, isAvailableForPurchase: false, isPublished: true, @@ -1289,21 +1289,21 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-14", - visibleInListings: false + visibleInListings: false, }, { @@ -1313,7 +1313,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "124", - name: "Channel2" + name: "Channel2", }, isAvailableForPurchase: false, isPublished: false, @@ -1326,22 +1326,22 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-30", - visibleInListings: false - } + visibleInListings: false, + }, ], id: "UHJvZHVjdDo3Mg==", name: "Apple Juice", @@ -1349,12 +1349,12 @@ export const products = ( __typename: "ProductType", hasVariants: true, id: "UHJvZHVjdFR5cGU6OQ==", - name: "Juice" + name: "Juice", }, thumbnail: { __typename: "Image", - url: placeholderImage - } + url: placeholderImage, + }, }, { __typename: "Product", @@ -1364,7 +1364,7 @@ export const products = ( __typename: "SelectedAttribute", attribute: { __typename: "Attribute", - id: "QXR0cmlidXRlOjE2" + id: "QXR0cmlidXRlOjE2", }, values: [ { @@ -1377,10 +1377,10 @@ export const products = ( boolean: null, date: null, dateTime: null, - value: null - } - ] - } + value: null, + }, + ], + }, ], channelListings: [ { @@ -1390,7 +1390,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "123", - name: "Channel1" + name: "Channel1", }, isAvailableForPurchase: false, isPublished: true, @@ -1403,21 +1403,21 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-14", - visibleInListings: false + visibleInListings: false, }, { __typename: "ProductChannelListing", @@ -1426,7 +1426,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "124", - name: "Channel2" + name: "Channel2", }, isAvailableForPurchase: false, isPublished: false, @@ -1439,22 +1439,22 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-30", - visibleInListings: false - } + visibleInListings: false, + }, ], id: "UHJvZHVjdDo3MQ==", name: "Orange Juice", @@ -1462,12 +1462,12 @@ export const products = ( __typename: "ProductType", hasVariants: true, id: "UHJvZHVjdFR5cGU6OQ==", - name: "Juice" + name: "Juice", }, thumbnail: { __typename: "Image", - url: placeholderImage - } + url: placeholderImage, + }, }, { __typename: "Product", @@ -1477,7 +1477,7 @@ export const products = ( __typename: "SelectedAttribute", attribute: { __typename: "Attribute", - id: "QXR0cmlidXRlOjE2" + id: "QXR0cmlidXRlOjE2", }, values: [ { @@ -1490,10 +1490,10 @@ export const products = ( boolean: null, date: null, dateTime: null, - value: null - } - ] - } + value: null, + }, + ], + }, ], channelListings: [ { @@ -1503,7 +1503,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "123", - name: "Channel1" + name: "Channel1", }, isAvailableForPurchase: false, isPublished: true, @@ -1516,21 +1516,21 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-14", - visibleInListings: false + visibleInListings: false, }, { __typename: "ProductChannelListing", @@ -1539,7 +1539,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "124", - name: "Channel2" + name: "Channel2", }, isAvailableForPurchase: false, isPublished: false, @@ -1552,22 +1552,22 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-30", - visibleInListings: false - } + visibleInListings: false, + }, ], id: "UHJvZHVjdDo3NA==", name: "Banana Juice", @@ -1575,12 +1575,12 @@ export const products = ( __typename: "ProductType", hasVariants: true, id: "UHJvZHVjdFR5cGU6OQ==", - name: "Juice" + name: "Juice", }, thumbnail: { __typename: "Image", - url: placeholderImage - } + url: placeholderImage, + }, }, { __typename: "Product", @@ -1590,7 +1590,7 @@ export const products = ( __typename: "SelectedAttribute", attribute: { __typename: "Attribute", - id: "QXR0cmlidXRlOjE2" + id: "QXR0cmlidXRlOjE2", }, values: [ { @@ -1603,10 +1603,10 @@ export const products = ( boolean: null, date: null, dateTime: null, - value: null - } - ] - } + value: null, + }, + ], + }, ], channelListings: [ { @@ -1616,7 +1616,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "123", - name: "Channel1" + name: "Channel1", }, isAvailableForPurchase: false, isPublished: true, @@ -1629,21 +1629,21 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-14", - visibleInListings: true + visibleInListings: true, }, { __typename: "ProductChannelListing", @@ -1652,7 +1652,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "124", - name: "Channel2" + name: "Channel2", }, isAvailableForPurchase: false, isPublished: false, @@ -1665,22 +1665,22 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-30", - visibleInListings: true - } + visibleInListings: true, + }, ], id: "UHJvZHVjdDo3OQ==", name: "Bean Juice", @@ -1688,12 +1688,12 @@ export const products = ( __typename: "ProductType", hasVariants: true, id: "UHJvZHVjdFR5cGU6OQ==", - name: "Juice" + name: "Juice", }, thumbnail: { __typename: "Image", - url: placeholderImage - } + url: placeholderImage, + }, }, { __typename: "Product", @@ -1703,7 +1703,7 @@ export const products = ( __typename: "SelectedAttribute", attribute: { __typename: "Attribute", - id: "QXR0cmlidXRlOjE2" + id: "QXR0cmlidXRlOjE2", }, values: [ { @@ -1716,10 +1716,10 @@ export const products = ( boolean: null, date: null, dateTime: null, - value: null - } - ] - } + value: null, + }, + ], + }, ], channelListings: [ { @@ -1729,7 +1729,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "123", - name: "Channel1" + name: "Channel1", }, isAvailableForPurchase: false, isPublished: true, @@ -1742,21 +1742,21 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-14", - visibleInListings: false + visibleInListings: false, }, { __typename: "ProductChannelListing", @@ -1765,7 +1765,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "124", - name: "Channel2" + name: "Channel2", }, isAvailableForPurchase: false, isPublished: false, @@ -1778,22 +1778,22 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-30", - visibleInListings: false - } + visibleInListings: false, + }, ], id: "UHJvZHVjdDo3Mw==", name: "Carrot Juice", @@ -1801,12 +1801,12 @@ export const products = ( __typename: "ProductType", hasVariants: true, id: "UHJvZHVjdFR5cGU6OQ==", - name: "Juice" + name: "Juice", }, thumbnail: { __typename: "Image", - url: placeholderImage - } + url: placeholderImage, + }, }, { __typename: "Product", @@ -1816,7 +1816,7 @@ export const products = ( __typename: "SelectedAttribute", attribute: { __typename: "Attribute", - id: "QXR0cmlidXRlOjE2" + id: "QXR0cmlidXRlOjE2", }, values: [ { @@ -1829,10 +1829,10 @@ export const products = ( boolean: null, date: null, dateTime: null, - value: null - } - ] - } + value: null, + }, + ], + }, ], channelListings: [ { @@ -1842,7 +1842,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "123", - name: "Channel1" + name: "Channel1", }, isAvailableForPurchase: false, isPublished: true, @@ -1855,21 +1855,21 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-14", - visibleInListings: true + visibleInListings: true, }, { __typename: "ProductChannelListing", @@ -1878,7 +1878,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "124", - name: "Channel2" + name: "Channel2", }, isAvailableForPurchase: false, isPublished: false, @@ -1891,22 +1891,22 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-30", - visibleInListings: true - } + visibleInListings: true, + }, ], id: "UHJvZHVjdDo3OA==", name: "Green Juice", @@ -1914,12 +1914,12 @@ export const products = ( __typename: "ProductType", hasVariants: true, id: "UHJvZHVjdFR5cGU6OQ==", - name: "Juice" + name: "Juice", }, thumbnail: { __typename: "Image", - url: placeholderImage - } + url: placeholderImage, + }, }, { __typename: "Product", @@ -1929,7 +1929,7 @@ export const products = ( __typename: "SelectedAttribute", attribute: { __typename: "Attribute", - id: "QXR0cmlidXRlOjI1" + id: "QXR0cmlidXRlOjI1", }, values: [ { @@ -1942,10 +1942,10 @@ export const products = ( boolean: null, date: null, dateTime: null, - value: null - } - ] - } + value: null, + }, + ], + }, ], channelListings: [ { @@ -1955,7 +1955,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "123", - name: "Channel1" + name: "Channel1", }, isAvailableForPurchase: false, isPublished: true, @@ -1968,21 +1968,21 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-14", - visibleInListings: true + visibleInListings: true, }, { __typename: "ProductChannelListing", @@ -1991,7 +1991,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "124", - name: "Channel2" + name: "Channel2", }, isAvailableForPurchase: false, isPublished: false, @@ -2004,22 +2004,22 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-30", - visibleInListings: true - } + visibleInListings: true, + }, ], id: "UHJvZHVjdDo4OQ==", name: "Code Division T-shirt", @@ -2027,12 +2027,12 @@ export const products = ( __typename: "ProductType", hasVariants: true, id: "UHJvZHVjdFR5cGU6MTQ=", - name: "Top (clothing)" + name: "Top (clothing)", }, thumbnail: { __typename: "Image", - url: placeholderImage - } + url: placeholderImage, + }, }, { __typename: "Product", @@ -2042,7 +2042,7 @@ export const products = ( __typename: "SelectedAttribute", attribute: { __typename: "Attribute", - id: "QXR0cmlidXRlOjI1" + id: "QXR0cmlidXRlOjI1", }, values: [ { @@ -2055,10 +2055,10 @@ export const products = ( boolean: null, date: null, dateTime: null, - value: null - } - ] - } + value: null, + }, + ], + }, ], channelListings: [ { @@ -2068,7 +2068,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "123", - name: "Channel1" + name: "Channel1", }, isAvailableForPurchase: false, isPublished: true, @@ -2081,21 +2081,21 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-14", - visibleInListings: true + visibleInListings: true, }, { __typename: "ProductChannelListing", @@ -2104,7 +2104,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "124", - name: "Channel2" + name: "Channel2", }, isAvailableForPurchase: false, isPublished: false, @@ -2117,22 +2117,22 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-30", - visibleInListings: true - } + visibleInListings: true, + }, ], id: "UHJvZHVjdDoxMDc=", name: "Polo Shirt", @@ -2140,12 +2140,12 @@ export const products = ( __typename: "ProductType", hasVariants: true, id: "UHJvZHVjdFR5cGU6MTQ=", - name: "Top (clothing)" + name: "Top (clothing)", }, thumbnail: { __typename: "Image", - url: placeholderImage - } + url: placeholderImage, + }, }, { __typename: "Product", @@ -2155,7 +2155,7 @@ export const products = ( __typename: "SelectedAttribute", attribute: { __typename: "Attribute", - id: "QXR0cmlidXRlOjI1" + id: "QXR0cmlidXRlOjI1", }, values: [ { @@ -2168,10 +2168,10 @@ export const products = ( boolean: null, date: null, dateTime: null, - value: null - } - ] - } + value: null, + }, + ], + }, ], channelListings: [ { @@ -2181,7 +2181,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "123", - name: "Channel1" + name: "Channel1", }, isAvailableForPurchase: false, isPublished: true, @@ -2194,21 +2194,21 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-14", - visibleInListings: false + visibleInListings: false, }, { __typename: "ProductChannelListing", @@ -2217,7 +2217,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "124", - name: "Channel2" + name: "Channel2", }, isAvailableForPurchase: false, isPublished: false, @@ -2230,22 +2230,22 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-30", - visibleInListings: false - } + visibleInListings: false, + }, ], id: "UHJvZHVjdDoxMDg=", name: "Polo Shirt", @@ -2253,12 +2253,12 @@ export const products = ( __typename: "ProductType", hasVariants: true, id: "UHJvZHVjdFR5cGU6MTQ=", - name: "Top (clothing)" + name: "Top (clothing)", }, thumbnail: { __typename: "Image", - url: placeholderImage - } + url: placeholderImage, + }, }, { __typename: "Product", @@ -2268,7 +2268,7 @@ export const products = ( __typename: "SelectedAttribute", attribute: { __typename: "Attribute", - id: "QXR0cmlidXRlOjI1" + id: "QXR0cmlidXRlOjI1", }, values: [ { @@ -2281,10 +2281,10 @@ export const products = ( boolean: null, date: null, dateTime: null, - value: null - } - ] - } + value: null, + }, + ], + }, ], channelListings: [ { @@ -2294,7 +2294,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "123", - name: "Channel1" + name: "Channel1", }, isAvailableForPurchase: false, isPublished: true, @@ -2307,21 +2307,21 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-14", - visibleInListings: false + visibleInListings: false, }, { __typename: "ProductChannelListing", @@ -2330,7 +2330,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "124", - name: "Channel2" + name: "Channel2", }, isAvailableForPurchase: false, isPublished: false, @@ -2343,22 +2343,22 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-30", - visibleInListings: false - } + visibleInListings: false, + }, ], id: "UHJvZHVjdDoxMDk=", name: "Polo Shirt", @@ -2366,12 +2366,12 @@ export const products = ( __typename: "ProductType", hasVariants: true, id: "UHJvZHVjdFR5cGU6MTQ=", - name: "Top (clothing)" + name: "Top (clothing)", }, thumbnail: { __typename: "Image", - url: placeholderImage - } + url: placeholderImage, + }, }, { __typename: "Product", @@ -2381,7 +2381,7 @@ export const products = ( __typename: "SelectedAttribute", attribute: { __typename: "Attribute", - id: "QXR0cmlidXRlOjI1" + id: "QXR0cmlidXRlOjI1", }, values: [ { @@ -2394,10 +2394,10 @@ export const products = ( boolean: null, date: null, dateTime: null, - value: null - } - ] - } + value: null, + }, + ], + }, ], channelListings: [ { @@ -2407,7 +2407,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "123", - name: "Channel1" + name: "Channel1", }, isAvailableForPurchase: false, isPublished: true, @@ -2420,21 +2420,21 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-14", - visibleInListings: true + visibleInListings: true, }, { __typename: "ProductChannelListing", @@ -2443,7 +2443,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "124", - name: "Channel2" + name: "Channel2", }, isAvailableForPurchase: false, isPublished: false, @@ -2456,22 +2456,22 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-30", - visibleInListings: true - } + visibleInListings: true, + }, ], id: "UHJvZHVjdDoxMTA=", name: "Polo Shirt", @@ -2479,12 +2479,12 @@ export const products = ( __typename: "ProductType", hasVariants: true, id: "UHJvZHVjdFR5cGU6MTQ=", - name: "Top (clothing)" + name: "Top (clothing)", }, thumbnail: { __typename: "Image", - url: placeholderImage - } + url: placeholderImage, + }, }, { __typename: "Product", @@ -2494,7 +2494,7 @@ export const products = ( __typename: "SelectedAttribute", attribute: { __typename: "Attribute", - id: "QXR0cmlidXRlOjI1" + id: "QXR0cmlidXRlOjI1", }, values: [ { @@ -2507,10 +2507,10 @@ export const products = ( boolean: null, date: null, dateTime: null, - value: null - } - ] - } + value: null, + }, + ], + }, ], channelListings: [ { @@ -2520,7 +2520,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "123", - name: "Channel1" + name: "Channel1", }, isAvailableForPurchase: false, isPublished: true, @@ -2533,21 +2533,21 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-14", - visibleInListings: false + visibleInListings: false, }, { __typename: "ProductChannelListing", @@ -2556,7 +2556,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "124", - name: "Channel2" + name: "Channel2", }, isAvailableForPurchase: false, isPublished: false, @@ -2569,22 +2569,22 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-30", - visibleInListings: false - } + visibleInListings: false, + }, ], id: "UHJvZHVjdDoxMTU=", name: "Black Hoodie", @@ -2592,12 +2592,12 @@ export const products = ( __typename: "ProductType", hasVariants: true, id: "UHJvZHVjdFR5cGU6MTQ=", - name: "Top (clothing)" + name: "Top (clothing)", }, thumbnail: { __typename: "Image", - url: placeholderImage - } + url: placeholderImage, + }, }, { __typename: "Product", @@ -2607,7 +2607,7 @@ export const products = ( __typename: "SelectedAttribute", attribute: { __typename: "Attribute", - id: "QXR0cmlidXRlOjI1" + id: "QXR0cmlidXRlOjI1", }, values: [ { @@ -2620,10 +2620,10 @@ export const products = ( boolean: null, date: null, dateTime: null, - value: null - } - ] - } + value: null, + }, + ], + }, ], channelListings: [ { @@ -2633,7 +2633,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "123", - name: "Channel1" + name: "Channel1", }, isAvailableForPurchase: false, isPublished: true, @@ -2646,21 +2646,21 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-14", - visibleInListings: true + visibleInListings: true, }, { __typename: "ProductChannelListing", @@ -2669,7 +2669,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "124", - name: "Channel2" + name: "Channel2", }, isAvailableForPurchase: false, isPublished: false, @@ -2682,22 +2682,22 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-30", - visibleInListings: true - } + visibleInListings: true, + }, ], id: "UHJvZHVjdDoxMTY=", name: "Blue Hoodie", @@ -2705,12 +2705,12 @@ export const products = ( __typename: "ProductType", hasVariants: true, id: "UHJvZHVjdFR5cGU6MTQ=", - name: "Top (clothing)" + name: "Top (clothing)", }, thumbnail: { __typename: "Image", - url: placeholderImage - } + url: placeholderImage, + }, }, { __typename: "Product", @@ -2720,7 +2720,7 @@ export const products = ( __typename: "SelectedAttribute", attribute: { __typename: "Attribute", - id: "QXR0cmlidXRlOjI1" + id: "QXR0cmlidXRlOjI1", }, values: [ { @@ -2733,10 +2733,10 @@ export const products = ( boolean: null, date: null, dateTime: null, - value: null - } - ] - } + value: null, + }, + ], + }, ], channelListings: [ { @@ -2746,7 +2746,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "123", - name: "Channel1" + name: "Channel1", }, isAvailableForPurchase: false, isPublished: true, @@ -2759,21 +2759,21 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-14", - visibleInListings: true + visibleInListings: true, }, { __typename: "ProductChannelListing", @@ -2782,7 +2782,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "124", - name: "Channel2" + name: "Channel2", }, isAvailableForPurchase: false, isPublished: false, @@ -2795,22 +2795,22 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-30", - visibleInListings: true - } + visibleInListings: true, + }, ], id: "UHJvZHVjdDoxMTc=", name: "Mustard Hoodie", @@ -2818,12 +2818,12 @@ export const products = ( __typename: "ProductType", hasVariants: true, id: "UHJvZHVjdFR5cGU6MTQ=", - name: "Top (clothing)" + name: "Top (clothing)", }, thumbnail: { __typename: "Image", - url: placeholderImage - } + url: placeholderImage, + }, }, { __typename: "Product", @@ -2833,7 +2833,7 @@ export const products = ( __typename: "SelectedAttribute", attribute: { __typename: "Attribute", - id: "QXR0cmlidXRlOjIz" + id: "QXR0cmlidXRlOjIz", }, values: [ { @@ -2846,10 +2846,10 @@ export const products = ( boolean: null, date: null, dateTime: null, - value: null - } - ] - } + value: null, + }, + ], + }, ], channelListings: [ { @@ -2859,7 +2859,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "123", - name: "Channel1" + name: "Channel1", }, isAvailableForPurchase: false, isPublished: true, @@ -2872,21 +2872,21 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-14", - visibleInListings: true + visibleInListings: true, }, { __typename: "ProductChannelListing", @@ -2895,7 +2895,7 @@ export const products = ( __typename: "Channel", currencyCode: "USD", id: "124", - name: "Channel2" + name: "Channel2", }, isAvailableForPurchase: false, isPublished: false, @@ -2908,22 +2908,22 @@ export const products = ( net: { __typename: "Money", amount: 1.2, - currency: "USD" - } + currency: "USD", + }, }, stop: { __typename: "TaxedMoney", net: { __typename: "Money", amount: 3.5, - currency: "USD" - } - } - } + currency: "USD", + }, + }, + }, }, publicationDate: "2020-07-30", - visibleInListings: true - } + visibleInListings: true, + }, ], id: "UHJvZHVjdDo4NQ==", name: "Colored Parrot Cushion", @@ -2931,13 +2931,13 @@ export const products = ( __typename: "ProductType", hasVariants: true, id: "UHJvZHVjdFR5cGU6MTI=", - name: "Cushion" + name: "Cushion", }, thumbnail: { __typename: "Image", - url: placeholderImage - } - } + url: placeholderImage, + }, + }, ]; export const variant = (placeholderImage: string): ProductVariantFragment => ({ @@ -2949,23 +2949,23 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ __typename: "Channel", currencyCode: "USD", id: "test1", - name: "Test channel" + name: "Test channel", }, costPrice: { __typename: "Money", amount: 10, - currency: "USD" + currency: "USD", }, price: { __typename: "Money", amount: 10, - currency: "USD" + currency: "USD", }, preorderThreshold: { __typename: "PreorderThreshold", quantity: 0, - soldUnits: 0 - } + soldUnits: 0, + }, }, { __typename: "ProductVariantChannelListing", @@ -2973,24 +2973,24 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ __typename: "Channel", currencyCode: "USD", id: "test2", - name: "Test channel other" + name: "Test channel other", }, costPrice: { __typename: "Money", amount: 10, - currency: "USD" + currency: "USD", }, price: { __typename: "Money", amount: 20, - currency: "USD" + currency: "USD", }, preorderThreshold: { __typename: "PreorderThreshold", quantity: 0, - soldUnits: 0 - } - } + soldUnits: 0, + }, + }, ], id: "var1", quantityLimitPerCustomer: 300, @@ -3000,36 +3000,36 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ id: "img1", type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage + url: placeholderImage, }, { __typename: "ProductMedia", id: "img2", type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage + url: placeholderImage, }, { __typename: "ProductMedia", id: "img7", type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage + url: placeholderImage, }, { __typename: "ProductMedia", id: "img8", type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage - } + url: placeholderImage, + }, ], metadata: [ { __typename: "MetadataItem", key: "integration.id", - value: "100023123" - } + value: "100023123", + }, ], name: "Extended Hard", nonSelectionAttributes: [ @@ -3051,7 +3051,7 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ hasNextPage: false, hasPreviousPage: false, startCursor: "WyIwIiwgIjQ5Il0=", - __typename: "PageInfo" + __typename: "PageInfo", }, edges: [ { @@ -3062,7 +3062,7 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ file: { __typename: "File", contentType: "image/png", - url: "some-non-existing-url" + url: "some-non-existing-url", }, id: "gdghdgdhkkdae", name: "File First Value", @@ -3072,11 +3072,11 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ boolean: null, date: null, dateTime: null, - value: null - } - } - ] - } + value: null, + }, + }, + ], + }, }, values: [ { @@ -3084,7 +3084,7 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ file: { __typename: "File", contentType: "image/png", - url: "some-non-existing-url" + url: "some-non-existing-url", }, id: "gdghdgdhkkdae", name: "File First Value", @@ -3094,10 +3094,10 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ boolean: null, date: null, dateTime: null, - value: null - } - ] - } + value: null, + }, + ], + }, ], privateMetadata: [], product: { @@ -3111,8 +3111,8 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ __typename: "Channel", currencyCode: "USD", id: "test1", - name: "Test channel" - } + name: "Test channel", + }, }, { __typename: "ProductChannelListing", @@ -3122,13 +3122,13 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ __typename: "Channel", currencyCode: "USD", id: "test2", - name: "Test channel other" - } - } + name: "Test channel other", + }, + }, ], defaultVariant: { __typename: "ProductVariant", - id: "var1" + id: "var1", }, id: "prod1", media: [ @@ -3139,7 +3139,7 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ sortOrder: 1, type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage + url: placeholderImage, }, { __typename: "ProductMedia", @@ -3148,7 +3148,7 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ sortOrder: 4, type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage + url: placeholderImage, }, { __typename: "ProductMedia", @@ -3157,7 +3157,7 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ sortOrder: 2, type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage + url: placeholderImage, }, { __typename: "ProductMedia", @@ -3166,7 +3166,7 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ sortOrder: 3, type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage + url: placeholderImage, }, { __typename: "ProductMedia", @@ -3175,7 +3175,7 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ sortOrder: 0, type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage + url: placeholderImage, }, { __typename: "ProductMedia", @@ -3184,7 +3184,7 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ sortOrder: 1, type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage + url: placeholderImage, }, { __typename: "ProductMedia", @@ -3193,7 +3193,7 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ sortOrder: 0, type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage + url: placeholderImage, }, { __typename: "ProductMedia", @@ -3202,7 +3202,7 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ sortOrder: 2, type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage + url: placeholderImage, }, { __typename: "ProductMedia", @@ -3211,8 +3211,8 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ sortOrder: 2, type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage - } + url: placeholderImage, + }, ], name: "Our Awesome Book", thumbnail: { __typename: "Image" as "Image", url: placeholderImage }, @@ -3226,11 +3226,11 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ id: "23123", type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage - } + url: placeholderImage, + }, ], name: "Extended Hard", - sku: "13-1337" + sku: "13-1337", }, { __typename: "ProductVariant", @@ -3241,11 +3241,11 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ id: "23123", type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage - } + url: placeholderImage, + }, ], name: "Extended Soft", - sku: "13-1338" + sku: "13-1338", }, { __typename: "ProductVariant", @@ -3256,11 +3256,11 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ id: "23123", type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage - } + url: placeholderImage, + }, ], name: "Normal Hard", - sku: "13-1339" + sku: "13-1339", }, { __typename: "ProductVariant", @@ -3271,13 +3271,13 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ id: "23123", type: ProductMediaType.IMAGE, oembedData: "{}", - url: placeholderImage - } + url: placeholderImage, + }, ], name: "Normal Soft", - sku: "13-1340" - } - ] + sku: "13-1340", + }, + ], }, selectionAttributes: [ { @@ -3298,7 +3298,7 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ hasNextPage: false, hasPreviousPage: false, startCursor: "WyIwIiwgIjQ5Il0=", - __typename: "PageInfo" + __typename: "PageInfo", }, edges: [ { @@ -3315,8 +3315,8 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ boolean: null, date: null, dateTime: null, - value: null - } + value: null, + }, }, { __typename: "AttributeValueCountableEdge", @@ -3332,11 +3332,11 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ boolean: null, date: null, dateTime: null, - value: null - } - } - ] - } + value: null, + }, + }, + ], + }, }, values: [ { @@ -3350,9 +3350,9 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ boolean: null, date: null, dateTime: null, - value: null - } - ] + value: null, + }, + ], }, { __typename: "SelectedAttribute", @@ -3372,7 +3372,7 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ hasNextPage: false, hasPreviousPage: false, startCursor: "WyIwIiwgIjQ5Il0=", - __typename: "PageInfo" + __typename: "PageInfo", }, edges: [ { @@ -3389,8 +3389,8 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ boolean: null, date: null, dateTime: null, - value: null - } + value: null, + }, }, { __typename: "AttributeValueCountableEdge", @@ -3406,8 +3406,8 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ boolean: null, date: null, dateTime: null, - value: null - } + value: null, + }, }, { __typename: "AttributeValueCountableEdge", @@ -3423,8 +3423,8 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ boolean: null, date: null, dateTime: null, - value: null - } + value: null, + }, }, { __typename: "AttributeValueCountableEdge", @@ -3440,11 +3440,11 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ boolean: null, date: null, dateTime: null, - value: null - } - } - ] - } + value: null, + }, + }, + ], + }, }, values: [ { @@ -3458,10 +3458,10 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ boolean: null, date: null, dateTime: null, - value: null - } - ] - } + value: null, + }, + ], + }, ], sku: "1230959124123", stocks: [ @@ -3473,8 +3473,8 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ warehouse: { __typename: "Warehouse", id: "123", - name: "Warehouse 1" - } + name: "Warehouse 1", + }, }, { __typename: "Stock", @@ -3484,22 +3484,22 @@ export const variant = (placeholderImage: string): ProductVariantFragment => ({ warehouse: { __typename: "Warehouse", id: "1234", - name: "Warehouse 2" - } - } + name: "Warehouse 2", + }, + }, ], trackInventory: true, preorder: { __typename: "PreorderData", endDate: null, globalSoldUnits: null, - globalThreshold: 0 + globalThreshold: 0, }, weight: { __typename: "Weight", unit: WeightUnitsEnum.KG, - value: 6 - } + value: 6, + }, }); export const variantMedia = (placeholderImage: string) => variant(placeholderImage).media; diff --git a/src/products/index.tsx b/src/products/index.tsx index 8a5f06ae4..041b8b519 100644 --- a/src/products/index.tsx +++ b/src/products/index.tsx @@ -21,7 +21,7 @@ import { ProductVariantAddUrlQueryParams, productVariantCreatorPath, productVariantEditPath, - ProductVariantEditUrlQueryParams + ProductVariantEditUrlQueryParams, } from "./urls"; import ProductCreateComponent from "./views/ProductCreate"; import ProductImageComponent from "./views/ProductImage"; @@ -40,9 +40,9 @@ const ProductList: React.FC> = ({ location }) => { collections: getArrayQueryParam(qs.collections), ids: getArrayQueryParam(qs.ids), productTypes: getArrayQueryParam(qs.productTypes), - productKind: qs.productKind + productKind: qs.productKind, }, - ProductListUrlSortField + ProductListUrlSortField, ); return ; @@ -57,7 +57,7 @@ const ProductUpdate: React.FC> = ({ match }) => { id={decodeURIComponent(match.params.id)} params={{ ...params, - ids: getArrayQueryParam(qs.ids) + ids: getArrayQueryParam(qs.ids), }} /> ); @@ -85,7 +85,7 @@ const ProductVariant: React.FC> = ({ match }) => { const ProductImage: React.FC> = ({ location, - match + match, }) => { const qs = parseQs(location.search.substr(1)); const params: ProductImageUrlQueryParams = qs; @@ -100,7 +100,7 @@ const ProductImage: React.FC> = ({ }; const ProductVariantCreate: React.FC> = ({ - match + match, }) => { const qs = parseQs(location.search.substr(1)); const params: ProductVariantAddUrlQueryParams = qs; diff --git a/src/products/urls.ts b/src/products/urls.ts index 142dceeac..09b3c477d 100644 --- a/src/products/urls.ts +++ b/src/products/urls.ts @@ -12,7 +12,7 @@ import { Pagination, SingleAction, Sort, - TabActionDialog + TabActionDialog, } from "../types"; import { stringifyQs } from "../utils/urls"; @@ -31,18 +31,18 @@ export enum ProductListUrlFiltersEnum { stockStatus = "stockStatus", query = "query", channel = "channel", - productKind = "productKind" + productKind = "productKind", } export enum ProductListUrlFiltersWithMultipleValues { categories = "categories", collections = "collections", - productTypes = "productTypes" + productTypes = "productTypes", } export enum ProductListUrlFiltersAsDictWithMultipleValues { - attributes = "attributes" + attributes = "attributes", } export enum ProductListUrlFiltersWithKeyValueValues { - metadata = "metadata" + metadata = "metadata", } export type ProductListUrlFilters = Filters & FiltersWithMultipleValues & @@ -57,7 +57,7 @@ export enum ProductListUrlSortField { status = "status", price = "price", rank = "rank", - date = "date" + date = "date", } export type ProductListUrlSort = Sort; export interface ProductListUrlQueryParams @@ -98,11 +98,11 @@ export type ProductVariantEditUrlQueryParams = Dialog< export const productVariantEditUrl = ( productId: string, variantId: string, - params?: ProductVariantEditUrlQueryParams + params?: ProductVariantEditUrlQueryParams, ) => productVariantEditPath( encodeURIComponent(productId), - encodeURIComponent(variantId) + encodeURIComponent(variantId), ) + "?" + stringifyQs(params); @@ -121,7 +121,7 @@ export const productVariantAddPath = (productId: string) => urlJoin(productSection, productId, "variant/add"); export const productVariantAddUrl = ( productId: string, - params?: ProductVariantAddUrlQueryParams + params?: ProductVariantAddUrlQueryParams, ): string => productVariantAddPath(encodeURIComponent(productId)) + "?" + @@ -134,7 +134,7 @@ export type ProductImageUrlQueryParams = Dialog<"remove">; export const productImageUrl = ( productId: string, imageId: string, - params?: ProductImageUrlQueryParams + params?: ProductImageUrlQueryParams, ) => productImagePath(encodeURIComponent(productId), encodeURIComponent(imageId)) + "?" + diff --git a/src/products/utils/data.ts b/src/products/utils/data.ts index 852d04972..311e18d1a 100644 --- a/src/products/utils/data.ts +++ b/src/products/utils/data.ts @@ -1,12 +1,12 @@ import { getDefaultAttributeValues, getSelectedAttributeValues, - mergeChoicesWithValues + mergeChoicesWithValues, } from "@saleor/attributes/utils/data"; import { ChannelData } from "@saleor/channels/utils"; import { AttributeInput, - VariantAttributeScope + VariantAttributeScope, } from "@saleor/components/Attributes"; import { MetadataFormData } from "@saleor/components/Metadata/types"; import { SingleAutocompleteChoiceType } from "@saleor/components/SingleAutocompleteSelectField"; @@ -18,7 +18,7 @@ import { ProductVariantFragment, SelectedVariantAttributeFragment, StockInput, - VariantAttributeFragment + VariantAttributeFragment, } from "@saleor/graphql"; import { FormsetAtomicData } from "@saleor/hooks/useFormset"; import { maybe } from "@saleor/misc"; @@ -46,7 +46,7 @@ export interface ProductType { } export function getAttributeInputFromProduct( - product: ProductFragment + product: ProductFragment, ): AttributeInput[] { return ( product?.attributes?.map(attribute => ({ @@ -56,17 +56,17 @@ export function getAttributeInputFromProduct( isRequired: attribute.attribute.valueRequired, selectedValues: attribute.values, values: mergeChoicesWithValues(attribute), - unit: attribute.attribute.unit + unit: attribute.attribute.unit, }, id: attribute.attribute.id, label: attribute.attribute.name, - value: getSelectedAttributeValues(attribute) + value: getSelectedAttributeValues(attribute), })) ?? [] ); } export function getAttributeInputFromProductType( - productType: ProductType + productType: ProductType, ): AttributeInput[] { return productType.productAttributes.map(attribute => ({ data: { @@ -74,17 +74,17 @@ export function getAttributeInputFromProductType( inputType: attribute.inputType, isRequired: attribute.valueRequired, values: mapEdgesToItems(attribute.choices) || [], - unit: attribute.unit + unit: attribute.unit, }, id: attribute.id, label: attribute.name, - value: [] + value: [], })); } export function getAttributeInputFromAttributes( variantAttributes: VariantAttributeFragment[], - variantAttributeScope: VariantAttributeScope + variantAttributeScope: VariantAttributeScope, ): AttributeInput[] { return variantAttributes?.map(attribute => ({ data: { @@ -93,17 +93,17 @@ export function getAttributeInputFromAttributes( isRequired: attribute.valueRequired, values: mapEdgesToItems(attribute.choices) || [], unit: attribute.unit, - variantAttributeScope + variantAttributeScope, }, id: attribute.id, label: attribute.name, - value: getDefaultAttributeValues(attribute) + value: getDefaultAttributeValues(attribute), })); } export function getAttributeInputFromSelectedAttributes( variantAttributes: SelectedVariantAttributeFragment[], - variantAttributeScope: VariantAttributeScope + variantAttributeScope: VariantAttributeScope, ): AttributeInput[] { return variantAttributes?.map(attribute => ({ data: { @@ -113,24 +113,24 @@ export function getAttributeInputFromSelectedAttributes( selectedValues: attribute.values, values: mergeChoicesWithValues(attribute), unit: attribute.attribute.unit, - variantAttributeScope + variantAttributeScope, }, id: attribute.attribute.id, label: attribute.attribute.name, - value: getSelectedAttributeValues(attribute) + value: getSelectedAttributeValues(attribute), })); } export function getAttributeInputFromVariant( - variant: ProductVariantFragment + variant: ProductVariantFragment, ): AttributeInput[] { const selectionAttributeInput = getAttributeInputFromSelectedAttributes( variant?.selectionAttributes, - VariantAttributeScope.VARIANT_SELECTION + VariantAttributeScope.VARIANT_SELECTION, ); const nonSelectionAttributeInput = getAttributeInputFromSelectedAttributes( variant?.nonSelectionAttributes, - VariantAttributeScope.NOT_VARIANT_SELECTION + VariantAttributeScope.NOT_VARIANT_SELECTION, ); return ( @@ -139,16 +139,16 @@ export function getAttributeInputFromVariant( } export function getVariantAttributeInputFromProduct( - product: ProductVariantCreateDataQuery["product"] + product: ProductVariantCreateDataQuery["product"], ): AttributeInput[] { const selectionAttributeInput = getAttributeInputFromAttributes( product?.productType?.selectionVariantAttributes, - VariantAttributeScope.VARIANT_SELECTION + VariantAttributeScope.VARIANT_SELECTION, ); const nonSelectionAttributeInput = getAttributeInputFromAttributes( product?.productType?.nonSelectionVariantAttributes, - VariantAttributeScope.NOT_VARIANT_SELECTION + VariantAttributeScope.NOT_VARIANT_SELECTION, ); return ( @@ -157,43 +157,43 @@ export function getVariantAttributeInputFromProduct( } export function getStockInputFromVariant( - variant: ProductVariantFragment + variant: ProductVariantFragment, ): ProductStockInput[] { return ( variant?.stocks.map(stock => ({ data: { - quantityAllocated: stock.quantityAllocated + quantityAllocated: stock.quantityAllocated, }, id: stock.warehouse.id, label: stock.warehouse.name, - value: stock.quantity.toString() + value: stock.quantity.toString(), })) || [] ); } export function getStockInputFromProduct( - product: ProductFragment + product: ProductFragment, ): ProductStockInput[] { return product?.variants[0]?.stocks.map(stock => ({ data: { - quantityAllocated: stock?.quantityAllocated + quantityAllocated: stock?.quantityAllocated, }, id: stock.warehouse.id, label: stock.warehouse.name, - value: stock.quantity.toString() + value: stock.quantity.toString(), })); } export function getCollectionInput( - productCollections: ProductFragment["collections"] + productCollections: ProductFragment["collections"], ): Collection[] { return maybe( () => productCollections.map(collection => ({ id: collection.id, - label: collection.name + label: collection.name, })), - [] + [], ); } @@ -202,9 +202,9 @@ export function getChoices(nodes: Node[]): SingleAutocompleteChoiceType[] { () => nodes.map(node => ({ label: node.name, - value: node.id + value: node.id, })), - [] + [], ); } @@ -238,7 +238,7 @@ export function getProductUpdatePageFormData( variants: ProductDetailsVariantFragment[], currentChannels: ChannelData[], channelsData: ChannelData[], - channelsWithVariants: ChannelsWithVariantsData + channelsWithVariants: ChannelsWithVariantsData, ): ProductUpdatePageFormData { const variant = product?.variants[0]; return { @@ -249,7 +249,7 @@ export function getProductUpdatePageFormData( chargeTaxes: maybe(() => product.chargeTaxes, false), collections: maybe( () => product.collections.map(collection => collection.id), - [] + [], ), channelListings: currentChannels.map(listing => ({ ...listing })), isAvailable: !!product?.isAvailable, @@ -266,7 +266,7 @@ export function getProductUpdatePageFormData( : variants && variants[0] ? variants[0].sku : undefined, - "" + "", ), slug: product?.slug || "", taxCode: product?.taxType.taxCode, @@ -276,16 +276,16 @@ export function getProductUpdatePageFormData( globalThreshold: variant?.preorder?.globalThreshold?.toString() || "", globalSoldUnits: variant?.preorder?.globalSoldUnits || 0, hasPreorderEndDate: !!variant?.preorder?.endDate, - preorderEndDateTime: variant?.preorder?.endDate + preorderEndDateTime: variant?.preorder?.endDate, }; } export function mapFormsetStockToStockInput( - stock: FormsetAtomicData + stock: FormsetAtomicData, ): StockInput { return { quantity: parseInt(stock.value, 10) || 0, - warehouse: stock.id + warehouse: stock.id, }; } diff --git a/src/products/utils/handlers.ts b/src/products/utils/handlers.ts index 8149546c9..f7deab69b 100644 --- a/src/products/utils/handlers.ts +++ b/src/products/utils/handlers.ts @@ -3,7 +3,7 @@ import { ChannelPreorderArgs, ChannelPriceAndPreorderData, ChannelPriceArgs, - ChannelPriceData + ChannelPriceData, } from "@saleor/channels/utils"; import { FormChange, UseFormResult } from "@saleor/hooks/useForm"; import moment from "moment"; @@ -11,13 +11,13 @@ import moment from "moment"; export function createChannelsPriceChangeHandler( channelListings: ChannelData[], updateChannels: (data: ChannelData[]) => void, - triggerChange: () => void + triggerChange: () => void, ) { return (id: string, priceData: ChannelPriceArgs) => { const { costPrice, price } = priceData; const updatedChannels = channelListings.map(channel => - channel.id === id ? { ...channel, costPrice, price } : channel + channel.id === id ? { ...channel, costPrice, price } : channel, ); updateChannels(updatedChannels); @@ -29,13 +29,15 @@ export function createChannelsPriceChangeHandler( export function createChannelsPreorderChangeHandler( channelListings: ChannelData[], updateChannels: (data: ChannelData[]) => void, - triggerChange: () => void + triggerChange: () => void, ) { return (id: string, preorderData: ChannelPreorderArgs) => { const { preorderThreshold, unitsSold } = preorderData; const updatedChannels = channelListings.map(channel => - channel.id === id ? { ...channel, preorderThreshold, unitsSold } : channel + channel.id === id + ? { ...channel, preorderThreshold, unitsSold } + : channel, ); updateChannels(updatedChannels); @@ -47,11 +49,11 @@ export function createChannelsPreorderChangeHandler( export function createChannelsChangeHandler( channelsData: ChannelData[], updateChannels: (data: ChannelData[]) => void, - triggerChange: () => void + triggerChange: () => void, ) { return ( id: string, - data: Omit + data: Omit, ) => { const channelIndex = channelsData.findIndex(channel => channel.id === id); const channel = channelsData[channelIndex]; @@ -60,9 +62,9 @@ export function createChannelsChangeHandler( ...channelsData.slice(0, channelIndex), { ...channel, - ...data + ...data, }, - ...channelsData.slice(channelIndex + 1) + ...channelsData.slice(channelIndex + 1), ]; updateChannels(updatedChannels); @@ -74,12 +76,12 @@ export function createChannelsChangeHandler( export function createVariantChannelsChangeHandler( channelListings: ChannelPriceData[], setData: (data: ChannelPriceData[]) => void, - triggerChange: () => void + triggerChange: () => void, ) { return (id: string, priceData: ChannelPriceArgs) => { const { costPrice, price } = priceData; const channelIndex = channelListings.findIndex( - channel => channel.id === id + channel => channel.id === id, ); const channel = channelListings[channelIndex]; @@ -88,9 +90,9 @@ export function createVariantChannelsChangeHandler( { ...channel, costPrice, - price + price, }, - ...channelListings.slice(channelIndex + 1) + ...channelListings.slice(channelIndex + 1), ]; setData(updatedChannels); triggerChange(); @@ -99,7 +101,7 @@ export function createVariantChannelsChangeHandler( export function createProductTypeSelectHandler( setProductType: (productTypeId: string) => void, - triggerChange: () => void + triggerChange: () => void, ): FormChange { return (event: React.ChangeEvent) => { const id = event.target.value; @@ -116,8 +118,8 @@ export const getChannelsInput = (channels: ChannelPriceAndPreorderData[]) => value: { costPrice: channel.costPrice || "", price: channel.price || "", - preorderThreshold: channel.preorderThreshold || null - } + preorderThreshold: channel.preorderThreshold || null, + }, })); export const getAvailabilityVariables = (channels: ChannelData[]) => @@ -137,14 +139,14 @@ export const getAvailabilityVariables = (channels: ChannelData[]) => isAvailableForPurchase: isAvailable, isPublished: channel.isPublished, publicationDate: channel.publicationDate, - visibleInListings: channel.visibleInListings + visibleInListings: channel.visibleInListings, }; }); export const createPreorderEndDateChangeHandler = ( form: UseFormResult<{ preorderEndDateTime?: string }>, triggerChange: () => void, - preorderPastDateErrorMessage: string + preorderPastDateErrorMessage: string, ): FormChange => event => { form.change(event); if (moment(event.target.value).isSameOrBefore(Date.now())) { diff --git a/src/products/views/ProductCreate/ProductCreate.tsx b/src/products/views/ProductCreate/ProductCreate.tsx index de529237a..e51c2ef72 100644 --- a/src/products/views/ProductCreate/ProductCreate.tsx +++ b/src/products/views/ProductCreate/ProductCreate.tsx @@ -5,7 +5,7 @@ import ChannelsAvailabilityDialog from "@saleor/components/ChannelsAvailabilityD import { WindowTitle } from "@saleor/components/WindowTitle"; import { DEFAULT_INITIAL_SEARCH_DATA, - VALUES_PAGINATE_BY + VALUES_PAGINATE_BY, } from "@saleor/config"; import { useFileUploadMutation, @@ -18,20 +18,20 @@ import { useUpdateMetadataMutation, useUpdatePrivateMetadataMutation, useVariantCreateMutation, - useWarehouseListQuery + useWarehouseListQuery, } from "@saleor/graphql"; import useChannels from "@saleor/hooks/useChannels"; import useNavigator from "@saleor/hooks/useNavigator"; import useNotifier from "@saleor/hooks/useNotifier"; import useShop from "@saleor/hooks/useShop"; import ProductCreatePage, { - ProductCreateData + ProductCreateData, } from "@saleor/products/components/ProductCreatePage"; import { productAddUrl, ProductCreateUrlDialog, ProductCreateUrlQueryParams, - productUrl + productUrl, } from "@saleor/products/urls"; import useCategorySearch from "@saleor/searches/useCategorySearch"; import useCollectionSearch from "@saleor/searches/useCollectionSearch"; @@ -60,7 +60,7 @@ export const ProductCreateView: React.FC = ({ params }) => { const shop = useShop(); const intl = useIntl(); const [productCreateComplete, setProductCreateComplete] = React.useState( - false + false, ); const [selectedProductTypeId, setSelectedProductTypeId] = React.useState< string @@ -74,49 +74,49 @@ export const ProductCreateView: React.FC = ({ params }) => { const { loadMore: loadMoreCategories, search: searchCategory, - result: searchCategoryOpts + result: searchCategoryOpts, } = useCategorySearch({ - variables: DEFAULT_INITIAL_SEARCH_DATA + variables: DEFAULT_INITIAL_SEARCH_DATA, }); const { loadMore: loadMoreCollections, search: searchCollection, - result: searchCollectionOpts + result: searchCollectionOpts, } = useCollectionSearch({ - variables: DEFAULT_INITIAL_SEARCH_DATA + variables: DEFAULT_INITIAL_SEARCH_DATA, }); const { loadMore: loadMoreProductTypes, search: searchProductTypes, - result: searchProductTypesOpts + result: searchProductTypesOpts, } = useProductTypeSearch({ - variables: DEFAULT_INITIAL_SEARCH_DATA + variables: DEFAULT_INITIAL_SEARCH_DATA, }); const { loadMore: loadMorePages, search: searchPages, - result: searchPagesOpts + result: searchPagesOpts, } = usePageSearch({ - variables: DEFAULT_INITIAL_SEARCH_DATA + variables: DEFAULT_INITIAL_SEARCH_DATA, }); const { loadMore: loadMoreProducts, search: searchProducts, - result: searchProductsOpts + result: searchProductsOpts, } = useProductSearch({ - variables: DEFAULT_INITIAL_SEARCH_DATA + variables: DEFAULT_INITIAL_SEARCH_DATA, }); const { loadMore: loadMoreAttributeValues, search: searchAttributeValues, result: searchAttributeValuesOpts, - reset: searchAttributeReset + reset: searchAttributeReset, } = useAttributeValueSearchHandler(DEFAULT_INITIAL_SEARCH_DATA); const warehouses = useWarehouseListQuery({ displayLoader: true, variables: { - first: 50 - } + first: 50, + }, }); const [updateMetadata] = useUpdateMetadataMutation({}); const [updatePrivateMetadata] = useUpdatePrivateMetadataMutation({}); @@ -124,9 +124,9 @@ export const ProductCreateView: React.FC = ({ params }) => { const { data: selectedProductType } = useProductTypeQuery({ variables: { id: selectedProductTypeId, - firstValues: VALUES_PAGINATE_BY + firstValues: VALUES_PAGINATE_BY, }, - skip: !selectedProductTypeId + skip: !selectedProductTypeId, }); const productTypes = @@ -134,7 +134,7 @@ export const ProductCreateView: React.FC = ({ params }) => { const { availableChannels } = useAppChannel(false); const allChannels: ChannelData[] = createSortedChannelsData( - availableChannels + availableChannels, ); const { @@ -147,17 +147,17 @@ export const ProductCreateView: React.FC = ({ params }) => { isChannelSelected, isChannelsModalOpen, setCurrentChannels, - toggleAllChannels + toggleAllChannels, } = useChannels( allChannels, params?.action, { closeModal, - openModal + openModal, }, { - formId: PRODUCT_CREATE_FORM_ID - } + formId: PRODUCT_CREATE_FORM_ID, + }, ); const handleSuccess = (productId: string) => { @@ -165,8 +165,8 @@ export const ProductCreateView: React.FC = ({ params }) => { status: "success", text: intl.formatMessage({ id: "DO8+uV", - defaultMessage: "Product created" - }) + defaultMessage: "Product created", + }), }); navigate(productUrl(productId)); }; @@ -175,18 +175,18 @@ export const ProductCreateView: React.FC = ({ params }) => { const [ updateChannels, - updateChannelsOpts + updateChannelsOpts, ] = useProductChannelListingUpdateMutation({}); const [ updateVariantChannels, - updateVariantChannelsOpts + updateVariantChannelsOpts, ] = useProductVariantChannelListingUpdateMutation({}); const [productCreate, productCreateOpts] = useProductCreateMutation({}); const [deleteProduct] = useProductDeleteMutation({}); const [ productVariantCreate, - productVariantCreateOpts + productVariantCreateOpts, ] = useVariantCreateMutation({ onCompleted: data => { const errors = data.productVariantCreate.errors; @@ -194,11 +194,11 @@ export const ProductCreateView: React.FC = ({ params }) => { errors.map(error => notify({ status: "error", - text: getProductErrorMessage(error, intl) - }) + text: getProductErrorMessage(error, intl), + }), ); } - } + }, }); const handleSubmit = async (data: ProductCreateData) => { @@ -210,10 +210,10 @@ export const ProductCreateView: React.FC = ({ params }) => { variables => productVariantCreate({ variables }), updateChannels, updateVariantChannels, - deleteProduct + deleteProduct, ), updateMetadata, - updatePrivateMetadata + updatePrivateMetadata, )(data); if (!errors?.length) { @@ -227,8 +227,8 @@ export const ProductCreateView: React.FC = ({ params }) => { navigate( productAddUrl({ action: "assign-attribute-value", - id: attribute.id - }) + id: attribute.id, + }), ); React.useEffect(() => { @@ -242,33 +242,33 @@ export const ProductCreateView: React.FC = ({ params }) => { const fetchMoreProductTypes = { hasMore: searchProductTypesOpts.data?.search?.pageInfo?.hasNextPage, loading: searchProductTypesOpts.loading, - onFetchMore: loadMoreProductTypes + onFetchMore: loadMoreProductTypes, }; const fetchMoreCollections = { hasMore: searchCollectionOpts.data?.search?.pageInfo?.hasNextPage, loading: searchCollectionOpts.loading, - onFetchMore: loadMoreCollections + onFetchMore: loadMoreCollections, }; const fetchMoreCategories = { hasMore: searchCategoryOpts.data?.search?.pageInfo?.hasNextPage, loading: searchCategoryOpts.loading, - onFetchMore: loadMoreCategories + onFetchMore: loadMoreCategories, }; const fetchMoreReferencePages = { hasMore: searchPagesOpts.data?.search?.pageInfo?.hasNextPage, loading: searchPagesOpts.loading, - onFetchMore: loadMorePages + onFetchMore: loadMorePages, }; const fetchMoreReferenceProducts = { hasMore: searchProductsOpts.data?.search?.pageInfo?.hasNextPage, loading: searchProductsOpts.loading, - onFetchMore: loadMoreProducts + onFetchMore: loadMoreProducts, }; const fetchMoreAttributeValues = { hasMore: !!searchAttributeValuesOpts.data?.attribute?.choices?.pageInfo ?.hasNextPage, loading: !!searchAttributeValuesOpts.loading, - onFetchMore: loadMoreAttributeValues + onFetchMore: loadMoreAttributeValues, }; const loading = @@ -284,7 +284,7 @@ export const ProductCreateView: React.FC = ({ params }) => { title={intl.formatMessage({ id: "PXx4Jk", defaultMessage: "Create Product", - description: "window title" + description: "window title", })} /> {!!allChannels?.length && ( @@ -296,7 +296,7 @@ export const ProductCreateView: React.FC = ({ params }) => { open={isChannelsModalOpen} title={intl.formatMessage({ id: "Eau5AV", - defaultMessage: "Manage Products Channel Availability" + defaultMessage: "Manage Products Channel Availability", })} confirmButtonState="default" selected={channelListElements.length} @@ -320,7 +320,7 @@ export const ProductCreateView: React.FC = ({ params }) => { } errors={[ ...(productCreateOpts.data?.productCreate.errors || []), - ...(productVariantCreateOpts.data?.productVariantCreate.errors || []) + ...(productVariantCreateOpts.data?.productVariantCreate.errors || []), ]} fetchCategories={searchCategory} fetchCollections={searchCollection} @@ -329,7 +329,7 @@ export const ProductCreateView: React.FC = ({ params }) => { header={intl.formatMessage({ id: "NBP8uu", defaultMessage: "New Product", - description: "page header" + description: "page header", })} productTypes={productTypes} onSubmit={handleSubmit} diff --git a/src/products/views/ProductCreate/handlers.ts b/src/products/views/ProductCreate/handlers.ts index e57548378..d18275e7b 100644 --- a/src/products/views/ProductCreate/handlers.ts +++ b/src/products/views/ProductCreate/handlers.ts @@ -1,11 +1,11 @@ import { FetchResult } from "@apollo/client"; import { getAttributesAfterFileAttributesUpdate, - mergeFileUploadErrors + mergeFileUploadErrors, } from "@saleor/attributes/utils/data"; import { handleUploadMultipleFiles, - prepareAttributesInput + prepareAttributesInput, } from "@saleor/attributes/utils/handlers"; import { ChannelData } from "@saleor/channels/utils"; import { @@ -23,7 +23,7 @@ import { ProductVariantChannelListingUpdateMutationVariables, UploadErrorFragment, VariantCreateMutation, - VariantCreateMutationVariables + VariantCreateMutationVariables, } from "@saleor/graphql"; import { weight } from "@saleor/misc"; import { ProductCreateData } from "@saleor/products/components/ProductCreatePage/form"; @@ -34,14 +34,14 @@ const getChannelsVariables = (productId: string, channels: ChannelData[]) => ({ variables: { id: productId, input: { - updateChannels: getAvailabilityVariables(channels) - } - } + updateChannels: getAvailabilityVariables(channels), + }, + }, }); const getSimpleProductVariables = ( formData: ProductCreateData, - productId: string + productId: string, ) => ({ input: { attributes: [], @@ -49,30 +49,30 @@ const getSimpleProductVariables = ( sku: formData.sku, stocks: formData.stocks?.map(stock => ({ quantity: parseInt(stock.value, 10), - warehouse: stock.id + warehouse: stock.id, })), preorder: formData.isPreorder ? { globalThreshold: formData.globalThreshold ? parseInt(formData.globalThreshold, 10) : null, - endDate: formData.preorderEndDateTime || null + endDate: formData.preorderEndDateTime || null, } : null, - trackInventory: formData.trackInventory - } + trackInventory: formData.trackInventory, + }, }); export function createHandler( productType: ProductTypeQuery["productType"], uploadFile: ( - variables: FileUploadMutationVariables + variables: FileUploadMutationVariables, ) => Promise>, productCreate: ( - variables: ProductCreateMutationVariables + variables: ProductCreateMutationVariables, ) => Promise>, productVariantCreate: ( - variables: VariantCreateMutationVariables + variables: VariantCreateMutationVariables, ) => Promise>, updateChannels: (options: { variables: ProductChannelListingUpdateMutationVariables; @@ -82,20 +82,20 @@ export function createHandler( }) => Promise>, productDelete: (options: { variables: ProductDeleteMutationVariables; - }) => Promise> + }) => Promise>, ) { return async (formData: ProductCreateData) => { let errors: Array = []; const uploadFilesResult = await handleUploadMultipleFiles( formData.attributesWithNewFileValue, - uploadFile + uploadFile, ); errors = [...errors, ...mergeFileUploadErrors(uploadFilesResult)]; const updatedFileAttributes = getAttributesAfterFileAttributesUpdate( formData.attributesWithNewFileValue, - uploadFilesResult + uploadFilesResult, ); const productVariables: ProductCreateMutationVariables = { @@ -103,7 +103,7 @@ export function createHandler( attributes: prepareAttributesInput({ attributes: formData.attributes, prevAttributes: null, - updatedFileAttributes + updatedFileAttributes, }), category: formData.category, chargeTaxes: formData.chargeTaxes, @@ -114,12 +114,12 @@ export function createHandler( rating: formData.rating, seo: { description: formData.seoDescription, - title: formData.seoTitle + title: formData.seoTitle, }, slug: formData.slug, taxCode: formData.changeTaxCode ? formData.taxCode : undefined, - weight: weight(formData.weight) - } + weight: weight(formData.weight), + }, }; const result = await productCreate(productVariables); @@ -136,9 +136,9 @@ export function createHandler( if (!hasVariants) { const result = await Promise.all([ updateChannels( - getChannelsVariables(productId, formData.channelListings) + getChannelsVariables(productId, formData.channelListings), ), - productVariantCreate(getSimpleProductVariables(formData, productId)) + productVariantCreate(getSimpleProductVariables(formData, productId)), ]); const channelErrors = result[0].data?.productChannelListingUpdate?.errors; const variantErrors = result[1].data?.productVariantCreate?.errors; @@ -155,14 +155,14 @@ export function createHandler( input: formData.channelListings.map(listing => ({ channelId: listing.id, costPrice: listing.costPrice || null, - price: listing.price - })) - } + price: listing.price, + })), + }, }); } } else { const result = await updateChannels( - getChannelsVariables(productId, formData.channelListings) + getChannelsVariables(productId, formData.channelListings), ); if (result.data?.productChannelListingUpdate?.errors.length > 0) { diff --git a/src/products/views/ProductImage.tsx b/src/products/views/ProductImage.tsx index b276226ba..0a68514c8 100644 --- a/src/products/views/ProductImage.tsx +++ b/src/products/views/ProductImage.tsx @@ -4,7 +4,7 @@ import NotFoundPage from "@saleor/components/NotFoundPage"; import { useProductMediaByIdQuery, useProductMediaDeleteMutation, - useProductMediaUpdateMutation + useProductMediaUpdateMutation, } from "@saleor/graphql"; import useNavigator from "@saleor/hooks/useNavigator"; import useNotifier from "@saleor/hooks/useNotifier"; @@ -17,7 +17,7 @@ import { productImageUrl, ProductImageUrlQueryParams, productListUrl, - productUrl + productUrl, } from "../urls"; interface ProductMediaProps { @@ -29,7 +29,7 @@ interface ProductMediaProps { export const ProductImage: React.FC = ({ mediaId, productId, - params + params, }) => { const navigate = useNavigator(); const notify = useNotifier(); @@ -41,8 +41,8 @@ export const ProductImage: React.FC = ({ displayLoader: true, variables: { mediaId, - productId - } + productId, + }, }); const [updateImage, updateResult] = useProductMediaUpdateMutation({ @@ -50,14 +50,14 @@ export const ProductImage: React.FC = ({ if (data.productMediaUpdate.errors.length === 0) { notify({ status: "success", - text: intl.formatMessage(commonMessages.savedChanges) + text: intl.formatMessage(commonMessages.savedChanges), }); } - } + }, }); const [deleteImage, deleteResult] = useProductMediaDeleteMutation({ - onCompleted: handleBack + onCompleted: handleBack, }); const product = data?.product; @@ -73,8 +73,8 @@ export const ProductImage: React.FC = ({ updateImage({ variables: { alt: formData.description, - id: mediaId - } + id: mediaId, + }, }); }; const mediaObj = data?.product?.mainImage; @@ -90,8 +90,8 @@ export const ProductImage: React.FC = ({ onDelete={() => navigate( productImageUrl(productId, mediaId, { - action: "remove" - }) + action: "remove", + }), ) } onRowClick={handleImageClick} @@ -107,7 +107,7 @@ export const ProductImage: React.FC = ({ title={intl.formatMessage({ id: "uCn/rd", defaultMessage: "Delete Image", - description: "dialog header" + description: "dialog header", })} variant="delete" confirmButtonState={deleteResult.status} diff --git a/src/products/views/ProductList/ProductList.tsx b/src/products/views/ProductList/ProductList.tsx index c1186375d..22fc3d31f 100644 --- a/src/products/views/ProductList/ProductList.tsx +++ b/src/products/views/ProductList/ProductList.tsx @@ -4,14 +4,14 @@ import ActionDialog from "@saleor/components/ActionDialog"; import useAppChannel from "@saleor/components/AppLayout/AppChannelContext"; import DeleteFilterTabDialog from "@saleor/components/DeleteFilterTabDialog"; import SaveFilterTabDialog, { - SaveFilterTabDialogFormData + SaveFilterTabDialogFormData, } from "@saleor/components/SaveFilterTabDialog"; import { useShopLimitsQuery } from "@saleor/components/Shop/queries"; import { DEFAULT_INITIAL_PAGINATION_DATA, DEFAULT_INITIAL_SEARCH_DATA, defaultListSettings, - ProductListColumns + ProductListColumns, } from "@saleor/config"; import { Task } from "@saleor/containers/BackgroundTasks/types"; import { @@ -25,7 +25,7 @@ import { useProductCountQuery, useProductExportMutation, useProductListQuery, - useWarehouseListQuery + useWarehouseListQuery, } from "@saleor/graphql"; import useBackgroundTask from "@saleor/hooks/useBackgroundTask"; import useBulkActions from "@saleor/hooks/useBulkActions"; @@ -35,7 +35,7 @@ import useNotifier from "@saleor/hooks/useNotifier"; import { usePaginationReset } from "@saleor/hooks/usePaginationReset"; import usePaginator, { createPaginationState, - PaginatorContext + PaginatorContext, } from "@saleor/hooks/usePaginator"; import { commonMessages } from "@saleor/intl"; import { DeleteIcon, IconButton } from "@saleor/macaw-ui"; @@ -43,13 +43,13 @@ import { maybe } from "@saleor/misc"; import ProductExportDialog from "@saleor/products/components/ProductExportDialog"; import { getAttributeIdFromColumnValue, - isAttributeColumnValue + isAttributeColumnValue, } from "@saleor/products/components/ProductListPage/utils"; import { productListUrl, ProductListUrlDialog, ProductListUrlQueryParams, - ProductListUrlSortField + ProductListUrlSortField, } from "@saleor/products/urls"; import useAttributeSearch from "@saleor/searches/useAttributeSearch"; import useAttributeValueSearch from "@saleor/searches/useAttributeValueSearch"; @@ -74,7 +74,7 @@ import { getFiltersCurrentTab, getFilterTabs, getFilterVariables, - saveFilterTab + saveFilterTab, } from "./filters"; import { getSortQueryVariables } from "./sort"; import { useSortRedirects } from "./useSortRedirects"; @@ -89,91 +89,91 @@ export const ProductList: React.FC = ({ params }) => { const notify = useNotifier(); const { queue } = useBackgroundTask(); const { isSelected, listElements, reset, toggle, toggleAll } = useBulkActions( - params.ids + params.ids, ); const { updateListSettings, settings } = useListSettings( - ListViews.PRODUCT_LIST + ListViews.PRODUCT_LIST, ); usePaginationReset(productListUrl, params, settings.rowNumber); const intl = useIntl(); const { - data: initialFilterAttributes + data: initialFilterAttributes, } = useInitialProductFilterAttributesQuery(); const { - data: initialFilterCategories + data: initialFilterCategories, } = useInitialProductFilterCategoriesQuery({ variables: { - categories: params.categories + categories: params.categories, }, - skip: !params.categories?.length + skip: !params.categories?.length, }); const { - data: initialFilterCollections + data: initialFilterCollections, } = useInitialProductFilterCollectionsQuery({ variables: { - collections: params.collections + collections: params.collections, }, - skip: !params.collections?.length + skip: !params.collections?.length, }); const { - data: initialFilterProductTypes + data: initialFilterProductTypes, } = useInitialProductFilterProductTypesQuery({ variables: { - productTypes: params.productTypes + productTypes: params.productTypes, }, - skip: !params.productTypes?.length + skip: !params.productTypes?.length, }); const searchCategories = useCategorySearch({ variables: { ...DEFAULT_INITIAL_SEARCH_DATA, - first: 5 - } + first: 5, + }, }); const searchCollections = useCollectionSearch({ variables: { ...DEFAULT_INITIAL_SEARCH_DATA, - first: 5 - } + first: 5, + }, }); const searchProductTypes = useProductTypeSearch({ variables: { ...DEFAULT_INITIAL_SEARCH_DATA, - first: 5 - } + first: 5, + }, }); const searchAttributes = useAttributeSearch({ variables: { ...DEFAULT_INITIAL_SEARCH_DATA, - first: 10 - } + first: 10, + }, }); const [focusedAttribute, setFocusedAttribute] = useState(); const searchAttributeValues = useAttributeValueSearch({ variables: { id: focusedAttribute, ...DEFAULT_INITIAL_SEARCH_DATA, - first: 10 + first: 10, }, - skip: !focusedAttribute + skip: !focusedAttribute, }); const warehouses = useWarehouseListQuery({ variables: { - first: 100 + first: 100, }, - skip: params.action !== "export" + skip: params.action !== "export", }); const availableProductKinds = getAvailableProductKinds(); const { availableChannels } = useAppChannel(false); const limitOpts = useShopLimitsQuery({ variables: { - productVariants: true - } + productVariants: true, + }, }); const selectedChannel = availableChannels.find( - channel => channel.slug === params.channel + channel => channel.slug === params.channel, ); useSortRedirects(params, !!selectedChannel); @@ -188,7 +188,7 @@ export const ProductList: React.FC = ({ params }) => { const currentTab = getFiltersCurrentTab(params, tabs); const countAllProducts = useProductCountQuery({ - skip: params.action !== "export" + skip: params.action !== "export", }); const [exportProducts, exportProductsOpts] = useProductExportMutation({ @@ -198,33 +198,33 @@ export const ProductList: React.FC = ({ params }) => { text: intl.formatMessage({ id: "dPYqy0", defaultMessage: - "We are currently exporting your requested CSV. As soon as it is available it will be sent to your email address" + "We are currently exporting your requested CSV. As soon as it is available it will be sent to your email address", }), title: intl.formatMessage({ id: "5QKsu+", defaultMessage: "Exporting CSV", - description: "waiting for export to end, header" - }) + description: "waiting for export to end, header", + }), }); queue(Task.EXPORT, { - id: data.exportProducts.exportFile.id + id: data.exportProducts.exportFile.id, }); closeModal(); reset(); } - } + }, }); const [ changeFilters, resetFilters, - handleSearchChange + handleSearchChange, ] = createFilterHandlers({ cleanupFn: reset, createUrl: productListUrl, getFilterQueryParam, navigate, - params + params, }); const handleTabChange = (tab: number) => { @@ -232,8 +232,8 @@ export const ProductList: React.FC = ({ params }) => { navigate( productListUrl({ activeTab: tab.toString(), - ...getFilterTabs()[tab - 1].data - }) + ...getFilterTabs()[tab - 1].data, + }), ); }; @@ -254,8 +254,8 @@ export const ProductList: React.FC = ({ params }) => { ...params, ...getSortUrlVariables(field, params), attributeId, - ...DEFAULT_INITIAL_PAGINATION_DATA - }) + ...DEFAULT_INITIAL_PAGINATION_DATA, + }), ); const kindOpts = getProductKindOpts(availableProductKinds, intl); @@ -272,9 +272,9 @@ export const ProductList: React.FC = ({ params }) => { ...paginationState, filter, sort, - channel: selectedChannel?.slug + channel: selectedChannel?.slug, }), - [params, settings.rowNumber] + [params, settings.rowNumber], ); const filteredColumnIds = settings.columns @@ -286,65 +286,65 @@ export const ProductList: React.FC = ({ params }) => { variables: { ...queryVariables, hasChannel: !!selectedChannel, - hasSelectedAttributes: filteredColumnIds.length > 0 - } + hasSelectedAttributes: filteredColumnIds.length > 0, + }, }); const availableInGridAttributesOpts = useAvailableInGridAttributesSearch({ variables: { ...DEFAULT_INITIAL_SEARCH_DATA, - first: 5 - } + first: 5, + }, }); const gridAttributes = useGridAttributesQuery({ variables: { ids: filteredColumnIds }, - skip: filteredColumnIds.length === 0 + skip: filteredColumnIds.length === 0, }); const [ productBulkDelete, - productBulkDeleteOpts + productBulkDeleteOpts, ] = useProductBulkDeleteMutation({ onCompleted: data => { if (data.productBulkDelete.errors.length === 0) { closeModal(); notify({ status: "success", - text: intl.formatMessage(commonMessages.savedChanges) + text: intl.formatMessage(commonMessages.savedChanges), }); reset(); refetch(); limitOpts.refetch(); } - } + }, }); const filterOpts = getFilterOpts( params, (mapEdgesToItems(initialFilterAttributes?.attributes) || []).filter( - filterable + filterable, ), searchAttributeValues, { initial: mapEdgesToItems(initialFilterCategories?.categories) || [], - search: searchCategories + search: searchCategories, }, { initial: mapEdgesToItems(initialFilterCollections?.collections) || [], - search: searchCollections + search: searchCollections, }, { initial: mapEdgesToItems(initialFilterProductTypes?.productTypes) || [], - search: searchProductTypes + search: searchProductTypes, }, kindOpts, - channelOpts + channelOpts, ); const paginationValues = usePaginator({ pageInfo: data?.products?.pageInfo, paginationState, - queryString: params + queryString: params, }); return ( @@ -353,12 +353,12 @@ export const ProductList: React.FC = ({ params }) => { activeAttributeSortId={params.attributeId} sort={{ asc: params.asc, - sort: params.sort + sort: params.sort, }} onSort={handleSort} availableInGridAttributes={ mapEdgesToItems( - availableInGridAttributesOpts.result?.data?.availableInGrid + availableInGridAttributesOpts.result?.data?.availableInGrid, ) || [] } currencySymbol={selectedChannel?.currencyCode || ""} @@ -370,7 +370,7 @@ export const ProductList: React.FC = ({ params }) => { () => availableInGridAttributesOpts.result.data.availableInGrid .totalCount, - 0 + 0, )} settings={settings} loading={ @@ -380,7 +380,7 @@ export const ProductList: React.FC = ({ params }) => { () => availableInGridAttributesOpts.result.data.availableInGrid.pageInfo .hasNextPage, - false + false, )} disabled={loading} limits={limitOpts.data?.shop.limits} @@ -395,7 +395,7 @@ export const ProductList: React.FC = ({ params }) => { color="primary" onClick={() => openModal("delete", { - ids: listElements + ids: listElements, }) } > @@ -424,13 +424,13 @@ export const ProductList: React.FC = ({ params }) => { onClose={closeModal} onConfirm={() => productBulkDelete({ - variables: { ids: params.ids } + variables: { ids: params.ids }, }) } title={intl.formatMessage({ id: "F4WdSO", defaultMessage: "Delete Products", - description: "dialog header" + description: "dialog header", })} variant="delete" > @@ -441,7 +441,7 @@ export const ProductList: React.FC = ({ params }) => { description="dialog content" values={{ counter: params?.ids?.length, - displayQuantity: {params?.ids?.length} + displayQuantity: {params?.ids?.length}, }} /> @@ -463,7 +463,7 @@ export const ProductList: React.FC = ({ params }) => { errors={exportProductsOpts.data?.exportProducts.errors || []} productQuantity={{ all: countAllProducts.data?.products.totalCount, - filter: data?.products.totalCount + filter: data?.products.totalCount, }} selectedProducts={listElements.length} warehouses={mapEdgesToItems(warehouses?.data?.warehouses) || []} @@ -475,9 +475,9 @@ export const ProductList: React.FC = ({ params }) => { input: { ...data, filter, - ids: listElements - } - } + ids: listElements, + }, + }, }) } /> diff --git a/src/products/views/ProductList/filters.test.ts b/src/products/views/ProductList/filters.test.ts index 76ddaaba5..6f5eaa179 100644 --- a/src/products/views/ProductList/filters.test.ts +++ b/src/products/views/ProductList/filters.test.ts @@ -23,7 +23,7 @@ describe("Filtering query params", () => { priceFrom: "10", priceTo: "20", status: true.toString(), - stockStatus: StockAvailability.IN_STOCK + stockStatus: StockAvailability.IN_STOCK, }; const filterVariables = getFilterVariables(params, true); @@ -39,7 +39,7 @@ describe("Filtering URL params", () => { it("should be empty if no active filters", () => { const filterQueryParams = getFilterQueryParams( filters, - getFilterQueryParam + getFilterQueryParam, ); expect(getExistingKeys(filterQueryParams)).toHaveLength(0); @@ -48,7 +48,7 @@ describe("Filtering URL params", () => { it("should not be empty if active filters are present", () => { const filterQueryParams = getFilterQueryParams( setFilterOptsStatus(filters, true), - getFilterQueryParam + getFilterQueryParam, ); expect(filterQueryParams).toMatchSnapshot(); diff --git a/src/products/views/ProductList/filters.ts b/src/products/views/ProductList/filters.ts index e3ed7b896..5da49c64b 100644 --- a/src/products/views/ProductList/filters.ts +++ b/src/products/views/ProductList/filters.ts @@ -13,19 +13,19 @@ import { SearchCollectionsQueryVariables, SearchProductTypesQuery, SearchProductTypesQueryVariables, - StockAvailability + StockAvailability, } from "@saleor/graphql"; import { UseSearchResult } from "@saleor/hooks/makeSearch"; import { findValueInEnum, maybe } from "@saleor/misc"; import { ProductFilterKeys, - ProductListFilterOpts + ProductListFilterOpts, } from "@saleor/products/components/ProductListPage"; import { RelayToFlat } from "@saleor/types"; import { mapEdgesToItems, mapNodeToChoice, - mapSlugNodeToChoice + mapSlugNodeToChoice, } from "@saleor/utils/maps"; import isArray from "lodash/isArray"; import moment from "moment-timezone"; @@ -33,7 +33,7 @@ import moment from "moment-timezone"; import { FilterElement, FilterElementKeyValue, - FilterElementRegular + FilterElementRegular, } from "../../../components/Filter"; import { createFilterTabUtils, @@ -45,7 +45,7 @@ import { getMultipleValueQueryParam, getSingleEnumValueQueryParam, getSingleValueQueryParam, - GteLte + GteLte, } from "../../../utils/filters"; import { ProductListUrlFilters, @@ -53,7 +53,7 @@ import { ProductListUrlFiltersEnum, ProductListUrlFiltersWithKeyValueValues, ProductListUrlFiltersWithMultipleValues, - ProductListUrlQueryParams + ProductListUrlQueryParams, } from "../../urls"; import { getProductGiftCardFilterParam } from "./utils"; export const PRODUCT_FILTERS_KEY = "productFilters"; @@ -87,7 +87,7 @@ export function getFilterOpts( >; }, productKind: SingleAutocompleteChoiceType[], - channels: SingleAutocompleteChoiceType[] + channels: SingleAutocompleteChoiceType[], ): ProductListFilterOpts { return { attributes: attributes @@ -98,15 +98,19 @@ export function getFilterOpts( name: attr.name, slug: attr.slug, inputType: attr.inputType, - value: dedupeFilter(params.attributes?.[attr.slug] || []) + value: dedupeFilter(params.attributes?.[attr.slug] || []), })), attributeChoices: { active: true, choices: mapSlugNodeToChoice( - mapEdgesToItems(focusedAttributeChoices.result.data?.attribute?.choices) + mapEdgesToItems( + focusedAttributeChoices.result.data?.attribute?.choices, + ), ), displayValues: mapNodeToChoice( - mapEdgesToItems(focusedAttributeChoices.result.data?.attribute?.choices) + mapEdgesToItems( + focusedAttributeChoices.result.data?.attribute?.choices, + ), ), hasMore: focusedAttributeChoices.result.data?.attribute?.choices?.pageInfo @@ -115,122 +119,124 @@ export function getFilterOpts( loading: focusedAttributeChoices.result.loading, onFetchMore: focusedAttributeChoices.loadMore, onSearchChange: focusedAttributeChoices.search, - value: null + value: null, }, categories: { active: !!params.categories, choices: mapNodeToChoice( - mapEdgesToItems(categories?.search?.result?.data?.search) + mapEdgesToItems(categories?.search?.result?.data?.search), ), displayValues: !!params.categories ? maybe( () => categories.initial.map(category => ({ label: category.name, - value: category.id + value: category.id, })), - [] + [], ) : [], hasMore: maybe( () => categories.search.result.data.search.pageInfo.hasNextPage, - false + false, ), initialSearch: "", loading: categories.search.result.loading, onFetchMore: categories.search.loadMore, onSearchChange: categories.search.search, - value: dedupeFilter(params.categories || []) + value: dedupeFilter(params.categories || []), }, channel: { active: params?.channel !== undefined, choices: channels, - value: params?.channel + value: params?.channel, }, collections: { active: !!params.collections, choices: mapNodeToChoice( - mapEdgesToItems(collections?.search?.result?.data?.search) + mapEdgesToItems(collections?.search?.result?.data?.search), ), displayValues: !!params.collections ? maybe( () => collections.initial.map(category => ({ label: category.name, - value: category.id + value: category.id, })), - [] + [], ) : [], hasMore: maybe( () => collections.search.result.data.search.pageInfo.hasNextPage, - false + false, ), initialSearch: "", loading: collections.search.result.loading, onFetchMore: collections.search.loadMore, onSearchChange: collections.search.search, - value: dedupeFilter(params.collections || []) + value: dedupeFilter(params.collections || []), }, metadata: { active: !!params?.metadata?.length, value: [ ...(params?.metadata ? params.metadata.filter(pair => pair?.key !== undefined) - : []) - ] + : []), + ], }, productKind: { active: params?.productKind !== undefined, choices: productKind, - value: params?.productKind + value: params?.productKind, }, price: { active: maybe( () => [params.priceFrom, params.priceTo].some(field => field !== undefined), - false + false, ), value: { max: maybe(() => params.priceTo, "0"), - min: maybe(() => params.priceFrom, "0") - } + min: maybe(() => params.priceFrom, "0"), + }, }, productType: { active: !!params.productTypes, choices: mapNodeToChoice( - mapEdgesToItems(productTypes?.search?.result?.data?.search) + mapEdgesToItems(productTypes?.search?.result?.data?.search), ), displayValues: !!params.productTypes ? maybe( () => productTypes.initial.map(productType => ({ label: productType.name, - value: productType.id + value: productType.id, })), - [] + [], ) : [], hasMore: maybe( () => productTypes.search.result.data.search.pageInfo.hasNextPage, - false + false, ), initialSearch: "", loading: productTypes.search.result.loading, onFetchMore: productTypes.search.loadMore, onSearchChange: productTypes.search.search, - value: dedupeFilter(params.productTypes || []) + value: dedupeFilter(params.productTypes || []), }, stockStatus: { active: maybe(() => params.stockStatus !== undefined, false), - value: maybe(() => findValueInEnum(params.stockStatus, StockAvailability)) - } + value: maybe(() => + findValueInEnum(params.stockStatus, StockAvailability), + ), + }, }; } const parseFilterValue = ( params: ProductListUrlFilters, - key: string + key: string, ): { type: "boolean" | "date" | "dateTime" | "string"; isMulti: boolean; @@ -242,10 +248,10 @@ const parseFilterValue = ( const isBooleanValue = !isMulti && ["true", "false"].includes((value as unknown) as string); const isDateValue = (isMulti ? value : [value]).some(val => - moment(val, moment.HTML5_FMT.DATE, true).isValid() + moment(val, moment.HTML5_FMT.DATE, true).isValid(), ); const isDateTimeValue = (isMulti ? value : [value]).some(val => - moment(val, moment.ISO_8601, true).isValid() + moment(val, moment.ISO_8601, true).isValid(), ); const data = { isMulti, value: (isMulti ? value : [value]) as string[] }; @@ -277,7 +283,7 @@ interface DefaultFilterParam extends BaseFilterParam { } function getFilteredAttributeValue( - params: ProductListUrlFilters + params: ProductListUrlFilters, ): Array< | BooleanFilterParam | BaseFilterParam @@ -299,8 +305,8 @@ function getFilteredAttributeValue( ...name, date: getGteLteVariables({ gte: value[0] || null, - lte: isMulti ? value[1] || null : value[0] - }) + lte: isMulti ? value[1] || null : value[0], + }), }; case "dateTime": @@ -308,8 +314,8 @@ function getFilteredAttributeValue( ...name, dateTime: getGteLteVariables({ gte: value[0] || null, - lte: isMulti ? value[1] || null : value[0] - }) + lte: isMulti ? value[1] || null : value[0], + }), }; default: @@ -321,7 +327,7 @@ function getFilteredAttributeValue( export function getFilterVariables( params: ProductListUrlFilters, - isChannelSelected: boolean + isChannelSelected: boolean, ): ProductFilterInput { return { attributes: getFilteredAttributeValue(params), @@ -331,7 +337,7 @@ export function getFilterVariables( price: isChannelSelected ? getGteLteVariables({ gte: parseFloat(params.priceFrom), - lte: parseFloat(params.priceTo) + lte: parseFloat(params.priceTo), }) : null, productTypes: @@ -341,13 +347,13 @@ export function getFilterVariables( stockAvailability: params.stockStatus !== undefined ? findValueInEnum(params.stockStatus, StockAvailability) - : null + : null, }; } export function getFilterQueryParam( filter: FilterElement, - params: ProductListUrlFilters + params: ProductListUrlFilters, ): ProductListUrlFilters { const { active, group, name, value } = filter; @@ -358,9 +364,9 @@ export function getFilterQueryParam( [group]: active ? { ...(rest === undefined ? {} : rest), - [name]: value + [name]: value, } - : rest + : rest, }; } @@ -368,51 +374,51 @@ export function getFilterQueryParam( case ProductFilterKeys.categories: return getMultipleValueQueryParam( filter, - ProductListUrlFiltersWithMultipleValues.categories + ProductListUrlFiltersWithMultipleValues.categories, ); case ProductFilterKeys.collections: return getMultipleValueQueryParam( filter, - ProductListUrlFiltersWithMultipleValues.collections + ProductListUrlFiltersWithMultipleValues.collections, ); case ProductFilterKeys.price: return getMinMaxQueryParam( filter, ProductListUrlFiltersEnum.priceFrom, - ProductListUrlFiltersEnum.priceTo + ProductListUrlFiltersEnum.priceTo, ); case ProductFilterKeys.productType: return getMultipleValueQueryParam( filter, - ProductListUrlFiltersWithMultipleValues.productTypes + ProductListUrlFiltersWithMultipleValues.productTypes, ); case ProductFilterKeys.stock: return getSingleEnumValueQueryParam( filter as FilterElementRegular, ProductListUrlFiltersEnum.stockStatus, - StockAvailability + StockAvailability, ); case ProductFilterKeys.channel: return getSingleValueQueryParam( filter, - ProductListUrlFiltersEnum.channel + ProductListUrlFiltersEnum.channel, ); case ProductFilterKeys.productKind: return getSingleValueQueryParam( filter, - ProductListUrlFiltersEnum.productKind + ProductListUrlFiltersEnum.productKind, ); case ProductFilterKeys.metadata: return getKeyValueQueryParam( filter as FilterElementKeyValue, - ProductListUrlFiltersWithKeyValueValues.metadata + ProductListUrlFiltersWithKeyValueValues.metadata, ); } } @@ -420,15 +426,15 @@ export function getFilterQueryParam( export const { deleteFilterTab, getFilterTabs, - saveFilterTab + saveFilterTab, } = createFilterTabUtils(PRODUCT_FILTERS_KEY); export const { areFiltersApplied, getActiveFilters, - getFiltersCurrentTab + getFiltersCurrentTab, } = createFilterUtils({ ...ProductListUrlFiltersEnum, ...ProductListUrlFiltersWithMultipleValues, - ...ProductListUrlFiltersAsDictWithMultipleValues + ...ProductListUrlFiltersAsDictWithMultipleValues, }); diff --git a/src/products/views/ProductList/fixtures.ts b/src/products/views/ProductList/fixtures.ts index 9973e8798..45dd738c9 100644 --- a/src/products/views/ProductList/fixtures.ts +++ b/src/products/views/ProductList/fixtures.ts @@ -16,8 +16,8 @@ export const productListFilterOpts: ProductListFilterOpts = { slug: attr.slug, value: [ attr.choices.edges[0].node.slug, - attr.choices.edges.length > 2 && attr.choices.edges[2].node.slug - ] + attr.choices.edges.length > 2 && attr.choices.edges[2].node.slug, + ], })), attributeChoices: { ...fetchMoreProps, @@ -25,7 +25,7 @@ export const productListFilterOpts: ProductListFilterOpts = { active: false, value: null, choices: mapSlugNodeToChoice(mapEdgesToItems(attributes[0].choices)), - displayValues: mapSlugNodeToChoice(mapEdgesToItems(attributes[0].choices)) + displayValues: mapSlugNodeToChoice(mapEdgesToItems(attributes[0].choices)), }, categories: { ...fetchMoreProps, @@ -33,15 +33,15 @@ export const productListFilterOpts: ProductListFilterOpts = { active: false, choices: categories.slice(5).map(category => ({ label: category.name, - value: category.id + value: category.id, })), displayValues: [ { label: categories[5].name, - value: categories[5].id - } + value: categories[5].id, + }, ], - value: [categories[5].id] + value: [categories[5].id], }, channel: { active: false, @@ -49,13 +49,13 @@ export const productListFilterOpts: ProductListFilterOpts = { choices: [ { value: "default-channel", - label: "Default channel" - } - ] + label: "Default channel", + }, + ], }, metadata: { active: false, - value: [{ key: "metadataKey", value: "metadataValue" }] + value: [{ key: "metadataKey", value: "metadataValue" }], }, productKind: { active: false, @@ -63,9 +63,9 @@ export const productListFilterOpts: ProductListFilterOpts = { choices: [ { value: "NORMAL", - label: "Normal" - } - ] + label: "Normal", + }, + ], }, collections: { ...fetchMoreProps, @@ -73,22 +73,22 @@ export const productListFilterOpts: ProductListFilterOpts = { active: false, choices: collections.slice(5).map(category => ({ label: category.name, - value: category.id + value: category.id, })), displayValues: [ { label: collections[5].name, - value: collections[5].id - } + value: collections[5].id, + }, ], - value: [collections[5].id] + value: [collections[5].id], }, price: { active: false, value: { max: "20", - min: "10" - } + min: "10", + }, }, productType: { ...fetchMoreProps, @@ -96,18 +96,18 @@ export const productListFilterOpts: ProductListFilterOpts = { active: false, choices: productTypes.slice(3).map(category => ({ label: category.name, - value: category.id + value: category.id, })), displayValues: [ { label: productTypes[3].name, - value: productTypes[3].id - } + value: productTypes[3].id, + }, ], - value: [productTypes[4].id] + value: [productTypes[4].id], }, stockStatus: { active: false, - value: StockAvailability.IN_STOCK - } + value: StockAvailability.IN_STOCK, + }, }; diff --git a/src/products/views/ProductList/messages.ts b/src/products/views/ProductList/messages.ts index cff0db449..fc51db904 100644 --- a/src/products/views/ProductList/messages.ts +++ b/src/products/views/ProductList/messages.ts @@ -4,11 +4,11 @@ export const productKindMessages = defineMessages({ giftCardLabel: { id: "YKyNm9", defaultMessage: "Gift Card", - description: "label" + description: "label", }, normalLabel: { id: "X/K4LI", defaultMessage: "Normal", - description: "label" - } + description: "label", + }, }); diff --git a/src/products/views/ProductList/sort.ts b/src/products/views/ProductList/sort.ts index bb5562eda..613742827 100644 --- a/src/products/views/ProductList/sort.ts +++ b/src/products/views/ProductList/sort.ts @@ -1,7 +1,7 @@ import { ProductOrder, ProductOrderField } from "@saleor/graphql"; import { ProductListUrlQueryParams, - ProductListUrlSortField + ProductListUrlSortField, } from "@saleor/products/urls"; import { getOrderDirection } from "@saleor/utils/sort"; @@ -9,7 +9,7 @@ export const DEFAULT_SORT_KEY = ProductListUrlSortField.name; export function canBeSorted( sort: ProductListUrlSortField, - isChannelSelected: boolean + isChannelSelected: boolean, ) { switch (sort) { case ProductListUrlSortField.name: @@ -27,7 +27,7 @@ export function canBeSorted( } export function getSortQueryField( - sort: ProductListUrlSortField + sort: ProductListUrlSortField, ): ProductOrderField { switch (sort) { case ProductListUrlSortField.name: @@ -49,7 +49,7 @@ export function getSortQueryField( export function getSortQueryVariables( params: ProductListUrlQueryParams, - isChannelSelected: boolean + isChannelSelected: boolean, ): ProductOrder { if (!canBeSorted(params.sort, isChannelSelected)) { return; @@ -59,13 +59,13 @@ export function getSortQueryVariables( if (params.sort === ProductListUrlSortField.attribute) { return { attributeId: params.attributeId, - direction + direction, }; } const field = getSortQueryField(params.sort); return { direction, - field + field, }; } diff --git a/src/products/views/ProductList/useSortRedirects.ts b/src/products/views/ProductList/useSortRedirects.ts index 24bc3dafe..99c85c0bc 100644 --- a/src/products/views/ProductList/useSortRedirects.ts +++ b/src/products/views/ProductList/useSortRedirects.ts @@ -2,7 +2,7 @@ import useNavigator from "@saleor/hooks/useNavigator"; import { productListUrl, ProductListUrlQueryParams, - ProductListUrlSortField + ProductListUrlSortField, } from "@saleor/products/urls"; import { useEffect } from "react"; @@ -10,7 +10,7 @@ import { canBeSorted, DEFAULT_SORT_KEY } from "./sort"; export function useSortRedirects( params: ProductListUrlQueryParams, - isChannelSelected: boolean + isChannelSelected: boolean, ) { const navigate = useNavigator(); @@ -26,8 +26,8 @@ export function useSortRedirects( productListUrl({ ...params, asc: hasQuery ? false : params.asc, - sort: hasQuery ? sortWithQuery : sortWithoutQuery - }) + sort: hasQuery ? sortWithQuery : sortWithoutQuery, + }), ); }, [params.query]); @@ -36,8 +36,8 @@ export function useSortRedirects( navigate( productListUrl({ ...params, - sort: DEFAULT_SORT_KEY - }) + sort: DEFAULT_SORT_KEY, + }), ); } }, [params]); diff --git a/src/products/views/ProductList/utils.ts b/src/products/views/ProductList/utils.ts index 52e8f8987..3c1072c90 100644 --- a/src/products/views/ProductList/utils.ts +++ b/src/products/views/ProductList/utils.ts @@ -12,24 +12,24 @@ interface ProductKindChoice { export const getAvailableProductKinds = (): ProductKindChoice[] => Object.keys(ProductTypeKindEnum).map(kind => ({ label: kind, - value: kind as ProductTypeKindEnum + value: kind as ProductTypeKindEnum, })); export const getProductKindOpts = ( availableProducts: ProductKindChoice[], - intl: IntlShape + intl: IntlShape, ): ProductKindChoice[] => availableProducts.map(kind => { switch (kind.value) { case ProductTypeKindEnum.GIFT_CARD: return { ...kind, - label: intl.formatMessage(messages.giftCardLabel) + label: intl.formatMessage(messages.giftCardLabel), }; case ProductTypeKindEnum.NORMAL: return { ...kind, - label: intl.formatMessage(messages.normalLabel) + label: intl.formatMessage(messages.normalLabel), }; } }); diff --git a/src/products/views/ProductUpdate/ProductUpdate.tsx b/src/products/views/ProductUpdate/ProductUpdate.tsx index c88925065..53cf4ac22 100644 --- a/src/products/views/ProductUpdate/ProductUpdate.tsx +++ b/src/products/views/ProductUpdate/ProductUpdate.tsx @@ -4,7 +4,7 @@ import ChannelsWithVariantsAvailabilityDialog from "@saleor/channels/components/ import { ChannelData, createChannelsDataWithPrice, - createSortedChannelsDataFromProduct + createSortedChannelsDataFromProduct, } from "@saleor/channels/utils"; import ActionDialog from "@saleor/components/ActionDialog"; import useAppChannel from "@saleor/components/AppLayout/AppChannelContext"; @@ -15,7 +15,7 @@ import { useShopLimitsQuery } from "@saleor/components/Shop/queries"; import { WindowTitle } from "@saleor/components/WindowTitle"; import { DEFAULT_INITIAL_SEARCH_DATA, - VALUES_PAGINATE_BY + VALUES_PAGINATE_BY, } from "@saleor/config"; import { ProductMediaCreateMutationVariables, @@ -37,7 +37,7 @@ import { useUpdateMetadataMutation, useUpdatePrivateMetadataMutation, useVariantCreateMutation, - useWarehouseListQuery + useWarehouseListQuery, } from "@saleor/graphql"; import { getSearchFetchMoreProps } from "@saleor/hooks/makeTopLevelSearch/utils"; import useBulkActions from "@saleor/hooks/useBulkActions"; @@ -72,17 +72,17 @@ import { ProductUrlDialog, ProductUrlQueryParams, productVariantAddUrl, - productVariantCreatorUrl + productVariantCreatorUrl, } from "../../urls"; import { CHANNELS_AVAILIABILITY_MODAL_SELECTOR, - PRODUCT_UPDATE_FORM_ID + PRODUCT_UPDATE_FORM_ID, } from "./consts"; import { createImageReorderHandler, createImageUploadHandler, createUpdateHandler, - createVariantReorderHandler + createVariantReorderHandler, } from "./handlers"; import useChannelVariantListings from "./useChannelVariantListings"; @@ -90,24 +90,24 @@ const messages = defineMessages({ deleteProductDialogTitle: { id: "TWVx7O", defaultMessage: "Delete Product", - description: "delete product dialog title" + description: "delete product dialog title", }, deleteProductDialogSubtitle: { id: "ZHF4Z9", defaultMessage: "Are you sure you want to delete {name}?", - description: "delete product dialog subtitle" + description: "delete product dialog subtitle", }, deleteVariantDialogTitle: { id: "6iw4VR", defaultMessage: "Delete Product Variants", - description: "delete variant dialog title" + description: "delete variant dialog title", }, deleteVariantDialogSubtitle: { id: "ukdRUv", defaultMessage: "{counter,plural,one{Are you sure you want to delete this variant?} other{Are you sure you want to delete {displayQuantity} variants?}}", - description: "delete variant dialog subtitle" - } + description: "delete variant dialog subtitle", + }, }); interface ProductUpdateProps { @@ -119,63 +119,63 @@ export const ProductUpdate: React.FC = ({ id, params }) => { const navigate = useNavigator(); const notify = useNotifier(); const { isSelected, listElements, reset, toggle, toggleAll } = useBulkActions( - params.ids + params.ids, ); const intl = useIntl(); const { loadMore: loadMoreCategories, search: searchCategories, - result: searchCategoriesOpts + result: searchCategoriesOpts, } = useCategorySearch({ - variables: DEFAULT_INITIAL_SEARCH_DATA + variables: DEFAULT_INITIAL_SEARCH_DATA, }); const { loadMore: loadMoreCollections, search: searchCollections, - result: searchCollectionsOpts + result: searchCollectionsOpts, } = useCollectionSearch({ - variables: DEFAULT_INITIAL_SEARCH_DATA + variables: DEFAULT_INITIAL_SEARCH_DATA, }); const { loadMore: loadMorePages, search: searchPages, - result: searchPagesOpts + result: searchPagesOpts, } = usePageSearch({ - variables: DEFAULT_INITIAL_SEARCH_DATA + variables: DEFAULT_INITIAL_SEARCH_DATA, }); const { loadMore: loadMoreProducts, search: searchProducts, - result: searchProductsOpts + result: searchProductsOpts, } = useProductSearch({ - variables: DEFAULT_INITIAL_SEARCH_DATA + variables: DEFAULT_INITIAL_SEARCH_DATA, }); const { loadMore: loadMoreAttributeValues, search: searchAttributeValues, result: searchAttributeValuesOpts, - reset: searchAttributeReset + reset: searchAttributeReset, } = useAttributeValueSearchHandler(DEFAULT_INITIAL_SEARCH_DATA); const warehouses = useWarehouseListQuery({ displayLoader: true, variables: { - first: 50 - } + first: 50, + }, }); const shop = useShop(); const [updateMetadata] = useUpdateMetadataMutation({}); const [updatePrivateMetadata] = useUpdatePrivateMetadataMutation({}); const [ productVariantCreate, - productVariantCreateOpts + productVariantCreateOpts, ] = useVariantCreateMutation({}); const { data, loading, refetch } = useProductDetailsQuery({ displayLoader: true, variables: { id, - firstValues: VALUES_PAGINATE_BY - } + firstValues: VALUES_PAGINATE_BY, + }, }); const isSimpleProduct = !data?.product?.productType?.hasVariants; @@ -184,8 +184,8 @@ export const ProductUpdate: React.FC = ({ id, params }) => { const limitOpts = useShopLimitsQuery({ variables: { - productVariants: true - } + productVariants: true, + }, }); const [uploadFile, uploadFileOpts] = useFileUploadMutation({}); @@ -194,23 +194,23 @@ export const ProductUpdate: React.FC = ({ id, params }) => { if (data.productUpdate.errors.length === 0) { notify({ status: "success", - text: intl.formatMessage(commonMessages.savedChanges) + text: intl.formatMessage(commonMessages.savedChanges), }); } }; const [updateProduct, updateProductOpts] = useProductUpdateMutation({ - onCompleted: handleUpdate + onCompleted: handleUpdate, }); const [ updateSimpleProduct, - updateSimpleProductOpts + updateSimpleProductOpts, ] = useSimpleProductUpdateMutation({ - onCompleted: handleUpdate + onCompleted: handleUpdate, }); const [ reorderProductImages, - reorderProductImagesOpts + reorderProductImagesOpts, ] = useProductMediaReorderMutation({}); const [deleteProduct, deleteProductOpts] = useProductDeleteMutation({ @@ -219,43 +219,44 @@ export const ProductUpdate: React.FC = ({ id, params }) => { status: "success", text: intl.formatMessage({ id: "vlVTmY", - defaultMessage: "Product removed" - }) + defaultMessage: "Product removed", + }), }); navigate(productListUrl()); - } + }, }); const [ createProductImage, - createProductImageOpts + createProductImageOpts, ] = useProductMediaCreateMutation({ onCompleted: data => { const imageError = data.productMediaCreate.errors.find( error => - error.field === ("image" as keyof ProductMediaCreateMutationVariables) + error.field === + ("image" as keyof ProductMediaCreateMutationVariables), ); if (imageError) { notify({ status: "error", title: intl.formatMessage(errorMessages.imgageUploadErrorTitle), - text: intl.formatMessage(errorMessages.imageUploadErrorText) + text: intl.formatMessage(errorMessages.imageUploadErrorText), }); } - } + }, }); const [deleteProductImage] = useProductMediaDeleteMutation({ onCompleted: () => notify({ status: "success", - text: intl.formatMessage(commonMessages.savedChanges) - }) + text: intl.formatMessage(commonMessages.savedChanges), + }), }); const [ bulkProductVariantDelete, - bulkProductVariantDeleteOpts + bulkProductVariantDeleteOpts, ] = useProductVariantBulkDeleteMutation({ onCompleted: data => { if (data.productVariantBulkDelete.errors.length === 0) { @@ -264,7 +265,7 @@ export const ProductUpdate: React.FC = ({ id, params }) => { refetch(); limitOpts.refetch(); } - } + }, }); const [openModal, closeModal] = createDialogActionHandlers< @@ -274,7 +275,7 @@ export const ProductUpdate: React.FC = ({ id, params }) => { const [ isEndPreorderModalOpened, - setIsEndPreorderModalOpened + setIsEndPreorderModalOpened, ] = React.useState(false); const product = data?.product; @@ -284,22 +285,22 @@ export const ProductUpdate: React.FC = ({ id, params }) => { () => createChannelsDataWithPrice( product, - availableChannels + availableChannels, ).sort((channel, nextChannel) => - channel.name.localeCompare(nextChannel.name) + channel.name.localeCompare(nextChannel.name), ), - [product, availableChannels] + [product, availableChannels], ); const [channelsData, setChannelsData] = useStateFromProps(allChannels); const { channels: updatedChannels, channelsWithVariantsData, - setChannelVariantListing + setChannelVariantListing, } = useChannelVariantListings(allChannels); const productChannelsChoices: ChannelData[] = createSortedChannelsDataFromProduct( - product + product, ); const { @@ -312,41 +313,41 @@ export const ProductUpdate: React.FC = ({ id, params }) => { isChannelSelected, isChannelsModalOpen, setCurrentChannels, - toggleAllChannels + toggleAllChannels, } = useChannels( productChannelsChoices, params?.action, { closeModal, - openModal + openModal, }, - { formId: PRODUCT_UPDATE_FORM_ID } + { formId: PRODUCT_UPDATE_FORM_ID }, ); const [ updateChannels, - updateChannelsOpts + updateChannelsOpts, ] = useProductChannelListingUpdateMutation({ onCompleted: data => { if (!!data.productChannelListingUpdate.errors.length) { data.productChannelListingUpdate.errors.forEach(error => notify({ status: "error", - text: getProductErrorMessage(error, intl) - }) + text: getProductErrorMessage(error, intl), + }), ); } - } + }, }); const [ updateVariantChannels, - updateVariantChannelsOpts + updateVariantChannelsOpts, ] = useProductVariantChannelListingUpdateMutation({}); const [ createProductMedia, - createProductMediaOpts + createProductMediaOpts, ] = useProductMediaCreateMutation({ onCompleted: data => { const errors = data.productMediaCreate.errors; @@ -355,43 +356,43 @@ export const ProductUpdate: React.FC = ({ id, params }) => { errors.map(error => notify({ status: "error", - text: getProductErrorMessage(error, intl) - }) + text: getProductErrorMessage(error, intl), + }), ); } else { notify({ status: "success", - text: intl.formatMessage(commonMessages.savedChanges) + text: intl.formatMessage(commonMessages.savedChanges), }); } - } + }, }); const handleMediaUrlUpload = (mediaUrl: string) => { const variables = { alt: "", mediaUrl, - product: product.id + product: product.id, }; createProductMedia({ - variables + variables, }); }; const [ deleteAttributeValue, - deleteAttributeValueOpts + deleteAttributeValueOpts, ] = useAttributeValueDeleteMutation({}); const onSetDefaultVariant = useOnSetDefaultVariant( product ? product.id : null, - null + null, ); const [ reorderProductVariants, - reorderProductVariantsOpts + reorderProductVariantsOpts, ] = useProductVariantReorderMutation({}); const handleBack = () => navigate(productListUrl()); @@ -413,21 +414,21 @@ export const ProductUpdate: React.FC = ({ id, params }) => { updateChannels, updateVariantChannels, productVariantCreate, - variables => deleteAttributeValue({ variables }) + variables => deleteAttributeValue({ variables }), ), variables => updateMetadata({ variables }), - variables => updatePrivateMetadata({ variables }) + variables => updatePrivateMetadata({ variables }), ); const handleImageUpload = createImageUploadHandler(id, variables => - createProductImage({ variables }) + createProductImage({ variables }), ); const handleImageReorder = createImageReorderHandler(product, variables => - reorderProductImages({ variables }) + reorderProductImages({ variables }), ); const handleVariantReorder = createVariantReorderHandler(product, variables => - reorderProductVariants({ variables }) + reorderProductVariants({ variables }), ); const handleDeactivatePreorder = async () => { @@ -437,7 +438,7 @@ export const ProductUpdate: React.FC = ({ id, params }) => { const [ deactivatePreorder, - deactivatePreoderOpts + deactivatePreoderOpts, ] = useProductVariantPreorderDeactivateMutation({}); const handleDeactivateVariantPreorder = (id: string) => deactivatePreorder({ variables: { id } }); @@ -446,9 +447,9 @@ export const ProductUpdate: React.FC = ({ id, params }) => { navigate( productUrl(id, { action: "assign-attribute-value", - id: attribute.id + id: attribute.id, }), - { resetScroll: false } + { resetScroll: false }, ); const disableFormSave = @@ -472,7 +473,7 @@ export const ProductUpdate: React.FC = ({ id, params }) => { updateProductOpts.data?.productUpdate.errors, updateSimpleProductOpts.data?.productUpdate.errors, updateSimpleProductOpts.data?.productVariantUpdate.errors, - createProductMediaOpts.data?.productMediaCreate.errors + createProductMediaOpts.data?.productMediaCreate.errors, ); const categories = mapEdgesToItems(searchCategoriesOpts?.data?.search) || []; @@ -486,40 +487,40 @@ export const ProductUpdate: React.FC = ({ id, params }) => { const errors = [ ...(updateProductOpts.data?.productUpdate.errors || []), ...(updateSimpleProductOpts.data?.productUpdate.errors || []), - ...(productVariantCreateOpts.data?.productVariantCreate.errors || []) + ...(productVariantCreateOpts.data?.productVariantCreate.errors || []), ]; const channelsErrors = [ ...(updateChannelsOpts?.data?.productChannelListingUpdate?.errors || []), ...(updateVariantChannelsOpts?.data?.productVariantChannelListingUpdate - ?.errors || []) + ?.errors || []), ]; const fetchMoreCollections = getSearchFetchMoreProps( searchCollectionsOpts, - loadMoreCollections + loadMoreCollections, ); const fetchMoreCategories = getSearchFetchMoreProps( searchCategoriesOpts, - loadMoreCategories + loadMoreCategories, ); const fetchMoreReferencePages = getSearchFetchMoreProps( searchPagesOpts, - loadMorePages + loadMorePages, ); const fetchMoreReferenceProducts = getSearchFetchMoreProps( searchProductsOpts, - loadMoreProducts + loadMoreProducts, ); const fetchMoreAttributeValues = { hasMore: !!searchAttributeValuesOpts.data?.attribute?.choices?.pageInfo ?.hasNextPage, loading: !!searchAttributeValuesOpts.loading, - onFetchMore: loadMoreAttributeValues + onFetchMore: loadMoreAttributeValues, }; if (product === null) { @@ -539,7 +540,7 @@ export const ProductUpdate: React.FC = ({ id, params }) => { open={isChannelsModalOpen} title={intl.formatMessage({ id: "Eau5AV", - defaultMessage: "Manage Products Channel Availability" + defaultMessage: "Manage Products Channel Availability", })} confirmButtonState="default" selected={channelListElements.length} @@ -604,7 +605,7 @@ export const ProductUpdate: React.FC = ({ id, params }) => { color="primary" onClick={() => openModal("remove-variants", { - ids: listElements + ids: listElements, }) } > @@ -656,8 +657,8 @@ export const ProductUpdate: React.FC = ({ id, params }) => { onConfirm={() => bulkProductVariantDelete({ variables: { - ids: params.ids - } + ids: params.ids, + }, }) } variant="delete" @@ -668,7 +669,7 @@ export const ProductUpdate: React.FC = ({ id, params }) => { {...messages.deleteVariantDialogSubtitle} values={{ counter: params?.ids?.length, - displayQuantity: {params?.ids?.length} + displayQuantity: {params?.ids?.length}, }} /> diff --git a/src/products/views/ProductUpdate/consts.ts b/src/products/views/ProductUpdate/consts.ts index 60af0ec27..5d27b9c50 100644 --- a/src/products/views/ProductUpdate/consts.ts +++ b/src/products/views/ProductUpdate/consts.ts @@ -5,7 +5,7 @@ export const CHANNELS_AVAILIABILITY_MODAL_SELECTOR = "open-channels-picker"; export const initialChannelWithVariantData: ChannelWithVariantData = { variantsIdsToRemove: [], variantsIdsToAdd: [], - selectedVariantsIds: [] + selectedVariantsIds: [], }; export const PRODUCT_UPDATE_FORM_ID = Symbol(); diff --git a/src/products/views/ProductUpdate/handlers/index.ts b/src/products/views/ProductUpdate/handlers/index.ts index 0b305dec2..9ffefed66 100644 --- a/src/products/views/ProductUpdate/handlers/index.ts +++ b/src/products/views/ProductUpdate/handlers/index.ts @@ -2,12 +2,12 @@ import { FetchResult } from "@apollo/client"; import { getAttributesAfterFileAttributesUpdate, mergeAttributeValueDeleteErrors, - mergeFileUploadErrors + mergeFileUploadErrors, } from "@saleor/attributes/utils/data"; import { handleDeleteMultipleAttributeValues, handleUploadMultipleFiles, - prepareAttributesInput + prepareAttributesInput, } from "@saleor/attributes/utils/handlers"; import { ChannelData } from "@saleor/channels/utils"; import { VALUES_PAGINATE_BY } from "@saleor/config"; @@ -36,12 +36,12 @@ import { StockErrorFragment, UploadErrorFragment, VariantCreateMutation, - VariantCreateMutationVariables + VariantCreateMutationVariables, } from "@saleor/graphql"; import { ProductUpdatePageSubmitData } from "@saleor/products/components/ProductUpdatePage"; import { getAttributeInputFromProduct, - mapFormsetStockToStockInput + mapFormsetStockToStockInput, } from "@saleor/products/utils/data"; import { ReorderEvent } from "@saleor/types"; import { move } from "@saleor/utils/lists"; @@ -53,7 +53,7 @@ import { getSimpleChannelsVariables, getSimpleProductErrors, getSimpleProductVariables, - getVariantChannelsInput + getVariantChannelsInput, } from "./utils"; type SubmitErrors = Array< @@ -69,13 +69,13 @@ export function createUpdateHandler( product: ProductFragment, allChannels: ChannelData[], uploadFile: ( - variables: FileUploadMutationVariables + variables: FileUploadMutationVariables, ) => Promise>, updateProduct: ( - variables: ProductUpdateMutationVariables + variables: ProductUpdateMutationVariables, ) => Promise>, updateSimpleProduct: ( - variables: SimpleProductUpdateMutationVariables + variables: SimpleProductUpdateMutationVariables, ) => Promise>, updateChannels: (options: { variables: ProductChannelListingUpdateMutationVariables; @@ -87,31 +87,31 @@ export function createUpdateHandler( variables: VariantCreateMutationVariables; }) => Promise>, deleteAttributeValue: ( - variables: AttributeValueDeleteMutationVariables - ) => Promise> + variables: AttributeValueDeleteMutationVariables, + ) => Promise>, ) { return async (data: ProductUpdatePageSubmitData) => { let errors: SubmitErrors = []; const uploadFilesResult = await handleUploadMultipleFiles( data.attributesWithNewFileValue, - uploadFile + uploadFile, ); const deleteAttributeValuesResult = await handleDeleteMultipleAttributeValues( data.attributesWithNewFileValue, product?.attributes, - deleteAttributeValue + deleteAttributeValue, ); errors = [ ...errors, ...mergeFileUploadErrors(uploadFilesResult), - ...mergeAttributeValueDeleteErrors(deleteAttributeValuesResult) + ...mergeAttributeValueDeleteErrors(deleteAttributeValuesResult), ]; const updatedFileAttributes = getAttributesAfterFileAttributesUpdate( data.attributesWithNewFileValue, - uploadFilesResult + uploadFilesResult, ); const productVariables: ProductUpdateMutationVariables = { @@ -120,7 +120,7 @@ export function createUpdateHandler( attributes: prepareAttributesInput({ attributes: data.attributes, prevAttributes: getAttributeInputFromProduct(product), - updatedFileAttributes + updatedFileAttributes, }), category: data.category, chargeTaxes: data.chargeTaxes, @@ -130,12 +130,12 @@ export function createUpdateHandler( rating: data.rating, seo: { description: data.seoDescription, - title: data.seoTitle + title: data.seoTitle, }, slug: data.slug, - taxCode: data.changeTaxCode ? data.taxCode : null + taxCode: data.changeTaxCode ? data.taxCode : null, }, - firstValues: VALUES_PAGINATE_BY + firstValues: VALUES_PAGINATE_BY, }; if (product.productType.hasVariants) { @@ -155,17 +155,17 @@ export function createUpdateHandler( attributes: product.productType.variantAttributes?.map(attribute => ({ id: attribute.id, - values: attribute.choices.edges.map(value => value.node.slug) + values: attribute.choices.edges.map(value => value.node.slug), })) || [], product: product.id, sku: data.sku, - stocks: data.updateStocks.map(mapFormsetStockToStockInput) - } - } + stocks: data.updateStocks.map(mapFormsetStockToStockInput), + }, + }, }); errors = [ ...errors, - ...productVariantResult.data.productVariantCreate.errors + ...productVariantResult.data.productVariantCreate.errors, ]; const variantId = @@ -175,16 +175,16 @@ export function createUpdateHandler( updateVariantChannels({ variables: { id: variantId, - input: getVariantChannelsInput(data) - } + input: getVariantChannelsInput(data), + }, }); await updateChannels( - getChannelsVariables(product, allChannels, data) + getChannelsVariables(product, allChannels, data), ); const result = await updateSimpleProduct( - getSimpleProductVariables(productVariables, data, variantId) + getSimpleProductVariables(productVariables, data, variantId), ); errors = [...errors, ...getSimpleProductErrors(result.data)]; } @@ -193,8 +193,8 @@ export function createUpdateHandler( getSimpleProductVariables( productVariables, data, - product.variants[0].id - ) + product.variants[0].id, + ), ); errors = [...errors, ...getSimpleProductErrors(result.data)]; @@ -203,8 +203,8 @@ export function createUpdateHandler( updateVariantChannels({ variables: { id: product.variants[0].id, - input: getVariantChannelsInput(data) - } + input: getVariantChannelsInput(data), + }, }); } } @@ -215,28 +215,28 @@ export function createUpdateHandler( export function createImageUploadHandler( id: string, - createProductImage: (variables: ProductMediaCreateMutationVariables) => void + createProductImage: (variables: ProductMediaCreateMutationVariables) => void, ) { return (file: File) => createProductImage({ alt: "", image: file, - product: id + product: id, }); } export function createImageReorderHandler( product: ProductFragment, reorderProductImages: ( - variables: ProductMediaReorderMutationVariables - ) => void + variables: ProductMediaReorderMutationVariables, + ) => void, ) { return ({ newIndex, oldIndex }: ReorderEvent) => { let ids = product.media.map(image => image.id); ids = arrayMove(ids, oldIndex, newIndex); reorderProductImages({ mediaIds: ids, - productId: product.id + productId: product.id, }); }; } @@ -250,8 +250,8 @@ export function createVariantReorderHandler< >( product: T, reorderProductVariants: ( - variables: ProductVariantReorderMutationVariables - ) => void + variables: ProductVariantReorderMutationVariables, + ) => void, ) { return ({ newIndex, oldIndex }: ReorderEvent) => { const oldVariantOrder = [...product.variants]; @@ -261,16 +261,16 @@ export function createVariantReorderHandler< product.variants[oldIndex], product!.variants, areVariantsEqual, - newIndex - ) + newIndex, + ), ]; reorderProductVariants({ move: { id: oldVariantOrder[oldIndex].id, - sortOrder: newIndex - oldIndex + sortOrder: newIndex - oldIndex, }, - productId: product.id + productId: product.id, }); }; } diff --git a/src/products/views/ProductUpdate/handlers/utils.ts b/src/products/views/ProductUpdate/handlers/utils.ts index 6d26d7b01..8b5a9337d 100644 --- a/src/products/views/ProductUpdate/handlers/utils.ts +++ b/src/products/views/ProductUpdate/handlers/utils.ts @@ -1,13 +1,13 @@ import { ChannelData, - createSortedChannelsDataFromProduct + createSortedChannelsDataFromProduct, } from "@saleor/channels/utils"; import { ProductChannelListingAddInput, ProductDetailsVariantFragment, ProductFragment, ProductUpdateMutationVariables, - SimpleProductUpdateMutation + SimpleProductUpdateMutation, } from "@saleor/graphql"; import { weight } from "@saleor/misc"; import { getById } from "@saleor/orders/components/OrderReturnPage/utils"; @@ -24,14 +24,14 @@ import { getParsedChannelsWithVariantsDataFromChannels } from "../utils"; export const getSimpleProductVariables = ( productVariables: ProductUpdateMutationVariables, data: ProductUpdatePageSubmitData, - productId: string + productId: string, ) => ({ ...productVariables, addStocks: data.addStocks.map(mapFormsetStockToStockInput), deleteStocks: data.removeStocks, input: { ...productVariables.input, - weight: weight(data.weight) + weight: weight(data.weight), }, productVariantId: productId, productVariantInput: { @@ -42,18 +42,18 @@ export const getSimpleProductVariables = ( globalThreshold: data.globalThreshold ? parseInt(data.globalThreshold, 10) : null, - endDate: data.preorderEndDateTime + endDate: data.preorderEndDateTime, } - : undefined + : undefined, }, - updateStocks: data.updateStocks.map(mapFormsetStockToStockInput) + updateStocks: data.updateStocks.map(mapFormsetStockToStockInput), }); export const getSimpleProductErrors = (data: SimpleProductUpdateMutation) => [ ...data.productUpdate.errors, ...data.productVariantStocksCreate.errors, ...data.productVariantStocksDelete.errors, - ...data.productVariantStocksUpdate.errors + ...data.productVariantStocksUpdate.errors, ]; export const getChannelListingBaseInputData = ({ @@ -62,53 +62,53 @@ export const getChannelListingBaseInputData = ({ publicationDate, isAvailableForPurchase, availableForPurchase, - visibleInListings + visibleInListings, }: ChannelData) => ({ channelId, isPublished, publicationDate, visibleInListings, isAvailableForPurchase, - availableForPurchaseDate: availableForPurchase + availableForPurchaseDate: availableForPurchase, }); export const getChannelListingUpdateInputFromData = ( { variantsIdsToAdd, variantsIdsToRemove }: ChannelWithVariantData, { selectedVariantsIds: initialSelectedVariantsIds }: ChannelWithVariantData, - basicChannelData: ChannelData + basicChannelData: ChannelData, ) => ({ ...getChannelListingBaseInputData(basicChannelData), addVariants: arrayDiff(initialSelectedVariantsIds, variantsIdsToAdd).added, - removeVariants: variantsIdsToRemove + removeVariants: variantsIdsToRemove, }); const getParsedChannelsData = ( channelsWithVariants: ChannelsWithVariantsData, initialChannelWithVariants: ChannelsWithVariantsData, - channelsData: ChannelData[] + channelsData: ChannelData[], ): ProductChannelListingAddInput[] => channelsData.map(({ id, ...rest }) => getChannelListingUpdateInputFromData( channelsWithVariants[id], initialChannelWithVariants[id], - { id, ...rest } - ) + { id, ...rest }, + ), ); const shouldRemoveChannel = (allVariants: ProductDetailsVariantFragment[]) => ({ - removeVariants + removeVariants, }: ProductChannelListingAddInput) => isRemovingAllVariants(allVariants, removeVariants); const isRemovingAllVariants = ( allVariants: ProductDetailsVariantFragment[], - removeVariants: string[] + removeVariants: string[], ) => !!removeVariants.length && removeVariants.length === allVariants.length; const shouldUpdateChannel = ( initialChannelWithVariantData, allVariants: ProductDetailsVariantFragment[], - allChannels: ChannelData[] + allChannels: ChannelData[], ) => ({ removeVariants, addVariants, @@ -118,12 +118,12 @@ const shouldUpdateChannel = ( const initialDataInput = getChannelListingUpdateInputFromData( initialChannelWithVariantData[channelId], initialChannelWithVariantData[channelId], - allChannels.find(getById(channelId)) + allChannels.find(getById(channelId)), ); const hasDataChanged = !isEqual( { removeVariants, addVariants, channelId, ...rest }, - initialDataInput + initialDataInput, ); const isRemovingChannel = isRemovingAllVariants(allVariants, removeVariants); @@ -134,24 +134,24 @@ const shouldUpdateChannel = ( export const getChannelsVariables = ( { id, variants }: ProductFragment, allChannels: ChannelData[], - { channelsWithVariants, channelsData }: ProductUpdateSubmitData + { channelsWithVariants, channelsData }: ProductUpdateSubmitData, ) => { const initialChannelWithVariants = getParsedChannelsWithVariantsDataFromChannels( - channelsData + channelsData, ); const channelsToBeUpdated = getParsedChannelsData( channelsWithVariants, initialChannelWithVariants, - channelsData + channelsData, ).filter( - shouldUpdateChannel(initialChannelWithVariants, variants, allChannels) + shouldUpdateChannel(initialChannelWithVariants, variants, allChannels), ); const channelsIdsToBeRemoved = getParsedChannelsData( channelsWithVariants, initialChannelWithVariants, - channelsData + channelsData, ) .filter(shouldRemoveChannel(variants)) .map(({ channelId }) => channelId); @@ -161,22 +161,22 @@ export const getChannelsVariables = ( id, input: { updateChannels: channelsToBeUpdated, - removeChannels: channelsIdsToBeRemoved - } - } + removeChannels: channelsIdsToBeRemoved, + }, + }, }; }; export const getSimpleChannelsVariables = ( data: ProductUpdatePageSubmitData, - product: ProductFragment + product: ProductFragment, ) => { const productChannels = createSortedChannelsDataFromProduct(product); const existingChannelIDs = productChannels.map(channel => channel.id); const modifiedChannelIDs = data.channelListings.map(channel => channel.id); const removedChannelIDs = existingChannelIDs.filter( - x => !modifiedChannelIDs.includes(x) + x => !modifiedChannelIDs.includes(x), ); return { @@ -184,18 +184,18 @@ export const getSimpleChannelsVariables = ( id: product.id, input: { updateChannels: getAvailabilityVariables(data.channelListings), - removeChannels: removedChannelIDs - } - } + removeChannels: removedChannelIDs, + }, + }, }; }; export const getVariantChannelsInput = ({ - channelListings + channelListings, }: ProductUpdatePageSubmitData) => channelListings.map(listing => ({ channelId: listing.id, costPrice: listing.costPrice || null, price: listing.price, - preorderThreshold: listing.preorderThreshold + preorderThreshold: listing.preorderThreshold, })); diff --git a/src/products/views/ProductUpdate/useChannelVariantListings.ts b/src/products/views/ProductUpdate/useChannelVariantListings.ts index ed09bf7d8..d6938db71 100644 --- a/src/products/views/ProductUpdate/useChannelVariantListings.ts +++ b/src/products/views/ProductUpdate/useChannelVariantListings.ts @@ -9,12 +9,12 @@ import { createFromChannels, createUpdatedChannels } from "./utils"; function useChannelVariantListings(channels: ChannelData[]) { const initialChannelVariantListing = useMemo( () => createFromChannels(channels, ({ variantsIds }) => variantsIds), - [channels] + [channels], ); const [ updatedChannelVariantListing, - setUpdatedChannelVariantListing + setUpdatedChannelVariantListing, ] = useStateFromProps(initialChannelVariantListing); const channelsWithVariantsData = useMemo( @@ -22,16 +22,16 @@ function useChannelVariantListings(channels: ChannelData[]) { createFromChannels(channels, channel => { const diff = arrayDiff( initialChannelVariantListing[channel.id], - updatedChannelVariantListing[channel.id] + updatedChannelVariantListing[channel.id], ); return { selectedVariantsIds: updatedChannelVariantListing[channel.id], variantsIdsToAdd: diff.added, - variantsIdsToRemove: diff.removed + variantsIdsToRemove: diff.removed, }; }), - [updatedChannelVariantListing] + [updatedChannelVariantListing], ); const reset = () => @@ -39,7 +39,7 @@ function useChannelVariantListings(channels: ChannelData[]) { const updatedChannels: ChannelData[] = useMemo( () => createUpdatedChannels(channels, updatedChannelVariantListing), - [channels, updatedChannelVariantListing] + [channels, updatedChannelVariantListing], ); return { @@ -47,7 +47,7 @@ function useChannelVariantListings(channels: ChannelData[]) { channelsWithVariantsData, channelVariantListing: updatedChannelVariantListing, setChannelVariantListing: setUpdatedChannelVariantListing, - reset + reset, }; } diff --git a/src/products/views/ProductUpdate/useChannelsWithProductVariants.test.ts b/src/products/views/ProductUpdate/useChannelsWithProductVariants.test.ts index fedb823e5..5f2c090c4 100644 --- a/src/products/views/ProductUpdate/useChannelsWithProductVariants.test.ts +++ b/src/products/views/ProductUpdate/useChannelsWithProductVariants.test.ts @@ -7,13 +7,13 @@ const channels: ChannelData[] = [ { id: "channel1", name: "Channel 1", - variantsIds: ["variant1", "variant2"] + variantsIds: ["variant1", "variant2"], }, { id: "channel2", name: "Channel 2", - variantsIds: [] - } + variantsIds: [], + }, ]; const variants = ["variant1", "variant2", "variant3", "variant4", "variant5"]; @@ -26,23 +26,23 @@ describe("useChannelsWithProductVariants", () => { const { result } = setupHook(); expect( - result.current.channelsWithVariantsData.channel1.selectedVariantsIds + result.current.channelsWithVariantsData.channel1.selectedVariantsIds, ).toHaveLength(2); expect( - result.current.channelsWithVariantsData.channel1.variantsIdsToAdd + result.current.channelsWithVariantsData.channel1.variantsIdsToAdd, ).toHaveLength(0); expect( - result.current.channelsWithVariantsData.channel1.variantsIdsToRemove + result.current.channelsWithVariantsData.channel1.variantsIdsToRemove, ).toHaveLength(0); expect( - result.current.channelsWithVariantsData.channel2.selectedVariantsIds + result.current.channelsWithVariantsData.channel2.selectedVariantsIds, ).toHaveLength(0); expect( - result.current.channelsWithVariantsData.channel2.variantsIdsToAdd + result.current.channelsWithVariantsData.channel2.variantsIdsToAdd, ).toHaveLength(0); expect( - result.current.channelsWithVariantsData.channel2.variantsIdsToRemove + result.current.channelsWithVariantsData.channel2.variantsIdsToRemove, ).toHaveLength(0); }); @@ -52,23 +52,23 @@ describe("useChannelsWithProductVariants", () => { act(() => result.current.addVariantToChannel("channel1", "variant3")); expect( - result.current.channelsWithVariantsData.channel1.selectedVariantsIds + result.current.channelsWithVariantsData.channel1.selectedVariantsIds, ).toHaveLength(3); expect( - result.current.channelsWithVariantsData.channel1.variantsIdsToAdd + result.current.channelsWithVariantsData.channel1.variantsIdsToAdd, ).toHaveLength(1); expect( - result.current.channelsWithVariantsData.channel1.variantsIdsToRemove + result.current.channelsWithVariantsData.channel1.variantsIdsToRemove, ).toHaveLength(0); expect( - result.current.channelsWithVariantsData.channel2.selectedVariantsIds + result.current.channelsWithVariantsData.channel2.selectedVariantsIds, ).toHaveLength(0); expect( - result.current.channelsWithVariantsData.channel2.variantsIdsToAdd + result.current.channelsWithVariantsData.channel2.variantsIdsToAdd, ).toHaveLength(0); expect( - result.current.channelsWithVariantsData.channel2.variantsIdsToRemove + result.current.channelsWithVariantsData.channel2.variantsIdsToRemove, ).toHaveLength(0); }); @@ -78,23 +78,23 @@ describe("useChannelsWithProductVariants", () => { act(() => result.current.removeVariantFromChannel("channel1", "variant2")); expect( - result.current.channelsWithVariantsData.channel1.selectedVariantsIds + result.current.channelsWithVariantsData.channel1.selectedVariantsIds, ).toHaveLength(1); expect( - result.current.channelsWithVariantsData.channel1.variantsIdsToAdd + result.current.channelsWithVariantsData.channel1.variantsIdsToAdd, ).toHaveLength(0); expect( - result.current.channelsWithVariantsData.channel1.variantsIdsToRemove + result.current.channelsWithVariantsData.channel1.variantsIdsToRemove, ).toHaveLength(1); expect( - result.current.channelsWithVariantsData.channel2.selectedVariantsIds + result.current.channelsWithVariantsData.channel2.selectedVariantsIds, ).toHaveLength(0); expect( - result.current.channelsWithVariantsData.channel2.variantsIdsToAdd + result.current.channelsWithVariantsData.channel2.variantsIdsToAdd, ).toHaveLength(0); expect( - result.current.channelsWithVariantsData.channel2.variantsIdsToRemove + result.current.channelsWithVariantsData.channel2.variantsIdsToRemove, ).toHaveLength(0); }); @@ -105,26 +105,26 @@ describe("useChannelsWithProductVariants", () => { act(() => result.current.toggleAllChannelVariants("channel1")); expect( - result.current.channelsWithVariantsData.channel1.selectedVariantsIds + result.current.channelsWithVariantsData.channel1.selectedVariantsIds, ).toHaveLength(0); expect( - result.current.channelsWithVariantsData.channel1.variantsIdsToAdd + result.current.channelsWithVariantsData.channel1.variantsIdsToAdd, ).toHaveLength(0); expect( - result.current.channelsWithVariantsData.channel1.variantsIdsToRemove + result.current.channelsWithVariantsData.channel1.variantsIdsToRemove, ).toHaveLength(2); // Select all act(() => result.current.toggleAllChannelVariants("channel1")); expect( - result.current.channelsWithVariantsData.channel1.selectedVariantsIds + result.current.channelsWithVariantsData.channel1.selectedVariantsIds, ).toHaveLength(5); expect( - result.current.channelsWithVariantsData.channel1.variantsIdsToAdd + result.current.channelsWithVariantsData.channel1.variantsIdsToAdd, ).toHaveLength(3); expect( - result.current.channelsWithVariantsData.channel1.variantsIdsToRemove + result.current.channelsWithVariantsData.channel1.variantsIdsToRemove, ).toHaveLength(0); }); @@ -135,44 +135,44 @@ describe("useChannelsWithProductVariants", () => { act(result.current.toggleAllChannels); expect( - result.current.channelsWithVariantsData.channel1.selectedVariantsIds + result.current.channelsWithVariantsData.channel1.selectedVariantsIds, ).toHaveLength(5); expect( - result.current.channelsWithVariantsData.channel1.variantsIdsToAdd + result.current.channelsWithVariantsData.channel1.variantsIdsToAdd, ).toHaveLength(3); expect( - result.current.channelsWithVariantsData.channel1.variantsIdsToRemove + result.current.channelsWithVariantsData.channel1.variantsIdsToRemove, ).toHaveLength(0); expect( - result.current.channelsWithVariantsData.channel2.selectedVariantsIds + result.current.channelsWithVariantsData.channel2.selectedVariantsIds, ).toHaveLength(5); expect( - result.current.channelsWithVariantsData.channel2.variantsIdsToAdd + result.current.channelsWithVariantsData.channel2.variantsIdsToAdd, ).toHaveLength(5); expect( - result.current.channelsWithVariantsData.channel2.variantsIdsToRemove + result.current.channelsWithVariantsData.channel2.variantsIdsToRemove, ).toHaveLength(0); // Deselect all act(result.current.toggleAllChannels); expect( - result.current.channelsWithVariantsData.channel1.selectedVariantsIds + result.current.channelsWithVariantsData.channel1.selectedVariantsIds, ).toHaveLength(0); expect( - result.current.channelsWithVariantsData.channel1.variantsIdsToAdd + result.current.channelsWithVariantsData.channel1.variantsIdsToAdd, ).toHaveLength(0); expect( - result.current.channelsWithVariantsData.channel1.variantsIdsToRemove + result.current.channelsWithVariantsData.channel1.variantsIdsToRemove, ).toHaveLength(2); expect( - result.current.channelsWithVariantsData.channel2.selectedVariantsIds + result.current.channelsWithVariantsData.channel2.selectedVariantsIds, ).toHaveLength(0); expect( - result.current.channelsWithVariantsData.channel2.variantsIdsToAdd + result.current.channelsWithVariantsData.channel2.variantsIdsToAdd, ).toHaveLength(0); expect( - result.current.channelsWithVariantsData.channel2.variantsIdsToRemove + result.current.channelsWithVariantsData.channel2.variantsIdsToRemove, ).toHaveLength(0); }); }); diff --git a/src/products/views/ProductUpdate/useChannelsWithProductVariants.ts b/src/products/views/ProductUpdate/useChannelsWithProductVariants.ts index 61fc61064..9f948788b 100644 --- a/src/products/views/ProductUpdate/useChannelsWithProductVariants.ts +++ b/src/products/views/ProductUpdate/useChannelsWithProductVariants.ts @@ -5,32 +5,32 @@ import { UseChannelsWithProductVariants } from "./types"; import useChannelVariantListings from "./useChannelVariantListings"; import { addAllVariantsToAllChannels, - getChannelVariantToggleData + getChannelVariantToggleData, } from "./utils"; const useChannelsWithProductVariants = ( channels: ChannelData[], - variants: string[] + variants: string[], ): UseChannelsWithProductVariants => { const { channelsWithVariantsData, setChannelVariantListing, channelVariantListing, - reset + reset, } = useChannelVariantListings(channels); const handleAddVariant = (channelId: string, variantId: string) => setChannelVariantListing(listings => ({ ...listings, - [channelId]: uniq([...listings[channelId], variantId]) + [channelId]: uniq([...listings[channelId], variantId]), })); const handleRemoveVariant = (channelId: string, variantId: string) => setChannelVariantListing(listings => ({ ...listings, [channelId]: listings[channelId].filter( - selectedVariantId => selectedVariantId !== variantId - ) + selectedVariantId => selectedVariantId !== variantId, + ), })); const toggleAllChannelVariants = (channelId: string) => { @@ -38,13 +38,13 @@ const useChannelsWithProductVariants = ( setChannelVariantListing({ ...channelVariantListing, - [channelId]: getChannelVariantToggleData(variants, isChannelSelected) + [channelId]: getChannelVariantToggleData(variants, isChannelSelected), }); }; const toggleAllChannels = () => setChannelVariantListing(listings => - addAllVariantsToAllChannels(listings, variants) + addAllVariantsToAllChannels(listings, variants), ); return { @@ -55,7 +55,7 @@ const useChannelsWithProductVariants = ( toggleAllChannelVariants, toggleAllChannels, setChannelVariantListing, - reset + reset, }; }; diff --git a/src/products/views/ProductUpdate/utils.ts b/src/products/views/ProductUpdate/utils.ts index bfd6ac0bc..6d2ec5235 100644 --- a/src/products/views/ProductUpdate/utils.ts +++ b/src/products/views/ProductUpdate/utils.ts @@ -6,25 +6,25 @@ import { initialChannelWithVariantData } from "./consts"; import { ChannelsWithVariantsData, ChannelVariantListing, - ChannelWithVariantData + ChannelWithVariantData, } from "./types"; export function createFromChannels( channels: ChannelData[], - cb: (channel: ChannelData) => T + cb: (channel: ChannelData) => T, ): Record { return channels?.reduce( (result: Record, channel) => ({ ...result, - [channel.id]: cb(channel) + [channel.id]: cb(channel), }), - {} + {}, ); } export function createUpdatedChannels( channels: ChannelData[], - listing: ChannelVariantListing + listing: ChannelVariantListing, ): ChannelData[] { return reduce( listing, @@ -33,87 +33,90 @@ export function createUpdatedChannels( { id: channelId, name: channels.find(channel => channel.id === channelId).name, - variantsIds - } as ChannelData + variantsIds, + } as ChannelData, ], - [] + [], ); } export const getParsedChannelsWithVariantsDataFromChannels = ( - channels: ChannelData[] + channels: ChannelData[], ): ChannelsWithVariantsData => createFromChannels( channels, ({ variantsIds }) => ({ ...initialChannelWithVariantData, - selectedVariantsIds: variantsIds - } as ChannelWithVariantData) + selectedVariantsIds: variantsIds, + } as ChannelWithVariantData), ); export const getChannelVariantToggleData = ( variants: string[], - isSelected: boolean + isSelected: boolean, ): string[] => (isSelected ? [] : variants); export const areAllVariantsAtAllChannelsSelected = ( variants: string[] = [], - channelsWithVariants: ChannelVariantListing = {} + channelsWithVariants: ChannelVariantListing = {}, ) => every(channelsWithVariants, channelWithVariantsData => - areAllChannelVariantsSelected(variants, channelWithVariantsData) + areAllChannelVariantsSelected(variants, channelWithVariantsData), ); export const areAllChannelVariantsSelected = ( variants: string[] = [], - selectedVariants: string[] + selectedVariants: string[], ) => selectedVariants.length === variants.length; export const areAnyChannelVariantsSelected = ( - channelsWithVariantsData: ChannelWithVariantData + channelsWithVariantsData: ChannelWithVariantData, ) => channelsWithVariantsData?.selectedVariantsIds.length > 0; export const getTotalSelectedChannelsCount = ( - channelsWithVariantsData: ChannelsWithVariantsData + channelsWithVariantsData: ChannelsWithVariantsData, ) => Object.values(channelsWithVariantsData).filter( - channel => channel.selectedVariantsIds.length > 0 + channel => channel.selectedVariantsIds.length > 0, ).length; export const addAllVariantsToAllChannels = ( listings: ChannelVariantListing, - variants: string[] + variants: string[], ): ChannelVariantListing => { const areAllChannelsSelected = areAllVariantsAtAllChannelsSelected( variants, - listings + listings, ); const updatedListing = reduce( listings, (result: ChannelVariantListing, _, channelId) => ({ ...result, - [channelId]: getChannelVariantToggleData(variants, areAllChannelsSelected) + [channelId]: getChannelVariantToggleData( + variants, + areAllChannelsSelected, + ), }), - {} + {}, ); return updatedListing; }; export const channelVariantListingDiffToDict = ( - listing: ChannelsWithVariantsData + listing: ChannelsWithVariantsData, ): ChannelVariantListing => reduce( listing, ( listingDict: ChannelVariantListing, { selectedVariantsIds }, - channelId + channelId, ) => ({ ...listingDict, - [channelId]: selectedVariantsIds + [channelId]: selectedVariantsIds, }), - {} + {}, ); diff --git a/src/products/views/ProductVariant.tsx b/src/products/views/ProductVariant.tsx index 29d70a32f..fd414b2cf 100644 --- a/src/products/views/ProductVariant.tsx +++ b/src/products/views/ProductVariant.tsx @@ -2,12 +2,12 @@ import placeholderImg from "@assets/images/placeholder255x255.png"; import { getAttributesAfterFileAttributesUpdate, mergeAttributeValueDeleteErrors, - mergeFileUploadErrors + mergeFileUploadErrors, } from "@saleor/attributes/utils/data"; import { handleDeleteMultipleAttributeValues, handleUploadMultipleFiles, - prepareAttributesInput + prepareAttributesInput, } from "@saleor/attributes/utils/handlers"; import { createVariantChannels } from "@saleor/channels/utils"; import { AttributeInput } from "@saleor/components/Attributes"; @@ -29,7 +29,7 @@ import { useVariantMediaAssignMutation, useVariantMediaUnassignMutation, useVariantUpdateMutation, - useWarehouseListQuery + useWarehouseListQuery, } from "@saleor/graphql"; import useNavigator from "@saleor/hooks/useNavigator"; import useNotifier from "@saleor/hooks/useNotifier"; @@ -55,7 +55,7 @@ import { productUrl, productVariantEditUrl, ProductVariantEditUrlDialog, - ProductVariantEditUrlQueryParams + ProductVariantEditUrlQueryParams, } from "../urls"; import { mapFormsetStockToStockInput } from "../utils/data"; import { createVariantReorderHandler } from "./ProductUpdate/handlers"; @@ -69,14 +69,14 @@ interface ProductUpdateProps { export const ProductVariant: React.FC = ({ variantId, productId, - params + params, }) => { const shop = useShop(); const navigate = useNavigator(); const notify = useNotifier(); const intl = useIntl(); const [errors, setErrors] = useState( - [] + [], ); useEffect(() => { setErrors([]); @@ -85,23 +85,23 @@ export const ProductVariant: React.FC = ({ const warehouses = useWarehouseListQuery({ displayLoader: true, variables: { - first: 50 - } + first: 50, + }, }); const { data, loading } = useProductVariantDetailsQuery({ displayLoader: true, variables: { id: variantId, - firstValues: 10 - } + firstValues: 10, + }, }); const [updateMetadata] = useUpdateMetadataMutation({}); const [updatePrivateMetadata] = useUpdatePrivateMetadataMutation({}); const [ updateChannels, - updateChannelsOpts + updateChannelsOpts, ] = useProductVariantChannelListingUpdateMutation({}); const [openModal] = createDialogActionHandlers< @@ -110,14 +110,14 @@ export const ProductVariant: React.FC = ({ >( navigate, params => productVariantEditUrl(productId, variantId, params), - params + params, ); const [uploadFile, uploadFileOpts] = useFileUploadMutation({}); const [assignMedia, assignMediaOpts] = useVariantMediaAssignMutation({}); const [unassignMedia, unassignMediaOpts] = useVariantMediaUnassignMutation( - {} + {}, ); const [deleteVariant, deleteVariantOpts] = useVariantDeleteMutation({ onCompleted: () => { @@ -125,11 +125,11 @@ export const ProductVariant: React.FC = ({ status: "success", text: intl.formatMessage({ id: "BUKMzM", - defaultMessage: "Variant removed" - }) + defaultMessage: "Variant removed", + }), }); navigate(productUrl(productId)); - } + }, }); const [updateVariant, updateVariantOpts] = useVariantUpdateMutation({ @@ -137,25 +137,25 @@ export const ProductVariant: React.FC = ({ if (data.productVariantUpdate.errors.length === 0) { notify({ status: "success", - text: intl.formatMessage(commonMessages.savedChanges) + text: intl.formatMessage(commonMessages.savedChanges), }); } setErrors(data.productVariantUpdate.errors); - } + }, }); const [ deleteAttributeValue, - deleteAttributeValueOpts + deleteAttributeValueOpts, ] = useAttributeValueDeleteMutation({}); const handleSubmitChannels = async ( data: ProductVariantUpdateSubmitData, - variant: ProductVariantFragment + variant: ProductVariantFragment, ) => { const channelsHaveChanged = data.channelListings.some(channel => { const variantChannel = variant.channelListings.find( - variantChannel => variantChannel.channel.id === channel.id + variantChannel => variantChannel.channel.id === channel.id, ); const priceHasChanged = @@ -183,10 +183,10 @@ export const ProductVariant: React.FC = ({ channelId: listing.id, costPrice: listing.value.costPrice || null, price: listing.value.price, - preorderThreshold: listing.value.preorderThreshold - })) - } - }) + preorderThreshold: listing.value.preorderThreshold, + })), + }, + }), ); } @@ -198,21 +198,21 @@ export const ProductVariant: React.FC = ({ const [ deactivatePreorder, - deactivatePreoderOpts + deactivatePreoderOpts, ] = useProductVariantPreorderDeactivateMutation({}); const handleDeactivateVariantPreorder = (id: string) => deactivatePreorder({ variables: { id } }); const [ reorderProductVariants, - reorderProductVariantsOpts + reorderProductVariantsOpts, ] = useProductVariantReorderMutation({}); const onSetDefaultVariant = useOnSetDefaultVariant(productId, variant); const handleVariantReorder = createVariantReorderHandler( variant?.product, - variables => reorderProductVariants({ variables }) + variables => reorderProductVariants({ variables }), ); const disableFormSave = @@ -232,15 +232,15 @@ export const ProductVariant: React.FC = ({ unassignMedia({ variables: { mediaId: id, - variantId: variant.id - } + variantId: variant.id, + }, }); } else { assignMedia({ variables: { mediaId: id, - variantId: variant.id - } + variantId: variant.id, + }, }); } } @@ -249,18 +249,18 @@ export const ProductVariant: React.FC = ({ const handleUpdate = async (data: ProductVariantUpdateSubmitData) => { const uploadFilesResult = await handleUploadMultipleFiles( data.attributesWithNewFileValue, - variables => uploadFile({ variables }) + variables => uploadFile({ variables }), ); const deleteAttributeValuesResult = await handleDeleteMultipleAttributeValues( data.attributesWithNewFileValue, variant?.nonSelectionAttributes, - variables => deleteAttributeValue({ variables }) + variables => deleteAttributeValue({ variables }), ); const updatedFileAttributes = getAttributesAfterFileAttributesUpdate( data.attributesWithNewFileValue, - uploadFilesResult + uploadFilesResult, ); const result = await updateVariant({ @@ -269,7 +269,7 @@ export const ProductVariant: React.FC = ({ attributes: prepareAttributesInput({ attributes: data.attributes, prevAttributes: getAttributeInputFromVariant(variant), - updatedFileAttributes + updatedFileAttributes, }), id: variantId, removeStocks: data.removeStocks, @@ -282,12 +282,12 @@ export const ProductVariant: React.FC = ({ globalThreshold: data.globalThreshold ? parseInt(data.globalThreshold, 10) : null, - endDate: data?.preorderEndDateTime || null + endDate: data?.preorderEndDateTime || null, } : null, weight: weight(data.weight), - firstValues: 10 - } + firstValues: 10, + }, }); await handleSubmitChannels(data, variant); @@ -297,60 +297,60 @@ export const ProductVariant: React.FC = ({ ...result.data?.productVariantStocksCreate.errors, ...result.data?.productVariantStocksDelete.errors, ...result.data?.productVariantStocksUpdate.errors, - ...result.data?.productVariantUpdate.errors + ...result.data?.productVariantUpdate.errors, ]; }; const handleSubmit = createMetadataUpdateHandler( data?.productVariant, handleUpdate, variables => updateMetadata({ variables }), - variables => updatePrivateMetadata({ variables }) + variables => updatePrivateMetadata({ variables }), ); const handleAssignAttributeReferenceClick = (attribute: AttributeInput) => navigate( productVariantEditUrl(productId, variantId, { action: "assign-attribute-value", - id: attribute.id - }) + id: attribute.id, + }), ); const { loadMore: loadMorePages, search: searchPages, - result: searchPagesOpts + result: searchPagesOpts, } = usePageSearch({ - variables: DEFAULT_INITIAL_SEARCH_DATA + variables: DEFAULT_INITIAL_SEARCH_DATA, }); const { loadMore: loadMoreProducts, search: searchProducts, - result: searchProductsOpts + result: searchProductsOpts, } = useProductSearch({ - variables: DEFAULT_INITIAL_SEARCH_DATA + variables: DEFAULT_INITIAL_SEARCH_DATA, }); const { loadMore: loadMoreAttributeValues, search: searchAttributeValues, result: searchAttributeValuesOpts, - reset: searchAttributeReset + reset: searchAttributeReset, } = useAttributeValueSearchHandler(DEFAULT_INITIAL_SEARCH_DATA); const fetchMoreReferencePages = { hasMore: searchPagesOpts.data?.search?.pageInfo?.hasNextPage, loading: searchPagesOpts.loading, - onFetchMore: loadMorePages + onFetchMore: loadMorePages, }; const fetchMoreReferenceProducts = { hasMore: searchProductsOpts.data?.search?.pageInfo?.hasNextPage, loading: searchProductsOpts.loading, - onFetchMore: loadMoreProducts + onFetchMore: loadMoreProducts, }; const fetchMoreAttributeValues = { hasMore: !!searchAttributeValuesOpts.data?.attribute?.choices?.pageInfo ?.hasNextPage, loading: !!searchAttributeValuesOpts.loading, - onFetchMore: loadMoreAttributeValues + onFetchMore: loadMoreAttributeValues, }; const attributeValues = @@ -418,8 +418,8 @@ export const ProductVariant: React.FC = ({ onConfirm={() => deleteVariant({ variables: { - id: variantId - } + id: variantId, + }, }) } open={params.action === "remove"} diff --git a/src/products/views/ProductVariantCreate.tsx b/src/products/views/ProductVariantCreate.tsx index 9101dfd36..ed46e6bbe 100644 --- a/src/products/views/ProductVariantCreate.tsx +++ b/src/products/views/ProductVariantCreate.tsx @@ -1,7 +1,7 @@ import { getAttributesAfterFileAttributesUpdate } from "@saleor/attributes/utils/data"; import { handleUploadMultipleFiles, - prepareAttributesInput + prepareAttributesInput, } from "@saleor/attributes/utils/handlers"; import { AttributeInput } from "@saleor/components/Attributes"; import NotFoundPage from "@saleor/components/NotFoundPage"; @@ -14,7 +14,7 @@ import { useUpdateMetadataMutation, useUpdatePrivateMetadataMutation, useVariantCreateMutation, - useWarehouseListQuery + useWarehouseListQuery, } from "@saleor/graphql"; import useNavigator from "@saleor/hooks/useNavigator"; import useNotifier from "@saleor/hooks/useNotifier"; @@ -35,7 +35,7 @@ import { productListUrl, productVariantAddUrl, ProductVariantAddUrlQueryParams, - productVariantEditUrl + productVariantEditUrl, } from "../urls"; import { variantCreateMessages as messages } from "./messages"; import { createVariantReorderHandler } from "./ProductUpdate/handlers"; @@ -47,7 +47,7 @@ interface ProductVariantCreateProps { export const ProductVariant: React.FC = ({ productId, - params + params, }) => { const navigate = useNavigator(); const notify = useNotifier(); @@ -57,16 +57,16 @@ export const ProductVariant: React.FC = ({ const warehouses = useWarehouseListQuery({ displayLoader: true, variables: { - first: 50 - } + first: 50, + }, }); const { data, loading: productLoading } = useProductVariantCreateDataQuery({ displayLoader: true, variables: { id: productId, - firstValues: 10 - } + firstValues: 10, + }, }); const [uploadFile, uploadFileOpts] = useFileUploadMutation({}); @@ -79,12 +79,12 @@ export const ProductVariant: React.FC = ({ notify({ status: "success", - text: intl.formatMessage(messages.variantCreatedSuccess) + text: intl.formatMessage(messages.variantCreatedSuccess), }); navigate(productVariantEditUrl(productId, variantId), { - resetScroll: true + resetScroll: true, }); - } + }, }); const [updateMetadata] = useUpdateMetadataMutation({}); @@ -96,22 +96,22 @@ export const ProductVariant: React.FC = ({ const [ reorderProductVariants, - reorderProductVariantsOpts + reorderProductVariantsOpts, ] = useProductVariantReorderMutation({}); const handleVariantReorder = createVariantReorderHandler(product, variables => - reorderProductVariants({ variables }) + reorderProductVariants({ variables }), ); const handleCreate = async (formData: ProductVariantCreateData) => { const uploadFilesResult = await handleUploadMultipleFiles( formData.attributesWithNewFileValue, - variables => uploadFile({ variables }) + variables => uploadFile({ variables }), ); const updatedFileAttributes = getAttributesAfterFileAttributesUpdate( formData.attributesWithNewFileValue, - uploadFilesResult + uploadFilesResult, ); const result = await variantCreate({ @@ -119,16 +119,16 @@ export const ProductVariant: React.FC = ({ input: { attributes: prepareAttributesInput({ attributes: formData.attributes.filter( - attribute => attribute.value?.length && attribute.value[0] !== "" + attribute => attribute.value?.length && attribute.value[0] !== "", ), prevAttributes: null, - updatedFileAttributes + updatedFileAttributes, }), product: productId, sku: formData.sku, stocks: formData.stocks.map(stock => ({ quantity: parseInt(stock.value, 10) || 0, - warehouse: stock.id + warehouse: stock.id, })), trackInventory: true, weight: weight(formData.weight), @@ -139,12 +139,12 @@ export const ProductVariant: React.FC = ({ globalThreshold: formData.globalThreshold ? parseInt(formData.globalThreshold, 10) : null, - endDate: formData.preorderEndDateTime || null + endDate: formData.preorderEndDateTime || null, } - : undefined + : undefined, }, - firstValues: 10 - } + firstValues: 10, + }, }); const id = result.data?.productVariantCreate?.productVariant?.id || null; @@ -154,7 +154,7 @@ export const ProductVariant: React.FC = ({ const handleSubmit = createMetadataCreateHandler( handleCreate, updateMetadata, - updatePrivateMetadata + updatePrivateMetadata, ); const handleVariantClick = (id: string) => navigate(productVariantEditUrl(productId, id)); @@ -163,46 +163,46 @@ export const ProductVariant: React.FC = ({ navigate( productVariantAddUrl(productId, { action: "assign-attribute-value", - id: attribute.id - }) + id: attribute.id, + }), ); const { loadMore: loadMorePages, search: searchPages, - result: searchPagesOpts + result: searchPagesOpts, } = usePageSearch({ - variables: DEFAULT_INITIAL_SEARCH_DATA + variables: DEFAULT_INITIAL_SEARCH_DATA, }); const { loadMore: loadMoreProducts, search: searchProducts, - result: searchProductsOpts + result: searchProductsOpts, } = useProductSearch({ - variables: DEFAULT_INITIAL_SEARCH_DATA + variables: DEFAULT_INITIAL_SEARCH_DATA, }); const { loadMore: loadMoreAttributeValues, search: searchAttributeValues, result: searchAttributeValuesOpts, - reset: searchAttributeReset + reset: searchAttributeReset, } = useAttributeValueSearchHandler(DEFAULT_INITIAL_SEARCH_DATA); const fetchMoreReferencePages = { hasMore: searchPagesOpts.data?.search?.pageInfo?.hasNextPage, loading: searchPagesOpts.loading, - onFetchMore: loadMorePages + onFetchMore: loadMorePages, }; const fetchMoreReferenceProducts = { hasMore: searchProductsOpts.data?.search?.pageInfo?.hasNextPage, loading: searchProductsOpts.loading, - onFetchMore: loadMoreProducts + onFetchMore: loadMoreProducts, }; const fetchMoreAttributeValues = { hasMore: !!searchAttributeValuesOpts.data?.attribute?.choices?.pageInfo ?.hasNextPage, loading: !!searchAttributeValuesOpts.loading, - onFetchMore: loadMoreAttributeValues + onFetchMore: loadMoreAttributeValues, }; const attributeValues = @@ -220,7 +220,7 @@ export const ProductVariant: React.FC = ({ title={intl.formatMessage({ id: "MyM2oR", defaultMessage: "Create variant", - description: "window title" + description: "window title", })} /> = ({ header={intl.formatMessage({ id: "T6dXGG", defaultMessage: "Create Variant", - description: "header" + description: "header", })} product={data?.product} attributeValues={attributeValues} diff --git a/src/products/views/ProductVariantCreator/ProductVariantCreator.tsx b/src/products/views/ProductVariantCreator/ProductVariantCreator.tsx index f34013d24..101659b72 100644 --- a/src/products/views/ProductVariantCreator/ProductVariantCreator.tsx +++ b/src/products/views/ProductVariantCreator/ProductVariantCreator.tsx @@ -3,7 +3,7 @@ import { WindowTitle } from "@saleor/components/WindowTitle"; import { DEFAULT_INITIAL_SEARCH_DATA } from "@saleor/config"; import { useCreateMultipleVariantsDataQuery, - useProductVariantBulkCreateMutation + useProductVariantBulkCreateMutation, } from "@saleor/graphql"; import useNavigator from "@saleor/hooks/useNavigator"; import useNotifier from "@saleor/hooks/useNotifier"; @@ -20,7 +20,7 @@ interface ProductVariantCreatorProps { } const ProductVariantCreator: React.FC = ({ - id + id, }) => { const navigate = useNavigator(); const notify = useNotifier(); @@ -29,12 +29,12 @@ const ProductVariantCreator: React.FC = ({ displayLoader: true, variables: { id, - firstValues: 10 - } + firstValues: 10, + }, }); const [ bulkProductVariantCreate, - bulkProductVariantCreateOpts + bulkProductVariantCreateOpts, ] = useProductVariantBulkCreateMutation({ onCompleted: data => { if (data.productVariantBulkCreate.errors.length === 0) { @@ -43,31 +43,31 @@ const ProductVariantCreator: React.FC = ({ text: intl.formatMessage({ id: "oChkS4", defaultMessage: "Successfully created variants", - description: "success message" - }) + description: "success message", + }), }); navigate(productUrl(id)); } - } + }, }); const limitOpts = useShopLimitsQuery({ variables: { - productVariants: true - } + productVariants: true, + }, }); const { loadMore: loadMoreAttributeValues, search: searchAttributeValues, reset: searchAttributeReset, - result: searchAttributeValuesOpts + result: searchAttributeValuesOpts, } = useAttributeValueSearchHandler(DEFAULT_INITIAL_SEARCH_DATA); const fetchMoreAttributeValues = { hasMore: !!searchAttributeValuesOpts.data?.attribute?.choices?.pageInfo ?.hasNextPage, loading: !!searchAttributeValuesOpts.loading, - onFetchMore: loadMoreAttributeValues + onFetchMore: loadMoreAttributeValues, }; const attributeValues = @@ -79,7 +79,7 @@ const ProductVariantCreator: React.FC = ({ title={intl.formatMessage({ id: "z+wMgQ", defaultMessage: "Create Variants", - description: "window title" + description: "window title", })} /> = ({ currency: listing.channel.currencyCode, id: listing.channel.id, name: listing.channel.name, - price: "" + price: "", }))} attributes={data?.product?.productType?.variantAttributes || []} attributeValues={attributeValues} @@ -100,7 +100,7 @@ const ProductVariantCreator: React.FC = ({ limits={limitOpts.data?.shop?.limits} onSubmit={inputs => bulkProductVariantCreate({ - variables: { id, inputs } + variables: { id, inputs }, }) } onAttributeSelectBlur={searchAttributeReset} diff --git a/src/products/views/messages.ts b/src/products/views/messages.ts index 5933f7e20..2d7309691 100644 --- a/src/products/views/messages.ts +++ b/src/products/views/messages.ts @@ -4,6 +4,6 @@ export const variantCreateMessages = defineMessages({ variantCreatedSuccess: { id: "IeoGgH", defaultMessage: "Variant created", - description: "variant created success message" - } + description: "variant created success message", + }, }); diff --git a/src/searches/useAttributeSearch.ts b/src/searches/useAttributeSearch.ts index f17499cb1..c81940f03 100644 --- a/src/searches/useAttributeSearch.ts +++ b/src/searches/useAttributeSearch.ts @@ -2,7 +2,7 @@ import { gql } from "@apollo/client"; import { SearchAttributesDocument, SearchAttributesQuery, - SearchAttributesQueryVariables + SearchAttributesQueryVariables, } from "@saleor/graphql"; import makeTopLevelSearch from "@saleor/hooks/makeTopLevelSearch"; diff --git a/src/searches/useAttributeValueSearch.ts b/src/searches/useAttributeValueSearch.ts index 3b179859a..21cfd0e4b 100644 --- a/src/searches/useAttributeValueSearch.ts +++ b/src/searches/useAttributeValueSearch.ts @@ -2,7 +2,7 @@ import { gql } from "@apollo/client"; import { SearchAttributeValuesDocument, SearchAttributeValuesQuery, - SearchAttributeValuesQueryVariables + SearchAttributeValuesQueryVariables, } from "@saleor/graphql"; import makeSearch from "@saleor/hooks/makeSearch"; @@ -51,17 +51,17 @@ export default makeSearch< ...prev.attribute.choices, edges: [ ...prev.attribute.choices.edges, - ...next.attribute.choices.edges + ...next.attribute.choices.edges, ], - pageInfo: next.attribute.choices.pageInfo - } - } + pageInfo: next.attribute.choices.pageInfo, + }, + }, }; }, { ...result.variables, - after: result.data.attribute.choices.pageInfo.endCursor - } + after: result.data.attribute.choices.pageInfo.endCursor, + }, ); } }); diff --git a/src/searches/useAvailableInGridAttributesSearch.ts b/src/searches/useAvailableInGridAttributesSearch.ts index 0530e1e0b..94ac74b9e 100644 --- a/src/searches/useAvailableInGridAttributesSearch.ts +++ b/src/searches/useAvailableInGridAttributesSearch.ts @@ -2,7 +2,7 @@ import { gql } from "@apollo/client"; import { SearchAvailableInGridAttributesDocument, SearchAvailableInGridAttributesQuery, - SearchAvailableInGridAttributesQueryVariables + SearchAvailableInGridAttributesQueryVariables, } from "@saleor/graphql"; import makeSearch from "@saleor/hooks/makeSearch"; @@ -51,16 +51,16 @@ export default makeSearch< ...prev.availableInGrid, edges: [ ...prev.availableInGrid.edges, - ...next.availableInGrid.edges + ...next.availableInGrid.edges, ], - pageInfo: next.availableInGrid.pageInfo - } + pageInfo: next.availableInGrid.pageInfo, + }, } as SearchAvailableInGridAttributesQuery; }, { ...result.variables, - after: result.data.availableInGrid.pageInfo.endCursor - } + after: result.data.availableInGrid.pageInfo.endCursor, + }, ); } }); diff --git a/src/searches/useAvailablePageAttributesSearch.ts b/src/searches/useAvailablePageAttributesSearch.ts index 7b01eaa4a..2cf540d8d 100644 --- a/src/searches/useAvailablePageAttributesSearch.ts +++ b/src/searches/useAvailablePageAttributesSearch.ts @@ -2,7 +2,7 @@ import { gql } from "@apollo/client"; import { SearchAvailablePageAttributesDocument, SearchAvailablePageAttributesQuery, - SearchAvailablePageAttributesQueryVariables + SearchAvailablePageAttributesQueryVariables, } from "@saleor/graphql"; import makeSearch from "@saleor/hooks/makeSearch"; @@ -54,15 +54,15 @@ export default makeSearch< ...prev.pageType.availableAttributes, edges: [ ...prev.pageType.availableAttributes.edges, - ...next.pageType.availableAttributes.edges + ...next.pageType.availableAttributes.edges, ], - pageInfo: next.pageType.availableAttributes.pageInfo - } - } + pageInfo: next.pageType.availableAttributes.pageInfo, + }, + }, }; }, { - after: result.data.pageType.availableAttributes.pageInfo.endCursor - } - ) + after: result.data.pageType.availableAttributes.pageInfo.endCursor, + }, + ), ); diff --git a/src/searches/useAvailableProductAttributeSearch.ts b/src/searches/useAvailableProductAttributeSearch.ts index a0ab8b909..0f4288913 100644 --- a/src/searches/useAvailableProductAttributeSearch.ts +++ b/src/searches/useAvailableProductAttributeSearch.ts @@ -2,7 +2,7 @@ import { gql } from "@apollo/client"; import { SearchAvailableProductAttributesDocument, SearchAvailableProductAttributesQuery, - SearchAvailableProductAttributesQueryVariables + SearchAvailableProductAttributesQueryVariables, } from "@saleor/graphql"; import makeSearch from "@saleor/hooks/makeSearch"; @@ -54,15 +54,15 @@ export default makeSearch< ...prev.productType.availableAttributes, edges: [ ...prev.productType.availableAttributes.edges, - ...next.productType.availableAttributes.edges + ...next.productType.availableAttributes.edges, ], - pageInfo: next.productType.availableAttributes.pageInfo - } - } + pageInfo: next.productType.availableAttributes.pageInfo, + }, + }, }; }, { - after: result.data.productType.availableAttributes.pageInfo.endCursor - } - ) + after: result.data.productType.availableAttributes.pageInfo.endCursor, + }, + ), ); diff --git a/src/searches/useCategorySearch.ts b/src/searches/useCategorySearch.ts index 7ad3dd774..54cfbac71 100644 --- a/src/searches/useCategorySearch.ts +++ b/src/searches/useCategorySearch.ts @@ -2,7 +2,7 @@ import { gql } from "@apollo/client"; import { SearchCategoriesDocument, SearchCategoriesQuery, - SearchCategoriesQueryVariables + SearchCategoriesQueryVariables, } from "@saleor/graphql"; import makeTopLevelSearch from "@saleor/hooks/makeTopLevelSearch"; diff --git a/src/searches/useCollectionSearch.ts b/src/searches/useCollectionSearch.ts index 8f40f632c..af1309cf0 100644 --- a/src/searches/useCollectionSearch.ts +++ b/src/searches/useCollectionSearch.ts @@ -2,7 +2,7 @@ import { gql } from "@apollo/client"; import { SearchCollectionsDocument, SearchCollectionsQuery, - SearchCollectionsQueryVariables + SearchCollectionsQueryVariables, } from "@saleor/graphql"; import makeTopLevelSearch from "@saleor/hooks/makeTopLevelSearch"; diff --git a/src/searches/useCustomerSearch.ts b/src/searches/useCustomerSearch.ts index 09e3dfa6a..dcaaaa5a4 100644 --- a/src/searches/useCustomerSearch.ts +++ b/src/searches/useCustomerSearch.ts @@ -2,7 +2,7 @@ import { gql } from "@apollo/client"; import { SearchCustomersDocument, SearchCustomersQuery, - SearchCustomersQueryVariables + SearchCustomersQueryVariables, } from "@saleor/graphql"; import makeTopLevelSearch from "@saleor/hooks/makeTopLevelSearch"; diff --git a/src/searches/useGiftCardTagsSearch.ts b/src/searches/useGiftCardTagsSearch.ts index 0101522cb..168c140af 100644 --- a/src/searches/useGiftCardTagsSearch.ts +++ b/src/searches/useGiftCardTagsSearch.ts @@ -2,7 +2,7 @@ import { gql } from "@apollo/client"; import { SearchGiftCardTagsDocument, SearchGiftCardTagsQuery, - SearchGiftCardTagsQueryVariables + SearchGiftCardTagsQueryVariables, } from "@saleor/graphql"; import makeTopLevelSearch from "@saleor/hooks/makeTopLevelSearch"; diff --git a/src/searches/useOrderVariantSearch.ts b/src/searches/useOrderVariantSearch.ts index 062eb59b5..19f8d2254 100644 --- a/src/searches/useOrderVariantSearch.ts +++ b/src/searches/useOrderVariantSearch.ts @@ -2,7 +2,7 @@ import { gql } from "@apollo/client"; import { SearchOrderVariantDocument, SearchOrderVariantQuery, - SearchOrderVariantQueryVariables + SearchOrderVariantQueryVariables, } from "@saleor/graphql"; import makeTopLevelSearch from "@saleor/hooks/makeTopLevelSearch"; diff --git a/src/searches/usePageSearch.ts b/src/searches/usePageSearch.ts index 76801dba5..ca16a8003 100644 --- a/src/searches/usePageSearch.ts +++ b/src/searches/usePageSearch.ts @@ -2,7 +2,7 @@ import { gql } from "@apollo/client"; import { SearchPagesDocument, SearchPagesQuery, - SearchPagesQueryVariables + SearchPagesQueryVariables, } from "@saleor/graphql"; import makeTopLevelSearch from "@saleor/hooks/makeTopLevelSearch"; @@ -23,5 +23,5 @@ export const searchPages = gql` `; export default makeTopLevelSearch( - SearchPagesDocument + SearchPagesDocument, ); diff --git a/src/searches/usePageTypeSearch.ts b/src/searches/usePageTypeSearch.ts index f6ea375ff..0753aa893 100644 --- a/src/searches/usePageTypeSearch.ts +++ b/src/searches/usePageTypeSearch.ts @@ -2,7 +2,7 @@ import { gql } from "@apollo/client"; import { SearchPageTypesDocument, SearchPageTypesQuery, - SearchPageTypesQueryVariables + SearchPageTypesQueryVariables, } from "@saleor/graphql"; import makeTopLevelSearch from "@saleor/hooks/makeTopLevelSearch"; diff --git a/src/searches/usePermissionGroupSearch.ts b/src/searches/usePermissionGroupSearch.ts index ffb2bdd7f..1828cf953 100644 --- a/src/searches/usePermissionGroupSearch.ts +++ b/src/searches/usePermissionGroupSearch.ts @@ -2,7 +2,7 @@ import { gql } from "@apollo/client"; import { SearchPermissionGroupsDocument, SearchPermissionGroupsQuery, - SearchPermissionGroupsQueryVariables + SearchPermissionGroupsQueryVariables, } from "@saleor/graphql"; import makeTopLevelSearch from "@saleor/hooks/makeTopLevelSearch"; diff --git a/src/searches/useProductSearch.ts b/src/searches/useProductSearch.ts index 2753005c1..d9a3515f0 100644 --- a/src/searches/useProductSearch.ts +++ b/src/searches/useProductSearch.ts @@ -2,7 +2,7 @@ import { gql } from "@apollo/client"; import { SearchProductsDocument, SearchProductsQuery, - SearchProductsQueryVariables + SearchProductsQueryVariables, } from "@saleor/graphql"; import makeTopLevelSearch from "@saleor/hooks/makeTopLevelSearch"; diff --git a/src/searches/useProductTypeSearch.ts b/src/searches/useProductTypeSearch.ts index b82f74392..9b74a2168 100644 --- a/src/searches/useProductTypeSearch.ts +++ b/src/searches/useProductTypeSearch.ts @@ -2,7 +2,7 @@ import { gql } from "@apollo/client"; import { SearchProductTypesDocument, SearchProductTypesQuery, - SearchProductTypesQueryVariables + SearchProductTypesQueryVariables, } from "@saleor/graphql"; import makeTopLevelSearch from "@saleor/hooks/makeTopLevelSearch"; diff --git a/src/searches/useShippingZonesSearch.ts b/src/searches/useShippingZonesSearch.ts index b9cc7bae8..03cb3bf89 100644 --- a/src/searches/useShippingZonesSearch.ts +++ b/src/searches/useShippingZonesSearch.ts @@ -2,7 +2,7 @@ import { gql } from "@apollo/client"; import { SearchShippingZonesDocument, SearchShippingZonesQuery, - SearchShippingZonesQueryVariables + SearchShippingZonesQueryVariables, } from "@saleor/graphql"; import makeTopLevelSearch from "@saleor/hooks/makeTopLevelSearch"; diff --git a/src/searches/useStaffMemberSearch.ts b/src/searches/useStaffMemberSearch.ts index fac173733..7c9e7d289 100644 --- a/src/searches/useStaffMemberSearch.ts +++ b/src/searches/useStaffMemberSearch.ts @@ -2,7 +2,7 @@ import { gql } from "@apollo/client"; import { SearchStaffMembersDocument, SearchStaffMembersQuery, - SearchStaffMembersQueryVariables + SearchStaffMembersQueryVariables, } from "@saleor/graphql"; import makeTopLevelSearch from "@saleor/hooks/makeTopLevelSearch"; diff --git a/src/searches/useWarehouseSearch.ts b/src/searches/useWarehouseSearch.ts index 447be8285..080839869 100644 --- a/src/searches/useWarehouseSearch.ts +++ b/src/searches/useWarehouseSearch.ts @@ -2,7 +2,7 @@ import { gql } from "@apollo/client"; import { SearchWarehousesDocument, SearchWarehousesQuery, - SearchWarehousesQueryVariables + SearchWarehousesQueryVariables, } from "@saleor/graphql"; import makeTopLevelSearch from "@saleor/hooks/makeTopLevelSearch"; diff --git a/src/services/errorTracking/adapters/Sentry.ts b/src/services/errorTracking/adapters/Sentry.ts index 4609c5f30..a670ef0ff 100644 --- a/src/services/errorTracking/adapters/Sentry.ts +++ b/src/services/errorTracking/adapters/Sentry.ts @@ -13,7 +13,7 @@ export const SentryAdapter = (config: Config): TrackerMethods => { Sentry.init({ dsn: config.dsn, environment: config.environment, - ignoreErrors: ["Editor's content can not be saved in read-only mode"] + ignoreErrors: ["Editor's content can not be saved in read-only mode"], }); return true; } @@ -29,6 +29,6 @@ export const SentryAdapter = (config: Config): TrackerMethods => { return { captureException, init, - setUserData + setUserData, }; }; diff --git a/src/services/errorTracking/index.ts b/src/services/errorTracking/index.ts index 23db64011..1351888b8 100644 --- a/src/services/errorTracking/index.ts +++ b/src/services/errorTracking/index.ts @@ -4,8 +4,8 @@ import { ErrorTrackerFactory } from "./trackerFactory"; const errorTracker = ErrorTrackerFactory( SentryAdapter({ dsn: process.env.SENTRY_DSN, - environment: process.env.ENVIRONMENT - }) + environment: process.env.ENVIRONMENT, + }), ); export default errorTracker; diff --git a/src/services/errorTracking/trackerFactory.test.ts b/src/services/errorTracking/trackerFactory.test.ts index 8bfc3b268..62c1ce9e2 100644 --- a/src/services/errorTracking/trackerFactory.test.ts +++ b/src/services/errorTracking/trackerFactory.test.ts @@ -21,7 +21,7 @@ const TestAdapter = (): TrackerMethods => { return { captureException, init, - setUserData + setUserData, }; }; @@ -59,7 +59,7 @@ describe("Error Tracking", () => { const userData = { email: "john@example.com", id: "id", - username: "John Doe" + username: "John Doe", }; errorTracking.setUserData(userData); @@ -68,13 +68,13 @@ describe("Error Tracking", () => { it("Does save user data with proper permission", () => { const errorTracking = ErrorTrackerFactory(TestAdapter(), [ - TrackerPermission.USER_DATA + TrackerPermission.USER_DATA, ]); errorTracking.init(); const userData = { email: "john@example.com", id: "id", - username: "John Doe" + username: "John Doe", }; errorTracking.setUserData(userData); diff --git a/src/services/errorTracking/trackerFactory.ts b/src/services/errorTracking/trackerFactory.ts index 0f9efe8a6..503db840e 100644 --- a/src/services/errorTracking/trackerFactory.ts +++ b/src/services/errorTracking/trackerFactory.ts @@ -2,18 +2,18 @@ import { TrackerMethods, TrackerPermission, UserData } from "./types"; type ErrorTrackerFactory = ( ExtensionFactory: TrackerMethods, - permissions?: TrackerPermission[] + permissions?: TrackerPermission[], ) => TrackerMethods; export const ErrorTrackerFactory: ErrorTrackerFactory = ( extension, - permissions = [] + permissions = [], ) => { let ENABLED = false; const safelyInvoke = any>( fn: T, - permission?: TrackerPermission + permission?: TrackerPermission, ): ReturnType => { const hasPermission = permission !== undefined ? permissions.includes(permission) : true; @@ -38,7 +38,7 @@ export const ErrorTrackerFactory: ErrorTrackerFactory = ( const setUserData: TrackerMethods["setUserData"] = (userData: UserData) => safelyInvoke( () => extension.setUserData(userData), - TrackerPermission.USER_DATA + TrackerPermission.USER_DATA, ); const captureException: TrackerMethods["captureException"] = (e: Error) => @@ -47,6 +47,6 @@ export const ErrorTrackerFactory: ErrorTrackerFactory = ( return { captureException, init, - setUserData + setUserData, }; }; diff --git a/src/services/errorTracking/types.ts b/src/services/errorTracking/types.ts index ad51cd447..b65b748ec 100644 --- a/src/services/errorTracking/types.ts +++ b/src/services/errorTracking/types.ts @@ -11,5 +11,5 @@ export interface TrackerMethods { } export enum TrackerPermission { - USER_DATA + USER_DATA, } diff --git a/src/shipping/components/DeleteShippingRateDialog/DeleteShippingRateDialog.stories.tsx b/src/shipping/components/DeleteShippingRateDialog/DeleteShippingRateDialog.stories.tsx index c1105e889..1bd900d51 100644 --- a/src/shipping/components/DeleteShippingRateDialog/DeleteShippingRateDialog.stories.tsx +++ b/src/shipping/components/DeleteShippingRateDialog/DeleteShippingRateDialog.stories.tsx @@ -3,7 +3,7 @@ import { storiesOf } from "@storybook/react"; import React from "react"; import DeleteShippingRateDialog, { - DeleteShippingRateDialogProps + DeleteShippingRateDialogProps, } from "./DeleteShippingRateDialog"; const props: DeleteShippingRateDialogProps = { @@ -11,7 +11,7 @@ const props: DeleteShippingRateDialogProps = { handleConfirm: () => undefined, name: "Shipping", onClose: () => undefined, - open: true + open: true, }; storiesOf("Shipping / DeleteShippingRateDialog", module) diff --git a/src/shipping/components/DeleteShippingRateDialog/DeleteShippingRateDialog.tsx b/src/shipping/components/DeleteShippingRateDialog/DeleteShippingRateDialog.tsx index 439901944..c30bac90f 100644 --- a/src/shipping/components/DeleteShippingRateDialog/DeleteShippingRateDialog.tsx +++ b/src/shipping/components/DeleteShippingRateDialog/DeleteShippingRateDialog.tsx @@ -18,7 +18,7 @@ export const DeleteShippingRateDialog: React.FC = onClose, handleConfirm, name, - open + open, }) => { const intl = useIntl(); return ( @@ -30,7 +30,7 @@ export const DeleteShippingRateDialog: React.FC = title={intl.formatMessage({ id: "nNeWAx", defaultMessage: "Delete Shipping Method", - description: "dialog header" + description: "dialog header", })} variant="delete" > @@ -40,7 +40,7 @@ export const DeleteShippingRateDialog: React.FC = defaultMessage="Are you sure you want to delete {name}?" description="delete shipping method" values={{ - name: getStringOrPlaceholder(name) + name: getStringOrPlaceholder(name), }} /> diff --git a/src/shipping/components/OrderValue/OrderValue.stories.tsx b/src/shipping/components/OrderValue/OrderValue.stories.tsx index 6d06ec13e..6e1e73fc8 100644 --- a/src/shipping/components/OrderValue/OrderValue.stories.tsx +++ b/src/shipping/components/OrderValue/OrderValue.stories.tsx @@ -8,13 +8,13 @@ import OrderValue, { OrderValueProps } from "./OrderValue"; const props: OrderValueProps = { channels: createShippingChannelsFromRate( - shippingZone.shippingMethods[0].channelListings + shippingZone.shippingMethods[0].channelListings, ), disabled: false, errors: [], orderValueRestricted: true, onChange: () => undefined, - onChannelsChange: () => undefined + onChannelsChange: () => undefined, }; storiesOf("Shipping / Order value rates", module) diff --git a/src/shipping/components/OrderValue/OrderValue.tsx b/src/shipping/components/OrderValue/OrderValue.tsx index 6b0e6fd02..99c92e815 100644 --- a/src/shipping/components/OrderValue/OrderValue.tsx +++ b/src/shipping/components/OrderValue/OrderValue.tsx @@ -3,7 +3,7 @@ import { TableBody, TableCell, TableRow, - Typography + Typography, } from "@material-ui/core"; import VerticalSpacer from "@saleor/apps/components/VerticalSpacer"; import { ChannelShippingData } from "@saleor/channels/utils"; @@ -16,7 +16,7 @@ import { ShippingChannelsErrorFragment } from "@saleor/graphql"; import { ChangeEvent } from "@saleor/hooks/useForm"; import { getFormChannelError, - getFormChannelErrors + getFormChannelErrors, } from "@saleor/utils/errors"; import getShippingErrorMessage from "@saleor/utils/errors/shipping"; import React from "react"; @@ -45,13 +45,13 @@ export const OrderValue: React.FC = ({ orderValueRestricted, disabled, onChannelsChange, - onChange + onChange, }) => { const classes = useStyles({}); const intl = useIntl(); const formErrors = getFormChannelErrors( ["maximumOrderPrice", "minimumOrderPrice"], - errors + errors, ); return ( @@ -60,7 +60,7 @@ export const OrderValue: React.FC = ({ title={intl.formatMessage({ id: "yatGsm", defaultMessage: "Order Value", - description: "card title" + description: "card title", })} />
@@ -78,7 +78,7 @@ export const OrderValue: React.FC = ({ {intl.formatMessage({ id: "aZDHYr", defaultMessage: "This rate will apply to all orders", - description: "price rates info" + description: "price rates info", })} @@ -130,11 +130,11 @@ export const OrderValue: React.FC = ({ {channels?.map(channel => { const minError = getFormChannelError( formErrors.minimumOrderPrice, - channel.id + channel.id, ); const maxError = getFormChannelError( formErrors.maximumOrderPrice, - channel.id + channel.id, ); return ( @@ -148,14 +148,14 @@ export const OrderValue: React.FC = ({ error={!!minError} label={intl.formatMessage({ id: "kN6SLs", - defaultMessage: "Min Value" + defaultMessage: "Min Value", })} name={`minValue:${channel.name}`} value={channel.minValue} onChange={e => onChannelsChange(channel.id, { ...channel, - minValue: e.target.value + minValue: e.target.value, }) } currencySymbol={channel.currency} @@ -170,7 +170,7 @@ export const OrderValue: React.FC = ({ error={!!maxError} label={intl.formatMessage({ id: "vjsfyn", - defaultMessage: "Max Value" + defaultMessage: "Max Value", })} name={`maxValue:${channel.name}`} value={channel.maxValue} @@ -178,7 +178,7 @@ export const OrderValue: React.FC = ({ onChange={e => onChannelsChange(channel.id, { ...channel, - maxValue: e.target.value + maxValue: e.target.value, }) } currencySymbol={channel.currency} diff --git a/src/shipping/components/OrderValue/styles.ts b/src/shipping/components/OrderValue/styles.ts index 17d4badf7..fc83392d4 100644 --- a/src/shipping/components/OrderValue/styles.ts +++ b/src/shipping/components/OrderValue/styles.ts @@ -5,30 +5,30 @@ export const useStyles = makeStyles( colName: { fontSize: 14, paddingLeft: 0, - width: "auto" + width: "auto", }, colType: { fontSize: 14, textAlign: "right", - width: 250 + width: 250, }, content: { - padding: theme.spacing(3, 0, 3, 0) + padding: theme.spacing(3, 0, 3, 0), }, info: { - fontSize: 14 + fontSize: 14, }, price: { - verticalAlign: "top" + verticalAlign: "top", }, subheader: { - padding: theme.spacing(0, 3, 0, 3) + padding: theme.spacing(0, 3, 0, 3), }, table: { - tableLayout: "fixed" - } + tableLayout: "fixed", + }, }), { - name: "OrderValue" - } + name: "OrderValue", + }, ); diff --git a/src/shipping/components/OrderWeight/OrderWeight.stories.tsx b/src/shipping/components/OrderWeight/OrderWeight.stories.tsx index 5b12bb077..c76d653fe 100644 --- a/src/shipping/components/OrderWeight/OrderWeight.stories.tsx +++ b/src/shipping/components/OrderWeight/OrderWeight.stories.tsx @@ -11,7 +11,7 @@ const props: OrderWeightProps = { maxValue: "2", minValue: "1", orderValueRestricted: true, - onChange: () => undefined + onChange: () => undefined, }; storiesOf("Shipping / Order weight rates", module) @@ -26,7 +26,7 @@ storiesOf("Shipping / Order weight rates", module) __typename: "ShippingError", code: ShippingErrorCode.INVALID, field, - message: "Shipping code invalid" + message: "Shipping code invalid", }))} /> )); diff --git a/src/shipping/components/OrderWeight/OrderWeight.tsx b/src/shipping/components/OrderWeight/OrderWeight.tsx index 1907db634..3bacd26b0 100644 --- a/src/shipping/components/OrderWeight/OrderWeight.tsx +++ b/src/shipping/components/OrderWeight/OrderWeight.tsx @@ -3,7 +3,7 @@ import { CardContent, InputAdornment, TextField, - Typography + Typography, } from "@material-ui/core"; import VerticalSpacer from "@saleor/apps/components/VerticalSpacer"; import CardTitle from "@saleor/components/CardTitle"; @@ -33,7 +33,7 @@ export const OrderWeight: React.FC = ({ errors, maxValue = "", minValue = "", - onChange + onChange, }) => { const classes = useStyles({}); const intl = useIntl(); @@ -48,7 +48,7 @@ export const OrderWeight: React.FC = ({ title={intl.formatMessage({ id: "vWapBZ", defaultMessage: "Order Weight", - description: "card title" + description: "card title", })} /> @@ -82,19 +82,19 @@ export const OrderWeight: React.FC = ({ disabled={disabled} helperText={getShippingWeightRateErrorMessage( formErrors.minimumOrderWeight, - intl + intl, )} error={!!formErrors.minimumOrderWeight} fullWidth label={intl.formatMessage({ id: "w+5Djm", - defaultMessage: "Min. Order Weight" + defaultMessage: "Min. Order Weight", })} name="minValue" type="number" inputProps={{ min: 0, - type: "number" + type: "number", }} InputProps={{ inputProps: { min: 0 }, @@ -102,7 +102,7 @@ export const OrderWeight: React.FC = ({ {shop?.defaultWeightUnit} - ) + ), }} value={minValue} onChange={onChange} @@ -111,13 +111,13 @@ export const OrderWeight: React.FC = ({ disabled={disabled} helperText={getShippingWeightRateErrorMessage( formErrors.maximumOrderWeight, - intl + intl, )} error={!!formErrors.maximumOrderWeight} fullWidth label={intl.formatMessage({ id: "u0V06N", - defaultMessage: "Max. Order Weight" + defaultMessage: "Max. Order Weight", })} name="maxValue" type="number" @@ -127,7 +127,7 @@ export const OrderWeight: React.FC = ({ {shop?.defaultWeightUnit} - ) + ), }} value={maxValue} onChange={onChange} diff --git a/src/shipping/components/OrderWeight/styles.ts b/src/shipping/components/OrderWeight/styles.ts index cd920ef7b..5ae95667b 100644 --- a/src/shipping/components/OrderWeight/styles.ts +++ b/src/shipping/components/OrderWeight/styles.ts @@ -5,10 +5,10 @@ export const useStyles = makeStyles( grid: { display: "grid", gridColumnGap: theme.spacing(2), - gridTemplateColumns: "1fr 1fr" - } + gridTemplateColumns: "1fr 1fr", + }, }), { - name: "OrderWeight" - } + name: "OrderWeight", + }, ); diff --git a/src/shipping/components/PricingCard/PricingCard.stories.tsx b/src/shipping/components/PricingCard/PricingCard.stories.tsx index 85649002f..bd3b00360 100644 --- a/src/shipping/components/PricingCard/PricingCard.stories.tsx +++ b/src/shipping/components/PricingCard/PricingCard.stories.tsx @@ -8,11 +8,11 @@ import PricingCard, { PricingCardProps } from "./PricingCard"; const props: PricingCardProps = { channels: createShippingChannelsFromRate( - shippingZone.shippingMethods[0].channelListings + shippingZone.shippingMethods[0].channelListings, ), disabled: false, errors: [], - onChange: () => undefined + onChange: () => undefined, }; storiesOf("Shipping / Pricing Card", module) diff --git a/src/shipping/components/PricingCard/PricingCard.tsx b/src/shipping/components/PricingCard/PricingCard.tsx index 2f2af36d1..a0c8fa99e 100644 --- a/src/shipping/components/PricingCard/PricingCard.tsx +++ b/src/shipping/components/PricingCard/PricingCard.tsx @@ -4,7 +4,7 @@ import { TableBody, TableCell, TableRow, - Typography + Typography, } from "@material-ui/core"; import { ChannelShippingData } from "@saleor/channels/utils"; import CardTitle from "@saleor/components/CardTitle"; @@ -14,7 +14,7 @@ import TableHead from "@saleor/components/TableHead"; import { ShippingChannelsErrorFragment } from "@saleor/graphql"; import { getFormChannelError, - getFormChannelErrors + getFormChannelErrors, } from "@saleor/utils/errors"; import getShippingErrorMessage from "@saleor/utils/errors/shipping"; import React from "react"; @@ -41,7 +41,7 @@ export const PricingCard: React.FC = ({ channels, disabled, errors, - onChange + onChange, }) => { const classes = useStyles({}); const intl = useIntl(); @@ -53,7 +53,7 @@ export const PricingCard: React.FC = ({ title={intl.formatMessage({ id: "TnTi/a", defaultMessage: "Pricing", - description: "pricing card title" + description: "pricing card title", })} /> @@ -62,7 +62,7 @@ export const PricingCard: React.FC = ({ id: "VvA7ai", defaultMessage: "Channels that don’t have assigned prices will use their parent channel to define the price. Price will be converted to channel’s currency", - description: "info text" + description: "info text", })} @@ -102,14 +102,14 @@ export const PricingCard: React.FC = ({ label={intl.formatMessage({ id: "1shOIS", defaultMessage: "Price", - description: "column title" + description: "column title", })} name="price" value={channel.price} onChange={e => onChange(channel.id, { ...channel, - price: e.target.value + price: e.target.value, }) } currencySymbol={channel.currency} diff --git a/src/shipping/components/PricingCard/styles.ts b/src/shipping/components/PricingCard/styles.ts index 6844cbcbe..813c37d63 100644 --- a/src/shipping/components/PricingCard/styles.ts +++ b/src/shipping/components/PricingCard/styles.ts @@ -4,30 +4,30 @@ export const useStyles = makeStyles( theme => ({ caption: { fontSize: 14, - padding: theme.spacing(0, 3, 2, 3) + padding: theme.spacing(0, 3, 2, 3), }, colName: { fontSize: 14, paddingLeft: 0, - width: "auto" + width: "auto", }, colType: { fontSize: 14, textAlign: "right", - width: 250 + width: 250, }, pricingContent: { "&:last-child": { - paddingBottom: 0 + paddingBottom: 0, }, paddingLeft: 0, - paddingRight: 0 + paddingRight: 0, }, table: { - tableLayout: "fixed" - } + tableLayout: "fixed", + }, }), { - name: "PricingCard" - } + name: "PricingCard", + }, ); diff --git a/src/shipping/components/ShippingMethodProducts/ShippingMethodProducts.stories.tsx b/src/shipping/components/ShippingMethodProducts/ShippingMethodProducts.stories.tsx index 5f2f5a8f0..cb3e178ca 100644 --- a/src/shipping/components/ShippingMethodProducts/ShippingMethodProducts.stories.tsx +++ b/src/shipping/components/ShippingMethodProducts/ShippingMethodProducts.stories.tsx @@ -6,11 +6,11 @@ import { storiesOf } from "@storybook/react"; import React from "react"; import ShippingMethodProducts, { - ShippingMethodProductsProps + ShippingMethodProductsProps, } from "./ShippingMethodProducts"; const products = mapEdgesToItems( - shippingZone.shippingMethods[0].excludedProducts + shippingZone.shippingMethods[0].excludedProducts, ); const props: ShippingMethodProductsProps = { @@ -22,7 +22,7 @@ const props: ShippingMethodProductsProps = { selected: products.length, toggle: () => undefined, toggleAll: () => undefined, - toolbar: () => undefined + toolbar: () => undefined, }; storiesOf("Shipping / ShippingMethodProducts", module) diff --git a/src/shipping/components/ShippingMethodProducts/ShippingMethodProducts.tsx b/src/shipping/components/ShippingMethodProducts/ShippingMethodProducts.tsx index 2d320630e..e4247ded9 100644 --- a/src/shipping/components/ShippingMethodProducts/ShippingMethodProducts.tsx +++ b/src/shipping/components/ShippingMethodProducts/ShippingMethodProducts.tsx @@ -4,7 +4,7 @@ import { TableCell, TableFooter, TableRow, - Typography + Typography, } from "@material-ui/core"; import { Button } from "@saleor/components/Button"; import CardTitle from "@saleor/components/CardTitle"; @@ -25,22 +25,22 @@ const useStyles = makeStyles( theme => ({ colAction: { "&:last-child": { - paddingRight: theme.spacing(3) + paddingRight: theme.spacing(3), }, textAlign: "right", - width: 100 + width: 100, }, colName: { - width: "auto" + width: "auto", }, colProductName: { - paddingLeft: 0 + paddingLeft: 0, }, table: { - tableLayout: "fixed" - } + tableLayout: "fixed", + }, }), - { name: "ShippingMethodProducts" } + { name: "ShippingMethodProducts" }, ); export interface ShippingMethodProductsProps @@ -65,7 +65,7 @@ const ShippingMethodProducts: React.FC = props => { selected, toggle, toggleAll, - toolbar + toolbar, } = props; const classes = useStyles(props); @@ -77,7 +77,7 @@ const ShippingMethodProducts: React.FC = props => { title={intl.formatMessage({ id: "t3aiWF", defaultMessage: "Excluded Products", - description: "section header" + description: "section header", })} toolbar={
@@ -178,7 +178,7 @@ const ShippingMethodProductsAddDialog: React.FC { const isSelected = selectedProducts.some( - selectedProduct => selectedProduct.id === product.id + selectedProduct => selectedProduct.id === product.id, ); return ( @@ -224,7 +224,7 @@ const ShippingMethodProductsAddDialog: React.FC - ) + ), )} diff --git a/src/shipping/components/ShippingRateInfo/ShippingRateInfo.tsx b/src/shipping/components/ShippingRateInfo/ShippingRateInfo.tsx index 9831bf02c..b80522ce3 100644 --- a/src/shipping/components/ShippingRateInfo/ShippingRateInfo.tsx +++ b/src/shipping/components/ShippingRateInfo/ShippingRateInfo.tsx @@ -17,23 +17,23 @@ const messages = defineMessages({ maxDays: { id: "v17Lly", defaultMessage: "Max Delivery Time", - description: "label" + description: "label", }, minDays: { id: "GD/bom", defaultMessage: "Min Delivery Time", - description: "label" + description: "label", }, name: { id: "FkDObY", defaultMessage: "Shipping rate name", - description: "label" + description: "label", }, description: { id: "TLYeo5", defaultMessage: "Shipping Rate Description", - description: "label" - } + description: "label", + }, }); const useStyles = makeStyles( @@ -44,14 +44,14 @@ const useStyles = makeStyles( gridRowGap: theme.spacing(1), gridTemplateColumns: "1fr 1fr 1fr", [theme.breakpoints.down("md")]: { - gridTemplateColumns: "1fr 1fr" + gridTemplateColumns: "1fr 1fr", }, [theme.breakpoints.down("xs")]: { - gridTemplateColumns: "1fr" - } - } + gridTemplateColumns: "1fr", + }, + }, }), - { name: "ShippingRateInfo" } + { name: "ShippingRateInfo" }, ); export interface ShippingRateInfoProps { @@ -76,12 +76,12 @@ const ShippingRateInfo: React.FC = props => { defaultValue, editorRef, isReadyForMount, - handleChange + handleChange, } = useRichTextContext(); const formErrors = getFormErrors( ["name", "description", "minDays", "maxDays"], - errors + errors, ); return ( @@ -129,7 +129,7 @@ const ShippingRateInfo: React.FC = props => { type="number" inputProps={{ min: 0, - type: "number" + type: "number", }} InputProps={{ inputProps: { min: 0 } }} name="minDays" @@ -145,7 +145,7 @@ const ShippingRateInfo: React.FC = props => { type="number" inputProps={{ min: 0, - type: "number" + type: "number", }} InputProps={{ inputProps: { min: 0 } }} name="maxDays" diff --git a/src/shipping/components/ShippingWeightUnitForm/ShippingWeightUnitForm.tsx b/src/shipping/components/ShippingWeightUnitForm/ShippingWeightUnitForm.tsx index 6cb72277c..308a8aba6 100644 --- a/src/shipping/components/ShippingWeightUnitForm/ShippingWeightUnitForm.tsx +++ b/src/shipping/components/ShippingWeightUnitForm/ShippingWeightUnitForm.tsx @@ -22,11 +22,11 @@ export interface ShippingWeightUnitFormProps { const ShippingWeightUnitForm: React.FC = ({ defaultWeightUnit, disabled, - onSubmit + onSubmit, }) => { const intl = useIntl(); const initialForm: FormData = { - unit: defaultWeightUnit + unit: defaultWeightUnit, }; return ( = ({ disabled={disabled} choices={Object.keys(WeightUnitsEnum).map(unit => ({ label: WeightUnitsEnum[unit], - value: WeightUnitsEnum[unit] + value: WeightUnitsEnum[unit], }))} label={intl.formatMessage({ id: "Rp/Okl", - defaultMessage: "Shipping Weight Unit" + defaultMessage: "Shipping Weight Unit", })} hint={intl.formatMessage({ id: "4Kq3O6", defaultMessage: - "This unit will be used as default shipping weight" + "This unit will be used as default shipping weight", })} name={"unit" as keyof FormData} value={data.unit} diff --git a/src/shipping/components/ShippingZoneAddWarehouseDialog/ShippingZoneAddWarehouseDialog.tsx b/src/shipping/components/ShippingZoneAddWarehouseDialog/ShippingZoneAddWarehouseDialog.tsx index 3439432d7..bd62a92bd 100644 --- a/src/shipping/components/ShippingZoneAddWarehouseDialog/ShippingZoneAddWarehouseDialog.tsx +++ b/src/shipping/components/ShippingZoneAddWarehouseDialog/ShippingZoneAddWarehouseDialog.tsx @@ -3,7 +3,7 @@ import { DialogActions, DialogContent, DialogTitle, - TextField + TextField, } from "@material-ui/core"; import BackButton from "@saleor/components/BackButton"; import CompanyAddressForm from "@saleor/components/CompanyAddressInput/CompanyAddressForm"; @@ -14,7 +14,7 @@ import Hr from "@saleor/components/Hr"; import { AddressTypeInput } from "@saleor/customers/types"; import { CountryWithCodeFragment, - WarehouseErrorFragment + WarehouseErrorFragment, } from "@saleor/graphql"; import useAddressValidation from "@saleor/hooks/useAddressValidation"; import { SubmitPromise } from "@saleor/hooks/useForm"; @@ -53,18 +53,18 @@ const initialForm: ShippingZoneAddWarehouseDialogSubmitData = { phone: "", postalCode: "", streetAddress1: "", - streetAddress2: "" + streetAddress2: "", }; const useStyles = makeStyles( { overflow: { - overflowY: "visible" - } + overflowY: "visible", + }, }, { - name: "ShippingZoneAddWarehouseDialog" - } + name: "ShippingZoneAddWarehouseDialog", + }, ); const ShippingZoneAddWarehouseDialog: React.FC = ({ @@ -74,17 +74,17 @@ const ShippingZoneAddWarehouseDialog: React.FC { const classes = useStyles({}); const [countryDisplayName, setCountryDisplayName] = useStateFromProps(""); const { errors: validationErrors, - submit: handleSubmit + submit: handleSubmit, } = useAddressValidation(onSubmit); const errors = useModalDialogErrors( [...apiErrors, ...validationErrors], - open + open, ); useModalDialogOpen(open, {}); const intl = useIntl(); @@ -111,7 +111,7 @@ const ShippingZoneAddWarehouseDialog: React.FC { const countrySelectionMap = getCountrySelectionMap( countries, - data.countries + data.countries, ); const isRestOfTheWorldSelected = isRestWorldCountriesSelected( restWorldCountries, - countrySelectionMap + countrySelectionMap, ); const handleCountryChange = createCountryChangeHandler( data.countries, - change + change, ); const handleRestOfTheWorldChange = createRestOfTheWorldChangeHandler( countrySelectionMap, data.countries, restWorldCountries, - change + change, ); return ( @@ -112,7 +112,7 @@ const ShippingZoneCountriesAssignDialog: React.FC change(event)} label={intl.formatMessage(messages.searchCountriesLabel)} placeholder={intl.formatMessage( - messages.searchCountriesPlaceholder + messages.searchCountriesPlaceholder, )} fullWidth /> @@ -131,7 +131,7 @@ const ShippingZoneCountriesAssignDialog: React.FC handleRestOfTheWorldChange( - !isRestOfTheWorldSelected + !isRestOfTheWorldSelected, ) } > @@ -168,7 +168,7 @@ const ShippingZoneCountriesAssignDialog: React.FC {filter(countries, data.query, { - key: "country" + key: "country", }).map(country => { const isChecked = countrySelectionMap[country.code]; diff --git a/src/shipping/components/ShippingZoneCountriesAssignDialog/handlers.ts b/src/shipping/components/ShippingZoneCountriesAssignDialog/handlers.ts index 14c16d311..7124700ca 100644 --- a/src/shipping/components/ShippingZoneCountriesAssignDialog/handlers.ts +++ b/src/shipping/components/ShippingZoneCountriesAssignDialog/handlers.ts @@ -2,19 +2,19 @@ import { FormChange } from "@saleor/hooks/useForm"; export function createCountryChangeHandler( selectedCountries: string[], - change: FormChange + change: FormChange, ) { return (countryCode: string, checked: boolean) => { const updatedCountries = checked ? [...selectedCountries, countryCode] : selectedCountries.filter( - selectedCountry => selectedCountry !== countryCode + selectedCountry => selectedCountry !== countryCode, ); change({ target: { name: "countries" as keyof FormData, - value: updatedCountries - } + value: updatedCountries, + }, } as any); }; } @@ -23,7 +23,7 @@ export function createRestOfTheWorldChangeHandler( countrySelectionMap: Map, selectedCountries: string[], restWorldCountries: string[], - change: FormChange + change: FormChange, ) { return (restOfTheWorld: boolean) => { if (restOfTheWorld) { @@ -32,8 +32,8 @@ export function createRestOfTheWorldChangeHandler( name: "countries" as keyof FormData, value: restWorldCountries .filter(countryCode => !countrySelectionMap[countryCode]) - .concat(selectedCountries) - } + .concat(selectedCountries), + }, } as any); } else { change({ @@ -44,9 +44,9 @@ export function createRestOfTheWorldChangeHandler( !( countrySelectionMap[countryCode] && restWorldCountries.includes(countryCode) - ) - ) - } + ), + ), + }, } as any); } }; diff --git a/src/shipping/components/ShippingZoneCountriesAssignDialog/messages.ts b/src/shipping/components/ShippingZoneCountriesAssignDialog/messages.ts index e5e97f8ee..a46f20121 100644 --- a/src/shipping/components/ShippingZoneCountriesAssignDialog/messages.ts +++ b/src/shipping/components/ShippingZoneCountriesAssignDialog/messages.ts @@ -4,48 +4,48 @@ export const messages = defineMessages({ assignCountriesTitle: { id: "cvVIV/", defaultMessage: "Assign Countries", - description: "dialog header" + description: "dialog header", }, assignCountriesDescription: { id: "AjInNW", defaultMessage: "Choose countries you want to add to shipping zone from list below", - description: "dialog description" + description: "dialog description", }, searchCountriesLabel: { id: "pGDYG5", defaultMessage: "Search Countries", - description: "search label" + description: "search label", }, searchCountriesPlaceholder: { id: "1rpzrM", defaultMessage: "Search by country name", - description: "search placeholder" + description: "search placeholder", }, quickPickSubtitle: { id: "f2F1NJ", defaultMessage: "Quick Pick", - description: "section title" + description: "section title", }, countriesSubtitle: { id: "wgA48T", defaultMessage: "Countries A to Z", - description: "country selection" + description: "country selection", }, restOfTheWorldCheckbox: { id: "K/ic0P", defaultMessage: "Rest of the World", - description: "checkbox label" + description: "checkbox label", }, restOfTheWorldCheckboxDescription: { id: "G+9nOZ", defaultMessage: "If selected, this will add all of the countries not selected to other shipping zones", - description: "checkbox description" + description: "checkbox description", }, assignCountriesButton: { id: "LHPVg/", defaultMessage: "Assign and save", - description: "assign countries to shipping zone and save, button" - } + description: "assign countries to shipping zone and save, button", + }, }); diff --git a/src/shipping/components/ShippingZoneCountriesAssignDialog/styles.ts b/src/shipping/components/ShippingZoneCountriesAssignDialog/styles.ts index 41427749f..a16a9972c 100644 --- a/src/shipping/components/ShippingZoneCountriesAssignDialog/styles.ts +++ b/src/shipping/components/ShippingZoneCountriesAssignDialog/styles.ts @@ -4,17 +4,17 @@ export const useStyles = makeStyles( theme => ({ clickableRow: { cursor: "pointer", - userSelect: "none" + userSelect: "none", }, checkboxCell: { - paddingLeft: 0 + paddingLeft: 0, }, table: { - border: "1px solid " + theme.palette.grey[200] + border: "1px solid " + theme.palette.grey[200], }, wideCell: { - width: "100%" - } + width: "100%", + }, }), - { name: "ShippingZoneCountriesAssignDialog" } + { name: "ShippingZoneCountriesAssignDialog" }, ); diff --git a/src/shipping/components/ShippingZoneCreatePage/ShippingZoneCreatePage.tsx b/src/shipping/components/ShippingZoneCreatePage/ShippingZoneCreatePage.tsx index 405b5d517..70aade781 100644 --- a/src/shipping/components/ShippingZoneCreatePage/ShippingZoneCreatePage.tsx +++ b/src/shipping/components/ShippingZoneCreatePage/ShippingZoneCreatePage.tsx @@ -28,18 +28,18 @@ const messages = defineMessages({ countries: { id: "55LMJv", defaultMessage: "Countries", - description: "country list header" + description: "country list header", }, createZone: { id: "6fxdUO", defaultMessage: "Create New Shipping Zone", - description: "section header" + description: "section header", }, noCountriesAssigned: { id: "y7mfbl", defaultMessage: - "Currently, there are no countries assigned to this shipping zone" - } + "Currently, there are no countries assigned to this shipping zone", + }, }); export interface ShippingZoneCreatePageProps { @@ -57,7 +57,7 @@ const ShippingZoneCreatePage: React.FC = ({ disabled, errors, onSubmit, - saveButtonBarState + saveButtonBarState, }) => { const intl = useIntl(); const navigate = useNavigator(); @@ -68,7 +68,7 @@ const ShippingZoneCreatePage: React.FC = ({ const initialForm: ShippingZoneCreateFormData = { countries: [], description: "", - name: "" + name: "", }; return ( @@ -96,7 +96,7 @@ const ShippingZoneCreatePage: React.FC = ({ - countries.find(country => country.code === selectedCountry) + countries.find(country => country.code === selectedCountry), )} disabled={disabled} emptyText={intl.formatMessage(messages.noCountriesAssigned)} @@ -106,9 +106,9 @@ const ShippingZoneCreatePage: React.FC = ({ target: { name: "countries", value: data.countries.filter( - country => country !== countryCode - ) - } + country => country !== countryCode, + ), + }, } as any) } title={intl.formatMessage(messages.countries)} @@ -128,8 +128,8 @@ const ShippingZoneCreatePage: React.FC = ({ change({ target: { name: "countries", - value: formData.countries - } + value: formData.countries, + }, } as any); toggleModal(); }} diff --git a/src/shipping/components/ShippingZoneDetailsPage/ShippingZoneDetailsPage.tsx b/src/shipping/components/ShippingZoneDetailsPage/ShippingZoneDetailsPage.tsx index f4a35da03..7756aee28 100644 --- a/src/shipping/components/ShippingZoneDetailsPage/ShippingZoneDetailsPage.tsx +++ b/src/shipping/components/ShippingZoneDetailsPage/ShippingZoneDetailsPage.tsx @@ -14,7 +14,7 @@ import { ShippingErrorFragment, ShippingMethodTypeEnum, ShippingZoneDetailsFragment, - ShippingZoneQuery + ShippingZoneQuery, } from "@saleor/graphql"; import { SubmitPromise } from "@saleor/hooks/useForm"; import useNavigator from "@saleor/hooks/useNavigator"; @@ -39,18 +39,18 @@ const messages = defineMessages({ countries: { id: "55LMJv", defaultMessage: "Countries", - description: "country list header" + description: "country list header", }, noCountriesAssigned: { id: "y7mfbl", defaultMessage: - "Currently, there are no countries assigned to this shipping zone" + "Currently, there are no countries assigned to this shipping zone", }, shipping: { id: "G0+gAp", defaultMessage: "Shipping", - description: "shipping section header" - } + description: "shipping section header", + }, }); export interface ShippingZoneDetailsPageProps @@ -76,11 +76,11 @@ export interface ShippingZoneDetailsPageProps } function warehouseToChoice( - warehouse: Record<"id" | "name", string> + warehouse: Record<"id" | "name", string>, ): SingleAutocompleteChoiceType { return { label: warehouse.name, - value: warehouse.id + value: warehouse.id, }; } @@ -105,7 +105,7 @@ const ShippingZoneDetailsPage: React.FC = ({ selectedChannelId, shippingZone, warehouses, - allChannels + allChannels, }) => { const intl = useIntl(); const navigate = useNavigator(); @@ -125,7 +125,7 @@ const ShippingZoneDetailsPage: React.FC = ({ >(mapNodeToChoice(shippingZone?.channels)); const { - makeChangeHandler: makeMetadataChangeHandler + makeChangeHandler: makeMetadataChangeHandler, } = useMetadataChangeTrigger(); return ( @@ -140,14 +140,14 @@ const ShippingZoneDetailsPage: React.FC = ({ toggleValue, setWarehouseDisplayValues, warehouseDisplayValues, - warehouseChoices + warehouseChoices, ); const handleChannelChange = createMultiAutocompleteSelectHandler( toggleValue, setChannelDisplayValues, channelsDisplayValues, - channelChoices + channelChoices, ); const changeMetadata = makeMetadataChangeHandler(change); @@ -172,7 +172,7 @@ const ShippingZoneDetailsPage: React.FC = ({ disabled={disabled} emptyText={getStringOrPlaceholder( shippingZone && - intl.formatMessage(messages.noCountriesAssigned) + intl.formatMessage(messages.noCountriesAssigned), )} onCountryAssign={onCountryAdd} onCountryUnassign={onCountryRemove} @@ -185,7 +185,7 @@ const ShippingZoneDetailsPage: React.FC = ({ getRateEditHref={getPriceRateEditHref} onRateRemove={onRateRemove} rates={shippingZone?.shippingMethods?.filter( - method => method.type === ShippingMethodTypeEnum.PRICE + method => method.type === ShippingMethodTypeEnum.PRICE, )} variant="price" selectedChannelId={selectedChannelId} @@ -198,7 +198,7 @@ const ShippingZoneDetailsPage: React.FC = ({ getRateEditHref={getWeightRateEditHref} onRateRemove={onRateRemove} rates={shippingZone?.shippingMethods?.filter( - method => method.type === ShippingMethodTypeEnum.WEIGHT + method => method.type === ShippingMethodTypeEnum.WEIGHT, )} variant="weight" selectedChannelId={selectedChannelId} diff --git a/src/shipping/components/ShippingZoneDetailsPage/utils.ts b/src/shipping/components/ShippingZoneDetailsPage/utils.ts index d7743a2ed..a29998331 100644 --- a/src/shipping/components/ShippingZoneDetailsPage/utils.ts +++ b/src/shipping/components/ShippingZoneDetailsPage/utils.ts @@ -4,12 +4,12 @@ import { mapMetadataItemToInput } from "@saleor/utils/maps"; import { ShippingZoneUpdateFormData } from "./types"; export const getInitialFormData = ( - shippingZone?: ShippingZoneQuery["shippingZone"] + shippingZone?: ShippingZoneQuery["shippingZone"], ): ShippingZoneUpdateFormData => ({ description: shippingZone?.description || "", metadata: shippingZone?.metadata.map(mapMetadataItemToInput), name: shippingZone?.name || "", privateMetadata: shippingZone?.privateMetadata.map(mapMetadataItemToInput), warehouses: shippingZone?.warehouses?.map(warehouse => warehouse.id) || [], - channels: shippingZone?.channels.map(({ id }) => id) || [] + channels: shippingZone?.channels.map(({ id }) => id) || [], }); diff --git a/src/shipping/components/ShippingZoneInfo/ShippingZoneInfo.tsx b/src/shipping/components/ShippingZoneInfo/ShippingZoneInfo.tsx index 2df5f6379..8c79f8120 100644 --- a/src/shipping/components/ShippingZoneInfo/ShippingZoneInfo.tsx +++ b/src/shipping/components/ShippingZoneInfo/ShippingZoneInfo.tsx @@ -13,18 +13,18 @@ const messages = defineMessages({ descriptionCharacterLimit: { id: "ChAjJu", defaultMessage: "{numberOfCharacters} of {maxCharacters} characters", - description: "character limit" + description: "character limit", }, descriptionPlaceholder: { id: "FkRNk+", defaultMessage: "Description of a shipping zone.", - description: "field placeholder" + description: "field placeholder", }, name: { id: "YpukUN", defaultMessage: "Shipping zone name", - description: "label" - } + description: "label", + }, }); export interface ShippingZoneInfoProps { @@ -37,16 +37,16 @@ export interface ShippingZoneInfoProps { const useStyles = makeStyles( { label: { - flex: 1 + flex: 1, }, labelContainer: { "& span": { - paddingRight: 30 + paddingRight: 30, }, - display: "flex" - } + display: "flex", + }, }, - { name: "ShippingZoneCreatePage" } + { name: "ShippingZoneCreatePage" }, ); const MAX_DESCRIPTION_LENGTH = 300; @@ -55,7 +55,7 @@ const ShippingZoneInfo: React.FC = ({ data, disabled, errors, - onChange + onChange, }) => { const intl = useIntl(); const classes = useStyles({}); @@ -75,7 +75,7 @@ const ShippingZoneInfo: React.FC = ({ helperText={getShippingErrorMessage(formErrors.name, intl)} label={intl.formatMessage(messages.name)} inputProps={{ - "data-test-id": "name" + "data-test-id": "name", }} name="name" value={data.name} @@ -96,7 +96,7 @@ const ShippingZoneInfo: React.FC = ({ {...messages.descriptionCharacterLimit} values={{ maxCharacters: MAX_DESCRIPTION_LENGTH, - numberOfCharacters: data.description.length + numberOfCharacters: data.description.length, }} /> @@ -105,8 +105,8 @@ const ShippingZoneInfo: React.FC = ({ } InputProps={{ inputProps: { - maxLength: MAX_DESCRIPTION_LENGTH - } + maxLength: MAX_DESCRIPTION_LENGTH, + }, }} value={data.description} onChange={onChange} diff --git a/src/shipping/components/ShippingZonePostalCodeRangeDialog/ShippingZonePostalCodeRangeDialog.tsx b/src/shipping/components/ShippingZonePostalCodeRangeDialog/ShippingZonePostalCodeRangeDialog.tsx index 14b469d3c..f2100b75c 100644 --- a/src/shipping/components/ShippingZonePostalCodeRangeDialog/ShippingZonePostalCodeRangeDialog.tsx +++ b/src/shipping/components/ShippingZonePostalCodeRangeDialog/ShippingZonePostalCodeRangeDialog.tsx @@ -4,7 +4,7 @@ import { DialogContent, DialogTitle, TextField, - Typography + Typography, } from "@material-ui/core"; import BackButton from "@saleor/components/BackButton"; import ConfirmButton from "@saleor/components/ConfirmButton"; @@ -24,26 +24,26 @@ export interface ShippingZonePostalCodeRangeDialogProps extends DialogProps { const useStyles = makeStyles( theme => ({ info: { - marginBottom: theme.spacing(2) - } + marginBottom: theme.spacing(2), + }, }), { - name: "ShippingZonePostalCodeRangeDialog" - } + name: "ShippingZonePostalCodeRangeDialog", + }, ); const ShippingZonePostalCodeRangeDialog: React.FC = ({ confirmButtonState, open, onClose, - onSubmit + onSubmit, }) => { const classes = useStyles({}); const intl = useIntl(); const initial: MinMax = { max: "", - min: "" + min: "", }; return ( @@ -70,7 +70,7 @@ const ShippingZonePostalCodeRangeDialog: React.FC void; onPostalCodeDelete: ( - code: ShippingMethodTypeFragment["postalCodeRules"][0] + code: ShippingMethodTypeFragment["postalCodeRules"][0], ) => void; onPostalCodeRangeAdd: () => void; } @@ -39,29 +39,29 @@ export interface ShippingZonePostalCodesProps { const useStyles = makeStyles( theme => ({ arrow: { - transition: theme.transitions.create("transform") + transition: theme.transitions.create("transform"), }, arrowRotate: { - transform: "scale(-1)" + transform: "scale(-1)", }, colAction: { - width: 80 + width: 80, }, colCode: {}, option: { marginBottom: theme.spacing(2), - width: 400 + width: 400, }, radioContainer: { - paddingBottom: 0 + paddingBottom: 0, }, skeleton: { - width: 80 - } + width: 80, + }, }), { - name: "ShippingZonePostalCodes" - } + name: "ShippingZonePostalCodes", + }, ); const ShippingZonePostalCodes: React.FC = ({ @@ -70,7 +70,7 @@ const ShippingZonePostalCodes: React.FC = ({ postalCodes, onPostalCodeDelete, onPostalCodeInclusionChange, - onPostalCodeRangeAdd + onPostalCodeRangeAdd, }) => { const [expanded, setExpanded] = React.useState(initialExpanded); const [inclusionType, setInclusionType] = React.useState(null); @@ -93,7 +93,7 @@ const ShippingZonePostalCodes: React.FC = ({ }; const getPostalCodeRangeLabel = ( - postalCodeRange: ShippingMethodTypeFragment["postalCodeRules"][0] + postalCodeRange: ShippingMethodTypeFragment["postalCodeRules"][0], ) => { if (!postalCodeRange?.start) { return ; @@ -110,7 +110,7 @@ const ShippingZonePostalCodes: React.FC = ({ title={intl.formatMessage({ id: "FcTTvh", defaultMessage: "Postal codes", - description: "postal codes, header" + description: "postal codes, header", })} toolbar={
), - value: PostalCodeRuleInclusionTypeEnum.EXCLUDE + value: PostalCodeRuleInclusionTypeEnum.EXCLUDE, }, { label: ( @@ -167,8 +167,8 @@ const ShippingZonePostalCodes: React.FC = ({
), - value: PostalCodeRuleInclusionTypeEnum.INCLUDE - } + value: PostalCodeRuleInclusionTypeEnum.INCLUDE, + }, ]} name="includePostalCodes" value={getInclusionType()} @@ -192,7 +192,7 @@ const ShippingZonePostalCodes: React.FC = ({ defaultMessage="{number} postal code ranges" description="number of postal code ranges" values={{ - number: postalCodes.length + number: postalCodes.length, }} />
@@ -205,7 +205,7 @@ const ShippingZonePostalCodes: React.FC = ({ > @@ -244,7 +244,7 @@ const ShippingZonePostalCodes: React.FC = ({ - ) + ), )} )} diff --git a/src/shipping/components/ShippingZoneRates/ShippingZoneRates.tsx b/src/shipping/components/ShippingZoneRates/ShippingZoneRates.tsx index 0a58a5ee3..d0cad1faa 100644 --- a/src/shipping/components/ShippingZoneRates/ShippingZoneRates.tsx +++ b/src/shipping/components/ShippingZoneRates/ShippingZoneRates.tsx @@ -3,7 +3,7 @@ import { TableBody, TableCell, TableHead, - TableRow + TableRow, } from "@material-ui/core"; import EditIcon from "@material-ui/icons/Edit"; import CardTitle from "@saleor/components/CardTitle"; @@ -21,7 +21,7 @@ import { Button, DeleteIcon, ICONBUTTON_SIZE, - makeStyles + makeStyles, } from "@saleor/macaw-ui"; import { ChannelProps } from "@saleor/types"; import React from "react"; @@ -43,20 +43,20 @@ const useStyles = makeStyles( theme => ({ alignRight: { paddingRight: 24, - width: `calc(${ICONBUTTON_SIZE}px + ${theme.spacing(0.5)})` + width: `calc(${ICONBUTTON_SIZE}px + ${theme.spacing(0.5)})`, }, buttonColumn: { padding: "4px 0", - width: "62px" + width: "62px", }, nameColumn: { - width: "auto" + width: "auto", }, valueColumn: { - width: "auto" - } + width: "auto", + }, }), - { name: "ShippingZoneRates" } + { name: "ShippingZoneRates" }, ); const ShippingZoneRates: React.FC = props => { const { @@ -67,7 +67,7 @@ const ShippingZoneRates: React.FC = props => { rates, selectedChannelId, variant, - testId + testId, } = props; const classes = useStyles(props); @@ -83,12 +83,12 @@ const ShippingZoneRates: React.FC = props => { ? intl.formatMessage({ id: "FjrExY", defaultMessage: "Price Based Rates", - description: "price based shipping methods, section header" + description: "price based shipping methods, section header", }) : intl.formatMessage({ id: "foB6wx", defaultMessage: "Weight Based Rates", - description: "weight based shipping methods, section header" + description: "weight based shipping methods, section header", }) } toolbar={ @@ -116,12 +116,12 @@ const ShippingZoneRates: React.FC = props => { ? intl.formatMessage({ id: "njUQPz", defaultMessage: "Value Range", - description: "shipping method price range" + description: "shipping method price range", }) : intl.formatMessage({ id: "aYhcie", defaultMessage: "Weight Range", - description: "shipping method weight range" + description: "shipping method weight range", })} @@ -140,7 +140,7 @@ const ShippingZoneRates: React.FC = props => { rates, rate => { const channel = rate?.channelListings?.find( - listing => listing.channel.id === selectedChannelId + listing => listing.channel.id === selectedChannelId, ); return ( = props => { to={rate.maximumOrderWeight} /> ), - + , )} @@ -178,7 +178,7 @@ const ShippingZoneRates: React.FC = props => { ) : ( ), - + , )} @@ -211,7 +211,7 @@ const ShippingZoneRates: React.FC = props => { /> - ) + ), )} diff --git a/src/shipping/components/ShippingZoneRatesCreatePage/ShippingZoneRatesCreatePage.stories.tsx b/src/shipping/components/ShippingZoneRatesCreatePage/ShippingZoneRatesCreatePage.stories.tsx index 3f2fea755..ec5d61771 100644 --- a/src/shipping/components/ShippingZoneRatesCreatePage/ShippingZoneRatesCreatePage.stories.tsx +++ b/src/shipping/components/ShippingZoneRatesCreatePage/ShippingZoneRatesCreatePage.stories.tsx @@ -1,13 +1,13 @@ import { PostalCodeRuleInclusionTypeEnum, - ShippingMethodTypeEnum + ShippingMethodTypeEnum, } from "@saleor/graphql"; import Decorator from "@saleor/storybook//Decorator"; import { storiesOf } from "@storybook/react"; import React from "react"; import ShippingZoneRatesCreatePage, { - ShippingZoneRatesCreatePageProps + ShippingZoneRatesCreatePageProps, } from "./ShippingZoneRatesCreatePage"; const channels = [ @@ -17,7 +17,7 @@ const channels = [ maxValue: "10", minValue: "0", name: "channel", - price: "5" + price: "5", }, { currency: "USD", @@ -25,8 +25,8 @@ const channels = [ maxValue: "20", minValue: "1", name: "test", - price: "6" - } + price: "6", + }, ]; const defaultChannels = [ @@ -36,8 +36,8 @@ const defaultChannels = [ maxValue: "", minValue: "", name: "channel", - price: "" - } + price: "", + }, ]; const props: ShippingZoneRatesCreatePageProps = { @@ -60,19 +60,19 @@ const props: ShippingZoneRatesCreatePageProps = { end: "51-200", id: "1", inclusionType: PostalCodeRuleInclusionTypeEnum.EXCLUDE, - start: "51-220" + start: "51-220", }, { __typename: "ShippingMethodPostalCodeRule", end: "31-101", id: "1", inclusionType: PostalCodeRuleInclusionTypeEnum.EXCLUDE, - start: "44-205" - } + start: "44-205", + }, ], saveButtonBarState: "default", shippingChannels: defaultChannels, - variant: ShippingMethodTypeEnum.PRICE + variant: ShippingMethodTypeEnum.PRICE, }; storiesOf("Shipping / ShippingZoneRatesCreatePage page", module) diff --git a/src/shipping/components/ShippingZoneRatesCreatePage/ShippingZoneRatesCreatePage.tsx b/src/shipping/components/ShippingZoneRatesCreatePage/ShippingZoneRatesCreatePage.tsx index 5a3d0ab84..eb87549b5 100644 --- a/src/shipping/components/ShippingZoneRatesCreatePage/ShippingZoneRatesCreatePage.tsx +++ b/src/shipping/components/ShippingZoneRatesCreatePage/ShippingZoneRatesCreatePage.tsx @@ -13,7 +13,7 @@ import { ShippingChannelsErrorFragment, ShippingErrorFragment, ShippingMethodTypeEnum, - ShippingMethodTypeFragment + ShippingMethodTypeFragment, } from "@saleor/graphql"; import useForm, { SubmitPromise } from "@saleor/hooks/useForm"; import useHandleFormSubmit from "@saleor/hooks/useHandleFormSubmit"; @@ -45,7 +45,7 @@ export interface ShippingZoneRatesCreatePageProps extends WithFormId { onDelete?: () => void; onSubmit: (data: ShippingZoneRateCommonFormData) => SubmitPromise; onPostalCodeInclusionChange: ( - inclusion: PostalCodeRuleInclusionTypeEnum + inclusion: PostalCodeRuleInclusionTypeEnum, ) => void; onPostalCodeAssign: () => void; onPostalCodeUnassign: (code: any) => void; @@ -71,7 +71,7 @@ export const ShippingZoneRatesCreatePage: React.FC { const intl = useIntl(); const navigate = useNavigator(); @@ -86,34 +86,34 @@ export const ShippingZoneRatesCreatePage: React.FC => ({ ...formData, - description: await richText.getValue() + description: await richText.getValue(), }); const handleFormElementSubmit: FormEventHandler = async event => { @@ -126,10 +126,10 @@ export const ShippingZoneRatesCreatePage: React.FC - validatePrice(channel.price) + validatePrice(channel.price), ); const isSaveDisabled = disabled || !isValid; setIsSubmitDisabled(isSaveDisabled); @@ -147,12 +147,12 @@ export const ShippingZoneRatesCreatePage: React.FC diff --git a/src/shipping/components/ShippingZoneRatesPage/ShippingZoneRatesPage.stories.tsx b/src/shipping/components/ShippingZoneRatesPage/ShippingZoneRatesPage.stories.tsx index c07d696f4..7cbc5c033 100644 --- a/src/shipping/components/ShippingZoneRatesPage/ShippingZoneRatesPage.stories.tsx +++ b/src/shipping/components/ShippingZoneRatesPage/ShippingZoneRatesPage.stories.tsx @@ -6,7 +6,7 @@ import { storiesOf } from "@storybook/react"; import React from "react"; import ShippingZoneRatesPage, { - ShippingZoneRatesPageProps + ShippingZoneRatesPageProps, } from "./ShippingZoneRatesPage"; const channels = [ @@ -16,7 +16,7 @@ const channels = [ maxValue: "10", minValue: "0", name: "channel", - price: "5" + price: "5", }, { currency: "USD", @@ -24,8 +24,8 @@ const channels = [ maxValue: "20", minValue: "1", name: "test", - price: "6" - } + price: "6", + }, ]; const defaultChannels = [ @@ -35,8 +35,8 @@ const defaultChannels = [ maxValue: "", minValue: "", name: "channel", - price: "" - } + price: "", + }, ]; const props: ShippingZoneRatesPageProps = { @@ -64,7 +64,7 @@ const props: ShippingZoneRatesPageProps = { toggleAll: () => undefined, toolbar: () => undefined, variant: ShippingMethodTypeEnum.PRICE, - formId: Symbol() + formId: Symbol(), }; storiesOf("Views / Shipping / Shipping rate", module) diff --git a/src/shipping/components/ShippingZoneRatesPage/ShippingZoneRatesPage.tsx b/src/shipping/components/ShippingZoneRatesPage/ShippingZoneRatesPage.tsx index 566fd56da..3ae400b9a 100644 --- a/src/shipping/components/ShippingZoneRatesPage/ShippingZoneRatesPage.tsx +++ b/src/shipping/components/ShippingZoneRatesPage/ShippingZoneRatesPage.tsx @@ -15,7 +15,7 @@ import { ShippingErrorFragment, ShippingMethodTypeEnum, ShippingMethodTypeFragment, - ShippingZoneQuery + ShippingZoneQuery, } from "@saleor/graphql"; import useForm, { SubmitPromise } from "@saleor/hooks/useForm"; import useHandleFormSubmit from "@saleor/hooks/useHandleFormSubmit"; @@ -56,11 +56,11 @@ export interface ShippingZoneRatesPageProps onDelete?: () => void; onSubmit: (data: ShippingZoneRateUpdateFormData) => SubmitPromise; onPostalCodeInclusionChange: ( - inclusion: PostalCodeRuleInclusionTypeEnum + inclusion: PostalCodeRuleInclusionTypeEnum, ) => void; onPostalCodeAssign: () => void; onPostalCodeUnassign: ( - code: ShippingMethodTypeFragment["postalCodeRules"][0] + code: ShippingMethodTypeFragment["postalCodeRules"][0], ) => void; onChannelsChange: (data: ChannelShippingData[]) => void; openChannelsModal: () => void; @@ -111,42 +111,42 @@ export const ShippingZoneRatesPage: React.FC = ({ name: rate?.name || "", orderValueRestricted: !!rate?.channelListings.length, privateMetadata: rate?.privateMetadata.map(mapMetadataItemToInput), - type: rate?.type || null + type: rate?.type || null, }), - [shippingChannels, rate] + [shippingChannels, rate], ); const { change, data: formData, setIsSubmitDisabled, - triggerChange + triggerChange, } = useForm(initialForm, undefined, { confirmLeave: true, formId }); const handleFormSubmit = useHandleFormSubmit({ formId, - onSubmit + onSubmit, }); const richText = useRichText({ initial: rate?.description, loading: !rate, - triggerChange + triggerChange, }); const { - makeChangeHandler: makeMetadataChangeHandler + makeChangeHandler: makeMetadataChangeHandler, } = useMetadataChangeTrigger(); const data: ShippingZoneRateUpdateFormData = { ...formData, - description: null + description: null, }; // Prevents closing ref in submit functions const getData = async (): Promise => ({ ...data, - description: await richText.getValue() + description: await richText.getValue(), }); const handleFormElementSubmit: FormEventHandler = async event => { @@ -158,10 +158,10 @@ export const ShippingZoneRatesPage: React.FC = ({ const handleChannelsChange = createChannelsChangeHandler( shippingChannels, onChannelsChange, - triggerChange + triggerChange, ); const isValid = !formData.channelListings?.some(channel => - validatePrice(channel.price) + validatePrice(channel.price), ); const changeMetadata = makeMetadataChangeHandler(change); @@ -237,7 +237,7 @@ export const ShippingZoneRatesPage: React.FC = ({ allChannelsCount={allChannelsCount} channelsList={data.channelListings.map(channel => ({ id: channel.id, - name: channel.name + name: channel.name, }))} openModal={openChannelsModal} /> diff --git a/src/shipping/components/ShippingZoneSettingsCard/ChannelsSection.tsx b/src/shipping/components/ShippingZoneSettingsCard/ChannelsSection.tsx index 91418553a..fd56e31b1 100644 --- a/src/shipping/components/ShippingZoneSettingsCard/ChannelsSection.tsx +++ b/src/shipping/components/ShippingZoneSettingsCard/ChannelsSection.tsx @@ -1,6 +1,6 @@ import CardSpacer from "@saleor/components/CardSpacer"; import MultiAutocompleteSelectField, { - MultiAutocompleteChoiceType + MultiAutocompleteChoiceType, } from "@saleor/components/MultiAutocompleteSelectField"; import { ChannelFragment } from "@saleor/graphql"; import { useChannelsSearch } from "@saleor/hooks/useChannelsSearch"; @@ -14,18 +14,18 @@ const messages = defineMessages({ id: "avj76v", defaultMessage: "Assign channels to this shipping zone so we know which orders will be supported", - description: "ChannelsSection subtitle" + description: "ChannelsSection subtitle", }, selectFieldLabel: { id: "mLZMb6", defaultMessage: "Channel", - description: "ChannelsSection select field label" + description: "ChannelsSection select field label", }, selectFieldPlaceholder: { id: "cnvyqW", defaultMessage: "Add Channel", - description: "ChannelsSection select field placeholder" - } + description: "ChannelsSection select field placeholder", + }, }); interface ChannelsSectionProps { @@ -39,7 +39,7 @@ const ChannelsSection: React.FC = ({ onChange, allChannels = [], selectedChannels, - channelsDisplayValues + channelsDisplayValues, }) => { const { onQueryChange, filteredChannels } = useChannelsSearch(allChannels); diff --git a/src/shipping/components/ShippingZoneSettingsCard/ShippingZoneSettingsCard.stories.tsx b/src/shipping/components/ShippingZoneSettingsCard/ShippingZoneSettingsCard.stories.tsx index 3efdb06f6..02fc9d41c 100644 --- a/src/shipping/components/ShippingZoneSettingsCard/ShippingZoneSettingsCard.stories.tsx +++ b/src/shipping/components/ShippingZoneSettingsCard/ShippingZoneSettingsCard.stories.tsx @@ -6,23 +6,23 @@ import React from "react"; import { ShippingZoneUpdateFormData } from "../../components/ShippingZoneDetailsPage/types"; import ShippingZoneSettingsCard, { - ShippingZoneSettingsCardProps + ShippingZoneSettingsCardProps, } from "./ShippingZoneSettingsCard"; const props: ShippingZoneSettingsCardProps = { formData: { channels: ["channel1"], - warehouses: ["warehouse1", "warehouse2"] + warehouses: ["warehouse1", "warehouse2"], } as ShippingZoneUpdateFormData, warehousesDisplayValues: [ { value: "warehouse1", - label: "Asia Warehouse" + label: "Asia Warehouse", }, { value: "warehouse2", - label: "Europe Warehouse" - } + label: "Europe Warehouse", + }, ], hasMoreWarehouses: false, loading: false, @@ -33,25 +33,25 @@ const props: ShippingZoneSettingsCardProps = { warehousesChoices: [ { value: "warehouse1", - label: "C our wares" + label: "C our wares", }, { value: "warehouse2", - label: "Be stocked" - } + label: "Be stocked", + }, ], allChannels: [ { __typename: "Channel", id: "channel1", name: "GBP" }, { __typename: "Channel", id: "channel2", name: "PLN" }, - { __typename: "Channel", id: "channel3", name: "USD" } + { __typename: "Channel", id: "channel3", name: "USD" }, ] as ChannelDetailsFragment[], channelsDisplayValues: [ { value: "channel1", - label: "GBP" - } + label: "GBP", + }, ], - onChannelChange: () => undefined + onChannelChange: () => undefined, }; storiesOf("Shipping zones details / Settings Card", module) diff --git a/src/shipping/components/ShippingZoneSettingsCard/ShippingZoneSettingsCard.tsx b/src/shipping/components/ShippingZoneSettingsCard/ShippingZoneSettingsCard.tsx index 0c63cc3a3..469c452ef 100644 --- a/src/shipping/components/ShippingZoneSettingsCard/ShippingZoneSettingsCard.tsx +++ b/src/shipping/components/ShippingZoneSettingsCard/ShippingZoneSettingsCard.tsx @@ -14,8 +14,8 @@ const messages = defineMessages({ title: { id: "t/R8nK", defaultMessage: "Settings", - description: "ShippingZoneSettingsCard title" - } + description: "ShippingZoneSettingsCard title", + }, }); export interface ShippingZoneSettingsCardProps { @@ -45,7 +45,7 @@ export const ShippingZoneSettingsCard: React.FC = onWarehouseChange, allChannels, onChannelChange, - channelsDisplayValues + channelsDisplayValues, }) => { const intl = useIntl(); diff --git a/src/shipping/components/ShippingZoneSettingsCard/WarehousesSection.tsx b/src/shipping/components/ShippingZoneSettingsCard/WarehousesSection.tsx index c214421aa..5d00e8e67 100644 --- a/src/shipping/components/ShippingZoneSettingsCard/WarehousesSection.tsx +++ b/src/shipping/components/ShippingZoneSettingsCard/WarehousesSection.tsx @@ -1,6 +1,6 @@ import CardSpacer from "@saleor/components/CardSpacer"; import MultiAutocompleteSelectField, { - MultiAutocompleteChoiceType + MultiAutocompleteChoiceType, } from "@saleor/components/MultiAutocompleteSelectField"; import { FormChange } from "@saleor/hooks/useForm"; import { FetchMoreProps, SearchProps } from "@saleor/types"; @@ -12,23 +12,23 @@ const messages = defineMessages({ id: "wjKYSU", defaultMessage: "Select warehouse from which you will ship products for this shipping zone. This warehouse address will also be used to calculate taxes.", - description: "WarehousesSection subtitle" + description: "WarehousesSection subtitle", }, selectFieldAddText: { id: "n25d+d", defaultMessage: "Add New Warehouse", - description: "WarehousesSection select field add text" + description: "WarehousesSection select field add text", }, selectFieldLabel: { id: "PV0SQd", defaultMessage: "Warehouse", - description: "WarehousesSection select field label" + description: "WarehousesSection select field label", }, selectFieldPlaceholder: { id: "/cow4T", defaultMessage: "Select Warehouse", - description: "WarehousesSection select field placeholder" - } + description: "WarehousesSection select field placeholder", + }, }); interface WarehousesSectionProps extends FetchMoreProps, SearchProps { @@ -48,7 +48,7 @@ const WarehousesSection: React.FC = ({ choices, selectedWarehouses, hasMore, - loading + loading, }) => { const intl = useIntl(); @@ -59,7 +59,7 @@ const WarehousesSection: React.FC = ({ ({ colAction: { "&:last-child": { - paddingRight: theme.spacing(1) + paddingRight: theme.spacing(1), }, - width: 92 + width: 92, }, colCountries: { - width: 180 + width: 180, }, colName: { - paddingLeft: 0 + paddingLeft: 0, }, row: { - cursor: "pointer" - } + cursor: "pointer", + }, }), - { name: "ShippingZonesList" } + { name: "ShippingZonesList" }, ); const numberOfColumns = 4; @@ -61,7 +61,7 @@ const ShippingZonesList: React.FC = props => { selected, toggle, toggleAll, - toolbar + toolbar, } = props; const classes = useStyles(props); @@ -74,7 +74,7 @@ const ShippingZonesList: React.FC = props => { title={intl.formatMessage({ id: "h5r9+x", defaultMessage: "Shipping By Zone", - description: "sort shipping methods by zone, section header" + description: "sort shipping methods by zone, section header", })} toolbar={