@useinsider/guido 3.21.1-beta.f5fb7ac → 3.21.2-beta.cfc5be2

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 (75) hide show
  1. package/README.md +1 -9
  2. package/dist/@types/config/schemas.js +19 -19
  3. package/dist/@types/display-condition.js +25 -0
  4. package/dist/components/Guido.vue.js +8 -8
  5. package/dist/components/Guido.vue2.js +74 -76
  6. package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +20 -0
  7. package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +30 -0
  8. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +30 -0
  9. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +71 -0
  10. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +34 -0
  11. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +57 -0
  12. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +17 -0
  13. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +22 -0
  14. package/dist/composables/useBlocksConfig.js +32 -24
  15. package/dist/composables/useDisplayConditions.js +102 -0
  16. package/dist/composables/useModuleRepair.js +23 -32
  17. package/dist/config/compiler/utils/recommendationCompilerUtils.js +55 -53
  18. package/dist/config/migrator/index.js +9 -10
  19. package/dist/enums/academy.js +2 -2
  20. package/dist/enums/display-condition.js +12 -0
  21. package/dist/extensions/Blocks/Recommendation/block.js +52 -37
  22. package/dist/extensions/Blocks/Recommendation/controls/image/index.js +76 -16
  23. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +16 -15
  24. package/dist/extensions/DisplayConditions/bridge.js +17 -0
  25. package/dist/extensions/DisplayConditions/constants.js +17 -0
  26. package/dist/extensions/DisplayConditions/control.js +178 -0
  27. package/dist/extensions/DisplayConditions/display-conditions.css.js +201 -0
  28. package/dist/extensions/DisplayConditions/extension.js +28 -0
  29. package/dist/extensions/DisplayConditions/iconsRegistry.js +20 -0
  30. package/dist/extensions/DisplayConditions/library.js +27 -0
  31. package/dist/extensions/DisplayConditions/settingsPanel.js +17 -0
  32. package/dist/guido.css +1 -1
  33. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +93 -92
  34. package/dist/node_modules/valibot/dist/index.js +297 -261
  35. package/dist/services/displayConditionApi.js +39 -0
  36. package/dist/src/@types/config/schemas.d.ts +4 -4
  37. package/dist/src/@types/display-condition.d.ts +59 -0
  38. package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +43 -0
  39. package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +2 -0
  40. package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +2 -0
  41. package/dist/src/composables/useConfig.d.ts +2 -2
  42. package/dist/src/composables/useDisplayConditions.d.ts +16 -0
  43. package/dist/src/composables/useModuleRepair.d.ts +11 -2
  44. package/dist/src/enums/academy.d.ts +1 -1
  45. package/dist/src/enums/display-condition.d.ts +15 -0
  46. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +2 -0
  47. package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +31 -17
  48. package/dist/src/extensions/DisplayConditions/bridge.d.ts +6 -0
  49. package/dist/src/extensions/DisplayConditions/constants.d.ts +14 -0
  50. package/dist/src/extensions/DisplayConditions/control.d.ts +23 -0
  51. package/dist/src/extensions/DisplayConditions/extension.d.ts +2 -0
  52. package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +4 -0
  53. package/dist/src/extensions/DisplayConditions/library.d.ts +8 -0
  54. package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +5 -0
  55. package/dist/src/mock/api/display-conditions.d.ts +2 -0
  56. package/dist/src/services/displayConditionApi.d.ts +8 -0
  57. package/dist/src/stores/config.d.ts +166 -20
  58. package/dist/src/stores/display-condition.d.ts +81 -0
  59. package/dist/src/stores/editor.d.ts +0 -25
  60. package/dist/src/utils/displayCondition.d.ts +10 -0
  61. package/dist/src/utils/protectTableText.d.ts +2 -0
  62. package/dist/stores/config.js +13 -6
  63. package/dist/stores/display-condition.js +28 -0
  64. package/dist/stores/editor.js +14 -15
  65. package/dist/utils/displayCondition.js +26 -0
  66. package/dist/utils/pairProductVariables.js +15 -14
  67. package/dist/utils/protectTableText.js +22 -0
  68. package/package.json +1 -1
  69. package/dist/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue.js +0 -17
  70. package/dist/components/organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue2.js +0 -30
  71. package/dist/config/migrator/legacyUnsubscribeTextMigrator.js +0 -16
  72. package/dist/src/config/migrator/legacyUnsubscribeTextMigrator.d.ts +0 -1
  73. package/dist/src/utils/legacyUnsubscribeConversion.d.ts +0 -10
  74. package/dist/utils/legacyUnsubscribeConversion.js +0 -49
  75. /package/dist/src/components/organisms/{unsubscribe/LegacyUnsubscribeConvertedModal.vue.d.ts → display-conditions/DisplayConditionCreateDrawer.vue.d.ts} +0 -0
package/README.md CHANGED
@@ -150,6 +150,7 @@ const config: GuidoConfigInput = {
150
150
  ui?: {
151
151
  showHeader?: boolean, // Default: true
152
152
  backButtonLabel?: string,
153
+ externalDisplayConditions?: boolean, // Default: false - Replace Stripo's display-condition UI with a Conditions tab in the settings panel and create/select drawers for reusable Liquid/Pongo display conditions.
153
154
  },
154
155
 
155
156
  // Optional: Feature toggles (defaults apply once initialized — see `ready` prop below)
@@ -166,7 +167,6 @@ const config: GuidoConfigInput = {
166
167
  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).
167
168
  allowSaveWithErrors?: boolean, // Default: true - Allow the validation drawer's "Save and Continue" soft-save. Set false to hard-block invalid saves (transactional + unsubscribe pages).
168
169
  reusableRecommendationStrategy?: boolean, // Default: false - Assign an RRS strategy to recommendation blocks instead of per-block algorithm/filters/shuffle/product-count settings.
169
- 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.
170
170
  },
