@useinsider/guido 2.1.0-beta.7d0f92a → 2.1.0-beta.84a7014
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/README.md +77 -2
- package/dist/@types/config/schemas.js +70 -65
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +73 -62
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +1 -1
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +19 -19
- package/dist/composables/useBlocksConfig.js +26 -16
- package/dist/composables/useHtmlValidator.js +107 -119
- package/dist/composables/useSave.js +16 -12
- package/dist/composables/useStripo.js +63 -57
- package/dist/composables/useStripoEventHandler.js +27 -12
- package/dist/composables/useSyncModuleExtractor.js +45 -0
- package/dist/composables/useVersionHistoryApi.js +1 -1
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +27 -22
- package/dist/config/i18n/en/index.js +11 -0
- package/dist/config/i18n/en/labels.json.js +7 -0
- package/dist/config/i18n/en/toasters.json.js +56 -0
- package/dist/config/i18n/en/tooltips.json.js +82 -0
- package/dist/config/i18n/index.js +7 -0
- package/dist/config/migrator/itemsBlockMigrator.js +127 -122
- package/dist/enums/defaults.js +8 -4
- package/dist/enums/unsubscribe.js +25 -21
- package/dist/extensions/Blocks/Recommendation/block.js +26 -23
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +27 -26
- package/dist/extensions/Blocks/Recommendation/constants/layout.js +6 -4
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +12 -10
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +103 -70
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +87 -37
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +138 -117
- package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +21 -0
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +117 -107
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +25 -30
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +27 -30
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +20 -25
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +43 -31
- package/dist/extensions/Blocks/Unsubscribe/block.js +29 -29
- package/dist/extensions/Blocks/Unsubscribe/control.js +12 -9
- package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +13 -11
- package/dist/extensions/Blocks/Unsubscribe/styles.css.js +31 -1
- package/dist/extensions/ModulesTabIcons/extension.js +17 -0
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +257 -187
- package/dist/services/recommendationApi.js +11 -9
- package/dist/services/stripoApi.js +56 -17
- package/dist/src/@types/config/schemas.d.ts +9 -1
- package/dist/src/@types/events.d.ts +38 -2
- package/dist/src/components/Guido.vue.d.ts +2 -2
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useGuidoActions.d.ts +1 -1
- package/dist/src/composables/useSave.d.ts +2 -2
- package/dist/src/composables/useStripo.d.ts +2 -2
- package/dist/src/composables/useSyncModuleExtractor.d.ts +4 -0
- package/dist/src/config/i18n/en/index.d.ts +1 -0
- package/dist/src/config/i18n/index.d.ts +16 -0
- package/dist/src/enums/defaults.d.ts +4 -0
- package/dist/src/enums/unsubscribe.d.ts +3 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +2 -2
- package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +4 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +12 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +22 -4
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +9 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +29 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +12 -3
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
- package/dist/src/extensions/Blocks/Unsubscribe/control.d.ts +1 -0
- package/dist/src/extensions/ModulesTabIcons/extension.d.ts +2 -0
- package/dist/src/mock/api/settings.d.ts +2 -0
- package/dist/src/services/stripoApi.d.ts +5 -0
- package/dist/src/stores/config.d.ts +36 -0
- package/dist/src/stores/editor.d.ts +23 -0
- package/dist/src/utils/templatePreparation.d.ts +1 -1
- package/dist/static/styles/components/notification.css.js +19 -0
- package/dist/static/styles/components/tools.css.js +6 -2
- package/dist/static/styles/components/version-history.css.js +10 -2
- package/dist/static/styles/components/wide-panel.css.js +18 -2
- package/dist/static/styles/customEditorStyle.css.js +10 -9
- package/dist/static/styles/variables.css.js +2 -0
- package/dist/static/templates/empty/index.html.js +74 -0
- package/dist/static/templates/empty/style.css.js +779 -0
- package/dist/stores/editor.js +2 -1
- package/dist/stores/unsubscribe.js +37 -34
- package/dist/utils/templatePreparation.js +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var M = (
|
|
4
|
-
import { productPairs as
|
|
5
|
-
import { ItemInCartOptions as
|
|
1
|
+
var v = Object.defineProperty;
|
|
2
|
+
var B = (e, t, r) => t in e ? v(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
|
|
3
|
+
var M = (e, t, r) => B(e, typeof t != "symbol" ? t + "" : t, r);
|
|
4
|
+
import { productPairs as U } from "../../extensions/Blocks/Items/enums/productEnums.js";
|
|
5
|
+
import { ItemInCartOptions as T, DefaultConfigValues as g, SETTINGS_ENUMS as u } from "../../extensions/Blocks/Items/enums/settingsEnums.js";
|
|
6
6
|
import { getDefaultTemplate as K } from "../../extensions/Blocks/Items/template.js";
|
|
7
7
|
const w = {
|
|
8
8
|
img: {
|
|
@@ -74,76 +74,77 @@ const w = {
|
|
|
74
74
|
function F() {
|
|
75
75
|
return String(Date.now() + Math.floor(Math.random() * 1e3));
|
|
76
76
|
}
|
|
77
|
-
function q(
|
|
78
|
-
return
|
|
79
|
-
CartItems:
|
|
80
|
-
BrowsedItems:
|
|
81
|
-
PurchasedItems:
|
|
82
|
-
CART_ITEMS:
|
|
83
|
-
BROWSED_ITEMS:
|
|
84
|
-
PURCHASED_ITEMS:
|
|
85
|
-
}[
|
|
77
|
+
function q(e) {
|
|
78
|
+
return e ? {
|
|
79
|
+
CartItems: u.ITEMS_TYPE.CART_ITEMS,
|
|
80
|
+
BrowsedItems: u.ITEMS_TYPE.BROWSED_ITEMS,
|
|
81
|
+
PurchasedItems: u.ITEMS_TYPE.PURCHASED_ITEMS,
|
|
82
|
+
CART_ITEMS: u.ITEMS_TYPE.CART_ITEMS,
|
|
83
|
+
BROWSED_ITEMS: u.ITEMS_TYPE.BROWSED_ITEMS,
|
|
84
|
+
PURCHASED_ITEMS: u.ITEMS_TYPE.PURCHASED_ITEMS
|
|
85
|
+
}[e] || u.ITEMS_TYPE.CART_ITEMS : u.ITEMS_TYPE.CART_ITEMS;
|
|
86
86
|
}
|
|
87
|
-
function R(
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
function R(e) {
|
|
88
|
+
var a;
|
|
89
|
+
const t = (_, c) => _ == null ? c : _ === "1" || _ === "true", r = (_, c) => _ || c, l = e["data-type"] || e["data-source"], i = q(l), n = T[i];
|
|
90
|
+
let o = e["data-cart_items_select_control_value"] || ((a = n == null ? void 0 : n[0]) == null ? void 0 : a.value) || g.cartItemsSelectControlValue;
|
|
91
|
+
if (o && !o.includes("{{") && /^\d+$/.test(o)) {
|
|
92
|
+
const _ = parseInt(o) - 1, c = T[i];
|
|
93
|
+
c && c[_] && (o = c[_].value);
|
|
93
94
|
}
|
|
94
95
|
return {
|
|
95
96
|
initialized: !0,
|
|
96
|
-
blockInstanceId: e
|
|
97
|
-
source:
|
|
98
|
-
type:
|
|
99
|
-
itemsSelectValue:
|
|
100
|
-
orientation:
|
|
101
|
-
nameTrimming: t(
|
|
102
|
-
priceHideDiscount: t(
|
|
103
|
-
priceFormatted: t(
|
|
104
|
-
priceSinglePrice: t(
|
|
105
|
-
priceCurrencySymbol:
|
|
106
|
-
|
|
97
|
+
blockInstanceId: r(e["data-block-instance-id"], F()),
|
|
98
|
+
source: i,
|
|
99
|
+
type: i,
|
|
100
|
+
itemsSelectValue: o,
|
|
101
|
+
orientation: e["data-card_orientation_control_value"] || u.ORIENTATION.VERTICAL,
|
|
102
|
+
nameTrimming: t(e["data-product_name_control_trim"], !0),
|
|
103
|
+
priceHideDiscount: t(e["data-product_price_control_nodup"], !0),
|
|
104
|
+
priceFormatted: t(e["data-product_price_control_formated"], !0),
|
|
105
|
+
priceSinglePrice: t(e["data-product_price_control_single_price"], !1),
|
|
106
|
+
priceCurrencySymbol: r(
|
|
107
|
+
e["data-product_price_control_currency_symbol"],
|
|
107
108
|
g.productPriceCurrencySymbolControlValue
|
|
108
109
|
),
|
|
109
|
-
priceCurrencyLocation:
|
|
110
|
-
|
|
110
|
+
priceCurrencyLocation: r(
|
|
111
|
+
e["data-product_price_currency_location"],
|
|
111
112
|
g.productPriceCurrencyLocationControlValue
|
|
112
113
|
),
|
|
113
|
-
priceOrientation:
|
|
114
|
-
quantityControlEnabled: t(
|
|
115
|
-
buttonLink: e
|
|
116
|
-
imageLink: e
|
|
117
|
-
buttonLabel: e
|
|
118
|
-
buttonFullWidth: t(
|
|
119
|
-
imageVisible: t(
|
|
120
|
-
nameVisible: t(
|
|
121
|
-
quantityVisible: t(
|
|
122
|
-
priceVisible: t(
|
|
123
|
-
originalPriceVisible: t(
|
|
124
|
-
buttonVisible: t(
|
|
114
|
+
priceOrientation: e["data-product_original_price_control_orientation"] || "horizontal",
|
|
115
|
+
quantityControlEnabled: t(e["data-product_quantity_control_enabled"], !0),
|
|
116
|
+
buttonLink: r(e["data-product_button_link"], g.productButtonLinkControlValue),
|
|
117
|
+
imageLink: r(e["data-product_image_link"], g.productImageLinkControlValue),
|
|
118
|
+
buttonLabel: r(e["data-product_button_control_label"], "Buy"),
|
|
119
|
+
buttonFullWidth: t(e["data-product_button_control_atw"], !0),
|
|
120
|
+
imageVisible: t(e["data-product_image_control_enabled"], !0),
|
|
121
|
+
nameVisible: t(e["data-product_name_control_enabled"], !0),
|
|
122
|
+
quantityVisible: t(e["data-product_quantity_control_enabled"], !0),
|
|
123
|
+
priceVisible: t(e["data-product_price_control_enabled"], !0),
|
|
124
|
+
originalPriceVisible: t(e["data-product_original_price_control_enabled"], !0),
|
|
125
|
+
buttonVisible: t(e["data-product_button_control_enabled"], !0)
|
|
125
126
|
};
|
|
126
127
|
}
|
|
127
|
-
const
|
|
128
|
+
const O = {
|
|
128
129
|
ins_apr: "CART_ITEMS",
|
|
129
130
|
browsed_item: "BROWSED_ITEMS",
|
|
130
131
|
purchased_item: "PURCHASED_ITEMS"
|
|
131
132
|
};
|
|
132
|
-
function
|
|
133
|
-
const
|
|
133
|
+
function $(e, t) {
|
|
134
|
+
const r = {
|
|
134
135
|
CART_ITEMS: `{{Abandoned Cart Item (${t}) Image}}`,
|
|
135
136
|
BROWSED_ITEMS: `{{Browsed Item (${t}) Image}}`,
|
|
136
137
|
PURCHASED_ITEMS: `{{Purchased Item (${t}) Image}}`
|
|
137
138
|
};
|
|
138
|
-
return e
|
|
139
|
+
return r[e] || r.CART_ITEMS;
|
|
139
140
|
}
|
|
140
|
-
function
|
|
141
|
-
const
|
|
141
|
+
function x(e, t) {
|
|
142
|
+
const r = {
|
|
142
143
|
CART_ITEMS: `{{Abandoned Cart Item (${t}) Url}}`,
|
|
143
144
|
BROWSED_ITEMS: `{{Browsed Item (${t}) Url}}`,
|
|
144
145
|
PURCHASED_ITEMS: `{{Purchased Item (${t}) Url}}`
|
|
145
146
|
};
|
|
146
|
-
return e
|
|
147
|
+
return r[e] || r.CART_ITEMS;
|
|
147
148
|
}
|
|
148
149
|
class V {
|
|
149
150
|
constructor() {
|
|
@@ -152,40 +153,40 @@ class V {
|
|
|
152
153
|
}
|
|
153
154
|
migrate(t) {
|
|
154
155
|
try {
|
|
155
|
-
let
|
|
156
|
-
|
|
157
|
-
const
|
|
156
|
+
let r = this.removeJinjaConditionals(t);
|
|
157
|
+
r = this.replaceTemplateVariables(r);
|
|
158
|
+
const l = this.parser.parseFromString(r, "text/html"), i = l.querySelectorAll(
|
|
158
159
|
"td.esd-cart-items-block, td.esd-browsed-items-block, td.esd-purchased-items-block"
|
|
159
160
|
);
|
|
160
|
-
return
|
|
161
|
-
const
|
|
162
|
-
orientation:
|
|
163
|
-
itemsType:
|
|
164
|
-
itemId:
|
|
165
|
-
currencySymbol:
|
|
166
|
-
currencyLocation:
|
|
167
|
-
formattedPrice:
|
|
168
|
-
configBlockAttributes:
|
|
161
|
+
return i.length === 0 ? (console.warn("ItemsBlockMigrator: No blocks found with items block selectors"), r) : (i.forEach((n) => {
|
|
162
|
+
const o = this.extractConfiguration(n), a = K({
|
|
163
|
+
orientation: o.orientation,
|
|
164
|
+
itemsType: o.itemsType,
|
|
165
|
+
itemId: o.itemId,
|
|
166
|
+
currencySymbol: o.currencySymbol,
|
|
167
|
+
currencyLocation: o.currencyLocation,
|
|
168
|
+
formattedPrice: o.formattedPrice,
|
|
169
|
+
configBlockAttributes: o.configBlockAttributes,
|
|
169
170
|
migrate: !0,
|
|
170
|
-
nameStyles:
|
|
171
|
-
buttonStyles:
|
|
172
|
-
priceStyles:
|
|
173
|
-
originalPriceStyles:
|
|
174
|
-
quantityStyles:
|
|
175
|
-
nodeConfig: R(
|
|
171
|
+
nameStyles: o.nameStyles,
|
|
172
|
+
buttonStyles: o.buttonStyles,
|
|
173
|
+
priceStyles: o.priceStyles,
|
|
174
|
+
originalPriceStyles: o.originalPriceStyles,
|
|
175
|
+
quantityStyles: o.quantityStyles,
|
|
176
|
+
nodeConfig: R(o.configBlockAttributes)
|
|
176
177
|
}), c = this.parser.parseFromString(
|
|
177
|
-
`<table><tbody><tr>${
|
|
178
|
+
`<table><tbody><tr>${a}</tr></tbody></table>`,
|
|
178
179
|
"text/html"
|
|
179
180
|
).querySelector("td");
|
|
180
181
|
if (c && n.parentNode) {
|
|
181
|
-
const f = R(
|
|
182
|
+
const f = R(o.configBlockAttributes);
|
|
182
183
|
c.setAttribute("esd-ext-config", JSON.stringify(f));
|
|
183
|
-
const
|
|
184
|
-
|
|
184
|
+
const d = c.querySelector("esd-config-block");
|
|
185
|
+
d && d.remove(), n.parentNode.replaceChild(c, n);
|
|
185
186
|
}
|
|
186
|
-
}),
|
|
187
|
-
} catch (
|
|
188
|
-
return console.error("ItemsBlockMigrator failed:",
|
|
187
|
+
}), l.documentElement.outerHTML);
|
|
188
|
+
} catch (r) {
|
|
189
|
+
return console.error("ItemsBlockMigrator failed:", r), t;
|
|
189
190
|
}
|
|
190
191
|
}
|
|
191
192
|
/**
|
|
@@ -196,22 +197,22 @@ class V {
|
|
|
196
197
|
*/
|
|
197
198
|
extractConfiguration(t) {
|
|
198
199
|
var C, D, P;
|
|
199
|
-
const
|
|
200
|
-
let
|
|
201
|
-
|
|
202
|
-
const p = t.querySelector('a[product-attr="name"]'),
|
|
200
|
+
const r = ((C = t.querySelector("[data-type]")) == null ? void 0 : C.getAttribute("data-type")) || "CART_ITEMS", l = ((D = t.querySelector("[data-number]")) == null ? void 0 : D.getAttribute("data-number")) || "1", i = parseInt(l) - 1, n = T[r], o = ((P = n == null ? void 0 : n[i]) == null ? void 0 : P.value) || n[0].value, a = t.querySelector('[product-attr="price"]'), _ = (a == null ? void 0 : a.getAttribute("data-currency_symbol")) || "USD", f = ((a == null ? void 0 : a.getAttribute("data-curency")) || "before") === "after" ? "1" : "0", d = (a == null ? void 0 : a.getAttribute("data-formated")) !== "false", s = this.extractConfigBlockAttributes(t, r, l), S = s["data-card_orientation_control_value"];
|
|
201
|
+
let b;
|
|
202
|
+
S ? b = S === "horizontal" ? "horizontal" : "vertical" : b = t.querySelector('[colspan="2"]') !== null ? "vertical" : "horizontal";
|
|
203
|
+
const p = t.querySelector('a[product-attr="name"]'), I = (p == null ? void 0 : p.getAttribute("style")) || void 0, y = t.querySelector('a[product-attr="button"]'), m = (y == null ? void 0 : y.getAttribute("style")) || void 0, h = (a == null ? void 0 : a.getAttribute("style")) || void 0, A = t.querySelector("p.original-price"), k = (A == null ? void 0 : A.getAttribute("style")) || void 0, E = t.querySelector('[product-attr="quantity"]'), L = (E == null ? void 0 : E.getAttribute("style")) || void 0;
|
|
203
204
|
return {
|
|
204
|
-
orientation:
|
|
205
|
-
itemsType:
|
|
206
|
-
itemId:
|
|
205
|
+
orientation: b,
|
|
206
|
+
itemsType: r,
|
|
207
|
+
itemId: o,
|
|
207
208
|
currencySymbol: _,
|
|
208
209
|
currencyLocation: f,
|
|
209
|
-
formattedPrice:
|
|
210
|
+
formattedPrice: d,
|
|
210
211
|
configBlockAttributes: s,
|
|
211
|
-
nameStyles:
|
|
212
|
+
nameStyles: I,
|
|
212
213
|
buttonStyles: m,
|
|
213
|
-
priceStyles:
|
|
214
|
-
originalPriceStyles:
|
|
214
|
+
priceStyles: h,
|
|
215
|
+
originalPriceStyles: k,
|
|
215
216
|
quantityStyles: L
|
|
216
217
|
};
|
|
217
218
|
}
|
|
@@ -222,27 +223,27 @@ class V {
|
|
|
222
223
|
* @param itemsType - The type of items (CART_ITEMS, BROWSED_ITEMS, PURCHASED_ITEMS)
|
|
223
224
|
* @param itemNumber - The item number (1-based index)
|
|
224
225
|
*/
|
|
225
|
-
extractConfigBlockAttributes(t,
|
|
226
|
-
const
|
|
227
|
-
if (!
|
|
226
|
+
extractConfigBlockAttributes(t, r, l) {
|
|
227
|
+
const i = t.querySelector("esd-config-block"), n = {};
|
|
228
|
+
if (!i)
|
|
228
229
|
return this.getDefaultConfigBlockAttributes();
|
|
229
|
-
if (Array.from(
|
|
230
|
-
|
|
230
|
+
if (Array.from(i.attributes).forEach((a) => {
|
|
231
|
+
a.name.startsWith("data-") && (n[a.name] = a.value);
|
|
231
232
|
}), n["data-cart_items_select_control_value"]) {
|
|
232
|
-
const
|
|
233
|
-
if (/^\d+$/.test(
|
|
234
|
-
const _ = parseInt(
|
|
233
|
+
const a = n["data-cart_items_select_control_value"];
|
|
234
|
+
if (/^\d+$/.test(a)) {
|
|
235
|
+
const _ = parseInt(a) - 1, c = T[r];
|
|
235
236
|
c && c[_] && (n["data-cart_items_select_control_value"] = c[_].value);
|
|
236
237
|
}
|
|
237
238
|
}
|
|
238
239
|
if (n["data-product_price_control_curency"]) {
|
|
239
|
-
const
|
|
240
|
-
let _ =
|
|
241
|
-
|
|
240
|
+
const a = n["data-product_price_control_curency"];
|
|
241
|
+
let _ = a;
|
|
242
|
+
a === "before" ? _ = "0" : a === "after" && (_ = "1"), n["data-product_price_control_curency"] = _, n["data-product_price_currency_location"] = _;
|
|
242
243
|
}
|
|
243
244
|
(!n["data-product_price_control_currency_symbol"] || n["data-product_price_control_currency_symbol"].trim() === "") && (n["data-product_price_control_currency_symbol"] = "USD");
|
|
244
|
-
const
|
|
245
|
-
return
|
|
245
|
+
const o = { ...this.getDefaultConfigBlockAttributes(), ...n };
|
|
246
|
+
return o["data-type"] = r, o["data-source"] = r, o["data-product_image_link"] = $(r, l), o["data-product_button_link"] = x(r, l), o;
|
|
246
247
|
}
|
|
247
248
|
/**
|
|
248
249
|
* Returns default esd-config-block attributes based on the old template structure
|
|
@@ -297,18 +298,22 @@ class V {
|
|
|
297
298
|
* - Cart Items: ins_apr_total_product_kind, ins_apr_price_N, ins_apr_originalprice_N
|
|
298
299
|
* - Browsed Items: browsed_item_total_product_kind, browsed_item_price_N, browsed_item_originalprice_N
|
|
299
300
|
* - Purchased Items: purchased_item_total_product_kind, purchased_item_price_N, purchased_item_originalprice_N
|
|
301
|
+
*
|
|
302
|
+
* IMPORTANT: Preserves the esd-custom-display-conditions attribute on <body> which
|
|
303
|
+
* contains display condition Jinja scripts that should NOT be removed.
|
|
300
304
|
*/
|
|
301
305
|
removeJinjaConditionals(t) {
|
|
302
|
-
|
|
306
|
+
const r = "__ESD_DISPLAY_CONDITIONS_PLACEHOLDER__", l = t.match(/esd-custom-display-conditions="[^"]*"/);
|
|
307
|
+
let i = l ? t.replace(l[0], r) : t;
|
|
308
|
+
return i = i.replace(
|
|
303
309
|
/\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_total_product_kind\s*(>|>)\s*\d+\s*%\}/g,
|
|
304
310
|
""
|
|
305
|
-
)
|
|
306
|
-
return e = e.replace(
|
|
311
|
+
), i = i.replace(
|
|
307
312
|
/\{%\s*if\s+(ins_apr|browsed_item|purchased_item)_price_\d+\s*(!=|!=)\s*\1_originalprice_\d+\s*%\}/g,
|
|
308
313
|
""
|
|
309
|
-
),
|
|
314
|
+
), i = i.replace(/\{%\s*endif\s*%\}/g, ""), l && (i = i.replace(r, l[0])), i = i.replace(/\n\s*\n\s*\n/g, `
|
|
310
315
|
|
|
311
|
-
`),
|
|
316
|
+
`), i;
|
|
312
317
|
}
|
|
313
318
|
/**
|
|
314
319
|
* Replaces template variables with default values from productPairs
|
|
@@ -320,31 +325,31 @@ class V {
|
|
|
320
325
|
* - {{purchased_item_formattedprice_5}} → '1,490.49' (PURCHASED_ITEMS)
|
|
321
326
|
*/
|
|
322
327
|
replaceTemplateVariables(t) {
|
|
323
|
-
const { PAIRS_FOR_EXTENSION:
|
|
324
|
-
return t.replace(/{{([^}]+)}}/g, (
|
|
325
|
-
const n =
|
|
328
|
+
const { PAIRS_FOR_EXTENSION: r } = U;
|
|
329
|
+
return t.replace(/{{([^}]+)}}/g, (l, i) => {
|
|
330
|
+
const n = i.match(/^(ins_apr|browsed_item|purchased_item)_([a-z_]+)_(\d+)$/);
|
|
326
331
|
if (!n)
|
|
327
|
-
return
|
|
328
|
-
const [,
|
|
332
|
+
return l;
|
|
333
|
+
const [, o, a, _] = n, c = O[o];
|
|
329
334
|
if (!c)
|
|
330
|
-
return console.warn(`Unknown variable prefix: ${
|
|
331
|
-
const f = w[
|
|
335
|
+
return console.warn(`Unknown variable prefix: ${o}`), l;
|
|
336
|
+
const f = w[a];
|
|
332
337
|
if (!f)
|
|
333
|
-
return console.warn(`Unknown variable suffix mapping for: ${
|
|
334
|
-
const { pairsKey:
|
|
338
|
+
return console.warn(`Unknown variable suffix mapping for: ${a}`), l;
|
|
339
|
+
const { pairsKey: d, defaultKey: s, isArray: S } = f, p = r[d][c];
|
|
335
340
|
if (!p)
|
|
336
|
-
return console.warn(`No data found for: ${
|
|
337
|
-
if (
|
|
341
|
+
return console.warn(`No data found for: ${d}.${c}`), l;
|
|
342
|
+
if (S) {
|
|
338
343
|
const y = parseInt(_) - 1, m = p[s];
|
|
339
|
-
return Array.isArray(m) && m[y] ? m[y] : (console.warn(`Array value not found: ${
|
|
344
|
+
return Array.isArray(m) && m[y] ? m[y] : (console.warn(`Array value not found: ${d}.${c}.${s}[${y}]`), l);
|
|
340
345
|
}
|
|
341
|
-
const
|
|
342
|
-
return
|
|
346
|
+
const I = p[s];
|
|
347
|
+
return I !== void 0 ? String(I) : (console.warn(`Default value not found: ${d}.${c}.${s}`), l);
|
|
343
348
|
});
|
|
344
349
|
}
|
|
345
350
|
}
|
|
346
|
-
function G(
|
|
347
|
-
return new V().migrate(
|
|
351
|
+
function G(e) {
|
|
352
|
+
return new V().migrate(e);
|
|
348
353
|
}
|
|
349
354
|
export {
|
|
350
355
|
G as migrateItemsBlock
|
package/dist/enums/defaults.js
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
-
const
|
|
1
|
+
const e = {
|
|
2
2
|
transactional: 2
|
|
3
|
-
}, o = 2,
|
|
3
|
+
}, o = 2, t = 13, s = {
|
|
4
|
+
SAVED_MODULES: "savedModules",
|
|
5
|
+
DEFAULT_MODULES: "defaultModules"
|
|
6
|
+
};
|
|
4
7
|
export {
|
|
5
8
|
o as EditorType,
|
|
6
|
-
|
|
7
|
-
|
|
9
|
+
t as MAX_DEFAULT_TEMPLATE_ID,
|
|
10
|
+
s as ModuleFolderDefaults,
|
|
11
|
+
e as TemplateTypes
|
|
8
12
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { useTranslations as e } from "../composables/useTranslations.js";
|
|
2
2
|
import { getEnvironmentPrefix as R } from "../utils/environmentUtil.js";
|
|
3
|
-
const
|
|
3
|
+
const _ = {
|
|
4
4
|
UNSUBSCRIBE_LINK_TYPE: 1,
|
|
5
5
|
PREFERENCES_LINK_TYPE: 3
|
|
6
|
-
},
|
|
6
|
+
}, I = {
|
|
7
7
|
UNSUBSCRIBE_LINK_REGEX: /{{ins-unsubscribe-link}}/g,
|
|
8
8
|
DATA_OGSB_BUTTON_CSS_REGEX: "\\[data-ogsb\\]\\s*\\.es-button\\.es-button-[0-9]+\\s*\\{(?:[^\\}]*)\\}",
|
|
9
9
|
GLOBAL_UNSUBSCRIBE_LINK_REGEX: /{{ins-global-unsubscribe-link}}/g,
|
|
10
10
|
PREFERENCES_UNSUBSCRIBE_LINK_REGEX: /{{ins-preferences-unsubscribe-link}}/g
|
|
11
|
-
},
|
|
12
|
-
UNSUBSCRIBE_URL: `https://mail.${
|
|
13
|
-
PREFERENCES_URL: `https://mail.${
|
|
14
|
-
},
|
|
11
|
+
}, n = R(), r = {
|
|
12
|
+
UNSUBSCRIBE_URL: `https://mail.${n}.com/user/v1/unsub`,
|
|
13
|
+
PREFERENCES_URL: `https://mail.${n}.com/user/v1/prefs`
|
|
14
|
+
}, B = "iid", i = {
|
|
15
15
|
name: "Global Unsubscribe",
|
|
16
16
|
sendGridId: "G"
|
|
17
17
|
}, C = "/email/unsubscribe-pages", E = {
|
|
@@ -20,6 +20,9 @@ const I = {
|
|
|
20
20
|
SUBSCRIPTION_PREFERENCE_CENTER: 3,
|
|
21
21
|
SUBSCRIPTION_PREFERENCE_CONFIRMATION: 4,
|
|
22
22
|
RESUBSCRIBE: 5
|
|
23
|
+
}, U = {
|
|
24
|
+
[E.GLOBAL_UNSUBSCRIBE]: "custom-unsubscribe",
|
|
25
|
+
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "custom-preferences"
|
|
23
26
|
}, t = {
|
|
24
27
|
[E.GLOBAL_UNSUBSCRIBE]: [
|
|
25
28
|
E.GLOBAL_UNSUBSCRIBE,
|
|
@@ -30,29 +33,30 @@ const I = {
|
|
|
30
33
|
E.SUBSCRIPTION_PREFERENCE_CENTER,
|
|
31
34
|
E.SUBSCRIPTION_PREFERENCE_CONFIRMATION
|
|
32
35
|
]
|
|
33
|
-
},
|
|
34
|
-
const
|
|
36
|
+
}, c = () => {
|
|
37
|
+
const s = e();
|
|
35
38
|
return {
|
|
36
|
-
[E.GLOBAL_UNSUBSCRIBE]:
|
|
37
|
-
[E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]:
|
|
38
|
-
[E.RESUBSCRIBE]:
|
|
39
|
-
[E.SUBSCRIPTION_PREFERENCE_CENTER]:
|
|
40
|
-
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]:
|
|
39
|
+
[E.GLOBAL_UNSUBSCRIBE]: s("unsubscription-preference.type-global-unsubscribe"),
|
|
40
|
+
[E.GLOBAL_UNSUBSCRIBE_CONFIRMATION_PAGE]: s("unsubscription-preference.type-global-unsubscription-confirmation"),
|
|
41
|
+
[E.RESUBSCRIBE]: s("unsubscription-preference.type-resubscribe"),
|
|
42
|
+
[E.SUBSCRIPTION_PREFERENCE_CENTER]: s("unsubscription-preference.type-subscription-preferences-center"),
|
|
43
|
+
[E.SUBSCRIPTION_PREFERENCE_CONFIRMATION]: s("unsubscription-preference.type-subscription-preferences-confirmation")
|
|
41
44
|
};
|
|
42
|
-
},
|
|
45
|
+
}, o = {
|
|
43
46
|
default: "{{ins-unsubscribe-link}}",
|
|
44
47
|
[E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
|
|
45
48
|
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
|
|
46
49
|
};
|
|
47
50
|
export {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
i as DEFAULT_UNSUBSCRIBE_GROUP,
|
|
52
|
+
B as INSIDER_ID,
|
|
53
|
+
I as LINK_REGEXES,
|
|
54
|
+
_ as LINK_TYPES,
|
|
55
|
+
o as MERGE_TAGS,
|
|
53
56
|
E as PAGE_TYPES,
|
|
54
57
|
t as TYPE_COLLECTIONS,
|
|
55
58
|
C as UNSUBSCRIBE_PAGES_LINK,
|
|
56
|
-
|
|
57
|
-
|
|
59
|
+
U as UNSUBSCRIBE_SYNC_MODULE_TYPES,
|
|
60
|
+
r as URLS,
|
|
61
|
+
c as getTypeTranslations
|
|
58
62
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var g = (r,
|
|
4
|
-
import { Block as
|
|
1
|
+
var p = Object.defineProperty;
|
|
2
|
+
var f = (r, o, t) => o in r ? p(r, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[o] = t;
|
|
3
|
+
var g = (r, o, t) => f(r, typeof o != "symbol" ? o + "" : o, t);
|
|
4
|
+
import { Block as h, BlockCompositionType as I, ModificationDescription as _ } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { ensureMobileCssRulesExist as d } from "./controls/mobileLayout/cssRules.js";
|
|
5
6
|
import { RecommendationConfigService as s } from "./services/configService.js";
|
|
6
|
-
import { useRecommendationExtensionStore as
|
|
7
|
-
import { getDefaultTemplate as
|
|
8
|
-
const
|
|
9
|
-
class
|
|
7
|
+
import { useRecommendationExtensionStore as u } from "./store/recommendation.js";
|
|
8
|
+
import { getDefaultTemplate as k } from "./templates/grid/template.js";
|
|
9
|
+
const B = "recommendation-block", c = "ins-recommendation-v3-block-v2", a = "recommendation-id";
|
|
10
|
+
class y extends h {
|
|
10
11
|
constructor() {
|
|
11
12
|
super();
|
|
12
13
|
/**
|
|
@@ -16,7 +17,7 @@ class b extends f {
|
|
|
16
17
|
g(this, "_pendingBlockId", null);
|
|
17
18
|
}
|
|
18
19
|
getId() {
|
|
19
|
-
return
|
|
20
|
+
return B;
|
|
20
21
|
}
|
|
21
22
|
getIcon() {
|
|
22
23
|
return "recommendation-icon";
|
|
@@ -39,7 +40,7 @@ class b extends f {
|
|
|
39
40
|
*/
|
|
40
41
|
getTemplate() {
|
|
41
42
|
const t = this._generateNextId();
|
|
42
|
-
return this._pendingBlockId = t,
|
|
43
|
+
return this._pendingBlockId = t, k(t);
|
|
43
44
|
}
|
|
44
45
|
/**
|
|
45
46
|
* Called when a new block is dropped into the template
|
|
@@ -50,7 +51,9 @@ class b extends f {
|
|
|
50
51
|
*/
|
|
51
52
|
onCreated(t) {
|
|
52
53
|
const e = this._pendingBlockId ?? this._generateNextId();
|
|
53
|
-
this._pendingBlockId = null, this._assignRecommendationId(t, e)
|
|
54
|
+
this._pendingBlockId = null, this._assignRecommendationId(t, e);
|
|
55
|
+
const n = s.initializeConfig(this.api, t, { recommendationId: e }), i = u();
|
|
56
|
+
i.setCurrentBlock(e), d(this.api), i.patchCurrentBlockConfig({ language: n.language }, { triggerRefetch: !1 });
|
|
54
57
|
}
|
|
55
58
|
/**
|
|
56
59
|
* Called when the document changes or template is loaded
|
|
@@ -70,7 +73,7 @@ class b extends f {
|
|
|
70
73
|
"Assign recommendation ID to legacy block"
|
|
71
74
|
);
|
|
72
75
|
}
|
|
73
|
-
s.needsMigration(t) && this._migrateFromLegacy(t);
|
|
76
|
+
s.needsMigration(t) && this._migrateFromLegacy(t), d(this.api);
|
|
74
77
|
}
|
|
75
78
|
}
|
|
76
79
|
/**
|
|
@@ -81,7 +84,7 @@ class b extends f {
|
|
|
81
84
|
*/
|
|
82
85
|
onDelete(t) {
|
|
83
86
|
const e = this._getRecommendationId(t);
|
|
84
|
-
e &&
|
|
87
|
+
e && u().removeBlockState(e);
|
|
85
88
|
}
|
|
86
89
|
/**
|
|
87
90
|
* Generates the next unique recommendation ID by scanning all existing blocks
|
|
@@ -91,9 +94,9 @@ class b extends f {
|
|
|
91
94
|
let t = 0;
|
|
92
95
|
try {
|
|
93
96
|
const e = this.api.getDocumentRoot();
|
|
94
|
-
e && "querySelectorAll" in e && e.querySelectorAll(`.${c}`).forEach((
|
|
95
|
-
if ("getAttribute" in
|
|
96
|
-
const
|
|
97
|
+
e && "querySelectorAll" in e && e.querySelectorAll(`.${c}`).forEach((i) => {
|
|
98
|
+
if ("getAttribute" in i) {
|
|
99
|
+
const m = i.getAttribute(a), l = m ? parseInt(m) : 0;
|
|
97
100
|
l > t && (t = l);
|
|
98
101
|
}
|
|
99
102
|
});
|
|
@@ -111,8 +114,8 @@ class b extends f {
|
|
|
111
114
|
const n = this._getBlockElement(t);
|
|
112
115
|
if (!n)
|
|
113
116
|
return;
|
|
114
|
-
const
|
|
115
|
-
|
|
117
|
+
const i = this.api.getDocumentModifier();
|
|
118
|
+
i.modifyHtml(n).setAttribute(a, e.toString()), i.apply(new _(`Assign recommendation ID ${e}`));
|
|
116
119
|
}
|
|
117
120
|
/**
|
|
118
121
|
* Gets the recommendation-id from a block node
|
|
@@ -121,11 +124,11 @@ class b extends f {
|
|
|
121
124
|
const e = this._getBlockElement(t);
|
|
122
125
|
if (!e || !("getAttribute" in e))
|
|
123
126
|
return null;
|
|
124
|
-
const n = e.getAttribute(
|
|
127
|
+
const n = e.getAttribute(a);
|
|
125
128
|
if (!n)
|
|
126
129
|
return null;
|
|
127
|
-
const
|
|
128
|
-
return Number.isNaN(
|
|
130
|
+
const i = parseInt(n);
|
|
131
|
+
return Number.isNaN(i) ? null : i;
|
|
129
132
|
}
|
|
130
133
|
/**
|
|
131
134
|
* Gets the block element (the element with BLOCK_CLASS)
|
|
@@ -146,6 +149,6 @@ class b extends f {
|
|
|
146
149
|
}
|
|
147
150
|
}
|
|
148
151
|
export {
|
|
149
|
-
|
|
150
|
-
|
|
152
|
+
B as BLOCK_ID,
|
|
153
|
+
y as RecommendationBlock
|
|
151
154
|
};
|