@gem-sdk/components 2.0.0-staging.154 → 2.0.0-staging.161

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 (52) hide show
  1. package/dist/cjs/banner/components/hero-banner/index.liquid.js +1 -1
  2. package/dist/cjs/builder.js +4 -0
  3. package/dist/cjs/index.js +4 -0
  4. package/dist/cjs/index.liquid.js +4 -0
  5. package/dist/cjs/post-purchase/product/components/ProductDiscountTag.js +5 -2
  6. package/dist/cjs/post-purchase/product/components/ProductOffer.js +16 -3
  7. package/dist/cjs/post-purchase/product/components/ProductPrice.js +3 -1
  8. package/dist/cjs/post-purchase/product/components/ProductPriceBreakdown.js +9 -21
  9. package/dist/cjs/post-purchase/product/constants/ProductOfferPlaceholder.js +149 -0
  10. package/dist/cjs/post-purchase/product/hooks/useDynamicProduct.js +28 -0
  11. package/dist/cjs/post-purchase/product/settings/ProductOffer.js +26 -0
  12. package/dist/cjs/product/components/ProductBundleDiscountItem.liquid.js +3 -3
  13. package/dist/cjs/product/components/ProductVariants/variants/index.js +1 -1
  14. package/dist/cjs/product/components/ProductVariants/variants/index.liquid.js +1 -1
  15. package/dist/cjs/third-party/components/EssentialAnnouncementBar.js +33 -0
  16. package/dist/cjs/third-party/components/EssentialAnnouncementBar.liquid.js +12 -0
  17. package/dist/cjs/third-party/components/EssentialCountdownTimerBar.js +33 -0
  18. package/dist/cjs/third-party/components/EssentialCountdownTimerBar.liquid.js +12 -0
  19. package/dist/cjs/third-party/configs/EssentialAnnouncementBar.js +12 -0
  20. package/dist/cjs/third-party/configs/EssentialCountdownTimerBar.js +12 -0
  21. package/dist/cjs/third-party/helpers/thirdParty.js +1 -1
  22. package/dist/cjs/third-party/next.js +10 -0
  23. package/dist/cjs/third-party/setting/EssentialAnnouncementBar.js +142 -0
  24. package/dist/cjs/third-party/setting/EssentialCountdownTimerBar.js +142 -0
  25. package/dist/cjs/third-party/setting/index.js +4 -0
  26. package/dist/esm/banner/components/hero-banner/index.liquid.js +1 -1
  27. package/dist/esm/builder.js +4 -0
  28. package/dist/esm/index.js +2 -0
  29. package/dist/esm/index.liquid.js +2 -0
  30. package/dist/esm/post-purchase/product/components/ProductDiscountTag.js +5 -2
  31. package/dist/esm/post-purchase/product/components/ProductOffer.js +16 -3
  32. package/dist/esm/post-purchase/product/components/ProductPrice.js +3 -1
  33. package/dist/esm/post-purchase/product/components/ProductPriceBreakdown.js +9 -21
  34. package/dist/esm/post-purchase/product/constants/ProductOfferPlaceholder.js +147 -0
  35. package/dist/esm/post-purchase/product/hooks/useDynamicProduct.js +26 -0
  36. package/dist/esm/post-purchase/product/settings/ProductOffer.js +26 -0
  37. package/dist/esm/product/components/ProductBundleDiscountItem.liquid.js +3 -3
  38. package/dist/esm/product/components/ProductVariants/variants/index.js +1 -1
  39. package/dist/esm/product/components/ProductVariants/variants/index.liquid.js +1 -1
  40. package/dist/esm/third-party/components/EssentialAnnouncementBar.js +29 -0
  41. package/dist/esm/third-party/components/EssentialAnnouncementBar.liquid.js +8 -0
  42. package/dist/esm/third-party/components/EssentialCountdownTimerBar.js +29 -0
  43. package/dist/esm/third-party/components/EssentialCountdownTimerBar.liquid.js +8 -0
  44. package/dist/esm/third-party/configs/EssentialAnnouncementBar.js +8 -0
  45. package/dist/esm/third-party/configs/EssentialCountdownTimerBar.js +8 -0
  46. package/dist/esm/third-party/helpers/thirdParty.js +1 -1
  47. package/dist/esm/third-party/next.js +10 -0
  48. package/dist/esm/third-party/setting/EssentialAnnouncementBar.js +138 -0
  49. package/dist/esm/third-party/setting/EssentialCountdownTimerBar.js +138 -0
  50. package/dist/esm/third-party/setting/index.js +206 -202
  51. package/dist/types/index.d.ts +38 -1
  52. package/package.json +2 -2
