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,1530 +1,283 @@
1
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
2
-
3
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4
-
5
- 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); } }
6
-
7
- 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); }); }; }
8
-
9
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
10
-
11
- 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); } }
12
-
13
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
14
-
15
1
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
-
17
2
  /* eslint-disable @typescript-eslint/no-non-null-assertion */
18
3
  import * as comlink from 'comlink';
19
- import { addVisibilityChangeListener as _addVisibilityChangeListener, removeVisibilityChangeListener as _removeVisibilityChangeListener } from '../calls/visibilityChangeListener';
4
+ import { addVisibilityChangeListener, removeVisibilityChangeListener } from '../calls/visibilityChangeListener';
20
5
  import { addApiListener, dispatchApiEvent, removeApiListener } from '../helper/apiListenerHelper';
21
- import _getUserInfo from '../calls/getUserInfo';
22
- import { sendMessageToGroup as _sendMessageToGroup, sendMessageToPage as _sendMessageToPage, sendMessageToUser as _sendMessageToUser } from '../calls/sendMessage';
6
+ import getUserInfo from '../calls/getUserInfo';
7
+ import { sendMessageToGroup, sendMessageToPage, sendMessageToUser } from '../calls/sendMessage';
23
8
  import { setTappHeight } from '../util/heightHelper';
