@zeniai/client-epic-state 5.1.32-betaAK0 → 5.1.32-betaAK1
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/esm/view/invoicing/settingsView/settingsViewEpics.js +18 -4
- package/lib/esm/view/invoicing/settingsView/settingsViewReducer.js +9 -3
- package/lib/index.d.ts +1 -0
- package/lib/view/invoicing/settingsView/settingsViewEpics.js +18 -4
- package/lib/view/invoicing/settingsView/settingsViewPayload.d.ts +11 -1
- package/lib/view/invoicing/settingsView/settingsViewReducer.d.ts +6 -1
- package/lib/view/invoicing/settingsView/settingsViewReducer.js +9 -3
- package/package.json +1 -1
|
@@ -12,13 +12,24 @@ export const fetchInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => action
|
|
|
12
12
|
}), catchError((error) => of(updateInvoicingSettingsFailure(createZeniAPIStatus('Unexpected Error', 'Fetch settings REST API call errored out ' +
|
|
13
13
|
JSON.stringify(error))))));
|
|
14
14
|
}));
|
|
15
|
-
export const connectInvoicingStripeEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(connectInvoicingStripe.match), switchMap(() => {
|
|
15
|
+
export const connectInvoicingStripeEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(connectInvoicingStripe.match), switchMap((action) => {
|
|
16
16
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings/stripe-connect/setup`;
|
|
17
|
+
const { api_key, publishable_key, webhook_secret } = action.payload;
|
|
18
|
+
const body = {
|
|
19
|
+
api_key,
|
|
20
|
+
publishable_key,
|
|
21
|
+
...(webhook_secret != null && webhook_secret !== ''
|
|
22
|
+
? { webhook_secret }
|
|
23
|
+
: {}),
|
|
24
|
+
};
|
|
17
25
|
return zeniAPI
|
|
18
|
-
.postAndGetJSON(apiUrl,
|
|
26
|
+
.postAndGetJSON(apiUrl, body)
|
|
19
27
|
.pipe(switchMap((response) => {
|
|
20
28
|
if (isSuccessResponse(response) && response.data != null) {
|
|
21
|
-
return of(updateInvoicingStripeConnection(
|
|
29
|
+
return of(updateInvoicingStripeConnection({
|
|
30
|
+
stripe_connected: response.data.stripe_connected,
|
|
31
|
+
publishable_key: response.data.publishable_key,
|
|
32
|
+
}));
|
|
22
33
|
}
|
|
23
34
|
return of(invoicingStripeConnectionFailure(response.status));
|
|
24
35
|
}), catchError((error) => of(invoicingStripeConnectionFailure(createZeniAPIStatus('Unexpected Error', 'Stripe connect setup REST API call errored out ' +
|
|
@@ -30,7 +41,10 @@ export const disconnectInvoicingStripeEpic = (actions$, _state$, zeniAPI) => act
|
|
|
30
41
|
.deleteAndGetJSON(apiUrl)
|
|
31
42
|
.pipe(switchMap((response) => {
|
|
32
43
|
if (isSuccessResponse(response)) {
|
|
33
|
-
return of(updateInvoicingStripeConnection(
|
|
44
|
+
return of(updateInvoicingStripeConnection({
|
|
45
|
+
stripe_connected: false,
|
|
46
|
+
publishable_key: '',
|
|
47
|
+
}));
|
|
34
48
|
}
|
|
35
49
|
return of(invoicingStripeConnectionFailure(response.status));
|
|
36
50
|
}), catchError((error) => of(invoicingStripeConnectionFailure(createZeniAPIStatus('Unexpected Error', 'Stripe disconnect REST API call errored out ' +
|
|
@@ -42,8 +42,13 @@ const settingsView = createSlice({
|
|
|
42
42
|
resetSaveInvoicingSettings(draft) {
|
|
43
43
|
draft.saveFetchState = { fetchState: 'Not-Started', error: undefined };
|
|
44
44
|
},
|
|
45
|
-
connectInvoicingStripe
|
|
46
|
-
draft
|
|
45
|
+
connectInvoicingStripe: {
|
|
46
|
+
reducer(draft) {
|
|
47
|
+
draft.stripeFetchState = { fetchState: 'In-Progress', error: undefined };
|
|
48
|
+
},
|
|
49
|
+
prepare(credentials) {
|
|
50
|
+
return { payload: credentials };
|
|
51
|
+
},
|
|
47
52
|
},
|
|
48
53
|
disconnectInvoicingStripe(draft) {
|
|
49
54
|
draft.stripeFetchState = { fetchState: 'In-Progress', error: undefined };
|
|
@@ -53,7 +58,8 @@ const settingsView = createSlice({
|
|
|
53
58
|
if (draft.settings != null) {
|
|
54
59
|
draft.settings = {
|
|
55
60
|
...draft.settings,
|
|
56
|
-
|
|
61
|
+
stripe_connected: action.payload.stripe_connected,
|
|
62
|
+
stripe_publishable_key: action.payload.publishable_key ?? '',
|
|
57
63
|
};
|
|
58
64
|
}
|
|
59
65
|
},
|
package/lib/index.d.ts
CHANGED
|
@@ -1008,6 +1008,7 @@ export type { InvoicingApprovalItem, InvoicingApprovalStatus, } from './view/inv
|
|
|
1008
1008
|
export type { InvoicingAuditEntry } from './view/invoicing/auditView/auditViewPayload';
|
|
1009
1009
|
export type { InvoicingDataImportStatusRow, InvoicingMigrationIssue, InvoicingMigrationModuleSummary, InvoicingMigrationSession, InvoicingMigrationStatus, InvoicingMigrationSummary, } from './view/invoicing/dataImportView/dataImportViewPayload';
|
|
1010
1010
|
export type { InvoicingAgingBuckets, InvoicingAgingReport, InvoicingAgingReportSummary, InvoicingCustomerMovementReport, InvoicingCustomerMovementRow, InvoicingDeferredRevenueKPIs, InvoicingDeferredRevenueObligationRow, InvoicingDeferredRevenueReport, InvoicingDeferredRevenueScheduleRow, } from './view/invoicing/reportsView/reportsViewPayload';
|
|
1011
|
+
export type { StripeConnectCredentials } from './view/invoicing/settingsView/settingsViewPayload';
|
|
1011
1012
|
export { clearAllInvoices, removeInvoice, updateInvoices, } from './entity/invoicing/invoice/invoiceReducer';
|
|
1012
1013
|
export { getInvoiceById, getInvoicesByIds, } from './entity/invoicing/invoice/invoiceSelector';
|
|
1013
1014
|
export { clearInvoiceList, fetchInvoiceCounts, fetchInvoiceKPIs, fetchInvoiceList, updateInvoiceListFilters, } from './view/invoicing/invoiceList/invoiceListReducer';
|
|
@@ -16,13 +16,24 @@ const fetchInvoicingSettingsEpic = (actions$, _state$, zeniAPI) => actions$.pipe
|
|
|
16
16
|
JSON.stringify(error))))));
|
|
17
17
|
}));
|
|
18
18
|
exports.fetchInvoicingSettingsEpic = fetchInvoicingSettingsEpic;
|
|
19
|
-
const connectInvoicingStripeEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.connectInvoicingStripe.match), (0, operators_1.switchMap)(() => {
|
|
19
|
+
const connectInvoicingStripeEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(settingsViewReducer_1.connectInvoicingStripe.match), (0, operators_1.switchMap)((action) => {
|
|
20
20
|
const apiUrl = `${zeniAPI.apiEndPoints.invoicingMicroServiceBaseUrl}/1.0/settings/stripe-connect/setup`;
|
|
21
|
+
const { api_key, publishable_key, webhook_secret } = action.payload;
|
|
22
|
+
const body = {
|
|
23
|
+
api_key,
|
|
24
|
+
publishable_key,
|
|
25
|
+
...(webhook_secret != null && webhook_secret !== ''
|
|
26
|
+
? { webhook_secret }
|
|
27
|
+
: {}),
|
|
28
|
+
};
|
|
21
29
|
return zeniAPI
|
|
22
|
-
.postAndGetJSON(apiUrl,
|
|
30
|
+
.postAndGetJSON(apiUrl, body)
|
|
23
31
|
.pipe((0, operators_1.switchMap)((response) => {
|
|
24
32
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
25
|
-
return (0, rxjs_1.of)((0, settingsViewReducer_1.updateInvoicingStripeConnection)(
|
|
33
|
+
return (0, rxjs_1.of)((0, settingsViewReducer_1.updateInvoicingStripeConnection)({
|
|
34
|
+
stripe_connected: response.data.stripe_connected,
|
|
35
|
+
publishable_key: response.data.publishable_key,
|
|
36
|
+
}));
|
|
26
37
|
}
|
|
27
38
|
return (0, rxjs_1.of)((0, settingsViewReducer_1.invoicingStripeConnectionFailure)(response.status));
|
|
28
39
|
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, settingsViewReducer_1.invoicingStripeConnectionFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Stripe connect setup REST API call errored out ' +
|
|
@@ -35,7 +46,10 @@ const disconnectInvoicingStripeEpic = (actions$, _state$, zeniAPI) => actions$.p
|
|
|
35
46
|
.deleteAndGetJSON(apiUrl)
|
|
36
47
|
.pipe((0, operators_1.switchMap)((response) => {
|
|
37
48
|
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
38
|
-
return (0, rxjs_1.of)((0, settingsViewReducer_1.updateInvoicingStripeConnection)(
|
|
49
|
+
return (0, rxjs_1.of)((0, settingsViewReducer_1.updateInvoicingStripeConnection)({
|
|
50
|
+
stripe_connected: false,
|
|
51
|
+
publishable_key: '',
|
|
52
|
+
}));
|
|
39
53
|
}
|
|
40
54
|
return (0, rxjs_1.of)((0, settingsViewReducer_1.invoicingStripeConnectionFailure)(response.status));
|
|
41
55
|
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, settingsViewReducer_1.invoicingStripeConnectionFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Stripe disconnect REST API call errored out ' +
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import { InvoicingSettingsPayload } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
2
2
|
import { ZeniAPIResponse } from '../../../responsePayload';
|
|
3
|
+
/** Credentials the merchant pastes to connect their own Stripe account (BYOK). */
|
|
4
|
+
export interface StripeConnectCredentials {
|
|
5
|
+
/** Restricted/secret key (rk_/sk_) used server-side for all charges. */
|
|
6
|
+
api_key: string;
|
|
7
|
+
/** Publishable key (pk_) used by Stripe.js in the browser card flow. */
|
|
8
|
+
publishable_key: string;
|
|
9
|
+
/** Optional webhook signing secret (whsec_) for verifying this account's events. */
|
|
10
|
+
webhook_secret?: string;
|
|
11
|
+
}
|
|
3
12
|
interface StripeConnectResponse {
|
|
4
|
-
|
|
13
|
+
publishable_key: string;
|
|
14
|
+
stripe_connected: boolean;
|
|
5
15
|
}
|
|
6
16
|
export type InvoicingSettingsResponse = ZeniAPIResponse<InvoicingSettingsPayload>;
|
|
7
17
|
export type InvoicingStripeConnectResponse = ZeniAPIResponse<StripeConnectResponse>;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { InvoicingSettingsPayload } from '../../../entity/invoicing/invoicingCommonPayload';
|
|
2
2
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
3
|
+
import { StripeConnectCredentials } from './settingsViewPayload';
|
|
3
4
|
import { InvoicingSettingsViewState } from './settingsViewState';
|
|
5
|
+
export interface InvoicingStripeConnectionUpdate {
|
|
6
|
+
stripe_connected: boolean;
|
|
7
|
+
publishable_key?: string;
|
|
8
|
+
}
|
|
4
9
|
export declare const initialState: InvoicingSettingsViewState;
|
|
5
|
-
export declare const fetchInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/fetchInvoicingSettings">, updateInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingSettingsPayload, "invoicingSettingsView/updateInvoicingSettings">, updateInvoicingSettingsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingSettingsView/updateInvoicingSettingsFailure">, saveInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithPayload<Partial<InvoicingSettingsPayload>, "invoicingSettingsView/saveInvoicingSettings">, saveInvoicingSettingsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingSettingsPayload, "invoicingSettingsView/saveInvoicingSettingsSuccess">, saveInvoicingSettingsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingSettingsView/saveInvoicingSettingsFailure">, resetSaveInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/resetSaveInvoicingSettings">, connectInvoicingStripe: import("@reduxjs/toolkit").
|
|
10
|
+
export declare const fetchInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/fetchInvoicingSettings">, updateInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingSettingsPayload, "invoicingSettingsView/updateInvoicingSettings">, updateInvoicingSettingsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingSettingsView/updateInvoicingSettingsFailure">, saveInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithPayload<Partial<InvoicingSettingsPayload>, "invoicingSettingsView/saveInvoicingSettings">, saveInvoicingSettingsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingSettingsPayload, "invoicingSettingsView/saveInvoicingSettingsSuccess">, saveInvoicingSettingsFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingSettingsView/saveInvoicingSettingsFailure">, resetSaveInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/resetSaveInvoicingSettings">, connectInvoicingStripe: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[credentials: StripeConnectCredentials], StripeConnectCredentials, "invoicingSettingsView/connectInvoicingStripe", never, never>, disconnectInvoicingStripe: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/disconnectInvoicingStripe">, updateInvoicingStripeConnection: import("@reduxjs/toolkit").ActionCreatorWithPayload<InvoicingStripeConnectionUpdate, "invoicingSettingsView/updateInvoicingStripeConnection">, invoicingStripeConnectionFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "invoicingSettingsView/invoicingStripeConnectionFailure">, clearInvoicingSettings: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"invoicingSettingsView/clearInvoicingSettings">;
|
|
6
11
|
declare const _default: import("redux").Reducer<InvoicingSettingsViewState>;
|
|
7
12
|
export default _default;
|
|
@@ -46,8 +46,13 @@ const settingsView = (0, toolkit_1.createSlice)({
|
|
|
46
46
|
resetSaveInvoicingSettings(draft) {
|
|
47
47
|
draft.saveFetchState = { fetchState: 'Not-Started', error: undefined };
|
|
48
48
|
},
|
|
49
|
-
connectInvoicingStripe
|
|
50
|
-
draft
|
|
49
|
+
connectInvoicingStripe: {
|
|
50
|
+
reducer(draft) {
|
|
51
|
+
draft.stripeFetchState = { fetchState: 'In-Progress', error: undefined };
|
|
52
|
+
},
|
|
53
|
+
prepare(credentials) {
|
|
54
|
+
return { payload: credentials };
|
|
55
|
+
},
|
|
51
56
|
},
|
|
52
57
|
disconnectInvoicingStripe(draft) {
|
|
53
58
|
draft.stripeFetchState = { fetchState: 'In-Progress', error: undefined };
|
|
@@ -57,7 +62,8 @@ const settingsView = (0, toolkit_1.createSlice)({
|
|
|
57
62
|
if (draft.settings != null) {
|
|
58
63
|
draft.settings = {
|
|
59
64
|
...draft.settings,
|
|
60
|
-
|
|
65
|
+
stripe_connected: action.payload.stripe_connected,
|
|
66
|
+
stripe_publishable_key: action.payload.publishable_key ?? '',
|
|
61
67
|
};
|
|
62
68
|
}
|
|
63
69
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.1.32-
|
|
3
|
+
"version": "5.1.32-betaAK1",
|
|
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",
|