@staffbase/plugins-client-sdk 3.0.2 → 3.1.0
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/plugins-client-sdk.esm.js +45 -5
- package/dist/plugins-client-sdk.esm.js.map +1 -1
- package/dist/plugins-client-sdk.js +45 -4
- package/dist/plugins-client-sdk.js.map +1 -1
- package/dist/plugins-client-sdk.umd.js +45 -4
- package/dist/plugins-client-sdk.umd.js.map +1 -1
- package/dist/plugins-client-sdk.umd.min.js +3 -3
- package/dist/plugins-client-sdk.umd.min.js.map +1 -1
- package/package.json +8 -8
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* Bundle of @staffbase/plugins-client-sdk
|
|
3
3
|
* @file Staffbase plugins client SDK for JavaScript
|
|
4
4
|
* @see https://github.com/Staffbase/plugins-client-sdk#readme
|
|
5
|
-
* @version 3.0.0-alpha.
|
|
5
|
+
* @version 3.0.0-alpha.4
|
|
6
6
|
*
|
|
7
7
|
* @author Stefan Staude <stefan.staude@staffbase.com>
|
|
8
8
|
* @author Daniel Große <daniel.grosse@staffbase.com>
|
|
9
9
|
*
|
|
10
|
-
* @copyright
|
|
10
|
+
* @copyright 2026
|
|
11
11
|
* @license Apache-2.0
|
|
12
12
|
*/
|
|
13
13
|
|
|
@@ -392,6 +392,7 @@ const commands = {
|
|
|
392
392
|
version: 'app-version',
|
|
393
393
|
mobile: 'app-mobile',
|
|
394
394
|
native: 'app-native',
|
|
395
|
+
instanceUrl: 'instance-url',
|
|
395
396
|
openLink: 'openExternalLink',
|
|
396
397
|
nativeUpload: 'nativeFileUpload',
|
|
397
398
|
nativeShare: 'nativeShareDialog',
|
|
@@ -496,6 +497,12 @@ var locales = {
|
|
|
496
497
|
name: 'English',
|
|
497
498
|
localizedName: 'English'
|
|
498
499
|
},
|
|
500
|
+
enGB: {
|
|
501
|
+
key: 'enGB',
|
|
502
|
+
locale: 'en_GB',
|
|
503
|
+
name: 'English (United Kingdom)',
|
|
504
|
+
localizedName: 'English (United Kingdom)'
|
|
505
|
+
},
|
|
499
506
|
es: {
|
|
500
507
|
key: 'es',
|
|
501
508
|
locale: 'es_ES',
|
|
@@ -997,6 +1004,18 @@ const getUserContentLocale$2 = () => {
|
|
|
997
1004
|
return locale;
|
|
998
1005
|
};
|
|
999
1006
|
|
|
1007
|
+
/**
|
|
1008
|
+
* Get the Staffbase instance URL / frontend domain.
|
|
1009
|
+
*
|
|
1010
|
+
* Uses ancestorOrigins when available (chrome/safari in iframe),
|
|
1011
|
+
* falls back to document.referrer or empty string.
|
|
1012
|
+
*
|
|
1013
|
+
* @return {String} the instance URL
|
|
1014
|
+
*/
|
|
1015
|
+
const getInstanceUrl$2 = () => {
|
|
1016
|
+
return window.location.ancestorOrigins && window.location.ancestorOrigins[0] || document.referrer || '';
|
|
1017
|
+
};
|
|
1018
|
+
|
|
1000
1019
|
let connection$1 = null;
|
|
1001
1020
|
const fallbackKickIn = 500;
|
|
1002
1021
|
|
|
@@ -1053,6 +1072,8 @@ const sendMessage$2 = async function (cmd) {
|
|
|
1053
1072
|
return getPreferredContentLocale$2.apply(null, payload);
|
|
1054
1073
|
case commands.userContentLocale:
|
|
1055
1074
|
return getUserContentLocale$2();
|
|
1075
|
+
case commands.instanceUrl:
|
|
1076
|
+
return getInstanceUrl$2();
|
|
1056
1077
|
case commands.nativeUpload:
|
|
1057
1078
|
case commands.nativeShare:
|
|
1058
1079
|
return unSupported();
|
|
@@ -1189,7 +1210,8 @@ const get = id => {
|
|
|
1189
1210
|
const dataStore = _ref => {
|
|
1190
1211
|
let {
|
|
1191
1212
|
platform,
|
|
1192
|
-
language
|
|
1213
|
+
language,
|
|
1214
|
+
instance
|
|
1193
1215
|
} = _ref;
|
|
1194
1216
|
return {
|
|
1195
1217
|
mobile: platform.mobile,
|
|
@@ -1198,7 +1220,8 @@ const dataStore = _ref => {
|
|
|
1198
1220
|
ios: platform.native === 'ios',
|
|
1199
1221
|
android: platform.native === 'android',
|
|
1200
1222
|
langInfos: language,
|
|
1201
|
-
branchDefaultLanguage: language.branchDefaultLanguage
|
|
1223
|
+
branchDefaultLanguage: language.branchDefaultLanguage,
|
|
1224
|
+
instanceUrl: instance && instance.url || ''
|
|
1202
1225
|
};
|
|
1203
1226
|
};
|
|
1204
1227
|
let connection = null;
|
|
@@ -1307,6 +1330,7 @@ const sendMessage$1 = store => async function (cmd) {
|
|
|
1307
1330
|
case commands.ios:
|
|
1308
1331
|
case commands.android:
|
|
1309
1332
|
case commands.branchDefaultLang:
|
|
1333
|
+
case commands.instanceUrl:
|
|
1310
1334
|
return store[reversedCommands[cmd]];
|
|
1311
1335
|
case commands.langInfos:
|
|
1312
1336
|
case commands.openLink:
|
|
@@ -1519,6 +1543,15 @@ const getUserContentLocale$1 = async () => {
|
|
|
1519
1543
|
return sendMessage(commands.langInfos).then(res => res.userContentLocale);
|
|
1520
1544
|
};
|
|
1521
1545
|
|
|
1546
|
+
/**
|
|
1547
|
+
* Get the Staffbase instance URL / frontend domain.
|
|
1548
|
+
*
|
|
1549
|
+
* @return {Promise<string>}
|
|
1550
|
+
*/
|
|
1551
|
+
const getInstanceUrl$1 = async () => {
|
|
1552
|
+
return sendMessage(commands.instanceUrl);
|
|
1553
|
+
};
|
|
1554
|
+
|
|
1522
1555
|
/**
|
|
1523
1556
|
* Compare [semver](https://semver.org/) version strings to find greater, equal or lesser.
|
|
1524
1557
|
* This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`.
|
|
@@ -1732,6 +1765,13 @@ const getPreferredContentLocale = async content => getPreferredContentLocale$1(c
|
|
|
1732
1765
|
*/
|
|
1733
1766
|
const getUserContentLocale = async () => getUserContentLocale$1();
|
|
1734
1767
|
|
|
1768
|
+
/**
|
|
1769
|
+
* Get the Staffbase instance URL / frontend domain.
|
|
1770
|
+
* @function
|
|
1771
|
+
* @return {Promise<string>}
|
|
1772
|
+
*/
|
|
1773
|
+
const getInstanceUrl = async () => getInstanceUrl$1();
|
|
1774
|
+
|
|
1735
1775
|
/**
|
|
1736
1776
|
* Open a share dialog on native devices
|
|
1737
1777
|
*
|
|
@@ -1750,5 +1790,5 @@ const getUserContentLocale = async () => getUserContentLocale$1();
|
|
|
1750
1790
|
const openNativeShareDialog = async content => openNativeShareDialog$1(content);
|
|
1751
1791
|
/* experimental */
|
|
1752
1792
|
|
|
1753
|
-
export { deviceCanDownload, getAppVersion, getBranchDefaultLanguage, getBranchLanguages, getContentLanguages, getPreferredContentLocale, getUserContentLocale, isAndroidDevice, isIosDevice, isMobileApp, isNativeApp, openLink, openLinkExternal, openLinkInternal, openNativeFileDialog, openNativeShareDialog };
|
|
1793
|
+
export { deviceCanDownload, getAppVersion, getBranchDefaultLanguage, getBranchLanguages, getContentLanguages, getInstanceUrl, getPreferredContentLocale, getUserContentLocale, isAndroidDevice, isIosDevice, isMobileApp, isNativeApp, openLink, openLinkExternal, openLinkInternal, openNativeFileDialog, openNativeShareDialog };
|
|
1754
1794
|
//# sourceMappingURL=plugins-client-sdk.esm.js.map
|