@useinsider/guido 3.17.0-beta.ddd4dde → 3.17.0-beta.e23d5cd
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 +8 -8
- package/dist/components/Guido.vue2.js +77 -73
- 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/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/config/migrator/recommendation/settingsMapper.js +17 -17
- package/dist/config/migrator/recommendationMigrator.js +5 -4
- 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/Items/block.js +49 -98
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +24 -25
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +11 -12
- package/dist/extensions/Blocks/Items/template.js +152 -153
- package/dist/extensions/Blocks/Recommendation/block.js +26 -21
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +34 -34
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +96 -95
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +238 -185
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +124 -0
- package/dist/extensions/Blocks/Recommendation/services/configService.js +54 -36
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +165 -79
- 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/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/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/Items/block.d.ts +0 -21
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +2 -6
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- 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/services/configService.d.ts +12 -1
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +150 -10
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +1 -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/utils/dateUtil.js +23 -10
- package/dist/utils/genericUtil.js +28 -27
- package/dist/utils/pairProductVariables.js +59 -60
- package/dist/utils/templatePreparation.js +35 -34
- package/package.json +2 -1
- package/dist/extensions/Blocks/Items/constants/currency.js +0 -11
- package/dist/src/extensions/Blocks/Items/constants/currency.d.ts +0 -19
|
@@ -1,52 +1,91 @@
|
|
|
1
|
-
import { useHttp as
|
|
2
|
-
import {
|
|
3
|
-
const R = (
|
|
4
|
-
(
|
|
5
|
-
attributeName:
|
|
6
|
-
attributeJs:
|
|
7
|
-
attributeType:
|
|
8
|
-
type:
|
|
9
|
-
displayName:
|
|
10
|
-
isFilterable:
|
|
11
|
-
},
|
|
1
|
+
import { useHttp as l } from "../composables/useHttp.js";
|
|
2
|
+
import { URLS as m, QUERY_PARAMS as u } from "../enums/extensions/recommendationBlock.js";
|
|
3
|
+
const y = "[sr_strategies.status][=][active]*[sr_strategies.suitable_channels][~][EMAIL]", R = (c) => c.reduce(
|
|
4
|
+
(s, r, i) => (s[i] = {
|
|
5
|
+
attributeName: r.attributeName,
|
|
6
|
+
attributeJs: r.attributeJs,
|
|
7
|
+
attributeType: r.attributeType,
|
|
8
|
+
type: r.type,
|
|
9
|
+
displayName: r.displayName,
|
|
10
|
+
isFilterable: r.isFilterable
|
|
11
|
+
}, s),
|
|
12
12
|
{}
|
|
13
|
-
),
|
|
14
|
-
const { get:
|
|
13
|
+
), _ = () => {
|
|
14
|
+
const { get: c, post: s } = l(), { get: r } = l({ headers: {} }), i = "6KcLM9TwheVB1mgK";
|
|
15
15
|
return {
|
|
16
16
|
fetchRecommendationCreateData: async () => {
|
|
17
17
|
try {
|
|
18
|
-
return (await
|
|
18
|
+
return (await c("/newsletter/recommendations/create-data")).data;
|
|
19
19
|
} catch (e) {
|
|
20
20
|
throw console.error("fetchUserModalState error:", e), e;
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
fetchRecommendationFilters: async () => {
|
|
24
24
|
try {
|
|
25
|
-
const { data: e } = await
|
|
26
|
-
|
|
27
|
-
),
|
|
28
|
-
return R(
|
|
25
|
+
const { data: e } = await c(
|
|
26
|
+
m.PRODUCT_ATTRIBUTES_PATH
|
|
27
|
+
), o = Array.isArray(e) ? e : (e == null ? void 0 : e.data) ?? [];
|
|
28
|
+
return R(o);
|
|
29
29
|
} catch (e) {
|
|
30
30
|
throw console.error("fetchRecommendationFilters error:", e), e;
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
-
fetchRecommendationProducts: async (e,
|
|
34
|
-
var
|
|
33
|
+
fetchRecommendationProducts: async (e, o) => {
|
|
34
|
+
var t;
|
|
35
35
|
try {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
console.debug("🏁 Recommendation API Query:",
|
|
40
|
-
const
|
|
41
|
-
`${
|
|
36
|
+
const n = new URLSearchParams(Object.entries(o));
|
|
37
|
+
n.set(u.CLIENT_ID, i);
|
|
38
|
+
const d = decodeURIComponent(n.toString());
|
|
39
|
+
console.debug("🏁 Recommendation API Query:", d);
|
|
40
|
+
const a = await r(
|
|
41
|
+
`${m.RECOMMENDATION_API_URL}/v2/${e}?${d}`
|
|
42
42
|
);
|
|
43
|
-
return ((
|
|
44
|
-
} catch (
|
|
45
|
-
throw console.error("fetchRecommendationProducts error:",
|
|
43
|
+
return ((t = a == null ? void 0 : a.data) == null ? void 0 : t.data) ?? [];
|
|
44
|
+
} catch (n) {
|
|
45
|
+
throw console.error("fetchRecommendationProducts error:", n), n;
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
fetchRecommendationProductsByUrl: async (e) => {
|
|
49
|
+
var o;
|
|
50
|
+
try {
|
|
51
|
+
const t = new RegExp(`[?&]${u.CLIENT_ID}=`).test(e), n = e.includes("?") ? "&" : "?", d = t ? e : `${e}${n}${u.CLIENT_ID}=${i}`, a = await r(
|
|
52
|
+
d
|
|
53
|
+
);
|
|
54
|
+
return ((o = a == null ? void 0 : a.data) == null ? void 0 : o.data) ?? [];
|
|
55
|
+
} catch (t) {
|
|
56
|
+
return console.error("fetchRecommendationProductsByUrl error:", t), [];
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
fetchRecommendationStrategies: async () => {
|
|
60
|
+
try {
|
|
61
|
+
const { data: e } = await c(
|
|
62
|
+
`${m.RECOMMENDATION_STRATEGIES_PATH}?filters=${encodeURIComponent(y)}`
|
|
63
|
+
);
|
|
64
|
+
return Array.isArray(e) ? e : (e == null ? void 0 : e.data) ?? [];
|
|
65
|
+
} catch (e) {
|
|
66
|
+
throw console.error("fetchRecommendationStrategies error:", e), e;
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
generateStrategyEndpoint: async (e, o) => {
|
|
70
|
+
try {
|
|
71
|
+
const { data: t } = await s(
|
|
72
|
+
`${m.RECOMMENDATION_STRATEGIES_PATH}/endpoint-generate`,
|
|
73
|
+
{
|
|
74
|
+
campaignId: 0,
|
|
75
|
+
pageTypes: [],
|
|
76
|
+
isPreviewer: !1,
|
|
77
|
+
strategy: e,
|
|
78
|
+
userId: "",
|
|
79
|
+
currency: o
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
return !t || typeof t != "object" || !("full_path" in t || "data" in t) ? (console.error("generateStrategyEndpoint unexpected response shape:", t), null) : "full_path" in t ? t : t.data;
|
|
83
|
+
} catch (t) {
|
|
84
|
+
return console.error("generateStrategyEndpoint error:", t), null;
|
|
46
85
|
}
|
|
47
86
|
}
|
|
48
87
|
};
|
|
49
88
|
};
|
|
50
89
|
export {
|
|
51
|
-
|
|
90
|
+
_ as useRecommendationApi
|
|
52
91
|
};
|
|
@@ -395,6 +395,7 @@ export declare const FeaturesSchema: v.ObjectSchema<{
|
|
|
395
395
|
readonly allowlistEnabled: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
396
396
|
/** Enable persistent link tracking-id assignment for the click heatmap (opt-in) */
|
|
397
397
|
readonly linkTrackingIds: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
398
|
+
readonly reusableRecommendationStrategy: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
398
399
|
}, undefined>;
|
|
399
400
|
/**
|
|
400
401
|
* Default block types available in Stripo
|
|
@@ -794,6 +795,7 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
|
794
795
|
readonly allowlistEnabled: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
795
796
|
/** Enable persistent link tracking-id assignment for the click heatmap (opt-in) */
|
|
796
797
|
readonly linkTrackingIds: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
798
|
+
readonly reusableRecommendationStrategy: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
797
799
|
}, undefined>, {}>;
|
|
798
800
|
/** Block configuration */
|
|
799
801
|
readonly blocks: v.OptionalSchema<v.ObjectSchema<{
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import '@useinsider/design-system-organisms/style';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
3
|
+
export default _default;
|
package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { RrsStrategy } from '@@/Types/recommendation';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
strategy: RrsStrategy;
|
|
4
|
+
};
|
|
5
|
+
declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_Props>>>, {}>;
|
|
6
|
+
export default _default;
|
|
7
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
8
|
+
type __VLS_TypePropsToOption<T> = {
|
|
9
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
10
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
11
|
+
} : {
|
|
12
|
+
type: import('vue').PropType<T[K]>;
|
|
13
|
+
required: true;
|
|
14
|
+
};
|
|
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;
|
|
@@ -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;
|
|
@@ -16,8 +16,6 @@ export declare const BLOCK_ID: BlockId;
|
|
|
16
16
|
* - Onboarding support
|
|
17
17
|
*/
|
|
18
18
|
export declare class ItemsBlock extends Block {
|
|
19
|
-
/** Block instances whose currency attrs were already self-healed this session (SD-147588 — undo-safe). */
|
|
20
|
-
private _currencyHealed;
|
|
21
19
|
getId(): string;
|
|
22
20
|
getIcon(): string;
|
|
23
21
|
getBlockCompositionType(): BlockCompositionType;
|
|
@@ -44,23 +42,4 @@ export declare class ItemsBlock extends Block {
|
|
|
44
42
|
* relies on this td-level fallback in pairProductVariables.
|
|
45
43
|
*/
|
|
46
44
|
private _stampProductTdDomAttributes;
|
|
47
|
-
/**
|
|
48
|
-
* Whether the currency self-heal should run for this block. Two guards (SD-147588):
|
|
49
|
-
* 1. Config is only authoritative when the symbol was actually customized — a symbol still at
|
|
50
|
-
* the 'USD' sentinel may be a migrator default, so we trust the DOM's real value over a
|
|
51
|
-
* defaulted config and never overwrite it.
|
|
52
|
-
* 2. Heal each instance at most once per session, so the auto-fix can't fight undo (undo
|
|
53
|
-
* re-drifts the attr, which would otherwise re-trigger the heal forever).
|
|
54
|
-
*/
|
|
55
|
-
private _shouldReconcileCurrency;
|
|
56
|
-
/** Marks a block instance's currency as reconciled so it is not healed again (undo-safe). */
|
|
57
|
-
private _markCurrencyHealed;
|
|
58
|
-
/**
|
|
59
|
-
* Stamps the export-read currency attrs onto every price `<p>` from config, so a template whose
|
|
60
|
-
* attrs drifted (e.g. a location toggle before the sync fix) self-heals to match the editor.
|
|
61
|
-
* Config is the source of truth — never derive from visible text. Callers gate this with
|
|
62
|
-
* `_shouldReconcileCurrency`. Returns true only when an attr actually changed, so the caller can
|
|
63
|
-
* skip an empty apply that would otherwise re-trigger onDocumentChanged and loop (SD-147588).
|
|
64
|
-
*/
|
|
65
|
-
private _reconcileCurrencyDomAttributes;
|
|
66
45
|
}
|
|
@@ -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
|
|
@@ -47,9 +49,3 @@ export declare const DEFAULT_NODE_CONFIG: RecommendationNodeConfig;
|
|
|
47
49
|
* View Together and Purchase Together algorithms are disabled because these require product id.
|
|
48
50
|
*/
|
|
49
51
|
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;
|
|
@@ -10,4 +10,4 @@ export { RecommendationBlockId } from './blockIds';
|
|
|
10
10
|
export { RecommendationControlId } from './controlIds';
|
|
11
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';
|
|
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';
|
|
@@ -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. The delay has to outlast the product fetch
|
|
83
|
+
* and the re-render debounce it triggers — firing earlier writes the config on
|
|
84
|
+
* 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
|
+
}
|
|
@@ -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
|
*
|