@twilio/conversations 3.0.1-rc.102 → 3.0.1
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/README.md +2 -2
- package/builds/browser.esm.js +10846 -0
- package/builds/browser.esm.js.map +1 -0
- package/builds/browser.js +891 -260
- package/builds/browser.js.map +1 -1
- package/builds/lib.d.ts +162 -52
- package/builds/lib.esm.d.ts +3178 -0
- package/builds/lib.esm.js +10845 -0
- package/builds/lib.js +900 -260
- package/builds/lib.js.map +1 -1
- package/builds/twilio-conversations.js +9407 -10424
- package/builds/twilio-conversations.js.map +1 -0
- package/builds/twilio-conversations.min.js +2 -1
- package/builds/twilio-conversations.min.js.map +1 -0
- package/dist/aggregated-delivery-receipt.js +1 -5
- package/dist/aggregated-delivery-receipt.js.map +1 -1
- package/dist/channel-metadata-client.js +5 -10
- package/dist/channel-metadata-client.js.map +1 -1
- package/dist/client.js +218 -204
- package/dist/client.js.map +1 -1
- package/dist/command-executor.js +6 -10
- package/dist/command-executor.js.map +1 -1
- package/dist/configuration.js +14 -14
- package/dist/configuration.js.map +1 -1
- package/dist/content-client.js +5 -9
- package/dist/content-client.js.map +1 -1
- package/dist/content-template.js +1 -7
- package/dist/content-template.js.map +1 -1
- package/dist/conversation.js +170 -134
- package/dist/conversation.js.map +1 -1
- package/dist/data/conversations.js +44 -46
- package/dist/data/conversations.js.map +1 -1
- package/dist/data/messages.js +18 -22
- package/dist/data/messages.js.map +1 -1
- package/dist/data/participants.js +22 -25
- package/dist/data/participants.js.map +1 -1
- package/dist/data/users.js +10 -14
- package/dist/data/users.js.map +1 -1
- package/dist/detailed-delivery-receipt.js +1 -5
- package/dist/detailed-delivery-receipt.js.map +1 -1
- package/dist/index.js +17 -46
- package/dist/index.js.map +1 -1
- package/dist/interfaces/notification-types.js +1 -5
- package/dist/interfaces/notification-types.js.map +1 -1
- package/dist/interfaces/rules.js +7 -13
- package/dist/interfaces/rules.js.map +1 -1
- package/dist/logger.js +9 -29
- package/dist/logger.js.map +1 -1
- package/dist/media.js +32 -25
- package/dist/media.js.map +1 -1
- package/dist/message-builder.js +43 -47
- package/dist/message-builder.js.map +1 -1
- package/dist/message-recipients-client.js +231 -0
- package/dist/message-recipients-client.js.map +1 -0
- package/dist/message.js +120 -98
- package/dist/message.js.map +1 -1
- package/dist/node_modules/quick-lru/index.js +1 -5
- package/dist/node_modules/quick-lru/index.js.map +1 -1
- package/dist/node_modules/tslib/tslib.es6.js +7 -6
- package/dist/node_modules/tslib/tslib.es6.js.map +1 -1
- package/dist/packages/conversations/package.json.js +2 -6
- package/dist/packages/conversations/package.json.js.map +1 -1
- package/dist/participant.js +32 -37
- package/dist/participant.js.map +1 -1
- package/dist/push-notification.js +1 -5
- package/dist/push-notification.js.map +1 -1
- package/dist/rest-paginator.js +1 -5
- package/dist/rest-paginator.js.map +1 -1
- package/dist/services/network.js +3 -7
- package/dist/services/network.js.map +1 -1
- package/dist/services/typing-indicator.js +7 -10
- package/dist/services/typing-indicator.js.map +1 -1
- package/dist/unsent-message.js +5 -9
- package/dist/unsent-message.js.map +1 -1
- package/dist/user.js +21 -30
- package/dist/user.js.map +1 -1
- package/dist/util/deferred.js +1 -5
- package/dist/util/deferred.js.map +1 -1
- package/dist/util/index.js +36 -9
- package/dist/util/index.js.map +1 -1
- package/dist/utils/uuid.js +145 -0
- package/dist/utils/uuid.js.map +1 -0
- package/package.json +14 -17
- package/docs/assets/css/main.css +0 -2660
- package/docs/assets/images/icons.png +0 -0
- package/docs/assets/images/icons@2x.png +0 -0
- package/docs/assets/images/widgets.png +0 -0
- package/docs/assets/images/widgets@2x.png +0 -0
- package/docs/assets/js/main.js +0 -248
- package/docs/assets/js/search.js +0 -1
- package/docs/classes/AggregatedDeliveryReceipt.html +0 -3184
- package/docs/classes/CancellablePromise.html +0 -3213
- package/docs/classes/ChannelMetadata.html +0 -3050
- package/docs/classes/Client.html +0 -4278
- package/docs/classes/ContentTemplate.html +0 -3116
- package/docs/classes/ContentTemplateVariable.html +0 -3116
- package/docs/classes/Conversation.html +0 -4359
- package/docs/classes/DetailedDeliveryReceipt.html +0 -3163
- package/docs/classes/Media.html +0 -3167
- package/docs/classes/Message.html +0 -3803
- package/docs/classes/MessageBuilder.html +0 -3318
- package/docs/classes/Participant.html +0 -3444
- package/docs/classes/PushNotification.html +0 -3130
- package/docs/classes/RestPaginator.html +0 -3160
- package/docs/classes/UnsentMessage.html +0 -3042
- package/docs/classes/User.html +0 -3349
- package/docs/index.html +0 -4333
- package/docs/interfaces/ClientOptions.html +0 -3050
- package/docs/interfaces/ConversationBindings.html +0 -3001
- package/docs/interfaces/ConversationEmailBinding.html +0 -3001
- package/docs/interfaces/ConversationLimits.html +0 -3098
- package/docs/interfaces/ConversationState.html +0 -3050
- package/docs/interfaces/ConversationUpdatedEventArgs.html +0 -3001
- package/docs/interfaces/CreateConversationOptions.html +0 -3066
- package/docs/interfaces/LastMessage.html +0 -3050
- package/docs/interfaces/Paginator.html +0 -3141
- package/docs/interfaces/ParticipantBindings.html +0 -3001
- package/docs/interfaces/ParticipantEmailBinding.html +0 -3001
- package/docs/interfaces/PushNotificationData.html +0 -3114
- package/docs/interfaces/SendEmailOptions.html +0 -3034
- package/docs/interfaces/SendMediaOptions.html +0 -3068
- package/docs/modules.html +0 -4334
package/dist/message-builder.js
CHANGED
|
@@ -126,8 +126,6 @@ This software includes platform.js under the following license.
|
|
|
126
126
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
127
127
|
|
|
128
128
|
*/
|
|
129
|
-
'use strict';
|
|
130
|
-
|
|
131
129
|
var global =
|
|
132
130
|
typeof global !== "undefined"
|
|
133
131
|
? global
|
|
@@ -137,13 +135,11 @@ var global =
|
|
|
137
135
|
? window
|
|
138
136
|
: {};
|
|
139
137
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
var declarativeTypeValidator = require('@twilio/declarative-type-validator');
|
|
146
|
-
var rules = require('./interfaces/rules.js');
|
|
138
|
+
import { __decorate, __metadata } from './node_modules/tslib/tslib.es6.js';
|
|
139
|
+
import { UnsentMessage } from './unsent-message.js';
|
|
140
|
+
import { ContentTemplateVariable } from './content-template.js';
|
|
141
|
+
import { validateTypes, array } from '@twilio/declarative-type-validator';
|
|
142
|
+
import { json, sendMediaOptions } from './interfaces/rules.js';
|
|
147
143
|
|
|
148
144
|
/**
|
|
149
145
|
* Message builder. Allows the message to be built and sent via method chaining.
|
|
@@ -166,7 +162,7 @@ class MessageBuilder {
|
|
|
166
162
|
*/
|
|
167
163
|
constructor(limits, messagesEntity) {
|
|
168
164
|
this.limits = limits;
|
|
169
|
-
this.message = new
|
|
165
|
+
this.message = new UnsentMessage(messagesEntity);
|
|
170
166
|
this.emailBodies = new Map();
|
|
171
167
|
this.emailHistories = new Map();
|
|
172
168
|
}
|
|
@@ -289,51 +285,51 @@ class MessageBuilder {
|
|
|
289
285
|
return this.build().send();
|
|
290
286
|
}
|
|
291
287
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
288
|
+
__decorate([
|
|
289
|
+
validateTypes("string"),
|
|
290
|
+
__metadata("design:type", Function),
|
|
291
|
+
__metadata("design:paramtypes", [String]),
|
|
292
|
+
__metadata("design:returntype", MessageBuilder)
|
|
297
293
|
], MessageBuilder.prototype, "setBody", null);
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
294
|
+
__decorate([
|
|
295
|
+
validateTypes("string"),
|
|
296
|
+
__metadata("design:type", Function),
|
|
297
|
+
__metadata("design:paramtypes", [String]),
|
|
298
|
+
__metadata("design:returntype", MessageBuilder)
|
|
303
299
|
], MessageBuilder.prototype, "setSubject", null);
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
300
|
+
__decorate([
|
|
301
|
+
validateTypes(json),
|
|
302
|
+
__metadata("design:type", Function),
|
|
303
|
+
__metadata("design:paramtypes", [Object]),
|
|
304
|
+
__metadata("design:returntype", MessageBuilder)
|
|
309
305
|
], MessageBuilder.prototype, "setAttributes", null);
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
306
|
+
__decorate([
|
|
307
|
+
validateTypes("string", [FormData, sendMediaOptions]),
|
|
308
|
+
__metadata("design:type", Function),
|
|
309
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
310
|
+
__metadata("design:returntype", MessageBuilder)
|
|
315
311
|
], MessageBuilder.prototype, "setEmailBody", null);
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
312
|
+
__decorate([
|
|
313
|
+
validateTypes("string", [FormData, sendMediaOptions]),
|
|
314
|
+
__metadata("design:type", Function),
|
|
315
|
+
__metadata("design:paramtypes", [String, Object]),
|
|
316
|
+
__metadata("design:returntype", MessageBuilder)
|
|
321
317
|
], MessageBuilder.prototype, "setEmailHistory", null);
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
318
|
+
__decorate([
|
|
319
|
+
validateTypes("string", [
|
|
320
|
+
array("content variables", ContentTemplateVariable),
|
|
325
321
|
"undefined",
|
|
326
322
|
]),
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
323
|
+
__metadata("design:type", Function),
|
|
324
|
+
__metadata("design:paramtypes", [String, Array]),
|
|
325
|
+
__metadata("design:returntype", MessageBuilder)
|
|
330
326
|
], MessageBuilder.prototype, "setContentTemplate", null);
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
327
|
+
__decorate([
|
|
328
|
+
validateTypes([FormData, sendMediaOptions]),
|
|
329
|
+
__metadata("design:type", Function),
|
|
330
|
+
__metadata("design:paramtypes", [Object]),
|
|
331
|
+
__metadata("design:returntype", MessageBuilder)
|
|
336
332
|
], MessageBuilder.prototype, "addMedia", null);
|
|
337
333
|
|
|
338
|
-
|
|
334
|
+
export { MessageBuilder };
|
|
339
335
|
//# sourceMappingURL=message-builder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-builder.js","sources":["../src/message-builder.ts"],"sourcesContent":["import { CancellablePromise } from \"@twilio/mcs-client\";\nimport { ConversationLimits } from \"./interfaces/conversation-limits\";\nimport { SendMediaOptions } from \"./conversation\";\nimport { UnsentMessage } from \"./unsent-message\";\nimport { JSONValue } from \"./types\";\nimport { Messages } from \"./data/messages\";\nimport { ContentTemplateVariable } from \"./content-template\";\nimport { array, validateTypes } from \"@twilio/declarative-type-validator\";\nimport { json, sendMediaOptions } from \"./interfaces/rules\";\n\n/**\n * Message builder. Allows the message to be built and sent via method chaining.\n *\n * Example:\n *\n * ```ts\n * await testConversation.prepareMessage()\n * .setBody('Hello!')\n * .setAttributes({foo: 'bar'})\n * .addMedia(media1)\n * .addMedia(media2)\n * .build()\n * .send();\n * ```\n */\nclass MessageBuilder {\n private readonly message: UnsentMessage;\n private emailBodies: Map<string, FormData | SendMediaOptions>;\n private emailHistories: Map<string, FormData | SendMediaOptions>;\n\n /**\n * @internal\n */\n constructor(\n private readonly limits: ConversationLimits,\n messagesEntity: Messages\n ) {\n this.message = new UnsentMessage(messagesEntity);\n this.emailBodies = new Map<string, FormData | SendMediaOptions>();\n this.emailHistories = new Map<string, FormData | SendMediaOptions>();\n }\n\n /**\n * Sets the message body.\n * @param text Contents of the body.\n */\n @validateTypes(\"string\")\n setBody(text: string): MessageBuilder {\n this.message.text = text;\n return this;\n }\n\n /**\n * Sets the message subject.\n * @param subject Contents of the subject.\n */\n @validateTypes(\"string\")\n setSubject(subject: string): MessageBuilder {\n this.message.emailOptions.subject = subject;\n return this;\n }\n\n /**\n * Sets the message attributes.\n * @param attributes Message attributes.\n */\n @validateTypes(json)\n setAttributes(attributes: JSONValue): MessageBuilder {\n this.message.attributes = attributes;\n return this;\n }\n\n /**\n * Set the email body with a given content type.\n * @param contentType Format of the body to set (text/plain or text/html).\n * @param body Body payload in the selected format.\n */\n @validateTypes(\"string\", [FormData, sendMediaOptions])\n setEmailBody(\n contentType: string,\n body: FormData | SendMediaOptions\n ): MessageBuilder {\n this.emailBodies.set(contentType, body);\n return this;\n }\n\n /**\n * Set the email history with a given content type.\n * @param contentType Format of the history to set (text/plain or text/html).\n * @param history History payload in the selected format.\n */\n @validateTypes(\"string\", [FormData, sendMediaOptions])\n setEmailHistory(\n contentType: string,\n history: FormData | SendMediaOptions\n ): MessageBuilder {\n this.emailHistories.set(contentType, history);\n return this;\n }\n\n /**\n * Adds {@link ContentTemplate} SID for the message alongside optional\n * variables. When no variables provided, the default values will be used.\n *\n * Adding the content SID converts the message to a rich message. In this\n * case, other fields are ignored and the message is sent using the content\n * from the the {@link ContentTemplate}.\n *\n * Use {@link Client.getContentTemplates} to request all available\n * {@link ContentTemplate}s.\n *\n * @param contentSid SID of the {@link ContentTemplate}\n * @param variables Custom variables to resolve the template.\n */\n @validateTypes(\"string\", [\n array(\"content variables\", ContentTemplateVariable),\n \"undefined\",\n ])\n setContentTemplate(\n contentSid: string,\n contentVariables: ContentTemplateVariable[] = []\n ): MessageBuilder {\n this.message.contentSid = contentSid;\n this.message.contentVariables = contentVariables;\n return this;\n }\n\n /**\n * Adds media to the message.\n * @param payload Media to add.\n */\n @validateTypes([FormData, sendMediaOptions])\n addMedia(payload: FormData | SendMediaOptions): MessageBuilder {\n if (typeof FormData === \"undefined\" && payload instanceof FormData) {\n throw new Error(\"Could not add FormData content whilst not in a browser\");\n }\n if (!(payload instanceof FormData)) {\n const mediaOptions = payload as SendMediaOptions;\n if (!mediaOptions.contentType || !mediaOptions.media) {\n throw new Error(\n \"Media content in SendMediaOptions must contain non-empty contentType and media\"\n );\n }\n }\n this.message.mediaContent.push([\"media\", payload]);\n return this;\n }\n\n /**\n * Builds the message, making it ready to be sent.\n */\n build(): UnsentMessage {\n this.emailBodies.forEach((_, key) => {\n if (!this.limits.emailBodiesAllowedContentTypes.includes(key)) {\n throw new Error(`Unsupported email body content type ${key}`);\n }\n });\n this.emailHistories.forEach((_, key) => {\n if (!this.limits.emailHistoriesAllowedContentTypes.includes(key)) {\n throw new Error(`Unsupported email history content type ${key}`);\n }\n });\n if (\n this.emailBodies.size > this.limits.emailBodiesAllowedContentTypes.length\n ) {\n throw new Error(\n `Too many email bodies attached to the message (${this.emailBodies.size} > ${this.limits.emailBodiesAllowedContentTypes.length})`\n );\n }\n if (\n this.emailHistories.size >\n this.limits.emailHistoriesAllowedContentTypes.length\n ) {\n throw new Error(\n `Too many email histories attached to the message (${this.emailHistories.size} > ${this.limits.emailHistoriesAllowedContentTypes.length})`\n );\n }\n\n if (\n this.message.mediaContent.length > this.limits.mediaAttachmentsCountLimit\n ) {\n throw new Error(\n `Too many media attachments in the message (${this.message.mediaContent.length} > ${this.limits.mediaAttachmentsCountLimit})`\n );\n }\n\n // @todo we don't know the sizes of the attachments in FormData\n // @todo insertion below makes build() method non-repeatable - probably move to UnsentMessage.send() or even sendV2()?\n\n this.emailBodies.forEach((body) => {\n this.message.mediaContent.push([\"body\", body]);\n });\n\n this.emailHistories.forEach((history) => {\n this.message.mediaContent.push([\"history\", history]);\n });\n\n return this.message;\n }\n\n /**\n * Prepares a message and sends it to the conversation.\n */\n buildAndSend(): CancellablePromise<number | null> {\n return this.build().send();\n }\n}\n\nexport { MessageBuilder };\n"],"names":["UnsentMessage","__decorate","validateTypes","json","sendMediaOptions","array","ContentTemplateVariable"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA;;;;;;;;;;;;;;AAcG;AACH,MAAM,cAAc,CAAA;AAKlB;;AAEG;IACH,WACmB,CAAA,MAA0B,EAC3C,cAAwB,EAAA;QADP,IAAM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AAA,SAAA,EAAA,UAAA,EAAA,IAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"message-builder.js","sources":["../src/message-builder.ts"],"sourcesContent":["import { CancellablePromise } from \"@twilio/mcs-client\";\nimport { ConversationLimits } from \"./interfaces/conversation-limits\";\nimport { SendMediaOptions } from \"./conversation\";\nimport { UnsentMessage } from \"./unsent-message\";\nimport { JSONValue } from \"./types\";\nimport { Messages } from \"./data/messages\";\nimport { ContentTemplateVariable } from \"./content-template\";\nimport { array, validateTypes } from \"@twilio/declarative-type-validator\";\nimport { json, sendMediaOptions } from \"./interfaces/rules\";\n\n/**\n * Message builder. Allows the message to be built and sent via method chaining.\n *\n * Example:\n *\n * ```ts\n * await testConversation.prepareMessage()\n * .setBody('Hello!')\n * .setAttributes({foo: 'bar'})\n * .addMedia(media1)\n * .addMedia(media2)\n * .build()\n * .send();\n * ```\n */\nclass MessageBuilder {\n private readonly message: UnsentMessage;\n private emailBodies: Map<string, FormData | SendMediaOptions>;\n private emailHistories: Map<string, FormData | SendMediaOptions>;\n\n /**\n * @internal\n */\n constructor(\n private readonly limits: ConversationLimits,\n messagesEntity: Messages\n ) {\n this.message = new UnsentMessage(messagesEntity);\n this.emailBodies = new Map<string, FormData | SendMediaOptions>();\n this.emailHistories = new Map<string, FormData | SendMediaOptions>();\n }\n\n /**\n * Sets the message body.\n * @param text Contents of the body.\n */\n @validateTypes(\"string\")\n setBody(text: string): MessageBuilder {\n this.message.text = text;\n return this;\n }\n\n /**\n * Sets the message subject.\n * @param subject Contents of the subject.\n */\n @validateTypes(\"string\")\n setSubject(subject: string): MessageBuilder {\n this.message.emailOptions.subject = subject;\n return this;\n }\n\n /**\n * Sets the message attributes.\n * @param attributes Message attributes.\n */\n @validateTypes(json)\n setAttributes(attributes: JSONValue): MessageBuilder {\n this.message.attributes = attributes;\n return this;\n }\n\n /**\n * Set the email body with a given content type.\n * @param contentType Format of the body to set (text/plain or text/html).\n * @param body Body payload in the selected format.\n */\n @validateTypes(\"string\", [FormData, sendMediaOptions])\n setEmailBody(\n contentType: string,\n body: FormData | SendMediaOptions\n ): MessageBuilder {\n this.emailBodies.set(contentType, body);\n return this;\n }\n\n /**\n * Set the email history with a given content type.\n * @param contentType Format of the history to set (text/plain or text/html).\n * @param history History payload in the selected format.\n */\n @validateTypes(\"string\", [FormData, sendMediaOptions])\n setEmailHistory(\n contentType: string,\n history: FormData | SendMediaOptions\n ): MessageBuilder {\n this.emailHistories.set(contentType, history);\n return this;\n }\n\n /**\n * Adds {@link ContentTemplate} SID for the message alongside optional\n * variables. When no variables provided, the default values will be used.\n *\n * Adding the content SID converts the message to a rich message. In this\n * case, other fields are ignored and the message is sent using the content\n * from the the {@link ContentTemplate}.\n *\n * Use {@link Client.getContentTemplates} to request all available\n * {@link ContentTemplate}s.\n *\n * @param contentSid SID of the {@link ContentTemplate}\n * @param variables Custom variables to resolve the template.\n */\n @validateTypes(\"string\", [\n array(\"content variables\", ContentTemplateVariable),\n \"undefined\",\n ])\n setContentTemplate(\n contentSid: string,\n contentVariables: ContentTemplateVariable[] = []\n ): MessageBuilder {\n this.message.contentSid = contentSid;\n this.message.contentVariables = contentVariables;\n return this;\n }\n\n /**\n * Adds media to the message.\n * @param payload Media to add.\n */\n @validateTypes([FormData, sendMediaOptions])\n addMedia(payload: FormData | SendMediaOptions): MessageBuilder {\n if (typeof FormData === \"undefined\" && payload instanceof FormData) {\n throw new Error(\"Could not add FormData content whilst not in a browser\");\n }\n if (!(payload instanceof FormData)) {\n const mediaOptions = payload as SendMediaOptions;\n if (!mediaOptions.contentType || !mediaOptions.media) {\n throw new Error(\n \"Media content in SendMediaOptions must contain non-empty contentType and media\"\n );\n }\n }\n this.message.mediaContent.push([\"media\", payload]);\n return this;\n }\n\n /**\n * Builds the message, making it ready to be sent.\n */\n build(): UnsentMessage {\n this.emailBodies.forEach((_, key) => {\n if (!this.limits.emailBodiesAllowedContentTypes.includes(key)) {\n throw new Error(`Unsupported email body content type ${key}`);\n }\n });\n this.emailHistories.forEach((_, key) => {\n if (!this.limits.emailHistoriesAllowedContentTypes.includes(key)) {\n throw new Error(`Unsupported email history content type ${key}`);\n }\n });\n if (\n this.emailBodies.size > this.limits.emailBodiesAllowedContentTypes.length\n ) {\n throw new Error(\n `Too many email bodies attached to the message (${this.emailBodies.size} > ${this.limits.emailBodiesAllowedContentTypes.length})`\n );\n }\n if (\n this.emailHistories.size >\n this.limits.emailHistoriesAllowedContentTypes.length\n ) {\n throw new Error(\n `Too many email histories attached to the message (${this.emailHistories.size} > ${this.limits.emailHistoriesAllowedContentTypes.length})`\n );\n }\n\n if (\n this.message.mediaContent.length > this.limits.mediaAttachmentsCountLimit\n ) {\n throw new Error(\n `Too many media attachments in the message (${this.message.mediaContent.length} > ${this.limits.mediaAttachmentsCountLimit})`\n );\n }\n\n // @todo we don't know the sizes of the attachments in FormData\n // @todo insertion below makes build() method non-repeatable - probably move to UnsentMessage.send() or even sendV2()?\n\n this.emailBodies.forEach((body) => {\n this.message.mediaContent.push([\"body\", body]);\n });\n\n this.emailHistories.forEach((history) => {\n this.message.mediaContent.push([\"history\", history]);\n });\n\n return this.message;\n }\n\n /**\n * Prepares a message and sends it to the conversation.\n */\n buildAndSend(): CancellablePromise<number | null> {\n return this.build().send();\n }\n}\n\nexport { MessageBuilder };\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA;;;;;;;;;;;;;;AAcG;AACH,MAAM,cAAc,CAAA;AAKlB;;AAEG;IACH,WACmB,CAAA,MAA0B,EAC3C,cAAwB,EAAA;QADP,IAAM,CAAA,MAAA,GAAN,MAAM,CAAoB;QAG3C,IAAI,CAAC,OAAO,GAAG,IAAI,aAAa,CAAC,cAAc,CAAC,CAAC;AACjD,QAAA,IAAI,CA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
|
+
|
|
6
|
+
Copyright (c) 2019, Twilio, inc.
|
|
7
|
+
All rights reserved.
|
|
8
|
+
|
|
9
|
+
Redistribution and use in source and binary forms, with or without
|
|
10
|
+
modification, are permitted provided that the following conditions are
|
|
11
|
+
met:
|
|
12
|
+
|
|
13
|
+
1. Redistributions of source code must retain the above copyright
|
|
14
|
+
notice, this list of conditions and the following disclaimer.
|
|
15
|
+
|
|
16
|
+
2. Redistributions in binary form must reproduce the above copyright
|
|
17
|
+
notice, this list of conditions and the following disclaimer in
|
|
18
|
+
the documentation and/or other materials provided with the
|
|
19
|
+
distribution.
|
|
20
|
+
|
|
21
|
+
3. Neither the name of Twilio nor the names of its contributors may
|
|
22
|
+
be used to endorse or promote products derived from this software
|
|
23
|
+
without specific prior written permission.
|
|
24
|
+
|
|
25
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
26
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
27
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
28
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
29
|
+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
30
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
31
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
32
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
33
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
34
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
35
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
36
|
+
|
|
37
|
+
This software includes javascript-state-machine under the following license.
|
|
38
|
+
|
|
39
|
+
Copyright (c) 2012, 2013, 2014, 2015, Jake Gordon and contributors
|
|
40
|
+
|
|
41
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
42
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
43
|
+
in the Software without restriction, including without limitation the rights
|
|
44
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
45
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
46
|
+
furnished to do so, subject to the following conditions:
|
|
47
|
+
|
|
48
|
+
The above copyright notice and this permission notice shall be included in all
|
|
49
|
+
copies or substantial portions of the Software.
|
|
50
|
+
|
|
51
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
52
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
53
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
54
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
55
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
56
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
57
|
+
|
|
58
|
+
This software includes loglevel under the following license.
|
|
59
|
+
|
|
60
|
+
Copyright (c) 2013 Tim Perry
|
|
61
|
+
|
|
62
|
+
Permission is hereby granted, free of charge, to any person
|
|
63
|
+
obtaining a copy of this software and associated documentation
|
|
64
|
+
files (the "Software"), to deal in the Software without
|
|
65
|
+
restriction, including without limitation the rights to use,
|
|
66
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
67
|
+
copies of the Software, and to permit persons to whom the
|
|
68
|
+
Software is furnished to do so, subject to the following
|
|
69
|
+
conditions:
|
|
70
|
+
|
|
71
|
+
The above copyright notice and this permission notice shall be
|
|
72
|
+
included in all copies or substantial portions of the Software.
|
|
73
|
+
|
|
74
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
75
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
76
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
77
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
78
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
79
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
80
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
81
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
|
82
|
+
|
|
83
|
+
This software includes q under the following license.
|
|
84
|
+
|
|
85
|
+
Copyright 2009–2014 Kristopher Michael Kowal. All rights reserved.
|
|
86
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
87
|
+
of this software and associated documentation files (the "Software"), to
|
|
88
|
+
deal in the Software without restriction, including without limitation the
|
|
89
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
|
90
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
|
91
|
+
furnished to do so, subject to the following conditions:
|
|
92
|
+
|
|
93
|
+
The above copyright notice and this permission notice shall be included in
|
|
94
|
+
all copies or substantial portions of the Software.
|
|
95
|
+
|
|
96
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
97
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
98
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
99
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
100
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
101
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
102
|
+
IN THE SOFTWARE.
|
|
103
|
+
|
|
104
|
+
This software includes platform.js under the following license.
|
|
105
|
+
|
|
106
|
+
Copyright 2014 Benjamin Tan <https://d10.github.io/>
|
|
107
|
+
Copyright 2011-2015 John-David Dalton <http://allyoucanleet.com/>
|
|
108
|
+
|
|
109
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
110
|
+
a copy of this software and associated documentation files (the
|
|
111
|
+
"Software"), to deal in the Software without restriction, including
|
|
112
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
113
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
114
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
115
|
+
the following conditions:
|
|
116
|
+
|
|
117
|
+
The above copyright notice and this permission notice shall be
|
|
118
|
+
included in all copies or substantial portions of the Software.
|
|
119
|
+
|
|
120
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
121
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
122
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
123
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
124
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
125
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
126
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
127
|
+
|
|
128
|
+
*/
|
|
129
|
+
var global =
|
|
130
|
+
typeof global !== "undefined"
|
|
131
|
+
? global
|
|
132
|
+
: typeof self !== "undefined"
|
|
133
|
+
? self
|
|
134
|
+
: typeof window !== "undefined"
|
|
135
|
+
? window
|
|
136
|
+
: {};
|
|
137
|
+
|
|
138
|
+
import quickLru from './node_modules/quick-lru/index.js';
|
|
139
|
+
import { UriBuilder } from './util/index.js';
|
|
140
|
+
import { RestPaginator } from './rest-paginator.js';
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Email recipient descriptor.
|
|
144
|
+
*/
|
|
145
|
+
class EmailRecipientDescriptor {
|
|
146
|
+
/**
|
|
147
|
+
* @internal
|
|
148
|
+
*/
|
|
149
|
+
constructor(recipient) {
|
|
150
|
+
/**
|
|
151
|
+
* Type of recipient.
|
|
152
|
+
*/
|
|
153
|
+
this.type = "email";
|
|
154
|
+
this.messageSid = recipient.message_sid;
|
|
155
|
+
this.level = recipient.level;
|
|
156
|
+
this.name = recipient.name;
|
|
157
|
+
this.address = recipient.address;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Unknown recipient descriptor. Used to be able to handle recipient types that
|
|
162
|
+
* are not supported by the current version of the SDK.
|
|
163
|
+
*/
|
|
164
|
+
class UnknownRecipientDescriptor {
|
|
165
|
+
/**
|
|
166
|
+
* @internal
|
|
167
|
+
*/
|
|
168
|
+
constructor(recipient) {
|
|
169
|
+
this.type = recipient.type;
|
|
170
|
+
this.messageSid = recipient.message_sid;
|
|
171
|
+
this.rawData = JSON.stringify(recipient);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
class MessageRecipientsClient {
|
|
175
|
+
constructor(services, configuration) {
|
|
176
|
+
this._services = services;
|
|
177
|
+
this._configuration = configuration;
|
|
178
|
+
this._cache = new quickLru({
|
|
179
|
+
maxSize: configuration.messageRecipientsCacheCapacity,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
async getRecipientsFromMessage(conversationSid, messageSid) {
|
|
183
|
+
const key = `${conversationSid},${messageSid}`;
|
|
184
|
+
const cachedItem = this._cache.get(key);
|
|
185
|
+
if (cachedItem) {
|
|
186
|
+
return cachedItem.item;
|
|
187
|
+
}
|
|
188
|
+
const url = new UriBuilder(this._configuration.links.conversations)
|
|
189
|
+
.path(conversationSid)
|
|
190
|
+
.path("MessageRecipients")
|
|
191
|
+
.arg("MessageSid", messageSid)
|
|
192
|
+
.build();
|
|
193
|
+
const recipientsResponse = await this._services.commandExecutor.fetchResource(url);
|
|
194
|
+
const recipients = recipientsResponse.message_recipients.map((recipient) => this._wrapResponse(recipient));
|
|
195
|
+
if (recipients.length > 0) {
|
|
196
|
+
this._cache.set(key, { item: recipients });
|
|
197
|
+
}
|
|
198
|
+
return recipients;
|
|
199
|
+
}
|
|
200
|
+
async getRecipientsFromConversation(conversationSid, paginatorOptions) {
|
|
201
|
+
var _a, _b, _c, _d;
|
|
202
|
+
const url = new UriBuilder(this._configuration.links.conversations)
|
|
203
|
+
.path(conversationSid)
|
|
204
|
+
.path("MessageRecipients")
|
|
205
|
+
.arg("PageToken", (_a = paginatorOptions === null || paginatorOptions === void 0 ? void 0 : paginatorOptions.pageToken) !== null && _a !== void 0 ? _a : undefined)
|
|
206
|
+
.arg("PageSize", (_b = paginatorOptions === null || paginatorOptions === void 0 ? void 0 : paginatorOptions.pageSize) !== null && _b !== void 0 ? _b : undefined)
|
|
207
|
+
.build();
|
|
208
|
+
const recipientsResponse = await this._services.commandExecutor.fetchResource(url);
|
|
209
|
+
const allRecipients = recipientsResponse.message_recipients.map((recipient) => this._wrapResponse(recipient));
|
|
210
|
+
for (const recipient of allRecipients) {
|
|
211
|
+
const key = `${conversationSid},${recipient.messageSid}`;
|
|
212
|
+
const existingMessageRecipients = (_d = (_c = this._cache.get(key)) === null || _c === void 0 ? void 0 : _c.item) !== null && _d !== void 0 ? _d : [];
|
|
213
|
+
this._cache.set(key, { item: [...existingMessageRecipients, recipient] });
|
|
214
|
+
}
|
|
215
|
+
return new RestPaginator(allRecipients, (pageToken, pageSize) => this.getRecipientsFromConversation(conversationSid, {
|
|
216
|
+
pageToken,
|
|
217
|
+
pageSize,
|
|
218
|
+
}), recipientsResponse.meta.previous_token, recipientsResponse.meta.next_token);
|
|
219
|
+
}
|
|
220
|
+
_wrapResponse(recipient) {
|
|
221
|
+
switch (recipient.type) {
|
|
222
|
+
case "email":
|
|
223
|
+
return new EmailRecipientDescriptor(recipient);
|
|
224
|
+
default:
|
|
225
|
+
return new UnknownRecipientDescriptor(recipient);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export { EmailRecipientDescriptor, MessageRecipientsClient, UnknownRecipientDescriptor };
|
|
231
|
+
//# sourceMappingURL=message-recipients-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-recipients-client.js","sources":["../src/message-recipients-client.ts"],"sourcesContent":["import { CommandExecutor } from \"./command-executor\";\nimport { Configuration } from \"./configuration\";\nimport QuickLRU from \"quick-lru\";\nimport {\n MessageRecipient,\n MessageRecipientsResponse,\n} from \"./interfaces/commands/message-recipients-response\";\nimport { Paginator } from \"./interfaces/paginator\";\nimport { UriBuilder } from \"./util\";\nimport { ResponseMeta } from \"./interfaces/commands/response-meta\";\nimport { RestPaginator } from \"./rest-paginator\";\n\ntype MessageRecipientsClientServices = {\n commandExecutor: CommandExecutor;\n};\n\ntype MessageRecipientsCacheEntry = {\n item: RecipientDescriptor[];\n};\n\n/**\n * Message recipient descriptor.\n */\ntype RecipientDescriptor =\n | EmailRecipientDescriptor\n | UnknownRecipientDescriptor;\n\n/**\n * Email recipient level.\n */\ntype EmailRecipientLevel = \"to\" | \"from\" | \"cc\";\n\n/**\n * Email recipient descriptor.\n */\nclass EmailRecipientDescriptor {\n /**\n * Type of recipient.\n */\n public readonly type = \"email\";\n\n /**\n * Sid of the message that this recipient belongs to.\n */\n public readonly messageSid: string;\n\n /**\n * Email recipient level.\n */\n public readonly level: EmailRecipientLevel;\n\n /**\n * Name of the recipient.\n */\n public readonly name: string;\n\n /**\n * Address of the recipient.\n */\n public readonly address: string;\n\n /**\n * @internal\n */\n public constructor(recipient: MessageRecipient) {\n this.messageSid = recipient.message_sid;\n this.level = recipient.level;\n this.name = recipient.name;\n this.address = recipient.address;\n }\n}\n\n/**\n * Unknown recipient descriptor. Used to be able to handle recipient types that\n * are not supported by the current version of the SDK.\n */\nclass UnknownRecipientDescriptor {\n /**\n * Type of recipient.\n */\n public readonly type: string;\n\n /**\n * Sid of the message that this recipient belongs to.\n */\n public readonly messageSid: string;\n\n /**\n * Recipient data as a JSON string.\n */\n public readonly rawData: string;\n\n /**\n * @internal\n */\n public constructor(recipient: MessageRecipient) {\n this.type = recipient.type;\n this.messageSid = recipient.message_sid;\n this.rawData = JSON.stringify(recipient);\n }\n}\n\nclass MessageRecipientsClient {\n private readonly _services: MessageRecipientsClientServices;\n private readonly _configuration: Configuration;\n private readonly _cache: QuickLRU<string, MessageRecipientsCacheEntry>;\n\n public constructor(\n services: MessageRecipientsClientServices,\n configuration: Configuration\n ) {\n this._services = services;\n this._configuration = configuration;\n this._cache = new QuickLRU({\n maxSize: configuration.messageRecipientsCacheCapacity,\n });\n }\n\n public async getRecipientsFromMessage(\n conversationSid: string,\n messageSid: string\n ): Promise<RecipientDescriptor[]> {\n const key = `${conversationSid},${messageSid}`;\n const cachedItem = this._cache.get(key);\n\n if (cachedItem) {\n return cachedItem.item;\n }\n\n const url = new UriBuilder(this._configuration.links.conversations)\n .path(conversationSid)\n .path(\"MessageRecipients\")\n .arg(\"MessageSid\", messageSid)\n .build();\n const recipientsResponse =\n await this._services.commandExecutor.fetchResource<\n void,\n MessageRecipientsResponse\n >(url);\n const recipients: RecipientDescriptor[] =\n recipientsResponse.message_recipients.map((recipient) =>\n this._wrapResponse(recipient)\n );\n\n if (recipients.length > 0) {\n this._cache.set(key, { item: recipients });\n }\n\n return recipients;\n }\n\n public async getRecipientsFromConversation(\n conversationSid: string,\n paginatorOptions?: {\n pageToken?: string;\n pageSize?: number;\n }\n ): Promise<Paginator<RecipientDescriptor>> {\n const url = new UriBuilder(this._configuration.links.conversations)\n .path(conversationSid)\n .path(\"MessageRecipients\")\n .arg(\"PageToken\", paginatorOptions?.pageToken ?? undefined)\n .arg(\"PageSize\", paginatorOptions?.pageSize ?? undefined)\n .build();\n const recipientsResponse =\n await this._services.commandExecutor.fetchResource<\n void,\n { message_recipients: MessageRecipient[] } & ResponseMeta\n >(url);\n const allRecipients = recipientsResponse.message_recipients.map(\n (recipient) => this._wrapResponse(recipient)\n );\n\n for (const recipient of allRecipients) {\n const key = `${conversationSid},${recipient.messageSid}`;\n const existingMessageRecipients = this._cache.get(key)?.item ?? [];\n this._cache.set(key, { item: [...existingMessageRecipients, recipient] });\n }\n\n return new RestPaginator<RecipientDescriptor>(\n allRecipients,\n (pageToken, pageSize) =>\n this.getRecipientsFromConversation(conversationSid, {\n pageToken,\n pageSize,\n }),\n recipientsResponse.meta.previous_token,\n recipientsResponse.meta.next_token\n );\n }\n\n private _wrapResponse(recipient: MessageRecipient): RecipientDescriptor {\n switch (recipient.type) {\n case \"email\":\n return new EmailRecipientDescriptor(recipient);\n default:\n return new UnknownRecipientDescriptor(recipient);\n }\n }\n}\n\nexport {\n MessageRecipientsClient,\n EmailRecipientDescriptor,\n UnknownRecipientDescriptor,\n RecipientDescriptor,\n EmailRecipientLevel,\n};\n"],"names":["QuickLRU"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCA;;AAEG;AACH,MAAM,wBAAwB,CAAA;AA0B5B;;AAEG;AACH,IAAA,WAAA,CAAmB,SAA2B,EAAA;AA5B9C;;AAEG;QACa,I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