@useinsider/guido 3.1.1 → 3.2.0-beta.080341b
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/README.md +117 -0
- package/dist/@types/config/schemas.js +166 -96
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +92 -80
- package/dist/components/organisms/AutoSaveController.vue.js +17 -0
- package/dist/components/organisms/AutoSaveController.vue2.js +13 -0
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +7 -7
- package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +12 -20
- package/dist/components/organisms/header/AutoSaveToggle.vue.js +22 -0
- package/dist/components/organisms/header/AutoSaveToggle.vue2.js +19 -0
- package/dist/components/organisms/header/EditorActions.vue.js +2 -2
- package/dist/components/organisms/header/EditorActions.vue2.js +51 -36
- package/dist/components/organisms/header/RightSlot.vue.js +11 -11
- package/dist/components/organisms/header/RightSlot.vue2.js +17 -13
- package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +51 -31
- package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +23 -22
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +37 -39
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +3 -3
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +30 -41
- package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +15 -14
- package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +18 -17
- package/dist/composables/useActionsApi.js +4 -4
- package/dist/composables/useAutoSave.js +71 -0
- package/dist/composables/useFullStoryBridge.js +14 -0
- package/dist/composables/useHtmlCompiler.js +23 -21
- package/dist/composables/useHtmlValidator.js +40 -38
- package/dist/composables/usePreviewMode.js +20 -16
- package/dist/composables/useRecommendation.js +46 -26
- package/dist/composables/useRibbonOffset.js +21 -0
- package/dist/composables/useSave.js +26 -15
- package/dist/composables/useStripo.js +48 -45
- package/dist/composables/validators/useCouponBlockValidator.js +24 -0
- package/dist/composables/validators/useLiquidValidator.js +42 -0
- package/dist/config/compiler/liquidCompilerRules.js +15 -0
- package/dist/config/compiler/recommendationCompilerRules.js +162 -43
- package/dist/config/compiler/unsubscribeCompilerRules.js +48 -45
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +110 -71
- package/dist/config/i18n/en/tooltips.json.js +2 -1
- package/dist/config/migrator/checkboxMigrator.js +5 -3
- package/dist/config/migrator/index.js +9 -9
- package/dist/config/migrator/radioButtonMigrator.js +66 -44
- package/dist/config/migrator/recommendation/compositionMapper.js +98 -0
- package/dist/config/migrator/recommendation/extractors.js +27 -0
- package/dist/config/migrator/recommendation/htmlBuilder.js +496 -0
- package/dist/config/migrator/recommendation/parseLegacyConfig.js +33 -0
- package/dist/config/migrator/recommendation/settingsMapper.js +70 -0
- package/dist/config/migrator/recommendation/themeMapper.js +93 -0
- package/dist/config/migrator/recommendationMigrator.js +74 -290
- package/dist/enums/extensions/recommendationBlock.js +16 -12
- package/dist/enums/onboarding.js +7 -2
- package/dist/enums/recommendation.js +2 -2
- package/dist/enums/unsubscribe.js +34 -27
- package/dist/extensions/Blocks/CouponBlock/template.js +24 -13
- package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +38 -38
- package/dist/extensions/Blocks/Items/enums/productEnums.js +19 -7
- package/dist/extensions/Blocks/RadioButton/template.js +1 -1
- package/dist/extensions/Blocks/Recommendation/block.js +60 -50
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +5 -5
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +27 -11
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +185 -172
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +21 -18
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +99 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +27 -26
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +3 -1
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +211 -162
- package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +27 -57
- package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +14 -0
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +75 -73
- package/dist/extensions/Blocks/Recommendation/services/configService.js +76 -33
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +18 -17
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +123 -79
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +24 -13
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -29
- package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -7
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +27 -15
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +21 -21
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -50
- package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +17 -14
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +21 -0
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +13 -22
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +6 -6
- package/dist/extensions/Blocks/Unsubscribe/block.js +11 -11
- package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +16 -17
- package/dist/extensions/DynamicContent/dynamic-content.js +17 -12
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +393 -264
- package/dist/node_modules/valibot/dist/index.js +450 -235
- package/dist/package.json.js +1 -1
- package/dist/services/recommendationApi.js +15 -15
- package/dist/services/stripoApi.js +9 -9
- package/dist/services/templateLibraryApi.js +49 -46
- package/dist/src/@types/config/defaults.d.ts +5 -1
- package/dist/src/@types/config/index.d.ts +3 -3
- package/dist/src/@types/config/schemas.d.ts +245 -0
- package/dist/src/@types/config/types.d.ts +11 -1
- package/dist/src/@types/generic.d.ts +0 -1
- package/dist/src/@types/save-as-template.d.ts +1 -0
- package/dist/src/components/Guido.vue.d.ts +1 -1
- package/dist/src/components/organisms/AutoSaveController.vue.d.ts +2 -0
- package/dist/src/components/organisms/header/AutoSaveToggle.vue.d.ts +2 -0
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
- package/dist/src/composables/useActionsApi.d.ts +1 -1
- package/dist/src/composables/useAutoSave.d.ts +3 -0
- package/dist/src/composables/useConfig.d.ts +70 -0
- package/dist/src/composables/useFullStoryBridge.d.ts +11 -0
- package/dist/src/composables/useRecommendation.d.ts +10 -1
- package/dist/src/composables/useRecommendation.test.d.ts +1 -0
- package/dist/src/composables/useRibbonOffset.d.ts +4 -0
- package/dist/src/composables/useSave.d.ts +1 -1
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
- package/dist/src/composables/validators/useLiquidValidator.d.ts +3 -0
- package/dist/src/config/compiler/liquidCompilerRules.d.ts +2 -0
- package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +1 -1
- package/dist/src/config/migrator/index.d.ts +2 -1
- package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +2 -0
- package/dist/src/config/migrator/recommendation/compositionMapper.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +7 -0
- package/dist/src/config/migrator/recommendation/extractors.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +11 -0
- package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +15 -0
- package/dist/src/config/migrator/recommendation/parseLegacyConfig.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +7 -0
- package/dist/src/config/migrator/recommendation/settingsMapper.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/themeMapper.d.ts +5 -0
- package/dist/src/config/migrator/recommendation/themeMapper.test.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/types.d.ts +205 -0
- package/dist/src/config/migrator/recommendationMigrator.d.ts +13 -1
- package/dist/src/config/migrator/recommendationMigrator.test.d.ts +1 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +3 -0
- package/dist/src/enums/onboarding.d.ts +6 -0
- package/dist/src/enums/unsubscribe.d.ts +5 -0
- package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +2 -0
- package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +5 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +3 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.d.ts +35 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +3 -20
- package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +29 -0
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +21 -3
- package/dist/src/extensions/Blocks/Recommendation/services/configService.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +34 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +20 -3
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +21 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.test.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -3
- package/dist/src/library.d.ts +1 -1
- package/dist/src/services/templateLibraryApi.d.ts +1 -1
- package/dist/src/stores/autosave.d.ts +12 -0
- package/dist/src/stores/config.d.ts +630 -0
- package/dist/src/stores/editor.d.ts +23 -0
- package/dist/src/stores/onboarding.d.ts +4 -0
- package/dist/src/stores/preview.d.ts +3 -0
- package/dist/src/utils/genericUtil.d.ts +1 -1
- package/dist/src/utils/htmlCompiler.d.ts +2 -1
- package/dist/src/utils/htmlEscape.d.ts +5 -0
- package/dist/src/utils/htmlEscape.test.d.ts +1 -0
- package/dist/src/utils/timeUtil.d.ts +8 -0
- package/dist/static/styles/base.css.js +7 -2
- package/dist/static/styles/components/button.css.js +16 -9
- package/dist/static/styles/components/loader.css.js +4 -0
- package/dist/static/styles/components/narrow-panel.css.js +52 -0
- package/dist/stores/autosave.js +17 -0
- package/dist/stores/editor.js +3 -1
- package/dist/stores/onboarding.js +4 -0
- package/dist/stores/preview.js +4 -3
- package/dist/utils/genericUtil.js +42 -20
- package/dist/utils/htmlCompiler.js +48 -41
- package/dist/utils/htmlEscape.js +13 -0
- package/dist/utils/pairProductVariables.js +89 -88
- package/dist/utils/templatePreparation.js +75 -24
- package/dist/utils/timeUtil.js +19 -0
- package/dist/utils/tooltipUtils.js +4 -5
- package/package.json +8 -4
- package/dist/enums/displayConditions.js +0 -80
- package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
- package/dist/src/enums/displayConditions.d.ts +0 -2
|
@@ -50,3 +50,8 @@ export declare const ATTR_CUSTOM_PREFIX = "customAttr:";
|
|
|
50
50
|
export declare const ATTR_DATA_CUSTOM_ATTRIBUTES = "data-custom-attributes";
|
|
51
51
|
/** HTML attribute on <td> elements identifying the product attribute for compiler template variable generation */
|
|
52
52
|
export declare const ATTR_PRODUCT_ATTR = "product-attr";
|
|
53
|
+
/**
|
|
54
|
+
* Default attribute names that are already represented by built-in composition toggle items.
|
|
55
|
+
* Used to exclude these from the custom attribute dropdown to prevent duplication with toggles.
|
|
56
|
+
*/
|
|
57
|
+
export declare const BUILT_IN_DEFAULT_ATTRIBUTES: Set<string>;
|
|
@@ -170,6 +170,11 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
170
170
|
* When filterList changes (e.g. after async fetch), re-renders dropdowns with new options.
|
|
171
171
|
*/
|
|
172
172
|
private _subscribeToStoreChanges;
|
|
173
|
+
/**
|
|
174
|
+
* Returns filters eligible for the custom attribute dropdown,
|
|
175
|
+
* excluding default attributes already covered by built-in toggle items.
|
|
176
|
+
*/
|
|
177
|
+
private _getAddableFilters;
|
|
173
178
|
/**
|
|
174
179
|
* Looks up the display name for an attribute from the store's filterList.
|
|
175
180
|
* Falls back to Title Case conversion of the snake_case attribute name.
|
|
@@ -13,10 +13,12 @@
|
|
|
13
13
|
* product cards — changing "brand" color won't affect "rating_star" color.
|
|
14
14
|
*/
|
|
15
15
|
import { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
16
|
+
import { CustomAttributeTextTrimControl } from './textTrim';
|
|
16
17
|
/**
|
|
17
18
|
* Grouped Custom Attribute Controls
|
|
18
19
|
* Use this object for cleaner imports in extension.ts
|
|
19
20
|
*/
|
|
21
|
+
export { CustomAttributeTextTrimControl } from './textTrim';
|
|
20
22
|
export declare const CustomAttributeControls: {
|
|
21
23
|
readonly align: {
|
|
22
24
|
new (): {
|
|
@@ -102,4 +104,5 @@ export declare const CustomAttributeControls: {
|
|
|
102
104
|
isVisible(_node: ImmutableHtmlNode): boolean;
|
|
103
105
|
};
|
|
104
106
|
};
|
|
107
|
+
readonly textTrim: typeof CustomAttributeTextTrimControl;
|
|
105
108
|
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom Attribute Text Trim Control
|
|
3
|
+
*
|
|
4
|
+
* Per-attribute text trimming for custom product attributes.
|
|
5
|
+
* Unlike NameTextTrimControl which applies to ALL product names globally,
|
|
6
|
+
* this control is scoped to a specific custom attribute type via the
|
|
7
|
+
* `product-attr` HTML attribute — changing text-trim on "brand" won't
|
|
8
|
+
* affect "rating_star".
|
|
9
|
+
*
|
|
10
|
+
* CSS rules are shared with NameTextTrimControl via shared/textTrimCssRules.ts.
|
|
11
|
+
*/
|
|
12
|
+
import { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
13
|
+
import { CommonControl } from '../../../common-control';
|
|
14
|
+
/**
|
|
15
|
+
* Control for enabling/disabling text trimming on individual custom attributes.
|
|
16
|
+
* Scoped per attribute type using the `product-attr` HTML attribute.
|
|
17
|
+
*/
|
|
18
|
+
export declare class CustomAttributeTextTrimControl extends CommonControl {
|
|
19
|
+
getId(): string;
|
|
20
|
+
getTemplate(): string;
|
|
21
|
+
onRender(): void;
|
|
22
|
+
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
23
|
+
_setFormValues(): void;
|
|
24
|
+
_getCurrentTrimState(): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Finds all custom attribute elements of the same type as the current node.
|
|
27
|
+
*
|
|
28
|
+
* Similar to getCustomAttrTargetNodes in customAttribute/index.ts, but adapted
|
|
29
|
+
* for CommonControl lifecycle where currentNode is a class property (not a
|
|
30
|
+
* parameter from Stripo's getTargetNodes override).
|
|
31
|
+
*/
|
|
32
|
+
_getTargetElements(): ImmutableHtmlNode[];
|
|
33
|
+
_onTextTrimChange(enabled: boolean): void;
|
|
34
|
+
_listenToFormUpdates(): void;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
2
2
|
import { CommonControl } from '../../../common-control';
|
|
3
3
|
/**
|
|
4
|
-
* Control for enabling/disabling text trimming on product names
|
|
4
|
+
* Control for enabling/disabling text trimming on product names.
|
|
5
5
|
* When enabled, adds a CSS class that applies text-overflow: ellipsis
|
|
6
|
-
* and injects the required CSS rules into the document stylesheet
|
|
6
|
+
* and injects the required CSS rules into the document stylesheet.
|
|
7
7
|
*/
|
|
8
8
|
export declare class NameTextTrimControl extends CommonControl {
|
|
9
9
|
getId(): string;
|
|
@@ -12,23 +12,6 @@ export declare class NameTextTrimControl extends CommonControl {
|
|
|
12
12
|
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
13
13
|
_setFormValues(): void;
|
|
14
14
|
_getCurrentTrimState(): boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Finds an existing CSS rule in the document stylesheet by exact query
|
|
17
|
-
* @param query - The CSS query to search for (uses Stripo's CSS query syntax)
|
|
18
|
-
* @returns The CSS rule node if found, undefined otherwise
|
|
19
|
-
*/
|
|
20
|
-
_findCssRule(query: string): ImmutableCssNode | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* Finds the .text-trim-enabled p rule by searching all text-trim rules and comparing selectors
|
|
23
|
-
* This is needed because Stripo's CSS query syntax interprets spaces as path separators
|
|
24
|
-
* @returns true if the rule exists
|
|
25
|
-
*/
|
|
26
|
-
_hasParagraphRule(): boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Ensures the text-trim CSS rules exist in the document stylesheet
|
|
29
|
-
* Only adds rules if they don't already exist (prevents duplicates across multiple blocks)
|
|
30
|
-
*/
|
|
31
|
-
_ensureCssRulesExist(): void;
|
|
32
15
|
_onTextTrimChange(enabled: boolean): void;
|
|
33
16
|
_listenToFormUpdates(): void;
|
|
34
17
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Text Trim CSS Rule Management
|
|
3
|
+
*
|
|
4
|
+
* Extracted from NameTextTrimControl to be reused by CustomAttributeTextTrimControl.
|
|
5
|
+
* Follows the same pattern as controls/mobileLayout/cssRules.ts — standalone
|
|
6
|
+
* functions that accept an API parameter, importable by any control class.
|
|
7
|
+
*
|
|
8
|
+
* The CSS rules are document-scoped (shared across all recommendation blocks).
|
|
9
|
+
* Once injected, they persist until the template is closed.
|
|
10
|
+
*/
|
|
11
|
+
import type { ImmutableCssNode } from '@stripoinc/ui-editor-extensions';
|
|
12
|
+
import { ModificationDescription } from '@stripoinc/ui-editor-extensions';
|
|
13
|
+
export declare const CSS_CLASS_TEXT_TRIM = "text-trim-enabled";
|
|
14
|
+
interface CssCapableApi {
|
|
15
|
+
getDocumentRootCssNode: () => ImmutableCssNode | null;
|
|
16
|
+
getDocumentModifier: () => {
|
|
17
|
+
modifyCss: (node: ImmutableCssNode) => {
|
|
18
|
+
appendRule: (rule: string) => void;
|
|
19
|
+
};
|
|
20
|
+
apply: (desc: ModificationDescription) => void;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Ensures the text-trim CSS rules exist in the document stylesheet.
|
|
25
|
+
* Only adds rules if they don't already exist (prevents duplicates across blocks).
|
|
26
|
+
* Calls getDocumentRootCssNode once and passes it to both checks.
|
|
27
|
+
*/
|
|
28
|
+
export declare function ensureTextTrimCssRulesExist(api: CssCapableApi): void;
|
|
29
|
+
export {};
|
|
@@ -95,15 +95,23 @@ export declare class RecommendationConfigService {
|
|
|
95
95
|
*
|
|
96
96
|
* Called when a block is first created (dropped into template).
|
|
97
97
|
* Can optionally merge in partial config from migration.
|
|
98
|
+
*
|
|
99
|
+
* The `wasFreshDrop` flag distinguishes a brand-new drop (no prior config)
|
|
100
|
+
* from a clone (Stripo replays the source's setNodeConfig payload before
|
|
101
|
+
* onCreated fires). Callers use this to skip side-effects already inherited
|
|
102
|
+
* from the source.
|
|
98
103
|
* @example
|
|
99
104
|
* // In Block.onCreated lifecycle
|
|
100
|
-
* RecommendationConfigService.initializeConfig(this.api, node);
|
|
105
|
+
* const { config, wasFreshDrop } = RecommendationConfigService.initializeConfig(this.api, node);
|
|
101
106
|
* @param api - Stripo extension API with document modifier
|
|
102
107
|
* @param node - The immutable HTML node to initialize
|
|
103
108
|
* @param partialConfig - Optional partial config to merge with defaults
|
|
104
|
-
* @returns The initialized configuration
|
|
109
|
+
* @returns The initialized configuration and whether the node was a fresh drop
|
|
105
110
|
*/
|
|
106
|
-
static initializeConfig(api: DocumentModifierApi, node: ImmutableHtmlNode, partialConfig?: PartialNodeConfig):
|
|
111
|
+
static initializeConfig(api: DocumentModifierApi, node: ImmutableHtmlNode, partialConfig?: PartialNodeConfig): {
|
|
112
|
+
config: RecommendationNodeConfig;
|
|
113
|
+
wasFreshDrop: boolean;
|
|
114
|
+
};
|
|
107
115
|
/**
|
|
108
116
|
* Save complete configuration to a node
|
|
109
117
|
*
|
|
@@ -119,6 +127,16 @@ export declare class RecommendationConfigService {
|
|
|
119
127
|
*
|
|
120
128
|
* Reads existing data-attributes and creates a proper node config.
|
|
121
129
|
* Used when loading templates created before node config was implemented.
|
|
130
|
+
*
|
|
131
|
+
* Sources, in priority order (later overrides earlier):
|
|
132
|
+
* 1. `esd-ext-config` JSON blob — emitted by the recommendation migrator and
|
|
133
|
+
* by hand-authored new templates. Carries the full RecommendationNodeConfig
|
|
134
|
+
* (strategy, language, currency, filters, productIds, etc.) which the
|
|
135
|
+
* discrete data-* attrs below cannot capture.
|
|
136
|
+
* 2. Discrete `data-*` attributes — runtime source of truth for
|
|
137
|
+
* layout/composition/spacing; controls keep these in sync as the user
|
|
138
|
+
* edits, so we let them override the JSON blob if they disagree.
|
|
139
|
+
* 3. `currency-*` attributes — durable currency source on the block element.
|
|
122
140
|
* @param api - Stripo extension API with document modifier
|
|
123
141
|
* @param node - The block node to migrate
|
|
124
142
|
* @returns The migrated configuration
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -36,6 +36,25 @@ interface PerBlockState {
|
|
|
36
36
|
/** Snapshot of filters taken when the drawer opens, used to revert on cancel */
|
|
37
37
|
filterSnapshot: Filter[] | null;
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Persisted-config subset used by `seedBlockUrlConfig` to reconstruct
|
|
41
|
+
* `recommendationConfigs` from a node-config JSON blob without coupling the
|
|
42
|
+
* caller to the full `RecommendationNodeConfig` shape. Separator strings are
|
|
43
|
+
* narrowed at the seed boundary.
|
|
44
|
+
*/
|
|
45
|
+
export interface PerBlockUrlConfig {
|
|
46
|
+
strategy: string;
|
|
47
|
+
language: string;
|
|
48
|
+
size: string;
|
|
49
|
+
productIds: string[];
|
|
50
|
+
filters: Filter[];
|
|
51
|
+
shuffleProducts: boolean;
|
|
52
|
+
currencyCode: string;
|
|
53
|
+
currencyAlignment: 'before' | 'after';
|
|
54
|
+
currencyDecimalCount: number;
|
|
55
|
+
currencyDecimalSeparator: string;
|
|
56
|
+
currencyThousandSeparator: string;
|
|
57
|
+
}
|
|
39
58
|
interface StoreState {
|
|
40
59
|
recommendationCampaignUrls: Record<string, string>;
|
|
41
60
|
activePredictiveAlgorithms: number[];
|
|
@@ -202,6 +221,21 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
|
|
|
202
221
|
* Automatically cleaned up when removeBlockState deletes the block entry.
|
|
203
222
|
*/
|
|
204
223
|
markBlockInitialized(id: number): void;
|
|
224
|
+
/**
|
|
225
|
+
* Seeds the URL-relevant fields of a block from a persisted node config.
|
|
226
|
+
*
|
|
227
|
+
* Used at save-time to ensure the campaign URL is built from the
|
|
228
|
+
* persisted truth (the `esd-ext-config` blob in the raw HTML) even when
|
|
229
|
+
* the user never selected the block in this editor session — without
|
|
230
|
+
* this seed, `_syncNodeConfigToStore` would never have run for that
|
|
231
|
+
* block and the store would hold default values (USD/en_US/mostPopular)
|
|
232
|
+
* instead of the real config.
|
|
233
|
+
*
|
|
234
|
+
* Creates the block entry if missing; otherwise patches only the URL-
|
|
235
|
+
* relevant subset and leaves runtime fields (e.g., `recommendedProducts`,
|
|
236
|
+
* `isInitialized`) alone.
|
|
237
|
+
*/
|
|
238
|
+
seedBlockUrlConfig(id: number, config: PerBlockUrlConfig): void;
|
|
205
239
|
/**
|
|
206
240
|
* Patches the current block's recommendationConfigs.
|
|
207
241
|
* Replaces `store.$patch({ recommendationConfigs: { ... } })` pattern.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RecommendationProduct } from '@@/Types/recommendation';
|
|
1
|
+
import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
|
|
2
2
|
import { type ElementRenderer } from '../utils';
|
|
3
3
|
/**
|
|
4
4
|
* Generates attribute-aligned product rows for grid layout.
|
|
@@ -9,7 +9,7 @@ import { type ElementRenderer } from '../utils';
|
|
|
9
9
|
* @param composition - Array defining order of card elements
|
|
10
10
|
* @returns HTML string for attribute-aligned rows
|
|
11
11
|
*/
|
|
12
|
-
export declare function prepareGridAttributeRows(products: RecommendationProduct[], productsPerRow: number, elementRenderer: ElementRenderer, composition?: string[]): string;
|
|
12
|
+
export declare function prepareGridAttributeRows(products: RecommendationProduct[], productsPerRow: number, elementRenderer: ElementRenderer, composition?: string[], filterList?: FiltersResponse): string;
|
|
13
13
|
/**
|
|
14
14
|
* Prepares grid product rows with attribute-aligned structure
|
|
15
15
|
* Groups products into rows, then generates attribute-aligned HTML for each group
|
|
@@ -19,7 +19,7 @@ export declare function prepareGridAttributeRows(products: RecommendationProduct
|
|
|
19
19
|
* @param composition - Array defining order of card elements
|
|
20
20
|
* @returns HTML string for all product rows
|
|
21
21
|
*/
|
|
22
|
-
export declare function prepareGridProductRows(products: RecommendationProduct[], productsPerRow: number, elementRenderer: ElementRenderer, composition?: string[]): string;
|
|
22
|
+
export declare function prepareGridProductRows(products: RecommendationProduct[], productsPerRow: number, elementRenderer: ElementRenderer, composition?: string[], filterList?: FiltersResponse): string;
|
|
23
23
|
/**
|
|
24
24
|
* Prepares grid product rows with attribute-aligned structure.
|
|
25
25
|
* Uses row-based rendering where each attribute type forms a single row across all products.
|
|
@@ -28,6 +28,6 @@ export declare function prepareGridProductRows(products: RecommendationProduct[]
|
|
|
28
28
|
* @param composition - Array defining element order
|
|
29
29
|
* @returns HTML string for product rows
|
|
30
30
|
*/
|
|
31
|
-
export declare function prepareProductRows(products: RecommendationProduct[], productsPerRow: number, composition?: string[]): string;
|
|
31
|
+
export declare function prepareProductRows(products: RecommendationProduct[], productsPerRow: number, composition?: string[], filterList?: FiltersResponse): string;
|
|
32
32
|
export declare function getDefaultTemplate(recommendationId?: number): string;
|
|
33
33
|
export declare function generateBlockTemplate(products: RecommendationProduct[], productsPerRow: number, title?: string, composition?: string[], mobileProductsPerRow?: number): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RecommendationProduct } from '@@/Types/recommendation';
|
|
1
|
+
import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
|
|
2
2
|
/**
|
|
3
3
|
* Generates a list product card with 3-column layout
|
|
4
4
|
* Uses buildElementRenderer to render Image, Info content, and Button
|
|
@@ -11,7 +11,7 @@ import type { RecommendationProduct } from '@@/Types/recommendation';
|
|
|
11
11
|
* @param composition - Array defining order of card elements
|
|
12
12
|
* @returns HTML string for a single product card row
|
|
13
13
|
*/
|
|
14
|
-
export declare function getListProductCard(product: RecommendationProduct, composition?: string[]): string;
|
|
14
|
+
export declare function getListProductCard(product: RecommendationProduct, composition?: string[], filterList?: FiltersResponse): string;
|
|
15
15
|
/**
|
|
16
16
|
* Prepares list product rows
|
|
17
17
|
* Each product is a full-width row with 3-column layout
|
|
@@ -19,6 +19,6 @@ export declare function getListProductCard(product: RecommendationProduct, compo
|
|
|
19
19
|
* @param composition - Array defining order of card elements
|
|
20
20
|
* @returns HTML string for product rows
|
|
21
21
|
*/
|
|
22
|
-
export declare function prepareProductRows(products: RecommendationProduct[], composition?: string[]): string;
|
|
22
|
+
export declare function prepareProductRows(products: RecommendationProduct[], composition?: string[], filterList?: FiltersResponse): string;
|
|
23
23
|
export declare function getDefaultTemplate(): string;
|
|
24
24
|
export declare function generateBlockTemplate(products: RecommendationProduct[], title?: string, composition?: string[]): string;
|
|
@@ -1,15 +1,29 @@
|
|
|
1
|
-
import type { RecommendationProduct } from '@@/Types/recommendation';
|
|
1
|
+
import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
|
|
2
2
|
import { ATTR_PRODUCT_IMAGE, ATTR_PRODUCT_NAME, ATTR_PRODUCT_PRICE, ATTR_PRODUCT_OLD_PRICE, ATTR_PRODUCT_OMNIBUS_PRICE, ATTR_PRODUCT_OMNIBUS_DISCOUNT, ATTR_PRODUCT_BUTTON } from '../constants';
|
|
3
3
|
/**
|
|
4
4
|
* Converts a snake_case attribute name to Title Case display name.
|
|
5
5
|
* e.g., "rating_star" → "Rating Star"
|
|
6
6
|
*/
|
|
7
7
|
export declare function toDisplayName(attrName: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Checks whether an attribute is a default (top-level) product attribute
|
|
10
|
+
* vs a custom product attribute (nested under `product_attributes`).
|
|
11
|
+
* Returns false when filterList is empty or the attribute is not found.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isDefaultAttribute(attrName: string, filterList: FiltersResponse): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Resolves the `product-attr` HTML attribute value based on attribute type from the filter list.
|
|
16
|
+
* - Default attributes → attribute name directly (e.g., "brand") → compiles to `{{1_0_brand}}`
|
|
17
|
+
* - Product attributes → "product_attribute.<name>" (e.g., "product_attribute.rating_star")
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveProductAttrValue(attrName: string, filterList: FiltersResponse): string;
|
|
8
20
|
/**
|
|
9
21
|
* Callback that generates the cell HTML for a custom product attribute.
|
|
10
22
|
* Layout-specific: grid returns `<td>…`, list returns `<tr><td>…</td></tr>`.
|
|
23
|
+
* @param productAttrValue - The resolved `product-attr` value (e.g., "brand" or "product_attribute.rating_star")
|
|
24
|
+
* @param content - The display content for the cell
|
|
11
25
|
*/
|
|
12
|
-
export type CustomCellHtmlGetter = (
|
|
26
|
+
export type CustomCellHtmlGetter = (productAttrValue: string, content: string) => string;
|
|
13
27
|
/**
|
|
14
28
|
* Symbol key for embedding custom attribute HTML in an ElementRenderer.
|
|
15
29
|
* Grid and list renderers store their custom-attribute cell template under this key
|
|
@@ -28,8 +42,9 @@ export declare const CUSTOM_CELL_HTML: unique symbol;
|
|
|
28
42
|
* alongside built-in ones, so template code can use a uniform lookup for all attributes.
|
|
29
43
|
* @param baseRenderer - The built-in element renderer (grid or list), must include a [CUSTOM_CELL_HTML] entry
|
|
30
44
|
* @param composition - Array of attribute keys including `customAttr:*` entries
|
|
45
|
+
* @param filterList - Filter list from the store, used to determine attribute type for correct product-attr resolution
|
|
31
46
|
*/
|
|
32
|
-
export declare function buildElementRenderer(baseRenderer: ElementRenderer, composition: string[]): ElementRenderer;
|
|
47
|
+
export declare function buildElementRenderer(baseRenderer: ElementRenderer, composition: string[], filterList?: FiltersResponse): ElementRenderer;
|
|
33
48
|
export type Orientation = 'list' | 'grid';
|
|
34
49
|
/**
|
|
35
50
|
* Options for prepareProductRows unified function
|
|
@@ -41,6 +56,8 @@ export interface PrepareProductRowsOptions {
|
|
|
41
56
|
mobileProductsPerRow?: number;
|
|
42
57
|
/** Array defining order of card elements */
|
|
43
58
|
composition?: string[];
|
|
59
|
+
/** Filter list for attribute type resolution (default vs product attributes) */
|
|
60
|
+
filterList?: FiltersResponse;
|
|
44
61
|
}
|
|
45
62
|
/**
|
|
46
63
|
* Element renderer interface for product card elements.
|
|
@@ -24,7 +24,7 @@ export interface CurrencyConfig {
|
|
|
24
24
|
/** Number of decimal places (-1 for no formatting) */
|
|
25
25
|
decimalCount: number;
|
|
26
26
|
/** Character used for decimal separation */
|
|
27
|
-
decimalSeparator: '.' | ',';
|
|
27
|
+
decimalSeparator: '.' | ',' | ' ';
|
|
28
28
|
/** Character used for thousands separation */
|
|
29
29
|
thousandSeparator: '.' | ',' | ' ' | '';
|
|
30
30
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps legacy algorithm strategy keys (used by templates authored against the
|
|
3
|
+
* old recommendation system) to the new keys used by `RecommendationFeedSourceMaps`.
|
|
4
|
+
*
|
|
5
|
+
* Renames are matched by feed-source id:
|
|
6
|
+
* - `viewedTogether` → `similarViewed` (id 11, path `viewed-together`)
|
|
7
|
+
* - `purchasedTogether` → `similarBought` (id 12, path `purchased-together`)
|
|
8
|
+
* - `trending` → `trendingProducts` (id 40, path `trending`)
|
|
9
|
+
* - `mostValuable` → `mostValuableOfPartner` (id 46, path `most-valuable`)
|
|
10
|
+
* - `topSellers` → `mostPurchased` (id 62, path `top-sellers`)
|
|
11
|
+
*
|
|
12
|
+
* Used at two boundaries:
|
|
13
|
+
* 1. The migrator (`settingsMapper`), so freshly migrated node configs carry
|
|
14
|
+
* the new key.
|
|
15
|
+
* 2. The algorithm dropdown control, so already-saved blocks that still carry
|
|
16
|
+
* a legacy key resolve to a matching dropdown option.
|
|
17
|
+
*
|
|
18
|
+
* Unknown values pass through untouched so a future-added algorithm doesn't
|
|
19
|
+
* silently default.
|
|
20
|
+
*/
|
|
21
|
+
export declare function mapLegacyStrategy(legacy: string | undefined): string | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/src/library.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { default as Guido } from './components/Guido.vue';
|
|
2
|
-
export type { GuidoConfig, GuidoConfigInput, IdentityConfig, PartnerConfig, TemplateConfig, EditorConfig, UIConfig, FeaturesConfig, BlocksConfig, CompilerConfig, DynamicContent, EmailHeader, DefaultBlockType, CustomBlockType, ValidationResult, ValidationError, } from './@types/config';
|
|
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
4
|
export type { StripoEventType } from './@types/events';
|
|
5
5
|
export type { PositionData, DynamicContentEvent, MergeTagClickEvent, MergeTag, BaseDynamicContent, TooltipOptions, TextValueObject, L10n, } from './@types/generic';
|
|
@@ -3,5 +3,5 @@ export declare const useTemplateLibraryApi: () => {
|
|
|
3
3
|
getCategories: () => Promise<Category[]>;
|
|
4
4
|
checkTemplateNameAvailability: (value: string) => Promise<boolean>;
|
|
5
5
|
createCategory: (category: string) => Promise<string>;
|
|
6
|
-
createTemplate: () => Promise<
|
|
6
|
+
createTemplate: () => Promise<boolean>;
|
|
7
7
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const AUTOSAVE_STATUS: {
|
|
2
|
+
readonly IDLE: "idle";
|
|
3
|
+
readonly SAVING: "saving";
|
|
4
|
+
readonly SAVED: "saved";
|
|
5
|
+
readonly ERROR: "error";
|
|
6
|
+
};
|
|
7
|
+
export type AutosaveStatus = typeof AUTOSAVE_STATUS[keyof typeof AUTOSAVE_STATUS];
|
|
8
|
+
export declare const useAutosaveStore: import("pinia").StoreDefinition<"guidoAutosave", {
|
|
9
|
+
isOn: boolean;
|
|
10
|
+
lastSavedAt: Date | null;
|
|
11
|
+
status: AutosaveStatus;
|
|
12
|
+
}, {}, {}>;
|