@gem-sdk/core 1.14.0-next.96 → 1.14.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 (241) hide show
  1. package/dist/cjs/components/AddOn.js +18 -1
  2. package/dist/cjs/components/ComponentWrapper.js +28 -1
  3. package/dist/cjs/components/ComponentWrapperPreview.js +72 -1
  4. package/dist/cjs/components/Empty.js +7 -1
  5. package/dist/cjs/components/Render.js +65 -1
  6. package/dist/cjs/components/Render.liquid.js +158 -3
  7. package/dist/cjs/components/RenderBlock.js +54 -1
  8. package/dist/cjs/components/RenderPreview.js +66 -1
  9. package/dist/cjs/components/RenderSection.js +23 -1
  10. package/dist/cjs/components/constant.js +39 -1
  11. package/dist/cjs/contexts/AddonContext.js +36 -1
  12. package/dist/cjs/contexts/BuilderComponent.js +34 -1
  13. package/dist/cjs/contexts/BuilderContext.js +35 -1
  14. package/dist/cjs/contexts/BuilderPreviewContext.js +370 -1
  15. package/dist/cjs/contexts/CartLineContext.js +29 -1
  16. package/dist/cjs/contexts/CollectionContext.js +38 -1
  17. package/dist/cjs/contexts/ModalContext.js +47 -1
  18. package/dist/cjs/contexts/ProductContext.js +149 -1
  19. package/dist/cjs/contexts/ProductListContext.js +32 -1
  20. package/dist/cjs/contexts/SectionContext.js +53 -1
  21. package/dist/cjs/contexts/ShopContext.js +70 -1
  22. package/dist/cjs/graphql/fragments/analytic.generated.js +6 -2
  23. package/dist/cjs/graphql/fragments/collection-detail.generated.js +6 -2
  24. package/dist/cjs/graphql/fragments/collection-product.generated.js +6 -2
  25. package/dist/cjs/graphql/fragments/collection.generated.js +6 -2
  26. package/dist/cjs/graphql/fragments/custom-code.generated.js +6 -2
  27. package/dist/cjs/graphql/fragments/data-seo.generated.js +6 -2
  28. package/dist/cjs/graphql/fragments/media.generated.js +6 -3
  29. package/dist/cjs/graphql/fragments/product-little.generated.js +6 -2
  30. package/dist/cjs/graphql/fragments/product-option-value.generated.js +6 -2
  31. package/dist/cjs/graphql/fragments/product-option.generated.js +6 -2
  32. package/dist/cjs/graphql/fragments/product.generated.js +6 -2
  33. package/dist/cjs/graphql/fragments/published-custom-section.generated.js +6 -2
  34. package/dist/cjs/graphql/fragments/published-page-section.generated.js +6 -2
  35. package/dist/cjs/graphql/fragments/published-theme-page.generated.js +6 -2
  36. package/dist/cjs/graphql/fragments/published-theme-style.generated.js +6 -2
  37. package/dist/cjs/graphql/fragments/selected-option.generated.js +6 -2
  38. package/dist/cjs/graphql/fragments/variant.generated.js +6 -2
  39. package/dist/cjs/graphql/mutations/page-view-up.generated.js +7 -3
  40. package/dist/cjs/graphql/queries/collection-detail-filter.generated.js +16 -2
  41. package/dist/cjs/graphql/queries/collection.generated.js +14 -2
  42. package/dist/cjs/graphql/queries/collections.generated.js +9 -2
  43. package/dist/cjs/graphql/queries/preview-page.generated.js +14 -2
  44. package/dist/cjs/graphql/queries/product-little-detail.generated.js +11 -2
  45. package/dist/cjs/graphql/queries/product-medias.generated.js +8 -2
  46. package/dist/cjs/graphql/queries/product-variants.generated.js +10 -2
  47. package/dist/cjs/graphql/queries/products.generated.js +17 -3
  48. package/dist/cjs/graphql/queries/published-theme-pages.generated.js +14 -2
  49. package/dist/cjs/graphql/queries/store-property.generated.js +6 -2
  50. package/dist/cjs/helpers/GlobalEvent.js +19 -1
  51. package/dist/cjs/helpers/background.js +109 -1
  52. package/dist/cjs/helpers/borders.js +183 -4
  53. package/dist/cjs/helpers/clone-deep.js +5 -1
  54. package/dist/cjs/helpers/cls.js +16 -1
  55. package/dist/cjs/helpers/colors.js +183 -1
  56. package/dist/cjs/helpers/compose-advance-style.js +188 -1
  57. package/dist/cjs/helpers/constant.js +23 -1
  58. package/dist/cjs/helpers/convert.js +7 -1
  59. package/dist/cjs/helpers/css-variable.js +7 -1
  60. package/dist/cjs/helpers/email.js +11 -1
  61. package/dist/cjs/helpers/flatten-connection.js +9 -1
  62. package/dist/cjs/helpers/get-resonsive-value.js +31 -1
  63. package/dist/cjs/helpers/get-shortname.js +92 -1
  64. package/dist/cjs/helpers/is-browser.js +9 -1
  65. package/dist/cjs/helpers/is-defined.js +7 -1
  66. package/dist/cjs/helpers/is-empty-children.js +12 -1
  67. package/dist/cjs/helpers/is-safari.js +9 -1
  68. package/dist/cjs/helpers/layout.js +59 -1
  69. package/dist/cjs/helpers/load-script.js +31 -1
  70. package/dist/cjs/helpers/make-style.js +128 -1
  71. package/dist/cjs/helpers/normalize-builder-data.js +23 -1
  72. package/dist/cjs/helpers/prefetch-queries.js +78 -1
  73. package/dist/cjs/helpers/product.js +45 -1
  74. package/dist/cjs/helpers/queries/get-collection.js +220 -1
  75. package/dist/cjs/helpers/queries/get-collections.js +21 -1
  76. package/dist/cjs/helpers/queries/get-product-by-slug.js +125 -1
  77. package/dist/cjs/helpers/queries/get-product.js +154 -1
  78. package/dist/cjs/helpers/queries/get-products.js +161 -1
  79. package/dist/cjs/helpers/query.js +29 -1
  80. package/dist/cjs/helpers/radius.js +131 -6
  81. package/dist/cjs/helpers/render.js +71 -1
  82. package/dist/cjs/helpers/shadow.js +56 -1
  83. package/dist/cjs/helpers/size.js +35 -4
  84. package/dist/cjs/helpers/spacing.js +43 -1
  85. package/dist/cjs/helpers/tracking/fpixel.js +28 -1
  86. package/dist/cjs/helpers/tracking/gtag.js +93 -1
  87. package/dist/cjs/helpers/tracking/tiktokpixel.js +17 -1
  88. package/dist/cjs/helpers/typography.js +105 -17
  89. package/dist/cjs/helpers/variant.js +8 -1
  90. package/dist/cjs/hooks/cart/use-add-to-cart.js +20 -1
  91. package/dist/cjs/hooks/cart/use-cart-data.js +28 -1
  92. package/dist/cjs/hooks/cart/use-cart-discount-codes-update.js +20 -1
  93. package/dist/cjs/hooks/cart/use-cart-note-update.js +20 -1
  94. package/dist/cjs/hooks/cart/use-create-cart.js +22 -1
  95. package/dist/cjs/hooks/cart/use-remove-cart-item.js +20 -1
  96. package/dist/cjs/hooks/cart/use-update-cart-item.js +20 -1
  97. package/dist/cjs/hooks/shop/use-collection-query.js +22 -1
  98. package/dist/cjs/hooks/shop/use-collections-query.js +17 -1
  99. package/dist/cjs/hooks/shop/use-product-query.js +22 -1
  100. package/dist/cjs/hooks/shop/use-products-query.js +22 -1
  101. package/dist/cjs/hooks/shop.js +126 -1
  102. package/dist/cjs/hooks/use-current-device.js +21 -1
  103. package/dist/cjs/hooks/use-lazy-video.js +15 -1
  104. package/dist/cjs/hooks/useCartId.js +44 -1
  105. package/dist/cjs/hooks/useCartLine.js +11 -1
  106. package/dist/cjs/hooks/useCartUI.js +48 -1
  107. package/dist/cjs/hooks/useCollection.js +9 -1
  108. package/dist/cjs/hooks/useFetchHandle.js +13 -1
  109. package/dist/cjs/hooks/useFormatMoney.js +58 -1
  110. package/dist/cjs/hooks/useIsomorphicLayoutEffect.js +10 -1
  111. package/dist/cjs/hooks/useLoadScript.js +32 -1
  112. package/dist/cjs/hooks/useMoney.js +84 -1
  113. package/dist/cjs/hooks/usePrevious.js +19 -1
  114. package/dist/cjs/hooks/useProduct.js +124 -1
  115. package/dist/cjs/hooks/useProductList.js +21 -1
  116. package/dist/cjs/hooks/useSuspenseFetch.js +27 -1
  117. package/dist/cjs/hooks/useSwatchesOptions.js +41 -1
  118. package/dist/cjs/index.js +291 -1
  119. package/dist/cjs/types/global-style.js +14 -1
  120. package/dist/cjs/types/shop.js +2 -1
  121. package/dist/esm/components/AddOn.js +14 -1
  122. package/dist/esm/components/ComponentWrapper.js +24 -1
  123. package/dist/esm/components/ComponentWrapperPreview.js +68 -1
  124. package/dist/esm/components/Empty.js +3 -1
  125. package/dist/esm/components/Render.js +61 -1
  126. package/dist/esm/components/Render.liquid.js +153 -3
  127. package/dist/esm/components/RenderBlock.js +50 -1
  128. package/dist/esm/components/RenderPreview.js +62 -1
  129. package/dist/esm/components/RenderSection.js +19 -1
  130. package/dist/esm/components/constant.js +37 -1
  131. package/dist/esm/contexts/AddonContext.js +32 -1
  132. package/dist/esm/contexts/BuilderComponent.js +31 -1
  133. package/dist/esm/contexts/BuilderContext.js +32 -1
  134. package/dist/esm/contexts/BuilderPreviewContext.js +367 -1
  135. package/dist/esm/contexts/CartLineContext.js +26 -1
  136. package/dist/esm/contexts/CollectionContext.js +35 -1
  137. package/dist/esm/contexts/ModalContext.js +44 -1
  138. package/dist/esm/contexts/ProductContext.js +146 -1
  139. package/dist/esm/contexts/ProductListContext.js +28 -1
  140. package/dist/esm/contexts/SectionContext.js +49 -1
  141. package/dist/esm/contexts/ShopContext.js +67 -1
  142. package/dist/esm/graphql/fragments/analytic.generated.js +4 -2
  143. package/dist/esm/graphql/fragments/collection-detail.generated.js +4 -2
  144. package/dist/esm/graphql/fragments/collection-product.generated.js +4 -2
  145. package/dist/esm/graphql/fragments/collection.generated.js +4 -2
  146. package/dist/esm/graphql/fragments/custom-code.generated.js +4 -2
  147. package/dist/esm/graphql/fragments/data-seo.generated.js +4 -2
  148. package/dist/esm/graphql/fragments/media.generated.js +4 -3
  149. package/dist/esm/graphql/fragments/product-little.generated.js +4 -2
  150. package/dist/esm/graphql/fragments/product-option-value.generated.js +4 -2
  151. package/dist/esm/graphql/fragments/product-option.generated.js +4 -2
  152. package/dist/esm/graphql/fragments/product.generated.js +4 -2
  153. package/dist/esm/graphql/fragments/published-custom-section.generated.js +4 -2
  154. package/dist/esm/graphql/fragments/published-page-section.generated.js +4 -2
  155. package/dist/esm/graphql/fragments/published-theme-page.generated.js +4 -2
  156. package/dist/esm/graphql/fragments/published-theme-style.generated.js +4 -2
  157. package/dist/esm/graphql/fragments/selected-option.generated.js +4 -2
  158. package/dist/esm/graphql/fragments/variant.generated.js +4 -2
  159. package/dist/esm/graphql/mutations/page-view-up.generated.js +5 -3
  160. package/dist/esm/graphql/queries/collection-detail-filter.generated.js +22 -10
  161. package/dist/esm/graphql/queries/collection.generated.js +18 -8
  162. package/dist/esm/graphql/queries/collections.generated.js +8 -3
  163. package/dist/esm/graphql/queries/preview-page.generated.js +18 -8
  164. package/dist/esm/graphql/queries/product-little-detail.generated.js +12 -5
  165. package/dist/esm/graphql/queries/product-medias.generated.js +6 -2
  166. package/dist/esm/graphql/queries/product-variants.generated.js +10 -4
  167. package/dist/esm/graphql/queries/products.generated.js +20 -9
  168. package/dist/esm/graphql/queries/published-theme-pages.generated.js +18 -8
  169. package/dist/esm/graphql/queries/store-property.generated.js +4 -2
  170. package/dist/esm/helpers/GlobalEvent.js +15 -1
  171. package/dist/esm/helpers/background.js +106 -1
  172. package/dist/esm/helpers/borders.js +175 -4
  173. package/dist/esm/helpers/clone-deep.js +3 -1
  174. package/dist/esm/helpers/cls.js +14 -1
  175. package/dist/esm/helpers/colors.js +168 -1
  176. package/dist/esm/helpers/compose-advance-style.js +185 -1
  177. package/dist/esm/helpers/constant.js +19 -1
  178. package/dist/esm/helpers/convert.js +4 -1
  179. package/dist/esm/helpers/css-variable.js +5 -1
  180. package/dist/esm/helpers/email.js +6 -1
  181. package/dist/esm/helpers/flatten-connection.js +7 -1
  182. package/dist/esm/helpers/get-resonsive-value.js +27 -1
  183. package/dist/esm/helpers/get-shortname.js +90 -1
  184. package/dist/esm/helpers/is-browser.js +5 -1
  185. package/dist/esm/helpers/is-defined.js +5 -1
  186. package/dist/esm/helpers/is-empty-children.js +7 -1
  187. package/dist/esm/helpers/is-safari.js +5 -1
  188. package/dist/esm/helpers/layout.js +54 -1
  189. package/dist/esm/helpers/load-script.js +29 -1
  190. package/dist/esm/helpers/make-style.js +117 -1
  191. package/dist/esm/helpers/normalize-builder-data.js +21 -1
  192. package/dist/esm/helpers/prefetch-queries.js +76 -1
  193. package/dist/esm/helpers/product.js +41 -1
  194. package/dist/esm/helpers/queries/get-collection.js +217 -1
  195. package/dist/esm/helpers/queries/get-collections.js +19 -1
  196. package/dist/esm/helpers/queries/get-product-by-slug.js +123 -1
  197. package/dist/esm/helpers/queries/get-product.js +150 -1
  198. package/dist/esm/helpers/queries/get-products.js +159 -1
  199. package/dist/esm/helpers/query.js +25 -1
  200. package/dist/esm/helpers/radius.js +124 -6
  201. package/dist/esm/helpers/render.js +64 -1
  202. package/dist/esm/helpers/shadow.js +51 -1
  203. package/dist/esm/helpers/size.js +31 -4
  204. package/dist/esm/helpers/spacing.js +40 -1
  205. package/dist/esm/helpers/tracking/fpixel.js +24 -1
  206. package/dist/esm/helpers/tracking/gtag.js +87 -1
  207. package/dist/esm/helpers/tracking/tiktokpixel.js +15 -1
  208. package/dist/esm/helpers/typography.js +96 -17
  209. package/dist/esm/helpers/variant.js +6 -1
  210. package/dist/esm/hooks/cart/use-add-to-cart.js +18 -1
  211. package/dist/esm/hooks/cart/use-cart-data.js +26 -1
  212. package/dist/esm/hooks/cart/use-cart-discount-codes-update.js +18 -1
  213. package/dist/esm/hooks/cart/use-cart-note-update.js +18 -1
  214. package/dist/esm/hooks/cart/use-create-cart.js +20 -1
  215. package/dist/esm/hooks/cart/use-remove-cart-item.js +18 -1
  216. package/dist/esm/hooks/cart/use-update-cart-item.js +18 -1
  217. package/dist/esm/hooks/shop/use-collection-query.js +20 -1
  218. package/dist/esm/hooks/shop/use-collections-query.js +15 -1
  219. package/dist/esm/hooks/shop/use-product-query.js +20 -1
  220. package/dist/esm/hooks/shop/use-products-query.js +20 -1
  221. package/dist/esm/hooks/shop.js +111 -1
  222. package/dist/esm/hooks/use-current-device.js +19 -1
  223. package/dist/esm/hooks/use-lazy-video.js +13 -1
  224. package/dist/esm/hooks/useCartId.js +40 -1
  225. package/dist/esm/hooks/useCartLine.js +7 -1
  226. package/dist/esm/hooks/useCartUI.js +44 -1
  227. package/dist/esm/hooks/useCollection.js +7 -1
  228. package/dist/esm/hooks/useFetchHandle.js +11 -1
  229. package/dist/esm/hooks/useFormatMoney.js +56 -1
  230. package/dist/esm/hooks/useIsomorphicLayoutEffect.js +6 -1
  231. package/dist/esm/hooks/useLoadScript.js +28 -1
  232. package/dist/esm/hooks/useMoney.js +80 -1
  233. package/dist/esm/hooks/usePrevious.js +17 -1
  234. package/dist/esm/hooks/useProduct.js +111 -1
  235. package/dist/esm/hooks/useProductList.js +16 -1
  236. package/dist/esm/hooks/useSuspenseFetch.js +23 -1
  237. package/dist/esm/hooks/useSwatchesOptions.js +37 -1
  238. package/dist/esm/index.js +92 -1
  239. package/dist/esm/types/global-style.js +11 -1
  240. package/dist/types/index.d.ts +26 -28
  241. package/package.json +2 -2
