@frontegg/rest-api 3.1.74-alpha.9437937621 → 3.1.74-alpha.9446693332
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/ContextHolder/index.d.ts +16 -16
- package/ContextHolder/index.js +74 -74
- package/connectivity/index.d.ts +8 -8
- package/index.js +1 -1
- package/node/ContextHolder/index.js +74 -74
- package/node/index.js +1 -1
- package/node/subscriptions/index.js +14 -24
- package/package.json +1 -1
- package/subscriptions/index.d.ts +2 -2
- package/subscriptions/index.js +14 -24
package/ContextHolder/index.d.ts
CHANGED
|
@@ -30,32 +30,32 @@ export declare class ContextHolder {
|
|
|
30
30
|
* @deprecated - use ContextHolder.for(appName).setContext instead
|
|
31
31
|
*/
|
|
32
32
|
static setContext(context: ContextOptions, appName?: string): void;
|
|
33
|
-
setContext(context: ContextOptions)
|
|
33
|
+
setContext: (context: ContextOptions) => void;
|
|
34
34
|
/**
|
|
35
35
|
* @deprecated - use ContextHolder.for(appName).setAccessToken instead
|
|
36
36
|
*/
|
|
37
37
|
static setAccessToken(accessToken: string | null, appName?: string): void;
|
|
38
|
-
setAccessToken(accessToken: string | null)
|
|
38
|
+
setAccessToken: (accessToken: string | null) => void;
|
|
39
39
|
/**
|
|
40
40
|
* @deprecated - use ContextHolder.for(appName).setUser instead
|
|
41
41
|
*/
|
|
42
42
|
static setUser(user: IUserProfile | null, appName?: string): void;
|
|
43
|
-
setUser(user: IUserProfile | null)
|
|
43
|
+
setUser: (user: IUserProfile | null) => void;
|
|
44
44
|
/**
|
|
45
45
|
* @deprecated - use ContextHolder.for(appName).setRequestSource instead
|
|
46
46
|
*/
|
|
47
47
|
static setRequestSource(requestSource: RequestSource | null, appName?: string): void;
|
|
48
|
-
setRequestSource(requestSource: RequestSource | null)
|
|
48
|
+
setRequestSource: (requestSource: RequestSource | null) => void;
|
|
49
49
|
/**
|
|
50
50
|
* @deprecated - use ContextHolder.for(appName).setOnRedirectTo instead
|
|
51
51
|
*/
|
|
52
52
|
static setOnRedirectTo(onRedirectTo: (path: string, opts?: RedirectOptions) => void, appName?: string): void;
|
|
53
|
-
setOnRedirectTo(onRedirectTo: (path: string, opts?: RedirectOptions) => void)
|
|
53
|
+
setOnRedirectTo: (onRedirectTo: (path: string, opts?: RedirectOptions | undefined) => void) => void;
|
|
54
54
|
/**
|
|
55
55
|
* @deprecated - use ContextHolder.for(appName).setLogout instead
|
|
56
56
|
*/
|
|
57
57
|
static setLogout(logout: (callback?: () => void) => void, logoutUrl: string, appName?: string): void;
|
|
58
|
-
setLogout(logout: (callback?: () => void) => void)
|
|
58
|
+
setLogout: (logout: (callback?: (() => void) | undefined) => void) => void;
|
|
59
59
|
/**
|
|
60
60
|
* App name should also be set for entitlements
|
|
61
61
|
* @deprecated - use ContextHolder.for(appName).setEntitlementsOptions instead
|
|
@@ -63,39 +63,39 @@ export declare class ContextHolder {
|
|
|
63
63
|
* @param appName - app name
|
|
64
64
|
*/
|
|
65
65
|
static setEntitlementsOptions(entitlementsOptions: EntitlementsOptions, appName?: string): void;
|
|
66
|
-
setEntitlementsOptions(entitlementsOptions: EntitlementsOptions)
|
|
66
|
+
setEntitlementsOptions: (entitlementsOptions: EntitlementsOptions) => void;
|
|
67
67
|
/**
|
|
68
68
|
* @deprecated - use ContextHolder.for(appName).setSessionContext instead
|
|
69
69
|
* @param sessionContext frontegg options SessionContext config
|
|
70
70
|
* @param appName - app name
|
|
71
71
|
*/
|
|
72
72
|
static setSessionContext(sessionContext: SessionContext, appName?: string): void;
|
|
73
|
-
setSessionContext(sessionContext: SessionContext)
|
|
73
|
+
setSessionContext: (sessionContext: SessionContext) => void;
|
|
74
74
|
/**
|
|
75
75
|
* @deprecated - use ContextHolder.for(appName).setAppName instead
|
|
76
76
|
*/
|
|
77
77
|
static setAppName(appName: string): void;
|
|
78
|
-
setAppName(appName: string)
|
|
78
|
+
setAppName: (appName: string) => void;
|
|
79
79
|
/**
|
|
80
80
|
* @deprecated - use ContextHolder.for(appName).getContext instead
|
|
81
81
|
*/
|
|
82
82
|
static getContext(appName?: string): ContextOptions;
|
|
83
|
-
getContext()
|
|
83
|
+
getContext: () => ContextOptions;
|
|
84
84
|
/**
|
|
85
85
|
* @deprecated - use ContextHolder.for(appName).getAccessToken instead
|
|
86
86
|
*/
|
|
87
87
|
static getAccessToken(appName?: string): string | null;
|
|
88
|
-
getAccessToken()
|
|
88
|
+
getAccessToken: () => string | null;
|
|
89
89
|
/**
|
|
90
90
|
* @deprecated - use ContextHolder.for(appName).requestSource instead
|
|
91
91
|
*/
|
|
92
92
|
static getRequestSource(appName?: string): RequestSource | null;
|
|
93
|
-
getRequestSource()
|
|
93
|
+
getRequestSource: () => RequestSource | null;
|
|
94
94
|
/**
|
|
95
95
|
* @deprecated - use ContextHolder.for(appName).getUser instead
|
|
96
96
|
*/
|
|
97
97
|
static getUser(appName?: string): IUserProfile | null;
|
|
98
|
-
getUser()
|
|
98
|
+
getUser: () => IUserProfile | null;
|
|
99
99
|
/**
|
|
100
100
|
* @deprecated - use ContextHolder.for(appName).onRedirectTo instead
|
|
101
101
|
*/
|
|
@@ -109,19 +109,19 @@ export declare class ContextHolder {
|
|
|
109
109
|
* @returns shouldLoadEntitlements. Default to false.
|
|
110
110
|
*/
|
|
111
111
|
static shouldLoadEntitlements(appName?: string): boolean;
|
|
112
|
-
shouldLoadEntitlements()
|
|
112
|
+
shouldLoadEntitlements: () => boolean;
|
|
113
113
|
/**
|
|
114
114
|
* @deprecated - use ContextHolder.for(appName).isSessionPerTenantEnabled instead
|
|
115
115
|
* @returns isSessionPerTenantEnabled. Default to false.
|
|
116
116
|
*/
|
|
117
117
|
static isSessionPerTenantEnabled(appName?: string): boolean;
|
|
118
|
-
isSessionPerTenantEnabled()
|
|
118
|
+
isSessionPerTenantEnabled: () => boolean;
|
|
119
119
|
/**
|
|
120
120
|
* @deprecated - use ContextHolder.for(appName).getAppName instead
|
|
121
121
|
* @returns app name value
|
|
122
122
|
*/
|
|
123
123
|
static getAppName(appName?: string): string | null;
|
|
124
|
-
getAppName()
|
|
124
|
+
getAppName: () => string | null;
|
|
125
125
|
}
|
|
126
126
|
/**
|
|
127
127
|
* Frontegg context to be used in the application
|
package/ContextHolder/index.js
CHANGED
|
@@ -12,6 +12,80 @@ export class ContextHolder {
|
|
|
12
12
|
this.entitlementsOptions = null;
|
|
13
13
|
this.appName = null;
|
|
14
14
|
this.sessionContext = void 0;
|
|
15
|
+
|
|
16
|
+
this.setContext = context => {
|
|
17
|
+
this.context = context;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
this.setAccessToken = accessToken => {
|
|
21
|
+
this.accessToken = accessToken;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
this.setUser = user => {
|
|
25
|
+
this.user = user;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
this.setRequestSource = requestSource => {
|
|
29
|
+
this.requestSource = requestSource;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
this.setOnRedirectTo = onRedirectTo => {
|
|
33
|
+
this.onRedirectTo = onRedirectTo;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
this.setLogout = logout => {
|
|
37
|
+
this.logout = logout;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
this.setEntitlementsOptions = entitlementsOptions => {
|
|
41
|
+
this.entitlementsOptions = entitlementsOptions;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
this.setSessionContext = sessionContext => {
|
|
45
|
+
this.sessionContext = sessionContext;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
this.setAppName = appName => {
|
|
49
|
+
this.appName = appName;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
this.getContext = () => {
|
|
53
|
+
var _this$context;
|
|
54
|
+
|
|
55
|
+
return (_this$context = this.context) != null ? _this$context : {
|
|
56
|
+
baseUrl: window.location.href,
|
|
57
|
+
tokenResolver: () => 'my-authentication-token',
|
|
58
|
+
logLevel: 'error'
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
this.getAccessToken = () => {
|
|
63
|
+
return this.accessToken;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
this.getRequestSource = () => {
|
|
67
|
+
return this.requestSource;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
this.getUser = () => {
|
|
71
|
+
return this.user;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
this.shouldLoadEntitlements = () => {
|
|
75
|
+
var _this$entitlementsOpt;
|
|
76
|
+
|
|
77
|
+
return ((_this$entitlementsOpt = this.entitlementsOptions) == null ? void 0 : _this$entitlementsOpt.enabled) || false;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
this.isSessionPerTenantEnabled = () => {
|
|
81
|
+
var _this$sessionContext;
|
|
82
|
+
|
|
83
|
+
return ((_this$sessionContext = this.sessionContext) == null ? void 0 : _this$sessionContext.enableSessionPerTenant) || false;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
this.getAppName = () => {
|
|
87
|
+
return this.appName;
|
|
88
|
+
};
|
|
15
89
|
}
|
|
16
90
|
|
|
17
91
|
static default() {
|
|
@@ -45,42 +119,22 @@ export class ContextHolder {
|
|
|
45
119
|
ContextHolder.for(appName).context = context;
|
|
46
120
|
}
|
|
47
121
|
|
|
48
|
-
setContext(context) {
|
|
49
|
-
this.context = context;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
122
|
static setAccessToken(accessToken, appName = 'default') {
|
|
53
123
|
ContextHolder.for(appName).accessToken = accessToken;
|
|
54
124
|
}
|
|
55
125
|
|
|
56
|
-
setAccessToken(accessToken) {
|
|
57
|
-
this.accessToken = accessToken;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
126
|
static setUser(user, appName = 'default') {
|
|
61
127
|
ContextHolder.for(appName).user = user;
|
|
62
128
|
}
|
|
63
129
|
|
|
64
|
-
setUser(user) {
|
|
65
|
-
this.user = user;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
130
|
static setRequestSource(requestSource, appName = 'default') {
|
|
69
131
|
ContextHolder.for(appName).requestSource = requestSource;
|
|
70
132
|
}
|
|
71
133
|
|
|
72
|
-
setRequestSource(requestSource) {
|
|
73
|
-
this.requestSource = requestSource;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
134
|
static setOnRedirectTo(onRedirectTo, appName = 'default') {
|
|
77
135
|
ContextHolder.for(appName).onRedirectTo = onRedirectTo;
|
|
78
136
|
}
|
|
79
137
|
|
|
80
|
-
setOnRedirectTo(onRedirectTo) {
|
|
81
|
-
this.onRedirectTo = onRedirectTo;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
138
|
static setLogout(logout, logoutUrl, appName = 'default') {
|
|
85
139
|
const context = ContextHolder.for(appName);
|
|
86
140
|
|
|
@@ -93,34 +147,18 @@ export class ContextHolder {
|
|
|
93
147
|
};
|
|
94
148
|
}
|
|
95
149
|
|
|
96
|
-
setLogout(logout) {
|
|
97
|
-
this.logout = logout;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
150
|
static setEntitlementsOptions(entitlementsOptions, appName = 'default') {
|
|
101
151
|
ContextHolder.for(appName).entitlementsOptions = entitlementsOptions;
|
|
102
152
|
}
|
|
103
153
|
|
|
104
|
-
setEntitlementsOptions(entitlementsOptions) {
|
|
105
|
-
this.entitlementsOptions = entitlementsOptions;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
154
|
static setSessionContext(sessionContext, appName = 'default') {
|
|
109
155
|
ContextHolder.for(appName).sessionContext = sessionContext;
|
|
110
156
|
}
|
|
111
157
|
|
|
112
|
-
setSessionContext(sessionContext) {
|
|
113
|
-
this.sessionContext = sessionContext;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
158
|
static setAppName(appName) {
|
|
117
159
|
ContextHolder.for(appName).appName = appName;
|
|
118
160
|
}
|
|
119
161
|
|
|
120
|
-
setAppName(appName) {
|
|
121
|
-
this.appName = appName;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
162
|
static getContext(appName = 'default') {
|
|
125
163
|
var _ContextHolder$for$co;
|
|
126
164
|
|
|
@@ -131,40 +169,18 @@ export class ContextHolder {
|
|
|
131
169
|
};
|
|
132
170
|
}
|
|
133
171
|
|
|
134
|
-
getContext() {
|
|
135
|
-
var _this$context;
|
|
136
|
-
|
|
137
|
-
return (_this$context = this.context) != null ? _this$context : {
|
|
138
|
-
baseUrl: window.location.href,
|
|
139
|
-
tokenResolver: () => 'my-authentication-token',
|
|
140
|
-
logLevel: 'error'
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
|
|
144
172
|
static getAccessToken(appName = 'default') {
|
|
145
173
|
return ContextHolder.for(appName).accessToken;
|
|
146
174
|
}
|
|
147
175
|
|
|
148
|
-
getAccessToken() {
|
|
149
|
-
return this.accessToken;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
176
|
static getRequestSource(appName = 'default') {
|
|
153
177
|
return ContextHolder.for(appName).requestSource;
|
|
154
178
|
}
|
|
155
179
|
|
|
156
|
-
getRequestSource() {
|
|
157
|
-
return this.requestSource;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
180
|
static getUser(appName = 'default') {
|
|
161
181
|
return ContextHolder.for(appName).user;
|
|
162
182
|
}
|
|
163
183
|
|
|
164
|
-
getUser() {
|
|
165
|
-
return this.user;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
184
|
static onRedirectTo(path, opts, appName = 'default') {
|
|
169
185
|
return ContextHolder.for(appName).onRedirectTo(path, opts);
|
|
170
186
|
}
|
|
@@ -179,32 +195,16 @@ export class ContextHolder {
|
|
|
179
195
|
return ((_ContextHolder$for$en = ContextHolder.for(appName).entitlementsOptions) == null ? void 0 : _ContextHolder$for$en.enabled) || false;
|
|
180
196
|
}
|
|
181
197
|
|
|
182
|
-
shouldLoadEntitlements() {
|
|
183
|
-
var _this$entitlementsOpt;
|
|
184
|
-
|
|
185
|
-
return ((_this$entitlementsOpt = this.entitlementsOptions) == null ? void 0 : _this$entitlementsOpt.enabled) || false;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
198
|
static isSessionPerTenantEnabled(appName = 'default') {
|
|
189
199
|
var _ContextHolder$for$se;
|
|
190
200
|
|
|
191
201
|
return ((_ContextHolder$for$se = ContextHolder.for(appName).sessionContext) == null ? void 0 : _ContextHolder$for$se.enableSessionPerTenant) || false;
|
|
192
202
|
}
|
|
193
203
|
|
|
194
|
-
isSessionPerTenantEnabled() {
|
|
195
|
-
var _this$sessionContext;
|
|
196
|
-
|
|
197
|
-
return ((_this$sessionContext = this.sessionContext) == null ? void 0 : _this$sessionContext.enableSessionPerTenant) || false;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
204
|
static getAppName(appName = 'default') {
|
|
201
205
|
return ContextHolder.for(appName).appName;
|
|
202
206
|
}
|
|
203
207
|
|
|
204
|
-
getAppName() {
|
|
205
|
-
return this.appName;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
208
|
}
|
|
209
209
|
ContextHolder._apps = void 0;
|
|
210
210
|
const DEFAULT_APP_NAME = 'default';
|
package/connectivity/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { IWebhookTest, IWebhooksSaveData, ISlackSubscription, IEmailSMSConfigResponse, IEmailSMSSubscriptionResponse } from './interfaces';
|
|
1
|
+
import { IWebhookTest, IWebhooksSaveData, ISlackSubscription, IEmailSMSConfigResponse, IEmailSMSSubscriptionResponse, ISlackChannel, ISlackConfigurations, IWebhookLog, ICategory, IChannelsMap } from './interfaces';
|
|
2
2
|
import { BaseApiClient } from '../BaseApiClient';
|
|
3
3
|
export declare class ConnectivityApi extends BaseApiClient {
|
|
4
4
|
constructor(appName: string);
|
|
5
5
|
/** Get Slack configuration */
|
|
6
|
-
getSlackConfiguration: () => Promise<
|
|
6
|
+
getSlackConfiguration: () => Promise<ISlackConfigurations>;
|
|
7
7
|
/** Get Slack scope */
|
|
8
8
|
getSlackScope: () => Promise<unknown>;
|
|
9
9
|
/** Get Slack channels */
|
|
10
|
-
getSlackChannels: () => Promise<
|
|
10
|
+
getSlackChannels: () => Promise<ISlackChannel[] | undefined>;
|
|
11
11
|
/**
|
|
12
12
|
* Post Slack configuration
|
|
13
13
|
* @param data Slack subscription data
|
|
14
14
|
*/
|
|
15
|
-
postSlackConfiguration: (data: ISlackSubscription) => Promise<
|
|
15
|
+
postSlackConfiguration: (data: ISlackSubscription) => Promise<any>;
|
|
16
16
|
/**
|
|
17
17
|
* Delete Slack configuration
|
|
18
18
|
* @param data Required Slack subscription data
|
|
@@ -108,19 +108,19 @@ export declare class ConnectivityApi extends BaseApiClient {
|
|
|
108
108
|
* Post webhook test
|
|
109
109
|
* @param data Webhook test data
|
|
110
110
|
*/
|
|
111
|
-
postWebhookTest: (data: IWebhookTest) => Promise<
|
|
111
|
+
postWebhookTest: (data: IWebhookTest) => Promise<IWebhookLog>;
|
|
112
112
|
/**
|
|
113
113
|
* Post webhook retry
|
|
114
114
|
* @param id Webhook log ID
|
|
115
115
|
*/
|
|
116
|
-
postWebhookRetry: (id: string) => Promise<
|
|
116
|
+
postWebhookRetry: (id: string) => Promise<IWebhookLog>;
|
|
117
117
|
/** Get event categories */
|
|
118
|
-
getCategories: () => Promise<
|
|
118
|
+
getCategories: () => Promise<ICategory[]>;
|
|
119
119
|
/**
|
|
120
120
|
* Get channel maps
|
|
121
121
|
* @param channels Channel names
|
|
122
122
|
*/
|
|
123
|
-
getChannelMaps: (channels: string) => Promise<
|
|
123
|
+
getChannelMaps: (channels: string) => Promise<IChannelsMap[]>;
|
|
124
124
|
}
|
|
125
125
|
declare const _default: ConnectivityApi;
|
|
126
126
|
export default _default;
|
package/index.js
CHANGED
|
@@ -19,6 +19,80 @@ class ContextHolder {
|
|
|
19
19
|
this.entitlementsOptions = null;
|
|
20
20
|
this.appName = null;
|
|
21
21
|
this.sessionContext = void 0;
|
|
22
|
+
|
|
23
|
+
this.setContext = context => {
|
|
24
|
+
this.context = context;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
this.setAccessToken = accessToken => {
|
|
28
|
+
this.accessToken = accessToken;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
this.setUser = user => {
|
|
32
|
+
this.user = user;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
this.setRequestSource = requestSource => {
|
|
36
|
+
this.requestSource = requestSource;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
this.setOnRedirectTo = onRedirectTo => {
|
|
40
|
+
this.onRedirectTo = onRedirectTo;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
this.setLogout = logout => {
|
|
44
|
+
this.logout = logout;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
this.setEntitlementsOptions = entitlementsOptions => {
|
|
48
|
+
this.entitlementsOptions = entitlementsOptions;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
this.setSessionContext = sessionContext => {
|
|
52
|
+
this.sessionContext = sessionContext;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
this.setAppName = appName => {
|
|
56
|
+
this.appName = appName;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
this.getContext = () => {
|
|
60
|
+
var _this$context;
|
|
61
|
+
|
|
62
|
+
return (_this$context = this.context) != null ? _this$context : {
|
|
63
|
+
baseUrl: window.location.href,
|
|
64
|
+
tokenResolver: () => 'my-authentication-token',
|
|
65
|
+
logLevel: 'error'
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
this.getAccessToken = () => {
|
|
70
|
+
return this.accessToken;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
this.getRequestSource = () => {
|
|
74
|
+
return this.requestSource;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
this.getUser = () => {
|
|
78
|
+
return this.user;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
this.shouldLoadEntitlements = () => {
|
|
82
|
+
var _this$entitlementsOpt;
|
|
83
|
+
|
|
84
|
+
return ((_this$entitlementsOpt = this.entitlementsOptions) == null ? void 0 : _this$entitlementsOpt.enabled) || false;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
this.isSessionPerTenantEnabled = () => {
|
|
88
|
+
var _this$sessionContext;
|
|
89
|
+
|
|
90
|
+
return ((_this$sessionContext = this.sessionContext) == null ? void 0 : _this$sessionContext.enableSessionPerTenant) || false;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
this.getAppName = () => {
|
|
94
|
+
return this.appName;
|
|
95
|
+
};
|
|
22
96
|
}
|
|
23
97
|
|
|
24
98
|
static default() {
|
|
@@ -52,42 +126,22 @@ class ContextHolder {
|
|
|
52
126
|
ContextHolder.for(appName).context = context;
|
|
53
127
|
}
|
|
54
128
|
|
|
55
|
-
setContext(context) {
|
|
56
|
-
this.context = context;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
129
|
static setAccessToken(accessToken, appName = 'default') {
|
|
60
130
|
ContextHolder.for(appName).accessToken = accessToken;
|
|
61
131
|
}
|
|
62
132
|
|
|
63
|
-
setAccessToken(accessToken) {
|
|
64
|
-
this.accessToken = accessToken;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
133
|
static setUser(user, appName = 'default') {
|
|
68
134
|
ContextHolder.for(appName).user = user;
|
|
69
135
|
}
|
|
70
136
|
|
|
71
|
-
setUser(user) {
|
|
72
|
-
this.user = user;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
137
|
static setRequestSource(requestSource, appName = 'default') {
|
|
76
138
|
ContextHolder.for(appName).requestSource = requestSource;
|
|
77
139
|
}
|
|
78
140
|
|
|
79
|
-
setRequestSource(requestSource) {
|
|
80
|
-
this.requestSource = requestSource;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
141
|
static setOnRedirectTo(onRedirectTo, appName = 'default') {
|
|
84
142
|
ContextHolder.for(appName).onRedirectTo = onRedirectTo;
|
|
85
143
|
}
|
|
86
144
|
|
|
87
|
-
setOnRedirectTo(onRedirectTo) {
|
|
88
|
-
this.onRedirectTo = onRedirectTo;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
145
|
static setLogout(logout, logoutUrl, appName = 'default') {
|
|
92
146
|
const context = ContextHolder.for(appName);
|
|
93
147
|
|
|
@@ -100,34 +154,18 @@ class ContextHolder {
|
|
|
100
154
|
};
|
|
101
155
|
}
|
|
102
156
|
|
|
103
|
-
setLogout(logout) {
|
|
104
|
-
this.logout = logout;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
157
|
static setEntitlementsOptions(entitlementsOptions, appName = 'default') {
|
|
108
158
|
ContextHolder.for(appName).entitlementsOptions = entitlementsOptions;
|
|
109
159
|
}
|
|
110
160
|
|
|
111
|
-
setEntitlementsOptions(entitlementsOptions) {
|
|
112
|
-
this.entitlementsOptions = entitlementsOptions;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
161
|
static setSessionContext(sessionContext, appName = 'default') {
|
|
116
162
|
ContextHolder.for(appName).sessionContext = sessionContext;
|
|
117
163
|
}
|
|
118
164
|
|
|
119
|
-
setSessionContext(sessionContext) {
|
|
120
|
-
this.sessionContext = sessionContext;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
165
|
static setAppName(appName) {
|
|
124
166
|
ContextHolder.for(appName).appName = appName;
|
|
125
167
|
}
|
|
126
168
|
|
|
127
|
-
setAppName(appName) {
|
|
128
|
-
this.appName = appName;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
169
|
static getContext(appName = 'default') {
|
|
132
170
|
var _ContextHolder$for$co;
|
|
133
171
|
|
|
@@ -138,40 +176,18 @@ class ContextHolder {
|
|
|
138
176
|
};
|
|
139
177
|
}
|
|
140
178
|
|
|
141
|
-
getContext() {
|
|
142
|
-
var _this$context;
|
|
143
|
-
|
|
144
|
-
return (_this$context = this.context) != null ? _this$context : {
|
|
145
|
-
baseUrl: window.location.href,
|
|
146
|
-
tokenResolver: () => 'my-authentication-token',
|
|
147
|
-
logLevel: 'error'
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
|
|
151
179
|
static getAccessToken(appName = 'default') {
|
|
152
180
|
return ContextHolder.for(appName).accessToken;
|
|
153
181
|
}
|
|
154
182
|
|
|
155
|
-
getAccessToken() {
|
|
156
|
-
return this.accessToken;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
183
|
static getRequestSource(appName = 'default') {
|
|
160
184
|
return ContextHolder.for(appName).requestSource;
|
|
161
185
|
}
|
|
162
186
|
|
|
163
|
-
getRequestSource() {
|
|
164
|
-
return this.requestSource;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
187
|
static getUser(appName = 'default') {
|
|
168
188
|
return ContextHolder.for(appName).user;
|
|
169
189
|
}
|
|
170
190
|
|
|
171
|
-
getUser() {
|
|
172
|
-
return this.user;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
191
|
static onRedirectTo(path, opts, appName = 'default') {
|
|
176
192
|
return ContextHolder.for(appName).onRedirectTo(path, opts);
|
|
177
193
|
}
|
|
@@ -186,32 +202,16 @@ class ContextHolder {
|
|
|
186
202
|
return ((_ContextHolder$for$en = ContextHolder.for(appName).entitlementsOptions) == null ? void 0 : _ContextHolder$for$en.enabled) || false;
|
|
187
203
|
}
|
|
188
204
|
|
|
189
|
-
shouldLoadEntitlements() {
|
|
190
|
-
var _this$entitlementsOpt;
|
|
191
|
-
|
|
192
|
-
return ((_this$entitlementsOpt = this.entitlementsOptions) == null ? void 0 : _this$entitlementsOpt.enabled) || false;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
205
|
static isSessionPerTenantEnabled(appName = 'default') {
|
|
196
206
|
var _ContextHolder$for$se;
|
|
197
207
|
|
|
198
208
|
return ((_ContextHolder$for$se = ContextHolder.for(appName).sessionContext) == null ? void 0 : _ContextHolder$for$se.enableSessionPerTenant) || false;
|
|
199
209
|
}
|
|
200
210
|
|
|
201
|
-
isSessionPerTenantEnabled() {
|
|
202
|
-
var _this$sessionContext;
|
|
203
|
-
|
|
204
|
-
return ((_this$sessionContext = this.sessionContext) == null ? void 0 : _this$sessionContext.enableSessionPerTenant) || false;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
211
|
static getAppName(appName = 'default') {
|
|
208
212
|
return ContextHolder.for(appName).appName;
|
|
209
213
|
}
|
|
210
214
|
|
|
211
|
-
getAppName() {
|
|
212
|
-
return this.appName;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
exports.ContextHolder = ContextHolder;
|
package/node/index.js
CHANGED
|
@@ -61,19 +61,19 @@ Object.keys(_enums).forEach(function (key) {
|
|
|
61
61
|
class SubscriptionsApi extends _BaseApiClient.BaseApiClient {
|
|
62
62
|
constructor(appName) {
|
|
63
63
|
super(appName);
|
|
64
|
-
this.invoicesApi =
|
|
65
|
-
this.managedSubscriptionApi =
|
|
66
|
-
this.paymentMethodsApi =
|
|
67
|
-
this.paymentProvidersApi =
|
|
68
|
-
this.plansApi =
|
|
69
|
-
this.subscriptionApi =
|
|
70
|
-
this.
|
|
71
|
-
this.subscriptionTenantConfigApi =
|
|
72
|
-
this.vendorPublicConfigApi =
|
|
73
|
-
this.stripeProviderApi =
|
|
74
|
-
this.getSubscriptionInvoices = this.invoicesApi.getSubscriptionInvoices.bind(this.
|
|
75
|
-
this.getSubscriptionInvoice = this.invoicesApi.getSubscriptionInvoice.bind(this.
|
|
76
|
-
this.getSubscriptionInvoicePdf = this.invoicesApi.getSubscriptionInvoicePdf.bind(this.
|
|
64
|
+
this.invoicesApi = new _invoices.InvoicesApi(this.appName);
|
|
65
|
+
this.managedSubscriptionApi = new _managedSubscriptions.ManagedSubscriptionApi(this.appName);
|
|
66
|
+
this.paymentMethodsApi = new _paymentMethods.PaymentMethodsApi(this.appName);
|
|
67
|
+
this.paymentProvidersApi = new _paymentProviders.PaymentProvidersApi(this.appName);
|
|
68
|
+
this.plansApi = new _plans.PlansApi(this.appName);
|
|
69
|
+
this.subscriptionApi = new _subscriptions.SubscriptionApi(this.appName);
|
|
70
|
+
this.summariesApi = new _summaries.SummariesApi(this.appName);
|
|
71
|
+
this.subscriptionTenantConfigApi = new _tenantConfiguration.SubscriptionTenantConfigApi(this.appName);
|
|
72
|
+
this.vendorPublicConfigApi = new _vendorPublicConfigurations.VendorPublicConfigApi(this.appName);
|
|
73
|
+
this.stripeProviderApi = new _stripe.StripeProviderApi(this.appName);
|
|
74
|
+
this.getSubscriptionInvoices = this.invoicesApi.getSubscriptionInvoices.bind(this.invoicesApi);
|
|
75
|
+
this.getSubscriptionInvoice = this.invoicesApi.getSubscriptionInvoice.bind(this.invoicesApi);
|
|
76
|
+
this.getSubscriptionInvoicePdf = this.invoicesApi.getSubscriptionInvoicePdf.bind(this.invoicesApi);
|
|
77
77
|
this.getManagedSubscription = this.managedSubscriptionApi.getManagedSubscription.bind(this.managedSubscriptionApi);
|
|
78
78
|
this.getManagedSubscriptions = this.managedSubscriptionApi.getManagedSubscriptions.bind(this.managedSubscriptionApi);
|
|
79
79
|
this.cancelManagedSubscription = this.managedSubscriptionApi.cancelManagedSubscription.bind(this.managedSubscriptionApi);
|
|
@@ -90,7 +90,7 @@ class SubscriptionsApi extends _BaseApiClient.BaseApiClient {
|
|
|
90
90
|
this.cancelSubscription = this.subscriptionApi.cancelSubscription.bind(this.subscriptionApi);
|
|
91
91
|
this.renewSubscription = this.subscriptionApi.renewSubscription.bind(this.subscriptionApi);
|
|
92
92
|
this.updateSubscription = this.subscriptionApi.updateSubscription.bind(this.subscriptionApi);
|
|
93
|
-
this.getSubscriptionSummaries = this.
|
|
93
|
+
this.getSubscriptionSummaries = this.summariesApi.getSubscriptionSummaries.bind(this.summariesApi);
|
|
94
94
|
this.getTenantConfiguration = this.subscriptionTenantConfigApi.getTenantConfiguration.bind(this.subscriptionTenantConfigApi);
|
|
95
95
|
this.createTenantConfiguration = this.subscriptionTenantConfigApi.createTenantConfiguration.bind(this.subscriptionTenantConfigApi);
|
|
96
96
|
this.getVendorPublicConfigurations = this.vendorPublicConfigApi.getVendorPublicConfigurations.bind(this.vendorPublicConfigApi);
|
|
@@ -99,16 +99,6 @@ class SubscriptionsApi extends _BaseApiClient.BaseApiClient {
|
|
|
99
99
|
this.createStripeCustomer = this.stripeProviderApi.createStripeCustomer.bind(this.stripeProviderApi);
|
|
100
100
|
this.getStripePaymentProviderConfiguration = this.stripeProviderApi.getStripePaymentProviderConfiguration.bind(this.stripeProviderApi);
|
|
101
101
|
this.createStripePaymentMethodSetupIntentSecret = this.stripeProviderApi.createStripePaymentMethodSetupIntentSecret.bind(this.stripeProviderApi);
|
|
102
|
-
this.invoicesApi = new _invoices.InvoicesApi(appName);
|
|
103
|
-
this.managedSubscriptionApi = new _managedSubscriptions.ManagedSubscriptionApi(appName);
|
|
104
|
-
this.paymentMethodsApi = new _paymentMethods.PaymentMethodsApi(appName);
|
|
105
|
-
this.paymentProvidersApi = new _paymentProviders.PaymentProvidersApi(appName);
|
|
106
|
-
this.plansApi = new _plans.PlansApi(appName);
|
|
107
|
-
this.subscriptionApi = new _subscriptions.SubscriptionApi(appName);
|
|
108
|
-
this.summaries = new _summaries.SummariesApi(appName);
|
|
109
|
-
this.subscriptionTenantConfigApi = new _tenantConfiguration.SubscriptionTenantConfigApi(appName);
|
|
110
|
-
this.vendorPublicConfigApi = new _vendorPublicConfigurations.VendorPublicConfigApi(appName);
|
|
111
|
-
this.stripeProviderApi = new _stripe.StripeProviderApi(appName);
|
|
112
102
|
}
|
|
113
103
|
|
|
114
104
|
}
|
package/package.json
CHANGED
package/subscriptions/index.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { BaseApiClient } from '../BaseApiClient';
|
|
2
2
|
export declare class SubscriptionsApi extends BaseApiClient {
|
|
3
|
+
constructor(appName: string);
|
|
3
4
|
private readonly invoicesApi;
|
|
4
5
|
private readonly managedSubscriptionApi;
|
|
5
6
|
private readonly paymentMethodsApi;
|
|
6
7
|
private readonly paymentProvidersApi;
|
|
7
8
|
private readonly plansApi;
|
|
8
9
|
private readonly subscriptionApi;
|
|
9
|
-
private readonly
|
|
10
|
+
private readonly summariesApi;
|
|
10
11
|
private readonly subscriptionTenantConfigApi;
|
|
11
12
|
private readonly vendorPublicConfigApi;
|
|
12
13
|
private readonly stripeProviderApi;
|
|
13
|
-
constructor(appName: string);
|
|
14
14
|
/** InvoicesApi **/
|
|
15
15
|
getSubscriptionInvoices: () => Promise<import("./interfaces").ISubscriptionInvoiceResponse[]>;
|
|
16
16
|
getSubscriptionInvoice: (invoiceId: string) => Promise<import("./interfaces").ISubscriptionInvoiceResponse>;
|
package/subscriptions/index.js
CHANGED
|
@@ -12,19 +12,19 @@ import { StripeProviderApi } from './providers/stripe';
|
|
|
12
12
|
export class SubscriptionsApi extends BaseApiClient {
|
|
13
13
|
constructor(appName) {
|
|
14
14
|
super(appName);
|
|
15
|
-
this.invoicesApi =
|
|
16
|
-
this.managedSubscriptionApi =
|
|
17
|
-
this.paymentMethodsApi =
|
|
18
|
-
this.paymentProvidersApi =
|
|
19
|
-
this.plansApi =
|
|
20
|
-
this.subscriptionApi =
|
|
21
|
-
this.
|
|
22
|
-
this.subscriptionTenantConfigApi =
|
|
23
|
-
this.vendorPublicConfigApi =
|
|
24
|
-
this.stripeProviderApi =
|
|
25
|
-
this.getSubscriptionInvoices = this.invoicesApi.getSubscriptionInvoices.bind(this.
|
|
26
|
-
this.getSubscriptionInvoice = this.invoicesApi.getSubscriptionInvoice.bind(this.
|
|
27
|
-
this.getSubscriptionInvoicePdf = this.invoicesApi.getSubscriptionInvoicePdf.bind(this.
|
|
15
|
+
this.invoicesApi = new InvoicesApi(this.appName);
|
|
16
|
+
this.managedSubscriptionApi = new ManagedSubscriptionApi(this.appName);
|
|
17
|
+
this.paymentMethodsApi = new PaymentMethodsApi(this.appName);
|
|
18
|
+
this.paymentProvidersApi = new PaymentProvidersApi(this.appName);
|
|
19
|
+
this.plansApi = new PlansApi(this.appName);
|
|
20
|
+
this.subscriptionApi = new SubscriptionApi(this.appName);
|
|
21
|
+
this.summariesApi = new SummariesApi(this.appName);
|
|
22
|
+
this.subscriptionTenantConfigApi = new SubscriptionTenantConfigApi(this.appName);
|
|
23
|
+
this.vendorPublicConfigApi = new VendorPublicConfigApi(this.appName);
|
|
24
|
+
this.stripeProviderApi = new StripeProviderApi(this.appName);
|
|
25
|
+
this.getSubscriptionInvoices = this.invoicesApi.getSubscriptionInvoices.bind(this.invoicesApi);
|
|
26
|
+
this.getSubscriptionInvoice = this.invoicesApi.getSubscriptionInvoice.bind(this.invoicesApi);
|
|
27
|
+
this.getSubscriptionInvoicePdf = this.invoicesApi.getSubscriptionInvoicePdf.bind(this.invoicesApi);
|
|
28
28
|
this.getManagedSubscription = this.managedSubscriptionApi.getManagedSubscription.bind(this.managedSubscriptionApi);
|
|
29
29
|
this.getManagedSubscriptions = this.managedSubscriptionApi.getManagedSubscriptions.bind(this.managedSubscriptionApi);
|
|
30
30
|
this.cancelManagedSubscription = this.managedSubscriptionApi.cancelManagedSubscription.bind(this.managedSubscriptionApi);
|
|
@@ -41,7 +41,7 @@ export class SubscriptionsApi extends BaseApiClient {
|
|
|
41
41
|
this.cancelSubscription = this.subscriptionApi.cancelSubscription.bind(this.subscriptionApi);
|
|
42
42
|
this.renewSubscription = this.subscriptionApi.renewSubscription.bind(this.subscriptionApi);
|
|
43
43
|
this.updateSubscription = this.subscriptionApi.updateSubscription.bind(this.subscriptionApi);
|
|
44
|
-
this.getSubscriptionSummaries = this.
|
|
44
|
+
this.getSubscriptionSummaries = this.summariesApi.getSubscriptionSummaries.bind(this.summariesApi);
|
|
45
45
|
this.getTenantConfiguration = this.subscriptionTenantConfigApi.getTenantConfiguration.bind(this.subscriptionTenantConfigApi);
|
|
46
46
|
this.createTenantConfiguration = this.subscriptionTenantConfigApi.createTenantConfiguration.bind(this.subscriptionTenantConfigApi);
|
|
47
47
|
this.getVendorPublicConfigurations = this.vendorPublicConfigApi.getVendorPublicConfigurations.bind(this.vendorPublicConfigApi);
|
|
@@ -50,16 +50,6 @@ export class SubscriptionsApi extends BaseApiClient {
|
|
|
50
50
|
this.createStripeCustomer = this.stripeProviderApi.createStripeCustomer.bind(this.stripeProviderApi);
|
|
51
51
|
this.getStripePaymentProviderConfiguration = this.stripeProviderApi.getStripePaymentProviderConfiguration.bind(this.stripeProviderApi);
|
|
52
52
|
this.createStripePaymentMethodSetupIntentSecret = this.stripeProviderApi.createStripePaymentMethodSetupIntentSecret.bind(this.stripeProviderApi);
|
|
53
|
-
this.invoicesApi = new InvoicesApi(appName);
|
|
54
|
-
this.managedSubscriptionApi = new ManagedSubscriptionApi(appName);
|
|
55
|
-
this.paymentMethodsApi = new PaymentMethodsApi(appName);
|
|
56
|
-
this.paymentProvidersApi = new PaymentProvidersApi(appName);
|
|
57
|
-
this.plansApi = new PlansApi(appName);
|
|
58
|
-
this.subscriptionApi = new SubscriptionApi(appName);
|
|
59
|
-
this.summaries = new SummariesApi(appName);
|
|
60
|
-
this.subscriptionTenantConfigApi = new SubscriptionTenantConfigApi(appName);
|
|
61
|
-
this.vendorPublicConfigApi = new VendorPublicConfigApi(appName);
|
|
62
|
-
this.stripeProviderApi = new StripeProviderApi(appName);
|
|
63
53
|
}
|
|
64
54
|
|
|
65
55
|
}
|