@gem-sdk/core 1.56.0 → 1.57.0-dev.45

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 (54) hide show
  1. package/dist/cjs/components/ComponentToolbarPreview.js +181 -107
  2. package/dist/cjs/components/ComponentWrapper.js +16 -1
  3. package/dist/cjs/components/ComponentWrapperPreview.js +16 -2
  4. package/dist/cjs/components/InteractionSuffix.js +42 -0
  5. package/dist/cjs/components/Render.liquid.js +22 -7
  6. package/dist/cjs/contexts/PageContext.js +42 -1
  7. package/dist/cjs/contexts/ProductContext.js +10 -0
  8. package/dist/cjs/graphql/fragments/published-theme-page.generated.js +4 -0
  9. package/dist/cjs/helpers/animations.js +17 -8
  10. package/dist/cjs/helpers/background.js +10 -5
  11. package/dist/cjs/helpers/compose-advance-style.js +30 -4
  12. package/dist/cjs/helpers/interaction/index.js +110 -0
  13. package/dist/cjs/helpers/radius.js +11 -1
  14. package/dist/cjs/helpers/shadow.js +5 -4
  15. package/dist/cjs/helpers/third-party/appConfig.js +56 -0
  16. package/dist/cjs/helpers/third-party/appSetting.js +207 -60
  17. package/dist/cjs/helpers/third-party/constant.js +9 -1
  18. package/dist/cjs/helpers/third-party/getAppBlockConfig.js +8 -1
  19. package/dist/cjs/hooks/animation/useAnimationConfig.js +2 -1
  20. package/dist/cjs/hooks/animation/useAnimationTarget.js +5 -2
  21. package/dist/cjs/hooks/animation/useApplyAnimation.js +6 -4
  22. package/dist/cjs/hooks/useInteraction.js +19 -0
  23. package/dist/cjs/hooks/useToolbarPostPurchase.js +2 -2
  24. package/dist/cjs/index.js +14 -1
  25. package/dist/cjs/types/animations.js +2 -0
  26. package/dist/cjs/types/custom.js +52 -0
  27. package/dist/esm/components/ComponentToolbarPreview.js +181 -107
  28. package/dist/esm/components/ComponentWrapper.js +16 -1
  29. package/dist/esm/components/ComponentWrapperPreview.js +16 -2
  30. package/dist/esm/components/InteractionSuffix.js +40 -0
  31. package/dist/esm/components/Render.liquid.js +22 -7
  32. package/dist/esm/contexts/PageContext.js +42 -1
  33. package/dist/esm/contexts/ProductContext.js +10 -0
  34. package/dist/esm/graphql/fragments/published-theme-page.generated.js +4 -0
  35. package/dist/esm/helpers/animations.js +17 -8
  36. package/dist/esm/helpers/background.js +10 -5
  37. package/dist/esm/helpers/compose-advance-style.js +31 -5
  38. package/dist/esm/helpers/interaction/index.js +108 -0
  39. package/dist/esm/helpers/radius.js +11 -1
  40. package/dist/esm/helpers/shadow.js +5 -4
  41. package/dist/esm/helpers/third-party/appConfig.js +49 -1
  42. package/dist/esm/helpers/third-party/appSetting.js +207 -60
  43. package/dist/esm/helpers/third-party/constant.js +10 -2
  44. package/dist/esm/helpers/third-party/getAppBlockConfig.js +8 -1
  45. package/dist/esm/hooks/animation/useAnimationConfig.js +2 -1
  46. package/dist/esm/hooks/animation/useAnimationTarget.js +5 -2
  47. package/dist/esm/hooks/animation/useApplyAnimation.js +6 -4
  48. package/dist/esm/hooks/useInteraction.js +17 -0
  49. package/dist/esm/hooks/useToolbarPostPurchase.js +2 -2
  50. package/dist/esm/index.js +4 -1
  51. package/dist/esm/types/animations.js +2 -0
  52. package/dist/esm/types/custom.js +52 -0
  53. package/dist/types/index.d.ts +548 -185
  54. package/package.json +3 -3
@@ -72,6 +72,13 @@ const ShopifyForms = {
72
72
  }
73
73
  }
74
74
  };
