@zeniai/client-epic-state 5.2.87 → 5.2.88

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.
@@ -50,6 +50,8 @@ function toSaveNotificationSettingsPayload(localData, notificationSettingsData)
50
50
  pending_bill_approval_notification: null,
51
51
  pending_reimbursement_approval_notification: null,
52
52
  is_pending_reimbursement_approval_notification_active: null,
53
+ is_pending_task_notification_active: null,
54
+ pending_task_notification: null,
53
55
  is_month_end_insights_active: monthEndInsightsNotificationSettings.enabled != null
54
56
  ? monthEndInsights.notify
55
57
  : null,
@@ -77,5 +79,10 @@ function toSaveNotificationSettingsPayload(localData, notificationSettingsData)
77
79
  0;
78
80
  payload.pending_reimbursement_approval_notification = toRemindersPayload(reminders.pendingReimbursementApprovalNotification);
79
81
  }
82
+ if (reminderNotificationSettings.pendingTaskNotification != null) {
83
+ payload.is_pending_task_notification_active =
84
+ reminders.pendingTaskNotification.preferredMode.length > 0;
85
+ payload.pending_task_notification = toRemindersPayload(reminders.pendingTaskNotification);
86
+ }
80
87
  return payload;
81
88
  }
@@ -140,6 +140,7 @@ export const isRemindersSectionVisibleOnSettingsPage = (reminderNotificationSett
140
140
  reminderNotificationSettings.pendingBillApprovalNotification != null ||
141
141
  reminderNotificationSettings.pendingReimbursementApprovalNotification !=
142
142
  null ||
143
+ reminderNotificationSettings.pendingTaskNotification != null ||
143
144
  reminderNotificationSettings.uncategorizedTransactionNotification != null);
144
145
  };
