@useinsider/guido 3.19.0-beta.cac604e → 3.19.0-beta.cd75ff0

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 (77) hide show
  1. package/README.md +1 -0
  2. package/dist/@types/config/schemas.js +39 -37
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +83 -75
  5. package/dist/components/organisms/AutoSaveController.vue2.js +10 -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 +5 -5
  9. package/dist/components/organisms/header/EditorActions.vue2.js +83 -46
  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 +50 -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/useAutoSave.js +44 -42
  20. package/dist/composables/useHtmlCompiler.js +37 -26
  21. package/dist/composables/useHtmlValidator.js +2 -0
  22. package/dist/composables/useHttp.js +64 -54
  23. package/dist/composables/useLegacyStrategyConversion.js +23 -19
  24. package/dist/composables/useSave.js +92 -45
  25. package/dist/composables/useSaveValidation.js +284 -0
  26. package/dist/composables/useSaveValidationRollout.js +20 -0
  27. package/dist/composables/useStripo.js +24 -20
  28. package/dist/composables/useToaster.js +17 -15
  29. package/dist/composables/validators/useCouponBlockValidator.js +24 -21
  30. package/dist/composables/validators/useLiquidValidator.js +15 -15
  31. package/dist/composables/validators/useUnsubscribeBlockValidator.js +34 -27
  32. package/dist/config/migrator/index.js +14 -13
  33. package/dist/config/migrator/recommendationPartnerMigrator.js +50 -0
  34. package/dist/enums/extensions/recommendationBlock.js +30 -29
  35. package/dist/enums/save-validation.js +4 -0
  36. package/dist/extensions/Blocks/Recommendation/block.js +54 -88
  37. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +32 -51
  38. package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +11 -12
  39. package/dist/guido.css +1 -1
  40. package/dist/services/settingsApi.js +11 -0
  41. package/dist/src/@types/config/schemas.d.ts +4 -0
  42. package/dist/src/@types/save-validation.d.ts +19 -0
  43. package/dist/src/components/Guido.vue.d.ts +17 -1
  44. package/dist/src/components/organisms/base/AuthErrorModal.vue.d.ts +2 -0
  45. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +17 -1
  46. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +17 -1
  47. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +17 -1
  48. package/dist/src/components/organisms/validation/ValidationErrorDrawer.vue.d.ts +2 -0
  49. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +4 -3
  50. package/dist/src/components/wrappers/WpModal.vue.d.ts +5 -1
  51. package/dist/src/composables/useAuthError.d.ts +12 -0
  52. package/dist/src/composables/useAutoSave.d.ts +4 -1
  53. package/dist/src/composables/useConfig.d.ts +2 -0
  54. package/dist/src/composables/useHtmlValidator.d.ts +21 -0
  55. package/dist/src/composables/useHttp.d.ts +2 -0
  56. package/dist/src/composables/useSave.d.ts +6 -1
  57. package/dist/src/composables/useSaveValidation.d.ts +6 -0
  58. package/dist/src/composables/useSaveValidationRollout.d.ts +4 -0
  59. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
  60. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +10 -0
  61. package/dist/src/config/migrator/index.d.ts +2 -1
  62. package/dist/src/config/migrator/recommendationPartnerMigrator.d.ts +19 -0
  63. package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -1
  64. package/dist/src/enums/save-validation.d.ts +27 -0
  65. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -6
  66. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -5
  67. package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +13 -7
  68. package/dist/src/services/settingsApi.d.ts +6 -0
  69. package/dist/src/stores/config.d.ts +32 -0
  70. package/dist/src/stores/save-validation.d.ts +22 -0
  71. package/dist/src/stores/setup-settings.d.ts +4 -0
  72. package/dist/src/utils/templatePreparation.d.ts +30 -0
  73. package/dist/stores/config.js +84 -67
  74. package/dist/stores/save-validation.js +30 -0
  75. package/dist/stores/setup-settings.js +10 -0
  76. package/dist/utils/templatePreparation.js +39 -36
  77. package/package.json +1 -1
