@infuro/cms-core 1.0.46 → 1.0.47

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 (58) hide show
  1. package/dist/admin.cjs +3420 -2702
  2. package/dist/admin.d.cts +18 -4
  3. package/dist/admin.d.ts +18 -4
  4. package/dist/admin.js +2328 -1612
  5. package/dist/api.cjs +37 -38
  6. package/dist/api.d.cts +9 -3
  7. package/dist/api.d.ts +9 -3
  8. package/dist/api.js +5 -6
  9. package/dist/auth.cjs +55 -51
  10. package/dist/auth.d.cts +5 -3
  11. package/dist/auth.d.ts +5 -3
  12. package/dist/auth.js +3 -3
  13. package/dist/{chunk-KFFB6EMZ.js → chunk-2HU5R2JE.js} +2 -0
  14. package/dist/chunk-2IAXTKQN.cjs +19 -0
  15. package/dist/{chunk-SPQFNIYJ.cjs → chunk-4PMK3RNA.cjs} +2 -0
  16. package/dist/{chunk-X6UQFV4X.cjs → chunk-77NUXO6A.cjs} +14 -12
  17. package/dist/chunk-EIZKW2PF.js +13 -0
  18. package/dist/{chunk-X47PBV4I.js → chunk-JE22VP6S.js} +1 -0
  19. package/dist/{chunk-DN65KDIA.js → chunk-JIWUVQ6B.js} +14 -13
  20. package/dist/{chunk-HT5DI3XW.cjs → chunk-KOTXDSQB.cjs} +1 -0
  21. package/dist/{chunk-TCSGFAWB.cjs → chunk-LMJ7RKPF.cjs} +1188 -3
  22. package/dist/{chunk-FBKDMRQL.cjs → chunk-Q3HQEM4R.cjs} +6 -6
  23. package/dist/{chunk-NBY4NVTY.cjs → chunk-VUQFARRT.cjs} +7 -7
  24. package/dist/{chunk-UKC3HYXI.js → chunk-W42UZLQO.js} +1377 -559
  25. package/dist/{chunk-UDVLFVEC.cjs → chunk-XUCKZPML.cjs} +1448 -630
  26. package/dist/{chunk-57O3HZPG.js → chunk-YC4NUZCS.js} +1 -1
  27. package/dist/{chunk-CRYKVJTO.js → chunk-YXH2UUEZ.js} +1179 -3
  28. package/dist/{chunk-SF2XKMCI.js → chunk-ZF2RQWXB.js} +1 -1
  29. package/dist/{emit-order-notification-trigger-IVLWKKJL.js → emit-order-notification-trigger-6XX7LSC4.js} +1 -1
  30. package/dist/{emit-order-notification-trigger-D2N3KFHL.cjs → emit-order-notification-trigger-NASG7ZEO.cjs} +3 -3
  31. package/dist/{event-order-defaults-EMWBIGL3.cjs → event-order-defaults-7Z3UZOEH.cjs} +9 -9
  32. package/dist/{event-order-defaults-SDRNAZHC.js → event-order-defaults-XQ3IDPD7.js} +1 -1
  33. package/dist/hooks.cjs +43 -0
  34. package/dist/hooks.d.cts +10 -1
  35. package/dist/hooks.d.ts +10 -1
  36. package/dist/hooks.js +39 -1
  37. package/dist/index.cjs +414 -310
  38. package/dist/index.d.cts +51 -17
  39. package/dist/index.d.ts +51 -17
  40. package/dist/index.js +114 -12
  41. package/dist/migrations/1782200000000-VendorTeamProfiles.ts +233 -0
  42. package/dist/migrations/1782300000000-AddTypeToOrderNotificationBindings.ts +75 -0
  43. package/dist/{order-notification-dispatcher-ZJZB2HUN.js → order-notification-dispatcher-6WNG24NY.js} +1 -2
  44. package/dist/{order-notification-dispatcher-SBQAMM5V.cjs → order-notification-dispatcher-6XSU3AR7.cjs} +3 -4
  45. package/dist/{rbac-debug-db-2SGNLANF.js → rbac-debug-db-6EMIVMGF.js} +1 -1
  46. package/dist/{rbac-debug-db-4Z6A425H.cjs → rbac-debug-db-6PWTLBEL.cjs} +2 -2
  47. package/dist/theme.cjs +6 -1
  48. package/dist/theme.d.cts +4 -1
  49. package/dist/theme.d.ts +4 -1
  50. package/dist/theme.js +3 -1
  51. package/package.json +1 -1
  52. package/src/admin/admin.css +7 -0
  53. package/dist/chunk-7PMHZRF3.cjs +0 -872
  54. package/dist/chunk-CQHXW4TR.js +0 -107
  55. package/dist/chunk-GUSHM5HN.js +0 -862
  56. package/dist/chunk-XMRMZ6NQ.cjs +0 -109
  57. package/dist/send-order-placed-emails-B5ZVJT7T.cjs +0 -15
  58. package/dist/send-order-placed-emails-WPI37KRZ.js +0 -6
@@ -1,15 +1,14 @@
1
1
  import { validateInventoryForConfirmedOrderLines, orderStatusHoldsStock, reconcileOrderInventoryBetweenSnapshots, orderInventorySnapshotFromRow, validateInventoryForOrderBecomingConfirmed } from './chunk-3K5AIEIZ.js';
2
2
  import { retireSoftDeletedUniqueValue, activeUniqueValueExists } from './chunk-DBPSJYLZ.js';
3
- import { isWhatsAppPluginEnabled, mergeWhatsAppConfigLayers, whatsAppConfigured, WhatsAppService, registerWhatsAppQueueProcessor, initWhatsappTriggerDispatcher } from './chunk-GUSHM5HN.js';
4
- import { resolveChatEmailToolSettings, CHAT_EMAIL_LOG, detectChatLeadIntent, parseIntentRecipientEmails, sendChatLeadEmail, buildTranscriptForLeadEmail, buildChatbotSystemPromptWithEmailTool, parseEmailRecipientsFromConfig, emailPlugin } from './chunk-CRYKVJTO.js';
3
+ import { resolveChatEmailToolSettings, CHAT_EMAIL_LOG, detectChatLeadIntent, parseIntentRecipientEmails, sendChatLeadEmail, buildTranscriptForLeadEmail, buildChatbotSystemPromptWithEmailTool, parseEmailRecipientsFromConfig, isWhatsAppPluginEnabled, mergeWhatsAppConfigLayers, whatsAppConfigured, WhatsAppService, registerWhatsAppQueueProcessor, emailPlugin, initWhatsappTriggerDispatcher } from './chunk-YXH2UUEZ.js';
5
4
  import { inviteStatusForActivation } from './chunk-JXF23MPG.js';
6
5
  import { queueEmail, queueVendorOnboardEmails, registerEmailQueueProcessor } from './chunk-L3525VXI.js';
7
6
  import { mergeEmailLayoutCompanyDetails, unwrapErpReadData, mapErpPayloadToFulfillment, extractChildOrderRefsFromSalePayload, mapErpPayloadToInvoiceNumber, streamOrderInvoicePdf } from './chunk-2KUCQVAQ.js';
8
7
  import { getSmsTemplateDefault, SMS_MESSAGE_TEMPLATE_DEFAULTS } from './chunk-MQBT33IV.js';
9
- import { EVENT_ORDER_MESSAGE_TEMPLATE_DEFAULTS, EVENT_ORDER_TEMPLATE_KEY, EVENT_ORDER_TEMPLATE_VARIABLES } from './chunk-KFFB6EMZ.js';
8
+ import { EVENT_ORDER_MESSAGE_TEMPLATE_DEFAULTS, EVENT_ORDER_TEMPLATE_KEY, EVENT_ORDER_TEMPLATE_VARIABLES } from './chunk-2HU5R2JE.js';
10
9
  import { JOB_RUNNER_QUEUE } from './chunk-GO7PPYNU.js';
11
- import { canManageRoles, sessionHasEntityAccess } from './chunk-SF2XKMCI.js';
12
- import { permissionRowsToRecord, logRbac, isSuperAdmin, vendorPortalFlagsFromUser, VENDOR_SCOPED_STORE_ENTITIES, isVendorPortalUser, getPermissionableEntityKeys, VENDOR_STORE_RBAC_ENTITIES, isSuperAdminGroupName, VENDOR_RBAC_ENTITIES, VENDOR_VIEWER_ROLE_NAME, DEFAULT_VENDOR_ROLE_DEFS, VENDOR_OWNER_GROUP_NAME, resolveVendorScopeFromSessionUser, canManageVendorRoles, isPlatformAdministrator, canManageVendorTeam, resolveDisabledMultiVendorScope, logEntityAccessDecision, explainSessionEntityAccess } from './chunk-DN65KDIA.js';
10
+ import { canManageRoles, sessionHasEntityAccess } from './chunk-ZF2RQWXB.js';
11
+ import { permissionRowsToRecord, logRbac, isSuperAdmin, vendorPortalFlagsFromUser, VENDOR_SCOPED_STORE_ENTITIES, isVendorPortalUser, getPermissionableEntityKeys, VENDOR_STORE_RBAC_ENTITIES, isSuperAdminGroupName, VENDOR_RBAC_ENTITIES, VENDOR_VIEWER_ROLE_NAME, DEFAULT_VENDOR_ROLE_DEFS, VENDOR_GROUP_NAME, resolveVendorScopeFromSessionUser, canManageVendorRoles, isPlatformAdministrator, canManageVendorTeam, resolveDisabledMultiVendorScope, logEntityAccessDecision, explainSessionEntityAccess } from './chunk-JIWUVQ6B.js';
13
12
  import { queueErp } from './chunk-SYBOCAWB.js';
14
13
  import { isErpIntegrationEnabled } from './chunk-JC6DLWTE.js';
15
14
  import { __name } from './chunk-SHUYVCID.js';
