chayns-api 1.0.36 → 1.0.38

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.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.vibrate = exports.user = exports.storageSetItem = exports.storageRemoveItem = exports.storageGetItem = exports.site = exports.setWaitCursor = exports.setTempDesignSettings = exports.setScanQrCode = exports.setRefreshScrollEnabled = exports.setOverlay = exports.setHeight = exports.setFloatingButton = exports.setDisplayTimeout = exports.setAdminMode = exports.sendMessageToUser = exports.sendMessageToPage = exports.sendMessageToGroup = exports.selectPage = exports.scrollToY = exports.scrollByY = exports.removeWindowMetricsListener = exports.removeVisibilityChangeListener = exports.removeScrollListener = exports.removeGeoLocationListener = exports.refreshData = exports.refreshAccessToken = exports.parameters = exports.pages = exports.openVideo = exports.openUrl = exports.openImage = exports.navigateBack = exports.logout = exports.login = exports.language = exports.invokeDialogCall = exports.invokeCall = exports.getWindowMetrics = exports.getUserInfo = exports.getUser = exports.getSite = exports.getScrollPosition = exports.getParameters = exports.getPages = exports.getLanguage = exports.getGeoLocation = exports.getEnvironment = exports.getDevice = exports.getCurrentPage = exports.getAvailableSharingServices = exports.getAccessToken = exports.environment = exports.device = exports.customCallbackFunction = exports.createDialog = exports.addWindowMetricsListener = exports.addVisibilityChangeListener = exports.addScrollListener = exports.addGeoLocationListener = void 0;
6
+ exports.vibrate = exports.user = exports.storageSetItem = exports.storageRemoveItem = exports.storageGetItem = exports.site = exports.setWaitCursor = exports.setTempDesignSettings = exports.setScanQrCode = exports.setRefreshScrollEnabled = exports.setOverlay = exports.setHeight = exports.setFloatingButton = exports.setDisplayTimeout = exports.setAdminMode = exports.sendMessageToUser = exports.sendMessageToPage = exports.sendMessageToGroup = exports.selectPage = exports.scrollToY = exports.scrollByY = exports.removeWindowMetricsListener = exports.removeVisibilityChangeListener = exports.removeToolbarChangeListener = exports.removeScrollListener = exports.removeGeoLocationListener = exports.refreshData = exports.refreshAccessToken = exports.parameters = exports.pages = exports.openVideo = exports.openUrl = exports.openMedia = exports.openImage = exports.navigateBack = exports.logout = exports.login = exports.language = exports.invokeDialogCall = exports.invokeCall = exports.getWindowMetrics = exports.getUserInfo = exports.getUser = exports.getSite = exports.getScrollPosition = exports.getParameters = exports.getPages = exports.getLanguage = exports.getGeoLocation = exports.getEnvironment = exports.getDevice = exports.getCurrentPage = exports.getAvailableSharingServices = exports.getAccessToken = exports.environment = exports.device = exports.customCallbackFunction = exports.createDialog = exports.addWindowMetricsListener = exports.addVisibilityChangeListener = exports.addToolbarChangeListener = exports.addScrollListener = exports.addGeoLocationListener = void 0;
7
7
  var _moduleWrapper = require("../components/moduleWrapper");
8
8
  /**
9
9
  * This adds a listener to determine your location.
@@ -23,10 +23,17 @@ const addScrollListener = (...args) => _moduleWrapper.moduleWrapper.current.func
23
23
  exports.addScrollListener = addScrollListener;
24
24
  const addVisibilityChangeListener = (...args) => _moduleWrapper.moduleWrapper.current.functions.addVisibilityChangeListener(...args);
25
25
  /**
26
- * This adds a listener to get the actual height of the page.
26
+ * This method will be executed when the toolbar gets displayed or hidden.
27
27
  * @category Event listener
28
28
  */
29
29
  exports.addVisibilityChangeListener = addVisibilityChangeListener;
30
+ const addToolbarChangeListener = (...args) => _moduleWrapper.moduleWrapper.current.functions.addToolbarChangeListener(...args);
31
+
32
+ /**
33
+ * This adds a listener to get the actual height of the page.
34
+ * @category Event listener
35
+ */
36
+ exports.addToolbarChangeListener = addToolbarChangeListener;
30
37
  const addWindowMetricsListener = (...args) => _moduleWrapper.moduleWrapper.current.functions.addWindowMetricsListener(...args); /**
31
38
  * Allows a custom callback function to be defined
32
39
  */
@@ -90,9 +97,14 @@ const navigateBack = (...args) => _moduleWrapper.moduleWrapper.current.functions
90
97
  exports.navigateBack = navigateBack;
