@aws-amplify/notifications 2.0.1-console-preview.a1c533e.0 → 2.0.1-console-preview.23dc225.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.
Files changed (190) hide show
  1. package/lib/common/AWSPinpointProviderCommon/index.d.ts +0 -1
  2. package/lib/common/AWSPinpointProviderCommon/index.js +14 -19
  3. package/lib/common/AWSPinpointProviderCommon/index.js.map +1 -1
  4. package/lib/common/eventListeners/index.d.ts +2 -2
  5. package/lib/common/eventListeners/index.js +3 -1
  6. package/lib/common/eventListeners/index.js.map +1 -1
  7. package/lib/common/eventListeners/types.d.ts +3 -0
  8. package/lib/common/index.d.ts +1 -1
  9. package/lib/inAppMessaging/errors/validation.d.ts +2 -1
  10. package/lib/inAppMessaging/errors/validation.js +5 -0
  11. package/lib/inAppMessaging/errors/validation.js.map +1 -1
  12. package/lib/inAppMessaging/index.d.ts +1 -1
  13. package/lib/inAppMessaging/index.js +8 -0
  14. package/lib/inAppMessaging/index.js.map +1 -1
  15. package/lib/inAppMessaging/providers/index.d.ts +1 -1
  16. package/lib/inAppMessaging/providers/index.js +8 -0
  17. package/lib/inAppMessaging/providers/index.js.map +1 -1
  18. package/lib/inAppMessaging/providers/pinpoint/apis/dispatchEvent.d.ts +26 -0
  19. package/lib/inAppMessaging/providers/pinpoint/apis/dispatchEvent.js +69 -0
  20. package/lib/inAppMessaging/providers/pinpoint/apis/dispatchEvent.js.map +1 -0
  21. package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.d.ts +1 -4
  22. package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.js +5 -5
  23. package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.js.map +1 -1
  24. package/lib/inAppMessaging/providers/pinpoint/apis/index.d.ts +8 -0
  25. package/lib/inAppMessaging/providers/pinpoint/apis/index.js +16 -0
  26. package/lib/inAppMessaging/providers/pinpoint/apis/index.js.map +1 -1
  27. package/lib/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.d.ts +12 -0
  28. package/lib/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js +61 -0
  29. package/lib/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js.map +1 -0
  30. package/lib/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.d.ts +16 -0
  31. package/lib/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js +27 -0
  32. package/lib/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js.map +1 -0
  33. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.d.ts +18 -0
  34. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.js +27 -0
  35. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.js.map +1 -0
  36. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.d.ts +18 -0
  37. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.js +27 -0
  38. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.js.map +1 -0
  39. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.d.ts +18 -0
  40. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.js +27 -0
  41. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.js.map +1 -0
  42. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageReceived.d.ts +18 -0
  43. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageReceived.js +27 -0
  44. package/lib/inAppMessaging/providers/pinpoint/apis/onMessageReceived.js.map +1 -0
  45. package/lib/inAppMessaging/providers/pinpoint/apis/setConflictHandler.d.ts +32 -0
  46. package/lib/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js +66 -0
  47. package/lib/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js.map +1 -0
  48. package/lib/inAppMessaging/providers/pinpoint/apis/syncMessages.d.ts +1 -3
  49. package/lib/inAppMessaging/providers/pinpoint/apis/syncMessages.js +20 -18
  50. package/lib/inAppMessaging/providers/pinpoint/apis/syncMessages.js.map +1 -1
  51. package/lib/inAppMessaging/providers/pinpoint/index.d.ts +1 -1
  52. package/lib/inAppMessaging/providers/pinpoint/index.js +8 -0
  53. package/lib/inAppMessaging/providers/pinpoint/index.js.map +1 -1
  54. package/lib/inAppMessaging/providers/pinpoint/types/index.d.ts +2 -1
  55. package/lib/inAppMessaging/providers/pinpoint/types/index.js +2 -0
  56. package/lib/inAppMessaging/providers/pinpoint/types/index.js.map +1 -1
  57. package/lib/inAppMessaging/providers/pinpoint/types/inputs.d.ts +33 -2
  58. package/lib/inAppMessaging/providers/pinpoint/types/outputs.d.ts +17 -0
  59. package/lib/inAppMessaging/providers/pinpoint/types/outputs.js +5 -0
  60. package/lib/inAppMessaging/providers/pinpoint/types/outputs.js.map +1 -0
  61. package/lib/inAppMessaging/providers/pinpoint/types/types.d.ts +4 -1
  62. package/lib/inAppMessaging/providers/pinpoint/types/types.js +6 -6
  63. package/lib/inAppMessaging/providers/pinpoint/types/types.js.map +1 -1
  64. package/lib/inAppMessaging/providers/pinpoint/utils/helpers.d.ts +17 -0
  65. package/lib/inAppMessaging/providers/pinpoint/utils/helpers.js +260 -0
  66. package/lib/inAppMessaging/providers/pinpoint/utils/helpers.js.map +1 -0
  67. package/lib/inAppMessaging/providers/pinpoint/utils/index.d.ts +1 -0
  68. package/lib/inAppMessaging/providers/pinpoint/utils/index.js +4 -0
  69. package/lib/inAppMessaging/providers/pinpoint/utils/index.js.map +1 -1
  70. package/lib/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.d.ts +6 -0
  71. package/lib/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js +247 -0
  72. package/lib/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js.map +1 -0
  73. package/lib/inAppMessaging/providers/pinpoint/utils/resolveCredentials.d.ts +1 -6
  74. package/lib/inAppMessaging/types/index.d.ts +1 -1
  75. package/lib/inAppMessaging/utils/index.d.ts +1 -0
  76. package/lib/inAppMessaging/utils/index.js +9 -0
  77. package/lib/inAppMessaging/utils/index.js.map +1 -0
  78. package/lib/inAppMessaging/utils/statusHelpers.d.ts +13 -0
  79. package/lib/inAppMessaging/utils/statusHelpers.js +25 -0
  80. package/lib/inAppMessaging/utils/statusHelpers.js.map +1 -0
  81. package/lib-esm/common/AWSPinpointProviderCommon/index.d.ts +0 -1
  82. package/lib-esm/common/AWSPinpointProviderCommon/index.js +15 -20
  83. package/lib-esm/common/AWSPinpointProviderCommon/index.js.map +1 -1
  84. package/lib-esm/common/eventListeners/index.d.ts +2 -2
  85. package/lib-esm/common/eventListeners/index.js +3 -1
  86. package/lib-esm/common/eventListeners/index.js.map +1 -1
  87. package/lib-esm/common/eventListeners/types.d.ts +3 -0
  88. package/lib-esm/common/index.d.ts +1 -1
  89. package/lib-esm/inAppMessaging/errors/validation.d.ts +2 -1
  90. package/lib-esm/inAppMessaging/errors/validation.js +5 -0
  91. package/lib-esm/inAppMessaging/errors/validation.js.map +1 -1
  92. package/lib-esm/inAppMessaging/index.d.ts +1 -1
  93. package/lib-esm/inAppMessaging/index.js +1 -1
  94. package/lib-esm/inAppMessaging/index.js.map +1 -1
  95. package/lib-esm/inAppMessaging/providers/index.d.ts +1 -1
  96. package/lib-esm/inAppMessaging/providers/index.js +1 -1
  97. package/lib-esm/inAppMessaging/providers/index.js.map +1 -1
  98. package/lib-esm/inAppMessaging/providers/pinpoint/apis/dispatchEvent.d.ts +26 -0
  99. package/lib-esm/inAppMessaging/providers/pinpoint/apis/dispatchEvent.js +66 -0
  100. package/lib-esm/inAppMessaging/providers/pinpoint/apis/dispatchEvent.js.map +1 -0
  101. package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.d.ts +1 -4
  102. package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.js +5 -5
  103. package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.js.map +1 -1
  104. package/lib-esm/inAppMessaging/providers/pinpoint/apis/index.d.ts +8 -0
  105. package/lib-esm/inAppMessaging/providers/pinpoint/apis/index.js +8 -0
  106. package/lib-esm/inAppMessaging/providers/pinpoint/apis/index.js.map +1 -1
  107. package/lib-esm/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.d.ts +12 -0
  108. package/lib-esm/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js +57 -0
  109. package/lib-esm/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js.map +1 -0
  110. package/lib-esm/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.d.ts +16 -0
  111. package/lib-esm/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js +24 -0
  112. package/lib-esm/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js.map +1 -0
  113. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.d.ts +18 -0
  114. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.js +24 -0
  115. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.js.map +1 -0
  116. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.d.ts +18 -0
  117. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.js +24 -0
  118. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.js.map +1 -0
  119. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.d.ts +18 -0
  120. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.js +24 -0
  121. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.js.map +1 -0
  122. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageReceived.d.ts +18 -0
  123. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageReceived.js +24 -0
  124. package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageReceived.js.map +1 -0
  125. package/lib-esm/inAppMessaging/providers/pinpoint/apis/setConflictHandler.d.ts +32 -0
  126. package/lib-esm/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js +63 -0
  127. package/lib-esm/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js.map +1 -0
  128. package/lib-esm/inAppMessaging/providers/pinpoint/apis/syncMessages.d.ts +1 -3
  129. package/lib-esm/inAppMessaging/providers/pinpoint/apis/syncMessages.js +20 -18
  130. package/lib-esm/inAppMessaging/providers/pinpoint/apis/syncMessages.js.map +1 -1
  131. package/lib-esm/inAppMessaging/providers/pinpoint/index.d.ts +1 -1
  132. package/lib-esm/inAppMessaging/providers/pinpoint/index.js +1 -1
  133. package/lib-esm/inAppMessaging/providers/pinpoint/index.js.map +1 -1
  134. package/lib-esm/inAppMessaging/providers/pinpoint/types/index.d.ts +2 -1
  135. package/lib-esm/inAppMessaging/providers/pinpoint/types/index.js +1 -0
  136. package/lib-esm/inAppMessaging/providers/pinpoint/types/index.js.map +1 -1
  137. package/lib-esm/inAppMessaging/providers/pinpoint/types/inputs.d.ts +33 -2
  138. package/lib-esm/inAppMessaging/providers/pinpoint/types/outputs.d.ts +17 -0
  139. package/lib-esm/inAppMessaging/providers/pinpoint/types/outputs.js +3 -0
  140. package/lib-esm/inAppMessaging/providers/pinpoint/types/outputs.js.map +1 -0
  141. package/lib-esm/inAppMessaging/providers/pinpoint/types/types.d.ts +4 -1
  142. package/lib-esm/inAppMessaging/providers/pinpoint/types/types.js +6 -6
  143. package/lib-esm/inAppMessaging/providers/pinpoint/types/types.js.map +1 -1
  144. package/lib-esm/inAppMessaging/providers/pinpoint/utils/helpers.d.ts +17 -0
  145. package/lib-esm/inAppMessaging/providers/pinpoint/utils/helpers.js +258 -0
  146. package/lib-esm/inAppMessaging/providers/pinpoint/utils/helpers.js.map +1 -0
  147. package/lib-esm/inAppMessaging/providers/pinpoint/utils/index.d.ts +1 -0
  148. package/lib-esm/inAppMessaging/providers/pinpoint/utils/index.js +1 -0
  149. package/lib-esm/inAppMessaging/providers/pinpoint/utils/index.js.map +1 -1
  150. package/lib-esm/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.d.ts +6 -0
  151. package/lib-esm/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js +242 -0
  152. package/lib-esm/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js.map +1 -0
  153. package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveCredentials.d.ts +1 -6
  154. package/lib-esm/inAppMessaging/types/index.d.ts +1 -1
  155. package/lib-esm/inAppMessaging/utils/index.d.ts +1 -0
  156. package/lib-esm/inAppMessaging/utils/index.js +4 -0
  157. package/lib-esm/inAppMessaging/utils/index.js.map +1 -0
  158. package/lib-esm/inAppMessaging/utils/statusHelpers.d.ts +13 -0
  159. package/lib-esm/inAppMessaging/utils/statusHelpers.js +22 -0
  160. package/lib-esm/inAppMessaging/utils/statusHelpers.js.map +1 -0
  161. package/package.json +5 -6
  162. package/src/common/AWSPinpointProviderCommon/index.ts +9 -14
  163. package/src/common/eventListeners/index.ts +5 -3
  164. package/src/common/eventListeners/types.ts +4 -0
  165. package/src/common/index.ts +5 -1
  166. package/src/inAppMessaging/errors/validation.ts +6 -0
  167. package/src/inAppMessaging/index.ts +12 -1
  168. package/src/inAppMessaging/providers/index.ts +12 -1
  169. package/src/inAppMessaging/providers/pinpoint/apis/dispatchEvent.ts +63 -0
  170. package/src/inAppMessaging/providers/pinpoint/apis/identifyUser.ts +3 -4
  171. package/src/inAppMessaging/providers/pinpoint/apis/index.ts +8 -0
  172. package/src/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.ts +64 -0
  173. package/src/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.ts +28 -0
  174. package/src/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.ts +29 -0
  175. package/src/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.ts +29 -0
  176. package/src/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.ts +29 -0
  177. package/src/inAppMessaging/providers/pinpoint/apis/onMessageReceived.ts +29 -0
  178. package/src/inAppMessaging/providers/pinpoint/apis/setConflictHandler.ts +68 -0
  179. package/src/inAppMessaging/providers/pinpoint/apis/syncMessages.ts +6 -5
  180. package/src/inAppMessaging/providers/pinpoint/index.ts +12 -1
  181. package/src/inAppMessaging/providers/pinpoint/types/index.ts +14 -1
  182. package/src/inAppMessaging/providers/pinpoint/types/inputs.ts +49 -2
  183. package/src/inAppMessaging/providers/pinpoint/types/outputs.ts +24 -0
  184. package/src/inAppMessaging/providers/pinpoint/types/types.ts +9 -1
  185. package/src/inAppMessaging/providers/pinpoint/utils/helpers.ts +325 -0
  186. package/src/inAppMessaging/providers/pinpoint/utils/index.ts +6 -0
  187. package/src/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.ts +196 -0
  188. package/src/inAppMessaging/types/index.ts +7 -1
  189. package/src/inAppMessaging/utils/index.ts +8 -0
  190. package/src/inAppMessaging/utils/statusHelpers.ts +32 -0
