@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.
- package/dist/composables/useHtmlValidator.js +50 -50
- package/dist/config/i18n/en/labels.json.js +7 -3
- package/dist/config/migrator/recommendation/compositionMapper.js +26 -23
- package/dist/config/migrator/recommendation/htmlBuilder.js +156 -155
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +18 -15
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +363 -322
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +8 -8
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +271 -231
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +16 -16
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +16 -16
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +120 -120
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +55 -54
- package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +89 -0
- package/dist/extensions/Blocks/common-control.js +42 -35
- package/dist/src/composables/useHtmlValidator.d.ts +3 -2
- package/dist/src/config/migrator/recommendation/types.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 +6 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +27 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +4 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +12 -11
- package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +47 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +3 -1
- 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
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
46
|
+
* Name-only type lookup — **legacy fallback only**; the canonical path uses
|
|
47
|
+
* `isDefaultProductAttr` on the `product-attr` value. A bare name is the canonical
|
|
48
|
+
* form of a default attribute, so a duplicated name resolves to the default rather
|
|
49
|
+
* than to whichever entry the filter list happens to enumerate first. (SD-147101)
|
|
49
50
|
*/
|
|
50
51
|
export declare function isDefaultAttribute(attrName: string, filterList: FiltersResponse): boolean;
|
|
51
52
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
53
|
+
* Name-only `product-attr` resolution — **legacy fallback only**, see
|
|
54
|
+
* `isDefaultAttribute`. Prefer `filterToProductAttrValue`, which reads the type off
|
|
55
|
+
* the filter entry itself.
|
|
55
56
|
*/
|
|
56
57
|
export declare function resolveProductAttrValue(attrName: string, filterList: FiltersResponse): string;
|
|
57
58
|
/**
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
59
|
+
* Maps a cell's `product-attr` value to its composition key. The value is the
|
|
60
|
+
* canonical identity, so it is carried into the key verbatim — stripping the
|
|
61
|
+
* `product_attribute.` prefix here would collapse a default and a same-named
|
|
62
|
+
* custom attribute onto one key.
|
|
62
63
|
*/
|
|
63
64
|
export declare function toCustomCompositionKey(productAttrValue: string): string;
|
|
64
65
|
/**
|
|
@@ -184,7 +185,7 @@ export interface RenderOptions {
|
|
|
184
185
|
* `RenderOptions`. Single source for both the stacked per-cell options and the two inline
|
|
185
186
|
* (price + old-price) option sets, so style capture → re-bake stays consistent across layouts.
|
|
186
187
|
*/
|
|
187
|
-
export declare function buildCellOptions(attrType: string, renderOptions: RenderOptions): CellRenderOptions;
|
|
188
|
+
export declare function buildCellOptions(attrType: string, renderOptions: RenderOptions, composition?: string[]): CellRenderOptions;
|
|
188
189
|
/**
|
|
189
190
|
* Options for prepareProductRows unified function
|
|
190
191
|
*/
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { FiltersResponse } from '@@/Types/recommendation';
|
|
2
|
+
import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
3
|
+
/**
|
|
4
|
+
* Canonical identity of a card-composition custom attribute is its `product-attr`
|
|
5
|
+
* value — `brand` for a default attribute, `product_attribute.brand` for a custom
|
|
6
|
+
* one. A partner can own both under the same name, and only this form tells them
|
|
7
|
+
* apart. (SD-147101)
|
|
8
|
+
*/
|
|
9
|
+
type FilterEntry = FiltersResponse[string];
|
|
10
|
+
export declare function isDefaultProductAttr(productAttrValue: string): boolean;
|
|
11
|
+
export declare function bareAttributeName(productAttrValue: string): string;
|
|
12
|
+
export declare function compositionKeyToProductAttr(compositionKey: string): string;
|
|
13
|
+
export declare function productAttrToCompositionKey(productAttrValue: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Canonical identity of a filter entry. Reads the type off the entry itself, so
|
|
16
|
+
* two same-named filters never collapse onto one value.
|
|
17
|
+
*/
|
|
18
|
+
export declare function filterToProductAttrValue(filter: FilterEntry): string;
|
|
19
|
+
/**
|
|
20
|
+
* Filter entry behind a bare attribute name. A bare name is the canonical form of a
|
|
21
|
+
* DEFAULT attribute, so the default wins a name collision; the custom entry is only
|
|
22
|
+
* reached when it is the sole match (a genuinely legacy key). (SD-147101)
|
|
23
|
+
*/
|
|
24
|
+
export declare function findFilterByBareName(bareName: string, filterList: FiltersResponse): FilterEntry | undefined;
|
|
25
|
+
export declare function normalizeCompositionKeys(composition: string[], blockNode?: ImmutableHtmlNode | null, filterList?: FiltersResponse): string[];
|
|
26
|
+
/**
|
|
27
|
+
* `data-custom-attributes` upgraded to canonical values. Index-preserving: the
|
|
28
|
+
* Nth entry must keep mapping to the Nth `customAttr:*` composition key.
|
|
29
|
+
*/
|
|
30
|
+
export declare function normalizeCustomAttrValues(values: string[], blockNode?: ImmutableHtmlNode | null, filterList?: FiltersResponse): string[];
|
|
31
|
+
/**
|
|
32
|
+
* Composition key of an attribute row. Custom rows are keyed by their `product-attr`
|
|
33
|
+
* value, which stays correct on rows still tagged with a legacy bare name.
|
|
34
|
+
*/
|
|
35
|
+
export declare function resolveRowCompositionKey(row: ImmutableHtmlNode): string | null;
|
|
36
|
+
/**
|
|
37
|
+
* Finds an attribute row by composition key, tolerating rows still tagged with the
|
|
38
|
+
* legacy bare-name key. Custom candidates are validated against their `product-attr`,
|
|
39
|
+
* so a legacy custom `brand` row is never mistaken for the default `brand`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function findAttributeRow(container: ImmutableHtmlNode, compositionKey: string): ImmutableHtmlNode | null;
|
|
42
|
+
/**
|
|
43
|
+
* Rewrites a copied row's legacy `data-attribute-type` to the canonical key so the
|
|
44
|
+
* DOM converges on the user's next composition change (no write on mere open).
|
|
45
|
+
*/
|
|
46
|
+
export declare function rewriteLegacyRowKeyHtml(rowHtml: string, compositionKey: string): string;
|
|
47
|
+
export {};
|
|
@@ -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.
|
|
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",
|