@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.
Files changed (413) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/components/AddOn.js +2 -18
  3. package/dist/cjs/components/ComponentAnimation.js +2 -17
  4. package/dist/cjs/components/ComponentToolbarPreview.js +2 -752
  5. package/dist/cjs/components/ComponentWrapper.js +2 -61
  6. package/dist/cjs/components/ComponentWrapperPreview.js +2 -213
  7. package/dist/cjs/components/Empty.js +2 -7
  8. package/dist/cjs/components/InteractionSuffix.js +2 -42
  9. package/dist/cjs/components/Render.js +2 -75
  10. package/dist/cjs/components/Render.liquid.js +16 -307
  11. package/dist/cjs/components/RenderBlock.js +2 -54
  12. package/dist/cjs/components/RenderCustomCode.js +4 -59
  13. package/dist/cjs/components/RenderPreview.js +2 -67
  14. package/dist/cjs/components/RenderSection.js +2 -23
  15. package/dist/cjs/components/ai-generator/AIContentGenerator.js +2 -252
  16. package/dist/cjs/components/ai-generator/AIGenContentLoading.js +2 -85
  17. package/dist/cjs/components/ai-generator/components/PickProduct.js +2 -220
  18. package/dist/cjs/components/ai-generator/components/ToneAndVoice.js +2 -77
  19. package/dist/cjs/components/ai-generator/hooks/useCheckingProductInside.js +1 -47
  20. package/dist/cjs/components/ai-generator/hooks/useFlipPopup.js +1 -110
  21. package/dist/cjs/components/ai-generator/hooks/useGettingGenerateRequest.js +1 -37
  22. package/dist/cjs/components/ai-generator/hooks/useListenEventGenerate.js +1 -70
  23. package/dist/cjs/components/ai-generator/icons/AIIcon.js +2 -67
  24. package/dist/cjs/components/ai-generator/icons/CloseIcon.js +2 -19
  25. package/dist/cjs/components/ai-generator/icons/DropdownIcon.js +2 -37
  26. package/dist/cjs/components/ai-generator/icons/SearchIcon.js +2 -21
  27. package/dist/cjs/components/ai-generator/icons/ShowMoreIcon.js +2 -21
  28. package/dist/cjs/components/ai-generator/icons/UpgradeIcon.js +2 -27
  29. package/dist/cjs/components/ai-generator/icons/WarningIcon.js +2 -31
  30. package/dist/cjs/components/constant.js +1 -82
  31. package/dist/cjs/components/resize/Resize.js +2 -16
  32. package/dist/cjs/components/resize/Spacing.js +2 -260
  33. package/dist/cjs/components/src/product/helpers/variant-presets.js +1 -56
  34. package/dist/cjs/components/theme-section/CreateThemeSection.js +2 -123
  35. package/dist/cjs/components/theme-section/ThemeSectionStatus.js +2 -45
  36. package/dist/cjs/components/theme-section/ThemeSectionTooltip.js +2 -126
  37. package/dist/cjs/components/toolbar/Tooltip.js +2 -28
  38. package/dist/cjs/constants/device.js +1 -0
  39. package/dist/cjs/contexts/AddonContext.js +2 -36
  40. package/dist/cjs/contexts/ArticleContext.js +2 -39
  41. package/dist/cjs/contexts/ArticleListContext.js +2 -31
  42. package/dist/cjs/contexts/BuilderComponent.js +2 -34
  43. package/dist/cjs/contexts/BuilderContext.js +2 -39
  44. package/dist/cjs/contexts/BuilderPreviewContext.js +2 -482
  45. package/dist/cjs/contexts/CartLineContext.js +2 -29
  46. package/dist/cjs/contexts/CollectionContext.js +2 -38
  47. package/dist/cjs/contexts/I18nContext.js +2 -0
  48. package/dist/cjs/contexts/ModalContext.js +2 -47
  49. package/dist/cjs/contexts/PageContext.js +2 -111
  50. package/dist/cjs/contexts/ProductContext.js +2 -182
  51. package/dist/cjs/contexts/ProductListContext.js +2 -32
  52. package/dist/cjs/contexts/SectionContext.js +2 -53
  53. package/dist/cjs/contexts/ShopContext.js +2 -107
  54. package/dist/cjs/graphql/fragments/analytic.generated.js +2 -6
  55. package/dist/cjs/graphql/fragments/collection-detail.generated.js +2 -6
  56. package/dist/cjs/graphql/fragments/collection-product.generated.js +2 -6
  57. package/dist/cjs/graphql/fragments/collection.generated.js +2 -6
  58. package/dist/cjs/graphql/fragments/custom-code.generated.js +2 -6
  59. package/dist/cjs/graphql/fragments/custom-font.generated.js +7 -7
  60. package/dist/cjs/graphql/fragments/data-seo.generated.js +2 -6
  61. package/dist/cjs/graphql/fragments/media.generated.js +2 -6
  62. package/dist/cjs/graphql/fragments/preview-theme-page.generated.js +6 -6
  63. package/dist/cjs/graphql/fragments/product-little.generated.js +2 -6
  64. package/dist/cjs/graphql/fragments/product-option-value.generated.js +2 -6
  65. package/dist/cjs/graphql/fragments/product-option.generated.js +2 -6
  66. package/dist/cjs/graphql/fragments/product.generated.js +2 -6
  67. package/dist/cjs/graphql/fragments/published-custom-section.generated.js +2 -6
  68. package/dist/cjs/graphql/fragments/published-page-section.generated.js +2 -6
  69. package/dist/cjs/graphql/fragments/published-theme-page.generated.js +4 -18
  70. package/dist/cjs/graphql/fragments/published-theme-style.generated.js +2 -6
  71. package/dist/cjs/graphql/fragments/selected-option.generated.js +2 -6
  72. package/dist/cjs/graphql/fragments/variant.generated.js +2 -6
  73. package/dist/cjs/graphql/mutations/page-view-up.generated.js +2 -6
  74. package/dist/cjs/graphql/queries/articles.generated.js +2 -6
  75. package/dist/cjs/graphql/queries/blogs.generated.js +3 -6
  76. package/dist/cjs/graphql/queries/collection-detail-filter.generated.js +2 -16
  77. package/dist/cjs/graphql/queries/collection.generated.js +2 -14
  78. package/dist/cjs/graphql/queries/collections.generated.js +2 -9
  79. package/dist/cjs/graphql/queries/preview-page.generated.js +2 -12
  80. package/dist/cjs/graphql/queries/product-little-detail.generated.js +2 -11
  81. package/dist/cjs/graphql/queries/product-medias.generated.js +2 -8
  82. package/dist/cjs/graphql/queries/product-value-label.generated.js +2 -6
  83. package/dist/cjs/graphql/queries/product-variants.generated.js +3 -11
  84. package/dist/cjs/graphql/queries/products.generated.js +3 -17
  85. package/dist/cjs/graphql/queries/{published-shop-metas.js → published-shop-metas.generated.js} +2 -6
  86. package/dist/cjs/graphql/queries/published-theme-pages.generated.js +3 -19
  87. package/dist/cjs/graphql/queries/shop-shopify.generated.js +2 -6
  88. package/dist/cjs/graphql/queries/store-property.generated.js +2 -6
  89. package/dist/cjs/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +2 -6
  90. package/dist/cjs/graphql-app-api/queries/LibraryTemplate.generated.js +2 -6
  91. package/dist/cjs/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +2 -6
  92. package/dist/cjs/graphql-app-api/queries/SaleFunnelOffer.generated.js +2 -6
  93. package/dist/cjs/graphql-app-api/queries/ShopLibraryPage.generated.js +2 -6
  94. package/dist/cjs/graphql-app-api/queries/ThemePage.generated.js +2 -6
  95. package/dist/cjs/helpers/GlobalEvent.js +1 -19
  96. package/dist/cjs/helpers/align.js +1 -37
  97. package/dist/cjs/helpers/animations.js +1 -222
  98. package/dist/cjs/helpers/background.js +1 -236
  99. package/dist/cjs/helpers/backgroundImage.js +1 -0
  100. package/dist/cjs/helpers/borders.js +4 -198
  101. package/dist/cjs/helpers/carousel.js +1 -55
  102. package/dist/cjs/helpers/clone-deep.js +1 -5
  103. package/dist/cjs/helpers/cls.js +1 -16
  104. package/dist/cjs/helpers/colors.js +1 -184
  105. package/dist/cjs/helpers/compose-advance-style.js +1 -323
  106. package/dist/cjs/helpers/composeClasses.js +1 -0
  107. package/dist/cjs/helpers/const.js +1 -0
  108. package/dist/cjs/helpers/constant.js +1 -23
  109. package/dist/cjs/helpers/convert.js +1 -7
  110. package/dist/cjs/helpers/covert-entities-html.js +1 -19
  111. package/dist/cjs/helpers/css-variable.js +1 -7
  112. package/dist/cjs/helpers/email.js +1 -11
  113. package/dist/cjs/helpers/filter-styles.js +1 -0
  114. package/dist/cjs/helpers/filter-toolbar-preview.js +2 -14
  115. package/dist/cjs/helpers/flatten-connection.js +1 -9
  116. package/dist/cjs/helpers/get-resonsive-value.js +1 -36
  117. package/dist/cjs/helpers/get-shortname.js +1 -92
  118. package/dist/cjs/helpers/icon-list.js +1 -61
  119. package/dist/cjs/helpers/interaction/index.js +2 -134
  120. package/dist/cjs/helpers/is-browser.js +1 -9
  121. package/dist/cjs/helpers/is-defined.js +1 -7
  122. package/dist/cjs/helpers/is-empty-children.js +2 -15
  123. package/dist/cjs/helpers/is-safari.js +1 -9
  124. package/dist/cjs/helpers/layout.js +1 -76
  125. package/dist/cjs/helpers/load-script.js +1 -31
  126. package/dist/cjs/helpers/loop-component.js +1 -16
  127. package/dist/cjs/helpers/make-style.js +1 -163
  128. package/dist/cjs/helpers/normalize-builder-data.js +1 -23
  129. package/dist/cjs/helpers/pascal-to-kebab-case.js +1 -7
  130. package/dist/cjs/helpers/prefetch-queries.js +1 -78
  131. package/dist/cjs/helpers/product.js +1 -48
  132. package/dist/cjs/helpers/queries/get-collection.js +1 -226
  133. package/dist/cjs/helpers/queries/get-collections.js +1 -21
  134. package/dist/cjs/helpers/queries/get-product-by-slug.js +1 -125
  135. package/dist/cjs/helpers/queries/get-product.js +1 -154
  136. package/dist/cjs/helpers/queries/get-products.js +1 -214
  137. package/dist/cjs/helpers/query.js +1 -29
  138. package/dist/cjs/helpers/radius.js +6 -140
  139. package/dist/cjs/helpers/render.js +1 -91
  140. package/dist/cjs/helpers/shadow.js +1 -69
  141. package/dist/cjs/helpers/size.js +4 -228
  142. package/dist/cjs/helpers/spacing.js +1 -43
  143. package/dist/cjs/helpers/third-party/addAppBlockId.js +1 -20
  144. package/dist/cjs/helpers/third-party/appConfig.js +1 -416
  145. package/dist/cjs/helpers/third-party/appSetting.js +1 -1324
  146. package/dist/cjs/helpers/third-party/composeAppBlockId.js +1 -11
  147. package/dist/cjs/helpers/third-party/constant.js +1 -69
  148. package/dist/cjs/helpers/third-party/generateAppBlockConfigs.js +1 -34
  149. package/dist/cjs/helpers/third-party/getAppBlockConfig.js +1 -55
  150. package/dist/cjs/helpers/third-party/getAppBlockType.js +1 -12
  151. package/dist/cjs/helpers/third-party/getAppBlocks.js +1 -30
  152. package/dist/cjs/helpers/third-party/mergeBlock.js +1 -19
  153. package/dist/cjs/helpers/third-party/mergeBlockOrder.js +1 -47
  154. package/dist/cjs/helpers/third-party/removeGPAppItems.js +1 -18
  155. package/dist/cjs/helpers/tracking/fpixel.js +1 -28
  156. package/dist/cjs/helpers/tracking/gtag.js +1 -93
  157. package/dist/cjs/helpers/tracking/tiktokpixel.js +1 -17
  158. package/dist/cjs/helpers/typography.js +19 -160
  159. package/dist/cjs/helpers/variant.js +1 -11
  160. package/dist/cjs/hooks/animation/useAnimationActions.js +2 -39
  161. package/dist/cjs/hooks/animation/useAnimationConfig.js +2 -30
  162. package/dist/cjs/hooks/animation/useAnimationPreview.js +2 -31
  163. package/dist/cjs/hooks/animation/useAnimationTarget.js +2 -122
  164. package/dist/cjs/hooks/animation/useApplyAnimation.js +2 -89
  165. package/dist/cjs/hooks/articles/useArticlesQuery.js +2 -33
  166. package/dist/cjs/hooks/cart/use-add-to-cart.js +2 -20
  167. package/dist/cjs/hooks/cart/use-cart-data.js +2 -28
  168. package/dist/cjs/hooks/cart/use-cart-discount-codes-update.js +2 -20
  169. package/dist/cjs/hooks/cart/use-cart-note-update.js +2 -20
  170. package/dist/cjs/hooks/cart/use-create-cart.js +2 -22
  171. package/dist/cjs/hooks/cart/use-remove-cart-item.js +2 -20
  172. package/dist/cjs/hooks/cart/use-update-cart-item.js +2 -20
  173. package/dist/cjs/hooks/shop/use-collection-query.js +2 -22
  174. package/dist/cjs/hooks/shop/use-collections-query.js +2 -17
  175. package/dist/cjs/hooks/shop/use-product-query.js +2 -22
  176. package/dist/cjs/hooks/shop/use-products-query.js +2 -63
  177. package/dist/cjs/hooks/shop/useShopifyLink.js +2 -0
  178. package/dist/cjs/hooks/shop.js +2 -135
  179. package/dist/cjs/hooks/use-current-device.js +2 -30
  180. package/dist/cjs/hooks/use-lazy-video.js +2 -15
  181. package/dist/cjs/hooks/useAnimations.js +2 -29
  182. package/dist/cjs/hooks/useCartId.js +2 -44
  183. package/dist/cjs/hooks/useCartLine.js +2 -11
  184. package/dist/cjs/hooks/useCartUI.js +2 -48
  185. package/dist/cjs/hooks/useCollection.js +2 -9
  186. package/dist/cjs/hooks/useFetchHandle.js +2 -13
  187. package/dist/cjs/hooks/useFormatMoney.js +2 -75
  188. package/dist/cjs/hooks/useI18n.js +2 -0
  189. package/dist/cjs/hooks/useInitialSwatchesOptions.js +2 -127
  190. package/dist/cjs/hooks/useInteraction.js +2 -19
  191. package/dist/cjs/hooks/useIsomorphicLayoutEffect.js +2 -10
  192. package/dist/cjs/hooks/useLoadScript.js +2 -32
  193. package/dist/cjs/hooks/useMoney.js +2 -84
  194. package/dist/cjs/hooks/usePrevious.js +2 -19
  195. package/dist/cjs/hooks/useProduct.js +2 -250
  196. package/dist/cjs/hooks/useProductList.js +2 -21
  197. package/dist/cjs/hooks/useStickyStore.js +1 -0
  198. package/dist/cjs/hooks/useSuspenseFetch.js +2 -27
  199. package/dist/cjs/hooks/useSwatchesOptions.js +2 -41
  200. package/dist/cjs/hooks/useToolbarPostPurchase.js +2 -89
  201. package/dist/cjs/index.js +1 -425
  202. package/dist/cjs/types/animations.js +1 -49
  203. package/dist/cjs/types/appAPI.js +1 -2
  204. package/dist/cjs/types/custom.js +1 -52
  205. package/dist/cjs/types/global-style.js +1 -15
  206. package/dist/cjs/types/shop.js +1 -2
  207. package/dist/esm/components/AddOn.js +2 -14
  208. package/dist/esm/components/ComponentAnimation.js +2 -13
  209. package/dist/esm/components/ComponentToolbarPreview.js +2 -748
  210. package/dist/esm/components/ComponentWrapper.js +2 -57
  211. package/dist/esm/components/ComponentWrapperPreview.js +2 -209
  212. package/dist/esm/components/Empty.js +2 -3
  213. package/dist/esm/components/InteractionSuffix.js +2 -40
  214. package/dist/esm/components/Render.js +2 -71
  215. package/dist/esm/components/Render.liquid.js +16 -301
  216. package/dist/esm/components/RenderBlock.js +2 -50
  217. package/dist/esm/components/RenderCustomCode.js +4 -55
  218. package/dist/esm/components/RenderPreview.js +2 -63
  219. package/dist/esm/components/RenderSection.js +2 -19
  220. package/dist/esm/components/ai-generator/AIContentGenerator.js +2 -250
  221. package/dist/esm/components/ai-generator/AIGenContentLoading.js +2 -83
  222. package/dist/esm/components/ai-generator/components/PickProduct.js +2 -218
  223. package/dist/esm/components/ai-generator/components/ToneAndVoice.js +2 -75
  224. package/dist/esm/components/ai-generator/hooks/useCheckingProductInside.js +1 -45
  225. package/dist/esm/components/ai-generator/hooks/useFlipPopup.js +1 -108
  226. package/dist/esm/components/ai-generator/hooks/useGettingGenerateRequest.js +1 -35
  227. package/dist/esm/components/ai-generator/hooks/useListenEventGenerate.js +1 -68
  228. package/dist/esm/components/ai-generator/icons/AIIcon.js +2 -65
  229. package/dist/esm/components/ai-generator/icons/CloseIcon.js +2 -17
  230. package/dist/esm/components/ai-generator/icons/DropdownIcon.js +2 -34
  231. package/dist/esm/components/ai-generator/icons/SearchIcon.js +2 -19
  232. package/dist/esm/components/ai-generator/icons/ShowMoreIcon.js +2 -19
  233. package/dist/esm/components/ai-generator/icons/UpgradeIcon.js +2 -25
  234. package/dist/esm/components/ai-generator/icons/WarningIcon.js +2 -29
  235. package/dist/esm/components/constant.js +1 -75
  236. package/dist/esm/components/resize/Resize.js +2 -12
  237. package/dist/esm/components/resize/Spacing.js +2 -256
  238. package/dist/esm/components/src/product/helpers/variant-presets.js +1 -54
  239. package/dist/esm/components/theme-section/CreateThemeSection.js +2 -121
  240. package/dist/esm/components/theme-section/ThemeSectionStatus.js +2 -43
  241. package/dist/esm/components/theme-section/ThemeSectionTooltip.js +2 -124
  242. package/dist/esm/components/toolbar/Tooltip.js +2 -24
  243. package/dist/esm/constants/device.js +1 -0
  244. package/dist/esm/contexts/AddonContext.js +2 -32
  245. package/dist/esm/contexts/ArticleContext.js +2 -36
  246. package/dist/esm/contexts/ArticleListContext.js +2 -27
  247. package/dist/esm/contexts/BuilderComponent.js +2 -31
  248. package/dist/esm/contexts/BuilderContext.js +2 -36
  249. package/dist/esm/contexts/BuilderPreviewContext.js +2 -479
  250. package/dist/esm/contexts/CartLineContext.js +2 -26
  251. package/dist/esm/contexts/CollectionContext.js +2 -35
  252. package/dist/esm/contexts/I18nContext.js +2 -0
  253. package/dist/esm/contexts/ModalContext.js +2 -44
  254. package/dist/esm/contexts/PageContext.js +2 -108
  255. package/dist/esm/contexts/ProductContext.js +2 -179
  256. package/dist/esm/contexts/ProductListContext.js +2 -28
  257. package/dist/esm/contexts/SectionContext.js +2 -49
  258. package/dist/esm/contexts/ShopContext.js +2 -104
  259. package/dist/esm/graphql/fragments/analytic.generated.js +2 -4
  260. package/dist/esm/graphql/fragments/collection-detail.generated.js +2 -4
  261. package/dist/esm/graphql/fragments/collection-product.generated.js +2 -4
  262. package/dist/esm/graphql/fragments/collection.generated.js +2 -4
  263. package/dist/esm/graphql/fragments/custom-code.generated.js +2 -4
  264. package/dist/esm/graphql/fragments/custom-font.generated.js +7 -5
  265. package/dist/esm/graphql/fragments/data-seo.generated.js +2 -4
  266. package/dist/esm/graphql/fragments/media.generated.js +2 -4
  267. package/dist/esm/graphql/fragments/preview-theme-page.generated.js +6 -4
  268. package/dist/esm/graphql/fragments/product-little.generated.js +2 -4
  269. package/dist/esm/graphql/fragments/product-option-value.generated.js +2 -4
  270. package/dist/esm/graphql/fragments/product-option.generated.js +2 -4
  271. package/dist/esm/graphql/fragments/product.generated.js +2 -4
  272. package/dist/esm/graphql/fragments/published-custom-section.generated.js +2 -4
  273. package/dist/esm/graphql/fragments/published-page-section.generated.js +2 -4
  274. package/dist/esm/graphql/fragments/published-theme-page.generated.js +4 -16
  275. package/dist/esm/graphql/fragments/published-theme-style.generated.js +2 -4
  276. package/dist/esm/graphql/fragments/selected-option.generated.js +2 -4
  277. package/dist/esm/graphql/fragments/variant.generated.js +2 -4
  278. package/dist/esm/graphql/mutations/page-view-up.generated.js +2 -4
  279. package/dist/esm/graphql/queries/articles.generated.js +2 -4
  280. package/dist/esm/graphql/queries/blogs.generated.js +3 -4
  281. package/dist/esm/graphql/queries/collection-detail-filter.generated.js +10 -22
  282. package/dist/esm/graphql/queries/collection.generated.js +8 -18
  283. package/dist/esm/graphql/queries/collections.generated.js +3 -8
  284. package/dist/esm/graphql/queries/preview-page.generated.js +6 -14
  285. package/dist/esm/graphql/queries/product-little-detail.generated.js +5 -12
  286. package/dist/esm/graphql/queries/product-medias.generated.js +2 -6
  287. package/dist/esm/graphql/queries/product-value-label.generated.js +2 -4
  288. package/dist/esm/graphql/queries/product-variants.generated.js +5 -11
  289. package/dist/esm/graphql/queries/products.generated.js +9 -20
  290. package/dist/esm/graphql/queries/{published-shop-metas.js → published-shop-metas.generated.js} +2 -4
  291. package/dist/esm/graphql/queries/published-theme-pages.generated.js +6 -20
  292. package/dist/esm/graphql/queries/shop-shopify.generated.js +2 -4
  293. package/dist/esm/graphql/queries/store-property.generated.js +2 -4
  294. package/dist/esm/graphql-app-api/queries/LibrarySaleFunnelDiscount.generated.js +2 -4
  295. package/dist/esm/graphql-app-api/queries/LibraryTemplate.generated.js +2 -4
  296. package/dist/esm/graphql-app-api/queries/SaleFunnelDiscounts.generated.js +2 -4
  297. package/dist/esm/graphql-app-api/queries/SaleFunnelOffer.generated.js +2 -4
  298. package/dist/esm/graphql-app-api/queries/ShopLibraryPage.generated.js +2 -4
  299. package/dist/esm/graphql-app-api/queries/ThemePage.generated.js +2 -4
  300. package/dist/esm/helpers/GlobalEvent.js +1 -15
  301. package/dist/esm/helpers/align.js +1 -34
  302. package/dist/esm/helpers/animations.js +1 -220
  303. package/dist/esm/helpers/background.js +1 -227
  304. package/dist/esm/helpers/backgroundImage.js +1 -0
  305. package/dist/esm/helpers/borders.js +4 -189
  306. package/dist/esm/helpers/carousel.js +1 -51
  307. package/dist/esm/helpers/clone-deep.js +1 -3
  308. package/dist/esm/helpers/cls.js +1 -14
  309. package/dist/esm/helpers/colors.js +1 -169
  310. package/dist/esm/helpers/compose-advance-style.js +1 -315
  311. package/dist/esm/helpers/composeClasses.js +1 -0
  312. package/dist/esm/helpers/const.js +1 -0
  313. package/dist/esm/helpers/constant.js +1 -19
  314. package/dist/esm/helpers/convert.js +1 -4
  315. package/dist/esm/helpers/covert-entities-html.js +1 -17
  316. package/dist/esm/helpers/css-variable.js +1 -5
  317. package/dist/esm/helpers/email.js +1 -6
  318. package/dist/esm/helpers/filter-styles.js +1 -0
  319. package/dist/esm/helpers/filter-toolbar-preview.js +2 -9
  320. package/dist/esm/helpers/flatten-connection.js +1 -7
  321. package/dist/esm/helpers/get-resonsive-value.js +1 -31
  322. package/dist/esm/helpers/get-shortname.js +1 -90
  323. package/dist/esm/helpers/icon-list.js +1 -58
  324. package/dist/esm/helpers/interaction/index.js +2 -132
  325. package/dist/esm/helpers/is-browser.js +1 -5
  326. package/dist/esm/helpers/is-defined.js +1 -5
  327. package/dist/esm/helpers/is-empty-children.js +2 -10
  328. package/dist/esm/helpers/is-safari.js +1 -5
  329. package/dist/esm/helpers/layout.js +1 -70
  330. package/dist/esm/helpers/load-script.js +1 -29
  331. package/dist/esm/helpers/loop-component.js +1 -14
  332. package/dist/esm/helpers/make-style.js +1 -149
  333. package/dist/esm/helpers/normalize-builder-data.js +1 -21
  334. package/dist/esm/helpers/pascal-to-kebab-case.js +1 -5
  335. package/dist/esm/helpers/prefetch-queries.js +1 -76
  336. package/dist/esm/helpers/product.js +1 -44
  337. package/dist/esm/helpers/queries/get-collection.js +1 -223
  338. package/dist/esm/helpers/queries/get-collections.js +1 -19
  339. package/dist/esm/helpers/queries/get-product-by-slug.js +1 -123
  340. package/dist/esm/helpers/queries/get-product.js +1 -150
  341. package/dist/esm/helpers/queries/get-products.js +1 -210
  342. package/dist/esm/helpers/query.js +1 -25
  343. package/dist/esm/helpers/radius.js +6 -132
  344. package/dist/esm/helpers/render.js +1 -82
  345. package/dist/esm/helpers/shadow.js +1 -63
  346. package/dist/esm/helpers/size.js +4 -213
  347. package/dist/esm/helpers/spacing.js +1 -40
  348. package/dist/esm/helpers/third-party/addAppBlockId.js +1 -18
  349. package/dist/esm/helpers/third-party/appConfig.js +1 -356
  350. package/dist/esm/helpers/third-party/appSetting.js +1 -1321
  351. package/dist/esm/helpers/third-party/composeAppBlockId.js +1 -9
  352. package/dist/esm/helpers/third-party/constant.js +1 -66
  353. package/dist/esm/helpers/third-party/generateAppBlockConfigs.js +1 -32
  354. package/dist/esm/helpers/third-party/getAppBlockConfig.js +1 -53
  355. package/dist/esm/helpers/third-party/getAppBlockType.js +1 -10
  356. package/dist/esm/helpers/third-party/getAppBlocks.js +1 -28
  357. package/dist/esm/helpers/third-party/mergeBlock.js +1 -17
  358. package/dist/esm/helpers/third-party/mergeBlockOrder.js +1 -45
  359. package/dist/esm/helpers/third-party/removeGPAppItems.js +1 -15
  360. package/dist/esm/helpers/tracking/fpixel.js +1 -24
  361. package/dist/esm/helpers/tracking/gtag.js +1 -87
  362. package/dist/esm/helpers/tracking/tiktokpixel.js +1 -15
  363. package/dist/esm/helpers/typography.js +19 -149
  364. package/dist/esm/helpers/variant.js +1 -9
  365. package/dist/esm/hooks/animation/useAnimationActions.js +2 -37
  366. package/dist/esm/hooks/animation/useAnimationConfig.js +2 -28
  367. package/dist/esm/hooks/animation/useAnimationPreview.js +2 -29
  368. package/dist/esm/hooks/animation/useAnimationTarget.js +2 -120
  369. package/dist/esm/hooks/animation/useApplyAnimation.js +2 -85
  370. package/dist/esm/hooks/articles/useArticlesQuery.js +2 -30
  371. package/dist/esm/hooks/cart/use-add-to-cart.js +2 -18
  372. package/dist/esm/hooks/cart/use-cart-data.js +2 -26
  373. package/dist/esm/hooks/cart/use-cart-discount-codes-update.js +2 -18
  374. package/dist/esm/hooks/cart/use-cart-note-update.js +2 -18
  375. package/dist/esm/hooks/cart/use-create-cart.js +2 -20
  376. package/dist/esm/hooks/cart/use-remove-cart-item.js +2 -18
  377. package/dist/esm/hooks/cart/use-update-cart-item.js +2 -18
  378. package/dist/esm/hooks/shop/use-collection-query.js +2 -20
  379. package/dist/esm/hooks/shop/use-collections-query.js +2 -15
  380. package/dist/esm/hooks/shop/use-product-query.js +2 -20
  381. package/dist/esm/hooks/shop/use-products-query.js +2 -59
  382. package/dist/esm/hooks/shop/useShopifyLink.js +2 -0
  383. package/dist/esm/hooks/shop.js +2 -119
  384. package/dist/esm/hooks/use-current-device.js +2 -28
  385. package/dist/esm/hooks/use-lazy-video.js +2 -13
  386. package/dist/esm/hooks/useAnimations.js +2 -27
  387. package/dist/esm/hooks/useCartId.js +2 -40
  388. package/dist/esm/hooks/useCartLine.js +2 -7
  389. package/dist/esm/hooks/useCartUI.js +2 -44
  390. package/dist/esm/hooks/useCollection.js +2 -7
  391. package/dist/esm/hooks/useFetchHandle.js +2 -11
  392. package/dist/esm/hooks/useFormatMoney.js +2 -71
  393. package/dist/esm/hooks/useI18n.js +2 -0
  394. package/dist/esm/hooks/useInitialSwatchesOptions.js +2 -123
  395. package/dist/esm/hooks/useInteraction.js +2 -17
  396. package/dist/esm/hooks/useIsomorphicLayoutEffect.js +2 -6
  397. package/dist/esm/hooks/useLoadScript.js +2 -28
  398. package/dist/esm/hooks/useMoney.js +2 -80
  399. package/dist/esm/hooks/usePrevious.js +2 -17
  400. package/dist/esm/hooks/useProduct.js +2 -233
  401. package/dist/esm/hooks/useProductList.js +2 -16
  402. package/dist/esm/hooks/useStickyStore.js +1 -0
  403. package/dist/esm/hooks/useSuspenseFetch.js +2 -23
  404. package/dist/esm/hooks/useSwatchesOptions.js +2 -37
  405. package/dist/esm/hooks/useToolbarPostPurchase.js +2 -87
  406. package/dist/esm/index.js +1 -119
  407. package/dist/esm/types/animations.js +1 -49
  408. package/dist/esm/types/custom.js +1 -52
  409. package/dist/esm/types/global-style.js +1 -12
  410. package/dist/types/index.d.ts +12025 -8969
  411. package/package.json +6 -6
  412. package/dist/cjs/web-components/src/helpers/styles/constant.js +0 -9
  413. package/dist/esm/web-components/src/helpers/styles/constant.js +0 -7