91
98
  const openImage = (...args) => _moduleWrapper.moduleWrapper.current.functions.openImage(...args);
92
99
  /**
93
- * Opens an URL in the chayns environment.
100
+ * The images and videos specified in the items array is shown in gallery mode.
94
101
  */
95
102
  exports.openImage = openImage;
103
+ const openMedia = (...args) => _moduleWrapper.moduleWrapper.current.functions.openMedia(...args);
104
+ /**
105
+ * Opens an URL in the chayns environment.
106
+ */
107
+ exports.openMedia = openMedia;
96
108
  const openUrl = (...args) => _moduleWrapper.moduleWrapper.current.functions.openUrl(...args);
97
109
  /**
98
110
  * The video specified in the URL is shown in video mode.
@@ -116,10 +128,16 @@ const refreshAccessToken = (...args) => _moduleWrapper.moduleWrapper.current.fun
116
128
  exports.refreshAccessToken = refreshAccessToken;
117
129
  const removeGeoLocationListener = (...args) => _moduleWrapper.moduleWrapper.current.functions.removeGeoLocationListener(...args);
118
130
  /**
119
- * Removes scroll listener.
131
+ * This removes a listener for changing toolbar visibility
120
132
  * @category Event listener
121
133
  */
122
134
  exports.removeGeoLocationListener = removeGeoLocationListener;
135
+ const removeToolbarChangeListener = (...args) => _moduleWrapper.moduleWrapper.current.functions.removeToolbarChangeListener(...args);
136
+ /**
137
+ * Removes scroll listener.
138
+ * @category Event listener
139
+ */
140
+ exports.removeToolbarChangeListener = removeToolbarChangeListener;
123
141
  const removeScrollListener = (...args) => _moduleWrapper.moduleWrapper.current.functions.removeScrollListener(...args);
124
142
  /**
125
143
  * Removes visibility change listener.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.ToastType = exports.TappEvent = exports.SharingApp = exports.ScreenSize = exports.ScanQrCodeCodeType = exports.ScanQrCodeCameraTypes = exports.RuntimeEnviroment = exports.Language = exports.IconType = exports.Gender = exports.Font = exports.FloatingButtonPosition = exports.Environment = exports.DialogType = exports.DialogSelectType = exports.DialogInputType = exports.DialogButtonType = exports.DeviceOs = exports.DateType = exports.ColorMode = exports.BrowserName = exports.AppName = exports.AccessMode = void 0;
6
+ exports.ToastType = exports.TappEvent = exports.SharingApp = exports.ScreenSize = exports.ScanQrCodeCodeType = exports.ScanQrCodeCameraTypes = exports.RuntimeEnviroment = exports.MediaType = exports.Language = exports.IconType = exports.Gender = exports.Font = exports.FloatingButtonPosition = exports.Environment = exports.DialogType = exports.DialogSelectType = exports.DialogInputType = exports.DialogButtonType = exports.DeviceOs = exports.DateType = exports.ColorMode = exports.BrowserName = exports.AppName = exports.AccessMode = void 0;
7
7
  let DateType = /*#__PURE__*/function (DateType) {
8
8
  DateType[DateType["DATE"] = 0] = "DATE";
9
9
  DateType[DateType["TIME"] = 1] = "TIME";
@@ -314,4 +314,10 @@ let DialogType = /*#__PURE__*/function (DialogType) {
314
314
  DialogType["TOAST"] = "toast";
315
315
  return DialogType;
316
316
  }({});
317
- exports.DialogType = DialogType;
317
+ exports.DialogType = DialogType;
318
+ let MediaType = /*#__PURE__*/function (MediaType) {
319
+ MediaType["IMAGE"] = "image";
320
+ MediaType["VIDEO"] = "video";
321
+ return MediaType;
322
+ }({});
323
+ exports.MediaType = MediaType;
@@ -211,6 +211,23 @@ class AppWrapper {
211
211
  }
212
212
  return id;
213
213
  },
