chayns-api 1.0.12 → 1.1.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/.babelrc +30 -30
- package/.eslintrc +17 -17
- package/.github/workflows/deploy_docs.yml +28 -28
- package/.github/workflows/publish.yml +21 -21
- package/LICENSE +21 -21
- package/README.md +54 -54
- package/dist/cjs/bootstrap.js +11 -0
- package/dist/cjs/calls/abstractApiListener.js +40 -0
- package/dist/cjs/calls/apiEventListener.js +40 -0
- package/dist/cjs/calls/dialogs/date.js +10 -10
- package/dist/cjs/calls/index.js +102 -97
- package/dist/cjs/calls/sendMessage.js +8 -8
- package/dist/cjs/calls/setVisibilityChangeListener.js +1 -0
- package/dist/cjs/calls/visibilityChangeListener.js +4 -4
- package/dist/cjs/calls/windowMetricsListener.js +18 -0
- package/dist/cjs/client.js +93 -0
- package/dist/cjs/components/App.js +32 -0
- package/dist/cjs/components/App.spec.js +16 -0
- package/dist/cjs/components/AppDialogWrapper.js +42 -0
- package/dist/cjs/components/Button.js +32 -0
- package/dist/cjs/components/ChaynsModuleProvider.js +457 -0
- package/dist/cjs/components/ChaynsProvider.js +5 -2
- package/dist/cjs/components/ChaynsProviderExposed.js +16 -0
- package/dist/cjs/components/Dialog.js +1 -0
- package/dist/cjs/components/TestProvider.js +236 -0
- package/dist/cjs/components/Title.js +162 -0
- package/dist/cjs/functions/addApiListener.js +37 -0
- package/dist/cjs/functions/addGeoLocationListener.js +26 -0
- package/dist/cjs/functions/addScrollListener.js +26 -0
- package/dist/cjs/functions/addWindowMetricsListener.js +37 -0
- package/dist/cjs/handler/DialogHandler.js +40 -0
- package/dist/cjs/helper/cssLoader.js +28 -0
- package/dist/cjs/hooks/addGeoLocationListener.js +26 -0
- package/dist/cjs/hooks/addScrollListener.js +26 -0
- package/dist/cjs/hooks/addWindowMetricsListener.js +37 -0
- package/dist/cjs/hooks/geoLocation.js +48 -0
- package/dist/cjs/hooks/geoLocationListener.js +4 -4
- package/dist/cjs/hooks/index.js +14 -1
- package/dist/cjs/hooks/scrollListener.js +8 -8
- package/dist/cjs/hooks/useAccessToken.js +2 -2
- package/dist/cjs/hooks/useAddGeoLocationListener.js +26 -0
- package/dist/cjs/hooks/useAddScrollListener.js +48 -0
- package/dist/cjs/hooks/useAddWindowMetricsListener.js +45 -0
- package/dist/cjs/hooks/useAdddScrollListener.js +26 -0
- package/dist/cjs/hooks/useCurrentPage.js +2 -2
- package/dist/cjs/hooks/useCustomData.js +2 -2
- package/dist/cjs/hooks/useDevice.js +2 -2
- package/dist/cjs/hooks/useDialogState.js +35 -0
- package/dist/cjs/hooks/useEnvironment.js +2 -2
- package/dist/cjs/hooks/useFunction.js +13 -0
- package/dist/cjs/hooks/useFunctions.js +2 -2
- package/dist/cjs/hooks/useIsAdminMode.js +2 -2
- package/dist/cjs/hooks/useLanguage.js +2 -2
- package/dist/cjs/hooks/usePages.js +4 -4
- package/dist/cjs/hooks/useParameters.js +2 -2
- package/dist/cjs/hooks/useSite.js +2 -2
- package/dist/cjs/hooks/useUser.js +2 -2
- package/dist/cjs/hooks/useValues.js +2 -2
- package/dist/cjs/hooks/windowMetrics.js +45 -0
- package/dist/cjs/hooks/windowMetricsListener.js +4 -4
- package/dist/cjs/host/ChaynsHost.js +10 -5
- package/dist/cjs/host/HostIframe.js +157 -0
- package/dist/cjs/host/ModuleHost.js +11 -0
- package/dist/cjs/host/iframe/HostIframe.js +5 -2
- package/dist/cjs/host/module/ModuleHost.js +4 -0
- package/dist/cjs/host/module/utils.js +25 -0
- package/dist/cjs/index.example.js +7 -0
- package/dist/cjs/index2.js +64 -0
- package/dist/cjs/types/DynamicApiImport.d.js +5 -0
- package/dist/cjs/types/DynamicImport.d.js +5 -0
- package/dist/cjs/types/IChaynsReact.js +22 -2
- package/dist/cjs/types/chayns-components.d.js +1 -0
- package/dist/cjs/types/chayns-logger.d.js +1 -0
- package/dist/cjs/types/chayns.d.js +1 -0
- package/dist/cjs/types/tobit-websocket-service-client.d.js +1 -0
- package/dist/cjs/types/toolkit-types.d.js +1 -0
- package/dist/cjs/util/deviceHelper.js +7 -6
- package/dist/cjs/util/useFunctionsContext.js +16 -0
- package/dist/cjs/util/useIsAdminMode.js +18 -0
- package/dist/cjs/util/useUser.js +16 -0
- package/dist/cjs/wrapper/AppWrapper.js +39 -0
- package/dist/cjs/wrapper/Dialog.js +35 -0
- package/dist/cjs/wrapper/DialogHandler.js +35 -0
- package/dist/cjs/wrapper/FrameWrapper.js +17 -0
- package/dist/cjs/wrapper/ModuleFederationWrapper.js +4 -0
- package/dist/esm/bootstrap.js +4 -0
- package/dist/esm/calls/dialogs/date.js +34 -34
- package/dist/esm/calls/index.js +102 -96
- package/dist/esm/calls/sendMessage.js +8 -8
- package/dist/esm/calls/visibilityChangeListener.js +4 -4
- package/dist/esm/client.js +8 -0
- package/dist/esm/components/App.js +35 -0
- package/dist/esm/components/App.spec.js +9 -0
- package/dist/esm/components/AppDialogWrapper.js +33 -0
- package/dist/esm/components/Button.js +34 -0
- package/dist/esm/components/ChaynsModuleProvider.js +517 -0
- package/dist/esm/components/ChaynsProvider.js +5 -2
- package/dist/esm/components/ChaynsProviderExposed.js +3 -0
- package/dist/esm/components/Dialog.js +0 -0
- package/dist/esm/components/TestProvider.js +308 -0
- package/dist/esm/components/Title.js +210 -0
- package/dist/esm/handler/DialogHandler.js +36 -0
- package/dist/esm/helper/cssLoader.js +21 -0
- package/dist/esm/hooks/geoLocationListener.js +4 -4
- package/dist/esm/hooks/index.js +2 -1
- package/dist/esm/hooks/scrollListener.js +8 -8
- package/dist/esm/hooks/useAccessToken.js +2 -2
- package/dist/esm/hooks/useAddGeoLocationListener.js +18 -0
- package/dist/esm/hooks/useAddScrollListener.js +18 -0
- package/dist/esm/hooks/useAddWindowMetricsListener.js +18 -0
- package/dist/esm/hooks/useCurrentPage.js +2 -2
- package/dist/esm/hooks/useCustomData.js +2 -2
- package/dist/esm/hooks/useDevice.js +2 -2
- package/dist/esm/hooks/useDialogState.js +28 -0
- package/dist/esm/hooks/useEnvironment.js +2 -2
- package/dist/esm/hooks/useFunction.js +6 -0
- package/dist/esm/hooks/useFunctions.js +2 -2
- package/dist/esm/hooks/useIsAdminMode.js +2 -2
- package/dist/esm/hooks/useLanguage.js +2 -2
- package/dist/esm/hooks/usePages.js +4 -4
- package/dist/esm/hooks/useParameters.js +2 -2
- package/dist/esm/hooks/useSite.js +2 -2
- package/dist/esm/hooks/useUser.js +2 -2
- package/dist/esm/hooks/useValues.js +2 -2
- package/dist/esm/hooks/windowMetricsListener.js +4 -4
- package/dist/esm/host/ChaynsHost.js +10 -5
- package/dist/esm/host/HostIframe.js +153 -0
- package/dist/esm/host/iframe/HostIframe.js +5 -2
- package/dist/esm/host/module/ModuleHost.js +4 -0
- package/dist/esm/index.example.js +1 -0
- package/dist/esm/index2.js +5 -0
- package/dist/esm/types/DynamicApiImport.d.js +1 -0
- package/dist/esm/types/DynamicImport.d.js +1 -0
- package/dist/esm/types/IChaynsReact.js +19 -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/deviceHelper.js +7 -6
- package/dist/esm/util/useIsAdminMode.js +9 -0
- package/dist/esm/util/useUser.js +7 -0
- package/dist/esm/wrapper/AppWrapper.js +39 -0
- package/dist/esm/wrapper/Dialog.js +31 -0
- package/dist/esm/wrapper/DialogHandler.js +31 -0
- package/dist/esm/wrapper/FrameWrapper.js +17 -0
- package/dist/esm/wrapper/ModuleFederationWrapper.js +4 -0
- package/dist/types/bootstrap.d.ts +1 -0
- 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 +237 -233
- package/dist/types/calls/sendMessage.d.ts +13 -13
- package/dist/types/calls/visibilityChangeListener.d.ts +9 -9
- package/dist/types/client.d.ts +7 -0
- package/dist/types/components/App.d.ts +5 -0
- package/dist/types/components/AppDialogWrapper.d.ts +5 -0
- package/dist/types/components/Button.d.ts +8 -0
- package/dist/types/components/ChaynsContext.d.ts +3 -3
- package/dist/types/components/ChaynsModuleProvider.d.ts +170 -0
- package/dist/types/components/ChaynsProvider.d.ts +14 -14
- package/dist/types/components/ChaynsProviderExposed.d.ts +13 -0
- package/dist/types/components/Dialog.d.ts +0 -0
- package/dist/types/components/Title.d.ts +3 -0
- package/dist/types/components/WaitUntil.d.ts +8 -8
- package/dist/types/components/withCompatMode.d.ts +13 -13
- package/dist/types/handler/DialogHandler.d.ts +12 -0
- 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 +17 -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/useDialogState.d.ts +9 -0
- package/dist/types/hooks/useEnvironment.d.ts +5 -5
- package/dist/types/hooks/useFunction.d.ts +2 -0
- 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 -18
- 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 +30 -29
- package/dist/types/host/HostIframe.d.ts +20 -0
- package/dist/types/host/iframe/HostIframe.d.ts +26 -25
- package/dist/types/host/iframe/utils/useUpdateData.d.ts +3 -3
- package/dist/types/host/module/ModuleHost.d.ts +26 -25
- 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/index.example.d.ts +0 -0
- package/dist/types/types/IChaynsReact.d.ts +702 -623
- 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/util/url.d.ts +1 -1
- package/dist/types/wrapper/AppWrapper.d.ts +22 -18
- package/dist/types/wrapper/Dialog.d.ts +10 -0
- package/dist/types/wrapper/DialogHandler.d.ts +10 -0
- 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 +75 -75
- package/tsconfig.json +56 -56
|
@@ -3,32 +3,32 @@ import { isDate, isNumber, isObject } from './utils/is';
|
|
|
3
3
|
import { open } from './open';
|
|
4
4
|
import { getDevice } from "../index";
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* The config object for date dialog
|
|
8
|
-
* @typedef {Object} dateConfig
|
|
9
|
-
* @property {Date} preSelect - The date object which should be preselected.
|
|
10
|
-
* @property {Date} minDate - The min date which you could select.
|
|
11
|
-
* @property {Date} maxDate - The max date which you could select.
|
|
12
|
-
* @property {dateDialogType} dateType - The type of dialog you want to display.
|
|
13
|
-
* @property {number} minuteIntervall - The interval for special minutes, possible are 2, 3, 4, 5, 6, 12, 15, 20, 30. Default is 1.
|
|
14
|
-
* @property {string} message - The message that is displayed above the date dialog, only in apps supported
|
|
15
|
-
* @property {string} title - The title that is displayed above the message, only in apps supported
|
|
6
|
+
/**
|
|
7
|
+
* The config object for date dialog
|
|
8
|
+
* @typedef {Object} dateConfig
|
|
9
|
+
* @property {Date} preSelect - The date object which should be preselected.
|
|
10
|
+
* @property {Date} minDate - The min date which you could select.
|
|
11
|
+
* @property {Date} maxDate - The max date which you could select.
|
|
12
|
+
* @property {dateDialogType} dateType - The type of dialog you want to display.
|
|
13
|
+
* @property {number} minuteIntervall - The interval for special minutes, possible are 2, 3, 4, 5, 6, 12, 15, 20, 30. Default is 1.
|
|
14
|
+
* @property {string} message - The message that is displayed above the date dialog, only in apps supported
|
|
15
|
+
* @property {string} title - The title that is displayed above the message, only in apps supported
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* This call will open a date select dialog.
|
|
20
|
-
* <div>Call: 30</div>
|
|
21
|
-
* @param {dateConfig} config - Define the configuration of this call
|
|
22
|
-
* @return {Promise} contains a timestamp as result
|
|
23
|
-
* @example chayns.dialog.date({
|
|
24
|
-
* 'dateType': chayns.dialog.dateType.DATE_TIME,
|
|
25
|
-
* 'preSelect': new Date(2018, 6, 14, 0, 0, 0),
|
|
26
|
-
* 'minDate': new Date(2018, 6, 1, 15, 0, 0),
|
|
27
|
-
* 'maxDate': new Date(2019, 6, 1, 0, 23, 0),
|
|
28
|
-
* 'minuteInterval': 15
|
|
29
|
-
* ).then(function (data) {
|
|
30
|
-
* console.log(data);
|
|
31
|
-
* });
|
|
18
|
+
/**
|
|
19
|
+
* This call will open a date select dialog.
|
|
20
|
+
* <div>Call: 30</div>
|
|
21
|
+
* @param {dateConfig} config - Define the configuration of this call
|
|
22
|
+
* @return {Promise} contains a timestamp as result
|
|
23
|
+
* @example chayns.dialog.date({
|
|
24
|
+
* 'dateType': chayns.dialog.dateType.DATE_TIME,
|
|
25
|
+
* 'preSelect': new Date(2018, 6, 14, 0, 0, 0),
|
|
26
|
+
* 'minDate': new Date(2018, 6, 1, 15, 0, 0),
|
|
27
|
+
* 'maxDate': new Date(2019, 6, 1, 0, 23, 0),
|
|
28
|
+
* 'minuteInterval': 15
|
|
29
|
+
* ).then(function (data) {
|
|
30
|
+
* console.log(data);
|
|
31
|
+
* });
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
34
|
export function date() {
|
|
@@ -165,18 +165,18 @@ export function advancedDate() {
|
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
/**
|
|
169
|
-
* @typedef {number} dateDialogType
|
|
168
|
+
/**
|
|
169
|
+
* @typedef {number} dateDialogType
|
|
170
170
|
*/
|
|
171
171
|
|
|
172
|
-
/**
|
|
173
|
-
* Enum for date dialog
|
|
174
|
-
* <div>DATE will open a dialog where you can select a special day</div>
|
|
175
|
-
* <div>TIME will open a dialog where you can only select a special time</div>
|
|
176
|
-
* <div>DATE_TIME will open a dialog where you can select a special time on a special day</div>
|
|
177
|
-
* @readonly
|
|
178
|
-
* @enum {dateDialogType}
|
|
179
|
-
* @type {{DATE: number, TIME: number, DATE_TIME: number}}
|
|
172
|
+
/**
|
|
173
|
+
* Enum for date dialog
|
|
174
|
+
* <div>DATE will open a dialog where you can select a special day</div>
|
|
175
|
+
* <div>TIME will open a dialog where you can only select a special time</div>
|
|
176
|
+
* <div>DATE_TIME will open a dialog where you can select a special time on a special day</div>
|
|
177
|
+
* @readonly
|
|
178
|
+
* @enum {dateDialogType}
|
|
179
|
+
* @type {{DATE: number, TIME: number, DATE_TIME: number}}
|
|
180
180
|
*/
|
|
181
181
|
export const dateType = {
|
|
182
182
|
'DATE': 1,
|
package/dist/esm/calls/index.js
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
1
|
import { moduleWrapper } from '../components/ChaynsProvider';
|
|
2
|
-
/**
|
|
3
|
-
* This adds a listener to determine your location.
|
|
4
|
-
* @category Event listener
|
|
2
|
+
/**
|
|
3
|
+
* This adds a listener to determine your location.
|
|
4
|
+
* @category Event listener
|
|
5
5
|
*/
|
|
6
6
|
export const addGeoLocationListener = function () {
|
|
7
7
|
return moduleWrapper.current.functions.addGeoLocationListener(...arguments);
|
|
8
8
|
};
|
|
9
|
-
/**
|
|
10
|
-
* Adds a listener for scroll event by user.
|
|
11
|
-
* @category Event listener
|
|
9
|
+
/**
|
|
10
|
+
* Adds a listener for scroll event by user.
|
|
11
|
+
* @category Event listener
|
|
12
12
|
*/
|
|
13
13
|
export const addScrollListener = function () {
|
|
14
14
|
return moduleWrapper.current.functions.addScrollListener(...arguments);
|
|
15
15
|
};
|
|
16
|
-
/**
|
|
17
|
-
* This method will be executed when the page gets displayed or hidden.
|
|
18
|
-
* @category Event listener
|
|
16
|
+
/**
|
|
17
|
+
* This method will be executed when the page gets displayed or hidden.
|
|
18
|
+
* @category Event listener
|
|
19
19
|
*/
|
|
20
20
|
export const addVisibilityChangeListener = function () {
|
|
21
21
|
return moduleWrapper.current.functions.addVisibilityChangeListener(...arguments);
|
|
22
22
|
};
|
|
23
|
-
/**
|
|
24
|
-
* This adds a listener to get the actual height of the page.
|
|
25
|
-
* @category Event listener
|
|
23
|
+
/**
|
|
24
|
+
* This adds a listener to get the actual height of the page.
|
|
25
|
+
* @category Event listener
|
|
26
26
|
*/
|
|
27
27
|
export const addWindowMetricsListener = function () {
|
|
28
28
|
return moduleWrapper.current.functions.addWindowMetricsListener(...arguments);
|
|
29
|
-
}; /**
|
|
30
|
-
* Allows a custom callback function to be defined
|
|
29
|
+
}; /**
|
|
30
|
+
* Allows a custom callback function to be defined
|
|
31
31
|
*/
|
|
32
32
|
export const customCallbackFunction = function () {
|
|
33
33
|
return moduleWrapper.current.functions.customCallbackFunction(...arguments);
|
|
34
34
|
};
|
|
35
|
-
/**
|
|
36
|
-
* Get the accessToken from the user.
|
|
35
|
+
/**
|
|
36
|
+
* Get the accessToken from the user.
|
|
37
37
|
*/
|
|
38
38
|
export const getAccessToken = function () {
|
|
39
39
|
return moduleWrapper.current.functions.getAccessToken(...arguments);
|
|
40
40
|
};
|
|
41
|
-
/**
|
|
42
|
-
* This method returns a list of installed share/social media apps.
|
|
41
|
+
/**
|
|
42
|
+
* This method returns a list of installed share/social media apps.
|
|
43
43
|
*/
|
|
44
44
|
export const getAvailableSharingServices = function () {
|
|
45
45
|
return moduleWrapper.current.functions.getAvailableSharingServices(...arguments);
|
|
46
46
|
};
|
|
47
|
-
/**
|
|
48
|
-
* This method determines your location. If you want to track a route, use addGeoLocationListener.
|
|
47
|
+
/**
|
|
48
|
+
* This method determines your location. If you want to track a route, use addGeoLocationListener.
|
|
49
49
|
*/
|
|
50
50
|
export const getGeoLocation = function () {
|
|
51
51
|
return moduleWrapper.current.functions.getGeoLocation(...arguments);
|
|
52
52
|
};
|
|
53
|
-
/**
|
|
54
|
-
* This method returns user information for a specific user.
|
|
55
|
-
* @category User functions
|
|
53
|
+
/**
|
|
54
|
+
* This method returns user information for a specific user.
|
|
55
|
+
* @category User functions
|
|
56
56
|
*/
|
|
57
57
|
export const getUserInfo = function () {
|
|
58
58
|
return moduleWrapper.current.functions.getUserInfo(...arguments);
|
|
59
59
|
};
|
|
60
|
-
/**
|
|
61
|
-
* Return the current scroll position of the top frame
|
|
60
|
+
/**
|
|
61
|
+
* Return the current scroll position of the top frame
|
|
62
62
|
*/
|
|
63
63
|
export const getScrollPosition = function () {
|
|
64
64
|
return moduleWrapper.current.functions.getScrollPosition(...arguments);
|
|
65
65
|
};
|
|
66
|
-
/**
|
|
67
|
-
* Returns the window metrics.
|
|
66
|
+
/**
|
|
67
|
+
* Returns the window metrics.
|
|
68
68
|
*/
|
|
69
69
|
export const getWindowMetrics = function () {
|
|
70
70
|
return moduleWrapper.current.functions.getWindowMetrics(...arguments);
|
|
@@ -77,199 +77,205 @@ export const invokeCall = function () {
|
|
|
77
77
|
export const invokeDialogCall = function () {
|
|
78
78
|
return moduleWrapper.current.functions.invokeDialogCall(...arguments);
|
|
79
79
|
};
|
|
80
|
-
/**
|
|
81
|
-
* This method will show a login dialog where the user has the opportunity to log in.
|
|
80
|
+
/**
|
|
81
|
+
* This method will show a login dialog where the user has the opportunity to log in.
|
|
82
82
|
*/
|
|
83
83
|
export const login = function () {
|
|
84
84
|
return moduleWrapper.current.functions.login(...arguments);
|
|
85
85
|
};
|
|
86
|
-
/**
|
|
87
|
-
* This method will logout the user
|
|
86
|
+
/**
|
|
87
|
+
* This method will logout the user
|
|
88
88
|
*/
|
|
89
89
|
export const logout = function () {
|
|
90
90
|
return moduleWrapper.current.functions.logout(...arguments);
|
|
91
91
|
};
|
|
92
|
-
/**
|
|
93
|
-
* This function navigates you to the previous site.
|
|
92
|
+
/**
|
|
93
|
+
* This function navigates you to the previous site.
|
|
94
94
|
*/
|
|
95
95
|
export const navigateBack = function () {
|
|
96
96
|
return moduleWrapper.current.functions.navigateBack(...arguments);
|
|
97
97
|
};
|
|
98
|
-
/**
|
|
99
|
-
* The images specified in the url array is shown in gallery mode.
|
|
98
|
+
/**
|
|
99
|
+
* The images specified in the url array is shown in gallery mode.
|
|
100
100
|
*/
|
|
101
101
|
export const openImage = function () {
|
|
102
102
|
return moduleWrapper.current.functions.openImage(...arguments);
|
|
103
103
|
};
|
|
104
|
-
/**
|
|
105
|
-
* Opens an URL in the chayns environment.
|
|
104
|
+
/**
|
|
105
|
+
* Opens an URL in the chayns environment.
|
|
106
106
|
*/
|
|
107
107
|
export const openUrl = function () {
|
|
108
108
|
return moduleWrapper.current.functions.openUrl(...arguments);
|
|
109
109
|
};
|
|
110
|
-
/**
|
|
111
|
-
* The video specified in the URL is shown in video mode.
|
|
110
|
+
/**
|
|
111
|
+
* The video specified in the URL is shown in video mode.
|
|
112
112
|
*/
|
|
113
113
|
export const openVideo = function () {
|
|
114
114
|
return moduleWrapper.current.functions.openVideo(...arguments);
|
|
115
115
|
};
|
|
116
|
-
/**
|
|
117
|
-
* Refresh badge count in navigation, user information and pages
|
|
116
|
+
/**
|
|
117
|
+
* Refresh badge count in navigation, user information and pages
|
|
118
118
|
*/
|
|
119
119
|
export const refreshData = function () {
|
|
120
120
|
return moduleWrapper.current.functions.refreshData(...arguments);
|
|
121
121
|
};
|
|
122
|
-
/**
|
|
123
|
-
* Refresh accesstoken, should only be used when user object changes, not when token is invalid
|
|
122
|
+
/**
|
|
123
|
+
* Refresh accesstoken, should only be used when user object changes, not when token is invalid
|
|
124
124
|
*/
|
|
125
125
|
export const refreshAccessToken = function () {
|
|
126
126
|
return moduleWrapper.current.functions.refreshAccessToken(...arguments);
|
|
127
127
|
};
|
|
128
|
-
/**
|
|
129
|
-
* This removes a listener to determine your location.
|
|
130
|
-
* @category Event listener
|
|
128
|
+
/**
|
|
129
|
+
* This removes a listener to determine your location.
|
|
130
|
+
* @category Event listener
|
|
131
131
|
*/
|
|
132
132
|
export const removeGeoLocationListener = function () {
|
|
133
133
|
return moduleWrapper.current.functions.removeGeoLocationListener(...arguments);
|
|
134
134
|
};
|
|
135
|
-
/**
|
|
136
|
-
* Removes scroll listener.
|
|
137
|
-
* @category Event listener
|
|
135
|
+
/**
|
|
136
|
+
* Removes scroll listener.
|
|
137
|
+
* @category Event listener
|
|
138
138
|
*/
|
|
139
139
|
export const removeScrollListener = function () {
|
|
140
140
|
return moduleWrapper.current.functions.removeScrollListener(...arguments);
|
|
141
141
|
};
|
|
142
|
-
/**
|
|
143
|
-
* Removes visibility change listener.
|
|
144
|
-
* @category Event listener
|
|
142
|
+
/**
|
|
143
|
+
* Removes visibility change listener.
|
|
144
|
+
* @category Event listener
|
|
145
145
|
*/
|
|
146
146
|
export const removeVisibilityChangeListener = function () {
|
|
147
147
|
return moduleWrapper.current.functions.removeVisibilityChangeListener(...arguments);
|
|
148
148
|
};
|
|
149
|
-
/**
|
|
150
|
-
* Removes window metrics listener.
|
|
151
|
-
* @category Event listener
|
|
149
|
+
/**
|
|
150
|
+
* Removes window metrics listener.
|
|
151
|
+
* @category Event listener
|
|
152
152
|
*/
|
|
153
153
|
export const removeWindowMetricsListener = function () {
|
|
154
154
|
return moduleWrapper.current.functions.removeWindowMetricsListener(...arguments);
|
|
155
155
|
};
|
|
156
|
-
/**
|
|
157
|
-
* Select other page on chayns site.
|
|
156
|
+
/**
|
|
157
|
+
* Select other page on chayns site.
|
|
158
158
|
*/
|
|
159
159
|
export const selectPage = function () {
|
|
160
160
|
return moduleWrapper.current.functions.selectPage(...arguments);
|
|
161
161
|
};
|
|
162
|
-
/**
|
|
163
|
-
* Scrolls by specific amount.
|
|
162
|
+
/**
|
|
163
|
+
* Scrolls by specific amount.
|
|
164
164
|
*/
|
|
165
165
|
export const scrollByY = function () {
|
|
166
166
|
return moduleWrapper.current.functions.scrollByY(...arguments);
|
|
167
167
|
};
|
|
168
|
-
/**
|
|
169
|
-
* Scrolls to specific position.
|
|
168
|
+
/**
|
|
169
|
+
* Scrolls to specific position.
|
|
170
170
|
*/
|
|
171
171
|
export const scrollToY = function () {
|
|
172
172
|
return moduleWrapper.current.functions.scrollToY(...arguments);
|
|
173
173
|
};
|
|
174
|
-
/**
|
|
175
|
-
* Sends intercom message to group.
|
|
174
|
+
/**
|
|
175
|
+
* Sends intercom message to group.
|
|
176
176
|
*/
|
|
177
177
|
export const sendMessageToGroup = function () {
|
|
178
178
|
return moduleWrapper.current.functions.sendMessageToGroup(...arguments);
|
|
179
179
|
};
|
|
180
|
-
/**
|
|
181
|
-
* Sends intercom message to page.
|
|
180
|
+
/**
|
|
181
|
+
* Sends intercom message to page.
|
|
182
182
|
*/
|
|
183
183
|
export const sendMessageToPage = function () {
|
|
184
184
|
return moduleWrapper.current.functions.sendMessageToPage(...arguments);
|
|
185
185
|
};
|
|
186
|
-
/**
|
|
187
|
-
* Sends intercom message to an user.
|
|
186
|
+
/**
|
|
187
|
+
* Sends intercom message to an user.
|
|
188
188
|
*/
|
|
189
189
|
export const sendMessageToUser = function () {
|
|
190
190
|
return moduleWrapper.current.functions.sendMessageToUser(...arguments);
|
|
191
191
|
};
|
|
192
|
-
/**
|
|
193
|
-
* Switches admin mode, also toggles admin switch in top frame.
|
|
192
|
+
/**
|
|
193
|
+
* Switches admin mode, also toggles admin switch in top frame.
|
|
194
194
|
*/
|
|
195
195
|
export const setAdminMode = function () {
|
|
196
196
|
return moduleWrapper.current.functions.setAdminMode(...arguments);
|
|
197
197
|
};
|
|
198
|
-
/**
|
|
199
|
-
* Sets the display timeout, only works in chayns App.
|
|
198
|
+
/**
|
|
199
|
+
* Sets the display timeout, only works in chayns App.
|
|
200
200
|
*/
|
|
201
201
|
export const setDisplayTimeout = function () {
|
|
202
202
|
return moduleWrapper.current.functions.setDisplayTimeout(...arguments);
|
|
203
203
|
};
|
|
204
|
-
/**
|
|
205
|
-
* Enables or disables a button which floats over the page.
|
|
204
|
+
/**
|
|
205
|
+
* Enables or disables a button which floats over the page.
|
|
206
206
|
*/
|
|
207
207
|
export const setFloatingButton = function () {
|
|
208
208
|
return moduleWrapper.current.functions.setFloatingButton(...arguments);
|
|
209
209
|
};
|
|
210
|
-
/**
|
|
211
|
-
* Sets the height of the page.
|
|
210
|
+
/**
|
|
211
|
+
* Sets the height of the page.
|
|
212
212
|
*/
|
|
213
213
|
export const setHeight = function () {
|
|
214
214
|
return moduleWrapper.current.functions.setHeight(...arguments);
|
|
215
215
|
};
|
|
216
|
-
/**
|
|
217
|
-
* Enables or disables the ability to refresh a page
|
|
216
|
+
/**
|
|
217
|
+
* Enables or disables the ability to refresh a page
|
|
218
218
|
*/
|
|
219
219
|
export const setRefreshScrollEnabled = function () {
|
|
220
220
|
return moduleWrapper.current.functions.setRefreshScrollEnabled(...arguments);
|
|
221
221
|
};
|
|
222
|
-
/**
|
|
223
|
-
* Scans a qr-code and returns the result
|
|
222
|
+
/**
|
|
223
|
+
* Scans a qr-code and returns the result
|
|
224
224
|
*/
|
|
225
225
|
export const setScanQrCode = function () {
|
|
226
226
|
return moduleWrapper.current.functions.setScanQrCode(...arguments);
|
|
227
227
|
};
|
|
228
|
-
/**
|
|
229
|
-
* Temporarily change design settings in top frame
|
|
228
|
+
/**
|
|
229
|
+
* Temporarily change design settings in top frame
|
|
230
230
|
*/
|
|
231
231
|
export const setTempDesignSettings = function () {
|
|
232
232
|
return moduleWrapper.current.functions.setTempDesignSettings(...arguments);
|
|
233
233
|
};
|
|
234
|
-
/**
|
|
235
|
-
* Shows or hide a waitcursor
|
|
234
|
+
/**
|
|
235
|
+
* Shows or hide a waitcursor
|
|
236
236
|
*/
|
|
237
237
|
export const setWaitCursor = function () {
|
|
238
238
|
return moduleWrapper.current.functions.setWaitCursor(...arguments);
|
|
239
239
|
};
|
|
240
|
-
/**
|
|
241
|
-
* Retrieves the value that is assigned to the key from a storage outside the frame
|
|
240
|
+
/**
|
|
241
|
+
* Retrieves the value that is assigned to the key from a storage outside the frame
|
|
242
242
|
*/
|
|
243
243
|
export const storageGetItem = function () {
|
|
244
244
|
return moduleWrapper.current.functions.storageGetItem(...arguments);
|
|
245
245
|
};
|
|
246
|
-
/**
|
|
247
|
-
* Removes the value that is assigned to the key from a storage outside the frame
|
|
246
|
+
/**
|
|
247
|
+
* Removes the value that is assigned to the key from a storage outside the frame
|
|
248
248
|
*/
|
|
249
249
|
export const storageRemoveItem = function () {
|
|
250
250
|
return moduleWrapper.current.functions.storageRemoveItem(...arguments);
|
|
251
251
|
};
|
|
252
|
-
/**
|
|
253
|
-
* Sets the value that is assigned to the key from a storage outside the frame
|
|
252
|
+
/**
|
|
253
|
+
* Sets the value that is assigned to the key from a storage outside the frame
|
|
254
254
|
*/
|
|
255
255
|
export const storageSetItem = function () {
|
|
256
256
|
return moduleWrapper.current.functions.storageSetItem(...arguments);
|
|
257
257
|
};
|
|
258
|
-
/**
|
|
259
|
-
* This method lets a smartphone vibrate for the given time.
|
|
258
|
+
/**
|
|
259
|
+
* This method lets a smartphone vibrate for the given time.
|
|
260
260
|
*/
|
|
261
261
|
export const vibrate = function () {
|
|
262
262
|
return moduleWrapper.current.functions.vibrate(...arguments);
|
|
263
263
|
};
|
|
264
|
-
/**
|
|
265
|
-
*
|
|
264
|
+
/**
|
|
265
|
+
* This method creates a dialog
|
|
266
|
+
*/
|
|
267
|
+
export const createDialog = function () {
|
|
268
|
+
return moduleWrapper.current.functions.createDialog(...arguments);
|
|
269
|
+
};
|
|
270
|
+
/**
|
|
271
|
+
* Displays an overlay
|
|
266
272
|
*/
|
|
267
273
|
export const setOverlay = function () {
|
|
268
274
|
return moduleWrapper.current.functions.setOverlay(...arguments);
|
|
269
275
|
};
|
|
270
|
-
/**
|
|
271
|
-
* Returns user information, only when user is logged in
|
|
272
|
-
* @category User functions
|
|
276
|
+
/**
|
|
277
|
+
* Returns user information, only when user is logged in
|
|
278
|
+
* @category User functions
|
|
273
279
|
*/
|
|
274
280
|
export const getUser = () => moduleWrapper.current.values.user;
|
|
275
281
|
export const getSite = () => moduleWrapper.current.values.site;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const INTERCOM_URL = 'https://sub54.tobit.com/rest/api';
|
|
2
|
-
/**
|
|
3
|
-
* @category Intercom functions
|
|
2
|
+
/**
|
|
3
|
+
* @category Intercom functions
|
|
4
4
|
*/
|
|
5
5
|
export const sendMessageToUser = async (api, object, receiverUserId) => {
|
|
6
6
|
var _api$values$user;
|
|
@@ -34,8 +34,8 @@ export const sendMessageToUser = async (api, object, receiverUserId) => {
|
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
};
|
|
37
|
-
/**
|
|
38
|
-
* @category Intercom functions
|
|
37
|
+
/**
|
|
38
|
+
* @category Intercom functions
|
|
39
39
|
*/
|
|
40
40
|
export const sendMessageToPage = async (api, object) => {
|
|
41
41
|
var _api$values$user2;
|
|
@@ -66,8 +66,8 @@ export const sendMessageToPage = async (api, object) => {
|
|
|
66
66
|
}
|
|
67
67
|
});
|
|
68
68
|
};
|
|
69
|
-
/**
|
|
70
|
-
* @category Intercom functions
|
|
69
|
+
/**
|
|
70
|
+
* @category Intercom functions
|
|
71
71
|
*/
|
|
72
72
|
export const sendMessageToGroup = async (api, object, groupId) => {
|
|
73
73
|
if (!object.text) {
|
|
@@ -96,8 +96,8 @@ export const sendMessageToGroup = async (api, object, groupId) => {
|
|
|
96
96
|
}
|
|
97
97
|
});
|
|
98
98
|
};
|
|
99
|
-
/**
|
|
100
|
-
* @category Intercom functions
|
|
99
|
+
/**
|
|
100
|
+
* @category Intercom functions
|
|
101
101
|
*/
|
|
102
102
|
function sendMessage(endpoint, token, body) {
|
|
103
103
|
return fetch(`${INTERCOM_URL}${endpoint}`, {
|
|
@@ -6,8 +6,8 @@ const handleVisibilityChange = () => {
|
|
|
6
6
|
});
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* @category Event listener
|
|
9
|
+
/**
|
|
10
|
+
* @category Event listener
|
|
11
11
|
*/
|
|
12
12
|
export const addVisibilityChangeListener = callback => {
|
|
13
13
|
const {
|
|
@@ -19,8 +19,8 @@ export const addVisibilityChangeListener = callback => {
|
|
|
19
19
|
}
|
|
20
20
|
return id;
|
|
21
21
|
};
|
|
22
|
-
/**
|
|
23
|
-
* @category Event listener
|
|
22
|
+
/**
|
|
23
|
+
* @category Event listener
|
|
24
24
|
*/
|
|
25
25
|
export const removeVisibilityChangeListener = id => {
|
|
26
26
|
const shouldRemove = removeApiListener(key, id);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { default as ChaynsProvider } from './components/ChaynsModuleProvider';
|
|
2
|
+
export { default as ChaynsHost } from './host/ChaynsHost';
|
|
3
|
+
export { default as getDeviceInfo, getScreenSize } from './util/deviceHelper';
|
|
4
|
+
export * from './components/ChaynsModuleProvider';
|
|
5
|
+
export * from './components/withCompatMode';
|
|
6
|
+
import * as _dialog from './calls/dialogs/index';
|
|
7
|
+
export { _dialog as dialog };
|
|
8
|
+
export * from './types/IChaynsReact';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
+
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
13
|
+
import React, { useState } from 'react';
|
|
14
|
+
import Title from './Title';
|
|
15
|
+
import ChaynsProvider from './ChaynsProvider';
|
|
16
|
+
var propTypes = {};
|
|
17
|
+
|
|
18
|
+
var App = function App() {
|
|
19
|
+
var _useState = useState(true),
|
|
20
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
21
|
+
isVisible = _useState2[0],
|
|
22
|
+
setIsVisible = _useState2[1];
|
|
23
|
+
|
|
24
|
+
return /*#__PURE__*/React.createElement(ChaynsProvider, null, /*#__PURE__*/React.createElement("button", {
|
|
25
|
+
type: "button",
|
|
26
|
+
onClick: function onClick() {
|
|
27
|
+
return setIsVisible(function (s) {
|
|
28
|
+
return !s;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}, "Toggle"), isVisible && /*#__PURE__*/React.createElement(Title, null));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
App.propTypes = propTypes;
|
|
35
|
+
export default App;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import App from './App';
|
|
4
|
+
test('should have correct text', function () {
|
|
5
|
+
var _render = render( /*#__PURE__*/React.createElement(App, null)),
|
|
6
|
+
getByRole = _render.getByRole;
|
|
7
|
+
|
|
8
|
+
expect(getByRole("heading")).toHaveTextContent("Hi! Welcome to your newly created chayns application!");
|
|
9
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import ChaynsHost from '../host/ChaynsHost';
|
|
4
|
+
import { useFunctions, useValues } from '../hooks';
|
|
5
|
+
const AppDialogWrapper = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
dialogEventTarget
|
|
8
|
+
} = _ref;
|
|
9
|
+
const functions = useFunctions();
|
|
10
|
+
const data = useValues();
|
|
11
|
+
const [dialogData, setDialogData] = useState({
|
|
12
|
+
dialogs: []
|
|
13
|
+
});
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
dialogEventTarget.addEventListener('change', e => {
|
|
16
|
+
setDialogData({
|
|
17
|
+
dialogs: e.detail
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
}, []);
|
|
21
|
+
return /*#__PURE__*/React.createElement(ChaynsHost, _extends({
|
|
22
|
+
type: "client-module",
|
|
23
|
+
system: {
|
|
24
|
+
module: './AppWrapper',
|
|
25
|
+
url: 'https://tapp-staging.chayns-static.space/api/dialog-v2/v1/remoteEntry.js',
|
|
26
|
+
scope: 'dialog_v2'
|
|
27
|
+
}
|
|
28
|
+
}, data, {
|
|
29
|
+
functions: functions,
|
|
30
|
+
customData: dialogData
|
|
31
|
+
}));
|
|
32
|
+
};
|
|
33
|
+
export default AppDialogWrapper;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
|
|
3
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
|
|
5
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
6
|
+
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8
|
+
|
|
9
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
10
|
+
|
|
11
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
12
|
+
|
|
13
|
+
import React, { useState } from 'react';
|
|
14
|
+
import ChaynsProvider from './ChaynsProvider';
|
|
15
|
+
import Title from './Title';
|
|
16
|
+
import withCompatMode from './withCompatMode';
|
|
17
|
+
|
|
18
|
+
var Button = function Button(props) {
|
|
19
|
+
var _useState = useState(true),
|
|
20
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
21
|
+
visible = _useState2[0],
|
|
22
|
+
setVisible = _useState2[1];
|
|
23
|
+
|
|
24
|
+
return /*#__PURE__*/React.createElement(ChaynsProvider, props, /*#__PURE__*/React.createElement("button", {
|
|
25
|
+
type: "button",
|
|
26
|
+
onClick: function onClick() {
|
|
27
|
+
return setVisible(function (s) {
|
|
28
|
+
return !s;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}, "Toggle"), visible && /*#__PURE__*/React.createElement(Title, null));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default withCompatMode(Button);
|