@useinsider/guido 3.12.0-beta.40db55d → 3.12.0-beta.840207a
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 -14
- package/dist/@types/config/schemas.js +13 -8
- package/dist/components/Guido.vue.js +6 -6
- package/dist/components/Guido.vue2.js +50 -49
- package/dist/components/organisms/extensions/recommendation/StrategyDetailDrawer.vue.js +36 -0
- package/dist/components/organisms/extensions/recommendation/StrategyDetailDrawer.vue2.js +244 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/CampaignTable.vue.js +18 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/CampaignTable.vue2.js +42 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/FilterHumanizer.vue.js +20 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/FilterHumanizer.vue2.js +18 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerCondition.vue.js +20 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerCondition.vue2.js +60 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerGroup.vue.js +19 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/HumanizerGroup.vue2.js +19 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/InfoDisplayValue.vue.js +22 -0
- package/dist/components/organisms/extensions/recommendation/strategy-detail/InfoDisplayValue.vue2.js +29 -0
- package/dist/components/organisms/header/ViewOptions.vue.js +3 -3
- package/dist/components/organisms/header/version-history/ViewOptions.vue.js +1 -1
- package/dist/composables/useRecommendation.js +82 -51
- package/dist/composables/useStrategyFilters.js +16 -0
- package/dist/config/migrator/recommendationMigrator.js +7 -4
- package/dist/enums/date.js +4 -3
- package/dist/enums/extensions/filteringV2.js +8 -0
- package/dist/enums/extensions/recommendationBlock.js +28 -22
- package/dist/enums/extensions/strategyDetail.js +148 -0
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +12 -11
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +123 -109
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +146 -0
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +1 -1
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +256 -102
- package/dist/extensions/Blocks/Recommendation/utils/strategyHumanizer.js +97 -0
- package/dist/extensions/Blocks/Recommendation/utils/strategySummary.js +10 -0
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +24 -12
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +72 -29
- package/dist/src/@types/config/schemas.d.ts +10 -0
- package/dist/src/components/organisms/extensions/recommendation/StrategyDetailDrawer.vue.d.ts +2 -0
- package/dist/src/components/organisms/extensions/recommendation/strategy-detail/CampaignTable.vue.d.ts +43 -0
- package/dist/src/components/organisms/extensions/recommendation/strategy-detail/FilterHumanizer.vue.d.ts +29 -0
- package/dist/src/components/organisms/extensions/recommendation/strategy-detail/HumanizerCondition.vue.d.ts +40 -0
- package/dist/src/components/organisms/extensions/recommendation/strategy-detail/HumanizerGroup.vue.d.ts +38 -0
- package/dist/src/components/organisms/extensions/recommendation/strategy-detail/InfoDisplayValue.vue.d.ts +51 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useRecommendation.d.ts +2 -0
- package/dist/src/composables/useStrategyFilters.d.ts +24 -0
- package/dist/src/enums/extensions/filteringV2.d.ts +72 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +10 -0
- package/dist/src/enums/extensions/strategyDetail.d.ts +90 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +61 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +606 -1
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyHumanizer.d.ts +50 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategySummary.d.ts +34 -0
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +3 -1
- package/dist/src/services/recommendationApi.d.ts +7 -1
- package/dist/src/stores/config.d.ts +18 -0
- package/dist/src/utils/genericUtil.d.ts +9 -0
- package/dist/static/styles/base.css.js +15 -0
- package/dist/utils/dateUtil.js +23 -10
- package/dist/utils/genericUtil.js +10 -1
- package/dist/utils/templatePreparation.js +62 -58
- package/package.json +5 -10
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
const a = "TIME", r = "COUNT", o = {
|
|
2
|
+
OPERATOR: {
|
|
3
|
+
IN_LAST: "in-last",
|
|
4
|
+
IN_BETWEEN: "is-between",
|
|
5
|
+
IN: "in",
|
|
6
|
+
NOT_IN: "not-in"
|
|
7
|
+
}
|
|
8
|
+
}, e = [
|
|
9
|
+
{ value: "is-exactly", text: "campaign-builder.exactly", operator: "=" },
|
|
10
|
+
{ value: "is-not-exactly", text: "action-builder.is-not-exactly", operator: "!=" },
|
|
11
|
+
{ value: "contains", text: "campaign-builder.contains", operator: "~" },
|
|
12
|
+
{ value: "does-not-contain", text: "campaign-builder.does-not-contain", operator: "!~" },
|
|
13
|
+
{ value: "in", text: "smart-recommender.in", operator: "=" },
|
|
14
|
+
{ value: "not-in", text: "campaign-builder.not-in", operator: "!=" },
|
|
15
|
+
{ value: "matches-with", text: "discovery-strategy-filtering.matches-with", operator: "=" },
|
|
16
|
+
{ value: "does-not-match-with", text: "discovery-strategy-filtering.does-not-match-with", operator: "!=" },
|
|
17
|
+
{ value: "contains-user-context", text: "campaign-builder.contains", operator: "~" },
|
|
18
|
+
{ value: "does-not-contain-user-context", text: "campaign-builder.does-not-contain", operator: "!~" }
|
|
19
|
+
], t = [
|
|
20
|
+
{ value: "is-equal-to", text: "campaign-builder.equal-to", operator: "=" },
|
|
21
|
+
{ value: "is-not-equal-to", text: "smart-recommender.is-not-equal-to", operator: "!=" },
|
|
22
|
+
{ value: "is-greater-than", text: "campaign-builder.greater-than", operator: ">" },
|
|
23
|
+
{ value: "is-less-than", text: "campaign-builder.less-than", operator: "<" },
|
|
24
|
+
{ value: "is-greater-than-or-equal", text: "campaign-builder.greater-than-or-equal-to", operator: ">=" },
|
|
25
|
+
{ value: "is-less-than-or-equal", text: "campaign-builder.less-than-or-equal-to", operator: "<=" },
|
|
26
|
+
{ value: "is-between", text: "smart-recommender.in-between", operator: "><" },
|
|
27
|
+
{ value: "in", text: "smart-recommender.in", operator: "=" },
|
|
28
|
+
{ value: "not-in", text: "campaign-builder.not-in", operator: "!=" },
|
|
29
|
+
{ value: "is-exactly", text: "campaign-builder.exactly", operator: "=" }
|
|
30
|
+
], i = {
|
|
31
|
+
Number: [
|
|
32
|
+
...t,
|
|
33
|
+
{ value: "matches-with", text: "discovery-strategy-filtering.matches-with", operator: "=" },
|
|
34
|
+
{ value: "does-not-match-with", text: "discovery-strategy-filtering.does-not-match-with", operator: "!=" },
|
|
35
|
+
{ value: "is-greater-than-user-context", text: "campaign-builder.greater-than", operator: ">" },
|
|
36
|
+
{ value: "is-less-than-user-context", text: "campaign-builder.less-than", operator: "<" },
|
|
37
|
+
{
|
|
38
|
+
value: "is-greater-than-or-equal-user-context",
|
|
39
|
+
text: "campaign-builder.greater-than-or-equal-to",
|
|
40
|
+
operator: ">="
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
value: "is-less-than-or-equal-user-context",
|
|
44
|
+
text: "campaign-builder.less-than-or-equal-to",
|
|
45
|
+
operator: "<="
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
value: "is-more-than-currently-viewing-item-page-context",
|
|
49
|
+
text: "discovery-strategy-filtering.in-range-greater-than",
|
|
50
|
+
operator: "><"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
value: "is-less-than-currently-viewing-item-page-context",
|
|
54
|
+
text: "discovery-strategy-filtering.in-range-less-than",
|
|
55
|
+
operator: "><"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
value: "is-more-or-less-than-currently-viewing-item-page-context",
|
|
59
|
+
text: "discovery-strategy-filtering.in-range-less-or-greater-than",
|
|
60
|
+
operator: "><"
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
String: e,
|
|
64
|
+
"Array[String]": e,
|
|
65
|
+
Array: e,
|
|
66
|
+
Strings: e,
|
|
67
|
+
Numbers: e,
|
|
68
|
+
Booleans: e,
|
|
69
|
+
Dates: [
|
|
70
|
+
{ value: "is-exactly", text: "campaign-builder.exactly", operator: "=" },
|
|
71
|
+
{ value: "is-not-exactly", text: "action-builder.is-not-exactly", operator: "!=" },
|
|
72
|
+
{ value: "contains", text: "campaign-builder.contains", operator: "~" },
|
|
73
|
+
{ value: "does-not-contain", text: "campaign-builder.does-not-contain", operator: "!~" },
|
|
74
|
+
{ value: "in", text: "smart-recommender.in", operator: "=" },
|
|
75
|
+
{ value: "not-in", text: "campaign-builder.not-in", operator: "!=" }
|
|
76
|
+
],
|
|
77
|
+
Boolean: [
|
|
78
|
+
{ value: "true", text: "smart-recommender.is-true", operator: "=" },
|
|
79
|
+
{ value: "false", text: "smart-recommender.is-false", operator: "=" }
|
|
80
|
+
],
|
|
81
|
+
Image: [
|
|
82
|
+
{ value: "is-equal-to", text: "campaign-builder.exactly", operator: "=" },
|
|
83
|
+
{ value: "contains", text: "campaign-builder.contains", operator: "~" },
|
|
84
|
+
{ value: "does-not-contain", text: "campaign-builder.does-not-contain", operator: "!~" },
|
|
85
|
+
{ value: "is-empty", text: "condition.empty", operator: "?" },
|
|
86
|
+
{ value: "is-not-empty", text: "condition.not-empty", operator: "!?" }
|
|
87
|
+
],
|
|
88
|
+
Date: [
|
|
89
|
+
{ value: "after", text: "campaign-builder.after", operator: ">" },
|
|
90
|
+
{ value: "before", text: "campaign-builder.before", operator: "<" },
|
|
91
|
+
{ value: "is", text: "campaign-builder.is", operator: "=" },
|
|
92
|
+
{ value: "is-not", text: "campaign-builder.is-not", operator: "!=" },
|
|
93
|
+
{ value: "in-last", text: "purchase-history.in-last", operator: "<=" },
|
|
94
|
+
{ value: "matches-with", text: "discovery-strategy-filtering.matches-with", operator: "=" },
|
|
95
|
+
{ value: "does-not-match-with", text: "discovery-strategy-filtering.does-not-match-with", operator: "!=" },
|
|
96
|
+
{ value: "after-user-context", text: "campaign-builder.after", operator: ">" },
|
|
97
|
+
{ value: "before-user-context", text: "campaign-builder.before", operator: "<" }
|
|
98
|
+
],
|
|
99
|
+
Object: t
|
|
100
|
+
}, n = {
|
|
101
|
+
STRING: "String",
|
|
102
|
+
DATE: "Date"
|
|
103
|
+
}, s = ["Strings", "String", "Array"], l = {
|
|
104
|
+
IS_EXACTLY: "is-exactly",
|
|
105
|
+
IS_NOT_EXACTLY: "is-not-exactly",
|
|
106
|
+
CONTAINS: "contains",
|
|
107
|
+
NOT_CONTAINS: "does-not-contain"
|
|
108
|
+
}, c = {
|
|
109
|
+
USER_CONTEXT_FILTER: "userContextFilter",
|
|
110
|
+
USER_ATTRIBUTE_FILTER: "userAttributeFilter",
|
|
111
|
+
USER_EVENT_FILTER: "userEventFilter",
|
|
112
|
+
EVENT_BASED_FILTER: "eventBasedFilter"
|
|
113
|
+
}, u = {
|
|
114
|
+
CURRENTLY_VIEWED_ITEM: "page",
|
|
115
|
+
LEGACY_CURRENTLY_VIEWED_ITEM: "currentlyViewedItem"
|
|
116
|
+
}, p = [
|
|
117
|
+
{ value: "lastViewed", text: "discovery-strategy-filtering.users-last-viewed" },
|
|
118
|
+
{ value: "lastPurchased", text: "discovery-strategy-filtering.users-last-purchased" },
|
|
119
|
+
{ value: "lastAddedToCart", text: "discovery-strategy-filtering.users-last-added-to-cart" },
|
|
120
|
+
{ value: "lastRemovedFromCart", text: "discovery-strategy-filtering.users-last-removed-from-cart" },
|
|
121
|
+
{ value: "lastAddedToWishlist", text: "discovery-strategy-filtering.users-last-added-to-wishlist" },
|
|
122
|
+
{ value: "lastRemovedFromWishlist", text: "discovery-strategy-filtering.users-last-removed-from-wishlist" },
|
|
123
|
+
{ value: "page", text: "discovery-strategy-filtering.currently-viewed-item-on-page" },
|
|
124
|
+
{ value: "currentlyViewedItem", text: "discovery-strategy-filtering.currently-viewed-item-on-page" }
|
|
125
|
+
], d = "email", g = {
|
|
126
|
+
CATEGORY: "products.category-pages",
|
|
127
|
+
PRODUCT: "products.product-article-pages",
|
|
128
|
+
CART: "products.cart-pages",
|
|
129
|
+
ALL_PAGES: "products.all-pages"
|
|
130
|
+
}, v = {
|
|
131
|
+
GENERAL: "general",
|
|
132
|
+
OTHER: "other"
|
|
133
|
+
};
|
|
134
|
+
export {
|
|
135
|
+
r as COUNT,
|
|
136
|
+
n as DataTypes,
|
|
137
|
+
v as DetailTabs,
|
|
138
|
+
d as EMAIL_CHANNEL,
|
|
139
|
+
c as FilterTypeNames,
|
|
140
|
+
s as MultiSelectDataTypes,
|
|
141
|
+
o as OperatorAbbreviations,
|
|
142
|
+
l as OperatorNames,
|
|
143
|
+
i as Operators,
|
|
144
|
+
g as PageTypeTranslationKeys,
|
|
145
|
+
a as TIME,
|
|
146
|
+
u as UserEventKeys,
|
|
147
|
+
p as UserEvents
|
|
148
|
+
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { DEFAULT_COLUMN_SPACING as n, DEFAULT_ROW_SPACING as s, DEFAULT_MOBILE_ROW_SPACING as R, DEFAULT_MOBILE_COLUMN_SPACING as U, DEFAULT_MOBILE_CARDS_IN_ROW as e, DEFAULT_CARDS_IN_ROW as
|
|
1
|
+
import { DEFAULT_COLUMN_SPACING as n, DEFAULT_ROW_SPACING as s, DEFAULT_MOBILE_ROW_SPACING as R, DEFAULT_MOBILE_COLUMN_SPACING as U, DEFAULT_MOBILE_CARDS_IN_ROW as e, DEFAULT_CARDS_IN_ROW as a } from "./layout.js";
|
|
2
2
|
import { ATTR_PRODUCT_IMAGE as o, ATTR_PRODUCT_NAME as t, ATTR_PRODUCT_OLD_PRICE as _, ATTR_PRODUCT_PRICE as T, ATTR_PRODUCT_OMNIBUS_PRICE as r, ATTR_PRODUCT_OMNIBUS_DISCOUNT as i, ATTR_PRODUCT_BUTTON as I } from "./selectors.js";
|
|
3
|
-
const
|
|
3
|
+
const C = {
|
|
4
4
|
code: "USD",
|
|
5
5
|
symbol: "USD",
|
|
6
6
|
alignment: "after",
|
|
7
7
|
decimalCount: 2,
|
|
8
8
|
decimalSeparator: ".",
|
|
9
9
|
thousandSeparator: ","
|
|
10
|
-
},
|
|
10
|
+
}, D = {
|
|
11
11
|
textBefore: "",
|
|
12
12
|
textAfter: ""
|
|
13
|
-
},
|
|
13
|
+
}, O = {
|
|
14
14
|
textBefore: "",
|
|
15
15
|
textAfter: ""
|
|
16
16
|
}, A = [
|
|
@@ -32,15 +32,16 @@ const D = {
|
|
|
32
32
|
}, l = {
|
|
33
33
|
// Settings
|
|
34
34
|
strategy: "mostPopular",
|
|
35
|
+
strategyId: "",
|
|
35
36
|
productIds: [],
|
|
36
37
|
size: "6",
|
|
37
38
|
shuffleProducts: !1,
|
|
38
39
|
language: "en_US",
|
|
39
|
-
currency:
|
|
40
|
+
currency: C,
|
|
40
41
|
filters: [],
|
|
41
42
|
// Layout
|
|
42
43
|
layout: "grid",
|
|
43
|
-
cardsInRow:
|
|
44
|
+
cardsInRow: a,
|
|
44
45
|
mobileCardsInRow: e,
|
|
45
46
|
mobileLayoutEnabled: !1,
|
|
46
47
|
previousMobileCardsInRow: e,
|
|
@@ -52,8 +53,8 @@ const D = {
|
|
|
52
53
|
composition: A,
|
|
53
54
|
visibility: c,
|
|
54
55
|
// Element settings
|
|
55
|
-
omnibusPrice:
|
|
56
|
-
omnibusDiscount:
|
|
56
|
+
omnibusPrice: D,
|
|
57
|
+
omnibusDiscount: O,
|
|
57
58
|
textTrimming: !1,
|
|
58
59
|
// Price placement (block-level, affects all cards)
|
|
59
60
|
// Default ON = current stacked look, so existing templates are unaffected.
|
|
@@ -71,10 +72,10 @@ const D = {
|
|
|
71
72
|
export {
|
|
72
73
|
m as CURRENT_CONFIG_VERSION,
|
|
73
74
|
A as DEFAULT_COMPOSITION,
|
|
74
|
-
|
|
75
|
+
C as DEFAULT_CURRENCY,
|
|
75
76
|
l as DEFAULT_NODE_CONFIG,
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
O as DEFAULT_OMNIBUS_DISCOUNT,
|
|
78
|
+
D as DEFAULT_OMNIBUS_PRICE,
|
|
78
79
|
c as DEFAULT_VISIBILITY,
|
|
79
80
|
N as EXCLUDED_ALGORITHM_IDS
|
|
80
81
|
};
|
|
@@ -1,41 +1,45 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var s = (d, l, t) =>
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
var p = Object.defineProperty;
|
|
2
|
+
var g = (d, l, t) => l in d ? p(d, l, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[l] = t;
|
|
3
|
+
var s = (d, l, t) => g(d, typeof l != "symbol" ? l + "" : l, t);
|
|
4
|
+
import { useConfig as h } from "../../../../../composables/useConfig.js";
|
|
5
|
+
import { CommonControl as y } from "../../../common-control.js";
|
|
6
|
+
import { DEFAULT_NODE_CONFIG as a } from "../../constants/defaultConfig.js";
|
|
6
7
|
import { RecommendationConfigService as m } from "../../services/configService.js";
|
|
7
|
-
import { useRecommendationExtensionStore as
|
|
8
|
-
import { AlgorithmControl as
|
|
9
|
-
import { ALGORITHM_CONTROL_ID as
|
|
10
|
-
import { CurrencyControl as
|
|
11
|
-
import { CURRENCY_CONTROL_ID as
|
|
12
|
-
import { FiltersControl as
|
|
13
|
-
import { FILTERS_CONTROL_ID as
|
|
8
|
+
import { useRecommendationExtensionStore as R } from "../../store/recommendation.js";
|
|
9
|
+
import { AlgorithmControl as b } from "./algorithm.js";
|
|
10
|
+
import { ALGORITHM_CONTROL_ID as nt } from "./algorithm.js";
|
|
11
|
+
import { CurrencyControl as I } from "./currency.js";
|
|
12
|
+
import { CURRENCY_CONTROL_ID as st } from "./currency.js";
|
|
13
|
+
import { FiltersControl as N } from "./filters.js";
|
|
14
|
+
import { FILTERS_CONTROL_ID as lt } from "./filters.js";
|
|
14
15
|
import { LayoutOrientationControl as _ } from "./layoutOrientation.js";
|
|
15
|
-
import { LAYOUT_ORIENTATION_CONTROL_ID as
|
|
16
|
-
import { LocaleControl as
|
|
17
|
-
import { LOCALE_CONTROL_ID as
|
|
18
|
-
import { PricePlacementControl as
|
|
19
|
-
import { PRICE_PLACEMENT_CONTROL_ID as
|
|
20
|
-
import { ProductCountControl as
|
|
21
|
-
import { PRODUCT_COUNT_CONTROL_ID as
|
|
22
|
-
import { ProductLayoutControl as
|
|
23
|
-
import { PRODUCT_LAYOUT_CONTROL_ID as
|
|
16
|
+
import { LAYOUT_ORIENTATION_CONTROL_ID as ut } from "./layoutOrientation.js";
|
|
17
|
+
import { LocaleControl as T } from "./locale.js";
|
|
18
|
+
import { LOCALE_CONTROL_ID as mt } from "./locale.js";
|
|
19
|
+
import { PricePlacementControl as S } from "./pricePlacement.js";
|
|
20
|
+
import { PRICE_PLACEMENT_CONTROL_ID as Ct } from "./pricePlacement.js";
|
|
21
|
+
import { ProductCountControl as O } from "./productCount.js";
|
|
22
|
+
import { PRODUCT_COUNT_CONTROL_ID as pt } from "./productCount.js";
|
|
23
|
+
import { ProductLayoutControl as P } from "./productLayout.js";
|
|
24
|
+
import { PRODUCT_LAYOUT_CONTROL_ID as yt } from "./productLayout.js";
|
|
24
25
|
import { ShuffleControl as L } from "./shuffle.js";
|
|
25
|
-
import { SHUFFLE_CONTROL_ID as
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
import { SHUFFLE_CONTROL_ID as bt } from "./shuffle.js";
|
|
27
|
+
import { StrategyControl as E } from "./strategy.js";
|
|
28
|
+
import { STRATEGY_CONTROL_ID as Nt } from "./strategy.js";
|
|
29
|
+
import { setCurrencyAttributes as k, getBlockElement as D, isPartnerManagedBlock as A, updateProductContentInPlace as w, regenerateProductRowsWithStyles as v } from "./utils.js";
|
|
30
|
+
import { adjustProductsToSize as Tt, formatProductPrice as St, getCardComposition as Ot, getCurrentLayout as Pt, regenerateMobileProductRows as Lt, updatePricesInPlace as Et, updateSingleProductContent as kt } from "./utils.js";
|
|
31
|
+
import { useDebounceFn as C } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
32
|
+
const x = "recommendation-id", B = "ui-elements-recommendation-block";
|
|
33
|
+
class et extends y {
|
|
31
34
|
constructor() {
|
|
32
35
|
super(...arguments);
|
|
33
|
-
s(this, "store",
|
|
36
|
+
s(this, "store", R());
|
|
34
37
|
s(this, "storeUnsubscription", () => {
|
|
35
38
|
});
|
|
36
39
|
s(this, "syncedBlockIds", /* @__PURE__ */ new Set());
|
|
37
40
|
// Sub-control instances for lifecycle management
|
|
38
41
|
s(this, "algorithmControl", null);
|
|
42
|
+
s(this, "strategyControl", null);
|
|
39
43
|
s(this, "localeControl", null);
|
|
40
44
|
s(this, "currencyControl", null);
|
|
41
45
|
s(this, "productCountControl", null);
|
|
@@ -47,7 +51,7 @@ class Q extends g {
|
|
|
47
51
|
/**
|
|
48
52
|
* Debounced product fetch to prevent rapid API calls during config changes
|
|
49
53
|
*/
|
|
50
|
-
s(this, "_debouncedFetchProducts",
|
|
54
|
+
s(this, "_debouncedFetchProducts", C(() => {
|
|
51
55
|
this.store.fetchRecommendationProducts();
|
|
52
56
|
}, 500));
|
|
53
57
|
/**
|
|
@@ -61,16 +65,16 @@ class Q extends g {
|
|
|
61
65
|
* count. The store pads products to the configured size, so in-place only
|
|
62
66
|
* fails when the size actually changed.
|
|
63
67
|
*/
|
|
64
|
-
s(this, "_debouncedRegenerateWithProducts",
|
|
68
|
+
s(this, "_debouncedRegenerateWithProducts", C(() => {
|
|
65
69
|
const t = this.store.recommendationProducts;
|
|
66
|
-
if (!this.currentNode || !this.api ||
|
|
70
|
+
if (!this.currentNode || !this.api || A(this.currentNode))
|
|
67
71
|
return;
|
|
68
72
|
const e = this.api.getDocumentModifier();
|
|
69
|
-
|
|
73
|
+
w({
|
|
70
74
|
currentNode: this.currentNode,
|
|
71
75
|
documentModifier: e,
|
|
72
76
|
products: t
|
|
73
|
-
}) ||
|
|
77
|
+
}) || v({
|
|
74
78
|
currentNode: this.currentNode,
|
|
75
79
|
documentModifier: e,
|
|
76
80
|
products: t
|
|
@@ -78,11 +82,13 @@ class Q extends g {
|
|
|
78
82
|
}, 100));
|
|
79
83
|
}
|
|
80
84
|
getId() {
|
|
81
|
-
return
|
|
85
|
+
return B;
|
|
82
86
|
}
|
|
83
87
|
getTemplate() {
|
|
84
|
-
|
|
88
|
+
var o;
|
|
89
|
+
return h().isFeatureEnabled("reusableRecommendationStrategy") ? this.strategyControl = new E() : this.algorithmControl = new b(), this.localeControl = new T(), this.currencyControl = new I(), this.productCountControl = new O(), this.productLayoutControl = new P(), this.filtersControl = new N(), this.shuffleControl = new L(), this.pricePlacementControl = new S(), this.layoutOrientationControl = new _(), [
|
|
85
90
|
this.algorithmControl,
|
|
91
|
+
this.strategyControl,
|
|
86
92
|
this.localeControl,
|
|
87
93
|
this.currencyControl,
|
|
88
94
|
this.productCountControl,
|
|
@@ -91,14 +97,14 @@ class Q extends g {
|
|
|
91
97
|
this.shuffleControl,
|
|
92
98
|
this.pricePlacementControl,
|
|
93
99
|
this.layoutOrientationControl
|
|
94
|
-
].forEach((
|
|
95
|
-
|
|
100
|
+
].filter(Boolean).forEach((n) => {
|
|
101
|
+
n.api = this.api;
|
|
96
102
|
}), `
|
|
97
103
|
<div class="recommendation-controls-container">
|
|
98
104
|
${this.layoutOrientationControl.getTemplate()}
|
|
99
105
|
${this.productCountControl.getTemplate()}
|
|
100
106
|
${this.productLayoutControl.getTemplate()}
|
|
101
|
-
${this.algorithmControl.getTemplate()}
|
|
107
|
+
${((o = this.strategyControl ?? this.algorithmControl) == null ? void 0 : o.getTemplate()) ?? ""}
|
|
102
108
|
${this.localeControl.getTemplate()}
|
|
103
109
|
${this.pricePlacementControl.getTemplate()}
|
|
104
110
|
${this.currencyControl.getTemplate()}
|
|
@@ -117,24 +123,25 @@ class Q extends g {
|
|
|
117
123
|
await this._fetchBlockData(e), this._initializeSubControls();
|
|
118
124
|
}
|
|
119
125
|
onTemplateNodeUpdated(t) {
|
|
120
|
-
var
|
|
126
|
+
var n;
|
|
121
127
|
super.onTemplateNodeUpdated(t);
|
|
122
128
|
const e = this._getRecommendationIdFromNode(t);
|
|
123
|
-
e !== null && e !== this.store.currentRecommendationId && this.store.setCurrentBlock(e), e !== null && !this.syncedBlockIds.has(e) && (this.syncedBlockIds.add(e), this._syncNodeConfigToStore()), e !== null && !((
|
|
129
|
+
e !== null && e !== this.store.currentRecommendationId && this.store.setCurrentBlock(e), e !== null && !this.syncedBlockIds.has(e) && (this.syncedBlockIds.add(e), this._syncNodeConfigToStore()), e !== null && !((n = this.store.blockStates[e]) != null && n.isInitialized) && this._fetchBlockData(e).then(() => {
|
|
124
130
|
this._initializeSubControls();
|
|
125
131
|
}), [
|
|
126
132
|
this.layoutOrientationControl,
|
|
127
133
|
this.productCountControl,
|
|
128
134
|
this.algorithmControl,
|
|
135
|
+
this.strategyControl,
|
|
129
136
|
this.localeControl,
|
|
130
137
|
this.currencyControl,
|
|
131
138
|
this.productLayoutControl,
|
|
132
139
|
this.filtersControl,
|
|
133
140
|
this.shuffleControl,
|
|
134
141
|
this.pricePlacementControl
|
|
135
|
-
].forEach((
|
|
142
|
+
].forEach((r) => {
|
|
136
143
|
var i;
|
|
137
|
-
|
|
144
|
+
r != null && r.api && (r.currentNode = t, (i = r.onTemplateNodeUpdated) == null || i.call(r, t));
|
|
138
145
|
});
|
|
139
146
|
}
|
|
140
147
|
onDestroy() {
|
|
@@ -142,6 +149,7 @@ class Q extends g {
|
|
|
142
149
|
this.layoutOrientationControl,
|
|
143
150
|
this.productCountControl,
|
|
144
151
|
this.algorithmControl,
|
|
152
|
+
this.strategyControl,
|
|
145
153
|
this.localeControl,
|
|
146
154
|
this.currencyControl,
|
|
147
155
|
this.productLayoutControl,
|
|
@@ -162,6 +170,7 @@ class Q extends g {
|
|
|
162
170
|
this.layoutOrientationControl,
|
|
163
171
|
this.productCountControl,
|
|
164
172
|
this.algorithmControl,
|
|
173
|
+
this.strategyControl,
|
|
165
174
|
this.localeControl,
|
|
166
175
|
this.currencyControl,
|
|
167
176
|
this.productLayoutControl,
|
|
@@ -185,8 +194,8 @@ class Q extends g {
|
|
|
185
194
|
* values are being prepared for the upcoming initial fetch.
|
|
186
195
|
*/
|
|
187
196
|
_syncNodeConfigToStore() {
|
|
188
|
-
var
|
|
189
|
-
const t = m.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((
|
|
197
|
+
var n;
|
|
198
|
+
const t = m.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((n = this.store.blockStates[e]) == null ? void 0 : n.isInitialized);
|
|
190
199
|
this.store.patchCurrentBlockConfig({
|
|
191
200
|
strategy: t.strategy,
|
|
192
201
|
language: t.language,
|
|
@@ -224,16 +233,19 @@ class Q extends g {
|
|
|
224
233
|
* Marks the block as initialized to prevent redundant fetches on re-selection.
|
|
225
234
|
*/
|
|
226
235
|
async _fetchBlockData(t) {
|
|
227
|
-
t !== null && this.store.markBlockInitialized(t)
|
|
228
|
-
|
|
229
|
-
this.store.
|
|
230
|
-
|
|
231
|
-
|
|
236
|
+
t !== null && this.store.markBlockInitialized(t);
|
|
237
|
+
const e = h().isFeatureEnabled("reusableRecommendationStrategy"), o = [
|
|
238
|
+
{ name: "fetchRecommendationCreateData", run: () => this.store.fetchRecommendationCreateData() },
|
|
239
|
+
{ name: "fetchRecommendationFilters", run: () => this.store.fetchRecommendationFilters() },
|
|
240
|
+
...e ? [{ name: "fetchRecommendationStrategies", run: () => this.store.fetchRecommendationStrategies() }] : []
|
|
241
|
+
];
|
|
242
|
+
(await Promise.allSettled(o.map((r) => r.run()))).forEach((r, i) => {
|
|
243
|
+
r.status === "rejected" && console.warn(`Recommendation block: ${o[i].name} failed`, r.reason);
|
|
232
244
|
}), this._applySmartDefaults();
|
|
233
245
|
try {
|
|
234
246
|
await this.store.fetchRecommendationProducts();
|
|
235
|
-
} catch (
|
|
236
|
-
console.warn("Recommendation block: fetchRecommendationProducts failed",
|
|
247
|
+
} catch (r) {
|
|
248
|
+
console.warn("Recommendation block: fetchRecommendationProducts failed", r);
|
|
237
249
|
}
|
|
238
250
|
}
|
|
239
251
|
/**
|
|
@@ -250,35 +262,35 @@ class Q extends g {
|
|
|
250
262
|
if (!this.currentNode || !this.api)
|
|
251
263
|
return;
|
|
252
264
|
const t = m.getConfig(this.currentNode), e = {};
|
|
253
|
-
let o = null,
|
|
254
|
-
if (t.currency.code ===
|
|
265
|
+
let o = null, n = null, r = null;
|
|
266
|
+
if (t.currency.code === a.currency.code) {
|
|
255
267
|
const { currencyList: i } = this.store;
|
|
256
268
|
i.length > 0 && (i.some(
|
|
257
|
-
(u) => u.value === `price.${
|
|
269
|
+
(u) => u.value === `price.${a.currency.code}`
|
|
258
270
|
) || (o = i[0].value.replace("price.", ""), e.currency = {
|
|
259
|
-
...
|
|
271
|
+
...a.currency,
|
|
260
272
|
code: o,
|
|
261
273
|
symbol: o
|
|
262
274
|
}));
|
|
263
275
|
}
|
|
264
|
-
if (t.strategy ===
|
|
276
|
+
if (t.strategy === a.strategy) {
|
|
265
277
|
const i = this.store.getActivePredictiveAlgorithms;
|
|
266
278
|
i.length > 0 && (i.some(
|
|
267
|
-
(u) => u.value ===
|
|
268
|
-
) || (
|
|
279
|
+
(u) => u.value === a.strategy
|
|
280
|
+
) || (n = i[0].value, e.strategy = n));
|
|
269
281
|
}
|
|
270
|
-
if (t.language ===
|
|
282
|
+
if (t.language === a.language) {
|
|
271
283
|
const i = this.store.getLanguages;
|
|
272
284
|
i.length > 0 && (i.some(
|
|
273
|
-
(u) => u.value ===
|
|
274
|
-
) || (
|
|
285
|
+
(u) => u.value === a.language
|
|
286
|
+
) || (r = i[0].value, e.language = r));
|
|
275
287
|
}
|
|
276
|
-
!o && !
|
|
288
|
+
!o && !n && !r || (m.updateConfig(
|
|
277
289
|
this.api,
|
|
278
290
|
this.currentNode,
|
|
279
291
|
e,
|
|
280
292
|
"Applied smart defaults"
|
|
281
|
-
), o && e.currency &&
|
|
293
|
+
), o && e.currency && k({
|
|
282
294
|
currentNode: this.currentNode,
|
|
283
295
|
documentModifier: this.api.getDocumentModifier(),
|
|
284
296
|
currency: e.currency
|
|
@@ -288,28 +300,28 @@ class Q extends g {
|
|
|
288
300
|
name: o,
|
|
289
301
|
value: o,
|
|
290
302
|
symbol: o,
|
|
291
|
-
alignment:
|
|
292
|
-
decimalCount:
|
|
293
|
-
decimalSeparator:
|
|
294
|
-
thousandSeparator:
|
|
303
|
+
alignment: a.currency.alignment === "before" ? "0" : "1",
|
|
304
|
+
decimalCount: a.currency.decimalCount.toString(),
|
|
305
|
+
decimalSeparator: a.currency.decimalSeparator,
|
|
306
|
+
thousandSeparator: a.currency.thousandSeparator
|
|
295
307
|
}
|
|
296
308
|
} : {},
|
|
297
|
-
...
|
|
298
|
-
...
|
|
309
|
+
...n ? { strategy: n } : {},
|
|
310
|
+
...r ? { language: r } : {}
|
|
299
311
|
}, { triggerRefetch: !1 }));
|
|
300
312
|
}
|
|
301
313
|
/**
|
|
302
314
|
* Reads the recommendation-id attribute from the block element within the node
|
|
303
315
|
*/
|
|
304
316
|
_getRecommendationIdFromNode(t) {
|
|
305
|
-
const e =
|
|
317
|
+
const e = D(t);
|
|
306
318
|
if (!e || !("getAttribute" in e))
|
|
307
319
|
return null;
|
|
308
|
-
const o = e.getAttribute(
|
|
320
|
+
const o = e.getAttribute(x);
|
|
309
321
|
if (!o)
|
|
310
322
|
return null;
|
|
311
|
-
const
|
|
312
|
-
return Number.isNaN(
|
|
323
|
+
const n = parseInt(o);
|
|
324
|
+
return Number.isNaN(n) ? null : n;
|
|
313
325
|
}
|
|
314
326
|
/**
|
|
315
327
|
* Listen to store changes that require product refresh or regeneration.
|
|
@@ -326,17 +338,17 @@ class Q extends g {
|
|
|
326
338
|
*/
|
|
327
339
|
_listenStateUpdates() {
|
|
328
340
|
const { store: t } = this;
|
|
329
|
-
let e = t.recommendationProducts, o = t.$state.configVersion,
|
|
341
|
+
let e = t.recommendationProducts, o = t.$state.configVersion, n = t.currentRecommendationId;
|
|
330
342
|
this.storeUnsubscription = t.$subscribe(() => {
|
|
331
|
-
const
|
|
332
|
-
if (
|
|
333
|
-
|
|
343
|
+
const r = t.currentRecommendationId;
|
|
344
|
+
if (r !== n) {
|
|
345
|
+
n = r, e = t.recommendationProducts, o = t.$state.configVersion;
|
|
334
346
|
return;
|
|
335
347
|
}
|
|
336
348
|
const i = t.$state.configVersion;
|
|
337
349
|
i !== o && (o = i, this._persistFiltersToNodeConfig(), this._debouncedFetchProducts());
|
|
338
|
-
const
|
|
339
|
-
u &&
|
|
350
|
+
const c = t.recommendationProducts, u = c !== e, f = Array.isArray(c) && c.length > 0;
|
|
351
|
+
u && f && (e = c, this._debouncedRegenerateWithProducts());
|
|
340
352
|
});
|
|
341
353
|
}
|
|
342
354
|
/**
|
|
@@ -356,36 +368,38 @@ class Q extends g {
|
|
|
356
368
|
}
|
|
357
369
|
}
|
|
358
370
|
export {
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
371
|
+
nt as ALGORITHM_CONTROL_ID,
|
|
372
|
+
b as AlgorithmControl,
|
|
373
|
+
B as CONTROL_BLOCK_ID,
|
|
374
|
+
st as CURRENCY_CONTROL_ID,
|
|
375
|
+
I as CurrencyControl,
|
|
376
|
+
lt as FILTERS_CONTROL_ID,
|
|
377
|
+
N as FiltersControl,
|
|
378
|
+
ut as LAYOUT_ORIENTATION_CONTROL_ID,
|
|
379
|
+
mt as LOCALE_CONTROL_ID,
|
|
368
380
|
_ as LayoutOrientationControl,
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
381
|
+
T as LocaleControl,
|
|
382
|
+
Ct as PRICE_PLACEMENT_CONTROL_ID,
|
|
383
|
+
pt as PRODUCT_COUNT_CONTROL_ID,
|
|
384
|
+
yt as PRODUCT_LAYOUT_CONTROL_ID,
|
|
385
|
+
S as PricePlacementControl,
|
|
386
|
+
O as ProductCountControl,
|
|
387
|
+
P as ProductLayoutControl,
|
|
388
|
+
et as RecommendationBlockControl,
|
|
389
|
+
bt as SHUFFLE_CONTROL_ID,
|
|
390
|
+
Nt as STRATEGY_CONTROL_ID,
|
|
378
391
|
L as ShuffleControl,
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
392
|
+
E as StrategyControl,
|
|
393
|
+
Tt as adjustProductsToSize,
|
|
394
|
+
St as formatProductPrice,
|
|
395
|
+
D as getBlockElement,
|
|
396
|
+
Ot as getCardComposition,
|
|
397
|
+
Pt as getCurrentLayout,
|
|
398
|
+
A as isPartnerManagedBlock,
|
|
399
|
+
Lt as regenerateMobileProductRows,
|
|
400
|
+
v as regenerateProductRowsWithStyles,
|
|
401
|
+
k as setCurrencyAttributes,
|
|
402
|
+
Et as updatePricesInPlace,
|
|
403
|
+
w as updateProductContentInPlace,
|
|
404
|
+
kt as updateSingleProductContent
|
|
391
405
|
};
|