@useinsider/guido 3.17.0-beta.8dc8fbb → 3.17.0-beta.a0d17c2
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 +1 -0
- package/dist/@types/config/schemas.js +7 -6
- package/dist/components/Guido.vue.js +10 -10
- package/dist/components/Guido.vue2.js +82 -76
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +21 -0
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +106 -0
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.js +17 -0
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +57 -0
- package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.js +19 -0
- package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue2.js +63 -0
- package/dist/composables/useCustomInterfaceAppearance.js +52 -38
- package/dist/composables/useRecommendation.js +41 -34
- package/dist/composables/useStripo.js +14 -14
- package/dist/config/i18n/en/labels.json.js +1 -1
- package/dist/config/migrator/index.js +9 -8
- package/dist/config/migrator/recommendation/compositionMapper.js +20 -20
- package/dist/config/migrator/recommendation/extractors.js +29 -24
- package/dist/config/migrator/recommendation/htmlBuilder.js +116 -130
- package/dist/config/migrator/recommendation/settingsMapper.js +17 -17
- package/dist/config/migrator/recommendationMigrator.js +31 -25
- package/dist/config/migrator/recommendationTitleMigrator.js +119 -0
- package/dist/enums/academy.js +2 -1
- package/dist/enums/date.js +5 -3
- package/dist/enums/extensions/recommendationBlock.js +3 -1
- package/dist/extensions/Blocks/Recommendation/block.js +26 -21
- package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +29 -27
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +34 -28
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +309 -236
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +246 -186
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +124 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +1 -0
- package/dist/extensions/Blocks/Recommendation/controls/title/index.js +44 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +31 -29
- package/dist/extensions/Blocks/Recommendation/services/configService.js +54 -36
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +23 -4
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +175 -79
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -3
- package/dist/extensions/Blocks/Recommendation/templates/titleRows.js +33 -0
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +85 -107
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +22 -0
- package/dist/extensions/Blocks/common-control.js +22 -19
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +69 -30
- package/dist/src/@types/config/schemas.d.ts +2 -0
- package/dist/src/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.d.ts +3 -0
- package/dist/src/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.d.ts +2 -0
- package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.d.ts +15 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useRecommendation.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +8 -0
- package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +5 -0
- package/dist/src/enums/academy.d.ts +1 -0
- package/dist/src/enums/date.d.ts +1 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +3 -6
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +2 -2
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +11 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +44 -8
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +16 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +86 -0
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +12 -1
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +176 -10
- package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +31 -0
- package/dist/src/extensions/Blocks/common-control.d.ts +4 -1
- package/dist/src/mock/api/recommendation-strategies.d.ts +2 -0
- package/dist/src/services/recommendationApi.d.ts +4 -1
- package/dist/src/stores/config.d.ts +18 -0
- package/dist/src/stores/save-as-template.d.ts +4 -3
- package/dist/src/utils/genericUtil.d.ts +5 -0
- package/dist/static/assets/icons/line-change.svg.js +5 -0
- package/dist/static/assets/icons/line-delete.svg.js +5 -0
- package/dist/static/assets/icons/line-plus.svg.js +5 -0
- package/dist/static/styles/components/recommendation-strategy.css.js +155 -0
- package/dist/static/styles/customEditorStyle.css.js +3 -1
- package/dist/utils/dateUtil.js +23 -10
- package/dist/utils/genericUtil.js +57 -59
- package/dist/utils/templatePreparation.js +35 -34
- package/package.json +2 -1
- package/dist/src/utils/liquidDynamicContent.d.ts +0 -20
- package/dist/utils/liquidDynamicContent.js +0 -15
|
@@ -99,6 +99,7 @@ export declare const useConfig: () => {
|
|
|
99
99
|
autosave: boolean;
|
|
100
100
|
allowlistEnabled: boolean;
|
|
101
101
|
linkTrackingIds: boolean;
|
|
102
|
+
reusableRecommendationStrategy: boolean;
|
|
102
103
|
};
|
|
103
104
|
blocks: {
|
|
104
105
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -233,6 +234,7 @@ export declare const useConfig: () => {
|
|
|
233
234
|
autosave: boolean;
|
|
234
235
|
allowlistEnabled: boolean;
|
|
235
236
|
linkTrackingIds: boolean;
|
|
237
|
+
reusableRecommendationStrategy: boolean;
|
|
236
238
|
} | null>;
|
|
237
239
|
blocks: import("vue").ComputedRef<{
|
|
238
240
|
excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
|
|
@@ -18,6 +18,7 @@ export declare const useRecommendation: () => {
|
|
|
18
18
|
getRecommendationCampaignData: (id: string) => CampaignData;
|
|
19
19
|
buildCampaignUrl: (campaignId: string, overrides?: {
|
|
20
20
|
strategy: string;
|
|
21
|
+
strategyId: string;
|
|
21
22
|
language: string;
|
|
22
23
|
currencyCode: string;
|
|
23
24
|
size: string;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
export declare function extractTitleText(block: Element): string;
|
|
2
|
+
/**
|
|
3
|
+
* Fallback for legacy configs that carry no `p_recommendation_title` variable:
|
|
4
|
+
* the rendered HTML decides. A missing or `display: none` title container means
|
|
5
|
+
* the user never saw a title, so the migrated block keeps it toggled off.
|
|
6
|
+
* @param block - The legacy recommendation block element
|
|
7
|
+
* @returns True when the legacy block renders a visible title
|
|
8
|
+
*/
|
|
9
|
+
export declare function hasVisibleTitle(block: Element): boolean;
|
|
2
10
|
/**
|
|
3
11
|
* Card background lives on either the block (`bgcolor`/`style`) or per-card
|
|
4
12
|
* cells (`.product-card`). Returns empty string when no background is set —
|
|
@@ -8,5 +8,6 @@ export declare const ACADEMY_LINKS: {
|
|
|
8
8
|
readonly EMAIL_EDITOR: "https://academy.insiderone.com/docs/email-drag-and-drop-editor";
|
|
9
9
|
readonly GLOBAL_UNSUBSCRIBE: "https://academy.insiderone.com/docs/global-unsubscribe-preference-center";
|
|
10
10
|
readonly AMP_FOR_EMAILS: "https://academy.insiderone.com/docs/amp-for-emails";
|
|
11
|
+
readonly EMAIL_RECOMMENDATION_BLOCK: "https://academy.insiderone.com/docs/new-editor-email-recommendation-block";
|
|
11
12
|
};
|
|
12
13
|
export type AcademyLinkKey = keyof typeof ACADEMY_LINKS;
|
package/dist/src/enums/date.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import type { RecommendationFeedItem } from '@@/Types/recommendation';
|
|
|
3
3
|
export declare const URLS: {
|
|
4
4
|
RECOMMENDATION_API_URL: string;
|
|
5
5
|
PRODUCT_ATTRIBUTES_PATH: string;
|
|
6
|
+
RECOMMENDATION_STRATEGIES_PATH: string;
|
|
7
|
+
RECOMMENDATION_STRATEGIES_PANEL_PATH: string;
|
|
6
8
|
};
|
|
7
9
|
export declare const QUERY_PARAMS: {
|
|
8
10
|
CLIENT_ID: string;
|
|
@@ -10,5 +10,6 @@ export declare enum RecommendationBlockId {
|
|
|
10
10
|
OMNIBUS_PRICE = "recommendation-block-omnibus-price",
|
|
11
11
|
OMNIBUS_DISCOUNT = "recommendation-block-omnibus-discount",
|
|
12
12
|
IMAGE = "recommendation-block-image",
|
|
13
|
-
CUSTOM_ATTRIBUTE = "recommendation-block-custom-attribute"
|
|
13
|
+
CUSTOM_ATTRIBUTE = "recommendation-block-custom-attribute",
|
|
14
|
+
TITLE = "recommendation-block-title"
|
|
14
15
|
}
|
|
@@ -65,5 +65,12 @@ export declare enum RecommendationControlId {
|
|
|
65
65
|
CUSTOM_ATTR_SIZE = "recommendation-block-custom-attr-size-control",
|
|
66
66
|
CUSTOM_ATTR_STYLE = "recommendation-block-custom-attr-style-control",
|
|
67
67
|
CUSTOM_ATTR_TEXT_TRIM = "recommendation-block-custom-attr-text-trim-control",
|
|
68
|
+
TITLE_ALIGN = "recommendation-block-title-align-control",
|
|
69
|
+
TITLE_BACKGROUND = "recommendation-block-title-background-control",
|
|
70
|
+
TITLE_COLOR = "recommendation-block-title-color-control",
|
|
71
|
+
TITLE_FONT_FAMILY = "recommendation-block-title-font-family-control",
|
|
72
|
+
TITLE_PADDINGS = "recommendation-block-title-paddings-control",
|
|
73
|
+
TITLE_SIZE = "recommendation-block-title-size-control",
|
|
74
|
+
TITLE_STYLE = "recommendation-block-title-style-control",
|
|
68
75
|
SYNC_INFO_MESSAGE = "recommendation-block-sync-info-message"
|
|
69
76
|
}
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
* - Merging partial updates with existing config
|
|
9
9
|
*/
|
|
10
10
|
import type { RecommendationNodeConfig, CurrencyConfig, OmnibusTextConfig } from '../types/nodeConfig';
|
|
11
|
+
export declare const PRE_RRS_CONFIG_VERSION = 1;
|
|
12
|
+
export declare const CURRENT_CONFIG_VERSION = 2;
|
|
11
13
|
/**
|
|
12
14
|
* Default currency configuration
|
|
13
15
|
* Uses USD as the base currency with standard formatting
|
|
@@ -32,6 +34,7 @@ export declare const DEFAULT_COMPOSITION: string[];
|
|
|
32
34
|
/**
|
|
33
35
|
* Default visibility settings for card elements
|
|
34
36
|
* Omnibus elements are hidden by default (not all regions require them)
|
|
37
|
+
* The block-level title is visible on a fresh drop.
|
|
35
38
|
*/
|
|
36
39
|
export declare const DEFAULT_VISIBILITY: Record<string, boolean>;
|
|
37
40
|
/**
|
|
@@ -47,9 +50,3 @@ export declare const DEFAULT_NODE_CONFIG: RecommendationNodeConfig;
|
|
|
47
50
|
* View Together and Purchase Together algorithms are disabled because these require product id.
|
|
48
51
|
*/
|
|
49
52
|
export declare const EXCLUDED_ALGORITHM_IDS: number[];
|
|
50
|
-
/**
|
|
51
|
-
* Current configuration version
|
|
52
|
-
* Increment this when making breaking changes to the schema
|
|
53
|
-
* Used for migration detection
|
|
54
|
-
*/
|
|
55
|
-
export declare const CURRENT_CONFIG_VERSION = 1;
|
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export { RecommendationBlockId } from './blockIds';
|
|
10
10
|
export { RecommendationControlId } from './controlIds';
|
|
11
|
-
export { BLOCK_ROOT_SELECTOR, CONTAINER_SELECTOR, DESKTOP_CONTAINER_SELECTOR, MOBILE_CONTAINER_SELECTOR, MOBILE_ROW_SELECTOR, CSS_CLASS_RECO_BUTTON, CSS_CLASS_SKIP_COMPILE, RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES, CURRENCY_ATTR, ATTR_PRODUCT_IMAGE, ATTR_PRODUCT_NAME, ATTR_PRODUCT_PRICE, ATTR_PRODUCT_OLD_PRICE, ATTR_PRODUCT_OMNIBUS_PRICE, ATTR_PRODUCT_OMNIBUS_DISCOUNT, ATTR_PRODUCT_BUTTON, ATTR_CUSTOM_PREFIX, ATTR_DATA_CARD_COMPOSITION, ATTR_DATA_CUSTOM_ATTRIBUTES, ATTR_PRODUCT_ATTR, SELECTOR_ATTRIBUTE_ROW, ATTR_DATA_ATTRIBUTE_TYPE, PRODUCT_ATTRIBUTE_PREFIX, BUILT_IN_DEFAULT_ATTRIBUTES, } from './selectors';
|
|
11
|
+
export { BLOCK_ROOT_SELECTOR, CONTAINER_SELECTOR, DESKTOP_CONTAINER_SELECTOR, MOBILE_CONTAINER_SELECTOR, MOBILE_ROW_SELECTOR, CSS_CLASS_RECO_BUTTON, CSS_CLASS_SKIP_COMPILE, RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES, CURRENCY_ATTR, ATTR_PRODUCT_IMAGE, ATTR_PRODUCT_NAME, ATTR_PRODUCT_PRICE, ATTR_PRODUCT_OLD_PRICE, ATTR_PRODUCT_OMNIBUS_PRICE, ATTR_PRODUCT_OMNIBUS_DISCOUNT, ATTR_PRODUCT_BUTTON, ATTR_RECOMMENDATION_TITLE, SELECTOR_TITLE_CELL, ATTR_CUSTOM_PREFIX, ATTR_DATA_CARD_COMPOSITION, ATTR_DATA_CUSTOM_ATTRIBUTES, ATTR_PRODUCT_ATTR, CSS_CLASS_ATTRIBUTE_ROW, CSS_CLASS_SPACER, SELECTOR_ATTRIBUTE_ROW, ATTR_DATA_ATTRIBUTE_TYPE, ATTR_DATA_VISIBILITY, PRODUCT_ATTRIBUTE_PREFIX, BUILT_IN_DEFAULT_ATTRIBUTES, } from './selectors';
|
|
12
12
|
export { LAYOUT_VALUES, LAYOUT_OPTIONS, DEFAULT_PRODUCTS_PER_ROW, DEFAULT_CARDS_IN_ROW, DEFAULT_MOBILE_CARDS_IN_ROW, MAX_PRODUCT_COUNT, MIN_PRODUCT_COUNT, MAX_PRODUCTS_PER_ROW, MIN_PRODUCTS_PER_ROW, MAX_MOBILE_PRODUCTS_PER_ROW, MIN_MOBILE_PRODUCTS_PER_ROW, DEFAULT_COLUMN_SPACING, DEFAULT_ROW_SPACING, DEFAULT_MOBILE_COLUMN_SPACING, DEFAULT_MOBILE_ROW_SPACING, MIN_SPACING, MAX_SPACING, SPACING_STEP, } from './layout';
|
|
13
|
-
export { DEFAULT_NODE_CONFIG, DEFAULT_CURRENCY, DEFAULT_COMPOSITION, DEFAULT_VISIBILITY, CURRENT_CONFIG_VERSION, EXCLUDED_ALGORITHM_IDS, } from './defaultConfig';
|
|
13
|
+
export { DEFAULT_NODE_CONFIG, DEFAULT_CURRENCY, DEFAULT_COMPOSITION, DEFAULT_VISIBILITY, CURRENT_CONFIG_VERSION, PRE_RRS_CONFIG_VERSION, EXCLUDED_ALGORITHM_IDS, } from './defaultConfig';
|
|
@@ -58,6 +58,10 @@ export declare const ATTR_PRODUCT_OLD_PRICE = "productOldPrice";
|
|
|
58
58
|
export declare const ATTR_PRODUCT_OMNIBUS_PRICE = "productOmnibusPrice";
|
|
59
59
|
export declare const ATTR_PRODUCT_OMNIBUS_DISCOUNT = "productOmnibusDiscount";
|
|
60
60
|
export declare const ATTR_PRODUCT_BUTTON = "productButton";
|
|
61
|
+
export declare const ATTR_RECOMMENDATION_TITLE = "recommendationTitle";
|
|
62
|
+
export declare const CSS_CLASS_TITLE_CELL = "ins-recommendation-title";
|
|
63
|
+
/** Title cell — the only `esd-block-text` living outside the product containers. */
|
|
64
|
+
export declare const SELECTOR_TITLE_CELL = ".ins-recommendation-title";
|
|
61
65
|
/**
|
|
62
66
|
* Custom attribute constants
|
|
63
67
|
* Used for dynamically added product attributes in Card Composition
|
|
@@ -70,10 +74,16 @@ export declare const ATTR_DATA_CUSTOM_ATTRIBUTES = "data-custom-attributes";
|
|
|
70
74
|
export declare const ATTR_DATA_CARD_COMPOSITION = "data-card-composition";
|
|
71
75
|
/** HTML attribute on <td> elements identifying the product attribute for compiler template variable generation */
|
|
72
76
|
export declare const ATTR_PRODUCT_ATTR = "product-attr";
|
|
77
|
+
/** Class every composition attribute row carries — the visibility toggle and the compiler both key on it */
|
|
78
|
+
export declare const CSS_CLASS_ATTRIBUTE_ROW = "recommendation-attribute-row";
|
|
73
79
|
/** Row wrapper of one composition entry inside a product card */
|
|
74
80
|
export declare const SELECTOR_ATTRIBUTE_ROW = ".recommendation-attribute-row";
|
|
75
81
|
/** HTML attribute on an attribute row holding its composition key */
|
|
76
82
|
export declare const ATTR_DATA_ATTRIBUTE_TYPE = "data-attribute-type";
|
|
83
|
+
/** HTML attribute on an attribute row holding its visibility (`1` / `0`) */
|
|
84
|
+
export declare const ATTR_DATA_VISIBILITY = "data-visibility";
|
|
85
|
+
/** Class on the spacer cell of the row that trails a title */
|
|
86
|
+
export declare const CSS_CLASS_SPACER = "spacer";
|
|
77
87
|
/** Prefix `resolveProductAttrValue` puts on custom (non-default) product attributes in `product-attr` values */
|
|
78
88
|
export declare const PRODUCT_ATTRIBUTE_PREFIX = "product_attribute.";
|
|
79
89
|
/**
|
|
@@ -33,6 +33,8 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
33
33
|
private _normalizeComposition;
|
|
34
34
|
private _readCustomAttributesFromNode;
|
|
35
35
|
private _readVisibilityFromRows;
|
|
36
|
+
private _withTitlePresence;
|
|
37
|
+
private _hasTitle;
|
|
36
38
|
private _getDefaultVisibilities;
|
|
37
39
|
private _extractVisibilityFromRows;
|
|
38
40
|
private _parseVisibilityValue;
|
|
@@ -187,6 +189,15 @@ export declare class RecommendationCardCompositionControl extends CommonControl
|
|
|
187
189
|
*/
|
|
188
190
|
private _buildCompositionHtml;
|
|
189
191
|
private _applyVisibilityToBlock;
|
|
192
|
+
private _applyTitleVisibilityToBlock;
|
|
193
|
+
private _resolveTitleInjection;
|
|
194
|
+
private _readTitleHtml;
|
|
195
|
+
private _findTitleRows;
|
|
196
|
+
private _findTitleRowsByClass;
|
|
197
|
+
private _isSpacerRow;
|
|
198
|
+
private _findTitleContainerBody;
|
|
199
|
+
private _readInnerHtml;
|
|
200
|
+
private _defaultTitleParagraph;
|
|
190
201
|
/**
|
|
191
202
|
* Finds the composition array index for the Nth custom attribute (0-based).
|
|
192
203
|
* Scans left-to-right, counting only entries with the custom prefix.
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
export { RecommendationBlockControl, CONTROL_BLOCK_ID, AlgorithmControl, ALGORITHM_CONTROL_ID, LocaleControl, LOCALE_CONTROL_ID, CurrencyControl, CURRENCY_CONTROL_ID, ProductCountControl, PRODUCT_COUNT_CONTROL_ID, ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID, FiltersControl, FILTERS_CONTROL_ID, ShuffleControl, SHUFFLE_CONTROL_ID, LayoutOrientationControl, LAYOUT_ORIENTATION_CONTROL_ID, PricePlacementControl, PRICE_PLACEMENT_CONTROL_ID, } from './main';
|
|
13
13
|
export * from './main/utils';
|
|
14
|
+
export { TitleControls } from './title';
|
|
14
15
|
export { NameControls } from './name';
|
|
15
16
|
export { PriceControls } from './price';
|
|
16
17
|
export { OldPriceControls } from './oldPrice';
|
|
@@ -9,8 +9,9 @@ import { PricePlacementControl, PRICE_PLACEMENT_CONTROL_ID } from './pricePlacem
|
|
|
9
9
|
import { ProductCountControl, PRODUCT_COUNT_CONTROL_ID } from './productCount';
|
|
10
10
|
import { ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID } from './productLayout';
|
|
11
11
|
import { ShuffleControl, SHUFFLE_CONTROL_ID } from './shuffle';
|
|
12
|
+
import { StrategyControl, STRATEGY_CONTROL_ID } from './strategy';
|
|
12
13
|
export declare const CONTROL_BLOCK_ID = "ui-elements-recommendation-block";
|
|
13
|
-
export { AlgorithmControl, ALGORITHM_CONTROL_ID, LocaleControl, LOCALE_CONTROL_ID, CurrencyControl, CURRENCY_CONTROL_ID, ProductCountControl, PRODUCT_COUNT_CONTROL_ID, ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID, FiltersControl, FILTERS_CONTROL_ID, ShuffleControl, SHUFFLE_CONTROL_ID, LayoutOrientationControl, LAYOUT_ORIENTATION_CONTROL_ID, PricePlacementControl, PRICE_PLACEMENT_CONTROL_ID, };
|
|
14
|
+
export { AlgorithmControl, ALGORITHM_CONTROL_ID, LocaleControl, LOCALE_CONTROL_ID, CurrencyControl, CURRENCY_CONTROL_ID, ProductCountControl, PRODUCT_COUNT_CONTROL_ID, ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID, FiltersControl, FILTERS_CONTROL_ID, ShuffleControl, SHUFFLE_CONTROL_ID, LayoutOrientationControl, LAYOUT_ORIENTATION_CONTROL_ID, PricePlacementControl, PRICE_PLACEMENT_CONTROL_ID, StrategyControl, STRATEGY_CONTROL_ID, };
|
|
14
15
|
export * from './utils';
|
|
15
16
|
/**
|
|
16
17
|
* Main recommendation block control that composes all sub-controls
|
|
@@ -19,7 +20,9 @@ export * from './utils';
|
|
|
19
20
|
export declare class RecommendationBlockControl extends CommonControl {
|
|
20
21
|
private store;
|
|
21
22
|
private storeUnsubscription;
|
|
22
|
-
private
|
|
23
|
+
private syncedConfigs;
|
|
24
|
+
private pendingNodeConfigWrite;
|
|
25
|
+
private pendingConfigFlushTimer;
|
|
23
26
|
private algorithmControl;
|
|
24
27
|
private localeControl;
|
|
25
28
|
private currencyControl;
|
|
@@ -29,8 +32,12 @@ export declare class RecommendationBlockControl extends CommonControl {
|
|
|
29
32
|
private shuffleControl;
|
|
30
33
|
private pricePlacementControl;
|
|
31
34
|
private layoutOrientationControl;
|
|
35
|
+
private strategyControl;
|
|
36
|
+
private rrsEnabled;
|
|
32
37
|
getId(): string;
|
|
38
|
+
private get _subControls();
|
|
33
39
|
getTemplate(): string;
|
|
40
|
+
private _showControlsForBlock;
|
|
34
41
|
onRender(): Promise<void>;
|
|
35
42
|
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
36
43
|
onDestroy(): void;
|
|
@@ -42,7 +49,6 @@ export declare class RecommendationBlockControl extends CommonControl {
|
|
|
42
49
|
/**
|
|
43
50
|
* Syncs persisted node config into the Pinia store's block state.
|
|
44
51
|
*
|
|
45
|
-
* setCurrentBlock() creates a default entry (USD, en_US, mostPopular).
|
|
46
52
|
* For saved templates, the real config lives in the node (e.g., TRY, tr_TR).
|
|
47
53
|
* This method reads it and patches the store so fetchRecommendationProducts()
|
|
48
54
|
* uses the correct values.
|
|
@@ -50,6 +56,41 @@ export declare class RecommendationBlockControl extends CommonControl {
|
|
|
50
56
|
* Uses triggerRefetch: false because the fetch hasn't happened yet —
|
|
51
57
|
* values are being prepared for the upcoming initial fetch.
|
|
52
58
|
*/
|
|
59
|
+
/**
|
|
60
|
+
* Re-syncs the store when the node config moved since we last read it.
|
|
61
|
+
*
|
|
62
|
+
* Undo/redo, the code editor and version-history restore rewrite the node
|
|
63
|
+
* config behind the store's back — Stripo exposes no undo signal, so a
|
|
64
|
+
* fingerprint diff on this hook is the only way to notice (SD-149105).
|
|
65
|
+
* An unchanged fingerprint means the move came from us, so runtime store
|
|
66
|
+
* edits are never clobbered (SD-141049).
|
|
67
|
+
*/
|
|
68
|
+
private _syncNodeConfigIfChanged;
|
|
69
|
+
private _capturePendingNodeConfigWrite;
|
|
70
|
+
/**
|
|
71
|
+
* Accumulates the pending write into `documentModifier` without applying, so the
|
|
72
|
+
* caller's apply() commits config and re-render as ONE undo entry.
|
|
73
|
+
*
|
|
74
|
+
* Deliberately does not consume the pending record: the product helpers call
|
|
75
|
+
* apply() only when they actually changed something, so this batch may never be
|
|
76
|
+
* committed and the flush has to stay able to write it standalone.
|
|
77
|
+
* @param documentModifier - The batch to accumulate into
|
|
78
|
+
* @returns Whether anything was staged
|
|
79
|
+
*/
|
|
80
|
+
private _stagePendingNodeConfig;
|
|
81
|
+
/**
|
|
82
|
+
* Arms the guaranteed fallback write, once the product fetch has settled. The
|
|
83
|
+
* delay only has to outlast the re-render debounce that fetch triggers — firing
|
|
84
|
+
* earlier writes the config on its own and the undo entry splits in two again.
|
|
85
|
+
*/
|
|
86
|
+
private _scheduleConfigFlush;
|
|
87
|
+
private _clearConfigFlush;
|
|
88
|
+
/**
|
|
89
|
+
* Writes the deferred change standalone when the batch it was staged into never
|
|
90
|
+
* committed. Always targets the LIVE node — the captured one is an immutable
|
|
91
|
+
* snapshot the intervening re-render staled, and saveConfig swallows that failure.
|
|
92
|
+
*/
|
|
93
|
+
private _flushPendingNodeConfig;
|
|
53
94
|
private _syncNodeConfigToStore;
|
|
54
95
|
/**
|
|
55
96
|
* Fetches initial data for a block in three phases:
|
|
@@ -106,9 +147,4 @@ export declare class RecommendationBlockControl extends CommonControl {
|
|
|
106
147
|
* We skip that tick and update tracking references instead.
|
|
107
148
|
*/
|
|
108
149
|
private _listenStateUpdates;
|
|
109
|
-
/**
|
|
110
|
-
* Persists the current filter state from Pinia store to the Stripo node config.
|
|
111
|
-
* This ensures filters survive template save/reload cycles.
|
|
112
|
-
*/
|
|
113
|
-
private _persistFiltersToNodeConfig;
|
|
114
150
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CommonControl } from '../../../common-control';
|
|
2
|
+
export declare const STRATEGY_CONTROL_ID = "recommendation-strategy-control";
|
|
3
|
+
export declare class StrategyControl extends CommonControl {
|
|
4
|
+
private store;
|
|
5
|
+
private storeUnsubscription;
|
|
6
|
+
private listeners;
|
|
7
|
+
private lastPaintedState;
|
|
8
|
+
getId(): string;
|
|
9
|
+
getTemplate(): string;
|
|
10
|
+
private _strategyAction;
|
|
11
|
+
onRender(): void;
|
|
12
|
+
onDestroy(): void;
|
|
13
|
+
private _teardown;
|
|
14
|
+
private _setupButtonListeners;
|
|
15
|
+
private _renderState;
|
|
16
|
+
}
|
|
@@ -70,6 +70,7 @@ export interface RegenerateProductRowsOptions {
|
|
|
70
70
|
/** Optional: pass composition directly to avoid stale DOM reads after setAttribute */
|
|
71
71
|
composition?: string[];
|
|
72
72
|
}
|
|
73
|
+
export declare function getMainContainerTbody(currentNode: ImmutableHtmlNode): ImmutableHtmlNode | null;
|
|
73
74
|
/**
|
|
74
75
|
* Regenerates only the mobile product container rows and commits in a single apply().
|
|
75
76
|
* Standalone entry point for callers that change mobile-only settings
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export declare const TitleControls: {
|
|
2
|
+
readonly align: {
|
|
3
|
+
new (): {
|
|
4
|
+
getId(): string;
|
|
5
|
+
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
6
|
+
getParentControlId(): string;
|
|
7
|
+
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
8
|
+
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
9
|
+
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
10
|
+
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
11
|
+
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
readonly color: {
|
|
15
|
+
new (): {
|
|
16
|
+
getId(): string;
|
|
17
|
+
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
18
|
+
getParentControlId(): string;
|
|
19
|
+
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
20
|
+
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
21
|
+
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
22
|
+
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
23
|
+
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
readonly size: {
|
|
27
|
+
new (): {
|
|
28
|
+
getId(): string;
|
|
29
|
+
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
30
|
+
getParentControlId(): string;
|
|
31
|
+
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
32
|
+
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
33
|
+
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
34
|
+
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
35
|
+
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
readonly style: {
|
|
39
|
+
new (): {
|
|
40
|
+
getId(): string;
|
|
41
|
+
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
42
|
+
getParentControlId(): string;
|
|
43
|
+
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
44
|
+
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
45
|
+
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
46
|
+
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
47
|
+
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
readonly fontFamily: {
|
|
51
|
+
new (): {
|
|
52
|
+
getId(): string;
|
|
53
|
+
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
54
|
+
getParentControlId(): string;
|
|
55
|
+
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
56
|
+
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
57
|
+
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
58
|
+
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
59
|
+
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
readonly background: {
|
|
63
|
+
new (): {
|
|
64
|
+
getId(): string;
|
|
65
|
+
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
66
|
+
getAdditionalModifications(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
67
|
+
getParentControlId(): string;
|
|
68
|
+
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
69
|
+
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
70
|
+
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
71
|
+
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
readonly paddings: {
|
|
75
|
+
new (): {
|
|
76
|
+
getId(): string;
|
|
77
|
+
getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
|
|
78
|
+
getParentControlId(): string;
|
|
79
|
+
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
80
|
+
getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
|
|
81
|
+
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
82
|
+
getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
83
|
+
isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
};
|
|
@@ -25,7 +25,7 @@ import { ModificationDescription } from '@stripoinc/ui-editor-extensions';
|
|
|
25
25
|
* Stripo Extension API interface for document modifications
|
|
26
26
|
* Extracted to allow type-safe usage without importing full Stripo types
|
|
27
27
|
*/
|
|
28
|
-
interface DocumentModifier {
|
|
28
|
+
export interface DocumentModifier {
|
|
29
29
|
modifyHtml: (node: ImmutableHtmlNode) => {
|
|
30
30
|
setNodeConfig: (config: Record<string, unknown>) => DocumentModifier;
|
|
31
31
|
setAttribute: (name: string, value: string) => DocumentModifier;
|
|
@@ -90,6 +90,17 @@ export declare class RecommendationConfigService {
|
|
|
90
90
|
* @returns The new complete configuration
|
|
91
91
|
*/
|
|
92
92
|
static updateConfig(api: DocumentModifierApi, node: ImmutableHtmlNode, updates: PartialNodeConfig, description: string): RecommendationNodeConfig;
|
|
93
|
+
/**
|
|
94
|
+
* Accumulate a config update into an existing modifier batch, WITHOUT applying.
|
|
95
|
+
*
|
|
96
|
+
* The caller owns the apply(), so the write shares one undo entry with the rest
|
|
97
|
+
* of that batch — a change whose visible result only lands after an async product
|
|
98
|
+
* fetch would otherwise cost the user two undo presses (SD-149105).
|
|
99
|
+
* @param documentModifier - The batch to accumulate into (caller applies)
|
|
100
|
+
* @param node - The immutable HTML node to write to
|
|
101
|
+
* @param updates - Partial config with values to update
|
|
102
|
+
*/
|
|
103
|
+
static stageConfig(documentModifier: DocumentModifier, node: ImmutableHtmlNode, updates: PartialNodeConfig): void;
|
|
93
104
|
/**
|
|
94
105
|
* Initialize configuration for a new block
|
|
95
106
|
*
|