@useinsider/guido 3.2.0-beta.e01b42a → 3.2.0-beta.e0b6612

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 (116) hide show
  1. package/README.md +1 -0
  2. package/dist/@types/config/schemas.js +66 -54
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +91 -81
  5. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +7 -7
  6. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +12 -20
  7. package/dist/components/organisms/header/EditorActions.vue.js +2 -2
  8. package/dist/components/organisms/header/EditorActions.vue2.js +51 -36
  9. package/dist/components/organisms/header/RightSlot.vue.js +10 -10
  10. package/dist/components/organisms/header/RightSlot.vue2.js +16 -13
  11. package/dist/components/organisms/onboarding/AMPOnboarding.vue2.js +51 -31
  12. package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
  13. package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +23 -22
  14. package/dist/components/organisms/onboarding/ItemsOnboarding.vue.js +1 -1
  15. package/dist/components/organisms/onboarding/ItemsOnboarding.vue2.js +37 -39
  16. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +3 -3
  17. package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +30 -41
  18. package/dist/components/organisms/onboarding/VersionHistoryOnboarding.vue2.js +15 -14
  19. package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +18 -17
  20. package/dist/composables/useActionsApi.js +4 -4
  21. package/dist/composables/useFullStoryBridge.js +14 -0
  22. package/dist/composables/useHtmlCompiler.js +23 -21
  23. package/dist/composables/useHtmlValidator.js +40 -38
  24. package/dist/composables/usePreviewMode.js +20 -16
  25. package/dist/composables/useRibbonOffset.js +21 -0
  26. package/dist/composables/useSave.js +23 -15
  27. package/dist/composables/useStripo.js +52 -47
  28. package/dist/composables/validators/useLiquidValidator.js +42 -0
  29. package/dist/config/compiler/liquidCompilerRules.js +15 -0
  30. package/dist/config/compiler/recommendationCompilerRules.js +162 -43
  31. package/dist/config/compiler/unsubscribeCompilerRules.js +48 -45
  32. package/dist/config/compiler/utils/recommendationCompilerUtils.js +52 -46
  33. package/dist/config/migrator/checkboxMigrator.js +5 -3
  34. package/dist/config/migrator/radioButtonMigrator.js +66 -44
  35. package/dist/config/migrator/recommendationMigrator.js +1 -1
  36. package/dist/enums/extensions/recommendationBlock.js +14 -11
  37. package/dist/enums/onboarding.js +7 -2
  38. package/dist/enums/recommendation.js +2 -2
  39. package/dist/enums/unsubscribe.js +34 -27
  40. package/dist/extensions/Blocks/CouponBlock/template.js +24 -13
  41. package/dist/extensions/Blocks/Items/controls/price/singlePrice.js +38 -38
  42. package/dist/extensions/Blocks/Items/enums/productEnums.js +19 -7
  43. package/dist/extensions/Blocks/RadioButton/template.js +1 -1
  44. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  45. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +27 -11
  46. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +185 -172
  47. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +21 -18
  48. package/dist/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.js +99 -0
  49. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +6 -6
  50. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +3 -1
  51. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +94 -92
  52. package/dist/extensions/Blocks/Recommendation/controls/name/textTrim.js +27 -57
  53. package/dist/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.js +14 -0
  54. package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +31 -31
  55. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +18 -17
  56. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +29 -25
  57. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +7 -5
  58. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -29
  59. package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -7
  60. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +3 -1
  61. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +21 -21
  62. package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -50
  63. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +17 -14
  64. package/dist/extensions/Blocks/Unsubscribe/block.js +11 -11
  65. package/dist/extensions/DynamicContent/dynamic-content.js +17 -12
  66. package/dist/guido.css +1 -1
  67. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +258 -235
  68. package/dist/package.json.js +1 -1
  69. package/dist/services/recommendationApi.js +15 -15
  70. package/dist/services/stripoApi.js +9 -9
  71. package/dist/services/templateLibraryApi.js +48 -46
  72. package/dist/src/@types/config/index.d.ts +1 -1
  73. package/dist/src/@types/config/schemas.d.ts +28 -0
  74. package/dist/src/@types/config/types.d.ts +3 -1
  75. package/dist/src/@types/generic.d.ts +0 -1
  76. package/dist/src/@types/save-as-template.d.ts +1 -0
  77. package/dist/src/composables/useActionsApi.d.ts +1 -1
  78. package/dist/src/composables/useConfig.d.ts +12 -0
  79. package/dist/src/composables/useFullStoryBridge.d.ts +11 -0
  80. package/dist/src/composables/useRibbonOffset.d.ts +4 -0
  81. package/dist/src/composables/validators/useLiquidValidator.d.ts +3 -0
  82. package/dist/src/config/compiler/liquidCompilerRules.d.ts +2 -0
  83. package/dist/src/config/compiler/utils/recommendationCompilerUtils.d.ts +1 -1
  84. package/dist/src/enums/extensions/recommendationBlock.d.ts +3 -0
  85. package/dist/src/enums/onboarding.d.ts +6 -0
  86. package/dist/src/enums/unsubscribe.d.ts +5 -0
  87. package/dist/src/extensions/Blocks/CouponBlock/template.d.ts +2 -0
  88. package/dist/src/extensions/Blocks/RadioButton/template.d.ts +1 -1
  89. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +1 -0
  90. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  91. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +5 -0
  92. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +5 -0
  93. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +3 -0
  94. package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/textTrim.d.ts +35 -0
  95. package/dist/src/extensions/Blocks/Recommendation/controls/name/textTrim.d.ts +3 -20
  96. package/dist/src/extensions/Blocks/Recommendation/controls/shared/textTrimCssRules.d.ts +29 -0
  97. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  98. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
  99. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +20 -3
  100. package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +3 -3
  101. package/dist/src/services/templateLibraryApi.d.ts +1 -1
  102. package/dist/src/stores/config.d.ts +108 -0
  103. package/dist/src/stores/onboarding.d.ts +4 -0
  104. package/dist/src/stores/preview.d.ts +3 -0
  105. package/dist/src/utils/genericUtil.d.ts +1 -1
  106. package/dist/src/utils/htmlCompiler.d.ts +2 -1
  107. package/dist/static/styles/base.css.js +7 -2
  108. package/dist/static/styles/components/button.css.js +3 -2
  109. package/dist/static/styles/components/loader.css.js +4 -0
  110. package/dist/stores/onboarding.js +4 -0
  111. package/dist/stores/preview.js +4 -3
  112. package/dist/utils/genericUtil.js +42 -20
  113. package/dist/utils/htmlCompiler.js +48 -41
  114. package/dist/utils/templatePreparation.js +36 -25
  115. package/dist/utils/tooltipUtils.js +4 -5
  116. package/package.json +4 -4