@@ -1 +1,71 @@
1
- "use strict";const RenderIf=(e,t,s)=>e?"string"==typeof t?t:t():("string"==typeof s?s:s?.())??"",isObject=e=>!("object"!=typeof e||Array.isArray(e))&&null!==e,props=(e,...t)=>{let s=t[0],r=[];for(let e in s)if(Object.hasOwnProperty.call(s,e)){let t=s[e];["symbol","object","function"].includes(typeof t)||(t?r.push(`${e}="${t}"`):r.push(`${e}`))}return r.join(" ")},styles=(e,...t)=>{let s=t[0],r=[];for(let e in s)if(Object.hasOwnProperty.call(s,e)){let t=s[e];void 0!==t&&!1!==t&&r.push(`${e}:${t}`)}return r.join(";")},dataStringify=e=>JSON.stringify(e).replace(/\\"/g,'"'),template=(e,...t)=>{let s="";return e.forEach((e,r)=>{s+=e,void 0!==t[r]&&(isObject(t[r])?/style=["|']/.test(e)?s+=styles`${t[r]}`:s+=props`${t[r]}`:s+=t[r])}),s},composeMemo=(e,t)=>e();exports.RenderIf=RenderIf,exports.composeMemo=composeMemo,exports.dataStringify=dataStringify,exports.props=props,exports.styles=styles,exports.template=template;
1
+ 'use strict';
2
+
3
+ const RenderIf = (c, t, f)=>c ? typeof t === 'string' ? t : t() : (typeof f === 'string' ? f : f?.()) ?? '';
4
+ const isObject = (obj)=>{
5
+ if (typeof obj === 'object' && !Array.isArray(obj) && obj !== null) {
6
+ return true;
7
+ }
8
+ return false;
9
+ };
10
+ const props = (strings, ...keys)=>{
11
+ const props = keys[0];
12
+ const propsArr = [];
13
+ for(const attr in props){
14
+ if (Object.hasOwnProperty.call(props, attr)) {
15
+ const val = props[attr];
16
+ if (![
17
+ 'symbol',
18
+ 'object',
19
+ 'function'
20
+ ].includes(typeof val)) {
21
+ if (val) {
22
+ propsArr.push(`${attr}="${val}"`);
23
+ } else {
24
+ propsArr.push(`${attr}`);
25
+ }
26
+ }
27
+ }
28
+ }
29
+ return propsArr.join(' ');
30
+ };
31
+ const styles = (strings, ...keys)=>{
32
+ const styles = keys[0];
33
+ const styleArr = [];
34
+ for(const attr in styles){
35
+ if (Object.hasOwnProperty.call(styles, attr)) {
36
+ const val = styles[attr];
37
+ if (val !== undefined && val !== false) styleArr.push(`${attr}:${val}`);
38
+ }
39
+ }
40
+ return styleArr.join(';');
41
+ };
42
+ const dataStringify = (obj)=>{
43
+ return JSON.stringify(obj).replace(/\\"/g, '"');
44
+ };
45
+ const template = (strings, ...keys)=>{
46
+ let str = '';
47
+ strings.forEach((item, index)=>{
48
+ str += item;
49
+ if (keys[index] !== undefined) {
50
+ if (isObject(keys[index])) {
51
+ if (/style=["|']/.test(item)) {
52
+ str += styles`${keys[index]}`;
53
+ } else {
54
+ str += props`${keys[index]}`;
55
+ }
56
+ } else {
57
+ str += keys[index];
58
+ }
59
+ }
60
+ });
61
+ return str;
62
+ };
63
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
64
+ const composeMemo = (fn, _)=>fn();
65
+
66
+ exports.RenderIf = RenderIf;
67
+ exports.composeMemo = composeMemo;
68
+ exports.dataStringify = dataStringify;
69
+ exports.props = props;
70
+ exports.styles = styles;
71
+ exports.template = template;
@@ -1 +1,56 @@
1
- "use strict";var colors=require("./colors.js"),constant=require("./constant.js"),getShortname=require("./get-shortname.js");const parseValueWithUnit=e=>{let t=e.match(/(\d+)(.+)/);if(t&&3===t.length){let e=Number(t[1]??0),a=t[2];return{value:e,unit:a??"px"}}return{value:0,unit:"px"}},getStyleShadow=(e,t=!1)=>{let{styleAppliedFor:a,value:o,isEnableShadow:r}=e||{},{state:s}=e||{};if(s||(s="normal"),!a||!o||void 0===o.distance)return{};let{value:l,unit:n}=parseValueWithUnit(`${o?.distance}`);return{[`-${t?"":constant.stateMapping?.[s]}-${getShortname.getShortName(a)}`]:r?`${Math.cos(parseFloat(`${o?.angle}`)*Math.PI/180)*parseFloat(`${l}`)}${n} ${Math.sin(parseFloat(`${o?.angle}`)*Math.PI/180)*parseFloat(`${l}`)}${n} ${o?.blur} ${"box-shadow"===a?o?.spread+" ":""}${colors.getSingleColorVariable(o?.color)}`:"none"}},getStyleShadowState=(e,t,a)=>{if(!e||!t)return{};let o={};for(let[r,s]of Object.entries(e))Object.assign(o,getStyleShadow({value:s,state:r,styleAppliedFor:t,isEnableShadow:a?.[r]}));return o},composeShadowCss=({hasBoxShadow:e,boxShadowValue:t})=>{if(!e||!t)return;let{value:a,unit:o}=parseValueWithUnit(`${t?.distance}`);return`box-shadow: ${Math.cos(parseFloat(`${t?.angle}`)*Math.PI/180)*parseFloat(`${a}`)}${o} ${Math.sin(parseFloat(`${t?.angle}`)*Math.PI/180)*parseFloat(`${a}`)}${o} ${t?.blur} ${t?.spread+" "}${colors.getSingleColorVariable(t?.color)};`};exports.composeShadowCss=composeShadowCss,exports.getStyleShadow=getStyleShadow,exports.getStyleShadowState=getStyleShadowState,exports.parseValueWithUnit=parseValueWithUnit;
1
+ 'use strict';
2
+
3
+ var colors = require('./colors.js');
4
+ var constant = require('./constant.js');
5
+ var getShortname = require('./get-shortname.js');
6
+
7
+ const parseValueWithUnit = (valueWithUnit)=>{
8
+ const matches = valueWithUnit.match(/(\d+)(.+)/);
9
+ if (matches && matches.length === 3) {
10
+ const value = Number(matches[1] ?? 0);
11
+ const unit = matches[2];
12
+ return {
13
+ value,
14
+ unit: unit ?? 'px'
15
+ };
16
+ }
17
+ return {
18
+ value: 0,
19
+ unit: 'px'
20
+ };
21
+ };
22
+ const getStyleShadow = (shadowStyle, isActiveState = false)=>{
23
+ const { styleAppliedFor, value, isEnableShadow } = shadowStyle || {};
24
+ let { state } = shadowStyle || {};
25
+ if (!state) state = 'normal';
26
+ if (!styleAppliedFor || !value) return {};
27
+ if (typeof value.distance == 'undefined') return {};
28
+ const { value: distance, unit: unitDistance } = parseValueWithUnit(`${value?.distance}`);
29
+ return {
30
+ [`-${!isActiveState ? constant.stateMapping?.[state] : ''}-${getShortname.getShortName(styleAppliedFor)}`]: isEnableShadow ? `${Math.cos(parseFloat(`${value?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${Math.sin(parseFloat(`${value?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${value?.blur} ${styleAppliedFor === 'box-shadow' ? value?.spread + ' ' : ''}${colors.getSingleColorVariable(value?.color)}` : 'none'
31
+ };
32
+ };
33
+ const getStyleShadowState = (shadow, styleAppliedFor, isEnableShadow)=>{
34
+ if (!shadow || !styleAppliedFor) return {};
35
+ const style = {};
36
+ for (const [key, value] of Object.entries(shadow)){
37
+ Object.assign(style, getStyleShadow({
38
+ value: value,
39
+ state: key,
40
+ styleAppliedFor,
41
+ isEnableShadow: isEnableShadow?.[key]
42
+ }));
43
+ }
44
+ return style;
45
+ };
46
+ const composeShadowCss = ({ hasBoxShadow, boxShadowValue })=>{
47
+ if (!hasBoxShadow) return undefined;
48
+ if (!boxShadowValue) return undefined;
49
+ const { value: distance, unit: unitDistance } = parseValueWithUnit(`${boxShadowValue?.distance}`);
50
+ return `box-shadow: ${Math.cos(parseFloat(`${boxShadowValue?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${Math.sin(parseFloat(`${boxShadowValue?.angle}`) * Math.PI / 180) * parseFloat(`${distance}`)}${unitDistance} ${boxShadowValue?.blur} ${boxShadowValue?.spread + ' '}${colors.getSingleColorVariable(boxShadowValue?.color)};`;
51
+ };
52
+
53
+ exports.composeShadowCss = composeShadowCss;
54
+ exports.getStyleShadow = getStyleShadow;
55
+ exports.getStyleShadowState = getStyleShadowState;
56
+ exports.parseValueWithUnit = parseValueWithUnit;
@@ -1,4 +1,35 @@
1
- "use strict";var constant=require("./constant.js");function getCustomSizeCSSByDevice(e,t){if(!e||!t)return{};let o=constant.devicesMapping[t]??"";return{[`--pl${o}`]:e?.[t]?.horizontal,[`--pr${o}`]:e?.[t]?.horizontal,[`--pt${o}`]:e?.[t]?.vertical,[`--pb${o}`]:e?.[t]?.vertical}}const composeSize=e=>Object.assign({},getCustomSizeCSSByDevice(e,"desktop"),getCustomSizeCSSByDevice(e,"tablet"),getCustomSizeCSSByDevice(e,"mobile"));function genSizeClass(e){return`g-s-${e}`}const composeSizeCss=e=>{if(void 0===e)return"";let t=e?.custom?.desktop?.horizontal,o=e?.custom?.desktop?.vertical;if(e?.custom)return`
2
- ${t?`padding-left: ${t}; padding-right: ${t};`:void 0}
3
- ${o?`padding-top: ${o}; padding-bottom: ${o};`:void 0}
4
- `};exports.composeSize=composeSize,exports.composeSizeCss=composeSizeCss,exports.genSizeClass=genSizeClass;
1
+ 'use strict';
2
+
3
+ var constant = require('./constant.js');
4
+
5
+ function getCustomSizeCSSByDevice(size, device) {
6
+ if (!size || !device) return {};
7
+ const suffix = constant.devicesMapping[device] ?? '';
8
+ return {
9
+ [`--pl${suffix}`]: size?.[device]?.horizontal,
10
+ [`--pr${suffix}`]: size?.[device]?.horizontal,
11
+ [`--pt${suffix}`]: size?.[device]?.vertical,
12
+ [`--pb${suffix}`]: size?.[device]?.vertical
13
+ };
14
+ }
15
+ const composeSize = (size)=>{
16
+ return Object.assign({}, getCustomSizeCSSByDevice(size, 'desktop'), getCustomSizeCSSByDevice(size, 'tablet'), getCustomSizeCSSByDevice(size, 'mobile'));
17
+ };
18
+ function genSizeClass(name) {
19
+ return `g-s-${name}`;
20
+ }
21
+ const composeSizeCss = (spacing)=>{
22
+ if (spacing === undefined) return '';
23
+ const size = spacing;
24
+ const sizeHozi = spacing?.custom?.desktop?.horizontal;
25
+ const sizeVerti = spacing?.custom?.desktop?.vertical;
26
+ if (!size?.custom) return undefined;
27
+ return `
28
+ ${sizeHozi ? `padding-left: ${sizeHozi}; padding-right: ${sizeHozi};` : undefined}
29
+ ${sizeVerti ? `padding-top: ${sizeVerti}; padding-bottom: ${sizeVerti};` : undefined}
30
+ `;
31
+ };
32
+
33
+ exports.composeSize = composeSize;
34
+ exports.composeSizeCss = composeSizeCss;
35
+ exports.genSizeClass = genSizeClass;
@@ -1 +1,43 @@
1
- "use strict";var constant=require("./constant.js");function getSpacingCSSByType(e,t){if(!e)return{};let a=t?constant.devicesMapping?.[t]??"":"";return{[`--p${a}`]:`var(--g-s-${e})`}}function getSpacingVariable(e){return e?`var(--g-s-${e})`:""}const composeSpacing=e=>{let t={};switch(e?.desktop){case"m":case"l":case"s":Object.assign(t,getSpacingCSSByType(e.desktop))}switch(e?.tablet){case"m":case"l":case"s":Object.assign(t,getSpacingCSSByType(e.tablet,"tablet"))}switch(e?.mobile){case"m":case"l":case"s":Object.assign(t,getSpacingCSSByType(e.mobile,"mobile"))}return t};exports.composeSpacing=composeSpacing,exports.getSpacingVariable=getSpacingVariable;
1
+ 'use strict';
2
+
3
+ var constant = require('./constant.js');
4
+
5
+ function getSpacingCSSByType(key, device) {
6
+ if (!key) return {};
7
+ const suffix = device ? constant.devicesMapping?.[device] ?? '' : '';
8
+ return {
9
+ [`--p${suffix}`]: `var(--g-s-${key})`
10
+ };
11
+ }
12
+ function getSpacingVariable(key) {
13
+ if (!key) return '';
14
+ return `var(--g-s-${key})`;
15
+ }
16
+ const composeSpacing = (spacingValue)=>{
17
+ const style = {};
18
+ switch(spacingValue?.desktop){
19
+ case 'm':
20
+ case 'l':
21
+ case 's':
22
+ Object.assign(style, getSpacingCSSByType(spacingValue.desktop));
23
+ break;
24
+ }
25
+ switch(spacingValue?.tablet){
26
+ case 'm':
27
+ case 'l':
28
+ case 's':
29
+ Object.assign(style, getSpacingCSSByType(spacingValue.tablet, 'tablet'));
30
+ break;
31
+ }
32
+ switch(spacingValue?.mobile){
33
+ case 'm':
34
+ case 'l':
35
+ case 's':
36
+ Object.assign(style, getSpacingCSSByType(spacingValue.mobile, 'mobile'));
37
+ break;
38
+ }
39
+ return style;
40
+ };
41
+
42
+ exports.composeSpacing = composeSpacing;
43
+ exports.getSpacingVariable = getSpacingVariable;
@@ -1 +1,28 @@
1
- "use strict";const pageview=()=>{window.fbq&&window.fbq("track","PageView")},event=(e,t={})=>{window.fbq&&window.fbq("track",e,t)},addToCart=e=>{window.fbq&&window.fbq("track","AddToCart",{content_ids:[e.id],content_name:e.name,content_category:e.category,content_type:"product",value:e.price,currency:e.currency})};exports.addToCart=addToCart,exports.event=event,exports.pageview=pageview;
1
+ 'use strict';
2
+
3
+ const pageview = ()=>{
4
+ if (!window.fbq) return;
5
+ window.fbq('track', 'PageView');
6
+ };
7
+ // https://developers.facebook.com/docs/facebook-pixel/advanced/
8
+ const event = (name, options = {})=>{
9
+ if (!window.fbq) return;
10
+ window.fbq('track', name, options);
11
+ };
12
+ const addToCart = (product)=>{
13
+ if (!window.fbq) return;
14
+ window.fbq('track', 'AddToCart', {
15
+ content_ids: [
16
+ product.id
17
+ ],
18
+ content_name: product.name,
19
+ content_category: product.category,
20
+ content_type: 'product',
21
+ value: product.price,
22
+ currency: product.currency
23
+ });
24
+ };
25
+
26
+ exports.addToCart = addToCart;
27
+ exports.event = event;
28
+ exports.pageview = pageview;
@@ -1 +1,93 @@
1
- "use strict";const pageview=(e,a)=>{window.gtag&&a&&window.gtag("config",a,{page_path:e}),window.ga&&window.ga("send","pageview",e)},addToCart=e=>{window.ga&&e&&(window.ga("ec:addProduct",{...e,id:e.sku,name:"Default Title"===e.variant?e.name:`${e.name} - ${e.variant}`,variant:"Default Title"===e.variant?e.name:e.variant}),window.ga("ec:setAction","add"),window.ga("send","event",{eventCategory:"EnhancedEcommerce",eventAction:"Added Product",nonInteraction:!0}))},productClick=e=>{window.ga&&(ga("ec:addProduct",{id:e.id,name:e.name,category:e.category,brand:e.brand,variant:e.variant}),ga("ec:setAction","click"),ga("send","event",{eventAction:"Click",eventCategory:"Product"}))},productDetail=e=>{e&&window.ga&&(ga("ec:addProduct",{brand:e.brand,category:e.category,id:e.id,name:e.name,variant:e.variant}),ga("ec:setAction","detail"),ga("send","event",{eventAction:"Detail",eventCategory:"Ecommerce",nonInteraction:1}))},removeFromCart=(e,a)=>{e&&window.ga&&(ga("ec:addProduct",{id:e.id,name:e.name,price:a}),ga("ec:setAction","remove"),ga("send","event",{eventAction:"Click",eventCategory:"Remove from cart"}))};exports.addToCart=addToCart,exports.pageview=pageview,exports.productClick=productClick,exports.productDetail=productDetail,exports.removeFromCart=removeFromCart;
1
+ 'use strict';
2
+
3
+ // https://developers.google.com/analytics/devguides/collection/gtagjs/pages
4
+ const pageview = (url, trackingId)=>{
5
+ // GA 4
6
+ if (window.gtag && trackingId) {
7
+ window.gtag('config', trackingId, {
8
+ page_path: url
9
+ });
10
+ }
11
+ // GA 3
12
+ if (window.ga) {
13
+ window.ga('send', 'pageview', url);
14
+ }
15
+ };
16
+ /** Addition to cart events
17
+ * https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#add-remove-cart
18
+ */ const addToCart = (product)=>{
19
+ // GA 3
20
+ if (!window.ga || !product) {
21
+ return;
22
+ }
23
+ window.ga('ec:addProduct', {
24
+ ...product,
25
+ id: product.sku,
26
+ name: product.variant === 'Default Title' ? product.name : `${product.name} - ${product.variant}`,
27
+ variant: product.variant === 'Default Title' ? product.name : product.variant
28
+ });
29
+ window.ga('ec:setAction', 'add');
30
+ window.ga('send', 'event', {
31
+ eventCategory: 'EnhancedEcommerce',
32
+ eventAction: 'Added Product',
33
+ nonInteraction: true
34
+ });
35
+ };
36
+ /** Product clicked event
37
+ * https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#product-click
38
+ */ const productClick = (product)=>{
39
+ if (!window.ga) {
40
+ return;
41
+ }
42
+ ga('ec:addProduct', {
43
+ id: product.id,
44
+ name: product.name,
45
+ category: product.category,
46
+ brand: product.brand,
47
+ variant: product.variant
48
+ });
49
+ ga('ec:setAction', 'click');
50
+ ga('send', 'event', {
51
+ eventAction: 'Click',
52
+ eventCategory: 'Product'
53
+ });
54
+ };
55
+ /** Product viewed event
56
+ * https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#measuring-actvities
57
+ */ const productDetail = (product)=>{
58
+ if (!product || !window.ga) return;
59
+ ga('ec:addProduct', {
60
+ brand: product.brand,
61
+ category: product.category,
62
+ id: product.id,
63
+ name: product.name,
64
+ variant: product.variant
65
+ });
66
+ ga('ec:setAction', 'detail');
67
+ ga('send', 'event', {
68
+ eventAction: 'Detail',
69
+ eventCategory: 'Ecommerce',
70
+ nonInteraction: 1
71
+ });
72
+ };
73
+ /** Removal from cart events
74
+ * https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce#add-remove-cart
75
+ */ const removeFromCart = (product, price)=>{
76
+ if (!product || !window.ga) return;
77
+ ga('ec:addProduct', {
78
+ id: product.id,
79
+ name: product.name,
80
+ price
81
+ });
82
+ ga('ec:setAction', 'remove');
83
+ ga('send', 'event', {
84
+ eventAction: 'Click',
85
+ eventCategory: 'Remove from cart'
86
+ });
87
+ };
88
+
89
+ exports.addToCart = addToCart;
90
+ exports.pageview = pageview;
91
+ exports.productClick = productClick;
92
+ exports.productDetail = productDetail;
93
+ exports.removeFromCart = removeFromCart;
@@ -1 +1,17 @@
1
- "use strict";const addToCart=t=>{window?.ttq?.track&&window.ttq.track("AddToCart",{content_id:t.id,content_type:"product",content_name:t.name,quantity:t.quantity,price:t.price,value:(t.price??0)*(t.quantity??0),currency:t.currency})};exports.addToCart=addToCart;
1
+ 'use strict';
2
+
3
+ // @ts-nocheck
4
+ const addToCart = (product)=>{
5
+ if (!window?.ttq?.track) return;
6
+ window.ttq.track('AddToCart', {
7
+ content_id: product.id,
8
+ content_type: 'product',
9
+ content_name: product.name,
10
+ quantity: product.quantity,
11
+ price: product.price,
12
+ value: (product.price ?? 0) * (product.quantity ?? 0),
13
+ currency: product.currency
14
+ });
15
+ };
16
+
17
+ exports.addToCart = addToCart;
@@ -1,17 +1,105 @@
1
- "use strict";var colors=require("./colors.js"),makeStyle=require("./make-style.js");const genTypoClass=e=>`g-${e}`,composeTypographyCss=e=>{let o=e?.custom,{fontFamily:t,fontSize:s,fontStyle:p,fontWeight:y,lineHeight:r,letterSpacing:l}=o?.desktop??{};return`
2
- ${t?`font-family: var(--g-font-${t}, ${t});`:""}
3
- ${s?`font-size: ${s};`:""}
4
- ${p?`font-style: ${p};`:""}
5
- ${y?`font-weight: ${y};`:""}
6
- ${l?`letter-spacing: ${l};`:""}
7
- ${r?`line-height: ${r};`:""}
8
- `},composeTypographyV2Css=e=>{let o=e?.custom,{fontFamily:t,fontSize:s,fontWeight:p,lineHeight:y,letterSpacing:r}=o??{},l=e?.attrs,{bold:a,italic:i,underline:n,transform:m}=l??{};return`
9
- ${t?`font-family: var(--g-font-${t}, ${t});`:""}
10
- ${s?.desktop?`font-size: ${s?.desktop};`:""}
11
- ${a?"font-weight: bold;":p?`font-weight: ${p};`:""}
12
- ${r?`letter-spacing: ${r};`:""}
13
- ${y?`line-height: ${y};`:""}
14
- ${i?"font-style: italic;":""}
15
- ${n?"text-decoration-line: underline;":""}
16
- ${m?`text-transform: ${m};`:""}
17
- `};function getCustomCSSByDevice(e,o){if(!e||!o)return{};let t="desktop"!==o&&o?`-${o}`:"",{fontFamily:s}=e?.[o]??{};return{[`--size${t}`]:e?.[o]?.fontSize,[`--lh${t}`]:e?.[o]?.lineHeight,[`--fs${t}`]:e?.[o]?.fontStyle,[`--ff${t}`]:s?`var(--g-font-${s}, ${s})`:void 0,[`--weight${t}`]:e?.[o]?.fontWeight,[`--ls${t}`]:e?.[o]?.letterSpacing}}const composeTypography=e=>e?makeStyle.removeNullUndefined({...getCustomCSSByDevice(e,"desktop"),...getCustomCSSByDevice(e,"tablet"),...getCustomCSSByDevice(e,"mobile")}):{},composeTypographyV2=(e,o)=>e?makeStyle.removeNullUndefined({...makeStyle.makeStyle({fs:o?.italic?void 0:e?.fontStyle,ff:e?.fontFamily?`var(--g-font-${e.fontFamily.replace(/ /g,"-")}, ${e.fontFamily})`:void 0,weight:o?.bold?void 0:e?.fontWeight,ls:e?.letterSpacing,lh:e?.lineHeight}),...makeStyle.makeStyleResponsive("size",e?.fontSize)}):{},composeTypographyAttr=e=>e?makeStyle.removeNullUndefined({...makeStyle.makeStyle({fs:e?.italic?"italic":void 0,weight:e?.bold?"bold":void 0,c:colors.getSingleColorVariable(e?.color),tt:e?.transform,tdl:e?.underline?"underline":void 0})}):{},composeTypographyClassName=(e,o)=>e?e?.type&&!e.custom?genTypoClass(e.type):"":o?.type&&genTypoClass(o?.type),composeTypographyStyle=(e,o,t)=>e?{...composeTypographyV2(e.custom,e.attrs),...!t&&composeTypographyAttr(e.attrs)}:{...o?.type?{}:composeTypography(o?.custom)};exports.composeTypography=composeTypography,exports.composeTypographyAttr=composeTypographyAttr,exports.composeTypographyClassName=composeTypographyClassName,exports.composeTypographyCss=composeTypographyCss,exports.composeTypographyStyle=composeTypographyStyle,exports.composeTypographyV2=composeTypographyV2,exports.composeTypographyV2Css=composeTypographyV2Css,exports.genTypoClass=genTypoClass;
1
+ 'use strict';
2
+
3
+ var colors = require('./colors.js');
4
+ var makeStyle = require('./make-style.js');
5
+
6
+ const genTypoClass = (name)=>{
7
+ return `g-${name}`;
8
+ };
9
+ const composeTypographyCss = (typography)=>{
10
+ const typographyCustom = typography?.custom;
11
+ const { fontFamily, fontSize, fontStyle, fontWeight, lineHeight, letterSpacing } = typographyCustom?.desktop ?? {};
12
+ return `
13
+ ${fontFamily ? `font-family: var(--g-font-${fontFamily}, ${fontFamily});` : ''}
14
+ ${fontSize ? `font-size: ${fontSize};` : ''}
15
+ ${fontStyle ? `font-style: ${fontStyle};` : ''}
16
+ ${fontWeight ? `font-weight: ${fontWeight};` : ''}
17
+ ${letterSpacing ? `letter-spacing: ${letterSpacing};` : ''}
18
+ ${lineHeight ? `line-height: ${lineHeight};` : ''}
19
+ `;
20
+ };
21
+ const composeTypographyV2Css = (typography)=>{
22
+ const typographyCustom = typography?.custom;
23
+ const { fontFamily, fontSize, fontWeight, lineHeight, letterSpacing } = typographyCustom ?? {};
24
+ const typographyAttrs = typography?.attrs;
25
+ const { bold, italic, underline, transform } = typographyAttrs ?? {};
26
+ return `
27
+ ${fontFamily ? `font-family: var(--g-font-${fontFamily}, ${fontFamily});` : ''}
28
+ ${fontSize?.desktop ? `font-size: ${fontSize?.desktop};` : ''}
29
+ ${bold ? `font-weight: bold;` : fontWeight ? `font-weight: ${fontWeight};` : ''}
30
+ ${letterSpacing ? `letter-spacing: ${letterSpacing};` : ''}
31
+ ${lineHeight ? `line-height: ${lineHeight};` : ''}
32
+ ${italic ? `font-style: italic;` : ''}
33
+ ${underline ? `text-decoration-line: underline;` : ''}
34
+ ${transform ? `text-transform: ${transform};` : ''}
35
+ `;
36
+ };
37
+ function getCustomCSSByDevice(typography, device) {
38
+ if (!typography || !device) return {};
39
+ const suffix = device === 'desktop' || !device ? '' : `-${device}`;
40
+ const { fontFamily } = typography?.[device] ?? {};
41
+ return {
42
+ [`--size${suffix}`]: typography?.[device]?.fontSize,
43
+ [`--lh${suffix}`]: typography?.[device]?.lineHeight,
44
+ [`--fs${suffix}`]: typography?.[device]?.fontStyle,
45
+ [`--ff${suffix}`]: fontFamily ? `var(--g-font-${fontFamily}, ${fontFamily})` : undefined,
46
+ [`--weight${suffix}`]: typography?.[device]?.fontWeight,
47
+ [`--ls${suffix}`]: typography?.[device]?.letterSpacing
48
+ };
49
+ }
50
+ const composeTypography = (typography)=>{
51
+ if (!typography) return {};
52
+ return makeStyle.removeNullUndefined({
53
+ ...getCustomCSSByDevice(typography, 'desktop'),
54
+ ...getCustomCSSByDevice(typography, 'tablet'),
55
+ ...getCustomCSSByDevice(typography, 'mobile')
56
+ });
57
+ };
58
+ const composeTypographyV2 = (value, attrs)=>{
59
+ if (!value) return {};
60
+ return makeStyle.removeNullUndefined({
61
+ ...makeStyle.makeStyle({
62
+ fs: !attrs?.italic ? value?.fontStyle : undefined,
63
+ ff: value?.fontFamily ? `var(--g-font-${value.fontFamily.replace(/ /g, '-')}, ${value.fontFamily})` : undefined,
64
+ weight: !attrs?.bold ? value?.fontWeight : undefined,
65
+ ls: value?.letterSpacing,
66
+ lh: value?.lineHeight
67
+ }),
68
+ ...makeStyle.makeStyleResponsive('size', value?.fontSize)
69
+ });
70
+ };
71
+ const composeTypographyAttr = (attrs)=>{
72
+ if (!attrs) return {};
73
+ return makeStyle.removeNullUndefined({
74
+ ...makeStyle.makeStyle({
75
+ fs: attrs?.italic ? 'italic' : undefined,
76
+ weight: attrs?.bold ? 'bold' : undefined,
77
+ c: colors.getSingleColorVariable(attrs?.color),
78
+ tt: attrs?.transform,
79
+ tdl: attrs?.underline ? 'underline' : undefined
80
+ })
81
+ });
82
+ };
83
+ const composeTypographyClassName = (typo, typography)=>{
84
+ return typo ? typo?.type && !typo.custom ? genTypoClass(typo.type) : '' : typography?.type && genTypoClass(typography?.type);
85
+ };
86
+ const composeTypographyStyle = (typo, typography, disableAttr)=>{
87
+ if (typo) {
88
+ return {
89
+ ...composeTypographyV2(typo.custom, typo.attrs),
90
+ ...!disableAttr && composeTypographyAttr(typo.attrs)
91
+ };
92
+ }
93
+ return {
94
+ ...!typography?.type ? composeTypography(typography?.custom) : {}
95
+ };
96
+ };
97
+
98
+ exports.composeTypography = composeTypography;
99
+ exports.composeTypographyAttr = composeTypographyAttr;
100
+ exports.composeTypographyClassName = composeTypographyClassName;
101
+ exports.composeTypographyCss = composeTypographyCss;
102
+ exports.composeTypographyStyle = composeTypographyStyle;
103
+ exports.composeTypographyV2 = composeTypographyV2;
104
+ exports.composeTypographyV2Css = composeTypographyV2Css;
105
+ exports.genTypoClass = genTypoClass;
@@ -1 +1,8 @@
1
- "use strict";function checkInStock(n){return!!n&&(n?.inventoryQuantity&&n.inventoryQuantity>0||!n?.manageInventory||"CONTINUE"===n.inventoryPolicy)}exports.checkInStock=checkInStock;
1
+ 'use strict';
2
+
3
+ function checkInStock(variant) {
4
+ if (!variant) return false;
5
+ return variant?.inventoryQuantity && variant.inventoryQuantity > 0 || !variant?.manageInventory || variant.inventoryPolicy === 'CONTINUE';
6
+ }
7
+
8
+ exports.checkInStock = checkInStock;
@@ -1 +1,20 @@
1
- "use strict";var adapterShopify=require("@gem-sdk/adapter-shopify"),useSWR=require("swr"),useSWRMutation=require("swr/mutation"),shop=require("../shop.js");const useAddToCart=e=>{let r=shop.useStoreFront(),{mutate:s}=useSWR.useSWRConfig();return useSWRMutation("add-to-cart",(e,{arg:s})=>adapterShopify.addToCartOperation(r)(s),{...e,onSuccess:(r,t,o)=>{s("cart",r,!1),e?.onSuccess?.(r,t,o)}})};exports.useAddToCart=useAddToCart;
1
+ 'use strict';
2
+
3
+ var adapterShopify = require('@gem-sdk/adapter-shopify');
4
+ var useSWR = require('swr');
5
+ var useSWRMutation = require('swr/mutation');
6
+ var shop = require('../shop.js');
7
+
8
+ const useAddToCart = (options)=>{
9
+ const shop$1 = shop.useStoreFront();
10
+ const { mutate } = useSWR.useSWRConfig();
11
+ return useSWRMutation('add-to-cart', (_, { arg })=>adapterShopify.addToCartOperation(shop$1)(arg), {
12
+ ...options,
13
+ onSuccess: (result, key, config)=>{
14
+ mutate('cart', result, false);
15
+ options?.onSuccess?.(result, key, config);
16
+ }
17
+ });
18
+ };
19
+
20
+ exports.useAddToCart = useAddToCart;
@@ -1 +1,28 @@
1
- "use strict";var adapterShopify=require("@gem-sdk/adapter-shopify"),useSWR=require("swr"),shop=require("../shop.js"),useCartId=require("../useCartId.js");const useCartData=e=>{let{cartId:r,clearCartId:a}=useCartId.default(),t=shop.useStoreFront();return useSWR(r?"cart":null,()=>adapterShopify.getCartOperation(t)({cartId:r}),{revalidateOnMount:!0,revalidateOnFocus:!0,keepPreviousData:!1,dedupingInterval:2e3,...e,onSuccess(r,t,s){r||a(),e?.onSuccess?.(r,t,s)}})};exports.useCartData=useCartData;
1
+ 'use strict';
2
+
3
+ var adapterShopify = require('@gem-sdk/adapter-shopify');
4
+ var useSWR = require('swr');
5
+ var shop = require('../shop.js');
6
+ var useCartId = require('../useCartId.js');
7
+
8
+ const useCartData = (options)=>{
9
+ const { cartId, clearCartId } = useCartId.default();
10
+ const shop$1 = shop.useStoreFront();
11
+ return useSWR(cartId ? 'cart' : null, ()=>adapterShopify.getCartOperation(shop$1)({
12
+ cartId: cartId
13
+ }), {
14
+ revalidateOnMount: true,
15
+ revalidateOnFocus: true,
16
+ keepPreviousData: false,
17
+ dedupingInterval: 2000,
18
+ ...options,
19
+ onSuccess (data, key, config) {
20
+ if (!data) {
21
+ clearCartId();
22
+ }
23
+ options?.onSuccess?.(data, key, config);
24
+ }
25
+ });
26
+ };
27
+
28
+ exports.useCartData = useCartData;
@@ -1 +1,20 @@
1
- "use strict";var adapterShopify=require("@gem-sdk/adapter-shopify"),useSWR=require("swr"),useSWRMutation=require("swr/mutation"),shop=require("../shop.js");const useCartDiscountCodesUpdate=e=>{let s=shop.useStoreFront(),{mutate:t}=useSWR.useSWRConfig();return useSWRMutation("cart-discount-codes-update",(e,{arg:t})=>adapterShopify.cartDiscountCodesUpdateOperation(s)(t),{...e,onSuccess:(s,o,r)=>{t("cart",s,!1),e?.onSuccess?.(s,o,r)}})};exports.useCartDiscountCodesUpdate=useCartDiscountCodesUpdate;
1
+ 'use strict';
2
+
3
+ var adapterShopify = require('@gem-sdk/adapter-shopify');
4
+ var useSWR = require('swr');
5
+ var useSWRMutation = require('swr/mutation');
6
+ var shop = require('../shop.js');
7
+
8
+ const useCartDiscountCodesUpdate = (options)=>{
9
+ const shop$1 = shop.useStoreFront();
10
+ const { mutate } = useSWR.useSWRConfig();
11
+ return useSWRMutation('cart-discount-codes-update', (_, { arg })=>adapterShopify.cartDiscountCodesUpdateOperation(shop$1)(arg), {
12
+ ...options,
13
+ onSuccess: (result, key, config)=>{
14
+ mutate('cart', result, false);
15
+ options?.onSuccess?.(result, key, config);
16
+ }
17
+ });
18
+ };
19
+
20
+ exports.useCartDiscountCodesUpdate = useCartDiscountCodesUpdate;
@@ -1 +1,20 @@
1
- "use strict";var adapterShopify=require("@gem-sdk/adapter-shopify"),useSWR=require("swr"),useSWRMutation=require("swr/mutation"),shop=require("../shop.js");const useCartNoteUpdate=e=>{let t=shop.useStoreFront(),{mutate:r}=useSWR.useSWRConfig();return useSWRMutation("cart-note-update",(e,{arg:r})=>adapterShopify.cartNoteUpdateOperation(t)(r),{...e,onSuccess:(t,s,a)=>{r("cart",t,!1),e?.onSuccess?.(t,s,a)}})};exports.useCartNoteUpdate=useCartNoteUpdate;
1
+ 'use strict';
2
+
3
+ var adapterShopify = require('@gem-sdk/adapter-shopify');
4
+ var useSWR = require('swr');
5
+ var useSWRMutation = require('swr/mutation');
6
+ var shop = require('../shop.js');
7
+
8
+ const useCartNoteUpdate = (options)=>{
9
+ const shop$1 = shop.useStoreFront();
10
+ const { mutate } = useSWR.useSWRConfig();
11
+ return useSWRMutation('cart-note-update', (_, { arg })=>adapterShopify.cartNoteUpdateOperation(shop$1)(arg), {
12
+ ...options,
13
+ onSuccess: (result, key, config)=>{
14
+ mutate('cart', result, false);
15
+ options?.onSuccess?.(result, key, config);
16
+ }
17
+ });
18
+ };
19
+
20
+ exports.useCartNoteUpdate = useCartNoteUpdate;
@@ -1 +1,22 @@
1
- "use strict";var adapterShopify=require("@gem-sdk/adapter-shopify"),useSWR=require("swr"),useSWRMutation=require("swr/mutation"),shop=require("../shop.js");const useCreateCart=e=>{let r=shop.useStoreFront(),{mutate:t}=useSWR.useSWRConfig();return useSWRMutation("create-cart",(e,{arg:t})=>adapterShopify.createCartOperation(r)(t),{...e,onSuccess:(r,s,a)=>{t("cart",r,!1),e?.onSuccess?.(r,s,a)}})};exports.useCreateCart=useCreateCart;
1
+ 'use strict';
2
+
3
+ var adapterShopify = require('@gem-sdk/adapter-shopify');
4
+ var useSWR = require('swr');
5
+ var useSWRMutation = require('swr/mutation');
6
+ var shop = require('../shop.js');
7
+
8
+ const useCreateCart = (options)=>{
9
+ const shop$1 = shop.useStoreFront();
10
+ const { mutate } = useSWR.useSWRConfig();
11
+ return useSWRMutation('create-cart', (_, { arg })=>{
12
+ return adapterShopify.createCartOperation(shop$1)(arg);
13
+ }, {
14
+ ...options,
15
+ onSuccess: (result, key, config)=>{
16
+ mutate('cart', result, false);
17
+ options?.onSuccess?.(result, key, config);
18
+ }
19
+ });
20
+ };
21
+
22
+ exports.useCreateCart = useCreateCart;
@@ -1 +1,20 @@
1
- "use strict";var adapterShopify=require("@gem-sdk/adapter-shopify"),useSWR=require("swr"),useSWRMutation=require("swr/mutation"),shop=require("../shop.js");const useRemoveCartItem=e=>{let r=shop.useStoreFront(),{mutate:t}=useSWR.useSWRConfig();return useSWRMutation("remove-cart-item",(e,{arg:t})=>adapterShopify.removeCartItemOperation(r)(t),{...e,onSuccess:(r,s,o)=>{t("cart",r,!1),e?.onSuccess?.(r,s,o)}})};exports.useRemoveCartItem=useRemoveCartItem;
1
+ 'use strict';
2
+
3
+ var adapterShopify = require('@gem-sdk/adapter-shopify');
4
+ var useSWR = require('swr');
5
+ var useSWRMutation = require('swr/mutation');
6
+ var shop = require('../shop.js');
7
+
8
+ const useRemoveCartItem = (options)=>{
9
+ const shop$1 = shop.useStoreFront();
10
+ const { mutate } = useSWR.useSWRConfig();
11
+ return useSWRMutation('remove-cart-item', (_, { arg })=>adapterShopify.removeCartItemOperation(shop$1)(arg), {
12
+ ...options,
13
+ onSuccess: (result, key, config)=>{
14
+ mutate('cart', result, false);
15
+ options?.onSuccess?.(result, key, config);
16
+ }
17
+ });
18
+ };
19
+
20
+ exports.useRemoveCartItem = useRemoveCartItem;