214
+ addToolbarChangeListener: async callback => {
215
+ const {
216
+ id,
217
+ shouldInitialize
218
+ } = (0, _apiListenerHelper.addApiListener)('toolbarChangeListener', callback);
219
+ if (shouldInitialize) {
220
+ this.appCall(293, {}, {
221
+ callback: v => {
222
+ (0, _apiListenerHelper.dispatchApiEvent)('toolbarChangeListener', {
223
+ isVisible: v.isVisible,
224
+ toolbarHeight: v.toolbarHeight
225
+ });
226
+ }
227
+ });
228
+ }
229
+ return id;
230
+ },
214
231
  addWindowMetricsListener: async callback => {
215
232
  const {
216
233
  id,
@@ -275,7 +292,7 @@ class AppWrapper {
275
292
  window[callbackName] = ({
276
293
  retVal
277
294
  }) => {
278
- callback === null || callback === void 0 ? void 0 : callback(retVal);
295
+ callback === null || callback === void 0 || callback(retVal);
279
296
  delete window[callbackName];
280
297
  };
281
298
  const callObj = {
@@ -359,6 +376,14 @@ class AppWrapper {
359
376
  // App does not support removal of onActivate callback which makes this a no-op
360
377
  }
361
378
  },
379
+ removeToolbarChangeListener: async id => {
380
+ const {
381
+ shouldRemove
382
+ } = (0, _apiListenerHelper.removeApiListener)('toolbarChangeListener', id);
383
+ if (shouldRemove) {
384
+ // App does not support removal of onToolbarBarRemove callback which makes this a no-op
385
+ }
386
+ },
362
387
  removeWindowMetricsListener: async id => {
363
388
  const shouldRemove = (0, _apiListenerHelper.removeApiListener)('windowMetricsListener', id);
364
389
  if (shouldRemove) {
@@ -34,6 +34,10 @@ class FrameWrapper {
34
34
  return this.exposedFunctions.addScrollListener(value, callback && comlink.proxy(result => callback(result)));
35
35
  },
36
36
  addVisibilityChangeListener: async callback => (0, _visibilityChangeListener.addVisibilityChangeListener)(callback),
37
+ addToolbarChangeListener: async callback => {
38
+ if (!this.initialized) await this.ready;
39
+ return this.exposedFunctions.addToolbarChangeListener(callback && comlink.proxy(result => callback(result)));
40
+ },
37
41
  addWindowMetricsListener: async callback => {
38
42
  if (!this.initialized) await this.ready;
39
43
  const {
@@ -105,6 +109,10 @@ class FrameWrapper {
105
109
  if (!this.initialized) await this.ready;
106
110
  return this.exposedFunctions.openImage(value);
107
111
  },
112
+ openMedia: async value => {
113
+ if (!this.initialized) await this.ready;
114
+ return this.exposedFunctions.openMedia(value);
115
+ },
108
116
  openUrl: async value => {
109
117
  if (!this.initialized) await this.ready;
110
118
  return this.exposedFunctions.openUrl(value);
@@ -142,6 +150,10 @@ class FrameWrapper {
142
150
  this.resizeListener = null;
143
151
  }
144
152
  },
153
+ removeToolbarChangeListener: async id => {
154
+ if (!this.initialized) await this.ready;
155
+ return this.exposedFunctions.removeToolbarChangeListener(id);
156
+ },
145
157
  selectPage: async options => {
146
158
  if (!this.initialized) await this.ready;
147
159
  await this.exposedFunctions.selectPage(options);
@@ -20,6 +20,14 @@ export const addScrollListener = function () {
20
20
  export const addVisibilityChangeListener = function () {
21
21
  return moduleWrapper.current.functions.addVisibilityChangeListener(...arguments);
22
22
  };
23
+ /**
24
+ * This method will be executed when the toolbar gets displayed or hidden.
25
+ * @category Event listener
26
+ */
27
+ export const addToolbarChangeListener = function () {
28
+ return moduleWrapper.current.functions.addToolbarChangeListener(...arguments);
29
+ };
30
+
23
31
  /**
24
32
  * This adds a listener to get the actual height of the page.
25
33
  * @category Event listener
@@ -101,6 +109,12 @@ export const navigateBack = function () {
101
109
  export const openImage = function () {
102
110
  return moduleWrapper.current.functions.openImage(...arguments);
103
111
  };
112
+ /**
113
+ * The images and videos specified in the items array is shown in gallery mode.
114
+ */
115
+ export const openMedia = function () {
116
+ return moduleWrapper.current.functions.openMedia(...arguments);
117
+ };
104
118
  /**
105
119
  * Opens an URL in the chayns environment.
106
120
  */
@@ -132,6 +146,13 @@ export const refreshAccessToken = function () {
132
146
  export const removeGeoLocationListener = function () {
133
147
  return moduleWrapper.current.functions.removeGeoLocationListener(...arguments);
134
148
  };
149
+ /**
150
+ * This removes a listener for changing toolbar visibility
151
+ * @category Event listener
152
+ */
153
+ export const removeToolbarChangeListener = function () {
154
+ return moduleWrapper.current.functions.removeToolbarChangeListener(...arguments);
155
+ };
135
156
  /**
136
157
  * Removes scroll listener.
137
158
  * @category Event listener
@@ -288,4 +288,9 @@ export let DialogType = /*#__PURE__*/function (DialogType) {
288
288
  DialogType["SELECT"] = "select";
289
289
  DialogType["TOAST"] = "toast";
290
290
  return DialogType;
291
+ }({});
292
+ export let MediaType = /*#__PURE__*/function (MediaType) {
293
+ MediaType["IMAGE"] = "image";
294
+ MediaType["VIDEO"] = "video";
295
+ return MediaType;
291
296
  }({});
@@ -166,6 +166,23 @@ export class AppWrapper {
166
166
  }
167
167
  return id;
168
168
  },
169
+ addToolbarChangeListener: async callback => {
170
+ const {
171
+ id,
172
+ shouldInitialize
173
+ } = addApiListener('toolbarChangeListener', callback);
174
+ if (shouldInitialize) {
175
+ this.appCall(293, {}, {
176
+ callback: v => {
177
+ dispatchApiEvent('toolbarChangeListener', {
178
+ isVisible: v.isVisible,
179
+ toolbarHeight: v.toolbarHeight
180
+ });
181
+ }
182
+ });
183
+ }
184
+ return id;
185
+ },
169
186
  addWindowMetricsListener: async callback => {
170
187
  const {
171
188
  id,
@@ -231,7 +248,7 @@ export class AppWrapper {
231
248
  let {
232
249
  retVal
233
250
  } = _ref;
234
- callback === null || callback === void 0 ? void 0 : callback(retVal);
251
+ callback === null || callback === void 0 || callback(retVal);
235
252
  delete window[callbackName];
236
253
  };
237
254
  const callObj = {
@@ -315,6 +332,14 @@ export class AppWrapper {
315
332
  // App does not support removal of onActivate callback which makes this a no-op
316
333
  }
317
334
  },
335
+ removeToolbarChangeListener: async id => {
336
+ const {
337
+ shouldRemove
338
+ } = removeApiListener('toolbarChangeListener', id);
339
+ if (shouldRemove) {
340
+ // App does not support removal of onToolbarBarRemove callback which makes this a no-op
341
+ }
342
+ },
318
343
  removeWindowMetricsListener: async id => {
319
344
  const shouldRemove = removeApiListener('windowMetricsListener', id);
320
345
  if (shouldRemove) {
@@ -28,6 +28,10 @@ export class FrameWrapper {
28
28
  return this.exposedFunctions.addScrollListener(value, callback && comlink.proxy(result => callback(result)));
29
29
  },
30
30
  addVisibilityChangeListener: async callback => addVisibilityChangeListener(callback),
31
+ addToolbarChangeListener: async callback => {
32
+ if (!this.initialized) await this.ready;
33
+ return this.exposedFunctions.addToolbarChangeListener(callback && comlink.proxy(result => callback(result)));
34
+ },
31
35
  addWindowMetricsListener: async callback => {
32
36
  if (!this.initialized) await this.ready;
33
37
  const {
@@ -99,6 +103,10 @@ export class FrameWrapper {
99
103
  if (!this.initialized) await this.ready;
100
104
  return this.exposedFunctions.openImage(value);
101
105
  },
106
+ openMedia: async value => {
107
+ if (!this.initialized) await this.ready;
108
+ return this.exposedFunctions.openMedia(value);
109
+ },
102
110
  openUrl: async value => {
103
111
  if (!this.initialized) await this.ready;
104
112
  return this.exposedFunctions.openUrl(value);
@@ -136,6 +144,10 @@ export class FrameWrapper {
136
144
  this.resizeListener = null;
137
145
  }
138
146
  },
147
+ removeToolbarChangeListener: async id => {
148
+ if (!this.initialized) await this.ready;
149
+ return this.exposedFunctions.removeToolbarChangeListener(id);
150
+ },
139
151
  selectPage: async options => {
140
152
  if (!this.initialized) await this.ready;
141
153
  await this.exposedFunctions.selectPage(options);
@@ -19,6 +19,11 @@ export declare const addScrollListener: (value: {
19
19
  * @category Event listener
20
20
  */
21
21
  export declare const addVisibilityChangeListener: (callback: (result: import("../types/IChaynsReact").VisibilityChangeListenerResult) => void) => Promise<number>;
22
+ /**
23
+ * This method will be executed when the toolbar gets displayed or hidden.
24
+ * @category Event listener
25
+ */
26
+ export declare const addToolbarChangeListener: (callback: (result: import("../types/IChaynsReact").ToolbarChangeListenerResult) => void) => Promise<number>;
22
27
  /**
23
28
  * This adds a listener to get the actual height of the page.
24
29
  * @category Event listener
@@ -75,6 +80,10 @@ export declare const navigateBack: () => Promise<void>;
75
80
  * The images specified in the url array is shown in gallery mode.
76
81
  */
77
82
  export declare const openImage: (value: import("../types/IChaynsReact").OpenImage) => Promise<void>;
83
+ /**
84
+ * The images and videos specified in the items array is shown in gallery mode.
85
+ */
86
+ export declare const openMedia: (value: import("../types/IChaynsReact").OpenMedia) => Promise<void>;
78
87
  /**
79
88
  * Opens an URL in the chayns environment.
80
89
  */
@@ -96,6 +105,11 @@ export declare const refreshAccessToken: () => Promise<void>;
96
105
  * @category Event listener
97
106
  */
98
107
  export declare const removeGeoLocationListener: (value: number) => Promise<void>;
108
+ /**
109
+ * This removes a listener for changing toolbar visibility
110
+ * @category Event listener
111
+ */
112
+ export declare const removeToolbarChangeListener: (value: number) => Promise<void>;
99
113
  /**
100
114
  * Removes scroll listener.
101
115
  * @category Event listener
@@ -212,6 +212,7 @@ export interface ChaynsReactFunctions {
212
212
  throttle?: number;
213
213
  }, callback: (result: ScrollListenerResult) => void) => Promise<number>;
214
214
  addVisibilityChangeListener: (callback: (result: VisibilityChangeListenerResult) => void) => Promise<number>;
215
+ addToolbarChangeListener: (callback: (result: ToolbarChangeListenerResult) => void) => Promise<number>;
215
216
  addWindowMetricsListener: (callback: (result: WindowMetricsListenerResult) => void) => Promise<number>;
216
217
  customCallbackFunction: (type: string, data: unknown) => Promise<unknown>;
217
218
  getAvailableSharingServices: () => Promise<AvailableSharingServices>;
@@ -231,11 +232,13 @@ export interface ChaynsReactFunctions {
231
232
  openImage: (value: OpenImage) => Promise<void>;
232
233
  openUrl: (value: OpenUrl) => Promise<void>;
233
234
  openVideo: (value: OpenVideo) => Promise<void>;
235
+ openMedia: (value: OpenMedia) => Promise<void>;
234
236
  refreshData: (value: RefreshData) => Promise<void>;
235
237
  refreshAccessToken: () => Promise<void>;
236
238
  removeGeoLocationListener: (value: number) => Promise<void>;
237
239
  removeScrollListener: (value: number) => Promise<void>;
238
240
  removeVisibilityChangeListener: (value: number) => Promise<void>;
241
+ removeToolbarChangeListener: (value: number) => Promise<void>;
239
242
  removeWindowMetricsListener: (value: number) => Promise<void>;
240
243
  selectPage: (value: SelectPage) => Promise<void>;
241
244
  scrollToY: (position: number, duration: number) => Promise<void>;
@@ -487,7 +490,7 @@ export type UserInfoQuery = {
487
490
  personId?: string;
488
491
  userId: number;
489
492
  };
490
- type OpenImageItem = {
493
+ export type OpenImageItem = {
491
494
  url: string;
492
495
  title?: string;
493
496
  description?: string;
@@ -611,6 +614,10 @@ export interface VisibilityChangeListenerResult {
611
614
  isVisible: boolean;
612
615
  tappEvent: TappEvent;
613
616
  }
617
+ export interface ToolbarChangeListenerResult {
618
+ isVisible: boolean;
619
+ toolbarHeight: number;
620
+ }
614
621
  export interface ScrollListenerResult {
615
622
  scrollX: number | null;
616
623
  scrollY: number | null;
@@ -763,4 +770,19 @@ export declare enum DialogType {
763
770
  SELECT = "select",
764
771
  TOAST = "toast"
765
772
  }
773
+ export declare enum MediaType {
774
+ IMAGE = "image",
775
+ VIDEO = "video"
776
+ }
777
+ export type OpenMediaItem = {
778
+ url: string;
779
+ title?: string;
780
+ description?: string;
781
+ preventCache?: boolean;
782
+ mediaType: MediaType;
783
+ };
784
+ export type OpenMedia = {
785
+ items: [OpenMediaItem, ...OpenMediaItem[]];
786
+ startIndex?: number;
787
+ };
766
788
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chayns-api",
3
- "version": "1.0.36",
3
+ "version": "1.0.38",
4
4
  "description": "new chayns api",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",