@diagonal-hq/cli 0.43.3 → 0.45.0

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.
@@ -2850,7 +2850,121 @@ type SdkNotificationTemplateContent = {
2850
2850
  references: Record<string, SdkNotificationTemplateReference>;
2851
2851
  };
2852
2852
 
2853
+ type SdkEmailDocument = EmailDocument;
2854
+
2855
+ type EmailDocument = {
2856
+ version: 1;
2857
+ /** The values that the author changed from the Brand Kit. */
2858
+ theme: Partial<EmailTheme>;
2859
+ blocks: EmailBlock[];
2860
+ };
2861
+
2862
+ type EmailTheme = {
2863
+ background: string;
2864
+ surface: string;
2865
+ text: string;
2866
+ muted: string;
2867
+ accent: string;
2868
+ accent_text: string;
2869
+ font: 'sans' | 'modern' | 'humanist' | 'serif';
2870
+ radius: number;
2871
+ };
2872
+
2873
+ type EmailBlock =
2874
+ | TextBlock
2875
+ | ImageBlock
2876
+ | ButtonBlock
2877
+ | LogoBlock
2878
+ | DividerBlock
2879
+ | SpacerBlock
2880
+ | ColumnsBlock
2881
+ | SocialBlock;
2882
+
2883
+ type TextBlock = BlockBase & { type: 'text'; content: JSONContent; align: EmailAlign };
2884
+
2885
+ type BlockBase = {
2886
+ id: string;
2887
+ condition?: BlockCondition | null;
2888
+ style: { padding_top: number; padding_bottom: number; background: string | null };
2889
+ };
2890
+
2891
+ type BlockCondition = { path: string; is: 'filled' | 'empty' };
2892
+
2893
+ type JSONContent<A = any, B = any, C = any, D = any> = any;
2894
+
2895
+ type EmailAlign = 'left' | 'center' | 'right';
2896
+
2897
+ type ImageBlock = BlockBase & {
2898
+ type: 'image';
2899
+ file_id: string | null;
2900
+ url: string | null;
2901
+ alt: string;
2902
+ link: EmailLink;
2903
+ width: number;
2904
+ radius: number;
2905
+ align: EmailAlign;
2906
+ };
2907
+
2908
+ type EmailLink =
2909
+ | { type: 'url'; value: string }
2910
+ | { type: 'variable'; expression: string }
2911
+ | null;
2912
+
2913
+ type ButtonBlock = BlockBase & {
2914
+ type: 'button';
2915
+ label: string;
2916
+ link: EmailLink;
2917
+ variant: 'solid' | 'outline';
2918
+ color: string | null;
2919
+ text_color: string | null;
2920
+ full_width: boolean;
2921
+ align: EmailAlign;
2922
+ };
2923
+
2924
+ type LogoBlock = BlockBase & {
2925
+ type: 'logo';
2926
+ variant: LogoVariant;
2927
+ width: number;
2928
+ link: EmailLink;
2929
+ align: EmailAlign;
2930
+ };
2931
+
2932
+ type LogoVariant = 'auto' | 'horizontal' | 'wordmark' | 'icon';
2933
+
2934
+ type DividerBlock = BlockBase & { type: 'divider'; color: string | null; thickness: number };
2935
+
2936
+ type SpacerBlock = BlockBase & { type: 'spacer'; height: number };
2937
+
2938
+ type ColumnsBlock = BlockBase & {
2939
+ type: 'columns';
2940
+ layout: ColumnLayout;
2941
+ columns: EmailBlock[][];
2942
+ };
2943
+
2944
+ type ColumnLayout = '1-1' | '1-2' | '2-1' | '1-1-1';
2945
+
2946
+ type SocialBlock = BlockBase & {
2947
+ type: 'social';
2948
+ links: { network: SocialNetwork; url: string }[];
2949
+ align: EmailAlign;
2950
+ };
2951
+
2952
+ type SocialNetwork =
2953
+ | 'facebook'
2954
+ | 'instagram'
2955
+ | 'linkedin'
2956
+ | 'x'
2957
+ | 'youtube'
2958
+ | 'tiktok'
2959
+ | 'website';
2960
+
2853
2961
  type SdkNotificationTemplateDefinition = SdkNotificationTemplateContent & {
2962
+ /** The `EmailBuilder` document, or null for a template that another editor wrote. */
2963
+ email_document: SdkEmailDocument | null;
2964
+ /** What the author must finish before the email can be sent. */
2965
+ email_document_issues: { block_id: string; message: string }[];
2966
+ /** Changes with the email's content. Send it as `expected_revision` to refuse a stale save. */
2967
+ content_revision: string;
2854
2968
  id: string;
2855
2969
  name: string;
2856
2970
  notification_type_name: string;
@@ -2864,6 +2978,14 @@ type SdkNotificationTemplateDefinition = SdkNotificationTemplateContent & {
2864
2978
  type SdkSaveNotificationTemplateInput = SdkNotificationTemplateContent & {
2865
2979
  id?: string;
2866
2980
  name: string;
2981
+ /**
2982
+ * The `EmailBuilder` document. The server compiles it to the `content` layout value. Copy it
2983
+ * from a starting template to keep the copy editable in the builder. A save that omits it
2984
+ * keeps the document, and may not change the content.
2985
+ */
2986
+ email_document?: SdkEmailDocument | null;
2987
+ /** The `content_revision` that the change is based on. A save from an older one fails with 409. */
2988
+ expected_revision?: string;
2867
2989
  };
2868
2990
 
2869
2991
  type SdkUseSaveNotificationTemplateOptions = {
@@ -2893,51 +3015,47 @@ type SdkSaveNotificationTemplateHandle = {
2893
3015
  type SdkNavigationMenu = {
2894
3016
  id: string;
2895
3017
  name: string;
2896
- items: any[];
3018
+ /** The items of a menu row, or the resolved items of a `navigation/*.ts` module. */
3019
+ items: any[] | readonly SdkResolvedMenuItem[];
2897
3020
  };
2898
3021
 
2899
- type SdkNavigationMenuCatalog = Record<string, SdkNavigationMenu>;
3022
+ type SdkResolvedMenuItem = NavMainItem & {
3023
+ readonly badge: string | number | null;
3024
+ readonly children: readonly SdkResolvedMenuItem[] | null;
3025
+ };
2900
3026
 
2901
- type SdkSystemSettingsPage =
2902
- | 'ai-assistant'
2903
- | 'ai-conversations'
2904
- | 'application-assets'
2905
- | 'branches'
2906
- | 'calendar-sync'
2907
- | 'components'
2908
- | 'data-imports'
2909
- | 'developer'
2910
- | 'diagonal-wallet'
2911
- | 'entity-graph'
2912
- | 'layouts'
2913
- | 'media-library'
2914
- | 'navigation'
2915
- | 'notifications'
2916
- | 'package'
2917
- | 'packages'
2918
- | 'page-playground'
2919
- | 'pages'
2920
- | 'projects'
2921
- | 'record-bindings'
2922
- | 'redirects'
2923
- | 'resources'
2924
- | 'security'
2925
- | 'staged-content'
2926
- | 'tests'
2927
- | 'workflow-script-migration'
2928
- | 'workflows'
2929
- | 'workspace-analytics'
2930
- | 'workspace-brand-kit'
2931
- | 'workspace-domains'
2932
- | 'workspace-email'
2933
- | 'workspace-fields'
2934
- | 'workspace-files'
2935
- | 'workspace-onboarding'
2936
- | 'workspace-runs'
2937
- | 'workspace-workflows'
2938
- | 'workspaces';
3027
+ type NavMainItem = {
3028
+ readonly id: string;
3029
+ readonly parent_id: string | null;
3030
+ readonly title: string;
3031
+ /** The destination, or null for a dropdown and for a page that has no published route. */
3032
+ readonly url: string | null;
3033
+ readonly type: {
3034
+ readonly value: 'page' | 'url' | 'external_link' | 'system_config' | 'dropdown';
3035
+ readonly label: string;
3036
+ };
3037
+ readonly icon: string | null;
3038
+ /** A short count or label that shows at the end of the item. */
3039
+ readonly badge?: string | number | null;
3040
+ readonly sort_order: number;
3041
+ readonly children: readonly NavMainItem[] | null;
3042
+ /** Paths other than `url` that mark the item active. */
3043
+ readonly activation_paths?: readonly string[] | null;
3044
+ };
2939
3045
 
2940
- type SdkSystemSettingsPageEntry = { key: string; url: string | null };
3046
+ type SdkNavigationMenuModule = {
3047
+ id: string;
3048
+ name: string;
3049
+ /** Loads the module's menu. It throws when the module does not load or exports no menu. */
3050
+ load: () => SdkMenu;
3051
+ };
3052
+
3053
+ type SdkMenu<E extends SdkMenuExtra = Record<never, never>> = {
3054
+ readonly $menu: true;
3055
+ readonly build: (ctx: SdkMenuContext & E) => readonly SdkMenuItem[];
3056
+ };
3057
+
3058
+ type SdkMenuExtra = Record<string, any>;
2941
3059
 
2942
3060
  type SdkMenuContext = {
2943
3061
  /** The signed-in identity, or null for a visitor who is not signed in. */
@@ -3034,36 +3152,48 @@ type SdkCatalogPageParams<U> = SdkCatalogPage<U> extends { params: infer P } ? P
3034
3152
 
3035
3153
  type SdkCatalogPage<U> = U extends keyof PageParamsCatalog ? PageParamsCatalog[U] : null;
3036
3154
 
3037
- type SdkMenuExtra = Record<string, any>;
3038
-
3039
- type SdkMenu<E extends SdkMenuExtra = Record<never, never>> = {
3040
- readonly $menu: true;
3041
- readonly build: (ctx: SdkMenuContext & E) => readonly SdkMenuItem[];
3042
- };
3155
+ type SdkSystemSettingsPage =
3156
+ | 'ai-assistant'
3157
+ | 'ai-conversations'
3158
+ | 'application-assets'
3159
+ | 'branches'
3160
+ | 'calendar-sync'
3161
+ | 'components'
3162
+ | 'data-imports'
3163
+ | 'developer'
3164
+ | 'diagonal-wallet'
3165
+ | 'entity-graph'
3166
+ | 'layouts'
3167
+ | 'media-library'
3168
+ | 'navigation'
3169
+ | 'notifications'
3170
+ | 'package'
3171
+ | 'packages'
3172
+ | 'page-playground'
3173
+ | 'pages'
3174
+ | 'projects'
3175
+ | 'record-bindings'
3176
+ | 'redirects'
3177
+ | 'resources'
3178
+ | 'security'
3179
+ | 'staged-content'
3180
+ | 'tests'
3181
+ | 'workflow-script-migration'
3182
+ | 'workflows'
3183
+ | 'workspace-analytics'
3184
+ | 'workspace-brand-kit'
3185
+ | 'workspace-domains'
3186
+ | 'workspace-email'
3187
+ | 'workspace-fields'
3188
+ | 'workspace-files'
3189
+ | 'workspace-onboarding'
3190
+ | 'workspace-runs'
3191
+ | 'workspace-workflows'
3192
+ | 'workspaces';
3043
3193
 
3044
- type SdkResolvedMenuItem = NavMainItem & {
3045
- readonly badge: string | number | null;
3046
- readonly children: readonly SdkResolvedMenuItem[] | null;
3047
- };
3194
+ type SdkNavigationMenuCatalog = Record<string, SdkNavigationMenu | SdkNavigationMenuModule>;
3048
3195
 
3049
- type NavMainItem = {
3050
- readonly id: string;
3051
- readonly parent_id: string | null;
3052
- readonly title: string;
3053
- /** The destination, or null for a dropdown and for a page that has no published route. */
3054
- readonly url: string | null;
3055
- readonly type: {
3056
- readonly value: 'page' | 'url' | 'external_link' | 'system_config' | 'dropdown';
3057
- readonly label: string;
3058
- };
3059
- readonly icon: string | null;
3060
- /** A short count or label that shows at the end of the item. */
3061
- readonly badge?: string | number | null;
3062
- readonly sort_order: number;
3063
- readonly children: readonly NavMainItem[] | null;
3064
- /** Paths other than `url` that mark the item active. */
3065
- readonly activation_paths?: readonly string[] | null;
3066
- };
3196
+ type SdkSystemSettingsPageEntry = { key: string; url: string | null };
3067
3197
 
3068
3198
  type SdkMenuResult = { items: readonly SdkResolvedMenuItem[] };
3069
3199
 
@@ -6387,6 +6517,7 @@ type ComponentRegistry = {
6387
6517
  "DataTableToolbar": SdkComponent<DataTableToolbarProps>;
6388
6518
  "DeleteResourceRecord": SdkComponent<DeleteResourceRecordProps>;
6389
6519
  "DropdownMenu": SdkComponent<DropdownMenuProps>;
6520
+ "EmailBuilder": SdkComponent<EmailBuilderProps>;
6390
6521
  "EmailComposer": SdkComponent<EmailComposerProps>;
6391
6522
  "EmailMessages": SdkComponent<EmailMessagesProps>;
6392
6523
  "EmptyState": SdkComponent<EmptyStateProps>;
@@ -11002,6 +11133,81 @@ type DropdownMenuItem = {
11002
11133
  onSelect?: () => void;
11003
11134
  };
11004
11135
 
11136
+ type EmailBuilderProps = {
11137
+ /**
11138
+ * Notification template that the builder edits. The builder reads it once per mount and
11139
+ * saves each edit to it. Saving sends no email. Requires `manage_notifications`.
11140
+ */
11141
+ notificationTemplateId: string;
11142
+
11143
+ /** Title in the top bar, such as the campaign name. */
11144
+ title: string;
11145
+
11146
+ /** Called by the Back button after the last edit is saved. */
11147
+ onExit: () => void;
11148
+
11149
+ /** Called after each save, for example to copy the subject to a campaign record. */
11150
+ onSaved?: (template: SdkNotificationTemplateDefinition) => void;
11151
+
11152
+ /** Actions at the right of the top bar, such as Review and send. */
11153
+ actions?: (state: EmailBuilderState) => ReactNode;
11154
+
11155
+ /** Values of the type's variables for previews and tests. A record variable takes a record ID. */
11156
+ data?: Record<string, any>;
11157
+
11158
+ /** People the author can preview the email as. A test email renders for the selected person. */
11159
+ recipients?: EmailBuilderRecipient[];
11160
+
11161
+ /** Pages that buttons can link to. The first one is the Portal link block. */
11162
+ links?: EmailBuilderLink[];
11163
+
11164
+ /**
11165
+ * Layout that the next save uses. It must declare a `content` field. A layout can also declare
11166
+ * `preview_text`, `theme_background`, `theme_text`, `theme_muted`, `theme_accent`, and
11167
+ * `theme_font`. Omit it to keep the template's layout.
11168
+ */
11169
+ emailLayoutId?: string;
11170
+
11171
+ /**
11172
+ * Layout fields whose text starts the email when the template has no builder document yet.
11173
+ * @default ['content']
11174
+ */
11175
+ importFields?: string[];
11176
+
11177
+ /**
11178
+ * What the layout adds below every email, such as the sender's address and the unsubscribe
11179
+ * line. The canvas shows it as a locked section, so authors know what the recipient sees.
11180
+ */
11181
+ footer?: ReactNode;
11182
+
11183
+ /** Shows the email without editing, for example after it was sent. It keeps its saved design. */
11184
+ readOnly?: boolean;
11185
+ };
11186
+
11187
+ type EmailBuilderState = {
11188
+ /** True when every edit is saved. */
11189
+ isSaved: boolean;
11190
+ isSaving: boolean;
11191
+ /** Number of blocks the author must finish. A send refuses the email until it is zero. */
11192
+ issueCount: number;
11193
+ };
11194
+
11195
+ type EmailBuilderRecipient = {
11196
+ resourceId: string;
11197
+ recordId: string;
11198
+ email: string;
11199
+ name?: string;
11200
+ };
11201
+
11202
+ type EmailBuilderLink = {
11203
+ /** Name of the generated link. Lowercase letters, numbers, and underscores. */
11204
+ key: string;
11205
+ /** What the author reads in the link menu, such as `Member portal`. */
11206
+ label: string;
11207
+ /** Page that the link opens. */
11208
+ pageId: string;
11209
+ };
11210
+
11005
11211
  type EmailComposerProps = EmailComposerSendProps | EmailComposerDraftProps;
11006
11212
 
11007
11213
  type EmailComposerSendProps = EmailComposerBaseProps & {
@@ -11785,8 +11991,6 @@ type FormContentInputProps = Omit<
11785
11991
 
11786
11992
  type UiFormContentInputProps<A = any, B = any, C = any, D = any> = any;
11787
11993
 
11788
- type JSONContent<A = any, B = any, C = any, D = any> = any;
11789
-
11790
11994
  type ContentSettings = {
11791
11995
  extensions?: ExtensionsSettings;
11792
11996
  placeholder?: string | null;
@@ -14941,11 +15145,13 @@ declare namespace Sdk {
14941
15145
  export type NotificationTemplateEmailDraft = import("diagonal:sdk-internal").SdkNotificationTemplateEmailDraft;
14942
15146
  export type NotificationTemplateReference = import("diagonal:sdk-internal").SdkNotificationTemplateReference;
14943
15147
  export type NotificationTemplateContent = import("diagonal:sdk-internal").SdkNotificationTemplateContent;
15148
+ export type EmailDocument = import("diagonal:sdk-internal").SdkEmailDocument;
14944
15149
  export type NotificationTemplateDefinition = import("diagonal:sdk-internal").SdkNotificationTemplateDefinition;
14945
15150
  export type SaveNotificationTemplateInput = import("diagonal:sdk-internal").SdkSaveNotificationTemplateInput;
14946
15151
  export type UseSaveNotificationTemplateOptions = import("diagonal:sdk-internal").SdkUseSaveNotificationTemplateOptions;
14947
15152
  export type SaveNotificationTemplateHandle = import("diagonal:sdk-internal").SdkSaveNotificationTemplateHandle;
14948
15153
  export type NavigationMenu = import("diagonal:sdk-internal").SdkNavigationMenu;
15154
+ export type NavigationMenuModule = import("diagonal:sdk-internal").SdkNavigationMenuModule;
14949
15155
  export type NavigationMenuCatalog = import("diagonal:sdk-internal").SdkNavigationMenuCatalog;
14950
15156
  export type SystemSettingsPage = import("diagonal:sdk-internal").SdkSystemSettingsPage;
14951
15157
  export type SystemSettingsPageEntry = import("diagonal:sdk-internal").SdkSystemSettingsPageEntry;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diagonal-hq/cli",
3
- "version": "0.43.3",
3
+ "version": "0.45.0",
4
4
  "description": "The diagonal CLI and the configuration helpers for file-based Diagonal workspaces.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "repository": {