@useinsider/guido 3.4.2-beta.6886b92 → 3.5.0-beta.b7a6d77
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/README.md +2 -0
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +50 -48
- package/dist/components/organisms/extensions/recommendation/FilterItem.vue.js +2 -2
- package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +49 -49
- package/dist/composables/useActionsApi.js +9 -5
- package/dist/composables/useRecommendation.js +34 -33
- package/dist/composables/useSave.js +13 -14
- package/dist/extensions/Blocks/Recommendation/block.js +90 -45
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +40 -17
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +24 -16
- package/dist/extensions/Blocks/Recommendation/utils/partnerCustomizations.js +21 -0
- package/dist/extensions/Blocks/Unsubscribe/block.js +133 -49
- package/dist/extensions/Blocks/Unsubscribe/template.js +8 -8
- package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +2 -1
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +145 -144
- package/dist/src/composables/useActionsApi.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/filterUtil.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/partnerCustomizations.d.ts +7 -0
- package/dist/src/extensions/Blocks/Unsubscribe/block.d.ts +20 -1
- package/dist/src/extensions/Blocks/Unsubscribe/utils/constants.d.ts +1 -0
- package/dist/src/stores/config.test.d.ts +1 -0
- package/dist/src/vitest.setup.d.ts +0 -0
- package/dist/stores/config.js +24 -23
- package/dist/utils/templatePreparation.js +51 -43
- package/package.json +3 -2
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { BlockId as
|
|
1
|
+
var B = Object.defineProperty;
|
|
2
|
+
var C = (a, s, t) => s in a ? B(a, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[s] = t;
|
|
3
|
+
var p = (a, s, t) => C(a, typeof s != "symbol" ? s + "" : s, t);
|
|
4
|
+
import { BlockId as R } from "../../../enums/block.js";
|
|
5
5
|
import { getMigrationBannerHtml as b } from "../../../utils/migrationBannerHtml.js";
|
|
6
|
-
import { Block as
|
|
7
|
-
import { regenerateMobileProductRows as
|
|
8
|
-
import { ensureMobileCssRulesExist as
|
|
9
|
-
import { RecommendationConfigService as
|
|
10
|
-
import { useRecommendationExtensionStore as
|
|
11
|
-
import { getDefaultTemplate as
|
|
12
|
-
const
|
|
13
|
-
let
|
|
14
|
-
class q extends
|
|
6
|
+
import { Block as A, BlockCompositionType as y, ModificationDescription as f } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
7
|
+
import { regenerateMobileProductRows as D } from "./controls/main/utils.js";
|
|
8
|
+
import { ensureMobileCssRulesExist as h, setMobileLayoutOptOut as I, hasMobileLayoutOptOut as E } from "./controls/mobileLayout/cssRules.js";
|
|
9
|
+
import { RecommendationConfigService as c } from "./services/configService.js";
|
|
10
|
+
import { useRecommendationExtensionStore as g } from "./store/recommendation.js";
|
|
11
|
+
import { getDefaultTemplate as N } from "./templates/grid/template.js";
|
|
12
|
+
const k = R.Recommendation, m = "recommendation-block-v2", u = "recommendation-id";
|
|
13
|
+
let _ = !1;
|
|
14
|
+
class q extends A {
|
|
15
15
|
constructor() {
|
|
16
16
|
super();
|
|
17
17
|
/**
|
|
18
18
|
* Stores the ID generated in getTemplate() so onCreated() can reuse it.
|
|
19
19
|
* This avoids generating a new (different) ID in onCreated().
|
|
20
20
|
*/
|
|
21
|
-
|
|
21
|
+
p(this, "_pendingBlockId", null);
|
|
22
22
|
}
|
|
23
23
|
getId() {
|
|
24
|
-
return
|
|
24
|
+
return k;
|
|
25
25
|
}
|
|
26
26
|
getIcon() {
|
|
27
27
|
return "recommendation-icon";
|
|
@@ -39,7 +39,7 @@ class q extends R {
|
|
|
39
39
|
}
|
|
40
40
|
getSettingsPanelTitleHtml() {
|
|
41
41
|
return b(
|
|
42
|
-
|
|
42
|
+
k,
|
|
43
43
|
this.api.translate("Recommendation Block"),
|
|
44
44
|
this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.")
|
|
45
45
|
);
|
|
@@ -59,7 +59,7 @@ class q extends R {
|
|
|
59
59
|
*/
|
|
60
60
|
getTemplate() {
|
|
61
61
|
const t = this._generateNextId();
|
|
62
|
-
return this._pendingBlockId = t,
|
|
62
|
+
return this._pendingBlockId = t, N(t);
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
65
|
* Called when a new block is dropped into the template
|
|
@@ -70,24 +70,26 @@ class q extends R {
|
|
|
70
70
|
*/
|
|
71
71
|
onCreated(t) {
|
|
72
72
|
const e = this._getRecommendationId(t);
|
|
73
|
-
if (e !== null && e > 0)
|
|
73
|
+
if (e !== null && e > 0) {
|
|
74
|
+
this._detectDuplicate(e) && this._handleDuplicate(t, e);
|
|
74
75
|
return;
|
|
76
|
+
}
|
|
75
77
|
const i = this._pendingBlockId ?? this._generateNextId();
|
|
76
78
|
this._pendingBlockId = null, this._assignRecommendationId(t, i);
|
|
77
|
-
const { config:
|
|
79
|
+
const { config: n, wasFreshDrop: o } = c.initializeConfig(
|
|
78
80
|
this.api,
|
|
79
81
|
t,
|
|
80
82
|
{ recommendationId: i }
|
|
81
|
-
),
|
|
82
|
-
if (
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
|
|
83
|
+
), r = g();
|
|
84
|
+
if (r.setCurrentBlock(i), o) {
|
|
85
|
+
h(this.api);
|
|
86
|
+
const l = this._getBlockElement(t);
|
|
87
|
+
l && (I(this.api, l, !0), D({
|
|
86
88
|
currentNode: t,
|
|
87
89
|
documentModifier: this.api.getDocumentModifier()
|
|
88
90
|
}));
|
|
89
91
|
}
|
|
90
|
-
|
|
92
|
+
r.patchCurrentBlockConfig({ language: n.language }, { triggerRefetch: !1 });
|
|
91
93
|
}
|
|
92
94
|
/**
|
|
93
95
|
* Called when the document changes or template is loaded
|
|
@@ -100,20 +102,20 @@ class q extends R {
|
|
|
100
102
|
if (!(!t || !("getNodeConfig" in t))) {
|
|
101
103
|
if (!this._getRecommendationId(t)) {
|
|
102
104
|
const e = this._generateNextId();
|
|
103
|
-
this._assignRecommendationId(t, e),
|
|
105
|
+
this._assignRecommendationId(t, e), c.hasConfig(t) && c.updateConfig(
|
|
104
106
|
this.api,
|
|
105
107
|
t,
|
|
106
108
|
{ recommendationId: e },
|
|
107
109
|
"Assign recommendation ID to legacy block"
|
|
108
110
|
);
|
|
109
111
|
}
|
|
110
|
-
|
|
112
|
+
c.needsMigration(t) && this._migrateFromLegacy(t);
|
|
111
113
|
try {
|
|
112
|
-
|
|
113
|
-
const e =
|
|
114
|
+
_ || (h(this.api), _ = !0);
|
|
115
|
+
const e = c.getConfig(t), i = this._getBlockElement(t);
|
|
114
116
|
if (i) {
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
+
const n = !e.mobileLayoutEnabled;
|
|
118
|
+
E(i) !== n && I(this.api, i, n);
|
|
117
119
|
}
|
|
118
120
|
} catch {
|
|
119
121
|
}
|
|
@@ -127,7 +129,7 @@ class q extends R {
|
|
|
127
129
|
*/
|
|
128
130
|
onDelete(t) {
|
|
129
131
|
const e = this._getRecommendationId(t);
|
|
130
|
-
e &&
|
|
132
|
+
e && g().removeBlockState(e);
|
|
131
133
|
}
|
|
132
134
|
/**
|
|
133
135
|
* Generates the next unique recommendation ID by scanning all existing blocks
|
|
@@ -137,16 +139,59 @@ class q extends R {
|
|
|
137
139
|
let t = 0;
|
|
138
140
|
try {
|
|
139
141
|
const e = this.api.getDocumentRoot();
|
|
140
|
-
e && "querySelectorAll" in e && e.querySelectorAll(`.${
|
|
141
|
-
if ("getAttribute" in
|
|
142
|
-
const
|
|
143
|
-
|
|
142
|
+
e && "querySelectorAll" in e && e.querySelectorAll(`.${m}`).forEach((n) => {
|
|
143
|
+
if ("getAttribute" in n) {
|
|
144
|
+
const o = n.getAttribute(u), r = o ? parseInt(o) : 0;
|
|
145
|
+
r > t && (t = r);
|
|
144
146
|
}
|
|
145
147
|
});
|
|
146
148
|
} catch {
|
|
147
149
|
}
|
|
148
150
|
return t + 1;
|
|
149
151
|
}
|
|
152
|
+
/** True when another block already holds the same id — Stripo's duplication signal. */
|
|
153
|
+
_detectDuplicate(t) {
|
|
154
|
+
try {
|
|
155
|
+
const e = this.api.getDocumentRoot();
|
|
156
|
+
if (e && "querySelectorAll" in e)
|
|
157
|
+
return e.querySelectorAll(
|
|
158
|
+
`.${m}[${u}="${t}"]`
|
|
159
|
+
).length > 1;
|
|
160
|
+
} catch {
|
|
161
|
+
}
|
|
162
|
+
return !1;
|
|
163
|
+
}
|
|
164
|
+
/** Assigns a fresh id to a duplicated block and syncs DOM, node config and store. */
|
|
165
|
+
_handleDuplicate(t, e) {
|
|
166
|
+
const i = this._generateNextId(), n = this._getBlockElement(t);
|
|
167
|
+
this._assignRecommendationId(t, i), n && this._reassignInstanceClass(n, e, i), c.hasConfig(t) && c.updateConfig(
|
|
168
|
+
this.api,
|
|
169
|
+
t,
|
|
170
|
+
{ recommendationId: i },
|
|
171
|
+
`Reassign recommendation ID on duplicate (was ${e})`
|
|
172
|
+
);
|
|
173
|
+
const o = g();
|
|
174
|
+
o.cloneBlockState(e, i), o.setCurrentBlock(i);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Rewrites `ins-recommendation-v3-block-{id}` on the clone — the instance
|
|
178
|
+
* class scopes per-block CSS rules, so leaving the source's class would
|
|
179
|
+
* make stylistic edits leak between source and clone.
|
|
180
|
+
*/
|
|
181
|
+
_reassignInstanceClass(t, e, i) {
|
|
182
|
+
if (!("getAttribute" in t))
|
|
183
|
+
return;
|
|
184
|
+
const n = t.getAttribute("class");
|
|
185
|
+
if (!n)
|
|
186
|
+
return;
|
|
187
|
+
const o = `ins-recommendation-v3-block-${e}`, r = `ins-recommendation-v3-block-${i}`;
|
|
188
|
+
if (!n.includes(o))
|
|
189
|
+
return;
|
|
190
|
+
const l = n.replace(o, r), d = this.api.getDocumentModifier();
|
|
191
|
+
d.modifyHtml(t).setAttribute("class", l), d.apply(new f(
|
|
192
|
+
`Reassign recommendation instance class ${o} -> ${r}`
|
|
193
|
+
));
|
|
194
|
+
}
|
|
150
195
|
/**
|
|
151
196
|
* Assigns a recommendation-id attribute to the block element.
|
|
152
197
|
* The instance class (ins-recommendation-v3-block-{id}) is embedded in the template
|
|
@@ -157,8 +202,8 @@ class q extends R {
|
|
|
157
202
|
const i = this._getBlockElement(t);
|
|
158
203
|
if (!i)
|
|
159
204
|
return;
|
|
160
|
-
const
|
|
161
|
-
|
|
205
|
+
const n = this.api.getDocumentModifier();
|
|
206
|
+
n.modifyHtml(i).setAttribute(u, e.toString()), n.apply(new f(`Assign recommendation ID ${e}`));
|
|
162
207
|
}
|
|
163
208
|
/**
|
|
164
209
|
* Gets the recommendation-id from a block node
|
|
@@ -167,11 +212,11 @@ class q extends R {
|
|
|
167
212
|
const e = this._getBlockElement(t);
|
|
168
213
|
if (!e || !("getAttribute" in e))
|
|
169
214
|
return null;
|
|
170
|
-
const i = e.getAttribute(
|
|
215
|
+
const i = e.getAttribute(u);
|
|
171
216
|
if (!i)
|
|
172
217
|
return null;
|
|
173
|
-
const
|
|
174
|
-
return Number.isNaN(
|
|
218
|
+
const n = parseInt(i);
|
|
219
|
+
return Number.isNaN(n) ? null : n;
|
|
175
220
|
}
|
|
176
221
|
/**
|
|
177
222
|
* Gets the block element (the element with BLOCK_CLASS)
|
|
@@ -179,19 +224,19 @@ class q extends R {
|
|
|
179
224
|
_getBlockElement(t) {
|
|
180
225
|
if ("getAttribute" in t) {
|
|
181
226
|
const e = t.getAttribute("class");
|
|
182
|
-
if (e && e.includes(
|
|
227
|
+
if (e && e.includes(m))
|
|
183
228
|
return t;
|
|
184
229
|
}
|
|
185
|
-
return "querySelector" in t ? t.querySelector(`.${
|
|
230
|
+
return "querySelector" in t ? t.querySelector(`.${m}`) ?? null : null;
|
|
186
231
|
}
|
|
187
232
|
/**
|
|
188
233
|
* Migrate configuration from legacy format
|
|
189
234
|
*/
|
|
190
235
|
_migrateFromLegacy(t) {
|
|
191
|
-
|
|
236
|
+
c.migrateFromDataAttributes(this.api, t);
|
|
192
237
|
}
|
|
193
238
|
}
|
|
194
239
|
export {
|
|
195
|
-
|
|
240
|
+
k as BLOCK_ID,
|
|
196
241
|
q as RecommendationBlock
|
|
197
242
|
};
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { getRecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAttributes as
|
|
2
|
-
import { useRecommendationApi as
|
|
1
|
+
import { getRecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAttributes as C } from "../../../../enums/extensions/recommendationBlock.js";
|
|
2
|
+
import { useRecommendationApi as y } from "../../../../services/recommendationApi.js";
|
|
3
3
|
import { useConfigStore as G } from "../../../../stores/config.js";
|
|
4
4
|
import { defineStore as P } from "pinia";
|
|
5
5
|
import { DEFAULT_CARDS_IN_ROW as F } from "../constants/layout.js";
|
|
6
6
|
import { EXCLUDED_ALGORITHM_IDS as D } 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
|
+
import { getPartnerRecommendationParams as v } from "../utils/partnerCustomizations.js";
|
|
9
10
|
import { isFilterValid as w } from "../validation/filterSchema.js";
|
|
10
|
-
import { isConfigValid as
|
|
11
|
-
const h =
|
|
11
|
+
import { isConfigValid as N } from "../validation/requiredFields.js";
|
|
12
|
+
const h = y();
|
|
12
13
|
let m = null, u = null, d = null;
|
|
13
|
-
function
|
|
14
|
+
function I() {
|
|
14
15
|
return {
|
|
15
16
|
cardsInRow: F,
|
|
16
17
|
currencySettings: {
|
|
@@ -38,9 +39,9 @@ function k() {
|
|
|
38
39
|
customAttributes: []
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
+
function k() {
|
|
42
43
|
return {
|
|
43
|
-
recommendationConfigs:
|
|
44
|
+
recommendationConfigs: I(),
|
|
44
45
|
recommendationProducts: [],
|
|
45
46
|
filterStatus: !1,
|
|
46
47
|
filterSelectionDrawerStatus: !1,
|
|
@@ -49,7 +50,7 @@ function I() {
|
|
|
49
50
|
filterSnapshot: null
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
|
-
const
|
|
53
|
+
const x = () => ({
|
|
53
54
|
recommendationCampaignUrls: {},
|
|
54
55
|
activePredictiveAlgorithms: [],
|
|
55
56
|
languages: {},
|
|
@@ -58,8 +59,8 @@ const N = () => ({
|
|
|
58
59
|
blockStates: {},
|
|
59
60
|
currentRecommendationId: null,
|
|
60
61
|
configVersion: 0
|
|
61
|
-
}),
|
|
62
|
-
state: () =>
|
|
62
|
+
}), T = P("guidoRecommendationExtension", {
|
|
63
|
+
state: () => x(),
|
|
63
64
|
getters: {
|
|
64
65
|
// ====================================================================
|
|
65
66
|
// Proxy Getters — Backward Compatible Access to Current Block State
|
|
@@ -69,7 +70,7 @@ const N = () => ({
|
|
|
69
70
|
* This allows all existing code that reads `store.recommendationConfigs` to work unchanged.
|
|
70
71
|
*/
|
|
71
72
|
recommendationConfigs(t) {
|
|
72
|
-
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs :
|
|
73
|
+
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs : I();
|
|
73
74
|
},
|
|
74
75
|
/**
|
|
75
76
|
* Proxy getter: delegates to blockStates[currentRecommendationId].recommendationProducts
|
|
@@ -133,7 +134,7 @@ const N = () => ({
|
|
|
133
134
|
getFilterList() {
|
|
134
135
|
return Object.values(this.filterList).map((t) => {
|
|
135
136
|
let e;
|
|
136
|
-
return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` :
|
|
137
|
+
return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` : C.includes(t.attributeName) ? e = `${t.attributeName}.${this.recommendationConfigs.currencySettings.value}` : e = t.attributeName, {
|
|
137
138
|
text: t.displayName,
|
|
138
139
|
value: e,
|
|
139
140
|
type: t.attributeType
|
|
@@ -155,7 +156,7 @@ const N = () => ({
|
|
|
155
156
|
setCurrentBlock(t) {
|
|
156
157
|
this.blockStates[t] || (this.blockStates = {
|
|
157
158
|
...this.blockStates,
|
|
158
|
-
[t]:
|
|
159
|
+
[t]: k()
|
|
159
160
|
}), this.currentRecommendationId = t;
|
|
160
161
|
},
|
|
161
162
|
/**
|
|
@@ -174,6 +175,25 @@ const N = () => ({
|
|
|
174
175
|
this.currentRecommendationId = n.length > 0 ? n[0] : null;
|
|
175
176
|
}
|
|
176
177
|
},
|
|
178
|
+
/**
|
|
179
|
+
* Deep-clones a block's state and mirrors its campaign URL under a new id.
|
|
180
|
+
* Invoked from `onCreated` when a duplicate is detected (SD-142352).
|
|
181
|
+
*/
|
|
182
|
+
cloneBlockState(t, e) {
|
|
183
|
+
const r = this.blockStates[t];
|
|
184
|
+
if (r) {
|
|
185
|
+
const o = structuredClone(r);
|
|
186
|
+
o.recommendationConfigs.id = e, this.blockStates = {
|
|
187
|
+
...this.blockStates,
|
|
188
|
+
[e]: o
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
const n = t.toString(), c = e.toString(), i = this.recommendationCampaignUrls[n];
|
|
192
|
+
i && (this.recommendationCampaignUrls = {
|
|
193
|
+
...this.recommendationCampaignUrls,
|
|
194
|
+
[c]: i
|
|
195
|
+
});
|
|
196
|
+
},
|
|
177
197
|
/**
|
|
178
198
|
* Marks a block as initialized (initial API data has been fetched).
|
|
179
199
|
* Automatically cleaned up when removeBlockState deletes the block entry.
|
|
@@ -204,7 +224,7 @@ const N = () => ({
|
|
|
204
224
|
decimalCount: String(e.currencyDecimalCount),
|
|
205
225
|
decimalSeparator: r(e.currencyDecimalSeparator, ","),
|
|
206
226
|
thousandSeparator: r(e.currencyThousandSeparator, ".")
|
|
207
|
-
}, c = !this.blockStates[t], i = c ?
|
|
227
|
+
}, c = !this.blockStates[t], i = c ? k() : this.blockStates[t];
|
|
208
228
|
i.recommendationConfigs = {
|
|
209
229
|
...i.recommendationConfigs,
|
|
210
230
|
strategy: e.strategy,
|
|
@@ -405,7 +425,7 @@ const N = () => ({
|
|
|
405
425
|
* every block's recommendationConfigs across user edits.
|
|
406
426
|
*/
|
|
407
427
|
hasInvalidBlock() {
|
|
408
|
-
return Object.values(this.blockStates).some((t) => !
|
|
428
|
+
return Object.values(this.blockStates).some((t) => !N(t.recommendationConfigs, this));
|
|
409
429
|
},
|
|
410
430
|
// ====================================================================
|
|
411
431
|
// Per-Block Product Fetching
|
|
@@ -434,7 +454,10 @@ const N = () => ({
|
|
|
434
454
|
details: !0,
|
|
435
455
|
campaignId: o.variationId
|
|
436
456
|
};
|
|
437
|
-
r.strategy === "manualMerchandising" ? a.productId = r.productIds.slice(0, s).join(",") : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), c && (a.filter = c), r.shuffleProducts && (a.shuffle = !0)
|
|
457
|
+
r.strategy === "manualMerchandising" ? a.productId = r.productIds.slice(0, s).join(",") : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), c && (a.filter = c), r.shuffleProducts && (a.shuffle = !0), Object.assign(
|
|
458
|
+
a,
|
|
459
|
+
v(o.partnerName, r.strategy)
|
|
460
|
+
);
|
|
438
461
|
let f;
|
|
439
462
|
try {
|
|
440
463
|
f = await h.fetchRecommendationProducts(i, a);
|
|
@@ -452,5 +475,5 @@ const N = () => ({
|
|
|
452
475
|
}
|
|
453
476
|
});
|
|
454
477
|
export {
|
|
455
|
-
|
|
478
|
+
T as useRecommendationExtensionStore
|
|
456
479
|
};
|
|
@@ -9,36 +9,44 @@ function m(t) {
|
|
|
9
9
|
function f(t) {
|
|
10
10
|
return t.split(",").filter(Boolean).map(m);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function G(t) {
|
|
13
|
+
return t.map(encodeURIComponent).join(",");
|
|
14
|
+
}
|
|
15
|
+
function Q(t) {
|
|
16
|
+
return t.trim().length > 0;
|
|
17
|
+
}
|
|
18
|
+
function d(t) {
|
|
13
19
|
if (t.length === 0)
|
|
14
20
|
return "";
|
|
15
21
|
const o = t.sort((r, e) => r.filterNumber - e.filterNumber), u = o.map((r) => {
|
|
16
|
-
const e = r.operator === l, a = e ? "=" : r.operator,
|
|
17
|
-
return `[${r.attribute}][${encodeURIComponent(a)}][${
|
|
18
|
-
}), [
|
|
19
|
-
let n =
|
|
20
|
-
for (let r = 0; r <
|
|
22
|
+
const e = r.operator === l, a = e ? "=" : r.operator, s = e ? f(r.value).join(l) : r.value;
|
|
23
|
+
return `[${r.attribute}][${encodeURIComponent(a)}][${s}]`;
|
|
24
|
+
}), [p, ...i] = u;
|
|
25
|
+
let n = p;
|
|
26
|
+
for (let r = 0; r < i.length; r++) {
|
|
21
27
|
const e = o[r].innerGroupOperator;
|
|
22
|
-
n += `${e}${
|
|
28
|
+
n += `${e}${i[r]}`;
|
|
23
29
|
}
|
|
24
30
|
return `(${n})`;
|
|
25
31
|
}
|
|
26
|
-
function
|
|
32
|
+
function F(t) {
|
|
27
33
|
if (!t || t.length === 0)
|
|
28
34
|
return "";
|
|
29
|
-
const o = t.reduce((r, e) => (r[e.filterGroup] || (r[e.filterGroup] = []), r[e.filterGroup].push(e), r), {}), u = Object.keys(o).map(Number).sort((r, e) => r - e),
|
|
35
|
+
const o = t.reduce((r, e) => (r[e.filterGroup] || (r[e.filterGroup] = []), r[e.filterGroup].push(e), r), {}), u = Object.keys(o).map(Number).sort((r, e) => r - e), p = u.map((r) => {
|
|
30
36
|
const e = o[r];
|
|
31
|
-
return
|
|
32
|
-
}), [
|
|
33
|
-
let
|
|
37
|
+
return d(e);
|
|
38
|
+
}), [i, ...n] = p;
|
|
39
|
+
let c = i;
|
|
34
40
|
for (let r = 0; r < n.length; r++) {
|
|
35
|
-
const e = u[r + 1],
|
|
36
|
-
|
|
41
|
+
const e = u[r + 1], s = o[e][0].outerGroupOperator;
|
|
42
|
+
c += `${s}${n[r]}`;
|
|
37
43
|
}
|
|
38
|
-
return
|
|
44
|
+
return c.trim();
|
|
39
45
|
}
|
|
40
46
|
export {
|
|
41
|
-
|
|
47
|
+
G as encodeTagList,
|
|
48
|
+
F as generateCompleteFilterQuery,
|
|
49
|
+
Q as isValidFilterTag,
|
|
42
50
|
f as parseTagList,
|
|
43
51
|
m as safeDecodeURIComponent
|
|
44
52
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const i = [
|
|
2
|
+
"ozonebg",
|
|
3
|
+
"ozonehr",
|
|
4
|
+
"ozonero",
|
|
5
|
+
"ozoneinfo",
|
|
6
|
+
"babybg",
|
|
7
|
+
"ozongr",
|
|
8
|
+
"iboodat",
|
|
9
|
+
"iboodbe",
|
|
10
|
+
"iboodde",
|
|
11
|
+
"iboodfr",
|
|
12
|
+
"iboodnl",
|
|
13
|
+
"iboodpl"
|
|
14
|
+
], r = ["interencheres", "interencherespreprod"], d = ["lodenfrey", "lodenfreyuat"], c = "manualMerchandising";
|
|
15
|
+
function s(e, n) {
|
|
16
|
+
const o = {};
|
|
17
|
+
return i.includes(e) && (o.excludePurchaseDay = "30", o.userId = "{user_id}"), r.includes(e) && (o.hp = "1"), d.includes(e) && n === c && (o.includeOutOfStockItems = "true"), o;
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
s as getPartnerRecommendationParams
|
|
21
|
+
};
|