@zeniai/client-epic-state 5.0.94 → 5.0.95-beta1ND
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/commonStateTypes/animations.d.ts +1 -1
- package/lib/commonStateTypes/animations.js +1 -0
- package/lib/entity/company/companyPayload.d.ts +4 -0
- package/lib/entity/company/companyPayload.js +4 -0
- package/lib/entity/company/companyStateTypes.d.ts +4 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +7 -0
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +2 -0
- package/lib/entity/paymentAccount/paymentAccountSelector.d.ts +1 -0
- package/lib/entity/paymentAccount/paymentAccountSelector.js +4 -0
- package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +1 -1
- package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.d.ts +21 -0
- package/lib/entity/tenant/epic/initEmailConnectOAuthEpic.js +54 -0
- 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 +1 -0
- package/lib/entity/tenant/tenantReducer.d.ts +38 -25
- package/lib/entity/tenant/tenantReducer.js +65 -5
- package/lib/entity/tenant/tenantState.d.ts +1 -0
- package/lib/epic.d.ts +6 -1
- package/lib/epic.js +7 -1
- package/lib/esm/commonStateTypes/animations.js +1 -0
- package/lib/esm/entity/company/companyPayload.js +4 -0
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +7 -0
- package/lib/esm/entity/paymentAccount/paymentAccountSelector.js +3 -0
- package/lib/esm/entity/tenant/epic/initEmailConnectOAuthEpic.js +50 -0
- package/lib/esm/entity/tenant/tenantReducer.js +63 -3
- package/lib/esm/epic.js +7 -1
- package/lib/esm/index.js +9 -6
- package/lib/esm/view/fileView/epic/deleteFileEpic.js +2 -2
- package/lib/esm/view/fileView/epic/deleteFileListEpic.js +2 -2
- package/lib/esm/view/fileView/epic/updateFileNameEpic.js +2 -2
- package/lib/esm/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +42 -0
- package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.js +29 -0
- package/lib/esm/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +40 -0
- package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewReducer.js +217 -50
- package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewSelector.js +7 -1
- package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewState.js +12 -0
- package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +58 -0
- package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +77 -0
- package/lib/esm/view/spendManagement/commonSetup/kycKybAutofillActions.js +14 -0
- package/lib/esm/view/spendManagement/commonSetup/kycKybParseMapper.js +210 -0
- package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +105 -52
- package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +6 -1
- package/lib/esm/view/spendManagement/commonSetup/types/kycKybAutofill.js +50 -0
- package/lib/index.d.ts +11 -7
- package/lib/index.js +54 -34
- package/lib/view/fileView/epic/deleteFileEpic.js +1 -1
- package/lib/view/fileView/epic/deleteFileListEpic.js +1 -1
- package/lib/view/fileView/epic/updateFileNameEpic.js +1 -1
- package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.d.ts +7 -0
- package/lib/view/onboardingView/customerView/epic/aiAgentsActivation/fetchAiAgentsActivationStatusEpic.js +46 -0
- package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.d.ts +8 -0
- package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiActivationViewedEpic.js +33 -0
- package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.d.ts +9 -0
- package/lib/view/onboardingView/customerView/epic/customerDetails/acknowledgeOnboardingAiFinanceTeamEpic.js +44 -0
- package/lib/view/onboardingView/customerView/onboardingCustomerViewPayload.d.ts +3 -0
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +41 -4
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +219 -51
- package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.d.ts +5 -1
- package/lib/view/onboardingView/customerView/onboardingCustomerViewSelector.js +11 -2
- package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +40 -0
- package/lib/view/onboardingView/customerView/onboardingCustomerViewState.js +13 -1
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.d.ts +28 -0
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +62 -0
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.d.ts +9 -0
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +81 -0
- package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.d.ts +33 -0
- package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.js +17 -0
- package/lib/view/spendManagement/commonSetup/kycKybParseMapper.d.ts +36 -0
- package/lib/view/spendManagement/commonSetup/kycKybParseMapper.js +218 -0
- package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +28 -2
- package/lib/view/spendManagement/commonSetup/setupViewReducer.js +106 -53
- package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +7 -2
- package/lib/view/spendManagement/commonSetup/setupViewSelector.js +6 -1
- package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +19 -0
- package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.d.ts +154 -0
- package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.js +55 -0
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const toAnimationsFileName: (v: string) => "Success" | "AiAgent" | "AiIconEntry" | "AiIconExit" | "AiIconLoop" | "AiStar" | "AiStarIcon" | "AiStarPlain" | "AIPoweredInvoiceDark" | "AIPoweredInvoiceLight" | "Angry" | "AutoTransfer" | "CloseCard" | "Confetti" | "ConfettiSuccess" | "DashboardChristmasSnow" | "DashboardNewYearShow" | "DashboardSidebarBottomChristmas" | "DashboardSidebarBottomHalloween" | "DashboardSidebarBottomNewYear" | "DashboardSidebarBottomThanksgiving" | "DashboardSidebarTopChristmas" | "DashboardSidebarTopHalloween" | "DashboardSidebarTopNewYear" | "DashboardSidebarTopThanksgiving" | "Distribution" | "DistributionDark" | "EarnYield" | "FastestWayDark" | "FastestWayLight" | "FinanceTeamDark" | "FinanceTeamLight" | "Happy" | "Liquidity" | "LockCard" | "MoneyTransferSuccess" | "MultiLevelApprovalDark" | "MultiLevelApprovalLight" | "NotHappy" | "Protection" | "ReceiptDark" | "ReceiptLight" | "Recurring" | "RecurringDark" | "ReimburseDark" | "ReimburseLight" | "RewardsDark" | "RewardsDarkHover" | "RewardsLight" | "RewardsLightHover" | "Ripple" | "Secure" | "Target" | "TargetDark" | "UnlockCard" | "VeryHappy" | "ZeniAssist";
|
|
1
|
+
export declare const toAnimationsFileName: (v: string) => "Success" | "AiAgent" | "AiIconEntry" | "AiIconExit" | "AiIconLoop" | "AiStar" | "AiStarIcon" | "AiStarPlain" | "AIPoweredInvoiceDark" | "AIPoweredInvoiceLight" | "Angry" | "AutoTransfer" | "CloseCard" | "Confetti" | "ConfettiSuccess" | "DashboardChristmasSnow" | "DashboardNewYearShow" | "DashboardSidebarBottomChristmas" | "DashboardSidebarBottomHalloween" | "DashboardSidebarBottomNewYear" | "DashboardSidebarBottomThanksgiving" | "DashboardSidebarTopChristmas" | "DashboardSidebarTopHalloween" | "DashboardSidebarTopNewYear" | "DashboardSidebarTopThanksgiving" | "Distribution" | "DistributionDark" | "EarnYield" | "FastestWayDark" | "FastestWayLight" | "FinanceTeamDark" | "FinanceTeamLight" | "Happy" | "Liquidity" | "LockCard" | "MoneyTransferSuccess" | "MultiLevelApprovalDark" | "MultiLevelApprovalLight" | "NotHappy" | "Protection" | "ReceiptDark" | "ReceiptLight" | "Recurring" | "RecurringDark" | "ReimburseDark" | "ReimburseLight" | "RewardsDark" | "RewardsDarkHover" | "RewardsLight" | "RewardsLightHover" | "Ripple" | "Secure" | "Target" | "TargetDark" | "UnlockCard" | "VeryHappy" | "Welcome" | "ZeniAssist";
|
|
2
2
|
export type AnimationFileName = ReturnType<typeof toAnimationsFileName>;
|
|
@@ -320,6 +320,10 @@ interface CompanyOnboardingInfoPayload {
|
|
|
320
320
|
is_subsidiary: boolean;
|
|
321
321
|
onboarding_user_ids: ID[];
|
|
322
322
|
parent_company_id: ID | null;
|
|
323
|
+
is_onboarding_ai_activation_viewed?: boolean;
|
|
324
|
+
is_onboarding_ai_finance_team_acknowledged?: boolean;
|
|
325
|
+
onboarding_ai_activation_viewed_by?: ID[];
|
|
326
|
+
onboarding_ai_finance_team_acknowledged_by?: ID[];
|
|
323
327
|
onboarding_info?: OnboardingInfoPayload;
|
|
324
328
|
subscription_billing_address_id?: ID;
|
|
325
329
|
}
|
|
@@ -333,7 +333,11 @@ const toCompanyOnboardingInfo = (payload) => ({
|
|
|
333
333
|
onboardingUserIds: payload.onboarding_user_ids,
|
|
334
334
|
isSubsidiary: payload.is_subsidiary,
|
|
335
335
|
parentCompanyId: payload.parent_company_id != null ? payload.parent_company_id : undefined,
|
|
336
|
+
isOnboardingAiFinanceTeamAcknowledged: payload.is_onboarding_ai_finance_team_acknowledged ?? false,
|
|
337
|
+
isOnboardingAiActivationViewed: payload.is_onboarding_ai_activation_viewed ?? false,
|
|
336
338
|
isOnboardingCompanyDetailsCompleted: payload.is_onboarding_company_details_step_completed,
|
|
339
|
+
onboardingAiFinanceTeamAcknowledgedBy: payload.onboarding_ai_finance_team_acknowledged_by ?? [],
|
|
340
|
+
onboardingAiActivationViewedBy: payload.onboarding_ai_activation_viewed_by ?? [],
|
|
337
341
|
onboardingInfo: (0, exports.toOnboardingInfo)(payload.onboarding_info),
|
|
338
342
|
isOnboardingCompleted: payload.is_onboarding_completed,
|
|
339
343
|
subscriptionBillingAddressId: payload.subscription_billing_address_id,
|
|
@@ -323,9 +323,13 @@ export interface OnboardingInfo extends OnboardingStepsInfo {
|
|
|
323
323
|
onboardingToQuoteSignMinutes?: number;
|
|
324
324
|
}
|
|
325
325
|
export interface CompanyOnboardingInfo {
|
|
326
|
+
isOnboardingAiActivationViewed: boolean;
|
|
327
|
+
isOnboardingAiFinanceTeamAcknowledged: boolean;
|
|
326
328
|
isOnboardingCompanyDetailsCompleted: boolean;
|
|
327
329
|
isOnboardingCompleted: boolean;
|
|
328
330
|
isSubsidiary: boolean;
|
|
331
|
+
onboardingAiActivationViewedBy: ID[];
|
|
332
|
+
onboardingAiFinanceTeamAcknowledgedBy: ID[];
|
|
329
333
|
onboardingUserIds: ID[];
|
|
330
334
|
onboardingInfo?: OnboardingInfo;
|
|
331
335
|
parentCompanyId?: ID;
|
|
@@ -16,6 +16,7 @@ export interface JEScheduleOtherAttributesPayload {
|
|
|
16
16
|
export interface JEScheduleAISummaryFieldPayload {
|
|
17
17
|
confidence: number;
|
|
18
18
|
reasoning: string;
|
|
19
|
+
cot?: string[];
|
|
19
20
|
predicted_value?: number | string;
|
|
20
21
|
}
|
|
21
22
|
export interface JEScheduleAISummariesPayload {
|
|
@@ -155,42 +155,49 @@ function toJEScheduleAISummaries(payload) {
|
|
|
155
155
|
result.debitAccount = {
|
|
156
156
|
confidence: payload.debit_account.confidence,
|
|
157
157
|
reasoning: payload.debit_account.reasoning,
|
|
158
|
+
cot: Array.isArray(payload.debit_account.cot) ? payload.debit_account.cot : undefined,
|
|
158
159
|
};
|
|
159
160
|
}
|
|
160
161
|
if (payload.credit_account != null) {
|
|
161
162
|
result.creditAccount = {
|
|
162
163
|
confidence: payload.credit_account.confidence,
|
|
163
164
|
reasoning: payload.credit_account.reasoning,
|
|
165
|
+
cot: Array.isArray(payload.credit_account.cot) ? payload.credit_account.cot : undefined,
|
|
164
166
|
};
|
|
165
167
|
}
|
|
166
168
|
if (payload.debit_accounting_class != null) {
|
|
167
169
|
result.debitClass = {
|
|
168
170
|
confidence: payload.debit_accounting_class.confidence,
|
|
169
171
|
reasoning: payload.debit_accounting_class.reasoning,
|
|
172
|
+
cot: Array.isArray(payload.debit_accounting_class.cot) ? payload.debit_accounting_class.cot : undefined,
|
|
170
173
|
};
|
|
171
174
|
}
|
|
172
175
|
if (payload.credit_accounting_class != null) {
|
|
173
176
|
result.creditClass = {
|
|
174
177
|
confidence: payload.credit_accounting_class.confidence,
|
|
175
178
|
reasoning: payload.credit_accounting_class.reasoning,
|
|
179
|
+
cot: Array.isArray(payload.credit_accounting_class.cot) ? payload.credit_accounting_class.cot : undefined,
|
|
176
180
|
};
|
|
177
181
|
}
|
|
178
182
|
if (payload.period != null) {
|
|
179
183
|
result.period = {
|
|
180
184
|
confidence: payload.period.confidence,
|
|
181
185
|
reasoning: payload.period.reasoning,
|
|
186
|
+
cot: Array.isArray(payload.period.cot) ? payload.period.cot : undefined,
|
|
182
187
|
};
|
|
183
188
|
}
|
|
184
189
|
if (payload.posting_date != null) {
|
|
185
190
|
result.postingDate = {
|
|
186
191
|
confidence: payload.posting_date.confidence,
|
|
187
192
|
reasoning: payload.posting_date.reasoning,
|
|
193
|
+
cot: Array.isArray(payload.posting_date.cot) ? payload.posting_date.cot : undefined,
|
|
188
194
|
};
|
|
189
195
|
}
|
|
190
196
|
if (payload.schedule_type != null) {
|
|
191
197
|
result.scheduleType = {
|
|
192
198
|
confidence: payload.schedule_type.confidence,
|
|
193
199
|
reasoning: payload.schedule_type.reasoning,
|
|
200
|
+
cot: Array.isArray(payload.schedule_type.cot) ? payload.schedule_type.cot : undefined,
|
|
194
201
|
};
|
|
195
202
|
}
|
|
196
203
|
return Object.keys(result).length > 0 ? result : undefined;
|
|
@@ -14,7 +14,9 @@ export interface ScheduleJournalStatusCode {
|
|
|
14
14
|
}
|
|
15
15
|
export interface JEScheduleFieldRecommendation {
|
|
16
16
|
confidence: number;
|
|
17
|
+
/** @deprecated prefer cot */
|
|
17
18
|
reasoning: string;
|
|
19
|
+
cot?: string[];
|
|
18
20
|
}
|
|
19
21
|
export interface JEScheduleAISummaries {
|
|
20
22
|
creditAccount?: JEScheduleFieldRecommendation;
|
|
@@ -4,3 +4,4 @@ export declare function getPaymentAccountsByPaymentAccountIds(paymentAccountStat
|
|
|
4
4
|
export declare function getPaymentAccountByPaymentAccountId(paymentAccountState: PaymentAccountState, PaymentAccountId: ID): PaymentAccount | undefined;
|
|
5
5
|
export declare function getPaymentAccountByBankAccountId(paymentAccountState: PaymentAccountState, bankAccountId: ID): PaymentAccount | undefined;
|
|
6
6
|
export declare function getPaymentAccountsByBankAccountIds(paymentAccountState: PaymentAccountState, bankAccountIds: ID[]): PaymentAccount[];
|
|
7
|
+
export declare function getPlaidPaymentAccounts(paymentAccountState: PaymentAccountState): PaymentAccount[];
|
|
@@ -7,6 +7,7 @@ exports.getPaymentAccountsByPaymentAccountIds = getPaymentAccountsByPaymentAccou
|
|
|
7
7
|
exports.getPaymentAccountByPaymentAccountId = getPaymentAccountByPaymentAccountId;
|
|
8
8
|
exports.getPaymentAccountByBankAccountId = getPaymentAccountByBankAccountId;
|
|
9
9
|
exports.getPaymentAccountsByBankAccountIds = getPaymentAccountsByBankAccountIds;
|
|
10
|
+
exports.getPlaidPaymentAccounts = getPlaidPaymentAccounts;
|
|
10
11
|
const get_1 = __importDefault(require("lodash/get"));
|
|
11
12
|
const values_1 = __importDefault(require("lodash/values"));
|
|
12
13
|
function getPaymentAccountsByPaymentAccountIds(paymentAccountState, paymentAccountIds) {
|
|
@@ -28,3 +29,6 @@ function getPaymentAccountsByBankAccountIds(paymentAccountState, bankAccountIds)
|
|
|
28
29
|
.filter((value) => value != null);
|
|
29
30
|
return paymentAccounts;
|
|
30
31
|
}
|
|
32
|
+
function getPlaidPaymentAccounts(paymentAccountState) {
|
|
33
|
+
return (0, values_1.default)(paymentAccountState.paymentAccountByID).filter((account) => account.provider === 'plaid');
|
|
34
|
+
}
|
|
@@ -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" | "payments";
|
|
10
|
+
connectionType: "revenue" | "email" | "payments";
|
|
11
11
|
};
|
|
12
12
|
type: "tenant/deleteConnectionSuccess";
|
|
13
13
|
} | {
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { RootState } from '../../../reducer';
|
|
3
|
+
import { ZeniAPI } from '../../../zeniAPI';
|
|
4
|
+
import { initEmailConnectOAuth, initEmailConnectOAuthFailure, initEmailConnectOAuthSuccess } from '../tenantReducer';
|
|
5
|
+
export type ActionType = ReturnType<typeof initEmailConnectOAuth> | ReturnType<typeof initEmailConnectOAuthSuccess> | ReturnType<typeof initEmailConnectOAuthFailure>;
|
|
6
|
+
export type NavigateFn = (url: string) => void;
|
|
7
|
+
export declare const initEmailConnectOAuthEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI, navigate?: NavigateFn) => import("rxjs").Observable<{
|
|
8
|
+
payload: {
|
|
9
|
+
tenantId: string;
|
|
10
|
+
provider: "gmail" | "outlook";
|
|
11
|
+
authorizationUrl: string;
|
|
12
|
+
};
|
|
13
|
+
type: "tenant/initEmailConnectOAuthSuccess";
|
|
14
|
+
} | {
|
|
15
|
+
payload: {
|
|
16
|
+
tenantId: string;
|
|
17
|
+
provider: "gmail" | "outlook";
|
|
18
|
+
status: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
|
|
19
|
+
};
|
|
20
|
+
type: "tenant/initEmailConnectOAuthFailure";
|
|
21
|
+
}>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initEmailConnectOAuthEpic = 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
|
+
const defaultNavigate = (url) => {
|
|
9
|
+
// Production path: full-page redirect. The user's session continues on the
|
|
10
|
+
// provider's consent screen and lands back on this app via auth's HTML
|
|
11
|
+
// callback page (which itself redirects to redirect_after_url with the
|
|
12
|
+
// result encoded as a query param).
|
|
13
|
+
if (typeof window !== 'undefined') {
|
|
14
|
+
window.location.href = url;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
// Backs the new POST /1.0/connectors/email/<provider>/init endpoint on the
|
|
18
|
+
// auth service. The endpoint creates a CSRF state token in the auth NDB
|
|
19
|
+
// store and returns the provider's authorization_url; this epic then drives
|
|
20
|
+
// a full-page redirect so the user lands on Google's / Microsoft's consent
|
|
21
|
+
// screen. After consent the user lands on auth's callback, which writes the
|
|
22
|
+
// resulting tokens through to tenant and redirects the browser back to
|
|
23
|
+
// ``redirectAfterUrl`` with ``?email_connect_result=<json>`` for the
|
|
24
|
+
// integrations page to consume on mount.
|
|
25
|
+
const initEmailConnectOAuthEpic = (actions$, _state$, zeniAPI,
|
|
26
|
+
// Test seam: callers can override to assert intended URL without actually
|
|
27
|
+
// navigating. Default is full-page redirect via window.location.
|
|
28
|
+
navigate = defaultNavigate) => actions$.pipe((0, operators_1.filter)(tenantReducer_1.initEmailConnectOAuth.match), (0, operators_1.switchMap)((action) => zeniAPI
|
|
29
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/1.0/connectors/email/${action.payload.provider}/init`, { redirect_after_url: action.payload.redirectAfterUrl }, { 'zeni-tenant-id': action.payload.tenantId })
|
|
30
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
31
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
32
|
+
// Fire-and-forget side effect — once the browser navigates,
|
|
33
|
+
// any further state we'd dispatch here is irrelevant. We still
|
|
34
|
+
// emit the success action so subscribers (tests, analytics)
|
|
35
|
+
// can observe the URL the epic decided to navigate to.
|
|
36
|
+
navigate(response.data.authorization_url);
|
|
37
|
+
return (0, rxjs_1.from)([
|
|
38
|
+
(0, tenantReducer_1.initEmailConnectOAuthSuccess)(action.payload.tenantId, action.payload.provider, response.data.authorization_url),
|
|
39
|
+
]);
|
|
40
|
+
}
|
|
41
|
+
const status = response.status ??
|
|
42
|
+
(0, responsePayload_1.createZeniAPIStatus)(`Failed to start ${action.payload.provider} connection. Please try again.`);
|
|
43
|
+
return (0, rxjs_1.from)([
|
|
44
|
+
(0, tenantReducer_1.initEmailConnectOAuthFailure)(action.payload.tenantId, action.payload.provider, status),
|
|
45
|
+
]);
|
|
46
|
+
}), (0, operators_1.catchError)((error) => {
|
|
47
|
+
const message = error instanceof Error
|
|
48
|
+
? error.message
|
|
49
|
+
: `Unexpected error starting ${action.payload.provider} connection.`;
|
|
50
|
+
return (0, rxjs_1.from)([
|
|
51
|
+
(0, tenantReducer_1.initEmailConnectOAuthFailure)(action.payload.tenantId, action.payload.provider, (0, responsePayload_1.createZeniAPIStatus)(message)),
|
|
52
|
+
]);
|
|
53
|
+
}))));
|
|
54
|
+
exports.initEmailConnectOAuthEpic = initEmailConnectOAuthEpic;
|
|
@@ -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" | "payments";
|
|
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" | "payments";
|
|
10
|
-
connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal";
|
|
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";
|
|
17
|
+
connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook";
|
|
18
18
|
status: import("../../../responsePayload").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" | "payments";
|
|
9
|
+
connectionType: "revenue" | "email" | "payments";
|
|
10
10
|
connectionPayload: import("../tenantPayload").ConnectionDataPayload;
|
|
11
11
|
};
|
|
12
12
|
type: "tenant/saveOAuthConnectionSuccess";
|
|
@@ -13,9 +13,9 @@ export interface DoSignInPayload {
|
|
|
13
13
|
redirectUri: ZeniUrl;
|
|
14
14
|
sourceUri: ZeniUrl;
|
|
15
15
|
}
|
|
16
|
-
export declare const toExternalIntegrationType: (v: string) => "revenue" | "payments";
|
|
16
|
+
export declare const toExternalIntegrationType: (v: string) => "revenue" | "email" | "payments";
|
|
17
17
|
export type ExternalIntegrationType = ReturnType<typeof toExternalIntegrationType>;
|
|
18
|
-
export declare const toExternalSupportedTool: (v: string) => "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal";
|
|
18
|
+
export declare const toExternalSupportedTool: (v: string) => "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook";
|
|
19
19
|
export type ExternalSupportedTool = ReturnType<typeof toExternalSupportedTool>;
|
|
20
20
|
export type ConnectorCredentialsBySlug = {
|
|
21
21
|
connectionName: 'stripe';
|
|
@@ -101,26 +101,26 @@ export declare const updateTenants: import("@reduxjs/toolkit").ActionCreatorWith
|
|
|
101
101
|
}, "tenant/fetchExternalConnectionsFailure", never, never>, fetchExternalConnectionsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, externalConnections: ConnectionsPayload], {
|
|
102
102
|
tenantId: string;
|
|
103
103
|
externalConnections: ConnectionsPayload;
|
|
104
|
-
}, "tenant/fetchExternalConnectionsSuccess", never, never>, saveAPIKeyConnection: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionId: string, connectionType: "revenue" | "payments", connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal", credentials: {
|
|
104
|
+
}, "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: {
|
|
105
105
|
api_key: string;
|
|
106
106
|
site: string;
|
|
107
107
|
}], {
|
|
108
108
|
tenantId: string;
|
|
109
109
|
connectionId: string;
|
|
110
|
-
connectionType: "revenue" | "payments";
|
|
111
|
-
connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal";
|
|
110
|
+
connectionType: "revenue" | "email" | "payments";
|
|
111
|
+
connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook";
|
|
112
112
|
credentials: {
|
|
113
113
|
api_key: string;
|
|
114
114
|
site: string;
|
|
115
115
|
};
|
|
116
|
-
}, "tenant/saveAPIKeyConnection", never, never>, saveAPIKeyConnectionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionType: "revenue" | "payments", connectionPayload: ConnectionDataPayload], {
|
|
116
|
+
}, "tenant/saveAPIKeyConnection", never, never>, saveAPIKeyConnectionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionType: "revenue" | "email" | "payments", connectionPayload: ConnectionDataPayload], {
|
|
117
117
|
tenantId: string;
|
|
118
|
-
connectionType: "revenue" | "payments";
|
|
118
|
+
connectionType: "revenue" | "email" | "payments";
|
|
119
119
|
connectionPayload: ConnectionDataPayload;
|
|
120
120
|
}, "tenant/saveAPIKeyConnectionSuccess", never, never>, saveAPIKeyConnectionFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
121
121
|
tenantId: string;
|
|
122
122
|
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
123
|
-
}, "tenant/saveAPIKeyConnectionFailure", never, never>, saveOAuthConnection: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionId: string, connectionType: "revenue" | "payments", connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal", credentials: {
|
|
123
|
+
}, "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: {
|
|
124
124
|
authorization_code: string;
|
|
125
125
|
client_id: string;
|
|
126
126
|
client_secret: string;
|
|
@@ -128,35 +128,35 @@ export declare const updateTenants: import("@reduxjs/toolkit").ActionCreatorWith
|
|
|
128
128
|
}], {
|
|
129
129
|
tenantId: string;
|
|
130
130
|
connectionId: string;
|
|
131
|
-
connectionType: "revenue" | "payments";
|
|
132
|
-
connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal";
|
|
131
|
+
connectionType: "revenue" | "email" | "payments";
|
|
132
|
+
connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook";
|
|
133
133
|
credentials: {
|
|
134
134
|
authorization_code: string;
|
|
135
135
|
client_id: string;
|
|
136
136
|
client_secret: string;
|
|
137
137
|
redirect_uri: string;
|
|
138
138
|
};
|
|
139
|
-
}, "tenant/saveOAuthConnection", never, never>, saveOAuthConnectionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionType: "revenue" | "payments", connectionPayload: ConnectionDataPayload], {
|
|
139
|
+
}, "tenant/saveOAuthConnection", never, never>, saveOAuthConnectionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionType: "revenue" | "email" | "payments", connectionPayload: ConnectionDataPayload], {
|
|
140
140
|
tenantId: string;
|
|
141
|
-
connectionType: "revenue" | "payments";
|
|
141
|
+
connectionType: "revenue" | "email" | "payments";
|
|
142
142
|
connectionPayload: ConnectionDataPayload;
|
|
143
143
|
}, "tenant/saveOAuthConnectionSuccess", never, never>, saveOAuthConnectionFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
144
144
|
tenantId: string;
|
|
145
145
|
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
146
|
-
}, "tenant/saveOAuthConnectionFailure", never, never>, saveConnectorCredentials: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionType: "revenue" | "payments", args: ConnectorCredentialsBySlug], {
|
|
146
|
+
}, "tenant/saveOAuthConnectionFailure", never, never>, saveConnectorCredentials: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionType: "revenue" | "email" | "payments", args: ConnectorCredentialsBySlug], {
|
|
147
147
|
connectionName: "stripe";
|
|
148
148
|
credentials: {
|
|
149
149
|
api_key: string;
|
|
150
150
|
};
|
|
151
151
|
tenantId: string;
|
|
152
|
-
connectionType: "revenue" | "payments";
|
|
152
|
+
connectionType: "revenue" | "email" | "payments";
|
|
153
153
|
} | {
|
|
154
154
|
connectionName: "mercury";
|
|
155
155
|
credentials: {
|
|
156
156
|
api_key: string;
|
|
157
157
|
};
|
|
158
158
|
tenantId: string;
|
|
159
|
-
connectionType: "revenue" | "payments";
|
|
159
|
+
connectionType: "revenue" | "email" | "payments";
|
|
160
160
|
} | {
|
|
161
161
|
connectionName: "paypal";
|
|
162
162
|
credentials: {
|
|
@@ -164,24 +164,36 @@ export declare const updateTenants: import("@reduxjs/toolkit").ActionCreatorWith
|
|
|
164
164
|
client_secret: string;
|
|
165
165
|
};
|
|
166
166
|
tenantId: string;
|
|
167
|
-
connectionType: "revenue" | "payments";
|
|
168
|
-
}, "tenant/saveConnectorCredentials", never, never>, saveConnectorCredentialsSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionType: "revenue" | "payments", connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal", connectionPayload: ConnectionDataPayload], {
|
|
167
|
+
connectionType: "revenue" | "email" | "payments";
|
|
168
|
+
}, "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], {
|
|
169
169
|
tenantId: string;
|
|
170
|
-
connectionType: "revenue" | "payments";
|
|
171
|
-
connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal";
|
|
170
|
+
connectionType: "revenue" | "email" | "payments";
|
|
171
|
+
connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook";
|
|
172
172
|
connectionPayload: ConnectionDataPayload;
|
|
173
|
-
}, "tenant/saveConnectorCredentialsSuccess", never, never>, saveConnectorCredentialsFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal", status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
173
|
+
}, "tenant/saveConnectorCredentialsSuccess", never, never>, saveConnectorCredentialsFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook", status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
174
174
|
tenantId: string;
|
|
175
|
-
connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal";
|
|
175
|
+
connectionName: "chargebee" | "hubspot" | "stripe" | "mercury" | "paypal" | "gmail" | "outlook";
|
|
176
176
|
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
177
|
-
}, "tenant/saveConnectorCredentialsFailure", never, never>,
|
|
177
|
+
}, "tenant/saveConnectorCredentialsFailure", never, never>, initEmailConnectOAuth: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, provider: "gmail" | "outlook", redirectAfterUrl: string], {
|
|
178
|
+
tenantId: string;
|
|
179
|
+
provider: "gmail" | "outlook";
|
|
180
|
+
redirectAfterUrl: string;
|
|
181
|
+
}, "tenant/initEmailConnectOAuth", never, never>, initEmailConnectOAuthSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, provider: "gmail" | "outlook", authorizationUrl: string], {
|
|
182
|
+
tenantId: string;
|
|
183
|
+
provider: "gmail" | "outlook";
|
|
184
|
+
authorizationUrl: string;
|
|
185
|
+
}, "tenant/initEmailConnectOAuthSuccess", never, never>, initEmailConnectOAuthFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, provider: "gmail" | "outlook", status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
186
|
+
tenantId: string;
|
|
187
|
+
provider: "gmail" | "outlook";
|
|
188
|
+
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
189
|
+
}, "tenant/initEmailConnectOAuthFailure", never, never>, deleteConnection: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionId: string, connectionType: "revenue" | "email" | "payments"], {
|
|
178
190
|
tenantId: string;
|
|
179
191
|
connectionId: string;
|
|
180
|
-
connectionType: "revenue" | "payments";
|
|
181
|
-
}, "tenant/deleteConnection", never, never>, deleteConnectionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionId: string, connectionType: "revenue" | "payments"], {
|
|
192
|
+
connectionType: "revenue" | "email" | "payments";
|
|
193
|
+
}, "tenant/deleteConnection", never, never>, deleteConnectionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, connectionId: string, connectionType: "revenue" | "email" | "payments"], {
|
|
182
194
|
tenantId: string;
|
|
183
195
|
connectionId: string;
|
|
184
|
-
connectionType: "revenue" | "payments";
|
|
196
|
+
connectionType: "revenue" | "email" | "payments";
|
|
185
197
|
}, "tenant/deleteConnectionSuccess", never, never>, deleteConnectionFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, status: ZeniAPIStatus<Record<string, unknown>>], {
|
|
186
198
|
tenantId: string;
|
|
187
199
|
status: ZeniAPIStatus<Record<string, unknown>>;
|
|
@@ -240,6 +252,7 @@ export declare const toRoleResource: (payload: RoleResourcePayload) => RoleResou
|
|
|
240
252
|
*/
|
|
241
253
|
export declare function mapConnectionsPayloadToState(connectionsPayload: ConnectionsPayload): {
|
|
242
254
|
accounting: Connection[];
|
|
255
|
+
email: Connection[];
|
|
243
256
|
payments: Connection[];
|
|
244
257
|
revenue: Connection[];
|
|
245
258
|
};
|
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
var _a;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.
|
|
8
|
-
exports.toConnection = exports.toRoleResource = exports.resendVerifyDeviceOTPFailure = exports.resendVerifyDeviceOTPSuccess = exports.resendVerifyDeviceOTP = exports.updateTreasuryPromoIntroClosedByOutsideClickForLoggedInUser = exports.updateTreasuryPromoRemindMeLaterClickedForLoggedInUser = exports.updateTreasuryVideoViewedForLoggedInUser = exports.verifyDeviceWithTwoFAFailure = exports.verifyDeviceWithTwoFASuccess = exports.verifyDeviceWithTwoFA = exports.updateTenantMasterTOSInfo = exports.updateTenantCapitalizationThreshold = exports.updateTenantCapitalizationOnboardingDismissed = exports.updateTenantAccountingClassesEnabled = exports.trigger2FA = exports.resetSignInState = exports.updateReferViewedForLoggedInUser = exports.updateTenantReimbursementInfo = exports.removeOnboardingTenant = exports.updateOnboardingTenants = void 0;
|
|
7
|
+
exports.clearAll = exports.deleteConnectionFailure = exports.deleteConnectionSuccess = exports.deleteConnection = exports.initEmailConnectOAuthFailure = exports.initEmailConnectOAuthSuccess = exports.initEmailConnectOAuth = exports.saveConnectorCredentialsFailure = exports.saveConnectorCredentialsSuccess = exports.saveConnectorCredentials = exports.saveOAuthConnectionFailure = exports.saveOAuthConnectionSuccess = exports.saveOAuthConnection = exports.saveAPIKeyConnectionFailure = exports.saveAPIKeyConnectionSuccess = exports.saveAPIKeyConnection = exports.fetchExternalConnectionsSuccess = exports.fetchExternalConnectionsFailure = exports.saveExternalConnectionFailure = exports.saveExternalConnectionSuccess = exports.saveExternalConnection = exports.fetchExternalConnections = exports.updateLoggedInUser = exports.sessionHeartbeatFailure = exports.sessionHeartbeatSuccess = exports.sendSessionHeartbeat = exports.signOutSuccess = exports.doSignOut = exports.updateSignInState = exports.sendEmailMagicLinkToUserFailure = exports.sendEmailMagicLinkToUserSuccess = exports.sendEmailMagicLinkToUser = exports.magicLinkSignInFailure = exports.magicLinkSignInSuccess = exports.doMagicLinkSignIn = exports.doSignIn = exports.updateExcludedResourcesFailure = exports.updateExcludedResourcesSuccess = exports.fetchExcludedResources = exports.updateCurrentTenant = exports.updateTenantFailure = exports.updateTenantSuccess = exports.fetchActiveTenant = exports.updateTenantsFailure = exports.updateTenantsSuccess = exports.fetchAllTenants = exports.updateTenants = exports.initialState = exports.toExternalSupportedTool = exports.toExternalIntegrationType = void 0;
|
|
8
|
+
exports.toConnection = exports.toRoleResource = exports.resendVerifyDeviceOTPFailure = exports.resendVerifyDeviceOTPSuccess = exports.resendVerifyDeviceOTP = exports.updateTreasuryPromoIntroClosedByOutsideClickForLoggedInUser = exports.updateTreasuryPromoRemindMeLaterClickedForLoggedInUser = exports.updateTreasuryVideoViewedForLoggedInUser = exports.verifyDeviceWithTwoFAFailure = exports.verifyDeviceWithTwoFASuccess = exports.verifyDeviceWithTwoFA = exports.updateTenantMasterTOSInfo = exports.updateTenantCapitalizationThreshold = exports.updateTenantCapitalizationOnboardingDismissed = exports.updateTenantAccountingClassesEnabled = exports.trigger2FA = exports.resetSignInState = exports.updateReferViewedForLoggedInUser = exports.updateTenantReimbursementInfo = exports.removeOnboardingTenant = exports.updateOnboardingTenants = exports.updateSubscriptionSummaryForTenantFailure = exports.updateSubscriptionSummaryForTenantSuccess = exports.fetchSubscriptionSummaryForTenant = void 0;
|
|
9
9
|
exports.mapCapitalizableAccountsPayload = mapCapitalizableAccountsPayload;
|
|
10
10
|
exports.mapConnectionsPayloadToState = mapConnectionsPayloadToState;
|
|
11
11
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
@@ -19,7 +19,7 @@ const netBurnOrIncomeStoryCardState_1 = require("../../view/netBurnOrIncomeStory
|
|
|
19
19
|
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
20
20
|
const subscriptionSummaryReducer_1 = require("../subscription/subscriptionSummary/subscriptionSummaryReducer");
|
|
21
21
|
const userRolePayload_1 = require("../userRole/userRolePayload");
|
|
22
|
-
const EXTERNAL_INTEGRATION_TYPES = ['revenue', 'payments'];
|
|
22
|
+
const EXTERNAL_INTEGRATION_TYPES = ['revenue', 'payments', 'email'];
|
|
23
23
|
const toExternalIntegrationType = (v) => (0, stringToUnion_1.stringToUnion)(v, EXTERNAL_INTEGRATION_TYPES);
|
|
24
24
|
exports.toExternalIntegrationType = toExternalIntegrationType;
|
|
25
25
|
const EXTERNAL_SUPPORTED_TOOLS = [
|
|
@@ -28,6 +28,8 @@ const EXTERNAL_SUPPORTED_TOOLS = [
|
|
|
28
28
|
'stripe',
|
|
29
29
|
'mercury',
|
|
30
30
|
'paypal',
|
|
31
|
+
'gmail',
|
|
32
|
+
'outlook',
|
|
31
33
|
];
|
|
32
34
|
const toExternalSupportedTool = (v) => (0, stringToUnion_1.stringToUnion)(v, EXTERNAL_SUPPORTED_TOOLS);
|
|
33
35
|
exports.toExternalSupportedTool = toExternalSupportedTool;
|
|
@@ -373,6 +375,7 @@ const tenant = (0, toolkit_1.createSlice)({
|
|
|
373
375
|
draft.externalConnectionsByTenant[action.payload.tenantId] = {
|
|
374
376
|
fetchState: 'In-Progress',
|
|
375
377
|
accounting: [],
|
|
378
|
+
email: [],
|
|
376
379
|
payments: [],
|
|
377
380
|
revenue: [],
|
|
378
381
|
saveConnectionState: 'Not-Started',
|
|
@@ -390,10 +393,11 @@ const tenant = (0, toolkit_1.createSlice)({
|
|
|
390
393
|
return { payload: { tenantId, externalConnections } };
|
|
391
394
|
},
|
|
392
395
|
reducer(draft, action) {
|
|
393
|
-
const { accounting, payments, revenue } = mapConnectionsPayloadToState(action.payload.externalConnections);
|
|
396
|
+
const { accounting, email, payments, revenue } = mapConnectionsPayloadToState(action.payload.externalConnections);
|
|
394
397
|
draft.externalConnectionsByTenant[action.payload.tenantId] = {
|
|
395
398
|
fetchState: 'Completed',
|
|
396
399
|
accounting,
|
|
400
|
+
email,
|
|
397
401
|
payments,
|
|
398
402
|
revenue,
|
|
399
403
|
saveConnectionState: 'Completed',
|
|
@@ -415,6 +419,7 @@ const tenant = (0, toolkit_1.createSlice)({
|
|
|
415
419
|
draft.externalConnectionsByTenant[tenantId] = {
|
|
416
420
|
fetchState: 'Error',
|
|
417
421
|
accounting: [],
|
|
422
|
+
email: [],
|
|
418
423
|
payments: [],
|
|
419
424
|
revenue: [],
|
|
420
425
|
saveConnectionState: 'Error',
|
|
@@ -628,6 +633,56 @@ const tenant = (0, toolkit_1.createSlice)({
|
|
|
628
633
|
}
|
|
629
634
|
},
|
|
630
635
|
},
|
|
636
|
+
// Email-connect (Gmail / Outlook) OAuth init. Distinct from the other
|
|
637
|
+
// connector saves because the FE never sees the access_token — the
|
|
638
|
+
// user-facing redirect lands on the auth service's callback, auth
|
|
639
|
+
// exchanges code → tokens and posts them to tenant, then redirects the
|
|
640
|
+
// browser back to ``redirectAfterUrl`` with ``?email_connect_result=...``.
|
|
641
|
+
// The success action carries the provider's authorization_url so the
|
|
642
|
+
// epic can drive a full-page redirect, mirroring the legacy HubSpot
|
|
643
|
+
// flow in zeni-web-app-ui/IntegrationsScreen.
|
|
644
|
+
initEmailConnectOAuth: {
|
|
645
|
+
prepare(tenantId, provider, redirectAfterUrl) {
|
|
646
|
+
return { payload: { tenantId, provider, redirectAfterUrl } };
|
|
647
|
+
},
|
|
648
|
+
reducer(draft, action) {
|
|
649
|
+
const existing = draft.externalConnectionsByTenant[action.payload.tenantId];
|
|
650
|
+
if (existing != null) {
|
|
651
|
+
// Reuse the per-slug saveConnectorCredentialsStateBySlug bucket so
|
|
652
|
+
// the IntegrationsSettingsPage shows the same loading affordance
|
|
653
|
+
// it already uses for Stripe/Mercury/PayPal connect flows.
|
|
654
|
+
existing.saveConnectorCredentialsStateBySlug[action.payload.provider] = 'In-Progress';
|
|
655
|
+
delete existing.saveConnectorCredentialsErrorBySlug[action.payload.provider];
|
|
656
|
+
}
|
|
657
|
+
},
|
|
658
|
+
},
|
|
659
|
+
initEmailConnectOAuthSuccess: {
|
|
660
|
+
prepare(tenantId, provider, authorizationUrl) {
|
|
661
|
+
return { payload: { tenantId, provider, authorizationUrl } };
|
|
662
|
+
},
|
|
663
|
+
reducer(draft, action) {
|
|
664
|
+
// Intentionally leave state as 'In-Progress' — the epic is about to
|
|
665
|
+
// do a full-page redirect, so any UI state we set here would be
|
|
666
|
+
// overwritten by the navigation anyway. Setting Completed would
|
|
667
|
+
// briefly flash a success state before the redirect, which reads
|
|
668
|
+
// wrong because the connection isn't actually saved yet at this
|
|
669
|
+
// point (it lands after the OAuth round-trip).
|
|
670
|
+
void draft;
|
|
671
|
+
void action;
|
|
672
|
+
},
|
|
673
|
+
},
|
|
674
|
+
initEmailConnectOAuthFailure: {
|
|
675
|
+
prepare(tenantId, provider, status) {
|
|
676
|
+
return { payload: { tenantId, provider, status } };
|
|
677
|
+
},
|
|
678
|
+
reducer(draft, action) {
|
|
679
|
+
const existing = draft.externalConnectionsByTenant[action.payload.tenantId];
|
|
680
|
+
if (existing != null) {
|
|
681
|
+
existing.saveConnectorCredentialsStateBySlug[action.payload.provider] = 'Error';
|
|
682
|
+
existing.saveConnectorCredentialsErrorBySlug[action.payload.provider] = action.payload.status;
|
|
683
|
+
}
|
|
684
|
+
},
|
|
685
|
+
},
|
|
631
686
|
deleteConnection: {
|
|
632
687
|
prepare(tenantId, connectionId, connectionType) {
|
|
633
688
|
return { payload: { tenantId, connectionId, connectionType } };
|
|
@@ -827,7 +882,7 @@ const tenant = (0, toolkit_1.createSlice)({
|
|
|
827
882
|
},
|
|
828
883
|
},
|
|
829
884
|
});
|
|
830
|
-
_a = tenant.actions, exports.updateTenants = _a.updateTenants, exports.fetchAllTenants = _a.fetchAllTenants, exports.updateTenantsSuccess = _a.updateTenantsSuccess, exports.updateTenantsFailure = _a.updateTenantsFailure, exports.fetchActiveTenant = _a.fetchActiveTenant, exports.updateTenantSuccess = _a.updateTenantSuccess, exports.updateTenantFailure = _a.updateTenantFailure, exports.updateCurrentTenant = _a.updateCurrentTenant, exports.fetchExcludedResources = _a.fetchExcludedResources, exports.updateExcludedResourcesSuccess = _a.updateExcludedResourcesSuccess, exports.updateExcludedResourcesFailure = _a.updateExcludedResourcesFailure, exports.doSignIn = _a.doSignIn, exports.doMagicLinkSignIn = _a.doMagicLinkSignIn, exports.magicLinkSignInSuccess = _a.magicLinkSignInSuccess, exports.magicLinkSignInFailure = _a.magicLinkSignInFailure, exports.sendEmailMagicLinkToUser = _a.sendEmailMagicLinkToUser, exports.sendEmailMagicLinkToUserSuccess = _a.sendEmailMagicLinkToUserSuccess, exports.sendEmailMagicLinkToUserFailure = _a.sendEmailMagicLinkToUserFailure, exports.updateSignInState = _a.updateSignInState, exports.doSignOut = _a.doSignOut, exports.signOutSuccess = _a.signOutSuccess, exports.sendSessionHeartbeat = _a.sendSessionHeartbeat, exports.sessionHeartbeatSuccess = _a.sessionHeartbeatSuccess, exports.sessionHeartbeatFailure = _a.sessionHeartbeatFailure, exports.updateLoggedInUser = _a.updateLoggedInUser, exports.fetchExternalConnections = _a.fetchExternalConnections, exports.saveExternalConnection = _a.saveExternalConnection, exports.saveExternalConnectionSuccess = _a.saveExternalConnectionSuccess, exports.saveExternalConnectionFailure = _a.saveExternalConnectionFailure, exports.fetchExternalConnectionsFailure = _a.fetchExternalConnectionsFailure, exports.fetchExternalConnectionsSuccess = _a.fetchExternalConnectionsSuccess, exports.saveAPIKeyConnection = _a.saveAPIKeyConnection, exports.saveAPIKeyConnectionSuccess = _a.saveAPIKeyConnectionSuccess, exports.saveAPIKeyConnectionFailure = _a.saveAPIKeyConnectionFailure, exports.saveOAuthConnection = _a.saveOAuthConnection, exports.saveOAuthConnectionSuccess = _a.saveOAuthConnectionSuccess, exports.saveOAuthConnectionFailure = _a.saveOAuthConnectionFailure, exports.saveConnectorCredentials = _a.saveConnectorCredentials, exports.saveConnectorCredentialsSuccess = _a.saveConnectorCredentialsSuccess, exports.saveConnectorCredentialsFailure = _a.saveConnectorCredentialsFailure, exports.deleteConnection = _a.deleteConnection, exports.deleteConnectionSuccess = _a.deleteConnectionSuccess, exports.deleteConnectionFailure = _a.deleteConnectionFailure, exports.clearAll = _a.clearAll, exports.fetchSubscriptionSummaryForTenant = _a.fetchSubscriptionSummaryForTenant, exports.updateSubscriptionSummaryForTenantSuccess = _a.updateSubscriptionSummaryForTenantSuccess, exports.updateSubscriptionSummaryForTenantFailure = _a.updateSubscriptionSummaryForTenantFailure, exports.updateOnboardingTenants = _a.updateOnboardingTenants, exports.removeOnboardingTenant = _a.removeOnboardingTenant, exports.updateTenantReimbursementInfo = _a.updateTenantReimbursementInfo, exports.updateReferViewedForLoggedInUser = _a.updateReferViewedForLoggedInUser, exports.resetSignInState = _a.resetSignInState, exports.trigger2FA = _a.trigger2FA, exports.updateTenantAccountingClassesEnabled = _a.updateTenantAccountingClassesEnabled, exports.updateTenantCapitalizationOnboardingDismissed = _a.updateTenantCapitalizationOnboardingDismissed, exports.updateTenantCapitalizationThreshold = _a.updateTenantCapitalizationThreshold, exports.updateTenantMasterTOSInfo = _a.updateTenantMasterTOSInfo, exports.verifyDeviceWithTwoFA = _a.verifyDeviceWithTwoFA, exports.verifyDeviceWithTwoFASuccess = _a.verifyDeviceWithTwoFASuccess, exports.verifyDeviceWithTwoFAFailure = _a.verifyDeviceWithTwoFAFailure, exports.updateTreasuryVideoViewedForLoggedInUser = _a.updateTreasuryVideoViewedForLoggedInUser, exports.updateTreasuryPromoRemindMeLaterClickedForLoggedInUser = _a.updateTreasuryPromoRemindMeLaterClickedForLoggedInUser, exports.updateTreasuryPromoIntroClosedByOutsideClickForLoggedInUser = _a.updateTreasuryPromoIntroClosedByOutsideClickForLoggedInUser, exports.resendVerifyDeviceOTP = _a.resendVerifyDeviceOTP, exports.resendVerifyDeviceOTPSuccess = _a.resendVerifyDeviceOTPSuccess, exports.resendVerifyDeviceOTPFailure = _a.resendVerifyDeviceOTPFailure;
|
|
885
|
+
_a = tenant.actions, exports.updateTenants = _a.updateTenants, exports.fetchAllTenants = _a.fetchAllTenants, exports.updateTenantsSuccess = _a.updateTenantsSuccess, exports.updateTenantsFailure = _a.updateTenantsFailure, exports.fetchActiveTenant = _a.fetchActiveTenant, exports.updateTenantSuccess = _a.updateTenantSuccess, exports.updateTenantFailure = _a.updateTenantFailure, exports.updateCurrentTenant = _a.updateCurrentTenant, exports.fetchExcludedResources = _a.fetchExcludedResources, exports.updateExcludedResourcesSuccess = _a.updateExcludedResourcesSuccess, exports.updateExcludedResourcesFailure = _a.updateExcludedResourcesFailure, exports.doSignIn = _a.doSignIn, exports.doMagicLinkSignIn = _a.doMagicLinkSignIn, exports.magicLinkSignInSuccess = _a.magicLinkSignInSuccess, exports.magicLinkSignInFailure = _a.magicLinkSignInFailure, exports.sendEmailMagicLinkToUser = _a.sendEmailMagicLinkToUser, exports.sendEmailMagicLinkToUserSuccess = _a.sendEmailMagicLinkToUserSuccess, exports.sendEmailMagicLinkToUserFailure = _a.sendEmailMagicLinkToUserFailure, exports.updateSignInState = _a.updateSignInState, exports.doSignOut = _a.doSignOut, exports.signOutSuccess = _a.signOutSuccess, exports.sendSessionHeartbeat = _a.sendSessionHeartbeat, exports.sessionHeartbeatSuccess = _a.sessionHeartbeatSuccess, exports.sessionHeartbeatFailure = _a.sessionHeartbeatFailure, exports.updateLoggedInUser = _a.updateLoggedInUser, exports.fetchExternalConnections = _a.fetchExternalConnections, exports.saveExternalConnection = _a.saveExternalConnection, exports.saveExternalConnectionSuccess = _a.saveExternalConnectionSuccess, exports.saveExternalConnectionFailure = _a.saveExternalConnectionFailure, exports.fetchExternalConnectionsFailure = _a.fetchExternalConnectionsFailure, exports.fetchExternalConnectionsSuccess = _a.fetchExternalConnectionsSuccess, exports.saveAPIKeyConnection = _a.saveAPIKeyConnection, exports.saveAPIKeyConnectionSuccess = _a.saveAPIKeyConnectionSuccess, exports.saveAPIKeyConnectionFailure = _a.saveAPIKeyConnectionFailure, exports.saveOAuthConnection = _a.saveOAuthConnection, exports.saveOAuthConnectionSuccess = _a.saveOAuthConnectionSuccess, exports.saveOAuthConnectionFailure = _a.saveOAuthConnectionFailure, exports.saveConnectorCredentials = _a.saveConnectorCredentials, exports.saveConnectorCredentialsSuccess = _a.saveConnectorCredentialsSuccess, exports.saveConnectorCredentialsFailure = _a.saveConnectorCredentialsFailure, exports.initEmailConnectOAuth = _a.initEmailConnectOAuth, exports.initEmailConnectOAuthSuccess = _a.initEmailConnectOAuthSuccess, exports.initEmailConnectOAuthFailure = _a.initEmailConnectOAuthFailure, exports.deleteConnection = _a.deleteConnection, exports.deleteConnectionSuccess = _a.deleteConnectionSuccess, exports.deleteConnectionFailure = _a.deleteConnectionFailure, exports.clearAll = _a.clearAll, exports.fetchSubscriptionSummaryForTenant = _a.fetchSubscriptionSummaryForTenant, exports.updateSubscriptionSummaryForTenantSuccess = _a.updateSubscriptionSummaryForTenantSuccess, exports.updateSubscriptionSummaryForTenantFailure = _a.updateSubscriptionSummaryForTenantFailure, exports.updateOnboardingTenants = _a.updateOnboardingTenants, exports.removeOnboardingTenant = _a.removeOnboardingTenant, exports.updateTenantReimbursementInfo = _a.updateTenantReimbursementInfo, exports.updateReferViewedForLoggedInUser = _a.updateReferViewedForLoggedInUser, exports.resetSignInState = _a.resetSignInState, exports.trigger2FA = _a.trigger2FA, exports.updateTenantAccountingClassesEnabled = _a.updateTenantAccountingClassesEnabled, exports.updateTenantCapitalizationOnboardingDismissed = _a.updateTenantCapitalizationOnboardingDismissed, exports.updateTenantCapitalizationThreshold = _a.updateTenantCapitalizationThreshold, exports.updateTenantMasterTOSInfo = _a.updateTenantMasterTOSInfo, exports.verifyDeviceWithTwoFA = _a.verifyDeviceWithTwoFA, exports.verifyDeviceWithTwoFASuccess = _a.verifyDeviceWithTwoFASuccess, exports.verifyDeviceWithTwoFAFailure = _a.verifyDeviceWithTwoFAFailure, exports.updateTreasuryVideoViewedForLoggedInUser = _a.updateTreasuryVideoViewedForLoggedInUser, exports.updateTreasuryPromoRemindMeLaterClickedForLoggedInUser = _a.updateTreasuryPromoRemindMeLaterClickedForLoggedInUser, exports.updateTreasuryPromoIntroClosedByOutsideClickForLoggedInUser = _a.updateTreasuryPromoIntroClosedByOutsideClickForLoggedInUser, exports.resendVerifyDeviceOTP = _a.resendVerifyDeviceOTP, exports.resendVerifyDeviceOTPSuccess = _a.resendVerifyDeviceOTPSuccess, exports.resendVerifyDeviceOTPFailure = _a.resendVerifyDeviceOTPFailure;
|
|
831
886
|
exports.default = tenant.reducer;
|
|
832
887
|
/**
|
|
833
888
|
* Applies treasury promo user fields from the tenants API user block when present.
|
|
@@ -1007,6 +1062,11 @@ function mapConnectionsPayloadToState(connectionsPayload) {
|
|
|
1007
1062
|
const { connections } = connectionsPayload;
|
|
1008
1063
|
return {
|
|
1009
1064
|
accounting: connections.accounting.map((payload) => (0, exports.toConnection)(payload)),
|
|
1065
|
+
// Tenant materializes gmail/outlook under the `email` bucket via
|
|
1066
|
+
// _THIRD_PARTY_CONNECTORS_TO_MATERIALIZE when their slugs are enabled in
|
|
1067
|
+
// third_party_enabled_connectors Statsig config. Default to [] so older
|
|
1068
|
+
// tenant deploys (or disabled-everywhere envs) don't blow up here.
|
|
1069
|
+
email: (connections.email ?? []).map((payload) => (0, exports.toConnection)(payload)),
|
|
1010
1070
|
payments: connections.payments.map((payload) => (0, exports.toConnection)(payload)),
|
|
1011
1071
|
revenue: (connections.revenue ?? []).map((payload) => (0, exports.toConnection)(payload)),
|
|
1012
1072
|
};
|
|
@@ -13,6 +13,7 @@ import { AuthProvider, ExternalSupportedTool } from './tenantReducer';
|
|
|
13
13
|
export interface TenantExternalConnections {
|
|
14
14
|
accounting: Connection[];
|
|
15
15
|
deleteConnectionState: FetchState;
|
|
16
|
+
email: Connection[];
|
|
16
17
|
fetchState: FetchState;
|
|
17
18
|
payments: Connection[];
|
|
18
19
|
revenue: Connection[];
|