@useinsider/guido 3.18.1-beta.e39fb14 → 3.18.1-beta.e489d08

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 (67) hide show
  1. package/README.md +0 -1
  2. package/dist/@types/config/schemas.js +26 -28
  3. package/dist/components/Guido.vue.js +6 -6
  4. package/dist/components/Guido.vue2.js +70 -72
  5. package/dist/components/organisms/AutoSaveController.vue2.js +8 -9
  6. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +13 -11
  7. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +65 -53
  8. package/dist/components/organisms/header/EditorActions.vue.js +2 -2
  9. package/dist/components/organisms/header/EditorActions.vue2.js +56 -86
  10. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  11. package/dist/components/organisms/header/LeftSlot.vue2.js +12 -16
  12. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +20 -18
  13. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
  14. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +47 -0
  15. package/dist/components/wrappers/WpDrawer.vue.js +7 -9
  16. package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
  17. package/dist/composables/useCustomInterfaceAppearance.js +46 -41
  18. package/dist/composables/useHtmlCompiler.js +26 -37
  19. package/dist/composables/useHtmlValidator.js +84 -81
  20. package/dist/composables/useRecommendation.js +21 -18
  21. package/dist/composables/useSave.js +45 -90
  22. package/dist/composables/useStripo.js +7 -7
  23. package/dist/composables/validators/useCouponBlockValidator.js +21 -24
  24. package/dist/composables/validators/useUnsubscribeBlockValidator.js +27 -34
  25. package/dist/enums/extensions/recommendationBlock.js +38 -31
  26. package/dist/extensions/Blocks/Recommendation/block.js +43 -39
  27. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +62 -57
  28. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +80 -52
  29. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +145 -75
  30. package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +21 -12
  31. package/dist/guido.css +1 -1
  32. package/dist/src/@types/config/schemas.d.ts +0 -4
  33. package/dist/src/components/Guido.vue.d.ts +1 -17
  34. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -17
  35. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -17
  36. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -17
  37. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +3 -4
  38. package/dist/src/composables/useConfig.d.ts +0 -2
  39. package/dist/src/composables/useHtmlValidator.d.ts +0 -21
  40. package/dist/src/composables/useSave.d.ts +1 -6
  41. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +0 -3
  42. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +0 -10
  43. package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
  44. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -0
  45. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +9 -0
  46. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +59 -3
  47. package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +4 -0
  48. package/dist/src/stores/config.d.ts +0 -30
  49. package/dist/src/stores/onboarding.d.ts +377 -0
  50. package/dist/src/utils/templatePreparation.d.ts +0 -30
  51. package/dist/static/styles/components/recommendation-strategy.css.js +51 -4
  52. package/dist/stores/config.js +22 -39
  53. package/dist/stores/onboarding.js +41 -36
  54. package/dist/utils/templatePreparation.js +47 -50
  55. package/package.json +1 -1
  56. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +0 -20
  57. package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +0 -48
  58. package/dist/composables/useSaveValidation.js +0 -279
  59. package/dist/composables/useSaveValidationRollout.js +0 -9
  60. package/dist/enums/save-validation.js +0 -4
  61. package/dist/src/@types/save-validation.d.ts +0 -19
  62. package/dist/src/composables/useSaveValidation.d.ts +0 -6
  63. package/dist/src/composables/useSaveValidationRollout.d.ts +0 -3
  64. package/dist/src/enums/save-validation.d.ts +0 -27
  65. package/dist/src/stores/save-validation.d.ts +0 -22
  66. package/dist/stores/save-validation.js +0 -30
  67. /package/dist/src/components/organisms/{validation/ValidationErrorDrawer.vue.d.ts → onboarding/RecommendationStrategyOnboarding.vue.d.ts} +0 -0
@@ -1,100 +1,55 @@
1
- import { useActionsApi as W } from "./useActionsApi.js";
1
+ import { useActionsApi as T } from "./useActionsApi.js";
2
2
  import { useConfig as q } from "./useConfig.js";