@@ -8,6 +8,14 @@ require('react/jsx-runtime');
8
8
  require('react');
9
9
  require('@gem-sdk/core');
10
10
 
11
+ const EssentialAnnouncementBar = dynamic(()=>Promise.resolve().then(function () { return require('./components/EssentialAnnouncementBar.js'); }), {
12
+ ssr: false,
13
+ loading: Loading.default
14
+ });
15
+ const EssentialCountdownTimerBar = dynamic(()=>Promise.resolve().then(function () { return require('./components/EssentialCountdownTimerBar.js'); }), {
16
+ ssr: false,
17
+ loading: Loading.default
18
+ });
11
19
  const StellarDeliveryDatePickup = dynamic(()=>Promise.resolve().then(function () { return require('./components/StellarDeliveryDatePickup.js'); }), {
12
20
  ssr: false,
13
21
  loading: Loading.default
@@ -413,6 +421,8 @@ const Selleasy = dynamic(()=>Promise.resolve().then(function () { return require
413
421
  loading: Loading.default
414
422
  });
415
423
  var thirdParty = {
424
+ EssentialAnnouncementBar,
425
+ EssentialCountdownTimerBar,
416
426
  StellarDeliveryDatePickup,
417
427
  TrustshopProductReviews,
418
428
  HulkProductOptions,
@@ -0,0 +1,142 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var EssentialAnnouncementBar = require('../configs/EssentialAnnouncementBar.js');
6
+
7
+ const config = {
8
+ tag: EssentialAnnouncementBar.default.tag,
9
+ label: EssentialAnnouncementBar.default.label,
10
+ icon: '<img class="gp-w-6 gp-border gp-border-[#494949] gp-rounded-[3px]" src="https://cdn.shopify.com/app-store/listing_images/15e8255158a042a1eab34a4c45c72aa5/icon/CMK1jPv9uoADEAE=.png">',
11
+ editorConfigs: {
12
+ component: {
13
+ isThirdParty: true
14
+ }
15
+ },
16
+ presets: [
17
+ {
18
+ id: EssentialAnnouncementBar.default.id,
19
+ name: {
20
+ en: EssentialAnnouncementBar.default.label
21
+ },
22
+ hideTextContent: true,
23
+ icon: {
24
+ desktop: `<div class="w-full flex flex-col items-center">
25
+ <img class="w-24 border border-dark-200 rounded-medium" src="https://cdn.shopify.com/app-store/listing_images/15e8255158a042a1eab34a4c45c72aa5/icon/CMK1jPv9uoADEAE=.png">
26
+ <span class="preset-item-title">Essential Announcement Bar</span>
27
+ </div>`
28
+ },
29
+ components: [
30
+ {
31
+ tag: EssentialAnnouncementBar.default.tag
32
+ }
33
+ ]
34
+ }
35
+ ],
36
+ settings: [
37
+ {
38
+ id: 'setting',
39
+ controls: [
40
+ {
41
+ id: 'appBlockId',
42
+ type: 'input',
43
+ default: ''
44
+ },
45
+ {
46
+ id: 'widgetType',
47
+ label: 'Choose widget',
48
+ type: 'select',
49
+ options: [
50
+ {
51
+ label: 'App Block',
52
+ value: 'app-block'
53
+ }
54
+ ],
55
+ default: 'app-block'
56
+ },
57
+ {
58
+ id: 'install',
59
+ type: 'open-link',
60
+ target: '_blank',
61
+ linkType: 'install',
62
+ href: 'https://apps.shopify.com/essential-announcement-bar?utm_source=gempages',
63
+ appName: EssentialAnnouncementBar.default.label
64
+ },
65
+ {
66
+ id: 'announcementId',
67
+ type: 'input',
68
+ default: ''
69
+ },
70
+ {
71
+ id: 'openApp',
72
+ type: 'open-link',
73
+ target: '_blank',
74
+ linkType: 'openApp',
75
+ href: 'https://admin.shopify.com/?redirect=/apps/essential-announcement-bar',
76
+ appName: EssentialAnnouncementBar.default.label
77
+ },
78
+ {
79
+ id: 'align',
80
+ label: 'Alignment',
81
+ type: 'segment',
82
+ options: [
83
+ {
84
+ label: 'Left',
85
+ value: 'left',
86
+ type: 'align'
87
+ },
88
+ {
89
+ label: 'Center',
90
+ value: 'center',
91
+ type: 'align'
92
+ },
93
+ {
94
+ label: 'Right',
95
+ value: 'right',
96
+ type: 'align'
97
+ }
98
+ ],
99
+ devices: {
100
+ desktop: {
101
+ default: 'left'
102
+ }
103
+ }
104
+ }
105
+ ]
106
+ }
107
+ ],
108
+ ui: [
109
+ {
110
+ type: 'control',
111
+ setting: {
112
+ id: 'install'
113
+ }
114
+ },
115
+ {
116
+ type: 'control',
117
+ label: {
118
+ en: 'Announcement id'
119
+ },
120
+ setting: {
121
+ id: 'announcementId'
122
+ }
123
+ },
124
+ {
125
+ type: 'control',
126
+ setting: {
127
+ id: 'openApp'
128
+ }
129
+ },
130
+ {
131
+ type: 'control',
132
+ label: {
133
+ en: 'Align'
134
+ },
135
+ setting: {
136
+ id: 'align'
137
+ }
138
+ }
139
+ ]
140
+ };
141
+
142
+ exports.default = config;
@@ -0,0 +1,142 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var EssentialCountdownTimerBar = require('../configs/EssentialCountdownTimerBar.js');
6
+
7
+ const config = {
8
+ tag: EssentialCountdownTimerBar.default.tag,
9
+ label: EssentialCountdownTimerBar.default.label,
10
+ icon: '<img class="gp-w-6 gp-border gp-border-[#494949] gp-rounded-[3px]" src="https://cdn.shopify.com/app-store/listing_images/f84bf9e49eca8bd84c2af7488461363b/icon/CPzKxLTD4_UCEAE=.png">',
11
+ editorConfigs: {
12
+ component: {
13
+ isThirdParty: true
14
+ }
15
+ },
16
+ presets: [
17
+ {
18
+ id: EssentialCountdownTimerBar.default.id,
19
+ name: {
20
+ en: EssentialCountdownTimerBar.default.label
21
+ },
22
+ hideTextContent: true,
23
+ icon: {
24
+ desktop: `<div class="w-full flex flex-col items-center">
25
+ <img class="w-24 border border-dark-200 rounded-medium" src="https://cdn.shopify.com/app-store/listing_images/f84bf9e49eca8bd84c2af7488461363b/icon/CPzKxLTD4_UCEAE=.png">
26
+ <span class="preset-item-title">Essential Countdown Timer Bar</span>
27
+ </div>`
28
+ },
29
+ components: [
30
+ {
31
+ tag: EssentialCountdownTimerBar.default.tag
32
+ }
33
+ ]
34
+ }
35
+ ],
36
+ settings: [
37
+ {
38
+ id: 'setting',
39
+ controls: [
40
+ {
41
+ id: 'appBlockId',
42
+ type: 'input',
43
+ default: ''
44
+ },
45
+ {
46
+ id: 'widgetType',
47
+ label: 'Choose widget',
48
+ type: 'select',
49
+ options: [
50
+ {
51
+ label: 'App Block',
52
+ value: 'app-block'
53
+ }
54
+ ],
55
+ default: 'app-block'
56
+ },
57
+ {
58
+ id: 'install',
59
+ type: 'open-link',
60
+ target: '_blank',
61
+ linkType: 'install',
62
+ href: 'https://apps.shopify.com/essential-countdown-timer?utm_source=gempages',
63
+ appName: EssentialCountdownTimerBar.default.label
64
+ },
65
+ {
66
+ id: 'timerId',
67
+ type: 'input',
68
+ default: ''
69
+ },
70
+ {
71
+ id: 'openApp',
72
+ type: 'open-link',
73
+ target: '_blank',
74
+ linkType: 'openApp',
75
+ href: 'https://admin.shopify.com/?redirect=/apps/countdown-timer-30',
76
+ appName: EssentialCountdownTimerBar.default.label
77
+ },
78
+ {
79
+ id: 'align',
80
+ label: 'Alignment',
81
+ type: 'segment',
82
+ options: [
83
+ {
84
+ label: 'Left',
85
+ value: 'left',
86
+ type: 'align'
87
+ },
88
+ {
89
+ label: 'Center',
90
+ value: 'center',
91
+ type: 'align'
92
+ },
93
+ {
94
+ label: 'Right',
95
+ value: 'right',
96
+ type: 'align'
97
+ }
98
+ ],
99
+ devices: {
100
+ desktop: {
101
+ default: 'left'
102
+ }
103
+ }
104
+ }
105
+ ]
106
+ }
107
+ ],
108
+ ui: [
109
+ {
110
+ type: 'control',
111
+ setting: {
112
+ id: 'install'
113
+ }
114
+ },
115
+ {
116
+ type: 'control',
117
+ label: {
118
+ en: 'Timer id'
119
+ },
120
+ setting: {
121
+ id: 'timerId'
122
+ }
123
+ },
124
+ {
125
+ type: 'control',
126
+ setting: {
127
+ id: 'openApp'
128
+ }
129
+ },
130
+ {
131
+ type: 'control',
132
+ label: {
133
+ en: 'Align'
134
+ },
135
+ setting: {
136
+ id: 'align'
137
+ }
138
+ }
139
+ ]
140
+ };
141
+
142
+ exports.default = config;
@@ -103,8 +103,12 @@ var MyappgurusProductReviews = require('./MyappgurusProductReviews.js');
103
103
  var HulkProductOptions = require('./HulkProductOptions.js');
104
104
  var TrustshopProductReviews = require('./TrustshopProductReviews.js');
105
105
  var StellarDeliveryDatePickup = require('./StellarDeliveryDatePickup.js');
106
+ var EssentialCountdownTimerBar = require('./EssentialCountdownTimerBar.js');
107
+ var EssentialAnnouncementBar = require('./EssentialAnnouncementBar.js');
106
108
 
107
109
  var thirdPartySetting = {
110
+ EssentialAnnouncementBar: EssentialAnnouncementBar.default,
111
+ EssentialCountdownTimerBar: EssentialCountdownTimerBar.default,
108
112
  StellarDeliveryDatePickup: StellarDeliveryDatePickup.default,
109
113
  TrustshopProductReviews: TrustshopProductReviews.default,
110
114
  HulkProductOptions: HulkProductOptions.default,
@@ -262,7 +262,6 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
262
262
  }}">
263
263
  <gp-hero-banner
264
264
  gp-data='${dataStringify({
265
- href: urlData?.href ?? '',
266
265
  target: urlData?.target ?? '_blank',
267
266
  background: backgroundResponsive,
268
267
  uid: builderProps?.uid,
@@ -275,6 +274,7 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
275
274
  contentPosition2Col: styles?.contentPosition2Col,
276
275
  aspectRatio: setting?.aspectRatio
277
276
  }).replaceAll("'", '&#039;')}'
