@useinsider/guido 3.30.0-beta.232ea3c → 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 (46) hide show
  1. package/README.md +52 -0
  2. package/dist/@types/config/schemas.js +40 -33
  3. package/dist/components/Guido.vue.js +8 -8
  4. package/dist/components/Guido.vue2.js +128 -113
  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/useHtmlCompiler.js +15 -13
  14. package/dist/composables/useInfoBoxPosition.js +16 -0
  15. package/dist/composables/useStripo.js +59 -57
  16. package/dist/config/compiler/liquidCompilerRules.js +13 -5
  17. package/dist/config/migrator/itemsBlockMigrator.js +164 -161
  18. package/dist/enums/dynamic-content.js +180 -2
  19. package/dist/extensions/DynamicContent/dynamic-content.js +56 -33
  20. package/dist/guido.css +1 -1
  21. package/dist/package.json.js +1 -1
  22. package/dist/src/@types/config/schemas.d.ts +16 -0
  23. package/dist/src/@types/generic.d.ts +11 -0
  24. package/dist/src/components/organisms/dynamic-content/DynamicContentAooRuleConfig.vue.d.ts +48 -0
  25. package/dist/src/components/organisms/dynamic-content/DynamicContentCustomFormat.vue.d.ts +44 -0
  26. package/dist/src/components/organisms/dynamic-content/DynamicContentPicker.vue.d.ts +67 -0
  27. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +1 -1
  28. package/dist/src/composables/useConfig.d.ts +6 -0
  29. package/dist/src/composables/useDynamicContentFormat.d.ts +5 -0
  30. package/dist/src/composables/useDynamicContentPicker.d.ts +35 -0
  31. package/dist/src/composables/useInfoBoxPosition.d.ts +24 -0
  32. package/dist/src/enums/dynamic-content.d.ts +21 -0
  33. package/dist/src/extensions/DynamicContent/dynamic-content.d.ts +11 -0
  34. package/dist/src/stores/config.d.ts +63 -0
  35. package/dist/src/utils/clipboardText.d.ts +1 -0
  36. package/dist/src/utils/dynamicContentPicker.d.ts +43 -0
  37. package/dist/src/utils/genericUtil.d.ts +7 -2
  38. package/dist/src/utils/linkTokenPaste.d.ts +3 -0
  39. package/dist/src/utils/liquidLinkQuotes.d.ts +4 -0
  40. package/dist/utils/clipboardText.js +31 -0
  41. package/dist/utils/dynamicContentPicker.js +88 -0
  42. package/dist/utils/genericUtil.js +53 -43
  43. package/dist/utils/linkTokenPaste.js +28 -0
  44. package/dist/utils/liquidLinkQuotes.js +10 -0
  45. package/dist/utils/pairProductVariables.js +98 -108
  46. 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,8 @@ 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`
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)
176
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.
177
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.
178
181
  itemsPriceFormatting?: boolean, // Default: false - Items block price formatting: thousand/decimal separator + decimal count on the block root, raw price tags in the export (formatted at send time).
@@ -690,6 +693,55 @@ const closeModal = () => {
690
693
  </script>
691
694
  ```
692
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
+
729
+ ### Special links in the link type selector
730
+
731
+ Behind `features.dynamicContentSpecialLinks` (default `false`). Guido passes the `template.dynamicContentList`
732
+ catalogue to Stripo as `specialLinks`, one group per top-level category, keeping only the attributes whose
733
+ token ends in `url` or `url_<n>` (`last_visited_product_url`, `ins_apr_url_1`), each entry valued `{{token}}`.
734
+ Call an API variables are the exception: their tokens are id-based (`call_an_api_response_<id>`) and carry no
735
+ usable type, so the whole category is listed as its own group regardless of suffix. The link type dropdown of
736
+ link fields gains a **Personalization** tab with those groups and a search box; picking an entry writes the
737
+ token into the URL field and the dropdown label shows the entry's label.
738
+
739
+ - When no attribute matches (or the host passes no catalogue), `specialLinks` is not passed and the tab is not shown.
740
+ - Link fields only: the image path, alt text and button text are not covered; they keep Stripo's native
741
+ merge-tag dropdown fed by `mergeTags`.
742
+ - The list is fixed at editor init and the host picker is not involved, so nothing is added to the selected
743
+ list; `template.customFieldAttributes` must list every token for save validation.
744
+
693
745
  ### Saved-module token repair
694
746
 
695
747
  Legacy or hand-written **saved modules** may carry tokens by display label
