@aws-amplify/core 6.0.1-console-preview.8d88eef.0 → 6.0.1-console-preview.be08038.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 (62) hide show
  1. package/lib/Cache/StorageCacheCommon.js +1 -4
  2. package/lib/I18n/I18n.js +1 -6
  3. package/lib/Platform/version.d.ts +1 -1
  4. package/lib/Platform/version.js +1 -1
  5. package/lib/Reachability/Reachability.js +6 -1
  6. package/lib/index.d.ts +2 -1
  7. package/lib/libraryUtils.d.ts +2 -0
  8. package/lib/libraryUtils.js +4 -1
  9. package/lib/parseAWSExports.js +26 -6
  10. package/lib/singleton/Auth/types.d.ts +2 -2
  11. package/lib/singleton/Interactions/types.d.ts +21 -0
  12. package/lib/singleton/Interactions/types.js +4 -0
  13. package/lib/singleton/types.d.ts +3 -5
  14. package/lib/tsconfig.tsbuildinfo +1 -1
  15. package/lib/utils/deepFreeze.js +1 -1
  16. package/lib/utils/sessionListener/SessionListener.d.ts +10 -0
  17. package/lib/utils/sessionListener/SessionListener.js +55 -0
  18. package/lib/utils/sessionListener/SessionListener.native.d.ts +10 -0
  19. package/lib/utils/sessionListener/SessionListener.native.js +54 -0
  20. package/lib/utils/sessionListener/index.d.ts +2 -0
  21. package/lib/utils/sessionListener/index.js +7 -0
  22. package/lib/utils/sessionListener/types.d.ts +6 -0
  23. package/lib/utils/sessionListener/types.js +4 -0
  24. package/lib-esm/Cache/StorageCacheCommon.js +1 -4
  25. package/lib-esm/I18n/I18n.js +1 -6
  26. package/lib-esm/Platform/version.d.ts +1 -1
  27. package/lib-esm/Platform/version.js +1 -1
  28. package/lib-esm/Reachability/Reachability.js +7 -2
  29. package/lib-esm/index.d.ts +2 -1
  30. package/lib-esm/libraryUtils.d.ts +2 -0
  31. package/lib-esm/libraryUtils.js +2 -0
  32. package/lib-esm/parseAWSExports.js +26 -6
  33. package/lib-esm/singleton/Auth/types.d.ts +2 -2
  34. package/lib-esm/singleton/Interactions/types.d.ts +21 -0
  35. package/lib-esm/singleton/Interactions/types.js +3 -0
  36. package/lib-esm/singleton/types.d.ts +3 -5
  37. package/lib-esm/tsconfig.tsbuildinfo +1 -1
  38. package/lib-esm/utils/deepFreeze.js +1 -1
  39. package/lib-esm/utils/sessionListener/SessionListener.d.ts +10 -0
  40. package/lib-esm/utils/sessionListener/SessionListener.js +52 -0
  41. package/lib-esm/utils/sessionListener/SessionListener.native.d.ts +10 -0
  42. package/lib-esm/utils/sessionListener/SessionListener.native.js +51 -0
  43. package/lib-esm/utils/sessionListener/index.d.ts +2 -0
  44. package/lib-esm/utils/sessionListener/index.js +4 -0
  45. package/lib-esm/utils/sessionListener/types.d.ts +6 -0
  46. package/lib-esm/utils/sessionListener/types.js +3 -0
  47. package/package.json +4 -4
  48. package/src/Cache/StorageCacheCommon.ts +0 -4
  49. package/src/I18n/I18n.ts +1 -6
  50. package/src/Platform/version.ts +1 -1
  51. package/src/Reachability/Reachability.ts +8 -2
  52. package/src/index.ts +1 -1
  53. package/src/libraryUtils.ts +4 -0
  54. package/src/parseAWSExports.ts +34 -7
  55. package/src/singleton/Auth/types.ts +2 -2
  56. package/src/singleton/Interactions/types.ts +29 -0
  57. package/src/singleton/types.ts +3 -7
  58. package/src/utils/deepFreeze.ts +1 -1
  59. package/src/utils/sessionListener/SessionListener.native.ts +70 -0
  60. package/src/utils/sessionListener/SessionListener.ts +74 -0
  61. package/src/utils/sessionListener/index.ts +6 -0
  62. package/src/utils/sessionListener/types.ts +11 -0
