@aws-amplify/core 6.0.1-console-preview.4b7d177.0 → 6.0.1-console-preview.11cf989.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 (41) hide show
  1. package/lib/Hub/types/AuthTypes.d.ts +14 -0
  2. package/lib/I18n/I18n.d.ts +1 -1
  3. package/lib/I18n/index.d.ts +1 -1
  4. package/lib/Platform/version.d.ts +1 -1
  5. package/lib/Platform/version.js +1 -1
  6. package/lib/libraryUtils.d.ts +1 -1
  7. package/lib/providers/pinpoint/index.d.ts +1 -0
  8. package/lib/providers/pinpoint/index.js +3 -0
  9. package/lib/singleton/Auth/utils/index.js +10 -10
  10. package/lib/singleton/Notifications/InAppMessaging/types.d.ts +2 -0
  11. package/lib/singleton/Notifications/InAppMessaging/types.js +4 -0
  12. package/lib/singleton/Notifications/types.d.ts +4 -0
  13. package/lib/singleton/Notifications/types.js +4 -0
  14. package/lib/singleton/types.d.ts +2 -0
  15. package/lib/tsconfig.tsbuildinfo +1 -1
  16. package/lib-esm/Hub/types/AuthTypes.d.ts +14 -0
  17. package/lib-esm/I18n/I18n.d.ts +1 -1
  18. package/lib-esm/I18n/index.d.ts +1 -1
  19. package/lib-esm/Platform/version.d.ts +1 -1
  20. package/lib-esm/Platform/version.js +1 -1
  21. package/lib-esm/libraryUtils.d.ts +1 -1
  22. package/lib-esm/providers/pinpoint/index.d.ts +1 -0
  23. package/lib-esm/providers/pinpoint/index.js +1 -0
  24. package/lib-esm/singleton/Auth/utils/index.js +10 -10
  25. package/lib-esm/singleton/Notifications/InAppMessaging/types.d.ts +2 -0
  26. package/lib-esm/singleton/Notifications/InAppMessaging/types.js +3 -0
  27. package/lib-esm/singleton/Notifications/types.d.ts +4 -0
  28. package/lib-esm/singleton/Notifications/types.js +3 -0
  29. package/lib-esm/singleton/types.d.ts +2 -0
  30. package/lib-esm/tsconfig.tsbuildinfo +1 -1
  31. package/package.json +2 -2
  32. package/src/Hub/types/AuthTypes.ts +10 -1
  33. package/src/I18n/I18n.ts +1 -1
  34. package/src/I18n/index.ts +1 -1
  35. package/src/Platform/version.ts +1 -1
  36. package/src/libraryUtils.ts +1 -1
  37. package/src/providers/pinpoint/index.ts +1 -0
  38. package/src/singleton/Auth/utils/index.ts +14 -11
  39. package/src/singleton/Notifications/InAppMessaging/types.ts +6 -0
  40. package/src/singleton/Notifications/types.ts +8 -0
  41. package/src/singleton/types.ts +2 -1
@@ -1,3 +1,7 @@
1
+ type AuthUser = {
2
+ username: string;
3
+ userId: string;
4
+ };
1
5
  export type AuthHubEventData =
2
6
  /** Dispatched when a user signs in with an oauth provider such as Google.*/
3
7
  {
@@ -19,4 +23,14 @@ export type AuthHubEventData =
19
23
  | {
20
24
  event: 'customOAuthState';
21
25
  data: string;
26
+ }
27
+ /** Dispatched when the user is signed-in.*/
28
+ | {
29
+ event: 'signedIn';
30
+ data: AuthUser;
31
+ }
32
+ /** Dispatched after the user calls the `signOut` API successfully.*/
33
+ | {
34
+ event: 'signedOut';
22
35
  };
36
+ export {};
@@ -59,5 +59,5 @@ export declare class I18n {
59
59
  * @param {Object} vocabularies - Object that has language as key,
60
60
  * vocabularies of each language as value
61
61
  */
62
- putVocabularies(vocabularies: Record<string, any>): void;
62
+ putVocabularies(vocabularies: Record<string, Record<string, string>>): void;
63
63
  }
@@ -45,6 +45,6 @@ export declare class I18n {
45
45
  * @param {Object} vocabularies - Object that has language as key,
46
46
  * vocabularies of each language as value
47
47
  */
48
- static putVocabularies(vocabularies: Record<string, string>): void;
48
+ static putVocabularies(vocabularies: Record<string, Record<string, string>>): void;
49
49
  static checkConfig(): boolean;
50
50
  }
@@ -1 +1 @@
1
- export declare const version = "6.0.1-console-preview.4b7d177.0+4b7d177";
1
+ export declare const version = "6.0.1-console-preview.11cf989.0+11cf989";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
4
  // generated by genversion
5
- exports.version = '6.0.1-console-preview.4b7d177.0+4b7d177';
5
+ exports.version = '6.0.1-console-preview.11cf989.0+11cf989';
@@ -4,7 +4,7 @@ export { LegacyConfig } from './singleton/types';
4
4
  export { JWT, StrictUnion, CognitoIdentityPoolConfig, JwtPayload, } from './singleton/Auth/types';
5
5
  export { decodeJWT, assertTokenProviderConfig, assertIdentityPoolIdConfig, assertOAuthConfig, } from './singleton/Auth/utils';
6
6
  export { isTokenExpired } from './singleton/Auth';
7
- export { GraphQLAuthModeKeys } from './singleton/API/types';
7
+ export { GraphQLAuthMode, GraphQLAuthModeKeys } from './singleton/API/types';
8
8
  export { Signer } from './Signer';
9
9
  export { ConsoleLogger, ConsoleLogger as Logger } from './Logger';
10
10
  export { ClientDevice } from './ClientDevice';
@@ -1,2 +1,3 @@
1
1
  export * from './apis';
2
2
  export { PinpointAnalyticsEvent, PinpointServiceOptions } from './types';
3
+ export { getEndpointId } from './utils';
@@ -16,4 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
17
17
  };
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.getEndpointId = void 0;
19
20
  __exportStar(require("./apis"), exports);
