@useinsider/guido 3.19.0-beta.e110e88 → 3.19.0-beta.f05f865

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 (80) hide show
  1. package/README.md +1 -0
  2. package/dist/@types/config/schemas.js +102 -87
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +84 -76
  5. package/dist/components/organisms/AutoSaveController.vue2.js +9 -8
  6. package/dist/components/organisms/base/AuthErrorModal.vue.js +18 -0
  7. package/dist/components/organisms/base/AuthErrorModal.vue2.js +42 -0
  8. package/dist/components/organisms/header/EditorActions.vue.js +2 -2
  9. package/dist/components/organisms/header/EditorActions.vue2.js +90 -55
  10. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  11. package/dist/components/organisms/header/LeftSlot.vue2.js +16 -12
  12. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +20 -0
  13. package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +49 -0
  14. package/dist/components/wrappers/WpDrawer.vue.js +9 -7
  15. package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
  16. package/dist/components/wrappers/WpModal.vue.js +1 -1
  17. package/dist/components/wrappers/WpModal.vue2.js +4 -3
  18. package/dist/composables/useAuthError.js +52 -0
  19. package/dist/composables/useHtmlCompiler.js +37 -26
  20. package/dist/composables/useHtmlValidator.js +2 -0
  21. package/dist/composables/useHttp.js +64 -54
  22. package/dist/composables/useLegacyStrategyConversion.js +23 -19
  23. package/dist/composables/useSave.js +90 -45
  24. package/dist/composables/useSaveValidation.js +282 -0
  25. package/dist/composables/useSaveValidationRollout.js +9 -0
  26. package/dist/composables/useStripo.js +24 -20
  27. package/dist/composables/useToaster.js +17 -15
  28. package/dist/composables/validators/useCouponBlockValidator.js +24 -21
  29. package/dist/composables/validators/useLiquidValidator.js +15 -15
  30. package/dist/composables/validators/useUnsubscribeBlockValidator.js +34 -27
  31. package/dist/config/migrator/index.js +14 -13
  32. package/dist/config/migrator/recommendationPartnerMigrator.js +50 -0
  33. package/dist/enums/extensions/recommendationBlock.js +30 -29
  34. package/dist/enums/save-validation.js +4 -0
  35. package/dist/extensions/Blocks/Recommendation/block.js +21 -22
  36. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +97 -107
  37. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +72 -49
  38. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +203 -209
  39. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +67 -91
  40. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +21 -26
  41. package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +25 -0
  42. package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +16 -55
  43. package/dist/guido.css +1 -1
  44. package/dist/src/@types/config/schemas.d.ts +20 -0
  45. package/dist/src/@types/save-validation.d.ts +19 -0
  46. package/dist/src/components/Guido.vue.d.ts +17 -1
  47. package/dist/src/components/organisms/base/AuthErrorModal.vue.d.ts +2 -0
  48. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +17 -1
  49. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +17 -1
  50. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +17 -1
  51. package/dist/src/components/organisms/validation/ValidationErrorDrawer.vue.d.ts +2 -0
  52. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +4 -3
  53. package/dist/src/components/wrappers/WpModal.vue.d.ts +5 -1
  54. package/dist/src/composables/useAuthError.d.ts +12 -0
  55. package/dist/src/composables/useConfig.d.ts +4 -0
  56. package/dist/src/composables/useHtmlValidator.d.ts +21 -0
  57. package/dist/src/composables/useHttp.d.ts +2 -0
  58. package/dist/src/composables/useSave.d.ts +6 -1
  59. package/dist/src/composables/useSaveValidation.d.ts +6 -0
  60. package/dist/src/composables/useSaveValidationRollout.d.ts +3 -0
  61. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
  62. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +10 -0
  63. package/dist/src/config/migrator/index.d.ts +2 -1
  64. package/dist/src/config/migrator/recommendationPartnerMigrator.d.ts +19 -0
  65. package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -1
  66. package/dist/src/enums/save-validation.d.ts +27 -0
  67. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +0 -2
  68. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -13
  69. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
  70. package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +1 -3
  71. package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +33 -0
  72. package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +0 -7
  73. package/dist/src/stores/config.d.ts +52 -0
  74. package/dist/src/stores/save-validation.d.ts +22 -0
  75. package/dist/src/utils/templatePreparation.d.ts +30 -0
  76. package/dist/static/styles/components/recommendation-strategy.css.js +9 -0
  77. package/dist/stores/config.js +84 -67
  78. package/dist/stores/save-validation.js +30 -0
  79. package/dist/utils/templatePreparation.js +39 -36
  80. package/package.json +1 -1
