@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.
Files changed (189) hide show
  1. package/README.md +117 -0
  2. package/dist/@types/config/schemas.js +166 -96
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +92 -80
  5. package/dist/components/organisms/AutoSaveController.vue.js +17 -0
  6. package/dist/components/organisms/AutoSaveController.vue2.js +13 -0
  7. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +7 -7
  8. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +12 -20
  9. package/dist/components/organisms/header/AutoSaveToggle.vue.js +22 -0
  10. package/dist/components/organisms/header/AutoSaveToggle.vue2.js +19 -0
  11. package/dist/components/organisms/header/EditorActions.vue.js +2 -2
  12. package/dist/components/organisms/header/EditorActions.vue2.js +51 -36
  13. package/dist/components/organisms/header/RightSlot.vue.js +11 -11
  14. package/dist/components/organisms/header/RightSlot.vue2.js +17 -13
  15. package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +51 -31
  16. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
  17. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +23 -22
  18. package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +1 -1
  19. package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +37 -39
  20. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +3 -3
  21. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +30 -41
  22. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +15 -14
  23. package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +18 -17
  24. package/dist/composables/useActionsApi.js +4 -4
  25. package/dist/composables/useAutoSave.js +71 -0
  26. package/dist/composables/useFullStoryBridge.js +14 -0
  27. package/dist/composables/useHtmlCompiler.js +23 -21
  28. package/dist/composables/useHtmlValidator.js +40 -38
  29. package/dist/composables/usePreviewMode.js +20 -16
  30. package/dist/composables/useRecommendation.js +46 -26
  31. package/dist/composables/useRibbonOffset.js +21 -0
  32. package/dist/composables/useSave.js +26 -15
  33. package/dist/composables/useStripo.js +48 -45
  34. package/dist/composables/validators/useCouponBlockValidator.js +24 -0
  35. package/dist/composables/validators/useLiquidValidator.js +42 -0
  36. package/dist/config/compiler/liquidCompilerRules.js +15 -0
  37. package/dist/config/compiler/recommendationCompilerRules.js +162 -43
  38. package/dist/config/compiler/unsubscribeCompilerRules.js +48 -45
  39. package/dist/config/compiler/utils/recommendationCompilerUtils.js +110 -71
  40. package/dist/config/i18n/en/tooltips.json.js +2 -1
  41. package/dist/config/migrator/checkboxMigrator.js +5 -3
  42. package/dist/config/migrator/index.js +9 -9
  43. package/dist/config/migrator/radioButtonMigrator.js +66 -44
  44. package/dist/config/migrator/recommendation/compositionMapper.js +98 -0
  45. package/dist/config/migrator/recommendation/extractors.js +27 -0
  46. package/dist/config/migrator/recommendation/htmlBuilder.js +496 -0
  47. package/dist/config/migrator/recommendation/parseLegacyConfig.js +33 -0
  48. package/dist/config/migrator/recommendation/settingsMapper.js +70 -0
  49. package/dist/config/migrator/recommendation/themeMapper.js +93 -0
  50. package/dist/config/migrator/recommendationMigrator.js +74 -290
  51. package/dist/enums/extensions/recommendationBlock.js +16 -12
  52. package/dist/enums/onboarding.js +7 -2
  53. package/dist/enums/recommendation.js +2 -2
  54. package/dist/enums/unsubscribe.js +34 -27
  55. package/dist/extensions/Blocks/CouponBlock/template.js +24 -13
  56. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +38 -38
  57. package/dist/extensions/Blocks/Items/enums/productEnums.js +19 -7
  58. package/dist/extensions/Blocks/RadioButton/template.js +1 -1
  59. package/dist/extensions/Blocks/Recommendation/block.js +60 -50
  60. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  61. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +5 -5
  62. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +27 -11
  63. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +185 -172
  64. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +21 -18
  65. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +99 -0
  66. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +27 -26
  67. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +3 -1
  68. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +211 -162
  69. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +27 -57
  70. package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +14 -0
  71. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +75 -73
  72. package/dist/extensions/Blocks/Recommendation/services/configService.js +76 -33
  73. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +18 -17
  74. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +123 -79
  75. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +24 -13
  76. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -29
  77. package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -7
  78. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +27 -15
  79. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +21 -21
  80. package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -50
  81. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +17 -14
  82. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +21 -0
  83. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +13 -22
  84. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +6 -6
  85. package/dist/extensions/Blocks/Unsubscribe/block.js +11 -11
  86. package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +16 -17
  87. package/dist/extensions/DynamicContent/dynamic-content.js +17 -12
  88. package/dist/guido.css +1 -1
  89. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +393 -264
  90. package/dist/node_modules/valibot/dist/index.js +450 -235
  91. package/dist/package.json.js +1 -1
  92. package/dist/services/recommendationApi.js +15 -15
  93. package/dist/services/stripoApi.js +9 -9
  94. package/dist/services/templateLibraryApi.js +49 -46
  95. package/dist/src/@types/config/defaults.d.ts +5 -1
  96. package/dist/src/@types/config/index.d.ts +3 -3
  97. package/dist/src/@types/config/schemas.d.ts +245 -0
  98. package/dist/src/@types/config/types.d.ts +11 -1
  99. package/dist/src/@types/generic.d.ts +0 -1
  100. package/dist/src/@types/save-as-template.d.ts +1 -0
  101. package/dist/src/components/Guido.vue.d.ts +1 -1
  102. package/dist/src/components/organisms/AutoSaveController.vue.d.ts +2 -0
  103. package/dist/src/components/organisms/header/AutoSaveToggle.vue.d.ts +2 -0
  104. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  105. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
  106. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  107. package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -1
  108. package/dist/src/composables/useActionsApi.d.ts +1 -1
  109. package/dist/src/composables/useAutoSave.d.ts +3 -0
  110. package/dist/src/composables/useConfig.d.ts +70 -0
  111. package/dist/src/composables/useFullStoryBridge.d.ts +11 -0
  112. package/dist/src/composables/useRecommendation.d.ts +10 -1
  113. package/dist/src/composables/useRecommendation.test.d.ts +1 -0
  114. package/dist/src/composables/useRibbonOffset.d.ts +4 -0
  115. package/dist/src/composables/useSave.d.ts +1 -1
  116. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
  117. package/dist/src/composables/validators/useLiquidValidator.d.ts +3 -0
  118. package/dist/src/config/compiler/liquidCompilerRules.d.ts +2 -0
  119. package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +1 -1
  120. package/dist/src/config/migrator/index.d.ts +2 -1
  121. package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +2 -0
  122. package/dist/src/config/migrator/recommendation/compositionMapper.test.d.ts +1 -0
  123. package/dist/src/config/migrator/recommendation/extractors.d.ts +7 -0
  124. package/dist/src/config/migrator/recommendation/extractors.test.d.ts +1 -0
  125. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +11 -0
  126. package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +15 -0
  127. package/dist/src/config/migrator/recommendation/parseLegacyConfig.test.d.ts +1 -0
  128. package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +7 -0
  129. package/dist/src/config/migrator/recommendation/settingsMapper.test.d.ts +1 -0
  130. package/dist/src/config/migrator/recommendation/themeMapper.d.ts +5 -0
  131. package/dist/src/config/migrator/recommendation/themeMapper.test.d.ts +1 -0
  132. package/dist/src/config/migrator/recommendation/types.d.ts +205 -0
  133. package/dist/src/config/migrator/recommendationMigrator.d.ts +13 -1
  134. package/dist/src/config/migrator/recommendationMigrator.test.d.ts +1 -0
  135. package/dist/src/enums/extensions/recommendationBlock.d.ts +3 -0
  136. package/dist/src/enums/onboarding.d.ts +6 -0
  137. package/dist/src/enums/unsubscribe.d.ts +5 -0
  138. package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +2 -0
  139. package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
  140. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
  141. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  142. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +5 -0
  143. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +5 -0
  144. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +3 -0
  145. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.d.ts +35 -0
  146. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.test.d.ts +1 -0
  147. package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +3 -20
  148. package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +29 -0
  149. package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +21 -3
  150. package/dist/src/extensions/Blocks/Recommendation/services/configService.test.d.ts +1 -0
  151. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +34 -0
  152. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  153. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
  154. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +20 -3
  155. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -1
  156. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +21 -0
  157. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.test.d.ts +1 -0
  158. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -3
  159. package/dist/src/library.d.ts +1 -1
  160. package/dist/src/services/templateLibraryApi.d.ts +1 -1
  161. package/dist/src/stores/autosave.d.ts +12 -0
  162. package/dist/src/stores/config.d.ts +630 -0
  163. package/dist/src/stores/editor.d.ts +23 -0
  164. package/dist/src/stores/onboarding.d.ts +4 -0
  165. package/dist/src/stores/preview.d.ts +3 -0
  166. package/dist/src/utils/genericUtil.d.ts +1 -1
  167. package/dist/src/utils/htmlCompiler.d.ts +2 -1
  168. package/dist/src/utils/htmlEscape.d.ts +5 -0
  169. package/dist/src/utils/htmlEscape.test.d.ts +1 -0
  170. package/dist/src/utils/timeUtil.d.ts +8 -0
  171. package/dist/static/styles/base.css.js +7 -2
  172. package/dist/static/styles/components/button.css.js +16 -9
  173. package/dist/static/styles/components/loader.css.js +4 -0
  174. package/dist/static/styles/components/narrow-panel.css.js +52 -0
  175. package/dist/stores/autosave.js +17 -0
  176. package/dist/stores/editor.js +3 -1
  177. package/dist/stores/onboarding.js +4 -0
  178. package/dist/stores/preview.js +4 -3
  179. package/dist/utils/genericUtil.js +42 -20
  180. package/dist/utils/htmlCompiler.js +48 -41
  181. package/dist/utils/htmlEscape.js +13 -0
  182. package/dist/utils/pairProductVariables.js +89 -88
  183. package/dist/utils/templatePreparation.js +75 -24
  184. package/dist/utils/timeUtil.js +19 -0
  185. package/dist/utils/tooltipUtils.js +4 -5
  186. package/package.json +8 -4
  187. package/dist/enums/displayConditions.js +0 -80
  188. package/dist/extensions/Blocks/Recommendation/templates/grid/migration.js +0 -251
  189. 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
+ }
@@ -1,9 +1,9 @@
1
- import { ImmutableCssNode, ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
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): RecommendationNodeConfig;
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
@@ -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 = (attrName: string, content: string) => string;
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;
@@ -1,6 +1,3 @@
1
- /**
2
- * Utility for preserving text styling when updating innerHTML
3
- */
4
1
  import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
5
2
  /**
6
3
  * Preserves existing style tags when updating text content
@@ -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<void>;
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
+ }, {}, {}>;