@commercetools-frontend/experimental-components 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/commercetools-frontend-experimental-components.cjs.dev.js +15285 -0
- package/dist/commercetools-frontend-experimental-components.cjs.js +7 -0
- package/dist/commercetools-frontend-experimental-components.cjs.prod.js +15276 -0
- package/dist/commercetools-frontend-experimental-components.esm.js +14983 -0
- package/package.json +88 -0
- package/src/actions/reference-search/cart-discount/cart-discount.ctp.graphql +29 -0
- package/src/actions/reference-search/cart-discount/cart-discount.js +69 -0
- package/src/actions/reference-search/cart-discount/cart-discount.spec.js +115 -0
- package/src/actions/reference-search/cart-discount/index.js +1 -0
- package/src/actions/reference-search/category/category.ctp.graphql +44 -0
- package/src/actions/reference-search/category/category.js +50 -0
- package/src/actions/reference-search/category/category.spec.js +82 -0
- package/src/actions/reference-search/category/index.js +1 -0
- package/src/components/attribute-definitions/reference-search/cart-discount-reference-search/cart-discount-reference-search.jsx +132 -0
- package/src/components/attribute-definitions/reference-search/cart-discount-reference-search/cart-discount-reference-search.spec.js +225 -0
- package/src/components/attribute-definitions/reference-search/cart-discount-reference-search/index.js +1 -0
- package/src/components/attribute-definitions/reference-search/cart-discount-reference-search/messages.js +33 -0
- package/src/components/attribute-definitions/reference-search/cart-discount-reference-search/option.jsx +45 -0
- package/src/components/attribute-definitions/reference-search/category-reference-search/category-reference-search.jsx +96 -0
- package/src/components/attribute-definitions/reference-search/category-reference-search/category-reference-search.spec.js +281 -0
- package/src/components/attribute-definitions/reference-search/category-reference-search/index.js +2 -0
- package/src/components/attribute-definitions/reference-search/category-reference-search/messages.js +37 -0
- package/src/components/attribute-definitions/reference-search/category-reference-search/option.jsx +71 -0
- package/src/components/attribute-definitions/reference-search/category-reference-search/use-cached-category-options.js +21 -0
- package/src/components/attribute-definitions/reference-search/index.js +10 -0
- package/src/components/attribute-definitions/reference-search/reference-search.jsx +179 -0
- package/src/components/attribute-definitions/reference-search/reference-search.module.css +13 -0
- package/src/components/business-unit-select-field/business-unit-select-field.jsx +141 -0
- package/src/components/business-unit-select-field/index.js +1 -0
- package/src/components/business-unit-select-input/business-unit-select-input.jsx +160 -0
- package/src/components/business-unit-select-input/business-unit-select-input.spec.js +118 -0
- package/src/components/business-unit-select-input/components/business-unit-async-select-input/business-unit-async-select-input.jsx +181 -0
- package/src/components/business-unit-select-input/components/business-unit-async-select-input/index.js +1 -0
- package/src/components/business-unit-select-input/components/business-unit-basic-select-input/business-unit-basic-select-input.jsx +150 -0
- package/src/components/business-unit-select-input/components/business-unit-basic-select-input/index.js +1 -0
- package/src/components/business-unit-select-input/components/business-unit-search-select-input/business-unit-search-select-input.jsx +187 -0
- package/src/components/business-unit-select-input/components/business-unit-search-select-input/fetch-business-units-by-where-predicate.ctp.graphql +9 -0
- package/src/components/business-unit-select-input/components/business-unit-search-select-input/index.js +1 -0
- package/src/components/business-unit-select-input/components/business-unit-search-select-input/mocks/handlers.js +16 -0
- package/src/components/business-unit-select-input/components/business-unit-search-select-input/mocks/index.js +3 -0
- package/src/components/business-unit-select-input/constants.js +2 -0
- package/src/components/business-unit-select-input/hooks/index.js +5 -0
- package/src/components/business-unit-select-input/hooks/use-business-units-by-field-fetcher/fetch-business-units-by-field.ctp.graphql +9 -0
- package/src/components/business-unit-select-input/hooks/use-business-units-by-field-fetcher/index.js +2 -0
- package/src/components/business-unit-select-input/hooks/use-business-units-by-field-fetcher/mocks/handlers.js +17 -0
- package/src/components/business-unit-select-input/hooks/use-business-units-by-field-fetcher/mocks/index.js +3 -0
- package/src/components/business-unit-select-input/hooks/use-business-units-by-field-fetcher/use-business-units-by-field-fetcher.js +35 -0
- package/src/components/business-unit-select-input/hooks/use-business-units-list-fetcher/fetch-business-units-list.ctp.graphql +21 -0
- package/src/components/business-unit-select-input/hooks/use-business-units-list-fetcher/index.js +2 -0
- package/src/components/business-unit-select-input/hooks/use-business-units-list-fetcher/mocks/handlers.js +17 -0
- package/src/components/business-unit-select-input/hooks/use-business-units-list-fetcher/mocks/index.js +3 -0
- package/src/components/business-unit-select-input/hooks/use-business-units-list-fetcher/use-business-units-list-fetcher.js +50 -0
- package/src/components/business-unit-select-input/hooks/use-total-number-of-business-units-fetcher/index.js +2 -0
- package/src/components/business-unit-select-input/hooks/use-total-number-of-business-units-fetcher/mocks/handlers.js +17 -0
- package/src/components/business-unit-select-input/hooks/use-total-number-of-business-units-fetcher/mocks/index.js +3 -0
- package/src/components/business-unit-select-input/hooks/use-total-number-of-business-units-fetcher/total-number-of-business-units.ctp.graphql +5 -0
- package/src/components/business-unit-select-input/hooks/use-total-number-of-business-units-fetcher/use-total-number-of-business-units-fetcher.js +20 -0
- package/src/components/business-unit-select-input/index.js +5 -0
- package/src/components/business-unit-select-input/messages.js +30 -0
- package/src/components/business-unit-select-input/utils.js +27 -0
- package/src/components/buttons/button/button.jsx +42 -0
- package/src/components/buttons/button/button.module.css +214 -0
- package/src/components/buttons/button/button.spec.js +84 -0
- package/src/components/buttons/button/index.js +1 -0
- package/src/components/buttons/button-close/__snapshots__/button-close.spec.js.snap +19 -0
- package/src/components/buttons/button-close/button-close.jsx +37 -0
- package/src/components/buttons/button-close/button-close.module.css +3 -0
- package/src/components/buttons/button-close/button-close.spec.js +68 -0
- package/src/components/buttons/button-close/index.js +1 -0
- package/src/components/buttons/button-group/button-group.jsx +62 -0
- package/src/components/buttons/button-group/button-group.module.css +53 -0
- package/src/components/buttons/button-group/button-group.spec.js +142 -0
- package/src/components/buttons/button-group/index.js +1 -0
- package/src/components/buttons/button-typed/button-typed.jsx +120 -0
- package/src/components/buttons/button-typed/button-typed.spec.js +95 -0
- package/src/components/buttons/button-typed/index.js +1 -0
- package/src/components/buttons/file-input/README.md +45 -0
- package/src/components/buttons/file-input/file-input.jsx +35 -0
- package/src/components/buttons/file-input/file-input.module.css +31 -0
- package/src/components/buttons/file-input/file-input.spec.js +115 -0
- package/src/components/buttons/file-input/index.js +1 -0
- package/src/components/buttons/file-input/messages.js +9 -0
- package/src/components/buttons/index.jsx +42 -0
- package/src/components/centered-loading-spinner/centered-loading-spinner.jsx +18 -0
- package/src/components/centered-loading-spinner/centered-loading-spinner.module.css +7 -0
- package/src/components/centered-loading-spinner/centered-loading-spinner.spec.js +13 -0
- package/src/components/centered-loading-spinner/index.js +2 -0
- package/src/components/channel-picker-input/channel-picker-input.ctp.graphql +24 -0
- package/src/components/channel-picker-input/channel-picker-input.jsx +210 -0
- package/src/components/channel-picker-input/channel-picker-input.spec.js +405 -0
- package/src/components/channel-picker-input/index.js +1 -0
- package/src/components/channel-picker-input/messages.js +14 -0
- package/src/components/channel-picker-input/tracking-events.js +24 -0
- package/src/components/country-picker/components/countries-async-select-dropdown/countries-async-select-dropdown.jsx +89 -0
- package/src/components/country-picker/components/countries-async-select-dropdown/index.js +1 -0
- package/src/components/country-picker/components/countries-basic-select-dropdown/countries-basic-select-dropdown.jsx +50 -0
- package/src/components/country-picker/components/countries-basic-select-dropdown/index.js +1 -0
- package/src/components/country-picker/constants.js +1 -0
- package/src/components/country-picker/country-picker.jsx +49 -0
- package/src/components/country-picker/index.js +1 -0
- package/src/components/country-picker/messages.js +20 -0
- package/src/components/divider/divider.jsx +21 -0
- package/src/components/divider/divider.module.css +25 -0
- package/src/components/divider/index.js +1 -0
- package/src/components/formatted-date-time/README.md +44 -0
- package/src/components/formatted-date-time/__snapshots__/formatted-date-time.spec.js.snap +19 -0
- package/src/components/formatted-date-time/formatted-date-time.jsx +35 -0
- package/src/components/formatted-date-time/formatted-date-time.spec.js +68 -0
- package/src/components/formatted-date-time/index.js +1 -0
- package/src/components/keep-display-name/index.js +1 -0
- package/src/components/keep-display-name/keep-display-name.js +6 -0
- package/src/components/messages.js +17 -0
- package/src/components/modal-container/__snapshots__/modal-container.spec.js.snap +21 -0
- package/src/components/modal-container/index.js +1 -0
- package/src/components/modal-container/modal-container.jsx +36 -0
- package/src/components/modal-container/modal-container.spec.js +10 -0
- package/src/components/modal-content-layout/index.js +1 -0
- package/src/components/modal-content-layout/modal-content-layout.jsx +38 -0
- package/src/components/modal-content-layout/modal-content-layout.module.css +69 -0
- package/src/components/modal-content-layout/modal-content-layout.spec.js +109 -0
- package/src/components/product-attributes/README.md +72 -0
- package/src/components/product-attributes/conversions.js +75 -0
- package/src/components/product-attributes/conversions.spec.js +97 -0
- package/src/components/product-attributes/index.js +3 -0
- package/src/components/product-attributes/product-attribute-input.jsx +68 -0
- package/src/components/product-attributes/product-attributes.jsx +79 -0
- package/src/components/product-picker-input/index.js +1 -0
- package/src/components/product-picker-input/messages.js +14 -0
- package/src/components/product-picker-input/product-picker-input.ctp.graphql +31 -0
- package/src/components/product-picker-input/product-picker-input.jsx +203 -0
- package/src/components/product-picker-input/product-picker-input.spec.js +357 -0
- package/src/components/product-picker-input/tracking-events.js +19 -0
- package/src/components/product-selection-picker/components/product-selection-async-select-dropdown/index.js +1 -0
- package/src/components/product-selection-picker/components/product-selection-async-select-dropdown/product-selection-async-select-dropdown.jsx +113 -0
- package/src/components/product-selection-picker/components/product-selection-basic-select-dropdown/index.js +1 -0
- package/src/components/product-selection-picker/components/product-selection-basic-select-dropdown/product-selection-basic-select-dropdown.jsx +98 -0
- package/src/components/product-selection-picker/components/product-selections-search-select-dropdown/index.js +1 -0
- package/src/components/product-selection-picker/components/product-selections-search-select-dropdown/product-selections-fetcher.ctp.graphql +13 -0
- package/src/components/product-selection-picker/components/product-selections-search-select-dropdown/product-selections-search-select-dropdown.jsx +121 -0
- package/src/components/product-selection-picker/constants.js +2 -0
- package/src/components/product-selection-picker/index.js +1 -0
- package/src/components/product-selection-picker/messages.js +20 -0
- package/src/components/product-selection-picker/product-selection-picker.jsx +84 -0
- package/src/components/product-type-picker-input/index.js +1 -0
- package/src/components/product-type-picker-input/messages.js +14 -0
- package/src/components/product-type-picker-input/product-type-picker-input.ctp.graphql +15 -0
- package/src/components/product-type-picker-input/product-type-picker-input.jsx +172 -0
- package/src/components/product-type-picker-input/product-type-picker-input.spec.js +266 -0
- package/src/components/product-type-picker-input/tracking-events.js +14 -0
- package/src/components/required-indicator/__snapshots__/required-indicator.spec.js.snap +17 -0
- package/src/components/required-indicator/index.js +1 -0
- package/src/components/required-indicator/required-indicator.jsx +16 -0
- package/src/components/required-indicator/required-indicator.module.css +3 -0
- package/src/components/required-indicator/required-indicator.spec.js +14 -0
- package/src/components/scroll-to-field-error/index.js +1 -0
- package/src/components/scroll-to-field-error/scroll-to-field-error.js +32 -0
- package/src/components/selectable-field-search-input/index.js +1 -0
- package/src/components/selectable-field-search-input/messages.js +14 -0
- package/src/components/selectable-field-search-input/selectable-field-search-input.jsx +147 -0
- package/src/components/selectable-field-search-input/selectable-field-search-input.module.css +14 -0
- package/src/components/selectable-field-search-input/selectable-field-search-input.spec.js +82 -0
- package/src/components/state-picker-input/index.js +1 -0
- package/src/components/state-picker-input/messages.js +14 -0
- package/src/components/state-picker-input/state-picker-input.ctp.graphql +24 -0
- package/src/components/state-picker-input/state-picker-input.jsx +204 -0
- package/src/components/state-picker-input/state-picker-input.spec.js +447 -0
- package/src/components/state-picker-input/tracking-events.js +24 -0
- package/src/components/store-select-field/index.js +1 -0
- package/src/components/store-select-field/store-select-field.jsx +145 -0
- package/src/components/store-select-input/components/stores-async-select-input/index.js +1 -0
- package/src/components/store-select-input/components/stores-async-select-input/stores-async-select-input.jsx +214 -0
- package/src/components/store-select-input/components/stores-basic-select-input/index.js +1 -0
- package/src/components/store-select-input/components/stores-basic-select-input/stores-basic-select-input.jsx +172 -0
- package/src/components/store-select-input/components/stores-search-select-input/fetch-stores-by-where-predicate.ctp.graphql +26 -0
- package/src/components/store-select-input/components/stores-search-select-input/index.js +2 -0
- package/src/components/store-select-input/components/stores-search-select-input/mocks/handlers.js +16 -0
- package/src/components/store-select-input/components/stores-search-select-input/mocks/index.js +3 -0
- package/src/components/store-select-input/components/stores-search-select-input/stores-search-select-input.jsx +261 -0
- package/src/components/store-select-input/constants.js +2 -0
- package/src/components/store-select-input/hooks/index.js +4 -0
- package/src/components/store-select-input/hooks/use-stores-by-field-fetcher/fetch-stores-by-field.ctp.graphql +22 -0
- package/src/components/store-select-input/hooks/use-stores-by-field-fetcher/index.js +2 -0
- package/src/components/store-select-input/hooks/use-stores-by-field-fetcher/mocks/handlers.js +16 -0
- package/src/components/store-select-input/hooks/use-stores-by-field-fetcher/mocks/index.js +3 -0
- package/src/components/store-select-input/hooks/use-stores-by-field-fetcher/use-stores-by-field-fetcher.js +47 -0
- package/src/components/store-select-input/hooks/use-total-number-of-stores-fetcher/index.js +2 -0
- package/src/components/store-select-input/hooks/use-total-number-of-stores-fetcher/mocks/handlers.js +16 -0
- package/src/components/store-select-input/hooks/use-total-number-of-stores-fetcher/mocks/index.js +3 -0
- package/src/components/store-select-input/hooks/use-total-number-of-stores-fetcher/total-number-of-stores.ctp.graphql +5 -0
- package/src/components/store-select-input/hooks/use-total-number-of-stores-fetcher/use-total-number-of-stores-fetcher.js +20 -0
- package/src/components/store-select-input/index.js +4 -0
- package/src/components/store-select-input/messages.js +36 -0
- package/src/components/store-select-input/store-select-input.jsx +163 -0
- package/src/components/store-select-input/store-select-input.spec.js +124 -0
- package/src/components/store-select-input/utils.js +40 -0
- package/src/components/tooltip/index.js +1 -0
- package/src/components/tooltip/tooltip.jsx +192 -0
- package/src/components/tooltip/tooltip.module.css +281 -0
- package/src/components/tooltip/tooltip.spec.js +138 -0
- package/src/components/validated-input/__snapshots__/validated-input.spec.js.snap +13 -0
- package/src/components/validated-input/index.js +2 -0
- package/src/components/validated-input/validated-input.jsx +318 -0
- package/src/components/validated-input/validated-input.module.css +9 -0
- package/src/components/validated-input/validated-input.spec.js +91 -0
- package/src/components/validation-error/README.md +87 -0
- package/src/components/validation-error/__snapshots__/validation-error-match.spec.js.snap +9 -0
- package/src/components/validation-error/__snapshots__/validation-error-switch.spec.js.snap +12 -0
- package/src/components/validation-error/index.js +4 -0
- package/src/components/validation-error/validation-error-match.js +31 -0
- package/src/components/validation-error/validation-error-match.spec.js +102 -0
- package/src/components/validation-error/validation-error-switch.js +45 -0
- package/src/components/validation-error/validation-error-switch.spec.js +78 -0
- package/src/components/with-mouse-over-state/README.md +33 -0
- package/src/components/with-mouse-over-state/index.js +1 -0
- package/src/components/with-mouse-over-state/with-mouse-over-state.jsx +32 -0
- package/src/components/with-mouse-over-state/with-mouse-over-state.spec.js +35 -0
- package/src/constants/index.js +114 -0
- package/src/custom-fields/custom-field-definitions-connector/README.md +90 -0
- package/src/custom-fields/custom-field-definitions-connector/__snapshots__/custom-field-definitions-connector.spec.js.snap +7 -0
- package/src/custom-fields/custom-field-definitions-connector/custom-field-definitions-connector.ctp.graphql +54 -0
- package/src/custom-fields/custom-field-definitions-connector/custom-field-definitions-connector.js +150 -0
- package/src/custom-fields/custom-field-definitions-connector/custom-field-definitions-connector.spec.js +288 -0
- package/src/custom-fields/custom-field-definitions-connector/index.js +3 -0
- package/src/custom-fields/custom-field-definitions-connector/mocks/handlers.js +16 -0
- package/src/custom-fields/custom-field-definitions-connector/mocks/index.js +4 -0
- package/src/custom-fields/custom-field-type-definitions-connector/README.md +193 -0
- package/src/custom-fields/custom-field-type-definitions-connector/__snapshots__/custom-field-type-definitions-connector.spec.js.snap +7 -0
- package/src/custom-fields/custom-field-type-definitions-connector/custom-field-type-definitions-connector.ctp.graphql +72 -0
- package/src/custom-fields/custom-field-type-definitions-connector/custom-field-type-definitions-connector.js +131 -0
- package/src/custom-fields/custom-field-type-definitions-connector/custom-field-type-definitions-connector.spec.js +82 -0
- package/src/custom-fields/custom-field-type-definitions-connector/index.js +1 -0
- package/src/custom-fields/custom-field-type-definitions-connector/utils.js +89 -0
- package/src/custom-fields/custom-field-type-definitions-connector/utils.spec.js +235 -0
- package/src/custom-fields/custom-fields/README.md +75 -0
- package/src/custom-fields/custom-fields/constants.js +38 -0
- package/src/custom-fields/custom-fields/custom-field-errors.jsx +60 -0
- package/src/custom-fields/custom-fields/custom-field-input.jsx +100 -0
- package/src/custom-fields/custom-fields/custom-field-tooltip.jsx +34 -0
- package/src/custom-fields/custom-fields/custom-fields-internal.jsx +148 -0
- package/src/custom-fields/custom-fields/custom-fields-label/cart-discounts-count.ctp.graphql +5 -0
- package/src/custom-fields/custom-fields/custom-fields-label/custom-fields-label.jsx +156 -0
- package/src/custom-fields/custom-fields/custom-fields-label/custom-fields-label.spec.js +92 -0
- package/src/custom-fields/custom-fields/custom-fields-label/index.js +1 -0
- package/src/custom-fields/custom-fields/custom-fields-label/messages.js +37 -0
- package/src/custom-fields/custom-fields/custom-fields.jsx +61 -0
- package/src/custom-fields/custom-fields/custom-nested-field-input/custom-nested-field-input.jsx +66 -0
- package/src/custom-fields/custom-fields/custom-nested-field-input/fetch-product-type.ctp.graphql +82 -0
- package/src/custom-fields/custom-fields/custom-nested-field-input/index.js +1 -0
- package/src/custom-fields/custom-fields/custom-nested-field-input/messages.js +9 -0
- package/src/custom-fields/custom-fields/custom-nested-field-input/product-type-reference.jsx +20 -0
- package/src/custom-fields/custom-fields/custom-nested-field-input/use-nested-product-type.js +72 -0
- package/src/custom-fields/custom-fields/index.js +5 -0
- package/src/custom-fields/custom-fields/nesting-level-context.js +5 -0
- package/src/custom-fields/custom-fields/set/custom-boolean-input-set.jsx +69 -0
- package/src/custom-fields/custom-fields/set/custom-boolean-input-set.spec.js +89 -0
- package/src/custom-fields/custom-fields/set/custom-input-set.jsx +233 -0
- package/src/custom-fields/custom-fields/set/custom-input-set.spec.js +193 -0
- package/src/custom-fields/custom-fields/set/expand-button.jsx +37 -0
- package/src/custom-fields/custom-fields/set/expand-button.spec.js +43 -0
- package/src/custom-fields/custom-fields/set/set-buttons.jsx +47 -0
- package/src/custom-fields/custom-fields/set/set-buttons.module.css +7 -0
- package/src/custom-fields/custom-fields/set/set-buttons.spec.js +39 -0
- package/src/custom-fields/custom-fields/test-utils.jsx +167 -0
- package/src/custom-fields/custom-fields/types/custom-boolean-input.jsx +49 -0
- package/src/custom-fields/custom-fields/types/custom-boolean-input.spec.js +51 -0
- package/src/custom-fields/custom-fields/types/custom-date-time-input.jsx +53 -0
- package/src/custom-fields/custom-fields/types/custom-date-time-input.spec.js +116 -0
- package/src/custom-fields/custom-fields/types/custom-enum-input.jsx +61 -0
- package/src/custom-fields/custom-fields/types/custom-enum-input.spec.js +113 -0
- package/src/custom-fields/custom-fields/types/custom-localized-enum-input.jsx +70 -0
- package/src/custom-fields/custom-fields/types/custom-localized-enum-input.spec.js +133 -0
- package/src/custom-fields/custom-fields/types/custom-localized-text-input.jsx +86 -0
- package/src/custom-fields/custom-fields/types/custom-localized-text-input.spec.js +99 -0
- package/src/custom-fields/custom-fields/types/custom-money-input.jsx +117 -0
- package/src/custom-fields/custom-fields/types/custom-money-input.module.css +3 -0
- package/src/custom-fields/custom-fields/types/custom-money-input.spec.js +124 -0
- package/src/custom-fields/custom-fields/types/custom-nested-input/custom-nested-input.jsx +331 -0
- package/src/custom-fields/custom-fields/types/custom-nested-input/custom-nested-input.spec.js +470 -0
- package/src/custom-fields/custom-fields/types/custom-nested-input/index.js +1 -0
- package/src/custom-fields/custom-fields/types/custom-nested-input/messages.js +82 -0
- package/src/custom-fields/custom-fields/types/custom-number-input.jsx +34 -0
- package/src/custom-fields/custom-fields/types/custom-number-input.spec.js +42 -0
- package/src/custom-fields/custom-fields/types/custom-reference-input/custom-cart-discount-reference-input.jsx +44 -0
- package/src/custom-fields/custom-fields/types/custom-reference-input/custom-cart-discount-reference-input.spec.js +132 -0
- package/src/custom-fields/custom-fields/types/custom-reference-input/custom-category-reference-input.jsx +46 -0
- package/src/custom-fields/custom-fields/types/custom-reference-input/custom-category-reference-input.spec.js +134 -0
- package/src/custom-fields/custom-fields/types/custom-reference-input/custom-channel-reference-input.jsx +36 -0
- package/src/custom-fields/custom-fields/types/custom-reference-input/custom-channel-reference-input.spec.js +130 -0
- package/src/custom-fields/custom-fields/types/custom-reference-input/custom-product-reference-input.jsx +37 -0
- package/src/custom-fields/custom-fields/types/custom-reference-input/custom-product-reference-input.spec.js +123 -0
- package/src/custom-fields/custom-fields/types/custom-reference-input/custom-product-type-reference-input.jsx +36 -0
- package/src/custom-fields/custom-fields/types/custom-reference-input/custom-product-type-reference-input.spec.js +146 -0
- package/src/custom-fields/custom-fields/types/custom-reference-input/custom-raw-id-reference-input.jsx +32 -0
- package/src/custom-fields/custom-fields/types/custom-reference-input/custom-raw-id-reference-input.spec.js +83 -0
- package/src/custom-fields/custom-fields/types/custom-reference-input/custom-reference-input.jsx +78 -0
- package/src/custom-fields/custom-fields/types/custom-reference-input/custom-state-reference-input.jsx +36 -0
- package/src/custom-fields/custom-fields/types/custom-reference-input/custom-state-reference-input.spec.js +130 -0
- package/src/custom-fields/custom-fields/types/custom-reference-input/index.js +1 -0
- package/src/custom-fields/custom-fields/types/custom-text-input.jsx +46 -0
- package/src/custom-fields/custom-fields/types/custom-text-input.spec.js +66 -0
- package/src/custom-fields/custom-fields/types/custom-time-input.jsx +74 -0
- package/src/custom-fields/custom-fields/types/custom-time-input.spec.js +91 -0
- package/src/custom-fields/custom-fields/utils/index.js +1 -0
- package/src/custom-fields/custom-fields/utils/utils.js +22 -0
- package/src/custom-fields/custom-fields/validations/index.js +1 -0
- package/src/custom-fields/custom-fields/validations/validations.js +117 -0
- package/src/custom-fields/custom-fields/validations/validations.spec.js +134 -0
- package/src/custom-fields/custom-fields-error-text-notification/custom-fields-error-text-notification.jsx +29 -0
- package/src/custom-fields/custom-fields-error-text-notification/custom-fields-error-text-notification.spec.js +31 -0
- package/src/custom-fields/custom-fields-error-text-notification/index.js +1 -0
- package/src/custom-fields/custom-fields-error-text-notification/messages.js +10 -0
- package/src/custom-fields/messages/custom-fields.js +17 -0
- package/src/features/picker/index.js +11 -0
- package/src/features/picker/shared/components/index.js +1 -0
- package/src/features/picker/shared/components/messages.js +9 -0
- package/src/features/picker/shared/components/option.jsx +51 -0
- package/src/features/picker/shared/hooks/use-current-option.js +24 -0
- package/src/features/picker/shared/hooks/use-current-option.spec.js +125 -0
- package/src/features/picker/shared/hooks/use-handlers.js +42 -0
- package/src/features/picker/shared/hooks/use-load-options.js +63 -0
- package/src/features/picker/shared/hooks/use-load-options.spec.js +63 -0
- package/src/features/picker/shared/hooks/use-product-type-options.js +190 -0
- package/src/features/picker/shared/hooks/use-product-type-options.spec.js +151 -0
- package/src/features/pim-indexer/components/index.js +5 -0
- package/src/features/pim-indexer/components/pim-indexer-context/index.js +1 -0
- package/src/features/pim-indexer/components/pim-indexer-context/pim-indexer-context.js +28 -0
- package/src/features/pim-indexer/components/pim-indexer-provider/fetch-indices-exist.pim-indexer.graphql +12 -0
- package/src/features/pim-indexer/components/pim-indexer-provider/fetch-pim-index-status.js +42 -0
- package/src/features/pim-indexer/components/pim-indexer-provider/fetch-pim-index-status.spec.js +128 -0
- package/src/features/pim-indexer/components/pim-indexer-provider/index.js +1 -0
- package/src/features/pim-indexer/components/pim-indexer-provider/messages.js +17 -0
- package/src/features/pim-indexer/components/pim-indexer-provider/pim-indexer-provider.jsx +287 -0
- package/src/features/pim-indexer/components/pim-indexer-provider/pim-indexer-provider.spec.js +80 -0
- package/src/features/pim-indexer/components/pim-indexer-provider/pim-indexer.pim-indexer.graphql +55 -0
- package/src/features/pim-indexer/components/with-pim-indexer/index.js +1 -0
- package/src/features/pim-indexer/components/with-pim-indexer/with-pim-indexer.jsx +19 -0
- package/src/features/pim-indexer/hocs/index.js +2 -0
- package/src/features/pim-indexer/hocs/inject-pim-indexer/index.js +1 -0
- package/src/features/pim-indexer/hocs/inject-pim-indexer/inject-pim-indexer.jsx +23 -0
- package/src/features/pim-indexer/hocs/inject-pim-indexer/inject-pim-indexer.spec.js +37 -0
- package/src/features/pim-indexer/hooks/index.js +2 -0
- package/src/features/pim-indexer/hooks/use-pim-indexer/index.js +1 -0
- package/src/features/pim-indexer/hooks/use-pim-indexer/use-pim-indexer.js +6 -0
- package/src/features/pim-indexer/index.js +6 -0
- package/src/features/platform-limits/assets/graphic-limits-reached.react.svg +50 -0
- package/src/features/platform-limits/customer-groups/components/index.js +5 -0
- package/src/features/platform-limits/customer-groups/components/platform-limits-customer-groups-combined/index.js +1 -0
- package/src/features/platform-limits/customer-groups/components/platform-limits-customer-groups-combined/platform-limits-customer-groups-combined.jsx +32 -0
- package/src/features/platform-limits/customer-groups/components/platform-limits-customer-groups-combined/platform-limits-customer-groups-combined.module.css +3 -0
- package/src/features/platform-limits/customer-groups/components/platform-limits-customer-groups-error-modal/index.js +1 -0
- package/src/features/platform-limits/customer-groups/components/platform-limits-customer-groups-error-modal/messages.js +15 -0
- package/src/features/platform-limits/customer-groups/components/platform-limits-customer-groups-error-modal/platform-limits-customer-groups-error-modal.jsx +43 -0
- package/src/features/platform-limits/customer-groups/components/platform-limits-customer-groups-notification/index.js +1 -0
- package/src/features/platform-limits/customer-groups/components/platform-limits-customer-groups-notification/platform-limits-customer-groups-notification.jsx +42 -0
- package/src/features/platform-limits/customer-groups/components/platform-limits-customer-groups-notification/platform-limits-customer-groups-notification.spec.js +51 -0
- package/src/features/platform-limits/customer-groups/components/platform-limits-customer-groups-status/index.js +1 -0
- package/src/features/platform-limits/customer-groups/components/platform-limits-customer-groups-status/messages.js +9 -0
- package/src/features/platform-limits/customer-groups/components/platform-limits-customer-groups-status/platform-limits-customer-groups-status.jsx +37 -0
- package/src/features/platform-limits/customer-groups/components/platform-limits-customer-groups-status/platform-limits-customer-groups-status.module.css +3 -0
- package/src/features/platform-limits/customer-groups/components/platform-limits-customer-groups-tooltip/index.js +1 -0
- package/src/features/platform-limits/customer-groups/components/platform-limits-customer-groups-tooltip/messages.js +9 -0
- package/src/features/platform-limits/customer-groups/components/platform-limits-customer-groups-tooltip/platform-limits-customer-groups-tooltip.jsx +18 -0
- package/src/features/platform-limits/customer-groups/hocs/index.js +2 -0
- package/src/features/platform-limits/customer-groups/hocs/inject-customer-groups-platform-limits/index.js +1 -0
- package/src/features/platform-limits/customer-groups/hocs/inject-customer-groups-platform-limits/inject-customer-groups-platform-limits.jsx +23 -0
- package/src/features/platform-limits/customer-groups/hooks/index.js +4 -0
- package/src/features/platform-limits/customer-groups/hooks/use-customer-groups-platform-limits/index.js +1 -0
- package/src/features/platform-limits/customer-groups/hooks/use-customer-groups-platform-limits/use-customer-groups-platform-limits.js +40 -0
- package/src/features/platform-limits/customer-groups/hooks/use-customer-groups-platform-limits-fetcher/index.js +1 -0
- package/src/features/platform-limits/customer-groups/hooks/use-customer-groups-platform-limits-fetcher/use-customer-groups-platform-limits-fetcher.js +18 -0
- package/src/features/platform-limits/customer-groups/hooks/use-customer-groups-platform-limits-fetcher/use-customer-groups-platform-limits-fetcher.spec.js +45 -0
- package/src/features/platform-limits/customer-groups/hooks/use-customer-groups-platform-limits-modal-state/index.js +1 -0
- package/src/features/platform-limits/customer-groups/hooks/use-customer-groups-platform-limits-modal-state/use-customer-groups-platform-limits-modal-state.js +21 -0
- package/src/features/platform-limits/customer-groups/hooks/use-customer-groups-platform-limits-modal-state/use-customer-groups-platform-limits-modal-state.spec.js +39 -0
- package/src/features/platform-limits/customer-groups/hooks/use-customer-groups-platform-limits-status/index.js +1 -0
- package/src/features/platform-limits/customer-groups/hooks/use-customer-groups-platform-limits-status/use-customer-groups-platform-limits-status.js +35 -0
- package/src/features/platform-limits/customer-groups/hooks/use-customer-groups-platform-limits-status/use-customer-groups-platform-limits-status.spec.js +66 -0
- package/src/features/platform-limits/customer-groups/index.js +3 -0
- package/src/features/platform-limits/customers/components/index.js +5 -0
- package/src/features/platform-limits/customers/components/platform-limits-customers-combined/index.js +1 -0
- package/src/features/platform-limits/customers/components/platform-limits-customers-combined/platform-limits-customers-combined.jsx +28 -0
- package/src/features/platform-limits/customers/components/platform-limits-customers-combined/platform-limits-customers-combined.module.css +3 -0
- package/src/features/platform-limits/customers/components/platform-limits-customers-error-modal/index.js +1 -0
- package/src/features/platform-limits/customers/components/platform-limits-customers-error-modal/messages.js +14 -0
- package/src/features/platform-limits/customers/components/platform-limits-customers-error-modal/platform-limits-customers-error-modal.jsx +43 -0
- package/src/features/platform-limits/customers/components/platform-limits-customers-notification/index.js +1 -0
- package/src/features/platform-limits/customers/components/platform-limits-customers-notification/platform-limits-customers-notification.jsx +40 -0
- package/src/features/platform-limits/customers/components/platform-limits-customers-notification/platform-limits-customers-notification.spec.js +51 -0
- package/src/features/platform-limits/customers/components/platform-limits-customers-status/index.js +1 -0
- package/src/features/platform-limits/customers/components/platform-limits-customers-status/messages.js +9 -0
- package/src/features/platform-limits/customers/components/platform-limits-customers-status/platform-limits-customers-status.jsx +36 -0
- package/src/features/platform-limits/customers/components/platform-limits-customers-status/platform-limits-customers-status.module.css +3 -0
- package/src/features/platform-limits/customers/components/platform-limits-customers-tooltip/index.js +1 -0
- package/src/features/platform-limits/customers/components/platform-limits-customers-tooltip/messages.js +9 -0
- package/src/features/platform-limits/customers/components/platform-limits-customers-tooltip/platform-limits-customers-tooltip.jsx +17 -0
- package/src/features/platform-limits/customers/hocs/index.js +2 -0
- package/src/features/platform-limits/customers/hocs/inject-customers-platform-limits/index.js +1 -0
- package/src/features/platform-limits/customers/hocs/inject-customers-platform-limits/inject-customers-platform-limits.jsx +23 -0
- package/src/features/platform-limits/customers/hooks/index.js +4 -0
- package/src/features/platform-limits/customers/hooks/use-customers-platform-limits/index.js +1 -0
- package/src/features/platform-limits/customers/hooks/use-customers-platform-limits/use-customers-platform-limits.js +38 -0
- package/src/features/platform-limits/customers/hooks/use-customers-platform-limits-fetcher/index.js +1 -0
- package/src/features/platform-limits/customers/hooks/use-customers-platform-limits-fetcher/use-customers-platform-limits-fetcher.js +18 -0
- package/src/features/platform-limits/customers/hooks/use-customers-platform-limits-fetcher/use-customers-platform-limits-fetcher.spec.js +43 -0
- package/src/features/platform-limits/customers/hooks/use-customers-platform-limits-modal-state/index.js +1 -0
- package/src/features/platform-limits/customers/hooks/use-customers-platform-limits-modal-state/use-customers-platform-limits-modal-state.js +20 -0
- package/src/features/platform-limits/customers/hooks/use-customers-platform-limits-modal-state/use-customers-platform-limits-modal-state.spec.js +39 -0
- package/src/features/platform-limits/customers/hooks/use-customers-platform-limits-status/index.js +1 -0
- package/src/features/platform-limits/customers/hooks/use-customers-platform-limits-status/use-customers-platform-limits-status.js +35 -0
- package/src/features/platform-limits/customers/hooks/use-customers-platform-limits-status/use-customers-platform-limits-status.spec.js +61 -0
- package/src/features/platform-limits/customers/index.js +3 -0
- package/src/features/platform-limits/index.js +21 -0
- package/src/features/platform-limits/shared/components/index.js +2 -0
- package/src/features/platform-limits/shared/components/notifications/error/error.jsx +33 -0
- package/src/features/platform-limits/shared/components/notifications/error/index.js +1 -0
- package/src/features/platform-limits/shared/components/notifications/error/messages.js +34 -0
- package/src/features/platform-limits/shared/components/notifications/index.js +1 -0
- package/src/features/platform-limits/shared/components/notifications/notifications.js +9 -0
- package/src/features/platform-limits/shared/components/notifications/warning/index.js +1 -0
- package/src/features/platform-limits/shared/components/notifications/warning/messages.js +34 -0
- package/src/features/platform-limits/shared/components/notifications/warning/warning.jsx +41 -0
- package/src/features/platform-limits/shared/components/status-text/index.js +1 -0
- package/src/features/platform-limits/shared/components/status-text/status-text.jsx +19 -0
- package/src/features/platform-limits/shared/constants.js +16 -0
- package/src/features/platform-limits/shared/hooks/index.js +5 -0
- package/src/features/platform-limits/shared/hooks/use-intercept-navigation/index.js +1 -0
- package/src/features/platform-limits/shared/hooks/use-intercept-navigation/use-intercept-navigation.js +31 -0
- package/src/features/platform-limits/shared/hooks/use-intercept-navigation/use-intercept-navigation.spec.js +76 -0
- package/src/features/platform-limits/shared/hooks/use-limits-modal-state/index.js +1 -0
- package/src/features/platform-limits/shared/hooks/use-limits-modal-state/use-limits-modal-state.js +17 -0
- package/src/features/platform-limits/shared/hooks/use-limits-modal-state/use-limits-modal-state.spec.js +33 -0
- package/src/features/platform-limits/shared/hooks/use-platform-limits-fetcher/__mocks__/index.js +405 -0
- package/src/features/platform-limits/shared/hooks/use-platform-limits-fetcher/index.js +1 -0
- package/src/features/platform-limits/shared/hooks/use-platform-limits-fetcher/mocks/handlers.js +16 -0
- package/src/features/platform-limits/shared/hooks/use-platform-limits-fetcher/mocks/index.js +4 -0
- package/src/features/platform-limits/shared/hooks/use-platform-limits-fetcher/platform-limits-query-variables.js +18 -0
- package/src/features/platform-limits/shared/hooks/use-platform-limits-fetcher/use-platform-limits-fetcher.ctp.graphql +87 -0
- package/src/features/platform-limits/shared/hooks/use-platform-limits-fetcher/use-platform-limits-fetcher.js +30 -0
- package/src/features/platform-limits/shared/hooks/use-platform-limits-fetcher/use-platform-limits-fetcher.spec.js +202 -0
- package/src/features/platform-limits/shared/index.js +15 -0
- package/src/features/platform-limits/shared/utils/index.js +5 -0
- package/src/features/platform-limits/shared/utils/utils.js +17 -0
- package/src/features/platform-limits/shared/utils/utils.spec.js +126 -0
- package/src/features/platform-limits/shipping-methods/components/index.js +3 -0
- package/src/features/platform-limits/shipping-methods/components/platform-limits-shipping-methods-notification/index.js +1 -0
- package/src/features/platform-limits/shipping-methods/components/platform-limits-shipping-methods-notification/platform-limits-shipping-methods-notification.jsx +42 -0
- package/src/features/platform-limits/shipping-methods/components/platform-limits-shipping-methods-notification/platform-limits-shipping-methods-notification.spec.js +51 -0
- package/src/features/platform-limits/shipping-methods/components/platform-limits-shipping-methods-status/index.js +1 -0
- package/src/features/platform-limits/shipping-methods/components/platform-limits-shipping-methods-status/messages.js +9 -0
- package/src/features/platform-limits/shipping-methods/components/platform-limits-shipping-methods-status/platform-limits-shipping-methods-status.jsx +29 -0
- package/src/features/platform-limits/shipping-methods/components/platform-limits-shipping-methods-status/platform-limits-shipping-methods-status.spec.js +37 -0
- package/src/features/platform-limits/shipping-methods/components/platform-limits-shipping-methods-tooltip/index.js +1 -0
- package/src/features/platform-limits/shipping-methods/components/platform-limits-shipping-methods-tooltip/messages.js +10 -0
- package/src/features/platform-limits/shipping-methods/components/platform-limits-shipping-methods-tooltip/platform-limits-shipping-methods-tooltip.jsx +18 -0
- package/src/features/platform-limits/shipping-methods/hocs/index.js +2 -0
- package/src/features/platform-limits/shipping-methods/hocs/inject-shipping-methods-platform-limits/index.js +1 -0
- package/src/features/platform-limits/shipping-methods/hocs/inject-shipping-methods-platform-limits/inject-shipping-methods-platform-limits.jsx +23 -0
- package/src/features/platform-limits/shipping-methods/hooks/index.js +3 -0
- package/src/features/platform-limits/shipping-methods/hooks/use-shipping-methods-platform-limits/index.js +1 -0
- package/src/features/platform-limits/shipping-methods/hooks/use-shipping-methods-platform-limits/use-shipping-methods-platform-limits.js +30 -0
- package/src/features/platform-limits/shipping-methods/hooks/use-shipping-methods-platform-limits-fetcher/index.js +1 -0
- package/src/features/platform-limits/shipping-methods/hooks/use-shipping-methods-platform-limits-fetcher/use-shipping-methods-platform-limits-fetcher.js +18 -0
- package/src/features/platform-limits/shipping-methods/hooks/use-shipping-methods-platform-limits-fetcher/use-shipping-methods-platform-limits-fetcher.spec.js +46 -0
- package/src/features/platform-limits/shipping-methods/hooks/use-shipping-methods-platform-limits-status/index.js +1 -0
- package/src/features/platform-limits/shipping-methods/hooks/use-shipping-methods-platform-limits-status/use-shipping-methods-platform-limits-status.js +35 -0
- package/src/features/platform-limits/shipping-methods/hooks/use-shipping-methods-platform-limits-status/use-shipping-methods-platform-limits-status.spec.js +67 -0
- package/src/features/platform-limits/shipping-methods/index.js +3 -0
- package/src/features/platform-limits/stores/hooks/index.js +3 -0
- package/src/features/platform-limits/stores/hooks/use-store-platform-limits/index.js +1 -0
- package/src/features/platform-limits/stores/hooks/use-store-platform-limits/use-store-platform-limits.js +19 -0
- package/src/features/platform-limits/stores/hooks/use-store-platform-limits-fetcher/index.js +1 -0
- package/src/features/platform-limits/stores/hooks/use-store-platform-limits-fetcher/use-store-platform-limits-fetcher.js +28 -0
- package/src/features/platform-limits/stores/hooks/use-store-platform-limits-fetcher/use-store-platform-limits-fetcher.spec.js +51 -0
- package/src/features/platform-limits/stores/hooks/use-store-platform-limits-status/index.js +1 -0
- package/src/features/platform-limits/stores/hooks/use-store-platform-limits-status/use-store-platform-limits-status.js +35 -0
- package/src/features/platform-limits/stores/hooks/use-store-platform-limits-status/use-store-platform-limits-status.spec.js +61 -0
- package/src/features/platform-limits/stores/index.js +1 -0
- package/src/features/platform-limits/tax-categories/components/index.js +3 -0
- package/src/features/platform-limits/tax-categories/components/platform-limits-tax-categories-notification/index.js +1 -0
- package/src/features/platform-limits/tax-categories/components/platform-limits-tax-categories-notification/platform-limits-tax-categories-notification.jsx +42 -0
- package/src/features/platform-limits/tax-categories/components/platform-limits-tax-categories-notification/platform-limits-tax-categories-notification.spec.js +51 -0
- package/src/features/platform-limits/tax-categories/components/platform-limits-tax-categories-status/index.js +1 -0
- package/src/features/platform-limits/tax-categories/components/platform-limits-tax-categories-status/messages.js +9 -0
- package/src/features/platform-limits/tax-categories/components/platform-limits-tax-categories-status/platform-limits-tax-categories-status.jsx +29 -0
- package/src/features/platform-limits/tax-categories/components/platform-limits-tax-categories-status/platform-limits-tax-categories-status.spec.js +37 -0
- package/src/features/platform-limits/tax-categories/components/platform-limits-tax-categories-tooltip/index.js +1 -0
- package/src/features/platform-limits/tax-categories/components/platform-limits-tax-categories-tooltip/messages.js +9 -0
- package/src/features/platform-limits/tax-categories/components/platform-limits-tax-categories-tooltip/platform-limits-tax-categories-tooltip.jsx +18 -0
- package/src/features/platform-limits/tax-categories/hocs/index.js +2 -0
- package/src/features/platform-limits/tax-categories/hocs/inject-tax-categories-platform-limits/index.js +1 -0
- package/src/features/platform-limits/tax-categories/hocs/inject-tax-categories-platform-limits/inject-tax-categories-platform-limits.jsx +23 -0
- package/src/features/platform-limits/tax-categories/hooks/index.js +3 -0
- package/src/features/platform-limits/tax-categories/hooks/use-tax-categories-platform-limits/index.js +1 -0
- package/src/features/platform-limits/tax-categories/hooks/use-tax-categories-platform-limits/use-tax-categories-platform-limits.js +30 -0
- package/src/features/platform-limits/tax-categories/hooks/use-tax-categories-platform-limits-fetcher/index.js +1 -0
- package/src/features/platform-limits/tax-categories/hooks/use-tax-categories-platform-limits-fetcher/use-tax-categories-platform-limits-fetcher.js +18 -0
- package/src/features/platform-limits/tax-categories/hooks/use-tax-categories-platform-limits-fetcher/use-tax-categories-platform-limits-fetcher.spec.js +48 -0
- package/src/features/platform-limits/tax-categories/hooks/use-tax-categories-platform-limits-status/index.js +1 -0
- package/src/features/platform-limits/tax-categories/hooks/use-tax-categories-platform-limits-status/use-tax-categories-platform-limits-status.js +35 -0
- package/src/features/platform-limits/tax-categories/hooks/use-tax-categories-platform-limits-status/use-tax-categories-platform-limits-status.spec.js +66 -0
- package/src/features/platform-limits/tax-categories/index.js +3 -0
- package/src/features/platform-limits/test-utils/index.js +1 -0
- package/src/features/platform-limits/zones/components/index.js +3 -0
- package/src/features/platform-limits/zones/components/platform-limits-zones-notification/index.js +1 -0
- package/src/features/platform-limits/zones/components/platform-limits-zones-notification/platform-limits-zones-notification.jsx +40 -0
- package/src/features/platform-limits/zones/components/platform-limits-zones-notification/platform-limits-zones-notification.spec.js +51 -0
- package/src/features/platform-limits/zones/components/platform-limits-zones-status/index.js +1 -0
- package/src/features/platform-limits/zones/components/platform-limits-zones-status/messages.js +9 -0
- package/src/features/platform-limits/zones/components/platform-limits-zones-status/platform-limits-zones-status.jsx +32 -0
- package/src/features/platform-limits/zones/components/platform-limits-zones-status/platform-limits-zones-status.spec.js +37 -0
- package/src/features/platform-limits/zones/components/platform-limits-zones-tooltip/index.js +1 -0
- package/src/features/platform-limits/zones/components/platform-limits-zones-tooltip/messages.js +9 -0
- package/src/features/platform-limits/zones/components/platform-limits-zones-tooltip/platform-limits-zones-tooltip.jsx +17 -0
- package/src/features/platform-limits/zones/hocs/index.js +2 -0
- package/src/features/platform-limits/zones/hocs/inject-zones-platform-limits/index.js +1 -0
- package/src/features/platform-limits/zones/hocs/inject-zones-platform-limits/inject-zones-platform-limits.jsx +23 -0
- package/src/features/platform-limits/zones/hooks/index.js +3 -0
- package/src/features/platform-limits/zones/hooks/use-zones-platform-limits/index.js +1 -0
- package/src/features/platform-limits/zones/hooks/use-zones-platform-limits/use-zones-platform-limits.js +24 -0
- package/src/features/platform-limits/zones/hooks/use-zones-platform-limits-fetcher/index.js +1 -0
- package/src/features/platform-limits/zones/hooks/use-zones-platform-limits-fetcher/use-zones-platform-limits-fetcher.js +18 -0
- package/src/features/platform-limits/zones/hooks/use-zones-platform-limits-fetcher/use-zones-platform-limits-fetcher.spec.js +42 -0
- package/src/features/platform-limits/zones/hooks/use-zones-platform-limits-status/index.js +1 -0
- package/src/features/platform-limits/zones/hooks/use-zones-platform-limits-status/use-zones-platform-limits-status.js +35 -0
- package/src/features/platform-limits/zones/hooks/use-zones-platform-limits-status/use-zones-platform-limits-status.spec.js +61 -0
- package/src/features/platform-limits/zones/index.js +2 -0
- package/src/fields/attribute-reference-label/attribute-reference-label.jsx +38 -0
- package/src/fields/attribute-reference-label/attribute-reference-label.module.css +7 -0
- package/src/fields/attribute-reference-label/index.js +1 -0
- package/src/fields/autocomplete/README.md +66 -0
- package/src/fields/autocomplete/autocomplete.jsx +129 -0
- package/src/fields/autocomplete/autocomplete.module.css +3 -0
- package/src/fields/autocomplete/autocomplete.spec.js +144 -0
- package/src/fields/autocomplete/dropdown-indicator.jsx +14 -0
- package/src/fields/autocomplete/dropdown-indicator.module.css +5 -0
- package/src/fields/autocomplete/index.js +1 -0
- package/src/fields/boolean-field/boolean-field.jsx +82 -0
- package/src/fields/boolean-field/boolean-field.spec.js +80 -0
- package/src/fields/boolean-field/index.js +3 -0
- package/src/fields/boolean-field/messages.js +14 -0
- package/src/fields/checkbox-field/checkbox-field.jsx +50 -0
- package/src/fields/checkbox-field/checkbox-field.module.css +40 -0
- package/src/fields/checkbox-field/checkbox-field.spec.js +67 -0
- package/src/fields/checkbox-field/index.js +1 -0
- package/src/fields/checkbox-field/radio-check-icons.png +0 -0
- package/src/fields/expandable-field/expandable-field.jsx +93 -0
- package/src/fields/expandable-field/expandable-field.module.css +3 -0
- package/src/fields/expandable-field/expandable-field.spec.js +68 -0
- package/src/fields/expandable-field/index.js +1 -0
- package/src/fields/expandable-field/messages.js +14 -0
- package/src/fields/label-range/index.js +1 -0
- package/src/fields/label-range/label-range.jsx +28 -0
- package/src/fields/label-range/label-range.module.css +4 -0
- package/src/fields/label-range/label-range.spec.js +28 -0
- package/src/fields/label-required/index.js +2 -0
- package/src/fields/label-required/label-required.jsx +25 -0
- package/src/fields/localized-field/index.js +1 -0
- package/src/fields/localized-field/localized-field.jsx +320 -0
- package/src/fields/localized-field/localized-field.module.css +291 -0
- package/src/fields/localized-field/localized-field.spec.js +53 -0
- package/src/fields/localized-input/index.js +1 -0
- package/src/fields/localized-input/localized-input.jsx +20 -0
- package/src/fields/localized-textarea/index.js +1 -0
- package/src/fields/localized-textarea/localized-textarea.jsx +50 -0
- package/src/fields/missing-value-field/__snapshots__/missing-value-field.spec.js.snap +22 -0
- package/src/fields/missing-value-field/index.js +2 -0
- package/src/fields/missing-value-field/messages.js +9 -0
- package/src/fields/missing-value-field/missing-value-field.jsx +28 -0
- package/src/fields/missing-value-field/missing-value-field.spec.js +35 -0
- package/src/fields/multi-value-search-input/index.js +1 -0
- package/src/fields/multi-value-search-input/messages.js +14 -0
- package/src/fields/multi-value-search-input/multi-value-search-input.jsx +175 -0
- package/src/fields/multi-value-search-input/multi-value-search-input.module.css +45 -0
- package/src/fields/numeric-format-input/index.js +1 -0
- package/src/fields/numeric-format-input/numeric-format-input.jsx +184 -0
- package/src/fields/numeric-format-input/numeric-format-input.module.css +10 -0
- package/src/fields/numeric-format-input/numeric-format-input.spec.js +323 -0
- package/src/fields/search-input/index.js +1 -0
- package/src/fields/search-input/messages.js +14 -0
- package/src/fields/search-input/search-input.jsx +202 -0
- package/src/fields/search-input/search-input.module.css +75 -0
- package/src/fields/search-input/search-input.spec.js +116 -0
- package/src/fields/throttled-field/index.js +1 -0
- package/src/fields/throttled-field/throttled-field.jsx +189 -0
- package/src/fields/throttled-field/throttled-field.module.css +75 -0
- package/src/fields/throttled-field/throttled-field.spec.js +172 -0
- package/src/hocs/index.js +9 -0
- package/src/hocs/inject-data-table-pagination-state/index.js +1 -0
- package/src/hocs/inject-data-table-pagination-state/inject-data-table-pagination-state.jsx +41 -0
- package/src/hocs/inject-modal-state/index.js +1 -0
- package/src/hocs/inject-modal-state/inject-modal-state.jsx +31 -0
- package/src/hocs/inject-modal-state/inject-modal-state.spec.js +60 -0
- package/src/hocs/inject-notifications/README.md +43 -0
- package/src/hocs/inject-notifications/index.js +1 -0
- package/src/hocs/inject-notifications/inject-notifications.jsx +35 -0
- package/src/hocs/inject-notifications/inject-notifications.spec.js +55 -0
- package/src/hocs/inject-storage/index.js +1 -0
- package/src/hocs/inject-storage/inject-storage.jsx +45 -0
- package/src/hocs/inject-storage/inject-storage.spec.js +32 -0
- package/src/hocs/inject-toggle-state/index.js +1 -0
- package/src/hocs/inject-toggle-state/inject-toggle-state.jsx +31 -0
- package/src/hocs/inject-toggle-state/inject-toggle-state.spec.js +58 -0
- package/src/hocs/utils/get-display-name/get-display-name.js +13 -0
- package/src/hocs/utils/get-display-name/get-display-name.spec.js +52 -0
- package/src/hocs/utils/get-display-name/index.js +1 -0
- package/src/hocs/utils/index.js +2 -0
- package/src/hocs/utils/set-display-name/index.js +1 -0
- package/src/hocs/utils/set-display-name/set-display-name.js +8 -0
- package/src/hocs/utils/set-display-name/set-display-name.spec.js +9 -0
- package/src/hocs/with-props/index.js +1 -0
- package/src/hocs/with-props/with-props.jsx +21 -0
- package/src/hocs/with-props/with-props.spec.js +57 -0
- package/src/hocs/with-redirect-to/index.js +1 -0
- package/src/hocs/with-redirect-to/with-redirect-to.jsx +42 -0
- package/src/hocs/with-redirect-to/with-redirect-to.spec.js +77 -0
- package/src/hocs/wrap-display-name/index.js +1 -0
- package/src/hocs/wrap-display-name/wrap-display-name.js +6 -0
- package/src/hocs/wrap-display-name/wrap-display-name.spec.js +26 -0
- package/src/hooks/index.js +37 -0
- package/src/hooks/use-debounced-promise-callback.js +8 -0
- package/src/hooks/use-did-form-validation-fail/index.js +1 -0
- package/src/hooks/use-did-form-validation-fail/use-did-form-validation-fail.js +30 -0
- package/src/hooks/use-did-form-validation-fail/use-did-form-validation-fail.spec.js +48 -0
- package/src/hooks/use-event-callback/index.js +1 -0
- package/src/hooks/use-event-callback/use-event-callback.js +18 -0
- package/src/hooks/use-format-localized-field-to-string/index.js +1 -0
- package/src/hooks/use-format-localized-field-to-string/use-format-localized-field-to-string.js +43 -0
- package/src/hooks/use-format-localized-field-to-string/use-format-localized-field-to-string.spec.js +36 -0
- package/src/hooks/use-is-sso-user/index.js +1 -0
- package/src/hooks/use-is-sso-user/use-is-sso-user.js +13 -0
- package/src/hooks/use-is-sso-user/use-is-sso-user.spec.js +46 -0
- package/src/hooks/use-localized-key-fallback/index.js +1 -0
- package/src/hooks/use-localized-key-fallback/messages.js +9 -0
- package/src/hooks/use-localized-key-fallback/use-localized-key-fallback.js +31 -0
- package/src/hooks/use-localized-key-fallback/use-localized-key-fallback.spec.js +44 -0
- package/src/hooks/use-pending-requests/index.js +1 -0
- package/src/hooks/use-pending-requests/use-pending-requests.js +39 -0
- package/src/hooks/use-pending-requests/use-pending-requests.spec.js +10 -0
- package/src/hooks/use-persisted-reminder/index.js +1 -0
- package/src/hooks/use-persisted-reminder/use-persisted-reminder.js +88 -0
- package/src/hooks/use-persisted-reminder/use-persisted-reminder.spec.js +114 -0
- package/src/hooks/use-persisted-table-configuration/index.js +1 -0
- package/src/hooks/use-persisted-table-configuration/use-persisted-table-configuration.js +136 -0
- package/src/hooks/use-persisted-table-configuration/use-persisted-table-configuration.spec.js +170 -0
- package/src/hooks/use-previous/index.js +1 -0
- package/src/hooks/use-previous/use-previous.js +12 -0
- package/src/hooks/use-previous/use-previous.spec.js +25 -0
- package/src/hooks/use-product-selections-fetcher/conversions.js +15 -0
- package/src/hooks/use-product-selections-fetcher/fetch-product-selections.ctp.graphql +18 -0
- package/src/hooks/use-product-selections-fetcher/index.js +2 -0
- package/src/hooks/use-product-selections-fetcher/mocks/handlers.js +16 -0
- package/src/hooks/use-product-selections-fetcher/mocks/index.js +3 -0
- package/src/hooks/use-product-selections-fetcher/use-product-selections-fetcher.js +39 -0
- package/src/hooks/use-product-selections-fetcher/use-product-selections-fetcher.spec.js +71 -0
- package/src/hooks/use-product-selections-total-fetcher/fetch-product-selections-total.ctp.graphql +5 -0
- package/src/hooks/use-product-selections-total-fetcher/index.js +2 -0
- package/src/hooks/use-product-selections-total-fetcher/mocks/handlers.js +19 -0
- package/src/hooks/use-product-selections-total-fetcher/mocks/index.js +3 -0
- package/src/hooks/use-product-selections-total-fetcher/use-product-selections-total-fetcher.js +19 -0
- package/src/hooks/use-role-based-channels-fetcher/index.js +2 -0
- package/src/hooks/use-role-based-channels-fetcher/role-based-channels-fetcher.ctp.graphql +12 -0
- package/src/hooks/use-role-based-channels-fetcher/test-utils.js +37 -0
- package/src/hooks/use-role-based-channels-fetcher/use-role-based-channels-fetcher.js +44 -0
- package/src/hooks/use-role-notification/index.js +1 -0
- package/src/hooks/use-role-notification/notification-text/index.js +1 -0
- package/src/hooks/use-role-notification/notification-text/messages.js +21 -0
- package/src/hooks/use-role-notification/notification-text/notification-text.jsx +46 -0
- package/src/hooks/use-role-notification/use-role-notification.jsx +36 -0
- package/src/hooks/use-role-notification/use-role-notification.spec.js +46 -0
- package/src/hooks/use-role-notification-effect/index.js +1 -0
- package/src/hooks/use-role-notification-effect/use-role-notification-effect.js +56 -0
- package/src/hooks/use-role-notification-effect/use-role-notification-effect.spec.js +72 -0
- package/src/hooks/use-storage/__mocks__/index.js +26 -0
- package/src/hooks/use-storage/index.js +1 -0
- package/src/hooks/use-storage/use-storage.js +85 -0
- package/src/hooks/use-storage/use-storage.spec.js +237 -0
- package/src/hooks/use-store-keys-in-data-fence/index.js +1 -0
- package/src/hooks/use-store-keys-in-data-fence/use-store-keys-in-data-fence.js +38 -0
- package/src/hooks/use-store-keys-in-data-fence/use-store-keys-in-data-fence.spec.js +141 -0
- package/src/hooks/use-stores-list-fetcher/index.js +2 -0
- package/src/hooks/use-stores-list-fetcher/mocks/handlers.js +76 -0
- package/src/hooks/use-stores-list-fetcher/mocks/index.js +3 -0
- package/src/hooks/use-stores-list-fetcher/stores-list-query.ctp.graphql +52 -0
- package/src/hooks/use-stores-list-fetcher/use-stores-list-fetcher.js +71 -0
- package/src/hooks/use-stores-list-fetcher/use-stores-list-fetcher.spec.js +234 -0
- package/src/hooks/use-tracking/index.js +1 -0
- package/src/hooks/use-tracking/use-tracking.js +4 -0
- package/src/hooks/use-tracking/use-tracking.spec.js +29 -0
- package/src/hooks/use-tracking-shared/__mocks__/index.js +16 -0
- package/src/hooks/use-tracking-shared/index.js +1 -0
- package/src/hooks/use-tracking-shared/use-tracking-shared.js +58 -0
- package/src/index.js +489 -0
- package/src/internal-index.js +143 -0
- package/src/utils/active-modals/active-modals.js +7 -0
- package/src/utils/active-modals/active-modals.spec.js +27 -0
- package/src/utils/active-modals/index.js +1 -0
- package/src/utils/ariaset/ariaset.js +11 -0
- package/src/utils/ariaset/ariaset.spec.js +20 -0
- package/src/utils/ariaset/index.js +1 -0
- package/src/utils/array-helpers/array-helpers.js +2 -0
- package/src/utils/array-helpers/index.js +1 -0
- package/src/utils/attributes/attributes.js +38 -0
- package/src/utils/attributes/attributes.spec.js +180 -0
- package/src/utils/attributes/index.js +1 -0
- package/src/utils/build-search-query/build-search-query.js +27 -0
- package/src/utils/build-search-query/build-search-query.spec.js +129 -0
- package/src/utils/build-search-query/index.js +1 -0
- package/src/utils/bulk-notifications/get-bulk-notification.js +34 -0
- package/src/utils/bulk-notifications/get-bulk-notification.spec.js +142 -0
- package/src/utils/bulk-notifications/index.js +4 -0
- package/src/utils/business-roles/business-roles.js +24 -0
- package/src/utils/business-roles/index.js +4 -0
- package/src/utils/business-roles/messages.js +95 -0
- package/src/utils/capitalize-first/capitalize-first.js +3 -0
- package/src/utils/capitalize-first/capitalize-first.spec.js +7 -0
- package/src/utils/capitalize-first/index.js +1 -0
- package/src/utils/categories/categories.js +56 -0
- package/src/utils/categories/categories.spec.js +122 -0
- package/src/utils/categories/index.js +1 -0
- package/src/utils/clone/clone.js +3 -0
- package/src/utils/clone/clone.spec.js +23 -0
- package/src/utils/clone/index.js +1 -0
- package/src/utils/coerce-to-integer/coerce-to-integer.js +3 -0
- package/src/utils/coerce-to-integer/coerce-to-integer.spec.js +49 -0
- package/src/utils/coerce-to-integer/index.js +1 -0
- package/src/utils/connector/connector.js +30 -0
- package/src/utils/connector/connector.spec.js +174 -0
- package/src/utils/connector/index.js +1 -0
- package/src/utils/constants.js +43 -0
- package/src/utils/conversions/sort-array.js +6 -0
- package/src/utils/create-next-sort-definition/create-next-sort-definition.js +46 -0
- package/src/utils/create-next-sort-definition/create-next-sort-definition.spec.js +121 -0
- package/src/utils/create-next-sort-definition/index.js +1 -0
- package/src/utils/create-reducer/create-reducer.js +21 -0
- package/src/utils/create-reducer/create-reducer.spec.js +45 -0
- package/src/utils/create-reducer/index.js +1 -0
- package/src/utils/create-resource-reducer/create-resource-reducer.js +53 -0
- package/src/utils/create-resource-reducer/create-resource-reducer.spec.js +151 -0
- package/src/utils/create-resource-reducer/index.js +1 -0
- package/src/utils/customer/format-customer-address/format-customer-address.js +12 -0
- package/src/utils/customer/format-customer-address/format-customer-address.spec.js +43 -0
- package/src/utils/customer/format-customer-address/index.js +1 -0
- package/src/utils/customer/format-customer-name/format-customer-name.js +9 -0
- package/src/utils/customer/format-customer-name/format-customer-name.spec.js +44 -0
- package/src/utils/customer/format-customer-name/index.js +1 -0
- package/src/utils/customer/format-customer-title/format-customer-title.js +5 -0
- package/src/utils/customer/format-customer-title/format-customer-title.spec.js +23 -0
- package/src/utils/customer/format-customer-title/index.js +1 -0
- package/src/utils/dataset/dataset.js +34 -0
- package/src/utils/dataset/dataset.spec.js +70 -0
- package/src/utils/dataset/index.js +1 -0
- package/src/utils/encodings/encodings.js +24 -0
- package/src/utils/encodings/encodings.spec.js +21 -0
- package/src/utils/encodings/index.js +1 -0
- package/src/utils/filters/README.md +56 -0
- package/src/utils/filters/custom-fields/custom-fields.js +56 -0
- package/src/utils/filters/custom-fields/custom-fields.spec.js +328 -0
- package/src/utils/filters/custom-fields/index.js +1 -0
- package/src/utils/filters/date/date.js +114 -0
- package/src/utils/filters/date/date.spec.js +138 -0
- package/src/utils/filters/date/index.js +1 -0
- package/src/utils/filters/graphql/category-level/category-level.js +17 -0
- package/src/utils/filters/graphql/category-level/index.js +1 -0
- package/src/utils/filters/graphql/date/date.js +58 -0
- package/src/utils/filters/graphql/date/date.spec.js +122 -0
- package/src/utils/filters/graphql/date/index.js +1 -0
- package/src/utils/filters/graphql/graphql.js +42 -0
- package/src/utils/filters/graphql/graphql.spec.js +130 -0
- package/src/utils/filters/graphql/index.js +1 -0
- package/src/utils/filters/graphql/missing/index.js +1 -0
- package/src/utils/filters/graphql/missing/missing.js +7 -0
- package/src/utils/filters/graphql/missing/missing.spec.js +17 -0
- package/src/utils/filters/graphql/missing-locale/index.js +1 -0
- package/src/utils/filters/graphql/missing-locale/missing-locale.js +8 -0
- package/src/utils/filters/graphql/missing-locale/missing-locale.spec.js +17 -0
- package/src/utils/filters/graphql/number/index.js +1 -0
- package/src/utils/filters/graphql/number/number.js +37 -0
- package/src/utils/filters/graphql/number/number.spec.js +65 -0
- package/src/utils/filters/graphql/reference/index.js +1 -0
- package/src/utils/filters/graphql/reference/reference.js +26 -0
- package/src/utils/filters/graphql/reference/reference.spec.js +20 -0
- package/src/utils/filters/graphql/text/index.js +1 -0
- package/src/utils/filters/graphql/text/text.js +8 -0
- package/src/utils/filters/graphql/text/text.spec.js +35 -0
- package/src/utils/filters/is-date/index.js +1 -0
- package/src/utils/filters/is-date/is-date.js +17 -0
- package/src/utils/filters/is-date/is-date.spec.js +73 -0
- package/src/utils/filters/is-empty/index.js +1 -0
- package/src/utils/filters/is-empty/is-empty.js +9 -0
- package/src/utils/filters/is-empty/is-empty.spec.js +20 -0
- package/src/utils/filters/is-empty/range/index.js +1 -0
- package/src/utils/filters/is-empty/range/range.js +8 -0
- package/src/utils/filters/is-empty/range/range.spec.js +22 -0
- package/src/utils/filters/is-empty/single/index.js +1 -0
- package/src/utils/filters/is-empty/single/single.js +5 -0
- package/src/utils/filters/is-empty/single/single.spec.js +17 -0
- package/src/utils/filters/localized-string/index.js +1 -0
- package/src/utils/filters/localized-string/localized-string.js +4 -0
- package/src/utils/filters/localized-string/localized-string.spec.js +26 -0
- package/src/utils/filters/money/index.js +1 -0
- package/src/utils/filters/money/money.js +36 -0
- package/src/utils/filters/money/money.spec.js +55 -0
- package/src/utils/filters/time/index.js +1 -0
- package/src/utils/filters/time/time.js +65 -0
- package/src/utils/filters/time/time.spec.js +96 -0
- package/src/utils/filters/validation/custom-field/custom-field.js +70 -0
- package/src/utils/filters/validation/custom-field/custom-field.spec.js +237 -0
- package/src/utils/filters/validation/custom-field/index.js +1 -0
- package/src/utils/filters/validation/date/date.js +42 -0
- package/src/utils/filters/validation/date/date.spec.js +60 -0
- package/src/utils/filters/validation/date/index.js +1 -0
- package/src/utils/filters/validation/enum/enum.js +16 -0
- package/src/utils/filters/validation/enum/enum.spec.js +44 -0
- package/src/utils/filters/validation/enum/index.js +1 -0
- package/src/utils/filters/validation/number/index.js +1 -0
- package/src/utils/filters/validation/number/number.js +52 -0
- package/src/utils/filters/validation/number/number.spec.js +39 -0
- package/src/utils/filters/validation/text/index.js +1 -0
- package/src/utils/filters/validation/text/text.js +9 -0
- package/src/utils/filters/validation/text/text.spec.js +20 -0
- package/src/utils/formats/custom-field/custom-field.js +66 -0
- package/src/utils/formats/custom-field/custom-field.spec.js +91 -0
- package/src/utils/formats/custom-field/index.js +1 -0
- package/src/utils/formats/date/__mocks__/index.js +2 -0
- package/src/utils/formats/date/date.js +58 -0
- package/src/utils/formats/date/date.spec.js +241 -0
- package/src/utils/formats/date/index.js +1 -0
- package/src/utils/formats/discount/discount.js +12 -0
- package/src/utils/formats/discount/discount.spec.js +75 -0
- package/src/utils/formats/discount/index.js +1 -0
- package/src/utils/formats/index.js +4 -0
- package/src/utils/formats/money/index.js +6 -0
- package/src/utils/formats/money/money.js +50 -0
- package/src/utils/formats/money/money.spec.js +117 -0
- package/src/utils/formats/percentage/index.js +1 -0
- package/src/utils/formats/percentage/percentage.js +7 -0
- package/src/utils/formats/percentage/percentage.spec.js +18 -0
- package/src/utils/formats/product-attribute/index.js +1 -0
- package/src/utils/formats/product-attribute/messages.js +14 -0
- package/src/utils/formats/product-attribute/product-attribute.js +127 -0
- package/src/utils/formats/product-attribute/product-attribute.spec.js +128 -0
- package/src/utils/get-currency-code-data/currency-code-data.js +1247 -0
- package/src/utils/get-currency-code-data/get-currency-code-data.js +53 -0
- package/src/utils/get-currency-code-data/index.js +12 -0
- package/src/utils/get-prefix-search-bounds/get-prefix-search-bounds.js +26 -0
- package/src/utils/get-prefix-search-bounds/get-prefix-search-bounds.spec.js +14 -0
- package/src/utils/get-prefix-search-bounds/index.js +1 -0
- package/src/utils/graphql/__snapshots__/graphql.spec.js.snap +45 -0
- package/src/utils/graphql/fragments/address.ctp.graphql +39 -0
- package/src/utils/graphql/fragments/custom-fields.ctp.graphql +67 -0
- package/src/utils/graphql/fragments/store-basic-info.ctp.graphql +11 -0
- package/src/utils/graphql/graphql.js +579 -0
- package/src/utils/graphql/graphql.spec.js +1129 -0
- package/src/utils/graphql/index.js +1 -0
- package/src/utils/has-error-code/has-error-code.js +15 -0
- package/src/utils/has-error-code/has-error-code.spec.js +56 -0
- package/src/utils/has-error-code/has-invalid-input-error.js +7 -0
- package/src/utils/has-error-code/has-semantic-error.js +7 -0
- package/src/utils/has-error-code/has-semantic-error.spec.js +56 -0
- package/src/utils/has-error-code/index.js +3 -0
- package/src/utils/is-uuid/index.js +1 -0
- package/src/utils/is-uuid/is-uuid.js +6 -0
- package/src/utils/is-uuid/is-uuid.spec.js +25 -0
- package/src/utils/minusify/index.js +1 -0
- package/src/utils/minusify/minusify.js +4 -0
- package/src/utils/minusify/minusify.spec.js +9 -0
- package/src/utils/numbers/index.js +1 -0
- package/src/utils/numbers/numbers.js +32 -0
- package/src/utils/numbers/numbers.spec.js +57 -0
- package/src/utils/omit-deep/index.js +1 -0
- package/src/utils/omit-deep/omit-deep.js +20 -0
- package/src/utils/pim-query-clauses.js +43 -0
- package/src/utils/prices/index.js +1 -0
- package/src/utils/prices/prices.js +79 -0
- package/src/utils/prices/prices.spec.js +265 -0
- package/src/utils/product-selections/convert-product-selection-from-graphql.js +80 -0
- package/src/utils/product-selections/index.js +1 -0
- package/src/utils/product-types/index.js +1 -0
- package/src/utils/product-types/product-types.js +122 -0
- package/src/utils/product-types/product-types.spec.js +328 -0
- package/src/utils/products/index.js +1 -0
- package/src/utils/products/messages.js +16 -0
- package/src/utils/products/products.jsx +258 -0
- package/src/utils/products/products.spec.js +331 -0
- package/src/utils/query-string/index.js +1 -0
- package/src/utils/query-string/query-string.js +37 -0
- package/src/utils/query-string/query-string.spec.js +56 -0
- package/src/utils/request-cache/index.js +2 -0
- package/src/utils/request-cache/request-cache.js +52 -0
- package/src/utils/request-cache/request-cache.spec.js +118 -0
- package/src/utils/shallow-equal/index.js +1 -0
- package/src/utils/shallow-equal/shallow-equal.js +19 -0
- package/src/utils/shallow-equal/shallow-equal.spec.js +45 -0
- package/src/utils/should-update-attribute-input/index.js +1 -0
- package/src/utils/should-update-attribute-input/should-update-attribute-input.js +43 -0
- package/src/utils/should-update-attribute-input/should-update-attribute-input.spec.js +96 -0
- package/src/utils/slugify/index.js +1 -0
- package/src/utils/slugify/slugify.js +10 -0
- package/src/utils/slugify/slugify.spec.js +11 -0
- package/src/utils/swap-array-items/index.js +2 -0
- package/src/utils/swap-array-items/swap-array-items.js +13 -0
- package/src/utils/swap-array-items/swap-array-items.spec.js +52 -0
- package/src/utils/text-fallback/text-fallback.js +6 -0
- package/src/utils/time-zones/index.js +5 -0
- package/src/utils/time-zones/time-zone-utils.js +34 -0
- package/src/utils/time-zones/time-zone-utils.spec.js +47 -0
- package/src/utils/track-menu-click/index.js +1 -0
- package/src/utils/track-menu-click/track-menu-click.js +28 -0
- package/src/utils/track-menu-click/track-menu-click.spec.js +66 -0
- package/src/utils/transform-to-proper-noun-case/index.js +1 -0
- package/src/utils/transform-to-proper-noun-case/transform-to-proper-noun-case.js +10 -0
- package/src/utils/transform-to-proper-noun-case/transform-to-proper-noun-case.spec.js +23 -0
- package/src/utils/truncate/index.js +1 -0
- package/src/utils/truncate/truncate.js +9 -0
- package/src/utils/truncate/truncate.spec.js +23 -0
- package/src/utils/type-definitions/index.js +1 -0
- package/src/utils/type-definitions/type-definitions.js +118 -0
- package/src/utils/type-definitions/type-definitions.spec.js +547 -0
- package/src/utils/update-status-in-list/index.js +1 -0
- package/src/utils/update-status-in-list/update-status-in-list.js +16 -0
- package/src/utils/validation/get-indexes-of-invalid-values.js +16 -0
- package/src/utils/validation/get-indexes-of-invalid-values.spec.js +31 -0
- package/src/utils/validation/index.js +3 -0
- package/src/utils/validation/validation.js +169 -0
- package/src/utils/validation/validation.spec.js +99 -0
- package/src/utils/validation/without-empty-errors-by-field.js +5 -0
- package/src/utils/validation/without-empty-errors-by-field.spec.js +74 -0
- package/src/utils/with-pending-requests/index.js +1 -0
- package/src/utils/with-pending-requests/with-pending-requests.jsx +21 -0
- package/src/utils/with-pending-requests/with-pending-requests.spec.js +62 -0
|
@@ -0,0 +1,1129 @@
|
|
|
1
|
+
import {
|
|
2
|
+
transformLocalizedFieldsForCategory,
|
|
3
|
+
mapShippingRateTierToGraphQL,
|
|
4
|
+
createGraphQlUpdateActions,
|
|
5
|
+
createAttributeTypeValue,
|
|
6
|
+
transformCustomFieldsRawToCustomFields,
|
|
7
|
+
extractErrorFromGraphQlResponse,
|
|
8
|
+
getIsLocalizedString,
|
|
9
|
+
} from './graphql';
|
|
10
|
+
import { PRECISION_TYPES } from '../constants';
|
|
11
|
+
|
|
12
|
+
describe('transformCustomFieldsRawToCustomFields', () => {
|
|
13
|
+
let result;
|
|
14
|
+
describe('when raw custom fields are not defined', () => {
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
result = transformCustomFieldsRawToCustomFields();
|
|
17
|
+
});
|
|
18
|
+
it('should return null', () => {
|
|
19
|
+
expect(result).toBe(null);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
describe('when raw custom fields are empty', () => {
|
|
23
|
+
beforeEach(() => {
|
|
24
|
+
result = transformCustomFieldsRawToCustomFields([]);
|
|
25
|
+
});
|
|
26
|
+
it('should return null', () => {
|
|
27
|
+
expect(result).toBe(null);
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
describe('when raw custom fields are non empty and defined', () => {
|
|
31
|
+
beforeEach(() => {
|
|
32
|
+
result = transformCustomFieldsRawToCustomFields([
|
|
33
|
+
{ name: 'fieldA', value: 'Hello' },
|
|
34
|
+
{ name: 'fieldB', value: 'Ciao' },
|
|
35
|
+
]);
|
|
36
|
+
});
|
|
37
|
+
it('should return a CustomField object', () => {
|
|
38
|
+
expect(result).toEqual({ fieldA: 'Hello', fieldB: 'Ciao' });
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
describe('transformLocalizedFieldsForCategory', () => {
|
|
44
|
+
describe('no parent and no ancestors', () => {
|
|
45
|
+
const expected = {
|
|
46
|
+
id: '1',
|
|
47
|
+
name: {
|
|
48
|
+
en: 'name',
|
|
49
|
+
de: 'name',
|
|
50
|
+
},
|
|
51
|
+
slug: {
|
|
52
|
+
en: 'slug',
|
|
53
|
+
de: 'slug',
|
|
54
|
+
},
|
|
55
|
+
externalId: 'xxx',
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const mapped = transformLocalizedFieldsForCategory(
|
|
59
|
+
{
|
|
60
|
+
id: '1',
|
|
61
|
+
nameAllLocales: [
|
|
62
|
+
{
|
|
63
|
+
locale: 'en',
|
|
64
|
+
value: 'name',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
locale: 'de',
|
|
68
|
+
value: 'name',
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
slugAllLocales: [
|
|
72
|
+
{
|
|
73
|
+
locale: 'en',
|
|
74
|
+
value: 'slug',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
locale: 'de',
|
|
78
|
+
value: 'slug',
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
externalId: 'xxx',
|
|
82
|
+
},
|
|
83
|
+
[
|
|
84
|
+
{
|
|
85
|
+
from: 'nameAllLocales',
|
|
86
|
+
to: 'name',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
from: 'slugAllLocales',
|
|
90
|
+
to: 'slug',
|
|
91
|
+
},
|
|
92
|
+
]
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
it('map correctly to category representation', () => {
|
|
96
|
+
expect(mapped).toEqual(expected);
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
describe('with parent', () => {
|
|
100
|
+
const expected = {
|
|
101
|
+
id: '1',
|
|
102
|
+
name: { en: 'name' },
|
|
103
|
+
parent: { id: '2', name: { en: 'name' } },
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const mapped = transformLocalizedFieldsForCategory({
|
|
107
|
+
id: '1',
|
|
108
|
+
nameAllLocales: [{ locale: 'en', value: 'name' }],
|
|
109
|
+
parent: { id: '2', nameAllLocales: [{ locale: 'en', value: 'name' }] },
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('map correctly to category representation', () => {
|
|
113
|
+
expect(mapped).toEqual(expected);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
describe('with ancestors', () => {
|
|
117
|
+
const expected = {
|
|
118
|
+
id: '1',
|
|
119
|
+
name: { en: 'name' },
|
|
120
|
+
ancestors: [
|
|
121
|
+
{ id: '2', name: { en: 'name' } },
|
|
122
|
+
{ id: '3', name: { en: 'name' } },
|
|
123
|
+
],
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
const mapped = transformLocalizedFieldsForCategory({
|
|
127
|
+
id: '1',
|
|
128
|
+
nameAllLocales: [{ locale: 'en', value: 'name' }],
|
|
129
|
+
ancestors: [
|
|
130
|
+
{ id: '2', nameAllLocales: [{ locale: 'en', value: 'name' }] },
|
|
131
|
+
{ id: '3', nameAllLocales: [{ locale: 'en', value: 'name' }] },
|
|
132
|
+
],
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it('map correctly to category representation', () => {
|
|
136
|
+
expect(mapped).toEqual(expected);
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
describe('mapShippingRateTierToGraphQL', () => {
|
|
142
|
+
const expected = [
|
|
143
|
+
{
|
|
144
|
+
CartValue: {
|
|
145
|
+
score: 10,
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
];
|
|
149
|
+
|
|
150
|
+
const mapped = mapShippingRateTierToGraphQL([
|
|
151
|
+
{
|
|
152
|
+
type: 'CartValue',
|
|
153
|
+
price: undefined,
|
|
154
|
+
minimumCentAmount: undefined,
|
|
155
|
+
value: undefined,
|
|
156
|
+
priceFunction: null,
|
|
157
|
+
score: 10,
|
|
158
|
+
},
|
|
159
|
+
]);
|
|
160
|
+
|
|
161
|
+
it('correctly transform and omit shipping rate tier fields', () => {
|
|
162
|
+
expect(mapped).toEqual(expected);
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
describe('createGraphQlUpdateActions', () => {
|
|
167
|
+
let syncActions;
|
|
168
|
+
describe('with actions', () => {
|
|
169
|
+
beforeEach(() => {
|
|
170
|
+
syncActions = [{ action: 'fooAction', payload: { foo: 'bar' } }];
|
|
171
|
+
});
|
|
172
|
+
it('should map `action` names to the object key', () => {
|
|
173
|
+
expect(createGraphQlUpdateActions(syncActions)).toEqual([
|
|
174
|
+
{ [syncActions[0].action]: expect.any(Object) },
|
|
175
|
+
]);
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
it('should map `action` payload to the object value', () => {
|
|
179
|
+
expect(createGraphQlUpdateActions(syncActions)[0].fooAction).toEqual({
|
|
180
|
+
payload: { foo: 'bar' },
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
describe('with `setCustomField` action', () => {
|
|
185
|
+
const customFieldActions = [
|
|
186
|
+
{
|
|
187
|
+
action: 'setCustomField',
|
|
188
|
+
name: 'String-149-84-6976',
|
|
189
|
+
value: 'bhss',
|
|
190
|
+
},
|
|
191
|
+
];
|
|
192
|
+
|
|
193
|
+
it('should stringify the `action` payload as the object value', () => {
|
|
194
|
+
expect(
|
|
195
|
+
createGraphQlUpdateActions(customFieldActions)[0].setCustomField.value
|
|
196
|
+
).toEqual(JSON.stringify(customFieldActions[0].value));
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
describe('with `removeLocation` action', () => {
|
|
201
|
+
const zoneActions = [
|
|
202
|
+
{
|
|
203
|
+
action: 'removeLocation',
|
|
204
|
+
location: { country: 'ES' },
|
|
205
|
+
},
|
|
206
|
+
];
|
|
207
|
+
|
|
208
|
+
it('should build the graphql action with only the country', () => {
|
|
209
|
+
expect(createGraphQlUpdateActions(zoneActions)[0]).toEqual({
|
|
210
|
+
removeLocation: { location: { country: 'ES' } },
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
describe('with `addLocation` action', () => {
|
|
216
|
+
const zoneActions = [
|
|
217
|
+
{
|
|
218
|
+
action: 'addLocation',
|
|
219
|
+
location: { country: 'ES' },
|
|
220
|
+
},
|
|
221
|
+
];
|
|
222
|
+
|
|
223
|
+
it('should build the graphql action with only the country', () => {
|
|
224
|
+
expect(createGraphQlUpdateActions(zoneActions)[0]).toEqual({
|
|
225
|
+
addLocation: { location: { country: 'ES' } },
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
describe('with `replaceTaxRate` action', () => {
|
|
231
|
+
const taxCategoryWithNoSubRatesActions = [
|
|
232
|
+
{
|
|
233
|
+
action: 'replaceTaxRate',
|
|
234
|
+
taxRate: {
|
|
235
|
+
id: 'some-id',
|
|
236
|
+
name: 'Test',
|
|
237
|
+
country: 'ES',
|
|
238
|
+
amount: 1,
|
|
239
|
+
subRates: [],
|
|
240
|
+
},
|
|
241
|
+
taxRateId: 'some-id',
|
|
242
|
+
},
|
|
243
|
+
];
|
|
244
|
+
|
|
245
|
+
const taxCategoryWithSubRatesActions = [
|
|
246
|
+
{
|
|
247
|
+
action: 'replaceTaxRate',
|
|
248
|
+
taxRate: {
|
|
249
|
+
id: 'some-id',
|
|
250
|
+
name: 'Test',
|
|
251
|
+
country: 'ES',
|
|
252
|
+
amount: 1,
|
|
253
|
+
subRates: [{ name: 'sub-rate', amount: 1 }],
|
|
254
|
+
},
|
|
255
|
+
taxRateId: 'some-id',
|
|
256
|
+
},
|
|
257
|
+
];
|
|
258
|
+
|
|
259
|
+
it('should build the graphql action taxRate including empty subRates but without the id', () => {
|
|
260
|
+
expect(
|
|
261
|
+
createGraphQlUpdateActions(taxCategoryWithNoSubRatesActions)[0]
|
|
262
|
+
).toEqual({
|
|
263
|
+
replaceTaxRate: {
|
|
264
|
+
taxRateId: 'some-id',
|
|
265
|
+
taxRate: { name: 'Test', country: 'ES', amount: 1, subRates: [] },
|
|
266
|
+
},
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
it('should build the graphql action taxRate including subRates but without the id', () => {
|
|
271
|
+
expect(
|
|
272
|
+
createGraphQlUpdateActions(taxCategoryWithSubRatesActions)[0]
|
|
273
|
+
).toEqual({
|
|
274
|
+
replaceTaxRate: {
|
|
275
|
+
taxRateId: 'some-id',
|
|
276
|
+
taxRate: {
|
|
277
|
+
name: 'Test',
|
|
278
|
+
country: 'ES',
|
|
279
|
+
amount: 1,
|
|
280
|
+
subRates: [{ name: 'sub-rate', amount: 1 }],
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
describe('with `addZone` action', () => {
|
|
288
|
+
const shippingMethodActions = [
|
|
289
|
+
{
|
|
290
|
+
action: 'addZone',
|
|
291
|
+
zone: {
|
|
292
|
+
id: 'z1',
|
|
293
|
+
typeId: 'zone',
|
|
294
|
+
},
|
|
295
|
+
typename: 'shippingMethod',
|
|
296
|
+
},
|
|
297
|
+
];
|
|
298
|
+
|
|
299
|
+
it('should build the graphql action shippingMethod without the other props', () => {
|
|
300
|
+
expect(createGraphQlUpdateActions(shippingMethodActions)[0]).toEqual({
|
|
301
|
+
addZone: {
|
|
302
|
+
zone: {
|
|
303
|
+
id: 'z1',
|
|
304
|
+
typeId: 'zone',
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
});
|
|
308
|
+
});
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
describe('with `removeZone` action', () => {
|
|
312
|
+
const shippingMethodActions = [
|
|
313
|
+
{
|
|
314
|
+
action: 'removeZone',
|
|
315
|
+
zone: {
|
|
316
|
+
id: 'z1',
|
|
317
|
+
name: 'Zone 1',
|
|
318
|
+
typeId: 'zone',
|
|
319
|
+
},
|
|
320
|
+
typename: 'shippingMethod',
|
|
321
|
+
},
|
|
322
|
+
];
|
|
323
|
+
|
|
324
|
+
it('should build the graphql action shippingMethod without the other props', () => {
|
|
325
|
+
expect(createGraphQlUpdateActions(shippingMethodActions)[0]).toEqual({
|
|
326
|
+
removeZone: {
|
|
327
|
+
zone: {
|
|
328
|
+
id: 'z1',
|
|
329
|
+
typeId: 'zone',
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
});
|
|
333
|
+
});
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
describe('with `changeTaxCategory` action', () => {
|
|
337
|
+
const shippingMethodActions = [
|
|
338
|
+
{
|
|
339
|
+
action: 'changeTaxCategory',
|
|
340
|
+
taxCategory: {
|
|
341
|
+
id: 'tc1',
|
|
342
|
+
name: 'Tax 1',
|
|
343
|
+
typeId: 'tax-category',
|
|
344
|
+
},
|
|
345
|
+
typename: 'shippingMethod',
|
|
346
|
+
},
|
|
347
|
+
];
|
|
348
|
+
|
|
349
|
+
it('should build the graphql action shippingMethod without the other props', () => {
|
|
350
|
+
expect(createGraphQlUpdateActions(shippingMethodActions)[0]).toEqual({
|
|
351
|
+
changeTaxCategory: {
|
|
352
|
+
taxCategory: {
|
|
353
|
+
id: 'tc1',
|
|
354
|
+
typeId: 'tax-category',
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
});
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
describe('with `addShippingRate` action', () => {
|
|
362
|
+
const shippingMethodActions = [
|
|
363
|
+
{
|
|
364
|
+
action: 'addShippingRate',
|
|
365
|
+
zone: {
|
|
366
|
+
id: 'z1',
|
|
367
|
+
typeId: 'zone',
|
|
368
|
+
},
|
|
369
|
+
typename: 'shippingMethod',
|
|
370
|
+
shippingRate: {
|
|
371
|
+
price: {
|
|
372
|
+
centAmount: 10,
|
|
373
|
+
currencyCode: 'EUR',
|
|
374
|
+
},
|
|
375
|
+
freeAbove: null,
|
|
376
|
+
tiers: null,
|
|
377
|
+
},
|
|
378
|
+
},
|
|
379
|
+
];
|
|
380
|
+
|
|
381
|
+
it('should build the graphql action shippingMethod without the other props', () => {
|
|
382
|
+
expect(createGraphQlUpdateActions(shippingMethodActions)[0]).toEqual({
|
|
383
|
+
addShippingRate: {
|
|
384
|
+
zone: {
|
|
385
|
+
id: 'z1',
|
|
386
|
+
typeId: 'zone',
|
|
387
|
+
},
|
|
388
|
+
shippingRate: {
|
|
389
|
+
price: {
|
|
390
|
+
centAmount: 10,
|
|
391
|
+
currencyCode: 'EUR',
|
|
392
|
+
},
|
|
393
|
+
},
|
|
394
|
+
},
|
|
395
|
+
});
|
|
396
|
+
});
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
describe('with `removeShippingRate` action', () => {
|
|
400
|
+
const shippingMethodActions = [
|
|
401
|
+
{
|
|
402
|
+
action: 'removeShippingRate',
|
|
403
|
+
zone: {
|
|
404
|
+
id: 'z1',
|
|
405
|
+
typeId: 'zone',
|
|
406
|
+
},
|
|
407
|
+
typename: 'shippingMethod',
|
|
408
|
+
shippingRate: {
|
|
409
|
+
price: {
|
|
410
|
+
centAmount: 10,
|
|
411
|
+
currencyCode: 'EUR',
|
|
412
|
+
},
|
|
413
|
+
freeAbove: null,
|
|
414
|
+
tiers: null,
|
|
415
|
+
},
|
|
416
|
+
},
|
|
417
|
+
];
|
|
418
|
+
|
|
419
|
+
it('should build the graphql action shippingMethod without the other props', () => {
|
|
420
|
+
expect(createGraphQlUpdateActions(shippingMethodActions)[0]).toEqual({
|
|
421
|
+
removeShippingRate: {
|
|
422
|
+
zone: {
|
|
423
|
+
id: 'z1',
|
|
424
|
+
typeId: 'zone',
|
|
425
|
+
},
|
|
426
|
+
shippingRate: {
|
|
427
|
+
price: {
|
|
428
|
+
centAmount: 10,
|
|
429
|
+
currencyCode: 'EUR',
|
|
430
|
+
},
|
|
431
|
+
},
|
|
432
|
+
},
|
|
433
|
+
});
|
|
434
|
+
});
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
describe('with `changeValue` action', () => {
|
|
438
|
+
const changeValueActions = [
|
|
439
|
+
{
|
|
440
|
+
action: 'changeValue',
|
|
441
|
+
value: {
|
|
442
|
+
type: 'relative',
|
|
443
|
+
permyriad: '1200',
|
|
444
|
+
},
|
|
445
|
+
},
|
|
446
|
+
];
|
|
447
|
+
|
|
448
|
+
it('should build the graphql action changeValue', () => {
|
|
449
|
+
expect(createGraphQlUpdateActions(changeValueActions)).toEqual([
|
|
450
|
+
{
|
|
451
|
+
changeValue: {
|
|
452
|
+
value: {
|
|
453
|
+
relative: {
|
|
454
|
+
permyriad: '1200',
|
|
455
|
+
},
|
|
456
|
+
},
|
|
457
|
+
},
|
|
458
|
+
},
|
|
459
|
+
]);
|
|
460
|
+
});
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
describe('with `changeLabel`', () => {
|
|
464
|
+
beforeEach(() => {
|
|
465
|
+
syncActions = [
|
|
466
|
+
{
|
|
467
|
+
action: 'changeLabel',
|
|
468
|
+
attributeName: 'foo',
|
|
469
|
+
label: { en: 'bar', de: 'baz' },
|
|
470
|
+
},
|
|
471
|
+
];
|
|
472
|
+
});
|
|
473
|
+
it('should return attribute-type name as action and transform label', () => {
|
|
474
|
+
expect(createGraphQlUpdateActions(syncActions)).toEqual([
|
|
475
|
+
{
|
|
476
|
+
changeLabel: {
|
|
477
|
+
attributeName: 'foo',
|
|
478
|
+
label: [
|
|
479
|
+
{ locale: 'de', value: 'baz' },
|
|
480
|
+
{ locale: 'en', value: 'bar' },
|
|
481
|
+
],
|
|
482
|
+
},
|
|
483
|
+
},
|
|
484
|
+
]);
|
|
485
|
+
});
|
|
486
|
+
});
|
|
487
|
+
describe('with `changeLocalizedEnumValueLabel`', () => {
|
|
488
|
+
beforeEach(() => {
|
|
489
|
+
syncActions = [
|
|
490
|
+
{
|
|
491
|
+
action: 'changeLocalizedEnumValueLabel',
|
|
492
|
+
attributeName: 'foo',
|
|
493
|
+
newValue: {
|
|
494
|
+
key: 'bar',
|
|
495
|
+
label: { en: 'bar', de: 'baz' },
|
|
496
|
+
},
|
|
497
|
+
},
|
|
498
|
+
];
|
|
499
|
+
});
|
|
500
|
+
it('should return attribute-type name as action and transform label', () => {
|
|
501
|
+
expect(createGraphQlUpdateActions(syncActions)).toEqual([
|
|
502
|
+
{
|
|
503
|
+
changeLocalizedEnumValueLabel: {
|
|
504
|
+
attributeName: 'foo',
|
|
505
|
+
newValue: {
|
|
506
|
+
key: 'bar',
|
|
507
|
+
label: [
|
|
508
|
+
{ locale: 'de', value: 'baz' },
|
|
509
|
+
{ locale: 'en', value: 'bar' },
|
|
510
|
+
],
|
|
511
|
+
},
|
|
512
|
+
},
|
|
513
|
+
},
|
|
514
|
+
]);
|
|
515
|
+
});
|
|
516
|
+
});
|
|
517
|
+
describe('with `addLocalizedEnumValue`', () => {
|
|
518
|
+
beforeEach(() => {
|
|
519
|
+
syncActions = [
|
|
520
|
+
{
|
|
521
|
+
action: 'addLocalizedEnumValue',
|
|
522
|
+
attributeName: 'foo',
|
|
523
|
+
value: {
|
|
524
|
+
key: 'bar',
|
|
525
|
+
label: { de: 'baz', en: 'bar' },
|
|
526
|
+
},
|
|
527
|
+
},
|
|
528
|
+
];
|
|
529
|
+
});
|
|
530
|
+
it('should return attribute-type name as action and transform label', () => {
|
|
531
|
+
expect(createGraphQlUpdateActions(syncActions)).toEqual([
|
|
532
|
+
{
|
|
533
|
+
addLocalizedEnumValue: {
|
|
534
|
+
attributeName: 'foo',
|
|
535
|
+
value: {
|
|
536
|
+
key: 'bar',
|
|
537
|
+
label: [
|
|
538
|
+
{ locale: 'de', value: 'baz' },
|
|
539
|
+
{ locale: 'en', value: 'bar' },
|
|
540
|
+
],
|
|
541
|
+
},
|
|
542
|
+
},
|
|
543
|
+
},
|
|
544
|
+
]);
|
|
545
|
+
});
|
|
546
|
+
});
|
|
547
|
+
|
|
548
|
+
describe('with `setInputTip`', () => {
|
|
549
|
+
beforeEach(() => {
|
|
550
|
+
syncActions = [
|
|
551
|
+
{
|
|
552
|
+
action: 'setInputTip',
|
|
553
|
+
attributeName: 'foo',
|
|
554
|
+
inputTip: { en: 'bar', de: 'baz' },
|
|
555
|
+
},
|
|
556
|
+
];
|
|
557
|
+
});
|
|
558
|
+
it('should return attribute-type name as action and transform inputTip', () => {
|
|
559
|
+
expect(createGraphQlUpdateActions(syncActions)).toEqual([
|
|
560
|
+
{
|
|
561
|
+
setInputTip: {
|
|
562
|
+
attributeName: 'foo',
|
|
563
|
+
inputTip: [
|
|
564
|
+
{ locale: 'de', value: 'baz' },
|
|
565
|
+
{ locale: 'en', value: 'bar' },
|
|
566
|
+
],
|
|
567
|
+
},
|
|
568
|
+
},
|
|
569
|
+
]);
|
|
570
|
+
});
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
describe('with `addAttributeDefinition`', () => {
|
|
574
|
+
const createAddAttributeAction = (custom) => ({
|
|
575
|
+
action: 'addAttributeDefinition',
|
|
576
|
+
attribute: {
|
|
577
|
+
label: { en: 'foo' },
|
|
578
|
+
inputTip: { en: 'foo' },
|
|
579
|
+
type: { name: 'text' },
|
|
580
|
+
},
|
|
581
|
+
...custom,
|
|
582
|
+
});
|
|
583
|
+
describe('with text', () => {
|
|
584
|
+
beforeEach(() => {
|
|
585
|
+
syncActions = [createAddAttributeAction()];
|
|
586
|
+
});
|
|
587
|
+
it('should match snapshot', () => {
|
|
588
|
+
expect(createGraphQlUpdateActions(syncActions)).toMatchSnapshot();
|
|
589
|
+
});
|
|
590
|
+
it('should return attribute-type name as action', () => {
|
|
591
|
+
expect(createGraphQlUpdateActions(syncActions)).toEqual([
|
|
592
|
+
{
|
|
593
|
+
addAttributeDefinition: {
|
|
594
|
+
attributeDefinition: expect.objectContaining({
|
|
595
|
+
type: {
|
|
596
|
+
text: {},
|
|
597
|
+
},
|
|
598
|
+
}),
|
|
599
|
+
},
|
|
600
|
+
},
|
|
601
|
+
]);
|
|
602
|
+
});
|
|
603
|
+
it('should convert localized fields', () => {
|
|
604
|
+
expect(createGraphQlUpdateActions(syncActions)).toEqual([
|
|
605
|
+
{
|
|
606
|
+
addAttributeDefinition: {
|
|
607
|
+
attributeDefinition: expect.objectContaining({
|
|
608
|
+
label: [{ locale: 'en', value: 'foo' }],
|
|
609
|
+
inputTip: [{ locale: 'en', value: 'foo' }],
|
|
610
|
+
}),
|
|
611
|
+
},
|
|
612
|
+
},
|
|
613
|
+
]);
|
|
614
|
+
});
|
|
615
|
+
});
|
|
616
|
+
describe('with reference', () => {
|
|
617
|
+
beforeEach(() => {
|
|
618
|
+
syncActions = [
|
|
619
|
+
createAddAttributeAction({
|
|
620
|
+
attribute: {
|
|
621
|
+
type: {
|
|
622
|
+
name: 'reference',
|
|
623
|
+
referenceTypeId: 'product',
|
|
624
|
+
},
|
|
625
|
+
},
|
|
626
|
+
}),
|
|
627
|
+
];
|
|
628
|
+
});
|
|
629
|
+
it('should match snapshot', () => {
|
|
630
|
+
expect(createGraphQlUpdateActions(syncActions)).toMatchSnapshot();
|
|
631
|
+
});
|
|
632
|
+
it('should return attribute-type name as action', () => {
|
|
633
|
+
expect(createGraphQlUpdateActions(syncActions)).toEqual([
|
|
634
|
+
{
|
|
635
|
+
addAttributeDefinition: {
|
|
636
|
+
attributeDefinition: expect.objectContaining({
|
|
637
|
+
type: {
|
|
638
|
+
reference: {
|
|
639
|
+
referenceTypeId: 'product',
|
|
640
|
+
},
|
|
641
|
+
},
|
|
642
|
+
}),
|
|
643
|
+
},
|
|
644
|
+
},
|
|
645
|
+
]);
|
|
646
|
+
});
|
|
647
|
+
});
|
|
648
|
+
});
|
|
649
|
+
|
|
650
|
+
describe('with `setShippingRateInputType`', () => {
|
|
651
|
+
describe('when `type` is `CartClassification`', () => {
|
|
652
|
+
beforeEach(() => {
|
|
653
|
+
syncActions = [
|
|
654
|
+
{
|
|
655
|
+
action: 'setShippingRateInputType',
|
|
656
|
+
shippingRateInputType: {
|
|
657
|
+
type: 'CartClassification',
|
|
658
|
+
values: [
|
|
659
|
+
{
|
|
660
|
+
key: 'foo',
|
|
661
|
+
allLocaleLabels: [{ locale: 'en', value: 'Foo' }],
|
|
662
|
+
},
|
|
663
|
+
],
|
|
664
|
+
},
|
|
665
|
+
},
|
|
666
|
+
];
|
|
667
|
+
});
|
|
668
|
+
it('should return `type` and `values` on `setShippingRateInputType`', () => {
|
|
669
|
+
expect(createGraphQlUpdateActions(syncActions)).toEqual([
|
|
670
|
+
{
|
|
671
|
+
setShippingRateInputType: {
|
|
672
|
+
shippingRateInputType: {
|
|
673
|
+
[syncActions[0].shippingRateInputType.type]: {
|
|
674
|
+
values: [
|
|
675
|
+
{
|
|
676
|
+
key: 'foo',
|
|
677
|
+
label: [{ locale: 'en', value: 'Foo' }],
|
|
678
|
+
},
|
|
679
|
+
],
|
|
680
|
+
},
|
|
681
|
+
},
|
|
682
|
+
},
|
|
683
|
+
},
|
|
684
|
+
]);
|
|
685
|
+
});
|
|
686
|
+
});
|
|
687
|
+
describe('when `type` is `CartScore`', () => {
|
|
688
|
+
beforeEach(() => {
|
|
689
|
+
syncActions = [
|
|
690
|
+
{
|
|
691
|
+
action: 'setShippingRateInputType',
|
|
692
|
+
shippingRateInputType: {
|
|
693
|
+
type: 'CartScore',
|
|
694
|
+
values: null,
|
|
695
|
+
},
|
|
696
|
+
},
|
|
697
|
+
];
|
|
698
|
+
});
|
|
699
|
+
it('should return `type` and unset `values` on `setShippingRateInputType`', () => {
|
|
700
|
+
expect(createGraphQlUpdateActions(syncActions)).toEqual([
|
|
701
|
+
{
|
|
702
|
+
setShippingRateInputType: {
|
|
703
|
+
shippingRateInputType: {
|
|
704
|
+
[syncActions[0].shippingRateInputType.type]: {},
|
|
705
|
+
},
|
|
706
|
+
},
|
|
707
|
+
},
|
|
708
|
+
]);
|
|
709
|
+
});
|
|
710
|
+
});
|
|
711
|
+
describe('when `type` is `CartValue`', () => {
|
|
712
|
+
beforeEach(() => {
|
|
713
|
+
syncActions = [
|
|
714
|
+
{
|
|
715
|
+
action: 'setShippingRateInputType',
|
|
716
|
+
shippingRateInputType: {
|
|
717
|
+
type: 'CartValue',
|
|
718
|
+
values: null,
|
|
719
|
+
},
|
|
720
|
+
},
|
|
721
|
+
];
|
|
722
|
+
});
|
|
723
|
+
it('should return `type` and unset `values` on `setShippingRateInputType`', () => {
|
|
724
|
+
expect(createGraphQlUpdateActions(syncActions)).toEqual([
|
|
725
|
+
{
|
|
726
|
+
setShippingRateInputType: {
|
|
727
|
+
shippingRateInputType: {
|
|
728
|
+
[syncActions[0].shippingRateInputType.type]: {},
|
|
729
|
+
},
|
|
730
|
+
},
|
|
731
|
+
},
|
|
732
|
+
]);
|
|
733
|
+
});
|
|
734
|
+
});
|
|
735
|
+
});
|
|
736
|
+
|
|
737
|
+
describe('with `addCustomLineItem` action', () => {
|
|
738
|
+
describe('with high-precision money type', () => {
|
|
739
|
+
const cartUpdateActions = [
|
|
740
|
+
{
|
|
741
|
+
action: 'addCustomLineItem',
|
|
742
|
+
slug: 'slug',
|
|
743
|
+
quantity: 2,
|
|
744
|
+
name: { en: 'foo' },
|
|
745
|
+
taxCategory: 'tax-1',
|
|
746
|
+
money: {
|
|
747
|
+
type: PRECISION_TYPES.highPrecision,
|
|
748
|
+
fractionDigits: 2,
|
|
749
|
+
centAmount: 100,
|
|
750
|
+
currencyCode: 'EUR',
|
|
751
|
+
},
|
|
752
|
+
},
|
|
753
|
+
];
|
|
754
|
+
it('should build the graphql action `addCustomLineItem`', () => {
|
|
755
|
+
expect(createGraphQlUpdateActions(cartUpdateActions)[0]).toEqual({
|
|
756
|
+
addCustomLineItem: {
|
|
757
|
+
name: [{ locale: 'en', value: 'foo' }],
|
|
758
|
+
slug: 'slug',
|
|
759
|
+
quantity: 2,
|
|
760
|
+
taxCategory: 'tax-1',
|
|
761
|
+
money: {
|
|
762
|
+
[PRECISION_TYPES.highPrecision]: {
|
|
763
|
+
centAmount: 100,
|
|
764
|
+
currencyCode: 'EUR',
|
|
765
|
+
fractionDigits: 2,
|
|
766
|
+
},
|
|
767
|
+
},
|
|
768
|
+
},
|
|
769
|
+
});
|
|
770
|
+
});
|
|
771
|
+
});
|
|
772
|
+
describe('with cent-precision money type', () => {
|
|
773
|
+
const cartUpdateActions = [
|
|
774
|
+
{
|
|
775
|
+
action: 'addCustomLineItem',
|
|
776
|
+
slug: 'slug',
|
|
777
|
+
quantity: 2,
|
|
778
|
+
name: { en: 'foo' },
|
|
779
|
+
taxCategory: 'tax-1',
|
|
780
|
+
money: {
|
|
781
|
+
type: PRECISION_TYPES.centPrecision,
|
|
782
|
+
fractionDigits: 2,
|
|
783
|
+
centAmount: 100,
|
|
784
|
+
currencyCode: 'EUR',
|
|
785
|
+
},
|
|
786
|
+
},
|
|
787
|
+
];
|
|
788
|
+
|
|
789
|
+
it('should build the graphql action `addCustomLineItem`', () => {
|
|
790
|
+
expect(createGraphQlUpdateActions(cartUpdateActions)[0]).toEqual({
|
|
791
|
+
addCustomLineItem: {
|
|
792
|
+
name: [{ locale: 'en', value: 'foo' }],
|
|
793
|
+
slug: 'slug',
|
|
794
|
+
quantity: 2,
|
|
795
|
+
taxCategory: 'tax-1',
|
|
796
|
+
money: {
|
|
797
|
+
[PRECISION_TYPES.centPrecision]: {
|
|
798
|
+
centAmount: 100,
|
|
799
|
+
currencyCode: 'EUR',
|
|
800
|
+
},
|
|
801
|
+
},
|
|
802
|
+
},
|
|
803
|
+
});
|
|
804
|
+
});
|
|
805
|
+
});
|
|
806
|
+
});
|
|
807
|
+
|
|
808
|
+
describe('with `setCustomType` action', () => {
|
|
809
|
+
const cartUpdateActions = [
|
|
810
|
+
{
|
|
811
|
+
action: 'setCustomType',
|
|
812
|
+
type: {
|
|
813
|
+
id: 'type-id',
|
|
814
|
+
},
|
|
815
|
+
fields: {
|
|
816
|
+
field1: 'foo',
|
|
817
|
+
field2: 'bar',
|
|
818
|
+
},
|
|
819
|
+
},
|
|
820
|
+
];
|
|
821
|
+
|
|
822
|
+
it('should build the graphql action `addCustomLineItem`', () => {
|
|
823
|
+
expect(createGraphQlUpdateActions(cartUpdateActions)[0]).toEqual({
|
|
824
|
+
setCustomType: {
|
|
825
|
+
typeId: 'type-id',
|
|
826
|
+
fields: [
|
|
827
|
+
{
|
|
828
|
+
name: 'field1',
|
|
829
|
+
value: '"foo"',
|
|
830
|
+
},
|
|
831
|
+
{
|
|
832
|
+
name: 'field2',
|
|
833
|
+
value: '"bar"',
|
|
834
|
+
},
|
|
835
|
+
],
|
|
836
|
+
},
|
|
837
|
+
});
|
|
838
|
+
});
|
|
839
|
+
});
|
|
840
|
+
describe('with `changeName`', () => {
|
|
841
|
+
const productDiscountActions = [
|
|
842
|
+
{
|
|
843
|
+
action: 'changeName',
|
|
844
|
+
name: {
|
|
845
|
+
en: 'change name',
|
|
846
|
+
},
|
|
847
|
+
},
|
|
848
|
+
];
|
|
849
|
+
it('should build graphql action `changeName`', () => {
|
|
850
|
+
expect(createGraphQlUpdateActions(productDiscountActions)[0]).toEqual({
|
|
851
|
+
changeName: {
|
|
852
|
+
name: [
|
|
853
|
+
{
|
|
854
|
+
locale: 'en',
|
|
855
|
+
value: 'change name',
|
|
856
|
+
},
|
|
857
|
+
],
|
|
858
|
+
},
|
|
859
|
+
});
|
|
860
|
+
});
|
|
861
|
+
});
|
|
862
|
+
describe('with `setDescription`', () => {
|
|
863
|
+
describe('when description is a localized string', () => {
|
|
864
|
+
const productDiscountActions = [
|
|
865
|
+
{
|
|
866
|
+
action: 'setDescription',
|
|
867
|
+
description: {
|
|
868
|
+
en: 'change description',
|
|
869
|
+
},
|
|
870
|
+
},
|
|
871
|
+
];
|
|
872
|
+
it('should build graphql action `setDescription` with localized string', () => {
|
|
873
|
+
expect(createGraphQlUpdateActions(productDiscountActions)[0]).toEqual(
|
|
874
|
+
{
|
|
875
|
+
setDescription: {
|
|
876
|
+
description: [
|
|
877
|
+
{
|
|
878
|
+
locale: 'en',
|
|
879
|
+
value: 'change description',
|
|
880
|
+
},
|
|
881
|
+
],
|
|
882
|
+
},
|
|
883
|
+
}
|
|
884
|
+
);
|
|
885
|
+
});
|
|
886
|
+
});
|
|
887
|
+
describe('when description is a string', () => {
|
|
888
|
+
const productDiscountActions = [
|
|
889
|
+
{
|
|
890
|
+
action: 'setDescription',
|
|
891
|
+
description: 'change description',
|
|
892
|
+
},
|
|
893
|
+
];
|
|
894
|
+
it('should build graphql action `setDescription` with string', () => {
|
|
895
|
+
expect(createGraphQlUpdateActions(productDiscountActions)[0]).toEqual(
|
|
896
|
+
{
|
|
897
|
+
setDescription: {
|
|
898
|
+
description: 'change description',
|
|
899
|
+
},
|
|
900
|
+
}
|
|
901
|
+
);
|
|
902
|
+
});
|
|
903
|
+
});
|
|
904
|
+
describe('with `setLocalizedDescription`', () => {
|
|
905
|
+
const shippingMethodActions = [
|
|
906
|
+
{
|
|
907
|
+
action: 'setLocalizedDescription',
|
|
908
|
+
localizedDescription: {
|
|
909
|
+
en: 'change description',
|
|
910
|
+
},
|
|
911
|
+
},
|
|
912
|
+
];
|
|
913
|
+
it('should build graphql action `setLocalizedDescription` with localized string', () => {
|
|
914
|
+
expect(createGraphQlUpdateActions(shippingMethodActions)[0]).toEqual({
|
|
915
|
+
setLocalizedDescription: {
|
|
916
|
+
localizedDescription: [
|
|
917
|
+
{
|
|
918
|
+
locale: 'en',
|
|
919
|
+
value: 'change description',
|
|
920
|
+
},
|
|
921
|
+
],
|
|
922
|
+
},
|
|
923
|
+
});
|
|
924
|
+
});
|
|
925
|
+
});
|
|
926
|
+
});
|
|
927
|
+
});
|
|
928
|
+
|
|
929
|
+
describe('without actions', () => {
|
|
930
|
+
it('should return an empty `Array`', () => {
|
|
931
|
+
expect(createGraphQlUpdateActions([])).toEqual([]);
|
|
932
|
+
});
|
|
933
|
+
});
|
|
934
|
+
|
|
935
|
+
describe('utils', () => {
|
|
936
|
+
describe('createAttributeTypeValue', () => {
|
|
937
|
+
let attribute;
|
|
938
|
+
describe('with text', () => {
|
|
939
|
+
beforeEach(() => {
|
|
940
|
+
attribute = {
|
|
941
|
+
type: { name: 'text' },
|
|
942
|
+
};
|
|
943
|
+
});
|
|
944
|
+
it('should return attribute type with name', () => {
|
|
945
|
+
expect(createAttributeTypeValue(attribute)).toEqual({
|
|
946
|
+
text: {},
|
|
947
|
+
});
|
|
948
|
+
});
|
|
949
|
+
});
|
|
950
|
+
describe('with ltext', () => {
|
|
951
|
+
beforeEach(() => {
|
|
952
|
+
attribute = {
|
|
953
|
+
type: { name: 'ltext' },
|
|
954
|
+
};
|
|
955
|
+
});
|
|
956
|
+
it('should return attribute type with name', () => {
|
|
957
|
+
expect(createAttributeTypeValue(attribute)).toEqual({
|
|
958
|
+
ltext: {},
|
|
959
|
+
});
|
|
960
|
+
});
|
|
961
|
+
});
|
|
962
|
+
describe('with boolean', () => {
|
|
963
|
+
beforeEach(() => {
|
|
964
|
+
attribute = {
|
|
965
|
+
type: { name: 'boolean' },
|
|
966
|
+
};
|
|
967
|
+
});
|
|
968
|
+
it('should return attribute type with name', () => {
|
|
969
|
+
expect(createAttributeTypeValue(attribute)).toEqual({
|
|
970
|
+
boolean: {},
|
|
971
|
+
});
|
|
972
|
+
});
|
|
973
|
+
});
|
|
974
|
+
describe('with date', () => {
|
|
975
|
+
beforeEach(() => {
|
|
976
|
+
attribute = {
|
|
977
|
+
type: { name: 'date' },
|
|
978
|
+
};
|
|
979
|
+
});
|
|
980
|
+
it('should return attribute type with name', () => {
|
|
981
|
+
expect(createAttributeTypeValue(attribute)).toEqual({
|
|
982
|
+
date: {},
|
|
983
|
+
});
|
|
984
|
+
});
|
|
985
|
+
});
|
|
986
|
+
describe('with time', () => {
|
|
987
|
+
beforeEach(() => {
|
|
988
|
+
attribute = {
|
|
989
|
+
type: { name: 'time' },
|
|
990
|
+
};
|
|
991
|
+
});
|
|
992
|
+
it('should return attribute type with name', () => {
|
|
993
|
+
expect(createAttributeTypeValue(attribute)).toEqual({
|
|
994
|
+
time: {},
|
|
995
|
+
});
|
|
996
|
+
});
|
|
997
|
+
});
|
|
998
|
+
describe('with datetime', () => {
|
|
999
|
+
beforeEach(() => {
|
|
1000
|
+
attribute = {
|
|
1001
|
+
type: { name: 'datetime' },
|
|
1002
|
+
};
|
|
1003
|
+
});
|
|
1004
|
+
it('should return attribute type with name', () => {
|
|
1005
|
+
expect(createAttributeTypeValue(attribute)).toEqual({
|
|
1006
|
+
datetime: {},
|
|
1007
|
+
});
|
|
1008
|
+
});
|
|
1009
|
+
});
|
|
1010
|
+
describe('with number', () => {
|
|
1011
|
+
beforeEach(() => {
|
|
1012
|
+
attribute = {
|
|
1013
|
+
type: { name: 'number' },
|
|
1014
|
+
};
|
|
1015
|
+
});
|
|
1016
|
+
it('should return attribute type with name', () => {
|
|
1017
|
+
expect(createAttributeTypeValue(attribute)).toEqual({
|
|
1018
|
+
number: {},
|
|
1019
|
+
});
|
|
1020
|
+
});
|
|
1021
|
+
});
|
|
1022
|
+
describe('with money', () => {
|
|
1023
|
+
beforeEach(() => {
|
|
1024
|
+
attribute = {
|
|
1025
|
+
type: { name: 'money' },
|
|
1026
|
+
};
|
|
1027
|
+
});
|
|
1028
|
+
it('should return attribute type with name', () => {
|
|
1029
|
+
expect(createAttributeTypeValue(attribute)).toEqual({
|
|
1030
|
+
money: {},
|
|
1031
|
+
});
|
|
1032
|
+
});
|
|
1033
|
+
});
|
|
1034
|
+
describe('with reference', () => {
|
|
1035
|
+
beforeEach(() => {
|
|
1036
|
+
attribute = {
|
|
1037
|
+
type: { name: 'reference', referenceTypeId: 'product' },
|
|
1038
|
+
};
|
|
1039
|
+
});
|
|
1040
|
+
it('should return attribute type with name and referenceTypeId', () => {
|
|
1041
|
+
expect(createAttributeTypeValue(attribute)).toEqual({
|
|
1042
|
+
reference: {
|
|
1043
|
+
referenceTypeId: 'product',
|
|
1044
|
+
},
|
|
1045
|
+
});
|
|
1046
|
+
});
|
|
1047
|
+
});
|
|
1048
|
+
});
|
|
1049
|
+
});
|
|
1050
|
+
});
|
|
1051
|
+
|
|
1052
|
+
describe('extractErrorFromGraphQlResponse', () => {
|
|
1053
|
+
describe('given a `networkError` with errors exists', () => {
|
|
1054
|
+
const graphQlResponseWithNetworkErrors = {
|
|
1055
|
+
networkError: {
|
|
1056
|
+
result: {
|
|
1057
|
+
errors: [
|
|
1058
|
+
{
|
|
1059
|
+
code: 'a network error',
|
|
1060
|
+
},
|
|
1061
|
+
],
|
|
1062
|
+
},
|
|
1063
|
+
},
|
|
1064
|
+
};
|
|
1065
|
+
|
|
1066
|
+
it('should rethrow the network errors', () => {
|
|
1067
|
+
expect(
|
|
1068
|
+
extractErrorFromGraphQlResponse(graphQlResponseWithNetworkErrors)
|
|
1069
|
+
).toEqual(graphQlResponseWithNetworkErrors.networkError.result.errors);
|
|
1070
|
+
});
|
|
1071
|
+
});
|
|
1072
|
+
|
|
1073
|
+
describe('given a `graphQLErrors` exists', () => {
|
|
1074
|
+
const graphQlResponseWithGraphQLErrors = {
|
|
1075
|
+
graphQLErrors: [
|
|
1076
|
+
{
|
|
1077
|
+
code: 'a graphql error',
|
|
1078
|
+
},
|
|
1079
|
+
],
|
|
1080
|
+
};
|
|
1081
|
+
|
|
1082
|
+
it('should rethrow the network errors', () => {
|
|
1083
|
+
expect(
|
|
1084
|
+
extractErrorFromGraphQlResponse(graphQlResponseWithGraphQLErrors)
|
|
1085
|
+
).toEqual(graphQlResponseWithGraphQLErrors.graphQLErrors);
|
|
1086
|
+
});
|
|
1087
|
+
});
|
|
1088
|
+
|
|
1089
|
+
describe('given no `graphqlErrors` and no `networkErrors` exist', () => {
|
|
1090
|
+
const graphQlResponseWithoutGraphQLErrorsAndNetworkErrors = {
|
|
1091
|
+
graphQLErrors: [],
|
|
1092
|
+
networkError: {},
|
|
1093
|
+
};
|
|
1094
|
+
|
|
1095
|
+
it('should rethrow the response', () => {
|
|
1096
|
+
expect(
|
|
1097
|
+
extractErrorFromGraphQlResponse(
|
|
1098
|
+
graphQlResponseWithoutGraphQLErrorsAndNetworkErrors
|
|
1099
|
+
)
|
|
1100
|
+
).toEqual(graphQlResponseWithoutGraphQLErrorsAndNetworkErrors);
|
|
1101
|
+
});
|
|
1102
|
+
});
|
|
1103
|
+
});
|
|
1104
|
+
|
|
1105
|
+
describe('getIsLocalizedString', () => {
|
|
1106
|
+
describe('when input is not defined', () => {
|
|
1107
|
+
it('should indicate that it is not a localied string', () => {
|
|
1108
|
+
expect(getIsLocalizedString(null)).toBe(false);
|
|
1109
|
+
expect(getIsLocalizedString(undefined)).toBe(false);
|
|
1110
|
+
});
|
|
1111
|
+
});
|
|
1112
|
+
describe('when input is a string', () => {
|
|
1113
|
+
it('should indicate that it is not a localied string', () => {
|
|
1114
|
+
expect(getIsLocalizedString('foo')).toBe(false);
|
|
1115
|
+
});
|
|
1116
|
+
});
|
|
1117
|
+
describe('when input is an object', () => {
|
|
1118
|
+
describe('with less than one property', () => {
|
|
1119
|
+
it('should indicate that it is not a localied string', () => {
|
|
1120
|
+
expect(getIsLocalizedString({})).toBe(false);
|
|
1121
|
+
});
|
|
1122
|
+
});
|
|
1123
|
+
describe('with more than one property', () => {
|
|
1124
|
+
it('should indicate that it is an localied string', () => {
|
|
1125
|
+
expect(getIsLocalizedString({ de: 'Hallo' })).toBe(true);
|
|
1126
|
+
});
|
|
1127
|
+
});
|
|
1128
|
+
});
|
|
1129
|
+
});
|