@@ -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 k, 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 h } 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,17 +76,18 @@ 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()),
@@ -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) */
@@ -247,13 +250,17 @@ const b = {
247
250
  /** Allow persisting a template that still has validation errors (drawer "Save and Continue" soft-save). Host sets false for transactional + unsubscribe. */
248
251
  allowSaveWithErrors: e(a(), !0),
249
252
  reusableRecommendationStrategy: e(a(), !1),
253
+ /** List the dynamic-content catalogue as Stripo special links in the link type selector */
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),
250
257
  /** Convert linkless legacy unsubscribe blocks into text blocks and warn with a modal (opt-in) */
251
258
  legacyUnsubscribeConversion: e(a(), !1),
252
259
  /** Items block: Recommendation-style price formatting (root currency-* attrs, raw price tags). Released dark. */
253
260
  itemsPriceFormatting: e(a(), !1),
254
261
  /** Warn on save when the design carries an Insider unsubscribe link or code (host sets true for SFMC accounts) */
255
262
  blockUnsubscribeLinks: e(a(), !1)
256
- }), w = m([
263
+ }), w = u([
257
264
  "amp-accordion",
258
265
  "amp-carousel",
259
266
  "amp-form-controls",
@@ -267,7 +274,7 @@ const b = {
267
274
  "text-block",
268
275
  "timer-block",
269
276
  "video-block"
270
- ]), B = m([
277
+ ]), B = u([
271
278
  "dynamic-content",
272
279
  "checkbox-block",
273
280
  "radio-button-block",
@@ -286,7 +293,7 @@ const b = {
286
293
  n(B),
287
294
  []
288
295
  )
289
- }), d = o({
296
+ }), p = o({
290
297
  /** Unique identifier for the rule */
291
298
  id: t(),
292
299
  /** Human-readable description */
@@ -294,8 +301,8 @@ const b = {
294
301
  /** Priority for rule ordering (lower = earlier) */
295
302
  priority: c()
296
303
  }), H = o({
297
- ...d.entries,
298
- type: u("replace"),
304
+ ...p.entries,
305
+ type: d("replace"),
299
306
  /** String to search for */
300
307
  search: t(),
301
308
  /** Replacement string */
@@ -303,8 +310,8 @@ const b = {
303
310
  /** Replace all occurrences (default: false) */
304
311
  replaceAll: e(a())
305
312
  }), _ = o({
306
- ...d.entries,
307
- type: u("regex"),
313
+ ...p.entries,
314
+ type: d("regex"),
308
315
  /** Regex pattern string */
309
316
  pattern: t(),
310
317
  /** Replacement string (supports $1, $2, etc.) */
@@ -312,13 +319,13 @@ const b = {
312
319
  /** Regex flags (e.g., 'gi') */
313
320
  flags: e(t())
314
321
  }), q = o({
315
- ...d.entries,
316
- type: u("remove"),
322
+ ...p.entries,
323
+ type: d("remove"),
317
324
  /** Strings or patterns to remove */
318
325
  targets: n(t())
319
326
  }), G = o({
320
- ...d.entries,
321
- type: u("custom"),
327
+ ...p.entries,
328
+ type: d("custom"),
322
329
  /** Custom processor function */
323
330
  processor: k(
324
331
  (s) => typeof s == "function",
@@ -350,7 +357,7 @@ const b = {
350
357
  /** Identity configuration (required) */
351
358
  identity: A,
352
359
  /** Partner configuration (required) */
353
- partner: E,
360
+ partner: P,
354
361
  // Optional sections (with defaults)
355
362
  /** Template content and presets */
356
363
  template: e(D, {}),
@@ -375,9 +382,9 @@ export {
375
382
  B as CustomBlockTypeSchema,
376
383
  G as CustomRuleSchema,
377
384
  w as DefaultBlockTypeSchema,
378
- P as DynamicContentListSchema,
379
- f as DynamicContentNodeSchema,
380
- M as DynamicContentSchema,
385
+ M as DynamicContentListSchema,
386
+ m as DynamicContentNodeSchema,
387
+ E as DynamicContentSchema,
381
388
  O as EditorSchema,
382
389
  N as EmailHeaderSchema,
383
390
  L as FallbackFontSchema,
@@ -386,7 +393,7 @@ export {
386
393
  A as IdentitySchema,
387
394
  v as LegacyRecommendationConfigSchema,
388
395
  b as MessageType,
389
- E as PartnerSchema,
396
+ P as PartnerSchema,
390
397
  l as ProductType,
391
398
  _ as RegexRuleSchema,
392
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
- "0c5f11a1"
15
+ "a737f14a"
16
16
  );
17
17
  const u = s.exports;
18
18
  export {