@segment/action-destinations 3.326.0 → 3.326.1-extensible-destination-http.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/accoil-analytics/postToAccoil/generated-types.d.ts +5 -0
- package/dist/destinations/accoil-analytics/postToAccoil/generated-types.js +3 -0
- package/dist/destinations/accoil-analytics/postToAccoil/generated-types.js.map +1 -0
- package/dist/destinations/accoil-analytics/postToAccoil/index.d.ts +5 -0
- package/dist/destinations/accoil-analytics/postToAccoil/index.js +27 -0
- package/dist/destinations/accoil-analytics/postToAccoil/index.js.map +1 -0
- package/dist/destinations/amazon-ads/generated-types.d.ts +12 -0
- package/dist/destinations/amazon-ads/generated-types.js +3 -0
- package/dist/destinations/amazon-ads/generated-types.js.map +1 -0
- package/dist/destinations/amazon-ads/index.d.ts +4 -0
- package/dist/destinations/amazon-ads/index.js +237 -0
- package/dist/destinations/amazon-ads/index.js.map +1 -0
- package/dist/destinations/amazon-ads/syncAudiences/generated-types.d.ts +15 -0
- package/dist/destinations/amazon-ads/syncAudiences/generated-types.js +3 -0
- package/dist/destinations/amazon-ads/syncAudiences/generated-types.js.map +1 -0
- package/dist/destinations/amazon-ads/syncAudiences/index.d.ts +5 -0
- package/dist/destinations/amazon-ads/syncAudiences/index.js +182 -0
- package/dist/destinations/amazon-ads/syncAudiences/index.js.map +1 -0
- package/dist/destinations/amazon-ads/types.d.ts +47 -0
- package/dist/destinations/amazon-ads/types.js +11 -0
- package/dist/destinations/amazon-ads/types.js.map +1 -0
- package/dist/destinations/amazon-ads/utils.d.ts +37 -0
- package/dist/destinations/amazon-ads/utils.js +25 -0
- package/dist/destinations/amazon-ads/utils.js.map +1 -0
- package/dist/destinations/blackbaud-raisers-edge-nxt/utils/index.d.ts +1 -1
- package/dist/destinations/braze/createAliasV2.types.d.ts +5 -0
- package/dist/destinations/braze/createAliasV2.types.js +3 -0
- package/dist/destinations/braze/createAliasV2.types.js.map +1 -0
- package/dist/destinations/braze/identifyUserV2.types.d.ts +8 -0
- package/dist/destinations/braze/identifyUserV2.types.js +3 -0
- package/dist/destinations/braze/identifyUserV2.types.js.map +1 -0
- package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.d.ts +1 -0
- package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.js +184 -0
- package/dist/destinations/braze/updateUserProfile/__snapshots__/snapshot.test.js.map +1 -0
- package/dist/destinations/contentstack/constants.d.ts +3 -0
- package/dist/destinations/contentstack/constants.js +7 -0
- package/dist/destinations/contentstack/constants.js.map +1 -0
- package/dist/destinations/contentstack/customAttributesSync/generated-types.d.ts +7 -0
- package/dist/destinations/contentstack/customAttributesSync/generated-types.js +3 -0
- package/dist/destinations/contentstack/customAttributesSync/generated-types.js.map +1 -0
- package/dist/destinations/contentstack/customAttributesSync/index.d.ts +5 -0
- package/dist/destinations/contentstack/customAttributesSync/index.js +54 -0
- package/dist/destinations/contentstack/customAttributesSync/index.js.map +1 -0
- package/dist/destinations/contentstack/customAttributesSync/types.d.ts +14 -0
- package/dist/destinations/contentstack/customAttributesSync/types.js +3 -0
- package/dist/destinations/contentstack/customAttributesSync/types.js.map +1 -0
- package/dist/destinations/contentstack/customAttributesSync/utils.d.ts +4 -0
- package/dist/destinations/contentstack/customAttributesSync/utils.js +20 -0
- package/dist/destinations/contentstack/customAttributesSync/utils.js.map +1 -0
- package/dist/destinations/contentstack/types.d.ts +12 -0
- package/dist/destinations/contentstack/types.js +3 -0
- package/dist/destinations/contentstack/types.js.map +1 -0
- package/dist/destinations/dynamic-yield-audiences/syncAudience/types.d.ts +22 -0
- package/dist/destinations/dynamic-yield-audiences/syncAudience/types.js +3 -0
- package/dist/destinations/dynamic-yield-audiences/syncAudience/types.js.map +1 -0
- package/dist/destinations/dynamic-yield-audiences/types.d.ts +8 -0
- package/dist/destinations/dynamic-yield-audiences/types.js +12 -0
- package/dist/destinations/dynamic-yield-audiences/types.js.map +1 -0
- package/dist/destinations/engage/sendgrid/Profile.d.ts +6 -0
- package/dist/destinations/engage/sendgrid/Profile.js +3 -0
- 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/sendgrid/previewApiLookup/actionDefinition.d.ts +4 -0
- package/dist/destinations/engage/sendgrid/previewApiLookup/actionDefinition.js +28 -0
- package/dist/destinations/engage/sendgrid/previewApiLookup/actionDefinition.js.map +1 -0
- package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.d.ts +21 -0
- package/dist/destinations/engage/sendgrid/previewApiLookup/api-lookups.js +174 -0
- 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 +1 -0
- package/dist/destinations/engage/sendgrid/previewApiLookup/index.js +14 -0
- package/dist/destinations/engage/sendgrid/previewApiLookup/index.js.map +1 -0
- package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.d.ts +44 -0
- package/dist/destinations/engage/sendgrid/sendEmail/SendEmailPerformer.js +419 -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 +257 -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 +28 -0
- package/dist/destinations/engage/twilio/sendMobilePush/PushSender.js +151 -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/twilio/sendMobilePush/actionDefinition.js +250 -0
- 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/twilio/sendSms/SmsMessageSender.js +72 -0
- 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/twilio/sendSms/actionDefinition.js +162 -0
- 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 +9 -0
- package/dist/destinations/engage/twilio/sendWhatsApp/WhatsAppMessageSender.js +89 -0
- 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/twilio/sendWhatsApp/actionDefinition.js +136 -0
- 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 +71 -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 +115 -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/twilio/utils/types.d.ts +23 -0
- package/dist/destinations/engage/twilio/utils/types.js +3 -0
- 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 +42 -0
- package/dist/destinations/engage/utils/EngageActionPerformer.js +148 -0
- package/dist/destinations/engage/utils/EngageActionPerformer.js.map +1 -0
- package/dist/destinations/engage/utils/EngageLogger.d.ts +18 -0
- 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/utils/EngageStats.js +95 -0
- package/dist/destinations/engage/utils/EngageStats.js.map +1 -0
- package/dist/destinations/engage/utils/IntegrationErrorWrapper.d.ts +12 -0
- package/dist/destinations/engage/utils/IntegrationErrorWrapper.js +31 -0
- package/dist/destinations/engage/utils/IntegrationErrorWrapper.js.map +1 -0
- package/dist/destinations/engage/utils/MessageSendPerformer.d.ts +65 -0
- package/dist/destinations/engage/utils/MessageSendPerformer.js +211 -0
- package/dist/destinations/engage/utils/MessageSendPerformer.js.map +1 -0
- package/dist/destinations/engage/utils/Profile.d.ts +6 -0
- package/dist/destinations/engage/utils/Profile.js +3 -0
- package/dist/destinations/engage/utils/Profile.js.map +1 -0
- package/dist/destinations/engage/utils/ResponseError.d.ts +25 -0
- package/dist/destinations/engage/utils/ResponseError.js +22 -0
- package/dist/destinations/engage/utils/ResponseError.js.map +1 -0
- package/dist/destinations/engage/utils/apiLookups.d.ts +22 -0
- package/dist/destinations/engage/utils/apiLookups.js +189 -0
- package/dist/destinations/engage/utils/apiLookups.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.d.ts +1 -0
- package/dist/destinations/engage/utils/isDestinationActionService.js +8 -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.d.ts +1 -0
- package/dist/destinations/engage/utils/operationTracking/GenericMethodDecorator.js +3 -0
- package/dist/destinations/engage/utils/operationTracking/GenericMethodDecorator.js.map +1 -0
- package/dist/destinations/engage/utils/operationTracking/OperationDecorator.d.ts +46 -0
- package/dist/destinations/engage/utils/operationTracking/OperationDecorator.js +46 -0
- package/dist/destinations/engage/utils/operationTracking/OperationDecorator.js.map +1 -0
- package/dist/destinations/engage/utils/operationTracking/OperationDuration.d.ts +12 -0
- package/dist/destinations/engage/utils/operationTracking/OperationDuration.js +23 -0
- package/dist/destinations/engage/utils/operationTracking/OperationDuration.js.map +1 -0
- package/dist/destinations/engage/utils/operationTracking/OperationErrorHandler.d.ts +12 -0
- package/dist/destinations/engage/utils/operationTracking/OperationErrorHandler.js +35 -0
- package/dist/destinations/engage/utils/operationTracking/OperationErrorHandler.js.map +1 -0
- package/dist/destinations/engage/utils/operationTracking/OperationFinallyHooks.d.ts +14 -0
- package/dist/destinations/engage/utils/operationTracking/OperationFinallyHooks.js +31 -0
- package/dist/destinations/engage/utils/operationTracking/OperationFinallyHooks.js.map +1 -0
- package/dist/destinations/engage/utils/operationTracking/OperationLogger.d.ts +31 -0
- package/dist/destinations/engage/utils/operationTracking/OperationLogger.js +104 -0
- package/dist/destinations/engage/utils/operationTracking/OperationLogger.js.map +1 -0
- package/dist/destinations/engage/utils/operationTracking/OperationStats.d.ts +39 -0
- package/dist/destinations/engage/utils/operationTracking/OperationStats.js +130 -0
- package/dist/destinations/engage/utils/operationTracking/OperationStats.js.map +1 -0
- package/dist/destinations/engage/utils/operationTracking/OperationTracker.test.d.ts +1 -0
- package/dist/destinations/engage/utils/operationTracking/OperationTracker.test.js +377 -0
- package/dist/destinations/engage/utils/operationTracking/OperationTracker.test.js.map +1 -0
- package/dist/destinations/engage/utils/operationTracking/OperationTree.d.ts +23 -0
- package/dist/destinations/engage/utils/operationTracking/OperationTree.js +49 -0
- package/dist/destinations/engage/utils/operationTracking/OperationTree.js.map +1 -0
- package/dist/destinations/engage/utils/operationTracking/TrackedError.d.ts +6 -0
- package/dist/destinations/engage/utils/operationTracking/TrackedError.js +3 -0
- package/dist/destinations/engage/utils/operationTracking/TrackedError.js.map +1 -0
- package/dist/destinations/engage/utils/operationTracking/index.d.ts +10 -0
- package/dist/destinations/engage/utils/operationTracking/index.js +23 -0
- package/dist/destinations/engage/utils/operationTracking/index.js.map +1 -0
- package/dist/destinations/engage/utils/operationTracking/wrapTryCatchFinallyPromisable.d.ts +21 -0
- package/dist/destinations/engage/utils/operationTracking/wrapTryCatchFinallyPromisable.js +99 -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/previewApiLookup.types.d.ts +16 -0
- 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.d.ts +56 -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/sendMobilePush.types.d.ts +39 -0
- 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.d.ts +27 -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.d.ts +25 -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/facebook-custom-audiences/add/generated-types.d.ts +2 -0
- package/dist/destinations/facebook-custom-audiences/add/generated-types.js +3 -0
- package/dist/destinations/facebook-custom-audiences/add/generated-types.js.map +1 -0
- package/dist/destinations/facebook-custom-audiences/add/index.d.ts +5 -0
- package/dist/destinations/facebook-custom-audiences/add/index.js +11 -0
- package/dist/destinations/facebook-custom-audiences/add/index.js.map +1 -0
- package/dist/destinations/facebook-custom-audiences/remove/generated-types.d.ts +2 -0
- package/dist/destinations/facebook-custom-audiences/remove/generated-types.js +3 -0
- package/dist/destinations/facebook-custom-audiences/remove/generated-types.js.map +1 -0
- package/dist/destinations/facebook-custom-audiences/remove/index.d.ts +5 -0
- package/dist/destinations/facebook-custom-audiences/remove/index.js +11 -0
- package/dist/destinations/facebook-custom-audiences/remove/index.js.map +1 -0
- package/dist/destinations/first-party-dv360/_tests_/index.test.d.ts +1 -0
- package/dist/destinations/first-party-dv360/_tests_/index.test.js +48 -0
- package/dist/destinations/first-party-dv360/_tests_/index.test.js.map +1 -0
- package/dist/destinations/hubspot/customEvent/hubspot-api.d.ts +62 -0
- package/dist/destinations/hubspot/customEvent/hubspot-api.js +305 -0
- package/dist/destinations/hubspot/customEvent/hubspot-api.js.map +1 -0
- package/dist/destinations/hubspot/upsertObject/hubspot-api.d.ts +219 -0
- package/dist/destinations/hubspot/upsertObject/hubspot-api.js +609 -0
- package/dist/destinations/hubspot/upsertObject/hubspot-api.js.map +1 -0
- package/dist/destinations/klaviyo/orderCompleted/formatters.d.ts +26 -0
- package/dist/destinations/klaviyo/orderCompleted/formatters.js +62 -0
- package/dist/destinations/klaviyo/orderCompleted/formatters.js.map +1 -0
- package/dist/destinations/klaviyo/orderCompleted/types.d.ts +2 -0
- package/dist/destinations/klaviyo/orderCompleted/types.js +3 -0
- package/dist/destinations/klaviyo/orderCompleted/types.js.map +1 -0
- package/dist/destinations/klaviyo/removeProfileToList/generated-types.d.ts +4 -0
- package/dist/destinations/klaviyo/removeProfileToList/generated-types.js +3 -0
- package/dist/destinations/klaviyo/removeProfileToList/generated-types.js.map +1 -0
- package/dist/destinations/klaviyo/removeProfileToList/index.d.ts +5 -0
- package/dist/destinations/klaviyo/removeProfileToList/index.js +43 -0
- package/dist/destinations/klaviyo/removeProfileToList/index.js.map +1 -0
- package/dist/destinations/mappings-two-test/generated-types.d.ts +3 -0
- package/dist/destinations/mappings-two-test/generated-types.js +3 -0
- package/dist/destinations/mappings-two-test/generated-types.js.map +1 -0
- package/dist/destinations/mappings-two-test/index.d.ts +4 -0
- package/dist/destinations/mappings-two-test/index.js +32 -0
- package/dist/destinations/mappings-two-test/index.js.map +1 -0
- package/dist/destinations/mappings-two-test/kitchenSink/generated-types.d.ts +53 -0
- package/dist/destinations/mappings-two-test/kitchenSink/generated-types.js +3 -0
- package/dist/destinations/mappings-two-test/kitchenSink/generated-types.js.map +1 -0
- package/dist/destinations/mappings-two-test/kitchenSink/index.d.ts +5 -0
- package/dist/destinations/mappings-two-test/kitchenSink/index.js +289 -0
- package/dist/destinations/mappings-two-test/kitchenSink/index.js.map +1 -0
- package/dist/destinations/mappings-two-test/sendEvent/generated-types.d.ts +17 -0
- package/dist/destinations/mappings-two-test/sendEvent/generated-types.js +3 -0
- package/dist/destinations/mappings-two-test/sendEvent/generated-types.js.map +1 -0
- package/dist/destinations/mappings-two-test/sendEvent/index.d.ts +5 -0
- package/dist/destinations/mappings-two-test/sendEvent/index.js +343 -0
- package/dist/destinations/mappings-two-test/sendEvent/index.js.map +1 -0
- package/dist/destinations/mixpanel/utils.d.ts +13 -0
- package/dist/destinations/mixpanel/utils.js +117 -0
- package/dist/destinations/mixpanel/utils.js.map +1 -0
- package/dist/destinations/movable-ink/categoryView/generated-types.d.ts +22 -0
- package/dist/destinations/movable-ink/categoryView/generated-types.js +3 -0
- package/dist/destinations/movable-ink/categoryView/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/categoryView/index.d.ts +5 -0
- package/dist/destinations/movable-ink/categoryView/index.js +43 -0
- package/dist/destinations/movable-ink/categoryView/index.js.map +1 -0
- package/dist/destinations/movable-ink/conversion/generated-types.d.ts +20 -0
- package/dist/destinations/movable-ink/conversion/generated-types.js +3 -0
- package/dist/destinations/movable-ink/conversion/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/conversion/index.d.ts +5 -0
- package/dist/destinations/movable-ink/conversion/index.js +45 -0
- package/dist/destinations/movable-ink/conversion/index.js.map +1 -0
- package/dist/destinations/movable-ink/fields.d.ts +21 -0
- package/dist/destinations/movable-ink/fields.js +236 -0
- package/dist/destinations/movable-ink/fields.js.map +1 -0
- package/dist/destinations/movable-ink/identify/generated-types.d.ts +7 -0
- package/dist/destinations/movable-ink/identify/generated-types.js +3 -0
- package/dist/destinations/movable-ink/identify/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/identify/index.d.ts +5 -0
- package/dist/destinations/movable-ink/identify/index.js +32 -0
- package/dist/destinations/movable-ink/identify/index.js.map +1 -0
- package/dist/destinations/movable-ink/productAdded/generated-types.d.ts +22 -0
- package/dist/destinations/movable-ink/productAdded/generated-types.js +3 -0
- package/dist/destinations/movable-ink/productAdded/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/productAdded/index.d.ts +5 -0
- package/dist/destinations/movable-ink/productAdded/index.js +43 -0
- package/dist/destinations/movable-ink/productAdded/index.js.map +1 -0
- package/dist/destinations/movable-ink/productViewed/generated-types.d.ts +21 -0
- package/dist/destinations/movable-ink/productViewed/generated-types.js +3 -0
- package/dist/destinations/movable-ink/productViewed/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/productViewed/index.d.ts +5 -0
- package/dist/destinations/movable-ink/productViewed/index.js +43 -0
- package/dist/destinations/movable-ink/productViewed/index.js.map +1 -0
- package/dist/destinations/movable-ink/search/generated-types.d.ts +12 -0
- package/dist/destinations/movable-ink/search/generated-types.js +3 -0
- package/dist/destinations/movable-ink/search/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/search/index.d.ts +5 -0
- package/dist/destinations/movable-ink/search/index.js +43 -0
- package/dist/destinations/movable-ink/search/index.js.map +1 -0
- package/dist/destinations/movable-ink/sendCustomEvent/generated-types.d.ts +25 -0
- package/dist/destinations/movable-ink/sendCustomEvent/generated-types.js +3 -0
- package/dist/destinations/movable-ink/sendCustomEvent/generated-types.js.map +1 -0
- package/dist/destinations/movable-ink/sendCustomEvent/index.d.ts +5 -0
- package/dist/destinations/movable-ink/sendCustomEvent/index.js +48 -0
- package/dist/destinations/movable-ink/sendCustomEvent/index.js.map +1 -0
- package/dist/destinations/responsys/asyncMergePetRecords/generated-types.d.ts +14 -0
- package/dist/destinations/responsys/asyncMergePetRecords/generated-types.js +3 -0
- package/dist/destinations/responsys/asyncMergePetRecords/generated-types.js.map +1 -0
- package/dist/destinations/responsys/asyncMergePetRecords/index.d.ts +5 -0
- package/dist/destinations/responsys/asyncMergePetRecords/index.js +113 -0
- package/dist/destinations/responsys/asyncMergePetRecords/index.js.map +1 -0
- package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.d.ts +20 -0
- package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.js +3 -0
- package/dist/destinations/responsys/asyncMergeProfileListMembers/generated-types.js.map +1 -0
- package/dist/destinations/responsys/asyncMergeProfileListMembers/index.d.ts +5 -0
- package/dist/destinations/responsys/asyncMergeProfileListMembers/index.js +174 -0
- package/dist/destinations/responsys/asyncMergeProfileListMembers/index.js.map +1 -0
- package/dist/destinations/responsys/rsp-operations.d.ts +14 -0
- package/dist/destinations/responsys/rsp-operations.js +33 -0
- package/dist/destinations/responsys/rsp-operations.js.map +1 -0
- package/dist/destinations/responsys/rsp-properties.d.ts +4 -0
- package/dist/destinations/responsys/rsp-properties.js +27 -0
- package/dist/destinations/responsys/rsp-properties.js.map +1 -0
- package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.d.ts +1 -0
- package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.js +381 -0
- package/dist/destinations/snap-conversions-api/_tests_/capiV2tests.js.map +1 -0
- package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.d.ts +1 -0
- package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.js +581 -0
- package/dist/destinations/snap-conversions-api/_tests_/capiV3tests.js.map +1 -0
- package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.d.ts +4 -0
- package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.js +97 -0
- package/dist/destinations/snap-conversions-api/reportConversionEvent/snap-capi-v2.js.map +1 -0
- package/dist/destinations/snap-conversions-api/snap-capi-properties.d.ts +30 -0
- package/dist/destinations/snap-conversions-api/snap-capi-properties.js +316 -0
- package/dist/destinations/snap-conversions-api/snap-capi-properties.js.map +1 -0
- package/dist/destinations/tiktok-conversions/reportWebEvent/formatter.d.ts +3 -0
- package/dist/destinations/tiktok-conversions/reportWebEvent/formatter.js +34 -0
- package/dist/destinations/tiktok-conversions/reportWebEvent/formatter.js.map +1 -0
- package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.d.ts +3 -0
- package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.js +43 -0
- package/dist/destinations/tiktok-offline-conversions/reportOfflineEvent/formatter.js.map +1 -0
- package/dist/destinations/trackey/group.types.d.ts +11 -0
- package/dist/destinations/trackey/group.types.js +3 -0
- package/dist/destinations/trackey/group.types.js.map +1 -0
- package/dist/destinations/trackey/identify.types.d.ts +11 -0
- package/dist/destinations/trackey/identify.types.js +3 -0
- package/dist/destinations/trackey/identify.types.js.map +1 -0
- package/dist/destinations/trackey/track.types.d.ts +12 -0
- package/dist/destinations/trackey/track.types.js +3 -0
- package/dist/destinations/trackey/track.types.js.map +1 -0
- package/dist/destinations/webhook-extensible/__test__/webhook.test.js +0 -67
- package/dist/destinations/webhook-extensible/__test__/webhook.test.js.map +1 -1
- package/dist/destinations/webhook-extensible/index.d.ts +4 -1
- package/dist/destinations/webhook-extensible/index.js +20 -9
- package/dist/destinations/webhook-extensible/index.js.map +1 -1
- package/dist/destinations/webhook-extensible/send/index.js +31 -3
- package/dist/destinations/webhook-extensible/send/index.js.map +1 -1
- package/dist/destinations/webhook-extensible/types.d.ts +6 -0
- package/dist/destinations/webhook-extensible/types.js +3 -0
- package/dist/destinations/webhook-extensible/types.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/accoil-analytics/postToAccoil/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const action = {
|
|
4
|
+
title: 'Post to Accoil',
|
|
5
|
+
description: 'Send Data to Accoil Analytics',
|
|
6
|
+
defaultSubscription: 'type = "track"',
|
|
7
|
+
fields: {
|
|
8
|
+
segmentEventData: {
|
|
9
|
+
label: 'Event Payload',
|
|
10
|
+
description: 'Segment Event Payload',
|
|
11
|
+
type: 'object',
|
|
12
|
+
unsafe_hidden: true,
|
|
13
|
+
required: true,
|
|
14
|
+
default: {
|
|
15
|
+
'@path': '$.'
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
perform: (request, { payload }) => {
|
|
20
|
+
return request(`https://in.accoil.com/segment`, {
|
|
21
|
+
method: 'post',
|
|
22
|
+
json: payload.segmentEventData
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
exports.default = action;
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/accoil-analytics/postToAccoil/index.ts"],"names":[],"mappings":";;AAIA,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,gBAAgB;IACvB,WAAW,EAAE,+BAA+B;IAC5C,mBAAmB,EAAE,gBAAgB;IAErC,MAAM,EAAE;QACN,gBAAgB,EAAE;YAChB,KAAK,EAAE,eAAe;YACtB,WAAW,EAAE,uBAAuB;YACpC,IAAI,EAAE,QAAQ;YACd,aAAa,EAAE,IAAI;YACnB,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,IAAI;aACd;SACF;KACF;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,OAAO,OAAO,CAAC,+BAA+B,EAAE;YAC9C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,OAAO,CAAC,gBAAgB;SAC/B,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/destinations/amazon-ads/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
7
|
+
const utils_1 = require("./utils");
|
|
8
|
+
const syncAudiences_1 = __importDefault(require("./syncAudiences"));
|
|
9
|
+
const destination = {
|
|
10
|
+
name: 'Amazon Ads',
|
|
11
|
+
slug: 'actions-amazon-ads',
|
|
12
|
+
mode: 'cloud',
|
|
13
|
+
authentication: {
|
|
14
|
+
scheme: 'oauth2',
|
|
15
|
+
fields: {
|
|
16
|
+
region: {
|
|
17
|
+
label: 'Region',
|
|
18
|
+
description: 'Region for API Endpoint, either NA, EU, FE.',
|
|
19
|
+
choices: [
|
|
20
|
+
{ label: 'North America (NA)', value: 'https://advertising-api.amazon.com' },
|
|
21
|
+
{ label: 'Europe (EU)', value: 'https://advertising-api-eu.amazon.com' },
|
|
22
|
+
{ label: 'Far East (FE)', value: 'https://advertising-api-fe.amazon.com' }
|
|
23
|
+
],
|
|
24
|
+
default: 'https://advertising-api.amazon.com',
|
|
25
|
+
type: 'string',
|
|
26
|
+
required: true
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
testAuthentication: async (request, { auth, settings }) => {
|
|
30
|
+
if (!auth?.accessToken) {
|
|
31
|
+
throw new actions_core_1.InvalidAuthenticationError('Please authenticate via Oauth before enabling the destination.');
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
await request(`${settings.region}/v2/profiles`, {
|
|
35
|
+
method: 'GET'
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
const error = e;
|
|
40
|
+
if (error.message === 'Unauthorized') {
|
|
41
|
+
throw new actions_core_1.InvalidAuthenticationError('Invalid Amazon Oauth access token. Please reauthenticate to retrieve a valid access token before enabling the destination.');
|
|
42
|
+
}
|
|
43
|
+
throw e;
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
refreshAccessToken: async (request, { auth, settings }) => {
|
|
47
|
+
const endpoint = utils_1.AUTHORIZATION_URL[`${settings.region}`];
|
|
48
|
+
let res;
|
|
49
|
+
console.log(settings.region, auth, endpoint);
|
|
50
|
+
try {
|
|
51
|
+
res = await request('https://api.amazon.com/auth/o2/token', {
|
|
52
|
+
method: 'POST',
|
|
53
|
+
body: new URLSearchParams({
|
|
54
|
+
refresh_token: auth.refreshToken,
|
|
55
|
+
client_id: auth.clientId,
|
|
56
|
+
client_secret: auth.clientSecret,
|
|
57
|
+
grant_type: 'refresh_token'
|
|
58
|
+
}),
|
|
59
|
+
headers: {
|
|
60
|
+
authorization: ''
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
return { accessToken: res.data.access_token };
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
console.log(e);
|
|
67
|
+
const error = e;
|
|
68
|
+
if (error.response?.data?.error === 'invalid_grant') {
|
|
69
|
+
throw new actions_core_1.InvalidAuthenticationError(`Invalid Authentication: Your refresh token is invalid or expired. Please re-authenticate to fetch a new refresh token.`, actions_core_1.ErrorCodes.REFRESH_TOKEN_EXPIRED);
|
|
70
|
+
}
|
|
71
|
+
throw new actions_core_1.InvalidAuthenticationError(`Failed to fetch a new access token. Reason: ${error.response?.data?.error}`, actions_core_1.ErrorCodes.OAUTH_REFRESH_FAILED);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
extendRequest({ auth }) {
|
|
76
|
+
return {
|
|
77
|
+
headers: {
|
|
78
|
+
authorization: `Bearer ${auth?.accessToken}`,
|
|
79
|
+
'Amazon-Advertising-API-ClientID': process.env.ACTIONS_AMAZON_ADS_CLIENT_ID || ''
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
audienceFields: {
|
|
84
|
+
description: {
|
|
85
|
+
type: 'string',
|
|
86
|
+
label: 'Description',
|
|
87
|
+
required: true,
|
|
88
|
+
description: 'The audience description. Must be an alphanumeric, non-null string between 0 to 1000 characters in length.'
|
|
89
|
+
},
|
|
90
|
+
countryCode: {
|
|
91
|
+
type: 'string',
|
|
92
|
+
label: 'Country Code',
|
|
93
|
+
required: true,
|
|
94
|
+
description: 'A String value representing ISO 3166-1 alpha-2 country code for the members in this audience.'
|
|
95
|
+
},
|
|
96
|
+
externalAudienceId: {
|
|
97
|
+
type: 'string',
|
|
98
|
+
label: 'External Audience Id',
|
|
99
|
+
required: true,
|
|
100
|
+
description: 'The user-defined audience identifier.'
|
|
101
|
+
},
|
|
102
|
+
cpmCents: {
|
|
103
|
+
label: 'CPM Cents',
|
|
104
|
+
type: 'number',
|
|
105
|
+
description: `Cost per thousand impressions (CPM) in cents. For example, $1.00 = 100 cents.`
|
|
106
|
+
},
|
|
107
|
+
currency: {
|
|
108
|
+
label: 'Currency',
|
|
109
|
+
type: 'string',
|
|
110
|
+
description: `The price paid. Base units depend on the currency. As an example, USD should be reported as Dollars.Cents, whereas JPY should be reported as a whole number of Yen. All provided values will be rounded to two digits with toFixed(2).Refer [Aamzon Ads Documentation](https://advertising.amazon.com/API/docs/en-us/amc-advertiser-audience#tag/Audience-Metadata/operation/CreateAudienceMetadataV2) to view supported Currency`
|
|
111
|
+
},
|
|
112
|
+
ttl: {
|
|
113
|
+
type: 'number',
|
|
114
|
+
label: 'Time-to-live',
|
|
115
|
+
required: false,
|
|
116
|
+
description: 'Time-to-live in seconds. The amount of time the record is associated with the audience.'
|
|
117
|
+
},
|
|
118
|
+
advertiserId: {
|
|
119
|
+
label: 'Advertiser ID',
|
|
120
|
+
description: 'Advertiser Id',
|
|
121
|
+
type: 'string',
|
|
122
|
+
required: true
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
audienceConfig: {
|
|
126
|
+
mode: {
|
|
127
|
+
type: 'synced',
|
|
128
|
+
full_audience_sync: false
|
|
129
|
+
},
|
|
130
|
+
async createAudience(request, createAudienceInput) {
|
|
131
|
+
const { audienceName, statsContext, audienceSettings } = createAudienceInput;
|
|
132
|
+
const { statsClient, tags: statsTags } = statsContext || {};
|
|
133
|
+
const endpoint = createAudienceInput.settings.region;
|
|
134
|
+
const description = audienceSettings?.description;
|
|
135
|
+
const advertiser_id = audienceSettings?.advertiserId;
|
|
136
|
+
const external_audience_id = audienceSettings?.externalAudienceId;
|
|
137
|
+
const country_code = audienceSettings?.countryCode;
|
|
138
|
+
const ttl = audienceSettings?.ttl;
|
|
139
|
+
const currency = audienceSettings?.currency;
|
|
140
|
+
const cpm_cents = audienceSettings?.cpmCents;
|
|
141
|
+
const statsName = 'createAmazonAudience';
|
|
142
|
+
statsTags?.push(`slug:${destination.slug}`);
|
|
143
|
+
statsTags?.push(`ttl_type:${typeof ttl}_${ttl}`);
|
|
144
|
+
statsTags?.push(`cpmcents_type:${typeof cpm_cents}_${cpm_cents}`);
|
|
145
|
+
statsClient?.incr(`${statsName}.intialise`, 1, statsTags);
|
|
146
|
+
console.log(ttl, cpm_cents);
|
|
147
|
+
if (!advertiser_id) {
|
|
148
|
+
throw new actions_core_1.IntegrationError('Missing advertiserId Value', 'MISSING_REQUIRED_FIELD', 400);
|
|
149
|
+
}
|
|
150
|
+
if (!description) {
|
|
151
|
+
throw new actions_core_1.IntegrationError('Missing description Value', 'MISSING_REQUIRED_FIELD', 400);
|
|
152
|
+
}
|
|
153
|
+
if (!external_audience_id) {
|
|
154
|
+
throw new actions_core_1.IntegrationError('Missing externalAudienceId Value', 'MISSING_REQUIRED_FIELD', 400);
|
|
155
|
+
}
|
|
156
|
+
if (!audienceName) {
|
|
157
|
+
throw new actions_core_1.IntegrationError('Missing audienceName Value', 'MISSING_REQUIRED_FIELD', 400);
|
|
158
|
+
}
|
|
159
|
+
if (!country_code) {
|
|
160
|
+
throw new actions_core_1.IntegrationError('Missing countryCode Value', 'MISSING_REQUIRED_FIELD', 400);
|
|
161
|
+
}
|
|
162
|
+
const payload = {
|
|
163
|
+
name: audienceName,
|
|
164
|
+
description: description,
|
|
165
|
+
targetResource: {
|
|
166
|
+
advertiserId: advertiser_id
|
|
167
|
+
},
|
|
168
|
+
metadata: {
|
|
169
|
+
externalAudienceId: external_audience_id
|
|
170
|
+
},
|
|
171
|
+
countryCode: country_code
|
|
172
|
+
};
|
|
173
|
+
if (ttl) {
|
|
174
|
+
const timeToLive = Number(ttl);
|
|
175
|
+
if (!timeToLive) {
|
|
176
|
+
throw new actions_core_1.IntegrationError('TTL:-String can not be converted to Number', 'INVALID_TTL_VALUE', 400);
|
|
177
|
+
}
|
|
178
|
+
payload.metadata.ttl = timeToLive;
|
|
179
|
+
}
|
|
180
|
+
if (cpm_cents && currency) {
|
|
181
|
+
if (!utils_1.CURRENCY.includes(currency)) {
|
|
182
|
+
throw new actions_core_1.IntegrationError('Invalid Currency Value', 'INVALID_CURRENCY_VALUE', 400);
|
|
183
|
+
}
|
|
184
|
+
const cpmCents = Number(cpm_cents);
|
|
185
|
+
if (!cpmCents) {
|
|
186
|
+
throw new actions_core_1.IntegrationError('CPM_CENTS:-String can not be converted to Number', 'INVALID_CPMCENTS_VALUE', 400);
|
|
187
|
+
}
|
|
188
|
+
payload.metadata.audienceFees = [];
|
|
189
|
+
payload.metadata?.audienceFees.push({
|
|
190
|
+
currency,
|
|
191
|
+
cpmCents: cpmCents
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
statsTags?.push(`slug:${destination.slug}`);
|
|
195
|
+
statsClient?.incr(`${statsName}.call`, 1, statsTags);
|
|
196
|
+
let payloadString = JSON.stringify(payload);
|
|
197
|
+
payloadString = payloadString.replace(utils_1.REGEX_ADVERTISERID, '"advertiserId":$1');
|
|
198
|
+
const response = await request(`${endpoint}/amc/audiences/metadata`, {
|
|
199
|
+
method: 'POST',
|
|
200
|
+
body: payloadString,
|
|
201
|
+
headers: {
|
|
202
|
+
'Content-Type': 'application/vnd.amcaudiences.v1+json'
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
const res = await response.text();
|
|
206
|
+
const resp = utils_1.extractNumberAndSubstituteWithStringValue(res, utils_1.REGEX_AUDIENCEID, '"audienceId":"$1"');
|
|
207
|
+
return {
|
|
208
|
+
externalId: resp.audienceId
|
|
209
|
+
};
|
|
210
|
+
},
|
|
211
|
+
async getAudience(request, getAudienceInput) {
|
|
212
|
+
const { statsContext } = getAudienceInput;
|
|
213
|
+
const audience_id = getAudienceInput.externalId;
|
|
214
|
+
const endpoint = getAudienceInput.settings.region;
|
|
215
|
+
const { statsClient, tags: statsTags } = statsContext || {};
|
|
216
|
+
const statsName = 'getAudience';
|
|
217
|
+
statsTags?.push(`slug:${destination.slug}`);
|
|
218
|
+
statsClient?.incr(`${statsName}.call`, 1, statsTags);
|
|
219
|
+
if (!audience_id) {
|
|
220
|
+
throw new actions_core_1.IntegrationError('Missing audienceId value', 'MISSING_REQUIRED_FIELD', 400);
|
|
221
|
+
}
|
|
222
|
+
const response = await request(`${endpoint}/amc/audiences/metadata/${audience_id}`, {
|
|
223
|
+
method: 'GET'
|
|
224
|
+
});
|
|
225
|
+
const res = await response.text();
|
|
226
|
+
const resp = utils_1.extractNumberAndSubstituteWithStringValue(res, utils_1.REGEX_AUDIENCEID, '"audienceId":"$1"');
|
|
227
|
+
return {
|
|
228
|
+
externalId: resp.audienceId
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
actions: {
|
|
233
|
+
syncAudiences: syncAudiences_1.default
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
exports.default = destination;
|
|
237
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/amazon-ads/index.ts"],"names":[],"mappings":";;;;;AACA,wDAAgG;AAGhG,mCAOgB;AAEhB,oEAA2C;AAE3C,MAAM,WAAW,GAA8D;IAC7E,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAE;YACN,MAAM,EAAE;gBACN,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,6CAA6C;gBAC1D,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,oCAAoC,EAAE;oBAC5E,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,uCAAuC,EAAE;oBACxE,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,uCAAuC,EAAE;iBAC3E;gBACD,OAAO,EAAE,oCAAoC;gBAC7C,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;SACF;QACD,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE;YACx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CAAA;YACzC,MAAM,WAAW,GAAG,gBAAgB,CAAC,UAAU,CAAA;YAC/C,MAAM,QAAQ,GAAG,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAAA;YACjD,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,YAAY,IAAI,EAAE,CAAA;YAE3D,MAAM,SAAS,GAAG,aAAa,CAAA;YAC/B,SAAS,EAAE,IAAI,CAAC,QAAQ,WAAW,CAAC,IAAI,EAAE,CAAC,CAAA;YAC3C,WAAW,EAAE,IAAI,CAAC,GAAG,SAAS,OAAO,EAAE,CAAC,EAAE,SAAS,CAAC,CAAA;YAEpD,IAAI,CAAC,WAAW,EAAE;gBAChB,MAAM,IAAI,+BAAgB,CAAC,0BAA0B,EAAE,wBAAwB,EAAE,GAAG,CAAC,CAAA;aACtF;YACD,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,QAAQ,2BAA2B,WAAW,EAAE,EAAE;gBAClF,MAAM,EAAE,KAAK;aACd,CAAC,CAAA;YACF,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAA;YAEjC,MAAM,IAAI,GAAG,iDAAyC,CAAC,GAAG,EAAE,wBAAgB,EAAE,mBAAmB,CAAC,CAAA;YAClG,OAAO;gBACL,UAAU,EAAE,IAAI,CAAC,UAAU;aAC5B,CAAA;QACH,CAAC;KACF;IACD,OAAO,EAAE;QACP,aAAa,EAAb,uBAAa;KACd;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface Payload {
|
|
2
|
+
event_name?: string;
|
|
3
|
+
externalUserId: string;
|
|
4
|
+
email?: string;
|
|
5
|
+
firstName?: string;
|
|
6
|
+
lastName?: string;
|
|
7
|
+
phone?: string;
|
|
8
|
+
postal?: string;
|
|
9
|
+
state?: string;
|
|
10
|
+
city?: string;
|
|
11
|
+
address?: string;
|
|
12
|
+
audienceId: string;
|
|
13
|
+
enable_batching: boolean;
|
|
14
|
+
batch_size?: number;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/amazon-ads/syncAudiences/generated-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("../utils");
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
5
|
+
const action = {
|
|
6
|
+
title: 'Sync Audience',
|
|
7
|
+
description: 'Sync audiences from Segment to Amazon Ads Audience.',
|
|
8
|
+
defaultSubscription: 'event = "Audience Entered" or event = "Audience Exited"',
|
|
9
|
+
fields: {
|
|
10
|
+
event_name: {
|
|
11
|
+
label: 'Event Name',
|
|
12
|
+
description: 'The name of the current Segment event.',
|
|
13
|
+
type: 'string',
|
|
14
|
+
unsafe_hidden: true,
|
|
15
|
+
default: {
|
|
16
|
+
'@path': '$.event'
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
externalUserId: {
|
|
20
|
+
label: 'External User ID',
|
|
21
|
+
description: 'This is an external user identifier defined by data providers.',
|
|
22
|
+
type: 'string',
|
|
23
|
+
required: true,
|
|
24
|
+
default: { '@path': '$.userId' }
|
|
25
|
+
},
|
|
26
|
+
email: {
|
|
27
|
+
label: 'Email',
|
|
28
|
+
description: 'User email address. Vaule will be hashed before sending to Amazon.',
|
|
29
|
+
type: 'string',
|
|
30
|
+
required: false,
|
|
31
|
+
default: { '@path': '$.properties.email' }
|
|
32
|
+
},
|
|
33
|
+
firstName: {
|
|
34
|
+
label: 'First name',
|
|
35
|
+
description: 'User first name. Value will be hashed before sending to Amazon.',
|
|
36
|
+
type: 'string',
|
|
37
|
+
required: false,
|
|
38
|
+
default: { '@path': '$.properties.first_name' }
|
|
39
|
+
},
|
|
40
|
+
lastName: {
|
|
41
|
+
label: 'Last name',
|
|
42
|
+
description: 'User Last name. Value will be hashed before sending to Amazon.',
|
|
43
|
+
type: 'string',
|
|
44
|
+
required: false,
|
|
45
|
+
default: { '@path': '$.properties.last_name' }
|
|
46
|
+
},
|
|
47
|
+
phone: {
|
|
48
|
+
label: 'Phone',
|
|
49
|
+
description: 'Phone Number. Value will be hashed before sending to Amazon.',
|
|
50
|
+
type: 'string',
|
|
51
|
+
required: false,
|
|
52
|
+
default: { '@path': '$.properties.phone' }
|
|
53
|
+
},
|
|
54
|
+
postal: {
|
|
55
|
+
label: 'Postal',
|
|
56
|
+
description: 'POstal Code. Value will be hashed before sending to Amazon.',
|
|
57
|
+
type: 'string',
|
|
58
|
+
required: false,
|
|
59
|
+
default: { '@path': '$.properties.postal' }
|
|
60
|
+
},
|
|
61
|
+
state: {
|
|
62
|
+
label: 'Postal',
|
|
63
|
+
description: 'State Code. Value will be hashed before sending to Amazon.',
|
|
64
|
+
type: 'string',
|
|
65
|
+
required: false,
|
|
66
|
+
default: { '@path': '$.properties.state' }
|
|
67
|
+
},
|
|
68
|
+
city: {
|
|
69
|
+
label: 'City',
|
|
70
|
+
description: 'City name. Value will be hashed before sending to Amazon.',
|
|
71
|
+
type: 'string',
|
|
72
|
+
required: false,
|
|
73
|
+
default: { '@path': '$.properties.city' }
|
|
74
|
+
},
|
|
75
|
+
address: {
|
|
76
|
+
label: 'Address',
|
|
77
|
+
description: 'Address Code. Value will be hashed before sending to Amazon.',
|
|
78
|
+
type: 'string',
|
|
79
|
+
required: false,
|
|
80
|
+
default: { '@path': '$.properties.address' }
|
|
81
|
+
},
|
|
82
|
+
audienceId: {
|
|
83
|
+
label: 'Audience ID',
|
|
84
|
+
type: 'string',
|
|
85
|
+
required: true,
|
|
86
|
+
unsafe_hidden: true,
|
|
87
|
+
description: 'A number value representing the Amazon audience identifier. This is the identifier that is returned during audience creation.',
|
|
88
|
+
default: {
|
|
89
|
+
'@path': '$.context.personas.external_audience_id'
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
enable_batching: {
|
|
93
|
+
label: 'Enable Batching',
|
|
94
|
+
description: 'When enabled,segment will send data in batching',
|
|
95
|
+
type: 'boolean',
|
|
96
|
+
required: true,
|
|
97
|
+
default: true
|
|
98
|
+
},
|
|
99
|
+
batch_size: {
|
|
100
|
+
label: 'Batch Size',
|
|
101
|
+
description: 'Maximum number of events to include in each batch. Actual batch sizes may be lower.',
|
|
102
|
+
type: 'number',
|
|
103
|
+
unsafe_hidden: true,
|
|
104
|
+
required: false,
|
|
105
|
+
default: 10000
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
perform: (request, { settings, payload, statsContext, audienceSettings }) => {
|
|
109
|
+
return processPayload(request, settings, [payload], statsContext, audienceSettings);
|
|
110
|
+
},
|
|
111
|
+
performBatch: (request, { settings, payload: payloads, statsContext, audienceSettings }) => {
|
|
112
|
+
return processPayload(request, settings, payloads, statsContext, audienceSettings);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
async function processPayload(request, settings, payload, statsContext, audienceSettings) {
|
|
116
|
+
const { statsClient, tags: statsTags } = statsContext || {};
|
|
117
|
+
const statsName = 'syncAmazonAdsAudience';
|
|
118
|
+
statsClient?.incr(`${statsName}.intialise`, 1, statsTags);
|
|
119
|
+
const payloadRecord = createPayloadToUploadRecords(payload, audienceSettings);
|
|
120
|
+
const payloadString = JSON.stringify(payloadRecord).replace(/"audienceId":"(\d+)"/, '"audienceId":$1');
|
|
121
|
+
const response = await request(`${settings.region}/amc/audiences/records`, {
|
|
122
|
+
method: 'POST',
|
|
123
|
+
body: payloadString,
|
|
124
|
+
headers: {
|
|
125
|
+
'Content-Type': 'application/vnd.amcaudiences.v1+json'
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
const result = response.data;
|
|
129
|
+
return {
|
|
130
|
+
result
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
function createPayloadToUploadRecords(payloads, audienceSettings) {
|
|
134
|
+
const records = [];
|
|
135
|
+
const { audienceId } = payloads[0];
|
|
136
|
+
payloads.forEach((payload) => {
|
|
137
|
+
const hashedPII = {};
|
|
138
|
+
if (payload.firstName) {
|
|
139
|
+
hashedPII.firstname = normalizeAndHash(payload.firstName);
|
|
140
|
+
}
|
|
141
|
+
if (payload.lastName) {
|
|
142
|
+
hashedPII.lastname = normalizeAndHash(payload.lastName);
|
|
143
|
+
}
|
|
144
|
+
if (payload.address) {
|
|
145
|
+
hashedPII.address = normalizeAndHash(payload.address);
|
|
146
|
+
}
|
|
147
|
+
if (payload.postal) {
|
|
148
|
+
hashedPII.postal = normalizeAndHash(payload.postal);
|
|
149
|
+
}
|
|
150
|
+
if (payload.phone) {
|
|
151
|
+
hashedPII.phone = normalizeAndHash(payload.phone);
|
|
152
|
+
}
|
|
153
|
+
if (payload.city) {
|
|
154
|
+
hashedPII.city = normalizeAndHash(payload.city);
|
|
155
|
+
}
|
|
156
|
+
if (payload.state) {
|
|
157
|
+
hashedPII.state = normalizeAndHash(payload.state);
|
|
158
|
+
}
|
|
159
|
+
if (payload.email) {
|
|
160
|
+
hashedPII.email = normalizeAndHash(payload.email);
|
|
161
|
+
}
|
|
162
|
+
const payloadRecord = {
|
|
163
|
+
externalUserId: payload.externalUserId,
|
|
164
|
+
countryCode: audienceSettings.countryCode,
|
|
165
|
+
action: payload.event_name == 'Audience Entered' ? utils_1.CONSTANTS.CREATE : utils_1.CONSTANTS.DELETE,
|
|
166
|
+
hashedPII: [hashedPII]
|
|
167
|
+
};
|
|
168
|
+
records.push(payloadRecord);
|
|
169
|
+
});
|
|
170
|
+
return {
|
|
171
|
+
records: records,
|
|
172
|
+
audienceId: audienceId
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
function normalizeAndHash(data) {
|
|
176
|
+
const normalizedData = data.toLowerCase().trim();
|
|
177
|
+
const hash = crypto_1.createHash('sha256');
|
|
178
|
+
hash.update(normalizedData);
|
|
179
|
+
return hash.digest('hex');
|
|
180
|
+
}
|
|
181
|
+
exports.default = action;
|
|
182
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/amazon-ads/syncAudiences/index.ts"],"names":[],"mappings":";;AAGA,oCAAyD;AACzD,mCAAmC;AAGnC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,eAAe;IACtB,WAAW,EAAE,qDAAqD;IAClE,mBAAmB,EAAE,yDAAyD;IAC9E,MAAM,EAAE;QACN,UAAU,EAAE;YACV,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,wCAAwC;YACrD,IAAI,EAAE,QAAQ;YACd,aAAa,EAAE,IAAI;YACnB,OAAO,EAAE;gBACP,OAAO,EAAE,SAAS;aACnB;SACF;QACD,cAAc,EAAE;YACd,KAAK,EAAE,kBAAkB;YACzB,WAAW,EAAE,gEAAgE;YAC7E,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,UAAU,EAAE;SACjC;QACD,KAAK,EAAE;YACL,KAAK,EAAE,OAAO;YACd,WAAW,EAAE,oEAAoE;YACjF,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE;SAC3C;QACD,SAAS,EAAE;YACT,KAAK,EAAE,YAAY;YACnB,WAAW,EAAE,iEAAiE;YAC9E,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,EAAE,OAAO,EAAE,yBAAyB,EAAE;SAChD;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,WAAW;YAClB,WAAW,EAAE,gEAAgE;YAC7E,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE;SAC/C;QACD,KAAK,EAAE;YACL,KAAK,EAAE,OAAO;YACd,WAAW,EAAE,8DAA8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,CAAC,KAAK,CAAC,CAAA;SAClD;QAED,MAAM,aAAa,GAAmB;YACpC,cAAc,EAAE,OAAO,CAAC,cAAc;YACtC,WAAW,EAAE,gBAAgB,CAAC,WAAW;YACzC,MAAM,EAAE,OAAO,CAAC,UAAU,IAAI,kBAAkB,CAAC,CAAC,CAAC,iBAAS,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAS,CAAC,MAAM;YACtF,SAAS,EAAE,CAAC,SAAS,CAAC;SACvB,CAAA;QACD,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;IAC7B,CAAC,CAAC,CAAA;IAEF,OAAO;QACL,OAAO,EAAE,OAAO;QAChB,UAAU,EAAE,UAAU;KACvB,CAAA;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAY;IAEpC,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAA;IAEhD,MAAM,IAAI,GAAG,mBAAU,CAAC,QAAQ,CAAC,CAAA;IACjC,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,CAAA;IAC3B,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC3B,CAAC;AAED,kBAAe,MAAM,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { HTTPError } from '@segment/actions-core';
|
|
2
|
+
export interface RefreshTokenResponse {
|
|
3
|
+
access_token: string;
|
|
4
|
+
scope: string;
|
|
5
|
+
expires_in: number;
|
|
6
|
+
token_type: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class AmazonTestAuthenticationError extends HTTPError {
|
|
9
|
+
response: Response & {
|
|
10
|
+
data: {
|
|
11
|
+
message: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare class AmazonRefreshTokenError extends HTTPError {
|
|
16
|
+
response: Response & {
|
|
17
|
+
data: {
|
|
18
|
+
error: string;
|
|
19
|
+
error_description: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface HashedPIIObject {
|
|
24
|
+
firstname?: string;
|
|
25
|
+
lastname?: string;
|
|
26
|
+
phone?: string;
|
|
27
|
+
city?: string;
|
|
28
|
+
state?: string;
|
|
29
|
+
postal?: string;
|
|
30
|
+
email?: string;
|
|
31
|
+
address?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface AudienceRecord {
|
|
34
|
+
hashedPII?: HashedPIIObject[];
|
|
35
|
+
externalUserId: string;
|
|
36
|
+
countryCode: string;
|
|
37
|
+
action: string;
|
|
38
|
+
}
|
|
39
|
+
export interface TargetResourceRecords {
|
|
40
|
+
connectionId: string;
|
|
41
|
+
targetTypes: string[];
|
|
42
|
+
}
|
|
43
|
+
export interface AudienceRecordPayload {
|
|
44
|
+
records: AudienceRecord[];
|
|
45
|
+
targetResource: TargetResourceRecords;
|
|
46
|
+
audienceId: number;
|
|
47
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AmazonRefreshTokenError = exports.AmazonTestAuthenticationError = void 0;
|
|
4
|
+
const actions_core_1 = require("@segment/actions-core");
|
|
5
|
+
class AmazonTestAuthenticationError extends actions_core_1.HTTPError {
|
|
6
|
+
}
|
|
7
|
+
exports.AmazonTestAuthenticationError = AmazonTestAuthenticationError;
|
|
8
|
+
class AmazonRefreshTokenError extends actions_core_1.HTTPError {
|
|
9
|
+
}
|
|
10
|
+
exports.AmazonRefreshTokenError = AmazonRefreshTokenError;
|
|
11
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/destinations/amazon-ads/types.ts"],"names":[],"mappings":";;;AAAA,wDAAiD;AAajD,MAAa,6BAA8B,SAAQ,wBAAS;CAM3D;AAND,sEAMC;AAED,MAAa,uBAAwB,SAAQ,wBAAS;CAOrD;AAPD,0DAOC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { HTTPError } from '@segment/actions-core';
|
|
2
|
+
export declare class AmazonAdsError extends HTTPError {
|
|
3
|
+
response: Response & {
|
|
4
|
+
data: {
|
|
5
|
+
status: string;
|
|
6
|
+
message: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export interface AudiencePayload {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
countryCode: string;
|
|
14
|
+
targetResource: {
|
|
15
|
+
advertiserId: string;
|
|
16
|
+
};
|
|
17
|
+
metadata: {
|
|
18
|
+
externalAudienceId: string;
|
|
19
|
+
ttl?: number;
|
|
20
|
+
audienceFees?: {
|
|
21
|
+
cpmCents: number;
|
|
22
|
+
currency: string;
|
|
23
|
+
}[];
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface RecordsResponseType {
|
|
27
|
+
jobRequestId: string;
|
|
28
|
+
}
|
|
29
|
+
export declare const AUTHORIZATION_URL: any;
|
|
30
|
+
export declare const CONSTANTS: {
|
|
31
|
+
CREATE: string;
|
|
32
|
+
DELETE: string;
|
|
33
|
+
};
|
|
34
|
+
export declare const CURRENCY: string[];
|
|
35
|
+
export declare const REGEX_AUDIENCEID: RegExp;
|
|
36
|
+
export declare const REGEX_ADVERTISERID: RegExp;
|
|
37
|
+
export declare function extractNumberAndSubstituteWithStringValue(responseString: string, regex: any, substituteWith: string): any;
|