@zeniai/client-epic-state 5.1.96 → 5.1.97-betaAK0

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.
Files changed (163) hide show
  1. package/lib/entity/invoicing/invoicingCommonPayload.d.ts +21 -0
  2. package/lib/entity/invoicing/invoicingCommonPayload.js +25 -0
  3. package/lib/epic.d.ts +1 -5
  4. package/lib/epic.js +1 -5
  5. package/lib/esm/entity/invoicing/invoicingCommonPayload.js +22 -0
  6. package/lib/esm/epic.js +1 -5
  7. package/lib/esm/index.js +17 -20
  8. package/lib/esm/reducer.js +0 -3
  9. package/lib/esm/view/dashboard/dashboardEpic.js +0 -20
  10. package/lib/esm/view/dashboard/dashboardReducer.js +1 -13
  11. package/lib/esm/view/dashboard/dashboardSelector.js +2 -7
  12. package/lib/esm/view/invoicing/couponView/couponViewSelector.js +9 -3
  13. package/lib/esm/view/invoicing/couponView/couponViewState.js +0 -9
  14. package/lib/esm/view/invoicing/createCreditNote/createCreditNoteFormConfig.js +1 -0
  15. package/lib/esm/view/invoicing/createCreditNote/createCreditNotePayload.js +2 -1
  16. package/lib/esm/view/invoicing/createCreditNote/createCreditNoteSelector.js +4 -2
  17. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +1 -1
  18. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +8 -5
  19. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.js +4 -20
  20. package/lib/esm/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +7 -5
  21. package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.js +6 -4
  22. package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/invoicingCustomerFormConfig.js +0 -17
  23. package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewPayload.js +14 -4
  24. package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.js +56 -1
  25. package/lib/esm/view/invoicing/invoiceList/invoiceListSelector.js +8 -3
  26. package/lib/esm/view/invoicing/invoiceList/invoiceListState.js +0 -9
  27. package/lib/esm/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.js +6 -0
  28. package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +31 -1
  29. package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +9 -0
  30. package/lib/esm/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.js +8 -3
  31. package/lib/esm/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewState.js +0 -9
  32. package/lib/esm/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewSelector.js +9 -3
  33. package/lib/esm/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewState.js +0 -9
  34. package/lib/esm/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.js +8 -3
  35. package/lib/esm/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.js +1 -9
  36. package/lib/esm/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.js +8 -3
  37. package/lib/esm/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.js +0 -9
  38. package/lib/esm/view/invoicing/invoicingTabHelper.js +25 -0
  39. package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.js +8 -3
  40. package/lib/esm/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.js +1 -9
  41. package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteFormConfig.js +1 -8
  42. package/lib/esm/view/invoicing/issueCreditNote/issueCreditNotePayload.js +3 -1
  43. package/lib/esm/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +5 -2
  44. package/lib/esm/view/invoicing/recordPayment/recordPaymentFormConfig.js +0 -26
  45. package/lib/esm/view/invoicing/recordPayment/recordPaymentSelector.js +27 -6
  46. package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +0 -1
  47. package/lib/esm/view/spendManagement/treasury/treasurySetUp/treasurySetupViewReducer.js +1 -67
  48. package/lib/index.d.ts +18 -23
  49. package/lib/index.js +42 -65
  50. package/lib/reducer.d.ts +0 -3
  51. package/lib/reducer.js +0 -3
  52. package/lib/view/dashboard/dashboardEpic.d.ts +1 -3
  53. package/lib/view/dashboard/dashboardEpic.js +0 -20
  54. package/lib/view/dashboard/dashboardReducer.d.ts +1 -1
  55. package/lib/view/dashboard/dashboardReducer.js +2 -14
  56. package/lib/view/dashboard/dashboardSelector.d.ts +0 -1
  57. package/lib/view/dashboard/dashboardSelector.js +2 -7
  58. package/lib/view/dashboard/dashboardState.d.ts +0 -1
  59. package/lib/view/invoicing/couponView/couponViewSelector.d.ts +3 -1
  60. package/lib/view/invoicing/couponView/couponViewSelector.js +8 -2
  61. package/lib/view/invoicing/couponView/couponViewState.d.ts +0 -7
  62. package/lib/view/invoicing/couponView/couponViewState.js +1 -10
  63. package/lib/view/invoicing/createCreditNote/createCreditNoteFormConfig.js +1 -0
  64. package/lib/view/invoicing/createCreditNote/createCreditNotePayload.js +2 -1
  65. package/lib/view/invoicing/createCreditNote/createCreditNoteSelector.d.ts +3 -1
  66. package/lib/view/invoicing/createCreditNote/createCreditNoteSelector.js +4 -2
  67. package/lib/view/invoicing/createCreditNote/createCreditNoteState.d.ts +6 -0
  68. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.js +1 -1
  69. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +12 -4
  70. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +7 -4
  71. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.d.ts +4 -7
  72. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormConfig.js +5 -21
  73. package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.d.ts +4 -5
  74. package/lib/view/invoicing/editInvoicingCouponDetailView/editInvoicingCouponDetailViewSelector.js +7 -5
  75. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.d.ts +4 -3
  76. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.js +5 -3
  77. package/lib/view/invoicing/editInvoicingCustomerDetailView/invoicingCustomerFormConfig.d.ts +0 -8
  78. package/lib/view/invoicing/editInvoicingCustomerDetailView/invoicingCustomerFormConfig.js +1 -18
  79. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewPayload.d.ts +4 -0
  80. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewPayload.js +13 -3
  81. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewState.d.ts +17 -0
  82. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.d.ts +22 -0
  83. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/invoicingSubscriptionFormConfig.js +60 -2
  84. package/lib/view/invoicing/invoiceList/invoiceListSelector.d.ts +3 -1
  85. package/lib/view/invoicing/invoiceList/invoiceListSelector.js +7 -2
  86. package/lib/view/invoicing/invoiceList/invoiceListState.d.ts +0 -7
  87. package/lib/view/invoicing/invoiceList/invoiceListState.js +1 -10
  88. package/lib/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.d.ts +13 -1
  89. package/lib/view/invoicing/invoicingCatalogItemDetailView/invoicingCatalogItemDetailViewSelector.js +6 -0
  90. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewPayload.d.ts +15 -1
  91. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.d.ts +1 -1
  92. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewReducer.js +30 -0
  93. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +19 -1
  94. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +11 -1
  95. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewState.d.ts +20 -1
  96. package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.d.ts +3 -1
  97. package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewSelector.js +7 -2
  98. package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewState.d.ts +0 -7
  99. package/lib/view/invoicing/invoicingCreditNoteListView/invoicingCreditNoteListViewState.js +1 -10
  100. package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewSelector.d.ts +3 -1
  101. package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewSelector.js +8 -2
  102. package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewState.d.ts +0 -7
  103. package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewState.js +1 -10
  104. package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewReducer.d.ts +1 -1
  105. package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.d.ts +3 -1
  106. package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewSelector.js +7 -2
  107. package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.d.ts +2 -9
  108. package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.js +2 -10
  109. package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.d.ts +3 -1
  110. package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewSelector.js +7 -2
  111. package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.d.ts +0 -7
  112. package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.js +1 -10
  113. package/lib/view/invoicing/invoicingTabHelper.d.ts +27 -0
  114. package/lib/view/invoicing/invoicingTabHelper.js +28 -0
  115. package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewReducer.d.ts +1 -1
  116. package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.d.ts +3 -0
  117. package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewSelector.js +7 -2
  118. package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.d.ts +2 -9
  119. package/lib/view/invoicing/invoicingTransactionListView/invoicingTransactionListViewState.js +2 -10
  120. package/lib/view/invoicing/issueCreditNote/issueCreditNoteFormConfig.d.ts +0 -2
  121. package/lib/view/invoicing/issueCreditNote/issueCreditNoteFormConfig.js +2 -9
  122. package/lib/view/invoicing/issueCreditNote/issueCreditNotePayload.d.ts +2 -2
  123. package/lib/view/invoicing/issueCreditNote/issueCreditNotePayload.js +3 -1
  124. package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.d.ts +3 -1
  125. package/lib/view/invoicing/issueCreditNote/issueCreditNoteSelector.js +4 -1
  126. package/lib/view/invoicing/issueCreditNote/issueCreditNoteState.d.ts +6 -0
  127. package/lib/view/invoicing/recordPayment/recordPaymentFormConfig.d.ts +0 -6
  128. package/lib/view/invoicing/recordPayment/recordPaymentFormConfig.js +1 -27
  129. package/lib/view/invoicing/recordPayment/recordPaymentSelector.d.ts +3 -2
  130. package/lib/view/invoicing/recordPayment/recordPaymentSelector.js +27 -6
  131. package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +0 -2
  132. package/lib/view/invoicing/settingsView/settingsViewSelector.js +0 -1
  133. package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewReducer.d.ts +1 -1
  134. package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewReducer.js +2 -68
  135. package/lib/view/spendManagement/treasury/treasurySetUp/treasurySetupViewState.d.ts +0 -3
  136. package/package.json +1 -1
  137. package/lib/entity/invoicing/coupon/couponConstants.d.ts +0 -11
  138. package/lib/entity/invoicing/coupon/couponConstants.js +0 -29
  139. package/lib/esm/entity/invoicing/coupon/couponConstants.js +0 -26
  140. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -18
  141. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -18
  142. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -18
  143. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -16
  144. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -1
  145. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -60
  146. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -12
  147. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -1
  148. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.d.ts +0 -8
  149. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +0 -22
  150. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.d.ts +0 -8
  151. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +0 -22
  152. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.d.ts +0 -8
  153. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +0 -22
  154. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.d.ts +0 -13
  155. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +0 -20
  156. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.d.ts +0 -11
  157. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +0 -2
  158. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.d.ts +0 -7
  159. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +0 -64
  160. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.d.ts +0 -12
  161. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +0 -15
  162. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.d.ts +0 -9
  163. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +0 -2
