@useinsider/guido 3.19.0-beta.c8d2be8 → 3.19.0-beta.cc48fee

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 (73) hide show
  1. package/dist/@types/config/schemas.js +104 -91
  2. package/dist/components/Guido.vue.js +6 -6
  3. package/dist/components/Guido.vue2.js +96 -85
  4. package/dist/components/organisms/base/AuthErrorModal.vue.js +18 -0
  5. package/dist/components/organisms/base/AuthErrorModal.vue2.js +42 -0
  6. package/dist/components/organisms/header/EditorActions.vue.js +4 -4
  7. package/dist/components/organisms/header/EditorActions.vue2.js +23 -25
  8. package/dist/components/wrappers/WpModal.vue.js +1 -1
  9. package/dist/components/wrappers/WpModal.vue2.js +4 -3
  10. package/dist/composables/useActionsApi.js +52 -47
  11. package/dist/composables/useAuthError.js +52 -0
  12. package/dist/composables/useAutoSave.js +11 -11
  13. package/dist/composables/useCodeEditorApi.js +23 -9
  14. package/dist/composables/useCortexBlueprintBridge.js +122 -54
  15. package/dist/composables/useEmailTemplateApplier.js +111 -50
  16. package/dist/composables/useHttp.js +48 -49
  17. package/dist/composables/useLegacyStrategyConversion.js +23 -19
  18. package/dist/composables/useStripo.js +24 -20
  19. package/dist/composables/useToaster.js +17 -15
  20. package/dist/composables/useTranslations.js +3 -2
  21. package/dist/composables/useVersionHistoryApi.js +33 -24
  22. package/dist/composables/validators/useLiquidValidator.js +15 -15
  23. package/dist/config/migrator/index.js +14 -13
  24. package/dist/config/migrator/itemsBlockMigrator.js +236 -248
  25. package/dist/config/migrator/recommendationMigrator.js +28 -21
  26. package/dist/config/migrator/recommendationPartnerMigrator.js +56 -0
  27. package/dist/enums/extensions/recommendationBlock.js +30 -29
  28. package/dist/extensions/Blocks/Items/constants/cardLayout.js +20 -0
  29. package/dist/extensions/Blocks/Items/controls/name/trimming.js +18 -17
  30. package/dist/extensions/Blocks/Items/controls/settingsControl.js +114 -105
  31. package/dist/extensions/Blocks/Items/enums/productEnums.js +14 -9
  32. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +11 -9
  33. package/dist/extensions/Blocks/Items/template.js +219 -204
  34. package/dist/extensions/Blocks/Recommendation/block.js +15 -14
  35. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +45 -38
  36. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +72 -49
  37. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +30 -29
  38. package/dist/extensions/Blocks/Recommendation/utils/partnerCustomizations.js +3 -1
  39. package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +25 -0
  40. package/dist/guido.css +1 -1
  41. package/dist/src/@types/config/schemas.d.ts +16 -0
  42. package/dist/src/components/organisms/base/AuthErrorModal.vue.d.ts +2 -0
  43. package/dist/src/components/wrappers/WpModal.vue.d.ts +5 -1
  44. package/dist/src/composables/useAuthError.d.ts +12 -0
  45. package/dist/src/composables/useConfig.d.ts +2 -0
  46. package/dist/src/composables/useCortexBlueprintBridge.d.ts +2 -3
  47. package/dist/src/composables/useEmailTemplateApplier.d.ts +18 -5
  48. package/dist/src/composables/useGuidoActions.d.ts +2 -0
  49. package/dist/src/composables/useHttp.d.ts +2 -0
  50. package/dist/src/config/migrator/index.d.ts +2 -1
  51. package/dist/src/config/migrator/recommendationPartnerMigrator.d.ts +19 -0
  52. package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -1
  53. package/dist/src/extensions/Blocks/Items/constants/cardLayout.d.ts +44 -0
  54. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +3 -0
  55. package/dist/src/extensions/Blocks/Items/template.d.ts +19 -0
  56. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
  57. package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +33 -0
  58. package/dist/src/mock/cortexChatStore.d.ts +12 -0
  59. package/dist/src/stores/config.d.ts +20 -0
  60. package/dist/src/stores/guido-email-editor.d.ts +20 -10
  61. package/dist/src/stores/onboarding.d.ts +4 -0
  62. package/dist/src/stores/recommendation.d.ts +5 -0
  63. package/dist/src/utils/dateUtil.d.ts +10 -0
  64. package/dist/src/utils/genericUtil.d.ts +3 -0
  65. package/dist/src/utils/stripoEditorApi.d.ts +4 -0
  66. package/dist/static/styles/components/recommendation-strategy.css.js +9 -0
  67. package/dist/static/styles/components/version-history.css.js +2 -6
  68. package/dist/stores/guido-email-editor.js +3 -1
  69. package/dist/stores/onboarding.js +4 -0
  70. package/dist/stores/unsubscribe.js +3 -3
  71. package/dist/utils/pairProductVariables.js +71 -71
  72. package/dist/utils/stripoEditorApi.js +11 -0
  73. package/package.json +3 -2
