@timardex/cluemart-server-shared 1.0.291 → 1.0.293

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/dist/index.cjs CHANGED
@@ -3710,6 +3710,12 @@ var EnumGameType = /* @__PURE__ */ ((EnumGameType2) => {
3710
3710
  EnumGameType2["ODD_ONE_OUT"] = "oddOneOut";
3711
3711
  return EnumGameType2;
3712
3712
  })(EnumGameType || {});
3713
+ var EnumAffiliateParticipantType = /* @__PURE__ */ ((EnumAffiliateParticipantType2) => {
3714
+ EnumAffiliateParticipantType2["INDIVIDUAL"] = "INDIVIDUAL";
3715
+ EnumAffiliateParticipantType2["SOLE_TRADER"] = "SOLE_TRADER";
3716
+ EnumAffiliateParticipantType2["COMPANY"] = "COMPANY";
3717
+ return EnumAffiliateParticipantType2;
3718
+ })(EnumAffiliateParticipantType || {});
3713
3719
  var EnumAffiliateRewardType = /* @__PURE__ */ ((EnumAffiliateRewardType22) => {
3714
3720
  EnumAffiliateRewardType22["ACTIVE_EVENT_WITH_VENDOR_REGISTRATIONS"] = "ACTIVE_EVENT_WITH_VENDOR_REGISTRATIONS";
3715
3721
  EnumAffiliateRewardType22["ACTIVE_VENDOR_BONUS_REWARD"] = "ACTIVE_VENDOR_BONUS_REWARD";
@@ -7568,6 +7574,14 @@ var AFFILIATE_DETAILS_FIELDS_FRAGMENT = gql`
7568
7574
  contactDetails {
7569
7575
  mobilePhone
7570
7576
  }
7577
+ irdNumber
7578
+ participantType
7579
+ email
7580
+ firstName
7581
+ lastName
7582
+ location {
7583
+ ...LocationFields
7584
+ }
7571
7585
  region
7572
7586
  socialMedia {
7573
7587
  ...SocialMediaFields
@@ -7577,6 +7591,7 @@ var AFFILIATE_DETAILS_FIELDS_FRAGMENT = gql`
7577
7591
  }
7578
7592
  }
7579
7593
  ${AFFILIATE_BANK_ACCOUNT_DETAILS_FIELDS_FRAGMENT}
7594
+ ${LOCATION_FIELDS_FRAGMENT}
7580
7595
  ${SOCIAL_MEDIA_FIELDS_FRAGMENT}
7581
7596
  ${TERMS_AGREEMENT_FIELDS_FRAGMENT}
7582
7597
  `;
@@ -7642,6 +7657,14 @@ var DELETE_AFFILIATE_MUTATION = gql`
7642
7657
  deleteAffiliate(_id: $_id)
7643
7658
  }
7644
7659
  `;
7660
+ var REDEEM_AFFILIATE_REWARD_MUTATION = gql`
7661
+ mutation redeemAffiliateReward($affiliateId: ID!) {
7662
+ redeemAffiliateReward(affiliateId: $affiliateId) {
7663
+ ...AffiliateFields
7664
+ }
7665
+ }
7666
+ ${AFFILIATE_FIELDS_FRAGMENT}
7667
+ `;
7645
7668
  var PKG = "@timardex/cluemart-shared";
7646
7669
  var IMAGE_EXTENSION = ".webp";
7647
7670
  var posterIds = [
@@ -9377,6 +9400,16 @@ var affiliateDetailsSchema = new MongooseSchema25(
9377
9400
  type: affiliateBankAccountDetailsSchema
9378
9401
  },
9379
9402
  contactDetails: { required: true, type: affiliateContactDetailsSchema },
9403
+ email: { required: true, type: String },
9404
+ firstName: { required: true, type: String },
9405
+ irdNumber: { required: true, type: String },
9406
+ lastName: { required: true, type: String },
9407
+ location: { required: true, type: locationsSchema },
9408
+ participantType: {
9409
+ enum: Object.values(EnumAffiliateParticipantType),
9410
+ required: true,
9411
+ type: String
9412
+ },
9380
9413
  region: { required: true, type: String },
9381
9414
  socialMedia: { required: false, type: [SocialMediaTypeSchema] },
9382
9415
  termsAgreement: { required: true, type: termsAgreementSchema }
@@ -9904,14 +9937,16 @@ async function notifyUsers({
9904
9937
  try {
9905
9938
  await sendPushNotifications(payload);
9906
9939
  const uniqueUserIds = await saveNotificationsInDb(payload);
9907
- if (!pubsub) {
9908
- return;
9909
- }
9910
- for (const userId of uniqueUserIds) {
9911
- await publishNotificationEvents(userId, pubsub);
9940
+ const persisted = payload.userIds.length === 0 || uniqueUserIds.length > 0;
9941
+ if (pubsub) {
9942
+ for (const userId of uniqueUserIds) {
9943
+ await publishNotificationEvents(userId, pubsub);
9944
+ }
9912
9945
  }
9946
+ return persisted;
9913
9947
  } catch (error) {
9914
9948
  console.error("Error in notifyUsers:", error);
9949
+ return false;
9915
9950
  }
9916
9951
  }
9917
9952