@timardex/cluemart-server-shared 1.1.18 → 1.1.20
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-TDAUQKK7.mjs → chunk-WDKTIULG.mjs} +171 -114
- package/dist/chunk-WDKTIULG.mjs.map +1 -0
- package/dist/index.cjs +180 -132
- 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 +180 -132
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +170 -113
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.mjs +1 -1
- package/dist/service/index.cjs +180 -132
- 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-TDAUQKK7.mjs.map +0 -1
package/dist/mongoose/index.mjs
CHANGED
package/dist/service/index.cjs
CHANGED
|
@@ -4981,6 +4981,12 @@ var OWNER_FIELDS_FRAGMENT = gql`
|
|
|
4981
4981
|
userId
|
|
4982
4982
|
}
|
|
4983
4983
|
`;
|
|
4984
|
+
var PRODUCT_COUPON_FIELDS_FRAGMENT = gql`
|
|
4985
|
+
fragment ProductCouponFields on ProductCouponType {
|
|
4986
|
+
couponDocumentId
|
|
4987
|
+
couponId
|
|
4988
|
+
}
|
|
4989
|
+
`;
|
|
4984
4990
|
var CATEGORY_FIELDS_FRAGMENT = gql`
|
|
4985
4991
|
fragment CategoryFields on CategoryType {
|
|
4986
4992
|
id
|
|
@@ -5454,109 +5460,6 @@ var GET_EVENT_INFO = gql`
|
|
|
5454
5460
|
}
|
|
5455
5461
|
${EVENT_INFO}
|
|
5456
5462
|
`;
|
|
5457
|
-
var PRODUCT_COUPON_FIELDS_FRAGMENT = gql`
|
|
5458
|
-
fragment ProductCouponFields on ProductCouponType {
|
|
5459
|
-
couponDocumentId
|
|
5460
|
-
couponId
|
|
5461
|
-
}
|
|
5462
|
-
`;
|
|
5463
|
-
var COUPON_CODE_FIELDS_FRAGMENT = gql`
|
|
5464
|
-
fragment CouponCodeFields on CouponCodeType {
|
|
5465
|
-
code
|
|
5466
|
-
qrCode {
|
|
5467
|
-
...ResourceImageFields
|
|
5468
|
-
}
|
|
5469
|
-
}
|
|
5470
|
-
${RESOURCE_IMAGE_FIELDS_FRAGMENT}
|
|
5471
|
-
`;
|
|
5472
|
-
var COUPON_PARTICIPANT_USER_FIELDS_FRAGMENT = gql`
|
|
5473
|
-
fragment CouponParticipantUserFields on CouponParticipantUserType {
|
|
5474
|
-
couponCollectedCount
|
|
5475
|
-
couponRedeemedAt
|
|
5476
|
-
createdAt
|
|
5477
|
-
updatedAt
|
|
5478
|
-
userId
|
|
5479
|
-
}
|
|
5480
|
-
`;
|
|
5481
|
-
var COUPON_OPTION_FIELDS_FRAGMENT = gql`
|
|
5482
|
-
fragment CouponOptionFields on CouponOptionType {
|
|
5483
|
-
type
|
|
5484
|
-
buy
|
|
5485
|
-
get
|
|
5486
|
-
unit
|
|
5487
|
-
visits
|
|
5488
|
-
}
|
|
5489
|
-
`;
|
|
5490
|
-
var COUPON_REWARD_FIELDS_FRAGMENT = gql`
|
|
5491
|
-
fragment CouponRewardFields on CouponRewardType {
|
|
5492
|
-
vendorId
|
|
5493
|
-
productId
|
|
5494
|
-
quantity
|
|
5495
|
-
unit
|
|
5496
|
-
}
|
|
5497
|
-
`;
|
|
5498
|
-
var COUPON_DATA_FIELDS_FRAGMENT = gql`
|
|
5499
|
-
fragment CouponDataFields on CouponDataType {
|
|
5500
|
-
_id
|
|
5501
|
-
active
|
|
5502
|
-
couponCode {
|
|
5503
|
-
...CouponCodeFields
|
|
5504
|
-
}
|
|
5505
|
-
couponDescription
|
|
5506
|
-
couponOption {
|
|
5507
|
-
...CouponOptionFields
|
|
5508
|
-
}
|
|
5509
|
-
couponRewards {
|
|
5510
|
-
...CouponRewardFields
|
|
5511
|
-
}
|
|
5512
|
-
createdAt
|
|
5513
|
-
endDate
|
|
5514
|
-
participantUsers {
|
|
5515
|
-
...CouponParticipantUserFields
|
|
5516
|
-
}
|
|
5517
|
-
resourceId
|
|
5518
|
-
resourceType
|
|
5519
|
-
startDate
|
|
5520
|
-
updatedAt
|
|
5521
|
-
}
|
|
5522
|
-
${COUPON_CODE_FIELDS_FRAGMENT}
|
|
5523
|
-
${COUPON_OPTION_FIELDS_FRAGMENT}
|
|
5524
|
-
${COUPON_PARTICIPANT_USER_FIELDS_FRAGMENT}
|
|
5525
|
-
${COUPON_REWARD_FIELDS_FRAGMENT}
|
|
5526
|
-
`;
|
|
5527
|
-
var COUPON = gql`
|
|
5528
|
-
fragment CouponFields on CouponType {
|
|
5529
|
-
_id
|
|
5530
|
-
active
|
|
5531
|
-
couponData {
|
|
5532
|
-
...CouponDataFields
|
|
5533
|
-
}
|
|
5534
|
-
createdAt
|
|
5535
|
-
deletedAt
|
|
5536
|
-
owner {
|
|
5537
|
-
...OwnerFields
|
|
5538
|
-
}
|
|
5539
|
-
updatedAt
|
|
5540
|
-
}
|
|
5541
|
-
${OWNER_FIELDS_FRAGMENT}
|
|
5542
|
-
${COUPON_DATA_FIELDS_FRAGMENT}
|
|
5543
|
-
`;
|
|
5544
|
-
var GET_COUPONS = gql`
|
|
5545
|
-
query getCoupons {
|
|
5546
|
-
coupons {
|
|
5547
|
-
...CouponFields
|
|
5548
|
-
}
|
|
5549
|
-
}
|
|
5550
|
-
${COUPON}
|
|
5551
|
-
`;
|
|
5552
|
-
var GET_COUPON = gql`
|
|
5553
|
-
query getCoupon($_id: ID!) {
|
|
5554
|
-
coupon(_id: $_id) {
|
|
5555
|
-
...CouponFields
|
|
5556
|
-
}
|
|
5557
|
-
}
|
|
5558
|
-
${COUPON}
|
|
5559
|
-
`;
|
|
5560
5463
|
var VENDOR_DATETIME_FIELDS_FRAGMENT = gql`
|
|
5561
5464
|
fragment VendorDateTimeFields on VendorDateTimeType {
|
|
5562
5465
|
dateStatus
|
|
@@ -5583,6 +5486,15 @@ var VENDOR_PRODUCT_LIST_FIELDS_FRAGMENT = gql`
|
|
|
5583
5486
|
}
|
|
5584
5487
|
${PRODUCT_COUPON_FIELDS_FRAGMENT}
|
|
5585
5488
|
`;
|
|
5489
|
+
var VENDOR_PRODUCTS_FIELDS_FRAGMENT = gql`
|
|
5490
|
+
fragment VendorProductsFields on VendorProductsType {
|
|
5491
|
+
active
|
|
5492
|
+
productsList {
|
|
5493
|
+
...VendorProductListFields
|
|
5494
|
+
}
|
|
5495
|
+
}
|
|
5496
|
+
${VENDOR_PRODUCT_LIST_FIELDS_FRAGMENT}
|
|
5497
|
+
`;
|
|
5586
5498
|
var VENDOR = gql`
|
|
5587
5499
|
fragment VendorFields on VendorType {
|
|
5588
5500
|
_id
|
|
@@ -5632,10 +5544,7 @@ var VENDOR = gql`
|
|
|
5632
5544
|
...OwnerFields
|
|
5633
5545
|
}
|
|
5634
5546
|
products {
|
|
5635
|
-
|
|
5636
|
-
productsList {
|
|
5637
|
-
...VendorProductListFields
|
|
5638
|
-
}
|
|
5547
|
+
...VendorProductsFields
|
|
5639
5548
|
}
|
|
5640
5549
|
promoCodes
|
|
5641
5550
|
posterUsage {
|
|
@@ -5677,7 +5586,7 @@ var VENDOR = gql`
|
|
|
5677
5586
|
${RESOURCE_IMAGE_FIELDS_FRAGMENT}
|
|
5678
5587
|
${SOCIAL_MEDIA_FIELDS_FRAGMENT}
|
|
5679
5588
|
${POSTER_USAGE_FIELDS_FRAGMENT}
|
|
5680
|
-
${
|
|
5589
|
+
${VENDOR_PRODUCTS_FIELDS_FRAGMENT}
|
|
5681
5590
|
${CONTACT_DETAILS_FIELDS_FRAGMENT}
|
|
5682
5591
|
${TERMS_AGREEMENT_FIELDS_FRAGMENT}
|
|
5683
5592
|
${RELATION_DATES_FRAGMENT}
|
|
@@ -7883,6 +7792,146 @@ var ASSIGN_AFFILIATE_BONUS_REWARD_MUTATION = gql`
|
|
|
7883
7792
|
}
|
|
7884
7793
|
${AFFILIATE_FIELDS_FRAGMENT}
|
|
7885
7794
|
`;
|
|
7795
|
+
var COUPON_CODE_FIELDS_FRAGMENT = gql`
|
|
7796
|
+
fragment CouponCodeFields on CouponCodeType {
|
|
7797
|
+
code
|
|
7798
|
+
qrCode {
|
|
7799
|
+
...ResourceImageFields
|
|
7800
|
+
}
|
|
7801
|
+
}
|
|
7802
|
+
${RESOURCE_IMAGE_FIELDS_FRAGMENT}
|
|
7803
|
+
`;
|
|
7804
|
+
var COUPON_PARTICIPANT_USER_FIELDS_FRAGMENT = gql`
|
|
7805
|
+
fragment CouponParticipantUserFields on CouponParticipantUserType {
|
|
7806
|
+
couponCollectedCount
|
|
7807
|
+
couponRedeemedAt
|
|
7808
|
+
createdAt
|
|
7809
|
+
updatedAt
|
|
7810
|
+
userId
|
|
7811
|
+
}
|
|
7812
|
+
`;
|
|
7813
|
+
var COUPON_OPTION_FIELDS_FRAGMENT = gql`
|
|
7814
|
+
fragment CouponOptionFields on CouponOptionType {
|
|
7815
|
+
type
|
|
7816
|
+
buy
|
|
7817
|
+
get
|
|
7818
|
+
unit
|
|
7819
|
+
visits
|
|
7820
|
+
}
|
|
7821
|
+
`;
|
|
7822
|
+
var COUPON_REWARD_FIELDS_FRAGMENT = gql`
|
|
7823
|
+
fragment CouponRewardFields on CouponRewardType {
|
|
7824
|
+
vendorId
|
|
7825
|
+
productId
|
|
7826
|
+
quantity
|
|
7827
|
+
unit
|
|
7828
|
+
}
|
|
7829
|
+
`;
|
|
7830
|
+
var COUPON_DATA_PRODUCTS_FIELDS_FRAGMENT = gql`
|
|
7831
|
+
fragment CouponDataProductsFields on CouponDataProductsType {
|
|
7832
|
+
active
|
|
7833
|
+
productsList {
|
|
7834
|
+
...VendorProductListFields
|
|
7835
|
+
}
|
|
7836
|
+
vendorLogo {
|
|
7837
|
+
...ResourceImageFields
|
|
7838
|
+
}
|
|
7839
|
+
vendorName
|
|
7840
|
+
}
|
|
7841
|
+
${VENDOR_PRODUCT_LIST_FIELDS_FRAGMENT}
|
|
7842
|
+
${RESOURCE_IMAGE_FIELDS_FRAGMENT}
|
|
7843
|
+
`;
|
|
7844
|
+
var COUPON_DATA_FIELDS_FRAGMENT = gql`
|
|
7845
|
+
fragment CouponDataFields on CouponDataType {
|
|
7846
|
+
_id
|
|
7847
|
+
active
|
|
7848
|
+
couponCode {
|
|
7849
|
+
...CouponCodeFields
|
|
7850
|
+
}
|
|
7851
|
+
couponDescription
|
|
7852
|
+
couponOption {
|
|
7853
|
+
...CouponOptionFields
|
|
7854
|
+
}
|
|
7855
|
+
couponRewards {
|
|
7856
|
+
...CouponRewardFields
|
|
7857
|
+
}
|
|
7858
|
+
createdAt
|
|
7859
|
+
endDate
|
|
7860
|
+
participantUsers {
|
|
7861
|
+
...CouponParticipantUserFields
|
|
7862
|
+
}
|
|
7863
|
+
products {
|
|
7864
|
+
...CouponDataProductsFields
|
|
7865
|
+
}
|
|
7866
|
+
resourceId
|
|
7867
|
+
resourceType
|
|
7868
|
+
startDate
|
|
7869
|
+
updatedAt
|
|
7870
|
+
}
|
|
7871
|
+
${COUPON_CODE_FIELDS_FRAGMENT}
|
|
7872
|
+
${COUPON_OPTION_FIELDS_FRAGMENT}
|
|
7873
|
+
${COUPON_PARTICIPANT_USER_FIELDS_FRAGMENT}
|
|
7874
|
+
${COUPON_REWARD_FIELDS_FRAGMENT}
|
|
7875
|
+
${COUPON_DATA_PRODUCTS_FIELDS_FRAGMENT}
|
|
7876
|
+
`;
|
|
7877
|
+
var COUPON = gql`
|
|
7878
|
+
fragment CouponFields on CouponType {
|
|
7879
|
+
_id
|
|
7880
|
+
active
|
|
7881
|
+
couponData {
|
|
7882
|
+
...CouponDataFields
|
|
7883
|
+
}
|
|
7884
|
+
createdAt
|
|
7885
|
+
deletedAt
|
|
7886
|
+
owner {
|
|
7887
|
+
...OwnerFields
|
|
7888
|
+
}
|
|
7889
|
+
updatedAt
|
|
7890
|
+
}
|
|
7891
|
+
${OWNER_FIELDS_FRAGMENT}
|
|
7892
|
+
${COUPON_DATA_FIELDS_FRAGMENT}
|
|
7893
|
+
`;
|
|
7894
|
+
var GET_COUPONS = gql`
|
|
7895
|
+
query getCoupons {
|
|
7896
|
+
coupons {
|
|
7897
|
+
active {
|
|
7898
|
+
listName
|
|
7899
|
+
data {
|
|
7900
|
+
...CouponFields
|
|
7901
|
+
}
|
|
7902
|
+
}
|
|
7903
|
+
owned {
|
|
7904
|
+
listName
|
|
7905
|
+
data {
|
|
7906
|
+
...CouponFields
|
|
7907
|
+
}
|
|
7908
|
+
}
|
|
7909
|
+
scanned {
|
|
7910
|
+
listName
|
|
7911
|
+
data {
|
|
7912
|
+
...CouponFields
|
|
7913
|
+
}
|
|
7914
|
+
}
|
|
7915
|
+
}
|
|
7916
|
+
}
|
|
7917
|
+
${COUPON}
|
|
7918
|
+
`;
|
|
7919
|
+
var GET_COUPON = gql`
|
|
7920
|
+
query getCoupon($_id: ID!) {
|
|
7921
|
+
coupon(_id: $_id) {
|
|
7922
|
+
...CouponFields
|
|
7923
|
+
}
|
|
7924
|
+
}
|
|
7925
|
+
${COUPON}
|
|
7926
|
+
`;
|
|
7927
|
+
var GET_RESOURCE_COUPONS = gql`
|
|
7928
|
+
query getResourceCoupons($resourceId: ID!, $resourceType: ResourceTypeEnum!) {
|
|
7929
|
+
resourceCoupons(resourceId: $resourceId, resourceType: $resourceType) {
|
|
7930
|
+
...CouponFields
|
|
7931
|
+
}
|
|
7932
|
+
}
|
|
7933
|
+
${COUPON}
|
|
7934
|
+
`;
|
|
7886
7935
|
var CREATE_COUPON_MUTATION = gql`
|
|
7887
7936
|
mutation createCoupon($input: CouponInputType!) {
|
|
7888
7937
|
createCoupon(input: $input) {
|
|
@@ -7895,8 +7944,16 @@ var CREATE_COUPON_MUTATION = gql`
|
|
|
7895
7944
|
${COUPON}
|
|
7896
7945
|
`;
|
|
7897
7946
|
var UPDATE_COUPON_MUTATION = gql`
|
|
7898
|
-
mutation updateCoupon(
|
|
7899
|
-
|
|
7947
|
+
mutation updateCoupon(
|
|
7948
|
+
$couponDocumentId: ID!
|
|
7949
|
+
$couponId: ID!
|
|
7950
|
+
$input: CouponInputType!
|
|
7951
|
+
) {
|
|
7952
|
+
updateCoupon(
|
|
7953
|
+
couponDocumentId: $couponDocumentId
|
|
7954
|
+
couponId: $couponId
|
|
7955
|
+
input: $input
|
|
7956
|
+
) {
|
|
7900
7957
|
data {
|
|
7901
7958
|
...CouponFields
|
|
7902
7959
|
}
|
|
@@ -7906,8 +7963,8 @@ var UPDATE_COUPON_MUTATION = gql`
|
|
|
7906
7963
|
${COUPON}
|
|
7907
7964
|
`;
|
|
7908
7965
|
var DELETE_COUPON_MUTATION = gql`
|
|
7909
|
-
mutation deleteCoupon($
|
|
7910
|
-
deleteCoupon(
|
|
7966
|
+
mutation deleteCoupon($couponDocumentId: ID!, $couponId: ID!) {
|
|
7967
|
+
deleteCoupon(couponDocumentId: $couponDocumentId, couponId: $couponId) {
|
|
7911
7968
|
data
|
|
7912
7969
|
message
|
|
7913
7970
|
}
|
|
@@ -9173,7 +9230,7 @@ var vendorProductTypeSchema = new MongooseSchema14(
|
|
|
9173
9230
|
);
|
|
9174
9231
|
var productWrapperSchema = new MongooseSchema14(
|
|
9175
9232
|
{
|
|
9176
|
-
active: { default: false, required:
|
|
9233
|
+
active: { default: false, required: false, type: Boolean },
|
|
9177
9234
|
productsList: { required: false, type: [vendorProductTypeSchema] }
|
|
9178
9235
|
},
|
|
9179
9236
|
{ _id: false }
|
|
@@ -9923,7 +9980,7 @@ var SHARE_RESOURCE_LABEL2 = {
|
|
|
9923
9980
|
school: "School"
|
|
9924
9981
|
};
|
|
9925
9982
|
|
|
9926
|
-
// node_modules/@timardex/cluemart-shared/dist/chunk-
|
|
9983
|
+
// node_modules/@timardex/cluemart-shared/dist/chunk-3HRC67D3.mjs
|
|
9927
9984
|
var PROMO_CODE_PREFIX2 = "CM-";
|
|
9928
9985
|
var OBJECT_ID_PATH_SEGMENT2 = "[a-f0-9]{24}";
|
|
9929
9986
|
var OBJECT_ID_PATH_SEGMENT_END2 = `${OBJECT_ID_PATH_SEGMENT2}$`;
|
|
@@ -10025,7 +10082,7 @@ var gameScreenIdentifierList2 = [
|
|
|
10025
10082
|
}
|
|
10026
10083
|
];
|
|
10027
10084
|
|
|
10028
|
-
// node_modules/@timardex/cluemart-shared/dist/chunk-
|
|
10085
|
+
// node_modules/@timardex/cluemart-shared/dist/chunk-E7KKXQDI.mjs
|
|
10029
10086
|
var import_dayjs4 = __toESM(require("dayjs"), 1);
|
|
10030
10087
|
var statusOptions2 = [
|
|
10031
10088
|
...Object.values(EnumInviteStatus2).map((status) => ({
|
|
@@ -11069,12 +11126,6 @@ function createAffiliateReward(rewardType, createdAt) {
|
|
|
11069
11126
|
};
|
|
11070
11127
|
}
|
|
11071
11128
|
|
|
11072
|
-
// src/service/promoCode/normalizePromoCode.ts
|
|
11073
|
-
function normalizePromoCode(decoratedPromoCode) {
|
|
11074
|
-
const normalized = decoratedPromoCode?.trim().toUpperCase();
|
|
11075
|
-
return normalized || null;
|
|
11076
|
-
}
|
|
11077
|
-
|
|
11078
11129
|
// src/service/saveNotificationsInDb.ts
|
|
11079
11130
|
async function saveNotificationsInDb(payload) {
|
|
11080
11131
|
const { data, message, title, type, userIds } = payload;
|
|
@@ -11254,10 +11305,9 @@ async function findAffiliatesWithActiveVendorReferrals() {
|
|
|
11254
11305
|
}
|
|
11255
11306
|
},
|
|
11256
11307
|
deletedAt: null
|
|
11257
|
-
}).select("_id
|
|
11308
|
+
}).select("_id affiliateResources owner").lean().exec();
|
|
11258
11309
|
}
|
|
11259
11310
|
async function isEligibleReferredVendor({
|
|
11260
|
-
affiliateCode,
|
|
11261
11311
|
resourceId,
|
|
11262
11312
|
resourceOwnerUserId
|
|
11263
11313
|
}) {
|
|
@@ -11265,8 +11315,7 @@ async function isEligibleReferredVendor({
|
|
|
11265
11315
|
_id: resourceId,
|
|
11266
11316
|
active: true,
|
|
11267
11317
|
deletedAt: null,
|
|
11268
|
-
"owner.userId": resourceOwnerUserId
|
|
11269
|
-
promoCodes: affiliateCode
|
|
11318
|
+
"owner.userId": resourceOwnerUserId
|
|
11270
11319
|
}).exec();
|
|
11271
11320
|
return Boolean(match);
|
|
11272
11321
|
}
|
|
@@ -11355,14 +11404,12 @@ async function tryAwardSubscriptionReward({
|
|
|
11355
11404
|
}
|
|
11356
11405
|
async function processAffiliateVendorReferral({
|
|
11357
11406
|
affiliate,
|
|
11358
|
-
affiliateCode,
|
|
11359
11407
|
createdAt,
|
|
11360
11408
|
now,
|
|
11361
11409
|
period,
|
|
11362
11410
|
resource
|
|
11363
11411
|
}) {
|
|
11364
11412
|
const vendorEligible = await isEligibleReferredVendor({
|
|
11365
|
-
affiliateCode,
|
|
11366
11413
|
resourceId: resource.resourceId,
|
|
11367
11414
|
resourceOwnerUserId: resource.resourceOwner.userId
|
|
11368
11415
|
});
|
|
@@ -11392,10 +11439,6 @@ async function awardAffiliateVendorSubscriptionRewards(now = /* @__PURE__ */ new
|
|
|
11392
11439
|
let skipped = 0;
|
|
11393
11440
|
const seenPairs = /* @__PURE__ */ new Set();
|
|
11394
11441
|
for (const affiliate of affiliates) {
|
|
11395
|
-
const affiliateCode = normalizePromoCode(affiliate.affiliateCode);
|
|
11396
|
-
if (!affiliateCode) {
|
|
11397
|
-
continue;
|
|
11398
|
-
}
|
|
11399
11442
|
for (const resource of affiliate.affiliateResources) {
|
|
11400
11443
|
if (!isEligibleVendorResource(resource)) {
|
|
11401
11444
|
continue;
|
|
@@ -11407,7 +11450,6 @@ async function awardAffiliateVendorSubscriptionRewards(now = /* @__PURE__ */ new
|
|
|
11407
11450
|
seenPairs.add(pairKey);
|
|
11408
11451
|
const outcome = await processAffiliateVendorReferral({
|
|
11409
11452
|
affiliate,
|
|
11410
|
-
affiliateCode,
|
|
11411
11453
|
createdAt,
|
|
11412
11454
|
now,
|
|
11413
11455
|
period,
|
|
@@ -11431,6 +11473,12 @@ async function findAffiliateByPromoCode(promoCode) {
|
|
|
11431
11473
|
}).exec();
|
|
11432
11474
|
}
|
|
11433
11475
|
|
|
11476
|
+
// src/service/promoCode/normalizePromoCode.ts
|
|
11477
|
+
function normalizePromoCode(decoratedPromoCode) {
|
|
11478
|
+
const normalized = decoratedPromoCode?.trim().toUpperCase();
|
|
11479
|
+
return normalized || null;
|
|
11480
|
+
}
|
|
11481
|
+
|
|
11434
11482
|
// src/service/affiliate/normalizeAffiliatePromoCodes.ts
|
|
11435
11483
|
function normalizeAffiliatePromoCodes(promoCodes) {
|
|
11436
11484
|
const normalized = (promoCodes ?? []).map((code) => normalizePromoCode(code)).filter((code) => code !== null);
|