chayns-api 1.0.1 → 1.0.2

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 (211) hide show
  1. package/dist/cjs/calls/dialogs/alert.js +0 -2
  2. package/dist/cjs/calls/dialogs/chaynsDialog.js +2 -8
  3. package/dist/cjs/calls/dialogs/close.js +0 -2
  4. package/dist/cjs/calls/dialogs/communication.js +1 -16
  5. package/dist/cjs/calls/dialogs/confirm.js +0 -4
  6. package/dist/cjs/calls/dialogs/date.js +36 -53
  7. package/dist/cjs/calls/dialogs/dropUpAlert.js +0 -3
  8. package/dist/cjs/calls/dialogs/fileSelect.js +0 -10
  9. package/dist/cjs/calls/dialogs/iFrame.js +0 -8
  10. package/dist/cjs/calls/dialogs/index.js +0 -27
  11. package/dist/cjs/calls/dialogs/input.js +0 -6
  12. package/dist/cjs/calls/dialogs/mediaSelect.js +0 -7
  13. package/dist/cjs/calls/dialogs/open.js +0 -2
  14. package/dist/cjs/calls/dialogs/select.js +0 -9
  15. package/dist/cjs/calls/dialogs/signature.js +0 -5
  16. package/dist/cjs/calls/dialogs/toast.js +0 -3
  17. package/dist/cjs/calls/dialogs/utils/callback.js +0 -2
  18. package/dist/cjs/calls/dialogs/utils/environment.js +10 -0
  19. package/dist/cjs/calls/dialogs/utils/is.js +0 -4
  20. package/dist/cjs/calls/getUserInfo.js +0 -11
  21. package/dist/cjs/calls/index.js +3 -155
  22. package/dist/cjs/calls/sendMessage.js +0 -26
  23. package/dist/cjs/calls/visibilityChangeListener.js +1 -12
  24. package/dist/cjs/components/ChaynsContext.js +2 -4
  25. package/dist/cjs/components/ChaynsProvider.js +6 -28
  26. package/dist/cjs/components/WaitUntil.js +0 -5
  27. package/dist/cjs/components/withCompatMode.js +1 -16
  28. package/dist/cjs/helper/apiListenerHelper.js +0 -9
  29. package/dist/cjs/hooks/geoLocationListener.js +2 -11
  30. package/dist/cjs/hooks/index.js +6 -16
  31. package/dist/cjs/hooks/scrollListener.js +4 -23
  32. package/dist/cjs/hooks/useAccessToken.js +0 -5
  33. package/dist/cjs/hooks/useCurrentPage.js +0 -4
  34. package/dist/cjs/hooks/useCustomData.js +0 -4
  35. package/dist/cjs/hooks/useDevice.js +0 -4
  36. package/dist/cjs/hooks/useEnvironment.js +0 -4
  37. package/dist/cjs/hooks/useFunctions.js +0 -4
  38. package/dist/cjs/hooks/useIsAdminMode.js +0 -5
  39. package/dist/cjs/hooks/useLanguage.js +0 -4
  40. package/dist/cjs/hooks/usePages.js +22 -14
  41. package/dist/cjs/hooks/useParameters.js +0 -4
  42. package/dist/cjs/hooks/useSite.js +0 -4
  43. package/dist/cjs/hooks/useUser.js +0 -5
  44. package/dist/cjs/hooks/useValues.js +0 -4
  45. package/dist/cjs/hooks/windowMetricsListener.js +2 -12
  46. package/dist/cjs/host/ChaynsHost.js +0 -10
  47. package/dist/cjs/host/iframe/HostIframe.js +23 -30
  48. package/dist/cjs/host/iframe/utils/useUpdateData.js +0 -3
  49. package/dist/cjs/host/module/ModuleHost.js +3 -13
  50. package/dist/cjs/host/{HostIframe.js → module/PagemakerFrame.js} +23 -75
  51. package/dist/cjs/host/module/utils/loadComponent.js +1 -18
  52. package/dist/cjs/host/module/utils/useDynamicScript.js +0 -18
  53. package/dist/cjs/index.js +0 -19
  54. package/dist/cjs/types/IChaynsReact.js +27 -48
  55. package/dist/cjs/util/appCall.js +1 -4
  56. package/dist/cjs/util/deviceHelper.js +4 -21
  57. package/dist/cjs/util/heightHelper.js +0 -9
  58. package/dist/cjs/util/postIframeForm.js +0 -5
  59. package/dist/cjs/wrapper/AppWrapper.js +318 -159
  60. package/dist/cjs/wrapper/FrameWrapper.js +215 -248
  61. package/dist/cjs/wrapper/ModuleFederationWrapper.js +2 -27
  62. package/dist/cjs/wrapper/SsrWrapper.js +0 -8
  63. package/dist/esm/calls/dialogs/alert.js +4 -4
  64. package/dist/esm/calls/dialogs/chaynsDialog.js +7 -11
  65. package/dist/esm/calls/dialogs/communication.js +15 -26
  66. package/dist/esm/calls/dialogs/confirm.js +5 -8
  67. package/dist/esm/calls/dialogs/date.js +85 -94
  68. package/dist/esm/calls/dialogs/dropUpAlert.js +1 -1
  69. package/dist/esm/calls/dialogs/fileSelect.js +23 -62
  70. package/dist/esm/calls/dialogs/iFrame.js +7 -10
  71. package/dist/esm/calls/dialogs/input.js +2 -5
  72. package/dist/esm/calls/dialogs/mediaSelect.js +18 -55
  73. package/dist/esm/calls/dialogs/open.js +2 -2
  74. package/dist/esm/calls/dialogs/select.js +5 -9
  75. package/dist/esm/calls/dialogs/signature.js +0 -2
  76. package/dist/esm/calls/dialogs/toast.js +6 -11
  77. package/dist/esm/calls/dialogs/utils/callback.js +3 -5
  78. package/dist/esm/calls/dialogs/utils/environment.js +3 -0
  79. package/dist/esm/calls/dialogs/utils/is.js +1 -3
  80. package/dist/esm/calls/getUserInfo.js +32 -92
  81. package/dist/esm/calls/index.js +124 -276
  82. package/dist/esm/calls/sendMessage.js +91 -221
  83. package/dist/esm/calls/visibilityChangeListener.js +10 -15
  84. package/dist/esm/components/ChaynsContext.js +3 -3
  85. package/dist/esm/components/ChaynsProvider.js +45 -86
  86. package/dist/esm/components/WaitUntil.js +21 -86
  87. package/dist/esm/components/withCompatMode.js +35 -77
  88. package/dist/esm/helper/apiListenerHelper.js +10 -15
  89. package/dist/esm/hooks/geoLocationListener.js +20 -46
  90. package/dist/esm/hooks/index.js +1 -1
  91. package/dist/esm/hooks/scrollListener.js +50 -86
  92. package/dist/esm/hooks/useAccessToken.js +6 -28
  93. package/dist/esm/hooks/useCurrentPage.js +2 -6
  94. package/dist/esm/hooks/useCustomData.js +2 -6
  95. package/dist/esm/hooks/useDevice.js +1 -6
  96. package/dist/esm/hooks/useEnvironment.js +1 -6
  97. package/dist/esm/hooks/useFunctions.js +2 -5
  98. package/dist/esm/hooks/useIsAdminMode.js +2 -6
  99. package/dist/esm/hooks/useLanguage.js +1 -6
  100. package/dist/esm/hooks/usePages.js +34 -27
  101. package/dist/esm/hooks/useParameters.js +1 -6
  102. package/dist/esm/hooks/useSite.js +1 -6
  103. package/dist/esm/hooks/useUser.js +1 -7
  104. package/dist/esm/hooks/useValues.js +2 -5
  105. package/dist/esm/hooks/windowMetricsListener.js +18 -44
  106. package/dist/esm/host/ChaynsHost.js +22 -29
  107. package/dist/esm/host/iframe/HostIframe.js +86 -142
  108. package/dist/esm/host/iframe/utils/useUpdateData.js +4 -6
  109. package/dist/esm/host/module/ModuleHost.js +42 -49
  110. package/dist/esm/host/module/PagemakerFrame.js +97 -0
  111. package/dist/esm/host/module/utils/loadComponent.js +47 -85
  112. package/dist/esm/host/module/utils/useDynamicScript.js +27 -74
  113. package/dist/esm/types/IChaynsReact.js +37 -61
  114. package/dist/esm/util/appCall.js +2 -4
  115. package/dist/esm/util/deviceHelper.js +12 -36
  116. package/dist/esm/util/heightHelper.js +10 -13
  117. package/dist/esm/util/postIframeForm.js +25 -57
  118. package/dist/esm/wrapper/AppWrapper.js +380 -781
  119. package/dist/esm/wrapper/FrameWrapper.js +258 -1509
  120. package/dist/esm/wrapper/ModuleFederationWrapper.js +47 -284
  121. package/dist/esm/wrapper/SsrWrapper.js +19 -65
  122. package/dist/types/calls/dialogs/confirm.d.ts +1 -1
  123. package/dist/types/calls/dialogs/date.d.ts +4 -4
  124. package/dist/types/calls/dialogs/dropUpAlert.d.ts +1 -1
  125. package/dist/types/calls/dialogs/fileSelect.d.ts +1 -1
  126. package/dist/types/calls/dialogs/iFrame.d.ts +1 -1
  127. package/dist/types/calls/dialogs/input.d.ts +1 -1
  128. package/dist/types/calls/dialogs/mediaSelect.d.ts +1 -1
  129. package/dist/types/calls/dialogs/signature.d.ts +1 -1
  130. package/dist/types/calls/dialogs/utils/environment.d.ts +3 -0
  131. package/dist/types/calls/index.d.ts +0 -6
  132. package/dist/types/components/ChaynsProvider.d.ts +1 -1
  133. package/dist/types/components/WaitUntil.d.ts +1 -1
  134. package/dist/types/components/withCompatMode.d.ts +1 -1
  135. package/dist/types/hooks/index.d.ts +1 -1
  136. package/dist/types/hooks/useAccessToken.d.ts +1 -1
  137. package/dist/types/hooks/usePages.d.ts +4 -0
  138. package/dist/types/host/ChaynsHost.d.ts +1 -1
  139. package/dist/types/host/iframe/HostIframe.d.ts +1 -1
  140. package/dist/types/host/module/ModuleHost.d.ts +2 -2
  141. package/dist/types/host/{HostIframe.d.ts → module/PagemakerFrame.d.ts} +7 -5
  142. package/dist/types/types/IChaynsReact.d.ts +55 -24
  143. package/dist/types/util/deviceHelper.d.ts +2 -2
  144. package/dist/types/wrapper/AppWrapper.d.ts +6 -4
  145. package/package.json +1 -1
  146. package/dist/cjs/bootstrap.js +0 -11
  147. package/dist/cjs/calls/abstractApiListener.js +0 -40
  148. package/dist/cjs/calls/apiEventListener.js +0 -40
  149. package/dist/cjs/calls/setVisibilityChangeListener.js +0 -1
  150. package/dist/cjs/calls/windowMetricsListener.js +0 -18
  151. package/dist/cjs/components/App.js +0 -32
  152. package/dist/cjs/components/App.spec.js +0 -16
  153. package/dist/cjs/components/Button.js +0 -32
  154. package/dist/cjs/components/ChaynsProviderExposed.js +0 -16
  155. package/dist/cjs/components/TestProvider.js +0 -236
  156. package/dist/cjs/components/Title.js +0 -162
  157. package/dist/cjs/functions/addApiListener.js +0 -37
  158. package/dist/cjs/functions/addGeoLocationListener.js +0 -26
  159. package/dist/cjs/functions/addScrollListener.js +0 -26
  160. package/dist/cjs/functions/addWindowMetricsListener.js +0 -37
  161. package/dist/cjs/helper/cssLoader.js +0 -28
  162. package/dist/cjs/hooks/addGeoLocationListener.js +0 -26
  163. package/dist/cjs/hooks/addScrollListener.js +0 -26
  164. package/dist/cjs/hooks/addWindowMetricsListener.js +0 -37
  165. package/dist/cjs/hooks/geoLocation.js +0 -48
  166. package/dist/cjs/hooks/useAddGeoLocationListener.js +0 -26
  167. package/dist/cjs/hooks/useAddScrollListener.js +0 -48
  168. package/dist/cjs/hooks/useAddWindowMetricsListener.js +0 -45
  169. package/dist/cjs/hooks/useAdddScrollListener.js +0 -26
  170. package/dist/cjs/hooks/windowMetrics.js +0 -45
  171. package/dist/cjs/host/ModuleHost.js +0 -11
  172. package/dist/cjs/host/module/utils.js +0 -25
  173. package/dist/cjs/index.example.js +0 -7
  174. package/dist/cjs/index2.js +0 -64
  175. package/dist/cjs/types/DynamicImport.d.js +0 -5
  176. package/dist/cjs/types/chayns-components.d.js +0 -1
  177. package/dist/cjs/types/chayns-logger.d.js +0 -1
  178. package/dist/cjs/types/chayns.d.js +0 -1
  179. package/dist/cjs/types/tobit-websocket-service-client.d.js +0 -1
  180. package/dist/cjs/types/toolkit-types.d.js +0 -1
  181. package/dist/cjs/util/useFunctionsContext.js +0 -16
  182. package/dist/cjs/util/useIsAdminMode.js +0 -18
  183. package/dist/cjs/util/useUser.js +0 -16
  184. package/dist/esm/bootstrap.js +0 -4
  185. package/dist/esm/components/App.js +0 -35
  186. package/dist/esm/components/App.spec.js +0 -9
  187. package/dist/esm/components/Button.js +0 -34
  188. package/dist/esm/components/ChaynsProviderExposed.js +0 -3
  189. package/dist/esm/components/TestProvider.js +0 -308
  190. package/dist/esm/components/Title.js +0 -210
  191. package/dist/esm/helper/cssLoader.js +0 -21
  192. package/dist/esm/hooks/useAddGeoLocationListener.js +0 -18
  193. package/dist/esm/hooks/useAddScrollListener.js +0 -18
  194. package/dist/esm/hooks/useAddWindowMetricsListener.js +0 -18
  195. package/dist/esm/host/HostIframe.js +0 -153
  196. package/dist/esm/index.example.js +0 -1
  197. package/dist/esm/index2.js +0 -5
  198. package/dist/esm/types/DynamicImport.d.js +0 -1
  199. package/dist/esm/types/chayns-components.d.js +0 -0
  200. package/dist/esm/types/chayns-logger.d.js +0 -0
  201. package/dist/esm/types/chayns.d.js +0 -0
  202. package/dist/esm/types/tobit-websocket-service-client.d.js +0 -0
  203. package/dist/esm/types/toolkit-types.d.js +0 -0
  204. package/dist/esm/util/useIsAdminMode.js +0 -9
  205. package/dist/esm/util/useUser.js +0 -7
  206. package/dist/types/bootstrap.d.ts +0 -1
  207. package/dist/types/components/App.d.ts +0 -5
  208. package/dist/types/components/Button.d.ts +0 -8
  209. package/dist/types/components/ChaynsProviderExposed.d.ts +0 -13
  210. package/dist/types/components/Title.d.ts +0 -3
  211. 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,5 +1,5 @@
