@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,250 +1,2 @@
1
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
- import { useState, useRef, useCallback, useEffect } from 'react';
3
- import { AIIcon } from './icons/AIIcon.js';
4
- import { CloseIcon } from './icons/CloseIcon.js';
5
- import { ShowMoreIcon } from './icons/ShowMoreIcon.js';
6
- import { WarningIcon } from './icons/WarningIcon.js';
7
- import { UpgradeIcon } from './icons/UpgradeIcon.js';
8
- import { PickProduct } from './components/PickProduct.js';
9
- import { ToneAndVoice } from './components/ToneAndVoice.js';
10
- import classNames from 'classnames';
11
- import { useListenEventGenerate } from './hooks/useListenEventGenerate.js';
12
- import { useGettingGenerateRequest } from './hooks/useGettingGenerateRequest.js';
13
- import { useFlipPopup } from './hooks/useFlipPopup.js';
14
- import { useCheckingProductInside } from './hooks/useCheckingProductInside.js';
15
- import 'zustand';
16
- import 'react-transition-group';
17
- import '@gem-sdk/core';
18
- import { useShopStore } from '../../contexts/ShopContext.js';
19
- import dayjs from 'dayjs';
20
- import 'swr';
21
- import '../../helpers/convert.js';
22
- import '@gem-sdk/adapter-shopify';
23
- import 'swr/mutation';
24
- import 'swr/infinite';
25
- import 'vanilla-lazyload';
26
- import '../../hooks/useCartUI.js';
27
-
28
- const AIContentGenerator = ({ ...props })=>{
29
- const [isShowPopup, setIsShowPopup] = useState(false);
30
- const [isShowMore, setIsShowMore] = useState(false);
31
- const genTool = useRef(null);
32
- const genPopup = useRef(null);
33
- const genPopupHeader = useRef(null);
34
- const genButtonWrapper = useRef(null);
35
- const nextMonth = dayjs().add(1, 'month').startOf('month').format('DD MMM');
36
- const { popupPositionX, popupPositionY, isValidating: isValidatingFlipPopup, bodyMaxHeight: popupBodyMaxHeight } = useFlipPopup(isShowPopup, {
37
- genTool,
38
- genPopup,
39
- genPopupHeader,
40
- genButtonWrapper
41
- });
42
- const { isGenerating, onGenerate, onOpenProductElementSettings, goToPricing } = useListenEventGenerate({
43
- uid: props.uid,
44
- tag: String(props.tag)
45
- });
46
- const { getRequestBody, prompt, changeProductName, changePrompt, changeTone } = useGettingGenerateRequest();
47
- const { productElement, checkSectionHasProduct } = useCheckingProductInside(genTool);
48
- const generateLimitation = useShopStore((s)=>s.generateContentLimitation);
49
- const togglePopup = ()=>{
50
- setIsShowPopup(!isShowPopup);
51
- };
52
- const hidePopup = ()=>{
53
- setIsShowPopup(false);
54
- };
55
- const onChangePrompt = (e)=>{
56
- changePrompt(e.target.value);
57
- };
58
- const onActiveComponent = useCallback((e)=>{
59
- const detail = e.detail;
60
- if (detail?.componentUid !== props.uid) {
61
- hidePopup();
62
- return;
63
- }
64
- checkSectionHasProduct();
65
- }, [
66
- props.uid,
67
- checkSectionHasProduct
68
- ]);
69
- const toggleShowMore = ()=>{
70
- setIsShowMore(!isShowMore);
71
- };
72
- const handleGenerateContent = ()=>{
73
- const body = getRequestBody();
74
- onGenerate(body);
75
- hidePopup();
76
- };
77
- const handleOpenProductSetting = ()=>{
78
- onOpenProductElementSettings(productElement.uid ?? '');
79
- };
80
- useEffect(()=>{
81
- if (!isGenerating) {
82
- hidePopup();
83
- }
84
- }, [
85
- isGenerating
86
- ]);
87
- useEffect(()=>{
88
- if (productElement.productId) {
89
- setIsShowMore(false);
90
- return;
91
- }
92
- setIsShowMore(true);
93
- }, [
94
- productElement
95
- ]);
96
- useEffect(()=>{
97
- window.addEventListener('editor:active-component', onActiveComponent);
98
- return ()=>{
99
- window.removeEventListener('editor:active-component', onActiveComponent);
100
- };
101
- }, [
102
- onActiveComponent
103
- ]);
104
- return /*#__PURE__*/ jsxs("div", {
105
- className: "gp-gen-content-toolbar-wrapper gp-relative",
106
- ref: genTool,
107
- children: [
108
- /*#__PURE__*/ jsx("div", {
109
- className: "gp-gen-content-btn gp-border-r gp-pr-1 gp-mr-1",
110
- children: /*#__PURE__*/ jsxs("button", {
111
- className: classNames({
112
- 'gp-toolbar-ai-active': isShowPopup
113
- }, 'gp-p-1 gp-text-xs gp-flex gp-gap-1 gp-items-center gp-rounded-md hover:gp-bg-[#3B3B3B] gp-font-medium'),
114
- onClick: togglePopup,
115
- children: [
116
- /*#__PURE__*/ jsx(AIIcon, {}),
117
- "AI Content"
118
- ]
119
- })
120
- }),
121
- /*#__PURE__*/ jsxs("div", {
122
- className: classNames({
123
- 'gp-hidden': !isShowPopup,
124
- 'gp-right-0': props.tag === 'Section' || popupPositionX === 'right',
125
- 'gp-left-0': popupPositionX === 'left' && props.tag !== 'Section',
126
- 'gp-top-8': popupPositionY === 'top',
127
- 'gp-bottom-8': popupPositionY === 'bottom',
128
- '!gp-visible': !isValidatingFlipPopup
129
- }, 'gp-absolute gp-invisible gp-rounded-lg gp-bg-[#151515] gp-w-[312px] !gp-max-w-[312px] !gp-cursor-default'),
130
- ref: genPopup,
131
- children: [
132
- /*#__PURE__*/ jsxs("div", {
133
- className: "gp-flex gp-items-center gp-justify-between gp-px-4 gp-py-[10px]",
134
- ref: genPopupHeader,
135
- children: [
136
- /*#__PURE__*/ jsx("span", {
137
- className: "gp-font-medium gp-text-sm",
138
- children: "Write with GemAI"
139
- }),
140
- /*#__PURE__*/ jsx("button", {
141
- className: "gp-p-2 gp-cursor-pointer hover:gp-bg-[#3B3B3B] gp-rounded-md",
142
- onClick: hidePopup,
143
- children: /*#__PURE__*/ jsx(CloseIcon, {})
144
- })
145
- ]
146
- }),
147
- /*#__PURE__*/ jsx("div", {
148
- className: classNames({
149
- 'gp-overflow-auto': popupBodyMaxHeight !== null
150
- }, 'gp-pt-2 gp-text-left gp-px-4 scrollbar:gp-w-1 scrollbar-thumb:gp-bg-[#999] scrollbar-thumb:gp-rounded-xl'),
151
- style: {
152
- maxHeight: popupBodyMaxHeight !== null ? `${popupBodyMaxHeight}px` : 'auto'
153
- },
154
- children: generateLimitation?.isAllow ? /*#__PURE__*/ jsxs(Fragment, {
155
- children: [
156
- /*#__PURE__*/ jsx("div", {
157
- className: "gp-mb-4",
158
- children: /*#__PURE__*/ jsx("span", {
159
- className: "gp-text-xs",
160
- children: "What would you like to describe here?"
161
- })
162
- }),
163
- /*#__PURE__*/ jsx("div", {
164
- className: "gp-mb-4 gp-flex",
165
- children: /*#__PURE__*/ jsx("textarea", {
166
- 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",
167
- placeholder: "e.g: generate feature benefits",
168
- rows: 4,
169
- value: prompt,
170
- onChange: onChangePrompt
171
- })
172
- }),
173
- /*#__PURE__*/ jsxs("div", {
174
- className: classNames({
175
- 'gp-hidden': !isShowMore
176
- }, 'gp-mb-4 gp-gap-4 gp-flex gp-flex-col'),
177
- children: [
178
- /*#__PURE__*/ jsx(ToneAndVoice, {
179
- changeToneAndVoice: changeTone
180
- }),
181
- /*#__PURE__*/ jsx(PickProduct, {
182
- changeProductName: changeProductName,
183
- openProductSetting: handleOpenProductSetting,
184
- productId: productElement.productId
185
- })
186
- ]
187
- }),
188
- /*#__PURE__*/ jsx("div", {
189
- children: /*#__PURE__*/ jsxs("button", {
190
- 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",
191
- onClick: toggleShowMore,
192
- children: [
193
- "Show more",
194
- /*#__PURE__*/ jsx("span", {
195
- className: classNames({
196
- 'gp-rotate-180': isShowMore
197
- }),
198
- children: /*#__PURE__*/ jsx(ShowMoreIcon, {})
199
- })
200
- ]
201
- })
202
- })
203
- ]
204
- }) : /*#__PURE__*/ jsxs("div", {
205
- className: "gp-flex gp-gap-2 gp-p-3 gp-rounded-xl gp-bg-[#FDB913] gp-bg-opacity-20",
206
- children: [
207
- /*#__PURE__*/ jsx("div", {
208
- className: "gp-flex-none gp-w-7 gp-h-7 gp-rounded-lg gp-bg-[#FFB800] gp-flex gp-justify-center gp-items-center",
209
- children: /*#__PURE__*/ jsx(WarningIcon, {})
210
- }),
211
- /*#__PURE__*/ jsxs("p", {
212
- className: "gp-text-xs gp-whitespace-normal",
213
- children: [
214
- "You've reached ",
215
- generateLimitation?.maxGenerateCount,
216
- "/",
217
- generateLimitation?.maxGenerateCount,
218
- " rewrites of your AI generative this month.",
219
- /*#__PURE__*/ jsx("br", {}),
220
- "Resets on ",
221
- nextMonth,
222
- "."
223
- ]
224
- })
225
- ]
226
- })
227
- }),
228
- /*#__PURE__*/ jsx("div", {
229
- className: "gp-p-4",
230
- ref: genButtonWrapper,
231
- children: generateLimitation?.isAllow ? /*#__PURE__*/ jsx("button", {
232
- 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",
233
- onClick: handleGenerateContent,
234
- children: isGenerating ? 'Generating...' : 'Generate'
235
- }) : /*#__PURE__*/ jsxs("button", {
236
- 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",
237
- onClick: goToPricing,
238
- children: [
239
- /*#__PURE__*/ jsx(UpgradeIcon, {}),
240
- generateLimitation?.nextQuota ? `Upgrade to generate ${generateLimitation?.nextQuota} rewrites` : 'You have reached limit this month'
241
- ]
242
- })
243
- })
244
- ]
245
- })
246
- ]
247
- });
248
- };
249
-
250
- export { AIContentGenerator };
1
+ 'use client';
2
+ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import{useState as p,useRef as r,useCallback as n,useEffect as i}from"react";import{AIIcon as g}from"./icons/AIIcon.js";import{CloseIcon as s}from"./icons/CloseIcon.js";import{ShowMoreIcon as a}from"./icons/ShowMoreIcon.js";import{WarningIcon as l}from"./icons/WarningIcon.js";import{UpgradeIcon as m}from"./icons/UpgradeIcon.js";import{PickProduct as c}from"./components/PickProduct.js";import{ToneAndVoice as d}from"./components/ToneAndVoice.js";import u from"classnames";import{useListenEventGenerate as h}from"./hooks/useListenEventGenerate.js";import{useGettingGenerateRequest as f}from"./hooks/useGettingGenerateRequest.js";import{useFlipPopup as x}from"./hooks/useFlipPopup.js";import{useCheckingProductInside as b}from"./hooks/useCheckingProductInside.js";import"zustand";import{useI18nStore as v}from"../../contexts/I18nContext.js";import"react-transition-group";import"@gem-sdk/core";import{useShopStore as w}from"../../contexts/ShopContext.js";import j from"dayjs";import"swr";import"../../helpers/convert.js";import"@gem-sdk/adapter-shopify";import"swr/mutation";import"swr/infinite";import"vanilla-lazyload";import"../../hooks/useCartUI.js";import"../../hooks/useStickyStore.js";let AIContentGenerator=({...N})=>{let[C,k]=p(!1),[y,I]=p(!1),A=r(null),G=r(null),S=r(null),B=r(null),F=j().add(1,"month").startOf("month").format("DD MMM"),{t:P}=v(),{popupPositionX:D,popupPositionY:E,isValidating:M,bodyMaxHeight:L}=x(C,{genTool:A,genPopup:G,genPopupHeader:S,genButtonWrapper:B}),{isGenerating:U,onGenerate:z,onOpenProductElementSettings:V,goToPricing:W}=h({uid:N.uid,tag:String(N.tag)}),{getRequestBody:H,prompt:Q,changeProductName:R,changePrompt:T,changeTone:Y}=f(),{productElement:$,checkSectionHasProduct:q}=b(A),O=w(e=>e.generateContentLimitation),J=()=>{k(!C)},K=()=>{k(!1)},X=e=>{T(e.target.value)},Z=n(e=>{let t=e.detail;if(t?.componentUid!==N.uid){K();return}q()},[N.uid,q]),_=()=>{I(!y)},ee=()=>{let e=H();z(e),K()},et=()=>{V($.uid??"")};return i(()=>{U||K()},[U]),i(()=>{if($.productId){I(!1);return}I(!0)},[$]),i(()=>(window.addEventListener("editor:active-component",Z),()=>{window.removeEventListener("editor:active-component",Z)}),[Z]),e("div",{className:"gp-gen-content-toolbar-wrapper gp-relative",ref:A,children:[t("div",{className:"gp-gen-content-btn gp-border-r gp-pr-1 gp-mr-1",children:e("button",{className:u({"gp-toolbar-ai-active":C},"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:J,children:[t(g,{}),P("AI Content")]})}),e("div",{className:u({"gp-hidden":!C,"gp-right-0":"Section"===N.tag||"right"===D,"gp-left-0":"left"===D&&"Section"!==N.tag,"gp-top-8":"top"===E,"gp-bottom-8":"bottom"===E,"!gp-visible":!M},"gp-absolute gp-invisible gp-rounded-lg gp-bg-[#151515] gp-w-[312px] !gp-max-w-[312px] !gp-cursor-default"),ref:G,children:[e("div",{className:"gp-flex gp-items-center gp-justify-between gp-px-4 gp-py-[10px]",ref:S,children:[t("span",{className:"gp-font-medium gp-text-sm",children:"Write with GemAI"}),t("button",{className:"gp-p-2 gp-cursor-pointer hover:gp-bg-[#3B3B3B] gp-rounded-md",onClick:K,children:t(s,{})})]}),t("div",{className:u({"gp-overflow-auto":null!==L},"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!==L?`${L}px`:"auto"},children:O?.isAllow?e(o,{children:[t("div",{className:"gp-mb-4",children:t("span",{className:"gp-text-xs",children:"What would you like to describe here?"})}),t("div",{className:"gp-mb-4 gp-flex",children:t("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:Q,onChange:X})}),e("div",{className:u({"gp-hidden":!y},"gp-mb-4 gp-gap-4 gp-flex gp-flex-col"),children:[t(d,{changeToneAndVoice:Y}),t(c,{changeProductName:R,openProductSetting:et,productId:$.productId})]}),t("div",{children:e("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:_,children:["Show more",t("span",{className:u({"gp-rotate-180":y}),children:t(a,{})})]})})]}):e("div",{className:"gp-flex gp-gap-2 gp-p-3 gp-rounded-xl gp-bg-[#FDB913] gp-bg-opacity-20",children:[t("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:t(l,{})}),e("p",{className:"gp-text-xs gp-whitespace-normal",children:["You've reached ",O?.maxGenerateCount,"/",O?.maxGenerateCount," rewrites of your AI generative this month.",t("br",{}),"Resets on ",F,"."]})]})}),t("div",{className:"gp-p-4",ref:B,children:O?.isAllow?t("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:ee,children:U?"Generating...":"Generate"}):e("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:W,children:[t(m,{}),O?.nextQuota?`Upgrade to generate ${O?.nextQuota} rewrites`:"You have reached limit this month"]})})]})]})};export{AIContentGenerator};
@@ -1,83 +1,2 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { useState, useRef, useCallback, useEffect } from 'react';
3
- import { AIIcon } from './icons/AIIcon.js';
4
-
5
- function getRandomArbitrary(min, max) {
6
- const randomNum = Math.random();
7
- return randomNum * (max - min) + min;
8
- }
9
- const AIGenContentLoading = ({ ...props })=>{
10
- const [isGenerating, setIsGenerating] = useState(false);
11
- const [time, setTime] = useState(0);
12
- const interval = useRef(null);
13
- const onGenerateContentStatus = useCallback((e)=>{
14
- const detail = e.detail;
15
- if (detail?.generatingUid !== props.uid) {
16
- return;
17
- }
18
- if (detail.status === 'loading') {
19
- setIsGenerating(true);
20
- return;
21
- }
22
- if (detail.status === 'success') {
23
- setIsGenerating(false);
24
- return;
25
- }
26
- }, [
27
- props.uid
28
- ]);
29
- useEffect(()=>{
30
- if (isGenerating) {
31
- handleFakeLoading();
32
- } else {
33
- setTime(0);
34
- }
35
- return ()=>{
36
- interval.current && clearInterval(interval.current);
37
- };
38
- }, [
39
- isGenerating
40
- ]);
41
- const handleFakeLoading = ()=>{
42
- setTime(0);
43
- interval.current = setInterval(()=>{
44
- setTime((time)=>{
45
- const randomNum = getRandomArbitrary(0, 6);
46
- return time >= 580 ? time : time + randomNum;
47
- });
48
- }, 50);
49
- };
50
- useEffect(()=>{
51
- window.addEventListener('editor:ai-generate-content-status', onGenerateContentStatus);
52
- return ()=>{
53
- window.removeEventListener('editor:ai-generate-content-status', onGenerateContentStatus);
54
- };
55
- }, [
56
- onGenerateContentStatus
57
- ]);
58
- return isGenerating ? /*#__PURE__*/ jsxs("div", {
59
- 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",
60
- children: [
61
- /*#__PURE__*/ jsx("div", {
62
- className: "gp-absolute gp-left-0 gp-top-0 gp-z-2 gp-flex gp-h-full gp-w-full",
63
- children: /*#__PURE__*/ jsxs("div", {
64
- className: `gp-relative gp-h-[2px] gp-w-full gp-overflow-hidden gp-rounded-md`,
65
- children: [
66
- /*#__PURE__*/ jsx("div", {
67
- className: "gp-absolute gp-h-full gp-w-full gp-rounded-md gp-bg-[#F4F4F4]"
68
- }),
69
- /*#__PURE__*/ jsx("div", {
70
- className: "gps-image-to-layout-progress-bar gp-absolute gp-h-full gp-rounded-md gp-transition-all",
71
- style: {
72
- width: `${time / 600 * 100}%`
73
- }
74
- })
75
- ]
76
- })
77
- }),
78
- /*#__PURE__*/ jsx(AIIcon, {})
79
- ]
80
- }) : null;
81
- };
82
-
83
- export { AIGenContentLoading };
1
+ 'use client';
2
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as r,useRef as n,useCallback as l,useEffect as g}from"react";import{AIIcon as a}from"./icons/AIIcon.js";function getRandomArbitrary(e,t){return Math.random()*(t-e)+e}let AIGenContentLoading=({...i})=>{let[p,o]=r(!1),[s,d]=r(0),u=n(null),c=l(e=>{let t=e.detail;if(t?.generatingUid===i.uid){if("loading"===t.status){o(!0);return}if("success"===t.status){o(!1);return}}},[i.uid]);g(()=>(p?f():d(0),()=>{u.current&&clearInterval(u.current)}),[p]);let f=()=>{d(0),u.current=setInterval(()=>{d(e=>{let t=getRandomArbitrary(0,6);return e>=580?e:e+t})},50)};return g(()=>(window.addEventListener("editor:ai-generate-content-status",c),()=>{window.removeEventListener("editor:ai-generate-content-status",c)}),[c]),p?e("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:[t("div",{className:"gp-absolute gp-left-0 gp-top-0 gp-z-2 gp-flex gp-h-full gp-w-full",children:e("div",{className:"gp-relative gp-h-[2px] gp-w-full gp-overflow-hidden gp-rounded-md",children:[t("div",{className:"gp-absolute gp-h-full gp-w-full gp-rounded-md gp-bg-[#F4F4F4]"}),t("div",{className:"gps-image-to-layout-progress-bar gp-absolute gp-h-full gp-rounded-md gp-transition-all",style:{width:`${s/600*100}%`}})]})}),t(a,{})]}):null};export{AIGenContentLoading};
@@ -1,218 +1,2 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { useState, useRef, useMemo, useEffect } from 'react';
3
- import { SearchIcon } from '../icons/SearchIcon.js';
4
- import { useListProductQuery } from '../../../hooks/shop/use-products-query.js';
5
- import classNames from 'classnames';
6
- import 'zustand';
7
- import 'react-transition-group';
8
- import '@gem-sdk/core';
9
- import 'swr';
10
- import 'dayjs';
11
- import '../../../helpers/convert.js';
12
- import '@gem-sdk/adapter-shopify';
13
- import 'swr/mutation';
14
- import { useProductQuery } from '../../../hooks/shop/use-product-query.js';
15
- import 'vanilla-lazyload';
16
- import '../../../hooks/useCartUI.js';
17
-
18
- const PickProduct = (props)=>{
19
- const LIMIT_PRODUCTS = 8;
20
- const [productVariables, setProductVariables] = useState(!props.productId ? {
21
- first: LIMIT_PRODUCTS
22
- } : undefined);
23
- const { data: productList, isLoading: isLoadingGetProducts, isValidating: isValidatingGetProducts, size: productsSize, setSize: setProductsSize } = useListProductQuery(productVariables, {
24
- revalidateFirstPage: false
25
- });
26
- const { data: sectionProduct } = useProductQuery(props.productId);
27
- const [activeProduct, setActiveProduct] = useState();
28
- const [isShowChooseProduct, setIsShowChooseProduct] = useState(false);
29
- const debounceSearch = useRef(null);
30
- const debounceScroll = useRef(null);
31
- const toggleChooseProduct = ()=>{
32
- if (props.productId) return;
33
- setIsShowChooseProduct(!isShowChooseProduct);
34
- };
35
- const chooseProduct = (product)=>{
36
- setActiveProduct(product);
37
- setIsShowChooseProduct(false);
38
- };
39
- const searchProduct = (e)=>{
40
- debounceSearch.current && clearTimeout(debounceSearch.current);
41
- debounceSearch.current = setTimeout(()=>{
42
- const searchValue = e.target.value ?? '';
43
- if (searchValue) {
44
- setProductVariables({
45
- first: LIMIT_PRODUCTS,
46
- where: {
47
- titleContainsFold: searchValue
48
- }
49
- });
50
- return;
51
- }
52
- setProductVariables({
53
- first: LIMIT_PRODUCTS
54
- });
55
- }, 200);
56
- };
57
- const handleOpenProductElementSettings = ()=>{
58
- props.openProductSetting();
59
- };
60
- const handleLoadMore = (e)=>{
61
- const target = e.target;
62
- if (target.scrollHeight - target.scrollTop === target.clientHeight) {
63
- debounceScroll.current && clearTimeout(debounceScroll.current);
64
- debounceScroll.current = setTimeout(()=>{
65
- setProductsSize(productsSize + 1);
66
- }, 50);
67
- }
68
- };
69
- const products = useMemo(()=>{
70
- return productList?.reduce((acc, curr)=>{
71
- return [
72
- ...acc,
73
- ...curr.products?.edges ?? []
74
- ];
75
- }, []) ?? [];
76
- }, [
77
- productList
78
- ]);
79
- useEffect(()=>{
80
- if (products.length && !activeProduct && !props.productId) {
81
- const firstProduct = products[0]?.node;
82
- if (!firstProduct) return;
83
- setActiveProduct({
84
- id: firstProduct?.id,
85
- name: firstProduct?.title,
86
- image: firstProduct.featuredImage?.src
87
- });
88
- }
89
- }, [
90
- products,
91
- activeProduct,
92
- props.productId
93
- ]);
94
- useEffect(()=>{
95
- if (activeProduct && activeProduct.name) {
96
- props.changeProductName(activeProduct.name);
97
- }
98
- }, [
99
- activeProduct,
100
- props
101
- ]);
102
- useEffect(()=>{
103
- if (sectionProduct) {
104
- setActiveProduct({
105
- id: sectionProduct.id,
106
- name: sectionProduct.title,
107
- image: sectionProduct.featuredImage?.src
108
- });
109
- }
110
- }, [
111
- sectionProduct
112
- ]);
113
- const NO_IMAGE_SRC = 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif';
114
- return /*#__PURE__*/ jsxs("div", {
115
- className: "gp-flex gp-flex-col gp-gap-2",
116
- children: [
117
- /*#__PURE__*/ jsx("p", {
118
- className: "gp-py-2 gp-text-xs",
119
- children: "Product"
120
- }),
121
- /*#__PURE__*/ jsxs("div", {
122
- className: "gp-relative",
123
- children: [
124
- !isLoadingGetProducts || activeProduct ? /*#__PURE__*/ jsxs("button", {
125
- className: classNames({
126
- 'gp-cursor-default': props.productId
127
- }, 'gp-flex gp-gap-2 gp-items-center gp-w-full gp-p-2 gp-rounded-lg gp-bg-[#333333] gp-text-xs'),
128
- onClick: toggleChooseProduct,
129
- children: [
130
- /*#__PURE__*/ jsx("img", {
131
- className: "gp-rounded-lg gp-w-10 gp-h-10",
132
- src: activeProduct?.image || NO_IMAGE_SRC,
133
- alt: "product_image"
134
- }),
135
- /*#__PURE__*/ jsx("span", {
136
- className: "gp-truncate gp-max-w-[210px]",
137
- children: activeProduct?.name
138
- })
139
- ]
140
- }) : /*#__PURE__*/ jsx("div", {
141
- children: /*#__PURE__*/ jsx("span", {
142
- className: "gp-text-xs",
143
- children: "Getting products..."
144
- })
145
- }),
146
- props.productId && /*#__PURE__*/ jsx("div", {
147
- className: "gp-mt-2 gp-text-xs",
148
- children: /*#__PURE__*/ jsxs("p", {
149
- children: [
150
- "You can manage it in",
151
- ' ',
152
- /*#__PURE__*/ jsx("button", {
153
- className: "gp-text-[#8AA4FF] gp-cursor-pointer hover:gp-underline",
154
- onClick: handleOpenProductElementSettings,
155
- children: "Product element"
156
- })
157
- ]
158
- })
159
- }),
160
- isShowChooseProduct && /*#__PURE__*/ jsxs("div", {
161
- 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",
162
- children: [
163
- /*#__PURE__*/ jsxs("div", {
164
- className: "gp-flex gp-items-center gp-gap-2 gp-p-2",
165
- children: [
166
- /*#__PURE__*/ jsx(SearchIcon, {}),
167
- /*#__PURE__*/ jsx("input", {
168
- className: "gp-bg-transparent gp-w-full focus-visible:!gp-outline-none gp-text-xs",
169
- placeholder: "Search product...",
170
- onChange: searchProduct
171
- })
172
- ]
173
- }),
174
- /*#__PURE__*/ jsxs("div", {
175
- className: "gp-max-h-[168px] gp-overflow-auto scrollbar:gp-w-1 scrollbar-thumb:gp-bg-[#999] scrollbar-thumb:gp-rounded-xl",
176
- onScroll: handleLoadMore,
177
- children: [
178
- products?.map((item)=>{
179
- return /*#__PURE__*/ jsxs("button", {
180
- className: "gp-flex gp-p-2 hover:gp-bg-[#3B3B3B] gp-rounded-lg gp-cursor-pointer gp-gap-2 gp-items-center",
181
- onClick: ()=>{
182
- chooseProduct({
183
- id: item.node?.id,
184
- name: item.node?.title,
185
- image: item.node?.featuredImage?.src
186
- });
187
- },
188
- children: [
189
- /*#__PURE__*/ jsx("img", {
190
- className: "gp-rounded-lg gp-w-10 gp-h-10",
191
- src: item.node?.featuredImage?.src || NO_IMAGE_SRC,
192
- alt: "product_image"
193
- }),
194
- /*#__PURE__*/ jsx("span", {
195
- className: "gp-truncate gp-max-w-[210px] gp-text-xs",
196
- children: item.node?.title
197
- })
198
- ]
199
- }, item.node?.id);
200
- }),
201
- isLoadingGetProducts || isValidatingGetProducts && /*#__PURE__*/ jsx("div", {
202
- className: "gp-p-2",
203
- children: /*#__PURE__*/ jsx("span", {
204
- className: "gp-text-xs",
205
- children: "Getting products..."
206
- })
207
- })
208
- ]
209
- })
210
- ]
211
- })
212
- ]
213
- })
214
- ]
215
- });
216
- };
217
-
218
- export { PickProduct };
1
+ 'use client';
2
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as r,useRef as p,useMemo as a,useEffect as o}from"react";import{SearchIcon as s}from"../icons/SearchIcon.js";import{useListProductQuery as i}from"../../../hooks/shop/use-products-query.js";import l from"classnames";import"zustand";import"react-transition-group";import"@gem-sdk/core";import"swr";import"dayjs";import"../../../helpers/convert.js";import"@gem-sdk/adapter-shopify";import"swr/mutation";import{useProductQuery as c}from"../../../hooks/shop/use-product-query.js";import"vanilla-lazyload";import"../../../hooks/useCartUI.js";import"../../../hooks/useStickyStore.js";let PickProduct=g=>{let[d,n]=r(g.productId?void 0:{first:8}),{data:m,isLoading:u,isValidating:h,size:f,setSize:x}=i(d,{revalidateFirstPage:!1}),{data:b}=c(g.productId),[N,v]=r(),[I,k]=r(!1),w=p(null),P=p(null),j=()=>{g.productId||k(!I)},y=e=>{v(e),k(!1)},S=e=>{w.current&&clearTimeout(w.current),w.current=setTimeout(()=>{let t=e.target.value??"";if(t){n({first:8,where:{titleContainsFold:t}});return}n({first:8})},200)},C=()=>{g.openProductSetting()},z=e=>{let t=e.target;t.scrollHeight-t.scrollTop===t.clientHeight&&(P.current&&clearTimeout(P.current),P.current=setTimeout(()=>{x(f+1)},50))},T=a(()=>m?.reduce((e,t)=>[...e,...t.products?.edges??[]],[])??[],[m]);o(()=>{if(T.length&&!N&&!g.productId){let e=T[0]?.node;e&&v({id:e?.id,name:e?.title,image:e.featuredImage?.src})}},[T,N,g.productId]),o(()=>{N&&N.name&&g.changeProductName(N.name)},[N,g]),o(()=>{b&&v({id:b.id,name:b.title,image:b.featuredImage?.src})},[b]);let F="https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif";return e("div",{className:"gp-flex gp-flex-col gp-gap-2",children:[t("p",{className:"gp-py-2 gp-text-xs",children:"Product"}),e("div",{className:"gp-relative",children:[!u||N?e("button",{className:l({"gp-cursor-default":g.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:j,children:[t("img",{className:"gp-rounded-lg gp-w-10 gp-h-10",src:N?.image||F,alt:"product_image"}),t("span",{className:"gp-truncate gp-max-w-[210px]",children:N?.name})]}):t("div",{children:t("span",{className:"gp-text-xs",children:"Getting products..."})}),g.productId&&t("div",{className:"gp-mt-2 gp-text-xs",children:e("p",{children:["You can manage it in"," ",t("button",{className:"gp-text-[#8AA4FF] gp-cursor-pointer hover:gp-underline",onClick:C,children:"Product element"})]})}),I&&e("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:[e("div",{className:"gp-flex gp-items-center gp-gap-2 gp-p-2",children:[t(s,{}),t("input",{className:"gp-bg-transparent gp-w-full focus-visible:!gp-outline-none gp-text-xs",placeholder:"Search product...",onChange:S})]}),e("div",{className:"gp-max-h-[168px] gp-overflow-auto scrollbar:gp-w-1 scrollbar-thumb:gp-bg-[#999] scrollbar-thumb:gp-rounded-xl",onScroll:z,children:[T?.map(r=>e("button",{className:"gp-flex gp-p-2 hover:gp-bg-[#3B3B3B] gp-rounded-lg gp-cursor-pointer gp-gap-2 gp-items-center",onClick:()=>{y({id:r.node?.id,name:r.node?.title,image:r.node?.featuredImage?.src})},children:[t("img",{className:"gp-rounded-lg gp-w-10 gp-h-10",src:r.node?.featuredImage?.src||F,alt:"product_image"}),t("span",{className:"gp-truncate gp-max-w-[210px] gp-text-xs",children:r.node?.title})]},r.node?.id)),u||h&&t("div",{className:"gp-p-2",children:t("span",{className:"gp-text-xs",children:"Getting products..."})})]})]})]})]})};export{PickProduct};
@@ -1,75 +1,2 @@
1
- import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { useState, useEffect } from 'react';
3
- import { DropdownIcon, TickIcon } from '../icons/DropdownIcon.js';
4
- import classNames from 'classnames';
5
-
6
- const ToneAndVoice = (props)=>{
7
- const listToneAndVoice = [
8
- 'Persuasive',
9
- 'Friendly',
10
- 'Professional',
11
- 'Casual'
12
- ];
13
- const [tone, setTone] = useState(listToneAndVoice[0]);
14
- const [isShow, setIsShow] = useState(false);
15
- const toggle = ()=>{
16
- setIsShow(!isShow);
17
- };
18
- const setValue = (value)=>{
19
- setTone(value);
20
- setIsShow(false);
21
- };
22
- useEffect(()=>{
23
- tone && props.changeToneAndVoice(tone);
24
- }, [
25
- tone,
26
- props
27
- ]);
28
- return /*#__PURE__*/ jsx("div", {
29
- children: /*#__PURE__*/ jsxs("div", {
30
- className: "gp-flex gp-flex-col gp-gap-2",
31
- children: [
32
- /*#__PURE__*/ jsx("p", {
33
- className: "gp-py-2 gp-text-xs",
34
- children: "Tone and Voice"
35
- }),
36
- /*#__PURE__*/ jsxs("div", {
37
- className: "gp-relative",
38
- children: [
39
- /*#__PURE__*/ jsxs("button", {
40
- className: "gp-flex gp-justify-between gp-items-center gp-w-full gp-p-2 gp-rounded-lg gp-bg-[#333333] gp-text-xs",
41
- onClick: toggle,
42
- children: [
43
- tone,
44
- /*#__PURE__*/ jsx(DropdownIcon, {})
45
- ]
46
- }),
47
- isShow ? /*#__PURE__*/ jsx("div", {
48
- className: "gp-absolute gp-w-full gp-top-10 gp-left-0 gp-rounded-lg gp-bg-[#333333] gp-p-2 gp-flex gp-flex-col gp-gap-2 gp-z-10",
49
- children: listToneAndVoice.map((item)=>{
50
- return /*#__PURE__*/ jsxs("button", {
51
- className: "gp-flex gp-p-2 hover:gp-bg-[#3B3B3B] gp-rounded-lg gp-cursor-pointer gp-gap-3 gp-items-center",
52
- onClick: ()=>setValue(item),
53
- children: [
54
- /*#__PURE__*/ jsx("div", {
55
- className: classNames({
56
- 'gp-invisible': tone !== item
57
- }),
58
- children: /*#__PURE__*/ jsx(TickIcon, {})
59
- }),
60
- /*#__PURE__*/ jsx("span", {
61
- className: "gp-text-xs",
62
- children: item
63
- })
64
- ]
65
- }, item);
66
- })
67
- }) : null
68
- ]
69
- })
70
- ]
71
- })
72
- });
73
- };
74
-
75
- export { ToneAndVoice };
1
+ 'use client';
2
+ import{jsx as e,jsxs as p}from"react/jsx-runtime";import{useState as l,useEffect as g}from"react";import{DropdownIcon as n,TickIcon as i}from"../icons/DropdownIcon.js";import o from"classnames";let ToneAndVoice=r=>{let s=["Persuasive","Friendly","Professional","Casual"],[c,a]=l(s[0]),[t,d]=l(!1),m=()=>{d(!t)},f=e=>{a(e),d(!1)};return g(()=>{c&&r.changeToneAndVoice(c)},[c,r]),e("div",{children:p("div",{className:"gp-flex gp-flex-col gp-gap-2",children:[e("p",{className:"gp-py-2 gp-text-xs",children:"Tone and Voice"}),p("div",{className:"gp-relative",children:[p("button",{className:"gp-flex gp-justify-between gp-items-center gp-w-full gp-p-2 gp-rounded-lg gp-bg-[#333333] gp-text-xs",onClick:m,children:[c,e(n,{})]}),t?e("div",{className:"gp-absolute gp-w-full gp-top-10 gp-left-0 gp-rounded-lg gp-bg-[#333333] gp-p-2 gp-flex gp-flex-col gp-gap-2 gp-z-10",children:s.map(l=>p("button",{className:"gp-flex gp-p-2 hover:gp-bg-[#3B3B3B] gp-rounded-lg gp-cursor-pointer gp-gap-3 gp-items-center",onClick:()=>f(l),children:[e("div",{className:o({"gp-invisible":c!==l}),children:e(i,{})}),e("span",{className:"gp-text-xs",children:l})]},l))}):null]})]})})};export{ToneAndVoice};