@useinsider/guido 3.3.0-beta.c1e1d7e → 3.3.0-beta.ddabd14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +103 -89
- package/dist/components/organisms/extensions/recommendation/FilterItem.vue.js +9 -11
- package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +70 -35
- package/dist/components/organisms/header/MiddleSlot.vue.js +7 -7
- package/dist/composables/useCortexBlueprintBridge.js +66 -0
- package/dist/composables/useCustomInterfaceAppearance.js +18 -16
- package/dist/composables/useEmailTemplateApplier.js +41 -0
- package/dist/composables/useGuidoStateBridge.js +48 -0
- package/dist/composables/useHtmlValidator.js +41 -36
- package/dist/composables/useRecommendation.js +2 -2
- package/dist/composables/useStripo.js +56 -54
- package/dist/config/migrator/index.js +21 -10
- package/dist/config/migrator/radioButtonMigrator.js +73 -48
- package/dist/enums/extensions/recommendationBlock.js +101 -46
- package/dist/enums/unsubscribe.js +25 -24
- package/dist/extensions/Blocks/Checkbox/control.js +23 -23
- package/dist/extensions/Blocks/RadioButton/control.js +15 -15
- package/dist/extensions/Blocks/RadioButton/template.js +6 -6
- package/dist/extensions/Blocks/Recommendation/block.js +43 -36
- package/dist/extensions/Blocks/Recommendation/services/configService.js +33 -26
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +35 -26
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +25 -12
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +33 -0
- package/dist/guido.css +1 -1
- package/dist/services/unsubscribeApi.js +6 -6
- package/dist/src/composables/useCortexBlueprintBridge.d.ts +25 -0
- package/dist/src/composables/useEmailTemplateApplier.d.ts +21 -0
- package/dist/src/composables/useGuidoStateBridge.d.ts +22 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +6 -1
- package/dist/src/enums/unsubscribe.d.ts +8 -3
- package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +11 -3
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +7 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/filterUtil.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +21 -0
- package/dist/src/stores/guido-email-editor.d.ts +41 -0
- package/dist/static/styles/components/notification.css.js +74 -0
- package/dist/stores/guido-email-editor.js +20 -0
- package/dist/utils/templatePreparation.js +57 -50
- package/package.json +1 -1
- package/dist/composables/useStripoNotifications.js +0 -30
- package/dist/src/composables/useStripoNotifications.d.ts +0 -4
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Outbound bridge — publishes the current editor's html/css to the shared
|
|
3
|
+
* Pinia store `guidoEmailEditor` so cortex-fe can read it at chat-stream
|
|
4
|
+
* submit time and forward it as `clientState.editor`. This is what enables
|
|
5
|
+
* sub-case 1.3 (refine an already-loaded template via the email-agent).
|
|
6
|
+
*
|
|
7
|
+
* The bridge writes on three triggers:
|
|
8
|
+
*
|
|
9
|
+
* 1. Stripo finishes initializing — first snapshot.
|
|
10
|
+
* 2. Editor `hasChanges` flips to true — debounced 500 ms so a streaming
|
|
11
|
+
* Stripo edit doesn't thrash the store.
|
|
12
|
+
* 3. Editor `hasChanges` flips back to false (post-save / autosave) —
|
|
13
|
+
* immediate, since this is the canonical "saved" snapshot.
|
|
14
|
+
*
|
|
15
|
+
* `getTemplateData()` is a Stripo iframe call; it must not run before
|
|
16
|
+
* `isStripoInitialized` is true. The bridge guards against that.
|
|
17
|
+
*
|
|
18
|
+
* If cortex-fe isn't loaded the store still gets written — that's fine;
|
|
19
|
+
* the store has zero overhead and any future reader will find consistent
|
|
20
|
+
* state. The bridge is a one-way pipe with no consumer dependency.
|
|
21
|
+
*/
|
|
22
|
+
export declare const useGuidoStateBridge: () => void;
|
|
@@ -6,11 +6,16 @@ export declare const URLS: {
|
|
|
6
6
|
export declare const QUERY_PARAMS: {
|
|
7
7
|
CLIENT_ID: string;
|
|
8
8
|
};
|
|
9
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Get recommendation feed source maps lazily so translated names resolve at access time.
|
|
11
|
+
* Must be called within a Vue component context or after Pinia is initialized.
|
|
12
|
+
*/
|
|
13
|
+
export declare const getRecommendationFeedSourceMaps: () => RecommendationFeedItem[];
|
|
10
14
|
export declare const PriceAttributes: string[];
|
|
11
15
|
export declare const currencyLocationMaps: TextValueObject[];
|
|
12
16
|
export declare const currencyOperators: TextValueObject[];
|
|
13
17
|
export declare const currencyDecimalCounts: TextValueObject[];
|
|
18
|
+
export declare const OP_ANY_OF = "||";
|
|
14
19
|
export declare const operatorOptionsForStrings: TextValueObject[];
|
|
15
20
|
export declare const operatorOptionsForArrayOfStrings: TextValueObject[];
|
|
16
21
|
export declare const operatorOptionsForNumbers: TextValueObject[];
|
|
@@ -18,9 +18,14 @@ export declare const PRODUCT_TYPE_URL_SEGMENTS: {
|
|
|
18
18
|
readonly 97: "email";
|
|
19
19
|
};
|
|
20
20
|
export declare const INSIDER_ID = "iid";
|
|
21
|
-
export declare const
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
export declare const DEFAULT_UNSUBSCRIBE_GROUP_SEND_GRID_ID = "G";
|
|
22
|
+
/**
|
|
23
|
+
* Get the default unsubscribe group lazily so the translated name resolves at access time.
|
|
24
|
+
* Must be called within a Vue component context or after Pinia is initialized.
|
|
25
|
+
*/
|
|
26
|
+
export declare const getDefaultUnsubscribeGroup: () => {
|
|
27
|
+
name: string;
|
|
28
|
+
sendGridId: string;
|
|
24
29
|
};
|
|
25
30
|
export declare const UNSUBSCRIBE_PAGES_LINK = "/email/unsubscribe-pages";
|
|
26
31
|
export declare const PAGE_TYPES: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const migrationTemplate = "\n <td\n align=\"left\"\n esd-extension-block-id=\"radio-button-block\"\n esd-handler-name=\"esd-extension-RadioButtonBlock\"\n class=\"\n radio-button\n radio-button-v2\n esd-block-ra\n esd-radio-button-block\n esd-extension-block\n es-p10t\n es-p10b\n es-p30r\n es-p30l\"\n >\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td align=\"left\" width=\"70%\" style=\"vertical-align: top;\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n {-{-TITLE-}-}\n </tr>\n <tr>\n {-{-DESCRIPTION-}-}\n </tr>\n </tbody>\n </table>\n </td>\n <td align=\"right\" width=\"30%\" style=\"vertical-align: middle;\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td width=\"50%\">\n <table width=\"100%\">\n <tr>\n <td width=\"24\">\n <input\n type=\"radio\"\n id=\"radioYes\"\n name=\"unsubscribe\"\n data-cke-editable=\"1\"\n style=\"margin: 0px; vertical-align: middle;\">\n </td>\n {-{-YES-}-}\n </tr>\n </table>\n </td>\n <td width=\"50%\">\n <table width=\"100%\">\n <tr>\n <td width=\"24\">\n <input\n type=\"radio\"\n id=\"radioNo\"\n name=\"unsubscribe\"\n data-cke-editable=\"1\"\n style=\"margin: 0px; vertical-align: middle;\">\n </td>\n {-{-NO-}-}\n </tr>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n";
|
|
1
|
+
declare const migrationTemplate = "\n <td\n align=\"left\"\n esd-extension-block-id=\"radio-button-block\"\n esd-handler-name=\"esd-extension-RadioButtonBlock\"\n class=\"\n radio-button-block\n radio-button-v2\n esd-block-ra\n esd-radio-button-block\n esd-extension-block\n es-p10t\n es-p10b\n es-p30r\n es-p30l\"\n >\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td align=\"left\" width=\"70%\" style=\"vertical-align: top;\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n {-{-TITLE-}-}\n </tr>\n <tr>\n {-{-DESCRIPTION-}-}\n </tr>\n </tbody>\n </table>\n </td>\n <td align=\"right\" width=\"30%\" style=\"vertical-align: middle;\">\n <table cellpadding=\"0\" cellspacing=\"0\" role=\"presentation\" width=\"100%\">\n <tbody>\n <tr>\n <td width=\"50%\">\n <table width=\"100%\">\n <tr>\n <td width=\"24\">\n <input\n type=\"radio\"\n id=\"radioYes\"\n name=\"unsubscribe\"\n data-cke-editable=\"1\"\n style=\"margin: 0px; vertical-align: middle;\">\n </td>\n {-{-YES-}-}\n </tr>\n </table>\n </td>\n <td width=\"50%\">\n <table width=\"100%\">\n <tr>\n <td width=\"24\">\n <input\n type=\"radio\"\n id=\"radioNo\"\n name=\"unsubscribe\"\n data-cke-editable=\"1\"\n style=\"margin: 0px; vertical-align: middle;\">\n </td>\n {-{-NO-}-}\n </tr>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n </tr>\n </tbody>\n </table>\n </td>\n";
|
|
2
2
|
/**
|
|
3
3
|
* @returns The template for the default checkbox block
|
|
4
4
|
*/
|
|
@@ -95,15 +95,23 @@ export declare class RecommendationConfigService {
|
|
|
95
95
|
*
|
|
96
96
|
* Called when a block is first created (dropped into template).
|
|
97
97
|
* Can optionally merge in partial config from migration.
|
|
98
|
+
*
|
|
99
|
+
* The `wasFreshDrop` flag distinguishes a brand-new drop (no prior config)
|
|
100
|
+
* from a clone (Stripo replays the source's setNodeConfig payload before
|
|
101
|
+
* onCreated fires). Callers use this to skip side-effects already inherited
|
|
102
|
+
* from the source.
|
|
98
103
|
* @example
|
|
99
104
|
* // In Block.onCreated lifecycle
|
|
100
|
-
* RecommendationConfigService.initializeConfig(this.api, node);
|
|
105
|
+
* const { config, wasFreshDrop } = RecommendationConfigService.initializeConfig(this.api, node);
|
|
101
106
|
* @param api - Stripo extension API with document modifier
|
|
102
107
|
* @param node - The immutable HTML node to initialize
|
|
103
108
|
* @param partialConfig - Optional partial config to merge with defaults
|
|
104
|
-
* @returns The initialized configuration
|
|
109
|
+
* @returns The initialized configuration and whether the node was a fresh drop
|
|
105
110
|
*/
|
|
106
|
-
static initializeConfig(api: DocumentModifierApi, node: ImmutableHtmlNode, partialConfig?: PartialNodeConfig):
|
|
111
|
+
static initializeConfig(api: DocumentModifierApi, node: ImmutableHtmlNode, partialConfig?: PartialNodeConfig): {
|
|
112
|
+
config: RecommendationNodeConfig;
|
|
113
|
+
wasFreshDrop: boolean;
|
|
114
|
+
};
|
|
107
115
|
/**
|
|
108
116
|
* Save complete configuration to a node
|
|
109
117
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Orientation, Languages, Currency, NumericSeparator, FiltersResponse, Filter, RecommendationProduct } from '@@/Types/recommendation';
|
|
2
|
-
interface PerBlockConfigs {
|
|
2
|
+
export interface PerBlockConfigs {
|
|
3
3
|
cardsInRow: number;
|
|
4
4
|
currencySettings: {
|
|
5
5
|
name: string;
|
|
@@ -272,6 +272,12 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
|
|
|
272
272
|
deleteFilter(filter: Filter): void;
|
|
273
273
|
addFilter(filter: Filter): void;
|
|
274
274
|
generateFilterQuery(): string;
|
|
275
|
+
/**
|
|
276
|
+
* Validation-only check invoked at save-CTA time. Defined as an action
|
|
277
|
+
* (not a getter) so reading it does not register reactive tracking on
|
|
278
|
+
* every block's recommendationConfigs across user edits.
|
|
279
|
+
*/
|
|
280
|
+
hasInvalidBlock(): boolean;
|
|
275
281
|
fetchRecommendationProducts(): Promise<void>;
|
|
276
282
|
_doFetchProducts(): Promise<void>;
|
|
277
283
|
}>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Filter } from '@@/Types/recommendation';
|
|
2
|
+
export declare function safeDecodeURIComponent(value: string): string;
|
|
3
|
+
export declare function parseTagList(value: string): string[];
|
|
2
4
|
/**
|
|
3
5
|
* Generates the complete query with outer group operators
|
|
4
6
|
* @param filters Array of Filter objects
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PerBlockConfigs } from '../store/recommendation';
|
|
2
|
+
import type { Currency, Languages } from '@@/Types/recommendation';
|
|
3
|
+
/**
|
|
4
|
+
* Structural slice of the recommendation extension store that descriptors may read.
|
|
5
|
+
* Add new fields here when a future descriptor needs them.
|
|
6
|
+
*/
|
|
7
|
+
export interface ExtensionStoreSlice {
|
|
8
|
+
languages: Languages;
|
|
9
|
+
currencyList: Currency[];
|
|
10
|
+
}
|
|
11
|
+
interface RequiredField {
|
|
12
|
+
key: string;
|
|
13
|
+
getValue: (config: PerBlockConfigs) => string;
|
|
14
|
+
getAvailableOptions?: (store: ExtensionStoreSlice) => string[];
|
|
15
|
+
condition?: (config: PerBlockConfigs) => boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const REQUIRED_RECOMMENDATION_FIELDS: RequiredField[];
|
|
18
|
+
export declare const RecommendationRequiredFieldsKey = "newsletter.recommendation-fill-required-fields";
|
|
19
|
+
export declare function getInvalidFields(config: PerBlockConfigs, store: ExtensionStoreSlice): string[];
|
|
20
|
+
export declare function isConfigValid(config: PerBlockConfigs, store: ExtensionStoreSlice): boolean;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Outbound contract Guido publishes to the host's shared Pinia singleton so
|
|
3
|
+
* cortex-fe can pick up the current editor state and forward it as
|
|
4
|
+
* `clientState.editor` on the next chat-stream POST.
|
|
5
|
+
*
|
|
6
|
+
* State + getters only — `useGuidoStateBridge` writes via `$patch`, no actions
|
|
7
|
+
* live here (architecture invariant).
|
|
8
|
+
*
|
|
9
|
+
* Store id `guidoEmailEditor` is cross-MFE: cortex-fe reads it via
|
|
10
|
+
* `pinia._s.get('guidoEmailEditor')` at runtime. The internal Guido editor
|
|
11
|
+
* store keeps id `guidoEditor` — these are intentionally separate. The
|
|
12
|
+
* internal store carries UI state that cortex-fe should not see; this public
|
|
13
|
+
* store carries the contract Guido is willing to share.
|
|
14
|
+
*/
|
|
15
|
+
export declare const useGuidoEmailEditorStore: import("pinia").StoreDefinition<"guidoEmailEditor", {
|
|
16
|
+
/** Current Stripo HTML — stripe tables only, no DOCTYPE/wrapper. */
|
|
17
|
+
html: string;
|
|
18
|
+
/** Current Stripo CSS — es-p* utility classes used by the html. */
|
|
19
|
+
css: string;
|
|
20
|
+
/** Wall-clock ms when html/css were last written by the bridge. */
|
|
21
|
+
lastUpdatedAt: number;
|
|
22
|
+
/** Template id from the editor config, for cortex-fe to scope per-template. */
|
|
23
|
+
templateId: string;
|
|
24
|
+
}, {
|
|
25
|
+
/** True once the bridge has published at least one snapshot. */
|
|
26
|
+
hasSnapshot: (state: {
|
|
27
|
+
html: string;
|
|
28
|
+
css: string;
|
|
29
|
+
lastUpdatedAt: number;
|
|
30
|
+
templateId: string;
|
|
31
|
+
} & import("pinia").PiniaCustomStateProperties<{
|
|
32
|
+
/** Current Stripo HTML — stripe tables only, no DOCTYPE/wrapper. */
|
|
33
|
+
html: string;
|
|
34
|
+
/** Current Stripo CSS — es-p* utility classes used by the html. */
|
|
35
|
+
css: string;
|
|
36
|
+
/** Wall-clock ms when html/css were last written by the bridge. */
|
|
37
|
+
lastUpdatedAt: number;
|
|
38
|
+
/** Template id from the editor config, for cortex-fe to scope per-template. */
|
|
39
|
+
templateId: string;
|
|
40
|
+
}>) => boolean;
|
|
41
|
+
}, {}>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const n = `ue-notifications-container {
|
|
2
|
+
left: 96px;
|
|
3
|
+
margin: 0;
|
|
4
|
+
bottom: 32px;
|
|
5
|
+
top: unset;
|
|
6
|
+
width: unset;
|
|
7
|
+
position: fixed;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
ue-notifications-container ue-message + ue-message {
|
|
11
|
+
margin-bottom: 24px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
ue-notifications-container .alert-message-wrapper {
|
|
15
|
+
box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.07);
|
|
16
|
+
border: none;
|
|
17
|
+
padding: 16px 24px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
ue-notifications-container .alert-message-wrapper.info,
|
|
21
|
+
ue-notifications-container .alert-message-wrapper.loader {
|
|
22
|
+
background-color: var(--guido-color-background-toaster-info) !important;
|
|
23
|
+
color: inherit;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.alert-message-wrapper .alert-message-main {
|
|
27
|
+
align-items: center;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
ue-notifications-container ue-caption .caption {
|
|
31
|
+
color: var(--guido-color-white) !important;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
ue-block-thumb-hint {
|
|
35
|
+
text-align: left;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
ue-notifications-container .alert-message-wrapper .alert-message-main .alert-message-content {
|
|
39
|
+
width: calc(100% - 64px);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
ue-notifications-container .alert-message-wrapper .alert-message-main .alert-message-text {
|
|
43
|
+
font-size: 15px;
|
|
44
|
+
font-weight: 600;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
ue-notifications-container .alert-message-text,
|
|
48
|
+
ue-notifications-container .alert-message-wrapper ue-icon-component.icon,
|
|
49
|
+
ue-notifications-container .alert-message-wrapper ue-icon-component.icon-button {
|
|
50
|
+
color: var(--guido-color-white);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
ue-notifications-container ue-message ue-button.close {
|
|
54
|
+
margin: 0 0 0 16px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
ue-notifications-container .alert-message-wrapper.success {
|
|
58
|
+
background: var(--guido-color-background-toaster-success);
|
|
59
|
+
color: inherit;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
ue-notifications-container .alert-message-wrapper.error {
|
|
63
|
+
background: var(--guido-color-background-toaster-error);
|
|
64
|
+
color: inherit;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
ue-notifications-container .alert-message-wrapper.warn {
|
|
68
|
+
background: var(--guido-color-background-toaster-warn);
|
|
69
|
+
color: inherit;
|
|
70
|
+
}
|
|
71
|
+
`;
|
|
72
|
+
export {
|
|
73
|
+
n as default
|
|
74
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineStore as e } from "pinia";
|
|
2
|
+
const d = e("guidoEmailEditor", {
|
|
3
|
+
state: () => ({
|
|
4
|
+
/** Current Stripo HTML — stripe tables only, no DOCTYPE/wrapper. */
|
|
5
|
+
html: "",
|
|
6
|
+
/** Current Stripo CSS — es-p* utility classes used by the html. */
|
|
7
|
+
css: "",
|
|
8
|
+
/** Wall-clock ms when html/css were last written by the bridge. */
|
|
9
|
+
lastUpdatedAt: 0,
|
|
10
|
+
/** Template id from the editor config, for cortex-fe to scope per-template. */
|
|
11
|
+
templateId: ""
|
|
12
|
+
}),
|
|
13
|
+
getters: {
|
|
14
|
+
/** True once the bridge has published at least one snapshot. */
|
|
15
|
+
hasSnapshot: (t) => t.lastUpdatedAt > 0 && t.html !== ""
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
export {
|
|
19
|
+
d as useGuidoEmailEditorStore
|
|
20
|
+
};
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useHtmlCompiler as
|
|
3
|
-
import { DEFAULT_CURRENCY as
|
|
4
|
-
import { useRecommendationExtensionStore as
|
|
5
|
-
import { DATA_ATTRIBUTES as
|
|
6
|
-
import { parsePageList as
|
|
7
|
-
import { useDynamicContentStore as
|
|
8
|
-
import { useUnsubscribeStore as
|
|
9
|
-
function
|
|
10
|
-
const
|
|
11
|
-
return
|
|
12
|
-
const o = t.getAttribute(
|
|
13
|
-
o && c.push(...
|
|
1
|
+
import { useActionsApi as R } from "../composables/useActionsApi.js";
|
|
2
|
+
import { useHtmlCompiler as U } from "../composables/useHtmlCompiler.js";
|
|
3
|
+
import { DEFAULT_CURRENCY as d, DEFAULT_NODE_CONFIG as i } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
4
|
+
import { useRecommendationExtensionStore as A } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
|
+
import { DATA_ATTRIBUTES as T } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
6
|
+
import { parsePageList as F } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
7
|
+
import { useDynamicContentStore as H } from "../stores/dynamic-content.js";
|
|
8
|
+
import { useUnsubscribeStore as w } from "../stores/unsubscribe.js";
|
|
9
|
+
function x(m, r) {
|
|
10
|
+
const n = new DOMParser().parseFromString(m, "text/html").querySelectorAll(`[${T.PAGE_LIST}]`), c = [];
|
|
11
|
+
return n.forEach((t) => {
|
|
12
|
+
const o = t.getAttribute(T.PAGE_LIST);
|
|
13
|
+
o && c.push(...F(o));
|
|
14
14
|
}), r.filter((t) => c.includes(t));
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
16
|
+
function z(m) {
|
|
17
|
+
const l = new DOMParser().parseFromString(m, "text/html").querySelectorAll(".recommendation-block-v2");
|
|
18
|
+
if (l.length === 0)
|
|
19
19
|
return;
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
var g, f,
|
|
23
|
-
const c =
|
|
20
|
+
const p = A();
|
|
21
|
+
l.forEach((n) => {
|
|
22
|
+
var g, f, a, s, S;
|
|
23
|
+
const c = n.getAttribute("recommendation-id"), t = c ? Number(c) : NaN;
|
|
24
24
|
if (!Number.isFinite(t))
|
|
25
25
|
return;
|
|
26
|
-
const o =
|
|
26
|
+
const o = n.getAttribute("esd-ext-config");
|
|
27
27
|
if (!o)
|
|
28
28
|
return;
|
|
29
29
|
let e;
|
|
@@ -34,60 +34,67 @@ function F(i) {
|
|
|
34
34
|
}
|
|
35
35
|
if (!e || typeof e != "object" || Array.isArray(e))
|
|
36
36
|
return;
|
|
37
|
-
const
|
|
38
|
-
strategy: e.strategy ??
|
|
39
|
-
language: e.language ??
|
|
40
|
-
size: e.size ??
|
|
37
|
+
const u = {
|
|
38
|
+
strategy: e.strategy ?? i.strategy,
|
|
39
|
+
language: e.language ?? i.language,
|
|
40
|
+
size: e.size ?? i.size,
|
|
41
41
|
// Spread the default arrays so each block gets a fresh reference
|
|
42
42
|
// instead of sharing the singleton in DEFAULT_NODE_CONFIG.
|
|
43
|
-
productIds: e.productIds ?? [...
|
|
44
|
-
filters: e.filters ?? [...
|
|
45
|
-
shuffleProducts: e.shuffleProducts ??
|
|
46
|
-
currencyCode: ((g = e.currency) == null ? void 0 : g.code) ??
|
|
47
|
-
currencyAlignment: ((f = e.currency) == null ? void 0 : f.alignment) ??
|
|
48
|
-
currencyDecimalCount: ((
|
|
49
|
-
currencyDecimalSeparator: ((
|
|
50
|
-
currencyThousandSeparator: ((S = e.currency) == null ? void 0 : S.thousandSeparator) ??
|
|
43
|
+
productIds: e.productIds ?? [...i.productIds],
|
|
44
|
+
filters: e.filters ?? [...i.filters],
|
|
45
|
+
shuffleProducts: e.shuffleProducts ?? i.shuffleProducts,
|
|
46
|
+
currencyCode: ((g = e.currency) == null ? void 0 : g.code) ?? d.code,
|
|
47
|
+
currencyAlignment: ((f = e.currency) == null ? void 0 : f.alignment) ?? d.alignment,
|
|
48
|
+
currencyDecimalCount: ((a = e.currency) == null ? void 0 : a.decimalCount) ?? d.decimalCount,
|
|
49
|
+
currencyDecimalSeparator: ((s = e.currency) == null ? void 0 : s.decimalSeparator) ?? d.decimalSeparator,
|
|
50
|
+
currencyThousandSeparator: ((S = e.currency) == null ? void 0 : S.thousandSeparator) ?? d.thousandSeparator
|
|
51
51
|
};
|
|
52
|
-
|
|
52
|
+
p.seedBlockUrlConfig(t, u);
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
|
-
const
|
|
56
|
-
const
|
|
55
|
+
const G = () => {
|
|
56
|
+
const m = H(), r = w(), { getCompiledEmail: l, getTemplateData: p } = R(), { compileHtml: n } = U();
|
|
57
57
|
return {
|
|
58
58
|
prepareTemplateDetails: async () => {
|
|
59
|
-
const { html: t, ampHtml: o = "", ampErrors: e = [] } = await
|
|
59
|
+
const { html: t, ampHtml: o = "", ampErrors: e = [] } = await l({
|
|
60
60
|
minimize: !0,
|
|
61
61
|
resetDataSavedFlag: !1
|
|
62
|
-
}), { html:
|
|
63
|
-
r.selectedUnsubscribePages.length && await r.fetchTemplates(),
|
|
64
|
-
const { compiledHtml:
|
|
62
|
+
}), { html: u, css: g, syncModulesIds: f = [] } = await p();
|
|
63
|
+
r.selectedUnsubscribePages.length && await r.fetchTemplates(), z(u);
|
|
64
|
+
const { compiledHtml: a, stats: s, appliedRules: S } = n(t), C = m.getSelectedDynamicContentList, P = A(), b = (D) => (D.match(/<td[^>]*radio-button-v2[^>]*>/gi) ?? []).map((E) => {
|
|
65
|
+
var h;
|
|
66
|
+
const y = (((h = E.match(/class="([^"]*)"/)) == null ? void 0 : h[1]) ?? "").split(/\s+/).filter(Boolean);
|
|
67
|
+
return { hasBlock: y.includes("radio-button-block"), classes: y };
|
|
68
|
+
});
|
|
65
69
|
return console.debug("HTML Compilation Stats:", {
|
|
66
|
-
originalSize:
|
|
67
|
-
compiledSize:
|
|
68
|
-
reduction: `${
|
|
70
|
+
originalSize: s.originalSize,
|
|
71
|
+
compiledSize: s.compiledSize,
|
|
72
|
+
reduction: `${s.reductionPercentage.toFixed(2)}%`,
|
|
69
73
|
appliedRules: S,
|
|
70
|
-
executionTime: `${
|
|
74
|
+
executionTime: `${s.executionTime.toFixed(2)}ms`
|
|
75
|
+
}), console.debug("[guido:radio-migrator] template-prep", {
|
|
76
|
+
rawHtmlRadioTds: b(u),
|
|
77
|
+
compiledHtmlRadioTds: b(a)
|
|
71
78
|
}), {
|
|
72
|
-
dynamicContentList:
|
|
73
|
-
compiledHtml:
|
|
74
|
-
rawHtml:
|
|
79
|
+
dynamicContentList: C,
|
|
80
|
+
compiledHtml: a,
|
|
81
|
+
rawHtml: u,
|
|
75
82
|
css: g,
|
|
76
83
|
ampHtml: o,
|
|
77
84
|
ampErrors: e,
|
|
78
85
|
modules: f.map(Number),
|
|
79
86
|
recommendation: {
|
|
80
|
-
campaignUrls:
|
|
87
|
+
campaignUrls: P.recommendationCampaignUrls,
|
|
81
88
|
configs: {}
|
|
82
89
|
},
|
|
83
90
|
unsubscribe: {
|
|
84
91
|
status: r.unsubscribePagesStatus,
|
|
85
|
-
config:
|
|
92
|
+
config: x(a, r.selectedUnsubscribePages)
|
|
86
93
|
}
|
|
87
94
|
};
|
|
88
95
|
}
|
|
89
96
|
};
|
|
90
97
|
};
|
|
91
98
|
export {
|
|
92
|
-
|
|
99
|
+
G as useTemplatePreparation
|
|
93
100
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.3.0-beta.
|
|
3
|
+
"version": "3.3.0-beta.ddabd14",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { useToaster as a } from "./useToaster.js";
|
|
2
|
-
import { ToasterTypeOptions as r } from "../enums/toaster.js";
|
|
3
|
-
const h = () => {
|
|
4
|
-
const { showToaster: l, hideToaster: u } = a();
|
|
5
|
-
let e = null, s = null;
|
|
6
|
-
const c = (t, o, i, n) => {
|
|
7
|
-
if (e === i && s === o)
|
|
8
|
-
return;
|
|
9
|
-
e = i, s = o;
|
|
10
|
-
const f = n != null && n.action ? { text: n.action.label, onClick: n.action.func } : void 0;
|
|
11
|
-
l({ type: t, message: o, actionButton: f });
|
|
12
|
-
};
|
|
13
|
-
return { getStripoNotifications: () => ({
|
|
14
|
-
info: (t, o, i) => c(r.Success, t, o, i),
|
|
15
|
-
success: (t, o, i) => c(r.Success, t, o, i),
|
|
16
|
-
warn: (t, o, i) => c(r.Warning, t, o, i),
|
|
17
|
-
error: (t, o, i) => c(r.Alert, t, o, i),
|
|
18
|
-
// Stripo emits `loader` for in-progress operations expected to persist until
|
|
19
|
-
// explicit hide(id). Available toaster types auto-dismiss at 6s, so showing
|
|
20
|
-
// anything here would lie about completion. Skip until a persistent type exists.
|
|
21
|
-
loader: () => {
|
|
22
|
-
},
|
|
23
|
-
hide: (t) => {
|
|
24
|
-
e === t && (u(), e = null, s = null);
|
|
25
|
-
}
|
|
26
|
-
}) };
|
|
27
|
-
};
|
|
28
|
-
export {
|
|
29
|
-
h as useStripoNotifications
|
|
30
|
-
};
|