@@ -21,7 +21,7 @@ var deepFreeze = function (object) {
21
21
  for (var propNames_1 = __values(propNames), propNames_1_1 = propNames_1.next(); !propNames_1_1.done; propNames_1_1 = propNames_1.next()) {
22
22
  var name_1 = propNames_1_1.value;
23
23
  var value = object[name_1];
24
- if ((value && typeof value === "object") || typeof value === "function") {
24
+ if ((value && typeof value === 'object') || typeof value === 'function') {
25
25
  (0, exports.deepFreeze)(value);
26
26
  }
27
27
  }
@@ -0,0 +1,10 @@
1
+ import { SessionStateChangeListener, SessionListenerInterface } from './types';
2
+ export declare class SessionListener implements SessionListenerInterface {
3
+ private listenerActive;
4
+ constructor();
5
+ addStateChangeListener(listener: SessionStateChangeListener, notifyOnAdd?: boolean): void;
6
+ removeStateChangeListener(handler: SessionStateChangeListener): void;
7
+ private handleVisibilityChange;
8
+ private notifyHandlers;
9
+ private getSessionState;
10
+ }
@@ -0,0 +1,55 @@
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.SessionListener = void 0;
6
+ var isBrowser_1 = require("../isBrowser");
7
+ var stateChangeListeners = new Set();
8
+ var SessionListener = /** @class */ (function () {
9
+ function SessionListener() {
10
+ this.listenerActive = false;
11
+ this.handleVisibilityChange = this.handleVisibilityChange.bind(this);
12
+ // Setup state listeners
13
+ if ((0, isBrowser_1.isBrowser)()) {
14
+ document.addEventListener('visibilitychange', this.handleVisibilityChange, false);
15
+ this.listenerActive = true;
16
+ }
17
+ }
18
+ SessionListener.prototype.addStateChangeListener = function (listener, notifyOnAdd) {
19
+ if (notifyOnAdd === void 0) { notifyOnAdd = false; }
20
+ // No-op if document listener is not active
21
+ if (!this.listenerActive) {
22
+ return;
23
+ }
24
+ stateChangeListeners.add(listener);
25
+ // Notify new handlers of the current status on add
26
+ if (notifyOnAdd) {
27
+ listener(this.getSessionState());
28
+ }
29
+ };
30
+ SessionListener.prototype.removeStateChangeListener = function (handler) {
31
+ // No-op if document listener is not active
32
+ if (!this.listenerActive) {
33
+ return;
34
+ }
35
+ stateChangeListeners.delete(handler);
36
+ };
37
+ SessionListener.prototype.handleVisibilityChange = function () {
38
+ this.notifyHandlers();
39
+ };
40
+ SessionListener.prototype.notifyHandlers = function () {
41
+ var sessionState = this.getSessionState();
42
+ stateChangeListeners.forEach(function (listener) {
43
+ listener(sessionState);
44
+ });
45
+ };
46
+ SessionListener.prototype.getSessionState = function () {
47
+ if ((0, isBrowser_1.isBrowser)() && document.visibilityState !== 'hidden') {
48
+ return 'started';
49
+ }
50
+ // If, for any reason, document is undefined the session will never start
51
+ return 'ended';
52
+ };
53
+ return SessionListener;
54
+ }());
55
+ exports.SessionListener = SessionListener;
@@ -0,0 +1,10 @@
1
+ import { SessionStateChangeListener, SessionListenerInterface } from './types';
2
+ export declare class SessionListener implements SessionListenerInterface {
3
+ private currentAppState?;
4
+ constructor();
5
+ addStateChangeListener(listener: SessionStateChangeListener, notifyOnAdd?: boolean): void;
6
+ removeStateChangeListener(handler: SessionStateChangeListener): void;
7
+ private handleStateChange;
8
+ private notifyHandlers;
9
+ private getSessionState;
10
+ }
@@ -0,0 +1,54 @@
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.SessionListener = void 0;
6
+ var react_native_1 = require("@aws-amplify/react-native");
7
+ var stateChangeListeners = new Set();
8
+ var isActive = function (appState) { return appState === 'active'; };
9
+ var isInactive = function (appState) {
10
+ return appState === 'inactive' || appState === 'background';
11
+ };
12
+ var SessionListener = /** @class */ (function () {
13
+ function SessionListener() {
14
+ this.handleStateChange = this.handleStateChange.bind(this);
15
+ // Setup state listeners
16
+ (0, react_native_1.loadAppState)().addEventListener('change', this.handleStateChange);
17
+ }
18
+ SessionListener.prototype.addStateChangeListener = function (listener, notifyOnAdd) {
19
+ if (notifyOnAdd === void 0) { notifyOnAdd = false; }
20
+ stateChangeListeners.add(listener);
21
+ // Notify new handlers of the current state on add if the current state has been determined
22
+ if (notifyOnAdd && this.currentAppState !== undefined) {
23
+ listener(this.getSessionState());
24
+ }
25
+ };
26
+ SessionListener.prototype.removeStateChangeListener = function (handler) {
27
+ stateChangeListeners.delete(handler);
28
+ };
29
+ SessionListener.prototype.handleStateChange = function (nextAppState) {
30
+ if ((this.currentAppState === undefined ||
31
+ isInactive(this.currentAppState)) &&
32
+ isActive(nextAppState)) {
33
+ this.notifyHandlers('started');
34
+ }
35
+ else if (isActive(this.currentAppState) && isInactive(nextAppState)) {
36
+ this.notifyHandlers('ended');
37
+ }
38
+ this.currentAppState = nextAppState;
39
+ };
40
+ SessionListener.prototype.notifyHandlers = function (state) {
41
+ stateChangeListeners.forEach(function (listener) {
42
+ listener(state);
43
+ });
44
+ };
45
+ SessionListener.prototype.getSessionState = function () {
46
+ if (isActive(this.currentAppState)) {
47
+ return 'started';
48
+ }
49
+ // Consider any other app state as ended
50
+ return 'ended';
51
+ };
52
+ return SessionListener;
53
+ }());
54
+ exports.SessionListener = SessionListener;
@@ -0,0 +1,2 @@
1
+ import { SessionListener } from './SessionListener';
2
+ export declare const sessionListener: SessionListener;
@@ -0,0 +1,7 @@
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.sessionListener = void 0;
6
+ var SessionListener_1 = require("./SessionListener");
7
+ exports.sessionListener = new SessionListener_1.SessionListener();
@@ -0,0 +1,6 @@
1
+ export type SessionState = 'started' | 'ended';
2
+ export type SessionStateChangeListener = (state: SessionState) => void;
3
+ export interface SessionListenerInterface {
4
+ addStateChangeListener: (listener: SessionStateChangeListener) => void;
5
+ removeStateChangeListener: (listener: SessionStateChangeListener) => void;
6
+ }
@@ -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 });
@@ -58,7 +58,6 @@ var __values = (this && this.__values) || function(o) {
58
58
  };
