@useinsider/guido 3.7.0-beta.9fddd7d → 3.7.0-beta.a1aaf44
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/@types/config/schemas.js +66 -70
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +1 -1
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +37 -34
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +1 -1
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +54 -51
- package/dist/composables/usePreviewMode.js +14 -15
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +82 -90
- package/dist/config/migrator/recommendation/htmlBuilder.js +58 -59
- package/dist/config/migrator/recommendation/settingsMapper.js +33 -38
- package/dist/extensions/Blocks/Recommendation/block.js +39 -58
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +32 -41
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +288 -369
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +72 -84
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +66 -68
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +7 -21
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +4 -64
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +5 -7
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +72 -101
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -31
- package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -9
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +59 -74
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +21 -21
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -88
- package/dist/extensions/Blocks/Unsubscribe/block.js +74 -60
- package/dist/extensions/Blocks/Unsubscribe/control.js +33 -24
- package/dist/guido.css +1 -1
- package/dist/src/@types/config/schemas.d.ts +0 -16
- package/dist/src/composables/useConfig.d.ts +0 -4
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -29
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +1 -3
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +0 -13
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +2 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -33
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -15
- package/dist/src/extensions/Blocks/Unsubscribe/block.d.ts +6 -0
- package/dist/src/extensions/Blocks/Unsubscribe/control.d.ts +1 -0
- package/dist/src/stores/config.d.ts +0 -36
- package/dist/src/stores/unsubscribe.d.ts +11 -1
- package/dist/stores/unsubscribe.js +8 -7
- package/package.json +1 -1
- package/dist/composables/useRecommendationPreview.js +0 -100
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +0 -133
- package/dist/src/composables/useRecommendationPreview.d.ts +0 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +0 -59
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
|
|
2
|
-
import { type ElementRenderer
|
|
2
|
+
import { type ElementRenderer } from '../utils';
|
|
3
3
|
/**
|
|
4
4
|
* Generates attribute-aligned product rows for grid layout.
|
|
5
5
|
* Creates rows where each row contains one attribute type from all products.
|
|
@@ -9,7 +9,7 @@ import { type ElementRenderer, type PricePlacementFlags } from '../utils';
|
|
|
9
9
|
* @param composition - Array defining order of card elements
|
|
10
10
|
* @returns HTML string for attribute-aligned rows
|
|
11
11
|
*/
|
|
12
|
-
export declare function prepareGridAttributeRows(products: RecommendationProduct[], productsPerRow: number, elementRenderer: ElementRenderer, composition?: string[], filterList?: FiltersResponse
|
|
12
|
+
export declare function prepareGridAttributeRows(products: RecommendationProduct[], productsPerRow: number, elementRenderer: ElementRenderer, composition?: string[], filterList?: FiltersResponse): string;
|
|
13
13
|
/**
|
|
14
14
|
* Prepares grid product rows with attribute-aligned structure
|
|
15
15
|
* Groups products into rows, then generates attribute-aligned HTML for each group
|
|
@@ -19,7 +19,7 @@ export declare function prepareGridAttributeRows(products: RecommendationProduct
|
|
|
19
19
|
* @param composition - Array defining order of card elements
|
|
20
20
|
* @returns HTML string for all product rows
|
|
21
21
|
*/
|
|
22
|
-
export declare function prepareGridProductRows(products: RecommendationProduct[], productsPerRow: number, elementRenderer: ElementRenderer, composition?: string[], filterList?: FiltersResponse
|
|
22
|
+
export declare function prepareGridProductRows(products: RecommendationProduct[], productsPerRow: number, elementRenderer: ElementRenderer, composition?: string[], filterList?: FiltersResponse): string;
|
|
23
23
|
/**
|
|
24
24
|
* Prepares grid product rows with attribute-aligned structure.
|
|
25
25
|
* Uses row-based rendering where each attribute type forms a single row across all products.
|
|
@@ -28,6 +28,6 @@ export declare function prepareGridProductRows(products: RecommendationProduct[]
|
|
|
28
28
|
* @param composition - Array defining element order
|
|
29
29
|
* @returns HTML string for product rows
|
|
30
30
|
*/
|
|
31
|
-
export declare function prepareProductRows(products: RecommendationProduct[], productsPerRow: number, composition?: string[], filterList?: FiltersResponse
|
|
31
|
+
export declare function prepareProductRows(products: RecommendationProduct[], productsPerRow: number, composition?: string[], filterList?: FiltersResponse): string;
|
|
32
32
|
export declare function getDefaultTemplate(recommendationId?: number): string;
|
|
33
33
|
export declare function generateBlockTemplate(products: RecommendationProduct[], productsPerRow: number, title?: string, composition?: string[], mobileProductsPerRow?: number): string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { RecommendationProduct } from '@@/Types/recommendation';
|
|
2
1
|
import { type ElementRenderer } from '../utils';
|
|
3
2
|
/**
|
|
4
3
|
* List element renderer
|
|
@@ -6,16 +5,4 @@ import { type ElementRenderer } from '../utils';
|
|
|
6
5
|
* - Name and Prices return `<tr><td>` rows for the info cell table
|
|
7
6
|
* All elements have esd-block-* classes for Stripo selection
|
|
8
7
|
*/
|
|
9
|
-
/**
|
|
10
|
-
* Standalone (stacked) original-price info row.
|
|
11
|
-
*/
|
|
12
|
-
export declare function renderListOldPriceRow(product: RecommendationProduct): string;
|
|
13
|
-
/**
|
|
14
|
-
* Inline price info row used when "Move to next line" is OFF: the sale price and
|
|
15
|
-
* original price sit in two cells of one row. Each keeps its block id + class so
|
|
16
|
-
* style controls and the compiler keep working. `originalFirst` preserves the
|
|
17
|
-
* card-composition order (original before sale by default) so it matches the
|
|
18
|
-
* stacked order.
|
|
19
|
-
*/
|
|
20
|
-
export declare function renderInlineListPriceRow(product: RecommendationProduct, originalFirst?: boolean): string;
|
|
21
8
|
export declare const listElementRenderer: ElementRenderer;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
|
|
2
|
-
import { type PricePlacementFlags } from '../utils';
|
|
3
2
|
/**
|
|
4
3
|
* Generates a list product card with 3-column layout
|
|
5
4
|
* Uses buildElementRenderer to render Image, Info content, and Button
|
|
@@ -12,7 +11,7 @@ import { type PricePlacementFlags } from '../utils';
|
|
|
12
11
|
* @param composition - Array defining order of card elements
|
|
13
12
|
* @returns HTML string for a single product card row
|
|
14
13
|
*/
|
|
15
|
-
export declare function getListProductCard(product: RecommendationProduct, composition?: string[], filterList?: FiltersResponse
|
|
14
|
+
export declare function getListProductCard(product: RecommendationProduct, composition?: string[], filterList?: FiltersResponse): string;
|
|
16
15
|
/**
|
|
17
16
|
* Prepares list product rows
|
|
18
17
|
* Each product is a full-width row with 3-column layout
|
|
@@ -20,6 +19,6 @@ export declare function getListProductCard(product: RecommendationProduct, compo
|
|
|
20
19
|
* @param composition - Array defining order of card elements
|
|
21
20
|
* @returns HTML string for product rows
|
|
22
21
|
*/
|
|
23
|
-
export declare function prepareProductRows(products: RecommendationProduct[], composition?: string[], filterList?: FiltersResponse
|
|
22
|
+
export declare function prepareProductRows(products: RecommendationProduct[], composition?: string[], filterList?: FiltersResponse): string;
|
|
24
23
|
export declare function getDefaultTemplate(): string;
|
|
25
24
|
export declare function generateBlockTemplate(products: RecommendationProduct[], title?: string, composition?: string[]): string;
|
|
@@ -1,33 +1,10 @@
|
|
|
1
|
-
import type { CurrencyConfig } from '../types/nodeConfig';
|
|
2
1
|
import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
|
|
3
2
|
import { ATTR_PRODUCT_IMAGE, ATTR_PRODUCT_NAME, ATTR_PRODUCT_PRICE, ATTR_PRODUCT_OLD_PRICE, ATTR_PRODUCT_OMNIBUS_PRICE, ATTR_PRODUCT_OMNIBUS_DISCOUNT, ATTR_PRODUCT_BUTTON } from '../constants';
|
|
4
|
-
type PriceKey = 'price' | 'original_price' | 'discount';
|
|
5
|
-
/**
|
|
6
|
-
* Current currency configuration from the store, in CurrencyConfig shape.
|
|
7
|
-
*/
|
|
8
|
-
export declare function getCurrentCurrencyConfig(): CurrencyConfig;
|
|
9
|
-
/**
|
|
10
|
-
* Formats a product price using current currency settings. Falls back to the
|
|
11
|
-
* first available currency, then 0, when the active currency has no value.
|
|
12
|
-
*/
|
|
13
|
-
export declare function formatProductPrice(product: RecommendationProduct, priceKey?: PriceKey): string;
|
|
14
3
|
/**
|
|
15
4
|
* Converts a snake_case attribute name to Title Case display name.
|
|
16
5
|
* e.g., "rating_star" → "Rating Star"
|
|
17
6
|
*/
|
|
18
7
|
export declare function toDisplayName(attrName: string): string;
|
|
19
|
-
/**
|
|
20
|
-
* Resolves the inline (side-by-side) price layout from the composition order so
|
|
21
|
-
* it matches the stacked order. `anchor` is whichever of price / original price
|
|
22
|
-
* comes first in the composition (the merged cell renders there); `skip` is the
|
|
23
|
-
* other (dropped, since it's merged in); `originalFirst` puts the original price
|
|
24
|
-
* on the left when it precedes the sale price (the default composition order).
|
|
25
|
-
*/
|
|
26
|
-
export declare function resolveInlinePriceOrder(composition: string[]): {
|
|
27
|
-
originalFirst: boolean;
|
|
28
|
-
anchor: string;
|
|
29
|
-
skip: string;
|
|
30
|
-
};
|
|
31
8
|
/**
|
|
32
9
|
* Reduces a raw product-attribute value to a displayable scalar string.
|
|
33
10
|
* Array-type attributes (filter types `Strings`/`Numbers`) are substituted with
|
|
@@ -80,15 +57,7 @@ export type Orientation = 'list' | 'grid';
|
|
|
80
57
|
/**
|
|
81
58
|
* Options for prepareProductRows unified function
|
|
82
59
|
*/
|
|
83
|
-
|
|
84
|
-
* Block-level price placement flags threaded into the row builders.
|
|
85
|
-
* - `priceInline`: render sale + original price on one line (skip the standalone
|
|
86
|
-
* original-price row).
|
|
87
|
-
*/
|
|
88
|
-
export interface PricePlacementFlags {
|
|
89
|
-
priceInline?: boolean;
|
|
90
|
-
}
|
|
91
|
-
export interface PrepareProductRowsOptions extends PricePlacementFlags {
|
|
60
|
+
export interface PrepareProductRowsOptions {
|
|
92
61
|
/** Number of products per row (only for grid layout, defaults to 3) */
|
|
93
62
|
productsPerRow?: number;
|
|
94
63
|
/** Number of products per row on mobile (only for grid layout, defaults to 1) */
|
|
@@ -155,4 +124,3 @@ export declare function getDefaultProducts(count?: number): RecommendationProduc
|
|
|
155
124
|
* @returns HTML template string with {-{-TITLE-}-}, {-{-PRODUCT_ROWS-}-}, and {-{-MOBILE_PRODUCT_ROWS-}-} (grid only) placeholders
|
|
156
125
|
*/
|
|
157
126
|
export declare function createBlockTemplate(layout?: Orientation, instanceClass?: string): string;
|
|
158
|
-
export {};
|
|
@@ -152,21 +152,6 @@ export interface RecommendationNodeConfig {
|
|
|
152
152
|
* Whether to trim long product names with ellipsis
|
|
153
153
|
*/
|
|
154
154
|
textTrimming: boolean;
|
|
155
|
-
/**
|
|
156
|
-
* Whether the price and original price render on separate stacked lines.
|
|
157
|
-
* - true (default): each on its own attribute row (current Guido look)
|
|
158
|
-
* - false: both rendered inline on the same line, and Card Composition
|
|
159
|
-
* collapses them into a single "Product Prices" entry
|
|
160
|
-
* Ported from the legacy product block's `isPriceMovedToNextLine`.
|
|
161
|
-
*/
|
|
162
|
-
priceMovedToNextLine: boolean;
|
|
163
|
-
/**
|
|
164
|
-
* Whether to hide the redundant original price when it equals the sale
|
|
165
|
-
* price (no real discount). Enforced in the real email via a liquid
|
|
166
|
-
* condition and mirrored in the editor on mock data.
|
|
167
|
-
* Ported from the legacy product block's `isPriceDeletedForZeroSale`.
|
|
168
|
-
*/
|
|
169
|
-
priceHideIfSameAsDiscounted: boolean;
|
|
170
155
|
/**
|
|
171
156
|
* Configuration version for future migrations
|
|
172
157
|
* Increment when making breaking changes to schema
|
|
@@ -20,6 +20,12 @@ export declare class UnsubscribeBlock extends Block {
|
|
|
20
20
|
onDestroy(): void;
|
|
21
21
|
private _hasUnsubscribeLink;
|
|
22
22
|
private _readBlockId;
|
|
23
|
+
/**
|
|
24
|
+
* True when the block has a page type and a page list — i.e. a template was
|
|
25
|
+
* applied. A block with neither, combined with an already-present block id,
|
|
26
|
+
* is an undo-restored orphan of a cancelled block.
|
|
27
|
+
*/
|
|
28
|
+
private _hasPageSelection;
|
|
23
29
|
/**
|
|
24
30
|
* Returns the block's stable id, assigning one via the document modifier if
|
|
25
31
|
* the node has not been tagged yet. Idempotent: subsequent calls during
|
|
@@ -15,6 +15,7 @@ export declare class UnsubscribeControl extends Control {
|
|
|
15
15
|
private get totalTemplates();
|
|
16
16
|
private _listenToFormUpdates;
|
|
17
17
|
private _onButtonClick;
|
|
18
|
+
private _reseedSelectionFromBlock;
|
|
18
19
|
private _onPrevClick;
|
|
19
20
|
private _onNextClick;
|
|
20
21
|
private _loadAndUpdatePreview;
|
|
@@ -65,8 +65,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
65
65
|
blockType?: string | undefined;
|
|
66
66
|
size?: string | number | undefined;
|
|
67
67
|
verticalResponsiveness?: boolean | undefined;
|
|
68
|
-
isPriceMovedToNextLine?: boolean | undefined;
|
|
69
|
-
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
70
68
|
} & {
|
|
71
69
|
[key: string]: unknown;
|
|
72
70
|
};
|
|
@@ -199,8 +197,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
199
197
|
blockType?: string | undefined;
|
|
200
198
|
size?: string | number | undefined;
|
|
201
199
|
verticalResponsiveness?: boolean | undefined;
|
|
202
|
-
isPriceMovedToNextLine?: boolean | undefined;
|
|
203
|
-
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
204
200
|
} & {
|
|
205
201
|
[key: string]: unknown;
|
|
206
202
|
};
|
|
@@ -333,8 +329,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
333
329
|
blockType?: string | undefined;
|
|
334
330
|
size?: string | number | undefined;
|
|
335
331
|
verticalResponsiveness?: boolean | undefined;
|
|
336
|
-
isPriceMovedToNextLine?: boolean | undefined;
|
|
337
|
-
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
338
332
|
} & {
|
|
339
333
|
[key: string]: unknown;
|
|
340
334
|
};
|
|
@@ -467,8 +461,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
467
461
|
blockType?: string | undefined;
|
|
468
462
|
size?: string | number | undefined;
|
|
469
463
|
verticalResponsiveness?: boolean | undefined;
|
|
470
|
-
isPriceMovedToNextLine?: boolean | undefined;
|
|
471
|
-
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
472
464
|
} & {
|
|
473
465
|
[key: string]: unknown;
|
|
474
466
|
};
|
|
@@ -601,8 +593,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
601
593
|
blockType?: string | undefined;
|
|
602
594
|
size?: string | number | undefined;
|
|
603
595
|
verticalResponsiveness?: boolean | undefined;
|
|
604
|
-
isPriceMovedToNextLine?: boolean | undefined;
|
|
605
|
-
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
606
596
|
} & {
|
|
607
597
|
[key: string]: unknown;
|
|
608
598
|
};
|
|
@@ -735,8 +725,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
735
725
|
blockType?: string | undefined;
|
|
736
726
|
size?: string | number | undefined;
|
|
737
727
|
verticalResponsiveness?: boolean | undefined;
|
|
738
|
-
isPriceMovedToNextLine?: boolean | undefined;
|
|
739
|
-
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
740
728
|
} & {
|
|
741
729
|
[key: string]: unknown;
|
|
742
730
|
};
|
|
@@ -869,8 +857,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
869
857
|
blockType?: string | undefined;
|
|
870
858
|
size?: string | number | undefined;
|
|
871
859
|
verticalResponsiveness?: boolean | undefined;
|
|
872
|
-
isPriceMovedToNextLine?: boolean | undefined;
|
|
873
|
-
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
874
860
|
} & {
|
|
875
861
|
[key: string]: unknown;
|
|
876
862
|
};
|
|
@@ -1003,8 +989,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1003
989
|
blockType?: string | undefined;
|
|
1004
990
|
size?: string | number | undefined;
|
|
1005
991
|
verticalResponsiveness?: boolean | undefined;
|
|
1006
|
-
isPriceMovedToNextLine?: boolean | undefined;
|
|
1007
|
-
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
1008
992
|
} & {
|
|
1009
993
|
[key: string]: unknown;
|
|
1010
994
|
};
|
|
@@ -1137,8 +1121,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1137
1121
|
blockType?: string | undefined;
|
|
1138
1122
|
size?: string | number | undefined;
|
|
1139
1123
|
verticalResponsiveness?: boolean | undefined;
|
|
1140
|
-
isPriceMovedToNextLine?: boolean | undefined;
|
|
1141
|
-
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
1142
1124
|
} & {
|
|
1143
1125
|
[key: string]: unknown;
|
|
1144
1126
|
};
|
|
@@ -1271,8 +1253,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1271
1253
|
blockType?: string | undefined;
|
|
1272
1254
|
size?: string | number | undefined;
|
|
1273
1255
|
verticalResponsiveness?: boolean | undefined;
|
|
1274
|
-
isPriceMovedToNextLine?: boolean | undefined;
|
|
1275
|
-
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
1276
1256
|
} & {
|
|
1277
1257
|
[key: string]: unknown;
|
|
1278
1258
|
};
|
|
@@ -1405,8 +1385,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1405
1385
|
blockType?: string | undefined;
|
|
1406
1386
|
size?: string | number | undefined;
|
|
1407
1387
|
verticalResponsiveness?: boolean | undefined;
|
|
1408
|
-
isPriceMovedToNextLine?: boolean | undefined;
|
|
1409
|
-
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
1410
1388
|
} & {
|
|
1411
1389
|
[key: string]: unknown;
|
|
1412
1390
|
};
|
|
@@ -1539,8 +1517,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1539
1517
|
blockType?: string | undefined;
|
|
1540
1518
|
size?: string | number | undefined;
|
|
1541
1519
|
verticalResponsiveness?: boolean | undefined;
|
|
1542
|
-
isPriceMovedToNextLine?: boolean | undefined;
|
|
1543
|
-
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
1544
1520
|
} & {
|
|
1545
1521
|
[key: string]: unknown;
|
|
1546
1522
|
};
|
|
@@ -1673,8 +1649,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1673
1649
|
blockType?: string | undefined;
|
|
1674
1650
|
size?: string | number | undefined;
|
|
1675
1651
|
verticalResponsiveness?: boolean | undefined;
|
|
1676
|
-
isPriceMovedToNextLine?: boolean | undefined;
|
|
1677
|
-
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
1678
1652
|
} & {
|
|
1679
1653
|
[key: string]: unknown;
|
|
1680
1654
|
};
|
|
@@ -1807,8 +1781,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1807
1781
|
blockType?: string | undefined;
|
|
1808
1782
|
size?: string | number | undefined;
|
|
1809
1783
|
verticalResponsiveness?: boolean | undefined;
|
|
1810
|
-
isPriceMovedToNextLine?: boolean | undefined;
|
|
1811
|
-
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
1812
1784
|
} & {
|
|
1813
1785
|
[key: string]: unknown;
|
|
1814
1786
|
};
|
|
@@ -1941,8 +1913,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1941
1913
|
blockType?: string | undefined;
|
|
1942
1914
|
size?: string | number | undefined;
|
|
1943
1915
|
verticalResponsiveness?: boolean | undefined;
|
|
1944
|
-
isPriceMovedToNextLine?: boolean | undefined;
|
|
1945
|
-
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
1946
1916
|
} & {
|
|
1947
1917
|
[key: string]: unknown;
|
|
1948
1918
|
};
|
|
@@ -2075,8 +2045,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2075
2045
|
blockType?: string | undefined;
|
|
2076
2046
|
size?: string | number | undefined;
|
|
2077
2047
|
verticalResponsiveness?: boolean | undefined;
|
|
2078
|
-
isPriceMovedToNextLine?: boolean | undefined;
|
|
2079
|
-
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
2080
2048
|
} & {
|
|
2081
2049
|
[key: string]: unknown;
|
|
2082
2050
|
};
|
|
@@ -2209,8 +2177,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2209
2177
|
blockType?: string | undefined;
|
|
2210
2178
|
size?: string | number | undefined;
|
|
2211
2179
|
verticalResponsiveness?: boolean | undefined;
|
|
2212
|
-
isPriceMovedToNextLine?: boolean | undefined;
|
|
2213
|
-
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
2214
2180
|
} & {
|
|
2215
2181
|
[key: string]: unknown;
|
|
2216
2182
|
};
|
|
@@ -2343,8 +2309,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2343
2309
|
blockType?: string | undefined;
|
|
2344
2310
|
size?: string | number | undefined;
|
|
2345
2311
|
verticalResponsiveness?: boolean | undefined;
|
|
2346
|
-
isPriceMovedToNextLine?: boolean | undefined;
|
|
2347
|
-
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
2348
2312
|
} & {
|
|
2349
2313
|
[key: string]: unknown;
|
|
2350
2314
|
};
|
|
@@ -10,6 +10,7 @@ interface StoreState {
|
|
|
10
10
|
typeSelectionDrawerStatus: boolean;
|
|
11
11
|
isGlobalUnsubscribeDisabled: boolean;
|
|
12
12
|
isSubscriptionPreferencesCenterDisabled: boolean;
|
|
13
|
+
pendingBlockId: string | null;
|
|
13
14
|
}
|
|
14
15
|
export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guidoUnsubscribe", StoreState, {
|
|
15
16
|
getSelectedCollection: (state: {
|
|
@@ -35,6 +36,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
35
36
|
typeSelectionDrawerStatus: boolean;
|
|
36
37
|
isGlobalUnsubscribeDisabled: boolean;
|
|
37
38
|
isSubscriptionPreferencesCenterDisabled: boolean;
|
|
39
|
+
pendingBlockId: string | null;
|
|
38
40
|
} & import("pinia").PiniaCustomStateProperties<StoreState>) => number[];
|
|
39
41
|
getSelectedTemplateByActiveType: (state: {
|
|
40
42
|
templates: {
|
|
@@ -59,6 +61,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
59
61
|
typeSelectionDrawerStatus: boolean;
|
|
60
62
|
isGlobalUnsubscribeDisabled: boolean;
|
|
61
63
|
isSubscriptionPreferencesCenterDisabled: boolean;
|
|
64
|
+
pendingBlockId: string | null;
|
|
62
65
|
} & import("pinia").PiniaCustomStateProperties<StoreState>) => number;
|
|
63
66
|
getTemplatesByActiveType: (state: {
|
|
64
67
|
templates: {
|
|
@@ -83,6 +86,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
83
86
|
typeSelectionDrawerStatus: boolean;
|
|
84
87
|
isGlobalUnsubscribeDisabled: boolean;
|
|
85
88
|
isSubscriptionPreferencesCenterDisabled: boolean;
|
|
89
|
+
pendingBlockId: string | null;
|
|
86
90
|
} & import("pinia").PiniaCustomStateProperties<StoreState>) => {
|
|
87
91
|
id: number;
|
|
88
92
|
name: string;
|
|
@@ -119,6 +123,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
119
123
|
typeSelectionDrawerStatus: boolean;
|
|
120
124
|
isGlobalUnsubscribeDisabled: boolean;
|
|
121
125
|
isSubscriptionPreferencesCenterDisabled: boolean;
|
|
126
|
+
pendingBlockId: string | null;
|
|
122
127
|
} & import("pinia").PiniaCustomStateProperties<StoreState>) => (id: number) => string;
|
|
123
128
|
getSelectedUnsubscribePagesByCollection: (state: {
|
|
124
129
|
templates: {
|
|
@@ -143,6 +148,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
143
148
|
typeSelectionDrawerStatus: boolean;
|
|
144
149
|
isGlobalUnsubscribeDisabled: boolean;
|
|
145
150
|
isSubscriptionPreferencesCenterDisabled: boolean;
|
|
151
|
+
pendingBlockId: string | null;
|
|
146
152
|
} & import("pinia").PiniaCustomStateProperties<StoreState>) => (collectionType: number) => number[];
|
|
147
153
|
isActiveTypeFirstInCollection: (state: {
|
|
148
154
|
templates: {
|
|
@@ -167,6 +173,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
167
173
|
typeSelectionDrawerStatus: boolean;
|
|
168
174
|
isGlobalUnsubscribeDisabled: boolean;
|
|
169
175
|
isSubscriptionPreferencesCenterDisabled: boolean;
|
|
176
|
+
pendingBlockId: string | null;
|
|
170
177
|
} & import("pinia").PiniaCustomStateProperties<StoreState>) => boolean;
|
|
171
178
|
isActiveTypeLastInCollection: (state: {
|
|
172
179
|
templates: {
|
|
@@ -191,6 +198,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
191
198
|
typeSelectionDrawerStatus: boolean;
|
|
192
199
|
isGlobalUnsubscribeDisabled: boolean;
|
|
193
200
|
isSubscriptionPreferencesCenterDisabled: boolean;
|
|
201
|
+
pendingBlockId: string | null;
|
|
194
202
|
} & import("pinia").PiniaCustomStateProperties<StoreState>) => boolean;
|
|
195
203
|
hasTemplatesByCollectionType: (state: {
|
|
196
204
|
templates: {
|
|
@@ -215,6 +223,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
215
223
|
typeSelectionDrawerStatus: boolean;
|
|
216
224
|
isGlobalUnsubscribeDisabled: boolean;
|
|
217
225
|
isSubscriptionPreferencesCenterDisabled: boolean;
|
|
226
|
+
pendingBlockId: string | null;
|
|
218
227
|
} & import("pinia").PiniaCustomStateProperties<StoreState>) => Record<number, boolean>;
|
|
219
228
|
unsubscribePagesStatus: (state: {
|
|
220
229
|
templates: {
|
|
@@ -239,10 +248,11 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
|
|
|
239
248
|
typeSelectionDrawerStatus: boolean;
|
|
240
249
|
isGlobalUnsubscribeDisabled: boolean;
|
|
241
250
|
isSubscriptionPreferencesCenterDisabled: boolean;
|
|
251
|
+
pendingBlockId: string | null;
|
|
242
252
|
} & import("pinia").PiniaCustomStateProperties<StoreState>) => boolean;
|
|
243
253
|
}, {
|
|
244
254
|
$reset(): void;
|
|
245
|
-
fetchTemplates(): Promise<void>;
|
|
255
|
+
fetchTemplates(force?: boolean): Promise<void>;
|
|
246
256
|
setCollection(collectionType: number): void;
|
|
247
257
|
setCollectionWithoutAutoSelection(collectionType: number): void;
|
|
248
258
|
setSelectedTemplate(template: number): void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TYPE_COLLECTIONS as i, PAGE_TYPES as p } from "../enums/unsubscribe.js";
|
|
2
2
|
import { useUnsubscribeApi as d } from "../services/unsubscribeApi.js";
|
|
3
|
-
import { defineStore as
|
|
3
|
+
import { defineStore as u } from "pinia";
|
|
4
4
|
let o = null;
|
|
5
5
|
const r = () => ({
|
|
6
6
|
templates: [],
|
|
@@ -12,8 +12,9 @@ const r = () => ({
|
|
|
12
12
|
pageSelectionDrawerStatus: !1,
|
|
13
13
|
typeSelectionDrawerStatus: !1,
|
|
14
14
|
isGlobalUnsubscribeDisabled: !1,
|
|
15
|
-
isSubscriptionPreferencesCenterDisabled: !1
|
|
16
|
-
|
|
15
|
+
isSubscriptionPreferencesCenterDisabled: !1,
|
|
16
|
+
pendingBlockId: null
|
|
17
|
+
}), b = u("guidoUnsubscribe", {
|
|
17
18
|
state: () => r(),
|
|
18
19
|
getters: {
|
|
19
20
|
getSelectedCollection: (e) => i[e.selectedCollectionType],
|
|
@@ -62,10 +63,10 @@ const r = () => ({
|
|
|
62
63
|
selectedUnsubscribePages: t
|
|
63
64
|
});
|
|
64
65
|
},
|
|
65
|
-
async fetchTemplates() {
|
|
66
|
-
this.templates.length || (
|
|
67
|
-
const { getUnsubscribePages:
|
|
68
|
-
this.templates = await
|
|
66
|
+
async fetchTemplates(e = !1) {
|
|
67
|
+
!e && this.templates.length || ((e || !o) && (o = (async () => {
|
|
68
|
+
const { getUnsubscribePages: t } = d();
|
|
69
|
+
this.templates = await t();
|
|
69
70
|
})().finally(() => {
|
|
70
71
|
o = null;
|
|
71
72
|
})), await o);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.7.0-beta.
|
|
3
|
+
"version": "3.7.0-beta.a1aaf44",
|
|
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,100 +0,0 @@
|
|
|
1
|
-
import { BLOCK_ROOT_SELECTOR as S, CURRENCY_ATTR as d, CONTAINER_SELECTOR as f } from "../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
2
|
-
import { useRecommendationExtensionStore as O } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
3
|
-
import { formatPrice as g } from "../extensions/Blocks/Recommendation/utils/priceFormatter.js";
|
|
4
|
-
const p = `${S}[recommendation-id]`, R = ".product-old-price", C = /\{\{(?:reco_)?(\d+_\d+_[a-zA-Z0-9_.]+)\}\}/g, h = new RegExp(
|
|
5
|
-
"\\{%\\s*if\\s+([\\s\\S]+?)\\s*%\\}([\\s\\S]*?)(?:\\{%\\s*else\\s*%\\}([\\s\\S]*?))?\\{%\\s*endif\\s*%\\}",
|
|
6
|
-
"g"
|
|
7
|
-
);
|
|
8
|
-
function T(e) {
|
|
9
|
-
const t = e.getAttribute(d.CURRENCY) || "USD", i = e.getAttribute(d.DECIMAL_SEPARATOR) || ".", s = e.getAttribute(d.THOUSAND_SEPARATOR) || ",";
|
|
10
|
-
return {
|
|
11
|
-
code: t,
|
|
12
|
-
symbol: e.getAttribute(d.SYMBOL) || t,
|
|
13
|
-
alignment: e.getAttribute(d.ALIGNMENT) === "0" ? "before" : "after",
|
|
14
|
-
decimalCount: parseInt(e.getAttribute(d.DECIMAL_COUNT) || "2") || 2,
|
|
15
|
-
decimalSeparator: i,
|
|
16
|
-
thousandSeparator: s
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
function _(e, t) {
|
|
20
|
-
return (e == null ? void 0 : e[t]) ?? Object.values(e ?? {})[0] ?? 0;
|
|
21
|
-
}
|
|
22
|
-
function b(e, t) {
|
|
23
|
-
const i = _(e.original_price, t), s = _(e.price, t), n = i > 0 ? Math.round((i - s) / i * 100) : 0;
|
|
24
|
-
return n > 0 ? `${n}%` : "0%";
|
|
25
|
-
}
|
|
26
|
-
function N(e, t, i, s, n, a) {
|
|
27
|
-
s.forEach((o, c) => {
|
|
28
|
-
const r = (m) => `${i}_${c}_${m}`, u = g({ price: _(o.price, n.code), currency: n }), l = g({ price: _(o.original_price, n.code), currency: n }), A = b(o, n.code);
|
|
29
|
-
e.set(r("name"), o.name ?? ""), e.set(r("image_url"), o.image_url ?? ""), e.set(r("url"), o.url ?? ""), e.set(r("item_id"), o.item_id ?? ""), e.set(r("currency"), ""), e.set(r("price"), u), e.set(r("original_price"), l), e.set(r("discount"), A), e.set(r("omnibus_price"), l), e.set(r("omnibus_discount"), A), a && u === l && t.add(`${i}_${c}`), Object.entries(o.product_attributes ?? {}).forEach(([m, E]) => {
|
|
30
|
-
e.set(r(`product_attribute.${m}`), String(E)), e.set(r(m), String(E));
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
function L(e, t) {
|
|
35
|
-
const i = e.match(/^(.+?)\s*(!=|==)\s*"([^"]*)"$/);
|
|
36
|
-
if (!i)
|
|
37
|
-
return !0;
|
|
38
|
-
const [, s, n, a] = i, o = t.get(s.trim()) ?? "";
|
|
39
|
-
return n === "!=" ? o !== a : o === a;
|
|
40
|
-
}
|
|
41
|
-
function P(e, t) {
|
|
42
|
-
return e.replace(
|
|
43
|
-
h,
|
|
44
|
-
(i, s, n, a) => s.split(/\s+and\s+/).every((c) => L(c.trim(), t)) ? n : a ?? ""
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
function $(e) {
|
|
48
|
-
let t = e;
|
|
49
|
-
for (; t.children.length === 1; )
|
|
50
|
-
[t] = t.children;
|
|
51
|
-
return t;
|
|
52
|
-
}
|
|
53
|
-
function D(e, t) {
|
|
54
|
-
var o;
|
|
55
|
-
if (!t.size)
|
|
56
|
-
return e;
|
|
57
|
-
const i = e.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), s = new DOMParser().parseFromString(i, "text/html");
|
|
58
|
-
s.querySelectorAll(p).forEach((c) => {
|
|
59
|
-
const r = Number(c.getAttribute("recommendation-id"));
|
|
60
|
-
if (!Number.isFinite(r))
|
|
61
|
-
return;
|
|
62
|
-
const u = c.querySelectorAll(f);
|
|
63
|
-
(u.length ? Array.from(u) : [c]).forEach((A) => {
|
|
64
|
-
A.querySelectorAll(R).forEach((m, E) => {
|
|
65
|
-
t.has(`${r}_${E}`) && ($(m).textContent = "");
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
const n = (o = e.match(/<!DOCTYPE[^>]*>/i)) == null ? void 0 : o[0];
|
|
70
|
-
return ((n ? `${n}
|
|
71
|
-
` : "") + s.documentElement.outerHTML).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
72
|
-
}
|
|
73
|
-
function I(e) {
|
|
74
|
-
if (!e || !e.includes("recommendation-block-v2"))
|
|
75
|
-
return e;
|
|
76
|
-
const t = O(), i = new DOMParser().parseFromString(e, "text/html"), s = Array.from(i.querySelectorAll(p)), n = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set();
|
|
77
|
-
if (s.forEach((c) => {
|
|
78
|
-
var l;
|
|
79
|
-
const r = Number(c.getAttribute("recommendation-id"));
|
|
80
|
-
if (!Number.isFinite(r))
|
|
81
|
-
return;
|
|
82
|
-
const u = ((l = t.blockStates[r]) == null ? void 0 : l.recommendationProducts) ?? [];
|
|
83
|
-
u.length && N(
|
|
84
|
-
n,
|
|
85
|
-
a,
|
|
86
|
-
r,
|
|
87
|
-
u,
|
|
88
|
-
T(c),
|
|
89
|
-
c.getAttribute("hide-price") === "true"
|
|
90
|
-
);
|
|
91
|
-
}), !n.size)
|
|
92
|
-
return e;
|
|
93
|
-
let o = D(e, a);
|
|
94
|
-
return o = o.replace(C, (c, r) => n.has(r) ? n.get(r) : c), o = P(o, n), o;
|
|
95
|
-
}
|
|
96
|
-
const x = () => ({ substituteRecommendationPreview: I });
|
|
97
|
-
export {
|
|
98
|
-
I as substituteRecommendationPreview,
|
|
99
|
-
x as useRecommendationPreview
|
|
100
|
-
};
|