@gem-sdk/core 2.0.0-dev.896 → 2.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.
Files changed (396) hide show
  1. package/dist/cjs/components/AddOn.js +18 -1
  2. package/dist/cjs/components/ComponentAnimation.js +17 -0
  3. package/dist/cjs/components/ComponentToolbarPreview.js +752 -1
  4. package/dist/cjs/components/ComponentWrapper.js +61 -1
  5. package/dist/cjs/components/ComponentWrapperPreview.js +213 -1
  6. package/dist/cjs/components/Empty.js +7 -1
  7. package/dist/cjs/components/InteractionSuffix.js +42 -0
  8. package/dist/cjs/components/Render.js +75 -1
  9. package/dist/cjs/components/Render.liquid.js +313 -17
  10. package/dist/cjs/components/RenderBlock.js +54 -1
  11. package/dist/cjs/components/RenderCustomCode.js +59 -3
  12. package/dist/cjs/components/RenderPreview.js +67 -1
  13. package/dist/cjs/components/RenderSection.js +23 -1
  14. package/dist/cjs/components/ai-generator/AIContentGenerator.js +252 -1
  15. package/dist/cjs/components/ai-generator/AIGenContentLoading.js +85 -1
  16. package/dist/cjs/components/ai-generator/components/PickProduct.js +220 -1
  17. package/dist/cjs/components/ai-generator/components/ToneAndVoice.js +77 -1
  18. package/dist/cjs/components/ai-generator/hooks/useCheckingProductInside.js +47 -0
  19. package/dist/cjs/components/ai-generator/hooks/useFlipPopup.js +110 -0
  20. package/dist/cjs/components/ai-generator/hooks/useGettingGenerateRequest.js +37 -1
  21. package/dist/cjs/components/ai-generator/hooks/useListenEventGenerate.js +70 -1
  22. package/dist/cjs/components/ai-generator/icons/AIIcon.js +67 -1
  23. package/dist/cjs/components/ai-generator/icons/CloseIcon.js +19 -1
  24. package/dist/cjs/components/ai-generator/icons/DropdownIcon.js +37 -1
  25. package/dist/cjs/components/ai-generator/icons/SearchIcon.js +21 -1
  26. package/dist/cjs/components/ai-generator/icons/ShowMoreIcon.js +21 -1
  27. package/dist/cjs/components/ai-generator/icons/UpgradeIcon.js +27 -0
  28. package/dist/cjs/components/ai-generator/icons/WarningIcon.js +31 -0
  29. package/dist/cjs/components/constant.js +83 -1
  30. package/dist/cjs/components/resize/Resize.js +16 -1
  31. package/dist/cjs/components/resize/Spacing.js +260 -1
  32. package/dist/cjs/components/src/product/helpers/variant-presets.js +56 -1
  33. package/dist/cjs/components/theme-section/CreateThemeSection.js +123 -1
  34. package/dist/cjs/components/theme-section/ThemeSectionStatus.js +45 -1
  35. package/dist/cjs/components/theme-section/ThemeSectionTooltip.js +126 -1
  36. package/dist/cjs/components/toolbar/Tooltip.js +28 -1
  37. package/dist/cjs/contexts/AddonContext.js +36 -1
  38. package/dist/cjs/contexts/ArticleContext.js +39 -1
  39. package/dist/cjs/contexts/ArticleListContext.js +31 -1
  40. package/dist/cjs/contexts/BuilderComponent.js +34 -1
  41. package/dist/cjs/contexts/BuilderContext.js +39 -1
  42. package/dist/cjs/contexts/BuilderPreviewContext.js +486 -1
  43. package/dist/cjs/contexts/CartLineContext.js +29 -1
  44. package/dist/cjs/contexts/CollectionContext.js +38 -1
  45. package/dist/cjs/contexts/ModalContext.js +47 -1
  46. package/dist/cjs/contexts/PageContext.js +104 -1
  47. package/dist/cjs/contexts/ProductContext.js +177 -1
  48. package/dist/cjs/contexts/ProductListContext.js +32 -1
  49. package/dist/cjs/contexts/SectionContext.js +53 -1
  50. package/dist/cjs/contexts/ShopContext.js +107 -1
  51. package/dist/cjs/graphql/fragments/analytic.generated.js +6 -2
  52. package/dist/cjs/graphql/fragments/collection-detail.generated.js +6 -2
  53. package/dist/cjs/graphql/fragments/collection-product.generated.js +6 -2
  54. package/dist/cjs/graphql/fragments/collection.generated.js +6 -2
  55. package/dist/cjs/graphql/fragments/custom-code.generated.js +6 -2
  56. package/dist/cjs/graphql/fragments/custom-font.generated.js +6 -2
  57. package/dist/cjs/graphql/fragments/data-seo.generated.js +6 -2
  58. package/dist/cjs/graphql/fragments/media.generated.js +6 -2
  59. package/dist/cjs/graphql/fragments/preview-theme-page.generated.js +39 -0
  60. package/dist/cjs/graphql/fragments/product-little.generated.js +7 -2
  61. package/dist/cjs/graphql/fragments/product-option-value.generated.js +6 -2
  62. package/dist/cjs/graphql/fragments/product-option.generated.js +6 -2
  63. package/dist/cjs/graphql/fragments/product.generated.js +6 -2
  64. package/dist/cjs/graphql/fragments/published-custom-section.generated.js +6 -2
  65. package/dist/cjs/graphql/fragments/published-page-section.generated.js +6 -2
  66. package/dist/cjs/graphql/fragments/published-theme-page.generated.js +10 -28
  67. package/dist/cjs/graphql/fragments/published-theme-style.generated.js +6 -2
  68. package/dist/cjs/graphql/fragments/selected-option.generated.js +6 -2
  69. package/dist/cjs/graphql/fragments/variant.generated.js +6 -2
  70. package/dist/cjs/graphql/mutations/page-view-up.generated.js +8 -4
  71. package/dist/cjs/graphql/queries/articles.generated.js +61 -0
  72. package/dist/cjs/graphql/queries/blogs.generated.js +69 -0
  73. package/dist/cjs/graphql/queries/collection-detail-filter.generated.js +16 -2
  74. package/dist/cjs/graphql/queries/collection.generated.js +14 -2
  75. package/dist/cjs/graphql/queries/collections.generated.js +9 -2
  76. package/dist/cjs/graphql/queries/preview-page.generated.js +16 -8
  77. package/dist/cjs/graphql/queries/product-little-detail.generated.js +11 -2
  78. package/dist/cjs/graphql/queries/product-medias.generated.js +8 -2
  79. package/dist/cjs/graphql/queries/product-value-label.generated.js +6 -2
  80. package/dist/cjs/graphql/queries/product-variants.generated.js +10 -2
  81. package/dist/cjs/graphql/queries/products.generated.js +17 -3
  82. package/dist/cjs/graphql/queries/published-shop-metas.js +15 -0
  83. package/dist/cjs/graphql/queries/published-theme-pages.generated.js +15 -2
  84. package/dist/cjs/graphql/queries/store-property.generated.js +6 -2
  85. package/dist/cjs/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +6 -2
  86. package/dist/cjs/graphql-app-api/queries/LibraryTemplate.generated.js +6 -2
  87. package/dist/cjs/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +6 -2
  88. package/dist/cjs/graphql-app-api/queries/ShopLibraryPage.generated.js +17 -0
  89. package/dist/cjs/graphql-app-api/queries/ThemePage.generated.js +6 -2
  90. package/dist/cjs/helpers/GlobalEvent.js +19 -1
  91. package/dist/cjs/helpers/align.js +19 -0
  92. package/dist/cjs/helpers/animations.js +222 -1
  93. package/dist/cjs/helpers/background.js +235 -1
  94. package/dist/cjs/helpers/borders.js +198 -4
  95. package/dist/cjs/helpers/carousel.js +55 -1
  96. package/dist/cjs/helpers/clone-deep.js +5 -1
  97. package/dist/cjs/helpers/cls.js +16 -1
  98. package/dist/cjs/helpers/colors.js +184 -1
  99. package/dist/cjs/helpers/compose-advance-style.js +327 -1
  100. package/dist/cjs/helpers/constant.js +23 -1
  101. package/dist/cjs/helpers/convert.js +7 -1
  102. package/dist/cjs/helpers/covert-entities-html.js +19 -1
  103. package/dist/cjs/helpers/css-variable.js +7 -1
  104. package/dist/cjs/helpers/email.js +11 -1
  105. package/dist/cjs/helpers/filter-toolbar-preview.js +14 -1
  106. package/dist/cjs/helpers/flatten-connection.js +9 -1
  107. package/dist/cjs/helpers/get-resonsive-value.js +36 -1
  108. package/dist/cjs/helpers/get-shortname.js +92 -1
  109. package/dist/cjs/helpers/icon-list.js +61 -1
  110. package/dist/cjs/helpers/interaction/index.js +134 -0
  111. package/dist/cjs/helpers/is-browser.js +9 -1
  112. package/dist/cjs/helpers/is-defined.js +7 -1
  113. package/dist/cjs/helpers/is-empty-children.js +15 -1
  114. package/dist/cjs/helpers/is-safari.js +9 -1
  115. package/dist/cjs/helpers/layout.js +59 -1
  116. package/dist/cjs/helpers/load-script.js +31 -1
  117. package/dist/cjs/helpers/loop-component.js +16 -0
  118. package/dist/cjs/helpers/make-style.js +163 -1
  119. package/dist/cjs/helpers/normalize-builder-data.js +23 -1
  120. package/dist/cjs/helpers/pascal-to-kebab-case.js +7 -0
  121. package/dist/cjs/helpers/prefetch-queries.js +78 -1
  122. package/dist/cjs/helpers/product.js +48 -1
  123. package/dist/cjs/helpers/queries/get-collection.js +226 -1
  124. package/dist/cjs/helpers/queries/get-collections.js +21 -1
  125. package/dist/cjs/helpers/queries/get-product-by-slug.js +125 -1
  126. package/dist/cjs/helpers/queries/get-product.js +154 -1
  127. package/dist/cjs/helpers/queries/get-products.js +214 -1
  128. package/dist/cjs/helpers/query.js +29 -1
  129. package/dist/cjs/helpers/radius.js +140 -6
  130. package/dist/cjs/helpers/render.js +78 -1
  131. package/dist/cjs/helpers/shadow.js +69 -1
  132. package/dist/cjs/helpers/size.js +206 -4
  133. package/dist/cjs/helpers/spacing.js +43 -1
  134. package/dist/cjs/helpers/third-party/addAppBlockId.js +20 -0
  135. package/dist/cjs/helpers/third-party/appConfig.js +234 -0
  136. package/dist/cjs/helpers/third-party/appSetting.js +661 -0
  137. package/dist/cjs/helpers/third-party/composeAppBlockId.js +11 -0
  138. package/dist/cjs/helpers/third-party/constant.js +43 -0
  139. package/dist/cjs/helpers/third-party/generateAppBlockConfigs.js +34 -0
  140. package/dist/cjs/helpers/third-party/getAppBlockConfig.js +47 -0
  141. package/dist/cjs/helpers/third-party/getAppBlockType.js +12 -0
  142. package/dist/cjs/helpers/third-party/getAppBlocks.js +30 -0
  143. package/dist/cjs/helpers/third-party/mergeBlock.js +19 -0
  144. package/dist/cjs/helpers/third-party/mergeBlockOrder.js +47 -0
  145. package/dist/cjs/helpers/third-party/removeGPAppItems.js +18 -0
  146. package/dist/cjs/helpers/tracking/fpixel.js +28 -1
  147. package/dist/cjs/helpers/tracking/gtag.js +93 -1
  148. package/dist/cjs/helpers/tracking/tiktokpixel.js +17 -1
  149. package/dist/cjs/helpers/typography.js +160 -17
  150. package/dist/cjs/helpers/variant.js +11 -1
  151. package/dist/cjs/hooks/animation/useAnimationActions.js +39 -1
  152. package/dist/cjs/hooks/animation/useAnimationConfig.js +30 -1
  153. package/dist/cjs/hooks/animation/useAnimationPreview.js +31 -1
  154. package/dist/cjs/hooks/animation/useAnimationTarget.js +122 -1
  155. package/dist/cjs/hooks/animation/useApplyAnimation.js +89 -1
  156. package/dist/cjs/hooks/articles/useArticlesQuery.js +33 -1
  157. package/dist/cjs/hooks/cart/use-add-to-cart.js +20 -1
  158. package/dist/cjs/hooks/cart/use-cart-data.js +28 -1
  159. package/dist/cjs/hooks/cart/use-cart-discount-codes-update.js +20 -1
  160. package/dist/cjs/hooks/cart/use-cart-note-update.js +20 -1
  161. package/dist/cjs/hooks/cart/use-create-cart.js +22 -1
  162. package/dist/cjs/hooks/cart/use-remove-cart-item.js +20 -1
  163. package/dist/cjs/hooks/cart/use-update-cart-item.js +20 -1
  164. package/dist/cjs/hooks/shop/use-collection-query.js +22 -1
  165. package/dist/cjs/hooks/shop/use-collections-query.js +17 -1
  166. package/dist/cjs/hooks/shop/use-product-query.js +22 -1
  167. package/dist/cjs/hooks/shop/use-products-query.js +63 -1
  168. package/dist/cjs/hooks/shop.js +126 -1
  169. package/dist/cjs/hooks/use-current-device.js +30 -1
  170. package/dist/cjs/hooks/use-lazy-video.js +15 -1
  171. package/dist/cjs/hooks/useAnimations.js +29 -1
  172. package/dist/cjs/hooks/useCartId.js +44 -1
  173. package/dist/cjs/hooks/useCartLine.js +11 -1
  174. package/dist/cjs/hooks/useCartUI.js +48 -1
  175. package/dist/cjs/hooks/useCollection.js +9 -1
  176. package/dist/cjs/hooks/useFetchHandle.js +13 -1
  177. package/dist/cjs/hooks/useFormatMoney.js +75 -1
  178. package/dist/cjs/hooks/useInitialSwatchesOptions.js +128 -1
  179. package/dist/cjs/hooks/useInteraction.js +19 -0
  180. package/dist/cjs/hooks/useIsomorphicLayoutEffect.js +10 -1
  181. package/dist/cjs/hooks/useLoadScript.js +32 -1
  182. package/dist/cjs/hooks/useMoney.js +84 -1
  183. package/dist/cjs/hooks/usePrevious.js +19 -1
  184. package/dist/cjs/hooks/useProduct.js +245 -1
  185. package/dist/cjs/hooks/useProductList.js +21 -1
  186. package/dist/cjs/hooks/useSuspenseFetch.js +27 -1
  187. package/dist/cjs/hooks/useSwatchesOptions.js +41 -1
  188. package/dist/cjs/hooks/useToolbarPostPurchase.js +89 -1
  189. package/dist/cjs/index.js +416 -1
  190. package/dist/cjs/types/animations.js +49 -1
  191. package/dist/cjs/types/appAPI.js +2 -1
  192. package/dist/cjs/types/custom.js +52 -0
  193. package/dist/cjs/types/global-style.js +15 -1
  194. package/dist/cjs/types/shop.js +2 -1
  195. package/dist/cjs/web-components/src/helpers/styles/constant.js +9 -1
  196. package/dist/esm/components/AddOn.js +14 -1
  197. package/dist/esm/components/ComponentAnimation.js +13 -0
  198. package/dist/esm/components/ComponentToolbarPreview.js +748 -1
  199. package/dist/esm/components/ComponentWrapper.js +57 -1
  200. package/dist/esm/components/ComponentWrapperPreview.js +209 -1
  201. package/dist/esm/components/Empty.js +3 -1
  202. package/dist/esm/components/InteractionSuffix.js +40 -0
  203. package/dist/esm/components/Render.js +71 -1
  204. package/dist/esm/components/Render.liquid.js +307 -17
  205. package/dist/esm/components/RenderBlock.js +50 -1
  206. package/dist/esm/components/RenderCustomCode.js +55 -3
  207. package/dist/esm/components/RenderPreview.js +63 -1
  208. package/dist/esm/components/RenderSection.js +19 -1
  209. package/dist/esm/components/ai-generator/AIContentGenerator.js +250 -1
  210. package/dist/esm/components/ai-generator/AIGenContentLoading.js +83 -1
  211. package/dist/esm/components/ai-generator/components/PickProduct.js +218 -1
  212. package/dist/esm/components/ai-generator/components/ToneAndVoice.js +75 -1
  213. package/dist/esm/components/ai-generator/hooks/useCheckingProductInside.js +45 -0
  214. package/dist/esm/components/ai-generator/hooks/useFlipPopup.js +108 -0
  215. package/dist/esm/components/ai-generator/hooks/useGettingGenerateRequest.js +35 -1
  216. package/dist/esm/components/ai-generator/hooks/useListenEventGenerate.js +68 -1
  217. package/dist/esm/components/ai-generator/icons/AIIcon.js +65 -1
  218. package/dist/esm/components/ai-generator/icons/CloseIcon.js +17 -1
  219. package/dist/esm/components/ai-generator/icons/DropdownIcon.js +34 -1
  220. package/dist/esm/components/ai-generator/icons/SearchIcon.js +19 -1
  221. package/dist/esm/components/ai-generator/icons/ShowMoreIcon.js +19 -1
  222. package/dist/esm/components/ai-generator/icons/UpgradeIcon.js +25 -0
  223. package/dist/esm/components/ai-generator/icons/WarningIcon.js +29 -0
  224. package/dist/esm/components/constant.js +76 -1
  225. package/dist/esm/components/resize/Resize.js +12 -1
  226. package/dist/esm/components/resize/Spacing.js +256 -1
  227. package/dist/esm/components/src/product/helpers/variant-presets.js +54 -1
  228. package/dist/esm/components/theme-section/CreateThemeSection.js +121 -1
  229. package/dist/esm/components/theme-section/ThemeSectionStatus.js +43 -1
  230. package/dist/esm/components/theme-section/ThemeSectionTooltip.js +124 -1
  231. package/dist/esm/components/toolbar/Tooltip.js +24 -1
  232. package/dist/esm/contexts/AddonContext.js +32 -1
  233. package/dist/esm/contexts/ArticleContext.js +36 -1
  234. package/dist/esm/contexts/ArticleListContext.js +27 -1
  235. package/dist/esm/contexts/BuilderComponent.js +31 -1
  236. package/dist/esm/contexts/BuilderContext.js +36 -1
  237. package/dist/esm/contexts/BuilderPreviewContext.js +483 -1
  238. package/dist/esm/contexts/CartLineContext.js +26 -1
  239. package/dist/esm/contexts/CollectionContext.js +35 -1
  240. package/dist/esm/contexts/ModalContext.js +44 -1
  241. package/dist/esm/contexts/PageContext.js +101 -1
  242. package/dist/esm/contexts/ProductContext.js +174 -1
  243. package/dist/esm/contexts/ProductListContext.js +28 -1
  244. package/dist/esm/contexts/SectionContext.js +49 -1
  245. package/dist/esm/contexts/ShopContext.js +104 -1
  246. package/dist/esm/graphql/fragments/analytic.generated.js +4 -2
  247. package/dist/esm/graphql/fragments/collection-detail.generated.js +4 -2
  248. package/dist/esm/graphql/fragments/collection-product.generated.js +4 -2
  249. package/dist/esm/graphql/fragments/collection.generated.js +4 -2
  250. package/dist/esm/graphql/fragments/custom-code.generated.js +4 -2
  251. package/dist/esm/graphql/fragments/custom-font.generated.js +4 -2
  252. package/dist/esm/graphql/fragments/data-seo.generated.js +4 -2
  253. package/dist/esm/graphql/fragments/media.generated.js +4 -2
  254. package/dist/esm/graphql/fragments/preview-theme-page.generated.js +37 -0
  255. package/dist/esm/graphql/fragments/product-little.generated.js +5 -2
  256. package/dist/esm/graphql/fragments/product-option-value.generated.js +4 -2
  257. package/dist/esm/graphql/fragments/product-option.generated.js +4 -2
  258. package/dist/esm/graphql/fragments/product.generated.js +4 -2
  259. package/dist/esm/graphql/fragments/published-custom-section.generated.js +4 -2
  260. package/dist/esm/graphql/fragments/published-page-section.generated.js +4 -2
  261. package/dist/esm/graphql/fragments/published-theme-page.generated.js +8 -28
  262. package/dist/esm/graphql/fragments/published-theme-style.generated.js +4 -2
  263. package/dist/esm/graphql/fragments/selected-option.generated.js +4 -2
  264. package/dist/esm/graphql/fragments/variant.generated.js +4 -2
  265. package/dist/esm/graphql/mutations/page-view-up.generated.js +6 -4
  266. package/dist/esm/graphql/queries/articles.generated.js +59 -0
  267. package/dist/esm/graphql/queries/blogs.generated.js +67 -0
  268. package/dist/esm/graphql/queries/collection-detail-filter.generated.js +22 -10
  269. package/dist/esm/graphql/queries/collection.generated.js +18 -8
  270. package/dist/esm/graphql/queries/collections.generated.js +8 -3
  271. package/dist/esm/graphql/queries/preview-page.generated.js +16 -10
  272. package/dist/esm/graphql/queries/product-little-detail.generated.js +12 -5
  273. package/dist/esm/graphql/queries/product-medias.generated.js +6 -2
  274. package/dist/esm/graphql/queries/product-value-label.generated.js +4 -2
  275. package/dist/esm/graphql/queries/product-variants.generated.js +10 -4
  276. package/dist/esm/graphql/queries/products.generated.js +20 -9
  277. package/dist/esm/graphql/queries/published-shop-metas.js +13 -0
  278. package/dist/esm/graphql/queries/published-theme-pages.generated.js +20 -9
  279. package/dist/esm/graphql/queries/store-property.generated.js +4 -2
  280. package/dist/esm/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +4 -2
  281. package/dist/esm/graphql-app-api/queries/LibraryTemplate.generated.js +4 -2
  282. package/dist/esm/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +4 -2
  283. package/dist/esm/graphql-app-api/queries/ShopLibraryPage.generated.js +15 -0
  284. package/dist/esm/graphql-app-api/queries/ThemePage.generated.js +4 -2
  285. package/dist/esm/helpers/GlobalEvent.js +15 -1
  286. package/dist/esm/helpers/align.js +17 -0
  287. package/dist/esm/helpers/animations.js +220 -1
  288. package/dist/esm/helpers/background.js +226 -1
  289. package/dist/esm/helpers/borders.js +189 -4
  290. package/dist/esm/helpers/carousel.js +51 -1
  291. package/dist/esm/helpers/clone-deep.js +3 -1
  292. package/dist/esm/helpers/cls.js +14 -1
  293. package/dist/esm/helpers/colors.js +169 -1
  294. package/dist/esm/helpers/compose-advance-style.js +319 -1
  295. package/dist/esm/helpers/constant.js +19 -1
  296. package/dist/esm/helpers/convert.js +4 -1
  297. package/dist/esm/helpers/covert-entities-html.js +17 -1
  298. package/dist/esm/helpers/css-variable.js +5 -1
  299. package/dist/esm/helpers/email.js +6 -1
  300. package/dist/esm/helpers/filter-toolbar-preview.js +9 -1
  301. package/dist/esm/helpers/flatten-connection.js +7 -1
  302. package/dist/esm/helpers/get-resonsive-value.js +31 -1
  303. package/dist/esm/helpers/get-shortname.js +90 -1
  304. package/dist/esm/helpers/icon-list.js +58 -1
  305. package/dist/esm/helpers/interaction/index.js +132 -0
  306. package/dist/esm/helpers/is-browser.js +5 -1
  307. package/dist/esm/helpers/is-defined.js +5 -1
  308. package/dist/esm/helpers/is-empty-children.js +10 -1
  309. package/dist/esm/helpers/is-safari.js +5 -1
  310. package/dist/esm/helpers/layout.js +54 -1
  311. package/dist/esm/helpers/load-script.js +29 -1
  312. package/dist/esm/helpers/loop-component.js +14 -0
  313. package/dist/esm/helpers/make-style.js +149 -1
  314. package/dist/esm/helpers/normalize-builder-data.js +21 -1
  315. package/dist/esm/helpers/pascal-to-kebab-case.js +5 -0
  316. package/dist/esm/helpers/prefetch-queries.js +76 -1
  317. package/dist/esm/helpers/product.js +44 -1
  318. package/dist/esm/helpers/queries/get-collection.js +223 -1
  319. package/dist/esm/helpers/queries/get-collections.js +19 -1
  320. package/dist/esm/helpers/queries/get-product-by-slug.js +123 -1
  321. package/dist/esm/helpers/queries/get-product.js +150 -1
  322. package/dist/esm/helpers/queries/get-products.js +210 -1
  323. package/dist/esm/helpers/query.js +25 -1
  324. package/dist/esm/helpers/radius.js +132 -6
  325. package/dist/esm/helpers/render.js +70 -1
  326. package/dist/esm/helpers/shadow.js +63 -1
  327. package/dist/esm/helpers/size.js +192 -4
  328. package/dist/esm/helpers/spacing.js +40 -1
  329. package/dist/esm/helpers/third-party/addAppBlockId.js +18 -0
  330. package/dist/esm/helpers/third-party/appConfig.js +200 -0
  331. package/dist/esm/helpers/third-party/appSetting.js +658 -0
  332. package/dist/esm/helpers/third-party/composeAppBlockId.js +9 -0
  333. package/dist/esm/helpers/third-party/constant.js +40 -0
  334. package/dist/esm/helpers/third-party/generateAppBlockConfigs.js +32 -0
  335. package/dist/esm/helpers/third-party/getAppBlockConfig.js +45 -0
  336. package/dist/esm/helpers/third-party/getAppBlockType.js +10 -0
  337. package/dist/esm/helpers/third-party/getAppBlocks.js +28 -0
  338. package/dist/esm/helpers/third-party/mergeBlock.js +17 -0
  339. package/dist/esm/helpers/third-party/mergeBlockOrder.js +45 -0
  340. package/dist/esm/helpers/third-party/removeGPAppItems.js +15 -0
  341. package/dist/esm/helpers/tracking/fpixel.js +24 -1
  342. package/dist/esm/helpers/tracking/gtag.js +87 -1
  343. package/dist/esm/helpers/tracking/tiktokpixel.js +15 -1
  344. package/dist/esm/helpers/typography.js +149 -17
  345. package/dist/esm/helpers/variant.js +9 -1
  346. package/dist/esm/hooks/animation/useAnimationActions.js +37 -1
  347. package/dist/esm/hooks/animation/useAnimationConfig.js +28 -1
  348. package/dist/esm/hooks/animation/useAnimationPreview.js +29 -1
  349. package/dist/esm/hooks/animation/useAnimationTarget.js +120 -1
  350. package/dist/esm/hooks/animation/useApplyAnimation.js +85 -1
  351. package/dist/esm/hooks/articles/useArticlesQuery.js +30 -1
  352. package/dist/esm/hooks/cart/use-add-to-cart.js +18 -1
  353. package/dist/esm/hooks/cart/use-cart-data.js +26 -1
  354. package/dist/esm/hooks/cart/use-cart-discount-codes-update.js +18 -1
  355. package/dist/esm/hooks/cart/use-cart-note-update.js +18 -1
  356. package/dist/esm/hooks/cart/use-create-cart.js +20 -1
  357. package/dist/esm/hooks/cart/use-remove-cart-item.js +18 -1
  358. package/dist/esm/hooks/cart/use-update-cart-item.js +18 -1
  359. package/dist/esm/hooks/shop/use-collection-query.js +20 -1
  360. package/dist/esm/hooks/shop/use-collections-query.js +15 -1
  361. package/dist/esm/hooks/shop/use-product-query.js +20 -1
  362. package/dist/esm/hooks/shop/use-products-query.js +59 -1
  363. package/dist/esm/hooks/shop.js +111 -1
  364. package/dist/esm/hooks/use-current-device.js +28 -1
  365. package/dist/esm/hooks/use-lazy-video.js +13 -1
  366. package/dist/esm/hooks/useAnimations.js +27 -1
  367. package/dist/esm/hooks/useCartId.js +40 -1
  368. package/dist/esm/hooks/useCartLine.js +7 -1
  369. package/dist/esm/hooks/useCartUI.js +44 -1
  370. package/dist/esm/hooks/useCollection.js +7 -1
  371. package/dist/esm/hooks/useFetchHandle.js +11 -1
  372. package/dist/esm/hooks/useFormatMoney.js +71 -1
  373. package/dist/esm/hooks/useInitialSwatchesOptions.js +124 -1
  374. package/dist/esm/hooks/useInteraction.js +17 -0
  375. package/dist/esm/hooks/useIsomorphicLayoutEffect.js +6 -1
  376. package/dist/esm/hooks/useLoadScript.js +28 -1
  377. package/dist/esm/hooks/useMoney.js +80 -1
  378. package/dist/esm/hooks/usePrevious.js +17 -1
  379. package/dist/esm/hooks/useProduct.js +228 -1
  380. package/dist/esm/hooks/useProductList.js +16 -1
  381. package/dist/esm/hooks/useSuspenseFetch.js +23 -1
  382. package/dist/esm/hooks/useSwatchesOptions.js +37 -1
  383. package/dist/esm/hooks/useToolbarPostPurchase.js +87 -1
  384. package/dist/esm/index.js +117 -1
  385. package/dist/esm/types/animations.js +49 -1
  386. package/dist/esm/types/custom.js +52 -0
  387. package/dist/esm/types/global-style.js +12 -1
  388. package/dist/esm/web-components/src/helpers/styles/constant.js +7 -1
  389. package/dist/types/index.d.ts +23183 -17335
  390. package/package.json +5 -3
  391. package/dist/cjs/components/animation/AnimationWrapper.js +0 -1
  392. package/dist/cjs/hooks/animation/animations.js +0 -1
  393. package/dist/cjs/hooks/animation/useLivePageAnimation.js +0 -1
  394. package/dist/esm/components/animation/AnimationWrapper.js +0 -1
  395. package/dist/esm/hooks/animation/animations.js +0 -1
  396. package/dist/esm/hooks/animation/useLivePageAnimation.js +0 -1