@@ -1,252 +1,2 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var react = require('react');
5
- var AIIcon = require('./icons/AIIcon.js');
6
- var CloseIcon = require('./icons/CloseIcon.js');
7
- var ShowMoreIcon = require('./icons/ShowMoreIcon.js');
8
- var WarningIcon = require('./icons/WarningIcon.js');
9
- var UpgradeIcon = require('./icons/UpgradeIcon.js');
10
- var PickProduct = require('./components/PickProduct.js');
11
- var ToneAndVoice = require('./components/ToneAndVoice.js');
12
- var classNames = require('classnames');
13
- var useListenEventGenerate = require('./hooks/useListenEventGenerate.js');
14
- var useGettingGenerateRequest = require('./hooks/useGettingGenerateRequest.js');
15
- var useFlipPopup = require('./hooks/useFlipPopup.js');
16
- var useCheckingProductInside = require('./hooks/useCheckingProductInside.js');
17
- require('zustand');
18
- require('react-transition-group');
19
- require('@gem-sdk/core');
20
- var ShopContext = require('../../contexts/ShopContext.js');
21
- var dayjs = require('dayjs');
22
- require('swr');
23
- require('../../helpers/convert.js');
24
- require('@gem-sdk/adapter-shopify');
25
- require('swr/mutation');
26
- require('swr/infinite');
27
- require('vanilla-lazyload');
28
- require('../../hooks/useCartUI.js');
29
-
30
- const AIContentGenerator = ({ ...props })=>{
31
- const [isShowPopup, setIsShowPopup] = react.useState(false);
32
- const [isShowMore, setIsShowMore] = react.useState(false);
33
- const genTool = react.useRef(null);
34
- const genPopup = react.useRef(null);
35
- const genPopupHeader = react.useRef(null);
36
- const genButtonWrapper = react.useRef(null);
37
- const nextMonth = dayjs().add(1, 'month').startOf('month').format('DD MMM');
38
- const { popupPositionX, popupPositionY, isValidating: isValidatingFlipPopup, bodyMaxHeight: popupBodyMaxHeight } = useFlipPopup.useFlipPopup(isShowPopup, {
39
- genTool,
40
- genPopup,
41
- genPopupHeader,
42
- genButtonWrapper
43
- });
44
- const { isGenerating, onGenerate, onOpenProductElementSettings, goToPricing } = useListenEventGenerate.useListenEventGenerate({
45
- uid: props.uid,
46
- tag: String(props.tag)
47
- });
48
- const { getRequestBody, prompt, changeProductName, changePrompt, changeTone } = useGettingGenerateRequest.useGettingGenerateRequest();
49
- const { productElement, checkSectionHasProduct } = useCheckingProductInside.useCheckingProductInside(genTool);
50
- const generateLimitation = ShopContext.useShopStore((s)=>s.generateContentLimitation);
51
- const togglePopup = ()=>{
52
- setIsShowPopup(!isShowPopup);
53
- };
54
- const hidePopup = ()=>{
55
- setIsShowPopup(false);
56
- };
57
- const onChangePrompt = (e)=>{
58
- changePrompt(e.target.value);
59
- };
60
- const onActiveComponent = react.useCallback((e)=>{
61
- const detail = e.detail;
62
- if (detail?.componentUid !== props.uid) {
63
- hidePopup();
64
- return;
65
- }
66
- checkSectionHasProduct();
67
- }, [
68
- props.uid,
69
- checkSectionHasProduct
70
- ]);
71
- const toggleShowMore = ()=>{
72
- setIsShowMore(!isShowMore);
73
- };
74
- const handleGenerateContent = ()=>{
75
- const body = getRequestBody();
76
- onGenerate(body);
77
- hidePopup();
78
- };
79
- const handleOpenProductSetting = ()=>{
80
- onOpenProductElementSettings(productElement.uid ?? '');
81
- };
82
- react.useEffect(()=>{
83
- if (!isGenerating) {
84
- hidePopup();
85
- }
86
- }, [
87
- isGenerating
88
- ]);
89
- react.useEffect(()=>{
90
- if (productElement.productId) {
91
- setIsShowMore(false);
92
- return;
93
- }
94
- setIsShowMore(true);
95
- }, [
96
- productElement
97
- ]);
98
- react.useEffect(()=>{
99
- window.addEventListener('editor:active-component', onActiveComponent);
100
- return ()=>{
101
- window.removeEventListener('editor:active-component', onActiveComponent);
102
- };
103
- }, [
104
- onActiveComponent
105
- ]);
106
- return /*#__PURE__*/ jsxRuntime.jsxs("div", {
107
- className: "gp-gen-content-toolbar-wrapper gp-relative",
108
- ref: genTool,
109
- children: [
110
- /*#__PURE__*/ jsxRuntime.jsx("div", {
111
- className: "gp-gen-content-btn gp-border-r gp-pr-1 gp-mr-1",
112
- children: /*#__PURE__*/ jsxRuntime.jsxs("button", {
113
- className: classNames({
114
- 'gp-toolbar-ai-active': isShowPopup
115
- }, 'gp-p-1 gp-text-xs gp-flex gp-gap-1 gp-items-center gp-rounded-md hover:gp-bg-[#3B3B3B] gp-font-medium'),
116
- onClick: togglePopup,
117
- children: [
118
- /*#__PURE__*/ jsxRuntime.jsx(AIIcon.AIIcon, {}),
119
- "AI Content"
120
- ]
121
- })
122
- }),
123
- /*#__PURE__*/ jsxRuntime.jsxs("div", {
124
- className: classNames({
125
- 'gp-hidden': !isShowPopup,
126
- 'gp-right-0': props.tag === 'Section' || popupPositionX === 'right',
127
- 'gp-left-0': popupPositionX === 'left' && props.tag !== 'Section',
128
- 'gp-top-8': popupPositionY === 'top',
129
- 'gp-bottom-8': popupPositionY === 'bottom',
130
- '!gp-visible': !isValidatingFlipPopup
131
- }, 'gp-absolute gp-invisible gp-rounded-lg gp-bg-[#151515] gp-w-[312px] !gp-max-w-[312px] !gp-cursor-default'),
132
- ref: genPopup,
133
- children: [
134
- /*#__PURE__*/ jsxRuntime.jsxs("div", {
135
- className: "gp-flex gp-items-center gp-justify-between gp-px-4 gp-py-[10px]",
136
- ref: genPopupHeader,
137
- children: [
138
- /*#__PURE__*/ jsxRuntime.jsx("span", {
139
- className: "gp-font-medium gp-text-sm",
140
- children: "Write with GemAI"
141
- }),
142
- /*#__PURE__*/ jsxRuntime.jsx("button", {
143
- className: "gp-p-2 gp-cursor-pointer hover:gp-bg-[#3B3B3B] gp-rounded-md",
144
- onClick: hidePopup,
145
- children: /*#__PURE__*/ jsxRuntime.jsx(CloseIcon.CloseIcon, {})
146
- })
147
- ]
148
- }),
149
- /*#__PURE__*/ jsxRuntime.jsx("div", {
150
- className: classNames({
151
- 'gp-overflow-auto': popupBodyMaxHeight !== null
152
- }, 'gp-pt-2 gp-text-left gp-px-4 scrollbar:gp-w-1 scrollbar-thumb:gp-bg-[#999] scrollbar-thumb:gp-rounded-xl'),
153
- style: {
154
- maxHeight: popupBodyMaxHeight !== null ? `${popupBodyMaxHeight}px` : 'auto'
155
- },
156
- children: generateLimitation?.isAllow ? /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
157
- children: [
158
- /*#__PURE__*/ jsxRuntime.jsx("div", {
159
- className: "gp-mb-4",
160
- children: /*#__PURE__*/ jsxRuntime.jsx("span", {
161
- className: "gp-text-xs",
162
- children: "What would you like to describe here?"
163
- })
164
- }),
165
- /*#__PURE__*/ jsxRuntime.jsx("div", {
166
- className: "gp-mb-4 gp-flex",
167
- children: /*#__PURE__*/ jsxRuntime.jsx("textarea", {
168
- className: "gp-p-2 gp-bg-[#333333] gp-rounded-lg gp-w-full gp-text-xs gp-text-white placeholder:gp-text-[#AAAAAA] gp-resize-none focus-visible:gp-outline-none",
169
- placeholder: "e.g: generate feature benefits",
170
- rows: 4,
171
- value: prompt,
172
- onChange: onChangePrompt
173
- })
174
- }),
175
- /*#__PURE__*/ jsxRuntime.jsxs("div", {
176
- className: classNames({
177
- 'gp-hidden': !isShowMore
178
- }, 'gp-mb-4 gp-gap-4 gp-flex gp-flex-col'),
179
- children: [
180
- /*#__PURE__*/ jsxRuntime.jsx(ToneAndVoice.ToneAndVoice, {
181
- changeToneAndVoice: changeTone
182
- }),
183
- /*#__PURE__*/ jsxRuntime.jsx(PickProduct.PickProduct, {
184
- changeProductName: changeProductName,
185
- openProductSetting: handleOpenProductSetting,
186
- productId: productElement.productId
187
- })
188
- ]
189
- }),
190
- /*#__PURE__*/ jsxRuntime.jsx("div", {
191
- children: /*#__PURE__*/ jsxRuntime.jsxs("button", {
192
- className: "gp-flex gp-justify-center gp-items-center gp-w-full gp-bg-[#333333] gp-py-2 gp-rounded-lg gp-gap-2 gp-text-xs gp-font-medium",
193
- onClick: toggleShowMore,
194
- children: [
195
- "Show more",
196
- /*#__PURE__*/ jsxRuntime.jsx("span", {
197
- className: classNames({
198
- 'gp-rotate-180': isShowMore
199
- }),
200
- children: /*#__PURE__*/ jsxRuntime.jsx(ShowMoreIcon.ShowMoreIcon, {})
201
- })
202
- ]
203
- })
204
- })
205
- ]
206
- }) : /*#__PURE__*/ jsxRuntime.jsxs("div", {
207
- className: "gp-flex gp-gap-2 gp-p-3 gp-rounded-xl gp-bg-[#FDB913] gp-bg-opacity-20",
208
- children: [
209
- /*#__PURE__*/ jsxRuntime.jsx("div", {
210
- className: "gp-flex-none gp-w-7 gp-h-7 gp-rounded-lg gp-bg-[#FFB800] gp-flex gp-justify-center gp-items-center",
211
- children: /*#__PURE__*/ jsxRuntime.jsx(WarningIcon.WarningIcon, {})
212
- }),
213
- /*#__PURE__*/ jsxRuntime.jsxs("p", {
214
- className: "gp-text-xs gp-whitespace-normal",
215
- children: [
216
- "You've reached ",
217
- generateLimitation?.maxGenerateCount,
218
- "/",
219
- generateLimitation?.maxGenerateCount,
220
- " rewrites of your AI generative this month.",
221
- /*#__PURE__*/ jsxRuntime.jsx("br", {}),
222
- "Resets on ",
223
- nextMonth,
224
- "."
225
- ]
226
- })
227
- ]
228
- })
229
- }),
230
- /*#__PURE__*/ jsxRuntime.jsx("div", {
231
- className: "gp-p-4",
232
- ref: genButtonWrapper,
233
- children: generateLimitation?.isAllow ? /*#__PURE__*/ jsxRuntime.jsx("button", {
234
- className: "gp-rounded-lg gp-w-full gp-text-xs gp-font-medium gp-bg-gradient-to-tl gp-from-[#3C38E1] gp-to-[#874CFD] gp-py-2",
235
- onClick: handleGenerateContent,
236
- children: isGenerating ? 'Generating...' : 'Generate'
237
- }) : /*#__PURE__*/ jsxRuntime.jsxs("button", {
238
- className: "gp-flex gp-items-center gp-gap-2 gp-justify-center gp-rounded-lg gp-w-full gp-text-xs gp-font-medium gp-bg-gradient-to-tl gp-from-[#3C38E1] gp-to-[#874CFD] gp-py-2",
239
- onClick: goToPricing,
240
- children: [
241
- /*#__PURE__*/ jsxRuntime.jsx(UpgradeIcon.UpgradeIcon, {}),
242
- generateLimitation?.nextQuota ? `Upgrade to generate ${generateLimitation?.nextQuota} rewrites` : 'You have reached limit this month'
243
- ]
244
- })
245
- })
246
- ]
247
- })
248
- ]
249
- });
250
- };
251
-
252
- exports.AIContentGenerator = AIContentGenerator;
1
+ 'use client';
2
+ "use strict";var jsxRuntime=require("react/jsx-runtime"),react=require("react"),AIIcon=require("./icons/AIIcon.js"),CloseIcon=require("./icons/CloseIcon.js"),ShowMoreIcon=require("./icons/ShowMoreIcon.js"),WarningIcon=require("./icons/WarningIcon.js"),UpgradeIcon=require("./icons/UpgradeIcon.js"),PickProduct=require("./components/PickProduct.js"),ToneAndVoice=require("./components/ToneAndVoice.js"),classNames=require("classnames"),useListenEventGenerate=require("./hooks/useListenEventGenerate.js"),useGettingGenerateRequest=require("./hooks/useGettingGenerateRequest.js"),useFlipPopup=require("./hooks/useFlipPopup.js"),useCheckingProductInside=require("./hooks/useCheckingProductInside.js");require("zustand");var I18nContext=require("../../contexts/I18nContext.js");require("react-transition-group"),require("@gem-sdk/core");var ShopContext=require("../../contexts/ShopContext.js"),dayjs=require("dayjs");require("swr"),require("../../helpers/convert.js"),require("@gem-sdk/adapter-shopify"),require("swr/mutation"),require("swr/infinite"),require("vanilla-lazyload"),require("../../hooks/useCartUI.js"),require("../../hooks/useStickyStore.js");const AIContentGenerator=({...e})=>{let[t,s]=react.useState(!1),[n,r]=react.useState(!1),i=react.useRef(null),o=react.useRef(null),a=react.useRef(null),p=react.useRef(null),u=dayjs().add(1,"month").startOf("month").format("DD MMM"),{t:g}=I18nContext.useI18nStore(),{popupPositionX:c,popupPositionY:l,isValidating:d,bodyMaxHeight:x}=useFlipPopup.useFlipPopup(t,{genTool:i,genPopup:o,genPopupHeader:a,genButtonWrapper:p}),{isGenerating:m,onGenerate:j,onOpenProductElementSettings:h,goToPricing:f}=useListenEventGenerate.useListenEventGenerate({uid:e.uid,tag:String(e.tag)}),{getRequestBody:I,prompt:R,changeProductName:b,changePrompt:v,changeTone:C}=useGettingGenerateRequest.useGettingGenerateRequest(),{productElement:q,checkSectionHasProduct:w}=useCheckingProductInside.useCheckingProductInside(i),N=ShopContext.useShopStore(e=>e.generateContentLimitation),k=()=>{s(!t)},A=()=>{s(!1)},G=e=>{v(e.target.value)},y=react.useCallback(t=>{let s=t.detail;if(s?.componentUid!==e.uid){A();return}w()},[e.uid,w]),S=()=>{r(!n)},P=()=>{let e=I();j(e),A()},E=()=>{h(q.uid??"")};return react.useEffect(()=>{m||A()},[m]),react.useEffect(()=>{if(q.productId){r(!1);return}r(!0)},[q]),react.useEffect(()=>(window.addEventListener("editor:active-component",y),()=>{window.removeEventListener("editor:active-component",y)}),[y]),jsxRuntime.jsxs("div",{className:"gp-gen-content-toolbar-wrapper gp-relative",ref:i,children:[jsxRuntime.jsx("div",{className:"gp-gen-content-btn gp-border-r gp-pr-1 gp-mr-1",children:jsxRuntime.jsxs("button",{className:classNames({"gp-toolbar-ai-active":t},"gp-p-1 gp-text-xs gp-flex gp-gap-1 gp-items-center gp-rounded-md hover:gp-bg-[#3B3B3B] gp-font-medium"),onClick:k,children:[jsxRuntime.jsx(AIIcon.AIIcon,{}),g("AI Content")]})}),jsxRuntime.jsxs("div",{className:classNames({"gp-hidden":!t,"gp-right-0":"Section"===e.tag||"right"===c,"gp-left-0":"left"===c&&"Section"!==e.tag,"gp-top-8":"top"===l,"gp-bottom-8":"bottom"===l,"!gp-visible":!d},"gp-absolute gp-invisible gp-rounded-lg gp-bg-[#151515] gp-w-[312px] !gp-max-w-[312px] !gp-cursor-default"),ref:o,children:[jsxRuntime.jsxs("div",{className:"gp-flex gp-items-center gp-justify-between gp-px-4 gp-py-[10px]",ref:a,children:[jsxRuntime.jsx("span",{className:"gp-font-medium gp-text-sm",children:"Write with GemAI"}),jsxRuntime.jsx("button",{className:"gp-p-2 gp-cursor-pointer hover:gp-bg-[#3B3B3B] gp-rounded-md",onClick:A,children:jsxRuntime.jsx(CloseIcon.CloseIcon,{})})]}),jsxRuntime.jsx("div",{className:classNames({"gp-overflow-auto":null!==x},"gp-pt-2 gp-text-left gp-px-4 scrollbar:gp-w-1 scrollbar-thumb:gp-bg-[#999] scrollbar-thumb:gp-rounded-xl"),style:{maxHeight:null!==x?`${x}px`:"auto"},children:N?.isAllow?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"gp-mb-4",children:jsxRuntime.jsx("span",{className:"gp-text-xs",children:"What would you like to describe here?"})}),jsxRuntime.jsx("div",{className:"gp-mb-4 gp-flex",children:jsxRuntime.jsx("textarea",{className:"gp-p-2 gp-bg-[#333333] gp-rounded-lg gp-w-full gp-text-xs gp-text-white placeholder:gp-text-[#AAAAAA] gp-resize-none focus-visible:gp-outline-none",placeholder:"e.g: generate feature benefits",rows:4,value:R,onChange:G})}),jsxRuntime.jsxs("div",{className:classNames({"gp-hidden":!n},"gp-mb-4 gp-gap-4 gp-flex gp-flex-col"),children:[jsxRuntime.jsx(ToneAndVoice.ToneAndVoice,{changeToneAndVoice:C}),jsxRuntime.jsx(PickProduct.PickProduct,{changeProductName:b,openProductSetting:E,productId:q.productId})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsxs("button",{className:"gp-flex gp-justify-center gp-items-center gp-w-full gp-bg-[#333333] gp-py-2 gp-rounded-lg gp-gap-2 gp-text-xs gp-font-medium",onClick:S,children:["Show more",jsxRuntime.jsx("span",{className:classNames({"gp-rotate-180":n}),children:jsxRuntime.jsx(ShowMoreIcon.ShowMoreIcon,{})})]})})]}):jsxRuntime.jsxs("div",{className:"gp-flex gp-gap-2 gp-p-3 gp-rounded-xl gp-bg-[#FDB913] gp-bg-opacity-20",children:[jsxRuntime.jsx("div",{className:"gp-flex-none gp-w-7 gp-h-7 gp-rounded-lg gp-bg-[#FFB800] gp-flex gp-justify-center gp-items-center",children:jsxRuntime.jsx(WarningIcon.WarningIcon,{})}),jsxRuntime.jsxs("p",{className:"gp-text-xs gp-whitespace-normal",children:["You've reached ",N?.maxGenerateCount,"/",N?.maxGenerateCount," rewrites of your AI generative this month.",jsxRuntime.jsx("br",{}),"Resets on ",u,"."]})]})}),jsxRuntime.jsx("div",{className:"gp-p-4",ref:p,children:N?.isAllow?jsxRuntime.jsx("button",{className:"gp-rounded-lg gp-w-full gp-text-xs gp-font-medium gp-bg-gradient-to-tl gp-from-[#3C38E1] gp-to-[#874CFD] gp-py-2",onClick:P,children:m?"Generating...":"Generate"}):jsxRuntime.jsxs("button",{className:"gp-flex gp-items-center gp-gap-2 gp-justify-center gp-rounded-lg gp-w-full gp-text-xs gp-font-medium gp-bg-gradient-to-tl gp-from-[#3C38E1] gp-to-[#874CFD] gp-py-2",onClick:f,children:[jsxRuntime.jsx(UpgradeIcon.UpgradeIcon,{}),N?.nextQuota?`Upgrade to generate ${N?.nextQuota} rewrites`:"You have reached limit this month"]})})]})]})};exports.AIContentGenerator=AIContentGenerator;
@@ -1,85 +1,2 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var react = require('react');
5
- var AIIcon = require('./icons/AIIcon.js');
6
-
7
- function getRandomArbitrary(min, max) {
8
- const randomNum = Math.random();
9
- return randomNum * (max - min) + min;
10
- }
11
- const AIGenContentLoading = ({ ...props })=>{
12
- const [isGenerating, setIsGenerating] = react.useState(false);
13
- const [time, setTime] = react.useState(0);
14
- const interval = react.useRef(null);
15
- const onGenerateContentStatus = react.useCallback((e)=>{
16
- const detail = e.detail;
17
- if (detail?.generatingUid !== props.uid) {
18
- return;
19
- }
20
- if (detail.status === 'loading') {
21
- setIsGenerating(true);
22
- return;
23
- }
24
- if (detail.status === 'success') {
25
- setIsGenerating(false);
26
- return;
27
- }
28
- }, [
29
- props.uid
30
- ]);
31
- react.useEffect(()=>{
32
- if (isGenerating) {
33
- handleFakeLoading();
34
- } else {
35
- setTime(0);
36
- }
37
- return ()=>{
38
- interval.current && clearInterval(interval.current);
39
- };
40
- }, [
41
- isGenerating
42
- ]);
43
- const handleFakeLoading = ()=>{
44
- setTime(0);
45
- interval.current = setInterval(()=>{
46
- setTime((time)=>{
47
- const randomNum = getRandomArbitrary(0, 6);
48
- return time >= 580 ? time : time + randomNum;
49
- });
50
- }, 50);
51
- };
52
- react.useEffect(()=>{
53
- window.addEventListener('editor:ai-generate-content-status', onGenerateContentStatus);
54
- return ()=>{
55
- window.removeEventListener('editor:ai-generate-content-status', onGenerateContentStatus);
56
- };
57
- }, [
58
- onGenerateContentStatus
59
- ]);
60
- return isGenerating ? /*#__PURE__*/ jsxRuntime.jsxs("div", {
61
- className: "gp-absolute gp-top-0 gp-left-0 gp-w-full gp-h-full gp-bg-white gp-bg-opacity-70 gp-flex gp-justify-center gp-items-center gp-z-100 gp-gap-2",
62
- children: [
63
- /*#__PURE__*/ jsxRuntime.jsx("div", {
64
- className: "gp-absolute gp-left-0 gp-top-0 gp-z-2 gp-flex gp-h-full gp-w-full",
65
- children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
66
- className: `gp-relative gp-h-[2px] gp-w-full gp-overflow-hidden gp-rounded-md`,
67
- children: [
68
- /*#__PURE__*/ jsxRuntime.jsx("div", {
69
- className: "gp-absolute gp-h-full gp-w-full gp-rounded-md gp-bg-[#F4F4F4]"
70
- }),
71
- /*#__PURE__*/ jsxRuntime.jsx("div", {
72
- className: "gps-image-to-layout-progress-bar gp-absolute gp-h-full gp-rounded-md gp-transition-all",
73
- style: {
74
- width: `${time / 600 * 100}%`
75
- }
76
- })
77
- ]
78
- })
79
- }),
80
- /*#__PURE__*/ jsxRuntime.jsx(AIIcon.AIIcon, {})
81
- ]
82
- }) : null;
83
- };
84
-
85
- exports.AIGenContentLoading = AIGenContentLoading;
1
+ 'use client';
2
+ "use strict";var jsxRuntime=require("react/jsx-runtime"),react=require("react"),AIIcon=require("./icons/AIIcon.js");function getRandomArbitrary(e,t){return Math.random()*(t-e)+e}const AIGenContentLoading=({...e})=>{let[t,n]=react.useState(!1),[r,s]=react.useState(0),a=react.useRef(null),i=react.useCallback(t=>{let r=t.detail;if(r?.generatingUid===e.uid){if("loading"===r.status){n(!0);return}if("success"===r.status){n(!1);return}}},[e.uid]);react.useEffect(()=>(t?l():s(0),()=>{a.current&&clearInterval(a.current)}),[t]);let l=()=>{s(0),a.current=setInterval(()=>{s(e=>{let t=getRandomArbitrary(0,6);return e>=580?e:e+t})},50)};return react.useEffect(()=>(window.addEventListener("editor:ai-generate-content-status",i),()=>{window.removeEventListener("editor:ai-generate-content-status",i)}),[i]),t?jsxRuntime.jsxs("div",{className:"gp-absolute gp-top-0 gp-left-0 gp-w-full gp-h-full gp-bg-white gp-bg-opacity-70 gp-flex gp-justify-center gp-items-center gp-z-100 gp-gap-2",children:[jsxRuntime.jsx("div",{className:"gp-absolute gp-left-0 gp-top-0 gp-z-2 gp-flex gp-h-full gp-w-full",children:jsxRuntime.jsxs("div",{className:"gp-relative gp-h-[2px] gp-w-full gp-overflow-hidden gp-rounded-md",children:[jsxRuntime.jsx("div",{className:"gp-absolute gp-h-full gp-w-full gp-rounded-md gp-bg-[#F4F4F4]"}),jsxRuntime.jsx("div",{className:"gps-image-to-layout-progress-bar gp-absolute gp-h-full gp-rounded-md gp-transition-all",style:{width:`${r/600*100}%`}})]})}),jsxRuntime.jsx(AIIcon.AIIcon,{})]}):null};exports.AIGenContentLoading=AIGenContentLoading;
@@ -1,220 +1,2 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var react = require('react');
5
- var SearchIcon = require('../icons/SearchIcon.js');
6
- var useProductsQuery = require('../../../hooks/shop/use-products-query.js');
7
- var classNames = require('classnames');
8
- require('zustand');
9
- require('react-transition-group');
10
- require('@gem-sdk/core');
11
- require('swr');
12
- require('dayjs');
13
- require('../../../helpers/convert.js');
14
- require('@gem-sdk/adapter-shopify');
15
- require('swr/mutation');
16
- var useProductQuery = require('../../../hooks/shop/use-product-query.js');
17
- require('vanilla-lazyload');
18
- require('../../../hooks/useCartUI.js');
19
-
20
- const PickProduct = (props)=>{
21
- const LIMIT_PRODUCTS = 8;
22
- const [productVariables, setProductVariables] = react.useState(!props.productId ? {
23
- first: LIMIT_PRODUCTS
24
- } : undefined);
25
- const { data: productList, isLoading: isLoadingGetProducts, isValidating: isValidatingGetProducts, size: productsSize, setSize: setProductsSize } = useProductsQuery.useListProductQuery(productVariables, {
26
- revalidateFirstPage: false
27
- });
28
- const { data: sectionProduct } = useProductQuery.useProductQuery(props.productId);
29
- const [activeProduct, setActiveProduct] = react.useState();
30
- const [isShowChooseProduct, setIsShowChooseProduct] = react.useState(false);
31
- const debounceSearch = react.useRef(null);
32
- const debounceScroll = react.useRef(null);
33
- const toggleChooseProduct = ()=>{
34
- if (props.productId) return;
35
- setIsShowChooseProduct(!isShowChooseProduct);
36
- };
37
- const chooseProduct = (product)=>{
38
- setActiveProduct(product);
39
- setIsShowChooseProduct(false);
40
- };
41
- const searchProduct = (e)=>{
42
- debounceSearch.current && clearTimeout(debounceSearch.current);
43
- debounceSearch.current = setTimeout(()=>{
44
- const searchValue = e.target.value ?? '';
45
- if (searchValue) {
46
- setProductVariables({
47
- first: LIMIT_PRODUCTS,
48
- where: {
49
- titleContainsFold: searchValue
50
- }
51
- });
52
- return;
53
- }
54
- setProductVariables({
55
- first: LIMIT_PRODUCTS
56
- });
57
- }, 200);
58
- };
59
- const handleOpenProductElementSettings = ()=>{
60
- props.openProductSetting();
61
- };
62
- const handleLoadMore = (e)=>{
63
- const target = e.target;
64
- if (target.scrollHeight - target.scrollTop === target.clientHeight) {
65
- debounceScroll.current && clearTimeout(debounceScroll.current);
66
- debounceScroll.current = setTimeout(()=>{
67
- setProductsSize(productsSize + 1);
68
- }, 50);
69
- }
70
- };
71
- const products = react.useMemo(()=>{
72
- return productList?.reduce((acc, curr)=>{
73
- return [
74
- ...acc,
75
- ...curr.products?.edges ?? []
76
- ];
77
- }, []) ?? [];
78
- }, [
79
- productList
80
- ]);
81
- react.useEffect(()=>{
82
- if (products.length && !activeProduct && !props.productId) {
83
- const firstProduct = products[0]?.node;
84
- if (!firstProduct) return;
85
- setActiveProduct({
86
- id: firstProduct?.id,
87
- name: firstProduct?.title,
88
- image: firstProduct.featuredImage?.src
89
- });
90
- }
91
- }, [
92
- products,
93
- activeProduct,
94
- props.productId
95
- ]);
96
- react.useEffect(()=>{
97
- if (activeProduct && activeProduct.name) {
98
- props.changeProductName(activeProduct.name);
99
- }
100
- }, [
101
- activeProduct,
102
- props
103
- ]);
104
- react.useEffect(()=>{
105
- if (sectionProduct) {
106
- setActiveProduct({
107
- id: sectionProduct.id,
108
- name: sectionProduct.title,
109
- image: sectionProduct.featuredImage?.src
110
- });
111
- }
112
- }, [
113
- sectionProduct
114
- ]);
115
- const NO_IMAGE_SRC = 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif';
116
- return /*#__PURE__*/ jsxRuntime.jsxs("div", {
117
- className: "gp-flex gp-flex-col gp-gap-2",
118
- children: [
119
- /*#__PURE__*/ jsxRuntime.jsx("p", {
120
- className: "gp-py-2 gp-text-xs",
121
- children: "Product"
122
- }),
123
- /*#__PURE__*/ jsxRuntime.jsxs("div", {
124
- className: "gp-relative",
125
- children: [
126
- !isLoadingGetProducts || activeProduct ? /*#__PURE__*/ jsxRuntime.jsxs("button", {
127
- className: classNames({
128
- 'gp-cursor-default': props.productId
129
- }, 'gp-flex gp-gap-2 gp-items-center gp-w-full gp-p-2 gp-rounded-lg gp-bg-[#333333] gp-text-xs'),
130
- onClick: toggleChooseProduct,
131
- children: [
132
- /*#__PURE__*/ jsxRuntime.jsx("img", {
133
- className: "gp-rounded-lg gp-w-10 gp-h-10",
134
- src: activeProduct?.image || NO_IMAGE_SRC,
135
- alt: "product_image"
136
- }),
137
- /*#__PURE__*/ jsxRuntime.jsx("span", {
138
- className: "gp-truncate gp-max-w-[210px]",
139
- children: activeProduct?.name
140
- })
141
- ]
142
- }) : /*#__PURE__*/ jsxRuntime.jsx("div", {
143
- children: /*#__PURE__*/ jsxRuntime.jsx("span", {
144
- className: "gp-text-xs",
145
- children: "Getting products..."
146
- })
147
- }),
148
- props.productId && /*#__PURE__*/ jsxRuntime.jsx("div", {
149
- className: "gp-mt-2 gp-text-xs",
150
- children: /*#__PURE__*/ jsxRuntime.jsxs("p", {
151
- children: [
152
- "You can manage it in",
153
- ' ',
154
- /*#__PURE__*/ jsxRuntime.jsx("button", {
155
- className: "gp-text-[#8AA4FF] gp-cursor-pointer hover:gp-underline",
156
- onClick: handleOpenProductElementSettings,
157
- children: "Product element"
158
- })
159
- ]
160
- })
161
- }),
162
- isShowChooseProduct && /*#__PURE__*/ jsxRuntime.jsxs("div", {
163
- className: "gp-absolute gp-w-full gp-top-16 gp-left-0 gp-rounded-lg gp-bg-[#333333] gp-p-2 gp-flex gp-flex-col gp-gap-2 gp-z-10",
164
- children: [
165
- /*#__PURE__*/ jsxRuntime.jsxs("div", {
166
- className: "gp-flex gp-items-center gp-gap-2 gp-p-2",
167
- children: [
168
- /*#__PURE__*/ jsxRuntime.jsx(SearchIcon.SearchIcon, {}),
169
- /*#__PURE__*/ jsxRuntime.jsx("input", {
170
- className: "gp-bg-transparent gp-w-full focus-visible:!gp-outline-none gp-text-xs",
171
- placeholder: "Search product...",
172
- onChange: searchProduct
173
- })
174
- ]
175
- }),
176
- /*#__PURE__*/ jsxRuntime.jsxs("div", {
177
- className: "gp-max-h-[168px] gp-overflow-auto scrollbar:gp-w-1 scrollbar-thumb:gp-bg-[#999] scrollbar-thumb:gp-rounded-xl",
178
- onScroll: handleLoadMore,
179
- children: [
180
- products?.map((item)=>{
181
- return /*#__PURE__*/ jsxRuntime.jsxs("button", {
182
- className: "gp-flex gp-p-2 hover:gp-bg-[#3B3B3B] gp-rounded-lg gp-cursor-pointer gp-gap-2 gp-items-center",
183
- onClick: ()=>{
184
- chooseProduct({
185
- id: item.node?.id,
186
- name: item.node?.title,
187
- image: item.node?.featuredImage?.src
188
- });
189
- },
190
- children: [
191
- /*#__PURE__*/ jsxRuntime.jsx("img", {
192
- className: "gp-rounded-lg gp-w-10 gp-h-10",
193
- src: item.node?.featuredImage?.src || NO_IMAGE_SRC,
194
- alt: "product_image"
195
- }),
196
- /*#__PURE__*/ jsxRuntime.jsx("span", {
197
- className: "gp-truncate gp-max-w-[210px] gp-text-xs",
198
- children: item.node?.title
199
- })
200
- ]
201
- }, item.node?.id);
202
- }),
203
- isLoadingGetProducts || isValidatingGetProducts && /*#__PURE__*/ jsxRuntime.jsx("div", {
204
- className: "gp-p-2",
205
- children: /*#__PURE__*/ jsxRuntime.jsx("span", {
206
- className: "gp-text-xs",
207
- children: "Getting products..."
208
- })
209
- })
210
- ]
211
- })
212
- ]
213
- })
214
- ]
215
- })
216
- ]
217
- });
218
- };
219
-
220
- exports.PickProduct = PickProduct;
1
+ 'use client';
2
+ "use strict";var jsxRuntime=require("react/jsx-runtime"),react=require("react"),SearchIcon=require("../icons/SearchIcon.js"),useProductsQuery=require("../../../hooks/shop/use-products-query.js"),classNames=require("classnames");require("zustand"),require("react-transition-group"),require("@gem-sdk/core"),require("swr"),require("dayjs"),require("../../../helpers/convert.js"),require("@gem-sdk/adapter-shopify"),require("swr/mutation");var useProductQuery=require("../../../hooks/shop/use-product-query.js");require("vanilla-lazyload"),require("../../../hooks/useCartUI.js"),require("../../../hooks/useStickyStore.js");const PickProduct=e=>{let[s,t]=react.useState(e.productId?void 0:{first:8}),{data:r,isLoading:a,isValidating:u,size:c,setSize:i}=useProductsQuery.useListProductQuery(s,{revalidateFirstPage:!1}),{data:n}=useProductQuery.useProductQuery(e.productId),[p,l]=react.useState(),[g,o]=react.useState(!1),d=react.useRef(null),m=react.useRef(null),x=()=>{e.productId||o(!g)},j=e=>{l(e),o(!1)},h=e=>{d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{let s=e.target.value??"";if(s){t({first:8,where:{titleContainsFold:s}});return}t({first:8})},200)},f=()=>{e.openProductSetting()},b=e=>{let s=e.target;s.scrollHeight-s.scrollTop===s.clientHeight&&(m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{i(c+1)},50))},R=react.useMemo(()=>r?.reduce((e,s)=>[...e,...s.products?.edges??[]],[])??[],[r]);react.useEffect(()=>{if(R.length&&!p&&!e.productId){let e=R[0]?.node;e&&l({id:e?.id,name:e?.title,image:e.featuredImage?.src})}},[R,p,e.productId]),react.useEffect(()=>{p&&p.name&&e.changeProductName(p.name)},[p,e]),react.useEffect(()=>{n&&l({id:n.id,name:n.title,image:n.featuredImage?.src})},[n]);let N="https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif";return jsxRuntime.jsxs("div",{className:"gp-flex gp-flex-col gp-gap-2",children:[jsxRuntime.jsx("p",{className:"gp-py-2 gp-text-xs",children:"Product"}),jsxRuntime.jsxs("div",{className:"gp-relative",children:[!a||p?jsxRuntime.jsxs("button",{className:classNames({"gp-cursor-default":e.productId},"gp-flex gp-gap-2 gp-items-center gp-w-full gp-p-2 gp-rounded-lg gp-bg-[#333333] gp-text-xs"),onClick:x,children:[jsxRuntime.jsx("img",{className:"gp-rounded-lg gp-w-10 gp-h-10",src:p?.image||N,alt:"product_image"}),jsxRuntime.jsx("span",{className:"gp-truncate gp-max-w-[210px]",children:p?.name})]}):jsxRuntime.jsx("div",{children:jsxRuntime.jsx("span",{className:"gp-text-xs",children:"Getting products..."})}),e.productId&&jsxRuntime.jsx("div",{className:"gp-mt-2 gp-text-xs",children:jsxRuntime.jsxs("p",{children:["You can manage it in"," ",jsxRuntime.jsx("button",{className:"gp-text-[#8AA4FF] gp-cursor-pointer hover:gp-underline",onClick:f,children:"Product element"})]})}),g&&jsxRuntime.jsxs("div",{className:"gp-absolute gp-w-full gp-top-16 gp-left-0 gp-rounded-lg gp-bg-[#333333] gp-p-2 gp-flex gp-flex-col gp-gap-2 gp-z-10",children:[jsxRuntime.jsxs("div",{className:"gp-flex gp-items-center gp-gap-2 gp-p-2",children:[jsxRuntime.jsx(SearchIcon.SearchIcon,{}),jsxRuntime.jsx("input",{className:"gp-bg-transparent gp-w-full focus-visible:!gp-outline-none gp-text-xs",placeholder:"Search product...",onChange:h})]}),jsxRuntime.jsxs("div",{className:"gp-max-h-[168px] gp-overflow-auto scrollbar:gp-w-1 scrollbar-thumb:gp-bg-[#999] scrollbar-thumb:gp-rounded-xl",onScroll:b,children:[R?.map(e=>jsxRuntime.jsxs("button",{className:"gp-flex gp-p-2 hover:gp-bg-[#3B3B3B] gp-rounded-lg gp-cursor-pointer gp-gap-2 gp-items-center",onClick:()=>{j({id:e.node?.id,name:e.node?.title,image:e.node?.featuredImage?.src})},children:[jsxRuntime.jsx("img",{className:"gp-rounded-lg gp-w-10 gp-h-10",src:e.node?.featuredImage?.src||N,alt:"product_image"}),jsxRuntime.jsx("span",{className:"gp-truncate gp-max-w-[210px] gp-text-xs",children:e.node?.title})]},e.node?.id)),a||u&&jsxRuntime.jsx("div",{className:"gp-p-2",children:jsxRuntime.jsx("span",{className:"gp-text-xs",children:"Getting products..."})})]})]})]})]})};exports.PickProduct=PickProduct;