75
+ const KachingBundles = {
76
+ KachingBundles: {
77
+ 'app-block': {
78
+ product: '{{product}}'
79
+ }
80
+ }
81
+ };
75
82
  const overrideSettings = (tag, currentSetting, appSetting)=>{
76
83
  switch(tag){
77
84
  case 'ShopifyForms':
@@ -93,6 +100,20 @@ const overrideSettings = (tag, currentSetting, appSetting)=>{
93
100
  selected_product: appSetting?.['productHandle'] || '{{ product }}'
94
101
  };
95
102
  }
103
+ case 'WhatmoreShoppableVideosreel':
104
+ {
105
+ return {
106
+ ...currentSetting,
107
+ ['show-views']: appSetting?.showViews
108
+ };
109
+ }
110
+ case 'PowerfulContactFormBuilder':
111
+ {
112
+ return {
113
+ ...currentSetting,
114
+ shortcode: appSetting?.shortcode
115
+ };
116
+ }
96
117
  default:
97
118
  return currentSetting;
98
119
  }
@@ -215,77 +236,77 @@ const YotpoReviews = {
215
236
  const WhatmoreShoppableVideosreel = {
216
237
  WhatmoreShoppableVideosreel: {
217
238
  'app-block': {
218
- "heading": "Watch and Buy",
219
- "template-type": "template-f",
220
- "show-views": "show",
221
- "ui-theme": "round",
222
- "color-primary": "#343434",
223
- "color-secondary": "#343434",
224
- "title-font": "poppins_n4",
225
- "primary-font": "poppins_n4",
226
- "title-font-size": 40,
227
- "title-font-size-portrait": 24,
228
- "landscape-padding": 40,
229
- "top-bottom-padding": 20,
230
- "scroll-video-tile-size": 80,
231
- "scroll-video-tile-size-portrait": 80,
232
- "min-height": 380
239
+ heading: 'Watch and Buy',
240
+ 'template-type': 'template-f',
241
+ 'show-views': 'show',
242
+ 'ui-theme': 'round',
243
+ 'color-primary': '#343434',
244
+ 'color-secondary': '#343434',
245
+ 'title-font': 'poppins_n4',
246
+ 'primary-font': 'poppins_n4',
247
+ 'title-font-size': 40,
248
+ 'title-font-size-portrait': 24,
249
+ 'landscape-padding': 40,
250
+ 'top-bottom-padding': 20,
251
+ 'scroll-video-tile-size': 80,
252
+ 'scroll-video-tile-size-portrait': 80,
253
+ 'min-height': 380
233
254
  },
234
255
  'app-block-banner': {
235
- "template-type": "template-banner-a",
236
- "ui-theme": "round",
237
- "banner-video-tile-size": 80
256
+ 'template-type': 'template-banner-a',
257
+ 'ui-theme': 'round',
258
+ 'banner-video-tile-size': 80
238
259
  },
239
260
  'app-block-collections': {
240
- "collectionHeading": "W",
241
- "template-type": "template-collections-b",
242
- "ui-theme": "round",
243
- "color-secondary": "#343434",
244
- "primary-font": "poppins_n4",
245
- "tile-size": 60,
246
- "tile-size-portrait": 60,
247
- "min-height": 250
261
+ collectionHeading: 'W',
262
+ 'template-type': 'template-collections-b',
263
+ 'ui-theme': 'round',
264
+ 'color-secondary': '#343434',
265
+ 'primary-font': 'poppins_n4',
266
+ 'tile-size': 60,
267
+ 'tile-size-portrait': 60,
268
+ 'min-height': 250
248
269
  },
249
270
  'app-block-stories': {
250
- "template-type": "template-stories-a",
251
- "ui-theme": "round",
252
- "color-primary": "#343434",
253
- "color-secondary": "#343434",
254
- "primary-font": "poppins_n4",
255
- "stories-top-bottom-padding": 0,
256
- "story-tile-size": 40,
257
- "story-tile-size-desktop": 40
271
+ 'template-type': 'template-stories-a',
272
+ 'ui-theme': 'round',
273
+ 'color-primary': '#343434',
274
+ 'color-secondary': '#343434',
275
+ 'primary-font': 'poppins_n4',
276
+ 'stories-top-bottom-padding': 0,
277
+ 'story-tile-size': 40,
278
+ 'story-tile-size-desktop': 40
258
279
  }
259
280
  }
260
281
  };
261
282
  const ProductOptionsCustomizer = {
262
283
  ProductOptionsCustomizer: {
263
284
  'product-page-customizer': {
264
- "pc_container_size": 100,
265
- "pc_show_options_total": "initial",
266
- "pc_customizations_total_text": "Customizations Total:",
267
- "pc_show_preloader": "hide",
268
- "pc_preloader_color": "",
269
- "pc_ignore_redirect_command": true,
270
- "pc_basic_label_text_color": "#000000",
271
- "pc_basic_label_font_size": 14,
272
- "pc_basic_label_bolden": "unset",
273
- "pc_basic_label_space_above": 0,
274
- "pc_basic_option_background_color": "#FFFFFF",
275
- "pc_basic_option_text_color": "#000000",
276
- "pc_basic_option_border_color": "#000000",
277
- "pc_basic_option_border_style": "solid",
278
- "pc_basic_option_border_width": 1,
279
- "pc_basic_option_curve_the_corners": "none",
280
- "pc_basic_option_font_size": 14,
281
- "pc_basic_option_bolden": "none",
282
- "pc_basic_option_width": 100,
283
- "pc_basic_option_space_above": 0,
284
- "pc_basic_option_space_below": 0,
285
- "pc_basic_option_space_inside": 10,
286
- "pc_advanced_custom_css": "",
287
- "pc_advanced_custom_js": "",
288
- "pc_show_image_swatch_preview": false
285
+ pc_container_size: 100,
286
+ pc_show_options_total: 'initial',
287
+ pc_customizations_total_text: 'Customizations Total:',
288
+ pc_show_preloader: 'hide',
289
+ pc_preloader_color: '',
290
+ pc_ignore_redirect_command: true,
291
+ pc_basic_label_text_color: '#000000',
292
+ pc_basic_label_font_size: 14,
293
+ pc_basic_label_bolden: 'unset',
294
+ pc_basic_label_space_above: 0,
295
+ pc_basic_option_background_color: '#FFFFFF',
296
+ pc_basic_option_text_color: '#000000',
297
+ pc_basic_option_border_color: '#000000',
298
+ pc_basic_option_border_style: 'solid',
299
+ pc_basic_option_border_width: 1,
300
+ pc_basic_option_curve_the_corners: 'none',
301
+ pc_basic_option_font_size: 14,
302
+ pc_basic_option_bolden: 'none',
303
+ pc_basic_option_width: 100,
304
+ pc_basic_option_space_above: 0,
305
+ pc_basic_option_space_below: 0,
306
+ pc_basic_option_space_inside: 10,
307
+ pc_advanced_custom_css: '',
308
+ pc_advanced_custom_js: '',
309
+ pc_show_image_swatch_preview: false
289
310
  }
290
311
  }
291
312
  };
@@ -297,7 +318,130 @@ const AppointmentBookingCowlendar = {
297
318
  }
298
319
  }
