@gem-sdk/core 3.0.0-pre-production.14 → 3.0.0
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/README.md +1 -1
- package/dist/cjs/components/AddOn.js +2 -18
- package/dist/cjs/components/ComponentAnimation.js +2 -17
- package/dist/cjs/components/ComponentToolbarPreview.js +2 -752
- package/dist/cjs/components/ComponentWrapper.js +2 -61
- package/dist/cjs/components/ComponentWrapperPreview.js +2 -213
- package/dist/cjs/components/Empty.js +2 -7
- package/dist/cjs/components/InteractionSuffix.js +2 -42
- package/dist/cjs/components/Render.js +2 -75
- package/dist/cjs/components/Render.liquid.js +16 -307
- package/dist/cjs/components/RenderBlock.js +2 -54
- package/dist/cjs/components/RenderCustomCode.js +4 -59
- package/dist/cjs/components/RenderPreview.js +2 -67
- package/dist/cjs/components/RenderSection.js +2 -23
- package/dist/cjs/components/ai-generator/AIContentGenerator.js +2 -252
- package/dist/cjs/components/ai-generator/AIGenContentLoading.js +2 -85
- package/dist/cjs/components/ai-generator/components/PickProduct.js +2 -220
- package/dist/cjs/components/ai-generator/components/ToneAndVoice.js +2 -77
- package/dist/cjs/components/ai-generator/hooks/useCheckingProductInside.js +1 -47
- package/dist/cjs/components/ai-generator/hooks/useFlipPopup.js +1 -110
- package/dist/cjs/components/ai-generator/hooks/useGettingGenerateRequest.js +1 -37
- package/dist/cjs/components/ai-generator/hooks/useListenEventGenerate.js +1 -70
- package/dist/cjs/components/ai-generator/icons/AIIcon.js +2 -67
- package/dist/cjs/components/ai-generator/icons/CloseIcon.js +2 -19
- package/dist/cjs/components/ai-generator/icons/DropdownIcon.js +2 -37
- package/dist/cjs/components/ai-generator/icons/SearchIcon.js +2 -21
- package/dist/cjs/components/ai-generator/icons/ShowMoreIcon.js +2 -21
- package/dist/cjs/components/ai-generator/icons/UpgradeIcon.js +2 -27
- package/dist/cjs/components/ai-generator/icons/WarningIcon.js +2 -31
- package/dist/cjs/components/constant.js +1 -82
- package/dist/cjs/components/resize/Resize.js +2 -16
- package/dist/cjs/components/resize/Spacing.js +2 -260
- package/dist/cjs/components/src/product/helpers/variant-presets.js +1 -56
- package/dist/cjs/components/theme-section/CreateThemeSection.js +2 -123
- package/dist/cjs/components/theme-section/ThemeSectionStatus.js +2 -45
- package/dist/cjs/components/theme-section/ThemeSectionTooltip.js +2 -126
- package/dist/cjs/components/toolbar/Tooltip.js +2 -28
- package/dist/cjs/constants/device.js +1 -0
- package/dist/cjs/contexts/AddonContext.js +2 -36
- package/dist/cjs/contexts/ArticleContext.js +2 -39
- package/dist/cjs/contexts/ArticleListContext.js +2 -31
- package/dist/cjs/contexts/BuilderComponent.js +2 -34
- package/dist/cjs/contexts/BuilderContext.js +2 -39
- package/dist/cjs/contexts/BuilderPreviewContext.js +2 -482
- package/dist/cjs/contexts/CartLineContext.js +2 -29
- package/dist/cjs/contexts/CollectionContext.js +2 -38
- package/dist/cjs/contexts/I18nContext.js +2 -0
- package/dist/cjs/contexts/ModalContext.js +2 -47
- package/dist/cjs/contexts/PageContext.js +2 -111
- package/dist/cjs/contexts/ProductContext.js +2 -182
- package/dist/cjs/contexts/ProductListContext.js +2 -32
- package/dist/cjs/contexts/SectionContext.js +2 -53
- package/dist/cjs/contexts/ShopContext.js +2 -107
- package/dist/cjs/graphql/fragments/analytic.generated.js +2 -6
- package/dist/cjs/graphql/fragments/collection-detail.generated.js +2 -6
- package/dist/cjs/graphql/fragments/collection-product.generated.js +2 -6
- package/dist/cjs/graphql/fragments/collection.generated.js +2 -6
- package/dist/cjs/graphql/fragments/custom-code.generated.js +2 -6
- package/dist/cjs/graphql/fragments/custom-font.generated.js +7 -7
- package/dist/cjs/graphql/fragments/data-seo.generated.js +2 -6
- package/dist/cjs/graphql/fragments/media.generated.js +2 -6
- package/dist/cjs/graphql/fragments/preview-theme-page.generated.js +6 -6
- package/dist/cjs/graphql/fragments/product-little.generated.js +2 -6
- package/dist/cjs/graphql/fragments/product-option-value.generated.js +2 -6
- package/dist/cjs/graphql/fragments/product-option.generated.js +2 -6
- package/dist/cjs/graphql/fragments/product.generated.js +2 -6
- package/dist/cjs/graphql/fragments/published-custom-section.generated.js +2 -6
- package/dist/cjs/graphql/fragments/published-page-section.generated.js +2 -6
- package/dist/cjs/graphql/fragments/published-theme-page.generated.js +4 -18
- package/dist/cjs/graphql/fragments/published-theme-style.generated.js +2 -6
- package/dist/cjs/graphql/fragments/selected-option.generated.js +2 -6
- package/dist/cjs/graphql/fragments/variant.generated.js +2 -6
- package/dist/cjs/graphql/mutations/page-view-up.generated.js +2 -6
- package/dist/cjs/graphql/queries/articles.generated.js +2 -6
- package/dist/cjs/graphql/queries/blogs.generated.js +3 -6
- package/dist/cjs/graphql/queries/collection-detail-filter.generated.js +2 -16
- package/dist/cjs/graphql/queries/collection.generated.js +2 -14
- package/dist/cjs/graphql/queries/collections.generated.js +2 -9
- package/dist/cjs/graphql/queries/preview-page.generated.js +2 -12
- package/dist/cjs/graphql/queries/product-little-detail.generated.js +2 -11
- package/dist/cjs/graphql/queries/product-medias.generated.js +2 -8
- package/dist/cjs/graphql/queries/product-value-label.generated.js +2 -6
- package/dist/cjs/graphql/queries/product-variants.generated.js +3 -11
- package/dist/cjs/graphql/queries/products.generated.js +3 -17
- package/dist/cjs/graphql/queries/{published-shop-metas.js → published-shop-metas.generated.js} +2 -6
- package/dist/cjs/graphql/queries/published-theme-pages.generated.js +3 -19
- package/dist/cjs/graphql/queries/shop-shopify.generated.js +2 -6
- package/dist/cjs/graphql/queries/store-property.generated.js +2 -6
- package/dist/cjs/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +2 -6
- package/dist/cjs/graphql-app-api/queries/LibraryTemplate.generated.js +2 -6
- package/dist/cjs/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +2 -6
- package/dist/cjs/graphql-app-api/queries/SaleFunnelOffer.generated.js +2 -6
- package/dist/cjs/graphql-app-api/queries/ShopLibraryPage.generated.js +2 -6
- package/dist/cjs/graphql-app-api/queries/ThemePage.generated.js +2 -6
- package/dist/cjs/helpers/GlobalEvent.js +1 -19
- package/dist/cjs/helpers/align.js +1 -37
- package/dist/cjs/helpers/animations.js +1 -222
- package/dist/cjs/helpers/background.js +1 -236
- package/dist/cjs/helpers/backgroundImage.js +1 -0
- package/dist/cjs/helpers/borders.js +4 -198
- package/dist/cjs/helpers/carousel.js +1 -55
- package/dist/cjs/helpers/clone-deep.js +1 -5
- package/dist/cjs/helpers/cls.js +1 -16
- package/dist/cjs/helpers/colors.js +1 -184
- package/dist/cjs/helpers/compose-advance-style.js +1 -323
- package/dist/cjs/helpers/composeClasses.js +1 -0
- package/dist/cjs/helpers/const.js +1 -0
- package/dist/cjs/helpers/constant.js +1 -23
- package/dist/cjs/helpers/convert.js +1 -7
- package/dist/cjs/helpers/covert-entities-html.js +1 -19
- package/dist/cjs/helpers/css-variable.js +1 -7
- package/dist/cjs/helpers/email.js +1 -11
- package/dist/cjs/helpers/filter-styles.js +1 -0
- package/dist/cjs/helpers/filter-toolbar-preview.js +2 -14
- package/dist/cjs/helpers/flatten-connection.js +1 -9
- package/dist/cjs/helpers/get-resonsive-value.js +1 -36
- package/dist/cjs/helpers/get-shortname.js +1 -92
- package/dist/cjs/helpers/icon-list.js +1 -61
- package/dist/cjs/helpers/interaction/index.js +2 -134
- package/dist/cjs/helpers/is-browser.js +1 -9
- package/dist/cjs/helpers/is-defined.js +1 -7
- package/dist/cjs/helpers/is-empty-children.js +2 -15
- package/dist/cjs/helpers/is-safari.js +1 -9
- package/dist/cjs/helpers/layout.js +1 -76
- package/dist/cjs/helpers/load-script.js +1 -31
- package/dist/cjs/helpers/loop-component.js +1 -16
- package/dist/cjs/helpers/make-style.js +1 -163
- package/dist/cjs/helpers/normalize-builder-data.js +1 -23
- package/dist/cjs/helpers/pascal-to-kebab-case.js +1 -7
- package/dist/cjs/helpers/prefetch-queries.js +1 -78
- package/dist/cjs/helpers/product.js +1 -48
- package/dist/cjs/helpers/queries/get-collection.js +1 -226
- package/dist/cjs/helpers/queries/get-collections.js +1 -21
- package/dist/cjs/helpers/queries/get-product-by-slug.js +1 -125
- package/dist/cjs/helpers/queries/get-product.js +1 -154
- package/dist/cjs/helpers/queries/get-products.js +1 -214
- package/dist/cjs/helpers/query.js +1 -29
- package/dist/cjs/helpers/radius.js +6 -140
- package/dist/cjs/helpers/render.js +1 -91
- package/dist/cjs/helpers/shadow.js +1 -69
- package/dist/cjs/helpers/size.js +4 -228
- package/dist/cjs/helpers/spacing.js +1 -43
- package/dist/cjs/helpers/third-party/addAppBlockId.js +1 -20
- package/dist/cjs/helpers/third-party/appConfig.js +1 -416
- package/dist/cjs/helpers/third-party/appSetting.js +1 -1324
- package/dist/cjs/helpers/third-party/composeAppBlockId.js +1 -11
- package/dist/cjs/helpers/third-party/constant.js +1 -69
- package/dist/cjs/helpers/third-party/generateAppBlockConfigs.js +1 -34
- package/dist/cjs/helpers/third-party/getAppBlockConfig.js +1 -55
- package/dist/cjs/helpers/third-party/getAppBlockType.js +1 -12
- package/dist/cjs/helpers/third-party/getAppBlocks.js +1 -30
- package/dist/cjs/helpers/third-party/mergeBlock.js +1 -19
- package/dist/cjs/helpers/third-party/mergeBlockOrder.js +1 -47
- package/dist/cjs/helpers/third-party/removeGPAppItems.js +1 -18
- package/dist/cjs/helpers/tracking/fpixel.js +1 -28
- package/dist/cjs/helpers/tracking/gtag.js +1 -93
- package/dist/cjs/helpers/tracking/tiktokpixel.js +1 -17
- package/dist/cjs/helpers/typography.js +19 -160
- package/dist/cjs/helpers/variant.js +1 -11
- package/dist/cjs/hooks/animation/useAnimationActions.js +2 -39
- package/dist/cjs/hooks/animation/useAnimationConfig.js +2 -30
- package/dist/cjs/hooks/animation/useAnimationPreview.js +2 -31
- package/dist/cjs/hooks/animation/useAnimationTarget.js +2 -122
- package/dist/cjs/hooks/animation/useApplyAnimation.js +2 -89
- package/dist/cjs/hooks/articles/useArticlesQuery.js +2 -33
- package/dist/cjs/hooks/cart/use-add-to-cart.js +2 -20
- package/dist/cjs/hooks/cart/use-cart-data.js +2 -28
- package/dist/cjs/hooks/cart/use-cart-discount-codes-update.js +2 -20
- package/dist/cjs/hooks/cart/use-cart-note-update.js +2 -20
- package/dist/cjs/hooks/cart/use-create-cart.js +2 -22
- package/dist/cjs/hooks/cart/use-remove-cart-item.js +2 -20
- package/dist/cjs/hooks/cart/use-update-cart-item.js +2 -20
- package/dist/cjs/hooks/shop/use-collection-query.js +2 -22
- package/dist/cjs/hooks/shop/use-collections-query.js +2 -17
- package/dist/cjs/hooks/shop/use-product-query.js +2 -22
- package/dist/cjs/hooks/shop/use-products-query.js +2 -63
- package/dist/cjs/hooks/shop/useShopifyLink.js +2 -0
- package/dist/cjs/hooks/shop.js +2 -135
- package/dist/cjs/hooks/use-current-device.js +2 -30
- package/dist/cjs/hooks/use-lazy-video.js +2 -15
- package/dist/cjs/hooks/useAnimations.js +2 -29
- package/dist/cjs/hooks/useCartId.js +2 -44
- package/dist/cjs/hooks/useCartLine.js +2 -11
- package/dist/cjs/hooks/useCartUI.js +2 -48
- package/dist/cjs/hooks/useCollection.js +2 -9
- package/dist/cjs/hooks/useFetchHandle.js +2 -13
- package/dist/cjs/hooks/useFormatMoney.js +2 -75
- package/dist/cjs/hooks/useI18n.js +2 -0
- package/dist/cjs/hooks/useInitialSwatchesOptions.js +2 -127
- package/dist/cjs/hooks/useInteraction.js +2 -19
- package/dist/cjs/hooks/useIsomorphicLayoutEffect.js +2 -10
- package/dist/cjs/hooks/useLoadScript.js +2 -32
- package/dist/cjs/hooks/useMoney.js +2 -84
- package/dist/cjs/hooks/usePrevious.js +2 -19
- package/dist/cjs/hooks/useProduct.js +2 -250
- package/dist/cjs/hooks/useProductList.js +2 -21
- package/dist/cjs/hooks/useStickyStore.js +1 -0
- package/dist/cjs/hooks/useSuspenseFetch.js +2 -27
- package/dist/cjs/hooks/useSwatchesOptions.js +2 -41
- package/dist/cjs/hooks/useToolbarPostPurchase.js +2 -89
- package/dist/cjs/index.js +1 -425
- package/dist/cjs/types/animations.js +1 -49
- package/dist/cjs/types/appAPI.js +1 -2
- package/dist/cjs/types/custom.js +1 -52
- package/dist/cjs/types/global-style.js +1 -15
- package/dist/cjs/types/shop.js +1 -2
- package/dist/esm/components/AddOn.js +2 -14
- package/dist/esm/components/ComponentAnimation.js +2 -13
- package/dist/esm/components/ComponentToolbarPreview.js +2 -748
- package/dist/esm/components/ComponentWrapper.js +2 -57
- package/dist/esm/components/ComponentWrapperPreview.js +2 -209
- package/dist/esm/components/Empty.js +2 -3
- package/dist/esm/components/InteractionSuffix.js +2 -40
- package/dist/esm/components/Render.js +2 -71
- package/dist/esm/components/Render.liquid.js +16 -301
- package/dist/esm/components/RenderBlock.js +2 -50
- package/dist/esm/components/RenderCustomCode.js +4 -55
- package/dist/esm/components/RenderPreview.js +2 -63
- package/dist/esm/components/RenderSection.js +2 -19
- package/dist/esm/components/ai-generator/AIContentGenerator.js +2 -250
- package/dist/esm/components/ai-generator/AIGenContentLoading.js +2 -83
- package/dist/esm/components/ai-generator/components/PickProduct.js +2 -218
- package/dist/esm/components/ai-generator/components/ToneAndVoice.js +2 -75
- package/dist/esm/components/ai-generator/hooks/useCheckingProductInside.js +1 -45
- package/dist/esm/components/ai-generator/hooks/useFlipPopup.js +1 -108
- package/dist/esm/components/ai-generator/hooks/useGettingGenerateRequest.js +1 -35
- package/dist/esm/components/ai-generator/hooks/useListenEventGenerate.js +1 -68
- package/dist/esm/components/ai-generator/icons/AIIcon.js +2 -65
- package/dist/esm/components/ai-generator/icons/CloseIcon.js +2 -17
- package/dist/esm/components/ai-generator/icons/DropdownIcon.js +2 -34
- package/dist/esm/components/ai-generator/icons/SearchIcon.js +2 -19
- package/dist/esm/components/ai-generator/icons/ShowMoreIcon.js +2 -19
- package/dist/esm/components/ai-generator/icons/UpgradeIcon.js +2 -25
- package/dist/esm/components/ai-generator/icons/WarningIcon.js +2 -29
- package/dist/esm/components/constant.js +1 -75
- package/dist/esm/components/resize/Resize.js +2 -12
- package/dist/esm/components/resize/Spacing.js +2 -256
- package/dist/esm/components/src/product/helpers/variant-presets.js +1 -54
- package/dist/esm/components/theme-section/CreateThemeSection.js +2 -121
- package/dist/esm/components/theme-section/ThemeSectionStatus.js +2 -43
- package/dist/esm/components/theme-section/ThemeSectionTooltip.js +2 -124
- package/dist/esm/components/toolbar/Tooltip.js +2 -24
- package/dist/esm/constants/device.js +1 -0
- package/dist/esm/contexts/AddonContext.js +2 -32
- package/dist/esm/contexts/ArticleContext.js +2 -36
- package/dist/esm/contexts/ArticleListContext.js +2 -27
- package/dist/esm/contexts/BuilderComponent.js +2 -31
- package/dist/esm/contexts/BuilderContext.js +2 -36
- package/dist/esm/contexts/BuilderPreviewContext.js +2 -479
- package/dist/esm/contexts/CartLineContext.js +2 -26
- package/dist/esm/contexts/CollectionContext.js +2 -35
- package/dist/esm/contexts/I18nContext.js +2 -0
- package/dist/esm/contexts/ModalContext.js +2 -44
- package/dist/esm/contexts/PageContext.js +2 -108
- package/dist/esm/contexts/ProductContext.js +2 -179
- package/dist/esm/contexts/ProductListContext.js +2 -28
- package/dist/esm/contexts/SectionContext.js +2 -49
- package/dist/esm/contexts/ShopContext.js +2 -104
- package/dist/esm/graphql/fragments/analytic.generated.js +2 -4
- package/dist/esm/graphql/fragments/collection-detail.generated.js +2 -4
- package/dist/esm/graphql/fragments/collection-product.generated.js +2 -4
- package/dist/esm/graphql/fragments/collection.generated.js +2 -4
- package/dist/esm/graphql/fragments/custom-code.generated.js +2 -4
- package/dist/esm/graphql/fragments/custom-font.generated.js +7 -5
- package/dist/esm/graphql/fragments/data-seo.generated.js +2 -4
- package/dist/esm/graphql/fragments/media.generated.js +2 -4
- package/dist/esm/graphql/fragments/preview-theme-page.generated.js +6 -4
- package/dist/esm/graphql/fragments/product-little.generated.js +2 -4
- package/dist/esm/graphql/fragments/product-option-value.generated.js +2 -4
- package/dist/esm/graphql/fragments/product-option.generated.js +2 -4
- package/dist/esm/graphql/fragments/product.generated.js +2 -4
- package/dist/esm/graphql/fragments/published-custom-section.generated.js +2 -4
- package/dist/esm/graphql/fragments/published-page-section.generated.js +2 -4
- package/dist/esm/graphql/fragments/published-theme-page.generated.js +4 -16
- package/dist/esm/graphql/fragments/published-theme-style.generated.js +2 -4
- package/dist/esm/graphql/fragments/selected-option.generated.js +2 -4
- package/dist/esm/graphql/fragments/variant.generated.js +2 -4
- package/dist/esm/graphql/mutations/page-view-up.generated.js +2 -4
- package/dist/esm/graphql/queries/articles.generated.js +2 -4
- package/dist/esm/graphql/queries/blogs.generated.js +3 -4
- package/dist/esm/graphql/queries/collection-detail-filter.generated.js +10 -22
- package/dist/esm/graphql/queries/collection.generated.js +8 -18
- package/dist/esm/graphql/queries/collections.generated.js +3 -8
- package/dist/esm/graphql/queries/preview-page.generated.js +6 -14
- package/dist/esm/graphql/queries/product-little-detail.generated.js +5 -12
- package/dist/esm/graphql/queries/product-medias.generated.js +2 -6
- package/dist/esm/graphql/queries/product-value-label.generated.js +2 -4
- package/dist/esm/graphql/queries/product-variants.generated.js +5 -11
- package/dist/esm/graphql/queries/products.generated.js +9 -20
- package/dist/esm/graphql/queries/{published-shop-metas.js → published-shop-metas.generated.js} +2 -4
- package/dist/esm/graphql/queries/published-theme-pages.generated.js +6 -20
- package/dist/esm/graphql/queries/shop-shopify.generated.js +2 -4
- package/dist/esm/graphql/queries/store-property.generated.js +2 -4
- package/dist/esm/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +2 -4
- package/dist/esm/graphql-app-api/queries/LibraryTemplate.generated.js +2 -4
- package/dist/esm/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +2 -4
- package/dist/esm/graphql-app-api/queries/SaleFunnelOffer.generated.js +2 -4
- package/dist/esm/graphql-app-api/queries/ShopLibraryPage.generated.js +2 -4
- package/dist/esm/graphql-app-api/queries/ThemePage.generated.js +2 -4
- package/dist/esm/helpers/GlobalEvent.js +1 -15
- package/dist/esm/helpers/align.js +1 -34
- package/dist/esm/helpers/animations.js +1 -220
- package/dist/esm/helpers/background.js +1 -227
- package/dist/esm/helpers/backgroundImage.js +1 -0
- package/dist/esm/helpers/borders.js +4 -189
- package/dist/esm/helpers/carousel.js +1 -51
- package/dist/esm/helpers/clone-deep.js +1 -3
- package/dist/esm/helpers/cls.js +1 -14
- package/dist/esm/helpers/colors.js +1 -169
- package/dist/esm/helpers/compose-advance-style.js +1 -315
- package/dist/esm/helpers/composeClasses.js +1 -0
- package/dist/esm/helpers/const.js +1 -0
- package/dist/esm/helpers/constant.js +1 -19
- package/dist/esm/helpers/convert.js +1 -4
- package/dist/esm/helpers/covert-entities-html.js +1 -17
- package/dist/esm/helpers/css-variable.js +1 -5
- package/dist/esm/helpers/email.js +1 -6
- package/dist/esm/helpers/filter-styles.js +1 -0
- package/dist/esm/helpers/filter-toolbar-preview.js +2 -9
- package/dist/esm/helpers/flatten-connection.js +1 -7
- package/dist/esm/helpers/get-resonsive-value.js +1 -31
- package/dist/esm/helpers/get-shortname.js +1 -90
- package/dist/esm/helpers/icon-list.js +1 -58
- package/dist/esm/helpers/interaction/index.js +2 -132
- package/dist/esm/helpers/is-browser.js +1 -5
- package/dist/esm/helpers/is-defined.js +1 -5
- package/dist/esm/helpers/is-empty-children.js +2 -10
- package/dist/esm/helpers/is-safari.js +1 -5
- package/dist/esm/helpers/layout.js +1 -70
- package/dist/esm/helpers/load-script.js +1 -29
- package/dist/esm/helpers/loop-component.js +1 -14
- package/dist/esm/helpers/make-style.js +1 -149
- package/dist/esm/helpers/normalize-builder-data.js +1 -21
- package/dist/esm/helpers/pascal-to-kebab-case.js +1 -5
- package/dist/esm/helpers/prefetch-queries.js +1 -76
- package/dist/esm/helpers/product.js +1 -44
- package/dist/esm/helpers/queries/get-collection.js +1 -223
- package/dist/esm/helpers/queries/get-collections.js +1 -19
- package/dist/esm/helpers/queries/get-product-by-slug.js +1 -123
- package/dist/esm/helpers/queries/get-product.js +1 -150
- package/dist/esm/helpers/queries/get-products.js +1 -210
- package/dist/esm/helpers/query.js +1 -25
- package/dist/esm/helpers/radius.js +6 -132
- package/dist/esm/helpers/render.js +1 -82
- package/dist/esm/helpers/shadow.js +1 -63
- package/dist/esm/helpers/size.js +4 -213
- package/dist/esm/helpers/spacing.js +1 -40
- package/dist/esm/helpers/third-party/addAppBlockId.js +1 -18
- package/dist/esm/helpers/third-party/appConfig.js +1 -356
- package/dist/esm/helpers/third-party/appSetting.js +1 -1321
- package/dist/esm/helpers/third-party/composeAppBlockId.js +1 -9
- package/dist/esm/helpers/third-party/constant.js +1 -66
- package/dist/esm/helpers/third-party/generateAppBlockConfigs.js +1 -32
- package/dist/esm/helpers/third-party/getAppBlockConfig.js +1 -53
- package/dist/esm/helpers/third-party/getAppBlockType.js +1 -10
- package/dist/esm/helpers/third-party/getAppBlocks.js +1 -28
- package/dist/esm/helpers/third-party/mergeBlock.js +1 -17
- package/dist/esm/helpers/third-party/mergeBlockOrder.js +1 -45
- package/dist/esm/helpers/third-party/removeGPAppItems.js +1 -15
- package/dist/esm/helpers/tracking/fpixel.js +1 -24
- package/dist/esm/helpers/tracking/gtag.js +1 -87
- package/dist/esm/helpers/tracking/tiktokpixel.js +1 -15
- package/dist/esm/helpers/typography.js +19 -149
- package/dist/esm/helpers/variant.js +1 -9
- package/dist/esm/hooks/animation/useAnimationActions.js +2 -37
- package/dist/esm/hooks/animation/useAnimationConfig.js +2 -28
- package/dist/esm/hooks/animation/useAnimationPreview.js +2 -29
- package/dist/esm/hooks/animation/useAnimationTarget.js +2 -120
- package/dist/esm/hooks/animation/useApplyAnimation.js +2 -85
- package/dist/esm/hooks/articles/useArticlesQuery.js +2 -30
- package/dist/esm/hooks/cart/use-add-to-cart.js +2 -18
- package/dist/esm/hooks/cart/use-cart-data.js +2 -26
- package/dist/esm/hooks/cart/use-cart-discount-codes-update.js +2 -18
- package/dist/esm/hooks/cart/use-cart-note-update.js +2 -18
- package/dist/esm/hooks/cart/use-create-cart.js +2 -20
- package/dist/esm/hooks/cart/use-remove-cart-item.js +2 -18
- package/dist/esm/hooks/cart/use-update-cart-item.js +2 -18
- package/dist/esm/hooks/shop/use-collection-query.js +2 -20
- package/dist/esm/hooks/shop/use-collections-query.js +2 -15
- package/dist/esm/hooks/shop/use-product-query.js +2 -20
- package/dist/esm/hooks/shop/use-products-query.js +2 -59
- package/dist/esm/hooks/shop/useShopifyLink.js +2 -0
- package/dist/esm/hooks/shop.js +2 -119
- package/dist/esm/hooks/use-current-device.js +2 -28
- package/dist/esm/hooks/use-lazy-video.js +2 -13
- package/dist/esm/hooks/useAnimations.js +2 -27
- package/dist/esm/hooks/useCartId.js +2 -40
- package/dist/esm/hooks/useCartLine.js +2 -7
- package/dist/esm/hooks/useCartUI.js +2 -44
- package/dist/esm/hooks/useCollection.js +2 -7
- package/dist/esm/hooks/useFetchHandle.js +2 -11
- package/dist/esm/hooks/useFormatMoney.js +2 -71
- package/dist/esm/hooks/useI18n.js +2 -0
- package/dist/esm/hooks/useInitialSwatchesOptions.js +2 -123
- package/dist/esm/hooks/useInteraction.js +2 -17
- package/dist/esm/hooks/useIsomorphicLayoutEffect.js +2 -6
- package/dist/esm/hooks/useLoadScript.js +2 -28
- package/dist/esm/hooks/useMoney.js +2 -80
- package/dist/esm/hooks/usePrevious.js +2 -17
- package/dist/esm/hooks/useProduct.js +2 -233
- package/dist/esm/hooks/useProductList.js +2 -16
- package/dist/esm/hooks/useStickyStore.js +1 -0
- package/dist/esm/hooks/useSuspenseFetch.js +2 -23
- package/dist/esm/hooks/useSwatchesOptions.js +2 -37
- package/dist/esm/hooks/useToolbarPostPurchase.js +2 -87
- package/dist/esm/index.js +1 -119
- package/dist/esm/types/animations.js +1 -49
- package/dist/esm/types/custom.js +1 -52
- package/dist/esm/types/global-style.js +1 -12
- package/dist/types/index.d.ts +12025 -8969
- package/package.json +6 -6
- package/dist/cjs/web-components/src/helpers/styles/constant.js +0 -9
- package/dist/esm/web-components/src/helpers/styles/constant.js +0 -7
|
@@ -1,37 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const useAnimationActions = ()=>{
|
|
4
|
-
const listAnimations = useRef();
|
|
5
|
-
const setAnimation = useCallback((newListAnimations)=>{
|
|
6
|
-
listAnimations.current = newListAnimations;
|
|
7
|
-
}, [
|
|
8
|
-
listAnimations
|
|
9
|
-
]);
|
|
10
|
-
const playAnimation = useCallback(()=>{
|
|
11
|
-
if (!listAnimations.current) return;
|
|
12
|
-
for (const animation of listAnimations.current){
|
|
13
|
-
animation.play();
|
|
14
|
-
}
|
|
15
|
-
}, []);
|
|
16
|
-
const cancelAnimation = useCallback(()=>{
|
|
17
|
-
if (!listAnimations.current) return;
|
|
18
|
-
for (const animation of listAnimations.current){
|
|
19
|
-
animation.cancel();
|
|
20
|
-
}
|
|
21
|
-
}, []);
|
|
22
|
-
const setAnimationOnFinish = useCallback((onFinish)=>{
|
|
23
|
-
if (!listAnimations.current) return;
|
|
24
|
-
for (const animation of listAnimations.current){
|
|
25
|
-
animation.onfinish = onFinish;
|
|
26
|
-
}
|
|
27
|
-
}, []);
|
|
28
|
-
return {
|
|
29
|
-
currentAnimation: listAnimations.current,
|
|
30
|
-
setAnimation,
|
|
31
|
-
playAnimation,
|
|
32
|
-
cancelAnimation,
|
|
33
|
-
setAnimationOnFinish
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
export { useAnimationActions };
|
|
1
|
+
'use client';
|
|
2
|
+
import{useRef as r,useCallback as t}from"react";let useAnimationActions=()=>{let n=r(),e=t(r=>{n.current=r},[n]),o=t(()=>{if(n.current)for(let r of n.current)r.play()},[]),c=t(()=>{if(n.current)for(let r of n.current)r.cancel()},[]),i=t(r=>{if(n.current)for(let t of n.current)t.onfinish=r},[]);return{currentAnimation:n.current,setAnimation:e,playAnimation:o,cancelAnimation:c,setAnimationOnFinish:i}};export{useAnimationActions};
|
|
@@ -1,28 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
const useAnimationConfig = (props)=>{
|
|
5
|
-
const currentDevice = useCurrentDevice();
|
|
6
|
-
const configByDevices = useMemo(()=>props?.advanced?.animation?.[currentDevice], [
|
|
7
|
-
currentDevice,
|
|
8
|
-
props?.advanced?.animation
|
|
9
|
-
]);
|
|
10
|
-
const getAnimationConfig = useCallback(()=>{
|
|
11
|
-
const { trigger, triggerConfig } = configByDevices;
|
|
12
|
-
const { animation, setting } = triggerConfig[trigger];
|
|
13
|
-
return {
|
|
14
|
-
type: animation,
|
|
15
|
-
setting: setting[animation],
|
|
16
|
-
reverse: trigger === "hidden"
|
|
17
|
-
};
|
|
18
|
-
}, [
|
|
19
|
-
configByDevices
|
|
20
|
-
]);
|
|
21
|
-
const isEnabledAnimation = configByDevices?.enabled;
|
|
22
|
-
return {
|
|
23
|
-
isEnabledAnimation,
|
|
24
|
-
getAnimationConfig
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export { useAnimationConfig };
|
|
1
|
+
'use client';
|
|
2
|
+
import{useMemo as e,useCallback as n}from"react";import{useCurrentDevice as t}from"../use-current-device.js";let useAnimationConfig=i=>{let r=t(),a=e(()=>i?.advanced?.animation?.[r],[r,i?.advanced?.animation]),o=n(()=>{let{trigger:e,triggerConfig:n}=a,{animation:t,setting:i}=n[e];return{type:t,setting:i[t],reverse:"hidden"===e}},[a]),d=a?.enabled;return{isEnabledAnimation:d,getAnimationConfig:o}};export{useAnimationConfig};
|
|
@@ -1,29 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const useAnimationPreview = ({ props, playAnimation, cancelAnimation, setAnimationOnFinish, setToolbarActive })=>{
|
|
4
|
-
const previewAnimation = useCallback((e)=>{
|
|
5
|
-
const { uid, isCancel } = e.detail;
|
|
6
|
-
if (props.uid !== uid) return;
|
|
7
|
-
cancelAnimation();
|
|
8
|
-
if (isCancel) {
|
|
9
|
-
setToolbarActive(true);
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
playAnimation();
|
|
13
|
-
setToolbarActive(false);
|
|
14
|
-
setAnimationOnFinish(()=>{
|
|
15
|
-
setToolbarActive(true);
|
|
16
|
-
});
|
|
17
|
-
}, [
|
|
18
|
-
props.uid,
|
|
19
|
-
cancelAnimation,
|
|
20
|
-
playAnimation,
|
|
21
|
-
setToolbarActive,
|
|
22
|
-
setAnimationOnFinish
|
|
23
|
-
]);
|
|
24
|
-
return {
|
|
25
|
-
previewAnimation
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export { useAnimationPreview };
|
|
1
|
+
'use client';
|
|
2
|
+
import{useCallback as e}from"react";let useAnimationPreview=({props:i,playAnimation:t,cancelAnimation:r,setAnimationOnFinish:n,setToolbarActive:u})=>{let o=e(e=>{let{uid:o,isCancel:a}=e.detail;if(i.uid===o){if(r(),a){u(!0);return}t(),u(!1),n(()=>{u(!0)})}},[i.uid,r,t,u,n]);return{previewAnimation:o}};export{useAnimationPreview};
|
|
@@ -1,120 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
const SPACING_ACTIVE_ATTRIBUTE = 'data-spacing-margin-bottom-active';
|
|
5
|
-
const TOOLBAR_ACTIVE_ATTRIBUTE = 'data-toolbar-active';
|
|
6
|
-
const OUTLINE_ACTIVE_ATTRIBUTE = 'data-outline-active';
|
|
7
|
-
const TOOLBAR_ADD_SECTION_ACTIVE_ATTRIBUTE = 'data-toolbar-add-active';
|
|
8
|
-
const useAnimationTarget = (props)=>{
|
|
9
|
-
const { isEnabledAnimation } = useAnimationConfig(props);
|
|
10
|
-
const componentTag = props.tag;
|
|
11
|
-
const componentUid = props.uid;
|
|
12
|
-
const targets = useRef(null);
|
|
13
|
-
const targetObjects = useRef([]);
|
|
14
|
-
const setToolbarActive = (isActive)=>{
|
|
15
|
-
if (!targetObjects.current) return;
|
|
16
|
-
for (const item of targetObjects.current){
|
|
17
|
-
if (isActive) {
|
|
18
|
-
item.toolbar?.setAttribute(TOOLBAR_ACTIVE_ATTRIBUTE, 'true');
|
|
19
|
-
item.outline?.setAttribute(OUTLINE_ACTIVE_ATTRIBUTE, 'true');
|
|
20
|
-
item.spacing?.setAttribute(SPACING_ACTIVE_ATTRIBUTE, 'true');
|
|
21
|
-
item.addSectionTop?.setAttribute(TOOLBAR_ADD_SECTION_ACTIVE_ATTRIBUTE, 'true');
|
|
22
|
-
item.addSectionBottom?.setAttribute(TOOLBAR_ADD_SECTION_ACTIVE_ATTRIBUTE, 'true');
|
|
23
|
-
} else {
|
|
24
|
-
item.toolbar?.removeAttribute(TOOLBAR_ACTIVE_ATTRIBUTE);
|
|
25
|
-
item.outline?.removeAttribute(OUTLINE_ACTIVE_ATTRIBUTE);
|
|
26
|
-
item.spacing?.removeAttribute(SPACING_ACTIVE_ATTRIBUTE);
|
|
27
|
-
item.addSectionTop?.removeAttribute(TOOLBAR_ADD_SECTION_ACTIVE_ATTRIBUTE);
|
|
28
|
-
item.addSectionBottom?.removeAttribute(TOOLBAR_ADD_SECTION_ACTIVE_ATTRIBUTE);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
const getSectionProperties = (target)=>{
|
|
33
|
-
const sectionAddTop = target.querySelector('[data-toolbar-add-top]');
|
|
34
|
-
const sectionAddBottom = target.querySelector('[data-toolbar-add-bottom]');
|
|
35
|
-
const sectionChild = Array.from(target.children);
|
|
36
|
-
const sectionToolbar = sectionChild.find((child)=>child.getAttribute('data-toolbar') !== null);
|
|
37
|
-
const sectionOutline = sectionChild.find((child)=>child.getAttribute('data-outline') !== null);
|
|
38
|
-
return {
|
|
39
|
-
sectionToolbar,
|
|
40
|
-
sectionOutline,
|
|
41
|
-
sectionAddTop,
|
|
42
|
-
sectionAddBottom
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
const getUpdatedTargetObjects = useCallback((targets)=>{
|
|
46
|
-
return targets.reduce((accumulator, $rootTarget)=>{
|
|
47
|
-
let addSectionTop = null;
|
|
48
|
-
let addSectionBottom = null;
|
|
49
|
-
let target = $rootTarget;
|
|
50
|
-
let toolbar = $rootTarget.querySelector('[data-toolbar][data-toolbar-active]');
|
|
51
|
-
let outline = $rootTarget.querySelector('[data-outline][data-outline-active]');
|
|
52
|
-
const spacing = $rootTarget.querySelector('[data-spacing] [data-spacing-margin-bottom]');
|
|
53
|
-
switch(componentTag){
|
|
54
|
-
case 'Button':
|
|
55
|
-
case 'SubmitButton':
|
|
56
|
-
case 'ProductButton':
|
|
57
|
-
case 'DynamicCheckout':
|
|
58
|
-
target = $rootTarget.querySelector('.gp-button-base');
|
|
59
|
-
break;
|
|
60
|
-
case 'ProductProperties':
|
|
61
|
-
target = $rootTarget.querySelector('input');
|
|
62
|
-
break;
|
|
63
|
-
case 'Icon':
|
|
64
|
-
target = $rootTarget.firstElementChild;
|
|
65
|
-
break;
|
|
66
|
-
case 'ProductTag':
|
|
67
|
-
target = $rootTarget?.children[0]?.children[0];
|
|
68
|
-
break;
|
|
69
|
-
case 'Section':
|
|
70
|
-
{
|
|
71
|
-
target = $rootTarget;
|
|
72
|
-
const { sectionOutline, sectionToolbar, sectionAddTop, sectionAddBottom } = getSectionProperties(target);
|
|
73
|
-
outline = sectionOutline;
|
|
74
|
-
toolbar = sectionToolbar;
|
|
75
|
-
addSectionTop = sectionAddTop;
|
|
76
|
-
addSectionBottom = sectionAddBottom;
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
default:
|
|
80
|
-
target = $rootTarget;
|
|
81
|
-
}
|
|
82
|
-
const newTargetObject = {
|
|
83
|
-
target,
|
|
84
|
-
toolbar,
|
|
85
|
-
outline,
|
|
86
|
-
spacing,
|
|
87
|
-
addSectionTop,
|
|
88
|
-
addSectionBottom
|
|
89
|
-
};
|
|
90
|
-
accumulator.push(newTargetObject);
|
|
91
|
-
return accumulator;
|
|
92
|
-
}, []);
|
|
93
|
-
}, [
|
|
94
|
-
componentTag
|
|
95
|
-
]);
|
|
96
|
-
const initListOfTargets = useCallback(()=>{
|
|
97
|
-
if (!isEnabledAnimation) return;
|
|
98
|
-
if (!targets.current) {
|
|
99
|
-
const $storefront = document.body.querySelector('#storefront');
|
|
100
|
-
if ($storefront) {
|
|
101
|
-
targets.current = $storefront.querySelectorAll(`[data-uid="${componentUid}"]`);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
const targetsArray = Array.from(targets.current || []);
|
|
105
|
-
if (!targetsArray.length) return;
|
|
106
|
-
const updatedTargetObjects = getUpdatedTargetObjects(targetsArray);
|
|
107
|
-
targetObjects.current = updatedTargetObjects;
|
|
108
|
-
}, [
|
|
109
|
-
componentUid,
|
|
110
|
-
getUpdatedTargetObjects,
|
|
111
|
-
isEnabledAnimation
|
|
112
|
-
]);
|
|
113
|
-
return {
|
|
114
|
-
targetObjects,
|
|
115
|
-
setToolbarActive,
|
|
116
|
-
initListOfTargets
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
export { useAnimationTarget };
|
|
1
|
+
'use client';
|
|
2
|
+
import{useRef as t,useCallback as e}from"react";import{useAnimationConfig as r}from"./useAnimationConfig.js";let SPACING_ACTIVE_ATTRIBUTE="data-spacing-margin-bottom-active",TOOLBAR_ACTIVE_ATTRIBUTE="data-toolbar-active",OUTLINE_ACTIVE_ATTRIBUTE="data-outline-active",TOOLBAR_ADD_SECTION_ACTIVE_ATTRIBUTE="data-toolbar-add-active",useAnimationTarget=a=>{let{isEnabledAnimation:o}=r(a),T=a.tag,u=a.uid,i=t(null),A=t([]),n=t=>{if(A.current)for(let e of A.current)t?(e.toolbar?.setAttribute(TOOLBAR_ACTIVE_ATTRIBUTE,"true"),e.outline?.setAttribute(OUTLINE_ACTIVE_ATTRIBUTE,"true"),e.spacing?.setAttribute(SPACING_ACTIVE_ATTRIBUTE,"true"),e.addSectionTop?.setAttribute(TOOLBAR_ADD_SECTION_ACTIVE_ATTRIBUTE,"true"),e.addSectionBottom?.setAttribute(TOOLBAR_ADD_SECTION_ACTIVE_ATTRIBUTE,"true")):(e.toolbar?.removeAttribute(TOOLBAR_ACTIVE_ATTRIBUTE),e.outline?.removeAttribute(OUTLINE_ACTIVE_ATTRIBUTE),e.spacing?.removeAttribute(SPACING_ACTIVE_ATTRIBUTE),e.addSectionTop?.removeAttribute(TOOLBAR_ADD_SECTION_ACTIVE_ATTRIBUTE),e.addSectionBottom?.removeAttribute(TOOLBAR_ADD_SECTION_ACTIVE_ATTRIBUTE))},l=t=>{let e=t.querySelector("[data-toolbar-add-top]"),r=t.querySelector("[data-toolbar-add-bottom]"),a=Array.from(t.children),o=a.find(t=>null!==t.getAttribute("data-toolbar")),T=a.find(t=>null!==t.getAttribute("data-outline"));return{sectionToolbar:o,sectionOutline:T,sectionAddTop:e,sectionAddBottom:r}},c=e(t=>t.reduce((t,e)=>{let r=null,a=null,o=e,u=e.querySelector("[data-toolbar][data-toolbar-active]"),i=e.querySelector("[data-outline][data-outline-active]"),A=e.querySelector("[data-spacing] [data-spacing-margin-bottom]");switch(T){case"Button":case"SubmitButton":case"ProductButton":case"DynamicCheckout":o=e.querySelector(".gp-button-base");break;case"ProductProperties":o=e.querySelector("input");break;case"Icon":o=e.firstElementChild;break;case"ProductTag":o=e?.children[0]?.children[0];break;case"Section":{o=e;let{sectionOutline:t,sectionToolbar:T,sectionAddTop:A,sectionAddBottom:n}=l(o);i=t,u=T,r=A,a=n;break}default:o=e}let n={target:o,toolbar:u,outline:i,spacing:A,addSectionTop:r,addSectionBottom:a};return t.push(n),t},[]),[T]),d=e(()=>{if(!o)return;let t=document.body.querySelector("#storefront");t&&(i.current=t.querySelectorAll(`[data-uid="${u}"]`));let e=Array.from(i.current||[]);if(!e.length)return;let r=c(e);A.current=r},[u,c,o]);return{targetObjects:A,setToolbarActive:n,initListOfTargets:d}};export{useAnimationTarget};
|
|
@@ -1,85 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { useAnimations } from
|
|
3
|
-
import { useAnimationTarget } from './useAnimationTarget.js';
|
|
4
|
-
import { useAnimationConfig } from './useAnimationConfig.js';
|
|
5
|
-
import { useAnimationActions } from './useAnimationActions.js';
|
|
6
|
-
import { useAnimationPreview } from './useAnimationPreview.js';
|
|
7
|
-
import '../../types/custom.js';
|
|
8
|
-
import { AnimationType } from '../../types/animations.js';
|
|
9
|
-
|
|
10
|
-
const useApplyAnimation = ({ props })=>{
|
|
11
|
-
const currentProps = props;
|
|
12
|
-
const { uid: componentUid } = currentProps;
|
|
13
|
-
const animation = useAnimations();
|
|
14
|
-
const { initListOfTargets, targetObjects, setToolbarActive } = useAnimationTarget(currentProps);
|
|
15
|
-
const { isEnabledAnimation, getAnimationConfig } = useAnimationConfig(currentProps);
|
|
16
|
-
const { setAnimation, cancelAnimation, playAnimation, setAnimationOnFinish } = useAnimationActions();
|
|
17
|
-
const { previewAnimation } = useAnimationPreview({
|
|
18
|
-
props: currentProps,
|
|
19
|
-
playAnimation,
|
|
20
|
-
cancelAnimation,
|
|
21
|
-
setAnimationOnFinish,
|
|
22
|
-
setToolbarActive
|
|
23
|
-
});
|
|
24
|
-
const generateAnimation = useCallback(({ target, setting, type, reverse })=>{
|
|
25
|
-
return animation[type](target, setting, reverse);
|
|
26
|
-
}, [
|
|
27
|
-
animation
|
|
28
|
-
]);
|
|
29
|
-
const initListAnimations = useCallback(()=>{
|
|
30
|
-
const { type, setting, reverse } = getAnimationConfig();
|
|
31
|
-
if (!type || type === AnimationType.None || !targetObjects.current.length) {
|
|
32
|
-
cancelAnimation();
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
const listAnimations = targetObjects.current.map((item)=>generateAnimation({
|
|
36
|
-
type,
|
|
37
|
-
setting,
|
|
38
|
-
target: item.target,
|
|
39
|
-
reverse
|
|
40
|
-
}));
|
|
41
|
-
cancelAnimation();
|
|
42
|
-
setAnimation(listAnimations);
|
|
43
|
-
}, [
|
|
44
|
-
getAnimationConfig,
|
|
45
|
-
targetObjects,
|
|
46
|
-
cancelAnimation,
|
|
47
|
-
setAnimation,
|
|
48
|
-
generateAnimation
|
|
49
|
-
]);
|
|
50
|
-
useEffect(()=>{
|
|
51
|
-
if (isEnabledAnimation) {
|
|
52
|
-
initListOfTargets();
|
|
53
|
-
initListAnimations();
|
|
54
|
-
} else {
|
|
55
|
-
cancelAnimation();
|
|
56
|
-
}
|
|
57
|
-
return ()=>{
|
|
58
|
-
cancelAnimation();
|
|
59
|
-
};
|
|
60
|
-
}, [
|
|
61
|
-
componentUid,
|
|
62
|
-
initListAnimations,
|
|
63
|
-
cancelAnimation,
|
|
64
|
-
isEnabledAnimation,
|
|
65
|
-
initListOfTargets
|
|
66
|
-
]);
|
|
67
|
-
useEffect(()=>{
|
|
68
|
-
window.addEventListener('preview-animation', previewAnimation);
|
|
69
|
-
return ()=>{
|
|
70
|
-
window.removeEventListener('preview-animation', previewAnimation);
|
|
71
|
-
};
|
|
72
|
-
}, [
|
|
73
|
-
previewAnimation
|
|
74
|
-
]);
|
|
75
|
-
useEffect(()=>{
|
|
76
|
-
window.addEventListener('init-animation-target', initListOfTargets);
|
|
77
|
-
return ()=>{
|
|
78
|
-
window.removeEventListener('init-animation-target', initListOfTargets);
|
|
79
|
-
};
|
|
80
|
-
}, [
|
|
81
|
-
initListOfTargets
|
|
82
|
-
]);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
export { useApplyAnimation as default };
|
|
1
|
+
'use client';
|
|
2
|
+
import{useCallback as t,useEffect as i}from"react";import{useAnimations as e}from"../useAnimations.js";import{useAnimationTarget as n}from"./useAnimationTarget.js";import{useAnimationConfig as o}from"./useAnimationConfig.js";import{useAnimationActions as r}from"./useAnimationActions.js";import{useAnimationPreview as m}from"./useAnimationPreview.js";import"../../types/custom.js";import{AnimationType as a}from"../../types/animations.js";import{DIALOG as s}from"../../helpers/const.js";let useApplyAnimation=({props:p})=>{let{uid:u}=p,f=e(),{initListOfTargets:w,targetObjects:A,setToolbarActive:d}=n(p),{isEnabledAnimation:l,getAnimationConfig:v}=o(p),{setAnimation:g,cancelAnimation:j,playAnimation:c,setAnimationOnFinish:y}=r(),E=()=>{p.tag===s&&(w(),x()),c()},{previewAnimation:L}=m({props:p,playAnimation:E,cancelAnimation:j,setAnimationOnFinish:y,setToolbarActive:d}),h=t(({target:t,setting:i,type:e,reverse:n})=>f[e](t,i,n),[f]),x=t(()=>{let{type:t,setting:i,reverse:e}=v();if(!t||t===a.None||!A.current.length){j();return}let n=A.current.map(n=>h({type:t,setting:i,target:n.target,reverse:e}));j(),g(n)},[v,A,j,g,h]);i(()=>(l?(w(),x()):j(),()=>{j()}),[u,x,j,l,w]),i(()=>(window.addEventListener("preview-animation",L),()=>{window.removeEventListener("preview-animation",L)}),[L]),i(()=>(window.addEventListener("init-animation-target",w),()=>{window.removeEventListener("init-animation-target",w)}),[w])};export{useApplyAnimation as default};
|
|
@@ -1,30 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import useSWR from 'swr';
|
|
4
|
-
import { BlogsDocument } from '../../graphql/queries/blogs.generated.js';
|
|
5
|
-
|
|
6
|
-
const useArticlesQuery = (variables, options)=>{
|
|
7
|
-
const fetcher = useFetchHandle();
|
|
8
|
-
const fetchArticles = ()=>fetcher([
|
|
9
|
-
ArticlesDocument,
|
|
10
|
-
variables ?? {}
|
|
11
|
-
]);
|
|
12
|
-
return useSWR(variables ? [
|
|
13
|
-
'query/articles',
|
|
14
|
-
variables
|
|
15
|
-
] : null, fetchArticles, options);
|
|
16
|
-
};
|
|
17
|
-
const useBlogsQuery = (variables, options)=>{
|
|
18
|
-
const fetcher = useFetchHandle();
|
|
19
|
-
//@ts-ignore
|
|
20
|
-
const fetchBlogs = ()=>fetcher([
|
|
21
|
-
BlogsDocument,
|
|
22
|
-
variables ?? {}
|
|
23
|
-
]);
|
|
24
|
-
return useSWR(variables ? [
|
|
25
|
-
'query/blogs',
|
|
26
|
-
variables
|
|
27
|
-
] : null, fetchBlogs, options);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export { useArticlesQuery, useBlogsQuery };
|
|
1
|
+
'use client';
|
|
2
|
+
import{ArticlesDocument as e}from"../../graphql/queries/articles.generated.js";import{useFetchHandle as r}from"../useFetchHandle.js";import s from"swr";import{BlogsDocument as l}from"../../graphql/queries/blogs.generated.js";let useArticlesQuery=(l,t)=>{let u=r(),o=()=>u([e,l??{}]);return s(l?["query/articles",l]:null,o,t)},useBlogsQuery=(e,t)=>{let u=r(),o=()=>u([l,e??{}]);return s(e?["query/blogs",e]:null,o,t)};export{useArticlesQuery,useBlogsQuery};
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import useSWRMutation from 'swr/mutation';
|
|
4
|
-
import { useStoreFront } from '../shop.js';
|
|
5
|
-
|
|
6
|
-
const useAddToCart = (options)=>{
|
|
7
|
-
const shop = useStoreFront();
|
|
8
|
-
const { mutate } = useSWRConfig();
|
|
9
|
-
return useSWRMutation('add-to-cart', (_, { arg })=>addToCartOperation(shop)(arg), {
|
|
10
|
-
...options,
|
|
11
|
-
onSuccess: (result, key, config)=>{
|
|
12
|
-
mutate('cart', result, false);
|
|
13
|
-
options?.onSuccess?.(result, key, config);
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export { useAddToCart };
|
|
1
|
+
'use client';
|
|
2
|
+
import{addToCartOperation as r}from"@gem-sdk/adapter-shopify";import{useSWRConfig as o}from"swr";import t from"swr/mutation";import{useStoreFront as s}from"../shop.js";let useAddToCart=e=>{let m=s(),{mutate:a}=o();return t("add-to-cart",(o,{arg:t})=>r(m)(t),{...e,onSuccess:(r,o,t)=>{a("cart",r,!1),e?.onSuccess?.(r,o,t)}})};export{useAddToCart};
|
|
@@ -1,26 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { useStoreFront } from '../shop.js';
|
|
4
|
-
import useCartId from '../useCartId.js';
|
|
5
|
-
|
|
6
|
-
const useCartData = (options)=>{
|
|
7
|
-
const { cartId, clearCartId } = useCartId();
|
|
8
|
-
const shop = useStoreFront();
|
|
9
|
-
return useSWR(cartId ? 'cart' : null, ()=>getCartOperation(shop)({
|
|
10
|
-
cartId: cartId
|
|
11
|
-
}), {
|
|
12
|
-
revalidateOnMount: true,
|
|
13
|
-
revalidateOnFocus: true,
|
|
14
|
-
keepPreviousData: false,
|
|
15
|
-
dedupingInterval: 2000,
|
|
16
|
-
...options,
|
|
17
|
-
onSuccess (data, key, config) {
|
|
18
|
-
if (!data) {
|
|
19
|
-
clearCartId();
|
|
20
|
-
}
|
|
21
|
-
options?.onSuccess?.(data, key, config);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export { useCartData };
|
|
1
|
+
'use client';
|
|
2
|
+
import{getCartOperation as r}from"@gem-sdk/adapter-shopify";import e from"swr";import{useStoreFront as t}from"../shop.js";import a from"../useCartId.js";let useCartData=o=>{let{cartId:s,clearCartId:u}=a(),p=t();return e(s?"cart":null,()=>r(p)({cartId:s}),{revalidateOnMount:!0,revalidateOnFocus:!0,keepPreviousData:!1,dedupingInterval:2e3,...o,onSuccess(r,e,t){r||u(),o?.onSuccess?.(r,e,t)}})};export{useCartData};
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import useSWRMutation from 'swr/mutation';
|
|
4
|
-
import { useStoreFront } from '../shop.js';
|
|
5
|
-
|
|
6
|
-
const useCartDiscountCodesUpdate = (options)=>{
|
|
7
|
-
const shop = useStoreFront();
|
|
8
|
-
const { mutate } = useSWRConfig();
|
|
9
|
-
return useSWRMutation('cart-discount-codes-update', (_, { arg })=>cartDiscountCodesUpdateOperation(shop)(arg), {
|
|
10
|
-
...options,
|
|
11
|
-
onSuccess: (result, key, config)=>{
|
|
12
|
-
mutate('cart', result, false);
|
|
13
|
-
options?.onSuccess?.(result, key, config);
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export { useCartDiscountCodesUpdate };
|
|
1
|
+
'use client';
|
|
2
|
+
import{cartDiscountCodesUpdateOperation as t}from"@gem-sdk/adapter-shopify";import{useSWRConfig as o}from"swr";import r from"swr/mutation";import{useStoreFront as s}from"../shop.js";let useCartDiscountCodesUpdate=e=>{let p=s(),{mutate:a}=o();return r("cart-discount-codes-update",(o,{arg:r})=>t(p)(r),{...e,onSuccess:(t,o,r)=>{a("cart",t,!1),e?.onSuccess?.(t,o,r)}})};export{useCartDiscountCodesUpdate};
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import useSWRMutation from 'swr/mutation';
|
|
4
|
-
import { useStoreFront } from '../shop.js';
|
|
5
|
-
|
|
6
|
-
const useCartNoteUpdate = (options)=>{
|
|
7
|
-
const shop = useStoreFront();
|
|
8
|
-
const { mutate } = useSWRConfig();
|
|
9
|
-
return useSWRMutation('cart-note-update', (_, { arg })=>cartNoteUpdateOperation(shop)(arg), {
|
|
10
|
-
...options,
|
|
11
|
-
onSuccess: (result, key, config)=>{
|
|
12
|
-
mutate('cart', result, false);
|
|
13
|
-
options?.onSuccess?.(result, key, config);
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export { useCartNoteUpdate };
|
|
1
|
+
'use client';
|
|
2
|
+
import{cartNoteUpdateOperation as t}from"@gem-sdk/adapter-shopify";import{useSWRConfig as r}from"swr";import o from"swr/mutation";import{useStoreFront as e}from"../shop.js";let useCartNoteUpdate=s=>{let p=e(),{mutate:a}=r();return o("cart-note-update",(r,{arg:o})=>t(p)(o),{...s,onSuccess:(t,r,o)=>{a("cart",t,!1),s?.onSuccess?.(t,r,o)}})};export{useCartNoteUpdate};
|
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import useSWRMutation from 'swr/mutation';
|
|
4
|
-
import { useStoreFront } from '../shop.js';
|
|
5
|
-
|
|
6
|
-
const useCreateCart = (options)=>{
|
|
7
|
-
const shop = useStoreFront();
|
|
8
|
-
const { mutate } = useSWRConfig();
|
|
9
|
-
return useSWRMutation('create-cart', (_, { arg })=>{
|
|
10
|
-
return createCartOperation(shop)(arg);
|
|
11
|
-
}, {
|
|
12
|
-
...options,
|
|
13
|
-
onSuccess: (result, key, config)=>{
|
|
14
|
-
mutate('cart', result, false);
|
|
15
|
-
options?.onSuccess?.(result, key, config);
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export { useCreateCart };
|
|
1
|
+
'use client';
|
|
2
|
+
import{createCartOperation as r}from"@gem-sdk/adapter-shopify";import{useSWRConfig as t}from"swr";import e from"swr/mutation";import{useStoreFront as o}from"../shop.js";let useCreateCart=s=>{let a=o(),{mutate:m}=t();return e("create-cart",(t,{arg:e})=>r(a)(e),{...s,onSuccess:(r,t,e)=>{m("cart",r,!1),s?.onSuccess?.(r,t,e)}})};export{useCreateCart};
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import useSWRMutation from 'swr/mutation';
|
|
4
|
-
import { useStoreFront } from '../shop.js';
|
|
5
|
-
|
|
6
|
-
const useRemoveCartItem = (options)=>{
|
|
7
|
-
const shop = useStoreFront();
|
|
8
|
-
const { mutate } = useSWRConfig();
|
|
9
|
-
return useSWRMutation('remove-cart-item', (_, { arg })=>removeCartItemOperation(shop)(arg), {
|
|
10
|
-
...options,
|
|
11
|
-
onSuccess: (result, key, config)=>{
|
|
12
|
-
mutate('cart', result, false);
|
|
13
|
-
options?.onSuccess?.(result, key, config);
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export { useRemoveCartItem };
|
|
1
|
+
'use client';
|
|
2
|
+
import{removeCartItemOperation as e}from"@gem-sdk/adapter-shopify";import{useSWRConfig as r}from"swr";import t from"swr/mutation";import{useStoreFront as o}from"../shop.js";let useRemoveCartItem=m=>{let s=o(),{mutate:p}=r();return t("remove-cart-item",(r,{arg:t})=>e(s)(t),{...m,onSuccess:(e,r,t)=>{p("cart",e,!1),m?.onSuccess?.(e,r,t)}})};export{useRemoveCartItem};
|
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import useSWRMutation from 'swr/mutation';
|
|
4
|
-
import { useStoreFront } from '../shop.js';
|
|
5
|
-
|
|
6
|
-
const useUpdateCartItem = (options)=>{
|
|
7
|
-
const shop = useStoreFront();
|
|
8
|
-
const { mutate } = useSWRConfig();
|
|
9
|
-
return useSWRMutation('update-cart-item', (_, { arg })=>updateCartLineOperation(shop)(arg), {
|
|
10
|
-
...options,
|
|
11
|
-
onSuccess: (result, key, config)=>{
|
|
12
|
-
mutate('cart', result, false);
|
|
13
|
-
options?.onSuccess?.(result, key, config);
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export { useUpdateCartItem };
|
|
1
|
+
'use client';
|
|
2
|
+
import{updateCartLineOperation as t}from"@gem-sdk/adapter-shopify";import{useSWRConfig as r}from"swr";import e from"swr/mutation";import{useStoreFront as o}from"../shop.js";let useUpdateCartItem=m=>{let s=o(),{mutate:p}=r();return e("update-cart-item",(r,{arg:e})=>t(s)(e),{...m,onSuccess:(t,r,e)=>{p("cart",t,!1),m?.onSuccess?.(t,r,e)}})};export{useUpdateCartItem};
|
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { useIsSampleProduct, useIsStorefrontProduct } from '../shop.js';
|
|
4
|
-
import { useFetchHandle } from '../useFetchHandle.js';
|
|
5
|
-
import { generateCollectionQueryKey } from '../../helpers/query.js';
|
|
6
|
-
|
|
7
|
-
const useCollectionQuery = (args, options)=>{
|
|
8
|
-
const fetcher = useFetchHandle();
|
|
9
|
-
const isSample = useIsSampleProduct();
|
|
10
|
-
const isStorefront = useIsStorefrontProduct();
|
|
11
|
-
return useSWR(args ? generateCollectionQueryKey({
|
|
12
|
-
...args,
|
|
13
|
-
isSample,
|
|
14
|
-
isStorefront
|
|
15
|
-
}) : null, ([, arg])=>{
|
|
16
|
-
return getCollection(fetcher, arg);
|
|
17
|
-
}, options);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export { useCollectionQuery };
|
|
1
|
+
'use client';
|
|
2
|
+
import e from"swr";import{getCollection as r}from"../../helpers/queries/get-collection.js";import{useIsSampleProduct as o,useIsStorefrontProduct as t}from"../shop.js";import{useFetchHandle as l}from"../useFetchHandle.js";import{generateCollectionQueryKey as s}from"../../helpers/query.js";let useCollectionQuery=(m,i)=>{let p=l(),u=o(),n=t();return e(m?s({...m,isSample:u,isStorefront:n}):null,([,e])=>r(p,e),i)};export{useCollectionQuery};
|
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { useFetchHandle } from '../useFetchHandle.js';
|
|
4
|
-
|
|
5
|
-
const useCollectionsQuery = (variable, options)=>{
|
|
6
|
-
const fetcher = useFetchHandle();
|
|
7
|
-
return useSWR(variable ? [
|
|
8
|
-
'query/collections',
|
|
9
|
-
variable
|
|
10
|
-
] : null, async ([, arg])=>{
|
|
11
|
-
return getCollections(fetcher, arg);
|
|
12
|
-
}, options);
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export { useCollectionsQuery };
|
|
1
|
+
'use client';
|
|
2
|
+
import e from"swr";import{getCollections as o}from"../../helpers/queries/get-collections.js";import{useFetchHandle as r}from"../useFetchHandle.js";let useCollectionsQuery=(l,s)=>{let t=r();return e(l?["query/collections",l]:null,async([,e])=>o(t,e),s)};export{useCollectionsQuery};
|
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { useIsSampleProduct, useIsStorefrontProduct } from '../shop.js';
|
|
4
|
-
import { useFetchHandle } from '../useFetchHandle.js';
|
|
5
|
-
import { generateProductQueryKey } from '../../helpers/query.js';
|
|
6
|
-
|
|
7
|
-
const useProductQuery = (productId, options, customFetcher)=>{
|
|
8
|
-
const fetcher = useFetchHandle();
|
|
9
|
-
const isSample = useIsSampleProduct();
|
|
10
|
-
const isStorefront = useIsStorefrontProduct();
|
|
11
|
-
return useSWR(productId ? generateProductQueryKey({
|
|
12
|
-
id: productId,
|
|
13
|
-
isSample,
|
|
14
|
-
isStorefront
|
|
15
|
-
}) : null, async ([, arg])=>{
|
|
16
|
-
return getProduct(customFetcher || fetcher, arg);
|
|
17
|
-
}, options);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export { useProductQuery };
|
|
1
|
+
'use client';
|
|
2
|
+
import r from"swr";import{getProduct as e}from"../../helpers/queries/get-product.js";import{useIsSampleProduct as o,useIsStorefrontProduct as t}from"../shop.js";import{useFetchHandle as s}from"../useFetchHandle.js";import{generateProductQueryKey as u}from"../../helpers/query.js";let useProductQuery=(m,p,i)=>{let l=s(),c=o(),d=t();return r(m?u({id:m,isSample:c,isStorefront:d}):null,async([,r])=>e(i||l,r),p)};export{useProductQuery};
|
|
@@ -1,59 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { getProducts, getProductQueryAll, getListProductByVariables } from '../../helpers/queries/get-products.js';
|
|
4
|
-
import { generateProductsQueryKey } from '../../helpers/query.js';
|
|
5
|
-
import { useIsSampleProduct, useIsStorefrontProduct } from '../shop.js';
|
|
6
|
-
import { useFetchHandle } from '../useFetchHandle.js';
|
|
7
|
-
|
|
8
|
-
const useProductsQuery = (ids, options, params)=>{
|
|
9
|
-
const fetcher = useFetchHandle();
|
|
10
|
-
const isSample = useIsSampleProduct();
|
|
11
|
-
const isStorefront = useIsStorefrontProduct();
|
|
12
|
-
return useSWR(ids ? generateProductsQueryKey({
|
|
13
|
-
ids,
|
|
14
|
-
isSample,
|
|
15
|
-
isStorefront,
|
|
16
|
-
defaultSelectedProductCount: params?.defaultSelectedProductCount,
|
|
17
|
-
allStatus: params?.allStatus
|
|
18
|
-
}) : null, async ([, arg])=>{
|
|
19
|
-
return getProducts(params?.fetcher || fetcher, arg);
|
|
20
|
-
}, options);
|
|
21
|
-
};
|
|
22
|
-
const getKey = (variable)=>{
|
|
23
|
-
return (pageIndex, previousPageData)=>{
|
|
24
|
-
if (!variable || previousPageData && !previousPageData.products?.pageInfo?.hasNextPage) {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
if (pageIndex === 0) {
|
|
28
|
-
return [
|
|
29
|
-
'query/products',
|
|
30
|
-
variable
|
|
31
|
-
];
|
|
32
|
-
}
|
|
33
|
-
return [
|
|
34
|
-
'query/products',
|
|
35
|
-
{
|
|
36
|
-
...variable,
|
|
37
|
-
after: previousPageData.products?.pageInfo?.endCursor
|
|
38
|
-
}
|
|
39
|
-
];
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
const useListProductQuery = (variable, options)=>{
|
|
43
|
-
const fetcher = useFetchHandle();
|
|
44
|
-
const data = useSWRInfinite(getKey(variable), async ([, arg])=>{
|
|
45
|
-
return getListProductByVariables(fetcher, arg);
|
|
46
|
-
}, options);
|
|
47
|
-
return data;
|
|
48
|
-
};
|
|
49
|
-
const useProductsQueryAll = (variable, options)=>{
|
|
50
|
-
const fetcher = useFetchHandle();
|
|
51
|
-
return useSWR(variable ? [
|
|
52
|
-
'query/products',
|
|
53
|
-
variable
|
|
54
|
-
] : null, async ([, arg])=>{
|
|
55
|
-
return getProductQueryAll(fetcher, arg);
|
|
56
|
-
}, options);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export { useListProductQuery, useProductsQuery, useProductsQueryAll };
|
|
1
|
+
'use client';
|
|
2
|
+
import e from"swr";import r from"swr/infinite";import{getProducts as t,getProductQueryAll as u,getListProductByVariables as s}from"../../helpers/queries/get-products.js";import{generateProductsQueryKey as o}from"../../helpers/query.js";import{useIsSampleProduct as l,useIsStorefrontProduct as c}from"../shop.js";import{useFetchHandle as d}from"../useFetchHandle.js";let useProductsQuery=(r,u,s)=>{let p=d(),n=l(),a=c();return e(r?o({ids:r,isSample:n,isStorefront:a,defaultSelectedProductCount:s?.defaultSelectedProductCount,allStatus:s?.allStatus}):null,async([,e])=>t(s?.fetcher||p,e),u)},getKey=e=>(r,t)=>e&&(!t||t.products?.pageInfo?.hasNextPage)?0===r?["query/products",e]:["query/products",{...e,after:t.products?.pageInfo?.endCursor}]:null,useListProductQuery=(e,t)=>{let u=d(),o=r(getKey(e),async([,e])=>s(u,e),t);return o},useProductsQueryAll=(r,t)=>{let s=d();return e(r?["query/products",r]:null,async([,e])=>u(s,e),t)};export{useListProductQuery,useProductsQuery,useProductsQueryAll};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import{useMemo as t}from"react";import{useShopStore as o}from"../../contexts/ShopContext.js";let useShopifyLink=({productId:r,articleId:e})=>{let s=o(t=>t.storefrontUrl),p=t(()=>{let t=/^(?:https?:\/\/)?([^/]+)\.myshopify\.com/;return s?s.match(t)?.[1]:""},[s]),i=t(()=>`https://admin.shopify.com/store/${p}`,[p]),m=t(()=>r?`${i}/products/${r}`:"",[i,r]),h=t(()=>e?`${i}/articles/${e}`:"",[e,i]);return{linkShopDefault:i,linkEditProduct:m,linkEditArticle:h}};export{useShopifyLink};
|