@useinsider/guido 3.20.1-beta.d2cba14 → 3.20.1-beta.da6efd5
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 +41 -39
- package/dist/@types/display-condition.js +25 -0
- package/dist/components/Guido.vue.js +6 -6
- package/dist/components/Guido.vue2.js +78 -76
- package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +20 -0
- package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +30 -0
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +30 -0
- package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +71 -0
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +34 -0
- package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +57 -0
- package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +17 -0
- package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +22 -0
- package/dist/composables/useBlocksConfig.js +32 -24
- package/dist/composables/useDisplayConditions.js +111 -0
- package/dist/composables/useLegacyStrategyConversion.js +16 -16
- package/dist/enums/academy.js +1 -0
- package/dist/enums/display-condition.js +12 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +296 -223
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +219 -205
- package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +19 -0
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +51 -36
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +31 -35
- package/dist/extensions/DisplayConditions/bridge.js +17 -0
- package/dist/extensions/DisplayConditions/constants.js +17 -0
- package/dist/extensions/DisplayConditions/control.js +169 -0
- package/dist/extensions/DisplayConditions/display-conditions.css.js +201 -0
- package/dist/extensions/DisplayConditions/extension.js +28 -0
- package/dist/extensions/DisplayConditions/iconsRegistry.js +20 -0
- package/dist/extensions/DisplayConditions/library.js +25 -0
- package/dist/extensions/DisplayConditions/settingsPanel.js +17 -0
- package/dist/guido.css +1 -1
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +93 -92
- package/dist/node_modules/valibot/dist/index.js +297 -261
- package/dist/services/displayConditionApi.js +39 -0
- package/dist/src/@types/config/schemas.d.ts +4 -0
- package/dist/src/@types/display-condition.d.ts +59 -0
- package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +43 -0
- package/dist/src/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.d.ts +2 -0
- package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +2 -0
- package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +2 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useDisplayConditions.d.ts +16 -0
- package/dist/src/enums/academy.d.ts +1 -0
- package/dist/src/enums/display-condition.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +18 -3
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +8 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/blockRefresh.d.ts +17 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +7 -0
- package/dist/src/extensions/DisplayConditions/bridge.d.ts +6 -0
- package/dist/src/extensions/DisplayConditions/constants.d.ts +14 -0
- package/dist/src/extensions/DisplayConditions/control.d.ts +21 -0
- package/dist/src/extensions/DisplayConditions/extension.d.ts +2 -0
- package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +4 -0
- package/dist/src/extensions/DisplayConditions/library.d.ts +8 -0
- package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +5 -0
- package/dist/src/mock/api/display-conditions.d.ts +2 -0
- package/dist/src/services/displayConditionApi.d.ts +9 -0
- package/dist/src/stores/config.d.ts +166 -0
- package/dist/src/stores/display-condition.d.ts +81 -0
- package/dist/src/utils/displayCondition.d.ts +4 -0
- package/dist/src/utils/protectTableText.d.ts +2 -0
- package/dist/stores/config.js +7 -0
- package/dist/stores/display-condition.js +28 -0
- package/dist/utils/displayCondition.js +21 -0
- package/dist/utils/pairProductVariables.js +15 -14
- package/dist/utils/protectTableText.js +22 -0
- package/package.json +1 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useHttp as c } from "../composables/useHttp.js";
|
|
2
|
+
import { SavedDisplayConditionSchema as m, DisplayConditionListResponseSchema as d } from "../@types/display-condition.js";
|
|
3
|
+
import { parse as i } from "../node_modules/valibot/dist/index.js";
|
|
4
|
+
const n = "/email-proxy/v1/display-conditions", p = 100, A = () => {
|
|
5
|
+
const { get: a, post: s, delete: r } = c();
|
|
6
|
+
return { list: async (t) => {
|
|
7
|
+
const e = new URLSearchParams({
|
|
8
|
+
page: "1",
|
|
9
|
+
limit: String(p),
|
|
10
|
+
sortColumn: "id",
|
|
11
|
+
sortDirection: "desc",
|
|
12
|
+
"filter[syntax]": t
|
|
13
|
+
}), { data: o } = await a(`${n}?${e.toString()}`);
|
|
14
|
+
return i(d, o);
|
|
15
|
+
}, create: async (t, e) => {
|
|
16
|
+
const { data: o } = await s(n, {
|
|
17
|
+
name: t.name.trim(),
|
|
18
|
+
description: t.description.trim() || null,
|
|
19
|
+
syntax: e,
|
|
20
|
+
method: "codeOnly",
|
|
21
|
+
codeBefore: t.codeBefore,
|
|
22
|
+
codeAfter: t.codeAfter
|
|
23
|
+
});
|
|
24
|
+
return i(m, o.data);
|
|
25
|
+
}, nameExists: async (t, e) => {
|
|
26
|
+
const { data: o } = await s(`${n}/name-check`, {
|
|
27
|
+
name: t.trim(),
|
|
28
|
+
syntax: e
|
|
29
|
+
});
|
|
30
|
+
return o.data.exists;
|
|
31
|
+
}, remove: async (t) => {
|
|
32
|
+
await r(`${n}/${t}`);
|
|
33
|
+
} };
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
p as DISPLAY_CONDITIONS_PAGE_LIMIT,
|
|
37
|
+
n as DISPLAY_CONDITIONS_URL,
|
|
38
|
+
A as useDisplayConditionApi
|
|
39
|
+
};
|
|
@@ -384,6 +384,8 @@ export declare const UISchema: v.ObjectSchema<{
|
|
|
384
384
|
readonly showHeader: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
|
|
385
385
|
/** Custom label for back button (if shown) */
|
|
386
386
|
readonly backButtonLabel: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
387
|
+
/** Replace Stripo's display-condition UI with the Conditions tab and create/select drawers */
|
|
388
|
+
readonly externalDisplayConditions: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
387
389
|
}, undefined>;
|
|
388
390
|
/**
|
|
389
391
|
* Features configuration - enable/disable editor features
|
|
@@ -804,6 +806,8 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
|
804
806
|
readonly showHeader: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
|
|
805
807
|
/** Custom label for back button (if shown) */
|
|
806
808
|
readonly backButtonLabel: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
809
|
+
/** Replace Stripo's display-condition UI with the Conditions tab and create/select drawers */
|
|
810
|
+
readonly externalDisplayConditions: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
807
811
|
}, undefined>, {}>;
|
|
808
812
|
/** Feature toggles */
|
|
809
813
|
readonly features: v.OptionalSchema<v.ObjectSchema<{
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as v from 'valibot';
|
|
2
|
+
export declare const DisplayConditionSyntaxSchema: v.PicklistSchema<["liquid", "pongo"], undefined>;
|
|
3
|
+
export declare const DisplayConditionMethodSchema: v.PicklistSchema<["codeOnly", "logicBuilder"], undefined>;
|
|
4
|
+
export declare const SavedDisplayConditionSchema: v.ObjectSchema<{
|
|
5
|
+
readonly id: v.NumberSchema<undefined>;
|
|
6
|
+
readonly name: v.StringSchema<undefined>;
|
|
7
|
+
readonly description: v.NullishSchema<v.StringSchema<undefined>, "">;
|
|
8
|
+
readonly syntax: v.PicklistSchema<["liquid", "pongo"], undefined>;
|
|
9
|
+
readonly method: v.PicklistSchema<["codeOnly", "logicBuilder"], undefined>;
|
|
10
|
+
readonly codeBefore: v.StringSchema<undefined>;
|
|
11
|
+
readonly codeAfter: v.NullishSchema<v.StringSchema<undefined>, "">;
|
|
12
|
+
readonly createdAt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
13
|
+
}, undefined>;
|
|
14
|
+
export declare const DisplayConditionListResponseSchema: v.ObjectSchema<{
|
|
15
|
+
readonly data: v.ArraySchema<v.ObjectSchema<{
|
|
16
|
+
readonly id: v.NumberSchema<undefined>;
|
|
17
|
+
readonly name: v.StringSchema<undefined>;
|
|
18
|
+
readonly description: v.NullishSchema<v.StringSchema<undefined>, "">;
|
|
19
|
+
readonly syntax: v.PicklistSchema<["liquid", "pongo"], undefined>;
|
|
20
|
+
readonly method: v.PicklistSchema<["codeOnly", "logicBuilder"], undefined>;
|
|
21
|
+
readonly codeBefore: v.StringSchema<undefined>;
|
|
22
|
+
readonly codeAfter: v.NullishSchema<v.StringSchema<undefined>, "">;
|
|
23
|
+
readonly createdAt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
24
|
+
}, undefined>, undefined>;
|
|
25
|
+
readonly meta: v.ObjectSchema<{
|
|
26
|
+
readonly totalCount: v.NumberSchema<undefined>;
|
|
27
|
+
readonly perPage: v.NumberSchema<undefined>;
|
|
28
|
+
readonly currentPage: v.NumberSchema<undefined>;
|
|
29
|
+
readonly lastPage: v.NumberSchema<undefined>;
|
|
30
|
+
}, undefined>;
|
|
31
|
+
}, undefined>;
|
|
32
|
+
export type DisplayConditionSyntax = v.InferOutput<typeof DisplayConditionSyntaxSchema>;
|
|
33
|
+
export type DisplayConditionMethod = v.InferOutput<typeof DisplayConditionMethodSchema>;
|
|
34
|
+
export type SavedDisplayCondition = v.InferOutput<typeof SavedDisplayConditionSchema>;
|
|
35
|
+
export type DisplayConditionListResponse = v.InferOutput<typeof DisplayConditionListResponseSchema>;
|
|
36
|
+
export interface DisplayConditionDraft {
|
|
37
|
+
name: string;
|
|
38
|
+
description: string;
|
|
39
|
+
codeBefore: string;
|
|
40
|
+
codeAfter: string;
|
|
41
|
+
}
|
|
42
|
+
export type DisplayConditionSource = 'inline' | 'saved';
|
|
43
|
+
/** Mirrors Stripo's `DisplayCondition`; kept local so Vue code does not import the Stripo package. */
|
|
44
|
+
export interface AppliedDisplayCondition {
|
|
45
|
+
id: number;
|
|
46
|
+
name: string;
|
|
47
|
+
description: string;
|
|
48
|
+
beforeScript: string;
|
|
49
|
+
afterScript: string;
|
|
50
|
+
extraData?: string;
|
|
51
|
+
}
|
|
52
|
+
export type DisplayConditionOpenMode = 'select' | 'create' | 'edit';
|
|
53
|
+
export interface DisplayConditionOpenDetail {
|
|
54
|
+
mode: DisplayConditionOpenMode;
|
|
55
|
+
current: AppliedDisplayCondition | null;
|
|
56
|
+
}
|
|
57
|
+
export interface DisplayConditionApplyDetail {
|
|
58
|
+
condition: AppliedDisplayCondition | null;
|
|
59
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
type __VLS_Props = {
|
|
2
|
+
id: string;
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
error?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
|
|
10
|
+
placeholder: string;
|
|
11
|
+
error: string;
|
|
12
|
+
disabled: boolean;
|
|
13
|
+
}>, {
|
|
14
|
+
read: () => string;
|
|
15
|
+
}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {
|
|
16
|
+
input: (value: string) => void;
|
|
17
|
+
}, string, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
|
|
18
|
+
placeholder: string;
|
|
19
|
+
error: string;
|
|
20
|
+
disabled: boolean;
|
|
21
|
+
}>>>, {
|
|
22
|
+
error: string;
|
|
23
|
+
placeholder: string;
|
|
24
|
+
disabled: boolean;
|
|
25
|
+
}>;
|
|
26
|
+
export default _default;
|
|
27
|
+
type __VLS_WithDefaults<P, D> = {
|
|
28
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
29
|
+
default: D[K];
|
|
30
|
+
}> : P[K];
|
|
31
|
+
};
|
|
32
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
33
|
+
type __VLS_TypePropsToOption<T> = {
|
|
34
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
35
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
36
|
+
} : {
|
|
37
|
+
type: import('vue').PropType<T[K]>;
|
|
38
|
+
required: true;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
type __VLS_PrettifyLocal<T> = {
|
|
42
|
+
[K in keyof T]: T[K];
|
|
43
|
+
} & {};
|
package/dist/src/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
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<{}>>, {}>;
|
|
2
|
+
export default _default;
|
package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
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<{}>>, {}>;
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
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<{}>>, {}>;
|
|
2
|
+
export default _default;
|
|
@@ -89,6 +89,7 @@ export declare const useConfig: () => {
|
|
|
89
89
|
ui: {
|
|
90
90
|
showHeader: boolean;
|
|
91
91
|
backButtonLabel?: string | undefined;
|
|
92
|
+
externalDisplayConditions: boolean;
|
|
92
93
|
};
|
|
93
94
|
features: {
|
|
94
95
|
dynamicContent: boolean;
|
|
@@ -228,6 +229,7 @@ export declare const useConfig: () => {
|
|
|
228
229
|
ui: import("vue").ComputedRef<{
|
|
229
230
|
showHeader: boolean;
|
|
230
231
|
backButtonLabel?: string | undefined;
|
|
232
|
+
externalDisplayConditions: boolean;
|
|
231
233
|
} | null>;
|
|
232
234
|
features: import("vue").ComputedRef<{
|
|
233
235
|
dynamicContent: boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { DisplayConditionDraft, DisplayConditionOpenDetail, SavedDisplayCondition } from '@@/Types/display-condition';
|
|
2
|
+
export type DraftField = keyof DisplayConditionDraft;
|
|
3
|
+
export type DraftErrors = Partial<Record<DraftField, string>>;
|
|
4
|
+
export type CreateIntent = 'inline' | 'save';
|
|
5
|
+
export declare const useDisplayConditions: () => {
|
|
6
|
+
syntax: import("vue").ComputedRef<"liquid" | "pongo">;
|
|
7
|
+
handleOpen: (detail: DisplayConditionOpenDetail) => void;
|
|
8
|
+
cancel: () => void;
|
|
9
|
+
loadList: () => Promise<void>;
|
|
10
|
+
validate: (draft: DisplayConditionDraft, intent: CreateIntent) => DraftErrors;
|
|
11
|
+
notifyInvalid: () => void;
|
|
12
|
+
createInline: (draft: DisplayConditionDraft) => void;
|
|
13
|
+
createAndSave: (draft: DisplayConditionDraft) => Promise<DraftErrors | null>;
|
|
14
|
+
select: (row: SavedDisplayCondition) => void;
|
|
15
|
+
deleteSaved: (row: SavedDisplayCondition) => Promise<void>;
|
|
16
|
+
};
|
|
@@ -8,6 +8,7 @@ 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_DISPLAY_CONDITIONS: "https://academy.insiderone.com/docs/new-editor-add-display-conditions-to-an-email";
|
|
11
12
|
readonly EMAIL_RECOMMENDATION_BLOCK: "https://academy.insiderone.com/docs/new-editor-email-recommendation-block";
|
|
12
13
|
};
|
|
13
14
|
export type AcademyLinkKey = keyof typeof ACADEMY_LINKS;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare enum DisplayConditionEvent {
|
|
2
|
+
OPEN = "display-condition:open",
|
|
3
|
+
APPLY = "display-condition:apply",
|
|
4
|
+
CANCEL = "display-condition:cancel"
|
|
5
|
+
}
|
|
6
|
+
export declare enum DisplayConditionSourceType {
|
|
7
|
+
INLINE = "inline",
|
|
8
|
+
SAVED = "saved"
|
|
9
|
+
}
|
|
10
|
+
export declare const DISPLAY_CONDITION_LIMITS: {
|
|
11
|
+
readonly NAME_MIN: 2;
|
|
12
|
+
readonly NAME_MAX: 40;
|
|
13
|
+
readonly DESCRIPTION_MAX: 200;
|
|
14
|
+
readonly CODE_MAX: 65535;
|
|
15
|
+
};
|
|
@@ -22,6 +22,11 @@ export declare class RecommendationBlockControl extends CommonControl {
|
|
|
22
22
|
private storeUnsubscription;
|
|
23
23
|
private pendingNodeConfigWrite;
|
|
24
24
|
private pendingConfigFlushTimer;
|
|
25
|
+
private trackedBlockId;
|
|
26
|
+
private fetchedConfigVersion;
|
|
27
|
+
private hasUnrenderedProducts;
|
|
28
|
+
private panelGeneration;
|
|
29
|
+
private isPanelAlive;
|
|
25
30
|
private algorithmControl;
|
|
26
31
|
private localeControl;
|
|
27
32
|
private currencyControl;
|
|
@@ -73,6 +78,7 @@ export declare class RecommendationBlockControl extends CommonControl {
|
|
|
73
78
|
/** Whether the deferred write would move the node's strategyId — see the caller (SD-149916). */
|
|
74
79
|
private _isPendingStrategyIdChange;
|
|
75
80
|
private _capturePendingNodeConfigWrite;
|
|
81
|
+
private _getNodeConfigUpdates;
|
|
76
82
|
/**
|
|
77
83
|
* Accumulates the pending write into `documentModifier` without applying, so the
|
|
78
84
|
* caller's apply() commits config and re-render as ONE undo entry.
|
|
@@ -93,8 +99,8 @@ export declare class RecommendationBlockControl extends CommonControl {
|
|
|
93
99
|
private _clearConfigFlush;
|
|
94
100
|
/**
|
|
95
101
|
* Writes the deferred change standalone when the batch it was staged into never
|
|
96
|
-
* committed. Always targets
|
|
97
|
-
*
|
|
102
|
+
* committed. Always targets a LIVE node — a captured one is an immutable snapshot
|
|
103
|
+
* the intervening re-render staled, and saveConfig swallows that failure.
|
|
98
104
|
*/
|
|
99
105
|
private _flushPendingNodeConfig;
|
|
100
106
|
private _syncNodeConfigToStore;
|
|
@@ -108,6 +114,7 @@ export declare class RecommendationBlockControl extends CommonControl {
|
|
|
108
114
|
* Marks the block as initialized to prevent redundant fetches on re-selection.
|
|
109
115
|
*/
|
|
110
116
|
private _fetchBlockData;
|
|
117
|
+
private _isPanelOn;
|
|
111
118
|
/**
|
|
112
119
|
* Applies smart defaults for newly dropped blocks.
|
|
113
120
|
*
|
|
@@ -127,6 +134,14 @@ export declare class RecommendationBlockControl extends CommonControl {
|
|
|
127
134
|
* Debounced product fetch to prevent rapid API calls during config changes
|
|
128
135
|
*/
|
|
129
136
|
private _debouncedFetchProducts;
|
|
137
|
+
/**
|
|
138
|
+
* Lands what the panel still owes its block before it stops watching it: the config now, the
|
|
139
|
+
* products through a block-scoped refresh. Never throws — it runs from Stripo's teardown.
|
|
140
|
+
*/
|
|
141
|
+
private _finishBlockOutsidePanel;
|
|
142
|
+
private _trackedBlockSnapshot;
|
|
143
|
+
private _refreshOutsidePanel;
|
|
144
|
+
private _getBlockConfigVersion;
|
|
130
145
|
/**
|
|
131
146
|
* Debounced content update when products arrive from API.
|
|
132
147
|
*
|
|
@@ -144,7 +159,7 @@ export declare class RecommendationBlockControl extends CommonControl {
|
|
|
144
159
|
/**
|
|
145
160
|
* Listen to store changes that require product refresh or regeneration.
|
|
146
161
|
*
|
|
147
|
-
* Uses configVersion counter (
|
|
162
|
+
* Uses the block's configVersion counter (bumped by patchCurrentBlockConfig and legacy conversion)
|
|
148
163
|
* to distinguish user-initiated config changes from internal mutations
|
|
149
164
|
* (e.g., fetchRecommendationCreateData setting preferred currency).
|
|
150
165
|
*
|
|
@@ -54,6 +54,8 @@ interface PerBlockState {
|
|
|
54
54
|
*/
|
|
55
55
|
syncedConfigFingerprint: string | null;
|
|
56
56
|
legacyConversionLoading: boolean;
|
|
57
|
+
configVersion: number;
|
|
58
|
+
adoptedSizeVersion: number;
|
|
57
59
|
}
|
|
58
60
|
/**
|
|
59
61
|
* Persisted-config subset used by `seedBlockUrlConfig` to reconstruct
|
|
@@ -618,7 +620,12 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
|
|
|
618
620
|
*/
|
|
619
621
|
invalidBlockFields(): string[];
|
|
620
622
|
fetchRecommendationProducts(): Promise<void>;
|
|
621
|
-
|
|
623
|
+
/**
|
|
624
|
+
* Fetches one block's products whether or not it is selected: the panel teardown and the
|
|
625
|
+
* strategy drawer refresh the block they were handed after the user may have moved on.
|
|
626
|
+
*/
|
|
627
|
+
fetchRecommendationProductsForBlock(blockId: number): Promise<void>;
|
|
628
|
+
_doFetchProducts(targetBlockId?: number): Promise<void>;
|
|
622
629
|
/**
|
|
623
630
|
* Block-scoped counterpart of `fetchRecommendationProducts`, which only serves the selected block:
|
|
624
631
|
* the legacy conversion and the duplicate refresh must reach a block that may no longer be selected.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PerBlockConfigs } from '../store/recommendation';
|
|
2
|
+
import type { PartialNodeConfig } from '../types/nodeConfig';
|
|
3
|
+
interface BlockRefreshOptions {
|
|
4
|
+
pickUpdates: (configs: PerBlockConfigs) => PartialNodeConfig;
|
|
5
|
+
description: string;
|
|
6
|
+
fetch?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Fetches one block's products and commits them with its config straight to the document, for
|
|
10
|
+
* callers the settings panel can no longer serve (deselect, block switch, host-rendered strategy UI).
|
|
11
|
+
* @param options.pickUpdates - the config keys this caller owns on the node
|
|
12
|
+
* @param options.description - labels the undo entry
|
|
13
|
+
* @param options.fetch - false when the block's products already landed and only need rendering
|
|
14
|
+
* @returns whether the write reached a node
|
|
15
|
+
*/
|
|
16
|
+
export declare function refreshBlockOutsidePanel(blockId: number, { pickUpdates, description, fetch }: BlockRefreshOptions): Promise<boolean>;
|
|
17
|
+
export {};
|
|
@@ -13,6 +13,13 @@ interface ConfigWriterApi {
|
|
|
13
13
|
* itself is torn down.
|
|
14
14
|
*/
|
|
15
15
|
export declare function registerNodeConfigWriter(api: ConfigWriterApi): void;
|
|
16
|
+
export declare function hasEditedConfigChange(node: ImmutableHtmlNode, updates: PartialNodeConfig): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Writes a config change to the block's node on its own, found by id — never through a
|
|
19
|
+
* panel-held node, which may already belong to the block the user switched to.
|
|
20
|
+
* @returns whether the block's node was found
|
|
21
|
+
*/
|
|
22
|
+
export declare function writeBlockConfigOutsidePanel(blockId: number, updates: PartialNodeConfig, description: string): boolean;
|
|
16
23
|
/** Reads the persisted config of every node carrying a block id (two while a duplicate still shares it). */
|
|
17
24
|
export declare function readBlockNodeConfigs(blockId: number): RecommendationNodeConfig[];
|
|
18
25
|
/**
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AppliedDisplayCondition, DisplayConditionOpenDetail } from '@@/Types/display-condition';
|
|
2
|
+
export interface ConditionRequestHandlers {
|
|
3
|
+
onApply: (condition: AppliedDisplayCondition | null) => void;
|
|
4
|
+
onCancel?: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const requestDisplayCondition: (detail: DisplayConditionOpenDetail, handlers: ConditionRequestHandlers) => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BlockType } from '@stripoinc/ui-editor-extensions';
|
|
2
|
+
export declare const CONDITIONS_TAB_ID = "conditions";
|
|
3
|
+
export declare const CONDITIONS_CONTROL_ID = "guido-display-conditions-control";
|
|
4
|
+
export declare const MAX_COLLAPSED_LINES = 10;
|
|
5
|
+
export declare const CONDITION_BLOCK_TYPES: readonly [BlockType.STRIPE, BlockType.STRUCTURE, BlockType.CONTAINER];
|
|
6
|
+
export declare const CONDITION_ICONS: {
|
|
7
|
+
readonly PLUS: "guido-display-condition-plus";
|
|
8
|
+
readonly EDIT: "guido-display-condition-edit";
|
|
9
|
+
readonly TRASH: "guido-display-condition-trash";
|
|
10
|
+
readonly CHEVRON: "guido-display-condition-chevron";
|
|
11
|
+
};
|
|
12
|
+
export declare const BUILT_IN_CONDITION_CONTROLS: string[];
|
|
13
|
+
export declare const EMPTY_DESCRIPTION: string;
|
|
14
|
+
export declare const APPLIED_DESCRIPTION: string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
2
|
+
import { CommonControl } from '@@/Extensions/Blocks/common-control';
|
|
3
|
+
export declare class DisplayConditionsControl extends CommonControl {
|
|
4
|
+
private expanded;
|
|
5
|
+
private listeners;
|
|
6
|
+
private resizeObserver;
|
|
7
|
+
getId(): string;
|
|
8
|
+
getTemplate(): string;
|
|
9
|
+
onRender(): void;
|
|
10
|
+
onTemplateNodeUpdated(node: ImmutableHtmlNode): void;
|
|
11
|
+
onDestroy(): void;
|
|
12
|
+
private getCondition;
|
|
13
|
+
private toggleMenu;
|
|
14
|
+
private openDrawer;
|
|
15
|
+
private applyCondition;
|
|
16
|
+
private wire;
|
|
17
|
+
private teardown;
|
|
18
|
+
private observeCodeSize;
|
|
19
|
+
private paint;
|
|
20
|
+
private collapsedHeight;
|
|
21
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DisplayCondition, ExternalDisplayConditionSelectedCB } from '@stripoinc/ui-editor-extensions';
|
|
2
|
+
import { ExternalDisplayConditionsLibrary } from '@stripoinc/ui-editor-extensions';
|
|
3
|
+
export declare class DisplayConditionsLibrary extends ExternalDisplayConditionsLibrary {
|
|
4
|
+
getCategoryName(): string;
|
|
5
|
+
openExternalDisplayConditionsDialog(currentCondition: DisplayCondition, successCallback: ExternalDisplayConditionSelectedCB, cancelCallback: () => void): void;
|
|
6
|
+
getIsContextActionEnabled(): boolean;
|
|
7
|
+
getContextActionIndex(): number;
|
|
8
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { SettingsPanelTab as SettingsPanelTabType } from '@stripoinc/ui-editor-extensions';
|
|
2
|
+
import { SettingsPanelRegistry } from '@stripoinc/ui-editor-extensions';
|
|
3
|
+
export declare class DisplayConditionsSettingsPanel extends SettingsPanelRegistry {
|
|
4
|
+
registerBlockControls(blockControlsMap: Record<string, SettingsPanelTabType[]>): void;
|
|
5
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DisplayConditionDraft, DisplayConditionListResponse, DisplayConditionSyntax, SavedDisplayCondition } from '@@/Types/display-condition';
|
|
2
|
+
export declare const DISPLAY_CONDITIONS_URL = "/email-proxy/v1/display-conditions";
|
|
3
|
+
export declare const DISPLAY_CONDITIONS_PAGE_LIMIT = 100;
|
|
4
|
+
export declare const useDisplayConditionApi: () => {
|
|
5
|
+
list: (syntax: DisplayConditionSyntax) => Promise<DisplayConditionListResponse>;
|
|
6
|
+
create: (draft: DisplayConditionDraft, syntax: DisplayConditionSyntax) => Promise<SavedDisplayCondition>;
|
|
7
|
+
nameExists: (name: string, syntax: DisplayConditionSyntax) => Promise<boolean>;
|
|
8
|
+
remove: (id: number) => Promise<void>;
|
|
9
|
+
};
|