@diagonal-hq/cli 0.28.3 → 0.28.4
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 +3 -1
- package/dist/sdk-contract.d.ts +91 -16
- package/package.json +1 -1
package/dist/sdk-contract.d.ts
CHANGED
|
@@ -2814,6 +2814,26 @@ type SdkNotificationTemplateList = {
|
|
|
2814
2814
|
pagination: ResourcePagination;
|
|
2815
2815
|
};
|
|
2816
2816
|
|
|
2817
|
+
type SdkNotificationTemplateEmailDraft = {
|
|
2818
|
+
notification_template_id: string;
|
|
2819
|
+
notification_template_name: string;
|
|
2820
|
+
notification_type_id: string;
|
|
2821
|
+
notification_type_name: string;
|
|
2822
|
+
/** The type's recipient resource. Its templates read the recipient as `{{ record.<field> }}`. */
|
|
2823
|
+
notifiable_resource_id: string | null;
|
|
2824
|
+
/** Liquid source, such as `Hi {{ first_name | upcase }}`. */
|
|
2825
|
+
subject: string;
|
|
2826
|
+
/** The template's published layout, or null for the default body. */
|
|
2827
|
+
email_layout_id: string | null;
|
|
2828
|
+
/**
|
|
2829
|
+
* Every field the layout declares, or `content` without a layout, as the template
|
|
2830
|
+
* saved it. Liquid fields are source strings. A field the template leaves empty is null.
|
|
2831
|
+
*/
|
|
2832
|
+
layout_data: Record<string, any>;
|
|
2833
|
+
/** The values the template's type takes. Supply them per recipient in `data`. */
|
|
2834
|
+
variables: SdkNotificationVariableSummary[];
|
|
2835
|
+
};
|
|
2836
|
+
|
|
2817
2837
|
type SdkNavigationMenu = {
|
|
2818
2838
|
id: string;
|
|
2819
2839
|
name: string;
|
|
@@ -7453,6 +7473,34 @@ type SdkHooks = {
|
|
|
7453
7473
|
notificationTypeId: string | null | undefined,
|
|
7454
7474
|
options?: SdkNotificationListOptions
|
|
7455
7475
|
): SdkApiHandle<SdkNotificationTemplateList>;
|
|
7476
|
+
/**
|
|
7477
|
+
* Read a template's saved email subject and layout fields as unrendered Liquid, with
|
|
7478
|
+
* its published layout and the variables of its type. Requires send_emails; does not
|
|
7479
|
+
* require manage_notifications. No request runs until notificationTemplateId is set.
|
|
7480
|
+
* Reading never changes the template. Embedded files the viewer cannot read are removed.
|
|
7481
|
+
* The request fails with 422 for a template without email, without a published layout,
|
|
7482
|
+
* or with copy that only a notification send resolves: `{{ ref }}` generated values, a
|
|
7483
|
+
* field bound to a notification variable, or Liquid in a typed field.
|
|
7484
|
+
* To edit and send the draft, prefer `<Sdk.Components.EmailComposer notificationTemplateId>`,
|
|
7485
|
+
* which loads it for you. Without the composer, send it with useSendEmail in bulk mode:
|
|
7486
|
+
* the send renders the subject and Liquid fields once for each recipient's `data`.
|
|
7487
|
+
* Do not preview a template with placeholder variables and send the result: filters,
|
|
7488
|
+
* defaults, and conditions would read the placeholder.
|
|
7489
|
+
* @example
|
|
7490
|
+
* const draft = Sdk.hooks.useNotificationTemplateEmailDraft(templateId);
|
|
7491
|
+
* const email = Sdk.hooks.useSendEmail();
|
|
7492
|
+
* await email.send({
|
|
7493
|
+
* bulk: true,
|
|
7494
|
+
* to: members.map((m) => ({ email: m.email, data: { first_name: m.first_name } })),
|
|
7495
|
+
* subject: draft.data.subject,
|
|
7496
|
+
* email_layout_id: draft.data.email_layout_id,
|
|
7497
|
+
* layout_data: draft.data.layout_data
|
|
7498
|
+
* });
|
|
7499
|
+
*/
|
|
7500
|
+
useNotificationTemplateEmailDraft(
|
|
7501
|
+
notificationTemplateId: string | null | undefined,
|
|
7502
|
+
options?: { enabled?: boolean }
|
|
7503
|
+
): SdkApiHandle<SdkNotificationTemplateEmailDraft>;
|
|
7456
7504
|
|
|
7457
7505
|
/**
|
|
7458
7506
|
* List pending and failed notifications associated with one source or recipient record.
|
|
@@ -10677,7 +10725,9 @@ type DropdownMenuItem = {
|
|
|
10677
10725
|
onSelect?: () => void;
|
|
10678
10726
|
};
|
|
10679
10727
|
|
|
10680
|
-
type EmailComposerProps = EmailComposerBaseProps &
|
|
10728
|
+
type EmailComposerProps = EmailComposerBaseProps &
|
|
10729
|
+
EmailComposerContentProps &
|
|
10730
|
+
EmailComposerAudienceProps;
|
|
10681
10731
|
|
|
10682
10732
|
type EmailComposerBaseProps = {
|
|
10683
10733
|
/**
|
|
@@ -10706,13 +10756,6 @@ type EmailComposerBaseProps = {
|
|
|
10706
10756
|
*/
|
|
10707
10757
|
variables?: EmailComposerVariable[];
|
|
10708
10758
|
|
|
10709
|
-
/**
|
|
10710
|
-
* Published email layout that wraps the body. When set, the layout is fixed and the
|
|
10711
|
-
* picker is hidden. When omitted, the toolbar offers the workspace's published
|
|
10712
|
-
* layouts, or no layout at all.
|
|
10713
|
-
*/
|
|
10714
|
-
emailLayoutId?: string | null;
|
|
10715
|
-
|
|
10716
10759
|
/**
|
|
10717
10760
|
* Values every email can read as `{{ key }}` — the same for all recipients, and
|
|
10718
10761
|
* the defaults for any variables the chosen layout declares. Recipient `data`
|
|
@@ -10723,14 +10766,6 @@ type EmailComposerBaseProps = {
|
|
|
10723
10766
|
*/
|
|
10724
10767
|
data?: Record<string, any>;
|
|
10725
10768
|
|
|
10726
|
-
/**
|
|
10727
|
-
* Subject the composer opens with, as Liquid source, so it can use `{{ name }}` and
|
|
10728
|
-
* the other variables. The viewer can edit it, and "Send another" restores it. The
|
|
10729
|
-
* composer reads it once, when it mounts: give the component a new `key` to start
|
|
10730
|
-
* again from a new subject and new `data`.
|
|
10731
|
-
*/
|
|
10732
|
-
initialSubject?: string;
|
|
10733
|
-
|
|
10734
10769
|
/**
|
|
10735
10770
|
* Called after the email is queued.
|
|
10736
10771
|
*/
|
|
@@ -10755,6 +10790,45 @@ type EmailComposerVariable = {
|
|
|
10755
10790
|
type?: 'text' | 'number' | 'boolean' | 'date';
|
|
10756
10791
|
};
|
|
10757
10792
|
|
|
10793
|
+
type EmailComposerContentProps =
|
|
10794
|
+
| {
|
|
10795
|
+
/**
|
|
10796
|
+
* Saved notification template the composer starts from, by ID. The composer
|
|
10797
|
+
* loads its subject, layout, and layout fields as Liquid source, and the send
|
|
10798
|
+
* renders them once for each recipient, so filters, defaults, and conditions
|
|
10799
|
+
* read that recipient's `data`. The template's layout is fixed, and its type's
|
|
10800
|
+
* variables fill the `{{` menu when `variables` is omitted. The edits change
|
|
10801
|
+
* only this email, never the template. Requires `send_emails`, not
|
|
10802
|
+
* `manage_notifications`.
|
|
10803
|
+
*
|
|
10804
|
+
* The composer shows a loading state, then the draft. A failed load shows the
|
|
10805
|
+
* reason with a "Try again" button; templates that only a notification send can
|
|
10806
|
+
* render fail this way. The draft is read once per mount and is not refreshed
|
|
10807
|
+
* in the background, so it never replaces the viewer's edits. A different ID
|
|
10808
|
+
* discards the edits and loads that template. A new `key` reloads the same
|
|
10809
|
+
* template. "Send another" restores the template's copy.
|
|
10810
|
+
*/
|
|
10811
|
+
notificationTemplateId: string;
|
|
10812
|
+
emailLayoutId?: never;
|
|
10813
|
+
initialSubject?: never;
|
|
10814
|
+
}
|
|
10815
|
+
| {
|
|
10816
|
+
notificationTemplateId?: undefined;
|
|
10817
|
+
/**
|
|
10818
|
+
* Published email layout that wraps the body. When set, the layout is fixed and the
|
|
10819
|
+
* picker is hidden. When omitted, the toolbar offers the workspace's published
|
|
10820
|
+
* layouts, or no layout at all.
|
|
10821
|
+
*/
|
|
10822
|
+
emailLayoutId?: string | null;
|
|
10823
|
+
/**
|
|
10824
|
+
* Subject the composer opens with, as Liquid source, so it can use `{{ name }}` and
|
|
10825
|
+
* the other variables. The viewer can edit it, and "Send another" restores it. The
|
|
10826
|
+
* composer reads it once, when it mounts: give the component a new `key` to start
|
|
10827
|
+
* again from a new subject and new `data`.
|
|
10828
|
+
*/
|
|
10829
|
+
initialSubject?: string;
|
|
10830
|
+
};
|
|
10831
|
+
|
|
10758
10832
|
type EmailComposerAudienceProps =
|
|
10759
10833
|
| {
|
|
10760
10834
|
/**
|
|
@@ -14528,6 +14602,7 @@ declare namespace Sdk {
|
|
|
14528
14602
|
export type NotificationTemplateSummary = import("diagonal:sdk-internal").SdkNotificationTemplateSummary;
|
|
14529
14603
|
export type NotificationTypeList = import("diagonal:sdk-internal").SdkNotificationTypeList;
|
|
14530
14604
|
export type NotificationTemplateList = import("diagonal:sdk-internal").SdkNotificationTemplateList;
|
|
14605
|
+
export type NotificationTemplateEmailDraft = import("diagonal:sdk-internal").SdkNotificationTemplateEmailDraft;
|
|
14531
14606
|
export type NavigationMenu = import("diagonal:sdk-internal").SdkNavigationMenu;
|
|
14532
14607
|
export type NavigationMenuCatalog = import("diagonal:sdk-internal").SdkNavigationMenuCatalog;
|
|
14533
14608
|
export type SystemSettingsPage = import("diagonal:sdk-internal").SdkSystemSettingsPage;
|