@useinsider/guido 3.2.0-beta.543661c → 3.2.0-beta.64b2dc3

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.
@@ -89,11 +89,11 @@ const v = () => {
89
89
  updateHtmlAndCss: (t, e) => {
90
90
  window.StripoEditorApi.actionsApi.updateHtmlAndCss(t, e);
91
91
  },
92
- editorSave: () => {
93
- window.StripoEditorApi.actionsApi.save((t) => {
94
- t && n(t, "Failed to save template");
92
+ editorSave: () => new Promise((t) => {
93
+ window.StripoEditorApi.actionsApi.save((e) => {
94
+ e && n(e, "Failed to save template"), t();
95
95
  });
96
- }
96
+ })
97
97
  };
98
98
  };
99
99
  export {
@@ -1,4 +1,4 @@
1
- import { RecommendationFeedSourceMaps as g, URLS as p } from "../enums/extensions/recommendationBlock.js";
1
+ import { getRecommendationFeedSourceMaps as g, URLS as p } from "../enums/extensions/recommendationBlock.js";
2
2
  import { MinDeviceViewport as R, DefaultPadding as b } from "../enums/recommendation.js";
3
3
  import { useRecommendationExtensionStore as u } from "../extensions/Blocks/Recommendation/store/recommendation.js";
4
4
  import { generateCompleteFilterQuery as x } from "../extensions/Blocks/Recommendation/utils/filterUtil.js";
@@ -47,7 +47,7 @@ const N = () => ({
47
47
  const n = u(), o = I(), a = Number(i), r = n.blockStates[a];
48
48
  if (!r)
49
49
  return "";
50
- const { recommendationConfigs: e } = r, l = ((m = g.find((s) => s.key === e.strategy)) == null ? void 0 : m.path) || "", t = new URLSearchParams();
50
+ const { recommendationConfigs: e } = r, l = ((m = g().find((s) => s.key === e.strategy)) == null ? void 0 : m.path) || "", t = new URLSearchParams();
51
51
  t.set("locale", e.language), t.set("currency", e.currencySettings.value), t.set("partnerName", o.partnerName), t.set("size", e.size), t.set("details", "true"), t.set("campaignId", o.variationId), e.strategy === "manualMerchandising" ? t.set("productId", e.productIds.join(",")) : e.strategy === "similarViewed" && t.set("productId", "{itemId}"), e.strategy === "userBased" && t.set("userId", "{user_id}");
52
52
  const f = e.filters.filter((s) => s.isValid), c = x(f);
53
53
  c && t.set("filter", c), e.shuffleProducts && t.set("shuffle", "true");
@@ -19,7 +19,7 @@ const F = () => {
19
19
  return;
20
20
  if ((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(t))
21
21
  return;
22
- c();
22
+ await c();
23
23
  const { unsubscribePayload: f, stripoModules: v } = d(t.rawHtml);
24
24
  return await u(f), t.modules = v, m || s(t), t;
25
25
  } };
@@ -1,4 +1,4 @@
1
- import { useActionsApi as D } from "./useActionsApi.js";
1
+ import { useActionsApi as A } from "./useActionsApi.js";
2
2
  import { useBlocksConfig as I } from "./useBlocksConfig.js";
3
3
  import { useConfig as P } from "./useConfig.js";
4
4
  import { useCustomInterfaceAppearance as U } from "./useCustomInterfaceAppearance.js";
@@ -6,7 +6,7 @@ import { useFullStoryBridge as R } from "./useFullStoryBridge.js";
6
6
  import { useStripoEventHandler as q } from "./useStripoEventHandler.js";
7
7
  import { useToaster as x } from "./useToaster.js";
8
8
  import { localePatch as H } from "../config/i18n/index.js";
9
- import { displayConditions as O } from "../enums/displayConditions.js";
9
+ import { getDisplayConditions as O } from "../enums/displayConditions.js";
10
10
  import { useStripoApi as j } from "../services/stripoApi.js";
11
11
  import L from "../static/styles/customEditorStyle.css.js";
12
12
  import { useEditorStore as C } from "../stores/editor.js";
@@ -35,7 +35,7 @@ const ae = (E, l) => {
35
35
  customViewStyles: L,
36
36
  conditionsEnabled: f,
37
37
  customConditionsEnabled: f,
38
- conditionCategories: O,
38
+ conditionCategories: O(),
39
39
  enableXSSSecurity: !0,
40
40
  modulesDisabled: F,
41
41
  syncModulesEnabled: s,
@@ -70,8 +70,8 @@ const ae = (E, l) => {
70
70
  },
71
71
  onTemplateLoaded() {
72
72
  try {
73
- const { importCss: t } = U(), { activateCustomViewStyles: n, updateTimerInClonedTemplate: M } = D(), { injectFullStory: A } = R();
74
- t(), n(), A(), M(), l.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
73
+ const { importCss: t } = U(), { activateCustomViewStyles: n, updateTimerInClonedTemplate: D } = A(), { injectFullStory: M } = R();
74
+ t(), n(), M(), D(), l.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
75
75
  e.hasChanges = !1;
76
76
  }, 1e3);
77
77
  } catch (t) {
@@ -1,16 +1,16 @@
1
- import { useRecommendation as N } from "../../composables/useRecommendation.js";
2
- import { DUMMY_IMAGE_MAPPINGS as C, REGEX as T, VerticalOrientation as M, CSS as E, ATTRIBUTES as R, CONDITIONS as $, HTML as h } from "../../enums/recommendation.js";
1
+ import { useRecommendation as C } from "../../composables/useRecommendation.js";
2
+ import { DUMMY_IMAGE_MAPPINGS as h, REGEX as T, VerticalOrientation as M, CSS as E, ATTRIBUTES as A, CONDITIONS as g, HTML as N } from "../../enums/recommendation.js";
3
3
  import { prepareRecommendationBlocks as x } from "./utils/recommendationCompilerUtils.js";
4
4
  const w = [
5
5
  {
6
6
  id: "replace-images-with-variable-names",
7
7
  description: "Replacing dummy images with variable names in recommendation module",
8
8
  type: "custom",
9
- processor: (i) => {
10
- let e = i;
11
- return Object.entries(C).forEach(([, p]) => {
12
- Object.entries(p).forEach(([c, n]) => {
13
- e = e.replaceAll(n, `{{${c}}}`);
9
+ processor: (c) => {
10
+ let e = c;
11
+ return Object.entries(h).forEach(([, l]) => {
12
+ Object.entries(l).forEach(([n, s]) => {
13
+ e = e.replaceAll(s, `{{${n}}}`);
14
14
  });
15
15
  }), e;
16
16
  },
@@ -29,21 +29,21 @@ const w = [
29
29
  id: "add-recommendation-unresponsive-css",
30
30
  description: "Adding recommendation unresponsive css",
31
31
  type: "custom",
32
- processor: (i) => {
33
- const { calculateCardWidth: e, getRecommendationCampaignData: p } = N();
34
- let c = i;
35
- const n = c.match(T.ID);
36
- if (n) {
32
+ processor: (c) => {
33
+ const { calculateCardWidth: e, getRecommendationCampaignData: l } = C();
34
+ let n = c;
35
+ const s = n.match(T.ID);
36
+ if (s) {
37
37
  const a = [];
38
- if (n.forEach((s) => {
39
- const d = /recommendation-id="(.*?)"/i.exec(s), _ = d ? d[1].trim() : "", A = p(_);
40
- A.textTrimming && A.orientation === M && a.push(e(A));
38
+ if (s.forEach((i) => {
39
+ const d = /recommendation-id="(.*?)"/i.exec(i), _ = d ? d[1].trim() : "", R = l(_);
40
+ R.textTrimming && R.orientation === M && a.push(e(R));
41
41
  }), a.length) {
42
- const s = `width:${Math.min(...a)}px!important;`;
43
- c = c.replace(E.REGULAR_NAME_HEIGHT, `${E.TRIMMED_NAME_HEIGHT} ${s} ${E.ELLIPSIS}`).replace(E.REGULAR_NAME_CONTAINER_HEIGHT, E.TRIMMED_NAME_CONTAINER_CSS).replace(E.RESPONSIVE_NAME_SIZE, `${E.RESPONSIVE_NAME_HEIGHT} ${s} ${E.ELLIPSIS}`).replace(E.RESPONSIVE_NAME_CONTAINER_HEIGHT, E.TRIMMED_RESPONSIVE_NAME_CONTAINER_CSS);
42
+ const i = `width:${Math.min(...a)}px!important;`;
43
+ n = n.replace(E.REGULAR_NAME_HEIGHT, `${E.TRIMMED_NAME_HEIGHT} ${i} ${E.ELLIPSIS}`).replace(E.REGULAR_NAME_CONTAINER_HEIGHT, E.TRIMMED_NAME_CONTAINER_CSS).replace(E.RESPONSIVE_NAME_SIZE, `${E.RESPONSIVE_NAME_HEIGHT} ${i} ${E.ELLIPSIS}`).replace(E.RESPONSIVE_NAME_CONTAINER_HEIGHT, E.TRIMMED_RESPONSIVE_NAME_CONTAINER_CSS);
44
44
  }
45
45
  }
46
- return c;
46
+ return n;
47
47
  },
48
48
  priority: 52
49
49
  },
@@ -51,34 +51,34 @@ const w = [
51
51
  id: "prepare-recommendations",
52
52
  description: "Replacing product data with template variables in recommendation blocks",
53
53
  type: "custom",
54
- processor: (i) => x(i),
54
+ processor: (c) => x(c),
55
55
  priority: 48
56
56
  },
57
57
  {
58
58
  id: "add-discount-conditions",
59
59
  description: "Adding discount conditions to the recommendation block",
60
60
  type: "custom",
61
- processor: (i) => {
62
- let e = i;
63
- const p = e.match(T.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData: c } = N();
64
- return p !== null && p.forEach((n) => {
65
- const a = n.match(T.CUSTOM_FIELD);
61
+ processor: (c) => {
62
+ let e = c;
63
+ const l = e.match(T.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData: n } = C();
64
+ return l !== null && l.forEach((s) => {
65
+ const a = s.match(T.CUSTOM_FIELD);
66
66
  if (!a)
67
67
  return;
68
- const [s] = a, d = s.match(T.CUSTOM_FIELD_INDEXES_PART), _ = s.match(T.CUSTOM_FIELD_NAME_PART), A = n.match(T.ATTRIBUTE_PARAGRAPH_START_TAG);
69
- if (!d || !_ || !A)
68
+ const [i] = a, d = i.match(T.CUSTOM_FIELD_INDEXES_PART), _ = i.match(T.CUSTOM_FIELD_NAME_PART), R = s.match(T.ATTRIBUTE_PARAGRAPH_START_TAG);
69
+ if (!d || !_ || !R)
70
70
  return;
71
- const [I] = d, [S] = _, [m] = A, o = S.substring(1, S.length - 2), r = m.match(T.COMPOSITION) !== null;
72
- let t = s;
71
+ const [S] = d, [b] = _, [m] = R, o = b.substring(1, b.length - 2), r = m.match(T.COMPOSITION) !== null;
72
+ let t = i;
73
73
  if (r) {
74
- const b = I.substring(2, I.length - 3), l = c(b);
75
- o === R.OMNIBUS_PRICE && (l.priceBeforeTextValue && (t = `${l.priceBeforeTextValue}${t}`), l.priceAfterTextValue && (t = `${t}${l.priceAfterTextValue}`)), o === R.OMNIBUS_DISCOUNT && (l.discountBeforeTextValue && (t = `${l.discountBeforeTextValue}${t}`), l.discountAfterTextValue && (t = `${t}${l.discountAfterTextValue}`));
74
+ const I = S.substring(2, S.length - 3), p = n(I);
75
+ o === A.OMNIBUS_PRICE && (p.priceBeforeTextValue && (t = `${p.priceBeforeTextValue}${t}`), p.priceAfterTextValue && (t = `${t}${p.priceAfterTextValue}`)), o === A.OMNIBUS_DISCOUNT && (p.discountBeforeTextValue && (t = `${p.discountBeforeTextValue}${t}`), p.discountAfterTextValue && (t = `${t}${p.discountAfterTextValue}`));
76
76
  }
77
- const u = I.substring(2);
77
+ const u = S.substring(2);
78
78
  let f = "";
79
- o in $.IF && (f = $.IF[o].replaceAll(`{${R.DISCOUNT}}`, `${u}${R.DISCOUNT}`).replaceAll(`{${R.OMNIBUS_DISCOUNT}}`, `${u}${R.OMNIBUS_DISCOUNT}`).replaceAll(`{${R.OMNIBUS_PRICE}}`, `${u}${R.OMNIBUS_PRICE}`));
80
- const g = `${m}${t}${h.PARAGRAPH_END_TAG}`, y = `${f}${r ? g : n}${$.ELSE}${m}${h.PARAGRAPH_END_TAG}${$.END_IF}`;
81
- e = e.replace(n, y);
79
+ o in g.IF && (f = g.IF[o].replaceAll(`{${A.DISCOUNT}}`, `${u}${A.DISCOUNT}`).replaceAll(`{${A.OMNIBUS_DISCOUNT}}`, `${u}${A.OMNIBUS_DISCOUNT}`).replaceAll(`{${A.OMNIBUS_PRICE}}`, `${u}${A.OMNIBUS_PRICE}`));
80
+ const $ = `${m}${t}${N.PARAGRAPH_END_TAG}`, y = `${f}${r ? $ : s}${g.ELSE}${m}${N.PARAGRAPH_END_TAG}${g.END_IF}`;
81
+ e = e.replace(s, y);
82
82
  }), e;
83
83
  },
84
84
  priority: 53
@@ -95,19 +95,24 @@ const w = [
95
95
  {
96
96
  id: "strip-recommendation-editor-attributes",
97
97
  description: "Strip editor-only attributes from compiled recommendation output",
98
- type: "regex",
99
- // eslint-disable-next-line @stylistic/max-len
100
- pattern: '\\s+(?:esd-extension-block-id|data-attribute-type|data-visibility|data-text-before|data-text-after|product-attr|composition)="[^"]*"',
101
- replacement: "",
102
- flags: "g",
98
+ type: "custom",
99
+ // Scoped to REC_START/REC_END markers so it cannot strip `product-attr`
100
+ // from Items block elements, which the items compiler rule depends on.
101
+ processor: (c) => {
102
+ const e = /\s+(?:esd-extension-block-id|data-attribute-type|data-visibility|data-text-before|data-text-after|product-attr|composition)="[^"]*"/g;
103
+ return c.replace(
104
+ /<!--REC_START-->([\s\S]*?)<!--REC_END-->/g,
105
+ (l, n) => `<!--REC_START-->${n.replace(e, "")}<!--REC_END-->`
106
+ );
107
+ },
103
108
  priority: 55
104
109
  },
105
110
  {
106
111
  id: "strip-unused-recommendation-classes",
107
112
  description: "Remove CSS classes not referenced by any style rule from recommendation elements",
108
113
  type: "custom",
109
- processor: (i) => {
110
- let e = i.replace(
114
+ processor: (c) => {
115
+ let e = c.replace(
111
116
  / class="(?:product-card-segment|attribute-cell|recommendation-attribute-row|product-image|product-name|product-price|product-old-price|product-omnibus-price|product-omnibus-discount|product-button|recommendation-product-row|product-card-wrapper)"/g,
112
117
  ""
113
118
  );
@@ -119,8 +124,8 @@ const w = [
119
124
  id: "remove-empty-mobile-layout-artifacts",
120
125
  description: "Remove empty mobile container rows and unused mobile layout CSS",
121
126
  type: "custom",
122
- processor: (i) => {
123
- let e = i;
127
+ processor: (c) => {
128
+ let e = c;
124
129
  return e = e.replace(
125
130
  /<tr[^>]*class="ins-recommendation-mobile-row"[^>]*><\/tr>/g,
126
131
  ""
@@ -129,9 +134,9 @@ const w = [
129
134
  ""
130
135
  ), e = e.replace(
131
136
  /@media[^{]*max-width\s*:\s*480px[^{]*\{((?:[^{}]*\{[^{}]*\})*[^{}]*)\}/g,
132
- (p, c) => {
133
- const n = c.match(/[^{}]+\{[^{}]*\}/g) || [], a = /ins-recommendation|product-image-cell|button-cell|product-info-cell/;
134
- return n.every((d) => a.test(d)) ? "" : p;
137
+ (l, n) => {
138
+ const s = n.match(/[^{}]+\{[^{}]*\}/g) || [], a = /ins-recommendation|product-image-cell|button-cell|product-info-cell/;
139
+ return s.every((d) => a.test(d)) ? "" : l;
135
140
  }
136
141
  )), e;
137
142
  },
@@ -141,38 +146,38 @@ const w = [
141
146
  id: "deduplicate-inline-styles",
142
147
  description: "Replace repeated inline styles with CSS class references within recommendation blocks",
143
148
  type: "custom",
144
- processor: (i) => {
145
- const e = i.replace(
149
+ processor: (c) => {
150
+ const e = c.replace(
146
151
  /<a\b[^>]*\bes-button\b[^>]*>/g,
147
152
  (o) => o.replace(
148
153
  /([;"]color:)([^;"]+)/g,
149
154
  (r, t, u) => u.includes("!important") ? r : `${t}${u} !important`
150
155
  )
151
- ), p = /<!--REC_START-->([\s\S]*?)<!--REC_END-->/g, c = / style="([^"]*)"/g, n = /* @__PURE__ */ new Map();
152
- let a = p.exec(e);
156
+ ), l = /<!--REC_START-->([\s\S]*?)<!--REC_END-->/g, n = / style="([^"]*)"/g, s = /* @__PURE__ */ new Map();
157
+ let a = l.exec(e);
153
158
  for (; a !== null; ) {
154
- let o = c.exec(a[1]);
159
+ let o = n.exec(a[1]);
155
160
  for (; o !== null; ) {
156
161
  const [, r] = o;
157
- n.set(r, (n.get(r) || 0) + 1), o = c.exec(a[1]);
162
+ s.set(r, (s.get(r) || 0) + 1), o = n.exec(a[1]);
158
163
  }
159
- c.lastIndex = 0, a = p.exec(e);
164
+ n.lastIndex = 0, a = l.exec(e);
160
165
  }
161
- const s = /* @__PURE__ */ new Map(), d = [];
166
+ const i = /* @__PURE__ */ new Map(), d = [];
162
167
  let _ = 0;
163
- if (n.forEach((o, r) => {
168
+ if (s.forEach((o, r) => {
164
169
  if (o >= 6) {
165
170
  const t = `rc${_++}`;
166
- s.set(r, t), d.push(`.${t}{${r}}`);
171
+ i.set(r, t), d.push(`.${t}{${r}}`);
167
172
  }
168
- }), s.size === 0) {
173
+ }), i.size === 0) {
169
174
  let o = e;
170
175
  return o = o.replaceAll("<!--REC_START-->", ""), o = o.replaceAll("<!--REC_END-->", ""), o;
171
176
  }
172
- const A = (o) => o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), I = (o, r) => `${o.slice(0, -1)} ${r}"`, S = /* @__PURE__ */ new Map();
173
- s.forEach((o, r) => {
174
- const t = A(r);
175
- S.set(r, {
177
+ const R = (o) => o.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), S = (o, r) => `${o.slice(0, -1)} ${r}"`, b = /* @__PURE__ */ new Map();
178
+ i.forEach((o, r) => {
179
+ const t = R(r);
180
+ b.set(r, {
176
181
  caseA: new RegExp(`(class="[^"]*")((?:[^>]*?)) style="${t}"`, "g"),
177
182
  caseB: new RegExp(` style="${t}"((?:[^>]*?))(class="[^"]*")`, "g")
178
183
  });
@@ -182,14 +187,14 @@ const w = [
182
187
  /<!--REC_START-->([\s\S]*?)<!--REC_END-->/g,
183
188
  (o, r) => {
184
189
  let t = r;
185
- return s.forEach((u, f) => {
186
- const g = S.get(f);
190
+ return i.forEach((u, f) => {
191
+ const $ = b.get(f);
187
192
  t = t.replace(
188
- g.caseA,
189
- (y, b, l) => I(b, u) + l
193
+ $.caseA,
194
+ (y, I, p) => S(I, u) + p
190
195
  ), t = t.replace(
191
- g.caseB,
192
- (y, b, l) => b + I(l, u)
196
+ $.caseB,
197
+ (y, I, p) => I + S(p, u)
193
198
  ), t = t.replaceAll(` style="${f}"`, ` class="${u}"`);
194
199
  }), t;
195
200
  }
@@ -1,80 +1,84 @@
1
- const e = [
2
- {
3
- category: "Demographics",
4
- conditions: [
5
- {
6
- id: 1,
7
- name: "Language",
8
- description: "Users who are in the English will see the banner",
9
- beforeScript: '{% if language == "en_US" %}',
10
- afterScript: "{% endif %}"
11
- },
12
- {
13
- id: 2,
14
- name: "Country",
15
- description: "Only people who live in Australia will see the banner",
16
- beforeScript: '{% if country == "Australia" %}',
17
- afterScript: "{% endif %}"
18
- },
19
- {
20
- id: 3,
21
- name: "Country & City",
22
- description: "Only people who are located in that country and city",
23
- beforeScript: '{% if country == "United Kingdom" and city == "London" %}',
24
- afterScript: "{% endif %}"
25
- },
26
- {
27
- id: 4,
28
- name: "Age (Less than operator)",
29
- description: "Users whose age is less than 18",
30
- beforeScript: "{% if age < 18 %}",
31
- afterScript: "{% endif %}"
32
- },
33
- {
34
- id: 5,
35
- name: "Age (Equal and greater than operator)",
36
- description: "Users whose age is equal or greater than 25",
37
- beforeScript: "{% if age >= 25 %}",
38
- afterScript: "{% endif %}"
39
- },
40
- {
41
- id: 6,
42
- name: "Age (Greater than & less than operators)",
43
- description: "Users whose age is between 18 and 25",
44
- beforeScript: "{% if age > 18 and age < 25 %}",
45
- afterScript: "{% endif %}"
46
- },
47
- {
48
- id: 7,
49
- name: "Gender",
50
- description: "Users whose gender is Female",
51
- beforeScript: '{% if gender == "Female" %}',
52
- afterScript: "{% endif %}"
53
- },
54
- {
55
- id: 8,
56
- name: "State",
57
- description: "Users whose state is one of the followings. c_state is a custom attribute. Use this condition if you have the attribute with the same naming. ",
58
- beforeScript: '{% if c_state == "VIC" or c_state == "NSW" or c_state == "QLD" %}',
59
- afterScript: "{% endif %}"
60
- },
61
- {
62
- id: 9,
63
- name: "VIP User",
64
- description: "Users who are VIP users for that brand. c_is_vip_user = true. c_is_vip_user is a custom attribute. Use this condition if you have the attribute with the same naming.",
65
- beforeScript: "{% if c_is_vip_user %}",
66
- afterScript: "{% endif %}"
67
- },
68
- {
69
- id: 10,
70
- name: "Membership Type",
71
- description: "Users who belong to gold or silver membership type. c_is_gold_member = true, c_is_silver_member = true. These are custom attributes. Use this condition if you have the attribute with the same naming.",
72
- beforeScript: "{% if c_is_gold_member or c_is_silver_member %}",
73
- afterScript: "{% endif %}"
74
- }
75
- ]
76
- }
77
- ];
1
+ import { useTranslations as i } from "../composables/useTranslations.js";
2
+ const t = () => {
3
+ const e = i();
4
+ return [
5
+ {
6
+ category: e("journey-builder.demographics"),
7
+ conditions: [
8
+ {
9
+ id: 1,
10
+ name: e("condition.language"),
11
+ description: e("journey-builder.display-condition-language-description"),
12
+ beforeScript: '{% if language == "en_US" %}',
13
+ afterScript: "{% endif %}"
14
+ },
15
+ {
16
+ id: 2,
17
+ name: e("condition.country"),
18
+ description: e("journey-builder.display-condition-country-description"),
19
+ beforeScript: '{% if country == "Australia" %}',
20
+ afterScript: "{% endif %}"
21
+ },
22
+ {
23
+ id: 3,
24
+ name: e("stripo-editor.country-and-city"),
25
+ description: e("journey-builder.display-condition-country-city-description"),
26
+ beforeScript: '{% if country == "United Kingdom" and city == "London" %}',
27
+ afterScript: "{% endif %}"
28
+ },
29
+ {
30
+ id: 4,
31
+ name: e("stripo-editor.age-less-than-operator"),
32
+ description: e("journey-builder.display-condition-age-less-than"),
33
+ beforeScript: "{% if age < 18 %}",
34
+ afterScript: "{% endif %}"
35
+ },
36
+ {
37
+ id: 5,
38
+ name: e("stripo-editor.age-equal-greater-operator"),
39
+ description: e("journey-builder.display-condition-age-equal-greater"),
40
+ beforeScript: "{% if age >= 25 %}",
41
+ afterScript: "{% endif %}"
42
+ },
43
+ {
44
+ id: 6,
45
+ name: e("stripo-editor.age-greater-less-operators"),
46
+ description: e("journey-builder.display-condition-age-between"),
47
+ beforeScript: "{% if age > 18 and age < 25 %}",
48
+ afterScript: "{% endif %}"
49
+ },
50
+ {
51
+ id: 7,
52
+ name: e("condition.gender"),
53
+ description: e("journey-builder.display-condition-gender-female"),
54
+ beforeScript: '{% if gender == "Female" %}',
55
+ afterScript: "{% endif %}"
56
+ },
57
+ {
58
+ id: 8,
59
+ name: e("journey-builder.state"),
60
+ description: e("stripo-editor.state-description"),
61
+ beforeScript: '{% if c_state == "VIC" or c_state == "NSW" or c_state == "QLD" %}',
62
+ afterScript: "{% endif %}"
63
+ },
64
+ {
65
+ id: 9,
66
+ name: e("journey-builder.vip-user"),
67
+ description: e("stripo-editor.vip-user-description"),
68
+ beforeScript: "{% if c_is_vip_user %}",
69
+ afterScript: "{% endif %}"
70
+ },
71
+ {
72
+ id: 10,
73
+ name: e("journey-builder.membership-type"),
74
+ description: e("stripo-editor.membership-type-description"),
75
+ beforeScript: "{% if c_is_gold_member or c_is_silver_member %}",
76
+ afterScript: "{% endif %}"
77
+ }
78
+ ]
79
+ }
80
+ ];
81
+ };
78
82
  export {
79
- e as displayConditions
83
+ t as getDisplayConditions
80
84
  };
@@ -1,43 +1,97 @@
1
- const s = {
1
+ import { useTranslations as a } from "../../composables/useTranslations.js";
2
+ const u = {
2
3
  RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com"
3
- }, i = {
4
+ }, l = {
4
5
  CLIENT_ID: "clientId"
5
- }, u = [
6
- { id: 11, key: "similarViewed", name: "Viewed Together", path: "viewed-together" },
7
- { id: 12, key: "similarBought", name: "Purchased Together", path: "purchased-together" },
8
- { id: 13, key: "userBased", name: "User Based", path: "user-based" },
9
- { id: 36, key: "highestDiscounted", name: "Highest Discounted Items", path: "highest-discounted" },
10
- { id: 38, key: "manualMerchandising", name: "Manual Merchandising", path: "manual-merchandising" },
11
- { id: 39, key: "newArrivals", name: "New Arrivals", path: "new-arrivals" },
12
- { id: 40, key: "trendingProducts", name: "Trending Products", path: "trending" },
13
- { id: 46, key: "mostValuableOfPartner", name: "Most Valuable Products", path: "most-valuable" },
14
- { id: 61, key: "mostPopular", name: "Most Popular Items", path: "most-popular" },
15
- { id: 62, key: "mostPurchased", name: "Top Sellers", path: "top-sellers" }
16
- ], l = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], c = [
6
+ }, c = () => {
7
+ const e = a();
8
+ return [
9
+ {
10
+ id: 11,
11
+ key: "similarViewed",
12
+ name: e("action-builder.similar-viewed"),
13
+ path: "viewed-together"
14
+ },
15
+ {
16
+ id: 12,
17
+ key: "similarBought",
18
+ name: e("action-builder.similar-bought"),
19
+ path: "purchased-together"
20
+ },
21
+ {
22
+ id: 13,
23
+ key: "userBased",
24
+ name: e("action-builder.user-based"),
25
+ path: "user-based"
26
+ },
27
+ {
28
+ id: 36,
29
+ key: "highestDiscounted",
30
+ name: e("journey-builder.highest-discounted-items"),
31
+ path: "highest-discounted"
32
+ },
33
+ {
34
+ id: 38,
35
+ key: "manualMerchandising",
36
+ name: e("action-builder.manual-merchandising"),
37
+ path: "manual-merchandising"
38
+ },
39
+ {
40
+ id: 39,
41
+ key: "newArrivals",
42
+ name: e("action-builder.new-arrivals"),
43
+ path: "new-arrivals"
44
+ },
45
+ {
46
+ id: 40,
47
+ key: "trendingProducts",
48
+ name: e("journey-builder.trending-products"),
49
+ path: "trending"
50
+ },
51
+ {
52
+ id: 46,
53
+ key: "mostValuableOfPartner",
54
+ name: e("journey-builder.most-valuable-products"),
55
+ path: "most-valuable"
56
+ },
57
+ {
58
+ id: 61,
59
+ key: "mostPopular",
60
+ name: e("journey-builder.most-popular-items"),
61
+ path: "most-popular"
62
+ },
63
+ {
64
+ id: 62,
65
+ key: "mostPurchased",
66
+ name: e("action-builder.most-purchased"),
67
+ path: "top-sellers"
68
+ }
69
+ ];
70
+ }, d = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], m = [
17
71
  { text: "before the amount", value: "0" },
18
72
  { text: "after the amount", value: "1" }
19
- ], d = [
73
+ ], p = [
20
74
  { text: "dot(.)", value: "." },
21
75
  { text: "comma(,)", value: "," }
22
- ], p = [
76
+ ], v = [
23
77
  { text: "0", value: "0" },
24
78
  { text: "1", value: "1" },
25
79
  { text: "2", value: "2" },
26
80
  { text: "3", value: "3" },
27
81
  { text: "4", value: "4" },
28
82
  { text: "5", value: "5" }
29
- ], e = [
83
+ ], t = [
30
84
  { text: "is exactly", value: "=" },
31
85
  { text: "contains", value: "~" },
32
86
  { text: "does not contain", value: "!~" },
33
87
  { text: "any of", value: "||" }
34
- ], a = [
88
+ ], r = [
35
89
  { text: "is exactly", value: "=" },
36
90
  { text: "is not exactly", value: "!==" },
37
91
  { text: "contains", value: "~" },
38
92
  { text: "does not contain", value: "!~" },
39
93
  { text: "any of", value: "||" }
40
- ], r = [
94
+ ], n = [
41
95
  { text: "is equal to", value: "=" },
42
96
  { text: "is greater than", value: ">" },
43
97
  { text: "is less than", value: "<" }
@@ -45,39 +99,39 @@ const s = {
45
99
  { text: "is equal to", value: "=" },
46
100
  { text: "after", value: ">" },
47
101
  { text: "before", value: "<" }
48
- ], n = [
102
+ ], s = [
49
103
  { text: "true", value: "==" },
50
104
  { text: "false", value: "!=" }
51
- ], m = (t) => {
52
- if (!t)
53
- return e;
54
- switch (t) {
105
+ ], h = (e) => {
106
+ if (!e)
107
+ return t;
108
+ switch (e) {
55
109
  case "Boolean":
56
- return n;
110
+ return s;
57
111
  case "Date":
58
112
  return o;
59
113
  case "Number":
60
- return r;
114
+ return n;
61
115
  case "String":
62
- return e;
116
+ return t;
63
117
  case "Strings":
64
- return a;
118
+ return r;
65
119
  default:
66
- return e;
120
+ return t;
67
121
  }
68
122
  };
69
123
  export {
70
- l as PriceAttributes,
71
- i as QUERY_PARAMS,
72
- u as RecommendationFeedSourceMaps,
73
- s as URLS,
74
- p as currencyDecimalCounts,
75
- c as currencyLocationMaps,
76
- d as currencyOperators,
77
- m as getOperatorOptions,
78
- a as operatorOptionsForArrayOfStrings,
79
- n as operatorOptionsForBooleans,
124
+ d as PriceAttributes,
125
+ l as QUERY_PARAMS,
126
+ u as URLS,
127
+ v as currencyDecimalCounts,
128
+ m as currencyLocationMaps,
129
+ p as currencyOperators,
130
+ h as getOperatorOptions,
131
+ c as getRecommendationFeedSourceMaps,
132
+ r as operatorOptionsForArrayOfStrings,
133
+ s as operatorOptionsForBooleans,
80
134
  o as operatorOptionsForDates,
81
- r as operatorOptionsForNumbers,
82
- e as operatorOptionsForStrings
135
+ n as operatorOptionsForNumbers,
136
+ t as operatorOptionsForStrings
83
137
  };
@@ -8,22 +8,22 @@ const _ = {
8
8
  DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
9
9
  GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
10
10
  PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
11
- }, n = R(), r = {
11
+ }, n = R(), t = {
12
12
  UNSUBSCRIBE_URL: `https://mail.${n}.com/user/v1/unsub`,
13
13
  PREFERENCES_URL: `https://mail.${n}.com/user/v1/prefs`
14
- }, B = "iid", i = {
15
- name: "Global Unsubscribe",
16
- sendGridId: "G"
17
- }, C = "/email/unsubscribe-pages", E = {
14
+ }, i = "iid", S = "G", B = () => ({
15
+ name: e()("onboarding-center.email-subscribers-global-unsub-card-title"),
16
+ sendGridId: S
17
+ }), C = "/email/unsubscribe-pages", E = {
18
18
  GLOBAL_UNSUBSCRIBE: 1,
19
19
  GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE: 2,
20
20
  SUBSCRIPTION_PREFERENCE_CENTER: 3,
21
21
  SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
22
22
  RESUBSCRIBE: 5
23
- }, U = {
23
+ }, c = {
24
24
  [E.GLOBAL_UNSUBSCRIBE]: "custom-unsubscribe",
25
25
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: "custom-preferences"
26
- }, t = {
26
+ }, U = {
27
27
  [E.GLOBAL_UNSUBSCRIBE]: [
28
28
  E.GLOBAL_UNSUBSCRIBE,
29
29
  E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE,
@@ -33,7 +33,7 @@ const _ = {
33
33
  E.SUBSCRIPTION_PREFERENCE_CENTER,
34
34
  E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
35
35
  ]
36
- }, c = () => {
36
+ }, o = () => {
37
37
  const s = e();
38
38
  return {
39
39
  [E.GLOBAL_UNSUBSCRIBE]: s("unsubscription-preference.type-global-unsubscribe"),
@@ -42,21 +42,22 @@ const _ = {
42
42
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: s("unsubscription-preference.type-subscription-preferences-center"),
43
43
  [E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: s("unsubscription-preference.type-subscription-preferences-confirmation")
44
44
  };
45
- }, o = {
45
+ }, u = {
46
46
  default: "{{ins-unsubscribe-link}}",
47
47
  [E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
48
48
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
49
49
  };
50
50
  export {
51
- i as DEFAULT_UNSUBSCRIBE_GROUP,
52
- B as INSIDER_ID,
51
+ S as DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID,
52
+ i as INSIDER_ID,
53
53
  I as LINK_REGEXES,
54
54
  _ as LINK_TYPES,
55
- o as MERGE_TAGS,
55
+ u as MERGE_TAGS,
56
56
  E as PAGE_TYPES,
57
- t as TYPE_COLLECTIONS,
57
+ U as TYPE_COLLECTIONS,
58
58
  C as UNSUBSCRIBE_PAGES_LINK,
59
- U as UNSUBSCRIBE_SYNC_MODULE_TYPES,
60
- r as URLS,
61
- c as getTypeTranslations
59
+ c as UNSUBSCRIBE_SYNC_MODULE_TYPES,
60
+ t as URLS,
61
+ B as getDefaultUnsubscribeGroup,
62
+ o as getTypeTranslations
62
63
  };
@@ -1,11 +1,11 @@
1
- var d = Object.defineProperty;
2
- var l = (r, n, e) => n in r ? d(r, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[n] = e;
3
- var o = (r, n, e) => l(r, typeof n != "symbol" ? n + "" : n, e);
4
- import { useHttp as L } from "../../../composables/useHttp.js";
5
- import { DEFAULT_UNSUBSCRIBE_GROUP as c } from "../../../enums/unsubscribe.js";
6
- import { Control as h, UIElementType as i, UEAttr as t, ModificationDescription as p } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
- const m = "ui-elements-checkbox", u = "select", { get: C } = L();
8
- class S extends h {
1
+ var E = Object.defineProperty;
2
+ var d = (i, n, e) => n in i ? E(i, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[n] = e;
3
+ var o = (i, n, e) => d(i, typeof n != "symbol" ? n + "" : n, e);
4
+ import { useHttp as l } from "../../../composables/useHttp.js";
5
+ import { getDefaultUnsubscribeGroup as L, DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID as h } from "../../../enums/unsubscribe.js";
6
+ import { Control as p, UIElementType as r, UEAttr as t, ModificationDescription as m } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
+ const b = "ui-elements-checkbox", u = "select", { get: C } = l();
8
+ class I extends p {
9
9
  constructor() {
10
10
  super(...arguments);
11
11
  o(this, "currentNode");
@@ -13,13 +13,13 @@ class S extends h {
13
13
  o(this, "unsubList", []);
14
14
  }
15
15
  getId() {
16
- return m;
16
+ return b;
17
17
  }
18
18
  _setFormValues() {
19
19
  if (this.selectedUnsubGroup = "", this.currentNode && "getAttribute" in this.currentNode) {
20
20
  const e = this.currentNode.getAttribute("id");
21
21
  if (e) {
22
- const s = e === c.sendGridId ? e : Number(e);
22
+ const s = e === h ? e : Number(e);
23
23
  s && (this.selectedUnsubGroup = s);
24
24
  }
25
25
  }
@@ -29,18 +29,18 @@ class S extends h {
29
29
  }
30
30
  _getLabel(e, s = `${Math.random()}`) {
31
31
  return `
32
- <${i.LABEL}
32
+ <${r.LABEL}
33
33
  ${t.LABEL.text}="${e}"
34
34
  ${t.LABEL.name}="${s}">
35
- </${i.LABEL}>
35
+ </${r.LABEL}>
36
36
  `;
37
37
  }
38
38
  _getSelectItem(e, s) {
39
39
  return `
40
- <${i.SELECT_ITEM}
40
+ <${r.SELECT_ITEM}
41
41
  ${t.SELECT_ITEM.text}="${e}"
42
42
  ${t.SELECT_ITEM.value}="${s}">
43
- </${i.SELECT_ITEM}>`;
43
+ </${r.SELECT_ITEM}>`;
44
44
  }
45
45
  _getSelect() {
46
46
  return this.unsubList.map((e) => this._getSelectItem(e.name, e.sendGridId)).join("");
@@ -49,22 +49,22 @@ class S extends h {
49
49
  return `
50
50
  <div class="checkbox-controls-container">
51
51
  <div class="checkbox-select-container container two-columns stretch">
52
- <${i.LABEL}
52
+ <${r.LABEL}
53
53
  ${t.LABEL.text}="${this.api.translate("Unsubscribe Group")}"
54
54
  ${t.LABEL.name}="${Math.random()}">
55
- </${i.LABEL}>
55
+ </${r.LABEL}>
56
56
 
57
- <${i.SELECTPICKER}
57
+ <${r.SELECTPICKER}
58
58
  ${t.SELECTPICKER.name}="${u}"
59
59
  ${t.SELECTPICKER.placeholder}="${this.api.translate("Select Unsubscribe Group")}">
60
60
  ${this._getSelect()}
61
- </${i.SELECTPICKER}>
61
+ </${r.SELECTPICKER}>
62
62
  </div>
63
63
  </div>
64
64
  `;
65
65
  }
66
66
  _onSelectChange(e) {
67
- this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new p(`Updated text to ${e}`));
67
+ this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", e.toString()).apply(new m(`Updated text to ${e}`));
68
68
  }
69
69
  _listenToFormUpdates() {
70
70
  this.api.onValueChanged(u, (e) => this._onSelectChange(e));
@@ -76,18 +76,18 @@ class S extends h {
76
76
  async onRender() {
77
77
  const e = await C(
78
78
  "/unsubscribe-groups/unsubscribe-list"
79
- ), s = [c, ...e.data], E = s.map((a) => ({
79
+ ), s = [L(), ...e.data], c = s.map((a) => ({
80
80
  [t.SELECT_ITEM.text]: a.name,
81
81
  [t.SELECT_ITEM.value]: a.sendGridId
82
82
  }));
83
83
  this.unsubList = s, this.api.setUIEAttribute(
84
84
  u,
85
85
  t.SELECTPICKER.items,
86
- E
86
+ c
87
87
  ), this._setFormValues(), this._listenToFormUpdates();
88
88
  }
89
89
  }
90
90
  export {
91
- m as CHECKBOX_CONTROL_BLOCK_ID,
92
- S as CheckboxControl
91
+ b as CHECKBOX_CONTROL_BLOCK_ID,
92
+ I as CheckboxControl
93
93
  };
@@ -1,75 +1,75 @@
1
- import { ModificationDescription as m, UIElementType as _, UEAttr as A } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
- import { CommonControl as h } from "../../../common-control.js";
3
- import { ItemsBlockControlId as L, ItemsBlockId as R } from "../../enums/controlEnums.js";
4
- import { productPairs as T } from "../../enums/productEnums.js";
5
- import { getItemsBlockConfig as I, setItemsBlockConfig as u, escapeReplacement as N } from "../../utils/nodeConfigUtils.js";
6
- const D = L.PRICE_SINGLE_PRICE, l = {
1
+ import { ModificationDescription as S, UIElementType as d, UEAttr as m } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
+ import { CommonControl as A } from "../../../common-control.js";
3
+ import { ItemsBlockControlId as T, ItemsBlockId as p } from "../../enums/controlEnums.js";
4
+ import { productPairs as R } from "../../enums/productEnums.js";
5
+ import { getItemsBlockConfig as I, setItemsBlockConfig as N, escapeReplacement as h } from "../../utils/nodeConfigUtils.js";
6
+ const u = T.PRICE_SINGLE_PRICE, l = {
7
7
  SINGLE_PRICE: "singlePrice"
8
8
  };
9
- class y extends h {
9
+ class k extends A {
10
10
  getId() {
11
- return D;
11
+ return u;
12
12
  }
13
13
  getTemplate() {
14
14
  return `
15
- <div class="container ${L.PRICE_SINGLE_PRICE}">
15
+ <div class="container ${T.PRICE_SINGLE_PRICE}">
16
16
  ${this._getSinglePrice()}
17
17
  </div>
18
18
  `;
19
19
  }
20
20
  onRender() {
21
21
  const e = I(this.currentNode);
22
- this.api.updateValues({ [l.SINGLE_PRICE]: (e == null ? void 0 : e.priceSinglePrice) ?? !1 }), this.api.onValueChanged(l.SINGLE_PRICE, (t) => {
23
- this._onSinglePriceChange(t);
22
+ this.api.updateValues({ [l.SINGLE_PRICE]: (e == null ? void 0 : e.priceSinglePrice) ?? !1 }), this.api.onValueChanged(l.SINGLE_PRICE, (i) => {
23
+ this._onSinglePriceChange(i);
24
24
  });
25
25
  }
26
26
  onTemplateNodeUpdated(e) {
27
27
  super.onTemplateNodeUpdated(e), this.handleBlockInstanceChange(() => {
28
- const t = I(this.currentNode);
29
- this.api.updateValues({ [l.SINGLE_PRICE]: (t == null ? void 0 : t.priceSinglePrice) ?? !1 });
28
+ const i = I(this.currentNode);
29
+ this.api.updateValues({ [l.SINGLE_PRICE]: (i == null ? void 0 : i.priceSinglePrice) ?? !1 });
30
30
  });
31
31
  }
32
32
  _onSinglePriceChange(e) {
33
- if (console.debug("Single price changed to: ", e), u(this.currentNode, this.api, { priceSinglePrice: e }), !this.currentNode)
33
+ if (console.debug("Single price changed to: ", e), !this.currentNode)
34
34
  return;
35
- const t = I(this.currentNode), o = (t == null ? void 0 : t.type) ?? "CART_ITEMS", r = (t == null ? void 0 : t.priceFormatted) ?? !1, i = T.PAIRS_FOR_EXTENSION.price[o], c = T.PAIRS_FOR_EXTENSION.originalPrice[o], [P, p] = e ? [
36
- r ? i.DEFAULT_PRICE_FORMATTED : i.DEFAULT_PRICE,
37
- r ? i.DEFAULT_SINGLE_PRICE_FORMATTED : i.DEFAULT_SINGLE_PRICE
35
+ const i = I(this.currentNode), c = (i == null ? void 0 : i.type) ?? "CART_ITEMS", r = (i == null ? void 0 : i.priceFormatted) ?? !1, t = R.PAIRS_FOR_EXTENSION.price[c], n = R.PAIRS_FOR_EXTENSION.originalPrice[c], [E, g] = e ? [
36
+ r ? t.DEFAULT_PRICE_FORMATTED : t.DEFAULT_PRICE,
37
+ r ? t.DEFAULT_SINGLE_PRICE_FORMATTED : t.DEFAULT_SINGLE_PRICE
38
38
  ] : [
39
- r ? i.DEFAULT_SINGLE_PRICE_FORMATTED : i.DEFAULT_SINGLE_PRICE,
40
- r ? i.DEFAULT_PRICE_FORMATTED : i.DEFAULT_PRICE
41
- ], s = r ? c.DEFAULT_PRICE_FORMATTED : c.DEFAULT_PRICE, d = r ? c.DEFAULT_SINGLE_PRICE_FORMATTED : c.DEFAULT_SINGLE_PRICE, [g, C] = e ? [s, d] : [d, s], n = this.currentNode.closest(".items-block"), S = (n == null ? void 0 : n.querySelectorAll(
42
- `[esd-extension-block-id="${R.PRICE}"]`
43
- )) || [], E = this.api.getDocumentModifier();
44
- S.forEach((a) => {
45
- this._updatePriceBlock(E, a, P, p, e);
46
- }), ((n == null ? void 0 : n.querySelectorAll(
47
- `[esd-extension-block-id="${R.ORIGINAL_PRICE}"]`
39
+ r ? t.DEFAULT_SINGLE_PRICE_FORMATTED : t.DEFAULT_SINGLE_PRICE,
40
+ r ? t.DEFAULT_PRICE_FORMATTED : t.DEFAULT_PRICE
41
+ ], P = r ? n.DEFAULT_PRICE_FORMATTED : n.DEFAULT_PRICE, _ = r ? n.DEFAULT_SINGLE_PRICE_FORMATTED : n.DEFAULT_SINGLE_PRICE, [L, C] = e ? [P, _] : [_, P], s = this.api.getDocumentModifier();
42
+ N(this.currentNode, this.api, { priceSinglePrice: e }, s);
43
+ const o = this.currentNode.closest(".items-block");
44
+ ((o == null ? void 0 : o.querySelectorAll(
45
+ `[esd-extension-block-id="${p.PRICE}"]`
48
46
  )) || []).forEach((a) => {
49
- this._updatePriceBlock(E, a, g, C, e);
50
- }), E.apply(new m(
47
+ this._updatePriceBlock(s, a, E, g, e);
48
+ }), ((o == null ? void 0 : o.querySelectorAll(
49
+ `[esd-extension-block-id="${p.ORIGINAL_PRICE}"]`
50
+ )) || []).forEach((a) => {
51
+ this._updatePriceBlock(s, a, L, C, e);
52
+ }), s.apply(new S(
51
53
  `Updated price to ${e ? "single" : "total"} price`
52
54
  ));
53
55
  }
54
- _updatePriceBlock(e, t, o, r, i) {
55
- const c = t.getInnerHTML().trim().replace(o, N(r));
56
- e.modifyHtml(t).setInnerHtml(c), t.querySelectorAll('[product-attr="price"], [product-attr="originalPrice"]').forEach((s) => {
57
- e.modifyHtml(s).setAttribute("data-single_price", i ? "true" : "false");
58
- });
56
+ _updatePriceBlock(e, i, c, r, t) {
57
+ const n = `data-single_price="${t ? "true" : "false"}"`, E = i.getInnerHTML().trim().replace(c, h(r)).replace(/data-single_price=(?:"[^"]*"|'[^']*')/g, n);
58
+ e.modifyHtml(i).setInnerHtml(E);
59
59
  }
60
60
  _getSinglePrice() {
61
61
  return `
62
62
  <div class="display-flex align-items-center justify-content-between">
63
- <${_.LABEL}
64
- ${A.LABEL.text}="${this.api.translate("Show Single Product Price")}"
63
+ <${d.LABEL}
64
+ ${m.LABEL.text}="${this.api.translate("Show Single Product Price")}"
65
65
  >
66
- </${_.LABEL}>
66
+ </${d.LABEL}>
67
67
  ${this._GuToggle(l.SINGLE_PRICE)}
68
68
  </div>
69
69
  `;
70
70
  }
71
71
  }
72
72
  export {
73
- D as CONTROL_BLOCK_ID,
74
- y as PriceSinglePriceControl
73
+ u as CONTROL_BLOCK_ID,
74
+ k as PriceSinglePriceControl
75
75
  };
@@ -1,6 +1,6 @@
1
1
  import _ from "../../../../node_modules/lodash-es/flatMap.js";
2
- import a from "../../../../node_modules/lodash-es/range.js";
3
- const T = '<td align="center" class="ins-product-td items-block items-block-v2">', E = { PAIRS_FOR_EXTENSION: {
2
+ import E from "../../../../node_modules/lodash-es/range.js";
3
+ const T = '<td align="center" class="ins-product-td items-block items-block-v2">', a = { PAIRS_FOR_EXTENSION: {
4
4
  imageSrc: {
5
5
  CART_ITEMS: {
6
6
  ATTR: "ins_apr_img",
@@ -212,10 +212,10 @@ const T = '<td align="center" class="ins-product-td items-block items-block-v2">
212
212
  }
213
213
  } };
214
214
  function m(e, s = 8) {
215
- return a(1, s + 1).map((i) => `${e}_${i}`);
215
+ return E(1, s + 1).map((i) => `${e}_${i}`);
216
216
  }
217
- function t() {
218
- const { PAIRS_FOR_EXTENSION: e } = E, s = [];
217
+ function r() {
218
+ const { PAIRS_FOR_EXTENSION: e } = a, s = [];
219
219
  return s.push(
220
220
  e.imageSrc.CART_ITEMS.ATTR,
221
221
  e.imageSrc.BROWSED_ITEMS.ATTR,
@@ -234,22 +234,34 @@ function t() {
234
234
  ), s.push(
235
235
  e.price.CART_ITEMS.PRICE,
236
236
  e.price.CART_ITEMS.PRICE_FORMATTED,
237
+ e.price.CART_ITEMS.SINGLE_PRICE,
238
+ e.price.CART_ITEMS.SINGLE_PRICE_FORMATTED,
237
239
  e.price.CART_ITEMS.CURRENCY,
238
240
  e.price.BROWSED_ITEMS.PRICE,
239
241
  e.price.BROWSED_ITEMS.PRICE_FORMATTED,
242
+ e.price.BROWSED_ITEMS.SINGLE_PRICE,
243
+ e.price.BROWSED_ITEMS.SINGLE_PRICE_FORMATTED,
240
244
  e.price.BROWSED_ITEMS.CURRENCY,
241
245
  e.price.PURCHASED_ITEMS.PRICE,
242
246
  e.price.PURCHASED_ITEMS.PRICE_FORMATTED,
247
+ e.price.PURCHASED_ITEMS.SINGLE_PRICE,
248
+ e.price.PURCHASED_ITEMS.SINGLE_PRICE_FORMATTED,
243
249
  e.price.PURCHASED_ITEMS.CURRENCY
244
250
  ), s.push(
245
251
  e.originalPrice.CART_ITEMS.PRICE,
246
252
  e.originalPrice.CART_ITEMS.PRICE_FORMATTED,
253
+ e.originalPrice.CART_ITEMS.SINGLE_PRICE,
254
+ e.originalPrice.CART_ITEMS.SINGLE_PRICE_FORMATTED,
247
255
  e.originalPrice.CART_ITEMS.CURRENCY,
248
256
  e.originalPrice.BROWSED_ITEMS.PRICE,
249
257
  e.originalPrice.BROWSED_ITEMS.PRICE_FORMATTED,
258
+ e.originalPrice.BROWSED_ITEMS.SINGLE_PRICE,
259
+ e.originalPrice.BROWSED_ITEMS.SINGLE_PRICE_FORMATTED,
250
260
  e.originalPrice.BROWSED_ITEMS.CURRENCY,
251
261
  e.originalPrice.PURCHASED_ITEMS.PRICE,
252
262
  e.originalPrice.PURCHASED_ITEMS.PRICE_FORMATTED,
263
+ e.originalPrice.PURCHASED_ITEMS.SINGLE_PRICE,
264
+ e.originalPrice.PURCHASED_ITEMS.SINGLE_PRICE_FORMATTED,
253
265
  e.originalPrice.PURCHASED_ITEMS.CURRENCY
254
266
  ), s.push(
255
267
  e.button.CART_ITEMS.HREF,
@@ -262,11 +274,11 @@ function t() {
262
274
  ), s;
263
275
  }
264
276
  const o = _(
265
- t(),
277
+ r(),
266
278
  (e) => m(e)
267
279
  );
268
280
  export {
269
281
  o as itemsBlockDynamicVariables,
270
- E as productPairs,
282
+ a as productPairs,
271
283
  T as templateFirstLine
272
284
  };
@@ -1,11 +1,11 @@
1
- var d = Object.defineProperty;
2
- var l = (r, n, t) => n in r ? d(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
3
- var o = (r, n, t) => l(r, typeof n != "symbol" ? n + "" : n, t);
4
- import { useHttp as L } from "../../../composables/useHttp.js";
5
- import { DEFAULT_UNSUBSCRIBE_GROUP as c } from "../../../enums/unsubscribe.js";
6
- import { Control as p, UIElementType as i, UEAttr as e, ModificationDescription as h } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
- const m = "ui-elements-radio-button", u = "select", { get: $ } = L();
8
- class S extends p {
1
+ var E = Object.defineProperty;
2
+ var d = (r, n, t) => n in r ? E(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
3
+ var o = (r, n, t) => d(r, typeof n != "symbol" ? n + "" : n, t);
4
+ import { useHttp as l } from "../../../composables/useHttp.js";
5
+ import { getDefaultUnsubscribeGroup as L, DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID as p } from "../../../enums/unsubscribe.js";
6
+ import { Control as h, UIElementType as i, UEAttr as e, ModificationDescription as m } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
+ const b = "ui-elements-radio-button", u = "select", { get: $ } = l();
8
+ class I extends h {
9
9
  constructor() {
10
10
  super(...arguments);
11
11
  o(this, "currentNode");
@@ -13,13 +13,13 @@ class S extends p {
13
13
  o(this, "unsubList", []);
14
14
  }
15
15
  getId() {
16
- return m;
16
+ return b;
17
17
  }
18
18
  _setFormValues() {
19
19
  if (this.selectedUnsubGroup = "", this.currentNode && "getAttribute" in this.currentNode) {
20
20
  const t = this.currentNode.getAttribute("id");
21
21
  if (t) {
22
- const s = t === c.sendGridId ? t : Number(t);
22
+ const s = t === p ? t : Number(t);
23
23
  s && (this.selectedUnsubGroup = s);
24
24
  }
25
25
  }
@@ -64,7 +64,7 @@ class S extends p {
64
64
  `;
65
65
  }
66
66
  _onSelectChange(t) {
67
- this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", t.toString()).apply(new h(`Updated text to ${t}`));
67
+ this.currentNode && this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute("id", t.toString()).apply(new m(`Updated text to ${t}`));
68
68
  }
69
69
  _listenToFormUpdates() {
70
70
  this.api.onValueChanged(u, (t) => this._onSelectChange(t));
@@ -76,18 +76,18 @@ class S extends p {
76
76
  async onRender() {
77
77
  const t = await $(
78
78
  "/unsubscribe-groups/unsubscribe-list"
79
- ), s = [c, ...t.data], E = s.map((a) => ({
79
+ ), s = [L(), ...t.data], c = s.map((a) => ({
80
80
  [e.SELECT_ITEM.text]: a.name,
81
81
  [e.SELECT_ITEM.value]: a.sendGridId
82
82
  }));
83
83
  this.unsubList = s, this.api.setUIEAttribute(
84
84
  u,
85
85
  e.SELECTPICKER.items,
86
- E
86
+ c
87
87
  ), this._setFormValues(), this._listenToFormUpdates();
88
88
  }
89
89
  }
90
90
  export {
91
- m as CONTROL_BLOCK_ID,
92
- S as RadioButtonControl
91
+ b as CONTROL_BLOCK_ID,
92
+ I as RadioButtonControl
93
93
  };
@@ -1,4 +1,4 @@
1
- import { RecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAttributes as k } from "../../../../enums/extensions/recommendationBlock.js";
1
+ import { getRecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAttributes as k } from "../../../../enums/extensions/recommendationBlock.js";
2
2
  import { useRecommendationApi as y } from "../../../../services/recommendationApi.js";
3
3
  import { useConfigStore as C } from "../../../../stores/config.js";
4
4
  import { defineStore as G } from "pinia";
@@ -115,7 +115,7 @@ const v = () => ({
115
115
  getActivePredictiveAlgorithms: (t) => {
116
116
  const r = [];
117
117
  return t.activePredictiveAlgorithms.filter((e) => !w.includes(e)).forEach((e) => {
118
- r.push(...g.filter((n) => n.id === e));
118
+ r.push(...g().filter((n) => n.id === e));
119
119
  }), r.map((e) => ({
120
120
  text: e.name,
121
121
  value: e.key
@@ -375,7 +375,7 @@ const v = () => ({
375
375
  },
376
376
  async _doFetchProducts() {
377
377
  var p;
378
- const t = this.currentRecommendationId, r = this.blockStates[t], { recommendationConfigs: e } = r, n = e.filters.filter((a) => a.isValid), c = b(n), i = ((p = g.find((a) => a.key === e.strategy)) == null ? void 0 : p.path) || "", o = C(), s = {
378
+ const t = this.currentRecommendationId, r = this.blockStates[t], { recommendationConfigs: e } = r, n = e.filters.filter((a) => a.isValid), c = b(n), i = ((p = g().find((a) => a.key === e.strategy)) == null ? void 0 : p.path) || "", o = C(), s = {
379
379
  locale: e.language,
380
380
  currency: e.currencySettings.value,
381
381
  partnerName: o.partnerName,
@@ -3,15 +3,15 @@ var h = (n, i, e) => i in n ? d(n, i, { enumerable: !0, configurable: !0, writab
3
3
  var u = (n, i, e) => h(n, typeof i != "symbol" ? i + "" : i, e);
4
4
  import { PAGE_TYPES as E } from "../../../enums/unsubscribe.js";
5
5
  import { useUnsubscribeStore as c } from "../../../stores/unsubscribe.js";
6
- import { Block as _, BlockCompositionType as S, ModificationDescription as b } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
- import { getDefaultTemplate as L } from "./template.js";
6
+ import { Block as _, BlockCompositionType as S, BlockType as L, ModificationDescription as b } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
7
+ import { getDefaultTemplate as v } from "./template.js";
8
8
  import { UNSUBSCRIBE_EVENTS as a, DATA_ATTRIBUTES as o } from "./utils/constants.js";
9
9
  import { parsePageList as p } from "./utils/utils.js";
10
- const v = "unsubscribe-block", g = 'a[data-unsubscribe-link="true"]', f = ".unsubscribe-block-v2", T = "{{ins-unsubscribe-link}}", B = {
10
+ const g = "unsubscribe-block", T = 'a[data-unsubscribe-link="true"]', f = ".unsubscribe-block-v2", B = "{{ins-unsubscribe-link}}", C = {
11
11
  [E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
12
12
  [E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
13
13
  };
14
- class R extends _ {
14
+ class I extends _ {
15
15
  constructor() {
16
16
  super();
17
17
  u(this, "selectEventListener", null);
@@ -19,7 +19,7 @@ class R extends _ {
19
19
  u(this, "currentNode");
20
20
  }
21
21
  getId() {
22
- return v;
22
+ return g;
23
23
  }
24
24
  getIcon() {
25
25
  return "unsubscribe-icon";
@@ -34,7 +34,7 @@ class R extends _ {
34
34
  return this.api.translate("Unsubscribe Block Description");
35
35
  }
36
36
  getTemplate() {
37
- return L();
37
+ return v();
38
38
  }
39
39
  onSelect(e) {
40
40
  this.currentNode = e, !("getAttribute" in e && e.getAttribute("data-migration")) && (this._resetStoreState(), this._loadBlockState(e), this._setupSelectEventListener(), this._setupCancelEventListener(), this._checkExistingBlocks(), this._openDrawer());
@@ -66,7 +66,7 @@ class R extends _ {
66
66
  try {
67
67
  if (!this.currentNode)
68
68
  return;
69
- this.api.getDocumentModifier().modifyHtml(this.currentNode).delete().apply(new b("Removed unsubscribe block due to cancel"));
69
+ this.api.getDocumentModifier().modifyHtml(this.currentNode).replaceWith(`<${L.EMPTY_CONTAINER}/>`).apply(new b("Removed unsubscribe block due to cancel"));
70
70
  } catch (e) {
71
71
  console.warn("[UnsubscribeBlock] Failed to remove unsubscribe block:", e);
72
72
  }
@@ -77,14 +77,14 @@ class R extends _ {
77
77
  _updateBlock(e, r) {
78
78
  if (!this.currentNode || !("querySelector" in this.currentNode))
79
79
  return;
80
- const s = this.currentNode.querySelector(g);
80
+ const s = this.currentNode.querySelector(T);
81
81
  if (!s)
82
82
  return;
83
83
  const t = this._getMergeTag(e);
84
84
  this.api.getDocumentModifier().modifyHtml(s).setAttribute("href", t).apply(new b(`Updated unsubscribe link to ${t}`)), this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(o.PAGE_TYPE, e.toString()).setAttribute(o.PAGE_LIST, r).apply(new b("Updated unsubscribe block metadata"));
85
85
  }
86
86
  _getMergeTag(e) {
87
- return B[e] ?? T;
87
+ return C[e] ?? B;
88
88
  }
89
89
  _openDrawer() {
90
90
  if (!(this.currentNode && this.currentNode.getAttribute("data-unsubscribe-page-type")))
@@ -130,6 +130,6 @@ class R extends _ {
130
130
  }
131
131
  }
132
132
  export {
133
- v as UNSUBSCRIBE_BLOCK_ID,
134
- R as UnsubscribeBlock
133
+ g as UNSUBSCRIBE_BLOCK_ID,
134
+ I as UnsubscribeBlock
135
135
  };
@@ -7,5 +7,5 @@ export declare const useActionsApi: () => {
7
7
  getPreviewData: (options?: CompileEmailOptions) => Promise<CompiledEmailResult>;
8
8
  updateTimerInClonedTemplate: () => Promise<string | null>;
9
9
  updateHtmlAndCss: (html: string, css: string) => void;
10
- editorSave: () => void;
10
+ editorSave: () => Promise<void>;
11
11
  };
@@ -1,2 +1,6 @@
1
1
  import type { ConditionCategories } from '@@/Types/condition-categories';
2
- export declare const displayConditions: ConditionCategories;
2
+ /**
3
+ * Get display conditions lazily so translations resolve at access time.
4
+ * Must be called within a Vue component context or after Pinia is initialized.
5
+ */
6
+ export declare const getDisplayConditions: () => ConditionCategories;
@@ -6,7 +6,11 @@ export declare const URLS: {
6
6
  export declare const QUERY_PARAMS: {
7
7
  CLIENT_ID: string;
8
8
  };
9
- export declare const RecommendationFeedSourceMaps: RecommendationFeedItem[];
9
+ /**
10
+ * Get recommendation feed source maps lazily so translated names resolve at access time.
11
+ * Must be called within a Vue component context or after Pinia is initialized.
12
+ */
13
+ export declare const getRecommendationFeedSourceMaps: () => RecommendationFeedItem[];
10
14
  export declare const PriceAttributes: string[];
11
15
  export declare const currencyLocationMaps: TextValueObject[];
12
16
  export declare const currencyOperators: TextValueObject[];
@@ -13,9 +13,14 @@ export declare const URLS: {
13
13
  PREFERENCES_URL: string;
14
14
  };
15
15
  export declare const INSIDER_ID = "iid";
16
- export declare const DEFAULT_UNSUBSCRIBE_GROUP: {
17
- readonly name: "Global Unsubscribe";
18
- readonly sendGridId: "G";
16
+ export declare const DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID = "G";
17
+ /**
18
+ * Get the default unsubscribe group lazily so the translated name resolves at access time.
19
+ * Must be called within a Vue component context or after Pinia is initialized.
20
+ */
21
+ export declare const getDefaultUnsubscribeGroup: () => {
22
+ name: string;
23
+ sendGridId: string;
19
24
  };
20
25
  export declare const UNSUBSCRIBE_PAGES_LINK = "/email/unsubscribe-pages";
21
26
  export declare const PAGE_TYPES: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.2.0-beta.543661c",
3
+ "version": "3.2.0-beta.64b2dc3",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",