24
- export var FrameWrapper = /*#__PURE__*/function () {
25
- function FrameWrapper() {
26
- var _this = this;
27
-
28
- _classCallCheck(this, FrameWrapper);
29
-
9
+ export class FrameWrapper {
10
+ constructor() {
30
11
  _defineProperty(this, "resolve", null);
31
-
32
12
  _defineProperty(this, "exposedFunctions", null);
33
-
34
13
  _defineProperty(this, "resizeListener", null);
35
-
36
- _defineProperty(this, "ready", new Promise(function (res) {
37
- _this.resolve = res;
14
+ _defineProperty(this, "ready", new Promise(res => {
15
+ this.resolve = res;
38
16
  }));
39
-
40
17
  _defineProperty(this, "values", null);
41
-
42
18
  _defineProperty(this, "functions", {
43
- addGeoLocationListener: function () {
44
- var _addGeoLocationListener = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(value, callback) {
45
- return regeneratorRuntime.wrap(function _callee$(_context) {
46
- while (1) {
47
- switch (_context.prev = _context.next) {
48
- case 0:
49
- if (_this.initialized) {
50
- _context.next = 3;
51
- break;
52
- }
53
-
54
- _context.next = 3;
55
- return _this.ready;
56
-
57
- case 3:
58
- return _context.abrupt("return", _this.exposedFunctions.addGeoLocationListener(value, callback && comlink.proxy(function (result) {
59
- return callback(result);
60
- })));
61
-
62
- case 4:
63
- case "end":
64
- return _context.stop();
65
- }
66
- }
67
- }, _callee);
68
- }));
69
-
70
- function addGeoLocationListener(_x, _x2) {
71
- return _addGeoLocationListener.apply(this, arguments);
72
- }
73
-
74
- return addGeoLocationListener;
75
- }(),
76
- addScrollListener: function () {
77
- var _addScrollListener = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(value, callback) {
78
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
79
- while (1) {
80
- switch (_context2.prev = _context2.next) {
81
- case 0:
82
- if (_this.initialized) {
83
- _context2.next = 3;
84
- break;
85
- }
86
-
87
- _context2.next = 3;
88
- return _this.ready;
89
-
90
- case 3:
91
- return _context2.abrupt("return", _this.exposedFunctions.addScrollListener(value, callback && comlink.proxy(function (result) {
92
- return callback(result);
93
- })));
94
-
95
- case 4:
96
- case "end":
97
- return _context2.stop();
98
- }
99
- }
100
- }, _callee2);
101
- }));
102
-
103
- function addScrollListener(_x3, _x4) {
104
- return _addScrollListener.apply(this, arguments);
105
- }
106
-
107
- return addScrollListener;
108
- }(),
109
- addVisibilityChangeListener: function () {
110
- var _addVisibilityChangeListener2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(callback) {
111
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
112
- while (1) {
113
- switch (_context3.prev = _context3.next) {
114
- case 0:
115
- return _context3.abrupt("return", _addVisibilityChangeListener(callback));
116
-
117
- case 1:
118
- case "end":
119
- return _context3.stop();
120
- }
121
- }
122
- }, _callee3);
123
- }));
124
-
125
- function addVisibilityChangeListener(_x5) {
126
- return _addVisibilityChangeListener2.apply(this, arguments);
127
- }
128
-
129
- return addVisibilityChangeListener;
130
- }(),
131
- addWindowMetricsListener: function () {
132
- var _addWindowMetricsListener = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(callback) {
133
- var _addApiListener, id, shouldInitialize;
134
-
135
- return regeneratorRuntime.wrap(function _callee5$(_context5) {
136
- while (1) {
137
- switch (_context5.prev = _context5.next) {
138
- case 0:
139
- if (_this.initialized) {
140
- _context5.next = 3;
141
- break;
142
- }
143
-
144
- _context5.next = 3;
145
- return _this.ready;
146
-
147
- case 3:
148
- _addApiListener = addApiListener('windowMetricsListener', callback), id = _addApiListener.id, shouldInitialize = _addApiListener.shouldInitialize;
149
-
150
- if (shouldInitialize) {
151
- void _this.exposedFunctions.addWindowMetricsListener(comlink.proxy(function (result) {
152
- dispatchApiEvent('windowMetricsListener', result);
153
- }));
154
- window.addEventListener('resize', _this.resizeListener = function () {
155
- void _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
156
- var metrics;
157
- return regeneratorRuntime.wrap(function _callee4$(_context4) {
158
- while (1) {
159
- switch (_context4.prev = _context4.next) {
160
- case 0:
161
- _context4.next = 2;
162
- return _this.exposedFunctions.getWindowMetrics();
163
-
164
- case 2:
165
- metrics = _context4.sent;
166
- dispatchApiEvent('windowMetricsListener', metrics);
167
-
168
- case 4:
169
- case "end":
170
- return _context4.stop();
171
- }
172
- }
173
- }, _callee4);
174
- }))();
175
- });
176
- }
177
-
178
- return _context5.abrupt("return", id);
179
-
180
- case 6:
181
- case "end":
182
- return _context5.stop();
183
- }
184
- }
185
- }, _callee5);
186
- }));
187
-
188
- function addWindowMetricsListener(_x6) {
189
- return _addWindowMetricsListener.apply(this, arguments);
190
- }
191
-
192
- return addWindowMetricsListener;
193
- }(),
194
- customCallbackFunction: function () {
195
- var _customCallbackFunction = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(type, data) {
196
- return regeneratorRuntime.wrap(function _callee6$(_context6) {
197
- while (1) {
198
- switch (_context6.prev = _context6.next) {
199
- case 0:
200
- if (_this.initialized) {
201
- _context6.next = 3;
202
- break;
203
- }
204
-
205
- _context6.next = 3;
206
- return _this.ready;
207
-
208
- case 3:
209
- return _context6.abrupt("return", _this.exposedFunctions.customCallbackFunction(type, data));
210
-
211
- case 4:
212
- case "end":
213
- return _context6.stop();
214
- }
215
- }
216
- }, _callee6);
217
- }));
218
-
219
- function customCallbackFunction(_x7, _x8) {
220
- return _customCallbackFunction.apply(this, arguments);
221
- }
222
-
223
- return customCallbackFunction;
224
- }(),
225
- getAvailableSharingServices: function () {
226
- var _getAvailableSharingServices = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() {
227
- return regeneratorRuntime.wrap(function _callee7$(_context7) {
228
- while (1) {
229
- switch (_context7.prev = _context7.next) {
230
- case 0:
231
- if (_this.initialized) {
232
- _context7.next = 3;
233
- break;
234
- }
235
-
236
- _context7.next = 3;
237
- return _this.ready;
238
-
239
- case 3:
240
- return _context7.abrupt("return", _this.exposedFunctions.getAvailableSharingServices());
241
-
242
- case 4:
243
- case "end":
244
- return _context7.stop();
245
- }
246
- }
247
- }, _callee7);
248
- }));
249
-
250
- function getAvailableSharingServices() {
251
- return _getAvailableSharingServices.apply(this, arguments);
252
- }
253
-
254
- return getAvailableSharingServices;
255
- }(),
256
- getAccessToken: function () {
257
- var _getAccessToken = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8(accessToken) {
258
- return regeneratorRuntime.wrap(function _callee8$(_context8) {
259
- while (1) {
260
- switch (_context8.prev = _context8.next) {
261
- case 0:
262
- if (_this.initialized) {
263
- _context8.next = 3;
264
- break;
265
- }
266
-
267
- _context8.next = 3;
268
- return _this.ready;
269
-
270
- case 3:
271
- return _context8.abrupt("return", _this.exposedFunctions.getAccessToken(accessToken));
272
-
273
- case 4:
274
- case "end":
275
- return _context8.stop();
276
- }
277
- }
278
- }, _callee8);
279
- }));
280
-
281
- function getAccessToken(_x9) {
282
- return _getAccessToken.apply(this, arguments);
283
- }
284
-
285
- return getAccessToken;
286
- }(),
287
- getGeoLocation: function () {
288
- var _getGeoLocation = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(value) {
289
- return regeneratorRuntime.wrap(function _callee9$(_context9) {
290
- while (1) {
291
- switch (_context9.prev = _context9.next) {
292
- case 0:
293
- if (_this.initialized) {
294
- _context9.next = 3;
295
- break;
296
- }
297
-
298
- _context9.next = 3;
299
- return _this.ready;
300
-
301
- case 3:
302
- return _context9.abrupt("return", _this.exposedFunctions.getGeoLocation(value));
303
-
304
- case 4:
305
- case "end":
306
- return _context9.stop();
307
- }
308
- }
309
- }, _callee9);
310
- }));
311
-
312
- function getGeoLocation(_x10) {
313
- return _getGeoLocation.apply(this, arguments);
314
- }
315
-
316
- return getGeoLocation;
317
- }(),
318
- getUserInfo: function () {
319
- var _getUserInfo2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10(query) {
320
- return regeneratorRuntime.wrap(function _callee10$(_context10) {
321
- while (1) {
322
- switch (_context10.prev = _context10.next) {
323
- case 0:
324
- if (_this.initialized) {
325
- _context10.next = 3;
326
- break;
327
- }
328
-
329
- _context10.next = 3;
330
- return _this.ready;
331
-
332
- case 3:
333
- return _context10.abrupt("return", _getUserInfo(_this, query));
334
-
335
- case 4:
336
- case "end":
337
- return _context10.stop();
338
- }
339
- }
340
- }, _callee10);
341
- }));
342
-
343
- function getUserInfo(_x11) {
344
- return _getUserInfo2.apply(this, arguments);
345
- }
346
-
347
- return getUserInfo;
348
- }(),
349
- getScrollPosition: function () {
350
- var _getScrollPosition = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee11() {
351
- return regeneratorRuntime.wrap(function _callee11$(_context11) {
352
- while (1) {
353
- switch (_context11.prev = _context11.next) {
354
- case 0:
355
- if (_this.initialized) {
356
- _context11.next = 3;
357
- break;
358
- }
359
-
360
- _context11.next = 3;
361
- return _this.ready;
362
-
363
- case 3:
364
- return _context11.abrupt("return", _this.exposedFunctions.getScrollPosition());
365
-
366
- case 4:
367
- case "end":
368
- return _context11.stop();
369
- }
370
- }
371
- }, _callee11);
372
- }));
373
-
374
- function getScrollPosition() {
375
- return _getScrollPosition.apply(this, arguments);
376
- }
377
-
378
- return getScrollPosition;
379
- }(),
380
- getWindowMetrics: function () {
381
- var _getWindowMetrics = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee12() {
382
- return regeneratorRuntime.wrap(function _callee12$(_context12) {
383
- while (1) {
384
- switch (_context12.prev = _context12.next) {
385
- case 0:
386
- if (_this.initialized) {
387
- _context12.next = 3;
388
- break;
389
- }
390
-
391
- _context12.next = 3;
392
- return _this.ready;
393
-
394
- case 3:
395
- return _context12.abrupt("return", _this.exposedFunctions.getWindowMetrics());
396
-
397
- case 4:
398
- case "end":
399
- return _context12.stop();
400
- }
401
- }
402
- }, _callee12);
403
- }));
404
-
405
- function getWindowMetrics() {
406
- return _getWindowMetrics.apply(this, arguments);
407
- }
408
-
409
- return getWindowMetrics;
410
- }(),
411
- invokeCall: function () {
412
- var _invokeCall = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee13(value, callback) {
413
- return regeneratorRuntime.wrap(function _callee13$(_context13) {
414
- while (1) {
415
- switch (_context13.prev = _context13.next) {
416
- case 0:
417
- if (_this.initialized) {
418
- _context13.next = 3;
419
- break;
420
- }
421
-
422
- _context13.next = 3;
423
- return _this.ready;
424
-
425
- case 3:
426
- return _context13.abrupt("return", _this.exposedFunctions.invokeCall(value, callback && comlink.proxy(function (result) {
427
- return callback(result);
428
- })));
429
-
430
- case 4:
431
- case "end":
432
- return _context13.stop();
433
- }
434
- }
435
- }, _callee13);
436
- }));
437
-
438
- function invokeCall(_x12, _x13) {
439
- return _invokeCall.apply(this, arguments);
440
- }
441
-
442
- return invokeCall;
443
- }(),
444
- invokeDialogCall: function () {
445
- var _invokeDialogCall = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee14(value, callback) {
446
- return regeneratorRuntime.wrap(function _callee14$(_context14) {
447
- while (1) {
448
- switch (_context14.prev = _context14.next) {
449
- case 0:
450
- if (_this.initialized) {
451
- _context14.next = 3;
452
- break;
453
- }
454
-
455
- _context14.next = 3;
456
- return _this.ready;
457
-
458
- case 3:
459
- return _context14.abrupt("return", _this.exposedFunctions.invokeDialogCall(value, callback && comlink.proxy(function (result) {
460
- return callback(result);
461
- })));
462
-
463
- case 4:
464
- case "end":
465
- return _context14.stop();
466
- }
467
- }
468
- }, _callee14);
469
- }));
470
-
471
- function invokeDialogCall(_x14, _x15) {
472
- return _invokeDialogCall.apply(this, arguments);
473
- }
474
-
475
- return invokeDialogCall;
476
- }(),
477
- login: function () {
478
- var _login = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee15(value, callback, closeCallback) {
479
- return regeneratorRuntime.wrap(function _callee15$(_context15) {
480
- while (1) {
481
- switch (_context15.prev = _context15.next) {
482
- case 0:
483
- if (_this.initialized) {
484
- _context15.next = 3;
485
- break;
486
- }
487
-
488
- _context15.next = 3;
489
- return _this.ready;
490
-
491
- case 3:
492
- return _context15.abrupt("return", _this.exposedFunctions.login(value, callback && comlink.proxy(function (result) {
493
- return callback(result);
494
- }), closeCallback && comlink.proxy(function () {
495
- return closeCallback();
496
- })));
497
-
498
- case 4:
499
- case "end":
500
- return _context15.stop();
501
- }
502
- }
503
- }, _callee15);
504
- }));
505
-
506
- function login(_x16, _x17, _x18) {
507
- return _login.apply(this, arguments);
508
- }
509
-
510
- return login;
511
- }(),
512
- logout: function () {
513
- var _logout = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee16() {
514
- return regeneratorRuntime.wrap(function _callee16$(_context16) {
515
- while (1) {
516
- switch (_context16.prev = _context16.next) {
517
- case 0:
518
- if (_this.initialized) {
519
- _context16.next = 3;
520
- break;
521
- }
522
-
523
- _context16.next = 3;
524
- return _this.ready;
525
-
526
- case 3:
527
- return _context16.abrupt("return", _this.exposedFunctions.logout());
528
-
529
- case 4:
530
- case "end":
531
- return _context16.stop();
532
- }
533
- }
534
- }, _callee16);
535
- }));
536
-
537
- function logout() {
538
- return _logout.apply(this, arguments);
539
- }
540
-
541
- return logout;
542
- }(),
543
- navigateBack: function () {
544
- var _navigateBack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee17() {
545
- return regeneratorRuntime.wrap(function _callee17$(_context17) {
546
- while (1) {
547
- switch (_context17.prev = _context17.next) {
548
- case 0:
549
- if (_this.initialized) {
550
- _context17.next = 3;
551
- break;
552
- }
553
-
554
- _context17.next = 3;
555
- return _this.ready;
556
-
557
- case 3:
558
- return _context17.abrupt("return", _this.exposedFunctions.navigateBack());
559
-
560
- case 4:
561
- case "end":
562
- return _context17.stop();
563
- }
564
- }
565
- }, _callee17);
566
- }));
567
-
568
- function navigateBack() {
569
- return _navigateBack.apply(this, arguments);
570
- }
571
-
572
- return navigateBack;
573
- }(),
574
- openImage: function () {
575
- var _openImage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee18(value) {
576
- return regeneratorRuntime.wrap(function _callee18$(_context18) {
577
- while (1) {
578
- switch (_context18.prev = _context18.next) {
579
- case 0:
580
- if (_this.initialized) {
581
- _context18.next = 3;
582
- break;
583
- }
584
-
585
- _context18.next = 3;
586
- return _this.ready;
587
-
588
- case 3:
589
- return _context18.abrupt("return", _this.exposedFunctions.openImage(value));
590
-
591
- case 4:
592
- case "end":
593
- return _context18.stop();
594
- }
595
- }
596
- }, _callee18);
597
- }));
598
-
599
- function openImage(_x19) {
600
- return _openImage.apply(this, arguments);
601
- }
602
-
603
- return openImage;
604
- }(),
605
- openUrl: function () {
606
- var _openUrl = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(value) {
607
- return regeneratorRuntime.wrap(function _callee19$(_context19) {
608
- while (1) {
609
- switch (_context19.prev = _context19.next) {
610
- case 0:
611
- if (_this.initialized) {
612
- _context19.next = 3;
613
- break;
614
- }
615
-
616
- _context19.next = 3;
617
- return _this.ready;
618
-
619
- case 3:
620
- return _context19.abrupt("return", _this.exposedFunctions.openUrl(value));
621
-
622
- case 4:
623
- case "end":
624
- return _context19.stop();
625
- }
626
- }
627
- }, _callee19);
628
- }));
629
-
630
- function openUrl(_x20) {
631
- return _openUrl.apply(this, arguments);
632
- }
633
-
634
- return openUrl;
635
- }(),
636
- openVideo: function () {
637
- var _openVideo = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee20(value) {
638
- return regeneratorRuntime.wrap(function _callee20$(_context20) {
639
- while (1) {
640
- switch (_context20.prev = _context20.next) {
641
- case 0:
642
- if (_this.initialized) {
643
- _context20.next = 3;
644
- break;
645
- }
646
-
647
- _context20.next = 3;
648
- return _this.ready;
649
-
650
- case 3:
651
- return _context20.abrupt("return", _this.exposedFunctions.openVideo(value));
652
-
653
- case 4:
654
- case "end":
655
- return _context20.stop();
656
- }
657
- }
658
- }, _callee20);
659
- }));
660
-
661
- function openVideo(_x21) {
662
- return _openVideo.apply(this, arguments);
663
- }
664
-
665
- return openVideo;
666
- }(),
667
- refreshAccessToken: function () {
668
- var _refreshAccessToken = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee21() {
669
- return regeneratorRuntime.wrap(function _callee21$(_context21) {
670
- while (1) {
671
- switch (_context21.prev = _context21.next) {
672
- case 0:
673
- if (_this.initialized) {
674
- _context21.next = 3;
675
- break;
676
- }
677
-
678
- _context21.next = 3;
679
- return _this.ready;
680
-
681
- case 3:
682
- return _context21.abrupt("return", _this.exposedFunctions.refreshAccessToken());
683
-
684
- case 4:
685
- case "end":
686
- return _context21.stop();
687
- }
688
- }
689
- }, _callee21);
690
- }));
691
-
692
- function refreshAccessToken() {
693
- return _refreshAccessToken.apply(this, arguments);
694
- }
695
-
696
- return refreshAccessToken;
697
- }(),
698
- refreshData: function () {
699
- var _refreshData = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee22(value) {
700
- return regeneratorRuntime.wrap(function _callee22$(_context22) {
701
- while (1) {
702
- switch (_context22.prev = _context22.next) {
703
- case 0:
704
- if (_this.initialized) {
705
- _context22.next = 3;
706
- break;
707
- }
708
-
709
- _context22.next = 3;
710
- return _this.ready;
711
-
712
- case 3:
713
- return _context22.abrupt("return", _this.exposedFunctions.refreshData(value));
714
-
715
- case 4:
716
- case "end":
717
- return _context22.stop();
718
- }
719
- }
720
- }, _callee22);
721
- }));
722
-
723
- function refreshData(_x22) {
724
- return _refreshData.apply(this, arguments);
725
- }
726
-
727
- return refreshData;
728
- }(),
729
- removeGeoLocationListener: function () {
730
- var _removeGeoLocationListener = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee23(id) {
731
- return regeneratorRuntime.wrap(function _callee23$(_context23) {
732
- while (1) {
733
- switch (_context23.prev = _context23.next) {
734
- case 0:
735
- if (_this.initialized) {
736
- _context23.next = 3;
737
- break;
738
- }
739
-
740
- _context23.next = 3;
741
- return _this.ready;
742
-
743
- case 3:
744
- return _context23.abrupt("return", _this.exposedFunctions.removeGeoLocationListener(id));
745
-
746
- case 4:
747
- case "end":
748
- return _context23.stop();
749
- }
750
- }
751
- }, _callee23);
752
- }));
753
-
754
- function removeGeoLocationListener(_x23) {
755
- return _removeGeoLocationListener.apply(this, arguments);
756
- }
757
-
758
- return removeGeoLocationListener;
759
- }(),
760
- removeScrollListener: function () {
761
- var _removeScrollListener = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee24(id) {
762
- return regeneratorRuntime.wrap(function _callee24$(_context24) {
763
- while (1) {
764
- switch (_context24.prev = _context24.next) {
765
- case 0:
766
- if (_this.initialized) {
767
- _context24.next = 3;
768
- break;
769
- }
770
-
771
- _context24.next = 3;
772
- return _this.ready;
773
-
774
- case 3:
775
- return _context24.abrupt("return", _this.exposedFunctions.removeScrollListener(id));
776
-
777
- case 4:
778
- case "end":
779
- return _context24.stop();
780
- }
781
- }
782
- }, _callee24);
783
- }));
784
-
785
- function removeScrollListener(_x24) {
786
- return _removeScrollListener.apply(this, arguments);
787
- }
788
-
789
- return removeScrollListener;
790
- }(),
791
- removeVisibilityChangeListener: function removeVisibilityChangeListener(number) {
792
- _removeVisibilityChangeListener(number);
793
-
19
+ addGeoLocationListener: async (value, callback) => {
20
+ if (!this.initialized) await this.ready;
21
+ return this.exposedFunctions.addGeoLocationListener(value, callback && comlink.proxy(result => callback(result)));
22
+ },
23
+ addScrollListener: async (value, callback) => {
24
+ if (!this.initialized) await this.ready;
25
+ return this.exposedFunctions.addScrollListener(value, callback && comlink.proxy(result => callback(result)));
26
+ },
27
+ addVisibilityChangeListener: async callback => addVisibilityChangeListener(callback),
28
+ addWindowMetricsListener: async callback => {
29
+ if (!this.initialized) await this.ready;
30
+ const {
31
+ id,
32
+ shouldInitialize
33
+ } = addApiListener('windowMetricsListener', callback);
34
+ if (shouldInitialize) {
35
+ void this.exposedFunctions.addWindowMetricsListener(comlink.proxy(result => {
36
+ dispatchApiEvent('windowMetricsListener', result);
37
+ }));
38
+ window.addEventListener('resize', this.resizeListener = () => {
39
+ void (async () => {
40
+ const metrics = await this.exposedFunctions.getWindowMetrics();
41
+ dispatchApiEvent('windowMetricsListener', metrics);
42
+ })();
43
+ });
44
+ }
45
+ return id;
46
+ },
47
+ customCallbackFunction: async (type, data) => {
48
+ if (!this.initialized) await this.ready;
49
+ return this.exposedFunctions.customCallbackFunction(type, data);
50
+ },
51
+ getAvailableSharingServices: async () => {
52
+ if (!this.initialized) await this.ready;
53
+ return this.exposedFunctions.getAvailableSharingServices();
54
+ },
55
+ getAccessToken: async accessToken => {
56
+ if (!this.initialized) await this.ready;
57
+ return this.exposedFunctions.getAccessToken(accessToken);
58
+ },
59
+ getGeoLocation: async value => {
60
+ if (!this.initialized) await this.ready;
61
+ return this.exposedFunctions.getGeoLocation(value);
62
+ },
63
+ getUserInfo: async query => {
64
+ if (!this.initialized) await this.ready;
65
+ return getUserInfo(this, query);
66
+ },
67
+ getScrollPosition: async () => {
68
+ if (!this.initialized) await this.ready;
69
+ return this.exposedFunctions.getScrollPosition();
70
+ },
71
+ getWindowMetrics: async () => {
72
+ if (!this.initialized) await this.ready;
73
+ return this.exposedFunctions.getWindowMetrics();
74
+ },
75
+ invokeCall: async (value, callback) => {
76
+ if (!this.initialized) await this.ready;
77
+ return this.exposedFunctions.invokeCall(value, callback && comlink.proxy(result => callback(result)));
78
+ },
79
+ invokeDialogCall: async (value, callback) => {
80
+ if (!this.initialized) await this.ready;
81
+ return this.exposedFunctions.invokeDialogCall(value, callback && comlink.proxy(result => callback(result)));
82
+ },
83
+ login: async (value, callback, closeCallback) => {
84
+ if (!this.initialized) await this.ready;
85
+ return this.exposedFunctions.login(value, callback && comlink.proxy(result => callback(result)), closeCallback && comlink.proxy(() => closeCallback()));
86
+ },
87
+ logout: async () => {
88
+ if (!this.initialized) await this.ready;
89
+ return this.exposedFunctions.logout();
90
+ },
91
+ navigateBack: async () => {
92
+ if (!this.initialized) await this.ready;
93
+ return this.exposedFunctions.navigateBack();
94
+ },
95
+ openImage: async value => {
96
+ if (!this.initialized) await this.ready;
97
+ return this.exposedFunctions.openImage(value);
98
+ },
99
+ openUrl: async value => {
100
+ if (!this.initialized) await this.ready;
101
+ return this.exposedFunctions.openUrl(value);
102
+ },
103
+ openVideo: async value => {
104
+ if (!this.initialized) await this.ready;
105
+ return this.exposedFunctions.openVideo(value);
106
+ },
107
+ refreshAccessToken: async () => {
108
+ if (!this.initialized) await this.ready;
109
+ return this.exposedFunctions.refreshAccessToken();
110
+ },
111
+ refreshData: async value => {
112
+ if (!this.initialized) await this.ready;
113
+ return this.exposedFunctions.refreshData(value);
114
+ },
115
+ removeGeoLocationListener: async id => {
116
+ if (!this.initialized) await this.ready;
117
+ return this.exposedFunctions.removeGeoLocationListener(id);
118
+ },
119
+ removeScrollListener: async id => {
120
+ if (!this.initialized) await this.ready;
121
+ return this.exposedFunctions.removeScrollListener(id);
122
+ },
123
+ removeVisibilityChangeListener(number) {
124
+ removeVisibilityChangeListener(number);
794
125
  return Promise.resolve();
795
126
  },
796
- removeWindowMetricsListener: function () {
797
- var _removeWindowMetricsListener = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee25(id) {
798
- var shouldRemove;
799
- return regeneratorRuntime.wrap(function _callee25$(_context25) {
800
- while (1) {
801
- switch (_context25.prev = _context25.next) {
802
- case 0:
803
- if (_this.initialized) {
804
- _context25.next = 3;
805
- break;
806
- }
807
-
808
- _context25.next = 3;
809
- return _this.ready;
810
-
811
- case 3:
812
- shouldRemove = removeApiListener('windowMetricsListener', id);
813
-
814
- if (shouldRemove) {
815
- void _this.exposedFunctions.removeWindowMetricsListener(id);
816
- if (_this.resizeListener) window.removeEventListener('resize', _this.resizeListener);
817
- _this.resizeListener = null;
818
- }
819
-
820
- case 5:
821
- case "end":
822
- return _context25.stop();
823
- }
824
- }
825
- }, _callee25);
826
- }));
827
-
828
- function removeWindowMetricsListener(_x25) {
829
- return _removeWindowMetricsListener.apply(this, arguments);
127
+ removeWindowMetricsListener: async id => {
128
+ if (!this.initialized) await this.ready;
129
+ const shouldRemove = removeApiListener('windowMetricsListener', id);
130
+ if (shouldRemove) {
131
+ void this.exposedFunctions.removeWindowMetricsListener(id);
132
+ if (this.resizeListener) window.removeEventListener('resize', this.resizeListener);
133
+ this.resizeListener = null;
830
134
  }
831
-
832
- return removeWindowMetricsListener;
833
- }(),
834
- selectPage: function () {
835
- var _selectPage = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee26(options) {
836
- return regeneratorRuntime.wrap(function _callee26$(_context26) {
837
- while (1) {
838
- switch (_context26.prev = _context26.next) {
839
- case 0:
840
- if (_this.initialized) {
841
- _context26.next = 3;
842
- break;
843
- }
844
-
845
- _context26.next = 3;
846
- return _this.ready;
847
-
848
- case 3:
849
- _context26.next = 5;
850
- return _this.exposedFunctions.selectPage(options);
851
-
852
- case 5:
853
- case "end":
854
- return _context26.stop();
855
- }
856
- }
857
- }, _callee26);
858
- }));
859
-
860
- function selectPage(_x26) {
861
- return _selectPage.apply(this, arguments);
862
- }
863
-
864
- return selectPage;
865
- }(),
866
- scrollToY: function () {
867
- var _scrollToY = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee27(position, duration) {
868
- return regeneratorRuntime.wrap(function _callee27$(_context27) {
869
- while (1) {
870
- switch (_context27.prev = _context27.next) {
871
- case 0:
872
- if (_this.initialized) {
873
- _context27.next = 3;
874
- break;
875
- }
876
-
877
- _context27.next = 3;
878
- return _this.ready;
879
-
880
- case 3:
881
- _context27.next = 5;
882
- return _this.exposedFunctions.scrollToY(position, duration);
883
-
884
- case 5:
885
- case "end":
886
- return _context27.stop();
887
- }
888
- }
889
- }, _callee27);
890
- }));
891
-
892
- function scrollToY(_x27, _x28) {
893
- return _scrollToY.apply(this, arguments);
894
- }
895
-
896
- return scrollToY;
897
- }(),
898
- sendMessageToGroup: function () {
899
- var _sendMessageToGroup2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee28(groupId, message) {
900
- return regeneratorRuntime.wrap(function _callee28$(_context28) {
901
- while (1) {
902
- switch (_context28.prev = _context28.next) {
903
- case 0:
904
- if (_this.initialized) {
905
- _context28.next = 3;
906
- break;
907
- }
908
-
909
- _context28.next = 3;
910
- return _this.ready;
911
-
912
- case 3:
913
- return _context28.abrupt("return", _sendMessageToGroup(_this, message, groupId));
914
-
915
- case 4:
916
- case "end":
917
- return _context28.stop();
918
- }
919
- }
920
- }, _callee28);
921
- }));
922
-
923
- function sendMessageToGroup(_x29, _x30) {
924
- return _sendMessageToGroup2.apply(this, arguments);
925
- }
926
-
927
- return sendMessageToGroup;
928
- }(),
929
- sendMessageToPage: function () {
930
- var _sendMessageToPage2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee29(message) {
931
- return regeneratorRuntime.wrap(function _callee29$(_context29) {
932
- while (1) {
933
- switch (_context29.prev = _context29.next) {
934
- case 0:
935
- if (_this.initialized) {
936
- _context29.next = 3;
937
- break;
938
- }
939
-
940
- _context29.next = 3;
941
- return _this.ready;
942
-
943
- case 3:
944
- return _context29.abrupt("return", _sendMessageToPage(_this, message));
945
-
946
- case 4:
947
- case "end":
948
- return _context29.stop();
949
- }
950
- }
951
- }, _callee29);
952
- }));
953
-
954
- function sendMessageToPage(_x31) {
955
- return _sendMessageToPage2.apply(this, arguments);
956
- }
957
-
958
- return sendMessageToPage;
959
- }(),
960
- sendMessageToUser: function () {
961
- var _sendMessageToUser2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee30(userId, message) {
962
- return regeneratorRuntime.wrap(function _callee30$(_context30) {
963
- while (1) {
964
- switch (_context30.prev = _context30.next) {
965
- case 0:
966
- if (_this.initialized) {
967
- _context30.next = 3;
968
- break;
969
- }
970
-
971
- _context30.next = 3;
972
- return _this.ready;
973
-
974
- case 3:
975
- return _context30.abrupt("return", _sendMessageToUser(_this, message, userId));
976
-
977
- case 4:
978
- case "end":
979
- return _context30.stop();
980
- }
981
- }
982
- }, _callee30);
983
- }));
984
-
985
- function sendMessageToUser(_x32, _x33) {
986
- return _sendMessageToUser2.apply(this, arguments);
987
- }
988
-
989
- return sendMessageToUser;
990
- }(),
991
- setAdminMode: function () {
992
- var _setAdminMode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee31(enabled) {
993
- return regeneratorRuntime.wrap(function _callee31$(_context31) {
994
- while (1) {
995
- switch (_context31.prev = _context31.next) {
996
- case 0:
997
- if (_this.initialized) {
998
- _context31.next = 3;
999
- break;
1000
- }
1001
-
1002
- _context31.next = 3;
1003
- return _this.ready;
1004
-
1005
- case 3:
1006
- return _context31.abrupt("return", _this.exposedFunctions.setAdminMode(enabled));
1007
-
1008
- case 4:
1009
- case "end":
1010
- return _context31.stop();
1011
- }
1012
- }
1013
- }, _callee31);
1014
- }));
1015
-
1016
- function setAdminMode(_x34) {
1017
- return _setAdminMode.apply(this, arguments);
1018
- }
1019
-
1020
- return setAdminMode;
1021
- }(),
1022
- setDisplayTimeout: function () {
1023
- var _setDisplayTimeout = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee32(value) {
1024
- return regeneratorRuntime.wrap(function _callee32$(_context32) {
1025
- while (1) {
1026
- switch (_context32.prev = _context32.next) {
1027
- case 0:
1028
- if (_this.initialized) {
1029
- _context32.next = 3;
1030
- break;
1031
- }
1032
-
1033
- _context32.next = 3;
1034
- return _this.ready;
1035
-
1036
- case 3:
1037
- return _context32.abrupt("return", _this.exposedFunctions.setDisplayTimeout(value));
1038
-
1039
- case 4:
1040
- case "end":
1041
- return _context32.stop();
1042
- }
1043
- }
1044
- }, _callee32);
1045
- }));
1046
-
1047
- function setDisplayTimeout(_x35) {
1048
- return _setDisplayTimeout.apply(this, arguments);
1049
- }
1050
-
1051
- return setDisplayTimeout;
1052
- }(),
1053
- setFloatingButton: function () {
1054
- var _setFloatingButton = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee33(value, callback) {
1055
- var _value$items;
1056
-
1057
- var itemClickFunctions, cb;
1058
- return regeneratorRuntime.wrap(function _callee33$(_context33) {
1059
- while (1) {
1060
- switch (_context33.prev = _context33.next) {
1061
- case 0:
1062
- if (_this.initialized) {
1063
- _context33.next = 3;
1064
- break;
1065
- }
1066
-
1067
- _context33.next = 3;
1068
- return _this.ready;
1069
-
1070
- case 3:
1071
- value.items = (_value$items = value.items) !== null && _value$items !== void 0 ? _value$items : [];
1072
- itemClickFunctions = value.items.map(function (x) {
1073
- return x.onClick;
1074
- });
1075
- value.items = value.items.map(function (x) {
1076
- return _objectSpread(_objectSpread({}, x), {}, {
1077
- onClick: undefined
1078
- });
1079
- });
1080
- cb = callback && comlink.proxy(function (data) {
1081
- if (data !== null && data !== void 0 && data.item && itemClickFunctions[data.index]) {
1082
- itemClickFunctions[data.index]();
1083
- } else {
1084
- callback();
1085
- }
1086
- }); // @ts-ignore
1087
-
1088
- return _context33.abrupt("return", _this.exposedFunctions.setFloatingButton(value, cb));
1089
-
1090
- case 8:
1091
- case "end":
1092
- return _context33.stop();
1093
- }
1094
- }
1095
- }, _callee33);
1096
- }));
1097
-
1098
- function setFloatingButton(_x36, _x37) {
1099
- return _setFloatingButton.apply(this, arguments);
1100
- }
1101
-
1102
- return setFloatingButton;
1103
- }(),
1104
- setHeight: function () {
1105
- var _setHeight = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee34(value) {
1106
- return regeneratorRuntime.wrap(function _callee34$(_context34) {
1107
- while (1) {
1108
- switch (_context34.prev = _context34.next) {
1109
- case 0:
1110
- if (_this.initialized) {
1111
- _context34.next = 3;
1112
- break;
1113
- }
1114
-
1115
- _context34.next = 3;
1116
- return _this.ready;
1117
-
1118
- case 3:
1119
- return _context34.abrupt("return", _this.exposedFunctions.setHeight(value));
1120
-
1121
- case 4:
1122
- case "end":
1123
- return _context34.stop();
1124
- }
1125
- }
1126
- }, _callee34);
1127
- }));
1128
-
1129
- function setHeight(_x38) {
1130
- return _setHeight.apply(this, arguments);
1131
- }
1132
-
1133
- return setHeight;
1134
- }(),
1135
- setOverlay: function () {
1136
- var _setOverlay = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee35(value, callback) {
1137
- return regeneratorRuntime.wrap(function _callee35$(_context35) {
1138
- while (1) {
1139
- switch (_context35.prev = _context35.next) {
1140
- case 0:
1141
- if (_this.initialized) {
1142
- _context35.next = 3;
1143
- break;
1144
- }
1145
-
1146
- _context35.next = 3;
1147
- return _this.ready;
1148
-
1149
- case 3:
1150
- return _context35.abrupt("return", _this.exposedFunctions.setOverlay(value, callback && comlink.proxy(function () {
1151
- return callback();
1152
- })));
1153
-
1154
- case 4:
1155
- case "end":
1156
- return _context35.stop();
1157
- }
1158
- }
1159
- }, _callee35);
1160
- }));
1161
-
1162
- function setOverlay(_x39, _x40) {
1163
- return _setOverlay.apply(this, arguments);
1164
- }
1165
-
1166
- return setOverlay;
1167
- }(),
1168
- setRefreshScrollEnabled: function () {
1169
- var _setRefreshScrollEnabled = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee36(enabled) {
1170
- return regeneratorRuntime.wrap(function _callee36$(_context36) {
1171
- while (1) {
1172
- switch (_context36.prev = _context36.next) {
1173
- case 0:
1174
- if (_this.initialized) {
1175
- _context36.next = 3;
1176
- break;
1177
- }
1178
-
1179
- _context36.next = 3;
1180
- return _this.ready;
1181
-
1182
- case 3:
1183
- return _context36.abrupt("return", _this.exposedFunctions.setRefreshScrollEnabled(enabled));
1184
-
1185
- case 4:
1186
- case "end":
1187
- return _context36.stop();
1188
- }
1189
- }
1190
- }, _callee36);
1191
- }));
1192
-
1193
- function setRefreshScrollEnabled(_x41) {
1194
- return _setRefreshScrollEnabled.apply(this, arguments);
1195
- }
1196
-
1197
- return setRefreshScrollEnabled;
1198
- }(),
1199
- setScanQrCode: function () {
1200
- var _setScanQrCode = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee37(value) {
1201
- return regeneratorRuntime.wrap(function _callee37$(_context37) {
1202
- while (1) {
1203
- switch (_context37.prev = _context37.next) {
1204
- case 0:
1205
- if (_this.initialized) {
1206
- _context37.next = 3;
1207
- break;
1208
- }
1209
-
1210
- _context37.next = 3;
1211
- return _this.ready;
1212
-
1213
- case 3:
1214
- return _context37.abrupt("return", _this.exposedFunctions.setScanQrCode(value !== null && value !== void 0 ? value : {
1215
- cancel: false
1216
- }));
1217
-
1218
- case 4:
1219
- case "end":
1220
- return _context37.stop();
1221
- }
1222
- }
1223
- }, _callee37);
1224
- }));
1225
-
1226
- function setScanQrCode(_x42) {
1227
- return _setScanQrCode.apply(this, arguments);
1228
- }
1229
-
1230
- return setScanQrCode;
1231
- }(),
1232
- setTempDesignSettings: function () {
1233
- var _setTempDesignSettings = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee38(value) {
1234
- return regeneratorRuntime.wrap(function _callee38$(_context38) {
1235
- while (1) {
1236
- switch (_context38.prev = _context38.next) {
1237
- case 0:
1238
- if (_this.initialized) {
1239
- _context38.next = 3;
1240
- break;
1241
- }
1242
-
1243
- _context38.next = 3;
1244
- return _this.ready;
1245
-
1246
- case 3:
1247
- return _context38.abrupt("return", _this.exposedFunctions.setTempDesignSettings(value));
1248
-
1249
- case 4:
1250
- case "end":
1251
- return _context38.stop();
1252
- }
1253
- }
1254
- }, _callee38);
1255
- }));
1256
-
1257
- function setTempDesignSettings(_x43) {
1258
- return _setTempDesignSettings.apply(this, arguments);
1259
- }
1260
-
1261
- return setTempDesignSettings;
1262
- }(),
1263
- setWaitCursor: function () {
1264
- var _setWaitCursor = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee39(value) {
1265
- return regeneratorRuntime.wrap(function _callee39$(_context39) {
1266
- while (1) {
1267
- switch (_context39.prev = _context39.next) {
1268
- case 0:
1269
- if (_this.initialized) {
1270
- _context39.next = 3;
1271
- break;
1272
- }
1273
-
1274
- _context39.next = 3;
1275
- return _this.ready;
1276
-
1277
- case 3:
1278
- return _context39.abrupt("return", _this.exposedFunctions.setWaitCursor(value));
1279
-
1280
- case 4:
1281
- case "end":
1282
- return _context39.stop();
1283
- }
1284
- }
1285
- }, _callee39);
1286
- }));
1287
-
1288
- function setWaitCursor(_x44) {
1289
- return _setWaitCursor.apply(this, arguments);
1290
- }
1291
-
1292
- return setWaitCursor;
1293
- }(),
1294
- storageGetItem: function () {
1295
- var _storageGetItem = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee40(key, accessMode) {
1296
- return regeneratorRuntime.wrap(function _callee40$(_context40) {
1297
- while (1) {
1298
- switch (_context40.prev = _context40.next) {
1299
- case 0:
1300
- if (_this.initialized) {
1301
- _context40.next = 3;
1302
- break;
1303
- }
1304
-
1305
- _context40.next = 3;
1306
- return _this.ready;
1307
-
1308
- case 3:
1309
- return _context40.abrupt("return", _this.exposedFunctions.storageGetItem(key, accessMode));
1310
-
1311
- case 4:
1312
- case "end":
1313
- return _context40.stop();
1314
- }
1315
- }
1316
- }, _callee40);
1317
- }));
1318
-
1319
- function storageGetItem(_x45, _x46) {
1320
- return _storageGetItem.apply(this, arguments);
1321
- }
1322
-
1323
- return storageGetItem;
1324
- }(),
1325
- storageRemoveItem: function () {
1326
- var _storageRemoveItem = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee41(key, accessMode) {
1327
- return regeneratorRuntime.wrap(function _callee41$(_context41) {
1328
- while (1) {
1329
- switch (_context41.prev = _context41.next) {
1330
- case 0:
1331
- if (_this.initialized) {
1332
- _context41.next = 3;
1333
- break;
1334
- }
1335
-
1336
- _context41.next = 3;
1337
- return _this.ready;
1338
-
1339
- case 3:
1340
- return _context41.abrupt("return", _this.exposedFunctions.storageRemoveItem(key, accessMode));
1341
-
1342
- case 4:
1343
- case "end":
1344
- return _context41.stop();
1345
- }
1346
- }
1347
- }, _callee41);
1348
- }));
1349
-
1350
- function storageRemoveItem(_x47, _x48) {
1351
- return _storageRemoveItem.apply(this, arguments);
1352
- }
1353
-
1354
- return storageRemoveItem;
1355
- }(),
1356
- storageSetItem: function () {
1357
- var _storageSetItem = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee42(key, value, accessMode, tappIds) {
1358
- return regeneratorRuntime.wrap(function _callee42$(_context42) {
1359
- while (1) {
1360
- switch (_context42.prev = _context42.next) {
1361
- case 0:
1362
- if (_this.initialized) {
1363
- _context42.next = 3;
1364
- break;
1365
- }
1366
-
1367
- _context42.next = 3;
1368
- return _this.ready;
1369
-
1370
- case 3:
1371
- return _context42.abrupt("return", _this.exposedFunctions.storageSetItem(key, value, accessMode, tappIds));
1372
-
1373
- case 4:
1374
- case "end":
1375
- return _context42.stop();
1376
- }
1377
- }
1378
- }, _callee42);
1379
- }));
1380
-
1381
- function storageSetItem(_x49, _x50, _x51, _x52) {
1382
- return _storageSetItem.apply(this, arguments);
1383
- }
1384
-
1385
- return storageSetItem;
1386
- }(),
1387
- vibrate: function () {
1388
- var _vibrate = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee43(value) {
1389
- return regeneratorRuntime.wrap(function _callee43$(_context43) {
1390
- while (1) {
1391
- switch (_context43.prev = _context43.next) {
1392
- case 0:
1393
- if (_this.initialized) {
1394
- _context43.next = 3;
1395
- break;
1396
- }
1397
-
1398
- _context43.next = 3;
1399
- return _this.ready;
1400
-
1401
- case 3:
1402
- return _context43.abrupt("return", _this.exposedFunctions.vibrate(value));
1403
-
1404
- case 4:
1405
- case "end":
1406
- return _context43.stop();
1407
- }
1408
- }
1409
- }, _callee43);
1410
- }));
1411
-
1412
- function vibrate(_x53) {
1413
- return _vibrate.apply(this, arguments);
1414
- }
1415
-
1416
- return vibrate;
1417
- }()
135
+ },
136
+ selectPage: async options => {
137
+ if (!this.initialized) await this.ready;
138
+ await this.exposedFunctions.selectPage(options);
139
+ },
140
+ scrollToY: async (position, duration) => {
141
+ if (!this.initialized) await this.ready;
142
+ await this.exposedFunctions.scrollToY(position, duration);
143
+ },
144
+ sendMessageToGroup: async (groupId, message) => {
145
+ if (!this.initialized) await this.ready;
146
+ return sendMessageToGroup(this, message, groupId);
147
+ },
148
+ sendMessageToPage: async message => {
149
+ if (!this.initialized) await this.ready;
150
+ return sendMessageToPage(this, message);
151
+ },
152
+ sendMessageToUser: async (userId, message) => {
153
+ if (!this.initialized) await this.ready;
154
+ return sendMessageToUser(this, message, userId);
155
+ },
156
+ setAdminMode: async enabled => {
157
+ if (!this.initialized) await this.ready;
158
+ return this.exposedFunctions.setAdminMode(enabled);
159
+ },
160
+ setDisplayTimeout: async value => {
161
+ if (!this.initialized) await this.ready;
162
+ return this.exposedFunctions.setDisplayTimeout(value);
163
+ },
164
+ setFloatingButton: async (value, callback) => {
165
+ var _value$items;
166
+ if (!this.initialized) await this.ready;
167
+ value.items = (_value$items = value.items) !== null && _value$items !== void 0 ? _value$items : [];
168
+ const itemClickFunctions = value.items.map(x => x.onClick);
169
+ value.items = value.items.map(x => ({
170
+ ...x,
171
+ onClick: undefined
172
+ }));
173
+ const cb = callback && comlink.proxy(data => {
174
+ if (data !== null && data !== void 0 && data.item && itemClickFunctions[data.index]) {
175
+ itemClickFunctions[data.index]();
176
+ } else {
177
+ callback();
178
+ }
179
+ });
180
+ // @ts-ignore
181
+ return this.exposedFunctions.setFloatingButton(value, cb);
182
+ },
183
+ setHeight: async value => {
184
+ if (!this.initialized) await this.ready;
185
+ return this.exposedFunctions.setHeight(value);
186
+ },
187
+ setOverlay: async (value, callback) => {
188
+ if (!this.initialized) await this.ready;
189
+ return this.exposedFunctions.setOverlay(value, callback && comlink.proxy(() => callback()));
190
+ },
191
+ setRefreshScrollEnabled: async enabled => {
192
+ if (!this.initialized) await this.ready;
193
+ return this.exposedFunctions.setRefreshScrollEnabled(enabled);
194
+ },
195
+ setScanQrCode: async value => {
196
+ if (!this.initialized) await this.ready;
197
+ return this.exposedFunctions.setScanQrCode(value !== null && value !== void 0 ? value : {
198
+ cancel: false
199
+ });
200
+ },
201
+ setTempDesignSettings: async value => {
202
+ if (!this.initialized) await this.ready;
203
+ return this.exposedFunctions.setTempDesignSettings(value);
204
+ },
205
+ setWaitCursor: async value => {
206
+ if (!this.initialized) await this.ready;
207
+ return this.exposedFunctions.setWaitCursor(value);
208
+ },
209
+ storageGetItem: async (key, accessMode) => {
210
+ if (!this.initialized) await this.ready;
211
+ return this.exposedFunctions.storageGetItem(key, accessMode);
212
+ },
213
+ storageRemoveItem: async (key, accessMode) => {
214
+ if (!this.initialized) await this.ready;
215
+ return this.exposedFunctions.storageRemoveItem(key, accessMode);
216
+ },
217
+ storageSetItem: async (key, value, accessMode, tappIds) => {
218
+ if (!this.initialized) await this.ready;
219
+ return this.exposedFunctions.storageSetItem(key, value, accessMode, tappIds);
220
+ },
221
+ vibrate: async value => {
222
+ if (!this.initialized) await this.ready;
223
+ return this.exposedFunctions.vibrate(value);
224
+ },
225
+ scrollByY: async (value, duration) => {
226
+ if (!this.initialized) await this.ready;
227
+ return this.exposedFunctions.scrollByY(value, duration);
228
+ }
1418
229
  });
