@deallony/shared 1.2.79 → 1.2.81

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 (104) hide show
  1. package/dist/cjs/constants/events/EventBirthday.d.ts +2 -0
  2. package/dist/cjs/constants/events/EventBirthday.js +12 -0
  3. package/dist/cjs/constants/events/EventCustomization.d.ts +90 -0
  4. package/dist/cjs/constants/events/EventCustomization.js +72 -0
  5. package/dist/cjs/constants/events/EventDressCode.d.ts +65 -0
  6. package/dist/cjs/constants/events/EventDressCode.js +56 -0
  7. package/dist/cjs/constants/events/EventOccasion.d.ts +63 -0
  8. package/dist/cjs/constants/events/EventOccasion.js +242 -0
  9. package/dist/cjs/constants/events/EventPreview.d.ts +9 -0
  10. package/dist/cjs/constants/events/EventPreview.js +11 -1
  11. package/dist/cjs/constants/events/EventTemplate.d.ts +518 -10
  12. package/dist/cjs/constants/events/EventTemplate.js +81 -11
  13. package/dist/cjs/constants/events/EventTextPolicy.d.ts +7 -0
  14. package/dist/cjs/constants/events/EventTextPolicy.js +66 -0
  15. package/dist/cjs/constants/events/EventType.d.ts +273 -8
  16. package/dist/cjs/constants/events/EventType.js +38 -2
  17. package/dist/cjs/constants/events/EventVisibility.d.ts +19 -0
  18. package/dist/cjs/constants/events/EventVisibility.js +18 -0
  19. package/dist/cjs/constants/events/EventWedding.js +3 -0
  20. package/dist/cjs/constants/events/EventWeddingReligion.d.ts +72 -0
  21. package/dist/cjs/constants/events/EventWeddingReligion.js +126 -0
  22. package/dist/cjs/constants/events/index.d.ts +7 -0
  23. package/dist/cjs/constants/events/index.js +7 -0
  24. package/dist/cjs/constants/payments/PaymentStatus.d.ts +1 -1
  25. package/dist/cjs/constants/routes/app.d.ts +42 -0
  26. package/dist/cjs/constants/routes/app.js +14 -0
  27. package/dist/cjs/dto/events/EventBirthday.dto.d.ts +3 -0
  28. package/dist/cjs/dto/events/EventBirthday.dto.js +2 -0
  29. package/dist/cjs/dto/events/EventOccasion.dto.d.ts +3 -0
  30. package/dist/cjs/dto/events/EventOccasion.dto.js +2 -0
  31. package/dist/cjs/dto/events/index.d.ts +2 -0
  32. package/dist/cjs/dto/events/index.js +2 -0
  33. package/dist/cjs/schema/communication/ai-conversation.schema.d.ts +156 -0
  34. package/dist/cjs/schema/communication/ai-conversation.schema.js +57 -1
  35. package/dist/cjs/schema/communication/support-ticket.schema.d.ts +136 -0
  36. package/dist/cjs/schema/communication/support-ticket.schema.js +47 -2
  37. package/dist/cjs/schema/events/Event.schema.d.ts +399 -0
  38. package/dist/cjs/schema/events/Event.schema.js +67 -1
  39. package/dist/cjs/schema/events/EventBirthday.schema.d.ts +19 -0
  40. package/dist/cjs/schema/events/EventBirthday.schema.js +17 -0
  41. package/dist/cjs/schema/events/EventOccasion.schema.d.ts +22 -0
  42. package/dist/cjs/schema/events/EventOccasion.schema.js +31 -0
  43. package/dist/cjs/schema/events/EventRsvp.schema.d.ts +4 -0
  44. package/dist/cjs/schema/events/EventRsvp.schema.js +1 -0
  45. package/dist/cjs/schema/events/EventTimeline.schema.d.ts +5 -0
  46. package/dist/cjs/schema/events/EventTimeline.schema.js +14 -1
  47. package/dist/cjs/schema/events/EventWedding.schema.d.ts +32 -0
  48. package/dist/cjs/schema/events/EventWedding.schema.js +11 -0
  49. package/dist/cjs/schema/events/index.d.ts +2 -0
  50. package/dist/cjs/schema/events/index.js +2 -0
  51. package/dist/cjs/types/communication/Notification.d.ts +13 -2
  52. package/dist/cjs/types/communication/Notification.js +8 -0
  53. package/dist/cjs/types/events/Event.d.ts +18 -1
  54. package/dist/cjs/types/events/EventBirthday.d.ts +17 -0
  55. package/dist/cjs/types/events/EventBirthday.js +2 -0
  56. package/dist/cjs/types/events/EventCustomization.d.ts +20 -0
  57. package/dist/cjs/types/events/EventCustomization.js +2 -0
  58. package/dist/cjs/types/events/EventDressCode.d.ts +13 -0
  59. package/dist/cjs/types/events/EventDressCode.js +2 -0
  60. package/dist/cjs/types/events/EventOccasion.d.ts +24 -0
  61. package/dist/cjs/types/events/EventOccasion.js +2 -0
  62. package/dist/cjs/types/events/EventRsvp.d.ts +2 -0
  63. package/dist/cjs/types/events/EventTimeline.d.ts +2 -0
  64. package/dist/cjs/types/events/EventWedding.d.ts +7 -0
  65. package/dist/cjs/types/events/index.d.ts +4 -0
  66. package/dist/cjs/types/events/index.js +4 -0
  67. package/dist/cjs/types/index.d.ts +3 -0
  68. package/dist/cjs/types/index.js +5 -2
  69. package/dist/cjs/types/user/SavedSearch.d.ts +38 -0
  70. package/dist/cjs/types/user/SavedSearch.js +11 -0
  71. package/dist/esm/constants/events/EventBirthday.js +9 -0
  72. package/dist/esm/constants/events/EventCustomization.js +65 -0
  73. package/dist/esm/constants/events/EventDressCode.js +49 -0
  74. package/dist/esm/constants/events/EventOccasion.js +235 -0
  75. package/dist/esm/constants/events/EventPreview.js +9 -0
  76. package/dist/esm/constants/events/EventTemplate.js +78 -10
  77. package/dist/esm/constants/events/EventTextPolicy.js +61 -0
  78. package/dist/esm/constants/events/EventType.js +34 -1
  79. package/dist/esm/constants/events/EventVisibility.js +15 -0
  80. package/dist/esm/constants/events/EventWedding.js +3 -0
  81. package/dist/esm/constants/events/EventWeddingReligion.js +118 -0
  82. package/dist/esm/constants/events/index.js +7 -0
  83. package/dist/esm/constants/routes/app.js +14 -0
  84. package/dist/esm/dto/events/EventBirthday.dto.js +1 -0
  85. package/dist/esm/dto/events/EventOccasion.dto.js +1 -0
  86. package/dist/esm/dto/events/index.js +2 -0
  87. package/dist/esm/schema/communication/ai-conversation.schema.js +56 -0
  88. package/dist/esm/schema/communication/support-ticket.schema.js +46 -1
  89. package/dist/esm/schema/events/Event.schema.js +67 -1
  90. package/dist/esm/schema/events/EventBirthday.schema.js +14 -0
  91. package/dist/esm/schema/events/EventOccasion.schema.js +28 -0
  92. package/dist/esm/schema/events/EventRsvp.schema.js +1 -0
  93. package/dist/esm/schema/events/EventTimeline.schema.js +14 -1
  94. package/dist/esm/schema/events/EventWedding.schema.js +11 -0
  95. package/dist/esm/schema/events/index.js +2 -0
  96. package/dist/esm/types/communication/Notification.js +8 -0
  97. package/dist/esm/types/events/EventBirthday.js +1 -0
  98. package/dist/esm/types/events/EventCustomization.js +1 -0
  99. package/dist/esm/types/events/EventDressCode.js +1 -0
  100. package/dist/esm/types/events/EventOccasion.js +1 -0
  101. package/dist/esm/types/events/index.js +4 -0
  102. package/dist/esm/types/index.js +3 -0
  103. package/dist/esm/types/user/SavedSearch.js +8 -0
  104. package/package.json +1 -1
