@segment/action-destinations 3.188.0 → 3.189.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/dist/destinations/app-fit/index.js +2 -2
- package/dist/destinations/app-fit/index.js.map +1 -1
- package/dist/destinations/app-fit/track/index.js +1 -1
- package/dist/destinations/app-fit/track/index.js.map +1 -1
- package/dist/destinations/attio/index.js +1 -1
- package/dist/destinations/attio/index.js.map +1 -1
- package/dist/destinations/{engage-messaging-twilio/utils/types.js → engage/sendgrid/Profile.js} +1 -1
- package/dist/destinations/engage/sendgrid/Profile.js.map +1 -0
- package/dist/destinations/engage/sendgrid/destinationDefinition.d.ts +3 -0
- package/dist/destinations/engage/sendgrid/destinationDefinition.js +70 -0
- package/dist/destinations/engage/sendgrid/destinationDefinition.js.map +1 -0
- package/dist/destinations/engage/sendgrid/generated-types.d.ts +1 -0
- package/dist/destinations/engage/sendgrid/generated-types.js +14 -0
- package/dist/destinations/engage/sendgrid/generated-types.js.map +1 -0
- package/dist/destinations/engage/sendgrid/index.d.ts +2 -0
- package/dist/destinations/engage/sendgrid/index.js +5 -0
- package/dist/destinations/engage/sendgrid/index.js.map +1 -0
- package/dist/destinations/{engage-messaging-sendgrid/previewApiLookup/index.d.ts → engage/sendgrid/previewApiLookup/actionDefinition.d.ts} +1 -2
- package/dist/destinations/{engage-messaging-sendgrid/previewApiLookup/index.js → engage/sendgrid/previewApiLookup/actionDefinition.js} +4 -4
- package/dist/destinations/engage/sendgrid/previewApiLookup/actionDefinition.js.map +1 -0
- package/dist/destinations/{engage-messaging-sendgrid/utils → engage/sendgrid/previewApiLookup}/api-lookups.d.ts +2 -4
- package/dist/destinations/{engage-messaging-sendgrid/utils → engage/sendgrid/previewApiLookup}/api-lookups.js +1 -15
- package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js.map +1 -0
- package/dist/destinations/engage/sendgrid/previewApiLookup/generated-types.d.ts +1 -0
- package/dist/destinations/engage/sendgrid/previewApiLookup/generated-types.js +14 -0
- package/dist/destinations/engage/sendgrid/previewApiLookup/generated-types.js.map +1 -0
- package/dist/destinations/engage/sendgrid/previewApiLookup/index.d.ts +2 -0
- package/dist/destinations/{engage-messaging-twilio/utils → engage/sendgrid/previewApiLookup}/index.js +2 -6
- package/dist/destinations/engage/sendgrid/previewApiLookup/index.js.map +1 -0
- package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.d.ts +42 -0
- package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.js +318 -0
- package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.js.map +1 -0
- package/dist/destinations/engage/sendgrid/sendEmail/UnlayerResponse.d.ts +12 -0
- package/dist/destinations/engage/sendgrid/sendEmail/UnlayerResponse.js +3 -0
- package/dist/destinations/engage/sendgrid/sendEmail/UnlayerResponse.js.map +1 -0
- package/dist/destinations/engage/sendgrid/sendEmail/actionDefinition.d.ts +4 -0
- package/dist/destinations/engage/sendgrid/sendEmail/actionDefinition.js +236 -0
- package/dist/destinations/engage/sendgrid/sendEmail/actionDefinition.js.map +1 -0
- package/dist/destinations/engage/sendgrid/sendEmail/generated-types.d.ts +1 -0
- package/dist/destinations/engage/sendgrid/sendEmail/generated-types.js +14 -0
- package/dist/destinations/engage/sendgrid/sendEmail/generated-types.js.map +1 -0
- package/dist/destinations/engage/sendgrid/sendEmail/index.d.ts +1 -0
- package/dist/destinations/engage/sendgrid/sendEmail/index.js +14 -0
- package/dist/destinations/engage/sendgrid/sendEmail/index.js.map +1 -0
- package/dist/destinations/engage/sendgrid/sendEmail/insertEmailPreviewText.d.ts +1 -0
- package/dist/destinations/engage/sendgrid/sendEmail/insertEmailPreviewText.js +23 -0
- package/dist/destinations/engage/sendgrid/sendEmail/insertEmailPreviewText.js.map +1 -0
- package/dist/destinations/engage/sendgrid/sendEmail/isRestrictedDomain.d.ts +1 -0
- package/dist/destinations/engage/sendgrid/sendEmail/isRestrictedDomain.js +14 -0
- package/dist/destinations/engage/sendgrid/sendEmail/isRestrictedDomain.js.map +1 -0
- package/dist/destinations/engage/twilio/destinationDefinition.d.ts +3 -0
- package/dist/destinations/engage/twilio/destinationDefinition.js +172 -0
- package/dist/destinations/engage/twilio/destinationDefinition.js.map +1 -0
- package/dist/destinations/engage/twilio/generated-types.d.ts +1 -0
- package/dist/destinations/engage/twilio/generated-types.js +14 -0
- package/dist/destinations/engage/twilio/generated-types.js.map +1 -0
- package/dist/destinations/engage/twilio/index.d.ts +2 -0
- package/dist/destinations/engage/twilio/index.js +5 -0
- package/dist/destinations/engage/twilio/index.js.map +1 -0
- package/dist/destinations/engage/twilio/sendMobilePush/PushSender.d.ts +27 -0
- package/dist/destinations/engage/twilio/sendMobilePush/PushSender.js +142 -0
- package/dist/destinations/engage/twilio/sendMobilePush/PushSender.js.map +1 -0
- package/dist/destinations/engage/twilio/sendMobilePush/actionDefinition.d.ts +4 -0
- package/dist/destinations/{engage-messaging-twilio/sendMobilePush/index.js → engage/twilio/sendMobilePush/actionDefinition.js} +5 -5
- package/dist/destinations/engage/twilio/sendMobilePush/actionDefinition.js.map +1 -0
- package/dist/destinations/engage/twilio/sendMobilePush/generated-types.d.ts +1 -0
- package/dist/destinations/engage/twilio/sendMobilePush/generated-types.js +14 -0
- package/dist/destinations/engage/twilio/sendMobilePush/generated-types.js.map +1 -0
- package/dist/destinations/engage/twilio/sendMobilePush/index.d.ts +1 -0
- package/dist/destinations/engage/twilio/sendMobilePush/index.js +14 -0
- package/dist/destinations/engage/twilio/sendMobilePush/index.js.map +1 -0
- package/dist/destinations/engage/twilio/sendSms/SmsMessageSender.d.ts +9 -0
- package/dist/destinations/{engage-messaging-twilio/sendSms/sms-sender.js → engage/twilio/sendSms/SmsMessageSender.js} +5 -32
- package/dist/destinations/engage/twilio/sendSms/SmsMessageSender.js.map +1 -0
- package/dist/destinations/engage/twilio/sendSms/actionDefinition.d.ts +4 -0
- package/dist/destinations/{engage-messaging-twilio/sendSms/index.js → engage/twilio/sendSms/actionDefinition.js} +5 -5
- package/dist/destinations/engage/twilio/sendSms/actionDefinition.js.map +1 -0
- package/dist/destinations/engage/twilio/sendSms/generated-types.d.ts +1 -0
- package/dist/destinations/engage/twilio/sendSms/generated-types.js +14 -0
- package/dist/destinations/engage/twilio/sendSms/generated-types.js.map +1 -0
- package/dist/destinations/engage/twilio/sendSms/index.d.ts +1 -0
- package/dist/destinations/engage/twilio/sendSms/index.js +14 -0
- package/dist/destinations/engage/twilio/sendSms/index.js.map +1 -0
- package/dist/destinations/engage/twilio/sendWhatsApp/WhatsAppMessageSender.d.ts +8 -0
- package/dist/destinations/{engage-messaging-twilio/sendWhatsApp/whatsapp-sender.js → engage/twilio/sendWhatsApp/WhatsAppMessageSender.js} +8 -4
- package/dist/destinations/engage/twilio/sendWhatsApp/WhatsAppMessageSender.js.map +1 -0
- package/dist/destinations/engage/twilio/sendWhatsApp/actionDefinition.d.ts +4 -0
- package/dist/destinations/{engage-messaging-twilio/sendWhatsApp/index.js → engage/twilio/sendWhatsApp/actionDefinition.js} +5 -5
- package/dist/destinations/engage/twilio/sendWhatsApp/actionDefinition.js.map +1 -0
- package/dist/destinations/engage/twilio/sendWhatsApp/generated-types.d.ts +1 -0
- package/dist/destinations/engage/twilio/sendWhatsApp/generated-types.js +14 -0
- package/dist/destinations/engage/twilio/sendWhatsApp/generated-types.js.map +1 -0
- package/dist/destinations/engage/twilio/sendWhatsApp/index.d.ts +1 -0
- package/dist/destinations/engage/twilio/sendWhatsApp/index.js +14 -0
- package/dist/destinations/engage/twilio/sendWhatsApp/index.js.map +1 -0
- package/dist/destinations/engage/twilio/utils/PhoneMessageSender.d.ts +16 -0
- package/dist/destinations/engage/twilio/utils/PhoneMessageSender.js +57 -0
- package/dist/destinations/engage/twilio/utils/PhoneMessageSender.js.map +1 -0
- package/dist/destinations/engage/twilio/utils/TwilioMessageSender.d.ts +16 -0
- package/dist/destinations/engage/twilio/utils/TwilioMessageSender.js +109 -0
- package/dist/destinations/engage/twilio/utils/TwilioMessageSender.js.map +1 -0
- package/dist/destinations/engage/twilio/utils/index.d.ts +2 -0
- package/dist/destinations/engage/twilio/utils/index.js +15 -0
- package/dist/destinations/engage/twilio/utils/index.js.map +1 -0
- package/dist/destinations/{engage-messaging-twilio → engage/twilio}/utils/types.d.ts +0 -16
- package/dist/destinations/engage/twilio/utils/types.js.map +1 -0
- package/dist/destinations/engage/utils/AggregateError.d.ts +14 -0
- package/dist/destinations/engage/utils/AggregateError.js +26 -0
- package/dist/destinations/engage/utils/AggregateError.js.map +1 -0
- package/dist/destinations/engage/utils/EngageActionPerformer.d.ts +41 -0
- package/dist/destinations/engage/utils/EngageActionPerformer.js +135 -0
- package/dist/destinations/engage/utils/EngageActionPerformer.js.map +1 -0
- package/dist/destinations/{engage-messaging-twilio/utils/MessageLogger.d.ts → engage/utils/EngageLogger.d.ts} +8 -5
- package/dist/destinations/engage/utils/EngageLogger.js +52 -0
- package/dist/destinations/engage/utils/EngageLogger.js.map +1 -0
- package/dist/destinations/engage/utils/EngageStats.d.ts +18 -0
- package/dist/destinations/{engage-messaging-twilio/utils/MessageStats.js → engage/utils/EngageStats.js} +28 -14
- package/dist/destinations/engage/utils/EngageStats.js.map +1 -0
- package/dist/destinations/{engage-messaging-twilio → engage}/utils/IntegrationErrorWrapper.d.ts +2 -2
- package/dist/destinations/{engage-messaging-twilio → engage}/utils/IntegrationErrorWrapper.js +1 -1
- package/dist/destinations/engage/utils/IntegrationErrorWrapper.js.map +1 -0
- package/dist/destinations/engage/utils/MessageSendPerformer.d.ts +63 -0
- package/dist/destinations/engage/utils/MessageSendPerformer.js +191 -0
- package/dist/destinations/engage/utils/MessageSendPerformer.js.map +1 -0
- package/dist/destinations/engage/utils/ResponseError.d.ts +20 -0
- package/dist/destinations/engage/utils/ResponseError.js +17 -0
- package/dist/destinations/engage/utils/ResponseError.js.map +1 -0
- package/dist/destinations/engage/utils/getProfileApiEndpoint.d.ts +2 -0
- package/dist/destinations/engage/utils/getProfileApiEndpoint.js +10 -0
- package/dist/destinations/engage/utils/getProfileApiEndpoint.js.map +1 -0
- package/dist/destinations/engage/utils/index.d.ts +9 -0
- package/dist/destinations/engage/utils/index.js +22 -0
- package/dist/destinations/engage/utils/index.js.map +1 -0
- package/dist/destinations/engage/utils/isDestinationActionService.js.map +1 -0
- package/dist/destinations/engage/utils/isRetryableError.d.ts +2 -0
- package/dist/destinations/engage/utils/isRetryableError.js +33 -0
- package/dist/destinations/engage/utils/isRetryableError.js.map +1 -0
- package/dist/destinations/engage/utils/operationTracking/GenericMethodDecorator.js.map +1 -0
- package/dist/destinations/engage/utils/operationTracking/OperationDecorator.js.map +1 -0
- package/dist/destinations/engage/utils/operationTracking/OperationDuration.js.map +1 -0
- package/dist/destinations/engage/utils/operationTracking/OperationErrorHandler.js.map +1 -0
- package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationFinallyHooks.d.ts +4 -0
- package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationFinallyHooks.js +2 -0
- package/dist/destinations/engage/utils/operationTracking/OperationFinallyHooks.js.map +1 -0
- package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationLogger.d.ts +2 -1
- package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationLogger.js +22 -25
- package/dist/destinations/engage/utils/operationTracking/OperationLogger.js.map +1 -0
- package/dist/destinations/engage/utils/operationTracking/OperationStats.js.map +1 -0
- package/dist/destinations/engage/utils/operationTracking/OperationTracker.test.js.map +1 -0
- package/dist/destinations/engage/utils/operationTracking/OperationTree.js.map +1 -0
- package/dist/destinations/engage/utils/operationTracking/TrackedError.js.map +1 -0
- package/dist/destinations/engage/utils/operationTracking/index.js.map +1 -0
- package/dist/destinations/engage/utils/operationTracking/wrapTryCatchFinallyPromisable.js.map +1 -0
- package/dist/destinations/engage/utils/testUtils.d.ts +6 -0
- package/dist/destinations/engage/utils/testUtils.js +26 -0
- package/dist/destinations/engage/utils/testUtils.js.map +1 -0
- package/dist/destinations/engage/utils/track.d.ts +52 -0
- package/dist/destinations/engage/utils/track.js +9 -0
- package/dist/destinations/engage/utils/track.js.map +1 -0
- package/dist/destinations/engage-messaging-sendgrid/index.d.ts +2 -3
- package/dist/destinations/engage-messaging-sendgrid/index.js +13 -67
- package/dist/destinations/engage-messaging-sendgrid/index.js.map +1 -1
- package/dist/destinations/engage-messaging-sendgrid/previewApiLookup.types.js +3 -0
- package/dist/destinations/engage-messaging-sendgrid/previewApiLookup.types.js.map +1 -0
- package/dist/destinations/engage-messaging-sendgrid/sendEmail.types.js +3 -0
- package/dist/destinations/engage-messaging-sendgrid/sendEmail.types.js.map +1 -0
- package/dist/destinations/engage-messaging-twilio/index.d.ts +2 -3
- package/dist/destinations/engage-messaging-twilio/index.js +13 -169
- package/dist/destinations/engage-messaging-twilio/index.js.map +1 -1
- package/dist/destinations/engage-messaging-twilio/sendMobilePush.types.js +3 -0
- package/dist/destinations/engage-messaging-twilio/sendMobilePush.types.js.map +1 -0
- package/dist/destinations/engage-messaging-twilio/sendSms.types.js +3 -0
- package/dist/destinations/engage-messaging-twilio/sendSms.types.js.map +1 -0
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp.types.js +3 -0
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp.types.js.map +1 -0
- package/dist/destinations/hilo/generated-types.d.ts +3 -0
- package/dist/destinations/hilo/generated-types.js.map +1 -0
- package/dist/destinations/hilo/group/generated-types.d.ts +9 -0
- package/dist/destinations/hilo/group/generated-types.js.map +1 -0
- package/dist/destinations/hilo/group/index.js +59 -0
- package/dist/destinations/hilo/group/index.js.map +1 -0
- package/dist/destinations/hilo/identify/generated-types.d.ts +8 -0
- package/dist/destinations/hilo/identify/generated-types.js.map +1 -0
- package/dist/destinations/hilo/identify/index.js +51 -0
- package/dist/destinations/hilo/identify/index.js.map +1 -0
- package/dist/destinations/hilo/index.d.ts +4 -0
- package/dist/destinations/hilo/index.js +103 -0
- package/dist/destinations/hilo/index.js.map +1 -0
- package/dist/destinations/hilo/page/generated-types.d.ts +9 -0
- package/dist/destinations/hilo/page/generated-types.js.map +1 -0
- package/dist/destinations/{engage-messaging-sendgrid/sendEmail → hilo/page}/index.d.ts +1 -1
- package/dist/destinations/hilo/page/index.js +59 -0
- package/dist/destinations/hilo/page/index.js.map +1 -0
- package/dist/destinations/hilo/screen/generated-types.d.ts +9 -0
- package/dist/destinations/hilo/screen/generated-types.js.map +1 -0
- package/dist/destinations/{engage-messaging-twilio/sendMobilePush → hilo/screen}/index.d.ts +1 -1
- package/dist/destinations/hilo/screen/index.js +59 -0
- package/dist/destinations/hilo/screen/index.js.map +1 -0
- package/dist/destinations/hilo/track/generated-types.d.ts +9 -0
- package/dist/destinations/hilo/track/generated-types.js +3 -0
- package/dist/destinations/hilo/track/generated-types.js.map +1 -0
- package/dist/destinations/hilo/track/index.d.ts +5 -0
- package/dist/destinations/hilo/track/index.js +59 -0
- package/dist/destinations/hilo/track/index.js.map +1 -0
- package/dist/destinations/hubspot/api/index.d.ts +11 -5
- package/dist/destinations/hubspot/api/index.js +59 -24
- package/dist/destinations/hubspot/api/index.js.map +1 -1
- package/dist/destinations/hubspot/errors.d.ts +2 -0
- package/dist/destinations/hubspot/errors.js +3 -1
- package/dist/destinations/hubspot/errors.js.map +1 -1
- package/dist/destinations/hubspot/upsertCompany/index.js +1 -1
- package/dist/destinations/hubspot/upsertCompany/index.js.map +1 -1
- package/dist/destinations/hubspot/upsertCustomObjectRecord/generated-types.d.ts +5 -0
- package/dist/destinations/hubspot/upsertCustomObjectRecord/index.js +113 -22
- package/dist/destinations/hubspot/upsertCustomObjectRecord/index.js.map +1 -1
- package/dist/destinations/hubspot/utils.d.ts +23 -0
- package/dist/destinations/hubspot/utils.js +7 -1
- package/dist/destinations/hubspot/utils.js.map +1 -1
- package/dist/destinations/index.js +5 -2
- package/dist/destinations/index.js.map +1 -1
- package/dist/destinations/iterable/generated-types.d.ts +1 -0
- package/dist/destinations/iterable/index.js +20 -1
- package/dist/destinations/iterable/index.js.map +1 -1
- package/dist/destinations/iterable/index.test.d.ts +1 -0
- package/dist/destinations/iterable/index.test.js +46 -0
- package/dist/destinations/iterable/index.test.js.map +1 -0
- package/dist/destinations/iterable/shared-fields.d.ts +1 -0
- package/dist/destinations/iterable/trackEvent/index.js +3 -2
- package/dist/destinations/iterable/trackEvent/index.js.map +1 -1
- package/dist/destinations/iterable/trackPurchase/index.js +3 -2
- package/dist/destinations/iterable/trackPurchase/index.js.map +1 -1
- package/dist/destinations/iterable/updateCart/index.js +3 -2
- package/dist/destinations/iterable/updateCart/index.js.map +1 -1
- package/dist/destinations/iterable/updateUser/index.js +3 -2
- package/dist/destinations/iterable/updateUser/index.js.map +1 -1
- package/dist/destinations/iterable/utils.d.ts +9 -1
- package/dist/destinations/iterable/utils.js +18 -1
- package/dist/destinations/iterable/utils.js.map +1 -1
- package/dist/destinations/rehook/generated-types.d.ts +4 -0
- package/dist/destinations/rehook/generated-types.js +3 -0
- package/dist/destinations/rehook/generated-types.js.map +1 -0
- package/dist/destinations/rehook/identifyUser/generated-types.d.ts +7 -0
- package/dist/destinations/rehook/identifyUser/generated-types.js +3 -0
- package/dist/destinations/rehook/identifyUser/generated-types.js.map +1 -0
- package/dist/destinations/rehook/identifyUser/index.d.ts +5 -0
- package/dist/destinations/rehook/identifyUser/index.js +44 -0
- package/dist/destinations/rehook/identifyUser/index.js.map +1 -0
- package/dist/destinations/rehook/index.d.ts +4 -0
- package/dist/destinations/rehook/index.js +47 -0
- package/dist/destinations/rehook/index.js.map +1 -0
- package/dist/destinations/rehook/trackEvent/generated-types.d.ts +7 -0
- package/dist/destinations/rehook/trackEvent/generated-types.js +3 -0
- package/dist/destinations/rehook/trackEvent/generated-types.js.map +1 -0
- package/dist/destinations/rehook/trackEvent/index.d.ts +5 -0
- package/dist/destinations/rehook/trackEvent/index.js +48 -0
- package/dist/destinations/rehook/trackEvent/index.js.map +1 -0
- package/package.json +2 -2
- package/dist/destinations/engage-messaging-sendgrid/previewApiLookup/generated-types.js.map +0 -1
- package/dist/destinations/engage-messaging-sendgrid/previewApiLookup/index.js.map +0 -1
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/generated-types.js.map +0 -1
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/index.js +0 -578
- package/dist/destinations/engage-messaging-sendgrid/sendEmail/index.js.map +0 -1
- package/dist/destinations/engage-messaging-sendgrid/utils/api-lookups.js.map +0 -1
- package/dist/destinations/engage-messaging-sendgrid/utils/types.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/operationTracking/GenericMethodDecorator.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/operationTracking/OperationDecorator.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/operationTracking/OperationDuration.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/operationTracking/OperationErrorHandler.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/operationTracking/OperationFinallyHooks.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/operationTracking/OperationLogger.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/operationTracking/OperationStats.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/operationTracking/OperationTracker.test.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/operationTracking/OperationTree.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/operationTracking/TrackedError.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/operationTracking/index.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/operationTracking/wrapTryCatchFinallyPromisable.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/sendMobilePush/generated-types.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/sendMobilePush/index.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/sendMobilePush/push-sender.d.ts +0 -17
- package/dist/destinations/engage-messaging-twilio/sendMobilePush/push-sender.js +0 -182
- package/dist/destinations/engage-messaging-twilio/sendMobilePush/push-sender.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/sendSms/generated-types.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/sendSms/index.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.d.ts +0 -9
- package/dist/destinations/engage-messaging-twilio/sendSms/sms-sender.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp/generated-types.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp/index.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.d.ts +0 -7
- package/dist/destinations/engage-messaging-twilio/sendWhatsApp/whatsapp-sender.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/utils/IntegrationErrorWrapper.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/utils/MessageLogger.js +0 -36
- package/dist/destinations/engage-messaging-twilio/utils/MessageLogger.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/utils/MessageStats.d.ts +0 -14
- package/dist/destinations/engage-messaging-twilio/utils/MessageStats.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/utils/index.d.ts +0 -6
- package/dist/destinations/engage-messaging-twilio/utils/index.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/utils/isDestinationActionService.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/utils/message-sender.d.ts +0 -43
- package/dist/destinations/engage-messaging-twilio/utils/message-sender.js +0 -203
- package/dist/destinations/engage-messaging-twilio/utils/message-sender.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/utils/phone-message.d.ts +0 -19
- package/dist/destinations/engage-messaging-twilio/utils/phone-message.js +0 -97
- package/dist/destinations/engage-messaging-twilio/utils/phone-message.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/utils/track.d.ts +0 -45
- package/dist/destinations/engage-messaging-twilio/utils/track.js +0 -9
- package/dist/destinations/engage-messaging-twilio/utils/track.js.map +0 -1
- package/dist/destinations/engage-messaging-twilio/utils/types.js.map +0 -1
- /package/dist/destinations/{engage-messaging-sendgrid/utils/types.d.ts → engage/sendgrid/Profile.d.ts} +0 -0
- /package/dist/destinations/{engage-messaging-sendgrid → engage/twilio}/utils/types.js +0 -0
- /package/dist/destinations/{engage-messaging-twilio → engage}/utils/isDestinationActionService.d.ts +0 -0
- /package/dist/destinations/{engage-messaging-twilio → engage}/utils/isDestinationActionService.js +0 -0
- /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/GenericMethodDecorator.d.ts +0 -0
- /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/GenericMethodDecorator.js +0 -0
- /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationDecorator.d.ts +0 -0
- /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationDecorator.js +0 -0
- /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationDuration.d.ts +0 -0
- /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationDuration.js +0 -0
- /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationErrorHandler.d.ts +0 -0
- /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationErrorHandler.js +0 -0
- /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationStats.d.ts +0 -0
- /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationStats.js +0 -0
- /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationTracker.test.d.ts +0 -0
- /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationTracker.test.js +0 -0
- /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationTree.d.ts +0 -0
- /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/OperationTree.js +0 -0
- /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/TrackedError.d.ts +0 -0
- /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/TrackedError.js +0 -0
- /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/index.d.ts +0 -0
- /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/index.js +0 -0
- /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/wrapTryCatchFinallyPromisable.d.ts +0 -0
- /package/dist/destinations/{engage-messaging-twilio → engage/utils}/operationTracking/wrapTryCatchFinallyPromisable.js +0 -0
- /package/dist/destinations/engage-messaging-sendgrid/{previewApiLookup/generated-types.d.ts → previewApiLookup.types.d.ts} +0 -0
- /package/dist/destinations/engage-messaging-sendgrid/{sendEmail/generated-types.d.ts → sendEmail.types.d.ts} +0 -0
- /package/dist/destinations/engage-messaging-twilio/{sendMobilePush/generated-types.d.ts → sendMobilePush.types.d.ts} +0 -0
- /package/dist/destinations/engage-messaging-twilio/{sendSms/generated-types.d.ts → sendSms.types.d.ts} +0 -0
- /package/dist/destinations/engage-messaging-twilio/{sendWhatsApp/generated-types.d.ts → sendWhatsApp.types.d.ts} +0 -0
- /package/dist/destinations/{engage-messaging-sendgrid/previewApiLookup → hilo}/generated-types.js +0 -0
- /package/dist/destinations/{engage-messaging-sendgrid/sendEmail → hilo/group}/generated-types.js +0 -0
- /package/dist/destinations/{engage-messaging-twilio/sendSms → hilo/group}/index.d.ts +0 -0
- /package/dist/destinations/{engage-messaging-twilio/sendMobilePush → hilo/identify}/generated-types.js +0 -0
- /package/dist/destinations/{engage-messaging-twilio/sendWhatsApp → hilo/identify}/index.d.ts +0 -0
- /package/dist/destinations/{engage-messaging-twilio/sendSms → hilo/page}/generated-types.js +0 -0
- /package/dist/destinations/{engage-messaging-twilio/sendWhatsApp → hilo/screen}/generated-types.js +0 -0
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
3
|
+
exports.actionDefinition = void 0;
|
|
4
|
+
const SmsMessageSender_1 = require("./SmsMessageSender");
|
|
5
|
+
exports.actionDefinition = {
|
|
5
6
|
title: 'Send SMS',
|
|
6
7
|
description: 'Send SMS using Twilio',
|
|
7
8
|
defaultSubscription: 'type = "track" and event = "Audience Entered"',
|
|
@@ -140,8 +141,7 @@ const action = {
|
|
|
140
141
|
}
|
|
141
142
|
},
|
|
142
143
|
perform: async (request, data) => {
|
|
143
|
-
return new
|
|
144
|
+
return new SmsMessageSender_1.SmsMessageSender(request, data).perform();
|
|
144
145
|
}
|
|
145
146
|
};
|
|
146
|
-
|
|
147
|
-
//# sourceMappingURL=index.js.map
|
|
147
|
+
//# sourceMappingURL=actionDefinition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actionDefinition.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/sendSms/actionDefinition.ts"],"names":[],"mappings":";;;AAIA,yDAAqD;AAExC,QAAA,gBAAgB,GAAwC;IACnE,KAAK,EAAE,UAAU;IACjB,WAAW,EAAE,uBAAuB;IACpC,mBAAmB,EAAE,+CAA+C;IACpE,MAAM,EAAE;QACN,MAAM,EAAE;YACN,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,oBAAoB;YACjC,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;SACjC;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,aAAa;YACpB,WAAW,EAAE,oCAAoC;YACjD,IAAI,EAAE,QAAQ;SACf;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,6EAA6E;YAC1F,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,IAAI,EAAE;YACJ,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,iBAAiB;YAC9B,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE,KAAK;SAChB;QACD,KAAK,EAAE;YACL,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,4BAA4B;YACzC,IAAI,EAAE,QAAQ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ACxD,IAAI,EAAE,QAAQ;iBACf;aACF;YACD,OAAO,EAAE;gBACP,YAAY,EAAE;oBACZ,gBAAgB;oBAChB;wBACE,EAAE,EAAE;4BACF,OAAO,EAAE,MAAM;yBAChB;wBACD,IAAI,EAAE;4BACJ,OAAO,EAAE,QAAQ;yBAClB;wBACD,WAAW,EAAE;4BACX,OAAO,EAAE,eAAe;yBACzB;wBACD,kBAAkB,EAAE;4BAClB,OAAO,EAAE,gBAAgB;yBAC1B;qBACF;iBACF;aACF;SACF;QACD,MAAM,EAAE;YACN,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,yBAAyB;YACtC,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;SACrC;QACD,eAAe,EAAE;YACf,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,yCAAyC;YACtD,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;QACD,SAAS,EAAE;YACT,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,uBAAuB;YACpC,KAAK,EAAE,WAAW;YAClB,OAAO,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;SACpC;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC/B,OAAO,IAAI,mCAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,CAAA;IACtD,CAAC;CACF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../engage-messaging-twilio/sendSms.types';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("../../../engage-messaging-twilio/sendSms.types"), exports);
|
|
14
|
+
//# sourceMappingURL=generated-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/sendSms/generated-types.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iFAA8D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './actionDefinition';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./actionDefinition"), exports);
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/sendSms/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAkC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Payload } from './generated-types';
|
|
2
|
+
import { PhoneMessageSender } from '../utils';
|
|
3
|
+
export declare class WhatsAppMessageSender extends PhoneMessageSender<Payload> {
|
|
4
|
+
get supportedTemplateTypes(): string[];
|
|
5
|
+
getChannelType(): string;
|
|
6
|
+
getBody(phone: string): Promise<URLSearchParams>;
|
|
7
|
+
private getVariables;
|
|
8
|
+
}
|
|
@@ -11,9 +11,13 @@ const liquidjs_1 = require("liquidjs");
|
|
|
11
11
|
const actions_core_1 = require("@segment/actions-core");
|
|
12
12
|
const google_libphonenumber_1 = require("google-libphonenumber");
|
|
13
13
|
const utils_1 = require("../utils");
|
|
14
|
+
const utils_2 = require("../../utils");
|
|
14
15
|
const phoneUtil = google_libphonenumber_1.PhoneNumberUtil.getInstance();
|
|
15
16
|
const Liquid = new liquidjs_1.Liquid();
|
|
16
|
-
class WhatsAppMessageSender extends utils_1.
|
|
17
|
+
class WhatsAppMessageSender extends utils_1.PhoneMessageSender {
|
|
18
|
+
get supportedTemplateTypes() {
|
|
19
|
+
throw new Error('Method not supported.');
|
|
20
|
+
}
|
|
17
21
|
getChannelType() {
|
|
18
22
|
return 'whatsapp';
|
|
19
23
|
}
|
|
@@ -62,10 +66,10 @@ class WhatsAppMessageSender extends utils_1.PhoneMessage {
|
|
|
62
66
|
}
|
|
63
67
|
}
|
|
64
68
|
__decorate([
|
|
65
|
-
|
|
69
|
+
utils_2.track()
|
|
66
70
|
], WhatsAppMessageSender.prototype, "getBody", null);
|
|
67
71
|
__decorate([
|
|
68
|
-
|
|
72
|
+
utils_2.track({
|
|
69
73
|
wrapIntegrationError: () => [
|
|
70
74
|
`Unable to parse templating in content variables`,
|
|
71
75
|
`Content variables templating parse failure`,
|
|
@@ -74,4 +78,4 @@ __decorate([
|
|
|
74
78
|
})
|
|
75
79
|
], WhatsAppMessageSender.prototype, "getVariables", null);
|
|
76
80
|
exports.WhatsAppMessageSender = WhatsAppMessageSender;
|
|
77
|
-
//# sourceMappingURL=
|
|
81
|
+
//# sourceMappingURL=WhatsAppMessageSender.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WhatsAppMessageSender.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/sendWhatsApp/WhatsAppMessageSender.ts"],"names":[],"mappings":";;;;;;;;;AACA,uCAA6C;AAE7C,wDAAwD;AACxD,iEAA0E;AAC1E,oCAA6C;AAC7C,uCAAmC;AAEnC,MAAM,SAAS,GAAG,uCAAe,CAAC,WAAW,EAAE,CAAA;AAC/C,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AAE7B,MAAa,qBAAsB,SAAQ,0BAA2B;IACpE,IAAI,sBAAsB;QACxB,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAA;IAC1C,CAAC;IACD,cAAc;QACZ,OAAO,UAAU,CAAA;IACnB,CAAC;IAGD,KAAK,CAAC,OAAO,CAAC,KAAa;QACzB,IAAI,WAAW,CAAA;QAEf,IAAI;YAIF,WAAW,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;YAC1C,WAAW,GAAG,SAAS,CAAC,MAAM,CAAC,WAAW,EAAE,yCAAiB,CAAC,IAAI,CAAC,CAAA;YACnE,WAAW,GAAG,YAAY,WAAW,EAAE,CAAA;SACxC;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,eAAe,GAAG,CAAU,CAAA;YAClC,MAAM,IAAI,+BAAgB,CACxB,kEAAkE,GAAG,eAAe,CAAC,OAAO,EAC5F,eAAe,EACf,GAAG,CACJ,CAAA;SACF;QAED,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YAC5B,MAAM,IAAI,+BAAgB,CAAC,gDAAgD,EAAE,qBAAqB,EAAE,GAAG,CAAC,CAAA;SACz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IAPC,aAAK,CAAC;QACL,oBAAoB,EAAE,GAAG,EAAE,CAAC;YAC1B,iDAAiD;YACjD,4CAA4C;YAC5C,GAAG;SACJ;KACF,CAAC;yDAwBD;AA1EH,sDA2EC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
const
|
|
3
|
+
exports.actionDefinition = void 0;
|
|
4
|
+
const WhatsAppMessageSender_1 = require("./WhatsAppMessageSender");
|
|
5
|
+
exports.actionDefinition = {
|
|
5
6
|
title: 'Send WhatsApp',
|
|
6
7
|
description: 'Send WhatsApp using Twilio',
|
|
7
8
|
defaultSubscription: 'type = "track" and event = "Audience Entered"',
|
|
@@ -120,8 +121,7 @@ const action = {
|
|
|
120
121
|
}
|
|
121
122
|
},
|
|
122
123
|
perform: async (request, data) => {
|
|
123
|
-
return new
|
|
124
|
+
return new WhatsAppMessageSender_1.WhatsAppMessageSender(request, data).perform();
|
|
124
125
|
}
|
|
125
126
|
};
|
|
126
|
-
|
|
127
|
-
//# sourceMappingURL=index.js.map
|
|
127
|
+
//# sourceMappingURL=actionDefinition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actionDefinition.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/sendWhatsApp/actionDefinition.ts"],"names":[],"mappings":";;;AAIA,mEAA+D;AAElD,QAAA,gBAAgB,GAAwC;IACnE,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,4BAA4B;IACzC,mBAAmB,EAAE,+CAA+C;IACpE,MAAM,EAAE;QACN,UAAU,EAAE;YACV,KAAK,EAAE,+BAA+B;YACtC,WAAW,EAAE,2CAA2C;YACxD,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;SACf;QACD,gBAAgB,EAAE;YAChB,KAAK,EAAE,6BAA6B;YACpC,WAAW,EAAE,wEAAwE;YACrF,IAAI,EAAE,Q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gBACD,kBAAkB,EAAE;oBAClB,KAAK,EAAE,IAAI;oBACX,WAAW,EAAE,2CAA2C;oBACxD,IAAI,EAAE,QAAQ;iBACf;aACF;YACD,OAAO,EAAE;gBACP,YAAY,EAAE;oBACZ,gBAAgB;oBAChB;wBACE,EAAE,EAAE;4BACF,OAAO,EAAE,MAAM;yBAChB;wBACD,IAAI,EAAE;4BACJ,OAAO,EAAE,QAAQ;yBAClB;wBACD,WAAW,EAAE;4BACX,OAAO,EAAE,eAAe;yBACzB;wBACD,kBAAkB,EAAE;4BAClB,OAAO,EAAE,gBAAgB;yBAC1B;qBACF;iBACF;aACF;SACF;QACD,MAAM,EAAE;YACN,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,yBAAyB;YACtC,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;SACrC;QACD,eAAe,EAAE;YACf,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,yCAAyC;YACtD,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE,aAAa;aACvB;SACF;KACF;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC/B,OAAO,IAAI,6CAAqB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,OAAO,EAAE,CAAA;IAC3D,CAAC;CACF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../engage-messaging-twilio/sendWhatsApp.types';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("../../../engage-messaging-twilio/sendWhatsApp.types"), exports);
|
|
14
|
+
//# sourceMappingURL=generated-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/sendWhatsApp/generated-types.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,sFAAmE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './actionDefinition';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./actionDefinition"), exports);
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/sendWhatsApp/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qDAAkC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TwilioMessageSender, TwilioPayloadBase } from './TwilioMessageSender';
|
|
2
|
+
import { ExtId } from '../../utils';
|
|
3
|
+
export declare abstract class PhoneMessageSender<Payload extends PhoneMessagePayload> extends TwilioMessageSender<Payload> {
|
|
4
|
+
private readonly EXTERNAL_ID_KEY;
|
|
5
|
+
private readonly DEFAULT_HOSTNAME;
|
|
6
|
+
private readonly DEFAULT_CONNECTION_OVERRIDES;
|
|
7
|
+
abstract getBody(phone: string): Promise<URLSearchParams>;
|
|
8
|
+
get twilioHostname(): string;
|
|
9
|
+
get twilioToken(): string;
|
|
10
|
+
sendToRecepient(recepient: ExtId<Payload>): Promise<import("@segment/actions-core/*").ModifiedResponse<unknown>>;
|
|
11
|
+
isSupportedExternalId(externalId: NonNullable<Payload['externalIds']>[number]): boolean;
|
|
12
|
+
getRecepients(): ExtId<Payload>[];
|
|
13
|
+
}
|
|
14
|
+
export interface PhoneMessagePayload extends TwilioPayloadBase {
|
|
15
|
+
toNumber?: string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PhoneMessageSender = void 0;
|
|
4
|
+
const TwilioMessageSender_1 = require("./TwilioMessageSender");
|
|
5
|
+
const utils_1 = require("../../utils");
|
|
6
|
+
class PhoneMessageSender extends TwilioMessageSender_1.TwilioMessageSender {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.EXTERNAL_ID_KEY = 'phone';
|
|
10
|
+
this.DEFAULT_HOSTNAME = 'api.twilio.com';
|
|
11
|
+
this.DEFAULT_CONNECTION_OVERRIDES = 'rp=all&rc=5';
|
|
12
|
+
}
|
|
13
|
+
get twilioHostname() {
|
|
14
|
+
return this.settings.twilioHostname ?? this.DEFAULT_HOSTNAME;
|
|
15
|
+
}
|
|
16
|
+
get twilioToken() {
|
|
17
|
+
return Buffer.from(`${this.settings.twilioApiKeySID}:${this.settings.twilioApiKeySecret}`).toString('base64');
|
|
18
|
+
}
|
|
19
|
+
async sendToRecepient(recepient) {
|
|
20
|
+
const phone = recepient.id;
|
|
21
|
+
const op = this.currentOperation;
|
|
22
|
+
this.currentOperation?.onFinally.push(() => {
|
|
23
|
+
const error = op.error;
|
|
24
|
+
if (error)
|
|
25
|
+
op.tags.push('not_sent_reason:error_operation_' + utils_1.OperationDecorator.getOperationName(error.trackedContext || op));
|
|
26
|
+
});
|
|
27
|
+
const body = await this.getBody(phone);
|
|
28
|
+
const webhookUrlWithParams = this.getWebhookUrlWithParams(this.EXTERNAL_ID_KEY, phone, this.DEFAULT_CONNECTION_OVERRIDES);
|
|
29
|
+
if (webhookUrlWithParams)
|
|
30
|
+
body.append('StatusCallback', webhookUrlWithParams);
|
|
31
|
+
this.statsSet('message_body_size', body?.toString().length);
|
|
32
|
+
const response = await this.request(`https://${this.twilioHostname}/2010-04-01/Accounts/${this.settings.twilioAccountSID}/Messages.json`, {
|
|
33
|
+
method: 'POST',
|
|
34
|
+
headers: {
|
|
35
|
+
authorization: `Basic ${this.twilioToken}`
|
|
36
|
+
},
|
|
37
|
+
body
|
|
38
|
+
});
|
|
39
|
+
this.logDetails['twilio-request-id'] = response.headers?.get('twilio-request-id');
|
|
40
|
+
return response;
|
|
41
|
+
}
|
|
42
|
+
isSupportedExternalId(externalId) {
|
|
43
|
+
return externalId.type === 'phone' && externalId.channelType?.toLowerCase() === this.getChannelType();
|
|
44
|
+
}
|
|
45
|
+
getRecepients() {
|
|
46
|
+
if (this.payload.toNumber)
|
|
47
|
+
return [
|
|
48
|
+
{
|
|
49
|
+
id: this.payload.toNumber
|
|
50
|
+
}
|
|
51
|
+
];
|
|
52
|
+
const res = super.getRecepients();
|
|
53
|
+
return res.length > 0 ? [res[0]] : res;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.PhoneMessageSender = PhoneMessageSender;
|
|
57
|
+
//# sourceMappingURL=PhoneMessageSender.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PhoneMessageSender.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/utils/PhoneMessageSender.ts"],"names":[],"mappings":";;;AAEA,+DAA8E;AAC9E,uCAAuF;AAKvF,MAAsB,kBAAwD,SAAQ,yCAA4B;IAAlH;;QACmB,oBAAe,GAAG,OAAO,CAAA;QACzB,qBAAgB,GAAG,gBAAgB,CAAA;QACnC,iCAA4B,GAAG,aAAa,CAAA;IAmE/D,CAAC;IA/DC,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC,cAAc,IAAI,IAAI,CAAC,gBAAgB,CAAA;IAC9D,CAAC;IACD,IAAI,WAAW;QACb,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,eAAe,IAAI,IAAI,CAAC,QAAQ,CAAC,kBAAkB,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IAC/G,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,SAAyB;QAC7C,MAAM,KAAK,GAAG,SAAS,CAAC,EAAG,CAAA;QAC3B,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAoC,CAAA;QACpD,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE;YACzC,MAAM,KAAK,GAAG,EAAE,CAAC,KAAqB,CAAA;YACtC,IAAI,KAAK;gBACP,EAAE,CAAC,IAAI,CAAC,IAAI,CACV,kCAAkC,GAAG,0BAAkB,CAAC,gBAAgB,CAAC,KAAK,CAAC,cAAc,IAAI,EAAE,CAAC,CACrG,CAAA;QACL,CAAC,CAAC,CAAA;QAGF,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QAEtC,MAAM,oBAAoB,GAAG,IAAI,CAAC,uBAAuB,CACvD,IAAI,CAAC,eAAe,EACp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ile } from './types';
|
|
3
|
+
import { MessageSendPerformer, MessagePayloadBase } from '../../utils';
|
|
4
|
+
export interface TwilioPayloadBase extends MessagePayloadBase {
|
|
5
|
+
contentSid?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare abstract class TwilioMessageSender<TPayload extends TwilioPayloadBase> extends MessageSendPerformer<Settings, TPayload> {
|
|
8
|
+
getIntegrationStatsName(): string;
|
|
9
|
+
getDefaultSettingsRegion(): string;
|
|
10
|
+
abstract readonly supportedTemplateTypes: string[];
|
|
11
|
+
parseContent<R extends Record<string, string | string[] | undefined>>(content: R, profile: Profile): Promise<R>;
|
|
12
|
+
getContentTemplateTypes(): Promise<ContentTemplateTypes>;
|
|
13
|
+
private extractTemplateTypes;
|
|
14
|
+
getWebhookUrlWithParams(externalIdType?: string, externalIdValue?: string, defaultConnectionOverrides?: string): string | null;
|
|
15
|
+
beforePerform(): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.TwilioMessageSender = void 0;
|
|
10
|
+
const liquidjs_1 = require("liquidjs");
|
|
11
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
12
|
+
const utils_1 = require("../../utils");
|
|
13
|
+
const Liquid = new liquidjs_1.Liquid();
|
|
14
|
+
class TwilioMessageSender extends utils_1.MessageSendPerformer {
|
|
15
|
+
getIntegrationStatsName() {
|
|
16
|
+
return 'actions_personas_messaging_twilio';
|
|
17
|
+
}
|
|
18
|
+
getDefaultSettingsRegion() {
|
|
19
|
+
return 'us-west-1';
|
|
20
|
+
}
|
|
21
|
+
async parseContent(content, profile) {
|
|
22
|
+
const parsedEntries = await Promise.all(Object.entries(content).map(async ([key, val]) => {
|
|
23
|
+
if (val == null) {
|
|
24
|
+
return [key, val];
|
|
25
|
+
}
|
|
26
|
+
if (Array.isArray(val)) {
|
|
27
|
+
val = await Promise.all(val.map((item) => Liquid.parseAndRender(item, { profile })));
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
val = await Liquid.parseAndRender(val, { profile });
|
|
31
|
+
}
|
|
32
|
+
return [key, val];
|
|
33
|
+
}));
|
|
34
|
+
return Object.fromEntries(parsedEntries);
|
|
35
|
+
}
|
|
36
|
+
async getContentTemplateTypes() {
|
|
37
|
+
if (!this.payload.contentSid) {
|
|
38
|
+
throw new actions_core_1.PayloadValidationError('Content SID not in payload');
|
|
39
|
+
}
|
|
40
|
+
const twilioToken = Buffer.from(`${this.settings.twilioApiKeySID}:${this.settings.twilioApiKeySecret}`).toString('base64');
|
|
41
|
+
const response = await this.request(`https://content.twilio.com/v1/Content/${this.payload.contentSid}`, {
|
|
42
|
+
method: 'GET',
|
|
43
|
+
headers: {
|
|
44
|
+
authorization: `Basic ${twilioToken}`
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
const template = (await response.json());
|
|
48
|
+
return this.extractTemplateTypes(template);
|
|
49
|
+
}
|
|
50
|
+
extractTemplateTypes(template) {
|
|
51
|
+
if (!template.types) {
|
|
52
|
+
throw new actions_core_1.IntegrationError('Template from Twilio Content API does not contain any template types', `NO_CONTENT_TYPES`, 400);
|
|
53
|
+
}
|
|
54
|
+
const type = Object.keys(template.types)[0];
|
|
55
|
+
if (this.supportedTemplateTypes.includes(type)) {
|
|
56
|
+
return { body: template.types[type].body, media: template.types[type].media };
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
throw new actions_core_1.IntegrationError(`Sending templates with '${type}' content type is not supported by ${this.getChannelType()}`, 'UNSUPPORTED_CONTENT_TYPE', 400);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
getWebhookUrlWithParams(externalIdType, externalIdValue, defaultConnectionOverrides = 'rp=all&rc=5') {
|
|
63
|
+
const webhookUrl = this.settings.webhookUrl;
|
|
64
|
+
const connectionOverrides = this.settings.connectionOverrides;
|
|
65
|
+
const customArgs = {
|
|
66
|
+
...this.payload.customArgs,
|
|
67
|
+
space_id: this.settings.spaceId,
|
|
68
|
+
__segment_internal_external_id_key__: externalIdType,
|
|
69
|
+
__segment_internal_external_id_value__: externalIdValue
|
|
70
|
+
};
|
|
71
|
+
if (webhookUrl && customArgs) {
|
|
72
|
+
this.logOnError(() => JSON.stringify(customArgs));
|
|
73
|
+
const webhookUrlWithParams = new URL(webhookUrl);
|
|
74
|
+
for (const key of Object.keys(customArgs)) {
|
|
75
|
+
webhookUrlWithParams.searchParams.append(key, String(customArgs[key]));
|
|
76
|
+
}
|
|
77
|
+
webhookUrlWithParams.hash = connectionOverrides || defaultConnectionOverrides;
|
|
78
|
+
return webhookUrlWithParams.toString();
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
beforePerform() {
|
|
83
|
+
super.beforePerform();
|
|
84
|
+
Object.assign(this.logDetails, {
|
|
85
|
+
contentSid: this.payload.contentSid,
|
|
86
|
+
twilioApiKeySID: this.settings.twilioApiKeySID
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
__decorate([
|
|
91
|
+
utils_1.track({
|
|
92
|
+
wrapIntegrationError: () => new actions_core_1.PayloadValidationError('Unable to parse templating, invalid liquid')
|
|
93
|
+
})
|
|
94
|
+
], TwilioMessageSender.prototype, "parseContent", null);
|
|
95
|
+
__decorate([
|
|
96
|
+
utils_1.track({
|
|
97
|
+
wrapIntegrationError: () => ['Unable to fetch content template', 'Twilio Content API request failure', 500]
|
|
98
|
+
})
|
|
99
|
+
], TwilioMessageSender.prototype, "getContentTemplateTypes", null);
|
|
100
|
+
__decorate([
|
|
101
|
+
utils_1.track()
|
|
102
|
+
], TwilioMessageSender.prototype, "extractTemplateTypes", null);
|
|
103
|
+
__decorate([
|
|
104
|
+
utils_1.track({
|
|
105
|
+
wrapIntegrationError: () => new actions_core_1.PayloadValidationError('Invalid webhook url arguments')
|
|
106
|
+
})
|
|
107
|
+
], TwilioMessageSender.prototype, "getWebhookUrlWithParams", null);
|
|
108
|
+
exports.TwilioMessageSender = TwilioMessageSender;
|
|
109
|
+
//# sourceMappingURL=TwilioMessageSender.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TwilioMessageSender.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/utils/TwilioMessageSender.ts"],"names":[],"mappings":";;;;;;;;;AAEA,uCAA6C;AAI7C,wDAAgF;AAEhF,uCAA6E;AAE7E,MAAM,MAAM,GAAG,IAAI,iBAAQ,EAAE,CAAA;AAM7B,MAAsB,mBAAwD,SAAQ,4BAGrF;IACC,uBAAuB;QACrB,OAAO,mCAAmC,CAAA;IAC5C,CAAC;IAED,wBAAwB;QACtB,OAAO,WAAW,CAAA;IACpB,CAAC;IAUD,KAAK,CAAC,YAAY,CAChB,OAAU,EACV,OAAgB;QAEhB,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,GAAG,CACrC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE;YAC/C,IAAI,GAAG,IAAI,IAAI,EAAE;gBACf,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;aAClB;YAED,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;gBACtB,GAAG,GAAG,MAAM,OAAO,CAAC,G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A;aACvE;YAED,oBAAoB,CAAC,IAAI,GAAG,mBAAmB,IAAI,0BAA0B,CAAA;YAC7E,OAAO,oBAAoB,CAAC,QAAQ,EAAE,CAAA;SACvC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAED,aAAa;QACX,KAAK,CAAC,aAAa,EAAE,CAAA;QACrB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE;YAC7B,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU;YACnC,eAAe,EAAE,IAAI,CAAC,QAAQ,CAAC,eAAe;SAC/C,CAAC,CAAA;IACJ,CAAC;CACF;AA/GC;IAHC,aAAK,CAAC;QACL,oBAAoB,EAAE,GAAG,EAAE,CAAC,IAAI,qCAAsB,CAAC,4CAA4C,CAAC;KACrG,CAAC;uDAqBD;AAKD;IAHC,aAAK,CAAC;QACL,oBAAoB,EAAE,GAAG,EAAE,CAAC,CAAC,kCAAkC,EAAE,oCAAoC,EAAE,GAAG,CAAC;KAC5G,CAAC;kEAmBD;AAGD;IADC,aAAK,EAAE;+DAoBP;AAKD;IAHC,aAAK,CAAC;QACL,oBAAoB,EAAE,GAAG,EAAE,CAAC,IAAI,qCAAsB,CAAC,+BAA+B,CAAC;KACxF,CAAC;kEAiCD;AA1HH,kDAmIC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./TwilioMessageSender"), exports);
|
|
14
|
+
__exportStar(require("./PhoneMessageSender"), exports);
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,wDAAqC;AACrC,uDAAoC"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type { RequestOptions } from '@segment/actions-core';
|
|
2
1
|
import { Payload } from '../sendSms/generated-types';
|
|
3
|
-
export declare type RequestFn = (url: string, options?: RequestOptions) => Promise<Response>;
|
|
4
2
|
export interface ContentTemplateResponse {
|
|
5
3
|
types: {
|
|
6
4
|
[type: string]: {
|
|
@@ -9,20 +7,6 @@ export interface ContentTemplateResponse {
|
|
|
9
7
|
};
|
|
10
8
|
};
|
|
11
9
|
}
|
|
12
|
-
export interface TwilioApiError extends Error {
|
|
13
|
-
response: {
|
|
14
|
-
data: {
|
|
15
|
-
code: number;
|
|
16
|
-
message: string;
|
|
17
|
-
more_info: string;
|
|
18
|
-
status: number;
|
|
19
|
-
};
|
|
20
|
-
headers?: Response['headers'];
|
|
21
|
-
};
|
|
22
|
-
code?: number;
|
|
23
|
-
status?: number;
|
|
24
|
-
statusCode?: number;
|
|
25
|
-
}
|
|
26
10
|
export interface ContentTemplateResponse {
|
|
27
11
|
types: {
|
|
28
12
|
[type: string]: {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/destinations/engage/twilio/utils/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IntegrationError } from '@segment/actions-core';
|
|
2
|
+
export declare class AggregateError extends IntegrationError {
|
|
3
|
+
errors: any[];
|
|
4
|
+
data?: any;
|
|
5
|
+
static create(args: {
|
|
6
|
+
errors: any[];
|
|
7
|
+
code?: string;
|
|
8
|
+
status?: number;
|
|
9
|
+
takeCodeAndStatusFromError?: any;
|
|
10
|
+
message?: (msg: string) => string;
|
|
11
|
+
}): AggregateError;
|
|
12
|
+
constructor(errors: any[], code?: string, status?: number, data?: any, message?: string);
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AggregateError = void 0;
|
|
4
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
5
|
+
const ResponseError_1 = require("./ResponseError");
|
|
6
|
+
class AggregateError extends actions_core_1.IntegrationError {
|
|
7
|
+
constructor(errors, code, status, data, message) {
|
|
8
|
+
super(message || 'Multiple errors', code, status);
|
|
9
|
+
this.errors = errors;
|
|
10
|
+
this.data = data;
|
|
11
|
+
}
|
|
12
|
+
static create(args) {
|
|
13
|
+
const firstErrorInfo = ResponseError_1.getErrorDetails(args.takeCodeAndStatusFromError ? args.takeCodeAndStatusFromError : args.errors[0]);
|
|
14
|
+
if (!args.code)
|
|
15
|
+
args.code = firstErrorInfo.code;
|
|
16
|
+
if (!args.status)
|
|
17
|
+
args.status = firstErrorInfo.status;
|
|
18
|
+
let message = `Multiple errors (${args.errors.length}): ${args.errors
|
|
19
|
+
.map((e) => ResponseError_1.getErrorDetails(e).message)
|
|
20
|
+
.join(', ')}`;
|
|
21
|
+
message = args.message?.(message) || message;
|
|
22
|
+
return new AggregateError(args.errors, args.code, args.status, undefined, message);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.AggregateError = AggregateError;
|
|
26
|
+
//# sourceMappingURL=AggregateError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AggregateError.js","sourceRoot":"","sources":["../../../../src/destinations/engage/utils/AggregateError.ts"],"names":[],"mappings":";;;AAAA,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destination-kit';
|
|
3
|
+
import { MaybePromise } from '@segment/actions-core/destination-kit/types';
|
|
4
|
+
import { EngageLogger } from './EngageLogger';
|
|
5
|
+
import { EngageStats } from './EngageStats';
|
|
6
|
+
import { OperationContext } from './track';
|
|
7
|
+
import { RequestOptions } from '@segment/actions-core/request-client';
|
|
8
|
+
import { IntegrationError } from '@segment/actions-core';
|
|
9
|
+
import { Awaited } from './operationTracking';
|
|
10
|
+
export declare abstract class EngageActionPerformer<TSettings = any, TPayload = any, TReturn = any> {
|
|
11
|
+
readonly requestClient: RequestClient;
|
|
12
|
+
readonly executeInput: ExecuteInput<TSettings, TPayload>;
|
|
13
|
+
readonly logger: EngageLogger;
|
|
14
|
+
readonly statsClient: EngageStats;
|
|
15
|
+
readonly currentOperation: OperationContext | undefined;
|
|
16
|
+
readonly payload: TPayload;
|
|
17
|
+
readonly settings: TSettings;
|
|
18
|
+
constructor(requestClient: RequestClient, executeInput: ExecuteInput<TSettings, TPayload>);
|
|
19
|
+
beforePerform?(): void | Promise<void>;
|
|
20
|
+
perform(): Promise<TReturn>;
|
|
21
|
+
abstract doPerform(): MaybePromise<TReturn>;
|
|
22
|
+
abstract getIntegrationStatsName(): string;
|
|
23
|
+
abstract getChannelType(): string;
|
|
24
|
+
request<Data = unknown>(url: string, options?: RequestOptions): Promise<import("@segment/actions-core/create-request-client").ModifiedResponse<Data>>;
|
|
25
|
+
onResponse?(args: {
|
|
26
|
+
response?: Awaited<ReturnType<RequestClient>>;
|
|
27
|
+
error?: any;
|
|
28
|
+
operation: OperationContext;
|
|
29
|
+
}): void;
|
|
30
|
+
redactPii(pii: string | undefined): string | undefined;
|
|
31
|
+
isFeatureActive(featureName: string, getDefault?: () => boolean): boolean | undefined;
|
|
32
|
+
logInfo(msg: string, metadata?: object): void;
|
|
33
|
+
logError(msg: string, metadata?: object): void;
|
|
34
|
+
logOnError(logMessage: string | ((ctx: OperationContext) => string)): void;
|
|
35
|
+
statsIncr(metric: string, value?: number, tags?: string[]): void;
|
|
36
|
+
statsHistogram(metric: string, value: number, tags?: string[]): void;
|
|
37
|
+
statsSet(metric: string, value: number, tags?: string[]): void;
|
|
38
|
+
get logDetails(): Record<string, unknown>;
|
|
39
|
+
get tags(): string[];
|
|
40
|
+
rethrowIntegrationError(error: unknown, getWrapper: () => IntegrationError | ConstructorParameters<typeof IntegrationError>): never;
|
|
41
|
+
}
|