chayns-api 2.4.23 → 2.4.25

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.
@@ -7,6 +7,9 @@ exports.loadModule = exports.default = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
9
  const loadModule = (scope, module, url, preventSingleton = false) => {
10
+ if (!globalThis.moduleFederationRuntime || !globalThis.moduleFederationScopes) {
11
+ throw new Error('[chayns-api] moduleFederationSharing has not been initialized. Make sure to call initModuleFederationSharing.');
12
+ }
10
13
  const {
11
14
  loadRemote,
12
15
  registerRemotes
@@ -51,6 +54,9 @@ const loadComponent = (scope, module, url, skipCompatMode = false, preventSingle
51
54
  if (skipCompatMode) {
52
55
  console.warn('[chayns-api] skipCompatMode-option is deprecated and is set automatically now');
53
56
  }
57
+ if (!globalThis.moduleFederationRuntime || !globalThis.moduleFederationScopes) {
58
+ throw new Error('[chayns-api] moduleFederationSharing has not been initialized. Make sure to call initModuleFederationSharing.');
59
+ }
54
60
  const {
55
61
  loadShareSync,
56
62
  getInstance
@@ -621,6 +621,14 @@ class AppWrapper {
621
621
  }, {
622
622
  awaitResult: true
623
623
  }).then(result => {
624
+ if (config.type === _IChaynsReact.DialogType.DATE) {
625
+ const dialogResult = result.result;
626
+ if (typeof dialogResult === 'string') {
627
+ result.result = new Date(dialogResult);
628
+ } else if (Array.isArray(dialogResult)) {
629
+ result.result = dialogResult.map(date => new Date(date));
630
+ }
631
+ }
624
632
  callback(result);
625
633
  });
626
634
  return currentDialogId;
@@ -1,6 +1,9 @@
1
1
  import React from "react";
2
2
  export const loadModule = function (scope, module, url) {
3
3
  let preventSingleton = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
4
+ if (!globalThis.moduleFederationRuntime || !globalThis.moduleFederationScopes) {
5
+ throw new Error('[chayns-api] moduleFederationSharing has not been initialized. Make sure to call initModuleFederationSharing.');
6
+ }
4
7
  const {
5
8
  loadRemote,
6
9
  registerRemotes
@@ -46,6 +49,9 @@ const loadComponent = function (scope, module, url) {
46
49
  if (skipCompatMode) {
47
50
  console.warn('[chayns-api] skipCompatMode-option is deprecated and is set automatically now');
48
51
  }
52
+ if (!globalThis.moduleFederationRuntime || !globalThis.moduleFederationScopes) {
53
+ throw new Error('[chayns-api] moduleFederationSharing has not been initialized. Make sure to call initModuleFederationSharing.');
54
+ }
49
55
  const {
50
56
  loadShareSync,
51
57
  getInstance
@@ -7,7 +7,7 @@ import { sendMessageToGroup, sendMessageToPage, sendMessageToUser } from '../cal
7
7
  import { DeviceLanguage } from '../constants/languages';
8
8
  import DialogHandler from '../handler/DialogHandler';
9
9
  import { addApiListener, dispatchApiEvent, removeApiListener } from '../helper/apiListenerHelper';
10
- import { AppName, DialogButtonType, Environment, Font, Gender, IconType, LoginState, RuntimeEnviroment, TappEvent } from '../types/IChaynsReact';
10
+ import { AppName, DialogButtonType, DialogType, Environment, Font, Gender, IconType, LoginState, RuntimeEnviroment, TappEvent } from '../types/IChaynsReact';
11
11
  import invokeAppCall from '../util/appCall';
12
12
  import { addAppStorageListener, clearAppStorage, isAppStorageAvailable, setAppStorageItem } from '../util/appStorage';
13
13
  import getDeviceInfo, { getScreenSize } from '../util/deviceHelper';
@@ -588,6 +588,14 @@ export class AppWrapper {
588
588
  }, {
589
589
  awaitResult: true
590
590
  }).then(result => {
591
+ if (config.type === DialogType.DATE) {
592
+ const dialogResult = result.result;
593
+ if (typeof dialogResult === 'string') {
594
+ result.result = new Date(dialogResult);
595
+ } else if (Array.isArray(dialogResult)) {
596
+ result.result = dialogResult.map(date => new Date(date));
597
+ }
598
+ }
591
599
  callback(result);
592
600
  });
593
601
  return currentDialogId;
@@ -1,3 +1,3 @@
1
- export declare const loadModule: (scope: any, module: any, url: any, preventSingleton?: boolean) => any;
2
- declare const loadComponent: (scope: any, module: any, url: any, skipCompatMode?: boolean, preventSingleton?: boolean) => any;
1
+ 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
3
  export default loadComponent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chayns-api",
3
- "version": "2.4.23",
3
+ "version": "2.4.25",
4
4
  "description": "new chayns api",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",