277
+ gp-href="${urlData.href}"
278
278
  ${{
279
279
  ...builderAttrs
280
280
  }}
@@ -108,6 +108,8 @@ import MyappgurusProductReviews from './third-party/components/MyappgurusProduct
108
108
  import HulkProductOptions from './third-party/components/HulkProductOptions.js';
109
109
  import TrustshopProductReviews from './third-party/components/TrustshopProductReviews.js';
110
110
  import StellarDeliveryDatePickup from './third-party/components/StellarDeliveryDatePickup.js';
111
+ import EssentialCountdownTimerBar from './third-party/components/EssentialCountdownTimerBar.js';
112
+ import EssentialAnnouncementBar from './third-party/components/EssentialAnnouncementBar.js';
111
113
  import CartLineVariant from './cart/components/CartLineVariant.js';
112
114
  import Cart from './cart/components/Cart.js';
113
115
  import CartList from './cart/components/CartList.js';
@@ -244,6 +246,8 @@ import Link$1 from './post-purchase/link/components/PostPurchaseLink.js';
244
246
  import Text$1 from './post-purchase/text/Text.js';
245
247
 
246
248
  var builder = {
249
+ EssentialAnnouncementBar,
250
+ EssentialCountdownTimerBar,
247
251
  StellarDeliveryDatePickup,
248
252
  TrustshopProductReviews,
249
253
  HulkProductOptions,
package/dist/esm/index.js CHANGED
@@ -205,6 +205,8 @@ export { default as MyappgurusProductReviews } from './third-party/components/My
205
205
  export { default as HulkProductOptions } from './third-party/components/HulkProductOptions.js';
206
206
  export { default as TrustshopProductReviews } from './third-party/components/TrustshopProductReviews.js';
207
207
  export { default as StellarDeliveryDatePickup } from './third-party/components/StellarDeliveryDatePickup.js';
208
+ export { default as EssentialCountdownTimerBar } from './third-party/components/EssentialCountdownTimerBar.js';
209
+ export { default as EssentialAnnouncementBar } from './third-party/components/EssentialAnnouncementBar.js';
208
210
  export { default as thirdPartyInstantSetting } from './third-party-instant/setting/index.js';
209
211
  export { default as InstantJudgemeReviews } from './third-party-instant/components/InstantJudgemeReviews.js';
210
212
  export { default as InstantLooxReviews } from './third-party-instant/components/InstantLooxReviews.js';
@@ -159,6 +159,8 @@ export { default as DiscountyBulkDiscountSales } from './third-party/components/
159
159
  export { default as TrustreviewsProductReviews } from './third-party/components/TrustreviewsProductReviews.liquid.js';
160
160
  export { default as MyappgurusProductReviews } from './third-party/components/MyappgurusProductReviews.liquid.js';
161
161
  export { default as HulkProductOptions } from './third-party/components/HulkProductOptions.liquid.js';
162
+ export { default as EssentialCountdownTimerBar } from './third-party/components/EssentialCountdownTimerBar.liquid.js';
163
+ export { default as EssentialAnnouncementBar } from './third-party/components/EssentialAnnouncementBar.liquid.js';
162
164
  export { default as TrustshopProductReviews } from './third-party/components/TrustshopProductReviews.liquid.js';
163
165
  export { default as StellarDeliveryDatePickup } from './third-party/components/StellarDeliveryDatePickup.liquid.js';
164
166
  export { default as ImageComparison } from './image-comparison/components/ImageComparison.liquid.js';
@@ -2,26 +2,29 @@
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import { useProduct, useProductOfferDiscount, cls } from '@gem-sdk/core';
4
4
  import Text from '../../text/Text.js';
5
+ import { useDynamicProduct } from '../hooks/useDynamicProduct.js';
5
6
 
6
7
  const PostPurchaseProductDiscountTag = ({ setting = {}, styles = {}, style, builderAttrs, builderProps, children })=>{
7
8
  const currentProduct = useProduct();
8
9
  const currentProductId = currentProduct?.baseID?.replace('gid://shopify/Product/', '');
9
10
  const currentOfferDiscount = useProductOfferDiscount();
11
+ const { isDynamicProduct, isEnableDynamicDiscount } = useDynamicProduct();
10
12
  const { typo } = styles;
11
13
  const { message } = setting;
14
+ const hasDiscount = !!currentOfferDiscount || isDynamicProduct && isEnableDynamicDiscount;
12
15
  return /*#__PURE__*/ jsxs("div", {
13
16
  ...builderAttrs,
14
17
  className: cls(builderProps?.uid, 'gp-flex gp-w-full'),
15
18
  style: {
16
19
  ...style,
17
- opacity: currentOfferDiscount ? 1 : 0.2
20
+ opacity: hasDiscount ? 1 : 0.2
18
21
  },
19
22
  id: `shopify-text-element-${builderProps?.uid}`,
20
23
  "data-product-id": currentProductId,
21
24
  children: [
22
25
  /*#__PURE__*/ jsx(Text, {
23
26
  setting: {
24
- text: currentOfferDiscount ? message : message?.replace(new RegExp(/\{\{Discount\}\}/, 'gi'), '0%')
27
+ text: hasDiscount ? message : message?.replace(new RegExp(/\{\{Discount\}\}/, 'gi'), '0%')
25
28
  },
26
29
  styles: {
27
30
  typo
@@ -8,14 +8,20 @@ import Loading from '../../../common/components/Loading.js';
8
8
  import { DEVICES } from './ProductVariant.js';
9
9
  import { postPurchaseViewSpacing } from '../../utils/helper.js';
10
10
  import { hasPublicStoreFrontData, createStoreFrontFetcher } from '../helpers/index.js';
11
+ import { productOfferPlaceholder } from '../constants/ProductOfferPlaceholder.js';
12
+ import { useDynamicProduct } from '../hooks/useDynamicProduct.js';
11
13
 
12
14
  const PostPurchaseProductOffer = ({ styles, builderAttrs, builderProps, children, setting })=>{
13
15
  const mode = useEditorMode();
14
- const { productSetting, productOfferLayout, inlineAlignment, variantSelected, ...rowSetting } = setting || {};
16
+ const { productSetting, productOfferLayout, inlineAlignment, variantSelected, discountAndShippingFee, ...rowSetting } = setting || {};
15
17
  const { productOfferColumnGap, productOfferVerticalGutter, productOfferWidth, ...rowStyles } = styles || {};
16
18
  const productOffers = usePageStore((s)=>s.productOffers);
17
19
  const publicStoreFrontData = usePageStore((s)=>s.publicStoreFrontData);
18
- const totalProduct = useMemo(()=>productOffers?.length, [
20
+ const { isDynamicProduct } = useDynamicProduct();
21
+ const dynamicDiscountOffer = usePageStore((s)=>s.dynamicDiscountOffer);
22
+ const totalProduct = useMemo(()=>isDynamicProduct ? dynamicDiscountOffer?.appliedProductCount : productOffers?.length, [
23
+ dynamicDiscountOffer?.appliedProductCount,
24
+ isDynamicProduct,
19
25
  productOffers?.length
20
26
  ]);
21
27
  const sortedProductBaseIDs = useMemo(()=>{
@@ -41,7 +47,14 @@ const PostPurchaseProductOffer = ({ styles, builderAttrs, builderProps, children
41
47
  const products = useMemo(()=>flattenConnection(productData.data?.products), [
42
48
  productData.data?.products
43
49
  ]);
44
- const productSortedById = sortedProductBaseIDs?.map((id)=>products?.find((el)=>el?.baseID === id)).filter(Boolean);
50
+ const productSortedById = useMemo(()=>{
51
+ return isDynamicProduct && dynamicDiscountOffer?.appliedProductCount ? Array(dynamicDiscountOffer.appliedProductCount).fill(productOfferPlaceholder) : sortedProductBaseIDs?.map((id)=>products?.find((el)=>el?.baseID === id)).filter(Boolean);
52
+ }, [
53
+ isDynamicProduct,
54
+ dynamicDiscountOffer?.appliedProductCount,
55
+ sortedProductBaseIDs,
56
+ products
57
+ ]);
45
58
  const getStyles = ()=>{
46
59
  return {
47
60
  ...makeStyleResponsive('cg', productOfferColumnGap),
@@ -3,6 +3,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
3
3
  import { useCurrentVariant, useProduct, shopifyPriceRounding, useProductOfferDiscount, useFormatMoney, cls } from '@gem-sdk/core';
4
4
  import { useMemo } from 'react';
5
5
  import Text from '../../text/Text.js';
6
+ import { useDynamicProduct } from '../hooks/useDynamicProduct.js';
6
7
 
7
8
  const PostPurchaseProductPrice = ({ styles, style, builderAttrs, builderProps, children })=>{
8
9
  const currentVariant = useCurrentVariant();
@@ -10,6 +11,7 @@ const PostPurchaseProductPrice = ({ styles, style, builderAttrs, builderProps, c
10
11
  const price = currentVariant?.price ?? 0;
11
12
  const salePrice = currentVariant?.salePrice ?? 0;
12
13
  const discount = parseFloat(shopifyPriceRounding(useProductOfferDiscount(), 2));
14
+ const { isDynamicProduct } = useDynamicProduct();
13
15
  const priceShow = useMemo(()=>{
14
16
  if (!discount) {
15
17
  if (styles?.priceType === 'compare') {
@@ -50,7 +52,7 @@ const PostPurchaseProductPrice = ({ styles, style, builderAttrs, builderProps, c
50
52
  /*#__PURE__*/ jsx(Text, {
51
53
  styles: styles,
52
54
  setting: {
53
- text: moneyFormatted
55
+ text: isDynamicProduct ? '$???' : moneyFormatted
54
56
  },
55
57
  className: cls({
56
58
  'gp-money': styles?.priceType === 'regular',
@@ -4,6 +4,7 @@ import { useCurrentVariant, useProduct, useQuantity, useProductOfferDiscount, us
4
4
  import { useMemo, useState, useEffect, Fragment as Fragment$1 } from 'react';
5
5
  import { postPurchaseSpacing } from '../../utils/helper.js';
6
6
  import MoneyLine from './priceBreakdown/MoneyLine.js';
7
+ import { useDynamicProduct } from '../hooks/useDynamicProduct.js';
7
8
 
8
9
  const PostPurchaseProductPriceBreakdown = ({ setting = {}, styles = {}, style, builderAttrs, builderProps, children })=>{
9
10
  const currentVariant = useCurrentVariant();
@@ -18,6 +19,7 @@ const PostPurchaseProductPriceBreakdown = ({ setting = {}, styles = {}, style, b
18
19
  const discountShopifyFormat = shopifyPriceRounding(discountWithQuantity, 2);
19
20
  const totalMoneyFormatted = useFormatMoney(subTotal - parseFloat(discountShopifyFormat), false);
20
21
  const currentProductId = currentProduct?.baseID?.replace('gid://shopify/Product/', '');
22
+ const { isDynamicProduct, dynamicPrice, dynamicDiscount, isEnableDynamicDiscount } = useDynamicProduct();
21
23
  const { labelStyle, moneyStyle, spacing, width, align, isShowPrice } = styles;
22
24
  const itemGap = useMemo(()=>{
23
25
  return postPurchaseSpacing[spacing || 'none'];
@@ -30,19 +32,19 @@ const PostPurchaseProductPriceBreakdown = ({ setting = {}, styles = {}, style, b
30
32
  }, [
31
33
  isShowPrice
32
34
  ]);
33
- const moneyLines = useMemo(()=>{
35
+ const getMoneyLines = ()=>{
34
36
  const data = [];
35
37
  if (styles.isShowSubTotalLabel !== false) {
36
38
  data.push({
37
39
  title: setting.subTotalLabel,
38
- money: subTotalMoneyFormatted,
40
+ money: isDynamicProduct ? dynamicPrice : subTotalMoneyFormatted,
39
41
  uniqueId: 'subTotalLabel'
40
42
  });
41
43
  }
42
44
  if (styles.isShowDiscountLabel !== false) {
43
45
  data.push({
44
46
  title: setting.discountLabel,
45
- money: discount > 0 ? discountMoneyFormatted : 'No discount',
47
+ money: isDynamicProduct && dynamicDiscount && isEnableDynamicDiscount ? `${dynamicDiscount.value}%` : discount > 0 ? discountMoneyFormatted : 'No discount',
46
48
  uniqueId: 'discountLabel'
47
49
  });
48
50
  }
@@ -68,25 +70,11 @@ const PostPurchaseProductPriceBreakdown = ({ setting = {}, styles = {}, style, b
68
70
  }
69
71
  data.push({
70
72
  title: setting.totalLabel,
71
- money: totalMoneyFormatted,
73
+ money: isDynamicProduct ? dynamicPrice : totalMoneyFormatted,
72
74
  uniqueId: 'totalLabel'
73
75
  });
74
76
  return data;
75
- }, [
76
- discount,
77
- discountMoneyFormatted,
78
- setting.discountLabel,
79
- setting.shippingLabel,
80
- setting.subTotalLabel,
81
- setting.taxesLabel,
82
- setting.totalLabel,
83
- styles.isShowSubTotalLabel,
84
- styles.isShowDiscountLabel,
85
- styles.isShowShippingLabel,
86
- styles.isShowTaxesLabel,
87
- subTotalMoneyFormatted,
88
- totalMoneyFormatted
89
- ]);
77
+ };
90
78
  return /*#__PURE__*/ jsxs(Fragment, {
91
79
  children: [
92
80
  /*#__PURE__*/ jsxs("div", {
@@ -137,9 +125,9 @@ const PostPurchaseProductPriceBreakdown = ({ setting = {}, styles = {}, style, b
137
125
  ...makeStyleResponsive('w', width),
138
126
  gap: itemGap
139
127
  },
140
- children: moneyLines.map((item)=>/*#__PURE__*/ jsxs(Fragment$1, {
128
+ children: getMoneyLines().map((item)=>/*#__PURE__*/ jsxs(Fragment$1, {
141
129
  children: [
142
- item.uniqueId === 'totalLabel' && moneyLines.length > 1 && /*#__PURE__*/ jsx("hr", {}),
130
+ item.uniqueId === 'totalLabel' && getMoneyLines().length > 1 && /*#__PURE__*/ jsx("hr", {}),
143
131
  /*#__PURE__*/ jsx("div", {
144
132
  children: /*#__PURE__*/ jsx(MoneyLine, {
145
133
  uniqueId: item.uniqueId,