@useinsider/guido 3.15.0 → 3.16.0-beta.0faee0c
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 +108 -92
- package/dist/components/Guido.vue.js +1 -1
- package/dist/components/Guido.vue2.js +78 -75
- package/dist/composables/useActionsApi.js +30 -22
- package/dist/composables/useEmailTemplateApplier.js +25 -23
- package/dist/composables/useHtmlValidator.js +108 -106
- package/dist/composables/useStripo.js +30 -29
- package/dist/composables/useTimerClone.js +21 -19
- package/dist/config/i18n/en/labels.json.js +7 -3
- package/dist/config/migrator/checkboxMigrator.js +20 -19
- package/dist/config/migrator/radioButtonMigrator.js +26 -25
- package/dist/config/migrator/recommendation/compositionMapper.js +26 -23
- package/dist/config/migrator/recommendation/htmlBuilder.js +156 -155
- package/dist/extensions/Blocks/Checkbox/constants/controlIds.js +4 -0
- package/dist/extensions/Blocks/Checkbox/constants/selectors.js +6 -0
- package/dist/extensions/Blocks/Checkbox/controls/blockBackground/index.js +10 -0
- package/dist/extensions/Blocks/Checkbox/extension.js +6 -5
- package/dist/extensions/Blocks/Checkbox/settingsPanel.js +15 -14
- package/dist/extensions/Blocks/Checkbox/template.js +10 -9
- package/dist/extensions/Blocks/Items/block.js +44 -42
- package/dist/extensions/Blocks/Items/template.js +86 -86
- package/dist/extensions/Blocks/RadioButton/constants/controlIds.js +4 -0
- package/dist/extensions/Blocks/RadioButton/constants/selectors.js +6 -0
- package/dist/extensions/Blocks/RadioButton/controls/blockBackground/index.js +10 -0
- package/dist/extensions/Blocks/RadioButton/extension.js +5 -4
- package/dist/extensions/Blocks/RadioButton/settingsPanel.js +12 -11
- package/dist/extensions/Blocks/RadioButton/template.js +16 -9
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +18 -15
- package/dist/extensions/Blocks/Recommendation/controls/cardBackground/index.js +5 -9
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +363 -322
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +8 -8
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +271 -231
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +98 -113
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +21 -0
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +16 -16
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +16 -16
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +120 -120
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +55 -54
- package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +89 -0
- package/dist/extensions/Blocks/common-control.js +42 -35
- package/dist/extensions/Blocks/controlFactories.js +117 -115
- package/dist/guido.css +1 -1
- package/dist/library.js +11 -7
- package/dist/node_modules/valibot/dist/index.js +230 -216
- package/dist/public/trackingIds.js +8 -0
- package/dist/src/@types/config/schemas.d.ts +20 -0
- package/dist/src/composables/useActionsApi.d.ts +1 -1
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useHtmlValidator.d.ts +3 -2
- package/dist/src/config/migrator/recommendation/types.d.ts +1 -0
- package/dist/src/extensions/Blocks/Checkbox/constants/controlIds.d.ts +7 -0
- package/dist/src/extensions/Blocks/Checkbox/constants/index.d.ts +10 -0
- package/dist/src/extensions/Blocks/Checkbox/constants/selectors.d.ts +16 -0
- package/dist/src/extensions/Blocks/Checkbox/controls/blockBackground/index.d.ts +14 -0
- package/dist/src/extensions/Blocks/RadioButton/constants/controlIds.d.ts +7 -0
- package/dist/src/extensions/Blocks/RadioButton/constants/index.d.ts +10 -0
- package/dist/src/extensions/Blocks/RadioButton/constants/selectors.d.ts +16 -0
- package/dist/src/extensions/Blocks/RadioButton/controls/blockBackground/index.d.ts +14 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +27 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +4 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/spacing/index.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +12 -11
- package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +47 -0
- package/dist/src/extensions/Blocks/_Boilerplate/constants/controlIds.d.ts +7 -0
- package/dist/src/extensions/Blocks/_Boilerplate/constants/index.d.ts +10 -0
- package/dist/src/extensions/Blocks/_Boilerplate/constants/selectors.d.ts +16 -0
- package/dist/src/extensions/Blocks/_Boilerplate/controls/blockBackground/index.d.ts +14 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +3 -1
- package/dist/src/library.d.ts +1 -0
- package/dist/src/public/trackingIds.d.ts +9 -0
- package/dist/src/stores/config.d.ts +36 -0
- package/dist/src/stores/editor.d.ts +25 -0
- package/dist/src/utils/linkTrackingIds.d.ts +30 -0
- package/dist/stores/editor.js +4 -1
- package/dist/stores/onboarding.js +11 -7
- package/dist/utils/linkTrackingIds.js +56 -0
- package/dist/utils/pairProductVariables.js +105 -99
- package/dist/utils/templatePreparation.js +72 -61
- package/package.json +5 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TRACK_ID_ATTRIBUTE as a, TRACK_SEQ_ATTRIBUTE as e, assignTrackingIds as o, readTrackFloor as A, readTrackSeq as I } from "../utils/linkTrackingIds.js";
|
|
2
|
+
export {
|
|
3
|
+
a as TRACK_ID_ATTRIBUTE,
|
|
4
|
+
e as TRACK_SEQ_ATTRIBUTE,
|
|
5
|
+
o as assignTrackingIds,
|
|
6
|
+
A as readTrackFloor,
|
|
7
|
+
I as readTrackSeq
|
|
8
|
+
};
|
|
@@ -262,6 +262,14 @@ export declare const TemplateSchema: v.ObjectSchema<{
|
|
|
262
262
|
readonly selectedUnsubscribePages: v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>;
|
|
263
263
|
/** Force recreate template in Stripo storage (use true when updating externally modified templates) */
|
|
264
264
|
readonly forceRecreate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
265
|
+
/**
|
|
266
|
+
* Consumer-persisted tracking-id high-water mark (SD-141414). Used as the id floor
|
|
267
|
+
* during migration so a rolled-back document never re-mints retired tracking ids.
|
|
268
|
+
* Out-of-range numbers are coerced rather than rejected — this value arrives from
|
|
269
|
+
* stored partner data, and rejecting it would fail parseConfig and block the editor
|
|
270
|
+
* mount. Non-numbers still fail, like every other field in this schema.
|
|
271
|
+
*/
|
|
272
|
+
readonly trackIdCounter: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, number>]>, 0>;
|
|
265
273
|
/** Migration-only inputs (legacy block configs) */
|
|
266
274
|
readonly migration: v.OptionalSchema<v.ObjectSchema<{
|
|
267
275
|
/**
|
|
@@ -385,6 +393,8 @@ export declare const FeaturesSchema: v.ObjectSchema<{
|
|
|
385
393
|
readonly autosave: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
386
394
|
/** Enable pre-save domain-allowlist validation (opt-in; Guido self-serves the block toaster) */
|
|
387
395
|
readonly allowlistEnabled: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
396
|
+
/** Enable persistent link tracking-id assignment for the click heatmap (opt-in) */
|
|
397
|
+
readonly linkTrackingIds: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
388
398
|
}, undefined>;
|
|
389
399
|
/**
|
|
390
400
|
* Default block types available in Stripo
|
|
@@ -666,6 +676,14 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
|
666
676
|
readonly selectedUnsubscribePages: v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>;
|
|
667
677
|
/** Force recreate template in Stripo storage (use true when updating externally modified templates) */
|
|
668
678
|
readonly forceRecreate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
679
|
+
/**
|
|
680
|
+
* Consumer-persisted tracking-id high-water mark (SD-141414). Used as the id floor
|
|
681
|
+
* during migration so a rolled-back document never re-mints retired tracking ids.
|
|
682
|
+
* Out-of-range numbers are coerced rather than rejected — this value arrives from
|
|
683
|
+
* stored partner data, and rejecting it would fail parseConfig and block the editor
|
|
684
|
+
* mount. Non-numbers still fail, like every other field in this schema.
|
|
685
|
+
*/
|
|
686
|
+
readonly trackIdCounter: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, number>]>, 0>;
|
|
669
687
|
/** Migration-only inputs (legacy block configs) */
|
|
670
688
|
readonly migration: v.OptionalSchema<v.ObjectSchema<{
|
|
671
689
|
/**
|
|
@@ -774,6 +792,8 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
|
774
792
|
readonly autosave: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
775
793
|
/** Enable pre-save domain-allowlist validation (opt-in; Guido self-serves the block toaster) */
|
|
776
794
|
readonly allowlistEnabled: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
795
|
+
/** Enable persistent link tracking-id assignment for the click heatmap (opt-in) */
|
|
796
|
+
readonly linkTrackingIds: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
777
797
|
}, undefined>, {}>;
|
|
778
798
|
/** Block configuration */
|
|
779
799
|
readonly blocks: v.OptionalSchema<v.ObjectSchema<{
|
|
@@ -6,6 +6,6 @@ export declare const useActionsApi: () => {
|
|
|
6
6
|
activateCustomViewStyles: (isActive?: boolean) => void;
|
|
7
7
|
getPreviewData: (options?: CompileEmailOptions) => Promise<CompiledEmailResult>;
|
|
8
8
|
updateTimerInClonedTemplate: () => Promise<string | null>;
|
|
9
|
-
updateHtmlAndCss: (html: string, css: string) => void
|
|
9
|
+
updateHtmlAndCss: (html: string, css: string) => Promise<void>;
|
|
10
10
|
editorSave: () => Promise<boolean>;
|
|
11
11
|
};
|
|
@@ -40,6 +40,7 @@ export declare const useConfig: () => {
|
|
|
40
40
|
customFieldAttributes: string[];
|
|
41
41
|
selectedUnsubscribePages: number[];
|
|
42
42
|
forceRecreate: boolean;
|
|
43
|
+
trackIdCounter: number;
|
|
43
44
|
migration: {
|
|
44
45
|
recommendationConfigs: {
|
|
45
46
|
[x: string]: {
|
|
@@ -97,6 +98,7 @@ export declare const useConfig: () => {
|
|
|
97
98
|
liquidSyntax: boolean;
|
|
98
99
|
autosave: boolean;
|
|
99
100
|
allowlistEnabled: boolean;
|
|
101
|
+
linkTrackingIds: boolean;
|
|
100
102
|
};
|
|
101
103
|
blocks: {
|
|
102
104
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -172,6 +174,7 @@ export declare const useConfig: () => {
|
|
|
172
174
|
customFieldAttributes: string[];
|
|
173
175
|
selectedUnsubscribePages: number[];
|
|
174
176
|
forceRecreate: boolean;
|
|
177
|
+
trackIdCounter: number;
|
|
175
178
|
migration: {
|
|
176
179
|
recommendationConfigs: {
|
|
177
180
|
[x: string]: {
|
|
@@ -229,6 +232,7 @@ export declare const useConfig: () => {
|
|
|
229
232
|
liquidSyntax: boolean;
|
|
230
233
|
autosave: boolean;
|
|
231
234
|
allowlistEnabled: boolean;
|
|
235
|
+
linkTrackingIds: boolean;
|
|
232
236
|
} | null>;
|
|
233
237
|
blocks: import("vue").ComputedRef<{
|
|
234
238
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -14,8 +14,9 @@ export declare function parseRecommendationVariable(field: string): {
|
|
|
14
14
|
* `{{recoId_index_attribute}}` variables: the built-in compiler attributes plus
|
|
15
15
|
* each account attribute in its canonical token form — bare for
|
|
16
16
|
* `defaultAttribute`, `product_attribute.<name>` for `productAttribute`. Using
|
|
17
|
-
* `
|
|
18
|
-
* validator's notion of "valid form" identical to what is actually emitted
|
|
17
|
+
* `filterToProductAttrValue` (the same producer the block builder uses) keeps the
|
|
18
|
+
* validator's notion of "valid form" identical to what is actually emitted, and
|
|
19
|
+
* admits both forms when a default and a custom attribute share a name.
|
|
19
20
|
*/
|
|
20
21
|
export declare function buildPartnerAttributeNameSet(filterList: FiltersResponse): Set<string>;
|
|
21
22
|
/**
|
|
@@ -193,6 +193,7 @@ export type PerElementStyles = Record<string, MappedTextStyle | MappedButtonStyl
|
|
|
193
193
|
export interface MappedComposition {
|
|
194
194
|
composition: string[];
|
|
195
195
|
visibility: Record<string, boolean>;
|
|
196
|
+
/** Canonical `product-attr` values, mirrored into `data-custom-attributes`. */
|
|
196
197
|
customAttributes: string[];
|
|
197
198
|
/** Mapping of customAttr key → full `product-attr` value. */
|
|
198
199
|
customAttrValues: Record<string, string>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checkbox Extension Constants
|
|
3
|
+
*
|
|
4
|
+
* This module re-exports all constants for the Checkbox extension.
|
|
5
|
+
* Import from this file for cleaner imports.
|
|
6
|
+
* @example
|
|
7
|
+
* import { CheckboxControlId, BLOCK_ROOT_SELECTOR } from './constants';
|
|
8
|
+
*/
|
|
9
|
+
export { CheckboxControlId } from './controlIds';
|
|
10
|
+
export { BLOCK_ROOT_SELECTOR, CSS_CLASS_CHECKBOX_BLOCK, CSS_CLASS_CHECKBOX_BLOCK_V2, } from './selectors';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS selectors and class names used across the Checkbox extension
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Stable contract class present on BOTH legacy and v2 markup — the backend submit
|
|
6
|
+
* script selects by it. Renaming it silently breaks form submission.
|
|
7
|
+
*/
|
|
8
|
+
export declare const CSS_CLASS_CHECKBOX_BLOCK = "checkbox-block";
|
|
9
|
+
/** Current block class — what the template emits and the migrator upgrades legacy blocks to. */
|
|
10
|
+
export declare const CSS_CLASS_CHECKBOX_BLOCK_V2 = "checkbox-block-v2";
|
|
11
|
+
/**
|
|
12
|
+
* Block root selector — the block `<td>` itself.
|
|
13
|
+
* Used across block-level controls so edits apply to the whole block, not the title cell.
|
|
14
|
+
* Derived from the class so a rename cannot half-land.
|
|
15
|
+
*/
|
|
16
|
+
export declare const BLOCK_ROOT_SELECTOR = ".checkbox-block-v2";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const CheckboxBlockBackgroundControl: {
|
|
2
|
+
new (): {
|
|
3
|
+
getId(): string;
|
|
4
|
+
getLabels(): {
|
|
5
|
+
title: string;
|
|
6
|
+
};
|
|
7
|
+
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
8
|
+
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;
|
|
9
|
+
getParentControlId(): string;
|
|
10
|
+
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
11
|
+
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
12
|
+
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RadioButton Extension Constants
|
|
3
|
+
*
|
|
4
|
+
* This module re-exports all constants for the RadioButton extension.
|
|
5
|
+
* Import from this file for cleaner imports.
|
|
6
|
+
* @example
|
|
7
|
+
* import { RadioButtonControlId, BLOCK_ROOT_SELECTOR } from './constants';
|
|
8
|
+
*/
|
|
9
|
+
export { RadioButtonControlId } from './controlIds';
|
|
10
|
+
export { BLOCK_ROOT_SELECTOR, CSS_CLASS_RADIO_BUTTON_BLOCK, CSS_CLASS_RADIO_BUTTON_BLOCK_V2, } from './selectors';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS selectors and class names used across the RadioButton extension
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Stable contract class present on BOTH legacy and v2 markup — the backend submit
|
|
6
|
+
* script selects by it. Renaming it silently breaks form submission.
|
|
7
|
+
*/
|
|
8
|
+
export declare const CSS_CLASS_RADIO_BUTTON_BLOCK = "radio-button-block";
|
|
9
|
+
/** Current block class — what the template emits and the migrator upgrades legacy blocks to. */
|
|
10
|
+
export declare const CSS_CLASS_RADIO_BUTTON_BLOCK_V2 = "radio-button-v2";
|
|
11
|
+
/**
|
|
12
|
+
* Block root selector — the block `<td>` itself.
|
|
13
|
+
* Used across block-level controls so edits apply to the whole block, not the title cell.
|
|
14
|
+
* Derived from the class so a rename cannot half-land.
|
|
15
|
+
*/
|
|
16
|
+
export declare const BLOCK_ROOT_SELECTOR = ".radio-button-v2";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const RadioButtonBlockBackgroundControl: {
|
|
2
|
+
new (): {
|
|
3
|
+
getId(): string;
|
|
4
|
+
getLabels(): {
|
|
5
|
+
title: string;
|
|
6
|
+
};
|
|
7
|
+
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
8
|
+
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;
|
|
9
|
+
getParentControlId(): string;
|
|
10
|
+
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
11
|
+
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
12
|
+
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -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, 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, PRODUCT_ATTRIBUTE_PREFIX, 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_CARD_COMPOSITION, ATTR_DATA_CUSTOM_ATTRIBUTES, ATTR_PRODUCT_ATTR, SELECTOR_ATTRIBUTE_ROW, ATTR_DATA_ATTRIBUTE_TYPE, PRODUCT_ATTRIBUTE_PREFIX, 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';
|
|
@@ -66,8 +66,14 @@ export declare const ATTR_PRODUCT_BUTTON = "productButton";
|
|
|
66
66
|
export declare const ATTR_CUSTOM_PREFIX = "customAttr:";
|
|
67
67
|
/** HTML data attribute storing JSON array of added custom attribute names */
|
|
68
68
|
export declare const ATTR_DATA_CUSTOM_ATTRIBUTES = "data-custom-attributes";
|
|
69
|
+
/** HTML data attribute on the block root holding the comma-joined composition order */
|
|
70
|
+
export declare const ATTR_DATA_CARD_COMPOSITION = "data-card-composition";
|
|
69
71
|
/** HTML attribute on <td> elements identifying the product attribute for compiler template variable generation */
|
|
70
72
|
export declare const ATTR_PRODUCT_ATTR = "product-attr";
|
|
73
|
+
/** Row wrapper of one composition entry inside a product card */
|
|
74
|
+
export declare const SELECTOR_ATTRIBUTE_ROW = ".recommendation-attribute-row";
|
|
75
|
+
/** HTML attribute on an attribute row holding its composition key */
|
|
76
|
+
export declare const ATTR_DATA_ATTRIBUTE_TYPE = "data-attribute-type";
|
|
71
77
|
/** Prefix `resolveProductAttrValue` puts on custom (non-default) product attributes in `product-attr` values */
|
|
72
78
|
export declare const PRODUCT_ATTRIBUTE_PREFIX = "product_attribute.";
|
|
73
79
|
/**
|
|
@@ -29,6 +29,8 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
29
29
|
private _initializeComposition;
|
|
30
30
|
private _registerValueChangeListeners;
|
|
31
31
|
private _readCompositionFromNode;
|
|
32
|
+
/** Upgrades legacy bare-name custom keys to the canonical form. (SD-147101) */
|
|
33
|
+
private _normalizeComposition;
|
|
32
34
|
private _readCustomAttributesFromNode;
|
|
33
35
|
private _readVisibilityFromRows;
|
|
34
36
|
private _getDefaultVisibilities;
|
|
@@ -61,7 +63,15 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
61
63
|
private _createPriceGroupItemHtml;
|
|
62
64
|
private _createCustomItemHtml;
|
|
63
65
|
/**
|
|
64
|
-
*
|
|
66
|
+
* Dropdown label of an attribute. A partner can own a default and a custom
|
|
67
|
+
* attribute under the same name; the type is spelled out only then, so partners
|
|
68
|
+
* without a collision keep clean labels. (SD-147101)
|
|
69
|
+
*/
|
|
70
|
+
private _toOptionLabel;
|
|
71
|
+
/**
|
|
72
|
+
* Builds select options from the store's filterList. Option values are
|
|
73
|
+
* `product-attr` values, so a default attribute and a same-named custom one
|
|
74
|
+
* never collapse onto a single option. (SD-147101)
|
|
65
75
|
* Falls back to a single option for the currently selected attribute.
|
|
66
76
|
*/
|
|
67
77
|
private _getSelectOptions;
|
|
@@ -144,6 +154,12 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
144
154
|
*/
|
|
145
155
|
private _onCustomAttributeChanged;
|
|
146
156
|
private _onReorder;
|
|
157
|
+
/**
|
|
158
|
+
* Outer HTML of an existing attribute row, rewritten to the canonical key when
|
|
159
|
+
* the row still carries a legacy bare-name one. Copying rows this way lets the
|
|
160
|
+
* DOM converge on the next composition change without writing on open.
|
|
161
|
+
*/
|
|
162
|
+
private _getExistingRowHtml;
|
|
147
163
|
private _injectCustomAttributeHtml;
|
|
148
164
|
private _injectGridAttributeRow;
|
|
149
165
|
private _injectListAttributeRow;
|
|
@@ -204,13 +220,19 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
204
220
|
*/
|
|
205
221
|
private _subscribeToStoreChanges;
|
|
206
222
|
/**
|
|
207
|
-
* Returns filters eligible for the custom attribute dropdown,
|
|
208
|
-
*
|
|
223
|
+
* Returns filters eligible for the custom attribute dropdown, excluding default
|
|
224
|
+
* attributes already covered by built-in toggle items.
|
|
225
|
+
*
|
|
226
|
+
* Deduped by canonical value: a partner can own two backend rows of the same type
|
|
227
|
+
* and name (e.g. two `defaultAttribute` "discount"), which are indistinguishable
|
|
228
|
+
* once reduced to a `product-attr`. Left in, they render as identical options and
|
|
229
|
+
* skew the collision count that decides the (Default)/(Custom) suffix. (SD-147101)
|
|
209
230
|
*/
|
|
210
231
|
private _getAddableFilters;
|
|
211
232
|
/**
|
|
212
|
-
* Looks up the display name for
|
|
213
|
-
*
|
|
233
|
+
* Looks up the display name for a `product-attr` value from the store's filterList.
|
|
234
|
+
* Matches on the canonical value, so a default and a same-named custom attribute
|
|
235
|
+
* resolve to their own entry. Falls back to Title Case of the bare name.
|
|
214
236
|
*/
|
|
215
237
|
private _getDisplayNameForAttribute;
|
|
216
238
|
/**
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* - In-place content updates (style-preserving)
|
|
10
10
|
*/
|
|
11
11
|
import type { CurrencyConfig } from '../../types/nodeConfig';
|
|
12
|
-
import type { RecommendationProduct } from '@@/Types/recommendation';
|
|
12
|
+
import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
|
|
13
13
|
import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
14
14
|
import { ModificationDescription } from '@stripoinc/ui-editor-extensions';
|
|
15
15
|
import { type Orientation } from '../../templates';
|
|
@@ -54,9 +54,11 @@ export declare function getCurrentLayout(currentNode: ImmutableHtmlNode | null |
|
|
|
54
54
|
/**
|
|
55
55
|
* Gets the current card composition from block data attribute or use default
|
|
56
56
|
* @param currentNode - The current template node
|
|
57
|
+
* @param filterList - Partner filters. Omitting it makes a row-less legacy key resolve
|
|
58
|
+
* differently here than in `_readCompositionFromNode`. (SD-147101)
|
|
57
59
|
* @returns Array of card element types in order
|
|
58
60
|
*/
|
|
59
|
-
export declare function getCardComposition(currentNode: ImmutableHtmlNode | null | undefined): string[];
|
|
61
|
+
export declare function getCardComposition(currentNode: ImmutableHtmlNode | null | undefined, filterList?: FiltersResponse): string[];
|
|
60
62
|
export interface RegenerateProductRowsOptions {
|
|
61
63
|
currentNode: ImmutableHtmlNode | null | undefined;
|
|
62
64
|
documentModifier: DocumentModifier;
|
|
@@ -30,6 +30,11 @@ export declare class SpacingControl extends CommonControl {
|
|
|
30
30
|
onRender(): void;
|
|
31
31
|
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
32
32
|
onDestroy(): void;
|
|
33
|
+
/**
|
|
34
|
+
* One label + counter per two-column row, so every spacing field gets the same
|
|
35
|
+
* 16px-padded row the color controls already render instead of sharing one grid.
|
|
36
|
+
*/
|
|
37
|
+
_spacingRow(label: string, labelName: string, counterName: string): string;
|
|
33
38
|
/**
|
|
34
39
|
* Updates spacing control visibility based on layout orientation and mobileLayoutEnabled.
|
|
35
40
|
* - List layout: hide column spacing (products are full-width), hide ALL mobile
|
|
@@ -43,22 +43,23 @@ export declare function resolveInlinePriceOrder(composition: string[]): {
|
|
|
43
43
|
*/
|
|
44
44
|
export declare function toDisplayableAttributeValue(value: unknown): string | undefined;
|
|
45
45
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
46
|
+
* Name-only type lookup — **legacy fallback only**; the canonical path uses
|
|
47
|
+
* `isDefaultProductAttr` on the `product-attr` value. A bare name is the canonical
|
|
48
|
+
* form of a default attribute, so a duplicated name resolves to the default rather
|
|
49
|
+
* than to whichever entry the filter list happens to enumerate first. (SD-147101)
|
|
49
50
|
*/
|
|
50
51
|
export declare function isDefaultAttribute(attrName: string, filterList: FiltersResponse): boolean;
|
|
51
52
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
53
|
+
* Name-only `product-attr` resolution — **legacy fallback only**, see
|
|
54
|
+
* `isDefaultAttribute`. Prefer `filterToProductAttrValue`, which reads the type off
|
|
55
|
+
* the filter entry itself.
|
|
55
56
|
*/
|
|
56
57
|
export declare function resolveProductAttrValue(attrName: string, filterList: FiltersResponse): string;
|
|
57
58
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
59
|
+
* Maps a cell's `product-attr` value to its composition key. The value is the
|
|
60
|
+
* canonical identity, so it is carried into the key verbatim — stripping the
|
|
61
|
+
* `product_attribute.` prefix here would collapse a default and a same-named
|
|
62
|
+
* custom attribute onto one key.
|
|
62
63
|
*/
|
|
63
64
|
export declare function toCustomCompositionKey(productAttrValue: string): string;
|
|
64
65
|
/**
|
|
@@ -184,7 +185,7 @@ export interface RenderOptions {
|
|
|
184
185
|
* `RenderOptions`. Single source for both the stacked per-cell options and the two inline
|
|
185
186
|
* (price + old-price) option sets, so style capture → re-bake stays consistent across layouts.
|
|
186
187
|
*/
|
|
187
|
-
export declare function buildCellOptions(attrType: string, renderOptions: RenderOptions): CellRenderOptions;
|
|
188
|
+
export declare function buildCellOptions(attrType: string, renderOptions: RenderOptions, composition?: string[]): CellRenderOptions;
|
|
188
189
|
/**
|
|
189
190
|
* Options for prepareProductRows unified function
|
|
190
191
|
*/
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { FiltersResponse } from '@@/Types/recommendation';
|
|
2
|
+
import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
3
|
+
/**
|
|
4
|
+
* Canonical identity of a card-composition custom attribute is its `product-attr`
|
|
5
|
+
* value — `brand` for a default attribute, `product_attribute.brand` for a custom
|
|
6
|
+
* one. A partner can own both under the same name, and only this form tells them
|
|
7
|
+
* apart. (SD-147101)
|
|
8
|
+
*/
|
|
9
|
+
type FilterEntry = FiltersResponse[string];
|
|
10
|
+
export declare function isDefaultProductAttr(productAttrValue: string): boolean;
|
|
11
|
+
export declare function bareAttributeName(productAttrValue: string): string;
|
|
12
|
+
export declare function compositionKeyToProductAttr(compositionKey: string): string;
|
|
13
|
+
export declare function productAttrToCompositionKey(productAttrValue: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Canonical identity of a filter entry. Reads the type off the entry itself, so
|
|
16
|
+
* two same-named filters never collapse onto one value.
|
|
17
|
+
*/
|
|
18
|
+
export declare function filterToProductAttrValue(filter: FilterEntry): string;
|
|
19
|
+
/**
|
|
20
|
+
* Filter entry behind a bare attribute name. A bare name is the canonical form of a
|
|
21
|
+
* DEFAULT attribute, so the default wins a name collision; the custom entry is only
|
|
22
|
+
* reached when it is the sole match (a genuinely legacy key). (SD-147101)
|
|
23
|
+
*/
|
|
24
|
+
export declare function findFilterByBareName(bareName: string, filterList: FiltersResponse): FilterEntry | undefined;
|
|
25
|
+
export declare function normalizeCompositionKeys(composition: string[], blockNode?: ImmutableHtmlNode | null, filterList?: FiltersResponse): string[];
|
|
26
|
+
/**
|
|
27
|
+
* `data-custom-attributes` upgraded to canonical values. Index-preserving: the
|
|
28
|
+
* Nth entry must keep mapping to the Nth `customAttr:*` composition key.
|
|
29
|
+
*/
|
|
30
|
+
export declare function normalizeCustomAttrValues(values: string[], blockNode?: ImmutableHtmlNode | null, filterList?: FiltersResponse): string[];
|
|
31
|
+
/**
|
|
32
|
+
* Composition key of an attribute row. Custom rows are keyed by their `product-attr`
|
|
33
|
+
* value, which stays correct on rows still tagged with a legacy bare name.
|
|
34
|
+
*/
|
|
35
|
+
export declare function resolveRowCompositionKey(row: ImmutableHtmlNode): string | null;
|
|
36
|
+
/**
|
|
37
|
+
* Finds an attribute row by composition key, tolerating rows still tagged with the
|
|
38
|
+
* legacy bare-name key. Custom candidates are validated against their `product-attr`,
|
|
39
|
+
* so a legacy custom `brand` row is never mistaken for the default `brand`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function findAttributeRow(container: ImmutableHtmlNode, compositionKey: string): ImmutableHtmlNode | null;
|
|
42
|
+
/**
|
|
43
|
+
* Rewrites a copied row's legacy `data-attribute-type` to the canonical key so the
|
|
44
|
+
* DOM converges on the user's next composition change (no write on mere open).
|
|
45
|
+
*/
|
|
46
|
+
export declare function rewriteLegacyRowKeyHtml(rowHtml: string, compositionKey: string): string;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extension Constants
|
|
3
|
+
*
|
|
4
|
+
* This module re-exports all constants for the extension.
|
|
5
|
+
* Import from this file for cleaner imports.
|
|
6
|
+
* @example
|
|
7
|
+
* import { BlockControlId, BLOCK_ROOT_SELECTOR } from './constants';
|
|
8
|
+
*/
|
|
9
|
+
export { BlockControlId } from './controlIds';
|
|
10
|
+
export { BLOCK_ROOT_SELECTOR, CSS_CLASS_BLOCK, CSS_CLASS_BLOCK_V2, } from './selectors';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS selectors and class names used across the extension
|
|
3
|
+
*
|
|
4
|
+
* Declare them ONCE here and import everywhere (template, migrator, save validator,
|
|
5
|
+
* controls). The same literal re-typed across those files is how a rename half-lands.
|
|
6
|
+
*/
|
|
7
|
+
/** Stable contract class, if the backend selects this block by name. Renaming breaks it. */
|
|
8
|
+
export declare const CSS_CLASS_BLOCK = "{{your-block}}";
|
|
9
|
+
/** Current block class — what the template emits and the migrator upgrades legacy blocks to. */
|
|
10
|
+
export declare const CSS_CLASS_BLOCK_V2 = "{{your-block}}-v2";
|
|
11
|
+
/**
|
|
12
|
+
* Block root selector — the block `<td>` itself.
|
|
13
|
+
* Used across block-level controls so edits apply to the whole block, not the title cell.
|
|
14
|
+
* Derived from the class so a rename cannot half-land.
|
|
15
|
+
*/
|
|
16
|
+
export declare const BLOCK_ROOT_SELECTOR = ".{{your-block}}-v2";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const BlockBackgroundControl: {
|
|
2
|
+
new (): {
|
|
3
|
+
getId(): string;
|
|
4
|
+
getLabels(): {
|
|
5
|
+
title: string;
|
|
6
|
+
};
|
|
7
|
+
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
8
|
+
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;
|
|
9
|
+
getParentControlId(): string;
|
|
10
|
+
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
11
|
+
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
12
|
+
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -34,6 +34,8 @@ interface SelectProps {
|
|
|
34
34
|
placeholder: string;
|
|
35
35
|
options: TextValueObject[];
|
|
36
36
|
className?: string;
|
|
37
|
+
/** Adds the picker's built-in search box. Worth it once the list gets long. */
|
|
38
|
+
searchable?: boolean;
|
|
37
39
|
}
|
|
38
40
|
interface CounterProps {
|
|
39
41
|
name: string;
|
|
@@ -105,7 +107,7 @@ export declare abstract class CommonControl extends Control {
|
|
|
105
107
|
text: string;
|
|
106
108
|
value: string;
|
|
107
109
|
}): string;
|
|
108
|
-
_GuSelect({ name, placeholder, options, className }: SelectProps): string;
|
|
110
|
+
_GuSelect({ name, placeholder, options, className, searchable, }: SelectProps): string;
|
|
109
111
|
_GuTextInput({ name, placeholder, className, disabled }: TextInputProps): string;
|
|
110
112
|
_GuCounter({ name, maxValue, minValue, step }: CounterProps): string;
|
|
111
113
|
_GuRadioButtonItem({ text, value, icon }: {
|
package/dist/src/library.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as Guido } from './components/Guido.vue';
|
|
2
2
|
export type { GuidoConfig, GuidoConfigInput, IdentityConfig, PartnerConfig, TemplateConfig, TemplateMigrationConfig, LegacyRecommendationConfig, EditorConfig, UIConfig, FeaturesConfig, BlocksConfig, CompilerConfig, DynamicContent, EmailHeader, DefaultBlockType, CustomBlockType, ValidationResult, ValidationError, } from './@types/config';
|
|
3
3
|
export { validateConfig, parseConfig, parseConfigSafe, isValidConfig, getValidationErrors, MessageType, ProductType, } from './@types/config';
|
|
4
|
+
export { assignTrackingIds, readTrackFloor, readTrackSeq } from './public/trackingIds';
|
|
4
5
|
export type { StripoEventType } from './@types/events';
|
|
5
6
|
export type { PositionData, DynamicContentEvent, MergeTagClickEvent, MergeTag, BaseDynamicContent, DynamicContentNode, DynamicContentList, TooltipOptions, TextValueObject, L10n, } from './@types/generic';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Published as `@useinsider/guido/tracking-ids` — persistent link ids for the click heatmap.
|
|
3
|
+
*
|
|
4
|
+
* Importing from here pulls in nothing else, so the editor never enters a
|
|
5
|
+
* consumer's module graph. Re-export surface only: this is the contract,
|
|
6
|
+
* `utils/linkTrackingIds` is the implementation and stays free to move.
|
|
7
|
+
*/
|
|
8
|
+
export { assignTrackingIds, readTrackFloor, readTrackSeq, TRACK_ID_ATTRIBUTE, TRACK_SEQ_ATTRIBUTE, } from '@@/Utils/linkTrackingIds';
|
|
9
|
+
export type { TrackingIdResult } from '@@/Utils/linkTrackingIds';
|