@smartico/public-api 0.0.54 → 0.0.55
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/SmarticoAPI.d.ts +2 -1
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +7 -4
- package/dist/index.modern.mjs.map +1 -1
- package/package.json +1 -1
- package/src/SmarticoAPI.ts +10 -4
package/dist/SmarticoAPI.d.ts
CHANGED
|
@@ -36,7 +36,8 @@ declare class SmarticoAPI {
|
|
|
36
36
|
private logHTTPTiming;
|
|
37
37
|
tracker?: Tracker;
|
|
38
38
|
constructor(label_api_key: string, brand_api_key: string, messageSender: MessageSender, options?: IOptions);
|
|
39
|
-
static
|
|
39
|
+
static getEnvDnsSuffix(label_api_key: string): string;
|
|
40
|
+
static getEnvId(label_api_key: string): number;
|
|
40
41
|
static getCleanLabelApiKey(label_api_key: string): string;
|
|
41
42
|
static getPublicUrl(label_api_key: string): string;
|
|
42
43
|
static getPublicWsUrl(label_api_key: string): string;
|
package/dist/index.js
CHANGED
|
@@ -826,24 +826,27 @@ var SmarticoAPI = /*#__PURE__*/function () {
|
|
|
826
826
|
this.avatarDomain = SmarticoAPI.getAvatarUrl(label_api_key || ((_options$tracker = options.tracker) == null ? void 0 : _options$tracker.label_api_key));
|
|
827
827
|
this.label_api_key = SmarticoAPI.getCleanLabelApiKey(label_api_key);
|
|
828
828
|
}
|
|
829
|
-
SmarticoAPI.
|
|
829
|
+
SmarticoAPI.getEnvDnsSuffix = function getEnvDnsSuffix(label_api_key) {
|
|
830
830
|
var ENV_ID = label_api_key.length === 38 ? label_api_key.substring(37, 38) : '';
|
|
831
831
|
if (ENV_ID === '1' || ENV_ID === '2') {
|
|
832
832
|
ENV_ID = '';
|
|
833
833
|
}
|
|
834
834
|
return ENV_ID;
|
|
835
835
|
};
|
|
836
|
+
SmarticoAPI.getEnvId = function getEnvId(label_api_key) {
|
|
837
|
+
return label_api_key.length === 38 ? parseInt(label_api_key.substring(37, 38), 10) : 2;
|
|
838
|
+
};
|
|
836
839
|
SmarticoAPI.getCleanLabelApiKey = function getCleanLabelApiKey(label_api_key) {
|
|
837
840
|
return label_api_key.substring(0, 36);
|
|
838
841
|
};
|
|
839
842
|
SmarticoAPI.getPublicUrl = function getPublicUrl(label_api_key) {
|
|
840
|
-
return PUBLIC_API_URL.replace('{ENV_ID}', SmarticoAPI.
|
|
843
|
+
return PUBLIC_API_URL.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
|
|
841
844
|
};
|
|
842
845
|
SmarticoAPI.getPublicWsUrl = function getPublicWsUrl(label_api_key) {
|
|
843
|
-
return C_SOCKET_PROD.replace('{ENV_ID}', SmarticoAPI.
|
|
846
|
+
return C_SOCKET_PROD.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
|
|
844
847
|
};
|
|
845
848
|
SmarticoAPI.getAvatarUrl = function getAvatarUrl(label_api_key) {
|
|
846
|
-
return AVATAR_DOMAIN.replace('{ENV_ID}', SmarticoAPI.
|
|
849
|
+
return AVATAR_DOMAIN.replace('{ENV_ID}', SmarticoAPI.getEnvDnsSuffix(label_api_key));
|
|
847
850
|
};
|
|
848
851
|
var _proto = SmarticoAPI.prototype;
|
|
849
852
|
_proto.send = function send(message, expectCID) {
|