@gem-sdk/core 1.13.38 → 1.14.0-dev.284

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 (249) hide show
  1. package/dist/cjs/components/AddOn.js +1 -18
  2. package/dist/cjs/components/ComponentWrapper.js +1 -28
  3. package/dist/cjs/components/ComponentWrapperPreview.js +1 -72
  4. package/dist/cjs/components/Empty.js +1 -7
  5. package/dist/cjs/components/Render.js +1 -65
  6. package/dist/cjs/components/Render.liquid.js +15 -158
  7. package/dist/cjs/components/RenderBlock.js +1 -54
  8. package/dist/cjs/components/RenderCustomCode.js +5 -0
  9. package/dist/cjs/components/RenderPreview.js +1 -66
  10. package/dist/cjs/components/RenderSection.js +1 -23
  11. package/dist/cjs/components/constant.js +1 -39
  12. package/dist/cjs/components/src/product/helpers/variant-presets.js +1 -0
  13. package/dist/cjs/contexts/AddonContext.js +1 -36
  14. package/dist/cjs/contexts/BuilderComponent.js +1 -34
  15. package/dist/cjs/contexts/BuilderContext.js +1 -35
  16. package/dist/cjs/contexts/BuilderPreviewContext.js +1 -370
  17. package/dist/cjs/contexts/CartLineContext.js +1 -29
  18. package/dist/cjs/contexts/CollectionContext.js +1 -38
  19. package/dist/cjs/contexts/ModalContext.js +1 -47
  20. package/dist/cjs/contexts/ProductContext.js +1 -149
  21. package/dist/cjs/contexts/ProductListContext.js +1 -32
  22. package/dist/cjs/contexts/SectionContext.js +1 -53
  23. package/dist/cjs/contexts/ShopContext.js +1 -70
  24. package/dist/cjs/graphql/fragments/analytic.generated.js +2 -6
  25. package/dist/cjs/graphql/fragments/collection-detail.generated.js +2 -6
  26. package/dist/cjs/graphql/fragments/collection-product.generated.js +2 -6
  27. package/dist/cjs/graphql/fragments/collection.generated.js +2 -6
  28. package/dist/cjs/graphql/fragments/custom-code.generated.js +2 -6
  29. package/dist/cjs/graphql/fragments/data-seo.generated.js +2 -6
  30. package/dist/cjs/graphql/fragments/media.generated.js +3 -6
  31. package/dist/cjs/graphql/fragments/product-little.generated.js +2 -6
  32. package/dist/cjs/graphql/fragments/product-option-value.generated.js +2 -6
  33. package/dist/cjs/graphql/fragments/product-option.generated.js +2 -6
  34. package/dist/cjs/graphql/fragments/product.generated.js +2 -6
  35. package/dist/cjs/graphql/fragments/published-custom-section.generated.js +2 -6
  36. package/dist/cjs/graphql/fragments/published-page-section.generated.js +2 -6
  37. package/dist/cjs/graphql/fragments/published-theme-page.generated.js +2 -6
  38. package/dist/cjs/graphql/fragments/published-theme-style.generated.js +2 -6
  39. package/dist/cjs/graphql/fragments/selected-option.generated.js +2 -6
  40. package/dist/cjs/graphql/fragments/variant.generated.js +2 -6
  41. package/dist/cjs/graphql/mutations/page-view-up.generated.js +3 -7
  42. package/dist/cjs/graphql/queries/collection-detail-filter.generated.js +2 -16
  43. package/dist/cjs/graphql/queries/collection.generated.js +2 -14
  44. package/dist/cjs/graphql/queries/collections.generated.js +2 -9
  45. package/dist/cjs/graphql/queries/preview-page.generated.js +2 -14
  46. package/dist/cjs/graphql/queries/product-little-detail.generated.js +2 -11
  47. package/dist/cjs/graphql/queries/product-medias.generated.js +2 -8
  48. package/dist/cjs/graphql/queries/product-value-label.generated.js +7 -0
  49. package/dist/cjs/graphql/queries/product-variants.generated.js +2 -10
  50. package/dist/cjs/graphql/queries/products.generated.js +3 -17
  51. package/dist/cjs/graphql/queries/published-theme-pages.generated.js +2 -14
  52. package/dist/cjs/graphql/queries/store-property.generated.js +2 -6
  53. package/dist/cjs/helpers/GlobalEvent.js +1 -19
  54. package/dist/cjs/helpers/background.js +1 -109
  55. package/dist/cjs/helpers/borders.js +4 -183
  56. package/dist/cjs/helpers/clone-deep.js +1 -5
  57. package/dist/cjs/helpers/cls.js +1 -16
  58. package/dist/cjs/helpers/colors.js +1 -183
  59. package/dist/cjs/helpers/compose-advance-style.js +1 -188
  60. package/dist/cjs/helpers/constant.js +1 -23
  61. package/dist/cjs/helpers/convert.js +1 -7
  62. package/dist/cjs/helpers/css-variable.js +1 -7
  63. package/dist/cjs/helpers/email.js +1 -11
  64. package/dist/cjs/helpers/flatten-connection.js +1 -9
  65. package/dist/cjs/helpers/get-resonsive-value.js +1 -31
  66. package/dist/cjs/helpers/get-shortname.js +1 -92
  67. package/dist/cjs/helpers/is-browser.js +1 -9
  68. package/dist/cjs/helpers/is-defined.js +1 -7
  69. package/dist/cjs/helpers/is-empty-children.js +1 -12
  70. package/dist/cjs/helpers/is-safari.js +1 -9
  71. package/dist/cjs/helpers/layout.js +1 -59
  72. package/dist/cjs/helpers/load-script.js +1 -31
  73. package/dist/cjs/helpers/make-style.js +1 -128
  74. package/dist/cjs/helpers/normalize-builder-data.js +1 -23
  75. package/dist/cjs/helpers/prefetch-queries.js +1 -78
  76. package/dist/cjs/helpers/product.js +1 -31
  77. package/dist/cjs/helpers/queries/get-collection.js +1 -220
  78. package/dist/cjs/helpers/queries/get-collections.js +1 -21
  79. package/dist/cjs/helpers/queries/get-product-by-slug.js +1 -125
  80. package/dist/cjs/helpers/queries/get-product.js +1 -154
  81. package/dist/cjs/helpers/queries/get-products.js +1 -161
  82. package/dist/cjs/helpers/query.js +1 -29
  83. package/dist/cjs/helpers/radius.js +6 -134
  84. package/dist/cjs/helpers/render.js +1 -71
  85. package/dist/cjs/helpers/shadow.js +1 -56
  86. package/dist/cjs/helpers/size.js +4 -35
  87. package/dist/cjs/helpers/spacing.js +1 -43
  88. package/dist/cjs/helpers/tracking/fpixel.js +1 -28
  89. package/dist/cjs/helpers/tracking/gtag.js +1 -93
  90. package/dist/cjs/helpers/tracking/tiktokpixel.js +1 -17
  91. package/dist/cjs/helpers/typography.js +17 -105
  92. package/dist/cjs/helpers/variant.js +1 -8
  93. package/dist/cjs/hooks/cart/use-add-to-cart.js +1 -20
  94. package/dist/cjs/hooks/cart/use-cart-data.js +1 -28
  95. package/dist/cjs/hooks/cart/use-cart-discount-codes-update.js +1 -20
  96. package/dist/cjs/hooks/cart/use-cart-note-update.js +1 -20
  97. package/dist/cjs/hooks/cart/use-create-cart.js +1 -22
  98. package/dist/cjs/hooks/cart/use-remove-cart-item.js +1 -20
  99. package/dist/cjs/hooks/cart/use-update-cart-item.js +1 -20
  100. package/dist/cjs/hooks/shop/use-collection-query.js +1 -22
  101. package/dist/cjs/hooks/shop/use-collections-query.js +1 -17
  102. package/dist/cjs/hooks/shop/use-product-query.js +1 -22
  103. package/dist/cjs/hooks/shop/use-products-query.js +1 -22
  104. package/dist/cjs/hooks/shop.js +1 -126
  105. package/dist/cjs/hooks/use-current-device.js +1 -21
  106. package/dist/cjs/hooks/use-lazy-video.js +1 -15
  107. package/dist/cjs/hooks/useCartId.js +1 -44
  108. package/dist/cjs/hooks/useCartLine.js +1 -11
  109. package/dist/cjs/hooks/useCartUI.js +1 -48
  110. package/dist/cjs/hooks/useCollection.js +1 -9
  111. package/dist/cjs/hooks/useFetchHandle.js +1 -13
  112. package/dist/cjs/hooks/useFormatMoney.js +1 -58
  113. package/dist/cjs/hooks/useInitialSwatchesOptions.js +1 -0
  114. package/dist/cjs/hooks/useIsomorphicLayoutEffect.js +1 -10
  115. package/dist/cjs/hooks/useLoadScript.js +1 -32
  116. package/dist/cjs/hooks/useMoney.js +1 -84
  117. package/dist/cjs/hooks/usePrevious.js +1 -19
  118. package/dist/cjs/hooks/useProduct.js +1 -127
  119. package/dist/cjs/hooks/useProductList.js +1 -21
  120. package/dist/cjs/hooks/useSuspenseFetch.js +1 -27
  121. package/dist/cjs/hooks/useSwatchesOptions.js +1 -41
  122. package/dist/cjs/index.js +1 -290
  123. package/dist/cjs/types/global-style.js +1 -14
  124. package/dist/cjs/types/shop.js +1 -2
  125. package/dist/esm/components/AddOn.js +1 -14
  126. package/dist/esm/components/ComponentWrapper.js +1 -24
  127. package/dist/esm/components/ComponentWrapperPreview.js +1 -68
  128. package/dist/esm/components/Empty.js +1 -3
  129. package/dist/esm/components/Render.js +1 -61
  130. package/dist/esm/components/Render.liquid.js +15 -153
  131. package/dist/esm/components/RenderBlock.js +1 -50
  132. package/dist/esm/components/RenderCustomCode.js +5 -0
  133. package/dist/esm/components/RenderPreview.js +1 -62
  134. package/dist/esm/components/RenderSection.js +1 -19
  135. package/dist/esm/components/constant.js +1 -37
  136. package/dist/esm/components/src/product/helpers/variant-presets.js +1 -0
  137. package/dist/esm/contexts/AddonContext.js +1 -32
  138. package/dist/esm/contexts/BuilderComponent.js +1 -31
  139. package/dist/esm/contexts/BuilderContext.js +1 -32
  140. package/dist/esm/contexts/BuilderPreviewContext.js +1 -367
  141. package/dist/esm/contexts/CartLineContext.js +1 -26
  142. package/dist/esm/contexts/CollectionContext.js +1 -35
  143. package/dist/esm/contexts/ModalContext.js +1 -44
  144. package/dist/esm/contexts/ProductContext.js +1 -146
  145. package/dist/esm/contexts/ProductListContext.js +1 -28
  146. package/dist/esm/contexts/SectionContext.js +1 -49
  147. package/dist/esm/contexts/ShopContext.js +1 -67
  148. package/dist/esm/graphql/fragments/analytic.generated.js +2 -4
  149. package/dist/esm/graphql/fragments/collection-detail.generated.js +2 -4
  150. package/dist/esm/graphql/fragments/collection-product.generated.js +2 -4
  151. package/dist/esm/graphql/fragments/collection.generated.js +2 -4
  152. package/dist/esm/graphql/fragments/custom-code.generated.js +2 -4
  153. package/dist/esm/graphql/fragments/data-seo.generated.js +2 -4
  154. package/dist/esm/graphql/fragments/media.generated.js +3 -4
  155. package/dist/esm/graphql/fragments/product-little.generated.js +2 -4
  156. package/dist/esm/graphql/fragments/product-option-value.generated.js +2 -4
  157. package/dist/esm/graphql/fragments/product-option.generated.js +2 -4
  158. package/dist/esm/graphql/fragments/product.generated.js +2 -4
  159. package/dist/esm/graphql/fragments/published-custom-section.generated.js +2 -4
  160. package/dist/esm/graphql/fragments/published-page-section.generated.js +2 -4
  161. package/dist/esm/graphql/fragments/published-theme-page.generated.js +2 -4
  162. package/dist/esm/graphql/fragments/published-theme-style.generated.js +2 -4
  163. package/dist/esm/graphql/fragments/selected-option.generated.js +2 -4
  164. package/dist/esm/graphql/fragments/variant.generated.js +2 -4
  165. package/dist/esm/graphql/mutations/page-view-up.generated.js +3 -5
  166. package/dist/esm/graphql/queries/collection-detail-filter.generated.js +10 -22
  167. package/dist/esm/graphql/queries/collection.generated.js +8 -18
  168. package/dist/esm/graphql/queries/collections.generated.js +3 -8
  169. package/dist/esm/graphql/queries/preview-page.generated.js +8 -18
  170. package/dist/esm/graphql/queries/product-little-detail.generated.js +5 -12
  171. package/dist/esm/graphql/queries/product-medias.generated.js +2 -6
  172. package/dist/esm/graphql/queries/product-value-label.generated.js +7 -0
  173. package/dist/esm/graphql/queries/product-variants.generated.js +4 -10
  174. package/dist/esm/graphql/queries/products.generated.js +9 -20
  175. package/dist/esm/graphql/queries/published-theme-pages.generated.js +8 -18
  176. package/dist/esm/graphql/queries/store-property.generated.js +2 -4
  177. package/dist/esm/helpers/GlobalEvent.js +1 -15
  178. package/dist/esm/helpers/background.js +1 -106
  179. package/dist/esm/helpers/borders.js +4 -175
  180. package/dist/esm/helpers/clone-deep.js +1 -3
  181. package/dist/esm/helpers/cls.js +1 -14
  182. package/dist/esm/helpers/colors.js +1 -168
  183. package/dist/esm/helpers/compose-advance-style.js +1 -185
  184. package/dist/esm/helpers/constant.js +1 -19
  185. package/dist/esm/helpers/convert.js +1 -4
  186. package/dist/esm/helpers/css-variable.js +1 -5
  187. package/dist/esm/helpers/email.js +1 -6
  188. package/dist/esm/helpers/flatten-connection.js +1 -7
  189. package/dist/esm/helpers/get-resonsive-value.js +1 -27
  190. package/dist/esm/helpers/get-shortname.js +1 -90
  191. package/dist/esm/helpers/is-browser.js +1 -5
  192. package/dist/esm/helpers/is-defined.js +1 -5
  193. package/dist/esm/helpers/is-empty-children.js +1 -7
  194. package/dist/esm/helpers/is-safari.js +1 -5
  195. package/dist/esm/helpers/layout.js +1 -54
  196. package/dist/esm/helpers/load-script.js +1 -29
  197. package/dist/esm/helpers/make-style.js +1 -117
  198. package/dist/esm/helpers/normalize-builder-data.js +1 -21
  199. package/dist/esm/helpers/prefetch-queries.js +1 -76
  200. package/dist/esm/helpers/product.js +1 -28
  201. package/dist/esm/helpers/queries/get-collection.js +1 -217
  202. package/dist/esm/helpers/queries/get-collections.js +1 -19
  203. package/dist/esm/helpers/queries/get-product-by-slug.js +1 -123
  204. package/dist/esm/helpers/queries/get-product.js +1 -150
  205. package/dist/esm/helpers/queries/get-products.js +1 -159
  206. package/dist/esm/helpers/query.js +1 -25
  207. package/dist/esm/helpers/radius.js +6 -127
  208. package/dist/esm/helpers/render.js +1 -64
  209. package/dist/esm/helpers/shadow.js +1 -51
  210. package/dist/esm/helpers/size.js +4 -31
  211. package/dist/esm/helpers/spacing.js +1 -40
  212. package/dist/esm/helpers/tracking/fpixel.js +1 -24
  213. package/dist/esm/helpers/tracking/gtag.js +1 -87
  214. package/dist/esm/helpers/tracking/tiktokpixel.js +1 -15
  215. package/dist/esm/helpers/typography.js +17 -96
  216. package/dist/esm/helpers/variant.js +1 -6
  217. package/dist/esm/hooks/cart/use-add-to-cart.js +1 -18
  218. package/dist/esm/hooks/cart/use-cart-data.js +1 -26
  219. package/dist/esm/hooks/cart/use-cart-discount-codes-update.js +1 -18
  220. package/dist/esm/hooks/cart/use-cart-note-update.js +1 -18
  221. package/dist/esm/hooks/cart/use-create-cart.js +1 -20
  222. package/dist/esm/hooks/cart/use-remove-cart-item.js +1 -18
  223. package/dist/esm/hooks/cart/use-update-cart-item.js +1 -18
  224. package/dist/esm/hooks/shop/use-collection-query.js +1 -20
  225. package/dist/esm/hooks/shop/use-collections-query.js +1 -15
  226. package/dist/esm/hooks/shop/use-product-query.js +1 -20
  227. package/dist/esm/hooks/shop/use-products-query.js +1 -20
  228. package/dist/esm/hooks/shop.js +1 -111
  229. package/dist/esm/hooks/use-current-device.js +1 -19
  230. package/dist/esm/hooks/use-lazy-video.js +1 -13
  231. package/dist/esm/hooks/useCartId.js +1 -40
  232. package/dist/esm/hooks/useCartLine.js +1 -7
  233. package/dist/esm/hooks/useCartUI.js +1 -44
  234. package/dist/esm/hooks/useCollection.js +1 -7
  235. package/dist/esm/hooks/useFetchHandle.js +1 -11
  236. package/dist/esm/hooks/useFormatMoney.js +1 -56
  237. package/dist/esm/hooks/useInitialSwatchesOptions.js +1 -0
  238. package/dist/esm/hooks/useIsomorphicLayoutEffect.js +1 -6
  239. package/dist/esm/hooks/useLoadScript.js +1 -28
  240. package/dist/esm/hooks/useMoney.js +1 -80
  241. package/dist/esm/hooks/usePrevious.js +1 -17
  242. package/dist/esm/hooks/useProduct.js +1 -114
  243. package/dist/esm/hooks/useProductList.js +1 -16
  244. package/dist/esm/hooks/useSuspenseFetch.js +1 -23
  245. package/dist/esm/hooks/useSwatchesOptions.js +1 -37
  246. package/dist/esm/index.js +1 -92
  247. package/dist/esm/types/global-style.js +1 -11
  248. package/dist/types/index.d.ts +1213 -1031
  249. package/package.json +5 -5