145
146
  export const isMonthEndNotificationsSectionVisibleOnSettingsPage = (monthEndInsightsNotificationSettings, signedInUseEmail) => {
@@ -4,6 +4,7 @@ import { toNotificationMode, toRemindersFrequencyType, } from './settingsViewSta
4
4
  const initialNotificationSettingsData = {
5
5
  reminderNotificationSettings: {
6
6
  missingReceiptNotification: null,
7
+ pendingTaskNotification: null,
7
8
  uncategorizedTransactionNotification: null,
8
9
  pendingBillApprovalNotification: null,
9
10
  pendingReimbursementApprovalNotification: null,
@@ -44,6 +45,7 @@ const initialNotificationSettingsLocalData = {
44
45
  missingReceiptNotification: initialRemindersLocalData,
45
46
  pendingBillApprovalNotification: initialRemindersLocalData,
46
47
  pendingReimbursementApprovalNotification: initialRemindersLocalData,
48
+ pendingTaskNotification: initialRemindersLocalData,
47
49
  uncategorizedTransactionNotification: initialRemindersLocalData,
48
50
  },
49
51
  };
@@ -373,7 +375,7 @@ function toRemindersLocalData(reminderNotificationSettingDetails) {
373
375
  }
374
376
  const toNotificationSettingsLocalData = (data, loggedInUserEmail) => {
375
377
  const { monthEndInsightsNotificationSettings, reminderNotificationSettings } = data;
376
- const { missingReceiptNotification, pendingBillApprovalNotification, pendingReimbursementApprovalNotification, uncategorizedTransactionNotification, } = reminderNotificationSettings;
378
+ const { missingReceiptNotification, pendingBillApprovalNotification, pendingReimbursementApprovalNotification, pendingTaskNotification, uncategorizedTransactionNotification, } = reminderNotificationSettings;
377
379
  return {
378
380
  monthEndInsights: {
379
381
  notify: monthEndInsightsNotificationSettings.enabled ??
@@ -384,10 +386,22 @@ const toNotificationSettingsLocalData = (data, loggedInUserEmail) => {
384
386
  missingReceiptNotification: toRemindersLocalData(missingReceiptNotification),
385
387
  pendingBillApprovalNotification: toRemindersLocalData(pendingBillApprovalNotification),
386
388
  pendingReimbursementApprovalNotification: toRemindersLocalData(pendingReimbursementApprovalNotification),
389
+ pendingTaskNotification: toRemindersLocalData(pendingTaskNotification),
387
390
  uncategorizedTransactionNotification: toRemindersLocalData(uncategorizedTransactionNotification),
388
391
  },
389
392
  };
390
393
  };
394
+ function toPendingTaskNotificationActive(data) {
395
+ if (data.is_pending_task_notification_active != null) {
396
+ return data.is_pending_task_notification_active;
397
+ }
398
+ // Rows saved before this flag existed store null. It shares the
399
+ // transactions-reminder scope with missing receipts and uncategorized
400
+ // transactions, so a set sibling means the user has access.
401
+ const hasTransactionReminderAccess = data.is_missing_receipt_notification_active != null ||
402
+ data.is_uncategorized_transaction_notification_active != null;
403
+ return hasTransactionReminderAccess ? false : null;
404
+ }
391
405
  function toReminderNotificationSettingsDetails(isNotificationActive, remindersPayload) {
392
406
  if (isNotificationActive != null) {
393
407
  return {
@@ -408,6 +422,7 @@ const toNotificationSettings = (data) => {
408
422
  missingReceiptNotification: toReminderNotificationSettingsDetails(data.is_missing_receipt_notification_active, data.missing_receipt_notification),
409
423
  pendingBillApprovalNotification: toReminderNotificationSettingsDetails(data.is_pending_bill_approval_notification_active, data.pending_bill_approval_notification),
410
424
  pendingReimbursementApprovalNotification: toReminderNotificationSettingsDetails(data.is_pending_reimbursement_approval_notification_active, data.pending_reimbursement_approval_notification),
425
+ pendingTaskNotification: toReminderNotificationSettingsDetails(toPendingTaskNotificationActive(data), data.pending_task_notification),
411
426
  uncategorizedTransactionNotification: toReminderNotificationSettingsDetails(data.is_uncategorized_transaction_notification_active, data.uncategorized_transaction_notification),
412
427
  },
413
428
  monthEndInsightsNotificationSettings: {
@@ -1,6 +1,7 @@
1
1
  import { stringToUnion } from '../../commonStateTypes/stringToUnion';
2
2
  export const REMINDER_NOTIFICATION_TYPES = [
3
3
  'missingReceiptNotification',
4
+ 'pendingTaskNotification',
4
5
  'uncategorizedTransactionNotification',
5
6
  'pendingBillApprovalNotification',
6
7
  'pendingReimbursementApprovalNotification',
@@ -54,6 +54,8 @@ function toSaveNotificationSettingsPayload(localData, notificationSettingsData)
54
54
  pending_bill_approval_notification: null,
55
55
  pending_reimbursement_approval_notification: null,
56
56
  is_pending_reimbursement_approval_notification_active: null,
57
+ is_pending_task_notification_active: null,
58
+ pending_task_notification: null,
57
59
  is_month_end_insights_active: monthEndInsightsNotificationSettings.enabled != null
58
60
  ? monthEndInsights.notify
59
61
  : null,
@@ -81,5 +83,10 @@ function toSaveNotificationSettingsPayload(localData, notificationSettingsData)
81
83
  0;
82
84
  payload.pending_reimbursement_approval_notification = toRemindersPayload(reminders.pendingReimbursementApprovalNotification);
83
85
  }
86
+ if (reminderNotificationSettings.pendingTaskNotification != null) {
87
+ payload.is_pending_task_notification_active =
88
+ reminders.pendingTaskNotification.preferredMode.length > 0;
89
+ payload.pending_task_notification = toRemindersPayload(reminders.pendingTaskNotification);
90
+ }
84
91
  return payload;
85
92
  }
@@ -153,6 +153,7 @@ const isRemindersSectionVisibleOnSettingsPage = (reminderNotificationSettings) =
153
153
  reminderNotificationSettings.pendingBillApprovalNotification != null ||
154
154
  reminderNotificationSettings.pendingReimbursementApprovalNotification !=
155
155
  null ||
156
+ reminderNotificationSettings.pendingTaskNotification != null ||
156
157
  reminderNotificationSettings.uncategorizedTransactionNotification != null);
157
158
  };
158
159
  exports.isRemindersSectionVisibleOnSettingsPage = isRemindersSectionVisibleOnSettingsPage;
@@ -32,10 +32,12 @@ export interface NotificationSettingsPayload {
32
32
  is_month_end_insights_active: boolean | null;
33
33
  is_pending_bill_approval_notification_active: boolean | null;
34
34
  is_pending_reimbursement_approval_notification_active: boolean | null;
35
+ is_pending_task_notification_active: boolean | null;
35
36
  is_uncategorized_transaction_notification_active: boolean | null;
36
37
  missing_receipt_notification: RemindersPayload | null;
37
38
  pending_bill_approval_notification: RemindersPayload | null;
38
39
  pending_reimbursement_approval_notification: RemindersPayload | null;
40
+ pending_task_notification: RemindersPayload | null;
39
41
  uncategorized_transaction_notification: RemindersPayload | null;
40
42
  month_end_email_recipient_email_ids?: string[];
41
43
  task_checklist_preferences?: NotificationPreferencesPayload;
@@ -8,6 +8,7 @@ const settingsViewState_1 = require("./settingsViewState");
8
8
  const initialNotificationSettingsData = {
9
9
  reminderNotificationSettings: {
10
10
  missingReceiptNotification: null,
11
+ pendingTaskNotification: null,
11
12
  uncategorizedTransactionNotification: null,
12
13
  pendingBillApprovalNotification: null,
13
14
  pendingReimbursementApprovalNotification: null,
@@ -48,6 +49,7 @@ const initialNotificationSettingsLocalData = {
48
49
  missingReceiptNotification: initialRemindersLocalData,
49
50
  pendingBillApprovalNotification: initialRemindersLocalData,
50
51
  pendingReimbursementApprovalNotification: initialRemindersLocalData,
52
+ pendingTaskNotification: initialRemindersLocalData,
51
53
  uncategorizedTransactionNotification: initialRemindersLocalData,
52
54
  },
53
55
  };
@@ -377,7 +379,7 @@ function toRemindersLocalData(reminderNotificationSettingDetails) {
377
379
  }
378
380
  const toNotificationSettingsLocalData = (data, loggedInUserEmail) => {
379
381
  const { monthEndInsightsNotificationSettings, reminderNotificationSettings } = data;
380
- const { missingReceiptNotification, pendingBillApprovalNotification, pendingReimbursementApprovalNotification, uncategorizedTransactionNotification, } = reminderNotificationSettings;
382
+ const { missingReceiptNotification, pendingBillApprovalNotification, pendingReimbursementApprovalNotification, pendingTaskNotification, uncategorizedTransactionNotification, } = reminderNotificationSettings;
381
383
  return {
382
384
  monthEndInsights: {
383
385
  notify: monthEndInsightsNotificationSettings.enabled ??
@@ -388,10 +390,22 @@ const toNotificationSettingsLocalData = (data, loggedInUserEmail) => {
388
390
  missingReceiptNotification: toRemindersLocalData(missingReceiptNotification),
389
391
  pendingBillApprovalNotification: toRemindersLocalData(pendingBillApprovalNotification),
390
392
  pendingReimbursementApprovalNotification: toRemindersLocalData(pendingReimbursementApprovalNotification),
393
+ pendingTaskNotification: toRemindersLocalData(pendingTaskNotification),
391
394
  uncategorizedTransactionNotification: toRemindersLocalData(uncategorizedTransactionNotification),
392
395
  },
393
396
  };
394
397
  };
398
+ function toPendingTaskNotificationActive(data) {
399
+ if (data.is_pending_task_notification_active != null) {
400
+ return data.is_pending_task_notification_active;
401
+ }
402
+ // Rows saved before this flag existed store null. It shares the
403
+ // transactions-reminder scope with missing receipts and uncategorized
404
+ // transactions, so a set sibling means the user has access.
405
+ const hasTransactionReminderAccess = data.is_missing_receipt_notification_active != null ||
406
+ data.is_uncategorized_transaction_notification_active != null;
407
+ return hasTransactionReminderAccess ? false : null;
408
+ }
395
409
  function toReminderNotificationSettingsDetails(isNotificationActive, remindersPayload) {
396
410
  if (isNotificationActive != null) {
397
411
  return {
@@ -412,6 +426,7 @@ const toNotificationSettings = (data) => {
412
426
  missingReceiptNotification: toReminderNotificationSettingsDetails(data.is_missing_receipt_notification_active, data.missing_receipt_notification),
413
427
  pendingBillApprovalNotification: toReminderNotificationSettingsDetails(data.is_pending_bill_approval_notification_active, data.pending_bill_approval_notification),
414
428
  pendingReimbursementApprovalNotification: toReminderNotificationSettingsDetails(data.is_pending_reimbursement_approval_notification_active, data.pending_reimbursement_approval_notification),
429
+ pendingTaskNotification: toReminderNotificationSettingsDetails(toPendingTaskNotificationActive(data), data.pending_task_notification),
415
430
  uncategorizedTransactionNotification: toReminderNotificationSettingsDetails(data.is_uncategorized_transaction_notification_active, data.uncategorized_transaction_notification),
416
431
  },
417
432
  monthEndInsightsNotificationSettings: {
@@ -9,8 +9,8 @@ interface BillingAddress extends FetchStateAndError {
9
9
  export interface IntegrationsSettings {
10
10
  refreshQBO: FetchStateAndError;
11
11
  }
12
- export declare const REMINDER_NOTIFICATION_TYPES: readonly ["missingReceiptNotification", "uncategorizedTransactionNotification", "pendingBillApprovalNotification", "pendingReimbursementApprovalNotification"];
13
- declare const toReminderTypeKey: (v: string) => "missingReceiptNotification" | "uncategorizedTransactionNotification" | "pendingBillApprovalNotification" | "pendingReimbursementApprovalNotification";
12
+ export declare const REMINDER_NOTIFICATION_TYPES: readonly ["missingReceiptNotification", "pendingTaskNotification", "uncategorizedTransactionNotification", "pendingBillApprovalNotification", "pendingReimbursementApprovalNotification"];
13
+ declare const toReminderTypeKey: (v: string) => "missingReceiptNotification" | "pendingTaskNotification" | "uncategorizedTransactionNotification" | "pendingBillApprovalNotification" | "pendingReimbursementApprovalNotification";
14
14
  export type ReminderTypeKey = ReturnType<typeof toReminderTypeKey>;
15
15
  export declare const toRemindersFrequencyType: (v: string) => "weekly" | "monthly" | "daily" | "bi-weekly";
16
16
  export type FrequencyTypeKey = ReturnType<typeof toRemindersFrequencyType>;
@@ -4,6 +4,7 @@ exports.toNotificationMode = exports.NOTIFICATION_MODES = exports.toRemindersFre
4
4
  const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
5
5
  exports.REMINDER_NOTIFICATION_TYPES = [
6
6
  'missingReceiptNotification',
7
+ 'pendingTaskNotification',
7
8
  'uncategorizedTransactionNotification',
8
9
  'pendingBillApprovalNotification',
9
10
  'pendingReimbursementApprovalNotification',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.2.87",
3
+ "version": "5.2.88",
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",