@@ -13,16 +13,16 @@ export interface IssueCreditNoteLineItemRequest {
13
13
  }
14
14
  export interface IssueCreditNoteRequest {
15
15
  line_items: IssueCreditNoteLineItemRequest[];
16
- type: 'adjustment';
17
16
  reason_code?: string;
17
+ type?: string;
18
18
  }
19
19
  export type IssueCreditNoteResponse = ZeniAPIResponse<InvoicingCreditNotePayload>;
20
20
  export type CreateCreditNoteRequest = {
21
21
  customer_id: string;
22
22
  line_items: IssueCreditNoteLineItemRequest[];
23
- type: 'adjustment';
24
23
  reason_code?: string;
25
24
  reference_invoice_id?: string;
25
+ type?: string;
26
26
  };
27
27
  export type CreateCreditNoteResponse = ZeniAPIResponse<InvoicingCreditNotePayload>;
28
28
  export declare const computeIssueCreditNoteTotal: (lineItems: IssueCreditNoteLineItemDraft[]) => number;
@@ -27,16 +27,18 @@ const localDataToIssueCreditNotePayload = (localData) => {
27
27
  };
28
28
  });
29
29
  const reasonCode = localData.reasonCode.trim();
30
+ const type = localData.type.trim();
30
31
  return {
31
32
  line_items: lineItems,
32
- type: 'adjustment',
33
33
  ...(reasonCode !== '' ? { reason_code: reasonCode } : {}),
34
+ ...(type !== '' ? { type } : {}),
34
35
  };
35
36
  };
36
37
  exports.localDataToIssueCreditNotePayload = localDataToIssueCreditNotePayload;
