@useinsider/guido 3.6.0-beta.6fd3d23 → 3.6.0-beta.70bbf9f
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/composables/useHtmlValidator.js +165 -118
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +28 -27
- package/dist/config/compiler/utils/recommendationIgnoreUtils.js +15 -0
- package/dist/config/migrator/recommendation/extractors.js +44 -22
- package/dist/config/migrator/recommendation/htmlBuilder.js +175 -169
- package/dist/config/migrator/recommendationMigrator.js +30 -31
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +21 -15
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +38 -24
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +39 -38
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +45 -35
- package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +3 -2
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +62 -52
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +74 -67
- package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +7 -6
- package/dist/extensions/Blocks/Recommendation/extension.js +6 -5
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +3 -2
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +3 -2
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +2 -4
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -2
- package/dist/extensions/Blocks/Recommendation/templates/index.js +5 -4
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +8 -8
- package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +17 -17
- package/dist/src/composables/useHtmlValidator.d.ts +27 -0
- package/dist/src/config/compiler/utils/recommendationIgnoreUtils.d.ts +17 -0
- package/dist/src/config/compiler/utils/recommendationIgnoreUtils.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +15 -0
- package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +8 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +21 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +9 -0
- package/package.json +1 -1
- /package/dist/src/{extensions/Blocks/Recommendation/utils/priceFormatter.test.d.ts → composables/useHtmlValidator.test.d.ts} +0 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { ExtensionBuilder as r } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { RecommendationBlock as m } from "./block.js";
|
|
3
3
|
import { RecommendationBlockControl as n } from "./controls/main/index.js";
|
|
4
|
+
import "./constants/selectors.js";
|
|
4
5
|
import "./store/recommendation.js";
|
|
5
6
|
import { NameControls as i } from "./controls/name/index.js";
|
|
6
7
|
import { PriceControls as e } from "./controls/price/index.js";
|
|
7
8
|
import { OldPriceControls as s } from "./controls/oldPrice/index.js";
|
|
8
9
|
import { OmnibusPriceControls as l } from "./controls/omnibusPrice/index.js";
|
|
9
|
-
import { OmnibusDiscountControls as
|
|
10
|
-
import { ButtonControls as
|
|
10
|
+
import { OmnibusDiscountControls as p } from "./controls/omnibusDiscount/index.js";
|
|
11
|
+
import { ButtonControls as a } from "./controls/button/index.js";
|
|
11
12
|
import { ImageControls as c } from "./controls/image/index.js";
|
|
12
13
|
import { CustomAttributeControls as C } from "./controls/customAttribute/index.js";
|
|
13
14
|
import { SpacingControl as f } from "./controls/spacing/index.js";
|
|
@@ -22,8 +23,8 @@ const b = [
|
|
|
22
23
|
e,
|
|
23
24
|
s,
|
|
24
25
|
l,
|
|
25
|
-
a,
|
|
26
26
|
p,
|
|
27
|
+
a,
|
|
27
28
|
c,
|
|
28
29
|
C
|
|
29
30
|
], P = [
|
|
@@ -35,10 +36,10 @@ const b = [
|
|
|
35
36
|
], S = [
|
|
36
37
|
...P,
|
|
37
38
|
...b.flatMap((o) => Object.values(o))
|
|
38
|
-
],
|
|
39
|
+
], L = S.reduce(
|
|
39
40
|
(o, t) => o.addControl(t),
|
|
40
41
|
new r().addBlock(m).withSettingsPanelRegistry(B)
|
|
41
42
|
).addStyles(y).withIconsRegistry(R).build();
|
|
42
43
|
export {
|
|
43
|
-
|
|
44
|
+
L as default
|
|
44
45
|
};
|
|
@@ -2,6 +2,7 @@ import { SettingsPanelRegistry as E, SettingsPanelTab as _, SettingsTab as O, Co
|
|
|
2
2
|
import { BLOCK_ID as U } from "./block.js";
|
|
3
3
|
import { RecommendationBlockId as S } from "./constants/blockIds.js";
|
|
4
4
|
import { RecommendationControlId as T } from "./constants/controlIds.js";
|
|
5
|
+
import "./constants/selectors.js";
|
|
5
6
|
import { CONTROL_BLOCK_ID as A } from "./controls/main/index.js";
|
|
6
7
|
import "./store/recommendation.js";
|
|
7
8
|
import "./controls/name/index.js";
|
|
@@ -15,7 +16,7 @@ import { SPACING_CONTROL_ID as L } from "./controls/spacing/index.js";
|
|
|
15
16
|
import { CARD_BACKGROUND_COLOR_CONTROL_ID as D } from "./controls/cardBackground/index.js";
|
|
16
17
|
import { COMPOSITION_CONTROL_BLOCK_ID as B } from "./controls/cardComposition/index.js";
|
|
17
18
|
import { SYNC_INFO_MESSAGE_CONTROL_ID as N } from "./controls/syncInfoMessage.js";
|
|
18
|
-
class
|
|
19
|
+
class a extends E {
|
|
19
20
|
registerBlockControls(I) {
|
|
20
21
|
I[U] = [
|
|
21
22
|
new _(
|
|
@@ -194,5 +195,5 @@ class Z extends E {
|
|
|
194
195
|
}
|
|
195
196
|
}
|
|
196
197
|
export {
|
|
197
|
-
|
|
198
|
+
a as SettingsPanel
|
|
198
199
|
};
|
|
@@ -2,6 +2,7 @@ import { getRecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAtt
|
|
|
2
2
|
import { useRecommendationApi as y } from "../../../../services/recommendationApi.js";
|
|
3
3
|
import { useConfigStore as G } from "../../../../stores/config.js";
|
|
4
4
|
import { defineStore as P } from "pinia";
|
|
5
|
+
import "../constants/selectors.js";
|
|
5
6
|
import { DEFAULT_CARDS_IN_ROW as F } from "../constants/layout.js";
|
|
6
7
|
import { EXCLUDED_ALGORITHM_IDS as D } from "../constants/defaultConfig.js";
|
|
7
8
|
import { getDefaultProducts as S } from "../templates/utils.js";
|
|
@@ -59,7 +60,7 @@ const x = () => ({
|
|
|
59
60
|
blockStates: {},
|
|
60
61
|
currentRecommendationId: null,
|
|
61
62
|
configVersion: 0
|
|
62
|
-
}),
|
|
63
|
+
}), K = P("guidoRecommendationExtension", {
|
|
63
64
|
state: () => x(),
|
|
64
65
|
getters: {
|
|
65
66
|
// ====================================================================
|
|
@@ -475,5 +476,5 @@ const x = () => ({
|
|
|
475
476
|
}
|
|
476
477
|
});
|
|
477
478
|
export {
|
|
478
|
-
|
|
479
|
+
K as useRecommendationExtensionStore
|
|
479
480
|
};
|
|
@@ -115,10 +115,8 @@ const S = {
|
|
|
115
115
|
class="esd-block-text product-old-price es-p15l es-p15r"
|
|
116
116
|
align="center"
|
|
117
117
|
esd-extension-block-id="${s.OLD_PRICE}">
|
|
118
|
-
<p
|
|
119
|
-
|
|
120
|
-
style="font-size: 14px; color: #999999;">
|
|
121
|
-
<s><strong>${i(t, "original_price")}</strong></s>
|
|
118
|
+
<p contenteditable="false" style="font-size: 14px; color: #999999;">
|
|
119
|
+
<strong>${i(t, "original_price")}</strong>
|
|
122
120
|
</p>
|
|
123
121
|
</td>
|
|
124
122
|
</tr>
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "../../constants/selectors.js";
|
|
1
2
|
import { DEFAULT_PRODUCTS_PER_ROW as L } from "../../constants/layout.js";
|
|
2
3
|
import { getDefaultProducts as E, DEFAULTS as I, createBlockTemplate as _, DEFAULT_CARD_COMPOSITION as S, spacer as b, buildElementRenderer as A, DEFAULT_CARD_VISIBILITY as f } from "../utils.js";
|
|
3
4
|
import { ATTRIBUTE_CELL_CLASS as w, DEFAULT_CELL_PADDING as D, gridElementRenderer as C } from "./elementRenderer.js";
|
|
@@ -52,12 +53,12 @@ function U(t, e, o, r, n = {}) {
|
|
|
52
53
|
function h(t, e, o, r = {}) {
|
|
53
54
|
return U(t, e, C, o, r);
|
|
54
55
|
}
|
|
55
|
-
function
|
|
56
|
+
function H(t) {
|
|
56
57
|
const e = t ? `ins-recommendation-v3-block-${t}` : void 0, o = _("grid", e), r = E(), n = h(r, L);
|
|
57
58
|
return o.replace("{-{-TITLE-}-}", I.TITLE).replace("{-{-PRODUCT_ROWS-}-}", n).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
|
|
58
59
|
}
|
|
59
60
|
export {
|
|
60
|
-
|
|
61
|
+
H as getDefaultTemplate,
|
|
61
62
|
P as prepareGridAttributeRows,
|
|
62
63
|
U as prepareGridProductRows,
|
|
63
64
|
h as prepareProductRows
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
+
import "../constants/selectors.js";
|
|
1
2
|
import { DEFAULT_PRODUCTS_PER_ROW as s } from "../constants/layout.js";
|
|
2
3
|
import { prepareProductRows as c } from "./grid/template.js";
|
|
3
|
-
import { prepareProductRows as
|
|
4
|
-
function
|
|
4
|
+
import { prepareProductRows as m } from "./list/template.js";
|
|
5
|
+
function f(o, t, r = {}) {
|
|
5
6
|
if (t === "list")
|
|
6
|
-
return
|
|
7
|
+
return m(o, r.composition, r.filterList);
|
|
7
8
|
const { productsPerRow: e = s, composition: p, filterList: i } = r;
|
|
8
9
|
return c(o, e, p, i);
|
|
9
10
|
}
|
|
10
11
|
export {
|
|
11
|
-
|
|
12
|
+
f as prepareProductRows
|
|
12
13
|
};
|
|
@@ -14,10 +14,10 @@ function b() {
|
|
|
14
14
|
thousandSeparator: e.thousandSeparator
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
const n = b(),
|
|
17
|
+
function s(t, e = "price") {
|
|
18
|
+
const n = b(), a = t[e], r = (a == null ? void 0 : a[n.code]) ?? Object.values(a ?? {})[0] ?? 0;
|
|
19
19
|
return R({
|
|
20
|
-
price:
|
|
20
|
+
price: r,
|
|
21
21
|
currency: n
|
|
22
22
|
});
|
|
23
23
|
}
|
|
@@ -69,7 +69,7 @@ const I = {
|
|
|
69
69
|
esd-extension-block-id="${o.PRICE}"
|
|
70
70
|
align="left">
|
|
71
71
|
<p contenteditable="false" style="font-size: 16px; color: #333333; font-weight: bold; margin: 0;">
|
|
72
|
-
<strong>${
|
|
72
|
+
<strong>${s(t, "price")}</strong>
|
|
73
73
|
</p>
|
|
74
74
|
</td>
|
|
75
75
|
</tr>
|
|
@@ -85,8 +85,8 @@ const I = {
|
|
|
85
85
|
align="left">
|
|
86
86
|
<p
|
|
87
87
|
contenteditable="false"
|
|
88
|
-
style="font-size: 14px; color: #999999; margin: 0;">
|
|
89
|
-
<
|
|
88
|
+
style="font-size: 14px; color: #999999; text-decoration: line-through; margin: 0;">
|
|
89
|
+
<strong>${s(t, "original_price")}</strong>
|
|
90
90
|
</p>
|
|
91
91
|
</td>
|
|
92
92
|
</tr>
|
|
@@ -104,7 +104,7 @@ const I = {
|
|
|
104
104
|
align="left">
|
|
105
105
|
<p contenteditable="false" style="font-size: 12px; color: #666666; margin: 0;">
|
|
106
106
|
<span class="omnibus-text-before">Lowest 30-day price: </span>
|
|
107
|
-
<span class="omnibus-price-value">${
|
|
107
|
+
<span class="omnibus-price-value">${s(t, "original_price")}</span>
|
|
108
108
|
<span class="omnibus-text-after"></span>
|
|
109
109
|
</p>
|
|
110
110
|
</td>
|
|
@@ -115,7 +115,7 @@ const I = {
|
|
|
115
115
|
*/
|
|
116
116
|
[g]: (t) => {
|
|
117
117
|
var i, l;
|
|
118
|
-
const e = b(), n = ((i = t.original_price) == null ? void 0 : i[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0,
|
|
118
|
+
const e = b(), n = ((i = t.original_price) == null ? void 0 : i[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, a = ((l = t.price) == null ? void 0 : l[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, r = n > 0 ? Math.round((n - a) / n * 100) : 0, m = r > 0 ? `-${r}%` : "0%";
|
|
119
119
|
return `
|
|
120
120
|
<tr>
|
|
121
121
|
<td
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
function d(
|
|
2
|
-
const { thousandSeparator:
|
|
1
|
+
function d(a, t) {
|
|
2
|
+
const { thousandSeparator: s, decimalSeparator: e, decimalCount: r } = t, u = Math.abs(a).toFixed(r), [c, o] = u.split("."), n = c.replace(
|
|
3
3
|
/\B(?=(\d{3})+(?!\d))/g,
|
|
4
|
-
|
|
5
|
-
);
|
|
6
|
-
return r > 0 &&
|
|
4
|
+
s
|
|
5
|
+
), i = a < 0 ? "-" : "";
|
|
6
|
+
return r > 0 && o ? `${i}${n}${e}${o}` : `${i}${n}`;
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
const { price: t, currency:
|
|
8
|
+
function m(a) {
|
|
9
|
+
const { price: t, currency: s } = a, {
|
|
10
10
|
symbol: e,
|
|
11
11
|
alignment: r,
|
|
12
12
|
thousandSeparator: u,
|
|
13
|
-
decimalSeparator:
|
|
14
|
-
decimalCount:
|
|
15
|
-
} =
|
|
13
|
+
decimalSeparator: c,
|
|
14
|
+
decimalCount: o
|
|
15
|
+
} = s;
|
|
16
16
|
if (typeof t != "number" || Number.isNaN(t)) {
|
|
17
|
-
const
|
|
18
|
-
return r === "before" ? `${e} ${
|
|
17
|
+
const i = "0".repeat(o), $ = `0${c}${i}`;
|
|
18
|
+
return r === "before" ? `${e} ${$}` : `${$} ${e}`;
|
|
19
19
|
}
|
|
20
|
-
const
|
|
20
|
+
const n = d(t, {
|
|
21
21
|
thousandSeparator: u,
|
|
22
|
-
decimalSeparator:
|
|
23
|
-
decimalCount:
|
|
22
|
+
decimalSeparator: c,
|
|
23
|
+
decimalCount: o
|
|
24
24
|
});
|
|
25
|
-
return r === "before" ? `${e} ${
|
|
25
|
+
return r === "before" ? `${e} ${n}` : `${n} ${e}`;
|
|
26
26
|
}
|
|
27
27
|
export {
|
|
28
|
-
|
|
28
|
+
m as formatPrice
|
|
29
29
|
};
|
|
@@ -1,4 +1,31 @@
|
|
|
1
1
|
import type { DynamicContent } from '@@/Types/generic';
|
|
2
|
+
import type { FiltersResponse } from '@@/Types/recommendation';
|
|
3
|
+
/**
|
|
4
|
+
* Parses a `{{recoId_index_attributeName}}` variable (already stripped of the
|
|
5
|
+
* braces/whitespace) into its recommendation id and attribute name. Returns
|
|
6
|
+
* null for anything that isn't a well-formed recommendation variable.
|
|
7
|
+
*/
|
|
8
|
+
export declare function parseRecommendationVariable(field: string): {
|
|
9
|
+
recoId: string;
|
|
10
|
+
attribute: string;
|
|
11
|
+
} | null;
|
|
12
|
+
/**
|
|
13
|
+
* Builds the set of attribute forms valid inside partner-authored
|
|
14
|
+
* `{{recoId_index_attribute}}` variables: the built-in compiler attributes plus
|
|
15
|
+
* each account attribute in its canonical token form — bare for
|
|
16
|
+
* `defaultAttribute`, `product_attribute.<name>` for `productAttribute`. Using
|
|
17
|
+
* `resolveProductAttrValue` (the same producer the block builder uses) keeps the
|
|
18
|
+
* validator's notion of "valid form" identical to what is actually emitted.
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildPartnerAttributeNameSet(filterList: FiltersResponse): Set<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the `{{...}}` custom fields in the HTML that are invalid. Partner
|
|
23
|
+
* attributes in `ins-skip-compile` blocks (recoId ∈ ignoredIds) are checked
|
|
24
|
+
* against `ignoredAttributeNames`; Guido-generated reco variables and known merge
|
|
25
|
+
* tags pass. An unrecognized dotted token is ignored: it was never captured
|
|
26
|
+
* before, so flagging it would false-positive on merge tags like `{{user.name}}`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function findInvalidCustomFields(html: string, validCustomFields: string[], recommendationBlockIds: string[], ignoredIds: Set<string>, ignoredAttributeNames: Set<string> | null): string[];
|
|
2
29
|
export declare const useHtmlValidator: () => {
|
|
3
30
|
validateHtml: (html: string, customFields: DynamicContent[], isOnSaveValidation?: boolean) => Promise<boolean>;
|
|
4
31
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns true when a recommendation block has opted out of Guido's
|
|
3
|
+
* product-data → template-variable substitution. Partners signal opt-out by
|
|
4
|
+
* adding the `ins-skip-compile` class on the `.recommendation-block-v2`
|
|
5
|
+
* element. Only the variable substitution is skipped — campaign URL building,
|
|
6
|
+
* hidden-row removal, Outlook image widths, discount conditions, text-trim CSS
|
|
7
|
+
* and general HTML optimizations still apply. See `CSS_CLASS_SKIP_COMPILE` for
|
|
8
|
+
* the full scope.
|
|
9
|
+
*/
|
|
10
|
+
export declare function isIgnoredRecommendationBlock(block: Element): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* DOM-parses the HTML once and returns the set of `recommendation-id`
|
|
13
|
+
* values that belong to ignored blocks. Use this in regex/string-based
|
|
14
|
+
* compiler rules where the rule processes flat matches and only has the
|
|
15
|
+
* extracted block ID rather than a DOM Element reference.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getIgnoredRecommendationBlockIds(html: string): Set<string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -5,3 +5,18 @@ export declare function extractTitleText(block: Element): string;
|
|
|
5
5
|
* the caller treats that as "no segment background".
|
|
6
6
|
*/
|
|
7
7
|
export declare function extractCardBgColor(block: Element): string;
|
|
8
|
+
/**
|
|
9
|
+
* Reads the legacy block's own `currency-*` attributes into a
|
|
10
|
+
* `currencySettings`-shaped object that `mapCurrency` understands. Used as a
|
|
11
|
+
* fallback when the external recommendationConfigs map has no entry for this
|
|
12
|
+
* block, so the migrated block keeps its real currency instead of defaulting.
|
|
13
|
+
* Returns undefined when the block carries no `currency` attribute.
|
|
14
|
+
*/
|
|
15
|
+
export declare function extractCurrencyFromBlock(block: Element): Record<string, string> | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* True when a PM has manually opted the legacy block out of content
|
|
18
|
+
* regeneration by adding the `ins-skip-compile` class. Detected before rebuild
|
|
19
|
+
* so the migrator preserves the partner's markup verbatim (keeping their
|
|
20
|
+
* hand-authored variables) instead of regenerating the block.
|
|
21
|
+
*/
|
|
22
|
+
export declare function isPartnerManagedBlock(block: Element): boolean;
|
|
@@ -8,4 +8,12 @@ export declare function buildBlockHtml(params: {
|
|
|
8
8
|
extraClasses?: string;
|
|
9
9
|
legacyId?: string;
|
|
10
10
|
legacyBgColor?: string;
|
|
11
|
+
/**
|
|
12
|
+
* When set, the block's existing inner HTML is preserved verbatim instead
|
|
13
|
+
* of regenerating product rows — used for partner-customized blocks so
|
|
14
|
+
* their hand-authored `{{...}}` variables survive migration.
|
|
15
|
+
*/
|
|
16
|
+
preserveInnerHtml?: string;
|
|
17
|
+
/** Adds the `ins-skip-compile` opt-out class to the migrated block. */
|
|
18
|
+
skipCompile?: boolean;
|
|
11
19
|
}): string;
|
|
@@ -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, CSS_CLASS_RECO_BUTTON, 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';
|
|
11
|
+
export { BLOCK_ROOT_SELECTOR, CONTAINER_SELECTOR, DESKTOP_CONTAINER_SELECTOR, MOBILE_CONTAINER_SELECTOR, MOBILE_ROW_SELECTOR, CSS_CLASS_RECO_BUTTON, CSS_CLASS_SKIP_COMPILE, RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES, 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';
|
|
@@ -23,6 +23,18 @@ export declare const MOBILE_ROW_SELECTOR = ".ins-recommendation-mobile-row";
|
|
|
23
23
|
* `{{cId_pIdx_url}}` template variable.
|
|
24
24
|
*/
|
|
25
25
|
export declare const CSS_CLASS_RECO_BUTTON = "reco-v3-button";
|
|
26
|
+
/**
|
|
27
|
+
* Opt-out class for partners who want to inject their own template variables
|
|
28
|
+
* into a recommendation block. When present on `.recommendation-block-v2`,
|
|
29
|
+
* Guido skips ONLY its product-data → template-variable substitution
|
|
30
|
+
* (`replaceProductAttributes`) for that block — partners author their own
|
|
31
|
+
* `{{recoId_index_attribute}}` variables. Everything else (campaign URL
|
|
32
|
+
* building, hidden-row removal, Outlook image widths, text-trim CSS, discount
|
|
33
|
+
* conditions, store hydration, store-level config validation, and general HTML
|
|
34
|
+
* optimizations) still applies. The class is preserved in the final compiled
|
|
35
|
+
* output so partners may use it for their own styling.
|
|
36
|
+
*/
|
|
37
|
+
export declare const CSS_CLASS_SKIP_COMPILE = "ins-skip-compile";
|
|
26
38
|
/**
|
|
27
39
|
* Currency HTML attributes set on the block element
|
|
28
40
|
* These are read by the HTML compiler at runtime to format prices
|
|
@@ -61,3 +73,12 @@ export declare const ATTR_PRODUCT_ATTR = "product-attr";
|
|
|
61
73
|
* Used to exclude these from the custom attribute dropdown to prevent duplication with toggles.
|
|
62
74
|
*/
|
|
63
75
|
export declare const BUILT_IN_DEFAULT_ATTRIBUTES: Set<string>;
|
|
76
|
+
/**
|
|
77
|
+
* Attribute names valid inside a `{{recoId_index_attributeName}}` template
|
|
78
|
+
* variable regardless of the account's custom attribute list. Every built-in
|
|
79
|
+
* composition attribute is valid, plus `currency` and `discount` which the
|
|
80
|
+
* compiler emits but are not composition toggles. Custom attributes are
|
|
81
|
+
* validated separately against the account's fetched attribute list
|
|
82
|
+
* (`stripo/email-recommendation-attributes`).
|
|
83
|
+
*/
|
|
84
|
+
export declare const RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES: Set<string>;
|
|
@@ -17,6 +17,13 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
17
17
|
getId(): string;
|
|
18
18
|
getTemplate(): string;
|
|
19
19
|
onRender(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Card composition restructures the block (toggles/reorders/adds attribute
|
|
22
|
+
* cells), which would corrupt a partner-managed (`ins-skip-compile`) block's
|
|
23
|
+
* preserved markup. There is no native tab-disable API, so the whole control
|
|
24
|
+
* container is rendered inert (greyed + non-interactive) instead.
|
|
25
|
+
*/
|
|
26
|
+
_syncDisabledState(): void;
|
|
20
27
|
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
21
28
|
onDestroy(): void;
|
|
22
29
|
private _initializeComposition;
|
|
@@ -21,6 +21,11 @@ export declare class LayoutOrientationControl extends CommonControl {
|
|
|
21
21
|
getTemplate(): string;
|
|
22
22
|
onRender(): void;
|
|
23
23
|
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
24
|
+
/**
|
|
25
|
+
* Layout orientation restructures the whole block, which is meaningless for
|
|
26
|
+
* partner-managed (`ins-skip-compile`) blocks — disable the control there.
|
|
27
|
+
*/
|
|
28
|
+
_syncDisabledState(): void;
|
|
24
29
|
_setFormValues(): void;
|
|
25
30
|
/**
|
|
26
31
|
* Handles layout change
|
|
@@ -30,6 +30,12 @@ export declare class ProductLayoutControl extends CommonControl {
|
|
|
30
30
|
getTemplate(): string;
|
|
31
31
|
onRender(): void;
|
|
32
32
|
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
33
|
+
/**
|
|
34
|
+
* Products-per-row and mobile-layout restructure the block, which is
|
|
35
|
+
* meaningless for partner-managed (`ins-skip-compile`) blocks — disable
|
|
36
|
+
* these inputs there. Disabling coexists with the visibility logic above.
|
|
37
|
+
*/
|
|
38
|
+
_syncDisabledState(): void;
|
|
33
39
|
onDestroy(): void;
|
|
34
40
|
_setFormValues(): void;
|
|
35
41
|
/**
|
|
@@ -35,6 +35,15 @@ interface DocumentModifier {
|
|
|
35
35
|
* @returns The block element or null if not found
|
|
36
36
|
*/
|
|
37
37
|
export declare function getBlockElement(currentNode: ImmutableHtmlNode | null | undefined): ImmutableHtmlNode | null;
|
|
38
|
+
/**
|
|
39
|
+
* True when the recommendation block has opted out of Guido's content
|
|
40
|
+
* regeneration via the `ins-skip-compile` class. Partner-managed blocks carry
|
|
41
|
+
* hand-authored `{{...}}` variables in their cells, so Guido must never
|
|
42
|
+
* overwrite their content with product data (regenerate / in-place update).
|
|
43
|
+
* @param currentNode - The current template node
|
|
44
|
+
* @returns True if the block opted out of content regeneration
|
|
45
|
+
*/
|
|
46
|
+
export declare function isPartnerManagedBlock(currentNode: ImmutableHtmlNode | null | undefined): boolean;
|
|
38
47
|
/**
|
|
39
48
|
* Gets the current layout orientation from the block's data attribute
|
|
40
49
|
* Supports both old (horizontal/vertical) and new (list/grid) values for backward compatibility
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.6.0-beta.
|
|
3
|
+
"version": "3.6.0-beta.70bbf9f",
|
|
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",
|