@@ -1,71 +1 @@
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
+ "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,56 +1 @@
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
+ "use strict";var colors=require("./colors.js"),constant=require("./constant.js"),getShortname=require("./get-shortname.js");const parseValueWithUnit=t=>{let e=t.match(/(\d+)(.+)/);if(e&&3===e.length){let t=Number(e[1]??0),a=e[2];return{value:t,unit:a??"px"}}return{value:0,unit:"px"}},getStyleShadow=(t,e=!1)=>{let{styleAppliedFor:a,value:o,isEnableShadow:r}=t||{},{state:s}=t||{};if(s||(s="normal"),!a||!o||void 0===o.distance)return{};let{value:l,unit:n}=parseValueWithUnit(`${o?.distance}`);return{[`-${e?"":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=(t,e,a)=>{if(!t||!e)return{};let o={};for(let[r,s]of Object.entries(t))Object.assign(o,getStyleShadow({value:s,state:r,styleAppliedFor:e,isEnableShadow:a?.[r]}));return o},composeShadowCss=({hasBoxShadow:t,boxShadowValue:e,important:a})=>{if(!t||!e)return;let{value:o,unit:r}=parseValueWithUnit(`${e?.distance}`),s=a?" !important":"";return`box-shadow: ${Math.cos(parseFloat(`${e?.angle}`)*Math.PI/180)*parseFloat(`${o}`)}${r} ${Math.sin(parseFloat(`${e?.angle}`)*Math.PI/180)*parseFloat(`${o}`)}${r} ${e?.blur} ${e?.spread+" "}${colors.getSingleColorVariable(e?.color)}${s};`};exports.composeShadowCss=composeShadowCss,exports.getStyleShadow=getStyleShadow,exports.getStyleShadowState=getStyleShadowState,exports.parseValueWithUnit=parseValueWithUnit;
@@ -1,35 +1,4 @@
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
+ "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,43 +1 @@
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
+ "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,28 +1 @@
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
+ "use strict";const pageview=()=>{window.fbq&&window.fbq("track","PageView")},event=(e,t={})=>{window.fbq&&window.fbq("track",e,t)},addToCart=e=>{window.fbq&&window.fbq("track","AddToCart",{content_ids:[e.id],content_name:e.name,content_category:e.category,content_type:"product",value:e.price,currency:e.currency})};exports.addToCart=addToCart,exports.event=event,exports.pageview=pageview;
@@ -1,93 +1 @@
1
- '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
+ "use strict";const pageview=(e,a)=>{window.gtag&&a&&window.gtag("config",a,{page_path:e}),window.ga&&window.ga("send","pageview",e)},addToCart=e=>{window.ga&&e&&(window.ga("ec:addProduct",{...e,id:e.sku,name:"Default Title"===e.variant?e.name:`${e.name} - ${e.variant}`,variant:"Default Title"===e.variant?e.name:e.variant}),window.ga("ec:setAction","add"),window.ga("send","event",{eventCategory:"EnhancedEcommerce",eventAction:"Added Product",nonInteraction:!0}))},productClick=e=>{window.ga&&(ga("ec:addProduct",{id:e.id,name:e.name,category:e.category,brand:e.brand,variant:e.variant}),ga("ec:setAction","click"),ga("send","event",{eventAction:"Click",eventCategory:"Product"}))},productDetail=e=>{e&&window.ga&&(ga("ec:addProduct",{brand:e.brand,category:e.category,id:e.id,name:e.name,variant:e.variant}),ga("ec:setAction","detail"),ga("send","event",{eventAction:"Detail",eventCategory:"Ecommerce",nonInteraction:1}))},removeFromCart=(e,a)=>{e&&window.ga&&(ga("ec:addProduct",{id:e.id,name:e.name,price:a}),ga("ec:setAction","remove"),ga("send","event",{eventAction:"Click",eventCategory:"Remove from cart"}))};exports.addToCart=addToCart,exports.pageview=pageview,exports.productClick=productClick,exports.productDetail=productDetail,exports.removeFromCart=removeFromCart;
@@ -1,17 +1 @@
1
- '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
+ "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,105 +1,17 @@
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
+ "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,8 +1 @@
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
+ "use strict";function checkInStock(n){return!!n&&(n?.inventoryQuantity&&n.inventoryQuantity>0||!n?.manageInventory||"CONTINUE"===n.inventoryPolicy)}exports.checkInStock=checkInStock;
@@ -1,20 +1 @@
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
+ "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,28 +1 @@
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
+ "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,20 +1 @@
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
+ "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,20 +1 @@
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
+ "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,22 +1 @@
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
+ "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,20 +1 @@
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;
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;