@@ -1,13 +1,13 @@
1
- import { ToasterTypeOptions as a } from "../../enums/toaster.js";
1
+ import { ToasterTypeOptions as r } from "../../enums/toaster.js";
2
2
  import { base64EncodeWithSpecialChars as u } from "../../utils/base64.js";
3
3
  import { useHttp as d } from "../useHttp.js";
4
- import { useToaster as c } from "../useToaster.js";
5
- import { useTranslations as p } from "../useTranslations.js";
4
+ import { useToaster as p } from "../useToaster.js";
5
+ import { useTranslations as c } from "../useTranslations.js";
6
6
  const v = () => {
7
- const { post: i } = d(), { showToaster: e } = c(), s = p();
7
+ const { post: i } = d(), { showToaster: t } = p(), s = c();
8
8
  return { validateLiquidSyntax: async (o) => {
9
9
  try {
10
- const t = await i("/newsletter/contents/validate-syntax", [{
10
+ const e = await i("/newsletter/contents/validate-syntax", [{
11
11
  identifier: "default",
12
12
  syntax: "liquid",
13
13
  contents: {
@@ -17,21 +17,21 @@ const v = () => {
17
17
  ampHtml: null
18
18
  }
19
19
  }]);
20
- if (!Array.isArray(t.data)) {
21
- const l = t.data;
22
- return e({
23
- type: a.Warning,
20
+ if (!Array.isArray(e.data)) {
21
+ const l = e.data;
22
+ return t({
23
+ type: r.Warning,
24
24
  message: l.message ?? s("journey-builder.liquid-validation-failed")
25
25
  }), !1;
26
26
  }
27
- const [r] = t.data, n = Object.values((r == null ? void 0 : r.errors) ?? {});
28
- return n.length ? (e({
29
- type: a.Warning,
27
+ const [a] = e.data, n = Object.values((a == null ? void 0 : a.errors) ?? {});
28
+ return n.length ? (t({
29
+ type: r.Warning,
30
30
  message: n[0].replace(/^line \d+:\s*/, "")
31
31
  }), !1) : !0;
32
- } catch {
33
- return e({
34
- type: a.Error,
32
+ } catch (e) {
33
+ return e != null && e.authReported || t({
34
+ type: r.Error,
35
35
  message: s("journey-builder.liquid-validation-failed")
36
36
  }), !1;
37
37
  }
@@ -1,8 +1,8 @@
1
- import { ToasterTypeOptions as i } from "../../enums/toaster.js";
1
+ import { ToasterTypeOptions as c } from "../../enums/toaster.js";
2
2
  import { PAGE_TYPES as u } from "../../enums/unsubscribe.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";
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";
6
6
  const T = [
7
7
  {
8
8
  pageType: u.GLOBAL_UNSUBSCRIBE,
@@ -12,30 +12,37 @@ 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", 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])
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)
27
37
  }), !1) : !0;
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
- } };
38
+ }, validateUnsubscribeBlockHasTemplate: (e) => b(e) === 0 ? !0 : (r({
39
+ type: c.Warning,
40
+ message: s(E)
41
+ }), !1) };
38
42
  };
39
43
  export {
40
- P as useUnsubscribeBlockValidator
44
+ E as EMPTY_BLOCK_KEY,
45
+ b as countUnsubBlocksWithoutPage,
46
+ m as findDuplicateUnsubPageTypes,
47
+ y as useUnsubscribeBlockValidator
41
48
  };
@@ -1,16 +1,17 @@
1
- import { migrateCheckbox as t } from "./checkboxMigrator.js";
2
- import { migrateCouponBlock as i } from "./couponBlockMigrator.js";
3
- import { migrateItemsBlock as e } from "./itemsBlockMigrator.js";
4
- import { migrateProductNameLink as a } from "./productNameLinkMigrator.js";
5
- import { migrateRadioButton as n } from "./radioButtonMigrator.js";
6
- import { migrateRecommendation as c } from "./recommendationMigrator.js";
7
- import { migrateRecommendationTitle as g } from "./recommendationTitleMigrator.js";
8
- import { migrateSocialIcons as p } from "./socialIconMigrator.js";
9
- import { migrateUnsubscribe as f } from "./unsubscribeMigrator.js";
10
- const C = async (o, r = {}) => {
11
- let m = o;
12
- return m = t(m), m = n(m), m = await f(m), m = i(m), m = c(m, r), m = g(m), m = e(m), m = a(m), m = p(m), m;
1
+ import { migrateCheckbox as i } from "./checkboxMigrator.js";
2
+ import { migrateCouponBlock as e } from "./couponBlockMigrator.js";
3
+ import { migrateItemsBlock as a } from "./itemsBlockMigrator.js";
4
+ import { migrateProductNameLink as n } from "./productNameLinkMigrator.js";
5
+ import { migrateRadioButton as c } from "./radioButtonMigrator.js";
6
+ import { migrateRecommendation as g } from "./recommendationMigrator.js";
7
+ import { migrateRecommendationPartnerScope as f } from "./recommendationPartnerMigrator.js";
8
+ import { migrateRecommendationTitle as p } from "./recommendationTitleMigrator.js";
9
+ import { migrateSocialIcons as d } from "./socialIconMigrator.js";
10
+ import { migrateUnsubscribe as l } from "./unsubscribeMigrator.js";
11
+ const h = async (r, t = {}, o) => {
12
+ let m = r;
13
+ return m = i(m), m = c(m), m = await l(m), m = e(m), m = g(m, t), o && (m = f(m, o)), m = p(m), m = a(m), m = n(m), m = d(m), m;
13
14
  };
14
15
  export {
15
- C as migrate
16
+ h as migrate
16
17
  };
@@ -0,0 +1,50 @@
1
+ import { RECOMMENDATION_ID_ATTR as f, SELECTOR_ATTRIBUTE_ROW as _, ATTR_DATA_ATTRIBUTE_TYPE as a, ATTR_CUSTOM_PREFIX as g, ATTR_DATA_CARD_COMPOSITION as O, ATTR_DATA_CUSTOM_ATTRIBUTES as R } from "../../extensions/Blocks/Recommendation/constants/selectors.js";
2
+ import { carriesForeignPartnerConfig as m, canJudgeUnstampedBlock as E, withoutCustomAttributes as d } from "../../extensions/Blocks/Recommendation/utils/partnerScope.js";
3
+ const S = ".recommendation-block-v2[esd-ext-config]", c = "esd-ext-config";
4
+ function C(t) {
5
+ const e = t.getAttribute(c);
6
+ if (!e)
7
+ return null;
8
+ try {
9
+ const r = JSON.parse(e);
10
+ return r && typeof r == "object" && !Array.isArray(r) ? r : null;
11
+ } catch {
12
+ return null;
13
+ }
14
+ }
15
+ function I(t, e, r) {
16
+ const o = d(e.composition ?? []);
17
+ t.querySelectorAll(_).forEach((i) => {
18
+ var s;
19
+ (s = i.getAttribute(a)) != null && s.startsWith(g) && i.remove();
20
+ }), t.setAttribute(O, o.join(",")), t.setAttribute(R, "[]"), t.setAttribute(c, JSON.stringify({
21
+ ...e,
22
+ strategyId: "",
23
+ strategy: "",
24
+ filters: [],
25
+ productIds: [],
26
+ composition: o,
27
+ partnerName: r
28
+ }));
29
+ }
30
+ function p(t, { partnerName: e, campaignUrls: r, rrsEnabled: o }) {
31
+ if (!e)
32
+ return t;
33
+ const i = new DOMParser().parseFromString(t, "text/html"), s = Array.from(i.querySelectorAll(S));
34
+ if (s.length === 0)
35
+ return t;
36
+ let T = 0;
37
+ return s.forEach((u) => {
38
+ const n = C(u), A = Number(u.getAttribute(f));
39
+ if (!(!n || !Number.isFinite(A))) {
40
+ if (m({ config: n, blockId: A, partnerName: e, campaignUrls: r, rrsEnabled: o })) {
41
+ I(u, n, e), T += 1;
42
+ return;
43
+ }
44
+ n.partnerName || !E({ config: n, campaignUrls: r, rrsEnabled: o }) || (u.setAttribute(c, JSON.stringify({ ...n, partnerName: e })), T += 1);
45
+ }
46
+ }), T > 0 ? i.documentElement.outerHTML : t;
47
+ }
48
+ export {
49
+ p as migrateRecommendationPartnerScope
50
+ };
@@ -1,5 +1,5 @@
1
1
  import { useTranslations as s } from "../../composables/useTranslations.js";
2
- const a = {
2
+ const t = {
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",
@@ -9,17 +9,17 @@ const a = {
9
9
  MIGRATE_STRATEGIES_PATH: "/newsletter/recommendations/migrate-strategies",
10
10
  // The template route narrows the recommendations resource before the action: the id
11
11
  // travels in the body, not the path.
12
- TEMPLATE_MIGRATE_STRATEGIES_PATH: "/newsletter/recommendations/template/migrate-strategies",
13
- // Smart Recommender hides the Email channel unless the URL asks for it, so a strategy created
14
- // without this flag can never be Email-suitable and would never reach the editor's list.
15
- RECOMMENDATION_STRATEGY_CREATE_PATH: "/discovery/recommendation-strategies/create?isEmail=true"
16
- }, d = (e) => {
17
- const { RECOMMENDATION_STRATEGIES_PANEL_PATH: n } = a;
18
- return `${n}/${e}/edit?isEmail=true`;
19
- }, m = {
20
- campaign: a.MIGRATE_STRATEGIES_PATH,
21
- template: a.TEMPLATE_MIGRATE_STRATEGIES_PATH
12
+ TEMPLATE_MIGRATE_STRATEGIES_PATH: "/newsletter/recommendations/template/migrate-strategies"
13
+ }, d = () => {
14
+ const { RECOMMENDATION_STRATEGIES_PANEL_PATH: e } = t;
15
+ return `${e}/create`;
16
+ }, m = (e) => {
17
+ const { RECOMMENDATION_STRATEGIES_PANEL_PATH: n } = t;
18
+ return `${n}/${e}/edit`;
22
19
  }, T = {
20
+ campaign: t.MIGRATE_STRATEGIES_PATH,
21
+ template: t.TEMPLATE_MIGRATE_STRATEGIES_PATH
22
+ }, p = {
23
23
  CLIENT_ID: "clientId"
24
24
  }, E = () => {
25
25
  const e = s();
@@ -85,21 +85,21 @@ const a = {
85
85
  path: "top-sellers"
86
86
  }
87
87
  ];
88
- }, p = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], A = [
88
+ }, A = ["discount", "omnibus_price", "omnibus_discount", "price", "original_price"], v = [
89
89
  { text: "before the amount", value: "0" },
90
90
  { text: "after the amount", value: "1" }
91
- ], v = [
91
+ ], _ = [
92
92
  { text: "dot(.)", value: "." },
93
93
  { text: "comma(,)", value: "," },
94
94
  { text: "space( )", value: " " }
95
- ], _ = [
95
+ ], h = [
96
96
  { text: "0", value: "0" },
97
97
  { text: "1", value: "1" },
98
98
  { text: "2", value: "2" },
99
99
  { text: "3", value: "3" },
100
100
  { text: "4", value: "4" },
101
101
  { text: "5", value: "5" }
102
- ], r = "||", t = [
102
+ ], r = "||", a = [
103
103
  { text: "is exactly", value: "=" },
104
104
  { text: "contains", value: "~" },
105
105
  { text: "does not contain", value: "!~" },
@@ -121,9 +121,9 @@ const a = {
121
121
  ], c = [
122
122
  { text: "true", value: "==" },
123
123
  { text: "false", value: "!=" }
124
- ], h = (e) => {
124
+ ], x = (e) => {
125
125
  if (!e)
126
- return t;
126
+ return a;
127
127
  switch (e) {
128
128
  case "Boolean":
129
129
  return c;
@@ -132,28 +132,29 @@ const a = {
132
132
  case "Number":
133
133
  return i;
134
134
  case "String":
135
- return t;
135
+ return a;
136
136
  case "Strings":
137
137
  return o;
138
138
  default:
139
- return t;
139
+ return a;
140
140
  }
141
141
  };
142
142
  export {
143
- m as MIGRATION_PATHS,
143
+ T as MIGRATION_PATHS,
144
144
  r as OP_ANY_OF,
145
- p as PriceAttributes,
146
- T as QUERY_PARAMS,
147
- a as URLS,
148
- _ as currencyDecimalCounts,
149
- A as currencyLocationMaps,
150
- v as currencyOperators,
151
- h as getOperatorOptions,
145
+ A as PriceAttributes,
146
+ p as QUERY_PARAMS,
147
+ t as URLS,
148
+ h as currencyDecimalCounts,
149
+ v as currencyLocationMaps,
150
+ _ as currencyOperators,
151
+ x as getOperatorOptions,
152
152
  E as getRecommendationFeedSourceMaps,
153
153
  o as operatorOptionsForArrayOfStrings,
154
154
  c as operatorOptionsForBooleans,
155
155
  u as operatorOptionsForDates,
156
156
  i as operatorOptionsForNumbers,
157
- t as operatorOptionsForStrings,
158
- d as strategyEditPath
157
+ a as operatorOptionsForStrings,
158
+ d as strategyCreatePath,
159
+ m as strategyEditPath
159
160
  };
@@ -0,0 +1,4 @@
1
+ var n = /* @__PURE__ */ ((s) => (s.CouponTagModified = "coupon-tag-modified", s.DuplicateUnsubBlock = "duplicate-unsub-block", s.UnsubBlockMissingTemplate = "unsub-block-missing-template", s.LiquidSyntax = "liquid-syntax", s.InvalidLinks = "invalid-links", s.LinkCheckInProgress = "link-check-in-progress", s.CustomFieldScript = "custom-field-script", s.EmptyHtml = "empty-html", s.MismatchedBraces = "mismatched-braces", s.InvalidDynamicTag = "invalid-dynamic-tag", s.InvalidCustomField = "invalid-custom-field", s.ConditionsSyntax = "conditions-syntax", s.WrongEqualityOperator = "wrong-equality-operator", s.MissingIfEndif = "missing-if-endif", s.ConditionTagSpacing = "condition-tag-spacing", s.BracesInsideIfTag = "braces-inside-if-tag", s.RecommendationRequiredFields = "recommendation-required-fields", s.RecommendationFilters = "recommendation-filters", s.InvalidImageType = "invalid-image-type", s.CheckboxUnsubGroup = "checkbox-unsub-group", s.RadioButtonUnsubGroup = "radio-button-unsub-group", s))(n || {});
2
+ export {
3
+ n as SaveValidationRule
4
+ };
@@ -1,9 +1,9 @@
1
- var b = Object.defineProperty;
2
- var C = (l, c, t) => c in l ? b(l, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[c] = t;
3
- var d = (l, c, t) => C(l, typeof c != "symbol" ? c + "" : c, t);
4
- import { useConfig as h } from "../../../composables/useConfig.js";
1
+ var y = Object.defineProperty;
2
+ var A = (l, c, t) => c in l ? y(l, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[c] = t;
3
+ var h = (l, c, t) => A(l, typeof c != "symbol" ? c + "" : c, t);
4
+ import { useConfig as d } from "../../../composables/useConfig.js";
5
5
  import { BlockId as D } from "../../../enums/block.js";
6
- import { getMigrationBannerHtml as A } from "../../../utils/migrationBannerHtml.js";
6
+ import { getMigrationBannerHtml as C } from "../../../utils/migrationBannerHtml.js";
7
7
  import { Block as E, BlockCompositionType as S, ModificationDescription as p } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
8
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";
@@ -12,21 +12,19 @@ import { ensureMobileCssRulesExist as I, setMobileLayoutOptOut as R, hasMobileLa
12
12
  import { RecommendationConfigService as s } from "./services/configService.js";
13
13
  import { useRecommendationExtensionStore as g } from "./store/recommendation.js";
14
14
  import { getDefaultTemplate as T } from "./templates/grid/template.js";
15
- import { useRecommendationBlockWarning as x } from "./useRecommendationBlockWarning.js";
16
- import { registerNodeConfigWriter as H } from "./utils/nodeConfigWriter.js";
17
- import { refreshDuplicatedStrategyBlocks as $ } from "./utils/strategyCommit.js";
18
- const k = D.Recommendation, u = "recommendation-block-v2", y = "hide-price";
19
- let B = !1;
20
- class Y extends E {
15
+ import { useRecommendationBlockWarning as v } from "./useRecommendationBlockWarning.js";
16
+ const k = D.Recommendation, u = "recommendation-block-v2", B = "hide-price";
17
+ let b = !1;
18
+ class j extends E {
21
19
  constructor() {
22
20
  super();
23
21
  /**
24
22
  * Stores the ID generated in getTemplate() so onCreated() can reuse it.
25
23
  * This avoids generating a new (different) ID in onCreated().
26
24
  */
27
- d(this, "_pendingBlockId", null);
25
+ h(this, "_pendingBlockId", null);
28
26
  /** Ids already reset under their new name, so the deferred pass skips their stale snapshot. */
29
- d(this, "_resetSourceIds", /* @__PURE__ */ new Set());
27
+ h(this, "_resetSourceIds", /* @__PURE__ */ new Set());
30
28
  }
31
29
  getId() {
32
30
  return k;
@@ -46,7 +44,7 @@ class Y extends E {
46
44
  );
47
45
  }
48
46
  getSettingsPanelTitleHtml() {
49
- return A(
47
+ return C(
50
48
  k,
51
49
  this.api.translate("Recommendation Block"),
52
50
  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.")
@@ -93,12 +91,13 @@ class Y extends E {
93
91
  }
94
92
  const i = this._pendingBlockId ?? this._generateNextId();
95
93
  this._pendingBlockId = null, this._assignRecommendationId(t, i);
96
- const n = h().isFeatureEnabled("reusableRecommendationStrategy"), o = n && !s.hasConfig(t), { config: r, wasFreshDrop: a } = s.initializeConfig(
94
+ const n = d().isFeatureEnabled("reusableRecommendationStrategy"), o = n && !s.hasConfig(t), { config: r, wasFreshDrop: a } = s.initializeConfig(
97
95
  this.api,
98
96
  t,
99
97
  {
100
98
  recommendationId: i,
101
99
  configVersion: n ? N : O,
100
+ ...o ? { partnerName: d().partnerName.value } : {},
102
101
  // An RRS block picks a strategy, not an algorithm, and its algorithm control is
103
102
  // hidden. Keeping the `mostPopular` default would bake a most-popular feed URL
104
103
  // at save for a block the user never configured.
@@ -135,7 +134,7 @@ class Y extends E {
135
134
  }
136
135
  this._healLingeringDuplicate(t), s.needsMigration(t) && this._migrateFromLegacy(t), this._healHidePriceAttr(t);
137
136
  try {
138
- B || (I(this.api), B = !0);
137
+ b || (I(this.api), b = !0);
139
138
  const e = s.getConfig(t), i = this._getBlockElement(t);
140
139
  if (i) {
141
140
  const n = !e.mobileLayoutEnabled;
@@ -169,7 +168,7 @@ class Y extends E {
169
168
  */
170
169
  _warnIfMultipleBlocks() {
171
170
  try {
172
- x().warnIfMultipleBlocks(this.api.getDocumentRootHtmlNode());
171
+ v().warnIfMultipleBlocks(this.api.getDocumentRootHtmlNode());
173
172
  } catch {
174
173
  }
175
174
  }
@@ -199,7 +198,7 @@ class Y extends E {
199
198
  * the renamed one depending on where the module was dropped (SD-149916).
200
199
  */
201
200
  _scheduleArrivalReset(t) {
202
- h().isFeatureEnabled("reusableRecommendationStrategy") && setTimeout(() => {
201
+ d().isFeatureEnabled("reusableRecommendationStrategy") && setTimeout(() => {
203
202
  const e = this._getRecommendationId(t);
204
203
  e !== null && e > 0 && !this._resetSourceIds.delete(e) && g().resetArrivedBlock(e);
205
204
  }, 0);
@@ -258,7 +257,7 @@ class Y extends E {
258
257
  /** Assigns a fresh id to a duplicated block and syncs DOM, node config and store. */
259
258
  _handleDuplicate(t, e) {
260
259
  const i = this._reassignDuplicateId(t, e), n = g();
261
- n.cloneBlockState(e, i), n.setCurrentBlock(i), h().isFeatureEnabled("reusableRecommendationStrategy") && (this._resetSourceIds.add(e), H(this.api), $(e, i, s.getConfig(t)).catch((o) => console.error("[recommendation] refreshing a duplicated strategy failed", o))), this._warnIfMultipleBlocks();
260
+ n.cloneBlockState(e, i), n.setCurrentBlock(i), d().isFeatureEnabled("reusableRecommendationStrategy") && (this._resetSourceIds.add(e), n.resetArrivedBlock(i)), this._warnIfMultipleBlocks();
262
261
  }
263
262
  /**
264
263
  * Core id-reassignment for a duplicated block: rewrites the DOM
@@ -314,7 +313,7 @@ class Y extends E {
314
313
  */
315
314
  _stampHidePrice(t, e) {
316
315
  const i = this._getBlockElement(t);
317
- i && this.api.getDocumentModifier().modifyHtml(i).setAttribute(y, String(e)).apply(new p("Stamp hide-price"));
316
+ i && this.api.getDocumentModifier().modifyHtml(i).setAttribute(B, String(e)).apply(new p("Stamp hide-price"));
318
317
  }
319
318
  /**
320
319
  * Stamps `hide-price` from config only when the block lacks the attribute —
@@ -322,7 +321,7 @@ class Y extends E {
322
321
  */
323
322
  _healHidePriceAttr(t) {
324
323
  const e = this._getBlockElement(t);
325
- if (!e || !("getAttribute" in e) || e.getAttribute(y) !== null)
324
+ if (!e || !("getAttribute" in e) || e.getAttribute(B) !== null)
326
325
  return;
327
326
  const { priceHideIfSameAsDiscounted: i } = s.getConfig(t);
328
327
  this._stampHidePrice(t, i);
@@ -360,5 +359,5 @@ class Y extends E {
360
359
  }
361
360
  export {
362
361
  k as BLOCK_ID,
363
- Y as RecommendationBlock
362
+ j as RecommendationBlock
364
363
  };