@zeniai/client-epic-state 5.0.51-betaRD3 → 5.0.51

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.0.51-betaRD3",
3
+ "version": "5.0.51",
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",
@@ -1,21 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { RootState } from '../../../reducer';
3
- import { ZeniAPI } from '../../../zeniAPI';
4
- import { saveConnectorCredentials, saveConnectorCredentialsFailure, saveConnectorCredentialsSuccess } from '../tenantReducer';
5
- export type ActionType = ReturnType<typeof saveConnectorCredentials> | ReturnType<typeof saveConnectorCredentialsSuccess> | ReturnType<typeof saveConnectorCredentialsFailure>;
6
- export declare const saveConnectorCredentialsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
7
- payload: {
8
- tenantId: string;
9
- connectionType: "revenue" | "payments";
10
- connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal";
11
- connectionPayload: import("../tenantPayload").ConnectionDataPayload;
12
- };
13
- type: "tenant/saveConnectorCredentialsSuccess";
14
- } | {
15
- payload: {
16
- tenantId: string;
17
- connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal";
18
- status: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
19
- };
20
- type: "tenant/saveConnectorCredentialsFailure";
21
- }>;
@@ -1,42 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.saveConnectorCredentialsEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../../responsePayload");
7
- const tenantReducer_1 = require("../tenantReducer");
8
- // Backs the new POST /1.0/connectors/<slug>/credentials endpoint used by
9
- // Phase 1 connectors (Stripe + Mercury api_key, PayPal client_credentials).
10
- // The endpoint is slug-keyed and creates-or-updates the Connection row, so the
11
- // FE doesn't need a connection_id in the URL. The credentials payload is
12
- // connector-specific (api_key, or client_id+client_secret) and is forwarded
13
- // verbatim to the BE — connector-side validation lives in
14
- // prepare_credential_update_args on the tenant service.
15
- const saveConnectorCredentialsEpic = (actions$,
16
- // Underscore prefix marks the parameter as intentionally unused today but
17
- // names what it will become — when we wire an in-progress guard (so a
18
- // second save click can't `switchMap`-cancel an in-flight save and leave
19
- // the BE in an indeterminate state), drop the underscore and read state
20
- // here.
21
- _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(tenantReducer_1.saveConnectorCredentials.match), (0, operators_1.switchMap)((action) => zeniAPI
22
- .postAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/connectors/${action.payload.connectionName}/credentials`, action.payload.credentials, { 'zeni-tenant-id': action.payload.tenantId })
23
- .pipe((0, operators_1.mergeMap)((response) => {
24
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
25
- return (0, rxjs_1.from)([
26
- (0, tenantReducer_1.saveConnectorCredentialsSuccess)(action.payload.tenantId, action.payload.connectionType, action.payload.connectionName, response.data),
27
- ]);
28
- }
29
- const status = response.status ??
30
- (0, responsePayload_1.createZeniAPIStatus)('Failed to save connection. Please try again.');
31
- return (0, rxjs_1.from)([
32
- (0, tenantReducer_1.saveConnectorCredentialsFailure)(action.payload.tenantId, action.payload.connectionName, status),
33
- ]);
34
- }), (0, operators_1.catchError)((error) => {
35
- const message = error instanceof Error
36
- ? error.message
37
- : 'Unexpected error saving connection.';
38
- return (0, rxjs_1.from)([
39
- (0, tenantReducer_1.saveConnectorCredentialsFailure)(action.payload.tenantId, action.payload.connectionName, (0, responsePayload_1.createZeniAPIStatus)(message)),
40
- ]);
41
- }))));
42
- exports.saveConnectorCredentialsEpic = saveConnectorCredentialsEpic;
@@ -1,38 +0,0 @@
1
- import { from } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
4
- import { saveConnectorCredentials, saveConnectorCredentialsFailure, saveConnectorCredentialsSuccess, } from '../tenantReducer';
5
- // Backs the new POST /1.0/connectors/<slug>/credentials endpoint used by
6
- // Phase 1 connectors (Stripe + Mercury api_key, PayPal client_credentials).
7
- // The endpoint is slug-keyed and creates-or-updates the Connection row, so the
8
- // FE doesn't need a connection_id in the URL. The credentials payload is
9
- // connector-specific (api_key, or client_id+client_secret) and is forwarded
10
- // verbatim to the BE — connector-side validation lives in
11
- // prepare_credential_update_args on the tenant service.
12
- export const saveConnectorCredentialsEpic = (actions$,
13
- // Underscore prefix marks the parameter as intentionally unused today but
14
- // names what it will become — when we wire an in-progress guard (so a
15
- // second save click can't `switchMap`-cancel an in-flight save and leave
16
- // the BE in an indeterminate state), drop the underscore and read state
17
- // here.
18
- _state$, zeniAPI) => actions$.pipe(filter(saveConnectorCredentials.match), switchMap((action) => zeniAPI
19
- .postAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/connectors/${action.payload.connectionName}/credentials`, action.payload.credentials, { 'zeni-tenant-id': action.payload.tenantId })
20
- .pipe(mergeMap((response) => {
21
- if (isSuccessResponse(response) && response.data != null) {
22
- return from([
23
- saveConnectorCredentialsSuccess(action.payload.tenantId, action.payload.connectionType, action.payload.connectionName, response.data),
24
- ]);
25
- }
26
- const status = response.status ??
27
- createZeniAPIStatus('Failed to save connection. Please try again.');
28
- return from([
29
- saveConnectorCredentialsFailure(action.payload.tenantId, action.payload.connectionName, status),
30
- ]);
31
- }), catchError((error) => {
32
- const message = error instanceof Error
33
- ? error.message
34
- : 'Unexpected error saving connection.';
35
- return from([
36
- saveConnectorCredentialsFailure(action.payload.tenantId, action.payload.connectionName, createZeniAPIStatus(message)),
37
- ]);
38
- }))));