chayns-api 2.6.0-beta.0 → 2.6.0-beta.10

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.
Files changed (91) hide show
  1. package/.github/workflows/publish.yml +7 -2
  2. package/dist/cjs/calls/dialogs/date.js +1 -1
  3. package/dist/cjs/calls/dialogs/iFrame.js +9 -6
  4. package/dist/cjs/calls/index.js +3 -1
  5. package/dist/cjs/components/ChaynsProvider.js +3 -3
  6. package/dist/cjs/components/withCompatMode.js +2 -2
  7. package/dist/cjs/components/withHydrationBoundary.js +1 -2
  8. package/dist/cjs/constants/hydrationContext.js +12 -1
  9. package/dist/cjs/constants/moduleContext.js +12 -1
  10. package/dist/cjs/hooks/useIsomorphicLayoutEffect.js +8 -0
  11. package/dist/cjs/host/ChaynsHost.js +1 -2
  12. package/dist/cjs/host/iframe/HostIframe.js +1 -2
  13. package/dist/cjs/host/module/ModuleHost.js +2 -3
  14. package/dist/cjs/host/module/utils/loadComponent.js +2 -17
  15. package/dist/cjs/index.js +13 -2
  16. package/dist/cjs/plugins/SSRManifestPlugin.js +28 -0
  17. package/dist/cjs/plugins/TrustedDomainsPlugins.js +29 -0
  18. package/dist/cjs/plugins/index.js +19 -0
  19. package/dist/cjs/types/IChaynsReact.js +3 -7
  20. package/dist/cjs/types/global.d.js +1 -0
  21. package/dist/cjs/umd.index.js +1 -2
  22. package/dist/cjs/util/collectCssChunks.js +3 -0
  23. package/dist/cjs/util/deviceHelper.js +17 -4
  24. package/dist/cjs/util/initModuleFederationSharing.js +17 -12
  25. package/dist/cjs/util/is.js +9 -4
  26. package/dist/cjs/util/transferNestedFunctions.js +1 -2
  27. package/dist/cjs/wrapper/AppWrapper.js +9 -3
  28. package/dist/cjs/wrapper/FrameWrapper.js +6 -3
  29. package/dist/cjs/wrapper/StaticChaynsApi.js +1 -3
  30. package/dist/esm/calls/dialogs/alert.js +1 -3
  31. package/dist/esm/calls/dialogs/communication.js +3 -6
  32. package/dist/esm/calls/dialogs/confirm.js +1 -4
  33. package/dist/esm/calls/dialogs/date.js +4 -8
  34. package/dist/esm/calls/dialogs/dropUpAlert.js +1 -2
  35. package/dist/esm/calls/dialogs/fileSelect.js +1 -2
  36. package/dist/esm/calls/dialogs/iFrame.js +11 -9
  37. package/dist/esm/calls/dialogs/input.js +1 -2
  38. package/dist/esm/calls/dialogs/mediaSelect.js +1 -2
  39. package/dist/esm/calls/dialogs/toast.js +1 -2
  40. package/dist/esm/calls/dialogs/utils/callback.js +1 -2
  41. package/dist/esm/calls/index.js +53 -156
  42. package/dist/esm/components/ChaynsProvider.js +18 -20
  43. package/dist/esm/components/WaitUntil.js +5 -6
  44. package/dist/esm/components/withCompatMode.js +1 -0
  45. package/dist/esm/components/withHydrationBoundary.js +5 -6
  46. package/dist/esm/constants/hydrationContext.js +12 -1
  47. package/dist/esm/constants/moduleContext.js +12 -1
  48. package/dist/esm/handler/DialogHandler.js +1 -2
  49. package/dist/esm/hooks/geoLocationListener.js +5 -6
  50. package/dist/esm/hooks/scrollListener.js +12 -15
  51. package/dist/esm/hooks/useIsomorphicLayoutEffect.js +2 -0
  52. package/dist/esm/hooks/usePages.js +16 -19
  53. package/dist/esm/hooks/windowMetricsListener.js +3 -4
  54. package/dist/esm/host/ChaynsHost.js +23 -24
  55. package/dist/esm/host/iframe/HostIframe.js +21 -22
  56. package/dist/esm/host/module/ModuleHost.js +25 -27
  57. package/dist/esm/host/module/utils/loadComponent.js +4 -22
  58. package/dist/esm/index.js +1 -0
  59. package/dist/esm/plugins/SSRManifestPlugin.js +21 -0
  60. package/dist/esm/plugins/TrustedDomainsPlugins.js +25 -0
  61. package/dist/esm/plugins/index.js +2 -0
  62. package/dist/esm/types/IChaynsReact.js +2 -6
  63. package/dist/esm/types/global.d.js +0 -0
  64. package/dist/esm/util/appStorage.js +3 -6
  65. package/dist/esm/util/collectCssChunks.js +3 -0
  66. package/dist/esm/util/deviceHelper.js +20 -8
  67. package/dist/esm/util/initModuleFederationSharing.js +19 -15
  68. package/dist/esm/util/is.js +11 -8
  69. package/dist/esm/util/transferNestedFunctions.js +1 -2
  70. package/dist/esm/wrapper/AppWrapper.js +23 -26
  71. package/dist/esm/wrapper/FrameWrapper.js +14 -21
  72. package/dist/esm/wrapper/ModuleFederationWrapper.js +2 -5
  73. package/dist/esm/wrapper/StaticChaynsApi.js +2 -5
  74. package/dist/types/calls/dialogs/iFrame.d.ts +10 -4
  75. package/dist/types/calls/index.d.ts +2 -0
  76. package/dist/types/hooks/useIsomorphicLayoutEffect.d.ts +2 -0
  77. package/dist/types/host/module/utils/loadComponent.d.ts +2 -1
  78. package/dist/types/index.d.ts +1 -0
  79. package/dist/types/plugins/SSRManifestPlugin.d.ts +5 -0
  80. package/dist/types/plugins/SequentialLoadPlugin.d.ts +2 -2
  81. package/dist/types/plugins/TrustedDomainsPlugins.d.ts +2 -0
  82. package/dist/types/plugins/index.d.ts +2 -0
  83. package/dist/types/types/IChaynsReact.d.ts +29 -12
  84. package/dist/types/util/initModuleFederationSharing.d.ts +2 -1
  85. package/dist/types/util/is.d.ts +1 -0
  86. package/dist/types/wrapper/StaticChaynsApi.d.ts +68 -4
  87. package/eslint.config.mjs +3 -0
  88. package/package.json +32 -22
  89. package/{toolkit.config.js → toolkit.config.ts} +6 -3
  90. package/tsconfig.json +1 -0
  91. package/.eslintrc +0 -17
