@useinsider/guido 3.18.1-beta.c5d7fb4 → 3.18.1-beta.cb31236

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.
@@ -1,5 +1,5 @@
1
1
  import { ModuleFolderDefaults as f } from "../../enums/defaults.js";
2
- import { object as a, number as n, optional as e, string as t, picklist as i, pipe as m, minLength as b, custom as y, boolean as o, array as c, transform as C, record as k, fallback as R, literal as u, looseObject as g, variant as T, union as h, unknown as r, lazy as I } from "../../node_modules/valibot/dist/index.js";
2
+ import { object as o, number as n, optional as e, string as t, picklist as i, pipe as m, minLength as b, custom as h, boolean as a, array as c, transform as C, record as k, fallback as R, literal as u, looseObject as g, variant as I, union as y, unknown as r, lazy as T } from "../../node_modules/valibot/dist/index.js";
3
3
  const p = {
4
4
  /** Promotional/marketing emails */
5
5
  PROMOTIONAL: 1,
@@ -12,7 +12,7 @@ const p = {
12
12
  ARCHITECT: 49,
13
13
  /** Unsubscribe page builder */
14
14
  UNSUBSCRIBE_PAGES: 97
15
- }, A = a({
15
+ }, A = o({
16
16
  /** Unique identifier for the template being edited */
17
17
  templateId: m(
18
18
  t(),
@@ -26,13 +26,19 @@ const p = {
26
26
  /** Optional variation ID for A/B testing */
27
27
  variationId: e(t()),
28
28
  /** Optional numeric campaign ID of the host campaign; absent for templates and modules */
29
- campaignId: e(t())
30
- }), L = a({
29
+ campaignId: e(t()),
30
+ /**
31
+ * Optional numeric template-library id of the host template; absent for campaigns and
32
+ * modules. Distinct from `templateId`, which is the editor's document identity (a uuid /
33
+ * Stripo doc id) and is never an endpoint id.
34
+ */
35
+ templateLibraryId: e(t())
36
+ }), L = o({
31
37
  /** Fallback font name (e.g., "Georgia") */
32
38
  name: t(),
33
39
  /** Fallback font family (e.g., "serif" or "sans-serif") */
34
40
  family: t()
35
- }), M = a({
41
+ }), M = o({
36
42
  /** Partner/organization name (required) */
37
43
  name: m(
38
44
  t(),
@@ -56,7 +62,7 @@ const p = {
56
62
  username: e(t(), "Guido User"),
57
63
  /** Fallback font settings from partner settings — used to match backend size calculation */
58
64
  fallbackFont: e(L)
59
- }), E = a({
65
+ }), E = o({
60
66
  /** Display text for the dynamic content */
61
67
  text: t(),
62
68
  /** Template variable value (e.g., {{username}}) */
@@ -65,12 +71,12 @@ const p = {
65
71
  fallback: e(t()),
66
72
  /** Optional formatting options */
67
73
  format: e(
68
- a({
74
+ o({
69
75
  key: t(),
70
76
  value: t()
71
77
  })
72
78
  )
73
- }), S = I(() => g({
79
+ }), S = T(() => g({
74
80
  text: e(t()),
75
81
  // eslint-disable-next-line camelcase -- backend field name
76
82
  tag_text: e(t()),
@@ -85,13 +91,13 @@ const p = {
85
91
  /** Block ID (matches the dictionary key and the legacy HTML element id) */
86
92
  id: e(n()),
87
93
  /** Decimal places for price display (legacy data may use string or number) */
88
- decimalCount: e(h([t(), n()])),
94
+ decimalCount: e(y([t(), n()])),
89
95
  /** Pinned product IDs (empty array when filter-driven) */
90
96
  productIds: e(c(r())),
91
97
  /** Whether the block requested live products at send time */
92
- sendProductRequestFlag: e(o()),
98
+ sendProductRequestFlag: e(a()),
93
99
  /** Whether to randomize product order */
94
- shuffleProducts: e(o()),
100
+ shuffleProducts: e(a()),
95
101
  /** Filter rules driving product selection */
96
102
  filters: e(c(r())),
97
103
  /** Currency code (e.g. 'EUR') — sometimes absent in legacy data */
@@ -111,22 +117,22 @@ const p = {
111
117
  /** Mobile-only padding (left) */
112
118
  mobileLeftPadding: e(n()),
113
119
  /** Disable responsive scaling */
114
- unresponsive: e(o()),
120
+ unresponsive: e(a()),
115
121
  /** Layout orientation ('vertical' | 'horizontal') */
116
122
  orientation: e(t()),
117
123
  /** Whether long text is trimmed */
118
- textTrimming: e(o()),
124
+ textTrimming: e(a()),
119
125
  /** Block type marker used by some legacy variants */
120
126
  blockType: e(t()),
121
127
  /** Size variant marker (legacy data may use string or number) */
122
- size: e(h([t(), n()])),
128
+ size: e(y([t(), n()])),
123
129
  /** Vertical responsiveness flag (legacy size=1 variants) */
124
- verticalResponsiveness: e(o()),
130
+ verticalResponsiveness: e(a()),
125
131
  /** Legacy "Move to next line" price placement toggle (cardPricePlacement.js) */
126
- isPriceMovedToNextLine: e(o()),
132
+ isPriceMovedToNextLine: e(a()),
127
133
  /** Legacy "Hide if same as discounted" / delete-price-for-zero-sale toggle */
128
- isPriceDeletedForZeroSale: e(o())
129
- }), v = a({
134
+ isPriceDeletedForZeroSale: e(a())
135
+ }), v = o({
130
136
  /**
131
137
  * Legacy recommendation block configs keyed by block ID.
132
138
  * Pass this when loading a template authored with the v1
@@ -137,7 +143,7 @@ const p = {
137
143
  k(t(), P),
138
144
  {}
139
145
  )
140
- }), x = a({
146
+ }), x = o({
141
147
  /** Initial HTML content */
142
148
  html: e(t(), ""),
143
149
  /** Initial CSS content */
@@ -159,7 +165,7 @@ const p = {
159
165
  /** Selected unsubscribe page IDs */
160
166
  selectedUnsubscribePages: e(c(n()), []),
161
167
  /** Force recreate template in Stripo storage (use true when updating externally modified templates) */
162
- forceRecreate: e(o(), !1),
168
+ forceRecreate: e(a(), !1),
163
169
  /**
164
170
  * Consumer-persisted tracking-id high-water mark (SD-141414). Used as the id floor
165
171
  * during migration so a rolled-back document never re-mints retired tracking ids.
@@ -176,12 +182,12 @@ const p = {
176
182
  ),
177
183
  /** Migration-only inputs (legacy block configs) */
178
184
  migration: e(v, {})
179
- }), D = a({
185
+ }), D = o({
180
186
  /** Sender display name */
181
187
  senderName: e(t(), ""),
182
188
  /** Email subject line */
183
189
  subject: e(t(), "")
184
- }), O = a({
190
+ }), O = o({
185
191
  /** Locale for the editor UI */
186
192
  locale: e(t(), "en"),
187
193
  /** Path to translations object */
@@ -194,35 +200,35 @@ const p = {
194
200
  savedModulesFolderName: e(t(), f.SAVED_MODULES),
195
201
  /** Folder name for default/prebuilt modules (used by Stripo plugin panel for path construction) */
196
202
  defaultModulesFolderName: e(t(), f.DEFAULT_MODULES)
197
- }), F = a({
203
+ }), F = o({
198
204
  /** Whether to show the header bar */
199
- showHeader: e(o(), !0),
205
+ showHeader: e(a(), !0),
200
206
  /** Custom label for back button (if shown) */
201
207
  backButtonLabel: e(t())
202
- }), U = a({
208
+ }), U = o({
203
209
  /** Enable dynamic content insertion */
204
- dynamicContent: e(o(), !0),
210
+ dynamicContent: e(a(), !0),
205
211
  /** Enable save as template functionality */
206
- saveAsTemplate: e(o(), !0),
212
+ saveAsTemplate: e(a(), !0),
207
213
  /** Enable version history */
208
- versionHistory: e(o(), !0),
214
+ versionHistory: e(a(), !0),
209
215
  /** Enable test message sending */
210
- testMessage: e(o(), !0),
216
+ testMessage: e(a(), !0),
211
217
  /** Enable display conditions */
212
- displayConditions: e(o(), !0),
218
+ displayConditions: e(a(), !0),
213
219
  /** Enable unsubscribe block */
214
- unsubscribe: e(o(), !0),
220
+ unsubscribe: e(a(), !0),
215
221
  /** Disable modules panel in the editor */
216
- modulesDisabled: e(o(), !1),
222
+ modulesDisabled: e(a(), !1),
217
223
  /** Enable Liquid template syntax */
218
- liquidSyntax: e(o(), !1),
224
+ liquidSyntax: e(a(), !1),
219
225
  /** Enable autosave (3-min interval + tab-hide). User toggles on/off from the header. */
220
- autosave: e(o(), !1),
226
+ autosave: e(a(), !1),
221
227
  /** Enable pre-save domain-allowlist validation (opt-in; Guido self-serves the block toaster) */
222
- allowlistEnabled: e(o(), !1),
228
+ allowlistEnabled: e(a(), !1),
223
229
  /** Enable persistent link tracking-id assignment for the click heatmap (opt-in) */
224
- linkTrackingIds: e(o(), !1),
225
- reusableRecommendationStrategy: e(o(), !1)
230
+ linkTrackingIds: e(a(), !1),
231
+ reusableRecommendationStrategy: e(a(), !1)
226
232
  }), B = i([
227
233
  "amp-accordion",
228
234
  "amp-carousel",
@@ -245,7 +251,7 @@ const p = {
245
251
  "unsubscribe-block",
246
252
  "coupon-block",
247
253
  "items-block"
248
- ]), H = a({
254
+ ]), H = o({
249
255
  /** Default blocks to exclude from the editor */
250
256
  excludeDefaults: e(
251
257
  c(B),
@@ -256,14 +262,14 @@ const p = {
256
262
  c(w),
257
263
  []
258
264
  )
259
- }), d = a({
265
+ }), d = o({
260
266
  /** Unique identifier for the rule */
261
267
  id: t(),
262
268
  /** Human-readable description */
263
269
  description: e(t()),
264
270
  /** Priority for rule ordering (lower = earlier) */
265
271
  priority: n()
266
- }), _ = a({
272
+ }), _ = o({
267
273
  ...d.entries,
268
274
  type: u("replace"),
269
275
  /** String to search for */
@@ -271,8 +277,8 @@ const p = {
271
277
  /** Replacement string */
272
278
  replacement: t(),
273
279
  /** Replace all occurrences (default: false) */
274
- replaceAll: e(o())
275
- }), j = a({
280
+ replaceAll: e(a())
281
+ }), j = o({
276
282
  ...d.entries,
277
283
  type: u("regex"),
278
284
  /** Regex pattern string */
@@ -281,41 +287,41 @@ const p = {
281
287
  replacement: t(),
282
288
  /** Regex flags (e.g., 'gi') */
283
289
  flags: e(t())
284
- }), q = a({
290
+ }), q = o({
285
291
  ...d.entries,
286
292
  type: u("remove"),
287
293
  /** Strings or patterns to remove */
288
294
  targets: c(t())
289
- }), G = a({
295
+ }), G = o({
290
296
  ...d.entries,
291
297
  type: u("custom"),
292
298
  /** Custom processor function */
293
- processor: y(
299
+ processor: h(
294
300
  (s) => typeof s == "function",
295
301
  "processor must be a function"
296
302
  )
297
- }), V = T("type", [
303
+ }), V = I("type", [
298
304
  _,
299
305
  j,
300
306
  q,
301
307
  G
302
- ]), z = a({
308
+ ]), z = o({
303
309
  /** Custom compiler rules to apply */
304
310
  customRules: e(c(V), []),
305
311
  /** Skip default compiler rules */
306
- ignoreDefaultRules: e(o(), !1)
307
- }), Z = a({
312
+ ignoreDefaultRules: e(a(), !1)
313
+ }), Z = o({
308
314
  /**
309
315
  * External validation handler called before save completes.
310
316
  * Return false to cancel the save operation.
311
317
  */
312
318
  externalValidation: e(
313
- y(
319
+ h(
314
320
  (s) => typeof s == "function",
315
321
  "externalValidation must be a function"
316
322
  )
317
323
  )
318
- }), Q = a({
324
+ }), Q = o({
319
325
  // Required sections
320
326
  /** Identity configuration (required) */
321
327
  identity: A,
@@ -1,54 +1,58 @@
1
1
  import { useRecommendation as f } from "./useRecommendation.js";
2
- import { useToaster as p } from "./useToaster.js";
3
- import { useTranslations as S } from "./useTranslations.js";
2
+ import { useToaster as S } from "./useToaster.js";
3
+ import { useTranslations as I } from "./useTranslations.js";
4
4
  import { ToasterTypeOptions as C } from "../enums/toaster.js";
5
5
  import "../extensions/Blocks/Recommendation/constants/selectors.js";
6
- import { CURRENT_CONFIG_VERSION as I } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
7
- import { useRecommendationExtensionStore as L } from "../extensions/Blocks/Recommendation/store/recommendation.js";
8
- import { buildLegacyMigrationPayload as v } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js";
9
- import { commitBlockChangeOutsidePanel as R } from "../extensions/Blocks/Recommendation/utils/nodeConfigWriter.js";
10
- import { useConfigStore as b } from "../stores/config.js";
11
- const F = () => {
12
- const t = L(), n = b(), { buildCampaignUrl: c } = f(), { showToaster: s } = p(), m = S();
6
+ import { CURRENT_CONFIG_VERSION as L } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
7
+ import { useRecommendationExtensionStore as v } from "../extensions/Blocks/Recommendation/store/recommendation.js";
8
+ import { resolveMigrationTarget as b, buildLegacyMigrationPayload as R } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js";
9
+ import { commitBlockChangeOutsidePanel as T } from "../extensions/Blocks/Recommendation/utils/nodeConfigWriter.js";
10
+ import { useConfigStore as h } from "../stores/config.js";
11
+ const V = () => {
12
+ const t = v(), o = h(), { buildCampaignUrl: s } = f(), { showToaster: m } = S(), g = I();
13
13
  return { convertLegacyStrategy: async () => {
14
- const o = t.currentRecommendationId;
15
- if (o === null || !t.isLegacyStrategyBlock || t.legacyConversionLoading)
14
+ const e = t.currentRecommendationId;
15
+ if (e === null || !t.isLegacyStrategyBlock || t.legacyConversionLoading)
16
16
  return "";
17
- const { strategy: g, productIds: d, filters: y } = t.recommendationConfigs, l = v({
18
- blockId: o,
19
- url: c(String(o)),
20
- campaignId: n.campaignId,
21
- variationId: n.variationId,
22
- strategy: g,
23
- productIds: d,
17
+ const { strategy: d, productIds: l, filters: y } = t.recommendationConfigs, n = b({
18
+ campaignId: o.campaignId,
19
+ templateLibraryId: o.templateLibraryId
20
+ }), p = R({
21
+ blockId: e,
22
+ url: s(String(e)),
23
+ campaignId: o.campaignId,
24
+ variationId: o.variationId,
25
+ strategy: d,
26
+ productIds: l,
24
27
  filters: y,
25
- attributes: t.getFilterList
28
+ attributes: t.getFilterList,
29
+ target: n
26
30
  });
27
- let e;
31
+ let r;
28
32
  try {
29
- e = await t.convertLegacyStrategy(l);
30
- } catch (r) {
31
- return console.error("[useLegacyStrategyConversion] migration failed", r), s({
33
+ r = await t.convertLegacyStrategy(p, n);
34
+ } catch (a) {
35
+ return console.error("[useLegacyStrategyConversion] migration failed", a), m({
32
36
  type: C.Error,
33
- message: m("email-editor.legacy-strategy-update-failed")
37
+ message: g("email-editor.legacy-strategy-update-failed")
34
38
  }), "";
35
39
  }
36
- const a = t.currentRecommendationId === o;
37
- if (a)
40
+ const i = t.currentRecommendationId === e;
41
+ if (i)
38
42
  try {
39
43
  await t.fetchRecommendationProducts();
40
- } catch (r) {
41
- console.error("[useLegacyStrategyConversion] product refetch failed", r);
44
+ } catch (a) {
45
+ console.error("[useLegacyStrategyConversion] product refetch failed", a);
42
46
  }
43
- const i = t.blockStates[o], { size: u } = i.recommendationConfigs;
44
- return R(
45
- o,
46
- { strategyId: e, size: u, configVersion: I },
47
- i.recommendationProducts,
47
+ const c = t.blockStates[e], { size: u } = c.recommendationConfigs;
48
+ return T(
49
+ e,
50
+ { strategyId: r, size: u, configVersion: L },
51
+ c.recommendationProducts,
48
52
  "Converted legacy recommendation strategy"
49
- ), a && t.openLegacyStrategyUpdatedModal(), e;
53
+ ), i && t.openLegacyStrategyUpdatedModal(), r;
50
54
  } };
51
55
  };
52
56
  export {
53
- F as useLegacyStrategyConversion
57
+ V as useLegacyStrategyConversion
54
58
  };
@@ -6,9 +6,9 @@ const l = {
6
6
  RECOMMENDATION_STRATEGIES_PATH: "/api/recommendation-strategies",
7
7
  RECOMMENDATION_STRATEGIES_PANEL_PATH: "/discovery/recommendation-strategies",
8
8
  NEWSLETTER_RECOMMENDATIONS_PATH: "/newsletter/recommendations"
9
- }, c = {
9
+ }, c = "migrate-strategies", d = "template", m = {
10
10
  CLIENT_ID: "clientId"
11
- }, d = () => {
11
+ }, p = () => {
12
12
  const e = r();
13
13
  return [
14
14
  {
@@ -72,14 +72,14 @@ const l = {
72
72
  path: "top-sellers"
73
73
  }
74
74
  ];
75
- }, m = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], p = [
75
+ }, v = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], h = [
76
76
  { text: "before the amount", value: "0" },
77
77
  { text: "after the amount", value: "1" }
78
- ], v = [
78
+ ], x = [
79
79
  { text: "dot(.)", value: "." },
80
80
  { text: "comma(,)", value: "," },
81
81
  { text: "space( )", value: " " }
82
- ], h = [
82
+ ], E = [
83
83
  { text: "0", value: "0" },
84
84
  { text: "1", value: "1" },
85
85
  { text: "2", value: "2" },
@@ -108,7 +108,7 @@ const l = {
108
108
  ], i = [
109
109
  { text: "true", value: "==" },
110
110
  { text: "false", value: "!=" }
111
- ], x = (e) => {
111
+ ], T = (e) => {
112
112
  if (!e)
113
113
  return t;
114
114
  switch (e) {
@@ -127,15 +127,17 @@ const l = {
127
127
  }
128
128
  };
129
129
  export {
130
+ c as MIGRATE_STRATEGIES_SEGMENT,
130
131
  a as OP_ANY_OF,
131
- m as PriceAttributes,
132
- c as QUERY_PARAMS,
132
+ v as PriceAttributes,
133
+ m as QUERY_PARAMS,
134
+ d as TEMPLATE_MIGRATION_SCOPE_SEGMENT,
133
135
  l as URLS,
134
- h as currencyDecimalCounts,
135
- p as currencyLocationMaps,
136
- v as currencyOperators,
137
- x as getOperatorOptions,
138
- d as getRecommendationFeedSourceMaps,
136
+ E as currencyDecimalCounts,
137
+ h as currencyLocationMaps,
138
+ x as currencyOperators,
139
+ T as getOperatorOptions,
140
+ p as getRecommendationFeedSourceMaps,
139
141
  n as operatorOptionsForArrayOfStrings,
140
142
  i as operatorOptionsForBooleans,
141
143
  s as operatorOptionsForDates,
@@ -398,27 +398,27 @@ const E = () => ({
398
398
  ...t.size !== void 0 ? { size: String(t.size) } : {}
399
399
  });
400
400
  },
401
- async convertLegacyStrategy(t) {
402
- const e = this.currentRecommendationId;
403
- if (e === null || !this.blockStates[e])
401
+ async convertLegacyStrategy(t, e = { scope: "campaign" }) {
402
+ const r = this.currentRecommendationId;
403
+ if (r === null || !this.blockStates[r])
404
404
  throw new Error("[Guido] convertLegacyStrategy called without an active block");
405
- this.blockStates[e].legacyConversionLoading = !0;
405
+ this.blockStates[r].legacyConversionLoading = !0;
406
406
  try {
407
- const r = await m.migrateLegacyStrategy(t);
407
+ const n = await m.migrateLegacyStrategy(t, e);
408
408
  try {
409
409
  await this.fetchStrategies();
410
- } catch (i) {
411
- console.error("[Guido] strategy listing refresh after conversion failed", i);
410
+ } catch (o) {
411
+ console.error("[Guido] strategy listing refresh after conversion failed", o);
412
412
  }
413
- const n = this.strategies.find((i) => String(i.strategy_id) === r), s = this.blockStates[e];
414
- return s.recommendationConfigs = {
415
- ...s.recommendationConfigs,
416
- strategyId: r,
413
+ const s = this.strategies.find((o) => String(o.strategy_id) === n), i = this.blockStates[r];
414
+ return i.recommendationConfigs = {
415
+ ...i.recommendationConfigs,
416
+ strategyId: n,
417
417
  nodeConfigVersion: y,
418
- ...(n == null ? void 0 : n.size) !== void 0 ? { size: String(n.size) } : {}
419
- }, this.currentRecommendationId === e && this.configVersion++, r;
418
+ ...(s == null ? void 0 : s.size) !== void 0 ? { size: String(s.size) } : {}
419
+ }, this.currentRecommendationId === r && this.configVersion++, n;
420
420
  } finally {
421
- this.blockStates[e].legacyConversionLoading = !1;
421
+ this.blockStates[r].legacyConversionLoading = !1;
422
422
  }
423
423
  },
424
424
  removeStrategy() {
@@ -1,58 +1,72 @@
1
- import { OP_ANY_OF as u } from "../../../../enums/extensions/recommendationBlock.js";
1
+ import { OP_ANY_OF as p } from "../../../../enums/extensions/recommendationBlock.js";
2
2
  import "../constants/selectors.js";
3
- import { CURRENT_CONFIG_VERSION as d } from "../constants/defaultConfig.js";
4
- import { parseTagList as m } from "./filterUtil.js";
5
- import { sanitizeProductIds as l } from "./productIds.js";
6
- const I = "String", N = "manualMerchandising";
7
- function _({ strategyId: t, nodeConfigVersion: e }) {
8
- return !t && e < d;
3
+ import { CURRENT_CONFIG_VERSION as l } from "../constants/defaultConfig.js";
4
+ import { parseTagList as I } from "./filterUtil.js";
5
+ import { sanitizeProductIds as N } from "./productIds.js";
6
+ const b = "String", f = "manualMerchandising";
7
+ function A({ strategyId: t, nodeConfigVersion: o }) {
8
+ return !t && o < l;
9
9
  }
10
- const c = (t) => t === "|" ? "or" : "and", b = (t, e) => {
11
- var r;
10
+ const m = (t) => {
11
+ const o = String(t ?? "").trim();
12
+ return /^[1-9]\d*$/.test(o) ? o : null;
13
+ };
14
+ function O({ campaignId: t, templateLibraryId: o }) {
15
+ if (m(t))
16
+ return { scope: "campaign" };
17
+ const e = m(o);
18
+ return e ? { scope: "template", templateId: e } : { scope: "campaign" };
19
+ }
20
+ const d = (t) => t === "|" ? "or" : "and", y = (t, o) => {
21
+ var e;
12
22
  return {
13
- conditionLogic: c(t.innerGroupOperator),
23
+ conditionLogic: d(t.innerGroupOperator),
14
24
  attribute: {
15
25
  attributeName: t.attribute,
16
- attributeType: ((r = e.find((o) => o.value === t.attribute)) == null ? void 0 : r.type) || I
26
+ attributeType: ((e = o.find((r) => r.value === t.attribute)) == null ? void 0 : e.type) || b
17
27
  },
18
- operator: { operator: t.operator === u ? "=" : t.operator },
19
- value: t.operator === u ? m(t.value).join(u) : t.value
28
+ operator: { operator: t.operator === p ? "=" : t.operator },
29
+ value: t.operator === p ? I(t.value).join(p) : t.value
20
30
  };
21
31
  };
22
- function f(t, e) {
23
- const r = /* @__PURE__ */ new Map();
24
- return t.filter((o) => o.isValid).forEach((o) => {
25
- r.set(o.filterGroup, [...r.get(o.filterGroup) ?? [], o]);
26
- }), [...r.keys()].sort((o, i) => o - i).map((o) => {
27
- const i = [...r.get(o) ?? []].sort((n, a) => n.filterNumber - a.filterNumber);
32
+ function L(t, o) {
33
+ const e = /* @__PURE__ */ new Map();
34
+ return t.filter((r) => r.isValid).forEach((r) => {
35
+ e.set(r.filterGroup, [...e.get(r.filterGroup) ?? [], r]);
36
+ }), [...e.keys()].sort((r, n) => r - n).map((r) => {
37
+ const n = [...e.get(r) ?? []].sort((i, a) => i.filterNumber - a.filterNumber);
28
38
  return {
29
- groupLogic: c(i[0].outerGroupOperator),
30
- conditionList: i.map((n) => b(n, e))
39
+ groupLogic: d(n[0].outerGroupOperator),
40
+ conditionList: n.map((i) => y(i, o))
31
41
  };
32
42
  });
33
43
  }
34
- function A({
44
+ function S({
35
45
  blockId: t,
36
- url: e,
37
- campaignId: r,
38
- variationId: o,
39
- strategy: i,
40
- productIds: n,
46
+ url: o,
47
+ campaignId: e,
48
+ variationId: r,
49
+ strategy: n,
50
+ productIds: i,
41
51
  filters: a,
42
- attributes: g
52
+ attributes: g,
53
+ target: u
43
54
  }) {
44
- const p = f(a, g), s = i === N ? l(n).split(",").filter(Boolean) : [];
55
+ const s = L(a, g), c = n === f ? N(i).split(",").filter(Boolean) : [];
45
56
  return {
46
- campaignId: Number.parseInt(r) || 0,
47
- variationId: Number.parseInt(o) || 0,
57
+ ...u.scope === "template" ? { templateId: Number.parseInt(u.templateId) } : {
58
+ campaignId: Number.parseInt(e) || 0,
59
+ variationId: Number.parseInt(r) || 0
60
+ },
48
61
  blockId: String(t),
49
- url: e,
50
- ...p.length ? { filters: p } : {},
51
- ...s.length ? { productIds: s } : {}
62
+ url: o,
63
+ ...s.length ? { filters: s } : {},
64
+ ...c.length ? { productIds: c } : {}
52
65
  };
53
66
  }
54
67
  export {
55
- A as buildLegacyMigrationPayload,
56
- _ as isLegacyStrategyConfig,
57
- f as toMigrationFilterGroups
68
+ S as buildLegacyMigrationPayload,
69
+ A as isLegacyStrategyConfig,
70
+ O as resolveMigrationTarget,
71
+ L as toMigrationFilterGroups
58
72
  };
@@ -1,100 +1,100 @@
1
- import { useHttp as y } from "../composables/useHttp.js";
2
- import { URLS as c, QUERY_PARAMS as u } from "../enums/extensions/recommendationBlock.js";
3
- const g = "[sr_strategies.status][=][active]*[sr_strategies.suitable_channels][~][EMAIL]", l = (s) => s.reduce(
4
- (i, o, d) => (i[d] = {
1
+ import { useHttp as T } from "../composables/useHttp.js";
2
+ import { URLS as c, QUERY_PARAMS as m, TEMPLATE_MIGRATION_SCOPE_SEGMENT as _, MIGRATE_STRATEGIES_SEGMENT as u } from "../enums/extensions/recommendationBlock.js";
3
+ const h = "[sr_strategies.status][=][active]*[sr_strategies.suitable_channels][~][EMAIL]", S = (i) => i.reduce(
4
+ (d, o, E) => (d[E] = {
5
5
  attributeName: o.attributeName,
6
6
  attributeJs: o.attributeJs,
7
7
  attributeType: o.attributeType,
8
8
  type: o.type,
9
9
  displayName: o.displayName,
10
10
  isFilterable: o.isFilterable
11
- }, i),
11
+ }, d),
12
12
  {}
13
- ), _ = () => {
14
- const { get: s, post: i } = y(), { get: o } = y({ headers: {} }), d = "6KcLM9TwheVB1mgK";
13
+ ), f = () => {
14
+ const { get: i, post: d } = T(), { get: o } = T({ headers: {} }), E = "6KcLM9TwheVB1mgK", y = async () => {
15
+ try {
16
+ return (await i(`${c.NEWSLETTER_RECOMMENDATIONS_PATH}/create-data`)).data;
17
+ } catch (t) {
18
+ throw console.error("fetchUserModalState error:", t), t;
19
+ }
20
+ }, R = async () => {
21
+ try {
22
+ const { data: t } = await i(
23
+ c.PRODUCT_ATTRIBUTES_PATH
24
+ ), a = Array.isArray(t) ? t : (t == null ? void 0 : t.data) ?? [];
25
+ return S(a);
26
+ } catch (t) {
27
+ throw console.error("fetchRecommendationFilters error:", t), t;
28
+ }
29
+ }, l = async (t, a) => {
30
+ var e;
31
+ try {
32
+ const r = new URLSearchParams(Object.entries(a));
33
+ r.set(m.CLIENT_ID, E);
34
+ const n = decodeURIComponent(r.toString());
35
+ console.debug("🏁 Recommendation API Query:", n);
36
+ const s = await o(
37
+ `${c.RECOMMENDATION_API_URL}/v2/${t}?${n}`
38
+ );
39
+ return ((e = s == null ? void 0 : s.data) == null ? void 0 : e.data) ?? [];
40
+ } catch (r) {
41
+ throw console.error("fetchRecommendationProducts error:", r), r;
42
+ }
43
+ }, g = async (t) => {
44
+ var a;
45
+ try {
46
+ const e = new RegExp(`[?&]${m.CLIENT_ID}=`).test(t), r = t.includes("?") ? "&" : "?", n = e ? t : `${t}${r}${m.CLIENT_ID}=${E}`, s = await o(
47
+ n
48
+ );
49
+ return ((a = s == null ? void 0 : s.data) == null ? void 0 : a.data) ?? [];
50
+ } catch (e) {
51
+ return console.error("fetchRecommendationProductsByUrl error:", e), [];
52
+ }
53
+ }, p = async () => {
54
+ try {
55
+ const { data: t } = await i(
56
+ `${c.RECOMMENDATION_STRATEGIES_PATH}?filters=${encodeURIComponent(h)}`
57
+ );
58
+ return Array.isArray(t) ? t : (t == null ? void 0 : t.data) ?? [];
59
+ } catch (t) {
60
+ throw console.error("fetchRecommendationStrategies error:", t), t;
61
+ }
62
+ }, I = async (t, a) => {
63
+ try {
64
+ const { data: e } = await d(
65
+ `${c.RECOMMENDATION_STRATEGIES_PATH}/endpoint-generate`,
66
+ {
67
+ campaignId: 0,
68
+ pageTypes: [],
69
+ isPreviewer: !1,
70
+ strategy: t,
71
+ userId: "",
72
+ currency: a
73
+ }
74
+ );
75
+ return !e || typeof e != "object" || !("full_path" in e || "data" in e) ? (console.error("generateStrategyEndpoint unexpected response shape:", e), null) : "full_path" in e ? e : e.data;
76
+ } catch (e) {
77
+ return console.error("generateStrategyEndpoint error:", e), null;
78
+ }
79
+ }, A = (t) => t.scope === "template" ? `${c.NEWSLETTER_RECOMMENDATIONS_PATH}/${_}/${u}` : `${c.NEWSLETTER_RECOMMENDATIONS_PATH}/${u}`;
15
80
  return {
16
- fetchRecommendationCreateData: async () => {
17
- try {
18
- return (await s(`${c.NEWSLETTER_RECOMMENDATIONS_PATH}/create-data`)).data;
19
- } catch (t) {
20
- throw console.error("fetchUserModalState error:", t), t;
21
- }
22
- },
23
- fetchRecommendationFilters: async () => {
24
- try {
25
- const { data: t } = await s(
26
- c.PRODUCT_ATTRIBUTES_PATH
27
- ), r = Array.isArray(t) ? t : (t == null ? void 0 : t.data) ?? [];
28
- return l(r);
29
- } catch (t) {
30
- throw console.error("fetchRecommendationFilters error:", t), t;
31
- }
32
- },
33
- fetchRecommendationProducts: async (t, r) => {
34
- var e;
35
- try {
36
- const a = new URLSearchParams(Object.entries(r));
37
- a.set(u.CLIENT_ID, d);
38
- const m = decodeURIComponent(a.toString());
39
- console.debug("🏁 Recommendation API Query:", m);
40
- const n = await o(
41
- `${c.RECOMMENDATION_API_URL}/v2/${t}?${m}`
42
- );
43
- return ((e = n == null ? void 0 : n.data) == null ? void 0 : e.data) ?? [];
44
- } catch (a) {
45
- throw console.error("fetchRecommendationProducts error:", a), a;
46
- }
47
- },
48
- fetchRecommendationProductsByUrl: async (t) => {
49
- var r;
50
- try {
51
- const e = new RegExp(`[?&]${u.CLIENT_ID}=`).test(t), a = t.includes("?") ? "&" : "?", m = e ? t : `${t}${a}${u.CLIENT_ID}=${d}`, n = await o(
52
- m
53
- );
54
- return ((r = n == null ? void 0 : n.data) == null ? void 0 : r.data) ?? [];
55
- } catch (e) {
56
- return console.error("fetchRecommendationProductsByUrl error:", e), [];
57
- }
58
- },
59
- fetchRecommendationStrategies: async () => {
60
- try {
61
- const { data: t } = await s(
62
- `${c.RECOMMENDATION_STRATEGIES_PATH}?filters=${encodeURIComponent(g)}`
63
- );
64
- return Array.isArray(t) ? t : (t == null ? void 0 : t.data) ?? [];
65
- } catch (t) {
66
- throw console.error("fetchRecommendationStrategies error:", t), t;
67
- }
68
- },
69
- generateStrategyEndpoint: async (t, r) => {
70
- try {
71
- const { data: e } = await i(
72
- `${c.RECOMMENDATION_STRATEGIES_PATH}/endpoint-generate`,
73
- {
74
- campaignId: 0,
75
- pageTypes: [],
76
- isPreviewer: !1,
77
- strategy: t,
78
- userId: "",
79
- currency: r
80
- }
81
- );
82
- return !e || typeof e != "object" || !("full_path" in e || "data" in e) ? (console.error("generateStrategyEndpoint unexpected response shape:", e), null) : "full_path" in e ? e : e.data;
83
- } catch (e) {
84
- return console.error("generateStrategyEndpoint error:", e), null;
85
- }
86
- },
87
- migrateLegacyStrategy: async (t) => {
88
- const { data: r } = await i(
89
- `${c.NEWSLETTER_RECOMMENDATIONS_PATH}/migrate-strategies`,
81
+ fetchRecommendationCreateData: y,
82
+ fetchRecommendationFilters: R,
83
+ fetchRecommendationProducts: l,
84
+ fetchRecommendationProductsByUrl: g,
85
+ fetchRecommendationStrategies: p,
86
+ generateStrategyEndpoint: I,
87
+ migrateLegacyStrategy: async (t, a = { scope: "campaign" }) => {
88
+ const { data: e } = await d(
89
+ A(a),
90
90
  t
91
- ), e = r && typeof r == "object" && "data" in r ? r.data : r, a = e == null ? void 0 : e.strategyId;
92
- if (a == null || a === "")
91
+ ), r = e && typeof e == "object" && "data" in e ? e.data : e, n = r == null ? void 0 : r.strategyId;
92
+ if (n == null || n === "")
93
93
  throw new Error("[Guido] migrate-strategies returned no strategyId");
94
- return String(a);
94
+ return String(n);
95
95
  }
96
96
  };
97
97
  };
98
98
  export {
99
- _ as useRecommendationApi
99
+ f as useRecommendationApi
100
100
  };
@@ -52,6 +52,12 @@ export declare const IdentitySchema: v.ObjectSchema<{
52
52
  readonly variationId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
53
53
  /** Optional numeric campaign ID of the host campaign; absent for templates and modules */
54
54
  readonly campaignId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
55
+ /**
56
+ * Optional numeric template-library id of the host template; absent for campaigns and
57
+ * modules. Distinct from `templateId`, which is the editor's document identity (a uuid /
58
+ * Stripo doc id) and is never an endpoint id.
59
+ */
60
+ readonly templateLibraryId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
55
61
  }, undefined>;
56
62
  /**
57
63
  * Partner configuration - organization and product context
@@ -629,6 +635,12 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
629
635
  readonly variationId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
630
636
  /** Optional numeric campaign ID of the host campaign; absent for templates and modules */
631
637
  readonly campaignId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
638
+ /**
639
+ * Optional numeric template-library id of the host template; absent for campaigns and
640
+ * modules. Distinct from `templateId`, which is the editor's document identity (a uuid /
641
+ * Stripo doc id) and is never an endpoint id.
642
+ */
643
+ readonly templateLibraryId: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
632
644
  }, undefined>;
633
645
  /** Partner configuration (required) */
634
646
  readonly partner: v.ObjectSchema<{
@@ -12,6 +12,7 @@ export declare const useConfig: () => {
12
12
  userId: string;
13
13
  variationId?: string | undefined;
14
14
  campaignId?: string | undefined;
15
+ templateLibraryId?: string | undefined;
15
16
  };
16
17
  partner: {
17
18
  name: string;
@@ -148,6 +149,7 @@ export declare const useConfig: () => {
148
149
  userId: string;
149
150
  variationId?: string | undefined;
150
151
  campaignId?: string | undefined;
152
+ templateLibraryId?: string | undefined;
151
153
  } | null>;
152
154
  partner: import("vue").ComputedRef<{
153
155
  name: string;
@@ -7,6 +7,8 @@ export declare const URLS: {
7
7
  RECOMMENDATION_STRATEGIES_PANEL_PATH: string;
8
8
  NEWSLETTER_RECOMMENDATIONS_PATH: string;
9
9
  };
10
+ export declare const MIGRATE_STRATEGIES_SEGMENT = "migrate-strategies";
11
+ export declare const TEMPLATE_MIGRATION_SCOPE_SEGMENT = "template";
10
12
  export declare const QUERY_PARAMS: {
11
13
  CLIENT_ID: string;
12
14
  };
@@ -1,4 +1,4 @@
1
- import type { Orientation, Languages, Currency, NumericSeparator, FiltersResponse, Filter, RecommendationCampaignUrlValue, RecommendationProduct, RrsMigrationPayload, RrsStrategy } from '@@/Types/recommendation';
1
+ import type { Orientation, Languages, Currency, NumericSeparator, FiltersResponse, Filter, RecommendationCampaignUrlValue, RecommendationProduct, RrsMigrationPayload, RrsMigrationTarget, RrsStrategy } from '@@/Types/recommendation';
2
2
  export interface PerBlockConfigs {
3
3
  cardsInRow: number;
4
4
  currencySettings: {
@@ -487,7 +487,7 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
487
487
  fetchStrategies(): Promise<void>;
488
488
  resolveStrategyUrlTemplate(strategy: RrsStrategy, currency: string): Promise<string>;
489
489
  assignStrategy(strategy: RrsStrategy): void;
490
- convertLegacyStrategy(payload: RrsMigrationPayload): Promise<string>;
490
+ convertLegacyStrategy(payload: RrsMigrationPayload, target?: RrsMigrationTarget): Promise<string>;
491
491
  removeStrategy(): void;
492
492
  fetchRecommendationCreateData(): Promise<void>;
493
493
  fetchRecommendationFilters(): Promise<void>;
@@ -1,4 +1,4 @@
1
- import type { Filter, RrsMigrationFilterGroup, RrsMigrationPayload } from '@@/Types/recommendation';
1
+ import type { Filter, RrsMigrationFilterGroup, RrsMigrationPayload, RrsMigrationTarget } from '@@/Types/recommendation';
2
2
  type FilterAttribute = {
3
3
  value: string;
4
4
  type: string;
@@ -13,6 +13,10 @@ export declare function isLegacyStrategyConfig({ strategyId, nodeConfigVersion }
13
13
  strategyId: string;
14
14
  nodeConfigVersion: number;
15
15
  }): boolean;
16
+ export declare function resolveMigrationTarget({ campaignId, templateLibraryId }: {
17
+ campaignId?: string;
18
+ templateLibraryId?: string;
19
+ }): RrsMigrationTarget;
16
20
  /**
17
21
  * Groups the block's valid filters the way the feed URL groups them, in the
18
22
  * shape the migration endpoint validates. The URL's filter DSL states no
@@ -29,11 +33,12 @@ interface MigrationInputs {
29
33
  productIds: string[];
30
34
  filters: Filter[];
31
35
  attributes: FilterAttribute[];
36
+ target: RrsMigrationTarget;
32
37
  }
33
38
  /**
34
- * The server names and de-duplicates the strategy, so nothing here derives a
35
- * name; `campaignId`/`variationId` only feed that name and fall back to 0 for
36
- * templates and modules, which carry no numeric campaign.
39
+ * The server names and de-duplicates the strategy, so nothing here derives a name. The two
40
+ * routes take different identity fields the campaign one names from `campaignId`/`variationId`
41
+ * (0 for modules, which carry no numeric campaign), the template one from `templateId`.
37
42
  */
38
- export declare function buildLegacyMigrationPayload({ blockId, url, campaignId, variationId, strategy, productIds, filters, attributes, }: MigrationInputs): RrsMigrationPayload;
43
+ export declare function buildLegacyMigrationPayload({ blockId, url, campaignId, variationId, strategy, productIds, filters, attributes, target, }: MigrationInputs): RrsMigrationPayload;
39
44
  export {};
@@ -1,4 +1,4 @@
1
- import type { InitialResponse, FiltersResponse, RecommendationProduct, RecommendationProductsParams, RrsEndpointGenerateResponse, RrsMigrationPayload, RrsStrategy } from '@@/Types/recommendation';
1
+ import type { InitialResponse, FiltersResponse, RecommendationProduct, RecommendationProductsParams, RrsEndpointGenerateResponse, RrsMigrationPayload, RrsMigrationTarget, RrsStrategy } from '@@/Types/recommendation';
2
2
  export declare const useRecommendationApi: () => {
3
3
  fetchRecommendationCreateData: () => Promise<InitialResponse>;
4
4
  fetchRecommendationFilters: () => Promise<FiltersResponse>;
@@ -6,5 +6,5 @@ export declare const useRecommendationApi: () => {
6
6
  fetchRecommendationProductsByUrl: (url: string) => Promise<RecommendationProduct[]>;
7
7
  fetchRecommendationStrategies: () => Promise<RrsStrategy[]>;
8
8
  generateStrategyEndpoint: (strategy: RrsStrategy, currency: string) => Promise<RrsEndpointGenerateResponse | null>;
9
- migrateLegacyStrategy: (payload: RrsMigrationPayload) => Promise<string>;
9
+ migrateLegacyStrategy: (payload: RrsMigrationPayload, target?: RrsMigrationTarget) => Promise<string>;
10
10
  };
@@ -17,6 +17,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
17
17
  userId: string;
18
18
  variationId?: string | undefined;
19
19
  campaignId?: string | undefined;
20
+ templateLibraryId?: string | undefined;
20
21
  };
21
22
  partner: {
22
23
  name: string;
@@ -159,6 +160,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
159
160
  userId: string;
160
161
  variationId?: string | undefined;
161
162
  campaignId?: string | undefined;
163
+ templateLibraryId?: string | undefined;
162
164
  };
163
165
  partner: {
164
166
  name: string;
@@ -301,6 +303,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
301
303
  userId: string;
302
304
  variationId?: string | undefined;
303
305
  campaignId?: string | undefined;
306
+ templateLibraryId?: string | undefined;
304
307
  };
305
308
  partner: {
306
309
  name: string;
@@ -443,6 +446,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
443
446
  userId: string;
444
447
  variationId?: string | undefined;
445
448
  campaignId?: string | undefined;
449
+ templateLibraryId?: string | undefined;
446
450
  };
447
451
  partner: {
448
452
  name: string;
@@ -585,6 +589,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
585
589
  userId: string;
586
590
  variationId?: string | undefined;
587
591
  campaignId?: string | undefined;
592
+ templateLibraryId?: string | undefined;
588
593
  };
589
594
  partner: {
590
595
  name: string;
@@ -727,6 +732,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
727
732
  userId: string;
728
733
  variationId?: string | undefined;
729
734
  campaignId?: string | undefined;
735
+ templateLibraryId?: string | undefined;
730
736
  };
731
737
  partner: {
732
738
  name: string;
@@ -869,6 +875,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
869
875
  userId: string;
870
876
  variationId?: string | undefined;
871
877
  campaignId?: string | undefined;
878
+ templateLibraryId?: string | undefined;
872
879
  };
873
880
  partner: {
874
881
  name: string;
@@ -1011,6 +1018,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1011
1018
  userId: string;
1012
1019
  variationId?: string | undefined;
1013
1020
  campaignId?: string | undefined;
1021
+ templateLibraryId?: string | undefined;
1014
1022
  };
1015
1023
  partner: {
1016
1024
  name: string;
@@ -1153,6 +1161,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1153
1161
  userId: string;
1154
1162
  variationId?: string | undefined;
1155
1163
  campaignId?: string | undefined;
1164
+ templateLibraryId?: string | undefined;
1156
1165
  };
1157
1166
  partner: {
1158
1167
  name: string;
@@ -1295,6 +1304,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1295
1304
  userId: string;
1296
1305
  variationId?: string | undefined;
1297
1306
  campaignId?: string | undefined;
1307
+ templateLibraryId?: string | undefined;
1298
1308
  };
1299
1309
  partner: {
1300
1310
  name: string;
@@ -1437,6 +1447,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1437
1447
  userId: string;
1438
1448
  variationId?: string | undefined;
1439
1449
  campaignId?: string | undefined;
1450
+ templateLibraryId?: string | undefined;
1440
1451
  };
1441
1452
  partner: {
1442
1453
  name: string;
@@ -1579,6 +1590,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1579
1590
  userId: string;
1580
1591
  variationId?: string | undefined;
1581
1592
  campaignId?: string | undefined;
1593
+ templateLibraryId?: string | undefined;
1582
1594
  };
1583
1595
  partner: {
1584
1596
  name: string;
@@ -1721,6 +1733,150 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1721
1733
  userId: string;
1722
1734
  variationId?: string | undefined;
1723
1735
  campaignId?: string | undefined;
1736
+ templateLibraryId?: string | undefined;
1737
+ };
1738
+ partner: {
1739
+ name: string;
1740
+ productType: 60 | 49 | 97;
1741
+ messageType: 1 | 2;
1742
+ username: string;
1743
+ fallbackFont?: {
1744
+ name: string;
1745
+ family: string;
1746
+ } | undefined;
1747
+ };
1748
+ template: {
1749
+ html: string;
1750
+ css: string;
1751
+ preselectedDynamicContent: {
1752
+ text: string;
1753
+ value: string;
1754
+ fallback?: string | undefined;
1755
+ format?: {
1756
+ key: string;
1757
+ value: string;
1758
+ } | undefined;
1759
+ }[];
1760
+ dynamicContentList: {
1761
+ [x: string]: import("../library").DynamicContentNode[];
1762
+ };
1763
+ customFieldAttributes: string[];
1764
+ selectedUnsubscribePages: number[];
1765
+ forceRecreate: boolean;
1766
+ trackIdCounter: number;
1767
+ migration: {
1768
+ recommendationConfigs: {
1769
+ [x: string]: {
1770
+ id?: number | undefined;
1771
+ decimalCount?: string | number | undefined;
1772
+ productIds?: unknown[] | undefined;
1773
+ sendProductRequestFlag?: boolean | undefined;
1774
+ shuffleProducts?: boolean | undefined;
1775
+ filters?: unknown[] | undefined;
1776
+ currency?: string | undefined;
1777
+ currencySettings?: unknown;
1778
+ language?: string | undefined;
1779
+ strategy?: string | undefined;
1780
+ recommendedProducts?: unknown[] | undefined;
1781
+ cardsInRow?: number | undefined;
1782
+ mobileRightPadding?: number | undefined;
1783
+ mobileLeftPadding?: number | undefined;
1784
+ unresponsive?: boolean | undefined;
1785
+ orientation?: string | undefined;
1786
+ textTrimming?: boolean | undefined;
1787
+ blockType?: string | undefined;
1788
+ size?: string | number | undefined;
1789
+ verticalResponsiveness?: boolean | undefined;
1790
+ isPriceMovedToNextLine?: boolean | undefined;
1791
+ isPriceDeletedForZeroSale?: boolean | undefined;
1792
+ } & {
1793
+ [key: string]: unknown;
1794
+ };
1795
+ };
1796
+ };
1797
+ };
1798
+ editor: {
1799
+ locale: string;
1800
+ translationsPath: string;
1801
+ migrationDate: number;
1802
+ emailHeader: {
1803
+ senderName: string;
1804
+ subject: string;
1805
+ };
1806
+ savedModulesFolderName: string;
1807
+ defaultModulesFolderName: string;
1808
+ };
1809
+ ui: {
1810
+ showHeader: boolean;
1811
+ backButtonLabel?: string | undefined;
1812
+ };
1813
+ features: {
1814
+ dynamicContent: boolean;
1815
+ saveAsTemplate: boolean;
1816
+ versionHistory: boolean;
1817
+ testMessage: boolean;
1818
+ displayConditions: boolean;
1819
+ unsubscribe: boolean;
1820
+ modulesDisabled: boolean;
1821
+ liquidSyntax: boolean;
1822
+ autosave: boolean;
1823
+ allowlistEnabled: boolean;
1824
+ linkTrackingIds: boolean;
1825
+ reusableRecommendationStrategy: boolean;
1826
+ };
1827
+ blocks: {
1828
+ excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
1829
+ includeCustoms: ("dynamic-content" | "checkbox-block" | "radio-button-block" | "recommendation-block" | "unsubscribe-block" | "coupon-block" | "items-block")[];
1830
+ };
1831
+ compiler: {
1832
+ customRules: ({
1833
+ type: "replace";
1834
+ search: string;
1835
+ replacement: string;
1836
+ replaceAll?: boolean | undefined;
1837
+ id: string;
1838
+ description?: string | undefined;
1839
+ priority: number;
1840
+ } | {
1841
+ type: "regex";
1842
+ pattern: string;
1843
+ replacement: string;
1844
+ flags?: string | undefined;
1845
+ id: string;
1846
+ description?: string | undefined;
1847
+ priority: number;
1848
+ } | {
1849
+ type: "remove";
1850
+ targets: string[];
1851
+ id: string;
1852
+ description?: string | undefined;
1853
+ priority: number;
1854
+ } | {
1855
+ type: "custom";
1856
+ processor: (html: string) => string;
1857
+ id: string;
1858
+ description?: string | undefined;
1859
+ priority: number;
1860
+ })[];
1861
+ ignoreDefaultRules: boolean;
1862
+ };
1863
+ callbacks: {
1864
+ externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
1865
+ };
1866
+ } | null;
1867
+ } & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => string;
1868
+ /**
1869
+ * Get the template-library ID of the host template
1870
+ */
1871
+ templateLibraryId: (state: {
1872
+ initialized: boolean;
1873
+ config: {
1874
+ identity: {
1875
+ templateId: string;
1876
+ userId: string;
1877
+ variationId?: string | undefined;
1878
+ campaignId?: string | undefined;
1879
+ templateLibraryId?: string | undefined;
1724
1880
  };
1725
1881
  partner: {
1726
1882
  name: string;
@@ -1863,6 +2019,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1863
2019
  userId: string;
1864
2020
  variationId?: string | undefined;
1865
2021
  campaignId?: string | undefined;
2022
+ templateLibraryId?: string | undefined;
1866
2023
  };
1867
2024
  partner: {
1868
2025
  name: string;
@@ -2005,6 +2162,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2005
2162
  userId: string;
2006
2163
  variationId?: string | undefined;
2007
2164
  campaignId?: string | undefined;
2165
+ templateLibraryId?: string | undefined;
2008
2166
  };
2009
2167
  partner: {
2010
2168
  name: string;
@@ -2147,6 +2305,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2147
2305
  userId: string;
2148
2306
  variationId?: string | undefined;
2149
2307
  campaignId?: string | undefined;
2308
+ templateLibraryId?: string | undefined;
2150
2309
  };
2151
2310
  partner: {
2152
2311
  name: string;
@@ -2289,6 +2448,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2289
2448
  userId: string;
2290
2449
  variationId?: string | undefined;
2291
2450
  campaignId?: string | undefined;
2451
+ templateLibraryId?: string | undefined;
2292
2452
  };
2293
2453
  partner: {
2294
2454
  name: string;
@@ -2431,6 +2591,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2431
2591
  userId: string;
2432
2592
  variationId?: string | undefined;
2433
2593
  campaignId?: string | undefined;
2594
+ templateLibraryId?: string | undefined;
2434
2595
  };
2435
2596
  partner: {
2436
2597
  name: string;
@@ -2575,6 +2736,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2575
2736
  userId: string;
2576
2737
  variationId?: string | undefined;
2577
2738
  campaignId?: string | undefined;
2739
+ templateLibraryId?: string | undefined;
2578
2740
  };
2579
2741
  partner: {
2580
2742
  name: string;
@@ -75,64 +75,71 @@ const s = a("guido-config", {
75
75
  * Get the template ID
76
76
  */
77
77
  templateId: (e) => {
78
- var i, n;
79
- return ((n = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : n.templateId) ?? "";
78
+ var i, t;
79
+ return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.templateId) ?? "";
80
80
  },
81
81
  /**
82
82
  * Get the user ID
83
83
  */
84
84
  userId: (e) => {
85
- var i, n;
86
- return ((n = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : n.userId) ?? "";
85
+ var i, t;
86
+ return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.userId) ?? "";
87
87
  },
88
88
  /**
89
89
  * Get the variation ID
90
90
  */
91
91
  variationId: (e) => {
92
- var i, n;
93
- return ((n = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : n.variationId) ?? "";
92
+ var i, t;
93
+ return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.variationId) ?? "";
94
94
  },
95
95
  /**
96
96
  * Get the campaign ID
97
97
  */
98
98
  campaignId: (e) => {
99
- var i, n;
100
- return ((n = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : n.campaignId) ?? "";
99
+ var i, t;
100
+ return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.campaignId) ?? "";
101
+ },
102
+ /**
103
+ * Get the template-library ID of the host template
104
+ */
105
+ templateLibraryId: (e) => {
106
+ var i, t;
107
+ return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.templateLibraryId) ?? "";
101
108
  },
102
109
  /**
103
110
  * Get the partner name
104
111
  */
105
112
  partnerName: (e) => {
106
- var i, n;
107
- return ((n = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : n.name) ?? "";
113
+ var i, t;
114
+ return ((t = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : t.name) ?? "";
108
115
  },
109
116
  /**
110
117
  * Get the product type
111
118
  */
112
119
  productType: (e) => {
113
- var i, n;
114
- return ((n = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : n.productType) ?? 60;
120
+ var i, t;
121
+ return ((t = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : t.productType) ?? 60;
115
122
  },
116
123
  /**
117
124
  * Get the message type
118
125
  */
119
126
  messageType: (e) => {
120
- var i, n;
121
- return ((n = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : n.messageType) ?? 1;
127
+ var i, t;
128
+ return ((t = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : t.messageType) ?? 1;
122
129
  },
123
130
  /**
124
131
  * Get the username
125
132
  */
126
133
  username: (e) => {
127
- var i, n;
128
- return ((n = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : n.username) ?? "Guido User";
134
+ var i, t;
135
+ return ((t = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : t.username) ?? "Guido User";
129
136
  },
130
137
  /**
131
138
  * Check if header should be shown
132
139
  */
133
140
  showHeader: (e) => {
134
- var i, n;
135
- return ((n = (i = e.config) == null ? void 0 : i.ui) == null ? void 0 : n.showHeader) ?? !0;
141
+ var i, t;
142
+ return ((t = (i = e.config) == null ? void 0 : i.ui) == null ? void 0 : t.showHeader) ?? !0;
136
143
  },
137
144
  /**
138
145
  * Check if a specific feature is enabled.
@@ -141,8 +148,8 @@ const s = a("guido-config", {
141
148
  */
142
149
  // eslint-disable-next-line @stylistic/max-len
143
150
  isFeatureEnabled: (e) => (i) => {
144
- var n, t;
145
- return ((t = (n = e.config) == null ? void 0 : n.features) == null ? void 0 : t[i]) ?? !1;
151
+ var t, n;
152
+ return ((n = (t = e.config) == null ? void 0 : t.features) == null ? void 0 : n[i]) ?? !1;
146
153
  }
147
154
  },
148
155
  actions: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.18.1-beta.c5d7fb4",
3
+ "version": "3.18.1-beta.cb31236",
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",