@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
|
|
|
@@ -398,6 +398,7 @@
|
|
|
398
398
|
version: 'app-version',
|
|
399
399
|
mobile: 'app-mobile',
|
|
400
400
|
native: 'app-native',
|
|
401
|
+
instanceUrl: 'instance-url',
|
|
401
402
|
openLink: 'openExternalLink',
|
|
402
403
|
nativeUpload: 'nativeFileUpload',
|
|
403
404
|
nativeShare: 'nativeShareDialog',
|
|
@@ -502,6 +503,12 @@
|
|
|
502
503
|
name: 'English',
|
|
503
504
|
localizedName: 'English'
|
|
504
505
|
},
|
|
506
|
+
enGB: {
|
|
507
|
+
key: 'enGB',
|
|
508
|
+
locale: 'en_GB',
|
|
509
|
+
name: 'English (United Kingdom)',
|
|
510
|
+
localizedName: 'English (United Kingdom)'
|
|
511
|
+
},
|
|
505
512
|
es: {
|
|
506
513
|
key: 'es',
|
|
507
514
|
locale: 'es_ES',
|
|
@@ -1003,6 +1010,18 @@
|
|
|
1003
1010
|
return locale;
|
|
1004
1011
|
};
|
|
1005
1012
|
|
|
1013
|
+
/**
|
|
1014
|
+
* Get the Staffbase instance URL / frontend domain.
|
|
1015
|
+
*
|
|
1016
|
+
* Uses ancestorOrigins when available (chrome/safari in iframe),
|
|
1017
|
+
* falls back to document.referrer or empty string.
|
|
1018
|
+
*
|
|
1019
|
+
* @return {String} the instance URL
|
|
1020
|
+
*/
|
|
1021
|
+
const getInstanceUrl$2 = () => {
|
|
1022
|
+
return window.location.ancestorOrigins && window.location.ancestorOrigins[0] || document.referrer || '';
|
|
1023
|
+
};
|
|
1024
|
+
|
|
1006
1025
|
let connection$1 = null;
|
|
1007
1026
|
const fallbackKickIn = 500;
|
|
1008
1027
|
|
|
@@ -1059,6 +1078,8 @@
|
|
|
1059
1078
|
return getPreferredContentLocale$2.apply(null, payload);
|
|
1060
1079
|
case commands.userContentLocale:
|
|
1061
1080
|
return getUserContentLocale$2();
|
|
1081
|
+
case commands.instanceUrl:
|
|
1082
|
+
return getInstanceUrl$2();
|
|
1062
1083
|
case commands.nativeUpload:
|
|
1063
1084
|
case commands.nativeShare:
|
|
1064
1085
|
return unSupported();
|
|
@@ -1195,7 +1216,8 @@
|
|
|
1195
1216
|
const dataStore = _ref => {
|
|
1196
1217
|
let {
|
|
1197
1218
|
platform,
|
|
1198
|
-
language
|
|
1219
|
+
language,
|
|
1220
|
+
instance
|
|
1199
1221
|
} = _ref;
|
|
1200
1222
|
return {
|
|
1201
1223
|
mobile: platform.mobile,
|
|
@@ -1204,7 +1226,8 @@
|
|
|
1204
1226
|
ios: platform.native === 'ios',
|
|
1205
1227
|
android: platform.native === 'android',
|
|
1206
1228
|
langInfos: language,
|
|
1207
|
-
branchDefaultLanguage: language.branchDefaultLanguage
|
|
1229
|
+
branchDefaultLanguage: language.branchDefaultLanguage,
|
|
1230
|
+
instanceUrl: instance && instance.url || ''
|
|
1208
1231
|
};
|
|
1209
1232
|
};
|
|
1210
1233
|
let connection = null;
|
|
@@ -1313,6 +1336,7 @@
|
|
|
1313
1336
|
case commands.ios:
|
|
1314
1337
|
case commands.android:
|
|
1315
1338
|
case commands.branchDefaultLang:
|
|
1339
|
+
case commands.instanceUrl:
|
|
1316
1340
|
return store[reversedCommands[cmd]];
|
|
1317
1341
|
case commands.langInfos:
|
|
1318
1342
|
case commands.openLink:
|
|
@@ -1525,6 +1549,15 @@
|
|
|
1525
1549
|
return sendMessage(commands.langInfos).then(res => res.userContentLocale);
|
|
1526
1550
|
};
|
|
1527
1551
|
|
|
1552
|
+
/**
|
|
1553
|
+
* Get the Staffbase instance URL / frontend domain.
|
|
1554
|
+
*
|
|
1555
|
+
* @return {Promise<string>}
|
|
1556
|
+
*/
|
|
1557
|
+
const getInstanceUrl$1 = async () => {
|
|
1558
|
+
return sendMessage(commands.instanceUrl);
|
|
1559
|
+
};
|
|
1560
|
+
|
|
1528
1561
|
/**
|
|
1529
1562
|
* Compare [semver](https://semver.org/) version strings to find greater, equal or lesser.
|
|
1530
1563
|
* 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`.
|
|
@@ -1738,6 +1771,13 @@
|
|
|
1738
1771
|
*/
|
|
1739
1772
|
const getUserContentLocale = async () => getUserContentLocale$1();
|
|
1740
1773
|
|
|
1774
|
+
/**
|
|
1775
|
+
* Get the Staffbase instance URL / frontend domain.
|
|
1776
|
+
* @function
|
|
1777
|
+
* @return {Promise<string>}
|
|
1778
|
+
*/
|
|
1779
|
+
const getInstanceUrl = async () => getInstanceUrl$1();
|
|
1780
|
+
|
|
1741
1781
|
/**
|
|
1742
1782
|
* Open a share dialog on native devices
|
|
1743
1783
|
*
|
|
@@ -1761,6 +1801,7 @@
|
|
|
1761
1801
|
exports.getBranchDefaultLanguage = getBranchDefaultLanguage;
|
|
1762
1802
|
exports.getBranchLanguages = getBranchLanguages;
|
|
1763
1803
|
exports.getContentLanguages = getContentLanguages;
|
|
1804
|
+
exports.getInstanceUrl = getInstanceUrl;
|
|
1764
1805
|
exports.getPreferredContentLocale = getPreferredContentLocale;
|
|
1765
1806
|
exports.getUserContentLocale = getUserContentLocale;
|
|
1766
1807
|
exports.isAndroidDevice = isAndroidDevice;
|