3
- import { useEditorLock as O } from "./useEditorLock.js";
4
- import { useSaveStart as D, useSaveComplete as F } from "./useGuidoActions.js";
5
- import { useSaveValidation as j } from "./useSaveValidation.js";
6
- import { useSaveValidationRollout as z } from "./useSaveValidationRollout.js";
7
- import { useSyncModuleExtractor as G } from "./useSyncModuleExtractor.js";
8
- import { ToasterTypeOptions as I } from "../enums/toaster.js";
9
- import { useStripoApi as J } from "../services/stripoApi.js";
10
- import { useConfigStore as K } from "../stores/config.js";
11
- import { useDynamicContentStore as N } from "../stores/dynamic-content.js";
12
- import { useSaveValidationStore as Q } from "../stores/save-validation.js";
13
- import { useTemplatePreparation as X, getHtmlReferencedUnsubscribePages as Y } from "../utils/templatePreparation.js";
14
- import { useAllowlist as Z } from "./useAllowlist.js";
15
- import { useHtmlValidator as _ } from "./useHtmlValidator.js";
16
- import { useToaster as $ } from "./useToaster.js";
17
- import { useCouponBlockValidator as tt } from "./validators/useCouponBlockValidator.js";
18
- import { useLiquidValidator as et } from "./validators/useLiquidValidator.js";
19
- import { useSyncModuleBlockValidator as ot } from "./validators/useSyncModuleBlockValidator.js";
20
- import { useUnsubscribeBlockValidator as st } from "./validators/useUnsubscribeBlockValidator.js";
21
- const Bt = () => {
22
- const r = D(), f = F(), { validateHtml: p } = _(), { validateLiquidSyntax: v } = et(), { validateCouponBlockTags: y } = tt(), { validateUnsubscribeBlockUniqueness: S, validateUnsubscribeBlockHasTemplate: w } = st(), { validateSyncModuleBlocks: u } = ot(), { callbacks: a, isFeatureEnabled: m } = q(), { extractSyncModuleData: b } = G(), { setSyncModuleUnsubscriptionPages: g } = J(), { editorSave: E, getTemplateData: H } = W(), { showToaster: V } = $(), { getBlockedDomains: x, resolveToast: k } = Z(), { prepareTemplateDetails: d } = X(), { collectSaveValidationErrors: C } = j(), { isEnabled: B } = z(), T = Q(), h = N(), P = K(), { runExclusive: n } = O(), l = async (t, e, o) => {
23
- if (!m("allowlistEnabled"))
24
- return !1;
25
- const i = await x(t, e);
26
- if (!i.length)
27
- return !1;
28
- if (!o) {
29
- const s = await k(i);
30
- s != null && s.message && V({
31
- type: I.Warning,
32
- message: s.message,
33
- actionButton: s.actionButton
34
- });
35
- }
36
- return !0;
37
- }, L = async (t) => !y(t.compiledHtml) || !S(t.compiledHtml) || !w(t.compiledHtml) ? !1 : m("liquidSyntax") ? v(t.compiledHtml) : p(t.compiledHtml, t.dynamicContentList, !0), c = async (t, e) => {
38
- if (!await E())
3
+ import { useEditorLock as C } from "./useEditorLock.js";
4
+ import { useSaveStart as L, useSaveComplete as M } from "./useGuidoActions.js";
5
+ import { useSyncModuleExtractor as D } from "./useSyncModuleExtractor.js";
6
+ import { ToasterTypeOptions as P } from "../enums/toaster.js";
7
+ import { useStripoApi as U } from "../services/stripoApi.js";
8
+ import { useTemplatePreparation as A } from "../utils/templatePreparation.js";
9
+ import { useAllowlist as h } from "./useAllowlist.js";
10
+ import { useHtmlValidator as F } from "./useHtmlValidator.js";
11
+ import { useToaster as O } from "./useToaster.js";
12
+ import { useCouponBlockValidator as W } from "./validators/useCouponBlockValidator.js";
13
+ import { useLiquidValidator as j } from "./validators/useLiquidValidator.js";
14
+ import { useSyncModuleBlockValidator as z } from "./validators/useSyncModuleBlockValidator.js";
15
+ import { useUnsubscribeBlockValidator as G } from "./validators/useUnsubscribeBlockValidator.js";
16
+ const rt = () => {
17
+ const n = L(), c = M(), { validateHtml: d } = F(), { validateLiquidSyntax: m } = j(), { validateCouponBlockTags: u } = W(), { validateUnsubscribeBlockUniqueness: p, validateUnsubscribeBlockHasTemplate: f } = G(), { validateSyncModuleBlocks: v } = z(), { callbacks: s, isFeatureEnabled: r } = q(), { extractSyncModuleData: S } = D(), { setSyncModuleUnsubscriptionPages: b } = U(), { editorSave: w } = T(), { showToaster: V } = O(), { getBlockedDomains: y, resolveToast: k } = h(), { runExclusive: x } = C(), H = async (a, o) => {
18
+ var l;
19
+ n();
20
+ const { prepareTemplateDetails: B } = A(), t = await B();
21
+ if (!v(t.rawHtml, o) || !u(t.compiledHtml) || !p(t.compiledHtml) || !f(t.compiledHtml))
39
22
  return;
40
- const { unsubscribePayload: i, stripoModules: s } = b(t.rawHtml);
41
- if (await g(i), t.modules = s, !e.suppress) {
42
- const R = e.blankCompiled ? { compiledHtml: "", ampHtml: "" } : {};
43
- f({ ...t, ...R, silent: e.silent });
44
- }
45
- return t;
46
- }, U = async (t, e) => {
47
- var i;
48
- r();
49
- const o = await d();
50
- if (u(o.rawHtml, e)) {
51
- if (B.value && !e) {
52
- const s = await C(
53
- o.compiledHtml,
54
- o.dynamicContentList
55
- );
56
- if (s.length) {
57
- T.open(s, "save");
58
- return;
59
- }
60
- } else if (!await L(o))
23
+ if (r("liquidSyntax")) {
24
+ if (!await m(t.compiledHtml))
61
25
  return;
62
- if (!((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(o)) && !await l(o.compiledHtml, o.css, e))
63
- return c(o, { silent: e, suppress: t });
64
- }
65
- }, A = async () => {
66
- var e;
67
- if (!P.allowSaveWithErrors)
26
+ } else if (!await d(t.compiledHtml, t.dynamicContentList, !0))
68
27
  return;
69
- r();
70
- const t = await d();
71
- if (!((e = a.value) != null && e.externalValidation && !await a.value.externalValidation(t)) && !await l(t.compiledHtml, t.css, !1))
72
- return c(t, { silent: !1, blankCompiled: !0 });
73
- }, M = async () => {
74
- r();
75
- const { html: t, css: e } = await H();
76
- if (!u(t, !0) || await l(t, e, !0))
28
+ if ((l = s.value) != null && l.externalValidation && !await s.value.externalValidation(t))
77
29
  return;
78
- const o = Y(t), i = {
79
- dynamicContentList: h.getSelectedDynamicContentList,
80
- compiledHtml: "",
81
- rawHtml: t,
82
- css: e,
83
- ampHtml: "",
84
- ampErrors: [],
85
- modules: [],
86
- recommendation: { campaignUrls: {}, configs: {} },
87
- unsubscribe: {
88
- status: o.length > 0,
89
- config: o
30
+ if (r("allowlistEnabled")) {
31
+ const i = await y(t.compiledHtml, t.css);
32
+ if (i.length) {
33
+ if (!o) {
34
+ const e = await k(i);
35
+ e != null && e.message && V({
36
+ type: P.Warning,
37
+ message: e.message,
38
+ actionButton: e.actionButton
39
+ });
40
+ }
41
+ return;
90
42
  }
91
- };
92
- return c(i, { silent: !0 });
43
+ }
44
+ if (!await w())
45
+ return;
46
+ const { unsubscribePayload: E, stripoModules: g } = S(t.rawHtml);
47
+ return await b(E), t.modules = g, a || c({ ...t, silent: o }), t;
93
48
  };
94
- return { save: (t = !1, e = !1) => n(
95
- () => U(t, e)
96
- ), saveWithErrors: () => n(A), saveRawOnly: () => n(M) };
49
+ return { save: (a = !1, o = !1) => x(
50
+ () => H(a, o)
51
+ ) };
97
52
  };
98
53
  export {
99
- Bt as useSave
54
+ rt as useSave
100
55
  };
@@ -16,7 +16,7 @@ import { useEditorStore as b } from "../stores/editor.js";
16
16
  import { buildMergeTagEntries as W, flattenDynamicContentList as Y } from "../utils/genericUtil.js";
17
17
  import Z from "../package.json.js";
18
18
  let n = null;
19
- const Ce = () => {
19
+ const he = () => {
20
20
  const { features: c, template: u, isFeatureEnabled: m } = q(), { handleError: p, showToaster: k } = G(), { getToken: B, getCustomFonts: M, getSyncModulesStatus: T } = K(), { handleEvent: v } = z(), { handleModuleAdd: F } = j(), { getStripoBlocksConfig: A } = O(), { getStripoNotifications: V } = $(), f = () => n || (n = new Promise((i, s) => {
21
21
  var d;
22
22
  if (document.getElementById("UiEditorScript")) {
@@ -31,8 +31,8 @@ const Ce = () => {
31
31
  n = null;
32
32
  }), n), _ = async (i, s, o, a = [], r = !1) => {
33
33
  var y, E, h, C;
34
- const e = b(), { html: d, css: D } = i, { baseBlocks: g, extensions: R } = await A(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, P = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, U = !!d || (((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1);
35
- await window.UIEditor.initEditor(
34
+ const e = b(), { html: d, css: D } = i, { baseBlocks: g, extensions: R } = await A(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, P = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, U = !!d || (((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1), I = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
35
+ H().importCss(), await window.UIEditor.initEditor(
36
36
  document.querySelector("#guido-editor"),
37
37
  {
38
38
  metadata: s,
@@ -62,7 +62,7 @@ const Ce = () => {
62
62
  displayUTM: !1,
63
63
  selectElementAfterDrop: !0,
64
64
  sameFontSizeForOutlook: !0,
65
- allowedScriptSourceDomains: "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com",
65
+ allowedScriptSourceDomains: I,
66
66
  ...g ? { baseBlocks: g } : {},
67
67
  editorFonts: {
68
68
  showDefaultStandardFonts: !0,
@@ -88,8 +88,8 @@ const Ce = () => {
88
88
  },
89
89
  onTemplateLoaded() {
90
90
  try {
91
- const { importCss: t } = H(), { activateCustomViewStyles: l, updateTimerInClonedTemplate: I } = L(), { injectFullStory: x } = N();
92
- t(), l(), x(), I(), o.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
91
+ const { activateCustomViewStyles: t, updateTimerInClonedTemplate: l } = L(), { injectFullStory: x } = N();
92
+ t(), x(), l(), o.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
93
93
  e.hasChanges = !1;
94
94
  }, 1e3);
95
95
  } catch (t) {
@@ -146,5 +146,5 @@ const Ce = () => {
146
146
  } };
147
147
  };
148
148
  export {
149
- Ce as useStripo
149
+ he as useStripo
150
150
  };
@@ -1,27 +1,24 @@
1
- import { ToasterTypeOptions as n } from "../../enums/toaster.js";
2
- import { COUPON_PLACEHOLDER_DEFAULT as s, COUPON_PLACEHOLDER_LIQUID as a } from "../../extensions/Blocks/CouponBlock/template.js";
3
- import { useToaster as i } from "../useToaster.js";
4
- import { useTranslations as l } from "../useTranslations.js";
5
- const c = /* @__PURE__ */ new Set([
6
- s,
7
- a
8
- ]), p = "newsletter.coupon-tag-modified";
9
- function u(r) {
10
- const e = new DOMParser().parseFromString(r, "text/html");
11
- return Array.from(e.querySelectorAll(".coupon-block")).map((o) => {
12
- var t;
13
- return ((t = o.textContent) == null ? void 0 : t.trim()) ?? "";
14
- }).filter((o) => !c.has(o));
15
- }
16
- const T = () => {
17
- const { showToaster: r } = i(), e = l();
18
- return { validateCouponBlockTags: (t) => u(t).length > 0 ? (r({
19
- type: n.Warning,
20
- message: e(p)
21
- }), !1) : !0 };
1
+ import { ToasterTypeOptions as c } from "../../enums/toaster.js";
2
+ import { COUPON_PLACEHOLDER_DEFAULT as i, COUPON_PLACEHOLDER_LIQUID as l } from "../../extensions/Blocks/CouponBlock/template.js";
3
+ import { useToaster as m } from "../useToaster.js";
4
+ import { useTranslations as p } from "../useTranslations.js";
5
+ const u = /* @__PURE__ */ new Set([
6
+ i,
7
+ l
8
+ ]), A = () => {
9
+ const { showToaster: t } = m(), r = p();
10
+ return { validateCouponBlockTags: (e) => {
11
+ const n = new DOMParser().parseFromString(e, "text/html");
12
+ return Array.from(n.querySelectorAll(".coupon-block")).find((s) => {
13
+ var o;
14
+ const a = ((o = s.textContent) == null ? void 0 : o.trim()) ?? "";
15
+ return !u.has(a);
16
+ }) ? (t({
17
+ type: c.Warning,
18
+ message: r("newsletter.coupon-tag-modified")
19
+ }), !1) : !0;
20
+ } };
22
21
  };
23
22
  export {
24
- p as COUPON_TAG_MODIFIED_KEY,
25
- u as findInvalidCouponBlocks,
26
- T as useCouponBlockValidator
23
+ A as useCouponBlockValidator
27
24
  };
@@ -1,8 +1,8 @@
1
- import { ToasterTypeOptions as c } from "../../enums/toaster.js";
1
+ import { ToasterTypeOptions as i } from "../../enums/toaster.js";
2
2
  import { PAGE_TYPES as u } from "../../enums/unsubscribe.js";
3
- import { UNSUBSCRIBE_BLOCK_SELECTOR as i, DATA_ATTRIBUTES as a } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
4
- import { useToaster as p } from "../useToaster.js";
5
- import { useTranslations as l } from "../useTranslations.js";
3
+ import { UNSUBSCRIBE_BLOCK_SELECTOR as l, DATA_ATTRIBUTES as a } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
4
+ import { useToaster as E } from "../useToaster.js";
5
+ import { useTranslations as m } from "../useTranslations.js";
6
6
  const T = [
7
7
  {
8
8
  pageType: u.GLOBAL_UNSUBSCRIBE,
@@ -12,37 +12,30 @@ const T = [
12
12
  pageType: u.SUBSCRIPTION_PREFERENCE_CENTER,
13
13
  messageKey: "unsubscription-preference.duplicate-pref-center"
14
14
  }
15
- ], g = "unsubscription-preference.duplicate-both", E = "unsubscription-preference.select-page-to-continue";
16
- function m(r) {
17
- const s = new DOMParser().parseFromString(r, "text/html"), t = /* @__PURE__ */ new Map();
18
- return s.querySelectorAll(i).forEach((n) => {
19
- const e = Number(n.getAttribute(a.PAGE_TYPE));
20
- t.set(e, (t.get(e) ?? 0) + 1);
21
- }), T.filter((n) => (t.get(n.pageType) ?? 0) > 1);
22
- }
23
- function b(r) {
24
- const s = new DOMParser().parseFromString(r, "text/html");
25
- return Array.from(s.querySelectorAll(i)).filter((t) => {
26
- const n = t.getAttribute(a.PAGE_TYPE), e = t.getAttribute(a.PAGE_LIST);
27
- return !n || !e;
28
- }).length;
29
- }
30
- const y = () => {
31
- const { showToaster: r } = p(), s = l();
32
- return { validateUnsubscribeBlockUniqueness: (e) => {
33
- const o = m(e);
34
- return o.length ? (r({
35
- type: c.Error,
36
- message: s(o.length > 1 ? g : o[0].messageKey)
15
+ ], g = "unsubscription-preference.duplicate-both", b = "unsubscription-preference.select-page-to-continue", P = () => {
16
+ const { showToaster: c } = E(), p = m();
17
+ return { validateUnsubscribeBlockUniqueness: (n) => {
18
+ const o = new DOMParser().parseFromString(n, "text/html"), r = /* @__PURE__ */ new Map();
19
+ o.querySelectorAll(l).forEach((e) => {
20
+ const s = Number(e.getAttribute(a.PAGE_TYPE));
21
+ r.set(s, (r.get(s) ?? 0) + 1);
22
+ });
23
+ const t = T.filter((e) => (r.get(e.pageType) ?? 0) > 1).map((e) => e.messageKey);
24
+ return t.length ? (c({
25
+ type: i.Error,
26
+ message: p(t.length > 1 ? g : t[0])
37
27
  }), !1) : !0;
38
- }, validateUnsubscribeBlockHasTemplate: (e) => b(e) === 0 ? !0 : (r({
39
- type: c.Warning,
40
- message: s(E)
41
- }), !1) };
28
+ }, validateUnsubscribeBlockHasTemplate: (n) => {
29
+ const o = new DOMParser().parseFromString(n, "text/html");
30
+ return Array.from(o.querySelectorAll(l)).some((t) => {
31
+ const e = t.getAttribute(a.PAGE_TYPE), s = t.getAttribute(a.PAGE_LIST);
32
+ return !e || !s;
33
+ }) ? (c({
34
+ type: i.Warning,
35
+ message: p(b)
36
+ }), !1) : !0;
37
+ } };
42
38
  };
43
39
  export {
44
- E as EMPTY_BLOCK_KEY,
45
- b as countUnsubBlocksWithoutPage,
46
- m as findDuplicateUnsubPageTypes,
47
- y as useUnsubscribeBlockValidator
40
+ P as useUnsubscribeBlockValidator
48
41
  };
@@ -1,14 +1,20 @@
1
- import { useTranslations as r } from "../../composables/useTranslations.js";
2
- const l = {
1
+ import { useTranslations as n } from "../../composables/useTranslations.js";
2
+ const o = {
3
3
  RECOMMENDATION_API_URL: "https://recommendationv2.api.useinsider.com",
4
4
  // Relative path → same-origin as the embedding inone dashboard.
5
5
  PRODUCT_ATTRIBUTES_PATH: "/product-attributes/get-attributes",
6
6
  RECOMMENDATION_STRATEGIES_PATH: "/api/recommendation-strategies",
7
- RECOMMENDATION_STRATEGIES_PANEL_PATH: "/discovery/recommendation-strategies"
8
- }, c = {
7
+ RECOMMENDATION_STRATEGIES_PANEL_PATH: "/discovery/recommendation-strategies",
8
+ // Smart Recommender hides the Email channel unless the URL asks for it, so a strategy created
9
+ // without this flag can never be Email-suitable and would never reach the editor's list.
10
+ RECOMMENDATION_STRATEGY_CREATE_PATH: "/discovery/recommendation-strategies/create?isEmail=true"
11
+ }, d = (e) => {
12
+ const { RECOMMENDATION_STRATEGIES_PANEL_PATH: r } = o;
13
+ return `${r}/${e}/edit`;
14
+ }, m = {
9
15
  CLIENT_ID: "clientId"
10
- }, d = () => {
11
- const e = r();
16
+ }, p = () => {
17
+ const e = n();
12
18
  return [
13
19
  {
14
20
  id: 11,
@@ -71,14 +77,14 @@ const l = {
71
77
  path: "top-sellers"
72
78
  }
73
79
  ];
74
- }, m = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], p = [
80
+ }, v = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], h = [
75
81
  { text: "before the amount", value: "0" },
76
82
  { text: "after the amount", value: "1" }
77
- ], v = [
83
+ ], x = [
78
84
  { text: "dot(.)", value: "." },
79
85
  { text: "comma(,)", value: "," },
80
86
  { text: "space( )", value: " " }
81
- ], h = [
87
+ ], b = [
82
88
  { text: "0", value: "0" },
83
89
  { text: "1", value: "1" },
84
90
  { text: "2", value: "2" },
@@ -90,54 +96,55 @@ const l = {
90
96
  { text: "contains", value: "~" },
91
97
  { text: "does not contain", value: "!~" },
92
98
  { text: "any of", value: a }
93
- ], n = [
99
+ ], s = [
94
100
  { text: "is exactly", value: "=" },
95
101
  { text: "is not exactly", value: "!==" },
96
102
  { text: "contains", value: "~" },
97
103
  { text: "does not contain", value: "!~" },
98
104
  { text: "any of", value: a }
99
- ], o = [
105
+ ], i = [
100
106
  { text: "is equal to", value: "=" },
101
107
  { text: "is greater than", value: ">" },
102
108
  { text: "is less than", value: "<" }
103
- ], s = [
109
+ ], u = [
104
110
  { text: "is equal to", value: "=" },
105
111
  { text: "after", value: ">" },
106
112
  { text: "before", value: "<" }
107
- ], i = [
113
+ ], c = [
108
114
  { text: "true", value: "==" },
109
115
  { text: "false", value: "!=" }
110
- ], x = (e) => {
116
+ ], g = (e) => {
111
117
  if (!e)
112
118
  return t;
113
119
  switch (e) {
114
120
  case "Boolean":
115
- return i;
121
+ return c;
116
122
  case "Date":
117
- return s;
123
+ return u;
118
124
  case "Number":
119
- return o;
125
+ return i;
120
126
  case "String":
121
127
  return t;
122
128
  case "Strings":
123
- return n;
129
+ return s;
124
130
  default:
125
131
  return t;
126
132
  }
127
133
  };
128
134
  export {
129
135
  a as OP_ANY_OF,
130
- m as PriceAttributes,
131
- c as QUERY_PARAMS,
132
- l as URLS,
133
- h as currencyDecimalCounts,
134
- p as currencyLocationMaps,
135
- v as currencyOperators,
136
- x as getOperatorOptions,
137
- d as getRecommendationFeedSourceMaps,
138
- n as operatorOptionsForArrayOfStrings,
139
- i as operatorOptionsForBooleans,
140
- s as operatorOptionsForDates,
141
- o as operatorOptionsForNumbers,
142
- t as operatorOptionsForStrings
136
+ v as PriceAttributes,
137
+ m as QUERY_PARAMS,
138
+ o as URLS,
139
+ b as currencyDecimalCounts,
140
+ h as currencyLocationMaps,
141
+ x as currencyOperators,
142
+ g as getOperatorOptions,
143
+ p as getRecommendationFeedSourceMaps,
144
+ s as operatorOptionsForArrayOfStrings,
145
+ c as operatorOptionsForBooleans,
146
+ u as operatorOptionsForDates,
147
+ i as operatorOptionsForNumbers,
148
+ t as operatorOptionsForStrings,
149
+ d as strategyEditPath
143
150
  };
@@ -1,37 +1,37 @@
1
- var R = Object.defineProperty;
2
- var B = (a, c, t) => c in a ? R(a, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[c] = t;
3
- var p = (a, c, t) => B(a, typeof c != "symbol" ? c + "" : c, t);
4
- import { useConfig as D } from "../../../composables/useConfig.js";
5
- import { BlockId as y } from "../../../enums/block.js";
6
- import { getMigrationBannerHtml as C } from "../../../utils/migrationBannerHtml.js";
7
- import { Block as b, BlockCompositionType as A, ModificationDescription as g } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
8
- import { CURRENT_CONFIG_VERSION as E, PRE_RRS_CONFIG_VERSION as S } from "./constants/defaultConfig.js";
1
+ var D = Object.defineProperty;
2
+ var y = (l, c, t) => c in l ? D(l, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[c] = t;
3
+ var f = (l, c, t) => y(l, typeof c != "symbol" ? c + "" : c, t);
4
+ import { useConfig as C } from "../../../composables/useConfig.js";
5
+ import { BlockId as b } from "../../../enums/block.js";
6
+ import { getMigrationBannerHtml as A } from "../../../utils/migrationBannerHtml.js";
7
+ import { Block as E, BlockCompositionType as S, ModificationDescription as g } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
8
+ import { CURRENT_CONFIG_VERSION as N, PRE_RRS_CONFIG_VERSION as O } from "./constants/defaultConfig.js";
9
9
  import { RECOMMENDATION_ID_ATTR as m } from "./constants/selectors.js";
10
- import { regenerateMobileProductRows as N } from "./controls/main/utils.js";
11
- import { ensureMobileCssRulesExist as h, setMobileLayoutOptOut as f, hasMobileLayoutOptOut as O } from "./controls/mobileLayout/cssRules.js";
10
+ import { regenerateMobileProductRows as M } from "./controls/main/utils.js";
11
+ import { ensureMobileCssRulesExist as _, setMobileLayoutOptOut as I, hasMobileLayoutOptOut as w } from "./controls/mobileLayout/cssRules.js";
12
12
  import { RecommendationConfigService as s } from "./services/configService.js";
13
13
  import { useRecommendationExtensionStore as d } from "./store/recommendation.js";
14
- import { getDefaultTemplate as M } from "./templates/grid/template.js";
15
- import { useRecommendationBlockWarning as w } from "./useRecommendationBlockWarning.js";
16
- const _ = y.Recommendation, u = "recommendation-block-v2", I = "hide-price";
17
- let k = !1;
18
- class W extends b {
14
+ import { getDefaultTemplate as x } from "./templates/grid/template.js";
15
+ import { useRecommendationBlockWarning as H } from "./useRecommendationBlockWarning.js";
16
+ const k = b.Recommendation, u = "recommendation-block-v2", R = "hide-price";
17
+ let B = !1;
18
+ class j extends E {
19
19
  constructor() {
20
20
  super();
21
21
  /**
22
22
  * Stores the ID generated in getTemplate() so onCreated() can reuse it.
23
23
  * This avoids generating a new (different) ID in onCreated().
24
24
  */
25
- p(this, "_pendingBlockId", null);
25
+ f(this, "_pendingBlockId", null);
26
26
  }
27
27
  getId() {
28
- return _;
28
+ return k;
29
29
  }
30
30
  getIcon() {
31
31
  return "recommendation-icon";
32
32
  }
33
33
  getBlockCompositionType() {
34
- return A.CONTAINER;
34
+ return S.CONTAINER;
35
35
  }
36
36
  getName() {
37
37
  return this.api.translate("Recommendation Block");
@@ -42,8 +42,8 @@ class W extends b {
42
42
  );
43
43
  }
44
44
  getSettingsPanelTitleHtml() {
45
- return C(
46
- _,
45
+ return A(
46
+ k,
47
47
  this.api.translate("Recommendation Block"),
48
48
  this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.")
49
49
  );
@@ -66,7 +66,7 @@ class W extends b {
66
66
  */
67
67
  getTemplate() {
68
68
  const t = this._generateNextId();
69
- return this._pendingBlockId = t, M(t);
69
+ return this._pendingBlockId = t, x(t);
70
70
  }
71
71
  /**
72
72
  * Called when a new block is dropped into the template
@@ -89,23 +89,27 @@ class W extends b {
89
89
  }
90
90
  const i = this._pendingBlockId ?? this._generateNextId();
91
91
  this._pendingBlockId = null, this._assignRecommendationId(t, i);
92
- const { config: n, wasFreshDrop: o } = s.initializeConfig(
92
+ const n = C().isFeatureEnabled("reusableRecommendationStrategy"), o = n && !s.hasConfig(t), { config: r, wasFreshDrop: a } = s.initializeConfig(
93
93
  this.api,
94
94
  t,
95
95
  {
96
96
  recommendationId: i,
97
- configVersion: D().isFeatureEnabled("reusableRecommendationStrategy") ? E : S
97
+ configVersion: n ? N : O,
98
+ // An RRS block picks a strategy, not an algorithm, and its algorithm control is
99
+ // hidden. Keeping the `mostPopular` default would bake a most-popular feed URL
100
+ // at save for a block the user never configured.
101
+ ...o ? { strategy: "" } : {}
98
102
  }
99
- ), r = d();
100
- if (r.setCurrentBlock(i), this._stampHidePrice(t, n.priceHideIfSameAsDiscounted), o) {
101
- h(this.api);
102
- const l = this._getBlockElement(t);
103
- l && (f(this.api, l, !0), N({
103
+ ), p = d();
104
+ if (p.setCurrentBlock(i), this._stampHidePrice(t, r.priceHideIfSameAsDiscounted), a) {
105
+ _(this.api);
106
+ const h = this._getBlockElement(t);
107
+ h && (I(this.api, h, !0), M({
104
108
  currentNode: t,
105
109
  documentModifier: this.api.getDocumentModifier()
106
110
  }));
107
111
  }
108
- r.patchCurrentBlockConfig({ language: n.language }, { triggerRefetch: !1 }), this._warnIfMultipleBlocks();
112
+ p.patchCurrentBlockConfig({ language: r.language }, { triggerRefetch: !1 }), this._warnIfMultipleBlocks();
109
113
  }
110
114
  /**
111
115
  * Called when the document changes or template is loaded
@@ -127,11 +131,11 @@ class W extends b {
127
131
  }
128
132
  this._healLingeringDuplicate(t), s.needsMigration(t) && this._migrateFromLegacy(t), this._healHidePriceAttr(t);
129
133
  try {
130
- k || (h(this.api), k = !0);
134
+ B || (_(this.api), B = !0);
131
135
  const e = s.getConfig(t), i = this._getBlockElement(t);
132
136
  if (i) {
133
137
  const n = !e.mobileLayoutEnabled;
134
- O(i) !== n && f(this.api, i, n);
138
+ w(i) !== n && I(this.api, i, n);
135
139
  }
136
140
  } catch {
137
141
  }
@@ -161,7 +165,7 @@ class W extends b {
161
165
  */
162
166
  _warnIfMultipleBlocks() {
163
167
  try {
164
- w().warnIfMultipleBlocks(this.api.getDocumentRootHtmlNode());
168
+ H().warnIfMultipleBlocks(this.api.getDocumentRootHtmlNode());
165
169
  } catch {
166
170
  }
167
171
  }
@@ -211,9 +215,9 @@ class W extends b {
211
215
  if (!o)
212
216
  return;
213
217
  let r = -1;
214
- for (let l = 0; l < n.length; l++)
215
- if (n[l] === o) {
216
- r = l;
218
+ for (let a = 0; a < n.length; a++)
219
+ if (n[a] === o) {
220
+ r = a;
217
221
  break;
218
222
  }
219
223
  if (r <= 0)
@@ -293,7 +297,7 @@ class W extends b {
293
297
  */
294
298
  _stampHidePrice(t, e) {
295
299
  const i = this._getBlockElement(t);
296
- i && this.api.getDocumentModifier().modifyHtml(i).setAttribute(I, String(e)).apply(new g("Stamp hide-price"));
300
+ i && this.api.getDocumentModifier().modifyHtml(i).setAttribute(R, String(e)).apply(new g("Stamp hide-price"));
297
301
  }
298
302
  /**
299
303
  * Stamps `hide-price` from config only when the block lacks the attribute —
@@ -301,7 +305,7 @@ class W extends b {
301
305
  */
302
306
  _healHidePriceAttr(t) {
303
307
  const e = this._getBlockElement(t);
304
- if (!e || !("getAttribute" in e) || e.getAttribute(I) !== null)
308
+ if (!e || !("getAttribute" in e) || e.getAttribute(R) !== null)
305
309
  return;
306
310
  const { priceHideIfSameAsDiscounted: i } = s.getConfig(t);
307
311
  this._stampHidePrice(t, i);
@@ -338,6 +342,6 @@ class W extends b {
338
342
  }
339
343
  }
340
344
  export {
341
- _ as BLOCK_ID,
342
- W as RecommendationBlock
345
+ k as BLOCK_ID,
346
+ j as RecommendationBlock
343
347
  };