@@ -1,14 +1,12 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { __assign, __awaiter, __generator } from "tslib";
4
- import { Category, ClientDevice, getAmplifyUserAgent, InAppMessagingAction, PushNotificationAction, } from '@aws-amplify/core/internals/utils';
4
+ import { Category, getAmplifyUserAgent, InAppMessagingAction, PushNotificationAction, amplifyUuid, } from '@aws-amplify/core/internals/utils';
5
5
  import { Cache, fetchAuthSession } from '@aws-amplify/core';
6
6
  import { putEvents, updateEndpoint, } from '@aws-amplify/core/internals/aws-clients/pinpoint';
7
- import { v4 as uuid } from 'uuid';
8
7
  var AWSPinpointProviderCommon = /** @class */ (function () {
9
8
  function AWSPinpointProviderCommon(logger) {
10
9
  var _this = this;
11
- var _a;
12
10
  this.config = {};
13
11
  this.endpointInitialized = false;
14
12
  this.initialized = false;
@@ -110,7 +108,7 @@ var AWSPinpointProviderCommon = /** @class */ (function () {
110
108
  _c[endpointId] = {
111
109
  Endpoint: {},
112
110
  Events: (_d = {},
113
- _d[uuid()] = event,
111
+ _d[amplifyUuid()] = event,
114
112
  _d),
115
113
  },
116
114
  _c),
@@ -133,14 +131,14 @@ var AWSPinpointProviderCommon = /** @class */ (function () {
133
131
  if (userId === void 0) { userId = null; }
134
132
  if (userInfo === void 0) { userInfo = null; }
135
133
  return __awaiter(_this, void 0, void 0, function () {
136
- var credentials, credentialsUpdated, _a, appId, endpointId, _b, endpointInfo, region, _c, address, attributes, demographic, location_1, metrics, optOut, _d, appVersion, make, model, platform, version, input, err_4;
134
+ var credentials, credentialsUpdated, _a, appId, endpointId, _b, endpointInfo, region, _c, address, attributes, demographic, location_1, metrics, optOut, input, err_4;
137
135
  var _this = this;
138
- var _e;
139
- return __generator(this, function (_f) {
140
- switch (_f.label) {
136
+ var _d;
137
+ return __generator(this, function (_e) {
138
+ switch (_e.label) {
141
139
  case 0: return [4 /*yield*/, this.getCredentials()];
142
140
  case 1:
143
- credentials = _f.sent();
141
+ credentials = _e.sent();
144
142
  credentialsUpdated = !this.config.credentials ||
145
143
  Object.keys(credentials).some(function (key) { return credentials[key] !== _this.config.credentials[key]; });
146
144
  // If endpoint is already initialized, and nothing else is changing, just early return
@@ -155,26 +153,25 @@ var AWSPinpointProviderCommon = /** @class */ (function () {
155
153
  // Assert required configuration properties to make `updateEndpoint` request are present
156
154
  this.assertNotEmptyConfiguration();
157
155
  _a = this.config, appId = _a.appId, endpointId = _a.endpointId, _b = _a.endpointInfo, endpointInfo = _b === void 0 ? {} : _b, region = _a.region;
158
- _f.label = 2;
156
+ _e.label = 2;
159
157
  case 2:
160
- _f.trys.push([2, 4, , 5]);
158
+ _e.trys.push([2, 4, , 5]);
161
159
  _c = userInfo !== null && userInfo !== void 0 ? userInfo : {}, address = _c.address, attributes = _c.attributes, demographic = _c.demographic, location_1 = _c.location, metrics = _c.metrics, optOut = _c.optOut;
162
- _d = this.clientInfo, appVersion = _d.appVersion, make = _d.make, model = _d.model, platform = _d.platform, version = _d.version;
163
160
  input = {
164
161
  ApplicationId: appId,
165
162
  EndpointId: endpointId,
166
163
  EndpointRequest: {
167
- RequestId: uuid(),
164
+ RequestId: amplifyUuid(),
168
165
  EffectiveDate: new Date().toISOString(),
169
166
  ChannelType: endpointInfo.channelType,
170
167
  Address: address !== null && address !== void 0 ? address : endpointInfo.address,
171
168
  Attributes: __assign(__assign({}, endpointInfo.attributes), attributes),
172
- Demographic: __assign({ AppVersion: appVersion, Make: make, Model: model, ModelVersion: version, Platform: platform }, this.transferKeyToUpperCase(__assign(__assign({}, endpointInfo.demographic), demographic))),
169
+ Demographic: __assign({ AppVersion: null, Make: null, Model: null, ModelVersion: null, Platform: null }, this.transferKeyToUpperCase(__assign(__assign({}, endpointInfo.demographic), demographic))),
173
170
  Location: this.transferKeyToUpperCase(__assign(__assign({}, endpointInfo.location), location_1)),
174
171
  Metrics: __assign(__assign({}, endpointInfo.metrics), metrics),
175
172
  OptOut: optOut !== null && optOut !== void 0 ? optOut : endpointInfo.optOut,
176
173
  User: {
177
- UserId: (_e = userId !== null && userId !== void 0 ? userId : endpointInfo.userId) !== null && _e !== void 0 ? _e : credentials.identityId,
174
+ UserId: (_d = userId !== null && userId !== void 0 ? userId : endpointInfo.userId) !== null && _d !== void 0 ? _d : credentials.identityId,
178
175
  UserAttributes: attributes !== null && attributes !== void 0 ? attributes : endpointInfo.userAttributes,
179
176
  },
180
177
  },
@@ -182,11 +179,11 @@ var AWSPinpointProviderCommon = /** @class */ (function () {
182
179
  this.logger.debug('updating endpoint');
183
180
  return [4 /*yield*/, updateEndpoint({ credentials: credentials, region: region, userAgentValue: this.getUserAgentValue() }, input)];
184
181
  case 3:
185
- _f.sent();
182
+ _e.sent();
186
183
  this.endpointInitialized = true;
187
184
  return [3 /*break*/, 5];
188
185
  case 4:
189
- err_4 = _f.sent();
186
+ err_4 = _e.sent();
190
187
  throw err_4;
191
188
  case 5: return [2 /*return*/];
192
189
  }
@@ -209,7 +206,7 @@ var AWSPinpointProviderCommon = /** @class */ (function () {
209
206
  if (cachedEndpointId) {
210
207
  return [2 /*return*/, cachedEndpointId];
211
208
  }
212
- endpointId = uuid();
209
+ endpointId = amplifyUuid();
213
210
  ttl = 1000 * 60 * 60 * 24 * 365 * 100;
214
211
  expiration = new Date().getTime() + ttl;
215
212
  Cache.setItem(cacheKey, endpointId, {
@@ -262,8 +259,6 @@ var AWSPinpointProviderCommon = /** @class */ (function () {
262
259
  }
263
260
  return ret;
264
261
  };
265
- // this.config = { storage: new StorageHelper().getStorage() };
266
- this.clientInfo = (_a = ClientDevice.clientInfo()) !== null && _a !== void 0 ? _a : {};
267
262
  this.logger = logger;
268
263
  }
269
264
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/AWSPinpointProviderCommon/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,EACN,QAAQ,EACR,YAAY,EAGZ,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,GACtB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAEN,SAAS,EAET,cAAc,GAEd,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAUlC;IAYC,mCAAY,MAAM;QAAlB,iBAIC;;QATS,WAAM,GAAwB,EAAE,CAAC;QACjC,wBAAmB,GAAG,KAAK,CAAC;QAC5B,gBAAW,GAAG,KAAK,CAAC;QAqC9B,iBAAY,GAAG,UAAO,MAAc,EAAE,QAAkB;;;;;6BACnD,CAAC,IAAI,CAAC,WAAW,EAAjB,wBAAiB;wBACpB,qBAAM,IAAI,CAAC,IAAI,EAAE,EAAA;;wBAAjB,SAAiB,CAAC;;;;wBAGlB,qBAAM,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAA;;wBAA3C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C;IAClD,sCAAY,GAAG,aAAa,CAAC;IAyQrC,gCAAC;CAAA,AA7QD,IA6QC;eA7Q6B,yBAAyB"}
@@ -1,4 +1,4 @@
1
- import { EventListener, EventType } from './types';
1
+ import { EventListenerRemover, EventType } from './types';
2
2
  export declare const notifyEventListeners: (type: EventType, ...args: any[]) => void;
3
3
  export declare const notifyEventListenersAndAwaitHandlers: (type: EventType, ...args: any[]) => Promise<void[]>;
4
- export declare const addEventListener: <EventHandler extends Function>(type: EventType, handler: EventHandler) => EventListener<EventHandler>;
4
+ export declare const addEventListener: <EventHandler extends Function>(type: EventType, handler: EventHandler) => EventListenerRemover;
@@ -48,6 +48,8 @@ export var addEventListener = function (type, handler) {
48
48
  },
49
49
  };
50
50
  eventListeners[type].add(listener);
51
- return listener;
51
+ return {
52
+ remove: function () { return listener.remove(); },
53
+ };
52
54
  };
53
55
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/common/eventListeners/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAItC,IAAM,cAAc,GAAiD,EAAE,CAAC;AAExE,MAAM,CAAC,IAAM,oBAAoB,GAAG,UAAC,IAAe;IAAE,cAAc;SAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;QAAd,6BAAc;;;IACnE,MAAA,cAAc,CAAC,IAAI,CAAC,0CAAE,OAAO,CAAC,UAAA,QAAQ;QACrC,QAAQ,CAAC,WAAW,OAApB,QAAQ,WAAgB,IAAI,GAAE;IAC/B,CAAC,EAAE;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,IAAM,oCAAoC,GAAG,UACnD,IAAe;IACf,cAAc;SAAd,UAAc,EAAd,qBAAc,EAAd,IAAc;QAAd,6BAAc;;;IAEd,OAAA,OAAO,CAAC,GAAG,CACV,KAAK,CAAC,IAAI,OAAC,cAAc,CAAC,IAAI,CAAC,mCAAI,EAAE,CAAC,CAAC,GAAG,CAAC,UA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cAAc,CAAC,IAAI,CAAC,mCAAI,EAAE,CAAC,CAAC,GAAG,CAAC,UAAM,QAAQ;;;;;;oBAEvD,qBAAM,QAAQ,CAAC,WAAW,OAApB,QAAQ,WAAgB,IAAI,IAAC;;oBAAnC,SAAmC,CAAC;;;;oBAEpC,MAAM,KAAG,CAAC;;;;SAEX,CAAC,CACF,CAAA;CAAA,CAAC;AAEH,MAAM,CAAC,IAAM,gBAAgB,GAAG,UAC/B,IAAe,EACf,OAAqB;IAErB,iEAAiE;IACjE,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE;QAC1B,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,EAA+B,CAAC;KAC9D;IACD,IAAM,QAAQ,GAAG;QAChB,WAAW,EAAE,OAAO;QACpB,MAAM,EAAE;YACP,cAAc,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACvC,CAAC;KACD,CAAC;IACF,cAAc,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACnC,OAAO;QACN,MAAM,EAAE,cAAM,OAAA,QAAQ,CAAC,MAAM,EAAE,EAAjB,CAAiB;KAC/B,CAAC;AACH,CAAC,CAAC"}
@@ -5,3 +5,6 @@ export interface EventListener<EventHandler extends Function> {
5
5
  remove: () => void;
6
6
  }
7
7
  export declare type EventType = InAppMessageInteractionEvent | PushNotificationEvent;
8
+ export declare type EventListenerRemover = {
9
+ remove: () => void;
10
+ };
@@ -1,3 +1,3 @@
1
1
  export { default as AWSPinpointProviderCommon } from './AWSPinpointProviderCommon';
2
2
  export { addEventListener, notifyEventListeners, notifyEventListenersAndAwaitHandlers, } from './eventListeners';
3
- export { EventListener, EventType } from './eventListeners/types';
3
+ export { EventListener, EventType, EventListenerRemover, } from './eventListeners/types';
@@ -3,6 +3,7 @@ export declare enum InAppMessagingValidationErrorCode {
3
3
  NoAppId = "NoAppId",
4
4
  NoCredentials = "NoCredentials",
5
5
  NoRegion = "NoRegion",
6
- NoEndpointId = "NoEndpointId"
6
+ NoEndpointId = "NoEndpointId",
7
+ NotInitialized = "NotInitialized"
7
8
  }
8
9
  export declare const validationErrorMap: AmplifyErrorMap<InAppMessagingValidationErrorCode>;
@@ -7,6 +7,7 @@ export var InAppMessagingValidationErrorCode;
7
7
  InAppMessagingValidationErrorCode["NoCredentials"] = "NoCredentials";
8
8
  InAppMessagingValidationErrorCode["NoRegion"] = "NoRegion";
9
9
  InAppMessagingValidationErrorCode["NoEndpointId"] = "NoEndpointId";
10
+ InAppMessagingValidationErrorCode["NotInitialized"] = "NotInitialized";
10
11
  })(InAppMessagingValidationErrorCode || (InAppMessagingValidationErrorCode = {}));
11
12
  export var validationErrorMap = (_a = {},
12
13
  _a[InAppMessagingValidationErrorCode.NoAppId] = {
@@ -21,5 +22,9 @@ export var validationErrorMap = (_a = {},
21
22
  _a[InAppMessagingValidationErrorCode.NoEndpointId] = {
22
23
  message: 'Could not find or create EndpointId.',
23
24
  },
25
+ _a[InAppMessagingValidationErrorCode.NotInitialized] = {
26
+ message: 'In-app messaging has not been initialized.',
27
+ recoverySuggestion: 'Please make sure to first call `initializePushNotifications`.',
28
+ },
24
29
  _a);
25
30
  //# sourceMappingURL=validation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../src/inAppMessaging/errors/validation.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAItC,MAAM,CAAN,IAAY,iCAKX;AALD,WAAY,iCAAiC;IAC5C,wDAAmB,CAAA;IACnB,oEAA+B,CAAA;IAC/B,0DAAqB,CAAA;IACrB,kEAA6B,CAAA;AAC9B,CAAC,EALW,iCAAiC,KAAjC,iCAAiC,QAK5C;AAED,MAAM,CAAC,IAAM,kBAAkB;IAE7B,GAAC,iCAAiC,CAAC,OAAO,IAAG;QAC5C,OAAO,EAAE,yBAAyB;KAClC;IACD,GAAC,iCAAiC,CAAC,aAAa,IAAG;QAClD,OAAO,EAAE,kCAAkC;KAC3C;IACD,GAAC,iCAAiC,CAAC,QAAQ,IAAG;QAC7C,OAAO,EAAE,iBAAiB;KAC1B;IACD,GAAC,iCAAiC,CAAC,YAAY,IAAG;QACjD,OAAO,EAAE,sCAAsC;KAC/C;OACD,CAAC"}
1
+ {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../src/inAppMessaging/errors/validation.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAItC,MAAM,CAAN,IAAY,iCAMX;AAND,WAAY,iCAAiC;IAC5C,wDAAmB,CAAA;IACnB,oEAA+B,CAAA;IAC/B,0DAAqB,CAAA;IACrB,kEAA6B,CAAA;IAC7B,sEAAiC,CAAA;AAClC,CAAC,EANW,iCAAiC,KAAjC,iCAAiC,QAM5C;AAED,MAAM,CAAC,IAAM,kBAAkB;IAE7B,GAAC,iCAAiC,CAAC,OAAO,IAAG;QAC5C,OAAO,EAAE,yBAAyB;KAClC;IACD,GAAC,iCAAiC,CAAC,aAAa,IAAG;QAClD,OAAO,EAAE,kCAAkC;KAC3C;IACD,GAAC,iCAAiC,CAAC,QAAQ,IAAG;QAC7C,OAAO,EAAE,iBAAiB;KAC1B;IACD,GAAC,iCAAiC,CAAC,YAAY,IAAG;QACjD,OAAO,EAAE,sCAAsC;KAC/C;IACD,GAAC,iCAAiC,CAAC,cAAc,IAAG;QACnD,OAAO,EAAE,4CAA4C;QACrD,kBAAkB,EACjB,+DAA+D;KAChE;OACD,CAAC"}
@@ -1 +1 @@
1
- export { identifyUser, syncMessages } from './providers/pinpoint';
1
+ export { identifyUser, syncMessages, dispatchEvent, setConflictHandler, initializeInAppMessaging, onMessageReceived, onMessageDisplayed, onMessageDismissed, onMessageActionTaken, notifyMessageInteraction, } from './providers/pinpoint';
@@ -1,4 +1,4 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- export { identifyUser, syncMessages } from './providers/pinpoint';
3
+ export { identifyUser, syncMessages, dispatchEvent, setConflictHandler, initializeInAppMessaging, onMessageReceived, onMessageDisplayed, onMessageDismissed, onMessageActionTaken, notifyMessageInteraction, } from './providers/pinpoint';
4
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/inAppMessaging/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/inAppMessaging/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EACN,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,wBAAwB,EACxB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,GACxB,MAAM,sBAAsB,CAAC"}
@@ -1 +1 @@
1
- export { identifyUser, syncMessages } from './pinpoint/apis';
1
+ export { identifyUser, syncMessages, dispatchEvent, setConflictHandler, initializeInAppMessaging, onMessageReceived, onMessageDisplayed, onMessageDismissed, onMessageActionTaken, notifyMessageInteraction, } from './pinpoint/apis';
@@ -1,4 +1,4 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- export { identifyUser, syncMessages } from './pinpoint/apis';
3
+ export { identifyUser, syncMessages, dispatchEvent, setConflictHandler, initializeInAppMessaging, onMessageReceived, onMessageDisplayed, onMessageDismissed, onMessageActionTaken, notifyMessageInteraction, } from './pinpoint/apis';
4
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/inAppMessaging/providers/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/inAppMessaging/providers/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EACN,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,wBAAwB,EACxB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,GACxB,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { DispatchEventInput } from '../types';
2
+ /**
3
+ * Triggers an In-App message to be displayed. Use this after your campaigns have been synced to the device using
4
+ * {@link syncMessages}. Based on the messages synced and the event passed to this API, it triggers the display
5
+ * of the In-App message that meets the criteria.
6
+ *
7
+ * @remark
8
+ * If an event would trigger multiple messages, the message closest to expiry will be chosen by default.
9
+ * To change this behavior, you can use the {@link setConflictHandler} API to provide
10
+ * your own logic for resolving message conflicts.
11
+ *
12
+ * @param DispatchEventInput The input object that holds the event to be dispatched.
13
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library
14
+ * configuration is incorrect, or if In App messaging hasn't been initialized.
15
+ * @throws service exceptions - Thrown when the underlying Pinpoint service returns an error.
16
+ * @returns A promise that will resolve when the operation is complete.
17
+ * @example
18
+ * ```ts
19
+ * // Sync message before disptaching an event
20
+ * await syncMessages();
21
+ *
22
+ * // Dispatch an event
23
+ * await dispatchEvent({ name: 'test_event' });
24
+ * ```
25
+ */
26
+ export declare function dispatchEvent(input: DispatchEventInput): Promise<void>;
@@ -0,0 +1,66 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { __awaiter, __generator } from "tslib";
4
+ import { PINPOINT_KEY_PREFIX, STORAGE_KEY_SUFFIX, processInAppMessages, } from '../utils';
5
+ import flatten from 'lodash/flatten';
6
+ import { defaultStorage } from '@aws-amplify/core';
7
+ import { notifyEventListeners } from '../../../../common';
8
+ import { assertServiceError } from '../../../errors';
9
+ import { conflictHandler } from './setConflictHandler';
10
+ import { assertIsInitialized } from '../../../utils';
11
+ /**
12
+ * Triggers an In-App message to be displayed. Use this after your campaigns have been synced to the device using
13
+ * {@link syncMessages}. Based on the messages synced and the event passed to this API, it triggers the display
14
+ * of the In-App message that meets the criteria.
15
+ *
16
+ * @remark
17
+ * If an event would trigger multiple messages, the message closest to expiry will be chosen by default.
18
+ * To change this behavior, you can use the {@link setConflictHandler} API to provide
19
+ * your own logic for resolving message conflicts.
20
+ *
21
+ * @param DispatchEventInput The input object that holds the event to be dispatched.
22
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library
23
+ * configuration is incorrect, or if In App messaging hasn't been initialized.
24
+ * @throws service exceptions - Thrown when the underlying Pinpoint service returns an error.
25
+ * @returns A promise that will resolve when the operation is complete.
26
+ * @example
27
+ * ```ts
28
+ * // Sync message before disptaching an event
29
+ * await syncMessages();
30
+ *
31
+ * // Dispatch an event
32
+ * await dispatchEvent({ name: 'test_event' });
33
+ * ```
34
+ */
35
+ export function dispatchEvent(input) {
36
+ return __awaiter(this, void 0, void 0, function () {
37
+ var key, cachedMessages, messages, flattenedMessages, error_1;
38
+ return __generator(this, function (_a) {
39
+ switch (_a.label) {
40
+ case 0:
41
+ assertIsInitialized();
42
+ _a.label = 1;
43
+ case 1:
44
+ _a.trys.push([1, 4, , 5]);
45
+ key = "" + PINPOINT_KEY_PREFIX + STORAGE_KEY_SUFFIX;
46
+ return [4 /*yield*/, defaultStorage.getItem(key)];
47
+ case 2:
48
+ cachedMessages = _a.sent();
49
+ return [4 /*yield*/, processInAppMessages(cachedMessages ? JSON.parse(cachedMessages) : [], input)];
50
+ case 3:
51
+ messages = _a.sent();
52
+ flattenedMessages = flatten(messages);
53
+ if (flattenedMessages.length > 0) {
54
+ notifyEventListeners('messageReceived', conflictHandler(flattenedMessages));
55
+ }
56
+ return [3 /*break*/, 5];
57
+ case 4:
58
+ error_1 = _a.sent();
59
+ assertServiceError(error_1);
60
+ throw error_1;
61
+ case 5: return [2 /*return*/];
62
+ }
63
+ });
64
+ });
65
+ }
66
+ //# sourceMappingURL=dispatchEvent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dispatchEvent.js","sourceRoot":"","sources":["../../../../../src/inAppMessaging/providers/pinpoint/apis/dispatchEvent.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,EACN,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,GACpB,MAAM,UAAU,CAAC;AAElB,OAAO,OAAO,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGrD,OAAO,EAAE,eAAe,EAAsB,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAgB,aAAa,CAAC,KAAyB;;;;;;oBAC5D,mBAAmB,EAAE,CAAC;;;;oBAEf,GAAG,GAAG,KAAG,mBAAmB,GAAG,kBAAoB,CAAC;oBACnC,qBAAM,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,EAAA;;oBAAlD,cAAc,GAAG,SAAiC;oBACvB,qBAAM,oBAAoB,CAC1D,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE,EAChD,KAAK,CACL,EAAA;;oBAHK,QAAQ,GAAmB,SAGhC;oBACK,iBAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;oBAC5C,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE;wBACjC,oBAAoB,CACnB,iBAAiB,EACjB,eAAe,CAAC,iBAAiB,CAAC,CAClC,CAAC;qBACF;;;;oBAED,kBAAkB,CAAC,OAAK,CAAC,CAAC;oBAC1B,MAAM,OAAK,CAAC;;;;;CAEb"}
@@ -5,13 +5,10 @@
5
5
  *
6
6
  * @param {IdentifyUserParameters} params The input object used to construct requests sent to Pinpoint's UpdateEndpoint
7
7
  * API.
8
- *
9
8
  * @throws service: {@link UpdateEndpointException} - Thrown when the underlying Pinpoint service returns an error.
10
9
  * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library
11
- * configuration is incorrect.
12
- *
10
+ * configuration is incorrect, or if In App messaging hasn't been initialized.
13
11
  * @returns A promise that will resolve when the operation is complete.
14
- *
15
12
  * @example
16
13
  * ```ts
17
14
  * // Identify a user with Pinpoint
@@ -4,6 +4,7 @@ import { __awaiter, __generator } from "tslib";
4
4
  import { InAppMessagingAction } from '@aws-amplify/core/internals/utils';
5
5
  import { updateEndpoint } from '@aws-amplify/core/internals/providers/pinpoint';
6
6
  import { CATEGORY, CHANNEL_TYPE, getInAppMessagingUserAgentString, resolveConfig, resolveCredentials, } from '../utils';
7
+ import { assertIsInitialized } from '../../../utils';
7
8
  /**
8
9
  * Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user
9
10
  * profile and activities or actions in your application. Activity can be tracked across devices & platforms by using
@@ -11,13 +12,10 @@ import { CATEGORY, CHANNEL_TYPE, getInAppMessagingUserAgentString, resolveConfig
11
12
  *
12
13
  * @param {IdentifyUserParameters} params The input object used to construct requests sent to Pinpoint's UpdateEndpoint
13
14
  * API.
14
- *
15
15
  * @throws service: {@link UpdateEndpointException} - Thrown when the underlying Pinpoint service returns an error.
16
16
  * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library
17
- * configuration is incorrect.
18
- *
17
+ * configuration is incorrect, or if In App messaging hasn't been initialized.
19
18
  * @returns A promise that will resolve when the operation is complete.
20
- *
21
19
  * @example
22
20
  * ```ts
23
21
  * // Identify a user with Pinpoint
@@ -65,7 +63,9 @@ export var identifyUser = function (_a) {
65
63
  var _e;
66
64
  return __generator(this, function (_f) {
67
65
  switch (_f.label) {
68
- case 0: return [4 /*yield*/, resolveCredentials()];
66
+ case 0:
67
+ assertIsInitialized();
68
+ return [4 /*yield*/, resolveCredentials()];
69
69
  case 1:
70
70
  _b = _f.sent(), credentials = _b.credentials, identityId = _b.identityId;
71
71
  _c = resolveConfig(), appId = _c.appId, region = _c.region;
@@ -1 +1 @@
1
- {"version":3,"file":"identifyUser.js","sourceRoot":"","sources":["../../../../../src/inAppMessaging/providers/pinpoint/apis/identifyUser.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAEhF,OAAO,EACN,QAAQ,EACR,YAAY,EACZ,gCAAgC,EAChC,aAAa,EACb,kBAAkB,GAClB,MAAM,UAAU,CAAC;AAGlB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAM,CAAC,IAAM,YAAY,GAAG,UAAO,EAIf;QAHnB,kBAAM,EACN,4BAAW,EACX,oBAAO;;;;;;wBAE6B,qBAAM,kBAAkB,EAAE,EAAA;;oBAAxD,KAA8B,SAA0B,EAAtD,WAAW,iBAAA,EAAE,UAAU,gBAAA;oBACzB,KAAoB,aAAa,EAAE,EAAjC,KAAK,WAAA,EAAE,MAAM,YAAA,CAAqB;oBACpC,WAAsC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,mCAAI,EAAE,EAAjE,OAAO,aAAA,EAAE,MAAM,YAAA,EAAE,cAAc,oBAAA,CAAmC;oBAC1E,cAAc,CAAC;wBACd,OAAO,SAAA;wBACP,WAAW,EAAE,YAAY;wBACzB,MAAM,QAAA;wBACN,KAAK,OAAA;wBACL,QAAQ,EAAE,QAAQ;wBAClB,WAAW,aAAA;wBACX,UAAU,YAAA;wBACV,MAAM,QAAA;wBACN,cAAc,gBAAA;wBACd,MAAM,QAAA;wBACN,WAAW,aAAA;wBACX,cAAc,EAAE,gCAAgC,CAC/C,oBAAoB,CAAC,YAAY,CACjC;qBACD,CAAC,CAAC;;;;;CACH,CAAC"}
1
+ {"version":3,"file":"identifyUser.js","sourceRoot":"","sources":["../../../../../src/inAppMessaging/providers/pinpoint/apis/identifyUser.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAEhF,OAAO,EACN,QAAQ,EACR,YAAY,EACZ,gCAAgC,EAChC,aAAa,EACb,kBAAkB,GAClB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,MAAM,CAAC,IAAM,YAAY,GAAG,UAAO,EAIf;QAHnB,kBAAM,EACN,4BAAW,EACX,oBAAO;;;;;;;oBAEP,mBAAmB,EAAE,CAAC;oBACc,qBAAM,kBAAkB,EAAE,EAAA;;oBAAxD,KAA8B,SAA0B,EAAtD,WAAW,iBAAA,EAAE,UAAU,gBAAA;oBACzB,KAAoB,aAAa,EAAE,EAAjC,KAAK,WAAA,EAAE,MAAM,YAAA,CAAqB;oBACpC,WAAsC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,cAAc,mCAAI,EAAE,EAAjE,OAAO,aAAA,EAAE,MAAM,YAAA,EAAE,cAAc,oBAAA,CAAmC;oBAC1E,cAAc,CAAC;wBACd,OAAO,SAAA;wBACP,WAAW,EAAE,YAAY;wBACzB,MAAM,QAAA;wBACN,KAAK,OAAA;wBACL,QAAQ,EAAE,QAAQ;wBAClB,WAAW,aAAA;wBACX,UAAU,YAAA;wBACV,MAAM,QAAA;wBACN,cAAc,gBAAA;wBACd,MAAM,QAAA;wBACN,WAAW,aAAA;wBACX,cAAc,EAAE,gCAAgC,CAC/C,oBAAoB,CAAC,YAAY,CACjC;qBACD,CAAC,CAAC;;;;;CACH,CAAC"}
@@ -1,2 +1,10 @@
1
1
  export { identifyUser } from './identifyUser';
2
2
  export { syncMessages } from './syncMessages';
3
+ export { dispatchEvent } from './dispatchEvent';
4
+ export { setConflictHandler } from './setConflictHandler';
5
+ export { initializeInAppMessaging } from './initializeInAppMessaging';
6
+ export { onMessageReceived } from './onMessageReceived';
7
+ export { onMessageDismissed } from './onMessageDismissed';
8
+ export { onMessageDisplayed } from './onMessageDisplayed';
9
+ export { onMessageActionTaken } from './onMessageActionTaken';
10
+ export { notifyMessageInteraction } from './notifyMessageInteraction';
@@ -2,4 +2,12 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  export { identifyUser } from './identifyUser';
4
4
  export { syncMessages } from './syncMessages';
5
+ export { dispatchEvent } from './dispatchEvent';
6
+ export { setConflictHandler } from './setConflictHandler';
7
+ export { initializeInAppMessaging } from './initializeInAppMessaging';
8
+ export { onMessageReceived } from './onMessageReceived';
9
+ export { onMessageDismissed } from './onMessageDismissed';
10
+ export { onMessageDisplayed } from './onMessageDisplayed';
11
+ export { onMessageActionTaken } from './onMessageActionTaken';
12
+ export { notifyMessageInteraction } from './notifyMessageInteraction';
5
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/inAppMessaging/providers/pinpoint/apis/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/inAppMessaging/providers/pinpoint/apis/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Initialize and set up in-app messaging category. This API needs to be called to enable other InAppMessaging APIs.
3
+ *
4
+ * @remarks
5
+ * Make sure to call this early in your app at the root entry point after configuring Amplify.
6
+ * @example
7
+ * ```ts
8
+ * Amplify.configure(config);
9
+ * initializeInAppMessaging();
10
+ * ```
11
+ */
12
+ export declare function initializeInAppMessaging(): void;
@@ -0,0 +1,57 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import SessionTracker from '../../../sessionTracker';
4
+ import { addEventListener } from '../../../../common';
5
+ import { recordAnalyticsEvent } from '../utils/helpers';
6
+ import { PinpointMessageEvent } from '../types';
7
+ import { Hub } from '@aws-amplify/core';
8
+ import { dispatchEvent } from './dispatchEvent';
9
+ import { incrementMessageCounts, sessionStateChangeHandler } from '../utils';
10
+ import { isInitialized, initialize } from '../../../utils';
11
+ /**
12
+ * Initialize and set up in-app messaging category. This API needs to be called to enable other InAppMessaging APIs.
13
+ *
14
+ * @remarks
15
+ * Make sure to call this early in your app at the root entry point after configuring Amplify.
16
+ * @example
17
+ * ```ts
18
+ * Amplify.configure(config);
19
+ * initializeInAppMessaging();
20
+ * ```
21
+ */
22
+ export function initializeInAppMessaging() {
23
+ if (isInitialized()) {
24
+ return;
25
+ }
26
+ // set up the session tracker and start it
27
+ var sessionTracker = new SessionTracker(sessionStateChangeHandler);
28
+ sessionTracker.start();
29
+ // wire up default Pinpoint message event handling
30
+ addEventListener('messageDisplayed', function (message) {
31
+ console.log('Recording message displayed event');
32
+ recordAnalyticsEvent(PinpointMessageEvent.MESSAGE_DISPLAYED, message);
33
+ incrementMessageCounts(message.id);
34
+ });
35
+ addEventListener('messageDismissed', function (message) {
36
+ recordAnalyticsEvent(PinpointMessageEvent.MESSAGE_DISMISSED, message);
37
+ });
38
+ addEventListener('messageActionTaken', function (message) {
39
+ recordAnalyticsEvent(PinpointMessageEvent.MESSAGE_ACTION_TAKEN, message);
40
+ });
41
+ // listen to analytics hub events
42
+ Hub.listen('analytics', analyticsListener);
43
+ initialize();
44
+ }
45
+ function analyticsListener(_a) {
46
+ var payload = _a.payload;
47
+ var event = payload.event, data = payload.data;
48
+ switch (event) {
49
+ case 'record': {
50
+ dispatchEvent(data);
51
+ break;
52
+ }
53
+ default:
54
+ break;
55
+ }
56
+ }
57
+ //# sourceMappingURL=initializeInAppMessaging.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"initializeInAppMessaging.js","sourceRoot":"","sources":["../../../../../src/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,cAAc,MAAM,yBAAyB,CAAC;AAErD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAA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CAAC;YACd,aAAa,CAAC,IAAI,CAAC,CAAC;YACpB,MAAM;SACN;QACD;YACC,MAAM;KACP;AACF,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { NotifyMessageInteractionInput } from '../types/inputs';
2
+ /**
3
+ * Notifies the respective listener of the specified type with the message given.
4
+ *
5
+ * @param {NotifyMessageInteractionInput} input - The input object that holds the type and message.
6
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library
7
+ * configuration is incorrect, or if In App messaging hasn't been initialized.
8
+ * @example
9
+ * ```ts
10
+ * onMessageRecieved((message) => {
11
+ * // Show end users the In-App message and notify event listeners
12
+ * notifyMessageInteraction({ type: 'messageDisplayed', message });
13
+ * });
14
+ * ```
15
+ */
16
+ export declare function notifyMessageInteraction({ type, message, }: NotifyMessageInteractionInput): void;
@@ -0,0 +1,24 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { notifyEventListeners } from '../../../../common';
4
+ import { assertIsInitialized } from '../../../utils';
5
+ /**
6
+ * Notifies the respective listener of the specified type with the message given.
7
+ *
8
+ * @param {NotifyMessageInteractionInput} input - The input object that holds the type and message.
9
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library
10
+ * configuration is incorrect, or if In App messaging hasn't been initialized.
11
+ * @example
12
+ * ```ts
13
+ * onMessageRecieved((message) => {
14
+ * // Show end users the In-App message and notify event listeners
15
+ * notifyMessageInteraction({ type: 'messageDisplayed', message });
16
+ * });
17
+ * ```
18
+ */
19
+ export function notifyMessageInteraction(_a) {
20
+ var type = _a.type, message = _a.message;
21
+ assertIsInitialized();
22
+ notifyEventListeners(type, message);
23
+ }
24
+ //# sourceMappingURL=notifyMessageInteraction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notifyMessageInteraction.js","sourceRoot":"","sources":["../../../../../src/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAGrD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,wBAAwB,CAAC,EAGT;QAF/B,cAAI,EACJ,oBAAO;IAEP,mBAAmB,EAAE,CAAC;IACtB,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACrC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { OnMessageActionTakenInput } from '../types/inputs';
2
+ import { OnMessageActionTakenOutput } from '../types/outputs';
3
+ /**
4
+ * Registers a callback that will be invoked on `messageActionTaken` events.
5
+ *
6
+ * @param {OnMessageActionTakenInput} input - The input object that holds the callback handler.
7
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library
8
+ * configuration is incorrect, or if In App messaging hasn't been initialized.
9
+ * @returns {OnMessageActionTakenOutput} - An object that holds a remove method to stop listening to events.
10
+ * @example
11
+ * ```ts
12
+ * onMessageActionTaken((message) => {
13
+ * // use the message
14
+ * console.log(message.id);
15
+ * });
16
+ * ```
17
+ */
18
+ export declare function onMessageActionTaken(input: OnMessageActionTakenInput): OnMessageActionTakenOutput;
@@ -0,0 +1,24 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { addEventListener } from '../../../../common';
4
+ import { assertIsInitialized } from '../../../utils';
5
+ /**
6
+ * Registers a callback that will be invoked on `messageActionTaken` events.
7
+ *
8
+ * @param {OnMessageActionTakenInput} input - The input object that holds the callback handler.
9
+ * @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown when the provided parameters or library
10
+ * configuration is incorrect, or if In App messaging hasn't been initialized.
11
+ * @returns {OnMessageActionTakenOutput} - An object that holds a remove method to stop listening to events.
12
+ * @example
13
+ * ```ts
14
+ * onMessageActionTaken((message) => {
15
+ * // use the message
16
+ * console.log(message.id);
17
+ * });
18
+ * ```
19
+ */
20
+ export function onMessageActionTaken(input) {
21
+ assertIsInitialized();
22
+ return addEventListener('messageActionTaken', input);
23
+ }
24
+ //# sourceMappingURL=onMessageActionTaken.js.map