chayns-api 1.0.65 → 1.0.67
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.
- package/dist/cjs/calls/index.js +8 -2
- package/dist/cjs/wrapper/AppWrapper.js +10 -14
- package/dist/cjs/wrapper/FrameWrapper.js +5 -1
- package/dist/esm/calls/index.js +5 -0
- package/dist/esm/wrapper/AppWrapper.js +10 -15
- package/dist/esm/wrapper/FrameWrapper.js +5 -1
- package/dist/types/calls/index.d.ts +4 -0
- package/dist/types/types/IChaynsReact.d.ts +4 -0
- package/package.json +1 -1
package/dist/cjs/calls/index.js
CHANGED
|
@@ -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.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;
|
|
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 = exports.addAnonymousAccount = void 0;
|
|
7
7
|
var _moduleWrapper = require("../components/moduleWrapper");
|
|
8
8
|
/**
|
|
9
9
|
* This adds a listener to determine your location.
|
|
@@ -251,11 +251,17 @@ const createDialog = (...args) => _moduleWrapper.moduleWrapper.current.functions
|
|
|
251
251
|
*/
|
|
252
252
|
exports.createDialog = createDialog;
|
|
253
253
|
const setOverlay = (...args) => _moduleWrapper.moduleWrapper.current.functions.setOverlay(...args);
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Generates a temp accesstoken, only valid for short period of time (~3 days), works only when no user is logged in
|
|
257
|
+
*/
|
|
258
|
+
exports.setOverlay = setOverlay;
|
|
259
|
+
const addAnonymousAccount = () => _moduleWrapper.moduleWrapper.current.functions.addAnonymousAccount();
|
|
254
260
|
/**
|
|
255
261
|
* Returns user information, only when user is logged in
|
|
256
262
|
* @category User functions
|
|
257
263
|
*/
|
|
258
|
-
exports.
|
|
264
|
+
exports.addAnonymousAccount = addAnonymousAccount;
|
|
259
265
|
const getUser = () => _moduleWrapper.moduleWrapper.current.values.user;
|
|
260
266
|
exports.getUser = getUser;
|
|
261
267
|
const getSite = () => _moduleWrapper.moduleWrapper.current.values.site;
|
|
@@ -559,6 +559,9 @@ class AppWrapper {
|
|
|
559
559
|
buttonType: -1
|
|
560
560
|
});
|
|
561
561
|
}
|
|
562
|
+
},
|
|
563
|
+
addAnonymousAccount: async () => {
|
|
564
|
+
return this.appCall(302);
|
|
562
565
|
}
|
|
563
566
|
};
|
|
564
567
|
dialogs = [];
|
|
@@ -568,22 +571,15 @@ class AppWrapper {
|
|
|
568
571
|
}
|
|
569
572
|
async init() {
|
|
570
573
|
this.values = this.mapOldApiToNew(await this.appCall(18));
|
|
571
|
-
const callbackName = `chaynsApiV5Callback_${this.counter++}`;
|
|
572
|
-
window.disablev4AccessTokenChangeListener = true;
|
|
573
|
-
window[callbackName] = ({
|
|
574
|
-
retVal: value
|
|
575
|
-
}) => {
|
|
576
|
-
if ('tobitAccessToken' in value) {
|
|
577
|
-
this.accessToken = value.tobitAccessToken;
|
|
578
|
-
} else {
|
|
579
|
-
this.mapOldApiToNew(value);
|
|
580
|
-
}
|
|
581
|
-
};
|
|
582
574
|
this.appCall(66, {
|
|
583
575
|
enabled: true,
|
|
584
|
-
callback:
|
|
585
|
-
|
|
586
|
-
|
|
576
|
+
callback: value => {
|
|
577
|
+
if ('tobitAccessToken' in value) {
|
|
578
|
+
this.accessToken = value.tobitAccessToken;
|
|
579
|
+
} else {
|
|
580
|
+
this.mapOldApiToNew(value);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
587
583
|
});
|
|
588
584
|
return undefined;
|
|
589
585
|
}
|
|
@@ -296,7 +296,11 @@ class FrameWrapper {
|
|
|
296
296
|
// this.exposedFunctions.removeDialogHostEventListener(0);
|
|
297
297
|
}
|
|
298
298
|
},
|
|
299
|
-
removeDialogClientEventListener: async () => {}
|
|
299
|
+
removeDialogClientEventListener: async () => {},
|
|
300
|
+
addAnonymousAccount: async () => {
|
|
301
|
+
if (!this.initialized) await this.ready;
|
|
302
|
+
return this.exposedFunctions.addAnonymousAccount();
|
|
303
|
+
}
|
|
300
304
|
};
|
|
301
305
|
initialized = false;
|
|
302
306
|
constructor() {
|
package/dist/esm/calls/index.js
CHANGED
|
@@ -294,6 +294,11 @@ export const createDialog = function () {
|
|
|
294
294
|
export const setOverlay = function () {
|
|
295
295
|
return moduleWrapper.current.functions.setOverlay(...arguments);
|
|
296
296
|
};
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Generates a temp accesstoken, only valid for short period of time (~3 days), works only when no user is logged in
|
|
300
|
+
*/
|
|
301
|
+
export const addAnonymousAccount = () => moduleWrapper.current.functions.addAnonymousAccount();
|
|
297
302
|
/**
|
|
298
303
|
* Returns user information, only when user is logged in
|
|
299
304
|
* @category User functions
|
|
@@ -515,6 +515,9 @@ export class AppWrapper {
|
|
|
515
515
|
buttonType: -1
|
|
516
516
|
});
|
|
517
517
|
}
|
|
518
|
+
},
|
|
519
|
+
addAnonymousAccount: async () => {
|
|
520
|
+
return this.appCall(302);
|
|
518
521
|
}
|
|
519
522
|
});
|
|
520
523
|
_defineProperty(this, "dialogs", []);
|
|
@@ -566,23 +569,15 @@ export class AppWrapper {
|
|
|
566
569
|
}
|
|
567
570
|
async init() {
|
|
568
571
|
this.values = this.mapOldApiToNew(await this.appCall(18));
|
|
569
|
-
const callbackName = `chaynsApiV5Callback_${this.counter++}`;
|
|
570
|
-
window.disablev4AccessTokenChangeListener = true;
|
|
571
|
-
window[callbackName] = _ref2 => {
|
|
572
|
-
let {
|
|
573
|
-
retVal: value
|
|
574
|
-
} = _ref2;
|
|
575
|
-
if ('tobitAccessToken' in value) {
|
|
576
|
-
this.accessToken = value.tobitAccessToken;
|
|
577
|
-
} else {
|
|
578
|
-
this.mapOldApiToNew(value);
|
|
579
|
-
}
|
|
580
|
-
};
|
|
581
572
|
this.appCall(66, {
|
|
582
573
|
enabled: true,
|
|
583
|
-
callback:
|
|
584
|
-
|
|
585
|
-
|
|
574
|
+
callback: value => {
|
|
575
|
+
if ('tobitAccessToken' in value) {
|
|
576
|
+
this.accessToken = value.tobitAccessToken;
|
|
577
|
+
} else {
|
|
578
|
+
this.mapOldApiToNew(value);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
586
581
|
});
|
|
587
582
|
return undefined;
|
|
588
583
|
}
|
|
@@ -290,7 +290,11 @@ export class FrameWrapper {
|
|
|
290
290
|
// this.exposedFunctions.removeDialogHostEventListener(0);
|
|
291
291
|
}
|
|
292
292
|
},
|
|
293
|
-
removeDialogClientEventListener: async () => {}
|
|
293
|
+
removeDialogClientEventListener: async () => {},
|
|
294
|
+
addAnonymousAccount: async () => {
|
|
295
|
+
if (!this.initialized) await this.ready;
|
|
296
|
+
return this.exposedFunctions.addAnonymousAccount();
|
|
297
|
+
}
|
|
294
298
|
});
|
|
295
299
|
_defineProperty(this, "initialized", false);
|
|
296
300
|
const initialDataTag = document.querySelector('#__CHAYNS_DATA__');
|
|
@@ -205,6 +205,10 @@ export declare const createDialog: (config: import("../types/IChaynsReact").Dial
|
|
|
205
205
|
* Displays an overlay
|
|
206
206
|
*/
|
|
207
207
|
export declare const setOverlay: (value: import("../types/IChaynsReact").ShowOverlay, callback: () => void) => Promise<void>;
|
|
208
|
+
/**
|
|
209
|
+
* Generates a temp accesstoken, only valid for short period of time (~3 days), works only when no user is logged in
|
|
210
|
+
*/
|
|
211
|
+
export declare const addAnonymousAccount: () => Promise<import("../types/IChaynsReact").AnonymousAccountResult>;
|
|
208
212
|
/**
|
|
209
213
|
* Returns user information, only when user is logged in
|
|
210
214
|
* @category User functions
|
|
@@ -285,6 +285,7 @@ export interface ChaynsReactFunctions {
|
|
|
285
285
|
dispatchEventToDialogHost: (data: object) => Promise<void>;
|
|
286
286
|
addDialogHostEventListener: (callback: (data: object) => void) => Promise<number>;
|
|
287
287
|
removeDialogHostEventListener: (id: number) => Promise<void>;
|
|
288
|
+
addAnonymousAccount: () => Promise<AnonymousAccountResult>;
|
|
288
289
|
}
|
|
289
290
|
export type DialogResult = {
|
|
290
291
|
open: () => Promise<any>;
|
|
@@ -813,4 +814,7 @@ export declare enum DialogIconType {
|
|
|
813
814
|
WarningIcon = "%%DialogWarningIcon%%",
|
|
814
815
|
ErrorIcon = "%%DialogErrorIcon%%"
|
|
815
816
|
}
|
|
817
|
+
export type AnonymousAccountResult = {
|
|
818
|
+
token: string;
|
|
819
|
+
};
|
|
816
820
|
export {};
|