@useinsider/guido 3.19.0-beta.3abc7c5 → 3.19.0-beta.3daecd0
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 +0 -1
- package/dist/@types/config/schemas.js +118 -107
- package/dist/components/Guido.vue.js +9 -9
- package/dist/components/Guido.vue2.js +84 -75
- package/dist/components/organisms/AutoSaveController.vue2.js +8 -9
- package/dist/components/organisms/base/AuthErrorModal.vue.js +18 -0
- package/dist/components/organisms/base/AuthErrorModal.vue2.js +42 -0
- package/dist/components/organisms/header/EditorActions.vue.js +5 -5
- package/dist/components/organisms/header/EditorActions.vue2.js +55 -85
- package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
- package/dist/components/organisms/header/LeftSlot.vue2.js +12 -16
- package/dist/components/wrappers/WpDrawer.vue.js +7 -9
- 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/useAuthError.js +52 -0
- package/dist/composables/useAutoSave.js +11 -11
- package/dist/composables/useCortexBlueprintBridge.js +122 -54
- package/dist/composables/useEmailTemplateApplier.js +111 -50
- package/dist/composables/useHtmlCompiler.js +26 -37
- package/dist/composables/useHtmlValidator.js +0 -2
- package/dist/composables/useHttp.js +64 -54
- package/dist/composables/useLegacyStrategyConversion.js +23 -19
- package/dist/composables/useSave.js +45 -90
- package/dist/composables/useStripo.js +24 -20
- package/dist/composables/useToaster.js +17 -15
- package/dist/composables/validators/useCouponBlockValidator.js +21 -24
- package/dist/composables/validators/useLiquidValidator.js +15 -15
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +27 -34
- 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 +30 -29
- package/dist/extensions/Blocks/Items/block.js +48 -45
- 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 +15 -14
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +45 -38
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +72 -49
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +32 -38
- package/dist/extensions/Blocks/Recommendation/utils/partnerCustomizations.js +3 -1
- package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +25 -0
- package/dist/guido.css +1 -1
- package/dist/src/@types/config/schemas.d.ts +16 -4
- package/dist/src/components/Guido.vue.d.ts +1 -17
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -17
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -17
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -17
- package/dist/src/components/wrappers/WpDrawer.vue.d.ts +3 -4
- package/dist/src/components/wrappers/WpModal.vue.d.ts +5 -1
- package/dist/src/composables/useAuthError.d.ts +12 -0
- package/dist/src/composables/useConfig.d.ts +2 -2
- 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 +0 -21
- package/dist/src/composables/useHttp.d.ts +2 -0
- package/dist/src/composables/useSave.d.ts +1 -6
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +0 -3
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +0 -10
- 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 +1 -1
- 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/store/recommendation.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +33 -0
- package/dist/src/mock/cortexChatStore.d.ts +12 -0
- package/dist/src/stores/config.d.ts +20 -32
- package/dist/src/stores/guido-email-editor.d.ts +20 -10
- package/dist/src/stores/onboarding.d.ts +4 -0
- package/dist/src/stores/recommendation.d.ts +5 -0
- package/dist/src/utils/dateUtil.d.ts +10 -0
- package/dist/src/utils/genericUtil.d.ts +3 -0
- package/dist/src/utils/templatePreparation.d.ts +0 -30
- package/dist/static/styles/components/recommendation-strategy.css.js +9 -0
- package/dist/static/styles/components/version-history.css.js +2 -6
- package/dist/stores/config.js +67 -84
- package/dist/stores/guido-email-editor.js +3 -1
- package/dist/stores/onboarding.js +4 -0
- package/dist/utils/pairProductVariables.js +71 -71
- package/dist/utils/templatePreparation.js +36 -39
- package/package.json +1 -1
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +0 -20
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +0 -48
- package/dist/composables/useSaveValidation.js +0 -279
- package/dist/composables/useSaveValidationRollout.js +0 -9
- package/dist/enums/save-validation.js +0 -4
- package/dist/src/@types/save-validation.d.ts +0 -19
- package/dist/src/composables/useSaveValidation.d.ts +0 -6
- package/dist/src/composables/useSaveValidationRollout.d.ts +0 -3
- package/dist/src/enums/save-validation.d.ts +0 -27
- package/dist/src/stores/save-validation.d.ts +0 -22
- package/dist/stores/save-validation.js +0 -30
- /package/dist/src/components/organisms/{validation/ValidationErrorDrawer.vue.d.ts → base/AuthErrorModal.vue.d.ts} +0 -0
|
@@ -3,12 +3,22 @@
|
|
|
3
3
|
* en-US -> MM/DD/YYYY
|
|
4
4
|
* en-GB -> DD/MM/YYYY
|
|
5
5
|
* tr-TR -> DD.MM.YYYY
|
|
6
|
+
*
|
|
7
|
+
* The non-string branches below are unreachable: the only caller chain is
|
|
8
|
+
* formatShortDate -> AssignStrategyDrawer.vue:74, which passes a non-empty string.
|
|
9
|
+
* The function itself is live — do not delete it with them.
|
|
6
10
|
*/
|
|
7
11
|
export declare const convertToDateObject: (date: string | number | Date | null | undefined) => Date;
|
|
8
12
|
export declare const locale: () => string;
|
|
9
13
|
export declare const localTz: string;
|
|
10
14
|
export declare const timezone: () => string;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated No caller in src/ and not exported from library.ts. Slated for deletion, see the SD-667788 dead-code ledger.
|
|
17
|
+
*/
|
|
11
18
|
export declare const hour12: () => boolean;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated No caller in src/ and not exported from library.ts. Slated for deletion, see the SD-667788 dead-code ledger.
|
|
21
|
+
*/
|
|
12
22
|
export declare const dateFormat: () => string;
|
|
13
23
|
/**
|
|
14
24
|
* @example 04/22/2024
|
|
@@ -24,6 +24,9 @@ export declare const getCsrfToken: () => string;
|
|
|
24
24
|
*/
|
|
25
25
|
export declare const getUrlParams: () => URLSearchParams;
|
|
26
26
|
export declare const getUrlParam: (paramName: string, defaultValue?: string) => string;
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated No caller in src/. Slated for deletion, see the SD-667788 dead-code ledger.
|
|
29
|
+
*/
|
|
27
30
|
export declare const replaceString: (string?: string, values?: Record<string, string | number>, isRemoveEmptyValues?: boolean) => string;
|
|
28
31
|
/**
|
|
29
32
|
* Narrows an unknown API value to a printable string; anything that is neither
|
|
@@ -15,36 +15,6 @@ import type { SavedTemplateDetails } from '@@/Types/stripo';
|
|
|
15
15
|
* same source), so it is reliably present regardless of how the block was added.
|
|
16
16
|
*/
|
|
17
17
|
export declare function getHtmlReferencedUnsubscribePages(html: string): number[];
|
|
18
|
-
/**
|
|
19
|
-
* Hydrates the recommendation extension store from the persisted `esd-ext-config`
|
|
20
|
-
* JSON blob on each `.recommendation-block-v2` element in the raw editor HTML.
|
|
21
|
-
*
|
|
22
|
-
* Why this runs before `compileHtml`:
|
|
23
|
-
* The HTML compiler's `prepareRecommendationBlocks` rule asks
|
|
24
|
-
* `useRecommendation.buildCampaignUrl(id)` to assemble each block's API URL
|
|
25
|
-
* from `blockStates[id].recommendationConfigs`. That Pinia entry is normally
|
|
26
|
-
* populated by `RecommendationBlockControl._syncNodeConfigToStore`, which
|
|
27
|
-
* only fires when the user *selects* the block. Saving without ever
|
|
28
|
-
* selecting a migrated block would otherwise build the URL from empty/
|
|
29
|
-
* default state and the campaign URL would not be saved.
|
|
30
|
-
*
|
|
31
|
-
* Why we read raw HTML, not compiled HTML:
|
|
32
|
-
* Stripo's `compileEmail()` strips editor-only attributes (`esd-*`) from the
|
|
33
|
-
* compiled output, so `esd-ext-config` is gone by the time the compiler
|
|
34
|
-
* pipeline sees the HTML. The raw HTML from `getTemplateData()` preserves
|
|
35
|
-
* the attribute as the migrator wrote it.
|
|
36
|
-
*
|
|
37
|
-
* Reference data pre-load:
|
|
38
|
-
* When the template has recommendation blocks, this also pre-loads the
|
|
39
|
-
* shared reference data (languages / currency list) so the save-time
|
|
40
|
-
* required-fields validator can check each block's locale and currency
|
|
41
|
-
* against the partner's real options. Best-effort — on a fetch failure the
|
|
42
|
-
* validator degrades to its empty-list guard (`requiredFields.ts`) instead
|
|
43
|
-
* of blocking the save or stranding the Save button.
|
|
44
|
-
*/
|
|
45
|
-
declare function hydrateRecommendationStoreFromRawHtml(rawHtml: string): Promise<void>;
|
|
46
18
|
export declare const useTemplatePreparation: () => {
|
|
47
19
|
prepareTemplateDetails: () => Promise<Omit<SavedTemplateDetails, "metadata">>;
|
|
48
|
-
hydrateRecommendationStore: typeof hydrateRecommendationStoreFromRawHtml;
|
|
49
20
|
};
|
|
50
|
-
export {};
|
|
@@ -52,6 +52,15 @@ const n = `.strategy-control-header {
|
|
|
52
52
|
mask-size: 24px 24px;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
.strategy-control-notice--error {
|
|
56
|
+
border-color: var(--guido-color-border-onpage-message-error);
|
|
57
|
+
background-color: var(--guido-color-background-onpage-message-error);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.strategy-control-notice--error::before {
|
|
61
|
+
background-color: var(--guido-color-border-onpage-message-error);
|
|
62
|
+
}
|
|
63
|
+
|
|
55
64
|
.strategy-control-notice-text {
|
|
56
65
|
margin: 0;
|
|
57
66
|
padding: 4px 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const r = `.patch-session-container {
|
|
2
2
|
row-gap: 16px;
|
|
3
3
|
}
|
|
4
4
|
|
|
@@ -28,11 +28,7 @@ ue-vh-patch.selected .patch-wrapper {
|
|
|
28
28
|
.change-history-panel-wrapper .control-panel-header {
|
|
29
29
|
padding: 16px 0 16px 16px;
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
.change-history-panel-wrapper .header-control-panel-label {
|
|
33
|
-
grid-area: 1 / 1 / 2 / 12;
|
|
34
|
-
}
|
|
35
31
|
`;
|
|
36
32
|
export {
|
|
37
|
-
|
|
33
|
+
r as default
|
|
38
34
|
};
|
package/dist/stores/config.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../@types/config/schemas.js";
|
|
2
2
|
import "../@types/config/defaults.js";
|
|
3
|
-
import { parseConfig as
|
|
4
|
-
import { defineStore as
|
|
5
|
-
const
|
|
3
|
+
import { parseConfig as o } from "../@types/config/validator.js";
|
|
4
|
+
import { defineStore as a } from "pinia";
|
|
5
|
+
const s = a("guido-config", {
|
|
6
6
|
state: () => ({
|
|
7
7
|
initialized: !1,
|
|
8
8
|
config: null
|
|
@@ -11,152 +11,135 @@ const g = o("guido-config", {
|
|
|
11
11
|
/**
|
|
12
12
|
* Get the identity configuration
|
|
13
13
|
*/
|
|
14
|
-
identity: (
|
|
15
|
-
var
|
|
16
|
-
return ((
|
|
14
|
+
identity: (e) => {
|
|
15
|
+
var i;
|
|
16
|
+
return ((i = e.config) == null ? void 0 : i.identity) ?? null;
|
|
17
17
|
},
|
|
18
18
|
/**
|
|
19
19
|
* Get the partner configuration
|
|
20
20
|
*/
|
|
21
|
-
partner: (
|
|
22
|
-
var
|
|
23
|
-
return ((
|
|
21
|
+
partner: (e) => {
|
|
22
|
+
var i;
|
|
23
|
+
return ((i = e.config) == null ? void 0 : i.partner) ?? null;
|
|
24
24
|
},
|
|
25
25
|
/**
|
|
26
26
|
* Get the template configuration
|
|
27
27
|
*/
|
|
28
|
-
template: (
|
|
29
|
-
var
|
|
30
|
-
return ((
|
|
28
|
+
template: (e) => {
|
|
29
|
+
var i;
|
|
30
|
+
return ((i = e.config) == null ? void 0 : i.template) ?? null;
|
|
31
31
|
},
|
|
32
32
|
/**
|
|
33
33
|
* Get the editor configuration
|
|
34
34
|
*/
|
|
35
|
-
editor: (
|
|
36
|
-
var
|
|
37
|
-
return ((
|
|
35
|
+
editor: (e) => {
|
|
36
|
+
var i;
|
|
37
|
+
return ((i = e.config) == null ? void 0 : i.editor) ?? null;
|
|
38
38
|
},
|
|
39
39
|
/**
|
|
40
40
|
* Get the UI configuration
|
|
41
41
|
*/
|
|
42
|
-
ui: (
|
|
43
|
-
var
|
|
44
|
-
return ((
|
|
42
|
+
ui: (e) => {
|
|
43
|
+
var i;
|
|
44
|
+
return ((i = e.config) == null ? void 0 : i.ui) ?? null;
|
|
45
45
|
},
|
|
46
46
|
/**
|
|
47
47
|
* Get the features configuration
|
|
48
48
|
*/
|
|
49
|
-
features: (
|
|
50
|
-
var
|
|
51
|
-
return ((
|
|
49
|
+
features: (e) => {
|
|
50
|
+
var i;
|
|
51
|
+
return ((i = e.config) == null ? void 0 : i.features) ?? null;
|
|
52
52
|
},
|
|
53
53
|
/**
|
|
54
54
|
* Get the blocks configuration
|
|
55
55
|
*/
|
|
56
|
-
blocks: (
|
|
57
|
-
var
|
|
58
|
-
return ((
|
|
56
|
+
blocks: (e) => {
|
|
57
|
+
var i;
|
|
58
|
+
return ((i = e.config) == null ? void 0 : i.blocks) ?? null;
|
|
59
59
|
},
|
|
60
60
|
/**
|
|
61
61
|
* Get the compiler configuration
|
|
62
62
|
*/
|
|
63
|
-
compiler: (
|
|
64
|
-
var
|
|
65
|
-
return ((
|
|
63
|
+
compiler: (e) => {
|
|
64
|
+
var i;
|
|
65
|
+
return ((i = e.config) == null ? void 0 : i.compiler) ?? null;
|
|
66
66
|
},
|
|
67
67
|
/**
|
|
68
68
|
* Get the callbacks configuration
|
|
69
69
|
*/
|
|
70
|
-
callbacks: (
|
|
71
|
-
var
|
|
72
|
-
return ((
|
|
70
|
+
callbacks: (e) => {
|
|
71
|
+
var i;
|
|
72
|
+
return ((i = e.config) == null ? void 0 : i.callbacks) ?? null;
|
|
73
73
|
},
|
|
74
74
|
/**
|
|
75
75
|
* Get the template ID
|
|
76
76
|
*/
|
|
77
|
-
templateId: (
|
|
78
|
-
var
|
|
79
|
-
return ((t = (
|
|
77
|
+
templateId: (e) => {
|
|
78
|
+
var i, t;
|
|
79
|
+
return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.templateId) ?? "";
|
|
80
80
|
},
|
|
81
81
|
/**
|
|
82
82
|
* Get the user ID
|
|
83
83
|
*/
|
|
84
|
-
userId: (
|
|
85
|
-
var
|
|
86
|
-
return ((t = (
|
|
84
|
+
userId: (e) => {
|
|
85
|
+
var i, t;
|
|
86
|
+
return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.userId) ?? "";
|
|
87
87
|
},
|
|
88
88
|
/**
|
|
89
89
|
* Get the variation ID
|
|
90
90
|
*/
|
|
91
|
-
variationId: (
|
|
92
|
-
var
|
|
93
|
-
return ((t = (
|
|
91
|
+
variationId: (e) => {
|
|
92
|
+
var i, t;
|
|
93
|
+
return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.variationId) ?? "";
|
|
94
94
|
},
|
|
95
95
|
/**
|
|
96
96
|
* Get the campaign ID
|
|
97
97
|
*/
|
|
98
|
-
campaignId: (
|
|
99
|
-
var
|
|
100
|
-
return ((t = (
|
|
98
|
+
campaignId: (e) => {
|
|
99
|
+
var i, t;
|
|
100
|
+
return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.campaignId) ?? "";
|
|
101
101
|
},
|
|
102
102
|
/**
|
|
103
103
|
* Get the template-library ID of the host template
|
|
104
104
|
*/
|
|
105
|
-
templateLibraryId: (
|
|
106
|
-
var
|
|
107
|
-
return ((t = (
|
|
105
|
+
templateLibraryId: (e) => {
|
|
106
|
+
var i, t;
|
|
107
|
+
return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.templateLibraryId) ?? "";
|
|
108
108
|
},
|
|
109
109
|
/**
|
|
110
110
|
* Get the partner name
|
|
111
111
|
*/
|
|
112
|
-
partnerName: (
|
|
113
|
-
var
|
|
114
|
-
return ((t = (
|
|
112
|
+
partnerName: (e) => {
|
|
113
|
+
var i, t;
|
|
114
|
+
return ((t = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : t.name) ?? "";
|
|
115
115
|
},
|
|
116
116
|
/**
|
|
117
117
|
* Get the product type
|
|
118
118
|
*/
|
|
119
|
-
productType: (
|
|
120
|
-
var
|
|
121
|
-
return ((t = (
|
|
119
|
+
productType: (e) => {
|
|
120
|
+
var i, t;
|
|
121
|
+
return ((t = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : t.productType) ?? 60;
|
|
122
122
|
},
|
|
123
123
|
/**
|
|
124
124
|
* Get the message type
|
|
125
125
|
*/
|
|
126
|
-
messageType: (
|
|
127
|
-
var
|
|
128
|
-
return ((t = (
|
|
129
|
-
},
|
|
130
|
-
/**
|
|
131
|
-
* Transactional campaigns keep the hard save block. Reactive getter, so
|
|
132
|
-
* consumers stay safe in setup where a raw config read snapshots null (SD-147945).
|
|
133
|
-
*/
|
|
134
|
-
isTransactional() {
|
|
135
|
-
return this.messageType === r.TRANSACTIONAL;
|
|
136
|
-
},
|
|
137
|
-
/**
|
|
138
|
-
* Soft-save policy: may the editor persist a template with validation errors?
|
|
139
|
-
* Default true (host sets features.allowSaveWithErrors=false for transactional +
|
|
140
|
-
* unsub). Reactive getter defaulting true — reading via isFeatureEnabled would
|
|
141
|
-
* floor to false pre-init and momentarily hide the soft-save option (SD-147430).
|
|
142
|
-
*/
|
|
143
|
-
allowSaveWithErrors() {
|
|
144
|
-
var i;
|
|
145
|
-
return ((i = this.features) == null ? void 0 : i.allowSaveWithErrors) ?? !0;
|
|
126
|
+
messageType: (e) => {
|
|
127
|
+
var i, t;
|
|
128
|
+
return ((t = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : t.messageType) ?? 1;
|
|
146
129
|
},
|
|
147
130
|
/**
|
|
148
131
|
* Get the username
|
|
149
132
|
*/
|
|
150
|
-
username: (
|
|
151
|
-
var
|
|
152
|
-
return ((t = (
|
|
133
|
+
username: (e) => {
|
|
134
|
+
var i, t;
|
|
135
|
+
return ((t = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : t.username) ?? "Guido User";
|
|
153
136
|
},
|
|
154
137
|
/**
|
|
155
138
|
* Check if header should be shown
|
|
156
139
|
*/
|
|
157
|
-
showHeader: (
|
|
158
|
-
var
|
|
159
|
-
return ((t = (
|
|
140
|
+
showHeader: (e) => {
|
|
141
|
+
var i, t;
|
|
142
|
+
return ((t = (i = e.config) == null ? void 0 : i.ui) == null ? void 0 : t.showHeader) ?? !0;
|
|
160
143
|
},
|
|
161
144
|
/**
|
|
162
145
|
* Check if a specific feature is enabled.
|
|
@@ -164,18 +147,18 @@ const g = o("guido-config", {
|
|
|
164
147
|
* flash on during loading, then disappear once config resolves.
|
|
165
148
|
*/
|
|
166
149
|
// eslint-disable-next-line @stylistic/max-len
|
|
167
|
-
isFeatureEnabled: (
|
|
150
|
+
isFeatureEnabled: (e) => (i) => {
|
|
168
151
|
var t, n;
|
|
169
|
-
return ((n = (t =
|
|
152
|
+
return ((n = (t = e.config) == null ? void 0 : t.features) == null ? void 0 : n[i]) ?? !1;
|
|
170
153
|
}
|
|
171
154
|
},
|
|
172
155
|
actions: {
|
|
173
156
|
/**
|
|
174
157
|
* Initialize the config store with validated configuration
|
|
175
158
|
*/
|
|
176
|
-
init(
|
|
177
|
-
const
|
|
178
|
-
this.config =
|
|
159
|
+
init(e) {
|
|
160
|
+
const i = o(e);
|
|
161
|
+
this.config = i, this.initialized = !0;
|
|
179
162
|
},
|
|
180
163
|
/**
|
|
181
164
|
* Reset the config store
|
|
@@ -186,5 +169,5 @@ const g = o("guido-config", {
|
|
|
186
169
|
}
|
|
187
170
|
});
|
|
188
171
|
export {
|
|
189
|
-
|
|
172
|
+
s as useConfigStore
|
|
190
173
|
};
|
|
@@ -20,8 +20,10 @@ const t = () => ({
|
|
|
20
20
|
}), c = s("guidoOnboarding", {
|
|
21
21
|
state: () => a(),
|
|
22
22
|
getters: {
|
|
23
|
+
/** @deprecated Components use the type-specific getters. Slated for deletion, see the SD-667788 dead-code ledger. */
|
|
23
24
|
getOnboarding: (n) => (o) => n.onboardings[o],
|
|
24
25
|
isActive: (n) => (o) => n.onboardings[o].isActive,
|
|
26
|
+
/** @deprecated Components use getGenericCurrentCard / getTextBlockCurrentCard. Slated for deletion, see the SD-667788 dead-code ledger. */
|
|
25
27
|
getCurrentCard: (n) => (o) => {
|
|
26
28
|
const i = n.onboardings[o];
|
|
27
29
|
return i.config[i.cardIndex];
|
|
@@ -81,6 +83,7 @@ const t = () => ({
|
|
|
81
83
|
previous(n) {
|
|
82
84
|
this.onboardings[n].cardIndex > 0 && this.onboardings[n].cardIndex--;
|
|
83
85
|
},
|
|
86
|
+
/** @deprecated No caller in src/. Slated for deletion, see the SD-667788 dead-code ledger. */
|
|
84
87
|
updateCardPosition(n, o, i) {
|
|
85
88
|
const r = this.onboardings[n].config[o];
|
|
86
89
|
r && (r.top = i.top, r.position = i.position);
|
|
@@ -97,6 +100,7 @@ const t = () => ({
|
|
|
97
100
|
async onNewVersionPopupClose() {
|
|
98
101
|
await this.setUserModalState("newVersionPopup", "true", "Guido");
|
|
99
102
|
},
|
|
103
|
+
/** @deprecated No caller in src/. Slated for deletion, see the SD-667788 dead-code ledger. */
|
|
100
104
|
isOnboardingActive() {
|
|
101
105
|
return Object.values(this.onboardings).some((n) => n.isActive);
|
|
102
106
|
},
|
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
import { ITEMS_CURRENCY_ATTR as
|
|
2
|
-
import { productPairs as
|
|
1
|
+
import { ITEMS_CURRENCY_ATTR as x, isCustomCurrencySymbol as Y } from "../extensions/Blocks/Items/constants/currency.js";
|
|
2
|
+
import { productPairs as w } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
3
3
|
import { escapeReplacement as X } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
|
|
4
|
-
import { preserveTextStyles as
|
|
5
|
-
import { unwrapProductNameLinks as
|
|
6
|
-
const
|
|
4
|
+
import { preserveTextStyles as P } from "./preserveTextStyles.js";
|
|
5
|
+
import { unwrapProductNameLinks as v } from "./unwrapProductNameLink.js";
|
|
6
|
+
const O = {
|
|
7
7
|
CART_ITEMS: "ins_apr",
|
|
8
8
|
BROWSED_ITEMS: "browsed_item",
|
|
9
9
|
PURCHASED_ITEMS: "purchased_item"
|
|
10
|
-
},
|
|
11
|
-
function
|
|
10
|
+
}, q = (S) => S.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
|
|
11
|
+
function B(S, y, b) {
|
|
12
12
|
let h = y;
|
|
13
13
|
for (; h > 0 && /\s/.test(S[h - 1]); )
|
|
14
14
|
h -= 1;
|
|
15
15
|
return b.some((I) => S.endsWith(I, h));
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
const y =
|
|
19
|
-
|
|
20
|
-
const h =
|
|
17
|
+
function Z(S) {
|
|
18
|
+
const y = q(S), b = new DOMParser().parseFromString(y, "text/html");
|
|
19
|
+
v(b);
|
|
20
|
+
const h = w.PAIRS_FOR_EXTENSION;
|
|
21
21
|
Object.entries(h).forEach(([n, d]) => {
|
|
22
22
|
b.querySelectorAll(".ins-product-td").forEach((r) => {
|
|
23
23
|
const E = r.getAttribute("data-number") || "1", m = r.getAttribute("data-type") || "CART_ITEMS";
|
|
24
24
|
r.querySelectorAll(`[product-attr="${n}"]`).forEach((t) => {
|
|
25
|
-
var $,
|
|
26
|
-
const g = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E,
|
|
27
|
-
if (
|
|
25
|
+
var $, F, D, N;
|
|
26
|
+
const g = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E, f = d[g];
|
|
27
|
+
if (f)
|
|
28
28
|
switch (n) {
|
|
29
29
|
case "imageSrc": {
|
|
30
|
-
let e = null,
|
|
31
|
-
if (t.tagName === "IMG" ? (e = t,
|
|
30
|
+
let e = null, a = null;
|
|
31
|
+
if (t.tagName === "IMG" ? (e = t, a = e.closest("a")) : (e = t.querySelector("img"), a = t.querySelector("a") || t.closest("a")), !e)
|
|
32
32
|
break;
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
return
|
|
39
|
-
}) && (e.src = `{{${
|
|
33
|
+
const l = f.DEFAULT, c = f.ATTR;
|
|
34
|
+
if (l && e.src) {
|
|
35
|
+
const s = e.src;
|
|
36
|
+
l.some((R) => {
|
|
37
|
+
const u = R.split("/").pop() || "", H = s.split("/").pop() || "";
|
|
38
|
+
return s.includes(R) || s.includes(u) || H === u;
|
|
39
|
+
}) && (e.src = `{{${c}_${o}}}`);
|
|
40
40
|
}
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
const
|
|
46
|
-
(
|
|
41
|
+
const i = (F = ($ = h.name) == null ? void 0 : $[g]) == null ? void 0 : F.ATTR;
|
|
42
|
+
if (i && e.setAttribute("alt", `{{${i}_${o}}}`), a) {
|
|
43
|
+
const s = (D = h.itemLink) == null ? void 0 : D[g];
|
|
44
|
+
if (s) {
|
|
45
|
+
const _ = s.HREF, R = s.DEFAULT_HREF || "#!", u = a.href;
|
|
46
|
+
(u === "#" || u === "" || u.endsWith("#!") || u.endsWith(R) || u === `${window.location.href}${R}` || !u || u === window.location.href) && (a.href = `{{${_}_${o}}}`);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
break;
|
|
50
50
|
}
|
|
51
51
|
case "name": {
|
|
52
|
-
const e =
|
|
53
|
-
t.textContent && (t.innerHTML =
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
const
|
|
57
|
-
(
|
|
52
|
+
const e = f, a = e.ATTR, l = e.DEFAULT_HREF || "#!", c = e.HREF;
|
|
53
|
+
t.textContent && (t.innerHTML = P(t, `{{${a}_${o}}}`));
|
|
54
|
+
const i = t.closest("a") || (t.tagName === "A" ? t : null);
|
|
55
|
+
if (i && c) {
|
|
56
|
+
const s = i.href, _ = `${window.location.href}${l}`;
|
|
57
|
+
(s === _ || s.endsWith(l)) && (i.href = `{{${c}_${o}}}`);
|
|
58
58
|
}
|
|
59
59
|
break;
|
|
60
60
|
}
|
|
61
61
|
case "price":
|
|
62
62
|
case "originalPrice": {
|
|
63
|
-
const e =
|
|
64
|
-
let
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
let
|
|
68
|
-
const
|
|
63
|
+
const e = f, a = t.getAttribute("data-formated"), l = t.getAttribute("data-single_price"), c = a === "true", i = l === "true", s = t.getAttribute(x.POSITION) || "before";
|
|
64
|
+
let _;
|
|
65
|
+
i ? _ = c ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : _ = c ? e.PRICE_FORMATTED : e.PRICE;
|
|
66
|
+
const R = e.CURRENCY;
|
|
67
|
+
let u = `{{${_}_${o}}}`;
|
|
68
|
+
const H = (t.getAttribute(x.SYMBOL) || "").trim(), G = Y(H);
|
|
69
69
|
let C = "";
|
|
70
|
-
|
|
70
|
+
G ? C = H : R && (C = `{{${R}_${o}}}`), C && (u = s === "after" ? `${u} ${C}` : `${C} ${u}`), t.innerHTML = P(t, u);
|
|
71
71
|
break;
|
|
72
72
|
}
|
|
73
73
|
case "quantity": {
|
|
74
|
-
const e =
|
|
75
|
-
|
|
74
|
+
const e = f, a = e.ATTR, l = [e.DEFAULT, ...e.LEGACY_DEFAULTS], c = (N = t.textContent) == null ? void 0 : N.trim();
|
|
75
|
+
c && l.includes(c) && (t.innerHTML = P(t, `{{${a}_${o}}}`));
|
|
76
76
|
break;
|
|
77
77
|
}
|
|
78
78
|
case "button": {
|
|
79
|
-
const e =
|
|
80
|
-
if (
|
|
81
|
-
const
|
|
82
|
-
(
|
|
79
|
+
const e = f, a = e.HREF, l = e.DEFAULT_HREF || "#!", c = t.tagName === "A" ? t : t.querySelector("a");
|
|
80
|
+
if (c) {
|
|
81
|
+
const i = c.href || "", s = `${window.location.href}${l}`;
|
|
82
|
+
(i === "" || i === "#" || i === s || i.endsWith(l) || i.endsWith("#!") || i === window.location.href) && (c.href = `{{${a}_${o}}}`);
|
|
83
83
|
}
|
|
84
84
|
break;
|
|
85
85
|
}
|
|
86
86
|
case "itemLink": {
|
|
87
|
-
const e =
|
|
88
|
-
if (
|
|
89
|
-
const
|
|
90
|
-
(
|
|
87
|
+
const e = f, a = e.HREF, l = e.DEFAULT_HREF || "#!", c = t;
|
|
88
|
+
if (c.href) {
|
|
89
|
+
const i = c.href, s = `${window.location.href}${l}`;
|
|
90
|
+
(i === s || i.endsWith(l)) && (c.href = `{{${a}_${o}}}`);
|
|
91
91
|
}
|
|
92
92
|
break;
|
|
93
93
|
}
|
|
94
94
|
default: {
|
|
95
|
-
if ("ATTR" in
|
|
96
|
-
const e =
|
|
97
|
-
t.textContent && (t.innerHTML =
|
|
95
|
+
if ("ATTR" in f) {
|
|
96
|
+
const e = f.ATTR;
|
|
97
|
+
t.textContent && (t.innerHTML = P(t, `{{${e}_${o}}}`));
|
|
98
98
|
}
|
|
99
99
|
break;
|
|
100
100
|
}
|
|
@@ -102,9 +102,9 @@ function K(S) {
|
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
|
-
const I = y.match(/<!DOCTYPE[^>]*>/i),
|
|
106
|
-
` : "",
|
|
107
|
-
|
|
105
|
+
const I = y.match(/<!DOCTYPE[^>]*>/i), U = I ? `${I[0]}
|
|
106
|
+
` : "", W = b.querySelectorAll(".ins-product-td"), M = [];
|
|
107
|
+
W.forEach((n) => {
|
|
108
108
|
const d = n.getAttribute("data-type") || "CART_ITEMS", p = n.getAttribute("data-number") || "1", r = n.outerHTML;
|
|
109
109
|
M.push({
|
|
110
110
|
element: n,
|
|
@@ -113,38 +113,38 @@ function K(S) {
|
|
|
113
113
|
number: p
|
|
114
114
|
});
|
|
115
115
|
});
|
|
116
|
-
let A =
|
|
116
|
+
let A = U + b.documentElement.outerHTML;
|
|
117
117
|
M.reverse().forEach(({ outerHtml: n, type: d, number: p }) => {
|
|
118
|
-
const r =
|
|
118
|
+
const r = O[d], E = r ? `${r}_total_product_kind` : "";
|
|
119
119
|
if (E) {
|
|
120
120
|
const T = parseInt(p) - 1, o = `${`{% if ${E} > ${T} %}`}${n}{% endif %}`;
|
|
121
121
|
A = A.replace(n, X(o));
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
|
-
const
|
|
125
|
-
return
|
|
124
|
+
const V = b.querySelectorAll('[product-attr="originalPrice"][data-type]'), L = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Set();
|
|
125
|
+
return V.forEach((n) => {
|
|
126
126
|
var t;
|
|
127
127
|
const d = n.getAttribute("data-number"), p = n.getAttribute("data-type");
|
|
128
|
-
if (!d || !
|
|
128
|
+
if (!d || !O[p])
|
|
129
129
|
return;
|
|
130
130
|
const r = n.closest(".product-original-price-class");
|
|
131
131
|
if (!r || k.has(r))
|
|
132
132
|
return;
|
|
133
133
|
k.add(r);
|
|
134
|
-
const E = r.outerHTML, m = (t = n.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), T =
|
|
135
|
-
T.wrap.push(m !== "false"),
|
|
136
|
-
}),
|
|
134
|
+
const E = r.outerHTML, m = (t = n.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), T = L.get(E) ?? { number: d, type: p, wrap: [] };
|
|
135
|
+
T.wrap.push(m !== "false"), L.set(E, T);
|
|
136
|
+
}), L.forEach(({ number: n, type: d, wrap: p }, r) => {
|
|
137
137
|
if (r.includes("{% if") || !p.some(Boolean))
|
|
138
138
|
return;
|
|
139
|
-
const E =
|
|
140
|
-
let g = "", o = 0,
|
|
139
|
+
const E = w.PAIRS_FOR_EXTENSION.price[d].PRICE, m = w.PAIRS_FOR_EXTENSION.originalPrice[d].PRICE, T = `{% if ${E}_${n} != ${m}_${n} %}`, t = [T, q(T)];
|
|
140
|
+
let g = "", o = 0, f = 0, $ = A.indexOf(r);
|
|
141
141
|
for (; $ !== -1; ) {
|
|
142
|
-
const
|
|
143
|
-
g += A.slice(o, $) + (
|
|
142
|
+
const F = p[f] === !0 && !B(A, $, t);
|
|
143
|
+
g += A.slice(o, $) + (F ? `${T}${r}{% endif %}` : r), o = $ + r.length, f += 1, $ = A.indexOf(r, o);
|
|
144
144
|
}
|
|
145
145
|
A = g + A.slice(o);
|
|
146
146
|
}), A.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
147
147
|
}
|
|
148
148
|
export {
|
|
149
|
-
|
|
149
|
+
Z as pairProductVariables
|
|
150
150
|
};
|