1419
-
1420
230
  _defineProperty(this, "initialized", false);
1421
-
1422
- var initialDataTag = document.querySelector('#__CHAYNS_DATA__');
1423
-
231
+ const initialDataTag = document.querySelector('#__CHAYNS_DATA__');
1424
232
  if (initialDataTag) {
1425
233
  this.values = JSON.parse(initialDataTag.innerHTML);
1426
234
  }
1427
235
  }
1428
-
1429
- _createClass(FrameWrapper, [{
1430
- key: "init",
1431
- value: function () {
1432
- var _init = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee44() {
1433
- var _this2 = this;
1434
-
1435
- var exposed, dataListener, hostReadyCallback;
1436
- return regeneratorRuntime.wrap(function _callee44$(_context44) {
1437
- while (1) {
1438
- switch (_context44.prev = _context44.next) {
1439
- case 0:
1440
- if (!this.initialized) {
1441
- _context44.next = 2;
1442
- break;
1443
- }
1444
-
1445
- return _context44.abrupt("return");
1446
-
1447
- case 2:
1448
- exposed = comlink.wrap(comlink.windowEndpoint(window.parent))[window.name];
1449
-
1450
- dataListener = function dataListener() {
1451
- return exposed.addDataListener(comlink.proxy(function (_ref2) {
1452
- var type = _ref2.type,
1453
- value = _ref2.value;
1454
-
1455
- if (_this2.initialized) {
1456
- _this2.values[type] = value;
1457
- }
1458
-
1459
- _this2.values[type] = value;
1460
- document.dispatchEvent(new CustomEvent('chayns_api_data', {
1461
- detail: {
1462
- type: type,
1463
- value: value
1464
- }
1465
- }));
1466
- }));
1467
- };
1468
-
1469
- hostReadyCallback = null;
1470
- _context44.next = 7;
1471
- return Promise.race([dataListener(), new Promise(function (resolve) {
1472
- window.addEventListener('message', hostReadyCallback = function hostReadyCallback(ev) {
1473
- if (ev.data === 'chayns-api-host-ready') {
1474
- void dataListener().then(resolve);
1475
- }
1476
- });
1477
- })]);
1478
-
1479
- case 7:
1480
- if (hostReadyCallback) window.removeEventListener('message', hostReadyCallback);
1481
- _context44.next = 10;
1482
- return exposed.getInitialData();
1483
-
1484
- case 10:
1485
- this.values = _context44.sent;
1486
- this.exposedFunctions = exposed.functions;
1487
- this.initialized = true;
1488
- this.resolve(null);
1489
- setTappHeight(this.functions.setHeight);
1490
-
1491
- case 15:
1492
- case "end":
1493
- return _context44.stop();
1494
- }
1495
- }
1496
- }, _callee44, this);
1497
- }));
1498
-
1499
- function init() {
1500
- return _init.apply(this, arguments);
236
+ async init() {
237
+ if (this.initialized) return;
238
+ const exposed = comlink.wrap(comlink.windowEndpoint(window.parent))[window.name];
239
+ const dataListener = () => exposed.addDataListener(comlink.proxy(_ref => {
240
+ let {
241
+ type,
242
+ value
243
+ } = _ref;
244
+ if (this.initialized) {
245
+ this.values[type] = value;
1501
246
  }
1502
-
1503
- return init;
1504
- }()
1505
- }, {
1506
- key: "addDataListener",
1507
- value: function addDataListener(cb) {
1508
- var listener = function listener(ev) {
1509
- return ev.detail && cb(ev.detail);
1510
- };
1511
-
1512
- document.addEventListener('chayns_api_data', listener);
1513
- return function () {
1514
- document.removeEventListener('chayns_api_data', listener);
1515
- };
1516
- }
1517
- }, {
1518
- key: "getSSRData",
1519
- value: function getSSRData() {
1520
- return null;
1521
- }
1522
- }, {
1523
- key: "getInitialData",
1524
- value: function getInitialData() {
1525
- return this.values;
1526
- }
1527
- }]);
1528
-
1529
- return FrameWrapper;
1530
- }();
247
+ this.values[type] = value;
248
+ document.dispatchEvent(new CustomEvent('chayns_api_data', {
249
+ detail: {
250
+ type,
251
+ value
252
+ }
253
+ }));
254
+ }));
255
+ let hostReadyCallback = null;
256
+ await Promise.race([dataListener(), new Promise(resolve => {
257
+ window.addEventListener('message', hostReadyCallback = ev => {
258
+ if (ev.data === 'chayns-api-host-ready') {
259
+ void dataListener().then(resolve);
260
+ }
261
+ });
262
+ })]);
263
+ if (hostReadyCallback) window.removeEventListener('message', hostReadyCallback);
264
+ this.values = await exposed.getInitialData();
265
+ this.exposedFunctions = exposed.functions;
266
+ this.initialized = true;
267
+ this.resolve(null);
268
+ setTappHeight(this.functions.setHeight);
269
+ }
270
+ addDataListener(cb) {
271
+ const listener = ev => ev.detail && cb(ev.detail);
272
+ document.addEventListener('chayns_api_data', listener);
273
+ return () => {
274
+ document.removeEventListener('chayns_api_data', listener);
275
+ };
276
+ }
277
+ getSSRData() {
278
+ return null;
279
+ }
280
+ getInitialData() {
281
+ return this.values;
282
+ }
283
+ }