1
1
  import { DialogButton } from "../../types/dialog";
2
- declare type Confirm = {
2
+ type Confirm = {
3
3
  headline?: string;
4
4
  text?: string;
5
5
  buttons?: DialogButton[] | {
@@ -25,7 +25,7 @@ import { DialogButton, DialogTextBlock, IntervalItem, WeekDayIntervalObject } fr
25
25
  * console.log(data);
26
26
  * });
27
27
  */
28
- declare type DateConfig = {
28
+ type DateConfig = {
29
29
  title?: string;
30
30
  message?: string;
31
31
  buttons?: DialogButton[];
@@ -48,12 +48,12 @@ declare type DateConfig = {
48
48
  autoSelectDate?: boolean;
49
49
  };
50
50
  export declare function date(config?: DateConfig): Promise<any>;
51
- declare type preSelectObj = {
51
+ type preSelectObj = {
52
52
  start?: number | undefined | Date;
53
53
  end?: number | undefined | Date;
54
54
  };
55
- declare type preSelect = preSelectObj | Date | undefined | number | number[];
56
- declare type AdvancedDateConfig = {
55
+ type preSelect = preSelectObj | Date | undefined | number | number[];
56
+ type AdvancedDateConfig = {
57
57
  title?: string;
58
58
  message?: string;
59
59
  buttons?: DialogButton[];
@@ -1,4 +1,4 @@
1
- declare type DropUpAlert = {
1
+ type DropUpAlert = {
2
2
  callType?: number;
3
3
  };
4
4
  export declare function dropUpAlert(dialog?: DropUpAlert): Promise<unknown>;
@@ -5,7 +5,7 @@ export declare const fileType: {
5
5
  AUDIO: string;
6
6
  DOCUMENT: string[];
7
7
  };
8
- declare type FileSelectInput = {
8
+ type FileSelectInput = {
9
9
  buttons?: DialogButton[];
10
10
  callType?: number;
11
11
  multiselect?: boolean;
@@ -1,5 +1,5 @@
1
1
  import { DialogButton } from "../../types/dialog";
2
- declare type iFrameDialog = {
2
+ type iFrameDialog = {
3
3
  buttons?: DialogButton[];
4
4
  callType?: number;
5
5
  tappIframeName?: string;
@@ -1,5 +1,5 @@
1
1
  import { DialogButton } from "../../types/dialog";
2
- declare type InputDialog = {
2
+ type InputDialog = {
3
3
  buttons?: DialogButton[];
4
4
  callType?: number;
5
5
  formatter?: string;
@@ -1,5 +1,5 @@
1
1
  import { DialogButton } from "../../types/dialog";
2
- declare type MediaSelectInput = {
2
+ type MediaSelectInput = {
3
3
  buttons?: DialogButton[];
4
4
  callType?: number;
5
5
  chaynsToken?: string;
@@ -1,5 +1,5 @@
1
1
  import { DialogButton } from "../../types/dialog";
2
- declare type SignatureInput = {
2
+ type SignatureInput = {
3
3
  buttons?: DialogButton[];
4
4
  callType?: number;
5
5
  };
@@ -0,0 +1,3 @@
1
+ export declare let environment: {
2
+ language: string;
3
+ };
@@ -193,9 +193,6 @@ export declare const getDevice: () => ChaynsApiDevice;
193
193
  export declare const getLanguage: () => {
194
194
  site: import("../types/IChaynsReact").Language;
195
195
  translation: import("../types/IChaynsReact").Language | null;
196
- /**
197
- * This method returns a list of installed share/social media apps.
198
- */
199
196
  device: import("../types/IChaynsReact").Language;
200
197
  active: import("../types/IChaynsReact").Language;
201
198
  };
@@ -214,9 +211,6 @@ export declare const device: ChaynsApiDevice;
214
211
  export declare const language: {
215
212
  site: import("../types/IChaynsReact").Language;
216
213
  translation: import("../types/IChaynsReact").Language | null;
217
- /**
218
- * This method returns a list of installed share/social media apps.
219
- */
220
214
  device: import("../types/IChaynsReact").Language;
221
215
  active: import("../types/IChaynsReact").Language;
222
216
  };
@@ -3,7 +3,7 @@ import { ChaynsReactFunctions, ChaynsReactValues, IChaynsReact } from '../types/
3
3
  export declare const moduleWrapper: {
4
4
  current: IChaynsReact;
5
5
  };
6
- declare type ChaynsProviderProps = {
6
+ type ChaynsProviderProps = {
7
7
  data?: ChaynsReactValues;
8
8
  functions?: ChaynsReactFunctions;
9
9
  renderedByServer?: boolean;
@@ -1,5 +1,5 @@
1
1
  import { FC, ReactNode } from "react";
2
- declare type TaskList = (TaskList | Promise<unknown> | (() => Promise<unknown>))[];
2
+ type TaskList = (TaskList | Promise<unknown> | (() => Promise<unknown>))[];
3
3
  export declare const WaitUntil: FC<{
4
4
  tasks: TaskList;
5
5
  loadingComponent?: ReactNode;
@@ -1,5 +1,5 @@
1
1
  import React, { RefObject } from 'react';
2
- declare type Props = {
2
+ type Props = {
3
3
  innerRef?: RefObject<unknown>;
4
4
  } & object;
5
5
  export declare const withCompatMode: <P extends Props>(Component: React.ComponentType<P>) => {
@@ -7,7 +7,7 @@ export { useWindowMetrics, useWindowMetricsListener } from './windowMetricsListe
7
7
  export { useDevice } from './useDevice';
8
8
  export { useSite } from './useSite';
9
9
  export { useParameters } from './useParameters';
10
- export { usePages, usePage } from './usePages';
10
+ export { usePages, usePage, getPage } from './usePages';
11
11
  export { useEnvironment } from './useEnvironment';
12
12
  export { useLanguage } from './useLanguage';
13
13
  export { useValues } from './useValues';
@@ -2,4 +2,4 @@ import { AccessToken } from "../types/IChaynsReact";
2
2
  /**
3
3
  * @category Hooks
4
4
  */
5
- export declare const useAccessToken: (accessToken?: AccessToken | undefined) => string | undefined;
5
+ export declare const useAccessToken: (accessToken?: AccessToken) => string | undefined;
@@ -12,3 +12,7 @@ export declare const usePage: ({ id, siteId }: {
12
12
  id: any;
13
13
  siteId: any;
14
14
  }) => Page | null;
15
+ export declare const getPage: ({ id, siteId }?: {
16
+ id: null;
17
+ siteId: null;
18
+ }) => Page | null;
@@ -1,7 +1,7 @@
1
1
  import React, { FC } from 'react';
2
2
  import { TypeSystem } from './module/ModuleHost';
3
3
  import { ChaynsApiDevice, ChaynsApiSite, ChaynsApiUser, ChaynsReactFunctions, ChaynsReactValues, Page } from '../types/IChaynsReact';
4
- declare type ChaynsHostType = {
4
+ type ChaynsHostType = {
5
5
  type: string;
6
6
  iFrameProps: {
7
7
  [key: string]: unknown;
@@ -1,6 +1,6 @@
1
1
  import React, { FC } from 'react';
2
2
  import { ChaynsApiDevice, ChaynsApiSite, ChaynsApiUser, ChaynsReactFunctions, ChaynsReactValues, Page } from '../../types/IChaynsReact';
3
- declare type HostIframeProps = {
3
+ type HostIframeProps = {
4
4
  iFrameProps: {
5
5
  [key: string]: unknown;
6
6
  name: string;
@@ -1,11 +1,11 @@
1
1
  import { FC } from 'react';
2
2
  import { ChaynsApiDevice, ChaynsApiSite, ChaynsApiUser, ChaynsReactFunctions, ChaynsReactValues, Page } from '../../types/IChaynsReact';
3
- export declare type TypeSystem = {
3
+ export type TypeSystem = {
4
4
  scope: string;
5
5
  url: string;
6
6
  module: string;
7
7
  };
8
- declare type ModulePropTypes = {
8
+ type ModulePropTypes = {
9
9
  system: TypeSystem;
10
10
  functions: ChaynsReactFunctions;
11
11
  pages: Page[];
@@ -1,11 +1,10 @@
1
1
  import React, { FC } from 'react';
2
- import { ChaynsApiDevice, ChaynsApiSite, ChaynsApiUser, ChaynsReactFunctions, ChaynsReactValues, Page } from '../types/IChaynsReact';
3
- declare type HostIframeProps = {
2
+ import { ChaynsApiDevice, ChaynsApiSite, ChaynsApiUser, ChaynsReactFunctions, ChaynsReactValues, Page } from '../../types/IChaynsReact';
3
+ declare type PagemakerFrameProps = {
4
4
  iFrameProps: {
5
5
  [key: string]: unknown;
6
6
  name: string;
7
7
  };
8
- src: string;
9
8
  postForm?: boolean;
10
9
  iFrameRef: React.MutableRefObject<HTMLIFrameElement | null> | undefined;
11
10
  pages: Page[];
@@ -15,6 +14,9 @@ declare type HostIframeProps = {
15
14
  currentPage: ChaynsReactValues["currentPage"];
16
15
  functions: ChaynsReactFunctions;
17
16
  device: ChaynsApiDevice;
17
+ language: ChaynsReactValues["language"];
18
+ parameters: ChaynsReactValues["parameters"];
19
+ environment: ChaynsReactValues["environment"];
18
20
  };
19
- declare const HostIframe: FC<HostIframeProps>;
20
- export default HostIframe;
21
+ declare const PagemakerFrame: FC<PagemakerFrameProps>;
22
+ export default PagemakerFrame;