171
171
 
172
172
  // Optional: Callbacks
@@ -668,14 +668,6 @@ multiple partners (e.g. architect) should key by partner and place the active pa
668
668
  first. Omit the prop and the repair is a safe no-op — nothing is rewritten and no
669
669
  toaster fires (useful before the host has wired the catalog).
670
670
 
671
- With `features.legacyUnsubscribeConversion: true`, a dropped or copied module's legacy
672
- unsubscribe block that has no unsubscribe link (the old editor reused it as plain text,
673
- e.g. a company address) becomes a plain text block that keeps its content, and a warning
674
- modal explains it. The same conversion runs when a template is opened. Register these
675
- keys host-side: `email-editor.legacy-unsubscribe-converted-modal-title`,
676
- `email-editor.legacy-unsubscribe-converted-modal-message` and
677
- `email-editor.legacy-unsubscribe-converted-modal-visit-academy` (OK reuses `action-builder.ok`).
678
-
679
671
  ---
680
672
 
681
673
  ## Development
@@ -84,10 +84,10 @@ const p = {
84
84
  children: e(n(f)),
85
85
  // eslint-disable-next-line camelcase -- backend field name
86
86
  select_items: e(n(f))
87
- })), v = g(
87
+ })), x = g(
88
88
  t(),
89
89
  R(n(f), [])
90
- ), N = C({
90
+ ), D = C({
91
91
  /** Block ID (matches the dictionary key and the legacy HTML element id) */
92
92
  id: e(s()),
93
93
  /** Decimal places for price display (legacy data may use string or number) */
@@ -132,7 +132,7 @@ const p = {
132
132
  isPriceMovedToNextLine: e(o()),
133
133
  /** Legacy "Hide if same as discounted" / delete-price-for-zero-sale toggle */
134
134
  isPriceDeletedForZeroSale: e(o())
135
- }), P = a({
135
+ }), N = a({
136
136
  /**
137
137
  * Legacy recommendation block configs keyed by block ID.
138
138
  * Pass this when loading a template authored with the v1
@@ -140,10 +140,10 @@ const p = {
140
140
  * strategy, currency, locale, and layout data.
141
141
  */
142
142
  recommendationConfigs: e(
143
- g(t(), N),
143
+ g(t(), D),
144
144
  {}
145
145
  )
146
- }), x = a({
146
+ }), P = a({
147
147
  /** Initial HTML content */
148
148
  html: e(t(), ""),
149
149
  /** Initial CSS content */
@@ -159,7 +159,7 @@ const p = {
159
159
  * (first) partner's leaf attributes into the label→token map that repairs
160
160
  * label-form placeholders (`{{ Phone Number }}`) in dropped saved modules.
161
161
  */
162
- dynamicContentList: e(v, {}),
162
+ dynamicContentList: e(x, {}),
163
163
  /** Valid custom field attribute names from the partner's categorized fields */
164
164
  customFieldAttributes: e(n(t()), []),
165
165
  /** Selected unsubscribe page IDs */
@@ -194,8 +194,8 @@ const p = {
194
194
  )
195
195
  ),
196
196
  /** Migration-only inputs (legacy block configs) */
197
- migration: e(P, {})
198
- }), D = a({
197
+ migration: e(N, {})
198
+ }), v = a({
199
199
  /** Sender display name */
200
200
  senderName: e(t(), ""),
201
201
  /** Email subject line */
@@ -208,7 +208,7 @@ const p = {
208
208
  /** Migration date for template compatibility */
209
209
  migrationDate: e(s(), 1759696858),
210
210
  /** Email header settings */
211
- emailHeader: e(D, { senderName: "", subject: "" }),
211
+ emailHeader: e(v, { senderName: "", subject: "" }),
212
212
  /** Folder name for user-saved modules (used by Stripo plugin panel for path construction) */
213
213
  savedModulesFolderName: e(t(), S.SAVED_MODULES),
214
214
  /** Folder name for default/prebuilt modules (used by Stripo plugin panel for path construction) */
@@ -217,7 +217,9 @@ const p = {
217
217
  /** Whether to show the header bar */
218
218
  showHeader: e(o(), !0),
219
219
  /** Custom label for back button (if shown) */
220
- backButtonLabel: e(t())
220
+ backButtonLabel: e(t()),
221
+ /** Replace Stripo's display-condition UI with the Conditions tab and create/select drawers */
222
+ externalDisplayConditions: e(o(), !1)
221
223
  }), U = a({
222
224
  /** Enable dynamic content insertion */
223
225
  dynamicContent: e(o(), !0),
@@ -243,9 +245,7 @@ const p = {
243
245
  linkTrackingIds: e(o(), !1),
244
246
  /** Allow persisting a template that still has validation errors (drawer "Save and Continue" soft-save). Host sets false for transactional + unsubscribe. */
245
247
  allowSaveWithErrors: e(o(), !0),
246
- reusableRecommendationStrategy: e(o(), !1),
247
- /** Convert linkless legacy unsubscribe blocks into text blocks and warn with a modal (opt-in) */
248
- legacyUnsubscribeConversion: e(o(), !1)
248
+ reusableRecommendationStrategy: e(o(), !1)
249
249
  }), w = m([
250
250
  "amp-accordion",
251
251
  "amp-carousel",
@@ -346,7 +346,7 @@ const p = {
346
346
  partner: E,
347
347
  // Optional sections (with defaults)
348
348
  /** Template content and presets */
349
- template: e(x, {}),
349
+ template: e(P, {}),
350
350
  /** Editor settings */
351
351
  editor: e(O, {}),
352
352
  /** UI configuration */
@@ -368,23 +368,23 @@ export {
368
368
  B as CustomBlockTypeSchema,
369
369
  G as CustomRuleSchema,
370
370
  w as DefaultBlockTypeSchema,
371
- v as DynamicContentListSchema,
371
+ x as DynamicContentListSchema,
372
372
  f as DynamicContentNodeSchema,
373
373
  M as DynamicContentSchema,
374
374
  O as EditorSchema,
375
- D as EmailHeaderSchema,
375
+ v as EmailHeaderSchema,
376
376
  L as FallbackFontSchema,
377
377
  U as FeaturesSchema,
378
378
  K as GuidoConfigSchema,
379
379
  A as IdentitySchema,
380
- N as LegacyRecommendationConfigSchema,
380
+ D as LegacyRecommendationConfigSchema,
381
381
  p as MessageType,
382
382
  E as PartnerSchema,
383
383
  l as ProductType,
384
384
  _ as RegexRuleSchema,
385
385
  q as RemoveRuleSchema,
386
386
  H as ReplaceRuleSchema,
387
- P as TemplateMigrationSchema,
388
- x as TemplateSchema,
387
+ N as TemplateMigrationSchema,
388
+ P as TemplateSchema,
389
389
  F as UISchema
390
390
  };
@@ -0,0 +1,25 @@
1
+ import { object as e, optional as a, string as o, nullish as i, number as t, picklist as n, array as c } from "../node_modules/valibot/dist/index.js";
2
+ const s = n(["liquid", "pongo"]), d = n(["codeOnly", "logicBuilder"]), r = e({
3
+ id: t(),
4
+ name: o(),
5
+ description: i(o(), ""),
6
+ syntax: s,
7
+ method: d,
8
+ codeBefore: o(),
9
+ codeAfter: i(o(), ""),
10
+ createdAt: a(o())
11
+ }), p = e({
12
+ data: c(r),
13
+ meta: e({
14
+ totalCount: t(),
15
+ perPage: t(),
16
+ currentPage: t(),
17
+ lastPage: t()
18
+ })
19
+ });
20
+ export {
21
+ p as DisplayConditionListResponseSchema,
22
+ d as DisplayConditionMethodSchema,
23
+ s as DisplayConditionSyntaxSchema,
24
+ r as SavedDisplayConditionSchema
25
+ };
@@ -1,18 +1,18 @@
1
- import o from "./Guido.vue2.js";
1
+ import i from "./Guido.vue2.js";
2
2
  /* empty css */
3
- import i from "../_virtual/_plugin-vue2_normalizer.js";
4
- var s = function() {
3
+ import o from "../_virtual/_plugin-vue2_normalizer.js";
4
+ var t = function() {
5
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, { ref: "headerWrapperRef" }), r(e.AutoSaveController), 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(), r(e.SaveAsTemplateDrawer), e.isSaveValidationEnabled ? r(e.ValidationErrorDrawer) : a._e(), e.isTestPartner() ? a._e() : r(e.OnboardingWrapper, { on: { "onboarding-finished": function(_) {
6
+ return r("div", { ref: "wrapperRef", staticClass: "guido-editor__wrapper", class: { "guido-editor__no-header": e.noHeader } }, [r(e.HeaderWrapper, { ref: "headerWrapperRef" }), r(e.AutoSaveController), 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(), 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(_) {
7
7
  return e.emit("onboarding:finished");
8
8
  } } }), r(e.UnsubscribeWrapper), r(e.LoadingWrapper)], 1);
9
- }, t = [], n = /* @__PURE__ */ i(
10
- o,
11
- s,
9
+ }, s = [], n = /* @__PURE__ */ o(
10
+ i,
12
11
  t,
12
+ s,
13
13
  !1,
14
14
  null,
15
- "6cdd5182"
15
+ "5d5e32de"
16
16
  );
17
17
  const v = n.exports;
18
18
  export {
@@ -4,33 +4,33 @@ import { useEditorLock as pe } from "../composables/useEditorLock.js";
4
4
  import { provideGuidoActions as fe } from "../composables/useGuidoActions.js";
5
5
  import { useGuidoStateBridge as ye } from "../composables/useGuidoStateBridge.js";
6
6
  import { usePartner as ge } from "../composables/usePartner.js";
7
- import { useSaveValidationRollout as be } from "../composables/useSaveValidationRollout.js";
7
+ import { useSaveValidationRollout as Se } from "../composables/useSaveValidationRollout.js";
8
8
  import { useStripo as ve } from "../composables/useStripo.js";
9
- import { useTimerClone as Se } from "../composables/useTimerClone.js";
10
- import { migrate as V } from "../config/migrator/index.js";
11
- import { ModuleFolderDefaults as $ } from "../enums/defaults.js";
9
+ import { useTimerClone as be } from "../composables/useTimerClone.js";
10
+ import { migrate as H } from "../config/migrator/index.js";
11
+ import { ModuleFolderDefaults as V } from "../enums/defaults.js";
12
12
  import { RIBBON_SELECTOR as he } from "../enums/onboarding.js";
13
- import { useRecommendationExtensionStore as z, disposeStrategyPageReturnListeners as Ee } from "../extensions/Blocks/Recommendation/store/recommendation.js";
14
- import { disposeUnsubscribeListeners as we } from "../extensions/Blocks/Unsubscribe/block.js";
15
- import Ce from "./organisms/AutoSaveController.vue.js";
16
- import De from "./organisms/base/AuthErrorModal.vue.js";
13
+ import { useRecommendationExtensionStore as $, disposeStrategyPageReturnListeners as Ee } from "../extensions/Blocks/Recommendation/store/recommendation.js";
14
+ import { disposeUnsubscribeListeners as De } from "../extensions/Blocks/Unsubscribe/block.js";
15
+ import we from "./organisms/AutoSaveController.vue.js";
16
+ import Ce from "./organisms/base/AuthErrorModal.vue.js";
17
17
  import ke from "./organisms/base/Toaster.vue.js";
18
- import Fe from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
19
- import Le from "./organisms/header/HeaderWrapper.vue.js";
20
- import Re from "./organisms/LoadingWrapper.vue.js";
18
+ import Re from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
19
+ import Fe from "./organisms/header/HeaderWrapper.vue.js";
20
+ import Le from "./organisms/LoadingWrapper.vue.js";
21
21
  import Me from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
22
- import Ue from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
23
- import Te from "./organisms/validation/ValidationErrorDrawer.vue.js";
24
- import { useStripoApi as Ie } from "../services/stripoApi.js";
22
+ import Te from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
23
+ import Ie from "./organisms/validation/ValidationErrorDrawer.vue.js";
24
+ import { useStripoApi as Ue } from "../services/stripoApi.js";
25
25
  import { useConfigStore as Ae } from "../stores/config.js";
26
26
  import { useDynamicContentStore as Be } from "../stores/dynamic-content.js";
27
27
  import { useEditorStore as E } from "../stores/editor.js";
28
28
  import { usePreviewStore as Ne } from "../stores/preview.js";
29
- import { useSaveValidationStore as Pe } from "../stores/save-validation.js";
30
- import { useTemplateStore as _e } from "../stores/template.js";
31
- import { useUnsubscribeStore as Oe } from "../stores/unsubscribe.js";
32
- import { readTrackFloor as H } from "../utils/linkTrackingIds.js";
33
- const vo = /* @__PURE__ */ de({
29
+ import { useSaveValidationStore as xe } from "../stores/save-validation.js";
30
+ import { useTemplateStore as Pe } from "../stores/template.js";
31
+ import { useUnsubscribeStore as _e } from "../stores/unsubscribe.js";
32
+ import { readTrackFloor as z } from "../utils/linkTrackingIds.js";
33
+ const St = /* @__PURE__ */ de({
34
34
  __name: "Guido",
35
35
  props: {
36
36
  config: null,
@@ -47,37 +47,35 @@ const vo = /* @__PURE__ */ de({
47
47
  ), X = c(
48
48
  () => import("./organisms/extensions/recommendation/RemoveStrategyModal.vue.js")
49
49
  ), Y = c(
50
- () => import("./organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js")
50
+ () => import("./organisms/display-conditions/DisplayConditionsHost.vue.js")
51
51
  ), Z = c(
52
- () => import("./organisms/unsubscribe/LegacyUnsubscribeConvertedModal.vue.js")
53
- ), w = W(), f = W(), y = Be(), C = Oe(), t = Ae();
54
- a.ready && t.init(a.config);
55
- const d = E(), ee = Ne(), u = l(() => d.hasChanges), { isTestPartner: oe } = ge(), { isEnabled: te, loadRollout: D } = be(), k = () => {
56
- var o;
57
- return (o = w.value) == null ? void 0 : o.handleSave(!0);
58
- }, F = (o) => {
59
- d.loadingStatus = o;
52
+ () => import("./organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js")
53
+ ), D = W(), f = W(), y = Be(), w = _e(), o = Ae();
54
+ a.ready && o.init(a.config);
55
+ const d = E(), ee = Ne(), u = l(() => d.hasChanges), { isTestPartner: te } = ge(), { isEnabled: oe, loadRollout: C } = Se(), k = () => {
56
+ var t;
57
+ return (t = D.value) == null ? void 0 : t.handleSave(!0);
58
+ }, R = (t) => {
59
+ d.loadingStatus = t;
60
60
  };
61
61
  ue(), ye();
62
62
  const g = () => {
63
- var o, e;
63
+ var t, e;
64
64
  return {
65
- emailId: t.templateId,
66
- userId: t.userId,
67
- username: t.username,
68
- partnerName: t.partnerName,
69
- savedModulesFolderName: ((o = t.editor) == null ? void 0 : o.savedModulesFolderName) || $.SAVED_MODULES,
70
- defaultModulesFolderName: ((e = t.editor) == null ? void 0 : e.defaultModulesFolderName) || $.DEFAULT_MODULES
65
+ emailId: o.templateId,
66
+ userId: o.userId,
67
+ username: o.username,
68
+ partnerName: o.partnerName,
69
+ savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || V.SAVED_MODULES,
70
+ defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || V.DEFAULT_MODULES
71
71
  };
72
- }, { initPlugin: L, preloadRuntime: R } = ve(), { runExclusive: M, beginMount: U, isCurrentMount: b } = pe();
72
+ }, { initPlugin: F, preloadRuntime: L } = ve(), { runExclusive: M, beginMount: T, isCurrentMount: S } = pe();
73
73
  let p = 0;
74
- const { getDefaultTemplate: T } = Ie(), { cloneTimersOnSave: I, hasTimerBlocks: A } = Se(), ne = l(() => {
75
- var o;
76
- return !((o = t.ui) != null && o.showHeader);
77
- }), re = l(() => t.isFeatureEnabled("reusableRecommendationStrategy")), se = l(
78
- () => t.isFeatureEnabled("legacyUnsubscribeConversion")
79
- ), ae = l(
80
- () => !!z().recommendationConfigs.strategyId
74
+ const { getDefaultTemplate: I } = Ue(), { cloneTimersOnSave: U, hasTimerBlocks: A } = be(), ne = l(() => {
75
+ var t;
76
+ return !((t = o.ui) != null && t.showHeader);
77
+ }), re = l(() => o.isFeatureEnabled("reusableRecommendationStrategy")), se = l(() => o.externalDisplayConditions), ae = l(
78
+ () => !!$().recommendationConfigs.strategyId
81
79
  );
82
80
  fe({
83
81
  onBack: () => {
@@ -86,65 +84,65 @@ const vo = /* @__PURE__ */ de({
86
84
  onSaveStart: () => {
87
85
  console.debug("guido:save:start"), r("save:start");
88
86
  },
89
- onSaveComplete: (o) => {
90
- const e = { ...o, metadata: g() };
87
+ onSaveComplete: (t) => {
88
+ const e = { ...t, metadata: g() };
91
89
  console.debug("guido:save:complete", e), r("save:complete", e);
92
90
  },
93
91
  onTestEmailClick: () => {
94
92
  console.debug("guido:test-email:click"), r("test-email:click");
95
93
  }
96
94
  });
97
- const B = (o) => {
98
- console.debug("dynamic-content:close", o), y.setSelectedDynamicContent(o), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: o }));
95
+ const B = (t) => {
96
+ console.debug("dynamic-content:close", t), y.setSelectedDynamicContent(t), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: t }));
99
97
  }, N = () => {
100
98
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
101
99
  };
102
100
  G(() => u.value, () => {
103
101
  r("on-change", u.value);
104
102
  });
105
- const v = (o) => {
106
- const e = o, { attribute: s, position: m } = e.detail;
103
+ const v = (t) => {
104
+ const e = t, { attribute: s, position: m } = e.detail;
107
105
  console.debug("dynamic-content:open", e.detail), r("dynamic-content:open", s, m);
108
106
  };
109
107
  let i = null;
110
- const S = () => {
108
+ const b = () => {
111
109
  var e;
112
- const o = document.querySelector(he);
113
- (e = f.value) == null || e.style.setProperty("--ribbon-offset", `${(o == null ? void 0 : o.offsetHeight) ?? 0}px`);
110
+ const t = document.querySelector(he);
111
+ (e = f.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
114
112
  }, h = async () => {
115
- var o;
113
+ var t;
116
114
  try {
117
- t.initialized || t.init(a.config), d.templateId = t.templateId;
118
- const e = t.template, s = (e == null ? void 0 : e.html) || "", m = (e == null ? void 0 : e.css) || "", P = (e == null ? void 0 : e.preselectedDynamicContent) || [];
119
- C.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
120
- const _ = ((o = e == null ? void 0 : e.migration) == null ? void 0 : o.recommendationConfigs) ?? {}, O = t.isFeatureEnabled("linkTrackingIds"), x = {
121
- partnerName: t.partnerName,
115
+ o.initialized || o.init(a.config), d.templateId = o.templateId;
116
+ const e = o.template, s = (e == null ? void 0 : e.html) || "", m = (e == null ? void 0 : e.css) || "", x = (e == null ? void 0 : e.preselectedDynamicContent) || [];
117
+ w.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
118
+ const P = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, _ = o.isFeatureEnabled("linkTrackingIds"), O = {
119
+ partnerName: o.partnerName,
122
120
  campaignUrls: e == null ? void 0 : e.recommendationCampaignUrls,
123
- rrsEnabled: t.isFeatureEnabled("reusableRecommendationStrategy")
121
+ rrsEnabled: o.isFeatureEnabled("reusableRecommendationStrategy")
124
122
  };
125
123
  let n = {
126
- html: s && await V(s, _, x),
124
+ html: s && await H(s, P, O),
127
125
  css: m
128
126
  };
129
- n.html || (n = await T(), n.html = await V(n.html, _, x));
130
- const ie = O ? H(n.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
131
- A(n.html) && (n.html = await I(n.html)), O && (d.trackIdSessionFloor = Math.max(ie, H(n.html)));
127
+ n.html || (n = await I(), n.html = await H(n.html, P, O));
128
+ const ie = _ ? z(n.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
129
+ A(n.html) && (n.html = await U(n.html)), _ && (d.trackIdSessionFloor = Math.max(ie, z(n.html)));
132
130
  const ce = {
133
- preselectedDynamicContentList: P,
131
+ preselectedDynamicContentList: x,
134
132
  onReady: () => {
135
133
  console.debug("guido:ready"), r("ready");
136
134
  }
137
135
  };
138
- p = U(), await L(n, g(), ce), y.selectedDynamicContentList = P;
136
+ p = T(), await F(n, g(), ce), y.selectedDynamicContentList = x;
139
137
  } catch (e) {
140
138
  console.error("Failed to initialize Stripo editor:", e);
141
139
  }
142
140
  };
143
141
  return me(async () => {
144
142
  var e;
145
- console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), z().$reset(), E().$reset(), _e().$reset(), Pe().$reset(), D(), S();
146
- const o = (e = f.value) == null ? void 0 : e.parentElement;
147
- if (o && (i = new ResizeObserver(S), i.observe(o)), R(), a.ready)
143
+ console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), $().$reset(), E().$reset(), Pe().$reset(), xe().$reset(), C(), b();
144
+ const t = (e = f.value) == null ? void 0 : e.parentElement;
145
+ if (t && (i = new ResizeObserver(b), i.observe(t)), L(), a.ready)
148
146
  await h();
149
147
  else {
150
148
  const s = G(() => a.ready, (m) => {
@@ -153,20 +151,20 @@ const vo = /* @__PURE__ */ de({
153
151
  }
154
152
  document.addEventListener("dynamic-content:open", v);
155
153
  }), le(() => {
156
- if (we(), Ee(), i == null || i.disconnect(), document.removeEventListener("dynamic-content:open", v), b(p))
154
+ if (De(), Ee(), i == null || i.disconnect(), document.removeEventListener("dynamic-content:open", v), S(p))
157
155
  try {
158
156
  E().isStripoInitialized = !1;
159
- } catch (o) {
160
- console.debug("Failed to close the editor readiness gate on unmount", o);
157
+ } catch (t) {
158
+ console.debug("Failed to close the editor readiness gate on unmount", t);
161
159
  }
162
160
  M(async () => {
163
- if (b(p))
161
+ if (S(p))
164
162
  try {
165
163
  window.UIEditor.removeEditor();
166
164
  } catch {
167
165
  console.debug("Failed to remove Stripo editor: No editor found");
168
166
  }
169
- }), t.reset();
167
+ }), o.reset();
170
168
  }), K({
171
169
  dynamicContent: {
172
170
  insert: B,
@@ -174,10 +172,10 @@ const vo = /* @__PURE__ */ de({
174
172
  },
175
173
  hasChanges: u,
176
174
  saveSilent: k,
177
- setLoading: F
178
- }), { __sfc: !0, PreviewContainer: j, OnboardingWrapper: J, AssignStrategyDrawer: Q, RemoveStrategyModal: X, LegacyStrategyUpdatedModal: Y, LegacyUnsubscribeConvertedModal: Z, headerWrapperRef: w, wrapperRef: f, dynamicContentStore: y, unsubscribeStore: C, props: a, configStore: t, editorStore: d, previewStore: ee, hasChanges: u, isTestPartner: oe, isSaveValidationEnabled: te, loadRollout: D, saveSilent: k, setLoading: F, emit: r, buildMetadata: g, initPlugin: L, preloadRuntime: R, runExclusive: M, beginMount: U, isCurrentMount: b, mountGeneration: p, getDefaultTemplate: T, cloneTimersOnSave: I, hasTimerBlocks: A, noHeader: ne, isRrsEnabled: re, isLegacyUnsubscribeConversionEnabled: se, hasAssignedStrategy: ae, insertDynamicContent: B, closeDynamicContent: N, handleDynamicContentOpen: v, ribbonObserver: i, updateRibbonOffset: S, startEditor: h, AutoSaveController: Ce, AuthErrorModal: De, Toaster: ke, FilterSelectionDrawer: Fe, HeaderWrapper: Le, LoadingWrapper: Re, SaveAsTemplateDrawer: Me, UnsubscribeWrapper: Ue, ValidationErrorDrawer: Te };
175
+ setLoading: R
176
+ }), { __sfc: !0, PreviewContainer: j, OnboardingWrapper: J, AssignStrategyDrawer: Q, RemoveStrategyModal: X, DisplayConditionsHost: Y, LegacyStrategyUpdatedModal: Z, headerWrapperRef: D, wrapperRef: f, dynamicContentStore: y, unsubscribeStore: w, props: a, configStore: o, editorStore: d, previewStore: ee, hasChanges: u, isTestPartner: te, isSaveValidationEnabled: oe, loadRollout: C, saveSilent: k, setLoading: R, emit: r, buildMetadata: g, initPlugin: F, preloadRuntime: L, runExclusive: M, beginMount: T, isCurrentMount: S, mountGeneration: p, getDefaultTemplate: I, cloneTimersOnSave: U, hasTimerBlocks: A, noHeader: ne, isRrsEnabled: re, isExternalDisplayConditionsEnabled: se, hasAssignedStrategy: ae, insertDynamicContent: B, closeDynamicContent: N, handleDynamicContentOpen: v, ribbonObserver: i, updateRibbonOffset: b, startEditor: h, AutoSaveController: we, AuthErrorModal: Ce, Toaster: ke, FilterSelectionDrawer: Re, HeaderWrapper: Fe, LoadingWrapper: Le, SaveAsTemplateDrawer: Me, UnsubscribeWrapper: Te, ValidationErrorDrawer: Ie };
179
177
  }
180
178
  });
181
179
  export {
182
- vo as default
180
+ St as default
183
181
  };
@@ -0,0 +1,20 @@
1
+ import i from "./CodeEditorField.vue2.js";
2
+ /* empty css */
3
+ import s from "../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var a = function() {
5
+ var e = this, r = e._self._c, o = e._self._setupProxy;
6
+ return r("div", { staticClass: "guido-code-editor-field", attrs: { id: e.id } }, [r("p", { staticClass: "guido-code-editor-field__label" }, [e._v(" " + e._s(e.label) + " ")]), r(o.InCodeSnippet, { attrs: { code: e.value, disable: e.disabled, "focus-editor": !1, invalid: !!e.error, "invalid-message": e.error, options: o.options, size: { height: e.error ? 196 : 216 }, "syntax-check": !1 }, on: { input: function(t) {
7
+ return o.emit("input", t);
8
+ }, ready: o.onReady } })], 1);
9
+ }, n = [], d = /* @__PURE__ */ s(
10
+ i,
11
+ a,
12
+ n,
13
+ !1,
14
+ null,
15
+ "e96c7aa3"
16
+ );
17
+ const p = d.exports;
18
+ export {
19
+ p as default
20
+ };
@@ -0,0 +1,30 @@
1
+ import { defineComponent as s, computed as u } from "vue";
2
+ import { InCodeSnippet as i } from "@useinsider/design-system-vue";
3
+ const m = /* @__PURE__ */ s({
4
+ __name: "CodeEditorField",
5
+ props: {
6
+ id: null,
7
+ label: null,
8
+ value: null,
9
+ placeholder: { default: "" },
10
+ error: { default: "" },
11
+ disabled: { type: Boolean, default: !1 }
12
+ },
13
+ emits: ["input"],
14
+ setup(t, { expose: n, emit: d }) {
15
+ const l = t;
16
+ let e = null;
17
+ const a = u(() => ({
18
+ mode: "liquid",
19
+ lint: !1,
20
+ foldGutter: !1,
21
+ placeholder: l.placeholder
22
+ })), r = (p) => {
23
+ e = p;
24
+ }, o = () => (e == null ? void 0 : e.state.doc.toString()) ?? l.value;
25
+ return n({ read: o }), { __sfc: !0, props: l, emit: d, view: e, options: a, onReady: r, read: o, InCodeSnippet: i };
26
+ }
27
+ });
28
+ export {
29
+ m as default
30
+ };
@@ -0,0 +1,30 @@
1
+ import a from "./DisplayConditionCreateDrawer.vue2.js";
2
+ /* empty css */
3
+ import r from "../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var n = function() {
5
+ var i = this, t = i._self._c, e = i._self._setupProxy;
6
+ return t(e.WpDrawer, { attrs: { id: "guido__display-condition-create-drawer", "description-status": "", "class-name": "guido-display-condition-create-drawer", size: "large", "close-on-outside-click": !1, "description-text": e.descriptionText, "footer-button-group-options": e.footerButtonGroupOptions, status: e.store.isCreateOpen, "title-text": e.trans(`${e.KEY}.create-title`) }, on: { cancelOrBackButtonEvent: e.close, onCloseEvent: e.close, primaryButtonEvent: function(o) {
7
+ return e.submit("inline");
8
+ }, secondaryButtonEvent: function(o) {
9
+ return e.submit("save");
10
+ } } }, [t("div", { staticClass: "guido-display-condition-create" }, [t(e.InBasicTextInput, { staticClass: "mb-4 w-1", attrs: { id: "guido__display-condition-name-input", name: "displayConditionName", "character-counter-status": !1, "disabled-status": e.isSaving, "label-text": e.trans(`${e.KEY}.condition-name`), "max-character-length": e.DISPLAY_CONDITION_LIMITS.NAME_MAX, "placeholder-text": e.trans(`${e.KEY}.condition-name-placeholder`), "state-message": e.errors.name || "", states: e.errors.name ? "error" : "default", "tooltip-status": !1, value: e.draft.name }, on: { input: function(o) {
11
+ return e.updateField("name", o);
12
+ } } }), t(e.InBasicTextInput, { staticClass: "mb-4 w-1", attrs: { id: "guido__display-condition-description-input", name: "displayConditionDescription", "character-counter-status": !1, "disabled-status": e.isSaving, "label-text": e.descriptionLabel, "max-character-length": e.DISPLAY_CONDITION_LIMITS.DESCRIPTION_MAX, "placeholder-text": e.trans(`${e.KEY}.condition-description-placeholder`), "state-message": e.errors.description || "", states: e.errors.description ? "error" : "default", "tooltip-status": !1, value: e.draft.description }, on: { input: function(o) {
13
+ return e.updateField("description", o);
14
+ } } }), t("div", { staticClass: "guido-display-condition-create__separator" }), t("p", { staticClass: "guido-display-condition-create__method-title" }, [i._v(" " + i._s(e.trans(`${e.KEY}.select-method`)) + " ")]), t("div", { staticClass: "guido-display-condition-create__methods" }, [t(e.InRadioButton, { attrs: { id: "guido__display-condition-method-logic-builder", disable: "", disabled: "", name: "displayConditionMethod", selected: "codeOnly", value: "logicBuilder", label: e.trans(`${e.KEY}.logic-builder`) } }), t(e.InRadioButton, { attrs: { id: "guido__display-condition-method-code-only", name: "displayConditionMethod", selected: "codeOnly", value: "codeOnly", label: e.trans(`${e.KEY}.code-only`) } })], 1), t(e.CodeEditorField, { ref: "codeBeforeRef", staticClass: "mb-3", attrs: { id: "guido__display-condition-code-before", disabled: e.isSaving, error: e.errors.codeBefore, label: e.trans(`${e.KEY}.code-before`), placeholder: e.trans(`${e.KEY}.code-placeholder`), value: e.draft.codeBefore }, on: { input: function(o) {
15
+ return e.updateField("codeBefore", o);
16
+ } } }), t(e.CodeEditorField, { ref: "codeAfterRef", attrs: { id: "guido__display-condition-code-after", disabled: e.isSaving, error: e.errors.codeAfter, label: e.trans(`${e.KEY}.code-after`), placeholder: e.trans(`${e.KEY}.code-placeholder`), value: e.draft.codeAfter }, on: { input: function(o) {
17
+ return e.updateField("codeAfter", o);
18
+ } } })], 1)]);
19
+ }, s = [], d = /* @__PURE__ */ r(
20
+ a,
21
+ n,
22
+ s,
23
+ !1,
24
+ null,
25
+ "a4b2ccb9"
26
+ );
27
+ const f = d.exports;
28
+ export {
29
+ f as default
30
+ };
@@ -0,0 +1,71 @@
1
+ import { defineComponent as D, reactive as $, ref as s, watch as C, computed as u } from "vue";
2
+ import O from "../../wrappers/WpDrawer.vue.js";
3
+ import { useDisplayConditions as T } from "../../../composables/useDisplayConditions.js";
4
+ import { useTranslations as L } from "../../../composables/useTranslations.js";
5
+ import { ACADEMY_LINKS as x } from "../../../enums/academy.js";
6
+ import { DISPLAY_CONDITION_LIMITS as h } from "../../../enums/display-condition.js";
7
+ import { useDisplayConditionStore as k } from "../../../stores/display-condition.js";
8
+ import { InRadioButton as N, InBasicTextInput as w } from "@useinsider/design-system-vue";
9
+ import E from "./CodeEditorField.vue.js";
10
+ const J = /* @__PURE__ */ D({
11
+ __name: "DisplayConditionCreateDrawer",
12
+ setup(Y) {
13
+ const r = "email-editor.display-conditions", i = L(), c = k(), { validate: p, notifyInvalid: l, createInline: f, createAndSave: m, cancel: y } = T(), d = () => ({ name: "", description: "", codeBefore: "", codeAfter: "" }), e = $(d()), o = s({}), a = s(!1), v = s(), _ = s();
14
+ C(() => c.isCreateOpen, (n) => {
15
+ if (!n)
16
+ return;
17
+ const { editing: t } = c;
18
+ Object.assign(e, t ? {
19
+ name: t.name,
20
+ description: t.description,
21
+ codeBefore: t.beforeScript,
22
+ codeAfter: t.afterScript
23
+ } : d()), o.value = {}, a.value = !1;
24
+ }, { immediate: !0 });
25
+ const g = u(() => i(`${r}.create-description`, {
26
+ academyLink: `<a href="${x.EMAIL_DISPLAY_CONDITIONS}" class="guido-display-condition-academy" target="_blank">${i(`${r}.academy`)}</a>`
27
+ })), S = u(() => ({
28
+ cancelOrBackButton: {
29
+ styling: "ghost",
30
+ type: "secondary",
31
+ labelText: i(`${r}.cancel`),
32
+ disabledStatus: a.value
33
+ },
34
+ secondaryButton: {
35
+ styling: "solid",
36
+ type: "subtle-primary",
37
+ labelText: i(`${r}.create-and-save`),
38
+ loadingStatus: a.value
39
+ },
40
+ primaryButton: {
41
+ styling: "solid",
42
+ type: "primary",
43
+ labelText: i(`${r}.create`),
44
+ disabledStatus: a.value
45
+ }
46
+ })), B = (n, t) => {
47
+ t !== e[n] && (e[n] = t, o.value[n] && (o.value = { ...o.value, [n]: void 0 }));
48
+ }, A = u(() => `${i(`${r}.condition-description`)} <span class="guido-display-condition-create__optional">(${i(`${r}.optional`)})</span>`);
49
+ return { __sfc: !0, KEY: r, trans: i, store: c, validate: p, notifyInvalid: l, createInline: f, createAndSave: m, cancel: y, emptyDraft: d, draft: e, errors: o, isSaving: a, codeBeforeRef: v, codeAfterRef: _, descriptionText: g, footerButtonGroupOptions: S, updateField: B, descriptionLabel: A, submit: async (n) => {
50
+ var I, b;
51
+ if (a.value)
52
+ return;
53
+ if (e.codeBefore = ((I = v.value) == null ? void 0 : I.read()) ?? e.codeBefore, e.codeAfter = ((b = _.value) == null ? void 0 : b.read()) ?? e.codeAfter, o.value = p(e), Object.keys(o.value).length) {
54
+ l();
55
+ return;
56
+ }
57
+ if (n === "inline") {
58
+ f({ ...e });
59
+ return;
60
+ }
61
+ a.value = !0;
62
+ const t = await m({ ...e });
63
+ a.value = !1, o.value = t ?? {}, Object.keys(o.value).length && l();
64
+ }, close: () => {
65
+ a.value || y();
66
+ }, WpDrawer: O, DISPLAY_CONDITION_LIMITS: h, InBasicTextInput: w, InRadioButton: N, CodeEditorField: E };
67
+ }
68
+ });
69
+ export {
70
+ J as default
71
+ };