chayns-api 1.0.1 → 1.0.3

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 (263) hide show
  1. package/.babelrc +30 -30
  2. package/.eslintrc +17 -17
  3. package/.github/workflows/deploy_docs.yml +28 -28
  4. package/.github/workflows/publish.yml +21 -0
  5. package/LICENSE +21 -21
  6. package/README.md +47 -47
  7. package/dist/cjs/calls/dialogs/alert.js +0 -2
  8. package/dist/cjs/calls/dialogs/chaynsDialog.js +2 -8
  9. package/dist/cjs/calls/dialogs/close.js +0 -2
  10. package/dist/cjs/calls/dialogs/communication.js +1 -16
  11. package/dist/cjs/calls/dialogs/confirm.js +0 -4
  12. package/dist/cjs/calls/dialogs/date.js +46 -63
  13. package/dist/cjs/calls/dialogs/dropUpAlert.js +0 -3
  14. package/dist/cjs/calls/dialogs/fileSelect.js +0 -10
  15. package/dist/cjs/calls/dialogs/iFrame.js +0 -8
  16. package/dist/cjs/calls/dialogs/index.js +0 -27
  17. package/dist/cjs/calls/dialogs/input.js +0 -6
  18. package/dist/cjs/calls/dialogs/mediaSelect.js +0 -7
  19. package/dist/cjs/calls/dialogs/open.js +0 -2
  20. package/dist/cjs/calls/dialogs/select.js +0 -9
  21. package/dist/cjs/calls/dialogs/signature.js +0 -5
  22. package/dist/cjs/calls/dialogs/toast.js +0 -3
  23. package/dist/cjs/calls/dialogs/utils/callback.js +0 -2
  24. package/dist/cjs/calls/dialogs/utils/is.js +0 -4
  25. package/dist/cjs/calls/getUserInfo.js +0 -11
  26. package/dist/cjs/calls/index.js +95 -247
  27. package/dist/cjs/calls/sendMessage.js +8 -34
  28. package/dist/cjs/calls/visibilityChangeListener.js +5 -16
  29. package/dist/cjs/components/ChaynsContext.js +2 -4
  30. package/dist/cjs/components/ChaynsProvider.js +6 -28
  31. package/dist/cjs/components/WaitUntil.js +0 -5
  32. package/dist/cjs/components/withCompatMode.js +1 -16
  33. package/dist/cjs/helper/apiListenerHelper.js +0 -9
  34. package/dist/cjs/hooks/geoLocationListener.js +6 -15
  35. package/dist/cjs/hooks/index.js +6 -16
  36. package/dist/cjs/hooks/scrollListener.js +12 -31
  37. package/dist/cjs/hooks/useAccessToken.js +2 -7
  38. package/dist/cjs/hooks/useCurrentPage.js +2 -6
  39. package/dist/cjs/hooks/useCustomData.js +2 -6
  40. package/dist/cjs/hooks/useDevice.js +2 -6
  41. package/dist/cjs/hooks/useEnvironment.js +2 -6
  42. package/dist/cjs/hooks/useFunctions.js +2 -6
  43. package/dist/cjs/hooks/useIsAdminMode.js +2 -7
  44. package/dist/cjs/hooks/useLanguage.js +2 -6
  45. package/dist/cjs/hooks/usePages.js +26 -18
  46. package/dist/cjs/hooks/useParameters.js +2 -6
  47. package/dist/cjs/hooks/useSite.js +2 -6
  48. package/dist/cjs/hooks/useUser.js +2 -7
  49. package/dist/cjs/hooks/useValues.js +2 -6
  50. package/dist/cjs/hooks/windowMetricsListener.js +6 -16
  51. package/dist/cjs/host/ChaynsHost.js +0 -10
  52. package/dist/cjs/host/iframe/HostIframe.js +23 -30
  53. package/dist/cjs/host/iframe/utils/useUpdateData.js +0 -3
  54. package/dist/cjs/host/module/ModuleHost.js +3 -13
  55. package/dist/cjs/host/module/utils/loadComponent.js +1 -18
  56. package/dist/cjs/host/module/utils/useDynamicScript.js +0 -18
  57. package/dist/cjs/index.js +0 -19
  58. package/dist/cjs/types/IChaynsReact.js +27 -48
  59. package/dist/cjs/util/appCall.js +1 -4
  60. package/dist/cjs/util/deviceHelper.js +5 -22
  61. package/dist/cjs/util/heightHelper.js +0 -9
  62. package/dist/cjs/util/postIframeForm.js +0 -5
  63. package/dist/cjs/wrapper/AppWrapper.js +323 -159
  64. package/dist/cjs/wrapper/FrameWrapper.js +219 -248
  65. package/dist/cjs/wrapper/ModuleFederationWrapper.js +2 -27
  66. package/dist/cjs/wrapper/SsrWrapper.js +0 -8
  67. package/dist/esm/calls/dialogs/alert.js +4 -4
  68. package/dist/esm/calls/dialogs/chaynsDialog.js +7 -11
  69. package/dist/esm/calls/dialogs/communication.js +15 -26
  70. package/dist/esm/calls/dialogs/confirm.js +5 -8
  71. package/dist/esm/calls/dialogs/date.js +119 -128
  72. package/dist/esm/calls/dialogs/dropUpAlert.js +1 -1
  73. package/dist/esm/calls/dialogs/fileSelect.js +23 -62
  74. package/dist/esm/calls/dialogs/iFrame.js +7 -10
  75. package/dist/esm/calls/dialogs/input.js +2 -5
  76. package/dist/esm/calls/dialogs/mediaSelect.js +18 -55
  77. package/dist/esm/calls/dialogs/open.js +2 -2
  78. package/dist/esm/calls/dialogs/select.js +5 -9
  79. package/dist/esm/calls/dialogs/signature.js +0 -2
  80. package/dist/esm/calls/dialogs/toast.js +6 -11
  81. package/dist/esm/calls/dialogs/utils/callback.js +3 -5
  82. package/dist/esm/calls/dialogs/utils/is.js +1 -3
  83. package/dist/esm/calls/getUserInfo.js +32 -92
  84. package/dist/esm/calls/index.js +297 -449
  85. package/dist/esm/calls/sendMessage.js +99 -229
  86. package/dist/esm/calls/visibilityChangeListener.js +14 -19
  87. package/dist/esm/components/ChaynsContext.js +3 -3
  88. package/dist/esm/components/ChaynsProvider.js +45 -86
  89. package/dist/esm/components/WaitUntil.js +21 -86
  90. package/dist/esm/components/withCompatMode.js +35 -77
  91. package/dist/esm/helper/apiListenerHelper.js +10 -15
  92. package/dist/esm/hooks/geoLocationListener.js +24 -50
  93. package/dist/esm/hooks/index.js +1 -1
  94. package/dist/esm/hooks/scrollListener.js +58 -94
  95. package/dist/esm/hooks/useAccessToken.js +8 -30
  96. package/dist/esm/hooks/useCurrentPage.js +4 -8
  97. package/dist/esm/hooks/useCustomData.js +4 -8
  98. package/dist/esm/hooks/useDevice.js +3 -8
  99. package/dist/esm/hooks/useEnvironment.js +3 -8
  100. package/dist/esm/hooks/useFunctions.js +4 -7
  101. package/dist/esm/hooks/useIsAdminMode.js +4 -8
  102. package/dist/esm/hooks/useLanguage.js +3 -8
  103. package/dist/esm/hooks/usePages.js +38 -31
  104. package/dist/esm/hooks/useParameters.js +3 -8
  105. package/dist/esm/hooks/useSite.js +3 -8
  106. package/dist/esm/hooks/useUser.js +3 -9
  107. package/dist/esm/hooks/useValues.js +4 -7
  108. package/dist/esm/hooks/windowMetricsListener.js +22 -48
  109. package/dist/esm/host/ChaynsHost.js +22 -29
  110. package/dist/esm/host/iframe/HostIframe.js +86 -142
  111. package/dist/esm/host/iframe/utils/useUpdateData.js +4 -6
  112. package/dist/esm/host/module/ModuleHost.js +42 -49
  113. package/dist/esm/host/module/utils/loadComponent.js +47 -85
  114. package/dist/esm/host/module/utils/useDynamicScript.js +27 -74
  115. package/dist/esm/types/IChaynsReact.js +37 -61
  116. package/dist/esm/util/appCall.js +2 -4
  117. package/dist/esm/util/deviceHelper.js +13 -37
  118. package/dist/esm/util/heightHelper.js +10 -13
  119. package/dist/esm/util/postIframeForm.js +25 -57
  120. package/dist/esm/wrapper/AppWrapper.js +385 -781
  121. package/dist/esm/wrapper/FrameWrapper.js +262 -1509
  122. package/dist/esm/wrapper/ModuleFederationWrapper.js +47 -284
  123. package/dist/esm/wrapper/SsrWrapper.js +19 -65
  124. package/dist/types/calls/dialogs/alert.d.ts +1 -1
  125. package/dist/types/calls/dialogs/chaynsDialog.d.ts +24 -24
  126. package/dist/types/calls/dialogs/close.d.ts +1 -1
  127. package/dist/types/calls/dialogs/communication.d.ts +3 -3
  128. package/dist/types/calls/dialogs/confirm.d.ts +13 -13
  129. package/dist/types/calls/dialogs/date.d.ts +96 -96
  130. package/dist/types/calls/dialogs/dropUpAlert.d.ts +5 -5
  131. package/dist/types/calls/dialogs/fileSelect.d.ts +16 -16
  132. package/dist/types/calls/dialogs/iFrame.d.ts +10 -10
  133. package/dist/types/calls/dialogs/index.d.ts +14 -14
  134. package/dist/types/calls/dialogs/input.d.ts +15 -15
  135. package/dist/types/calls/dialogs/mediaSelect.d.ts +8 -8
  136. package/dist/types/calls/dialogs/open.d.ts +1 -1
  137. package/dist/types/calls/dialogs/select.d.ts +6 -6
  138. package/dist/types/calls/dialogs/signature.d.ts +7 -7
  139. package/dist/types/calls/dialogs/toast.d.ts +1 -1
  140. package/dist/types/calls/dialogs/utils/callback.d.ts +1 -1
  141. package/dist/types/calls/dialogs/utils/is.d.ts +4 -4
  142. package/dist/types/calls/getUserInfo.d.ts +9 -9
  143. package/dist/types/calls/index.d.ts +225 -231
  144. package/dist/types/calls/sendMessage.d.ts +13 -13
  145. package/dist/types/calls/visibilityChangeListener.d.ts +9 -9
  146. package/dist/types/components/ChaynsContext.d.ts +3 -3
  147. package/dist/types/components/ChaynsProvider.d.ts +13 -13
  148. package/dist/types/components/WaitUntil.d.ts +7 -7
  149. package/dist/types/components/withCompatMode.d.ts +13 -13
  150. package/dist/types/helper/apiListenerHelper.d.ts +6 -6
  151. package/dist/types/hooks/geoLocationListener.d.ts +18 -18
  152. package/dist/types/hooks/index.d.ts +16 -16
  153. package/dist/types/hooks/scrollListener.d.ts +28 -28
  154. package/dist/types/hooks/useAccessToken.d.ts +5 -5
  155. package/dist/types/hooks/useCurrentPage.d.ts +4 -4
  156. package/dist/types/hooks/useCustomData.d.ts +4 -4
  157. package/dist/types/hooks/useDevice.d.ts +5 -5
  158. package/dist/types/hooks/useEnvironment.d.ts +5 -5
  159. package/dist/types/hooks/useFunctions.d.ts +5 -5
  160. package/dist/types/hooks/useIsAdminMode.d.ts +4 -4
  161. package/dist/types/hooks/useLanguage.d.ts +5 -5
  162. package/dist/types/hooks/usePages.d.ts +18 -14
  163. package/dist/types/hooks/useParameters.d.ts +5 -5
  164. package/dist/types/hooks/useSite.d.ts +5 -5
  165. package/dist/types/hooks/useUser.d.ts +5 -5
  166. package/dist/types/hooks/useValues.d.ts +5 -5
  167. package/dist/types/hooks/windowMetricsListener.d.ts +11 -11
  168. package/dist/types/host/ChaynsHost.d.ts +28 -28
  169. package/dist/types/host/iframe/HostIframe.d.ts +24 -24
  170. package/dist/types/host/iframe/utils/useUpdateData.d.ts +3 -3
  171. package/dist/types/host/module/ModuleHost.d.ts +23 -23
  172. package/dist/types/host/module/utils/loadComponent.d.ts +1 -1
  173. package/dist/types/host/module/utils/useDynamicScript.d.ts +9 -9
  174. package/dist/types/index.d.ts +16 -16
  175. package/dist/types/types/IChaynsReact.d.ts +622 -590
  176. package/dist/types/types/dialog.d.ts +41 -41
  177. package/dist/types/util/appCall.d.ts +2 -2
  178. package/dist/types/util/deviceHelper.d.ts +7 -7
  179. package/dist/types/util/heightHelper.d.ts +1 -1
  180. package/dist/types/util/postIframeForm.d.ts +1 -1
  181. package/dist/types/wrapper/AppWrapper.d.ts +18 -16
  182. package/dist/types/wrapper/FrameWrapper.d.ts +15 -15
  183. package/dist/types/wrapper/ModuleFederationWrapper.d.ts +10 -10
  184. package/dist/types/wrapper/SsrWrapper.d.ts +11 -11
  185. package/package.json +76 -76
  186. package/toolkit.config.js +52 -52
  187. package/tsconfig.json +56 -56
  188. package/dist/cjs/bootstrap.js +0 -11
  189. package/dist/cjs/calls/abstractApiListener.js +0 -40
  190. package/dist/cjs/calls/apiEventListener.js +0 -40
  191. package/dist/cjs/calls/setVisibilityChangeListener.js +0 -1
  192. package/dist/cjs/calls/windowMetricsListener.js +0 -18
  193. package/dist/cjs/client.js +0 -93
  194. package/dist/cjs/components/App.js +0 -32
  195. package/dist/cjs/components/App.spec.js +0 -16
  196. package/dist/cjs/components/Button.js +0 -32
  197. package/dist/cjs/components/ChaynsModuleProvider.js +0 -457
  198. package/dist/cjs/components/ChaynsProviderExposed.js +0 -16
  199. package/dist/cjs/components/TestProvider.js +0 -236
  200. package/dist/cjs/components/Title.js +0 -162
  201. package/dist/cjs/functions/addApiListener.js +0 -37
  202. package/dist/cjs/functions/addGeoLocationListener.js +0 -26
  203. package/dist/cjs/functions/addScrollListener.js +0 -26
  204. package/dist/cjs/functions/addWindowMetricsListener.js +0 -37
  205. package/dist/cjs/helper/cssLoader.js +0 -28
  206. package/dist/cjs/hooks/addGeoLocationListener.js +0 -26
  207. package/dist/cjs/hooks/addScrollListener.js +0 -26
  208. package/dist/cjs/hooks/addWindowMetricsListener.js +0 -37
  209. package/dist/cjs/hooks/geoLocation.js +0 -48
  210. package/dist/cjs/hooks/useAddGeoLocationListener.js +0 -26
  211. package/dist/cjs/hooks/useAddScrollListener.js +0 -48
  212. package/dist/cjs/hooks/useAddWindowMetricsListener.js +0 -45
  213. package/dist/cjs/hooks/useAdddScrollListener.js +0 -26
  214. package/dist/cjs/hooks/windowMetrics.js +0 -45
  215. package/dist/cjs/host/HostIframe.js +0 -157
  216. package/dist/cjs/host/ModuleHost.js +0 -11
  217. package/dist/cjs/host/module/utils.js +0 -25
  218. package/dist/cjs/index.example.js +0 -7
  219. package/dist/cjs/index2.js +0 -64
  220. package/dist/cjs/types/DynamicApiImport.d.js +0 -5
  221. package/dist/cjs/types/DynamicImport.d.js +0 -5
  222. package/dist/cjs/types/chayns-components.d.js +0 -1
  223. package/dist/cjs/types/chayns-logger.d.js +0 -1
  224. package/dist/cjs/types/chayns.d.js +0 -1
  225. package/dist/cjs/types/tobit-websocket-service-client.d.js +0 -1
  226. package/dist/cjs/types/toolkit-types.d.js +0 -1
  227. package/dist/cjs/util/useFunctionsContext.js +0 -16
  228. package/dist/cjs/util/useIsAdminMode.js +0 -18
  229. package/dist/cjs/util/useUser.js +0 -16
  230. package/dist/esm/bootstrap.js +0 -4
  231. package/dist/esm/client.js +0 -8
  232. package/dist/esm/components/App.js +0 -35
  233. package/dist/esm/components/App.spec.js +0 -9
  234. package/dist/esm/components/Button.js +0 -34
  235. package/dist/esm/components/ChaynsModuleProvider.js +0 -517
  236. package/dist/esm/components/ChaynsProviderExposed.js +0 -3
  237. package/dist/esm/components/TestProvider.js +0 -308
  238. package/dist/esm/components/Title.js +0 -210
  239. package/dist/esm/helper/cssLoader.js +0 -21
  240. package/dist/esm/hooks/useAddGeoLocationListener.js +0 -18
  241. package/dist/esm/hooks/useAddScrollListener.js +0 -18
  242. package/dist/esm/hooks/useAddWindowMetricsListener.js +0 -18
  243. package/dist/esm/host/HostIframe.js +0 -153
  244. package/dist/esm/index.example.js +0 -1
  245. package/dist/esm/index2.js +0 -5
  246. package/dist/esm/types/DynamicApiImport.d.js +0 -1
  247. package/dist/esm/types/DynamicImport.d.js +0 -1
  248. package/dist/esm/types/chayns-components.d.js +0 -0
  249. package/dist/esm/types/chayns-logger.d.js +0 -0
  250. package/dist/esm/types/chayns.d.js +0 -0
  251. package/dist/esm/types/tobit-websocket-service-client.d.js +0 -0
  252. package/dist/esm/types/toolkit-types.d.js +0 -0
  253. package/dist/esm/util/useIsAdminMode.js +0 -9
  254. package/dist/esm/util/useUser.js +0 -7
  255. package/dist/types/bootstrap.d.ts +0 -1
  256. package/dist/types/client.d.ts +0 -7
  257. package/dist/types/components/App.d.ts +0 -5
  258. package/dist/types/components/Button.d.ts +0 -8
  259. package/dist/types/components/ChaynsModuleProvider.d.ts +0 -170
  260. package/dist/types/components/ChaynsProviderExposed.d.ts +0 -13
  261. package/dist/types/components/Title.d.ts +0 -3
  262. package/dist/types/host/HostIframe.d.ts +0 -20
  263. package/dist/types/index.example.d.ts +0 -0
