chayns-api 2.2.12 → 2.2.14

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.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.getStyleSettings = exports.getSite = exports.getScrollPosition = exports.getParameters = exports.getPages = exports.getLanguage = exports.getGeoLocation = exports.getEnvironment = exports.getDevice = exports.getCustomFunction = exports.getCurrentPage = exports.getAvailableSharingServices = exports.getAccessToken = exports.environment = exports.device = exports.customCallbackFunction = exports.createDialog = exports.addWindowMetricsListener = exports.addVisibilityChangeListener = exports.addToolbarChangeListener = exports.addScrollListener = exports.addGeoLocationListener = exports.addAnonymousAccount = 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.setCustomCookie = 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.getStyleSettings = exports.getSite = exports.getScrollPosition = exports.getParameters = exports.getPages = exports.getLanguage = exports.getGeoLocation = exports.getEnvironment = exports.getDevice = exports.getCustomFunction = exports.getCustomCookie = exports.getCurrentPage = exports.getAvailableSharingServices = exports.getAccessToken = exports.environment = exports.device = exports.customCallbackFunction = exports.createDialog = exports.addWindowMetricsListener = exports.addVisibilityChangeListener = exports.addToolbarChangeListener = exports.addScrollListener = exports.addGeoLocationListener = exports.addAnonymousAccount = void 0;
7
7
  var _moduleWrapper = require("../components/moduleWrapper");
8
8
  const addGeoLocationListener = (...args) => _moduleWrapper.moduleWrapper.current.functions.addGeoLocationListener(...args);
9
9
  exports.addGeoLocationListener = addGeoLocationListener;
@@ -21,6 +21,8 @@ const getAccessToken = (...args) => _moduleWrapper.moduleWrapper.current.functio
21
21
  exports.getAccessToken = getAccessToken;
22
22
  const getAvailableSharingServices = (...args) => _moduleWrapper.moduleWrapper.current.functions.getAvailableSharingServices(...args);
23
23
  exports.getAvailableSharingServices = getAvailableSharingServices;
24
+ const getCustomCookie = (...args) => _moduleWrapper.moduleWrapper.current.functions.getCustomCookie(...args);
25
+ exports.getCustomCookie = getCustomCookie;
24
26
  const getGeoLocation = (...args) => _moduleWrapper.moduleWrapper.current.functions.getGeoLocation(...args);
25
27
  exports.getGeoLocation = getGeoLocation;
26
28
  const getUserInfo = (...args) => _moduleWrapper.moduleWrapper.current.functions.getUserInfo(...args);
@@ -75,6 +77,8 @@ const sendMessageToUser = (...args) => _moduleWrapper.moduleWrapper.current.func
75
77
  exports.sendMessageToUser = sendMessageToUser;
76
78
  const setAdminMode = (...args) => _moduleWrapper.moduleWrapper.current.functions.setAdminMode(...args);
77
79
  exports.setAdminMode = setAdminMode;
80
+ const setCustomCookie = (...args) => _moduleWrapper.moduleWrapper.current.functions.setCustomCookie(...args);
81
+ exports.setCustomCookie = setCustomCookie;
78
82
  const setDisplayTimeout = (...args) => _moduleWrapper.moduleWrapper.current.functions.setDisplayTimeout(...args);
79
83
  exports.setDisplayTimeout = setDisplayTimeout;
80
84
  const setFloatingButton = (...args) => _moduleWrapper.moduleWrapper.current.functions.setFloatingButton(...args);
@@ -288,6 +288,9 @@ class AppWrapper {
288
288
  availableAndroidApps: res.availableAndroidApps
289
289
  };
290
290
  },
