@timardex/cluemart-shared 1.2.34 → 1.2.35

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.
Files changed (36) hide show
  1. package/dist/{ad-CiYcsJB7.d.mts → ad-CWAaH5Ql.d.mts} +1 -1
  2. package/dist/{ad-BZylIpez.d.ts → ad-D60cy5L4.d.ts} +1 -1
  3. package/dist/{auth-DDtMJHZw.d.mts → auth-BslKse3L.d.mts} +1 -1
  4. package/dist/{auth-CmaB99NK.d.ts → auth-Ch9Nt77g.d.ts} +1 -1
  5. package/dist/{chunk-NPHPFWQH.mjs → chunk-WWL2Q5DN.mjs} +3 -22
  6. package/dist/chunk-WWL2Q5DN.mjs.map +1 -0
  7. package/dist/formFields/index.d.mts +1 -1
  8. package/dist/formFields/index.d.ts +1 -1
  9. package/dist/{global-DVYSZ6LR.d.ts → global-DvxKMAQD.d.ts} +1 -1
  10. package/dist/{global-ExJZRDGR.d.mts → global-j9FEfVZs.d.mts} +1 -1
  11. package/dist/graphql/index.d.mts +2 -2
  12. package/dist/graphql/index.d.ts +2 -2
  13. package/dist/hooks/index.d.mts +3 -3
  14. package/dist/hooks/index.d.ts +3 -3
  15. package/dist/index.cjs +0 -111
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.mts +1 -3
  18. package/dist/index.d.ts +1 -3
  19. package/dist/index.mjs +0 -110
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/mongoose/index.d.mts +3 -3
  22. package/dist/mongoose/index.d.ts +3 -3
  23. package/dist/mongoose/index.mjs +76 -60
  24. package/dist/mongoose/index.mjs.map +1 -1
  25. package/dist/service/index.cjs +6 -142
  26. package/dist/service/index.cjs.map +1 -1
  27. package/dist/service/index.d.mts +2 -4
  28. package/dist/service/index.d.ts +2 -4
  29. package/dist/service/index.mjs +3 -114
  30. package/dist/service/index.mjs.map +1 -1
  31. package/dist/types/index.d.mts +3 -3
  32. package/dist/types/index.d.ts +3 -3
  33. package/dist/utils/index.d.mts +1 -1
  34. package/dist/utils/index.d.ts +1 -1
  35. package/package.json +1 -2
  36. package/dist/chunk-NPHPFWQH.mjs.map +0 -1
@@ -1,5 +1,5 @@
1
1
  import { EnumOSPlatform, EnumResourceType, EnumUserLicence, EnumUserRole } from './enums/index.mjs';
2
- import { C as Category, a1 as CreateFormData, s as ResourceImageType, P as PartnerType, T as TermsAgreement, r as SocialMediaType } from './global-ExJZRDGR.mjs';
2
+ import { C as Category, a1 as CreateFormData, s as ResourceImageType, P as PartnerType, T as TermsAgreement, r as SocialMediaType } from './global-j9FEfVZs.mjs';
3
3
 
