@useinsider/guido 3.1.0 → 3.1.1-beta.02e79d6
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 +10 -8
- package/dist/composables/useHtmlValidator.js +40 -38
- package/dist/composables/useToaster.js +12 -10
- package/dist/config/compiler/unsubscribeCompilerRules.js +37 -37
- package/dist/config/i18n/en/tooltips.json.js +2 -1
- package/dist/extensions/Blocks/Recommendation/block.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +27 -11
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +185 -172
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +95 -93
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +75 -73
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +7 -5
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -29
- package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -7
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +3 -1
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +20 -20
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -50
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +6 -6
- package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +16 -17
- package/dist/src/@types/config/schemas.d.ts +4 -0
- package/dist/src/@types/generic.d.ts +0 -1
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +20 -3
- package/dist/src/stores/config.d.ts +18 -0
- package/dist/stores/toaster.js +7 -7
- package/dist/utils/templatePreparation.js +16 -14
- package/dist/utils/tooltipUtils.js +4 -5
- package/package.json +2 -2
|
@@ -1,55 +1,60 @@
|
|
|
1
|
-
import { ATTR_PRODUCT_IMAGE as m, ATTR_PRODUCT_NAME as
|
|
2
|
-
function
|
|
1
|
+
import { ATTR_PRODUCT_IMAGE as m, ATTR_PRODUCT_NAME as b, ATTR_PRODUCT_OLD_PRICE as T, ATTR_PRODUCT_PRICE as _, ATTR_PRODUCT_OMNIBUS_PRICE as g, ATTR_PRODUCT_OMNIBUS_DISCOUNT as C, ATTR_PRODUCT_BUTTON as f, ATTR_CUSTOM_PREFIX as u } from "../constants/selectors.js";
|
|
2
|
+
function U(t) {
|
|
3
3
|
return t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
function R(t, e) {
|
|
6
|
+
const n = Object.values(e).find((r) => r.attributeName === t);
|
|
7
|
+
return (n == null ? void 0 : n.type) === "defaultAttribute";
|
|
8
|
+
}
|
|
9
|
+
function y(t, e) {
|
|
10
|
+
return R(t, e) ? t : `product_attribute.${t}`;
|
|
11
|
+
}
|
|
12
|
+
const P = Symbol("customCellHtml");
|
|
13
|
+
function S(t, e, n = {}) {
|
|
14
|
+
const r = t[P];
|
|
15
|
+
if (!r)
|
|
9
16
|
return { ...t };
|
|
10
|
-
const
|
|
11
|
-
return e.filter((o) => o.startsWith(
|
|
12
|
-
const s = o.substring(
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
c != null ? String(c) : l
|
|
19
|
-
);
|
|
17
|
+
const l = { ...t };
|
|
18
|
+
return e.filter((o) => o.startsWith(u) && !l[o]).forEach((o) => {
|
|
19
|
+
const s = o.substring(u.length), a = U(s), D = y(s, n), O = R(s, n);
|
|
20
|
+
l[o] = (d) => {
|
|
21
|
+
var p;
|
|
22
|
+
const i = O ? d[s] : (p = d.product_attributes) == null ? void 0 : p[s];
|
|
23
|
+
let c = a;
|
|
24
|
+
return typeof i == "string" ? c = i : typeof i == "number" && (c = String(i)), r(D, c);
|
|
20
25
|
};
|
|
21
|
-
}),
|
|
26
|
+
}), l;
|
|
22
27
|
}
|
|
23
|
-
const
|
|
28
|
+
const L = {
|
|
24
29
|
TITLE: "You May Also Like!"
|
|
25
|
-
},
|
|
30
|
+
}, M = [
|
|
26
31
|
m,
|
|
27
|
-
|
|
32
|
+
b,
|
|
28
33
|
T,
|
|
29
|
-
u,
|
|
30
34
|
_,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
g,
|
|
36
|
+
C,
|
|
37
|
+
f
|
|
38
|
+
], $ = {
|
|
34
39
|
[m]: !0,
|
|
35
|
-
[
|
|
36
|
-
[
|
|
40
|
+
[b]: !0,
|
|
41
|
+
[_]: !0,
|
|
37
42
|
[T]: !0,
|
|
38
|
-
[
|
|
39
|
-
[
|
|
40
|
-
[
|
|
41
|
-
},
|
|
43
|
+
[g]: !1,
|
|
44
|
+
[C]: !1,
|
|
45
|
+
[f]: !0
|
|
46
|
+
}, h = `
|
|
42
47
|
<tr>
|
|
43
48
|
<td class="spacer" style="height: 10px;"></td>
|
|
44
49
|
</tr>
|
|
45
|
-
`,
|
|
46
|
-
function
|
|
47
|
-
return !t || typeof t != "string" || t.trim() === "" ?
|
|
50
|
+
`, A = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
|
|
51
|
+
function w(t) {
|
|
52
|
+
return !t || typeof t != "string" || t.trim() === "" ? A : t.startsWith("http://") ? t.replace("http://", "https://") : t;
|
|
48
53
|
}
|
|
49
|
-
function
|
|
54
|
+
function I(t) {
|
|
50
55
|
return {
|
|
51
56
|
name: "Product Name",
|
|
52
|
-
image_url:
|
|
57
|
+
image_url: A,
|
|
53
58
|
price: { USD: 18 },
|
|
54
59
|
original_price: { USD: 20 },
|
|
55
60
|
discount: { USD: 2 },
|
|
@@ -61,13 +66,13 @@ function D(t) {
|
|
|
61
66
|
category: []
|
|
62
67
|
};
|
|
63
68
|
}
|
|
64
|
-
function
|
|
69
|
+
function N(t = 6) {
|
|
65
70
|
return Array.from(
|
|
66
71
|
{ length: t },
|
|
67
|
-
(e, n) =>
|
|
72
|
+
(e, n) => I(String(n + 1))
|
|
68
73
|
);
|
|
69
74
|
}
|
|
70
|
-
function
|
|
75
|
+
function k(t = "grid", e) {
|
|
71
76
|
const n = t === "list" ? `
|
|
72
77
|
data-layout="list"` : "", r = e ? ` ${e}` : "";
|
|
73
78
|
return `
|
|
@@ -105,7 +110,7 @@ function y(t = "grid", e) {
|
|
|
105
110
|
</table>
|
|
106
111
|
</td>
|
|
107
112
|
</tr>
|
|
108
|
-
${
|
|
113
|
+
${h}
|
|
109
114
|
<tr>
|
|
110
115
|
<td>
|
|
111
116
|
<table
|
|
@@ -144,15 +149,17 @@ function y(t = "grid", e) {
|
|
|
144
149
|
`;
|
|
145
150
|
}
|
|
146
151
|
export {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
152
|
+
P as CUSTOM_CELL_HTML,
|
|
153
|
+
L as DEFAULTS,
|
|
154
|
+
M as DEFAULT_CARD_COMPOSITION,
|
|
155
|
+
$ as DEFAULT_CARD_VISIBILITY,
|
|
156
|
+
A as PLACEHOLDER_IMAGE,
|
|
157
|
+
S as buildElementRenderer,
|
|
158
|
+
k as createBlockTemplate,
|
|
159
|
+
N as getDefaultProducts,
|
|
160
|
+
R as isDefaultAttribute,
|
|
161
|
+
y as resolveProductAttrValue,
|
|
162
|
+
w as sanitizeImageUrl,
|
|
163
|
+
h as spacer,
|
|
164
|
+
U as toDisplayName
|
|
158
165
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
function a(t) {
|
|
2
2
|
return typeof t == "object" && t !== null && "tagName" in t && typeof t.tagName == "string";
|
|
3
3
|
}
|
|
4
|
-
function
|
|
4
|
+
function n(t) {
|
|
5
5
|
return typeof t == "object" && t !== null && "getTagName" in t && typeof t.getTagName == "function";
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function r(t) {
|
|
8
8
|
return typeof t == "object" && t !== null && "getStyle" in t && typeof t.getStyle == "function";
|
|
9
9
|
}
|
|
10
10
|
function u(t) {
|
|
@@ -14,13 +14,13 @@ function g(t) {
|
|
|
14
14
|
return typeof t == "object" && t !== null && "tagName" in t && t.tagName === "TD";
|
|
15
15
|
}
|
|
16
16
|
function p(t, e) {
|
|
17
|
-
return !t || !
|
|
17
|
+
return !t || !r(t) ? null : t.getStyle(e);
|
|
18
18
|
}
|
|
19
19
|
function N(t) {
|
|
20
|
-
return !t || !u(t) ? null : t.parent();
|
|
20
|
+
return !t || !u(t) ? null : t.parent() ?? null;
|
|
21
21
|
}
|
|
22
22
|
function l(t, e = "UNKNOWN") {
|
|
23
|
-
return t ? a(t) ? t.tagName.toUpperCase() :
|
|
23
|
+
return t ? a(t) ? t.tagName.toUpperCase() : n(t) ? t.getTagName().toUpperCase() : e : e;
|
|
24
24
|
}
|
|
25
25
|
const f = /* @__PURE__ */ new Set(["TD", "BLOCK_IMAGE", "BLOCK_BUTTON"]);
|
|
26
26
|
function i(t) {
|
|
@@ -36,7 +36,7 @@ function s(t) {
|
|
|
36
36
|
export {
|
|
37
37
|
s as getTableDisplayValue,
|
|
38
38
|
l as getTagName,
|
|
39
|
-
|
|
39
|
+
r as hasGetStyle,
|
|
40
40
|
u as hasParent,
|
|
41
41
|
c as isTableCellNode,
|
|
42
42
|
i as isTableCellTag,
|
|
@@ -1,35 +1,34 @@
|
|
|
1
|
-
import { SettingsPanelRegistry as e, SettingsPanelTab as
|
|
1
|
+
import { SettingsPanelRegistry as e, SettingsPanelTab as O, SettingsTab as t, TextControls as N } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { UNSUBSCRIBE_BLOCK_ID as I } from "./block.js";
|
|
3
3
|
import { UNSUBSCRIBE_CONTROL_ID as _ } from "./control.js";
|
|
4
|
-
class
|
|
4
|
+
class o extends e {
|
|
5
5
|
registerBlockControls(T) {
|
|
6
6
|
T[I] = [
|
|
7
|
-
new
|
|
7
|
+
new O(
|
|
8
8
|
t.SETTINGS,
|
|
9
9
|
[
|
|
10
10
|
_,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
N.FORMAT,
|
|
12
|
+
N.ALIGN,
|
|
13
|
+
N.LINE_HEIGHT,
|
|
14
|
+
N.DIRECTION,
|
|
15
|
+
N.INTERNAL_INDENTS,
|
|
16
|
+
N.HIDDEN_NODE
|
|
17
17
|
]
|
|
18
18
|
),
|
|
19
|
-
new
|
|
19
|
+
new O(
|
|
20
20
|
t.STYLES,
|
|
21
21
|
[
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
O.LINKS_COLOR
|
|
22
|
+
N.TEXT_BLOCK_BACKGROUND_COLOR,
|
|
23
|
+
N.FONT_FAMILY,
|
|
24
|
+
N.FONT_SIZE,
|
|
25
|
+
N.FONT_COLOR,
|
|
26
|
+
N.FONT_BACKGROUND_COLOR
|
|
28
27
|
]
|
|
29
28
|
)
|
|
30
29
|
];
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
32
|
export {
|
|
34
|
-
|
|
33
|
+
o as SettingsPanel
|
|
35
34
|
};
|
|
@@ -95,6 +95,8 @@ export declare const TemplateSchema: v.ObjectSchema<{
|
|
|
95
95
|
readonly value: v.StringSchema<undefined>;
|
|
96
96
|
}, undefined>, undefined>;
|
|
97
97
|
}, undefined>, undefined>, readonly []>;
|
|
98
|
+
/** Valid custom field attribute names from the partner's categorized fields */
|
|
99
|
+
readonly customFieldAttributes: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, readonly []>;
|
|
98
100
|
/** Selected unsubscribe page IDs */
|
|
99
101
|
readonly selectedUnsubscribePages: v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>;
|
|
100
102
|
/** Force recreate template in Stripo storage (use true when updating externally modified templates) */
|
|
@@ -422,6 +424,8 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
|
422
424
|
readonly value: v.StringSchema<undefined>;
|
|
423
425
|
}, undefined>, undefined>;
|
|
424
426
|
}, undefined>, undefined>, readonly []>;
|
|
427
|
+
/** Valid custom field attribute names from the partner's categorized fields */
|
|
428
|
+
readonly customFieldAttributes: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, readonly []>;
|
|
425
429
|
/** Selected unsubscribe page IDs */
|
|
426
430
|
readonly selectedUnsubscribePages: v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>;
|
|
427
431
|
/** Force recreate template in Stripo storage (use true when updating externally modified templates) */
|
|
@@ -30,6 +30,7 @@ export declare const useConfig: () => {
|
|
|
30
30
|
value: string;
|
|
31
31
|
} | undefined;
|
|
32
32
|
}[];
|
|
33
|
+
customFieldAttributes: string[];
|
|
33
34
|
selectedUnsubscribePages: number[];
|
|
34
35
|
forceRecreate: boolean;
|
|
35
36
|
};
|
|
@@ -121,6 +122,7 @@ export declare const useConfig: () => {
|
|
|
121
122
|
value: string;
|
|
122
123
|
} | undefined;
|
|
123
124
|
}[];
|
|
125
|
+
customFieldAttributes: string[];
|
|
124
126
|
selectedUnsubscribePages: number[];
|
|
125
127
|
forceRecreate: boolean;
|
|
126
128
|
} | null>;
|
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export { RecommendationBlockId } from './blockIds';
|
|
10
10
|
export { RecommendationControlId } from './controlIds';
|
|
11
|
-
export { BLOCK_ROOT_SELECTOR, CONTAINER_SELECTOR, DESKTOP_CONTAINER_SELECTOR, MOBILE_CONTAINER_SELECTOR, MOBILE_ROW_SELECTOR, CURRENCY_ATTR, ATTR_PRODUCT_IMAGE, ATTR_PRODUCT_NAME, ATTR_PRODUCT_PRICE, ATTR_PRODUCT_OLD_PRICE, ATTR_PRODUCT_OMNIBUS_PRICE, ATTR_PRODUCT_OMNIBUS_DISCOUNT, ATTR_PRODUCT_BUTTON, ATTR_CUSTOM_PREFIX, ATTR_DATA_CUSTOM_ATTRIBUTES, ATTR_PRODUCT_ATTR, } from './selectors';
|
|
11
|
+
export { BLOCK_ROOT_SELECTOR, CONTAINER_SELECTOR, DESKTOP_CONTAINER_SELECTOR, MOBILE_CONTAINER_SELECTOR, MOBILE_ROW_SELECTOR, CURRENCY_ATTR, ATTR_PRODUCT_IMAGE, ATTR_PRODUCT_NAME, ATTR_PRODUCT_PRICE, ATTR_PRODUCT_OLD_PRICE, ATTR_PRODUCT_OMNIBUS_PRICE, ATTR_PRODUCT_OMNIBUS_DISCOUNT, ATTR_PRODUCT_BUTTON, ATTR_CUSTOM_PREFIX, ATTR_DATA_CUSTOM_ATTRIBUTES, ATTR_PRODUCT_ATTR, BUILT_IN_DEFAULT_ATTRIBUTES, } from './selectors';
|
|
12
12
|
export { LAYOUT_VALUES, LAYOUT_OPTIONS, DEFAULT_PRODUCTS_PER_ROW, DEFAULT_CARDS_IN_ROW, DEFAULT_MOBILE_CARDS_IN_ROW, MAX_PRODUCT_COUNT, MIN_PRODUCT_COUNT, MAX_PRODUCTS_PER_ROW, MIN_PRODUCTS_PER_ROW, MAX_MOBILE_PRODUCTS_PER_ROW, MIN_MOBILE_PRODUCTS_PER_ROW, DEFAULT_COLUMN_SPACING, DEFAULT_ROW_SPACING, DEFAULT_MOBILE_COLUMN_SPACING, DEFAULT_MOBILE_ROW_SPACING, MIN_SPACING, MAX_SPACING, SPACING_STEP, } from './layout';
|
|
13
13
|
export { DEFAULT_NODE_CONFIG, DEFAULT_CURRENCY, DEFAULT_COMPOSITION, DEFAULT_VISIBILITY, CURRENT_CONFIG_VERSION, EXCLUDED_ALGORITHM_IDS, } from './defaultConfig';
|
|
@@ -50,3 +50,8 @@ export declare const ATTR_CUSTOM_PREFIX = "customAttr:";
|
|
|
50
50
|
export declare const ATTR_DATA_CUSTOM_ATTRIBUTES = "data-custom-attributes";
|
|
51
51
|
/** HTML attribute on <td> elements identifying the product attribute for compiler template variable generation */
|
|
52
52
|
export declare const ATTR_PRODUCT_ATTR = "product-attr";
|
|
53
|
+
/**
|
|
54
|
+
* Default attribute names that are already represented by built-in composition toggle items.
|
|
55
|
+
* Used to exclude these from the custom attribute dropdown to prevent duplication with toggles.
|
|
56
|
+
*/
|
|
57
|
+
export declare const BUILT_IN_DEFAULT_ATTRIBUTES: Set<string>;
|
|
@@ -170,6 +170,11 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
170
170
|
* When filterList changes (e.g. after async fetch), re-renders dropdowns with new options.
|
|
171
171
|
*/
|
|
172
172
|
private _subscribeToStoreChanges;
|
|
173
|
+
/**
|
|
174
|
+
* Returns filters eligible for the custom attribute dropdown,
|
|
175
|
+
* excluding default attributes already covered by built-in toggle items.
|
|
176
|
+
*/
|
|
177
|
+
private _getAddableFilters;
|
|
173
178
|
/**
|
|
174
179
|
* Looks up the display name for an attribute from the store's filterList.
|
|
175
180
|
* Falls back to Title Case conversion of the snake_case attribute name.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RecommendationProduct } from '@@/Types/recommendation';
|
|
1
|
+
import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
|
|
2
2
|
import { type ElementRenderer } from '../utils';
|
|
3
3
|
/**
|
|
4
4
|
* Generates attribute-aligned product rows for grid layout.
|
|
@@ -9,7 +9,7 @@ import { type ElementRenderer } 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[]): string;
|
|
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[]): string;
|
|
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[]): string;
|
|
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,4 @@
|
|
|
1
|
-
import type { RecommendationProduct } from '@@/Types/recommendation';
|
|
1
|
+
import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
|
|
2
2
|
/**
|
|
3
3
|
* Generates a list product card with 3-column layout
|
|
4
4
|
* Uses buildElementRenderer to render Image, Info content, and Button
|
|
@@ -11,7 +11,7 @@ import type { RecommendationProduct } from '@@/Types/recommendation';
|
|
|
11
11
|
* @param composition - Array defining order of card elements
|
|
12
12
|
* @returns HTML string for a single product card row
|
|
13
13
|
*/
|
|
14
|
-
export declare function getListProductCard(product: RecommendationProduct, composition?: string[]): string;
|
|
14
|
+
export declare function getListProductCard(product: RecommendationProduct, composition?: string[], filterList?: FiltersResponse): string;
|
|
15
15
|
/**
|
|
16
16
|
* Prepares list product rows
|
|
17
17
|
* Each product is a full-width row with 3-column layout
|
|
@@ -19,6 +19,6 @@ export declare function getListProductCard(product: RecommendationProduct, compo
|
|
|
19
19
|
* @param composition - Array defining order of card elements
|
|
20
20
|
* @returns HTML string for product rows
|
|
21
21
|
*/
|
|
22
|
-
export declare function prepareProductRows(products: RecommendationProduct[], composition?: string[]): string;
|
|
22
|
+
export declare function prepareProductRows(products: RecommendationProduct[], composition?: string[], filterList?: FiltersResponse): string;
|
|
23
23
|
export declare function getDefaultTemplate(): string;
|
|
24
24
|
export declare function generateBlockTemplate(products: RecommendationProduct[], title?: string, composition?: string[]): string;
|
|
@@ -1,15 +1,29 @@
|
|
|
1
|
-
import type { RecommendationProduct } from '@@/Types/recommendation';
|
|
1
|
+
import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
|
|
2
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';
|
|
3
3
|
/**
|
|
4
4
|
* Converts a snake_case attribute name to Title Case display name.
|
|
5
5
|
* e.g., "rating_star" → "Rating Star"
|
|
6
6
|
*/
|
|
7
7
|
export declare function toDisplayName(attrName: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Checks whether an attribute is a default (top-level) product attribute
|
|
10
|
+
* vs a custom product attribute (nested under `product_attributes`).
|
|
11
|
+
* Returns false when filterList is empty or the attribute is not found.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isDefaultAttribute(attrName: string, filterList: FiltersResponse): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Resolves the `product-attr` HTML attribute value based on attribute type from the filter list.
|
|
16
|
+
* - Default attributes → attribute name directly (e.g., "brand") → compiles to `{{1_0_brand}}`
|
|
17
|
+
* - Product attributes → "product_attribute.<name>" (e.g., "product_attribute.rating_star")
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveProductAttrValue(attrName: string, filterList: FiltersResponse): string;
|
|
8
20
|
/**
|
|
9
21
|
* Callback that generates the cell HTML for a custom product attribute.
|
|
10
22
|
* Layout-specific: grid returns `<td>…`, list returns `<tr><td>…</td></tr>`.
|
|
23
|
+
* @param productAttrValue - The resolved `product-attr` value (e.g., "brand" or "product_attribute.rating_star")
|
|
24
|
+
* @param content - The display content for the cell
|
|
11
25
|
*/
|
|
12
|
-
export type CustomCellHtmlGetter = (
|
|
26
|
+
export type CustomCellHtmlGetter = (productAttrValue: string, content: string) => string;
|
|
13
27
|
/**
|
|
14
28
|
* Symbol key for embedding custom attribute HTML in an ElementRenderer.
|
|
15
29
|
* Grid and list renderers store their custom-attribute cell template under this key
|
|
@@ -28,8 +42,9 @@ export declare const CUSTOM_CELL_HTML: unique symbol;
|
|
|
28
42
|
* alongside built-in ones, so template code can use a uniform lookup for all attributes.
|
|
29
43
|
* @param baseRenderer - The built-in element renderer (grid or list), must include a [CUSTOM_CELL_HTML] entry
|
|
30
44
|
* @param composition - Array of attribute keys including `customAttr:*` entries
|
|
45
|
+
* @param filterList - Filter list from the store, used to determine attribute type for correct product-attr resolution
|
|
31
46
|
*/
|
|
32
|
-
export declare function buildElementRenderer(baseRenderer: ElementRenderer, composition: string[]): ElementRenderer;
|
|
47
|
+
export declare function buildElementRenderer(baseRenderer: ElementRenderer, composition: string[], filterList?: FiltersResponse): ElementRenderer;
|
|
33
48
|
export type Orientation = 'list' | 'grid';
|
|
34
49
|
/**
|
|
35
50
|
* Options for prepareProductRows unified function
|
|
@@ -41,6 +56,8 @@ export interface PrepareProductRowsOptions {
|
|
|
41
56
|
mobileProductsPerRow?: number;
|
|
42
57
|
/** Array defining order of card elements */
|
|
43
58
|
composition?: string[];
|
|
59
|
+
/** Filter list for attribute type resolution (default vs product attributes) */
|
|
60
|
+
filterList?: FiltersResponse;
|
|
44
61
|
}
|
|
45
62
|
/**
|
|
46
63
|
* Element renderer interface for product card elements.
|
|
@@ -35,6 +35,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
35
35
|
value: string;
|
|
36
36
|
} | undefined;
|
|
37
37
|
}[];
|
|
38
|
+
customFieldAttributes: string[];
|
|
38
39
|
selectedUnsubscribePages: number[];
|
|
39
40
|
forceRecreate: boolean;
|
|
40
41
|
};
|
|
@@ -132,6 +133,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
132
133
|
value: string;
|
|
133
134
|
} | undefined;
|
|
134
135
|
}[];
|
|
136
|
+
customFieldAttributes: string[];
|
|
135
137
|
selectedUnsubscribePages: number[];
|
|
136
138
|
forceRecreate: boolean;
|
|
137
139
|
};
|
|
@@ -229,6 +231,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
229
231
|
value: string;
|
|
230
232
|
} | undefined;
|
|
231
233
|
}[];
|
|
234
|
+
customFieldAttributes: string[];
|
|
232
235
|
selectedUnsubscribePages: number[];
|
|
233
236
|
forceRecreate: boolean;
|
|
234
237
|
};
|
|
@@ -326,6 +329,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
326
329
|
value: string;
|
|
327
330
|
} | undefined;
|
|
328
331
|
}[];
|
|
332
|
+
customFieldAttributes: string[];
|
|
329
333
|
selectedUnsubscribePages: number[];
|
|
330
334
|
forceRecreate: boolean;
|
|
331
335
|
};
|
|
@@ -423,6 +427,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
423
427
|
value: string;
|
|
424
428
|
} | undefined;
|
|
425
429
|
}[];
|
|
430
|
+
customFieldAttributes: string[];
|
|
426
431
|
selectedUnsubscribePages: number[];
|
|
427
432
|
forceRecreate: boolean;
|
|
428
433
|
};
|
|
@@ -520,6 +525,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
520
525
|
value: string;
|
|
521
526
|
} | undefined;
|
|
522
527
|
}[];
|
|
528
|
+
customFieldAttributes: string[];
|
|
523
529
|
selectedUnsubscribePages: number[];
|
|
524
530
|
forceRecreate: boolean;
|
|
525
531
|
};
|
|
@@ -617,6 +623,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
617
623
|
value: string;
|
|
618
624
|
} | undefined;
|
|
619
625
|
}[];
|
|
626
|
+
customFieldAttributes: string[];
|
|
620
627
|
selectedUnsubscribePages: number[];
|
|
621
628
|
forceRecreate: boolean;
|
|
622
629
|
};
|
|
@@ -714,6 +721,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
714
721
|
value: string;
|
|
715
722
|
} | undefined;
|
|
716
723
|
}[];
|
|
724
|
+
customFieldAttributes: string[];
|
|
717
725
|
selectedUnsubscribePages: number[];
|
|
718
726
|
forceRecreate: boolean;
|
|
719
727
|
};
|
|
@@ -811,6 +819,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
811
819
|
value: string;
|
|
812
820
|
} | undefined;
|
|
813
821
|
}[];
|
|
822
|
+
customFieldAttributes: string[];
|
|
814
823
|
selectedUnsubscribePages: number[];
|
|
815
824
|
forceRecreate: boolean;
|
|
816
825
|
};
|
|
@@ -908,6 +917,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
908
917
|
value: string;
|
|
909
918
|
} | undefined;
|
|
910
919
|
}[];
|
|
920
|
+
customFieldAttributes: string[];
|
|
911
921
|
selectedUnsubscribePages: number[];
|
|
912
922
|
forceRecreate: boolean;
|
|
913
923
|
};
|
|
@@ -1005,6 +1015,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1005
1015
|
value: string;
|
|
1006
1016
|
} | undefined;
|
|
1007
1017
|
}[];
|
|
1018
|
+
customFieldAttributes: string[];
|
|
1008
1019
|
selectedUnsubscribePages: number[];
|
|
1009
1020
|
forceRecreate: boolean;
|
|
1010
1021
|
};
|
|
@@ -1102,6 +1113,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1102
1113
|
value: string;
|
|
1103
1114
|
} | undefined;
|
|
1104
1115
|
}[];
|
|
1116
|
+
customFieldAttributes: string[];
|
|
1105
1117
|
selectedUnsubscribePages: number[];
|
|
1106
1118
|
forceRecreate: boolean;
|
|
1107
1119
|
};
|
|
@@ -1199,6 +1211,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1199
1211
|
value: string;
|
|
1200
1212
|
} | undefined;
|
|
1201
1213
|
}[];
|
|
1214
|
+
customFieldAttributes: string[];
|
|
1202
1215
|
selectedUnsubscribePages: number[];
|
|
1203
1216
|
forceRecreate: boolean;
|
|
1204
1217
|
};
|
|
@@ -1296,6 +1309,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1296
1309
|
value: string;
|
|
1297
1310
|
} | undefined;
|
|
1298
1311
|
}[];
|
|
1312
|
+
customFieldAttributes: string[];
|
|
1299
1313
|
selectedUnsubscribePages: number[];
|
|
1300
1314
|
forceRecreate: boolean;
|
|
1301
1315
|
};
|
|
@@ -1393,6 +1407,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1393
1407
|
value: string;
|
|
1394
1408
|
} | undefined;
|
|
1395
1409
|
}[];
|
|
1410
|
+
customFieldAttributes: string[];
|
|
1396
1411
|
selectedUnsubscribePages: number[];
|
|
1397
1412
|
forceRecreate: boolean;
|
|
1398
1413
|
};
|
|
@@ -1490,6 +1505,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1490
1505
|
value: string;
|
|
1491
1506
|
} | undefined;
|
|
1492
1507
|
}[];
|
|
1508
|
+
customFieldAttributes: string[];
|
|
1493
1509
|
selectedUnsubscribePages: number[];
|
|
1494
1510
|
forceRecreate: boolean;
|
|
1495
1511
|
};
|
|
@@ -1587,6 +1603,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1587
1603
|
value: string;
|
|
1588
1604
|
} | undefined;
|
|
1589
1605
|
}[];
|
|
1606
|
+
customFieldAttributes: string[];
|
|
1590
1607
|
selectedUnsubscribePages: number[];
|
|
1591
1608
|
forceRecreate: boolean;
|
|
1592
1609
|
};
|
|
@@ -1684,6 +1701,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1684
1701
|
value: string;
|
|
1685
1702
|
} | undefined;
|
|
1686
1703
|
}[];
|
|
1704
|
+
customFieldAttributes: string[];
|
|
1687
1705
|
selectedUnsubscribePages: number[];
|
|
1688
1706
|
forceRecreate: boolean;
|
|
1689
1707
|
};
|
package/dist/stores/toaster.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { ToasterTypeOptions as
|
|
1
|
+
import { ToasterTypeOptions as e } from "../enums/toaster.js";
|
|
2
2
|
import { defineStore as i } from "pinia";
|
|
3
3
|
const a = () => ({
|
|
4
4
|
status: !1,
|
|
5
|
-
type:
|
|
5
|
+
type: e.Success,
|
|
6
6
|
text: "",
|
|
7
7
|
icon: "",
|
|
8
8
|
withIcon: !0,
|
|
9
9
|
withoutLeftMargin: !1,
|
|
10
10
|
actionButton: void 0
|
|
11
|
-
}),
|
|
11
|
+
}), n = i("guidoToaster", {
|
|
12
12
|
state: () => a(),
|
|
13
13
|
getters: {
|
|
14
14
|
shouldAutoHide: (t) => t.status && !!t.text
|
|
15
15
|
},
|
|
16
16
|
actions: {
|
|
17
|
-
showToaster({ type: t =
|
|
18
|
-
this.status = !0, this.text =
|
|
17
|
+
showToaster({ type: t = e.Success, message: s, actionButton: o }) {
|
|
18
|
+
this.status = !0, this.text = s, this.type = t, this.actionButton = o;
|
|
19
19
|
},
|
|
20
20
|
hideToaster() {
|
|
21
|
-
this.status = !1
|
|
21
|
+
this.status = !1;
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
export {
|
|
26
|
-
|
|
26
|
+
n as useToasterStore
|
|
27
27
|
};
|
|
@@ -3,22 +3,24 @@ import { useHtmlCompiler as C } from "../composables/useHtmlCompiler.js";
|
|
|
3
3
|
import { useRecommendationExtensionStore as T } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
4
4
|
import { useDynamicContentStore as x } from "../stores/dynamic-content.js";
|
|
5
5
|
import { useUnsubscribeStore as y } from "../stores/unsubscribe.js";
|
|
6
|
-
const
|
|
7
|
-
const o = x(),
|
|
6
|
+
const w = () => {
|
|
7
|
+
const o = x(), e = y(), { getCompiledEmail: i, getTemplateData: s, editorSave: n } = f(), { compileHtml: a } = C();
|
|
8
8
|
return {
|
|
9
9
|
prepareTemplateDetails: async () => {
|
|
10
|
-
const { html:
|
|
10
|
+
const { html: m, ampHtml: r = "", ampErrors: c = [] } = await i({
|
|
11
11
|
minimize: !0,
|
|
12
12
|
resetDataSavedFlag: !1
|
|
13
|
-
}), { html: l, css: p, syncModulesIds: u = [] } = await
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
13
|
+
}), { html: l, css: p, syncModulesIds: u = [] } = await s();
|
|
14
|
+
e.selectedUnsubscribePages.length && await e.fetchTemplates();
|
|
15
|
+
const { compiledHtml: d, stats: t, appliedRules: g } = a(m), S = o.getSelectedDynamicContentList, b = T();
|
|
16
|
+
return n(), console.debug("HTML Compilation Stats:", {
|
|
17
|
+
originalSize: t.originalSize,
|
|
18
|
+
compiledSize: t.compiledSize,
|
|
19
|
+
reduction: `${t.reductionPercentage.toFixed(2)}%`,
|
|
20
|
+
appliedRules: g,
|
|
21
|
+
executionTime: `${t.executionTime.toFixed(2)}ms`
|
|
20
22
|
}), {
|
|
21
|
-
dynamicContentList:
|
|
23
|
+
dynamicContentList: S,
|
|
22
24
|
compiledHtml: d,
|
|
23
25
|
rawHtml: l,
|
|
24
26
|
css: p,
|
|
@@ -30,13 +32,13 @@ const E = () => {
|
|
|
30
32
|
configs: {}
|
|
31
33
|
},
|
|
32
34
|
unsubscribe: {
|
|
33
|
-
status:
|
|
34
|
-
config:
|
|
35
|
+
status: e.unsubscribePagesStatus,
|
|
36
|
+
config: e.selectedUnsubscribePages
|
|
35
37
|
}
|
|
36
38
|
};
|
|
37
39
|
}
|
|
38
40
|
};
|
|
39
41
|
};
|
|
40
42
|
export {
|
|
41
|
-
|
|
43
|
+
w as useTemplatePreparation
|
|
42
44
|
};
|