@useinsider/guido 2.1.0-beta.038f431 → 2.1.0-beta.04bd1f4
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 +36 -0
- package/dist/@types/config/schemas.js +70 -65
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +69 -58
- package/dist/components/organisms/header/EditorActions.vue.js +10 -8
- package/dist/components/organisms/header/EditorActions.vue2.js +40 -31
- package/dist/components/organisms/header/HeaderWrapper.vue.js +9 -9
- package/dist/components/organisms/header/MigrationConfirmModal.vue.js +17 -0
- package/dist/components/organisms/header/MigrationConfirmModal.vue2.js +41 -0
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +1 -1
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +19 -19
- package/dist/composables/useActionsApi.js +15 -13
- package/dist/composables/useBlocksConfig.js +26 -16
- package/dist/composables/useHtmlValidator.js +114 -104
- package/dist/composables/useRecommendation.js +54 -21
- package/dist/composables/useStripo.js +25 -23
- package/dist/composables/useVersionHistoryApi.js +1 -1
- package/dist/config/compiler/recommendationCompilerRules.js +45 -39
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +121 -0
- package/dist/config/i18n/en/index.js +11 -0
- package/dist/config/i18n/en/labels.json.js +12 -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 +141 -117
- package/dist/config/migrator/recommendationMigrator.js +42 -40
- package/dist/enums/defaults.js +8 -4
- package/dist/enums/extensions/recommendationBlock.js +1 -1
- package/dist/enums/recommendation.js +16 -15
- package/dist/extensions/Blocks/Items/block.js +46 -35
- package/dist/extensions/Blocks/Items/controls/button/link.js +19 -31
- package/dist/extensions/Blocks/Items/controls/cardComposition.js +124 -85
- package/dist/extensions/Blocks/Items/controls/image/link.js +19 -31
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +28 -40
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +35 -47
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +49 -54
- package/dist/extensions/Blocks/Items/controls/price/formattedPrice.js +42 -51
- package/dist/extensions/Blocks/Items/controls/price/hideDiscount.js +23 -36
- package/dist/extensions/Blocks/Items/controls/price/priceOrientation.js +45 -57
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +42 -60
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +189 -196
- package/dist/extensions/Blocks/Items/enums/settingsEnums.js +0 -2
- package/dist/extensions/Blocks/Items/extension.js +8 -9
- package/dist/extensions/Blocks/Items/iconsRegistry.js +6 -5
- package/dist/extensions/Blocks/Items/items.css.js +48 -0
- package/dist/extensions/Blocks/Items/settingsPanel.js +10 -15
- package/dist/extensions/Blocks/Items/template.js +181 -175
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +65 -65
- package/dist/extensions/Blocks/Recommendation/block.js +50 -27
- 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/iconsRegistry.js +4 -3
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +48 -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/Recommendation/utils/preserveTextStyles.js +10 -10
- 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/Blocks/common-control.js +101 -94
- package/dist/extensions/Blocks/common-icons.js +39 -0
- 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 +20 -17
- package/dist/services/templateLibraryApi.js +16 -13
- package/dist/src/@types/config/schemas.d.ts +8 -0
- package/dist/src/components/Guido.vue.d.ts +1 -1
- 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/MigrationConfirmModal.vue.d.ts +6 -0
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/src/components/wrappers/WpModal.vue.d.ts +2 -2
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useRecommendation.d.ts +1 -0
- package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +17 -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/extensions/Blocks/Items/block.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/controls/button/link.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/cardComposition.d.ts +5 -5
- package/dist/src/extensions/Blocks/Items/controls/image/link.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/name/trimming.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/currencyLocation.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/currencySymbol.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/formattedPrice.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/hideDiscount.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/priceOrientation.d.ts +0 -1
- package/dist/src/extensions/Blocks/Items/controls/price/singlePrice.d.ts +0 -5
- package/dist/src/extensions/Blocks/Items/controls/settingsControl.d.ts +10 -12
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +2 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +1 -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/Blocks/common-control.d.ts +9 -5
- package/dist/src/extensions/Blocks/common-icons.d.ts +1 -0
- package/dist/src/extensions/ModulesTabIcons/extension.d.ts +2 -0
- package/dist/src/stores/config.d.ts +36 -0
- package/dist/src/stores/template.d.ts +3 -0
- 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/template.js +9 -0
- package/dist/stores/unsubscribe.js +37 -34
- package/dist/utils/pairProductVariables.js +57 -56
- package/dist/utils/templatePreparation.js +15 -14
- package/package.json +1 -1
- package/dist/extensions/Blocks/Items/store/items-block.js +0 -79
- package/dist/src/extensions/Blocks/Items/store/items-block.d.ts +0 -45
|
@@ -1,46 +1,46 @@
|
|
|
1
1
|
import { ModificationDescription as b } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
-
import { DefaultConfigValues as
|
|
3
|
-
function
|
|
2
|
+
import { DefaultConfigValues as o, SETTINGS_ENUMS as n, ItemInCartOptions as g } from "../enums/settingsEnums.js";
|
|
3
|
+
function _() {
|
|
4
4
|
return String(Date.now() + Math.floor(Math.random() * 1e3));
|
|
5
5
|
}
|
|
6
|
-
const E = (
|
|
6
|
+
const E = (r) => r.replace(/\$/g, "$$$$");
|
|
7
7
|
function S() {
|
|
8
8
|
return {
|
|
9
9
|
initialized: !0,
|
|
10
|
-
blockInstanceId:
|
|
10
|
+
blockInstanceId: _(),
|
|
11
11
|
source: n.ITEMS_TYPE.CART_ITEMS,
|
|
12
12
|
type: n.ITEMS_TYPE.CART_ITEMS,
|
|
13
|
-
itemsSelectValue:
|
|
13
|
+
itemsSelectValue: o.cartItemsSelectControlValue,
|
|
14
14
|
orientation: n.ORIENTATION.VERTICAL,
|
|
15
|
-
nameTrimming:
|
|
16
|
-
priceHideDiscount:
|
|
17
|
-
priceFormatted:
|
|
15
|
+
nameTrimming: o.productNameTrimmingControlValue === "1",
|
|
16
|
+
priceHideDiscount: o.productPriceHideDiscountControlValue === "1",
|
|
17
|
+
priceFormatted: o.productPriceFormattedControlValue === "1",
|
|
18
18
|
priceSinglePrice: !1,
|
|
19
|
-
priceCurrencySymbol:
|
|
20
|
-
priceCurrencyLocation:
|
|
19
|
+
priceCurrencySymbol: o.productPriceCurrencySymbolControlValue,
|
|
20
|
+
priceCurrencyLocation: o.productPriceCurrencyLocationControlValue,
|
|
21
21
|
priceOrientation: "horizontal",
|
|
22
|
-
quantityControlEnabled:
|
|
23
|
-
buttonLink:
|
|
24
|
-
imageLink:
|
|
22
|
+
quantityControlEnabled: o.productQuantityControlEnabled === "1",
|
|
23
|
+
buttonLink: o.productButtonLinkControlValue,
|
|
24
|
+
imageLink: o.productImageLinkControlValue,
|
|
25
25
|
buttonLabel: "Buy",
|
|
26
26
|
buttonFullWidth: !0,
|
|
27
27
|
// Default to full width (es-fw class)
|
|
28
|
-
imageVisible:
|
|
29
|
-
nameVisible:
|
|
30
|
-
quantityVisible:
|
|
31
|
-
priceVisible:
|
|
32
|
-
originalPriceVisible:
|
|
33
|
-
buttonVisible:
|
|
28
|
+
imageVisible: o.productImageVisible === "1",
|
|
29
|
+
nameVisible: o.productNameVisible === "1",
|
|
30
|
+
quantityVisible: o.productQuantityVisible === "1",
|
|
31
|
+
priceVisible: o.productPriceVisible === "1",
|
|
32
|
+
originalPriceVisible: o.productOriginalPriceVisible === "1",
|
|
33
|
+
buttonVisible: o.productButtonVisible === "1"
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
if (!
|
|
36
|
+
function p(r) {
|
|
37
|
+
if (!r)
|
|
38
38
|
return null;
|
|
39
|
-
const t =
|
|
40
|
-
return t ||
|
|
39
|
+
const t = r.closest(".items-block-v2");
|
|
40
|
+
return t || r.closest(".esd-cart-items-block");
|
|
41
41
|
}
|
|
42
|
-
function m(
|
|
43
|
-
return
|
|
42
|
+
function m(r) {
|
|
43
|
+
return r ? {
|
|
44
44
|
CartItems: n.ITEMS_TYPE.CART_ITEMS,
|
|
45
45
|
BrowsedItems: n.ITEMS_TYPE.BROWSED_ITEMS,
|
|
46
46
|
PurchasedItems: n.ITEMS_TYPE.PURCHASED_ITEMS,
|
|
@@ -48,34 +48,34 @@ function m(o) {
|
|
|
48
48
|
CART_ITEMS: n.ITEMS_TYPE.CART_ITEMS,
|
|
49
49
|
BROWSED_ITEMS: n.ITEMS_TYPE.BROWSED_ITEMS,
|
|
50
50
|
PURCHASED_ITEMS: n.ITEMS_TYPE.PURCHASED_ITEMS
|
|
51
|
-
}[
|
|
51
|
+
}[r] || n.ITEMS_TYPE.CART_ITEMS : n.ITEMS_TYPE.CART_ITEMS;
|
|
52
52
|
}
|
|
53
|
-
function I(
|
|
54
|
-
if (!
|
|
55
|
-
return
|
|
56
|
-
if (
|
|
57
|
-
return
|
|
58
|
-
if (/^\d+$/.test(
|
|
59
|
-
const e = parseInt(
|
|
60
|
-
if (
|
|
61
|
-
return
|
|
53
|
+
function I(r, t) {
|
|
54
|
+
if (!r)
|
|
55
|
+
return o.cartItemsSelectControlValue;
|
|
56
|
+
if (r.includes("{{"))
|
|
57
|
+
return r;
|
|
58
|
+
if (/^\d+$/.test(r)) {
|
|
59
|
+
const e = parseInt(r) - 1, i = g[t];
|
|
60
|
+
if (i && i[e])
|
|
61
|
+
return i[e].value;
|
|
62
62
|
}
|
|
63
|
-
return
|
|
63
|
+
return o.cartItemsSelectControlValue;
|
|
64
64
|
}
|
|
65
|
-
function C(
|
|
66
|
-
const t =
|
|
65
|
+
function C(r) {
|
|
66
|
+
const t = r.querySelector("esd-config-block");
|
|
67
67
|
if (!t)
|
|
68
68
|
return null;
|
|
69
|
-
const e = (c,
|
|
69
|
+
const e = (c, s) => c == null ? s : c === "1" || c === "true", i = (c, s) => c || s, u = t.getAttribute("data-type"), a = m(u), d = t.getAttribute("data-cart_items_select_control_value"), l = I(d, a);
|
|
70
70
|
return {
|
|
71
71
|
initialized: e(t.getAttribute("data-initialized"), !1),
|
|
72
|
-
blockInstanceId:
|
|
72
|
+
blockInstanceId: i(
|
|
73
73
|
t.getAttribute("data-block-instance-id"),
|
|
74
|
-
|
|
74
|
+
_()
|
|
75
75
|
),
|
|
76
|
-
source:
|
|
77
|
-
type:
|
|
78
|
-
itemsSelectValue:
|
|
76
|
+
source: a,
|
|
77
|
+
type: a,
|
|
78
|
+
itemsSelectValue: l,
|
|
79
79
|
orientation: t.getAttribute("data-card_orientation_control_value") || n.ORIENTATION.VERTICAL,
|
|
80
80
|
nameTrimming: e(
|
|
81
81
|
t.getAttribute("data-product_name_control_trim"),
|
|
@@ -93,28 +93,28 @@ function C(o) {
|
|
|
93
93
|
t.getAttribute("data-product_price_control_single_price"),
|
|
94
94
|
!1
|
|
95
95
|
),
|
|
96
|
-
priceCurrencySymbol:
|
|
97
|
-
t.getAttribute("data-
|
|
98
|
-
|
|
96
|
+
priceCurrencySymbol: i(
|
|
97
|
+
t.getAttribute("data-product_price_control_currency_symbol"),
|
|
98
|
+
o.productPriceCurrencySymbolControlValue
|
|
99
99
|
),
|
|
100
|
-
priceCurrencyLocation:
|
|
100
|
+
priceCurrencyLocation: i(
|
|
101
101
|
t.getAttribute("data-product_price_currency_location"),
|
|
102
|
-
|
|
102
|
+
o.productPriceCurrencyLocationControlValue
|
|
103
103
|
),
|
|
104
104
|
priceOrientation: t.getAttribute("data-product_original_price_control_orientation") || "horizontal",
|
|
105
105
|
quantityControlEnabled: e(
|
|
106
106
|
t.getAttribute("data-product_quantity_control_enabled"),
|
|
107
107
|
!0
|
|
108
108
|
),
|
|
109
|
-
buttonLink:
|
|
109
|
+
buttonLink: i(
|
|
110
110
|
t.getAttribute("data-product_button_link"),
|
|
111
|
-
|
|
111
|
+
o.productButtonLinkControlValue
|
|
112
112
|
),
|
|
113
|
-
imageLink:
|
|
113
|
+
imageLink: i(
|
|
114
114
|
t.getAttribute("data-product_image_link"),
|
|
115
|
-
|
|
115
|
+
o.productImageLinkControlValue
|
|
116
116
|
),
|
|
117
|
-
buttonLabel:
|
|
117
|
+
buttonLabel: i(
|
|
118
118
|
t.getAttribute("data-product_button_control_label"),
|
|
119
119
|
"Buy"
|
|
120
120
|
),
|
|
@@ -149,28 +149,28 @@ function C(o) {
|
|
|
149
149
|
)
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
|
-
function y(
|
|
153
|
-
const t =
|
|
152
|
+
function y(r) {
|
|
153
|
+
const t = p(r);
|
|
154
154
|
if (!t)
|
|
155
155
|
return null;
|
|
156
156
|
const e = t.getNodeConfig();
|
|
157
157
|
if (e && e.initialized)
|
|
158
158
|
return e;
|
|
159
|
-
const
|
|
160
|
-
return
|
|
159
|
+
const i = C(t);
|
|
160
|
+
return i || null;
|
|
161
161
|
}
|
|
162
|
-
function A(
|
|
163
|
-
const
|
|
164
|
-
if (!
|
|
162
|
+
function A(r, t, e, i) {
|
|
163
|
+
const u = p(r);
|
|
164
|
+
if (!u)
|
|
165
165
|
return;
|
|
166
|
-
const
|
|
167
|
-
|
|
166
|
+
const d = { ...u.getNodeConfig() || {}, ...e }, l = i ?? t.getDocumentModifier();
|
|
167
|
+
l.modifyHtml(u).setNodeConfig(d), i || l.apply(new b("Update Items block configuration"));
|
|
168
168
|
}
|
|
169
169
|
export {
|
|
170
170
|
E as escapeReplacement,
|
|
171
|
-
|
|
171
|
+
_ as generateBlockInstanceId,
|
|
172
172
|
S as getDefaultItemsBlockConfig,
|
|
173
173
|
y as getItemsBlockConfig,
|
|
174
|
-
|
|
174
|
+
p as getItemsBlockContainer,
|
|
175
175
|
A as setItemsBlockConfig
|
|
176
176
|
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var g = (r,
|
|
4
|
-
import {
|
|
1
|
+
var h = Object.defineProperty;
|
|
2
|
+
var I = (r, o, t) => o in r ? h(r, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[o] = t;
|
|
3
|
+
var g = (r, o, t) => I(r, typeof o != "symbol" ? o + "" : o, t);
|
|
4
|
+
import { useTemplateStore as k } from "../../../stores/template.js";
|
|
5
|
+
import { Block as _, BlockCompositionType as B, UIElementType as d, UEAttr as C, ModificationDescription as A } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
6
|
+
import { ensureMobileCssRulesExist as u } from "./controls/mobileLayout/cssRules.js";
|
|
5
7
|
import { RecommendationConfigService as s } from "./services/configService.js";
|
|
6
|
-
import { useRecommendationExtensionStore as
|
|
7
|
-
import { getDefaultTemplate as
|
|
8
|
-
const
|
|
9
|
-
class
|
|
8
|
+
import { useRecommendationExtensionStore as p } from "./store/recommendation.js";
|
|
9
|
+
import { getDefaultTemplate as R } from "./templates/grid/template.js";
|
|
10
|
+
const f = "recommendation-block", c = "ins-recommendation-v3-block-v2", a = "recommendation-id";
|
|
11
|
+
class E extends _ {
|
|
10
12
|
constructor() {
|
|
11
13
|
super();
|
|
12
14
|
/**
|
|
@@ -16,13 +18,13 @@ class b extends f {
|
|
|
16
18
|
g(this, "_pendingBlockId", null);
|
|
17
19
|
}
|
|
18
20
|
getId() {
|
|
19
|
-
return
|
|
21
|
+
return f;
|
|
20
22
|
}
|
|
21
23
|
getIcon() {
|
|
22
24
|
return "recommendation-icon";
|
|
23
25
|
}
|
|
24
26
|
getBlockCompositionType() {
|
|
25
|
-
return
|
|
27
|
+
return B.CONTAINER;
|
|
26
28
|
}
|
|
27
29
|
getName() {
|
|
28
30
|
return this.api.translate("Recommendation Block");
|
|
@@ -30,6 +32,25 @@ class b extends f {
|
|
|
30
32
|
getDescription() {
|
|
31
33
|
return this.api.translate("Recommendation Block Title Description");
|
|
32
34
|
}
|
|
35
|
+
getSettingsPanelTitleHtml() {
|
|
36
|
+
if (k().migrations[f] === 0)
|
|
37
|
+
return "";
|
|
38
|
+
const e = this.api.translate("Recommendation Block"), i = 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.");
|
|
39
|
+
return `<div>
|
|
40
|
+
<div style="display: flex; align-items: center;">
|
|
41
|
+
<span>${e}</span>
|
|
42
|
+
</div>
|
|
43
|
+
<div class="recommendation-migration-info">
|
|
44
|
+
<${d.ICON}
|
|
45
|
+
${C.ICON.src}="migration-info-icon"
|
|
46
|
+
class="recommendation-migration-info__icon">
|
|
47
|
+
</${d.ICON}>
|
|
48
|
+
<p class="recommendation-migration-info__text">
|
|
49
|
+
${i}
|
|
50
|
+
</p>
|
|
51
|
+
</div>
|
|
52
|
+
</div>`;
|
|
53
|
+
}
|
|
33
54
|
/**
|
|
34
55
|
* Returns the template HTML for a new recommendation block.
|
|
35
56
|
* Generates a unique recommendation ID and embeds the instance class
|
|
@@ -39,7 +60,7 @@ class b extends f {
|
|
|
39
60
|
*/
|
|
40
61
|
getTemplate() {
|
|
41
62
|
const t = this._generateNextId();
|
|
42
|
-
return this._pendingBlockId = t,
|
|
63
|
+
return this._pendingBlockId = t, R(t);
|
|
43
64
|
}
|
|
44
65
|
/**
|
|
45
66
|
* Called when a new block is dropped into the template
|
|
@@ -50,7 +71,9 @@ class b extends f {
|
|
|
50
71
|
*/
|
|
51
72
|
onCreated(t) {
|
|
52
73
|
const e = this._pendingBlockId ?? this._generateNextId();
|
|
53
|
-
this._pendingBlockId = null, this._assignRecommendationId(t, e)
|
|
74
|
+
this._pendingBlockId = null, this._assignRecommendationId(t, e);
|
|
75
|
+
const i = s.initializeConfig(this.api, t, { recommendationId: e }), n = p();
|
|
76
|
+
n.setCurrentBlock(e), u(this.api), n.patchCurrentBlockConfig({ language: i.language }, { triggerRefetch: !1 });
|
|
54
77
|
}
|
|
55
78
|
/**
|
|
56
79
|
* Called when the document changes or template is loaded
|
|
@@ -70,7 +93,7 @@ class b extends f {
|
|
|
70
93
|
"Assign recommendation ID to legacy block"
|
|
71
94
|
);
|
|
72
95
|
}
|
|
73
|
-
s.needsMigration(t) && this._migrateFromLegacy(t);
|
|
96
|
+
s.needsMigration(t) && this._migrateFromLegacy(t), u(this.api);
|
|
74
97
|
}
|
|
75
98
|
}
|
|
76
99
|
/**
|
|
@@ -81,7 +104,7 @@ class b extends f {
|
|
|
81
104
|
*/
|
|
82
105
|
onDelete(t) {
|
|
83
106
|
const e = this._getRecommendationId(t);
|
|
84
|
-
e &&
|
|
107
|
+
e && p().removeBlockState(e);
|
|
85
108
|
}
|
|
86
109
|
/**
|
|
87
110
|
* Generates the next unique recommendation ID by scanning all existing blocks
|
|
@@ -91,9 +114,9 @@ class b extends f {
|
|
|
91
114
|
let t = 0;
|
|
92
115
|
try {
|
|
93
116
|
const e = this.api.getDocumentRoot();
|
|
94
|
-
e && "querySelectorAll" in e && e.querySelectorAll(`.${c}`).forEach((
|
|
95
|
-
if ("getAttribute" in
|
|
96
|
-
const
|
|
117
|
+
e && "querySelectorAll" in e && e.querySelectorAll(`.${c}`).forEach((n) => {
|
|
118
|
+
if ("getAttribute" in n) {
|
|
119
|
+
const m = n.getAttribute(a), l = m ? parseInt(m) : 0;
|
|
97
120
|
l > t && (t = l);
|
|
98
121
|
}
|
|
99
122
|
});
|
|
@@ -108,11 +131,11 @@ class b extends f {
|
|
|
108
131
|
* added classes via setAttribute.
|
|
109
132
|
*/
|
|
110
133
|
_assignRecommendationId(t, e) {
|
|
111
|
-
const
|
|
112
|
-
if (!
|
|
134
|
+
const i = this._getBlockElement(t);
|
|
135
|
+
if (!i)
|
|
113
136
|
return;
|
|
114
|
-
const
|
|
115
|
-
|
|
137
|
+
const n = this.api.getDocumentModifier();
|
|
138
|
+
n.modifyHtml(i).setAttribute(a, e.toString()), n.apply(new A(`Assign recommendation ID ${e}`));
|
|
116
139
|
}
|
|
117
140
|
/**
|
|
118
141
|
* Gets the recommendation-id from a block node
|
|
@@ -121,11 +144,11 @@ class b extends f {
|
|
|
121
144
|
const e = this._getBlockElement(t);
|
|
122
145
|
if (!e || !("getAttribute" in e))
|
|
123
146
|
return null;
|
|
124
|
-
const
|
|
125
|
-
if (!
|
|
147
|
+
const i = e.getAttribute(a);
|
|
148
|
+
if (!i)
|
|
126
149
|
return null;
|
|
127
|
-
const
|
|
128
|
-
return Number.isNaN(
|
|
150
|
+
const n = parseInt(i);
|
|
151
|
+
return Number.isNaN(n) ? null : n;
|
|
129
152
|
}
|
|
130
153
|
/**
|
|
131
154
|
* Gets the block element (the element with BLOCK_CLASS)
|
|
@@ -146,6 +169,6 @@ class b extends f {
|
|
|
146
169
|
}
|
|
147
170
|
}
|
|
148
171
|
export {
|
|
149
|
-
|
|
150
|
-
|
|
172
|
+
f as BLOCK_ID,
|
|
173
|
+
E as RecommendationBlock
|
|
151
174
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DEFAULT_ROW_SPACING as
|
|
2
|
-
import { ATTR_PRODUCT_IMAGE as t, ATTR_PRODUCT_NAME as e, ATTR_PRODUCT_OLD_PRICE as o, ATTR_PRODUCT_PRICE as
|
|
3
|
-
const
|
|
1
|
+
import { DEFAULT_ROW_SPACING as U, DEFAULT_COLUMN_SPACING as I, DEFAULT_MOBILE_CARDS_IN_ROW as n, DEFAULT_CARDS_IN_ROW as s } from "./layout.js";
|
|
2
|
+
import { ATTR_PRODUCT_IMAGE as t, ATTR_PRODUCT_NAME as e, ATTR_PRODUCT_OLD_PRICE as o, ATTR_PRODUCT_PRICE as _, ATTR_PRODUCT_OMNIBUS_PRICE as T, ATTR_PRODUCT_OMNIBUS_DISCOUNT as r, ATTR_PRODUCT_BUTTON as R } from "./selectors.js";
|
|
3
|
+
const O = {
|
|
4
4
|
code: "USD",
|
|
5
5
|
symbol: "USD",
|
|
6
6
|
alignment: "after",
|
|
@@ -10,56 +10,57 @@ const I = {
|
|
|
10
10
|
}, i = {
|
|
11
11
|
textBefore: "",
|
|
12
12
|
textAfter: ""
|
|
13
|
-
},
|
|
13
|
+
}, C = {
|
|
14
14
|
textBefore: "",
|
|
15
15
|
textAfter: ""
|
|
16
|
-
},
|
|
16
|
+
}, D = [
|
|
17
17
|
t,
|
|
18
18
|
e,
|
|
19
19
|
o,
|
|
20
|
-
T,
|
|
21
20
|
_,
|
|
21
|
+
T,
|
|
22
22
|
r,
|
|
23
|
-
|
|
24
|
-
],
|
|
23
|
+
R
|
|
24
|
+
], A = {
|
|
25
25
|
[t]: !0,
|
|
26
26
|
[e]: !0,
|
|
27
|
-
[
|
|
27
|
+
[_]: !0,
|
|
28
28
|
[o]: !0,
|
|
29
|
-
[
|
|
29
|
+
[T]: !1,
|
|
30
30
|
[r]: !1,
|
|
31
|
-
[
|
|
32
|
-
},
|
|
31
|
+
[R]: !0
|
|
32
|
+
}, E = {
|
|
33
33
|
// Settings
|
|
34
34
|
strategy: "mostPopular",
|
|
35
35
|
productIds: [],
|
|
36
36
|
size: "6",
|
|
37
37
|
shuffleProducts: !1,
|
|
38
38
|
language: "en_US",
|
|
39
|
-
currency:
|
|
39
|
+
currency: O,
|
|
40
40
|
filters: [],
|
|
41
41
|
// Layout
|
|
42
42
|
layout: "grid",
|
|
43
|
-
cardsInRow:
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
cardsInRow: s,
|
|
44
|
+
mobileCardsInRow: n,
|
|
45
|
+
columnSpacing: I,
|
|
46
|
+
rowSpacing: U,
|
|
46
47
|
// Composition
|
|
47
|
-
composition:
|
|
48
|
-
visibility:
|
|
48
|
+
composition: D,
|
|
49
|
+
visibility: A,
|
|
49
50
|
// Element settings
|
|
50
51
|
omnibusPrice: i,
|
|
51
|
-
omnibusDiscount:
|
|
52
|
+
omnibusDiscount: C,
|
|
52
53
|
textTrimming: !1,
|
|
53
54
|
// Meta
|
|
54
55
|
configVersion: 1,
|
|
55
56
|
recommendationId: 0
|
|
56
|
-
},
|
|
57
|
+
}, N = 1;
|
|
57
58
|
export {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
N as CURRENT_CONFIG_VERSION,
|
|
60
|
+
D as DEFAULT_COMPOSITION,
|
|
61
|
+
O as DEFAULT_CURRENCY,
|
|
62
|
+
E as DEFAULT_NODE_CONFIG,
|
|
63
|
+
C as DEFAULT_OMNIBUS_DISCOUNT,
|
|
63
64
|
i as DEFAULT_OMNIBUS_PRICE,
|
|
64
|
-
|
|
65
|
+
A as DEFAULT_VISIBILITY
|
|
65
66
|
};
|
|
@@ -4,17 +4,19 @@ const _ = {
|
|
|
4
4
|
}, o = [
|
|
5
5
|
{ icon: "grid-orientation", value: _.GRID },
|
|
6
6
|
{ icon: "list-orientation", value: _.LIST }
|
|
7
|
-
], t = 3, n = 3, A = 9,
|
|
7
|
+
], t = 3, n = 3, A = 9, O = 4, R = 1, T = 2, c = 10, s = 20, I = 0, S = 50, P = 5;
|
|
8
8
|
export {
|
|
9
9
|
n as DEFAULT_CARDS_IN_ROW,
|
|
10
10
|
c as DEFAULT_COLUMN_SPACING,
|
|
11
|
+
R as DEFAULT_MOBILE_CARDS_IN_ROW,
|
|
11
12
|
t as DEFAULT_PRODUCTS_PER_ROW,
|
|
12
13
|
s as DEFAULT_ROW_SPACING,
|
|
13
14
|
o as LAYOUT_OPTIONS,
|
|
14
15
|
_ as LAYOUT_VALUES,
|
|
15
|
-
T as
|
|
16
|
+
T as MAX_MOBILE_PRODUCTS_PER_ROW,
|
|
17
|
+
O as MAX_PRODUCTS_PER_ROW,
|
|
16
18
|
A as MAX_PRODUCT_COUNT,
|
|
17
19
|
S as MAX_SPACING,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
I as MIN_SPACING,
|
|
21
|
+
P as SPACING_STEP
|
|
20
22
|
};
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
const c = ".ins-recommendation-product-container", T = {
|
|
1
|
+
const c = ".ins-recommendation-product-container", n = ".ins-recommendation-desktop-container", o = ".ins-recommendation-mobile-container", T = {
|
|
2
2
|
CURRENCY: "currency",
|
|
3
3
|
SYMBOL: "currency-symbol",
|
|
4
4
|
ALIGNMENT: "currency-alignment",
|
|
5
5
|
THOUSAND_SEPARATOR: "currency-thousand-separator",
|
|
6
6
|
DECIMAL_SEPARATOR: "currency-decimal-separator",
|
|
7
7
|
DECIMAL_COUNT: "currency-decimal-count"
|
|
8
|
-
},
|
|
8
|
+
}, t = "productImage", r = "productName", R = "productPrice", e = "productOldPrice", O = "productOmnibusPrice", _ = "productOmnibusDiscount", C = "productButton";
|
|
9
9
|
export {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
C as ATTR_PRODUCT_BUTTON,
|
|
11
|
+
t as ATTR_PRODUCT_IMAGE,
|
|
12
|
+
r as ATTR_PRODUCT_NAME,
|
|
13
|
+
e as ATTR_PRODUCT_OLD_PRICE,
|
|
14
|
+
_ as ATTR_PRODUCT_OMNIBUS_DISCOUNT,
|
|
15
|
+
O as ATTR_PRODUCT_OMNIBUS_PRICE,
|
|
16
|
+
R as ATTR_PRODUCT_PRICE,
|
|
17
17
|
c as CONTAINER_SELECTOR,
|
|
18
|
-
T as CURRENCY_ATTR
|
|
18
|
+
T as CURRENCY_ATTR,
|
|
19
|
+
n as DESKTOP_CONTAINER_SELECTOR,
|
|
20
|
+
o as MOBILE_CONTAINER_SELECTOR
|
|
19
21
|
};
|