@useinsider/guido 3.2.0-beta.22a0c4c → 3.2.0-beta.294ea63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/composables/useActionsApi.js +4 -4
- package/dist/composables/useFullStoryBridge.js +14 -0
- package/dist/composables/useSave.js +1 -1
- package/dist/composables/useStripo.js +44 -42
- package/dist/config/compiler/recommendationCompilerRules.js +72 -67
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +30 -33
- package/dist/config/migrator/recommendationMigrator.js +1 -1
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +38 -38
- package/dist/extensions/Blocks/Items/enums/productEnums.js +19 -7
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +18 -21
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +6 -6
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +1 -3
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +57 -27
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +17 -18
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +25 -29
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +11 -11
- package/dist/extensions/Blocks/Unsubscribe/block.js +11 -11
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +324 -218
- package/dist/package.json.js +1 -1
- package/dist/src/composables/useActionsApi.d.ts +1 -1
- package/dist/src/composables/useFullStoryBridge.d.ts +11 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +0 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +20 -3
- package/dist/static/styles/components/button.css.js +16 -9
- package/dist/static/styles/components/loader.css.js +4 -0
- package/dist/static/styles/components/narrow-panel.css.js +52 -0
- package/package.json +3 -3
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +0 -99
- package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +0 -14
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.d.ts +0 -35
- package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +0 -29
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { RecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAttributes as k } from "../../../../enums/extensions/recommendationBlock.js";
|
|
2
|
-
import { useRecommendationApi as
|
|
3
|
-
import { useConfigStore as
|
|
2
|
+
import { useRecommendationApi as y } from "../../../../services/recommendationApi.js";
|
|
3
|
+
import { useConfigStore as C } from "../../../../stores/config.js";
|
|
4
4
|
import { defineStore as G } from "pinia";
|
|
5
5
|
import { DEFAULT_CARDS_IN_ROW as F } from "../constants/layout.js";
|
|
6
6
|
import { EXCLUDED_ALGORITHM_IDS as w } from "../constants/defaultConfig.js";
|
|
7
7
|
import { getDefaultProducts as S } from "../templates/utils.js";
|
|
8
8
|
import { generateCompleteFilterQuery as b } from "../utils/filterUtil.js";
|
|
9
9
|
import { isFilterValid as D } from "../validation/filterSchema.js";
|
|
10
|
-
const h =
|
|
11
|
-
let
|
|
10
|
+
const h = y();
|
|
11
|
+
let u = null, m = null, d = null;
|
|
12
12
|
function I() {
|
|
13
13
|
return {
|
|
14
14
|
cardsInRow: F,
|
|
@@ -57,7 +57,7 @@ const v = () => ({
|
|
|
57
57
|
blockStates: {},
|
|
58
58
|
currentRecommendationId: null,
|
|
59
59
|
configVersion: 0
|
|
60
|
-
}),
|
|
60
|
+
}), E = G("guidoRecommendationExtension", {
|
|
61
61
|
state: () => v(),
|
|
62
62
|
getters: {
|
|
63
63
|
// ====================================================================
|
|
@@ -131,10 +131,11 @@ const v = () => ({
|
|
|
131
131
|
})),
|
|
132
132
|
getFilterList() {
|
|
133
133
|
return Object.values(this.filterList).map((t) => {
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
const r = t.type === "defaultAttribute", e = k.includes(t.attributeName);
|
|
135
|
+
let n = r ? t.attributeName : `product_attributes.${t.attributeName}`;
|
|
136
|
+
return n = e ? `${n}.${this.recommendationConfigs.currencySettings.value}` : n, {
|
|
136
137
|
text: t.displayName,
|
|
137
|
-
value:
|
|
138
|
+
value: n,
|
|
138
139
|
type: t.attributeType
|
|
139
140
|
};
|
|
140
141
|
});
|
|
@@ -162,15 +163,10 @@ const v = () => ({
|
|
|
162
163
|
* Resets currentRecommendationId if it was the deleted block.
|
|
163
164
|
*/
|
|
164
165
|
removeBlockState(t) {
|
|
165
|
-
const r =
|
|
166
|
-
if (this.
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
}
|
|
170
|
-
const e = { ...this.blockStates };
|
|
171
|
-
if (delete e[t], this.blockStates = e, this.currentRecommendationId === t) {
|
|
172
|
-
const n = Object.keys(this.blockStates).map(Number);
|
|
173
|
-
this.currentRecommendationId = n.length > 0 ? n[0] : null;
|
|
166
|
+
const r = { ...this.blockStates };
|
|
167
|
+
if (delete r[t], this.blockStates = r, this.currentRecommendationId === t) {
|
|
168
|
+
const e = Object.keys(this.blockStates).map(Number);
|
|
169
|
+
this.currentRecommendationId = e.length > 0 ? e[0] : null;
|
|
174
170
|
}
|
|
175
171
|
},
|
|
176
172
|
/**
|
|
@@ -255,11 +251,11 @@ const v = () => ({
|
|
|
255
251
|
// ====================================================================
|
|
256
252
|
async fetchRecommendationCreateData() {
|
|
257
253
|
if (!this.activePredictiveAlgorithms.length) {
|
|
258
|
-
if (
|
|
259
|
-
await
|
|
254
|
+
if (u) {
|
|
255
|
+
await u;
|
|
260
256
|
return;
|
|
261
257
|
}
|
|
262
|
-
|
|
258
|
+
u = (async () => {
|
|
263
259
|
const {
|
|
264
260
|
activePredictiveAlgorithms: t,
|
|
265
261
|
languages: r,
|
|
@@ -272,26 +268,26 @@ const v = () => ({
|
|
|
272
268
|
this.currencyList = e;
|
|
273
269
|
})();
|
|
274
270
|
try {
|
|
275
|
-
await
|
|
271
|
+
await u;
|
|
276
272
|
} finally {
|
|
277
|
-
|
|
273
|
+
u = null;
|
|
278
274
|
}
|
|
279
275
|
}
|
|
280
276
|
},
|
|
281
277
|
async fetchRecommendationFilters() {
|
|
282
278
|
if (!Object.keys(this.filterList).length) {
|
|
283
|
-
if (
|
|
284
|
-
await
|
|
279
|
+
if (m) {
|
|
280
|
+
await m;
|
|
285
281
|
return;
|
|
286
282
|
}
|
|
287
|
-
|
|
283
|
+
m = (async () => {
|
|
288
284
|
const t = await h.fetchRecommendationFilters();
|
|
289
285
|
this.filterList = t;
|
|
290
286
|
})();
|
|
291
287
|
try {
|
|
292
|
-
await
|
|
288
|
+
await m;
|
|
293
289
|
} finally {
|
|
294
|
-
|
|
290
|
+
m = null;
|
|
295
291
|
}
|
|
296
292
|
}
|
|
297
293
|
},
|
|
@@ -379,7 +375,7 @@ const v = () => ({
|
|
|
379
375
|
},
|
|
380
376
|
async _doFetchProducts() {
|
|
381
377
|
var p;
|
|
382
|
-
const t = this.currentRecommendationId, r = this.blockStates[t], { recommendationConfigs: e } = r, n = e.filters.filter((a) => a.isValid), c = b(n), i = ((p = g.find((a) => a.key === e.strategy)) == null ? void 0 : p.path) || "", o =
|
|
378
|
+
const t = this.currentRecommendationId, r = this.blockStates[t], { recommendationConfigs: e } = r, n = e.filters.filter((a) => a.isValid), c = b(n), i = ((p = g.find((a) => a.key === e.strategy)) == null ? void 0 : p.path) || "", o = C(), s = {
|
|
383
379
|
locale: e.language,
|
|
384
380
|
currency: e.currencySettings.value,
|
|
385
381
|
partnerName: o.partnerName,
|
|
@@ -403,5 +399,5 @@ const v = () => ({
|
|
|
403
399
|
}
|
|
404
400
|
});
|
|
405
401
|
export {
|
|
406
|
-
|
|
402
|
+
E as useRecommendationExtensionStore
|
|
407
403
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ATTR_PRODUCT_IMAGE as
|
|
2
|
-
import { DEFAULT_CARD_COMPOSITION as
|
|
3
|
-
import { listElementRenderer as
|
|
4
|
-
function
|
|
1
|
+
import { ATTR_PRODUCT_IMAGE as d, ATTR_PRODUCT_BUTTON as a } from "../../constants/selectors.js";
|
|
2
|
+
import { DEFAULT_CARD_COMPOSITION as m, spacer as C, buildElementRenderer as b, DEFAULT_CARD_VISIBILITY as T } from "../utils.js";
|
|
3
|
+
import { listElementRenderer as R } from "./elementRenderer.js";
|
|
4
|
+
function f(r, n, l) {
|
|
5
5
|
const t = l ? "" : ' style="display: none;"', o = r.replace(/<tr>/, "").replace(/<\/tr>/, "");
|
|
6
6
|
return `<tr
|
|
7
7
|
class="recommendation-attribute-row"
|
|
@@ -26,26 +26,26 @@ const y = `
|
|
|
26
26
|
</td>
|
|
27
27
|
</tr>
|
|
28
28
|
`;
|
|
29
|
-
function O(r, n =
|
|
30
|
-
const t =
|
|
29
|
+
function O(r, n = m, l = {}) {
|
|
30
|
+
const t = b(R, n, l), o = t[d](r), c = `
|
|
31
31
|
<td class="product-info-cell" valign="middle" style="padding: 15px;">
|
|
32
|
-
<table cellpadding="0" cellspacing="0" role="presentation" width="100%"
|
|
32
|
+
<table cellpadding="0" cellspacing="0" role="presentation" width="100%">
|
|
33
33
|
<tbody>
|
|
34
|
-
${n.filter((e) => e !==
|
|
34
|
+
${n.filter((e) => e !== d && e !== a).filter((e) => t[e]).map((e) => {
|
|
35
35
|
const u = T[e] ?? !0;
|
|
36
|
-
return
|
|
36
|
+
return f(t[e](r), e, u);
|
|
37
37
|
}).join(`
|
|
38
38
|
`)}
|
|
39
39
|
</tbody>
|
|
40
40
|
</table>
|
|
41
41
|
</td>
|
|
42
|
-
`, s = t[
|
|
42
|
+
`, s = t[a](r), p = o + c + s;
|
|
43
43
|
return y.replace("{-{-PRODUCT_CONTENT-}-}", p);
|
|
44
44
|
}
|
|
45
45
|
function D(r, n, l = {}) {
|
|
46
46
|
return r.map((t, o) => {
|
|
47
47
|
const i = O(t, n, l);
|
|
48
|
-
return o > 0 ?
|
|
48
|
+
return o > 0 ? C + i : i;
|
|
49
49
|
}).join("");
|
|
50
50
|
}
|
|
51
51
|
export {
|
|
@@ -3,15 +3,15 @@ var h = (n, i, e) => i in n ? d(n, i, { enumerable: !0, configurable: !0, writab
|
|
|
3
3
|
var u = (n, i, e) => h(n, typeof i != "symbol" ? i + "" : i, e);
|
|
4
4
|
import { PAGE_TYPES as E } from "../../../enums/unsubscribe.js";
|
|
5
5
|
import { useUnsubscribeStore as c } from "../../../stores/unsubscribe.js";
|
|
6
|
-
import { Block as _, BlockCompositionType as S, ModificationDescription as b } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
7
|
-
import { getDefaultTemplate as
|
|
6
|
+
import { Block as _, BlockCompositionType as S, BlockType as L, ModificationDescription as b } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
7
|
+
import { getDefaultTemplate as v } from "./template.js";
|
|
8
8
|
import { UNSUBSCRIBE_EVENTS as a, DATA_ATTRIBUTES as o } from "./utils/constants.js";
|
|
9
9
|
import { parsePageList as p } from "./utils/utils.js";
|
|
10
|
-
const
|
|
10
|
+
const g = "unsubscribe-block", T = 'a[data-unsubscribe-link="true"]', f = ".unsubscribe-block-v2", B = "{{ins-unsubscribe-link}}", C = {
|
|
11
11
|
[E.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
|
|
12
12
|
[E.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
|
|
13
13
|
};
|
|
14
|
-
class
|
|
14
|
+
class I extends _ {
|
|
15
15
|
constructor() {
|
|
16
16
|
super();
|
|
17
17
|
u(this, "selectEventListener", null);
|
|
@@ -19,7 +19,7 @@ class R extends _ {
|
|
|
19
19
|
u(this, "currentNode");
|
|
20
20
|
}
|
|
21
21
|
getId() {
|
|
22
|
-
return
|
|
22
|
+
return g;
|
|
23
23
|
}
|
|
24
24
|
getIcon() {
|
|
25
25
|
return "unsubscribe-icon";
|
|
@@ -34,7 +34,7 @@ class R extends _ {
|
|
|
34
34
|
return this.api.translate("Unsubscribe Block Description");
|
|
35
35
|
}
|
|
36
36
|
getTemplate() {
|
|
37
|
-
return
|
|
37
|
+
return v();
|
|
38
38
|
}
|
|
39
39
|
onSelect(e) {
|
|
40
40
|
this.currentNode = e, !("getAttribute" in e && e.getAttribute("data-migration")) && (this._resetStoreState(), this._loadBlockState(e), this._setupSelectEventListener(), this._setupCancelEventListener(), this._checkExistingBlocks(), this._openDrawer());
|
|
@@ -66,7 +66,7 @@ class R extends _ {
|
|
|
66
66
|
try {
|
|
67
67
|
if (!this.currentNode)
|
|
68
68
|
return;
|
|
69
|
-
this.api.getDocumentModifier().modifyHtml(this.currentNode).
|
|
69
|
+
this.api.getDocumentModifier().modifyHtml(this.currentNode).replaceWith(`<${L.EMPTY_CONTAINER}/>`).apply(new b("Removed unsubscribe block due to cancel"));
|
|
70
70
|
} catch (e) {
|
|
71
71
|
console.warn("[UnsubscribeBlock] Failed to remove unsubscribe block:", e);
|
|
72
72
|
}
|
|
@@ -77,14 +77,14 @@ class R extends _ {
|
|
|
77
77
|
_updateBlock(e, r) {
|
|
78
78
|
if (!this.currentNode || !("querySelector" in this.currentNode))
|
|
79
79
|
return;
|
|
80
|
-
const s = this.currentNode.querySelector(
|
|
80
|
+
const s = this.currentNode.querySelector(T);
|
|
81
81
|
if (!s)
|
|
82
82
|
return;
|
|
83
83
|
const t = this._getMergeTag(e);
|
|
84
84
|
this.api.getDocumentModifier().modifyHtml(s).setAttribute("href", t).apply(new b(`Updated unsubscribe link to ${t}`)), this.api.getDocumentModifier().modifyHtml(this.currentNode).setAttribute(o.PAGE_TYPE, e.toString()).setAttribute(o.PAGE_LIST, r).apply(new b("Updated unsubscribe block metadata"));
|
|
85
85
|
}
|
|
86
86
|
_getMergeTag(e) {
|
|
87
|
-
return
|
|
87
|
+
return C[e] ?? B;
|
|
88
88
|
}
|
|
89
89
|
_openDrawer() {
|
|
90
90
|
if (!(this.currentNode && this.currentNode.getAttribute("data-unsubscribe-page-type")))
|
|
@@ -130,6 +130,6 @@ class R extends _ {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
export {
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
g as UNSUBSCRIBE_BLOCK_ID,
|
|
134
|
+
I as UnsubscribeBlock
|
|
135
135
|
};
|