@useinsider/guido 2.1.0-beta.a67f307 → 2.1.0-beta.a873eb7
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/@types/config/schemas.js +1 -1
- package/dist/components/organisms/extensions/recommendation/FilterItem.vue.js +11 -13
- package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +54 -23
- package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue.js +3 -3
- package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +34 -21
- package/dist/components/organisms/extensions/recommendation/Filters.vue.js +11 -11
- package/dist/components/organisms/extensions/recommendation/Filters.vue2.js +44 -34
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +58 -39
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +93 -57
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +8 -8
- package/dist/extensions/Blocks/Recommendation/validation/filterSchema.js +29 -0
- package/dist/guido.css +1 -1
- package/dist/services/stripoApi.js +20 -17
- package/dist/src/components/organisms/extensions/recommendation/FilterItem.vue.d.ts +1 -0
- package/dist/src/components/organisms/extensions/recommendation/Filters.vue.d.ts +15 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +18 -2
- package/dist/src/extensions/Blocks/Recommendation/validation/filterSchema.d.ts +15 -0
- package/dist/static/templates/empty/index.html.js +74 -0
- package/dist/static/templates/empty/style.css.js +779 -0
- package/package.json +2 -2
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { RecommendationFeedSourceMaps as d,
|
|
2
|
-
import { useRecommendationApi as
|
|
3
|
-
import { useConfigStore as
|
|
4
|
-
import { defineStore as
|
|
5
|
-
import { DEFAULT_CARDS_IN_ROW as
|
|
6
|
-
import { getDefaultProducts as
|
|
1
|
+
import { RecommendationFeedSourceMaps as d, getOperatorOptions as S, PriceAttributes as p } from "../../../../enums/extensions/recommendationBlock.js";
|
|
2
|
+
import { useRecommendationApi as b } from "../../../../services/recommendationApi.js";
|
|
3
|
+
import { useConfigStore as I } from "../../../../stores/config.js";
|
|
4
|
+
import { defineStore as R } from "pinia";
|
|
5
|
+
import { DEFAULT_CARDS_IN_ROW as k } from "../constants/layout.js";
|
|
6
|
+
import { getDefaultProducts as C } from "../templates/utils.js";
|
|
7
7
|
import { generateCompleteFilterQuery as f } from "../utils/filterUtil.js";
|
|
8
|
-
|
|
8
|
+
import { isFilterValid as y } from "../validation/filterSchema.js";
|
|
9
|
+
const m = b();
|
|
9
10
|
function h() {
|
|
10
11
|
return {
|
|
11
|
-
cardsInRow:
|
|
12
|
+
cardsInRow: k,
|
|
12
13
|
currencySettings: {
|
|
13
14
|
name: "USD",
|
|
14
15
|
value: "USD",
|
|
@@ -32,17 +33,18 @@ function h() {
|
|
|
32
33
|
size: "6"
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
+
function G() {
|
|
36
37
|
return {
|
|
37
38
|
recommendationConfigs: h(),
|
|
38
39
|
recommendationProducts: [],
|
|
39
40
|
filterStatus: !1,
|
|
40
41
|
filterSelectionDrawerStatus: !1,
|
|
41
42
|
filterGroup: 1,
|
|
42
|
-
isInitialized: !1
|
|
43
|
+
isInitialized: !1,
|
|
44
|
+
filterSnapshot: null
|
|
43
45
|
};
|
|
44
46
|
}
|
|
45
|
-
const
|
|
47
|
+
const F = () => ({
|
|
46
48
|
recommendationCampaignUrls: {},
|
|
47
49
|
activePredictiveAlgorithms: [],
|
|
48
50
|
languages: {},
|
|
@@ -51,8 +53,8 @@ const y = () => ({
|
|
|
51
53
|
blockStates: {},
|
|
52
54
|
currentRecommendationId: null,
|
|
53
55
|
configVersion: 0
|
|
54
|
-
}),
|
|
55
|
-
state: () =>
|
|
56
|
+
}), V = R("guidoRecommendationExtension", {
|
|
57
|
+
state: () => F(),
|
|
56
58
|
getters: {
|
|
57
59
|
// ====================================================================
|
|
58
60
|
// Proxy Getters — Backward Compatible Access to Current Block State
|
|
@@ -94,9 +96,17 @@ const y = () => ({
|
|
|
94
96
|
hasFilters() {
|
|
95
97
|
return !!this.recommendationConfigs.filters.length;
|
|
96
98
|
},
|
|
99
|
+
hasValidFilters() {
|
|
100
|
+
const { filters: t } = this.recommendationConfigs;
|
|
101
|
+
return t.length ? t.every((r) => r.isValid) : !1;
|
|
102
|
+
},
|
|
97
103
|
getFilterGroupCount() {
|
|
98
104
|
const { filters: t } = this.recommendationConfigs;
|
|
99
|
-
return t.length
|
|
105
|
+
return t.length ? new Set(t.map((r) => r.filterGroup)).size : 0;
|
|
106
|
+
},
|
|
107
|
+
getUniqueFilterGroups() {
|
|
108
|
+
const { filters: t } = this.recommendationConfigs;
|
|
109
|
+
return [...new Set(t.map((r) => r.filterGroup))].sort((r, e) => r - e);
|
|
100
110
|
},
|
|
101
111
|
getActivePredictiveAlgorithms: (t) => {
|
|
102
112
|
const r = [];
|
|
@@ -117,7 +127,7 @@ const y = () => ({
|
|
|
117
127
|
})),
|
|
118
128
|
getFilterList() {
|
|
119
129
|
return Object.values(this.filterList).map((t) => {
|
|
120
|
-
const r = t.type === "defaultAttribute", e =
|
|
130
|
+
const r = t.type === "defaultAttribute", e = p.includes(t.attributeName);
|
|
121
131
|
let n = r ? t.attributeName : `product_attributes.${t.attributeName}`;
|
|
122
132
|
return n = e ? `${n}.${this.recommendationConfigs.currencySettings.value}` : n, {
|
|
123
133
|
text: t.displayName,
|
|
@@ -141,7 +151,7 @@ const y = () => ({
|
|
|
141
151
|
setCurrentBlock(t) {
|
|
142
152
|
this.blockStates[t] || (this.blockStates = {
|
|
143
153
|
...this.blockStates,
|
|
144
|
-
[t]:
|
|
154
|
+
[t]: G()
|
|
145
155
|
}), this.currentRecommendationId = t;
|
|
146
156
|
},
|
|
147
157
|
/**
|
|
@@ -181,33 +191,56 @@ const y = () => ({
|
|
|
181
191
|
const { triggerRefetch: n = !0 } = r;
|
|
182
192
|
n && this.configVersion++;
|
|
183
193
|
},
|
|
194
|
+
/**
|
|
195
|
+
* Creates a filter with the first available attribute and operator pre-selected.
|
|
196
|
+
*/
|
|
197
|
+
createDefaultFilter(t, r) {
|
|
198
|
+
const [e] = this.getFilterList, [n] = S(e == null ? void 0 : e.type);
|
|
199
|
+
return {
|
|
200
|
+
type: "standardFilter",
|
|
201
|
+
attribute: (e == null ? void 0 : e.value) ?? "",
|
|
202
|
+
operator: (n == null ? void 0 : n.value) ?? "",
|
|
203
|
+
innerGroupOperator: "*",
|
|
204
|
+
outerGroupOperator: "*",
|
|
205
|
+
filterNumber: r,
|
|
206
|
+
filterGroup: t,
|
|
207
|
+
isValid: !1,
|
|
208
|
+
value: ""
|
|
209
|
+
};
|
|
210
|
+
},
|
|
184
211
|
/**
|
|
185
212
|
* Opens the filter selection drawer for the current block.
|
|
186
|
-
*
|
|
213
|
+
* Saves a snapshot of current filters for cancel/revert.
|
|
214
|
+
* If no filters exist, initializes with a default filter
|
|
187
215
|
* so the user has a starting point for input.
|
|
188
216
|
*/
|
|
189
217
|
openFilterDrawer() {
|
|
190
218
|
if (this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])
|
|
191
219
|
return;
|
|
192
220
|
const t = this.blockStates[this.currentRecommendationId];
|
|
193
|
-
t.
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
operatorReplace: "",
|
|
197
|
-
operator: "",
|
|
198
|
-
innerGroupOperator: "*",
|
|
199
|
-
outerGroupOperator: "*",
|
|
200
|
-
filterNumber: 1,
|
|
201
|
-
filterGroup: 1,
|
|
202
|
-
isValid: !1,
|
|
203
|
-
value: ""
|
|
204
|
-
}]), t.filterSelectionDrawerStatus = !0;
|
|
221
|
+
t.filterSnapshot = JSON.parse(
|
|
222
|
+
JSON.stringify(t.recommendationConfigs.filters)
|
|
223
|
+
), t.recommendationConfigs.filters.length || (t.recommendationConfigs.filters = [this.createDefaultFilter(1, 1)]), t.filterSelectionDrawerStatus = !0;
|
|
205
224
|
},
|
|
206
225
|
/**
|
|
207
|
-
* Closes the filter selection drawer for the current block
|
|
226
|
+
* Closes the filter selection drawer for the current block.
|
|
227
|
+
* Called after successful apply — discards the snapshot.
|
|
208
228
|
*/
|
|
209
229
|
closeFilterDrawer() {
|
|
210
|
-
this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId]
|
|
230
|
+
if (this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])
|
|
231
|
+
return;
|
|
232
|
+
const t = this.blockStates[this.currentRecommendationId];
|
|
233
|
+
t.filterSnapshot = null, t.filterSelectionDrawerStatus = !1;
|
|
234
|
+
},
|
|
235
|
+
/**
|
|
236
|
+
* Cancels the filter selection drawer and reverts filters
|
|
237
|
+
* to the snapshot taken when the drawer was opened.
|
|
238
|
+
*/
|
|
239
|
+
cancelFilterDrawer() {
|
|
240
|
+
if (this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])
|
|
241
|
+
return;
|
|
242
|
+
const t = this.blockStates[this.currentRecommendationId];
|
|
243
|
+
t.filterSnapshot !== null && (t.recommendationConfigs.filters = t.filterSnapshot, t.filterSnapshot = null), t.filterSelectionDrawerStatus = !1;
|
|
211
244
|
},
|
|
212
245
|
// ====================================================================
|
|
213
246
|
// Shared Data Fetching (fetched once, used by all blocks)
|
|
@@ -234,18 +267,18 @@ const y = () => ({
|
|
|
234
267
|
// Per-Block Filter Actions
|
|
235
268
|
// ====================================================================
|
|
236
269
|
addFilterGroup(t) {
|
|
237
|
-
this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId] || this.blockStates[this.currentRecommendationId].recommendationConfigs.filters.push(
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
filterGroup:
|
|
248
|
-
});
|
|
270
|
+
this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId] || this.blockStates[this.currentRecommendationId].recommendationConfigs.filters.push(
|
|
271
|
+
this.createDefaultFilter(t, 1)
|
|
272
|
+
);
|
|
273
|
+
},
|
|
274
|
+
deleteFilterGroup(t) {
|
|
275
|
+
if (this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])
|
|
276
|
+
return;
|
|
277
|
+
const r = this.blockStates[this.currentRecommendationId], e = r.recommendationConfigs.filters.filter((i) => i.filterGroup !== t), n = [...new Set(e.map((i) => i.filterGroup))].sort((i, o) => i - o), s = new Map(n.map((i, o) => [i, o + 1]));
|
|
278
|
+
r.recommendationConfigs.filters = e.map((i) => ({
|
|
279
|
+
...i,
|
|
280
|
+
filterGroup: s.get(i.filterGroup) ?? i.filterGroup
|
|
281
|
+
}));
|
|
249
282
|
},
|
|
250
283
|
updateFilter(t) {
|
|
251
284
|
if (this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])
|
|
@@ -253,7 +286,10 @@ const y = () => ({
|
|
|
253
286
|
const r = this.blockStates[this.currentRecommendationId], e = r.recommendationConfigs.filters.findIndex((n) => n.filterNumber === t.filterNumber && n.filterGroup === t.filterGroup);
|
|
254
287
|
if (e !== -1) {
|
|
255
288
|
const n = [...r.recommendationConfigs.filters];
|
|
256
|
-
n[e] =
|
|
289
|
+
n[e] = {
|
|
290
|
+
...t,
|
|
291
|
+
isValid: y(t)
|
|
292
|
+
}, r.recommendationConfigs.filters = n;
|
|
257
293
|
}
|
|
258
294
|
},
|
|
259
295
|
deleteFilter(t) {
|
|
@@ -268,15 +304,15 @@ const y = () => ({
|
|
|
268
304
|
addFilter(t) {
|
|
269
305
|
if (this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])
|
|
270
306
|
return;
|
|
271
|
-
const r = this.blockStates[this.currentRecommendationId], e = [...r.recommendationConfigs.filters],
|
|
272
|
-
(
|
|
273
|
-
).length + 1,
|
|
274
|
-
|
|
307
|
+
const r = this.blockStates[this.currentRecommendationId], e = [...r.recommendationConfigs.filters], s = e.filter(
|
|
308
|
+
(o) => o.filterGroup === t.filterGroup
|
|
309
|
+
).length + 1, i = e.findLastIndex((o) => o.filterGroup === t.filterGroup);
|
|
310
|
+
i !== -1 ? e.splice(i + 1, 0, {
|
|
275
311
|
...t,
|
|
276
|
-
filterNumber:
|
|
312
|
+
filterNumber: s
|
|
277
313
|
}) : e.push({
|
|
278
314
|
...t,
|
|
279
|
-
filterNumber:
|
|
315
|
+
filterNumber: s
|
|
280
316
|
}), r.recommendationConfigs.filters = e;
|
|
281
317
|
},
|
|
282
318
|
generateFilterQuery() {
|
|
@@ -289,26 +325,26 @@ const y = () => ({
|
|
|
289
325
|
var u;
|
|
290
326
|
if (this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])
|
|
291
327
|
return;
|
|
292
|
-
const t = this.currentRecommendationId, r = this.blockStates[t], { recommendationConfigs: e } = r, n = e.filters.filter((l) => l.isValid),
|
|
328
|
+
const t = this.currentRecommendationId, r = this.blockStates[t], { recommendationConfigs: e } = r, n = e.filters.filter((l) => l.isValid), s = f(n), i = ((u = d.find((l) => l.key === e.strategy)) == null ? void 0 : u.path) || "", o = I(), c = {
|
|
293
329
|
locale: e.language,
|
|
294
330
|
currency: e.currencySettings.value,
|
|
295
|
-
partnerName:
|
|
331
|
+
partnerName: o.partnerName,
|
|
296
332
|
size: e.size,
|
|
297
333
|
details: !0,
|
|
298
|
-
campaignId:
|
|
334
|
+
campaignId: o.variationId
|
|
299
335
|
};
|
|
300
|
-
e.strategy === "manualMerchandising" ? c.productId = e.productIds.join(",") : e.strategy === "similarViewed" && (c.productId = "{itemId}"),
|
|
336
|
+
e.strategy === "manualMerchandising" ? c.productId = e.productIds.join(",") : e.strategy === "similarViewed" && (c.productId = "{itemId}"), s && (c.filter = s), e.shuffleProducts && (c.shuffle = !0);
|
|
301
337
|
const g = parseInt(e.size) || 6;
|
|
302
338
|
let a;
|
|
303
339
|
try {
|
|
304
|
-
a = await m.fetchRecommendationProducts(
|
|
340
|
+
a = await m.fetchRecommendationProducts(i, c);
|
|
305
341
|
} catch {
|
|
306
342
|
a = [];
|
|
307
343
|
}
|
|
308
|
-
this.blockStates[t] && (this.blockStates[t].recommendationProducts = a.length > 0 ? a :
|
|
344
|
+
this.blockStates[t] && (this.blockStates[t].recommendationProducts = a.length > 0 ? a : C(g));
|
|
309
345
|
}
|
|
310
346
|
}
|
|
311
347
|
});
|
|
312
348
|
export {
|
|
313
|
-
|
|
349
|
+
V as useRecommendationExtensionStore
|
|
314
350
|
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
function l(t) {
|
|
2
2
|
if (t.length === 0)
|
|
3
3
|
return "";
|
|
4
|
-
const o = t.sort((r, e) => r.filterNumber - e.filterNumber), n = o.map((r) => `[${r.attribute}][${r.
|
|
5
|
-
let u =
|
|
6
|
-
for (let r = 0; r <
|
|
7
|
-
const e = o[r
|
|
8
|
-
u += `${e}${
|
|
4
|
+
const o = t.sort((r, e) => r.filterNumber - e.filterNumber), n = o.map((r) => `[${r.attribute}][${r.operator}][${r.value}]`), [p, ...i] = n;
|
|
5
|
+
let u = p;
|
|
6
|
+
for (let r = 0; r < i.length; r++) {
|
|
7
|
+
const e = o[r].innerGroupOperator;
|
|
8
|
+
u += `${e}${i[r]}`;
|
|
9
9
|
}
|
|
10
10
|
return `(${u})`;
|
|
11
11
|
}
|
|
12
12
|
function f(t) {
|
|
13
13
|
if (!t || t.length === 0)
|
|
14
14
|
return "";
|
|
15
|
-
const o = t.reduce((r, e) => (r[e.filterGroup] || (r[e.filterGroup] = []), r[e.filterGroup].push(e), r), {}), n = Object.keys(o).map(Number).sort((r, e) => r - e),
|
|
15
|
+
const o = t.reduce((r, e) => (r[e.filterGroup] || (r[e.filterGroup] = []), r[e.filterGroup].push(e), r), {}), n = Object.keys(o).map(Number).sort((r, e) => r - e), p = n.map((r) => {
|
|
16
16
|
const e = o[r];
|
|
17
17
|
return l(e);
|
|
18
|
-
}), [
|
|
19
|
-
let s =
|
|
18
|
+
}), [i, ...u] = p;
|
|
19
|
+
let s = i;
|
|
20
20
|
for (let r = 0; r < u.length; r++) {
|
|
21
21
|
const e = n[r + 1], c = o[e][0].outerGroupOperator;
|
|
22
22
|
s += `${c}${u[r]}`;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { safeParse as o, object as p, boolean as l, number as i, pipe as c, minLength as f, string as m } from "../../../../node_modules/valibot/dist/index.js";
|
|
2
|
+
const e = c(m(), f(1)), s = p({
|
|
3
|
+
type: e,
|
|
4
|
+
attribute: e,
|
|
5
|
+
operator: e,
|
|
6
|
+
innerGroupOperator: e,
|
|
7
|
+
outerGroupOperator: e,
|
|
8
|
+
value: e,
|
|
9
|
+
filterGroup: i(),
|
|
10
|
+
filterNumber: i(),
|
|
11
|
+
isValid: l()
|
|
12
|
+
});
|
|
13
|
+
function g(t) {
|
|
14
|
+
return o(s, t).success;
|
|
15
|
+
}
|
|
16
|
+
function S(t) {
|
|
17
|
+
const r = o(s, t);
|
|
18
|
+
return r.success ? /* @__PURE__ */ new Set() : new Set(
|
|
19
|
+
r.issues.flatMap((u) => {
|
|
20
|
+
var n;
|
|
21
|
+
return ((n = u.path) == null ? void 0 : n.map((a) => String(a.key))) ?? [];
|
|
22
|
+
})
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
s as FilterSchema,
|
|
27
|
+
S as getInvalidFilterFields,
|
|
28
|
+
g as isFilterValid
|
|
29
|
+
};
|
package/dist/guido.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.gap-16[data-v-
|
|
1
|
+
.gap-16[data-v-3b53a736],.gap-16[data-v-c5dee797]{gap:16px}[data-v-cd76c125] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-913a3417] .in-progress-wrapper__progress p span:last-child{display:none!important}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-64c52560]{gap:8px}.version-history__toolbar[data-v-64c52560]{gap:4px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.editor-actions[data-v-17dd4d8b]{gap:4px}.header-wrapper[data-v-5c02dcc7]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-16abb398]{position:relative;width:100%;height:calc(100vh - 128px)}.guido-editor__container[data-v-16abb398]{width:100%;height:calc(100vh - 128px)}.guido-editor__no-header[data-v-16abb398]{height:calc(100vh - 75px)}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-a86fc486]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-a86fc486]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-a86fc486]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-a86fc486]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-a86fc486]{object-fit:cover;transform:scale(1)}[data-v-43c617a7] .guido__verion-history-view-option-selection-desktop svg,[data-v-43c617a7] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-43c617a7] .in-segments-wrapper__button_selected,[data-v-43c617a7] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-c3fd5d4b]{gap:16px}.desktop-browser-header[data-v-d86c5af5]{height:79px;min-height:79px}.desktop-browser-header__left[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:378px}.desktop-browser-header__center[data-v-d86c5af5]{height:79px;background-repeat:repeat-x;background-size:auto 100%;background-position:left top}.desktop-browser-header__right[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:112px}.desktop-preview[data-v-988f8da6]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-988f8da6]{min-height:504px}.iframe-wrapper[data-v-e0424e99]{width:258px}.iframe-scaled[data-v-e0424e99]{width:320px;height:124.0310077519%;transform:scale(.80625);transform-origin:top left}.cropped-text[data-v-eb3d05d7]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-preview-wrapper__phone[data-v-3f472f96]{width:282px}.mobile-preview-wrapper__phone img[data-v-3f472f96]{object-fit:cover;border-radius:44px}.mobile-preview-wrapper__content[data-v-3f472f96]{width:258px;height:450px;left:12px}[data-v-d3c52b44] .vueperslides__bullets,[data-v-dd1a237a] .vueperslides__bullets{pointer-events:none!important}[data-v-dd1a237a] .vueperslides__parallax-wrapper{height:110px!important}[data-v-a408dcea] .vueperslides__bullets{pointer-events:none!important}[data-v-a408dcea] .vueperslides__parallax-wrapper{height:110px!important}
|
|
@@ -1,44 +1,47 @@
|
|
|
1
|
-
import { useHttp as
|
|
2
|
-
import { useToaster as
|
|
3
|
-
import { MAX_DEFAULT_TEMPLATE_ID as
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { useHttp as l } from "../composables/useHttp.js";
|
|
2
|
+
import { useToaster as u } from "../composables/useToaster.js";
|
|
3
|
+
import { MAX_DEFAULT_TEMPLATE_ID as d } from "../enums/defaults.js";
|
|
4
|
+
import f from "../static/templates/empty/index.html.js";
|
|
5
|
+
import g from "../static/templates/empty/style.css.js";
|
|
6
|
+
const D = () => {
|
|
7
|
+
const { get: o } = l(), { handleError: a } = u();
|
|
6
8
|
return {
|
|
7
9
|
getToken: async () => {
|
|
8
10
|
try {
|
|
9
|
-
const t = Number(localStorage.getItem("ins-guido-test-instance")), { data: e } = await
|
|
11
|
+
const t = Number(localStorage.getItem("ins-guido-test-instance")), { data: e } = await o(`/stripo/get-user-token?test=${t}`);
|
|
10
12
|
return e.body.token;
|
|
11
13
|
} catch (t) {
|
|
12
|
-
return
|
|
14
|
+
return a(t, "Failed to fetch token"), "";
|
|
13
15
|
}
|
|
14
16
|
},
|
|
15
17
|
getCustomFonts: async () => {
|
|
16
18
|
try {
|
|
17
|
-
const { data: t = [] } = await
|
|
19
|
+
const { data: t = [] } = await o("/stripo/get-partner-custom-fonts");
|
|
18
20
|
return t.map((e) => ({
|
|
19
21
|
...e,
|
|
20
22
|
active: !0
|
|
21
23
|
}));
|
|
22
24
|
} catch (t) {
|
|
23
|
-
return
|
|
25
|
+
return a(t, "Failed to fetch custom fonts"), [];
|
|
24
26
|
}
|
|
25
27
|
},
|
|
26
28
|
getDefaultTemplate: async () => {
|
|
27
29
|
const t = {
|
|
28
|
-
html:
|
|
29
|
-
css:
|
|
30
|
+
html: f,
|
|
31
|
+
css: g
|
|
30
32
|
};
|
|
31
33
|
try {
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
const e = new URLSearchParams(window.location.search), c = e.get("default-template"), p = e.get("master"), s = c ? parseInt(c) : 0, m = s >= 1 && s <= d ? s : 0;
|
|
35
|
+
if (!m && !p)
|
|
36
|
+
return t;
|
|
37
|
+
const i = `/stripo/default-template/${m}`, { data: n } = await o(i), r = typeof n == "string" ? JSON.parse(n) : n;
|
|
38
|
+
return !r || typeof r != "object" || !("html" in r) || !("css" in r) ? t : r;
|
|
36
39
|
} catch (e) {
|
|
37
|
-
return
|
|
40
|
+
return a(e, "Failed to fetch default template"), t;
|
|
38
41
|
}
|
|
39
42
|
}
|
|
40
43
|
};
|
|
41
44
|
};
|
|
42
45
|
export {
|
|
43
|
-
|
|
46
|
+
D as useStripoApi
|
|
44
47
|
};
|
|
@@ -3,6 +3,7 @@ type __VLS_Props = {
|
|
|
3
3
|
filter: Filter;
|
|
4
4
|
index: number;
|
|
5
5
|
hasLogicAdapter?: boolean;
|
|
6
|
+
submitted: boolean;
|
|
6
7
|
};
|
|
7
8
|
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {
|
|
8
9
|
"delete-filter": (filter: Filter) => void;
|
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
submitted: boolean;
|
|
3
|
+
};
|
|
4
|
+
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {
|
|
5
|
+
switchToGroup: (groupId: number) => void;
|
|
6
|
+
}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_Props>>>, {}>;
|
|
2
7
|
export default _default;
|
|
8
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
9
|
+
type __VLS_TypePropsToOption<T> = {
|
|
10
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
11
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
12
|
+
} : {
|
|
13
|
+
type: import('vue').PropType<T[K]>;
|
|
14
|
+
required: true;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -76,4 +76,9 @@ export declare class RecommendationBlockControl extends CommonControl {
|
|
|
76
76
|
* (e.g., fetchRecommendationCreateData setting preferred currency).
|
|
77
77
|
*/
|
|
78
78
|
_listenStateUpdates(): void;
|
|
79
|
+
/**
|
|
80
|
+
* Persists the current filter state from Pinia store to the Stripo node config.
|
|
81
|
+
* This ensures filters survive template save/reload cycles.
|
|
82
|
+
*/
|
|
83
|
+
private _persistFiltersToNodeConfig;
|
|
79
84
|
}
|
|
@@ -31,6 +31,8 @@ interface PerBlockState {
|
|
|
31
31
|
filterGroup: number;
|
|
32
32
|
/** Whether initial API data (filters, algorithms, products) has been fetched for this block */
|
|
33
33
|
isInitialized: boolean;
|
|
34
|
+
/** Snapshot of filters taken when the drawer opens, used to revert on cancel */
|
|
35
|
+
filterSnapshot: Filter[] | null;
|
|
34
36
|
}
|
|
35
37
|
interface StoreState {
|
|
36
38
|
recommendationCampaignUrls: Record<string, string>;
|
|
@@ -125,7 +127,9 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
|
|
|
125
127
|
configVersion: number;
|
|
126
128
|
} & import("pinia").PiniaCustomStateProperties<StoreState>): number;
|
|
127
129
|
hasFilters(): boolean;
|
|
130
|
+
hasValidFilters(): boolean;
|
|
128
131
|
getFilterGroupCount(): number;
|
|
132
|
+
getUniqueFilterGroups(): number[];
|
|
129
133
|
getActivePredictiveAlgorithms: (state: {
|
|
130
134
|
recommendationCampaignUrls: Record<string, string>;
|
|
131
135
|
activePredictiveAlgorithms: number[];
|
|
@@ -203,19 +207,31 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
|
|
|
203
207
|
patchCurrentBlockConfig(updates: Partial<PerBlockConfigs>, options?: {
|
|
204
208
|
triggerRefetch?: boolean;
|
|
205
209
|
}): void;
|
|
210
|
+
/**
|
|
211
|
+
* Creates a filter with the first available attribute and operator pre-selected.
|
|
212
|
+
*/
|
|
213
|
+
createDefaultFilter(filterGroup: number, filterNumber: number): Filter;
|
|
206
214
|
/**
|
|
207
215
|
* Opens the filter selection drawer for the current block.
|
|
208
|
-
*
|
|
216
|
+
* Saves a snapshot of current filters for cancel/revert.
|
|
217
|
+
* If no filters exist, initializes with a default filter
|
|
209
218
|
* so the user has a starting point for input.
|
|
210
219
|
*/
|
|
211
220
|
openFilterDrawer(): void;
|
|
212
221
|
/**
|
|
213
|
-
* Closes the filter selection drawer for the current block
|
|
222
|
+
* Closes the filter selection drawer for the current block.
|
|
223
|
+
* Called after successful apply — discards the snapshot.
|
|
214
224
|
*/
|
|
215
225
|
closeFilterDrawer(): void;
|
|
226
|
+
/**
|
|
227
|
+
* Cancels the filter selection drawer and reverts filters
|
|
228
|
+
* to the snapshot taken when the drawer was opened.
|
|
229
|
+
*/
|
|
230
|
+
cancelFilterDrawer(): void;
|
|
216
231
|
fetchRecommendationCreateData(): Promise<void>;
|
|
217
232
|
fetchRecommendationFilters(): Promise<void>;
|
|
218
233
|
addFilterGroup(filterGroup: number): void;
|
|
234
|
+
deleteFilterGroup(groupId: number): void;
|
|
219
235
|
updateFilter(updatedFilter: Filter): void;
|
|
220
236
|
deleteFilter(filter: Filter): void;
|
|
221
237
|
addFilter(filter: Filter): void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Filter } from '@@/Types/recommendation';
|
|
2
|
+
import * as v from 'valibot';
|
|
3
|
+
export declare const FilterSchema: v.ObjectSchema<{
|
|
4
|
+
readonly type: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
5
|
+
readonly attribute: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
6
|
+
readonly operator: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
7
|
+
readonly innerGroupOperator: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
8
|
+
readonly outerGroupOperator: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
9
|
+
readonly value: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>]>;
|
|
10
|
+
readonly filterGroup: v.NumberSchema<undefined>;
|
|
11
|
+
readonly filterNumber: v.NumberSchema<undefined>;
|
|
12
|
+
readonly isValid: v.BooleanSchema<undefined>;
|
|
13
|
+
}, undefined>;
|
|
14
|
+
export declare function isFilterValid(filter: Filter): boolean;
|
|
15
|
+
export declare function getInvalidFilterFields(filter: Filter): Set<string>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const t = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
2
|
+
<html>
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<meta content="width=device-width, initial-scale=1" name="viewport">
|
|
7
|
+
<meta name="x-apple-disable-message-reformatting">
|
|
8
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
9
|
+
<meta content="telephone=no" name="format-detection">
|
|
10
|
+
<title></title>
|
|
11
|
+
<!--[if (mso 16)]><style type="text/css">a{text-decoration:none}</style><![endif]-->
|
|
12
|
+
<!--[if gte mso 9]><style>sup{font-size:100% !important}</style><![endif]-->
|
|
13
|
+
<!--[if gte mso 9]><style>sup{font-size:100% !important}</style><![endif]-->
|
|
14
|
+
<!--[if gte mso 9]><style>sup{font-size:100% !important}</style><![endif]-->
|
|
15
|
+
<!--[if gte mso 9]><style>sup{font-size:100% !important}</style><![endif]-->
|
|
16
|
+
<!--[if gte mso 9]><style>sup { font-size: 100% !important; }</style><![endif]-->
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
<div class="es-wrapper-color">
|
|
21
|
+
<!--[if gte mso 9]>
|
|
22
|
+
<v:background xmlns:v="urn:schemas-microsoft-com:vml" fill="t">
|
|
23
|
+
<v:fill type="tile" color="#f6f6f6"></v:fill>
|
|
24
|
+
</v:background>
|
|
25
|
+
<![endif]-->
|
|
26
|
+
<table class="es-wrapper" width="100%" cellspacing="0" cellpadding="0">
|
|
27
|
+
<tbody>
|
|
28
|
+
<tr>
|
|
29
|
+
<td class="esd-email-paddings" valign="top">
|
|
30
|
+
<table class="es-content esd-footer-popover" cellspacing="0" cellpadding="0" align="center">
|
|
31
|
+
<tbody>
|
|
32
|
+
<tr>
|
|
33
|
+
<td class="esd-stripe" align="center">
|
|
34
|
+
<table class="es-content-body" width="600" cellspacing="0" cellpadding="0" bgcolor="#ffffff" align="center">
|
|
35
|
+
<tbody>
|
|
36
|
+
<tr>
|
|
37
|
+
<td class="esd-structure es-p20" align="left">
|
|
38
|
+
<table cellpadding="0" cellspacing="0" width="100%">
|
|
39
|
+
<tbody>
|
|
40
|
+
<tr>
|
|
41
|
+
<td width="560" class="esd-container-frame" align="center" valign="top">
|
|
42
|
+
<table cellpadding="0" cellspacing="0" width="100%">
|
|
43
|
+
<tbody>
|
|
44
|
+
<tr>
|
|
45
|
+
<td align="center" class="esd-empty-container" style="display: none;"></td>
|
|
46
|
+
</tr>
|
|
47
|
+
</tbody>
|
|
48
|
+
</table>
|
|
49
|
+
</td>
|
|
50
|
+
</tr>
|
|
51
|
+
</tbody>
|
|
52
|
+
</table>
|
|
53
|
+
</td>
|
|
54
|
+
</tr>
|
|
55
|
+
</tbody>
|
|
56
|
+
</table>
|
|
57
|
+
</td>
|
|
58
|
+
</tr>
|
|
59
|
+
</tbody>
|
|
60
|
+
</table>
|
|
61
|
+
</td>
|
|
62
|
+
</tr>
|
|
63
|
+
</tbody>
|
|
64
|
+
</table>
|
|
65
|
+
</div>
|
|
66
|
+
<div style="position: absolute; left: -9999px; top: -9999px; margin: 0px;"></div>
|
|
67
|
+
<div style="position: absolute; left: -9999px; top: -9999px; margin: 0px; padding: 0px; border: 0px none; width: 1px;"></div>
|
|
68
|
+
</body>
|
|
69
|
+
|
|
70
|
+
</html>
|
|
71
|
+
`;
|
|
72
|
+
export {
|
|
73
|
+
t as default
|
|
74
|
+
};
|