@zeniai/client-epic-state 4.14.59 → 4.14.60
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/lib/init.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Pusher, { Options } from 'pusher-js
|
|
1
|
+
import Pusher, { Options } from 'pusher-js';
|
|
2
2
|
import { Store } from 'redux';
|
|
3
3
|
import { ID } from './commonStateTypes/common';
|
|
4
4
|
import { RootState } from './reducer';
|
|
@@ -14,7 +14,6 @@ export declare let store: ZeniStore;
|
|
|
14
14
|
export default function initialize(restEndPoints: RESTAPIEndpoints, userId?: string, sessionId?: string, tenantId?: string): ZeniStore;
|
|
15
15
|
export interface PusherAuthPayload {
|
|
16
16
|
auth: ID;
|
|
17
|
-
shared_secret: ID;
|
|
18
17
|
}
|
|
19
18
|
/**
|
|
20
19
|
* Call initializePusher before using pusher in web-app
|
|
@@ -51,3 +50,4 @@ export declare function zeniAPIClientConfig(): {
|
|
|
51
50
|
* @param tenantId tenant id
|
|
52
51
|
*/
|
|
53
52
|
export declare function initializeWithNewStore(restEndPoints: RESTAPIEndpoints, userId: string, sessionId: string, tenantId: string): ZeniStore;
|
|
53
|
+
export declare function initialize3rdPartyExtensions(): void;
|
package/lib/init.js
CHANGED
|
@@ -18,9 +18,9 @@ exports.initializePusher = initializePusher;
|
|
|
18
18
|
exports.updateZeniAPIClientConfig = updateZeniAPIClientConfig;
|
|
19
19
|
exports.zeniAPIClientConfig = zeniAPIClientConfig;
|
|
20
20
|
exports.initializeWithNewStore = initializeWithNewStore;
|
|
21
|
-
|
|
21
|
+
exports.initialize3rdPartyExtensions = initialize3rdPartyExtensions;
|
|
22
|
+
const pusher_js_1 = __importDefault(require("pusher-js"));
|
|
22
23
|
const configureStore_1 = __importDefault(require("./configureStore"));
|
|
23
|
-
const initialize3rdPartyExtensions_1 = require("./initialize3rdPartyExtensions");
|
|
24
24
|
const zeniAPI_1 = require("./zeniAPI");
|
|
25
25
|
let pusher;
|
|
26
26
|
let initialized = false;
|
|
@@ -36,7 +36,7 @@ function initialize(restEndPoints, userId, sessionId, tenantId) {
|
|
|
36
36
|
}
|
|
37
37
|
initialized = true;
|
|
38
38
|
console.info(`initializing with ${JSON.stringify(restEndPoints)}`);
|
|
39
|
-
|
|
39
|
+
initialize3rdPartyExtensions();
|
|
40
40
|
exports.zeniAPI = new zeniAPI_1.ZeniAPIClient(restEndPoints, userId, sessionId, tenantId);
|
|
41
41
|
exports.store = (0, configureStore_1.default)(exports.zeniAPI, false);
|
|
42
42
|
return exports.store;
|
|
@@ -57,7 +57,7 @@ function initializePusher(pusherClientSecret, options, headers, reInitialize = f
|
|
|
57
57
|
return pusher;
|
|
58
58
|
}
|
|
59
59
|
const endpoint = `${exports.zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/notifications/push_notification/auth`;
|
|
60
|
-
pusher = new
|
|
60
|
+
pusher = new pusher_js_1.default(pusherClientSecret, Object.assign(Object.assign({}, options), { channelAuthorization: {
|
|
61
61
|
endpoint,
|
|
62
62
|
transport: 'ajax',
|
|
63
63
|
customHandler: (params, callback) => customHandler(params, headers, callback),
|
|
@@ -79,10 +79,7 @@ const customHandler = (params, headers, callback) => __awaiter(void 0, void 0, v
|
|
|
79
79
|
.toPromise()
|
|
80
80
|
.then((response) => {
|
|
81
81
|
if (response.data != null) {
|
|
82
|
-
callback(null, {
|
|
83
|
-
auth: response.data.auth,
|
|
84
|
-
shared_secret: response.data.shared_secret,
|
|
85
|
-
});
|
|
82
|
+
callback(null, { auth: response.data.auth });
|
|
86
83
|
isPusherInitialized = true;
|
|
87
84
|
}
|
|
88
85
|
})
|
|
@@ -122,7 +119,18 @@ function zeniAPIClientConfig() {
|
|
|
122
119
|
*/
|
|
123
120
|
function initializeWithNewStore(restEndPoints, userId, sessionId, tenantId) {
|
|
124
121
|
console.info(`initializeWithNewStore with ${JSON.stringify(restEndPoints)}`);
|
|
125
|
-
|
|
122
|
+
initialize3rdPartyExtensions();
|
|
126
123
|
const zeniHttpClient = new zeniAPI_1.ZeniAPIClient(restEndPoints, userId, sessionId, tenantId);
|
|
127
124
|
return (0, configureStore_1.default)(zeniHttpClient, false);
|
|
128
125
|
}
|
|
126
|
+
/**
|
|
127
|
+
* Exported for testing purpose. Not intended to be used in any other place!
|
|
128
|
+
*/
|
|
129
|
+
let thirdPartyExtensionsInitialized = false;
|
|
130
|
+
function initialize3rdPartyExtensions() {
|
|
131
|
+
if (thirdPartyExtensionsInitialized) {
|
|
132
|
+
console.warn('3rd party extensions already initialized!');
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
thirdPartyExtensionsInitialized = true;
|
|
136
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.14.
|
|
3
|
+
"version": "4.14.60",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function initialize3rdPartyExtensions(): void;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.initialize3rdPartyExtensions = initialize3rdPartyExtensions;
|
|
4
|
-
/**
|
|
5
|
-
* Exported for testing purpose. Not intended to be used in any other place!
|
|
6
|
-
*/
|
|
7
|
-
let thirdPartyExtensionsInitialized = false;
|
|
8
|
-
function initialize3rdPartyExtensions() {
|
|
9
|
-
if (thirdPartyExtensionsInitialized) {
|
|
10
|
-
console.warn('3rd party extensions already initialized!');
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
thirdPartyExtensionsInitialized = true;
|
|
14
|
-
}
|