@@ -34,7 +33,6 @@ async function queryVendorLinks(dataSource, userId) {
34
33
  return await dataSource.query(`
35
34
  SELECT
36
35
  vu."vendorId" AS "vendorId",
37
- vu."role" AS "role",
38
36
  vu."vendorRoleId" AS "vendorRoleId",
39
37
  vr."name" AS "vendorRoleName",
40
38
  vr."isOwnerRole" AS "isOwnerRole"
@@ -48,22 +46,25 @@ async function queryVendorLinks(dataSource, userId) {
48
46
  ]);
49
47
  } catch (err) {
50
48
  if (!isMissingVendorRoleSchemaError(err)) throw err;
51
- const legacy = await dataSource.query(`
52
- SELECT vu."vendorId" AS "vendorId", vu."role" AS "role"
53
- FROM "vendor_users" vu
54
- INNER JOIN "vendors" v ON v.id = vu."vendorId" AND v.deleted = false
55
- WHERE vu."userId" = $1
56
- ORDER BY vu.id ASC
57
- `, [
58
- userId
59
- ]);
60
- return legacy.map((r) => ({
61
- vendorId: Number(r.vendorId),
62
- role: r.role,
63
- vendorRoleId: null,
64
- vendorRoleName: null,
65
- isOwnerRole: r.role === "owner" ? true : null
66
- }));
49
+ try {
50
+ const legacy = await dataSource.query(`
51
+ SELECT vu."vendorId" AS "vendorId", vu."role" AS "role"
52
+ FROM "vendor_users" vu
53
+ INNER JOIN "vendors" v ON v.id = vu."vendorId" AND v.deleted = false
54
+ WHERE vu."userId" = $1
55
+ ORDER BY vu.id ASC
56
+ `, [
57
+ userId
58
+ ]);
59
+ return legacy.map((r) => ({
60
+ vendorId: Number(r.vendorId),
61
+ vendorRoleId: null,
62
+ vendorRoleName: null,
63
+ isOwnerRole: r.role === "owner" ? true : null
64
+ }));
65
+ } catch {
66
+ return [];
67
+ }
67
68
  }
68
69
  }
69
70
  __name(queryVendorLinks, "queryVendorLinks");
@@ -90,7 +91,6 @@ async function loadUserVendorContext(dataSource, userId, preferredVendorId) {
90
91
  if (linkIds.has(ownedId)) continue;
91
92
  rows.push({
92
93
  vendorId: ownedId,
93
- role: "owner",
94
94
  vendorRoleId: null,
95
95
  vendorRoleName: null,
96
96
  isOwnerRole: true
@@ -115,13 +115,14 @@ async function loadUserVendorContext(dataSource, userId, preferredVendorId) {
115
115
  if (!isMissingVendorRoleSchemaError(err)) throw err;
116
116
  }
117
117
  }
118
+ const isOwner = !!primary?.isOwnerRole;
118
119
  return {
119
120
  vendorIds,
120
121
  activeVendorId: primary != null ? Number(primary.vendorId) : vendorIds[0] ?? null,
121
- vendorRole: primary?.role ?? null,
122
+ vendorRole: isOwner ? "owner" : primary ? "staff" : null,
122
123
  vendorRoleId: primary?.vendorRoleId != null ? Number(primary.vendorRoleId) : null,
123
124
  vendorRoleName: primary?.vendorRoleName ?? null,
124
- isVendorRoleOwner: !!primary?.isOwnerRole || primary?.role === "owner",
125
+ isVendorRoleOwner: isOwner,
125
126
  vendorEntityPerms
126
127
  };
127
128
  }
@@ -5285,22 +5286,12 @@ function createCrudHandler(dataSource, entityMap, options) {
5285
5286
  await recordDiscountUsage2(dataSource, entityMap, created.id, orderDiscountId, persistBody.contactId, discount);
5286
5287
  }
5287
5288
  const orderIdForNotify = created.id;
5288
- void import('./emit-order-notification-trigger-IVLWKKJL.js').then(({ fireOrderNotificationTrigger }) => {
5289
+ void import('./emit-order-notification-trigger-6XX7LSC4.js').then(({ fireOrderNotificationTrigger }) => {
5289
5290
  fireOrderNotificationTrigger("order_placed", orderIdForNotify, {
5290
5291
  dataSource,
5291
5292
  entityMap
5292
5293
  });
5293
5294
  });
5294
- if (getCms) {
5295
- void import('./send-order-placed-emails-WPI37KRZ.js').then(({ sendOrderPlacedEmailsAfterConfirmation }) => {
5296
- return sendOrderPlacedEmailsAfterConfirmation(orderIdForNotify, {
5297
- getDataSource: /* @__PURE__ */ __name(async () => dataSource, "getDataSource"),
5298
- entityMap,
5299
- getCms: /* @__PURE__ */ __name(async () => await getCms(), "getCms")
5300
- });
5301
- }).catch(() => {
5302
- });
5303
- }
5304
5295
  }
5305
5296
  } catch (err) {
5306
5297
  const message = err instanceof Error ? err.message : String(err);
@@ -13028,6 +13019,15 @@ async function seedVendorDefaultRoles(em, vendorId) {
13028
13019
  }
13029
13020
  __name(seedVendorDefaultRoles, "seedVendorDefaultRoles");
13030
13021
  async function backfillVendorUserRoleIds(em, vendorId, seeded) {
13022
+ const cols = await em.query(`
13023
+ SELECT 1
13024
+ FROM information_schema.columns
13025
+ WHERE table_schema = 'public'
13026
+ AND table_name = 'vendor_users'
13027
+ AND column_name = 'role'
13028
+ LIMIT 1
13029
+ `);
13030
+ if (!cols.length) return;
13031
13031
  if (seeded.ownerRoleId) {
13032
13032
  await em.query(`
13033
13033
  UPDATE "vendor_users"
@@ -13119,11 +13119,29 @@ function parseVendorProfileFromBody(raw, options) {
13119
13119
  country: trimOrNull(raw?.country) ?? "IN",
13120
13120
  postalCode: trimOrNull(raw?.postalCode),
13121
13121
  gstin: trimOrNull(raw?.gstin)?.toUpperCase() ?? null,
13122
- pan: trimOrNull(raw?.pan)?.toUpperCase() ?? null,
13123
13122
  registrationStatus: parseRegistrationStatus(raw?.registrationStatus, defaultStatus)
13124
13123
  };
13125
13124
  }
13126
13125
  __name(parseVendorProfileFromBody, "parseVendorProfileFromBody");
13126
+ function parseVendorPersonProfileFromBody(raw, fallbacks) {
13127
+ const name = trimOrNull(raw?.name) ?? trimOrNull(fallbacks?.name) ?? "";
13128
+ const email = (trimOrNull(raw?.email) ?? trimOrNull(fallbacks?.email) ?? "").toLowerCase();
13129
+ const aadhaarRaw = trimOrNull(raw?.aadhaarNo) ?? trimOrNull(raw?.aadhaar);
13130
+ const panRaw = trimOrNull(raw?.panNo) ?? trimOrNull(raw?.pan);
13131
+ return {
13132
+ name,
13133
+ email,
13134
+ phone: trimOrNull(raw?.phone) ?? trimOrNull(fallbacks?.phone),
13135
+ aadhaarNo: aadhaarRaw ? aadhaarRaw.replace(/\s+/g, "") : null,
13136
+ panNo: panRaw ? panRaw.toUpperCase() : null,
13137
+ addressLine1: trimOrNull(raw?.addressLine1),
13138
+ addressLine2: trimOrNull(raw?.addressLine2),
13139
+ city: trimOrNull(raw?.city),
13140
+ state: trimOrNull(raw?.state),
13141
+ postalCode: trimOrNull(raw?.postalCode)
13142
+ };
13143
+ }
13144
+ __name(parseVendorPersonProfileFromBody, "parseVendorPersonProfileFromBody");
13127
13145
  function validateIndiaTaxIds(gstin, pan) {
13128
13146
  if (gstin && !/^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z][1-9A-Z]Z[0-9A-Z]$/i.test(gstin)) {
13129
13147
  return "Invalid GSTIN format (15 characters, e.g. 22AAAAA0000A1Z5)";
@@ -13134,6 +13152,25 @@ function validateIndiaTaxIds(gstin, pan) {
13134
13152
  return null;
13135
13153
  }
13136
13154
  __name(validateIndiaTaxIds, "validateIndiaTaxIds");
13155
+ function validateAadhaar(aadhaar) {
13156
+ if (!aadhaar) return null;
13157
+ if (!/^[0-9]{12}$/.test(aadhaar)) {
13158
+ return "Invalid Aadhaar number (12 digits)";
13159
+ }
13160
+ return null;
13161
+ }
13162
+ __name(validateAadhaar, "validateAadhaar");
13163
+ function validatePersonKyc(person, options) {
13164
+ const required = options?.required === true;
13165
+ if (required && !person.aadhaarNo) return "Aadhaar number is required";
13166
+ if (required && !person.panNo) return "PAN is required";
13167
+ const aadhaarErr = validateAadhaar(person.aadhaarNo ?? null);
13168
+ if (aadhaarErr) return aadhaarErr;
13169
+ const panErr = validateIndiaTaxIds(null, person.panNo ?? null);
13170
+ if (panErr) return panErr;
13171
+ return null;
13172
+ }
13173
+ __name(validatePersonKyc, "validatePersonKyc");
13137
13174
  function buildVendorMetadata(existing, input) {
13138
13175
  const next = {
13139
13176
  ...existing ?? {}
@@ -13148,11 +13185,86 @@ function buildVendorMetadata(existing, input) {
13148
13185
  }
13149
13186
  __name(buildVendorMetadata, "buildVendorMetadata");
13150
13187
 
13188
+ // src/lib/vendor-pending-team-invite.ts
13189
+ var VENDOR_PENDING_TEAM_INVITES_KEY = "pendingTeamInvites";
13190
+ function asMetadata(raw) {
13191
+ if (raw && typeof raw === "object" && !Array.isArray(raw)) {
13192
+ return {
13193
+ ...raw
13194
+ };
13195
+ }
13196
+ return {};
13197
+ }
13198
+ __name(asMetadata, "asMetadata");
13199
+ function readPendingTeamInvites(metadata) {
13200
+ const list = metadata?.[VENDOR_PENDING_TEAM_INVITES_KEY];
13201
+ if (!Array.isArray(list)) return [];
13202
+ return list.filter((row) => {
13203
+ if (!row || typeof row !== "object") return false;
13204
+ const r = row;
13205
+ return typeof r.token === "string" && typeof r.userId === "number" && typeof r.email === "string" && typeof r.vendorRoleId === "number" && typeof r.vendorUserProfileId === "number" && typeof r.name === "string";
13206
+ });
13207
+ }
13208
+ __name(readPendingTeamInvites, "readPendingTeamInvites");
13209
+ function findPendingTeamInviteByToken(metadata, token) {
13210
+ const trimmed = token.trim();
13211
+ if (!trimmed) return null;
13212
+ return readPendingTeamInvites(metadata).find((i) => i.token === trimmed) ?? null;
13213
+ }
13214
+ __name(findPendingTeamInviteByToken, "findPendingTeamInviteByToken");
13215
+ function findPendingTeamInviteByUserId(metadata, userId) {
13216
+ if (!Number.isFinite(userId) || userId <= 0) return null;
13217
+ return readPendingTeamInvites(metadata).find((i) => i.userId === userId) ?? null;
13218
+ }
13219
+ __name(findPendingTeamInviteByUserId, "findPendingTeamInviteByUserId");
13220
+ function upsertPendingTeamInviteInMetadata(metadata, email, next) {
13221
+ const meta = asMetadata(metadata);
13222
+ const emailLc = email.trim().toLowerCase();
13223
+ const rest = readPendingTeamInvites(meta).filter((i) => i.email.toLowerCase() !== emailLc);
13224
+ const pending = next ? [
13225
+ ...rest,
13226
+ next
13227
+ ] : rest;
13228
+ if (pending.length === 0) {
13229
+ delete meta[VENDOR_PENDING_TEAM_INVITES_KEY];
13230
+ } else {
13231
+ meta[VENDOR_PENDING_TEAM_INVITES_KEY] = pending;
13232
+ }
13233
+ return meta;
13234
+ }
13235
+ __name(upsertPendingTeamInviteInMetadata, "upsertPendingTeamInviteInMetadata");
13236
+ function removePendingTeamInviteTokenFromMetadata(metadata, token) {
13237
+ const meta = asMetadata(metadata);
13238
+ const trimmed = token.trim();
13239
+ const pending = readPendingTeamInvites(meta).filter((i) => i.token !== trimmed);
13240
+ if (pending.length === 0) {
13241
+ delete meta[VENDOR_PENDING_TEAM_INVITES_KEY];
13242
+ } else {
13243
+ meta[VENDOR_PENDING_TEAM_INVITES_KEY] = pending;
13244
+ }
13245
+ return meta;
13246
+ }
13247
+ __name(removePendingTeamInviteTokenFromMetadata, "removePendingTeamInviteTokenFromMetadata");
13248
+
13151
13249
  // src/api/vendor-handlers.ts
13152
13250
  function slugify(input) {
13153
13251
  return input.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80);
13154
13252
  }
13155
13253
  __name(slugify, "slugify");
13254
+ function userHasActiveLogin(user) {
13255
+ if (user.deleted) return false;
13256
+ if (user.blocked) return false;
13257
+ const hasPassword = !!(user.password && String(user.password).trim());
13258
+ if (!hasPassword) return false;
13259
+ if (user.inviteStatus === "pending") return false;
13260
+ return true;
13261
+ }
13262
+ __name(userHasActiveLogin, "userHasActiveLogin");
13263
+ function buildTeamMembershipInviteLink(baseUrl, token, vendorId) {
13264
+ const base = baseUrl.replace(/\/+$/, "");
13265
+ return `${base}/admin/invite?token=${encodeURIComponent(token)}&mode=team&vendorId=${vendorId}`;
13266
+ }
13267
+ __name(buildTeamMembershipInviteLink, "buildTeamMembershipInviteLink");
13156
13268
  async function userHasActiveVendor(em, entityMap, userId) {
13157
13269
  const vendorRepo = em.getRepository(entityMap.vendors);
13158
13270
  const owned = await vendorRepo.findOne({
@@ -13205,7 +13317,7 @@ function vendorOnboardErrorResponse(json, err) {
13205
13317
  }
13206
13318
  if (msg === "VENDOR_OWNER_GROUP_MISSING") {
13207
13319
  return json({
13208
- error: "Vendor Owner group not found. Run migrations (VendorOwnerRbacSeed)."
13320
+ error: "Vendor group not found. Run migrations (VendorTeamProfiles / VendorOwnerRbacSeed)."
13209
13321
  }, {
13210
13322
  status: 500
13211
13323
  });
@@ -13265,7 +13377,7 @@ function vendorOnboardErrorResponse(json, err) {
13265
13377
  }
13266
13378
  __name(vendorOnboardErrorResponse, "vendorOnboardErrorResponse");
13267
13379
  function createVendorOnboardHandlers(config) {
13268
- const { dataSource, entityMap, json, getSessionUser, baseUrl, getCms, hashPassword, minPasswordLength = 6 } = config;
13380
+ const { dataSource, entityMap, json, getSessionUser, baseUrl, getCms } = config;
13269
13381
  async function gateAdmin() {
13270
13382
  const u = await getSessionUser();
13271
13383
  if (!u?.email) return json({
@@ -13415,7 +13527,7 @@ function createVendorOnboardHandlers(config) {
13415
13527
  async getProfile() {
13416
13528
  const gated = await gateVendorPortal();
13417
13529
  if (gated instanceof Response) return gated;
13418
- const { vendorId } = gated;
13530
+ const { user, vendorId } = gated;
13419
13531
  if (!entityMap.vendors) {
13420
13532
  return json({
13421
13533
  error: "Vendors not configured"
@@ -13435,7 +13547,39 @@ function createVendorOnboardHandlers(config) {
13435
13547
  }, {
13436
13548
  status: 404
13437
13549
  });
13438
- return json(row);
13550
+ let personProfile = null;
13551
+ const userId = user.id != null ? Number(user.id) : null;
13552
+ if (userId != null && Number.isFinite(userId) && entityMap.vendor_users && entityMap.vendor_user_profiles) {
13553
+ const link = await dataSource.getRepository(entityMap.vendor_users).findOne({
13554
+ where: {
13555
+ vendorId,
13556
+ userId
13557
+ },
13558
+ relations: [
13559
+ "vendorUserProfile"
13560
+ ]
13561
+ });
13562
+ const vp = link?.vendorUserProfile;
13563
+ if (vp) {
13564
+ personProfile = {
13565
+ id: vp.id,
13566
+ name: vp.name ?? null,
13567
+ email: vp.email ?? null,
13568
+ phone: vp.phone ?? null,
13569
+ aadhaarNo: vp.aadhaarNo ?? null,
13570
+ panNo: vp.panNo ?? null,
13571
+ addressLine1: vp.addressLine1 ?? null,
13572
+ addressLine2: vp.addressLine2 ?? null,
13573
+ city: vp.city ?? null,
13574
+ state: vp.state ?? null,
13575
+ postalCode: vp.postalCode ?? null
13576
+ };
13577
+ }
13578
+ }
13579
+ return json({
13580
+ ...row,
13581
+ personProfile
13582
+ });
13439
13583
  } catch (e) {
13440
13584
  console.error("[vendor.profile]", e);
13441
13585
  return json({
@@ -13456,6 +13600,13 @@ function createVendorOnboardHandlers(config) {
13456
13600
  status: 500
13457
13601
  });
13458
13602
  }
13603
+ if (!entityMap.vendor_user_profiles) {
13604
+ return json({
13605
+ error: "vendor_user_profiles not configured. Run migrations."
13606
+ }, {
13607
+ status: 500
13608
+ });
13609
+ }
13459
13610
  try {
13460
13611
  const body = await req.json();
13461
13612
  const vendorName = trimOrNull(body.vendor?.name);
@@ -13487,12 +13638,35 @@ function createVendorOnboardHandlers(config) {
13487
13638
  const profile = parseVendorProfileFromBody(body.vendor, {
13488
13639
  defaultRegistrationStatus: "approved"
13489
13640
  });
13490
- const taxError = validateIndiaTaxIds(profile.gstin, profile.pan);
13491
- if (taxError) return json({
13492
- error: taxError
13641
+ const gstError = validateIndiaTaxIds(profile.gstin, null);
13642
+ if (gstError) return json({
13643
+ error: gstError
13644
+ }, {
13645
+ status: 400
13646
+ });
13647
+ const person = parseVendorPersonProfileFromBody({
13648
+ ...body.ownerProfile ?? {},
13649
+ ...body.user ?? {}
13650
+ }, {
13651
+ name: userName,
13652
+ email: userEmail,
13653
+ phone: ownerPhone
13654
+ });
13655
+ const personErr = validatePersonKyc(person, {
13656
+ required: true
13657
+ });
13658
+ if (personErr) return json({
13659
+ error: personErr
13493
13660
  }, {
13494
13661
  status: 400
13495
13662
  });
13663
+ if (!person.addressLine1?.trim()) {
13664
+ return json({
13665
+ error: "Owner address line 1 is required"
13666
+ }, {
13667
+ status: 400
13668
+ });
13669
+ }
13496
13670
  const activation = "invite";
13497
13671
  const ownerPasswordHash = null;
13498
13672
  const slug = trimOrNull(body.vendor?.slug) || slugify(vendorName);
@@ -13506,6 +13680,7 @@ function createVendorOnboardHandlers(config) {
13506
13680
  const userRepo = em.getRepository(entityMap.users);
13507
13681
  const vuRepo = em.getRepository(entityMap.vendor_users);
13508
13682
  const groupRepo = em.getRepository(entityMap.user_groups);
13683
+ const profileRepo = em.getRepository(entityMap.vendor_user_profiles);
13509
13684
  const dupVendor = await vendorRepo.findOne({
13510
13685
  where: {
13511
13686
  slug,
@@ -13516,24 +13691,32 @@ function createVendorOnboardHandlers(config) {
13516
13691
  await retireSoftDeletedUniqueValue(vendorRepo, "slug", slug);
13517
13692
  let ownerGroup = await groupRepo.findOne({
13518
13693
  where: {
13519
- name: VENDOR_OWNER_GROUP_NAME,
13694
+ name: VENDOR_GROUP_NAME,
13520
13695
  deleted: false
13521
13696
  }
13522
13697
  });
13698
+ if (!ownerGroup) {
13699
+ ownerGroup = await groupRepo.findOne({
13700
+ where: {
13701
+ name: "Vendor Owner",
13702
+ deleted: false
13703
+ }
13704
+ });
13705
+ }
13523
13706
  if (!ownerGroup) {
13524
13707
  try {
13525
13708
  await groupRepo.save(groupRepo.create({
13526
- name: VENDOR_OWNER_GROUP_NAME,
13709
+ name: VENDOR_GROUP_NAME,
13527
13710
  deleted: false
13528
13711
  }));
13529
13712
  ownerGroup = await groupRepo.findOne({
13530
13713
  where: {
13531
- name: VENDOR_OWNER_GROUP_NAME,
13714
+ name: VENDOR_GROUP_NAME,
13532
13715
  deleted: false
13533
13716
  }
13534
13717
  });
13535
13718
  } catch (seedErr) {
13536
- console.error("[vendor-onboard] failed to seed Vendor Owner group", seedErr);
13719
+ console.error("[vendor-onboard] failed to seed Vendor group", seedErr);
13537
13720
  }
13538
13721
  }
13539
13722
  if (!ownerGroup) throw new Error("VENDOR_OWNER_GROUP_MISSING");
@@ -13601,7 +13784,6 @@ function createVendorOnboardHandlers(config) {
13601
13784
  country: profile.country,
13602
13785
  postalCode: profile.postalCode,
13603
13786
  gstin: profile.gstin,
13604
- pan: profile.pan,
13605
13787
  registrationStatus: profile.registrationStatus,
13606
13788
  metadata,
13607
13789
  active: body.vendor?.active !== false,
@@ -13609,6 +13791,18 @@ function createVendorOnboardHandlers(config) {
13609
13791
  userId: newUser.id,
13610
13792
  inviteStatus: inviteStatusForActivation(activation)
13611
13793
  }));
13794
+ const personRow = await profileRepo.save(profileRepo.create({
13795
+ name: person.name || userName,
13796
+ email: person.email || userEmail,
13797
+ phone: person.phone,
13798
+ aadhaarNo: person.aadhaarNo,
13799
+ panNo: person.panNo,
13800
+ addressLine1: person.addressLine1,
13801
+ addressLine2: person.addressLine2,
13802
+ city: person.city,
13803
+ state: person.state,
13804
+ postalCode: person.postalCode
13805
+ }));
13612
13806
  const seeded = await ensureVendorRolesForVendor(em, vendor.id);
13613
13807
  if (!seeded.ownerRoleId) {
13614
13808
  throw new Error("VENDOR_ROLES_SEED_FAILED");
@@ -13623,12 +13817,13 @@ function createVendorOnboardHandlers(config) {
13623
13817
  await vuRepo.save(vuRepo.create({
13624
13818
  vendorId: vendor.id,
13625
13819
  userId: newUser.id,
13626
- role: "owner",
13627
- vendorRoleId: seeded.ownerRoleId
13820
+ vendorRoleId: seeded.ownerRoleId,
13821
+ vendorUserProfileId: personRow.id
13628
13822
  }));
13629
- } else if (!existingLink.vendorRoleId) {
13823
+ } else {
13630
13824
  await vuRepo.update(existingLink.id, {
13631
- vendorRoleId: seeded.ownerRoleId
13825
+ vendorRoleId: seeded.ownerRoleId,
13826
+ vendorUserProfileId: personRow.id
13632
13827
  });
13633
13828
  }
13634
13829
  if (entityMap.customer) {
@@ -13857,9 +14052,14 @@ function createVendorOnboardHandlers(config) {
13857
14052
  order: {
13858
14053
  id: "ASC"
13859
14054
  },
13860
- relations: entityMap.vendor_roles ? [
13861
- "vendorRole"
13862
- ] : []
14055
+ relations: [
14056
+ ...entityMap.vendor_roles ? [
14057
+ "vendorRole"
14058
+ ] : [],
14059
+ ...entityMap.vendor_user_profiles ? [
14060
+ "vendorUserProfile"
14061
+ ] : []
14062
+ ]
13863
14063
  });
13864
14064
  if (links.length === 0) return json({
13865
14065
  vendorId,
@@ -13892,28 +14092,38 @@ function createVendorOnboardHandlers(config) {
13892
14092
  select: [
13893
14093
  "id",
13894
14094
  "name",
13895
- "isOwnerRole"
14095
+ "isOwnerRole",
14096
+ "isSystem"
13896
14097
  ]
13897
14098
  });
13898
14099
  roles = roleRows.map((r) => ({
13899
14100
  id: r.id,
13900
14101
  name: r.name,
13901
- isOwnerRole: r.isOwnerRole
14102
+ isOwnerRole: r.isOwnerRole,
14103
+ isSystem: r.isSystem === true
13902
14104
  }));
13903
14105
  }
13904
14106
  const members = links.map((l) => {
13905
14107
  const u = userById.get(l.userId);
13906
14108
  const vr = l.vendorRole;
14109
+ const vp = l.vendorUserProfile;
13907
14110
  return {
13908
14111
  vendorUserId: l.id,
13909
14112
  userId: l.userId,
13910
- role: l.role,
13911
14113
  vendorRoleId: l.vendorRoleId ?? null,
13912
14114
  vendorRoleName: vr?.name ?? null,
13913
- isOwnerRole: vr?.isOwnerRole ?? l.role === "owner",
14115
+ isOwnerRole: vr?.isOwnerRole === true,
14116
+ vendorUserProfileId: l.vendorUserProfileId ?? null,
13914
14117
  name: u?.name ?? null,
13915
14118
  email: u?.email ?? null,
13916
- phone: u?.phone ?? null,
14119
+ phone: vp?.phone ?? u?.phone ?? null,
14120
+ aadhaarNo: vp?.aadhaarNo ?? null,
14121
+ panNo: vp?.panNo ?? null,
14122
+ addressLine1: vp?.addressLine1 ?? null,
14123
+ addressLine2: vp?.addressLine2 ?? null,
14124
+ city: vp?.city ?? null,
14125
+ state: vp?.state ?? null,
14126
+ postalCode: vp?.postalCode ?? null,
13917
14127
  blocked: u?.blocked ?? false,
13918
14128
  groupName: u?.group?.name ?? null
13919
14129
  };
@@ -13924,7 +14134,7 @@ function createVendorOnboardHandlers(config) {
13924
14134
  roles
13925
14135
  });
13926
14136
  },
13927
- /** POST /api/admin/vendor/team — add staff to vendor */
14137
+ /** POST /api/admin/vendor/team — invite staff (set-password for new; accept-only for existing vendor people) */
13928
14138
  async addTeamMember(req) {
13929
14139
  const gated = await gateVendorTeam();
13930
14140
  if (gated instanceof Response) return gated;
@@ -13936,8 +14146,16 @@ function createVendorOnboardHandlers(config) {
13936
14146
  status: 500
13937
14147
  });
13938
14148
  }
14149
+ if (!entityMap.vendor_user_profiles) {
14150
+ return json({
14151
+ error: "vendor_user_profiles not configured. Run migrations."
14152
+ }, {
14153
+ status: 500
14154
+ });
14155
+ }
13939
14156
  try {
13940
14157
  const body = await req.json();
14158
+ const sendEmail = body.sendEmail === true;
13941
14159
  const userName = body.name?.trim();
13942
14160
  const userEmail = body.email?.trim().toLowerCase();
13943
14161
  if (!userName || !userEmail) {
@@ -13947,35 +14165,149 @@ function createVendorOnboardHandlers(config) {
13947
14165
  status: 400
13948
14166
  });
13949
14167
  }
13950
- const activation = body.activation === "password" ? "password" : "invite";
13951
- const sendOwnerEmail = body.sendOwnerEmail !== false && body.sendInviteEmail !== false;
13952
- let ownerPasswordHash = null;
13953
- if (activation === "password") {
13954
- const plain = body.user?.password?.trim();
13955
- if (!plain) return json({
13956
- error: "Password is required"
14168
+ if (body.activation === "password" || body.user?.password) {
14169
+ return json({
14170
+ error: "Setting a password for team members is not supported. Invite by email or copy the invite link."
13957
14171
  }, {
13958
14172
  status: 400
13959
14173
  });
13960
- if (plain.length < minPasswordLength) {
13961
- return json({
13962
- error: `Password must be at least ${minPasswordLength} characters`
13963
- }, {
13964
- status: 400
14174
+ }
14175
+ const person = parseVendorPersonProfileFromBody(body, {
14176
+ name: userName,
14177
+ email: userEmail,
14178
+ phone: body.phone
14179
+ });
14180
+ const vendorRow = await dataSource.getRepository(entityMap.vendors).findOne({
14181
+ where: {
14182
+ id: vendorId,
14183
+ deleted: false
14184
+ }
14185
+ });
14186
+ const vendorName = String(vendorRow?.name ?? "Vendor store");
14187
+ const vendorSlug = String(vendorRow?.slug ?? "");
14188
+ const profileRepo = dataSource.getRepository(entityMap.vendor_user_profiles);
14189
+ const existingProfile = await profileRepo.createQueryBuilder("p").where("LOWER(p.email) = :email", {
14190
+ email: userEmail
14191
+ }).orderBy("p.id", "ASC").getOne();
14192
+ const existingUser = await dataSource.getRepository(entityMap.users).findOne({
14193
+ where: {
14194
+ email: userEmail
14195
+ },
14196
+ select: [
14197
+ "id",
14198
+ "email",
14199
+ "name",
14200
+ "password",
14201
+ "inviteStatus",
14202
+ "blocked",
14203
+ "deleted"
14204
+ ]
14205
+ });
14206
+ const isExistingVendorPerson = !!existingProfile && !!existingUser && !existingUser.deleted && userHasActiveLogin(existingUser);
14207
+ if (isExistingVendorPerson) {
14208
+ const membershipToken = newUserInviteToken();
14209
+ const invitee = await dataSource.transaction(async (em) => {
14210
+ const vuRepo = em.getRepository(entityMap.vendor_users);
14211
+ const vendorRepo = em.getRepository(entityMap.vendors);
14212
+ await ensureVendorRolesForVendor(em, vendorId);
14213
+ let staffRoleId = body.vendorRoleId;
14214
+ if (staffRoleId != null && entityMap.vendor_roles) {
14215
+ const roleRow = await em.getRepository(entityMap.vendor_roles).findOne({
14216
+ where: {
14217
+ id: staffRoleId,
14218
+ vendorId,
14219
+ deleted: false
14220
+ }
14221
+ });
14222
+ if (!roleRow) throw new Error("INVALID_VENDOR_ROLE");
14223
+ if (roleRow.isOwnerRole) throw new Error("CANNOT_ASSIGN_OWNER_ROLE");
14224
+ } else {
14225
+ staffRoleId = await getDefaultStaffRoleIdForVendor(em, vendorId) ?? void 0;
14226
+ }
14227
+ if (staffRoleId == null) throw new Error("INVALID_VENDOR_ROLE");
14228
+ const link = await vuRepo.findOne({
14229
+ where: {
14230
+ vendorId,
14231
+ userId: existingUser.id
14232
+ }
14233
+ });
14234
+ if (link) throw new Error("USER_ALREADY_ON_TEAM");
14235
+ const priorLink = await vuRepo.findOne({
14236
+ where: {
14237
+ userId: existingUser.id
14238
+ },
14239
+ order: {
14240
+ id: "ASC"
14241
+ }
14242
+ });
14243
+ const vendorUserProfileId = priorLink?.vendorUserProfileId ?? existingProfile.id;
14244
+ const vendorFresh = await vendorRepo.findOne({
14245
+ where: {
14246
+ id: vendorId,
14247
+ deleted: false
14248
+ }
14249
+ });
14250
+ if (!vendorFresh) throw new Error("VENDOR_NOT_FOUND");
14251
+ const pending = {
14252
+ token: membershipToken,
14253
+ userId: existingUser.id,
14254
+ email: userEmail,
14255
+ vendorRoleId: staffRoleId,
14256
+ vendorUserProfileId,
14257
+ name: userName || String(existingUser.name ?? ""),
14258
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
14259
+ };
14260
+ const nextMeta = upsertPendingTeamInviteInMetadata(vendorFresh.metadata, userEmail, pending);
14261
+ await vendorRepo.update(vendorId, {
14262
+ metadata: nextMeta,
14263
+ updatedAt: /* @__PURE__ */ new Date()
14264
+ });
14265
+ return existingUser;
14266
+ });
14267
+ const inviteLink2 = buildTeamMembershipInviteLink(baseUrl, membershipToken, vendorId);
14268
+ let emailSent2 = false;
14269
+ if (sendEmail) {
14270
+ emailSent2 = await trySendVendorOnboardEmails({
14271
+ vendorName,
14272
+ vendorSlug,
14273
+ ownerName: userName,
14274
+ ownerEmail: userEmail,
14275
+ activation: "membership",
14276
+ inviteLink: inviteLink2,
14277
+ kind: "team_invite",
14278
+ sendToOwner: true
13965
14279
  });
13966
14280
  }
13967
- if (!hashPassword) return json({
13968
- error: "Password hashing not configured"
14281
+ return json({
14282
+ message: sendEmail ? emailSent2 ? "Existing vendor invited. They can accept without setting a new password." : "Existing vendor invited (email may not have been sent). Share the accept link." : "Existing vendor invited. Send the invite email or copy the invite link.",
14283
+ activation: "membership",
14284
+ emailSent: emailSent2,
14285
+ inviteLink: inviteLink2,
14286
+ user: {
14287
+ id: invitee.id,
14288
+ name: invitee.name,
14289
+ email: invitee.email
14290
+ }
13969
14291
  }, {
13970
- status: 501
14292
+ status: 201
13971
14293
  });
13972
- ownerPasswordHash = await hashPassword(plain);
13973
14294
  }
14295
+ const personErr = validatePersonKyc(person, {
14296
+ required: true
14297
+ });
14298
+ if (personErr) return json({
14299
+ error: personErr
14300
+ }, {
14301
+ status: 400
14302
+ });
14303
+ const activation = "invite";
13974
14304
  const staffGroupId = actor.groupId;
14305
+ const inviteToken = newUserInviteToken();
13975
14306
  const result = await dataSource.transaction(async (em) => {
13976
14307
  const userRepo = em.getRepository(entityMap.users);
13977
14308
  const vuRepo = em.getRepository(entityMap.vendor_users);
13978
14309
  const groupRepo = em.getRepository(entityMap.user_groups);
14310
+ const profileRepoTx = em.getRepository(entityMap.vendor_user_profiles);
13979
14311
  await ensureVendorRolesForVendor(em, vendorId);
13980
14312
  let staffRoleId = body.vendorRoleId;
13981
14313
  if (staffRoleId != null && entityMap.vendor_roles) {
@@ -13991,81 +14323,90 @@ function createVendorOnboardHandlers(config) {
13991
14323
  } else {
13992
14324
  staffRoleId = await getDefaultStaffRoleIdForVendor(em, vendorId) ?? void 0;
13993
14325
  }
14326
+ if (staffRoleId == null) throw new Error("INVALID_VENDOR_ROLE");
13994
14327
  let groupId = staffGroupId ?? null;
13995
14328
  if (!groupId) {
13996
14329
  const g = await groupRepo.findOne({
13997
14330
  where: {
13998
- name: VENDOR_OWNER_GROUP_NAME,
14331
+ name: VENDOR_GROUP_NAME,
14332
+ deleted: false
14333
+ }
14334
+ }) ?? await groupRepo.findOne({
14335
+ where: {
14336
+ name: "Vendor Owner",
13999
14337
  deleted: false
14000
14338
  }
14001
14339
  });
14002
14340
  groupId = g?.id ?? null;
14003
14341
  }
14004
14342
  if (!groupId) throw new Error("VENDOR_OWNER_GROUP_MISSING");
14005
- const existingUser = await userRepo.findOne({
14343
+ const existing = await userRepo.findOne({
14006
14344
  where: {
14007
14345
  email: userEmail
14008
14346
  }
14009
14347
  });
14010
- if (existingUser && !existingUser.deleted) {
14348
+ if (existing && !existing.deleted) {
14011
14349
  const link = await vuRepo.findOne({
14012
14350
  where: {
14013
14351
  vendorId,
14014
- userId: existingUser.id
14352
+ userId: existing.id
14015
14353
  }
14016
14354
  });
14017
14355
  if (link) throw new Error("USER_ALREADY_ON_TEAM");
14018
14356
  }
14019
- let newUser = existingUser;
14020
- if (existingUser?.deleted) {
14021
- await userRepo.update(existingUser.id, {
14357
+ let newUser = existing;
14358
+ const inviteUserFields = {
14359
+ name: userName,
14360
+ email: userEmail,
14361
+ phone: person.phone,
14362
+ password: null,
14363
+ blocked: true,
14364
+ inviteStatus: "pending",
14365
+ inviteToken,
14366
+ groupId,
14367
+ adminAccess: true
14368
+ };
14369
+ if (existing?.deleted) {
14370
+ await userRepo.update(existing.id, {
14022
14371
  deleted: false,
14023
14372
  deletedAt: null,
14024
14373
  deletedBy: null,
14025
- name: userName,
14026
- email: userEmail,
14027
- password: ownerPasswordHash,
14028
- blocked: activation === "invite",
14029
- groupId,
14030
- adminAccess: true,
14374
+ ...inviteUserFields,
14031
14375
  updatedAt: /* @__PURE__ */ new Date()
14032
14376
  });
14033
14377
  newUser = await userRepo.findOne({
14034
14378
  where: {
14035
- id: existingUser.id
14379
+ id: existing.id
14036
14380
  }
14037
14381
  });
14038
14382
  if (!newUser) throw new Error("user missing after restore");
14039
- } else if (existingUser && !existingUser.deleted) {
14040
- await userRepo.update(existingUser.id, {
14041
- name: userName,
14042
- groupId,
14043
- adminAccess: true,
14044
- ...ownerPasswordHash ? {
14045
- password: ownerPasswordHash,
14046
- blocked: false
14047
- } : activation === "invite" ? {
14048
- password: null,
14049
- blocked: true
14050
- } : {}
14383
+ } else if (existing && !existing.deleted) {
14384
+ await userRepo.update(existing.id, {
14385
+ ...inviteUserFields,
14386
+ updatedAt: /* @__PURE__ */ new Date()
14051
14387
  });
14052
14388
  newUser = await userRepo.findOne({
14053
14389
  where: {
14054
- id: existingUser.id
14390
+ id: existing.id
14055
14391
  }
14056
14392
  });
14057
14393
  if (!newUser) throw new Error("user missing after update");
14058
- } else if (!existingUser) {
14059
- newUser = await userRepo.save(userRepo.create({
14060
- name: userName,
14061
- email: userEmail,
14062
- password: ownerPasswordHash,
14063
- blocked: activation === "invite",
14064
- groupId,
14065
- adminAccess: true
14066
- }));
14394
+ } else if (!existing) {
14395
+ newUser = await userRepo.save(userRepo.create(inviteUserFields));
14067
14396
  }
14068
14397
  if (!newUser) throw new Error("user missing");
14398
+ const personRow = await profileRepoTx.save(profileRepoTx.create({
14399
+ name: person.name || userName,
14400
+ email: person.email || userEmail,
14401
+ phone: person.phone,
14402
+ aadhaarNo: person.aadhaarNo,
14403
+ panNo: person.panNo,
14404
+ addressLine1: person.addressLine1,
14405
+ addressLine2: person.addressLine2,
14406
+ city: person.city,
14407
+ state: person.state,
14408
+ postalCode: person.postalCode
14409
+ }));
14069
14410
  const existingLink = await vuRepo.findOne({
14070
14411
  where: {
14071
14412
  vendorId,
@@ -14076,40 +14417,32 @@ function createVendorOnboardHandlers(config) {
14076
14417
  await vuRepo.save(vuRepo.create({
14077
14418
  vendorId,
14078
14419
  userId: newUser.id,
14079
- role: "staff",
14080
- vendorRoleId: staffRoleId ?? null
14420
+ vendorRoleId: staffRoleId,
14421
+ vendorUserProfileId: personRow.id
14081
14422
  }));
14082
- } else if (staffRoleId) {
14423
+ } else {
14083
14424
  await vuRepo.update(existingLink.id, {
14084
14425
  vendorRoleId: staffRoleId,
14085
- role: "staff"
14426
+ vendorUserProfileId: personRow.id
14086
14427
  });
14087
14428
  }
14088
14429
  if (entityMap.customer) {
14089
- await ensureCustomerForUser(em, entityMap.customer, {
14090
- id: newUser.id,
14091
- name: userName,
14092
- email: userEmail,
14093
- phone: newUser.phone ?? null
14094
- });
14430
+ try {
14431
+ await ensureCustomerForUser(em, entityMap.customer, {
14432
+ id: newUser.id,
14433
+ name: userName,
14434
+ email: userEmail,
14435
+ phone: person.phone
14436
+ });
14437
+ } catch (customerErr) {
14438
+ console.error("[vendor-team] ensureCustomerForUser skipped", customerErr);
14439
+ }
14095
14440
  }
14096
14441
  return newUser;
14097
14442
  });
14098
- const vendorRow = await dataSource.getRepository(entityMap.vendors).findOne({
14099
- where: {
14100
- id: vendorId,
14101
- deleted: false
14102
- }
14103
- });
14104
- const vendorName = String(vendorRow?.name ?? "Vendor store");
14105
- const vendorSlug = String(vendorRow?.slug ?? "");
14106
- let inviteLink;
14443
+ const inviteLink = buildUserInviteLink(baseUrl, inviteToken);
14107
14444
  let emailSent = false;
14108
- if (activation === "invite") {
14109
- const emailToken = Buffer.from(result.email).toString("base64");
14110
- inviteLink = `${baseUrl}/admin/invite?token=${emailToken}`;
14111
- }
14112
- if (sendOwnerEmail || getCms) {
14445
+ if (sendEmail) {
14113
14446
  emailSent = await trySendVendorOnboardEmails({
14114
14447
  vendorName,
14115
14448
  vendorSlug,
@@ -14118,18 +14451,19 @@ function createVendorOnboardHandlers(config) {
14118
14451
  activation,
14119
14452
  inviteLink,
14120
14453
  kind: "team_invite",
14121
- sendToOwner: sendOwnerEmail
14454
+ sendToOwner: true
14122
14455
  });
14123
14456
  }
14124
14457
  return json({
14125
- message: emailSent ? "Team member added. Invitation email sent." : sendOwnerEmail ? "Team member added (email may not have been sent \u2014 check email plugin)." : "Team member added",
14458
+ message: sendEmail ? emailSent ? "Team member invited. Invitation email sent." : "Team member invited (email may not have been sent \u2014 check email plugin). Share the invite link so they can set their password." : "Team member invited. Send the invite email or copy the invite link.",
14459
+ activation,
14126
14460
  emailSent,
14461
+ inviteLink,
14127
14462
  user: {
14128
14463
  id: result.id,
14129
14464
  name: result.name,
14130
14465
  email: result.email
14131
- },
14132
- inviteLink
14466
+ }
14133
14467
  }, {
14134
14468
  status: 201
14135
14469
  });
@@ -14142,9 +14476,16 @@ function createVendorOnboardHandlers(config) {
14142
14476
  status: 400
14143
14477
  });
14144
14478
  }
14479
+ if (msg === "VENDOR_NOT_FOUND") {
14480
+ return json({
14481
+ error: "Vendor not found"
14482
+ }, {
14483
+ status: 404
14484
+ });
14485
+ }
14145
14486
  if (msg === "VENDOR_OWNER_GROUP_MISSING") {
14146
14487
  return json({
14147
- error: "Vendor role group not found. Run migrations."
14488
+ error: "Vendor group not found. Run migrations."
14148
14489
  }, {
14149
14490
  status: 500
14150
14491
  });
@@ -14163,11 +14504,327 @@ function createVendorOnboardHandlers(config) {
14163
14504
  status: 400
14164
14505
  });
14165
14506
  }
14166
- return json({
14167
- error: "Server error"
14168
- }, {
14169
- status: 500
14170
- });
14507
+ return vendorOnboardErrorResponse(json, e);
14508
+ }
14509
+ },
14510
+ /** POST /api/admin/vendor/team/send-invite — send invite email for a pending team member */
14511
+ async sendTeamInviteEmail(req) {
14512
+ const gated = await gateVendorTeam();
14513
+ if (gated instanceof Response) return gated;
14514
+ const { vendorId } = gated;
14515
+ if (!entityMap.vendors || !entityMap.users) {
14516
+ return json({
14517
+ error: "Vendor entities not configured"
14518
+ }, {
14519
+ status: 500
14520
+ });
14521
+ }
14522
+ try {
14523
+ const body = await req.json().catch(() => ({}));
14524
+ const userId = Number(body.userId);
14525
+ if (!Number.isFinite(userId) || userId <= 0) {
14526
+ return json({
14527
+ error: "userId is required"
14528
+ }, {
14529
+ status: 400
14530
+ });
14531
+ }
14532
+ const vendorRow = await dataSource.getRepository(entityMap.vendors).findOne({
14533
+ where: {
14534
+ id: vendorId,
14535
+ deleted: false
14536
+ }
14537
+ });
14538
+ if (!vendorRow) return json({
14539
+ error: "Vendor not found"
14540
+ }, {
14541
+ status: 404
14542
+ });
14543
+ const vendorName = String(vendorRow.name ?? "Vendor store");
14544
+ const vendorSlug = String(vendorRow.slug ?? "");
14545
+ const meta = vendorRow.metadata;
14546
+ const pending = findPendingTeamInviteByUserId(meta, userId);
14547
+ if (pending) {
14548
+ const inviteLink2 = buildTeamMembershipInviteLink(baseUrl, pending.token, vendorId);
14549
+ const emailSent2 = await trySendVendorOnboardEmails({
14550
+ vendorName,
14551
+ vendorSlug,
14552
+ ownerName: pending.name,
14553
+ ownerEmail: pending.email,
14554
+ activation: "membership",
14555
+ inviteLink: inviteLink2,
14556
+ kind: "team_invite",
14557
+ sendToOwner: true
14558
+ });
14559
+ return json({
14560
+ message: emailSent2 ? "Invite email sent" : "Invite email may not have been sent",
14561
+ emailSent: emailSent2,
14562
+ inviteLink: inviteLink2,
14563
+ activation: "membership"
14564
+ });
14565
+ }
14566
+ const user = await dataSource.getRepository(entityMap.users).findOne({
14567
+ where: {
14568
+ id: userId,
14569
+ deleted: false
14570
+ },
14571
+ select: [
14572
+ "id",
14573
+ "name",
14574
+ "email",
14575
+ "inviteToken",
14576
+ "inviteStatus",
14577
+ "password",
14578
+ "blocked"
14579
+ ]
14580
+ });
14581
+ if (!user) return json({
14582
+ error: "User not found"
14583
+ }, {
14584
+ status: 404
14585
+ });
14586
+ if (entityMap.vendor_users) {
14587
+ const link = await dataSource.getRepository(entityMap.vendor_users).findOne({
14588
+ where: {
14589
+ vendorId,
14590
+ userId
14591
+ }
14592
+ });
14593
+ if (!link) {
14594
+ return json({
14595
+ error: "User is not on this vendor team"
14596
+ }, {
14597
+ status: 400
14598
+ });
14599
+ }
14600
+ }
14601
+ const token = String(user.inviteToken ?? "").trim();
14602
+ if (!token || user.inviteStatus !== "pending") {
14603
+ return json({
14604
+ error: "No pending invite for this user"
14605
+ }, {
14606
+ status: 400
14607
+ });
14608
+ }
14609
+ const inviteLink = buildUserInviteLink(baseUrl, token);
14610
+ const emailSent = await trySendVendorOnboardEmails({
14611
+ vendorName,
14612
+ vendorSlug,
14613
+ ownerName: String(user.name ?? ""),
14614
+ ownerEmail: String(user.email ?? ""),
14615
+ activation: "invite",
14616
+ inviteLink,
14617
+ kind: "team_invite",
14618
+ sendToOwner: true
14619
+ });
14620
+ return json({
14621
+ message: emailSent ? "Invite email sent" : "Invite email may not have been sent",
14622
+ emailSent,
14623
+ inviteLink,
14624
+ activation: "invite"
14625
+ });
14626
+ } catch (e) {
14627
+ console.error("[vendor.team send-invite]", e);
14628
+ return json({
14629
+ error: "Server Error"
14630
+ }, {
14631
+ status: 500
14632
+ });
14633
+ }
14634
+ },
14635
+ /** GET /api/admin/vendor/team-invite?token=&vendorId= — preflight for membership accept (no password) */
14636
+ async validateTeamInvite(req) {
14637
+ if (!entityMap.vendors) {
14638
+ return json({
14639
+ valid: false,
14640
+ error: "Vendors not configured"
14641
+ }, {
14642
+ status: 500
14643
+ });
14644
+ }
14645
+ try {
14646
+ const url = new URL(req.url);
14647
+ const token = url.searchParams.get("token")?.trim() ?? "";
14648
+ const vendorId = Number(url.searchParams.get("vendorId"));
14649
+ if (!token) return json({
14650
+ valid: false,
14651
+ error: "Invalid invite link. Token is missing."
14652
+ }, {
14653
+ status: 400
14654
+ });
14655
+ if (!Number.isFinite(vendorId) || vendorId <= 0) {
14656
+ return json({
14657
+ valid: false,
14658
+ error: "Invalid invite link. Store is missing."
14659
+ }, {
14660
+ status: 400
14661
+ });
14662
+ }
14663
+ const vendor = await dataSource.getRepository(entityMap.vendors).findOne({
14664
+ where: {
14665
+ id: vendorId,
14666
+ deleted: false
14667
+ }
14668
+ });
14669
+ if (!vendor) {
14670
+ return json({
14671
+ valid: false,
14672
+ error: "This invitation is no longer valid."
14673
+ }, {
14674
+ status: 400
14675
+ });
14676
+ }
14677
+ const invite = findPendingTeamInviteByToken(vendor.metadata, token);
14678
+ if (!invite) {
14679
+ return json({
14680
+ valid: false,
14681
+ error: "This invitation is no longer valid."
14682
+ }, {
14683
+ status: 400
14684
+ });
14685
+ }
14686
+ return json({
14687
+ valid: true,
14688
+ mode: "team",
14689
+ vendorId,
14690
+ vendorName: vendor.name ?? "Vendor store",
14691
+ email: invite.email
14692
+ });
14693
+ } catch (e) {
14694
+ console.error("[vendor.team-invite GET]", e);
14695
+ return json({
14696
+ valid: false,
14697
+ error: "Server Error"
14698
+ }, {
14699
+ status: 500
14700
+ });
14701
+ }
14702
+ },
14703
+ /** POST /api/admin/vendor/team-invite — accept membership (token; no password) */
14704
+ async acceptTeamInvite(req) {
14705
+ if (!entityMap.vendors || !entityMap.vendor_users || !entityMap.vendor_user_profiles || !entityMap.users) {
14706
+ return json({
14707
+ error: "Vendor entities not configured"
14708
+ }, {
14709
+ status: 500
14710
+ });
14711
+ }
14712
+ try {
14713
+ const body = await req.json().catch(() => ({}));
14714
+ const token = typeof body.token === "string" ? body.token.trim() : "";
14715
+ const vendorId = Number(body.vendorId);
14716
+ if (!token) return json({
14717
+ error: "token is required"
14718
+ }, {
14719
+ status: 400
14720
+ });
14721
+ if (!Number.isFinite(vendorId) || vendorId <= 0) {
14722
+ return json({
14723
+ error: "vendorId is required"
14724
+ }, {
14725
+ status: 400
14726
+ });
14727
+ }
14728
+ const result = await dataSource.transaction(async (em) => {
14729
+ const vendorRepo = em.getRepository(entityMap.vendors);
14730
+ const vendor = await vendorRepo.findOne({
14731
+ where: {
14732
+ id: vendorId,
14733
+ deleted: false
14734
+ }
14735
+ });
14736
+ if (!vendor) throw new Error("INVITE_INVALID");
14737
+ const meta = vendor.metadata;
14738
+ const inv = findPendingTeamInviteByToken(meta, token);
14739
+ if (!inv) throw new Error("INVITE_INVALID");
14740
+ const user = await em.getRepository(entityMap.users).findOne({
14741
+ where: {
14742
+ id: inv.userId,
14743
+ deleted: false
14744
+ }
14745
+ });
14746
+ if (!user || !userHasActiveLogin(user)) {
14747
+ throw new Error("INVITE_USER_INACTIVE");
14748
+ }
14749
+ const vuRepo = em.getRepository(entityMap.vendor_users);
14750
+ const existingLink = await vuRepo.findOne({
14751
+ where: {
14752
+ vendorId,
14753
+ userId: inv.userId
14754
+ }
14755
+ });
14756
+ if (existingLink) {
14757
+ await vendorRepo.update(vendorId, {
14758
+ metadata: removePendingTeamInviteTokenFromMetadata(meta, token),
14759
+ updatedAt: /* @__PURE__ */ new Date()
14760
+ });
14761
+ return {
14762
+ alreadyMember: true,
14763
+ vendorId
14764
+ };
14765
+ }
14766
+ if (entityMap.vendor_roles) {
14767
+ const roleRow = await em.getRepository(entityMap.vendor_roles).findOne({
14768
+ where: {
14769
+ id: inv.vendorRoleId,
14770
+ vendorId,
14771
+ deleted: false
14772
+ }
14773
+ });
14774
+ if (!roleRow || roleRow.isOwnerRole) {
14775
+ throw new Error("INVALID_VENDOR_ROLE");
14776
+ }
14777
+ }
14778
+ const profile = await em.getRepository(entityMap.vendor_user_profiles).findOne({
14779
+ where: {
14780
+ id: inv.vendorUserProfileId
14781
+ }
14782
+ });
14783
+ if (!profile) throw new Error("INVITE_INVALID");
14784
+ await vuRepo.save(vuRepo.create({
14785
+ vendorId,
14786
+ userId: inv.userId,
14787
+ vendorRoleId: inv.vendorRoleId,
14788
+ vendorUserProfileId: inv.vendorUserProfileId
14789
+ }));
14790
+ await vendorRepo.update(vendorId, {
14791
+ metadata: removePendingTeamInviteTokenFromMetadata(meta, token),
14792
+ updatedAt: /* @__PURE__ */ new Date()
14793
+ });
14794
+ return {
14795
+ alreadyMember: false,
14796
+ vendorId
14797
+ };
14798
+ });
14799
+ return json({
14800
+ success: true,
14801
+ message: result.alreadyMember ? "You are already on this store team. Sign in to continue." : "You joined the store team. Sign in with your existing password.",
14802
+ vendorId: result.vendorId
14803
+ });
14804
+ } catch (e) {
14805
+ const msg = e instanceof Error ? e.message : String(e);
14806
+ if (msg === "INVITE_INVALID") {
14807
+ return json({
14808
+ error: "This invitation is no longer valid."
14809
+ }, {
14810
+ status: 400
14811
+ });
14812
+ }
14813
+ if (msg === "INVITE_USER_INACTIVE") {
14814
+ return json({
14815
+ error: "Your account is not active. Complete account setup first, or contact support."
14816
+ }, {
14817
+ status: 400
14818
+ });
14819
+ }
14820
+ if (msg === "INVALID_VENDOR_ROLE") {
14821
+ return json({
14822
+ error: "Invalid store role on this invitation"
14823
+ }, {
14824
+ status: 400
14825
+ });
14826
+ }
14827
+ return vendorOnboardErrorResponse(json, e);
14171
14828
  }
14172
14829
  },
14173
14830
  /** PATCH /api/admin/vendor/team/:userId — change member store role */
@@ -14222,14 +14879,18 @@ function createVendorOnboardHandlers(config) {
14222
14879
  where: {
14223
14880
  vendorId,
14224
14881
  userId
14225
- }
14882
+ },
14883
+ relations: entityMap.vendor_roles ? [
14884
+ "vendorRole"
14885
+ ] : []
14226
14886
  });
14227
14887
  if (!link) return json({
14228
14888
  error: "Not found"
14229
14889
  }, {
14230
14890
  status: 404
14231
14891
  });
14232
- if (link.role === "owner") {
14892
+ const linkIsOwner = link.vendorRole?.isOwnerRole === true;
14893
+ if (linkIsOwner) {
14233
14894
  return json({
14234
14895
  error: "Cannot change the store owner role here"
14235
14896
  }, {
@@ -14237,8 +14898,7 @@ function createVendorOnboardHandlers(config) {
14237
14898
  });
14238
14899
  }
14239
14900
  await vuRepo.update(link.id, {
14240
- vendorRoleId,
14241
- role: "staff"
14901
+ vendorRoleId
14242
14902
  });
14243
14903
  return json({
14244
14904
  ok: true,
@@ -14284,7 +14944,7 @@ function createVendorOnboardHandlers(config) {
14284
14944
  }, {
14285
14945
  status: 404
14286
14946
  });
14287
- const isOwner = link.role === "owner" || !!link.vendorRole?.isOwnerRole;
14947
+ const isOwner = !!link.vendorRole?.isOwnerRole;
14288
14948
  if (isOwner && Number(actor.id) !== userId) {
14289
14949
  return json({
14290
14950
  error: "Cannot remove the store owner"
@@ -14429,13 +15089,28 @@ function createVendorRolesHandlers(config) {
14429
15089
  isSystem: false,
14430
15090
  isOwnerRole: false
14431
15091
  }));
15092
+ const permRepo = dataSource.getRepository(entityMap.vendor_role_permissions);
15093
+ await permRepo.save(vendorRoleEntities.map((entity) => permRepo.create({
15094
+ vendorRoleId: role.id,
15095
+ entity,
15096
+ canCreate: false,
15097
+ canRead: false,
15098
+ canUpdate: false,
15099
+ canDelete: false
15100
+ })));
14432
15101
  return json({
14433
15102
  id: role.id,
14434
15103
  name: role.name,
14435
15104
  description: role.description,
14436
15105
  isSystem: role.isSystem,
14437
15106
  isOwnerRole: role.isOwnerRole,
14438
- permissions: []
15107
+ permissions: vendorRoleEntities.map((entity) => ({
15108
+ entity,
15109
+ canCreate: false,
15110
+ canRead: false,
15111
+ canUpdate: false,
15112
+ canDelete: false
15113
+ }))
14439
15114
  }, {
14440
15115
  status: 201
14441
15116
  });
@@ -14633,16 +15308,15 @@ function createVendorRolesHandlers(config) {
14633
15308
  await em.getRepository(entityMap.vendor_role_permissions).delete({
14634
15309
  vendorRoleId: id
14635
15310
  });
14636
- for (const r of rows) {
14637
- await em.getRepository(entityMap.vendor_role_permissions).save(em.getRepository(entityMap.vendor_role_permissions).create({
14638
- vendorRoleId: id,
14639
- entity: r.entity,
14640
- canCreate: !!r.canCreate,
14641
- canRead: !!r.canRead,
14642
- canUpdate: !!r.canUpdate,
14643
- canDelete: !!r.canDelete
14644
- }));
14645
- }
15311
+ const permRepo = em.getRepository(entityMap.vendor_role_permissions);
15312
+ await permRepo.save(rows.map((r) => permRepo.create({
15313
+ vendorRoleId: id,
15314
+ entity: r.entity,
15315
+ canCreate: !!r.canCreate,
15316
+ canRead: !!r.canRead,
15317
+ canUpdate: !!r.canUpdate,
15318
+ canDelete: !!r.canDelete
15319
+ })));
14646
15320
  });
14647
15321
  const updated = await roleRepo.findOne({
14648
15322
  where: {
@@ -14662,7 +15336,8 @@ function createVendorRolesHandlers(config) {
14662
15336
  canDelete: p.canDelete
14663
15337
  }))
14664
15338
  });
14665
- } catch {
15339
+ } catch (e) {
15340
+ console.error("[vendor-roles.putPermissions]", e);
14666
15341
  return json({
14667
15342
  error: "Server error"
14668
15343
  }, {
@@ -16299,7 +16974,6 @@ var Vendor = class {
16299
16974
  country;
16300
16975
  postalCode;
16301
16976
  gstin;
16302
- pan;
16303
16977
  logo;
16304
16978
  description;
16305
16979
  metadata;
@@ -16403,12 +17077,6 @@ _ts_decorate16([
16403
17077
  }),
16404
17078
  _ts_metadata16("design:type", Object)
16405
17079
  ], Vendor.prototype, "gstin", void 0);
16406
- _ts_decorate16([
16407
- Column("varchar", {
16408
- nullable: true
16409
- }),
16410
- _ts_metadata16("design:type", Object)
16411
- ], Vendor.prototype, "pan", void 0);
16412
17080
  _ts_decorate16([
16413
17081
  Column("varchar", {
16414
17082
  nullable: true
@@ -21724,8 +22392,6 @@ VendorRole = _ts_decorate57([
21724
22392
  "vendorId"
21725
22393
  ])
21726
22394
  ], VendorRole);
21727
-
21728
- // src/entities/vendor-user.entity.ts
21729
22395
  function _ts_decorate58(decorators, target, key, desc) {
21730
22396
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
21731
22397
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -21737,89 +22403,201 @@ function _ts_metadata58(k, v) {
21737
22403
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
21738
22404
  }
21739
22405
  __name(_ts_metadata58, "_ts_metadata");
21740
- var VendorUser = class {
22406
+ var VendorUserProfile = class {
21741
22407
  static {
21742
- __name(this, "VendorUser");
22408
+ __name(this, "VendorUserProfile");
21743
22409
  }
21744
22410
  id;
21745
- vendorId;
21746
- userId;
21747
- /** @deprecated use vendorRoleId — kept for migration compatibility */
21748
- role;
21749
- vendorRoleId;
22411
+ name;
22412
+ email;
22413
+ phone;
22414
+ aadhaarNo;
22415
+ panNo;
22416
+ addressLine1;
22417
+ addressLine2;
22418
+ city;
22419
+ state;
22420
+ postalCode;
21750
22421
  createdAt;
21751
22422
  updatedAt;
21752
- vendor;
21753
- user;
21754
- vendorRole;
21755
22423
  };
21756
22424
  _ts_decorate58([
21757
22425
  PrimaryGeneratedColumn(),
21758
22426
  _ts_metadata58("design:type", Number)
21759
- ], VendorUser.prototype, "id", void 0);
22427
+ ], VendorUserProfile.prototype, "id", void 0);
21760
22428
  _ts_decorate58([
21761
- Column("int"),
21762
- _ts_metadata58("design:type", Number)
21763
- ], VendorUser.prototype, "vendorId", void 0);
22429
+ Column("varchar"),
22430
+ _ts_metadata58("design:type", String)
22431
+ ], VendorUserProfile.prototype, "name", void 0);
21764
22432
  _ts_decorate58([
21765
- Column("int"),
21766
- _ts_metadata58("design:type", Number)
21767
- ], VendorUser.prototype, "userId", void 0);
22433
+ Column("varchar"),
22434
+ _ts_metadata58("design:type", String)
22435
+ ], VendorUserProfile.prototype, "email", void 0);
21768
22436
  _ts_decorate58([
21769
22437
  Column("varchar", {
21770
- default: "staff"
22438
+ nullable: true
21771
22439
  }),
21772
- _ts_metadata58("design:type", typeof VendorUserRole === "undefined" ? Object : VendorUserRole)
21773
- ], VendorUser.prototype, "role", void 0);
22440
+ _ts_metadata58("design:type", Object)
22441
+ ], VendorUserProfile.prototype, "phone", void 0);
21774
22442
  _ts_decorate58([
21775
- Column("int", {
22443
+ Column("varchar", {
21776
22444
  nullable: true
21777
22445
  }),
21778
22446
  _ts_metadata58("design:type", Object)
21779
- ], VendorUser.prototype, "vendorRoleId", void 0);
22447
+ ], VendorUserProfile.prototype, "aadhaarNo", void 0);
22448
+ _ts_decorate58([
22449
+ Column("varchar", {
22450
+ nullable: true
22451
+ }),
22452
+ _ts_metadata58("design:type", Object)
22453
+ ], VendorUserProfile.prototype, "panNo", void 0);
22454
+ _ts_decorate58([
22455
+ Column("varchar", {
22456
+ nullable: true
22457
+ }),
22458
+ _ts_metadata58("design:type", Object)
22459
+ ], VendorUserProfile.prototype, "addressLine1", void 0);
22460
+ _ts_decorate58([
22461
+ Column("varchar", {
22462
+ nullable: true
22463
+ }),
22464
+ _ts_metadata58("design:type", Object)
22465
+ ], VendorUserProfile.prototype, "addressLine2", void 0);
22466
+ _ts_decorate58([
22467
+ Column("varchar", {
22468
+ nullable: true
22469
+ }),
22470
+ _ts_metadata58("design:type", Object)
22471
+ ], VendorUserProfile.prototype, "city", void 0);
22472
+ _ts_decorate58([
22473
+ Column("varchar", {
22474
+ nullable: true
22475
+ }),
22476
+ _ts_metadata58("design:type", Object)
22477
+ ], VendorUserProfile.prototype, "state", void 0);
22478
+ _ts_decorate58([
22479
+ Column("varchar", {
22480
+ nullable: true
22481
+ }),
22482
+ _ts_metadata58("design:type", Object)
22483
+ ], VendorUserProfile.prototype, "postalCode", void 0);
21780
22484
  _ts_decorate58([
21781
22485
  Column({
21782
22486
  type: "timestamp",
21783
22487
  default: /* @__PURE__ */ __name(() => "CURRENT_TIMESTAMP", "default")
21784
22488
  }),
21785
22489
  _ts_metadata58("design:type", typeof Date === "undefined" ? Object : Date)
21786
- ], VendorUser.prototype, "createdAt", void 0);
22490
+ ], VendorUserProfile.prototype, "createdAt", void 0);
21787
22491
  _ts_decorate58([
21788
22492
  Column({
21789
22493
  type: "timestamp",
21790
22494
  default: /* @__PURE__ */ __name(() => "CURRENT_TIMESTAMP", "default")
21791
22495
  }),
21792
22496
  _ts_metadata58("design:type", typeof Date === "undefined" ? Object : Date)
22497
+ ], VendorUserProfile.prototype, "updatedAt", void 0);
22498
+ VendorUserProfile = _ts_decorate58([
22499
+ Entity("vendor_user_profiles")
22500
+ ], VendorUserProfile);
22501
+
22502
+ // src/entities/vendor-user.entity.ts
22503
+ function _ts_decorate59(decorators, target, key, desc) {
22504
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
22505
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
22506
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22507
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22508
+ }
22509
+ __name(_ts_decorate59, "_ts_decorate");
22510
+ function _ts_metadata59(k, v) {
22511
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
22512
+ }
22513
+ __name(_ts_metadata59, "_ts_metadata");
22514
+ var VendorUser = class {
22515
+ static {
22516
+ __name(this, "VendorUser");
22517
+ }
22518
+ id;
22519
+ vendorId;
22520
+ userId;
22521
+ vendorRoleId;
22522
+ vendorUserProfileId;
22523
+ createdAt;
22524
+ updatedAt;
22525
+ vendor;
22526
+ user;
22527
+ vendorRole;
22528
+ vendorUserProfile;
22529
+ };
22530
+ _ts_decorate59([
22531
+ PrimaryGeneratedColumn(),
22532
+ _ts_metadata59("design:type", Number)
22533
+ ], VendorUser.prototype, "id", void 0);
22534
+ _ts_decorate59([
22535
+ Column("int"),
22536
+ _ts_metadata59("design:type", Number)
22537
+ ], VendorUser.prototype, "vendorId", void 0);
22538
+ _ts_decorate59([
22539
+ Column("int"),
22540
+ _ts_metadata59("design:type", Number)
22541
+ ], VendorUser.prototype, "userId", void 0);
22542
+ _ts_decorate59([
22543
+ Column("int"),
22544
+ _ts_metadata59("design:type", Number)
22545
+ ], VendorUser.prototype, "vendorRoleId", void 0);
22546
+ _ts_decorate59([
22547
+ Column("int"),
22548
+ _ts_metadata59("design:type", Number)
22549
+ ], VendorUser.prototype, "vendorUserProfileId", void 0);
22550
+ _ts_decorate59([
22551
+ Column({
22552
+ type: "timestamp",
22553
+ default: /* @__PURE__ */ __name(() => "CURRENT_TIMESTAMP", "default")
22554
+ }),
22555
+ _ts_metadata59("design:type", typeof Date === "undefined" ? Object : Date)
22556
+ ], VendorUser.prototype, "createdAt", void 0);
22557
+ _ts_decorate59([
22558
+ Column({
22559
+ type: "timestamp",
22560
+ default: /* @__PURE__ */ __name(() => "CURRENT_TIMESTAMP", "default")
22561
+ }),
22562
+ _ts_metadata59("design:type", typeof Date === "undefined" ? Object : Date)
21793
22563
  ], VendorUser.prototype, "updatedAt", void 0);
21794
- _ts_decorate58([
22564
+ _ts_decorate59([
21795
22565
  ManyToOne(() => Vendor, (v) => v.vendorUsers, {
21796
22566
  onDelete: "CASCADE"
21797
22567
  }),
21798
22568
  JoinColumn({
21799
22569
  name: "vendorId"
21800
22570
  }),
21801
- _ts_metadata58("design:type", typeof Vendor === "undefined" ? Object : Vendor)
22571
+ _ts_metadata59("design:type", typeof Vendor === "undefined" ? Object : Vendor)
21802
22572
  ], VendorUser.prototype, "vendor", void 0);
21803
- _ts_decorate58([
22573
+ _ts_decorate59([
21804
22574
  ManyToOne(() => User, {
21805
22575
  onDelete: "CASCADE"
21806
22576
  }),
21807
22577
  JoinColumn({
21808
22578
  name: "userId"
21809
22579
  }),
21810
- _ts_metadata58("design:type", typeof User === "undefined" ? Object : User)
22580
+ _ts_metadata59("design:type", typeof User === "undefined" ? Object : User)
21811
22581
  ], VendorUser.prototype, "user", void 0);
21812
- _ts_decorate58([
22582
+ _ts_decorate59([
21813
22583
  ManyToOne(() => VendorRole, {
21814
- onDelete: "SET NULL",
21815
- nullable: true
22584
+ onDelete: "RESTRICT"
21816
22585
  }),
21817
22586
  JoinColumn({
21818
22587
  name: "vendorRoleId"
21819
22588
  }),
21820
- _ts_metadata58("design:type", Object)
22589
+ _ts_metadata59("design:type", typeof VendorRole === "undefined" ? Object : VendorRole)
21821
22590
  ], VendorUser.prototype, "vendorRole", void 0);
21822
- VendorUser = _ts_decorate58([
22591
+ _ts_decorate59([
22592
+ ManyToOne(() => VendorUserProfile, {
22593
+ onDelete: "RESTRICT"
22594
+ }),
22595
+ JoinColumn({
22596
+ name: "vendorUserProfileId"
22597
+ }),
22598
+ _ts_metadata59("design:type", typeof VendorUserProfile === "undefined" ? Object : VendorUserProfile)
22599
+ ], VendorUser.prototype, "vendorUserProfile", void 0);
22600
+ VendorUser = _ts_decorate59([
21823
22601
  Entity("vendor_users"),
21824
22602
  Unique("UQ_vendor_users_vendor_user", [
21825
22603
  "vendorId",
@@ -21833,19 +22611,22 @@ VendorUser = _ts_decorate58([
21833
22611
  ]),
21834
22612
  Index("IDX_vendor_users_vendor_role", [
21835
22613
  "vendorRoleId"
22614
+ ]),
22615
+ Index("IDX_vendor_users_profile", [
22616
+ "vendorUserProfileId"
21836
22617
  ])
21837
22618
  ], VendorUser);
21838
- function _ts_decorate59(decorators, target, key, desc) {
22619
+ function _ts_decorate60(decorators, target, key, desc) {
21839
22620
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
21840
22621
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21841
22622
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21842
22623
  return c > 3 && r && Object.defineProperty(target, key, r), r;
21843
22624
  }
21844
- __name(_ts_decorate59, "_ts_decorate");
21845
- function _ts_metadata59(k, v) {
22625
+ __name(_ts_decorate60, "_ts_decorate");
22626
+ function _ts_metadata60(k, v) {
21846
22627
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
21847
22628
  }
21848
- __name(_ts_metadata59, "_ts_metadata");
22629
+ __name(_ts_metadata60, "_ts_metadata");
21849
22630
  var VendorCustomer = class {
21850
22631
  static {
21851
22632
  __name(this, "VendorCustomer");
@@ -21864,78 +22645,78 @@ var VendorCustomer = class {
21864
22645
  contact;
21865
22646
  customer;
21866
22647
  };
21867
- _ts_decorate59([
22648
+ _ts_decorate60([
21868
22649
  PrimaryGeneratedColumn(),
21869
- _ts_metadata59("design:type", Number)
22650
+ _ts_metadata60("design:type", Number)
21870
22651
  ], VendorCustomer.prototype, "id", void 0);
21871
- _ts_decorate59([
22652
+ _ts_decorate60([
21872
22653
  Column("int"),
21873
- _ts_metadata59("design:type", Number)
22654
+ _ts_metadata60("design:type", Number)
21874
22655
  ], VendorCustomer.prototype, "vendorId", void 0);
21875
- _ts_decorate59([
22656
+ _ts_decorate60([
21876
22657
  Column("int", {
21877
22658
  nullable: true
21878
22659
  }),
21879
- _ts_metadata59("design:type", Object)
22660
+ _ts_metadata60("design:type", Object)
21880
22661
  ], VendorCustomer.prototype, "contactId", void 0);
21881
- _ts_decorate59([
22662
+ _ts_decorate60([
21882
22663
  Column("int"),
21883
- _ts_metadata59("design:type", Number)
22664
+ _ts_metadata60("design:type", Number)
21884
22665
  ], VendorCustomer.prototype, "customerId", void 0);
21885
- _ts_decorate59([
22666
+ _ts_decorate60([
21886
22667
  Column("text", {
21887
22668
  nullable: true
21888
22669
  }),
21889
- _ts_metadata59("design:type", Object)
22670
+ _ts_metadata60("design:type", Object)
21890
22671
  ], VendorCustomer.prototype, "notes", void 0);
21891
- _ts_decorate59([
22672
+ _ts_decorate60([
21892
22673
  Column("simple-array", {
21893
22674
  nullable: true
21894
22675
  }),
21895
- _ts_metadata59("design:type", Object)
22676
+ _ts_metadata60("design:type", Object)
21896
22677
  ], VendorCustomer.prototype, "tags", void 0);
21897
- _ts_decorate59([
22678
+ _ts_decorate60([
21898
22679
  Column({
21899
22680
  type: "timestamp",
21900
22681
  default: /* @__PURE__ */ __name(() => "CURRENT_TIMESTAMP", "default")
21901
22682
  }),
21902
- _ts_metadata59("design:type", typeof Date === "undefined" ? Object : Date)
22683
+ _ts_metadata60("design:type", typeof Date === "undefined" ? Object : Date)
21903
22684
  ], VendorCustomer.prototype, "createdAt", void 0);
21904
- _ts_decorate59([
22685
+ _ts_decorate60([
21905
22686
  Column({
21906
22687
  type: "timestamp",
21907
22688
  default: /* @__PURE__ */ __name(() => "CURRENT_TIMESTAMP", "default")
21908
22689
  }),
21909
- _ts_metadata59("design:type", typeof Date === "undefined" ? Object : Date)
22690
+ _ts_metadata60("design:type", typeof Date === "undefined" ? Object : Date)
21910
22691
  ], VendorCustomer.prototype, "updatedAt", void 0);
21911
- _ts_decorate59([
22692
+ _ts_decorate60([
21912
22693
  ManyToOne(() => Vendor, {
21913
22694
  onDelete: "CASCADE"
21914
22695
  }),
21915
22696
  JoinColumn({
21916
22697
  name: "vendorId"
21917
22698
  }),
21918
- _ts_metadata59("design:type", typeof Vendor === "undefined" ? Object : Vendor)
22699
+ _ts_metadata60("design:type", typeof Vendor === "undefined" ? Object : Vendor)
21919
22700
  ], VendorCustomer.prototype, "vendor", void 0);
21920
- _ts_decorate59([
22701
+ _ts_decorate60([
21921
22702
  ManyToOne(() => Contact, {
21922
22703
  onDelete: "CASCADE"
21923
22704
  }),
21924
22705
  JoinColumn({
21925
22706
  name: "contactId"
21926
22707
  }),
21927
- _ts_metadata59("design:type", Object)
22708
+ _ts_metadata60("design:type", Object)
21928
22709
  ], VendorCustomer.prototype, "contact", void 0);
21929
- _ts_decorate59([
22710
+ _ts_decorate60([
21930
22711
  ManyToOne(() => Customer, {
21931
22712
  onDelete: "CASCADE"
21932
22713
  }),
21933
22714
  JoinColumn({
21934
22715
  name: "customerId"
21935
22716
  }),
21936
- _ts_metadata59("design:type", typeof Customer === "undefined" ? Object : Customer)
22717
+ _ts_metadata60("design:type", typeof Customer === "undefined" ? Object : Customer)
21937
22718
  ], VendorCustomer.prototype, "customer", void 0);
21938
- VendorCustomer = _ts_decorate59([
22719
+ VendorCustomer = _ts_decorate60([
21939
22720
  Entity("vendor_customers"),
21940
22721
  Index("IDX_vendor_customers_vendor", [
21941
22722
  "vendorId"
@@ -21944,17 +22725,17 @@ VendorCustomer = _ts_decorate59([
21944
22725
  "contactId"
21945
22726
  ])
21946
22727
  ], VendorCustomer);
21947
- function _ts_decorate60(decorators, target, key, desc) {
22728
+ function _ts_decorate61(decorators, target, key, desc) {
21948
22729
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
21949
22730
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21950
22731
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21951
22732
  return c > 3 && r && Object.defineProperty(target, key, r), r;
21952
22733
  }
21953
- __name(_ts_decorate60, "_ts_decorate");
21954
- function _ts_metadata60(k, v) {
22734
+ __name(_ts_decorate61, "_ts_decorate");
22735
+ function _ts_metadata61(k, v) {
21955
22736
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
21956
22737
  }
21957
- __name(_ts_metadata60, "_ts_metadata");
22738
+ __name(_ts_metadata61, "_ts_metadata");
21958
22739
  var Event = class {
21959
22740
  static {
21960
22741
  __name(this, "Event");
@@ -22027,341 +22808,341 @@ var Event = class {
22027
22808
  refundPolicy;
22028
22809
  eventProducts;
22029
22810
  };
22030
- _ts_decorate60([
22811
+ _ts_decorate61([
22031
22812
  PrimaryGeneratedColumn(),
22032
- _ts_metadata60("design:type", Number)
22813
+ _ts_metadata61("design:type", Number)
22033
22814
  ], Event.prototype, "id", void 0);
22034
- _ts_decorate60([
22815
+ _ts_decorate61([
22035
22816
  Column("int", {
22036
22817
  nullable: true
22037
22818
  }),
22038
- _ts_metadata60("design:type", Object)
22819
+ _ts_metadata61("design:type", Object)
22039
22820
  ], Event.prototype, "vendorId", void 0);
22040
- _ts_decorate60([
22821
+ _ts_decorate61([
22041
22822
  Column("varchar"),
22042
- _ts_metadata60("design:type", String)
22823
+ _ts_metadata61("design:type", String)
22043
22824
  ], Event.prototype, "name", void 0);
22044
- _ts_decorate60([
22825
+ _ts_decorate61([
22045
22826
  Column("varchar"),
22046
- _ts_metadata60("design:type", String)
22827
+ _ts_metadata61("design:type", String)
22047
22828
  ], Event.prototype, "slug", void 0);
22048
- _ts_decorate60([
22829
+ _ts_decorate61([
22049
22830
  Column("text", {
22050
22831
  nullable: true
22051
22832
  }),
22052
- _ts_metadata60("design:type", Object)
22833
+ _ts_metadata61("design:type", Object)
22053
22834
  ], Event.prototype, "description", void 0);
22054
- _ts_decorate60([
22835
+ _ts_decorate61([
22055
22836
  Column("int", {
22056
22837
  nullable: true
22057
22838
  }),
22058
- _ts_metadata60("design:type", Object)
22839
+ _ts_metadata61("design:type", Object)
22059
22840
  ], Event.prototype, "expectedSpeakers", void 0);
22060
- _ts_decorate60([
22841
+ _ts_decorate61([
22061
22842
  Column("int", {
22062
22843
  nullable: true
22063
22844
  }),
22064
- _ts_metadata60("design:type", Object)
22845
+ _ts_metadata61("design:type", Object)
22065
22846
  ], Event.prototype, "expectedParticipants", void 0);
22066
- _ts_decorate60([
22847
+ _ts_decorate61([
22067
22848
  Column("boolean", {
22068
22849
  default: true
22069
22850
  }),
22070
- _ts_metadata60("design:type", Boolean)
22851
+ _ts_metadata61("design:type", Boolean)
22071
22852
  ], Event.prototype, "isActive", void 0);
22072
- _ts_decorate60([
22853
+ _ts_decorate61([
22073
22854
  Column("varchar", {
22074
22855
  nullable: true
22075
22856
  }),
22076
- _ts_metadata60("design:type", Object)
22857
+ _ts_metadata61("design:type", Object)
22077
22858
  ], Event.prototype, "approvalStatus", void 0);
22078
- _ts_decorate60([
22859
+ _ts_decorate61([
22079
22860
  Column("text", {
22080
22861
  nullable: true
22081
22862
  }),
22082
- _ts_metadata60("design:type", Object)
22863
+ _ts_metadata61("design:type", Object)
22083
22864
  ], Event.prototype, "rejectionReason", void 0);
22084
- _ts_decorate60([
22865
+ _ts_decorate61([
22085
22866
  Column({
22086
22867
  type: "timestamptz",
22087
22868
  nullable: true
22088
22869
  }),
22089
- _ts_metadata60("design:type", Object)
22870
+ _ts_metadata61("design:type", Object)
22090
22871
  ], Event.prototype, "rejectedAt", void 0);
22091
- _ts_decorate60([
22872
+ _ts_decorate61([
22092
22873
  Column("int", {
22093
22874
  nullable: true
22094
22875
  }),
22095
- _ts_metadata60("design:type", Object)
22876
+ _ts_metadata61("design:type", Object)
22096
22877
  ], Event.prototype, "rejectedBy", void 0);
22097
- _ts_decorate60([
22878
+ _ts_decorate61([
22098
22879
  Column("boolean", {
22099
22880
  default: false
22100
22881
  }),
22101
- _ts_metadata60("design:type", Boolean)
22882
+ _ts_metadata61("design:type", Boolean)
22102
22883
  ], Event.prototype, "comingSoon", void 0);
22103
- _ts_decorate60([
22884
+ _ts_decorate61([
22104
22885
  Column("varchar", {
22105
22886
  nullable: true
22106
22887
  }),
22107
- _ts_metadata60("design:type", Object)
22888
+ _ts_metadata61("design:type", Object)
22108
22889
  ], Event.prototype, "bannerImageUrl", void 0);
22109
- _ts_decorate60([
22890
+ _ts_decorate61([
22110
22891
  Column("varchar", {
22111
22892
  nullable: true
22112
22893
  }),
22113
- _ts_metadata60("design:type", Object)
22894
+ _ts_metadata61("design:type", Object)
22114
22895
  ], Event.prototype, "logoUrl", void 0);
22115
- _ts_decorate60([
22896
+ _ts_decorate61([
22116
22897
  Column("varchar", {
22117
22898
  nullable: true
22118
22899
  }),
22119
- _ts_metadata60("design:type", Object)
22900
+ _ts_metadata61("design:type", Object)
22120
22901
  ], Event.prototype, "venue", void 0);
22121
- _ts_decorate60([
22902
+ _ts_decorate61([
22122
22903
  Column("text", {
22123
22904
  nullable: true
22124
22905
  }),
22125
- _ts_metadata60("design:type", Object)
22906
+ _ts_metadata61("design:type", Object)
22126
22907
  ], Event.prototype, "additionalVenueDetails", void 0);
22127
- _ts_decorate60([
22908
+ _ts_decorate61([
22128
22909
  Column("varchar", {
22129
22910
  default: "public"
22130
22911
  }),
22131
- _ts_metadata60("design:type", typeof EventVisibility === "undefined" ? Object : EventVisibility)
22912
+ _ts_metadata61("design:type", typeof EventVisibility === "undefined" ? Object : EventVisibility)
22132
22913
  ], Event.prototype, "visibility", void 0);
22133
- _ts_decorate60([
22914
+ _ts_decorate61([
22134
22915
  Column({
22135
22916
  type: "timestamp",
22136
22917
  nullable: true
22137
22918
  }),
22138
- _ts_metadata60("design:type", Object)
22919
+ _ts_metadata61("design:type", Object)
22139
22920
  ], Event.prototype, "startDate", void 0);
22140
- _ts_decorate60([
22921
+ _ts_decorate61([
22141
22922
  Column({
22142
22923
  type: "timestamp",
22143
22924
  nullable: true
22144
22925
  }),
22145
- _ts_metadata60("design:type", Object)
22926
+ _ts_metadata61("design:type", Object)
22146
22927
  ], Event.prototype, "endDate", void 0);
22147
- _ts_decorate60([
22928
+ _ts_decorate61([
22148
22929
  Column({
22149
22930
  type: "timestamp",
22150
22931
  nullable: true
22151
22932
  }),
22152
- _ts_metadata60("design:type", Object)
22933
+ _ts_metadata61("design:type", Object)
22153
22934
  ], Event.prototype, "registrationOpensAt", void 0);
22154
- _ts_decorate60([
22935
+ _ts_decorate61([
22155
22936
  Column({
22156
22937
  type: "timestamp",
22157
22938
  nullable: true
22158
22939
  }),
22159
- _ts_metadata60("design:type", Object)
22940
+ _ts_metadata61("design:type", Object)
22160
22941
  ], Event.prototype, "registrationClosesAt", void 0);
22161
- _ts_decorate60([
22942
+ _ts_decorate61([
22162
22943
  Column("varchar", {
22163
22944
  nullable: true
22164
22945
  }),
22165
- _ts_metadata60("design:type", Object)
22946
+ _ts_metadata61("design:type", Object)
22166
22947
  ], Event.prototype, "pricingType", void 0);
22167
- _ts_decorate60([
22948
+ _ts_decorate61([
22168
22949
  Column("jsonb", {
22169
22950
  nullable: true
22170
22951
  }),
22171
- _ts_metadata60("design:type", Object)
22952
+ _ts_metadata61("design:type", Object)
22172
22953
  ], Event.prototype, "entityTypes", void 0);
22173
- _ts_decorate60([
22954
+ _ts_decorate61([
22174
22955
  Column("varchar", {
22175
22956
  nullable: true
22176
22957
  }),
22177
- _ts_metadata60("design:type", Object)
22958
+ _ts_metadata61("design:type", Object)
22178
22959
  ], Event.prototype, "entityMode", void 0);
22179
- _ts_decorate60([
22960
+ _ts_decorate61([
22180
22961
  Column("varchar", {
22181
22962
  nullable: true
22182
22963
  }),
22183
- _ts_metadata60("design:type", Object)
22964
+ _ts_metadata61("design:type", Object)
22184
22965
  ], Event.prototype, "city", void 0);
22185
- _ts_decorate60([
22966
+ _ts_decorate61([
22186
22967
  Column("varchar", {
22187
22968
  nullable: true
22188
22969
  }),
22189
- _ts_metadata60("design:type", Object)
22970
+ _ts_metadata61("design:type", Object)
22190
22971
  ], Event.prototype, "country", void 0);
22191
- _ts_decorate60([
22972
+ _ts_decorate61([
22192
22973
  Column("varchar", {
22193
22974
  nullable: true
22194
22975
  }),
22195
- _ts_metadata60("design:type", Object)
22976
+ _ts_metadata61("design:type", Object)
22196
22977
  ], Event.prototype, "cityCountry", void 0);
22197
- _ts_decorate60([
22978
+ _ts_decorate61([
22198
22979
  Column("varchar", {
22199
22980
  nullable: true
22200
22981
  }),
22201
- _ts_metadata60("design:type", Object)
22982
+ _ts_metadata61("design:type", Object)
22202
22983
  ], Event.prototype, "defaultCurrency", void 0);
22203
- _ts_decorate60([
22984
+ _ts_decorate61([
22204
22985
  Column("jsonb", {
22205
22986
  nullable: true
22206
22987
  }),
22207
- _ts_metadata60("design:type", Object)
22988
+ _ts_metadata61("design:type", Object)
22208
22989
  ], Event.prototype, "supportedCurrencies", void 0);
22209
- _ts_decorate60([
22990
+ _ts_decorate61([
22210
22991
  Column("varchar", {
22211
22992
  nullable: true
22212
22993
  }),
22213
- _ts_metadata60("design:type", Object)
22994
+ _ts_metadata61("design:type", Object)
22214
22995
  ], Event.prototype, "timezone", void 0);
22215
- _ts_decorate60([
22996
+ _ts_decorate61([
22216
22997
  Column("jsonb", {
22217
22998
  nullable: true
22218
22999
  }),
22219
- _ts_metadata60("design:type", Object)
23000
+ _ts_metadata61("design:type", Object)
22220
23001
  ], Event.prototype, "socialMediaLinks", void 0);
22221
- _ts_decorate60([
23002
+ _ts_decorate61([
22222
23003
  Column("varchar", {
22223
23004
  nullable: true
22224
23005
  }),
22225
- _ts_metadata60("design:type", Object)
23006
+ _ts_metadata61("design:type", Object)
22226
23007
  ], Event.prototype, "officialWebsiteUrl", void 0);
22227
- _ts_decorate60([
23008
+ _ts_decorate61([
22228
23009
  Column("varchar", {
22229
23010
  nullable: true
22230
23011
  }),
22231
- _ts_metadata60("design:type", Object)
23012
+ _ts_metadata61("design:type", Object)
22232
23013
  ], Event.prototype, "supportContact", void 0);
22233
- _ts_decorate60([
23014
+ _ts_decorate61([
22234
23015
  Column("boolean", {
22235
23016
  default: false
22236
23017
  }),
22237
- _ts_metadata60("design:type", Boolean)
23018
+ _ts_metadata61("design:type", Boolean)
22238
23019
  ], Event.prototype, "allowGroupOrders", void 0);
22239
- _ts_decorate60([
23020
+ _ts_decorate61([
22240
23021
  Column("boolean", {
22241
23022
  default: false
22242
23023
  }),
22243
- _ts_metadata60("design:type", Boolean)
23024
+ _ts_metadata61("design:type", Boolean)
22244
23025
  ], Event.prototype, "sendIndividualTicketPDFToAttendees", void 0);
22245
- _ts_decorate60([
23026
+ _ts_decorate61([
22246
23027
  Column("int", {
22247
23028
  nullable: true
22248
23029
  }),
22249
- _ts_metadata60("design:type", Object)
23030
+ _ts_metadata61("design:type", Object)
22250
23031
  ], Event.prototype, "contactFormId", void 0);
22251
- _ts_decorate60([
23032
+ _ts_decorate61([
22252
23033
  Column("int", {
22253
23034
  nullable: true
22254
23035
  }),
22255
- _ts_metadata60("design:type", Object)
23036
+ _ts_metadata61("design:type", Object)
22256
23037
  ], Event.prototype, "taxId", void 0);
22257
- _ts_decorate60([
23038
+ _ts_decorate61([
22258
23039
  Column("int", {
22259
23040
  nullable: true
22260
23041
  }),
22261
- _ts_metadata60("design:type", Object)
23042
+ _ts_metadata61("design:type", Object)
22262
23043
  ], Event.prototype, "refundPolicyId", void 0);
22263
- _ts_decorate60([
23044
+ _ts_decorate61([
22264
23045
  Column("decimal", {
22265
23046
  precision: 5,
22266
23047
  scale: 2,
22267
23048
  nullable: true
22268
23049
  }),
22269
- _ts_metadata60("design:type", Object)
23050
+ _ts_metadata61("design:type", Object)
22270
23051
  ], Event.prototype, "taxRate", void 0);
22271
- _ts_decorate60([
23052
+ _ts_decorate61([
22272
23053
  Column("int", {
22273
23054
  nullable: true
22274
23055
  }),
22275
- _ts_metadata60("design:type", Object)
23056
+ _ts_metadata61("design:type", Object)
22276
23057
  ], Event.prototype, "maxGroupPurchaseQuantity", void 0);
22277
- _ts_decorate60([
23058
+ _ts_decorate61([
22278
23059
  Column("jsonb", {
22279
23060
  nullable: true
22280
23061
  }),
22281
- _ts_metadata60("design:type", Object)
23062
+ _ts_metadata61("design:type", Object)
22282
23063
  ], Event.prototype, "sponsors", void 0);
22283
- _ts_decorate60([
23064
+ _ts_decorate61([
22284
23065
  Column("jsonb", {
22285
23066
  nullable: true
22286
23067
  }),
22287
- _ts_metadata60("design:type", Object)
23068
+ _ts_metadata61("design:type", Object)
22288
23069
  ], Event.prototype, "agenda", void 0);
22289
- _ts_decorate60([
23070
+ _ts_decorate61([
22290
23071
  Column("jsonb", {
22291
23072
  nullable: true
22292
23073
  }),
22293
- _ts_metadata60("design:type", Object)
23074
+ _ts_metadata61("design:type", Object)
22294
23075
  ], Event.prototype, "workshops", void 0);
22295
- _ts_decorate60([
23076
+ _ts_decorate61([
22296
23077
  Column("jsonb", {
22297
23078
  nullable: true
22298
23079
  }),
22299
- _ts_metadata60("design:type", Object)
23080
+ _ts_metadata61("design:type", Object)
22300
23081
  ], Event.prototype, "exhibitors", void 0);
22301
- _ts_decorate60([
23082
+ _ts_decorate61([
22302
23083
  Column("jsonb", {
22303
23084
  nullable: true
22304
23085
  }),
22305
- _ts_metadata60("design:type", Object)
23086
+ _ts_metadata61("design:type", Object)
22306
23087
  ], Event.prototype, "partners", void 0);
22307
- _ts_decorate60([
23088
+ _ts_decorate61([
22308
23089
  Column("jsonb", {
22309
23090
  nullable: true
22310
23091
  }),
22311
- _ts_metadata60("design:type", Object)
23092
+ _ts_metadata61("design:type", Object)
22312
23093
  ], Event.prototype, "speakers", void 0);
22313
- _ts_decorate60([
23094
+ _ts_decorate61([
22314
23095
  Column("int", {
22315
23096
  default: 0
22316
23097
  }),
22317
- _ts_metadata60("design:type", Number)
23098
+ _ts_metadata61("design:type", Number)
22318
23099
  ], Event.prototype, "sortOrder", void 0);
22319
- _ts_decorate60([
23100
+ _ts_decorate61([
22320
23101
  Column({
22321
23102
  type: "timestamp",
22322
23103
  default: /* @__PURE__ */ __name(() => "CURRENT_TIMESTAMP", "default")
22323
23104
  }),
22324
- _ts_metadata60("design:type", typeof Date === "undefined" ? Object : Date)
23105
+ _ts_metadata61("design:type", typeof Date === "undefined" ? Object : Date)
22325
23106
  ], Event.prototype, "createdAt", void 0);
22326
- _ts_decorate60([
23107
+ _ts_decorate61([
22327
23108
  Column({
22328
23109
  type: "timestamp",
22329
23110
  default: /* @__PURE__ */ __name(() => "CURRENT_TIMESTAMP", "default")
22330
23111
  }),
22331
- _ts_metadata60("design:type", typeof Date === "undefined" ? Object : Date)
23112
+ _ts_metadata61("design:type", typeof Date === "undefined" ? Object : Date)
22332
23113
  ], Event.prototype, "updatedAt", void 0);
22333
- _ts_decorate60([
23114
+ _ts_decorate61([
22334
23115
  Column({
22335
23116
  type: "timestamp",
22336
23117
  nullable: true
22337
23118
  }),
22338
- _ts_metadata60("design:type", Object)
23119
+ _ts_metadata61("design:type", Object)
22339
23120
  ], Event.prototype, "deletedAt", void 0);
22340
- _ts_decorate60([
23121
+ _ts_decorate61([
22341
23122
  Column("boolean", {
22342
23123
  default: false
22343
23124
  }),
22344
- _ts_metadata60("design:type", Boolean)
23125
+ _ts_metadata61("design:type", Boolean)
22345
23126
  ], Event.prototype, "deleted", void 0);
22346
- _ts_decorate60([
23127
+ _ts_decorate61([
22347
23128
  Column("int", {
22348
23129
  nullable: true
22349
23130
  }),
22350
- _ts_metadata60("design:type", Object)
23131
+ _ts_metadata61("design:type", Object)
22351
23132
  ], Event.prototype, "createdBy", void 0);
22352
- _ts_decorate60([
23133
+ _ts_decorate61([
22353
23134
  Column("int", {
22354
23135
  nullable: true
22355
23136
  }),
22356
- _ts_metadata60("design:type", Object)
23137
+ _ts_metadata61("design:type", Object)
22357
23138
  ], Event.prototype, "updatedBy", void 0);
22358
- _ts_decorate60([
23139
+ _ts_decorate61([
22359
23140
  Column("int", {
22360
23141
  nullable: true
22361
23142
  }),
22362
- _ts_metadata60("design:type", Object)
23143
+ _ts_metadata61("design:type", Object)
22363
23144
  ], Event.prototype, "deletedBy", void 0);
22364
- _ts_decorate60([
23145
+ _ts_decorate61([
22365
23146
  ManyToOne(() => Vendor, {
22366
23147
  onDelete: "RESTRICT",
22367
23148
  nullable: true
@@ -22369,9 +23150,9 @@ _ts_decorate60([
22369
23150
  JoinColumn({
22370
23151
  name: "vendorId"
22371
23152
  }),
22372
- _ts_metadata60("design:type", Object)
23153
+ _ts_metadata61("design:type", Object)
22373
23154
  ], Event.prototype, "vendor", void 0);
22374
- _ts_decorate60([
23155
+ _ts_decorate61([
22375
23156
  ManyToOne(() => Form, {
22376
23157
  onDelete: "SET NULL",
22377
23158
  nullable: true
@@ -22379,9 +23160,9 @@ _ts_decorate60([
22379
23160
  JoinColumn({
22380
23161
  name: "contactFormId"
22381
23162
  }),
22382
- _ts_metadata60("design:type", Object)
23163
+ _ts_metadata61("design:type", Object)
22383
23164
  ], Event.prototype, "contactForm", void 0);
22384
- _ts_decorate60([
23165
+ _ts_decorate61([
22385
23166
  ManyToOne(() => Tax, {
22386
23167
  onDelete: "SET NULL",
22387
23168
  nullable: true
@@ -22389,9 +23170,9 @@ _ts_decorate60([
22389
23170
  JoinColumn({
22390
23171
  name: "taxId"
22391
23172
  }),
22392
- _ts_metadata60("design:type", Object)
23173
+ _ts_metadata61("design:type", Object)
22393
23174
  ], Event.prototype, "tax", void 0);
22394
- _ts_decorate60([
23175
+ _ts_decorate61([
22395
23176
  ManyToOne(() => RefundPolicy, {
22396
23177
  onDelete: "SET NULL",
22397
23178
  nullable: true
@@ -22399,30 +23180,30 @@ _ts_decorate60([
22399
23180
  JoinColumn({
22400
23181
  name: "refundPolicyId"
22401
23182
  }),
22402
- _ts_metadata60("design:type", Object)
23183
+ _ts_metadata61("design:type", Object)
22403
23184
  ], Event.prototype, "refundPolicy", void 0);
22404
- _ts_decorate60([
23185
+ _ts_decorate61([
22405
23186
  OneToMany("EventProduct", "event"),
22406
- _ts_metadata60("design:type", Array)
23187
+ _ts_metadata61("design:type", Array)
22407
23188
  ], Event.prototype, "eventProducts", void 0);
22408
- Event = _ts_decorate60([
23189
+ Event = _ts_decorate61([
22409
23190
  Entity("events"),
22410
23191
  Unique("UQ_events_vendor_slug", [
22411
23192
  "vendorId",
22412
23193
  "slug"
22413
23194
  ])
22414
23195
  ], Event);
22415
- function _ts_decorate61(decorators, target, key, desc) {
23196
+ function _ts_decorate62(decorators, target, key, desc) {
22416
23197
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
22417
23198
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
22418
23199
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22419
23200
  return c > 3 && r && Object.defineProperty(target, key, r), r;
22420
23201
  }
22421
- __name(_ts_decorate61, "_ts_decorate");
22422
- function _ts_metadata61(k, v) {
23202
+ __name(_ts_decorate62, "_ts_decorate");
23203
+ function _ts_metadata62(k, v) {
22423
23204
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
22424
23205
  }
22425
- __name(_ts_metadata61, "_ts_metadata");
23206
+ __name(_ts_metadata62, "_ts_metadata");
22426
23207
  var EventProduct = class {
22427
23208
  static {
22428
23209
  __name(this, "EventProduct");
@@ -22437,63 +23218,63 @@ var EventProduct = class {
22437
23218
  event;
22438
23219
  product;
22439
23220
  };
22440
- _ts_decorate61([
23221
+ _ts_decorate62([
22441
23222
  PrimaryGeneratedColumn(),
22442
- _ts_metadata61("design:type", Number)
23223
+ _ts_metadata62("design:type", Number)
22443
23224
  ], EventProduct.prototype, "id", void 0);
22444
- _ts_decorate61([
23225
+ _ts_decorate62([
22445
23226
  Column("int"),
22446
- _ts_metadata61("design:type", Number)
23227
+ _ts_metadata62("design:type", Number)
22447
23228
  ], EventProduct.prototype, "eventId", void 0);
22448
- _ts_decorate61([
23229
+ _ts_decorate62([
22449
23230
  Column("int"),
22450
- _ts_metadata61("design:type", Number)
23231
+ _ts_metadata62("design:type", Number)
22451
23232
  ], EventProduct.prototype, "productId", void 0);
22452
- _ts_decorate61([
23233
+ _ts_decorate62([
22453
23234
  Column("int", {
22454
23235
  default: 0
22455
23236
  }),
22456
- _ts_metadata61("design:type", Number)
23237
+ _ts_metadata62("design:type", Number)
22457
23238
  ], EventProduct.prototype, "displayOrder", void 0);
22458
- _ts_decorate61([
23239
+ _ts_decorate62([
22459
23240
  Column("boolean", {
22460
23241
  default: true
22461
23242
  }),
22462
- _ts_metadata61("design:type", Boolean)
23243
+ _ts_metadata62("design:type", Boolean)
22463
23244
  ], EventProduct.prototype, "isActive", void 0);
22464
- _ts_decorate61([
23245
+ _ts_decorate62([
22465
23246
  Column({
22466
23247
  type: "timestamp",
22467
23248
  default: /* @__PURE__ */ __name(() => "CURRENT_TIMESTAMP", "default")
22468
23249
  }),
22469
- _ts_metadata61("design:type", typeof Date === "undefined" ? Object : Date)
23250
+ _ts_metadata62("design:type", typeof Date === "undefined" ? Object : Date)
22470
23251
  ], EventProduct.prototype, "createdAt", void 0);
22471
- _ts_decorate61([
23252
+ _ts_decorate62([
22472
23253
  Column({
22473
23254
  type: "timestamp",
22474
23255
  default: /* @__PURE__ */ __name(() => "CURRENT_TIMESTAMP", "default")
22475
23256
  }),
22476
- _ts_metadata61("design:type", typeof Date === "undefined" ? Object : Date)
23257
+ _ts_metadata62("design:type", typeof Date === "undefined" ? Object : Date)
22477
23258
  ], EventProduct.prototype, "updatedAt", void 0);
22478
- _ts_decorate61([
23259
+ _ts_decorate62([
22479
23260
  ManyToOne(() => Event, (event) => event.eventProducts, {
22480
23261
  onDelete: "CASCADE"
22481
23262
  }),
22482
23263
  JoinColumn({
22483
23264
  name: "eventId"
22484
23265
  }),
22485
- _ts_metadata61("design:type", typeof Event === "undefined" ? Object : Event)
23266
+ _ts_metadata62("design:type", typeof Event === "undefined" ? Object : Event)
22486
23267
  ], EventProduct.prototype, "event", void 0);
22487
- _ts_decorate61([
23268
+ _ts_decorate62([
22488
23269
  ManyToOne(() => Product, {
22489
23270
  onDelete: "CASCADE"
22490
23271
  }),
22491
23272
  JoinColumn({
22492
23273
  name: "productId"
22493
23274
  }),
22494
- _ts_metadata61("design:type", typeof Product === "undefined" ? Object : Product)
23275
+ _ts_metadata62("design:type", typeof Product === "undefined" ? Object : Product)
22495
23276
  ], EventProduct.prototype, "product", void 0);
22496
- EventProduct = _ts_decorate61([
23277
+ EventProduct = _ts_decorate62([
22497
23278
  Entity("event_products"),
22498
23279
  Unique("UQ_event_products_event_product", [
22499
23280
  "eventId",
@@ -22503,17 +23284,17 @@ EventProduct = _ts_decorate61([
22503
23284
  "eventId"
22504
23285
  ])
22505
23286
  ], EventProduct);
22506
- function _ts_decorate62(decorators, target, key, desc) {
23287
+ function _ts_decorate63(decorators, target, key, desc) {
22507
23288
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
22508
23289
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
22509
23290
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22510
23291
  return c > 3 && r && Object.defineProperty(target, key, r), r;
22511
23292
  }
22512
- __name(_ts_decorate62, "_ts_decorate");
22513
- function _ts_metadata62(k, v) {
23293
+ __name(_ts_decorate63, "_ts_decorate");
23294
+ function _ts_metadata63(k, v) {
22514
23295
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
22515
23296
  }
22516
- __name(_ts_metadata62, "_ts_metadata");
23297
+ __name(_ts_metadata63, "_ts_metadata");
22517
23298
  var ComboItemType = /* @__PURE__ */ (function(ComboItemType2) {
22518
23299
  ComboItemType2["FIXED"] = "fixed";
22519
23300
  ComboItemType2["ADDONS"] = "addons";
@@ -22530,64 +23311,64 @@ var ComboItem = class {
22530
23311
  product;
22531
23312
  type;
22532
23313
  };
22533
- _ts_decorate62([
23314
+ _ts_decorate63([
22534
23315
  PrimaryGeneratedColumn(),
22535
- _ts_metadata62("design:type", Number)
23316
+ _ts_metadata63("design:type", Number)
22536
23317
  ], ComboItem.prototype, "id", void 0);
22537
- _ts_decorate62([
23318
+ _ts_decorate63([
22538
23319
  Column({
22539
23320
  type: "integer"
22540
23321
  }),
22541
- _ts_metadata62("design:type", Number)
23322
+ _ts_metadata63("design:type", Number)
22542
23323
  ], ComboItem.prototype, "comboId", void 0);
22543
- _ts_decorate62([
23324
+ _ts_decorate63([
22544
23325
  ManyToOne(() => Combo, (combo) => combo.items, {
22545
23326
  onDelete: "CASCADE"
22546
23327
  }),
22547
23328
  JoinColumn({
22548
23329
  name: "comboId"
22549
23330
  }),
22550
- _ts_metadata62("design:type", typeof Combo === "undefined" ? Object : Combo)
23331
+ _ts_metadata63("design:type", typeof Combo === "undefined" ? Object : Combo)
22551
23332
  ], ComboItem.prototype, "combo", void 0);
22552
- _ts_decorate62([
23333
+ _ts_decorate63([
22553
23334
  Column({
22554
23335
  type: "integer"
22555
23336
  }),
22556
- _ts_metadata62("design:type", Number)
23337
+ _ts_metadata63("design:type", Number)
22557
23338
  ], ComboItem.prototype, "productId", void 0);
22558
- _ts_decorate62([
23339
+ _ts_decorate63([
22559
23340
  ManyToOne(() => Product, {
22560
23341
  onDelete: "CASCADE"
22561
23342
  }),
22562
23343
  JoinColumn({
22563
23344
  name: "productId"
22564
23345
  }),
22565
- _ts_metadata62("design:type", typeof Product === "undefined" ? Object : Product)
23346
+ _ts_metadata63("design:type", typeof Product === "undefined" ? Object : Product)
22566
23347
  ], ComboItem.prototype, "product", void 0);
22567
- _ts_decorate62([
23348
+ _ts_decorate63([
22568
23349
  Column({
22569
23350
  type: "enum",
22570
23351
  enum: ComboItemType,
22571
23352
  default: "fixed"
22572
23353
  }),
22573
- _ts_metadata62("design:type", String)
23354
+ _ts_metadata63("design:type", String)
22574
23355
  ], ComboItem.prototype, "type", void 0);
22575
- ComboItem = _ts_decorate62([
23356
+ ComboItem = _ts_decorate63([
22576
23357
  Entity("combo_items")
22577
23358
  ], ComboItem);
22578
23359
 
22579
23360
  // src/entities/combo.entity.ts
22580
- function _ts_decorate63(decorators, target, key, desc) {
23361
+ function _ts_decorate64(decorators, target, key, desc) {
22581
23362
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
22582
23363
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
22583
23364
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22584
23365
  return c > 3 && r && Object.defineProperty(target, key, r), r;
22585
23366
  }
22586
- __name(_ts_decorate63, "_ts_decorate");
22587
- function _ts_metadata63(k, v) {
23367
+ __name(_ts_decorate64, "_ts_decorate");
23368
+ function _ts_metadata64(k, v) {
22588
23369
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
22589
23370
  }
22590
- __name(_ts_metadata63, "_ts_metadata");
23371
+ __name(_ts_metadata64, "_ts_metadata");
22591
23372
  var ComboStatus = /* @__PURE__ */ (function(ComboStatus2) {
22592
23373
  ComboStatus2["ACTIVE"] = "active";
22593
23374
  ComboStatus2["INACTIVE"] = "inactive";
@@ -22623,50 +23404,50 @@ var Combo = class {
22623
23404
  updatedBy;
22624
23405
  deletedBy;
22625
23406
  };
22626
- _ts_decorate63([
23407
+ _ts_decorate64([
22627
23408
  PrimaryGeneratedColumn(),
22628
- _ts_metadata63("design:type", Number)
23409
+ _ts_metadata64("design:type", Number)
22629
23410
  ], Combo.prototype, "id", void 0);
22630
- _ts_decorate63([
23411
+ _ts_decorate64([
22631
23412
  Column("int"),
22632
- _ts_metadata63("design:type", Number)
23413
+ _ts_metadata64("design:type", Number)
22633
23414
  ], Combo.prototype, "vendorId", void 0);
22634
- _ts_decorate63([
23415
+ _ts_decorate64([
22635
23416
  ManyToOne(() => Vendor, {
22636
23417
  onDelete: "RESTRICT"
22637
23418
  }),
22638
23419
  JoinColumn({
22639
23420
  name: "vendorId"
22640
23421
  }),
22641
- _ts_metadata63("design:type", typeof Vendor === "undefined" ? Object : Vendor)
23422
+ _ts_metadata64("design:type", typeof Vendor === "undefined" ? Object : Vendor)
22642
23423
  ], Combo.prototype, "vendor", void 0);
22643
- _ts_decorate63([
23424
+ _ts_decorate64([
22644
23425
  Column({
22645
23426
  type: "varchar"
22646
23427
  }),
22647
- _ts_metadata63("design:type", String)
23428
+ _ts_metadata64("design:type", String)
22648
23429
  ], Combo.prototype, "name", void 0);
22649
- _ts_decorate63([
23430
+ _ts_decorate64([
22650
23431
  Column({
22651
23432
  type: "varchar"
22652
23433
  }),
22653
- _ts_metadata63("design:type", String)
23434
+ _ts_metadata64("design:type", String)
22654
23435
  ], Combo.prototype, "slug", void 0);
22655
- _ts_decorate63([
23436
+ _ts_decorate64([
22656
23437
  Column({
22657
23438
  type: "text",
22658
23439
  nullable: true
22659
23440
  }),
22660
- _ts_metadata63("design:type", String)
23441
+ _ts_metadata64("design:type", String)
22661
23442
  ], Combo.prototype, "desc", void 0);
22662
- _ts_decorate63([
23443
+ _ts_decorate64([
22663
23444
  Column({
22664
23445
  type: "integer",
22665
23446
  nullable: true
22666
23447
  }),
22667
- _ts_metadata63("design:type", Object)
23448
+ _ts_metadata64("design:type", Object)
22668
23449
  ], Combo.prototype, "eventId", void 0);
22669
- _ts_decorate63([
23450
+ _ts_decorate64([
22670
23451
  ManyToOne(() => Event, {
22671
23452
  onDelete: "CASCADE",
22672
23453
  nullable: true
@@ -22674,138 +23455,138 @@ _ts_decorate63([
22674
23455
  JoinColumn({
22675
23456
  name: "eventId"
22676
23457
  }),
22677
- _ts_metadata63("design:type", Object)
23458
+ _ts_metadata64("design:type", Object)
22678
23459
  ], Combo.prototype, "event", void 0);
22679
- _ts_decorate63([
23460
+ _ts_decorate64([
22680
23461
  Column({
22681
23462
  type: "decimal",
22682
23463
  precision: 12,
22683
23464
  scale: 2,
22684
23465
  default: 0
22685
23466
  }),
22686
- _ts_metadata63("design:type", Number)
23467
+ _ts_metadata64("design:type", Number)
22687
23468
  ], Combo.prototype, "price", void 0);
22688
- _ts_decorate63([
23469
+ _ts_decorate64([
22689
23470
  Column({
22690
23471
  type: "jsonb",
22691
23472
  nullable: true
22692
23473
  }),
22693
- _ts_metadata63("design:type", Object)
23474
+ _ts_metadata64("design:type", Object)
22694
23475
  ], Combo.prototype, "currencyPrices", void 0);
22695
- _ts_decorate63([
23476
+ _ts_decorate64([
22696
23477
  Column({
22697
23478
  type: "integer",
22698
23479
  default: 1
22699
23480
  }),
22700
- _ts_metadata63("design:type", Number)
23481
+ _ts_metadata64("design:type", Number)
22701
23482
  ], Combo.prototype, "minSelectableItems", void 0);
22702
- _ts_decorate63([
23483
+ _ts_decorate64([
22703
23484
  Column({
22704
23485
  type: "integer",
22705
23486
  default: 1
22706
23487
  }),
22707
- _ts_metadata63("design:type", Number)
23488
+ _ts_metadata64("design:type", Number)
22708
23489
  ], Combo.prototype, "maxSelectableItems", void 0);
22709
- _ts_decorate63([
23490
+ _ts_decorate64([
22710
23491
  Column({
22711
23492
  type: "enum",
22712
23493
  enum: ComboStatus,
22713
23494
  default: "active"
22714
23495
  }),
22715
- _ts_metadata63("design:type", String)
23496
+ _ts_metadata64("design:type", String)
22716
23497
  ], Combo.prototype, "status", void 0);
22717
- _ts_decorate63([
23498
+ _ts_decorate64([
22718
23499
  Column({
22719
23500
  type: "timestamp",
22720
23501
  nullable: true
22721
23502
  }),
22722
- _ts_metadata63("design:type", typeof Date === "undefined" ? Object : Date)
23503
+ _ts_metadata64("design:type", typeof Date === "undefined" ? Object : Date)
22723
23504
  ], Combo.prototype, "startsAt", void 0);
22724
- _ts_decorate63([
23505
+ _ts_decorate64([
22725
23506
  Column({
22726
23507
  type: "timestamp",
22727
23508
  nullable: true
22728
23509
  }),
22729
- _ts_metadata63("design:type", typeof Date === "undefined" ? Object : Date)
23510
+ _ts_metadata64("design:type", typeof Date === "undefined" ? Object : Date)
22730
23511
  ], Combo.prototype, "endsAt", void 0);
22731
- _ts_decorate63([
23512
+ _ts_decorate64([
22732
23513
  Column({
22733
23514
  type: "jsonb",
22734
23515
  nullable: true
22735
23516
  }),
22736
- _ts_metadata63("design:type", typeof Record === "undefined" ? Object : Record)
23517
+ _ts_metadata64("design:type", typeof Record === "undefined" ? Object : Record)
22737
23518
  ], Combo.prototype, "metadata", void 0);
22738
- _ts_decorate63([
23519
+ _ts_decorate64([
22739
23520
  OneToMany(() => ComboItem, (item) => item.combo),
22740
- _ts_metadata63("design:type", Array)
23521
+ _ts_metadata64("design:type", Array)
22741
23522
  ], Combo.prototype, "items", void 0);
22742
- _ts_decorate63([
23523
+ _ts_decorate64([
22743
23524
  Column({
22744
23525
  type: "timestamp",
22745
23526
  default: /* @__PURE__ */ __name(() => "now()", "default")
22746
23527
  }),
22747
- _ts_metadata63("design:type", typeof Date === "undefined" ? Object : Date)
23528
+ _ts_metadata64("design:type", typeof Date === "undefined" ? Object : Date)
22748
23529
  ], Combo.prototype, "createdAt", void 0);
22749
- _ts_decorate63([
23530
+ _ts_decorate64([
22750
23531
  Column({
22751
23532
  type: "timestamp",
22752
23533
  default: /* @__PURE__ */ __name(() => "now()", "default")
22753
23534
  }),
22754
- _ts_metadata63("design:type", typeof Date === "undefined" ? Object : Date)
23535
+ _ts_metadata64("design:type", typeof Date === "undefined" ? Object : Date)
22755
23536
  ], Combo.prototype, "updatedAt", void 0);
22756
- _ts_decorate63([
23537
+ _ts_decorate64([
22757
23538
  Column({
22758
23539
  type: "timestamp",
22759
23540
  nullable: true
22760
23541
  }),
22761
- _ts_metadata63("design:type", typeof Date === "undefined" ? Object : Date)
23542
+ _ts_metadata64("design:type", typeof Date === "undefined" ? Object : Date)
22762
23543
  ], Combo.prototype, "deletedAt", void 0);
22763
- _ts_decorate63([
23544
+ _ts_decorate64([
22764
23545
  Column({
22765
23546
  type: "boolean",
22766
23547
  default: false
22767
23548
  }),
22768
- _ts_metadata63("design:type", Boolean)
23549
+ _ts_metadata64("design:type", Boolean)
22769
23550
  ], Combo.prototype, "deleted", void 0);
22770
- _ts_decorate63([
23551
+ _ts_decorate64([
22771
23552
  Column({
22772
23553
  type: "integer",
22773
23554
  nullable: true
22774
23555
  }),
22775
- _ts_metadata63("design:type", Number)
23556
+ _ts_metadata64("design:type", Number)
22776
23557
  ], Combo.prototype, "createdBy", void 0);
22777
- _ts_decorate63([
23558
+ _ts_decorate64([
22778
23559
  Column({
22779
23560
  type: "integer",
22780
23561
  nullable: true
22781
23562
  }),
22782
- _ts_metadata63("design:type", Number)
23563
+ _ts_metadata64("design:type", Number)
22783
23564
  ], Combo.prototype, "updatedBy", void 0);
22784
- _ts_decorate63([
23565
+ _ts_decorate64([
22785
23566
  Column({
22786
23567
  type: "integer",
22787
23568
  nullable: true
22788
23569
  }),
22789
- _ts_metadata63("design:type", Number)
23570
+ _ts_metadata64("design:type", Number)
22790
23571
  ], Combo.prototype, "deletedBy", void 0);
22791
- Combo = _ts_decorate63([
23572
+ Combo = _ts_decorate64([
22792
23573
  Entity("combos"),
22793
23574
  Unique("UQ_combos_vendor_slug", [
22794
23575
  "vendorId",
22795
23576
  "slug"
22796
23577
  ])
22797
23578
  ], Combo);
22798
- function _ts_decorate64(decorators, target, key, desc) {
23579
+ function _ts_decorate65(decorators, target, key, desc) {
22799
23580
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
22800
23581
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
22801
23582
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22802
23583
  return c > 3 && r && Object.defineProperty(target, key, r), r;
22803
23584
  }
22804
- __name(_ts_decorate64, "_ts_decorate");
22805
- function _ts_metadata64(k, v) {
23585
+ __name(_ts_decorate65, "_ts_decorate");
23586
+ function _ts_metadata65(k, v) {
22806
23587
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
22807
23588
  }
22808
- __name(_ts_metadata64, "_ts_metadata");
23589
+ __name(_ts_metadata65, "_ts_metadata");
22809
23590
  var RefundMethod = /* @__PURE__ */ (function(RefundMethod2) {
22810
23591
  RefundMethod2["CARD"] = "card";
22811
23592
  RefundMethod2["UPI"] = "upi";
@@ -22836,109 +23617,109 @@ var RefundRequest = class {
22836
23617
  expectedRefundAmount;
22837
23618
  approvedRefundAmount;
22838
23619
  };
22839
- _ts_decorate64([
23620
+ _ts_decorate65([
22840
23621
  PrimaryGeneratedColumn(),
22841
- _ts_metadata64("design:type", Number)
23622
+ _ts_metadata65("design:type", Number)
22842
23623
  ], RefundRequest.prototype, "id", void 0);
22843
- _ts_decorate64([
23624
+ _ts_decorate65([
22844
23625
  Column({
22845
23626
  type: "integer"
22846
23627
  }),
22847
- _ts_metadata64("design:type", Number)
23628
+ _ts_metadata65("design:type", Number)
22848
23629
  ], RefundRequest.prototype, "refundPolicyId", void 0);
22849
- _ts_decorate64([
23630
+ _ts_decorate65([
22850
23631
  ManyToOne(() => RefundPolicy, {
22851
23632
  onDelete: "CASCADE"
22852
23633
  }),
22853
23634
  JoinColumn({
22854
23635
  name: "refundPolicyId"
22855
23636
  }),
22856
- _ts_metadata64("design:type", typeof RefundPolicy === "undefined" ? Object : RefundPolicy)
23637
+ _ts_metadata65("design:type", typeof RefundPolicy === "undefined" ? Object : RefundPolicy)
22857
23638
  ], RefundRequest.prototype, "refundPolicy", void 0);
22858
- _ts_decorate64([
23639
+ _ts_decorate65([
22859
23640
  Column({
22860
23641
  type: "integer"
22861
23642
  }),
22862
- _ts_metadata64("design:type", Number)
23643
+ _ts_metadata65("design:type", Number)
22863
23644
  ], RefundRequest.prototype, "orderId", void 0);
22864
- _ts_decorate64([
23645
+ _ts_decorate65([
22865
23646
  ManyToOne(() => Order, {
22866
23647
  onDelete: "CASCADE"
22867
23648
  }),
22868
23649
  JoinColumn({
22869
23650
  name: "orderId"
22870
23651
  }),
22871
- _ts_metadata64("design:type", typeof Order === "undefined" ? Object : Order)
23652
+ _ts_metadata65("design:type", typeof Order === "undefined" ? Object : Order)
22872
23653
  ], RefundRequest.prototype, "order", void 0);
22873
- _ts_decorate64([
23654
+ _ts_decorate65([
22874
23655
  Column({
22875
23656
  type: "integer"
22876
23657
  }),
22877
- _ts_metadata64("design:type", Number)
23658
+ _ts_metadata65("design:type", Number)
22878
23659
  ], RefundRequest.prototype, "customerId", void 0);
22879
- _ts_decorate64([
23660
+ _ts_decorate65([
22880
23661
  ManyToOne(() => Customer, {
22881
23662
  onDelete: "CASCADE"
22882
23663
  }),
22883
23664
  JoinColumn({
22884
23665
  name: "customerId"
22885
23666
  }),
22886
- _ts_metadata64("design:type", typeof Customer === "undefined" ? Object : Customer)
23667
+ _ts_metadata65("design:type", typeof Customer === "undefined" ? Object : Customer)
22887
23668
  ], RefundRequest.prototype, "customer", void 0);
22888
- _ts_decorate64([
23669
+ _ts_decorate65([
22889
23670
  Column({
22890
23671
  type: "text",
22891
23672
  nullable: true
22892
23673
  }),
22893
- _ts_metadata64("design:type", String)
23674
+ _ts_metadata65("design:type", String)
22894
23675
  ], RefundRequest.prototype, "reason", void 0);
22895
- _ts_decorate64([
23676
+ _ts_decorate65([
22896
23677
  Column({
22897
23678
  type: "enum",
22898
23679
  enum: RefundMethod
22899
23680
  }),
22900
- _ts_metadata64("design:type", String)
23681
+ _ts_metadata65("design:type", String)
22901
23682
  ], RefundRequest.prototype, "refundMethod", void 0);
22902
- _ts_decorate64([
23683
+ _ts_decorate65([
22903
23684
  Column({
22904
23685
  type: "enum",
22905
23686
  enum: RefundRequestStatus,
22906
23687
  default: "requested"
22907
23688
  }),
22908
- _ts_metadata64("design:type", String)
23689
+ _ts_metadata65("design:type", String)
22909
23690
  ], RefundRequest.prototype, "status", void 0);
22910
- _ts_decorate64([
23691
+ _ts_decorate65([
22911
23692
  Column({
22912
23693
  type: "decimal",
22913
23694
  precision: 10,
22914
23695
  scale: 2,
22915
23696
  default: 0
22916
23697
  }),
22917
- _ts_metadata64("design:type", Number)
23698
+ _ts_metadata65("design:type", Number)
22918
23699
  ], RefundRequest.prototype, "expectedRefundAmount", void 0);
22919
- _ts_decorate64([
23700
+ _ts_decorate65([
22920
23701
  Column({
22921
23702
  type: "decimal",
22922
23703
  precision: 10,
22923
23704
  scale: 2,
22924
23705
  nullable: true
22925
23706
  }),
22926
- _ts_metadata64("design:type", Number)
23707
+ _ts_metadata65("design:type", Number)
22927
23708
  ], RefundRequest.prototype, "approvedRefundAmount", void 0);
22928
- RefundRequest = _ts_decorate64([
23709
+ RefundRequest = _ts_decorate65([
22929
23710
  Entity("refund_requests")
22930
23711
  ], RefundRequest);
22931
- function _ts_decorate65(decorators, target, key, desc) {
23712
+ function _ts_decorate66(decorators, target, key, desc) {
22932
23713
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
22933
23714
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
22934
23715
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22935
23716
  return c > 3 && r && Object.defineProperty(target, key, r), r;
22936
23717
  }
22937
- __name(_ts_decorate65, "_ts_decorate");
22938
- function _ts_metadata65(k, v) {
23718
+ __name(_ts_decorate66, "_ts_decorate");
23719
+ function _ts_metadata66(k, v) {
22939
23720
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
22940
23721
  }
22941
- __name(_ts_metadata65, "_ts_metadata");
23722
+ __name(_ts_metadata66, "_ts_metadata");
22942
23723
  var Attendee = class {
22943
23724
  static {
22944
23725
  __name(this, "Attendee");
@@ -22949,34 +23730,34 @@ var Attendee = class {
22949
23730
  contactId;
22950
23731
  contact;
22951
23732
  };
22952
- _ts_decorate65([
23733
+ _ts_decorate66([
22953
23734
  PrimaryGeneratedColumn(),
22954
- _ts_metadata65("design:type", Number)
23735
+ _ts_metadata66("design:type", Number)
22955
23736
  ], Attendee.prototype, "id", void 0);
22956
- _ts_decorate65([
23737
+ _ts_decorate66([
22957
23738
  Column("varchar"),
22958
- _ts_metadata65("design:type", String)
23739
+ _ts_metadata66("design:type", String)
22959
23740
  ], Attendee.prototype, "displayName", void 0);
22960
- _ts_decorate65([
23741
+ _ts_decorate66([
22961
23742
  Column("varchar"),
22962
- _ts_metadata65("design:type", String)
23743
+ _ts_metadata66("design:type", String)
22963
23744
  ], Attendee.prototype, "email", void 0);
22964
- _ts_decorate65([
23745
+ _ts_decorate66([
22965
23746
  Column("int", {
22966
23747
  nullable: true
22967
23748
  }),
22968
- _ts_metadata65("design:type", Object)
23749
+ _ts_metadata66("design:type", Object)
22969
23750
  ], Attendee.prototype, "contactId", void 0);
22970
- _ts_decorate65([
23751
+ _ts_decorate66([
22971
23752
  ManyToOne(() => Contact, {
22972
23753
  onDelete: "SET NULL"
22973
23754
  }),
22974
23755
  JoinColumn({
22975
23756
  name: "contactId"
22976
23757
  }),
22977
- _ts_metadata65("design:type", Object)
23758
+ _ts_metadata66("design:type", Object)
22978
23759
  ], Attendee.prototype, "contact", void 0);
22979
- Attendee = _ts_decorate65([
23760
+ Attendee = _ts_decorate66([
22980
23761
  Entity("attendees"),
22981
23762
  Index("IDX_attendees_contactId", [
22982
23763
  "contactId"
@@ -22985,22 +23766,28 @@ Attendee = _ts_decorate65([
22985
23766
  "email"
22986
23767
  ])
22987
23768
  ], Attendee);
22988
- function _ts_decorate66(decorators, target, key, desc) {
23769
+ function _ts_decorate67(decorators, target, key, desc) {
22989
23770
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
22990
23771
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
22991
23772
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22992
23773
  return c > 3 && r && Object.defineProperty(target, key, r), r;
22993
23774
  }
22994
- __name(_ts_decorate66, "_ts_decorate");
22995
- function _ts_metadata66(k, v) {
23775
+ __name(_ts_decorate67, "_ts_decorate");
23776
+ function _ts_metadata67(k, v) {
22996
23777
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
22997
23778
  }
22998
- __name(_ts_metadata66, "_ts_metadata");
23779
+ __name(_ts_metadata67, "_ts_metadata");
22999
23780
  var NotificationChannel = /* @__PURE__ */ (function(NotificationChannel2) {
23000
23781
  NotificationChannel2["WHATSAPP"] = "whatsapp";
23001
23782
  NotificationChannel2["EMAIL"] = "email";
23002
23783
  return NotificationChannel2;
23003
23784
  })({});
23785
+ var NotificationAudienceType = /* @__PURE__ */ (function(NotificationAudienceType2) {
23786
+ NotificationAudienceType2["CUSTOMERS"] = "customers";
23787
+ NotificationAudienceType2["VENDORS"] = "vendors";
23788
+ NotificationAudienceType2["ADMIN"] = "admin";
23789
+ return NotificationAudienceType2;
23790
+ })({});
23004
23791
  var OrderNotificationBinding = class {
23005
23792
  static {
23006
23793
  __name(this, "OrderNotificationBinding");
@@ -23008,71 +23795,81 @@ var OrderNotificationBinding = class {
23008
23795
  id;
23009
23796
  triggerKey;
23010
23797
  channel;
23798
+ type;
23011
23799
  messageTemplateId;
23012
23800
  enabled;
23013
23801
  createdAt;
23014
23802
  updatedAt;
23015
23803
  };
23016
- _ts_decorate66([
23804
+ _ts_decorate67([
23017
23805
  PrimaryGeneratedColumn(),
23018
- _ts_metadata66("design:type", Number)
23806
+ _ts_metadata67("design:type", Number)
23019
23807
  ], OrderNotificationBinding.prototype, "id", void 0);
23020
- _ts_decorate66([
23808
+ _ts_decorate67([
23021
23809
  Column({
23022
23810
  type: "varchar"
23023
23811
  }),
23024
- _ts_metadata66("design:type", String)
23812
+ _ts_metadata67("design:type", String)
23025
23813
  ], OrderNotificationBinding.prototype, "triggerKey", void 0);
23026
- _ts_decorate66([
23814
+ _ts_decorate67([
23027
23815
  Column({
23028
23816
  type: "enum",
23029
23817
  enum: NotificationChannel,
23030
23818
  default: "whatsapp"
23031
23819
  }),
23032
- _ts_metadata66("design:type", String)
23820
+ _ts_metadata67("design:type", String)
23033
23821
  ], OrderNotificationBinding.prototype, "channel", void 0);
23034
- _ts_decorate66([
23822
+ _ts_decorate67([
23823
+ Column({
23824
+ type: "enum",
23825
+ enum: NotificationAudienceType,
23826
+ default: "customers"
23827
+ }),
23828
+ _ts_metadata67("design:type", String)
23829
+ ], OrderNotificationBinding.prototype, "type", void 0);
23830
+ _ts_decorate67([
23035
23831
  Column({
23036
23832
  type: "int",
23037
23833
  nullable: true
23038
23834
  }),
23039
- _ts_metadata66("design:type", Object)
23835
+ _ts_metadata67("design:type", Object)
23040
23836
  ], OrderNotificationBinding.prototype, "messageTemplateId", void 0);
23041
- _ts_decorate66([
23837
+ _ts_decorate67([
23042
23838
  Column({
23043
23839
  type: "boolean",
23044
23840
  default: true
23045
23841
  }),
23046
- _ts_metadata66("design:type", Boolean)
23842
+ _ts_metadata67("design:type", Boolean)
23047
23843
  ], OrderNotificationBinding.prototype, "enabled", void 0);
23048
- _ts_decorate66([
23844
+ _ts_decorate67([
23049
23845
  CreateDateColumn(),
23050
- _ts_metadata66("design:type", typeof Date === "undefined" ? Object : Date)
23846
+ _ts_metadata67("design:type", typeof Date === "undefined" ? Object : Date)
23051
23847
  ], OrderNotificationBinding.prototype, "createdAt", void 0);
23052
- _ts_decorate66([
23848
+ _ts_decorate67([
23053
23849
  UpdateDateColumn(),
23054
- _ts_metadata66("design:type", typeof Date === "undefined" ? Object : Date)
23850
+ _ts_metadata67("design:type", typeof Date === "undefined" ? Object : Date)
23055
23851
  ], OrderNotificationBinding.prototype, "updatedAt", void 0);
23056
- OrderNotificationBinding = _ts_decorate66([
23852
+ OrderNotificationBinding = _ts_decorate67([
23057
23853
  Entity("order_notification_bindings"),
23058
23854
  Index([
23059
23855
  "triggerKey",
23060
- "channel"
23856
+ "channel",
23857
+ "type"
23061
23858
  ], {
23062
23859
  unique: true
23063
23860
  })
23064
23861
  ], OrderNotificationBinding);
23065
- function _ts_decorate67(decorators, target, key, desc) {
23862
+ function _ts_decorate68(decorators, target, key, desc) {
23066
23863
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
23067
23864
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
23068
23865
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
23069
23866
  return c > 3 && r && Object.defineProperty(target, key, r), r;
23070
23867
  }
23071
- __name(_ts_decorate67, "_ts_decorate");
23072
- function _ts_metadata67(k, v) {
23868
+ __name(_ts_decorate68, "_ts_decorate");
23869
+ function _ts_metadata68(k, v) {
23073
23870
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
23074
23871
  }
23075
- __name(_ts_metadata67, "_ts_metadata");
23872
+ __name(_ts_metadata68, "_ts_metadata");
23076
23873
  var OrderNotificationTrigger = class {
23077
23874
  static {
23078
23875
  __name(this, "OrderNotificationTrigger");
@@ -23087,60 +23884,60 @@ var OrderNotificationTrigger = class {
23087
23884
  createdAt;
23088
23885
  updatedAt;
23089
23886
  };
23090
- _ts_decorate67([
23887
+ _ts_decorate68([
23091
23888
  PrimaryGeneratedColumn(),
23092
- _ts_metadata67("design:type", Number)
23889
+ _ts_metadata68("design:type", Number)
23093
23890
  ], OrderNotificationTrigger.prototype, "id", void 0);
23094
- _ts_decorate67([
23891
+ _ts_decorate68([
23095
23892
  Column({
23096
23893
  type: "varchar",
23097
23894
  unique: true
23098
23895
  }),
23099
- _ts_metadata67("design:type", String)
23896
+ _ts_metadata68("design:type", String)
23100
23897
  ], OrderNotificationTrigger.prototype, "triggerKey", void 0);
23101
- _ts_decorate67([
23898
+ _ts_decorate68([
23102
23899
  Column({
23103
23900
  type: "varchar"
23104
23901
  }),
23105
- _ts_metadata67("design:type", String)
23902
+ _ts_metadata68("design:type", String)
23106
23903
  ], OrderNotificationTrigger.prototype, "label", void 0);
23107
- _ts_decorate67([
23904
+ _ts_decorate68([
23108
23905
  Column({
23109
23906
  type: "text",
23110
23907
  nullable: true
23111
23908
  }),
23112
- _ts_metadata67("design:type", Object)
23909
+ _ts_metadata68("design:type", Object)
23113
23910
  ], OrderNotificationTrigger.prototype, "description", void 0);
23114
- _ts_decorate67([
23911
+ _ts_decorate68([
23115
23912
  Column({
23116
23913
  type: "varchar",
23117
23914
  default: "order"
23118
23915
  }),
23119
- _ts_metadata67("design:type", String)
23916
+ _ts_metadata68("design:type", String)
23120
23917
  ], OrderNotificationTrigger.prototype, "category", void 0);
23121
- _ts_decorate67([
23918
+ _ts_decorate68([
23122
23919
  Column({
23123
23920
  type: "boolean",
23124
23921
  default: true
23125
23922
  }),
23126
- _ts_metadata67("design:type", Boolean)
23923
+ _ts_metadata68("design:type", Boolean)
23127
23924
  ], OrderNotificationTrigger.prototype, "enabled", void 0);
23128
- _ts_decorate67([
23925
+ _ts_decorate68([
23129
23926
  Column({
23130
23927
  type: "int",
23131
23928
  default: 0
23132
23929
  }),
23133
- _ts_metadata67("design:type", Number)
23930
+ _ts_metadata68("design:type", Number)
23134
23931
  ], OrderNotificationTrigger.prototype, "sortOrder", void 0);
23135
- _ts_decorate67([
23932
+ _ts_decorate68([
23136
23933
  CreateDateColumn(),
23137
- _ts_metadata67("design:type", typeof Date === "undefined" ? Object : Date)
23934
+ _ts_metadata68("design:type", typeof Date === "undefined" ? Object : Date)
23138
23935
  ], OrderNotificationTrigger.prototype, "createdAt", void 0);
23139
- _ts_decorate67([
23936
+ _ts_decorate68([
23140
23937
  UpdateDateColumn(),
23141
- _ts_metadata67("design:type", typeof Date === "undefined" ? Object : Date)
23938
+ _ts_metadata68("design:type", typeof Date === "undefined" ? Object : Date)
23142
23939
  ], OrderNotificationTrigger.prototype, "updatedAt", void 0);
23143
- OrderNotificationTrigger = _ts_decorate67([
23940
+ OrderNotificationTrigger = _ts_decorate68([
23144
23941
  Entity("order_notification_triggers")
23145
23942
  ], OrderNotificationTrigger);
23146
23943
 
@@ -23199,6 +23996,7 @@ var CMS_ENTITY_MAP = {
23199
23996
  job_schedule_runs: JobScheduleRun,
23200
23997
  vendors: Vendor,
23201
23998
  vendor_users: VendorUser,
23999
+ vendor_user_profiles: VendorUserProfile,
23202
24000
  vendor_roles: VendorRole,
23203
24001
  vendor_role_permissions: VendorRolePermission,
23204
24002
  vendor_customers: VendorCustomer,
@@ -27096,9 +27894,7 @@ function createCmsApiHandler(config) {
27096
27894
  getSessionUser: getHydratedSessionUser,
27097
27895
  baseUrl: vendorOnboardBaseUrl,
27098
27896
  getCms,
27099
- hashPassword: userAuth?.hashPassword,
27100
- minPasswordLength: 6
27101
- });
27897
+ hashPassword: userAuth?.hashPassword});
27102
27898
  const vendorRolesHandlers = getHydratedSessionUser && createVendorRolesHandlers({
27103
27899
  dataSource,
27104
27900
  entityMap,
@@ -27138,10 +27934,30 @@ function createCmsApiHandler(config) {
27138
27934
  const zipExtractPost = uploadMerged ? createMediaZipExtractHandler(uploadMerged) : null;
27139
27935
  const blogBySlugGet = blogBySlug ? createBlogBySlugHandler(blogBySlug) : null;
27140
27936
  const formBySlugGet = formBySlug ? createFormBySlugHandler(formBySlug) : null;
27141
- const formSaveHandlers = formSaveConfig ? createFormSaveHandlers(mergePerm(formSaveConfig) ?? formSaveConfig) : null;
27142
- const formSubmissionPost = formSubmissionConfig ? createFormSubmissionHandler(formSubmissionConfig) : null;
27143
- const formSubmissionGetById = formSubmissionGetByIdConfig ? createFormSubmissionGetByIdHandler(mergePerm(formSubmissionGetByIdConfig) ?? formSubmissionGetByIdConfig) : null;
27144
- const formSubmissionList = formSubmissionGetByIdConfig ? createFormSubmissionListHandler(mergePerm(formSubmissionGetByIdConfig) ?? formSubmissionGetByIdConfig) : null;
27937
+ const formSaveResolved = formSaveConfig ?? {
27938
+ dataSource,
27939
+ entityMap,
27940
+ json: config.json,
27941
+ requireAuth: config.requireAuth
27942
+ };
27943
+ const formSaveHandlers = createFormSaveHandlers(mergePerm(formSaveResolved) ?? formSaveResolved);
27944
+ const formSubmissionResolved = formSubmissionConfig ?? {
27945
+ dataSource,
27946
+ entityMap,
27947
+ json: config.json,
27948
+ getCms,
27949
+ getCompanyDetails: config.getCompanyDetails,
27950
+ getRecipientForChannel: config.getRecipientForChannel
27951
+ };
27952
+ const formSubmissionPost = createFormSubmissionHandler(formSubmissionResolved);
27953
+ const formSubmissionGetByIdResolved = formSubmissionGetByIdConfig ?? {
27954
+ dataSource,
27955
+ entityMap,
27956
+ json: config.json,
27957
+ requireAuth: config.requireAuth
27958
+ };
27959
+ const formSubmissionGetById = createFormSubmissionGetByIdHandler(mergePerm(formSubmissionGetByIdResolved) ?? formSubmissionGetByIdResolved);
27960
+ const formSubmissionList = createFormSubmissionListHandler(mergePerm(formSubmissionGetByIdResolved) ?? formSubmissionGetByIdResolved);
27145
27961
  const usersApiMerged = usersApi && getCms ? {
27146
27962
  ...usersApi,
27147
27963
  getCms: usersApi.getCms ?? getCms,
@@ -27336,7 +28152,19 @@ function createCmsApiHandler(config) {
27336
28152
  status: 404
27337
28153
  });
27338
28154
  }
28155
+ if (path2[0] === "admin" && path2[1] === "vendor" && path2[2] === "team-invite" && vendorHandlers) {
28156
+ if (path2.length === 3 && m === "GET") return vendorHandlers.validateTeamInvite(req);
28157
+ if (path2.length === 3 && m === "POST") return vendorHandlers.acceptTeamInvite(req);
28158
+ return config.json({
28159
+ error: "Not found"
28160
+ }, {
28161
+ status: 404
28162
+ });
28163
+ }
27339
28164
  if (path2[0] === "admin" && path2[1] === "vendor" && path2[2] === "team" && vendorHandlers) {
28165
+ if (path2.length === 4 && path2[3] === "send-invite" && m === "POST") {
28166
+ return vendorHandlers.sendTeamInviteEmail(req);
28167
+ }
27340
28168
  if (path2.length === 3 && m === "GET") return vendorHandlers.listTeam();
27341
28169
  if (path2.length === 3 && m === "POST") return vendorHandlers.addTeamMember(req);
27342
28170
  if (path2.length === 4 && m === "PATCH") return vendorHandlers.updateTeamMemberRole(req, path2[3]);
@@ -28642,7 +29470,7 @@ function createCmsApiHandler(config) {
28642
29470
  status: 400
28643
29471
  });
28644
29472
  }
28645
- const { resendOrderNotification } = await import('./order-notification-dispatcher-ZJZB2HUN.js');
29473
+ const { resendOrderNotification } = await import('./order-notification-dispatcher-6WNG24NY.js');
28646
29474
  const result = await resendOrderNotification(triggerKey, orderId, {
28647
29475
  dataSource,
28648
29476
  entityMap,
@@ -28742,7 +29570,7 @@ function createCmsApiHandler(config) {
28742
29570
  status: "cancelled"
28743
29571
  });
28744
29572
  const fireOrderCancelledNotification = /* @__PURE__ */ __name((refundAmount) => {
28745
- void import('./emit-order-notification-trigger-IVLWKKJL.js').then(({ fireOrderNotificationTrigger }) => {
29573
+ void import('./emit-order-notification-trigger-6XX7LSC4.js').then(({ fireOrderNotificationTrigger }) => {
28746
29574
  fireOrderNotificationTrigger("order_cancelled", orderId, {
28747
29575
  dataSource,
28748
29576
  entityMap
@@ -29775,20 +30603,12 @@ function createStorefrontApiHandler(config) {
29775
30603
  const otpPepper = config.otpPepper;
29776
30604
  const defaultPhoneCc = config.defaultPhoneCountryCode;
29777
30605
  function fireOrderPlacedNotification(orderId) {
29778
- void import('./emit-order-notification-trigger-IVLWKKJL.js').then(({ fireOrderNotificationTrigger }) => {
30606
+ void import('./emit-order-notification-trigger-6XX7LSC4.js').then(({ fireOrderNotificationTrigger }) => {
29779
30607
  fireOrderNotificationTrigger("order_placed", orderId, {
29780
30608
  dataSource,
29781
30609
  entityMap
29782
30610
  });
29783
30611
  }).catch((err) => console.error("[notification-triggers] import failed", err));
29784
- if (!getCms) return;
29785
- void import('./send-order-placed-emails-WPI37KRZ.js').then(({ sendOrderPlacedEmailsAfterConfirmation }) => {
29786
- return sendOrderPlacedEmailsAfterConfirmation(orderId, {
29787
- getDataSource: /* @__PURE__ */ __name(async () => dataSource, "getDataSource"),
29788
- entityMap,
29789
- getCms
29790
- });
29791
- }).catch((err) => console.error("[order-emails] sendOrderPlacedEmailsAfterConfirmation failed", err));
29792
30612
  }
29793
30613
  __name(fireOrderPlacedNotification, "fireOrderPlacedNotification");
29794
30614
  const otpAllowPhoneLogin = config.otpAllowPhoneLogin !== false;
@@ -32191,7 +33011,6 @@ function createStorefrontApiHandler(config) {
32191
33011
  }));
32192
33012
  }
32193
33013
  await linkOrderContactToVendors(contactId, vendorRes.vendorIds);
32194
- fireOrderPlacedNotification(oid);
32195
33014
  return json({
32196
33015
  orderId: oid,
32197
33016
  orderNumber: ord.orderNumber,
@@ -32268,7 +33087,6 @@ function createStorefrontApiHandler(config) {
32268
33087
  cartId: cart.id
32269
33088
  });
32270
33089
  await cartRepo().delete(cart.id);
32271
- fireOrderPlacedNotification(oid);
32272
33090
  return json({
32273
33091
  orderId: oid,
32274
33092
  orderNumber: ord.orderNumber,
@@ -32511,4 +33329,4 @@ function createStorefrontApiHandler(config) {
32511
33329
  }
32512
33330
  __name(createStorefrontApiHandler, "createStorefrontApiHandler");
32513
33331
 
32514
- export { Address, Attendee, Attribute, BLOG_GENERATOR_AGENT_NAME, BLOG_GENERATOR_DEFAULT_SYSTEM_INSTRUCTION, BLOG_GENERATOR_DEFAULT_VALIDATION_RULES, BLOG_GENERATOR_LLM_AGENT_SLUG, BLOG_GENERATOR_MARKDOWN_ARTICLE_SEPARATOR, BLOG_METADATA_ENRICHER_AGENT_NAME, BLOG_METADATA_ENRICHER_DEFAULT_SYSTEM_INSTRUCTION, BLOG_METADATA_ENRICHER_DEFAULT_VALIDATION_RULES, BLOG_METADATA_ENRICHER_LLM_AGENT_SLUG, Blog, BlogGeneratorService, Brand, CMS_ENTITY_MAP, Cart, CartItem, Category, ChatConversation, ChatMessage, Collection, Combo, ComboItem, Comment, Config, Contact, Currency, CurrencyExchange, Customer, Customer_Contacts, Discount, DiscountRules, Event, EventProduct, Form, FormField, FormSubmission, JobSchedule, JobScheduleRun, KnowledgeBaseChunk, KnowledgeBaseDocument, LlmAgent, Media, MessageTemplate, Order, OrderAddresses, OrderDiscounts, OrderItem, OrderNotificationBinding, OrderNotificationTrigger, OtpChallenge, Page, PasswordResetToken, Payment, Permission, Product, ProductAttribute, ProductCategory, ProductConfig, ProductVariant, RefundPolicy, RefundRequest, RssArticle, RssFeed, Seo, Tag, Tax, User, UserGroup, Vendor, VendorCustomer, VendorRole, VendorRolePermission, VendorUser, Wishlist, WishlistItem, ZIP_MIME_TYPES, applyApprovalStatusSideEffects, applyEventApprovalStatusSideEffects, applyRotatingVendorInvite, applyVendorCustomersContactFilter, applyVendorEventCreateApproval, applyVendorProductCreateApproval, assertCaptchaOk, assertContactAllowedForVendorOrder, assertEventApprovalUpdate, assertProductApprovalUpdate, buildBlogMetadataUserPrompt, buildCronFromSchedule, buildRssUserPromptFromFeeds, buildUserInviteLink, buildVendorInviteLink, calculateOrderRefundPreview, calculateRefundFromPolicy, checkAndIncrementDiscountUsage, checkEventsEnabled, checkMultiVendorEnabled, completeUserInviteAccept, consumeAppliedDiscountUsages, contactIsVendorCustomer, countDiscountOrdersForContact, countRecentOtpSends, createAnalyticsHandlers, createBlogBySlugHandler, createChangePasswordHandler, createCmsApiHandler, createCmsApp, createCmsAppWithMessaging, createCrudByIdHandler, createCrudHandler, createDashboardStatsHandler, createEcommerceAnalyticsHandler, createEventOrderMessageTemplateHandlers, createForgotPasswordHandler, createFormBySlugHandler, createInviteAcceptHandler, createJobScheduleHandlers, createLlmAgentKnowledgeHandlers, createMediaZipExtractHandler, createMessageTemplateRowLoader, createOtpChallenge, createSetPasswordHandler, createSettingsApiHandlers, createSocialMediaHandlers, createStorefrontApiHandler, createUploadHandler, createUserAuthApiRouter, createUserAvatarHandler, createUserProfileHandler, createUsersApiHandlers, createVendorDashboardHandler, createVendorOnboardHandlers, customerPhoneForEmail, customerPhoneForUser, daysBeforeEventStart, decrementDiscountUsage, describeEventTierPolicy, ensureCustomerForUser, ensureCustomerRecord, ensureMessagingPluginsOnCms, ensureScheduleQueueWorker, ensureVendorCustomerForOrderContact, ensureVendorCustomersForOrder, findActiveRefundPolicyForVendor, findUserByInviteToken, findVendorByInviteToken, formatTierRange, generateNumericOtp, getPublicSettingsGroup, getRequireEventApproval, getRequireProductApproval, getRssArticleSummaryFromItem, getVendorCatalogCreateFlags, hashOtpCode, hydrateVendorSessionUser, invalidateEventsCache, invalidateMultiVendorCache, invalidateRequireEventApprovalCache, invalidateRequireProductApprovalCache, invalidateVendorCatalogCreateFlagsCache, isCustomerTypeContact, isMaxPerUserUsageReached, isMaxTotalUsageReached, isSyntheticCustomerPhone, isZipMedia, linkUnclaimedContactToUser, llmAgentToChatAgentOptions, loadSettingsGroupFromDb, loadUserVendorContext, mergeGuardrailsIntoSystemPrompt, messagingPlugins, metaFetchUserManagedPages, metaPostPageFeed, metaPostPagePhoto, metaResolvePageAccessToken, newUserInviteToken, normalizeCustomerPhone, normalizePhoneE164, normalizeRefundTiers, overlayCmsPlugins, parseBlogGeneratorAgentContent, parseBlogGeneratorModelOutput, parseBlogMetadataEnrichmentJson, parseLlmAgentValidationRules, pgBossScheduleNameForId, queueErpCreateContactIfEnabled, queueJobScheduleNow, queuePlugin, queueSms, recordDiscountUsage, registerJobRunnerWorker, registerMessagingQueueProcessors, registerSmsQueueProcessor, relativePathFromMediaParentId, resolveBlogCategoryIdByName, resolveSettingsEncryptionKey, resolveVendorIdForContactCheck, sanitizeMediaFolderPath, sanitizeStorageSegment, sendVendorOnboardEmails, simpleDecrypt, simpleEncrypt, syncJobScheduleToPgBoss, validateRefundTiers, validateScheduleInput, validateUserMessageAgainstAgentRules, validateUserMessageAgainstStructuredRules, verifyAndConsumeOtpChallenge, verifyOtpCodeHash, whatsappPlugin, wrapGetCmsWithMessaging };
33332
+ export { Address, Attendee, Attribute, BLOG_GENERATOR_AGENT_NAME, BLOG_GENERATOR_DEFAULT_SYSTEM_INSTRUCTION, BLOG_GENERATOR_DEFAULT_VALIDATION_RULES, BLOG_GENERATOR_LLM_AGENT_SLUG, BLOG_GENERATOR_MARKDOWN_ARTICLE_SEPARATOR, BLOG_METADATA_ENRICHER_AGENT_NAME, BLOG_METADATA_ENRICHER_DEFAULT_SYSTEM_INSTRUCTION, BLOG_METADATA_ENRICHER_DEFAULT_VALIDATION_RULES, BLOG_METADATA_ENRICHER_LLM_AGENT_SLUG, Blog, BlogGeneratorService, Brand, CMS_ENTITY_MAP, Cart, CartItem, Category, ChatConversation, ChatMessage, Collection, Combo, ComboItem, Comment, Config, Contact, Currency, CurrencyExchange, Customer, Customer_Contacts, Discount, DiscountRules, Event, EventProduct, Form, FormField, FormSubmission, JobSchedule, JobScheduleRun, KnowledgeBaseChunk, KnowledgeBaseDocument, LlmAgent, Media, MessageTemplate, Order, OrderAddresses, OrderDiscounts, OrderItem, OrderNotificationBinding, OrderNotificationTrigger, OtpChallenge, Page, PasswordResetToken, Payment, Permission, Product, ProductAttribute, ProductCategory, ProductConfig, ProductVariant, RefundPolicy, RefundRequest, RssArticle, RssFeed, Seo, Tag, Tax, User, UserGroup, Vendor, VendorCustomer, VendorRole, VendorRolePermission, VendorUser, VendorUserProfile, Wishlist, WishlistItem, ZIP_MIME_TYPES, applyApprovalStatusSideEffects, applyEventApprovalStatusSideEffects, applyRotatingVendorInvite, applyVendorCustomersContactFilter, applyVendorEventCreateApproval, applyVendorProductCreateApproval, assertCaptchaOk, assertContactAllowedForVendorOrder, assertEventApprovalUpdate, assertProductApprovalUpdate, buildBlogMetadataUserPrompt, buildCronFromSchedule, buildRssUserPromptFromFeeds, buildUserInviteLink, buildVendorInviteLink, calculateOrderRefundPreview, calculateRefundFromPolicy, checkAndIncrementDiscountUsage, checkEventsEnabled, checkMultiVendorEnabled, completeUserInviteAccept, consumeAppliedDiscountUsages, contactIsVendorCustomer, countDiscountOrdersForContact, countRecentOtpSends, createAnalyticsHandlers, createBlogBySlugHandler, createChangePasswordHandler, createCmsApiHandler, createCmsApp, createCmsAppWithMessaging, createCrudByIdHandler, createCrudHandler, createDashboardStatsHandler, createEcommerceAnalyticsHandler, createEventOrderMessageTemplateHandlers, createForgotPasswordHandler, createFormBySlugHandler, createInviteAcceptHandler, createJobScheduleHandlers, createLlmAgentKnowledgeHandlers, createMediaZipExtractHandler, createMessageTemplateRowLoader, createOtpChallenge, createSetPasswordHandler, createSettingsApiHandlers, createSocialMediaHandlers, createStorefrontApiHandler, createUploadHandler, createUserAuthApiRouter, createUserAvatarHandler, createUserProfileHandler, createUsersApiHandlers, createVendorDashboardHandler, createVendorOnboardHandlers, customerPhoneForEmail, customerPhoneForUser, daysBeforeEventStart, decrementDiscountUsage, describeEventTierPolicy, ensureCustomerForUser, ensureCustomerRecord, ensureMessagingPluginsOnCms, ensureScheduleQueueWorker, ensureVendorCustomerForOrderContact, ensureVendorCustomersForOrder, findActiveRefundPolicyForVendor, findUserByInviteToken, findVendorByInviteToken, formatTierRange, generateNumericOtp, getPublicSettingsGroup, getRequireEventApproval, getRequireProductApproval, getRssArticleSummaryFromItem, getVendorCatalogCreateFlags, hashOtpCode, hydrateVendorSessionUser, invalidateEventsCache, invalidateMultiVendorCache, invalidateRequireEventApprovalCache, invalidateRequireProductApprovalCache, invalidateVendorCatalogCreateFlagsCache, isCustomerTypeContact, isMaxPerUserUsageReached, isMaxTotalUsageReached, isSyntheticCustomerPhone, isZipMedia, linkUnclaimedContactToUser, llmAgentToChatAgentOptions, loadSettingsGroupFromDb, loadUserVendorContext, mergeGuardrailsIntoSystemPrompt, messagingPlugins, metaFetchUserManagedPages, metaPostPageFeed, metaPostPagePhoto, metaResolvePageAccessToken, newUserInviteToken, normalizeCustomerPhone, normalizePhoneE164, normalizeRefundTiers, overlayCmsPlugins, parseBlogGeneratorAgentContent, parseBlogGeneratorModelOutput, parseBlogMetadataEnrichmentJson, parseLlmAgentValidationRules, pgBossScheduleNameForId, queueErpCreateContactIfEnabled, queueJobScheduleNow, queuePlugin, queueSms, recordDiscountUsage, registerJobRunnerWorker, registerMessagingQueueProcessors, registerSmsQueueProcessor, relativePathFromMediaParentId, resolveBlogCategoryIdByName, resolveSettingsEncryptionKey, resolveVendorIdForContactCheck, sanitizeMediaFolderPath, sanitizeStorageSegment, sendVendorOnboardEmails, simpleDecrypt, simpleEncrypt, syncJobScheduleToPgBoss, validateRefundTiers, validateScheduleInput, validateUserMessageAgainstAgentRules, validateUserMessageAgainstStructuredRules, verifyAndConsumeOtpChallenge, verifyOtpCodeHash, whatsappPlugin, wrapGetCmsWithMessaging };