@trycourier/courier 9.4.2 → 9.4.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.
Files changed (44) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/client.d.mts +1 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +1 -0
  5. package/client.d.ts.map +1 -1
  6. package/package.json +1 -1
  7. package/resources/journeys/templates.d.mts +8 -1
  8. package/resources/journeys/templates.d.mts.map +1 -1
  9. package/resources/journeys/templates.d.ts +8 -1
  10. package/resources/journeys/templates.d.ts.map +1 -1
  11. package/resources/journeys/templates.js +8 -1
  12. package/resources/journeys/templates.js.map +1 -1
  13. package/resources/journeys/templates.mjs +8 -1
  14. package/resources/journeys/templates.mjs.map +1 -1
  15. package/resources/notifications/notifications.d.mts +16 -3
  16. package/resources/notifications/notifications.d.mts.map +1 -1
  17. package/resources/notifications/notifications.d.ts +16 -3
  18. package/resources/notifications/notifications.d.ts.map +1 -1
  19. package/resources/notifications/notifications.js +10 -0
  20. package/resources/notifications/notifications.js.map +1 -1
  21. package/resources/notifications/notifications.mjs +10 -0
  22. package/resources/notifications/notifications.mjs.map +1 -1
  23. package/resources/shared.d.mts +66 -5
  24. package/resources/shared.d.mts.map +1 -1
  25. package/resources/shared.d.ts +66 -5
  26. package/resources/shared.d.ts.map +1 -1
  27. package/resources/tenants/templates/templates.d.mts +11 -1
  28. package/resources/tenants/templates/templates.d.mts.map +1 -1
  29. package/resources/tenants/templates/templates.d.ts +11 -1
  30. package/resources/tenants/templates/templates.d.ts.map +1 -1
  31. package/resources/tenants/templates/templates.js +11 -1
  32. package/resources/tenants/templates/templates.js.map +1 -1
  33. package/resources/tenants/templates/templates.mjs +11 -1
  34. package/resources/tenants/templates/templates.mjs.map +1 -1
  35. package/src/client.ts +1 -0
  36. package/src/resources/journeys/templates.ts +8 -1
  37. package/src/resources/notifications/notifications.ts +16 -3
  38. package/src/resources/shared.ts +83 -6
  39. package/src/resources/tenants/templates/templates.ts +11 -1
  40. package/src/version.ts +1 -1
  41. package/version.d.mts +1 -1
  42. package/version.d.ts +1 -1
  43. package/version.js +1 -1
  44. package/version.mjs +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"templates.mjs","sourceRoot":"","sources":["../../../src/resources/tenants/templates/templates.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,mCAA+B;AAGrD,OAAO,KAAK,WAAW,uBAAmB;AAC1C,OAAO,EAAyB,QAAQ,EAAE,uBAAmB;AAE7D,OAAO,EAAE,YAAY,EAAE,sCAAkC;AAEzD,OAAO,EAAE,IAAI,EAAE,yCAAqC;AAEpD;;GAEG;AACH,MAAM,OAAO,SAAU,SAAQ,WAAW;IAA1C;;QACE,aAAQ,GAAyB,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAkH1E,CAAC;IAhHC;;;;;;;;;;;OAWG;IACH,QAAQ,CACN,UAAkB,EAClB,MAA8B,EAC9B,OAAwB;QAExB,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,YAAY,SAAS,cAAc,UAAU,EAAE,EAAE,OAAO,CAAC,CAAC;IACxF,CAAC;IAED;;;;;;;;;;OAUG;IACH,IAAI,CACF,QAAgB,EAChB,QAA+C,EAAE,EACjD,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,YAAY,QAAQ,YAAY,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACvF,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CAAC,UAAkB,EAAE,MAA4B,EAAE,OAAwB;QAC/E,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAAC;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI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;;;;;OA6BG;IACH,OAAO,CACL,UAAkB,EAClB,MAA6B,EAC7B,OAAwB;QAExB,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QACtC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,YAAY,SAAS,cAAc,UAAU,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACrG,CAAC;CACF;AA8GD,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAC"}
