@useinsider/guido 3.20.1-beta.991508 → 3.20.1-beta.d2cba14
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.
- package/dist/composables/useLegacyStrategyConversion.js +16 -16
- package/dist/composables/useStripo.js +4 -3
- package/dist/extensions/Blocks/Items/block.js +43 -42
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +223 -296
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +205 -219
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +36 -51
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +35 -31
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +271 -192
- package/dist/package.json.js +1 -1
- package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +8 -0
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +40 -0
- package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +11 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -18
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -8
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +0 -7
- package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/controlFactories.d.ts +22 -0
- package/dist/static/styles/components/button.css.js +5 -0
- package/package.json +3 -3
- package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +0 -19
- package/dist/src/extensions/Blocks/Recommendation/utils/blockRefresh.d.ts +0 -17
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { useRecommendation as
|
|
1
|
+
import { useRecommendation as C } from "./useRecommendation.js";
|
|
2
2
|
import { useToaster as I } from "./useToaster.js";
|
|
3
3
|
import { useTranslations as v } from "./useTranslations.js";
|
|
4
4
|
import { ToasterTypeOptions as g } from "../enums/toaster.js";
|
|
5
5
|
import "../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
6
6
|
import { CURRENT_CONFIG_VERSION as L } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
7
|
-
import { useRecommendationExtensionStore as
|
|
8
|
-
import { resolveMigrationTarget as
|
|
7
|
+
import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
8
|
+
import { resolveMigrationTarget as k, buildLegacyMigrationPayload as R } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js";
|
|
9
9
|
import { commitBlockChangeOutsidePanel as T } from "../extensions/Blocks/Recommendation/utils/nodeConfigWriter.js";
|
|
10
10
|
import { useConfigStore as h } from "../stores/config.js";
|
|
11
11
|
const F = () => {
|
|
12
|
-
const e =
|
|
12
|
+
const e = b(), r = h(), { buildCampaignUrl: m } = C(), { showToaster: c } = I(), a = v();
|
|
13
13
|
return { convertLegacyStrategy: async () => {
|
|
14
14
|
const t = e.currentRecommendationId;
|
|
15
15
|
if (t === null || !e.isLegacyStrategyBlock || e.legacyConversionLoading)
|
|
16
16
|
return "";
|
|
17
|
-
const { strategy: d, productIds: y, size: l, strategyId: p, nodeConfigVersion: u } = e.recommendationConfigs, f = { strategyId: p, size: l, nodeConfigVersion: u }, s =
|
|
18
|
-
campaignId:
|
|
19
|
-
templateLibraryId:
|
|
20
|
-
}),
|
|
17
|
+
const { strategy: d, productIds: y, size: l, strategyId: p, nodeConfigVersion: u } = e.recommendationConfigs, f = { strategyId: p, size: l, nodeConfigVersion: u }, s = k({
|
|
18
|
+
campaignId: r.campaignId,
|
|
19
|
+
templateLibraryId: r.templateLibraryId
|
|
20
|
+
}), S = R({
|
|
21
21
|
blockId: t,
|
|
22
22
|
url: m(String(t)),
|
|
23
|
-
campaignId:
|
|
24
|
-
variationId:
|
|
23
|
+
campaignId: r.campaignId,
|
|
24
|
+
variationId: r.variationId,
|
|
25
25
|
strategy: d,
|
|
26
26
|
productIds: y,
|
|
27
27
|
target: s
|
|
28
28
|
});
|
|
29
|
-
let
|
|
29
|
+
let o;
|
|
30
30
|
try {
|
|
31
|
-
|
|
31
|
+
o = await e.convertLegacyStrategy(S, s);
|
|
32
32
|
} catch (i) {
|
|
33
33
|
return console.error("[useLegacyStrategyConversion] migration failed", i), c({
|
|
34
34
|
type: g.Error,
|
|
@@ -40,7 +40,7 @@ const F = () => {
|
|
|
40
40
|
}), "";
|
|
41
41
|
}
|
|
42
42
|
try {
|
|
43
|
-
await e.
|
|
43
|
+
await e.fetchStrategyProductsForBlock(t);
|
|
44
44
|
} catch (i) {
|
|
45
45
|
console.error("[useLegacyStrategyConversion] product refetch failed", i);
|
|
46
46
|
}
|
|
@@ -48,16 +48,16 @@ const F = () => {
|
|
|
48
48
|
return n ? T(
|
|
49
49
|
t,
|
|
50
50
|
{
|
|
51
|
-
strategyId:
|
|
51
|
+
strategyId: o,
|
|
52
52
|
size: n.recommendationConfigs.size,
|
|
53
53
|
configVersion: L
|
|
54
54
|
},
|
|
55
55
|
n.recommendationProducts,
|
|
56
56
|
"Converted legacy recommendation strategy"
|
|
57
|
-
) ? (e.currentRecommendationId === t && e.openLegacyStrategyUpdatedModal(),
|
|
57
|
+
) ? (e.currentRecommendationId === t && e.openLegacyStrategyUpdatedModal(), o) : (console.error("[useLegacyStrategyConversion] node write failed", t), e.revertLegacyConversion(t, f), c({
|
|
58
58
|
type: g.Error,
|
|
59
59
|
message: a("email-editor.legacy-strategy-update-failed")
|
|
60
|
-
}), "") :
|
|
60
|
+
}), "") : o;
|
|
61
61
|
} };
|
|
62
62
|
};
|
|
63
63
|
export {
|
|
@@ -31,13 +31,13 @@ const he = () => {
|
|
|
31
31
|
n = null;
|
|
32
32
|
}), n), D = async (r, s, o, a = [], i = !1) => {
|
|
33
33
|
var y, E, h, C;
|
|
34
|
-
const e = k(), { html: d, css:
|
|
34
|
+
const e = k(), { html: d, css: P } = r, { baseBlocks: g, extensions: R } = await V(), S = ((y = c.value) == null ? void 0 : y.displayConditions) ?? !0, U = ((E = c.value) == null ? void 0 : E.modulesDisabled) ?? !1, I = !!d || (((h = u.value) == null ? void 0 : h.forceRecreate) ?? !1), q = "https://email-static.useinsider.com https://edge.fullstory.com https://rs.fullstory.com";
|
|
35
35
|
w().importCss(), await window.UIEditor.initEditor(
|
|
36
36
|
document.querySelector("#guido-editor"),
|
|
37
37
|
{
|
|
38
38
|
metadata: s,
|
|
39
39
|
html: d,
|
|
40
|
-
css:
|
|
40
|
+
css: P,
|
|
41
41
|
forceRecreate: I,
|
|
42
42
|
locale: "en",
|
|
43
43
|
undoButtonSelector: "#guido__undo-button",
|
|
@@ -60,6 +60,7 @@ const he = () => {
|
|
|
60
60
|
keepModuleStylesEnabled: !0,
|
|
61
61
|
displayTitle: !1,
|
|
62
62
|
displayUTM: !1,
|
|
63
|
+
copyPasteEnabled: !1,
|
|
63
64
|
selectElementAfterDrop: !0,
|
|
64
65
|
sameFontSizeForOutlook: !0,
|
|
65
66
|
allowedScriptSourceDomains: q,
|
|
@@ -120,7 +121,7 @@ const he = () => {
|
|
|
120
121
|
".in-modal-v2-wrapper",
|
|
121
122
|
".in-toasts-wrapper"
|
|
122
123
|
],
|
|
123
|
-
extensions:
|
|
124
|
+
extensions: R,
|
|
124
125
|
localePatch: J
|
|
125
126
|
}
|
|
126
127
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var k = Object.defineProperty;
|
|
2
|
-
var S = (d, l,
|
|
3
|
-
var g = (d, l,
|
|
2
|
+
var S = (d, l, t) => l in d ? k(d, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[l] = t;
|
|
3
|
+
var g = (d, l, t) => S(d, typeof l != "symbol" ? l + "" : l, t);
|
|
4
4
|
import { BlockId as D } from "../../../enums/block.js";
|
|
5
5
|
import { useOnboardingStore as T } from "../../../stores/onboarding.js";
|
|
6
6
|
import { getMigrationBannerHtml as N } from "../../../utils/migrationBannerHtml.js";
|
|
@@ -58,15 +58,15 @@ class $ extends H {
|
|
|
58
58
|
canBeSavedAsModule() {
|
|
59
59
|
return !0;
|
|
60
60
|
}
|
|
61
|
-
onCreated(
|
|
62
|
-
const
|
|
63
|
-
c.querySelector('[product-attr="imageSrc"] img') ||
|
|
64
|
-
const r = _(
|
|
61
|
+
onCreated(t) {
|
|
62
|
+
const e = this.api.getDocumentModifier(), c = this.api.getDocumentRootCssNode();
|
|
63
|
+
c.querySelector('[product-attr="imageSrc"] img') || e.modifyCss(c).appendRule('[product-attr="imageSrc"] img {object-fit: contain;}');
|
|
64
|
+
const r = _(t);
|
|
65
65
|
if (!r)
|
|
66
66
|
return;
|
|
67
|
-
const o = r.getNodeConfig(),
|
|
67
|
+
const o = r.getNodeConfig(), n = o && Object.keys(o).length > 0, i = C(t);
|
|
68
68
|
if (i != null && i.initialized) {
|
|
69
|
-
if (!
|
|
69
|
+
if (!n) {
|
|
70
70
|
const a = this.api.getDocumentModifier();
|
|
71
71
|
a.modifyHtml(r).setNodeConfig(i), this._stampProductTdDomAttributes(r, i, a), this._healCollapsedWidths(r, a), this._shouldReconcileCurrency(i) && this._reconcileCurrencyDomAttributes(r, i, a), a.apply(new u("Migrate legacy config to nodeConfig")), this._markCurrencyHealed(i.blockInstanceId);
|
|
72
72
|
return;
|
|
@@ -76,9 +76,9 @@ class $ extends H {
|
|
|
76
76
|
I.modifyHtml(r).setNodeConfig(a), this._stampProductTdDomAttributes(r, a, I, !0), I.apply(new u("Initialize Items block with default configuration")), T().startOnboarding("itemsOnboarding");
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
|
-
const
|
|
79
|
+
const s = this._resolveInstanceId(i.blockInstanceId), f = this.api.getDocumentModifier();
|
|
80
80
|
let h = !1;
|
|
81
|
-
|
|
81
|
+
s !== i.blockInstanceId && (f.modifyHtml(r).setNodeConfig({ ...i, blockInstanceId: s }), h = !0), !this._currencyHealed.has(s) && this._reconcileCurrencyDomAttributes(r, i, f) && (h = !0), this._healCollapsedWidths(r, f) && (h = !0), h && f.apply(new u("Assign Items block instance ID and reconcile currency")), this._markCurrencyHealed(s);
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
84
|
* Re-seeds nodeConfig from the persisted esd-ext-config when a saved module
|
|
@@ -86,24 +86,24 @@ class $ extends H {
|
|
|
86
86
|
* into nodeConfig, so without this a reused module would reset to defaults.
|
|
87
87
|
* Guarded to the nodeConfig-empty case so it runs once and never loops.
|
|
88
88
|
*/
|
|
89
|
-
onDocumentChanged(
|
|
90
|
-
const
|
|
91
|
-
if (!
|
|
89
|
+
onDocumentChanged(t) {
|
|
90
|
+
const e = _(t);
|
|
91
|
+
if (!e)
|
|
92
92
|
return;
|
|
93
|
-
const c =
|
|
93
|
+
const c = e.getNodeConfig();
|
|
94
94
|
if (c && Object.keys(c).length > 0) {
|
|
95
|
-
const i = C(
|
|
95
|
+
const i = C(t);
|
|
96
96
|
if (i != null && i.initialized && this._shouldReconcileCurrency(i)) {
|
|
97
|
-
const
|
|
98
|
-
this._reconcileCurrencyDomAttributes(
|
|
97
|
+
const s = this.api.getDocumentModifier();
|
|
98
|
+
this._reconcileCurrencyDomAttributes(e, i, s) && s.apply(new u(V)), this._markCurrencyHealed(i.blockInstanceId);
|
|
99
99
|
}
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
|
-
const o = C(
|
|
102
|
+
const o = C(t);
|
|
103
103
|
if (!(o != null && o.initialized))
|
|
104
104
|
return;
|
|
105
|
-
const
|
|
106
|
-
|
|
105
|
+
const n = this.api.getDocumentModifier();
|
|
106
|
+
n.modifyHtml(e).setNodeConfig(o), this._stampProductTdDomAttributes(e, o, n), this._healCollapsedWidths(e, n), this._shouldReconcileCurrency(o) && this._reconcileCurrencyDomAttributes(e, o, n), n.apply(new u("Recover Items block config from saved module")), this._markCurrencyHealed(o.blockInstanceId);
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
109
|
* Bakes the compiler-read DOM attributes (`data-type`, `data-number`, `data-nodup`) onto the
|
|
@@ -113,20 +113,21 @@ class $ extends H {
|
|
|
113
113
|
* restored before export. The name `<a>` carries no data-type/data-number of its own and
|
|
114
114
|
* relies on this td-level fallback in pairProductVariables.
|
|
115
115
|
*/
|
|
116
|
-
_stampProductTdDomAttributes(
|
|
117
|
-
const o = B(
|
|
118
|
-
r &&
|
|
116
|
+
_stampProductTdDomAttributes(t, e, c, r = !1) {
|
|
117
|
+
const o = B(e.itemsSelectValue, e.type), n = (i, s) => {
|
|
118
|
+
r && t.getAttribute(i) || c.modifyHtml(t).setAttribute(i, s);
|
|
119
119
|
};
|
|
120
|
-
|
|
120
|
+
n("data-type", e.type), n("data-number", o), n("data-nodup", String(e.priceHideDiscount));
|
|
121
121
|
}
|
|
122
122
|
/**
|
|
123
123
|
* Repairs a saved module's collapsed card into the state the load migrator produces. Acts only
|
|
124
124
|
* on a zero width, so Stripo's non-zero drop-time width never triggers it and a healed block no-ops.
|
|
125
125
|
*/
|
|
126
|
-
_healCollapsedWidths(
|
|
127
|
-
const r =
|
|
128
|
-
return !m(
|
|
129
|
-
|
|
126
|
+
_healCollapsedWidths(t, e) {
|
|
127
|
+
const r = t.querySelectorAll(M).filter((o) => m(o.getAttribute("width")) || m(o.getStyle("width")));
|
|
128
|
+
return !m(t.getAttribute("width")) && !r.length ? !1 : (t.hasClass("esd-container-frame") && e.modifyHtml(t).removeClass("esd-container-frame"), t.getAttribute("width") !== null && e.modifyHtml(t).removeAttribute("width"), r.forEach((o) => {
|
|
129
|
+
const n = o.getAttribute("width");
|
|
130
|
+
(n === null || m(n)) && e.modifyHtml(o).setAttribute("width", "100%"), m(o.getStyle("width")) && e.modifyHtml(o).setStyle("width", "100%");
|
|
130
131
|
}), !0);
|
|
131
132
|
}
|
|
132
133
|
/**
|
|
@@ -137,12 +138,12 @@ class $ extends H {
|
|
|
137
138
|
* the symbol write alone is skipped for the 'USD' sentinel — so we must NOT gate the whole pass
|
|
138
139
|
* on symbol customization here, or a default-symbol block with a toggled location never heals.
|
|
139
140
|
*/
|
|
140
|
-
_shouldReconcileCurrency(
|
|
141
|
-
return !
|
|
141
|
+
_shouldReconcileCurrency(t) {
|
|
142
|
+
return !t.blockInstanceId || !this._currencyHealed.has(t.blockInstanceId);
|
|
142
143
|
}
|
|
143
144
|
/** Marks a block instance's currency as reconciled so it is not healed again (undo-safe). */
|
|
144
|
-
_markCurrencyHealed(
|
|
145
|
-
|
|
145
|
+
_markCurrencyHealed(t) {
|
|
146
|
+
t && this._currencyHealed.add(t);
|
|
146
147
|
}
|
|
147
148
|
/**
|
|
148
149
|
* Resolves the id for a just-created block to one that is unique per live instance.
|
|
@@ -151,13 +152,13 @@ class $ extends H {
|
|
|
151
152
|
* currency heal guard and settings-panel switch detection. Mint a fresh id on absence
|
|
152
153
|
* or collision, otherwise keep the existing one. Registers the result as claimed.
|
|
153
154
|
*/
|
|
154
|
-
_resolveInstanceId(
|
|
155
|
-
let
|
|
156
|
-
if (!
|
|
155
|
+
_resolveInstanceId(t) {
|
|
156
|
+
let e = t;
|
|
157
|
+
if (!e || this._seenInstanceIds.has(e))
|
|
157
158
|
do
|
|
158
|
-
|
|
159
|
-
while (this._seenInstanceIds.has(
|
|
160
|
-
return this._seenInstanceIds.add(
|
|
159
|
+
e = P();
|
|
160
|
+
while (this._seenInstanceIds.has(e));
|
|
161
|
+
return this._seenInstanceIds.add(e), e;
|
|
161
162
|
}
|
|
162
163
|
/**
|
|
163
164
|
* Stamps the export-read currency attrs onto every price `<p>` from config, so a template whose
|
|
@@ -170,11 +171,11 @@ class $ extends H {
|
|
|
170
171
|
* Returns true only when an attr actually changed, so the caller can skip an empty apply that
|
|
171
172
|
* would otherwise re-trigger onDocumentChanged and loop.
|
|
172
173
|
*/
|
|
173
|
-
_reconcileCurrencyDomAttributes(
|
|
174
|
-
const { position: r, symbol: o } = w(
|
|
174
|
+
_reconcileCurrencyDomAttributes(t, e, c) {
|
|
175
|
+
const { position: r, symbol: o } = w(e), n = t.querySelectorAll(`.${E.PRICE} p`);
|
|
175
176
|
let i = !1;
|
|
176
|
-
return
|
|
177
|
-
r !== void 0 &&
|
|
177
|
+
return n.forEach((s) => {
|
|
178
|
+
r !== void 0 && s.getAttribute(y.POSITION) !== r && (c.modifyHtml(s).setAttribute(y.POSITION, r), i = !0), o !== void 0 && s.getAttribute(y.SYMBOL) !== o && (c.modifyHtml(s).setAttribute(y.SYMBOL, o), i = !0);
|
|
178
179
|
}), i;
|
|
179
180
|
}
|
|
180
181
|
}
|