@@ -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,41 +1,39 @@
1
- var D = Object.defineProperty;
2
- var S = (m, c, t) => c in m ? D(m, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : m[c] = t;
3
- var _ = (m, c, t) => S(m, typeof c != "symbol" ? c + "" : c, t);
4
- import { useConfig as g } from "../../../composables/useConfig.js";
5
- import { BlockId as T } from "../../../enums/block.js";
6
- import { getMigrationBannerHtml as N } from "../../../utils/migrationBannerHtml.js";
7
- import { Block as O, BlockCompositionType as M, ModificationDescription as h } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
8
- import { CURRENT_CONFIG_VERSION as w, PRE_RRS_CONFIG_VERSION as v } from "./constants/defaultConfig.js";
9
- import { RECOMMENDATION_ID_ATTR as d, SELECTOR_ATTRIBUTE_ROW as F, ATTR_CUSTOM_PREFIX as H, ATTR_DATA_CARD_COMPOSITION as P, ATTR_DATA_CUSTOM_ATTRIBUTES as x } from "./constants/selectors.js";
10
- import { regenerateMobileProductRows as $ } from "./controls/main/utils.js";
11
- import { ensureMobileCssRulesExist as C, setMobileLayoutOptOut as b, hasMobileLayoutOptOut as L } from "./controls/mobileLayout/cssRules.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
+ import { BlockId as D } from "../../../enums/block.js";
6
+ import { getMigrationBannerHtml as C } from "../../../utils/migrationBannerHtml.js";
7
+ import { Block as E, BlockCompositionType as S, ModificationDescription as p } 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
+ import { RECOMMENDATION_ID_ATTR as m } from "./constants/selectors.js";
10
+ import { regenerateMobileProductRows as M } from "./controls/main/utils.js";
11
+ import { ensureMobileCssRulesExist as I, setMobileLayoutOptOut as R, hasMobileLayoutOptOut as w } from "./controls/mobileLayout/cssRules.js";
12
12
  import { RecommendationConfigService as s } from "./services/configService.js";
13
- import { useRecommendationExtensionStore as p } from "./store/recommendation.js";
14
- import { getDefaultTemplate as q } from "./templates/grid/template.js";
15
- import { useRecommendationBlockWarning as U } from "./useRecommendationBlockWarning.js";
16
- import { resolveRowCompositionKey as V } from "./utils/compositionKeys.js";
17
- import { carriesForeignPartnerConfig as W, loadedRecommendationIds as K, withoutCustomAttributes as z } from "./utils/partnerScope.js";
18
- const y = T.Recommendation, f = "recommendation-block-v2", B = "hide-price";
19
- let E = !1;
20
- class at extends O {
13
+ import { useRecommendationExtensionStore as g } from "./store/recommendation.js";
14
+ import { getDefaultTemplate as T } from "./templates/grid/template.js";
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
- _(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
- _(this, "_resetSourceIds", /* @__PURE__ */ new Set());
27
+ h(this, "_resetSourceIds", /* @__PURE__ */ new Set());
30
28
  }
31
29
  getId() {
32
- return y;
30
+ return k;
33
31
  }
34
32
  getIcon() {
35
33
  return "recommendation-icon";
36
34
  }
37
35
  getBlockCompositionType() {
38
- return M.CONTAINER;
36
+ return S.CONTAINER;
39
37
  }
40
38
  getName() {
41
39
  return this.api.translate("Recommendation Block");
@@ -46,8 +44,8 @@ class at extends O {
46
44
  );
47
45
  }
48
46
  getSettingsPanelTitleHtml() {
49
- return N(
50
- y,
47
+ return C(
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.")
53
51
  );
@@ -70,7 +68,7 @@ class at extends O {
70
68
  */
71
69
  getTemplate() {
72
70
  const t = this._generateNextId();
73
- return this._pendingBlockId = t, q(t);
71
+ return this._pendingBlockId = t, T(t);
74
72
  }
75
73
  /**
76
74
  * Called when a new block is dropped into the template
@@ -93,28 +91,28 @@ class at extends O {
93
91
  }
94
92
  const i = this._pendingBlockId ?? this._generateNextId();
95
93
  this._pendingBlockId = null, this._assignRecommendationId(t, i);
96
- const n = g().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
- configVersion: n ? w : v,
102
- ...o ? { partnerName: g().partnerName.value } : {},
99
+ configVersion: n ? N : O,
100
+ ...o ? { partnerName: d().partnerName.value } : {},
103
101
  // An RRS block picks a strategy, not an algorithm, and its algorithm control is
104
102
  // hidden. Keeping the `mostPopular` default would bake a most-popular feed URL
105
103
  // at save for a block the user never configured.
106
104
  ...o ? { strategy: "" } : {}
107
105
  }
108
- ), u = p();
109
- if (u.setCurrentBlock(i), this._stampHidePrice(t, r.priceHideIfSameAsDiscounted), a) {
110
- C(this.api);
111
- const l = this._getBlockElement(t);
112
- l && (b(this.api, l, !0), $({
106
+ ), f = g();
107
+ if (f.setCurrentBlock(i), this._stampHidePrice(t, r.priceHideIfSameAsDiscounted), a) {
108
+ I(this.api);
109
+ const _ = this._getBlockElement(t);
110
+ _ && (R(this.api, _, !0), M({
113
111
  currentNode: t,
114
112
  documentModifier: this.api.getDocumentModifier()
115
113
  }));
116
114
  }
117
- u.patchCurrentBlockConfig({ language: r.language }, { triggerRefetch: !1 }), this._warnIfMultipleBlocks();
115
+ f.patchCurrentBlockConfig({ language: r.language }, { triggerRefetch: !1 }), this._warnIfMultipleBlocks();
118
116
  }
119
117
  /**
120
118
  * Called when the document changes or template is loaded
@@ -134,13 +132,13 @@ class at extends O {
134
132
  "Assign recommendation ID to legacy block"
135
133
  );
136
134
  }
137
- this._healLingeringDuplicate(t), s.needsMigration(t) && this._migrateFromLegacy(t), this._healHidePriceAttr(t), this._resetForeignPartnerConfig(t);
135
+ this._healLingeringDuplicate(t), s.needsMigration(t) && this._migrateFromLegacy(t), this._healHidePriceAttr(t);
138
136
  try {
139
- E || (C(this.api), E = !0);
137
+ b || (I(this.api), b = !0);
140
138
  const e = s.getConfig(t), i = this._getBlockElement(t);
141
139
  if (i) {
142
140
  const n = !e.mobileLayoutEnabled;
143
- L(i) !== n && b(this.api, i, n);
141
+ w(i) !== n && R(this.api, i, n);
144
142
  }
145
143
  } catch {
146
144
  }
@@ -154,7 +152,7 @@ class at extends O {
154
152
  */
155
153
  onDelete(t) {
156
154
  const e = this._getRecommendationId(t);
157
- e && p().removeBlockState(e);
155
+ e && g().removeBlockState(e);
158
156
  }
159
157
  /**
160
158
  * Warns (dark advisory toaster) when the design holds more than one live
@@ -170,7 +168,7 @@ class at extends O {
170
168
  */
171
169
  _warnIfMultipleBlocks() {
172
170
  try {
173
- U().warnIfMultipleBlocks(this.api.getDocumentRootHtmlNode());
171
+ v().warnIfMultipleBlocks(this.api.getDocumentRootHtmlNode());
174
172
  } catch {
175
173
  }
176
174
  }
@@ -182,9 +180,9 @@ class at extends O {
182
180
  let t = 0;
183
181
  try {
184
182
  const e = this.api.getDocumentRoot();
185
- e && "querySelectorAll" in e && e.querySelectorAll(`.${f}`).forEach((n) => {
183
+ e && "querySelectorAll" in e && e.querySelectorAll(`.${u}`).forEach((n) => {
186
184
  if ("getAttribute" in n) {
187
- const o = n.getAttribute(d), r = o ? parseInt(o) : 0;
185
+ const o = n.getAttribute(m), r = o ? parseInt(o) : 0;
188
186
  r > t && (t = r);
189
187
  }
190
188
  });
@@ -200,9 +198,9 @@ class at extends O {
200
198
  * the renamed one depending on where the module was dropped (SD-149916).
201
199
  */
202
200
  _scheduleArrivalReset(t) {
203
- g().isFeatureEnabled("reusableRecommendationStrategy") && setTimeout(() => {
201
+ d().isFeatureEnabled("reusableRecommendationStrategy") && setTimeout(() => {
204
202
  const e = this._getRecommendationId(t);
205
- e !== null && e > 0 && !this._resetSourceIds.delete(e) && p().resetArrivedBlock(e);
203
+ e !== null && e > 0 && !this._resetSourceIds.delete(e) && g().resetArrivedBlock(e);
206
204
  }, 0);
207
205
  }
208
206
  /**
@@ -225,7 +223,7 @@ class at extends O {
225
223
  if (!i || !("querySelectorAll" in i))
226
224
  return;
227
225
  const n = i.querySelectorAll(
228
- `.${f}[${d}="${e}"]`
226
+ `.${u}[${m}="${e}"]`
229
227
  );
230
228
  if (n.length <= 1)
231
229
  return;
@@ -250,7 +248,7 @@ class at extends O {
250
248
  const e = this.api.getDocumentRoot();
251
249
  if (e && "querySelectorAll" in e)
252
250
  return e.querySelectorAll(
253
- `.${f}[${d}="${t}"]`
251
+ `.${u}[${m}="${t}"]`
254
252
  ).length > 1;
255
253
  } catch {
256
254
  }
@@ -258,8 +256,8 @@ class at extends O {
258
256
  }
259
257
  /** Assigns a fresh id to a duplicated block and syncs DOM, node config and store. */
260
258
  _handleDuplicate(t, e) {
261
- const i = this._reassignDuplicateId(t, e), n = p();
262
- n.cloneBlockState(e, i), n.setCurrentBlock(i), g().isFeatureEnabled("reusableRecommendationStrategy") && (this._resetSourceIds.add(e), n.resetArrivedBlock(i)), this._warnIfMultipleBlocks();
259
+ const i = this._reassignDuplicateId(t, e), n = g();
260
+ n.cloneBlockState(e, i), n.setCurrentBlock(i), d().isFeatureEnabled("reusableRecommendationStrategy") && (this._resetSourceIds.add(e), n.resetArrivedBlock(i)), this._warnIfMultipleBlocks();
263
261
  }
264
262
  /**
265
263
  * Core id-reassignment for a duplicated block: rewrites the DOM
@@ -292,7 +290,7 @@ class at extends O {
292
290
  if (!("getAttribute" in t))
293
291
  return;
294
292
  const n = `ins-recommendation-v3-block-${e}`, o = `ins-recommendation-v3-block-${i}`, r = this.api.getDocumentModifier();
295
- r.modifyHtml(t).removeClass(n).setClass(o), r.apply(new h(
293
+ r.modifyHtml(t).removeClass(n).setClass(o), r.apply(new p(
296
294
  `Reassign recommendation instance class ${n} -> ${o}`
297
295
  ));
298
296
  }
@@ -307,7 +305,7 @@ class at extends O {
307
305
  if (!i)
308
306
  return;
309
307
  const n = this.api.getDocumentModifier();
310
- n.modifyHtml(i).setAttribute(d, e.toString()), n.apply(new h(`Assign recommendation ID ${e}`));
308
+ n.modifyHtml(i).setAttribute(m, e.toString()), n.apply(new p(`Assign recommendation ID ${e}`));
311
309
  }
312
310
  /**
313
311
  * Stamps the `hide-price` attribute (read by email-service at send time) on
@@ -315,7 +313,7 @@ class at extends O {
315
313
  */
316
314
  _stampHidePrice(t, e) {
317
315
  const i = this._getBlockElement(t);
318
- i && this.api.getDocumentModifier().modifyHtml(i).setAttribute(B, String(e)).apply(new h("Stamp hide-price"));
316
+ i && this.api.getDocumentModifier().modifyHtml(i).setAttribute(B, String(e)).apply(new p("Stamp hide-price"));
319
317
  }
320
318
  /**
321
319
  * Stamps `hide-price` from config only when the block lacks the attribute —
@@ -328,38 +326,6 @@ class at extends O {
328
326
  const { priceHideIfSameAsDiscounted: i } = s.getConfig(t);
329
327
  this._stampHidePrice(t, i);
330
328
  }
331
- /**
332
- * Empties a block copied in from another account: its strategy and attribute types
333
- * are account-scoped and would not resolve here (SD-151945). Layout, locale and
334
- * currency stay. The write stamps the current account, so the next pass is a no-op.
335
- */
336
- _resetForeignPartnerConfig(t) {
337
- var I, R;
338
- const e = this._getRecommendationId(t), i = this._getBlockElement(t);
339
- if (e === null || !i || !s.hasConfig(t))
340
- return;
341
- const { partnerName: n, template: o } = g(), r = s.getConfig(t);
342
- if (!W({
343
- config: r,
344
- blockId: e,
345
- partnerName: n.value,
346
- campaignUrls: (I = o.value) == null ? void 0 : I.recommendationCampaignUrls,
347
- loadedIds: K(((R = o.value) == null ? void 0 : R.html) ?? "")
348
- }))
349
- return;
350
- const u = z(r.composition), l = this.api.getDocumentModifier();
351
- i.querySelectorAll(F).forEach((k) => {
352
- var A;
353
- (A = V(k)) != null && A.startsWith(H) && l.modifyHtml(k).delete();
354
- }), l.modifyHtml(i).setAttribute(P, u.join(",")).setAttribute(x, "[]"), s.stageConfig(l, t, {
355
- strategyId: "",
356
- strategy: "",
357
- filters: [],
358
- productIds: [],
359
- composition: u,
360
- partnerName: n.value
361
- }), l.apply(new h("Reset recommendation block copied from another account")), p().resetPartnerScopedConfig(e);
362
- }
363
329
  /**
364
330
  * Gets the recommendation-id from a block node
365
331
  */
@@ -367,7 +333,7 @@ class at extends O {
367
333
  const e = this._getBlockElement(t);
368
334
  if (!e || !("getAttribute" in e))
369
335
  return null;
370
- const i = e.getAttribute(d);
336
+ const i = e.getAttribute(m);
371
337
  if (!i)
372
338
  return null;
373
339
  const n = parseInt(i);
@@ -379,10 +345,10 @@ class at extends O {
379
345
  _getBlockElement(t) {
380
346
  if ("getAttribute" in t) {
381
347
  const e = t.getAttribute("class");
382
- if (e && e.includes(f))
348
+ if (e && e.includes(u))
383
349
  return t;
384
350
  }
385
- return "querySelector" in t ? t.querySelector(`.${f}`) ?? null : null;
351
+ return "querySelector" in t ? t.querySelector(`.${u}`) ?? null : null;
386
352
  }
387
353
  /**
388
354
  * Migrate configuration from legacy format
@@ -392,6 +358,6 @@ class at extends O {
392
358
  }
393
359
  }
394
360
  export {
395
- y as BLOCK_ID,
396
- at as RecommendationBlock
361
+ k as BLOCK_ID,
362
+ j as RecommendationBlock
397
363
  };