@useinsider/guido 1.0.3-beta.4fc0167 → 1.0.3-beta.512f0b0
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/config/migrator/index.js +6 -7
- package/dist/extensions/Blocks/Recommendation/block.js +3 -6
- package/dist/extensions/Blocks/Recommendation/control.js +40 -69
- package/dist/extensions/Blocks/Recommendation/extension.js +7 -42
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +22 -107
- package/dist/extensions/Blocks/Recommendation/template.js +200 -0
- package/dist/extensions/Blocks/common-control.js +43 -125
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +100 -307
- package/dist/package.json.js +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/control.d.ts +0 -6
- package/dist/src/extensions/Blocks/Recommendation/template.d.ts +6 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +0 -21
- package/dist/static/styles/customEditorStyle.css.js +0 -5
- package/package.json +3 -3
- package/dist/config/migrator/recommendationMigrator.js +0 -293
- package/dist/extensions/Blocks/Recommendation/cardCompositionControl.js +0 -103
- package/dist/extensions/Blocks/Recommendation/constants.js +0 -5
- package/dist/extensions/Blocks/Recommendation/controls/button/align.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/border.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/borderRadius.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/color.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/fitToContent.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/fontFamily.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/margins.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/paddings.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/text.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/textSize.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/button/textStyleAndFontColor.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/image/margins.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/image/size.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/name/align.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/name/background.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/name/color.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/name/fontFamily.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/name/paddings.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/name/size.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/name/style.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/align.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/background.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/color.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/fontFamily.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/paddings.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/size.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/oldPrice/style.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/price/align.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/price/background.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/price/color.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/price/fontFamily.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/price/paddings.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/price/size.js +0 -13
- package/dist/extensions/Blocks/Recommendation/controls/price/style.js +0 -13
- package/dist/extensions/Blocks/Recommendation/templates/blockTemplate.js +0 -160
- package/dist/extensions/Blocks/Recommendation/templates/migrationTemplate.js +0 -152
- package/dist/extensions/Blocks/Recommendation/templates/templateUtils.js +0 -180
- package/dist/src/config/migrator/recommendationMigrator.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/cardCompositionControl.d.ts +0 -28
- package/dist/src/extensions/Blocks/Recommendation/constants.d.ts +0 -51
- package/dist/src/extensions/Blocks/Recommendation/controls/button/align.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/border.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/borderRadius.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/color.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/fitToContent.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/fontFamily.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/margins.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/paddings.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/text.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/textSize.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/button/textStyleAndFontColor.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/image/margins.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/image/size.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/align.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/background.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/color.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/fontFamily.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/paddings.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/size.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/name/style.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/align.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/background.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/color.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/fontFamily.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/paddings.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/size.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/style.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/price/align.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/price/background.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/price/color.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/price/fontFamily.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/price/paddings.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/price/size.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/price/style.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/templates/blockTemplate.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/templates/migrationTemplate.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/templates/templateUtils.d.ts +0 -44
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { migrateCheckbox as
|
|
2
|
-
import { migrateCouponBlock as
|
|
1
|
+
import { migrateCheckbox as o } from "./checkboxMigrator.js";
|
|
2
|
+
import { migrateCouponBlock as m } from "./couponBlockMigrator.js";
|
|
3
3
|
import { migrateRadioButton as i } from "./radioButtonMigrator.js";
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const s = async (t) => {
|
|
4
|
+
import { migrateUnsubscribe as e } from "./unsubscribeMigrator.js";
|
|
5
|
+
const c = async (t) => {
|
|
7
6
|
let r = t;
|
|
8
|
-
return r =
|
|
7
|
+
return r = o(r), r = i(r), r = await e(r), r = m(r), r;
|
|
9
8
|
};
|
|
10
9
|
export {
|
|
11
|
-
|
|
10
|
+
c as migrate
|
|
12
11
|
};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { Block as e, BlockCompositionType as t } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
-
import { getDefaultTemplate as o } from "./
|
|
2
|
+
import { getDefaultTemplate as o } from "./template.js";
|
|
3
3
|
const n = "recommendation-block";
|
|
4
|
-
class
|
|
5
|
-
constructor() {
|
|
6
|
-
super();
|
|
7
|
-
}
|
|
4
|
+
class c extends e {
|
|
8
5
|
getId() {
|
|
9
6
|
return n;
|
|
10
7
|
}
|
|
@@ -26,5 +23,5 @@ class m extends e {
|
|
|
26
23
|
}
|
|
27
24
|
export {
|
|
28
25
|
n as BLOCK_ID,
|
|
29
|
-
|
|
26
|
+
c as RecommendationBlock
|
|
30
27
|
};
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
var _ = Object.defineProperty;
|
|
2
|
-
var R = (
|
|
3
|
-
var r = (
|
|
4
|
-
import { currencyDecimalCounts as
|
|
5
|
-
import { UEAttr as
|
|
6
|
-
import { CommonControl as
|
|
7
|
-
import { useRecommendationExtensionStore as
|
|
8
|
-
|
|
9
|
-
import { DEFAULT_CARD_COMPOSITION as C, getDefaultProducts as E } from "./templates/templateUtils.js";
|
|
10
|
-
import { useDebounceFn as U } from "../../../node_modules/@vueuse/shared/index.js";
|
|
11
|
-
const L = "ui-elements-recommendation-block", t = {
|
|
2
|
+
var R = (o, n, e) => n in o ? _(o, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[n] = e;
|
|
3
|
+
var r = (o, n, e) => R(o, typeof n != "symbol" ? n + "" : n, e);
|
|
4
|
+
import { currencyDecimalCounts as c, currencyOperators as a, currencyLocationMaps as l } from "../../../enums/extensions/recommendationBlock.js";
|
|
5
|
+
import { UEAttr as d } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
6
|
+
import { CommonControl as m } from "../common-control.js";
|
|
7
|
+
import { useRecommendationExtensionStore as S } from "./store/recommendation.js";
|
|
8
|
+
const g = "ui-elements-recommendation-block", t = {
|
|
12
9
|
ALGORITHM: "strategy",
|
|
13
10
|
PRODUCT_IDS: "productIds",
|
|
14
11
|
LOCALE: "language",
|
|
@@ -24,21 +21,18 @@ const L = "ui-elements-recommendation-block", t = {
|
|
|
24
21
|
SHUFFLE_PRODUCTS: "shuffleProducts",
|
|
25
22
|
RESPONSIVE: "unresponsive"
|
|
26
23
|
};
|
|
27
|
-
class
|
|
24
|
+
class p extends m {
|
|
28
25
|
constructor() {
|
|
29
26
|
super(...arguments);
|
|
30
|
-
r(this, "store",
|
|
27
|
+
r(this, "store", S());
|
|
31
28
|
r(this, "storeUnsubscription", () => {
|
|
32
29
|
});
|
|
33
30
|
r(this, "addFilterListener", () => {
|
|
34
31
|
});
|
|
35
32
|
r(this, "addFilterButton", null);
|
|
36
|
-
r(this, "_debouncedRegenerateProductRows", U(() => {
|
|
37
|
-
this._regenerateProductRows();
|
|
38
|
-
}, 500));
|
|
39
33
|
}
|
|
40
34
|
getId() {
|
|
41
|
-
return
|
|
35
|
+
return g;
|
|
42
36
|
}
|
|
43
37
|
getTemplate() {
|
|
44
38
|
return `
|
|
@@ -84,22 +78,22 @@ class b extends g {
|
|
|
84
78
|
});
|
|
85
79
|
}
|
|
86
80
|
_initializeSelectItems() {
|
|
87
|
-
const { store: e } = this,
|
|
88
|
-
[t.ALGORITHM]:
|
|
81
|
+
const { store: e } = this, s = e.getActivePredictiveAlgorithms, i = e.getLanguages, C = {
|
|
82
|
+
[t.ALGORITHM]: s,
|
|
89
83
|
[t.LOCALE]: i,
|
|
90
84
|
[t.CURRENCY]: e.currencyList,
|
|
91
|
-
[t.CURRENCY_LOCATION]:
|
|
85
|
+
[t.CURRENCY_LOCATION]: l,
|
|
92
86
|
[t.CURRENCY_SYMBOL]: e.getCurrencySymbolList,
|
|
93
|
-
[t.CURRENCY_THOUSAND_SEPARATOR]:
|
|
94
|
-
[t.CURRENCY_DECIMAL_SEPARATOR]:
|
|
95
|
-
[t.CURRENCY_DECIMAL_COUNT]:
|
|
87
|
+
[t.CURRENCY_THOUSAND_SEPARATOR]: a,
|
|
88
|
+
[t.CURRENCY_DECIMAL_SEPARATOR]: a,
|
|
89
|
+
[t.CURRENCY_DECIMAL_COUNT]: c,
|
|
96
90
|
[t.PRODUCT_COUNT]: Number(e.recommendationConfigs.size),
|
|
97
91
|
[t.PRODUCT_IN_ROW]: e.recommendationConfigs.cardsInRow,
|
|
98
92
|
[t.SHUFFLE_PRODUCTS]: e.recommendationConfigs.shuffleProducts,
|
|
99
93
|
[t.RESPONSIVE]: !e.recommendationConfigs.unresponsive
|
|
100
94
|
};
|
|
101
|
-
Object.entries(
|
|
102
|
-
this.api.setUIEAttribute(u,
|
|
95
|
+
Object.entries(C).forEach(([u, h]) => {
|
|
96
|
+
this.api.setUIEAttribute(u, d.SELECTPICKER.items, h);
|
|
103
97
|
});
|
|
104
98
|
}
|
|
105
99
|
_getAlgorithms() {
|
|
@@ -145,7 +139,7 @@ class b extends g {
|
|
|
145
139
|
this._GuSelect({
|
|
146
140
|
name: t.CURRENCY_LOCATION,
|
|
147
141
|
placeholder: "Select Currency Location",
|
|
148
|
-
options:
|
|
142
|
+
options: l
|
|
149
143
|
}),
|
|
150
144
|
this._GuLabel({ text: "Currency Symbol" }),
|
|
151
145
|
this._GuSelect({
|
|
@@ -157,19 +151,19 @@ class b extends g {
|
|
|
157
151
|
this._GuSelect({
|
|
158
152
|
name: t.CURRENCY_THOUSAND_SEPARATOR,
|
|
159
153
|
placeholder: "Select Thousand Separator",
|
|
160
|
-
options:
|
|
154
|
+
options: a
|
|
161
155
|
}),
|
|
162
156
|
this._GuLabel({ text: "Decimal Separator" }),
|
|
163
157
|
this._GuSelect({
|
|
164
158
|
name: t.CURRENCY_DECIMAL_SEPARATOR,
|
|
165
159
|
placeholder: "Select Decimal Separator",
|
|
166
|
-
options:
|
|
160
|
+
options: a
|
|
167
161
|
}),
|
|
168
162
|
this._GuLabel({ text: "Decimal Count" }),
|
|
169
163
|
this._GuSelect({
|
|
170
164
|
name: t.CURRENCY_DECIMAL_COUNT,
|
|
171
165
|
placeholder: "Select Decimal Count",
|
|
172
|
-
options:
|
|
166
|
+
options: c
|
|
173
167
|
})
|
|
174
168
|
])}
|
|
175
169
|
`;
|
|
@@ -223,62 +217,39 @@ class b extends g {
|
|
|
223
217
|
filterSelectionDrawerStatus: !0
|
|
224
218
|
});
|
|
225
219
|
}
|
|
226
|
-
_onDataChange(e,
|
|
227
|
-
this.currentNode &&
|
|
220
|
+
_onDataChange(e, s) {
|
|
221
|
+
this.currentNode && this.store.$patch({
|
|
228
222
|
recommendationConfigs: {
|
|
229
|
-
[e]:
|
|
223
|
+
[e]: s
|
|
230
224
|
}
|
|
231
|
-
})
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Get the current card composition from block data attribute or use default
|
|
235
|
-
*/
|
|
236
|
-
_getCardComposition() {
|
|
237
|
-
if (!this.currentNode)
|
|
238
|
-
return C;
|
|
239
|
-
const e = this.currentNode.querySelector(".ins-recommendation-v3-block-v2");
|
|
240
|
-
if (!e || !("getAttribute" in e))
|
|
241
|
-
return C;
|
|
242
|
-
const o = e.getAttribute("data-card-composition");
|
|
243
|
-
return o ? o.split(",").filter(Boolean) : C;
|
|
244
|
-
}
|
|
245
|
-
_regenerateProductRows() {
|
|
246
|
-
if (!this.currentNode || !("querySelector" in this.currentNode))
|
|
247
|
-
return;
|
|
248
|
-
const e = this.currentNode.querySelector(".ins-recommendation-product-container");
|
|
249
|
-
if (!e) {
|
|
250
|
-
console.error("Could not find container table for product rows");
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
253
|
-
const o = this.store.recommendationProducts.length > 0 ? this.store.recommendationProducts : E(), { cardsInRow: i } = this.store.recommendationConfigs, a = this._getCardComposition(), u = p(o, i, a);
|
|
254
|
-
this.api.getDocumentModifier().modifyHtml(e).setInnerHtml(u).apply(new S("Updated product"));
|
|
225
|
+
});
|
|
255
226
|
}
|
|
256
|
-
_onCurrencyConfigChange(e,
|
|
227
|
+
_onCurrencyConfigChange(e, s) {
|
|
257
228
|
this.currentNode && this.store.$patch({
|
|
258
229
|
recommendationConfigs: {
|
|
259
230
|
currencySettings: {
|
|
260
|
-
[e]:
|
|
231
|
+
[e]: s
|
|
261
232
|
}
|
|
262
233
|
}
|
|
263
234
|
});
|
|
264
235
|
}
|
|
265
236
|
_onCurrencyChange(e) {
|
|
266
|
-
const [,
|
|
237
|
+
const [, s] = e.split(".");
|
|
267
238
|
this.store.$patch({
|
|
268
239
|
recommendationConfigs: {
|
|
269
240
|
currencySettings: {
|
|
270
|
-
name:
|
|
271
|
-
value:
|
|
241
|
+
name: s,
|
|
242
|
+
value: s
|
|
272
243
|
}
|
|
273
244
|
}
|
|
274
245
|
});
|
|
275
246
|
}
|
|
276
247
|
_setProductIdsVisibility() {
|
|
277
|
-
const { recommendationConfigs: e } = this.store,
|
|
278
|
-
this.api.setVisibility(t.PRODUCT_IDS,
|
|
248
|
+
const { recommendationConfigs: e } = this.store, s = e.strategy === "manualMerchandising";
|
|
249
|
+
this.api.setVisibility(t.PRODUCT_IDS, s), this.api.setVisibility(`${t.PRODUCT_IDS}_label`, s);
|
|
279
250
|
}
|
|
280
251
|
_listenToFormUpdates() {
|
|
281
|
-
var
|
|
252
|
+
var s;
|
|
282
253
|
this.api.onValueChanged(t.ALGORITHM, (i) => {
|
|
283
254
|
this._onDataChange(t.ALGORITHM, i), this._setProductIdsVisibility();
|
|
284
255
|
}), this.api.onValueChanged(t.PRODUCT_IDS, (i) => this._onDataChange(t.PRODUCT_IDS, i.split(",") || [])), this.api.onValueChanged(t.LOCALE, (i) => this._onDataChange(t.LOCALE, i)), this.api.onValueChanged(t.CURRENCY, (i) => this._onCurrencyChange(i)), [
|
|
@@ -288,19 +259,19 @@ class b extends g {
|
|
|
288
259
|
t.CURRENCY_DECIMAL_SEPARATOR,
|
|
289
260
|
t.CURRENCY_DECIMAL_COUNT
|
|
290
261
|
].forEach((i) => {
|
|
291
|
-
this.api.onValueChanged(i, (
|
|
292
|
-
}), this.api.onValueChanged(t.PRODUCT_COUNT, (i) => this._onDataChange(t.PRODUCT_COUNT, i.toString())), this.api.onValueChanged(t.PRODUCT_IN_ROW, (i) => this._onDataChange(t.PRODUCT_IN_ROW, i)), this.api.onValueChanged(t.SHUFFLE_PRODUCTS, (i) => this._onDataChange(t.SHUFFLE_PRODUCTS, i)), this.api.onValueChanged(t.RESPONSIVE, (i) => this._onDataChange(t.RESPONSIVE, i)), this.addFilterListener = this._onFilterSelectClick.bind(this), this.addFilterButton = this.getContainer().querySelector("#guido__btn-add-filter"), (
|
|
262
|
+
this.api.onValueChanged(i, (C) => this._onCurrencyConfigChange(i, C));
|
|
263
|
+
}), this.api.onValueChanged(t.PRODUCT_COUNT, (i) => this._onDataChange(t.PRODUCT_COUNT, i.toString())), this.api.onValueChanged(t.PRODUCT_IN_ROW, (i) => this._onDataChange(t.PRODUCT_IN_ROW, i)), this.api.onValueChanged(t.SHUFFLE_PRODUCTS, (i) => this._onDataChange(t.SHUFFLE_PRODUCTS, i)), this.api.onValueChanged(t.RESPONSIVE, (i) => this._onDataChange(t.RESPONSIVE, i)), this.addFilterListener = this._onFilterSelectClick.bind(this), this.addFilterButton = this.getContainer().querySelector("#guido__btn-add-filter"), (s = this.addFilterButton) == null || s.addEventListener("click", this.addFilterListener);
|
|
293
264
|
}
|
|
294
265
|
_listenStateUpdates() {
|
|
295
266
|
this.storeUnsubscription = this.store.$subscribe((e) => {
|
|
296
267
|
if ("payload" in e) {
|
|
297
|
-
const
|
|
298
|
-
|
|
268
|
+
const s = e.payload.recommendationConfigs;
|
|
269
|
+
s && (this.api.updateValues(s), this.store.fetchRecommendationProducts());
|
|
299
270
|
}
|
|
300
271
|
});
|
|
301
272
|
}
|
|
302
273
|
}
|
|
303
274
|
export {
|
|
304
|
-
|
|
305
|
-
|
|
275
|
+
g as CONTROL_BLOCK_ID,
|
|
276
|
+
p as RecommendationBlockControl
|
|
306
277
|
};
|
|
@@ -1,45 +1,10 @@
|
|
|
1
1
|
import { ExtensionBuilder as o } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
-
import { RecommendationBlock as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import { ButtonColorControl as i } from "./controls/button/color.js";
|
|
9
|
-
import { ButtonFitToContentControl as C } from "./controls/button/fitToContent.js";
|
|
10
|
-
import { ButtonFontFamilyControl as a } from "./controls/button/fontFamily.js";
|
|
11
|
-
import { ButtonMarginsControl as e } from "./controls/button/margins.js";
|
|
12
|
-
import { ButtonPaddingsControl as p } from "./controls/button/paddings.js";
|
|
13
|
-
import { ButtonTextControl as f } from "./controls/button/text.js";
|
|
14
|
-
import { ButtonTextSizeControl as c } from "./controls/button/textSize.js";
|
|
15
|
-
import { ButtonTextStyleAndFontColorControl as s } from "./controls/button/textStyleAndFontColor.js";
|
|
16
|
-
import { ImageMarginsControl as g } from "./controls/image/margins.js";
|
|
17
|
-
import { ImageSizeControl as B } from "./controls/image/size.js";
|
|
18
|
-
import { NameAlignControl as P } from "./controls/name/align.js";
|
|
19
|
-
import { NameBackgroundControl as u } from "./controls/name/background.js";
|
|
20
|
-
import { NameColorControl as y } from "./controls/name/color.js";
|
|
21
|
-
import { NameFontFamilyControl as S } from "./controls/name/fontFamily.js";
|
|
22
|
-
import { NamePaddingsControl as F } from "./controls/name/paddings.js";
|
|
23
|
-
import { NameSizeControl as R } from "./controls/name/size.js";
|
|
24
|
-
import { NameStyleControl as N } from "./controls/name/style.js";
|
|
25
|
-
import { OldPriceAlignControl as O } from "./controls/oldPrice/align.js";
|
|
26
|
-
import { OldPriceBackgroundControl as k } from "./controls/oldPrice/background.js";
|
|
27
|
-
import { OldPriceColorControl as x } from "./controls/oldPrice/color.js";
|
|
28
|
-
import { OldPriceFontFamilyControl as z } from "./controls/oldPrice/fontFamily.js";
|
|
29
|
-
import { OldPricePaddingsControl as A } from "./controls/oldPrice/paddings.js";
|
|
30
|
-
import { OldPriceSizeControl as I } from "./controls/oldPrice/size.js";
|
|
31
|
-
import { OldPriceStyleControl as T } from "./controls/oldPrice/style.js";
|
|
32
|
-
import { PriceAlignControl as w } from "./controls/price/align.js";
|
|
33
|
-
import { PriceBackgroundControl as h } from "./controls/price/background.js";
|
|
34
|
-
import { PriceColorControl as E } from "./controls/price/color.js";
|
|
35
|
-
import { PriceFontFamilyControl as M } from "./controls/price/fontFamily.js";
|
|
36
|
-
import { PricePaddingsControl as b } from "./controls/price/paddings.js";
|
|
37
|
-
import { PriceSizeControl as j } from "./controls/price/size.js";
|
|
38
|
-
import { PriceStyleControl as q } from "./controls/price/style.js";
|
|
39
|
-
import { RecommendationIconsRegistry as v } from "./iconsRegistry.js";
|
|
40
|
-
import D from "./recommendation.css.js";
|
|
41
|
-
import { SettingsPanel as G } from "./settingsPanel.js";
|
|
42
|
-
const Io = new o().addBlock(r).withSettingsPanelRegistry(G).addControl(n).addControl(d).addControl(l).addControl(m).addControl(i).addControl(C).addControl(a).addControl(e).addControl(p).addControl(f).addControl(c).addControl(s).addControl(g).addControl(B).addControl(P).addControl(u).addControl(y).addControl(S).addControl(F).addControl(R).addControl(N).addControl(O).addControl(k).addControl(x).addControl(z).addControl(A).addControl(I).addControl(T).addControl(w).addControl(h).addControl(E).addControl(M).addControl(b).addControl(j).addControl(q).addControl(t).addStyles(D).withIconsRegistry(v).build();
|
|
2
|
+
import { RecommendationBlock as t } from "./block.js";
|
|
3
|
+
import { RecommendationBlockControl as e } from "./control.js";
|
|
4
|
+
import { RecommendationIconsRegistry as n } from "./iconsRegistry.js";
|
|
5
|
+
import i from "./recommendation.css.js";
|
|
6
|
+
import { SettingsPanel as m } from "./settingsPanel.js";
|
|
7
|
+
const f = new o().addBlock(t).withSettingsPanelRegistry(m).addControl(e).addStyles(i).withIconsRegistry(n).build();
|
|
43
8
|
export {
|
|
44
|
-
|
|
9
|
+
f as default
|
|
45
10
|
};
|
|
@@ -1,117 +1,32 @@
|
|
|
1
|
-
import { SettingsPanelRegistry as
|
|
2
|
-
import { BLOCK_ID as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
e,
|
|
13
|
-
S.EXTERNAL_INDENTS
|
|
14
|
-
]
|
|
15
|
-
),
|
|
16
|
-
new _(
|
|
17
|
-
E.STYLES,
|
|
18
|
-
[
|
|
19
|
-
L.TEXT_BLOCK_BACKGROUND_COLOR
|
|
20
|
-
]
|
|
21
|
-
),
|
|
22
|
-
new _(
|
|
23
|
-
"Card Composition",
|
|
24
|
-
[
|
|
25
|
-
C
|
|
26
|
-
]
|
|
27
|
-
).withLabel("Card Composition")
|
|
28
|
-
], O[I.NAME] = [
|
|
29
|
-
new _(
|
|
30
|
-
E.SETTINGS,
|
|
31
|
-
[
|
|
32
|
-
T.NAME_BACKGROUND,
|
|
33
|
-
T.NAME_COLOR,
|
|
34
|
-
T.NAME_SIZE,
|
|
35
|
-
T.NAME_STYLE,
|
|
36
|
-
T.NAME_FONT_FAMILY
|
|
37
|
-
]
|
|
38
|
-
),
|
|
39
|
-
new _(
|
|
40
|
-
E.STYLES,
|
|
41
|
-
[
|
|
42
|
-
T.NAME_ALIGN,
|
|
43
|
-
T.NAME_PADDINGS
|
|
44
|
-
]
|
|
45
|
-
)
|
|
46
|
-
], O[I.PRICE] = [
|
|
47
|
-
new _(
|
|
48
|
-
E.SETTINGS,
|
|
49
|
-
[
|
|
50
|
-
T.PRICE_BACKGROUND,
|
|
51
|
-
T.PRICE_COLOR,
|
|
52
|
-
T.PRICE_SIZE,
|
|
53
|
-
T.PRICE_STYLE,
|
|
54
|
-
T.PRICE_FONT_FAMILY
|
|
1
|
+
import { SettingsPanelRegistry as o, SettingsPanelTab as t, SettingsTab as e, ContainerControls as r, TextControls as s } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { BLOCK_ID as T } from "./block.js";
|
|
3
|
+
import { CONTROL_BLOCK_ID as i } from "./control.js";
|
|
4
|
+
class a extends o {
|
|
5
|
+
registerBlockControls(n) {
|
|
6
|
+
n[T] = [
|
|
7
|
+
new t(
|
|
8
|
+
e.SETTINGS,
|
|
9
|
+
[
|
|
10
|
+
i,
|
|
11
|
+
r.EXTERNAL_INDENTS
|
|
55
12
|
]
|
|
56
13
|
),
|
|
57
|
-
new
|
|
58
|
-
|
|
59
|
-
[
|
|
60
|
-
T.PRICE_ALIGN,
|
|
61
|
-
T.PRICE_PADDINGS
|
|
62
|
-
]
|
|
63
|
-
)
|
|
64
|
-
], O[I.OLD_PRICE] = [
|
|
65
|
-
new _(
|
|
66
|
-
E.SETTINGS,
|
|
67
|
-
[
|
|
68
|
-
T.OLD_PRICE_BACKGROUND,
|
|
69
|
-
T.OLD_PRICE_COLOR,
|
|
70
|
-
T.OLD_PRICE_SIZE,
|
|
71
|
-
T.OLD_PRICE_STYLE,
|
|
72
|
-
T.OLD_PRICE_FONT_FAMILY
|
|
73
|
-
]
|
|
74
|
-
),
|
|
75
|
-
new _(
|
|
76
|
-
E.STYLES,
|
|
77
|
-
[
|
|
78
|
-
T.OLD_PRICE_ALIGN,
|
|
79
|
-
T.OLD_PRICE_PADDINGS
|
|
80
|
-
]
|
|
81
|
-
)
|
|
82
|
-
], O[I.BUTTON] = [
|
|
83
|
-
new _(
|
|
84
|
-
E.SETTINGS,
|
|
85
|
-
[
|
|
86
|
-
T.BUTTON_TEXT,
|
|
87
|
-
T.BUTTON_ALIGN,
|
|
88
|
-
T.BUTTON_MARGINS,
|
|
89
|
-
T.BUTTON_PADDINGS
|
|
90
|
-
]
|
|
91
|
-
),
|
|
92
|
-
new _(
|
|
93
|
-
E.STYLES,
|
|
94
|
-
[
|
|
95
|
-
T.BUTTON_COLOR,
|
|
96
|
-
T.BUTTON_FONT_FAMILY,
|
|
97
|
-
T.BUTTON_TEXT_SIZE,
|
|
98
|
-
T.BUTTON_TEXT_STYLE_AND_FONT_COLOR,
|
|
99
|
-
T.BUTTON_FIT_TO_CONTENT,
|
|
100
|
-
T.BUTTON_BORDER_RADIUS,
|
|
101
|
-
T.BUTTON_BORDER
|
|
102
|
-
]
|
|
103
|
-
)
|
|
104
|
-
], O[I.IMAGE] = [
|
|
105
|
-
new _(
|
|
106
|
-
E.SETTINGS,
|
|
14
|
+
new t(
|
|
15
|
+
e.STYLES,
|
|
107
16
|
[
|
|
108
|
-
|
|
109
|
-
T.IMAGE_MARGINS
|
|
17
|
+
s.TEXT_BLOCK_BACKGROUND_COLOR
|
|
110
18
|
]
|
|
111
19
|
)
|
|
20
|
+
// TODO: It'll be opened after the card composition is implemented by Stripo team.
|
|
21
|
+
// new SettingsPanelTab(
|
|
22
|
+
// 'Card Composition',
|
|
23
|
+
// [
|
|
24
|
+
// COMPOSITION_CONTROL_BLOCK_ID,
|
|
25
|
+
// ]
|
|
26
|
+
// ).withLabel('Card Composition'),
|
|
112
27
|
];
|
|
113
28
|
}
|
|
114
29
|
}
|
|
115
30
|
export {
|
|
116
|
-
|
|
31
|
+
a as SettingsPanel
|
|
117
32
|
};
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
const g = {
|
|
2
|
+
TITLE: "You May Also Like!"
|
|
3
|
+
}, h = `
|
|
4
|
+
<td align="left" class="ins-recommendation-v3-block-v2 esd-block-recommendation-v3-block">
|
|
5
|
+
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
6
|
+
<tr>
|
|
7
|
+
<td align="center" style="padding: 20px 0;">
|
|
8
|
+
<!-- Email Content Container -->
|
|
9
|
+
<table class="container"
|
|
10
|
+
width="600"
|
|
11
|
+
cellpadding="0"
|
|
12
|
+
cellspacing="0"
|
|
13
|
+
border="0"
|
|
14
|
+
style="max-width: 600px; width: 100%; background-color: #ffffff;">
|
|
15
|
+
<!-- Heading -->
|
|
16
|
+
<tr>
|
|
17
|
+
<td class="heading"
|
|
18
|
+
style="
|
|
19
|
+
font-size: 28px;
|
|
20
|
+
font-weight: bold;
|
|
21
|
+
color: #333333;
|
|
22
|
+
text-align: center;
|
|
23
|
+
padding: 30px 20px;">
|
|
24
|
+
{-{-TITLE-}-}
|
|
25
|
+
</td>
|
|
26
|
+
</tr>
|
|
27
|
+
|
|
28
|
+
<!-- Product Rows -->
|
|
29
|
+
{-{-PRODUCT_ROWS-}-}
|
|
30
|
+
</table>
|
|
31
|
+
<!-- End Email Content Container -->
|
|
32
|
+
</td>
|
|
33
|
+
</tr>
|
|
34
|
+
</table>
|
|
35
|
+
</td>
|
|
36
|
+
`, u = `
|
|
37
|
+
<tr>
|
|
38
|
+
<td style="padding: 0 20px;">
|
|
39
|
+
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0">
|
|
40
|
+
{-{-PRODUCTS-}-}
|
|
41
|
+
</table>
|
|
42
|
+
</td>
|
|
43
|
+
</tr>
|
|
44
|
+
`, m = `
|
|
45
|
+
<td width="{-{-COLUMN_WIDTH-}-}" style="padding: 0 5px;" valign="top" height="100%">
|
|
46
|
+
<table width="100%"
|
|
47
|
+
height="100%"
|
|
48
|
+
cellpadding="0"
|
|
49
|
+
cellspacing="0"
|
|
50
|
+
border="0"
|
|
51
|
+
class="product-card-wrapper"
|
|
52
|
+
style="background-color: #f8f8f8;">
|
|
53
|
+
<tr>
|
|
54
|
+
<td class="product-image-cell"
|
|
55
|
+
valign="top"
|
|
56
|
+
style="background-color: #e8f0f2; padding: 30px; text-align: center;">
|
|
57
|
+
<img src="{-{-PRODUCT_IMAGE-}-}"
|
|
58
|
+
alt="{-{-PRODUCT_NAME-}-}" width="120" style="max-width: 100%; height: auto; margin: 0 auto;">
|
|
59
|
+
</td>
|
|
60
|
+
</tr>
|
|
61
|
+
</table>
|
|
62
|
+
</td>
|
|
63
|
+
`, b = `
|
|
64
|
+
<td width="{-{-COLUMN_WIDTH-}-}" style="padding: 0 5px;" valign="top" height="100%">
|
|
65
|
+
<table width="100%"
|
|
66
|
+
height="100%"
|
|
67
|
+
cellpadding="0"
|
|
68
|
+
cellspacing="0"
|
|
69
|
+
border="0"
|
|
70
|
+
class="product-card-wrapper"
|
|
71
|
+
style="background-color: #f8f8f8;">
|
|
72
|
+
<tr>
|
|
73
|
+
<td class="product-name-cell"
|
|
74
|
+
valign="top"
|
|
75
|
+
style="font-size: 16px; color: #333333; font-weight: 600; padding: 15px 10px; text-align: center;">
|
|
76
|
+
{-{-PRODUCT_NAME-}-}
|
|
77
|
+
</td>
|
|
78
|
+
</tr>
|
|
79
|
+
</table>
|
|
80
|
+
</td>
|
|
81
|
+
`, x = `
|
|
82
|
+
<td width="{-{-COLUMN_WIDTH-}-}" style="padding: 0 5px;" valign="top" height="100%">
|
|
83
|
+
<table width="100%"
|
|
84
|
+
height="100%"
|
|
85
|
+
cellpadding="0"
|
|
86
|
+
cellspacing="0"
|
|
87
|
+
border="0"
|
|
88
|
+
class="product-card-wrapper"
|
|
89
|
+
style="background-color: #f8f8f8;">
|
|
90
|
+
<tr>
|
|
91
|
+
<td class="price-cell" valign="top" style="padding: 10px; text-align: center;">
|
|
92
|
+
<span class="current-price" style="font-size: 16px; color: #333333; font-weight: bold;">
|
|
93
|
+
18,00 TRY
|
|
94
|
+
</span>
|
|
95
|
+
<span class="old-price" style="font-size: 14px; color: #999999; text-decoration: line-through;">
|
|
96
|
+
20,00 TRY
|
|
97
|
+
</span>
|
|
98
|
+
</td>
|
|
99
|
+
</tr>
|
|
100
|
+
</table>
|
|
101
|
+
</td>
|
|
102
|
+
`, w = `
|
|
103
|
+
<td width="{-{-COLUMN_WIDTH-}-}" style="padding: 0 5px;" valign="top" height="100%">
|
|
104
|
+
<table width="100%"
|
|
105
|
+
height="100%"
|
|
106
|
+
cellpadding="0"
|
|
107
|
+
cellspacing="0"
|
|
108
|
+
border="0"
|
|
109
|
+
class="product-card-wrapper"
|
|
110
|
+
style="background-color: #f8f8f8;">
|
|
111
|
+
<tr>
|
|
112
|
+
<td class="button-cell" valign="top" style="padding: 15px 10px 20px 10px; text-align: center;">
|
|
113
|
+
<a href="#"
|
|
114
|
+
class="buy-button"
|
|
115
|
+
style="
|
|
116
|
+
display: inline-block;
|
|
117
|
+
width: 90%;
|
|
118
|
+
max-width: 150px;
|
|
119
|
+
padding: 12px 20px;
|
|
120
|
+
background-color: #ffffff;
|
|
121
|
+
color: #333333;
|
|
122
|
+
text-decoration: none;
|
|
123
|
+
border: 2px solid #cccccc;
|
|
124
|
+
font-size: 16px;
|
|
125
|
+
box-sizing: border-box;">
|
|
126
|
+
Buy
|
|
127
|
+
</a>
|
|
128
|
+
</td>
|
|
129
|
+
</tr>
|
|
130
|
+
</table>
|
|
131
|
+
</td>
|
|
132
|
+
`, f = `
|
|
133
|
+
<tr>
|
|
134
|
+
<td class="spacer" style="height: 20px;"></td>
|
|
135
|
+
</tr>
|
|
136
|
+
`;
|
|
137
|
+
function T() {
|
|
138
|
+
const c = [
|
|
139
|
+
{
|
|
140
|
+
name: "Beanie with Logo",
|
|
141
|
+
image: "https://inshoppingcart.com/ins-html/wp-content/uploads/2018/08/beanie-with-logo-1.jpg",
|
|
142
|
+
price: "18,00 TRY",
|
|
143
|
+
oldPrice: "20,00 TRY",
|
|
144
|
+
url: "https://example.com/product/1"
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: "Belt",
|
|
148
|
+
image: "https://inshoppingcart.com/ins-html/wp-content/uploads/2018/09/belt-2.jpg",
|
|
149
|
+
price: "55,00 TRY",
|
|
150
|
+
oldPrice: "65,00 TRY",
|
|
151
|
+
url: "https://example.com/product/2"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
name: "Beanie",
|
|
155
|
+
image: "https://inshoppingcart.com/ins-html/wp-content/uploads/2018/08/beanie-with-logo-1.jpg",
|
|
156
|
+
price: "18,00 TRY",
|
|
157
|
+
oldPrice: "20,00 TRY",
|
|
158
|
+
url: "https://example.com/product/3"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: "Album",
|
|
162
|
+
image: "https://inshoppingcart.com/ins-html/wp-content/uploads/2018/12/poster_2_up.jpg",
|
|
163
|
+
price: "15,00 TRY",
|
|
164
|
+
oldPrice: "15,00 TRY",
|
|
165
|
+
url: "https://example.com/product/4"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: "Flying Ninja with a very long product name",
|
|
169
|
+
image: "https://inshoppingcart.com/ins-html/wp-content/uploads/2018/09/belt-2.jpg",
|
|
170
|
+
price: "12,00 TRY",
|
|
171
|
+
oldPrice: "15,00 TRY",
|
|
172
|
+
url: "https://example.com/product/5"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
name: "Single",
|
|
176
|
+
image: "https://inshoppingcart.com/ins-html/wp-content/uploads/2018/12/poster_2_up.jpg",
|
|
177
|
+
price: "22.555,00 TRY",
|
|
178
|
+
oldPrice: "33.989,00 TRY",
|
|
179
|
+
url: "https://example.com/product/6"
|
|
180
|
+
}
|
|
181
|
+
], l = 3, d = (100 / l).toFixed(2), a = [];
|
|
182
|
+
for (let t = 0; t < c.length; t += l)
|
|
183
|
+
a.push(c.slice(t, t + l));
|
|
184
|
+
let e = "";
|
|
185
|
+
return a.forEach((t, s) => {
|
|
186
|
+
s > 0 && (e += f);
|
|
187
|
+
let p = "", r = "", n = "", i = "";
|
|
188
|
+
t.forEach((o) => {
|
|
189
|
+
p += m.replace("{-{-PRODUCT_IMAGE-}-}", o.image).replace("{-{-PRODUCT_NAME-}-}", o.name), r += b.replace("{-{-PRODUCT_NAME-}-}", o.name), n += x, i += w;
|
|
190
|
+
}), e += u.replace("{-{-PRODUCTS-}-}", `
|
|
191
|
+
<tr>${p}</tr>
|
|
192
|
+
<tr>${r}</tr>
|
|
193
|
+
<tr>${n}</tr>
|
|
194
|
+
<tr>${i}</tr>
|
|
195
|
+
`), e = e.replaceAll("{-{-COLUMN_WIDTH-}-}", `${d}%`);
|
|
196
|
+
}), h.replace("{-{-TITLE-}-}", g.TITLE).replace("{-{-PRODUCT_ROWS-}-}", e);
|
|
197
|
+
}
|
|
198
|
+
export {
|
|
199
|
+
T as getDefaultTemplate
|
|
200
|
+
};
|