59
59
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
60
60
  };
61
- import { Amplify } from '../singleton';
62
61
  import { ConsoleLogger as Logger } from '../Logger';
63
62
  import { currentSizeKey, defaultConfig } from './constants';
64
63
  import { getCurrentSizeKey, getCurrentTime, getByteLength } from './utils';
@@ -76,9 +75,7 @@ var StorageCacheCommon = /** @class */ (function () {
76
75
  */
77
76
  function StorageCacheCommon(_a) {
78
77
  var config = _a.config, keyValueStorage = _a.keyValueStorage;
79
- var _b;
80
- var globalCacheConfig = (_b = Amplify.getConfig().Cache) !== null && _b !== void 0 ? _b : {};
81
- this.config = __assign(__assign(__assign({}, defaultConfig), globalCacheConfig), config);
78
+ this.config = __assign(__assign({}, defaultConfig), config);
82
79
  this.keyValueStorage = keyValueStorage;
83
80
  this.sanitizeConfig();
84
81
  }
@@ -12,7 +12,6 @@ var __assign = (this && this.__assign) || function () {
12
12
  return __assign.apply(this, arguments);
13
13
  };
14
14
  import { ConsoleLogger as Logger } from '../Logger';
15
- import { Amplify } from '../singleton';
16
15
  var logger = new Logger('I18n');
17
16
  /**
18
17
  * Language translation utility.
@@ -41,11 +40,7 @@ var I18n = /** @class */ (function () {
41
40
  * Sets the default language from the configuration when required.
42
41
  */
43
42
  I18n.prototype.setDefaultLanguage = function () {
44
- if (!this._lang) {
45
- var i18nConfig = Amplify.getConfig().I18n;
46
- this._lang = i18nConfig === null || i18nConfig === void 0 ? void 0 : i18nConfig.language;
47
- }
48
- // Default to window language if not set in config
43
+ // Default to window language if not set in instance
49
44
  if (!this._lang &&
50
45
  typeof window !== 'undefined' &&
51
46
  window &&
@@ -1 +1 @@
1
- export declare const version = "6.0.1-console-preview.8d88eef.0+8d88eef";
1
+ export declare const version = "6.0.1-console-preview.be08038.0+be08038";
@@ -1,2 +1,2 @@
1
1
  // generated by genversion
2
- export var version = '6.0.1-console-preview.8d88eef.0+8d88eef';
2
+ export var version = '6.0.1-console-preview.be08038.0+be08038';
@@ -11,13 +11,18 @@ var __values = (this && this.__values) || function(o) {
11
11
  };
12
12
  throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
13
13
  };
14
- import { Observable } from 'rxjs';
14
+ import { Observable, from } from 'rxjs';
15
15
  import { isWebWorker } from '../libraryUtils';
16
16
  export var Reachability = /** @class */ (function () {
17
17
  function Reachability() {
18
18
  }
19
19
  Reachability.prototype.networkMonitor = function (_) {
20
- var globalObj = isWebWorker() ? self : window;
20
+ var globalObj = isWebWorker()
21
+ ? self
22
+ : typeof window !== 'undefined' && window;
23
+ if (!globalObj) {
24
+ return from([{ online: true }]);
25
+ }
21
26
  return new Observable(function (observer) {
22
27
  observer.next({ online: globalObj.navigator.onLine });
23
28
  var notifyOnline = function () { return observer.next({ online: true }); };
@@ -1,13 +1,14 @@
1
1
  export { Hub } from './Hub';
2
2
  export { HubCapsule, HubCallback, HubPayload } from './Hub/types';
3
3
  export { TokenProvider, AuthTokens, FetchAuthSessionOptions, AWSCredentialsAndIdentityIdProvider, AWSCredentialsAndIdentityId, Identity, OAuthConfig, CognitoUserPoolConfig, } from './singleton/Auth/types';
4
- export { AuthConfig, AuthUserPoolConfig, AuthUserPoolAndIdentityPoolConfig, APIConfig, CacheConfig, StorageAccessLevel, StorageConfig, GetCredentialsOptions, ResourcesConfig, LibraryOptions, AnalyticsConfig, GeoConfig, } from './singleton/types';
4
+ export { AuthConfig, AuthUserPoolConfig, AuthUserPoolAndIdentityPoolConfig, APIConfig, StorageAccessLevel, StorageConfig, GetCredentialsOptions, ResourcesConfig, LibraryOptions, AnalyticsConfig, GeoConfig, } from './singleton/types';
5
5
  export { Amplify, fetchAuthSession, AmplifyClass as AmplifyClassV6, clearCredentials, } from './singleton';
6
6
  export { getCredentialsForIdentity, getId, GetCredentialsForIdentityInput, GetCredentialsForIdentityOutput, } from './awsClients/cognitoIdentity';
7
7
  export { UserProfile } from './types';
8
8
  export { CookieStorage, defaultStorage, sessionStorage, sharedInMemoryStorage, } from './storage';
9
9
  export { KeyValueStorageInterface } from './types';
10
10
  export { Cache } from './Cache';
11
+ export { CacheConfig } from './Cache/types';
11
12
  export { I18n } from './I18n';
12
13
  export { ConsoleLogger } from './Logger';
13
14
  export { ServiceWorker } from './ServiceWorker';
@@ -22,3 +22,5 @@ export { AMPLIFY_SYMBOL } from './Hub';
22
22
  export { base64Decoder, base64Encoder } from './utils/convert';
23
23
  export { getCrypto } from './utils/globalHelpers';
24
24
  export { HubInternal } from './Hub';
25
+ export { sessionListener } from './utils/sessionListener';
26
+ export { SessionState } from './utils/sessionListener/types';
@@ -31,3 +31,5 @@ export { base64Decoder, base64Encoder } from './utils/convert';
31
31
  export { getCrypto } from './utils/globalHelpers';
32
32
  // Hub
33
33
  export { HubInternal } from './Hub';
34
+ // Session listener
35
+ export { sessionListener } from './utils/sessionListener';
@@ -57,7 +57,7 @@ var authTypeMapping = {
57
57
  export var parseAWSExports = function (config) {
58
58
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
59
59
  if (config === void 0) { config = {}; }
60
- var aws_appsync_apiKey = config.aws_appsync_apiKey, aws_appsync_authenticationType = config.aws_appsync_authenticationType, aws_appsync_graphqlEndpoint = config.aws_appsync_graphqlEndpoint, aws_appsync_region = config.aws_appsync_region, aws_cognito_identity_pool_id = config.aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method = config.aws_cognito_sign_up_verification_method, aws_cognito_mfa_configuration = config.aws_cognito_mfa_configuration, aws_cognito_mfa_types = config.aws_cognito_mfa_types, aws_cognito_password_protection_settings = config.aws_cognito_password_protection_settings, aws_cognito_verification_mechanisms = config.aws_cognito_verification_mechanisms, aws_cognito_signup_attributes = config.aws_cognito_signup_attributes, aws_cognito_username_attributes = config.aws_cognito_username_attributes, aws_mandatory_sign_in = config.aws_mandatory_sign_in, aws_mobile_analytics_app_id = config.aws_mobile_analytics_app_id, aws_mobile_analytics_app_region = config.aws_mobile_analytics_app_region, aws_user_files_s3_bucket = config.aws_user_files_s3_bucket, aws_user_files_s3_bucket_region = config.aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing = config.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id = config.aws_user_pools_id, aws_user_pools_web_client_id = config.aws_user_pools_web_client_id, geo = config.geo, oauth = config.oauth, aws_cloud_logic_custom = config.aws_cloud_logic_custom, Notifications = config.Notifications;
60
+ var aws_appsync_apiKey = config.aws_appsync_apiKey, aws_appsync_authenticationType = config.aws_appsync_authenticationType, aws_appsync_graphqlEndpoint = config.aws_appsync_graphqlEndpoint, aws_appsync_region = config.aws_appsync_region, aws_bots = config.aws_bots, aws_bots_config = config.aws_bots_config, aws_cognito_identity_pool_id = config.aws_cognito_identity_pool_id, aws_cognito_sign_up_verification_method = config.aws_cognito_sign_up_verification_method, aws_cognito_mfa_configuration = config.aws_cognito_mfa_configuration, aws_cognito_mfa_types = config.aws_cognito_mfa_types, aws_cognito_password_protection_settings = config.aws_cognito_password_protection_settings, aws_cognito_verification_mechanisms = config.aws_cognito_verification_mechanisms, aws_cognito_signup_attributes = config.aws_cognito_signup_attributes, aws_cognito_social_providers = config.aws_cognito_social_providers, aws_cognito_username_attributes = config.aws_cognito_username_attributes, aws_mandatory_sign_in = config.aws_mandatory_sign_in, aws_mobile_analytics_app_id = config.aws_mobile_analytics_app_id, aws_mobile_analytics_app_region = config.aws_mobile_analytics_app_region, aws_user_files_s3_bucket = config.aws_user_files_s3_bucket, aws_user_files_s3_bucket_region = config.aws_user_files_s3_bucket_region, aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing = config.aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing, aws_user_pools_id = config.aws_user_pools_id, aws_user_pools_web_client_id = config.aws_user_pools_web_client_id, geo = config.geo, oauth = config.oauth, aws_cloud_logic_custom = config.aws_cloud_logic_custom, Notifications = config.Notifications;
61
61
  var amplifyConfig = {};
62
62
  // Analytics
63
63
  if (aws_mobile_analytics_app_id) {
@@ -91,6 +91,12 @@ export var parseAWSExports = function (config) {
91
91
  };
92
92
  }
93
93
  }
94
+ // Interactions
95
+ if (Array.isArray(aws_bots_config)) {
96
+ amplifyConfig.Interactions = {
97
+ LexV1: Object.fromEntries(aws_bots_config.map(function (bot) { return [bot.name, bot]; })),
98
+ };
99
+ }
94
100
  // API
95
101
  if (aws_appsync_graphqlEndpoint) {
96
102
  var defaultAuthMode = authTypeMapping[aws_appsync_authenticationType];
@@ -146,13 +152,21 @@ export var parseAWSExports = function (config) {
146
152
  userPoolId: aws_user_pools_id,
147
153
  mfa: mfaConfig,
148
154
  passwordFormat: passwordFormatConfig,
149
- loginWith: __assign({ username: loginWithEmailEnabled || loginWithPhoneEnabled ? false : true, email: loginWithEmailEnabled, phone: loginWithPhoneEnabled }, (oauth &&
150
- Object.keys(oauth).length > 0 && {
151
- oauth: getOAuthConfig(oauth),
152
- })),
155
+ loginWith: {
156
+ username: loginWithEmailEnabled || loginWithPhoneEnabled ? false : true,
157
+ email: loginWithEmailEnabled,
158
+ phone: loginWithPhoneEnabled
159
+ },
153
160
  },
154
161
  };
155
162
  }
163
+ var hasOAuthConfig = oauth ? Object.keys(oauth).length > 0 : false;
164
+ var hasSocialProviderConfig = aws_cognito_social_providers ? aws_cognito_social_providers.length > 0 : false;
165
+ if (amplifyConfig.Auth && hasOAuthConfig) {
166
+ amplifyConfig.Auth.Cognito.loginWith = __assign(__assign({}, amplifyConfig.Auth.Cognito.loginWith), { oauth: __assign(__assign({}, (getOAuthConfig(oauth))), (hasSocialProviderConfig && {
167
+ providers: parseSocialProviders(aws_cognito_social_providers)
168
+ })) });
169
+ }
156
170
  // Storage
157
171
  if (aws_user_files_s3_bucket) {
158
172
  amplifyConfig.Storage = {
@@ -192,6 +206,12 @@ var getOAuthConfig = function (_a) {
192
206
  scopes: scope,
193
207
  redirectSignIn: getRedirectUrl(redirectSignIn),
194
208
  redirectSignOut: getRedirectUrl(redirectSignOut),
195
- responseType: responseType,
209
+ responseType: responseType
210
+ });
211
+ };
212
+ var parseSocialProviders = function (aws_cognito_social_providers) {
213
+ return aws_cognito_social_providers.map(function (provider) {
214
+ var updatedProvider = provider.toLowerCase();
215
+ return updatedProvider.charAt(0).toUpperCase() + updatedProvider.slice(1);
196
216
  });
197
217
  };
@@ -112,9 +112,9 @@ export type OAuthConfig = {
112
112
  redirectSignIn: Array<string>;
113
113
  redirectSignOut: Array<string>;
114
114
  responseType: 'code' | 'token';
115
- providers?: Array<OAuthProviders | CustomProvider>;
115
+ providers?: Array<OAuthProvider | CustomProvider>;
116
116
  };
117
- type OAuthProviders = 'Google' | 'Facebook' | 'Amazon' | 'Apple';
117
+ export type OAuthProvider = 'Google' | 'Facebook' | 'Amazon' | 'Apple';
118
118
  type CustomProvider = {
119
119
  custom: string;
120
120
  };
@@ -0,0 +1,21 @@
1
+ interface LexV1BotConfig {
2
+ alias: string;
3
+ region: string;
4
+ }
5
+ interface LexV2BotConfig {
6
+ botId: string;
7
+ aliasId: string;
8
+ localeId: string;
9
+ region: string;
10
+ }
11
+ type InteractionsLexV1Config = {
12
+ LexV1: Record<string, LexV1BotConfig>;
13
+ };
14
+ type InteractionsLexV2Config = {
15
+ LexV2: Record<string, LexV2BotConfig>;
16
+ };
17
+ type AtLeastOne<T, U = {
18
+ [K in keyof T]: Pick<T, K>;
19
+ }> = Partial<T> & U[keyof U];
20
+ export type InteractionsConfig = AtLeastOne<InteractionsLexV1Config & InteractionsLexV2Config>;
21
+ export {};
@@ -0,0 +1,3 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ export {};
@@ -1,11 +1,10 @@
1
1
  import { APIConfig, LibraryAPIOptions } from './API/types';
2
2
  import { AnalyticsConfig } from './Analytics/types';
3
3
  import { AuthConfig, LibraryAuthOptions, AuthUserPoolConfig, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig, GetCredentialsOptions, CognitoIdentityPoolConfig } from './Auth/types';
4
- import { CacheConfig } from './Cache/types';
5
4
  import { GeoConfig } from './Geo/types';
6
5
  import { LibraryStorageOptions, StorageAccessLevel, StorageConfig } from './Storage/types';
7
- import { I18nConfig } from '../I18n/types';
8
6
  import { NotificationsConfig } from './Notifications/types';
7
+ import { InteractionsConfig } from './Interactions/types';
9
8
  export type LegacyConfig = {
10
9
  /**
11
10
  * @deprecated The field should not be used.
@@ -16,8 +15,7 @@ export type ResourcesConfig = {
16
15
  API?: APIConfig;
17
16
  Analytics?: AnalyticsConfig;
18
17
  Auth?: AuthConfig;
19
- Cache?: CacheConfig;
20
- I18n?: I18nConfig;
18
+ Interactions?: InteractionsConfig;
21
19
  Notifications?: NotificationsConfig;
22
20
  Storage?: StorageConfig;
23
21
  Geo?: GeoConfig;
@@ -28,4 +26,4 @@ export type LibraryOptions = {
28
26
  Storage?: LibraryStorageOptions;
29
27
  ssr?: boolean;
30
28
  };
31
- export { APIConfig, AuthConfig, AuthUserPoolConfig, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig, CacheConfig, GetCredentialsOptions, StorageAccessLevel, StorageConfig, AnalyticsConfig, CognitoIdentityPoolConfig, GeoConfig, };
29
+ export { APIConfig, AuthConfig, AuthUserPoolConfig, AuthIdentityPoolConfig, AuthUserPoolAndIdentityPoolConfig, GetCredentialsOptions, InteractionsConfig, StorageAccessLevel, StorageConfig, AnalyticsConfig, CognitoIdentityPoolConfig, GeoConfig, };