299
320
  };
321
+ const BoldSubscriptions = {
322
+ BoldSubscriptions: {
323
+ 'bsub-widget-block': {
324
+ default_subscribe: true,
325
+ primary_color: '#3b63ff',
326
+ secondary_color: '#7dba63',
327
+ background_color: '#f8f9f9',
328
+ border_radius: 4,
329
+ header_text: 'Purchase Options',
330
+ one_time_text: 'One-time Purchase',
331
+ recurring_text: 'Subscribe and Save',
332
+ prepaid_recurring_text: 'Prepaid Subscribe and Save',
333
+ discount_summary_text: '(Save {discount})',
334
+ discount_summary_plural_text: '(Save up to {discount})',
335
+ frequency_header: 'Delivery Frequency',
336
+ frequency_text: 'delivery',
337
+ prepaid_checkbox_label_text: 'Prepay for subscription',
338
+ billing_frequency_header: 'Billing Frequency',
339
+ billing_frequency_text: '{count} Orders',
340
+ delivery_frequency_discount_text: '({discount} off)',
341
+ billing_frequency_discount_text: '({discount} off)',
342
+ prepaid_total_text: 'Billed {price} today',
343
+ prepaid_continue_as_prepaid_text: 'Prepaid order will auto-renew after {count} orders',
344
+ prepaid_continue_as_standard_text: 'Becomes a regular subscription after {count} orders',
345
+ convertible_header: 'Converts to',
346
+ eligible_for_subscription_header: 'Eligible for Subscription',
347
+ initial_dynamic_discount_text: 'Save {initial_percent_discount}% ({initial_fixed_discount})',
348
+ subsequent_dynamic_discounts_text: '{subsequent_percent_discount}% ({subsequent_fixed_discount}) after {order_count} order(s)'
349
+ }
350
+ }
351
+ };
352
+ const SproutPlantTreesGrowSales = {
353
+ SproutPlantTreesGrowSales: {
354
+ badge: null,
355
+ 'impact-banner': null
356
+ }
357
+ };
358
+ const InstasellShoppableInstagram = {
359
+ InstasellShoppableInstagram: {
360
+ 'app-block': {
361
+ heading: 'InstaSell: Instagram Gallery+',
362
+ description: 'Showcase your Instagram Feed on your Shopify Storefront'
363
+ }
364
+ }
365
+ };
366
+ const Growave = {
367
+ Growave: {
368
+ 'block.product.faveButton': {
369
+ option_button_class: ''
370
+ },
371
+ 'block.product.reviewWidget': null,
372
+ 'block.product.reviewAvgProfile': null,
373
+ 'v2.product.reviewsMiniSlider': null
374
+ }
375
+ };
376
+ const LoloyalSettingCommon = {
377
+ title_font_size: 30,
378
+ subtitle_font_size: 13,
379
+ name_font_size: 20,
380
+ details_font_size: 14,
381
+ corner_radius: 8,
382
+ btn_radius: 8,
383
+ top_padding: 32,
384
+ bottom_padding: 32,
385
+ icon_color: '',
386
+ title_color: '#000000',
387
+ subtitle_color: '#000000',
388
+ name_color: '#000000',
389
+ details_color: '#000000',
390
+ card_bg_color: '#FFFFFF',
391
+ background_color: '#ffffff',
392
+ border_color: '#ececec',
393
+ primary_button_color: '#000000',
394
+ primary_button_text_color: '#FFFFFF',
395
+ secondary_button_color: '#FFFFFF',
396
+ secondary_button_text_color: '#000000',
397
+ hover_btn: '#000000',
398
+ hover_text_color: '#FFFFFF',
399
+ custom_css: '/* Add your custom styles here */'
400
+ };
401
+ const LoloyalLoyaltyReferrals = {
402
+ LoloyalLoyaltyReferrals: {
403
+ 'app-banner': {
404
+ img_opacity: 0,
405
+ bg_color: '#F6F6F6',
406
+ banner_height: '400',
407
+ content_position: 'll-middle-left',
408
+ content_alignment: 'left',
409
+ title_font_size: 40,
410
+ subtitle_font_size: 13,
411
+ title_color: '#000000',
412
+ subtitle_color: '#000000',
413
+ btn_radius: 30,
414
+ primary_button_color: '#000000',
415
+ primary_button_text_color: '#FFFFFF',
416
+ secondary_button_color: '#FFFFFF',
417
+ secondary_button_text_color: '#000000',
418
+ hover_btn: '#000000',
419
+ hover_text_color: '#FFFFFF',
420
+ custom_css: '/* Add your custom styles here */'
421
+ },
422
+ 'app-ways-to-earn': LoloyalSettingCommon,
423
+ 'app-ways-to-redeem': LoloyalSettingCommon,
424
+ 'app-referrals': LoloyalSettingCommon
425
+ }
426
+ };
427
+ const PowerfulContactFormBuilder = {
428
+ PowerfulContactFormBuilder: {
429
+ 'app-block': {
430
+ shortcode: ''
431
+ }
432
+ }
433
+ };
434
+ const WishlistKing = {
435
+ WishlistKing: {
436
+ 'wishlist-button-block': null
437
+ }
438
+ };
300
439
  const composeSettingsByWidgetType = {
440
+ ...WishlistKing,
441
+ ...LoloyalLoyaltyReferrals,
442
+ ...PowerfulContactFormBuilder,
443
+ ...InstasellShoppableInstagram,
444
+ ...SproutPlantTreesGrowSales,
301
445
  ...AppointmentBookingCowlendar,
302
446
  ...ProductOptionsCustomizer,
303
447
  ...WhatmoreShoppableVideosreel,
@@ -319,7 +463,10 @@ const composeSettingsByWidgetType = {
319
463
  ...LoyaltyRewardsReferrals,
320
464
  ...SubifySubscriptions,
321
465
  ...SelleasyWidget,
322
- ...YotpoReviews
466
+ ...YotpoReviews,
467
+ ...BoldSubscriptions,
468
+ ...Growave,
469
+ ...KachingBundles
323
470
  };
324
471
 
325
472
  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 } 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, KachingBundlesConfig, LoloyalLoyaltyReferralsConfig, PowerfulContactFormBuilderConfig, WishlistKingConfig } from './appConfig.js';