@@ -5,22 +5,16 @@ let ReactDOMClient;
5
5
  try {
6
6
  ReactDOMClient = require('react-dom/client');
7
7
  } catch (e) {}
8
- export const initModuleFederationSharing = _ref => {
9
- let {
10
- name
11
- } = _ref;
12
- if (globalThis.moduleFederationRuntime) {
8
+ export const initModuleFederationSharing = ({
9
+ name,
10
+ plugins = []
11
+ }) => {
12
+ if (globalThis.moduleFederationScopes) {
13
13
  return;
14
14
  }
15
- globalThis.moduleFederationRuntime = require('@module-federation/enhanced/runtime');
16
- globalThis.moduleFederationScopes = {
17
- registeredScopes: {},
18
- moduleMap: {},
19
- componentMap: {}
20
- };
21
15
  const {
22
- init
23
- } = globalThis.moduleFederationRuntime;
16
+ createInstance
17
+ } = require('@module-federation/enhanced/runtime');
24
18
  const shared = {
25
19
  react: {
26
20
  version: React.version,
@@ -40,10 +34,20 @@ export const initModuleFederationSharing = _ref => {
40
34
  lib: () => ReactDOMClient
41
35
  };
42
36
  }
43
- init({
37
+ const instance = createInstance({
44
38
  name: name !== null && name !== void 0 ? name : '',
45
39
  remotes: [],
46
40
  shared,
47
- plugins: [SequentialLoadPlugin()]
41
+ plugins: [SequentialLoadPlugin(), ...plugins]
48
42
  });
43
+ globalThis.moduleFederationRuntime = {
44
+ loadRemote: instance.loadRemote.bind(instance),
45
+ registerRemotes: instance.registerRemotes.bind(instance),
46
+ getInstance: () => instance
47
+ };
48
+ globalThis.moduleFederationScopes = {
49
+ registeredScopes: {},
50
+ moduleMap: {},
51
+ componentMap: {}
52
+ };
49
53
  };
@@ -1,15 +1,14 @@
1
1
  import { getDevice } from '../calls';
2
- import { AppName } from '../types/IChaynsReact';
2
+ import { AppFlavor } from '../types/IChaynsReact';
3
3
  export const isApp = () => {
4
- var _getDevice$app$name, _getDevice$app;
5
- return ((_getDevice$app$name = (_getDevice$app = getDevice().app) === null || _getDevice$app === void 0 ? void 0 : _getDevice$app.name) !== null && _getDevice$app$name !== void 0 ? _getDevice$app$name : AppName.Unknown) !== AppName.Unknown;
4
+ var _getDevice$app;
5
+ return ((_getDevice$app = getDevice().app) === null || _getDevice$app === void 0 ? void 0 : _getDevice$app.flavor) === AppFlavor.Chayns;
6
6
  };
7
- export const isAppCallSupported = _ref => {
7
+ export const isAppCallSupported = ({
8
+ minAndroidVersion = 1,
9
+ minIOSVersion = 1
10
+ }) => {
8
11
  var _device$app;
9
- let {
10
- minAndroidVersion = 1,
11
- minIOSVersion = 1
12
- } = _ref;
13
12
  if (!isApp()) return false;
14
13
  const device = getDevice();
15
14
  if (!((_device$app = device.app) !== null && _device$app !== void 0 && _device$app.callVersion) || isNaN(device.app.callVersion)) return false;
@@ -20,4 +19,8 @@ export const isAppCallSupported = _ref => {
20
19
  return device.app.callVersion >= minAndroidVersion;
21
20
  }
22
21
  return false;
22
+ };
23
+ export const isElectron = () => {
24
+ var _getDevice$app2;
25
+ return ((_getDevice$app2 = getDevice().app) === null || _getDevice$app2 === void 0 ? void 0 : _getDevice$app2.flavor) === AppFlavor.Electron;
23
26
  };
@@ -6,8 +6,7 @@ Comlink.transferHandlers.set("FUNCTION", {
6
6
  serialize(obj) {
7
7
  obj._functionKeys = [];
8
8
  const ports = [];
9
- Object.entries(obj).forEach(_ref => {
10
- let [k, v] = _ref;
9
+ Object.entries(obj).forEach(([k, v]) => {
11
10
  if (typeof v === 'function') {
12
11
  const {
13
12
  port1,
@@ -4,6 +4,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
4
4
  import throttle from 'lodash.throttle';
5
5
  import getUserInfo from '../calls/getUserInfo';
6
6
  import { sendMessageToGroup, sendMessageToPage, sendMessageToUser } from '../calls/sendMessage';
7
+ import { DefaultLoginDialogOptions } from '../constants';
7
8
  import { DeviceLanguage } from '../constants/languages';
8
9
  import DialogHandler from '../handler/DialogHandler';
9
10
  import { addApiListener, dispatchApiEvent, removeApiListener } from '../helper/apiListenerHelper';
@@ -12,7 +13,6 @@ import invokeAppCall from '../util/appCall';
12
13
  import { addAppStorageListener, clearAppStorage, isAppStorageAvailable, setAppStorageItem } from '../util/appStorage';
13
14
  import getDeviceInfo, { getScreenSize } from '../util/deviceHelper';
14
15
  import { isAppCallSupported } from '../util/is';
15
- import { DefaultLoginDialogOptions } from '../constants';
16
16
  export class AppWrapper {
17
17
  async loadStyleSettings(siteId) {
18
18
  try {
@@ -145,7 +145,6 @@ export class AppWrapper {
145
145
  };
146
146
  }
147
147
  constructor() {
148
- var _this = this;
149
148
  _defineProperty(this, "values", null);
150
149
  _defineProperty(this, "accessToken", '');
151
150
  _defineProperty(this, "listeners", []);
@@ -297,12 +296,16 @@ export class AppWrapper {
297
296
  callback
298
297
  });
299
298
  },
299
+ invokePaymentCall: async (value, callback) => {
300
+ return this.appCall(value.action, value.value, {
301
+ callback
302
+ });
303
+ },
300
304
  invokeDialogCall: async (value, callback) => {
301
305
  const callbackName = `chaynsApiV5Callback_${this.counter++}`;
302
- window[callbackName] = _ref => {
303
- let {
304
- retVal
305
- } = _ref;
306
+ window[callbackName] = ({
307
+ retVal
308
+ }) => {
306
309
  callback === null || callback === void 0 || callback(retVal);
307
310
  delete window[callbackName];
308
311
  };
@@ -315,20 +318,18 @@ export class AppWrapper {
315
318
  };
316
319
  invokeAppCall(callObj);
317
320
  },
318
- login: async function () {
319
- let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
320
- let callback = arguments.length > 1 ? arguments[1] : undefined;
321
- let closeCallback = arguments.length > 2 ? arguments[2] : undefined;
321
+ login: async (value = {}, callback, closeCallback) => {
322
322
  const {
323
323
  result,
324
324
  buttonType
325
- } = await _this.functions.createDialog({
325
+ } = await this.functions.createDialog({
326
326
  ...DefaultLoginDialogOptions,
327
327
  ...value
328
328
  }).open();
329
329
  if (buttonType === DialogButtonType.OK && result.token) {
330
330
  const response = {
331
331
  loginState: LoginState.SUCCESS,
332
+ buttonType,
332
333
  ...result
333
334
  };
334
335
  if (callback) callback(response);
@@ -336,6 +337,7 @@ export class AppWrapper {
336
337
  }
337
338
  const response = {
338
339
  loginState: LoginState.LoginFailed,
340
+ buttonType,
339
341
  ...result
340
342
  };
341
343
  if (closeCallback) closeCallback(response);
@@ -431,8 +433,7 @@ export class AppWrapper {
431
433
  url.pathname += `/${options.path}`;
432
434
  }
433
435
  if (options.params) {
434
- Object.entries(options.params).forEach(_ref2 => {
435
- let [k, v] = _ref2;
436
+ Object.entries(options.params).forEach(([k, v]) => {
436
437
  url.searchParams.set(k, v);
437
438
  });
438
439
  }
@@ -612,9 +613,8 @@ export class AppWrapper {
612
613
  });
613
614
  return currentDialogId;
614
615
  },
615
- closeDialog: function (dialogId, result) {
616
- let buttonType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : -1;
617
- const dialog = _this.dialogs.find(x => x.dialogId === dialogId);
616
+ closeDialog: (dialogId, result, buttonType = -1) => {
617
+ const dialog = this.dialogs.find(x => x.dialogId === dialogId);
618
618
  if (dialog) {
619
619
  dialog.resolve({
620
620
  buttonType,
@@ -684,12 +684,10 @@ export class AppWrapper {
684
684
  notImplemented(call) {
685
685
  console.warn(`call ${call} not implement in app`);
686
686
  }
687
- appCall(action) {
688
- let value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
689
- let {
690
- callback,
691
- awaitResult = true
692
- } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
687
+ appCall(action, value = {}, {
688
+ callback,
689
+ awaitResult = true
690
+ } = {}) {
693
691
  if (!awaitResult) {
694
692
  invokeAppCall({
695
693
  action,
@@ -742,10 +740,9 @@ export class AppWrapper {
742
740
  this.appCall(254, {
743
741
  enabled: true
744
742
  }, {
745
- callback: _ref3 => {
746
- let {
747
- colorMode
748
- } = _ref3;
743
+ callback: ({
744
+ colorMode
745
+ }) => {
749
746
  this.values = {
750
747
  ...this.values,
751
748
  site: {
@@ -9,7 +9,6 @@ import { sendMessageToGroup, sendMessageToPage, sendMessageToUser } from '../cal
9
9
  import { setTappHeight } from '../util/heightHelper';
10
10
  export class FrameWrapper {
11
11
  constructor() {
12
- var _this = this;
13
12
  _defineProperty(this, "resolve", null);
14
13
  _defineProperty(this, "exposedFunctions", null);
15
14
  _defineProperty(this, "exposedCustomFunctions", {});
@@ -33,7 +32,7 @@ export class FrameWrapper {
33
32
  if (!this.initialized) await this.ready;
34
33
  try {
35
34
  return await this.exposedFunctions.addVisibilityChangeListener(comlink.proxy(result => callback(result)));
36
- } catch (ex) {
35
+ } catch {
37
36
  return addVisibilityChangeListener(callback);
38
37
  }
39
38
  },
@@ -83,6 +82,10 @@ export class FrameWrapper {
83
82
  if (!this.initialized) await this.ready;
84
83
  return this.exposedFunctions.invokeCall(value, callback && comlink.proxy(result => callback(result)));
85
84
  },
85
+ invokePaymentCall: async (value, callback) => {
86
+ if (!this.initialized) await this.ready;
87
+ return this.exposedFunctions.invokePaymentCall(value, callback && comlink.proxy(result => callback(result)));
88
+ },
86
89
  invokeDialogCall: async (value, callback) => {
87
90
  if (!this.initialized) await this.ready;
88
91
  return this.exposedFunctions.invokeDialogCall(value, callback && comlink.proxy(result => callback(result)));
@@ -299,13 +302,10 @@ export class FrameWrapper {
299
302
  if (p in target) {
300
303
  return target[p];
301
304
  }
302
- return target[p] = async function () {
303
- if (!_this.initialized) await _this.ready;
304
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
305
- args[_key] = arguments[_key];
306
- }
305
+ return target[p] = async (...args) => {
306
+ if (!this.initialized) await this.ready;
307
307
  const wrappedArgs = args.map(v => typeof v === 'function' ? comlink.proxy(v) : v);
308
- return _this.exposedCustomFunctions[p](...wrappedArgs);
308
+ return this.exposedCustomFunctions[p](...wrappedArgs);
309
309
  };
310
310
  }
311
311
  }));
@@ -325,15 +325,13 @@ export class FrameWrapper {
325
325
  }
326
326
  }
327
327
  async init() {
328
- var _await$exposed$_custo,
329
- _this2 = this;
328
+ var _await$exposed$_custo;
330
329
  if (this.initialized) return;
331
330
  const exposed = comlink.wrap(comlink.windowEndpoint(window.parent))[window.name];
332
- const dataListener = () => exposed.addDataListener(comlink.proxy(_ref => {
333
- let {
334
- type,
335
- value
336
- } = _ref;
331
+ const dataListener = () => exposed.addDataListener(comlink.proxy(({
332
+ type,
333
+ value
334
+ }) => {
337
335
  if (this.initialized) {
338
336
  this.values = {
339
337
  ...this.values,
@@ -361,12 +359,7 @@ export class FrameWrapper {
361
359
  this.exposedCustomFunctions = exposed.customFunctions;
362
360
  this.exposedCustomFunctionNames = (_await$exposed$_custo = await exposed._customFunctionNames) !== null && _await$exposed$_custo !== void 0 ? _await$exposed$_custo : [];
363
361
  this.customFunctions = this.exposedCustomFunctionNames.reduce((p, e) => {
364
- p[e] = function () {
365
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
366
- args[_key2] = arguments[_key2];
367
- }
368
- return _this2.exposedCustomFunctions[e](...args.map(a => typeof a === 'function' ? comlink.proxy(a) : a));
369
- };
362
+ p[e] = (...args) => this.exposedCustomFunctions[e](...args.map(a => typeof a === 'function' ? comlink.proxy(a) : a));
370
363
  return p;
371
364
  }, {});
372
365
  this.initialized = true;
@@ -26,11 +26,8 @@ export class ModuleFederationWrapper {
26
26
  this.functions.sendMessageToGroup = async (groupId, object) => sendMessageToGroup(this, object, groupId);
27
27
  this.functions.sendMessageToPage = async object => sendMessageToPage(this, object);
28
28
  this.functions.sendMessageToUser = async (userId, object) => sendMessageToUser(this, object, userId);
29
- Object.entries(functions).forEach(_ref => {
30
- let [k, fn] = _ref;
31
- this.functions[k] = async function () {
32
- return fn(...arguments);
33
- };
29
+ Object.entries(functions).forEach(([k, fn]) => {
30
+ this.functions[k] = async (...args) => fn(...args);
34
31
  });
35
32
  if (customFunctions) {
36
33
  this.customFunctions = customFunctions;
@@ -6,7 +6,7 @@ import { AppFlavor } 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
+ import { ModuleFederationWrapper } from './ModuleFederationWrapper';
10
10
  class StaticChaynsApi {
11
11
  constructor(values, functions) {
12
12
  var _deviceInfo$app;
@@ -34,10 +34,7 @@ class StaticChaynsApi {
34
34
  this._wrapper = wrapper;
35
35
  this.ready = wrapper.init();
36
36
  this.addDataListener = wrapper.addDataListener;
37
- Object.entries(wrapper.functions).forEach(_ref => {
38
- let [k, v] = _ref;
39
- this[k] = v;
40
- });
37
+ Object.assign(this, wrapper.functions);
41
38
  }
42
39
  }
43
40
  export default StaticChaynsApi;
@@ -1,10 +1,16 @@
1
1
  import { DialogButtonOld } from "../../types/dialog";
2
- type iFrameDialog = {
2
+ type IFrameDialog = {
3
3
  buttons?: DialogButtonOld[];
4
- callType?: number;
5
- tappIframeName?: string;
6
4
  url: string;
5
+ input?: object;
6
+ seamless?: boolean;
7
+ transparent?: boolean;
8
+ waitCursor?: boolean;
9
+ maxHeight?: string;
10
+ width?: number;
11
+ fullHeight?: boolean;
12
+ customTransitionTimeout?: number;
7
13
  };
8
- export declare function iFrame(dialog?: iFrameDialog): Promise<unknown>;
14
+ export declare function iFrame(dialog?: IFrameDialog): Promise<unknown>;
9
15
  export declare function _chaynsCallResponder(obj: any): void;
10
16
  export {};
@@ -65,6 +65,8 @@ export declare const getWindowMetrics: (...args: Parameters<ChaynsReactFunctions
65
65
  /** @internal */
66
66
  export declare const invokeCall: (...args: Parameters<ChaynsReactFunctions["invokeCall"]>) => Promise<any>;
67
67
  /** @internal */
68
+ export declare const invokePaymentCall: (...args: Parameters<ChaynsReactFunctions["invokePaymentCall"]>) => Promise<unknown>;
69
+ /** @internal */
68
70
  export declare const invokeDialogCall: (...args: Parameters<ChaynsReactFunctions["invokeDialogCall"]>) => Promise<any>;
69
71
  /**
70
72
  * This method will show a login dialog where the user has the opportunity to log in.
@@ -0,0 +1,2 @@
1
+ import { useLayoutEffect } from 'react';
2
+ export declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  export declare const loadModule: (scope: string, module: string, url: string, preventSingleton?: boolean) => any;
2
- declare const loadComponent: (scope: string, module: string, url: string, skipCompatMode?: boolean, preventSingleton?: boolean) => any;
3
+ declare const loadComponent: (scope: string, module: string, url: string, skipCompatMode?: boolean, preventSingleton?: boolean) => React.LazyExoticComponent<React.ComponentType<any>>;
3
4
  export default loadComponent;
@@ -14,6 +14,7 @@ export { default as StaticChaynsApi } from './wrapper/StaticChaynsApi';
14
14
  export { default as loadComponent, loadModule } from './host/module/utils/loadComponent';
15
15
  export { default as DialogHandler } from './handler/DialogHandler';
16
16
  export * as dialog from './calls/dialogs/index';
17
+ export * from './plugins';
17
18
  export * from './util/initModuleFederationSharing';
18
19
  export * from './util/bindChaynsApi';
19
20
  export * from './util/appStorage';
@@ -0,0 +1,5 @@
1
+ import type { ModuleFederationRuntimePlugin } from '@module-federation/enhanced/runtime';
2
+ /**
3
+ * Adds SSR metadata and resolves public path when using manifest
4
+ */
5
+ export declare const SSRManifestPlugin: () => ModuleFederationRuntimePlugin;
@@ -1,5 +1,5 @@
1
- import type { FederationRuntimePlugin } from '@module-federation/enhanced/runtime';
1
+ import type { ModuleFederationRuntimePlugin } from '@module-federation/enhanced/runtime';
2
2
  /**
3
3
  * Plugin to prevent parallel loading of shared dependencies
4
4
  */
5
- export declare const SequentialLoadPlugin: () => FederationRuntimePlugin;
5
+ export declare const SequentialLoadPlugin: () => ModuleFederationRuntimePlugin;
@@ -0,0 +1,2 @@
1
+ import { ModuleFederationRuntimePlugin } from '@module-federation/enhanced/runtime';
2
+ export declare const TrustedDomainsPlugin: (trustedDomains?: string[]) => ModuleFederationRuntimePlugin;
@@ -0,0 +1,2 @@
1
+ export { SSRManifestPlugin } from './SSRManifestPlugin';
2
+ export { TrustedDomainsPlugin } from './TrustedDomainsPlugins';
@@ -259,7 +259,8 @@ export declare enum ScreenSize {
259
259
  }
260
260
  export declare enum AppFlavor {
261
261
  None = "none",
262
- Chayns = "chayns"
262
+ Chayns = "chayns",
263
+ Electron = "electron"
263
264
  }
264
265
  export type ChaynsApiDevice = {
265
266
  app?: {
@@ -372,6 +373,7 @@ export interface ChaynsReactFunctions {
372
373
  getScrollPosition: () => Promise<ScrollListenerResult>;
373
374
  getWindowMetrics: () => Promise<WindowMetricsListenerResult>;
374
375
  invokeCall: (value: InvokeCall, callback?: (result: any) => void) => Promise<any>;
376
+ invokePaymentCall: <T>(value: InvokeCall, callback?: (result: T) => void) => Promise<T>;
375
377
  invokeDialogCall: (value: InvokeCall, callback?: (result: any) => void) => Promise<any>;
376
378
  login: (value?: Login, callback?: (result: boolean) => void, closeCallback?: () => void) => Promise<LoginResult>;
377
379
  logout: () => Promise<void>;
@@ -612,14 +614,11 @@ export interface DesignSettingsUpdateCover {
612
614
  type: DesignSettingsUpdateCoverTypes;
613
615
  urls: string[];
614
616
  }
615
- export declare enum DesignSettingsUpdateColorSchemeMode {
616
- Normal = 0,
617
- Dark = 1,
618
- Bright = 2
619
- }
620
617
  export interface DesignSettingsUpdateColorScheme {
621
618
  color: string;
622
- mode: DesignSettingsUpdateColorSchemeMode;
619
+ /** @deprecated use colorMode instead */
620
+ mode: ColorMode;
621
+ colorMode: ColorMode;
623
622
  }
624
623
  export interface DesignSettingsUpdateGlobalSettings {
625
624
  useChatHead?: boolean;
@@ -701,11 +700,28 @@ export declare enum LoginState {
701
700
  SUCCESS = 4
702
701
  }
703
702
  export interface LoginResult {
703
+ /** @deprecated Check buttonType instead **/
704
704
  loginState: LoginState;
705
- }
706
- export interface Login {
707
- ignoreAuthenticated: boolean;
708
- }
705
+ buttonType: DialogButtonType;
706
+ token?: string;
707
+ confirmationToken?: string;
708
+ authCode?: string;
709
+ redirectUri?: string;
710
+ }
711
+ export type Login = BaseDialog & DialogModule<{
712
+ preventLogin?: boolean;
713
+ restore?: number;
714
+ tokenType?: number;
715
+ /**
716
+ * SiteId for which site the token should be generated.
717
+ * @warning Only works when tokenLocationId is defined too
718
+ **/
719
+ tokenSiteId?: string;
720
+ /**
721
+ * @warning Only works when tokenSiteId is defined too
722
+ */
723
+ tokenLocationId?: number;
724
+ }>;
709
725
  export interface InvokeCall {
710
726
  action: number;
711
727
  value?: object;
@@ -906,7 +922,8 @@ export declare enum AppName {
906
922
  Sidekick = 7,
907
923
  Team = 8,
908
924
  CityApp = 9,
909
- ElectronChayns = 10
925
+ ElectronChayns = 10,
926
+ ElectronTeam = 11
910
927
  }
911
928
  export declare enum BrowserName {
912
929
  Unknown = "unknown",
@@ -1,3 +1,4 @@
1
- export declare const initModuleFederationSharing: ({ name }: {
1
+ export declare const initModuleFederationSharing: ({ name, plugins }: {
2
2
  name: any;
3
+ plugins?: never[] | undefined;
3
4
  }) => void;
@@ -3,3 +3,4 @@ export declare const isAppCallSupported: ({ minAndroidVersion, minIOSVersion }:
3
3
  minAndroidVersion?: number | undefined;
4
4
  minIOSVersion?: number | undefined;
5
5
  }) => boolean;
6
+ export declare const isElectron: () => boolean;
@@ -1,9 +1,73 @@
1
- import { DataChangeCallback } from '../types/IChaynsReact';
2
- declare class StaticChaynsApi {
1
+ import { ChaynsReactFunctions, ChaynsReactValues, DataChangeCallback } from '../types/IChaynsReact';
2
+ declare class StaticChaynsApi implements ChaynsReactFunctions {
3
+ addGeoLocationListener: ChaynsReactFunctions['addGeoLocationListener'];
4
+ addScrollListener: ChaynsReactFunctions['addScrollListener'];
5
+ addVisibilityChangeListener: ChaynsReactFunctions['addVisibilityChangeListener'];
6
+ addToolbarChangeListener: ChaynsReactFunctions['addToolbarChangeListener'];
7
+ addWindowMetricsListener: ChaynsReactFunctions['addWindowMetricsListener'];
8
+ customCallbackFunction: ChaynsReactFunctions['customCallbackFunction'];
9
+ getAvailableSharingServices: ChaynsReactFunctions['getAvailableSharingServices'];
10
+ getAccessToken: ChaynsReactFunctions['getAccessToken'];
11
+ getCustomCookie: ChaynsReactFunctions['getCustomCookie'];
12
+ getGeoLocation: ChaynsReactFunctions['getGeoLocation'];
13
+ getUserInfo: ChaynsReactFunctions['getUserInfo'];
14
+ getScrollPosition: ChaynsReactFunctions['getScrollPosition'];
15
+ getWindowMetrics: ChaynsReactFunctions['getWindowMetrics'];
16
+ invokeCall: ChaynsReactFunctions['invokeCall'];
17
+ invokePaymentCall: ChaynsReactFunctions['invokePaymentCall'];
18
+ invokeDialogCall: ChaynsReactFunctions['invokeDialogCall'];
19
+ login: ChaynsReactFunctions['login'];
20
+ logout: ChaynsReactFunctions['logout'];
21
+ navigateBack: ChaynsReactFunctions['navigateBack'];
22
+ openImage: ChaynsReactFunctions['openImage'];
23
+ openUrl: ChaynsReactFunctions['openUrl'];
24
+ openVideo: ChaynsReactFunctions['openVideo'];
25
+ openMedia: ChaynsReactFunctions['openMedia'];
26
+ refreshData: ChaynsReactFunctions['refreshData'];
27
+ refreshAccessToken: ChaynsReactFunctions['refreshAccessToken'];
28
+ removeGeoLocationListener: ChaynsReactFunctions['removeGeoLocationListener'];
29
+ removeScrollListener: ChaynsReactFunctions['removeScrollListener'];
30
+ removeVisibilityChangeListener: ChaynsReactFunctions['removeVisibilityChangeListener'];
31
+ removeToolbarChangeListener: ChaynsReactFunctions['removeToolbarChangeListener'];
32
+ removeWindowMetricsListener: ChaynsReactFunctions['removeWindowMetricsListener'];
33
+ selectPage: ChaynsReactFunctions['selectPage'];
34
+ scrollToY: ChaynsReactFunctions['scrollToY'];
35
+ sendMessageToGroup: ChaynsReactFunctions['sendMessageToGroup'];
36
+ sendMessageToPage: ChaynsReactFunctions['sendMessageToPage'];
37
+ sendMessageToUser: ChaynsReactFunctions['sendMessageToUser'];
38
+ setAdminMode: ChaynsReactFunctions['setAdminMode'];
39
+ setCustomCookie: ChaynsReactFunctions['setCustomCookie'];
40
+ setDisplayTimeout: ChaynsReactFunctions['setDisplayTimeout'];
41
+ setFloatingButton: ChaynsReactFunctions['setFloatingButton'];
42
+ setHeight: ChaynsReactFunctions['setHeight'];
43
+ setRefreshScrollEnabled: ChaynsReactFunctions['setRefreshScrollEnabled'];
44
+ setScanQrCode: ChaynsReactFunctions['setScanQrCode'];
45
+ setTempDesignSettings: ChaynsReactFunctions['setTempDesignSettings'];
46
+ setWaitCursor: ChaynsReactFunctions['setWaitCursor'];
47
+ storageGetItem: ChaynsReactFunctions['storageGetItem'];
48
+ storageRemoveItem: ChaynsReactFunctions['storageRemoveItem'];
49
+ storageSetItem: ChaynsReactFunctions['storageSetItem'];
50
+ vibrate: ChaynsReactFunctions['vibrate'];
51
+ scrollByY: ChaynsReactFunctions['scrollByY'];
52
+ setOverlay: ChaynsReactFunctions['setOverlay'];
53
+ createDialog: ChaynsReactFunctions['createDialog'];
54
+ openDialog: ChaynsReactFunctions['openDialog'];
55
+ closeDialog: ChaynsReactFunctions['closeDialog'];
56
+ setDialogResult: ChaynsReactFunctions['setDialogResult'];
57
+ dispatchEventToDialogClient: ChaynsReactFunctions['dispatchEventToDialogClient'];
58
+ addDialogClientEventListener: ChaynsReactFunctions['addDialogClientEventListener'];
59
+ removeDialogClientEventListener: ChaynsReactFunctions['removeDialogClientEventListener'];
60
+ dispatchEventToDialogHost: ChaynsReactFunctions['dispatchEventToDialogHost'];
61
+ addDialogHostEventListener: ChaynsReactFunctions['addDialogHostEventListener'];
62
+ removeDialogHostEventListener: ChaynsReactFunctions['removeDialogHostEventListener'];
63
+ addAnonymousAccount: ChaynsReactFunctions['addAnonymousAccount'];
64
+ addAccessTokenChangeListener: ChaynsReactFunctions['addAccessTokenChangeListener'];
65
+ removeAccessTokenChangeListener: ChaynsReactFunctions['removeAccessTokenChangeListener'];
66
+ redirect: ChaynsReactFunctions['redirect'];
3
67
  ready: Promise<void>;
4
68
  addDataListener: (cb: DataChangeCallback) => () => void;
5
69
  private _wrapper;
6
- constructor(values: any, functions: any);
70
+ constructor(values?: ChaynsReactValues, functions?: ChaynsReactFunctions);
7
71
  getUser: () => import("../types/IChaynsReact").ChaynsApiUser | undefined;
8
72
  getSite: () => import("../types/IChaynsReact").ChaynsApiSite;
9
73
  getCurrentPage: () => {
@@ -30,6 +94,6 @@ declare class StaticChaynsApi {
30
94
  };
31
95
  getStyleSettings: () => import("../types/IChaynsReact").ChaynsStyleSettings | undefined;
32
96
  getCustomFunction: (key: string) => (...args: any[]) => Promise<any>;
33
- getDialogInput: () => any;
97
+ getDialogInput: <T>() => T;
34
98
  }
35
99
  export default StaticChaynsApi;
@@ -0,0 +1,3 @@
1
+ import config from '@chayns-toolkit/eslint-config';
2
+
3
+ export default config;