@aws-amplify/notifications 2.0.1-console-preview.8d88eef.0 → 2.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 (122) hide show
  1. package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.d.ts +4 -4
  2. package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.js +4 -4
  3. package/lib/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js +8 -10
  4. package/lib/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.d.ts +1 -1
  5. package/lib/pushNotifications/errors/errorHelpers.d.ts +1 -0
  6. package/lib/pushNotifications/errors/errorHelpers.js +4 -0
  7. package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.js +7 -3
  8. package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.js +2 -0
  9. package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.js +2 -0
  10. package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.native.js +8 -4
  11. package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.js +8 -7
  12. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.js +2 -0
  13. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.js +5 -1
  14. package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.js +5 -1
  15. package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.js +2 -0
  16. package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.native.js +2 -0
  17. package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.js +5 -1
  18. package/lib/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.js +3 -4
  19. package/lib/pushNotifications/providers/pinpoint/utils/index.d.ts +0 -4
  20. package/lib/pushNotifications/providers/pinpoint/utils/index.js +0 -10
  21. package/lib/pushNotifications/utils/index.d.ts +4 -0
  22. package/lib/pushNotifications/utils/index.js +14 -0
  23. package/lib/pushNotifications/{providers/pinpoint/utils → utils}/resolveConfig.js +1 -1
  24. package/lib/pushNotifications/{providers/pinpoint/utils → utils}/resolveCredentials.js +1 -1
  25. package/lib/tsconfig.build.tsbuildinfo +330 -425
  26. package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.d.ts +4 -4
  27. package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.js +4 -4
  28. package/lib-esm/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js +3 -4
  29. package/lib-esm/inAppMessaging/providers/pinpoint/utils/helpers.js +1 -1
  30. package/lib-esm/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.d.ts +1 -1
  31. package/lib-esm/pushNotifications/errors/errorHelpers.d.ts +1 -0
  32. package/lib-esm/pushNotifications/errors/errorHelpers.js +4 -0
  33. package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.js +7 -3
  34. package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.js +2 -0
  35. package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.js +2 -0
  36. package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.native.js +6 -2
  37. package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.js +2 -1
  38. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.js +2 -0
  39. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.js +5 -1
  40. package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.js +5 -1
  41. package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.js +2 -0
  42. package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.native.js +2 -0
  43. package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.js +5 -1
  44. package/lib-esm/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.js +1 -2
  45. package/lib-esm/pushNotifications/providers/pinpoint/utils/index.d.ts +0 -4
  46. package/lib-esm/pushNotifications/providers/pinpoint/utils/index.js +0 -4
  47. package/lib-esm/pushNotifications/utils/index.d.ts +4 -0
  48. package/lib-esm/pushNotifications/utils/index.js +6 -0
  49. package/lib-esm/pushNotifications/{providers/pinpoint/utils → utils}/resolveConfig.js +1 -1
  50. package/lib-esm/pushNotifications/{providers/pinpoint/utils → utils}/resolveCredentials.js +1 -1
  51. package/lib-esm/tsconfig.build.tsbuildinfo +228 -233
  52. package/package.json +4 -4
  53. package/src/inAppMessaging/providers/pinpoint/apis/identifyUser.ts +4 -4
  54. package/src/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.ts +3 -4
  55. package/src/inAppMessaging/providers/pinpoint/utils/helpers.ts +1 -3
  56. package/src/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.ts +1 -1
  57. package/src/pushNotifications/errors/errorHelpers.ts +5 -0
  58. package/src/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.ts +5 -1
  59. package/src/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.ts +5 -2
  60. package/src/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.ts +5 -2
  61. package/src/pushNotifications/providers/pinpoint/apis/identifyUser.native.ts +4 -6
  62. package/src/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.ts +5 -3
  63. package/src/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.ts +5 -2
  64. package/src/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.ts +5 -1
  65. package/src/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.ts +5 -1
  66. package/src/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.ts +5 -2
  67. package/src/pushNotifications/providers/pinpoint/apis/requestPermissions.native.ts +5 -2
  68. package/src/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.ts +5 -1
  69. package/src/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.ts +1 -2
  70. package/src/pushNotifications/providers/pinpoint/utils/index.ts +0 -4
  71. package/src/pushNotifications/utils/index.ts +7 -0
  72. package/src/pushNotifications/{providers/pinpoint/utils → utils}/resolveConfig.ts +1 -1
  73. package/src/pushNotifications/{providers/pinpoint/utils → utils}/resolveCredentials.ts +1 -1
  74. package/lib/inAppMessaging/sessionTracker/SessionTracker.d.ts +0 -9
  75. package/lib/inAppMessaging/sessionTracker/SessionTracker.js +0 -67
  76. package/lib/inAppMessaging/sessionTracker/SessionTracker.native.d.ts +0 -10
  77. package/lib/inAppMessaging/sessionTracker/SessionTracker.native.js +0 -52
  78. package/lib/inAppMessaging/sessionTracker/index.d.ts +0 -3
  79. package/lib/inAppMessaging/sessionTracker/index.js +0 -7
  80. package/lib/inAppMessaging/sessionTracker/types.d.ts +0 -6
  81. package/lib/inAppMessaging/sessionTracker/types.js +0 -4
  82. package/lib/pushNotifications/Platform/index.d.ts +0 -2
  83. package/lib/pushNotifications/Platform/index.js +0 -25
  84. package/lib/pushNotifications/Platform/index.native.d.ts +0 -2
  85. package/lib/pushNotifications/Platform/index.native.js +0 -7
  86. package/lib/pushNotifications/Platform/types.d.ts +0 -5
  87. package/lib/pushNotifications/Platform/types.js +0 -4
  88. package/lib-esm/inAppMessaging/sessionTracker/SessionTracker.d.ts +0 -9
  89. package/lib-esm/inAppMessaging/sessionTracker/SessionTracker.js +0 -64
  90. package/lib-esm/inAppMessaging/sessionTracker/SessionTracker.native.d.ts +0 -10
  91. package/lib-esm/inAppMessaging/sessionTracker/SessionTracker.native.js +0 -49
  92. package/lib-esm/inAppMessaging/sessionTracker/index.d.ts +0 -3
  93. package/lib-esm/inAppMessaging/sessionTracker/index.js +0 -4
  94. package/lib-esm/inAppMessaging/sessionTracker/types.d.ts +0 -6
  95. package/lib-esm/inAppMessaging/sessionTracker/types.js +0 -2
  96. package/lib-esm/pushNotifications/Platform/index.d.ts +0 -2
  97. package/lib-esm/pushNotifications/Platform/index.js +0 -23
  98. package/lib-esm/pushNotifications/Platform/index.native.d.ts +0 -2
  99. package/lib-esm/pushNotifications/Platform/index.native.js +0 -5
  100. package/lib-esm/pushNotifications/Platform/types.d.ts +0 -5
  101. package/lib-esm/pushNotifications/Platform/types.js +0 -2
  102. package/src/inAppMessaging/sessionTracker/SessionTracker.native.ts +0 -60
  103. package/src/inAppMessaging/sessionTracker/SessionTracker.ts +0 -78
  104. package/src/inAppMessaging/sessionTracker/index.ts +0 -6
  105. package/src/inAppMessaging/sessionTracker/types.ts +0 -11
  106. package/src/pushNotifications/Platform/index.native.ts +0 -9
  107. package/src/pushNotifications/Platform/index.ts +0 -22
  108. package/src/pushNotifications/Platform/types.ts +0 -15
  109. /package/lib/pushNotifications/{providers/pinpoint/utils → utils}/initializationManager.d.ts +0 -0
  110. /package/lib/pushNotifications/{providers/pinpoint/utils → utils}/initializationManager.js +0 -0
  111. /package/lib/pushNotifications/{providers/pinpoint/utils → utils}/resolveConfig.d.ts +0 -0
  112. /package/lib/pushNotifications/{providers/pinpoint/utils → utils}/resolveCredentials.d.ts +0 -0
  113. /package/lib/pushNotifications/{providers/pinpoint/utils → utils}/tokenManager.d.ts +0 -0
  114. /package/lib/pushNotifications/{providers/pinpoint/utils → utils}/tokenManager.js +0 -0
  115. /package/lib-esm/pushNotifications/{providers/pinpoint/utils → utils}/initializationManager.d.ts +0 -0
  116. /package/lib-esm/pushNotifications/{providers/pinpoint/utils → utils}/initializationManager.js +0 -0
  117. /package/lib-esm/pushNotifications/{providers/pinpoint/utils → utils}/resolveConfig.d.ts +0 -0
  118. /package/lib-esm/pushNotifications/{providers/pinpoint/utils → utils}/resolveCredentials.d.ts +0 -0
  119. /package/lib-esm/pushNotifications/{providers/pinpoint/utils → utils}/tokenManager.d.ts +0 -0
  120. /package/lib-esm/pushNotifications/{providers/pinpoint/utils → utils}/tokenManager.js +0 -0
  121. /package/src/pushNotifications/{providers/pinpoint/utils → utils}/initializationManager.ts +0 -0
  122. /package/src/pushNotifications/{providers/pinpoint/utils → utils}/tokenManager.ts +0 -0
