@useinsider/guido 3.30.0-beta.23d415d → 3.30.0-beta.25ed52c

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +35 -0
  2. package/dist/@types/config/schemas.js +42 -37
  3. package/dist/components/Guido.vue.js +8 -8
  4. package/dist/components/Guido.vue2.js +129 -115
  5. package/dist/components/organisms/dynamic-content/DynamicContentAooRuleConfig.vue.js +34 -0
  6. package/dist/components/organisms/dynamic-content/DynamicContentAooRuleConfig.vue2.js +76 -0
  7. package/dist/components/organisms/dynamic-content/DynamicContentCustomFormat.vue.js +21 -0
  8. package/dist/components/organisms/dynamic-content/DynamicContentCustomFormat.vue2.js +33 -0
  9. package/dist/components/organisms/dynamic-content/DynamicContentPicker.vue.js +42 -0
  10. package/dist/components/organisms/dynamic-content/DynamicContentPicker.vue2.js +216 -0
  11. package/dist/composables/useDynamicContentFormat.js +10 -0
  12. package/dist/composables/useDynamicContentPicker.js +36 -0
  13. package/dist/composables/useInfoBoxPosition.js +16 -0
  14. package/dist/config/migrator/itemsBlockMigrator.js +164 -161
  15. package/dist/enums/dynamic-content.js +180 -2
  16. package/dist/guido.css +1 -1
  17. package/dist/package.json.js +2 -2
  18. package/dist/src/@types/config/schemas.d.ts +12 -0
  19. package/dist/src/@types/generic.d.ts +1 -0
  20. package/dist/src/components/organisms/dynamic-content/DynamicContentAooRuleConfig.vue.d.ts +48 -0
  21. package/dist/src/components/organisms/dynamic-content/DynamicContentCustomFormat.vue.d.ts +44 -0
  22. package/dist/src/components/organisms/dynamic-content/DynamicContentPicker.vue.d.ts +67 -0
  23. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +1 -1
  24. package/dist/src/composables/useConfig.d.ts +4 -0
  25. package/dist/src/composables/useDynamicContentFormat.d.ts +5 -0
  26. package/dist/src/composables/useDynamicContentPicker.d.ts +35 -0
  27. package/dist/src/composables/useInfoBoxPosition.d.ts +24 -0
  28. package/dist/src/enums/dynamic-content.d.ts +21 -0
  29. package/dist/src/stores/config.d.ts +42 -0
  30. package/dist/src/utils/dynamicContentPicker.d.ts +43 -0
  31. package/dist/src/utils/genericUtil.d.ts +1 -1
  32. package/dist/utils/dynamicContentPicker.js +88 -0
  33. package/dist/utils/genericUtil.js +21 -21
  34. package/dist/utils/pairProductVariables.js +98 -108
  35. package/package.json +1 -1
