chayns-api 2.1.3-3 → 2.1.4
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 +31 -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 +67 -67
- package/dist/cjs/calls/dialogs/chaynsDialog.js +0 -2
- package/dist/cjs/calls/dialogs/communication.js +0 -2
- package/dist/cjs/calls/dialogs/confirm.js +0 -1
- package/dist/cjs/calls/dialogs/date.js +0 -50
- package/dist/cjs/calls/dialogs/iFrame.js +1 -1
- package/dist/cjs/calls/index.js +1 -162
- package/dist/cjs/calls/sendMessage.js +0 -12
- package/dist/cjs/calls/visibilityChangeListener.js +0 -7
- package/dist/cjs/components/AppDialogWrapper.js +3 -3
- package/dist/cjs/components/ChaynsContext.js +1 -1
- package/dist/cjs/components/ChaynsProvider.js +6 -10
- package/dist/cjs/components/ErrorBoundary.js +1 -1
- package/dist/cjs/components/WaitUntil.js +0 -2
- package/dist/cjs/components/withCompatMode.js +9 -13
- package/dist/cjs/components/withHydrationBoundary.js +2 -2
- package/dist/cjs/constants/hydrationContext.js +1 -3
- package/dist/cjs/constants/languages.js +1 -1
- package/dist/cjs/handler/DialogHandler.js +0 -4
- package/dist/cjs/hooks/geoLocationListener.js +0 -7
- package/dist/cjs/hooks/scrollListener.js +0 -14
- package/dist/cjs/hooks/useAccessToken.js +0 -4
- package/dist/cjs/hooks/useCurrentPage.js +0 -3
- package/dist/cjs/hooks/useCustomCallbackFunction.js +0 -4
- package/dist/cjs/hooks/useCustomData.js +0 -3
- package/dist/cjs/hooks/useDevice.js +0 -3
- package/dist/cjs/hooks/useDialogState.js +0 -7
- package/dist/cjs/hooks/useEnvironment.js +0 -3
- package/dist/cjs/hooks/useFunctions.js +0 -3
- package/dist/cjs/hooks/useIsAdminMode.js +0 -3
- package/dist/cjs/hooks/useLanguage.js +0 -3
- package/dist/cjs/hooks/usePages.js +0 -6
- package/dist/cjs/hooks/useParameters.js +0 -3
- package/dist/cjs/hooks/useSite.js +0 -3
- package/dist/cjs/hooks/useUser.js +0 -3
- package/dist/cjs/hooks/useValues.js +0 -3
- package/dist/cjs/hooks/windowMetricsListener.js +0 -7
- package/dist/cjs/host/ChaynsHost.js +3 -4
- package/dist/cjs/host/iframe/HostIframe.js +4 -23
- package/dist/cjs/host/module/ModuleHost.js +5 -9
- package/dist/cjs/host/module/utils/loadComponent.js +4 -5
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/types/IChaynsReact.js +39 -46
- package/dist/cjs/util/appCall.js +0 -2
- package/dist/cjs/util/deviceHelper.js +0 -4
- package/dist/cjs/util/heightHelper.js +1 -1
- package/dist/cjs/util/initModuleFederationSharing.js +2 -6
- package/dist/cjs/util/postIframeForm.js +0 -1
- package/dist/cjs/util/transferNestedFunctions.js +0 -3
- package/dist/cjs/wrapper/AppWrapper.js +6 -20
- package/dist/cjs/wrapper/FrameWrapper.js +2 -7
- package/dist/cjs/wrapper/ModuleFederationWrapper.js +1 -3
- package/dist/cjs/wrapper/StaticChaynsApi.js +1 -1
- package/dist/esm/calls/dialogs/chaynsDialog.js +0 -2
- package/dist/esm/calls/dialogs/communication.js +0 -2
- package/dist/esm/calls/dialogs/confirm.js +0 -1
- package/dist/esm/calls/dialogs/date.js +0 -51
- package/dist/esm/calls/dialogs/iFrame.js +1 -1
- package/dist/esm/calls/index.js +1 -162
- package/dist/esm/calls/sendMessage.js +0 -12
- package/dist/esm/calls/visibilityChangeListener.js +0 -7
- package/dist/esm/components/AppDialogWrapper.js +2 -2
- package/dist/esm/components/ChaynsContext.js +1 -1
- package/dist/esm/components/ChaynsProvider.js +5 -10
- package/dist/esm/components/WaitUntil.js +0 -2
- package/dist/esm/components/withCompatMode.js +8 -14
- package/dist/esm/components/withHydrationBoundary.js +2 -2
- package/dist/esm/constants/hydrationContext.js +1 -3
- package/dist/esm/constants/languages.js +1 -1
- package/dist/esm/handler/DialogHandler.js +1 -5
- package/dist/esm/hooks/geoLocationListener.js +0 -7
- package/dist/esm/hooks/scrollListener.js +0 -14
- package/dist/esm/hooks/useAccessToken.js +0 -5
- package/dist/esm/hooks/useCurrentPage.js +0 -4
- package/dist/esm/hooks/useCustomCallbackFunction.js +0 -5
- package/dist/esm/hooks/useCustomData.js +0 -4
- package/dist/esm/hooks/useDevice.js +0 -3
- package/dist/esm/hooks/useDialogState.js +0 -8
- package/dist/esm/hooks/useEnvironment.js +0 -3
- package/dist/esm/hooks/useFunctions.js +0 -4
- package/dist/esm/hooks/useIsAdminMode.js +0 -3
- package/dist/esm/hooks/useLanguage.js +0 -3
- package/dist/esm/hooks/usePages.js +0 -6
- package/dist/esm/hooks/useParameters.js +0 -3
- package/dist/esm/hooks/useSite.js +0 -3
- package/dist/esm/hooks/useUser.js +0 -3
- package/dist/esm/hooks/useValues.js +0 -4
- package/dist/esm/hooks/windowMetricsListener.js +0 -7
- package/dist/esm/host/ChaynsHost.js +2 -3
- package/dist/esm/host/iframe/HostIframe.js +3 -22
- package/dist/esm/host/module/ModuleHost.js +4 -8
- package/dist/esm/host/module/utils/loadComponent.js +3 -4
- package/dist/esm/types/IChaynsReact.js +39 -49
- package/dist/esm/util/appCall.js +0 -2
- package/dist/esm/util/deviceHelper.js +0 -4
- package/dist/esm/util/initModuleFederationSharing.js +1 -5
- package/dist/esm/util/postIframeForm.js +0 -1
- package/dist/esm/util/transferNestedFunctions.js +0 -2
- package/dist/esm/wrapper/AppWrapper.js +6 -20
- package/dist/esm/wrapper/FrameWrapper.js +2 -6
- package/dist/esm/wrapper/ModuleFederationWrapper.js +1 -3
- package/dist/esm/wrapper/SsrWrapper.js +1 -1
- package/dist/esm/wrapper/StaticChaynsApi.js +1 -1
- 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 +255 -255
- package/dist/types/calls/sendMessage.d.ts +13 -13
- package/dist/types/calls/visibilityChangeListener.d.ts +9 -9
- package/dist/types/components/AppDialogWrapper.d.ts +5 -5
- package/dist/types/components/ChaynsContext.d.ts +3 -3
- package/dist/types/components/ChaynsProvider.d.ts +11 -11
- package/dist/types/components/ErrorBoundary.d.ts +13 -13
- package/dist/types/components/WaitUntil.d.ts +7 -7
- package/dist/types/components/moduleWrapper.d.ts +4 -4
- package/dist/types/components/withCompatMode.d.ts +43 -43
- package/dist/types/components/withHydrationBoundary.d.ts +24 -24
- package/dist/types/constants/hydrationContext.d.ts +6 -6
- package/dist/types/constants/index.d.ts +1 -1
- package/dist/types/constants/languages.d.ts +12 -12
- package/dist/types/handler/DialogHandler.d.ts +24 -24
- package/dist/types/helper/apiListenerHelper.d.ts +6 -6
- package/dist/types/hooks/context.d.ts +3 -3
- package/dist/types/hooks/geoLocationListener.d.ts +18 -18
- package/dist/types/hooks/index.d.ts +18 -18
- package/dist/types/hooks/scrollListener.d.ts +28 -28
- package/dist/types/hooks/useAccessToken.d.ts +6 -6
- package/dist/types/hooks/useCurrentPage.d.ts +5 -5
- package/dist/types/hooks/useCustomCallbackFunction.d.ts +5 -5
- 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 -9
- package/dist/types/hooks/useEnvironment.d.ts +5 -5
- package/dist/types/hooks/useFunctions.d.ts +4 -4
- 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 +4 -4
- package/dist/types/hooks/windowMetricsListener.d.ts +11 -11
- package/dist/types/host/ChaynsHost.d.ts +29 -29
- package/dist/types/host/iframe/HostIframe.d.ts +26 -26
- package/dist/types/host/iframe/utils/useUpdateData.d.ts +3 -3
- package/dist/types/host/module/ModuleHost.d.ts +28 -28
- package/dist/types/host/module/utils/loadComponent.d.ts +3 -3
- package/dist/types/index.d.ts +20 -20
- package/dist/types/types/IChaynsReact.d.ts +899 -899
- package/dist/types/types/dialog.d.ts +41 -41
- package/dist/types/util/appCall.d.ts +2 -2
- package/dist/types/util/bindChaynsApi.d.ts +1 -1
- package/dist/types/util/deviceHelper.d.ts +9 -9
- package/dist/types/util/heightHelper.d.ts +1 -1
- package/dist/types/util/initModuleFederationSharing.d.ts +3 -3
- package/dist/types/util/is.d.ts +5 -5
- package/dist/types/util/postIframeForm.d.ts +1 -1
- package/dist/types/util/transferNestedFunctions.d.ts +1 -1
- package/dist/types/util/url.d.ts +1 -1
- package/dist/types/wrapper/AppWrapper.d.ts +22 -22
- package/dist/types/wrapper/FrameWrapper.d.ts +18 -18
- package/dist/types/wrapper/ModuleFederationWrapper.d.ts +13 -13
- package/dist/types/wrapper/SsrWrapper.d.ts +14 -14
- package/dist/types/wrapper/StaticChaynsApi.d.ts +16 -16
- package/package.json +88 -88
- package/toolkit.config.js +20 -20
- package/tsconfig.json +56 -56
package/.babelrc
CHANGED
|
@@ -1,30 +1,31 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"esm": {
|
|
4
|
-
"presets": [
|
|
5
|
-
[
|
|
6
|
-
"@babel/preset-env",
|
|
7
|
-
{
|
|
8
|
-
"targets": ">0.5%, not dead, not op_mini all, chrome 71",
|
|
9
|
-
"modules": false
|
|
10
|
-
}
|
|
11
|
-
],
|
|
12
|
-
"@babel/preset-react",
|
|
13
|
-
"@babel/preset-typescript"
|
|
14
|
-
]
|
|
15
|
-
},
|
|
16
|
-
"cjs": {
|
|
17
|
-
"presets": [
|
|
18
|
-
[
|
|
19
|
-
"@babel/preset-env",
|
|
20
|
-
{
|
|
21
|
-
"targets": { "node": 12 },
|
|
22
|
-
"modules": "commonjs"
|
|
23
|
-
}
|
|
24
|
-
],
|
|
25
|
-
"@babel/preset-react",
|
|
26
|
-
"@babel/preset-typescript"
|
|
27
|
-
]
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"esm": {
|
|
4
|
+
"presets": [
|
|
5
|
+
[
|
|
6
|
+
"@babel/preset-env",
|
|
7
|
+
{
|
|
8
|
+
"targets": ">0.5%, not dead, not op_mini all, chrome 71",
|
|
9
|
+
"modules": false
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"@babel/preset-react",
|
|
13
|
+
"@babel/preset-typescript"
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"cjs": {
|
|
17
|
+
"presets": [
|
|
18
|
+
[
|
|
19
|
+
"@babel/preset-env",
|
|
20
|
+
{
|
|
21
|
+
"targets": { "node": 12 },
|
|
22
|
+
"modules": "commonjs"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"@babel/preset-react",
|
|
26
|
+
"@babel/preset-typescript"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"comments": false
|
|
31
|
+
}
|
package/.eslintrc
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "@chayns-toolkit",
|
|
3
|
-
"rules": {
|
|
4
|
-
"no-void": "off",
|
|
5
|
-
"react/function-component-definition": [
|
|
6
|
-
"error",
|
|
7
|
-
{
|
|
8
|
-
"namedComponents": "arrow-function",
|
|
9
|
-
"unnamedComponents": "arrow-function"
|
|
10
|
-
}
|
|
11
|
-
],
|
|
12
|
-
"@typescript-eslint/require-await": "off",
|
|
13
|
-
"@typescript-eslint/no-explicit-any": "off",
|
|
14
|
-
"class-methods-use-this": "off",
|
|
15
|
-
"react/jsx-props-no-spreading": "off"
|
|
16
|
-
}
|
|
17
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"extends": "@chayns-toolkit",
|
|
3
|
+
"rules": {
|
|
4
|
+
"no-void": "off",
|
|
5
|
+
"react/function-component-definition": [
|
|
6
|
+
"error",
|
|
7
|
+
{
|
|
8
|
+
"namedComponents": "arrow-function",
|
|
9
|
+
"unnamedComponents": "arrow-function"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"@typescript-eslint/require-await": "off",
|
|
13
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
14
|
+
"class-methods-use-this": "off",
|
|
15
|
+
"react/jsx-props-no-spreading": "off"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
name: Deploy Docs to GitHub Pages
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
paths:
|
|
6
|
-
- "website/**"
|
|
7
|
-
workflow_dispatch:
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
deploy:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
steps:
|
|
13
|
-
- name: Checkout repo
|
|
14
|
-
uses: actions/checkout@v2
|
|
15
|
-
|
|
16
|
-
- name: Use Node 20
|
|
17
|
-
uses: actions/setup-node@v1
|
|
18
|
-
with:
|
|
19
|
-
node-version: 20
|
|
20
|
-
|
|
21
|
-
- name: Build
|
|
22
|
-
run: npm run build-docs
|
|
23
|
-
|
|
24
|
-
- name: Deploy to GitHub Pages
|
|
25
|
-
uses: peaceiris/actions-gh-pages@v3
|
|
26
|
-
with:
|
|
27
|
-
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
28
|
-
publish_dir: ./website/build
|
|
1
|
+
name: Deploy Docs to GitHub Pages
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
paths:
|
|
6
|
+
- "website/**"
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
deploy:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- name: Checkout repo
|
|
14
|
+
uses: actions/checkout@v2
|
|
15
|
+
|
|
16
|
+
- name: Use Node 20
|
|
17
|
+
uses: actions/setup-node@v1
|
|
18
|
+
with:
|
|
19
|
+
node-version: 20
|
|
20
|
+
|
|
21
|
+
- name: Build
|
|
22
|
+
run: npm run build-docs
|
|
23
|
+
|
|
24
|
+
- name: Deploy to GitHub Pages
|
|
25
|
+
uses: peaceiris/actions-gh-pages@v3
|
|
26
|
+
with:
|
|
27
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
28
|
+
publish_dir: ./website/build
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
name: Publish to NPM
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
workflow_dispatch:
|
|
5
|
-
push:
|
|
6
|
-
tags:
|
|
7
|
-
- 'v*'
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
build:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
steps:
|
|
13
|
-
- uses: actions/checkout@v2
|
|
14
|
-
- uses: actions/setup-node@v1
|
|
15
|
-
with:
|
|
16
|
-
node-version: '14.21.1'
|
|
17
|
-
registry-url: https://registry.npmjs.org/
|
|
18
|
-
- run: npm install
|
|
19
|
-
- run: npm publish
|
|
20
|
-
env:
|
|
21
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
1
|
+
name: Publish to NPM
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
push:
|
|
6
|
+
tags:
|
|
7
|
+
- 'v*'
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v2
|
|
14
|
+
- uses: actions/setup-node@v1
|
|
15
|
+
with:
|
|
16
|
+
node-version: '14.21.1'
|
|
17
|
+
registry-url: https://registry.npmjs.org/
|
|
18
|
+
- run: npm install
|
|
19
|
+
- run: npm publish
|
|
20
|
+
env:
|
|
21
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 Tobit.Software
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Tobit.Software
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
# [chayns react api](https://github.com/TobitSoftware/chayns-api) · []() []() []()
|
|
2
|
-
|
|
3
|
-
The chayns-api provides information and useful functions to your page. The information and functions are provided by react hooks and normal functions.
|
|
4
|
-
A list of all functions and hooks can be found [here](https://tobitsoftware.github.io/chayns-api/docs).
|
|
5
|
-
|
|
6
|
-
## Installation
|
|
7
|
-
|
|
8
|
-
It is recommended to setup your new chayns page with the [create-chayns-app](https://github.com/TobitSoftware/create-chayns-app).
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
### Migrate old project
|
|
12
|
-
1. Install chayns-api package
|
|
13
|
-
```sh
|
|
14
|
-
# NPM
|
|
15
|
-
$ npm install chayns-api
|
|
16
|
-
|
|
17
|
-
# Yarn
|
|
18
|
-
$ yarn add chayns-api
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
2. Wrap your App component with the "ChaynsProvider" component. In all components which are under the ChaynsProvider you can use hooks and chayns functions.
|
|
22
|
-
```jsx
|
|
23
|
-
<ChaynsProvider>
|
|
24
|
-
<App/>
|
|
25
|
-
</ChaynsProvider>
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Example
|
|
29
|
-
|
|
30
|
-
```jsx
|
|
31
|
-
import { useUser } from 'chayns-api';
|
|
32
|
-
|
|
33
|
-
const FirstName = () => {
|
|
34
|
-
const user = useUser();
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<div>{user?.firstName}</div>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Migrate v1 to v2
|
|
43
|
-
|
|
44
|
-
When updating to chayns-api@2 you should also update chayns-toolkit to 3.0.1 or higher (check migration guide [here](https://github.com/TobitSoftware/chayns-toolkit/tree/main?tab=readme-ov-file#-migration-v2-to-v3)).
|
|
45
|
-
|
|
46
|
-
Check urls referencing **remoteEntry.js**. The filename has been changed to **v2.remoteEntry.js**.
|
|
47
|
-
|
|
48
|
-
When your application uses ChaynsHost with module-type you might have to add a call of **initModuleFederationSharing** as early as possible in your application (e.g. index/bootstrap). Unless your application is already embedded as module somewhere else (e.g. in a dialog).
|
|
49
|
-
|
|
50
|
-
```
|
|
51
|
-
initModuleFederationSharing({ name: 'project_name' });
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
## Getting started
|
|
56
|
-
|
|
57
|
-
More information to setup chayns-api can be found in the [documentation](https://tobitsoftware.github.io/chayns-api/docs).
|
|
58
|
-
|
|
59
|
-
## Troubleshooting
|
|
60
|
-
|
|
61
|
-
```
|
|
62
|
-
Can't resolve 'react-dom/client'
|
|
63
|
-
```
|
|
64
|
-
A warning like above can be shown when you are still using react 17.
|
|
65
|
-
This can be ignored because the react 17 api is used as fallback instead.
|
|
66
|
-
|
|
67
|
-
## License
|
|
1
|
+
# [chayns react api](https://github.com/TobitSoftware/chayns-api) · []() []() []()
|
|
2
|
+
|
|
3
|
+
The chayns-api provides information and useful functions to your page. The information and functions are provided by react hooks and normal functions.
|
|
4
|
+
A list of all functions and hooks can be found [here](https://tobitsoftware.github.io/chayns-api/docs).
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
|
|
8
|
+
It is recommended to setup your new chayns page with the [create-chayns-app](https://github.com/TobitSoftware/create-chayns-app).
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Migrate old project
|
|
12
|
+
1. Install chayns-api package
|
|
13
|
+
```sh
|
|
14
|
+
# NPM
|
|
15
|
+
$ npm install chayns-api
|
|
16
|
+
|
|
17
|
+
# Yarn
|
|
18
|
+
$ yarn add chayns-api
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
2. Wrap your App component with the "ChaynsProvider" component. In all components which are under the ChaynsProvider you can use hooks and chayns functions.
|
|
22
|
+
```jsx
|
|
23
|
+
<ChaynsProvider>
|
|
24
|
+
<App/>
|
|
25
|
+
</ChaynsProvider>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Example
|
|
29
|
+
|
|
30
|
+
```jsx
|
|
31
|
+
import { useUser } from 'chayns-api';
|
|
32
|
+
|
|
33
|
+
const FirstName = () => {
|
|
34
|
+
const user = useUser();
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div>{user?.firstName}</div>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Migrate v1 to v2
|
|
43
|
+
|
|
44
|
+
When updating to chayns-api@2 you should also update chayns-toolkit to 3.0.1 or higher (check migration guide [here](https://github.com/TobitSoftware/chayns-toolkit/tree/main?tab=readme-ov-file#-migration-v2-to-v3)).
|
|
45
|
+
|
|
46
|
+
Check urls referencing **remoteEntry.js**. The filename has been changed to **v2.remoteEntry.js**.
|
|
47
|
+
|
|
48
|
+
When your application uses ChaynsHost with module-type you might have to add a call of **initModuleFederationSharing** as early as possible in your application (e.g. index/bootstrap). Unless your application is already embedded as module somewhere else (e.g. in a dialog).
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
initModuleFederationSharing({ name: 'project_name' });
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
## Getting started
|
|
56
|
+
|
|
57
|
+
More information to setup chayns-api can be found in the [documentation](https://tobitsoftware.github.io/chayns-api/docs).
|
|
58
|
+
|
|
59
|
+
## Troubleshooting
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
Can't resolve 'react-dom/client'
|
|
63
|
+
```
|
|
64
|
+
A warning like above can be shown when you are still using react 17.
|
|
65
|
+
This can be ignored because the react 17 api is used as fallback instead.
|
|
66
|
+
|
|
67
|
+
## License
|
|
@@ -14,7 +14,6 @@ const buttonText = exports.buttonText = {
|
|
|
14
14
|
'en': 'Yes',
|
|
15
15
|
'nl': 'Ja'
|
|
16
16
|
}['de'] || 'Yes',
|
|
17
|
-
// TODO: Language
|
|
18
17
|
'NO': {
|
|
19
18
|
'de': 'Nein',
|
|
20
19
|
'en': 'No',
|
|
@@ -49,7 +48,6 @@ function chaynsDialog(config) {
|
|
|
49
48
|
config.callback = (0, _callback.getCallbackName)(callbackName);
|
|
50
49
|
if (config.dialog) {
|
|
51
50
|
config.dialog.callType = dialogAction.ALERT_CONFIRM;
|
|
52
|
-
// @ts-ignore
|
|
53
51
|
return (0, _open.open)(config.dialog).then(data => Promise.resolve(data.selection ? data : data.buttonType));
|
|
54
52
|
}
|
|
55
53
|
return "unsupported";
|
|
@@ -7,8 +7,6 @@ exports.addDialogDataListener = addDialogDataListener;
|
|
|
7
7
|
exports.removeDialogDataListener = removeDialogDataListener;
|
|
8
8
|
exports.sendData = sendData;
|
|
9
9
|
var _index = require("../index");
|
|
10
|
-
// @ts-nocheck
|
|
11
|
-
|
|
12
10
|
function sendData(data, isApiEvent) {
|
|
13
11
|
return (0, _index.invokeDialogCall)({
|
|
14
12
|
action: 218,
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.confirm = confirm;
|
|
7
7
|
var _chaynsDialog = require("./chaynsDialog");
|
|
8
8
|
function confirm(title = '', message = '', config = {}) {
|
|
9
|
-
// backward compatibility
|
|
10
9
|
if (Array.isArray(config)) {
|
|
11
10
|
config = {
|
|
12
11
|
'buttons': config
|
|
@@ -10,34 +10,6 @@ var _chaynsDialog = require("./chaynsDialog");
|
|
|
10
10
|
var _is = require("./utils/is");
|
|
11
11
|
var _open = require("./open");
|
|
12
12
|
var _index = require("../index");
|
|
13
|
-
/**
|
|
14
|
-
* The config object for date dialog
|
|
15
|
-
* @typedef {Object} dateConfig
|
|
16
|
-
* @property {Date} preSelect - The date object which should be preselected.
|
|
17
|
-
* @property {Date} minDate - The min date which you could select.
|
|
18
|
-
* @property {Date} maxDate - The max date which you could select.
|
|
19
|
-
* @property {dateDialogType} dateType - The type of dialog you want to display.
|
|
20
|
-
* @property {number} minuteIntervall - The interval for special minutes, possible are 2, 3, 4, 5, 6, 12, 15, 20, 30. Default is 1.
|
|
21
|
-
* @property {string} message - The message that is displayed above the date dialog, only in apps supported
|
|
22
|
-
* @property {string} title - The title that is displayed above the message, only in apps supported
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* This call will open a date select dialog.
|
|
27
|
-
* <div>Call: 30</div>
|
|
28
|
-
* @param {dateConfig} config - Define the configuration of this call
|
|
29
|
-
* @return {Promise} contains a timestamp as result
|
|
30
|
-
* @example chayns.dialog.date({
|
|
31
|
-
* 'dateType': chayns.dialog.dateType.DATE_TIME,
|
|
32
|
-
* 'preSelect': new Date(2018, 6, 14, 0, 0, 0),
|
|
33
|
-
* 'minDate': new Date(2018, 6, 1, 15, 0, 0),
|
|
34
|
-
* 'maxDate': new Date(2019, 6, 1, 0, 23, 0),
|
|
35
|
-
* 'minuteInterval': 15
|
|
36
|
-
* ).then(function (data) {
|
|
37
|
-
* console.log(data);
|
|
38
|
-
* });
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
13
|
function date(config = {}) {
|
|
42
14
|
let {
|
|
43
15
|
preSelect,
|
|
@@ -49,8 +21,6 @@ function date(config = {}) {
|
|
|
49
21
|
autoSelectDate
|
|
50
22
|
} = config,
|
|
51
23
|
type = config.dateType || dateType.DATE;
|
|
52
|
-
|
|
53
|
-
// This will fix the iOS problem with not preselectedDate without user interaction. That it return the wrog time.
|
|
54
24
|
const {
|
|
55
25
|
os,
|
|
56
26
|
app
|
|
@@ -79,7 +49,6 @@ function date(config = {}) {
|
|
|
79
49
|
minuteInterval,
|
|
80
50
|
autoSelectDate
|
|
81
51
|
}).then(data => {
|
|
82
|
-
// @ts-ignore
|
|
83
52
|
return Promise.resolve(data.selectedDate);
|
|
84
53
|
});
|
|
85
54
|
}
|
|
@@ -105,7 +74,6 @@ function advancedDate(config = {}) {
|
|
|
105
74
|
getLocalTime,
|
|
106
75
|
autoSelectDate
|
|
107
76
|
} = config,
|
|
108
|
-
// minInterval and maxInterval in minutes
|
|
109
77
|
type = config.dateType || dateType.DATE;
|
|
110
78
|
minDate = validateValue(minDate);
|
|
111
79
|
maxDate = validateValue(maxDate);
|
|
@@ -125,8 +93,6 @@ function advancedDate(config = {}) {
|
|
|
125
93
|
}
|
|
126
94
|
}
|
|
127
95
|
} else {
|
|
128
|
-
// This will fix the iOS problem with not preselectedDate without user interaction. That it return the wrong time.
|
|
129
|
-
// eslint-disable-next-line no-lonely-if
|
|
130
96
|
if (minuteInterval && minuteInterval > 1 && os === 'iOS' && app) {
|
|
131
97
|
preSelect = roundInterval(preSelect, minuteInterval);
|
|
132
98
|
} else {
|
|
@@ -169,20 +135,6 @@ function advancedDate(config = {}) {
|
|
|
169
135
|
return Promise.resolve(data);
|
|
170
136
|
});
|
|
171
137
|
}
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
* @typedef {number} dateDialogType
|
|
175
|
-
*/
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Enum for date dialog
|
|
179
|
-
* <div>DATE will open a dialog where you can select a special day</div>
|
|
180
|
-
* <div>TIME will open a dialog where you can only select a special time</div>
|
|
181
|
-
* <div>DATE_TIME will open a dialog where you can select a special time on a special day</div>
|
|
182
|
-
* @readonly
|
|
183
|
-
* @enum {dateDialogType}
|
|
184
|
-
* @type {{DATE: number, TIME: number, DATE_TIME: number}}
|
|
185
|
-
*/
|
|
186
138
|
const dateType = exports.dateType = {
|
|
187
139
|
'DATE': 1,
|
|
188
140
|
'TIME': 2,
|
|
@@ -191,7 +143,6 @@ const dateType = exports.dateType = {
|
|
|
191
143
|
function validateValue(value) {
|
|
192
144
|
if (!(0, _is.isNumber)(value)) {
|
|
193
145
|
if ((0, _is.isDate)(value)) {
|
|
194
|
-
// TODO: Find out whats the purpose of parsing to int
|
|
195
146
|
return parseInt(value.getTime() / 1000 + "", 10);
|
|
196
147
|
}
|
|
197
148
|
return undefined;
|
|
@@ -209,6 +160,5 @@ function roundInterval(preDate = new Date(), interval) {
|
|
|
209
160
|
let minutes = preDate.getMinutes();
|
|
210
161
|
preDate.setMinutes(minutes - minutes % interval);
|
|
211
162
|
preDate.setSeconds(0);
|
|
212
|
-
// TODO: Why?
|
|
213
163
|
return parseInt(preDate.getTime() / 1000 + "", 10);
|
|
214
164
|
}
|
|
@@ -30,7 +30,7 @@ function iFrame(dialog = {
|
|
|
30
30
|
}
|
|
31
31
|
function _chaynsCallResponder(obj) {
|
|
32
32
|
if (obj.call.value.callback) {
|
|
33
|
-
const call = JSON.parse(JSON.stringify(obj));
|
|
33
|
+
const call = JSON.parse(JSON.stringify(obj));
|
|
34
34
|
(0, _index.invokeDialogCall)(obj).then(result => {
|
|
35
35
|
(0, _communication.sendData)({
|
|
36
36
|
result,
|