chayns-api 1.1.17 → 1.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/hooks/index.js +7 -0
- package/dist/cjs/hooks/useCustomCallbackFunction.js +18 -0
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/types/IChaynsReact.js +6 -0
- package/dist/cjs/util/bindChaynsApi.js +12 -0
- package/dist/cjs/wrapper/AppWrapper.js +2 -2
- package/dist/cjs/wrapper/StaticChaynsApi.js +5 -2
- package/dist/esm/hooks/index.js +1 -0
- package/dist/esm/hooks/useCustomCallbackFunction.js +12 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/types/IChaynsReact.js +6 -0
- package/dist/esm/util/bindChaynsApi.js +5 -0
- package/dist/esm/wrapper/AppWrapper.js +2 -2
- package/dist/esm/wrapper/StaticChaynsApi.js +5 -2
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/useCustomCallbackFunction.d.ts +5 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/util/bindChaynsApi.d.ts +1 -0
- package/dist/types/wrapper/StaticChaynsApi.d.ts +1 -1
- package/package.json +1 -1
package/dist/cjs/hooks/index.js
CHANGED
|
@@ -21,6 +21,12 @@ Object.defineProperty(exports, "useCurrentPage", {
|
|
|
21
21
|
return _useCurrentPage.useCurrentPage;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
|
+
Object.defineProperty(exports, "useCustomCallbackFunction", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _useCustomCallbackFunction.useCustomCallbackFunction;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
24
30
|
Object.defineProperty(exports, "useCustomData", {
|
|
25
31
|
enumerable: true,
|
|
26
32
|
get: function () {
|
|
@@ -169,4 +175,5 @@ var _useValues = require("./useValues");
|
|
|
169
175
|
var _useFunctions = require("./useFunctions");
|
|
170
176
|
var _useCurrentPage = require("./useCurrentPage");
|
|
171
177
|
var _useCustomData = require("./useCustomData");
|
|
178
|
+
var _useCustomCallbackFunction = require("./useCustomCallbackFunction");
|
|
172
179
|
var _useDialogState = require("./useDialogState");
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useCustomCallbackFunction = void 0;
|
|
7
|
+
var _useFunctions = require("./useFunctions");
|
|
8
|
+
/**
|
|
9
|
+
* @category Hooks
|
|
10
|
+
* Returns customCallbackFunction
|
|
11
|
+
*/
|
|
12
|
+
const useCustomCallbackFunction = () => {
|
|
13
|
+
const {
|
|
14
|
+
customCallbackFunction
|
|
15
|
+
} = (0, _useFunctions.useFunctions)();
|
|
16
|
+
return customCallbackFunction;
|
|
17
|
+
};
|
|
18
|
+
exports.useCustomCallbackFunction = useCustomCallbackFunction;
|
package/dist/cjs/index.js
CHANGED
|
@@ -143,6 +143,18 @@ var _StaticChaynsApi = _interopRequireDefault(require("./wrapper/StaticChaynsApi
|
|
|
143
143
|
var _DialogHandler = _interopRequireDefault(require("./handler/DialogHandler"));
|
|
144
144
|
var _dialog = _interopRequireWildcard(require("./calls/dialogs/index"));
|
|
145
145
|
exports.dialog = _dialog;
|
|
146
|
+
var _bindChaynsApi = require("./util/bindChaynsApi");
|
|
147
|
+
Object.keys(_bindChaynsApi).forEach(function (key) {
|
|
148
|
+
if (key === "default" || key === "__esModule") return;
|
|
149
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
150
|
+
if (key in exports && exports[key] === _bindChaynsApi[key]) return;
|
|
151
|
+
Object.defineProperty(exports, key, {
|
|
152
|
+
enumerable: true,
|
|
153
|
+
get: function () {
|
|
154
|
+
return _bindChaynsApi[key];
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
});
|
|
146
158
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
147
159
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
148
160
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -49,10 +49,15 @@ let DialogButtonType = exports.DialogButtonType = /*#__PURE__*/function (DialogB
|
|
|
49
49
|
return DialogButtonType;
|
|
50
50
|
}({});
|
|
51
51
|
let ScreenSize = exports.ScreenSize = /*#__PURE__*/function (ScreenSize) {
|
|
52
|
+
/** screen width smaller than or equal 556px */
|
|
52
53
|
ScreenSize[ScreenSize["XS"] = 0] = "XS";
|
|
54
|
+
/** screen width between 557px and 769px */
|
|
53
55
|
ScreenSize[ScreenSize["SM"] = 1] = "SM";
|
|
56
|
+
/** screen width between 770px and 993px */
|
|
54
57
|
ScreenSize[ScreenSize["MD"] = 2] = "MD";
|
|
58
|
+
/** screen width between 994px and 1200px */
|
|
55
59
|
ScreenSize[ScreenSize["LG"] = 3] = "LG";
|
|
60
|
+
/** screen width larger than 1200px */
|
|
56
61
|
ScreenSize[ScreenSize["XL"] = 4] = "XL";
|
|
57
62
|
return ScreenSize;
|
|
58
63
|
}({});
|
|
@@ -224,6 +229,7 @@ let RuntimeEnviroment = exports.RuntimeEnviroment = /*#__PURE__*/function (Runti
|
|
|
224
229
|
RuntimeEnviroment[RuntimeEnviroment["Unknown"] = 0] = "Unknown";
|
|
225
230
|
RuntimeEnviroment[RuntimeEnviroment["ChaynsDe"] = 1] = "ChaynsDe";
|
|
226
231
|
RuntimeEnviroment[RuntimeEnviroment["ChaynsWeb"] = 2] = "ChaynsWeb";
|
|
232
|
+
// ?
|
|
227
233
|
RuntimeEnviroment[RuntimeEnviroment["ChaynsRuntime"] = 3] = "ChaynsRuntime";
|
|
228
234
|
RuntimeEnviroment[RuntimeEnviroment["IntercomPlugin"] = 4] = "IntercomPlugin";
|
|
229
235
|
RuntimeEnviroment[RuntimeEnviroment["PagemakerPlugin"] = 5] = "PagemakerPlugin";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.bindChaynsApi = void 0;
|
|
7
|
+
var _index = require("../index");
|
|
8
|
+
const bindChaynsApi = fun => (values, functions) => {
|
|
9
|
+
new _index.StaticChaynsApi(values, functions);
|
|
10
|
+
return fun;
|
|
11
|
+
};
|
|
12
|
+
exports.bindChaynsApi = bindChaynsApi;
|
|
@@ -25,7 +25,7 @@ class AppWrapper {
|
|
|
25
25
|
values = null;
|
|
26
26
|
accessToken = '';
|
|
27
27
|
mapOldApiToNew(retVal) {
|
|
28
|
-
var _window,
|
|
28
|
+
var _window, _window2, _AppInfo$TappSelected;
|
|
29
29
|
const {
|
|
30
30
|
AppInfo,
|
|
31
31
|
AppUser,
|
|
@@ -95,7 +95,7 @@ class AppWrapper {
|
|
|
95
95
|
docked: false
|
|
96
96
|
},
|
|
97
97
|
title: AppInfo.Title,
|
|
98
|
-
colorMode:
|
|
98
|
+
colorMode: colorMode !== null && colorMode !== void 0 ? colorMode : AppInfo.colorMode,
|
|
99
99
|
color,
|
|
100
100
|
domain: AppInfo.domain,
|
|
101
101
|
font: {
|
|
@@ -9,13 +9,16 @@ var _IChaynsReact = require("../types/IChaynsReact");
|
|
|
9
9
|
var _deviceHelper = _interopRequireDefault(require("../util/deviceHelper"));
|
|
10
10
|
var _AppWrapper = require("./AppWrapper");
|
|
11
11
|
var _FrameWrapper = require("./FrameWrapper");
|
|
12
|
+
var _ModuleFederationWrapper = require("./ModuleFederationWrapper");
|
|
12
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
14
|
class StaticChaynsApi {
|
|
14
|
-
constructor() {
|
|
15
|
+
constructor(values, functions) {
|
|
15
16
|
var _deviceInfo$app$name, _deviceInfo$app;
|
|
16
17
|
let wrapper;
|
|
17
18
|
const deviceInfo = (0, _deviceHelper.default)(navigator.userAgent, '');
|
|
18
|
-
if (
|
|
19
|
+
if (values && functions) {
|
|
20
|
+
wrapper = new _ModuleFederationWrapper.ModuleFederationWrapper(values, functions);
|
|
21
|
+
} else if ([_IChaynsReact.AppName.Chayns, _IChaynsReact.AppName.ChaynsLauncher, _IChaynsReact.AppName.Sidekick, _IChaynsReact.AppName.TobitChat].includes((_deviceInfo$app$name = (_deviceInfo$app = deviceInfo.app) === null || _deviceInfo$app === void 0 ? void 0 : _deviceInfo$app.name) !== null && _deviceInfo$app$name !== void 0 ? _deviceInfo$app$name : _IChaynsReact.AppName.Unknown) && window.self === window.top) {
|
|
19
22
|
wrapper = new _AppWrapper.AppWrapper();
|
|
20
23
|
} else {
|
|
21
24
|
wrapper = new _FrameWrapper.FrameWrapper();
|
package/dist/esm/hooks/index.js
CHANGED
|
@@ -14,4 +14,5 @@ export { useValues } from './useValues';
|
|
|
14
14
|
export { useFunctions } from './useFunctions';
|
|
15
15
|
export { useCurrentPage } from './useCurrentPage';
|
|
16
16
|
export { useCustomData } from './useCustomData';
|
|
17
|
+
export { useCustomCallbackFunction } from './useCustomCallbackFunction';
|
|
17
18
|
export { useDialogState, useDialogData } from './useDialogState';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useFunctions } from './useFunctions';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @category Hooks
|
|
5
|
+
* Returns customCallbackFunction
|
|
6
|
+
*/
|
|
7
|
+
export const useCustomCallbackFunction = () => {
|
|
8
|
+
const {
|
|
9
|
+
customCallbackFunction
|
|
10
|
+
} = useFunctions();
|
|
11
|
+
return customCallbackFunction;
|
|
12
|
+
};
|
package/dist/esm/index.js
CHANGED
|
@@ -43,10 +43,15 @@ export let DialogButtonType = /*#__PURE__*/function (DialogButtonType) {
|
|
|
43
43
|
return DialogButtonType;
|
|
44
44
|
}({});
|
|
45
45
|
export let ScreenSize = /*#__PURE__*/function (ScreenSize) {
|
|
46
|
+
/** screen width smaller than or equal 556px */
|
|
46
47
|
ScreenSize[ScreenSize["XS"] = 0] = "XS";
|
|
48
|
+
/** screen width between 557px and 769px */
|
|
47
49
|
ScreenSize[ScreenSize["SM"] = 1] = "SM";
|
|
50
|
+
/** screen width between 770px and 993px */
|
|
48
51
|
ScreenSize[ScreenSize["MD"] = 2] = "MD";
|
|
52
|
+
/** screen width between 994px and 1200px */
|
|
49
53
|
ScreenSize[ScreenSize["LG"] = 3] = "LG";
|
|
54
|
+
/** screen width larger than 1200px */
|
|
50
55
|
ScreenSize[ScreenSize["XL"] = 4] = "XL";
|
|
51
56
|
return ScreenSize;
|
|
52
57
|
}({});
|
|
@@ -221,6 +226,7 @@ export let RuntimeEnviroment = /*#__PURE__*/function (RuntimeEnviroment) {
|
|
|
221
226
|
RuntimeEnviroment[RuntimeEnviroment["Unknown"] = 0] = "Unknown";
|
|
222
227
|
RuntimeEnviroment[RuntimeEnviroment["ChaynsDe"] = 1] = "ChaynsDe";
|
|
223
228
|
RuntimeEnviroment[RuntimeEnviroment["ChaynsWeb"] = 2] = "ChaynsWeb";
|
|
229
|
+
// ?
|
|
224
230
|
RuntimeEnviroment[RuntimeEnviroment["ChaynsRuntime"] = 3] = "ChaynsRuntime";
|
|
225
231
|
RuntimeEnviroment[RuntimeEnviroment["IntercomPlugin"] = 4] = "IntercomPlugin";
|
|
226
232
|
RuntimeEnviroment[RuntimeEnviroment["PagemakerPlugin"] = 5] = "PagemakerPlugin";
|
|
@@ -17,7 +17,7 @@ import { isAppCallSupported } from '../util/is';
|
|
|
17
17
|
let appWrapperDialogId = 0;
|
|
18
18
|
export class AppWrapper {
|
|
19
19
|
mapOldApiToNew(retVal) {
|
|
20
|
-
var _window,
|
|
20
|
+
var _window, _window2, _AppInfo$TappSelected;
|
|
21
21
|
const {
|
|
22
22
|
AppInfo,
|
|
23
23
|
AppUser,
|
|
@@ -87,7 +87,7 @@ export class AppWrapper {
|
|
|
87
87
|
docked: false
|
|
88
88
|
},
|
|
89
89
|
title: AppInfo.Title,
|
|
90
|
-
colorMode:
|
|
90
|
+
colorMode: colorMode !== null && colorMode !== void 0 ? colorMode : AppInfo.colorMode,
|
|
91
91
|
color,
|
|
92
92
|
domain: AppInfo.domain,
|
|
93
93
|
font: {
|
|
@@ -6,8 +6,9 @@ import { AppName } from '../types/IChaynsReact';
|
|
|
6
6
|
import getDeviceInfo from '../util/deviceHelper';
|
|
7
7
|
import { AppWrapper } from './AppWrapper';
|
|
8
8
|
import { FrameWrapper } from './FrameWrapper';
|
|
9
|
+
import { ModuleFederationWrapper } from "./ModuleFederationWrapper";
|
|
9
10
|
class StaticChaynsApi {
|
|
10
|
-
constructor() {
|
|
11
|
+
constructor(values, functions) {
|
|
11
12
|
var _deviceInfo$app$name, _deviceInfo$app;
|
|
12
13
|
_defineProperty(this, "getUser", () => this._wrapper.values.user);
|
|
13
14
|
_defineProperty(this, "getSite", () => this._wrapper.values.site);
|
|
@@ -19,7 +20,9 @@ class StaticChaynsApi {
|
|
|
19
20
|
_defineProperty(this, "getEnvironment", () => this._wrapper.values.environment);
|
|
20
21
|
let wrapper;
|
|
21
22
|
const deviceInfo = getDeviceInfo(navigator.userAgent, '');
|
|
22
|
-
if (
|
|
23
|
+
if (values && functions) {
|
|
24
|
+
wrapper = new ModuleFederationWrapper(values, functions);
|
|
25
|
+
} else if ([AppName.Chayns, AppName.ChaynsLauncher, AppName.Sidekick, AppName.TobitChat].includes((_deviceInfo$app$name = (_deviceInfo$app = deviceInfo.app) === null || _deviceInfo$app === void 0 ? void 0 : _deviceInfo$app.name) !== null && _deviceInfo$app$name !== void 0 ? _deviceInfo$app$name : AppName.Unknown) && window.self === window.top) {
|
|
23
26
|
wrapper = new AppWrapper();
|
|
24
27
|
} else {
|
|
25
28
|
wrapper = new FrameWrapper();
|
|
@@ -14,4 +14,5 @@ export { useValues } from './useValues';
|
|
|
14
14
|
export { useFunctions } from './useFunctions';
|
|
15
15
|
export { useCurrentPage } from './useCurrentPage';
|
|
16
16
|
export { useCustomData } from './useCustomData';
|
|
17
|
+
export { useCustomCallbackFunction } from './useCustomCallbackFunction';
|
|
17
18
|
export { useDialogState, useDialogData } from './useDialogState';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const bindChaynsApi: (fun: any) => (values: any, functions: any) => any;
|
|
@@ -3,7 +3,7 @@ declare class StaticChaynsApi {
|
|
|
3
3
|
ready: Promise<void>;
|
|
4
4
|
addDataListener: (cb: DataChangeCallback) => () => void;
|
|
5
5
|
private _wrapper;
|
|
6
|
-
constructor();
|
|
6
|
+
constructor(values: any, functions: any);
|
|
7
7
|
getUser: () => any;
|
|
8
8
|
getSite: () => any;
|
|
9
9
|
getCurrentPage: () => any;
|