@useinsider/guido 3.5.1-beta.62862ff → 3.5.1-beta.8631873

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
- import { ModuleFolderDefaults as p } from "../../enums/defaults.js";
2
- import { object as o, number as n, optional as e, string as t, picklist as l, pipe as S, minLength as f, nullish as k, custom as h, boolean as a, array as c, record as y, literal as i, looseObject as g, variant as R, union as b, unknown as s } from "../../node_modules/valibot/dist/index.js";
1
+ import { ModuleFolderDefaults as S } from "../../enums/defaults.js";
2
+ import { object as o, number as n, optional as e, string as t, picklist as l, pipe as p, minLength as b, custom as h, boolean as a, array as c, record as k, literal as i, looseObject as y, variant as g, union as f, unknown as s } from "../../node_modules/valibot/dist/index.js";
3
3
  const d = {
4
4
  /** Promotional/marketing emails */
5
5
  PROMOTIONAL: 1,
@@ -12,33 +12,29 @@ const d = {
12
12
  ARCHITECT: 49,
13
13
  /** Unsubscribe page builder */
14
14
  UNSUBSCRIBE_PAGES: 97
15
- }, C = o({
16
- /**
17
- * Unique identifier for the template being edited.
18
- *
19
- * Optional: a brand-new newsletter being designed has no saved template yet,
20
- * so hosts may pass `null`/`undefined`. Normalizes to `''` to match the
21
- * library's own internal handling (config getter, state bridge, editor stores
22
- * all default templateId to `''`).
23
- */
24
- templateId: k(t(), ""),
15
+ }, R = o({
16
+ /** Unique identifier for the template being edited */
17
+ templateId: p(
18
+ t(),
19
+ b(1, "templateId is required")
20
+ ),
25
21
  /** Unique identifier for the user editing the template */
26
- userId: S(
22
+ userId: p(
27
23
  t(),
28
- f(1, "userId is required")
24
+ b(1, "userId is required")
29
25
  ),
30
26
  /** Optional variation ID for A/B testing */
31
27
  variationId: e(t())
32
- }), T = o({
28
+ }), C = o({
33
29
  /** Fallback font name (e.g., "Georgia") */
34
30
  name: t(),
35
31
  /** Fallback font family (e.g., "serif" or "sans-serif") */
36
32
  family: t()
37
- }), A = o({
33
+ }), T = o({
38
34
  /** Partner/organization name (required) */
39
- name: S(
35
+ name: p(
40
36
  t(),
41
- f(1, "partner.name is required")
37
+ b(1, "partner.name is required")
42
38
  ),
43
39
  /** Product type identifier */
44
40
  productType: e(
@@ -57,8 +53,8 @@ const d = {
57
53
  /** Display name for the current user */
58
54
  username: e(t(), "Guido User"),
59
55
  /** Fallback font settings from partner settings — used to match backend size calculation */
60
- fallbackFont: e(T)
61
- }), I = o({
56
+ fallbackFont: e(C)
57
+ }), A = o({
62
58
  /** Display text for the dynamic content */
63
59
  text: t(),
64
60
  /** Template variable value (e.g., {{username}}) */
@@ -72,11 +68,11 @@ const d = {
72
68
  value: t()
73
69
  })
74
70
  )
75
- }), E = g({
71
+ }), I = y({
76
72
  /** Block ID (matches the dictionary key and the legacy HTML element id) */
77
73
  id: e(n()),
78
74
  /** Decimal places for price display (legacy data may use string or number) */
79
- decimalCount: e(b([t(), n()])),
75
+ decimalCount: e(f([t(), n()])),
80
76
  /** Pinned product IDs (empty array when filter-driven) */
81
77
  productIds: e(c(s())),
82
78
  /** Whether the block requested live products at send time */
@@ -110,10 +106,10 @@ const d = {
110
106
  /** Block type marker used by some legacy variants */
111
107
  blockType: e(t()),
112
108
  /** Size variant marker (legacy data may use string or number) */
113
- size: e(b([t(), n()])),
109
+ size: e(f([t(), n()])),
114
110
  /** Vertical responsiveness flag (legacy size=1 variants) */
115
111
  verticalResponsiveness: e(a())
116
- }), L = o({
112
+ }), E = o({
117
113
  /**
118
114
  * Legacy recommendation block configs keyed by block ID.
119
115
  * Pass this when loading a template authored with the v1
@@ -121,17 +117,17 @@ const d = {
121
117
  * strategy, currency, locale, and layout data.
122
118
  */
123
119
  recommendationConfigs: e(
124
- y(t(), E),
120
+ k(t(), I),
125
121
  {}
126
122
  )
127
- }), O = o({
123
+ }), L = o({
128
124
  /** Initial HTML content */
129
125
  html: e(t(), ""),
130
126
  /** Initial CSS content */
131
127
  css: e(t(), ""),
132
128
  /** Preselected dynamic content items */
133
129
  preselectedDynamicContent: e(
134
- c(I),
130
+ c(A),
135
131
  []
136
132
  ),
137
133
  /** Valid custom field attribute names from the partner's categorized fields */
@@ -141,13 +137,13 @@ const d = {
141
137
  /** Force recreate template in Stripo storage (use true when updating externally modified templates) */
142
138
  forceRecreate: e(a(), !1),
143
139
  /** Migration-only inputs (legacy block configs) */
144
- migration: e(L, {})
145
- }), v = o({
140
+ migration: e(E, {})
141
+ }), O = o({
146
142
  /** Sender display name */
147
143
  senderName: e(t(), ""),
148
144
  /** Email subject line */
149
145
  subject: e(t(), "")
150
- }), M = o({
146
+ }), v = o({
151
147
  /** Locale for the editor UI */
152
148
  locale: e(t(), "en"),
153
149
  /** Path to translations object */
@@ -155,17 +151,17 @@ const d = {
155
151
  /** Migration date for template compatibility */
156
152
  migrationDate: e(n(), 1759696858),
157
153
  /** Email header settings */
158
- emailHeader: e(v, { senderName: "", subject: "" }),
154
+ emailHeader: e(O, { senderName: "", subject: "" }),
159
155
  /** Folder name for user-saved modules (used by Stripo plugin panel for path construction) */
160
- savedModulesFolderName: e(t(), p.SAVED_MODULES),
156
+ savedModulesFolderName: e(t(), S.SAVED_MODULES),
161
157
  /** Folder name for default/prebuilt modules (used by Stripo plugin panel for path construction) */
162
- defaultModulesFolderName: e(t(), p.DEFAULT_MODULES)
163
- }), P = o({
158
+ defaultModulesFolderName: e(t(), S.DEFAULT_MODULES)
159
+ }), M = o({
164
160
  /** Whether to show the header bar */
165
161
  showHeader: e(a(), !0),
166
162
  /** Custom label for back button (if shown) */
167
163
  backButtonLabel: e(t())
168
- }), N = o({
164
+ }), P = o({
169
165
  /** Enable dynamic content insertion */
170
166
  dynamicContent: e(a(), !0),
171
167
  /** Enable save as template functionality */
@@ -184,7 +180,7 @@ const d = {
184
180
  liquidSyntax: e(a(), !1),
185
181
  /** Enable autosave (3-min interval + tab-hide). User toggles on/off from the header. */
186
182
  autosave: e(a(), !1)
187
- }), D = l([
183
+ }), N = l([
188
184
  "amp-accordion",
189
185
  "amp-carousel",
190
186
  "amp-form-controls",
@@ -198,7 +194,7 @@ const d = {
198
194
  "text-block",
199
195
  "timer-block",
200
196
  "video-block"
201
- ]), x = l([
197
+ ]), D = l([
202
198
  "dynamic-content",
203
199
  "checkbox-block",
204
200
  "radio-button-block",
@@ -206,15 +202,15 @@ const d = {
206
202
  "unsubscribe-block",
207
203
  "coupon-block",
208
204
  "items-block"
209
- ]), F = o({
205
+ ]), x = o({
210
206
  /** Default blocks to exclude from the editor */
211
207
  excludeDefaults: e(
212
- c(D),
208
+ c(N),
213
209
  []
214
210
  ),
215
211
  /** Custom blocks to include in the editor */
216
212
  includeCustoms: e(
217
- c(x),
213
+ c(D),
218
214
  []
219
215
  )
220
216
  }), m = o({
@@ -224,7 +220,7 @@ const d = {
224
220
  description: e(t()),
225
221
  /** Priority for rule ordering (lower = earlier) */
226
222
  priority: n()
227
- }), U = o({
223
+ }), F = o({
228
224
  ...m.entries,
229
225
  type: i("replace"),
230
226
  /** String to search for */
@@ -233,7 +229,7 @@ const d = {
233
229
  replacement: t(),
234
230
  /** Replace all occurrences (default: false) */
235
231
  replaceAll: e(a())
236
- }), B = o({
232
+ }), U = o({
237
233
  ...m.entries,
238
234
  type: i("regex"),
239
235
  /** Regex pattern string */
@@ -242,12 +238,12 @@ const d = {
242
238
  replacement: t(),
243
239
  /** Regex flags (e.g., 'gi') */
244
240
  flags: e(t())
245
- }), w = o({
241
+ }), B = o({
246
242
  ...m.entries,
247
243
  type: i("remove"),
248
244
  /** Strings or patterns to remove */
249
245
  targets: c(t())
250
- }), H = o({
246
+ }), w = o({
251
247
  ...m.entries,
252
248
  type: i("custom"),
253
249
  /** Custom processor function */
@@ -255,17 +251,17 @@ const d = {
255
251
  (u) => typeof u == "function",
256
252
  "processor must be a function"
257
253
  )
258
- }), j = R("type", [
254
+ }), H = g("type", [
255
+ F,
259
256
  U,
260
257
  B,
261
- w,
262
- H
263
- ]), q = o({
258
+ w
259
+ ]), j = o({
264
260
  /** Custom compiler rules to apply */
265
- customRules: e(c(j), []),
261
+ customRules: e(c(H), []),
266
262
  /** Skip default compiler rules */
267
263
  ignoreDefaultRules: e(a(), !1)
268
- }), G = o({
264
+ }), q = o({
269
265
  /**
270
266
  * External validation handler called before save completes.
271
267
  * Return false to cancel the save operation.
@@ -276,51 +272,51 @@ const d = {
276
272
  "externalValidation must be a function"
277
273
  )
278
274
  )
279
- }), z = o({
275
+ }), V = o({
280
276
  // Required sections
281
277
  /** Identity configuration (required) */
282
- identity: C,
278
+ identity: R,
283
279
  /** Partner configuration (required) */
284
- partner: A,
280
+ partner: T,
285
281
  // Optional sections (with defaults)
286
282
  /** Template content and presets */
287
- template: e(O, {}),
283
+ template: e(L, {}),
288
284
  /** Editor settings */
289
- editor: e(M, {}),
285
+ editor: e(v, {}),
290
286
  /** UI configuration */
291
- ui: e(P, {}),
287
+ ui: e(M, {}),
292
288
  /** Feature toggles */
293
- features: e(N, {}),
289
+ features: e(P, {}),
294
290
  /** Block configuration */
295
- blocks: e(F, {}),
291
+ blocks: e(x, {}),
296
292
  /** Compiler configuration */
297
- compiler: e(q, {}),
293
+ compiler: e(j, {}),
298
294
  /** Callbacks and event handlers */
299
- callbacks: e(G, {})
295
+ callbacks: e(q, {})
300
296
  });
301
297
  export {
302
- F as BlocksSchema,
303
- G as CallbacksSchema,
304
- j as CompilerRuleSchema,
305
- q as CompilerSchema,
306
- x as CustomBlockTypeSchema,
307
- H as CustomRuleSchema,
308
- D as DefaultBlockTypeSchema,
309
- I as DynamicContentSchema,
310
- M as EditorSchema,
311
- v as EmailHeaderSchema,
312
- T as FallbackFontSchema,
313
- N as FeaturesSchema,
314
- z as GuidoConfigSchema,
315
- C as IdentitySchema,
316
- E as LegacyRecommendationConfigSchema,
298
+ x as BlocksSchema,
299
+ q as CallbacksSchema,
300
+ H as CompilerRuleSchema,
301
+ j as CompilerSchema,
302
+ D as CustomBlockTypeSchema,
303
+ w as CustomRuleSchema,
304
+ N as DefaultBlockTypeSchema,
305
+ A as DynamicContentSchema,
306
+ v as EditorSchema,
307
+ O as EmailHeaderSchema,
308
+ C as FallbackFontSchema,
309
+ P as FeaturesSchema,
310
+ V as GuidoConfigSchema,
311
+ R as IdentitySchema,
312
+ I as LegacyRecommendationConfigSchema,
317
313
  d as MessageType,
318
- A as PartnerSchema,
314
+ T as PartnerSchema,
319
315
  r as ProductType,
320
- B as RegexRuleSchema,
321
- w as RemoveRuleSchema,
322
- U as ReplaceRuleSchema,
323
- L as TemplateMigrationSchema,
324
- O as TemplateSchema,
325
- P as UISchema
316
+ U as RegexRuleSchema,
317
+ B as RemoveRuleSchema,
318
+ F as ReplaceRuleSchema,
319
+ E as TemplateMigrationSchema,
320
+ L as TemplateSchema,
321
+ M as UISchema
326
322
  };
@@ -1,31 +1,31 @@
1
- var f = Object.defineProperty;
2
- var p = (d, l, t) => l in d ? f(d, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[l] = t;
3
- var s = (d, l, t) => p(d, typeof l != "symbol" ? l + "" : l, t);
1
+ var C = Object.defineProperty;
2
+ var p = (d, c, t) => c in d ? C(d, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[c] = t;
3
+ var s = (d, c, t) => p(d, typeof c != "symbol" ? c + "" : c, t);
4
4
  import { CommonControl as g } from "../../../common-control.js";
5
5
  import { DEFAULT_NODE_CONFIG as a } from "../../constants/defaultConfig.js";
6
6
  import { RecommendationConfigService as h } from "../../services/configService.js";
7
7
  import { useRecommendationExtensionStore as y } from "../../store/recommendation.js";
8
- import { AlgorithmControl as R } from "./algorithm.js";
9
- import { ALGORITHM_CONTROL_ID as J } from "./algorithm.js";
10
- import { CurrencyControl as N } from "./currency.js";
11
- import { CURRENCY_CONTROL_ID as X } from "./currency.js";
8
+ import { AlgorithmControl as N } from "./algorithm.js";
9
+ import { ALGORITHM_CONTROL_ID as Q } from "./algorithm.js";
10
+ import { CurrencyControl as R } from "./currency.js";
11
+ import { CURRENCY_CONTROL_ID as Z } from "./currency.js";
12
12
  import { FiltersControl as _ } from "./filters.js";
13
- import { FILTERS_CONTROL_ID as tt } from "./filters.js";
13
+ import { FILTERS_CONTROL_ID as et } from "./filters.js";
14
14
  import { LayoutOrientationControl as b } from "./layoutOrientation.js";
15
- import { LAYOUT_ORIENTATION_CONTROL_ID as ot } from "./layoutOrientation.js";
15
+ import { LAYOUT_ORIENTATION_CONTROL_ID as rt } from "./layoutOrientation.js";
16
16
  import { LocaleControl as O } from "./locale.js";
17
- import { LOCALE_CONTROL_ID as nt } from "./locale.js";
17
+ import { LOCALE_CONTROL_ID as it } from "./locale.js";
18
18
  import { ProductCountControl as I } from "./productCount.js";
19
- import { PRODUCT_COUNT_CONTROL_ID as st } from "./productCount.js";
19
+ import { PRODUCT_COUNT_CONTROL_ID as at } from "./productCount.js";
20
20
  import { ProductLayoutControl as T } from "./productLayout.js";
21
21
  import { PRODUCT_LAYOUT_CONTROL_ID as lt } from "./productLayout.js";
22
22
  import { ShuffleControl as S } from "./shuffle.js";
23
- import { SHUFFLE_CONTROL_ID as ut } from "./shuffle.js";
24
- import { getBlockElement as L, updateProductContentInPlace as P, regenerateProductRowsWithStyles as D } from "./utils.js";
25
- import { adjustProductsToSize as ht, formatProductPrice as mt, getCardComposition as Ct, getCurrentLayout as ft, reapplySpacing as pt, regenerateMobileProductRows as gt, regenerateProductRows as yt, setCurrencyAttributes as Rt, updatePricesInPlace as Nt, updateSingleProductContent as _t } from "./utils.js";
23
+ import { SHUFFLE_CONTROL_ID as dt } from "./shuffle.js";
24
+ import { setCurrencyAttributes as L, getBlockElement as P, updateProductContentInPlace as D, regenerateProductRowsWithStyles as k } from "./utils.js";
25
+ import { adjustProductsToSize as mt, formatProductPrice as ft, getCardComposition as Ct, getCurrentLayout as pt, reapplySpacing as gt, regenerateMobileProductRows as yt, regenerateProductRows as Nt, updatePricesInPlace as Rt, updateSingleProductContent as _t } from "./utils.js";
26
26
  import { useDebounceFn as m } from "../../../../../node_modules/@vueuse/shared/index.js";
27
- const k = "recommendation-id", E = "ui-elements-recommendation-block";
28
- class H extends g {
27
+ const E = "recommendation-id", v = "ui-elements-recommendation-block";
28
+ class K extends g {
29
29
  constructor() {
30
30
  super(...arguments);
31
31
  s(this, "store", y());
@@ -62,11 +62,11 @@ class H extends g {
62
62
  if (!this.currentNode || !this.api)
63
63
  return;
64
64
  const e = this.api.getDocumentModifier();
65
- P({
65
+ D({
66
66
  currentNode: this.currentNode,
67
67
  documentModifier: e,
68
68
  products: t
69
- }) || D({
69
+ }) || k({
70
70
  currentNode: this.currentNode,
71
71
  documentModifier: e,
72
72
  products: t
@@ -74,10 +74,10 @@ class H extends g {
74
74
  }, 100));
75
75
  }
76
76
  getId() {
77
- return E;
77
+ return v;
78
78
  }
79
79
  getTemplate() {
80
- return this.algorithmControl = new R(), this.localeControl = new O(), this.currencyControl = new N(), this.productCountControl = new I(), this.productLayoutControl = new T(), this.filtersControl = new _(), this.shuffleControl = new S(), this.layoutOrientationControl = new b(), [
80
+ return this.algorithmControl = new N(), this.localeControl = new O(), this.currencyControl = new R(), this.productCountControl = new I(), this.productLayoutControl = new T(), this.filtersControl = new _(), this.shuffleControl = new S(), this.layoutOrientationControl = new b(), [
81
81
  this.algorithmControl,
82
82
  this.localeControl,
83
83
  this.currencyControl,
@@ -263,7 +263,11 @@ class H extends g {
263
263
  this.currentNode,
264
264
  e,
265
265
  "Applied smart defaults"
266
- ), this.store.patchCurrentBlockConfig({
266
+ ), o && e.currency && L({
267
+ currentNode: this.currentNode,
268
+ documentModifier: this.api.getDocumentModifier(),
269
+ currency: e.currency
270
+ }), this.store.patchCurrentBlockConfig({
267
271
  ...o ? {
268
272
  currencySettings: {
269
273
  name: o,
@@ -283,10 +287,10 @@ class H extends g {
283
287
  * Reads the recommendation-id attribute from the block element within the node
284
288
  */
285
289
  _getRecommendationIdFromNode(t) {
286
- const e = L(t);
290
+ const e = P(t);
287
291
  if (!e || !("getAttribute" in e))
288
292
  return null;
289
- const o = e.getAttribute(k);
293
+ const o = e.getAttribute(E);
290
294
  if (!o)
291
295
  return null;
292
296
  const r = parseInt(o);
@@ -316,8 +320,8 @@ class H extends g {
316
320
  }
317
321
  const i = t.$state.configVersion;
318
322
  i !== o && (o = i, this._persistFiltersToNodeConfig(), this._debouncedFetchProducts());
319
- const c = t.recommendationProducts, u = c !== e, C = Array.isArray(c) && c.length > 0;
320
- u && C && (e = c, this._debouncedRegenerateWithProducts());
323
+ const l = t.recommendationProducts, u = l !== e, f = Array.isArray(l) && l.length > 0;
324
+ u && f && (e = l, this._debouncedRegenerateWithProducts());
321
325
  });
322
326
  }
323
327
  /**
@@ -337,35 +341,35 @@ class H extends g {
337
341
  }
338
342
  }
339
343
  export {
340
- J as ALGORITHM_CONTROL_ID,
341
- R as AlgorithmControl,
342
- E as CONTROL_BLOCK_ID,
343
- X as CURRENCY_CONTROL_ID,
344
- N as CurrencyControl,
345
- tt as FILTERS_CONTROL_ID,
344
+ Q as ALGORITHM_CONTROL_ID,
345
+ N as AlgorithmControl,
346
+ v as CONTROL_BLOCK_ID,
347
+ Z as CURRENCY_CONTROL_ID,
348
+ R as CurrencyControl,
349
+ et as FILTERS_CONTROL_ID,
346
350
  _ as FiltersControl,
347
- ot as LAYOUT_ORIENTATION_CONTROL_ID,
348
- nt as LOCALE_CONTROL_ID,
351
+ rt as LAYOUT_ORIENTATION_CONTROL_ID,
352
+ it as LOCALE_CONTROL_ID,
349
353
  b as LayoutOrientationControl,
350
354
  O as LocaleControl,
351
- st as PRODUCT_COUNT_CONTROL_ID,
355
+ at as PRODUCT_COUNT_CONTROL_ID,
352
356
  lt as PRODUCT_LAYOUT_CONTROL_ID,
353
357
  I as ProductCountControl,
354
358
  T as ProductLayoutControl,
355
- H as RecommendationBlockControl,
356
- ut as SHUFFLE_CONTROL_ID,
359
+ K as RecommendationBlockControl,
360
+ dt as SHUFFLE_CONTROL_ID,
357
361
  S as ShuffleControl,
358
- ht as adjustProductsToSize,
359
- mt as formatProductPrice,
360
- L as getBlockElement,
362
+ mt as adjustProductsToSize,
363
+ ft as formatProductPrice,
364
+ P as getBlockElement,
361
365
  Ct as getCardComposition,
362
- ft as getCurrentLayout,
363
- pt as reapplySpacing,
364
- gt as regenerateMobileProductRows,
365
- yt as regenerateProductRows,
366
- D as regenerateProductRowsWithStyles,
367
- Rt as setCurrencyAttributes,
368
- Nt as updatePricesInPlace,
369
- P as updateProductContentInPlace,
366
+ pt as getCurrentLayout,
367
+ gt as reapplySpacing,
368
+ yt as regenerateMobileProductRows,
369
+ Nt as regenerateProductRows,
370
+ k as regenerateProductRowsWithStyles,
371
+ L as setCurrencyAttributes,
372
+ Rt as updatePricesInPlace,
373
+ D as updateProductContentInPlace,
370
374
  _t as updateSingleProductContent
371
375
  };
@@ -1,6 +1,6 @@
1
1
  import { ModificationDescription as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { RecommendationBlockId as m } from "../../constants/blockIds.js";
3
- import { MOBILE_CONTAINER_SELECTOR as q, MOBILE_ROW_SELECTOR as k, CURRENCY_ATTR as y, DESKTOP_CONTAINER_SELECTOR as P, CONTAINER_SELECTOR as v, ATTR_PRODUCT_ATTR as W } from "../../constants/selectors.js";
3
+ import { CURRENCY_ATTR as y, MOBILE_CONTAINER_SELECTOR as q, MOBILE_ROW_SELECTOR as k, DESKTOP_CONTAINER_SELECTOR as P, CONTAINER_SELECTOR as v, ATTR_PRODUCT_ATTR as W } from "../../constants/selectors.js";
4
4
  import { RecommendationConfigService as E } from "../../services/configService.js";
5
5
  import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
6
6
  import { prepareProductRows as _ } from "../../templates/index.js";