@dereekb/firebase 11.1.1 → 11.1.2

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
@@ -9073,6 +9073,12 @@ const notificationConverter = snapshotConverterFunctions({
9073
9073
  r: firestoreObjectArray({
9074
9074
  objectField: firestoreNotificationRecipientWithConfig
9075
9075
  }),
9076
+ ois: optionalFirestoreBoolean({
9077
+ dontStoreIf: false
9078
+ }),
9079
+ ots: optionalFirestoreBoolean({
9080
+ dontStoreIf: true
9081
+ }),
9076
9082
  sat: firestoreDate(),
9077
9083
  a: firestoreNumber({
9078
9084
  default: 0
@@ -9826,7 +9832,7 @@ function createNotificationDocumentPair(input) {
9826
9832
  }
9827
9833
 
9828
9834
  /**
9829
- * Creates a NotificationTemplateTypeInfoRecord from the input details array.
9835
+ * Creates a NotificationTemplateTypeInfoRecord from the input info array.
9830
9836
  *
9831
9837
  * @param infoArray
9832
9838
  * @returns
@@ -9851,19 +9857,19 @@ function appNotificationTemplateTypeInfoRecordService(appNotificationTemplateTyp
9851
9857
  const targetModelTypeInfoMapBuilder = util.multiValueMapBuilder();
9852
9858
  const allKnownTemplateTypes = [];
9853
9859
  const allKnownTemplateTypeInfo = [];
9854
- Object.entries(appNotificationTemplateTypeInfoRecord).forEach(([_, details]) => {
9860
+ Object.entries(appNotificationTemplateTypeInfoRecord).forEach(([_, info]) => {
9855
9861
  const {
9856
9862
  notificationModelIdentity,
9857
9863
  targetModelIdentity,
9858
9864
  alternativeModelIdentities
9859
- } = details;
9865
+ } = info;
9860
9866
  function addInfoForIdentity(modelIdentity, targetIdentity) {
9861
9867
  var _targetIdentity$colle;
9862
9868
  const {
9863
9869
  collectionType
9864
9870
  } = modelIdentity;
9865
- notificationModelTypeInfoMapBuilder.add(collectionType, details);
9866
- targetModelTypeInfoMapBuilder.add((_targetIdentity$colle = targetIdentity == null ? void 0 : targetIdentity.collectionType) != null ? _targetIdentity$colle : collectionType, details);
9871
+ notificationModelTypeInfoMapBuilder.add(collectionType, info);
9872
+ targetModelTypeInfoMapBuilder.add((_targetIdentity$colle = targetIdentity == null ? void 0 : targetIdentity.collectionType) != null ? _targetIdentity$colle : collectionType, info);
9867
9873
  allNotificationModelIdentityValuesSet.add(modelIdentity);
9868
9874
  }
9869
9875
  addInfoForIdentity(notificationModelIdentity, targetModelIdentity);
@@ -9873,8 +9879,8 @@ function appNotificationTemplateTypeInfoRecordService(appNotificationTemplateTyp
9873
9879
  addInfoForIdentity(x.altNotificationModelIdentity, (_x$altTargetModelIden = x.altTargetModelIdentity) != null ? _x$altTargetModelIden : targetModelIdentity);
9874
9880
  });
9875
9881
  }
9876
- allKnownTemplateTypeInfo.push(details);
9877
- allKnownTemplateTypes.push(details.type);
9882
+ allKnownTemplateTypeInfo.push(info);
9883
+ allKnownTemplateTypes.push(info.type);
9878
9884
  });
9879
9885
  const allNotificationModelIdentityValues = Array.from(allNotificationModelIdentityValuesSet);
9880
9886
  const notificationModelTemplateInfoMap = notificationModelTypeInfoMapBuilder.map();
package/index.esm.js CHANGED
@@ -9902,6 +9902,12 @@ const notificationConverter = snapshotConverterFunctions({
9902
9902
  r: firestoreObjectArray({
9903
9903
  objectField: firestoreNotificationRecipientWithConfig
9904
9904
  }),
9905
+ ois: optionalFirestoreBoolean({
9906
+ dontStoreIf: false
9907
+ }),
9908
+ ots: optionalFirestoreBoolean({
9909
+ dontStoreIf: true
9910
+ }),
9905
9911
  sat: firestoreDate(),
9906
9912
  a: firestoreNumber({
9907
9913
  default: 0
@@ -10890,7 +10896,7 @@ async function createNotificationDocumentIfSending(input) {
10890
10896
  */
10891
10897
 
10892
10898
  /**
10893
- * Creates a NotificationTemplateTypeInfoRecord from the input details array.
10899
+ * Creates a NotificationTemplateTypeInfoRecord from the input info array.
10894
10900
  *
10895
10901
  * @param infoArray
10896
10902
  * @returns
@@ -10966,19 +10972,19 @@ function appNotificationTemplateTypeInfoRecordService(appNotificationTemplateTyp
10966
10972
  const targetModelTypeInfoMapBuilder = multiValueMapBuilder();
10967
10973
  const allKnownTemplateTypes = [];
10968
10974
  const allKnownTemplateTypeInfo = [];
10969
- Object.entries(appNotificationTemplateTypeInfoRecord).forEach(([_, details]) => {
10975
+ Object.entries(appNotificationTemplateTypeInfoRecord).forEach(([_, info]) => {
10970
10976
  const {
10971
10977
  notificationModelIdentity,
10972
10978
  targetModelIdentity,
10973
10979
  alternativeModelIdentities
10974
- } = details;
10980
+ } = info;
10975
10981
  function addInfoForIdentity(modelIdentity, targetIdentity) {
10976
10982
  var _targetIdentity$colle;
10977
10983
  const {
10978
10984
  collectionType
10979
10985
  } = modelIdentity;
10980
- notificationModelTypeInfoMapBuilder.add(collectionType, details);
10981
- targetModelTypeInfoMapBuilder.add((_targetIdentity$colle = targetIdentity == null ? void 0 : targetIdentity.collectionType) != null ? _targetIdentity$colle : collectionType, details);
10986
+ notificationModelTypeInfoMapBuilder.add(collectionType, info);
10987
+ targetModelTypeInfoMapBuilder.add((_targetIdentity$colle = targetIdentity == null ? void 0 : targetIdentity.collectionType) != null ? _targetIdentity$colle : collectionType, info);
10982
10988
  allNotificationModelIdentityValuesSet.add(modelIdentity);
10983
10989
  }
10984
10990
  addInfoForIdentity(notificationModelIdentity, targetModelIdentity);
@@ -10988,8 +10994,8 @@ function appNotificationTemplateTypeInfoRecordService(appNotificationTemplateTyp
10988
10994
  addInfoForIdentity(x.altNotificationModelIdentity, (_x$altTargetModelIden = x.altTargetModelIdentity) != null ? _x$altTargetModelIden : targetModelIdentity);
10989
10995
  });
10990
10996
  }
10991
- allKnownTemplateTypeInfo.push(details);
10992
- allKnownTemplateTypes.push(details.type);
10997
+ allKnownTemplateTypeInfo.push(info);
10998
+ allKnownTemplateTypes.push(info.type);
10993
10999
  });
10994
11000
  const allNotificationModelIdentityValues = Array.from(allNotificationModelIdentityValuesSet);
10995
11001
  const notificationModelTemplateInfoMap = notificationModelTypeInfoMapBuilder.map();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/firebase",
3
- "version": "11.1.1",
3
+ "version": "11.1.2",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./src/index.d.ts",
@@ -4,7 +4,7 @@ import { type NotificationBoxId } from './notification.id';
4
4
  import { type NotificationBoxRecipient, type NotificationRecipientWithConfig, type NotificationUserNotificationBoxRecipientConfig, type NotificationUserDefaultNotificationBoxRecipientConfig } from './notification.config';
5
5
  import { type YearWeekCode } from '@dereekb/date';
6
6
  import { type UserRelatedById, type UserRelated } from '../user';
7
- import { AbstractFirestoreDocument, AbstractFirestoreDocumentWithParent, type CollectionGroup, type CollectionReference, type FirestoreCollection, type FirestoreCollectionGroup, type FirestoreCollectionWithParent, type FirestoreContext, type FirestoreModelKey, type SavedToFirestoreIfTrue } from '../../common';
7
+ import { AbstractFirestoreDocument, AbstractFirestoreDocumentWithParent, type CollectionGroup, type CollectionReference, type FirestoreCollection, type FirestoreCollectionGroup, type FirestoreCollectionWithParent, type FirestoreContext, type FirestoreModelKey, type SavedToFirestoreIfTrue, type SavedToFirestoreIfFalse } from '../../common';
8
8
  import { type NotificationItem } from './notification.item';
9
9
  export declare abstract class NotificationFirestoreCollections {
10
10
  abstract readonly notificationUserCollection: NotificationUserFirestoreCollection;
@@ -340,8 +340,28 @@ export interface Notification extends NotificationSendFlags, NotificationSendChe
340
340
  n: NotificationItem;
341
341
  /**
342
342
  * Additional embedded recipients.
343
+ *
344
+ * Any values for the NotificationBoxRecipientTemplateConfig-related parameters will be used when considering explicit opt-in/op-out.
345
+ * (I.E. setting "st" to true for a user with no other config for the notification template type will mark them as opt-in for texts, and
346
+ * can only be overridden by the user's own config)
343
347
  */
344
348
  r: NotificationRecipientWithConfig[];
349
+ /**
350
+ * Explicit opt-in send only.
351
+ *
352
+ * If true, will only send to users that have explicitly opted in to recieving notifications via specific methods.
353
+ *
354
+ * This setting takes priority over the system's configured default for this notification's template type.
355
+ */
356
+ ois?: Maybe<SavedToFirestoreIfTrue>;
357
+ /**
358
+ * Explicit opt-in text/sms send only.
359
+ *
360
+ * If false, will send text/sms to all users regardless if they have not explicitly opted in to text/sms. Will still take their opt-out into account.
361
+ *
362
+ * This setting takes priority over the system's configured default for this notification's template type.
363
+ */
364
+ ots?: Maybe<SavedToFirestoreIfFalse>;
345
365
  /**
346
366
  * Minimum time at which this notification should be sent.
347
367
  *
@@ -67,13 +67,21 @@ export interface NotificationTemplateTypeInfo extends NotificationTemplateTypeIn
67
67
  * Description of the notification's content.
68
68
  */
69
69
  readonly description: string;
70
+ /**
71
+ * If true, this notification will only be sent to recipients that explicitly enable recieving via respective NotificationBoxRecipientTemplateConfig for this type.
72
+ */
73
+ readonly onlySendToExplicitlyEnabledRecipients?: boolean;
74
+ /**
75
+ * If false, this notification will send sms/texts to all recipients, even if they have not explicitly opted in to recieving sms/texts.
76
+ */
77
+ readonly onlyTextExplicitlyEnabledRecipients?: boolean;
70
78
  }
71
79
  /**
72
80
  * Record of NotificationTemplateTypeInfo keyed by type.
73
81
  */
74
82
  export type NotificationTemplateTypeInfoRecord = Record<NotificationTemplateType, NotificationTemplateTypeInfo>;
75
83
  /**
76
- * Creates a NotificationTemplateTypeInfoRecord from the input details array.
84
+ * Creates a NotificationTemplateTypeInfoRecord from the input info array.
77
85
  *
78
86
  * @param infoArray
79
87
  * @returns
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
+ ## [11.1.2](https://github.com/dereekb/dbx-components/compare/v11.1.1-dev...v11.1.2) (2025-03-04)
6
+
7
+
8
+
5
9
  ## [11.1.1](https://github.com/dereekb/dbx-components/compare/v11.1.0-dev...v11.1.1) (2025-03-03)
6
10
 
7
11
 
package/test/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/firebase/test",
3
- "version": "11.1.1",
3
+ "version": "11.1.2",
4
4
  "type": "commonjs",
5
5
  "peerDependencies": {
6
6
  "@dereekb/util": "*",