@sentdm/sentdm 0.38.0 → 0.40.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/CHANGELOG.md +15 -0
- package/client.d.mts +4 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +4 -2
- package/client.d.ts.map +1 -1
- package/client.js +2 -0
- package/client.js.map +1 -1
- package/client.mjs +2 -0
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/conversations.d.mts +71 -3
- package/resources/conversations.d.mts.map +1 -1
- package/resources/conversations.d.ts +71 -3
- package/resources/conversations.d.ts.map +1 -1
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/messages.d.mts +171 -14
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +171 -14
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.js +21 -3
- package/resources/messages.js.map +1 -1
- package/resources/messages.mjs +21 -3
- package/resources/messages.mjs.map +1 -1
- package/resources/templates.d.mts +276 -14
- package/resources/templates.d.mts.map +1 -1
- package/resources/templates.d.ts +276 -14
- package/resources/templates.d.ts.map +1 -1
- package/resources/templates.js +28 -2
- package/resources/templates.js.map +1 -1
- package/resources/templates.mjs +28 -2
- package/resources/templates.mjs.map +1 -1
- package/resources/webhooks.d.mts +693 -22
- package/resources/webhooks.d.mts.map +1 -1
- package/resources/webhooks.d.ts +693 -22
- package/resources/webhooks.d.ts.map +1 -1
- package/src/client.ts +10 -0
- package/src/resources/conversations.ts +78 -3
- package/src/resources/index.ts +4 -0
- package/src/resources/messages.ts +182 -14
- package/src/resources/templates.ts +289 -14
- package/src/resources/webhooks.ts +764 -22
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { APIResource } from "../core/resource.mjs";
|
|
2
|
+
import * as TemplatesAPI from "./templates.mjs";
|
|
2
3
|
import * as WebhooksAPI from "./webhooks.mjs";
|
|
3
4
|
import { APIPromise } from "../core/api-promise.mjs";
|
|
4
5
|
import { PagePromise, TemplatesPage, type TemplatesPageParams } from "../core/pagination.mjs";
|
|
@@ -12,7 +13,9 @@ export declare class Templates extends APIResource {
|
|
|
12
13
|
/**
|
|
13
14
|
* Creates a new message template with header, body, footer, and buttons. The
|
|
14
15
|
* template can be submitted for review immediately or saved as draft for later
|
|
15
|
-
* submission.
|
|
16
|
+
* submission. There is no `name` field on create — the display name is derived
|
|
17
|
+
* from the template's content and can be changed afterwards with
|
|
18
|
+
* `PUT /v3/templates/{id}`.
|
|
16
19
|
*
|
|
17
20
|
* @example
|
|
18
21
|
* ```ts
|
|
@@ -34,7 +37,31 @@ export declare class Templates extends APIResource {
|
|
|
34
37
|
retrieve(id: string, params?: TemplateRetrieveParams | null | undefined, options?: RequestOptions): APIPromise<APIResponseTemplate>;
|
|
35
38
|
/**
|
|
36
39
|
* Updates an existing template's name, category, language, definition, or submits
|
|
37
|
-
* it for review.
|
|
40
|
+
* it for review. While the template is in review (status PENDING, or any channel
|
|
41
|
+
* awaiting a verdict) its definition, category and language are frozen and a
|
|
42
|
+
* resubmission is refused — those requests answer 409 CONFLICT_006. The display
|
|
43
|
+
* name stays editable throughout.
|
|
44
|
+
*
|
|
45
|
+
* `definition`, `category` and `language` are editable only from status DRAFT,
|
|
46
|
+
* REJECTED or APPROVED. An edit to any of them on a template in another state
|
|
47
|
+
* (PAUSED, DISABLED or REVOKED) is refused with 400 VALIDATION_001 and the detail
|
|
48
|
+
* "Template (except display name) cannot be updated unless it is in draft or
|
|
49
|
+
* rejected status"; `name` stays editable in every state. `submit_for_review` on a
|
|
50
|
+
* PAUSED, DISABLED or REVOKED template is accepted and answers 200, but opens no
|
|
51
|
+
* review and does not move the status — only the reviewer can reinstate it.
|
|
52
|
+
*
|
|
53
|
+
* Editing an APPROVED template is a live edit: the new content is stored
|
|
54
|
+
* immediately, and sending `submit_for_review: true` re-opens review, which
|
|
55
|
+
* returns the affected channels to PENDING so they stop sending until they are
|
|
56
|
+
* approved again. The previously approved content is never sent during re-review.
|
|
57
|
+
* Watch the per-channel `templates` webhook events rather than assuming the
|
|
58
|
+
* template-level status.
|
|
59
|
+
*
|
|
60
|
+
* Templates provisioned by Sent (light-onboarding templates, whose names carry the
|
|
61
|
+
* reserved `sent_` prefix) are read-only: every field is refused with 400
|
|
62
|
+
* VALIDATION*001 and the detail "This template is read-only. Only 'submit for
|
|
63
|
+
* review' is allowed.", and only `submit_for_review` is accepted. A `name`
|
|
64
|
+
* starting with `sent*` is refused for the same reason — the prefix is reserved.
|
|
38
65
|
*
|
|
39
66
|
* @example
|
|
40
67
|
* ```ts
|
|
@@ -120,12 +147,38 @@ export interface Template {
|
|
|
120
147
|
* Unique template identifier
|
|
121
148
|
*/
|
|
122
149
|
id?: string;
|
|
150
|
+
/**
|
|
151
|
+
* Which consent keyword this template answers, when it is one of Sent's
|
|
152
|
+
* auto-replies: OPT_IN, OPT_OUT, HELP, or OTHER for a customer-defined keyword.
|
|
153
|
+
* Null for an ordinary template, and omitted from the response, so its presence is
|
|
154
|
+
* the answer to "is this an auto-reply".
|
|
155
|
+
*
|
|
156
|
+
* Deliberately not required, unlike CustomerId, even though the same "no single
|
|
157
|
+
* mapper" argument applies: NJsonSchema publishes a C# required member in the
|
|
158
|
+
* schema's required array, so the contract would have advertised a field this
|
|
159
|
+
* response omits for every ordinary template, and a generated client could refuse
|
|
160
|
+
* the common case. A compile-time guard is not worth a wrong published contract.
|
|
161
|
+
* Every mapping site sets it explicitly, and TemplateResponseSchemaTests pins the
|
|
162
|
+
* field as optional so it cannot be reintroduced.
|
|
163
|
+
*/
|
|
164
|
+
auto_reply_action?: string | null;
|
|
123
165
|
/**
|
|
124
166
|
* Template category: MARKETING, UTILITY, AUTHENTICATION
|
|
125
167
|
*/
|
|
126
168
|
category?: string;
|
|
127
169
|
/**
|
|
128
|
-
*
|
|
170
|
+
* The channels this template's definition can render on, in canonical order: sms,
|
|
171
|
+
* whatsapp, rcs.
|
|
172
|
+
*
|
|
173
|
+
* Derived from the definition's body, mirroring each channel's send-time fallback
|
|
174
|
+
* chain, so a channel is listed only when a real body would be produced for it:
|
|
175
|
+
* SMS reads sms ?? multiChannel, WhatsApp reads whatsapp ?? multiChannel, and RCS
|
|
176
|
+
* reads rcs ?? multiChannel ?? sms. A multiChannel body therefore reports all
|
|
177
|
+
* three, and the extra SMS fallback on RCS is why an sms/whatsapp pair reports RCS
|
|
178
|
+
* too.
|
|
179
|
+
*
|
|
180
|
+
* This says what the content can render on, not what may be sent: sending also
|
|
181
|
+
* needs the template approved for that channel.
|
|
129
182
|
*/
|
|
130
183
|
channels?: Array<string> | null;
|
|
131
184
|
/**
|
|
@@ -145,7 +198,8 @@ export interface Template {
|
|
|
145
198
|
*/
|
|
146
199
|
name?: string;
|
|
147
200
|
/**
|
|
148
|
-
* Template status:
|
|
201
|
+
* Template status: DRAFT, PENDING, APPROVED, REJECTED. A template created with
|
|
202
|
+
* submit_for_review: false starts as DRAFT and stays there until it is submitted.
|
|
149
203
|
*/
|
|
150
204
|
status?: string;
|
|
151
205
|
/**
|
|
@@ -158,31 +212,131 @@ export interface Template {
|
|
|
158
212
|
variables?: Array<string> | null;
|
|
159
213
|
}
|
|
160
214
|
/**
|
|
161
|
-
* Body section of a message template
|
|
215
|
+
* Body section of a message template.
|
|
216
|
+
*
|
|
217
|
+
* A body picks one of two authoring strategies, and mixing them is refused
|
|
218
|
+
* (TemplateDefinitionValidator.HaveValidChannelConfiguration): a shared
|
|
219
|
+
* multiChannel body on its own, or an explicit sms + whatsapp pair, both present.
|
|
220
|
+
*
|
|
221
|
+
* multiChannel together with sms or whatsapp is rejected, and so is sms or
|
|
222
|
+
* whatsapp on its own — every template is expected to be deliverable on every
|
|
223
|
+
* channel. rcs is the one true override: it may accompany either strategy to vary
|
|
224
|
+
* the copy, but cannot stand alone.
|
|
162
225
|
*/
|
|
163
226
|
export interface TemplateBody {
|
|
164
227
|
/**
|
|
165
|
-
*
|
|
166
|
-
*
|
|
228
|
+
* MMS-specific content — subject, text and attachments.
|
|
229
|
+
*
|
|
230
|
+
* Like Rcs, an override that cannot stand on its own: a template still needs a
|
|
231
|
+
* MultiChannel body or the Sms + Whatsapp pair to be deliverable at all. Unlike
|
|
232
|
+
* Rcs, it has no fallback at send time — MMS with no media is a more expensive
|
|
233
|
+
* SMS, so a template without this slot is deliberately not MMS-capable and never
|
|
234
|
+
* produces an MMS route candidate.
|
|
235
|
+
*/
|
|
236
|
+
mms?: TemplateBody.Mms | null;
|
|
237
|
+
/**
|
|
238
|
+
* The shared body, used for every channel. One half of the choice described above.
|
|
167
239
|
*/
|
|
168
240
|
multiChannel?: TemplateBodyContent | null;
|
|
169
241
|
/**
|
|
170
|
-
* RCS-specific
|
|
242
|
+
* RCS-specific copy that overrides the chosen strategy for RCS only. The one true
|
|
243
|
+
* override: optional on top of either strategy, but it cannot be the only body
|
|
244
|
+
* present. Its length cap is the higher one described on Template.
|
|
171
245
|
*/
|
|
172
246
|
rcs?: TemplateBodyContent | null;
|
|
173
247
|
/**
|
|
174
|
-
* SMS
|
|
248
|
+
* The SMS body. It does not override multiChannel, it replaces it.
|
|
175
249
|
*/
|
|
176
250
|
sms?: TemplateBodyContent | null;
|
|
177
251
|
/**
|
|
178
|
-
* WhatsApp
|
|
179
|
-
* messages
|
|
252
|
+
* The WhatsApp body. It does not override multiChannel, it replaces it.
|
|
180
253
|
*/
|
|
181
254
|
whatsapp?: TemplateBodyContent | null;
|
|
182
255
|
}
|
|
256
|
+
export declare namespace TemplateBody {
|
|
257
|
+
/**
|
|
258
|
+
* MMS-specific content — subject, text and attachments.
|
|
259
|
+
*
|
|
260
|
+
* Like Rcs, an override that cannot stand on its own: a template still needs a
|
|
261
|
+
* MultiChannel body or the Sms + Whatsapp pair to be deliverable at all. Unlike
|
|
262
|
+
* Rcs, it has no fallback at send time — MMS with no media is a more expensive
|
|
263
|
+
* SMS, so a template without this slot is deliberately not MMS-capable and never
|
|
264
|
+
* produces an MMS route candidate.
|
|
265
|
+
*/
|
|
266
|
+
interface Mms extends TemplatesAPI.TemplateBodyContent {
|
|
267
|
+
/**
|
|
268
|
+
* Attachments carried by every send on this template, in order. A per-send
|
|
269
|
+
* media_urls on the request replaces this list rather than adding to it, so a
|
|
270
|
+
* template can hold a default creative and a caller can still send something
|
|
271
|
+
* recipient-specific.
|
|
272
|
+
*/
|
|
273
|
+
media?: Array<Mms.Media> | null;
|
|
274
|
+
/**
|
|
275
|
+
* MMS subject line. Optional — most handsets render it above the body, some ignore
|
|
276
|
+
* it entirely. Deliberately its own field rather than riding TemplateHeader: the
|
|
277
|
+
* header is authored once and shared across every channel, and carries Meta's
|
|
278
|
+
* 60-character cap plus its no-newline, no-emoji text rules, none of which
|
|
279
|
+
* describe an MMS subject.
|
|
280
|
+
*/
|
|
281
|
+
subject?: string | null;
|
|
282
|
+
}
|
|
283
|
+
namespace Mms {
|
|
284
|
+
/**
|
|
285
|
+
* One attachment on an MMS template body.
|
|
286
|
+
*/
|
|
287
|
+
interface Media {
|
|
288
|
+
/**
|
|
289
|
+
* One of MmsMediaTypes. Advisory: the carrier reads the Content-Type off the
|
|
290
|
+
* fetched object, not this field. It exists so an authoring UI can render the
|
|
291
|
+
* right preview and so a reviewer can see what was intended.
|
|
292
|
+
*/
|
|
293
|
+
mediaType?: string | null;
|
|
294
|
+
/**
|
|
295
|
+
* Publicly fetchable https URL. The carrier's MMSC fetches this at send time, so
|
|
296
|
+
* it has to stay reachable and unauthenticated for the life of the send —
|
|
297
|
+
* including retries and a DLQ replay — which is why a presigned URL is not a valid
|
|
298
|
+
* value here.
|
|
299
|
+
*/
|
|
300
|
+
url?: string;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
183
304
|
export interface TemplateBodyContent {
|
|
305
|
+
/**
|
|
306
|
+
* The body copy, with variables written as {{index:variable}}.
|
|
307
|
+
*
|
|
308
|
+
* Length cap depends on which channel this body belongs to:
|
|
309
|
+
* TemplateContentLimits.MaxBodyLength (1024) for multiChannel, sms and whatsapp —
|
|
310
|
+
* Meta's BODY limit, which a multiChannel body may be delivered under — and
|
|
311
|
+
* TemplateContentLimits.MaxRcsBodyLength (3072) for an rcs body, which never
|
|
312
|
+
* reaches Meta. The maxLength advertised on this schema is the 1024 one, because
|
|
313
|
+
* all four channel bodies share this single schema — an rcs body between the two
|
|
314
|
+
* is accepted.
|
|
315
|
+
*
|
|
316
|
+
* Meta requires every variable to carry surrounding context, so a body is refused
|
|
317
|
+
* unless it also satisfies all of the following (enforced by
|
|
318
|
+
* TemplateDefinitionValidator): At least one letter before the first variable and
|
|
319
|
+
* after the last — trailing punctuation such as "... {{1:variable}}." does not
|
|
320
|
+
* count. At least (2 × variable count) + 1 words once the placeholders are
|
|
321
|
+
* removed. No two variables adjacent with only whitespace between them. No leading
|
|
322
|
+
* or trailing newline, no more than two consecutive line breaks, and no more than
|
|
323
|
+
* four consecutive spaces.
|
|
324
|
+
*
|
|
325
|
+
* Example: "Hello {{0:variable}}! Welcome to {{1:variable}}. We are glad to have
|
|
326
|
+
* you on board." — two variables, so at least five words are required, and the
|
|
327
|
+
* copy after the final variable contains letters.
|
|
328
|
+
*/
|
|
184
329
|
template: string;
|
|
330
|
+
/**
|
|
331
|
+
* The type of body content — send "text". It is dropped from the stored definition
|
|
332
|
+
* when null, so a body posted without it is saved with no type key at all and the
|
|
333
|
+
* template editor has nothing to render the block from.
|
|
334
|
+
*/
|
|
185
335
|
type?: string | null;
|
|
336
|
+
/**
|
|
337
|
+
* The variables referenced by the body copy, one entry per {{index:variable}}
|
|
338
|
+
* placeholder.
|
|
339
|
+
*/
|
|
186
340
|
variables?: Array<TemplateVariable> | null;
|
|
187
341
|
}
|
|
188
342
|
/**
|
|
@@ -198,7 +352,13 @@ export interface TemplateButton {
|
|
|
198
352
|
*/
|
|
199
353
|
type: string;
|
|
200
354
|
/**
|
|
201
|
-
* The
|
|
355
|
+
* The button's identifier (1-based index), unique within the template.
|
|
356
|
+
*
|
|
357
|
+
* Omitting it is only safe for a template holding a single button. The field is a
|
|
358
|
+
* non-nullable int, so every button that leaves it out defaults to 0, and two such
|
|
359
|
+
* buttons are refused by the unique-id rule ("Button IDs must be unique"). Number
|
|
360
|
+
* them from 1 in the order they should appear — order matters on RCS, where only
|
|
361
|
+
* the first four buttons render.
|
|
202
362
|
*/
|
|
203
363
|
id?: number;
|
|
204
364
|
}
|
|
@@ -208,6 +368,19 @@ export interface TemplateButtonProps {
|
|
|
208
368
|
offerCode: string;
|
|
209
369
|
phoneNumber: string;
|
|
210
370
|
quickReplyType: string;
|
|
371
|
+
/**
|
|
372
|
+
* The button's label. Required for every button type, and capped at
|
|
373
|
+
* TemplateContentLimits.MaxButtonTextLength (25) characters.
|
|
374
|
+
*
|
|
375
|
+
* Meta accepts only static text here, so a label is refused when it contains a
|
|
376
|
+
* {{...}} variable placeholder, a newline, an emoji, or WhatsApp formatting markup
|
|
377
|
+
* (\*, \_, ~) — enforced by ApplyButtonLabelContentRules in
|
|
378
|
+
* TemplateButtonValidator. Meta reports all four as one error: "Buttons can't have
|
|
379
|
+
* any variables, newlines, emojis, or formatting characters."
|
|
380
|
+
*
|
|
381
|
+
* AUTHENTICATION OTP buttons are the exception: Meta auto-localizes their label
|
|
382
|
+
* from the template language, and the converter drops whatever text was sent.
|
|
383
|
+
*/
|
|
211
384
|
text: string;
|
|
212
385
|
url: string;
|
|
213
386
|
urlType: string;
|
|
@@ -228,7 +401,16 @@ export interface TemplateButtonProps {
|
|
|
228
401
|
*/
|
|
229
402
|
export interface TemplateDefinition {
|
|
230
403
|
/**
|
|
231
|
-
* Body section of a message template
|
|
404
|
+
* Body section of a message template.
|
|
405
|
+
*
|
|
406
|
+
* A body picks one of two authoring strategies, and mixing them is refused
|
|
407
|
+
* (TemplateDefinitionValidator.HaveValidChannelConfiguration): a shared
|
|
408
|
+
* multiChannel body on its own, or an explicit sms + whatsapp pair, both present.
|
|
409
|
+
*
|
|
410
|
+
* multiChannel together with sms or whatsapp is rejected, and so is sms or
|
|
411
|
+
* whatsapp on its own — every template is expected to be deliverable on every
|
|
412
|
+
* channel. rcs is the one true override: it may accompany either strategy to vary
|
|
413
|
+
* the copy, but cannot stand alone.
|
|
232
414
|
*/
|
|
233
415
|
body: TemplateBody;
|
|
234
416
|
/**
|
|
@@ -279,7 +461,49 @@ export interface TemplateHeader {
|
|
|
279
461
|
*/
|
|
280
462
|
template: string;
|
|
281
463
|
/**
|
|
282
|
-
* The
|
|
464
|
+
* Request-only. The s.dm URL of the asset Meta's reviewers see —
|
|
465
|
+
* https://s.dm/s/{ID}, eight uppercase characters, uploaded to s.dm out of band.
|
|
466
|
+
* NormalizeRichHeader folds it into the synthesized media variable's Props.Sample
|
|
467
|
+
* and clears it, so it never persists and a stored definition is indistinguishable
|
|
468
|
+
* from an imported one.
|
|
469
|
+
*
|
|
470
|
+
* Stricter than the send path on purpose:
|
|
471
|
+
* TemplateUtils.ValidateMediaVariableValues accepts any absolute https URL for the
|
|
472
|
+
* per-send asset, because that one is the customer's and may live behind a signed
|
|
473
|
+
* CDN link. This one is the review sample, has to outlive every resubmission, and
|
|
474
|
+
* so must be ours. Do not "fix" one to match the other.
|
|
475
|
+
*/
|
|
476
|
+
example_url?: string | null;
|
|
477
|
+
/**
|
|
478
|
+
* The map pin a location header drops. Meta wants none of this at creation — the
|
|
479
|
+
* component is just {"type":"header","format":"location"} — so these values exist
|
|
480
|
+
* for Sent: a preview, and the default a StaticResource header falls back to at
|
|
481
|
+
* send.
|
|
482
|
+
*/
|
|
483
|
+
location?: TemplateHeader.Location | null;
|
|
484
|
+
/**
|
|
485
|
+
* Whether the asset registered at creation is reused when a caller omits the
|
|
486
|
+
* header's variable at send time. Default false — the caller must supply it per
|
|
487
|
+
* message, which is the behaviour every existing template has. Written only when
|
|
488
|
+
* true, so a default-valued header serializes byte-identically to one imported
|
|
489
|
+
* from Meta.
|
|
490
|
+
*
|
|
491
|
+
* Stored and validated but not yet honoured at send: that lands with the Resumable
|
|
492
|
+
* Upload work, alongside the code that lets such a template be approved in the
|
|
493
|
+
* first place.
|
|
494
|
+
*/
|
|
495
|
+
static_resource?: boolean;
|
|
496
|
+
/**
|
|
497
|
+
* The kind of header. One of:
|
|
498
|
+
*
|
|
499
|
+
* text — up to 60 characters, at most one variable. image — png, jpg or jpeg.
|
|
500
|
+
* Needs ExampleUrl. video — mp4. Needs ExampleUrl. gif — mp4, max 3.5MB. WhatsApp
|
|
501
|
+
* renders larger files as an ordinary video. Needs ExampleUrl. document — pdf or
|
|
502
|
+
* docx; only the first page is shown as a thumbnail, so pdf is the practical
|
|
503
|
+
* choice. Needs ExampleUrl. location — a map pin, supplied through Location.
|
|
504
|
+
*
|
|
505
|
+
* Kept lowercase because MetaToTemplateConverter writes Meta's format through
|
|
506
|
+
* ToLowerInvariant() into this field on import, and the two are compared directly.
|
|
283
507
|
*/
|
|
284
508
|
type?: string | null;
|
|
285
509
|
/**
|
|
@@ -287,15 +511,53 @@ export interface TemplateHeader {
|
|
|
287
511
|
*/
|
|
288
512
|
variables?: Array<TemplateVariable> | null;
|
|
289
513
|
}
|
|
514
|
+
export declare namespace TemplateHeader {
|
|
515
|
+
/**
|
|
516
|
+
* The map pin a location header drops. Meta wants none of this at creation — the
|
|
517
|
+
* component is just {"type":"header","format":"location"} — so these values exist
|
|
518
|
+
* for Sent: a preview, and the default a StaticResource header falls back to at
|
|
519
|
+
* send.
|
|
520
|
+
*/
|
|
521
|
+
interface Location {
|
|
522
|
+
address: string;
|
|
523
|
+
latitude: string;
|
|
524
|
+
longitude: string;
|
|
525
|
+
name: string;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
290
528
|
export interface TemplateVariable {
|
|
529
|
+
/**
|
|
530
|
+
* The variable's name, and the key callers use for it in a send request's
|
|
531
|
+
* parameters object. Must start with a letter and hold only letters, digits and
|
|
532
|
+
* underscores.
|
|
533
|
+
*/
|
|
291
534
|
name: string;
|
|
292
535
|
props: TemplateVariable.Props;
|
|
536
|
+
/**
|
|
537
|
+
* One of variable, link or media. Decides which Props fields are required.
|
|
538
|
+
*/
|
|
293
539
|
type: string;
|
|
540
|
+
/**
|
|
541
|
+
* The variable's index, and the number its {{index:variable}} placeholder refers
|
|
542
|
+
* to.
|
|
543
|
+
*
|
|
544
|
+
* Omitting it is only safe for a section holding a single variable. The field is a
|
|
545
|
+
* non-nullable int, so every variable that leaves it out defaults to 0, and a
|
|
546
|
+
* section with two such variables is refused by the unique-id rule ("variables
|
|
547
|
+
* must have unique IDs"). Number them from 0 in the order they appear.
|
|
548
|
+
*/
|
|
294
549
|
id?: number;
|
|
295
550
|
}
|
|
296
551
|
export declare namespace TemplateVariable {
|
|
297
552
|
interface Props {
|
|
298
553
|
mediaType: string;
|
|
554
|
+
/**
|
|
555
|
+
* Example value substituted into the template when previewing it and when
|
|
556
|
+
* submitting it to Meta for review. Free text by nature, so the converter accepts
|
|
557
|
+
* a JSON number or boolean here and normalizes it — see
|
|
558
|
+
* JsonScalarToStringConverter for why — and guarantees it is always serialized
|
|
559
|
+
* back out as a JSON string.
|
|
560
|
+
*/
|
|
299
561
|
sample: string;
|
|
300
562
|
url: string;
|
|
301
563
|
variableType: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.mts","sourceRoot":"","sources":["../src/resources/templates.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAC/C,OAAO,KAAK,WAAW,uBAAmB;AAC1C,OAAO,EAAE,UAAU,EAAE,gCAA4B;AACjD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,mBAAmB,EAAE,+BAA2B;AAE1F,OAAO,EAAE,cAAc,EAAE,wCAAoC;AAG7D;;;;GAIG;AACH,qBAAa,SAAU,SAAQ,WAAW;IACxC
|
|
1
|
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