package/src/client.ts CHANGED
@@ -1457,6 +1457,7 @@ export declare namespace Courier {
1457
1457
  export type ElementalMetaNode = API.ElementalMetaNode;
1458
1458
  export type ElementalMetaNodeWithType = API.ElementalMetaNodeWithType;
1459
1459
  export type ElementalNode = API.ElementalNode;
1460
+ export type ElementalNodeNonChannel = API.ElementalNodeNonChannel;
1460
1461
  export type ElementalQuoteNode = API.ElementalQuoteNode;
1461
1462
  export type ElementalQuoteNodeWithType = API.ElementalQuoteNodeWithType;
1462
1463
  export type ElementalTextNode = API.ElementalTextNode;
@@ -17,6 +17,13 @@ export class Templates extends APIResource {
17
17
  * Create a notification template scoped to this journey. Defaults to `DRAFT`
18
18
  * state; pass `state: "PUBLISHED"` to publish on create.
19
19
  *
20
+ * The content tree must contain exactly one channel block whose `channel` matches
21
+ * the `channel` on the request — a journey-scoped template carries a single
22
+ * channel. Top-level elements, or a block for a different channel, return `400`.
23
+ * The template designer renders only the channel block matching the tab it draws,
24
+ * so content stored without one cannot be opened. An empty `elements` array is
25
+ * accepted.
26
+ *
20
27
  * @example
21
28
  * ```ts
22
29
  * const journeyTemplateGetResponse =
@@ -29,7 +36,7 @@ export class Templates extends APIResource {
29
36
  * subscription: null,
30
37
  * content: {
31
38
  * version: '2022-01-01',
32
- * elements: [{ type: 'text' }],
39
+ * elements: [{ type: 'channel' }],
33
40
  * },
34
41
  * },
35
42
  * });
@@ -26,6 +26,16 @@ export class Notifications extends APIResource {
26
26
  * Create a notification template. Requires all fields in the notification object.
27
27
  * Templates are created in draft state by default.
28
28
  *
29
+ * Content must place its elements inside a channel block —
30
+ * `{ "type": "channel", "channel": "email", "elements": [...] }` — or the request
31
+ * returns `400`. The template designer renders only the channel block matching the
32
+ * tab it draws, so content stored without one cannot be opened. An empty
33
+ * `elements` array is accepted, and the requirement applies to creation only:
34
+ * `PUT /notifications/{id}` still accepts unwrapped content. Note this endpoint
35
+ * takes versioned content only — the `{ title, body }` shorthand accepted by
36
+ * `/send` is rejected here with an `invalid_request_error` on
37
+ * `notification.content.version`.
38
+ *
29
39
  * @example
30
40
  * ```ts
31
41
  * const notificationTemplateResponse =
@@ -864,9 +874,12 @@ export interface NotificationTemplateSummary {
864
874
  }
865
875
 
866
876
  /**
867
- * Request body for replacing a notification template. Same shape as create. All
868
- * fields required (PUT = full replacement), except `alias`, whose omission means
869
- * "leave the existing aliases alone".
877
+ * Request body for replacing a notification template. All fields are required,
878
+ * since `PUT` is a full replacement, except `alias`, whose omission leaves the
879
+ * existing aliases in place. Unlike `NotificationTemplateCreateRequest`,
880
+ * `notification.content` is not required to place its elements inside a channel
881
+ * block: the requirement applies to creation only, so templates already stored
882
+ * without one stay editable.
870
883
  */
871
884
  export interface NotificationTemplateUpdateRequest {
872
885
  /**
@@ -225,6 +225,13 @@ export interface ElementalChannelNode extends ElementalBaseNode {
225
225
  */
226
226
  channel?: string;
227
227
 
228
+ /**
229
+ * An array of elements to apply to the channel. If `raw` has not been specified,
230
+ * `elements` is `required`. Channel elements cannot nest, so these are any node
231
+ * except another channel block.
232
+ */
233
+ elements?: Array<ElementalNodeNonChannel> | null;
234
+
228
235
  /**
229
236
  * Email only. Document-level base font size (CSS px, e.g. `16px`) for body content
230
237
  * — text, quote, list and action button labels. Heading styles (`h1`/`h2`/`h3`)
@@ -422,6 +429,76 @@ export type ElementalNode =
422
429
  | ElementalQuoteNodeWithType
423
430
  | ElementalHTMLNodeWithType;
424
431
 
432
+ /**
433
+ * Any Elemental node except a channel block. Channel elements are only valid as
434
+ * top-level elements, so the `elements` nested inside one can never be another
435
+ * channel. Keeping this union channel-free also keeps the schema acyclic; a
436
+ * recursive `$ref` here breaks the generated Python models.
437
+ */
438
+ export type ElementalNodeNonChannel =
439
+ | ElementalNodeNonChannel.UnionMember0
440
+ | ElementalNodeNonChannel.UnionMember1
441
+ | ElementalNodeNonChannel.UnionMember2
442
+ | ElementalNodeNonChannel.UnionMember3
443
+ | ElementalNodeNonChannel.UnionMember4
444
+ | ElementalNodeNonChannel.UnionMember5
445
+ | ElementalNodeNonChannel.UnionMember6;
446
+
447
+ export namespace ElementalNodeNonChannel {
448
+ /**
449
+ * Represents a body of text to be rendered inside of the notification.
450
+ */
451
+ export interface UnionMember0 extends Shared.ElementalTextNode {
452
+ type?: 'text';
453
+ }
454
+
455
+ /**
456
+ * The meta element contains information describing the notification that may be
457
+ * used by a particular channel or provider. One important field is the title field
458
+ * which will be used as the title for channels that support it.
459
+ */
460
+ export interface UnionMember1 extends Shared.ElementalMetaNode {
461
+ type?: 'meta';
462
+ }
463
+
464
+ /**
465
+ * Used to embed an image into the notification.
466
+ */
467
+ export interface UnionMember2 extends Shared.ElementalImageNode {
468
+ type?: 'image';
469
+ }
470
+
471
+ /**
472
+ * Allows the user to execute an action. Can be a button or a link.
473
+ */
474
+ export interface UnionMember3 extends Shared.ElementalActionNode {
475
+ type?: 'action';
476
+ }
477
+
478
+ /**
479
+ * Renders a dividing line between elements.
480
+ */
481
+ export interface UnionMember4 extends Shared.ElementalDividerNode {
482
+ type?: 'divider';
483
+ }
484
+
485
+ /**
486
+ * Renders a quote block.
487
+ */
488
+ export interface UnionMember5 extends Shared.ElementalQuoteNode {
489
+ type?: 'quote';
490
+ }
491
+
492
+ /**
493
+ * Raw HTML string inside an Elemental document. When rendering a message, this
494
+ * node is turned into output only for the email channel; for other channels it
495
+ * produces no blocks.
496
+ */
497
+ export interface UnionMember6 extends Shared.ElementalHTMLNode {
498
+ type?: 'html';
499
+ }
500
+ }
501
+
425
502
  /**
426
503
  * Renders a quote block.
427
504
  */
@@ -474,12 +551,6 @@ export interface ElementalQuoteNodeWithType extends ElementalQuoteNode {
474
551
  * Represents a body of text to be rendered inside of the notification.
475
552
  */
476
553
  export interface ElementalTextNode extends ElementalBaseNode {
477
- /**
478
- * The text content displayed in the notification. Either this field must be
479
- * specified, or the elements field
480
- */
481
- content: string;
482
-
483
554
  /**
484
555
  * Text alignment.
485
556
  */
@@ -495,6 +566,12 @@ export interface ElementalTextNode extends ElementalBaseNode {
495
566
  */
496
567
  color?: string | null;
497
568
 
569
+ /**
570
+ * The text content displayed in the notification. Either this field must be
571
+ * specified, or the elements field
572
+ */
573
+ content?: string;
574
+
498
575
  /**
499
576
  * CSS px font size for this text block, e.g. `16px`. Overrides the size of the
500
577
  * `text_style` preset. Email only.
@@ -104,6 +104,16 @@ export class Templates extends APIResource {
104
104
  * Creates or updates a notification template scoped to one tenant, letting a
105
105
  * tenant override the content the workspace template would send.
106
106
  *
107
+ * This is an upsert: it creates when the tenant has no template under
108
+ * `template_id`, and updates when it does. On the create half, content must place
109
+ * its elements inside a channel block —
110
+ * `{ "type": "channel", "channel": "email", "elements": [...] }` — or the request
111
+ * returns `400`. The template designer renders only the channel block matching the
112
+ * tab it draws, so content stored without one cannot be opened. An empty
113
+ * `elements` array is accepted, as is the `{ title, body }` shorthand, which has
114
+ * no elements to wrap. Updates are not checked, so tenant templates already stored
115
+ * without a wrapper stay editable.
116
+ *
107
117
  * @example
108
118
  * ```ts
109
119
  * const putTenantTemplateResponse =
@@ -112,7 +122,7 @@ export class Templates extends APIResource {
112
122
  * template: {
113
123
  * content: {
114
124
  * version: '2022-01-01',
115
- * elements: [{ type: 'text' }],
125
+ * elements: [{ type: 'channel' }],
116
126
  * },
117
127
  * routing: { method: 'single', channels: ['email'] },
118
128
  * },
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '9.4.2'; // x-release-please-version
1
+ export const VERSION = '9.4.4'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "9.4.2";
1
+ export declare const VERSION = "9.4.4";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "9.4.2";
1
+ export declare const VERSION = "9.4.4";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '9.4.2'; // x-release-please-version
4
+ exports.VERSION = '9.4.4'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '9.4.2'; // x-release-please-version
1
+ export const VERSION = '9.4.4'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map