package/README.md CHANGED
@@ -147,6 +147,7 @@ const config: GuidoConfigInput = {
147
147
  emailHeader?: {
148
148
  senderName?: string,
149
149
  subject?: string,
150
+ preheader?: string, // Default: '' - read by the dynamic content picker's array-of-objects lock
150
151
  },
151
152
  savedModulesFolderName?: string, // Default: 'savedModules' - folder name for user-saved modules
152
153
  defaultModulesFolderName?: string, // Default: 'defaultModules' - folder name for default/prebuilt modules
@@ -173,6 +174,7 @@ const config: GuidoConfigInput = {
173
174
  allowlistEnabled?: boolean, // Default: false - Pre-save domain-allowlist check (opt-in). Guido self-serves the block toaster (role lookup, deep-link, copy from window.trans).
174
175
  allowSaveWithErrors?: boolean, // Default: true - Allow the validation drawer's "Save and Continue" soft-save. Set false to hard-block invalid saves (transactional + unsubscribe pages).
175
176
  reusableRecommendationStrategy?: boolean, // Default: false - Assign an RRS strategy to recommendation blocks instead of per-block algorithm/filters/shuffle/product-count settings.
177
+ dynamicContentPicker?: boolean, // Default: false - Open Guido's own Text Block dynamic content picker (see "Dynamic content picker") instead of emitting `dynamic-content:open`
176
178
  dynamicContentSpecialLinks?: boolean, // Default: false - List the catalogue's URL attributes (token ends in `url` or `url_<n>`) and every Call an API variable as Stripo special links (Personalization tab of the link type selector)
177
179
  legacyUnsubscribeConversion?: boolean, // Default: false - Convert legacy unsubscribe blocks that have no unsubscribe link into text blocks (on load and on module drop/copy) and show a warning modal.
178
180
  accessibilityTesting?: boolean, // Default: false - Show the Accessibility Test entry in the header kebab menu (Stripo's checker: contrast, image alternatives, colour-vision simulation) and the tab-bar onboarding tour that points at it.
@@ -691,6 +693,39 @@ const closeModal = () => {
691
693
  </script>
692
694
  ```
693
695
 
696
+ ### Built-in picker (`features.dynamicContentPicker`)
697
+
698
+ With `features.dynamicContentPicker: true`, Guido opens its own picker instead of emitting
699
+ `dynamic-content:open`, and inserts or closes through the same path as `dynamicContent.insert` / `close`.
700
+ It reads `template.dynamicContentList` (first partner only) when it opens:
701
+
702
+ ```ts
703
+ template: {
704
+ dynamicContentList: {
705
+ [partnerName]: [
706
+ // Category: translated label + attribute leaves; `type` 'datetime' | 'number' enables the custom format
707
+ { text: 'Default Attributes', children: [{ text: 'Birthday', value: 'birthday', type: 'datetime' }] },
708
+ // Lookup binding: its `columns` are the `lk_` tokens; `bindingLabel` labels the column select
709
+ { text: 'Lookup', children: [{ text: 'Products (purchase)', value: 'binding-id', bindingLabel: 'Products',
710
+ columns: [{ text: 'Price', value: 'lk_products_price' }] }] },
711
+ // Array of Objects: category → array group → rule (`rules`, `filtersDescription`, `select_items` objects → leaf tokens)
712
+ { text: 'Array of Objects', value: 'array-of-objects', type: 'array_of_objects', children: [
713
+ { text: 'BestSellers', value: 'products', children: [
714
+ { text: 'Top 2 by price', value: 'array-of-objects-rule-3',
715
+ rules: { key: 'price', order: 'desc', limit: 2, operator: 'and' }, filtersDescription: [],
716
+ select_items: [{ text: 'Object 1', value: 'object_1',
717
+ children: [{ text: 'Price', value: 'BestSellers.products_1_price', type: 'number' }] }] },
718
+ ] },
719
+ ] },
720
+ ],
721
+ },
722
+ },
723
+ ```
724
+
725
+ Leave the AoO category out when the partner has AoO off. The one-rule-per-array lock scans
726
+ `editor.emailHeader.subject`, `editor.emailHeader.preheader` and the live editor html. Liquid date formats
727
+ follow `features.liquidSyntax`; the number format is hidden there.
728
+
694
729
  ### Special links in the link type selector
695
730
 
696
731
  Behind `features.dynamicContentSpecialLinks` (default `false`). Guido passes the `template.dynamicContentList`
@@ -1,5 +1,5 @@
1
1
  import { ModuleFolderDefaults as y } from "../../enums/defaults.js";
2
- import { object as o, number as c, optional as e, string as t, picklist as m, pipe as r, minLength as p, custom as h, boolean as a, array as n, transform as S, unknown as i, record as g, fallback as R, literal as u, lazy as T, looseObject as C, variant as I, union as k } from "../../node_modules/valibot/dist/index.js";
2
+ import { object as o, number as c, optional as e, string as t, picklist as u, pipe as r, minLength as f, custom as k, boolean as a, array as n, transform as S, unknown as i, record as g, fallback as R, literal as d, lazy as T, looseObject as C, variant as I, union as h } from "../../node_modules/valibot/dist/index.js";
3
3
  const b = {
4
4
  /** Promotional/marketing emails */
5
5
  PROMOTIONAL: 1,
@@ -16,12 +16,12 @@ const b = {
16
16
  /** Unique identifier for the template being edited */
17
17
  templateId: r(
18
18
  t(),
19
- p(1, "templateId is required")
19
+ f(1, "templateId is required")
20
20
  ),
21
21
  /** Unique identifier for the user editing the template */
22
22
  userId: r(
23
23
  t(),
24
- p(1, "userId is required")
24
+ f(1, "userId is required")
25
25
  ),
26
26
  /** Optional variation ID for A/B testing */
27
27
  variationId: e(t()),
@@ -38,15 +38,15 @@ const b = {
38
38
  name: t(),
39
39
  /** Fallback font family (e.g., "serif" or "sans-serif") */
40
40
  family: t()
41
- }), E = o({
41
+ }), P = o({
42
42
  /** Partner/organization name (required) */
43
43
  name: r(
44
44
  t(),
45
- p(1, "partner.name is required")
45
+ f(1, "partner.name is required")
46
46
  ),
47
47
  /** Product type identifier */
48
48
  productType: e(
49
- m([
49
+ u([
50
50
  l.EMAIL,
51
51
  l.ARCHITECT,
52
52
  l.UNSUBSCRIBE_PAGES
@@ -55,14 +55,14 @@ const b = {
55
55
  ),
56
56
  /** Message type (promotional or transactional) */
57
57
  messageType: e(
58
- m([b.PROMOTIONAL, b.TRANSACTIONAL]),
58
+ u([b.PROMOTIONAL, b.TRANSACTIONAL]),
59
59
  b.PROMOTIONAL
60
60
  ),
61
61
  /** Display name for the current user */
62
62
  username: e(t(), "Guido User"),
63
63
  /** Fallback font settings from partner settings — used to match backend size calculation */
64
64
  fallbackFont: e(L)
65
- }), M = o({
65
+ }), E = o({
66
66
  /** Display text for the dynamic content */
67
67
  text: t(),
68
68
  /** Template variable value (e.g., {{username}}) */
@@ -76,22 +76,23 @@ const b = {
76
76
  value: t()
77
77
  })
78
78
  )
79
- }), f = T(() => C({
79
+ }), m = T(() => C({
80
80
  text: e(t()),
81
81
  // eslint-disable-next-line camelcase -- backend field name
82
82
  tag_text: e(t()),
83
83
  value: e(t()),
84
- children: e(n(f)),
84
+ children: e(n(m)),
85
85
  // eslint-disable-next-line camelcase -- backend field name
86
- select_items: e(n(f))
87
- })), P = g(
86
+ select_items: e(n(m)),
87
+ columns: e(n(m))
88
+ })), M = g(
88
89
  t(),
89
- R(n(f), [])
90
+ R(n(m), [])
90
91
  ), v = C({
91
92
  /** Block ID (matches the dictionary key and the legacy HTML element id) */
92
93
  id: e(c()),
93
94
  /** Decimal places for price display (legacy data may use string or number) */
94
- decimalCount: e(k([t(), c()])),
95
+ decimalCount: e(h([t(), c()])),
95
96
  /** Pinned product IDs (empty array when filter-driven) */
96
97
  productIds: e(n(i())),
97
98
  /** Whether the block requested live products at send time */
@@ -125,7 +126,7 @@ const b = {
125
126
  /** Block type marker used by some legacy variants */
126
127
  blockType: e(t()),
127
128
  /** Size variant marker (legacy data may use string or number) */
128
- size: e(k([t(), c()])),
129
+ size: e(h([t(), c()])),
129
130
  /** Vertical responsiveness flag (legacy size=1 variants) */
130
131
  verticalResponsiveness: e(a()),
131
132
  /** Legacy "Move to next line" price placement toggle (cardPricePlacement.js) */
@@ -150,7 +151,7 @@ const b = {
150
151
  css: e(t(), ""),
151
152
  /** Preselected dynamic content items */
152
153
  preselectedDynamicContent: e(
153
- n(M),
154
+ n(E),
154
155
  []
155
156
  ),
156
157
  /**
@@ -159,7 +160,7 @@ const b = {
159
160
  * (first) partner's leaf attributes into the label→token map that repairs
160
161
  * label-form placeholders (`{{ Phone Number }}`) in dropped saved modules.
161
162
  */
162
- dynamicContentList: e(P, {}),
163
+ dynamicContentList: e(M, {}),
163
164
  /** Valid custom field attribute names from the partner's categorized fields */
164
165
  customFieldAttributes: e(n(t()), []),
165
166
  /** Selected unsubscribe page IDs */
@@ -199,7 +200,9 @@ const b = {
199
200
  /** Sender display name */
200
201
  senderName: e(t(), ""),
201
202
  /** Email subject line */
202
- subject: e(t(), "")
203
+ subject: e(t(), ""),
204
+ /** Email preheader text */
205
+ preheader: e(t(), "")
203
206
  }), O = o({
204
207
  /** Locale for the editor UI */
205
208
  locale: e(t(), "en"),
@@ -208,7 +211,7 @@ const b = {
208
211
  /** Migration date for template compatibility */
209
212
  migrationDate: e(c(), 1759696858),
210
213
  /** Email header settings */
211
- emailHeader: e(N, { senderName: "", subject: "" }),
214
+ emailHeader: e(N, { senderName: "", subject: "", preheader: "" }),
212
215
  /** Folder name for user-saved modules (used by Stripo plugin panel for path construction) */
213
216
  savedModulesFolderName: e(t(), y.SAVED_MODULES),
214
217
  /** Folder name for default/prebuilt modules (used by Stripo plugin panel for path construction) */
@@ -249,13 +252,15 @@ const b = {
249
252
  reusableRecommendationStrategy: e(a(), !1),
250
253
  /** List the dynamic-content catalogue as Stripo special links in the link type selector */
251
254
  dynamicContentSpecialLinks: e(a(), !1),
255
+ /** Open Guido's own Text Block dynamic content picker instead of emitting `dynamic-content:open` */
256
+ dynamicContentPicker: e(a(), !1),
252
257
  /** Convert linkless legacy unsubscribe blocks into text blocks and warn with a modal (opt-in) */
253
258
  legacyUnsubscribeConversion: e(a(), !1),
254
259
  /** Items block: Recommendation-style price formatting (root currency-* attrs, raw price tags). Released dark. */
255
260
  itemsPriceFormatting: e(a(), !1),
256
261
  /** Warn on save when the design carries an Insider unsubscribe link or code (host sets true for SFMC accounts) */
257
262
  blockUnsubscribeLinks: e(a(), !1)
258
- }), w = m([
263
+ }), w = u([
259
264
  "amp-accordion",
260
265
  "amp-carousel",
261
266
  "amp-form-controls",
@@ -269,7 +274,7 @@ const b = {
269
274
  "text-block",
270
275
  "timer-block",
271
276
  "video-block"
272
- ]), B = m([
277
+ ]), B = u([
273
278
  "dynamic-content",
274
279
  "checkbox-block",
275
280
  "radio-button-block",
@@ -288,7 +293,7 @@ const b = {
288
293
  n(B),
289
294
  []
290
295
  )
291
- }), d = o({
296
+ }), p = o({
292
297
  /** Unique identifier for the rule */
293
298
  id: t(),
294
299
  /** Human-readable description */
@@ -296,8 +301,8 @@ const b = {
296
301
  /** Priority for rule ordering (lower = earlier) */
297
302
  priority: c()
298
303
  }), H = o({
299
- ...d.entries,
300
- type: u("replace"),
304
+ ...p.entries,
305
+ type: d("replace"),
301
306
  /** String to search for */
302
307
  search: t(),
303
308
  /** Replacement string */
@@ -305,8 +310,8 @@ const b = {
305
310
  /** Replace all occurrences (default: false) */
306
311
  replaceAll: e(a())
307
312
  }), _ = o({
308
- ...d.entries,
309
- type: u("regex"),
313
+ ...p.entries,
314
+ type: d("regex"),
310
315
  /** Regex pattern string */
311
316
  pattern: t(),
312
317
  /** Replacement string (supports $1, $2, etc.) */
@@ -314,15 +319,15 @@ const b = {
314
319
  /** Regex flags (e.g., 'gi') */
315
320
  flags: e(t())
316
321
  }), q = o({
317
- ...d.entries,
318
- type: u("remove"),
322
+ ...p.entries,
323
+ type: d("remove"),
319
324
  /** Strings or patterns to remove */
320
325
  targets: n(t())
321
326
  }), G = o({
322
- ...d.entries,
323
- type: u("custom"),
327
+ ...p.entries,
328
+ type: d("custom"),
324
329
  /** Custom processor function */
325
- processor: h(
330
+ processor: k(
326
331
  (s) => typeof s == "function",
327
332
  "processor must be a function"
328
333
  )
@@ -342,7 +347,7 @@ const b = {
342
347
  * Return false to cancel the save operation.
343
348
  */
344
349
  externalValidation: e(
345
- h(
350
+ k(
346
351
  (s) => typeof s == "function",
347
352
  "externalValidation must be a function"
348
353
  )
@@ -352,7 +357,7 @@ const b = {
352
357
  /** Identity configuration (required) */
353
358
  identity: A,
354
359
  /** Partner configuration (required) */
355
- partner: E,
360
+ partner: P,
356
361
  // Optional sections (with defaults)
357
362
  /** Template content and presets */
358
363
  template: e(D, {}),
@@ -377,9 +382,9 @@ export {
377
382
  B as CustomBlockTypeSchema,
378
383
  G as CustomRuleSchema,
379
384
  w as DefaultBlockTypeSchema,
380
- P as DynamicContentListSchema,
381
- f as DynamicContentNodeSchema,
382
- M as DynamicContentSchema,
385
+ M as DynamicContentListSchema,
386
+ m as DynamicContentNodeSchema,
387
+ E as DynamicContentSchema,
383
388
  O as EditorSchema,
384
389
  N as EmailHeaderSchema,
385
390
  L as FallbackFontSchema,
@@ -388,7 +393,7 @@ export {
388
393
  A as IdentitySchema,
389
394
  v as LegacyRecommendationConfigSchema,
390
395
  b as MessageType,
391
- E as PartnerSchema,
396
+ P as PartnerSchema,
392
397
  l as ProductType,
393
398
  _ as RegexRuleSchema,
394
399
  q as RemoveRuleSchema,
@@ -1,18 +1,18 @@
1
- import o from "./Guido.vue2.js";
1
+ import r from "./Guido.vue2.js";
2
2
  /* empty css */
3
- import i from "../_virtual/_plugin-vue2_normalizer.js";
3
+ import a from "../_virtual/_plugin-vue2_normalizer.js";
4
4
  var n = function() {
5
- var a = this, r = a._self._c, e = a._self._setupProxy;
6
- return r("div", { ref: "wrapperRef", staticClass: "guido-editor__wrapper", class: { "guido-editor__no-header": e.noHeader } }, [r(e.HeaderWrapper), r(e.AutoSaveController, { ref: "autoSaveControllerRef" }), e.editorStore.isPreviewModeOpen ? r(e.PreviewContainer) : a._e(), r("div", { directives: [{ name: "show", rawName: "v-show", value: !e.previewStore.isLoaded, expression: "!previewStore.isLoaded" }], staticClass: "guido-editor__container", class: { "guido-editor__no-header": e.noHeader }, attrs: { id: "guido-editor" } }), r(e.Toaster), r(e.AuthErrorModal), r(e.FilterSelectionDrawer), e.isRrsEnabled || e.hasAssignedStrategy ? r(e.AssignStrategyDrawer) : a._e(), e.isRrsEnabled || e.hasAssignedStrategy ? r(e.RemoveStrategyModal) : a._e(), e.isRrsEnabled ? r(e.LegacyStrategyUpdatedModal) : a._e(), e.isLegacyUnsubscribeConversionEnabled ? r(e.LegacyUnsubscribeConvertedModal) : a._e(), e.moduleDynamicContentStore.queue.length > 0 ? r(e.AmbiguousDynamicContentModal) : a._e(), r(e.SaveAsTemplateDrawer), e.isSaveValidationEnabled ? r(e.ValidationErrorDrawer) : a._e(), e.isExternalDisplayConditionsEnabled ? r(e.DisplayConditionsHost) : a._e(), e.isTestPartner() ? a._e() : r(e.OnboardingWrapper, { on: { "onboarding-finished": function(l) {
5
+ var o = this, i = o._self._c, e = o._self._setupProxy;
6
+ return i("div", { ref: "wrapperRef", staticClass: "guido-editor__wrapper", class: { "guido-editor__no-header": e.noHeader } }, [i(e.HeaderWrapper), i(e.AutoSaveController, { ref: "autoSaveControllerRef" }), e.editorStore.isPreviewModeOpen ? i(e.PreviewContainer) : o._e(), i("div", { directives: [{ name: "show", rawName: "v-show", value: !e.previewStore.isLoaded, expression: "!previewStore.isLoaded" }], staticClass: "guido-editor__container", class: { "guido-editor__no-header": e.noHeader }, attrs: { id: "guido-editor" } }), i(e.Toaster), i(e.AuthErrorModal), i(e.FilterSelectionDrawer), e.isRrsEnabled || e.hasAssignedStrategy ? i(e.AssignStrategyDrawer) : o._e(), e.isRrsEnabled || e.hasAssignedStrategy ? i(e.RemoveStrategyModal) : o._e(), e.isRrsEnabled ? i(e.LegacyStrategyUpdatedModal) : o._e(), e.isLegacyUnsubscribeConversionEnabled ? i(e.LegacyUnsubscribeConvertedModal) : o._e(), e.moduleDynamicContentStore.queue.length > 0 ? i(e.AmbiguousDynamicContentModal) : o._e(), i(e.SaveAsTemplateDrawer), e.isSaveValidationEnabled ? i(e.ValidationErrorDrawer) : o._e(), e.isExternalDisplayConditionsEnabled ? i(e.DisplayConditionsHost) : o._e(), e.isTestPartner() ? o._e() : i(e.OnboardingWrapper, { on: { "onboarding-finished": function(l) {
7
7
  return e.emit("onboarding:finished");
8
- } } }), r(e.UnsubscribeWrapper), r(e.LoadingWrapper)], 1);
9
- }, t = [], s = /* @__PURE__ */ i(
10
- o,
8
+ } } }), i(e.UnsubscribeWrapper), i(e.LoadingWrapper), e.isPickerEnabled ? i(e.DynamicContentPicker, { attrs: { id: "guido-dynamic-content-modal", "aoo-options": e.pickerOptions.aooOptions, "aoo-scan-content": e.pickerAooScanContent, "dynamic-content-options": e.pickerOptions.options, "initial-data": e.picker.initialData, position: e.picker.position, visible: e.picker.visible }, on: { addDynamicContent: e.pickerSaveHandler, close: e.pickerCloseHandler } }) : o._e()], 1);
9
+ }, t = [], s = /* @__PURE__ */ a(
10
+ r,
11
11
  n,
12
12
  t,
13
13
  !1,
14
14
  null,
15
- "da8cab7f"
15
+ "a737f14a"
16
16
  );
17
17
  const u = s.exports;
18
18
  export {