@zeniai/client-epic-state 5.1.29-beta0ND → 5.1.30-beta0AY

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 (49) hide show
  1. package/lib/__testHelpers__/apiFailure.json +6 -0
  2. package/lib/entity/customer/customerPayload.js +11 -2
  3. package/lib/entity/transaction/payloadTypes/vendorTransactionPayload.js +1 -1
  4. package/lib/entity/vendor/__mocks__/vendorMock.d.ts +7 -0
  5. package/lib/entity/vendor/__mocks__/vendorMock.js +311 -0
  6. package/lib/entity/vendor/__mocks__/vendorStateMocks.d.ts +8 -0
  7. package/lib/entity/vendor/__mocks__/vendorStateMocks.js +415 -0
  8. package/lib/entity/vendor/vendorPayload.d.ts +2 -4
  9. package/lib/entity/vendor/vendorPayload.js +3 -12
  10. package/lib/entity/vendor/vendorReducer.js +0 -3
  11. package/lib/esm/__testHelpers__/apiFailure.json +6 -0
  12. package/lib/esm/entity/customer/customerPayload.js +11 -2
  13. package/lib/esm/entity/transaction/payloadTypes/vendorTransactionPayload.js +2 -2
  14. package/lib/esm/entity/vendor/__mocks__/vendorMock.js +308 -0
  15. package/lib/esm/entity/vendor/__mocks__/vendorStateMocks.js +412 -0
  16. package/lib/esm/entity/vendor/vendorPayload.js +2 -10
  17. package/lib/esm/entity/vendor/vendorReducer.js +1 -4
  18. package/lib/esm/index.js +2 -2
  19. package/lib/esm/view/accountMappingView/__mocks__/accountMappingSelectorMock.js +4650 -0
  20. package/lib/esm/view/addressView/__mocks__/addressViewMocks.js +203 -0
  21. package/lib/esm/view/addressView/__mocks__/json/createAddressResponse.json +23 -0
  22. package/lib/esm/view/addressView/__mocks__/json/createCompanyAddressSuccess.json +258 -0
  23. package/lib/esm/view/addressView/__mocks__/json/createCompanyUserAddressSuccess.json +418 -0
  24. package/lib/esm/view/addressView/__mocks__/json/fetchAddressResponse.json +24 -0
  25. package/lib/esm/view/addressView/__mocks__/json/updateAddressResponse.json +24 -0
  26. package/lib/esm/view/commonVendorView/transactionVendorView/transactionVendorViewReducer.js +0 -2
  27. package/lib/esm/view/referralView/referralReducer.js +3 -2
  28. package/lib/esm/view/transactionDetail/epics/markTransactionAsNotMiscategorizedEpic.js +2 -28
  29. package/lib/esm/view/transactionDetail/epics/transactionDetailEpic.js +9 -10
  30. package/lib/index.d.ts +2 -2
  31. package/lib/index.js +7 -6
  32. package/lib/view/accountMappingView/__mocks__/accountMappingSelectorMock.d.ts +11 -0
  33. package/lib/view/accountMappingView/__mocks__/accountMappingSelectorMock.js +4659 -0
  34. package/lib/view/addressView/__mocks__/addressViewMocks.d.ts +35 -0
  35. package/lib/view/addressView/__mocks__/addressViewMocks.js +239 -0
  36. package/lib/view/addressView/__mocks__/json/createAddressResponse.json +23 -0
  37. package/lib/view/addressView/__mocks__/json/createCompanyAddressSuccess.json +258 -0
  38. package/lib/view/addressView/__mocks__/json/createCompanyUserAddressSuccess.json +418 -0
  39. package/lib/view/addressView/__mocks__/json/fetchAddressResponse.json +24 -0
  40. package/lib/view/addressView/__mocks__/json/updateAddressResponse.json +24 -0
  41. package/lib/view/commonVendorView/transactionVendorView/transactionVendorViewReducer.js +0 -2
  42. package/lib/view/referralView/referralReducer.d.ts +1 -0
  43. package/lib/view/referralView/referralReducer.js +4 -3
  44. package/lib/view/transactionDetail/epics/markTransactionAsNotMiscategorizedEpic.js +2 -28
  45. package/lib/view/transactionDetail/epics/transactionDetailEpic.js +8 -9
  46. package/package.json +70 -38
  47. package/lib/commonPayloadTypes/payloadIdentifier.d.ts +0 -6
  48. package/lib/commonPayloadTypes/payloadIdentifier.js +0 -18
  49. package/lib/esm/commonPayloadTypes/payloadIdentifier.js +0 -14