@@ -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 {};
@@ -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.
@@ -15,7 +15,7 @@ export interface NodeWithGetStyle {
15
15
  }
16
16
  /** Interface for nodes with parent method */
17
17
  export interface NodeWithParent {
18
- parent: () => ImmutableHtmlNode | undefined;
18
+ parent: () => ImmutableHtmlNode | null;
19
19
  }
20
20
  /**
21
21
  * Type guard to check if a node has getStyle method
@@ -38,13 +38,13 @@ export declare function isTdNode(node: unknown): node is ImmutableHtmlNode & Nod
38
38
  * @param property - The CSS property name
39
39
  * @returns The style value or null if not accessible
40
40
  */
41
- export declare function safeGetStyle(node: ImmutableHtmlNode | null | undefined, property: string): string | null | undefined;
41
+ export declare function safeGetStyle(node: ImmutableHtmlNode | null, property: string): string | null | undefined;
42
42
  /**
43
43
  * Safely retrieves the parent element of a node
44
44
  * @param node - The node to get the parent from
45
45
  * @returns The parent node or null if not accessible
46
46
  */
47
- export declare function safeGetParent(node: ImmutableHtmlNode | null | undefined): ImmutableHtmlNode | null;
47
+ export declare function safeGetParent(node: ImmutableHtmlNode | null): ImmutableHtmlNode | null;
48
48
  /**
49
49
  * Safely retrieves the tag name from a node.
50
50
  * Handles both standard DOM tagName property and Stripo's getTagName() method.
@@ -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
  };