@twilio/conversations 3.0.0-rc.1 → 3.0.0-rc.7
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 +57 -0
- package/README.md +7 -3
- package/builds/browser.js +1643 -1410
- package/builds/browser.js.map +1 -1
- package/builds/lib.d.ts +270 -182
- package/builds/lib.js +1643 -1410
- package/builds/lib.js.map +1 -1
- package/builds/twilio-conversations.js +3719 -4034
- package/builds/twilio-conversations.min.js +1 -16
- package/dist/aggregated-delivery-receipt.js.map +1 -1
- package/dist/client.js +53 -35
- package/dist/client.js.map +1 -1
- package/dist/command-executor.js.map +1 -1
- package/dist/configuration.js.map +1 -1
- package/dist/conversation.js +405 -376
- package/dist/conversation.js.map +1 -1
- package/dist/data/conversations.js +10 -11
- package/dist/data/conversations.js.map +1 -1
- package/dist/data/messages.js +9 -9
- package/dist/data/messages.js.map +1 -1
- package/dist/data/participants.js +19 -10
- package/dist/data/participants.js.map +1 -1
- package/dist/data/users.js +2 -2
- package/dist/data/users.js.map +1 -1
- package/dist/detailed-delivery-receipt.js.map +1 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/interfaces/attributes.js.map +1 -1
- package/dist/interfaces/notification-types.js.map +1 -1
- package/dist/logger.js +2 -4
- package/dist/logger.js.map +1 -1
- package/dist/media.js.map +1 -1
- package/dist/message-builder.js.map +1 -1
- package/dist/message.js +16 -12
- package/dist/message.js.map +1 -1
- package/dist/node_modules/tslib/tslib.es6.js +1 -1
- package/dist/node_modules/tslib/tslib.es6.js.map +1 -1
- package/dist/packages/conversations/package.json.js +1 -1
- package/dist/participant.js +2 -2
- package/dist/participant.js.map +1 -1
- package/dist/push-notification.js.map +1 -1
- package/dist/rest-paginator.js.map +1 -1
- package/dist/services/network.js.map +1 -1
- package/dist/services/typing-indicator.js +1 -1
- package/dist/services/typing-indicator.js.map +1 -1
- package/dist/unsent-message.js.map +1 -1
- package/dist/user.js +1 -1
- package/dist/user.js.map +1 -1
- package/dist/util/deferred.js.map +1 -1
- package/dist/util/index.js.map +1 -1
- package/docs/assets/js/search.js +1 -1
- package/docs/classes/CancellablePromise.html +3213 -0
- package/docs/classes/Client.html +4 -10
- package/docs/classes/Conversation.html +80 -51
- package/docs/classes/Media.html +2 -2
- package/docs/classes/Message.html +6 -6
- package/docs/classes/MessageBuilder.html +2 -2
- package/docs/classes/PushNotification.html +1 -1
- package/docs/classes/UnsentMessage.html +2 -2
- package/docs/index.html +20 -25
- package/docs/interfaces/ConversationState.html +2 -2
- package/docs/interfaces/ConversationUpdatedEventArgs.html +3001 -0
- package/docs/interfaces/PushNotificationData.html +48 -0
- package/docs/modules.html +19 -24
- package/package.json +21 -19
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"configuration.js","sources":["../src/configuration.ts"],"sourcesContent":["import { ConfigurationResponse } from \"./interfaces/commands/configuration\";\nimport { parse as parseDuration, toSeconds } from \"iso8601-duration\";\nimport { Logger } from \"./logger\";\nimport { ConversationLimits } from \"./interfaces/conversation-limits\";\nimport { ClientOptions } from \"./client\";\n\nconst TYPING_TIMEOUT = 5;\nconst HTTP_CACHE_LIFETIME = \"PT5S\";\nconst CONSUMPTION_HORIZON_SENDING_INTERVAL = \"PT5S\";\nconst USER_INFOS_TO_SUBSCRIBE = 100;\n\nconst MINIMUM_RETRY_DELAY = 1000;\nconst MAXIMUM_RETRY_DELAY = 4000;\nconst MAXIMUM_ATTEMPTS_COUNT = 3;\nconst RETRY_WHEN_THROTTLED = true;\n\ninterface BackoffConfiguration {\n min: number;\n max: number;\n maxAttemptsCount: number;\n}\n\nclass Configuration {\n public readonly links: {\n myConversations: string;\n conversations: string;\n users: string;\n currentUser: string;\n typing: string;\n mediaService: string;\n mediaSetService: string;\n messagesReceipts: string;\n };\n\n public readonly limits: ConversationLimits;\n\n public readonly productId?: string;\n\n public readonly typingIndicatorTimeoutOverride?: number;\n public readonly typingIndicatorTimeoutDefault: number = TYPING_TIMEOUT * 1000;\n public readonly backoffConfiguration: BackoffConfiguration;\n public readonly retryWhenThrottled: boolean;\n\n public readonly consumptionReportInterval: number;\n public readonly userInfosToSubscribe: number;\n public readonly httpCacheInterval: number;\n public readonly reachabilityEnabled: boolean;\n\n public readonly userIdentity: string;\n public readonly userInfo: string;\n public readonly myConversations: string;\n\n constructor(\n options: ClientOptions = {},\n configurationResponse: ConfigurationResponse,\n logger: Logger\n ) {\n const constructorOptions =\n options.Chat || options.IPMessaging || options || {};\n\n this.productId = constructorOptions.productId;\n\n this.links = {\n myConversations: configurationResponse.links.my_conversations,\n conversations: configurationResponse.links.conversations,\n users: configurationResponse.links.users,\n currentUser: configurationResponse.links.current_user,\n typing: configurationResponse.links.typing,\n mediaService: configurationResponse.links.media_service,\n mediaSetService: configurationResponse.links.media_set_service,\n messagesReceipts: configurationResponse.links.messages_receipts,\n };\n\n this.limits = {\n mediaAttachmentsCountLimit:\n configurationResponse.options.media_attachments_count_limit,\n mediaAttachmentSizeLimitInMb:\n configurationResponse.options.media_attachment_size_limit_in_mb,\n mediaAttachmentsTotalSizeLimitInMb:\n configurationResponse.options.media_attachments_total_size_limit_in_mb,\n emailHistoriesAllowedContentTypes:\n configurationResponse.options.email_histories_allowed_mime_types,\n emailBodiesAllowedContentTypes:\n configurationResponse.options.email_bodies_allowed_mime_types,\n };\n\n this.typingIndicatorTimeoutOverride =\n constructorOptions.typingIndicatorTimeoutOverride;\n this.backoffConfiguration = {\n min: MINIMUM_RETRY_DELAY,\n max: MAXIMUM_RETRY_DELAY,\n maxAttemptsCount: MAXIMUM_ATTEMPTS_COUNT,\n ...constructorOptions.backoffConfigOverride,\n };\n this.retryWhenThrottled =\n constructorOptions.retryWhenThrottledOverride !== undefined\n ? constructorOptions.retryWhenThrottledOverride\n : RETRY_WHEN_THROTTLED;\n this.userInfosToSubscribe =\n constructorOptions.userInfosToSubscribeOverride ??\n configurationResponse.options.user_infos_to_subscribe ??\n USER_INFOS_TO_SUBSCRIBE;\n this.reachabilityEnabled =\n configurationResponse.options.reachability_enabled;\n this.userIdentity = configurationResponse.identity;\n this.userInfo = configurationResponse.sync_objects.my_user_info;\n this.myConversations = configurationResponse.sync_objects.my_conversations;\n\n const httpCacheInterval =\n constructorOptions.httpCacheIntervalOverride ??\n configurationResponse.options.http_cache_interval ??\n HTTP_CACHE_LIFETIME;\n\n try {\n this.httpCacheInterval = toSeconds(parseDuration(httpCacheInterval));\n } catch {\n logger.error(\n `Failed to parse http cache interval ${httpCacheInterval}, using default value ${HTTP_CACHE_LIFETIME}`\n );\n this.httpCacheInterval = toSeconds(parseDuration(HTTP_CACHE_LIFETIME));\n }\n\n const consumptionReportInterval =\n constructorOptions.consumptionReportIntervalOverride ??\n configurationResponse.options.consumption_report_interval ??\n CONSUMPTION_HORIZON_SENDING_INTERVAL;\n\n try {\n this.consumptionReportInterval = toSeconds(\n parseDuration(consumptionReportInterval)\n );\n } catch {\n logger.error(\n `Failed to parse consumption report interval ${consumptionReportInterval}, using default value ${CONSUMPTION_HORIZON_SENDING_INTERVAL}`\n );\n this.consumptionReportInterval = toSeconds(\n parseDuration(CONSUMPTION_HORIZON_SENDING_INTERVAL)\n );\n }\n }\n}\n\nexport { Configuration };\n"],"names":["toSeconds","parseDuration"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,mBAAmB,GAAG,MAAM,CAAC;AACnC,MAAM,oCAAoC,GAAG,MAAM,CAAC;AACpD,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAEpC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACjC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACjC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACjC,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAQlC,MAAM,aAAa;
|
1
|
+
{"version":3,"file":"configuration.js","sources":["../src/configuration.ts"],"sourcesContent":["import { ConfigurationResponse } from \"./interfaces/commands/configuration\";\nimport { parse as parseDuration, toSeconds } from \"iso8601-duration\";\nimport { Logger } from \"./logger\";\nimport { ConversationLimits } from \"./interfaces/conversation-limits\";\nimport { ClientOptions } from \"./client\";\n\nconst TYPING_TIMEOUT = 5;\nconst HTTP_CACHE_LIFETIME = \"PT5S\";\nconst CONSUMPTION_HORIZON_SENDING_INTERVAL = \"PT5S\";\nconst USER_INFOS_TO_SUBSCRIBE = 100;\n\nconst MINIMUM_RETRY_DELAY = 1000;\nconst MAXIMUM_RETRY_DELAY = 4000;\nconst MAXIMUM_ATTEMPTS_COUNT = 3;\nconst RETRY_WHEN_THROTTLED = true;\n\ninterface BackoffConfiguration {\n min: number;\n max: number;\n maxAttemptsCount: number;\n}\n\nclass Configuration {\n public readonly links: {\n myConversations: string;\n conversations: string;\n users: string;\n currentUser: string;\n typing: string;\n mediaService: string;\n mediaSetService: string;\n messagesReceipts: string;\n };\n\n public readonly limits: ConversationLimits;\n\n public readonly productId?: string;\n\n public readonly typingIndicatorTimeoutOverride?: number;\n public readonly typingIndicatorTimeoutDefault: number = TYPING_TIMEOUT * 1000;\n public readonly backoffConfiguration: BackoffConfiguration;\n public readonly retryWhenThrottled: boolean;\n\n public readonly consumptionReportInterval: number;\n public readonly userInfosToSubscribe: number;\n public readonly httpCacheInterval: number;\n public readonly reachabilityEnabled: boolean;\n\n public readonly userIdentity: string;\n public readonly userInfo: string;\n public readonly myConversations: string;\n\n constructor(\n options: ClientOptions = {},\n configurationResponse: ConfigurationResponse,\n logger: Logger\n ) {\n const constructorOptions =\n options.Chat || options.IPMessaging || options || {};\n\n this.productId = constructorOptions.productId;\n\n this.links = {\n myConversations: configurationResponse.links.my_conversations,\n conversations: configurationResponse.links.conversations,\n users: configurationResponse.links.users,\n currentUser: configurationResponse.links.current_user,\n typing: configurationResponse.links.typing,\n mediaService: configurationResponse.links.media_service,\n mediaSetService: configurationResponse.links.media_set_service,\n messagesReceipts: configurationResponse.links.messages_receipts,\n };\n\n this.limits = {\n mediaAttachmentsCountLimit:\n configurationResponse.options.media_attachments_count_limit,\n mediaAttachmentSizeLimitInMb:\n configurationResponse.options.media_attachment_size_limit_in_mb,\n mediaAttachmentsTotalSizeLimitInMb:\n configurationResponse.options.media_attachments_total_size_limit_in_mb,\n emailHistoriesAllowedContentTypes:\n configurationResponse.options.email_histories_allowed_mime_types,\n emailBodiesAllowedContentTypes:\n configurationResponse.options.email_bodies_allowed_mime_types,\n };\n\n this.typingIndicatorTimeoutOverride =\n constructorOptions.typingIndicatorTimeoutOverride;\n this.backoffConfiguration = {\n min: MINIMUM_RETRY_DELAY,\n max: MAXIMUM_RETRY_DELAY,\n maxAttemptsCount: MAXIMUM_ATTEMPTS_COUNT,\n ...constructorOptions.backoffConfigOverride,\n };\n this.retryWhenThrottled =\n constructorOptions.retryWhenThrottledOverride !== undefined\n ? constructorOptions.retryWhenThrottledOverride\n : RETRY_WHEN_THROTTLED;\n this.userInfosToSubscribe =\n constructorOptions.userInfosToSubscribeOverride ??\n configurationResponse.options.user_infos_to_subscribe ??\n USER_INFOS_TO_SUBSCRIBE;\n this.reachabilityEnabled =\n configurationResponse.options.reachability_enabled;\n this.userIdentity = configurationResponse.identity;\n this.userInfo = configurationResponse.sync_objects.my_user_info;\n this.myConversations = configurationResponse.sync_objects.my_conversations;\n\n const httpCacheInterval =\n constructorOptions.httpCacheIntervalOverride ??\n configurationResponse.options.http_cache_interval ??\n HTTP_CACHE_LIFETIME;\n\n try {\n this.httpCacheInterval = toSeconds(parseDuration(httpCacheInterval));\n } catch {\n logger.error(\n `Failed to parse http cache interval ${httpCacheInterval}, using default value ${HTTP_CACHE_LIFETIME}`\n );\n this.httpCacheInterval = toSeconds(parseDuration(HTTP_CACHE_LIFETIME));\n }\n\n const consumptionReportInterval =\n constructorOptions.consumptionReportIntervalOverride ??\n configurationResponse.options.consumption_report_interval ??\n CONSUMPTION_HORIZON_SENDING_INTERVAL;\n\n try {\n this.consumptionReportInterval = toSeconds(\n parseDuration(consumptionReportInterval)\n );\n } catch {\n logger.error(\n `Failed to parse consumption report interval ${consumptionReportInterval}, using default value ${CONSUMPTION_HORIZON_SENDING_INTERVAL}`\n );\n this.consumptionReportInterval = toSeconds(\n parseDuration(CONSUMPTION_HORIZON_SENDING_INTERVAL)\n );\n }\n }\n}\n\nexport { Configuration };\n"],"names":["toSeconds","parseDuration"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,MAAM,mBAAmB,GAAG,MAAM,CAAC;AACnC,MAAM,oCAAoC,GAAG,MAAM,CAAC;AACpD,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAEpC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACjC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACjC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACjC,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAQlC,MAAM,aAAa,CAAA;AA8BjB,IAAA,WAAA,CACE,OAAyB,GAAA,EAAE,EAC3B,qBAA4C,EAC5C,MAAc,EAAA;;AAhBA,QAAA,IAAA,CAAA,6BAA6B,GAAW,cAAc,GAAG,IAAI,CAAC;AAkB5E,QAAA,MAAM,kBAAkB,GACtB,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,WAAW,IAAI,OAAO,IAAI,EAAE,CAAC;AAEvD,QAAA,IAAI,CAAC,SAAS,GAAG,kBAAkB,CAAC,SAAS,CAAC;QAE9C,IAAI,CAAC,KAAK,GAAG;AACX,YAAA,eAAe,EAAE,qBAAqB,CAAC,KAAK,C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