@useinsider/guido 3.15.0 → 3.15.1-beta.6da4177

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 (24) hide show
  1. package/dist/composables/useHtmlValidator.js +50 -50
  2. package/dist/config/i18n/en/labels.json.js +7 -3
  3. package/dist/config/migrator/recommendation/compositionMapper.js +26 -23
  4. package/dist/config/migrator/recommendation/htmlBuilder.js +156 -155
  5. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +18 -15
  6. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +363 -322
  7. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +8 -8
  8. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +271 -231
  9. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +16 -16
  10. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +16 -16
  11. package/dist/extensions/Blocks/Recommendation/templates/utils.js +120 -120
  12. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +55 -54
  13. package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +89 -0
  14. package/dist/extensions/Blocks/common-control.js +42 -35
  15. package/dist/src/composables/useHtmlValidator.d.ts +3 -2
  16. package/dist/src/config/migrator/recommendation/types.d.ts +1 -0
  17. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  18. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +6 -0
  19. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +27 -5
  20. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +4 -2
  21. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +12 -11
  22. package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +47 -0
  23. package/dist/src/extensions/Blocks/common-control.d.ts +3 -1
  24. package/package.json +1 -1
@@ -9,7 +9,7 @@
9
9
  * - In-place content updates (style-preserving)
10
10
  */
11
11
  import type { CurrencyConfig } from '../../types/nodeConfig';
12
- import type { RecommendationProduct } from '@@/Types/recommendation';
12
+ import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
13
13
  import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
14
14
  import { ModificationDescription } from '@stripoinc/ui-editor-extensions';
15
15
  import { type Orientation } from '../../templates';
