@dereekb/firebase 12.3.11 → 12.3.12

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/index.cjs.js CHANGED
@@ -9529,6 +9529,8 @@ function notificationMessageFunction(fn, extras) {
9529
9529
  if (extras) {
9530
9530
  const fnWithExtras = fn;
9531
9531
  fnWithExtras.globalRecipients = extras.globalRecipients;
9532
+ fnWithExtras.onSendAttempted = extras.onSendAttempted;
9533
+ fnWithExtras.onSendSuccess = extras.onSendSuccess;
9532
9534
  return fnWithExtras;
9533
9535
  } else {
9534
9536
  return fn;
package/index.esm.js CHANGED
@@ -9527,6 +9527,8 @@ function notificationMessageFunction(fn, extras) {
9527
9527
  if (extras) {
9528
9528
  const fnWithExtras = fn;
9529
9529
  fnWithExtras.globalRecipients = extras.globalRecipients;
9530
+ fnWithExtras.onSendAttempted = extras.onSendAttempted;
9531
+ fnWithExtras.onSendSuccess = extras.onSendSuccess;
9530
9532
  return fnWithExtras;
9531
9533
  } else {
9532
9534
  return fn;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/firebase",
3
- "version": "12.3.11",
3
+ "version": "12.3.12",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./src/index.d.ts",
@@ -258,6 +258,16 @@ export declare abstract class AbstractSubscribeOrUnsubscribeToNotificationBoxPar
258
258
  */
259
259
  unsubscribe?: Maybe<boolean>;
260
260
  }
261
+ export interface SendNotificationResultOnSendCompleteResult<T = unknown> {
262
+ /**
263
+ * Value, if returned by the onSendSuccess callback.
264
+ */
265
+ readonly value?: T;
266
+ /**
267
+ * Error value if the onSendSuccess callback throws an error.
268
+ */
269
+ readonly error?: Maybe<unknown>;
270
+ }
261
271
  export interface SendNotificationResult {
262
272
  /**
263
273
  * Attempted notification type
@@ -348,6 +358,14 @@ export interface SendNotificationResult {
348
358
  * Failed while attempting to build a message
349
359
  */
350
360
  readonly buildMessageFailure: boolean;
361
+ /**
362
+ * Result of the onSendAttempted callback, if called.
363
+ */
364
+ readonly onSendAttemptedResult?: Maybe<SendNotificationResultOnSendCompleteResult>;
365
+ /**
366
+ * Result of the onSendSuccess callback, if called.
367
+ */
368
+ readonly onSendSuccessResult?: Maybe<SendNotificationResultOnSendCompleteResult>;
351
369
  }
352
370
  /**
353
371
  * Used for sending queued notifications in the system.
@@ -1,8 +1,9 @@
1
1
  import { type Maybe, type WebsiteUrl } from '@dereekb/util';
2
2
  import { type NotificationRecipient, type NotificationRecipientWithConfig } from './notification.config';
3
- import { type Notification, type NotificationBox } from './notification';
3
+ import { NotificationSendFlags, type Notification, type NotificationBox } from './notification';
4
4
  import { type NotificationItem, type NotificationItemMetadata } from './notification.item';
5
5
  import { type DocumentDataWithIdAndKey } from '../../common';
6
+ import { NotificationSendEmailMessagesResult, NotificationSendTextMessagesResult, NotificationSendNotificationSummaryMessagesResult } from './notification.send';
6
7
  /**
7
8
  * Contextual information when
8
9
  */
@@ -130,11 +131,27 @@ export interface NotificationMessageFunctionFactoryConfig<D extends Notification
130
131
  * Creates a NotificationMessageFunction from the input config.
131
132
  */
132
133
  export type NotificationMessageFunctionFactory<D extends NotificationItemMetadata = {}> = (config: NotificationMessageFunctionFactoryConfig<D>) => Promise<NotificationMessageFunction>;
134
+ export interface NotificationMessageFunctionExtrasCallbackDetails {
135
+ readonly success: boolean;
136
+ readonly updatedSendFlags: NotificationSendFlags;
137
+ readonly sendEmailsResult?: Maybe<NotificationSendEmailMessagesResult>;
138
+ readonly sendTextsResult?: Maybe<NotificationSendTextMessagesResult>;
139
+ readonly sendNotificationSummaryResult?: Maybe<NotificationSendNotificationSummaryMessagesResult>;
140
+ }
141
+ export type NotificationMessageFunctionExtrasCallbackFunction = (callbackDetails: NotificationMessageFunctionExtrasCallbackDetails) => Promise<unknown>;
133
142
  export interface NotificationMessageFunctionExtras {
134
143
  /**
135
144
  * Any global/additional recipient(s) that should be added to all Notifications associated with this NotificationMessageFunctionExtras.
136
145
  */
137
146
  readonly globalRecipients?: Maybe<NotificationRecipientWithConfig[]>;
147
+ /**
148
+ * Called each time the notification attempts to send something.
149
+ */
150
+ readonly onSendAttempted?: NotificationMessageFunctionExtrasCallbackFunction;
151
+ /**
152
+ * Called when the notification has is marked as done after sending to all recipients.
153
+ */
154
+ readonly onSendSuccess?: NotificationMessageFunctionExtrasCallbackFunction;
138
155
  }
139
156
  export type NotificationMessageFunctionWithoutExtras = (inputContext: NotificationMessageInputContext) => Promise<NotificationMessage>;
140
157
  /**
package/test/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [12.3.12](https://github.com/dereekb/dbx-components/compare/v12.3.11-dev...v12.3.12) (2025-08-20)
6
+
7
+
8
+
5
9
  ## [12.3.11](https://github.com/dereekb/dbx-components/compare/v12.3.10-dev...v12.3.11) (2025-08-19)
6
10
 
7
11
 
package/test/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/firebase/test",
3
- "version": "12.3.11",
3
+ "version": "12.3.12",
4
4
  "type": "commonjs",
5
5
  "peerDependencies": {
6
6
  "@dereekb/util": "*",