@useinsider/guido 3.22.0-beta.d4e1d48 → 3.22.0-beta.e1b5da2
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/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +11 -11
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +9 -9
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +22 -22
- package/dist/config/migrator/recommendation/compositionMapper.js +56 -49
- package/dist/config/migrator/recommendation/extractors.js +100 -40
- package/dist/config/migrator/recommendation/htmlBuilder.js +285 -207
- package/dist/config/migrator/recommendation/settingsMapper.js +37 -36
- package/dist/config/migrator/recommendation/themeMapper.js +53 -41
- package/dist/config/migrator/recommendationMigrator.js +68 -61
- package/dist/extensions/Blocks/Recommendation/block.js +33 -24
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +20 -19
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +148 -163
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +23 -22
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +19 -18
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +82 -91
- package/dist/extensions/Blocks/Recommendation/utils/inlinePriceOrder.js +12 -0
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +3 -2
- package/dist/guido.css +1 -1
- package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +3 -1
- package/dist/src/config/migrator/recommendation/extractors.d.ts +35 -6
- package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +3 -1
- package/dist/src/config/migrator/recommendation/themeMapper.d.ts +3 -1
- package/dist/src/config/migrator/recommendation/types.d.ts +11 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -8
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -13
- package/dist/src/extensions/Blocks/Recommendation/utils/inlinePriceOrder.d.ts +9 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +2 -19
- package/dist/src/stores/unsubscribe.d.ts +0 -10
- package/dist/stores/unsubscribe.js +29 -33
- package/package.json +1 -1
|
@@ -121,14 +121,8 @@ export declare class RecommendationBlockControl extends CommonControl {
|
|
|
121
121
|
private _fetchBlockData;
|
|
122
122
|
private _isPanelOn;
|
|
123
123
|
/**
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
* For new blocks (config still matches hardcoded defaults), validates that
|
|
127
|
-
* the default currency and algorithm are available from the API response.
|
|
128
|
-
* If not, falls back to the first available option.
|
|
129
|
-
*
|
|
130
|
-
* Saved templates with user-customized config are left unchanged because
|
|
131
|
-
* their values won't match the hardcoded defaults.
|
|
124
|
+
* Falls back to the first available option when the block's currency or locale is not offered (a new block on
|
|
125
|
+
* the hard-coded default, or a block copied from another account). Only the default strategy gets an algorithm.
|
|
132
126
|
*/
|
|
133
127
|
private _applySmartDefaults;
|
|
134
128
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CurrencyConfig } from '../types/nodeConfig';
|
|
2
2
|
import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
|
|
3
3
|
import { ATTR_PRODUCT_IMAGE, ATTR_PRODUCT_NAME, ATTR_PRODUCT_PRICE, ATTR_PRODUCT_OLD_PRICE, ATTR_PRODUCT_OMNIBUS_PRICE, ATTR_PRODUCT_OMNIBUS_DISCOUNT, ATTR_PRODUCT_BUTTON } from '../constants';
|
|
4
|
+
export { resolveInlinePriceOrder } from '../utils/inlinePriceOrder';
|
|
4
5
|
type PriceKey = 'price' | 'original_price' | 'discount';
|
|
5
6
|
/**
|
|
6
7
|
* Current currency configuration from the store, in CurrencyConfig shape.
|
|
@@ -22,18 +23,6 @@ export declare function isSamePrice(product: RecommendationProduct): boolean;
|
|
|
22
23
|
* e.g., "rating_star" → "Rating Star"
|
|
23
24
|
*/
|
|
24
25
|
export declare function toDisplayName(attrName: string): string;
|
|
25
|
-
/**
|
|
26
|
-
* Resolves the inline (side-by-side) price layout from the composition order so
|
|
27
|
-
* it matches the stacked order. `anchor` is whichever of price / original price
|
|
28
|
-
* comes first in the composition (the merged cell renders there); `skip` is the
|
|
29
|
-
* other (dropped, since it's merged in); `originalFirst` puts the original price
|
|
30
|
-
* on the left when it precedes the sale price (the default composition order).
|
|
31
|
-
*/
|
|
32
|
-
export declare function resolveInlinePriceOrder(composition: string[]): {
|
|
33
|
-
originalFirst: boolean;
|
|
34
|
-
anchor: string;
|
|
35
|
-
skip: string;
|
|
36
|
-
};
|
|
37
26
|
/**
|
|
38
27
|
* Reduces a raw product-attribute value to a displayable scalar string.
|
|
39
28
|
* Array-type attributes (filter types `Strings`/`Numbers`) are substituted with
|
|
@@ -328,4 +317,3 @@ export declare function getDefaultProducts(count?: number): RecommendationProduc
|
|
|
328
317
|
* @returns HTML template string with {-{-TITLE-}-}, {-{-PRODUCT_ROWS-}-}, and {-{-MOBILE_PRODUCT_ROWS-}-} (grid only) placeholders
|
|
329
318
|
*/
|
|
330
319
|
export declare function createBlockTemplate(layout?: Orientation, instanceClass?: string): string;
|
|
331
|
-
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves the inline price layout from the composition order: `anchor` is whichever price comes first (the merged
|
|
3
|
+
* cell renders there), `skip` is the other; `originalFirst` puts the original price on the left.
|
|
4
|
+
*/
|
|
5
|
+
export declare function resolveInlinePriceOrder(composition: string[]): {
|
|
6
|
+
originalFirst: boolean;
|
|
7
|
+
anchor: string;
|
|
8
|
+
skip: string;
|
|
9
|
+
};
|
|
@@ -1,22 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Maps legacy
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* Renames are matched by feed-source id:
|
|
6
|
-
* - `viewedTogether` → `similarViewed` (id 11, path `viewed-together`)
|
|
7
|
-
* - `purchasedTogether` → `similarBought` (id 12, path `purchased-together`)
|
|
8
|
-
* - `trending` → `trendingProducts` (id 40, path `trending`)
|
|
9
|
-
* - `mostValuable` → `mostValuableOfPartner` (id 46, path `most-valuable`)
|
|
10
|
-
* - `topSellers` → `mostPurchased` (id 62, path `top-sellers`)
|
|
11
|
-
* - `mostViewed` → `mostPopular` (id 61, path `most-popular`)
|
|
12
|
-
*
|
|
13
|
-
* Used at two boundaries:
|
|
14
|
-
* 1. The migrator (`settingsMapper`), so freshly migrated node configs carry
|
|
15
|
-
* the new key.
|
|
16
|
-
* 2. The algorithm dropdown control, so already-saved blocks that still carry
|
|
17
|
-
* a legacy key resolve to a matching dropdown option.
|
|
18
|
-
*
|
|
19
|
-
* Unknown values pass through untouched so a future-added algorithm doesn't
|
|
20
|
-
* silently default.
|
|
2
|
+
* Maps legacy strategy keys to `RecommendationFeedSourceMaps` keys; product-bound ones (ids 11, 12, excluded from the
|
|
3
|
+
* dropdown) become `mostPopular`. Unknown keys pass through so a future algorithm is not silently defaulted.
|
|
21
4
|
*/
|
|
22
5
|
export declare function mapLegacyStrategy(legacy: string | undefined): string | undefined;
|
|
@@ -26,7 +26,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
26
26
|
createdAt: string;
|
|
27
27
|
updatedAt: string;
|
|
28
28
|
status: number;
|
|
29
|
-
isDefault?: boolean | undefined;
|
|
30
29
|
}[];
|
|
31
30
|
selectedTemplates: Record<number, number>;
|
|
32
31
|
selectedUnsubscribePages: number[];
|
|
@@ -52,7 +51,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
52
51
|
createdAt: string;
|
|
53
52
|
updatedAt: string;
|
|
54
53
|
status: number;
|
|
55
|
-
isDefault?: boolean | undefined;
|
|
56
54
|
}[];
|
|
57
55
|
selectedTemplates: Record<number, number>;
|
|
58
56
|
selectedUnsubscribePages: number[];
|
|
@@ -78,7 +76,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
78
76
|
createdAt: string;
|
|
79
77
|
updatedAt: string;
|
|
80
78
|
status: number;
|
|
81
|
-
isDefault?: boolean | undefined;
|
|
82
79
|
}[];
|
|
83
80
|
selectedTemplates: Record<number, number>;
|
|
84
81
|
selectedUnsubscribePages: number[];
|
|
@@ -102,7 +99,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
102
99
|
createdAt: string;
|
|
103
100
|
updatedAt: string;
|
|
104
101
|
status: number;
|
|
105
|
-
isDefault?: boolean | undefined;
|
|
106
102
|
}[];
|
|
107
103
|
getThumbnailByTemplateId: (state: {
|
|
108
104
|
templates: {
|
|
@@ -117,7 +113,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
117
113
|
createdAt: string;
|
|
118
114
|
updatedAt: string;
|
|
119
115
|
status: number;
|
|
120
|
-
isDefault?: boolean | undefined;
|
|
121
116
|
}[];
|
|
122
117
|
selectedTemplates: Record<number, number>;
|
|
123
118
|
selectedUnsubscribePages: number[];
|
|
@@ -143,7 +138,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
143
138
|
createdAt: string;
|
|
144
139
|
updatedAt: string;
|
|
145
140
|
status: number;
|
|
146
|
-
isDefault?: boolean | undefined;
|
|
147
141
|
}[];
|
|
148
142
|
selectedTemplates: Record<number, number>;
|
|
149
143
|
selectedUnsubscribePages: number[];
|
|
@@ -169,7 +163,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
169
163
|
createdAt: string;
|
|
170
164
|
updatedAt: string;
|
|
171
165
|
status: number;
|
|
172
|
-
isDefault?: boolean | undefined;
|
|
173
166
|
}[];
|
|
174
167
|
selectedTemplates: Record<number, number>;
|
|
175
168
|
selectedUnsubscribePages: number[];
|
|
@@ -195,7 +188,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
195
188
|
createdAt: string;
|
|
196
189
|
updatedAt: string;
|
|
197
190
|
status: number;
|
|
198
|
-
isDefault?: boolean | undefined;
|
|
199
191
|
}[];
|
|
200
192
|
selectedTemplates: Record<number, number>;
|
|
201
193
|
selectedUnsubscribePages: number[];
|
|
@@ -221,7 +213,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
221
213
|
createdAt: string;
|
|
222
214
|
updatedAt: string;
|
|
223
215
|
status: number;
|
|
224
|
-
isDefault?: boolean | undefined;
|
|
225
216
|
}[];
|
|
226
217
|
selectedTemplates: Record<number, number>;
|
|
227
218
|
selectedUnsubscribePages: number[];
|
|
@@ -247,7 +238,6 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
247
238
|
createdAt: string;
|
|
248
239
|
updatedAt: string;
|
|
249
240
|
status: number;
|
|
250
|
-
isDefault?: boolean | undefined;
|
|
251
241
|
}[];
|
|
252
242
|
selectedTemplates: Record<number, number>;
|
|
253
243
|
selectedUnsubscribePages: number[];
|
|
@@ -1,27 +1,23 @@
|
|
|
1
|
-
import { TYPE_COLLECTIONS as
|
|
1
|
+
import { TYPE_COLLECTIONS as i, PAGE_TYPES as p } from "../enums/unsubscribe.js";
|
|
2
2
|
import { useUnsubscribeApi as d } from "../services/unsubscribeApi.js";
|
|
3
3
|
import { defineStore as u } from "pinia";
|
|
4
|
-
let
|
|
5
|
-
const
|
|
4
|
+
let o = null;
|
|
5
|
+
const r = () => ({
|
|
6
6
|
templates: [],
|
|
7
7
|
selectedTemplates: {},
|
|
8
8
|
selectedUnsubscribePages: [],
|
|
9
|
-
selectedCollectionType:
|
|
10
|
-
activeType:
|
|
9
|
+
selectedCollectionType: p.GLOBAL_UNSUBSCRIBE,
|
|
10
|
+
activeType: p.GLOBAL_UNSUBSCRIBE,
|
|
11
11
|
pageSelectionUpdateStatus: !1,
|
|
12
12
|
pageSelectionDrawerStatus: !1,
|
|
13
13
|
typeSelectionDrawerStatus: !1,
|
|
14
14
|
isGlobalUnsubscribeDisabled: !1,
|
|
15
15
|
isSubscriptionPreferencesCenterDisabled: !1,
|
|
16
16
|
pendingBlockId: null
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
return [...e].sort((t, l) => +!!l.isDefault - +!!t.isDefault);
|
|
20
|
-
}
|
|
21
|
-
const f = u("guidoUnsubscribe", {
|
|
22
|
-
state: () => p(),
|
|
17
|
+
}), b = u("guidoUnsubscribe", {
|
|
18
|
+
state: () => r(),
|
|
23
19
|
getters: {
|
|
24
|
-
getSelectedCollection: (e) =>
|
|
20
|
+
getSelectedCollection: (e) => i[e.selectedCollectionType],
|
|
25
21
|
getSelectedTemplateByActiveType: (e) => e.selectedTemplates[e.activeType],
|
|
26
22
|
getTemplatesByActiveType: (e) => e.templates.filter((t) => t.type === e.activeType),
|
|
27
23
|
getThumbnailByTemplateId: (e) => (t) => {
|
|
@@ -29,31 +25,31 @@ const f = u("guidoUnsubscribe", {
|
|
|
29
25
|
return ((l = e.templates.find((s) => s.id === t)) == null ? void 0 : l.thumbnail) ?? "";
|
|
30
26
|
},
|
|
31
27
|
getSelectedUnsubscribePagesByCollection: (e) => (t) => {
|
|
32
|
-
const l =
|
|
28
|
+
const l = i[t];
|
|
33
29
|
if (!l)
|
|
34
30
|
return [];
|
|
35
31
|
const s = /* @__PURE__ */ new Map();
|
|
36
32
|
e.templates.forEach((n) => {
|
|
37
33
|
s.set(n.id, n.type);
|
|
38
34
|
});
|
|
39
|
-
const
|
|
35
|
+
const c = new Set(l);
|
|
40
36
|
return e.selectedUnsubscribePages.filter((n) => {
|
|
41
|
-
const
|
|
42
|
-
return
|
|
37
|
+
const a = s.get(n);
|
|
38
|
+
return a !== void 0 && c.has(a);
|
|
43
39
|
});
|
|
44
40
|
},
|
|
45
41
|
isActiveTypeFirstInCollection: (e) => {
|
|
46
|
-
const t =
|
|
42
|
+
const t = i[e.selectedCollectionType] ?? [];
|
|
47
43
|
return e.activeType === t[0];
|
|
48
44
|
},
|
|
49
45
|
isActiveTypeLastInCollection: (e) => {
|
|
50
|
-
const t =
|
|
46
|
+
const t = i[e.selectedCollectionType] ?? [];
|
|
51
47
|
return e.activeType === t[t.length - 1];
|
|
52
48
|
},
|
|
53
49
|
hasTemplatesByCollectionType: (e) => {
|
|
54
50
|
const t = {};
|
|
55
|
-
return (
|
|
56
|
-
t[s] = e.templates.some((
|
|
51
|
+
return (i[e.selectedCollectionType] ?? []).forEach((s) => {
|
|
52
|
+
t[s] = e.templates.some((c) => c.type === s);
|
|
57
53
|
}), t;
|
|
58
54
|
},
|
|
59
55
|
unsubscribePagesStatus: (e) => e.selectedUnsubscribePages.length > 0
|
|
@@ -62,36 +58,36 @@ const f = u("guidoUnsubscribe", {
|
|
|
62
58
|
$reset() {
|
|
63
59
|
const { templates: e, selectedUnsubscribePages: t } = this;
|
|
64
60
|
Object.assign(this, {
|
|
65
|
-
...
|
|
61
|
+
...r(),
|
|
66
62
|
templates: e,
|
|
67
63
|
selectedUnsubscribePages: t
|
|
68
64
|
});
|
|
69
65
|
},
|
|
70
66
|
async fetchTemplates(e = !1) {
|
|
71
|
-
!e && this.templates.length || ((e || !
|
|
67
|
+
!e && this.templates.length || ((e || !o) && (o = (async () => {
|
|
72
68
|
const { getUnsubscribePages: t } = d();
|
|
73
|
-
this.templates =
|
|
69
|
+
this.templates = await t();
|
|
74
70
|
})().finally(() => {
|
|
75
|
-
|
|
76
|
-
})), await
|
|
71
|
+
o = null;
|
|
72
|
+
})), await o);
|
|
77
73
|
},
|
|
78
74
|
setCollection(e) {
|
|
79
75
|
this.selectedCollectionType = e;
|
|
80
|
-
const t =
|
|
76
|
+
const t = i[e];
|
|
81
77
|
if (t && t.length > 0) {
|
|
82
78
|
[this.activeType] = t;
|
|
83
79
|
const l = { ...this.selectedTemplates };
|
|
84
80
|
t.forEach((s) => {
|
|
85
81
|
if (!l[s]) {
|
|
86
|
-
const
|
|
87
|
-
|
|
82
|
+
const c = this.templates.find((n) => n.type === s);
|
|
83
|
+
c && (l[s] = c.id);
|
|
88
84
|
}
|
|
89
85
|
}), this.selectedTemplates = l;
|
|
90
86
|
}
|
|
91
87
|
},
|
|
92
88
|
setCollectionWithoutAutoSelection(e) {
|
|
93
89
|
this.selectedCollectionType = e;
|
|
94
|
-
const t =
|
|
90
|
+
const t = i[e];
|
|
95
91
|
t && t.length > 0 && ([this.activeType] = t);
|
|
96
92
|
},
|
|
97
93
|
setSelectedTemplate(e) {
|
|
@@ -111,12 +107,12 @@ const f = u("guidoUnsubscribe", {
|
|
|
111
107
|
loadSelectedTemplates(e) {
|
|
112
108
|
const t = new Map(this.templates.map((s) => [s.id, s.type])), l = { ...this.selectedTemplates };
|
|
113
109
|
e.forEach((s) => {
|
|
114
|
-
const
|
|
115
|
-
|
|
110
|
+
const c = t.get(s);
|
|
111
|
+
c !== void 0 && (l[c] = s);
|
|
116
112
|
}), this.selectedTemplates = l;
|
|
117
113
|
},
|
|
118
114
|
getSelectedTemplatesByCollection(e) {
|
|
119
|
-
const t =
|
|
115
|
+
const t = i[e], l = [];
|
|
120
116
|
return t.forEach((s) => {
|
|
121
117
|
this.selectedTemplates[s] && l.push(this.selectedTemplates[s]);
|
|
122
118
|
}), l;
|
|
@@ -133,5 +129,5 @@ const f = u("guidoUnsubscribe", {
|
|
|
133
129
|
}
|
|
134
130
|
});
|
|
135
131
|
export {
|
|
136
|
-
|
|
132
|
+
b as useUnsubscribeStore
|
|
137
133
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.22.0-beta.
|
|
3
|
+
"version": "3.22.0-beta.e1b5da2",
|
|
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",
|