@@ -54,9 +54,11 @@ export declare function getCurrentLayout(currentNode: ImmutableHtmlNode | null |
54
54
  /**
55
55
  * Gets the current card composition from block data attribute or use default
56
56
  * @param currentNode - The current template node
57
+ * @param filterList - Partner filters. Omitting it makes a row-less legacy key resolve
58
+ * differently here than in `_readCompositionFromNode`. (SD-147101)
57
59
  * @returns Array of card element types in order
58
60
  */
59
- export declare function getCardComposition(currentNode: ImmutableHtmlNode | null | undefined): string[];
61
+ export declare function getCardComposition(currentNode: ImmutableHtmlNode | null | undefined, filterList?: FiltersResponse): string[];
60
62
  export interface RegenerateProductRowsOptions {
61
63
  currentNode: ImmutableHtmlNode | null | undefined;
62
64
  documentModifier: DocumentModifier;
@@ -43,22 +43,23 @@ export declare function resolveInlinePriceOrder(composition: string[]): {
43
43
  */
44
44
  export declare function toDisplayableAttributeValue(value: unknown): string | undefined;
45
45
  /**
46
- * Checks whether an attribute is a default (top-level) product attribute
47
- * vs a custom product attribute (nested under `product_attributes`).
48
- * Returns false when filterList is empty or the attribute is not found.
46
+ * Name-only type lookup — **legacy fallback only**; the canonical path uses
47
+ * `isDefaultProductAttr` on the `product-attr` value. A bare name is the canonical
48
+ * form of a default attribute, so a duplicated name resolves to the default rather
49
+ * than to whichever entry the filter list happens to enumerate first. (SD-147101)
49
50
  */
50
51
  export declare function isDefaultAttribute(attrName: string, filterList: FiltersResponse): boolean;
51
52
  /**
52
- * Resolves the `product-attr` HTML attribute value based on attribute type from the filter list.
53
- * - Default attributes → attribute name directly (e.g., "brand") → compiles to `{{1_0_brand}}`
54
- * - Product attributes → "product_attribute.<name>" (e.g., "product_attribute.rating_star")
53
+ * Name-only `product-attr` resolution — **legacy fallback only**, see
54
+ * `isDefaultAttribute`. Prefer `filterToProductAttrValue`, which reads the type off
55
+ * the filter entry itself.
55
56
  */
56
57
  export declare function resolveProductAttrValue(attrName: string, filterList: FiltersResponse): string;
57
58
  /**
58
- * Reverse of `resolveProductAttrValue`: maps a cell's `product-attr` value back to its
59
- * `customAttr:<name>` composition key. The resolver only ever emits `<name>` (default
60
- * attribute) or `product_attribute.<name>` (custom product attribute), so stripping the
61
- * prefix recovers the attribute name without needing the store's filter list.
59
+ * Maps a cell's `product-attr` value to its composition key. The value is the
60
+ * canonical identity, so it is carried into the key verbatim — stripping the
61
+ * `product_attribute.` prefix here would collapse a default and a same-named
62
+ * custom attribute onto one key.
62
63
  */
63
64
  export declare function toCustomCompositionKey(productAttrValue: string): string;
64
65
  /**
@@ -184,7 +185,7 @@ export interface RenderOptions {
184
185
  * `RenderOptions`. Single source for both the stacked per-cell options and the two inline
185
186
  * (price + old-price) option sets, so style capture → re-bake stays consistent across layouts.
186
187
  */
187
- export declare function buildCellOptions(attrType: string, renderOptions: RenderOptions): CellRenderOptions;
188
+ export declare function buildCellOptions(attrType: string, renderOptions: RenderOptions, composition?: string[]): CellRenderOptions;
188
189
  /**
189
190
  * Options for prepareProductRows unified function
190
191
  */
@@ -0,0 +1,47 @@
1
+ import type { FiltersResponse } from '@@/Types/recommendation';
2
+ import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
3
+ /**
4
+ * Canonical identity of a card-composition custom attribute is its `product-attr`
5
+ * value — `brand` for a default attribute, `product_attribute.brand` for a custom
6
+ * one. A partner can own both under the same name, and only this form tells them
7
+ * apart. (SD-147101)
8
+ */
9
+ type FilterEntry = FiltersResponse[string];
10
+ export declare function isDefaultProductAttr(productAttrValue: string): boolean;
11
+ export declare function bareAttributeName(productAttrValue: string): string;
12
+ export declare function compositionKeyToProductAttr(compositionKey: string): string;
13
+ export declare function productAttrToCompositionKey(productAttrValue: string): string;
14
+ /**
15
+ * Canonical identity of a filter entry. Reads the type off the entry itself, so
16
+ * two same-named filters never collapse onto one value.
17
+ */
18
+ export declare function filterToProductAttrValue(filter: FilterEntry): string;
19
+ /**
20
+ * Filter entry behind a bare attribute name. A bare name is the canonical form of a
21
+ * DEFAULT attribute, so the default wins a name collision; the custom entry is only
22
+ * reached when it is the sole match (a genuinely legacy key). (SD-147101)
23
+ */
24
+ export declare function findFilterByBareName(bareName: string, filterList: FiltersResponse): FilterEntry | undefined;
25
+ export declare function normalizeCompositionKeys(composition: string[], blockNode?: ImmutableHtmlNode | null, filterList?: FiltersResponse): string[];
26
+ /**
27
+ * `data-custom-attributes` upgraded to canonical values. Index-preserving: the
28
+ * Nth entry must keep mapping to the Nth `customAttr:*` composition key.
29
+ */
30
+ export declare function normalizeCustomAttrValues(values: string[], blockNode?: ImmutableHtmlNode | null, filterList?: FiltersResponse): string[];
31
+ /**
32
+ * Composition key of an attribute row. Custom rows are keyed by their `product-attr`
33
+ * value, which stays correct on rows still tagged with a legacy bare name.
34
+ */
35
+ export declare function resolveRowCompositionKey(row: ImmutableHtmlNode): string | null;
36
+ /**
37
+ * Finds an attribute row by composition key, tolerating rows still tagged with the
38
+ * legacy bare-name key. Custom candidates are validated against their `product-attr`,
39
+ * so a legacy custom `brand` row is never mistaken for the default `brand`.
40
+ */
41
+ export declare function findAttributeRow(container: ImmutableHtmlNode, compositionKey: string): ImmutableHtmlNode | null;
42
+ /**
43
+ * Rewrites a copied row's legacy `data-attribute-type` to the canonical key so the
44
+ * DOM converges on the user's next composition change (no write on mere open).
45
+ */
46
+ export declare function rewriteLegacyRowKeyHtml(rowHtml: string, compositionKey: string): string;
47
+ export {};
@@ -34,6 +34,8 @@ interface SelectProps {
34
34
  placeholder: string;
35
35
  options: TextValueObject[];
36
36
  className?: string;
37
+ /** Adds the picker's built-in search box. Worth it once the list gets long. */
38
+ searchable?: boolean;
37
39
  }
38
40
  interface CounterProps {
39
41
  name: string;
@@ -105,7 +107,7 @@ export declare abstract class CommonControl extends Control {
105
107
  text: string;
106
108
  value: string;
107
109
  }): string;
108
- _GuSelect({ name, placeholder, options, className }: SelectProps): string;
110
+ _GuSelect({ name, placeholder, options, className, searchable, }: SelectProps): string;
109
111
  _GuTextInput({ name, placeholder, className, disabled }: TextInputProps): string;
110
112
  _GuCounter({ name, maxValue, minValue, step }: CounterProps): string;
111
113
  _GuRadioButtonItem({ text, value, icon }: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.15.0",
3
+ "version": "3.15.1-beta.6da4177",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",