@gem-sdk/core 2.2.0 → 2.4.11
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.
- package/dist/cjs/contexts/ProductContext.js +5 -0
- package/dist/cjs/helpers/third-party/appConfig.js +7 -0
- package/dist/cjs/helpers/third-party/appSetting.js +19 -1
- package/dist/cjs/helpers/third-party/constant.js +2 -1
- package/dist/cjs/helpers/third-party/getAppBlockConfig.js +6 -2
- package/dist/cjs/hooks/useProduct.js +6 -1
- package/dist/esm/contexts/ProductContext.js +5 -0
- package/dist/esm/helpers/third-party/appConfig.js +7 -1
- package/dist/esm/helpers/third-party/appSetting.js +19 -1
- package/dist/esm/helpers/third-party/constant.js +3 -2
- package/dist/esm/helpers/third-party/getAppBlockConfig.js +6 -2
- package/dist/esm/hooks/useProduct.js +6 -1
- package/dist/types/index.d.ts +3 -0
- package/package.json +2 -2
|
@@ -120,6 +120,11 @@ const createProductStoreProvider = (data)=>zustand.createStore((set, get)=>({
|
|
|
120
120
|
set({
|
|
121
121
|
hasPreSelected: value
|
|
122
122
|
});
|
|
123
|
+
},
|
|
124
|
+
setIsChangeSelectedOption: (value)=>{
|
|
125
|
+
set({
|
|
126
|
+
isChangeSelectedOption: value
|
|
127
|
+
});
|
|
123
128
|
}
|
|
124
129
|
}));
|
|
125
130
|
const ProductProvider = ({ children, product, initialVariantId, quantity = 1, isSyncProduct })=>{
|
|
@@ -348,6 +348,12 @@ const AppstleBundlesDiscountsConfig = {
|
|
|
348
348
|
appId: '8909921b-2d24-4d68-9b12-9d045d3dcb0a'
|
|
349
349
|
}
|
|
350
350
|
};
|
|
351
|
+
const ReleasitConfig = {
|
|
352
|
+
Releasit: {
|
|
353
|
+
appName: 'releasit-cod-form',
|
|
354
|
+
appId: '72faf214-4174-4fec-886b-0d0e8d3af9a2'
|
|
355
|
+
}
|
|
356
|
+
};
|
|
351
357
|
|
|
352
358
|
exports.AftershipEmailMarketingsmsConfig = AftershipEmailMarketingsmsConfig;
|
|
353
359
|
exports.AppointmentBookingCowlendarConfig = AppointmentBookingCowlendarConfig;
|
|
@@ -387,6 +393,7 @@ exports.ProductOptionsCustomizerConfig = ProductOptionsCustomizerConfig;
|
|
|
387
393
|
exports.PumperBundlesVolumeDiscountConfig = PumperBundlesVolumeDiscountConfig;
|
|
388
394
|
exports.QikifyUpsellConfig = QikifyUpsellConfig;
|
|
389
395
|
exports.RechargeSubscriptionsConfig = RechargeSubscriptionsConfig;
|
|
396
|
+
exports.ReleasitConfig = ReleasitConfig;
|
|
390
397
|
exports.ReviewxpoProductReviewsAppConfig = ReviewxpoProductReviewsAppConfig;
|
|
391
398
|
exports.SegunoEmailMarketingConfig = SegunoEmailMarketingConfig;
|
|
392
399
|
exports.SelleasyConfig = SelleasyConfig;
|
|
@@ -278,6 +278,13 @@ const overrideSettings = (tag, currentSetting, appSetting)=>{
|
|
|
278
278
|
playlist_id: appSetting?.['playlistId']
|
|
279
279
|
};
|
|
280
280
|
}
|
|
281
|
+
case 'Releasit':
|
|
282
|
+
{
|
|
283
|
+
return {
|
|
284
|
+
...currentSetting,
|
|
285
|
+
product: appSetting?.['productHandle'] || '{{ product }}'
|
|
286
|
+
};
|
|
287
|
+
}
|
|
281
288
|
default:
|
|
282
289
|
return currentSetting;
|
|
283
290
|
}
|
|
@@ -1227,6 +1234,16 @@ const AppstleBundlesDiscounts = {
|
|
|
1227
1234
|
'appstle-bundle-product-page-build-a-box': null
|
|
1228
1235
|
}
|
|
1229
1236
|
};
|
|
1237
|
+
const Releasit = {
|
|
1238
|
+
Releasit: {
|
|
1239
|
+
'button-app-block': {
|
|
1240
|
+
product: '{{product}}'
|
|
1241
|
+
},
|
|
1242
|
+
'form-app-block': {
|
|
1243
|
+
product: '{{product}}'
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
};
|
|
1230
1247
|
const composeSettingsByWidgetType = {
|
|
1231
1248
|
...AppstleBundlesDiscounts,
|
|
1232
1249
|
...HextomCountdownTimerBar,
|
|
@@ -1285,7 +1302,8 @@ const composeSettingsByWidgetType = {
|
|
|
1285
1302
|
...HextomFreeShippingBar,
|
|
1286
1303
|
...ShopifySubscriptions,
|
|
1287
1304
|
...QikifyUpsell,
|
|
1288
|
-
...EcoboostifyShoppableReelUgc
|
|
1305
|
+
...EcoboostifyShoppableReelUgc,
|
|
1306
|
+
...Releasit
|
|
1289
1307
|
};
|
|
1290
1308
|
|
|
1291
1309
|
exports.composeSettingsByWidgetType = composeSettingsByWidgetType;
|
|
@@ -60,7 +60,8 @@ const mapShopifyAppMeta = {
|
|
|
60
60
|
...appConfig.ShopifySubscriptionsConfig,
|
|
61
61
|
...appConfig.QikifyUpsellConfig,
|
|
62
62
|
...appConfig.EcoboostifyShoppableReelUgcConfig,
|
|
63
|
-
...appConfig.AppstleBundlesDiscountsConfig
|
|
63
|
+
...appConfig.AppstleBundlesDiscountsConfig,
|
|
64
|
+
...appConfig.ReleasitConfig
|
|
64
65
|
};
|
|
65
66
|
const THIRD_PARTY_APP_BLOCK_ID_PREFIX = 'gp_app';
|
|
66
67
|
|
|
@@ -7,7 +7,8 @@ const listAppUpdateNewVersion = [
|
|
|
7
7
|
'Growave',
|
|
8
8
|
'Trustoo',
|
|
9
9
|
'LooxReviews',
|
|
10
|
-
'Stamped'
|
|
10
|
+
'Stamped',
|
|
11
|
+
'Releasit'
|
|
11
12
|
];
|
|
12
13
|
const listThirdPartyRejectAppBlock = {
|
|
13
14
|
YotpoReviews: {
|
|
@@ -21,6 +22,9 @@ const listThirdPartyRejectAppBlock = {
|
|
|
21
22
|
},
|
|
22
23
|
Stamped: {
|
|
23
24
|
conditionToReject: 'settings?.version === "v1"'
|
|
25
|
+
},
|
|
26
|
+
Releasit: {
|
|
27
|
+
conditionToReject: 'settings?.version === "v1"'
|
|
24
28
|
}
|
|
25
29
|
};
|
|
26
30
|
const getAppBlockConfig = (tag, appBlockId, settings)=>{
|
|
@@ -35,7 +39,7 @@ const getAppBlockConfig = (tag, appBlockId, settings)=>{
|
|
|
35
39
|
tag,
|
|
36
40
|
widgetType
|
|
37
41
|
});
|
|
38
|
-
const settingByWidget = appSetting.composeSettingsByWidgetType[tag][
|
|
42
|
+
const settingByWidget = appSetting.composeSettingsByWidgetType[tag][widgetType];
|
|
39
43
|
const appSettings = appSetting.overrideSettings(tag, settingByWidget, settings);
|
|
40
44
|
return {
|
|
41
45
|
key: appBlockId,
|
|
@@ -110,6 +110,8 @@ const useSelectedOption = ()=>{
|
|
|
110
110
|
const selectedOptions = ProductContext.useProductStore((s)=>s.selectedOptions);
|
|
111
111
|
const forceSelectedOption = ProductContext.useProductStore((s)=>s.forceSelectedOption);
|
|
112
112
|
const isSyncProduct = ProductContext.useProductStore((s)=>s.isSyncProduct);
|
|
113
|
+
const isChangeSelectedOption = ProductContext.useProductStore((s)=>s.isChangeSelectedOption);
|
|
114
|
+
const setIsChangeSelectedOption = ProductContext.useProductStore((s)=>s.setIsChangeSelectedOption);
|
|
113
115
|
const updateOption = react.useCallback((optionId, optionValue, productId, noEmit)=>{
|
|
114
116
|
if (!noEmit && isSyncProduct) {
|
|
115
117
|
const setOption = new CustomEvent('set-selected-option', {
|
|
@@ -125,9 +127,11 @@ const useSelectedOption = ()=>{
|
|
|
125
127
|
window.dispatchEvent(setOption);
|
|
126
128
|
}
|
|
127
129
|
setSelectedOption(optionId, optionValue);
|
|
130
|
+
setIsChangeSelectedOption(true);
|
|
128
131
|
}, [
|
|
132
|
+
isSyncProduct,
|
|
129
133
|
setSelectedOption,
|
|
130
|
-
|
|
134
|
+
setIsChangeSelectedOption
|
|
131
135
|
]);
|
|
132
136
|
const forceOption = react.useCallback((selectedOption, productId, noEmit)=>{
|
|
133
137
|
if (!noEmit && isSyncProduct) {
|
|
@@ -148,6 +152,7 @@ const useSelectedOption = ()=>{
|
|
|
148
152
|
isSyncProduct
|
|
149
153
|
]);
|
|
150
154
|
return react.useMemo(()=>({
|
|
155
|
+
isChangeSelectedOption,
|
|
151
156
|
selectedOptions,
|
|
152
157
|
setSelectedOption: updateOption,
|
|
153
158
|
forceSelectedOption: forceOption
|
|
@@ -118,6 +118,11 @@ const createProductStoreProvider = (data)=>createStore((set, get)=>({
|
|
|
118
118
|
set({
|
|
119
119
|
hasPreSelected: value
|
|
120
120
|
});
|
|
121
|
+
},
|
|
122
|
+
setIsChangeSelectedOption: (value)=>{
|
|
123
|
+
set({
|
|
124
|
+
isChangeSelectedOption: value
|
|
125
|
+
});
|
|
121
126
|
}
|
|
122
127
|
}));
|
|
123
128
|
const ProductProvider = ({ children, product, initialVariantId, quantity = 1, isSyncProduct })=>{
|
|
@@ -346,5 +346,11 @@ const AppstleBundlesDiscountsConfig = {
|
|
|
346
346
|
appId: '8909921b-2d24-4d68-9b12-9d045d3dcb0a'
|
|
347
347
|
}
|
|
348
348
|
};
|
|
349
|
+
const ReleasitConfig = {
|
|
350
|
+
Releasit: {
|
|
351
|
+
appName: 'releasit-cod-form',
|
|
352
|
+
appId: '72faf214-4174-4fec-886b-0d0e8d3af9a2'
|
|
353
|
+
}
|
|
354
|
+
};
|
|
349
355
|
|
|
350
|
-
export { AftershipEmailMarketingsmsConfig, AppointmentBookingCowlendarConfig, AppstleBundlesDiscountsConfig, BestBuyFulfillmentConfig, BfSizeChartSizeGuideConfig, BoldSubscriptionsConfig, BonLoyaltyRewardsReferralsConfig, BoostAISearchDiscoveryConfig, EasyBundleBuilderSkailamaConfig, EcoboostifyShoppableReelUgcConfig, EssentialAnnouncementBarConfig, EssentialCountdownTimerBarConfig, EstimatedDeliveryDatePlusConfig, FastBundleBundlesDiscountsConfig, FlyBundlesUpsellsFbtConfig, GloColorSwatchvariantImageConfig, GloboProductOptionsVariantConfig, GrowaveConfig, HextomCountdownTimerBarConfig, HextomFreeShippingBarConfig, HulkProductOptionsConfig, InstasellShoppableInstagramConfig, JunipProductReviewsUgcConfig, KachingBundlesConfig, KiteFreeGiftDiscountConfig, LoloyalLoyaltyReferralsConfig, LoopSubscriptionsConfig, LooxReviewsConfig, MyappgurusProductReviewsConfig, OkendoReviewsLoyaltyConfig, PowerfulContactFormBuilderConfig, PowrContactFormBuilderConfig, PreorderNowPreOrderPqConfig, PreorderNowWodPresaleConfig, ProductOptionsCustomizerConfig, PumperBundlesVolumeDiscountConfig, QikifyUpsellConfig, RechargeSubscriptionsConfig, ReviewxpoProductReviewsAppConfig, SegunoEmailMarketingConfig, SelleasyConfig, SeoantTrustBadgesIconConfig, ShopifyFormsConfig, ShopifySubscriptionsConfig, SimpleBundlesKitsConfig, SkioSubscriptionsYcS20Config, SproutPlantTreesGrowSalesConfig, StampedConfig, SubifySubscriptionsConfig, TrustBadgesBearConfig, TrustedsiteTrustBadgesConfig, TrustooConfig, TrustreviewsProductReviewsConfig, TrustshopProductReviewsConfig, UnlimitedBundlesDiscountsConfig, WhatmoreShoppableVideosreelConfig, WishlistKingConfig, YotpoReviewsV3UgcConfig };
|
|
356
|
+
export { AftershipEmailMarketingsmsConfig, AppointmentBookingCowlendarConfig, AppstleBundlesDiscountsConfig, BestBuyFulfillmentConfig, BfSizeChartSizeGuideConfig, BoldSubscriptionsConfig, BonLoyaltyRewardsReferralsConfig, BoostAISearchDiscoveryConfig, EasyBundleBuilderSkailamaConfig, EcoboostifyShoppableReelUgcConfig, EssentialAnnouncementBarConfig, EssentialCountdownTimerBarConfig, EstimatedDeliveryDatePlusConfig, FastBundleBundlesDiscountsConfig, FlyBundlesUpsellsFbtConfig, GloColorSwatchvariantImageConfig, GloboProductOptionsVariantConfig, GrowaveConfig, HextomCountdownTimerBarConfig, HextomFreeShippingBarConfig, HulkProductOptionsConfig, InstasellShoppableInstagramConfig, JunipProductReviewsUgcConfig, KachingBundlesConfig, KiteFreeGiftDiscountConfig, LoloyalLoyaltyReferralsConfig, LoopSubscriptionsConfig, LooxReviewsConfig, MyappgurusProductReviewsConfig, OkendoReviewsLoyaltyConfig, PowerfulContactFormBuilderConfig, PowrContactFormBuilderConfig, PreorderNowPreOrderPqConfig, PreorderNowWodPresaleConfig, ProductOptionsCustomizerConfig, PumperBundlesVolumeDiscountConfig, QikifyUpsellConfig, RechargeSubscriptionsConfig, ReleasitConfig, ReviewxpoProductReviewsAppConfig, SegunoEmailMarketingConfig, SelleasyConfig, SeoantTrustBadgesIconConfig, ShopifyFormsConfig, ShopifySubscriptionsConfig, SimpleBundlesKitsConfig, SkioSubscriptionsYcS20Config, SproutPlantTreesGrowSalesConfig, StampedConfig, SubifySubscriptionsConfig, TrustBadgesBearConfig, TrustedsiteTrustBadgesConfig, TrustooConfig, TrustreviewsProductReviewsConfig, TrustshopProductReviewsConfig, UnlimitedBundlesDiscountsConfig, WhatmoreShoppableVideosreelConfig, WishlistKingConfig, YotpoReviewsV3UgcConfig };
|
|
@@ -276,6 +276,13 @@ const overrideSettings = (tag, currentSetting, appSetting)=>{
|
|
|
276
276
|
playlist_id: appSetting?.['playlistId']
|
|
277
277
|
};
|
|
278
278
|
}
|
|
279
|
+
case 'Releasit':
|
|
280
|
+
{
|
|
281
|
+
return {
|
|
282
|
+
...currentSetting,
|
|
283
|
+
product: appSetting?.['productHandle'] || '{{ product }}'
|
|
284
|
+
};
|
|
285
|
+
}
|
|
279
286
|
default:
|
|
280
287
|
return currentSetting;
|
|
281
288
|
}
|
|
@@ -1225,6 +1232,16 @@ const AppstleBundlesDiscounts = {
|
|
|
1225
1232
|
'appstle-bundle-product-page-build-a-box': null
|
|
1226
1233
|
}
|
|
1227
1234
|
};
|
|
1235
|
+
const Releasit = {
|
|
1236
|
+
Releasit: {
|
|
1237
|
+
'button-app-block': {
|
|
1238
|
+
product: '{{product}}'
|
|
1239
|
+
},
|
|
1240
|
+
'form-app-block': {
|
|
1241
|
+
product: '{{product}}'
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
};
|
|
1228
1245
|
const composeSettingsByWidgetType = {
|
|
1229
1246
|
...AppstleBundlesDiscounts,
|
|
1230
1247
|
...HextomCountdownTimerBar,
|
|
@@ -1283,7 +1300,8 @@ const composeSettingsByWidgetType = {
|
|
|
1283
1300
|
...HextomFreeShippingBar,
|
|
1284
1301
|
...ShopifySubscriptions,
|
|
1285
1302
|
...QikifyUpsell,
|
|
1286
|
-
...EcoboostifyShoppableReelUgc
|
|
1303
|
+
...EcoboostifyShoppableReelUgc,
|
|
1304
|
+
...Releasit
|
|
1287
1305
|
};
|
|
1288
1306
|
|
|
1289
1307
|
export { composeSettingsByWidgetType, overrideSettings };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RechargeSubscriptionsConfig, BonLoyaltyRewardsReferralsConfig, SubifySubscriptionsConfig, SelleasyConfig, LoopSubscriptionsConfig, SkioSubscriptionsYcS20Config, ShopifyFormsConfig, ReviewxpoProductReviewsAppConfig, PumperBundlesVolumeDiscountConfig, UnlimitedBundlesDiscountsConfig, KiteFreeGiftDiscountConfig, FastBundleBundlesDiscountsConfig, SimpleBundlesKitsConfig, EasyBundleBuilderSkailamaConfig, PreorderNowPreOrderPqConfig, FlyBundlesUpsellsFbtConfig, JunipProductReviewsUgcConfig, PreorderNowWodPresaleConfig, YotpoReviewsV3UgcConfig, WhatmoreShoppableVideosreelConfig, ProductOptionsCustomizerConfig, AppointmentBookingCowlendarConfig, BoldSubscriptionsConfig, SproutPlantTreesGrowSalesConfig, InstasellShoppableInstagramConfig, GrowaveConfig, LoloyalLoyaltyReferralsConfig, PowerfulContactFormBuilderConfig, WishlistKingConfig, GloboProductOptionsVariantConfig, KachingBundlesConfig, TrustooConfig, LooxReviewsConfig, PowrContactFormBuilderConfig, BestBuyFulfillmentConfig, AftershipEmailMarketingsmsConfig, SegunoEmailMarketingConfig, SeoantTrustBadgesIconConfig, TrustreviewsProductReviewsConfig, MyappgurusProductReviewsConfig, HulkProductOptionsConfig, TrustshopProductReviewsConfig, StampedConfig, BoostAISearchDiscoveryConfig, EssentialCountdownTimerBarConfig, EssentialAnnouncementBarConfig, OkendoReviewsLoyaltyConfig, EstimatedDeliveryDatePlusConfig, HextomCountdownTimerBarConfig, TrustBadgesBearConfig, TrustedsiteTrustBadgesConfig, GloColorSwatchvariantImageConfig, BfSizeChartSizeGuideConfig, HextomFreeShippingBarConfig, ShopifySubscriptionsConfig, QikifyUpsellConfig, EcoboostifyShoppableReelUgcConfig, AppstleBundlesDiscountsConfig } from './appConfig.js';
|
|
1
|
+
import { RechargeSubscriptionsConfig, BonLoyaltyRewardsReferralsConfig, SubifySubscriptionsConfig, SelleasyConfig, LoopSubscriptionsConfig, SkioSubscriptionsYcS20Config, ShopifyFormsConfig, ReviewxpoProductReviewsAppConfig, PumperBundlesVolumeDiscountConfig, UnlimitedBundlesDiscountsConfig, KiteFreeGiftDiscountConfig, FastBundleBundlesDiscountsConfig, SimpleBundlesKitsConfig, EasyBundleBuilderSkailamaConfig, PreorderNowPreOrderPqConfig, FlyBundlesUpsellsFbtConfig, JunipProductReviewsUgcConfig, PreorderNowWodPresaleConfig, YotpoReviewsV3UgcConfig, WhatmoreShoppableVideosreelConfig, ProductOptionsCustomizerConfig, AppointmentBookingCowlendarConfig, BoldSubscriptionsConfig, SproutPlantTreesGrowSalesConfig, InstasellShoppableInstagramConfig, GrowaveConfig, LoloyalLoyaltyReferralsConfig, PowerfulContactFormBuilderConfig, WishlistKingConfig, GloboProductOptionsVariantConfig, KachingBundlesConfig, TrustooConfig, LooxReviewsConfig, PowrContactFormBuilderConfig, BestBuyFulfillmentConfig, AftershipEmailMarketingsmsConfig, SegunoEmailMarketingConfig, SeoantTrustBadgesIconConfig, TrustreviewsProductReviewsConfig, MyappgurusProductReviewsConfig, HulkProductOptionsConfig, TrustshopProductReviewsConfig, StampedConfig, BoostAISearchDiscoveryConfig, EssentialCountdownTimerBarConfig, EssentialAnnouncementBarConfig, OkendoReviewsLoyaltyConfig, EstimatedDeliveryDatePlusConfig, HextomCountdownTimerBarConfig, TrustBadgesBearConfig, TrustedsiteTrustBadgesConfig, GloColorSwatchvariantImageConfig, BfSizeChartSizeGuideConfig, HextomFreeShippingBarConfig, ShopifySubscriptionsConfig, QikifyUpsellConfig, EcoboostifyShoppableReelUgcConfig, AppstleBundlesDiscountsConfig, ReleasitConfig } from './appConfig.js';
|
|
2
2
|
|
|
3
3
|
const mapShopifyAppMeta = {
|
|
4
4
|
...RechargeSubscriptionsConfig,
|
|
@@ -58,7 +58,8 @@ const mapShopifyAppMeta = {
|
|
|
58
58
|
...ShopifySubscriptionsConfig,
|
|
59
59
|
...QikifyUpsellConfig,
|
|
60
60
|
...EcoboostifyShoppableReelUgcConfig,
|
|
61
|
-
...AppstleBundlesDiscountsConfig
|
|
61
|
+
...AppstleBundlesDiscountsConfig,
|
|
62
|
+
...ReleasitConfig
|
|
62
63
|
};
|
|
63
64
|
const THIRD_PARTY_APP_BLOCK_ID_PREFIX = 'gp_app';
|
|
64
65
|
|
|
@@ -5,7 +5,8 @@ const listAppUpdateNewVersion = [
|
|
|
5
5
|
'Growave',
|
|
6
6
|
'Trustoo',
|
|
7
7
|
'LooxReviews',
|
|
8
|
-
'Stamped'
|
|
8
|
+
'Stamped',
|
|
9
|
+
'Releasit'
|
|
9
10
|
];
|
|
10
11
|
const listThirdPartyRejectAppBlock = {
|
|
11
12
|
YotpoReviews: {
|
|
@@ -19,6 +20,9 @@ const listThirdPartyRejectAppBlock = {
|
|
|
19
20
|
},
|
|
20
21
|
Stamped: {
|
|
21
22
|
conditionToReject: 'settings?.version === "v1"'
|
|
23
|
+
},
|
|
24
|
+
Releasit: {
|
|
25
|
+
conditionToReject: 'settings?.version === "v1"'
|
|
22
26
|
}
|
|
23
27
|
};
|
|
24
28
|
const getAppBlockConfig = (tag, appBlockId, settings)=>{
|
|
@@ -33,7 +37,7 @@ const getAppBlockConfig = (tag, appBlockId, settings)=>{
|
|
|
33
37
|
tag,
|
|
34
38
|
widgetType
|
|
35
39
|
});
|
|
36
|
-
const settingByWidget = composeSettingsByWidgetType[tag][
|
|
40
|
+
const settingByWidget = composeSettingsByWidgetType[tag][widgetType];
|
|
37
41
|
const appSettings = overrideSettings(tag, settingByWidget, settings);
|
|
38
42
|
return {
|
|
39
43
|
key: appBlockId,
|
|
@@ -108,6 +108,8 @@ const useSelectedOption = ()=>{
|
|
|
108
108
|
const selectedOptions = useProductStore((s)=>s.selectedOptions);
|
|
109
109
|
const forceSelectedOption = useProductStore((s)=>s.forceSelectedOption);
|
|
110
110
|
const isSyncProduct = useProductStore((s)=>s.isSyncProduct);
|
|
111
|
+
const isChangeSelectedOption = useProductStore((s)=>s.isChangeSelectedOption);
|
|
112
|
+
const setIsChangeSelectedOption = useProductStore((s)=>s.setIsChangeSelectedOption);
|
|
111
113
|
const updateOption = useCallback((optionId, optionValue, productId, noEmit)=>{
|
|
112
114
|
if (!noEmit && isSyncProduct) {
|
|
113
115
|
const setOption = new CustomEvent('set-selected-option', {
|
|
@@ -123,9 +125,11 @@ const useSelectedOption = ()=>{
|
|
|
123
125
|
window.dispatchEvent(setOption);
|
|
124
126
|
}
|
|
125
127
|
setSelectedOption(optionId, optionValue);
|
|
128
|
+
setIsChangeSelectedOption(true);
|
|
126
129
|
}, [
|
|
130
|
+
isSyncProduct,
|
|
127
131
|
setSelectedOption,
|
|
128
|
-
|
|
132
|
+
setIsChangeSelectedOption
|
|
129
133
|
]);
|
|
130
134
|
const forceOption = useCallback((selectedOption, productId, noEmit)=>{
|
|
131
135
|
if (!noEmit && isSyncProduct) {
|
|
@@ -146,6 +150,7 @@ const useSelectedOption = ()=>{
|
|
|
146
150
|
isSyncProduct
|
|
147
151
|
]);
|
|
148
152
|
return useMemo(()=>({
|
|
153
|
+
isChangeSelectedOption,
|
|
149
154
|
selectedOptions,
|
|
150
155
|
setSelectedOption: updateOption,
|
|
151
156
|
forceSelectedOption: forceOption
|
package/dist/types/index.d.ts
CHANGED
|
@@ -36175,6 +36175,8 @@ type ProductContextProps = {
|
|
|
36175
36175
|
setHasPreSelected: (value: boolean) => void;
|
|
36176
36176
|
useProductCompareAtPrice?: boolean;
|
|
36177
36177
|
setUseProductCompareAtPrice: (value?: boolean) => void;
|
|
36178
|
+
isChangeSelectedOption?: boolean;
|
|
36179
|
+
setIsChangeSelectedOption: (value: boolean) => void;
|
|
36178
36180
|
};
|
|
36179
36181
|
type ProductProviderProps = Pick<ProductContextProps, 'product' | 'quantity' | 'selectedOptions' | 'isSyncProduct'> & {
|
|
36180
36182
|
initialVariantId?: string;
|
|
@@ -44915,6 +44917,7 @@ declare const useHasPreSelected: () => {
|
|
|
44915
44917
|
setHasPreSelected: (value: boolean) => void;
|
|
44916
44918
|
};
|
|
44917
44919
|
declare const useSelectedOption: () => {
|
|
44920
|
+
isChangeSelectedOption: boolean | undefined;
|
|
44918
44921
|
selectedOptions: Record<string, string> | undefined;
|
|
44919
44922
|
setSelectedOption: (optionId?: Maybe$1<string>, optionValue?: Maybe$1<string>, productId?: Maybe$1<string>, noEmit?: boolean) => void;
|
|
44920
44923
|
forceSelectedOption: (selectedOption?: Record<string, string>, productId?: Maybe$1<string>, noEmit?: boolean) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.11",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@gem-sdk/adapter-shopify": "2.1.36",
|
|
31
|
-
"@gem-sdk/styles": "2.
|
|
31
|
+
"@gem-sdk/styles": "2.4.8",
|
|
32
32
|
"@types/classnames": "^2.3.1"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|