@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,11 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var pascalToKebabCase = require('../pascal-to-kebab-case.js');
|
|
4
|
-
var constant = require('./constant.js');
|
|
5
|
-
|
|
6
|
-
const composeAppBlockId = (tag, uid)=>{
|
|
7
|
-
const key = pascalToKebabCase.pascalToKebab(tag);
|
|
8
|
-
return `${constant.THIRD_PARTY_APP_BLOCK_ID_PREFIX}_${key}_${uid}`;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
exports.composeAppBlockId = composeAppBlockId;
|
|
1
|
+
"use strict";var pascalToKebabCase=require("../pascal-to-kebab-case.js"),constant=require("./constant.js");const composeAppBlockId=(a,s)=>{let e=pascalToKebabCase.pascalToKebab(a);return`${constant.THIRD_PARTY_APP_BLOCK_ID_PREFIX}_${e}_${s}`};exports.composeAppBlockId=composeAppBlockId;
|
|
@@ -1,69 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var appConfig = require('./appConfig.js');
|
|
4
|
-
|
|
5
|
-
const mapShopifyAppMeta = {
|
|
6
|
-
...appConfig.RechargeSubscriptionsConfig,
|
|
7
|
-
...appConfig.BonLoyaltyRewardsReferralsConfig,
|
|
8
|
-
...appConfig.SubifySubscriptionsConfig,
|
|
9
|
-
...appConfig.SelleasyConfig,
|
|
10
|
-
...appConfig.LoopSubscriptionsConfig,
|
|
11
|
-
...appConfig.SkioSubscriptionsYcS20Config,
|
|
12
|
-
...appConfig.ShopifyFormsConfig,
|
|
13
|
-
...appConfig.ReviewxpoProductReviewsAppConfig,
|
|
14
|
-
...appConfig.PumperBundlesVolumeDiscountConfig,
|
|
15
|
-
...appConfig.UnlimitedBundlesDiscountsConfig,
|
|
16
|
-
...appConfig.KiteFreeGiftDiscountConfig,
|
|
17
|
-
...appConfig.FastBundleBundlesDiscountsConfig,
|
|
18
|
-
...appConfig.SimpleBundlesKitsConfig,
|
|
19
|
-
...appConfig.EasyBundleBuilderSkailamaConfig,
|
|
20
|
-
...appConfig.PreorderNowPreOrderPqConfig,
|
|
21
|
-
...appConfig.FlyBundlesUpsellsFbtConfig,
|
|
22
|
-
...appConfig.JunipProductReviewsUgcConfig,
|
|
23
|
-
...appConfig.PreorderNowWodPresaleConfig,
|
|
24
|
-
...appConfig.YotpoReviewsV3UgcConfig,
|
|
25
|
-
...appConfig.WhatmoreShoppableVideosreelConfig,
|
|
26
|
-
...appConfig.ProductOptionsCustomizerConfig,
|
|
27
|
-
...appConfig.AppointmentBookingCowlendarConfig,
|
|
28
|
-
...appConfig.BoldSubscriptionsConfig,
|
|
29
|
-
...appConfig.SproutPlantTreesGrowSalesConfig,
|
|
30
|
-
...appConfig.InstasellShoppableInstagramConfig,
|
|
31
|
-
...appConfig.GrowaveConfig,
|
|
32
|
-
...appConfig.LoloyalLoyaltyReferralsConfig,
|
|
33
|
-
...appConfig.PowerfulContactFormBuilderConfig,
|
|
34
|
-
...appConfig.WishlistKingConfig,
|
|
35
|
-
...appConfig.GloboProductOptionsVariantConfig,
|
|
36
|
-
...appConfig.KachingBundlesConfig,
|
|
37
|
-
...appConfig.TrustooConfig,
|
|
38
|
-
...appConfig.LooxReviewsConfig,
|
|
39
|
-
...appConfig.PowrContactFormBuilderConfig,
|
|
40
|
-
...appConfig.BestBuyFulfillmentConfig,
|
|
41
|
-
...appConfig.AftershipEmailMarketingsmsConfig,
|
|
42
|
-
...appConfig.SegunoEmailMarketingConfig,
|
|
43
|
-
...appConfig.SeoantTrustBadgesIconConfig,
|
|
44
|
-
...appConfig.TrustreviewsProductReviewsConfig,
|
|
45
|
-
...appConfig.MyappgurusProductReviewsConfig,
|
|
46
|
-
...appConfig.HulkProductOptionsConfig,
|
|
47
|
-
...appConfig.TrustshopProductReviewsConfig,
|
|
48
|
-
...appConfig.StampedConfig,
|
|
49
|
-
...appConfig.BoostAISearchDiscoveryConfig,
|
|
50
|
-
...appConfig.EssentialCountdownTimerBarConfig,
|
|
51
|
-
...appConfig.EssentialAnnouncementBarConfig,
|
|
52
|
-
...appConfig.OkendoReviewsLoyaltyConfig,
|
|
53
|
-
...appConfig.EstimatedDeliveryDatePlusConfig,
|
|
54
|
-
...appConfig.HextomCountdownTimerBarConfig,
|
|
55
|
-
...appConfig.TrustBadgesBearConfig,
|
|
56
|
-
...appConfig.TrustedsiteTrustBadgesConfig,
|
|
57
|
-
...appConfig.GloColorSwatchvariantImageConfig,
|
|
58
|
-
...appConfig.BfSizeChartSizeGuideConfig,
|
|
59
|
-
...appConfig.HextomFreeShippingBarConfig,
|
|
60
|
-
...appConfig.ShopifySubscriptionsConfig,
|
|
61
|
-
...appConfig.QikifyUpsellConfig,
|
|
62
|
-
...appConfig.EcoboostifyShoppableReelUgcConfig,
|
|
63
|
-
...appConfig.AppstleBundlesDiscountsConfig,
|
|
64
|
-
...appConfig.ReleasitConfig
|
|
65
|
-
};
|
|
66
|
-
const THIRD_PARTY_APP_BLOCK_ID_PREFIX = 'gp_app';
|
|
67
|
-
|
|
68
|
-
exports.THIRD_PARTY_APP_BLOCK_ID_PREFIX = THIRD_PARTY_APP_BLOCK_ID_PREFIX;
|
|
69
|
-
exports.mapShopifyAppMeta = mapShopifyAppMeta;
|
|
1
|
+
"use strict";var appConfig=require("./appConfig.js");const mapShopifyAppMeta={...appConfig.RechargeSubscriptionsConfig,...appConfig.BonLoyaltyRewardsReferralsConfig,...appConfig.SubifySubscriptionsConfig,...appConfig.SelleasyConfig,...appConfig.LoopSubscriptionsConfig,...appConfig.SkioSubscriptionsYcS20Config,...appConfig.ShopifyFormsConfig,...appConfig.ReviewxpoProductReviewsAppConfig,...appConfig.PumperBundlesVolumeDiscountConfig,...appConfig.UnlimitedBundlesDiscountsConfig,...appConfig.KiteFreeGiftDiscountConfig,...appConfig.FastBundleBundlesDiscountsConfig,...appConfig.SimpleBundlesKitsConfig,...appConfig.EasyBundleBuilderSkailamaConfig,...appConfig.PreorderNowPreOrderPqConfig,...appConfig.FlyBundlesUpsellsFbtConfig,...appConfig.JunipProductReviewsUgcConfig,...appConfig.PreorderNowWodPresaleConfig,...appConfig.YotpoReviewsV3UgcConfig,...appConfig.WhatmoreShoppableVideosreelConfig,...appConfig.ProductOptionsCustomizerConfig,...appConfig.AppointmentBookingCowlendarConfig,...appConfig.BoldSubscriptionsConfig,...appConfig.SproutPlantTreesGrowSalesConfig,...appConfig.InstasellShoppableInstagramConfig,...appConfig.GrowaveConfig,...appConfig.LoloyalLoyaltyReferralsConfig,...appConfig.PowerfulContactFormBuilderConfig,...appConfig.WishlistKingConfig,...appConfig.GloboProductOptionsVariantConfig,...appConfig.KachingBundlesConfig,...appConfig.BestBuyFulfillmentConfig,...appConfig.AftershipEmailMarketingsmsConfig,...appConfig.SegunoEmailMarketingConfig,...appConfig.TrustooConfig,...appConfig.LooxReviewsConfig,...appConfig.SeoantTrustBadgesIconConfig,...appConfig.TrustreviewsProductReviewsConfig,...appConfig.MyappgurusProductReviewsConfig,...appConfig.HulkProductOptionsConfig,...appConfig.TrustshopProductReviewsConfig,...appConfig.StampedConfig,...appConfig.BoostAISearchDiscoveryConfig,...appConfig.EssentialCountdownTimerBarConfig,...appConfig.EssentialAnnouncementBarConfig,...appConfig.OkendoReviewsLoyaltyConfig,...appConfig.EstimatedDeliveryDatePlusConfig,...appConfig.HextomCountdownTimerBarConfig,...appConfig.TrustBadgesBearConfig,...appConfig.TrustedsiteTrustBadgesConfig,...appConfig.GloColorSwatchvariantImageConfig,...appConfig.BfSizeChartSizeGuideConfig,...appConfig.HextomFreeShippingBarConfig,...appConfig.ShopifySubscriptionsConfig,...appConfig.QikifyUpsellConfig,...appConfig.EcoboostifyShoppableReelUgcConfig,...appConfig.AppstleBundlesDiscountsConfig,...appConfig.ReleasitConfig,...appConfig.AovFreeGiftBuyXGetYBogoConfig},THIRD_PARTY_APP_BLOCK_ID_PREFIX="gp_app";exports.THIRD_PARTY_APP_BLOCK_ID_PREFIX="gp_app",exports.mapShopifyAppMeta=mapShopifyAppMeta;
|
|
@@ -1,34 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var loopComponent = require('../loop-component.js');
|
|
4
|
-
var getAppBlockConfig = require('./getAppBlockConfig.js');
|
|
5
|
-
|
|
6
|
-
const generateAppBlockConfigs = (component)=>{
|
|
7
|
-
const strComponent = JSON.stringify(component) || '';
|
|
8
|
-
if (!strComponent.includes('appBlockId')) return null;
|
|
9
|
-
const configs = [];
|
|
10
|
-
loopComponent.loopComponent(component, (component)=>{
|
|
11
|
-
const settings = component.settings || {};
|
|
12
|
-
const appBlockId = settings?.appBlockId || '';
|
|
13
|
-
if (!appBlockId) return;
|
|
14
|
-
const config = getAppBlockConfig.getAppBlockConfig(component.tag, appBlockId, settings);
|
|
15
|
-
if (!config) return;
|
|
16
|
-
configs.push(config);
|
|
17
|
-
});
|
|
18
|
-
if (!configs.length) return null;
|
|
19
|
-
return {
|
|
20
|
-
newBlocks: extractBlocks(configs),
|
|
21
|
-
newBlockOrder: extractBlockOrder(configs)
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
function extractBlocks(array) {
|
|
25
|
-
return array.reduce((acc, item)=>{
|
|
26
|
-
acc[item.key] = item.value;
|
|
27
|
-
return acc;
|
|
28
|
-
}, {});
|
|
29
|
-
}
|
|
30
|
-
function extractBlockOrder(array) {
|
|
31
|
-
return array.map((item)=>item.key);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
exports.generateAppBlockConfigs = generateAppBlockConfigs;
|
|
1
|
+
"use strict";var loopComponent=require("../loop-component.js"),getAppBlockConfig=require("./getAppBlockConfig.js");const generateAppBlockConfigs=e=>{let o=JSON.stringify(e)||"";if(!o.includes("appBlockId"))return null;let t=[];return(loopComponent.loopComponent(e,e=>{let o=e.settings||{},n=o?.appBlockId||"";if(!n)return;let r=getAppBlockConfig.getAppBlockConfig(e.tag,n,o);r&&t.push(r)}),t.length)?{newBlocks:extractBlocks(t),newBlockOrder:extractBlockOrder(t)}:null};function extractBlocks(e){return e.reduce((e,o)=>(e[o.key]=o.value,e),{})}function extractBlockOrder(e){return e.map(e=>e.key)}exports.generateAppBlockConfigs=generateAppBlockConfigs;
|
|
@@ -1,55 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var appSetting = require('./appSetting.js');
|
|
4
|
-
var getAppBlockType = require('./getAppBlockType.js');
|
|
5
|
-
|
|
6
|
-
const listAppUpdateNewVersion = [
|
|
7
|
-
'Growave',
|
|
8
|
-
'Trustoo',
|
|
9
|
-
'LooxReviews',
|
|
10
|
-
'Stamped',
|
|
11
|
-
'Releasit'
|
|
12
|
-
];
|
|
13
|
-
const listThirdPartyRejectAppBlock = {
|
|
14
|
-
YotpoReviews: {
|
|
15
|
-
conditionToReject: 'settings?.version === "v1"'
|
|
16
|
-
},
|
|
17
|
-
Trustoo: {
|
|
18
|
-
conditionToReject: 'settings?.version === "v1"'
|
|
19
|
-
},
|
|
20
|
-
LooxReviews: {
|
|
21
|
-
conditionToReject: 'settings?.version === "v1"'
|
|
22
|
-
},
|
|
23
|
-
Stamped: {
|
|
24
|
-
conditionToReject: 'settings?.version === "v1"'
|
|
25
|
-
},
|
|
26
|
-
Releasit: {
|
|
27
|
-
conditionToReject: 'settings?.version === "v1"'
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
const getAppBlockConfig = (tag, appBlockId, settings)=>{
|
|
31
|
-
if (listThirdPartyRejectAppBlock[tag] && eval(listThirdPartyRejectAppBlock[tag]?.conditionToReject ?? '')) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
let widgetType = settings?.widgetType;
|
|
35
|
-
if (listAppUpdateNewVersion.includes(tag)) {
|
|
36
|
-
widgetType = settings?.widgetTypeV2;
|
|
37
|
-
}
|
|
38
|
-
const appBlockType = getAppBlockType.getAppBlockType({
|
|
39
|
-
tag,
|
|
40
|
-
widgetType
|
|
41
|
-
});
|
|
42
|
-
const settingByWidget = appSetting.composeSettingsByWidgetType[tag][widgetType];
|
|
43
|
-
const appSettings = appSetting.overrideSettings(tag, settingByWidget, settings);
|
|
44
|
-
return {
|
|
45
|
-
key: appBlockId,
|
|
46
|
-
value: {
|
|
47
|
-
type: appBlockType,
|
|
48
|
-
...settingByWidget && {
|
|
49
|
-
settings: appSettings
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
exports.getAppBlockConfig = getAppBlockConfig;
|
|
1
|
+
"use strict";var appSetting=require("./appSetting.js"),getAppBlockType=require("./getAppBlockType.js");const listAppUpdateNewVersion=["Growave","Trustoo","LooxReviews","Stamped","Releasit"],listThirdPartyRejectAppBlock={YotpoReviews:{conditionToReject:'settings?.version === "v1"'},Trustoo:{conditionToReject:'settings?.version === "v1"'},LooxReviews:{conditionToReject:'settings?.version === "v1"'},Stamped:{conditionToReject:'settings?.version === "v1"'},Releasit:{conditionToReject:'settings?.version === "v1"'}},getAppBlockConfig=(tag,appBlockId,settings)=>{if(listThirdPartyRejectAppBlock[tag]&&eval(listThirdPartyRejectAppBlock[tag]?.conditionToReject??""))return;let widgetType=settings?.widgetType;listAppUpdateNewVersion.includes(tag)&&(widgetType=settings?.widgetTypeV2);let appBlockType=getAppBlockType.getAppBlockType({tag,widgetType}),settingByWidget=appSetting.composeSettingsByWidgetType?.[tag]?.[widgetType],appSettings=appSetting.overrideSettings(tag,settingByWidget,settings);return{key:appBlockId,value:{type:appBlockType,...settingByWidget&&{settings:appSettings}}}};exports.getAppBlockConfig=getAppBlockConfig;
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var constant = require('./constant.js');
|
|
4
|
-
|
|
5
|
-
const getAppBlockType = ({ tag, widgetType })=>{
|
|
6
|
-
const shopifyAppMeta = constant.mapShopifyAppMeta[tag];
|
|
7
|
-
if (!shopifyAppMeta) return '';
|
|
8
|
-
const { appName, appId } = shopifyAppMeta;
|
|
9
|
-
return `shopify://apps/${appName}/blocks/${widgetType}/${appId}`;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
exports.getAppBlockType = getAppBlockType;
|
|
1
|
+
"use strict";var constant=require("./constant.js");const getAppBlockType=({tag:t,widgetType:p})=>{let e=constant.mapShopifyAppMeta[t];if(!e)return"";let{appName:o,appId:s}=e;return`shopify://apps/${o}/blocks/${p}/${s}`};exports.getAppBlockType=getAppBlockType;
|
|
@@ -1,30 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var addAppBlockId = require('./addAppBlockId.js');
|
|
4
|
-
var generateAppBlockConfigs = require('./generateAppBlockConfigs.js');
|
|
5
|
-
var mergeBlock = require('./mergeBlock.js');
|
|
6
|
-
var mergeBlockOrder = require('./mergeBlockOrder.js');
|
|
7
|
-
var removeGPAppItems = require('./removeGPAppItems.js');
|
|
8
|
-
|
|
9
|
-
const getAppBlocks = (section)=>{
|
|
10
|
-
const { blocks: currentBlock, block_order: currentBlockOrder } = JSON.parse(section?.appBlocks || '{}');
|
|
11
|
-
const component = JSON.parse(section?.component || '');
|
|
12
|
-
const componentWithAppBlockId = addAppBlockId.addAppBlockId(component);
|
|
13
|
-
const appBlockConfigs = generateAppBlockConfigs.generateAppBlockConfigs(componentWithAppBlockId);
|
|
14
|
-
if (!appBlockConfigs) {
|
|
15
|
-
if (!currentBlock || !currentBlockOrder) return {};
|
|
16
|
-
return {
|
|
17
|
-
blocks: removeGPAppItems.removeAllGPAppItemsFromBlocks(currentBlock),
|
|
18
|
-
block_order: removeGPAppItems.removeAllGPAppItemsFromBlockOrder(currentBlockOrder)
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
const { newBlocks, newBlockOrder } = appBlockConfigs;
|
|
22
|
-
const blocks = mergeBlock.mergeBlocks(newBlocks, currentBlock);
|
|
23
|
-
const block_order = mergeBlockOrder.mergeBlockOrder(newBlockOrder, currentBlockOrder);
|
|
24
|
-
return {
|
|
25
|
-
blocks,
|
|
26
|
-
block_order
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
exports.getAppBlocks = getAppBlocks;
|
|
1
|
+
"use strict";var addAppBlockId=require("./addAppBlockId.js"),generateAppBlockConfigs=require("./generateAppBlockConfigs.js"),mergeBlock=require("./mergeBlock.js"),mergeBlockOrder=require("./mergeBlockOrder.js"),removeGPAppItems=require("./removeGPAppItems.js");const getAppBlocks=e=>{let{blocks:r,block_order:o}=JSON.parse(e?.appBlocks||"{}"),p=JSON.parse(e?.component||""),l=addAppBlockId.addAppBlockId(p),c=generateAppBlockConfigs.generateAppBlockConfigs(l);if(!c)return r&&o?{blocks:removeGPAppItems.removeAllGPAppItemsFromBlocks(r),block_order:removeGPAppItems.removeAllGPAppItemsFromBlockOrder(o)}:{};let{newBlocks:s,newBlockOrder:k}=c,m=mergeBlock.mergeBlocks(s,r),t=mergeBlockOrder.mergeBlockOrder(k,o);return{blocks:m,block_order:t}};exports.getAppBlocks=getAppBlocks;
|
|
@@ -1,19 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
function mergeBlocks(newBlocks, blocks) {
|
|
4
|
-
if (!blocks) return newBlocks;
|
|
5
|
-
const result = {};
|
|
6
|
-
// Add all non-gp_app blocks from the original blocks
|
|
7
|
-
for (const [key, value] of Object.entries(blocks)){
|
|
8
|
-
if (!key.startsWith('gp_app')) {
|
|
9
|
-
result[key] = value;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
// Add all blocks from new-blocks
|
|
13
|
-
for (const [key, value] of Object.entries(newBlocks)){
|
|
14
|
-
result[key] = value;
|
|
15
|
-
}
|
|
16
|
-
return result;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
exports.mergeBlocks = mergeBlocks;
|
|
1
|
+
"use strict";function mergeBlocks(e,t){if(!t)return e;let r={};for(let[e,s]of Object.entries(t))e.startsWith("gp_app")||(r[e]=s);for(let[t,s]of Object.entries(e))r[t]=s;return r}exports.mergeBlocks=mergeBlocks;
|
|
@@ -1,47 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var constant = require('./constant.js');
|
|
4
|
-
|
|
5
|
-
function isGpAppItem(item) {
|
|
6
|
-
if (!item) return false;
|
|
7
|
-
return item.startsWith(constant.THIRD_PARTY_APP_BLOCK_ID_PREFIX);
|
|
8
|
-
}
|
|
9
|
-
function filterCurrentOrder(currentOrder, newOrderSet) {
|
|
10
|
-
return currentOrder.filter((item)=>!isGpAppItem(item) || newOrderSet.has(item));
|
|
11
|
-
}
|
|
12
|
-
function processNonGpAppItem(item, resultOrder) {
|
|
13
|
-
resultOrder.push(item);
|
|
14
|
-
}
|
|
15
|
-
function processGpAppItems(newOrder, newOrderIndex, resultOrder) {
|
|
16
|
-
while(newOrderIndex < newOrder.length && isGpAppItem(newOrder[newOrderIndex])){
|
|
17
|
-
resultOrder.push(newOrder[newOrderIndex]);
|
|
18
|
-
newOrderIndex++;
|
|
19
|
-
}
|
|
20
|
-
return newOrderIndex;
|
|
21
|
-
}
|
|
22
|
-
function addRemainingGpAppItems(newOrder, startIndex, resultOrder) {
|
|
23
|
-
for(let i = startIndex; i < newOrder.length; i++){
|
|
24
|
-
const item = newOrder[i];
|
|
25
|
-
if (item && isGpAppItem(item)) {
|
|
26
|
-
resultOrder.push(item);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
function mergeBlockOrder(newOrder, currentOrder) {
|
|
31
|
-
if (!currentOrder) return newOrder;
|
|
32
|
-
const newOrderSet = new Set(newOrder);
|
|
33
|
-
const filteredCurrentOrder = filterCurrentOrder(currentOrder, newOrderSet);
|
|
34
|
-
const resultOrder = [];
|
|
35
|
-
let newOrderIndex = 0;
|
|
36
|
-
filteredCurrentOrder.forEach((item)=>{
|
|
37
|
-
if (!isGpAppItem(item)) {
|
|
38
|
-
processNonGpAppItem(item, resultOrder);
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
newOrderIndex = processGpAppItems(newOrder, newOrderIndex, resultOrder);
|
|
42
|
-
});
|
|
43
|
-
addRemainingGpAppItems(newOrder, newOrderIndex, resultOrder);
|
|
44
|
-
return resultOrder;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
exports.mergeBlockOrder = mergeBlockOrder;
|
|
1
|
+
"use strict";var constant=require("./constant.js");function isGpAppItem(e){return!!e&&e.startsWith(constant.THIRD_PARTY_APP_BLOCK_ID_PREFIX)}function filterCurrentOrder(e,t){return e.filter(e=>!isGpAppItem(e)||t.has(e))}function processNonGpAppItem(e,t){t.push(e)}function processGpAppItems(e,t,r){for(;t<e.length&&isGpAppItem(e[t]);)r.push(e[t]),t++;return t}function addRemainingGpAppItems(e,t,r){for(let p=t;p<e.length;p++){let t=e[p];t&&isGpAppItem(t)&&r.push(t)}}function mergeBlockOrder(e,t){if(!t)return e;let r=new Set(e),p=filterCurrentOrder(t,r),n=[],s=0;return p.forEach(t=>{if(!isGpAppItem(t)){processNonGpAppItem(t,n);return}s=processGpAppItems(e,s,n)}),addRemainingGpAppItems(e,s,n),n}exports.mergeBlockOrder=mergeBlockOrder;
|
|
@@ -1,18 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var constant = require('./constant.js');
|
|
4
|
-
|
|
5
|
-
const removeAllGPAppItemsFromBlocks = (blocks)=>{
|
|
6
|
-
for(const key in blocks){
|
|
7
|
-
if (key.startsWith(constant.THIRD_PARTY_APP_BLOCK_ID_PREFIX)) {
|
|
8
|
-
delete blocks[key];
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
return blocks;
|
|
12
|
-
};
|
|
13
|
-
const removeAllGPAppItemsFromBlockOrder = (blockOrder)=>{
|
|
14
|
-
return blockOrder.filter((item)=>!item.includes(constant.THIRD_PARTY_APP_BLOCK_ID_PREFIX));
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
exports.removeAllGPAppItemsFromBlockOrder = removeAllGPAppItemsFromBlockOrder;
|
|
18
|
-
exports.removeAllGPAppItemsFromBlocks = removeAllGPAppItemsFromBlocks;
|
|
1
|
+
"use strict";var constant=require("./constant.js");const removeAllGPAppItemsFromBlocks=e=>{for(let r in e)r.startsWith(constant.THIRD_PARTY_APP_BLOCK_ID_PREFIX)&&delete e[r];return e},removeAllGPAppItemsFromBlockOrder=e=>e.filter(e=>!e.includes(constant.THIRD_PARTY_APP_BLOCK_ID_PREFIX));exports.removeAllGPAppItemsFromBlockOrder=removeAllGPAppItemsFromBlockOrder,exports.removeAllGPAppItemsFromBlocks=removeAllGPAppItemsFromBlocks;
|
|
@@ -1,28 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const pageview = ()=>{
|
|
4
|
-
if (!window.fbq) return;
|
|
5
|
-
window.fbq('track', 'PageView');
|
|
6
|
-
};
|
|
7
|
-
// https://developers.facebook.com/docs/facebook-pixel/advanced/
|
|
8
|
-
const event = (name, options = {})=>{
|
|
9
|
-
if (!window.fbq) return;
|
|
10
|
-
window.fbq('track', name, options);
|
|
11
|
-
};
|
|
12
|
-
const addToCart = (product)=>{
|
|
13
|
-
if (!window.fbq) return;
|
|
14
|
-
window.fbq('track', 'AddToCart', {
|
|
15
|
-
content_ids: [
|
|
16
|
-
product.id
|
|
17
|
-
],
|
|
18
|
-
content_name: product.name,
|
|
19
|
-
content_category: product.category,
|
|
20
|
-
content_type: 'product',
|
|
21
|
-
value: product.price,
|
|
22
|
-
currency: product.currency
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
exports.addToCart = addToCart;
|
|
27
|
-
exports.event = event;
|
|
28
|
-
exports.pageview = pageview;
|
|
1
|
+
"use strict";const pageview=()=>{window.fbq&&window.fbq("track","PageView")},event=(e,t={})=>{window.fbq&&window.fbq("track",e,t)},addToCart=e=>{window.fbq&&window.fbq("track","AddToCart",{content_ids:[e.id],content_name:e.name,content_category:e.category,content_type:"product",value:e.price,currency:e.currency})};exports.addToCart=addToCart,exports.event=event,exports.pageview=pageview;
|
|
@@ -1,93 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// https://developers.google.com/analytics/devguides/collection/gtagjs/pages
|
|
4
|
-
const pageview = (url, trackingId)=>{
|
|
5
|
-
// GA 4
|
|
6
|
-
if (window.gtag && trackingId) {
|
|
7
|
-
window.gtag('config', trackingId, {
|
|
8
|
-
page_path: url
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
// GA 3
|
|
12
|
-
if (window.ga) {
|
|
13
|
-
window.ga('send', 'pageview', url);
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
/** Addition to cart events
|
|
17
|
-
* https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#add-remove-cart
|
|
18
|
-
*/ const addToCart = (product)=>{
|
|
19
|
-
// GA 3
|
|
20
|
-
if (!window.ga || !product) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
window.ga('ec:addProduct', {
|
|
24
|
-
...product,
|
|
25
|
-
id: product.sku,
|
|
26
|
-
name: product.variant === 'Default Title' ? product.name : `${product.name} - ${product.variant}`,
|
|
27
|
-
variant: product.variant === 'Default Title' ? product.name : product.variant
|
|
28
|
-
});
|
|
29
|
-
window.ga('ec:setAction', 'add');
|
|
30
|
-
window.ga('send', 'event', {
|
|
31
|
-
eventCategory: 'EnhancedEcommerce',
|
|
32
|
-
eventAction: 'Added Product',
|
|
33
|
-
nonInteraction: true
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
/** Product clicked event
|
|
37
|
-
* https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#product-click
|
|
38
|
-
*/ const productClick = (product)=>{
|
|
39
|
-
if (!window.ga) {
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
ga('ec:addProduct', {
|
|
43
|
-
id: product.id,
|
|
44
|
-
name: product.name,
|
|
45
|
-
category: product.category,
|
|
46
|
-
brand: product.brand,
|
|
47
|
-
variant: product.variant
|
|
48
|
-
});
|
|
49
|
-
ga('ec:setAction', 'click');
|
|
50
|
-
ga('send', 'event', {
|
|
51
|
-
eventAction: 'Click',
|
|
52
|
-
eventCategory: 'Product'
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
/** Product viewed event
|
|
56
|
-
* https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#measuring-actvities
|
|
57
|
-
*/ const productDetail = (product)=>{
|
|
58
|
-
if (!product || !window.ga) return;
|
|
59
|
-
ga('ec:addProduct', {
|
|
60
|
-
brand: product.brand,
|
|
61
|
-
category: product.category,
|
|
62
|
-
id: product.id,
|
|
63
|
-
name: product.name,
|
|
64
|
-
variant: product.variant
|
|
65
|
-
});
|
|
66
|
-
ga('ec:setAction', 'detail');
|
|
67
|
-
ga('send', 'event', {
|
|
68
|
-
eventAction: 'Detail',
|
|
69
|
-
eventCategory: 'Ecommerce',
|
|
70
|
-
nonInteraction: 1
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
/** Removal from cart events
|
|
74
|
-
* https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#add-remove-cart
|
|
75
|
-
*/ const removeFromCart = (product, price)=>{
|
|
76
|
-
if (!product || !window.ga) return;
|
|
77
|
-
ga('ec:addProduct', {
|
|
78
|
-
id: product.id,
|
|
79
|
-
name: product.name,
|
|
80
|
-
price
|
|
81
|
-
});
|
|
82
|
-
ga('ec:setAction', 'remove');
|
|
83
|
-
ga('send', 'event', {
|
|
84
|
-
eventAction: 'Click',
|
|
85
|
-
eventCategory: 'Remove from cart'
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
exports.addToCart = addToCart;
|
|
90
|
-
exports.pageview = pageview;
|
|
91
|
-
exports.productClick = productClick;
|
|
92
|
-
exports.productDetail = productDetail;
|
|
93
|
-
exports.removeFromCart = removeFromCart;
|
|
1
|
+
"use strict";const pageview=(e,a)=>{window.gtag&&a&&window.gtag("config",a,{page_path:e}),window.ga&&window.ga("send","pageview",e)},addToCart=e=>{window.ga&&e&&(window.ga("ec:addProduct",{...e,id:e.sku,name:"Default Title"===e.variant?e.name:`${e.name} - ${e.variant}`,variant:"Default Title"===e.variant?e.name:e.variant}),window.ga("ec:setAction","add"),window.ga("send","event",{eventCategory:"EnhancedEcommerce",eventAction:"Added Product",nonInteraction:!0}))},productClick=e=>{window.ga&&(ga("ec:addProduct",{id:e.id,name:e.name,category:e.category,brand:e.brand,variant:e.variant}),ga("ec:setAction","click"),ga("send","event",{eventAction:"Click",eventCategory:"Product"}))},productDetail=e=>{e&&window.ga&&(ga("ec:addProduct",{brand:e.brand,category:e.category,id:e.id,name:e.name,variant:e.variant}),ga("ec:setAction","detail"),ga("send","event",{eventAction:"Detail",eventCategory:"Ecommerce",nonInteraction:1}))},removeFromCart=(e,a)=>{e&&window.ga&&(ga("ec:addProduct",{id:e.id,name:e.name,price:a}),ga("ec:setAction","remove"),ga("send","event",{eventAction:"Click",eventCategory:"Remove from cart"}))};exports.addToCart=addToCart,exports.pageview=pageview,exports.productClick=productClick,exports.productDetail=productDetail,exports.removeFromCart=removeFromCart;
|
|
@@ -1,17 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// @ts-nocheck
|
|
4
|
-
const addToCart = (product)=>{
|
|
5
|
-
if (!window?.ttq?.track) return;
|
|
6
|
-
window.ttq.track('AddToCart', {
|
|
7
|
-
content_id: product.id,
|
|
8
|
-
content_type: 'product',
|
|
9
|
-
content_name: product.name,
|
|
10
|
-
quantity: product.quantity,
|
|
11
|
-
price: product.price,
|
|
12
|
-
value: (product.price ?? 0) * (product.quantity ?? 0),
|
|
13
|
-
currency: product.currency
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
exports.addToCart = addToCart;
|
|
1
|
+
"use strict";const addToCart=t=>{window?.ttq?.track&&window.ttq.track("AddToCart",{content_id:t.id,content_type:"product",content_name:t.name,quantity:t.quantity,price:t.price,value:(t.price??0)*(t.quantity??0),currency:t.currency})};exports.addToCart=addToCart;
|
|
@@ -1,160 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
${
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
${
|
|
17
|
-
${
|
|
18
|
-
${
|
|
19
|
-
|
|
20
|
-
${lineHeight ? `line-height: ${lineHeight};` : ''}
|
|
21
|
-
`;
|
|
22
|
-
};
|
|
23
|
-
const composeTypographyV2Css = (typography, isImportant)=>{
|
|
24
|
-
const typographyCustom = typography?.custom;
|
|
25
|
-
const { fontFamily, fontSize, fontWeight, lineHeight, letterSpacing } = typographyCustom ?? {};
|
|
26
|
-
const typographyAttrs = typography?.attrs;
|
|
27
|
-
const { bold, italic, underline, transform } = typographyAttrs ?? {};
|
|
28
|
-
const composeImportant = isImportant ? '!important' : '';
|
|
29
|
-
return `
|
|
30
|
-
${fontFamily ? `font-family: ${composeFontFamilyTypographyV2({
|
|
31
|
-
fontFamily,
|
|
32
|
-
type: typography?.type
|
|
33
|
-
})} ${composeImportant}` : ''};
|
|
34
|
-
${fontSize?.desktop ? `font-size: ${fontSize?.desktop} ${composeImportant}` : ''};
|
|
35
|
-
${bold ? `font-weight: bold ${composeImportant}` : fontWeight ? `font-weight: ${fontWeight} ${composeImportant}` : ''};
|
|
36
|
-
${letterSpacing ? `letter-spacing: ${letterSpacing} ${composeImportant}` : ''};
|
|
37
|
-
${lineHeight?.desktop ? `line-height: ${lineHeight?.desktop} ${composeImportant}` : ''};
|
|
38
|
-
${italic ? `font-style: italic ${composeImportant}` : ''};
|
|
39
|
-
${underline ? `text-decoration-line: underline ${composeImportant}` : ''};
|
|
40
|
-
${transform ? `text-transform: ${transform} ${composeImportant}` : ''};
|
|
41
|
-
`;
|
|
42
|
-
};
|
|
43
|
-
function getCustomCSSByDevice(typography, device) {
|
|
44
|
-
if (!typography || !device) return {};
|
|
45
|
-
const suffix = device === 'desktop' || !device ? '' : `-${device}`;
|
|
46
|
-
const { fontFamily } = typography?.[device] ?? {};
|
|
47
|
-
return {
|
|
48
|
-
[`--size${suffix}`]: typography?.[device]?.fontSize,
|
|
49
|
-
[`--lh${suffix}`]: typography?.[device]?.lineHeight,
|
|
50
|
-
[`--fs${suffix}`]: typography?.[device]?.fontStyle,
|
|
51
|
-
[`--ff${suffix}`]: composeFontFamilyTypographyV2({
|
|
52
|
-
fontFamily
|
|
53
|
-
}),
|
|
54
|
-
[`--weight${suffix}`]: typography?.[device]?.fontWeight,
|
|
55
|
-
[`--ls${suffix}`]: typography?.[device]?.letterSpacing
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
const composeTypography = (typography)=>{
|
|
59
|
-
if (!typography) return {};
|
|
60
|
-
return makeStyle.removeNullUndefined({
|
|
61
|
-
...getCustomCSSByDevice(typography, 'desktop'),
|
|
62
|
-
...getCustomCSSByDevice(typography, 'tablet'),
|
|
63
|
-
...getCustomCSSByDevice(typography, 'mobile')
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
const composeTypographyV2 = (value, attrs)=>{
|
|
67
|
-
if (!value) return {};
|
|
68
|
-
return makeStyle.removeNullUndefined({
|
|
69
|
-
...makeStyle.makeStyle({
|
|
70
|
-
fs: !attrs?.italic ? value?.fontStyle : undefined,
|
|
71
|
-
ff: composeFontFamilyTypographyV2(value),
|
|
72
|
-
weight: !attrs?.bold ? value?.fontWeight : undefined,
|
|
73
|
-
ls: value?.letterSpacing
|
|
74
|
-
}),
|
|
75
|
-
...makeStyle.makeStyleResponsive('size', value?.fontSize),
|
|
76
|
-
...makeStyle.makeStyleResponsive('lh', value?.lineHeight)
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
const composeFontFamilyTypographyV2 = (value)=>{
|
|
80
|
-
const { fontFamily, isCustom, fallbackFontFamily, type } = value || {};
|
|
81
|
-
if (!fontFamily) {
|
|
82
|
-
return isCustom ? fallbackFontFamily : undefined;
|
|
83
|
-
}
|
|
84
|
-
if (typeof fontFamily === 'string') {
|
|
85
|
-
return getFontUsedByTypographyV2({
|
|
86
|
-
fontFamily,
|
|
87
|
-
fallbackFontFamily: value?.fallbackFontFamily || composeFallbackTypographyStyle(type ?? 'heading')
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
if (typeof fontFamily === 'object' && typeof fontFamily?.value === 'string') {
|
|
91
|
-
switch(fontFamily.type){
|
|
92
|
-
case 'theme':
|
|
93
|
-
return `var(${fontFamily?.value}), var(--g-font-body)`;
|
|
94
|
-
default:
|
|
95
|
-
return getFontUsedByTypographyV2({
|
|
96
|
-
fontFamily: fontFamily.value,
|
|
97
|
-
fallbackFontFamily: value?.fallbackFontFamily || composeFallbackTypographyStyle(type ?? 'heading')
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return;
|
|
102
|
-
};
|
|
103
|
-
const getFontUsedByTypographyV2 = ({ fontFamily, fallbackFontFamily })=>{
|
|
104
|
-
if (fontFamily) {
|
|
105
|
-
return `var(--g-font-${fontFamily?.replace(/ /g, '-')}, '${fontFamily}'), ${fallbackFontFamily}`;
|
|
106
|
-
}
|
|
107
|
-
return;
|
|
108
|
-
};
|
|
109
|
-
const composeTypographyAttr = (attrs)=>{
|
|
110
|
-
if (!attrs) return {};
|
|
111
|
-
return makeStyle.removeNullUndefined({
|
|
112
|
-
...makeStyle.makeStyle({
|
|
113
|
-
fs: attrs?.italic ? 'italic' : undefined,
|
|
114
|
-
weight: attrs?.bold ? 'bold' : undefined,
|
|
115
|
-
c: colors.getSingleColorVariable(attrs?.color),
|
|
116
|
-
tt: attrs?.transform,
|
|
117
|
-
tdl: attrs?.underline ? 'underline' : undefined
|
|
118
|
-
})
|
|
119
|
-
});
|
|
120
|
-
};
|
|
121
|
-
const composeTypographyClassName = (typo, typography)=>{
|
|
122
|
-
return typo ? typo?.type && !isCustomTypo(typo.custom) ? genTypoClass(typo.type) : '' : typography?.type && genTypoClass(typography?.type);
|
|
123
|
-
};
|
|
124
|
-
const composeFallbackTypographyStyle = (tag)=>{
|
|
125
|
-
if (tag.toLocaleLowerCase().includes('heading')) {
|
|
126
|
-
return 'var(--g-font-heading, heading)';
|
|
127
|
-
}
|
|
128
|
-
return 'var(--g-font-body, body)';
|
|
129
|
-
};
|
|
130
|
-
const composeTypographyStyle = (typo, typography, disableAttr)=>{
|
|
131
|
-
if (typo) {
|
|
132
|
-
const fallbackFontFamily = composeFallbackTypographyStyle(typo.type ?? 'heading');
|
|
133
|
-
const customTypo = {
|
|
134
|
-
...typo.custom,
|
|
135
|
-
fallbackFontFamily: fallbackFontFamily,
|
|
136
|
-
isCustom: isCustomTypo(typo.custom)
|
|
137
|
-
};
|
|
138
|
-
return {
|
|
139
|
-
...composeTypographyV2(customTypo, typo.attrs),
|
|
140
|
-
...!disableAttr && composeTypographyAttr(typo.attrs)
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
return {
|
|
144
|
-
...!typography?.type ? composeTypography(typography?.custom) : {}
|
|
145
|
-
};
|
|
146
|
-
};
|
|
147
|
-
const isCustomTypo = (customTypo)=>{
|
|
148
|
-
return customTypo && Object.keys(customTypo).length > 1 || customTypo && Object.keys(customTypo).length === 1 && !customTypo.fontSize;
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
exports.composeFallbackTypographyStyle = composeFallbackTypographyStyle;
|
|
152
|
-
exports.composeFontFamilyTypographyV2 = composeFontFamilyTypographyV2;
|
|
153
|
-
exports.composeTypography = composeTypography;
|
|
154
|
-
exports.composeTypographyAttr = composeTypographyAttr;
|
|
155
|
-
exports.composeTypographyClassName = composeTypographyClassName;
|
|
156
|
-
exports.composeTypographyCss = composeTypographyCss;
|
|
157
|
-
exports.composeTypographyStyle = composeTypographyStyle;
|
|
158
|
-
exports.composeTypographyV2 = composeTypographyV2;
|
|
159
|
-
exports.composeTypographyV2Css = composeTypographyV2Css;
|
|
160
|
-
exports.genTypoClass = genTypoClass;
|
|
1
|
+
"use strict";var colors=require("./colors.js"),makeStyle=require("./make-style.js");const genTypoClass=o=>`gp-g-${o}`,composeTypographyCss=o=>{let e=o?.custom,{fontFamily:t,fontSize:p,fontStyle:s,fontWeight:a,lineHeight:y,letterSpacing:l}=e?.desktop??{};return`
|
|
2
|
+
${t?`fontFamily: ${composeFontFamilyTypographyV2({fontFamily:t})};`:""}
|
|
3
|
+
${p?`font-size: ${p};`:""}
|
|
4
|
+
${s?`font-style: ${s};`:""}
|
|
5
|
+
${a?`font-weight: ${a};`:""}
|
|
6
|
+
${l?`letter-spacing: ${l};`:""}
|
|
7
|
+
${y?`line-height: ${y};`:""}
|
|
8
|
+
`},composeTypographyV2Css=(o,e)=>{let t=o?.custom,{fontFamily:p,fontSize:s,fontWeight:a,lineHeight:y,letterSpacing:l,textShadow:r}=t??{},n=o?.attrs,{bold:i,italic:m,underline:c,transform:g,color:h}=n??{},$=e?"!important":"";return`
|
|
9
|
+
${p?`font-family: ${composeFontFamilyTypographyV2({fontFamily:p,type:o?.type})} ${$}`:""};
|
|
10
|
+
${s?.desktop?`font-size: ${s?.desktop} ${$}`:""};
|
|
11
|
+
${h?`color: ${colors.getSingleColorVariable(h)} ${$}`:""};
|
|
12
|
+
${i?`font-weight: bold ${$}`:a?`font-weight: ${a} ${$}`:""};
|
|
13
|
+
${l?`letter-spacing: ${l} ${$}`:""};
|
|
14
|
+
${y?.desktop?`line-height: ${y?.desktop} ${$}`:""};
|
|
15
|
+
${m?`font-style: italic ${$}`:""};
|
|
16
|
+
${c?`text-decoration-line: underline ${$}`:""};
|
|
17
|
+
${g?`text-transform: ${g} ${$}`:""};
|
|
18
|
+
${r&&"none"!==r.type?`text-shadow: ${composeTextShadowCss(r)}`:"none"};
|
|
19
|
+
`},composeTextShadowCss=o=>{let e="number"==typeof o?.angle?o?.angle:0,t=e*Math.PI/180,p=parseFloat(o?.distance??"0");if(isNaN(p))return"none";let s=Math.round(Math.cos(t)*p*100)/100,a=Math.round(Math.sin(t)*p*100)/100;return`${s}px ${a}px ${o?.blur??"0"} ${o.color}`},composeTextHoverColorCss=(o,e)=>{if(o){let t=e?"!important":"",p=colors.getSingleColorVariable(o.hover);return`${p?`color: ${p} ${t}`:""}`}};function getCustomCSSByDevice(o,e){if(!o||!e)return{};let t="desktop"!==e&&e?`-${e}`:"",{fontFamily:p}=o?.[e]??{};return{[`--size${t}`]:o?.[e]?.fontSize,[`--lh${t}`]:o?.[e]?.lineHeight,[`--fs${t}`]:o?.[e]?.fontStyle,[`--ff${t}`]:composeFontFamilyTypographyV2({fontFamily:p}),[`--weight${t}`]:o?.[e]?.fontWeight,[`--ls${t}`]:o?.[e]?.letterSpacing}}const composeTypography=o=>o?makeStyle.removeNullUndefined({...getCustomCSSByDevice(o,"desktop"),...getCustomCSSByDevice(o,"tablet"),...getCustomCSSByDevice(o,"mobile")}):{},composeTypographyV2=(o,e)=>o?makeStyle.removeNullUndefined({...makeStyle.makeStyle({fs:e?.italic?void 0:o?.fontStyle,ff:composeFontFamilyTypographyV2(o),weight:e?.bold?void 0:o?.fontWeight,ls:o?.letterSpacing}),...makeStyle.makeStyleResponsive("size",o?.fontSize),...makeStyle.makeStyleResponsive("lh",o?.lineHeight)}):{},composeFontFamilyTypographyV2=o=>{let{fontFamily:e,isCustom:t,fallbackFontFamily:p,type:s}=o||{};return e?"string"==typeof e?getFontUsedByTypographyV2({fontFamily:e,fallbackFontFamily:o?.fallbackFontFamily||composeFallbackTypographyStyle(s??"heading")}):"object"==typeof e&&"string"==typeof e?.value?"theme"===e.type?`var(${e?.value}), var(--g-font-body)`:getFontUsedByTypographyV2({fontFamily:e.value,fallbackFontFamily:o?.fallbackFontFamily||composeFallbackTypographyStyle(s??"heading")}):void 0:t?p:void 0},getFontUsedByTypographyV2=({fontFamily:o,fallbackFontFamily:e})=>{if(o)return`var(--g-font-${o?.replace(/ /g,"-")}, '${o}'), ${e}`},composeTypographyAttr=o=>o?makeStyle.removeNullUndefined({...makeStyle.makeStyle({fs:o?.italic?"italic":void 0,weight:o?.bold?"bold":void 0,c:colors.getSingleColorVariable(o?.color),tt:o?.transform,tdl:o?.underline?"underline":void 0})}):{},composeTypographyClassName=(o,e)=>o?o?.type&&!isCustomTypo(o.custom)?genTypoClass(o.type):"":e?.type&&genTypoClass(e?.type),composeFallbackTypographyStyle=o=>o.toLocaleLowerCase().includes("heading")?"var(--g-font-heading, heading)":"var(--g-font-body, body)",composeTypographyStyle=(o,e,t)=>{if(o){let e=composeFallbackTypographyStyle(o.type??"heading"),p={...o.custom,fallbackFontFamily:e,isCustom:isCustomTypo(o.custom)};return{...composeTypographyV2(p,o.attrs),...!t&&composeTypographyAttr(o.attrs)}}return{...e?.type?{}:composeTypography(e?.custom)}},isCustomTypo=o=>o&&Object.keys(o).length>1||o&&1===Object.keys(o).length&&!o.fontSize;exports.composeFallbackTypographyStyle=composeFallbackTypographyStyle,exports.composeFontFamilyTypographyV2=composeFontFamilyTypographyV2,exports.composeTextHoverColorCss=composeTextHoverColorCss,exports.composeTypography=composeTypography,exports.composeTypographyAttr=composeTypographyAttr,exports.composeTypographyClassName=composeTypographyClassName,exports.composeTypographyCss=composeTypographyCss,exports.composeTypographyStyle=composeTypographyStyle,exports.composeTypographyV2=composeTypographyV2,exports.composeTypographyV2Css=composeTypographyV2Css,exports.genTypoClass=genTypoClass;
|