@@ -0,0 +1,412 @@
1
+ import { date } from '../../../zeniDayJS';
2
+ import { toZeniUrl } from '../../../zeniUrl';
3
+ export const vendorStateMock1 = {
4
+ recommendations: [],
5
+ transactionAttachments: [],
6
+ id: 'vendor_j12jh1g2g12jg3jh12:12',
7
+ name: 'Sample Vendor 1',
8
+ legalName: 'Sample Vendor 1',
9
+ qboId: '12',
10
+ title: '',
11
+ suffix: '',
12
+ firstName: 'Sample',
13
+ middleName: '',
14
+ lastName: 'Vendor',
15
+ vendorType: 'individual',
16
+ isDeleted: false,
17
+ yearToDateSpend: undefined,
18
+ last30DaysSpend: undefined,
19
+ last90DaysSpend: undefined,
20
+ lastMonthSpend: 0,
21
+ last6MonthsSpend: 0,
22
+ last3MonthsSpend: 0,
23
+ last12MonthsSpend: 0,
24
+ previousYearSpend: 0,
25
+ createTime: date('2022-01-24T00:29:37.057Z'),
26
+ updateTime: date('2022-01-24T00:29:37.057Z'),
27
+ syncToken: '1',
28
+ email: '',
29
+ phone: '',
30
+ websiteUrl: '',
31
+ currencyCode: 'USD',
32
+ currencySymbol: '$',
33
+ countryCode: 'US',
34
+ balance: 0,
35
+ accountId: 'Travel Meals',
36
+ classId: 'class_e0f33254-2651-4d5c-9d57-2611788265ca',
37
+ addressId: 'a_e3e99a8b-d400-42ac-ae09-e655bff1af97',
38
+ bankAccountIds: [
39
+ 'bank_adg67-asnds-a6sad-sdfgf8',
40
+ 'bank_asghj-hags23-hgfjh-g3asfas',
41
+ ],
42
+ contactIds: [
43
+ 'contacts_f3881db1-35c0-4699-891c-6cca724e75d6',
44
+ 'contacts_6856c987-17ff-44a4-aad3-eef4b7696554',
45
+ ],
46
+ matchScore: 0,
47
+ isVendor1099: false,
48
+ documentIds: [],
49
+ vendorCurrencySymbol: '$',
50
+ vendorCurrencyCode: 'USD',
51
+ paymentInstrumentIds: ['pay_inst_f3fc9b06-694a-4609-a710-b0e1d4de72d3'],
52
+ preferredInternationalTransferFeeBearerPaymentMethod: undefined,
53
+ filing1099Status: 'incomplete',
54
+ filing1099Tin: {
55
+ type: 'ein',
56
+ value: '550258131',
57
+ },
58
+ filing1099W9Files: undefined,
59
+ filing1099Total: undefined,
60
+ filing1099Type: undefined,
61
+ w9DocumentIds: [],
62
+ };
63
+ export const vendorStateMock2 = {
64
+ recommendations: [],
65
+ transactionAttachments: [],
66
+ id: 'vendor_j12jh1g2g12jg3jh12:2',
67
+ name: 'Sample Vendor 2',
68
+ legalName: 'Sample Vendor 2',
69
+ qboId: '13',
70
+ title: '',
71
+ suffix: '',
72
+ firstName: 'Sample',
73
+ middleName: '',
74
+ lastName: 'Vendor 3',
75
+ vendorType: 'c_corporation',
76
+ isDeleted: false,
77
+ yearToDateSpend: undefined,
78
+ last30DaysSpend: undefined,
79
+ last90DaysSpend: undefined,
80
+ lastMonthSpend: 0,
81
+ last6MonthsSpend: 0,
82
+ last3MonthsSpend: 0,
83
+ last12MonthsSpend: 0,
84
+ previousYearSpend: 0,
85
+ createTime: date('2022-01-24T00:29:37.057Z'),
86
+ updateTime: date('2022-01-24T00:29:37.057Z'),
87
+ syncToken: '1',
88
+ email: '',
89
+ phone: '',
90
+ balance: 0,
91
+ websiteUrl: '',
92
+ currencyCode: 'USD',
93
+ currencySymbol: '$',
94
+ countryCode: 'US',
95
+ accountId: 'Travel Meals',
96
+ classId: 'class_e0f33254-2651-4d5c-9d57-2611788265ca',
97
+ bankAccountIds: [
98
+ 'bank_asghj-hgfjh-g3asfas-hags23',
99
+ 'bank_g3asfas-hags23-hgfjh-asghj',
100
+ ],
101
+ contactIds: [
102
+ 'contacts_f3881db1-35c0-4699-891c-6cca724e75d6',
103
+ 'contacts_6856c987-17ff-44a4-aad3-eef4b7696554',
104
+ ],
105
+ matchScore: 0,
106
+ isVendor1099: false,
107
+ documentIds: [],
108
+ vendorCurrencySymbol: '$',
109
+ vendorCurrencyCode: 'USD',
110
+ paymentInstrumentIds: ['pay_inst_f3fc9b06-694a-4609-a710-b0e1d4de72d3'],
111
+ preferredInternationalTransferFeeBearerPaymentMethod: undefined,
112
+ filing1099Status: 'incomplete',
113
+ filing1099Tin: {
114
+ type: 'ein',
115
+ value: '550258131',
116
+ },
117
+ w9DocumentIds: [],
118
+ };
119
+ export const vendorStateMock4 = {
120
+ recommendations: [],
121
+ transactionAttachments: [],
122
+ id: 'vendor_j12jh1g2g12jg3jh12:12',
123
+ name: 'Sample Vendor',
124
+ legalName: 'Sample Vendor',
125
+ qboId: '12',
126
+ title: '',
127
+ suffix: '',
128
+ firstName: 'Sample',
129
+ middleName: '',
130
+ lastName: 'Vendor',
131
+ vendorType: 'Individual',
132
+ isDeleted: false,
133
+ yearToDateSpend: undefined,
134
+ last30DaysSpend: undefined,
135
+ last90DaysSpend: undefined,
136
+ lastMonthSpend: 0,
137
+ last6MonthsSpend: 0,
138
+ last3MonthsSpend: 0,
139
+ last12MonthsSpend: 0,
140
+ previousYearSpend: 0,
141
+ createTime: date('2022-01-24T00:29:37.057Z'),
142
+ updateTime: date('2022-01-24T00:29:37.057Z'),
143
+ syncToken: '1',
144
+ email: '',
145
+ phone: '',
146
+ websiteUrl: '',
147
+ currencyCode: 'USD',
148
+ currencySymbol: '$',
149
+ countryCode: 'US',
150
+ balance: 0,
151
+ accountId: 'Travel Meals',
152
+ classId: 'class_e0f33254-2651-4d5c-9d57-2611788265ca',
153
+ addressId: 'a_e3e99a8b-d400-42ac-ae09-e655bff1af97',
154
+ bankAccountIds: [
155
+ 'bank_adg67-asnds-a6sad-sdfgf8',
156
+ 'bank_asghj-hags23-hgfjh-g3asfas',
157
+ ],
158
+ contactIds: [
159
+ 'contacts_6856c987-17ff-44a4-aad3-eef4b7696554',
160
+ 'contacts_f3881db1-35c0-4699-891c-6cca724e75d6',
161
+ ],
162
+ logo: undefined,
163
+ shippingAddressId: undefined,
164
+ matchScore: 0,
165
+ isVendor1099: false,
166
+ documentIds: [],
167
+ ownerId: undefined,
168
+ vendorCurrencySymbol: '$',
169
+ vendorCurrencyCode: 'USD',
170
+ paymentInstrumentIds: ['pay_inst_f3fc9b06-694a-4609-a710-b0e1d4de72d3'],
171
+ preferredInternationalTransferFeeBearerPaymentMethod: undefined,
172
+ filing1099Status: undefined,
173
+ filing1099Tin: undefined,
174
+ isINTType: false,
175
+ isMISCType: false,
176
+ isNECType: false,
177
+ filing1099INTTotal: undefined,
178
+ filing1099MISCTotal: undefined,
179
+ filing1099NECTotal: undefined,
180
+ filing1099W9Files: [],
181
+ filing1099TaxClassification: 'Individual',
182
+ w9DocumentIds: [],
183
+ };
184
+ export const vendorStateMock5 = {
185
+ recommendations: [],
186
+ transactionAttachments: [
187
+ {
188
+ id: '5000000000000795428',
189
+ contentType: 'application/pdf',
190
+ createTime: date('2022-02-17T06:30:51.000000'),
191
+ updateTime: date('2022-02-17T06:30:52.000000'),
192
+ fileName: 'Rent Receipt.pdf',
193
+ fileSizeInBytes: 255841,
194
+ fileDownloadUrl: toZeniUrl('https://storage.googleapis.com/zeni-dot-ai-tenant_745cc76c-5a82-4d2c-b9dc-9d1f283a4445/files/2022-05-05/file_bd906c26-0f37-44fe-8156-f5bfed67c383/file_bd906c26-0f37-44fe-8156-f5bfed67c383.pdf?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=zeni-apis-dev%40appspot.gserviceaccount.com%2F20220505%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20220505T083711Z&X-Goog-Expires=1200&X-Goog-SignedHeaders=host&X-Goog-Signature=bdba6c6b57b5a16973892683b57c27f29cbe72dc0e5a8acc03a630123bf5899536fd47178aef176ec5a2ebb549371e386bd0ac56e3d23e63446d20a0c8604f77b39aac055dcdb7a81529cbd934dba3e9a5934060b09695673a751436c96f1340979ce7c385f3bd3d4cb23211336bbdea7035d4f60997358c40020f8af0e6235b2e7fc43cdb3abb83c17d78abe5401257790601c01b97c1be5192178d0fe02d5828430ea763d0320beecea53a144a14c6f9e50ae8f29ea8bd9ae41686246f99a128ccdf7ef50ac102cc2ebc858c721a1006575a667b6963e4f95e37fcd17f94f8733ece376dbae145c6a91291fccb28b17eae7fe440a696302a901d7608384505'),
195
+ fileChecksum: undefined,
196
+ fileId: 'file_pu01bcfe-ebef-459b-a54c-7abdbdf0d77t',
197
+ },
198
+ ],
199
+ id: 'vendor_75f9e389-d9b7-4fcb-b4b5-8a691fcc96a5',
200
+ name: 'Google SVSS',
201
+ legalName: 'Google SVSS',
202
+ qboId: '10',
203
+ title: '',
204
+ suffix: '',
205
+ firstName: 'Google',
206
+ middleName: '',
207
+ lastName: 'SVSS',
208
+ vendorType: 'Individual',
209
+ isDeleted: false,
210
+ yearToDateSpend: undefined,
211
+ last30DaysSpend: undefined,
212
+ last90DaysSpend: undefined,
213
+ lastMonthSpend: 0,
214
+ last6MonthsSpend: 0,
215
+ last3MonthsSpend: 0,
216
+ last12MonthsSpend: 0,
217
+ previousYearSpend: 0,
218
+ createTime: date('2022-01-24T00:29:37.057Z'),
219
+ updateTime: date('2022-01-24T00:29:37.057Z'),
220
+ syncToken: '1',
221
+ email: '',
222
+ phone: '',
223
+ websiteUrl: '',
224
+ currencyCode: 'USD',
225
+ currencySymbol: '$',
226
+ countryCode: 'US',
227
+ balance: 0,
228
+ accountId: 'Travel Meals',
229
+ classId: 'class_e0f33254-2651-4d5c-9d57-2611788265ca',
230
+ addressId: 'a_e3e99a8b-d400-42ac-ae09-e655bff1af97',
231
+ bankAccountIds: [
232
+ 'bank_adg67-asnds-a6sad-sdfgf8',
233
+ 'bank_asghj-hags23-hgfjh-g3asfas',
234
+ ],
235
+ contactIds: [
236
+ 'contacts_6856c987-17ff-44a4-aad3-eef4b7696554',
237
+ 'contacts_f3881db1-35c0-4699-891c-6cca724e75d6',
238
+ ],
239
+ logo: undefined,
240
+ shippingAddressId: undefined,
241
+ matchScore: 0,
242
+ isVendor1099: false,
243
+ documentIds: [],
244
+ ownerId: undefined,
245
+ vendorCurrencySymbol: '$',
246
+ vendorCurrencyCode: 'USD',
247
+ paymentInstrumentIds: ['pay_inst_f3fc9b06-694a-4609-a710-b0e1d4de72d3'],
248
+ filing1099Status: 'incomplete',
249
+ filing1099Tin: {
250
+ type: 'ein',
251
+ value: '550258131',
252
+ },
253
+ filing1099Type: 'int',
254
+ filing1099Total: 2287,
255
+ w9DocumentIds: [],
256
+ };
257
+ export const vendorStateMock6 = {
258
+ recommendations: [],
259
+ id: 'vendor_44d40a18-22cb-49b7-b13f-c7c148ac1cf3',
260
+ name: 'Abb Enterprise',
261
+ legalName: 'Abb Enterprise',
262
+ qboId: '11',
263
+ title: '',
264
+ suffix: '',
265
+ firstName: 'Abb',
266
+ middleName: '',
267
+ lastName: 'Enterprise',
268
+ vendorType: 'Individual',
269
+ isDeleted: false,
270
+ yearToDateSpend: undefined,
271
+ last30DaysSpend: undefined,
272
+ last90DaysSpend: undefined,
273
+ lastMonthSpend: 0,
274
+ last6MonthsSpend: 0,
275
+ last3MonthsSpend: 0,
276
+ last12MonthsSpend: 0,
277
+ previousYearSpend: 0,
278
+ createTime: date('2022-01-24T00:29:37.057Z'),
279
+ updateTime: date('2022-01-24T00:29:37.057Z'),
280
+ syncToken: '1',
281
+ email: '',
282
+ phone: '',
283
+ websiteUrl: '',
284
+ currencyCode: 'USD',
285
+ currencySymbol: '$',
286
+ countryCode: 'US',
287
+ balance: 0,
288
+ accountId: 'Travel Meals',
289
+ classId: 'class_e0f33254-2651-4d5c-9d57-2611788265ca',
290
+ addressId: 'a_e3e99a8b-d400-42ac-ae09-e655bff1af97',
291
+ bankAccountIds: [
292
+ 'bank_adg67-asnds-a6sad-sdfgf8',
293
+ 'bank_asghj-hags23-hgfjh-g3asfas',
294
+ ],
295
+ contactIds: [
296
+ 'contacts_6856c987-17ff-44a4-aad3-eef4b7696554',
297
+ 'contacts_f3881db1-35c0-4699-891c-6cca724e75d6',
298
+ ],
299
+ paymentInstrumentIds: ['pay_inst_f3fc9b06-694a-4609-a710-b0e1d4de72d3'],
300
+ logo: undefined,
301
+ shippingAddressId: undefined,
302
+ matchScore: 0,
303
+ isVendor1099: false,
304
+ documentIds: [],
305
+ ownerId: undefined,
306
+ vendorCurrencySymbol: '$',
307
+ vendorCurrencyCode: 'USD',
308
+ transactionAttachments: [],
309
+ filing1099Status: 'incomplete',
310
+ filing1099Tin: {
311
+ type: 'ein',
312
+ value: '550258131',
313
+ },
314
+ filing1099Type: 'int',
315
+ filing1099Total: 2287,
316
+ w9DocumentIds: [],
317
+ };
318
+ export const vendorStateMock7 = {
319
+ id: 'vendor_7fd58fd7-2916-4fae-ba14-3c0f6e277743',
320
+ name: 'Hall Properties',
321
+ title: '',
322
+ suffix: '',
323
+ firstName: '',
324
+ middleName: '',
325
+ lastName: '',
326
+ vendorType: '',
327
+ isDeleted: false,
328
+ createTime: date('2024-02-19T12:38:08.740Z'),
329
+ updateTime: date('2024-02-19T12:38:08.740Z'),
330
+ currencyCode: 'USD',
331
+ currencySymbol: '$',
332
+ vendorCurrencyCode: 'USD',
333
+ vendorCurrencySymbol: '$',
334
+ qboId: '',
335
+ syncToken: '',
336
+ email: '',
337
+ phone: '',
338
+ websiteUrl: '',
339
+ contactIds: [],
340
+ bankAccountIds: [],
341
+ paymentInstrumentIds: [],
342
+ balance: 0,
343
+ matchScore: 0,
344
+ isVendor1099: false,
345
+ documentIds: [],
346
+ last30DaysSpend: 0,
347
+ last90DaysSpend: 0,
348
+ yearToDateSpend: 0,
349
+ recommendations: [],
350
+ transactionAttachments: [],
351
+ };
352
+ export const vendorStateMock8 = {
353
+ recommendations: [],
354
+ transactionAttachments: [],
355
+ id: 'vendor_j12jh1g2g12jg3jh12:12',
356
+ name: 'Sample Vendor 1',
357
+ legalName: 'Sample Vendor 1',
358
+ qboId: '12',
359
+ title: '',
360
+ suffix: '',
361
+ firstName: 'Sample',
362
+ middleName: '',
363
+ lastName: 'Vendor',
364
+ vendorType: 'individual',
365
+ isDeleted: false,
366
+ yearToDateSpend: undefined,
367
+ last30DaysSpend: undefined,
368
+ last90DaysSpend: undefined,
369
+ lastMonthSpend: 0,
370
+ last6MonthsSpend: 0,
371
+ last3MonthsSpend: 0,
372
+ last12MonthsSpend: 0,
373
+ previousYearSpend: 0,
374
+ createTime: date('2022-01-24T00:29:37.057Z'),
375
+ updateTime: date('2022-01-24T00:29:37.057Z'),
376
+ syncToken: '1',
377
+ email: '',
378
+ phone: '',
379
+ websiteUrl: '',
380
+ currencyCode: 'USD',
381
+ currencySymbol: '$',
382
+ countryCode: 'US',
383
+ balance: 0,
384
+ accountId: 'Travel Meals',
385
+ classId: 'class_e0f33254-2651-4d5c-9d57-2611788265ca',
386
+ addressId: 'a_e3e99a8b-d400-42ac-ae09-e655bff1af97',
387
+ bankAccountIds: [
388
+ 'bank_adg67-asnds-a6sad-sdfgf8',
389
+ 'bank_asghj-hags23-hgfjh-g3asfas',
390
+ ],
391
+ contactIds: [
392
+ 'contacts_f3881db1-35c0-4699-891c-6cca724e75d6',
393
+ 'contacts_6856c987-17ff-44a4-aad3-eef4b7696554',
394
+ ],
395
+ matchScore: 0,
396
+ isVendor1099: false,
397
+ documentIds: [],
398
+ vendorCurrencySymbol: '$',
399
+ vendorCurrencyCode: 'USD',
400
+ paymentInstrumentIds: ['pay_inst_f3fc9b06-694a-4609-a710-b0e1d4de72d3'],
401
+ preferredInternationalTransferFeeBearerPaymentMethod: undefined,
402
+ filing1099Status: 'incomplete',
403
+ filing1099Tin: {
404
+ type: 'ein',
405
+ value: '550258131',
406
+ },
407
+ isINTType: true,
408
+ filing1099W9Files: undefined,
409
+ filing1099Total: undefined,
410
+ filing1099Type: 'int',
411
+ w9DocumentIds: [],
412
+ };
@@ -1,4 +1,3 @@
1
- import { resolvePayloadIdentifier } from '../../commonPayloadTypes/payloadIdentifier';
2
1
  import { toURL } from '../../commonPayloadTypes/urlPayload';
