@diagonal-hq/cli 0.35.7 → 0.36.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.
- package/dist/cli.mjs +1876 -2175
- package/dist/sdk-contract.d.ts +130 -2
- package/package.json +4 -4
package/dist/sdk-contract.d.ts
CHANGED
|
@@ -2834,6 +2834,63 @@ type SdkNotificationTemplateEmailDraft = {
|
|
|
2834
2834
|
variables: SdkNotificationVariableSummary[];
|
|
2835
2835
|
};
|
|
2836
2836
|
|
|
2837
|
+
type SdkNotificationTemplateReference = {
|
|
2838
|
+
label: string;
|
|
2839
|
+
resolver: Record<string, any>;
|
|
2840
|
+
};
|
|
2841
|
+
|
|
2842
|
+
type SdkNotificationTemplateContent = {
|
|
2843
|
+
notification_type_id: string;
|
|
2844
|
+
/** Liquid source, such as `News for {{ record.first_name | default: "friend" }}`. */
|
|
2845
|
+
email_subject: string;
|
|
2846
|
+
/** The template's published layout, or null for the default body. */
|
|
2847
|
+
email_layout_id: string | null;
|
|
2848
|
+
/** Layout field values. A Liquid field is a source string; a bound field keeps its `context.get` value. */
|
|
2849
|
+
email_layout_data: Record<string, any>;
|
|
2850
|
+
/** The generated values that the content reads as `{{ ref.<key> }}`. */
|
|
2851
|
+
references: Record<string, SdkNotificationTemplateReference>;
|
|
2852
|
+
};
|
|
2853
|
+
|
|
2854
|
+
type SdkNotificationTemplateDefinition = SdkNotificationTemplateContent & {
|
|
2855
|
+
id: string;
|
|
2856
|
+
name: string;
|
|
2857
|
+
notification_type_name: string;
|
|
2858
|
+
email_layout_name: string | null;
|
|
2859
|
+
is_default: boolean;
|
|
2860
|
+
is_email_enabled: boolean;
|
|
2861
|
+
is_sms_enabled: boolean;
|
|
2862
|
+
sms_body: string | null;
|
|
2863
|
+
};
|
|
2864
|
+
|
|
2865
|
+
type SdkSaveNotificationTemplateInput = SdkNotificationTemplateContent & {
|
|
2866
|
+
id?: string;
|
|
2867
|
+
name: string;
|
|
2868
|
+
};
|
|
2869
|
+
|
|
2870
|
+
type SdkUseSaveNotificationTemplateOptions = {
|
|
2871
|
+
onSuccess?: (template: SdkNotificationTemplateDefinition) => void;
|
|
2872
|
+
onError?: (error: SdkApiError) => void;
|
|
2873
|
+
};
|
|
2874
|
+
|
|
2875
|
+
type SdkSaveNotificationTemplateHandle = {
|
|
2876
|
+
/**
|
|
2877
|
+
* Save the template. Resolves with the saved definition, or `null` when the request
|
|
2878
|
+
* failed. It never rejects. Read `error` for the failure.
|
|
2879
|
+
*/
|
|
2880
|
+
save: (
|
|
2881
|
+
input: SdkSaveNotificationTemplateInput
|
|
2882
|
+
) => Promise<SdkNotificationTemplateDefinition | null>;
|
|
2883
|
+
/** The definition of the most recent successful save. */
|
|
2884
|
+
data: SdkNotificationTemplateDefinition | undefined;
|
|
2885
|
+
/** `true` while a request is in flight. */
|
|
2886
|
+
isPending: boolean;
|
|
2887
|
+
isError: boolean;
|
|
2888
|
+
/** The failed request's {@link SdkApiError} (with `status` and `body`), or `null`. */
|
|
2889
|
+
error: SdkApiError | null;
|
|
2890
|
+
/** Clears `data`, `error`, and `isError` back to their initial state. */
|
|
2891
|
+
reset: () => void;
|
|
2892
|
+
};
|
|
2893
|
+
|
|
2837
2894
|
type SdkNavigationMenu = {
|
|
2838
2895
|
id: string;
|
|
2839
2896
|
name: string;
|
|
@@ -7535,6 +7592,31 @@ type SdkHooks = {
|
|
|
7535
7592
|
notificationTemplateId: string | null | undefined,
|
|
7536
7593
|
options?: { enabled?: boolean }
|
|
7537
7594
|
): SdkApiHandle<SdkNotificationTemplateEmailDraft>;
|
|
7595
|
+
/**
|
|
7596
|
+
* Read a saved notification template with its raw subject, layout, layout fields, and
|
|
7597
|
+
* generated references. Requires manage_notifications. No request runs until
|
|
7598
|
+
* notificationTemplateId is set. To edit the content in the page, use
|
|
7599
|
+
* `<Sdk.Components.EmailComposer mode="draft" notificationTemplateId>`.
|
|
7600
|
+
* @example
|
|
7601
|
+
* const campaign = Sdk.hooks.useNotificationTemplate(campaignTemplateId);
|
|
7602
|
+
*/
|
|
7603
|
+
useNotificationTemplate(
|
|
7604
|
+
notificationTemplateId: string | null | undefined,
|
|
7605
|
+
options?: { enabled?: boolean }
|
|
7606
|
+
): SdkApiHandle<SdkNotificationTemplateDefinition>;
|
|
7607
|
+
/**
|
|
7608
|
+
* Create or replace a notification template through `/api/notification-templates`.
|
|
7609
|
+
* Requires manage_notifications. Without `id`, the save creates a new template of the
|
|
7610
|
+
* type, for example a campaign copy of a starting template, and the starting template
|
|
7611
|
+
* does not change. With `id`, it replaces that template's name and email content.
|
|
7612
|
+
* The save validates the content as the notification editor does. Saving sends no email.
|
|
7613
|
+
* @example
|
|
7614
|
+
* const { save, isPending, error } = Sdk.hooks.useSaveNotificationTemplate();
|
|
7615
|
+
* const saved = await save({ ...draft, id: campaignTemplateId ?? undefined, name: 'Feature spotlight' });
|
|
7616
|
+
*/
|
|
7617
|
+
useSaveNotificationTemplate(
|
|
7618
|
+
options?: SdkUseSaveNotificationTemplateOptions
|
|
7619
|
+
): SdkSaveNotificationTemplateHandle;
|
|
7538
7620
|
|
|
7539
7621
|
/**
|
|
7540
7622
|
* List pending and failed notifications associated with one source or recipient record.
|
|
@@ -10759,8 +10841,11 @@ type DropdownMenuItem = {
|
|
|
10759
10841
|
onSelect?: () => void;
|
|
10760
10842
|
};
|
|
10761
10843
|
|
|
10762
|
-
type EmailComposerProps =
|
|
10763
|
-
|
|
10844
|
+
type EmailComposerProps = EmailComposerSendProps | EmailComposerDraftProps;
|
|
10845
|
+
|
|
10846
|
+
type EmailComposerSendProps = EmailComposerBaseProps & {
|
|
10847
|
+
mode?: 'send';
|
|
10848
|
+
} & EmailComposerContentProps &
|
|
10764
10849
|
EmailComposerAudienceProps;
|
|
10765
10850
|
|
|
10766
10851
|
type EmailComposerBaseProps = {
|
|
@@ -10912,6 +10997,43 @@ type EmailComposerRecipient = {
|
|
|
10912
10997
|
| { resourceId: string; recordId: string }
|
|
10913
10998
|
);
|
|
10914
10999
|
|
|
11000
|
+
type EmailComposerDraftProps = {
|
|
11001
|
+
/**
|
|
11002
|
+
* `draft` edits a notification template's content without sending it. The composer
|
|
11003
|
+
* shows **Subject** and the email, but no **To** and no send button. The page saves
|
|
11004
|
+
* the content from `onDraftChange`, for example with `Sdk.hooks.useSaveNotificationTemplate`.
|
|
11005
|
+
* Requires `manage_notifications` and `send_emails`.
|
|
11006
|
+
*/
|
|
11007
|
+
mode: 'draft';
|
|
11008
|
+
|
|
11009
|
+
/**
|
|
11010
|
+
* Notification template the draft starts from: a starting template, or the page's
|
|
11011
|
+
* own saved campaign copy. The composer loads its raw subject, fixed layout, layout
|
|
11012
|
+
* fields, and generated `{{ ref.<key> }}` values once per mount and never refreshes
|
|
11013
|
+
* them in the background. A different ID or a new `key` discards the edits.
|
|
11014
|
+
*/
|
|
11015
|
+
notificationTemplateId: string;
|
|
11016
|
+
|
|
11017
|
+
/**
|
|
11018
|
+
* Called with the raw content after each edit. Before the first edit the draft is
|
|
11019
|
+
* the loaded template, which `Sdk.hooks.useNotificationTemplate` reads. Liquid,
|
|
11020
|
+
* bound fields, and references stay unrendered. Save it without `id` to make a new
|
|
11021
|
+
* template, so the starting template does not change.
|
|
11022
|
+
*/
|
|
11023
|
+
onDraftChange?: (draft: SdkNotificationTemplateContent) => void;
|
|
11024
|
+
|
|
11025
|
+
/** Values of the type's variables that every preview reads. A recipient's `data` overrides them. */
|
|
11026
|
+
data?: Record<string, any>;
|
|
11027
|
+
|
|
11028
|
+
/**
|
|
11029
|
+
* The failed save of this draft. Its field errors show on the subject and body.
|
|
11030
|
+
* The edits stay.
|
|
11031
|
+
*/
|
|
11032
|
+
error?: SdkApiError | null;
|
|
11033
|
+
|
|
11034
|
+
className?: string;
|
|
11035
|
+
} & EmailComposerAudienceProps;
|
|
11036
|
+
|
|
10915
11037
|
type EmailMessagesProps = {
|
|
10916
11038
|
/**
|
|
10917
11039
|
* Resource the record belongs to. Pair it with `recordId` for one record's history.
|
|
@@ -14637,6 +14759,12 @@ declare namespace Sdk {
|
|
|
14637
14759
|
export type NotificationTypeList = import("diagonal:sdk-internal").SdkNotificationTypeList;
|
|
14638
14760
|
export type NotificationTemplateList = import("diagonal:sdk-internal").SdkNotificationTemplateList;
|
|
14639
14761
|
export type NotificationTemplateEmailDraft = import("diagonal:sdk-internal").SdkNotificationTemplateEmailDraft;
|
|
14762
|
+
export type NotificationTemplateReference = import("diagonal:sdk-internal").SdkNotificationTemplateReference;
|
|
14763
|
+
export type NotificationTemplateContent = import("diagonal:sdk-internal").SdkNotificationTemplateContent;
|
|
14764
|
+
export type NotificationTemplateDefinition = import("diagonal:sdk-internal").SdkNotificationTemplateDefinition;
|
|
14765
|
+
export type SaveNotificationTemplateInput = import("diagonal:sdk-internal").SdkSaveNotificationTemplateInput;
|
|
14766
|
+
export type UseSaveNotificationTemplateOptions = import("diagonal:sdk-internal").SdkUseSaveNotificationTemplateOptions;
|
|
14767
|
+
export type SaveNotificationTemplateHandle = import("diagonal:sdk-internal").SdkSaveNotificationTemplateHandle;
|
|
14640
14768
|
export type NavigationMenu = import("diagonal:sdk-internal").SdkNavigationMenu;
|
|
14641
14769
|
export type NavigationMenuCatalog = import("diagonal:sdk-internal").SdkNavigationMenuCatalog;
|
|
14642
14770
|
export type SystemSettingsPage = import("diagonal:sdk-internal").SdkSystemSettingsPage;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diagonal-hq/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.36.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": {
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"bun": "1.4.4"
|
|
49
49
|
},
|
|
50
50
|
"optionalDependencies": {
|
|
51
|
-
"@diagonal-hq/workflow-script-compiler-darwin-arm64": "0.1.0-
|
|
52
|
-
"@diagonal-hq/workflow-script-compiler-linux-x64": "0.1.0-
|
|
53
|
-
"@diagonal-hq/workflow-script-compiler-linux-arm64": "0.1.0-
|
|
51
|
+
"@diagonal-hq/workflow-script-compiler-darwin-arm64": "0.1.0-h65d254b12835",
|
|
52
|
+
"@diagonal-hq/workflow-script-compiler-linux-x64": "0.1.0-h65d254b12835",
|
|
53
|
+
"@diagonal-hq/workflow-script-compiler-linux-arm64": "0.1.0-h65d254b12835"
|
|
54
54
|
}
|
|
55
55
|
}
|