@useinsider/guido 3.8.2 → 3.9.0-beta.08da4e6
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 +70 -66
- package/dist/composables/usePreviewMode.js +15 -14
- package/dist/composables/useRecommendationPreview.js +111 -0
- package/dist/config/compiler/recommendationCompilerRules.js +1 -1
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +122 -106
- package/dist/config/migrator/itemsBlockMigrator.js +159 -114
- package/dist/config/migrator/recommendation/htmlBuilder.js +53 -52
- package/dist/config/migrator/recommendation/settingsMapper.js +38 -33
- package/dist/enums/defaults.js +7 -4
- package/dist/enums/html-validator.js +6 -5
- package/dist/extensions/Blocks/Items/block.js +67 -28
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +17 -18
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +67 -78
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +13 -9
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +26 -14
- package/dist/extensions/Blocks/Items/template.js +245 -247
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +89 -64
- package/dist/extensions/Blocks/Recommendation/block.js +64 -42
- package/dist/extensions/Blocks/Recommendation/canvasPreview.css.js +16 -0
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +41 -32
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +461 -363
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +99 -87
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +133 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +162 -160
- package/dist/extensions/Blocks/Recommendation/extension.js +30 -29
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +21 -7
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +64 -4
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +3 -1
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +130 -96
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +43 -54
- package/dist/extensions/Blocks/Recommendation/templates/index.js +17 -14
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +86 -80
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +30 -39
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +155 -102
- package/dist/extensions/Blocks/controlFactories.js +76 -57
- package/dist/package.json.js +1 -1
- package/dist/services/blankTemplate.js +34 -0
- package/dist/services/stripoApi.js +13 -18
- package/dist/src/@types/config/schemas.d.ts +16 -0
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useRecommendationPreview.d.ts +10 -0
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
- package/dist/src/enums/defaults.d.ts +3 -0
- package/dist/src/extensions/Blocks/CouponBlock/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/block.d.ts +17 -0
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +3 -3
- package/dist/src/extensions/Blocks/Items/template.d.ts +7 -0
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +13 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +29 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +59 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/oldPrice/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusDiscount/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/omnibusPrice/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/price/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +13 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +10 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +51 -1
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +15 -0
- package/dist/src/extensions/Blocks/controlFactories.d.ts +10 -1
- package/dist/src/services/blankTemplate.d.ts +11 -0
- package/dist/src/stores/config.d.ts +36 -0
- package/package.json +2 -2
- package/dist/static/templates/empty/index.html.js +0 -74
- package/dist/static/templates/empty/style.css.js +0 -779
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { useHttp as d } from "../composables/useHttp.js";
|
|
2
2
|
import { useToaster as m } from "../composables/useToaster.js";
|
|
3
3
|
import { MAX_DEFAULT_TEMPLATE_ID as y } from "../enums/defaults.js";
|
|
4
|
-
import f from "
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
const { get: s, post: c } = d(), { handleError: r } = m();
|
|
4
|
+
import { useBlankTemplate as f } from "./blankTemplate.js";
|
|
5
|
+
const D = () => {
|
|
6
|
+
const { get: s, post: u } = d(), { handleError: r } = m(), { getBlankTemplate: o } = f();
|
|
8
7
|
return {
|
|
9
8
|
getToken: async () => {
|
|
10
9
|
try {
|
|
@@ -26,18 +25,14 @@ const E = () => {
|
|
|
26
25
|
}
|
|
27
26
|
},
|
|
28
27
|
getDefaultTemplate: async () => {
|
|
29
|
-
const t = {
|
|
30
|
-
html: f,
|
|
31
|
-
css: g
|
|
32
|
-
};
|
|
33
28
|
try {
|
|
34
|
-
const
|
|
35
|
-
if (!i && !
|
|
36
|
-
return
|
|
37
|
-
const
|
|
38
|
-
return !
|
|
39
|
-
} catch (
|
|
40
|
-
return r(
|
|
29
|
+
const t = new URLSearchParams(window.location.search), e = t.get("default-template"), l = t.get("master"), n = e ? parseInt(e) : 0, i = n >= 1 && n <= y ? n : 0;
|
|
30
|
+
if (!i && !l)
|
|
31
|
+
return await o();
|
|
32
|
+
const p = `/stripo/default-template/${i}`, { data: c } = await s(p), a = typeof c == "string" ? JSON.parse(c) : c;
|
|
33
|
+
return !a || typeof a != "object" || !("html" in a) || !("css" in a) ? await o() : a;
|
|
34
|
+
} catch (t) {
|
|
35
|
+
return r(t, "Failed to fetch default template"), o();
|
|
41
36
|
}
|
|
42
37
|
},
|
|
43
38
|
getSyncModulesStatus: async () => {
|
|
@@ -50,7 +45,7 @@ const E = () => {
|
|
|
50
45
|
},
|
|
51
46
|
updateSyncModule: async (t) => {
|
|
52
47
|
try {
|
|
53
|
-
return await
|
|
48
|
+
return await u(`/stripo/stripo-modules/${t.moduleId}/update`), !0;
|
|
54
49
|
} catch (e) {
|
|
55
50
|
return r(e, "Failed to update sync module"), !1;
|
|
56
51
|
}
|
|
@@ -71,7 +66,7 @@ const E = () => {
|
|
|
71
66
|
if (t.length === 0)
|
|
72
67
|
return !0;
|
|
73
68
|
try {
|
|
74
|
-
return await
|
|
69
|
+
return await u("/stripo/stripo-modules/set-unsubscription-preference-pages", t), !0;
|
|
75
70
|
} catch (e) {
|
|
76
71
|
return r(e, "Failed to set unsubscription preference pages"), !1;
|
|
77
72
|
}
|
|
@@ -79,5 +74,5 @@ const E = () => {
|
|
|
79
74
|
};
|
|
80
75
|
};
|
|
81
76
|
export {
|
|
82
|
-
|
|
77
|
+
D as useStripoApi
|
|
83
78
|
};
|
|
@@ -139,6 +139,10 @@ export declare const LegacyRecommendationConfigSchema: v.LooseObjectSchema<{
|
|
|
139
139
|
readonly size: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
140
140
|
/** Vertical responsiveness flag (legacy size=1 variants) */
|
|
141
141
|
readonly verticalResponsiveness: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
142
|
+
/** Legacy "Move to next line" price placement toggle (cardPricePlacement.js) */
|
|
143
|
+
readonly isPriceMovedToNextLine: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
144
|
+
/** Legacy "Hide if same as discounted" / delete-price-for-zero-sale toggle */
|
|
145
|
+
readonly isPriceDeletedForZeroSale: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
142
146
|
}, undefined>;
|
|
143
147
|
/**
|
|
144
148
|
* Migration-only inputs scoped to this template.
|
|
@@ -195,6 +199,10 @@ export declare const TemplateMigrationSchema: v.ObjectSchema<{
|
|
|
195
199
|
readonly size: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
196
200
|
/** Vertical responsiveness flag (legacy size=1 variants) */
|
|
197
201
|
readonly verticalResponsiveness: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
202
|
+
/** Legacy "Move to next line" price placement toggle (cardPricePlacement.js) */
|
|
203
|
+
readonly isPriceMovedToNextLine: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
204
|
+
/** Legacy "Hide if same as discounted" / delete-price-for-zero-sale toggle */
|
|
205
|
+
readonly isPriceDeletedForZeroSale: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
198
206
|
}, undefined>, undefined>, {}>;
|
|
199
207
|
}, undefined>;
|
|
200
208
|
/**
|
|
@@ -274,6 +282,10 @@ export declare const TemplateSchema: v.ObjectSchema<{
|
|
|
274
282
|
readonly size: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
275
283
|
/** Vertical responsiveness flag (legacy size=1 variants) */
|
|
276
284
|
readonly verticalResponsiveness: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
285
|
+
/** Legacy "Move to next line" price placement toggle (cardPricePlacement.js) */
|
|
286
|
+
readonly isPriceMovedToNextLine: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
287
|
+
/** Legacy "Hide if same as discounted" / delete-price-for-zero-sale toggle */
|
|
288
|
+
readonly isPriceDeletedForZeroSale: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
277
289
|
}, undefined>, undefined>, {}>;
|
|
278
290
|
}, undefined>, {}>;
|
|
279
291
|
}, undefined>;
|
|
@@ -665,6 +677,10 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
|
665
677
|
readonly size: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
|
|
666
678
|
/** Vertical responsiveness flag (legacy size=1 variants) */
|
|
667
679
|
readonly verticalResponsiveness: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
680
|
+
/** Legacy "Move to next line" price placement toggle (cardPricePlacement.js) */
|
|
681
|
+
readonly isPriceMovedToNextLine: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
682
|
+
/** Legacy "Hide if same as discounted" / delete-price-for-zero-sale toggle */
|
|
683
|
+
readonly isPriceDeletedForZeroSale: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
668
684
|
}, undefined>, undefined>, {}>;
|
|
669
685
|
}, undefined>, {}>;
|
|
670
686
|
}, undefined>, {}>;
|
|
@@ -60,6 +60,8 @@ export declare const useConfig: () => {
|
|
|
60
60
|
blockType?: string | undefined;
|
|
61
61
|
size?: string | number | undefined;
|
|
62
62
|
verticalResponsiveness?: boolean | undefined;
|
|
63
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
64
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
63
65
|
} & {
|
|
64
66
|
[key: string]: unknown;
|
|
65
67
|
};
|
|
@@ -186,6 +188,8 @@ export declare const useConfig: () => {
|
|
|
186
188
|
blockType?: string | undefined;
|
|
187
189
|
size?: string | number | undefined;
|
|
188
190
|
verticalResponsiveness?: boolean | undefined;
|
|
191
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
192
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
189
193
|
} & {
|
|
190
194
|
[key: string]: unknown;
|
|
191
195
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Substitutes recommendation product variables in compiled preview HTML with the
|
|
3
|
+
* blocks' fetched sample products, then simulates the email-service hide rule by
|
|
4
|
+
* emptying the original-price cell (DOM kept) for slots with no real discount.
|
|
5
|
+
* Returns the input unchanged when there are no reco blocks or no products.
|
|
6
|
+
*/
|
|
7
|
+
export declare function substituteRecommendationPreview(html: string): string;
|
|
8
|
+
export declare const useRecommendationPreview: () => {
|
|
9
|
+
substituteRecommendationPreview: typeof substituteRecommendationPreview;
|
|
10
|
+
};
|
|
@@ -3,5 +3,5 @@ import type { CurrencyConfig, RecommendationNodeConfig } from '@@/Extensions/Blo
|
|
|
3
3
|
import type { LegacyRecommendationConfig } from '@@/Types/config';
|
|
4
4
|
/** Defensive against missing/malformed legacy `currencySettings` — defaults are per-field, not whole-object. */
|
|
5
5
|
export declare function mapCurrency(legacy: unknown): CurrencyConfig;
|
|
6
|
-
export type SettingsPartial = Pick<RecommendationNodeConfig, 'recommendationId' | 'strategy' | 'productIds' | 'size' | 'shuffleProducts' | 'language' | 'currency' | 'filters' | 'layout' | 'cardsInRow' | 'mobileCardsInRow' | 'mobileLayoutEnabled' | 'previousMobileCardsInRow' | 'columnSpacing' | 'rowSpacing' | 'mobileColumnSpacing' | 'mobileRowSpacing' | 'omnibusPrice' | 'omnibusDiscount' | 'configVersion'>;
|
|
6
|
+
export type SettingsPartial = Pick<RecommendationNodeConfig, 'recommendationId' | 'strategy' | 'productIds' | 'size' | 'shuffleProducts' | 'language' | 'currency' | 'filters' | 'layout' | 'cardsInRow' | 'mobileCardsInRow' | 'mobileLayoutEnabled' | 'previousMobileCardsInRow' | 'columnSpacing' | 'rowSpacing' | 'mobileColumnSpacing' | 'mobileRowSpacing' | 'omnibusPrice' | 'omnibusDiscount' | 'priceMovedToNextLine' | 'priceHideIfSameAsDiscounted' | 'configVersion'>;
|
|
7
7
|
export declare function mapSettings(recCfg: LegacyRecommendationConfig, parsed: LegacyProductConfig, id: number): SettingsPartial;
|
|
@@ -8,6 +8,9 @@ export declare const TemplateTypes: {
|
|
|
8
8
|
};
|
|
9
9
|
export declare const EditorType: number;
|
|
10
10
|
export declare const MAX_DEFAULT_TEMPLATE_ID = 13;
|
|
11
|
+
export declare const EMAIL_STATIC_BASE_URL = "https://email-static.useinsider.com";
|
|
12
|
+
export declare const BLANK_TEMPLATE_HTML_URL = "https://email-static.useinsider.com/templates/campaign/default.html";
|
|
13
|
+
export declare const BLANK_TEMPLATE_CSS_URL = "https://email-static.useinsider.com/templates/campaign/default.css";
|
|
11
14
|
export declare const ProductIds: Record<string, number>;
|
|
12
15
|
export declare const ModuleFolderDefaults: {
|
|
13
16
|
readonly SAVED_MODULES: "savedModules";
|
|
@@ -74,11 +74,11 @@ export declare const TextBackgroundControl: {
|
|
|
74
74
|
new (): {
|
|
75
75
|
getId(): string;
|
|
76
76
|
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
77
|
+
getAdditionalModifications(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
77
78
|
getParentControlId(): string;
|
|
78
79
|
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
79
80
|
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
80
81
|
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
81
|
-
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
82
82
|
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
83
83
|
};
|
|
84
84
|
};
|
|
@@ -24,5 +24,22 @@ export declare class ItemsBlock extends Block {
|
|
|
24
24
|
getSettingsPanelTitleHtml(): string;
|
|
25
25
|
getTemplate(): string;
|
|
26
26
|
allowInnerBlocksDND(): boolean;
|
|
27
|
+
canBeSavedAsModule(): boolean;
|
|
27
28
|
onCreated(node: ImmutableHtmlNode): void;
|
|
29
|
+
/**
|
|
30
|
+
* Re-seeds nodeConfig from the persisted esd-ext-config when a saved module
|
|
31
|
+
* surfaces via document load. Stripo strips esd-ext-config and never restores it
|
|
32
|
+
* into nodeConfig, so without this a reused module would reset to defaults.
|
|
33
|
+
* Guarded to the nodeConfig-empty case so it runs once and never loops.
|
|
34
|
+
*/
|
|
35
|
+
onDocumentChanged(node: ImmutableHtmlNode): void;
|
|
36
|
+
/**
|
|
37
|
+
* Bakes the compiler-read DOM attributes (`data-type`, `data-number`) onto the
|
|
38
|
+
* `.ins-product-td` container from the recovered config. Required for saved modules:
|
|
39
|
+
* `migrate()` (which backfills these) only runs at template load — never when a module
|
|
40
|
+
* is dropped into a live editor — so this is the one place the namespace + index get
|
|
41
|
+
* restored before export. The name `<a>` carries no data-type/data-number of its own and
|
|
42
|
+
* relies on this td-level fallback in pairProductVariables.
|
|
43
|
+
*/
|
|
44
|
+
private _stampProductTdDomAttributes;
|
|
28
45
|
}
|
|
@@ -232,11 +232,11 @@ export declare const OriginalPriceControls: {
|
|
|
232
232
|
new (): {
|
|
233
233
|
getId(): string;
|
|
234
234
|
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
235
|
+
getAdditionalModifications(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
235
236
|
getParentControlId(): string;
|
|
236
237
|
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
237
238
|
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
238
239
|
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
239
|
-
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
240
240
|
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
241
241
|
};
|
|
242
242
|
};
|
|
@@ -318,11 +318,11 @@ export declare const PriceControls: {
|
|
|
318
318
|
new (): {
|
|
319
319
|
getId(): string;
|
|
320
320
|
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
321
|
+
getAdditionalModifications(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
321
322
|
getParentControlId(): string;
|
|
322
323
|
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
323
324
|
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
324
325
|
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
325
|
-
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
326
326
|
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
327
327
|
};
|
|
328
328
|
};
|
|
@@ -404,11 +404,11 @@ export declare const NameControls: {
|
|
|
404
404
|
new (): {
|
|
405
405
|
getId(): string;
|
|
406
406
|
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
407
|
+
getAdditionalModifications(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
407
408
|
getParentControlId(): string;
|
|
408
409
|
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
409
410
|
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
410
411
|
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
411
|
-
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
412
412
|
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
413
413
|
};
|
|
414
414
|
};
|
|
@@ -3,6 +3,13 @@ declare const migrationTemplate = "ADD YOUR MIGRATION HERE";
|
|
|
3
3
|
type ProductType = 'CART_ITEMS' | 'BROWSED_ITEMS' | 'PURCHASED_ITEMS';
|
|
4
4
|
type OrientationType = 'vertical' | 'horizontal';
|
|
5
5
|
type PriceOrientationType = 'vertical' | 'horizontal';
|
|
6
|
+
/**
|
|
7
|
+
* Wraps a bare migrate-block `<td>` in a `<tr>` so it forms a valid table row.
|
|
8
|
+
* Stripo renders its `BlockType.*` tags as full rows, so both the migrate template
|
|
9
|
+
* (here) and the orientation-change rebuild (settingsControl._reOrderTemplate) must
|
|
10
|
+
* emit `<tr><td>` — otherwise the code editor flags the bare cell as invalid.
|
|
11
|
+
*/
|
|
12
|
+
export declare const wrapInTableRow: (html: string) => string;
|
|
6
13
|
type TemplateParameters = {
|
|
7
14
|
orientation: OrientationType;
|
|
8
15
|
itemsType: ProductType;
|
|
@@ -40,6 +40,18 @@ export declare function generateBlockInstanceId(): string;
|
|
|
40
40
|
* Prevents currency symbols like "$", "R$", "HK$" from being interpreted as special replacement patterns.
|
|
41
41
|
*/
|
|
42
42
|
export declare const escapeReplacement: (str: string) => string;
|
|
43
|
+
/**
|
|
44
|
+
* Derives a card's 1-based product index from its `itemsSelectValue`.
|
|
45
|
+
* Prefers the position within ItemInCartOptions for the type; falls back to the
|
|
46
|
+
* `(N)` token in the value (e.g. "{{Browsed Item (3) Url}}" -> "3"); defaults to "1".
|
|
47
|
+
*
|
|
48
|
+
* Single source of truth so block.ts, settingsControl and template.ts stay in sync —
|
|
49
|
+
* the number feeds `data-number`, which pairProductVariables reads to index merge tags.
|
|
50
|
+
*
|
|
51
|
+
* `itemsSelectValue` is typed loosely because callers pass it straight from parsed
|
|
52
|
+
* configs where the field can be absent — the runtime guard below is load-bearing.
|
|
53
|
+
*/
|
|
54
|
+
export declare function deriveItemNumber(itemsSelectValue: string | undefined, itemsType: ProductType): string;
|
|
43
55
|
/**
|
|
44
56
|
* Returns default ItemsBlockConfig values.
|
|
45
57
|
* These are used when initializing a new block or when migrating from legacy format.
|
|
@@ -55,7 +67,7 @@ export declare function getItemsBlockContainer(currentNode: ImmutableHtmlNode |
|
|
|
55
67
|
/**
|
|
56
68
|
* Gets the node configuration from the Items block.
|
|
57
69
|
* Uses Stripo V2's getNodeConfig() API.
|
|
58
|
-
* Falls back to
|
|
70
|
+
* Falls back to the persisted esd-ext-config (saved modules), then legacy config block.
|
|
59
71
|
* @param currentNode - The current node from the control
|
|
60
72
|
* @returns The ItemsBlockConfig object or null if not found
|
|
61
73
|
*/
|
|
@@ -117,6 +117,16 @@ export declare class RecommendationBlock extends Block {
|
|
|
117
117
|
* added classes via setAttribute.
|
|
118
118
|
*/
|
|
119
119
|
private _assignRecommendationId;
|
|
120
|
+
/**
|
|
121
|
+
* Stamps the `hide-price` attribute (read by email-service at send time) on
|
|
122
|
+
* the block element from the config flag.
|
|
123
|
+
*/
|
|
124
|
+
private _stampHidePrice;
|
|
125
|
+
/**
|
|
126
|
+
* Stamps `hide-price` from config only when the block lacks the attribute —
|
|
127
|
+
* heals templates saved before this feature without dirtying current ones.
|
|
128
|
+
*/
|
|
129
|
+
private _healHidePriceAttr;
|
|
120
130
|
/**
|
|
121
131
|
* Gets the recommendation-id from a block node
|
|
122
132
|
*/
|
|
@@ -50,6 +50,15 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
50
50
|
*/
|
|
51
51
|
private _tryReorderInPlace;
|
|
52
52
|
private _createBuiltInItemHtml;
|
|
53
|
+
/**
|
|
54
|
+
* Inline mode: the merged "Product Prices" group item. It moves as a unit in
|
|
55
|
+
* the main list (both keys stay adjacent) and contains a nested 2-item drag
|
|
56
|
+
* to reorder Product Price ↔ Product Original Price — which flips the inline
|
|
57
|
+
* render order via `resolveInlinePriceOrder`. The group keeps a single
|
|
58
|
+
* visibility toggle (`data-action-for="productPrice"`). Nested sub-items use a
|
|
59
|
+
* plain drag handle (no UE button → untouched by the reorder-icon rescue).
|
|
60
|
+
*/
|
|
61
|
+
private _createPriceGroupItemHtml;
|
|
53
62
|
private _createCustomItemHtml;
|
|
54
63
|
/**
|
|
55
64
|
* Builds select options from the store's filterList.
|
|
@@ -105,7 +114,23 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
105
114
|
*/
|
|
106
115
|
private _rescueReorderIconsToStore;
|
|
107
116
|
private _setupEventListeners;
|
|
117
|
+
/**
|
|
118
|
+
* Builds the composition key order from the orderable list, expanding the
|
|
119
|
+
* inline "Product Prices" group into its two sub-keys (in nested DOM order)
|
|
120
|
+
* so both price keys stay adjacent and in the user-chosen order.
|
|
121
|
+
*/
|
|
122
|
+
private _extractCompositionOrder;
|
|
108
123
|
private _setupDragAndDrop;
|
|
124
|
+
/**
|
|
125
|
+
* Wires drag/drop reordering for one item level on the shared list. Both the
|
|
126
|
+
* top-level items and the nested price sub-items use this; they never fight
|
|
127
|
+
* because each only sets its `dragged` ref when its own `itemSelector` matches
|
|
128
|
+
* at dragstart (and the top-level one additionally ignores drags originating
|
|
129
|
+
* inside `ignoreSelector`). Every drop re-reads the full composition via
|
|
130
|
+
* `_extractCompositionOrder`, so both levels commit through `_onReorder`
|
|
131
|
+
* identically.
|
|
132
|
+
*/
|
|
133
|
+
private _registerDragHandlers;
|
|
109
134
|
private _setupDeleteHandler;
|
|
110
135
|
private _onAddAttribute;
|
|
111
136
|
/**
|
|
@@ -162,9 +187,10 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
162
187
|
private _extractSegmentBgFromCard;
|
|
163
188
|
private _getControlContainer;
|
|
164
189
|
/**
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
190
|
+
* Ensures composition reorder is enabled. Both grid and list layouts now
|
|
191
|
+
* support reordering — top-level items and the nested price sub-items are all
|
|
192
|
+
* draggable. (Items render with `draggable="true"`; this just clears any stale
|
|
193
|
+
* disabled state.)
|
|
168
194
|
*/
|
|
169
195
|
private _updateOrderableState;
|
|
170
196
|
/**
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* // Or individual imports
|
|
10
10
|
* import { NameAlignControl, ButtonColorControl } from './controls';
|
|
11
11
|
*/
|
|
12
|
-
export { RecommendationBlockControl, CONTROL_BLOCK_ID, AlgorithmControl, ALGORITHM_CONTROL_ID, LocaleControl, LOCALE_CONTROL_ID, CurrencyControl, CURRENCY_CONTROL_ID, ProductCountControl, PRODUCT_COUNT_CONTROL_ID, ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID, FiltersControl, FILTERS_CONTROL_ID, ShuffleControl, SHUFFLE_CONTROL_ID, LayoutOrientationControl, LAYOUT_ORIENTATION_CONTROL_ID, } from './main';
|
|
12
|
+
export { RecommendationBlockControl, CONTROL_BLOCK_ID, AlgorithmControl, ALGORITHM_CONTROL_ID, LocaleControl, LOCALE_CONTROL_ID, CurrencyControl, CURRENCY_CONTROL_ID, ProductCountControl, PRODUCT_COUNT_CONTROL_ID, ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID, FiltersControl, FILTERS_CONTROL_ID, ShuffleControl, SHUFFLE_CONTROL_ID, LayoutOrientationControl, LAYOUT_ORIENTATION_CONTROL_ID, PricePlacementControl, PRICE_PLACEMENT_CONTROL_ID, } from './main';
|
|
13
13
|
export * from './main/utils';
|
|
14
14
|
export { NameControls } from './name';
|
|
15
15
|
export { PriceControls } from './price';
|
|
@@ -5,11 +5,12 @@ import { CurrencyControl, CURRENCY_CONTROL_ID } from './currency';
|
|
|
5
5
|
import { FiltersControl, FILTERS_CONTROL_ID } from './filters';
|
|
6
6
|
import { LayoutOrientationControl, LAYOUT_ORIENTATION_CONTROL_ID } from './layoutOrientation';
|
|
7
7
|
import { LocaleControl, LOCALE_CONTROL_ID } from './locale';
|
|
8
|
+
import { PricePlacementControl, PRICE_PLACEMENT_CONTROL_ID } from './pricePlacement';
|
|
8
9
|
import { ProductCountControl, PRODUCT_COUNT_CONTROL_ID } from './productCount';
|
|
9
10
|
import { ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID } from './productLayout';
|
|
10
11
|
import { ShuffleControl, SHUFFLE_CONTROL_ID } from './shuffle';
|
|
11
12
|
export declare const CONTROL_BLOCK_ID = "ui-elements-recommendation-block";
|
|
12
|
-
export { AlgorithmControl, ALGORITHM_CONTROL_ID, LocaleControl, LOCALE_CONTROL_ID, CurrencyControl, CURRENCY_CONTROL_ID, ProductCountControl, PRODUCT_COUNT_CONTROL_ID, ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID, FiltersControl, FILTERS_CONTROL_ID, ShuffleControl, SHUFFLE_CONTROL_ID, LayoutOrientationControl, LAYOUT_ORIENTATION_CONTROL_ID, };
|
|
13
|
+
export { AlgorithmControl, ALGORITHM_CONTROL_ID, LocaleControl, LOCALE_CONTROL_ID, CurrencyControl, CURRENCY_CONTROL_ID, ProductCountControl, PRODUCT_COUNT_CONTROL_ID, ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID, FiltersControl, FILTERS_CONTROL_ID, ShuffleControl, SHUFFLE_CONTROL_ID, LayoutOrientationControl, LAYOUT_ORIENTATION_CONTROL_ID, PricePlacementControl, PRICE_PLACEMENT_CONTROL_ID, };
|
|
13
14
|
export * from './utils';
|
|
14
15
|
/**
|
|
15
16
|
* Main recommendation block control that composes all sub-controls
|
|
@@ -26,6 +27,7 @@ export declare class RecommendationBlockControl extends CommonControl {
|
|
|
26
27
|
private productLayoutControl;
|
|
27
28
|
private filtersControl;
|
|
28
29
|
private shuffleControl;
|
|
30
|
+
private pricePlacementControl;
|
|
29
31
|
private layoutOrientationControl;
|
|
30
32
|
getId(): string;
|
|
31
33
|
getTemplate(): string;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Price Placement Control
|
|
3
|
+
*
|
|
4
|
+
* Two block-level price settings ported from the legacy product block, shown
|
|
5
|
+
* above the Currency control in the main Settings tab:
|
|
6
|
+
*
|
|
7
|
+
* - "Product Price Orientation" (`priceMovedToNextLine`): a vertical/horizontal
|
|
8
|
+
* icon radio (mirrors the Items block control). `vertical` (default) keeps the
|
|
9
|
+
* price and original price on separate stacked rows (current Guido look);
|
|
10
|
+
* `horizontal` renders them inline on the same line and Card Composition
|
|
11
|
+
* collapses them into a single "Product Prices" entry.
|
|
12
|
+
* - "Hide if same as discounted" (`priceHideIfSameAsDiscounted`): a toggle.
|
|
13
|
+
* When ON, email-service blanks the redundant original price at send time when
|
|
14
|
+
* it equals the sale price (see the `hide-price` block attribute below).
|
|
15
|
+
*
|
|
16
|
+
* Orientation re-renders the rows (it changes the saved template layout).
|
|
17
|
+
* Hide-if-same NEVER touches the template — it only persists config + stamps the
|
|
18
|
+
* `hide-price` attribute; the visual hide is simulated in the preview and applied
|
|
19
|
+
* for real server-side by email-service.
|
|
20
|
+
*/
|
|
21
|
+
import type { RecommendationNodeConfig } from '../../types/nodeConfig';
|
|
22
|
+
import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
23
|
+
import { CommonControl } from '../../../common-control';
|
|
24
|
+
export declare const PRICE_PLACEMENT_CONTROL_ID = "recommendation-price-placement-control";
|
|
25
|
+
type Orientation = 'vertical' | 'horizontal';
|
|
26
|
+
/**
|
|
27
|
+
* Control for the block-level price orientation radio + hide-if-same toggle.
|
|
28
|
+
*/
|
|
29
|
+
export declare class PricePlacementControl extends CommonControl {
|
|
30
|
+
private store;
|
|
31
|
+
getId(): string;
|
|
32
|
+
getTemplate(): string;
|
|
33
|
+
onRender(): void;
|
|
34
|
+
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
35
|
+
_setFormValues(config: RecommendationNodeConfig): void;
|
|
36
|
+
_initializeHideToggle(config: RecommendationNodeConfig): void;
|
|
37
|
+
/**
|
|
38
|
+
* Disables the orientation radio when a price element is hidden via Card
|
|
39
|
+
* Composition — orientation is meaningless without both prices visible.
|
|
40
|
+
* Visibility lives on the attribute rows' `data-visibility` (set by the Card
|
|
41
|
+
* Composition control). Inline mode has no standalone original-price row, so
|
|
42
|
+
* the merged "Product Prices" entry (the price row) governs.
|
|
43
|
+
*/
|
|
44
|
+
_updateOrientationDisabled(): void;
|
|
45
|
+
_onOrientationChange(orientation: Orientation): void;
|
|
46
|
+
_onHideIfSameChange(value: boolean): void;
|
|
47
|
+
/**
|
|
48
|
+
* Mirrors the hide-if-same flag onto the durable `hide-price` block attribute
|
|
49
|
+
* read by email-service at send time.
|
|
50
|
+
*/
|
|
51
|
+
_stampHideIfSameAttr(value: boolean): void;
|
|
52
|
+
/**
|
|
53
|
+
* Rebuilds the product rows so the renderer re-reads the inline/stacked
|
|
54
|
+
* layout flag from the store. Used by the orientation change only.
|
|
55
|
+
*/
|
|
56
|
+
_regenerate(): void;
|
|
57
|
+
_listenToFormUpdates(): void;
|
|
58
|
+
}
|
|
59
|
+
export {};
|
|
@@ -73,11 +73,11 @@ export declare const NameControls: {
|
|
|
73
73
|
new (): {
|
|
74
74
|
getId(): string;
|
|
75
75
|
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
76
|
+
getAdditionalModifications(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
76
77
|
getParentControlId(): string;
|
|
77
78
|
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
78
79
|
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
79
80
|
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
80
|
-
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
81
81
|
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
82
82
|
};
|
|
83
83
|
};
|
|
@@ -72,11 +72,11 @@ export declare const OldPriceControls: {
|
|
|
72
72
|
new (): {
|
|
73
73
|
getId(): string;
|
|
74
74
|
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
75
|
+
getAdditionalModifications(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
75
76
|
getParentControlId(): string;
|
|
76
77
|
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
77
78
|
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
78
79
|
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
79
|
-
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
80
80
|
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
81
81
|
};
|
|
82
82
|
};
|
|
@@ -75,11 +75,11 @@ export declare const OmnibusDiscountControls: {
|
|
|
75
75
|
new (): {
|
|
76
76
|
getId(): string;
|
|
77
77
|
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
78
|
+
getAdditionalModifications(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
78
79
|
getParentControlId(): string;
|
|
79
80
|
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
80
81
|
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
81
82
|
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
82
|
-
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
83
83
|
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
84
84
|
};
|
|
85
85
|
};
|
|
@@ -75,11 +75,11 @@ export declare const OmnibusPriceControls: {
|
|
|
75
75
|
new (): {
|
|
76
76
|
getId(): string;
|
|
77
77
|
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
78
|
+
getAdditionalModifications(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
78
79
|
getParentControlId(): string;
|
|
79
80
|
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
80
81
|
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
81
82
|
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
82
|
-
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
83
83
|
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
84
84
|
};
|
|
85
85
|
};
|
|
@@ -72,11 +72,11 @@ export declare const PriceControls: {
|
|
|
72
72
|
new (): {
|
|
73
73
|
getId(): string;
|
|
74
74
|
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
75
|
+
getAdditionalModifications(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
75
76
|
getParentControlId(): string;
|
|
76
77
|
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
77
78
|
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
78
79
|
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
79
|
-
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
80
80
|
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
81
81
|
};
|
|
82
82
|
};
|
|
@@ -25,6 +25,8 @@ export interface PerBlockConfigs {
|
|
|
25
25
|
unresponsive: boolean;
|
|
26
26
|
size: string;
|
|
27
27
|
customAttributes: string[];
|
|
28
|
+
priceMovedToNextLine: boolean;
|
|
29
|
+
priceHideIfSameAsDiscounted: boolean;
|
|
28
30
|
}
|
|
29
31
|
interface PerBlockState {
|
|
30
32
|
recommendationConfigs: PerBlockConfigs;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { RecommendationProduct } from '@@/Types/recommendation';
|
|
2
|
+
import { type ElementRenderer, type CellRenderOptions } from '../utils';
|
|
2
3
|
/**
|
|
3
4
|
* Grid element renderer
|
|
4
5
|
* Each element returns a `<td>` containing a nested table structure:
|
|
@@ -24,4 +25,15 @@ export declare const ATTRIBUTE_CELL_CLASS = "attribute-cell";
|
|
|
24
25
|
* card-composition control so both render identical filler markup.
|
|
25
26
|
*/
|
|
26
27
|
export declare function buildFillerCell(columnWidth: string, padding?: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Renders the inline price cell used when "Move to next line" is OFF: the sale
|
|
30
|
+
* price and original price sit side by side in a single attribute cell, each
|
|
31
|
+
* keeping its own `esd-extension-block-id` + `product-*` class so the per-element
|
|
32
|
+
* style controls and the compiler keep working.
|
|
33
|
+
*
|
|
34
|
+
* `originalFirst` preserves the card-composition order (original before sale when
|
|
35
|
+
* `productOldPrice` precedes `productPrice` in the composition) so the side-by-side
|
|
36
|
+
* order matches the stacked order.
|
|
37
|
+
*/
|
|
38
|
+
export declare function renderInlineGridPriceCell(product: RecommendationProduct, originalFirst?: boolean, priceOptions?: CellRenderOptions, oldPriceOptions?: CellRenderOptions, cardBackgroundColor?: string): string;
|
|
27
39
|
export declare const gridElementRenderer: ElementRenderer;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
|
|
2
|
-
import { type ElementRenderer, type RenderOptions } from '../utils';
|
|
2
|
+
import { type ElementRenderer, type PricePlacementFlags, type RenderOptions } 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 RenderOptions } 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, renderOptions?: RenderOptions): string;
|
|
12
|
+
export declare function prepareGridAttributeRows(products: RecommendationProduct[], productsPerRow: number, elementRenderer: ElementRenderer, composition?: string[], filterList?: FiltersResponse, renderOptions?: RenderOptions & PricePlacementFlags): 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, renderOptions?: RenderOptions): string;
|
|
22
|
+
export declare function prepareGridProductRows(products: RecommendationProduct[], productsPerRow: number, elementRenderer: ElementRenderer, composition?: string[], filterList?: FiltersResponse, renderOptions?: RenderOptions & PricePlacementFlags): 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, renderOptions?: RenderOptions): string;
|
|
31
|
+
export declare function prepareProductRows(products: RecommendationProduct[], productsPerRow: number, composition?: string[], filterList?: FiltersResponse, renderOptions?: RenderOptions & PricePlacementFlags): 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;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import type { RecommendationProduct } from '@@/Types/recommendation';
|
|
8
8
|
import { type Orientation, type PrepareProductRowsOptions } from './utils';
|
|
9
|
-
export { DEFAULTS, DEFAULT_CARD_COMPOSITION, DEFAULT_CARD_VISIBILITY, getDefaultProducts, spacer, sanitizeImageUrl, createBlockTemplate, toDisplayableAttributeValue, type Orientation, type PrepareProductRowsOptions, type ElementRenderer, type ProductCardGetter, type AttributeStyleTemplate, type AttributeStyleTemplates, type CellBackgroundColors, type CellAlignments, type CellClasses, type OmnibusTexts, } from './utils';
|
|
9
|
+
export { DEFAULTS, DEFAULT_CARD_COMPOSITION, DEFAULT_CARD_VISIBILITY, getDefaultProducts, isSamePrice, spacer, sanitizeImageUrl, createBlockTemplate, toDisplayableAttributeValue, type Orientation, type PrepareProductRowsOptions, type ElementRenderer, type ProductCardGetter, type AttributeStyleTemplate, type AttributeStyleTemplates, type CellBackgroundColors, type CellAlignments, type CellClasses, type OmnibusTexts, } from './utils';
|
|
10
10
|
/**
|
|
11
11
|
* Unified function to prepare product rows for any layout.
|
|
12
12
|
* Delegates to the appropriate layout-specific implementation.
|