chayns-api 1.0.1 → 1.0.3
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/.babelrc +30 -30
- package/.eslintrc +17 -17
- package/.github/workflows/deploy_docs.yml +28 -28
- package/.github/workflows/publish.yml +21 -0
- package/LICENSE +21 -21
- package/README.md +47 -47
- package/dist/cjs/calls/dialogs/alert.js +0 -2
- package/dist/cjs/calls/dialogs/chaynsDialog.js +2 -8
- package/dist/cjs/calls/dialogs/close.js +0 -2
- package/dist/cjs/calls/dialogs/communication.js +1 -16
- package/dist/cjs/calls/dialogs/confirm.js +0 -4
- package/dist/cjs/calls/dialogs/date.js +46 -63
- package/dist/cjs/calls/dialogs/dropUpAlert.js +0 -3
- package/dist/cjs/calls/dialogs/fileSelect.js +0 -10
- package/dist/cjs/calls/dialogs/iFrame.js +0 -8
- package/dist/cjs/calls/dialogs/index.js +0 -27
- package/dist/cjs/calls/dialogs/input.js +0 -6
- package/dist/cjs/calls/dialogs/mediaSelect.js +0 -7
- package/dist/cjs/calls/dialogs/open.js +0 -2
- package/dist/cjs/calls/dialogs/select.js +0 -9
- package/dist/cjs/calls/dialogs/signature.js +0 -5
- package/dist/cjs/calls/dialogs/toast.js +0 -3
- package/dist/cjs/calls/dialogs/utils/callback.js +0 -2
- package/dist/cjs/calls/dialogs/utils/is.js +0 -4
- package/dist/cjs/calls/getUserInfo.js +0 -11
- package/dist/cjs/calls/index.js +95 -247
- package/dist/cjs/calls/sendMessage.js +8 -34
- package/dist/cjs/calls/visibilityChangeListener.js +5 -16
- package/dist/cjs/components/ChaynsContext.js +2 -4
- package/dist/cjs/components/ChaynsProvider.js +6 -28
- package/dist/cjs/components/WaitUntil.js +0 -5
- package/dist/cjs/components/withCompatMode.js +1 -16
- package/dist/cjs/helper/apiListenerHelper.js +0 -9
- package/dist/cjs/hooks/geoLocationListener.js +6 -15
- package/dist/cjs/hooks/index.js +6 -16
- package/dist/cjs/hooks/scrollListener.js +12 -31
- package/dist/cjs/hooks/useAccessToken.js +2 -7
- package/dist/cjs/hooks/useCurrentPage.js +2 -6
- package/dist/cjs/hooks/useCustomData.js +2 -6
- package/dist/cjs/hooks/useDevice.js +2 -6
- package/dist/cjs/hooks/useEnvironment.js +2 -6
- package/dist/cjs/hooks/useFunctions.js +2 -6
- package/dist/cjs/hooks/useIsAdminMode.js +2 -7
- package/dist/cjs/hooks/useLanguage.js +2 -6
- package/dist/cjs/hooks/usePages.js +26 -18
- package/dist/cjs/hooks/useParameters.js +2 -6
- package/dist/cjs/hooks/useSite.js +2 -6
- package/dist/cjs/hooks/useUser.js +2 -7
- package/dist/cjs/hooks/useValues.js +2 -6
- package/dist/cjs/hooks/windowMetricsListener.js +6 -16
- package/dist/cjs/host/ChaynsHost.js +0 -10
- package/dist/cjs/host/iframe/HostIframe.js +23 -30
- package/dist/cjs/host/iframe/utils/useUpdateData.js +0 -3
- package/dist/cjs/host/module/ModuleHost.js +3 -13
- package/dist/cjs/host/module/utils/loadComponent.js +1 -18
- package/dist/cjs/host/module/utils/useDynamicScript.js +0 -18
- package/dist/cjs/index.js +0 -19
- package/dist/cjs/types/IChaynsReact.js +27 -48
- package/dist/cjs/util/appCall.js +1 -4
- package/dist/cjs/util/deviceHelper.js +5 -22
- package/dist/cjs/util/heightHelper.js +0 -9
- package/dist/cjs/util/postIframeForm.js +0 -5
- package/dist/cjs/wrapper/AppWrapper.js +323 -159
- package/dist/cjs/wrapper/FrameWrapper.js +219 -248
- package/dist/cjs/wrapper/ModuleFederationWrapper.js +2 -27
- package/dist/cjs/wrapper/SsrWrapper.js +0 -8
- package/dist/esm/calls/dialogs/alert.js +4 -4
- package/dist/esm/calls/dialogs/chaynsDialog.js +7 -11
- package/dist/esm/calls/dialogs/communication.js +15 -26
- package/dist/esm/calls/dialogs/confirm.js +5 -8
- package/dist/esm/calls/dialogs/date.js +119 -128
- package/dist/esm/calls/dialogs/dropUpAlert.js +1 -1
- package/dist/esm/calls/dialogs/fileSelect.js +23 -62
- package/dist/esm/calls/dialogs/iFrame.js +7 -10
- package/dist/esm/calls/dialogs/input.js +2 -5
- package/dist/esm/calls/dialogs/mediaSelect.js +18 -55
- package/dist/esm/calls/dialogs/open.js +2 -2
- package/dist/esm/calls/dialogs/select.js +5 -9
- package/dist/esm/calls/dialogs/signature.js +0 -2
- package/dist/esm/calls/dialogs/toast.js +6 -11
- package/dist/esm/calls/dialogs/utils/callback.js +3 -5
- package/dist/esm/calls/dialogs/utils/is.js +1 -3
- package/dist/esm/calls/getUserInfo.js +32 -92
- package/dist/esm/calls/index.js +297 -449
- package/dist/esm/calls/sendMessage.js +99 -229
- package/dist/esm/calls/visibilityChangeListener.js +14 -19
- package/dist/esm/components/ChaynsContext.js +3 -3
- package/dist/esm/components/ChaynsProvider.js +45 -86
- package/dist/esm/components/WaitUntil.js +21 -86
- package/dist/esm/components/withCompatMode.js +35 -77
- package/dist/esm/helper/apiListenerHelper.js +10 -15
- package/dist/esm/hooks/geoLocationListener.js +24 -50
- package/dist/esm/hooks/index.js +1 -1
- package/dist/esm/hooks/scrollListener.js +58 -94
- package/dist/esm/hooks/useAccessToken.js +8 -30
- package/dist/esm/hooks/useCurrentPage.js +4 -8
- package/dist/esm/hooks/useCustomData.js +4 -8
- package/dist/esm/hooks/useDevice.js +3 -8
- package/dist/esm/hooks/useEnvironment.js +3 -8
- package/dist/esm/hooks/useFunctions.js +4 -7
- package/dist/esm/hooks/useIsAdminMode.js +4 -8
- package/dist/esm/hooks/useLanguage.js +3 -8
- package/dist/esm/hooks/usePages.js +38 -31
- package/dist/esm/hooks/useParameters.js +3 -8
- package/dist/esm/hooks/useSite.js +3 -8
- package/dist/esm/hooks/useUser.js +3 -9
- package/dist/esm/hooks/useValues.js +4 -7
- package/dist/esm/hooks/windowMetricsListener.js +22 -48
- package/dist/esm/host/ChaynsHost.js +22 -29
- package/dist/esm/host/iframe/HostIframe.js +86 -142
- package/dist/esm/host/iframe/utils/useUpdateData.js +4 -6
- package/dist/esm/host/module/ModuleHost.js +42 -49
- package/dist/esm/host/module/utils/loadComponent.js +47 -85
- package/dist/esm/host/module/utils/useDynamicScript.js +27 -74
- package/dist/esm/types/IChaynsReact.js +37 -61
- package/dist/esm/util/appCall.js +2 -4
- package/dist/esm/util/deviceHelper.js +13 -37
- package/dist/esm/util/heightHelper.js +10 -13
- package/dist/esm/util/postIframeForm.js +25 -57
- package/dist/esm/wrapper/AppWrapper.js +385 -781
- package/dist/esm/wrapper/FrameWrapper.js +262 -1509
- package/dist/esm/wrapper/ModuleFederationWrapper.js +47 -284
- package/dist/esm/wrapper/SsrWrapper.js +19 -65
- package/dist/types/calls/dialogs/alert.d.ts +1 -1
- package/dist/types/calls/dialogs/chaynsDialog.d.ts +24 -24
- package/dist/types/calls/dialogs/close.d.ts +1 -1
- package/dist/types/calls/dialogs/communication.d.ts +3 -3
- package/dist/types/calls/dialogs/confirm.d.ts +13 -13
- package/dist/types/calls/dialogs/date.d.ts +96 -96
- package/dist/types/calls/dialogs/dropUpAlert.d.ts +5 -5
- package/dist/types/calls/dialogs/fileSelect.d.ts +16 -16
- package/dist/types/calls/dialogs/iFrame.d.ts +10 -10
- package/dist/types/calls/dialogs/index.d.ts +14 -14
- package/dist/types/calls/dialogs/input.d.ts +15 -15
- package/dist/types/calls/dialogs/mediaSelect.d.ts +8 -8
- package/dist/types/calls/dialogs/open.d.ts +1 -1
- package/dist/types/calls/dialogs/select.d.ts +6 -6
- package/dist/types/calls/dialogs/signature.d.ts +7 -7
- package/dist/types/calls/dialogs/toast.d.ts +1 -1
- package/dist/types/calls/dialogs/utils/callback.d.ts +1 -1
- package/dist/types/calls/dialogs/utils/is.d.ts +4 -4
- package/dist/types/calls/getUserInfo.d.ts +9 -9
- package/dist/types/calls/index.d.ts +225 -231
- package/dist/types/calls/sendMessage.d.ts +13 -13
- package/dist/types/calls/visibilityChangeListener.d.ts +9 -9
- package/dist/types/components/ChaynsContext.d.ts +3 -3
- package/dist/types/components/ChaynsProvider.d.ts +13 -13
- package/dist/types/components/WaitUntil.d.ts +7 -7
- package/dist/types/components/withCompatMode.d.ts +13 -13
- package/dist/types/helper/apiListenerHelper.d.ts +6 -6
- package/dist/types/hooks/geoLocationListener.d.ts +18 -18
- package/dist/types/hooks/index.d.ts +16 -16
- package/dist/types/hooks/scrollListener.d.ts +28 -28
- package/dist/types/hooks/useAccessToken.d.ts +5 -5
- package/dist/types/hooks/useCurrentPage.d.ts +4 -4
- package/dist/types/hooks/useCustomData.d.ts +4 -4
- package/dist/types/hooks/useDevice.d.ts +5 -5
- package/dist/types/hooks/useEnvironment.d.ts +5 -5
- package/dist/types/hooks/useFunctions.d.ts +5 -5
- package/dist/types/hooks/useIsAdminMode.d.ts +4 -4
- package/dist/types/hooks/useLanguage.d.ts +5 -5
- package/dist/types/hooks/usePages.d.ts +18 -14
- package/dist/types/hooks/useParameters.d.ts +5 -5
- package/dist/types/hooks/useSite.d.ts +5 -5
- package/dist/types/hooks/useUser.d.ts +5 -5
- package/dist/types/hooks/useValues.d.ts +5 -5
- package/dist/types/hooks/windowMetricsListener.d.ts +11 -11
- package/dist/types/host/ChaynsHost.d.ts +28 -28
- package/dist/types/host/iframe/HostIframe.d.ts +24 -24
- package/dist/types/host/iframe/utils/useUpdateData.d.ts +3 -3
- package/dist/types/host/module/ModuleHost.d.ts +23 -23
- package/dist/types/host/module/utils/loadComponent.d.ts +1 -1
- package/dist/types/host/module/utils/useDynamicScript.d.ts +9 -9
- package/dist/types/index.d.ts +16 -16
- package/dist/types/types/IChaynsReact.d.ts +622 -590
- package/dist/types/types/dialog.d.ts +41 -41
- package/dist/types/util/appCall.d.ts +2 -2
- package/dist/types/util/deviceHelper.d.ts +7 -7
- package/dist/types/util/heightHelper.d.ts +1 -1
- package/dist/types/util/postIframeForm.d.ts +1 -1
- package/dist/types/wrapper/AppWrapper.d.ts +18 -16
- package/dist/types/wrapper/FrameWrapper.d.ts +15 -15
- package/dist/types/wrapper/ModuleFederationWrapper.d.ts +10 -10
- package/dist/types/wrapper/SsrWrapper.d.ts +11 -11
- package/package.json +76 -76
- package/toolkit.config.js +52 -52
- package/tsconfig.json +56 -56
- package/dist/cjs/bootstrap.js +0 -11
- package/dist/cjs/calls/abstractApiListener.js +0 -40
- package/dist/cjs/calls/apiEventListener.js +0 -40
- package/dist/cjs/calls/setVisibilityChangeListener.js +0 -1
- package/dist/cjs/calls/windowMetricsListener.js +0 -18
- package/dist/cjs/client.js +0 -93
- package/dist/cjs/components/App.js +0 -32
- package/dist/cjs/components/App.spec.js +0 -16
- package/dist/cjs/components/Button.js +0 -32
- package/dist/cjs/components/ChaynsModuleProvider.js +0 -457
- package/dist/cjs/components/ChaynsProviderExposed.js +0 -16
- package/dist/cjs/components/TestProvider.js +0 -236
- package/dist/cjs/components/Title.js +0 -162
- package/dist/cjs/functions/addApiListener.js +0 -37
- package/dist/cjs/functions/addGeoLocationListener.js +0 -26
- package/dist/cjs/functions/addScrollListener.js +0 -26
- package/dist/cjs/functions/addWindowMetricsListener.js +0 -37
- package/dist/cjs/helper/cssLoader.js +0 -28
- package/dist/cjs/hooks/addGeoLocationListener.js +0 -26
- package/dist/cjs/hooks/addScrollListener.js +0 -26
- package/dist/cjs/hooks/addWindowMetricsListener.js +0 -37
- package/dist/cjs/hooks/geoLocation.js +0 -48
- package/dist/cjs/hooks/useAddGeoLocationListener.js +0 -26
- package/dist/cjs/hooks/useAddScrollListener.js +0 -48
- package/dist/cjs/hooks/useAddWindowMetricsListener.js +0 -45
- package/dist/cjs/hooks/useAdddScrollListener.js +0 -26
- package/dist/cjs/hooks/windowMetrics.js +0 -45
- package/dist/cjs/host/HostIframe.js +0 -157
- package/dist/cjs/host/ModuleHost.js +0 -11
- package/dist/cjs/host/module/utils.js +0 -25
- package/dist/cjs/index.example.js +0 -7
- package/dist/cjs/index2.js +0 -64
- package/dist/cjs/types/DynamicApiImport.d.js +0 -5
- package/dist/cjs/types/DynamicImport.d.js +0 -5
- package/dist/cjs/types/chayns-components.d.js +0 -1
- package/dist/cjs/types/chayns-logger.d.js +0 -1
- package/dist/cjs/types/chayns.d.js +0 -1
- package/dist/cjs/types/tobit-websocket-service-client.d.js +0 -1
- package/dist/cjs/types/toolkit-types.d.js +0 -1
- package/dist/cjs/util/useFunctionsContext.js +0 -16
- package/dist/cjs/util/useIsAdminMode.js +0 -18
- package/dist/cjs/util/useUser.js +0 -16
- package/dist/esm/bootstrap.js +0 -4
- package/dist/esm/client.js +0 -8
- package/dist/esm/components/App.js +0 -35
- package/dist/esm/components/App.spec.js +0 -9
- package/dist/esm/components/Button.js +0 -34
- package/dist/esm/components/ChaynsModuleProvider.js +0 -517
- package/dist/esm/components/ChaynsProviderExposed.js +0 -3
- package/dist/esm/components/TestProvider.js +0 -308
- package/dist/esm/components/Title.js +0 -210
- package/dist/esm/helper/cssLoader.js +0 -21
- package/dist/esm/hooks/useAddGeoLocationListener.js +0 -18
- package/dist/esm/hooks/useAddScrollListener.js +0 -18
- package/dist/esm/hooks/useAddWindowMetricsListener.js +0 -18
- package/dist/esm/host/HostIframe.js +0 -153
- package/dist/esm/index.example.js +0 -1
- package/dist/esm/index2.js +0 -5
- package/dist/esm/types/DynamicApiImport.d.js +0 -1
- package/dist/esm/types/DynamicImport.d.js +0 -1
- package/dist/esm/types/chayns-components.d.js +0 -0
- package/dist/esm/types/chayns-logger.d.js +0 -0
- package/dist/esm/types/chayns.d.js +0 -0
- package/dist/esm/types/tobit-websocket-service-client.d.js +0 -0
- package/dist/esm/types/toolkit-types.d.js +0 -0
- package/dist/esm/util/useIsAdminMode.js +0 -9
- package/dist/esm/util/useUser.js +0 -7
- package/dist/types/bootstrap.d.ts +0 -1
- package/dist/types/client.d.ts +0 -7
- package/dist/types/components/App.d.ts +0 -5
- package/dist/types/components/Button.d.ts +0 -8
- package/dist/types/components/ChaynsModuleProvider.d.ts +0 -170
- package/dist/types/components/ChaynsProviderExposed.d.ts +0 -13
- package/dist/types/components/Title.d.ts +0 -3
- package/dist/types/host/HostIframe.d.ts +0 -20
- package/dist/types/index.example.d.ts +0 -0
package/dist/cjs/calls/index.js
CHANGED
|
@@ -4,393 +4,247 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.vibrate = exports.user = exports.storageSetItem = exports.storageRemoveItem = exports.storageGetItem = exports.site = exports.setWaitCursor = exports.setTempDesignSettings = exports.setScanQrCode = exports.setRefreshScrollEnabled = exports.setOverlay = exports.setHeight = exports.setFloatingButton = exports.setDisplayTimeout = exports.setAdminMode = exports.sendMessageToUser = exports.sendMessageToPage = exports.sendMessageToGroup = exports.selectPage = exports.scrollToY = exports.removeWindowMetricsListener = exports.removeVisibilityChangeListener = exports.removeScrollListener = exports.removeGeoLocationListener = exports.refreshData = exports.refreshAccessToken = exports.parameters = exports.pages = exports.openVideo = exports.openUrl = exports.openImage = exports.navigateBack = exports.logout = exports.login = exports.language = exports.invokeDialogCall = exports.invokeCall = exports.getWindowMetrics = exports.getUserInfo = exports.getUser = exports.getSite = exports.getScrollPosition = exports.getParameters = exports.getPages = exports.getLanguage = exports.getGeoLocation = exports.getEnvironment = exports.getDevice = exports.getAvailableSharingServices = exports.getAccessToken = exports.environment = exports.device = exports.customCallbackFunction = exports.addWindowMetricsListener = exports.addVisibilityChangeListener = exports.addScrollListener = exports.addGeoLocationListener = void 0;
|
|
7
|
-
|
|
8
7
|
var _ChaynsProvider = require("../components/ChaynsProvider");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*
|
|
12
|
-
* @category Event listener
|
|
8
|
+
/**
|
|
9
|
+
* This adds a listener to determine your location.
|
|
10
|
+
* @category Event listener
|
|
13
11
|
*/
|
|
14
12
|
const addGeoLocationListener = (...args) => _ChaynsProvider.moduleWrapper.current.functions.addGeoLocationListener(...args);
|
|
15
|
-
/**
|
|
16
|
-
* Adds a listener for scroll event by user.
|
|
17
|
-
* @category Event listener
|
|
13
|
+
/**
|
|
14
|
+
* Adds a listener for scroll event by user.
|
|
15
|
+
* @category Event listener
|
|
18
16
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
17
|
exports.addGeoLocationListener = addGeoLocationListener;
|
|
22
|
-
|
|
23
18
|
const addScrollListener = (...args) => _ChaynsProvider.moduleWrapper.current.functions.addScrollListener(...args);
|
|
24
|
-
/**
|
|
25
|
-
* This method will be executed when the page gets displayed or hidden.
|
|
26
|
-
* @category Event listener
|
|
19
|
+
/**
|
|
20
|
+
* This method will be executed when the page gets displayed or hidden.
|
|
21
|
+
* @category Event listener
|
|
27
22
|
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
23
|
exports.addScrollListener = addScrollListener;
|
|
31
|
-
|
|
32
24
|
const addVisibilityChangeListener = (...args) => _ChaynsProvider.moduleWrapper.current.functions.addVisibilityChangeListener(...args);
|
|
33
|
-
/**
|
|
34
|
-
* This adds a listener to get the actual height of the page.
|
|
35
|
-
* @category Event listener
|
|
25
|
+
/**
|
|
26
|
+
* This adds a listener to get the actual height of the page.
|
|
27
|
+
* @category Event listener
|
|
36
28
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
29
|
exports.addVisibilityChangeListener = addVisibilityChangeListener;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
* Allows a custom callback function to be defined
|
|
44
|
-
*/
|
|
45
|
-
|
|
46
|
-
|
|
30
|
+
const addWindowMetricsListener = (...args) => _ChaynsProvider.moduleWrapper.current.functions.addWindowMetricsListener(...args); /**
|
|
31
|
+
* Allows a custom callback function to be defined
|
|
32
|
+
*/
|
|
47
33
|
exports.addWindowMetricsListener = addWindowMetricsListener;
|
|
48
|
-
|
|
49
34
|
const customCallbackFunction = (...args) => _ChaynsProvider.moduleWrapper.current.functions.customCallbackFunction(...args);
|
|
50
|
-
/**
|
|
51
|
-
* Get the accessToken from the user.
|
|
35
|
+
/**
|
|
36
|
+
* Get the accessToken from the user.
|
|
52
37
|
*/
|
|
53
|
-
|
|
54
|
-
|
|
55
38
|
exports.customCallbackFunction = customCallbackFunction;
|
|
56
|
-
|
|
57
39
|
const getAccessToken = (...args) => _ChaynsProvider.moduleWrapper.current.functions.getAccessToken(...args);
|
|
58
|
-
/**
|
|
59
|
-
* This method returns a list of installed share/social media apps.
|
|
40
|
+
/**
|
|
41
|
+
* This method returns a list of installed share/social media apps.
|
|
60
42
|
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
43
|
exports.getAccessToken = getAccessToken;
|
|
64
|
-
|
|
65
44
|
const getAvailableSharingServices = (...args) => _ChaynsProvider.moduleWrapper.current.functions.getAvailableSharingServices(...args);
|
|
66
|
-
/**
|
|
67
|
-
* This method determines your location. If you want to track a route, use addGeoLocationListener.
|
|
45
|
+
/**
|
|
46
|
+
* This method determines your location. If you want to track a route, use addGeoLocationListener.
|
|
68
47
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
48
|
exports.getAvailableSharingServices = getAvailableSharingServices;
|
|
72
|
-
|
|
73
49
|
const getGeoLocation = (...args) => _ChaynsProvider.moduleWrapper.current.functions.getGeoLocation(...args);
|
|
74
|
-
/**
|
|
75
|
-
* This method returns user information for a specific user.
|
|
76
|
-
* @category User functions
|
|
50
|
+
/**
|
|
51
|
+
* This method returns user information for a specific user.
|
|
52
|
+
* @category User functions
|
|
77
53
|
*/
|
|
78
|
-
|
|
79
|
-
|
|
80
54
|
exports.getGeoLocation = getGeoLocation;
|
|
81
|
-
|
|
82
55
|
const getUserInfo = (...args) => _ChaynsProvider.moduleWrapper.current.functions.getUserInfo(...args);
|
|
83
|
-
/**
|
|
84
|
-
* Return the current scroll position of the top frame
|
|
56
|
+
/**
|
|
57
|
+
* Return the current scroll position of the top frame
|
|
85
58
|
*/
|
|
86
|
-
|
|
87
|
-
|
|
88
59
|
exports.getUserInfo = getUserInfo;
|
|
89
|
-
|
|
90
60
|
const getScrollPosition = (...args) => _ChaynsProvider.moduleWrapper.current.functions.getScrollPosition(...args);
|
|
91
|
-
/**
|
|
92
|
-
* Returns the window metrics.
|
|
61
|
+
/**
|
|
62
|
+
* Returns the window metrics.
|
|
93
63
|
*/
|
|
94
|
-
|
|
95
|
-
|
|
96
64
|
exports.getScrollPosition = getScrollPosition;
|
|
97
|
-
|
|
98
65
|
const getWindowMetrics = (...args) => _ChaynsProvider.moduleWrapper.current.functions.getWindowMetrics(...args);
|
|
99
66
|
/** @internal */
|
|
100
|
-
|
|
101
|
-
|
|
102
67
|
exports.getWindowMetrics = getWindowMetrics;
|
|
103
|
-
|
|
104
68
|
const invokeCall = (...args) => _ChaynsProvider.moduleWrapper.current.functions.invokeCall(...args);
|
|
105
69
|
/** @internal */
|
|
106
|
-
|
|
107
|
-
|
|
108
70
|
exports.invokeCall = invokeCall;
|
|
109
|
-
|
|
110
71
|
const invokeDialogCall = (...args) => _ChaynsProvider.moduleWrapper.current.functions.invokeDialogCall(...args);
|
|
111
|
-
/**
|
|
112
|
-
* This method will show a login dialog where the user has the opportunity to log in.
|
|
72
|
+
/**
|
|
73
|
+
* This method will show a login dialog where the user has the opportunity to log in.
|
|
113
74
|
*/
|
|
114
|
-
|
|
115
|
-
|
|
116
75
|
exports.invokeDialogCall = invokeDialogCall;
|
|
117
|
-
|
|
118
76
|
const login = (...args) => _ChaynsProvider.moduleWrapper.current.functions.login(...args);
|
|
119
|
-
/**
|
|
120
|
-
* This method will logout the user
|
|
77
|
+
/**
|
|
78
|
+
* This method will logout the user
|
|
121
79
|
*/
|
|
122
|
-
|
|
123
|
-
|
|
124
80
|
exports.login = login;
|
|
125
|
-
|
|
126
81
|
const logout = (...args) => _ChaynsProvider.moduleWrapper.current.functions.logout(...args);
|
|
127
|
-
/**
|
|
128
|
-
* This function navigates you to the previous site.
|
|
82
|
+
/**
|
|
83
|
+
* This function navigates you to the previous site.
|
|
129
84
|
*/
|
|
130
|
-
|
|
131
|
-
|
|
132
85
|
exports.logout = logout;
|
|
133
|
-
|
|
134
86
|
const navigateBack = (...args) => _ChaynsProvider.moduleWrapper.current.functions.navigateBack(...args);
|
|
135
|
-
/**
|
|
136
|
-
* The images specified in the url array is shown in gallery mode.
|
|
87
|
+
/**
|
|
88
|
+
* The images specified in the url array is shown in gallery mode.
|
|
137
89
|
*/
|
|
138
|
-
|
|
139
|
-
|
|
140
90
|
exports.navigateBack = navigateBack;
|
|
141
|
-
|
|
142
91
|
const openImage = (...args) => _ChaynsProvider.moduleWrapper.current.functions.openImage(...args);
|
|
143
|
-
/**
|
|
144
|
-
* Opens an URL in the chayns environment.
|
|
92
|
+
/**
|
|
93
|
+
* Opens an URL in the chayns environment.
|
|
145
94
|
*/
|
|
146
|
-
|
|
147
|
-
|
|
148
95
|
exports.openImage = openImage;
|
|
149
|
-
|
|
150
96
|
const openUrl = (...args) => _ChaynsProvider.moduleWrapper.current.functions.openUrl(...args);
|
|
151
|
-
/**
|
|
152
|
-
* The video specified in the URL is shown in video mode.
|
|
97
|
+
/**
|
|
98
|
+
* The video specified in the URL is shown in video mode.
|
|
153
99
|
*/
|
|
154
|
-
|
|
155
|
-
|
|
156
100
|
exports.openUrl = openUrl;
|
|
157
|
-
|
|
158
101
|
const openVideo = (...args) => _ChaynsProvider.moduleWrapper.current.functions.openVideo(...args);
|
|
159
|
-
/**
|
|
160
|
-
* Refresh badge count in navigation, user information and pages
|
|
102
|
+
/**
|
|
103
|
+
* Refresh badge count in navigation, user information and pages
|
|
161
104
|
*/
|
|
162
|
-
|
|
163
|
-
|
|
164
105
|
exports.openVideo = openVideo;
|
|
165
|
-
|
|
166
106
|
const refreshData = (...args) => _ChaynsProvider.moduleWrapper.current.functions.refreshData(...args);
|
|
167
|
-
/**
|
|
168
|
-
* Refresh accesstoken, should only be used when user object changes, not when token is invalid
|
|
107
|
+
/**
|
|
108
|
+
* Refresh accesstoken, should only be used when user object changes, not when token is invalid
|
|
169
109
|
*/
|
|
170
|
-
|
|
171
|
-
|
|
172
110
|
exports.refreshData = refreshData;
|
|
173
|
-
|
|
174
111
|
const refreshAccessToken = (...args) => _ChaynsProvider.moduleWrapper.current.functions.refreshAccessToken(...args);
|
|
175
|
-
/**
|
|
176
|
-
* This removes a listener to determine your location.
|
|
177
|
-
* @category Event listener
|
|
112
|
+
/**
|
|
113
|
+
* This removes a listener to determine your location.
|
|
114
|
+
* @category Event listener
|
|
178
115
|
*/
|
|
179
|
-
|
|
180
|
-
|
|
181
116
|
exports.refreshAccessToken = refreshAccessToken;
|
|
182
|
-
|
|
183
117
|
const removeGeoLocationListener = (...args) => _ChaynsProvider.moduleWrapper.current.functions.removeGeoLocationListener(...args);
|
|
184
|
-
/**
|
|
185
|
-
* Removes scroll listener.
|
|
186
|
-
* @category Event listener
|
|
118
|
+
/**
|
|
119
|
+
* Removes scroll listener.
|
|
120
|
+
* @category Event listener
|
|
187
121
|
*/
|
|
188
|
-
|
|
189
|
-
|
|
190
122
|
exports.removeGeoLocationListener = removeGeoLocationListener;
|
|
191
|
-
|
|
192
123
|
const removeScrollListener = (...args) => _ChaynsProvider.moduleWrapper.current.functions.removeScrollListener(...args);
|
|
193
|
-
/**
|
|
194
|
-
* Removes visibility change listener.
|
|
195
|
-
* @category Event listener
|
|
124
|
+
/**
|
|
125
|
+
* Removes visibility change listener.
|
|
126
|
+
* @category Event listener
|
|
196
127
|
*/
|
|
197
|
-
|
|
198
|
-
|
|
199
128
|
exports.removeScrollListener = removeScrollListener;
|
|
200
|
-
|
|
201
129
|
const removeVisibilityChangeListener = (...args) => _ChaynsProvider.moduleWrapper.current.functions.removeVisibilityChangeListener(...args);
|
|
202
|
-
/**
|
|
203
|
-
* Removes window metrics listener.
|
|
204
|
-
* @category Event listener
|
|
130
|
+
/**
|
|
131
|
+
* Removes window metrics listener.
|
|
132
|
+
* @category Event listener
|
|
205
133
|
*/
|
|
206
|
-
|
|
207
|
-
|
|
208
134
|
exports.removeVisibilityChangeListener = removeVisibilityChangeListener;
|
|
209
|
-
|
|
210
135
|
const removeWindowMetricsListener = (...args) => _ChaynsProvider.moduleWrapper.current.functions.removeWindowMetricsListener(...args);
|
|
211
|
-
/**
|
|
212
|
-
* Select other page on chayns site.
|
|
136
|
+
/**
|
|
137
|
+
* Select other page on chayns site.
|
|
213
138
|
*/
|
|
214
|
-
|
|
215
|
-
|
|
216
139
|
exports.removeWindowMetricsListener = removeWindowMetricsListener;
|
|
217
|
-
|
|
218
140
|
const selectPage = (...args) => _ChaynsProvider.moduleWrapper.current.functions.selectPage(...args);
|
|
219
|
-
/**
|
|
220
|
-
* Scrolls to specific position.
|
|
141
|
+
/**
|
|
142
|
+
* Scrolls to specific position.
|
|
221
143
|
*/
|
|
222
|
-
|
|
223
|
-
|
|
224
144
|
exports.selectPage = selectPage;
|
|
225
|
-
|
|
226
145
|
const scrollToY = (...args) => _ChaynsProvider.moduleWrapper.current.functions.scrollToY(...args);
|
|
227
|
-
/**
|
|
228
|
-
* Sends intercom message to group.
|
|
146
|
+
/**
|
|
147
|
+
* Sends intercom message to group.
|
|
229
148
|
*/
|
|
230
|
-
|
|
231
|
-
|
|
232
149
|
exports.scrollToY = scrollToY;
|
|
233
|
-
|
|
234
150
|
const sendMessageToGroup = (...args) => _ChaynsProvider.moduleWrapper.current.functions.sendMessageToGroup(...args);
|
|
235
|
-
/**
|
|
236
|
-
* Sends intercom message to page.
|
|
151
|
+
/**
|
|
152
|
+
* Sends intercom message to page.
|
|
237
153
|
*/
|
|
238
|
-
|
|
239
|
-
|
|
240
154
|
exports.sendMessageToGroup = sendMessageToGroup;
|
|
241
|
-
|
|
242
155
|
const sendMessageToPage = (...args) => _ChaynsProvider.moduleWrapper.current.functions.sendMessageToPage(...args);
|
|
243
|
-
/**
|
|
244
|
-
* Sends intercom message to an user.
|
|
156
|
+
/**
|
|
157
|
+
* Sends intercom message to an user.
|
|
245
158
|
*/
|
|
246
|
-
|
|
247
|
-
|
|
248
159
|
exports.sendMessageToPage = sendMessageToPage;
|
|
249
|
-
|
|
250
160
|
const sendMessageToUser = (...args) => _ChaynsProvider.moduleWrapper.current.functions.sendMessageToUser(...args);
|
|
251
|
-
/**
|
|
252
|
-
* Switches admin mode, also toggles admin switch in top frame.
|
|
161
|
+
/**
|
|
162
|
+
* Switches admin mode, also toggles admin switch in top frame.
|
|
253
163
|
*/
|
|
254
|
-
|
|
255
|
-
|
|
256
164
|
exports.sendMessageToUser = sendMessageToUser;
|
|
257
|
-
|
|
258
165
|
const setAdminMode = (...args) => _ChaynsProvider.moduleWrapper.current.functions.setAdminMode(...args);
|
|
259
|
-
/**
|
|
260
|
-
* Sets the display timeout, only works in chayns App.
|
|
166
|
+
/**
|
|
167
|
+
* Sets the display timeout, only works in chayns App.
|
|
261
168
|
*/
|
|
262
|
-
|
|
263
|
-
|
|
264
169
|
exports.setAdminMode = setAdminMode;
|
|
265
|
-
|
|
266
170
|
const setDisplayTimeout = (...args) => _ChaynsProvider.moduleWrapper.current.functions.setDisplayTimeout(...args);
|
|
267
|
-
/**
|
|
268
|
-
* Enables or disables a button which floats over the page.
|
|
171
|
+
/**
|
|
172
|
+
* Enables or disables a button which floats over the page.
|
|
269
173
|
*/
|
|
270
|
-
|
|
271
|
-
|
|
272
174
|
exports.setDisplayTimeout = setDisplayTimeout;
|
|
273
|
-
|
|
274
175
|
const setFloatingButton = (...args) => _ChaynsProvider.moduleWrapper.current.functions.setFloatingButton(...args);
|
|
275
|
-
/**
|
|
276
|
-
* Sets the height of the page.
|
|
176
|
+
/**
|
|
177
|
+
* Sets the height of the page.
|
|
277
178
|
*/
|
|
278
|
-
|
|
279
|
-
|
|
280
179
|
exports.setFloatingButton = setFloatingButton;
|
|
281
|
-
|
|
282
180
|
const setHeight = (...args) => _ChaynsProvider.moduleWrapper.current.functions.setHeight(...args);
|
|
283
|
-
/**
|
|
284
|
-
* Enables or disables the ability to refresh a page
|
|
181
|
+
/**
|
|
182
|
+
* Enables or disables the ability to refresh a page
|
|
285
183
|
*/
|
|
286
|
-
|
|
287
|
-
|
|
288
184
|
exports.setHeight = setHeight;
|
|
289
|
-
|
|
290
185
|
const setRefreshScrollEnabled = (...args) => _ChaynsProvider.moduleWrapper.current.functions.setRefreshScrollEnabled(...args);
|
|
291
|
-
/**
|
|
292
|
-
* Scans a qr-code and returns the result
|
|
186
|
+
/**
|
|
187
|
+
* Scans a qr-code and returns the result
|
|
293
188
|
*/
|
|
294
|
-
|
|
295
|
-
|
|
296
189
|
exports.setRefreshScrollEnabled = setRefreshScrollEnabled;
|
|
297
|
-
|
|
298
190
|
const setScanQrCode = (...args) => _ChaynsProvider.moduleWrapper.current.functions.setScanQrCode(...args);
|
|
299
|
-
/**
|
|
300
|
-
* Temporarily change design settings in top frame
|
|
191
|
+
/**
|
|
192
|
+
* Temporarily change design settings in top frame
|
|
301
193
|
*/
|
|
302
|
-
|
|
303
|
-
|
|
304
194
|
exports.setScanQrCode = setScanQrCode;
|
|
305
|
-
|
|
306
195
|
const setTempDesignSettings = (...args) => _ChaynsProvider.moduleWrapper.current.functions.setTempDesignSettings(...args);
|
|
307
|
-
/**
|
|
308
|
-
* Shows or hide a waitcursor
|
|
196
|
+
/**
|
|
197
|
+
* Shows or hide a waitcursor
|
|
309
198
|
*/
|
|
310
|
-
|
|
311
|
-
|
|
312
199
|
exports.setTempDesignSettings = setTempDesignSettings;
|
|
313
|
-
|
|
314
200
|
const setWaitCursor = (...args) => _ChaynsProvider.moduleWrapper.current.functions.setWaitCursor(...args);
|
|
315
|
-
/**
|
|
316
|
-
* Retrieves the value that is assigned to the key from a storage outside the frame
|
|
201
|
+
/**
|
|
202
|
+
* Retrieves the value that is assigned to the key from a storage outside the frame
|
|
317
203
|
*/
|
|
318
|
-
|
|
319
|
-
|
|
320
204
|
exports.setWaitCursor = setWaitCursor;
|
|
321
|
-
|
|
322
205
|
const storageGetItem = (...args) => _ChaynsProvider.moduleWrapper.current.functions.storageGetItem(...args);
|
|
323
|
-
/**
|
|
324
|
-
* Removes the value that is assigned to the key from a storage outside the frame
|
|
206
|
+
/**
|
|
207
|
+
* Removes the value that is assigned to the key from a storage outside the frame
|
|
325
208
|
*/
|
|
326
|
-
|
|
327
|
-
|
|
328
209
|
exports.storageGetItem = storageGetItem;
|
|
329
|
-
|
|
330
210
|
const storageRemoveItem = (...args) => _ChaynsProvider.moduleWrapper.current.functions.storageRemoveItem(...args);
|
|
331
|
-
/**
|
|
332
|
-
* Sets the value that is assigned to the key from a storage outside the frame
|
|
211
|
+
/**
|
|
212
|
+
* Sets the value that is assigned to the key from a storage outside the frame
|
|
333
213
|
*/
|
|
334
|
-
|
|
335
|
-
|
|
336
214
|
exports.storageRemoveItem = storageRemoveItem;
|
|
337
|
-
|
|
338
215
|
const storageSetItem = (...args) => _ChaynsProvider.moduleWrapper.current.functions.storageSetItem(...args);
|
|
339
|
-
/**
|
|
340
|
-
* This method lets a smartphone vibrate for the given time.
|
|
216
|
+
/**
|
|
217
|
+
* This method lets a smartphone vibrate for the given time.
|
|
341
218
|
*/
|
|
342
|
-
|
|
343
|
-
|
|
344
219
|
exports.storageSetItem = storageSetItem;
|
|
345
|
-
|
|
346
220
|
const vibrate = (...args) => _ChaynsProvider.moduleWrapper.current.functions.vibrate(...args);
|
|
347
|
-
/**
|
|
348
|
-
* Displays an overlay
|
|
221
|
+
/**
|
|
222
|
+
* Displays an overlay
|
|
349
223
|
*/
|
|
350
|
-
|
|
351
|
-
|
|
352
224
|
exports.vibrate = vibrate;
|
|
353
|
-
|
|
354
225
|
const setOverlay = (...args) => _ChaynsProvider.moduleWrapper.current.functions.setOverlay(...args);
|
|
355
|
-
/**
|
|
356
|
-
* Returns user information, only when user is logged in
|
|
357
|
-
* @category User functions
|
|
226
|
+
/**
|
|
227
|
+
* Returns user information, only when user is logged in
|
|
228
|
+
* @category User functions
|
|
358
229
|
*/
|
|
359
|
-
|
|
360
|
-
|
|
361
230
|
exports.setOverlay = setOverlay;
|
|
362
|
-
|
|
363
231
|
const getUser = () => _ChaynsProvider.moduleWrapper.current.values.user;
|
|
364
|
-
|
|
365
232
|
exports.getUser = getUser;
|
|
366
|
-
|
|
367
233
|
const getSite = () => _ChaynsProvider.moduleWrapper.current.values.site;
|
|
368
|
-
|
|
369
234
|
exports.getSite = getSite;
|
|
370
|
-
|
|
371
235
|
const getDevice = () => _ChaynsProvider.moduleWrapper.current.values.device;
|
|
372
|
-
|
|
373
236
|
exports.getDevice = getDevice;
|
|
374
|
-
|
|
375
237
|
const getLanguage = () => _ChaynsProvider.moduleWrapper.current.values.language;
|
|
376
|
-
|
|
377
238
|
exports.getLanguage = getLanguage;
|
|
378
|
-
|
|
379
239
|
const getParameters = () => _ChaynsProvider.moduleWrapper.current.values.parameters;
|
|
380
|
-
|
|
381
240
|
exports.getParameters = getParameters;
|
|
382
|
-
|
|
383
241
|
const getPages = () => _ChaynsProvider.moduleWrapper.current.values.pages;
|
|
384
|
-
|
|
385
242
|
exports.getPages = getPages;
|
|
386
|
-
|
|
387
243
|
const getEnvironment = () => _ChaynsProvider.moduleWrapper.current.values.environment;
|
|
388
|
-
|
|
389
244
|
exports.getEnvironment = getEnvironment;
|
|
390
245
|
const user = new Proxy({}, {
|
|
391
246
|
get: (target, prop) => {
|
|
392
247
|
var _moduleWrapper$curren;
|
|
393
|
-
|
|
394
248
|
console.warn('Deprecated user import');
|
|
395
249
|
return (_moduleWrapper$curren = _ChaynsProvider.moduleWrapper.current.values.user) === null || _moduleWrapper$curren === void 0 ? void 0 : _moduleWrapper$curren[prop];
|
|
396
250
|
}
|
|
@@ -399,7 +253,6 @@ exports.user = user;
|
|
|
399
253
|
const site = new Proxy({}, {
|
|
400
254
|
get: (target, prop) => {
|
|
401
255
|
var _moduleWrapper$curren2;
|
|
402
|
-
|
|
403
256
|
console.warn('Deprecated site import');
|
|
404
257
|
return (_moduleWrapper$curren2 = _ChaynsProvider.moduleWrapper.current.values.site) === null || _moduleWrapper$curren2 === void 0 ? void 0 : _moduleWrapper$curren2[prop];
|
|
405
258
|
}
|
|
@@ -408,7 +261,6 @@ exports.site = site;
|
|
|
408
261
|
const device = new Proxy({}, {
|
|
409
262
|
get: (target, prop) => {
|
|
410
263
|
var _moduleWrapper$curren3;
|
|
411
|
-
|
|
412
264
|
console.warn('Deprecated device import');
|
|
413
265
|
return (_moduleWrapper$curren3 = _ChaynsProvider.moduleWrapper.current.values.device) === null || _moduleWrapper$curren3 === void 0 ? void 0 : _moduleWrapper$curren3[prop];
|
|
414
266
|
}
|
|
@@ -417,7 +269,6 @@ exports.device = device;
|
|
|
417
269
|
const language = new Proxy({}, {
|
|
418
270
|
get: (target, prop) => {
|
|
419
271
|
var _moduleWrapper$curren4;
|
|
420
|
-
|
|
421
272
|
console.warn('Deprecated language import');
|
|
422
273
|
return (_moduleWrapper$curren4 = _ChaynsProvider.moduleWrapper.current.values.language) === null || _moduleWrapper$curren4 === void 0 ? void 0 : _moduleWrapper$curren4[prop];
|
|
423
274
|
}
|
|
@@ -426,7 +277,6 @@ exports.language = language;
|
|
|
426
277
|
const parameters = new Proxy({}, {
|
|
427
278
|
get: (target, prop) => {
|
|
428
279
|
var _moduleWrapper$curren5;
|
|
429
|
-
|
|
430
280
|
console.warn('Deprecated parameters import');
|
|
431
281
|
return (_moduleWrapper$curren5 = _ChaynsProvider.moduleWrapper.current.values.parameters) === null || _moduleWrapper$curren5 === void 0 ? void 0 : _moduleWrapper$curren5[prop];
|
|
432
282
|
}
|
|
@@ -435,7 +285,6 @@ exports.parameters = parameters;
|
|
|
435
285
|
const pages = new Proxy({}, {
|
|
436
286
|
get: (target, prop) => {
|
|
437
287
|
var _moduleWrapper$curren6;
|
|
438
|
-
|
|
439
288
|
console.warn('Deprecated pages import');
|
|
440
289
|
return (_moduleWrapper$curren6 = _ChaynsProvider.moduleWrapper.current.values.pages) === null || _moduleWrapper$curren6 === void 0 ? void 0 : _moduleWrapper$curren6[prop];
|
|
441
290
|
}
|
|
@@ -444,7 +293,6 @@ exports.pages = pages;
|
|
|
444
293
|
const environment = new Proxy({}, {
|
|
445
294
|
get: (target, prop) => {
|
|
446
295
|
var _moduleWrapper$curren7;
|
|
447
|
-
|
|
448
296
|
console.warn('Deprecated environment import');
|
|
449
297
|
return (_moduleWrapper$curren7 = _ChaynsProvider.moduleWrapper.current.values.environment) === null || _moduleWrapper$curren7 === void 0 ? void 0 : _moduleWrapper$curren7[prop];
|
|
450
298
|
}
|
|
@@ -5,35 +5,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.sendMessageToUser = exports.sendMessageToPage = exports.sendMessageToGroup = void 0;
|
|
7
7
|
const INTERCOM_URL = 'https://sub54.tobit.com/rest/api';
|
|
8
|
-
/**
|
|
9
|
-
* @category Intercom functions
|
|
8
|
+
/**
|
|
9
|
+
* @category Intercom functions
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
11
|
const sendMessageToUser = async (api, object, receiverUserId) => {
|
|
13
12
|
var _api$values$user;
|
|
14
|
-
|
|
15
13
|
if (!object.text) {
|
|
16
14
|
return Promise.reject(new Error('no text specified'));
|
|
17
15
|
}
|
|
18
|
-
|
|
19
16
|
const senderUserId = (_api$values$user = api.values.user) === null || _api$values$user === void 0 ? void 0 : _api$values$user.userId;
|
|
20
|
-
|
|
21
17
|
if (senderUserId === undefined) {
|
|
22
18
|
return Promise.reject(new Error('missing sender user id'));
|
|
23
19
|
}
|
|
24
|
-
|
|
25
20
|
const {
|
|
26
21
|
accessToken
|
|
27
22
|
} = await api.functions.getAccessToken();
|
|
28
|
-
|
|
29
23
|
if (!accessToken) {
|
|
30
24
|
return Promise.reject(new Error('send message requires a user to be logged in'));
|
|
31
25
|
}
|
|
32
|
-
|
|
33
26
|
if (!accessToken) {
|
|
34
27
|
return Promise.reject(new Error('send message requires a user to be logged in'));
|
|
35
28
|
}
|
|
36
|
-
|
|
37
29
|
const images = Array.isArray(object.images) ? object.images.map(imageUrl => ({
|
|
38
30
|
url: imageUrl
|
|
39
31
|
})) : [];
|
|
@@ -48,34 +40,25 @@ const sendMessageToUser = async (api, object, receiverUserId) => {
|
|
|
48
40
|
}
|
|
49
41
|
});
|
|
50
42
|
};
|
|
51
|
-
/**
|
|
52
|
-
* @category Intercom functions
|
|
43
|
+
/**
|
|
44
|
+
* @category Intercom functions
|
|
53
45
|
*/
|
|
54
|
-
|
|
55
|
-
|
|
56
46
|
exports.sendMessageToUser = sendMessageToUser;
|
|
57
|
-
|
|
58
47
|
const sendMessageToPage = async (api, object) => {
|
|
59
48
|
var _api$values$user2;
|
|
60
|
-
|
|
61
49
|
if (!object.text) {
|
|
62
50
|
return Promise.reject(new Error('no text specified'));
|
|
63
51
|
}
|
|
64
|
-
|
|
65
52
|
const senderUserId = (_api$values$user2 = api.values.user) === null || _api$values$user2 === void 0 ? void 0 : _api$values$user2.userId;
|
|
66
|
-
|
|
67
53
|
if (senderUserId === undefined) {
|
|
68
54
|
return Promise.reject(new Error('missing sender user id'));
|
|
69
55
|
}
|
|
70
|
-
|
|
71
56
|
const {
|
|
72
57
|
accessToken
|
|
73
58
|
} = await api.functions.getAccessToken();
|
|
74
|
-
|
|
75
59
|
if (!accessToken) {
|
|
76
60
|
return Promise.reject(new Error('send message requires a user to be logged in'));
|
|
77
61
|
}
|
|
78
|
-
|
|
79
62
|
const images = Array.isArray(object.images) ? object.images.map(imageUrl => ({
|
|
80
63
|
url: imageUrl
|
|
81
64
|
})) : [];
|
|
@@ -90,29 +73,23 @@ const sendMessageToPage = async (api, object) => {
|
|
|
90
73
|
}
|
|
91
74
|
});
|
|
92
75
|
};
|
|
93
|
-
/**
|
|
94
|
-
* @category Intercom functions
|
|
76
|
+
/**
|
|
77
|
+
* @category Intercom functions
|
|
95
78
|
*/
|
|
96
|
-
|
|
97
|
-
|
|
98
79
|
exports.sendMessageToPage = sendMessageToPage;
|
|
99
|
-
|
|
100
80
|
const sendMessageToGroup = async (api, object, groupId) => {
|
|
101
81
|
if (!object.text) {
|
|
102
82
|
return Promise.reject(new Error('no text specified'));
|
|
103
83
|
}
|
|
104
|
-
|
|
105
84
|
const {
|
|
106
85
|
accessToken
|
|
107
86
|
} = await api.functions.getAccessToken();
|
|
108
87
|
const {
|
|
109
88
|
locationId
|
|
110
89
|
} = api.values.site;
|
|
111
|
-
|
|
112
90
|
if (!accessToken) {
|
|
113
91
|
return Promise.reject(new Error('send message requires a user to be logged in'));
|
|
114
92
|
}
|
|
115
|
-
|
|
116
93
|
const images = Array.isArray(object.images) ? object.images.map(imageUrl => ({
|
|
117
94
|
url: imageUrl
|
|
118
95
|
})) : [];
|
|
@@ -127,13 +104,10 @@ const sendMessageToGroup = async (api, object, groupId) => {
|
|
|
127
104
|
}
|
|
128
105
|
});
|
|
129
106
|
};
|
|
130
|
-
/**
|
|
131
|
-
* @category Intercom functions
|
|
107
|
+
/**
|
|
108
|
+
* @category Intercom functions
|
|
132
109
|
*/
|
|
133
|
-
|
|
134
|
-
|
|
135
110
|
exports.sendMessageToGroup = sendMessageToGroup;
|
|
136
|
-
|
|
137
111
|
function sendMessage(endpoint, token, body) {
|
|
138
112
|
return fetch(`${INTERCOM_URL}${endpoint}`, {
|
|
139
113
|
method: 'POST',
|