@@ -48,6 +48,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
48
48
  selectedUnsubscribePages: number[];
49
49
  forceRecreate: boolean;
50
50
  trackIdCounter: number;
51
+ recommendationCampaignUrls?: Record<string, unknown> | undefined;
51
52
  migration: {
52
53
  recommendationConfigs: {
53
54
  [x: string]: {
@@ -191,6 +192,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
191
192
  selectedUnsubscribePages: number[];
192
193
  forceRecreate: boolean;
193
194
  trackIdCounter: number;
195
+ recommendationCampaignUrls?: Record<string, unknown> | undefined;
194
196
  migration: {
195
197
  recommendationConfigs: {
196
198
  [x: string]: {
@@ -334,6 +336,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
334
336
  selectedUnsubscribePages: number[];
335
337
  forceRecreate: boolean;
336
338
  trackIdCounter: number;
339
+ recommendationCampaignUrls?: Record<string, unknown> | undefined;
337
340
  migration: {
338
341
  recommendationConfigs: {
339
342
  [x: string]: {
@@ -477,6 +480,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
477
480
  selectedUnsubscribePages: number[];
478
481
  forceRecreate: boolean;
479
482
  trackIdCounter: number;
483
+ recommendationCampaignUrls?: Record<string, unknown> | undefined;
480
484
  migration: {
481
485
  recommendationConfigs: {
482
486
  [x: string]: {
@@ -620,6 +624,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
620
624
  selectedUnsubscribePages: number[];
621
625
  forceRecreate: boolean;
622
626
  trackIdCounter: number;
627
+ recommendationCampaignUrls?: Record<string, unknown> | undefined;
623
628
  migration: {
624
629
  recommendationConfigs: {
625
630
  [x: string]: {
@@ -763,6 +768,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
763
768
  selectedUnsubscribePages: number[];
764
769
  forceRecreate: boolean;
765
770
  trackIdCounter: number;
771
+ recommendationCampaignUrls?: Record<string, unknown> | undefined;
766
772
  migration: {
767
773
  recommendationConfigs: {
768
774
  [x: string]: {
@@ -906,6 +912,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
906
912
  selectedUnsubscribePages: number[];
907
913
  forceRecreate: boolean;
908
914
  trackIdCounter: number;
915
+ recommendationCampaignUrls?: Record<string, unknown> | undefined;
909
916
  migration: {
910
917
  recommendationConfigs: {
911
918
  [x: string]: {
@@ -1049,6 +1056,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1049
1056
  selectedUnsubscribePages: number[];
1050
1057
  forceRecreate: boolean;
1051
1058
  trackIdCounter: number;
1059
+ recommendationCampaignUrls?: Record<string, unknown> | undefined;
1052
1060
  migration: {
1053
1061
  recommendationConfigs: {
1054
1062
  [x: string]: {
@@ -1192,6 +1200,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1192
1200
  selectedUnsubscribePages: number[];
1193
1201
  forceRecreate: boolean;
1194
1202
  trackIdCounter: number;
1203
+ recommendationCampaignUrls?: Record<string, unknown> | undefined;
1195
1204
  migration: {
1196
1205
  recommendationConfigs: {
1197
1206
  [x: string]: {
@@ -1335,6 +1344,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1335
1344
  selectedUnsubscribePages: number[];
1336
1345
  forceRecreate: boolean;
1337
1346
  trackIdCounter: number;
1347
+ recommendationCampaignUrls?: Record<string, unknown> | undefined;
1338
1348
  migration: {
1339
1349
  recommendationConfigs: {
1340
1350
  [x: string]: {
@@ -1478,6 +1488,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1478
1488
  selectedUnsubscribePages: number[];
1479
1489
  forceRecreate: boolean;
1480
1490
  trackIdCounter: number;
1491
+ recommendationCampaignUrls?: Record<string, unknown> | undefined;
1481
1492
  migration: {
1482
1493
  recommendationConfigs: {
1483
1494
  [x: string]: {
@@ -1621,6 +1632,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1621
1632
  selectedUnsubscribePages: number[];
1622
1633
  forceRecreate: boolean;
1623
1634
  trackIdCounter: number;
1635
+ recommendationCampaignUrls?: Record<string, unknown> | undefined;
1624
1636
  migration: {
1625
1637
  recommendationConfigs: {
1626
1638
  [x: string]: {
@@ -1764,6 +1776,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1764
1776
  selectedUnsubscribePages: number[];
1765
1777
  forceRecreate: boolean;
1766
1778
  trackIdCounter: number;
1779
+ recommendationCampaignUrls?: Record<string, unknown> | undefined;
1767
1780
  migration: {
1768
1781
  recommendationConfigs: {
1769
1782
  [x: string]: {
@@ -1907,6 +1920,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1907
1920
  selectedUnsubscribePages: number[];
1908
1921
  forceRecreate: boolean;
1909
1922
  trackIdCounter: number;
1923
+ recommendationCampaignUrls?: Record<string, unknown> | undefined;
1910
1924
  migration: {
1911
1925
  recommendationConfigs: {
1912
1926
  [x: string]: {
@@ -2050,6 +2064,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2050
2064
  selectedUnsubscribePages: number[];
2051
2065
  forceRecreate: boolean;
2052
2066
  trackIdCounter: number;
2067
+ recommendationCampaignUrls?: Record<string, unknown> | undefined;
2053
2068
  migration: {
2054
2069
  recommendationConfigs: {
2055
2070
  [x: string]: {
@@ -2193,6 +2208,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2193
2208
  selectedUnsubscribePages: number[];
2194
2209
  forceRecreate: boolean;
2195
2210
  trackIdCounter: number;
2211
+ recommendationCampaignUrls?: Record<string, unknown> | undefined;
2196
2212
  migration: {
2197
2213
  recommendationConfigs: {
2198
2214
  [x: string]: {
@@ -2336,6 +2352,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2336
2352
  selectedUnsubscribePages: number[];
2337
2353
  forceRecreate: boolean;
2338
2354
  trackIdCounter: number;
2355
+ recommendationCampaignUrls?: Record<string, unknown> | undefined;
2339
2356
  migration: {
2340
2357
  recommendationConfigs: {
2341
2358
  [x: string]: {
@@ -2479,6 +2496,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2479
2496
  selectedUnsubscribePages: number[];
2480
2497
  forceRecreate: boolean;
2481
2498
  trackIdCounter: number;
2499
+ recommendationCampaignUrls?: Record<string, unknown> | undefined;
2482
2500
  migration: {
2483
2501
  recommendationConfigs: {
2484
2502
  [x: string]: {
@@ -2622,6 +2640,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2622
2640
  selectedUnsubscribePages: number[];
2623
2641
  forceRecreate: boolean;
2624
2642
  trackIdCounter: number;
2643
+ recommendationCampaignUrls?: Record<string, unknown> | undefined;
2625
2644
  migration: {
2626
2645
  recommendationConfigs: {
2627
2646
  [x: string]: {
@@ -2767,6 +2786,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2767
2786
  selectedUnsubscribePages: number[];
2768
2787
  forceRecreate: boolean;
2769
2788
  trackIdCounter: number;
2789
+ recommendationCampaignUrls?: Record<string, unknown> | undefined;
2770
2790
  migration: {
2771
2791
  recommendationConfigs: {
2772
2792
  [x: string]: {
@@ -1,3 +1,13 @@
1
+ /** Terminal outcome of an editor write, keyed by `${blueprintId}:${version}`. */
2
+ export interface ApplyAck {
3
+ status: 'applied' | 'failed';
4
+ /** The `applyRequestedAt` of the click this ack answers — lets cortex drop stale acks. */
5
+ requestedAt: number;
6
+ /** Strictly increasing per key, so two acks in the same millisecond still order. */
7
+ ackAt: number;
8
+ /** Stringified — cortex JSON-clones store-derived payloads, an Error would not survive. */
9
+ error?: string;
10
+ }
1
11
  /** The published editor snapshot — the shape a consumer reads off the shared store. */
2
12
  export interface GuidoEmailEditorState {
3
13
  /** Current Stripo HTML — stripe tables only, no DOCTYPE/wrapper. */
@@ -8,6 +18,10 @@ export interface GuidoEmailEditorState {
8
18
  lastUpdatedAt: number;
9
19
  /** Template id from the editor config, so a consumer can scope per-template. */
10
20
  templateId: string;
21
+ /** True while a mounted Guido bridge is consuming the chat store. Gates cortex's Apply button. */
22
+ bridgeActive: boolean;
23
+ /** `${blueprintId}:${version}` → terminal outcome of the editor write, written only after it settles. */
24
+ applyAcks: Record<string, ApplyAck>;
11
25
  }
12
26
  /**
13
27
  * Outbound contract Guido publishes to the host's shared Pinia singleton so a
@@ -18,17 +32,11 @@ export interface GuidoEmailEditorState {
18
32
  * Published as `@useinsider/guido/editor-state` and from the root barrel, so a
19
33
  * consumer imports this store instead of re-declaring one under the same id.
20
34
  *
21
- * State + getters only, no actions. `useGuidoStateBridge` is the only intended
22
- * writer, but that is Guido's own convention rather than something the store
23
- * enforces: publishing the definition hands a consumer `$patch` as well, exactly
24
- * as the runtime `pinia._s` probe always did.
35
+ * State-only by contract: cortex-fe reads `pinia.state.value['guidoEmailEditor']`, which misses
36
+ * actions and getters. Intended writers: `useGuidoStateBridge` and `useCortexBlueprintBridge`.
25
37
  *
26
- * Store id `guidoEmailEditor` is cross-MFE: cortex-fe reads it via
27
- * `pinia._s.get('guidoEmailEditor')` at runtime rather than importing it, so the
28
- * id stays part of the contract. The internal Guido editor store keeps id
29
- * `guidoEditor` — these are intentionally separate. The internal store carries
30
- * UI state a consumer should not see; this public store carries the contract
31
- * Guido is willing to share.
38
+ * The id `guidoEmailEditor` is part of the cross-MFE contract; the internal
39
+ * store `guidoEditor` is intentionally separate.
32
40
  */
33
41
  export declare const useGuidoEmailEditorStore: import("pinia").StoreDefinition<"guidoEmailEditor", GuidoEmailEditorState, {
34
42
  /** True once the bridge has published at least one snapshot. */
@@ -37,5 +45,7 @@ export declare const useGuidoEmailEditorStore: import("pinia").StoreDefinition<"
37
45
  css: string;
38
46
  lastUpdatedAt: number;
39
47
  templateId: string;
48
+ bridgeActive: boolean;
49
+ applyAcks: Record<string, ApplyAck>;
40
50
  } & import("pinia").PiniaCustomStateProperties<GuidoEmailEditorState>) => boolean;
41
51
  }, {}>;
@@ -1,5 +1,6 @@
1
1
  import type { OnboardingCardConfig, OnboardingType, OnboardingStoreState } from '@@/Types/onboarding';
2
2
  export declare const useOnboardingStore: import("pinia").StoreDefinition<"guidoOnboarding", OnboardingStoreState, {
3
+ /** @deprecated Components use the type-specific getters. Slated for deletion, see the SD-667788 dead-code ledger. */
3
4
  getOnboarding: (state: {
4
5
  onboardings: {
5
6
  newVersionPopup: {
@@ -390,6 +391,7 @@ export declare const useOnboardingStore: import("pinia").StoreDefinition<"guidoO
390
391
  };
391
392
  isFetched: boolean;
392
393
  } & import("pinia").PiniaCustomStateProperties<OnboardingStoreState>) => (type: OnboardingType) => boolean;
394
+ /** @deprecated Components use getGenericCurrentCard / getTextBlockCurrentCard. Slated for deletion, see the SD-667788 dead-code ledger. */
393
395
  getCurrentCard: (state: {
394
396
  onboardings: {
395
397
  newVersionPopup: {
@@ -2190,6 +2192,7 @@ export declare const useOnboardingStore: import("pinia").StoreDefinition<"guidoO
2190
2192
  close(type: OnboardingType): Promise<void>;
2191
2193
  next(type: OnboardingType): void;
2192
2194
  previous(type: OnboardingType): void;
2195
+ /** @deprecated No caller in src/. Slated for deletion, see the SD-667788 dead-code ledger. */
2193
2196
  updateCardPosition(type: OnboardingType, cardIndex: number, position: {
2194
2197
  top: string;
2195
2198
  position: string;
@@ -2198,6 +2201,7 @@ export declare const useOnboardingStore: import("pinia").StoreDefinition<"guidoO
2198
2201
  onDiscoverNowClicked(): Promise<void>;
2199
2202
  onRemindMeLater(): void;
2200
2203
  onNewVersionPopupClose(): Promise<void>;
2204
+ /** @deprecated No caller in src/. Slated for deletion, see the SD-667788 dead-code ledger. */
2201
2205
  isOnboardingActive(): boolean;
2202
2206
  fetchUserModalState(): Promise<void>;
2203
2207
  setUserModalState(modal: string, state: string, page: string): Promise<void>;
@@ -6,5 +6,10 @@ type RecommendationConfig = {
6
6
  interface StoreState {
7
7
  recommendationConfigs: RecommendationConfig[];
8
8
  }
9
+ /**
10
+ * @deprecated recommendationConfigs has no writer in src/, so the store is
11
+ * permanently empty and its only readers (useHtmlValidator.ts:496-497) are a
12
+ * no-op. Slated for deletion, see the SD-667788 dead-code ledger.
13
+ */
9
14
  export declare const useRecommendationStore: import("pinia").StoreDefinition<"guidoRecommendation", StoreState, {}, {}>;
10
15
  export {};
@@ -3,12 +3,22 @@
3
3
  * en-US -> MM/DD/YYYY
4
4
  * en-GB -> DD/MM/YYYY
5
5
  * tr-TR -> DD.MM.YYYY
6
+ *
7
+ * The non-string branches below are unreachable: the only caller chain is
8
+ * formatShortDate -> AssignStrategyDrawer.vue:74, which passes a non-empty string.
9
+ * The function itself is live — do not delete it with them.
6
10
  */
7
11
  export declare const convertToDateObject: (date: string | number | Date | null | undefined) => Date;
8
12
  export declare const locale: () => string;
9
13
  export declare const localTz: string;
10
14
  export declare const timezone: () => string;
15
+ /**
16
+ * @deprecated No caller in src/ and not exported from library.ts. Slated for deletion, see the SD-667788 dead-code ledger.
17
+ */
11
18
  export declare const hour12: () => boolean;
19
+ /**
20
+ * @deprecated No caller in src/ and not exported from library.ts. Slated for deletion, see the SD-667788 dead-code ledger.
21
+ */
12
22
  export declare const dateFormat: () => string;
13
23
  /**
14
24
  * @example 04/22/2024
@@ -24,6 +24,9 @@ export declare const getCsrfToken: () => string;
24
24
  */
25
25
  export declare const getUrlParams: () => URLSearchParams;
26
26
  export declare const getUrlParam: (paramName: string, defaultValue?: string) => string;
27
+ /**
28
+ * @deprecated No caller in src/. Slated for deletion, see the SD-667788 dead-code ledger.
29
+ */
27
30
  export declare const replaceString: (string?: string, values?: Record<string, string | number>, isRemoveEmptyValues?: boolean) => string;
28
31
  /**
29
32
  * Narrows an unknown API value to a printable string; anything that is neither
@@ -0,0 +1,4 @@
1
+ import type { StripoEditorApi } from '@@/Types/stripo';
2
+ export declare const EDITOR_NOT_READY_MESSAGE = "The editor is not ready yet. Please wait for it to load and try again.";
3
+ export declare const findEditorApi: () => StripoEditorApi | undefined;
4
+ export declare const getEditorApi: () => StripoEditorApi;
@@ -52,6 +52,15 @@ const n = `.strategy-control-header {
52
52
  mask-size: 24px 24px;
53
53
  }
54
54
 
55
+ .strategy-control-notice--error {
56
+ border-color: var(--guido-color-border-onpage-message-error);
57
+ background-color: var(--guido-color-background-onpage-message-error);
58
+ }
59
+
60
+ .strategy-control-notice--error::before {
61
+ background-color: var(--guido-color-border-onpage-message-error);
62
+ }
63
+
55
64
  .strategy-control-notice-text {
56
65
  margin: 0;
57
66
  padding: 4px 0;
@@ -1,4 +1,4 @@
1
- const n = `.patch-session-container {
1
+ const r = `.patch-session-container {
2
2
  row-gap: 16px;
3
3
  }
4
4
 
@@ -28,11 +28,7 @@ ue-vh-patch.selected .patch-wrapper {
28
28
  .change-history-panel-wrapper .control-panel-header {
29
29
  padding: 16px 0 16px 16px;
30
30
  }
31
-
32
- .change-history-panel-wrapper .header-control-panel-label {
33
- grid-area: 1 / 1 / 2 / 12;
34
- }
35
31
  `;
36
32
  export {
37
- n as default
33
+ r as default
38
34
  };
@@ -4,7 +4,9 @@ const d = e("guidoEmailEditor", {
4
4
  html: "",
5
5
  css: "",
6
6
  lastUpdatedAt: 0,
7
- templateId: ""
7
+ templateId: "",
8
+ bridgeActive: !1,
9
+ applyAcks: {}
8
10
  }),
9
11
  getters: {
10
12
  /** True once the bridge has published at least one snapshot. */
@@ -20,8 +20,10 @@ const t = () => ({
20
20
  }), c = s("guidoOnboarding", {
21
21
  state: () => a(),
22
22
  getters: {
23
+ /** @deprecated Components use the type-specific getters. Slated for deletion, see the SD-667788 dead-code ledger. */
23
24
  getOnboarding: (n) => (o) => n.onboardings[o],
24
25
  isActive: (n) => (o) => n.onboardings[o].isActive,
26
+ /** @deprecated Components use getGenericCurrentCard / getTextBlockCurrentCard. Slated for deletion, see the SD-667788 dead-code ledger. */
25
27
  getCurrentCard: (n) => (o) => {
26
28
  const i = n.onboardings[o];
27
29
  return i.config[i.cardIndex];
@@ -81,6 +83,7 @@ const t = () => ({
81
83
  previous(n) {
82
84
  this.onboardings[n].cardIndex > 0 && this.onboardings[n].cardIndex--;
83
85
  },
86
+ /** @deprecated No caller in src/. Slated for deletion, see the SD-667788 dead-code ledger. */
84
87
  updateCardPosition(n, o, i) {
85
88
  const r = this.onboardings[n].config[o];
86
89
  r && (r.top = i.top, r.position = i.position);
@@ -97,6 +100,7 @@ const t = () => ({
97
100
  async onNewVersionPopupClose() {
98
101
  await this.setUserModalState("newVersionPopup", "true", "Guido");
99
102
  },
103
+ /** @deprecated No caller in src/. Slated for deletion, see the SD-667788 dead-code ledger. */
100
104
  isOnboardingActive() {
101
105
  return Object.values(this.onboardings).some((n) => n.isActive);
102
106
  },
@@ -39,16 +39,16 @@ const r = () => ({
39
39
  });
40
40
  },
41
41
  isActiveTypeFirstInCollection: (e) => {
42
- const t = i[e.selectedCollectionType];
42
+ const t = i[e.selectedCollectionType] ?? [];
43
43
  return e.activeType === t[0];
44
44
  },
45
45
  isActiveTypeLastInCollection: (e) => {
46
- const t = i[e.selectedCollectionType];
46
+ const t = i[e.selectedCollectionType] ?? [];
47
47
  return e.activeType === t[t.length - 1];
48
48
  },
49
49
  hasTemplatesByCollectionType: (e) => {
50
50
  const t = {};
51
- return i[e.selectedCollectionType].forEach((s) => {
51
+ return (i[e.selectedCollectionType] ?? []).forEach((s) => {
52
52
  t[s] = e.templates.some((c) => c.type === s);
53
53
  }), t;
54
54
  },
@@ -1,100 +1,100 @@
1
- import { ITEMS_CURRENCY_ATTR as D, isCustomCurrencySymbol as G } from "../extensions/Blocks/Items/constants/currency.js";
2
- import { productPairs as L } from "../extensions/Blocks/Items/enums/productEnums.js";
1
+ import { ITEMS_CURRENCY_ATTR as x, isCustomCurrencySymbol as Y } from "../extensions/Blocks/Items/constants/currency.js";
2
+ import { productPairs as w } from "../extensions/Blocks/Items/enums/productEnums.js";
3
3
  import { escapeReplacement as X } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
4
- import { preserveTextStyles as F } from "./preserveTextStyles.js";
5
- import { unwrapProductNameLinks as Y } from "./unwrapProductNameLink.js";
6
- const x = {
4
+ import { preserveTextStyles as P } from "./preserveTextStyles.js";
5
+ import { unwrapProductNameLinks as v } from "./unwrapProductNameLink.js";
6
+ const O = {
7
7
  CART_ITEMS: "ins_apr",
8
8
  BROWSED_ITEMS: "browsed_item",
9
9
  PURCHASED_ITEMS: "purchased_item"
10
- }, O = (S) => S.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
11
- function v(S, y, b) {
10
+ }, q = (S) => S.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
11
+ function B(S, y, b) {
12
12
  let h = y;
13
13
  for (; h > 0 && /\s/.test(S[h - 1]); )
14
14
  h -= 1;
15
15
  return b.some((I) => S.endsWith(I, h));
16
16
  }
17
- function K(S) {
18
- const y = O(S), b = new DOMParser().parseFromString(y, "text/html");
19
- Y(b);
20
- const h = L.PAIRS_FOR_EXTENSION;
17
+ function Z(S) {
18
+ const y = q(S), b = new DOMParser().parseFromString(y, "text/html");
19
+ v(b);
20
+ const h = w.PAIRS_FOR_EXTENSION;
21
21
  Object.entries(h).forEach(([n, d]) => {
22
22
  b.querySelectorAll(".ins-product-td").forEach((r) => {
23
23
  const E = r.getAttribute("data-number") || "1", m = r.getAttribute("data-type") || "CART_ITEMS";
24
24
  r.querySelectorAll(`[product-attr="${n}"]`).forEach((t) => {
25
- var $, H, N;
26
- const g = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E, u = d[g];
27
- if (u)
25
+ var $, F, D, N;
26
+ const g = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E, f = d[g];
27
+ if (f)
28
28
  switch (n) {
29
29
  case "imageSrc": {
30
- let e = null, s = null;
31
- if (t.tagName === "IMG" ? (e = t, s = e.closest("a")) : (e = t.querySelector("img"), s = t.querySelector("a") || t.closest("a")), !e)
30
+ let e = null, a = null;
31
+ if (t.tagName === "IMG" ? (e = t, a = e.closest("a")) : (e = t.querySelector("img"), a = t.querySelector("a") || t.closest("a")), !e)
32
32
  break;
33
- const a = u.DEFAULT, l = u.ATTR;
34
- if (a && e.src) {
35
- const i = e.src;
36
- a.some((_) => {
37
- const f = _.split("/").pop() || "", P = i.split("/").pop() || "";
38
- return i.includes(_) || i.includes(f) || P === f;
39
- }) && (e.src = `{{${l}_${o}}}`);
33
+ const l = f.DEFAULT, c = f.ATTR;
34
+ if (l && e.src) {
35
+ const s = e.src;
36
+ l.some((R) => {
37
+ const u = R.split("/").pop() || "", H = s.split("/").pop() || "";
38
+ return s.includes(R) || s.includes(u) || H === u;
39
+ }) && (e.src = `{{${c}_${o}}}`);
40
40
  }
41
- const c = (H = ($ = h.name) == null ? void 0 : $[g]) == null ? void 0 : H.ATTR;
42
- if (c && e.setAttribute("alt", `{{${c}_${o}}}`), s) {
43
- const i = (N = h.itemLink) == null ? void 0 : N[g];
44
- if (i) {
45
- const R = i.HREF, _ = i.DEFAULT_HREF || "#!", f = s.href;
46
- (f === "#" || f === "" || f.endsWith("#!") || f.endsWith(_) || f === `${window.location.href}${_}` || !f || f === window.location.href) && (s.href = `{{${R}_${o}}}`);
41
+ const i = (F = ($ = h.name) == null ? void 0 : $[g]) == null ? void 0 : F.ATTR;
42
+ if (i && e.setAttribute("alt", `{{${i}_${o}}}`), a) {
43
+ const s = (D = h.itemLink) == null ? void 0 : D[g];
44
+ if (s) {
45
+ const _ = s.HREF, R = s.DEFAULT_HREF || "#!", u = a.href;
46
+ (u === "#" || u === "" || u.endsWith("#!") || u.endsWith(R) || u === `${window.location.href}${R}` || !u || u === window.location.href) && (a.href = `{{${_}_${o}}}`);
47
47
  }
48
48
  }
49
49
  break;
50
50
  }
51
51
  case "name": {
52
- const e = u, s = e.ATTR, a = e.DEFAULT_HREF || "#!", l = e.HREF;
53
- t.textContent && (t.innerHTML = F(t, `{{${s}_${o}}}`));
54
- const c = t.closest("a") || (t.tagName === "A" ? t : null);
55
- if (c && l) {
56
- const i = c.href, R = `${window.location.href}${a}`;
57
- (i === R || i.endsWith(a)) && (c.href = `{{${l}_${o}}}`);
52
+ const e = f, a = e.ATTR, l = e.DEFAULT_HREF || "#!", c = e.HREF;
53
+ t.textContent && (t.innerHTML = P(t, `{{${a}_${o}}}`));
54
+ const i = t.closest("a") || (t.tagName === "A" ? t : null);
55
+ if (i && c) {
56
+ const s = i.href, _ = `${window.location.href}${l}`;
57
+ (s === _ || s.endsWith(l)) && (i.href = `{{${c}_${o}}}`);
58
58
  }
59
59
  break;
60
60
  }
61
61
  case "price":
62
62
  case "originalPrice": {
63
- const e = u, s = t.getAttribute("data-formated"), a = t.getAttribute("data-single_price"), l = s === "true", c = a === "true", i = t.getAttribute(D.POSITION) || "before";
64
- let R;
65
- c ? R = l ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : R = l ? e.PRICE_FORMATTED : e.PRICE;
66
- const _ = e.CURRENCY;
67
- let f = `{{${R}_${o}}}`;
68
- const P = (t.getAttribute(D.SYMBOL) || "").trim(), V = G(P);
63
+ const e = f, a = t.getAttribute("data-formated"), l = t.getAttribute("data-single_price"), c = a === "true", i = l === "true", s = t.getAttribute(x.POSITION) || "before";
64
+ let _;
65
+ i ? _ = c ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : _ = c ? e.PRICE_FORMATTED : e.PRICE;
66
+ const R = e.CURRENCY;
67
+ let u = `{{${_}_${o}}}`;
68
+ const H = (t.getAttribute(x.SYMBOL) || "").trim(), G = Y(H);
69
69
  let C = "";
70
- V ? C = P : _ && (C = `{{${_}_${o}}}`), C && (f = i === "after" ? `${f} ${C}` : `${C} ${f}`), t.innerHTML = F(t, f);
70
+ G ? C = H : R && (C = `{{${R}_${o}}}`), C && (u = s === "after" ? `${u} ${C}` : `${C} ${u}`), t.innerHTML = P(t, u);
71
71
  break;
72
72
  }
73
73
  case "quantity": {
74
- const e = u, s = e.ATTR, a = e.DEFAULT;
75
- t.textContent && t.textContent.trim() === a && (t.innerHTML = F(t, `{{${s}_${o}}}`));
74
+ const e = f, a = e.ATTR, l = [e.DEFAULT, ...e.LEGACY_DEFAULTS], c = (N = t.textContent) == null ? void 0 : N.trim();
75
+ c && l.includes(c) && (t.innerHTML = P(t, `{{${a}_${o}}}`));
76
76
  break;
77
77
  }
78
78
  case "button": {
79
- const e = u, s = e.HREF, a = e.DEFAULT_HREF || "#!", l = t.tagName === "A" ? t : t.querySelector("a");
80
- if (l) {
81
- const c = l.href || "", i = `${window.location.href}${a}`;
82
- (c === "" || c === "#" || c === i || c.endsWith(a) || c.endsWith("#!") || c === window.location.href) && (l.href = `{{${s}_${o}}}`);
79
+ const e = f, a = e.HREF, l = e.DEFAULT_HREF || "#!", c = t.tagName === "A" ? t : t.querySelector("a");
80
+ if (c) {
81
+ const i = c.href || "", s = `${window.location.href}${l}`;
82
+ (i === "" || i === "#" || i === s || i.endsWith(l) || i.endsWith("#!") || i === window.location.href) && (c.href = `{{${a}_${o}}}`);
83
83
  }
84
84
  break;
85
85
  }
86
86
  case "itemLink": {
87
- const e = u, s = e.HREF, a = e.DEFAULT_HREF || "#!", l = t;
88
- if (l.href) {
89
- const c = l.href, i = `${window.location.href}${a}`;
90
- (c === i || c.endsWith(a)) && (l.href = `{{${s}_${o}}}`);
87
+ const e = f, a = e.HREF, l = e.DEFAULT_HREF || "#!", c = t;
88
+ if (c.href) {
89
+ const i = c.href, s = `${window.location.href}${l}`;
90
+ (i === s || i.endsWith(l)) && (c.href = `{{${a}_${o}}}`);
91
91
  }
92
92
  break;
93
93
  }
94
94
  default: {
95
- if ("ATTR" in u) {
96
- const e = u.ATTR;
97
- t.textContent && (t.innerHTML = F(t, `{{${e}_${o}}}`));
95
+ if ("ATTR" in f) {
96
+ const e = f.ATTR;
97
+ t.textContent && (t.innerHTML = P(t, `{{${e}_${o}}}`));
98
98
  }
99
99
  break;
100
100
  }
@@ -102,9 +102,9 @@ function K(S) {
102
102
  });
103
103
  });
104
104
  });
105
- const I = y.match(/<!DOCTYPE[^>]*>/i), q = I ? `${I[0]}
106
- ` : "", U = b.querySelectorAll(".ins-product-td"), M = [];
107
- U.forEach((n) => {
105
+ const I = y.match(/<!DOCTYPE[^>]*>/i), U = I ? `${I[0]}
106
+ ` : "", W = b.querySelectorAll(".ins-product-td"), M = [];
107
+ W.forEach((n) => {
108
108
  const d = n.getAttribute("data-type") || "CART_ITEMS", p = n.getAttribute("data-number") || "1", r = n.outerHTML;
109
109
  M.push({
110
110
  element: n,
@@ -113,38 +113,38 @@ function K(S) {
113
113
  number: p
114
114
  });
115
115
  });
116
- let A = q + b.documentElement.outerHTML;
116
+ let A = U + b.documentElement.outerHTML;
117
117
  M.reverse().forEach(({ outerHtml: n, type: d, number: p }) => {
118
- const r = x[d], E = r ? `${r}_total_product_kind` : "";
118
+ const r = O[d], E = r ? `${r}_total_product_kind` : "";
119
119
  if (E) {
120
120
  const T = parseInt(p) - 1, o = `${`{% if ${E} > ${T} %}`}${n}{% endif %}`;
121
121
  A = A.replace(n, X(o));
122
122
  }
123
123
  });
124
- const W = b.querySelectorAll('[product-attr="originalPrice"][data-type]'), w = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Set();
125
- return W.forEach((n) => {
124
+ const V = b.querySelectorAll('[product-attr="originalPrice"][data-type]'), L = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Set();
125
+ return V.forEach((n) => {
126
126
  var t;
127
127
  const d = n.getAttribute("data-number"), p = n.getAttribute("data-type");
128
- if (!d || !x[p])
128
+ if (!d || !O[p])
129
129
  return;
130
130
  const r = n.closest(".product-original-price-class");
131
131
  if (!r || k.has(r))
132
132
  return;
133
133
  k.add(r);
134
- const E = r.outerHTML, m = (t = n.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), T = w.get(E) ?? { number: d, type: p, wrap: [] };
135
- T.wrap.push(m !== "false"), w.set(E, T);
136
- }), w.forEach(({ number: n, type: d, wrap: p }, r) => {
134
+ const E = r.outerHTML, m = (t = n.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), T = L.get(E) ?? { number: d, type: p, wrap: [] };
135
+ T.wrap.push(m !== "false"), L.set(E, T);
136
+ }), L.forEach(({ number: n, type: d, wrap: p }, r) => {
137
137
  if (r.includes("{% if") || !p.some(Boolean))
138
138
  return;
139
- const E = L.PAIRS_FOR_EXTENSION.price[d].PRICE, m = L.PAIRS_FOR_EXTENSION.originalPrice[d].PRICE, T = `{% if ${E}_${n} != ${m}_${n} %}`, t = [T, O(T)];
140
- let g = "", o = 0, u = 0, $ = A.indexOf(r);
139
+ const E = w.PAIRS_FOR_EXTENSION.price[d].PRICE, m = w.PAIRS_FOR_EXTENSION.originalPrice[d].PRICE, T = `{% if ${E}_${n} != ${m}_${n} %}`, t = [T, q(T)];
140
+ let g = "", o = 0, f = 0, $ = A.indexOf(r);
141
141
  for (; $ !== -1; ) {
142
- const H = p[u] === !0 && !v(A, $, t);
143
- g += A.slice(o, $) + (H ? `${T}${r}{% endif %}` : r), o = $ + r.length, u += 1, $ = A.indexOf(r, o);
142
+ const F = p[f] === !0 && !B(A, $, t);
143
+ g += A.slice(o, $) + (F ? `${T}${r}{% endif %}` : r), o = $ + r.length, f += 1, $ = A.indexOf(r, o);
144
144
  }
145
145
  A = g + A.slice(o);
146
146
  }), A.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("&lt;!--{%", "{%").replaceAll("%}--&gt;", "%}");
147
147
  }
148
148
  export {
149
- K as pairProductVariables
149
+ Z as pairProductVariables
150
150
  };
@@ -0,0 +1,11 @@
1
+ const o = "The editor is not ready yet. Please wait for it to load and try again.", i = () => window.StripoEditorApi, r = () => {
2
+ const t = i();
3
+ if (!t)
4
+ throw new Error(o);
5
+ return t;
6
+ };
7
+ export {
8
+ o as EDITOR_NOT_READY_MESSAGE,
9
+ i as findEditorApi,
10
+ r as getEditorApi
11
+ };