@aws-amplify/ui-react-core 1.0.5 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/Authenticator/context/AuthenticatorContext.js +4 -1
- package/dist/esm/Authenticator/context/AuthenticatorProvider.js +8 -4
- package/dist/esm/Authenticator/hooks/useAuthenticator/constants.js +4 -2
- package/dist/esm/Authenticator/hooks/useAuthenticator/useAuthenticator.js +10 -10
- package/dist/esm/Authenticator/hooks/useAuthenticator/utils.js +13 -10
- package/dist/esm/InAppMessaging/context/InAppMessagingContext/InAppMessagingContext.js +5 -0
- package/dist/esm/InAppMessaging/context/InAppMessagingProvider/InAppMessagingProvider.js +26 -0
- package/dist/esm/InAppMessaging/hooks/useInAppMessaging/useInAppMessaging.js +19 -0
- package/dist/esm/InAppMessaging/hooks/useMessage/useMessage.js +78 -0
- package/dist/esm/InAppMessaging/hooks/useMessage/utils.js +43 -0
- package/dist/esm/InAppMessaging/utils/handleMessageAction.js +16 -0
- package/dist/esm/components/RenderNothing/RenderNothing.js +8 -0
- package/dist/esm/index.js +8 -1
- package/dist/esm/node_modules/tslib/tslib.es6.js +38 -0
- package/dist/esm/utils/index.js +5 -2
- package/dist/index.js +348 -6
- package/dist/{esm/Authenticator/hooks/useAuthenticator/types.js → types/Authenticator/context/__tests__/AuthenticatorProvider.test.d.ts} +0 -0
- package/dist/types/Authenticator/hooks/useAuthenticator/__tests__/useAuthenticator.spec.d.ts +1 -0
- package/dist/types/Authenticator/hooks/useAuthenticator/__tests__/utils.spec.d.ts +1 -0
- package/dist/types/Authenticator/hooks/useAuthenticator/types.d.ts +1 -9
- package/dist/types/InAppMessaging/context/InAppMessagingContext/InAppMessagingContext.d.ts +9 -0
- package/dist/types/InAppMessaging/context/InAppMessagingContext/index.d.ts +1 -0
- package/dist/types/InAppMessaging/context/InAppMessagingProvider/InAppMessagingProvider.d.ts +5 -0
- package/dist/types/InAppMessaging/context/InAppMessagingProvider/__tests__/InAppMessagingProvider.spec.d.ts +1 -0
- package/dist/types/InAppMessaging/context/InAppMessagingProvider/index.d.ts +1 -0
- package/dist/types/InAppMessaging/context/index.d.ts +2 -0
- package/dist/types/InAppMessaging/hooks/index.d.ts +2 -0
- package/dist/types/InAppMessaging/hooks/useInAppMessaging/__tests__/useInAppMessaging.spec.d.ts +1 -0
- package/dist/types/InAppMessaging/hooks/useInAppMessaging/index.d.ts +1 -0
- package/dist/types/InAppMessaging/hooks/useInAppMessaging/useInAppMessaging.d.ts +7 -0
- package/dist/types/InAppMessaging/hooks/useMessage/__tests__/useMessage.spec.d.ts +1 -0
- package/dist/types/InAppMessaging/hooks/useMessage/__tests__/utils.spec.d.ts +1 -0
- package/dist/types/InAppMessaging/hooks/useMessage/index.d.ts +1 -0
- package/dist/types/InAppMessaging/hooks/useMessage/types.d.ts +18 -0
- package/dist/types/InAppMessaging/hooks/useMessage/useMessage.d.ts +9 -0
- package/dist/types/InAppMessaging/hooks/useMessage/utils.d.ts +9 -0
- package/dist/{esm/Authenticator/index.js → types/InAppMessaging/index.d.ts} +3 -1
- package/dist/types/InAppMessaging/types.d.ts +52 -0
- package/dist/types/InAppMessaging/utils/__tests__/handleMessageAction.spec.d.ts +1 -0
- package/dist/types/InAppMessaging/utils/handleMessageAction.d.ts +9 -0
- package/dist/types/InAppMessaging/utils/index.d.ts +1 -0
- package/dist/types/__tests__/index.spec.d.ts +1 -0
- package/dist/types/components/RenderNothing/RenderNothing.d.ts +4 -0
- package/dist/types/components/RenderNothing/__tests__/RenderNothing.spec.d.ts +1 -0
- package/dist/types/components/RenderNothing/index.d.ts +1 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/utils/__tests__/index.spec.d.ts +1 -0
- package/package.json +14 -9
- package/dist/Authenticator/context/AuthenticatorContext.js +0 -11
- package/dist/Authenticator/context/AuthenticatorProvider.js +0 -26
- package/dist/Authenticator/context/index.js +0 -10
- package/dist/Authenticator/hooks/index.js +0 -4
- package/dist/Authenticator/hooks/useAuthenticator/constants.js +0 -16
- package/dist/Authenticator/hooks/useAuthenticator/index.js +0 -8
- package/dist/Authenticator/hooks/useAuthenticator/types.js +0 -2
- package/dist/Authenticator/hooks/useAuthenticator/useAuthenticator.js +0 -38
- package/dist/Authenticator/hooks/useAuthenticator/utils.js +0 -53
- package/dist/Authenticator/index.js +0 -5
- package/dist/esm/Authenticator/context/index.js +0 -2
- package/dist/esm/Authenticator/hooks/index.js +0 -1
- package/dist/esm/Authenticator/hooks/useAuthenticator/index.js +0 -1
- package/dist/utils/index.js +0 -20
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
4
|
* AuthenticatorContext serves static reference to the auth machine service.
|
|
4
5
|
*
|
|
5
6
|
* https://xstate.js.org/docs/recipes/react.html#context-provider
|
|
6
7
|
*/
|
|
7
|
-
|
|
8
|
+
const AuthenticatorContext = React.createContext(null);
|
|
9
|
+
|
|
10
|
+
export { AuthenticatorContext };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useContext, useMemo, useEffect } from 'react';
|
|
2
3
|
import { useInterpret } from '@xstate/react';
|
|
3
4
|
import { createAuthenticatorMachine, listenToAuthHub } from '@aws-amplify/ui';
|
|
4
|
-
import { AuthenticatorContext } from './AuthenticatorContext';
|
|
5
|
-
|
|
5
|
+
import { AuthenticatorContext } from './AuthenticatorContext.js';
|
|
6
|
+
|
|
7
|
+
function AuthenticatorProvider({ children, }) {
|
|
6
8
|
/**
|
|
7
9
|
* Based on use cases, developer might already have added another Provider
|
|
8
10
|
* outside Authenticator. In that case, we sync the two providers by just
|
|
@@ -18,5 +20,7 @@ export default function AuthenticatorProvider({ children, }) {
|
|
|
18
20
|
const unsubscribe = listenToAuthHub(activeService);
|
|
19
21
|
return unsubscribe;
|
|
20
22
|
}, [activeService]);
|
|
21
|
-
return (
|
|
23
|
+
return (jsx(AuthenticatorContext.Provider, Object.assign({ value: value }, { children: children })));
|
|
22
24
|
}
|
|
25
|
+
|
|
26
|
+
export { AuthenticatorProvider as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const USE_AUTHENTICATOR_ERROR = '`useAuthenticator` must be used inside an `Authenticator.Provider`.';
|
|
2
|
+
const COMPONENT_ROUTE_KEYS = [
|
|
3
3
|
'signIn',
|
|
4
4
|
'signUp',
|
|
5
5
|
'forceNewPassword',
|
|
@@ -11,3 +11,5 @@ export const COMPONENT_ROUTE_KEYS = [
|
|
|
11
11
|
'setupTOTP',
|
|
12
12
|
'verifyUser',
|
|
13
13
|
];
|
|
14
|
+
|
|
15
|
+
export { COMPONENT_ROUTE_KEYS, USE_AUTHENTICATOR_ERROR };
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { __rest } from
|
|
1
|
+
import { __rest } from '../../../node_modules/tslib/tslib.es6.js';
|
|
2
2
|
import React, { useCallback, useMemo } from 'react';
|
|
3
3
|
import { useSelector } from '@xstate/react';
|
|
4
4
|
import { getServiceFacade } from '@aws-amplify/ui';
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import 'react/jsx-runtime';
|
|
6
|
+
import { AuthenticatorContext } from '../../context/AuthenticatorContext.js';
|
|
7
|
+
import { USE_AUTHENTICATOR_ERROR } from './constants.js';
|
|
8
|
+
import { getLegacyFields, getTotpSecretCodeCallback, getComparator, defaultComparator } from './utils.js';
|
|
9
|
+
|
|
8
10
|
/**
|
|
9
11
|
* [📖 Docs](https://ui.docs.amplify.aws/react/connected-components/authenticator/headless#useauthenticator-hook)
|
|
10
12
|
*/
|
|
11
|
-
|
|
13
|
+
function useAuthenticator(selector) {
|
|
12
14
|
const context = React.useContext(AuthenticatorContext);
|
|
13
15
|
if (!context) {
|
|
14
16
|
throw new Error(USE_AUTHENTICATOR_ERROR);
|
|
@@ -27,9 +29,7 @@ export default function useAuthenticator(selector) {
|
|
|
27
29
|
return Object.assign(Object.assign({}, rest), { getTotpSecretCode: getTotpSecretCodeCallback(user), route,
|
|
28
30
|
user,
|
|
29
31
|
/** @deprecated For internal use only */
|
|
30
|
-
fields
|
|
31
|
-
/** @deprecated For internal use only */
|
|
32
|
-
_state: serviceSnapshot,
|
|
33
|
-
/** @deprecated For internal use only */
|
|
34
|
-
_send: send });
|
|
32
|
+
fields });
|
|
35
33
|
}
|
|
34
|
+
|
|
35
|
+
export { useAuthenticator as default };
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { __awaiter } from
|
|
1
|
+
import { __awaiter } from '../../../node_modules/tslib/tslib.es6.js';
|
|
2
2
|
import { Auth } from 'aws-amplify';
|
|
3
|
-
import { getSortedFormFields
|
|
4
|
-
import { areEmptyArrays, areEmptyObjects } from '../../../utils';
|
|
5
|
-
import { COMPONENT_ROUTE_KEYS } from './constants';
|
|
6
|
-
|
|
3
|
+
import { getSortedFormFields } from '@aws-amplify/ui';
|
|
4
|
+
import { areEmptyArrays, areEmptyObjects } from '../../../utils/index.js';
|
|
5
|
+
import { COMPONENT_ROUTE_KEYS } from './constants.js';
|
|
6
|
+
|
|
7
|
+
const defaultComparator = () => false;
|
|
7
8
|
/**
|
|
8
9
|
* Does an ordering and shallow comparison of each array value,
|
|
9
10
|
* plus a value equality check for empty objects and arrays.
|
|
10
11
|
*/
|
|
11
|
-
|
|
12
|
+
function areSelectorDepsEqual(currentDeps, nextDeps) {
|
|
12
13
|
if (currentDeps.length !== nextDeps.length) {
|
|
13
14
|
return false;
|
|
14
15
|
}
|
|
@@ -21,24 +22,26 @@ export function areSelectorDepsEqual(currentDeps, nextDeps) {
|
|
|
21
22
|
return currentDep === nextDep;
|
|
22
23
|
});
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
+
const getComparator = (selector) => (currentFacade, nextFacade) => {
|
|
25
26
|
const currentSelectorDeps = selector(currentFacade);
|
|
26
27
|
const nextSelectorDeps = selector(nextFacade);
|
|
27
28
|
// Shallow compare the array values
|
|
28
29
|
return areSelectorDepsEqual(currentSelectorDeps, nextSelectorDeps);
|
|
29
30
|
};
|
|
30
|
-
|
|
31
|
+
const getTotpSecretCodeCallback = (user) => function getTotpSecretCode() {
|
|
31
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
33
|
return yield Auth.setupTOTP(user);
|
|
33
34
|
});
|
|
34
35
|
};
|
|
35
|
-
|
|
36
|
+
const isComponentRouteKey = (route) => COMPONENT_ROUTE_KEYS.some((componentRoute) => componentRoute === route);
|
|
36
37
|
const flattenFormFields = (fields) => fields.flatMap(([name, options]) => (Object.assign({ name }, options)));
|
|
37
38
|
/**
|
|
38
39
|
* Retrieves legacy form field values from state machine for routes that have fields
|
|
39
40
|
*/
|
|
40
|
-
|
|
41
|
+
const getLegacyFields = (route, state) =>
|
|
41
42
|
// verifyUser is a component route, but does not have form fields
|
|
42
43
|
isComponentRouteKey(route) && route !== 'verifyUser'
|
|
43
44
|
? flattenFormFields(getSortedFormFields(route, state))
|
|
44
45
|
: [];
|
|
46
|
+
|
|
47
|
+
export { areSelectorDepsEqual, defaultComparator, getComparator, getLegacyFields, getTotpSecretCodeCallback, isComponentRouteKey };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, useEffect, useCallback, useMemo } from 'react';
|
|
3
|
+
import { Notifications } from '@aws-amplify/notifications';
|
|
4
|
+
import InAppMessagingContext from '../InAppMessagingContext/InAppMessagingContext.js';
|
|
5
|
+
|
|
6
|
+
const { InAppMessaging } = Notifications;
|
|
7
|
+
function InAppMessagingProvider({ children, }) {
|
|
8
|
+
const [message, setMessage] = useState(null);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const listener = InAppMessaging.onMessageReceived((message) => {
|
|
11
|
+
setMessage(message);
|
|
12
|
+
});
|
|
13
|
+
return listener.remove;
|
|
14
|
+
}, []);
|
|
15
|
+
const clearMessage = useCallback(() => {
|
|
16
|
+
setMessage(null);
|
|
17
|
+
}, []);
|
|
18
|
+
const value = useMemo(() => ({
|
|
19
|
+
clearMessage,
|
|
20
|
+
displayMessage: setMessage,
|
|
21
|
+
message,
|
|
22
|
+
}), [clearMessage, message]);
|
|
23
|
+
return (jsx(InAppMessagingContext.Provider, Object.assign({ value: value }, { children: children })));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { InAppMessagingProvider as default };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { useContext } from 'react';
|
|
2
|
+
import InAppMessagingContext from '../../context/InAppMessagingContext/InAppMessagingContext.js';
|
|
3
|
+
import 'react/jsx-runtime';
|
|
4
|
+
import '@aws-amplify/notifications';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Utility hook used to access the InAppMessagingContext values
|
|
8
|
+
*
|
|
9
|
+
* @returns {InAppMessagingContextType} InAppMessaging context values
|
|
10
|
+
*/
|
|
11
|
+
function useInAppMessaging() {
|
|
12
|
+
const inAppMessagingContext = useContext(InAppMessagingContext);
|
|
13
|
+
if (!inAppMessagingContext) {
|
|
14
|
+
throw new Error('InAppMessagingContext is empty, did you forget the InAppMessagingProvider?');
|
|
15
|
+
}
|
|
16
|
+
return inAppMessagingContext;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { useInAppMessaging as default };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ConsoleLogger } from '@aws-amplify/core';
|
|
2
|
+
import { InAppMessageInteractionEvent, Notifications } from '@aws-amplify/notifications';
|
|
3
|
+
import isNil from 'lodash/isNil';
|
|
4
|
+
import RenderNothng from '../../../components/RenderNothing/RenderNothing.js';
|
|
5
|
+
import useInAppMessaging from '../useInAppMessaging/useInAppMessaging.js';
|
|
6
|
+
import { getContentProps, getPositionProp } from './utils.js';
|
|
7
|
+
|
|
8
|
+
const EMPTY_PROPS = Object.freeze({});
|
|
9
|
+
const logger = new ConsoleLogger('Notifications.InAppMessaging');
|
|
10
|
+
const { InAppMessaging } = Notifications;
|
|
11
|
+
/**
|
|
12
|
+
* Utility hook for parsing a message and retrieving its corresponding UI component and props
|
|
13
|
+
*
|
|
14
|
+
* @param {UseMessageParams} props - platform specific UI components, action handler, and styles
|
|
15
|
+
* @returns {UseMessage} message UI component and props
|
|
16
|
+
*/
|
|
17
|
+
function useMessage({ components, onMessageAction, }) {
|
|
18
|
+
const { clearMessage, message } = useInAppMessaging();
|
|
19
|
+
const { BannerMessage, CarouselMessage, FullScreenMessage, ModalMessage } = components;
|
|
20
|
+
if (isNil(message)) {
|
|
21
|
+
return {
|
|
22
|
+
Component: RenderNothng,
|
|
23
|
+
props: EMPTY_PROPS,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
const { content, layout } = message;
|
|
27
|
+
const onActionCallback = () => {
|
|
28
|
+
InAppMessaging.notifyMessageInteraction(message, InAppMessageInteractionEvent.MESSAGE_ACTION_TAKEN);
|
|
29
|
+
clearMessage();
|
|
30
|
+
};
|
|
31
|
+
const onClose = () => {
|
|
32
|
+
InAppMessaging.notifyMessageInteraction(message, InAppMessageInteractionEvent.MESSAGE_DISMISSED);
|
|
33
|
+
clearMessage();
|
|
34
|
+
};
|
|
35
|
+
const onDisplay = () => {
|
|
36
|
+
InAppMessaging.notifyMessageInteraction(message, InAppMessageInteractionEvent.MESSAGE_DISPLAYED);
|
|
37
|
+
};
|
|
38
|
+
switch (layout) {
|
|
39
|
+
case 'BOTTOM_BANNER':
|
|
40
|
+
case 'MIDDLE_BANNER':
|
|
41
|
+
case 'TOP_BANNER': {
|
|
42
|
+
const props = Object.assign(Object.assign({}, getContentProps(content === null || content === void 0 ? void 0 : content[0], onMessageAction, onActionCallback)), { layout,
|
|
43
|
+
onClose,
|
|
44
|
+
onDisplay, position: getPositionProp(layout) });
|
|
45
|
+
return { Component: BannerMessage, props };
|
|
46
|
+
}
|
|
47
|
+
case 'CAROUSEL': {
|
|
48
|
+
const props = {
|
|
49
|
+
data: content === null || content === void 0 ? void 0 : content.map((item) => getContentProps(item, onMessageAction, onActionCallback)),
|
|
50
|
+
layout,
|
|
51
|
+
onClose,
|
|
52
|
+
onDisplay,
|
|
53
|
+
};
|
|
54
|
+
return { Component: CarouselMessage, props };
|
|
55
|
+
}
|
|
56
|
+
case 'FULL_SCREEN': {
|
|
57
|
+
const props = Object.assign(Object.assign({}, getContentProps(content === null || content === void 0 ? void 0 : content[0], onMessageAction, onActionCallback)), { layout,
|
|
58
|
+
onClose,
|
|
59
|
+
onDisplay });
|
|
60
|
+
return { Component: FullScreenMessage, props };
|
|
61
|
+
}
|
|
62
|
+
case 'MODAL': {
|
|
63
|
+
const props = Object.assign(Object.assign({}, getContentProps(content === null || content === void 0 ? void 0 : content[0], onMessageAction, onActionCallback)), { layout,
|
|
64
|
+
onClose,
|
|
65
|
+
onDisplay });
|
|
66
|
+
return { Component: ModalMessage, props };
|
|
67
|
+
}
|
|
68
|
+
default: {
|
|
69
|
+
logger.info(`Received unknown InAppMessage layout: ${layout}`);
|
|
70
|
+
return {
|
|
71
|
+
Component: RenderNothng,
|
|
72
|
+
props: EMPTY_PROPS,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export { EMPTY_PROPS, useMessage as default };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { __rest } from '../../../node_modules/tslib/tslib.es6.js';
|
|
2
|
+
import { ConsoleLogger } from '@aws-amplify/core';
|
|
3
|
+
|
|
4
|
+
const logger = new ConsoleLogger('Notifications.InAppMessaging');
|
|
5
|
+
const positions = {
|
|
6
|
+
BOTTOM_BANNER: 'bottom',
|
|
7
|
+
MIDDLE_BANNER: 'middle',
|
|
8
|
+
TOP_BANNER: 'top',
|
|
9
|
+
};
|
|
10
|
+
const getPositionProp = (layout) => positions[layout];
|
|
11
|
+
const getActionHandler = (actionParams, onMessageAction, onActionCallback) => ({
|
|
12
|
+
onAction() {
|
|
13
|
+
try {
|
|
14
|
+
onMessageAction(actionParams);
|
|
15
|
+
}
|
|
16
|
+
catch (e) {
|
|
17
|
+
logger.error(`Message action failure: ${e}`);
|
|
18
|
+
}
|
|
19
|
+
finally {
|
|
20
|
+
onActionCallback();
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
const getButtonProps = (_a, onMessageAction, onActionCallback) => {
|
|
25
|
+
var { action, url } = _a, baseButtonProps = __rest(_a, ["action", "url"]);
|
|
26
|
+
return (Object.assign(Object.assign({}, baseButtonProps), getActionHandler({ action, url }, onMessageAction, onActionCallback)));
|
|
27
|
+
};
|
|
28
|
+
const getContentProps = (content, onMessageAction, onActionCallback) => {
|
|
29
|
+
const props = {};
|
|
30
|
+
if (!content) {
|
|
31
|
+
return props;
|
|
32
|
+
}
|
|
33
|
+
const { primaryButton, secondaryButton } = content, restContent = __rest(content, ["primaryButton", "secondaryButton"]);
|
|
34
|
+
if (primaryButton) {
|
|
35
|
+
props.primaryButton = getButtonProps(primaryButton, onMessageAction, onActionCallback);
|
|
36
|
+
}
|
|
37
|
+
if (secondaryButton) {
|
|
38
|
+
props.secondaryButton = getButtonProps(secondaryButton, onMessageAction, onActionCallback);
|
|
39
|
+
}
|
|
40
|
+
return Object.assign(Object.assign({}, props), restContent);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export { getActionHandler, getContentProps, getPositionProp };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ConsoleLogger } from '@aws-amplify/core';
|
|
2
|
+
import isString from 'lodash/isString';
|
|
3
|
+
|
|
4
|
+
const logger = new ConsoleLogger('Notifications.InAppMessaging');
|
|
5
|
+
const handleMessageAction = ({ action, handleMessageLinkAction, url, }) => {
|
|
6
|
+
logger.info(`Handle action: ${action}`);
|
|
7
|
+
if (action === 'LINK' || action === 'DEEP_LINK') {
|
|
8
|
+
if (!isString(url)) {
|
|
9
|
+
logger.warn(`url must be of type string: ${url}`);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
handleMessageLinkAction(url);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { handleMessageAction as default };
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
export { AuthenticatorProvider
|
|
1
|
+
export { default as AuthenticatorProvider } from './Authenticator/context/AuthenticatorProvider.js';
|
|
2
|
+
import './Authenticator/context/AuthenticatorContext.js';
|
|
3
|
+
export { default as useAuthenticator } from './Authenticator/hooks/useAuthenticator/useAuthenticator.js';
|
|
4
|
+
export { default as useInAppMessaging } from './InAppMessaging/hooks/useInAppMessaging/useInAppMessaging.js';
|
|
5
|
+
export { default as useMessage } from './InAppMessaging/hooks/useMessage/useMessage.js';
|
|
6
|
+
import './InAppMessaging/context/InAppMessagingContext/InAppMessagingContext.js';
|
|
7
|
+
export { default as InAppMessagingProvider } from './InAppMessaging/context/InAppMessagingProvider/InAppMessagingProvider.js';
|
|
8
|
+
export { default as handleMessageAction } from './InAppMessaging/utils/handleMessageAction.js';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation.
|
|
3
|
+
|
|
4
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
+
purpose with or without fee is hereby granted.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
|
|
16
|
+
function __rest(s, e) {
|
|
17
|
+
var t = {};
|
|
18
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
19
|
+
t[p] = s[p];
|
|
20
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
21
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
22
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
23
|
+
t[p[i]] = s[p[i]];
|
|
24
|
+
}
|
|
25
|
+
return t;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
29
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
30
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
31
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
32
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
33
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
34
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { __awaiter, __rest };
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import isEmpty from 'lodash/isEmpty';
|
|
2
2
|
import isObject from 'lodash/isObject';
|
|
3
|
+
|
|
3
4
|
function isEmptyArray(value) {
|
|
4
5
|
return Array.isArray(value) && isEmpty(value);
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
+
function areEmptyArrays(...values) {
|
|
7
8
|
return values.every(isEmptyArray);
|
|
8
9
|
}
|
|
9
10
|
function isEmptyObject(value) {
|
|
10
11
|
return isObject(value) && !Array.isArray(value) && isEmpty(value);
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
+
function areEmptyObjects(...values) {
|
|
13
14
|
return values.every(isEmptyObject);
|
|
14
15
|
}
|
|
16
|
+
|
|
17
|
+
export { areEmptyArrays, areEmptyObjects };
|