@@ -1 +1,256 @@
1
- import{jsx as t,Fragment as e,jsxs as r}from"react/jsx-runtime";import{useRef as n,useState as o,useCallback as a,useEffect as i}from"react";import"zustand";import{useBuilderPreviewStore as l}from"../../contexts/BuilderPreviewContext.js";import"swr";import"@gem-sdk/adapter-shopify";import"swr/mutation";import{usePageType as u}from"../../hooks/shop.js";import"vanilla-lazyload";import"../../hooks/useCartUI.js";import"react-transition-group";import"@gem-sdk/core";import"classnames";import"../../helpers/convert.js";function Spacing(s){let c=l(t=>t.isThemeSectionEditor),d=u(),m=n(null),p=n(null),g=n(null),v=n(!1),b=n(0),f=n(0),w=n(null),[h,y]=o(0),[E,S]=o(!1),L=n(null),C=t=>{let e=t.clientY,r=Math.ceil(e-b.current),n=f.current||0,o=n+r>=0?`${n+r}px`:"0px";return{newValue:o}},x=t=>{if(m.current&&p.current){let{newValue:e}=C(t);p.current.style.height=e,m.current.style.top=e;let r=m.current.closest("[data-toolbar-wrap]");r&&(r.style.marginBottom=e,B(e))}},T=()=>{P()},z=()=>{g.current&&clearTimeout(g.current),g.current=setTimeout(()=>{v.current=!0;let t=new CustomEvent("editor:toolbar:resize-spacing",{bubbles:!0,detail:{value:!0}});window.dispatchEvent(t),document.addEventListener("mousemove",x),document.addEventListener("mouseup",T)},100)},P=()=>{g.current&&clearTimeout(g.current),v.current=!1;let t=new CustomEvent("editor:toolbar:resize-spacing",{bubbles:!0,detail:{value:!1}});if(window.dispatchEvent(t),m.current){let t=getComputedStyle(m.current),e=t.top,r=new CustomEvent("editor:toolbar:change-margin-bottom",{bubbles:!0,detail:{componentUid:s.uid,marginBottom:e}});window.dispatchEvent(r)}let e=m.current?.closest("[data-toolbar-wrap]");e&&(e.style.marginBottom=""),document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",T)},j=(t,e)=>{let r=t.children.length;if(r)for(let n=0;n<r;n++){let r=t.children[n];if(r){let t=r.getAttribute(e);if(t)return r}}},A=t=>{let e=t.getAttribute("data-component-tag");return"Row"===e||"Product"===e},k=a(()=>{let t=m.current?.closest("[data-toolbar-wrap]");if(!t)return;let e=j(t,"data-toolbar");if(!e)return;let r=e.getAttribute("data-toolbar-active");if(!r)return;let n=getComputedStyle(t),o=j(t,"data-spacing"),a=o?.querySelector("[data-spacing-margin-bottom]")||null;if(a&&p.current&&m.current){let e=n.marginBottom;if(B(e),0>parseFloat(e)&&(e="0"),p.current.style.height=e,m.current.style.top=e,a.setAttribute("data-spacing-margin-bottom-active","true"),A(t))p.current.style.left="0";else{let t=n.paddingLeft,e=`-${t}`,r=`translate(${e}, -100%)`;p.current.style.left=e,m.current.style.transform=r}}},[]),B=t=>{let e=parseFloat(t);y(e),S(!0),L.current&&clearTimeout(L.current),L.current=setTimeout(()=>{S(!1)},2e3);let r=e<28&&e>=0?e/2+16:e>28?0:16;w.current&&(w.current.style.transform=`translateY(${r}px)`)},U=usePrevious(s.advanced?.["spacing-setting"]);i(()=>{JSON.stringify(U)!==JSON.stringify(s.advanced?.["spacing-setting"])&&k()},[U,s.advanced,k]);let $=a(()=>{k()},[k]);return i(()=>(window.addEventListener("editor:toolbar:update-margin-bottom",k),window.addEventListener("editor:toolbar:update-padding-left",k),window.addEventListener("resize",$),()=>{window.removeEventListener("editor:toolbar:update-margin-bottom",k),window.removeEventListener("editor:toolbar:update-padding-left",k),window.removeEventListener("resize",$)}),[$,k]),t(e,{children:"Section"!==s.tag&&"POST_PURCHASE"!==d&&t("div",{"data-spacing":!0,"data-spacing-theme-section":c,className:"gp-absolute gp-w-full gp-bottom-0",children:r("div",{"data-spacing-margin-bottom":!0,children:[r("div",{"data-spacing-margin-bottom-bg":!0,ref:p,children:[t("div",{"data-spacing-margin-bottom-value":!0}),t("div",{"data-active":E,"data-value-number":!0,ref:w,children:h})]}),t("div",{ref:m,"data-spacing-margin-bottom-drag":!0,onMouseDown:t=>{if(m.current){let e=getComputedStyle(m.current);b.current=t.clientY,f.current=parseFloat(e.top),z()}},onMouseUp:()=>{P()},role:"presentation"})]})})})}let usePrevious=t=>{let e=n();return i(()=>{e.current=t},[t]),e.current};export{Spacing as default};
1
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
+ import { useRef, useState, useCallback, useEffect } from 'react';
3
+ import 'zustand';
4
+ import { useBuilderPreviewStore } from '../../contexts/BuilderPreviewContext.js';
5
+ import 'react-transition-group';
6
+ import '@gem-sdk/core';
7
+ import 'swr';
8
+ import 'swr/infinite';
9
+ import { usePageType } from '../../hooks/shop.js';
10
+ import 'classnames';
11
+ import 'dayjs';
12
+ import '../../helpers/convert.js';
13
+ import '@gem-sdk/adapter-shopify';
14
+ import 'swr/mutation';
15
+ import 'vanilla-lazyload';
16
+ import '../../hooks/useCartUI.js';
17
+
18
+ function Spacing(props) {
19
+ const isThemeSectionEditor = useBuilderPreviewStore((s)=>s.isThemeSectionEditor);
20
+ const pageType = usePageType();
21
+ const $bottomDrag = useRef(null);
22
+ const $bottomBg = useRef(null);
23
+ const delayMouseMove = useRef(null);
24
+ const isDragging = useRef(false);
25
+ const startY = useRef(0);
26
+ const marginBottom = useRef(0);
27
+ const $visualNumberValue = useRef(null);
28
+ const [marginBottomValue, setMarginBottomValue] = useState(0);
29
+ const [isShowVisual, setIsShowVisual] = useState(false);
30
+ const hideVisualNumberValue = useRef(null);
31
+ const getNewValueMargin = (event)=>{
32
+ const top = event.clientY;
33
+ const diffY = Math.ceil(top - startY.current);
34
+ const currentValue = marginBottom.current || 0;
35
+ const newValue = currentValue + diffY >= 0 ? `${currentValue + diffY}px` : `0px`;
36
+ return {
37
+ newValue
38
+ };
39
+ };
40
+ const onMouseMoveDocument = (event)=>{
41
+ if ($bottomDrag.current && $bottomBg.current) {
42
+ // $bottomDrag.current.
43
+ const { newValue } = getNewValueMargin(event);
44
+ $bottomBg.current.style.height = newValue;
45
+ $bottomDrag.current.style.top = newValue;
46
+ const $component = $bottomDrag.current.closest('[data-toolbar-wrap]');
47
+ if ($component) {
48
+ $component.style.marginBottom = newValue;
49
+ onShowMarginBottomNumber(newValue);
50
+ }
51
+ }
52
+ };
53
+ const onMouseUpDocument = ()=>{
54
+ endDrag();
55
+ };
56
+ const startDrag = ()=>{
57
+ if (delayMouseMove.current) clearTimeout(delayMouseMove.current);
58
+ delayMouseMove.current = setTimeout(()=>{
59
+ isDragging.current = true;
60
+ const event = new CustomEvent('editor:toolbar:resize-spacing', {
61
+ bubbles: true,
62
+ detail: {
63
+ value: true
64
+ }
65
+ });
66
+ window.dispatchEvent(event);
67
+ document.addEventListener('mousemove', onMouseMoveDocument);
68
+ document.addEventListener('mouseup', onMouseUpDocument);
69
+ }, 100);
70
+ };
71
+ const endDrag = ()=>{
72
+ if (delayMouseMove.current) clearTimeout(delayMouseMove.current);
73
+ isDragging.current = false;
74
+ const event = new CustomEvent('editor:toolbar:resize-spacing', {
75
+ bubbles: true,
76
+ detail: {
77
+ value: false
78
+ }
79
+ });
80
+ window.dispatchEvent(event);
81
+ if ($bottomDrag.current) {
82
+ const style = getComputedStyle($bottomDrag.current);
83
+ const marginBottom = style.top;
84
+ const event = new CustomEvent('editor:toolbar:change-margin-bottom', {
85
+ bubbles: true,
86
+ detail: {
87
+ componentUid: props.uid,
88
+ marginBottom
89
+ }
90
+ });
91
+ window.dispatchEvent(event);
92
+ }
93
+ const $component = $bottomDrag.current?.closest('[data-toolbar-wrap]');
94
+ if ($component) {
95
+ $component.style.marginBottom = '';
96
+ }
97
+ document.removeEventListener('mousemove', onMouseMoveDocument);
98
+ document.removeEventListener('mouseup', onMouseUpDocument);
99
+ };
100
+ const onMouseDown = (event)=>{
101
+ if ($bottomDrag.current) {
102
+ const style = getComputedStyle($bottomDrag.current);
103
+ startY.current = event.clientY;
104
+ marginBottom.current = parseFloat(style.top);
105
+ startDrag();
106
+ }
107
+ };
108
+ const onMouseUp = ()=>{
109
+ endDrag();
110
+ };
111
+ const getChildrenByAttrSelector = ($el, attrSelector)=>{
112
+ const childLen = $el.children.length;
113
+ if (childLen) {
114
+ for(let i = 0; i < childLen; i++){
115
+ const children = $el.children[i];
116
+ if (children) {
117
+ const is = children.getAttribute(attrSelector);
118
+ if (is) {
119
+ return children;
120
+ }
121
+ }
122
+ }
123
+ }
124
+ };
125
+ const isLayoutElement = (el)=>{
126
+ const tag = el.getAttribute('data-component-tag');
127
+ return tag === 'Row' || tag === 'Product';
128
+ };
129
+ const updateSpacing = useCallback((isShowVisualize)=>{
130
+ const $component = $bottomDrag.current?.closest('[data-toolbar-wrap]');
131
+ if (!$component) return;
132
+ const toolbar = getChildrenByAttrSelector($component, 'data-toolbar');
133
+ if (!toolbar) return;
134
+ const isActive = toolbar.getAttribute('data-toolbar-active');
135
+ if (!isActive) return;
136
+ const style = getComputedStyle($component);
137
+ const $spacing = getChildrenByAttrSelector($component, 'data-spacing');
138
+ const $marginBottom = ($spacing?.querySelector('[data-spacing-margin-bottom]')) || null;
139
+ if ($marginBottom) {
140
+ if ($bottomBg.current && $bottomDrag.current) {
141
+ let value = style.marginBottom;
142
+ isShowVisualize && onShowMarginBottomNumber(value);
143
+ if (parseFloat(value) < 0) {
144
+ value = '0';
145
+ }
146
+ $bottomBg.current.style.height = value;
147
+ $bottomDrag.current.style.top = value;
148
+ $marginBottom.setAttribute('data-spacing-margin-bottom-active', 'true');
149
+ if (isLayoutElement($component)) {
150
+ $bottomBg.current.style.left = '0';
151
+ } else {
152
+ const paddingLeft = style.paddingLeft;
153
+ const leftValue = `-${paddingLeft}`;
154
+ const translateCss = `translate(${leftValue}, -100%)`;
155
+ $bottomBg.current.style.left = leftValue;
156
+ $bottomDrag.current.style.transform = translateCss;
157
+ }
158
+ }
159
+ }
160
+ }, []);
161
+ const onShowMarginBottomNumber = (value)=>{
162
+ const parsedValue = parseFloat(value);
163
+ setMarginBottomValue(parsedValue);
164
+ setIsShowVisual(true);
165
+ if (hideVisualNumberValue.current) clearTimeout(hideVisualNumberValue.current);
166
+ hideVisualNumberValue.current = setTimeout(()=>{
167
+ setIsShowVisual(false);
168
+ }, 2000);
169
+ // break point 28px
170
+ const topPosition = parsedValue <= 28 && parsedValue >= 0 ? parsedValue / 2 + 16 : parsedValue > 28 ? 0 : 16;
171
+ if ($visualNumberValue.current) {
172
+ $visualNumberValue.current.style.transform = `translateY(${topPosition}px)`;
173
+ }
174
+ };
175
+ const previousAdvanced = usePrevious(props.advanced?.['spacing-setting']);
176
+ useEffect(()=>{
177
+ // validate margin bottom setting changed
178
+ const isShowVisualize = verifyMarginBottomChanged(previousAdvanced, props.advanced?.['spacing-setting']);
179
+ updateSpacing(isShowVisualize);
180
+ }, [
181
+ previousAdvanced,
182
+ props.advanced,
183
+ updateSpacing
184
+ ]);
185
+ const verifyMarginBottomChanged = (prevValue, newValue)=>{
186
+ const listDevices = [
187
+ 'desktop',
188
+ 'tablet',
189
+ 'mobile'
190
+ ];
191
+ return listDevices.some((device)=>JSON.stringify(prevValue?.[device]?.margin?.bottom) !== JSON.stringify(newValue?.[device]?.margin?.bottom));
192
+ };
193
+ const onWindowResize = useCallback(()=>{
194
+ updateSpacing();
195
+ }, [
196
+ updateSpacing
197
+ ]);
198
+ useEffect(()=>{
199
+ window.addEventListener('editor:toolbar:update-margin-bottom', ()=>updateSpacing);
200
+ window.addEventListener('editor:toolbar:update-padding-left', ()=>updateSpacing);
201
+ window.addEventListener('resize', onWindowResize);
202
+ return ()=>{
203
+ window.removeEventListener('editor:toolbar:update-margin-bottom', ()=>updateSpacing);
204
+ window.removeEventListener('editor:toolbar:update-padding-left', ()=>updateSpacing);
205
+ window.removeEventListener('resize', onWindowResize);
206
+ };
207
+ }, [
208
+ onWindowResize,
209
+ updateSpacing
210
+ ]);
211
+ return /*#__PURE__*/ jsx(Fragment, {
212
+ children: props.tag !== 'Section' && pageType !== 'POST_PURCHASE' && /*#__PURE__*/ jsx("div", {
213
+ "data-spacing": true,
214
+ "data-spacing-theme-section": isThemeSectionEditor,
215
+ className: "gp-absolute gp-w-full gp-bottom-0",
216
+ children: /*#__PURE__*/ jsxs("div", {
217
+ "data-spacing-margin-bottom": true,
218
+ children: [
219
+ /*#__PURE__*/ jsxs("div", {
220
+ "data-spacing-margin-bottom-bg": true,
221
+ ref: $bottomBg,
222
+ children: [
223
+ /*#__PURE__*/ jsx("div", {
224
+ "data-spacing-margin-bottom-value": true
225
+ }),
226
+ /*#__PURE__*/ jsx("div", {
227
+ "data-active": isShowVisual,
228
+ "data-value-number": true,
229
+ ref: $visualNumberValue,
230
+ children: marginBottomValue
231
+ })
232
+ ]
233
+ }),
234
+ /*#__PURE__*/ jsx("div", {
235
+ ref: $bottomDrag,
236
+ "data-spacing-margin-bottom-drag": true,
237
+ onMouseDown: onMouseDown,
238
+ onMouseUp: onMouseUp,
239
+ role: "presentation"
240
+ })
241
+ ]
242
+ })
243
+ })
244
+ });
245
+ }
246
+ const usePrevious = (value)=>{
247
+ const ref = useRef();
248
+ useEffect(()=>{
249
+ ref.current = value;
250
+ }, [
251
+ value
252
+ ]);
253
+ return ref.current;
254
+ };
255
+
256
+ export { Spacing as default };
@@ -1 +1,54 @@
1
- let colorPreset={black:"#000000",white:"#FFFFFF",gray:"#808080",red:"#FF0000",blue:"#0000FF",green:"#008000",yellow:"#FFFF00",orange:"#FFA500",pink:"#FFC0CB",purple:"#800080",brown:"#A52A2A",cyan:"#00FFFF",magenta:"#FF00FF",teal:"#008080",navy:"#000080",maroon:"#800000",gold:"#FFD700",silver:"#C0C0C0",beige:"#F5F5DC",ivory:"#FFFFF0",lavender:"#E6E6FA",indigo:"#4B0082",coral:"#FF7F50",mint:"#98FF98","sky blue":"#87CEEB",salmon:"#FA8072",olive:"#808000",lilac:"#C8A2C8",peach:"#FFDAB9",turquoise:"#40E0D0",ruby:"#E0115F",bronze:"#CD7F32",slate:"#708090",charcoal:"#36454F",sand:"#C2B280",mauve:"#E0B0FF",tangerine:"#FF4500","mint green":"#00FF99","forest green":"#228B22","ruby red":"#9B111E",marigold:"#FFB928",eggplant:"#990066","coral pink":"#F88379",mustard:"#FFDB58","sky gray":"#B0C4DE","dusty rose":"#FF9BAE","olive green":"#556B2F",coffee:"#6F4E37","lilac gray":"#C8A2C8","steel blue":"#4682B4"};export{colorPreset};
1
+ const colorPreset = {
2
+ black: '#000000',
3
+ white: '#FFFFFF',
4
+ gray: '#808080',
5
+ red: '#FF0000',
6
+ blue: '#0000FF',
7
+ green: '#008000',
8
+ yellow: '#FFFF00',
9
+ orange: '#FFA500',
10
+ pink: '#FFC0CB',
11
+ purple: '#800080',
12
+ brown: '#A52A2A',
13
+ cyan: '#00FFFF',
14
+ magenta: '#FF00FF',
15
+ teal: '#008080',
16
+ navy: '#000080',
17
+ maroon: '#800000',
18
+ gold: '#FFD700',
19
+ silver: '#C0C0C0',
20
+ beige: '#F5F5DC',
21
+ ivory: '#FFFFF0',
22
+ lavender: '#E6E6FA',
23
+ indigo: '#4B0082',
24
+ coral: '#FF7F50',
25
+ mint: '#98FF98',
26
+ 'sky blue': '#87CEEB',
27
+ salmon: '#FA8072',
28
+ olive: '#808000',
29
+ lilac: '#C8A2C8',
30
+ peach: '#FFDAB9',
31
+ turquoise: '#40E0D0',
32
+ ruby: '#E0115F',
33
+ bronze: '#CD7F32',
34
+ slate: '#708090',
35
+ charcoal: '#36454F',
36
+ sand: '#C2B280',
37
+ mauve: '#E0B0FF',
38
+ tangerine: '#FF4500',
39
+ 'mint green': '#00FF99',
40
+ 'forest green': '#228B22',
41
+ 'ruby red': '#9B111E',
42
+ marigold: '#FFB928',
43
+ eggplant: '#990066',
44
+ 'coral pink': '#F88379',
45
+ mustard: '#FFDB58',
46
+ 'sky gray': '#B0C4DE',
47
+ 'dusty rose': '#FF9BAE',
48
+ 'olive green': '#556B2F',
49
+ coffee: '#6F4E37',
50
+ 'lilac gray': '#C8A2C8',
51
+ 'steel blue': '#4682B4'
52
+ };
53
+
54
+ export { colorPreset };
@@ -1 +1,121 @@
1
- import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import{useRef as o,useState as i}from"react";import{ThemeSectionTooltip as a}from"./ThemeSectionTooltip.js";import"zustand";import{useShopStore as n}from"../../contexts/ShopContext.js";import"@gem-sdk/adapter-shopify";import"swr";import"swr/mutation";import"vanilla-lazyload";import"../../hooks/useCartUI.js";import"classnames";import"../../helpers/convert.js";let SHOW_TOOLTIP_TIMEOUT=600,NUMBER_OF_THEME_SECTION_CREATED_TO_SHOW_TOOLTIP=1,LIMIT_PLANS=["starter","trial","trial2022"],CreateThemeSection=({...c})=>{let l=n(e=>e.plan),s=n(e=>e.createThemeSectionCount),d=LIMIT_PLANS.includes(l??""),m=d||void 0===s||s<1,p=o(),[h,u]=i(!1),C=()=>{m&&(p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{u(!0)},600))},T=()=>{m&&(p.current&&clearTimeout(p.current),u(!1))},v=(e,t)=>{e.preventDefault(),e.stopPropagation(),t?.disabled||(d?b():w(),p.current&&clearTimeout(p.current),u(!1))},b=()=>{let e=new CustomEvent("editor:toolbar:upgrade",{bubbles:!0});window.dispatchEvent(e)},w=()=>{let e=new CustomEvent("editor:toolbar:create-theme-section",{bubbles:!0,detail:{componentUid:c.uid}});window.dispatchEvent(e)};return e(t,{children:r(a,{isLimit:d,isShow:h,isRender:m,onActions:v,onMouseEnter:C,onMouseLeave:T,children:[m&&e("div",{"data-toolbar-create-theme-section":!0,children:"You can create reusable sections"}),e("div",{"data-toolbar-active-create-theme-section-wrapper":!0,children:r("div",{"data-toolbar-active-create-theme-section":!0,onClick:e=>v(e,{disabled:d}),"aria-hidden":"true",children:[r("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[e("path",{d:"M1 2C1 1.44772 1.44772 1 2 1H6C6.55228 1 7 1.44772 7 2V6C7 6.55228 6.55228 7 6 7H2C1.44772 7 1 6.55228 1 6V2Z",fill:"#F9F9F9"}),e("path",{d:"M9 10C9 9.44772 9.44772 9 10 9H14C14.5523 9 15 9.44772 15 10V14C15 14.5523 14.5523 15 14 15H10C9.44772 15 9 14.5523 9 14V10Z",fill:"#F9F9F9"}),e("path",{d:"M2 9C1.44772 9 1 9.44772 1 10V14C1 14.5523 1.44772 15 2 15H6C6.55228 15 7 14.5523 7 14V10C7 9.44772 6.55228 9 6 9H2Z",fill:"#F9F9F9"})]}),e("p",{children:"Create Theme Section"})]})})]})})};export{CreateThemeSection};
1
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
+ import { useRef, useState } from 'react';
3
+ import { ThemeSectionTooltip } from './ThemeSectionTooltip.js';
4
+ import 'zustand';
5
+ import { useShopStore } from '../../contexts/ShopContext.js';
6
+ import 'swr';
7
+ import 'swr/infinite';
8
+ import 'classnames';
9
+ import 'dayjs';
10
+ import '../../helpers/convert.js';
11
+ import '@gem-sdk/adapter-shopify';
12
+ import 'swr/mutation';
13
+ import 'vanilla-lazyload';
14
+ import '../../hooks/useCartUI.js';
15
+
16
+ const SHOW_TOOLTIP_TIMEOUT = 600;
17
+ const NUMBER_OF_THEME_SECTION_CREATED_TO_SHOW_TOOLTIP = 1;
18
+ const LIMIT_PLANS = [
19
+ 'starter',
20
+ 'trial',
21
+ 'trial2022'
22
+ ];
23
+ const CreateThemeSection = ({ ...props })=>{
24
+ const shopPlan = useShopStore((s)=>s.plan);
25
+ const createThemeSectionCount = useShopStore((s)=>s.createThemeSectionCount);
26
+ const limitCreateThemeSection = useShopStore((s)=>s.limitCreateThemeSection);
27
+ const isFreeLimit = LIMIT_PLANS.includes(shopPlan ?? '');
28
+ const isLimit = isFreeLimit || limitCreateThemeSection?.isLimit;
29
+ const isRenderTooltip = isLimit || createThemeSectionCount === undefined || createThemeSectionCount < NUMBER_OF_THEME_SECTION_CREATED_TO_SHOW_TOOLTIP;
30
+ const timeoutRef = useRef();
31
+ const [isShowTooltip, setIsShowTooltip] = useState(false);
32
+ const showTooltip = ()=>{
33
+ if (!isRenderTooltip) return;
34
+ if (timeoutRef.current) clearTimeout(timeoutRef.current);
35
+ timeoutRef.current = setTimeout(()=>{
36
+ setIsShowTooltip(true);
37
+ }, SHOW_TOOLTIP_TIMEOUT);
38
+ };
39
+ const hideTooltip = ()=>{
40
+ if (!isRenderTooltip) return;
41
+ if (timeoutRef.current) clearTimeout(timeoutRef.current);
42
+ setIsShowTooltip(false);
43
+ };
44
+ const onActions = (e, options)=>{
45
+ e.preventDefault();
46
+ e.stopPropagation();
47
+ if (options?.disabled) return;
48
+ isLimit ? onUpgrade() : onCreate();
49
+ if (timeoutRef.current) clearTimeout(timeoutRef.current);
50
+ setIsShowTooltip(false);
51
+ };
52
+ const onUpgrade = ()=>{
53
+ const eventUpgrade = new CustomEvent('editor:toolbar:upgrade', {
54
+ bubbles: true
55
+ });
56
+ window.dispatchEvent(eventUpgrade);
57
+ };
58
+ const onCreate = ()=>{
59
+ const eventCreate = new CustomEvent('editor:toolbar:create-theme-section', {
60
+ bubbles: true,
61
+ detail: {
62
+ componentUid: props.uid
63
+ }
64
+ });
65
+ window.dispatchEvent(eventCreate);
66
+ };
67
+ return /*#__PURE__*/ jsx(Fragment, {
68
+ children: /*#__PURE__*/ jsxs(ThemeSectionTooltip, {
69
+ isFreeLimit: isFreeLimit,
70
+ limitCreateThemeSection: limitCreateThemeSection,
71
+ isShow: isShowTooltip,
72
+ isRender: isRenderTooltip,
73
+ onActions: onActions,
74
+ onMouseEnter: showTooltip,
75
+ onMouseLeave: hideTooltip,
76
+ children: [
77
+ isRenderTooltip && /*#__PURE__*/ jsx("div", {
78
+ "data-toolbar-create-theme-section": true,
79
+ children: "You can create reusable sections"
80
+ }),
81
+ /*#__PURE__*/ jsx("div", {
82
+ "data-toolbar-active-create-theme-section-wrapper": true,
83
+ children: /*#__PURE__*/ jsxs("div", {
84
+ "data-toolbar-active-create-theme-section": true,
85
+ onClick: (e)=>onActions(e, {
86
+ disabled: !!isLimit
87
+ }),
88
+ "aria-hidden": "true",
89
+ children: [
90
+ /*#__PURE__*/ jsxs("svg", {
91
+ width: "16",
92
+ height: "16",
93
+ viewBox: "0 0 16 16",
94
+ fill: "none",
95
+ children: [
96
+ /*#__PURE__*/ jsx("path", {
97
+ d: "M1 2C1 1.44772 1.44772 1 2 1H6C6.55228 1 7 1.44772 7 2V6C7 6.55228 6.55228 7 6 7H2C1.44772 7 1 6.55228 1 6V2Z",
98
+ fill: "#F9F9F9"
99
+ }),
100
+ /*#__PURE__*/ jsx("path", {
101
+ d: "M9 10C9 9.44772 9.44772 9 10 9H14C14.5523 9 15 9.44772 15 10V14C15 14.5523 14.5523 15 14 15H10C9.44772 15 9 14.5523 9 14V10Z",
102
+ fill: "#F9F9F9"
103
+ }),
104
+ /*#__PURE__*/ jsx("path", {
105
+ d: "M2 9C1.44772 9 1 9.44772 1 10V14C1 14.5523 1.44772 15 2 15H6C6.55228 15 7 14.5523 7 14V10C7 9.44772 6.55228 9 6 9H2Z",
106
+ fill: "#F9F9F9"
107
+ })
108
+ ]
109
+ }),
110
+ /*#__PURE__*/ jsx("p", {
111
+ children: "Create Theme Section"
112
+ })
113
+ ]
114
+ })
115
+ })
116
+ ]
117
+ })
118
+ });
119
+ };
120
+
121
+ export { CreateThemeSection };
@@ -1 +1,43 @@
1
- import{jsx as e,Fragment as t,jsxs as i}from"react/jsx-runtime";let getStatusMessage=e=>{switch(e){case"DRAFT":return"This Theme Section is Draft. Publish page will also publish Theme Section.";case"NEED_PUBLISHING":return"Need to republish. Go to global edit and publish this section"}},ThemeSectionStatusWrapper=({tag:s,status:a,isThemeSection:l})=>{let n="Section"===s&&l&&("DRAFT"===a||"NEED_PUBLISHING"===a),h=getStatusMessage(a);return e(t,{children:n&&i("div",{"data-theme-section-status":!0,children:[e("div",{"data-theme-section-status-icon":!0,children:e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1C11.866 1 15 4.13401 15 8ZM8.4668 4.61597C8.4668 4.89211 8.24294 5.11597 7.9668 5.11597C7.69065 5.11597 7.4668 4.89211 7.4668 4.61597C7.4668 4.33982 7.69065 4.11597 7.9668 4.11597C8.24294 4.11597 8.4668 4.33982 8.4668 4.61597ZM6.91309 5.48633C6.63694 5.48633 6.41309 5.71019 6.41309 5.98633C6.41309 6.26247 6.63694 6.48633 6.91309 6.48633H7.56006V10.3839C7.56006 10.9362 8.00777 11.3839 8.56006 11.3839H9.57144C9.84758 11.3839 10.0714 11.1601 10.0714 10.8839C10.0714 10.6078 9.84758 10.3839 9.57144 10.3839H8.56006V6.48633C8.56006 5.93404 8.11234 5.48633 7.56006 5.48633H6.91309Z",fill:"#9144DA"})})}),h&&e("span",{"data-theme-section-status-text":!0,children:h})]})})};export{ThemeSectionStatusWrapper};
1
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
+
3
+ const getStatusMessage = (status)=>{
4
+ switch(status){
5
+ case 'DRAFT':
6
+ return 'This Theme Section is Draft. Publish page will also publish Theme Section.';
7
+ case 'NEED_PUBLISHING':
8
+ return 'Need to republish. Go to global edit and publish this section';
9
+ }
10
+ };
11
+ const ThemeSectionStatusWrapper = ({ tag, status, isThemeSection })=>{
12
+ const isRenderThemeSectionStatus = tag === 'Section' && isThemeSection && (status === 'DRAFT' || status === 'NEED_PUBLISHING');
13
+ const statusMessage = getStatusMessage(status);
14
+ return /*#__PURE__*/ jsx(Fragment, {
15
+ children: isRenderThemeSectionStatus && /*#__PURE__*/ jsxs("div", {
16
+ "data-theme-section-status": true,
17
+ children: [
18
+ /*#__PURE__*/ jsx("div", {
19
+ "data-theme-section-status-icon": true,
20
+ children: /*#__PURE__*/ jsx("svg", {
21
+ xmlns: "http://www.w3.org/2000/svg",
22
+ width: "16",
23
+ height: "16",
24
+ viewBox: "0 0 16 16",
25
+ fill: "none",
26
+ children: /*#__PURE__*/ jsx("path", {
27
+ fillRule: "evenodd",
28
+ clipRule: "evenodd",
29
+ d: "M15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1C11.866 1 15 4.13401 15 8ZM8.4668 4.61597C8.4668 4.89211 8.24294 5.11597 7.9668 5.11597C7.69065 5.11597 7.4668 4.89211 7.4668 4.61597C7.4668 4.33982 7.69065 4.11597 7.9668 4.11597C8.24294 4.11597 8.4668 4.33982 8.4668 4.61597ZM6.91309 5.48633C6.63694 5.48633 6.41309 5.71019 6.41309 5.98633C6.41309 6.26247 6.63694 6.48633 6.91309 6.48633H7.56006V10.3839C7.56006 10.9362 8.00777 11.3839 8.56006 11.3839H9.57144C9.84758 11.3839 10.0714 11.1601 10.0714 10.8839C10.0714 10.6078 9.84758 10.3839 9.57144 10.3839H8.56006V6.48633C8.56006 5.93404 8.11234 5.48633 7.56006 5.48633H6.91309Z",
30
+ fill: "#9144DA"
31
+ })
32
+ })
33
+ }),
34
+ statusMessage && /*#__PURE__*/ jsx("span", {
35
+ "data-theme-section-status-text": true,
36
+ children: statusMessage
37
+ })
38
+ ]
39
+ })
40
+ });
41
+ };
42
+
43
+ export { ThemeSectionStatusWrapper };
@@ -1 +1,124 @@
1
- import{jsx as e,Fragment as t,jsxs as i}from"react/jsx-runtime";import{useRef as o}from"react";import{Transition as n}from"react-transition-group";import{cls as a}from"@gem-sdk/core";let TRANSITION_DURATION=350,defaultStyles={transition:"opacity 350ms ease-out",opacity:0},transitions={entering:{opacity:1},entered:{opacity:1},exiting:{opacity:0},exited:{opacity:0},unmounted:{opacity:0}},ThemeSectionTooltip=({isShow:c,isLimit:r,isRender:l,children:s,onMouseEnter:m,onMouseLeave:h,onActions:d})=>{let p=o(null),u=r?"Upgrade to create Theme Section":"Create Theme Section",y=()=>{window.open("https://help.gempages.net/articles/theme-section","_blank")};return e(t,{children:i("div",{className:"theme-section-tooltip-wrapper",onMouseEnter:m,onMouseLeave:h,children:[s,l&&e(n,{in:c,timeout:350,nodeRef:p,unmountOnExit:!0,children:t=>i("div",{className:"theme-section-tooltip",ref:p,style:{...defaultStyles,...transitions[t]},children:[e("div",{className:"theme-section-tooltip__image",children:e("img",{src:"https://ucarecdn.com/6a9f408a-aa8c-434a-890b-81067a14aceb/-/format/auto/-/preview/1920x1920/-/quality/lighter/theme-section-illustration.png",alt:""})}),i("div",{className:"theme-section-tooltip__body",children:[e("div",{className:"theme-section-tooltip__body-title",children:"Create once, use everywhere with Theme Section"}),e("div",{className:"theme-section-tooltip__body-desc",children:"A global section that can be used on all your GemPages & Shopify pages."})]}),i("div",{className:a("theme-section-tooltip__action",{"theme-section-tooltip__action-limit":r}),children:[e("button",{onClick:e=>d(e),children:u}),r&&e("div",{onClick:y,"aria-hidden":!0,className:"theme-section-tooltip__action-learn-more",children:"Learn more about Theme Section"})]})]})})]})})};export{ThemeSectionTooltip};
1
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
+ import { useRef } from 'react';
3
+ import { Transition } from 'react-transition-group';
4
+ import { cls } from '@gem-sdk/core';
5
+
6
+ const TRANSITION_DURATION = 350;
7
+ const defaultStyles = {
8
+ transition: `opacity ${TRANSITION_DURATION}ms ease-out`,
9
+ opacity: 0
10
+ };
11
+ const transitions = {
12
+ entering: {
13
+ opacity: 1
14
+ },
15
+ entered: {
16
+ opacity: 1
17
+ },
18
+ exiting: {
19
+ opacity: 0
20
+ },
21
+ exited: {
22
+ opacity: 0
23
+ },
24
+ unmounted: {
25
+ opacity: 0
26
+ }
27
+ };
28
+ const ThemeSectionTooltip = ({ isShow, isFreeLimit, isRender, children, limitCreateThemeSection, onMouseEnter, onMouseLeave, onActions })=>{
29
+ const nodeRef = useRef(null);
30
+ const actionBtnLabel = isFreeLimit ? 'Upgrade to create Theme Section' : 'Create Theme Section';
31
+ const openHelpCenter = ()=>{
32
+ const url = 'https://help.gempages.net/articles/theme-section';
33
+ window.open(url, '_blank');
34
+ };
35
+ return /*#__PURE__*/ jsx(Fragment, {
36
+ children: /*#__PURE__*/ jsxs("div", {
37
+ className: "theme-section-tooltip-wrapper",
38
+ onMouseEnter: onMouseEnter,
39
+ onMouseLeave: onMouseLeave,
40
+ children: [
41
+ children,
42
+ isRender && /*#__PURE__*/ jsx(Transition, {
43
+ in: isShow,
44
+ timeout: TRANSITION_DURATION,
45
+ nodeRef: nodeRef,
46
+ unmountOnExit: true,
47
+ children: (state)=>/*#__PURE__*/ jsx("div", {
48
+ className: "theme-section-tooltip",
49
+ ref: nodeRef,
50
+ style: {
51
+ ...defaultStyles,
52
+ ...transitions[state]
53
+ },
54
+ children: limitCreateThemeSection?.isLimit && !isFreeLimit ? /*#__PURE__*/ jsxs("div", {
55
+ className: "theme-section-tooltip__body theme-section-tooltip__body-limit",
56
+ children: [
57
+ /*#__PURE__*/ jsx("div", {
58
+ className: "theme-section-tooltip__body-title theme-section-tooltip__body-limit__title",
59
+ children: "Upgrade plan"
60
+ }),
61
+ /*#__PURE__*/ jsxs("div", {
62
+ className: "theme-section-tooltip__body-desc theme-section-tooltip__body-limit__desc",
63
+ children: [
64
+ "You’ve reached the maximum number of theme sections on your plan (",
65
+ limitCreateThemeSection.total,
66
+ "/",
67
+ limitCreateThemeSection.limit,
68
+ ")"
69
+ ]
70
+ }),
71
+ /*#__PURE__*/ jsx("button", {
72
+ onClick: (e)=>onActions(e),
73
+ children: "Upgrade plan to create more"
74
+ })
75
+ ]
76
+ }) : /*#__PURE__*/ jsxs(Fragment, {
77
+ children: [
78
+ /*#__PURE__*/ jsx("div", {
79
+ className: "theme-section-tooltip__image",
80
+ children: /*#__PURE__*/ jsx("img", {
81
+ src: "https://ucarecdn.com/6a9f408a-aa8c-434a-890b-81067a14aceb/-/format/auto/-/preview/1920x1920/-/quality/lighter/theme-section-illustration.png",
82
+ alt: ""
83
+ })
84
+ }),
85
+ /*#__PURE__*/ jsxs("div", {
86
+ className: "theme-section-tooltip__body",
87
+ children: [
88
+ /*#__PURE__*/ jsx("div", {
89
+ className: "theme-section-tooltip__body-title",
90
+ children: "Create once, use everywhere with Theme Section"
91
+ }),
92
+ /*#__PURE__*/ jsx("div", {
93
+ className: "theme-section-tooltip__body-desc",
94
+ children: "A global section that can be used on all your GemPages & Shopify pages."
95
+ })
96
+ ]
97
+ }),
98
+ /*#__PURE__*/ jsxs("div", {
99
+ className: cls('theme-section-tooltip__action', {
100
+ 'theme-section-tooltip__action-limit': isFreeLimit
101
+ }),
102
+ children: [
103
+ /*#__PURE__*/ jsx("button", {
104
+ onClick: (e)=>onActions(e),
105
+ children: actionBtnLabel
106
+ }),
107
+ isFreeLimit && /*#__PURE__*/ jsx("div", {
108
+ onClick: openHelpCenter,
109
+ "aria-hidden": true,
110
+ className: "theme-section-tooltip__action-learn-more",
111
+ children: "Learn more about Theme Section"
112
+ })
113
+ ]
114
+ })
115
+ ]
116
+ })
117
+ })
118
+ })
119
+ ]
120
+ })
121
+ });
122
+ };
123
+
124
+ export { ThemeSectionTooltip };
@@ -1 +1,24 @@
1
- import{jsxs as t,jsx as o}from"react/jsx-runtime";function Tooltip({children:i,enable:r,text:l="Tooltip Text",position:a="right",width:e,...d}){return t("div",{...d,"data-toolbar-tooltip-trigger":!0,children:[i,r&&o("div",{style:{width:e,zIndex:50},"data-toolbar-tooltip":!0,"data-toolbar-tooltip-position":a,dangerouslySetInnerHTML:{__html:l}})]})}export{Tooltip as default};
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+
3
+ function Tooltip({ children, enable, text = 'Tooltip Text', position = 'right', width, ...props }) {
4
+ return /*#__PURE__*/ jsxs("div", {
5
+ ...props,
6
+ "data-toolbar-tooltip-trigger": true,
7
+ children: [
8
+ children,
9
+ enable && /*#__PURE__*/ jsx("div", {
10
+ style: {
11
+ width: width,
12
+ zIndex: 50
13
+ },
14
+ "data-toolbar-tooltip": true,
15
+ "data-toolbar-tooltip-position": position,
16
+ dangerouslySetInnerHTML: {
17
+ __html: text
18
+ }
19
+ })
20
+ ]
21
+ });
22
+ }
23
+
24
+ export { Tooltip as default };