37
38
  const initializeIssueCreditNoteDraftFromInvoice = (invoice) => ({
38
39
  invoiceId: invoice.id,
39
40
  reasonCode: '',
41
+ type: '',
40
42
  lineItems: (invoice.lineItems ?? []).map((lineItem) => ({
41
43
  description: lineItem.description,
42
44
  id: lineItem.id,
@@ -1,6 +1,7 @@
1
1
  import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
2
2
  import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
3
3
  import { InvoicingInvoice } from '../../../entity/invoicing/invoice/invoiceState';
4
+ import { InvoicingNamedOption } from '../../../entity/invoicing/invoicingCommonPayload';
4
5
  import { RootState } from '../../../reducer';
5
6
  import { IssueCreditNoteFormLocalData } from './issueCreditNoteState';
6
7
  /**
@@ -16,8 +17,9 @@ export interface IssueCreditNoteView extends SelectorView {
16
17
  */
17
18
  isPageReady: boolean;
18
19
  localData: IssueCreditNoteFormLocalData;
19
- reasonCodeValues: string[];
20
+ reasonCodeOptions: InvoicingNamedOption[];
20
21
  submitState: FetchStateAndError;
22
+ typeOptions: InvoicingNamedOption[];
21
23
  invoice?: InvoicingInvoice;
22
24
  issuedCreditNoteId?: ID;
23
25
  }
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getIssueCreditNoteView = void 0;
4
4
  const invoiceDetailSelector_1 = require("../invoiceDetail/invoiceDetailSelector");
5
+ const invoicingConfigViewSelector_1 = require("../invoicingConfigView/invoicingConfigViewSelector");
5
6
  const issueCreditNoteFormConfig_1 = require("./issueCreditNoteFormConfig");
6
7
  /**
7
8
  * The draft is a single global slice, so a draft seeded for a previously opened
@@ -13,6 +14,7 @@ const getIssueCreditNoteView = (state, invoiceId) => {
13
14
  const invoiceView = (0, invoiceDetailSelector_1.getInvoiceDetail)(state, invoiceId);
14
15
  const { draft, error, fetchState, issuedCreditNoteId } = state.invoicingIssueCreditNoteState;
15
16
  const isDraftForInvoice = draft.invoiceId === invoiceId;
17
+ const { creditNoteReasonCodeOptions, creditNoteTypeOptions } = (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state);
16
18
  return {
17
19
  invoice: invoiceView.invoice,
18
20
  isPageReady: invoiceView.fetchState === 'Completed' &&
@@ -22,8 +24,9 @@ const getIssueCreditNoteView = (state, invoiceId) => {
22
24
  localData: isDraftForInvoice
23
25
  ? draft
24
26
  : (0, issueCreditNoteFormConfig_1.initialIssueCreditNoteFormLocalData)(invoiceId),
25
- reasonCodeValues: [...issueCreditNoteFormConfig_1.INVOICING_CREDIT_NOTE_REASON_CODES],
27
+ reasonCodeOptions: creditNoteReasonCodeOptions,
26
28
  submitState: { error, fetchState },
29
+ typeOptions: creditNoteTypeOptions,
27
30
  error: invoiceView.error,
28
31
  fetchState: invoiceView.fetchState,
29
32
  version: 1.0,
@@ -13,6 +13,12 @@ export interface IssueCreditNoteFormLocalData {
13
13
  invoiceId: ID;
14
14
  lineItems: IssueCreditNoteLineItemDraft[];
15
15
  reasonCode: string;
16
+ /**
17
+ * Credit-note type code from `credit_note_type_options`. Empty until the user
18
+ * picks one; the payload then omits it and lets the backend default, rather
19
+ * than the client asserting `adjustment` for every credit note as it used to.
20
+ */
21
+ type: string;
16
22
  }
17
23
  export interface IssueCreditNoteState extends FetchedState {
18
24
  draft: IssueCreditNoteFormLocalData;
@@ -1,8 +1,2 @@
1
1
  import { RecordPaymentFormLocalData } from './recordPaymentState';
2
- /**
3
- * Canonical value sets for the Record Payment form. CES owns the values;
4
- * web-components maps each value to a localized label.
5
- */
6
- export declare const INVOICING_PAYMENT_METHOD_VALUES: readonly ["card", "cash", "check", "bank_transfer", "direct_debit", "paypal_express_checkout", "apple_pay", "google_pay", "ach_credit", "sepa_credit", "other"];
7
- export declare const INVOICING_PAYMENT_GATEWAY_VALUES: readonly ["stripe", "chargebee", "braintree", "paypal", "adyen", "razorpay", "other"];
8
2
  export declare const initialRecordPaymentFormLocalData: RecordPaymentFormLocalData;
@@ -1,32 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initialRecordPaymentFormLocalData = exports.INVOICING_PAYMENT_GATEWAY_VALUES = exports.INVOICING_PAYMENT_METHOD_VALUES = void 0;
4
- /**
5
- * Canonical value sets for the Record Payment form. CES owns the values;
6
- * web-components maps each value to a localized label.
7
- */
8
- exports.INVOICING_PAYMENT_METHOD_VALUES = [
9
- 'card',
10
- 'cash',
11
- 'check',
12
- 'bank_transfer',
13
- 'direct_debit',
14
- 'paypal_express_checkout',
15
- 'apple_pay',
16
- 'google_pay',
17
- 'ach_credit',
18
- 'sepa_credit',
19
- 'other',
20
- ];
21
- exports.INVOICING_PAYMENT_GATEWAY_VALUES = [
22
- 'stripe',
23
- 'chargebee',
24
- 'braintree',
25
- 'paypal',
26
- 'adyen',
27
- 'razorpay',
28
- 'other',
29
- ];
3
+ exports.initialRecordPaymentFormLocalData = void 0;
30
4
  exports.initialRecordPaymentFormLocalData = {
31
5
  comment: '',
32
6
  customerId: '',
@@ -1,6 +1,7 @@
1
1
  import { ID } from '../../../commonStateTypes/common';
2
2
  import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
3
3
  import { RootState } from '../../../reducer';
4
+ import { InvoicingNamedOption } from '../../../entity/invoicing/invoicingCommonPayload';
4
5
  import { RecordPaymentFormLocalData } from './recordPaymentState';
5
6
  export interface InvoicingRecordPaymentView extends SelectorView {
6
7
  recordedInvoiceId?: ID;
@@ -16,9 +17,9 @@ export declare const getRecordPaymentView: (state: RootState) => InvoicingRecord
16
17
  * CES-owned payment-method / gateway value sets, and the submit fetch state.
17
18
  */
18
19
  export interface RecordPaymentFormView extends SelectorView {
19
- gatewayValues: string[];
20
+ gatewayOptions: InvoicingNamedOption[];
20
21
  localData: RecordPaymentFormLocalData;
21
- paymentMethodValues: string[];
22
+ paymentMethodOptions: InvoicingNamedOption[];
22
23
  contextInvoiceId?: ID;
23
24
  }
24
25
  export declare const getRecordPaymentFormView: (state: RootState) => RecordPaymentFormView;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getRecordPaymentInvoiceOptions = exports.getRecordPaymentFormView = exports.getRecordPaymentView = void 0;
4
4
  const invoiceListSelector_1 = require("../invoiceList/invoiceListSelector");
5
- const recordPaymentFormConfig_1 = require("./recordPaymentFormConfig");
5
+ const invoicingConfigViewSelector_1 = require("../invoicingConfigView/invoicingConfigViewSelector");
6
6
  /**
7
7
  * Single bundled view for the record-payment submit lifecycle — carries the
8
8
  * submit fetch state/error and the ids produced on success.
@@ -20,22 +20,42 @@ const getRecordPaymentView = (state) => {
20
20
  exports.getRecordPaymentView = getRecordPaymentView;
21
21
  const getRecordPaymentFormView = (state) => {
22
22
  const { contextInvoiceId, error, fetchState, newPaymentDraft } = state.invoicingRecordPaymentState;
23
+ const { manualPaymentMethodOptions, paymentGatewayOptions } = (0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state);
23
24
  return {
24
25
  contextInvoiceId,
25
- gatewayValues: [...recordPaymentFormConfig_1.INVOICING_PAYMENT_GATEWAY_VALUES],
26
+ gatewayOptions: paymentGatewayOptions,
26
27
  localData: newPaymentDraft,
27
- paymentMethodValues: [...recordPaymentFormConfig_1.INVOICING_PAYMENT_METHOD_VALUES],
28
+ paymentMethodOptions: manualPaymentMethodOptions,
28
29
  fetchState,
29
30
  error,
30
31
  version: 1.0,
31
32
  };
32
33
  };
33
34
  exports.getRecordPaymentFormView = getRecordPaymentFormView;
34
- const UNPAID_INVOICE_STATUSES = new Set([
35
+ /**
36
+ * Statuses that leave nothing to collect. Kept FE-local and expressed as an
37
+ * exclusion so that "unpaid" is derived from the config status list rather than
38
+ * an allowlist: a status the backend adds later counts as collectable and shows
39
+ * up in the picker instead of silently disappearing from it.
40
+ */
41
+ const SETTLED_INVOICE_STATUSES = new Set([
42
+ 'paid',
43
+ 'voided',
44
+ ]);
45
+ /** Fallback while `/1.0/config` has not landed, so the picker is never empty. */
46
+ const FALLBACK_UNPAID_INVOICE_STATUSES = [
35
47
  'not_paid',
36
48
  'partially_paid',
37
49
  'payment_due',
38
- ]);
50
+ ];
51
+ const unpaidInvoiceStatuses = (invoiceStatusOptions) => {
52
+ if (invoiceStatusOptions.length === 0) {
53
+ return new Set(FALLBACK_UNPAID_INVOICE_STATUSES);
54
+ }
55
+ return new Set(invoiceStatusOptions
56
+ .map((option) => option.code)
57
+ .filter((code) => !SETTLED_INVOICE_STATUSES.has(code)));
58
+ };
39
59
  const getRecordPaymentInvoiceOptions = (state, customerId) => {
40
60
  if (customerId === '') {
41
61
  return [];
@@ -44,8 +64,9 @@ const getRecordPaymentInvoiceOptions = (state, customerId) => {
44
64
  if (listView.filters.customerId !== customerId) {
45
65
  return [];
46
66
  }
67
+ const collectableStatuses = unpaidInvoiceStatuses((0, invoicingConfigViewSelector_1.getInvoicingConfigView)(state).invoiceStatusOptions);
47
68
  return listView.invoices
48
- .filter((invoice) => UNPAID_INVOICE_STATUSES.has(invoice.status))
69
+ .filter((invoice) => collectableStatuses.has(invoice.status))
49
70
  .filter((invoice) => (invoice.amountDue?.amount ?? 0) > 0)
50
71
  .map((invoice) => ({
51
72
  amountDue: invoice.amountDue?.amount ?? 0,
@@ -2,7 +2,6 @@ import { FetchState, FetchStateAndError } from '../../../commonStateTypes/common
2
2
  import { InvoicingNamedOption, InvoicingQboAccountMappingKindOption, InvoicingSettingsPayload } from '../../../entity/invoicing/invoicingCommonPayload';
3
3
  import { RootState } from '../../../reducer';
4
4
  import { ZeniAPIStatus } from '../../../responsePayload';
5
- import { InvoicingOnboardingStatus } from '../invoicingConfigView/invoicingConfigViewPayload';
6
5
  import { InvoicingBrandingFormLocalData } from './invoicingBrandingFormConfig';
7
6
  /**
8
7
  * Shared primitive: the raw invoicing settings. Consumed internally by other
@@ -50,7 +49,6 @@ export interface InvoicingSettingsHubView {
50
49
  isEnablingInvoicing: boolean;
51
50
  isQboConfigured: boolean;
52
51
  isStripeConnected: boolean;
53
- status?: InvoicingOnboardingStatus;
54
52
  }
55
53
  /**
56
54
  * The settings hub's composite of everything it derives from the store: whether
@@ -86,7 +86,6 @@ const getInvoicingSettingsHubView = (state) => {
86
86
  isEnablingInvoicing: enableState.fetchState === 'In-Progress',
87
87
  isQboConfigured,
88
88
  isStripeConnected,
89
- status,
90
89
  };
91
90
  };
92
91
  exports.getInvoicingSettingsHubView = getInvoicingSettingsHubView;
@@ -15,6 +15,6 @@ export declare const fetchTreasuryFunds: import("@reduxjs/toolkit").ActionCreato
15
15
  }, "treasurySetupView/updatePortfolioAllocation", never, never>, updatePortfolioAllocationSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<UpdatePortfolioAllocationPayload, "treasurySetupView/updatePortfolioAllocationSuccess">, updatePortfolioAllocationFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>], ZeniAPIStatus<Record<string, unknown>>, "treasurySetupView/updatePortfolioAllocationFailure", never, never>, fetchPortfolioAllocation: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"treasurySetupView/fetchPortfolioAllocation">, fetchPortfolioAllocationSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
16
16
  allocation_percentages: Record<string, number>;
17
17
  custom_corporate_id: string | null;
18
- }, "treasurySetupView/fetchPortfolioAllocationSuccess">, fetchPortfolioAllocationFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "treasurySetupView/fetchPortfolioAllocationFailure">, updateFundAllocationLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<FundAllocationOption, "treasurySetupView/updateFundAllocationLocalData">, updateTreasuryPromoIntroClosedByOutsideClick: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"treasurySetupView/updateTreasuryPromoIntroClosedByOutsideClick">, updateTreasuryPromoIntroClosedByOutsideClickFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "treasurySetupView/updateTreasuryPromoIntroClosedByOutsideClickFailure">, updateTreasuryPromoIntroClosedByOutsideClickSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"treasurySetupView/updateTreasuryPromoIntroClosedByOutsideClickSuccess">, updateTreasuryPromoRemindMeLaterClicked: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"treasurySetupView/updateTreasuryPromoRemindMeLaterClicked">, updateTreasuryPromoRemindMeLaterClickedFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "treasurySetupView/updateTreasuryPromoRemindMeLaterClickedFailure">, updateTreasuryPromoRemindMeLaterClickedSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"treasurySetupView/updateTreasuryPromoRemindMeLaterClickedSuccess">, updateTreasuryVideoViewed: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"treasurySetupView/updateTreasuryVideoViewed">, updateTreasuryVideoViewedFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "treasurySetupView/updateTreasuryVideoViewedFailure">, updateTreasuryVideoViewedSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"treasurySetupView/updateTreasuryVideoViewedSuccess">;
18
+ }, "treasurySetupView/fetchPortfolioAllocationSuccess">, fetchPortfolioAllocationFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "treasurySetupView/fetchPortfolioAllocationFailure">, updateFundAllocationLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<FundAllocationOption, "treasurySetupView/updateFundAllocationLocalData">;
19
19
  declare const _default: import("redux").Reducer<TreasurySetupViewState>;
20
20
  export default _default;
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  var _a;
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.updateTreasuryVideoViewedSuccess = exports.updateTreasuryVideoViewedFailure = exports.updateTreasuryVideoViewed = exports.updateTreasuryPromoRemindMeLaterClickedSuccess = exports.updateTreasuryPromoRemindMeLaterClickedFailure = exports.updateTreasuryPromoRemindMeLaterClicked = exports.updateTreasuryPromoIntroClosedByOutsideClickSuccess = exports.updateTreasuryPromoIntroClosedByOutsideClickFailure = exports.updateTreasuryPromoIntroClosedByOutsideClick = exports.updateFundAllocationLocalData = exports.fetchPortfolioAllocationFailure = exports.fetchPortfolioAllocationSuccess = exports.fetchPortfolioAllocation = exports.updatePortfolioAllocationFailure = exports.updatePortfolioAllocationSuccess = exports.updatePortfolioAllocation = exports.updateTreasuryFundsFailure = exports.updateTreasuryFundsSuccess = exports.clearTreasurySetupView = exports.acceptTreasuryTermsFailure = exports.acceptTreasuryTermsSuccess = exports.acceptTreasuryTerms = exports.fetchTreasurySetupViewFailure = exports.fetchTreasurySetupViewSuccess = exports.fetchTreasurySetupView = exports.fetchTreasuryFunds = exports.initialState = void 0;
7
+ exports.updateFundAllocationLocalData = exports.fetchPortfolioAllocationFailure = exports.fetchPortfolioAllocationSuccess = exports.fetchPortfolioAllocation = exports.updatePortfolioAllocationFailure = exports.updatePortfolioAllocationSuccess = exports.updatePortfolioAllocation = exports.updateTreasuryFundsFailure = exports.updateTreasuryFundsSuccess = exports.clearTreasurySetupView = exports.acceptTreasuryTermsFailure = exports.acceptTreasuryTermsSuccess = exports.acceptTreasuryTerms = exports.fetchTreasurySetupViewFailure = exports.fetchTreasurySetupViewSuccess = exports.fetchTreasurySetupView = exports.fetchTreasuryFunds = exports.initialState = void 0;
8
8
  const toolkit_1 = require("@reduxjs/toolkit");
9
9
  const isEqual_1 = __importDefault(require("lodash/isEqual"));
10
10
  const rootActions_1 = require("../../../../rootActions");
@@ -41,18 +41,6 @@ exports.initialState = {
41
41
  fetchState: 'Not-Started',
42
42
  error: undefined,
43
43
  },
44
- updateTreasuryPromoIntroClosedByOutsideClickStatus: {
45
- fetchState: 'Not-Started',
46
- error: undefined,
47
- },
48
- updateTreasuryPromoRemindMeLaterClickedStatus: {
49
- fetchState: 'Not-Started',
50
- error: undefined,
51
- },
52
- updateTreasuryVideoViewedStatus: {
53
- fetchState: 'Not-Started',
54
- error: undefined,
55
- },
56
44
  hasValidState() {
57
45
  return this.fetchState === 'Completed';
58
46
  },
@@ -288,60 +276,6 @@ const treasurySetupView = (0, toolkit_1.createSlice)({
288
276
  updateFundAllocationLocalData(draft, action) {
289
277
  draft.fundAllocationLocalData = action.payload;
290
278
  },
291
- updateTreasuryVideoViewed(draft) {
292
- draft.updateTreasuryVideoViewedStatus = {
293
- fetchState: 'In-Progress',
294
- error: undefined,
295
- };
296
- },
297
- updateTreasuryVideoViewedSuccess(draft) {
298
- draft.updateTreasuryVideoViewedStatus = {
299
- fetchState: 'Completed',
300
- error: undefined,
301
- };
302
- },
303
- updateTreasuryVideoViewedFailure(draft, action) {
304
- draft.updateTreasuryVideoViewedStatus = {
305
- fetchState: 'Error',
306
- error: action.payload,
307
- };
308
- },
309
- updateTreasuryPromoRemindMeLaterClicked(draft) {
310
- draft.updateTreasuryPromoRemindMeLaterClickedStatus = {
311
- fetchState: 'In-Progress',
312
- error: undefined,
313
- };
314
- },
315
- updateTreasuryPromoRemindMeLaterClickedSuccess(draft) {
316
- draft.updateTreasuryPromoRemindMeLaterClickedStatus = {
317
- fetchState: 'Completed',
318
- error: undefined,
319
- };
320
- },
321
- updateTreasuryPromoRemindMeLaterClickedFailure(draft, action) {
322
- draft.updateTreasuryPromoRemindMeLaterClickedStatus = {
323
- fetchState: 'Error',
324
- error: action.payload,
325
- };
326
- },
327
- updateTreasuryPromoIntroClosedByOutsideClick(draft) {
328
- draft.updateTreasuryPromoIntroClosedByOutsideClickStatus = {
329
- fetchState: 'In-Progress',
330
- error: undefined,
331
- };
332
- },
333
- updateTreasuryPromoIntroClosedByOutsideClickSuccess(draft) {
334
- draft.updateTreasuryPromoIntroClosedByOutsideClickStatus = {
335
- fetchState: 'Completed',
336
- error: undefined,
337
- };
338
- },
339
- updateTreasuryPromoIntroClosedByOutsideClickFailure(draft, action) {
340
- draft.updateTreasuryPromoIntroClosedByOutsideClickStatus = {
341
- fetchState: 'Error',
342
- error: action.payload,
343
- };
344
- },
345
279
  clearTreasurySetupView(draft) {
346
280
  Object.assign(draft, exports.initialState);
347
281
  },
@@ -352,7 +286,7 @@ const treasurySetupView = (0, toolkit_1.createSlice)({
352
286
  });
353
287
  },
354
288
  });
355
- _a = treasurySetupView.actions, exports.fetchTreasuryFunds = _a.fetchTreasuryFunds, exports.fetchTreasurySetupView = _a.fetchTreasurySetupView, exports.fetchTreasurySetupViewSuccess = _a.fetchTreasurySetupViewSuccess, exports.fetchTreasurySetupViewFailure = _a.fetchTreasurySetupViewFailure, exports.acceptTreasuryTerms = _a.acceptTreasuryTerms, exports.acceptTreasuryTermsSuccess = _a.acceptTreasuryTermsSuccess, exports.acceptTreasuryTermsFailure = _a.acceptTreasuryTermsFailure, exports.clearTreasurySetupView = _a.clearTreasurySetupView, exports.updateTreasuryFundsSuccess = _a.updateTreasuryFundsSuccess, exports.updateTreasuryFundsFailure = _a.updateTreasuryFundsFailure, exports.updatePortfolioAllocation = _a.updatePortfolioAllocation, exports.updatePortfolioAllocationSuccess = _a.updatePortfolioAllocationSuccess, exports.updatePortfolioAllocationFailure = _a.updatePortfolioAllocationFailure, exports.fetchPortfolioAllocation = _a.fetchPortfolioAllocation, exports.fetchPortfolioAllocationSuccess = _a.fetchPortfolioAllocationSuccess, exports.fetchPortfolioAllocationFailure = _a.fetchPortfolioAllocationFailure, exports.updateFundAllocationLocalData = _a.updateFundAllocationLocalData, exports.updateTreasuryPromoIntroClosedByOutsideClick = _a.updateTreasuryPromoIntroClosedByOutsideClick, exports.updateTreasuryPromoIntroClosedByOutsideClickFailure = _a.updateTreasuryPromoIntroClosedByOutsideClickFailure, exports.updateTreasuryPromoIntroClosedByOutsideClickSuccess = _a.updateTreasuryPromoIntroClosedByOutsideClickSuccess, exports.updateTreasuryPromoRemindMeLaterClicked = _a.updateTreasuryPromoRemindMeLaterClicked, exports.updateTreasuryPromoRemindMeLaterClickedFailure = _a.updateTreasuryPromoRemindMeLaterClickedFailure, exports.updateTreasuryPromoRemindMeLaterClickedSuccess = _a.updateTreasuryPromoRemindMeLaterClickedSuccess, exports.updateTreasuryVideoViewed = _a.updateTreasuryVideoViewed, exports.updateTreasuryVideoViewedFailure = _a.updateTreasuryVideoViewedFailure, exports.updateTreasuryVideoViewedSuccess = _a.updateTreasuryVideoViewedSuccess;
289
+ _a = treasurySetupView.actions, exports.fetchTreasuryFunds = _a.fetchTreasuryFunds, exports.fetchTreasurySetupView = _a.fetchTreasurySetupView, exports.fetchTreasurySetupViewSuccess = _a.fetchTreasurySetupViewSuccess, exports.fetchTreasurySetupViewFailure = _a.fetchTreasurySetupViewFailure, exports.acceptTreasuryTerms = _a.acceptTreasuryTerms, exports.acceptTreasuryTermsSuccess = _a.acceptTreasuryTermsSuccess, exports.acceptTreasuryTermsFailure = _a.acceptTreasuryTermsFailure, exports.clearTreasurySetupView = _a.clearTreasurySetupView, exports.updateTreasuryFundsSuccess = _a.updateTreasuryFundsSuccess, exports.updateTreasuryFundsFailure = _a.updateTreasuryFundsFailure, exports.updatePortfolioAllocation = _a.updatePortfolioAllocation, exports.updatePortfolioAllocationSuccess = _a.updatePortfolioAllocationSuccess, exports.updatePortfolioAllocationFailure = _a.updatePortfolioAllocationFailure, exports.fetchPortfolioAllocation = _a.fetchPortfolioAllocation, exports.fetchPortfolioAllocationSuccess = _a.fetchPortfolioAllocationSuccess, exports.fetchPortfolioAllocationFailure = _a.fetchPortfolioAllocationFailure, exports.updateFundAllocationLocalData = _a.updateFundAllocationLocalData;
356
290
  exports.default = treasurySetupView.reducer;
357
291
  function mapTreasuryFundsPayloadToFundData(fundsPayload) {
358
292
  return fundsPayload.funds.map((fund) => ({
@@ -16,9 +16,6 @@ export interface TreasurySetupViewState extends FetchedState {
16
16
  fundAllocationOptions: FundAllocationOption[];
17
17
  fundsDetails: FundData[];
18
18
  };
19
- updateTreasuryPromoIntroClosedByOutsideClickStatus: FetchStateAndError;
20
- updateTreasuryPromoRemindMeLaterClickedStatus: FetchStateAndError;
21
- updateTreasuryVideoViewedStatus: FetchStateAndError;
22
19
  treasuryTermsDetails?: {
23
20
  fetchStatus: FetchStateAndError;
24
21
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.96",
3
+ "version": "5.1.97-betaAK0",
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,11 +0,0 @@
1
- import { InvoicingFormOption } from '../invoicingCommonPayload';
2
- import { InvoicingCouponApplyOn, InvoicingCouponDurationType, InvoicingCouponPeriodUnit, InvoicingDiscountType } from './couponPayload';
3
- /**
4
- * Coupon form select options. Single source of truth (CES-owned) for the value
5
- * sets that back the coupon's string-union domain fields; surfaced to the form
6
- * via `getInvoicingCouponFormView` so web-components need not hardcode them.
7
- */
8
- export declare const INVOICING_DISCOUNT_TYPE_OPTIONS: readonly InvoicingFormOption<InvoicingDiscountType>[];
9
- export declare const INVOICING_COUPON_DURATION_TYPE_OPTIONS: readonly InvoicingFormOption<InvoicingCouponDurationType>[];
10
- export declare const INVOICING_COUPON_PERIOD_UNIT_OPTIONS: readonly InvoicingFormOption<InvoicingCouponPeriodUnit>[];
11
- export declare const INVOICING_COUPON_APPLY_ON_OPTIONS: readonly InvoicingFormOption<InvoicingCouponApplyOn>[];
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.INVOICING_COUPON_APPLY_ON_OPTIONS = exports.INVOICING_COUPON_PERIOD_UNIT_OPTIONS = exports.INVOICING_COUPON_DURATION_TYPE_OPTIONS = exports.INVOICING_DISCOUNT_TYPE_OPTIONS = void 0;
4
- /**
5
- * Coupon form select options. Single source of truth (CES-owned) for the value
6
- * sets that back the coupon's string-union domain fields; surfaced to the form
7
- * via `getInvoicingCouponFormView` so web-components need not hardcode them.
8
- */
9
- exports.INVOICING_DISCOUNT_TYPE_OPTIONS = [
10
- { label: 'Percentage', value: 'percentage' },
11
- { label: 'Fixed amount', value: 'fixed_amount' },
12
- { label: 'Offer quantity', value: 'offer_quantity' },
13
- ];
14
- exports.INVOICING_COUPON_DURATION_TYPE_OPTIONS = [
15
- { label: 'One time', value: 'one_time' },
16
- { label: 'Forever', value: 'forever' },
17
- { label: 'Limited period', value: 'limited_period' },
18
- ];
19
- exports.INVOICING_COUPON_PERIOD_UNIT_OPTIONS = [
20
- { label: 'Day', value: 'day' },
21
- { label: 'Week', value: 'week' },
22
- { label: 'Month', value: 'month' },
23
- { label: 'Year', value: 'year' },
24
- ];
25
- exports.INVOICING_COUPON_APPLY_ON_OPTIONS = [
26
- { label: 'Invoice amount', value: 'invoice_amount' },
27
- { label: 'Each specified item', value: 'each_specified_item' },
28
- { label: 'Specified items total', value: 'specified_items_total' },
29
- ];
@@ -1,26 +0,0 @@
1
- /**
2
- * Coupon form select options. Single source of truth (CES-owned) for the value
3
- * sets that back the coupon's string-union domain fields; surfaced to the form
4
- * via `getInvoicingCouponFormView` so web-components need not hardcode them.
5
- */
6
- export const INVOICING_DISCOUNT_TYPE_OPTIONS = [
7
- { label: 'Percentage', value: 'percentage' },
8
- { label: 'Fixed amount', value: 'fixed_amount' },
9
- { label: 'Offer quantity', value: 'offer_quantity' },
10
- ];
11
- export const INVOICING_COUPON_DURATION_TYPE_OPTIONS = [
12
- { label: 'One time', value: 'one_time' },
13
- { label: 'Forever', value: 'forever' },
14
- { label: 'Limited period', value: 'limited_period' },
15
- ];
16
- export const INVOICING_COUPON_PERIOD_UNIT_OPTIONS = [
17
- { label: 'Day', value: 'day' },
18
- { label: 'Week', value: 'week' },
19
- { label: 'Month', value: 'month' },
20
- { label: 'Year', value: 'year' },
21
- ];
22
- export const INVOICING_COUPON_APPLY_ON_OPTIONS = [
23
- { label: 'Invoice amount', value: 'invoice_amount' },
24
- { label: 'Each specified item', value: 'each_specified_item' },
25
- { label: 'Specified items total', value: 'specified_items_total' },
26
- ];
@@ -1,18 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { updateTreasuryPromoIntroClosedByOutsideClickForLoggedInUser } from '../../../../../entity/tenant/tenantReducer';
4
- import { createZeniAPIStatus, isSuccessStatus, } from '../../../../../responsePayload';
5
- import { updateTreasuryPromoIntroClosedByOutsideClick, updateTreasuryPromoIntroClosedByOutsideClickFailure, updateTreasuryPromoIntroClosedByOutsideClickSuccess, } from '../treasurySetupViewReducer';
6
- export const updateTreasuryPromoIntroClosedByOutsideClickEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(updateTreasuryPromoIntroClosedByOutsideClick.match), switchMap(() => {
7
- return zeniAPI
8
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/user/self`, { is_treasury_promo_intro_closed_by_outside_click: true })
9
- .pipe(mergeMap((response) => {
10
- if (isSuccessStatus(response)) {
11
- return of(updateTreasuryPromoIntroClosedByOutsideClickForLoggedInUser(), updateTreasuryPromoIntroClosedByOutsideClickSuccess());
12
- }
13
- else {
14
- return of(updateTreasuryPromoIntroClosedByOutsideClickFailure(response.status));
15
- }
16
- }), catchError((error) => of(updateTreasuryPromoIntroClosedByOutsideClickFailure(createZeniAPIStatus('Unexpected error', 'Update treasury promo intro closed by outside click REST API call errored out' +
17
- (error?.message ?? JSON.stringify(error)))))));
18
- }));
@@ -1,18 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { updateTreasuryPromoRemindMeLaterClickedForLoggedInUser } from '../../../../../entity/tenant/tenantReducer';
4
- import { createZeniAPIStatus, isSuccessStatus, } from '../../../../../responsePayload';
5
- import { updateTreasuryPromoRemindMeLaterClicked, updateTreasuryPromoRemindMeLaterClickedFailure, updateTreasuryPromoRemindMeLaterClickedSuccess, } from '../treasurySetupViewReducer';
6
- export const updateTreasuryPromoRemindMeLaterClickedEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(updateTreasuryPromoRemindMeLaterClicked.match), switchMap(() => {
7
- return zeniAPI
8
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/user/self`, { is_treasury_promo_video_remind_me_later_clicked: true })
9
- .pipe(mergeMap((response) => {
10
- if (isSuccessStatus(response)) {
11
- return of(updateTreasuryPromoRemindMeLaterClickedForLoggedInUser(), updateTreasuryPromoRemindMeLaterClickedSuccess());
12
- }
13
- else {
14
- return of(updateTreasuryPromoRemindMeLaterClickedFailure(response.status));
15
- }
16
- }), catchError((error) => of(updateTreasuryPromoRemindMeLaterClickedFailure(createZeniAPIStatus('Unexpected error', 'Update treasury promo remind me later REST API call errored out' +
17
- (error?.message ?? JSON.stringify(error)))))));
18
- }));
@@ -1,18 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { updateTreasuryVideoViewedForLoggedInUser } from '../../../../../entity/tenant/tenantReducer';
4
- import { createZeniAPIStatus, isSuccessStatus, } from '../../../../../responsePayload';
5
- import { updateTreasuryVideoViewed, updateTreasuryVideoViewedFailure, updateTreasuryVideoViewedSuccess, } from '../treasurySetupViewReducer';
6
- export const updateTreasuryVideoViewedEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(updateTreasuryVideoViewed.match), switchMap(() => {
7
- return zeniAPI
8
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/user/self`, { is_treasury_promo_video_played: true })
9
- .pipe(mergeMap((response) => {
10
- if (isSuccessStatus(response)) {
11
- return of(updateTreasuryVideoViewedForLoggedInUser(), updateTreasuryVideoViewedSuccess());
12
- }
13
- else {
14
- return of(updateTreasuryVideoViewedFailure(response.status));
15
- }
16
- }), catchError((error) => of(updateTreasuryVideoViewedFailure(createZeniAPIStatus('Unexpected error', 'Update treasury video viewed REST API call errored out' +
17
- (error?.message ?? JSON.stringify(error)))))));
18
- }));
@@ -1,16 +0,0 @@
1
- import { of } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { createZeniAPIStatus, isSuccessResponse } from '../../responsePayload';
4
- import { fetchZeniAccountsPromoCard, updateZeniAccountsPromoCard, updateZeniAccountsPromoCardFailure, } from './zeniAccountsPromoCardReducer';
5
- export const fetchZeniAccountsPromoCardEpic = (actions$, _, zeniAPI) => actions$.pipe(filter(fetchZeniAccountsPromoCard.match), switchMap(() => zeniAPI
6
- .getJSON(`${zeniAPI.apiEndPoints.bankingMicroServiceBaseUrl}/1.0/deposit-accounts/promo-card`)
7
- .pipe(mergeMap((response) => {
8
- if (isSuccessResponse(response)) {
9
- return of(updateZeniAccountsPromoCard(response.data) // eslint-disable-line @typescript-eslint/no-non-null-assertion
10
- );
11
- }
12
- else {
13
- return of(updateZeniAccountsPromoCardFailure(response.status));
14
- }
15
- }), catchError((error) => of(updateZeniAccountsPromoCardFailure(createZeniAPIStatus('Unexpected error', 'Zeni Accounts Promo Card REST API call errored out' +
16
- JSON.stringify(error))))))));
@@ -1,60 +0,0 @@
1
- import { createSlice } from '@reduxjs/toolkit';
2
- import { clearAll } from '../../rootActions';
3
- export const initialState = {
4
- fetchState: 'Not-Started',
5
- error: undefined,
6
- depositAccountId: undefined,
7
- maxInsuredAmount: 0,
8
- maxAnnualPercentageYield: 0,
9
- maxPossibleInterest: 0,
10
- maxCashBalanceAvailable: 0,
11
- isShowDepositAccountsPromo: false,
12
- hasValidState() {
13
- return this.fetchState == 'Completed';
14
- },
15
- };
16
- const zeniAccountsPromoCard = createSlice({
17
- name: 'zeniAccountsPromoCard',
18
- initialState,
19
- reducers: {
20
- fetchZeniAccountsPromoCard(draft) {
21
- draft.fetchState = 'In-Progress';
22
- draft.error = undefined;
23
- },
24
- updateZeniAccountsPromoCard(draft, action) {
25
- draft.fetchState = 'Completed';
26
- draft.error = undefined;
27
- const promoPayload = action.payload;
28
- draft.isShowDepositAccountsPromo =
29
- promoPayload.is_show_deposit_accounts_promo_card;
30
- draft.maxAnnualPercentageYield = promoPayload.max_apy;
31
- draft.maxPossibleInterest =
32
- promoPayload.max_possible_interest != null
33
- ? promoPayload.max_possible_interest
34
- : undefined;
35
- draft.maxCashBalanceAvailable =
36
- promoPayload.max_cash_balance_available != null
37
- ? promoPayload.max_cash_balance_available
38
- : undefined;
39
- draft.maxInsuredAmount = promoPayload.max_insured_amount;
40
- draft.depositAccountId =
41
- promoPayload.primary_deposit_account_id != null
42
- ? promoPayload.primary_deposit_account_id
43
- : undefined;
44
- },
45
- updateZeniAccountsPromoCardFailure(draft, action) {
46
- draft.fetchState = 'Error';
47
- draft.error = action.payload;
48
- },
49
- clearZeniAccountsPromoCard(draft) {
50
- Object.assign(draft, initialState);
51
- },
52
- },
53
- extraReducers: (builder) => {
54
- builder.addCase(clearAll, (draft) => {
55
- Object.assign(draft, initialState);
56
- });
57
- },
58
- });
59
- export const { fetchZeniAccountsPromoCard, updateZeniAccountsPromoCard, updateZeniAccountsPromoCardFailure, clearZeniAccountsPromoCard, } = zeniAccountsPromoCard.actions;
60
- export default zeniAccountsPromoCard.reducer;
@@ -1,12 +0,0 @@
1
- import { createSelector } from '@reduxjs/toolkit';
2
- export const getZeniAccountsPromoCard = createSelector((state) => state.zeniAccountsPromoCardState, (zeniAccountsPromoCardState) => ({
3
- isShowDepositAccountsPromo: zeniAccountsPromoCardState.isShowDepositAccountsPromo,
4
- maxAnnualPercentageYield: zeniAccountsPromoCardState.maxAnnualPercentageYield,
5
- maxPossibleInterest: zeniAccountsPromoCardState.maxPossibleInterest,
6
- maxCashBalanceAvailable: zeniAccountsPromoCardState.maxCashBalanceAvailable,
7
- maxInsuredAmount: zeniAccountsPromoCardState.maxInsuredAmount,
8
- depositAccountId: zeniAccountsPromoCardState.depositAccountId,
9
- reportId: 'zeni_accounts_promo_card',
10
- fetchState: zeniAccountsPromoCardState.fetchState,
11
- error: zeniAccountsPromoCardState.error,
12
- }));