@@ -1,10 +0,0 @@
1
- import { SessionState, SessionStateChangeHandler, SessionTrackerInterface } from './types';
2
- export default class SessionTracker implements SessionTrackerInterface {
3
- private currentAppState;
4
- private sessionStateChangeHandler;
5
- constructor(sessionStateChangeHandler?: SessionStateChangeHandler);
6
- start: () => SessionState;
7
- end: () => SessionState;
8
- private getSessionState;
9
- private appStateChangeHandler;
10
- }
@@ -1,49 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { ConsoleLogger } from '@aws-amplify/core';
4
- import { AppState } from 'react-native';
5
- import noop from 'lodash/noop';
6
- var isActive = function (appState) { return appState === 'active'; };
7
- var isInactive = function (appState) {
8
- return appState === 'inactive' || appState === 'background';
9
- };
10
- var logger = new ConsoleLogger('InAppMessagingSessionTracker');
11
- var SessionTracker = /** @class */ (function () {
12
- function SessionTracker(sessionStateChangeHandler) {
13
- var _this = this;
14
- if (sessionStateChangeHandler === void 0) { sessionStateChangeHandler = noop; }
15
- this.start = function () {
16
- AppState.addEventListener('change', _this.appStateChangeHandler);
17
- return _this.getSessionState();
18
- };
19
- this.end = function () {
20
- AppState.removeEventListener('change', _this.appStateChangeHandler);
21
- return _this.getSessionState();
22
- };
23
- this.getSessionState = function () {
24
- if (isActive(_this.currentAppState)) {
25
- return 'started';
26
- }
27
- // consider any other app state as session ended
28
- return 'ended';
29
- };
30
- this.appStateChangeHandler = function (nextAppState) {
31
- // if going from active to inactive
32
- if (isActive(_this.currentAppState) && isInactive(nextAppState)) {
33
- logger.debug('App has gone to the background');
34
- _this.sessionStateChangeHandler('ended');
35
- }
36
- // if going from inactive to active
37
- if (isInactive(_this.currentAppState) && isActive(nextAppState)) {
38
- logger.debug('App has come to the foreground');
39
- _this.sessionStateChangeHandler('started');
40
- }
41
- // otherwise do nothing but always update current state
42
- _this.currentAppState = nextAppState;
43
- };
44
- this.currentAppState = 'active';
45
- this.sessionStateChangeHandler = sessionStateChangeHandler;
46
- }
47
- return SessionTracker;
48
- }());
49
- export default SessionTracker;
@@ -1,3 +0,0 @@
1
- import { default as SessionTracker } from './SessionTracker';
2
- export * from './types';
3
- export default SessionTracker;
@@ -1,4 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { default as SessionTracker } from './SessionTracker';
4
- export default SessionTracker;
@@ -1,6 +0,0 @@
1
- export declare type SessionState = 'started' | 'ended';
2
- export declare type SessionStateChangeHandler = (state: SessionState) => void;
3
- export interface SessionTrackerInterface {
4
- start: () => SessionState;
5
- end: () => SessionState;
6
- }
@@ -1,2 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
@@ -1,2 +0,0 @@
1
- import { Platform as PlatformInterface } from './types';
2
- export declare const Platform: PlatformInterface;
@@ -1,23 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- var userAgentIncludes = function (text) {
4
- var _a;
5
- return (_a = navigator === null || navigator === void 0 ? void 0 : navigator.userAgent) === null || _a === void 0 ? void 0 : _a.includes(text);
6
- };
7
- var getOS = function () {
8
- if (userAgentIncludes('Android'))
9
- return 'android';
10
- if (userAgentIncludes('like Mac'))
11
- return 'ios';
12
- if (userAgentIncludes('Win'))
13
- return 'windows';
14
- if (userAgentIncludes('Mac'))
15
- return 'macos';
16
- if (userAgentIncludes('Linux'))
17
- return 'linux';
18
- if (userAgentIncludes('X11'))
19
- return 'unix';
20
- return 'unknown';
21
- };
22
- var OS = getOS();
23
- export var Platform = { OS: OS };
@@ -1,2 +0,0 @@
1
- import { Platform as PlatformInterface } from './types';
2
- export declare const Platform: PlatformInterface;
@@ -1,5 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { Platform as NativePlatform } from 'react-native';
4
- var OS = NativePlatform.OS;
5
- export var Platform = { OS: OS };
@@ -1,5 +0,0 @@
1
- export interface Platform {
2
- OS: KnownOS | 'unknown';
3
- }
4
- declare type KnownOS = 'windows' | 'macos' | 'unix' | 'linux' | 'ios' | 'android' | 'web';
5
- export {};
@@ -1,2 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
@@ -1,60 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { ConsoleLogger } from '@aws-amplify/core';
5
- import { AppState, AppStateStatus } from 'react-native';
6
- import noop from 'lodash/noop';
7
- import {
8
- SessionState,
9
- SessionStateChangeHandler,
10
- SessionTrackerInterface,
11
- } from './types';
12
-
13
- const isActive = appState => appState === 'active';
14
- const isInactive = appState =>
15
- appState === 'inactive' || appState === 'background';
16
-
17
- const logger = new ConsoleLogger('InAppMessagingSessionTracker');
18
-
19
- export default class SessionTracker implements SessionTrackerInterface {
20
- private currentAppState: AppStateStatus;
21
- private sessionStateChangeHandler: SessionStateChangeHandler;
22
-
23
- constructor(sessionStateChangeHandler: SessionStateChangeHandler = noop) {
24
- this.currentAppState = 'active';
25
- this.sessionStateChangeHandler = sessionStateChangeHandler;
26
- }
27
-
28
- start = (): SessionState => {
29
- AppState.addEventListener('change', this.appStateChangeHandler);
30
- return this.getSessionState();
31
- };
32
-
33
- end = (): SessionState => {
34
- AppState.removeEventListener('change', this.appStateChangeHandler);
35
- return this.getSessionState();
36
- };
37
-
38
- private getSessionState = (): SessionState => {
39
- if (isActive(this.currentAppState)) {
40
- return 'started';
41
- }
42
- // consider any other app state as session ended
43
- return 'ended';
44
- };
45
-
46
- private appStateChangeHandler = nextAppState => {
47
- // if going from active to inactive
48
- if (isActive(this.currentAppState) && isInactive(nextAppState)) {
49
- logger.debug('App has gone to the background');
50
- this.sessionStateChangeHandler('ended');
51
- }
52
- // if going from inactive to active
53
- if (isInactive(this.currentAppState) && isActive(nextAppState)) {
54
- logger.debug('App has come to the foreground');
55
- this.sessionStateChangeHandler('started');
56
- }
57
- // otherwise do nothing but always update current state
58
- this.currentAppState = nextAppState;
59
- };
60
- }
@@ -1,78 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { isBrowser } from '@aws-amplify/core/internals/utils';
4
- import { ConsoleLogger } from '@aws-amplify/core';
5
- import noop from 'lodash/noop';
6
- import {
7
- SessionState,
8
- SessionStateChangeHandler,
9
- SessionTrackerInterface,
10
- } from './types';
11
-
12
- // Per https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API
13
- let hidden: string;
14
- let visibilityChange: string;
15
-
16
- if (isBrowser() && document) {
17
- if (typeof document.hidden !== 'undefined') {
18
- hidden = 'hidden';
19
- visibilityChange = 'visibilitychange';
20
- } else if (typeof document['msHidden'] !== 'undefined') {
21
- hidden = 'msHidden';
22
- visibilityChange = 'msvisibilitychange';
23
- } else if (typeof document['webkitHidden'] !== 'undefined') {
24
- hidden = 'webkitHidden';
25
- visibilityChange = 'webkitvisibilitychange';
26
- }
27
- }
28
-
29
- const logger = new ConsoleLogger('InAppMessagingSessionTracker');
30
-
31
- export default class SessionTracker implements SessionTrackerInterface {
32
- private sessionStateChangeHandler: SessionStateChangeHandler;
33
-
34
- constructor(sessionStateChangeHandler: SessionStateChangeHandler = noop) {
35
- this.sessionStateChangeHandler = sessionStateChangeHandler;
36
- }
37
-
38
- start = (): SessionState => {
39
- if (isBrowser()) {
40
- document?.addEventListener(
41
- visibilityChange,
42
- this.visibilityChangeHandler
43
- );
44
- }
45
- return this.getSessionState();
46
- };
47
-
48
- end = (): SessionState => {
49
- if (isBrowser()) {
50
- document?.removeEventListener(
51
- visibilityChange,
52
- this.visibilityChangeHandler
53
- );
54
- }
55
- return this.getSessionState();
56
- };
57
-
58
- private getSessionState = (): SessionState => {
59
- if (isBrowser() && document && !document[hidden]) {
60
- return 'started';
61
- }
62
- // If, for any reason, document is undefined the session will never start
63
- return 'ended';
64
- };
65
-
66
- private visibilityChangeHandler = () => {
67
- if (!isBrowser() || !document) {
68
- return;
69
- }
70
- if (document[hidden]) {
71
- logger.debug('App is now hidden');
72
- this.sessionStateChangeHandler('ended');
73
- } else {
74
- logger.debug('App is now visible');
75
- this.sessionStateChangeHandler('started');
76
- }
77
- };
78
- }
@@ -1,6 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { default as SessionTracker } from './SessionTracker';
5
- export * from './types';
6
- export default SessionTracker;
@@ -1,11 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- export type SessionState = 'started' | 'ended';
5
-
6
- export type SessionStateChangeHandler = (state: SessionState) => void;
7
-
8
- export interface SessionTrackerInterface {
9
- start: () => SessionState;
10
- end: () => SessionState;
11
- }
@@ -1,9 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { Platform as NativePlatform } from 'react-native';
5
- import { Platform as PlatformInterface } from './types';
6
-
7
- const { OS } = NativePlatform;
8
-
9
- export const Platform: PlatformInterface = { OS };
@@ -1,22 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- import { Platform as PlatformInterface } from './types';
5
-
6
- const userAgentIncludes = (text: string): boolean => {
7
- return navigator?.userAgent?.includes(text);
8
- };
9
-
10
- const getOS = (): PlatformInterface['OS'] => {
11
- if (userAgentIncludes('Android')) return 'android';
12
- if (userAgentIncludes('like Mac')) return 'ios';
13
- if (userAgentIncludes('Win')) return 'windows';
14
- if (userAgentIncludes('Mac')) return 'macos';
15
- if (userAgentIncludes('Linux')) return 'linux';
16
- if (userAgentIncludes('X11')) return 'unix';
17
- return 'unknown';
18
- };
19
-
20
- const OS = getOS();
21
-
22
- export const Platform: PlatformInterface = { OS };
@@ -1,15 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
-
4
- export interface Platform {
5
- OS: KnownOS | 'unknown';
6
- }
7
-
8
- type KnownOS =
9
- | 'windows'
10
- | 'macos'
11
- | 'unix'
12
- | 'linux'
13
- | 'ios'
14
- | 'android'
15
- | 'web';