@@ -1,8 +1,15 @@
1
1
  export * from "./Event";
2
2
  export * from "./EventType";
3
3
  export * from "./EventWedding";
4
+ export * from "./EventBirthday";
5
+ export * from "./EventOccasion";
4
6
  export * from "./EventTemplate";
5
7
  export * from "./EventTimeline";
6
8
  export * from "./EventInvitationScanType";
7
9
  export * from "./EventPricing";
8
10
  export * from "./EventPreview";
11
+ export * from "./EventCustomization";
12
+ export * from "./EventVisibility";
13
+ export * from "./EventWeddingReligion";
14
+ export * from "./EventTextPolicy";
15
+ export * from "./EventDressCode";
@@ -17,8 +17,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./Event"), exports);
18
18
  __exportStar(require("./EventType"), exports);
19
19
  __exportStar(require("./EventWedding"), exports);
20
+ __exportStar(require("./EventBirthday"), exports);
21
+ __exportStar(require("./EventOccasion"), exports);
20
22
  __exportStar(require("./EventTemplate"), exports);
21
23
  __exportStar(require("./EventTimeline"), exports);
22
24
  __exportStar(require("./EventInvitationScanType"), exports);
23
25
  __exportStar(require("./EventPricing"), exports);
24
26
  __exportStar(require("./EventPreview"), exports);