@@ -1,293 +1,56 @@
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
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
14
-
15
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
16
-
17
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18
-
19
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
20
-
21
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
22
-
23
1
  import { addVisibilityChangeListener, removeVisibilityChangeListener } from '../calls/visibilityChangeListener';
24
2
  import { addApiListener, dispatchApiEvent, removeApiListener } from '../helper/apiListenerHelper';
25
3
  import getUserInfo from '../calls/getUserInfo';
26
4
  import { sendMessageToGroup, sendMessageToPage, sendMessageToUser } from '../calls/sendMessage';
27
- export var ModuleFederationWrapper = /*#__PURE__*/function () {
28
- function ModuleFederationWrapper(values, functions) {
29
- var _this = this;
30
-
31
- _classCallCheck(this, ModuleFederationWrapper);
32
-
5
+ export class ModuleFederationWrapper {
6
+ constructor(values, functions) {
33
7
  this.values = values;
34
8
  this.functions = {};
35
-
36
- this.functions.addVisibilityChangeListener = /*#__PURE__*/function () {
37
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(callback) {
38
- return regeneratorRuntime.wrap(function _callee$(_context) {
39
- while (1) {
40
- switch (_context.prev = _context.next) {
41
- case 0:
42
- return _context.abrupt("return", addVisibilityChangeListener(callback));
43
-
44
- case 1:
45
- case "end":
46
- return _context.stop();
47
- }
48
- }
49
- }, _callee);
50
- }));
51
-
52
- return function (_x) {
53
- return _ref.apply(this, arguments);
54
- };
55
- }();
56
-
57
- this.functions.removeVisibilityChangeListener = /*#__PURE__*/function () {
58
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(id) {
59
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
60
- while (1) {
61
- switch (_context2.prev = _context2.next) {
62
- case 0:
63
- return _context2.abrupt("return", removeVisibilityChangeListener(id));
64
-
65
- case 1:
66
- case "end":
67
- return _context2.stop();
68
- }
69
- }
70
- }, _callee2);
71
- }));
72
-
73
- return function (_x2) {
74
- return _ref2.apply(this, arguments);
75
- };
76
- }();
77
-
78
- this.functions.getUserInfo = /*#__PURE__*/function () {
79
- var _ref3 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(query) {
80
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
81
- while (1) {
82
- switch (_context3.prev = _context3.next) {
83
- case 0:
84
- return _context3.abrupt("return", getUserInfo(_this, query));
85
-
86
- case 1:
87
- case "end":
88
- return _context3.stop();
89
- }
90
- }
91
- }, _callee3);
92
- }));
93
-
94
- return function (_x3) {
95
- return _ref3.apply(this, arguments);
96
- };
97
- }();
98
-
99
- this.functions.sendMessageToGroup = /*#__PURE__*/function () {
100
- var _ref4 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4(groupId, object) {
101
- return regeneratorRuntime.wrap(function _callee4$(_context4) {
102
- while (1) {
103
- switch (_context4.prev = _context4.next) {
104
- case 0:
105
- return _context4.abrupt("return", sendMessageToGroup(_this, object, groupId));
106
-
107
- case 1:
108
- case "end":
109
- return _context4.stop();
110
- }
111
- }
112
- }, _callee4);
113
- }));
114
-
115
- return function (_x4, _x5) {
116
- return _ref4.apply(this, arguments);
117
- };
118
- }();
119
-
120
- this.functions.sendMessageToPage = /*#__PURE__*/function () {
121
- var _ref5 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(object) {
122
- return regeneratorRuntime.wrap(function _callee5$(_context5) {
123
- while (1) {
124
- switch (_context5.prev = _context5.next) {
125
- case 0:
126
- return _context5.abrupt("return", sendMessageToPage(_this, object));
127
-
128
- case 1:
129
- case "end":
130
- return _context5.stop();
131
- }
132
- }
133
- }, _callee5);
134
- }));
135
-
136
- return function (_x6) {
137
- return _ref5.apply(this, arguments);
138
- };
139
- }();
140
-
141
- this.functions.sendMessageToUser = /*#__PURE__*/function () {
142
- var _ref6 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(userId, object) {
143
- return regeneratorRuntime.wrap(function _callee6$(_context6) {
144
- while (1) {
145
- switch (_context6.prev = _context6.next) {
146
- case 0:
147
- return _context6.abrupt("return", sendMessageToUser(_this, object, userId));
148
-
149
- case 1:
150
- case "end":
151
- return _context6.stop();
152
- }
153
- }
154
- }, _callee6);
155
- }));
156
-
157
- return function (_x7, _x8) {
158
- return _ref6.apply(this, arguments);
159
- };
160
- }(); // make all functions async to be consistent with frame wrapper
161
-
162
-
163
- Object.entries(functions).forEach(function (_ref7) {
164
- var _ref8 = _slicedToArray(_ref7, 2),
165
- k = _ref8[0],
166
- fn = _ref8[1];
167
-
9
+ this.functions.addVisibilityChangeListener = async callback => addVisibilityChangeListener(callback);
10
+ this.functions.removeVisibilityChangeListener = async id => removeVisibilityChangeListener(id);
11
+ this.functions.getUserInfo = async query => getUserInfo(this, query);
12
+ this.functions.sendMessageToGroup = async (groupId, object) => sendMessageToGroup(this, object, groupId);
13
+ this.functions.sendMessageToPage = async object => sendMessageToPage(this, object);
14
+ this.functions.sendMessageToUser = async (userId, object) => sendMessageToUser(this, object, userId);
15
+ // make all functions async to be consistent with frame wrapper
16
+ Object.entries(functions).forEach(_ref => {
17
+ let [k, fn] = _ref;
168
18
  // eslint-disable-next-line
169
- _this.functions[k] = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() {
170
- var _args7 = arguments;
171
- return regeneratorRuntime.wrap(function _callee7$(_context7) {
172
- while (1) {
173
- switch (_context7.prev = _context7.next) {
174
- case 0:
175
- return _context7.abrupt("return", fn.apply(void 0, _args7));
176
-
177
- case 1:
178
- case "end":
179
- return _context7.stop();
180
- }
181
- }
182
- }, _callee7);
183
- }));
184
- });
185
-
186
- this.functions.addWindowMetricsListener = /*#__PURE__*/function () {
187
- var _ref10 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(callback) {
188
- var _addApiListener, id, shouldInitialize;
189
-
190
- return regeneratorRuntime.wrap(function _callee8$(_context8) {
191
- while (1) {
192
- switch (_context8.prev = _context8.next) {
193
- case 0:
194
- _addApiListener = addApiListener('windowMetrics', callback), id = _addApiListener.id, shouldInitialize = _addApiListener.shouldInitialize;
195
-
196
- if (shouldInitialize) {
197
- void functions.addWindowMetricsListener(function (value) {
198
- return dispatchApiEvent('windowMetrics', value);
199
- });
200
- }
201
-
202
- return _context8.abrupt("return", id);
203
-
204
- case 3:
205
- case "end":
206
- return _context8.stop();
207
- }
208
- }
209
- }, _callee8);
210
- }));
211
-
212
- return function (_x9) {
213
- return _ref10.apply(this, arguments);
19
+ this.functions[k] = async function () {
20
+ return fn(...arguments);
214
21
  };
215
- }();
216
-
217
- this.functions.removeWindowMetricsListener = /*#__PURE__*/function () {
218
- var _ref11 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(id) {
219
- var shouldRemove;
220
- return regeneratorRuntime.wrap(function _callee9$(_context9) {
221
- while (1) {
222
- switch (_context9.prev = _context9.next) {
223
- case 0:
224
- shouldRemove = removeApiListener('windowMetrics', id);
225
-
226
- if (shouldRemove) {
227
- void functions.removeWindowMetricsListener(id);
228
- }
229
-
230
- case 2:
231
- case "end":
232
- return _context9.stop();
233
- }
234
- }
235
- }, _callee9);
236
- }));
237
-
238
- return function (_x10) {
239
- return _ref11.apply(this, arguments);
240
- };
241
- }();
242
- }
243
-
244
- _createClass(ModuleFederationWrapper, [{
245
- key: "init",
246
- value: function () {
247
- var _init = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10() {
248
- return regeneratorRuntime.wrap(function _callee10$(_context10) {
249
- while (1) {
250
- switch (_context10.prev = _context10.next) {
251
- case 0:
252
- return _context10.abrupt("return", undefined);
253
-
254
- case 1:
255
- case "end":
256
- return _context10.stop();
257
- }
258
- }
259
- }, _callee10);
260
- }));
261
-
262
- function init() {
263
- return _init.apply(this, arguments);
22
+ });
23
+ this.functions.addWindowMetricsListener = async callback => {
24
+ const {
25
+ id,
26
+ shouldInitialize
27
+ } = addApiListener('windowMetrics', callback);
28
+ if (shouldInitialize) {
29
+ void functions.addWindowMetricsListener(value => dispatchApiEvent('windowMetrics', value));
264
30
  }
265
-
266
- return init;
267
- }()
268
- }, {
269
- key: "addDataListener",
270
- value: function addDataListener(cb) {
271
- var listener = function listener(ev) {
272
- return ev.detail && cb(ev.detail);
273
- };
274
-
275
- document.addEventListener('chayns_api_data', listener);
276
- return function () {
277
- document.removeEventListener('chayns_api_data', listener);
278
- };
279
- }
280
- }, {
281
- key: "getSSRData",
282
- value: function getSSRData() {
283
- return null;
284
- }
285
- }, {
286
- key: "getInitialData",
287
- value: function getInitialData() {
288
- return this.values;
289
- }
290
- }]);
291
-
292
- return ModuleFederationWrapper;
293
- }();
31
+ return id;
32
+ };
33
+ this.functions.removeWindowMetricsListener = async id => {
34
+ const shouldRemove = removeApiListener('windowMetrics', id);
35
+ if (shouldRemove) {
36
+ void functions.removeWindowMetricsListener(id);
37
+ }
38
+ };
39
+ }
40
+ async init() {
41
+ return undefined;
42
+ }
43
+ addDataListener(cb) {
44
+ const listener = ev => ev.detail && cb(ev.detail);
45
+ document.addEventListener('chayns_api_data', listener);
46
+ return () => {
47
+ document.removeEventListener('chayns_api_data', listener);
48
+ };
49
+ }
50
+ getSSRData() {
51
+ return null;
52
+ }
53
+ getInitialData() {
54
+ return this.values;
55
+ }
56
+ }
@@ -1,69 +1,23 @@
1
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
2
-
3
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4
-
5
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
-
7
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
8
-
9
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
10
-
11
- export var SsrWrapper = /*#__PURE__*/function () {
12
- function SsrWrapper(values, functions) {
13
- _classCallCheck(this, SsrWrapper);
14
-
1
+ export class SsrWrapper {
2
+ constructor(values, functions) {
15
3
  this.initialData = values;
16
4
  this.values = values;
17
5
  this.functions = functions;
18
6
  }
19
-
20
- _createClass(SsrWrapper, [{
21
- key: "init",
22
- value: function () {
23
- var _init = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
24
- return regeneratorRuntime.wrap(function _callee$(_context) {
25
- while (1) {
26
- switch (_context.prev = _context.next) {
27
- case 0:
28
- return _context.abrupt("return", undefined);
29
-
30
- case 1:
31
- case "end":
32
- return _context.stop();
33
- }
34
- }
35
- }, _callee);
36
- }));
37
-
38
- function init() {
39
- return _init.apply(this, arguments);
40
- }
41
-
42
- return init;
43
- }()
44
- }, {
45
- key: "addDataListener",
46
- value: function addDataListener(cb) {
47
- var listener = function listener(ev) {
48
- return ev.detail && cb(ev.detail);
49
- };
50
-
51
- document.addEventListener('chayns_api_data', listener);
52
- return function () {
53
- document.removeEventListener('chayns_api_data', listener);
54
- };
55
- }
56
- }, {
57
- key: "getSSRData",
58
- value: function getSSRData() {
59
- return this.initialData;
60
- }
61
- }, {
62
- key: "getInitialData",
63
- value: function getInitialData() {
64
- return this.values;
65
- }
66
- }]);
67
-
68
- return SsrWrapper;
69
- }();
7
+ async init() {
8
+ return undefined;
9
+ }
10
+ addDataListener(cb) {
11
+ const listener = ev => ev.detail && cb(ev.detail);
12
+ document.addEventListener('chayns_api_data', listener);
13
+ return () => {
14
+ document.removeEventListener('chayns_api_data', listener);
15
+ };
16
+ }
17
+ getSSRData() {
18
+ return this.initialData;
19
+ }
20
+ getInitialData() {
21
+ return this.values;
22
+ }
23
+ }
@@ -1 +1 @@
1
- export declare function alert(title?: string, message?: string): Promise<any> | "unsupported";
1
+ export declare function alert(title?: string, message?: string): Promise<any> | "unsupported";
@@ -1,24 +1,24 @@
1
- export declare const buttonText: {
2
- YES: string;
3
- NO: string;
4
- OK: string;
5
- CANCEL: string;
6
- };
7
- export declare const buttonType: {
8
- CANCEL: number;
9
- NEGATIVE: number;
10
- POSITIVE: number;
11
- };
12
- export declare const dialogAction: {
13
- ALERT_CONFIRM: number;
14
- INPUT: number;
15
- SELECT: number;
16
- DATE: number;
17
- ADVANCED_DATE: number;
18
- DROP_UP_ALERT: number;
19
- MEDIA_SELECT: number;
20
- FILE_SELECT: number;
21
- SIGNATURE: number;
22
- IFRAME: number;
23
- };
24
- export declare function chaynsDialog(config: any): Promise<any> | "unsupported";
1
+ export declare const buttonText: {
2
+ YES: string;
3
+ NO: string;
4
+ OK: string;
5
+ CANCEL: string;
6
+ };
7
+ export declare const buttonType: {
8
+ CANCEL: number;
9
+ NEGATIVE: number;
10
+ POSITIVE: number;
11
+ };
12
+ export declare const dialogAction: {
13
+ ALERT_CONFIRM: number;
14
+ INPUT: number;
15
+ SELECT: number;
16
+ DATE: number;
17
+ ADVANCED_DATE: number;
18
+ DROP_UP_ALERT: number;
19
+ MEDIA_SELECT: number;
20
+ FILE_SELECT: number;
21
+ SIGNATURE: number;
22
+ IFRAME: number;
23
+ };
24
+ export declare function chaynsDialog(config: any): Promise<any> | "unsupported";
@@ -1 +1 @@
1
- export declare function close(): Promise<any>;
1
+ export declare function close(): Promise<any>;
@@ -1,3 +1,3 @@
1
- export declare function sendData(data: any, isApiEvent: any): Promise<any>;
2
- export declare function addDialogDataListener(callback: any, getApiEvents?: boolean): boolean;
3
- export declare function removeDialogDataListener(callback: any, getApiEvents?: boolean): boolean;
1
+ export declare function sendData(data: any, isApiEvent: any): Promise<any>;
2
+ export declare function addDialogDataListener(callback: any, getApiEvents?: boolean): boolean;
3
+ export declare function removeDialogDataListener(callback: any, getApiEvents?: boolean): boolean;
@@ -1,13 +1,13 @@
1
- import { DialogButton } from "../../types/dialog";
2
- declare type Confirm = {
3
- headline?: string;
4
- text?: string;
5
- buttons?: DialogButton[] | {
6
- buttons?: DialogButton[];
7
- links?: DialogButton[];
8
- };
9
- links?: unknown;
10
- select?: unknown;
11
- };
12
- export declare function confirm(title?: string, message?: string, config?: Confirm): Promise<any> | "unsupported";
13
- export {};
1
+ import { DialogButton } from "../../types/dialog";
2
+ type Confirm = {
3
+ headline?: string;
4
+ text?: string;
5
+ buttons?: DialogButton[] | {
6
+ buttons?: DialogButton[];
7
+ links?: DialogButton[];
8
+ };
9
+ links?: unknown;
10
+ select?: unknown;
11
+ };
12
+ export declare function confirm(title?: string, message?: string, config?: Confirm): Promise<any> | "unsupported";
13
+ export {};