@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.
- package/dist/admin.cjs +3420 -2702
- package/dist/admin.d.cts +18 -4
- package/dist/admin.d.ts +18 -4
- package/dist/admin.js +2328 -1612
- package/dist/api.cjs +37 -38
- package/dist/api.d.cts +9 -3
- package/dist/api.d.ts +9 -3
- package/dist/api.js +5 -6
- package/dist/auth.cjs +55 -51
- package/dist/auth.d.cts +5 -3
- package/dist/auth.d.ts +5 -3
- package/dist/auth.js +3 -3
- package/dist/{chunk-KFFB6EMZ.js → chunk-2HU5R2JE.js} +2 -0
- package/dist/chunk-2IAXTKQN.cjs +19 -0
- package/dist/{chunk-SPQFNIYJ.cjs → chunk-4PMK3RNA.cjs} +2 -0
- package/dist/{chunk-X6UQFV4X.cjs → chunk-77NUXO6A.cjs} +14 -12
- package/dist/chunk-EIZKW2PF.js +13 -0
- package/dist/{chunk-X47PBV4I.js → chunk-JE22VP6S.js} +1 -0
- package/dist/{chunk-DN65KDIA.js → chunk-JIWUVQ6B.js} +14 -13
- package/dist/{chunk-HT5DI3XW.cjs → chunk-KOTXDSQB.cjs} +1 -0
- package/dist/{chunk-TCSGFAWB.cjs → chunk-LMJ7RKPF.cjs} +1188 -3
- package/dist/{chunk-FBKDMRQL.cjs → chunk-Q3HQEM4R.cjs} +6 -6
- package/dist/{chunk-NBY4NVTY.cjs → chunk-VUQFARRT.cjs} +7 -7
- package/dist/{chunk-UKC3HYXI.js → chunk-W42UZLQO.js} +1377 -559
- package/dist/{chunk-UDVLFVEC.cjs → chunk-XUCKZPML.cjs} +1448 -630
- package/dist/{chunk-57O3HZPG.js → chunk-YC4NUZCS.js} +1 -1
- package/dist/{chunk-CRYKVJTO.js → chunk-YXH2UUEZ.js} +1179 -3
- package/dist/{chunk-SF2XKMCI.js → chunk-ZF2RQWXB.js} +1 -1
- package/dist/{emit-order-notification-trigger-IVLWKKJL.js → emit-order-notification-trigger-6XX7LSC4.js} +1 -1
- package/dist/{emit-order-notification-trigger-D2N3KFHL.cjs → emit-order-notification-trigger-NASG7ZEO.cjs} +3 -3
- package/dist/{event-order-defaults-EMWBIGL3.cjs → event-order-defaults-7Z3UZOEH.cjs} +9 -9
- package/dist/{event-order-defaults-SDRNAZHC.js → event-order-defaults-XQ3IDPD7.js} +1 -1
- package/dist/hooks.cjs +43 -0
- package/dist/hooks.d.cts +10 -1
- package/dist/hooks.d.ts +10 -1
- package/dist/hooks.js +39 -1
- package/dist/index.cjs +414 -310
- package/dist/index.d.cts +51 -17
- package/dist/index.d.ts +51 -17
- package/dist/index.js +114 -12
- package/dist/migrations/1782200000000-VendorTeamProfiles.ts +233 -0
- package/dist/migrations/1782300000000-AddTypeToOrderNotificationBindings.ts +75 -0
- package/dist/{order-notification-dispatcher-ZJZB2HUN.js → order-notification-dispatcher-6WNG24NY.js} +1 -2
- package/dist/{order-notification-dispatcher-SBQAMM5V.cjs → order-notification-dispatcher-6XSU3AR7.cjs} +3 -4
- package/dist/{rbac-debug-db-2SGNLANF.js → rbac-debug-db-6EMIVMGF.js} +1 -1
- package/dist/{rbac-debug-db-4Z6A425H.cjs → rbac-debug-db-6PWTLBEL.cjs} +2 -2
- package/dist/theme.cjs +6 -1
- package/dist/theme.d.cts +4 -1
- package/dist/theme.d.ts +4 -1
- package/dist/theme.js +3 -1
- package/package.json +1 -1
- package/src/admin/admin.css +7 -0
- package/dist/chunk-7PMHZRF3.cjs +0 -872
- package/dist/chunk-CQHXW4TR.js +0 -107
- package/dist/chunk-GUSHM5HN.js +0 -862
- package/dist/chunk-XMRMZ6NQ.cjs +0 -109
- package/dist/send-order-placed-emails-B5ZVJT7T.cjs +0 -15
- package/dist/send-order-placed-emails-WPI37KRZ.js +0 -6
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
var chunkHY3AXLOI_cjs = require('./chunk-HY3AXLOI.cjs');
|
|
4
4
|
var chunkOY2YTBMP_cjs = require('./chunk-OY2YTBMP.cjs');
|
|
5
|
-
var
|
|
6
|
-
var chunkTCSGFAWB_cjs = require('./chunk-TCSGFAWB.cjs');
|
|
5
|
+
var chunkLMJ7RKPF_cjs = require('./chunk-LMJ7RKPF.cjs');
|
|
7
6
|
var chunk7NMT3GBR_cjs = require('./chunk-7NMT3GBR.cjs');
|
|
8
7
|
var chunkV25RDUOU_cjs = require('./chunk-V25RDUOU.cjs');
|
|
9
8
|
var chunkBXYZDMTZ_cjs = require('./chunk-BXYZDMTZ.cjs');
|
|
10
9
|
var chunk3DZRIZOD_cjs = require('./chunk-3DZRIZOD.cjs');
|
|
11
|
-
var
|
|
10
|
+
var chunk4PMK3RNA_cjs = require('./chunk-4PMK3RNA.cjs');
|
|
12
11
|
var chunkXQ3QUHWR_cjs = require('./chunk-XQ3QUHWR.cjs');
|
|
13
|
-
var
|
|
14
|
-
var
|
|
12
|
+
var chunkVUQFARRT_cjs = require('./chunk-VUQFARRT.cjs');
|
|
13
|
+
var chunk77NUXO6A_cjs = require('./chunk-77NUXO6A.cjs');
|
|
15
14
|
var chunkD5FBNKQM_cjs = require('./chunk-D5FBNKQM.cjs');
|
|
16
15
|
var chunkUPLVMVRX_cjs = require('./chunk-UPLVMVRX.cjs');
|
|
17
16
|
var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
|
|
@@ -44,7 +43,6 @@ async function queryVendorLinks(dataSource, userId) {
|
|
|
44
43
|
return await dataSource.query(`
|
|
45
44
|
SELECT
|
|
46
45
|
vu."vendorId" AS "vendorId",
|
|
47
|
-
vu."role" AS "role",
|
|
48
46
|
vu."vendorRoleId" AS "vendorRoleId",
|
|
49
47
|
vr."name" AS "vendorRoleName",
|
|
50
48
|
vr."isOwnerRole" AS "isOwnerRole"
|
|
@@ -58,22 +56,25 @@ async function queryVendorLinks(dataSource, userId) {
|
|
|
58
56
|
]);
|
|
59
57
|
} catch (err) {
|
|
60
58
|
if (!isMissingVendorRoleSchemaError(err)) throw err;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
59
|
+
try {
|
|
60
|
+
const legacy = await dataSource.query(`
|
|
61
|
+
SELECT vu."vendorId" AS "vendorId", vu."role" AS "role"
|
|
62
|
+
FROM "vendor_users" vu
|
|
63
|
+
INNER JOIN "vendors" v ON v.id = vu."vendorId" AND v.deleted = false
|
|
64
|
+
WHERE vu."userId" = $1
|
|
65
|
+
ORDER BY vu.id ASC
|
|
66
|
+
`, [
|
|
67
|
+
userId
|
|
68
|
+
]);
|
|
69
|
+
return legacy.map((r) => ({
|
|
70
|
+
vendorId: Number(r.vendorId),
|
|
71
|
+
vendorRoleId: null,
|
|
72
|
+
vendorRoleName: null,
|
|
73
|
+
isOwnerRole: r.role === "owner" ? true : null
|
|
74
|
+
}));
|
|
75
|
+
} catch {
|
|
76
|
+
return [];
|
|
77
|
+
}
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
80
|
chunkUSNT2KNT_cjs.__name(queryVendorLinks, "queryVendorLinks");
|
|
@@ -100,7 +101,6 @@ async function loadUserVendorContext(dataSource, userId, preferredVendorId) {
|
|
|
100
101
|
if (linkIds.has(ownedId)) continue;
|
|
101
102
|
rows.push({
|
|
102
103
|
vendorId: ownedId,
|
|
103
|
-
role: "owner",
|
|
104
104
|
vendorRoleId: null,
|
|
105
105
|
vendorRoleName: null,
|
|
106
106
|
isOwnerRole: true
|
|
@@ -120,18 +120,19 @@ async function loadUserVendorContext(dataSource, userId, preferredVendorId) {
|
|
|
120
120
|
`, [
|
|
121
121
|
primary.vendorRoleId
|
|
122
122
|
]);
|
|
123
|
-
vendorEntityPerms =
|
|
123
|
+
vendorEntityPerms = chunk77NUXO6A_cjs.permissionRowsToRecord(permRows);
|
|
124
124
|
} catch (err) {
|
|
125
125
|
if (!isMissingVendorRoleSchemaError(err)) throw err;
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
+
const isOwner = !!primary?.isOwnerRole;
|
|
128
129
|
return {
|
|
129
130
|
vendorIds,
|
|
130
131
|
activeVendorId: primary != null ? Number(primary.vendorId) : vendorIds[0] ?? null,
|
|
131
|
-
vendorRole: primary
|
|
132
|
+
vendorRole: isOwner ? "owner" : primary ? "staff" : null,
|
|
132
133
|
vendorRoleId: primary?.vendorRoleId != null ? Number(primary.vendorRoleId) : null,
|
|
133
134
|
vendorRoleName: primary?.vendorRoleName ?? null,
|
|
134
|
-
isVendorRoleOwner:
|
|
135
|
+
isVendorRoleOwner: isOwner,
|
|
135
136
|
vendorEntityPerms
|
|
136
137
|
};
|
|
137
138
|
}
|
|
@@ -226,7 +227,7 @@ async function hydrateVendorSessionUser(dataSource, user) {
|
|
|
226
227
|
]);
|
|
227
228
|
const resolvedId = Number(byEmailRows[0]?.id);
|
|
228
229
|
if (!Number.isFinite(resolvedId)) {
|
|
229
|
-
|
|
230
|
+
chunk77NUXO6A_cjs.logRbac("hydrateVendorSessionUser: unable to resolve numeric user id", {
|
|
230
231
|
email: user.email,
|
|
231
232
|
rawSessionId: user.id ?? null
|
|
232
233
|
});
|
|
@@ -246,7 +247,7 @@ async function hydrateVendorSessionUser(dataSource, user) {
|
|
|
246
247
|
const groupName = rows[0]?.groupName ?? user.groupName ?? null;
|
|
247
248
|
const groupId = rows[0]?.groupId ?? user.groupId ?? void 0;
|
|
248
249
|
const adminAccess = rows[0]?.adminAccess ?? user.adminAccess;
|
|
249
|
-
const isRBACAdmin = user.isRBACAdmin ??
|
|
250
|
+
const isRBACAdmin = user.isRBACAdmin ?? chunk77NUXO6A_cjs.isSuperAdmin({
|
|
250
251
|
groupId,
|
|
251
252
|
groupName,
|
|
252
253
|
isRBACAdmin: user.isRBACAdmin
|
|
@@ -259,7 +260,7 @@ async function hydrateVendorSessionUser(dataSource, user) {
|
|
|
259
260
|
};
|
|
260
261
|
if (multiVendorEnabled) {
|
|
261
262
|
ctx = await loadUserVendorContext(dataSource, id, user.activeVendorId);
|
|
262
|
-
flags =
|
|
263
|
+
flags = chunk77NUXO6A_cjs.vendorPortalFlagsFromUser({
|
|
263
264
|
email: user.email,
|
|
264
265
|
isRBACAdmin,
|
|
265
266
|
groupName,
|
|
@@ -294,7 +295,7 @@ async function hydrateVendorSessionUser(dataSource, user) {
|
|
|
294
295
|
isVendorPortal: flags.isVendorPortal,
|
|
295
296
|
isVendorOwner: flags.isVendorOwner
|
|
296
297
|
};
|
|
297
|
-
|
|
298
|
+
chunk77NUXO6A_cjs.logRbac("hydrateVendorSessionUser", {
|
|
298
299
|
email: user.email,
|
|
299
300
|
userId: id,
|
|
300
301
|
groupName,
|
|
@@ -907,7 +908,7 @@ function repoHasVendorIdColumn(repo) {
|
|
|
907
908
|
}
|
|
908
909
|
chunkUSNT2KNT_cjs.__name(repoHasVendorIdColumn, "repoHasVendorIdColumn");
|
|
909
910
|
function resourceUsesVendorScope(resource) {
|
|
910
|
-
return resource === "vendors" ||
|
|
911
|
+
return resource === "vendors" || chunk77NUXO6A_cjs.VENDOR_SCOPED_STORE_ENTITIES.has(resource);
|
|
911
912
|
}
|
|
912
913
|
chunkUSNT2KNT_cjs.__name(resourceUsesVendorScope, "resourceUsesVendorScope");
|
|
913
914
|
function mergeWhereClause(where, extra) {
|
|
@@ -5295,22 +5296,12 @@ function createCrudHandler(dataSource, entityMap, options) {
|
|
|
5295
5296
|
await recordDiscountUsage2(dataSource, entityMap, created.id, orderDiscountId, persistBody.contactId, discount);
|
|
5296
5297
|
}
|
|
5297
5298
|
const orderIdForNotify = created.id;
|
|
5298
|
-
void import('./emit-order-notification-trigger-
|
|
5299
|
+
void import('./emit-order-notification-trigger-NASG7ZEO.cjs').then(({ fireOrderNotificationTrigger }) => {
|
|
5299
5300
|
fireOrderNotificationTrigger("order_placed", orderIdForNotify, {
|
|
5300
5301
|
dataSource,
|
|
5301
5302
|
entityMap
|
|
5302
5303
|
});
|
|
5303
5304
|
});
|
|
5304
|
-
if (getCms) {
|
|
5305
|
-
void import('./send-order-placed-emails-B5ZVJT7T.cjs').then(({ sendOrderPlacedEmailsAfterConfirmation }) => {
|
|
5306
|
-
return sendOrderPlacedEmailsAfterConfirmation(orderIdForNotify, {
|
|
5307
|
-
getDataSource: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name(async () => dataSource, "getDataSource"),
|
|
5308
|
-
entityMap,
|
|
5309
|
-
getCms: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name(async () => await getCms(), "getCms")
|
|
5310
|
-
});
|
|
5311
|
-
}).catch(() => {
|
|
5312
|
-
});
|
|
5313
|
-
}
|
|
5314
5305
|
}
|
|
5315
5306
|
} catch (err) {
|
|
5316
5307
|
const message = err instanceof Error ? err.message : String(err);
|
|
@@ -8529,7 +8520,7 @@ function createVendorDashboardHandler(config) {
|
|
|
8529
8520
|
if (pe) return pe;
|
|
8530
8521
|
}
|
|
8531
8522
|
const user = await getSessionUser();
|
|
8532
|
-
if (!user || !
|
|
8523
|
+
if (!user || !chunk77NUXO6A_cjs.isVendorPortalUser(user)) {
|
|
8533
8524
|
return json({
|
|
8534
8525
|
error: "Forbidden"
|
|
8535
8526
|
}, {
|
|
@@ -10979,7 +10970,7 @@ function createChatHandlers(config) {
|
|
|
10979
10970
|
const notifyEmailAgent = await findLlmAgentByScope(dataSource, entityMap, LLM_AGENT_SCOPE_EMAIL_INTENT_CHATBOT, {
|
|
10980
10971
|
enabledOnly: false
|
|
10981
10972
|
});
|
|
10982
|
-
const emailTool =
|
|
10973
|
+
const emailTool = chunkLMJ7RKPF_cjs.resolveChatEmailToolSettings(llmSettings, {
|
|
10983
10974
|
chatbotValidationRules: agentRow?.validationRules ?? null,
|
|
10984
10975
|
notifyAgent: notifyEmailAgent ? {
|
|
10985
10976
|
systemInstruction: notifyEmailAgent.systemInstruction,
|
|
@@ -10989,7 +10980,7 @@ function createChatHandlers(config) {
|
|
|
10989
10980
|
const emailPlugin2 = cms.getPlugin("email");
|
|
10990
10981
|
const convLeadSent = conv.leadEmailSentAt;
|
|
10991
10982
|
const chatAgentFn = llm.chatAgent?.bind(llm);
|
|
10992
|
-
console.info(
|
|
10983
|
+
console.info(chunkLMJ7RKPF_cjs.CHAT_EMAIL_LOG, "pipeline check", {
|
|
10993
10984
|
conversationId,
|
|
10994
10985
|
enabled: emailTool.enabled,
|
|
10995
10986
|
intentCount: emailTool.intents.length,
|
|
@@ -11003,27 +10994,27 @@ function createChatHandlers(config) {
|
|
|
11003
10994
|
mergedPromptIncludesNotify: Boolean(notifyEmailAgent?.systemInstruction?.trim())
|
|
11004
10995
|
});
|
|
11005
10996
|
if (!emailTool.enabled) {
|
|
11006
|
-
console.info(
|
|
10997
|
+
console.info(chunkLMJ7RKPF_cjs.CHAT_EMAIL_LOG, "pipeline skipped", {
|
|
11007
10998
|
conversationId,
|
|
11008
10999
|
reason: "email_tool_disabled"
|
|
11009
11000
|
});
|
|
11010
11001
|
} else if (emailTool.intents.length === 0) {
|
|
11011
|
-
console.info(
|
|
11002
|
+
console.info(chunkLMJ7RKPF_cjs.CHAT_EMAIL_LOG, "pipeline skipped", {
|
|
11012
11003
|
conversationId,
|
|
11013
11004
|
reason: "no_intents_configured"
|
|
11014
11005
|
});
|
|
11015
11006
|
} else if (!emailPlugin2) {
|
|
11016
|
-
console.info(
|
|
11007
|
+
console.info(chunkLMJ7RKPF_cjs.CHAT_EMAIL_LOG, "pipeline skipped", {
|
|
11017
11008
|
conversationId,
|
|
11018
11009
|
reason: "email_plugin_missing"
|
|
11019
11010
|
});
|
|
11020
11011
|
} else if (!chatAgentFn) {
|
|
11021
|
-
console.info(
|
|
11012
|
+
console.info(chunkLMJ7RKPF_cjs.CHAT_EMAIL_LOG, "pipeline skipped", {
|
|
11022
11013
|
conversationId,
|
|
11023
11014
|
reason: "llm_chat_agent_unavailable"
|
|
11024
11015
|
});
|
|
11025
11016
|
} else if (convLeadSent) {
|
|
11026
|
-
console.info(
|
|
11017
|
+
console.info(chunkLMJ7RKPF_cjs.CHAT_EMAIL_LOG, "pipeline skipped", {
|
|
11027
11018
|
conversationId,
|
|
11028
11019
|
reason: "lead_email_already_sent",
|
|
11029
11020
|
leadEmailSentAt: convLeadSent
|
|
@@ -11036,7 +11027,7 @@ function createChatHandlers(config) {
|
|
|
11036
11027
|
}
|
|
11037
11028
|
});
|
|
11038
11029
|
if (!contactRow) {
|
|
11039
|
-
console.warn(
|
|
11030
|
+
console.warn(chunkLMJ7RKPF_cjs.CHAT_EMAIL_LOG, "pipeline skipped", {
|
|
11040
11031
|
conversationId,
|
|
11041
11032
|
reason: "contact_not_found",
|
|
11042
11033
|
contactId
|
|
@@ -11044,7 +11035,7 @@ function createChatHandlers(config) {
|
|
|
11044
11035
|
} else {
|
|
11045
11036
|
const c = contactRow;
|
|
11046
11037
|
try {
|
|
11047
|
-
const intent = await
|
|
11038
|
+
const intent = await chunkLMJ7RKPF_cjs.detectChatLeadIntent({
|
|
11048
11039
|
chatAgent: chatAgentFn
|
|
11049
11040
|
}, {
|
|
11050
11041
|
settings: emailTool,
|
|
@@ -11058,15 +11049,15 @@ function createChatHandlers(config) {
|
|
|
11058
11049
|
model: agentRow?.model?.trim() || notifyEmailAgent?.model?.trim() || void 0
|
|
11059
11050
|
});
|
|
11060
11051
|
if (!intent.intent || !intent.emailTo) {
|
|
11061
|
-
console.info(
|
|
11052
|
+
console.info(chunkLMJ7RKPF_cjs.CHAT_EMAIL_LOG, "no email sent", {
|
|
11062
11053
|
conversationId,
|
|
11063
11054
|
reason: intent.intent ? "missing_email_to" : "no_intent_match",
|
|
11064
11055
|
intentLabel: intent.intentLabel,
|
|
11065
11056
|
classifierReason: intent.reason
|
|
11066
11057
|
});
|
|
11067
11058
|
} else {
|
|
11068
|
-
const intentRecipients =
|
|
11069
|
-
console.info(
|
|
11059
|
+
const intentRecipients = chunkLMJ7RKPF_cjs.parseIntentRecipientEmails(intent.emailTo);
|
|
11060
|
+
console.info(chunkLMJ7RKPF_cjs.CHAT_EMAIL_LOG, "intent matched \u2014 sending", {
|
|
11070
11061
|
conversationId,
|
|
11071
11062
|
intent: intent.intent,
|
|
11072
11063
|
emailTo: intent.emailTo,
|
|
@@ -11076,7 +11067,7 @@ function createChatHandlers(config) {
|
|
|
11076
11067
|
const emailSettings = await loadSettingsGroupMap(dataSource, entityMap, "email");
|
|
11077
11068
|
const brandingSettings = await loadSettingsGroupMap(dataSource, entityMap, "branding");
|
|
11078
11069
|
const companyDetails = chunkBXYZDMTZ_cjs.mergeEmailLayoutCompanyDetails(brandingSettings, emailSettings);
|
|
11079
|
-
const leadResult = await
|
|
11070
|
+
const leadResult = await chunkLMJ7RKPF_cjs.sendChatLeadEmail(cms, emailSettings, brandingSettings, {
|
|
11080
11071
|
contactName: String(c.name ?? "").trim() || "Visitor",
|
|
11081
11072
|
contactEmail: String(c.email ?? "").trim(),
|
|
11082
11073
|
contactPhone: c.phone ?? null,
|
|
@@ -11084,7 +11075,7 @@ function createChatHandlers(config) {
|
|
|
11084
11075
|
latestMessage: message,
|
|
11085
11076
|
intentCode: intent.intent,
|
|
11086
11077
|
intentReason: intent.intentLabel || intent.reason,
|
|
11087
|
-
transcript:
|
|
11078
|
+
transcript: chunkLMJ7RKPF_cjs.buildTranscriptForLeadEmail(history, message),
|
|
11088
11079
|
companyDetails,
|
|
11089
11080
|
recipients: intentRecipients.length > 0 ? intentRecipients : void 0
|
|
11090
11081
|
});
|
|
@@ -11092,13 +11083,13 @@ function createChatHandlers(config) {
|
|
|
11092
11083
|
await convRepo().update(conversationId, {
|
|
11093
11084
|
leadEmailSentAt: /* @__PURE__ */ new Date()
|
|
11094
11085
|
});
|
|
11095
|
-
console.info(
|
|
11086
|
+
console.info(chunkLMJ7RKPF_cjs.CHAT_EMAIL_LOG, "lead email recorded", {
|
|
11096
11087
|
conversationId,
|
|
11097
11088
|
sent: true,
|
|
11098
11089
|
recipients: leadResult.recipients
|
|
11099
11090
|
});
|
|
11100
11091
|
} else {
|
|
11101
|
-
console.warn(
|
|
11092
|
+
console.warn(chunkLMJ7RKPF_cjs.CHAT_EMAIL_LOG, "lead email not sent", {
|
|
11102
11093
|
conversationId,
|
|
11103
11094
|
sent: false,
|
|
11104
11095
|
error: leadResult.error ?? "unknown",
|
|
@@ -11107,7 +11098,7 @@ function createChatHandlers(config) {
|
|
|
11107
11098
|
}
|
|
11108
11099
|
}
|
|
11109
11100
|
} catch (intentErr) {
|
|
11110
|
-
console.warn(
|
|
11101
|
+
console.warn(chunkLMJ7RKPF_cjs.CHAT_EMAIL_LOG, "pipeline error", {
|
|
11111
11102
|
conversationId,
|
|
11112
11103
|
error: intentErr instanceof Error ? intentErr.message : String(intentErr)
|
|
11113
11104
|
});
|
|
@@ -11124,7 +11115,7 @@ function createChatHandlers(config) {
|
|
|
11124
11115
|
});
|
|
11125
11116
|
if (agentRow && llm.chatAgent) {
|
|
11126
11117
|
const fromAgent = llmAgentToChatAgentOptions(agentRow);
|
|
11127
|
-
const systemPrompt =
|
|
11118
|
+
const systemPrompt = chunkLMJ7RKPF_cjs.buildChatbotSystemPromptWithEmailTool(fromAgent.systemPrompt, parsedValidation.guardrailsForPrompt, emailTool);
|
|
11128
11119
|
const res = await llm.chatAgent({
|
|
11129
11120
|
...fromAgent,
|
|
11130
11121
|
systemPrompt: systemPrompt || void 0,
|
|
@@ -11145,7 +11136,7 @@ ${contextParts.join("\n\n")}` : "";
|
|
|
11145
11136
|
agentRow.systemInstruction?.trim(),
|
|
11146
11137
|
ragSystem
|
|
11147
11138
|
].filter(Boolean).join("\n\n");
|
|
11148
|
-
systemContent =
|
|
11139
|
+
systemContent = chunkLMJ7RKPF_cjs.buildChatbotSystemPromptWithEmailTool(mergedBase || defaultSystem, parsedValidation.guardrailsForPrompt, emailTool) || defaultSystem;
|
|
11149
11140
|
} else {
|
|
11150
11141
|
systemContent = ragSystem || defaultSystem;
|
|
11151
11142
|
}
|
|
@@ -12082,7 +12073,7 @@ function createEventOrderMessageTemplateHandlers(config) {
|
|
|
12082
12073
|
try {
|
|
12083
12074
|
const rows = await repo().find({
|
|
12084
12075
|
where: {
|
|
12085
|
-
templateKey:
|
|
12076
|
+
templateKey: chunk4PMK3RNA_cjs.EVENT_ORDER_TEMPLATE_KEY,
|
|
12086
12077
|
deleted: false
|
|
12087
12078
|
}
|
|
12088
12079
|
});
|
|
@@ -12090,7 +12081,7 @@ function createEventOrderMessageTemplateHandlers(config) {
|
|
|
12090
12081
|
r.channel,
|
|
12091
12082
|
r
|
|
12092
12083
|
]));
|
|
12093
|
-
const items =
|
|
12084
|
+
const items = chunk4PMK3RNA_cjs.EVENT_ORDER_MESSAGE_TEMPLATE_DEFAULTS.map((def) => {
|
|
12094
12085
|
const row = byChannel.get(def.channel);
|
|
12095
12086
|
return {
|
|
12096
12087
|
channel: def.channel,
|
|
@@ -12117,7 +12108,7 @@ function createEventOrderMessageTemplateHandlers(config) {
|
|
|
12117
12108
|
deleted: false
|
|
12118
12109
|
}
|
|
12119
12110
|
});
|
|
12120
|
-
whatsappTemplateOptions = waRows.filter((r) => r.templateKey !==
|
|
12111
|
+
whatsappTemplateOptions = waRows.filter((r) => r.templateKey !== chunk4PMK3RNA_cjs.EVENT_ORDER_TEMPLATE_KEY).map((r) => {
|
|
12121
12112
|
const row = r;
|
|
12122
12113
|
const bodyComponent = row.providerMeta?.components?.find((c) => c.type === "BODY");
|
|
12123
12114
|
return {
|
|
@@ -12135,7 +12126,7 @@ function createEventOrderMessageTemplateHandlers(config) {
|
|
|
12135
12126
|
return json({
|
|
12136
12127
|
items,
|
|
12137
12128
|
templateVariables: [
|
|
12138
|
-
...
|
|
12129
|
+
...chunk4PMK3RNA_cjs.EVENT_ORDER_TEMPLATE_VARIABLES
|
|
12139
12130
|
],
|
|
12140
12131
|
whatsappTemplateOptions
|
|
12141
12132
|
});
|
|
@@ -12161,7 +12152,7 @@ function createEventOrderMessageTemplateHandlers(config) {
|
|
|
12161
12152
|
}
|
|
12162
12153
|
for (const item of raw.items) {
|
|
12163
12154
|
const channel = item.channel;
|
|
12164
|
-
const def =
|
|
12155
|
+
const def = chunk4PMK3RNA_cjs.EVENT_ORDER_MESSAGE_TEMPLATE_DEFAULTS.find((d) => d.channel === channel);
|
|
12165
12156
|
if (!def) continue;
|
|
12166
12157
|
const body = typeof item.body === "string" ? item.body : "";
|
|
12167
12158
|
const subject = typeof item.subject === "string" ? item.subject : "";
|
|
@@ -12176,7 +12167,7 @@ function createEventOrderMessageTemplateHandlers(config) {
|
|
|
12176
12167
|
const existing = await repo().findOne({
|
|
12177
12168
|
where: {
|
|
12178
12169
|
channel,
|
|
12179
|
-
templateKey:
|
|
12170
|
+
templateKey: chunk4PMK3RNA_cjs.EVENT_ORDER_TEMPLATE_KEY,
|
|
12180
12171
|
deleted: false
|
|
12181
12172
|
}
|
|
12182
12173
|
});
|
|
@@ -12199,7 +12190,7 @@ function createEventOrderMessageTemplateHandlers(config) {
|
|
|
12199
12190
|
} else {
|
|
12200
12191
|
await repo().save(repo().create({
|
|
12201
12192
|
channel,
|
|
12202
|
-
templateKey:
|
|
12193
|
+
templateKey: chunk4PMK3RNA_cjs.EVENT_ORDER_TEMPLATE_KEY,
|
|
12203
12194
|
name: def.name,
|
|
12204
12195
|
subject: channel === "email" ? subject : null,
|
|
12205
12196
|
body,
|
|
@@ -12556,7 +12547,7 @@ chunkUSNT2KNT_cjs.__name(findActiveRefundPolicyForVendor, "findActiveRefundPolic
|
|
|
12556
12547
|
// src/api/admin-roles-handlers.ts
|
|
12557
12548
|
function createAdminRolesHandlers(config) {
|
|
12558
12549
|
const { dataSource, entityMap, json, getSessionUser } = config;
|
|
12559
|
-
const baseEntities =
|
|
12550
|
+
const baseEntities = chunk77NUXO6A_cjs.getPermissionableEntityKeys(entityMap);
|
|
12560
12551
|
const allowEntities = /* @__PURE__ */ new Set([
|
|
12561
12552
|
...baseEntities,
|
|
12562
12553
|
"users"
|
|
@@ -12571,7 +12562,7 @@ function createAdminRolesHandlers(config) {
|
|
|
12571
12562
|
}, {
|
|
12572
12563
|
status: 401
|
|
12573
12564
|
});
|
|
12574
|
-
if (!
|
|
12565
|
+
if (!chunkVUQFARRT_cjs.canManageRoles(u) && !chunk77NUXO6A_cjs.canManageVendorRoles(u)) {
|
|
12575
12566
|
return json({
|
|
12576
12567
|
error: "Forbidden"
|
|
12577
12568
|
}, {
|
|
@@ -12582,11 +12573,11 @@ function createAdminRolesHandlers(config) {
|
|
|
12582
12573
|
}
|
|
12583
12574
|
chunkUSNT2KNT_cjs.__name(gate, "gate");
|
|
12584
12575
|
function isVendorRolesOnly(u) {
|
|
12585
|
-
return
|
|
12576
|
+
return chunk77NUXO6A_cjs.canManageVendorRoles(u) && !chunkVUQFARRT_cjs.canManageRoles(u);
|
|
12586
12577
|
}
|
|
12587
12578
|
chunkUSNT2KNT_cjs.__name(isVendorRolesOnly, "isVendorRolesOnly");
|
|
12588
12579
|
const vendorRoleEntities = [
|
|
12589
|
-
...
|
|
12580
|
+
...chunk77NUXO6A_cjs.VENDOR_STORE_RBAC_ENTITIES,
|
|
12590
12581
|
"dashboard",
|
|
12591
12582
|
"settings"
|
|
12592
12583
|
].sort();
|
|
@@ -12743,7 +12734,7 @@ function createAdminRolesHandlers(config) {
|
|
|
12743
12734
|
}, {
|
|
12744
12735
|
status: 404
|
|
12745
12736
|
});
|
|
12746
|
-
if (
|
|
12737
|
+
if (chunk77NUXO6A_cjs.isSuperAdminGroupName(g.name) && !chunk77NUXO6A_cjs.isSuperAdminGroupName(name)) {
|
|
12747
12738
|
return json({
|
|
12748
12739
|
error: "Cannot rename the administrator group"
|
|
12749
12740
|
}, {
|
|
@@ -12800,7 +12791,7 @@ function createAdminRolesHandlers(config) {
|
|
|
12800
12791
|
}, {
|
|
12801
12792
|
status: 404
|
|
12802
12793
|
});
|
|
12803
|
-
if (
|
|
12794
|
+
if (chunk77NUXO6A_cjs.isSuperAdminGroupName(g.name)) return json({
|
|
12804
12795
|
error: "Cannot delete the administrator group"
|
|
12805
12796
|
}, {
|
|
12806
12797
|
status: 400
|
|
@@ -12940,7 +12931,7 @@ async function sendVendorOnboardEmails(input, deps) {
|
|
|
12940
12931
|
getSettingsGroup(deps, "email")
|
|
12941
12932
|
]);
|
|
12942
12933
|
const companyDetails = chunkBXYZDMTZ_cjs.mergeEmailLayoutCompanyDetails(branding, emailSettings);
|
|
12943
|
-
const notifyEmails =
|
|
12934
|
+
const notifyEmails = chunkLMJ7RKPF_cjs.parseEmailRecipientsFromConfig(emailSettings.salesTeamEmails ?? emailSettings.salesTeamEmail);
|
|
12944
12935
|
const sendToOwner = input.sendToOwner !== false;
|
|
12945
12936
|
const ownerEmail = input.ownerEmail?.trim() || "";
|
|
12946
12937
|
const cms = await deps.getCms();
|
|
@@ -12968,7 +12959,7 @@ chunkUSNT2KNT_cjs.__name(sendVendorOnboardEmails, "sendVendorOnboardEmails");
|
|
|
12968
12959
|
|
|
12969
12960
|
// src/lib/seed-vendor-roles.ts
|
|
12970
12961
|
async function insertRolePermissions(exec, vendorRoleId, permissions) {
|
|
12971
|
-
for (const entity of
|
|
12962
|
+
for (const entity of chunk77NUXO6A_cjs.VENDOR_RBAC_ENTITIES) {
|
|
12972
12963
|
const flags = permissions[entity];
|
|
12973
12964
|
if (!flags) continue;
|
|
12974
12965
|
await exec.query(`
|
|
@@ -12999,7 +12990,7 @@ async function seedVendorDefaultRoles(em, vendorId) {
|
|
|
12999
12990
|
for (const r of existing) {
|
|
13000
12991
|
roleIdsByName2[r.name] = Number(r.id);
|
|
13001
12992
|
if (r.isOwnerRole) ownerRoleId2 = Number(r.id);
|
|
13002
|
-
if (r.name ===
|
|
12993
|
+
if (r.name === chunk77NUXO6A_cjs.VENDOR_VIEWER_ROLE_NAME) viewerRoleId2 = Number(r.id);
|
|
13003
12994
|
}
|
|
13004
12995
|
return {
|
|
13005
12996
|
roleIdsByName: roleIdsByName2,
|
|
@@ -13010,7 +13001,7 @@ async function seedVendorDefaultRoles(em, vendorId) {
|
|
|
13010
13001
|
const roleIdsByName = {};
|
|
13011
13002
|
let ownerRoleId = 0;
|
|
13012
13003
|
let viewerRoleId = 0;
|
|
13013
|
-
for (const def of
|
|
13004
|
+
for (const def of chunk77NUXO6A_cjs.DEFAULT_VENDOR_ROLE_DEFS) {
|
|
13014
13005
|
const inserted = await exec.query(`
|
|
13015
13006
|
INSERT INTO "vendor_roles"
|
|
13016
13007
|
("vendorId", "name", "description", "isSystem", "isOwnerRole")
|
|
@@ -13027,7 +13018,7 @@ async function seedVendorDefaultRoles(em, vendorId) {
|
|
|
13027
13018
|
if (!roleId) continue;
|
|
13028
13019
|
roleIdsByName[def.name] = roleId;
|
|
13029
13020
|
if (def.isOwnerRole) ownerRoleId = roleId;
|
|
13030
|
-
if (def.name ===
|
|
13021
|
+
if (def.name === chunk77NUXO6A_cjs.VENDOR_VIEWER_ROLE_NAME) viewerRoleId = roleId;
|
|
13031
13022
|
await insertRolePermissions(exec, roleId, def.permissions);
|
|
13032
13023
|
}
|
|
13033
13024
|
return {
|
|
@@ -13038,6 +13029,15 @@ async function seedVendorDefaultRoles(em, vendorId) {
|
|
|
13038
13029
|
}
|
|
13039
13030
|
chunkUSNT2KNT_cjs.__name(seedVendorDefaultRoles, "seedVendorDefaultRoles");
|
|
13040
13031
|
async function backfillVendorUserRoleIds(em, vendorId, seeded) {
|
|
13032
|
+
const cols = await em.query(`
|
|
13033
|
+
SELECT 1
|
|
13034
|
+
FROM information_schema.columns
|
|
13035
|
+
WHERE table_schema = 'public'
|
|
13036
|
+
AND table_name = 'vendor_users'
|
|
13037
|
+
AND column_name = 'role'
|
|
13038
|
+
LIMIT 1
|
|
13039
|
+
`);
|
|
13040
|
+
if (!cols.length) return;
|
|
13041
13041
|
if (seeded.ownerRoleId) {
|
|
13042
13042
|
await em.query(`
|
|
13043
13043
|
UPDATE "vendor_users"
|
|
@@ -13048,7 +13048,7 @@ async function backfillVendorUserRoleIds(em, vendorId, seeded) {
|
|
|
13048
13048
|
vendorId
|
|
13049
13049
|
]);
|
|
13050
13050
|
}
|
|
13051
|
-
const viewerId = seeded.viewerRoleId || seeded.roleIdsByName[
|
|
13051
|
+
const viewerId = seeded.viewerRoleId || seeded.roleIdsByName[chunk77NUXO6A_cjs.VENDOR_VIEWER_ROLE_NAME];
|
|
13052
13052
|
if (viewerId) {
|
|
13053
13053
|
await em.query(`
|
|
13054
13054
|
UPDATE "vendor_users"
|
|
@@ -13074,7 +13074,7 @@ async function getDefaultStaffRoleIdForVendor(em, vendorId) {
|
|
|
13074
13074
|
LIMIT 1
|
|
13075
13075
|
`, [
|
|
13076
13076
|
vendorId,
|
|
13077
|
-
|
|
13077
|
+
chunk77NUXO6A_cjs.VENDOR_VIEWER_ROLE_NAME
|
|
13078
13078
|
]);
|
|
13079
13079
|
const id = rows[0]?.id;
|
|
13080
13080
|
return id != null ? Number(id) : null;
|
|
@@ -13129,11 +13129,29 @@ function parseVendorProfileFromBody(raw, options) {
|
|
|
13129
13129
|
country: trimOrNull(raw?.country) ?? "IN",
|
|
13130
13130
|
postalCode: trimOrNull(raw?.postalCode),
|
|
13131
13131
|
gstin: trimOrNull(raw?.gstin)?.toUpperCase() ?? null,
|
|
13132
|
-
pan: trimOrNull(raw?.pan)?.toUpperCase() ?? null,
|
|
13133
13132
|
registrationStatus: parseRegistrationStatus(raw?.registrationStatus, defaultStatus)
|
|
13134
13133
|
};
|
|
13135
13134
|
}
|
|
13136
13135
|
chunkUSNT2KNT_cjs.__name(parseVendorProfileFromBody, "parseVendorProfileFromBody");
|
|
13136
|
+
function parseVendorPersonProfileFromBody(raw, fallbacks) {
|
|
13137
|
+
const name = trimOrNull(raw?.name) ?? trimOrNull(fallbacks?.name) ?? "";
|
|
13138
|
+
const email = (trimOrNull(raw?.email) ?? trimOrNull(fallbacks?.email) ?? "").toLowerCase();
|
|
13139
|
+
const aadhaarRaw = trimOrNull(raw?.aadhaarNo) ?? trimOrNull(raw?.aadhaar);
|
|
13140
|
+
const panRaw = trimOrNull(raw?.panNo) ?? trimOrNull(raw?.pan);
|
|
13141
|
+
return {
|
|
13142
|
+
name,
|
|
13143
|
+
email,
|
|
13144
|
+
phone: trimOrNull(raw?.phone) ?? trimOrNull(fallbacks?.phone),
|
|
13145
|
+
aadhaarNo: aadhaarRaw ? aadhaarRaw.replace(/\s+/g, "") : null,
|
|
13146
|
+
panNo: panRaw ? panRaw.toUpperCase() : null,
|
|
13147
|
+
addressLine1: trimOrNull(raw?.addressLine1),
|
|
13148
|
+
addressLine2: trimOrNull(raw?.addressLine2),
|
|
13149
|
+
city: trimOrNull(raw?.city),
|
|
13150
|
+
state: trimOrNull(raw?.state),
|
|
13151
|
+
postalCode: trimOrNull(raw?.postalCode)
|
|
13152
|
+
};
|
|
13153
|
+
}
|
|
13154
|
+
chunkUSNT2KNT_cjs.__name(parseVendorPersonProfileFromBody, "parseVendorPersonProfileFromBody");
|
|
13137
13155
|
function validateIndiaTaxIds(gstin, pan) {
|
|
13138
13156
|
if (gstin && !/^[0-9]{2}[A-Z]{5}[0-9]{4}[A-Z][1-9A-Z]Z[0-9A-Z]$/i.test(gstin)) {
|
|
13139
13157
|
return "Invalid GSTIN format (15 characters, e.g. 22AAAAA0000A1Z5)";
|
|
@@ -13144,6 +13162,25 @@ function validateIndiaTaxIds(gstin, pan) {
|
|
|
13144
13162
|
return null;
|
|
13145
13163
|
}
|
|
13146
13164
|
chunkUSNT2KNT_cjs.__name(validateIndiaTaxIds, "validateIndiaTaxIds");
|
|
13165
|
+
function validateAadhaar(aadhaar) {
|
|
13166
|
+
if (!aadhaar) return null;
|
|
13167
|
+
if (!/^[0-9]{12}$/.test(aadhaar)) {
|
|
13168
|
+
return "Invalid Aadhaar number (12 digits)";
|
|
13169
|
+
}
|
|
13170
|
+
return null;
|
|
13171
|
+
}
|
|
13172
|
+
chunkUSNT2KNT_cjs.__name(validateAadhaar, "validateAadhaar");
|
|
13173
|
+
function validatePersonKyc(person, options) {
|
|
13174
|
+
const required = options?.required === true;
|
|
13175
|
+
if (required && !person.aadhaarNo) return "Aadhaar number is required";
|
|
13176
|
+
if (required && !person.panNo) return "PAN is required";
|
|
13177
|
+
const aadhaarErr = validateAadhaar(person.aadhaarNo ?? null);
|
|
13178
|
+
if (aadhaarErr) return aadhaarErr;
|
|
13179
|
+
const panErr = validateIndiaTaxIds(null, person.panNo ?? null);
|
|
13180
|
+
if (panErr) return panErr;
|
|
13181
|
+
return null;
|
|
13182
|
+
}
|
|
13183
|
+
chunkUSNT2KNT_cjs.__name(validatePersonKyc, "validatePersonKyc");
|
|
13147
13184
|
function buildVendorMetadata(existing, input) {
|
|
13148
13185
|
const next = {
|
|
13149
13186
|
...existing ?? {}
|
|
@@ -13158,11 +13195,86 @@ function buildVendorMetadata(existing, input) {
|
|
|
13158
13195
|
}
|
|
13159
13196
|
chunkUSNT2KNT_cjs.__name(buildVendorMetadata, "buildVendorMetadata");
|
|
13160
13197
|
|
|
13198
|
+
// src/lib/vendor-pending-team-invite.ts
|
|
13199
|
+
var VENDOR_PENDING_TEAM_INVITES_KEY = "pendingTeamInvites";
|
|
13200
|
+
function asMetadata(raw) {
|
|
13201
|
+
if (raw && typeof raw === "object" && !Array.isArray(raw)) {
|
|
13202
|
+
return {
|
|
13203
|
+
...raw
|
|
13204
|
+
};
|
|
13205
|
+
}
|
|
13206
|
+
return {};
|
|
13207
|
+
}
|
|
13208
|
+
chunkUSNT2KNT_cjs.__name(asMetadata, "asMetadata");
|
|
13209
|
+
function readPendingTeamInvites(metadata) {
|
|
13210
|
+
const list = metadata?.[VENDOR_PENDING_TEAM_INVITES_KEY];
|
|
13211
|
+
if (!Array.isArray(list)) return [];
|
|
13212
|
+
return list.filter((row) => {
|
|
13213
|
+
if (!row || typeof row !== "object") return false;
|
|
13214
|
+
const r = row;
|
|
13215
|
+
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";
|
|
13216
|
+
});
|
|
13217
|
+
}
|
|
13218
|
+
chunkUSNT2KNT_cjs.__name(readPendingTeamInvites, "readPendingTeamInvites");
|
|
13219
|
+
function findPendingTeamInviteByToken(metadata, token) {
|
|
13220
|
+
const trimmed = token.trim();
|
|
13221
|
+
if (!trimmed) return null;
|
|
13222
|
+
return readPendingTeamInvites(metadata).find((i) => i.token === trimmed) ?? null;
|
|
13223
|
+
}
|
|
13224
|
+
chunkUSNT2KNT_cjs.__name(findPendingTeamInviteByToken, "findPendingTeamInviteByToken");
|
|
13225
|
+
function findPendingTeamInviteByUserId(metadata, userId) {
|
|
13226
|
+
if (!Number.isFinite(userId) || userId <= 0) return null;
|
|
13227
|
+
return readPendingTeamInvites(metadata).find((i) => i.userId === userId) ?? null;
|
|
13228
|
+
}
|
|
13229
|
+
chunkUSNT2KNT_cjs.__name(findPendingTeamInviteByUserId, "findPendingTeamInviteByUserId");
|
|
13230
|
+
function upsertPendingTeamInviteInMetadata(metadata, email, next) {
|
|
13231
|
+
const meta = asMetadata(metadata);
|
|
13232
|
+
const emailLc = email.trim().toLowerCase();
|
|
13233
|
+
const rest = readPendingTeamInvites(meta).filter((i) => i.email.toLowerCase() !== emailLc);
|
|
13234
|
+
const pending = next ? [
|
|
13235
|
+
...rest,
|
|
13236
|
+
next
|
|
13237
|
+
] : rest;
|
|
13238
|
+
if (pending.length === 0) {
|
|
13239
|
+
delete meta[VENDOR_PENDING_TEAM_INVITES_KEY];
|
|
13240
|
+
} else {
|
|
13241
|
+
meta[VENDOR_PENDING_TEAM_INVITES_KEY] = pending;
|
|
13242
|
+
}
|
|
13243
|
+
return meta;
|
|
13244
|
+
}
|
|
13245
|
+
chunkUSNT2KNT_cjs.__name(upsertPendingTeamInviteInMetadata, "upsertPendingTeamInviteInMetadata");
|
|
13246
|
+
function removePendingTeamInviteTokenFromMetadata(metadata, token) {
|
|
13247
|
+
const meta = asMetadata(metadata);
|
|
13248
|
+
const trimmed = token.trim();
|
|
13249
|
+
const pending = readPendingTeamInvites(meta).filter((i) => i.token !== trimmed);
|
|
13250
|
+
if (pending.length === 0) {
|
|
13251
|
+
delete meta[VENDOR_PENDING_TEAM_INVITES_KEY];
|
|
13252
|
+
} else {
|
|
13253
|
+
meta[VENDOR_PENDING_TEAM_INVITES_KEY] = pending;
|
|
13254
|
+
}
|
|
13255
|
+
return meta;
|
|
13256
|
+
}
|
|
13257
|
+
chunkUSNT2KNT_cjs.__name(removePendingTeamInviteTokenFromMetadata, "removePendingTeamInviteTokenFromMetadata");
|
|
13258
|
+
|
|
13161
13259
|
// src/api/vendor-handlers.ts
|
|
13162
13260
|
function slugify(input) {
|
|
13163
13261
|
return input.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 80);
|
|
13164
13262
|
}
|
|
13165
13263
|
chunkUSNT2KNT_cjs.__name(slugify, "slugify");
|
|
13264
|
+
function userHasActiveLogin(user) {
|
|
13265
|
+
if (user.deleted) return false;
|
|
13266
|
+
if (user.blocked) return false;
|
|
13267
|
+
const hasPassword = !!(user.password && String(user.password).trim());
|
|
13268
|
+
if (!hasPassword) return false;
|
|
13269
|
+
if (user.inviteStatus === "pending") return false;
|
|
13270
|
+
return true;
|
|
13271
|
+
}
|
|
13272
|
+
chunkUSNT2KNT_cjs.__name(userHasActiveLogin, "userHasActiveLogin");
|
|
13273
|
+
function buildTeamMembershipInviteLink(baseUrl, token, vendorId) {
|
|
13274
|
+
const base = baseUrl.replace(/\/+$/, "");
|
|
13275
|
+
return `${base}/admin/invite?token=${encodeURIComponent(token)}&mode=team&vendorId=${vendorId}`;
|
|
13276
|
+
}
|
|
13277
|
+
chunkUSNT2KNT_cjs.__name(buildTeamMembershipInviteLink, "buildTeamMembershipInviteLink");
|
|
13166
13278
|
async function userHasActiveVendor(em, entityMap, userId) {
|
|
13167
13279
|
const vendorRepo = em.getRepository(entityMap.vendors);
|
|
13168
13280
|
const owned = await vendorRepo.findOne({
|
|
@@ -13215,7 +13327,7 @@ function vendorOnboardErrorResponse(json, err) {
|
|
|
13215
13327
|
}
|
|
13216
13328
|
if (msg === "VENDOR_OWNER_GROUP_MISSING") {
|
|
13217
13329
|
return json({
|
|
13218
|
-
error: "Vendor
|
|
13330
|
+
error: "Vendor group not found. Run migrations (VendorTeamProfiles / VendorOwnerRbacSeed)."
|
|
13219
13331
|
}, {
|
|
13220
13332
|
status: 500
|
|
13221
13333
|
});
|
|
@@ -13275,7 +13387,7 @@ function vendorOnboardErrorResponse(json, err) {
|
|
|
13275
13387
|
}
|
|
13276
13388
|
chunkUSNT2KNT_cjs.__name(vendorOnboardErrorResponse, "vendorOnboardErrorResponse");
|
|
13277
13389
|
function createVendorOnboardHandlers(config) {
|
|
13278
|
-
const { dataSource, entityMap, json, getSessionUser, baseUrl, getCms
|
|
13390
|
+
const { dataSource, entityMap, json, getSessionUser, baseUrl, getCms } = config;
|
|
13279
13391
|
async function gateAdmin() {
|
|
13280
13392
|
const u = await getSessionUser();
|
|
13281
13393
|
if (!u?.email) return json({
|
|
@@ -13283,7 +13395,7 @@ function createVendorOnboardHandlers(config) {
|
|
|
13283
13395
|
}, {
|
|
13284
13396
|
status: 401
|
|
13285
13397
|
});
|
|
13286
|
-
if (!
|
|
13398
|
+
if (!chunk77NUXO6A_cjs.isPlatformAdministrator(u)) return json({
|
|
13287
13399
|
error: "Forbidden",
|
|
13288
13400
|
reason: "admin_only"
|
|
13289
13401
|
}, {
|
|
@@ -13293,7 +13405,7 @@ function createVendorOnboardHandlers(config) {
|
|
|
13293
13405
|
}
|
|
13294
13406
|
chunkUSNT2KNT_cjs.__name(gateAdmin, "gateAdmin");
|
|
13295
13407
|
async function resolveActiveVendorId(u) {
|
|
13296
|
-
const scope =
|
|
13408
|
+
const scope = chunk77NUXO6A_cjs.resolveVendorScopeFromSessionUser(u);
|
|
13297
13409
|
const candidates = [];
|
|
13298
13410
|
if (scope.type === "vendor") candidates.push(scope.vendorId);
|
|
13299
13411
|
if (scope.type === "all" || scope.type === "vendor") {
|
|
@@ -13347,7 +13459,7 @@ function createVendorOnboardHandlers(config) {
|
|
|
13347
13459
|
}, {
|
|
13348
13460
|
status: 401
|
|
13349
13461
|
});
|
|
13350
|
-
if (!
|
|
13462
|
+
if (!chunk77NUXO6A_cjs.isVendorPortalUser(u) && !chunk77NUXO6A_cjs.isPlatformAdministrator(u)) {
|
|
13351
13463
|
return json({
|
|
13352
13464
|
error: "Forbidden"
|
|
13353
13465
|
}, {
|
|
@@ -13375,7 +13487,7 @@ function createVendorOnboardHandlers(config) {
|
|
|
13375
13487
|
}, {
|
|
13376
13488
|
status: 401
|
|
13377
13489
|
});
|
|
13378
|
-
if (!
|
|
13490
|
+
if (!chunk77NUXO6A_cjs.canManageVendorTeam(u)) return json({
|
|
13379
13491
|
error: "Forbidden"
|
|
13380
13492
|
}, {
|
|
13381
13493
|
status: 403
|
|
@@ -13425,7 +13537,7 @@ function createVendorOnboardHandlers(config) {
|
|
|
13425
13537
|
async getProfile() {
|
|
13426
13538
|
const gated = await gateVendorPortal();
|
|
13427
13539
|
if (gated instanceof Response) return gated;
|
|
13428
|
-
const { vendorId } = gated;
|
|
13540
|
+
const { user, vendorId } = gated;
|
|
13429
13541
|
if (!entityMap.vendors) {
|
|
13430
13542
|
return json({
|
|
13431
13543
|
error: "Vendors not configured"
|
|
@@ -13445,7 +13557,39 @@ function createVendorOnboardHandlers(config) {
|
|
|
13445
13557
|
}, {
|
|
13446
13558
|
status: 404
|
|
13447
13559
|
});
|
|
13448
|
-
|
|
13560
|
+
let personProfile = null;
|
|
13561
|
+
const userId = user.id != null ? Number(user.id) : null;
|
|
13562
|
+
if (userId != null && Number.isFinite(userId) && entityMap.vendor_users && entityMap.vendor_user_profiles) {
|
|
13563
|
+
const link = await dataSource.getRepository(entityMap.vendor_users).findOne({
|
|
13564
|
+
where: {
|
|
13565
|
+
vendorId,
|
|
13566
|
+
userId
|
|
13567
|
+
},
|
|
13568
|
+
relations: [
|
|
13569
|
+
"vendorUserProfile"
|
|
13570
|
+
]
|
|
13571
|
+
});
|
|
13572
|
+
const vp = link?.vendorUserProfile;
|
|
13573
|
+
if (vp) {
|
|
13574
|
+
personProfile = {
|
|
13575
|
+
id: vp.id,
|
|
13576
|
+
name: vp.name ?? null,
|
|
13577
|
+
email: vp.email ?? null,
|
|
13578
|
+
phone: vp.phone ?? null,
|
|
13579
|
+
aadhaarNo: vp.aadhaarNo ?? null,
|
|
13580
|
+
panNo: vp.panNo ?? null,
|
|
13581
|
+
addressLine1: vp.addressLine1 ?? null,
|
|
13582
|
+
addressLine2: vp.addressLine2 ?? null,
|
|
13583
|
+
city: vp.city ?? null,
|
|
13584
|
+
state: vp.state ?? null,
|
|
13585
|
+
postalCode: vp.postalCode ?? null
|
|
13586
|
+
};
|
|
13587
|
+
}
|
|
13588
|
+
}
|
|
13589
|
+
return json({
|
|
13590
|
+
...row,
|
|
13591
|
+
personProfile
|
|
13592
|
+
});
|
|
13449
13593
|
} catch (e) {
|
|
13450
13594
|
console.error("[vendor.profile]", e);
|
|
13451
13595
|
return json({
|
|
@@ -13466,6 +13610,13 @@ function createVendorOnboardHandlers(config) {
|
|
|
13466
13610
|
status: 500
|
|
13467
13611
|
});
|
|
13468
13612
|
}
|
|
13613
|
+
if (!entityMap.vendor_user_profiles) {
|
|
13614
|
+
return json({
|
|
13615
|
+
error: "vendor_user_profiles not configured. Run migrations."
|
|
13616
|
+
}, {
|
|
13617
|
+
status: 500
|
|
13618
|
+
});
|
|
13619
|
+
}
|
|
13469
13620
|
try {
|
|
13470
13621
|
const body = await req.json();
|
|
13471
13622
|
const vendorName = trimOrNull(body.vendor?.name);
|
|
@@ -13497,12 +13648,35 @@ function createVendorOnboardHandlers(config) {
|
|
|
13497
13648
|
const profile = parseVendorProfileFromBody(body.vendor, {
|
|
13498
13649
|
defaultRegistrationStatus: "approved"
|
|
13499
13650
|
});
|
|
13500
|
-
const
|
|
13501
|
-
if (
|
|
13502
|
-
error:
|
|
13651
|
+
const gstError = validateIndiaTaxIds(profile.gstin, null);
|
|
13652
|
+
if (gstError) return json({
|
|
13653
|
+
error: gstError
|
|
13654
|
+
}, {
|
|
13655
|
+
status: 400
|
|
13656
|
+
});
|
|
13657
|
+
const person = parseVendorPersonProfileFromBody({
|
|
13658
|
+
...body.ownerProfile ?? {},
|
|
13659
|
+
...body.user ?? {}
|
|
13660
|
+
}, {
|
|
13661
|
+
name: userName,
|
|
13662
|
+
email: userEmail,
|
|
13663
|
+
phone: ownerPhone
|
|
13664
|
+
});
|
|
13665
|
+
const personErr = validatePersonKyc(person, {
|
|
13666
|
+
required: true
|
|
13667
|
+
});
|
|
13668
|
+
if (personErr) return json({
|
|
13669
|
+
error: personErr
|
|
13503
13670
|
}, {
|
|
13504
13671
|
status: 400
|
|
13505
13672
|
});
|
|
13673
|
+
if (!person.addressLine1?.trim()) {
|
|
13674
|
+
return json({
|
|
13675
|
+
error: "Owner address line 1 is required"
|
|
13676
|
+
}, {
|
|
13677
|
+
status: 400
|
|
13678
|
+
});
|
|
13679
|
+
}
|
|
13506
13680
|
const activation = "invite";
|
|
13507
13681
|
const ownerPasswordHash = null;
|
|
13508
13682
|
const slug = trimOrNull(body.vendor?.slug) || slugify(vendorName);
|
|
@@ -13516,6 +13690,7 @@ function createVendorOnboardHandlers(config) {
|
|
|
13516
13690
|
const userRepo = em.getRepository(entityMap.users);
|
|
13517
13691
|
const vuRepo = em.getRepository(entityMap.vendor_users);
|
|
13518
13692
|
const groupRepo = em.getRepository(entityMap.user_groups);
|
|
13693
|
+
const profileRepo = em.getRepository(entityMap.vendor_user_profiles);
|
|
13519
13694
|
const dupVendor = await vendorRepo.findOne({
|
|
13520
13695
|
where: {
|
|
13521
13696
|
slug,
|
|
@@ -13526,24 +13701,32 @@ function createVendorOnboardHandlers(config) {
|
|
|
13526
13701
|
await chunkOY2YTBMP_cjs.retireSoftDeletedUniqueValue(vendorRepo, "slug", slug);
|
|
13527
13702
|
let ownerGroup = await groupRepo.findOne({
|
|
13528
13703
|
where: {
|
|
13529
|
-
name:
|
|
13704
|
+
name: chunk77NUXO6A_cjs.VENDOR_GROUP_NAME,
|
|
13530
13705
|
deleted: false
|
|
13531
13706
|
}
|
|
13532
13707
|
});
|
|
13708
|
+
if (!ownerGroup) {
|
|
13709
|
+
ownerGroup = await groupRepo.findOne({
|
|
13710
|
+
where: {
|
|
13711
|
+
name: "Vendor Owner",
|
|
13712
|
+
deleted: false
|
|
13713
|
+
}
|
|
13714
|
+
});
|
|
13715
|
+
}
|
|
13533
13716
|
if (!ownerGroup) {
|
|
13534
13717
|
try {
|
|
13535
13718
|
await groupRepo.save(groupRepo.create({
|
|
13536
|
-
name:
|
|
13719
|
+
name: chunk77NUXO6A_cjs.VENDOR_GROUP_NAME,
|
|
13537
13720
|
deleted: false
|
|
13538
13721
|
}));
|
|
13539
13722
|
ownerGroup = await groupRepo.findOne({
|
|
13540
13723
|
where: {
|
|
13541
|
-
name:
|
|
13724
|
+
name: chunk77NUXO6A_cjs.VENDOR_GROUP_NAME,
|
|
13542
13725
|
deleted: false
|
|
13543
13726
|
}
|
|
13544
13727
|
});
|
|
13545
13728
|
} catch (seedErr) {
|
|
13546
|
-
console.error("[vendor-onboard] failed to seed Vendor
|
|
13729
|
+
console.error("[vendor-onboard] failed to seed Vendor group", seedErr);
|
|
13547
13730
|
}
|
|
13548
13731
|
}
|
|
13549
13732
|
if (!ownerGroup) throw new Error("VENDOR_OWNER_GROUP_MISSING");
|
|
@@ -13611,7 +13794,6 @@ function createVendorOnboardHandlers(config) {
|
|
|
13611
13794
|
country: profile.country,
|
|
13612
13795
|
postalCode: profile.postalCode,
|
|
13613
13796
|
gstin: profile.gstin,
|
|
13614
|
-
pan: profile.pan,
|
|
13615
13797
|
registrationStatus: profile.registrationStatus,
|
|
13616
13798
|
metadata,
|
|
13617
13799
|
active: body.vendor?.active !== false,
|
|
@@ -13619,6 +13801,18 @@ function createVendorOnboardHandlers(config) {
|
|
|
13619
13801
|
userId: newUser.id,
|
|
13620
13802
|
inviteStatus: chunk7NMT3GBR_cjs.inviteStatusForActivation(activation)
|
|
13621
13803
|
}));
|
|
13804
|
+
const personRow = await profileRepo.save(profileRepo.create({
|
|
13805
|
+
name: person.name || userName,
|
|
13806
|
+
email: person.email || userEmail,
|
|
13807
|
+
phone: person.phone,
|
|
13808
|
+
aadhaarNo: person.aadhaarNo,
|
|
13809
|
+
panNo: person.panNo,
|
|
13810
|
+
addressLine1: person.addressLine1,
|
|
13811
|
+
addressLine2: person.addressLine2,
|
|
13812
|
+
city: person.city,
|
|
13813
|
+
state: person.state,
|
|
13814
|
+
postalCode: person.postalCode
|
|
13815
|
+
}));
|
|
13622
13816
|
const seeded = await ensureVendorRolesForVendor(em, vendor.id);
|
|
13623
13817
|
if (!seeded.ownerRoleId) {
|
|
13624
13818
|
throw new Error("VENDOR_ROLES_SEED_FAILED");
|
|
@@ -13633,12 +13827,13 @@ function createVendorOnboardHandlers(config) {
|
|
|
13633
13827
|
await vuRepo.save(vuRepo.create({
|
|
13634
13828
|
vendorId: vendor.id,
|
|
13635
13829
|
userId: newUser.id,
|
|
13636
|
-
|
|
13637
|
-
|
|
13830
|
+
vendorRoleId: seeded.ownerRoleId,
|
|
13831
|
+
vendorUserProfileId: personRow.id
|
|
13638
13832
|
}));
|
|
13639
|
-
} else
|
|
13833
|
+
} else {
|
|
13640
13834
|
await vuRepo.update(existingLink.id, {
|
|
13641
|
-
vendorRoleId: seeded.ownerRoleId
|
|
13835
|
+
vendorRoleId: seeded.ownerRoleId,
|
|
13836
|
+
vendorUserProfileId: personRow.id
|
|
13642
13837
|
});
|
|
13643
13838
|
}
|
|
13644
13839
|
if (entityMap.customer) {
|
|
@@ -13867,9 +14062,14 @@ function createVendorOnboardHandlers(config) {
|
|
|
13867
14062
|
order: {
|
|
13868
14063
|
id: "ASC"
|
|
13869
14064
|
},
|
|
13870
|
-
relations:
|
|
13871
|
-
|
|
13872
|
-
|
|
14065
|
+
relations: [
|
|
14066
|
+
...entityMap.vendor_roles ? [
|
|
14067
|
+
"vendorRole"
|
|
14068
|
+
] : [],
|
|
14069
|
+
...entityMap.vendor_user_profiles ? [
|
|
14070
|
+
"vendorUserProfile"
|
|
14071
|
+
] : []
|
|
14072
|
+
]
|
|
13873
14073
|
});
|
|
13874
14074
|
if (links.length === 0) return json({
|
|
13875
14075
|
vendorId,
|
|
@@ -13902,28 +14102,38 @@ function createVendorOnboardHandlers(config) {
|
|
|
13902
14102
|
select: [
|
|
13903
14103
|
"id",
|
|
13904
14104
|
"name",
|
|
13905
|
-
"isOwnerRole"
|
|
14105
|
+
"isOwnerRole",
|
|
14106
|
+
"isSystem"
|
|
13906
14107
|
]
|
|
13907
14108
|
});
|
|
13908
14109
|
roles = roleRows.map((r) => ({
|
|
13909
14110
|
id: r.id,
|
|
13910
14111
|
name: r.name,
|
|
13911
|
-
isOwnerRole: r.isOwnerRole
|
|
14112
|
+
isOwnerRole: r.isOwnerRole,
|
|
14113
|
+
isSystem: r.isSystem === true
|
|
13912
14114
|
}));
|
|
13913
14115
|
}
|
|
13914
14116
|
const members = links.map((l) => {
|
|
13915
14117
|
const u = userById.get(l.userId);
|
|
13916
14118
|
const vr = l.vendorRole;
|
|
14119
|
+
const vp = l.vendorUserProfile;
|
|
13917
14120
|
return {
|
|
13918
14121
|
vendorUserId: l.id,
|
|
13919
14122
|
userId: l.userId,
|
|
13920
|
-
role: l.role,
|
|
13921
14123
|
vendorRoleId: l.vendorRoleId ?? null,
|
|
13922
14124
|
vendorRoleName: vr?.name ?? null,
|
|
13923
|
-
isOwnerRole: vr?.isOwnerRole
|
|
14125
|
+
isOwnerRole: vr?.isOwnerRole === true,
|
|
14126
|
+
vendorUserProfileId: l.vendorUserProfileId ?? null,
|
|
13924
14127
|
name: u?.name ?? null,
|
|
13925
14128
|
email: u?.email ?? null,
|
|
13926
|
-
phone: u?.phone ?? null,
|
|
14129
|
+
phone: vp?.phone ?? u?.phone ?? null,
|
|
14130
|
+
aadhaarNo: vp?.aadhaarNo ?? null,
|
|
14131
|
+
panNo: vp?.panNo ?? null,
|
|
14132
|
+
addressLine1: vp?.addressLine1 ?? null,
|
|
14133
|
+
addressLine2: vp?.addressLine2 ?? null,
|
|
14134
|
+
city: vp?.city ?? null,
|
|
14135
|
+
state: vp?.state ?? null,
|
|
14136
|
+
postalCode: vp?.postalCode ?? null,
|
|
13927
14137
|
blocked: u?.blocked ?? false,
|
|
13928
14138
|
groupName: u?.group?.name ?? null
|
|
13929
14139
|
};
|
|
@@ -13934,7 +14144,7 @@ function createVendorOnboardHandlers(config) {
|
|
|
13934
14144
|
roles
|
|
13935
14145
|
});
|
|
13936
14146
|
},
|
|
13937
|
-
/** POST /api/admin/vendor/team —
|
|
14147
|
+
/** POST /api/admin/vendor/team — invite staff (set-password for new; accept-only for existing vendor people) */
|
|
13938
14148
|
async addTeamMember(req) {
|
|
13939
14149
|
const gated = await gateVendorTeam();
|
|
13940
14150
|
if (gated instanceof Response) return gated;
|
|
@@ -13946,8 +14156,16 @@ function createVendorOnboardHandlers(config) {
|
|
|
13946
14156
|
status: 500
|
|
13947
14157
|
});
|
|
13948
14158
|
}
|
|
14159
|
+
if (!entityMap.vendor_user_profiles) {
|
|
14160
|
+
return json({
|
|
14161
|
+
error: "vendor_user_profiles not configured. Run migrations."
|
|
14162
|
+
}, {
|
|
14163
|
+
status: 500
|
|
14164
|
+
});
|
|
14165
|
+
}
|
|
13949
14166
|
try {
|
|
13950
14167
|
const body = await req.json();
|
|
14168
|
+
const sendEmail = body.sendEmail === true;
|
|
13951
14169
|
const userName = body.name?.trim();
|
|
13952
14170
|
const userEmail = body.email?.trim().toLowerCase();
|
|
13953
14171
|
if (!userName || !userEmail) {
|
|
@@ -13957,35 +14175,149 @@ function createVendorOnboardHandlers(config) {
|
|
|
13957
14175
|
status: 400
|
|
13958
14176
|
});
|
|
13959
14177
|
}
|
|
13960
|
-
|
|
13961
|
-
|
|
13962
|
-
|
|
13963
|
-
if (activation === "password") {
|
|
13964
|
-
const plain = body.user?.password?.trim();
|
|
13965
|
-
if (!plain) return json({
|
|
13966
|
-
error: "Password is required"
|
|
14178
|
+
if (body.activation === "password" || body.user?.password) {
|
|
14179
|
+
return json({
|
|
14180
|
+
error: "Setting a password for team members is not supported. Invite by email or copy the invite link."
|
|
13967
14181
|
}, {
|
|
13968
14182
|
status: 400
|
|
13969
14183
|
});
|
|
13970
|
-
|
|
13971
|
-
|
|
13972
|
-
|
|
13973
|
-
|
|
13974
|
-
|
|
14184
|
+
}
|
|
14185
|
+
const person = parseVendorPersonProfileFromBody(body, {
|
|
14186
|
+
name: userName,
|
|
14187
|
+
email: userEmail,
|
|
14188
|
+
phone: body.phone
|
|
14189
|
+
});
|
|
14190
|
+
const vendorRow = await dataSource.getRepository(entityMap.vendors).findOne({
|
|
14191
|
+
where: {
|
|
14192
|
+
id: vendorId,
|
|
14193
|
+
deleted: false
|
|
14194
|
+
}
|
|
14195
|
+
});
|
|
14196
|
+
const vendorName = String(vendorRow?.name ?? "Vendor store");
|
|
14197
|
+
const vendorSlug = String(vendorRow?.slug ?? "");
|
|
14198
|
+
const profileRepo = dataSource.getRepository(entityMap.vendor_user_profiles);
|
|
14199
|
+
const existingProfile = await profileRepo.createQueryBuilder("p").where("LOWER(p.email) = :email", {
|
|
14200
|
+
email: userEmail
|
|
14201
|
+
}).orderBy("p.id", "ASC").getOne();
|
|
14202
|
+
const existingUser = await dataSource.getRepository(entityMap.users).findOne({
|
|
14203
|
+
where: {
|
|
14204
|
+
email: userEmail
|
|
14205
|
+
},
|
|
14206
|
+
select: [
|
|
14207
|
+
"id",
|
|
14208
|
+
"email",
|
|
14209
|
+
"name",
|
|
14210
|
+
"password",
|
|
14211
|
+
"inviteStatus",
|
|
14212
|
+
"blocked",
|
|
14213
|
+
"deleted"
|
|
14214
|
+
]
|
|
14215
|
+
});
|
|
14216
|
+
const isExistingVendorPerson = !!existingProfile && !!existingUser && !existingUser.deleted && userHasActiveLogin(existingUser);
|
|
14217
|
+
if (isExistingVendorPerson) {
|
|
14218
|
+
const membershipToken = newUserInviteToken();
|
|
14219
|
+
const invitee = await dataSource.transaction(async (em) => {
|
|
14220
|
+
const vuRepo = em.getRepository(entityMap.vendor_users);
|
|
14221
|
+
const vendorRepo = em.getRepository(entityMap.vendors);
|
|
14222
|
+
await ensureVendorRolesForVendor(em, vendorId);
|
|
14223
|
+
let staffRoleId = body.vendorRoleId;
|
|
14224
|
+
if (staffRoleId != null && entityMap.vendor_roles) {
|
|
14225
|
+
const roleRow = await em.getRepository(entityMap.vendor_roles).findOne({
|
|
14226
|
+
where: {
|
|
14227
|
+
id: staffRoleId,
|
|
14228
|
+
vendorId,
|
|
14229
|
+
deleted: false
|
|
14230
|
+
}
|
|
14231
|
+
});
|
|
14232
|
+
if (!roleRow) throw new Error("INVALID_VENDOR_ROLE");
|
|
14233
|
+
if (roleRow.isOwnerRole) throw new Error("CANNOT_ASSIGN_OWNER_ROLE");
|
|
14234
|
+
} else {
|
|
14235
|
+
staffRoleId = await getDefaultStaffRoleIdForVendor(em, vendorId) ?? void 0;
|
|
14236
|
+
}
|
|
14237
|
+
if (staffRoleId == null) throw new Error("INVALID_VENDOR_ROLE");
|
|
14238
|
+
const link = await vuRepo.findOne({
|
|
14239
|
+
where: {
|
|
14240
|
+
vendorId,
|
|
14241
|
+
userId: existingUser.id
|
|
14242
|
+
}
|
|
14243
|
+
});
|
|
14244
|
+
if (link) throw new Error("USER_ALREADY_ON_TEAM");
|
|
14245
|
+
const priorLink = await vuRepo.findOne({
|
|
14246
|
+
where: {
|
|
14247
|
+
userId: existingUser.id
|
|
14248
|
+
},
|
|
14249
|
+
order: {
|
|
14250
|
+
id: "ASC"
|
|
14251
|
+
}
|
|
14252
|
+
});
|
|
14253
|
+
const vendorUserProfileId = priorLink?.vendorUserProfileId ?? existingProfile.id;
|
|
14254
|
+
const vendorFresh = await vendorRepo.findOne({
|
|
14255
|
+
where: {
|
|
14256
|
+
id: vendorId,
|
|
14257
|
+
deleted: false
|
|
14258
|
+
}
|
|
14259
|
+
});
|
|
14260
|
+
if (!vendorFresh) throw new Error("VENDOR_NOT_FOUND");
|
|
14261
|
+
const pending = {
|
|
14262
|
+
token: membershipToken,
|
|
14263
|
+
userId: existingUser.id,
|
|
14264
|
+
email: userEmail,
|
|
14265
|
+
vendorRoleId: staffRoleId,
|
|
14266
|
+
vendorUserProfileId,
|
|
14267
|
+
name: userName || String(existingUser.name ?? ""),
|
|
14268
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
14269
|
+
};
|
|
14270
|
+
const nextMeta = upsertPendingTeamInviteInMetadata(vendorFresh.metadata, userEmail, pending);
|
|
14271
|
+
await vendorRepo.update(vendorId, {
|
|
14272
|
+
metadata: nextMeta,
|
|
14273
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
14274
|
+
});
|
|
14275
|
+
return existingUser;
|
|
14276
|
+
});
|
|
14277
|
+
const inviteLink2 = buildTeamMembershipInviteLink(baseUrl, membershipToken, vendorId);
|
|
14278
|
+
let emailSent2 = false;
|
|
14279
|
+
if (sendEmail) {
|
|
14280
|
+
emailSent2 = await trySendVendorOnboardEmails({
|
|
14281
|
+
vendorName,
|
|
14282
|
+
vendorSlug,
|
|
14283
|
+
ownerName: userName,
|
|
14284
|
+
ownerEmail: userEmail,
|
|
14285
|
+
activation: "membership",
|
|
14286
|
+
inviteLink: inviteLink2,
|
|
14287
|
+
kind: "team_invite",
|
|
14288
|
+
sendToOwner: true
|
|
13975
14289
|
});
|
|
13976
14290
|
}
|
|
13977
|
-
|
|
13978
|
-
|
|
14291
|
+
return json({
|
|
14292
|
+
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.",
|
|
14293
|
+
activation: "membership",
|
|
14294
|
+
emailSent: emailSent2,
|
|
14295
|
+
inviteLink: inviteLink2,
|
|
14296
|
+
user: {
|
|
14297
|
+
id: invitee.id,
|
|
14298
|
+
name: invitee.name,
|
|
14299
|
+
email: invitee.email
|
|
14300
|
+
}
|
|
13979
14301
|
}, {
|
|
13980
|
-
status:
|
|
14302
|
+
status: 201
|
|
13981
14303
|
});
|
|
13982
|
-
ownerPasswordHash = await hashPassword(plain);
|
|
13983
14304
|
}
|
|
14305
|
+
const personErr = validatePersonKyc(person, {
|
|
14306
|
+
required: true
|
|
14307
|
+
});
|
|
14308
|
+
if (personErr) return json({
|
|
14309
|
+
error: personErr
|
|
14310
|
+
}, {
|
|
14311
|
+
status: 400
|
|
14312
|
+
});
|
|
14313
|
+
const activation = "invite";
|
|
13984
14314
|
const staffGroupId = actor.groupId;
|
|
14315
|
+
const inviteToken = newUserInviteToken();
|
|
13985
14316
|
const result = await dataSource.transaction(async (em) => {
|
|
13986
14317
|
const userRepo = em.getRepository(entityMap.users);
|
|
13987
14318
|
const vuRepo = em.getRepository(entityMap.vendor_users);
|
|
13988
14319
|
const groupRepo = em.getRepository(entityMap.user_groups);
|
|
14320
|
+
const profileRepoTx = em.getRepository(entityMap.vendor_user_profiles);
|
|
13989
14321
|
await ensureVendorRolesForVendor(em, vendorId);
|
|
13990
14322
|
let staffRoleId = body.vendorRoleId;
|
|
13991
14323
|
if (staffRoleId != null && entityMap.vendor_roles) {
|
|
@@ -14001,81 +14333,90 @@ function createVendorOnboardHandlers(config) {
|
|
|
14001
14333
|
} else {
|
|
14002
14334
|
staffRoleId = await getDefaultStaffRoleIdForVendor(em, vendorId) ?? void 0;
|
|
14003
14335
|
}
|
|
14336
|
+
if (staffRoleId == null) throw new Error("INVALID_VENDOR_ROLE");
|
|
14004
14337
|
let groupId = staffGroupId ?? null;
|
|
14005
14338
|
if (!groupId) {
|
|
14006
14339
|
const g = await groupRepo.findOne({
|
|
14007
14340
|
where: {
|
|
14008
|
-
name:
|
|
14341
|
+
name: chunk77NUXO6A_cjs.VENDOR_GROUP_NAME,
|
|
14342
|
+
deleted: false
|
|
14343
|
+
}
|
|
14344
|
+
}) ?? await groupRepo.findOne({
|
|
14345
|
+
where: {
|
|
14346
|
+
name: "Vendor Owner",
|
|
14009
14347
|
deleted: false
|
|
14010
14348
|
}
|
|
14011
14349
|
});
|
|
14012
14350
|
groupId = g?.id ?? null;
|
|
14013
14351
|
}
|
|
14014
14352
|
if (!groupId) throw new Error("VENDOR_OWNER_GROUP_MISSING");
|
|
14015
|
-
const
|
|
14353
|
+
const existing = await userRepo.findOne({
|
|
14016
14354
|
where: {
|
|
14017
14355
|
email: userEmail
|
|
14018
14356
|
}
|
|
14019
14357
|
});
|
|
14020
|
-
if (
|
|
14358
|
+
if (existing && !existing.deleted) {
|
|
14021
14359
|
const link = await vuRepo.findOne({
|
|
14022
14360
|
where: {
|
|
14023
14361
|
vendorId,
|
|
14024
|
-
userId:
|
|
14362
|
+
userId: existing.id
|
|
14025
14363
|
}
|
|
14026
14364
|
});
|
|
14027
14365
|
if (link) throw new Error("USER_ALREADY_ON_TEAM");
|
|
14028
14366
|
}
|
|
14029
|
-
let newUser =
|
|
14030
|
-
|
|
14031
|
-
|
|
14367
|
+
let newUser = existing;
|
|
14368
|
+
const inviteUserFields = {
|
|
14369
|
+
name: userName,
|
|
14370
|
+
email: userEmail,
|
|
14371
|
+
phone: person.phone,
|
|
14372
|
+
password: null,
|
|
14373
|
+
blocked: true,
|
|
14374
|
+
inviteStatus: "pending",
|
|
14375
|
+
inviteToken,
|
|
14376
|
+
groupId,
|
|
14377
|
+
adminAccess: true
|
|
14378
|
+
};
|
|
14379
|
+
if (existing?.deleted) {
|
|
14380
|
+
await userRepo.update(existing.id, {
|
|
14032
14381
|
deleted: false,
|
|
14033
14382
|
deletedAt: null,
|
|
14034
14383
|
deletedBy: null,
|
|
14035
|
-
|
|
14036
|
-
email: userEmail,
|
|
14037
|
-
password: ownerPasswordHash,
|
|
14038
|
-
blocked: activation === "invite",
|
|
14039
|
-
groupId,
|
|
14040
|
-
adminAccess: true,
|
|
14384
|
+
...inviteUserFields,
|
|
14041
14385
|
updatedAt: /* @__PURE__ */ new Date()
|
|
14042
14386
|
});
|
|
14043
14387
|
newUser = await userRepo.findOne({
|
|
14044
14388
|
where: {
|
|
14045
|
-
id:
|
|
14389
|
+
id: existing.id
|
|
14046
14390
|
}
|
|
14047
14391
|
});
|
|
14048
14392
|
if (!newUser) throw new Error("user missing after restore");
|
|
14049
|
-
} else if (
|
|
14050
|
-
await userRepo.update(
|
|
14051
|
-
|
|
14052
|
-
|
|
14053
|
-
adminAccess: true,
|
|
14054
|
-
...ownerPasswordHash ? {
|
|
14055
|
-
password: ownerPasswordHash,
|
|
14056
|
-
blocked: false
|
|
14057
|
-
} : activation === "invite" ? {
|
|
14058
|
-
password: null,
|
|
14059
|
-
blocked: true
|
|
14060
|
-
} : {}
|
|
14393
|
+
} else if (existing && !existing.deleted) {
|
|
14394
|
+
await userRepo.update(existing.id, {
|
|
14395
|
+
...inviteUserFields,
|
|
14396
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
14061
14397
|
});
|
|
14062
14398
|
newUser = await userRepo.findOne({
|
|
14063
14399
|
where: {
|
|
14064
|
-
id:
|
|
14400
|
+
id: existing.id
|
|
14065
14401
|
}
|
|
14066
14402
|
});
|
|
14067
14403
|
if (!newUser) throw new Error("user missing after update");
|
|
14068
|
-
} else if (!
|
|
14069
|
-
newUser = await userRepo.save(userRepo.create(
|
|
14070
|
-
name: userName,
|
|
14071
|
-
email: userEmail,
|
|
14072
|
-
password: ownerPasswordHash,
|
|
14073
|
-
blocked: activation === "invite",
|
|
14074
|
-
groupId,
|
|
14075
|
-
adminAccess: true
|
|
14076
|
-
}));
|
|
14404
|
+
} else if (!existing) {
|
|
14405
|
+
newUser = await userRepo.save(userRepo.create(inviteUserFields));
|
|
14077
14406
|
}
|
|
14078
14407
|
if (!newUser) throw new Error("user missing");
|
|
14408
|
+
const personRow = await profileRepoTx.save(profileRepoTx.create({
|
|
14409
|
+
name: person.name || userName,
|
|
14410
|
+
email: person.email || userEmail,
|
|
14411
|
+
phone: person.phone,
|
|
14412
|
+
aadhaarNo: person.aadhaarNo,
|
|
14413
|
+
panNo: person.panNo,
|
|
14414
|
+
addressLine1: person.addressLine1,
|
|
14415
|
+
addressLine2: person.addressLine2,
|
|
14416
|
+
city: person.city,
|
|
14417
|
+
state: person.state,
|
|
14418
|
+
postalCode: person.postalCode
|
|
14419
|
+
}));
|
|
14079
14420
|
const existingLink = await vuRepo.findOne({
|
|
14080
14421
|
where: {
|
|
14081
14422
|
vendorId,
|
|
@@ -14086,40 +14427,32 @@ function createVendorOnboardHandlers(config) {
|
|
|
14086
14427
|
await vuRepo.save(vuRepo.create({
|
|
14087
14428
|
vendorId,
|
|
14088
14429
|
userId: newUser.id,
|
|
14089
|
-
|
|
14090
|
-
|
|
14430
|
+
vendorRoleId: staffRoleId,
|
|
14431
|
+
vendorUserProfileId: personRow.id
|
|
14091
14432
|
}));
|
|
14092
|
-
} else
|
|
14433
|
+
} else {
|
|
14093
14434
|
await vuRepo.update(existingLink.id, {
|
|
14094
14435
|
vendorRoleId: staffRoleId,
|
|
14095
|
-
|
|
14436
|
+
vendorUserProfileId: personRow.id
|
|
14096
14437
|
});
|
|
14097
14438
|
}
|
|
14098
14439
|
if (entityMap.customer) {
|
|
14099
|
-
|
|
14100
|
-
|
|
14101
|
-
|
|
14102
|
-
|
|
14103
|
-
|
|
14104
|
-
|
|
14440
|
+
try {
|
|
14441
|
+
await ensureCustomerForUser(em, entityMap.customer, {
|
|
14442
|
+
id: newUser.id,
|
|
14443
|
+
name: userName,
|
|
14444
|
+
email: userEmail,
|
|
14445
|
+
phone: person.phone
|
|
14446
|
+
});
|
|
14447
|
+
} catch (customerErr) {
|
|
14448
|
+
console.error("[vendor-team] ensureCustomerForUser skipped", customerErr);
|
|
14449
|
+
}
|
|
14105
14450
|
}
|
|
14106
14451
|
return newUser;
|
|
14107
14452
|
});
|
|
14108
|
-
const
|
|
14109
|
-
where: {
|
|
14110
|
-
id: vendorId,
|
|
14111
|
-
deleted: false
|
|
14112
|
-
}
|
|
14113
|
-
});
|
|
14114
|
-
const vendorName = String(vendorRow?.name ?? "Vendor store");
|
|
14115
|
-
const vendorSlug = String(vendorRow?.slug ?? "");
|
|
14116
|
-
let inviteLink;
|
|
14453
|
+
const inviteLink = buildUserInviteLink(baseUrl, inviteToken);
|
|
14117
14454
|
let emailSent = false;
|
|
14118
|
-
if (
|
|
14119
|
-
const emailToken = Buffer.from(result.email).toString("base64");
|
|
14120
|
-
inviteLink = `${baseUrl}/admin/invite?token=${emailToken}`;
|
|
14121
|
-
}
|
|
14122
|
-
if (sendOwnerEmail || getCms) {
|
|
14455
|
+
if (sendEmail) {
|
|
14123
14456
|
emailSent = await trySendVendorOnboardEmails({
|
|
14124
14457
|
vendorName,
|
|
14125
14458
|
vendorSlug,
|
|
@@ -14128,18 +14461,19 @@ function createVendorOnboardHandlers(config) {
|
|
|
14128
14461
|
activation,
|
|
14129
14462
|
inviteLink,
|
|
14130
14463
|
kind: "team_invite",
|
|
14131
|
-
sendToOwner:
|
|
14464
|
+
sendToOwner: true
|
|
14132
14465
|
});
|
|
14133
14466
|
}
|
|
14134
14467
|
return json({
|
|
14135
|
-
message: emailSent ? "Team member
|
|
14468
|
+
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.",
|
|
14469
|
+
activation,
|
|
14136
14470
|
emailSent,
|
|
14471
|
+
inviteLink,
|
|
14137
14472
|
user: {
|
|
14138
14473
|
id: result.id,
|
|
14139
14474
|
name: result.name,
|
|
14140
14475
|
email: result.email
|
|
14141
|
-
}
|
|
14142
|
-
inviteLink
|
|
14476
|
+
}
|
|
14143
14477
|
}, {
|
|
14144
14478
|
status: 201
|
|
14145
14479
|
});
|
|
@@ -14152,9 +14486,16 @@ function createVendorOnboardHandlers(config) {
|
|
|
14152
14486
|
status: 400
|
|
14153
14487
|
});
|
|
14154
14488
|
}
|
|
14489
|
+
if (msg === "VENDOR_NOT_FOUND") {
|
|
14490
|
+
return json({
|
|
14491
|
+
error: "Vendor not found"
|
|
14492
|
+
}, {
|
|
14493
|
+
status: 404
|
|
14494
|
+
});
|
|
14495
|
+
}
|
|
14155
14496
|
if (msg === "VENDOR_OWNER_GROUP_MISSING") {
|
|
14156
14497
|
return json({
|
|
14157
|
-
error: "Vendor
|
|
14498
|
+
error: "Vendor group not found. Run migrations."
|
|
14158
14499
|
}, {
|
|
14159
14500
|
status: 500
|
|
14160
14501
|
});
|
|
@@ -14173,11 +14514,327 @@ function createVendorOnboardHandlers(config) {
|
|
|
14173
14514
|
status: 400
|
|
14174
14515
|
});
|
|
14175
14516
|
}
|
|
14176
|
-
return json
|
|
14177
|
-
|
|
14178
|
-
|
|
14179
|
-
|
|
14180
|
-
|
|
14517
|
+
return vendorOnboardErrorResponse(json, e);
|
|
14518
|
+
}
|
|
14519
|
+
},
|
|
14520
|
+
/** POST /api/admin/vendor/team/send-invite — send invite email for a pending team member */
|
|
14521
|
+
async sendTeamInviteEmail(req) {
|
|
14522
|
+
const gated = await gateVendorTeam();
|
|
14523
|
+
if (gated instanceof Response) return gated;
|
|
14524
|
+
const { vendorId } = gated;
|
|
14525
|
+
if (!entityMap.vendors || !entityMap.users) {
|
|
14526
|
+
return json({
|
|
14527
|
+
error: "Vendor entities not configured"
|
|
14528
|
+
}, {
|
|
14529
|
+
status: 500
|
|
14530
|
+
});
|
|
14531
|
+
}
|
|
14532
|
+
try {
|
|
14533
|
+
const body = await req.json().catch(() => ({}));
|
|
14534
|
+
const userId = Number(body.userId);
|
|
14535
|
+
if (!Number.isFinite(userId) || userId <= 0) {
|
|
14536
|
+
return json({
|
|
14537
|
+
error: "userId is required"
|
|
14538
|
+
}, {
|
|
14539
|
+
status: 400
|
|
14540
|
+
});
|
|
14541
|
+
}
|
|
14542
|
+
const vendorRow = await dataSource.getRepository(entityMap.vendors).findOne({
|
|
14543
|
+
where: {
|
|
14544
|
+
id: vendorId,
|
|
14545
|
+
deleted: false
|
|
14546
|
+
}
|
|
14547
|
+
});
|
|
14548
|
+
if (!vendorRow) return json({
|
|
14549
|
+
error: "Vendor not found"
|
|
14550
|
+
}, {
|
|
14551
|
+
status: 404
|
|
14552
|
+
});
|
|
14553
|
+
const vendorName = String(vendorRow.name ?? "Vendor store");
|
|
14554
|
+
const vendorSlug = String(vendorRow.slug ?? "");
|
|
14555
|
+
const meta = vendorRow.metadata;
|
|
14556
|
+
const pending = findPendingTeamInviteByUserId(meta, userId);
|
|
14557
|
+
if (pending) {
|
|
14558
|
+
const inviteLink2 = buildTeamMembershipInviteLink(baseUrl, pending.token, vendorId);
|
|
14559
|
+
const emailSent2 = await trySendVendorOnboardEmails({
|
|
14560
|
+
vendorName,
|
|
14561
|
+
vendorSlug,
|
|
14562
|
+
ownerName: pending.name,
|
|
14563
|
+
ownerEmail: pending.email,
|
|
14564
|
+
activation: "membership",
|
|
14565
|
+
inviteLink: inviteLink2,
|
|
14566
|
+
kind: "team_invite",
|
|
14567
|
+
sendToOwner: true
|
|
14568
|
+
});
|
|
14569
|
+
return json({
|
|
14570
|
+
message: emailSent2 ? "Invite email sent" : "Invite email may not have been sent",
|
|
14571
|
+
emailSent: emailSent2,
|
|
14572
|
+
inviteLink: inviteLink2,
|
|
14573
|
+
activation: "membership"
|
|
14574
|
+
});
|
|
14575
|
+
}
|
|
14576
|
+
const user = await dataSource.getRepository(entityMap.users).findOne({
|
|
14577
|
+
where: {
|
|
14578
|
+
id: userId,
|
|
14579
|
+
deleted: false
|
|
14580
|
+
},
|
|
14581
|
+
select: [
|
|
14582
|
+
"id",
|
|
14583
|
+
"name",
|
|
14584
|
+
"email",
|
|
14585
|
+
"inviteToken",
|
|
14586
|
+
"inviteStatus",
|
|
14587
|
+
"password",
|
|
14588
|
+
"blocked"
|
|
14589
|
+
]
|
|
14590
|
+
});
|
|
14591
|
+
if (!user) return json({
|
|
14592
|
+
error: "User not found"
|
|
14593
|
+
}, {
|
|
14594
|
+
status: 404
|
|
14595
|
+
});
|
|
14596
|
+
if (entityMap.vendor_users) {
|
|
14597
|
+
const link = await dataSource.getRepository(entityMap.vendor_users).findOne({
|
|
14598
|
+
where: {
|
|
14599
|
+
vendorId,
|
|
14600
|
+
userId
|
|
14601
|
+
}
|
|
14602
|
+
});
|
|
14603
|
+
if (!link) {
|
|
14604
|
+
return json({
|
|
14605
|
+
error: "User is not on this vendor team"
|
|
14606
|
+
}, {
|
|
14607
|
+
status: 400
|
|
14608
|
+
});
|
|
14609
|
+
}
|
|
14610
|
+
}
|
|
14611
|
+
const token = String(user.inviteToken ?? "").trim();
|
|
14612
|
+
if (!token || user.inviteStatus !== "pending") {
|
|
14613
|
+
return json({
|
|
14614
|
+
error: "No pending invite for this user"
|
|
14615
|
+
}, {
|
|
14616
|
+
status: 400
|
|
14617
|
+
});
|
|
14618
|
+
}
|
|
14619
|
+
const inviteLink = buildUserInviteLink(baseUrl, token);
|
|
14620
|
+
const emailSent = await trySendVendorOnboardEmails({
|
|
14621
|
+
vendorName,
|
|
14622
|
+
vendorSlug,
|
|
14623
|
+
ownerName: String(user.name ?? ""),
|
|
14624
|
+
ownerEmail: String(user.email ?? ""),
|
|
14625
|
+
activation: "invite",
|
|
14626
|
+
inviteLink,
|
|
14627
|
+
kind: "team_invite",
|
|
14628
|
+
sendToOwner: true
|
|
14629
|
+
});
|
|
14630
|
+
return json({
|
|
14631
|
+
message: emailSent ? "Invite email sent" : "Invite email may not have been sent",
|
|
14632
|
+
emailSent,
|
|
14633
|
+
inviteLink,
|
|
14634
|
+
activation: "invite"
|
|
14635
|
+
});
|
|
14636
|
+
} catch (e) {
|
|
14637
|
+
console.error("[vendor.team send-invite]", e);
|
|
14638
|
+
return json({
|
|
14639
|
+
error: "Server Error"
|
|
14640
|
+
}, {
|
|
14641
|
+
status: 500
|
|
14642
|
+
});
|
|
14643
|
+
}
|
|
14644
|
+
},
|
|
14645
|
+
/** GET /api/admin/vendor/team-invite?token=&vendorId= — preflight for membership accept (no password) */
|
|
14646
|
+
async validateTeamInvite(req) {
|
|
14647
|
+
if (!entityMap.vendors) {
|
|
14648
|
+
return json({
|
|
14649
|
+
valid: false,
|
|
14650
|
+
error: "Vendors not configured"
|
|
14651
|
+
}, {
|
|
14652
|
+
status: 500
|
|
14653
|
+
});
|
|
14654
|
+
}
|
|
14655
|
+
try {
|
|
14656
|
+
const url = new URL(req.url);
|
|
14657
|
+
const token = url.searchParams.get("token")?.trim() ?? "";
|
|
14658
|
+
const vendorId = Number(url.searchParams.get("vendorId"));
|
|
14659
|
+
if (!token) return json({
|
|
14660
|
+
valid: false,
|
|
14661
|
+
error: "Invalid invite link. Token is missing."
|
|
14662
|
+
}, {
|
|
14663
|
+
status: 400
|
|
14664
|
+
});
|
|
14665
|
+
if (!Number.isFinite(vendorId) || vendorId <= 0) {
|
|
14666
|
+
return json({
|
|
14667
|
+
valid: false,
|
|
14668
|
+
error: "Invalid invite link. Store is missing."
|
|
14669
|
+
}, {
|
|
14670
|
+
status: 400
|
|
14671
|
+
});
|
|
14672
|
+
}
|
|
14673
|
+
const vendor = await dataSource.getRepository(entityMap.vendors).findOne({
|
|
14674
|
+
where: {
|
|
14675
|
+
id: vendorId,
|
|
14676
|
+
deleted: false
|
|
14677
|
+
}
|
|
14678
|
+
});
|
|
14679
|
+
if (!vendor) {
|
|
14680
|
+
return json({
|
|
14681
|
+
valid: false,
|
|
14682
|
+
error: "This invitation is no longer valid."
|
|
14683
|
+
}, {
|
|
14684
|
+
status: 400
|
|
14685
|
+
});
|
|
14686
|
+
}
|
|
14687
|
+
const invite = findPendingTeamInviteByToken(vendor.metadata, token);
|
|
14688
|
+
if (!invite) {
|
|
14689
|
+
return json({
|
|
14690
|
+
valid: false,
|
|
14691
|
+
error: "This invitation is no longer valid."
|
|
14692
|
+
}, {
|
|
14693
|
+
status: 400
|
|
14694
|
+
});
|
|
14695
|
+
}
|
|
14696
|
+
return json({
|
|
14697
|
+
valid: true,
|
|
14698
|
+
mode: "team",
|
|
14699
|
+
vendorId,
|
|
14700
|
+
vendorName: vendor.name ?? "Vendor store",
|
|
14701
|
+
email: invite.email
|
|
14702
|
+
});
|
|
14703
|
+
} catch (e) {
|
|
14704
|
+
console.error("[vendor.team-invite GET]", e);
|
|
14705
|
+
return json({
|
|
14706
|
+
valid: false,
|
|
14707
|
+
error: "Server Error"
|
|
14708
|
+
}, {
|
|
14709
|
+
status: 500
|
|
14710
|
+
});
|
|
14711
|
+
}
|
|
14712
|
+
},
|
|
14713
|
+
/** POST /api/admin/vendor/team-invite — accept membership (token; no password) */
|
|
14714
|
+
async acceptTeamInvite(req) {
|
|
14715
|
+
if (!entityMap.vendors || !entityMap.vendor_users || !entityMap.vendor_user_profiles || !entityMap.users) {
|
|
14716
|
+
return json({
|
|
14717
|
+
error: "Vendor entities not configured"
|
|
14718
|
+
}, {
|
|
14719
|
+
status: 500
|
|
14720
|
+
});
|
|
14721
|
+
}
|
|
14722
|
+
try {
|
|
14723
|
+
const body = await req.json().catch(() => ({}));
|
|
14724
|
+
const token = typeof body.token === "string" ? body.token.trim() : "";
|
|
14725
|
+
const vendorId = Number(body.vendorId);
|
|
14726
|
+
if (!token) return json({
|
|
14727
|
+
error: "token is required"
|
|
14728
|
+
}, {
|
|
14729
|
+
status: 400
|
|
14730
|
+
});
|
|
14731
|
+
if (!Number.isFinite(vendorId) || vendorId <= 0) {
|
|
14732
|
+
return json({
|
|
14733
|
+
error: "vendorId is required"
|
|
14734
|
+
}, {
|
|
14735
|
+
status: 400
|
|
14736
|
+
});
|
|
14737
|
+
}
|
|
14738
|
+
const result = await dataSource.transaction(async (em) => {
|
|
14739
|
+
const vendorRepo = em.getRepository(entityMap.vendors);
|
|
14740
|
+
const vendor = await vendorRepo.findOne({
|
|
14741
|
+
where: {
|
|
14742
|
+
id: vendorId,
|
|
14743
|
+
deleted: false
|
|
14744
|
+
}
|
|
14745
|
+
});
|
|
14746
|
+
if (!vendor) throw new Error("INVITE_INVALID");
|
|
14747
|
+
const meta = vendor.metadata;
|
|
14748
|
+
const inv = findPendingTeamInviteByToken(meta, token);
|
|
14749
|
+
if (!inv) throw new Error("INVITE_INVALID");
|
|
14750
|
+
const user = await em.getRepository(entityMap.users).findOne({
|
|
14751
|
+
where: {
|
|
14752
|
+
id: inv.userId,
|
|
14753
|
+
deleted: false
|
|
14754
|
+
}
|
|
14755
|
+
});
|
|
14756
|
+
if (!user || !userHasActiveLogin(user)) {
|
|
14757
|
+
throw new Error("INVITE_USER_INACTIVE");
|
|
14758
|
+
}
|
|
14759
|
+
const vuRepo = em.getRepository(entityMap.vendor_users);
|
|
14760
|
+
const existingLink = await vuRepo.findOne({
|
|
14761
|
+
where: {
|
|
14762
|
+
vendorId,
|
|
14763
|
+
userId: inv.userId
|
|
14764
|
+
}
|
|
14765
|
+
});
|
|
14766
|
+
if (existingLink) {
|
|
14767
|
+
await vendorRepo.update(vendorId, {
|
|
14768
|
+
metadata: removePendingTeamInviteTokenFromMetadata(meta, token),
|
|
14769
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
14770
|
+
});
|
|
14771
|
+
return {
|
|
14772
|
+
alreadyMember: true,
|
|
14773
|
+
vendorId
|
|
14774
|
+
};
|
|
14775
|
+
}
|
|
14776
|
+
if (entityMap.vendor_roles) {
|
|
14777
|
+
const roleRow = await em.getRepository(entityMap.vendor_roles).findOne({
|
|
14778
|
+
where: {
|
|
14779
|
+
id: inv.vendorRoleId,
|
|
14780
|
+
vendorId,
|
|
14781
|
+
deleted: false
|
|
14782
|
+
}
|
|
14783
|
+
});
|
|
14784
|
+
if (!roleRow || roleRow.isOwnerRole) {
|
|
14785
|
+
throw new Error("INVALID_VENDOR_ROLE");
|
|
14786
|
+
}
|
|
14787
|
+
}
|
|
14788
|
+
const profile = await em.getRepository(entityMap.vendor_user_profiles).findOne({
|
|
14789
|
+
where: {
|
|
14790
|
+
id: inv.vendorUserProfileId
|
|
14791
|
+
}
|
|
14792
|
+
});
|
|
14793
|
+
if (!profile) throw new Error("INVITE_INVALID");
|
|
14794
|
+
await vuRepo.save(vuRepo.create({
|
|
14795
|
+
vendorId,
|
|
14796
|
+
userId: inv.userId,
|
|
14797
|
+
vendorRoleId: inv.vendorRoleId,
|
|
14798
|
+
vendorUserProfileId: inv.vendorUserProfileId
|
|
14799
|
+
}));
|
|
14800
|
+
await vendorRepo.update(vendorId, {
|
|
14801
|
+
metadata: removePendingTeamInviteTokenFromMetadata(meta, token),
|
|
14802
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
14803
|
+
});
|
|
14804
|
+
return {
|
|
14805
|
+
alreadyMember: false,
|
|
14806
|
+
vendorId
|
|
14807
|
+
};
|
|
14808
|
+
});
|
|
14809
|
+
return json({
|
|
14810
|
+
success: true,
|
|
14811
|
+
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.",
|
|
14812
|
+
vendorId: result.vendorId
|
|
14813
|
+
});
|
|
14814
|
+
} catch (e) {
|
|
14815
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
14816
|
+
if (msg === "INVITE_INVALID") {
|
|
14817
|
+
return json({
|
|
14818
|
+
error: "This invitation is no longer valid."
|
|
14819
|
+
}, {
|
|
14820
|
+
status: 400
|
|
14821
|
+
});
|
|
14822
|
+
}
|
|
14823
|
+
if (msg === "INVITE_USER_INACTIVE") {
|
|
14824
|
+
return json({
|
|
14825
|
+
error: "Your account is not active. Complete account setup first, or contact support."
|
|
14826
|
+
}, {
|
|
14827
|
+
status: 400
|
|
14828
|
+
});
|
|
14829
|
+
}
|
|
14830
|
+
if (msg === "INVALID_VENDOR_ROLE") {
|
|
14831
|
+
return json({
|
|
14832
|
+
error: "Invalid store role on this invitation"
|
|
14833
|
+
}, {
|
|
14834
|
+
status: 400
|
|
14835
|
+
});
|
|
14836
|
+
}
|
|
14837
|
+
return vendorOnboardErrorResponse(json, e);
|
|
14181
14838
|
}
|
|
14182
14839
|
},
|
|
14183
14840
|
/** PATCH /api/admin/vendor/team/:userId — change member store role */
|
|
@@ -14232,14 +14889,18 @@ function createVendorOnboardHandlers(config) {
|
|
|
14232
14889
|
where: {
|
|
14233
14890
|
vendorId,
|
|
14234
14891
|
userId
|
|
14235
|
-
}
|
|
14892
|
+
},
|
|
14893
|
+
relations: entityMap.vendor_roles ? [
|
|
14894
|
+
"vendorRole"
|
|
14895
|
+
] : []
|
|
14236
14896
|
});
|
|
14237
14897
|
if (!link) return json({
|
|
14238
14898
|
error: "Not found"
|
|
14239
14899
|
}, {
|
|
14240
14900
|
status: 404
|
|
14241
14901
|
});
|
|
14242
|
-
|
|
14902
|
+
const linkIsOwner = link.vendorRole?.isOwnerRole === true;
|
|
14903
|
+
if (linkIsOwner) {
|
|
14243
14904
|
return json({
|
|
14244
14905
|
error: "Cannot change the store owner role here"
|
|
14245
14906
|
}, {
|
|
@@ -14247,8 +14908,7 @@ function createVendorOnboardHandlers(config) {
|
|
|
14247
14908
|
});
|
|
14248
14909
|
}
|
|
14249
14910
|
await vuRepo.update(link.id, {
|
|
14250
|
-
vendorRoleId
|
|
14251
|
-
role: "staff"
|
|
14911
|
+
vendorRoleId
|
|
14252
14912
|
});
|
|
14253
14913
|
return json({
|
|
14254
14914
|
ok: true,
|
|
@@ -14294,7 +14954,7 @@ function createVendorOnboardHandlers(config) {
|
|
|
14294
14954
|
}, {
|
|
14295
14955
|
status: 404
|
|
14296
14956
|
});
|
|
14297
|
-
const isOwner =
|
|
14957
|
+
const isOwner = !!link.vendorRole?.isOwnerRole;
|
|
14298
14958
|
if (isOwner && Number(actor.id) !== userId) {
|
|
14299
14959
|
return json({
|
|
14300
14960
|
error: "Cannot remove the store owner"
|
|
@@ -14315,10 +14975,10 @@ chunkUSNT2KNT_cjs.__name(createVendorOnboardHandlers, "createVendorOnboardHandle
|
|
|
14315
14975
|
function createVendorRolesHandlers(config) {
|
|
14316
14976
|
const { dataSource, entityMap, json, getSessionUser } = config;
|
|
14317
14977
|
const vendorRoleEntities = [
|
|
14318
|
-
...
|
|
14978
|
+
...chunk77NUXO6A_cjs.VENDOR_RBAC_ENTITIES
|
|
14319
14979
|
].sort();
|
|
14320
14980
|
async function resolveActiveVendorId(u) {
|
|
14321
|
-
const scope =
|
|
14981
|
+
const scope = chunk77NUXO6A_cjs.resolveVendorScopeFromSessionUser(u);
|
|
14322
14982
|
if (scope.type === "vendor") return scope.vendorId;
|
|
14323
14983
|
if (scope.type === "all") {
|
|
14324
14984
|
const id = u.activeVendorId ?? u.vendorIds?.[0];
|
|
@@ -14334,7 +14994,7 @@ function createVendorRolesHandlers(config) {
|
|
|
14334
14994
|
}, {
|
|
14335
14995
|
status: 401
|
|
14336
14996
|
});
|
|
14337
|
-
if (!
|
|
14997
|
+
if (!chunk77NUXO6A_cjs.canManageVendorRoles(u)) return json({
|
|
14338
14998
|
error: "Forbidden"
|
|
14339
14999
|
}, {
|
|
14340
15000
|
status: 403
|
|
@@ -14439,13 +15099,28 @@ function createVendorRolesHandlers(config) {
|
|
|
14439
15099
|
isSystem: false,
|
|
14440
15100
|
isOwnerRole: false
|
|
14441
15101
|
}));
|
|
15102
|
+
const permRepo = dataSource.getRepository(entityMap.vendor_role_permissions);
|
|
15103
|
+
await permRepo.save(vendorRoleEntities.map((entity) => permRepo.create({
|
|
15104
|
+
vendorRoleId: role.id,
|
|
15105
|
+
entity,
|
|
15106
|
+
canCreate: false,
|
|
15107
|
+
canRead: false,
|
|
15108
|
+
canUpdate: false,
|
|
15109
|
+
canDelete: false
|
|
15110
|
+
})));
|
|
14442
15111
|
return json({
|
|
14443
15112
|
id: role.id,
|
|
14444
15113
|
name: role.name,
|
|
14445
15114
|
description: role.description,
|
|
14446
15115
|
isSystem: role.isSystem,
|
|
14447
15116
|
isOwnerRole: role.isOwnerRole,
|
|
14448
|
-
permissions:
|
|
15117
|
+
permissions: vendorRoleEntities.map((entity) => ({
|
|
15118
|
+
entity,
|
|
15119
|
+
canCreate: false,
|
|
15120
|
+
canRead: false,
|
|
15121
|
+
canUpdate: false,
|
|
15122
|
+
canDelete: false
|
|
15123
|
+
}))
|
|
14449
15124
|
}, {
|
|
14450
15125
|
status: 201
|
|
14451
15126
|
});
|
|
@@ -14643,16 +15318,15 @@ function createVendorRolesHandlers(config) {
|
|
|
14643
15318
|
await em.getRepository(entityMap.vendor_role_permissions).delete({
|
|
14644
15319
|
vendorRoleId: id
|
|
14645
15320
|
});
|
|
14646
|
-
|
|
14647
|
-
|
|
14648
|
-
|
|
14649
|
-
|
|
14650
|
-
|
|
14651
|
-
|
|
14652
|
-
|
|
14653
|
-
|
|
14654
|
-
|
|
14655
|
-
}
|
|
15321
|
+
const permRepo = em.getRepository(entityMap.vendor_role_permissions);
|
|
15322
|
+
await permRepo.save(rows.map((r) => permRepo.create({
|
|
15323
|
+
vendorRoleId: id,
|
|
15324
|
+
entity: r.entity,
|
|
15325
|
+
canCreate: !!r.canCreate,
|
|
15326
|
+
canRead: !!r.canRead,
|
|
15327
|
+
canUpdate: !!r.canUpdate,
|
|
15328
|
+
canDelete: !!r.canDelete
|
|
15329
|
+
})));
|
|
14656
15330
|
});
|
|
14657
15331
|
const updated = await roleRepo.findOne({
|
|
14658
15332
|
where: {
|
|
@@ -14672,7 +15346,8 @@ function createVendorRolesHandlers(config) {
|
|
|
14672
15346
|
canDelete: p.canDelete
|
|
14673
15347
|
}))
|
|
14674
15348
|
});
|
|
14675
|
-
} catch {
|
|
15349
|
+
} catch (e) {
|
|
15350
|
+
console.error("[vendor-roles.putPermissions]", e);
|
|
14676
15351
|
return json({
|
|
14677
15352
|
error: "Server error"
|
|
14678
15353
|
}, {
|
|
@@ -16309,7 +16984,6 @@ exports.Vendor = class Vendor {
|
|
|
16309
16984
|
country;
|
|
16310
16985
|
postalCode;
|
|
16311
16986
|
gstin;
|
|
16312
|
-
pan;
|
|
16313
16987
|
logo;
|
|
16314
16988
|
description;
|
|
16315
16989
|
metadata;
|
|
@@ -16413,12 +17087,6 @@ _ts_decorate16([
|
|
|
16413
17087
|
}),
|
|
16414
17088
|
_ts_metadata16("design:type", Object)
|
|
16415
17089
|
], exports.Vendor.prototype, "gstin", void 0);
|
|
16416
|
-
_ts_decorate16([
|
|
16417
|
-
typeorm.Column("varchar", {
|
|
16418
|
-
nullable: true
|
|
16419
|
-
}),
|
|
16420
|
-
_ts_metadata16("design:type", Object)
|
|
16421
|
-
], exports.Vendor.prototype, "pan", void 0);
|
|
16422
17090
|
_ts_decorate16([
|
|
16423
17091
|
typeorm.Column("varchar", {
|
|
16424
17092
|
nullable: true
|
|
@@ -21734,8 +22402,6 @@ exports.VendorRole = _ts_decorate57([
|
|
|
21734
22402
|
"vendorId"
|
|
21735
22403
|
])
|
|
21736
22404
|
], exports.VendorRole);
|
|
21737
|
-
|
|
21738
|
-
// src/entities/vendor-user.entity.ts
|
|
21739
22405
|
function _ts_decorate58(decorators, target, key, desc) {
|
|
21740
22406
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
21741
22407
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -21747,89 +22413,201 @@ function _ts_metadata58(k, v) {
|
|
|
21747
22413
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
21748
22414
|
}
|
|
21749
22415
|
chunkUSNT2KNT_cjs.__name(_ts_metadata58, "_ts_metadata");
|
|
21750
|
-
exports.
|
|
22416
|
+
exports.VendorUserProfile = class VendorUserProfile {
|
|
21751
22417
|
static {
|
|
21752
|
-
chunkUSNT2KNT_cjs.__name(this, "
|
|
22418
|
+
chunkUSNT2KNT_cjs.__name(this, "VendorUserProfile");
|
|
21753
22419
|
}
|
|
21754
22420
|
id;
|
|
21755
|
-
|
|
21756
|
-
|
|
21757
|
-
|
|
21758
|
-
|
|
21759
|
-
|
|
22421
|
+
name;
|
|
22422
|
+
email;
|
|
22423
|
+
phone;
|
|
22424
|
+
aadhaarNo;
|
|
22425
|
+
panNo;
|
|
22426
|
+
addressLine1;
|
|
22427
|
+
addressLine2;
|
|
22428
|
+
city;
|
|
22429
|
+
state;
|
|
22430
|
+
postalCode;
|
|
21760
22431
|
createdAt;
|
|
21761
22432
|
updatedAt;
|
|
21762
|
-
vendor;
|
|
21763
|
-
user;
|
|
21764
|
-
vendorRole;
|
|
21765
22433
|
};
|
|
21766
22434
|
_ts_decorate58([
|
|
21767
22435
|
typeorm.PrimaryGeneratedColumn(),
|
|
21768
22436
|
_ts_metadata58("design:type", Number)
|
|
21769
|
-
], exports.
|
|
22437
|
+
], exports.VendorUserProfile.prototype, "id", void 0);
|
|
21770
22438
|
_ts_decorate58([
|
|
21771
|
-
typeorm.Column("
|
|
21772
|
-
_ts_metadata58("design:type",
|
|
21773
|
-
], exports.
|
|
22439
|
+
typeorm.Column("varchar"),
|
|
22440
|
+
_ts_metadata58("design:type", String)
|
|
22441
|
+
], exports.VendorUserProfile.prototype, "name", void 0);
|
|
21774
22442
|
_ts_decorate58([
|
|
21775
|
-
typeorm.Column("
|
|
21776
|
-
_ts_metadata58("design:type",
|
|
21777
|
-
], exports.
|
|
22443
|
+
typeorm.Column("varchar"),
|
|
22444
|
+
_ts_metadata58("design:type", String)
|
|
22445
|
+
], exports.VendorUserProfile.prototype, "email", void 0);
|
|
21778
22446
|
_ts_decorate58([
|
|
21779
22447
|
typeorm.Column("varchar", {
|
|
21780
|
-
|
|
22448
|
+
nullable: true
|
|
21781
22449
|
}),
|
|
21782
|
-
_ts_metadata58("design:type",
|
|
21783
|
-
], exports.
|
|
22450
|
+
_ts_metadata58("design:type", Object)
|
|
22451
|
+
], exports.VendorUserProfile.prototype, "phone", void 0);
|
|
21784
22452
|
_ts_decorate58([
|
|
21785
|
-
typeorm.Column("
|
|
22453
|
+
typeorm.Column("varchar", {
|
|
21786
22454
|
nullable: true
|
|
21787
22455
|
}),
|
|
21788
22456
|
_ts_metadata58("design:type", Object)
|
|
21789
|
-
], exports.
|
|
22457
|
+
], exports.VendorUserProfile.prototype, "aadhaarNo", void 0);
|
|
22458
|
+
_ts_decorate58([
|
|
22459
|
+
typeorm.Column("varchar", {
|
|
22460
|
+
nullable: true
|
|
22461
|
+
}),
|
|
22462
|
+
_ts_metadata58("design:type", Object)
|
|
22463
|
+
], exports.VendorUserProfile.prototype, "panNo", void 0);
|
|
22464
|
+
_ts_decorate58([
|
|
22465
|
+
typeorm.Column("varchar", {
|
|
22466
|
+
nullable: true
|
|
22467
|
+
}),
|
|
22468
|
+
_ts_metadata58("design:type", Object)
|
|
22469
|
+
], exports.VendorUserProfile.prototype, "addressLine1", void 0);
|
|
22470
|
+
_ts_decorate58([
|
|
22471
|
+
typeorm.Column("varchar", {
|
|
22472
|
+
nullable: true
|
|
22473
|
+
}),
|
|
22474
|
+
_ts_metadata58("design:type", Object)
|
|
22475
|
+
], exports.VendorUserProfile.prototype, "addressLine2", void 0);
|
|
22476
|
+
_ts_decorate58([
|
|
22477
|
+
typeorm.Column("varchar", {
|
|
22478
|
+
nullable: true
|
|
22479
|
+
}),
|
|
22480
|
+
_ts_metadata58("design:type", Object)
|
|
22481
|
+
], exports.VendorUserProfile.prototype, "city", void 0);
|
|
22482
|
+
_ts_decorate58([
|
|
22483
|
+
typeorm.Column("varchar", {
|
|
22484
|
+
nullable: true
|
|
22485
|
+
}),
|
|
22486
|
+
_ts_metadata58("design:type", Object)
|
|
22487
|
+
], exports.VendorUserProfile.prototype, "state", void 0);
|
|
22488
|
+
_ts_decorate58([
|
|
22489
|
+
typeorm.Column("varchar", {
|
|
22490
|
+
nullable: true
|
|
22491
|
+
}),
|
|
22492
|
+
_ts_metadata58("design:type", Object)
|
|
22493
|
+
], exports.VendorUserProfile.prototype, "postalCode", void 0);
|
|
21790
22494
|
_ts_decorate58([
|
|
21791
22495
|
typeorm.Column({
|
|
21792
22496
|
type: "timestamp",
|
|
21793
22497
|
default: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name(() => "CURRENT_TIMESTAMP", "default")
|
|
21794
22498
|
}),
|
|
21795
22499
|
_ts_metadata58("design:type", typeof Date === "undefined" ? Object : Date)
|
|
21796
|
-
], exports.
|
|
22500
|
+
], exports.VendorUserProfile.prototype, "createdAt", void 0);
|
|
21797
22501
|
_ts_decorate58([
|
|
21798
22502
|
typeorm.Column({
|
|
21799
22503
|
type: "timestamp",
|
|
21800
22504
|
default: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name(() => "CURRENT_TIMESTAMP", "default")
|
|
21801
22505
|
}),
|
|
21802
22506
|
_ts_metadata58("design:type", typeof Date === "undefined" ? Object : Date)
|
|
22507
|
+
], exports.VendorUserProfile.prototype, "updatedAt", void 0);
|
|
22508
|
+
exports.VendorUserProfile = _ts_decorate58([
|
|
22509
|
+
typeorm.Entity("vendor_user_profiles")
|
|
22510
|
+
], exports.VendorUserProfile);
|
|
22511
|
+
|
|
22512
|
+
// src/entities/vendor-user.entity.ts
|
|
22513
|
+
function _ts_decorate59(decorators, target, key, desc) {
|
|
22514
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
22515
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
22516
|
+
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;
|
|
22517
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22518
|
+
}
|
|
22519
|
+
chunkUSNT2KNT_cjs.__name(_ts_decorate59, "_ts_decorate");
|
|
22520
|
+
function _ts_metadata59(k, v) {
|
|
22521
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22522
|
+
}
|
|
22523
|
+
chunkUSNT2KNT_cjs.__name(_ts_metadata59, "_ts_metadata");
|
|
22524
|
+
exports.VendorUser = class VendorUser {
|
|
22525
|
+
static {
|
|
22526
|
+
chunkUSNT2KNT_cjs.__name(this, "VendorUser");
|
|
22527
|
+
}
|
|
22528
|
+
id;
|
|
22529
|
+
vendorId;
|
|
22530
|
+
userId;
|
|
22531
|
+
vendorRoleId;
|
|
22532
|
+
vendorUserProfileId;
|
|
22533
|
+
createdAt;
|
|
22534
|
+
updatedAt;
|
|
22535
|
+
vendor;
|
|
22536
|
+
user;
|
|
22537
|
+
vendorRole;
|
|
22538
|
+
vendorUserProfile;
|
|
22539
|
+
};
|
|
22540
|
+
_ts_decorate59([
|
|
22541
|
+
typeorm.PrimaryGeneratedColumn(),
|
|
22542
|
+
_ts_metadata59("design:type", Number)
|
|
22543
|
+
], exports.VendorUser.prototype, "id", void 0);
|
|
22544
|
+
_ts_decorate59([
|
|
22545
|
+
typeorm.Column("int"),
|
|
22546
|
+
_ts_metadata59("design:type", Number)
|
|
22547
|
+
], exports.VendorUser.prototype, "vendorId", void 0);
|
|
22548
|
+
_ts_decorate59([
|
|
22549
|
+
typeorm.Column("int"),
|
|
22550
|
+
_ts_metadata59("design:type", Number)
|
|
22551
|
+
], exports.VendorUser.prototype, "userId", void 0);
|
|
22552
|
+
_ts_decorate59([
|
|
22553
|
+
typeorm.Column("int"),
|
|
22554
|
+
_ts_metadata59("design:type", Number)
|
|
22555
|
+
], exports.VendorUser.prototype, "vendorRoleId", void 0);
|
|
22556
|
+
_ts_decorate59([
|
|
22557
|
+
typeorm.Column("int"),
|
|
22558
|
+
_ts_metadata59("design:type", Number)
|
|
22559
|
+
], exports.VendorUser.prototype, "vendorUserProfileId", void 0);
|
|
22560
|
+
_ts_decorate59([
|
|
22561
|
+
typeorm.Column({
|
|
22562
|
+
type: "timestamp",
|
|
22563
|
+
default: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name(() => "CURRENT_TIMESTAMP", "default")
|
|
22564
|
+
}),
|
|
22565
|
+
_ts_metadata59("design:type", typeof Date === "undefined" ? Object : Date)
|
|
22566
|
+
], exports.VendorUser.prototype, "createdAt", void 0);
|
|
22567
|
+
_ts_decorate59([
|
|
22568
|
+
typeorm.Column({
|
|
22569
|
+
type: "timestamp",
|
|
22570
|
+
default: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name(() => "CURRENT_TIMESTAMP", "default")
|
|
22571
|
+
}),
|
|
22572
|
+
_ts_metadata59("design:type", typeof Date === "undefined" ? Object : Date)
|
|
21803
22573
|
], exports.VendorUser.prototype, "updatedAt", void 0);
|
|
21804
|
-
|
|
22574
|
+
_ts_decorate59([
|
|
21805
22575
|
typeorm.ManyToOne(() => exports.Vendor, (v) => v.vendorUsers, {
|
|
21806
22576
|
onDelete: "CASCADE"
|
|
21807
22577
|
}),
|
|
21808
22578
|
typeorm.JoinColumn({
|
|
21809
22579
|
name: "vendorId"
|
|
21810
22580
|
}),
|
|
21811
|
-
|
|
22581
|
+
_ts_metadata59("design:type", typeof exports.Vendor === "undefined" ? Object : exports.Vendor)
|
|
21812
22582
|
], exports.VendorUser.prototype, "vendor", void 0);
|
|
21813
|
-
|
|
22583
|
+
_ts_decorate59([
|
|
21814
22584
|
typeorm.ManyToOne(() => exports.User, {
|
|
21815
22585
|
onDelete: "CASCADE"
|
|
21816
22586
|
}),
|
|
21817
22587
|
typeorm.JoinColumn({
|
|
21818
22588
|
name: "userId"
|
|
21819
22589
|
}),
|
|
21820
|
-
|
|
22590
|
+
_ts_metadata59("design:type", typeof exports.User === "undefined" ? Object : exports.User)
|
|
21821
22591
|
], exports.VendorUser.prototype, "user", void 0);
|
|
21822
|
-
|
|
22592
|
+
_ts_decorate59([
|
|
21823
22593
|
typeorm.ManyToOne(() => exports.VendorRole, {
|
|
21824
|
-
onDelete: "
|
|
21825
|
-
nullable: true
|
|
22594
|
+
onDelete: "RESTRICT"
|
|
21826
22595
|
}),
|
|
21827
22596
|
typeorm.JoinColumn({
|
|
21828
22597
|
name: "vendorRoleId"
|
|
21829
22598
|
}),
|
|
21830
|
-
|
|
22599
|
+
_ts_metadata59("design:type", typeof exports.VendorRole === "undefined" ? Object : exports.VendorRole)
|
|
21831
22600
|
], exports.VendorUser.prototype, "vendorRole", void 0);
|
|
21832
|
-
|
|
22601
|
+
_ts_decorate59([
|
|
22602
|
+
typeorm.ManyToOne(() => exports.VendorUserProfile, {
|
|
22603
|
+
onDelete: "RESTRICT"
|
|
22604
|
+
}),
|
|
22605
|
+
typeorm.JoinColumn({
|
|
22606
|
+
name: "vendorUserProfileId"
|
|
22607
|
+
}),
|
|
22608
|
+
_ts_metadata59("design:type", typeof exports.VendorUserProfile === "undefined" ? Object : exports.VendorUserProfile)
|
|
22609
|
+
], exports.VendorUser.prototype, "vendorUserProfile", void 0);
|
|
22610
|
+
exports.VendorUser = _ts_decorate59([
|
|
21833
22611
|
typeorm.Entity("vendor_users"),
|
|
21834
22612
|
typeorm.Unique("UQ_vendor_users_vendor_user", [
|
|
21835
22613
|
"vendorId",
|
|
@@ -21843,19 +22621,22 @@ exports.VendorUser = _ts_decorate58([
|
|
|
21843
22621
|
]),
|
|
21844
22622
|
typeorm.Index("IDX_vendor_users_vendor_role", [
|
|
21845
22623
|
"vendorRoleId"
|
|
22624
|
+
]),
|
|
22625
|
+
typeorm.Index("IDX_vendor_users_profile", [
|
|
22626
|
+
"vendorUserProfileId"
|
|
21846
22627
|
])
|
|
21847
22628
|
], exports.VendorUser);
|
|
21848
|
-
function
|
|
22629
|
+
function _ts_decorate60(decorators, target, key, desc) {
|
|
21849
22630
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
21850
22631
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21851
22632
|
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;
|
|
21852
22633
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
21853
22634
|
}
|
|
21854
|
-
chunkUSNT2KNT_cjs.__name(
|
|
21855
|
-
function
|
|
22635
|
+
chunkUSNT2KNT_cjs.__name(_ts_decorate60, "_ts_decorate");
|
|
22636
|
+
function _ts_metadata60(k, v) {
|
|
21856
22637
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
21857
22638
|
}
|
|
21858
|
-
chunkUSNT2KNT_cjs.__name(
|
|
22639
|
+
chunkUSNT2KNT_cjs.__name(_ts_metadata60, "_ts_metadata");
|
|
21859
22640
|
exports.VendorCustomer = class VendorCustomer {
|
|
21860
22641
|
static {
|
|
21861
22642
|
chunkUSNT2KNT_cjs.__name(this, "VendorCustomer");
|
|
@@ -21874,78 +22655,78 @@ exports.VendorCustomer = class VendorCustomer {
|
|
|
21874
22655
|
contact;
|
|
21875
22656
|
customer;
|
|
21876
22657
|
};
|
|
21877
|
-
|
|
22658
|
+
_ts_decorate60([
|
|
21878
22659
|
typeorm.PrimaryGeneratedColumn(),
|
|
21879
|
-
|
|
22660
|
+
_ts_metadata60("design:type", Number)
|
|
21880
22661
|
], exports.VendorCustomer.prototype, "id", void 0);
|
|
21881
|
-
|
|
22662
|
+
_ts_decorate60([
|
|
21882
22663
|
typeorm.Column("int"),
|
|
21883
|
-
|
|
22664
|
+
_ts_metadata60("design:type", Number)
|
|
21884
22665
|
], exports.VendorCustomer.prototype, "vendorId", void 0);
|
|
21885
|
-
|
|
22666
|
+
_ts_decorate60([
|
|
21886
22667
|
typeorm.Column("int", {
|
|
21887
22668
|
nullable: true
|
|
21888
22669
|
}),
|
|
21889
|
-
|
|
22670
|
+
_ts_metadata60("design:type", Object)
|
|
21890
22671
|
], exports.VendorCustomer.prototype, "contactId", void 0);
|
|
21891
|
-
|
|
22672
|
+
_ts_decorate60([
|
|
21892
22673
|
typeorm.Column("int"),
|
|
21893
|
-
|
|
22674
|
+
_ts_metadata60("design:type", Number)
|
|
21894
22675
|
], exports.VendorCustomer.prototype, "customerId", void 0);
|
|
21895
|
-
|
|
22676
|
+
_ts_decorate60([
|
|
21896
22677
|
typeorm.Column("text", {
|
|
21897
22678
|
nullable: true
|
|
21898
22679
|
}),
|
|
21899
|
-
|
|
22680
|
+
_ts_metadata60("design:type", Object)
|
|
21900
22681
|
], exports.VendorCustomer.prototype, "notes", void 0);
|
|
21901
|
-
|
|
22682
|
+
_ts_decorate60([
|
|
21902
22683
|
typeorm.Column("simple-array", {
|
|
21903
22684
|
nullable: true
|
|
21904
22685
|
}),
|
|
21905
|
-
|
|
22686
|
+
_ts_metadata60("design:type", Object)
|
|
21906
22687
|
], exports.VendorCustomer.prototype, "tags", void 0);
|
|
21907
|
-
|
|
22688
|
+
_ts_decorate60([
|
|
21908
22689
|
typeorm.Column({
|
|
21909
22690
|
type: "timestamp",
|
|
21910
22691
|
default: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name(() => "CURRENT_TIMESTAMP", "default")
|
|
21911
22692
|
}),
|
|
21912
|
-
|
|
22693
|
+
_ts_metadata60("design:type", typeof Date === "undefined" ? Object : Date)
|
|
21913
22694
|
], exports.VendorCustomer.prototype, "createdAt", void 0);
|
|
21914
|
-
|
|
22695
|
+
_ts_decorate60([
|
|
21915
22696
|
typeorm.Column({
|
|
21916
22697
|
type: "timestamp",
|
|
21917
22698
|
default: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name(() => "CURRENT_TIMESTAMP", "default")
|
|
21918
22699
|
}),
|
|
21919
|
-
|
|
22700
|
+
_ts_metadata60("design:type", typeof Date === "undefined" ? Object : Date)
|
|
21920
22701
|
], exports.VendorCustomer.prototype, "updatedAt", void 0);
|
|
21921
|
-
|
|
22702
|
+
_ts_decorate60([
|
|
21922
22703
|
typeorm.ManyToOne(() => exports.Vendor, {
|
|
21923
22704
|
onDelete: "CASCADE"
|
|
21924
22705
|
}),
|
|
21925
22706
|
typeorm.JoinColumn({
|
|
21926
22707
|
name: "vendorId"
|
|
21927
22708
|
}),
|
|
21928
|
-
|
|
22709
|
+
_ts_metadata60("design:type", typeof exports.Vendor === "undefined" ? Object : exports.Vendor)
|
|
21929
22710
|
], exports.VendorCustomer.prototype, "vendor", void 0);
|
|
21930
|
-
|
|
22711
|
+
_ts_decorate60([
|
|
21931
22712
|
typeorm.ManyToOne(() => exports.Contact, {
|
|
21932
22713
|
onDelete: "CASCADE"
|
|
21933
22714
|
}),
|
|
21934
22715
|
typeorm.JoinColumn({
|
|
21935
22716
|
name: "contactId"
|
|
21936
22717
|
}),
|
|
21937
|
-
|
|
22718
|
+
_ts_metadata60("design:type", Object)
|
|
21938
22719
|
], exports.VendorCustomer.prototype, "contact", void 0);
|
|
21939
|
-
|
|
22720
|
+
_ts_decorate60([
|
|
21940
22721
|
typeorm.ManyToOne(() => exports.Customer, {
|
|
21941
22722
|
onDelete: "CASCADE"
|
|
21942
22723
|
}),
|
|
21943
22724
|
typeorm.JoinColumn({
|
|
21944
22725
|
name: "customerId"
|
|
21945
22726
|
}),
|
|
21946
|
-
|
|
22727
|
+
_ts_metadata60("design:type", typeof exports.Customer === "undefined" ? Object : exports.Customer)
|
|
21947
22728
|
], exports.VendorCustomer.prototype, "customer", void 0);
|
|
21948
|
-
exports.VendorCustomer =
|
|
22729
|
+
exports.VendorCustomer = _ts_decorate60([
|
|
21949
22730
|
typeorm.Entity("vendor_customers"),
|
|
21950
22731
|
typeorm.Index("IDX_vendor_customers_vendor", [
|
|
21951
22732
|
"vendorId"
|
|
@@ -21954,17 +22735,17 @@ exports.VendorCustomer = _ts_decorate59([
|
|
|
21954
22735
|
"contactId"
|
|
21955
22736
|
])
|
|
21956
22737
|
], exports.VendorCustomer);
|
|
21957
|
-
function
|
|
22738
|
+
function _ts_decorate61(decorators, target, key, desc) {
|
|
21958
22739
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
21959
22740
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21960
22741
|
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;
|
|
21961
22742
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
21962
22743
|
}
|
|
21963
|
-
chunkUSNT2KNT_cjs.__name(
|
|
21964
|
-
function
|
|
22744
|
+
chunkUSNT2KNT_cjs.__name(_ts_decorate61, "_ts_decorate");
|
|
22745
|
+
function _ts_metadata61(k, v) {
|
|
21965
22746
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
21966
22747
|
}
|
|
21967
|
-
chunkUSNT2KNT_cjs.__name(
|
|
22748
|
+
chunkUSNT2KNT_cjs.__name(_ts_metadata61, "_ts_metadata");
|
|
21968
22749
|
exports.Event = class Event {
|
|
21969
22750
|
static {
|
|
21970
22751
|
chunkUSNT2KNT_cjs.__name(this, "Event");
|
|
@@ -22037,341 +22818,341 @@ exports.Event = class Event {
|
|
|
22037
22818
|
refundPolicy;
|
|
22038
22819
|
eventProducts;
|
|
22039
22820
|
};
|
|
22040
|
-
|
|
22821
|
+
_ts_decorate61([
|
|
22041
22822
|
typeorm.PrimaryGeneratedColumn(),
|
|
22042
|
-
|
|
22823
|
+
_ts_metadata61("design:type", Number)
|
|
22043
22824
|
], exports.Event.prototype, "id", void 0);
|
|
22044
|
-
|
|
22825
|
+
_ts_decorate61([
|
|
22045
22826
|
typeorm.Column("int", {
|
|
22046
22827
|
nullable: true
|
|
22047
22828
|
}),
|
|
22048
|
-
|
|
22829
|
+
_ts_metadata61("design:type", Object)
|
|
22049
22830
|
], exports.Event.prototype, "vendorId", void 0);
|
|
22050
|
-
|
|
22831
|
+
_ts_decorate61([
|
|
22051
22832
|
typeorm.Column("varchar"),
|
|
22052
|
-
|
|
22833
|
+
_ts_metadata61("design:type", String)
|
|
22053
22834
|
], exports.Event.prototype, "name", void 0);
|
|
22054
|
-
|
|
22835
|
+
_ts_decorate61([
|
|
22055
22836
|
typeorm.Column("varchar"),
|
|
22056
|
-
|
|
22837
|
+
_ts_metadata61("design:type", String)
|
|
22057
22838
|
], exports.Event.prototype, "slug", void 0);
|
|
22058
|
-
|
|
22839
|
+
_ts_decorate61([
|
|
22059
22840
|
typeorm.Column("text", {
|
|
22060
22841
|
nullable: true
|
|
22061
22842
|
}),
|
|
22062
|
-
|
|
22843
|
+
_ts_metadata61("design:type", Object)
|
|
22063
22844
|
], exports.Event.prototype, "description", void 0);
|
|
22064
|
-
|
|
22845
|
+
_ts_decorate61([
|
|
22065
22846
|
typeorm.Column("int", {
|
|
22066
22847
|
nullable: true
|
|
22067
22848
|
}),
|
|
22068
|
-
|
|
22849
|
+
_ts_metadata61("design:type", Object)
|
|
22069
22850
|
], exports.Event.prototype, "expectedSpeakers", void 0);
|
|
22070
|
-
|
|
22851
|
+
_ts_decorate61([
|
|
22071
22852
|
typeorm.Column("int", {
|
|
22072
22853
|
nullable: true
|
|
22073
22854
|
}),
|
|
22074
|
-
|
|
22855
|
+
_ts_metadata61("design:type", Object)
|
|
22075
22856
|
], exports.Event.prototype, "expectedParticipants", void 0);
|
|
22076
|
-
|
|
22857
|
+
_ts_decorate61([
|
|
22077
22858
|
typeorm.Column("boolean", {
|
|
22078
22859
|
default: true
|
|
22079
22860
|
}),
|
|
22080
|
-
|
|
22861
|
+
_ts_metadata61("design:type", Boolean)
|
|
22081
22862
|
], exports.Event.prototype, "isActive", void 0);
|
|
22082
|
-
|
|
22863
|
+
_ts_decorate61([
|
|
22083
22864
|
typeorm.Column("varchar", {
|
|
22084
22865
|
nullable: true
|
|
22085
22866
|
}),
|
|
22086
|
-
|
|
22867
|
+
_ts_metadata61("design:type", Object)
|
|
22087
22868
|
], exports.Event.prototype, "approvalStatus", void 0);
|
|
22088
|
-
|
|
22869
|
+
_ts_decorate61([
|
|
22089
22870
|
typeorm.Column("text", {
|
|
22090
22871
|
nullable: true
|
|
22091
22872
|
}),
|
|
22092
|
-
|
|
22873
|
+
_ts_metadata61("design:type", Object)
|
|
22093
22874
|
], exports.Event.prototype, "rejectionReason", void 0);
|
|
22094
|
-
|
|
22875
|
+
_ts_decorate61([
|
|
22095
22876
|
typeorm.Column({
|
|
22096
22877
|
type: "timestamptz",
|
|
22097
22878
|
nullable: true
|
|
22098
22879
|
}),
|
|
22099
|
-
|
|
22880
|
+
_ts_metadata61("design:type", Object)
|
|
22100
22881
|
], exports.Event.prototype, "rejectedAt", void 0);
|
|
22101
|
-
|
|
22882
|
+
_ts_decorate61([
|
|
22102
22883
|
typeorm.Column("int", {
|
|
22103
22884
|
nullable: true
|
|
22104
22885
|
}),
|
|
22105
|
-
|
|
22886
|
+
_ts_metadata61("design:type", Object)
|
|
22106
22887
|
], exports.Event.prototype, "rejectedBy", void 0);
|
|
22107
|
-
|
|
22888
|
+
_ts_decorate61([
|
|
22108
22889
|
typeorm.Column("boolean", {
|
|
22109
22890
|
default: false
|
|
22110
22891
|
}),
|
|
22111
|
-
|
|
22892
|
+
_ts_metadata61("design:type", Boolean)
|
|
22112
22893
|
], exports.Event.prototype, "comingSoon", void 0);
|
|
22113
|
-
|
|
22894
|
+
_ts_decorate61([
|
|
22114
22895
|
typeorm.Column("varchar", {
|
|
22115
22896
|
nullable: true
|
|
22116
22897
|
}),
|
|
22117
|
-
|
|
22898
|
+
_ts_metadata61("design:type", Object)
|
|
22118
22899
|
], exports.Event.prototype, "bannerImageUrl", void 0);
|
|
22119
|
-
|
|
22900
|
+
_ts_decorate61([
|
|
22120
22901
|
typeorm.Column("varchar", {
|
|
22121
22902
|
nullable: true
|
|
22122
22903
|
}),
|
|
22123
|
-
|
|
22904
|
+
_ts_metadata61("design:type", Object)
|
|
22124
22905
|
], exports.Event.prototype, "logoUrl", void 0);
|
|
22125
|
-
|
|
22906
|
+
_ts_decorate61([
|
|
22126
22907
|
typeorm.Column("varchar", {
|
|
22127
22908
|
nullable: true
|
|
22128
22909
|
}),
|
|
22129
|
-
|
|
22910
|
+
_ts_metadata61("design:type", Object)
|
|
22130
22911
|
], exports.Event.prototype, "venue", void 0);
|
|
22131
|
-
|
|
22912
|
+
_ts_decorate61([
|
|
22132
22913
|
typeorm.Column("text", {
|
|
22133
22914
|
nullable: true
|
|
22134
22915
|
}),
|
|
22135
|
-
|
|
22916
|
+
_ts_metadata61("design:type", Object)
|
|
22136
22917
|
], exports.Event.prototype, "additionalVenueDetails", void 0);
|
|
22137
|
-
|
|
22918
|
+
_ts_decorate61([
|
|
22138
22919
|
typeorm.Column("varchar", {
|
|
22139
22920
|
default: "public"
|
|
22140
22921
|
}),
|
|
22141
|
-
|
|
22922
|
+
_ts_metadata61("design:type", typeof EventVisibility === "undefined" ? Object : EventVisibility)
|
|
22142
22923
|
], exports.Event.prototype, "visibility", void 0);
|
|
22143
|
-
|
|
22924
|
+
_ts_decorate61([
|
|
22144
22925
|
typeorm.Column({
|
|
22145
22926
|
type: "timestamp",
|
|
22146
22927
|
nullable: true
|
|
22147
22928
|
}),
|
|
22148
|
-
|
|
22929
|
+
_ts_metadata61("design:type", Object)
|
|
22149
22930
|
], exports.Event.prototype, "startDate", void 0);
|
|
22150
|
-
|
|
22931
|
+
_ts_decorate61([
|
|
22151
22932
|
typeorm.Column({
|
|
22152
22933
|
type: "timestamp",
|
|
22153
22934
|
nullable: true
|
|
22154
22935
|
}),
|
|
22155
|
-
|
|
22936
|
+
_ts_metadata61("design:type", Object)
|
|
22156
22937
|
], exports.Event.prototype, "endDate", void 0);
|
|
22157
|
-
|
|
22938
|
+
_ts_decorate61([
|
|
22158
22939
|
typeorm.Column({
|
|
22159
22940
|
type: "timestamp",
|
|
22160
22941
|
nullable: true
|
|
22161
22942
|
}),
|
|
22162
|
-
|
|
22943
|
+
_ts_metadata61("design:type", Object)
|
|
22163
22944
|
], exports.Event.prototype, "registrationOpensAt", void 0);
|
|
22164
|
-
|
|
22945
|
+
_ts_decorate61([
|
|
22165
22946
|
typeorm.Column({
|
|
22166
22947
|
type: "timestamp",
|
|
22167
22948
|
nullable: true
|
|
22168
22949
|
}),
|
|
22169
|
-
|
|
22950
|
+
_ts_metadata61("design:type", Object)
|
|
22170
22951
|
], exports.Event.prototype, "registrationClosesAt", void 0);
|
|
22171
|
-
|
|
22952
|
+
_ts_decorate61([
|
|
22172
22953
|
typeorm.Column("varchar", {
|
|
22173
22954
|
nullable: true
|
|
22174
22955
|
}),
|
|
22175
|
-
|
|
22956
|
+
_ts_metadata61("design:type", Object)
|
|
22176
22957
|
], exports.Event.prototype, "pricingType", void 0);
|
|
22177
|
-
|
|
22958
|
+
_ts_decorate61([
|
|
22178
22959
|
typeorm.Column("jsonb", {
|
|
22179
22960
|
nullable: true
|
|
22180
22961
|
}),
|
|
22181
|
-
|
|
22962
|
+
_ts_metadata61("design:type", Object)
|
|
22182
22963
|
], exports.Event.prototype, "entityTypes", void 0);
|
|
22183
|
-
|
|
22964
|
+
_ts_decorate61([
|
|
22184
22965
|
typeorm.Column("varchar", {
|
|
22185
22966
|
nullable: true
|
|
22186
22967
|
}),
|
|
22187
|
-
|
|
22968
|
+
_ts_metadata61("design:type", Object)
|
|
22188
22969
|
], exports.Event.prototype, "entityMode", void 0);
|
|
22189
|
-
|
|
22970
|
+
_ts_decorate61([
|
|
22190
22971
|
typeorm.Column("varchar", {
|
|
22191
22972
|
nullable: true
|
|
22192
22973
|
}),
|
|
22193
|
-
|
|
22974
|
+
_ts_metadata61("design:type", Object)
|
|
22194
22975
|
], exports.Event.prototype, "city", void 0);
|
|
22195
|
-
|
|
22976
|
+
_ts_decorate61([
|
|
22196
22977
|
typeorm.Column("varchar", {
|
|
22197
22978
|
nullable: true
|
|
22198
22979
|
}),
|
|
22199
|
-
|
|
22980
|
+
_ts_metadata61("design:type", Object)
|
|
22200
22981
|
], exports.Event.prototype, "country", void 0);
|
|
22201
|
-
|
|
22982
|
+
_ts_decorate61([
|
|
22202
22983
|
typeorm.Column("varchar", {
|
|
22203
22984
|
nullable: true
|
|
22204
22985
|
}),
|
|
22205
|
-
|
|
22986
|
+
_ts_metadata61("design:type", Object)
|
|
22206
22987
|
], exports.Event.prototype, "cityCountry", void 0);
|
|
22207
|
-
|
|
22988
|
+
_ts_decorate61([
|
|
22208
22989
|
typeorm.Column("varchar", {
|
|
22209
22990
|
nullable: true
|
|
22210
22991
|
}),
|
|
22211
|
-
|
|
22992
|
+
_ts_metadata61("design:type", Object)
|
|
22212
22993
|
], exports.Event.prototype, "defaultCurrency", void 0);
|
|
22213
|
-
|
|
22994
|
+
_ts_decorate61([
|
|
22214
22995
|
typeorm.Column("jsonb", {
|
|
22215
22996
|
nullable: true
|
|
22216
22997
|
}),
|
|
22217
|
-
|
|
22998
|
+
_ts_metadata61("design:type", Object)
|
|
22218
22999
|
], exports.Event.prototype, "supportedCurrencies", void 0);
|
|
22219
|
-
|
|
23000
|
+
_ts_decorate61([
|
|
22220
23001
|
typeorm.Column("varchar", {
|
|
22221
23002
|
nullable: true
|
|
22222
23003
|
}),
|
|
22223
|
-
|
|
23004
|
+
_ts_metadata61("design:type", Object)
|
|
22224
23005
|
], exports.Event.prototype, "timezone", void 0);
|
|
22225
|
-
|
|
23006
|
+
_ts_decorate61([
|
|
22226
23007
|
typeorm.Column("jsonb", {
|
|
22227
23008
|
nullable: true
|
|
22228
23009
|
}),
|
|
22229
|
-
|
|
23010
|
+
_ts_metadata61("design:type", Object)
|
|
22230
23011
|
], exports.Event.prototype, "socialMediaLinks", void 0);
|
|
22231
|
-
|
|
23012
|
+
_ts_decorate61([
|
|
22232
23013
|
typeorm.Column("varchar", {
|
|
22233
23014
|
nullable: true
|
|
22234
23015
|
}),
|
|
22235
|
-
|
|
23016
|
+
_ts_metadata61("design:type", Object)
|
|
22236
23017
|
], exports.Event.prototype, "officialWebsiteUrl", void 0);
|
|
22237
|
-
|
|
23018
|
+
_ts_decorate61([
|
|
22238
23019
|
typeorm.Column("varchar", {
|
|
22239
23020
|
nullable: true
|
|
22240
23021
|
}),
|
|
22241
|
-
|
|
23022
|
+
_ts_metadata61("design:type", Object)
|
|
22242
23023
|
], exports.Event.prototype, "supportContact", void 0);
|
|
22243
|
-
|
|
23024
|
+
_ts_decorate61([
|
|
22244
23025
|
typeorm.Column("boolean", {
|
|
22245
23026
|
default: false
|
|
22246
23027
|
}),
|
|
22247
|
-
|
|
23028
|
+
_ts_metadata61("design:type", Boolean)
|
|
22248
23029
|
], exports.Event.prototype, "allowGroupOrders", void 0);
|
|
22249
|
-
|
|
23030
|
+
_ts_decorate61([
|
|
22250
23031
|
typeorm.Column("boolean", {
|
|
22251
23032
|
default: false
|
|
22252
23033
|
}),
|
|
22253
|
-
|
|
23034
|
+
_ts_metadata61("design:type", Boolean)
|
|
22254
23035
|
], exports.Event.prototype, "sendIndividualTicketPDFToAttendees", void 0);
|
|
22255
|
-
|
|
23036
|
+
_ts_decorate61([
|
|
22256
23037
|
typeorm.Column("int", {
|
|
22257
23038
|
nullable: true
|
|
22258
23039
|
}),
|
|
22259
|
-
|
|
23040
|
+
_ts_metadata61("design:type", Object)
|
|
22260
23041
|
], exports.Event.prototype, "contactFormId", void 0);
|
|
22261
|
-
|
|
23042
|
+
_ts_decorate61([
|
|
22262
23043
|
typeorm.Column("int", {
|
|
22263
23044
|
nullable: true
|
|
22264
23045
|
}),
|
|
22265
|
-
|
|
23046
|
+
_ts_metadata61("design:type", Object)
|
|
22266
23047
|
], exports.Event.prototype, "taxId", void 0);
|
|
22267
|
-
|
|
23048
|
+
_ts_decorate61([
|
|
22268
23049
|
typeorm.Column("int", {
|
|
22269
23050
|
nullable: true
|
|
22270
23051
|
}),
|
|
22271
|
-
|
|
23052
|
+
_ts_metadata61("design:type", Object)
|
|
22272
23053
|
], exports.Event.prototype, "refundPolicyId", void 0);
|
|
22273
|
-
|
|
23054
|
+
_ts_decorate61([
|
|
22274
23055
|
typeorm.Column("decimal", {
|
|
22275
23056
|
precision: 5,
|
|
22276
23057
|
scale: 2,
|
|
22277
23058
|
nullable: true
|
|
22278
23059
|
}),
|
|
22279
|
-
|
|
23060
|
+
_ts_metadata61("design:type", Object)
|
|
22280
23061
|
], exports.Event.prototype, "taxRate", void 0);
|
|
22281
|
-
|
|
23062
|
+
_ts_decorate61([
|
|
22282
23063
|
typeorm.Column("int", {
|
|
22283
23064
|
nullable: true
|
|
22284
23065
|
}),
|
|
22285
|
-
|
|
23066
|
+
_ts_metadata61("design:type", Object)
|
|
22286
23067
|
], exports.Event.prototype, "maxGroupPurchaseQuantity", void 0);
|
|
22287
|
-
|
|
23068
|
+
_ts_decorate61([
|
|
22288
23069
|
typeorm.Column("jsonb", {
|
|
22289
23070
|
nullable: true
|
|
22290
23071
|
}),
|
|
22291
|
-
|
|
23072
|
+
_ts_metadata61("design:type", Object)
|
|
22292
23073
|
], exports.Event.prototype, "sponsors", void 0);
|
|
22293
|
-
|
|
23074
|
+
_ts_decorate61([
|
|
22294
23075
|
typeorm.Column("jsonb", {
|
|
22295
23076
|
nullable: true
|
|
22296
23077
|
}),
|
|
22297
|
-
|
|
23078
|
+
_ts_metadata61("design:type", Object)
|
|
22298
23079
|
], exports.Event.prototype, "agenda", void 0);
|
|
22299
|
-
|
|
23080
|
+
_ts_decorate61([
|
|
22300
23081
|
typeorm.Column("jsonb", {
|
|
22301
23082
|
nullable: true
|
|
22302
23083
|
}),
|
|
22303
|
-
|
|
23084
|
+
_ts_metadata61("design:type", Object)
|
|
22304
23085
|
], exports.Event.prototype, "workshops", void 0);
|
|
22305
|
-
|
|
23086
|
+
_ts_decorate61([
|
|
22306
23087
|
typeorm.Column("jsonb", {
|
|
22307
23088
|
nullable: true
|
|
22308
23089
|
}),
|
|
22309
|
-
|
|
23090
|
+
_ts_metadata61("design:type", Object)
|
|
22310
23091
|
], exports.Event.prototype, "exhibitors", void 0);
|
|
22311
|
-
|
|
23092
|
+
_ts_decorate61([
|
|
22312
23093
|
typeorm.Column("jsonb", {
|
|
22313
23094
|
nullable: true
|
|
22314
23095
|
}),
|
|
22315
|
-
|
|
23096
|
+
_ts_metadata61("design:type", Object)
|
|
22316
23097
|
], exports.Event.prototype, "partners", void 0);
|
|
22317
|
-
|
|
23098
|
+
_ts_decorate61([
|
|
22318
23099
|
typeorm.Column("jsonb", {
|
|
22319
23100
|
nullable: true
|
|
22320
23101
|
}),
|
|
22321
|
-
|
|
23102
|
+
_ts_metadata61("design:type", Object)
|
|
22322
23103
|
], exports.Event.prototype, "speakers", void 0);
|
|
22323
|
-
|
|
23104
|
+
_ts_decorate61([
|
|
22324
23105
|
typeorm.Column("int", {
|
|
22325
23106
|
default: 0
|
|
22326
23107
|
}),
|
|
22327
|
-
|
|
23108
|
+
_ts_metadata61("design:type", Number)
|
|
22328
23109
|
], exports.Event.prototype, "sortOrder", void 0);
|
|
22329
|
-
|
|
23110
|
+
_ts_decorate61([
|
|
22330
23111
|
typeorm.Column({
|
|
22331
23112
|
type: "timestamp",
|
|
22332
23113
|
default: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name(() => "CURRENT_TIMESTAMP", "default")
|
|
22333
23114
|
}),
|
|
22334
|
-
|
|
23115
|
+
_ts_metadata61("design:type", typeof Date === "undefined" ? Object : Date)
|
|
22335
23116
|
], exports.Event.prototype, "createdAt", void 0);
|
|
22336
|
-
|
|
23117
|
+
_ts_decorate61([
|
|
22337
23118
|
typeorm.Column({
|
|
22338
23119
|
type: "timestamp",
|
|
22339
23120
|
default: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name(() => "CURRENT_TIMESTAMP", "default")
|
|
22340
23121
|
}),
|
|
22341
|
-
|
|
23122
|
+
_ts_metadata61("design:type", typeof Date === "undefined" ? Object : Date)
|
|
22342
23123
|
], exports.Event.prototype, "updatedAt", void 0);
|
|
22343
|
-
|
|
23124
|
+
_ts_decorate61([
|
|
22344
23125
|
typeorm.Column({
|
|
22345
23126
|
type: "timestamp",
|
|
22346
23127
|
nullable: true
|
|
22347
23128
|
}),
|
|
22348
|
-
|
|
23129
|
+
_ts_metadata61("design:type", Object)
|
|
22349
23130
|
], exports.Event.prototype, "deletedAt", void 0);
|
|
22350
|
-
|
|
23131
|
+
_ts_decorate61([
|
|
22351
23132
|
typeorm.Column("boolean", {
|
|
22352
23133
|
default: false
|
|
22353
23134
|
}),
|
|
22354
|
-
|
|
23135
|
+
_ts_metadata61("design:type", Boolean)
|
|
22355
23136
|
], exports.Event.prototype, "deleted", void 0);
|
|
22356
|
-
|
|
23137
|
+
_ts_decorate61([
|
|
22357
23138
|
typeorm.Column("int", {
|
|
22358
23139
|
nullable: true
|
|
22359
23140
|
}),
|
|
22360
|
-
|
|
23141
|
+
_ts_metadata61("design:type", Object)
|
|
22361
23142
|
], exports.Event.prototype, "createdBy", void 0);
|
|
22362
|
-
|
|
23143
|
+
_ts_decorate61([
|
|
22363
23144
|
typeorm.Column("int", {
|
|
22364
23145
|
nullable: true
|
|
22365
23146
|
}),
|
|
22366
|
-
|
|
23147
|
+
_ts_metadata61("design:type", Object)
|
|
22367
23148
|
], exports.Event.prototype, "updatedBy", void 0);
|
|
22368
|
-
|
|
23149
|
+
_ts_decorate61([
|
|
22369
23150
|
typeorm.Column("int", {
|
|
22370
23151
|
nullable: true
|
|
22371
23152
|
}),
|
|
22372
|
-
|
|
23153
|
+
_ts_metadata61("design:type", Object)
|
|
22373
23154
|
], exports.Event.prototype, "deletedBy", void 0);
|
|
22374
|
-
|
|
23155
|
+
_ts_decorate61([
|
|
22375
23156
|
typeorm.ManyToOne(() => exports.Vendor, {
|
|
22376
23157
|
onDelete: "RESTRICT",
|
|
22377
23158
|
nullable: true
|
|
@@ -22379,9 +23160,9 @@ _ts_decorate60([
|
|
|
22379
23160
|
typeorm.JoinColumn({
|
|
22380
23161
|
name: "vendorId"
|
|
22381
23162
|
}),
|
|
22382
|
-
|
|
23163
|
+
_ts_metadata61("design:type", Object)
|
|
22383
23164
|
], exports.Event.prototype, "vendor", void 0);
|
|
22384
|
-
|
|
23165
|
+
_ts_decorate61([
|
|
22385
23166
|
typeorm.ManyToOne(() => exports.Form, {
|
|
22386
23167
|
onDelete: "SET NULL",
|
|
22387
23168
|
nullable: true
|
|
@@ -22389,9 +23170,9 @@ _ts_decorate60([
|
|
|
22389
23170
|
typeorm.JoinColumn({
|
|
22390
23171
|
name: "contactFormId"
|
|
22391
23172
|
}),
|
|
22392
|
-
|
|
23173
|
+
_ts_metadata61("design:type", Object)
|
|
22393
23174
|
], exports.Event.prototype, "contactForm", void 0);
|
|
22394
|
-
|
|
23175
|
+
_ts_decorate61([
|
|
22395
23176
|
typeorm.ManyToOne(() => exports.Tax, {
|
|
22396
23177
|
onDelete: "SET NULL",
|
|
22397
23178
|
nullable: true
|
|
@@ -22399,9 +23180,9 @@ _ts_decorate60([
|
|
|
22399
23180
|
typeorm.JoinColumn({
|
|
22400
23181
|
name: "taxId"
|
|
22401
23182
|
}),
|
|
22402
|
-
|
|
23183
|
+
_ts_metadata61("design:type", Object)
|
|
22403
23184
|
], exports.Event.prototype, "tax", void 0);
|
|
22404
|
-
|
|
23185
|
+
_ts_decorate61([
|
|
22405
23186
|
typeorm.ManyToOne(() => exports.RefundPolicy, {
|
|
22406
23187
|
onDelete: "SET NULL",
|
|
22407
23188
|
nullable: true
|
|
@@ -22409,30 +23190,30 @@ _ts_decorate60([
|
|
|
22409
23190
|
typeorm.JoinColumn({
|
|
22410
23191
|
name: "refundPolicyId"
|
|
22411
23192
|
}),
|
|
22412
|
-
|
|
23193
|
+
_ts_metadata61("design:type", Object)
|
|
22413
23194
|
], exports.Event.prototype, "refundPolicy", void 0);
|
|
22414
|
-
|
|
23195
|
+
_ts_decorate61([
|
|
22415
23196
|
typeorm.OneToMany("EventProduct", "event"),
|
|
22416
|
-
|
|
23197
|
+
_ts_metadata61("design:type", Array)
|
|
22417
23198
|
], exports.Event.prototype, "eventProducts", void 0);
|
|
22418
|
-
exports.Event =
|
|
23199
|
+
exports.Event = _ts_decorate61([
|
|
22419
23200
|
typeorm.Entity("events"),
|
|
22420
23201
|
typeorm.Unique("UQ_events_vendor_slug", [
|
|
22421
23202
|
"vendorId",
|
|
22422
23203
|
"slug"
|
|
22423
23204
|
])
|
|
22424
23205
|
], exports.Event);
|
|
22425
|
-
function
|
|
23206
|
+
function _ts_decorate62(decorators, target, key, desc) {
|
|
22426
23207
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
22427
23208
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
22428
23209
|
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;
|
|
22429
23210
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22430
23211
|
}
|
|
22431
|
-
chunkUSNT2KNT_cjs.__name(
|
|
22432
|
-
function
|
|
23212
|
+
chunkUSNT2KNT_cjs.__name(_ts_decorate62, "_ts_decorate");
|
|
23213
|
+
function _ts_metadata62(k, v) {
|
|
22433
23214
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22434
23215
|
}
|
|
22435
|
-
chunkUSNT2KNT_cjs.__name(
|
|
23216
|
+
chunkUSNT2KNT_cjs.__name(_ts_metadata62, "_ts_metadata");
|
|
22436
23217
|
exports.EventProduct = class EventProduct {
|
|
22437
23218
|
static {
|
|
22438
23219
|
chunkUSNT2KNT_cjs.__name(this, "EventProduct");
|
|
@@ -22447,63 +23228,63 @@ exports.EventProduct = class EventProduct {
|
|
|
22447
23228
|
event;
|
|
22448
23229
|
product;
|
|
22449
23230
|
};
|
|
22450
|
-
|
|
23231
|
+
_ts_decorate62([
|
|
22451
23232
|
typeorm.PrimaryGeneratedColumn(),
|
|
22452
|
-
|
|
23233
|
+
_ts_metadata62("design:type", Number)
|
|
22453
23234
|
], exports.EventProduct.prototype, "id", void 0);
|
|
22454
|
-
|
|
23235
|
+
_ts_decorate62([
|
|
22455
23236
|
typeorm.Column("int"),
|
|
22456
|
-
|
|
23237
|
+
_ts_metadata62("design:type", Number)
|
|
22457
23238
|
], exports.EventProduct.prototype, "eventId", void 0);
|
|
22458
|
-
|
|
23239
|
+
_ts_decorate62([
|
|
22459
23240
|
typeorm.Column("int"),
|
|
22460
|
-
|
|
23241
|
+
_ts_metadata62("design:type", Number)
|
|
22461
23242
|
], exports.EventProduct.prototype, "productId", void 0);
|
|
22462
|
-
|
|
23243
|
+
_ts_decorate62([
|
|
22463
23244
|
typeorm.Column("int", {
|
|
22464
23245
|
default: 0
|
|
22465
23246
|
}),
|
|
22466
|
-
|
|
23247
|
+
_ts_metadata62("design:type", Number)
|
|
22467
23248
|
], exports.EventProduct.prototype, "displayOrder", void 0);
|
|
22468
|
-
|
|
23249
|
+
_ts_decorate62([
|
|
22469
23250
|
typeorm.Column("boolean", {
|
|
22470
23251
|
default: true
|
|
22471
23252
|
}),
|
|
22472
|
-
|
|
23253
|
+
_ts_metadata62("design:type", Boolean)
|
|
22473
23254
|
], exports.EventProduct.prototype, "isActive", void 0);
|
|
22474
|
-
|
|
23255
|
+
_ts_decorate62([
|
|
22475
23256
|
typeorm.Column({
|
|
22476
23257
|
type: "timestamp",
|
|
22477
23258
|
default: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name(() => "CURRENT_TIMESTAMP", "default")
|
|
22478
23259
|
}),
|
|
22479
|
-
|
|
23260
|
+
_ts_metadata62("design:type", typeof Date === "undefined" ? Object : Date)
|
|
22480
23261
|
], exports.EventProduct.prototype, "createdAt", void 0);
|
|
22481
|
-
|
|
23262
|
+
_ts_decorate62([
|
|
22482
23263
|
typeorm.Column({
|
|
22483
23264
|
type: "timestamp",
|
|
22484
23265
|
default: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name(() => "CURRENT_TIMESTAMP", "default")
|
|
22485
23266
|
}),
|
|
22486
|
-
|
|
23267
|
+
_ts_metadata62("design:type", typeof Date === "undefined" ? Object : Date)
|
|
22487
23268
|
], exports.EventProduct.prototype, "updatedAt", void 0);
|
|
22488
|
-
|
|
23269
|
+
_ts_decorate62([
|
|
22489
23270
|
typeorm.ManyToOne(() => exports.Event, (event) => event.eventProducts, {
|
|
22490
23271
|
onDelete: "CASCADE"
|
|
22491
23272
|
}),
|
|
22492
23273
|
typeorm.JoinColumn({
|
|
22493
23274
|
name: "eventId"
|
|
22494
23275
|
}),
|
|
22495
|
-
|
|
23276
|
+
_ts_metadata62("design:type", typeof exports.Event === "undefined" ? Object : exports.Event)
|
|
22496
23277
|
], exports.EventProduct.prototype, "event", void 0);
|
|
22497
|
-
|
|
23278
|
+
_ts_decorate62([
|
|
22498
23279
|
typeorm.ManyToOne(() => exports.Product, {
|
|
22499
23280
|
onDelete: "CASCADE"
|
|
22500
23281
|
}),
|
|
22501
23282
|
typeorm.JoinColumn({
|
|
22502
23283
|
name: "productId"
|
|
22503
23284
|
}),
|
|
22504
|
-
|
|
23285
|
+
_ts_metadata62("design:type", typeof exports.Product === "undefined" ? Object : exports.Product)
|
|
22505
23286
|
], exports.EventProduct.prototype, "product", void 0);
|
|
22506
|
-
exports.EventProduct =
|
|
23287
|
+
exports.EventProduct = _ts_decorate62([
|
|
22507
23288
|
typeorm.Entity("event_products"),
|
|
22508
23289
|
typeorm.Unique("UQ_event_products_event_product", [
|
|
22509
23290
|
"eventId",
|
|
@@ -22513,17 +23294,17 @@ exports.EventProduct = _ts_decorate61([
|
|
|
22513
23294
|
"eventId"
|
|
22514
23295
|
])
|
|
22515
23296
|
], exports.EventProduct);
|
|
22516
|
-
function
|
|
23297
|
+
function _ts_decorate63(decorators, target, key, desc) {
|
|
22517
23298
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
22518
23299
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
22519
23300
|
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;
|
|
22520
23301
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22521
23302
|
}
|
|
22522
|
-
chunkUSNT2KNT_cjs.__name(
|
|
22523
|
-
function
|
|
23303
|
+
chunkUSNT2KNT_cjs.__name(_ts_decorate63, "_ts_decorate");
|
|
23304
|
+
function _ts_metadata63(k, v) {
|
|
22524
23305
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22525
23306
|
}
|
|
22526
|
-
chunkUSNT2KNT_cjs.__name(
|
|
23307
|
+
chunkUSNT2KNT_cjs.__name(_ts_metadata63, "_ts_metadata");
|
|
22527
23308
|
var ComboItemType = /* @__PURE__ */ (function(ComboItemType2) {
|
|
22528
23309
|
ComboItemType2["FIXED"] = "fixed";
|
|
22529
23310
|
ComboItemType2["ADDONS"] = "addons";
|
|
@@ -22540,64 +23321,64 @@ exports.ComboItem = class ComboItem {
|
|
|
22540
23321
|
product;
|
|
22541
23322
|
type;
|
|
22542
23323
|
};
|
|
22543
|
-
|
|
23324
|
+
_ts_decorate63([
|
|
22544
23325
|
typeorm.PrimaryGeneratedColumn(),
|
|
22545
|
-
|
|
23326
|
+
_ts_metadata63("design:type", Number)
|
|
22546
23327
|
], exports.ComboItem.prototype, "id", void 0);
|
|
22547
|
-
|
|
23328
|
+
_ts_decorate63([
|
|
22548
23329
|
typeorm.Column({
|
|
22549
23330
|
type: "integer"
|
|
22550
23331
|
}),
|
|
22551
|
-
|
|
23332
|
+
_ts_metadata63("design:type", Number)
|
|
22552
23333
|
], exports.ComboItem.prototype, "comboId", void 0);
|
|
22553
|
-
|
|
23334
|
+
_ts_decorate63([
|
|
22554
23335
|
typeorm.ManyToOne(() => exports.Combo, (combo) => combo.items, {
|
|
22555
23336
|
onDelete: "CASCADE"
|
|
22556
23337
|
}),
|
|
22557
23338
|
typeorm.JoinColumn({
|
|
22558
23339
|
name: "comboId"
|
|
22559
23340
|
}),
|
|
22560
|
-
|
|
23341
|
+
_ts_metadata63("design:type", typeof exports.Combo === "undefined" ? Object : exports.Combo)
|
|
22561
23342
|
], exports.ComboItem.prototype, "combo", void 0);
|
|
22562
|
-
|
|
23343
|
+
_ts_decorate63([
|
|
22563
23344
|
typeorm.Column({
|
|
22564
23345
|
type: "integer"
|
|
22565
23346
|
}),
|
|
22566
|
-
|
|
23347
|
+
_ts_metadata63("design:type", Number)
|
|
22567
23348
|
], exports.ComboItem.prototype, "productId", void 0);
|
|
22568
|
-
|
|
23349
|
+
_ts_decorate63([
|
|
22569
23350
|
typeorm.ManyToOne(() => exports.Product, {
|
|
22570
23351
|
onDelete: "CASCADE"
|
|
22571
23352
|
}),
|
|
22572
23353
|
typeorm.JoinColumn({
|
|
22573
23354
|
name: "productId"
|
|
22574
23355
|
}),
|
|
22575
|
-
|
|
23356
|
+
_ts_metadata63("design:type", typeof exports.Product === "undefined" ? Object : exports.Product)
|
|
22576
23357
|
], exports.ComboItem.prototype, "product", void 0);
|
|
22577
|
-
|
|
23358
|
+
_ts_decorate63([
|
|
22578
23359
|
typeorm.Column({
|
|
22579
23360
|
type: "enum",
|
|
22580
23361
|
enum: ComboItemType,
|
|
22581
23362
|
default: "fixed"
|
|
22582
23363
|
}),
|
|
22583
|
-
|
|
23364
|
+
_ts_metadata63("design:type", String)
|
|
22584
23365
|
], exports.ComboItem.prototype, "type", void 0);
|
|
22585
|
-
exports.ComboItem =
|
|
23366
|
+
exports.ComboItem = _ts_decorate63([
|
|
22586
23367
|
typeorm.Entity("combo_items")
|
|
22587
23368
|
], exports.ComboItem);
|
|
22588
23369
|
|
|
22589
23370
|
// src/entities/combo.entity.ts
|
|
22590
|
-
function
|
|
23371
|
+
function _ts_decorate64(decorators, target, key, desc) {
|
|
22591
23372
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
22592
23373
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
22593
23374
|
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;
|
|
22594
23375
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22595
23376
|
}
|
|
22596
|
-
chunkUSNT2KNT_cjs.__name(
|
|
22597
|
-
function
|
|
23377
|
+
chunkUSNT2KNT_cjs.__name(_ts_decorate64, "_ts_decorate");
|
|
23378
|
+
function _ts_metadata64(k, v) {
|
|
22598
23379
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22599
23380
|
}
|
|
22600
|
-
chunkUSNT2KNT_cjs.__name(
|
|
23381
|
+
chunkUSNT2KNT_cjs.__name(_ts_metadata64, "_ts_metadata");
|
|
22601
23382
|
var ComboStatus = /* @__PURE__ */ (function(ComboStatus2) {
|
|
22602
23383
|
ComboStatus2["ACTIVE"] = "active";
|
|
22603
23384
|
ComboStatus2["INACTIVE"] = "inactive";
|
|
@@ -22633,50 +23414,50 @@ exports.Combo = class Combo {
|
|
|
22633
23414
|
updatedBy;
|
|
22634
23415
|
deletedBy;
|
|
22635
23416
|
};
|
|
22636
|
-
|
|
23417
|
+
_ts_decorate64([
|
|
22637
23418
|
typeorm.PrimaryGeneratedColumn(),
|
|
22638
|
-
|
|
23419
|
+
_ts_metadata64("design:type", Number)
|
|
22639
23420
|
], exports.Combo.prototype, "id", void 0);
|
|
22640
|
-
|
|
23421
|
+
_ts_decorate64([
|
|
22641
23422
|
typeorm.Column("int"),
|
|
22642
|
-
|
|
23423
|
+
_ts_metadata64("design:type", Number)
|
|
22643
23424
|
], exports.Combo.prototype, "vendorId", void 0);
|
|
22644
|
-
|
|
23425
|
+
_ts_decorate64([
|
|
22645
23426
|
typeorm.ManyToOne(() => exports.Vendor, {
|
|
22646
23427
|
onDelete: "RESTRICT"
|
|
22647
23428
|
}),
|
|
22648
23429
|
typeorm.JoinColumn({
|
|
22649
23430
|
name: "vendorId"
|
|
22650
23431
|
}),
|
|
22651
|
-
|
|
23432
|
+
_ts_metadata64("design:type", typeof exports.Vendor === "undefined" ? Object : exports.Vendor)
|
|
22652
23433
|
], exports.Combo.prototype, "vendor", void 0);
|
|
22653
|
-
|
|
23434
|
+
_ts_decorate64([
|
|
22654
23435
|
typeorm.Column({
|
|
22655
23436
|
type: "varchar"
|
|
22656
23437
|
}),
|
|
22657
|
-
|
|
23438
|
+
_ts_metadata64("design:type", String)
|
|
22658
23439
|
], exports.Combo.prototype, "name", void 0);
|
|
22659
|
-
|
|
23440
|
+
_ts_decorate64([
|
|
22660
23441
|
typeorm.Column({
|
|
22661
23442
|
type: "varchar"
|
|
22662
23443
|
}),
|
|
22663
|
-
|
|
23444
|
+
_ts_metadata64("design:type", String)
|
|
22664
23445
|
], exports.Combo.prototype, "slug", void 0);
|
|
22665
|
-
|
|
23446
|
+
_ts_decorate64([
|
|
22666
23447
|
typeorm.Column({
|
|
22667
23448
|
type: "text",
|
|
22668
23449
|
nullable: true
|
|
22669
23450
|
}),
|
|
22670
|
-
|
|
23451
|
+
_ts_metadata64("design:type", String)
|
|
22671
23452
|
], exports.Combo.prototype, "desc", void 0);
|
|
22672
|
-
|
|
23453
|
+
_ts_decorate64([
|
|
22673
23454
|
typeorm.Column({
|
|
22674
23455
|
type: "integer",
|
|
22675
23456
|
nullable: true
|
|
22676
23457
|
}),
|
|
22677
|
-
|
|
23458
|
+
_ts_metadata64("design:type", Object)
|
|
22678
23459
|
], exports.Combo.prototype, "eventId", void 0);
|
|
22679
|
-
|
|
23460
|
+
_ts_decorate64([
|
|
22680
23461
|
typeorm.ManyToOne(() => exports.Event, {
|
|
22681
23462
|
onDelete: "CASCADE",
|
|
22682
23463
|
nullable: true
|
|
@@ -22684,138 +23465,138 @@ _ts_decorate63([
|
|
|
22684
23465
|
typeorm.JoinColumn({
|
|
22685
23466
|
name: "eventId"
|
|
22686
23467
|
}),
|
|
22687
|
-
|
|
23468
|
+
_ts_metadata64("design:type", Object)
|
|
22688
23469
|
], exports.Combo.prototype, "event", void 0);
|
|
22689
|
-
|
|
23470
|
+
_ts_decorate64([
|
|
22690
23471
|
typeorm.Column({
|
|
22691
23472
|
type: "decimal",
|
|
22692
23473
|
precision: 12,
|
|
22693
23474
|
scale: 2,
|
|
22694
23475
|
default: 0
|
|
22695
23476
|
}),
|
|
22696
|
-
|
|
23477
|
+
_ts_metadata64("design:type", Number)
|
|
22697
23478
|
], exports.Combo.prototype, "price", void 0);
|
|
22698
|
-
|
|
23479
|
+
_ts_decorate64([
|
|
22699
23480
|
typeorm.Column({
|
|
22700
23481
|
type: "jsonb",
|
|
22701
23482
|
nullable: true
|
|
22702
23483
|
}),
|
|
22703
|
-
|
|
23484
|
+
_ts_metadata64("design:type", Object)
|
|
22704
23485
|
], exports.Combo.prototype, "currencyPrices", void 0);
|
|
22705
|
-
|
|
23486
|
+
_ts_decorate64([
|
|
22706
23487
|
typeorm.Column({
|
|
22707
23488
|
type: "integer",
|
|
22708
23489
|
default: 1
|
|
22709
23490
|
}),
|
|
22710
|
-
|
|
23491
|
+
_ts_metadata64("design:type", Number)
|
|
22711
23492
|
], exports.Combo.prototype, "minSelectableItems", void 0);
|
|
22712
|
-
|
|
23493
|
+
_ts_decorate64([
|
|
22713
23494
|
typeorm.Column({
|
|
22714
23495
|
type: "integer",
|
|
22715
23496
|
default: 1
|
|
22716
23497
|
}),
|
|
22717
|
-
|
|
23498
|
+
_ts_metadata64("design:type", Number)
|
|
22718
23499
|
], exports.Combo.prototype, "maxSelectableItems", void 0);
|
|
22719
|
-
|
|
23500
|
+
_ts_decorate64([
|
|
22720
23501
|
typeorm.Column({
|
|
22721
23502
|
type: "enum",
|
|
22722
23503
|
enum: ComboStatus,
|
|
22723
23504
|
default: "active"
|
|
22724
23505
|
}),
|
|
22725
|
-
|
|
23506
|
+
_ts_metadata64("design:type", String)
|
|
22726
23507
|
], exports.Combo.prototype, "status", void 0);
|
|
22727
|
-
|
|
23508
|
+
_ts_decorate64([
|
|
22728
23509
|
typeorm.Column({
|
|
22729
23510
|
type: "timestamp",
|
|
22730
23511
|
nullable: true
|
|
22731
23512
|
}),
|
|
22732
|
-
|
|
23513
|
+
_ts_metadata64("design:type", typeof Date === "undefined" ? Object : Date)
|
|
22733
23514
|
], exports.Combo.prototype, "startsAt", void 0);
|
|
22734
|
-
|
|
23515
|
+
_ts_decorate64([
|
|
22735
23516
|
typeorm.Column({
|
|
22736
23517
|
type: "timestamp",
|
|
22737
23518
|
nullable: true
|
|
22738
23519
|
}),
|
|
22739
|
-
|
|
23520
|
+
_ts_metadata64("design:type", typeof Date === "undefined" ? Object : Date)
|
|
22740
23521
|
], exports.Combo.prototype, "endsAt", void 0);
|
|
22741
|
-
|
|
23522
|
+
_ts_decorate64([
|
|
22742
23523
|
typeorm.Column({
|
|
22743
23524
|
type: "jsonb",
|
|
22744
23525
|
nullable: true
|
|
22745
23526
|
}),
|
|
22746
|
-
|
|
23527
|
+
_ts_metadata64("design:type", typeof Record === "undefined" ? Object : Record)
|
|
22747
23528
|
], exports.Combo.prototype, "metadata", void 0);
|
|
22748
|
-
|
|
23529
|
+
_ts_decorate64([
|
|
22749
23530
|
typeorm.OneToMany(() => exports.ComboItem, (item) => item.combo),
|
|
22750
|
-
|
|
23531
|
+
_ts_metadata64("design:type", Array)
|
|
22751
23532
|
], exports.Combo.prototype, "items", void 0);
|
|
22752
|
-
|
|
23533
|
+
_ts_decorate64([
|
|
22753
23534
|
typeorm.Column({
|
|
22754
23535
|
type: "timestamp",
|
|
22755
23536
|
default: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name(() => "now()", "default")
|
|
22756
23537
|
}),
|
|
22757
|
-
|
|
23538
|
+
_ts_metadata64("design:type", typeof Date === "undefined" ? Object : Date)
|
|
22758
23539
|
], exports.Combo.prototype, "createdAt", void 0);
|
|
22759
|
-
|
|
23540
|
+
_ts_decorate64([
|
|
22760
23541
|
typeorm.Column({
|
|
22761
23542
|
type: "timestamp",
|
|
22762
23543
|
default: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name(() => "now()", "default")
|
|
22763
23544
|
}),
|
|
22764
|
-
|
|
23545
|
+
_ts_metadata64("design:type", typeof Date === "undefined" ? Object : Date)
|
|
22765
23546
|
], exports.Combo.prototype, "updatedAt", void 0);
|
|
22766
|
-
|
|
23547
|
+
_ts_decorate64([
|
|
22767
23548
|
typeorm.Column({
|
|
22768
23549
|
type: "timestamp",
|
|
22769
23550
|
nullable: true
|
|
22770
23551
|
}),
|
|
22771
|
-
|
|
23552
|
+
_ts_metadata64("design:type", typeof Date === "undefined" ? Object : Date)
|
|
22772
23553
|
], exports.Combo.prototype, "deletedAt", void 0);
|
|
22773
|
-
|
|
23554
|
+
_ts_decorate64([
|
|
22774
23555
|
typeorm.Column({
|
|
22775
23556
|
type: "boolean",
|
|
22776
23557
|
default: false
|
|
22777
23558
|
}),
|
|
22778
|
-
|
|
23559
|
+
_ts_metadata64("design:type", Boolean)
|
|
22779
23560
|
], exports.Combo.prototype, "deleted", void 0);
|
|
22780
|
-
|
|
23561
|
+
_ts_decorate64([
|
|
22781
23562
|
typeorm.Column({
|
|
22782
23563
|
type: "integer",
|
|
22783
23564
|
nullable: true
|
|
22784
23565
|
}),
|
|
22785
|
-
|
|
23566
|
+
_ts_metadata64("design:type", Number)
|
|
22786
23567
|
], exports.Combo.prototype, "createdBy", void 0);
|
|
22787
|
-
|
|
23568
|
+
_ts_decorate64([
|
|
22788
23569
|
typeorm.Column({
|
|
22789
23570
|
type: "integer",
|
|
22790
23571
|
nullable: true
|
|
22791
23572
|
}),
|
|
22792
|
-
|
|
23573
|
+
_ts_metadata64("design:type", Number)
|
|
22793
23574
|
], exports.Combo.prototype, "updatedBy", void 0);
|
|
22794
|
-
|
|
23575
|
+
_ts_decorate64([
|
|
22795
23576
|
typeorm.Column({
|
|
22796
23577
|
type: "integer",
|
|
22797
23578
|
nullable: true
|
|
22798
23579
|
}),
|
|
22799
|
-
|
|
23580
|
+
_ts_metadata64("design:type", Number)
|
|
22800
23581
|
], exports.Combo.prototype, "deletedBy", void 0);
|
|
22801
|
-
exports.Combo =
|
|
23582
|
+
exports.Combo = _ts_decorate64([
|
|
22802
23583
|
typeorm.Entity("combos"),
|
|
22803
23584
|
typeorm.Unique("UQ_combos_vendor_slug", [
|
|
22804
23585
|
"vendorId",
|
|
22805
23586
|
"slug"
|
|
22806
23587
|
])
|
|
22807
23588
|
], exports.Combo);
|
|
22808
|
-
function
|
|
23589
|
+
function _ts_decorate65(decorators, target, key, desc) {
|
|
22809
23590
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
22810
23591
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
22811
23592
|
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;
|
|
22812
23593
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22813
23594
|
}
|
|
22814
|
-
chunkUSNT2KNT_cjs.__name(
|
|
22815
|
-
function
|
|
23595
|
+
chunkUSNT2KNT_cjs.__name(_ts_decorate65, "_ts_decorate");
|
|
23596
|
+
function _ts_metadata65(k, v) {
|
|
22816
23597
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22817
23598
|
}
|
|
22818
|
-
chunkUSNT2KNT_cjs.__name(
|
|
23599
|
+
chunkUSNT2KNT_cjs.__name(_ts_metadata65, "_ts_metadata");
|
|
22819
23600
|
var RefundMethod = /* @__PURE__ */ (function(RefundMethod2) {
|
|
22820
23601
|
RefundMethod2["CARD"] = "card";
|
|
22821
23602
|
RefundMethod2["UPI"] = "upi";
|
|
@@ -22846,109 +23627,109 @@ exports.RefundRequest = class RefundRequest {
|
|
|
22846
23627
|
expectedRefundAmount;
|
|
22847
23628
|
approvedRefundAmount;
|
|
22848
23629
|
};
|
|
22849
|
-
|
|
23630
|
+
_ts_decorate65([
|
|
22850
23631
|
typeorm.PrimaryGeneratedColumn(),
|
|
22851
|
-
|
|
23632
|
+
_ts_metadata65("design:type", Number)
|
|
22852
23633
|
], exports.RefundRequest.prototype, "id", void 0);
|
|
22853
|
-
|
|
23634
|
+
_ts_decorate65([
|
|
22854
23635
|
typeorm.Column({
|
|
22855
23636
|
type: "integer"
|
|
22856
23637
|
}),
|
|
22857
|
-
|
|
23638
|
+
_ts_metadata65("design:type", Number)
|
|
22858
23639
|
], exports.RefundRequest.prototype, "refundPolicyId", void 0);
|
|
22859
|
-
|
|
23640
|
+
_ts_decorate65([
|
|
22860
23641
|
typeorm.ManyToOne(() => exports.RefundPolicy, {
|
|
22861
23642
|
onDelete: "CASCADE"
|
|
22862
23643
|
}),
|
|
22863
23644
|
typeorm.JoinColumn({
|
|
22864
23645
|
name: "refundPolicyId"
|
|
22865
23646
|
}),
|
|
22866
|
-
|
|
23647
|
+
_ts_metadata65("design:type", typeof exports.RefundPolicy === "undefined" ? Object : exports.RefundPolicy)
|
|
22867
23648
|
], exports.RefundRequest.prototype, "refundPolicy", void 0);
|
|
22868
|
-
|
|
23649
|
+
_ts_decorate65([
|
|
22869
23650
|
typeorm.Column({
|
|
22870
23651
|
type: "integer"
|
|
22871
23652
|
}),
|
|
22872
|
-
|
|
23653
|
+
_ts_metadata65("design:type", Number)
|
|
22873
23654
|
], exports.RefundRequest.prototype, "orderId", void 0);
|
|
22874
|
-
|
|
23655
|
+
_ts_decorate65([
|
|
22875
23656
|
typeorm.ManyToOne(() => exports.Order, {
|
|
22876
23657
|
onDelete: "CASCADE"
|
|
22877
23658
|
}),
|
|
22878
23659
|
typeorm.JoinColumn({
|
|
22879
23660
|
name: "orderId"
|
|
22880
23661
|
}),
|
|
22881
|
-
|
|
23662
|
+
_ts_metadata65("design:type", typeof exports.Order === "undefined" ? Object : exports.Order)
|
|
22882
23663
|
], exports.RefundRequest.prototype, "order", void 0);
|
|
22883
|
-
|
|
23664
|
+
_ts_decorate65([
|
|
22884
23665
|
typeorm.Column({
|
|
22885
23666
|
type: "integer"
|
|
22886
23667
|
}),
|
|
22887
|
-
|
|
23668
|
+
_ts_metadata65("design:type", Number)
|
|
22888
23669
|
], exports.RefundRequest.prototype, "customerId", void 0);
|
|
22889
|
-
|
|
23670
|
+
_ts_decorate65([
|
|
22890
23671
|
typeorm.ManyToOne(() => exports.Customer, {
|
|
22891
23672
|
onDelete: "CASCADE"
|
|
22892
23673
|
}),
|
|
22893
23674
|
typeorm.JoinColumn({
|
|
22894
23675
|
name: "customerId"
|
|
22895
23676
|
}),
|
|
22896
|
-
|
|
23677
|
+
_ts_metadata65("design:type", typeof exports.Customer === "undefined" ? Object : exports.Customer)
|
|
22897
23678
|
], exports.RefundRequest.prototype, "customer", void 0);
|
|
22898
|
-
|
|
23679
|
+
_ts_decorate65([
|
|
22899
23680
|
typeorm.Column({
|
|
22900
23681
|
type: "text",
|
|
22901
23682
|
nullable: true
|
|
22902
23683
|
}),
|
|
22903
|
-
|
|
23684
|
+
_ts_metadata65("design:type", String)
|
|
22904
23685
|
], exports.RefundRequest.prototype, "reason", void 0);
|
|
22905
|
-
|
|
23686
|
+
_ts_decorate65([
|
|
22906
23687
|
typeorm.Column({
|
|
22907
23688
|
type: "enum",
|
|
22908
23689
|
enum: RefundMethod
|
|
22909
23690
|
}),
|
|
22910
|
-
|
|
23691
|
+
_ts_metadata65("design:type", String)
|
|
22911
23692
|
], exports.RefundRequest.prototype, "refundMethod", void 0);
|
|
22912
|
-
|
|
23693
|
+
_ts_decorate65([
|
|
22913
23694
|
typeorm.Column({
|
|
22914
23695
|
type: "enum",
|
|
22915
23696
|
enum: RefundRequestStatus,
|
|
22916
23697
|
default: "requested"
|
|
22917
23698
|
}),
|
|
22918
|
-
|
|
23699
|
+
_ts_metadata65("design:type", String)
|
|
22919
23700
|
], exports.RefundRequest.prototype, "status", void 0);
|
|
22920
|
-
|
|
23701
|
+
_ts_decorate65([
|
|
22921
23702
|
typeorm.Column({
|
|
22922
23703
|
type: "decimal",
|
|
22923
23704
|
precision: 10,
|
|
22924
23705
|
scale: 2,
|
|
22925
23706
|
default: 0
|
|
22926
23707
|
}),
|
|
22927
|
-
|
|
23708
|
+
_ts_metadata65("design:type", Number)
|
|
22928
23709
|
], exports.RefundRequest.prototype, "expectedRefundAmount", void 0);
|
|
22929
|
-
|
|
23710
|
+
_ts_decorate65([
|
|
22930
23711
|
typeorm.Column({
|
|
22931
23712
|
type: "decimal",
|
|
22932
23713
|
precision: 10,
|
|
22933
23714
|
scale: 2,
|
|
22934
23715
|
nullable: true
|
|
22935
23716
|
}),
|
|
22936
|
-
|
|
23717
|
+
_ts_metadata65("design:type", Number)
|
|
22937
23718
|
], exports.RefundRequest.prototype, "approvedRefundAmount", void 0);
|
|
22938
|
-
exports.RefundRequest =
|
|
23719
|
+
exports.RefundRequest = _ts_decorate65([
|
|
22939
23720
|
typeorm.Entity("refund_requests")
|
|
22940
23721
|
], exports.RefundRequest);
|
|
22941
|
-
function
|
|
23722
|
+
function _ts_decorate66(decorators, target, key, desc) {
|
|
22942
23723
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
22943
23724
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
22944
23725
|
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;
|
|
22945
23726
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22946
23727
|
}
|
|
22947
|
-
chunkUSNT2KNT_cjs.__name(
|
|
22948
|
-
function
|
|
23728
|
+
chunkUSNT2KNT_cjs.__name(_ts_decorate66, "_ts_decorate");
|
|
23729
|
+
function _ts_metadata66(k, v) {
|
|
22949
23730
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22950
23731
|
}
|
|
22951
|
-
chunkUSNT2KNT_cjs.__name(
|
|
23732
|
+
chunkUSNT2KNT_cjs.__name(_ts_metadata66, "_ts_metadata");
|
|
22952
23733
|
exports.Attendee = class Attendee {
|
|
22953
23734
|
static {
|
|
22954
23735
|
chunkUSNT2KNT_cjs.__name(this, "Attendee");
|
|
@@ -22959,34 +23740,34 @@ exports.Attendee = class Attendee {
|
|
|
22959
23740
|
contactId;
|
|
22960
23741
|
contact;
|
|
22961
23742
|
};
|
|
22962
|
-
|
|
23743
|
+
_ts_decorate66([
|
|
22963
23744
|
typeorm.PrimaryGeneratedColumn(),
|
|
22964
|
-
|
|
23745
|
+
_ts_metadata66("design:type", Number)
|
|
22965
23746
|
], exports.Attendee.prototype, "id", void 0);
|
|
22966
|
-
|
|
23747
|
+
_ts_decorate66([
|
|
22967
23748
|
typeorm.Column("varchar"),
|
|
22968
|
-
|
|
23749
|
+
_ts_metadata66("design:type", String)
|
|
22969
23750
|
], exports.Attendee.prototype, "displayName", void 0);
|
|
22970
|
-
|
|
23751
|
+
_ts_decorate66([
|
|
22971
23752
|
typeorm.Column("varchar"),
|
|
22972
|
-
|
|
23753
|
+
_ts_metadata66("design:type", String)
|
|
22973
23754
|
], exports.Attendee.prototype, "email", void 0);
|
|
22974
|
-
|
|
23755
|
+
_ts_decorate66([
|
|
22975
23756
|
typeorm.Column("int", {
|
|
22976
23757
|
nullable: true
|
|
22977
23758
|
}),
|
|
22978
|
-
|
|
23759
|
+
_ts_metadata66("design:type", Object)
|
|
22979
23760
|
], exports.Attendee.prototype, "contactId", void 0);
|
|
22980
|
-
|
|
23761
|
+
_ts_decorate66([
|
|
22981
23762
|
typeorm.ManyToOne(() => exports.Contact, {
|
|
22982
23763
|
onDelete: "SET NULL"
|
|
22983
23764
|
}),
|
|
22984
23765
|
typeorm.JoinColumn({
|
|
22985
23766
|
name: "contactId"
|
|
22986
23767
|
}),
|
|
22987
|
-
|
|
23768
|
+
_ts_metadata66("design:type", Object)
|
|
22988
23769
|
], exports.Attendee.prototype, "contact", void 0);
|
|
22989
|
-
exports.Attendee =
|
|
23770
|
+
exports.Attendee = _ts_decorate66([
|
|
22990
23771
|
typeorm.Entity("attendees"),
|
|
22991
23772
|
typeorm.Index("IDX_attendees_contactId", [
|
|
22992
23773
|
"contactId"
|
|
@@ -22995,22 +23776,28 @@ exports.Attendee = _ts_decorate65([
|
|
|
22995
23776
|
"email"
|
|
22996
23777
|
])
|
|
22997
23778
|
], exports.Attendee);
|
|
22998
|
-
function
|
|
23779
|
+
function _ts_decorate67(decorators, target, key, desc) {
|
|
22999
23780
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23000
23781
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
23001
23782
|
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;
|
|
23002
23783
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23003
23784
|
}
|
|
23004
|
-
chunkUSNT2KNT_cjs.__name(
|
|
23005
|
-
function
|
|
23785
|
+
chunkUSNT2KNT_cjs.__name(_ts_decorate67, "_ts_decorate");
|
|
23786
|
+
function _ts_metadata67(k, v) {
|
|
23006
23787
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
23007
23788
|
}
|
|
23008
|
-
chunkUSNT2KNT_cjs.__name(
|
|
23789
|
+
chunkUSNT2KNT_cjs.__name(_ts_metadata67, "_ts_metadata");
|
|
23009
23790
|
var NotificationChannel = /* @__PURE__ */ (function(NotificationChannel2) {
|
|
23010
23791
|
NotificationChannel2["WHATSAPP"] = "whatsapp";
|
|
23011
23792
|
NotificationChannel2["EMAIL"] = "email";
|
|
23012
23793
|
return NotificationChannel2;
|
|
23013
23794
|
})({});
|
|
23795
|
+
var NotificationAudienceType = /* @__PURE__ */ (function(NotificationAudienceType2) {
|
|
23796
|
+
NotificationAudienceType2["CUSTOMERS"] = "customers";
|
|
23797
|
+
NotificationAudienceType2["VENDORS"] = "vendors";
|
|
23798
|
+
NotificationAudienceType2["ADMIN"] = "admin";
|
|
23799
|
+
return NotificationAudienceType2;
|
|
23800
|
+
})({});
|
|
23014
23801
|
exports.OrderNotificationBinding = class OrderNotificationBinding {
|
|
23015
23802
|
static {
|
|
23016
23803
|
chunkUSNT2KNT_cjs.__name(this, "OrderNotificationBinding");
|
|
@@ -23018,71 +23805,81 @@ exports.OrderNotificationBinding = class OrderNotificationBinding {
|
|
|
23018
23805
|
id;
|
|
23019
23806
|
triggerKey;
|
|
23020
23807
|
channel;
|
|
23808
|
+
type;
|
|
23021
23809
|
messageTemplateId;
|
|
23022
23810
|
enabled;
|
|
23023
23811
|
createdAt;
|
|
23024
23812
|
updatedAt;
|
|
23025
23813
|
};
|
|
23026
|
-
|
|
23814
|
+
_ts_decorate67([
|
|
23027
23815
|
typeorm.PrimaryGeneratedColumn(),
|
|
23028
|
-
|
|
23816
|
+
_ts_metadata67("design:type", Number)
|
|
23029
23817
|
], exports.OrderNotificationBinding.prototype, "id", void 0);
|
|
23030
|
-
|
|
23818
|
+
_ts_decorate67([
|
|
23031
23819
|
typeorm.Column({
|
|
23032
23820
|
type: "varchar"
|
|
23033
23821
|
}),
|
|
23034
|
-
|
|
23822
|
+
_ts_metadata67("design:type", String)
|
|
23035
23823
|
], exports.OrderNotificationBinding.prototype, "triggerKey", void 0);
|
|
23036
|
-
|
|
23824
|
+
_ts_decorate67([
|
|
23037
23825
|
typeorm.Column({
|
|
23038
23826
|
type: "enum",
|
|
23039
23827
|
enum: NotificationChannel,
|
|
23040
23828
|
default: "whatsapp"
|
|
23041
23829
|
}),
|
|
23042
|
-
|
|
23830
|
+
_ts_metadata67("design:type", String)
|
|
23043
23831
|
], exports.OrderNotificationBinding.prototype, "channel", void 0);
|
|
23044
|
-
|
|
23832
|
+
_ts_decorate67([
|
|
23833
|
+
typeorm.Column({
|
|
23834
|
+
type: "enum",
|
|
23835
|
+
enum: NotificationAudienceType,
|
|
23836
|
+
default: "customers"
|
|
23837
|
+
}),
|
|
23838
|
+
_ts_metadata67("design:type", String)
|
|
23839
|
+
], exports.OrderNotificationBinding.prototype, "type", void 0);
|
|
23840
|
+
_ts_decorate67([
|
|
23045
23841
|
typeorm.Column({
|
|
23046
23842
|
type: "int",
|
|
23047
23843
|
nullable: true
|
|
23048
23844
|
}),
|
|
23049
|
-
|
|
23845
|
+
_ts_metadata67("design:type", Object)
|
|
23050
23846
|
], exports.OrderNotificationBinding.prototype, "messageTemplateId", void 0);
|
|
23051
|
-
|
|
23847
|
+
_ts_decorate67([
|
|
23052
23848
|
typeorm.Column({
|
|
23053
23849
|
type: "boolean",
|
|
23054
23850
|
default: true
|
|
23055
23851
|
}),
|
|
23056
|
-
|
|
23852
|
+
_ts_metadata67("design:type", Boolean)
|
|
23057
23853
|
], exports.OrderNotificationBinding.prototype, "enabled", void 0);
|
|
23058
|
-
|
|
23854
|
+
_ts_decorate67([
|
|
23059
23855
|
typeorm.CreateDateColumn(),
|
|
23060
|
-
|
|
23856
|
+
_ts_metadata67("design:type", typeof Date === "undefined" ? Object : Date)
|
|
23061
23857
|
], exports.OrderNotificationBinding.prototype, "createdAt", void 0);
|
|
23062
|
-
|
|
23858
|
+
_ts_decorate67([
|
|
23063
23859
|
typeorm.UpdateDateColumn(),
|
|
23064
|
-
|
|
23860
|
+
_ts_metadata67("design:type", typeof Date === "undefined" ? Object : Date)
|
|
23065
23861
|
], exports.OrderNotificationBinding.prototype, "updatedAt", void 0);
|
|
23066
|
-
exports.OrderNotificationBinding =
|
|
23862
|
+
exports.OrderNotificationBinding = _ts_decorate67([
|
|
23067
23863
|
typeorm.Entity("order_notification_bindings"),
|
|
23068
23864
|
typeorm.Index([
|
|
23069
23865
|
"triggerKey",
|
|
23070
|
-
"channel"
|
|
23866
|
+
"channel",
|
|
23867
|
+
"type"
|
|
23071
23868
|
], {
|
|
23072
23869
|
unique: true
|
|
23073
23870
|
})
|
|
23074
23871
|
], exports.OrderNotificationBinding);
|
|
23075
|
-
function
|
|
23872
|
+
function _ts_decorate68(decorators, target, key, desc) {
|
|
23076
23873
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
23077
23874
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
23078
23875
|
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;
|
|
23079
23876
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23080
23877
|
}
|
|
23081
|
-
chunkUSNT2KNT_cjs.__name(
|
|
23082
|
-
function
|
|
23878
|
+
chunkUSNT2KNT_cjs.__name(_ts_decorate68, "_ts_decorate");
|
|
23879
|
+
function _ts_metadata68(k, v) {
|
|
23083
23880
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
23084
23881
|
}
|
|
23085
|
-
chunkUSNT2KNT_cjs.__name(
|
|
23882
|
+
chunkUSNT2KNT_cjs.__name(_ts_metadata68, "_ts_metadata");
|
|
23086
23883
|
exports.OrderNotificationTrigger = class OrderNotificationTrigger {
|
|
23087
23884
|
static {
|
|
23088
23885
|
chunkUSNT2KNT_cjs.__name(this, "OrderNotificationTrigger");
|
|
@@ -23097,60 +23894,60 @@ exports.OrderNotificationTrigger = class OrderNotificationTrigger {
|
|
|
23097
23894
|
createdAt;
|
|
23098
23895
|
updatedAt;
|
|
23099
23896
|
};
|
|
23100
|
-
|
|
23897
|
+
_ts_decorate68([
|
|
23101
23898
|
typeorm.PrimaryGeneratedColumn(),
|
|
23102
|
-
|
|
23899
|
+
_ts_metadata68("design:type", Number)
|
|
23103
23900
|
], exports.OrderNotificationTrigger.prototype, "id", void 0);
|
|
23104
|
-
|
|
23901
|
+
_ts_decorate68([
|
|
23105
23902
|
typeorm.Column({
|
|
23106
23903
|
type: "varchar",
|
|
23107
23904
|
unique: true
|
|
23108
23905
|
}),
|
|
23109
|
-
|
|
23906
|
+
_ts_metadata68("design:type", String)
|
|
23110
23907
|
], exports.OrderNotificationTrigger.prototype, "triggerKey", void 0);
|
|
23111
|
-
|
|
23908
|
+
_ts_decorate68([
|
|
23112
23909
|
typeorm.Column({
|
|
23113
23910
|
type: "varchar"
|
|
23114
23911
|
}),
|
|
23115
|
-
|
|
23912
|
+
_ts_metadata68("design:type", String)
|
|
23116
23913
|
], exports.OrderNotificationTrigger.prototype, "label", void 0);
|
|
23117
|
-
|
|
23914
|
+
_ts_decorate68([
|
|
23118
23915
|
typeorm.Column({
|
|
23119
23916
|
type: "text",
|
|
23120
23917
|
nullable: true
|
|
23121
23918
|
}),
|
|
23122
|
-
|
|
23919
|
+
_ts_metadata68("design:type", Object)
|
|
23123
23920
|
], exports.OrderNotificationTrigger.prototype, "description", void 0);
|
|
23124
|
-
|
|
23921
|
+
_ts_decorate68([
|
|
23125
23922
|
typeorm.Column({
|
|
23126
23923
|
type: "varchar",
|
|
23127
23924
|
default: "order"
|
|
23128
23925
|
}),
|
|
23129
|
-
|
|
23926
|
+
_ts_metadata68("design:type", String)
|
|
23130
23927
|
], exports.OrderNotificationTrigger.prototype, "category", void 0);
|
|
23131
|
-
|
|
23928
|
+
_ts_decorate68([
|
|
23132
23929
|
typeorm.Column({
|
|
23133
23930
|
type: "boolean",
|
|
23134
23931
|
default: true
|
|
23135
23932
|
}),
|
|
23136
|
-
|
|
23933
|
+
_ts_metadata68("design:type", Boolean)
|
|
23137
23934
|
], exports.OrderNotificationTrigger.prototype, "enabled", void 0);
|
|
23138
|
-
|
|
23935
|
+
_ts_decorate68([
|
|
23139
23936
|
typeorm.Column({
|
|
23140
23937
|
type: "int",
|
|
23141
23938
|
default: 0
|
|
23142
23939
|
}),
|
|
23143
|
-
|
|
23940
|
+
_ts_metadata68("design:type", Number)
|
|
23144
23941
|
], exports.OrderNotificationTrigger.prototype, "sortOrder", void 0);
|
|
23145
|
-
|
|
23942
|
+
_ts_decorate68([
|
|
23146
23943
|
typeorm.CreateDateColumn(),
|
|
23147
|
-
|
|
23944
|
+
_ts_metadata68("design:type", typeof Date === "undefined" ? Object : Date)
|
|
23148
23945
|
], exports.OrderNotificationTrigger.prototype, "createdAt", void 0);
|
|
23149
|
-
|
|
23946
|
+
_ts_decorate68([
|
|
23150
23947
|
typeorm.UpdateDateColumn(),
|
|
23151
|
-
|
|
23948
|
+
_ts_metadata68("design:type", typeof Date === "undefined" ? Object : Date)
|
|
23152
23949
|
], exports.OrderNotificationTrigger.prototype, "updatedAt", void 0);
|
|
23153
|
-
exports.OrderNotificationTrigger =
|
|
23950
|
+
exports.OrderNotificationTrigger = _ts_decorate68([
|
|
23154
23951
|
typeorm.Entity("order_notification_triggers")
|
|
23155
23952
|
], exports.OrderNotificationTrigger);
|
|
23156
23953
|
|
|
@@ -23209,6 +24006,7 @@ var CMS_ENTITY_MAP = {
|
|
|
23209
24006
|
job_schedule_runs: exports.JobScheduleRun,
|
|
23210
24007
|
vendors: exports.Vendor,
|
|
23211
24008
|
vendor_users: exports.VendorUser,
|
|
24009
|
+
vendor_user_profiles: exports.VendorUserProfile,
|
|
23212
24010
|
vendor_roles: exports.VendorRole,
|
|
23213
24011
|
vendor_role_permissions: exports.VendorRolePermission,
|
|
23214
24012
|
vendor_customers: exports.VendorCustomer,
|
|
@@ -26648,16 +27446,16 @@ function whatsappPlugin(config = {}) {
|
|
|
26648
27446
|
db = await getWhatsAppSettings?.() ?? {};
|
|
26649
27447
|
} catch {
|
|
26650
27448
|
}
|
|
26651
|
-
if (!
|
|
27449
|
+
if (!chunkLMJ7RKPF_cjs.isWhatsAppPluginEnabled(db)) {
|
|
26652
27450
|
context.logger.warn("WhatsApp plugin skipped: disabled in Plugins \u2192 WhatsApp");
|
|
26653
27451
|
return null;
|
|
26654
27452
|
}
|
|
26655
|
-
const merged =
|
|
26656
|
-
if (!getWhatsAppSettings && !
|
|
27453
|
+
const merged = chunkLMJ7RKPF_cjs.mergeWhatsAppConfigLayers(env, db, staticRest);
|
|
27454
|
+
if (!getWhatsAppSettings && !chunkLMJ7RKPF_cjs.whatsAppConfigured(merged)) {
|
|
26657
27455
|
context.logger.warn("WhatsApp plugin skipped: set WHATSAPP_ACCESS_TOKEN and WHATSAPP_PHONE_NUMBER_ID, or pass getWhatsAppSettings");
|
|
26658
27456
|
return null;
|
|
26659
27457
|
}
|
|
26660
|
-
const svc = new
|
|
27458
|
+
const svc = new chunkLMJ7RKPF_cjs.WhatsAppService(env, staticRest, getWhatsAppSettings, getMessageTemplateRow);
|
|
26661
27459
|
return {
|
|
26662
27460
|
send: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((opts) => svc.send(opts), "send")
|
|
26663
27461
|
};
|
|
@@ -26734,7 +27532,7 @@ function registerMessagingQueueProcessors(cms, entityMap) {
|
|
|
26734
27532
|
getDataSource: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name(async () => cms.dataSource, "getDataSource"),
|
|
26735
27533
|
entityMap
|
|
26736
27534
|
});
|
|
26737
|
-
|
|
27535
|
+
chunkLMJ7RKPF_cjs.registerWhatsAppQueueProcessor(cms);
|
|
26738
27536
|
}
|
|
26739
27537
|
chunkUSNT2KNT_cjs.__name(registerMessagingQueueProcessors, "registerMessagingQueueProcessors");
|
|
26740
27538
|
async function ensureMessagingPluginsOnCms(base, options) {
|
|
@@ -26763,7 +27561,7 @@ async function ensureMessagingPluginsOnCms(base, options) {
|
|
|
26763
27561
|
}
|
|
26764
27562
|
if (!cms.getPlugin("email")) {
|
|
26765
27563
|
try {
|
|
26766
|
-
const instance = await
|
|
27564
|
+
const instance = await chunkLMJ7RKPF_cjs.emailPlugin({
|
|
26767
27565
|
type: "SMTP",
|
|
26768
27566
|
from: config.SMTP_FROM ?? "no-reply@localhost",
|
|
26769
27567
|
to: config.SMTP_TO ?? ""
|
|
@@ -26804,7 +27602,7 @@ function messagingPlugins(options) {
|
|
|
26804
27602
|
const config = options.config ?? (typeof process !== "undefined" ? process.env : {});
|
|
26805
27603
|
return [
|
|
26806
27604
|
queuePlugin(),
|
|
26807
|
-
|
|
27605
|
+
chunkLMJ7RKPF_cjs.emailPlugin({
|
|
26808
27606
|
type: "SMTP",
|
|
26809
27607
|
from: config.SMTP_FROM ?? "no-reply@localhost",
|
|
26810
27608
|
to: config.SMTP_TO ?? ""
|
|
@@ -26938,7 +27736,7 @@ function createCmsApiHandler(config) {
|
|
|
26938
27736
|
} : void 0;
|
|
26939
27737
|
const entityMap = withLlmKnowledgeEntityFallbacks(rawEntityMap);
|
|
26940
27738
|
if (getCms) {
|
|
26941
|
-
|
|
27739
|
+
chunkLMJ7RKPF_cjs.initWhatsappTriggerDispatcher({
|
|
26942
27740
|
dataSource,
|
|
26943
27741
|
entityMap,
|
|
26944
27742
|
getCms
|
|
@@ -26951,7 +27749,7 @@ function createCmsApiHandler(config) {
|
|
|
26951
27749
|
] : baseCrudResources;
|
|
26952
27750
|
const requireEntityPermissionEffective = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name(async (_req, entity, action) => {
|
|
26953
27751
|
if (!resolveSessionUser) {
|
|
26954
|
-
|
|
27752
|
+
chunk77NUXO6A_cjs.logRbac("requireEntityPermission: getSessionUser not passed \u2014 vendor store APIs may 403", {
|
|
26955
27753
|
entity,
|
|
26956
27754
|
action,
|
|
26957
27755
|
hint: "Pass getSessionUser: auth.getAuthenticatedUser from createCmsAuthBundle()"
|
|
@@ -26961,7 +27759,7 @@ function createCmsApiHandler(config) {
|
|
|
26961
27759
|
const raw = await resolveSessionUser();
|
|
26962
27760
|
const u = await hydrateVendorSessionUser(dataSource, raw);
|
|
26963
27761
|
if (!u?.email) {
|
|
26964
|
-
|
|
27762
|
+
chunk77NUXO6A_cjs.logRbac("requireEntityPermission: no session user", {
|
|
26965
27763
|
entity,
|
|
26966
27764
|
action
|
|
26967
27765
|
});
|
|
@@ -26971,13 +27769,13 @@ function createCmsApiHandler(config) {
|
|
|
26971
27769
|
status: 401
|
|
26972
27770
|
});
|
|
26973
27771
|
}
|
|
26974
|
-
const allowed =
|
|
26975
|
-
await
|
|
27772
|
+
const allowed = chunkVUQFARRT_cjs.sessionHasEntityAccess(u, entity, action);
|
|
27773
|
+
await chunk77NUXO6A_cjs.logEntityAccessDecision(dataSource, "cmsApi.requireEntityPermission", u, entity, action, {
|
|
26976
27774
|
allowed,
|
|
26977
27775
|
resolvePath: "hydrated_session"
|
|
26978
27776
|
});
|
|
26979
27777
|
if (allowed) return null;
|
|
26980
|
-
const { reason } =
|
|
27778
|
+
const { reason } = chunk77NUXO6A_cjs.explainSessionEntityAccess(u, entity, action);
|
|
26981
27779
|
return config.json({
|
|
26982
27780
|
error: "Forbidden",
|
|
26983
27781
|
entity,
|
|
@@ -26988,7 +27786,7 @@ function createCmsApiHandler(config) {
|
|
|
26988
27786
|
});
|
|
26989
27787
|
}
|
|
26990
27788
|
if (userRequireEntityPermission) {
|
|
26991
|
-
|
|
27789
|
+
chunk77NUXO6A_cjs.logRbac("requireEntityPermission: using app callback only (no getSessionUser)", {
|
|
26992
27790
|
entity,
|
|
26993
27791
|
action
|
|
26994
27792
|
});
|
|
@@ -27075,10 +27873,10 @@ function createCmsApiHandler(config) {
|
|
|
27075
27873
|
getVendorScope: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name(async () => {
|
|
27076
27874
|
const multiVendorEnabled = await checkMultiVendorEnabled(dataSource);
|
|
27077
27875
|
if (!multiVendorEnabled) {
|
|
27078
|
-
return
|
|
27876
|
+
return chunk77NUXO6A_cjs.resolveDisabledMultiVendorScope(dataSource);
|
|
27079
27877
|
}
|
|
27080
27878
|
const u = await hydrateVendorSessionUser(dataSource, await resolveSessionUser());
|
|
27081
|
-
return
|
|
27879
|
+
return chunk77NUXO6A_cjs.resolveVendorScopeFromSessionUser(u ?? null);
|
|
27082
27880
|
}, "getVendorScope"),
|
|
27083
27881
|
getHydratedSessionUser: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name(async () => {
|
|
27084
27882
|
const u = await hydrateVendorSessionUser(dataSource, await resolveSessionUser());
|
|
@@ -27106,9 +27904,7 @@ function createCmsApiHandler(config) {
|
|
|
27106
27904
|
getSessionUser: getHydratedSessionUser,
|
|
27107
27905
|
baseUrl: vendorOnboardBaseUrl,
|
|
27108
27906
|
getCms,
|
|
27109
|
-
hashPassword: userAuth?.hashPassword
|
|
27110
|
-
minPasswordLength: 6
|
|
27111
|
-
});
|
|
27907
|
+
hashPassword: userAuth?.hashPassword});
|
|
27112
27908
|
const vendorRolesHandlers = getHydratedSessionUser && createVendorRolesHandlers({
|
|
27113
27909
|
dataSource,
|
|
27114
27910
|
entityMap,
|
|
@@ -27148,10 +27944,30 @@ function createCmsApiHandler(config) {
|
|
|
27148
27944
|
const zipExtractPost = uploadMerged ? createMediaZipExtractHandler(uploadMerged) : null;
|
|
27149
27945
|
const blogBySlugGet = blogBySlug ? createBlogBySlugHandler(blogBySlug) : null;
|
|
27150
27946
|
const formBySlugGet = formBySlug ? createFormBySlugHandler(formBySlug) : null;
|
|
27151
|
-
const
|
|
27152
|
-
|
|
27153
|
-
|
|
27154
|
-
|
|
27947
|
+
const formSaveResolved = formSaveConfig ?? {
|
|
27948
|
+
dataSource,
|
|
27949
|
+
entityMap,
|
|
27950
|
+
json: config.json,
|
|
27951
|
+
requireAuth: config.requireAuth
|
|
27952
|
+
};
|
|
27953
|
+
const formSaveHandlers = createFormSaveHandlers(mergePerm(formSaveResolved) ?? formSaveResolved);
|
|
27954
|
+
const formSubmissionResolved = formSubmissionConfig ?? {
|
|
27955
|
+
dataSource,
|
|
27956
|
+
entityMap,
|
|
27957
|
+
json: config.json,
|
|
27958
|
+
getCms,
|
|
27959
|
+
getCompanyDetails: config.getCompanyDetails,
|
|
27960
|
+
getRecipientForChannel: config.getRecipientForChannel
|
|
27961
|
+
};
|
|
27962
|
+
const formSubmissionPost = createFormSubmissionHandler(formSubmissionResolved);
|
|
27963
|
+
const formSubmissionGetByIdResolved = formSubmissionGetByIdConfig ?? {
|
|
27964
|
+
dataSource,
|
|
27965
|
+
entityMap,
|
|
27966
|
+
json: config.json,
|
|
27967
|
+
requireAuth: config.requireAuth
|
|
27968
|
+
};
|
|
27969
|
+
const formSubmissionGetById = createFormSubmissionGetByIdHandler(mergePerm(formSubmissionGetByIdResolved) ?? formSubmissionGetByIdResolved);
|
|
27970
|
+
const formSubmissionList = createFormSubmissionListHandler(mergePerm(formSubmissionGetByIdResolved) ?? formSubmissionGetByIdResolved);
|
|
27155
27971
|
const usersApiMerged = usersApi && getCms ? {
|
|
27156
27972
|
...usersApi,
|
|
27157
27973
|
getCms: usersApi.getCms ?? getCms,
|
|
@@ -27346,7 +28162,19 @@ function createCmsApiHandler(config) {
|
|
|
27346
28162
|
status: 404
|
|
27347
28163
|
});
|
|
27348
28164
|
}
|
|
28165
|
+
if (path2[0] === "admin" && path2[1] === "vendor" && path2[2] === "team-invite" && vendorHandlers) {
|
|
28166
|
+
if (path2.length === 3 && m === "GET") return vendorHandlers.validateTeamInvite(req);
|
|
28167
|
+
if (path2.length === 3 && m === "POST") return vendorHandlers.acceptTeamInvite(req);
|
|
28168
|
+
return config.json({
|
|
28169
|
+
error: "Not found"
|
|
28170
|
+
}, {
|
|
28171
|
+
status: 404
|
|
28172
|
+
});
|
|
28173
|
+
}
|
|
27349
28174
|
if (path2[0] === "admin" && path2[1] === "vendor" && path2[2] === "team" && vendorHandlers) {
|
|
28175
|
+
if (path2.length === 4 && path2[3] === "send-invite" && m === "POST") {
|
|
28176
|
+
return vendorHandlers.sendTeamInviteEmail(req);
|
|
28177
|
+
}
|
|
27350
28178
|
if (path2.length === 3 && m === "GET") return vendorHandlers.listTeam();
|
|
27351
28179
|
if (path2.length === 3 && m === "POST") return vendorHandlers.addTeamMember(req);
|
|
27352
28180
|
if (path2.length === 4 && m === "PATCH") return vendorHandlers.updateTeamMemberRole(req, path2[3]);
|
|
@@ -28366,7 +29194,7 @@ function createCmsApiHandler(config) {
|
|
|
28366
29194
|
let vendorId = null;
|
|
28367
29195
|
if (resolveSessionUser) {
|
|
28368
29196
|
const u = await hydrateVendorSessionUser(dataSource, await resolveSessionUser());
|
|
28369
|
-
const scope =
|
|
29197
|
+
const scope = chunk77NUXO6A_cjs.resolveVendorScopeFromSessionUser(u ?? null);
|
|
28370
29198
|
if (scope.type === "vendor") vendorId = scope.vendorId;
|
|
28371
29199
|
}
|
|
28372
29200
|
const result = await validateCoupon(dataSource, entityMap, couponCode, orderLinesNorm, currency, contactId, isAutomatic, discountId ?? void 0, vendorId);
|
|
@@ -28446,7 +29274,7 @@ function createCmsApiHandler(config) {
|
|
|
28446
29274
|
let vendorId = null;
|
|
28447
29275
|
if (resolveSessionUser) {
|
|
28448
29276
|
const u = await hydrateVendorSessionUser(dataSource, await resolveSessionUser());
|
|
28449
|
-
const scope =
|
|
29277
|
+
const scope = chunk77NUXO6A_cjs.resolveVendorScopeFromSessionUser(u ?? null);
|
|
28450
29278
|
if (scope.type === "vendor") vendorId = scope.vendorId;
|
|
28451
29279
|
}
|
|
28452
29280
|
const orderLinesNorm = normalizeOrderLinesInput(body?.orderLines);
|
|
@@ -28652,7 +29480,7 @@ function createCmsApiHandler(config) {
|
|
|
28652
29480
|
status: 400
|
|
28653
29481
|
});
|
|
28654
29482
|
}
|
|
28655
|
-
const { resendOrderNotification } = await import('./order-notification-dispatcher-
|
|
29483
|
+
const { resendOrderNotification } = await import('./order-notification-dispatcher-6XSU3AR7.cjs');
|
|
28656
29484
|
const result = await resendOrderNotification(triggerKey, orderId, {
|
|
28657
29485
|
dataSource,
|
|
28658
29486
|
entityMap,
|
|
@@ -28752,7 +29580,7 @@ function createCmsApiHandler(config) {
|
|
|
28752
29580
|
status: "cancelled"
|
|
28753
29581
|
});
|
|
28754
29582
|
const fireOrderCancelledNotification = /* @__PURE__ */ chunkUSNT2KNT_cjs.__name((refundAmount) => {
|
|
28755
|
-
void import('./emit-order-notification-trigger-
|
|
29583
|
+
void import('./emit-order-notification-trigger-NASG7ZEO.cjs').then(({ fireOrderNotificationTrigger }) => {
|
|
28756
29584
|
fireOrderNotificationTrigger("order_cancelled", orderId, {
|
|
28757
29585
|
dataSource,
|
|
28758
29586
|
entityMap
|
|
@@ -29084,7 +29912,7 @@ function createCmsApiHandler(config) {
|
|
|
29084
29912
|
if (resolveSessionUser) {
|
|
29085
29913
|
const raw = await resolveSessionUser();
|
|
29086
29914
|
const u = await hydrateVendorSessionUser(dataSource, raw);
|
|
29087
|
-
const scope =
|
|
29915
|
+
const scope = chunk77NUXO6A_cjs.resolveVendorScopeFromSessionUser(u ?? null);
|
|
29088
29916
|
if (scope.type === "vendor") {
|
|
29089
29917
|
scopedVendorIds = scope.vendorIds;
|
|
29090
29918
|
}
|
|
@@ -29785,20 +30613,12 @@ function createStorefrontApiHandler(config) {
|
|
|
29785
30613
|
const otpPepper = config.otpPepper;
|
|
29786
30614
|
const defaultPhoneCc = config.defaultPhoneCountryCode;
|
|
29787
30615
|
function fireOrderPlacedNotification(orderId) {
|
|
29788
|
-
void import('./emit-order-notification-trigger-
|
|
30616
|
+
void import('./emit-order-notification-trigger-NASG7ZEO.cjs').then(({ fireOrderNotificationTrigger }) => {
|
|
29789
30617
|
fireOrderNotificationTrigger("order_placed", orderId, {
|
|
29790
30618
|
dataSource,
|
|
29791
30619
|
entityMap
|
|
29792
30620
|
});
|
|
29793
30621
|
}).catch((err) => console.error("[notification-triggers] import failed", err));
|
|
29794
|
-
if (!getCms) return;
|
|
29795
|
-
void import('./send-order-placed-emails-B5ZVJT7T.cjs').then(({ sendOrderPlacedEmailsAfterConfirmation }) => {
|
|
29796
|
-
return sendOrderPlacedEmailsAfterConfirmation(orderId, {
|
|
29797
|
-
getDataSource: /* @__PURE__ */ chunkUSNT2KNT_cjs.__name(async () => dataSource, "getDataSource"),
|
|
29798
|
-
entityMap,
|
|
29799
|
-
getCms
|
|
29800
|
-
});
|
|
29801
|
-
}).catch((err) => console.error("[order-emails] sendOrderPlacedEmailsAfterConfirmation failed", err));
|
|
29802
30622
|
}
|
|
29803
30623
|
chunkUSNT2KNT_cjs.__name(fireOrderPlacedNotification, "fireOrderPlacedNotification");
|
|
29804
30624
|
const otpAllowPhoneLogin = config.otpAllowPhoneLogin !== false;
|
|
@@ -32201,7 +33021,6 @@ function createStorefrontApiHandler(config) {
|
|
|
32201
33021
|
}));
|
|
32202
33022
|
}
|
|
32203
33023
|
await linkOrderContactToVendors(contactId, vendorRes.vendorIds);
|
|
32204
|
-
fireOrderPlacedNotification(oid);
|
|
32205
33024
|
return json({
|
|
32206
33025
|
orderId: oid,
|
|
32207
33026
|
orderNumber: ord.orderNumber,
|
|
@@ -32278,7 +33097,6 @@ function createStorefrontApiHandler(config) {
|
|
|
32278
33097
|
cartId: cart.id
|
|
32279
33098
|
});
|
|
32280
33099
|
await cartRepo().delete(cart.id);
|
|
32281
|
-
fireOrderPlacedNotification(oid);
|
|
32282
33100
|
return json({
|
|
32283
33101
|
orderId: oid,
|
|
32284
33102
|
orderNumber: ord.orderNumber,
|