27
+ __exportStar(require("./EventCustomization"), exports);
28
+ __exportStar(require("./EventVisibility"), exports);
29
+ __exportStar(require("./EventWeddingReligion"), exports);
30
+ __exportStar(require("./EventTextPolicy"), exports);
31
+ __exportStar(require("./EventDressCode"), exports);
@@ -24,7 +24,7 @@ export declare const PaymentStatuses: {
24
24
  export declare const PaymentStatusValues: [string, ...string[]];
25
25
  export type PaymentStatus = (typeof PaymentStatusValues)[number];
26
26
  export declare const PaymentStatusOptions: {
27
- value: "pending" | "approved" | "rejected";
27
+ value: "pending" | "rejected" | "approved";
28
28
  name: {
29
29
  readonly en: "Pending";
30
30
  readonly ar: "قيد الانتظار";
@@ -15,6 +15,19 @@ export declare const APP_ROUTES: {
15
15
  pathname: string;
16
16
  };
17
17
  };
18
+ readonly savedSearches: {
19
+ /** The user's saved ad searches ("بحثي المحفوظ") */
20
+ readonly list: () => {
21
+ pathname: string;
22
+ };
23
+ /** Opens a saved search's results with its new ads marked, and marks them seen */
24
+ readonly open: (id: number | string) => {
25
+ pathname: string;
26
+ params: {
27
+ id: string;
28
+ };
29
+ };
30
+ };
18
31
  readonly favorites: {
19
32
  readonly compare: (ad_ids: (number | string)[]) => {
20
33
  pathname: string;
@@ -412,6 +425,17 @@ export declare const APP_ROUTES: {
412
425
  id: string | number;
413
426
  };
414
427
  };
428
+ /** Every ad published under the company, for its members */
429
+ readonly ads: (id: number | string) => {
430
+ pathname: string;
431
+ params: {
432
+ id: string | number;
433
+ };
434
+ };
435
+ /** This week's most active companies (opened from the home strip) */
436
+ readonly ranking: () => {
437
+ pathname: string;
438
+ };
415
439
  };
416
440
  readonly venue: {
417
441
  readonly new: (companyId: number | string) => {
@@ -447,12 +471,30 @@ export declare const APP_ROUTES: {
447
471
  venue_id?: undefined;
448
472
  };
449
473
  };
474
+ /** A new personal event of one type (wedding, birthday), chosen on the start page */
475
+ readonly newOfType: (eventType: string) => {
476
+ pathname: string;
477
+ params: {
478
+ personal: string;
479
+ event_type: string;
480
+ };
481
+ };
450
482
  readonly start: () => {
451
483
  pathname: string;
452
484
  };
453
485
  readonly mine: () => {
454
486
  pathname: string;
455
487
  };
488
+ /** Upcoming public events (optionally of one venue) */
489
+ readonly upcoming: (venueId?: number | string) => {
490
+ pathname: string;
491
+ params: {
492
+ venue_id: string | number;
493
+ };
494
+ } | {
495
+ pathname: string;
496
+ params?: undefined;
497
+ };
456
498
  readonly publish: (id: number | string) => {
457
499
  pathname: string;
458
500
  params: {
@@ -10,6 +10,12 @@ exports.APP_ROUTES = {
10
10
  list: () => ({ pathname: "/notifications" }),
11
11
  settings: () => ({ pathname: "/notifications/settings" }),
12
12
  },
13
+ savedSearches: {
14
+ /** The user's saved ad searches ("بحثي المحفوظ") */
15
+ list: () => ({ pathname: "/saved-searches" }),
16
+ /** Opens a saved search's results with its new ads marked, and marks them seen */
17
+ open: (id) => ({ pathname: "/saved-searches/[id]", params: { id: String(id) } }),
18
+ },
13
19
  favorites: {
14
20
  compare: (ad_ids) => ({
15
21
  pathname: "/favorites/compare",
@@ -184,6 +190,10 @@ exports.APP_ROUTES = {
184
190
  details: (id) => ({ pathname: "/company/details/[id]", params: { id } }),
185
191
  /** Public profile with the company's ads */
186
192
  profile: (id) => ({ pathname: "/company/profile/[id]", params: { id } }),
193
+ /** Every ad published under the company, for its members */
194
+ ads: (id) => ({ pathname: "/company/ads/[id]", params: { id } }),
195
+ /** This week's most active companies (opened from the home strip) */
196
+ ranking: () => ({ pathname: "/company/ranking" }),
187
197
  },
188
198
  venue: {
189
199
  new: (companyId) => ({ pathname: "/venue/new", params: { company_id: companyId } }),
@@ -192,8 +202,12 @@ exports.APP_ROUTES = {
192
202
  },
193
203
  event: {
194
204
  new: (venueId) => venueId ? { pathname: "/event/new", params: { venue_id: venueId } } : { pathname: "/event/new", params: { personal: "1" } },
205
+ /** A new personal event of one type (wedding, birthday), chosen on the start page */
206
+ newOfType: (eventType) => ({ pathname: "/event/new", params: { personal: "1", event_type: eventType } }),
195
207
  start: () => ({ pathname: "/event/start" }),
196
208
  mine: () => ({ pathname: "/event/mine" }),
209
+ /** Upcoming public events (optionally of one venue) */
210
+ upcoming: (venueId) => venueId ? { pathname: "/event/upcoming", params: { venue_id: venueId } } : { pathname: "/event/upcoming" },
197
211
  publish: (id) => ({ pathname: "/event/publish/[id]", params: { id } }),
198
212
  edit: (id) => ({ pathname: "/event/new", params: { id } }),
199
213
  details: (id) => ({ pathname: "/event/details/[id]", params: { id } }),
@@ -0,0 +1,3 @@
1
+ import { z } from 'zod';
2
+ import { saveEventBirthdaySchema } from '../../schema/events/EventBirthday.schema';
3
+ export type SaveEventBirthdayDto = z.infer<typeof saveEventBirthdaySchema>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import { z } from 'zod';
2
+ import { saveEventOccasionSchema } from '../../schema/events/EventOccasion.schema';
3
+ export type SaveEventOccasionDto = z.infer<typeof saveEventOccasionSchema>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,4 +2,6 @@ export * from './Event.dto';
2
2
  export * from './EventRsvp.dto';
3
3
  export * from './EventTimeline.dto';
4
4
  export * from './EventWedding.dto';
5
+ export * from './EventBirthday.dto';
6
+ export * from './EventOccasion.dto';
5
7
  export * from './EventVenue.dto';
@@ -18,4 +18,6 @@ __exportStar(require("./Event.dto"), exports);
18
18
  __exportStar(require("./EventRsvp.dto"), exports);
19
19
  __exportStar(require("./EventTimeline.dto"), exports);
20
20
  __exportStar(require("./EventWedding.dto"), exports);
21
+ __exportStar(require("./EventBirthday.dto"), exports);
22
+ __exportStar(require("./EventOccasion.dto"), exports);
21
23
  __exportStar(require("./EventVenue.dto"), exports);
@@ -58,6 +58,8 @@ export declare const PotentialUserConversationEventSchema: z.ZodObject<{
58
58
  }, z.core.$strip>;
59
59
  export declare const AiConversationStatusSchema: z.ZodEnum<{
60
60
  starting: "starting";
61
+ awaiting_approval: "awaiting_approval";
62
+ scheduled: "scheduled";
61
63
  waiting_for_reply: "waiting_for_reply";
62
64
  chatting: "chatting";
63
65
  interested: "interested";
@@ -79,6 +81,8 @@ export declare const AiConversationListSchema: z.ZodObject<{
79
81
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
80
82
  statuses: z.ZodOptional<z.ZodArray<z.ZodEnum<{
81
83
  starting: "starting";
84
+ awaiting_approval: "awaiting_approval";
85
+ scheduled: "scheduled";
82
86
  waiting_for_reply: "waiting_for_reply";
83
87
  chatting: "chatting";
84
88
  interested: "interested";
@@ -100,6 +104,16 @@ export type MarketingSubjectType = z.infer<typeof MarketingSubjectTypeSchema>;
100
104
  export type AiConversationStatus = z.infer<typeof AiConversationStatusSchema>;
101
105
  export type AiConversationPurpose = z.infer<typeof AiConversationPurposeSchema>;
102
106
  export type AiConversationList = z.infer<typeof AiConversationListSchema>;
107
+ /** What a customer sent besides plain text: a voice note (transcribed when possible) or another file */
108
+ export type AiMessageMediaType = 'voice' | 'audio' | 'image' | 'video' | 'sticker' | 'document' | 'location' | 'contact';
109
+ /** done: content is the transcript; failed / too_long: not transcribed; none: not audio */
110
+ export type AiMessageTranscription = 'done' | 'failed' | 'too_long' | 'none';
111
+ export type AiMessageMedia = {
112
+ type: AiMessageMediaType;
113
+ /** Length of a voice note or audio file */
114
+ seconds?: number | null;
115
+ transcription: AiMessageTranscription;
116
+ };
103
117
  export type AiConversationListItem = {
104
118
  id: number;
105
119
  potential_user_id: number | null;
@@ -117,7 +131,15 @@ export type AiConversationListItem = {
117
131
  direction: 'inbound' | 'outbound';
118
132
  sender: 'user' | 'ai' | 'human';
119
133
  created_at: string;
134
+ /** Set when the customer sent a voice note or another file instead of text */
135
+ media?: AiMessageMedia | null;
120
136
  } | null;
137
+ /** AI drafts of this conversation waiting for an admin */
138
+ pending_draft_count?: number;
139
+ /** The customer wrote outside the sending hours: the AI answers at this time */
140
+ reply_after?: string | null;
141
+ /** The opening waits for the sending hours: it goes out at this time */
142
+ send_after?: string | null;
121
143
  /** Filled in by the marketplace from the potential user record. */
122
144
  potential_user?: {
123
145
  id: number;
@@ -134,8 +156,142 @@ export type AiConversationListResult = {
134
156
  /** Counts over all conversations matching purpose and search, not only this page. */
135
157
  status_counts: Record<AiConversationStatus, number>;
136
158
  active_count: number;
159
+ /** AI drafts waiting for an admin, over all conversations */
160
+ pending_approval_count?: number;
137
161
  };
138
162
  export type ConversationLanguage = z.infer<typeof ConversationLanguageSchema>;
139
163
  export type StartAiConversation = z.infer<typeof StartAiConversationSchema>;
140
164
  export type ConversationEventType = z.infer<typeof ConversationEventTypeSchema>;
141
165
  export type PotentialUserConversationEvent = z.infer<typeof PotentialUserConversationEventSchema>;
166
+ /** One switch for all AI conversations: when on, AI messages wait for an admin */
167
+ export declare const AiApprovalSettingsSchema: z.ZodObject<{
168
+ enabled: z.ZodBoolean;
169
+ }, z.core.$strip>;
170
+ /**
171
+ * pending: waiting for an admin. scheduled: ready, goes out when the sending hours open (send_after).
172
+ * sent: approved and sent. rejected: thrown away by an admin.
173
+ * outdated: the customer wrote again, so a newer draft replaced it. failed: approved but WhatsApp refused it.
174
+ */
175
+ export declare const AiDraftStatusSchema: z.ZodEnum<{
176
+ scheduled: "scheduled";
177
+ failed: "failed";
178
+ pending: "pending";
179
+ sent: "sent";
180
+ rejected: "rejected";
181
+ outdated: "outdated";
182
+ }>;
183
+ /** opening: first messages of a new chat. reply: answer to the customer. opt_out: goodbye after a stop request */
184
+ export declare const AiDraftKindSchema: z.ZodEnum<{
185
+ opening: "opening";
186
+ reply: "reply";
187
+ opt_out: "opt_out";
188
+ }>;
189
+ export declare const AiDraftListSchema: z.ZodObject<{
190
+ page: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
191
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
192
+ statuses: z.ZodOptional<z.ZodArray<z.ZodEnum<{
193
+ scheduled: "scheduled";
194
+ failed: "failed";
195
+ pending: "pending";
196
+ sent: "sent";
197
+ rejected: "rejected";
198
+ outdated: "outdated";
199
+ }>>>;
200
+ conversation_id: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
201
+ }, z.core.$strip>;
202
+ export declare const AiDraftDecisionSchema: z.ZodObject<{
203
+ draft_id: z.ZodCoercedNumber<unknown>;
204
+ action: z.ZodEnum<{
205
+ approve: "approve";
206
+ reject: "reject";
207
+ }>;
208
+ replies: z.ZodOptional<z.ZodArray<z.ZodString>>;
209
+ }, z.core.$strip>;
210
+ /** Sends a scheduled draft right away, ignoring the sending hours */
211
+ export declare const AiDraftSendNowSchema: z.ZodObject<{
212
+ draft_id: z.ZodCoercedNumber<unknown>;
213
+ }, z.core.$strip>;
214
+ export declare const AiDraftApproveAllSchema: z.ZodObject<{
215
+ draft_ids: z.ZodOptional<z.ZodArray<z.ZodCoercedNumber<unknown>>>;
216
+ }, z.core.$strip>;
217
+ export type AiApprovalSettings = z.infer<typeof AiApprovalSettingsSchema>;
218
+ export type AiDraftStatus = z.infer<typeof AiDraftStatusSchema>;
219
+ export type AiDraftKind = z.infer<typeof AiDraftKindSchema>;
220
+ export type AiDraftList = z.infer<typeof AiDraftListSchema>;
221
+ export type AiDraftDecision = z.infer<typeof AiDraftDecisionSchema>;
222
+ export type AiDraftApproveAll = z.infer<typeof AiDraftApproveAllSchema>;
223
+ export type AiDraftSendNow = z.infer<typeof AiDraftSendNowSchema>;
224
+ export type AiDraftItem = {
225
+ id: number;
226
+ conversation_id: number;
227
+ kind: AiDraftKind;
228
+ status: AiDraftStatus;
229
+ replies: string[];
230
+ /** Status change the AI asked for; applied only when the draft is sent */
231
+ event: ConversationEventType | null;
232
+ summary: string | null;
233
+ /** Support ticket the AI asked to open; opened only when the draft is sent */
234
+ ticket: {
235
+ title: string;
236
+ description: string;
237
+ category: string;
238
+ priority: string;
239
+ } | null;
240
+ error: string | null;
241
+ created_at: string;
242
+ decided_at: string | null;
243
+ /** When a scheduled draft goes out (the next opening of the sending hours) */
244
+ send_after?: string | null;
245
+ conversation: {
246
+ id: number;
247
+ potential_user_id: number | null;
248
+ phone: string;
249
+ purpose: AiConversationPurpose;
250
+ subject_type: string;
251
+ status: AiConversationStatus;
252
+ /** Latest messages for context, oldest first */
253
+ recent_messages: Array<{
254
+ direction: 'inbound' | 'outbound';
255
+ sender: 'user' | 'ai' | 'human';
256
+ content: string;
257
+ created_at: string;
258
+ media?: AiMessageMedia | null;
259
+ }>;
260
+ };
261
+ /** Filled in by the marketplace from the potential user record. */
262
+ potential_user?: {
263
+ id: number;
264
+ name: string | null;
265
+ } | null;
266
+ };
267
+ export type AiDraftListResult = {
268
+ items: AiDraftItem[];
269
+ page: number;
270
+ limit: number;
271
+ total: number;
272
+ total_pages: number;
273
+ pending_count: number;
274
+ };
275
+ /**
276
+ * One setting for all AI marketing conversations. Times are on each customer's own clock,
277
+ * picked from the phone code (+963 Syria, +971 UAE); other numbers use default_timezone.
278
+ * end before start means the hours cross midnight (for example 20:00 to 02:00).
279
+ */
280
+ export declare const AiSendWindowSettingsSchema: z.ZodObject<{
281
+ enabled: z.ZodBoolean;
282
+ start: z.ZodString;
283
+ end: z.ZodString;
284
+ default_timezone: z.ZodString;
285
+ }, z.core.$strip>;
286
+ export type AiSendWindowSettings = z.infer<typeof AiSendWindowSettingsSchema>;
287
+ /** The setting plus whether the hours are open now, per time zone the customers are in */
288
+ export type AiSendWindowStatus = AiSendWindowSettings & {
289
+ /** True when the hours are open in at least one customer time zone (or the setting is off) */
290
+ open_now: boolean;
291
+ zones: Array<{
292
+ timezone: string;
293
+ label: string;
294
+ open_now: boolean;
295
+ next_open_at: string | null;
296
+ }>;
297
+ };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AiConversationListSchema = exports.AI_CONVERSATION_ACTIVE_STATUSES = exports.AiConversationPurposeSchema = exports.AiConversationStatusSchema = exports.PotentialUserConversationEventSchema = exports.ConversationEventTypeSchema = exports.StartAiConversationSchema = exports.ConversationLanguageSchema = exports.MarketingSubjectTypeSchema = void 0;
3
+ exports.AiSendWindowSettingsSchema = exports.AiDraftApproveAllSchema = exports.AiDraftSendNowSchema = exports.AiDraftDecisionSchema = exports.AiDraftListSchema = exports.AiDraftKindSchema = exports.AiDraftStatusSchema = exports.AiApprovalSettingsSchema = exports.AiConversationListSchema = exports.AI_CONVERSATION_ACTIVE_STATUSES = exports.AiConversationPurposeSchema = exports.AiConversationStatusSchema = exports.PotentialUserConversationEventSchema = exports.ConversationEventTypeSchema = exports.StartAiConversationSchema = exports.ConversationLanguageSchema = exports.MarketingSubjectTypeSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.MarketingSubjectTypeSchema = zod_1.z.enum([
6
6
  'motors',
@@ -41,6 +41,10 @@ exports.PotentialUserConversationEventSchema = zod_1.z.object({
41
41
  });
42
42
  exports.AiConversationStatusSchema = zod_1.z.enum([
43
43
  'starting',
44
+ /** The opening is written and waits for an admin to approve it */
45
+ 'awaiting_approval',
46
+ /** Waits for the sending hours to open: the opening, an approved draft or the AI's reply goes out then */
47
+ 'scheduled',
44
48
  'waiting_for_reply',
45
49
  'chatting',
46
50
  'interested',
@@ -55,6 +59,8 @@ exports.AiConversationPurposeSchema = zod_1.z.enum(['marketing', 'support']);
55
59
  /** Statuses of a conversation that is still open with the customer. */
56
60
  exports.AI_CONVERSATION_ACTIVE_STATUSES = [
57
61
  'starting',
62
+ 'awaiting_approval',
63
+ 'scheduled',
58
64
  'waiting_for_reply',
59
65
  'chatting',
60
66
  'interested',
@@ -68,3 +74,53 @@ exports.AiConversationListSchema = zod_1.z.object({
68
74
  purpose: exports.AiConversationPurposeSchema.optional(),
69
75
  search: zod_1.z.string().trim().max(100).optional(),
70
76
  });
77
+ /* ---------- Admin approval before AI messages are sent ---------- */
78
+ /** One switch for all AI conversations: when on, AI messages wait for an admin */
79
+ exports.AiApprovalSettingsSchema = zod_1.z.object({
80
+ enabled: zod_1.z.boolean(),
81
+ });
82
+ /**
83
+ * pending: waiting for an admin. scheduled: ready, goes out when the sending hours open (send_after).
84
+ * sent: approved and sent. rejected: thrown away by an admin.
85
+ * outdated: the customer wrote again, so a newer draft replaced it. failed: approved but WhatsApp refused it.
86
+ */
87
+ exports.AiDraftStatusSchema = zod_1.z.enum(['pending', 'scheduled', 'sent', 'rejected', 'outdated', 'failed']);
88
+ /** opening: first messages of a new chat. reply: answer to the customer. opt_out: goodbye after a stop request */
89
+ exports.AiDraftKindSchema = zod_1.z.enum(['opening', 'reply', 'opt_out']);
90
+ exports.AiDraftListSchema = zod_1.z.object({
91
+ page: zod_1.z.coerce.number().int().positive().default(1),
92
+ limit: zod_1.z.coerce.number().int().min(1).max(100).default(20),
93
+ statuses: zod_1.z.array(exports.AiDraftStatusSchema).max(5).optional(),
94
+ conversation_id: zod_1.z.coerce.number().int().positive().optional(),
95
+ });
96
+ exports.AiDraftDecisionSchema = zod_1.z.object({
97
+ draft_id: zod_1.z.coerce.number().int().positive(),
98
+ action: zod_1.z.enum(['approve', 'reject']),
99
+ /** Edited messages to send instead of the AI's; only with approve */
100
+ replies: zod_1.z.array(zod_1.z.string().trim().min(1).max(4000)).min(1).max(4).optional(),
101
+ });
102
+ /** Sends a scheduled draft right away, ignoring the sending hours */
103
+ exports.AiDraftSendNowSchema = zod_1.z.object({
104
+ draft_id: zod_1.z.coerce.number().int().positive(),
105
+ });
106
+ exports.AiDraftApproveAllSchema = zod_1.z.object({
107
+ /** Approve only these drafts; all pending drafts when left out */
108
+ draft_ids: zod_1.z.array(zod_1.z.coerce.number().int().positive()).max(100).optional(),
109
+ });
110
+ /* ---------- Sending hours: AI marketing messages go out only between start and end ---------- */
111
+ const ClockTimeSchema = zod_1.z
112
+ .string()
113
+ .trim()
114
+ .regex(/^([01]\d|2[0-3]):[0-5]\d$/, 'Use HH:MM, 24-hour clock');
115
+ /**
116
+ * One setting for all AI marketing conversations. Times are on each customer's own clock,
117
+ * picked from the phone code (+963 Syria, +971 UAE); other numbers use default_timezone.
118
+ * end before start means the hours cross midnight (for example 20:00 to 02:00).
119
+ */
120
+ exports.AiSendWindowSettingsSchema = zod_1.z.object({
121
+ enabled: zod_1.z.boolean(),
122
+ start: ClockTimeSchema,
123
+ end: ClockTimeSchema,
124
+ /** IANA time zone, for example Asia/Damascus */
125
+ default_timezone: zod_1.z.string().trim().min(1).max(60),
126
+ });
@@ -17,10 +17,20 @@ export declare const SupportTicketPrioritySchema: z.ZodEnum<{
17
17
  export declare const SupportTicketCategorySchema: z.ZodEnum<{
18
18
  payment: "payment";
19
19
  other: "other";
20
+ event: "event";
20
21
  technical_issue: "technical_issue";
21
22
  account: "account";
22
23
  advertisement: "advertisement";
23
24
  complaint: "complaint";
25
+ kyc: "kyc";
26
+ login: "login";
27
+ }>;
28
+ export declare const SupportTicketSourceSchema: z.ZodEnum<{
29
+ admin: "admin";
30
+ ai: "ai";
31
+ app: "app";
32
+ guest: "guest";
33
+ report: "report";
24
34
  }>;
25
35
  export declare const SupportTicketCreateSchema: z.ZodObject<{
26
36
  title: z.ZodString;
@@ -28,10 +38,13 @@ export declare const SupportTicketCreateSchema: z.ZodObject<{
28
38
  category: z.ZodDefault<z.ZodEnum<{
29
39
  payment: "payment";
30
40
  other: "other";
41
+ event: "event";
31
42
  technical_issue: "technical_issue";
32
43
  account: "account";
33
44
  advertisement: "advertisement";
34
45
  complaint: "complaint";
46
+ kyc: "kyc";
47
+ login: "login";
35
48
  }>>;
36
49
  priority: z.ZodDefault<z.ZodEnum<{
37
50
  low: "low";
@@ -52,10 +65,13 @@ export declare const SupportTicketAiCreateSchema: z.ZodObject<{
52
65
  category: z.ZodDefault<z.ZodEnum<{
53
66
  payment: "payment";
54
67
  other: "other";
68
+ event: "event";
55
69
  technical_issue: "technical_issue";
56
70
  account: "account";
57
71
  advertisement: "advertisement";
58
72
  complaint: "complaint";
73
+ kyc: "kyc";
74
+ login: "login";
59
75
  }>>;
60
76
  priority: z.ZodDefault<z.ZodEnum<{
61
77
  low: "low";
@@ -94,6 +110,14 @@ export declare const SupportTicketListSchema: z.ZodObject<{
94
110
  urgent: "urgent";
95
111
  }>>;
96
112
  search: z.ZodOptional<z.ZodString>;
113
+ source: z.ZodOptional<z.ZodEnum<{
114
+ admin: "admin";
115
+ ai: "ai";
116
+ app: "app";
117
+ guest: "guest";
118
+ report: "report";
119
+ }>>;
120
+ screen: z.ZodOptional<z.ZodString>;
97
121
  }, z.core.$strip>;
98
122
  export declare const SupportTicketStatusUpdateSchema: z.ZodObject<{
99
123
  id: z.ZodNumber;
@@ -117,3 +141,115 @@ export declare const SupportTicketReplySchema: z.ZodObject<{
117
141
  }, z.core.$strip>;
118
142
  export type SupportTicketCreate = z.infer<typeof SupportTicketCreateSchema>;
119
143
  export type SupportTicketAiCreate = z.infer<typeof SupportTicketAiCreateSchema>;
144
+ export declare const SupportReportScreenSchema: z.ZodEnum<{
145
+ "auth.login": "auth.login";
146
+ kyc: "kyc";
147
+ "event.new": "event.new";
148
+ "ad.new": "ad.new";
149
+ }>;
150
+ export declare const SupportReportReasonSchema: z.ZodEnum<{
151
+ other: "other";
152
+ error_message: "error_message";
153
+ blocked: "blocked";
154
+ slow: "slow";
155
+ }>;
156
+ export declare const SupportReportAttachmentSchema: z.ZodObject<{
157
+ url: z.ZodString;
158
+ id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
159
+ mimetype: z.ZodOptional<z.ZodNullable<z.ZodString>>;
160
+ width: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
161
+ height: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
162
+ }, z.core.$strip>;
163
+ export declare const SupportReportRequestLogSchema: z.ZodObject<{
164
+ at: z.ZodString;
165
+ method: z.ZodString;
166
+ path: z.ZodString;
167
+ status: z.ZodNullable<z.ZodNumber>;
168
+ ms: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
169
+ message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
170
+ }, z.core.$strip>;
171
+ export declare const SupportReportErrorLogSchema: z.ZodObject<{
172
+ at: z.ZodString;
173
+ source: z.ZodString;
174
+ message: z.ZodString;
175
+ }, z.core.$strip>;
176
+ export declare const SupportReportContextSchema: z.ZodObject<{
177
+ screen: z.ZodOptional<z.ZodObject<{
178
+ route: z.ZodString;
179
+ step: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
180
+ ids: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>>;
181
+ error_fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
182
+ }, z.core.$strip>>;
183
+ device: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
184
+ app: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
185
+ requests: z.ZodOptional<z.ZodArray<z.ZodObject<{
186
+ at: z.ZodString;
187
+ method: z.ZodString;
188
+ path: z.ZodString;
189
+ status: z.ZodNullable<z.ZodNumber>;
190
+ ms: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
191
+ message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
192
+ }, z.core.$strip>>>;
193
+ errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
194
+ at: z.ZodString;
195
+ source: z.ZodString;
196
+ message: z.ZodString;
197
+ }, z.core.$strip>>>;
198
+ }, z.core.$loose>;
199
+ export declare const SupportReportCreateSchema: z.ZodObject<{
200
+ description: z.ZodString;
201
+ screen: z.ZodEnum<{
202
+ "auth.login": "auth.login";
203
+ kyc: "kyc";
204
+ "event.new": "event.new";
205
+ "ad.new": "ad.new";
206
+ }>;
207
+ reason: z.ZodDefault<z.ZodEnum<{
208
+ other: "other";
209
+ error_message: "error_message";
210
+ blocked: "blocked";
211
+ slow: "slow";
212
+ }>>;
213
+ phone: z.ZodOptional<z.ZodNullable<z.ZodString>>;
214
+ device_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
215
+ platform: z.ZodOptional<z.ZodNullable<z.ZodString>>;
216
+ app_version: z.ZodOptional<z.ZodNullable<z.ZodString>>;
217
+ ad_id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
218
+ context: z.ZodOptional<z.ZodNullable<z.ZodObject<{
219
+ screen: z.ZodOptional<z.ZodObject<{
220
+ route: z.ZodString;
221
+ step: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
222
+ ids: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>>;
223
+ error_fields: z.ZodOptional<z.ZodArray<z.ZodString>>;
224
+ }, z.core.$strip>>;
225
+ device: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
226
+ app: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
227
+ requests: z.ZodOptional<z.ZodArray<z.ZodObject<{
228
+ at: z.ZodString;
229
+ method: z.ZodString;
230
+ path: z.ZodString;
231
+ status: z.ZodNullable<z.ZodNumber>;
232
+ ms: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
233
+ message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
234
+ }, z.core.$strip>>>;
235
+ errors: z.ZodOptional<z.ZodArray<z.ZodObject<{
236
+ at: z.ZodString;
237
+ source: z.ZodString;
238
+ message: z.ZodString;
239
+ }, z.core.$strip>>>;
240
+ }, z.core.$loose>>>;
241
+ attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
242
+ url: z.ZodString;
243
+ id: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
244
+ mimetype: z.ZodOptional<z.ZodNullable<z.ZodString>>;
245
+ width: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
246
+ height: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
247
+ }, z.core.$strip>>>;
248
+ }, z.core.$strip>;
249
+ export type SupportReportScreen = z.infer<typeof SupportReportScreenSchema>;
250
+ export type SupportReportReason = z.infer<typeof SupportReportReasonSchema>;
251
+ export type SupportReportAttachment = z.infer<typeof SupportReportAttachmentSchema>;
252
+ export type SupportReportRequestLog = z.infer<typeof SupportReportRequestLogSchema>;
253
+ export type SupportReportErrorLog = z.infer<typeof SupportReportErrorLogSchema>;
254
+ export type SupportReportContext = z.infer<typeof SupportReportContextSchema>;
255
+ export type SupportReportCreate = z.infer<typeof SupportReportCreateSchema>;