3
2
  import { toCompletionStatusType } from '../../commonStateTypes/common';
4
3
  import { date, dateNow } from '../../zeniDayJS';
@@ -9,16 +8,9 @@ import { toTinType } from './vendorType';
9
8
  /**
10
9
  * Resolves the effective vendor identifier from a payload.
11
10
  * For JE/Deposit transactions, vendor_id is null at runtime — qbo_id is the
12
- * actual identity.
11
+ * actual identity. Using nullish-coalescing (`??`) handles both cases uniformly.
13
12
  */
14
- export const getVendorPayloadIdentifier = (vendor) => resolvePayloadIdentifier(vendor.vendor_id, vendor.qbo_id);
15
- /** Normalizes vendor_id to the resolved identifier when one exists. */
16
- export const normalizeVendorBasePayload = (vendor) => {
17
- const resolvedVendorId = getVendorPayloadIdentifier(vendor);
18
- return resolvedVendorId != null
19
- ? { ...vendor, vendor_id: resolvedVendorId }
20
- : vendor;
21
- };
13
+ export const getVendorPayloadIdentifier = (vendor) => vendor.vendor_id ?? vendor.qbo_id ?? null;
22
14
  export const mapVendorBasePayloadToVendorBase = (payload) => {
23
15
  const id = getVendorPayloadIdentifier(payload);
24
16
  if (id == null) {
@@ -1,6 +1,6 @@
1
1
  import { createSlice } from '@reduxjs/toolkit';
2
2
  import assignWith from 'lodash/assignWith';
3
- import { getVendorPayloadIdentifier, mapVendorPayloadToVendor, } from './vendorPayload';
3
+ import { mapVendorPayloadToVendor, } from './vendorPayload';
4
4
  export const initialState = {
5
5
  vendorByID: {},
6
6
  };
@@ -55,9 +55,6 @@ export const { updateVendors, removeVendor, updateVendorSpendTrend, clearAllVend
55
55
  export default vendor.reducer;
56
56
  const doUpdateVendors = (draft, vendors, updateType) => {
57
57
  vendors.forEach((vendorPayload) => {
58
- if (getVendorPayloadIdentifier(vendorPayload) == null) {
59
- return;
60
- }
61
58
  const latestVendor = mapVendorPayloadToVendor(vendorPayload);
62
59
  if (latestVendor.id in draft && updateType === 'merge') {
63
60
  assignWith(draft[latestVendor.id], latestVendor, (objValue, srcValue) => Boolean(srcValue) === false ? objValue : srcValue); // IMPORTANT: replace the value only when source has valid value. Otherwise keep the existing value!);
package/lib/esm/index.js CHANGED
@@ -244,7 +244,7 @@ import { getProfitAndLossProjectView } from './view/profitAndLossProjectView/pro
244
244
  import { fetchProjectList } from './view/projectList/projectListReducer';
245
245
  import { getProjectList, } from './view/projectList/projectListSelector';
246
246
  import { fetchEntityRecommendationsByTransactionId, fetchEntityRecommendationsForLineUpdate, fetchRecommendationByEntityId, fetchRecommendationByEntityName, } from './view/recommendation/recommendationReducer';
247
- import { clearReferrals, fetchReferrals, fetchRewardsPlan, resendReferralInvite, saveReferralFormDataInLocalStore, sendReferralInvite, updateReferViewed, updateReferralListSortUiState, } from './view/referralView/referralReducer';
247
+ import { DEFAULT_REFERRER_AMOUNT, clearReferrals, fetchReferrals, fetchRewardsPlan, resendReferralInvite, saveReferralFormDataInLocalStore, sendReferralInvite, updateReferViewed, updateReferralListSortUiState, } from './view/referralView/referralReducer';
248
248
  import { getInviteFormView, getReferralListView, getRewardsPlanCard, } from './view/referralView/referralSelector';
249
249
  import { AmountStatusTypes, StatusTypes, toReferralListViewSortKeyType, } from './view/referralView/referralState';
250
250
  import { fetchReimbursementCard } from './view/reimbursementCard/reimbursementCardReducer';
@@ -642,7 +642,7 @@ export { toNotificationModeStrict, updateCommentsNotifications, updateCommentsNo
642
642
  export { toNotificationSubTabTypeStrict, toNotificationTabTypeStrict, fetchNotificationView, fetchNotificationUnreadCount, fetchNotificationUnreadCountSuccess, updateNotificationViewAllNotificationsStatus, updateNotificationViewNotificationStatus, updateNotificationViewTabState, updateNotificationViewCurrentTabAndSubTab, updateNotificationViewSubTab, updateNotificationViewUIState, getNotificationView, getExternalNotificationsForSelectedSubTab, getNotificationsForSelectedSubTab, };
643
643
  export { clearFeatureNotificationView, fetchRegisteredInterests, notifyMeForFeature, getFeatureNotificationView, getRegisteredInterests, getRegisteredInterestsByFeature, isFeatureInterestRegistered, };
644
644
  export { pushToastNotification, getLastNotificationTime, getNotifications, };
645
- export { getReferralListView, getInviteFormView, toReferralListViewSortKeyType, StatusTypes, AmountStatusTypes, fetchReferrals, sendReferralInvite, clearReferrals, saveReferralFormDataInLocalStore, updateReferralListSortUiState, resendReferralInvite, fetchRewardsPlan, getRewardsPlanCard, updateReferViewed, };
645
+ export { getReferralListView, getInviteFormView, toReferralListViewSortKeyType, StatusTypes, AmountStatusTypes, DEFAULT_REFERRER_AMOUNT, fetchReferrals, sendReferralInvite, clearReferrals, saveReferralFormDataInLocalStore, updateReferralListSortUiState, resendReferralInvite, fetchRewardsPlan, getRewardsPlanCard, updateReferViewed, };
646
646
  export { ALL_WEEK_DAYS, SEMI_WEEKLY_REQUIRED_DAYS_COUNT, getMinAllowedEndDate, getRecurringEndDateFromCount, toDayOfWeek, toRecurringFrequency, };
647
647
  export { fetchCockpitContext, fetchCompanyTaskManagerView, fetchTaskManagerMetrics, getCompanyTaskManagerView, createTaskFromTaskGroupTemplate, };
648
648
  export { fetchInternationalVerificationForm, submitInternationalVerificationForm, updateVerificationFormLocalData, getIntlWireVerificationView, };