21
+ var utils_1 = require("./utils");
22
+ Object.defineProperty(exports, "getEndpointId", { enumerable: true, get: function () { return utils_1.getEndpointId; } });
@@ -36,15 +36,19 @@ function assertUserPoolAndIdentityPoolConfig(authConfig) {
36
36
  return (0, errorHelpers_1.assert)(validConfig, errorHelpers_1.AuthConfigurationErrorCode.AuthUserPoolAndIdentityPoolException);
37
37
  }
38
38
  function decodeJWT(token) {
39
- var tokenSplitted = token.split('.');
40
- if (tokenSplitted.length !== 3) {
39
+ var tokenParts = token.split('.');
40
+ if (tokenParts.length !== 3) {
41
41
  throw new Error('Invalid token');
42
42
  }
43
43
  try {
44
- var payloadStringb64 = tokenSplitted[1];
45
- var payloadArrayBuffer = base64ToBytes(payloadStringb64);
46
- var decodeString = new TextDecoder().decode(payloadArrayBuffer);
47
- var payload = JSON.parse(decodeString);
44
+ var base64WithUrlSafe = tokenParts[1];
45
+ var base64_1 = base64WithUrlSafe.replace(/-/g, '+').replace(/_/g, '/');
46
+ var jsonStr = decodeURIComponent(convert_1.base64Decoder
47
+ .convert(base64_1)
48
+ .split('')
49
+ .map(function (char) { return "%".concat("00".concat(char.charCodeAt(0).toString(16)).slice(-2)); })
50
+ .join(''));
51
+ var payload = JSON.parse(jsonStr);
48
52
  return {
49
53
  toString: function () { return token; },
50
54
  payload: payload,
@@ -55,7 +59,3 @@ function decodeJWT(token) {
55
59
  }
56
60
  }
57
61
  exports.decodeJWT = decodeJWT;
58
- function base64ToBytes(base64) {
59
- var binString = convert_1.base64Decoder.convert(base64);
60
- return Uint8Array.from(binString, function (m) { return m.codePointAt(0) || 0; });
61
- }
@@ -0,0 +1,2 @@
1
+ import { PinpointProviderConfig } from '../../../providers/pinpoint/types';
2
+ export type InAppMessagingConfig = PinpointProviderConfig;
@@ -0,0 +1,4 @@
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 });
@@ -0,0 +1,4 @@
1
+ import { InAppMessagingConfig } from './InAppMessaging/types';
2
+ export type NotificationsConfig = {
3
+ InAppMessaging: InAppMessagingConfig;
4
+ };
@@ -0,0 +1,4 @@
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 });
@@ -4,6 +4,7 @@ import { AuthConfig, LibraryAuthOptions, AuthUserPoolConfig, AuthIdentityPoolCon
4
4
  import { GeoConfig } from './Geo/types';
5
5
  import { LibraryStorageOptions, StorageAccessLevel, StorageConfig } from './Storage/types';
6
6
  import { I18nConfig } from '../I18n/types';
7
+ import { NotificationsConfig } from './Notifications/types';
7
8
  export type LegacyConfig = {
8
9
  /**
9
10
  * @deprecated The field should not be used.
@@ -15,6 +16,7 @@ export type ResourcesConfig = {
15
16
  Analytics?: AnalyticsConfig;
16
17
  Auth?: AuthConfig;
17
18
  I18n?: I18nConfig;
19
+ Notifications?: NotificationsConfig;
18
20
  Storage?: StorageConfig;
19
21
  Geo?: GeoConfig;
20
22
  };