@useinsider/guido 3.20.0-beta.13006ea → 3.20.0-beta.231200f
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/config/compiler/itemsCompilerRules.js +6 -13
- package/dist/config/compiler/utils/itemsCompilerUtils.js +17 -34
- package/dist/enums/academy.js +1 -0
- package/dist/enums/display-condition.js +12 -0
- 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/config/compiler/utils/itemsCompilerUtils.d.ts +0 -5
- package/dist/src/enums/academy.d.ts +1 -0
- package/dist/src/enums/display-condition.d.ts +15 -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 +20 -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/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
|
+
};
|
|
@@ -414,6 +414,8 @@ export declare const FeaturesSchema: v.ObjectSchema<{
|
|
|
414
414
|
/** Allow persisting a template that still has validation errors (drawer "Save and Continue" soft-save). Host sets false for transactional + unsubscribe. */
|
|
415
415
|
readonly allowSaveWithErrors: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
|
|
416
416
|
readonly reusableRecommendationStrategy: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
417
|
+
/** Enable the Conditions settings tab and the create/select display-condition drawers */
|
|
418
|
+
readonly externalDisplayConditions: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
417
419
|
}, undefined>;
|
|
418
420
|
/**
|
|
419
421
|
* Default block types available in Stripo
|
|
@@ -832,6 +834,8 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
|
832
834
|
/** Allow persisting a template that still has validation errors (drawer "Save and Continue" soft-save). Host sets false for transactional + unsubscribe. */
|
|
833
835
|
readonly allowSaveWithErrors: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
|
|
834
836
|
readonly reusableRecommendationStrategy: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
837
|
+
/** Enable the Conditions settings tab and the create/select display-condition drawers */
|
|
838
|
+
readonly externalDisplayConditions: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
835
839
|
}, undefined>, {}>;
|
|
836
840
|
/** Block configuration */
|
|
837
841
|
readonly blocks: 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;
|
|
@@ -104,6 +104,7 @@ export declare const useConfig: () => {
|
|
|
104
104
|
linkTrackingIds: boolean;
|
|
105
105
|
allowSaveWithErrors: boolean;
|
|
106
106
|
reusableRecommendationStrategy: boolean;
|
|
107
|
+
externalDisplayConditions: boolean;
|
|
107
108
|
};
|
|
108
109
|
blocks: {
|
|
109
110
|
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")[];
|
|
@@ -243,6 +244,7 @@ export declare const useConfig: () => {
|
|
|
243
244
|
linkTrackingIds: boolean;
|
|
244
245
|
allowSaveWithErrors: boolean;
|
|
245
246
|
reusableRecommendationStrategy: boolean;
|
|
247
|
+
externalDisplayConditions: boolean;
|
|
246
248
|
} | null>;
|
|
247
249
|
blocks: import("vue").ComputedRef<{
|
|
248
250
|
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")[];
|
|
@@ -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
|
+
};
|
|
@@ -10,8 +10,3 @@ export declare const MSO_ITEMS_HIDE_END = "MSO_ITEMS_HIDE_END";
|
|
|
10
10
|
* and collapse them inline for web-engine Outlook.
|
|
11
11
|
*/
|
|
12
12
|
export declare function wrapHiddenPriceTdsForOutlook(html: string): string;
|
|
13
|
-
/**
|
|
14
|
-
* The mobile `.adapt-img { width: 100% }` rule sizes the horizontal thumbnail by its auto-width column,
|
|
15
|
-
* so it grows in a roomy row and collapses to nothing in a crowded one — bound it to [default, width].
|
|
16
|
-
*/
|
|
17
|
-
export declare function lockHorizontalItemImageWidths(html: string): string;
|
|
@@ -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
|
+
};
|
|
@@ -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
|
+
};
|
|
@@ -109,6 +109,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
109
109
|
linkTrackingIds: boolean;
|
|
110
110
|
allowSaveWithErrors: boolean;
|
|
111
111
|
reusableRecommendationStrategy: boolean;
|
|
112
|
+
externalDisplayConditions: boolean;
|
|
112
113
|
};
|
|
113
114
|
blocks: {
|
|
114
115
|
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")[];
|
|
@@ -254,6 +255,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
254
255
|
linkTrackingIds: boolean;
|
|
255
256
|
allowSaveWithErrors: boolean;
|
|
256
257
|
reusableRecommendationStrategy: boolean;
|
|
258
|
+
externalDisplayConditions: boolean;
|
|
257
259
|
};
|
|
258
260
|
blocks: {
|
|
259
261
|
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")[];
|
|
@@ -399,6 +401,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
399
401
|
linkTrackingIds: boolean;
|
|
400
402
|
allowSaveWithErrors: boolean;
|
|
401
403
|
reusableRecommendationStrategy: boolean;
|
|
404
|
+
externalDisplayConditions: boolean;
|
|
402
405
|
};
|
|
403
406
|
blocks: {
|
|
404
407
|
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")[];
|
|
@@ -544,6 +547,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
544
547
|
linkTrackingIds: boolean;
|
|
545
548
|
allowSaveWithErrors: boolean;
|
|
546
549
|
reusableRecommendationStrategy: boolean;
|
|
550
|
+
externalDisplayConditions: boolean;
|
|
547
551
|
};
|
|
548
552
|
blocks: {
|
|
549
553
|
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")[];
|
|
@@ -689,6 +693,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
689
693
|
linkTrackingIds: boolean;
|
|
690
694
|
allowSaveWithErrors: boolean;
|
|
691
695
|
reusableRecommendationStrategy: boolean;
|
|
696
|
+
externalDisplayConditions: boolean;
|
|
692
697
|
};
|
|
693
698
|
blocks: {
|
|
694
699
|
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")[];
|
|
@@ -834,6 +839,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
834
839
|
linkTrackingIds: boolean;
|
|
835
840
|
allowSaveWithErrors: boolean;
|
|
836
841
|
reusableRecommendationStrategy: boolean;
|
|
842
|
+
externalDisplayConditions: boolean;
|
|
837
843
|
};
|
|
838
844
|
blocks: {
|
|
839
845
|
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")[];
|
|
@@ -979,6 +985,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
979
985
|
linkTrackingIds: boolean;
|
|
980
986
|
allowSaveWithErrors: boolean;
|
|
981
987
|
reusableRecommendationStrategy: boolean;
|
|
988
|
+
externalDisplayConditions: boolean;
|
|
982
989
|
};
|
|
983
990
|
blocks: {
|
|
984
991
|
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")[];
|
|
@@ -1124,6 +1131,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1124
1131
|
linkTrackingIds: boolean;
|
|
1125
1132
|
allowSaveWithErrors: boolean;
|
|
1126
1133
|
reusableRecommendationStrategy: boolean;
|
|
1134
|
+
externalDisplayConditions: boolean;
|
|
1127
1135
|
};
|
|
1128
1136
|
blocks: {
|
|
1129
1137
|
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")[];
|
|
@@ -1269,6 +1277,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1269
1277
|
linkTrackingIds: boolean;
|
|
1270
1278
|
allowSaveWithErrors: boolean;
|
|
1271
1279
|
reusableRecommendationStrategy: boolean;
|
|
1280
|
+
externalDisplayConditions: boolean;
|
|
1272
1281
|
};
|
|
1273
1282
|
blocks: {
|
|
1274
1283
|
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")[];
|
|
@@ -1414,6 +1423,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1414
1423
|
linkTrackingIds: boolean;
|
|
1415
1424
|
allowSaveWithErrors: boolean;
|
|
1416
1425
|
reusableRecommendationStrategy: boolean;
|
|
1426
|
+
externalDisplayConditions: boolean;
|
|
1417
1427
|
};
|
|
1418
1428
|
blocks: {
|
|
1419
1429
|
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")[];
|
|
@@ -1559,6 +1569,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1559
1569
|
linkTrackingIds: boolean;
|
|
1560
1570
|
allowSaveWithErrors: boolean;
|
|
1561
1571
|
reusableRecommendationStrategy: boolean;
|
|
1572
|
+
externalDisplayConditions: boolean;
|
|
1562
1573
|
};
|
|
1563
1574
|
blocks: {
|
|
1564
1575
|
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")[];
|
|
@@ -1704,6 +1715,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1704
1715
|
linkTrackingIds: boolean;
|
|
1705
1716
|
allowSaveWithErrors: boolean;
|
|
1706
1717
|
reusableRecommendationStrategy: boolean;
|
|
1718
|
+
externalDisplayConditions: boolean;
|
|
1707
1719
|
};
|
|
1708
1720
|
blocks: {
|
|
1709
1721
|
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")[];
|
|
@@ -1849,6 +1861,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1849
1861
|
linkTrackingIds: boolean;
|
|
1850
1862
|
allowSaveWithErrors: boolean;
|
|
1851
1863
|
reusableRecommendationStrategy: boolean;
|
|
1864
|
+
externalDisplayConditions: boolean;
|
|
1852
1865
|
};
|
|
1853
1866
|
blocks: {
|
|
1854
1867
|
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")[];
|
|
@@ -1994,6 +2007,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1994
2007
|
linkTrackingIds: boolean;
|
|
1995
2008
|
allowSaveWithErrors: boolean;
|
|
1996
2009
|
reusableRecommendationStrategy: boolean;
|
|
2010
|
+
externalDisplayConditions: boolean;
|
|
1997
2011
|
};
|
|
1998
2012
|
blocks: {
|
|
1999
2013
|
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")[];
|
|
@@ -2139,6 +2153,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2139
2153
|
linkTrackingIds: boolean;
|
|
2140
2154
|
allowSaveWithErrors: boolean;
|
|
2141
2155
|
reusableRecommendationStrategy: boolean;
|
|
2156
|
+
externalDisplayConditions: boolean;
|
|
2142
2157
|
};
|
|
2143
2158
|
blocks: {
|
|
2144
2159
|
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")[];
|
|
@@ -2284,6 +2299,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2284
2299
|
linkTrackingIds: boolean;
|
|
2285
2300
|
allowSaveWithErrors: boolean;
|
|
2286
2301
|
reusableRecommendationStrategy: boolean;
|
|
2302
|
+
externalDisplayConditions: boolean;
|
|
2287
2303
|
};
|
|
2288
2304
|
blocks: {
|
|
2289
2305
|
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")[];
|
|
@@ -2429,6 +2445,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2429
2445
|
linkTrackingIds: boolean;
|
|
2430
2446
|
allowSaveWithErrors: boolean;
|
|
2431
2447
|
reusableRecommendationStrategy: boolean;
|
|
2448
|
+
externalDisplayConditions: boolean;
|
|
2432
2449
|
};
|
|
2433
2450
|
blocks: {
|
|
2434
2451
|
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")[];
|
|
@@ -2586,6 +2603,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2586
2603
|
linkTrackingIds: boolean;
|
|
2587
2604
|
allowSaveWithErrors: boolean;
|
|
2588
2605
|
reusableRecommendationStrategy: boolean;
|
|
2606
|
+
externalDisplayConditions: boolean;
|
|
2589
2607
|
};
|
|
2590
2608
|
blocks: {
|
|
2591
2609
|
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")[];
|
|
@@ -2731,6 +2749,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2731
2749
|
linkTrackingIds: boolean;
|
|
2732
2750
|
allowSaveWithErrors: boolean;
|
|
2733
2751
|
reusableRecommendationStrategy: boolean;
|
|
2752
|
+
externalDisplayConditions: boolean;
|
|
2734
2753
|
};
|
|
2735
2754
|
blocks: {
|
|
2736
2755
|
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")[];
|
|
@@ -2878,6 +2897,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2878
2897
|
linkTrackingIds: boolean;
|
|
2879
2898
|
allowSaveWithErrors: boolean;
|
|
2880
2899
|
reusableRecommendationStrategy: boolean;
|
|
2900
|
+
externalDisplayConditions: boolean;
|
|
2881
2901
|
};
|
|
2882
2902
|
blocks: {
|
|
2883
2903
|
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")[];
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { AppliedDisplayCondition, SavedDisplayCondition } from '@@/Types/display-condition';
|
|
2
|
+
export type DisplayConditionView = 'none' | 'create' | 'select';
|
|
3
|
+
export type DisplayConditionListStatus = 'idle' | 'loading' | 'loaded' | 'error';
|
|
4
|
+
interface DisplayConditionState {
|
|
5
|
+
view: DisplayConditionView;
|
|
6
|
+
editing: AppliedDisplayCondition | null;
|
|
7
|
+
list: SavedDisplayCondition[];
|
|
8
|
+
listStatus: DisplayConditionListStatus;
|
|
9
|
+
pendingDelete: SavedDisplayCondition | null;
|
|
10
|
+
}
|
|
11
|
+
export declare const useDisplayConditionStore: import("pinia").StoreDefinition<"guidoDisplayCondition", DisplayConditionState, {
|
|
12
|
+
isCreateOpen: (state: {
|
|
13
|
+
view: DisplayConditionView;
|
|
14
|
+
editing: {
|
|
15
|
+
id: number;
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
beforeScript: string;
|
|
19
|
+
afterScript: string;
|
|
20
|
+
extraData?: string | undefined;
|
|
21
|
+
} | null;
|
|
22
|
+
list: {
|
|
23
|
+
id: number;
|
|
24
|
+
name: string;
|
|
25
|
+
description: string;
|
|
26
|
+
syntax: "liquid" | "pongo";
|
|
27
|
+
method: "codeOnly" | "logicBuilder";
|
|
28
|
+
codeBefore: string;
|
|
29
|
+
codeAfter: string;
|
|
30
|
+
createdAt?: string | undefined;
|
|
31
|
+
}[];
|
|
32
|
+
listStatus: DisplayConditionListStatus;
|
|
33
|
+
pendingDelete: {
|
|
34
|
+
id: number;
|
|
35
|
+
name: string;
|
|
36
|
+
description: string;
|
|
37
|
+
syntax: "liquid" | "pongo";
|
|
38
|
+
method: "codeOnly" | "logicBuilder";
|
|
39
|
+
codeBefore: string;
|
|
40
|
+
codeAfter: string;
|
|
41
|
+
createdAt?: string | undefined;
|
|
42
|
+
} | null;
|
|
43
|
+
} & import("pinia").PiniaCustomStateProperties<DisplayConditionState>) => boolean;
|
|
44
|
+
isSelectOpen: (state: {
|
|
45
|
+
view: DisplayConditionView;
|
|
46
|
+
editing: {
|
|
47
|
+
id: number;
|
|
48
|
+
name: string;
|
|
49
|
+
description: string;
|
|
50
|
+
beforeScript: string;
|
|
51
|
+
afterScript: string;
|
|
52
|
+
extraData?: string | undefined;
|
|
53
|
+
} | null;
|
|
54
|
+
list: {
|
|
55
|
+
id: number;
|
|
56
|
+
name: string;
|
|
57
|
+
description: string;
|
|
58
|
+
syntax: "liquid" | "pongo";
|
|
59
|
+
method: "codeOnly" | "logicBuilder";
|
|
60
|
+
codeBefore: string;
|
|
61
|
+
codeAfter: string;
|
|
62
|
+
createdAt?: string | undefined;
|
|
63
|
+
}[];
|
|
64
|
+
listStatus: DisplayConditionListStatus;
|
|
65
|
+
pendingDelete: {
|
|
66
|
+
id: number;
|
|
67
|
+
name: string;
|
|
68
|
+
description: string;
|
|
69
|
+
syntax: "liquid" | "pongo";
|
|
70
|
+
method: "codeOnly" | "logicBuilder";
|
|
71
|
+
codeBefore: string;
|
|
72
|
+
codeAfter: string;
|
|
73
|
+
createdAt?: string | undefined;
|
|
74
|
+
} | null;
|
|
75
|
+
} & import("pinia").PiniaCustomStateProperties<DisplayConditionState>) => boolean;
|
|
76
|
+
}, {
|
|
77
|
+
openCreate(editing?: AppliedDisplayCondition | null): void;
|
|
78
|
+
openSelect(): void;
|
|
79
|
+
close(): void;
|
|
80
|
+
}>;
|
|
81
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AppliedDisplayCondition, DisplayConditionSource } from '@@/Types/display-condition';
|
|
2
|
+
export declare const parseSource: (condition: AppliedDisplayCondition | null | undefined) => DisplayConditionSource | null;
|
|
3
|
+
export type CodeField = 'codeBefore' | 'codeAfter';
|
|
4
|
+
export declare const findInvalidCodeFields: (codeBefore: string, codeAfter: string) => CodeField[];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { defineStore as i } from "pinia";
|
|
2
|
+
const n = i("guidoDisplayCondition", {
|
|
3
|
+
state: () => ({
|
|
4
|
+
view: "none",
|
|
5
|
+
editing: null,
|
|
6
|
+
list: [],
|
|
7
|
+
listStatus: "idle",
|
|
8
|
+
pendingDelete: null
|
|
9
|
+
}),
|
|
10
|
+
getters: {
|
|
11
|
+
isCreateOpen: (e) => e.view === "create",
|
|
12
|
+
isSelectOpen: (e) => e.view === "select"
|
|
13
|
+
},
|
|
14
|
+
actions: {
|
|
15
|
+
openCreate(e = null) {
|
|
16
|
+
this.editing = e, this.view = "create";
|
|
17
|
+
},
|
|
18
|
+
openSelect() {
|
|
19
|
+
this.editing = null, this.view = "select";
|
|
20
|
+
},
|
|
21
|
+
close() {
|
|
22
|
+
this.view = "none", this.pendingDelete = null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
export {
|
|
27
|
+
n as useDisplayConditionStore
|
|
28
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DisplayConditionSourceType as i } from "../enums/display-condition.js";
|
|
2
|
+
const S = (s) => {
|
|
3
|
+
if (!s)
|
|
4
|
+
return null;
|
|
5
|
+
try {
|
|
6
|
+
return JSON.parse(s.extraData ?? "{}").source === i.INLINE ? "inline" : "saved";
|
|
7
|
+
} catch {
|
|
8
|
+
return "saved";
|
|
9
|
+
}
|
|
10
|
+
}, l = /{%-?\s*(\w+)[\s\S]*?-?%}/g, d = /{%[\s\S]*?%}|{{[\s\S]*?}}/g, a = /* @__PURE__ */ new Set(["if", "unless", "for", "case", "capture", "tablerow", "comment"]), f = /* @__PURE__ */ new Set(["else", "elsif", "elif", "when"]), h = (s) => /{%|%}|{{|}}/.test(s.replace(d, "")), A = (s, o) => {
|
|
11
|
+
const t = /* @__PURE__ */ new Set(), r = [];
|
|
12
|
+
return [["codeBefore", s], ["codeAfter", o]].forEach(([n, c]) => {
|
|
13
|
+
h(c) && t.add(n), Array.from(c.matchAll(l), (e) => e[1]).forEach((e) => {
|
|
14
|
+
a.has(e) ? r.push(e) : e.startsWith("end") && a.has(e.slice(3)) ? r.pop() !== e.slice(3) && t.add(n) : f.has(e) && !r.length && t.add(n);
|
|
15
|
+
});
|
|
16
|
+
}), r.length && t.add("codeAfter"), [...t];
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
A as findInvalidCodeFields,
|
|
20
|
+
S as parseSource
|
|
21
|
+
};
|