@useinsider/guido 3.5.1-beta.848956 → 3.5.1-beta.8631873
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.
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
var p = (d,
|
|
3
|
-
var s = (d,
|
|
1
|
+
var C = Object.defineProperty;
|
|
2
|
+
var p = (d, c, t) => c in d ? C(d, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[c] = t;
|
|
3
|
+
var s = (d, c, t) => p(d, typeof c != "symbol" ? c + "" : c, t);
|
|
4
4
|
import { CommonControl as g } from "../../../common-control.js";
|
|
5
5
|
import { DEFAULT_NODE_CONFIG as a } from "../../constants/defaultConfig.js";
|
|
6
6
|
import { RecommendationConfigService as h } from "../../services/configService.js";
|
|
7
7
|
import { useRecommendationExtensionStore as y } from "../../store/recommendation.js";
|
|
8
|
-
import { AlgorithmControl as
|
|
9
|
-
import { ALGORITHM_CONTROL_ID as
|
|
10
|
-
import { CurrencyControl as
|
|
11
|
-
import { CURRENCY_CONTROL_ID as
|
|
8
|
+
import { AlgorithmControl as N } from "./algorithm.js";
|
|
9
|
+
import { ALGORITHM_CONTROL_ID as Q } from "./algorithm.js";
|
|
10
|
+
import { CurrencyControl as R } from "./currency.js";
|
|
11
|
+
import { CURRENCY_CONTROL_ID as Z } from "./currency.js";
|
|
12
12
|
import { FiltersControl as _ } from "./filters.js";
|
|
13
|
-
import { FILTERS_CONTROL_ID as
|
|
13
|
+
import { FILTERS_CONTROL_ID as et } from "./filters.js";
|
|
14
14
|
import { LayoutOrientationControl as b } from "./layoutOrientation.js";
|
|
15
|
-
import { LAYOUT_ORIENTATION_CONTROL_ID as
|
|
15
|
+
import { LAYOUT_ORIENTATION_CONTROL_ID as rt } from "./layoutOrientation.js";
|
|
16
16
|
import { LocaleControl as O } from "./locale.js";
|
|
17
|
-
import { LOCALE_CONTROL_ID as
|
|
17
|
+
import { LOCALE_CONTROL_ID as it } from "./locale.js";
|
|
18
18
|
import { ProductCountControl as I } from "./productCount.js";
|
|
19
|
-
import { PRODUCT_COUNT_CONTROL_ID as
|
|
19
|
+
import { PRODUCT_COUNT_CONTROL_ID as at } from "./productCount.js";
|
|
20
20
|
import { ProductLayoutControl as T } from "./productLayout.js";
|
|
21
21
|
import { PRODUCT_LAYOUT_CONTROL_ID as lt } from "./productLayout.js";
|
|
22
22
|
import { ShuffleControl as S } from "./shuffle.js";
|
|
23
|
-
import { SHUFFLE_CONTROL_ID as
|
|
24
|
-
import {
|
|
25
|
-
import { adjustProductsToSize as
|
|
23
|
+
import { SHUFFLE_CONTROL_ID as dt } from "./shuffle.js";
|
|
24
|
+
import { setCurrencyAttributes as L, getBlockElement as P, updateProductContentInPlace as D, regenerateProductRowsWithStyles as k } from "./utils.js";
|
|
25
|
+
import { adjustProductsToSize as mt, formatProductPrice as ft, getCardComposition as Ct, getCurrentLayout as pt, reapplySpacing as gt, regenerateMobileProductRows as yt, regenerateProductRows as Nt, updatePricesInPlace as Rt, updateSingleProductContent as _t } from "./utils.js";
|
|
26
26
|
import { useDebounceFn as m } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
27
|
-
const
|
|
28
|
-
class
|
|
27
|
+
const E = "recommendation-id", v = "ui-elements-recommendation-block";
|
|
28
|
+
class K extends g {
|
|
29
29
|
constructor() {
|
|
30
30
|
super(...arguments);
|
|
31
31
|
s(this, "store", y());
|
|
@@ -62,11 +62,11 @@ class H extends g {
|
|
|
62
62
|
if (!this.currentNode || !this.api)
|
|
63
63
|
return;
|
|
64
64
|
const e = this.api.getDocumentModifier();
|
|
65
|
-
|
|
65
|
+
D({
|
|
66
66
|
currentNode: this.currentNode,
|
|
67
67
|
documentModifier: e,
|
|
68
68
|
products: t
|
|
69
|
-
}) ||
|
|
69
|
+
}) || k({
|
|
70
70
|
currentNode: this.currentNode,
|
|
71
71
|
documentModifier: e,
|
|
72
72
|
products: t
|
|
@@ -74,10 +74,10 @@ class H extends g {
|
|
|
74
74
|
}, 100));
|
|
75
75
|
}
|
|
76
76
|
getId() {
|
|
77
|
-
return
|
|
77
|
+
return v;
|
|
78
78
|
}
|
|
79
79
|
getTemplate() {
|
|
80
|
-
return this.algorithmControl = new
|
|
80
|
+
return this.algorithmControl = new N(), this.localeControl = new O(), this.currencyControl = new R(), this.productCountControl = new I(), this.productLayoutControl = new T(), this.filtersControl = new _(), this.shuffleControl = new S(), this.layoutOrientationControl = new b(), [
|
|
81
81
|
this.algorithmControl,
|
|
82
82
|
this.localeControl,
|
|
83
83
|
this.currencyControl,
|
|
@@ -263,7 +263,11 @@ class H extends g {
|
|
|
263
263
|
this.currentNode,
|
|
264
264
|
e,
|
|
265
265
|
"Applied smart defaults"
|
|
266
|
-
),
|
|
266
|
+
), o && e.currency && L({
|
|
267
|
+
currentNode: this.currentNode,
|
|
268
|
+
documentModifier: this.api.getDocumentModifier(),
|
|
269
|
+
currency: e.currency
|
|
270
|
+
}), this.store.patchCurrentBlockConfig({
|
|
267
271
|
...o ? {
|
|
268
272
|
currencySettings: {
|
|
269
273
|
name: o,
|
|
@@ -283,10 +287,10 @@ class H extends g {
|
|
|
283
287
|
* Reads the recommendation-id attribute from the block element within the node
|
|
284
288
|
*/
|
|
285
289
|
_getRecommendationIdFromNode(t) {
|
|
286
|
-
const e =
|
|
290
|
+
const e = P(t);
|
|
287
291
|
if (!e || !("getAttribute" in e))
|
|
288
292
|
return null;
|
|
289
|
-
const o = e.getAttribute(
|
|
293
|
+
const o = e.getAttribute(E);
|
|
290
294
|
if (!o)
|
|
291
295
|
return null;
|
|
292
296
|
const r = parseInt(o);
|
|
@@ -316,8 +320,8 @@ class H extends g {
|
|
|
316
320
|
}
|
|
317
321
|
const i = t.$state.configVersion;
|
|
318
322
|
i !== o && (o = i, this._persistFiltersToNodeConfig(), this._debouncedFetchProducts());
|
|
319
|
-
const
|
|
320
|
-
u &&
|
|
323
|
+
const l = t.recommendationProducts, u = l !== e, f = Array.isArray(l) && l.length > 0;
|
|
324
|
+
u && f && (e = l, this._debouncedRegenerateWithProducts());
|
|
321
325
|
});
|
|
322
326
|
}
|
|
323
327
|
/**
|
|
@@ -337,35 +341,35 @@ class H extends g {
|
|
|
337
341
|
}
|
|
338
342
|
}
|
|
339
343
|
export {
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
344
|
+
Q as ALGORITHM_CONTROL_ID,
|
|
345
|
+
N as AlgorithmControl,
|
|
346
|
+
v as CONTROL_BLOCK_ID,
|
|
347
|
+
Z as CURRENCY_CONTROL_ID,
|
|
348
|
+
R as CurrencyControl,
|
|
349
|
+
et as FILTERS_CONTROL_ID,
|
|
346
350
|
_ as FiltersControl,
|
|
347
|
-
|
|
348
|
-
|
|
351
|
+
rt as LAYOUT_ORIENTATION_CONTROL_ID,
|
|
352
|
+
it as LOCALE_CONTROL_ID,
|
|
349
353
|
b as LayoutOrientationControl,
|
|
350
354
|
O as LocaleControl,
|
|
351
|
-
|
|
355
|
+
at as PRODUCT_COUNT_CONTROL_ID,
|
|
352
356
|
lt as PRODUCT_LAYOUT_CONTROL_ID,
|
|
353
357
|
I as ProductCountControl,
|
|
354
358
|
T as ProductLayoutControl,
|
|
355
|
-
|
|
356
|
-
|
|
359
|
+
K as RecommendationBlockControl,
|
|
360
|
+
dt as SHUFFLE_CONTROL_ID,
|
|
357
361
|
S as ShuffleControl,
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
362
|
+
mt as adjustProductsToSize,
|
|
363
|
+
ft as formatProductPrice,
|
|
364
|
+
P as getBlockElement,
|
|
361
365
|
Ct as getCardComposition,
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
366
|
+
pt as getCurrentLayout,
|
|
367
|
+
gt as reapplySpacing,
|
|
368
|
+
yt as regenerateMobileProductRows,
|
|
369
|
+
Nt as regenerateProductRows,
|
|
370
|
+
k as regenerateProductRowsWithStyles,
|
|
371
|
+
L as setCurrencyAttributes,
|
|
372
|
+
Rt as updatePricesInPlace,
|
|
373
|
+
D as updateProductContentInPlace,
|
|
370
374
|
_t as updateSingleProductContent
|
|
371
375
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ModificationDescription as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { RecommendationBlockId as m } from "../../constants/blockIds.js";
|
|
3
|
-
import {
|
|
3
|
+
import { CURRENCY_ATTR as y, MOBILE_CONTAINER_SELECTOR as q, MOBILE_ROW_SELECTOR as k, DESKTOP_CONTAINER_SELECTOR as P, CONTAINER_SELECTOR as v, ATTR_PRODUCT_ATTR as W } from "../../constants/selectors.js";
|
|
4
4
|
import { RecommendationConfigService as E } from "../../services/configService.js";
|
|
5
5
|
import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
|
|
6
6
|
import { prepareProductRows as _ } from "../../templates/index.js";
|
package/dist/stores/config.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "../@types/config/schemas.js";
|
|
2
2
|
import "../@types/config/defaults.js";
|
|
3
|
-
import {
|
|
3
|
+
import { parseConfig as o } from "../@types/config/validator.js";
|
|
4
4
|
import { defineStore as r } from "pinia";
|
|
5
|
-
const
|
|
5
|
+
const f = r("guido-config", {
|
|
6
6
|
state: () => ({
|
|
7
7
|
initialized: !1,
|
|
8
8
|
config: null
|
|
@@ -75,65 +75,65 @@ const s = r("guido-config", {
|
|
|
75
75
|
* Get the template ID
|
|
76
76
|
*/
|
|
77
77
|
templateId: (i) => {
|
|
78
|
-
var e,
|
|
79
|
-
return ((
|
|
78
|
+
var e, t;
|
|
79
|
+
return ((t = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : t.templateId) ?? "";
|
|
80
80
|
},
|
|
81
81
|
/**
|
|
82
82
|
* Get the user ID
|
|
83
83
|
*/
|
|
84
84
|
userId: (i) => {
|
|
85
|
-
var e,
|
|
86
|
-
return ((
|
|
85
|
+
var e, t;
|
|
86
|
+
return ((t = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : t.userId) ?? "";
|
|
87
87
|
},
|
|
88
88
|
/**
|
|
89
89
|
* Get the variation ID
|
|
90
90
|
*/
|
|
91
91
|
variationId: (i) => {
|
|
92
|
-
var e,
|
|
93
|
-
return ((
|
|
92
|
+
var e, t;
|
|
93
|
+
return ((t = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : t.variationId) ?? "";
|
|
94
94
|
},
|
|
95
95
|
/**
|
|
96
96
|
* Get the partner name
|
|
97
97
|
*/
|
|
98
98
|
partnerName: (i) => {
|
|
99
|
-
var e,
|
|
100
|
-
return ((
|
|
99
|
+
var e, t;
|
|
100
|
+
return ((t = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : t.name) ?? "";
|
|
101
101
|
},
|
|
102
102
|
/**
|
|
103
103
|
* Get the product type
|
|
104
104
|
*/
|
|
105
105
|
productType: (i) => {
|
|
106
|
-
var e,
|
|
107
|
-
return ((
|
|
106
|
+
var e, t;
|
|
107
|
+
return ((t = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : t.productType) ?? 60;
|
|
108
108
|
},
|
|
109
109
|
/**
|
|
110
110
|
* Get the message type
|
|
111
111
|
*/
|
|
112
112
|
messageType: (i) => {
|
|
113
|
-
var e,
|
|
114
|
-
return ((
|
|
113
|
+
var e, t;
|
|
114
|
+
return ((t = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : t.messageType) ?? 1;
|
|
115
115
|
},
|
|
116
116
|
/**
|
|
117
117
|
* Get the username
|
|
118
118
|
*/
|
|
119
119
|
username: (i) => {
|
|
120
|
-
var e,
|
|
121
|
-
return ((
|
|
120
|
+
var e, t;
|
|
121
|
+
return ((t = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : t.username) ?? "Guido User";
|
|
122
122
|
},
|
|
123
123
|
/**
|
|
124
124
|
* Check if header should be shown
|
|
125
125
|
*/
|
|
126
126
|
showHeader: (i) => {
|
|
127
|
-
var e,
|
|
128
|
-
return ((
|
|
127
|
+
var e, t;
|
|
128
|
+
return ((t = (e = i.config) == null ? void 0 : e.ui) == null ? void 0 : t.showHeader) ?? !0;
|
|
129
129
|
},
|
|
130
130
|
/**
|
|
131
131
|
* Check if a specific feature is enabled
|
|
132
132
|
*/
|
|
133
133
|
// eslint-disable-next-line @stylistic/max-len
|
|
134
134
|
isFeatureEnabled: (i) => (e) => {
|
|
135
|
-
var
|
|
136
|
-
return ((
|
|
135
|
+
var t, n;
|
|
136
|
+
return ((n = (t = i.config) == null ? void 0 : t.features) == null ? void 0 : n[e]) ?? !0;
|
|
137
137
|
}
|
|
138
138
|
},
|
|
139
139
|
actions: {
|
|
@@ -142,7 +142,7 @@ const s = r("guido-config", {
|
|
|
142
142
|
*/
|
|
143
143
|
init(i) {
|
|
144
144
|
const e = o(i);
|
|
145
|
-
|
|
145
|
+
this.config = e, this.initialized = !0;
|
|
146
146
|
},
|
|
147
147
|
/**
|
|
148
148
|
* Reset the config store
|
|
@@ -153,5 +153,5 @@ const s = r("guido-config", {
|
|
|
153
153
|
}
|
|
154
154
|
});
|
|
155
155
|
export {
|
|
156
|
-
|
|
156
|
+
f as useConfigStore
|
|
157
157
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.5.1-beta.
|
|
3
|
+
"version": "3.5.1-beta.8631873",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|