@aws-amplify/analytics 7.0.1-preview-testing.034e780.0 → 7.0.1-server-generate-client.1e317a1.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/kinesis/package.json +7 -0
- package/kinesis-firehose/package.json +7 -0
- package/lib/apis/disable.d.ts +8 -0
- package/lib/apis/disable.js +14 -0
- package/lib/apis/enable.d.ts +7 -0
- package/lib/apis/enable.js +13 -0
- package/lib/apis/index.d.ts +2 -0
- package/lib/apis/index.js +9 -0
- package/lib/errors/AnalyticsError.d.ts +2 -2
- package/lib/errors/assertValidationError.d.ts +1 -1
- package/lib/errors/assertValidationError.js +7 -3
- package/lib/errors/validation.d.ts +5 -2
- package/lib/errors/validation.js +16 -4
- package/lib/index.d.ts +2 -1
- package/lib/index.js +6 -1
- package/lib/providers/kinesis/apis/flushEvents.d.ts +8 -0
- package/lib/providers/kinesis/apis/flushEvents.js +38 -0
- package/lib/providers/kinesis/apis/index.d.ts +2 -0
- package/lib/providers/kinesis/apis/index.js +9 -0
- package/lib/providers/kinesis/apis/record.d.ts +2 -0
- package/lib/providers/kinesis/apis/record.js +48 -0
- package/lib/providers/kinesis/index.d.ts +1 -0
- package/lib/providers/kinesis/index.js +8 -0
- package/lib/providers/kinesis/types/buffer.d.ts +15 -0
- package/lib/providers/kinesis/types/buffer.js +4 -0
- package/lib/providers/kinesis/types/index.d.ts +2 -0
- package/lib/providers/kinesis/types/index.js +4 -0
- package/lib/providers/kinesis/types/inputs.d.ts +6 -0
- package/lib/providers/kinesis/types/inputs.js +4 -0
- package/lib/providers/kinesis/utils/constants.d.ts +6 -0
- package/lib/providers/kinesis/utils/constants.js +11 -0
- package/lib/providers/kinesis/utils/getEventBuffer.d.ts +3 -0
- package/lib/providers/kinesis/utils/getEventBuffer.js +103 -0
- package/lib/providers/kinesis/utils/resolveConfig.d.ts +7 -0
- package/lib/providers/kinesis/utils/resolveConfig.js +24 -0
- package/lib/providers/kinesis-firehose/apis/flushEvents.d.ts +8 -0
- package/lib/providers/kinesis-firehose/apis/flushEvents.js +37 -0
- package/lib/providers/kinesis-firehose/apis/index.d.ts +2 -0
- package/lib/providers/kinesis-firehose/apis/index.js +9 -0
- package/lib/providers/kinesis-firehose/apis/record.d.ts +2 -0
- package/lib/providers/kinesis-firehose/apis/record.js +45 -0
- package/lib/providers/kinesis-firehose/index.d.ts +1 -0
- package/lib/providers/kinesis-firehose/index.js +8 -0
- package/lib/providers/kinesis-firehose/types/buffer.d.ts +15 -0
- package/lib/providers/kinesis-firehose/types/index.d.ts +2 -0
- package/lib/providers/kinesis-firehose/types/index.js +4 -0
- package/lib/providers/kinesis-firehose/types/inputs.d.ts +5 -0
- package/lib/providers/kinesis-firehose/types/inputs.js +4 -0
- package/lib/providers/kinesis-firehose/utils/constants.d.ts +6 -0
- package/lib/providers/kinesis-firehose/utils/constants.js +11 -0
- package/lib/providers/kinesis-firehose/utils/getEventBuffer.d.ts +3 -0
- package/lib/providers/kinesis-firehose/utils/getEventBuffer.js +100 -0
- package/lib/providers/kinesis-firehose/utils/index.d.ts +2 -0
- package/lib/providers/kinesis-firehose/utils/index.js +9 -0
- package/lib/providers/kinesis-firehose/utils/resolveConfig.d.ts +7 -0
- package/lib/providers/kinesis-firehose/utils/resolveConfig.js +24 -0
- package/lib/providers/personalize/apis/flushEvents.d.ts +8 -0
- package/lib/providers/personalize/apis/flushEvents.js +36 -0
- package/lib/providers/personalize/apis/index.d.ts +2 -0
- package/lib/providers/personalize/apis/index.js +9 -0
- package/lib/providers/personalize/apis/record.d.ts +2 -0
- package/lib/providers/personalize/apis/record.js +87 -0
- package/lib/providers/personalize/index.d.ts +1 -0
- package/lib/providers/personalize/index.js +8 -0
- package/lib/providers/personalize/types/buffer.d.ts +16 -0
- package/lib/providers/personalize/types/buffer.js +4 -0
- package/lib/providers/personalize/types/index.d.ts +2 -0
- package/lib/providers/personalize/types/index.js +4 -0
- package/lib/providers/personalize/types/inputs.d.ts +7 -0
- package/lib/providers/personalize/types/inputs.js +4 -0
- package/lib/providers/personalize/utils/autoTrackMedia.d.ts +10 -0
- package/lib/providers/personalize/utils/autoTrackMedia.js +183 -0
- package/lib/providers/personalize/utils/cachedSession.d.ts +5 -0
- package/lib/providers/personalize/utils/cachedSession.js +61 -0
- package/lib/providers/personalize/utils/constants.d.ts +7 -0
- package/lib/providers/personalize/utils/constants.js +12 -0
- package/lib/providers/personalize/utils/getEventBuffer.d.ts +3 -0
- package/lib/providers/personalize/utils/getEventBuffer.js +100 -0
- package/lib/providers/personalize/utils/index.d.ts +5 -0
- package/lib/providers/personalize/utils/index.js +17 -0
- package/lib/providers/personalize/utils/resolveConfig.d.ts +7 -0
- package/lib/providers/personalize/utils/resolveConfig.js +25 -0
- package/lib/providers/pinpoint/apis/configureAutoTrack.d.ts +15 -0
- package/lib/providers/pinpoint/apis/configureAutoTrack.js +35 -0
- package/lib/providers/pinpoint/apis/flushEvents.d.ts +8 -0
- package/lib/providers/pinpoint/apis/flushEvents.js +28 -0
- package/lib/providers/pinpoint/apis/identifyUser.d.ts +7 -5
- package/lib/providers/pinpoint/apis/identifyUser.js +15 -11
- package/lib/providers/pinpoint/apis/index.d.ts +2 -0
- package/lib/providers/pinpoint/apis/index.js +5 -1
- package/lib/providers/pinpoint/apis/record.d.ts +8 -14
- package/lib/providers/pinpoint/apis/record.js +22 -24
- package/lib/providers/pinpoint/index.d.ts +2 -2
- package/lib/providers/pinpoint/index.js +3 -1
- package/lib/providers/pinpoint/types/index.d.ts +2 -2
- package/lib/providers/pinpoint/types/index.js +0 -3
- package/lib/providers/pinpoint/types/inputs.d.ts +8 -17
- package/lib/providers/pinpoint/types/options.d.ts +5 -0
- package/lib/providers/pinpoint/types/options.js +4 -0
- package/lib/providers/pinpoint/utils/resolveCredentials.d.ts +1 -6
- package/lib/trackers/EventTracker.d.ts +10 -0
- package/lib/trackers/EventTracker.js +104 -0
- package/lib/trackers/PageViewTracker.d.ts +18 -0
- package/lib/trackers/PageViewTracker.js +116 -0
- package/lib/trackers/SessionTracker.d.ts +13 -0
- package/lib/trackers/SessionTracker.js +73 -0
- package/lib/trackers/SessionTracker.native.d.ts +13 -0
- package/lib/trackers/SessionTracker.native.js +73 -0
- package/lib/trackers/index.d.ts +3 -0
- package/lib/trackers/index.js +11 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/index.d.ts +3 -1
- package/lib/types/index.js +0 -2
- package/lib/types/inputs.d.ts +35 -0
- package/lib/types/inputs.js +4 -0
- package/lib/types/kinesis.d.ts +8 -0
- package/lib/types/kinesis.js +4 -0
- package/lib/types/options.d.ts +4 -0
- package/lib/types/options.js +4 -0
- package/lib/types/trackers.d.ts +22 -0
- package/lib/types/trackers.js +4 -0
- package/lib/utils/eventBuffer/EventBuffer.d.ts +16 -0
- package/lib/utils/eventBuffer/EventBuffer.js +91 -0
- package/lib/utils/eventBuffer/index.d.ts +2 -0
- package/lib/utils/eventBuffer/index.js +7 -0
- package/lib/utils/eventBuffer/types.d.ts +8 -0
- package/lib/utils/eventBuffer/types.js +4 -0
- package/lib/utils/groupBy.d.ts +1 -0
- package/lib/utils/groupBy.js +15 -0
- package/lib/utils/index.d.ts +7 -0
- package/lib/utils/index.js +22 -0
- package/lib/utils/resolveCredentials.d.ts +4 -0
- package/lib/utils/resolveCredentials.js +21 -0
- package/lib/utils/statusHelpers.d.ts +6 -0
- package/lib/utils/statusHelpers.js +19 -0
- package/lib/utils/trackerConfigHelpers.d.ts +5 -0
- package/lib/utils/trackerConfigHelpers.js +15 -0
- package/lib/utils/trackerConfigHelpers.native.d.ts +5 -0
- package/lib/utils/trackerConfigHelpers.native.js +14 -0
- package/lib/utils/trackerHelpers.d.ts +9 -0
- package/lib/utils/trackerHelpers.js +44 -0
- package/lib-esm/apis/disable.d.ts +8 -0
- package/lib-esm/apis/disable.js +11 -0
- package/lib-esm/apis/enable.d.ts +7 -0
- package/lib-esm/apis/enable.js +10 -0
- package/lib-esm/apis/index.d.ts +2 -0
- package/lib-esm/apis/index.js +4 -0
- package/lib-esm/errors/AnalyticsError.d.ts +2 -2
- package/lib-esm/errors/AnalyticsError.js +1 -1
- package/lib-esm/errors/assertValidationError.d.ts +1 -1
- package/lib-esm/errors/assertValidationError.js +7 -3
- package/lib-esm/errors/validation.d.ts +5 -2
- package/lib-esm/errors/validation.js +16 -4
- package/lib-esm/index.d.ts +2 -1
- package/lib-esm/index.js +2 -1
- package/lib-esm/providers/kinesis/apis/flushEvents.d.ts +8 -0
- package/lib-esm/providers/kinesis/apis/flushEvents.js +34 -0
- package/lib-esm/providers/kinesis/apis/index.d.ts +2 -0
- package/lib-esm/providers/kinesis/apis/index.js +4 -0
- package/lib-esm/providers/kinesis/apis/record.d.ts +2 -0
- package/lib-esm/providers/kinesis/apis/record.js +44 -0
- package/lib-esm/providers/kinesis/index.d.ts +1 -0
- package/lib-esm/providers/kinesis/index.js +3 -0
- package/lib-esm/providers/kinesis/types/buffer.d.ts +15 -0
- package/lib-esm/providers/kinesis/types/buffer.js +3 -0
- package/lib-esm/providers/kinesis/types/index.d.ts +2 -0
- package/lib-esm/providers/kinesis/types/index.js +3 -0
- package/lib-esm/providers/kinesis/types/inputs.d.ts +6 -0
- package/lib-esm/providers/kinesis/types/inputs.js +3 -0
- package/lib-esm/providers/kinesis/utils/constants.d.ts +6 -0
- package/lib-esm/providers/kinesis/utils/constants.js +8 -0
- package/lib-esm/providers/kinesis/utils/getEventBuffer.d.ts +3 -0
- package/lib-esm/providers/kinesis/utils/getEventBuffer.js +99 -0
- package/lib-esm/providers/kinesis/utils/resolveConfig.d.ts +7 -0
- package/lib-esm/providers/kinesis/utils/resolveConfig.js +20 -0
- package/lib-esm/providers/kinesis-firehose/apis/flushEvents.d.ts +8 -0
- package/lib-esm/providers/kinesis-firehose/apis/flushEvents.js +33 -0
- package/lib-esm/providers/kinesis-firehose/apis/index.d.ts +2 -0
- package/lib-esm/providers/kinesis-firehose/apis/index.js +4 -0
- package/lib-esm/providers/kinesis-firehose/apis/record.d.ts +2 -0
- package/lib-esm/providers/kinesis-firehose/apis/record.js +41 -0
- package/lib-esm/providers/kinesis-firehose/index.d.ts +1 -0
- package/lib-esm/providers/kinesis-firehose/index.js +3 -0
- package/lib-esm/providers/kinesis-firehose/types/buffer.d.ts +15 -0
- package/lib-esm/providers/kinesis-firehose/types/index.d.ts +2 -0
- package/lib-esm/providers/kinesis-firehose/types/index.js +3 -0
- package/lib-esm/providers/kinesis-firehose/types/inputs.d.ts +5 -0
- package/lib-esm/providers/kinesis-firehose/types/inputs.js +3 -0
- package/lib-esm/providers/kinesis-firehose/utils/constants.d.ts +6 -0
- package/lib-esm/providers/kinesis-firehose/utils/constants.js +8 -0
- package/lib-esm/providers/kinesis-firehose/utils/getEventBuffer.d.ts +3 -0
- package/lib-esm/providers/kinesis-firehose/utils/getEventBuffer.js +96 -0
- package/lib-esm/providers/kinesis-firehose/utils/index.d.ts +2 -0
- package/lib-esm/providers/kinesis-firehose/utils/index.js +4 -0
- package/lib-esm/providers/kinesis-firehose/utils/resolveConfig.d.ts +7 -0
- package/lib-esm/providers/kinesis-firehose/utils/resolveConfig.js +20 -0
- package/lib-esm/providers/personalize/apis/flushEvents.d.ts +8 -0
- package/lib-esm/providers/personalize/apis/flushEvents.js +32 -0
- package/lib-esm/providers/personalize/apis/index.d.ts +2 -0
- package/lib-esm/providers/personalize/apis/index.js +4 -0
- package/lib-esm/providers/personalize/apis/record.d.ts +2 -0
- package/lib-esm/providers/personalize/apis/record.js +83 -0
- package/lib-esm/providers/personalize/index.d.ts +1 -0
- package/lib-esm/providers/personalize/index.js +3 -0
- package/lib-esm/providers/personalize/types/buffer.d.ts +16 -0
- package/lib-esm/providers/personalize/types/buffer.js +3 -0
- package/lib-esm/providers/personalize/types/index.d.ts +2 -0
- package/lib-esm/providers/personalize/types/index.js +3 -0
- package/lib-esm/providers/personalize/types/inputs.d.ts +7 -0
- package/lib-esm/providers/personalize/types/inputs.js +3 -0
- package/lib-esm/providers/personalize/utils/autoTrackMedia.d.ts +10 -0
- package/lib-esm/providers/personalize/utils/autoTrackMedia.js +179 -0
- package/lib-esm/providers/personalize/utils/cachedSession.d.ts +5 -0
- package/lib-esm/providers/personalize/utils/cachedSession.js +56 -0
- package/lib-esm/providers/personalize/utils/constants.d.ts +7 -0
- package/lib-esm/providers/personalize/utils/constants.js +9 -0
- package/lib-esm/providers/personalize/utils/getEventBuffer.d.ts +3 -0
- package/lib-esm/providers/personalize/utils/getEventBuffer.js +96 -0
- package/lib-esm/providers/personalize/utils/index.d.ts +5 -0
- package/lib-esm/providers/personalize/utils/index.js +7 -0
- package/lib-esm/providers/personalize/utils/resolveConfig.d.ts +7 -0
- package/lib-esm/providers/personalize/utils/resolveConfig.js +21 -0
- package/lib-esm/providers/pinpoint/apis/configureAutoTrack.d.ts +15 -0
- package/lib-esm/providers/pinpoint/apis/configureAutoTrack.js +31 -0
- package/lib-esm/providers/pinpoint/apis/flushEvents.d.ts +8 -0
- package/lib-esm/providers/pinpoint/apis/flushEvents.js +24 -0
- package/lib-esm/providers/pinpoint/apis/identifyUser.d.ts +7 -5
- package/lib-esm/providers/pinpoint/apis/identifyUser.js +13 -9
- package/lib-esm/providers/pinpoint/apis/index.d.ts +2 -0
- package/lib-esm/providers/pinpoint/apis/index.js +2 -0
- package/lib-esm/providers/pinpoint/apis/record.d.ts +8 -14
- package/lib-esm/providers/pinpoint/apis/record.js +20 -22
- package/lib-esm/providers/pinpoint/index.d.ts +2 -2
- package/lib-esm/providers/pinpoint/index.js +1 -1
- package/lib-esm/providers/pinpoint/types/index.d.ts +2 -2
- package/lib-esm/providers/pinpoint/types/index.js +1 -1
- package/lib-esm/providers/pinpoint/types/inputs.d.ts +8 -17
- package/lib-esm/providers/pinpoint/types/options.d.ts +5 -0
- package/lib-esm/providers/pinpoint/types/options.js +3 -0
- package/lib-esm/providers/pinpoint/utils/resolveCredentials.d.ts +1 -6
- package/lib-esm/trackers/EventTracker.d.ts +10 -0
- package/lib-esm/trackers/EventTracker.js +101 -0
- package/lib-esm/trackers/PageViewTracker.d.ts +18 -0
- package/lib-esm/trackers/PageViewTracker.js +113 -0
- package/lib-esm/trackers/SessionTracker.d.ts +13 -0
- package/lib-esm/trackers/SessionTracker.js +70 -0
- package/lib-esm/trackers/SessionTracker.native.d.ts +13 -0
- package/lib-esm/trackers/SessionTracker.native.js +70 -0
- package/lib-esm/trackers/index.d.ts +3 -0
- package/lib-esm/trackers/index.js +5 -0
- package/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/lib-esm/types/index.d.ts +3 -1
- package/lib-esm/types/index.js +1 -1
- package/lib-esm/types/inputs.d.ts +35 -0
- package/lib-esm/types/inputs.js +3 -0
- package/lib-esm/types/kinesis.d.ts +8 -0
- package/lib-esm/types/kinesis.js +3 -0
- package/lib-esm/types/options.d.ts +4 -0
- package/lib-esm/types/options.js +3 -0
- package/lib-esm/types/trackers.d.ts +22 -0
- package/lib-esm/types/trackers.js +3 -0
- package/lib-esm/utils/eventBuffer/EventBuffer.d.ts +16 -0
- package/lib-esm/utils/eventBuffer/EventBuffer.js +88 -0
- package/lib-esm/utils/eventBuffer/index.d.ts +2 -0
- package/lib-esm/utils/eventBuffer/index.js +3 -0
- package/lib-esm/utils/eventBuffer/types.d.ts +8 -0
- package/lib-esm/utils/eventBuffer/types.js +3 -0
- package/lib-esm/utils/groupBy.d.ts +1 -0
- package/lib-esm/utils/groupBy.js +11 -0
- package/lib-esm/utils/index.d.ts +7 -0
- package/lib-esm/utils/index.js +9 -0
- package/lib-esm/utils/resolveCredentials.d.ts +4 -0
- package/lib-esm/utils/resolveCredentials.js +17 -0
- package/lib-esm/utils/statusHelpers.d.ts +6 -0
- package/lib-esm/utils/statusHelpers.js +13 -0
- package/lib-esm/utils/trackerConfigHelpers.d.ts +5 -0
- package/lib-esm/utils/trackerConfigHelpers.js +11 -0
- package/lib-esm/utils/trackerConfigHelpers.native.d.ts +5 -0
- package/lib-esm/utils/trackerConfigHelpers.native.js +10 -0
- package/lib-esm/utils/trackerHelpers.d.ts +9 -0
- package/lib-esm/utils/trackerHelpers.js +40 -0
- package/package.json +39 -9
- package/personalize/package.json +7 -0
- package/src/apis/disable.ts +13 -0
- package/src/apis/enable.ts +12 -0
- package/src/apis/index.ts +5 -0
- package/src/errors/AnalyticsError.ts +5 -2
- package/src/errors/assertValidationError.ts +9 -3
- package/src/errors/validation.ts +16 -4
- package/src/index.ts +4 -0
- package/src/providers/kinesis/apis/flushEvents.ts +40 -0
- package/src/providers/kinesis/apis/index.ts +5 -0
- package/src/providers/kinesis/apis/record.ts +58 -0
- package/src/providers/kinesis/index.ts +4 -0
- package/src/providers/kinesis/types/buffer.ts +20 -0
- package/src/providers/kinesis/types/index.ts +5 -0
- package/src/providers/kinesis/types/inputs.ts +10 -0
- package/src/providers/kinesis/utils/constants.ts +9 -0
- package/src/providers/kinesis/utils/getEventBuffer.ts +110 -0
- package/src/providers/kinesis/utils/resolveConfig.ts +36 -0
- package/src/providers/kinesis-firehose/apis/flushEvents.ts +39 -0
- package/src/providers/kinesis-firehose/apis/index.ts +5 -0
- package/src/providers/kinesis-firehose/apis/record.ts +51 -0
- package/src/providers/kinesis-firehose/index.ts +4 -0
- package/src/providers/kinesis-firehose/types/buffer.ts +20 -0
- package/src/providers/kinesis-firehose/types/index.ts +9 -0
- package/src/providers/kinesis-firehose/types/inputs.ts +9 -0
- package/src/providers/kinesis-firehose/utils/constants.ts +9 -0
- package/src/providers/kinesis-firehose/utils/getEventBuffer.ts +118 -0
- package/src/providers/kinesis-firehose/utils/index.ts +5 -0
- package/src/providers/kinesis-firehose/utils/resolveConfig.ts +36 -0
- package/src/providers/personalize/apis/flushEvents.ts +37 -0
- package/src/providers/personalize/apis/index.ts +5 -0
- package/src/providers/personalize/apis/record.ts +102 -0
- package/src/providers/personalize/index.ts +4 -0
- package/src/providers/personalize/types/buffer.ts +21 -0
- package/src/providers/personalize/types/index.ts +5 -0
- package/src/providers/personalize/types/inputs.ts +11 -0
- package/src/providers/personalize/utils/autoTrackMedia.ts +232 -0
- package/src/providers/personalize/utils/cachedSession.ts +68 -0
- package/src/providers/personalize/utils/constants.ts +12 -0
- package/src/providers/personalize/utils/getEventBuffer.ts +111 -0
- package/src/providers/personalize/utils/index.ts +11 -0
- package/src/providers/personalize/utils/resolveConfig.ts +41 -0
- package/src/providers/pinpoint/apis/configureAutoTrack.ts +49 -0
- package/src/providers/pinpoint/apis/flushEvents.ts +32 -0
- package/src/providers/pinpoint/apis/identifyUser.ts +20 -12
- package/src/providers/pinpoint/apis/index.ts +2 -0
- package/src/providers/pinpoint/apis/record.ts +31 -23
- package/src/providers/pinpoint/index.ts +6 -2
- package/src/providers/pinpoint/types/index.ts +6 -2
- package/src/providers/pinpoint/types/inputs.ts +11 -17
- package/src/providers/pinpoint/types/options.ts +12 -0
- package/src/trackers/EventTracker.ts +135 -0
- package/src/trackers/PageViewTracker.ts +160 -0
- package/src/trackers/SessionTracker.native.ts +106 -0
- package/src/trackers/SessionTracker.ts +106 -0
- package/src/trackers/index.ts +6 -0
- package/src/types/index.ts +8 -1
- package/src/types/inputs.ts +52 -0
- package/src/types/kinesis.ts +13 -0
- package/src/types/options.ts +7 -0
- package/src/types/trackers.ts +35 -0
- package/src/utils/eventBuffer/EventBuffer.ts +84 -0
- package/src/utils/eventBuffer/index.ts +5 -0
- package/src/utils/eventBuffer/types.ts +12 -0
- package/src/utils/groupBy.ts +12 -0
- package/src/utils/index.ts +21 -0
- package/src/utils/resolveCredentials.ts +14 -0
- package/src/utils/statusHelpers.ts +17 -0
- package/src/utils/trackerConfigHelpers.native.ts +18 -0
- package/src/utils/trackerConfigHelpers.ts +19 -0
- package/src/utils/trackerHelpers.ts +57 -0
- package/lib/providers/pinpoint/types/errors.d.ts +0 -9
- package/lib/providers/pinpoint/types/errors.js +0 -15
- package/lib/types/analytics.d.ts +0 -50
- package/lib-esm/providers/pinpoint/types/errors.d.ts +0 -9
- package/lib-esm/providers/pinpoint/types/errors.js +0 -12
- package/lib-esm/types/analytics.d.ts +0 -50
- package/src/providers/pinpoint/types/errors.ts +0 -12
- package/src/types/analytics.ts +0 -70
- /package/lib/{types/analytics.js → providers/kinesis-firehose/types/buffer.js} +0 -0
- /package/lib-esm/{types/analytics.js → providers/kinesis-firehose/types/buffer.js} +0 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.autoTrackMedia = void 0;
|
|
6
|
+
var tslib_1 = require("tslib");
|
|
7
|
+
var utils_1 = require("@aws-amplify/core/internals/utils");
|
|
8
|
+
var core_1 = require("@aws-amplify/core");
|
|
9
|
+
var HTML5_MEDIA_EVENT;
|
|
10
|
+
(function (HTML5_MEDIA_EVENT) {
|
|
11
|
+
HTML5_MEDIA_EVENT["PLAY"] = "play";
|
|
12
|
+
HTML5_MEDIA_EVENT["PAUSE"] = "pause";
|
|
13
|
+
HTML5_MEDIA_EVENT["ENDED"] = "Ended";
|
|
14
|
+
})(HTML5_MEDIA_EVENT || (HTML5_MEDIA_EVENT = {}));
|
|
15
|
+
var MEDIA_TYPE;
|
|
16
|
+
(function (MEDIA_TYPE) {
|
|
17
|
+
MEDIA_TYPE["IFRAME"] = "IFRAME";
|
|
18
|
+
MEDIA_TYPE["VIDEO"] = "VIDEO";
|
|
19
|
+
MEDIA_TYPE["AUDIO"] = "AUDIO";
|
|
20
|
+
})(MEDIA_TYPE || (MEDIA_TYPE = {}));
|
|
21
|
+
var EVENT_TYPE;
|
|
22
|
+
(function (EVENT_TYPE) {
|
|
23
|
+
EVENT_TYPE["PLAY"] = "Play";
|
|
24
|
+
EVENT_TYPE["ENDED"] = "Ended";
|
|
25
|
+
EVENT_TYPE["PAUSE"] = "Pause";
|
|
26
|
+
EVENT_TYPE["TIME_WATCHED"] = "TimeWatched";
|
|
27
|
+
})(EVENT_TYPE || (EVENT_TYPE = {}));
|
|
28
|
+
var logger = new core_1.ConsoleLogger('MediaAutoTrack');
|
|
29
|
+
var startIframeAutoTracking = function (element, recordEvent) {
|
|
30
|
+
var isPlaying = false;
|
|
31
|
+
var player;
|
|
32
|
+
var mediaProperties = function () {
|
|
33
|
+
var duration = Number(parseFloat(player.getDuration()).toFixed(4));
|
|
34
|
+
var currentTime = Number(parseFloat(player.getCurrentTime()).toFixed(4));
|
|
35
|
+
return {
|
|
36
|
+
duration: duration,
|
|
37
|
+
eventValue: Number((currentTime / duration).toFixed(4)),
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
var scriptElement = document.createElement('script');
|
|
41
|
+
scriptElement.type = 'text/javascript';
|
|
42
|
+
scriptElement.src = 'https://www.youtube.com/iframe_api';
|
|
43
|
+
document.body.append(scriptElement);
|
|
44
|
+
var timer = setInterval(function () {
|
|
45
|
+
if (isPlaying && player) {
|
|
46
|
+
recordEvent(EVENT_TYPE.TIME_WATCHED, mediaProperties());
|
|
47
|
+
}
|
|
48
|
+
}, 3000);
|
|
49
|
+
element.addEventListener('unload', function () { return clearInterval(timer); });
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
window.onYouTubeIframeAPIReady = function () {
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
delete window.onYouTubeIframeAPIReady;
|
|
54
|
+
// @ts-ignore
|
|
55
|
+
player = new window.YT.Player(element.id, {
|
|
56
|
+
events: {
|
|
57
|
+
onStateChange: function (event) {
|
|
58
|
+
var iframeEventMapping = {
|
|
59
|
+
0: EVENT_TYPE.ENDED,
|
|
60
|
+
1: EVENT_TYPE.PLAY,
|
|
61
|
+
2: EVENT_TYPE.PAUSE,
|
|
62
|
+
};
|
|
63
|
+
// @ts-ignore
|
|
64
|
+
var eventType = iframeEventMapping[event.data];
|
|
65
|
+
switch (eventType) {
|
|
66
|
+
case EVENT_TYPE.ENDED:
|
|
67
|
+
case EVENT_TYPE.PAUSE:
|
|
68
|
+
isPlaying = false;
|
|
69
|
+
break;
|
|
70
|
+
case EVENT_TYPE.PLAY:
|
|
71
|
+
isPlaying = true;
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
if (eventType) {
|
|
75
|
+
recordEvent(eventType, mediaProperties());
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
var startHTMLMediaAutoTracking = function (element, recordEvent) {
|
|
83
|
+
var isPlaying = false;
|
|
84
|
+
var mediaProperties = function () { return ({
|
|
85
|
+
duration: element.duration,
|
|
86
|
+
eventValue: Number((element.currentTime / element.duration).toFixed(4)),
|
|
87
|
+
}); };
|
|
88
|
+
var timer = setInterval(function () {
|
|
89
|
+
if (isPlaying) {
|
|
90
|
+
recordEvent(EVENT_TYPE.TIME_WATCHED, mediaProperties());
|
|
91
|
+
}
|
|
92
|
+
}, 3000);
|
|
93
|
+
element.addEventListener('unload', function () { return clearInterval(timer); });
|
|
94
|
+
element.addEventListener(HTML5_MEDIA_EVENT.PLAY, function () {
|
|
95
|
+
isPlaying = true;
|
|
96
|
+
recordEvent(EVENT_TYPE.PLAY, mediaProperties());
|
|
97
|
+
});
|
|
98
|
+
element.addEventListener(HTML5_MEDIA_EVENT.PAUSE, function () {
|
|
99
|
+
isPlaying = false;
|
|
100
|
+
recordEvent(EVENT_TYPE.PAUSE, mediaProperties());
|
|
101
|
+
});
|
|
102
|
+
element.addEventListener(HTML5_MEDIA_EVENT.ENDED, function () {
|
|
103
|
+
isPlaying = false;
|
|
104
|
+
recordEvent(EVENT_TYPE.ENDED, mediaProperties());
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
var checkElementLoaded = function (interval, maxTries) {
|
|
108
|
+
var retryCount = 0;
|
|
109
|
+
var wait = function () { return new Promise(function (r) { return setTimeout(r, interval); }); };
|
|
110
|
+
var check = function (elementId) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
111
|
+
var domElement;
|
|
112
|
+
return tslib_1.__generator(this, function (_a) {
|
|
113
|
+
switch (_a.label) {
|
|
114
|
+
case 0:
|
|
115
|
+
if (retryCount >= maxTries) {
|
|
116
|
+
return [2 /*return*/, false];
|
|
117
|
+
}
|
|
118
|
+
domElement = document.getElementById(elementId);
|
|
119
|
+
if (!(domElement && domElement.clientHeight)) return [3 /*break*/, 1];
|
|
120
|
+
return [2 /*return*/, true];
|
|
121
|
+
case 1:
|
|
122
|
+
retryCount += 1;
|
|
123
|
+
return [4 /*yield*/, wait()];
|
|
124
|
+
case 2:
|
|
125
|
+
_a.sent();
|
|
126
|
+
return [4 /*yield*/, check(elementId)];
|
|
127
|
+
case 3: return [2 /*return*/, _a.sent()];
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}); };
|
|
131
|
+
return check;
|
|
132
|
+
};
|
|
133
|
+
var recordEvent = function (config, eventBuffer) {
|
|
134
|
+
return function (eventType, properties) {
|
|
135
|
+
// override eventType and merge properties
|
|
136
|
+
eventBuffer.append(tslib_1.__assign(tslib_1.__assign({}, config), { event: tslib_1.__assign(tslib_1.__assign({}, config.event), { eventType: eventType, properties: tslib_1.__assign(tslib_1.__assign({}, config.event.properties), properties) }), timestamp: Date.now() }));
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
var autoTrackMedia = function (config, eventBuffer) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
140
|
+
var _a, eventType, properties, domElementId, otherProperties, elementId, isElementLoaded, autoTrackConfigWithoutDomElementId, element;
|
|
141
|
+
return tslib_1.__generator(this, function (_b) {
|
|
142
|
+
switch (_b.label) {
|
|
143
|
+
case 0:
|
|
144
|
+
_a = config.event, eventType = _a.eventType, properties = _a.properties;
|
|
145
|
+
domElementId = properties.domElementId, otherProperties = tslib_1.__rest(properties, ["domElementId"]);
|
|
146
|
+
if (!(0, utils_1.isBrowser)()) {
|
|
147
|
+
logger.debug("".concat(eventType, " only for browser"));
|
|
148
|
+
return [2 /*return*/];
|
|
149
|
+
}
|
|
150
|
+
if (typeof domElementId === 'string' && !domElementId) {
|
|
151
|
+
logger.debug("Missing domElementId field in 'properties' for MediaAutoTrack event type.");
|
|
152
|
+
return [2 /*return*/];
|
|
153
|
+
}
|
|
154
|
+
elementId = domElementId;
|
|
155
|
+
return [4 /*yield*/, checkElementLoaded(500, 5)(elementId)];
|
|
156
|
+
case 1:
|
|
157
|
+
isElementLoaded = _b.sent();
|
|
158
|
+
if (isElementLoaded) {
|
|
159
|
+
autoTrackConfigWithoutDomElementId = tslib_1.__assign(tslib_1.__assign({}, config), { event: tslib_1.__assign(tslib_1.__assign({}, config.event), { properties: otherProperties }) });
|
|
160
|
+
element = document.getElementById(elementId);
|
|
161
|
+
switch (element === null || element === void 0 ? void 0 : element.tagName) {
|
|
162
|
+
case MEDIA_TYPE.IFRAME:
|
|
163
|
+
startIframeAutoTracking(element, recordEvent(autoTrackConfigWithoutDomElementId, eventBuffer));
|
|
164
|
+
break;
|
|
165
|
+
case MEDIA_TYPE.VIDEO:
|
|
166
|
+
case MEDIA_TYPE.AUDIO:
|
|
167
|
+
if (element instanceof HTMLMediaElement) {
|
|
168
|
+
startHTMLMediaAutoTracking(element, recordEvent(autoTrackConfigWithoutDomElementId, eventBuffer));
|
|
169
|
+
}
|
|
170
|
+
break;
|
|
171
|
+
default:
|
|
172
|
+
logger.debug("Unsupported DOM element tag: ".concat(element === null || element === void 0 ? void 0 : element.tagName));
|
|
173
|
+
break;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
else {
|
|
177
|
+
logger.debug('Cannot find the media element.');
|
|
178
|
+
}
|
|
179
|
+
return [2 /*return*/];
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}); };
|
|
183
|
+
exports.autoTrackMedia = autoTrackMedia;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.updateCachedSession = exports.resolveCachedSession = void 0;
|
|
6
|
+
var tslib_1 = require("tslib");
|
|
7
|
+
var core_1 = require("@aws-amplify/core");
|
|
8
|
+
var utils_1 = require("@aws-amplify/core/internals/utils");
|
|
9
|
+
var PERSONALIZE_CACHE_USERID = '_awsct_uid';
|
|
10
|
+
var PERSONALIZE_CACHE_SESSIONID = '_awsct_sid';
|
|
11
|
+
var DEFAULT_CACHE_PREFIX = 'personalize';
|
|
12
|
+
var DELIMITER = '.';
|
|
13
|
+
var CACHE_EXPIRY_IN_DAYS = 7;
|
|
14
|
+
var normalize = function (key) {
|
|
15
|
+
return [key, (0, utils_1.isBrowser)() ? window.location.host : DEFAULT_CACHE_PREFIX].join(DELIMITER);
|
|
16
|
+
};
|
|
17
|
+
var getCache = function (key) { return core_1.Cache.getItem(normalize(key)); };
|
|
18
|
+
var setCache = function (key, value) {
|
|
19
|
+
var expiredAt = new Date(Date.now() + 3600000 * 24 * CACHE_EXPIRY_IN_DAYS);
|
|
20
|
+
core_1.Cache.setItem(normalize(key), value, {
|
|
21
|
+
expires: expiredAt.getTime(),
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
var resolveCachedSession = function () { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
25
|
+
var sessionId, userId;
|
|
26
|
+
return tslib_1.__generator(this, function (_a) {
|
|
27
|
+
switch (_a.label) {
|
|
28
|
+
case 0: return [4 /*yield*/, getCache(PERSONALIZE_CACHE_SESSIONID)];
|
|
29
|
+
case 1:
|
|
30
|
+
sessionId = _a.sent();
|
|
31
|
+
if (!sessionId) {
|
|
32
|
+
sessionId = (0, utils_1.amplifyUuid)();
|
|
33
|
+
setCache(PERSONALIZE_CACHE_SESSIONID, sessionId);
|
|
34
|
+
}
|
|
35
|
+
return [4 /*yield*/, getCache(PERSONALIZE_CACHE_USERID)];
|
|
36
|
+
case 2:
|
|
37
|
+
userId = _a.sent();
|
|
38
|
+
return [2 /*return*/, {
|
|
39
|
+
sessionId: sessionId,
|
|
40
|
+
userId: userId,
|
|
41
|
+
}];
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}); };
|
|
45
|
+
exports.resolveCachedSession = resolveCachedSession;
|
|
46
|
+
var updateCachedSession = function (newUserId, currentSessionId, currentUserId) {
|
|
47
|
+
var isNoCachedSession = !currentSessionId;
|
|
48
|
+
var isSignOutCase = !newUserId && !currentUserId;
|
|
49
|
+
var isSwitchUserCase = !!newUserId && !!currentUserId && newUserId !== currentUserId;
|
|
50
|
+
var isRequireNewSession = isNoCachedSession || isSignOutCase || isSwitchUserCase;
|
|
51
|
+
var isRequireUpdateSession = !!currentSessionId && !currentUserId && !!newUserId;
|
|
52
|
+
if (isRequireNewSession) {
|
|
53
|
+
var newSessionId = (0, utils_1.amplifyUuid)();
|
|
54
|
+
setCache(PERSONALIZE_CACHE_SESSIONID, newSessionId);
|
|
55
|
+
setCache(PERSONALIZE_CACHE_USERID, newUserId);
|
|
56
|
+
}
|
|
57
|
+
else if (isRequireUpdateSession) {
|
|
58
|
+
setCache(PERSONALIZE_CACHE_USERID, newUserId);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
exports.updateCachedSession = updateCachedSession;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const DEFAULT_PERSONALIZE_CONFIG: {
|
|
2
|
+
flushSize: number;
|
|
3
|
+
flushInterval: number;
|
|
4
|
+
};
|
|
5
|
+
export declare const PERSONALIZE_FLUSH_SIZE_MAX = 10;
|
|
6
|
+
export declare const IDENTIFY_EVENT_TYPE = "Identify";
|
|
7
|
+
export declare const MEDIA_AUTO_TRACK_EVENT_TYPE = "MediaAutoTrack";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.MEDIA_AUTO_TRACK_EVENT_TYPE = exports.IDENTIFY_EVENT_TYPE = exports.PERSONALIZE_FLUSH_SIZE_MAX = exports.DEFAULT_PERSONALIZE_CONFIG = void 0;
|
|
6
|
+
exports.DEFAULT_PERSONALIZE_CONFIG = {
|
|
7
|
+
flushSize: 5,
|
|
8
|
+
flushInterval: 5000,
|
|
9
|
+
};
|
|
10
|
+
exports.PERSONALIZE_FLUSH_SIZE_MAX = 10;
|
|
11
|
+
exports.IDENTIFY_EVENT_TYPE = 'Identify';
|
|
12
|
+
exports.MEDIA_AUTO_TRACK_EVENT_TYPE = 'MediaAutoTrack';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { EventBuffer } from '../../../utils';
|
|
2
|
+
import { PersonalizeBufferConfig, PersonalizeBufferEvent } from '../types';
|
|
3
|
+
export declare const getEventBuffer: ({ region, flushSize, flushInterval, bufferSize, credentials, identityId, userAgentValue, }: PersonalizeBufferConfig) => EventBuffer<PersonalizeBufferEvent>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.getEventBuffer = void 0;
|
|
6
|
+
var tslib_1 = require("tslib");
|
|
7
|
+
var utils_1 = require("../../../utils");
|
|
8
|
+
var client_personalize_events_1 = require("@aws-sdk/client-personalize-events");
|
|
9
|
+
/**
|
|
10
|
+
* These Records hold cached event buffers and AWS clients.
|
|
11
|
+
* The hash key is determined by the region and session,
|
|
12
|
+
* consisting of a combined value comprising [region, sessionToken, identityId].
|
|
13
|
+
*
|
|
14
|
+
* Only one active session should exist at any given moment.
|
|
15
|
+
* When a new session is initiated, the previous ones should be released.
|
|
16
|
+
* */
|
|
17
|
+
var eventBufferMap = {};
|
|
18
|
+
var cachedClients = {};
|
|
19
|
+
var DELIMITER = '#';
|
|
20
|
+
var createPutEventsCommand = function (ids, events) {
|
|
21
|
+
var _a = tslib_1.__read(ids.split(DELIMITER), 3), trackingId = _a[0], sessionId = _a[1], userId = _a[2];
|
|
22
|
+
return new client_personalize_events_1.PutEventsCommand({
|
|
23
|
+
trackingId: trackingId,
|
|
24
|
+
sessionId: sessionId,
|
|
25
|
+
userId: userId,
|
|
26
|
+
eventList: events.map(function (event) { return ({
|
|
27
|
+
eventId: event.event.eventId,
|
|
28
|
+
eventType: event.event.eventType,
|
|
29
|
+
properties: JSON.stringify(event.event.properties),
|
|
30
|
+
sentAt: new Date(event.timestamp),
|
|
31
|
+
}); }),
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var submitEvents = function (events, client) { return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
35
|
+
var groupedByIds, requests;
|
|
36
|
+
return tslib_1.__generator(this, function (_a) {
|
|
37
|
+
switch (_a.label) {
|
|
38
|
+
case 0:
|
|
39
|
+
groupedByIds = Object.entries((0, utils_1.groupBy)(function (event) {
|
|
40
|
+
return [event.trackingId, event.sessionId, event.userId]
|
|
41
|
+
.filter(function (id) { return !!id; })
|
|
42
|
+
.join(DELIMITER);
|
|
43
|
+
}, events));
|
|
44
|
+
requests = groupedByIds
|
|
45
|
+
.map(function (_a) {
|
|
46
|
+
var _b = tslib_1.__read(_a, 2), ids = _b[0], events = _b[1];
|
|
47
|
+
return createPutEventsCommand(ids, events);
|
|
48
|
+
})
|
|
49
|
+
.map(function (command) { return client.send(command); });
|
|
50
|
+
return [4 /*yield*/, Promise.allSettled(requests)];
|
|
51
|
+
case 1:
|
|
52
|
+
_a.sent();
|
|
53
|
+
return [2 /*return*/, Promise.resolve([])];
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}); };
|
|
57
|
+
var getEventBuffer = function (_a) {
|
|
58
|
+
var e_1, _b;
|
|
59
|
+
var region = _a.region, flushSize = _a.flushSize, flushInterval = _a.flushInterval, bufferSize = _a.bufferSize, credentials = _a.credentials, identityId = _a.identityId, userAgentValue = _a.userAgentValue;
|
|
60
|
+
var sessionToken = credentials.sessionToken;
|
|
61
|
+
var sessionIdentityKey = [region, sessionToken, identityId]
|
|
62
|
+
.filter(function (x) { return !!x; })
|
|
63
|
+
.join('-');
|
|
64
|
+
if (!eventBufferMap[sessionIdentityKey]) {
|
|
65
|
+
var getClient = function () {
|
|
66
|
+
if (!cachedClients[sessionIdentityKey]) {
|
|
67
|
+
cachedClients[sessionIdentityKey] = new client_personalize_events_1.PersonalizeEventsClient({
|
|
68
|
+
region: region,
|
|
69
|
+
credentials: credentials,
|
|
70
|
+
customUserAgent: userAgentValue,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return function (events) { return submitEvents(events, cachedClients[sessionIdentityKey]); };
|
|
74
|
+
};
|
|
75
|
+
eventBufferMap[sessionIdentityKey] =
|
|
76
|
+
new utils_1.EventBuffer({
|
|
77
|
+
bufferSize: bufferSize,
|
|
78
|
+
flushSize: flushSize,
|
|
79
|
+
flushInterval: flushInterval,
|
|
80
|
+
}, getClient);
|
|
81
|
+
var releaseSessionKeys = Object.keys(eventBufferMap).filter(function (key) { return key !== sessionIdentityKey; });
|
|
82
|
+
try {
|
|
83
|
+
for (var releaseSessionKeys_1 = tslib_1.__values(releaseSessionKeys), releaseSessionKeys_1_1 = releaseSessionKeys_1.next(); !releaseSessionKeys_1_1.done; releaseSessionKeys_1_1 = releaseSessionKeys_1.next()) {
|
|
84
|
+
var releaseSessionKey = releaseSessionKeys_1_1.value;
|
|
85
|
+
eventBufferMap[releaseSessionKey].release();
|
|
86
|
+
delete eventBufferMap[releaseSessionKey];
|
|
87
|
+
delete cachedClients[releaseSessionKey];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
91
|
+
finally {
|
|
92
|
+
try {
|
|
93
|
+
if (releaseSessionKeys_1_1 && !releaseSessionKeys_1_1.done && (_b = releaseSessionKeys_1.return)) _b.call(releaseSessionKeys_1);
|
|
94
|
+
}
|
|
95
|
+
finally { if (e_1) throw e_1.error; }
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return eventBufferMap[sessionIdentityKey];
|
|
99
|
+
};
|
|
100
|
+
exports.getEventBuffer = getEventBuffer;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { getEventBuffer } from './getEventBuffer';
|
|
2
|
+
export { resolveConfig } from './resolveConfig';
|
|
3
|
+
export { autoTrackMedia } from './autoTrackMedia';
|
|
4
|
+
export { resolveCachedSession, updateCachedSession } from './cachedSession';
|
|
5
|
+
export { DEFAULT_PERSONALIZE_CONFIG, PERSONALIZE_FLUSH_SIZE_MAX, } from './constants';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.PERSONALIZE_FLUSH_SIZE_MAX = exports.DEFAULT_PERSONALIZE_CONFIG = exports.updateCachedSession = exports.resolveCachedSession = exports.autoTrackMedia = exports.resolveConfig = exports.getEventBuffer = void 0;
|
|
6
|
+
var getEventBuffer_1 = require("./getEventBuffer");
|
|
7
|
+
Object.defineProperty(exports, "getEventBuffer", { enumerable: true, get: function () { return getEventBuffer_1.getEventBuffer; } });
|
|
8
|
+
var resolveConfig_1 = require("./resolveConfig");
|
|
9
|
+
Object.defineProperty(exports, "resolveConfig", { enumerable: true, get: function () { return resolveConfig_1.resolveConfig; } });
|
|
10
|
+
var autoTrackMedia_1 = require("./autoTrackMedia");
|
|
11
|
+
Object.defineProperty(exports, "autoTrackMedia", { enumerable: true, get: function () { return autoTrackMedia_1.autoTrackMedia; } });
|
|
12
|
+
var cachedSession_1 = require("./cachedSession");
|
|
13
|
+
Object.defineProperty(exports, "resolveCachedSession", { enumerable: true, get: function () { return cachedSession_1.resolveCachedSession; } });
|
|
14
|
+
Object.defineProperty(exports, "updateCachedSession", { enumerable: true, get: function () { return cachedSession_1.updateCachedSession; } });
|
|
15
|
+
var constants_1 = require("./constants");
|
|
16
|
+
Object.defineProperty(exports, "DEFAULT_PERSONALIZE_CONFIG", { enumerable: true, get: function () { return constants_1.DEFAULT_PERSONALIZE_CONFIG; } });
|
|
17
|
+
Object.defineProperty(exports, "PERSONALIZE_FLUSH_SIZE_MAX", { enumerable: true, get: function () { return constants_1.PERSONALIZE_FLUSH_SIZE_MAX; } });
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.resolveConfig = void 0;
|
|
6
|
+
var tslib_1 = require("tslib");
|
|
7
|
+
var core_1 = require("@aws-amplify/core");
|
|
8
|
+
var errors_1 = require("../../../errors");
|
|
9
|
+
var _1 = require("./");
|
|
10
|
+
var resolveConfig = function () {
|
|
11
|
+
var _a;
|
|
12
|
+
var config = (_a = core_1.Amplify.getConfig().Analytics) === null || _a === void 0 ? void 0 : _a.Personalize;
|
|
13
|
+
var _b = tslib_1.__assign(tslib_1.__assign({}, _1.DEFAULT_PERSONALIZE_CONFIG), config), region = _b.region, trackingId = _b.trackingId, _c = _b.flushSize, flushSize = _c === void 0 ? _1.DEFAULT_PERSONALIZE_CONFIG.flushSize : _c, _d = _b.flushInterval, flushInterval = _d === void 0 ? _1.DEFAULT_PERSONALIZE_CONFIG.flushInterval : _d;
|
|
14
|
+
(0, errors_1.assertValidationError)(!!region, errors_1.AnalyticsValidationErrorCode.NoRegion);
|
|
15
|
+
(0, errors_1.assertValidationError)(!!trackingId, errors_1.AnalyticsValidationErrorCode.NoTrackingId);
|
|
16
|
+
(0, errors_1.assertValidationError)(flushSize <= _1.PERSONALIZE_FLUSH_SIZE_MAX, errors_1.AnalyticsValidationErrorCode.InvalidFlushSize, "FlushSize for Personalize should be less or equal than ".concat(_1.PERSONALIZE_FLUSH_SIZE_MAX));
|
|
17
|
+
return {
|
|
18
|
+
region: region,
|
|
19
|
+
trackingId: trackingId,
|
|
20
|
+
bufferSize: flushSize + 1,
|
|
21
|
+
flushSize: flushSize,
|
|
22
|
+
flushInterval: flushInterval,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
exports.resolveConfig = resolveConfig;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ConfigureAutoTrackInput } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Configures automatic event tracking for Pinpoint. This API will automatically transmit an analytic event when
|
|
4
|
+
* configured events are detected within your application. This can include: DOM element events (via the `event`
|
|
5
|
+
* tracker), session events (via the `session` tracker), and page view events (via the `pageView` tracker).
|
|
6
|
+
*
|
|
7
|
+
* @remark Only session tracking is currently supported on React Native.
|
|
8
|
+
*
|
|
9
|
+
* @param {ConfigureAutoTrackInput} params The input object to configure auto track behavior.
|
|
10
|
+
*
|
|
11
|
+
* @throws service: {@link UpdateEndpointException} - Thrown when the underlying Pinpoint service returns an error.
|
|
12
|
+
* @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library
|
|
13
|
+
* configuration is incorrect.
|
|
14
|
+
*/
|
|
15
|
+
export declare const configureAutoTrack: (input: ConfigureAutoTrackInput) => void;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.configureAutoTrack = void 0;
|
|
6
|
+
var utils_1 = require("../../../utils");
|
|
7
|
+
var record_1 = require("./record");
|
|
8
|
+
// Configured Tracker instances for Pinpoint
|
|
9
|
+
var configuredTrackers = {};
|
|
10
|
+
// Callback that will emit an appropriate event to Pinpoint when required by the Tracker
|
|
11
|
+
var emitTrackingEvent = function (eventName, attributes) {
|
|
12
|
+
(0, record_1.record)({
|
|
13
|
+
name: eventName,
|
|
14
|
+
attributes: attributes,
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Configures automatic event tracking for Pinpoint. This API will automatically transmit an analytic event when
|
|
19
|
+
* configured events are detected within your application. This can include: DOM element events (via the `event`
|
|
20
|
+
* tracker), session events (via the `session` tracker), and page view events (via the `pageView` tracker).
|
|
21
|
+
*
|
|
22
|
+
* @remark Only session tracking is currently supported on React Native.
|
|
23
|
+
*
|
|
24
|
+
* @param {ConfigureAutoTrackInput} params The input object to configure auto track behavior.
|
|
25
|
+
*
|
|
26
|
+
* @throws service: {@link UpdateEndpointException} - Thrown when the underlying Pinpoint service returns an error.
|
|
27
|
+
* @throws validation: {@link AnalyticsValidationErrorCode} - Thrown when the provided parameters or library
|
|
28
|
+
* configuration is incorrect.
|
|
29
|
+
*/
|
|
30
|
+
var configureAutoTrack = function (input) {
|
|
31
|
+
(0, utils_1.validateTrackerConfiguration)(input);
|
|
32
|
+
// Initialize or update this provider's trackers
|
|
33
|
+
(0, utils_1.updateProviderTrackers)(input, emitTrackingEvent, configuredTrackers);
|
|
34
|
+
};
|
|
35
|
+
exports.configureAutoTrack = configureAutoTrack;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flushes all buffered Pinpoint events to the service.
|
|
3
|
+
*
|
|
4
|
+
* @note
|
|
5
|
+
* This API will make a best-effort attempt to flush events from the buffer. Events recorded immediately after invoking
|
|
6
|
+
* this API may not be included in the flush.
|
|
7
|
+
*/
|
|
8
|
+
export declare const flushEvents: () => void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.flushEvents = void 0;
|
|
6
|
+
var utils_1 = require("../utils");
|
|
7
|
+
var pinpoint_1 = require("@aws-amplify/core/internals/providers/pinpoint");
|
|
8
|
+
var utils_2 = require("@aws-amplify/core/internals/utils");
|
|
9
|
+
var core_1 = require("@aws-amplify/core");
|
|
10
|
+
var utils_3 = require("../../../utils");
|
|
11
|
+
var logger = new core_1.ConsoleLogger('Analytics');
|
|
12
|
+
/**
|
|
13
|
+
* Flushes all buffered Pinpoint events to the service.
|
|
14
|
+
*
|
|
15
|
+
* @note
|
|
16
|
+
* This API will make a best-effort attempt to flush events from the buffer. Events recorded immediately after invoking
|
|
17
|
+
* this API may not be included in the flush.
|
|
18
|
+
*/
|
|
19
|
+
var flushEvents = function () {
|
|
20
|
+
var _a = (0, utils_1.resolveConfig)(), appId = _a.appId, region = _a.region;
|
|
21
|
+
(0, utils_1.resolveCredentials)()
|
|
22
|
+
.then(function (_a) {
|
|
23
|
+
var credentials = _a.credentials, identityId = _a.identityId;
|
|
24
|
+
return (0, pinpoint_1.flushEvents)(appId, region, credentials, identityId, (0, utils_3.getAnalyticsUserAgentString)(utils_2.AnalyticsAction.Record));
|
|
25
|
+
})
|
|
26
|
+
.catch(function (e) { return logger.warn('Failed to flush events', e); });
|
|
27
|
+
};
|
|
28
|
+
exports.flushEvents = flushEvents;
|
|
@@ -19,8 +19,9 @@ import { IdentifyUserInput } from '../types';
|
|
|
19
19
|
* await identifyUser({
|
|
20
20
|
* userId,
|
|
21
21
|
* userProfile: {
|
|
22
|
-
*
|
|
23
|
-
*
|
|
22
|
+
* email: 'userEmail@example.com'
|
|
23
|
+
* customProperties: {
|
|
24
|
+
* phoneNumber: ['555-555-5555'],
|
|
24
25
|
* },
|
|
25
26
|
* }
|
|
26
27
|
* });
|
|
@@ -32,8 +33,9 @@ import { IdentifyUserInput } from '../types';
|
|
|
32
33
|
* await identifyUser({
|
|
33
34
|
* userId,
|
|
34
35
|
* userProfile: {
|
|
35
|
-
*
|
|
36
|
-
*
|
|
36
|
+
* email: 'userEmail@example.com'
|
|
37
|
+
* customProperties: {
|
|
38
|
+
* phoneNumber: ['555-555-5555'],
|
|
37
39
|
* },
|
|
38
40
|
* demographic: {
|
|
39
41
|
* platform: 'ios',
|
|
@@ -42,4 +44,4 @@ import { IdentifyUserInput } from '../types';
|
|
|
42
44
|
* }
|
|
43
45
|
* });
|
|
44
46
|
*/
|
|
45
|
-
export declare const identifyUser: ({ userId, userProfile, }: IdentifyUserInput) => Promise<void>;
|
|
47
|
+
export declare const identifyUser: ({ userId, userProfile, options, }: IdentifyUserInput) => Promise<void>;
|
|
@@ -6,8 +6,8 @@ exports.identifyUser = void 0;
|
|
|
6
6
|
var tslib_1 = require("tslib");
|
|
7
7
|
var utils_1 = require("@aws-amplify/core/internals/utils");
|
|
8
8
|
var pinpoint_1 = require("@aws-amplify/core/internals/providers/pinpoint");
|
|
9
|
-
var
|
|
10
|
-
var
|
|
9
|
+
var utils_2 = require("../../../utils");
|
|
10
|
+
var utils_3 = require("../utils");
|
|
11
11
|
/**
|
|
12
12
|
* Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user
|
|
13
13
|
* profile and activities or actions in your application. Activity can be tracked across devices & platforms by using
|
|
@@ -28,8 +28,9 @@ var utils_2 = require("../utils");
|
|
|
28
28
|
* await identifyUser({
|
|
29
29
|
* userId,
|
|
30
30
|
* userProfile: {
|
|
31
|
-
*
|
|
32
|
-
*
|
|
31
|
+
* email: 'userEmail@example.com'
|
|
32
|
+
* customProperties: {
|
|
33
|
+
* phoneNumber: ['555-555-5555'],
|
|
33
34
|
* },
|
|
34
35
|
* }
|
|
35
36
|
* });
|
|
@@ -41,8 +42,9 @@ var utils_2 = require("../utils");
|
|
|
41
42
|
* await identifyUser({
|
|
42
43
|
* userId,
|
|
43
44
|
* userProfile: {
|
|
44
|
-
*
|
|
45
|
-
*
|
|
45
|
+
* email: 'userEmail@example.com'
|
|
46
|
+
* customProperties: {
|
|
47
|
+
* phoneNumber: ['555-555-5555'],
|
|
46
48
|
* },
|
|
47
49
|
* demographic: {
|
|
48
50
|
* platform: 'ios',
|
|
@@ -52,24 +54,26 @@ var utils_2 = require("../utils");
|
|
|
52
54
|
* });
|
|
53
55
|
*/
|
|
54
56
|
var identifyUser = function (_a) {
|
|
55
|
-
var userId = _a.userId, userProfile = _a.userProfile;
|
|
57
|
+
var userId = _a.userId, userProfile = _a.userProfile, options = _a.options;
|
|
56
58
|
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
57
|
-
var _b, credentials, identityId, _c, appId, region;
|
|
59
|
+
var _b, credentials, identityId, _c, appId, region, userAttributes;
|
|
58
60
|
return tslib_1.__generator(this, function (_d) {
|
|
59
61
|
switch (_d.label) {
|
|
60
|
-
case 0: return [4 /*yield*/, (0,
|
|
62
|
+
case 0: return [4 /*yield*/, (0, utils_3.resolveCredentials)()];
|
|
61
63
|
case 1:
|
|
62
64
|
_b = _d.sent(), credentials = _b.credentials, identityId = _b.identityId;
|
|
63
|
-
_c = (0,
|
|
65
|
+
_c = (0, utils_3.resolveConfig)(), appId = _c.appId, region = _c.region;
|
|
66
|
+
userAttributes = (options !== null && options !== void 0 ? options : {}).userAttributes;
|
|
64
67
|
(0, pinpoint_1.updateEndpoint)({
|
|
65
68
|
appId: appId,
|
|
66
69
|
category: 'Analytics',
|
|
67
70
|
credentials: credentials,
|
|
68
71
|
identityId: identityId,
|
|
69
72
|
region: region,
|
|
73
|
+
userAttributes: userAttributes,
|
|
70
74
|
userId: userId,
|
|
71
75
|
userProfile: userProfile,
|
|
72
|
-
userAgentValue: (0,
|
|
76
|
+
userAgentValue: (0, utils_2.getAnalyticsUserAgentString)(utils_1.AnalyticsAction.IdentifyUser),
|
|
73
77
|
});
|
|
74
78
|
return [2 /*return*/];
|
|
75
79
|
}
|
|
@@ -2,8 +2,12 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.identifyUser = exports.record = void 0;
|
|
5
|
+
exports.flushEvents = exports.configureAutoTrack = exports.identifyUser = exports.record = void 0;
|
|
6
6
|
var record_1 = require("./record");
|
|
7
7
|
Object.defineProperty(exports, "record", { enumerable: true, get: function () { return record_1.record; } });
|
|
8
8
|
var identifyUser_1 = require("./identifyUser");
|
|
9
9
|
Object.defineProperty(exports, "identifyUser", { enumerable: true, get: function () { return identifyUser_1.identifyUser; } });
|
|
10
|
+
var configureAutoTrack_1 = require("./configureAutoTrack");
|
|
11
|
+
Object.defineProperty(exports, "configureAutoTrack", { enumerable: true, get: function () { return configureAutoTrack_1.configureAutoTrack; } });
|
|
12
|
+
var flushEvents_1 = require("./flushEvents");
|
|
13
|
+
Object.defineProperty(exports, "flushEvents", { enumerable: true, get: function () { return flushEvents_1.flushEvents; } });
|