@useinsider/guido 3.19.0 → 3.20.0-beta.05ce01c
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 +22 -3
- package/dist/@types/config/schemas.js +76 -53
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +105 -89
- package/dist/components/organisms/AutoSaveController.vue2.js +10 -8
- package/dist/components/organisms/base/AuthErrorModal.vue.js +18 -0
- package/dist/components/organisms/base/AuthErrorModal.vue2.js +42 -0
- package/dist/components/organisms/base/Toaster.vue2.js +13 -12
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +13 -11
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +78 -57
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +18 -0
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +25 -0
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +28 -42
- package/dist/components/organisms/header/EditorActions.vue.js +2 -2
- package/dist/components/organisms/header/EditorActions.vue2.js +83 -48
- package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
- package/dist/components/organisms/header/LeftSlot.vue2.js +16 -12
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +28 -24
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +21 -0
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +46 -0
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +47 -0
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +20 -0
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +50 -0
- package/dist/components/wrappers/WpDrawer.vue.js +9 -7
- package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
- package/dist/components/wrappers/WpModal.vue.js +1 -1
- package/dist/components/wrappers/WpModal.vue2.js +4 -3
- package/dist/composables/useActionsApi.js +52 -47
- package/dist/composables/useAuthError.js +52 -0
- package/dist/composables/useAutoSave.js +44 -42
- package/dist/composables/useCodeEditorApi.js +23 -9
- package/dist/composables/useCortexBlueprintBridge.js +122 -54
- package/dist/composables/useCustomInterfaceAppearance.js +65 -51
- package/dist/composables/useEmailTemplateApplier.js +111 -50
- package/dist/composables/useHtmlCompiler.js +37 -26
- package/dist/composables/useHtmlValidator.js +89 -82
- package/dist/composables/useHttp.js +64 -54
- package/dist/composables/useLegacyStrategyConversion.js +65 -0
- package/dist/composables/useRecommendation.js +40 -35
- package/dist/composables/useSave.js +93 -45
- package/dist/composables/useSaveValidation.js +284 -0
- package/dist/composables/useSaveValidationRollout.js +20 -0
- package/dist/composables/useStripo.js +43 -39
- package/dist/composables/useToaster.js +18 -22
- package/dist/composables/useTranslations.js +3 -2
- package/dist/composables/useVersionHistoryApi.js +33 -24
- package/dist/composables/validators/useCouponBlockValidator.js +24 -21
- package/dist/composables/validators/useLiquidValidator.js +15 -15
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +34 -27
- package/dist/config/migrator/index.js +14 -13
- package/dist/config/migrator/itemsBlockMigrator.js +236 -248
- package/dist/config/migrator/recommendationMigrator.js +28 -21
- package/dist/config/migrator/recommendationPartnerMigrator.js +56 -0
- package/dist/enums/extensions/recommendationBlock.js +51 -34
- package/dist/enums/save-validation.js +4 -0
- package/dist/extensions/Blocks/Items/constants/cardLayout.js +20 -0
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +18 -17
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +114 -105
- package/dist/extensions/Blocks/Items/enums/productEnums.js +14 -9
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +11 -9
- package/dist/extensions/Blocks/Items/template.js +219 -204
- package/dist/extensions/Blocks/Recommendation/block.js +65 -45
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +21 -20
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +103 -90
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +150 -52
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +74 -74
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +274 -92
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +42 -0
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +26 -16
- package/dist/extensions/Blocks/Recommendation/utils/partnerCustomizations.js +3 -1
- package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +25 -0
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +24 -0
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +21 -12
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +46 -37
- package/dist/services/settingsApi.js +11 -0
- package/dist/src/@types/config/schemas.d.ts +36 -0
- package/dist/src/@types/save-validation.d.ts +19 -0
- package/dist/src/components/Guido.vue.d.ts +17 -1
- package/dist/src/components/organisms/base/AuthErrorModal.vue.d.ts +2 -0
- package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +2 -0
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +17 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +17 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +17 -1
- package/dist/src/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.d.ts +2 -0
- package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +2 -0
- package/dist/src/components/organisms/validation/ValidationErrorDrawer.vue.d.ts +2 -0
- package/dist/src/components/wrappers/WpDrawer.vue.d.ts +4 -3
- package/dist/src/components/wrappers/WpModal.vue.d.ts +5 -1
- package/dist/src/composables/useAuthError.d.ts +12 -0
- package/dist/src/composables/useAutoSave.d.ts +4 -1
- package/dist/src/composables/useConfig.d.ts +8 -0
- package/dist/src/composables/useCortexBlueprintBridge.d.ts +2 -3
- package/dist/src/composables/useEmailTemplateApplier.d.ts +18 -5
- package/dist/src/composables/useGuidoActions.d.ts +2 -0
- package/dist/src/composables/useHtmlValidator.d.ts +21 -0
- package/dist/src/composables/useHttp.d.ts +2 -0
- package/dist/src/composables/useLegacyStrategyConversion.d.ts +3 -0
- package/dist/src/composables/useSave.d.ts +6 -1
- package/dist/src/composables/useSaveValidation.d.ts +6 -0
- package/dist/src/composables/useSaveValidationRollout.d.ts +4 -0
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +10 -0
- package/dist/src/config/migrator/index.d.ts +2 -1
- package/dist/src/config/migrator/recommendationPartnerMigrator.d.ts +19 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +7 -1
- package/dist/src/enums/save-validation.d.ts +27 -0
- package/dist/src/extensions/Blocks/Items/constants/cardLayout.d.ts +44 -0
- package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +3 -0
- package/dist/src/extensions/Blocks/Items/template.d.ts +19 -0
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +7 -2
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +162 -1
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +32 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +33 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +14 -0
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +4 -0
- package/dist/src/mock/cortexChatStore.d.ts +12 -0
- package/dist/src/services/recommendationApi.d.ts +2 -1
- package/dist/src/services/settingsApi.d.ts +6 -0
- package/dist/src/stores/config.d.ts +374 -0
- package/dist/src/stores/guido-email-editor.d.ts +20 -10
- package/dist/src/stores/onboarding.d.ts +812 -10
- package/dist/src/stores/recommendation.d.ts +5 -0
- package/dist/src/stores/save-validation.d.ts +22 -0
- package/dist/src/stores/setup-settings.d.ts +4 -0
- package/dist/src/utils/dateUtil.d.ts +10 -0
- package/dist/src/utils/genericUtil.d.ts +3 -0
- package/dist/src/utils/stripoEditorApi.d.ts +4 -0
- package/dist/src/utils/templatePreparation.d.ts +30 -0
- package/dist/static/assets/icons/filled-arrow-rising.svg.js +5 -0
- package/dist/static/assets/icons/line-info.svg.js +5 -0
- package/dist/static/styles/components/recommendation-strategy.css.js +113 -9
- package/dist/static/styles/components/skeleton.css.js +23 -0
- package/dist/static/styles/components/version-history.css.js +2 -6
- package/dist/stores/config.js +55 -24
- package/dist/stores/guido-email-editor.js +3 -1
- package/dist/stores/onboarding.js +50 -36
- package/dist/stores/save-validation.js +30 -0
- package/dist/stores/setup-settings.js +10 -0
- package/dist/stores/unsubscribe.js +3 -3
- package/dist/utils/pairProductVariables.js +71 -71
- package/dist/utils/stripoEditorApi.js +11 -0
- package/dist/utils/templatePreparation.js +54 -51
- package/package.json +2 -1
|
@@ -1,43 +1,66 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
var w = Object.defineProperty;
|
|
2
|
+
var N = (l, o, t) => o in l ? w(l, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[o] = t;
|
|
3
|
+
var i = (l, o, t) => N(l, typeof o != "symbol" ? o + "" : o, t);
|
|
4
|
+
import { useLegacyStrategyConversion as L } from "../../../../../composables/useLegacyStrategyConversion.js";
|
|
5
|
+
import { ACADEMY_LINKS as $ } from "../../../../../enums/academy.js";
|
|
6
|
+
import { useOnboardingStore as A } from "../../../../../stores/onboarding.js";
|
|
7
|
+
import { CommonControl as R } from "../../../common-control.js";
|
|
8
|
+
import { RRS_CONFIG_VERSION as E } from "../../constants/defaultConfig.js";
|
|
9
|
+
import { RecommendationConfigService as C } from "../../services/configService.js";
|
|
10
|
+
import { useRecommendationExtensionStore as O } from "../../store/recommendation.js";
|
|
11
|
+
const I = "recommendation-strategy-control";
|
|
12
|
+
class P extends R {
|
|
9
13
|
constructor() {
|
|
10
14
|
super(...arguments);
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
i(this, "store", O());
|
|
16
|
+
i(this, "onboardingStore", A());
|
|
17
|
+
i(this, "legacyConversion", L());
|
|
18
|
+
i(this, "storeUnsubscription", () => {
|
|
13
19
|
});
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
i(this, "listeners", []);
|
|
21
|
+
i(this, "lastPaintedState", null);
|
|
16
22
|
}
|
|
17
23
|
getId() {
|
|
18
|
-
return
|
|
24
|
+
return I;
|
|
19
25
|
}
|
|
20
26
|
getTemplate() {
|
|
21
27
|
const t = this.api.translate(
|
|
22
28
|
"You can assign a recommendation strategy by selecting an existing one or creating a new one to show specific content."
|
|
23
|
-
), e = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy")
|
|
29
|
+
), e = this.api.translate("For more information, you can"), a = this.api.translate("visit Academy"), r = this.api.translate("Legacy Strategy"), s = this.api.translate(
|
|
30
|
+
"Note that this is an older version of the Recommendation Strategy. We recommend you update it to the new Recommendation Strategy for an improved experience."
|
|
31
|
+
), g = this.api.translate(
|
|
32
|
+
"The recommendation strategy used in the recommendation block is no longer available. You can assign a different strategy to it."
|
|
33
|
+
);
|
|
24
34
|
return `
|
|
25
35
|
<div class="strategy-control-container">
|
|
26
|
-
<div
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
</p>
|
|
36
|
+
<div data-strategy-loading-state>
|
|
37
|
+
<div class="strategy-control-header">
|
|
38
|
+
<span class="guido-skeleton guido-skeleton--strategy-title"></span>
|
|
39
|
+
</div>
|
|
40
|
+
<div class="strategy-control-description-row">
|
|
41
|
+
<span class="guido-skeleton guido-skeleton--strategy-description"></span>
|
|
42
|
+
</div>
|
|
43
|
+
<div class="strategy-control-skeleton-row">
|
|
44
|
+
<span class="guido-skeleton guido-skeleton--strategy-cta"></span>
|
|
45
|
+
<span class="guido-skeleton guido-skeleton--strategy-cta"></span>
|
|
46
|
+
</div>
|
|
38
47
|
</div>
|
|
39
|
-
<div data-strategy-
|
|
40
|
-
|
|
48
|
+
<div data-strategy-content style="display: none;">
|
|
49
|
+
<div class="strategy-control-header">
|
|
50
|
+
<h3 class="strategy-control-title">${this.api.translate("Recommendation Strategy")}</h3>
|
|
51
|
+
</div>
|
|
52
|
+
<div class="strategy-control-description-row">
|
|
53
|
+
<p class="strategy-control-description">
|
|
54
|
+
${t}
|
|
55
|
+
${e}
|
|
56
|
+
<a
|
|
57
|
+
href="${$.EMAIL_RECOMMENDATION_BLOCK}"
|
|
58
|
+
target="_blank"
|
|
59
|
+
rel="noopener noreferrer">${a}</a>.
|
|
60
|
+
</p>
|
|
61
|
+
</div>
|
|
62
|
+
<div data-strategy-empty-state style="display: none;">
|
|
63
|
+
${this._GuTwoColumns([
|
|
41
64
|
this._GuButton({
|
|
42
65
|
name: "assignStrategy",
|
|
43
66
|
label: this.api.translate("Assign Strategy"),
|
|
@@ -48,26 +71,76 @@ class f extends h {
|
|
|
48
71
|
name: "createStrategy",
|
|
49
72
|
label: this.api.translate("Create New Strategy"),
|
|
50
73
|
id: "guido__btn-create-strategy",
|
|
51
|
-
className: "strategy-control-cta primary"
|
|
52
|
-
disabled: !0
|
|
74
|
+
className: "strategy-control-cta primary"
|
|
53
75
|
})
|
|
54
76
|
], "strategy-control-cta-row")}
|
|
55
|
-
</div>
|
|
56
|
-
<div data-strategy-assigned-state style="display: none;">
|
|
57
|
-
<div class="strategy-control-name-band">
|
|
58
|
-
<span class="strategy-control-name" data-strategy-name></span>
|
|
59
77
|
</div>
|
|
60
|
-
<div
|
|
61
|
-
|
|
78
|
+
<div data-strategy-unavailable-state style="display: none;">
|
|
79
|
+
<div class="strategy-control-notice-row">
|
|
80
|
+
<div class="strategy-control-notice strategy-control-notice--error" role="alert">
|
|
81
|
+
<p class="strategy-control-notice-text">${g}</p>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
${this._GuTwoColumns([
|
|
85
|
+
this._GuButton({
|
|
86
|
+
name: "assignUnavailableStrategy",
|
|
87
|
+
label: this.api.translate("Assign Strategy"),
|
|
88
|
+
id: "guido__btn-assign-unavailable-strategy",
|
|
89
|
+
className: "strategy-control-cta on"
|
|
90
|
+
}),
|
|
91
|
+
this._GuButton({
|
|
92
|
+
name: "createUnavailableStrategy",
|
|
93
|
+
label: this.api.translate("Create New Strategy"),
|
|
94
|
+
id: "guido__btn-create-unavailable-strategy",
|
|
95
|
+
className: "strategy-control-cta primary"
|
|
96
|
+
})
|
|
97
|
+
], "strategy-control-cta-row")}
|
|
98
|
+
</div>
|
|
99
|
+
<div data-strategy-legacy-state style="display: none;">
|
|
100
|
+
<div class="strategy-control-notice-row">
|
|
101
|
+
<div class="strategy-control-notice">
|
|
102
|
+
<p class="strategy-control-notice-text">${s}</p>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
<div class="strategy-control-name-band">
|
|
106
|
+
<span class="strategy-control-name">${r}</span>
|
|
107
|
+
${this._strategyAction({
|
|
108
|
+
id: "guido__btn-update-legacy-strategy",
|
|
109
|
+
label: this.api.translate("Update"),
|
|
110
|
+
modifier: "update"
|
|
111
|
+
})}
|
|
112
|
+
</div>
|
|
113
|
+
<div class="strategy-control-actions">
|
|
114
|
+
${this._strategyAction({
|
|
115
|
+
id: "guido__btn-change-legacy-strategy",
|
|
116
|
+
label: this.api.translate("Change"),
|
|
117
|
+
modifier: "change"
|
|
118
|
+
})}
|
|
119
|
+
${this._strategyAction({
|
|
120
|
+
id: "guido__btn-remove-legacy-strategy",
|
|
121
|
+
label: this.api.translate("Remove"),
|
|
122
|
+
modifier: "remove"
|
|
123
|
+
})}
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
<div data-strategy-assigned-state style="display: none;">
|
|
127
|
+
<div class="strategy-control-name-band">
|
|
128
|
+
<span class="strategy-control-name" data-strategy-name></span>
|
|
129
|
+
<span
|
|
130
|
+
class="guido-skeleton guido-skeleton--strategy-name" data-strategy-name-skeleton></span>
|
|
131
|
+
</div>
|
|
132
|
+
<div class="strategy-control-actions">
|
|
133
|
+
${this._strategyAction({
|
|
62
134
|
id: "guido__btn-change-strategy",
|
|
63
135
|
label: this.api.translate("Change"),
|
|
64
136
|
modifier: "change"
|
|
65
137
|
})}
|
|
66
|
-
|
|
138
|
+
${this._strategyAction({
|
|
67
139
|
id: "guido__btn-remove-strategy",
|
|
68
140
|
label: this.api.translate("Remove"),
|
|
69
141
|
modifier: "remove"
|
|
70
142
|
})}
|
|
143
|
+
</div>
|
|
71
144
|
</div>
|
|
72
145
|
</div>
|
|
73
146
|
</div>
|
|
@@ -84,41 +157,66 @@ class f extends h {
|
|
|
84
157
|
`;
|
|
85
158
|
}
|
|
86
159
|
onRender() {
|
|
87
|
-
this._teardown(), this._setupButtonListeners(), this._renderState(), this.storeUnsubscription = this.store.$subscribe(() => {
|
|
160
|
+
this._teardown(), this.store.strategyPanelOpen = !0, this._setupButtonListeners(), this._renderState(), this.storeUnsubscription = this.store.$subscribe(() => {
|
|
88
161
|
this._renderState();
|
|
89
|
-
}), this.store.recommendationConfigs.strategyId && !this.store.
|
|
90
|
-
});
|
|
162
|
+
}), this.store.recommendationConfigs.strategyId && !this.store.strategiesLoading && (this.store.invalidateStrategies(), this.store.fetchStrategies().catch(() => {
|
|
163
|
+
}));
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Whether the document itself says this block has no strategy.
|
|
167
|
+
*
|
|
168
|
+
* Read the node, not the store: when the main control cannot resolve the block id off the
|
|
169
|
+
* node it never syncs the persisted config, so the store still holds defaults (empty
|
|
170
|
+
* strategyId) for an assigned block.
|
|
171
|
+
*/
|
|
172
|
+
_isNodeUnassigned() {
|
|
173
|
+
if (!C.hasConfig(this.currentNode))
|
|
174
|
+
return !1;
|
|
175
|
+
const t = C.getConfig(this.currentNode);
|
|
176
|
+
return !t.strategyId && (t.configVersion ?? 0) >= E;
|
|
91
177
|
}
|
|
92
178
|
onDestroy() {
|
|
93
179
|
this._teardown();
|
|
94
180
|
}
|
|
95
181
|
_teardown() {
|
|
96
|
-
this.storeUnsubscription(), this.storeUnsubscription = () => {
|
|
182
|
+
this.store.strategyPanelOpen = !1, this.storeUnsubscription(), this.storeUnsubscription = () => {
|
|
97
183
|
}, this.lastPaintedState = null, this.listeners.forEach(({ element: t, handler: e }) => t.removeEventListener("click", e)), this.listeners = [];
|
|
98
184
|
}
|
|
99
185
|
_setupButtonListeners() {
|
|
100
186
|
const t = this.getContainer();
|
|
101
187
|
if (!t)
|
|
102
188
|
return;
|
|
103
|
-
const e = (a,
|
|
104
|
-
const
|
|
105
|
-
|
|
189
|
+
const e = (a, r) => {
|
|
190
|
+
const s = t.querySelector(a);
|
|
191
|
+
s && (s.addEventListener("click", r), this.listeners.push({ element: s, handler: r }));
|
|
106
192
|
};
|
|
107
|
-
e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-remove-strategy", () => this.store.openRemoveStrategyModal())
|
|
193
|
+
e("#guido__btn-assign-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-create-strategy", () => this.store.openStrategyCreation()), e("#guido__btn-assign-unavailable-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-create-unavailable-strategy", () => this.store.openStrategyCreation()), e("#guido__btn-change-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-change-legacy-strategy", () => this.store.openAssignStrategyDrawer()), e("#guido__btn-remove-strategy", () => this.store.openRemoveStrategyModal()), e("#guido__btn-remove-legacy-strategy", () => this.store.openRemoveStrategyModal()), e("#guido__btn-update-legacy-strategy", () => {
|
|
194
|
+
this.legacyConversion.convertLegacyStrategy();
|
|
195
|
+
});
|
|
108
196
|
}
|
|
109
197
|
_renderState() {
|
|
110
|
-
var
|
|
111
|
-
const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((
|
|
112
|
-
if (
|
|
198
|
+
var f;
|
|
199
|
+
const { strategyId: t } = this.store.recommendationConfigs, e = t ? ((f = this.store.assignedStrategy) == null ? void 0 : f.name) ?? "" : "", a = !!t && !e && (this.store.strategiesLoading || !this.store.strategiesSettled), r = !!t && !e && !a && this.store.strategiesFetched, s = this.store.legacyConversionLoading, g = this.store.isLegacyStrategyBlock, p = [t, e, a, r, s, g].join("\0");
|
|
200
|
+
if (p === this.lastPaintedState)
|
|
113
201
|
return;
|
|
114
202
|
const n = this.getContainer();
|
|
115
203
|
if (!n)
|
|
116
204
|
return;
|
|
117
|
-
const
|
|
118
|
-
!
|
|
205
|
+
const y = n.querySelector("[data-strategy-empty-state]"), u = n.querySelector("[data-strategy-assigned-state]"), c = n.querySelector("[data-strategy-legacy-state]"), h = n.querySelector("[data-strategy-unavailable-state]"), v = n.querySelector("[data-strategy-loading-state]"), b = n.querySelector("[data-strategy-content]"), m = n.querySelector("[data-strategy-name]"), _ = n.querySelector("[data-strategy-name-skeleton]");
|
|
206
|
+
if (!y || !u || !c || !h)
|
|
207
|
+
return;
|
|
208
|
+
v && (v.style.display = "none"), b && (b.style.display = "");
|
|
209
|
+
const k = t ? r ? h : u : g ? c : y;
|
|
210
|
+
[y, u, c, h].forEach((d) => {
|
|
211
|
+
d.style.display = d === k ? "" : "none";
|
|
212
|
+
}), c.querySelectorAll("button").forEach((d) => {
|
|
213
|
+
d.disabled = s;
|
|
214
|
+
}), c.classList.toggle("is-converting", s), !t && this._isNodeUnassigned() && this.onboardingStore.startOnboarding("recommendationStrategyOnboarding");
|
|
215
|
+
const S = this.store.currentRecommendationId;
|
|
216
|
+
g && S !== null && this.store.blockStates[S] && this.onboardingStore.startOnboarding("recommendationLegacyStrategyOnboarding"), m && (m.style.display = a ? "none" : "", t && !a && (m.textContent = e || `#${t}`)), _ && (_.style.display = a ? "block" : "none"), this.lastPaintedState = p;
|
|
119
217
|
}
|
|
120
218
|
}
|
|
121
219
|
export {
|
|
122
|
-
|
|
123
|
-
|
|
220
|
+
I as STRATEGY_CONTROL_ID,
|
|
221
|
+
P as StrategyControl
|
|
124
222
|
};
|
|
@@ -87,21 +87,21 @@ function j(e, t = {}) {
|
|
|
87
87
|
documentModifier: o,
|
|
88
88
|
products: r,
|
|
89
89
|
layout: s,
|
|
90
|
-
composition:
|
|
90
|
+
composition: l
|
|
91
91
|
} = e;
|
|
92
92
|
if (!n || !("querySelector" in n))
|
|
93
93
|
return !1;
|
|
94
|
-
const u = s ?? P(n),
|
|
95
|
-
if (u === "list" || !
|
|
94
|
+
const u = s ?? P(n), i = y.getConfig(n);
|
|
95
|
+
if (u === "list" || !i.mobileLayoutEnabled)
|
|
96
96
|
return te({ currentNode: n, documentModifier: o });
|
|
97
|
-
const c = A(), a = $(r, c.recommendationProducts), f =
|
|
98
|
-
productsPerRow:
|
|
97
|
+
const c = A(), a = $(r, c.recommendationProducts), f = l ?? U(n, c.filterList), p = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${k(a, u, {
|
|
98
|
+
productsPerRow: i.mobileCardsInRow,
|
|
99
99
|
composition: f,
|
|
100
100
|
filterList: c.filterList,
|
|
101
|
-
priceInline: !
|
|
101
|
+
priceInline: !i.priceMovedToNextLine,
|
|
102
102
|
// Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
|
|
103
|
-
cellPadding: v(
|
|
104
|
-
rowSpacingPx:
|
|
103
|
+
cellPadding: v(i.mobileColumnSpacing),
|
|
104
|
+
rowSpacingPx: i.mobileRowSpacing,
|
|
105
105
|
...t
|
|
106
106
|
})}</table></td>`, E = n.querySelector(w);
|
|
107
107
|
return E ? (o.modifyHtml(E).setInnerHtml(p), !0) : (re(n, o, p), !1);
|
|
@@ -115,17 +115,17 @@ function ie(e, t = {}) {
|
|
|
115
115
|
documentModifier: o,
|
|
116
116
|
products: r,
|
|
117
117
|
layout: s,
|
|
118
|
-
composition:
|
|
118
|
+
composition: l
|
|
119
119
|
} = e;
|
|
120
120
|
if (!n || !("querySelector" in n))
|
|
121
121
|
return !1;
|
|
122
122
|
const u = n.querySelector(L) ?? n.querySelector(W);
|
|
123
123
|
if (!u)
|
|
124
124
|
return !1;
|
|
125
|
-
const
|
|
125
|
+
const i = A(), c = $(r, i.recommendationProducts), { cardsInRow: a } = y.getConfig(n), f = l ?? U(n, i.filterList), d = s ?? P(n), p = y.getConfig(n), E = k(c, d, {
|
|
126
126
|
productsPerRow: a,
|
|
127
127
|
composition: f,
|
|
128
|
-
filterList:
|
|
128
|
+
filterList: i.filterList,
|
|
129
129
|
priceInline: !p.priceMovedToNextLine,
|
|
130
130
|
// Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
|
|
131
131
|
cellPadding: v(p.columnSpacing),
|
|
@@ -151,14 +151,14 @@ function ce(e, t, n) {
|
|
|
151
151
|
const r = o.getAttribute(R);
|
|
152
152
|
if (!r)
|
|
153
153
|
return !1;
|
|
154
|
-
const s = A(),
|
|
155
|
-
c &&
|
|
154
|
+
const s = A(), l = r.split(",").filter(Boolean), u = D(l, o, s.filterList), i = [], c = u.join(",") !== l.join(",");
|
|
155
|
+
c && i.push([R, u.join(",")]);
|
|
156
156
|
const a = le(
|
|
157
157
|
o.getAttribute(q)
|
|
158
158
|
), f = a && z(a, o, s.filterList);
|
|
159
|
-
if (a && f && f.join(",") !== a.join(",") &&
|
|
159
|
+
if (a && f && f.join(",") !== a.join(",") && i.push([q, JSON.stringify(f)]), i.length === 0)
|
|
160
160
|
return !1;
|
|
161
|
-
if (
|
|
161
|
+
if (i.forEach(([d, p]) => {
|
|
162
162
|
t.modifyHtml(o).setAttribute(d, p);
|
|
163
163
|
}), c && y.hasConfig(e)) {
|
|
164
164
|
const d = {
|
|
@@ -176,20 +176,20 @@ function Te(e) {
|
|
|
176
176
|
afterRegenerate: o,
|
|
177
177
|
products: r,
|
|
178
178
|
layout: s,
|
|
179
|
-
composition:
|
|
179
|
+
composition: l,
|
|
180
180
|
skipStylePreservation: u
|
|
181
181
|
} = e;
|
|
182
182
|
if (!t)
|
|
183
|
-
return;
|
|
184
|
-
const
|
|
183
|
+
return !1;
|
|
184
|
+
const i = u ? {} : x(t), c = {
|
|
185
185
|
currentNode: t,
|
|
186
186
|
documentModifier: n,
|
|
187
187
|
products: r,
|
|
188
188
|
layout: s,
|
|
189
|
-
composition:
|
|
189
|
+
composition: l
|
|
190
190
|
};
|
|
191
|
-
let a = ie(c,
|
|
192
|
-
a = j(c,
|
|
191
|
+
let a = ie(c, i);
|
|
192
|
+
return a = j(c, i) || a, a && (ce(t, n, l), n.apply(new S("Regenerate products with styles"))), o == null || o(), a;
|
|
193
193
|
}
|
|
194
194
|
function Re(e, t) {
|
|
195
195
|
return e.length === t ? e : e.length > t ? e.slice(0, t) : [...e, ...H(t - e.length)];
|
|
@@ -213,28 +213,28 @@ function T(e, t = "price") {
|
|
|
213
213
|
});
|
|
214
214
|
}
|
|
215
215
|
function ue(e) {
|
|
216
|
-
var s,
|
|
217
|
-
const t = F(), n = ((s = e.original_price) == null ? void 0 : s[t.code]) ?? Object.values(e.original_price ?? {})[0] ?? 0, o = ((
|
|
216
|
+
var s, l;
|
|
217
|
+
const t = F(), n = ((s = e.original_price) == null ? void 0 : s[t.code]) ?? Object.values(e.original_price ?? {})[0] ?? 0, o = ((l = e.price) == null ? void 0 : l[t.code]) ?? Object.values(e.price ?? {})[0] ?? 0, r = n > 0 ? Math.round((n - o) / n * 100) : 0;
|
|
218
218
|
return r > 0 ? `-${r}%` : "0%";
|
|
219
219
|
}
|
|
220
220
|
function K(e) {
|
|
221
|
-
const { documentModifier: t, product: n, priceEl: o, oldPriceEl: r, omnibusPriceEl: s, omnibusDiscountEl:
|
|
221
|
+
const { documentModifier: t, product: n, priceEl: o, oldPriceEl: r, omnibusPriceEl: s, omnibusDiscountEl: l } = e;
|
|
222
222
|
let u = !1;
|
|
223
223
|
if (o && "querySelector" in o) {
|
|
224
|
-
const
|
|
225
|
-
b(t,
|
|
224
|
+
const i = o.querySelector("strong") ?? o.querySelector("p"), c = T(n, "price");
|
|
225
|
+
b(t, i ?? null, c) && (u = !0);
|
|
226
226
|
}
|
|
227
227
|
if (r && "querySelector" in r) {
|
|
228
|
-
const
|
|
229
|
-
b(t,
|
|
228
|
+
const i = r.querySelector("strong") ?? r.querySelector("p"), c = T(n, "original_price");
|
|
229
|
+
b(t, i ?? null, c) && (u = !0), t.modifyHtml(r).setAttribute("data-same-price", String(Q(n))), u = !0;
|
|
230
230
|
}
|
|
231
231
|
if (s && "querySelector" in s) {
|
|
232
|
-
const
|
|
233
|
-
b(t,
|
|
232
|
+
const i = s.querySelector(".omnibus-price-value") ?? null, c = T(n, "original_price");
|
|
233
|
+
b(t, i, c) && (u = !0);
|
|
234
234
|
}
|
|
235
|
-
if (
|
|
236
|
-
const
|
|
237
|
-
b(t,
|
|
235
|
+
if (l && "querySelector" in l) {
|
|
236
|
+
const i = l.querySelector(".omnibus-discount-value") ?? null, c = ue(n);
|
|
237
|
+
b(t, i, c) && (u = !0);
|
|
238
238
|
}
|
|
239
239
|
return u;
|
|
240
240
|
}
|
|
@@ -245,9 +245,9 @@ function se(e) {
|
|
|
245
245
|
imageEl: o,
|
|
246
246
|
nameEl: r,
|
|
247
247
|
priceEl: s,
|
|
248
|
-
oldPriceEl:
|
|
248
|
+
oldPriceEl: l,
|
|
249
249
|
omnibusPriceEl: u,
|
|
250
|
-
omnibusDiscountEl:
|
|
250
|
+
omnibusDiscountEl: i,
|
|
251
251
|
buttonEl: c
|
|
252
252
|
} = e;
|
|
253
253
|
let a = !1;
|
|
@@ -265,9 +265,9 @@ function se(e) {
|
|
|
265
265
|
documentModifier: t,
|
|
266
266
|
product: n,
|
|
267
267
|
priceEl: s,
|
|
268
|
-
oldPriceEl:
|
|
268
|
+
oldPriceEl: l,
|
|
269
269
|
omnibusPriceEl: u,
|
|
270
|
-
omnibusDiscountEl:
|
|
270
|
+
omnibusDiscountEl: i
|
|
271
271
|
}) && (a = !0), c && "querySelector" in c) {
|
|
272
272
|
const f = c.querySelector("a.es-button") || c.querySelector("a");
|
|
273
273
|
f && (t.modifyHtml(f).setAttribute("href", n.url), a = !0);
|
|
@@ -296,19 +296,19 @@ function fe(e, t, n) {
|
|
|
296
296
|
if (o.length === 0)
|
|
297
297
|
return !1;
|
|
298
298
|
const r = /* @__PURE__ */ new Map();
|
|
299
|
-
o.forEach((
|
|
300
|
-
if (!("getAttribute" in
|
|
299
|
+
o.forEach((l) => {
|
|
300
|
+
if (!("getAttribute" in l))
|
|
301
301
|
return;
|
|
302
|
-
const u =
|
|
302
|
+
const u = l.getAttribute(Y);
|
|
303
303
|
if (!u)
|
|
304
304
|
return;
|
|
305
|
-
const
|
|
306
|
-
|
|
305
|
+
const i = r.get(u) ?? [];
|
|
306
|
+
i.push(l), r.set(u, i);
|
|
307
307
|
});
|
|
308
308
|
let s = !1;
|
|
309
|
-
return r.forEach((
|
|
310
|
-
const
|
|
311
|
-
|
|
309
|
+
return r.forEach((l, u) => {
|
|
310
|
+
const i = Math.min(l.length, n.length);
|
|
311
|
+
l.slice(0, i).forEach((c, a) => {
|
|
312
312
|
if (!("querySelector" in c))
|
|
313
313
|
return;
|
|
314
314
|
const f = ae(u, n[a]);
|
|
@@ -328,11 +328,11 @@ function O(e, t, n) {
|
|
|
328
328
|
`[esd-extension-block-id="${m.NAME}"]`
|
|
329
329
|
), s = e.querySelectorAll(
|
|
330
330
|
`[esd-extension-block-id="${m.PRICE}"]`
|
|
331
|
-
),
|
|
331
|
+
), l = e.querySelectorAll(
|
|
332
332
|
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
333
333
|
), u = e.querySelectorAll(
|
|
334
334
|
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
335
|
-
),
|
|
335
|
+
), i = e.querySelectorAll(
|
|
336
336
|
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
337
337
|
), c = e.querySelectorAll(
|
|
338
338
|
`[esd-extension-block-id="${m.BUTTON}"]`
|
|
@@ -345,9 +345,9 @@ function O(e, t, n) {
|
|
|
345
345
|
imageEl: o[d] ?? null,
|
|
346
346
|
nameEl: r[d] ?? null,
|
|
347
347
|
priceEl: s[d] ?? null,
|
|
348
|
-
oldPriceEl:
|
|
348
|
+
oldPriceEl: l[d] ?? null,
|
|
349
349
|
omnibusPriceEl: u[d] ?? null,
|
|
350
|
-
omnibusDiscountEl:
|
|
350
|
+
omnibusDiscountEl: i[d] ?? null,
|
|
351
351
|
buttonEl: c[d] ?? null
|
|
352
352
|
});
|
|
353
353
|
f = f || p;
|
|
@@ -355,28 +355,28 @@ function O(e, t, n) {
|
|
|
355
355
|
return fe(e, t, n) && (f = !0), f;
|
|
356
356
|
}
|
|
357
357
|
function qe(e) {
|
|
358
|
-
const { currentNode: t, documentModifier: n, products: o } = e;
|
|
358
|
+
const { currentNode: t, documentModifier: n, products: o, onApplied: r } = e;
|
|
359
359
|
if (!t || !("querySelectorAll" in t))
|
|
360
360
|
return !1;
|
|
361
|
-
const
|
|
362
|
-
if (!("querySelectorAll" in
|
|
361
|
+
const s = V(t);
|
|
362
|
+
if (!("querySelectorAll" in s) || s.querySelectorAll(
|
|
363
363
|
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
364
364
|
).length !== o.length)
|
|
365
365
|
return !1;
|
|
366
|
-
let
|
|
367
|
-
const
|
|
368
|
-
if (
|
|
369
|
-
const
|
|
370
|
-
if (
|
|
371
|
-
const
|
|
372
|
-
|
|
366
|
+
let u = O(s, n, o);
|
|
367
|
+
const i = P(t), c = y.getConfig(t);
|
|
368
|
+
if (i !== "list" && c.mobileLayoutEnabled && "querySelector" in t) {
|
|
369
|
+
const a = t.querySelector(N);
|
|
370
|
+
if (a) {
|
|
371
|
+
const f = O(
|
|
372
|
+
a,
|
|
373
373
|
n,
|
|
374
374
|
o
|
|
375
375
|
);
|
|
376
|
-
|
|
376
|
+
u = u || f;
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
return
|
|
379
|
+
return u && (n.apply(new S("Updated product content in-place")), r == null || r()), !0;
|
|
380
380
|
}
|
|
381
381
|
function _(e, t, n) {
|
|
382
382
|
if (!("querySelectorAll" in e))
|
|
@@ -387,10 +387,10 @@ function _(e, t, n) {
|
|
|
387
387
|
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
388
388
|
), s = e.querySelectorAll(
|
|
389
389
|
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
390
|
-
),
|
|
390
|
+
), l = e.querySelectorAll(
|
|
391
391
|
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
392
392
|
), u = Math.min(o.length, n.length);
|
|
393
|
-
let
|
|
393
|
+
let i = !1;
|
|
394
394
|
for (let c = 0; c < u; c++)
|
|
395
395
|
K({
|
|
396
396
|
documentModifier: t,
|
|
@@ -398,9 +398,9 @@ function _(e, t, n) {
|
|
|
398
398
|
priceEl: o[c] ?? null,
|
|
399
399
|
oldPriceEl: r[c] ?? null,
|
|
400
400
|
omnibusPriceEl: s[c] ?? null,
|
|
401
|
-
omnibusDiscountEl:
|
|
402
|
-
}) && (
|
|
403
|
-
return
|
|
401
|
+
omnibusDiscountEl: l[c] ?? null
|
|
402
|
+
}) && (i = !0);
|
|
403
|
+
return i;
|
|
404
404
|
}
|
|
405
405
|
function Me(e) {
|
|
406
406
|
const { currentNode: t, documentModifier: n } = e;
|
|
@@ -412,25 +412,25 @@ function Me(e) {
|
|
|
412
412
|
if (r.length === 0)
|
|
413
413
|
return !1;
|
|
414
414
|
const s = V(t);
|
|
415
|
-
let
|
|
416
|
-
const u = P(t),
|
|
417
|
-
if (u !== "list" &&
|
|
415
|
+
let l = _(s, n, r);
|
|
416
|
+
const u = P(t), i = y.getConfig(t);
|
|
417
|
+
if (u !== "list" && i.mobileLayoutEnabled && "querySelector" in t) {
|
|
418
418
|
const c = t.querySelector(N);
|
|
419
419
|
if (c) {
|
|
420
420
|
const a = _(c, n, r);
|
|
421
|
-
|
|
421
|
+
l = l || a;
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
|
-
return
|
|
424
|
+
return l && n.apply(new S("Updated price formatting in-place")), l;
|
|
425
425
|
}
|
|
426
426
|
function he(e) {
|
|
427
427
|
const { currentNode: t, documentModifier: n, currency: o } = e, r = C(t);
|
|
428
428
|
if (!r)
|
|
429
429
|
return;
|
|
430
|
-
const s = o.alignment === "before" ? "0" : "1",
|
|
431
|
-
n.modifyHtml(r).setAttribute(u,
|
|
430
|
+
const s = o.alignment === "before" ? "0" : "1", l = (u, i) => {
|
|
431
|
+
n.modifyHtml(r).setAttribute(u, i);
|
|
432
432
|
};
|
|
433
|
-
|
|
433
|
+
l(g.CURRENCY, o.code), l(g.SYMBOL, o.symbol), l(g.ALIGNMENT, s), l(g.THOUSAND_SEPARATOR, o.thousandSeparator), l(g.DECIMAL_SEPARATOR, o.decimalSeparator), l(g.DECIMAL_COUNT, o.decimalCount.toString()), n.apply(new S("Update currency attributes"));
|
|
434
434
|
}
|
|
435
435
|
export {
|
|
436
436
|
Re as adjustProductsToSize,
|