@timardex/cluemart-server-shared 1.1.19 → 1.1.21
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/{chunk-XOFBUTNJ.mjs → chunk-3JRVRK2N.mjs} +155 -110
- package/dist/chunk-3JRVRK2N.mjs.map +1 -0
- package/dist/index.cjs +164 -128
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +164 -128
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +154 -109
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.mjs +1 -1
- package/dist/service/index.cjs +164 -128
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.d.mts +2 -2
- package/dist/service/index.d.ts +2 -2
- package/dist/service/index.mjs +11 -20
- package/dist/service/index.mjs.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-XOFBUTNJ.mjs.map +0 -1
package/dist/index.d.mts
CHANGED
|
@@ -817,8 +817,8 @@ type AwardAffiliateVendorSubscriptionRewardsResult = {
|
|
|
817
817
|
* Eligibility per affiliate resource:
|
|
818
818
|
* - Affiliate is not soft-deleted
|
|
819
819
|
* - Linked `affiliateResources` entry is vendor, `resourceActive`, and not deleted
|
|
820
|
-
* - Vendor is active, not deleted,
|
|
821
|
-
* `
|
|
820
|
+
* - Vendor is active, not deleted, and `owner.userId` matches
|
|
821
|
+
* `affiliateResources.resourceOwner.userId`
|
|
822
822
|
* - `affiliateResources.resourceOwner` has a non-expired Standard / Pro / Pro+ vendor licence
|
|
823
823
|
*
|
|
824
824
|
* Reward type follows the owner's highest valid licence + Stripe paying status:
|
package/dist/index.d.ts
CHANGED
|
@@ -817,8 +817,8 @@ type AwardAffiliateVendorSubscriptionRewardsResult = {
|
|
|
817
817
|
* Eligibility per affiliate resource:
|
|
818
818
|
* - Affiliate is not soft-deleted
|
|
819
819
|
* - Linked `affiliateResources` entry is vendor, `resourceActive`, and not deleted
|
|
820
|
-
* - Vendor is active, not deleted,
|
|
821
|
-
* `
|
|
820
|
+
* - Vendor is active, not deleted, and `owner.userId` matches
|
|
821
|
+
* `affiliateResources.resourceOwner.userId`
|
|
822
822
|
* - `affiliateResources.resourceOwner` has a non-expired Standard / Pro / Pro+ vendor licence
|
|
823
823
|
*
|
|
824
824
|
* Reward type follows the owner's highest valid licence + Stripe paying status:
|
package/dist/index.mjs
CHANGED
|
@@ -4924,6 +4924,12 @@ var OWNER_FIELDS_FRAGMENT = gql`
|
|
|
4924
4924
|
userId
|
|
4925
4925
|
}
|
|
4926
4926
|
`;
|
|
4927
|
+
var PRODUCT_COUPON_FIELDS_FRAGMENT = gql`
|
|
4928
|
+
fragment ProductCouponFields on ProductCouponType {
|
|
4929
|
+
couponDocumentId
|
|
4930
|
+
couponId
|
|
4931
|
+
}
|
|
4932
|
+
`;
|
|
4927
4933
|
var CATEGORY_FIELDS_FRAGMENT = gql`
|
|
4928
4934
|
fragment CategoryFields on CategoryType {
|
|
4929
4935
|
id
|
|
@@ -5397,109 +5403,6 @@ var GET_EVENT_INFO = gql`
|
|
|
5397
5403
|
}
|
|
5398
5404
|
${EVENT_INFO}
|
|
5399
5405
|
`;
|
|
5400
|
-
var PRODUCT_COUPON_FIELDS_FRAGMENT = gql`
|
|
5401
|
-
fragment ProductCouponFields on ProductCouponType {
|
|
5402
|
-
couponDocumentId
|
|
5403
|
-
couponId
|
|
5404
|
-
}
|
|
5405
|
-
`;
|
|
5406
|
-
var COUPON_CODE_FIELDS_FRAGMENT = gql`
|
|
5407
|
-
fragment CouponCodeFields on CouponCodeType {
|
|
5408
|
-
code
|
|
5409
|
-
qrCode {
|
|
5410
|
-
...ResourceImageFields
|
|
5411
|
-
}
|
|
5412
|
-
}
|
|
5413
|
-
${RESOURCE_IMAGE_FIELDS_FRAGMENT}
|
|
5414
|
-
`;
|
|
5415
|
-
var COUPON_PARTICIPANT_USER_FIELDS_FRAGMENT = gql`
|
|
5416
|
-
fragment CouponParticipantUserFields on CouponParticipantUserType {
|
|
5417
|
-
couponCollectedCount
|
|
5418
|
-
couponRedeemedAt
|
|
5419
|
-
createdAt
|
|
5420
|
-
updatedAt
|
|
5421
|
-
userId
|
|
5422
|
-
}
|
|
5423
|
-
`;
|
|
5424
|
-
var COUPON_OPTION_FIELDS_FRAGMENT = gql`
|
|
5425
|
-
fragment CouponOptionFields on CouponOptionType {
|
|
5426
|
-
type
|
|
5427
|
-
buy
|
|
5428
|
-
get
|
|
5429
|
-
unit
|
|
5430
|
-
visits
|
|
5431
|
-
}
|
|
5432
|
-
`;
|
|
5433
|
-
var COUPON_REWARD_FIELDS_FRAGMENT = gql`
|
|
5434
|
-
fragment CouponRewardFields on CouponRewardType {
|
|
5435
|
-
vendorId
|
|
5436
|
-
productId
|
|
5437
|
-
quantity
|
|
5438
|
-
unit
|
|
5439
|
-
}
|
|
5440
|
-
`;
|
|
5441
|
-
var COUPON_DATA_FIELDS_FRAGMENT = gql`
|
|
5442
|
-
fragment CouponDataFields on CouponDataType {
|
|
5443
|
-
_id
|
|
5444
|
-
active
|
|
5445
|
-
couponCode {
|
|
5446
|
-
...CouponCodeFields
|
|
5447
|
-
}
|
|
5448
|
-
couponDescription
|
|
5449
|
-
couponOption {
|
|
5450
|
-
...CouponOptionFields
|
|
5451
|
-
}
|
|
5452
|
-
couponRewards {
|
|
5453
|
-
...CouponRewardFields
|
|
5454
|
-
}
|
|
5455
|
-
createdAt
|
|
5456
|
-
endDate
|
|
5457
|
-
participantUsers {
|
|
5458
|
-
...CouponParticipantUserFields
|
|
5459
|
-
}
|
|
5460
|
-
resourceId
|
|
5461
|
-
resourceType
|
|
5462
|
-
startDate
|
|
5463
|
-
updatedAt
|
|
5464
|
-
}
|
|
5465
|
-
${COUPON_CODE_FIELDS_FRAGMENT}
|
|
5466
|
-
${COUPON_OPTION_FIELDS_FRAGMENT}
|
|
5467
|
-
${COUPON_PARTICIPANT_USER_FIELDS_FRAGMENT}
|
|
5468
|
-
${COUPON_REWARD_FIELDS_FRAGMENT}
|
|
5469
|
-
`;
|
|
5470
|
-
var COUPON = gql`
|
|
5471
|
-
fragment CouponFields on CouponType {
|
|
5472
|
-
_id
|
|
5473
|
-
active
|
|
5474
|
-
couponData {
|
|
5475
|
-
...CouponDataFields
|
|
5476
|
-
}
|
|
5477
|
-
createdAt
|
|
5478
|
-
deletedAt
|
|
5479
|
-
owner {
|
|
5480
|
-
...OwnerFields
|
|
5481
|
-
}
|
|
5482
|
-
updatedAt
|
|
5483
|
-
}
|
|
5484
|
-
${OWNER_FIELDS_FRAGMENT}
|
|
5485
|
-
${COUPON_DATA_FIELDS_FRAGMENT}
|
|
5486
|
-
`;
|
|
5487
|
-
var GET_COUPONS = gql`
|
|
5488
|
-
query getCoupons {
|
|
5489
|
-
coupons {
|
|
5490
|
-
...CouponFields
|
|
5491
|
-
}
|
|
5492
|
-
}
|
|
5493
|
-
${COUPON}
|
|
5494
|
-
`;
|
|
5495
|
-
var GET_COUPON = gql`
|
|
5496
|
-
query getCoupon($_id: ID!) {
|
|
5497
|
-
coupon(_id: $_id) {
|
|
5498
|
-
...CouponFields
|
|
5499
|
-
}
|
|
5500
|
-
}
|
|
5501
|
-
${COUPON}
|
|
5502
|
-
`;
|
|
5503
5406
|
var VENDOR_DATETIME_FIELDS_FRAGMENT = gql`
|
|
5504
5407
|
fragment VendorDateTimeFields on VendorDateTimeType {
|
|
5505
5408
|
dateStatus
|
|
@@ -5526,6 +5429,15 @@ var VENDOR_PRODUCT_LIST_FIELDS_FRAGMENT = gql`
|
|
|
5526
5429
|
}
|
|
5527
5430
|
${PRODUCT_COUPON_FIELDS_FRAGMENT}
|
|
5528
5431
|
`;
|
|
5432
|
+
var VENDOR_PRODUCTS_FIELDS_FRAGMENT = gql`
|
|
5433
|
+
fragment VendorProductsFields on VendorProductsType {
|
|
5434
|
+
active
|
|
5435
|
+
productsList {
|
|
5436
|
+
...VendorProductListFields
|
|
5437
|
+
}
|
|
5438
|
+
}
|
|
5439
|
+
${VENDOR_PRODUCT_LIST_FIELDS_FRAGMENT}
|
|
5440
|
+
`;
|
|
5529
5441
|
var VENDOR = gql`
|
|
5530
5442
|
fragment VendorFields on VendorType {
|
|
5531
5443
|
_id
|
|
@@ -5575,10 +5487,7 @@ var VENDOR = gql`
|
|
|
5575
5487
|
...OwnerFields
|
|
5576
5488
|
}
|
|
5577
5489
|
products {
|
|
5578
|
-
|
|
5579
|
-
productsList {
|
|
5580
|
-
...VendorProductListFields
|
|
5581
|
-
}
|
|
5490
|
+
...VendorProductsFields
|
|
5582
5491
|
}
|
|
5583
5492
|
promoCodes
|
|
5584
5493
|
posterUsage {
|
|
@@ -5620,7 +5529,7 @@ var VENDOR = gql`
|
|
|
5620
5529
|
${RESOURCE_IMAGE_FIELDS_FRAGMENT}
|
|
5621
5530
|
${SOCIAL_MEDIA_FIELDS_FRAGMENT}
|
|
5622
5531
|
${POSTER_USAGE_FIELDS_FRAGMENT}
|
|
5623
|
-
${
|
|
5532
|
+
${VENDOR_PRODUCTS_FIELDS_FRAGMENT}
|
|
5624
5533
|
${CONTACT_DETAILS_FIELDS_FRAGMENT}
|
|
5625
5534
|
${TERMS_AGREEMENT_FIELDS_FRAGMENT}
|
|
5626
5535
|
${RELATION_DATES_FRAGMENT}
|
|
@@ -7826,6 +7735,141 @@ var ASSIGN_AFFILIATE_BONUS_REWARD_MUTATION = gql`
|
|
|
7826
7735
|
}
|
|
7827
7736
|
${AFFILIATE_FIELDS_FRAGMENT}
|
|
7828
7737
|
`;
|
|
7738
|
+
var COUPON_CODE_FIELDS_FRAGMENT = gql`
|
|
7739
|
+
fragment CouponCodeFields on CouponCodeType {
|
|
7740
|
+
code
|
|
7741
|
+
qrCode {
|
|
7742
|
+
...ResourceImageFields
|
|
7743
|
+
}
|
|
7744
|
+
shareableQrCode {
|
|
7745
|
+
...ResourceImageFields
|
|
7746
|
+
}
|
|
7747
|
+
}
|
|
7748
|
+
${RESOURCE_IMAGE_FIELDS_FRAGMENT}
|
|
7749
|
+
`;
|
|
7750
|
+
var COUPON_PARTICIPANT_USER_FIELDS_FRAGMENT = gql`
|
|
7751
|
+
fragment CouponParticipantUserFields on CouponParticipantUserType {
|
|
7752
|
+
couponCollectedCount
|
|
7753
|
+
couponRedeemedAt
|
|
7754
|
+
createdAt
|
|
7755
|
+
updatedAt
|
|
7756
|
+
userId
|
|
7757
|
+
}
|
|
7758
|
+
`;
|
|
7759
|
+
var COUPON_OPTION_FIELDS_FRAGMENT = gql`
|
|
7760
|
+
fragment CouponOptionFields on CouponOptionType {
|
|
7761
|
+
type
|
|
7762
|
+
buy
|
|
7763
|
+
get
|
|
7764
|
+
unit
|
|
7765
|
+
visits
|
|
7766
|
+
}
|
|
7767
|
+
`;
|
|
7768
|
+
var COUPON_REWARD_FIELDS_FRAGMENT = gql`
|
|
7769
|
+
fragment CouponRewardFields on CouponRewardType {
|
|
7770
|
+
vendorId
|
|
7771
|
+
productId
|
|
7772
|
+
quantity
|
|
7773
|
+
unit
|
|
7774
|
+
}
|
|
7775
|
+
`;
|
|
7776
|
+
var COUPON_DATA_PRODUCTS_FIELDS_FRAGMENT = gql`
|
|
7777
|
+
fragment CouponDataProductsFields on CouponDataProductsType {
|
|
7778
|
+
active
|
|
7779
|
+
productsList {
|
|
7780
|
+
...VendorProductListFields
|
|
7781
|
+
}
|
|
7782
|
+
vendorLogo {
|
|
7783
|
+
...ResourceImageFields
|
|
7784
|
+
}
|
|
7785
|
+
vendorName
|
|
7786
|
+
}
|
|
7787
|
+
${VENDOR_PRODUCT_LIST_FIELDS_FRAGMENT}
|
|
7788
|
+
${RESOURCE_IMAGE_FIELDS_FRAGMENT}
|
|
7789
|
+
`;
|
|
7790
|
+
var COUPON_DATA_FIELDS_FRAGMENT = gql`
|
|
7791
|
+
fragment CouponDataFields on CouponDataType {
|
|
7792
|
+
_id
|
|
7793
|
+
active
|
|
7794
|
+
couponCode {
|
|
7795
|
+
...CouponCodeFields
|
|
7796
|
+
}
|
|
7797
|
+
couponDescription
|
|
7798
|
+
couponOption {
|
|
7799
|
+
...CouponOptionFields
|
|
7800
|
+
}
|
|
7801
|
+
couponRewards {
|
|
7802
|
+
...CouponRewardFields
|
|
7803
|
+
}
|
|
7804
|
+
createdAt
|
|
7805
|
+
endDate
|
|
7806
|
+
participantUsers {
|
|
7807
|
+
...CouponParticipantUserFields
|
|
7808
|
+
}
|
|
7809
|
+
products {
|
|
7810
|
+
...CouponDataProductsFields
|
|
7811
|
+
}
|
|
7812
|
+
resourceId
|
|
7813
|
+
resourceType
|
|
7814
|
+
startDate
|
|
7815
|
+
updatedAt
|
|
7816
|
+
}
|
|
7817
|
+
${COUPON_CODE_FIELDS_FRAGMENT}
|
|
7818
|
+
${COUPON_OPTION_FIELDS_FRAGMENT}
|
|
7819
|
+
${COUPON_PARTICIPANT_USER_FIELDS_FRAGMENT}
|
|
7820
|
+
${COUPON_REWARD_FIELDS_FRAGMENT}
|
|
7821
|
+
${COUPON_DATA_PRODUCTS_FIELDS_FRAGMENT}
|
|
7822
|
+
`;
|
|
7823
|
+
var COUPON = gql`
|
|
7824
|
+
fragment CouponFields on CouponType {
|
|
7825
|
+
_id
|
|
7826
|
+
active
|
|
7827
|
+
couponData {
|
|
7828
|
+
...CouponDataFields
|
|
7829
|
+
}
|
|
7830
|
+
createdAt
|
|
7831
|
+
deletedAt
|
|
7832
|
+
owner {
|
|
7833
|
+
...OwnerFields
|
|
7834
|
+
}
|
|
7835
|
+
updatedAt
|
|
7836
|
+
}
|
|
7837
|
+
${OWNER_FIELDS_FRAGMENT}
|
|
7838
|
+
${COUPON_DATA_FIELDS_FRAGMENT}
|
|
7839
|
+
`;
|
|
7840
|
+
var GET_COUPONS = gql`
|
|
7841
|
+
query getCoupons {
|
|
7842
|
+
coupons {
|
|
7843
|
+
active {
|
|
7844
|
+
listName
|
|
7845
|
+
data {
|
|
7846
|
+
...CouponFields
|
|
7847
|
+
}
|
|
7848
|
+
}
|
|
7849
|
+
owned {
|
|
7850
|
+
listName
|
|
7851
|
+
data {
|
|
7852
|
+
...CouponFields
|
|
7853
|
+
}
|
|
7854
|
+
}
|
|
7855
|
+
scanned {
|
|
7856
|
+
listName
|
|
7857
|
+
data {
|
|
7858
|
+
...CouponFields
|
|
7859
|
+
}
|
|
7860
|
+
}
|
|
7861
|
+
}
|
|
7862
|
+
}
|
|
7863
|
+
${COUPON}
|
|
7864
|
+
`;
|
|
7865
|
+
var GET_COUPON = gql`
|
|
7866
|
+
query getCoupon($_id: ID!) {
|
|
7867
|
+
coupon(_id: $_id) {
|
|
7868
|
+
...CouponFields
|
|
7869
|
+
}
|
|
7870
|
+
}
|
|
7871
|
+
${COUPON}
|
|
7872
|
+
`;
|
|
7829
7873
|
var CREATE_COUPON_MUTATION = gql`
|
|
7830
7874
|
mutation createCoupon($input: CouponInputType!) {
|
|
7831
7875
|
createCoupon(input: $input) {
|
|
@@ -9055,7 +9099,8 @@ var couponRewardSchema = new MongooseSchema13(
|
|
|
9055
9099
|
var couponCodeSchema = new MongooseSchema13(
|
|
9056
9100
|
{
|
|
9057
9101
|
code: { required: true, type: String },
|
|
9058
|
-
qrCode: { required: true, type: ResourceImageTypeSchema }
|
|
9102
|
+
qrCode: { required: true, type: ResourceImageTypeSchema },
|
|
9103
|
+
shareableQrCode: { required: true, type: ResourceImageTypeSchema }
|
|
9059
9104
|
},
|
|
9060
9105
|
{ _id: false }
|
|
9061
9106
|
);
|
|
@@ -9874,7 +9919,7 @@ var SHARE_RESOURCE_LABEL2 = {
|
|
|
9874
9919
|
school: "School"
|
|
9875
9920
|
};
|
|
9876
9921
|
|
|
9877
|
-
// node_modules/@timardex/cluemart-shared/dist/chunk-
|
|
9922
|
+
// node_modules/@timardex/cluemart-shared/dist/chunk-Q3X2EHHF.mjs
|
|
9878
9923
|
var PROMO_CODE_PREFIX2 = "CM-";
|
|
9879
9924
|
var OBJECT_ID_PATH_SEGMENT2 = "[a-f0-9]{24}";
|
|
9880
9925
|
var OBJECT_ID_PATH_SEGMENT_END2 = `${OBJECT_ID_PATH_SEGMENT2}$`;
|
|
@@ -9976,7 +10021,7 @@ var gameScreenIdentifierList2 = [
|
|
|
9976
10021
|
}
|
|
9977
10022
|
];
|
|
9978
10023
|
|
|
9979
|
-
// node_modules/@timardex/cluemart-shared/dist/chunk-
|
|
10024
|
+
// node_modules/@timardex/cluemart-shared/dist/chunk-UGWEWOUM.mjs
|
|
9980
10025
|
import dayjs4 from "dayjs";
|
|
9981
10026
|
var statusOptions2 = [
|
|
9982
10027
|
...Object.values(EnumInviteStatus2).map((status) => ({
|
|
@@ -11020,12 +11065,6 @@ function createAffiliateReward(rewardType, createdAt) {
|
|
|
11020
11065
|
};
|
|
11021
11066
|
}
|
|
11022
11067
|
|
|
11023
|
-
// src/service/promoCode/normalizePromoCode.ts
|
|
11024
|
-
function normalizePromoCode(decoratedPromoCode) {
|
|
11025
|
-
const normalized = decoratedPromoCode?.trim().toUpperCase();
|
|
11026
|
-
return normalized || null;
|
|
11027
|
-
}
|
|
11028
|
-
|
|
11029
11068
|
// src/service/saveNotificationsInDb.ts
|
|
11030
11069
|
async function saveNotificationsInDb(payload) {
|
|
11031
11070
|
const { data, message, title, type, userIds } = payload;
|
|
@@ -11205,10 +11244,9 @@ async function findAffiliatesWithActiveVendorReferrals() {
|
|
|
11205
11244
|
}
|
|
11206
11245
|
},
|
|
11207
11246
|
deletedAt: null
|
|
11208
|
-
}).select("_id
|
|
11247
|
+
}).select("_id affiliateResources owner").lean().exec();
|
|
11209
11248
|
}
|
|
11210
11249
|
async function isEligibleReferredVendor({
|
|
11211
|
-
affiliateCode,
|
|
11212
11250
|
resourceId,
|
|
11213
11251
|
resourceOwnerUserId
|
|
11214
11252
|
}) {
|
|
@@ -11216,8 +11254,7 @@ async function isEligibleReferredVendor({
|
|
|
11216
11254
|
_id: resourceId,
|
|
11217
11255
|
active: true,
|
|
11218
11256
|
deletedAt: null,
|
|
11219
|
-
"owner.userId": resourceOwnerUserId
|
|
11220
|
-
promoCodes: affiliateCode
|
|
11257
|
+
"owner.userId": resourceOwnerUserId
|
|
11221
11258
|
}).exec();
|
|
11222
11259
|
return Boolean(match);
|
|
11223
11260
|
}
|
|
@@ -11306,14 +11343,12 @@ async function tryAwardSubscriptionReward({
|
|
|
11306
11343
|
}
|
|
11307
11344
|
async function processAffiliateVendorReferral({
|
|
11308
11345
|
affiliate,
|
|
11309
|
-
affiliateCode,
|
|
11310
11346
|
createdAt,
|
|
11311
11347
|
now,
|
|
11312
11348
|
period,
|
|
11313
11349
|
resource
|
|
11314
11350
|
}) {
|
|
11315
11351
|
const vendorEligible = await isEligibleReferredVendor({
|
|
11316
|
-
affiliateCode,
|
|
11317
11352
|
resourceId: resource.resourceId,
|
|
11318
11353
|
resourceOwnerUserId: resource.resourceOwner.userId
|
|
11319
11354
|
});
|
|
@@ -11343,10 +11378,6 @@ async function awardAffiliateVendorSubscriptionRewards(now = /* @__PURE__ */ new
|
|
|
11343
11378
|
let skipped = 0;
|
|
11344
11379
|
const seenPairs = /* @__PURE__ */ new Set();
|
|
11345
11380
|
for (const affiliate of affiliates) {
|
|
11346
|
-
const affiliateCode = normalizePromoCode(affiliate.affiliateCode);
|
|
11347
|
-
if (!affiliateCode) {
|
|
11348
|
-
continue;
|
|
11349
|
-
}
|
|
11350
11381
|
for (const resource of affiliate.affiliateResources) {
|
|
11351
11382
|
if (!isEligibleVendorResource(resource)) {
|
|
11352
11383
|
continue;
|
|
@@ -11358,7 +11389,6 @@ async function awardAffiliateVendorSubscriptionRewards(now = /* @__PURE__ */ new
|
|
|
11358
11389
|
seenPairs.add(pairKey);
|
|
11359
11390
|
const outcome = await processAffiliateVendorReferral({
|
|
11360
11391
|
affiliate,
|
|
11361
|
-
affiliateCode,
|
|
11362
11392
|
createdAt,
|
|
11363
11393
|
now,
|
|
11364
11394
|
period,
|
|
@@ -11382,6 +11412,12 @@ async function findAffiliateByPromoCode(promoCode) {
|
|
|
11382
11412
|
}).exec();
|
|
11383
11413
|
}
|
|
11384
11414
|
|
|
11415
|
+
// src/service/promoCode/normalizePromoCode.ts
|
|
11416
|
+
function normalizePromoCode(decoratedPromoCode) {
|
|
11417
|
+
const normalized = decoratedPromoCode?.trim().toUpperCase();
|
|
11418
|
+
return normalized || null;
|
|
11419
|
+
}
|
|
11420
|
+
|
|
11385
11421
|
// src/service/affiliate/normalizeAffiliatePromoCodes.ts
|
|
11386
11422
|
function normalizeAffiliatePromoCodes(promoCodes) {
|
|
11387
11423
|
const normalized = (promoCodes ?? []).map((code) => normalizePromoCode(code)).filter((code) => code !== null);
|