@gem-sdk/components 2.1.20 → 2.1.22

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 (32) hide show
  1. package/dist/cjs/marquee/components/MarqueeBase.liquid.js +7 -26
  2. package/dist/cjs/post-purchase/product/components/ProductDiscountTag.js +5 -2
  3. package/dist/cjs/post-purchase/product/components/ProductOffer.js +16 -3
  4. package/dist/cjs/post-purchase/product/components/ProductPrice.js +3 -1
  5. package/dist/cjs/post-purchase/product/components/ProductPriceBreakdown.js +9 -21
  6. package/dist/cjs/post-purchase/product/constants/ProductOfferPlaceholder.js +127 -0
  7. package/dist/cjs/post-purchase/product/hooks/useDynamicProduct.js +28 -0
  8. package/dist/cjs/post-purchase/product/settings/ProductOffer.js +26 -0
  9. package/dist/cjs/product/components/ProductImagesV2/jsx/components/ProductFeaturedImageCarousel.js +12 -4
  10. package/dist/cjs/product/components/Sku.js +2 -14
  11. package/dist/cjs/third-party/components/NotifyBackInStockPreOrder.js +1 -1
  12. package/dist/cjs/third-party/components/QikifyUpsell.js +22 -10
  13. package/dist/cjs/third-party/components/QikifyUpsell.liquid.js +3 -46
  14. package/dist/cjs/third-party/setting/NotifyBackInStockPreOrder.js +2 -2
  15. package/dist/cjs/third-party/setting/QikifyUpsell.js +11 -1
  16. package/dist/esm/marquee/components/MarqueeBase.liquid.js +7 -26
  17. package/dist/esm/post-purchase/product/components/ProductDiscountTag.js +5 -2
  18. package/dist/esm/post-purchase/product/components/ProductOffer.js +16 -3
  19. package/dist/esm/post-purchase/product/components/ProductPrice.js +3 -1
  20. package/dist/esm/post-purchase/product/components/ProductPriceBreakdown.js +9 -21
  21. package/dist/esm/post-purchase/product/constants/ProductOfferPlaceholder.js +125 -0
  22. package/dist/esm/post-purchase/product/hooks/useDynamicProduct.js +26 -0
  23. package/dist/esm/post-purchase/product/settings/ProductOffer.js +26 -0
  24. package/dist/esm/product/components/ProductImagesV2/jsx/components/ProductFeaturedImageCarousel.js +13 -5
  25. package/dist/esm/product/components/Sku.js +3 -15
  26. package/dist/esm/third-party/components/NotifyBackInStockPreOrder.js +1 -1
  27. package/dist/esm/third-party/components/QikifyUpsell.js +22 -10
  28. package/dist/esm/third-party/components/QikifyUpsell.liquid.js +3 -46
  29. package/dist/esm/third-party/setting/NotifyBackInStockPreOrder.js +2 -2
  30. package/dist/esm/third-party/setting/QikifyUpsell.js +11 -1
  31. package/dist/types/index.d.ts +3 -0
  32. package/package.json +2 -2
@@ -46,7 +46,6 @@ const MarqueeBase = ({ style = {}, autoFill = false, play = true, pauseOnHover =
46
46
  };
47
47
  return core.template`
48
48
  <div
49
-
50
49
  style="${containerStyle()}"
51
50
  class="rfm-marquee-container"
52
51
  >
@@ -55,35 +54,17 @@ const MarqueeBase = ({ style = {}, autoFill = false, play = true, pauseOnHover =
55
54
  style="${marqueeStyle()}"
56
55
  >
57
56
  <div class="rfm-initial-child-container">
58
-
59
- ${core.template`
60
- <div style="${childStyle()}" class="${`rfm-child`}">
61
- ${children}
62
- </div>
63
- `}
64
- </div>
65
- <div class="rfm-child-placeholder">
66
- ${core.template`
67
- <div style="${childStyle()}" class="${`rfm-child`}">
68
- ${children}
69
- </div>
70
- `}
71
- </div>
72
- <div class="rfm-child-placeholder">
73
-
74
- ${core.template`
75
- <div style="${childStyle()}" class="${`rfm-child`}">
76
- ${children}
77
- </div>
78
- `}
57
+ ${core.template`
58
+ <div style="${childStyle()}" class="${`rfm-child`}">
59
+ ${children}
60
+ </div>
61
+ `}
79
62
  </div>
80
63
  </div>
81
- <div
64
+ <div
82
65
  class="rfm-marquee placeholder-marquee"
83
66
  style="${marqueeStyle()}"
84
- >
85
-
86
- </div>
67
+ ></div>
87
68
  </div>
88
69
  `;
89
70
  };