4
4
  interface TestersFormData {
5
5
  categories?: Category[] | null;
@@ -1,5 +1,5 @@
1
1
  import { EnumOSPlatform, EnumResourceType, EnumUserLicence, EnumUserRole } from './enums/index.js';
2
- import { C as Category, a1 as CreateFormData, s as ResourceImageType, P as PartnerType, T as TermsAgreement, r as SocialMediaType } from './global-DVYSZ6LR.js';
2
+ import { C as Category, a1 as CreateFormData, s as ResourceImageType, P as PartnerType, T as TermsAgreement, r as SocialMediaType } from './global-DvxKMAQD.js';
3
3
 
4
4
  interface TestersFormData {
5
5
  categories?: Category[] | null;
@@ -1,4 +1,4 @@
1
- import { a1 as CreateFormData, T as TermsAgreement } from './global-ExJZRDGR.mjs';
1
+ import { a1 as CreateFormData, T as TermsAgreement } from './global-j9FEfVZs.mjs';
2
2
  import { EnumOSPlatform } from './enums/index.mjs';
3
3
 
4
4
  type ContactUsFormData = {
@@ -1,4 +1,4 @@
1
- import { a1 as CreateFormData, T as TermsAgreement } from './global-DVYSZ6LR.js';
1
+ import { a1 as CreateFormData, T as TermsAgreement } from './global-DvxKMAQD.js';
2
2
  import { EnumOSPlatform } from './enums/index.js';
3
3
 
4
4
  type ContactUsFormData = {
@@ -1,7 +1,6 @@
1
1
  import {
2
2
  EnumNotificationResourceType,
3
- EnumNotificationType,
4
- EnumOSPlatform
3
+ EnumNotificationType
5
4
  } from "./chunk-NNS747QT.mjs";
6
5
 
7
6
  // src/mongoose/Notification.ts
@@ -39,25 +38,7 @@ schema.index({ isRead: 1, userId: 1 });
39
38
  schema.index({ createdAt: -1, userId: 1 });
40
39
  var NotificationModel = mongoose.models.Notification || mongoose.model("Notification", schema);
41
40
 
42
- // src/mongoose/PushToken.ts
43
- import mongoose2 from "mongoose";
44
- var MongooseSchema2 = mongoose2.Schema;
45
- var schema2 = new MongooseSchema2(
46
- {
47
- platform: {
48
- enum: Object.values(EnumOSPlatform),
49
- required: true,
50
- type: String
51
- },
52
- token: { required: true, type: String },
53
- userId: { required: true, type: mongoose2.Schema.Types.ObjectId }
54
- },
55
- { timestamps: true }
56
- );
57
- var PushTokenModel = mongoose2.models.PushToken || mongoose2.model("PushToken", schema2);
58
-
59
41
  export {
60
- NotificationModel,
61
- PushTokenModel
42
+ NotificationModel
62
43
  };
63
- //# sourceMappingURL=chunk-NPHPFWQH.mjs.map
44
+ //# sourceMappingURL=chunk-WWL2Q5DN.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/mongoose/Notification.ts"],"sourcesContent":["import mongoose from \"mongoose\";\n\nimport { EnumNotificationResourceType, EnumNotificationType } from \"src/enums\";\nimport {\n CreateBulkNotificationInput,\n NotificationType,\n ObjectId,\n} from \"src/types\";\n\nconst MongooseSchema = mongoose.Schema;\n\nexport type SchemaCreateBulkNotificationInput = Omit<\n CreateBulkNotificationInput,\n \"userIds\"\n> & {\n userIds: ObjectId[];\n};\n\nexport type SchemaNotificationType = Omit<NotificationType, \"userId\"> & {\n userId: ObjectId;\n};\n/**\n * Schema for storing in-app notifications\n * Each notification is tied to a specific user and can be marked as read/unread\n */\nconst schema = new MongooseSchema<SchemaNotificationType>(\n {\n data: {\n resourceId: { required: true, type: String },\n resourceName: { required: true, type: String },\n resourceType: {\n enum: Object.values(EnumNotificationResourceType),\n required: true,\n type: String,\n },\n },\n isRead: { default: false, index: true, required: true, type: Boolean },\n message: { required: true, type: String },\n title: { required: true, type: String },\n type: {\n default: EnumNotificationType.SYSTEM,\n enum: Object.values(EnumNotificationType),\n required: true,\n type: String,\n },\n userId: {\n ref: \"User\",\n required: true,\n type: mongoose.Schema.Types.ObjectId,\n },\n },\n { timestamps: true },\n);\n\n// Compound index for efficient queries\nschema.index({ isRead: 1, userId: 1 });\nschema.index({ createdAt: -1, userId: 1 });\n\nexport const NotificationModel =\n (mongoose.models.Notification as mongoose.Model<SchemaNotificationType>) ||\n mongoose.model<SchemaNotificationType>(\"Notification\", schema);\n"],"mappings":";;;;;;AAAA,OAAO,cAAc;AASrB,IAAM,iBAAiB,SAAS;AAgBhC,IAAM,SAAS,IAAI;AAAA,EACjB;AAAA,IACE,MAAM;AAAA,MACJ,YAAY,EAAE,UAAU,MAAM,MAAM,OAAO;AAAA,MAC3C,cAAc,EAAE,UAAU,MAAM,MAAM,OAAO;AAAA,MAC7C,cAAc;AAAA,QACZ,MAAM,OAAO,OAAO,4BAA4B;AAAA,QAChD,UAAU;AAAA,QACV,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,QAAQ,EAAE,SAAS,OAAO,OAAO,MAAM,UAAU,MAAM,MAAM,QAAQ;AAAA,IACrE,SAAS,EAAE,UAAU,MAAM,MAAM,OAAO;AAAA,IACxC,OAAO,EAAE,UAAU,MAAM,MAAM,OAAO;AAAA,IACtC,MAAM;AAAA,MACJ;AAAA,MACA,MAAM,OAAO,OAAO,oBAAoB;AAAA,MACxC,UAAU;AAAA,MACV,MAAM;AAAA,IACR;AAAA,IACA,QAAQ;AAAA,MACN,KAAK;AAAA,MACL,UAAU;AAAA,MACV,MAAM,SAAS,OAAO,MAAM;AAAA,IAC9B;AAAA,EACF;AAAA,EACA,EAAE,YAAY,KAAK;AACrB;AAGA,OAAO,MAAM,EAAE,QAAQ,GAAG,QAAQ,EAAE,CAAC;AACrC,OAAO,MAAM,EAAE,WAAW,IAAI,QAAQ,EAAE,CAAC;AAElC,IAAM,oBACV,SAAS,OAAO,gBACjB,SAAS,MAA8B,gBAAgB,MAAM;","names":[]}
@@ -1,4 +1,4 @@
1
- import { F as FormField, a as FormDateField, O as OptionItem, R as Requirement, S as StallType, C as Category } from '../global-ExJZRDGR.mjs';
1
+ import { F as FormField, a as FormDateField, O as OptionItem, R as Requirement, S as StallType, C as Category } from '../global-j9FEfVZs.mjs';
2
2
  import 'express';
3
3
  import 'mongoose';
4
4
  import 'react-hook-form';
@@ -1,4 +1,4 @@
1
- import { F as FormField, a as FormDateField, O as OptionItem, R as Requirement, S as StallType, C as Category } from '../global-DVYSZ6LR.js';
1
+ import { F as FormField, a as FormDateField, O as OptionItem, R as Requirement, S as StallType, C as Category } from '../global-DvxKMAQD.js';
2
2
  import 'express';
3
3
  import 'mongoose';
4
4
  import 'react-hook-form';
@@ -267,7 +267,7 @@ declare const ParticipantSchema: mongoose.Schema<SchemaParticipantType, mongoose
267
267
  } & {
268
268
  __v: number;
269
269
  }>;
270
- declare const ChatModel: mongoose.Model<SchemaChatType, {}, {}, {}, mongoose.Document<unknown, {}, SchemaChatType, {}, {}> & Omit<ChatType, "messages" | "participants" | "resourceInfo"> & {
270
+ declare const ChatModel: mongoose.Model<SchemaChatType, {}, {}, {}, mongoose.Document<unknown, {}, SchemaChatType, {}, {}> & Omit<ChatType, "participants" | "messages" | "resourceInfo"> & {
271
271
  participants: SchemaParticipantType[];
272
272
  messages: SchemaChatMessageType[];
273
273
  resourceInfo: {
@@ -267,7 +267,7 @@ declare const ParticipantSchema: mongoose.Schema<SchemaParticipantType, mongoose
267
267
  } & {
268
268
  __v: number;
269
269
  }>;
270
- declare const ChatModel: mongoose.Model<SchemaChatType, {}, {}, {}, mongoose.Document<unknown, {}, SchemaChatType, {}, {}> & Omit<ChatType, "messages" | "participants" | "resourceInfo"> & {
270
+ declare const ChatModel: mongoose.Model<SchemaChatType, {}, {}, {}, mongoose.Document<unknown, {}, SchemaChatType, {}, {}> & Omit<ChatType, "participants" | "messages" | "resourceInfo"> & {
271
271
  participants: SchemaParticipantType[];
272
272
  messages: SchemaChatMessageType[];
273
273
  resourceInfo: {
@@ -1,7 +1,7 @@
1
1
  import * as _apollo_client from '@apollo/client';
2
- import { b as ChatType, E as EventType, c as EventInfoType, N as NotificationType, d as NotificationCount, e as RelationType, f as ResourceConnectionsType, V as VendorType, g as VendorInfoType } from '../global-ExJZRDGR.mjs';
2
+ import { b as ChatType, E as EventType, c as EventInfoType, N as NotificationType, d as NotificationCount, e as RelationType, f as ResourceConnectionsType, V as VendorType, g as VendorInfoType } from '../global-j9FEfVZs.mjs';
3
3
  import { EnumResourceType } from '../enums/index.mjs';
4
- import { T as TesterType, U as UserType, A as AdType, E as EnumAdStatus } from '../ad-CiYcsJB7.mjs';
4
+ import { T as TesterType, U as UserType, A as AdType, E as EnumAdStatus } from '../ad-CWAaH5Ql.mjs';
5
5
  import { R as ResourceActivityType } from '../resourceActivities-BIjtlOGp.mjs';
6
6
  import 'express';
7
7
  import 'mongoose';
@@ -1,7 +1,7 @@
1
1
  import * as _apollo_client from '@apollo/client';
2
- import { b as ChatType, E as EventType, c as EventInfoType, N as NotificationType, d as NotificationCount, e as RelationType, f as ResourceConnectionsType, V as VendorType, g as VendorInfoType } from '../global-DVYSZ6LR.js';
2
+ import { b as ChatType, E as EventType, c as EventInfoType, N as NotificationType, d as NotificationCount, e as RelationType, f as ResourceConnectionsType, V as VendorType, g as VendorInfoType } from '../global-DvxKMAQD.js';
3
3
  import { EnumResourceType } from '../enums/index.js';
4
- import { T as TesterType, U as UserType, A as AdType, E as EnumAdStatus } from '../ad-BZylIpez.js';
4
+ import { T as TesterType, U as UserType, A as AdType, E as EnumAdStatus } from '../ad-D60cy5L4.js';
5
5
  import { R as ResourceActivityType } from '../resourceActivities-B4roVKtQ.js';
6
6
  import 'express';
7
7
  import 'mongoose';
@@ -1,6 +1,6 @@
1
- import { L as LocationType, h as VendorFormData, i as CreateVendorFormData, j as VendorInfoFormData, k as CreateVendorInfoFormData, l as EventFormData, m as CreateEventFormData, n as EventInfoFormData, o as CreateEventInfoFormData, B as BaseResourceTypeFormData } from '../global-ExJZRDGR.mjs';
2
- import { a as UserFormData, C as CreateUserFormData, b as TestersFormData, c as CreateTestersFormData, d as AdFormData, e as CreateAdFormData } from '../ad-CiYcsJB7.mjs';
3
- import { C as CreateLoginFormData, a as CreateRegisterFormData, b as CreateRequestPasswordResetFormData, c as CreateValidateVerificationTokenFormData, d as CreateResetPasswordFormData, e as ContactUsFormData, f as CreateContactUsFormData } from '../auth-DDtMJHZw.mjs';
1
+ import { L as LocationType, h as VendorFormData, i as CreateVendorFormData, j as VendorInfoFormData, k as CreateVendorInfoFormData, l as EventFormData, m as CreateEventFormData, n as EventInfoFormData, o as CreateEventInfoFormData, B as BaseResourceTypeFormData } from '../global-j9FEfVZs.mjs';
2
+ import { a as UserFormData, C as CreateUserFormData, b as TestersFormData, c as CreateTestersFormData, d as AdFormData, e as CreateAdFormData } from '../ad-CWAaH5Ql.mjs';
3
+ import { C as CreateLoginFormData, a as CreateRegisterFormData, b as CreateRequestPasswordResetFormData, c as CreateValidateVerificationTokenFormData, d as CreateResetPasswordFormData, e as ContactUsFormData, f as CreateContactUsFormData } from '../auth-BslKse3L.mjs';
4
4
  import 'express';
5
5
  import 'mongoose';
6
6
  import 'react-hook-form';
@@ -1,6 +1,6 @@
1
- import { L as LocationType, h as VendorFormData, i as CreateVendorFormData, j as VendorInfoFormData, k as CreateVendorInfoFormData, l as EventFormData, m as CreateEventFormData, n as EventInfoFormData, o as CreateEventInfoFormData, B as BaseResourceTypeFormData } from '../global-DVYSZ6LR.js';
2
- import { a as UserFormData, C as CreateUserFormData, b as TestersFormData, c as CreateTestersFormData, d as AdFormData, e as CreateAdFormData } from '../ad-BZylIpez.js';
3
- import { C as CreateLoginFormData, a as CreateRegisterFormData, b as CreateRequestPasswordResetFormData, c as CreateValidateVerificationTokenFormData, d as CreateResetPasswordFormData, e as ContactUsFormData, f as CreateContactUsFormData } from '../auth-CmaB99NK.js';
1
+ import { L as LocationType, h as VendorFormData, i as CreateVendorFormData, j as VendorInfoFormData, k as CreateVendorInfoFormData, l as EventFormData, m as CreateEventFormData, n as EventInfoFormData, o as CreateEventInfoFormData, B as BaseResourceTypeFormData } from '../global-DvxKMAQD.js';
2
+ import { a as UserFormData, C as CreateUserFormData, b as TestersFormData, c as CreateTestersFormData, d as AdFormData, e as CreateAdFormData } from '../ad-D60cy5L4.js';
3
+ import { C as CreateLoginFormData, a as CreateRegisterFormData, b as CreateRequestPasswordResetFormData, c as CreateValidateVerificationTokenFormData, d as CreateResetPasswordFormData, e as ContactUsFormData, f as CreateContactUsFormData } from '../auth-Ch9Nt77g.js';
4
4
  import 'express';
5
5
  import 'mongoose';
6
6
  import 'react-hook-form';
package/dist/index.cjs CHANGED
@@ -126,7 +126,6 @@ __export(index_exports, {
126
126
  requirementsOptions: () => requirementsOptions,
127
127
  resetPasswordFields: () => resetPasswordFields,
128
128
  saveNotificationsInDb: () => saveNotificationsInDb,
129
- sendPushNotifications: () => sendPushNotifications,
130
129
  socialMediaFields: () => socialMediaFields,
131
130
  sortDatesChronologically: () => sortDatesChronologically,
132
131
  stallTypeOptions: () => stallTypeOptions,
@@ -7139,115 +7138,6 @@ async function saveNotificationsInDb(payload) {
7139
7138
  }
7140
7139
  }
7141
7140
 
7142
- // src/service/sendPushNotifications.ts
7143
- var import_expo_server_sdk = require("expo-server-sdk");
7144
- var expo = new import_expo_server_sdk.Expo();
7145
- function extractTokensFromMessage(message) {
7146
- return Array.isArray(message.to) ? message.to : [message.to];
7147
- }
7148
- function createPushMessages({
7149
- tokens,
7150
- message,
7151
- title,
7152
- data
7153
- }) {
7154
- const messages = [];
7155
- const invalidTokens = [];
7156
- for (const token of tokens) {
7157
- if (!import_expo_server_sdk.Expo.isExpoPushToken(token)) {
7158
- invalidTokens.push(token);
7159
- continue;
7160
- }
7161
- messages.push({
7162
- body: message,
7163
- data: { ...data },
7164
- sound: "default",
7165
- title,
7166
- to: token
7167
- });
7168
- }
7169
- return { invalidTokens, messages };
7170
- }
7171
- function processChunkResults(tickets, chunk) {
7172
- let successCount = 0;
7173
- const failedTokens = [];
7174
- for (const [ticketIndex, ticket] of tickets.entries()) {
7175
- if (ticket.status === "error") {
7176
- const message = chunk[ticketIndex];
7177
- if (message) {
7178
- const tokens = extractTokensFromMessage(message);
7179
- if (ticket.details?.error === "DeviceNotRegistered") {
7180
- failedTokens.push(...tokens);
7181
- }
7182
- console.log("Push notification error", {
7183
- error: ticket.details?.error,
7184
- tokens
7185
- });
7186
- }
7187
- } else {
7188
- successCount++;
7189
- }
7190
- }
7191
- return { failedTokens, successCount };
7192
- }
7193
- async function sendChunk(chunk, chunkIndex) {
7194
- try {
7195
- const tickets = await expo.sendPushNotificationsAsync(chunk);
7196
- const { successCount, failedTokens } = processChunkResults(tickets, chunk);
7197
- console.log(
7198
- `Chunk ${chunkIndex + 1}: Sent ${successCount}/${chunk.length} notifications successfully`
7199
- );
7200
- return { failedTokens, successCount };
7201
- } catch (error) {
7202
- console.log("Error sending Expo push notification chunk", {
7203
- chunkIndex,
7204
- chunkSize: chunk.length,
7205
- error: error instanceof Error ? error.message : String(error)
7206
- });
7207
- return { failedTokens: [], successCount: 0 };
7208
- }
7209
- }
7210
- async function sendPushNotifications({
7211
- data,
7212
- message,
7213
- title,
7214
- userIds
7215
- }) {
7216
- const pushTokens = await PushTokenModel.find({ userId: { $in: userIds } });
7217
- const expoTokens = pushTokens.map((token) => token.token);
7218
- if (!data) return;
7219
- const { messages, invalidTokens } = createPushMessages({
7220
- data,
7221
- message,
7222
- title,
7223
- tokens: expoTokens
7224
- });
7225
- if (invalidTokens.length > 0) {
7226
- console.log(`Found ${invalidTokens.length} invalid push tokens`);
7227
- }
7228
- if (messages.length === 0) {
7229
- console.log("No valid messages to send after filtering tokens");
7230
- return;
7231
- }
7232
- const chunks = expo.chunkPushNotifications(messages);
7233
- let totalSuccessCount = 0;
7234
- const allFailedTokens = [];
7235
- for (const [chunkIndex, chunk] of chunks.entries()) {
7236
- const { successCount, failedTokens } = await sendChunk(
7237
- chunk,
7238
- chunkIndex + 1
7239
- );
7240
- totalSuccessCount += successCount;
7241
- allFailedTokens.push(...failedTokens);
7242
- }
7243
- console.log(
7244
- `Sent push notification to ${totalSuccessCount}/${messages.length} tokens across ${chunks.length} chunks`
7245
- );
7246
- if (allFailedTokens.length > 0) {
7247
- console.log(`Found ${allFailedTokens.length} failed push tokens`);
7248
- }
7249
- }
7250
-
7251
7141
  // src/storage/index.ts
7252
7142
  var SAVED_PASSWORD_KEY = "savedPassword";
7253
7143
  var SAVED_EMAIL_KEY = "savedEmail";
@@ -7390,7 +7280,6 @@ var fonts = {
7390
7280
  requirementsOptions,
7391
7281
  resetPasswordFields,
7392
7282
  saveNotificationsInDb,
7393
- sendPushNotifications,
7394
7283
  socialMediaFields,
7395
7284
  sortDatesChronologically,
7396
7285
  stallTypeOptions,