@zeniai/client-epic-state 5.2.76-betaRD1 → 5.2.77
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/entity/tenant/epic/deleteConnectionEpic.d.ts +1 -1
- package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.d.ts +3 -3
- package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.js +2 -2
- package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +1 -1
- package/lib/entity/tenant/epic/saveConnectorCredentialsEpic.d.ts +3 -3
- package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +1 -1
- package/lib/entity/tenant/tenantPayload.d.ts +0 -1
- package/lib/entity/tenant/tenantReducer.d.ts +30 -32
- package/lib/entity/tenant/tenantReducer.js +2 -13
- package/lib/entity/tenant/tenantState.d.ts +0 -1
- package/lib/entity/tenant/tenantTypes.d.ts +1 -1
- package/lib/entity/tenant/tenantTypes.js +0 -1
- package/lib/esm/entity/tenant/epic/initEmailConnectOAuthEpic.js +2 -2
- package/lib/esm/entity/tenant/tenantReducer.js +2 -13
- package/lib/esm/entity/tenant/tenantTypes.js +0 -1
- package/lib/esm/view/invoicing/createInvoice/createInvoiceFormConfig.js +10 -0
- package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +6 -0
- package/lib/index.d.ts +1 -1
- package/lib/view/invoicing/createInvoice/createInvoiceFormConfig.js +10 -0
- package/lib/view/invoicing/createInvoice/createInvoicePayload.d.ts +4 -0
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +2 -1
- package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +6 -0
- package/lib/view/invoicing/createInvoice/createInvoiceState.d.ts +11 -0
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ export declare const deleteConnectionEpic: (actions$: ActionsObservable<ActionTy
|
|
|
7
7
|
payload: {
|
|
8
8
|
tenantId: string;
|
|
9
9
|
connectionId: string;
|
|
10
|
-
connectionType: "revenue" | "email" | "
|
|
10
|
+
connectionType: "revenue" | "email" | "payments";
|
|
11
11
|
};
|
|
12
12
|
type: "tenant/deleteConnectionSuccess";
|
|
13
13
|
} | {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { RootState } from '../../../rootStateTypes';
|
|
3
3
|
import { ZeniAPI } from '../../../zeniAPI';
|
|
4
|
-
import {
|
|
4
|
+
import { initEmailConnectOAuth, initEmailConnectOAuthFailure, initEmailConnectOAuthSuccess } from '../tenantReducer';
|
|
5
5
|
export type ActionType = ReturnType<typeof initEmailConnectOAuth> | ReturnType<typeof initEmailConnectOAuthSuccess> | ReturnType<typeof initEmailConnectOAuthFailure>;
|
|
6
6
|
export type NavigateFn = (url: string) => void;
|
|
7
7
|
export declare const initEmailConnectOAuthEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI, navigate?: NavigateFn) => import("rxjs").Observable<{
|
|
8
8
|
payload: {
|
|
9
9
|
tenantId: string;
|
|
10
|
-
provider:
|
|
10
|
+
provider: "gmail" | "outlook";
|
|
11
11
|
authorizationUrl: string;
|
|
12
12
|
};
|
|
13
13
|
type: "tenant/initEmailConnectOAuthSuccess";
|
|
14
14
|
} | {
|
|
15
15
|
payload: {
|
|
16
16
|
tenantId: string;
|
|
17
|
-
provider:
|
|
17
|
+
provider: "gmail" | "outlook";
|
|
18
18
|
status: import("../../../zeniAPIStatus").ZeniAPIStatus<Record<string, unknown>>;
|
|
19
19
|
};
|
|
20
20
|
type: "tenant/initEmailConnectOAuthFailure";
|
|
@@ -14,7 +14,7 @@ const defaultNavigate = (url) => {
|
|
|
14
14
|
window.location.href = url;
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
// Backs the POST /1.0/connectors/<provider>/init endpoint on the
|
|
17
|
+
// Backs the new POST /1.0/connectors/email/<provider>/init endpoint on the
|
|
18
18
|
// auth service. The endpoint creates a CSRF state token in the auth NDB
|
|
19
19
|
// store and returns the provider's authorization_url; this epic then drives
|
|
20
20
|
// a full-page redirect so the user lands on Google's / Microsoft's consent
|
|
@@ -31,7 +31,7 @@ navigate = defaultNavigate) => actions$.pipe((0, operators_1.filter)(tenantReduc
|
|
|
31
31
|
// the gmail provider's `saveConnectorCredentialsStateBySlug` in
|
|
32
32
|
// `In-Progress` forever. groupBy gives each provider its own stream.
|
|
33
33
|
(0, operators_1.groupBy)((action) => action.payload.provider), (0, operators_1.mergeMap)((perProvider$) => perProvider$.pipe((0, operators_1.switchMap)((action) => zeniAPI
|
|
34
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/connectors/${action.payload.provider}/init`, { redirect_after_url: action.payload.redirectAfterUrl }, { 'zeni-tenant-id': action.payload.tenantId })
|
|
34
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/connectors/email/${action.payload.provider}/init`, { redirect_after_url: action.payload.redirectAfterUrl }, { 'zeni-tenant-id': action.payload.tenantId })
|
|
35
35
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
36
36
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
37
37
|
// Fire-and-forget side effect — once the browser navigates,
|
|
@@ -6,7 +6,7 @@ export type ActionType = ReturnType<typeof saveAPIKeyConnection> | ReturnType<ty
|
|
|
6
6
|
export declare const saveAPIKeyConnectionEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
7
7
|
payload: {
|
|
8
8
|
tenantId: string;
|
|
9
|
-
connectionType: "revenue" | "email" | "
|
|
9
|
+
connectionType: "revenue" | "email" | "payments";
|
|
10
10
|
connectionPayload: import("../tenantPayload").ConnectionDataPayload;
|
|
11
11
|
};
|
|
12
12
|
type: "tenant/saveAPIKeyConnectionSuccess";
|
|
@@ -6,15 +6,15 @@ export type ActionType = ReturnType<typeof saveConnectorCredentials> | ReturnTyp
|
|
|
6
6
|
export declare const saveConnectorCredentialsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
7
7
|
payload: {
|
|
8
8
|
tenantId: string;
|
|
9
|
-
connectionType: "revenue" | "email" | "
|
|
10
|
-
connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook"
|
|
9
|
+
connectionType: "revenue" | "email" | "payments";
|
|
10
|
+
connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook";
|
|
11
11
|
connectionPayload: import("../tenantPayload").ConnectionDataPayload;
|
|
12
12
|
};
|
|
13
13
|
type: "tenant/saveConnectorCredentialsSuccess";
|
|
14
14
|
} | {
|
|
15
15
|
payload: {
|
|
16
16
|
tenantId: string;
|
|
17
|
-
connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook"
|
|
17
|
+
connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook";
|
|
18
18
|
status: import("../../../zeniAPIStatus").ZeniAPIStatus<Record<string, unknown>>;
|
|
19
19
|
};
|
|
20
20
|
type: "tenant/saveConnectorCredentialsFailure";
|
|
@@ -6,7 +6,7 @@ export type ActionType = ReturnType<typeof saveOAuthConnection> | ReturnType<typ
|
|
|
6
6
|
export declare const saveOAuthConnectionEpic: (actions$: ActionsObservable<ActionType>, _: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
7
7
|
payload: {
|
|
8
8
|
tenantId: string;
|
|
9
|
-
connectionType: "revenue" | "email" | "
|
|
9
|
+
connectionType: "revenue" | "email" | "payments";
|
|
10
10
|
connectionPayload: import("../tenantPayload").ConnectionDataPayload;
|
|
11
11
|
};
|
|
12
12
|
type: "tenant/saveOAuthConnectionSuccess";
|
|
@@ -13,9 +13,8 @@ export interface DoSignInPayload {
|
|
|
13
13
|
redirectUri: ZeniUrl;
|
|
14
14
|
sourceUri: ZeniUrl;
|
|
15
15
|
}
|
|
16
|
-
export declare const toExternalIntegrationType: (v: string) => "revenue" | "email" | "
|
|
16
|
+
export declare const toExternalIntegrationType: (v: string) => "revenue" | "email" | "payments";
|
|
17
17
|
export type ExternalIntegrationType = ReturnType<typeof toExternalIntegrationType>;
|
|
18
|
-
export type ConnectorOAuthProvider = 'gmail' | 'outlook' | 'gusto';
|
|
19
18
|
export type ConnectorCredentialsBySlug = {
|
|
20
19
|
connectionName: 'stripe';
|
|
21
20
|
credentials: {
|
|
@@ -100,26 +99,26 @@ export declare const updateTenants: import("@reduxjs/toolkit").ActionCreatorWith
|
|
|
100
99
|
}, "tenant/fetchExternalConnectionsFailure", never, never>, fetchExternalConnectionsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, externalConnections: ConnectionsPayload], {
|
|
101
100
|
tenantId: string;
|
|
102
101
|
externalConnections: ConnectionsPayload;
|
|
103
|
-
}, "tenant/fetchExternalConnectionsSuccess", never, never>, saveAPIKeyConnection: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionId: string, connectionType: "revenue" | "email" | "
|
|
102
|
+
}, "tenant/fetchExternalConnectionsSuccess", never, never>, saveAPIKeyConnection: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionId: string, connectionType: "revenue" | "email" | "payments", connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook", credentials: {
|
|
104
103
|
api_key: string;
|
|
105
104
|
site: string;
|
|
106
105
|
}], {
|
|
107
106
|
tenantId: string;
|
|
108
107
|
connectionId: string;
|
|
109
|
-
connectionType: "revenue" | "email" | "
|
|
110
|
-
connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook"
|
|
108
|
+
connectionType: "revenue" | "email" | "payments";
|
|
109
|
+
connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook";
|
|
111
110
|
credentials: {
|
|
112
111
|
api_key: string;
|
|
113
112
|
site: string;
|
|
114
113
|
};
|
|
115
|
-
}, "tenant/saveAPIKeyConnection", never, never>, saveAPIKeyConnectionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionType: "revenue" | "email" | "
|
|
114
|
+
}, "tenant/saveAPIKeyConnection", never, never>, saveAPIKeyConnectionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionType: "revenue" | "email" | "payments", connectionPayload: ConnectionDataPayload], {
|
|
116
115
|
tenantId: string;
|
|
117
|
-
connectionType: "revenue" | "email" | "
|
|
116
|
+
connectionType: "revenue" | "email" | "payments";
|
|
118
117
|
connectionPayload: ConnectionDataPayload;
|
|
119
118
|
}, "tenant/saveAPIKeyConnectionSuccess", never, never>, saveAPIKeyConnectionFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
120
119
|
tenantId: string;
|
|
121
120
|
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
122
|
-
}, "tenant/saveAPIKeyConnectionFailure", never, never>, saveOAuthConnection: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionId: string, connectionType: "revenue" | "email" | "
|
|
121
|
+
}, "tenant/saveAPIKeyConnectionFailure", never, never>, saveOAuthConnection: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionId: string, connectionType: "revenue" | "email" | "payments", connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook", credentials: {
|
|
123
122
|
authorization_code: string;
|
|
124
123
|
client_id: string;
|
|
125
124
|
client_secret: string;
|
|
@@ -127,35 +126,35 @@ export declare const updateTenants: import("@reduxjs/toolkit").ActionCreatorWith
|
|
|
127
126
|
}], {
|
|
128
127
|
tenantId: string;
|
|
129
128
|
connectionId: string;
|
|
130
|
-
connectionType: "revenue" | "email" | "
|
|
131
|
-
connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook"
|
|
129
|
+
connectionType: "revenue" | "email" | "payments";
|
|
130
|
+
connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook";
|
|
132
131
|
credentials: {
|
|
133
132
|
authorization_code: string;
|
|
134
133
|
client_id: string;
|
|
135
134
|
client_secret: string;
|
|
136
135
|
redirect_uri: string;
|
|
137
136
|
};
|
|
138
|
-
}, "tenant/saveOAuthConnection", never, never>, saveOAuthConnectionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionType: "revenue" | "email" | "
|
|
137
|
+
}, "tenant/saveOAuthConnection", never, never>, saveOAuthConnectionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionType: "revenue" | "email" | "payments", connectionPayload: ConnectionDataPayload], {
|
|
139
138
|
tenantId: string;
|
|
140
|
-
connectionType: "revenue" | "email" | "
|
|
139
|
+
connectionType: "revenue" | "email" | "payments";
|
|
141
140
|
connectionPayload: ConnectionDataPayload;
|
|
142
141
|
}, "tenant/saveOAuthConnectionSuccess", never, never>, saveOAuthConnectionFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
143
142
|
tenantId: string;
|
|
144
143
|
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
145
|
-
}, "tenant/saveOAuthConnectionFailure", never, never>, saveConnectorCredentials: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionType: "revenue" | "email" | "
|
|
144
|
+
}, "tenant/saveOAuthConnectionFailure", never, never>, saveConnectorCredentials: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionType: "revenue" | "email" | "payments", args: ConnectorCredentialsBySlug], {
|
|
146
145
|
connectionName: "stripe";
|
|
147
146
|
credentials: {
|
|
148
147
|
api_key: string;
|
|
149
148
|
};
|
|
150
149
|
tenantId: string;
|
|
151
|
-
connectionType: "revenue" | "email" | "
|
|
150
|
+
connectionType: "revenue" | "email" | "payments";
|
|
152
151
|
} | {
|
|
153
152
|
connectionName: "mercury";
|
|
154
153
|
credentials: {
|
|
155
154
|
api_key: string;
|
|
156
155
|
};
|
|
157
156
|
tenantId: string;
|
|
158
|
-
connectionType: "revenue" | "email" | "
|
|
157
|
+
connectionType: "revenue" | "email" | "payments";
|
|
159
158
|
} | {
|
|
160
159
|
connectionName: "paypal";
|
|
161
160
|
credentials: {
|
|
@@ -163,36 +162,36 @@ export declare const updateTenants: import("@reduxjs/toolkit").ActionCreatorWith
|
|
|
163
162
|
client_secret: string;
|
|
164
163
|
};
|
|
165
164
|
tenantId: string;
|
|
166
|
-
connectionType: "revenue" | "email" | "
|
|
167
|
-
}, "tenant/saveConnectorCredentials", never, never>, saveConnectorCredentialsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionType: "revenue" | "email" | "
|
|
165
|
+
connectionType: "revenue" | "email" | "payments";
|
|
166
|
+
}, "tenant/saveConnectorCredentials", never, never>, saveConnectorCredentialsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionType: "revenue" | "email" | "payments", connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook", connectionPayload: ConnectionDataPayload], {
|
|
168
167
|
tenantId: string;
|
|
169
|
-
connectionType: "revenue" | "email" | "
|
|
170
|
-
connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook"
|
|
168
|
+
connectionType: "revenue" | "email" | "payments";
|
|
169
|
+
connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook";
|
|
171
170
|
connectionPayload: ConnectionDataPayload;
|
|
172
|
-
}, "tenant/saveConnectorCredentialsSuccess", never, never>, saveConnectorCredentialsFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook"
|
|
171
|
+
}, "tenant/saveConnectorCredentialsSuccess", never, never>, saveConnectorCredentialsFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook", status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
173
172
|
tenantId: string;
|
|
174
|
-
connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook"
|
|
173
|
+
connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook";
|
|
175
174
|
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
176
|
-
}, "tenant/saveConnectorCredentialsFailure", never, never>, initEmailConnectOAuth: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, provider:
|
|
175
|
+
}, "tenant/saveConnectorCredentialsFailure", never, never>, initEmailConnectOAuth: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, provider: "gmail" | "outlook", redirectAfterUrl: string], {
|
|
177
176
|
tenantId: string;
|
|
178
|
-
provider:
|
|
177
|
+
provider: "gmail" | "outlook";
|
|
179
178
|
redirectAfterUrl: string;
|
|
180
|
-
}, "tenant/initEmailConnectOAuth", never, never>, initEmailConnectOAuthSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, provider:
|
|
179
|
+
}, "tenant/initEmailConnectOAuth", never, never>, initEmailConnectOAuthSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, provider: "gmail" | "outlook", authorizationUrl: string], {
|
|
181
180
|
tenantId: string;
|
|
182
|
-
provider:
|
|
181
|
+
provider: "gmail" | "outlook";
|
|
183
182
|
authorizationUrl: string;
|
|
184
|
-
}, "tenant/initEmailConnectOAuthSuccess", never, never>, initEmailConnectOAuthFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, provider:
|
|
183
|
+
}, "tenant/initEmailConnectOAuthSuccess", never, never>, initEmailConnectOAuthFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, provider: "gmail" | "outlook", status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
185
184
|
tenantId: string;
|
|
186
|
-
provider:
|
|
185
|
+
provider: "gmail" | "outlook";
|
|
187
186
|
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
188
|
-
}, "tenant/initEmailConnectOAuthFailure", never, never>, deleteConnection: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionId: string, connectionType: "revenue" | "email" | "
|
|
187
|
+
}, "tenant/initEmailConnectOAuthFailure", never, never>, deleteConnection: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionId: string, connectionType: "revenue" | "email" | "payments"], {
|
|
189
188
|
tenantId: string;
|
|
190
189
|
connectionId: string;
|
|
191
|
-
connectionType: "revenue" | "email" | "
|
|
192
|
-
}, "tenant/deleteConnection", never, never>, deleteConnectionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionId: string, connectionType: "revenue" | "email" | "
|
|
190
|
+
connectionType: "revenue" | "email" | "payments";
|
|
191
|
+
}, "tenant/deleteConnection", never, never>, deleteConnectionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionId: string, connectionType: "revenue" | "email" | "payments"], {
|
|
193
192
|
tenantId: string;
|
|
194
193
|
connectionId: string;
|
|
195
|
-
connectionType: "revenue" | "email" | "
|
|
194
|
+
connectionType: "revenue" | "email" | "payments";
|
|
196
195
|
}, "tenant/deleteConnectionSuccess", never, never>, deleteConnectionFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
197
196
|
tenantId: string;
|
|
198
197
|
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
@@ -259,7 +258,6 @@ export declare function mapConnectionsPayloadToState(connectionsPayload: Connect
|
|
|
259
258
|
accounting: Connection[];
|
|
260
259
|
email: Connection[];
|
|
261
260
|
payments: Connection[];
|
|
262
|
-
payroll: Connection[];
|
|
263
261
|
revenue: Connection[];
|
|
264
262
|
};
|
|
265
263
|
export declare const toConnection: (payload: ConnectionDataPayload) => Connection;
|
|
@@ -20,12 +20,7 @@ const netBurnOrIncomeStoryCardState_1 = require("../../view/netBurnOrIncomeStory
|
|
|
20
20
|
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
21
21
|
const subscriptionSummaryReducer_1 = require("../subscription/subscriptionSummary/subscriptionSummaryReducer");
|
|
22
22
|
const userRolePayload_1 = require("../userRole/userRolePayload");
|
|
23
|
-
const EXTERNAL_INTEGRATION_TYPES = [
|
|
24
|
-
'revenue',
|
|
25
|
-
'payments',
|
|
26
|
-
'email',
|
|
27
|
-
'payroll',
|
|
28
|
-
];
|
|
23
|
+
const EXTERNAL_INTEGRATION_TYPES = ['revenue', 'payments', 'email'];
|
|
29
24
|
const toExternalIntegrationType = (v) => (0, stringToUnion_1.stringToUnion)(v, EXTERNAL_INTEGRATION_TYPES);
|
|
30
25
|
exports.toExternalIntegrationType = toExternalIntegrationType;
|
|
31
26
|
exports.initialState = {
|
|
@@ -438,7 +433,6 @@ const tenant = (0, toolkit_1.createSlice)({
|
|
|
438
433
|
accounting: [],
|
|
439
434
|
email: [],
|
|
440
435
|
payments: [],
|
|
441
|
-
payroll: [],
|
|
442
436
|
revenue: [],
|
|
443
437
|
saveConnectionState: 'Not-Started',
|
|
444
438
|
saveAPIKeyConnectionState: 'Not-Started',
|
|
@@ -455,13 +449,12 @@ const tenant = (0, toolkit_1.createSlice)({
|
|
|
455
449
|
return { payload: { tenantId, externalConnections } };
|
|
456
450
|
},
|
|
457
451
|
reducer(draft, action) {
|
|
458
|
-
const { accounting, email, payments,
|
|
452
|
+
const { accounting, email, payments, revenue } = mapConnectionsPayloadToState(action.payload.externalConnections);
|
|
459
453
|
draft.externalConnectionsByTenant[action.payload.tenantId] = {
|
|
460
454
|
fetchState: 'Completed',
|
|
461
455
|
accounting,
|
|
462
456
|
email,
|
|
463
457
|
payments,
|
|
464
|
-
payroll,
|
|
465
458
|
revenue,
|
|
466
459
|
saveConnectionState: 'Completed',
|
|
467
460
|
saveAPIKeyConnectionState: 'Not-Started',
|
|
@@ -484,7 +477,6 @@ const tenant = (0, toolkit_1.createSlice)({
|
|
|
484
477
|
accounting: [],
|
|
485
478
|
email: [],
|
|
486
479
|
payments: [],
|
|
487
|
-
payroll: [],
|
|
488
480
|
revenue: [],
|
|
489
481
|
saveConnectionState: 'Error',
|
|
490
482
|
saveAPIKeyConnectionState: 'Not-Started',
|
|
@@ -1133,9 +1125,6 @@ function mapConnectionsPayloadToState(connectionsPayload) {
|
|
|
1133
1125
|
// tenant deploys (or disabled-everywhere envs) don't blow up here.
|
|
1134
1126
|
email: (connections.email ?? []).map((payload) => (0, exports.toConnection)(payload)),
|
|
1135
1127
|
payments: connections.payments.map((payload) => (0, exports.toConnection)(payload)),
|
|
1136
|
-
// Same back-compat shape as `email`: tenant materializes gusto under
|
|
1137
|
-
// `payroll` only when the slug is enabled in third_party_enabled_connectors.
|
|
1138
|
-
payroll: (connections.payroll ?? []).map((payload) => (0, exports.toConnection)(payload)),
|
|
1139
1128
|
revenue: (connections.revenue ?? []).map((payload) => (0, exports.toConnection)(payload)),
|
|
1140
1129
|
};
|
|
1141
1130
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type AuthProvider = 'google' | 'microsoft' | 'email';
|
|
2
|
-
export declare const toExternalSupportedTool: (v: string) => "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook"
|
|
2
|
+
export declare const toExternalSupportedTool: (v: string) => "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook";
|
|
3
3
|
export type ExternalSupportedTool = ReturnType<typeof toExternalSupportedTool>;
|
|
@@ -11,7 +11,7 @@ const defaultNavigate = (url) => {
|
|
|
11
11
|
window.location.href = url;
|
|
12
12
|
}
|
|
13
13
|
};
|
|
14
|
-
// Backs the POST /1.0/connectors/<provider>/init endpoint on the
|
|
14
|
+
// Backs the new POST /1.0/connectors/email/<provider>/init endpoint on the
|
|
15
15
|
// auth service. The endpoint creates a CSRF state token in the auth NDB
|
|
16
16
|
// store and returns the provider's authorization_url; this epic then drives
|
|
17
17
|
// a full-page redirect so the user lands on Google's / Microsoft's consent
|
|
@@ -28,7 +28,7 @@ navigate = defaultNavigate) => actions$.pipe(filter(initEmailConnectOAuth.match)
|
|
|
28
28
|
// the gmail provider's `saveConnectorCredentialsStateBySlug` in
|
|
29
29
|
// `In-Progress` forever. groupBy gives each provider its own stream.
|
|
30
30
|
groupBy((action) => action.payload.provider), mergeMap((perProvider$) => perProvider$.pipe(switchMap((action) => zeniAPI
|
|
31
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/connectors/${action.payload.provider}/init`, { redirect_after_url: action.payload.redirectAfterUrl }, { 'zeni-tenant-id': action.payload.tenantId })
|
|
31
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/connectors/email/${action.payload.provider}/init`, { redirect_after_url: action.payload.redirectAfterUrl }, { 'zeni-tenant-id': action.payload.tenantId })
|
|
32
32
|
.pipe(mergeMap((response) => {
|
|
33
33
|
if (isSuccessResponse(response) && response.data != null) {
|
|
34
34
|
// Fire-and-forget side effect — once the browser navigates,
|
|
@@ -10,12 +10,7 @@ import { toNumberOfMonthForAverage, toTimeSpanIdForAverage, } from '../../view/n
|
|
|
10
10
|
import { date, dateNow } from '../../zeniDayJS';
|
|
11
11
|
import { toSubscriptionSummary } from '../subscription/subscriptionSummary/subscriptionSummaryReducer';
|
|
12
12
|
import { getInvitationStatus, getUserRoles, toMasterTOSInfo, toUserReimbursementInfo, } from '../userRole/userRolePayload';
|
|
13
|
-
const EXTERNAL_INTEGRATION_TYPES = [
|
|
14
|
-
'revenue',
|
|
15
|
-
'payments',
|
|
16
|
-
'email',
|
|
17
|
-
'payroll',
|
|
18
|
-
];
|
|
13
|
+
const EXTERNAL_INTEGRATION_TYPES = ['revenue', 'payments', 'email'];
|
|
19
14
|
export const toExternalIntegrationType = (v) => stringToUnion(v, EXTERNAL_INTEGRATION_TYPES);
|
|
20
15
|
export const initialState = {
|
|
21
16
|
fetchState: 'Not-Started',
|
|
@@ -427,7 +422,6 @@ const tenant = createSlice({
|
|
|
427
422
|
accounting: [],
|
|
428
423
|
email: [],
|
|
429
424
|
payments: [],
|
|
430
|
-
payroll: [],
|
|
431
425
|
revenue: [],
|
|
432
426
|
saveConnectionState: 'Not-Started',
|
|
433
427
|
saveAPIKeyConnectionState: 'Not-Started',
|
|
@@ -444,13 +438,12 @@ const tenant = createSlice({
|
|
|
444
438
|
return { payload: { tenantId, externalConnections } };
|
|
445
439
|
},
|
|
446
440
|
reducer(draft, action) {
|
|
447
|
-
const { accounting, email, payments,
|
|
441
|
+
const { accounting, email, payments, revenue } = mapConnectionsPayloadToState(action.payload.externalConnections);
|
|
448
442
|
draft.externalConnectionsByTenant[action.payload.tenantId] = {
|
|
449
443
|
fetchState: 'Completed',
|
|
450
444
|
accounting,
|
|
451
445
|
email,
|
|
452
446
|
payments,
|
|
453
|
-
payroll,
|
|
454
447
|
revenue,
|
|
455
448
|
saveConnectionState: 'Completed',
|
|
456
449
|
saveAPIKeyConnectionState: 'Not-Started',
|
|
@@ -473,7 +466,6 @@ const tenant = createSlice({
|
|
|
473
466
|
accounting: [],
|
|
474
467
|
email: [],
|
|
475
468
|
payments: [],
|
|
476
|
-
payroll: [],
|
|
477
469
|
revenue: [],
|
|
478
470
|
saveConnectionState: 'Error',
|
|
479
471
|
saveAPIKeyConnectionState: 'Not-Started',
|
|
@@ -1121,9 +1113,6 @@ export function mapConnectionsPayloadToState(connectionsPayload) {
|
|
|
1121
1113
|
// tenant deploys (or disabled-everywhere envs) don't blow up here.
|
|
1122
1114
|
email: (connections.email ?? []).map((payload) => toConnection(payload)),
|
|
1123
1115
|
payments: connections.payments.map((payload) => toConnection(payload)),
|
|
1124
|
-
// Same back-compat shape as `email`: tenant materializes gusto under
|
|
1125
|
-
// `payroll` only when the slug is enabled in third_party_enabled_connectors.
|
|
1126
|
-
payroll: (connections.payroll ?? []).map((payload) => toConnection(payload)),
|
|
1127
1116
|
revenue: (connections.revenue ?? []).map((payload) => toConnection(payload)),
|
|
1128
1117
|
};
|
|
1129
1118
|
}
|
|
@@ -41,6 +41,16 @@ export const createInvoiceFormLocalDataToRequest = (localData) => {
|
|
|
41
41
|
quantity: toQuantity(line.quantity),
|
|
42
42
|
tax_amount: line.taxAmount.amount,
|
|
43
43
|
unit_amount: line.unitAmount.amount,
|
|
44
|
+
...(line.catalogLine != null
|
|
45
|
+
? {
|
|
46
|
+
entity_id: line.catalogLine.entityId,
|
|
47
|
+
entity_type: line.catalogLine.entityType,
|
|
48
|
+
is_taxed: line.catalogLine.isTaxed,
|
|
49
|
+
...(line.catalogLine.isTaxed
|
|
50
|
+
? {}
|
|
51
|
+
: { tax_exempt_reason: 'not_taxable' }),
|
|
52
|
+
}
|
|
53
|
+
: {}),
|
|
44
54
|
}));
|
|
45
55
|
const invoiceDate = localData.invoiceDate != null && localData.invoiceDate !== ''
|
|
46
56
|
? localData.invoiceDate
|
|
@@ -73,6 +73,12 @@ export const getCreateInvoiceFormView = (state) => {
|
|
|
73
73
|
planNames: catalogListView.plans.flatMap((plan) => (plan.subFamilies ?? [])
|
|
74
74
|
.filter((subFamily) => (subFamily.name ?? '') !== '')
|
|
75
75
|
.map((subFamily) => ({
|
|
76
|
+
// A price point with no flag is taxable, as subscription billing reads it.
|
|
77
|
+
catalogLine: {
|
|
78
|
+
entityId: subFamily.id,
|
|
79
|
+
entityType: plan.itemType ?? 'plan',
|
|
80
|
+
isTaxed: subFamily.isTaxable ?? true,
|
|
81
|
+
},
|
|
76
82
|
planName: plan.name ?? '',
|
|
77
83
|
price: planNamePrefillPrice(subFamily),
|
|
78
84
|
subFamilyName: subFamily.name ?? '',
|
package/lib/index.d.ts
CHANGED
|
@@ -1088,7 +1088,7 @@ export { getInvoiceDetail } from './view/invoicing/invoiceDetail/invoiceDetailSe
|
|
|
1088
1088
|
export type { InvoiceDetailView } from './view/invoicing/invoiceDetail/invoiceDetailSelector';
|
|
1089
1089
|
export { createInvoice, fetchCreateInvoiceFormPage, resetCreateInvoice, updateInvoicingCreateInvoiceFormDraft, } from './view/invoicing/createInvoice/createInvoiceReducer';
|
|
1090
1090
|
export type { CreateInvoiceLineItemRequest, CreateInvoiceRequest, } from './view/invoicing/createInvoice/createInvoicePayload';
|
|
1091
|
-
export type { InvoicingCreateInvoiceFormLineItem, InvoicingCreateInvoiceFormLocalData, } from './view/invoicing/createInvoice/createInvoiceState';
|
|
1091
|
+
export type { InvoicingCreateInvoiceCatalogLine, InvoicingCreateInvoiceFormLineItem, InvoicingCreateInvoiceFormLocalData, } from './view/invoicing/createInvoice/createInvoiceState';
|
|
1092
1092
|
export { blankInvoicingCreateInvoiceLineItem, createInvoiceFormLocalDataToRequest, initialInvoicingCreateInvoiceFormLocalData, } from './view/invoicing/createInvoice/createInvoiceFormConfig';
|
|
1093
1093
|
export { resetRecordPayment, initializeRecordPaymentDraft, submitRecordPayment, updateRecordPaymentFormDraft, } from './view/invoicing/recordPayment/recordPaymentReducer';
|
|
1094
1094
|
export { initializeIssueCreditNoteDraft, issueCreditNoteFailure, issueCreditNoteSuccess, resetIssueCreditNote, submitIssueCreditNote, updateIssueCreditNoteFormDraft, } from './view/invoicing/issueCreditNote/issueCreditNoteReducer';
|
|
@@ -45,6 +45,16 @@ const createInvoiceFormLocalDataToRequest = (localData) => {
|
|
|
45
45
|
quantity: toQuantity(line.quantity),
|
|
46
46
|
tax_amount: line.taxAmount.amount,
|
|
47
47
|
unit_amount: line.unitAmount.amount,
|
|
48
|
+
...(line.catalogLine != null
|
|
49
|
+
? {
|
|
50
|
+
entity_id: line.catalogLine.entityId,
|
|
51
|
+
entity_type: line.catalogLine.entityType,
|
|
52
|
+
is_taxed: line.catalogLine.isTaxed,
|
|
53
|
+
...(line.catalogLine.isTaxed
|
|
54
|
+
? {}
|
|
55
|
+
: { tax_exempt_reason: 'not_taxable' }),
|
|
56
|
+
}
|
|
57
|
+
: {}),
|
|
48
58
|
}));
|
|
49
59
|
const invoiceDate = localData.invoiceDate != null && localData.invoiceDate !== ''
|
|
50
60
|
? localData.invoiceDate
|
|
@@ -5,7 +5,11 @@ export interface CreateInvoiceLineItemRequest {
|
|
|
5
5
|
description: string;
|
|
6
6
|
quantity: number;
|
|
7
7
|
unit_amount: number;
|
|
8
|
+
entity_id?: string;
|
|
9
|
+
entity_type?: string;
|
|
10
|
+
is_taxed?: boolean;
|
|
8
11
|
tax_amount?: number;
|
|
12
|
+
tax_exempt_reason?: string;
|
|
9
13
|
}
|
|
10
14
|
/** Request body for creating an invoice; mirrors the Invoicing backend. */
|
|
11
15
|
export interface CreateInvoiceRequest {
|
|
@@ -4,7 +4,7 @@ import { Address } from '../../../entity/address/addressState';
|
|
|
4
4
|
import { InvoicingCatalogPricePoint } from '../../../entity/invoicing/invoicingCatalog/invoicingCatalogState';
|
|
5
5
|
import { InvoicingFieldHelpByCode, InvoicingSettingsPayload } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
6
6
|
import { RootState } from '../../../rootStateTypes';
|
|
7
|
-
import { InvoicingCreateInvoiceFormLocalData } from './createInvoiceState';
|
|
7
|
+
import { InvoicingCreateInvoiceCatalogLine, InvoicingCreateInvoiceFormLocalData } from './createInvoiceState';
|
|
8
8
|
/**
|
|
9
9
|
* One catalog plan price, split into its two naming parts so consumers can
|
|
10
10
|
* compose the label themselves (the plan family name and the price point/price
|
|
@@ -18,6 +18,7 @@ import { InvoicingCreateInvoiceFormLocalData } from './createInvoiceState';
|
|
|
18
18
|
* produce a plausible-looking wrong total. Those lines start unpriced.
|
|
19
19
|
*/
|
|
20
20
|
export interface InvoicingPlanNameOption {
|
|
21
|
+
catalogLine: InvoicingCreateInvoiceCatalogLine;
|
|
21
22
|
planName: string;
|
|
22
23
|
subFamilyName: string;
|
|
23
24
|
price?: number;
|
|
@@ -76,6 +76,12 @@ const getCreateInvoiceFormView = (state) => {
|
|
|
76
76
|
planNames: catalogListView.plans.flatMap((plan) => (plan.subFamilies ?? [])
|
|
77
77
|
.filter((subFamily) => (subFamily.name ?? '') !== '')
|
|
78
78
|
.map((subFamily) => ({
|
|
79
|
+
// A price point with no flag is taxable, as subscription billing reads it.
|
|
80
|
+
catalogLine: {
|
|
81
|
+
entityId: subFamily.id,
|
|
82
|
+
entityType: plan.itemType ?? 'plan',
|
|
83
|
+
isTaxed: subFamily.isTaxable ?? true,
|
|
84
|
+
},
|
|
79
85
|
planName: plan.name ?? '',
|
|
80
86
|
price: planNamePrefillPrice(subFamily),
|
|
81
87
|
subFamilyName: subFamily.name ?? '',
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { Amount } from '../../../commonStateTypes/amount';
|
|
2
2
|
import { FetchedState, ID } from '../../../commonStateTypes/common';
|
|
3
3
|
import { CreateInvoiceRequest } from './createInvoicePayload';
|
|
4
|
+
/**
|
|
5
|
+
* The catalog price point a line was picked from, so the invoice line links to
|
|
6
|
+
* it and takes its taxability, the way subscription billing builds its lines.
|
|
7
|
+
*/
|
|
8
|
+
export interface InvoicingCreateInvoiceCatalogLine {
|
|
9
|
+
entityId: ID;
|
|
10
|
+
entityType: string;
|
|
11
|
+
isTaxed: boolean;
|
|
12
|
+
}
|
|
4
13
|
/**
|
|
5
14
|
* A single line item in the create-invoice form draft. Amounts are USD values
|
|
6
15
|
* (whole units, e.g. dollars) held via the `Amount` interface — never minor
|
|
@@ -11,6 +20,8 @@ export interface InvoicingCreateInvoiceFormLineItem {
|
|
|
11
20
|
quantity: string;
|
|
12
21
|
taxAmount: Amount;
|
|
13
22
|
unitAmount: Amount;
|
|
23
|
+
/** Unset for a typed description, which the backend taxes by default. */
|
|
24
|
+
catalogLine?: InvoicingCreateInvoiceCatalogLine;
|
|
14
25
|
}
|
|
15
26
|
/**
|
|
16
27
|
* Draft form state for the create-invoice form. Held in CES so the form flows
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.2.
|
|
3
|
+
"version": "5.2.77",
|
|
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
|
"module": "lib/esm/index.js",
|