@@ -5,26 +5,29 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var core = require('@gem-sdk/core');
7
7
  var Text = require('../../text/Text.js');
8
+ var useDynamicProduct = require('../hooks/useDynamicProduct.js');
8
9
 
9
10
  const PostPurchaseProductDiscountTag = ({ setting = {}, styles = {}, style, builderAttrs, builderProps, children })=>{
10
11
  const currentProduct = core.useProduct();
11
12
  const currentProductId = currentProduct?.baseID?.replace('gid://shopify/Product/', '');
12
13
  const currentOfferDiscount = core.useProductOfferDiscount();
14
+ const { isDynamicProduct, isEnableDynamicDiscount } = useDynamicProduct.useDynamicProduct();
13
15
  const { typo } = styles;
14
16
  const { message } = setting;
17
+ const hasDiscount = !!currentOfferDiscount || isDynamicProduct && isEnableDynamicDiscount;
15
18
  return /*#__PURE__*/ jsxRuntime.jsxs("div", {
16
19
  ...builderAttrs,
17
20
  className: core.cls(builderProps?.uid, 'gp-flex gp-w-full'),
18
21
  style: {
19
22
  ...style,
20
- opacity: currentOfferDiscount ? 1 : 0.2
23
+ opacity: hasDiscount ? 1 : 0.2
21
24
  },
22
25
  id: `shopify-text-element-${builderProps?.uid}`,
23
26
  "data-product-id": currentProductId,
24
27
  children: [
25
28
  /*#__PURE__*/ jsxRuntime.jsx(Text.default, {
26
29
  setting: {
27
- text: currentOfferDiscount ? message : message?.replace(new RegExp(/\{\{Discount\}\}/, 'gi'), '0%')
30
+ text: hasDiscount ? message : message?.replace(new RegExp(/\{\{Discount\}\}/, 'gi'), '0%')
28
31
  },
29
32
  styles: {
30
33
  typo
@@ -11,14 +11,20 @@ var Loading = require('../../../common/components/Loading.js');
11
11
  var ProductVariant = require('./ProductVariant.js');
12
12
  var helper = require('../../utils/helper.js');
13
13
  var index = require('../helpers/index.js');
14
+ var ProductOfferPlaceholder = require('../constants/ProductOfferPlaceholder.js');
15
+ var useDynamicProduct = require('../hooks/useDynamicProduct.js');
14
16
 
15
17
  const PostPurchaseProductOffer = ({ styles, builderAttrs, builderProps, children, setting })=>{
16
18
  const mode = core.useEditorMode();
17
- const { productSetting, productOfferLayout, inlineAlignment, ...rowSetting } = setting || {};
19
+ const { productSetting, productOfferLayout, inlineAlignment, discountAndShippingFee, ...rowSetting } = setting || {};
18
20
  const { productOfferColumnGap, productOfferVerticalGutter, productOfferWidth, ...rowStyles } = styles || {};
19
21
  const productOffers = core.usePageStore((s)=>s.productOffers);
20
22
  const publicStoreFrontData = core.usePageStore((s)=>s.publicStoreFrontData);
21
- const totalProduct = React.useMemo(()=>productOffers?.length, [
23
+ const { isDynamicProduct } = useDynamicProduct.useDynamicProduct();
24
+ const dynamicDiscountOffer = core.usePageStore((s)=>s.dynamicDiscountOffer);
25
+ const totalProduct = React.useMemo(()=>isDynamicProduct ? dynamicDiscountOffer?.appliedProductCount : productOffers?.length, [
26
+ dynamicDiscountOffer?.appliedProductCount,
27
+ isDynamicProduct,
22
28
  productOffers?.length
23
29
  ]);
24
30
  const sortedProductBaseIDs = React.useMemo(()=>{
@@ -44,7 +50,14 @@ const PostPurchaseProductOffer = ({ styles, builderAttrs, builderProps, children
44
50
  const products = React.useMemo(()=>core.flattenConnection(productData.data?.products), [
45
51
  productData.data?.products
46
52
  ]);
47
- const productSortedById = sortedProductBaseIDs?.map((id)=>products?.find((el)=>el?.baseID === id)).filter(Boolean);
53
+ const productSortedById = React.useMemo(()=>{
54
+ return isDynamicProduct && dynamicDiscountOffer?.appliedProductCount ? Array(dynamicDiscountOffer.appliedProductCount).fill(ProductOfferPlaceholder.productOfferPlaceholder) : sortedProductBaseIDs?.map((id)=>products?.find((el)=>el?.baseID === id)).filter(Boolean);
55
+ }, [
56
+ isDynamicProduct,
57
+ dynamicDiscountOffer?.appliedProductCount,
58
+ sortedProductBaseIDs,
59
+ products
60
+ ]);
48
61
  const getStyles = ()=>{
49
62
  return {
50
63
  ...core.makeStyleResponsive('cg', productOfferColumnGap),
@@ -6,6 +6,7 @@ var jsxRuntime = require('react/jsx-runtime');
6
6
  var core = require('@gem-sdk/core');
7
7
  var React = require('react');
8
8
  var Text = require('../../text/Text.js');
9
+ var useDynamicProduct = require('../hooks/useDynamicProduct.js');
9
10
 
10
11
  const PostPurchaseProductPrice = ({ styles, style, builderAttrs, builderProps, children })=>{
11
12
  const currentVariant = core.useCurrentVariant();
@@ -13,6 +14,7 @@ const PostPurchaseProductPrice = ({ styles, style, builderAttrs, builderProps, c
13
14
  const price = currentVariant?.price ?? 0;
14
15
  const salePrice = currentVariant?.salePrice ?? 0;
15
16
  const discount = parseFloat(core.shopifyPriceRounding(core.useProductOfferDiscount(), 2));
17
+ const { isDynamicProduct } = useDynamicProduct.useDynamicProduct();
16
18
  const priceShow = React.useMemo(()=>{
17
19
  if (!discount) {
18
20
  if (styles?.priceType === 'compare') {
@@ -53,7 +55,7 @@ const PostPurchaseProductPrice = ({ styles, style, builderAttrs, builderProps, c
53
55
  /*#__PURE__*/ jsxRuntime.jsx(Text.default, {
54
56
  styles: styles,
55
57
  setting: {
56
- text: moneyFormatted
58
+ text: isDynamicProduct ? '$???' : moneyFormatted
57
59
  },
58
60
  className: core.cls({
59
61
  'gp-money': styles?.priceType === 'regular',
@@ -7,6 +7,7 @@ var core = require('@gem-sdk/core');
7
7
  var React = require('react');
8
8
  var helper = require('../../utils/helper.js');
9
9
  var MoneyLine = require('./priceBreakdown/MoneyLine.js');
10
+ var useDynamicProduct = require('../hooks/useDynamicProduct.js');
10
11
 
11
12
  const PostPurchaseProductPriceBreakdown = ({ setting = {}, styles = {}, style, builderAttrs, builderProps, children })=>{
12
13
  const currentVariant = core.useCurrentVariant();
@@ -21,6 +22,7 @@ const PostPurchaseProductPriceBreakdown = ({ setting = {}, styles = {}, style, b
21
22
  const discountShopifyFormat = core.shopifyPriceRounding(discountWithQuantity, 2);
22
23
  const totalMoneyFormatted = core.useFormatMoney(subTotal - parseFloat(discountShopifyFormat), false);
23
24
  const currentProductId = currentProduct?.baseID?.replace('gid://shopify/Product/', '');
25
+ const { isDynamicProduct, dynamicPrice, dynamicDiscount, isEnableDynamicDiscount } = useDynamicProduct.useDynamicProduct();
24
26
  const { labelStyle, moneyStyle, spacing, width, align, isShowPrice } = styles;
25
27
  const itemGap = React.useMemo(()=>{
26
28
  return helper.postPurchaseSpacing[spacing || 'none'];
@@ -33,19 +35,19 @@ const PostPurchaseProductPriceBreakdown = ({ setting = {}, styles = {}, style, b
33
35
  }, [
34
36
  isShowPrice
35
37
  ]);
36
- const moneyLines = React.useMemo(()=>{
38
+ const getMoneyLines = ()=>{
37
39
  const data = [];
38
40
  if (styles.isShowSubTotalLabel !== false) {
39
41
  data.push({
40
42
  title: setting.subTotalLabel,
41
- money: subTotalMoneyFormatted,
43
+ money: isDynamicProduct ? dynamicPrice : subTotalMoneyFormatted,
42
44
  uniqueId: 'subTotalLabel'
43
45
  });
44
46
  }
45
47
  if (styles.isShowDiscountLabel !== false) {
46
48
  data.push({
47
49
  title: setting.discountLabel,
48
- money: discount > 0 ? discountMoneyFormatted : 'No discount',
50
+ money: isDynamicProduct && dynamicDiscount && isEnableDynamicDiscount ? dynamicPrice : discount > 0 ? discountMoneyFormatted : 'No discount',
49
51
  uniqueId: 'discountLabel'
50
52
  });
51
53
  }
@@ -71,25 +73,11 @@ const PostPurchaseProductPriceBreakdown = ({ setting = {}, styles = {}, style, b
71
73
  }
72
74
  data.push({
73
75
  title: setting.totalLabel,
74
- money: totalMoneyFormatted,
76
+ money: isDynamicProduct ? dynamicPrice : totalMoneyFormatted,
75
77
  uniqueId: 'totalLabel'
76
78
  });
77
79
  return data;
78
- }, [
79
- discount,
80
- discountMoneyFormatted,
81
- setting.discountLabel,
82
- setting.shippingLabel,
83
- setting.subTotalLabel,
84
- setting.taxesLabel,
85
- setting.totalLabel,
86
- styles.isShowSubTotalLabel,
87
- styles.isShowDiscountLabel,
88
- styles.isShowShippingLabel,
89
- styles.isShowTaxesLabel,
90
- subTotalMoneyFormatted,
91
- totalMoneyFormatted
92
- ]);
80
+ };
93
81
  return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
94
82
  children: [
95
83
  /*#__PURE__*/ jsxRuntime.jsxs("div", {
@@ -140,9 +128,9 @@ const PostPurchaseProductPriceBreakdown = ({ setting = {}, styles = {}, style, b
140
128
  ...core.makeStyleResponsive('w', width),
141
129
  gap: itemGap
142
130
  },
143
- children: moneyLines.map((item)=>/*#__PURE__*/ jsxRuntime.jsxs(React.Fragment, {
131
+ children: getMoneyLines().map((item)=>/*#__PURE__*/ jsxRuntime.jsxs(React.Fragment, {
144
132
  children: [
145
- item.uniqueId === 'totalLabel' && moneyLines.length > 1 && /*#__PURE__*/ jsxRuntime.jsx("hr", {}),
133
+ item.uniqueId === 'totalLabel' && getMoneyLines().length > 1 && /*#__PURE__*/ jsxRuntime.jsx("hr", {}),
146
134
  /*#__PURE__*/ jsxRuntime.jsx("div", {
147
135
  children: /*#__PURE__*/ jsxRuntime.jsx(MoneyLine.default, {
148
136
  uniqueId: item.uniqueId,
@@ -0,0 +1,127 @@
1
+ 'use strict';
2
+
3
+ const productOfferPlaceholder = {
4
+ id: '',
5
+ title: 'Dynamic product',
6
+ description: 'This is a dynamic product. The actual product will appear here based on your setup',
7
+ descriptionHtml: '<p class="QN2lPu">This is a dynamic product. The actual product will</p>\n<p class="QN2lPu">appear here based on your setup</p>',
8
+ createdAt: '2024-07-01T04:19:51.286753Z',
9
+ handle: 'dynamic-product',
10
+ averageRating: 0,
11
+ isStorefront: true,
12
+ isSample: false,
13
+ baseID: '',
14
+ sku: '',
15
+ options: [
16
+ {
17
+ id: '1',
18
+ name: 'Variant',
19
+ optionType: '',
20
+ values: [
21
+ {
22
+ id: '1',
23
+ label: 'Variant option',
24
+ isDefault: true,
25
+ baseID: '1'
26
+ }
27
+ ]
28
+ }
29
+ ],
30
+ vendor: '',
31
+ featuredImage: {
32
+ id: '542178560626918105',
33
+ contentType: 'IMAGE',
34
+ previewImage: '',
35
+ src: 'https://cdn.shopify.com/s/files/1/0858/3168/0279/files/gempages_502328832959710176-312cf60c-d923-4913-9873-66545effe9cc.png',
36
+ width: 449,
37
+ height: 449,
38
+ alt: ''
39
+ },
40
+ collections: {
41
+ edges: [
42
+ {
43
+ node: {
44
+ id: '502321959132988135',
45
+ title: 'Home page'
46
+ }
47
+ },
48
+ {
49
+ node: {
50
+ id: '539286505089204764',
51
+ title: 'b'
52
+ }
53
+ },
54
+ {
55
+ node: {
56
+ id: '539286505089401372',
57
+ title: 'e'
58
+ }
59
+ }
60
+ ]
61
+ },
62
+ tags: [],
63
+ medias: {
64
+ edges: [
65
+ {
66
+ cursor: 'gqFpzweGNIc/AALZoXYB',
67
+ node: {
68
+ id: '542178560626918105',
69
+ contentType: 'IMAGE',
70
+ previewImage: '',
71
+ src: 'https://cdn.shopify.com/s/files/1/0858/3168/0279/files/gempages_502328832959710176-312cf60c-d923-4913-9873-66545effe9cc.png',
72
+ width: 449,
73
+ height: 449,
74
+ alt: ''
75
+ }
76
+ }
77
+ ],
78
+ pageInfo: {
79
+ endCursor: 'gqFpzweGNIc/AALZoXYB',
80
+ hasNextPage: true
81
+ }
82
+ },
83
+ variants: {
84
+ edges: [
85
+ {
86
+ cursor: 'gqFpzwc5ZqRtDAMIoXYC',
87
+ node: {
88
+ id: '520560088328176392',
89
+ title: 'Default Title',
90
+ barcode: '',
91
+ baseID: 'gid://shopify/ProductVariant/49298248925463',
92
+ costPrice: 88,
93
+ height: 0,
94
+ inventoryPolicy: 'DENY',
95
+ inventoryQuantity: 211,
96
+ inventoryStatus: '',
97
+ isDigital: true,
98
+ length: 0,
99
+ lowInventoryAmount: 0,
100
+ manageInventory: false,
101
+ mediaId: '0',
102
+ platform: 'SHOPIFY',
103
+ price: 88,
104
+ salePrice: 88,
105
+ sku: '',
106
+ soldIndividually: false,
107
+ weight: 0,
108
+ width: 0,
109
+ selectedOptions: [
110
+ {
111
+ name: 'Variant',
112
+ value: 'Variant option',
113
+ optionType: ''
114
+ }
115
+ ],
116
+ media: undefined
117
+ }
118
+ }
119
+ ],
120
+ pageInfo: {
121
+ hasNextPage: false,
122
+ endCursor: 'gaFpzwc5ZqRtDAMI'
123
+ }
124
+ }
125
+ };
126
+
127
+ exports.productOfferPlaceholder = productOfferPlaceholder;
@@ -0,0 +1,28 @@
1
+ 'use strict';
2
+
3
+ var core = require('@gem-sdk/core');
4
+ var React = require('react');
5
+
6
+ const useDynamicProduct = ()=>{
7
+ const dynamicDiscountOffer = core.usePageStore((s)=>s.dynamicDiscountOffer);
8
+ const isDynamicProduct = React.useMemo(()=>{
9
+ return !!dynamicDiscountOffer;
10
+ }, [
11
+ dynamicDiscountOffer
12
+ ]);
13
+ // false = No discount
14
+ const isEnableDynamicDiscount = React.useMemo(()=>{
15
+ return dynamicDiscountOffer?.isEnabled;
16
+ }, [
17
+ dynamicDiscountOffer
18
+ ]);
19
+ const dynamicPrice = '$???';
20
+ return {
21
+ isDynamicProduct,
22
+ dynamicPrice,
23
+ dynamicDiscount: dynamicDiscountOffer,
24
+ isEnableDynamicDiscount
25
+ };
26
+ };
27
+
28
+ exports.useDynamicProduct = useDynamicProduct;
@@ -184,6 +184,14 @@ const config = {
184
184
  }
185
185
  }
186
186
  },
187
+ {
188
+ id: 'dynamicOfferQuantity',
189
+ type: 'dynamic-offer-quantity',
190
+ min: 1,
191
+ max: 4,
192
+ default: 2,
193
+ isOnlyAcceptInteger: true
194
+ },
187
195
  {
188
196
  id: 'discountAndShippingFee',
189
197
  type: 'discount-and-shipping-fee-product-offer',
@@ -377,6 +385,24 @@ const config = {
377
385
  },
378
386
  layout: 'vertical'
379
387
  },
388
+ {
389
+ type: 'group',
390
+ label: {
391
+ en: 'Product offers'
392
+ },
393
+ controls: [
394
+ {
395
+ type: 'control',
396
+ label: {
397
+ en: 'Quantity'
398
+ },
399
+ setting: {
400
+ id: 'dynamicOfferQuantity'
401
+ }
402
+ }
403
+ ],
404
+ condition: 'false'
405
+ },
380
406
  {
381
407
  type: 'control',
382
408
  label: {
@@ -20,12 +20,20 @@ const ProductFeaturedImageCarousel = ({ productImages, imgRef, onHandleClick, on
20
20
  const { onListener, ref } = core.useInteraction();
21
21
  let delayTimeout;
22
22
  const mode = core.useEditorMode();
23
- const imageActiveIndex = React.useMemo(()=>{
23
+ const getImageActiveIndex = React.useCallback(()=>{
24
24
  const index = productImages?.findIndex((item)=>item.id === featuredImageGlobal?.id);
25
- return index;
25
+ return index ?? 0;
26
26
  }, [
27
- productImages,
28
- featuredImageGlobal
27
+ featuredImageGlobal?.id,
28
+ productImages
29
+ ]);
30
+ const [imageActiveIndex, setImageActiveIndex] = React.useState(getImageActiveIndex());
31
+ React.useEffect(()=>{
32
+ setImageActiveIndex(getImageActiveIndex());
33
+ }, [
34
+ featuredImageGlobal,
35
+ getImageActiveIndex,
36
+ productImages
29
37
  ]);
30
38
  const imageActive = React.useMemo(()=>{
31
39
  if (productImages?.length) return featuredImageGlobal || productImages?.[0];
@@ -5,23 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var core = require('@gem-sdk/core');
7
7
  var Text = require('../../text/components/Text.js');
8
- var product = require('../helpers/product.js');
9
8
 
10
9
  const ProductSku = ({ setting, builderProps, styles })=>{
11
10
  const currentVariant = core.useCurrentVariant();
12
- const product$1 = core.useProduct();
13
- const isDefaultVariant = product.checkDefaultVariant(product$1);
14
- const textContent = setting?.label && setting.label.trim().length ? `${setting.label}: ${currentVariant?.sku || ''}` : `${currentVariant?.sku || ''}`;
15
- if (isDefaultVariant) {
16
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
17
- "data-id": builderProps?.uid,
18
- children: /*#__PURE__*/ jsxRuntime.jsx("p", {
19
- className: "gp-p-2 gp-text-center gp-text-sm gp-font-semibold gp-text-gray-500",
20
- children: "This product does not have a SKU"
21
- })
22
- });
23
- }
24
- if (!isDefaultVariant && !currentVariant?.sku) {
11
+ const textContent = setting?.label?.trim()?.length ? `${setting.label}: ${currentVariant?.sku ?? ''}` : `${currentVariant?.sku ?? ''}`;
12
+ if (!currentVariant?.sku) {
25
13
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
26
14
  "data-id": builderProps?.uid,
27
15
  children: /*#__PURE__*/ jsxRuntime.jsx("p", {
@@ -9,7 +9,7 @@ var ThirdPartyPreview = require('./ThirdPartyPreview.js');
9
9
  const AppConfig = {
10
10
  id: 'notify-back-in-stockpreorder',
11
11
  label: 'Notify! Back in Stock|PreOrder',
12
- logoUrl: 'https://cdn.shopify.com/app-store/listing_images/9216cd5dd17ab1a38de2641bae109159/icon/CNWHjbfSt4MDEAE=.png',
12
+ logoUrl: 'https://cdn.shopify.com/s/files/1/0643/0497/1949/files/Notify_Me_Logo.png?v=1736234550',
13
13
  tag: 'NotifyBackInStockPreOrder'
14
14
  };
15
15
  const NotifyBackInStockPreOrderContent = ()=>{
@@ -8,21 +8,33 @@ var ThirdPartyPreview = require('./ThirdPartyPreview.js');
8
8
  var React = require('react');
9
9
 
10
10
  const WidgetOptions = [
11
- // {
12
- // value: 'bogo',
13
- // label: 'Upsell, Cross-sell',
14
- // },
15
11
  {
16
- value: 'bundle',
17
- label: 'Product bundle'
12
+ value: 'bogo_offer',
13
+ label: 'qikify Buy X get Y'
18
14
  },
19
15
  {
20
- value: 'volume',
21
- label: 'Volume Discount'
16
+ value: 'free_gift',
17
+ label: 'qikify Free Gift'
22
18
  },
23
19
  {
24
- value: 'upsurge',
25
- label: 'Upsurge'
20
+ value: 'bundle_offer',
21
+ label: 'qikify Product Bundle'
22
+ },
23
+ {
24
+ value: 'promotion_badge',
25
+ label: 'qikify Promotion Badge'
26
+ },
27
+ {
28
+ value: 'order-goal',
29
+ label: 'qikify Reward Bar'
30
+ },
31
+ {
32
+ value: 'upsurge_offer',
33
+ label: 'qikify Upsurge Discount'
34
+ },
35
+ {
36
+ value: 'volume_offer',
37
+ label: 'qikify Volume Discount'
26
38
  }
27
39
  ];
28
40
  const AppConfig = {
@@ -2,54 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var core = require('@gem-sdk/core');
5
+ var thirdParty = require('../helpers/thirdParty.js');
6
6
 
7
7
  const QikifyUpsell = ({ setting, advanced })=>{
8
- const { align, widgetType } = setting ?? {};
9
- const prefix = ()=>{
10
- switch(widgetType){
11
- // case 'bogo':
12
- // return 'qbk-bogo-offer';
13
- case 'bundle':
14
- return 'qbk-bundle-offer';
15
- case 'volume':
16
- return 'qbk-volume-offer';
17
- case 'upsurge':
18
- return 'qbk-upsurge-offer';
19
- // case 'free-gift':
20
- // return 'qbk-free-gift-offer';
21
- default:
22
- return '';
23
- }
24
- };
25
- return core.template`
26
- <div
27
- class="${advanced?.cssClass}"
28
- style="${{
29
- ...core.makeStyleResponsive('ta', align)
30
- }}"
31
- >
32
- {% assign productData = product %}
33
- {% if productData %}
34
- {% liquid
35
- assign triggerId = productData.selected_or_first_available_variant.id
36
- assign handle = productData.handle
37
- assign productId = productData.id
38
- assign blockId = block.id
39
- %}
40
- <div id="${prefix()}-{{ productId }}"></div>
41
- <qbk-inject-offer
42
- mount-id="${prefix()}-{{ productId }}"
43
- handle="{{ handle }}"
44
- section-id="{{ section.id }}"
45
- trigger-id="{{ triggerId }}"
46
- product-id="{{ productId }}"
47
- type="${widgetType}"
48
- >
49
- </qbk-inject-offer>
50
- {% endif %}
51
- </div>
52
- `;
8
+ const { align, appBlockId } = setting ?? {};
9
+ return thirdParty.getLiquidForAppBlock(appBlockId, align, `${advanced?.cssClass ?? ''} !gp-block`);
53
10
  };
54
11
 
55
12
  exports.default = QikifyUpsell;
@@ -7,7 +7,7 @@ var NotifyBackInStockPreOrder = require('../components/NotifyBackInStockPreOrder
7
7
  const config = {
8
8
  tag: NotifyBackInStockPreOrder.AppConfig.tag,
9
9
  label: NotifyBackInStockPreOrder.AppConfig.label,
10
- icon: '<img class="gp-w-[24px] gp-border gp-border-[#494949] gp-rounded-[3px]" src="https://cdn.shopify.com/app-store/listing_images/9216cd5dd17ab1a38de2641bae109159/icon/CNWHjbfSt4MDEAE=.png">',
10
+ icon: `<img class="gp-w-[24px] gp-border gp-border-[#494949] gp-rounded-[3px]" src="${NotifyBackInStockPreOrder.AppConfig.logoUrl}">`,
11
11
  editorConfigs: {
12
12
  placeholder: {
13
13
  flowTag: [
@@ -27,7 +27,7 @@ const config = {
27
27
  hideTextContent: true,
28
28
  icon: {
29
29
  desktop: `<div class="w-full flex flex-col items-center">
30
- <img class="w-24 border border-dark-200 rounded-medium" src="https://cdn.shopify.com/app-store/listing_images/9216cd5dd17ab1a38de2641bae109159/icon/CNWHjbfSt4MDEAE=.png">
30
+ <img class="w-24 border border-dark-200 rounded-medium" src="${NotifyBackInStockPreOrder.AppConfig.logoUrl}">
31
31
  <span class="preset-item-title">Notify! Back in Stock|PreOrder</span>
32
32
  </div>`
33
33
  },
@@ -44,6 +44,11 @@ const config = {
44
44
  {
45
45
  id: 'setting',
46
46
  controls: [
47
+ {
48
+ id: 'appBlockId',
49
+ type: 'input',
50
+ default: ''
51
+ },
47
52
  {
48
53
  id: 'install',
49
54
  type: 'open-link',
@@ -64,9 +69,14 @@ const config = {
64
69
  id: 'widgetType',
65
70
  label: 'Choose widget',
66
71
  type: 'select',
67
- default: 'bogo',
72
+ default: 'bogo_offer',
68
73
  options: QikifyUpsell.WidgetOptions
69
74
  },
75
+ {
76
+ id: 'productHandle',
77
+ type: 'product-handle',
78
+ hide: true
79
+ },
70
80
  {
71
81
  id: 'align',
72
82
  label: 'Alignment',