291
+ getCustomCookie: async () => {
292
+ this.notImplemented('getCustomCookie');
293
+ },
291
294
  getGeoLocation: async () => {
292
295
  var _res$accuracy, _res$isAccurate, _res$code;
293
296
  const res = await this.appCall(14);
@@ -476,6 +479,9 @@ class AppWrapper {
476
479
  setAdminMode: async () => {
477
480
  this.notImplemented('setAdminMode');
478
481
  },
482
+ setCustomCookie: async () => {
483
+ this.notImplemented('setCustomCookie');
484
+ },
479
485
  setDisplayTimeout: async enabled => {
480
486
  this.appCall(94, {
481
487
  enabled
@@ -70,6 +70,10 @@ class FrameWrapper {
70
70
  if (!this.initialized) await this.ready;
71
71
  return this.exposedFunctions.getAccessToken(accessToken);
72
72
  },
73
+ getCustomCookie: async value => {
74
+ if (!this.initialized) await this.ready;
75
+ return this.exposedFunctions.getCustomCookie(value);
76
+ },
73
77
  getGeoLocation: async value => {
74
78
  if (!this.initialized) await this.ready;
75
79
  return this.exposedFunctions.getGeoLocation(value);
@@ -179,6 +183,10 @@ class FrameWrapper {
179
183
  if (!this.initialized) await this.ready;
180
184
  return this.exposedFunctions.setAdminMode(enabled);
181
185
  },
186
+ setCustomCookie: async value => {
187
+ if (!this.initialized) await this.ready;
188
+ await this.exposedFunctions.setCustomCookie(value);
189
+ },
182
190
  setDisplayTimeout: async value => {
183
191
  if (!this.initialized) await this.ready;
184
192
  return this.exposedFunctions.setDisplayTimeout(value);
@@ -13,12 +13,12 @@ var _ModuleFederationWrapper = require("./ModuleFederationWrapper");
13
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
14
  class StaticChaynsApi {
15
15
  constructor(values, functions) {
16
- var _deviceInfo$app$name, _deviceInfo$app;
16
+ var _deviceInfo$app;
17
17
  let wrapper;
18
18
  const deviceInfo = (0, _deviceHelper.default)(navigator.userAgent, '');
19
19
  if (values && functions) {
20
20
  wrapper = new _ModuleFederationWrapper.ModuleFederationWrapper(values, functions);
21
- } else if ([_IChaynsReact.AppName.Chayns, _IChaynsReact.AppName.ChaynsLauncher, _IChaynsReact.AppName.Sidekick, _IChaynsReact.AppName.TobitChat].includes((_deviceInfo$app$name = (_deviceInfo$app = deviceInfo.app) === null || _deviceInfo$app === void 0 ? void 0 : _deviceInfo$app.name) !== null && _deviceInfo$app$name !== void 0 ? _deviceInfo$app$name : _IChaynsReact.AppName.Unknown) && window.self === window.top) {
21
+ } else if (((_deviceInfo$app = deviceInfo.app) === null || _deviceInfo$app === void 0 ? void 0 : _deviceInfo$app.flavor) === _IChaynsReact.AppFlavor.Chayns && window.self === window.top) {
22
22
  wrapper = new _AppWrapper.AppWrapper();
23
23
  } else {
24
24
  wrapper = new _FrameWrapper.FrameWrapper();
@@ -23,6 +23,9 @@ export const getAccessToken = function () {
23
23
  export const getAvailableSharingServices = function () {
24
24
  return moduleWrapper.current.functions.getAvailableSharingServices(...arguments);
25
25
  };
26
+ export const getCustomCookie = function () {
27
+ return moduleWrapper.current.functions.getCustomCookie(...arguments);
28
+ };
26
29
  export const getGeoLocation = function () {
27
30
  return moduleWrapper.current.functions.getGeoLocation(...arguments);
28
31
  };
@@ -104,6 +107,9 @@ export const sendMessageToUser = function () {
104
107
  export const setAdminMode = function () {
105
108
  return moduleWrapper.current.functions.setAdminMode(...arguments);
106
109
  };
110
+ export const setCustomCookie = function () {
111
+ return moduleWrapper.current.functions.setCustomCookie(...arguments);
112
+ };
107
113
  export const setDisplayTimeout = function () {
108
114
  return moduleWrapper.current.functions.setDisplayTimeout(...arguments);
109
115
  };
@@ -250,6 +250,9 @@ export class AppWrapper {
250
250
  availableAndroidApps: res.availableAndroidApps
251
251
  };
252
252
  },
253
+ getCustomCookie: async () => {
254
+ this.notImplemented('getCustomCookie');
255
+ },
253
256
  getGeoLocation: async () => {
254
257
  var _res$accuracy, _res$isAccurate, _res$code;
255
258
  const res = await this.appCall(14);
@@ -440,6 +443,9 @@ export class AppWrapper {
440
443
  setAdminMode: async () => {
441
444
  this.notImplemented('setAdminMode');
442
445
  },
446
+ setCustomCookie: async () => {
447
+ this.notImplemented('setCustomCookie');
448
+ },
443
449
  setDisplayTimeout: async enabled => {
444
450
  this.appCall(94, {
445
451
  enabled
@@ -66,6 +66,10 @@ export class FrameWrapper {
66
66
  if (!this.initialized) await this.ready;
67
67
  return this.exposedFunctions.getAccessToken(accessToken);
68
68
  },
69
+ getCustomCookie: async value => {
70
+ if (!this.initialized) await this.ready;
71
+ return this.exposedFunctions.getCustomCookie(value);
72
+ },
69
73
  getGeoLocation: async value => {
70
74
  if (!this.initialized) await this.ready;
71
75
  return this.exposedFunctions.getGeoLocation(value);
@@ -175,6 +179,10 @@ export class FrameWrapper {
175
179
  if (!this.initialized) await this.ready;
176
180
  return this.exposedFunctions.setAdminMode(enabled);
177
181
  },
182
+ setCustomCookie: async value => {
183
+ if (!this.initialized) await this.ready;
184
+ await this.exposedFunctions.setCustomCookie(value);
185
+ },
178
186
  setDisplayTimeout: async value => {
179
187
  if (!this.initialized) await this.ready;
180
188
  return this.exposedFunctions.setDisplayTimeout(value);
@@ -2,14 +2,14 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
2
2
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
3
3
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4
4
  import { moduleWrapper } from '../components/moduleWrapper';
5
- import { AppName } from '../types/IChaynsReact';
5
+ import { AppFlavor } from '../types/IChaynsReact';
6
6
  import getDeviceInfo from '../util/deviceHelper';
7
7
  import { AppWrapper } from './AppWrapper';
8
8
  import { FrameWrapper } from './FrameWrapper';
9
9
  import { ModuleFederationWrapper } from "./ModuleFederationWrapper";
10
10
  class StaticChaynsApi {
11
11
  constructor(values, functions) {
12
- var _deviceInfo$app$name, _deviceInfo$app;
12
+ var _deviceInfo$app;
13
13
  _defineProperty(this, "getUser", () => this._wrapper.values.user);
14
14
  _defineProperty(this, "getSite", () => this._wrapper.values.site);
15
15
  _defineProperty(this, "getCurrentPage", () => this._wrapper.values.currentPage);
@@ -24,7 +24,7 @@ class StaticChaynsApi {
24
24
  const deviceInfo = getDeviceInfo(navigator.userAgent, '');
25
25
  if (values && functions) {
26
26
  wrapper = new ModuleFederationWrapper(values, functions);
27
- } else if ([AppName.Chayns, AppName.ChaynsLauncher, AppName.Sidekick, AppName.TobitChat].includes((_deviceInfo$app$name = (_deviceInfo$app = deviceInfo.app) === null || _deviceInfo$app === void 0 ? void 0 : _deviceInfo$app.name) !== null && _deviceInfo$app$name !== void 0 ? _deviceInfo$app$name : AppName.Unknown) && window.self === window.top) {
27
+ } else if (((_deviceInfo$app = deviceInfo.app) === null || _deviceInfo$app === void 0 ? void 0 : _deviceInfo$app.flavor) === AppFlavor.Chayns && window.self === window.top) {
28
28
  wrapper = new AppWrapper();
29
29
  } else {
30
30
  wrapper = new FrameWrapper();
@@ -36,6 +36,10 @@ export declare const getAccessToken: (...args: Parameters<ChaynsReactFunctions["
36
36
  * This method returns a list of installed share/social media apps.
37
37
  */
38
38
  export declare const getAvailableSharingServices: (...args: Parameters<ChaynsReactFunctions["getAvailableSharingServices"]>) => Promise<import("../types/IChaynsReact").AvailableSharingServices>;
39
+ /**
40
+ * This method allows getting the value of a custom cookie
41
+ */
42
+ export declare const getCustomCookie: (...args: Parameters<ChaynsReactFunctions["getCustomCookie"]>) => Promise<string | undefined>;
39
43
  /**
40
44
  * This method determines your location. If you want to track a route, use addGeoLocationListener.
41
45
  */
@@ -146,6 +150,10 @@ export declare const sendMessageToUser: (...args: Parameters<ChaynsReactFunction
146
150
  * Switches admin mode, also toggles admin switch in top frame.
147
151
  */
148
152
  export declare const setAdminMode: (...args: Parameters<ChaynsReactFunctions["setAdminMode"]>) => Promise<void>;
153
+ /**
154
+ * This method sets the value for a custom cookie
155
+ */
156
+ export declare const setCustomCookie: (...args: Parameters<ChaynsReactFunctions["setCustomCookie"]>) => Promise<void>;
149
157
  /**
150
158
  * Sets the display timeout, only works in chayns App.
151
159
  */
@@ -352,6 +352,9 @@ export interface ChaynsReactFunctions {
352
352
  customCallbackFunction: (type: string, data: unknown) => Promise<unknown>;
353
353
  getAvailableSharingServices: () => Promise<AvailableSharingServices>;
354
354
  getAccessToken: (value?: AccessToken) => Promise<AccessTokenResult>;
355
+ getCustomCookie: (value: {
356
+ name: string;
357
+ }) => Promise<string | undefined>;
355
358
  getGeoLocation: (value: {
356
359
  timeout?: number;
357
360
  silent?: boolean;
@@ -381,6 +384,11 @@ export interface ChaynsReactFunctions {
381
384
  sendMessageToPage: (message: IntercomMessage) => Promise<Response>;
382
385
  sendMessageToUser: (userId: number, message: IntercomMessage) => Promise<Response>;
383
386
  setAdminMode: (enabled: boolean) => Promise<void>;
387
+ setCustomCookie: (value: {
388
+ name: string;
389
+ value: string | null;
390
+ expireDate?: string | number | Date;
391
+ }) => Promise<void>;
384
392
  setDisplayTimeout: (enabled: boolean) => Promise<DisplayTimeout>;
385
393
  setFloatingButton: (value: FloatingButton, callback: () => void) => Promise<void>;
386
394
  setHeight: (height: number) => Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chayns-api",
3
- "version": "2.2.12",
3
+ "version": "2.2.14",
4
4
  "description": "new chayns api",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",