2
2
 
3
3
  const mapShopifyAppMeta = {
4
4
  ...RechargeSubscriptionsConfig,
@@ -22,7 +22,15 @@ const mapShopifyAppMeta = {
22
22
  ...YotpoReviewsV3UgcConfig,
23
23
  ...WhatmoreShoppableVideosreelConfig,
24
24
  ...ProductOptionsCustomizerConfig,
25
- ...AppointmentBookingCowlendarConfig
25
+ ...AppointmentBookingCowlendarConfig,
26
+ ...BoldSubscriptionsConfig,
27
+ ...SproutPlantTreesGrowSalesConfig,
28
+ ...InstasellShoppableInstagramConfig,
29
+ ...GrowaveConfig,
30
+ ...KachingBundlesConfig,
31
+ ...LoloyalLoyaltyReferralsConfig,
32
+ ...PowerfulContactFormBuilderConfig,
33
+ ...WishlistKingConfig
26
34
  };
27
35
  const THIRD_PARTY_APP_BLOCK_ID_PREFIX = 'gp_app';
28
36
 
@@ -1,10 +1,17 @@
1
1
  import { composeSettingsByWidgetType, overrideSettings } from './appSetting.js';
2
2
  import { getAppBlockType } from './getAppBlockType.js';
3
3
 
4
+ const listAppUpdateNewVersion = [
5
+ 'Growave'
6
+ ];
4
7
  const getAppBlockConfig = (tag, appBlockId, settings)=>{
8
+ let widgetType = settings?.widgetType;
9
+ if (listAppUpdateNewVersion.includes(tag)) {
10
+ widgetType = settings?.widgetTypeV2;
11
+ }
5
12
  const appBlockType = getAppBlockType({
6
13
  tag,
7
- widgetType: settings?.widgetType
14
+ widgetType
8
15
  });
9
16
  const settingByWidget = composeSettingsByWidgetType[tag][settings?.widgetType];
10
17
  const appSettings = overrideSettings(tag, settingByWidget, settings);
@@ -12,7 +12,8 @@ const useAnimationConfig = (props)=>{
12
12
  const { animation, setting } = triggerConfig[trigger];
13
13
  return {
14
14
  type: animation,
15
- setting: setting[animation]
15
+ setting: setting[animation],
16
+ reverse: trigger === "hidden"
16
17
  };
17
18
  }, [
18
19
  configByDevices
@@ -96,9 +96,12 @@ const useAnimationTarget = (props)=>{
96
96
  const initListOfTargets = useCallback(()=>{
97
97
  if (!isEnabledAnimation) return;
98
98
  if (!targets.current) {
99
- targets.current = document.querySelectorAll(`[data-uid="${componentUid}"]`);
99
+ const $storefront = document.body.querySelector('#storefront');
100
+ if ($storefront) {
101
+ targets.current = $storefront.querySelectorAll(`[data-uid="${componentUid}"]`);
102
+ }
100
103
  }
101
- const targetsArray = Array.from(targets.current);
104
+ const targetsArray = Array.from(targets.current || []);
102
105
  if (!targetsArray.length) return;
103
106
  const updatedTargetObjects = getUpdatedTargetObjects(targetsArray);
104
107
  targetObjects.current = updatedTargetObjects;
@@ -4,6 +4,7 @@ import { useAnimationTarget } from './useAnimationTarget.js';
4
4
  import { useAnimationConfig } from './useAnimationConfig.js';
5
5
  import { useAnimationActions } from './useAnimationActions.js';
6
6
  import { useAnimationPreview } from './useAnimationPreview.js';
7
+ import '../../types/custom.js';
7
8
  import { AnimationType } from '../../types/animations.js';
8
9
 
9
10
  const useApplyAnimation = ({ props })=>{
@@ -20,13 +21,13 @@ const useApplyAnimation = ({ props })=>{
20
21
  setAnimationOnFinish,
21
22
  setToolbarActive
22
23
  });
23
- const generateAnimation = useCallback(({ target, setting, type })=>{
24
- return animation[type](target, setting);
24
+ const generateAnimation = useCallback(({ target, setting, type, reverse })=>{
25
+ return animation[type](target, setting, reverse);
25
26
  }, [
26
27
  animation
27
28
  ]);
28
29
  const initListAnimations = useCallback(()=>{
29
- const { type, setting } = getAnimationConfig();
30
+ const { type, setting, reverse } = getAnimationConfig();
30
31
  if (!type || type === AnimationType.None || !targetObjects.current.length) {
31
32
  cancelAnimation();
32
33
  return;
@@ -34,7 +35,8 @@ const useApplyAnimation = ({ props })=>{
34
35
  const listAnimations = targetObjects.current.map((item)=>generateAnimation({
35
36
  type,
36
37
  setting,
37
- target: item.target
38
+ target: item.target,
39
+ reverse
38
40
  }));
39
41
  cancelAnimation();
40
42
  setAnimation(listAnimations);
@@ -0,0 +1,17 @@
1
+ import { usePageStore } from '../contexts/PageContext.js';
2
+
3
+ const useInteraction = ()=>{
4
+ const interactionData = usePageStore((state)=>state.interactionData);
5
+ const { item } = interactionData || {};
6
+ const getAnimationByUid = (uid)=>{
7
+ const targets = item?.targets;
8
+ const targetByUid = targets?.find((target)=>target.uid === uid);
9
+ const metaDataContainsAnimation = targetByUid?.events?.find((it)=>it.condition?.metaData?.animation);
10
+ return metaDataContainsAnimation?.condition?.metaData?.animation;
11
+ };
12
+ return {
13
+ getAnimationByUid
14
+ };
15
+ };
16
+
17
+ export { useInteraction };
@@ -29,7 +29,7 @@ const usePostPurchase = (uid, tag)=>{
29
29
  return count <= 1;
30
30
  };
31
31
  const verifyWrapContainsRequireElement = ()=>{
32
- const $component = document.querySelector(`[data-uid="${uid}"]`);
32
+ const $component = document.body.querySelector('#storefront')?.querySelector(`[data-uid="${uid}"]`);
33
33
  if (!$component) return false;
34
34
  for (const requiredElementTag of postPurchaseRequiredElements){
35
35
  const countElementInsidePage = getElementCountInPage(requiredElementTag);
@@ -42,7 +42,7 @@ const usePostPurchase = (uid, tag)=>{
42
42
  };
43
43
  const countRequiredElement = ()=>{
44
44
  return postPurchaseRequiredElements.reduce((acc, requiredElementTag)=>{
45
- const $component = document.querySelector(`[data-uid="${uid}"]`);
45
+ const $component = document.body.querySelector('#storefront')?.querySelector(`[data-uid="${uid}"]`);
46
46
  if (!$component) return 0;
47
47
  const count = $component.querySelectorAll(`[data-component-tag="${requiredElementTag}"]`).length;
48
48
  return acc + count;
package/dist/esm/index.js CHANGED
@@ -63,11 +63,12 @@ export { isDefined } from './helpers/is-defined.js';
63
63
  export { composeGridLayout, convertOldLayout, gridToArrayRegex, optionLayoutStyle } from './helpers/layout.js';
64
64
  export { makeAspectRatio, makeGlobalSizeHeightResponsive, makeGlobalSizeWidthResponsive, makeHeight, makeLineClamp, makeStyle, makeStyleKey, makeStyleResponsive, makeStyleResponsiveByScreen, makeStyleResponsiveState, makeStyleState, makeWidth, removeNullUndefined } from './helpers/make-style.js';
65
65
  export { convertTextAlignToJustify } from './helpers/align.js';
66
+ export { checkInStock } from './helpers/variant.js';
66
67
  export { checkAvailableVariantInStock, getSelectedVariant, parseSelectedOption } from './helpers/product.js';
67
68
  export { generateCollectionQueryKey, generateProductQueryKey, generateProductsQueryKey } from './helpers/query.js';
68
69
  export { composeCornerCss, composeRadius, composeRadiusResponsive, getCornerCSSFromGlobal, getCustomRadius, getRadiusCSSFromGlobal, getRadiusStyleActiveState } from './helpers/radius.js';
69
70
  export { RenderIf, composeMemo, dataStringify, props, removeUndefinedValuesFromObject, styles, template } from './helpers/render.js';
70
- export { composeShadowCss, getResonsiveStyleShadow, getStyleShadow, getStyleShadowState, parseValueWithUnit } from './helpers/shadow.js';
71
+ export { composeShadowCss, getResponsiveStyleShadow, getStyleShadow, getStyleShadowState, parseValueWithUnit } from './helpers/shadow.js';
71
72
  export { composeSize, composeSizeCss, genSizeClass, getAspectRatioGlobalSize, getGlobalSizeGap, getHeightByShapeGlobalSize, getPaddingGlobalSize, getValueByDevice, getWidthByShapeGlobalSize, getWidthHeightGlobalSize, makeGlobalSize, makeGlobalSizeIcon, makeStyleWithDefault } from './helpers/size.js';
72
73
  export { composeFallbackTypographyStyle, composeFontFamilyTypographyV2, composeTypography, composeTypographyAttr, composeTypographyClassName, composeTypographyCss, composeTypographyStyle, composeTypographyV2, composeTypographyV2Css, genTypoClass } from './helpers/typography.js';
73
74
  export { useAddToCart } from './hooks/cart/use-add-to-cart.js';
@@ -100,6 +101,7 @@ export { useProductList, useProductListProducts, useProductListSettings, useProd
100
101
  export { default as useSuspenseFetch } from './hooks/useSuspenseFetch.js';
101
102
  export { default as useSwatchesOptions } from './hooks/useSwatchesOptions.js';
102
103
  export { default as useInitialSwatchesOptions } from './hooks/useInitialSwatchesOptions.js';
104
+ export { InteractionTargetEvent, InteractionTriggerEvent } from './types/custom.js';
103
105
  import * as shop from './types/shop.js';
104
106
  export { shop as ShopType };
105
107
  import * as appAPI from './types/appAPI.js';
@@ -111,3 +113,4 @@ export { fetchMedias, fetchVariants, getProduct } from './helpers/queries/get-pr
111
113
  export { getProductBySlug } from './helpers/queries/get-product-by-slug.js';
112
114
  export { getAppBlocks } from './helpers/third-party/getAppBlocks.js';
113
115
  export { addAppBlockId } from './helpers/third-party/addAppBlockId.js';
116
+ export { useInteraction } from './helpers/interaction/index.js';
@@ -30,6 +30,8 @@ var AnimationTriggerType;
30
30
  (function(AnimationTriggerType) {
31
31
  AnimationTriggerType["Appear"] = 'appear';
32
32
  AnimationTriggerType["Hover"] = 'hover';
33
+ AnimationTriggerType["Hidden"] = 'hidden';
34
+ AnimationTriggerType["AppearByTrigger"] = 'appearByTrigger';
33
35
  })(AnimationTriggerType || (AnimationTriggerType = {}));
34
36
  var AnimationZoomDirectionType;
35
37
  (function(AnimationZoomDirectionType) {
@@ -0,0 +1,52 @@
1
+ var InteractionTargetEvent;
2
+ (function(InteractionTargetEvent) {
3
+ InteractionTargetEvent[InteractionTargetEvent['gp:change-background-color'] = 0] = 'gp:change-background-color';
4
+ InteractionTargetEvent[InteractionTargetEvent['gp:run-animation'] = 1] = 'gp:run-animation';
5
+ InteractionTargetEvent[InteractionTargetEvent['gp:toggle-element-visibility'] = 2] = 'gp:toggle-element-visibility';
6
+ InteractionTargetEvent[InteractionTargetEvent['gp:change-text'] = 3] = 'gp:change-text';
7
+ InteractionTargetEvent[InteractionTargetEvent['gp:scroll-to'] = 4] = 'gp:scroll-to';
8
+ InteractionTargetEvent[InteractionTargetEvent['gp:change-text-style'] = 5] = 'gp:change-text-style';
9
+ InteractionTargetEvent[InteractionTargetEvent['gp:change-content'] = 6] = 'gp:change-content';
10
+ InteractionTargetEvent[InteractionTargetEvent['gp:change-button-style'] = 7] = 'gp:change-button-style';
11
+ InteractionTargetEvent[InteractionTargetEvent['gp:copy-text'] = 8] = 'gp:copy-text';
12
+ InteractionTargetEvent[InteractionTargetEvent['gp:change-image'] = 9] = 'gp:change-image';
13
+ InteractionTargetEvent[InteractionTargetEvent['gp:toggle-video-play'] = 10] = 'gp:toggle-video-play';
14
+ InteractionTargetEvent[InteractionTargetEvent['gp:change-slider-ratio'] = 11] = 'gp:change-slider-ratio';
15
+ InteractionTargetEvent[InteractionTargetEvent['gp:change-icon-style'] = 12] = 'gp:change-icon-style';
16
+ InteractionTargetEvent[InteractionTargetEvent['gp:change-expanded-item'] = 13] = 'gp:change-expanded-item';
17
+ InteractionTargetEvent[InteractionTargetEvent['gp:change-active-item'] = 14] = 'gp:change-active-item';
18
+ InteractionTargetEvent[InteractionTargetEvent['gp:change-slide'] = 15] = 'gp:change-slide';
19
+ InteractionTargetEvent[InteractionTargetEvent['gp:change-image-step'] = 16] = 'gp:change-image-step';
20
+ InteractionTargetEvent[InteractionTargetEvent['gp:change-text-value'] = 17] = 'gp:change-text-value';
21
+ InteractionTargetEvent[InteractionTargetEvent['gp:toggle-popup-open'] = 18] = 'gp:toggle-popup-open';
22
+ InteractionTargetEvent[InteractionTargetEvent['gp:show-or-hide'] = 19] = 'gp:show-or-hide';
23
+ InteractionTargetEvent[InteractionTargetEvent['gp:change-banner'] = 20] = 'gp:change-banner';
24
+ InteractionTargetEvent[InteractionTargetEvent['gp:change-open-tab'] = 21] = 'gp:change-open-tab';
25
+ })(InteractionTargetEvent || (InteractionTargetEvent = {}));
26
+ var InteractionTriggerEvent;
27
+ (function(InteractionTriggerEvent) {
28
+ InteractionTriggerEvent[InteractionTriggerEvent['click'] = 0] = 'click';
29
+ InteractionTriggerEvent[InteractionTriggerEvent["active"] = 1] = "active";
30
+ InteractionTriggerEvent[InteractionTriggerEvent['mouseover'] = 2] = 'mouseover';
31
+ InteractionTriggerEvent[InteractionTriggerEvent['gp:appear'] = 3] = 'gp:appear';
32
+ InteractionTriggerEvent[InteractionTriggerEvent['gp:item-selected'] = 4] = 'gp:item-selected';
33
+ InteractionTriggerEvent[InteractionTriggerEvent['gp:item-unselected'] = 5] = 'gp:item-unselected';
34
+ InteractionTriggerEvent[InteractionTriggerEvent['gp:item-hovered'] = 6] = 'gp:item-hovered';
35
+ InteractionTriggerEvent[InteractionTriggerEvent['gp:item-click'] = 7] = 'gp:item-click';
36
+ InteractionTriggerEvent[InteractionTriggerEvent['gp:after-submit'] = 8] = 'gp:after-submit';
37
+ InteractionTriggerEvent[InteractionTriggerEvent['gp:quantity-change'] = 9] = 'gp:quantity-change';
38
+ InteractionTriggerEvent[InteractionTriggerEvent['gp:after-checked-value'] = 10] = 'gp:after-checked-value';
39
+ InteractionTriggerEvent[InteractionTriggerEvent['gp:after-add-to-cart'] = 11] = 'gp:after-add-to-cart';
40
+ InteractionTriggerEvent[InteractionTriggerEvent['gp:popup-open'] = 12] = 'gp:popup-open';
41
+ InteractionTriggerEvent[InteractionTriggerEvent['gp:popup-close'] = 13] = 'gp:popup-close';
42
+ InteractionTriggerEvent[InteractionTriggerEvent['scroll-up'] = 14] = 'scroll-up';
43
+ InteractionTriggerEvent[InteractionTriggerEvent['scroll-down'] = 15] = 'scroll-down';
44
+ InteractionTriggerEvent[InteractionTriggerEvent['gp:price-change'] = 16] = 'gp:price-change';
45
+ InteractionTriggerEvent[InteractionTriggerEvent['gp:rollback-price-change'] = 17] = 'gp:rollback-price-change';
46
+ InteractionTriggerEvent[InteractionTriggerEvent['gp:compare-price-change'] = 18] = 'gp:compare-price-change';
47
+ InteractionTriggerEvent[InteractionTriggerEvent['gp:rollback:compare-price-change'] = 19] = 'gp:rollback:compare-price-change';
48
+ InteractionTriggerEvent[InteractionTriggerEvent['gp:stock-change'] = 20] = 'gp:stock-change';
49
+ InteractionTriggerEvent[InteractionTriggerEvent['gp:rollback:stock-change'] = 21] = 'gp:rollback:stock-change';
50
+ })(InteractionTriggerEvent || (InteractionTriggerEvent = {}));
51
+
52
+ export { InteractionTargetEvent, InteractionTriggerEvent };