@infuro/cms-core 1.0.66 → 1.0.68
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 +214 -32
- package/dist/admin.js +214 -32
- package/dist/api.cjs +45 -42
- package/dist/api.js +12 -9
- package/dist/auth.cjs +51 -51
- package/dist/auth.js +3 -3
- package/dist/{chunk-QYRXLURF.cjs → chunk-22XKONB5.cjs} +640 -145
- package/dist/{chunk-MVHDC3XF.js → chunk-5NOZSG6J.js} +22 -11
- package/dist/{chunk-TU23GJPJ.js → chunk-7JCCPQEF.js} +1 -1
- package/dist/{chunk-WMMZZRDJ.cjs → chunk-GN4LKG4V.cjs} +1 -1
- package/dist/{chunk-KM2I6AFP.cjs → chunk-HBUV73RB.cjs} +9 -9
- package/dist/chunk-IKTBZJHT.js +16 -0
- package/dist/chunk-M5GPOPGX.cjs +49 -0
- package/dist/{chunk-T33KU5G5.js → chunk-MYUGQHU4.js} +548 -53
- package/dist/{chunk-NV5IRHI3.js → chunk-N4LBZXBG.js} +2 -2
- package/dist/{chunk-J7FMZK66.cjs → chunk-O4AFPDQ4.cjs} +22 -11
- package/dist/{chunk-4U6DATGZ.cjs → chunk-OV5TRZET.cjs} +7 -7
- package/dist/chunk-P6S4XFZO.cjs +18 -0
- package/dist/{chunk-RCE5SJBA.js → chunk-SKJH7PX4.js} +1 -1
- package/dist/{chunk-5MZFQRDW.cjs → chunk-SMHQV3WL.cjs} +4 -4
- package/dist/chunk-SUUD7OUG.cjs +455 -0
- package/dist/{chunk-XFDIIVZB.cjs → chunk-UMC7W5G3.cjs} +3 -3
- package/dist/chunk-WKDBMDUX.js +45 -0
- package/dist/{chunk-6DBDJ4VD.js → chunk-Z5G54EGD.js} +2 -2
- package/dist/chunk-Z5OB5QGN.js +465 -0
- package/dist/chunk-ZIT4IP6N.js +445 -0
- package/dist/chunk-ZX5U3VCB.cjs +471 -0
- package/dist/{chunk-NR44CK5E.js → chunk-ZY64VJMS.js} +1 -1
- package/dist/email-queue-3QBQ63F7.js +8 -0
- package/dist/{email-queue-4OY45JIU.cjs → email-queue-K4E4OFI7.cjs} +9 -6
- package/dist/{emit-order-notification-trigger-ZD5YN3JM.cjs → emit-order-notification-trigger-ROASTYQP.cjs} +3 -3
- package/dist/{emit-order-notification-trigger-EJJZ6XTS.js → emit-order-notification-trigger-YUQTPELC.js} +1 -1
- package/dist/{erp-order-invoice-YUSPZ7CE.cjs → erp-order-invoice-AZ5MX2JB.cjs} +8 -5
- package/dist/{erp-order-invoice-H6HCJ7YS.js → erp-order-invoice-XSYHAMBS.js} +4 -1
- package/dist/generate-local-invoice-pdf-BQTCL5MW.cjs +12 -0
- package/dist/generate-local-invoice-pdf-OCFG47SE.js +3 -0
- package/dist/index.cjs +337 -330
- package/dist/index.d.cts +21 -2
- package/dist/index.d.ts +21 -2
- package/dist/index.js +18 -15
- package/dist/invoice-templates-GZ33OENC.js +2 -0
- package/dist/invoice-templates-RB462AQN.cjs +19 -0
- package/dist/migrations/1783300000000-CreateOrderAssigneesTable.ts +43 -0
- package/dist/{order-assignees-handlers-NPKD64P6.cjs → order-assignees-handlers-KF7RMTV5.cjs} +77 -8
- package/dist/{order-assignees-handlers-LKMAGLG6.js → order-assignees-handlers-L3RVKUBS.js} +77 -8
- package/dist/{order-completion-otp-handlers-NK65LOLV.cjs → order-completion-otp-handlers-DDQREULW.cjs} +75 -18
- package/dist/{order-completion-otp-handlers-LFRHXWK4.js → order-completion-otp-handlers-NROWBGXN.js} +73 -16
- package/dist/{order-notification-dispatcher-LL7ETKLU.cjs → order-notification-dispatcher-6HCJ6Q75.cjs} +12 -9
- package/dist/{order-notification-dispatcher-ECPFI7CD.js → order-notification-dispatcher-KM2SY7TX.js} +7 -4
- package/dist/{rbac-debug-db-5R6XFPSV.js → rbac-debug-db-DFZWZ6GV.js} +1 -1
- package/dist/{rbac-debug-db-JKK2MCWF.cjs → rbac-debug-db-KWV7D5PQ.cjs} +2 -2
- package/dist/resolve-invoice-asset-url-JEZRENJW.cjs +11 -0
- package/dist/resolve-invoice-asset-url-QZ2FRDHI.js +2 -0
- package/package.json +1 -1
- package/dist/chunk-GLD263KW.cjs +0 -862
- package/dist/chunk-OPJEV44S.js +0 -847
- package/dist/email-queue-HGXB2FIS.js +0 -5
|
@@ -190,23 +190,34 @@ function canOnboardVendors(user) {
|
|
|
190
190
|
}
|
|
191
191
|
__name(canOnboardVendors, "canOnboardVendors");
|
|
192
192
|
function resolveVendorScopeFromSessionUser(user) {
|
|
193
|
-
if (!user?.email)
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
193
|
+
if (!user?.email) {
|
|
194
|
+
console.log("[ORDERS-DEBUG][RESOLVE_VENDOR_SCOPE] No user email -> deny");
|
|
195
|
+
return {
|
|
196
|
+
type: "deny"
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
if (isPlatformAdministrator(user)) {
|
|
200
|
+
console.log("[ORDERS-DEBUG][RESOLVE_VENDOR_SCOPE] User is Platform Admin -> all");
|
|
201
|
+
return {
|
|
202
|
+
type: "all"
|
|
203
|
+
};
|
|
204
|
+
}
|
|
199
205
|
const vendorIds = user.vendorIds ?? [];
|
|
200
|
-
if (vendorIds.length === 0)
|
|
201
|
-
|
|
202
|
-
|
|
206
|
+
if (vendorIds.length === 0) {
|
|
207
|
+
console.log("[ORDERS-DEBUG][RESOLVE_VENDOR_SCOPE] User has 0 vendorIds -> deny. User:", user.email);
|
|
208
|
+
return {
|
|
209
|
+
type: "deny"
|
|
210
|
+
};
|
|
211
|
+
}
|
|
203
212
|
const preferred = user.activeVendorId ?? vendorIds[0];
|
|
204
213
|
const vendorId = vendorIds.includes(preferred) ? preferred : vendorIds[0];
|
|
205
|
-
|
|
214
|
+
const res = {
|
|
206
215
|
type: "vendor",
|
|
207
216
|
vendorId,
|
|
208
217
|
vendorIds
|
|
209
218
|
};
|
|
219
|
+
console.log("[ORDERS-DEBUG][RESOLVE_VENDOR_SCOPE] User:", user.email, "-> scope:", res);
|
|
220
|
+
return res;
|
|
210
221
|
}
|
|
211
222
|
__name(resolveVendorScopeFromSessionUser, "resolveVendorScopeFromSessionUser");
|
|
212
223
|
function vendorPortalFlagsFromUser(input) {
|
|
@@ -612,7 +623,7 @@ async function logEntityAccessDecision(dataSource, context, user, entity, action
|
|
|
612
623
|
const id = Number(user.id);
|
|
613
624
|
if (Number.isFinite(id)) {
|
|
614
625
|
try {
|
|
615
|
-
const { loadDbPermissionsForUser } = await import('./rbac-debug-db-
|
|
626
|
+
const { loadDbPermissionsForUser } = await import('./rbac-debug-db-DFZWZ6GV.js');
|
|
616
627
|
dbPermissions = await loadDbPermissionsForUser(dataSource, id);
|
|
617
628
|
} catch (e) {
|
|
618
629
|
dbPermissions = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isOrderEligibleForInvoiceEmail, resolveOrderInvoicePdfBytes } from './chunk-
|
|
1
|
+
import { isOrderEligibleForInvoiceEmail, resolveOrderInvoicePdfBytes } from './chunk-ZIT4IP6N.js';
|
|
2
2
|
import { __name } from './chunk-SHUYVCID.js';
|
|
3
3
|
|
|
4
4
|
// src/plugins/email/email-queue.ts
|
|
@@ -96,7 +96,7 @@ async function emitOrderNotificationTrigger(triggerKey, orderId, deps, extra) {
|
|
|
96
96
|
orderId
|
|
97
97
|
});
|
|
98
98
|
try {
|
|
99
|
-
const { dispatchOrderNotificationDirectly } = await import('./order-notification-dispatcher-
|
|
99
|
+
const { dispatchOrderNotificationDirectly } = await import('./order-notification-dispatcher-6HCJ6Q75.cjs');
|
|
100
100
|
await dispatchOrderNotificationDirectly(triggerKey, triggerPayload, deps.dataSource, deps.entityMap);
|
|
101
101
|
} catch (err) {
|
|
102
102
|
chunkPA6YDMFZ_cjs.notifyLog.error("TRIGGER", "direct dispatch failed", {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkOV5TRZET_cjs = require('./chunk-OV5TRZET.cjs');
|
|
4
|
+
var chunkO4AFPDQ4_cjs = require('./chunk-O4AFPDQ4.cjs');
|
|
4
5
|
var chunkOY2YTBMP_cjs = require('./chunk-OY2YTBMP.cjs');
|
|
5
|
-
var chunkJ7FMZK66_cjs = require('./chunk-J7FMZK66.cjs');
|
|
6
6
|
var chunk7L6KWI7S_cjs = require('./chunk-7L6KWI7S.cjs');
|
|
7
7
|
var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
|
|
8
8
|
var _CredentialsProvider = require('next-auth/providers/credentials');
|
|
@@ -15,12 +15,12 @@ var _GoogleProvider__default = /*#__PURE__*/_interopDefault(_GoogleProvider);
|
|
|
15
15
|
|
|
16
16
|
// src/auth/seed-permissions.ts
|
|
17
17
|
async function seedAdministratorPermissions(dataSource, entityMap) {
|
|
18
|
-
const entities =
|
|
18
|
+
const entities = chunkO4AFPDQ4_cjs.getPermissionableEntityKeys(entityMap);
|
|
19
19
|
const groupRepo = dataSource.getRepository(entityMap.user_groups);
|
|
20
20
|
const permRepo = dataSource.getRepository(entityMap.permissions);
|
|
21
21
|
const adminGroup = await groupRepo.findOne({
|
|
22
22
|
where: {
|
|
23
|
-
name:
|
|
23
|
+
name: chunkO4AFPDQ4_cjs.ADMIN_GROUP_NAME,
|
|
24
24
|
deleted: false
|
|
25
25
|
}
|
|
26
26
|
});
|
|
@@ -260,13 +260,13 @@ async function createCustomerUserFromGoogleOAuth(input) {
|
|
|
260
260
|
}
|
|
261
261
|
if (input.entityMap.contacts) {
|
|
262
262
|
try {
|
|
263
|
-
await
|
|
263
|
+
await chunkOV5TRZET_cjs.linkUnclaimedContactToUser(input.dataSource, input.entityMap.contacts, userId, email);
|
|
264
264
|
} catch {
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
267
|
if (input.entityMap.customer) {
|
|
268
268
|
try {
|
|
269
|
-
await
|
|
269
|
+
await chunkOV5TRZET_cjs.ensureCustomerForUser(input.dataSource, input.entityMap.customer, {
|
|
270
270
|
id: userId,
|
|
271
271
|
name: displayName,
|
|
272
272
|
email,
|
|
@@ -387,18 +387,18 @@ async function checkMultiVendorEnabledViaSettingsApi() {
|
|
|
387
387
|
chunkUSNT2KNT_cjs.__name(checkMultiVendorEnabledViaSettingsApi, "checkMultiVendorEnabledViaSettingsApi");
|
|
388
388
|
function sessionUserFromNextAuthUser(user) {
|
|
389
389
|
const g = user.group;
|
|
390
|
-
const isRBACAdmin =
|
|
390
|
+
const isRBACAdmin = chunkO4AFPDQ4_cjs.isSuperAdmin({
|
|
391
391
|
groupId: user.groupId ?? void 0,
|
|
392
392
|
groupName: g?.name,
|
|
393
393
|
isRBACAdmin: false
|
|
394
394
|
});
|
|
395
|
-
const entityPerms =
|
|
395
|
+
const entityPerms = chunkO4AFPDQ4_cjs.permissionRowsToRecord(g?.permissions);
|
|
396
396
|
const rawAdminAccess = user.adminAccess;
|
|
397
397
|
const adminAccess = rawAdminAccess === true ? true : rawAdminAccess === false ? false : void 0;
|
|
398
398
|
const vendorIds = user.vendorIds ?? [];
|
|
399
399
|
const vendorRole = user.vendorRole ?? null;
|
|
400
400
|
const isVendorRoleOwner = user.isVendorRoleOwner ?? false;
|
|
401
|
-
const { isVendorPortal, isVendorOwner: isVendorOwner2 } =
|
|
401
|
+
const { isVendorPortal, isVendorOwner: isVendorOwner2 } = chunkO4AFPDQ4_cjs.vendorPortalFlagsFromUser({
|
|
402
402
|
email: user.email,
|
|
403
403
|
isRBACAdmin,
|
|
404
404
|
groupName: g?.name,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { __name } from './chunk-SHUYVCID.js';
|
|
2
|
+
|
|
3
|
+
// src/lib/invoice/resolve-invoice-asset-url.ts
|
|
4
|
+
function resolveInvoiceAssetUrl(raw) {
|
|
5
|
+
const t = String(raw ?? "").trim();
|
|
6
|
+
if (!t) return null;
|
|
7
|
+
if (/^https?:\/\//i.test(t)) return t;
|
|
8
|
+
if (t.startsWith("//")) return `https:${t}`;
|
|
9
|
+
const base = (process.env.CMS_PUBLIC_URL || process.env.NEXT_PUBLIC_SITE_URL || process.env.NEXTAUTH_URL || "").trim().replace(/\/+$/, "");
|
|
10
|
+
if (!base) return null;
|
|
11
|
+
if (t.startsWith("/")) return `${base}${t}`;
|
|
12
|
+
return `${base}/${t}`;
|
|
13
|
+
}
|
|
14
|
+
__name(resolveInvoiceAssetUrl, "resolveInvoiceAssetUrl");
|
|
15
|
+
|
|
16
|
+
export { resolveInvoiceAssetUrl };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkUSNT2KNT_cjs = require('./chunk-USNT2KNT.cjs');
|
|
4
|
+
|
|
5
|
+
// src/lib/invoice/invoice-templates.ts
|
|
6
|
+
var INVOICE_TEMPLATE_IDS = [
|
|
7
|
+
"classic",
|
|
8
|
+
"modern",
|
|
9
|
+
"compact",
|
|
10
|
+
"bold",
|
|
11
|
+
"service_detailed"
|
|
12
|
+
];
|
|
13
|
+
var INVOICE_TEMPLATE_OPTIONS = [
|
|
14
|
+
{
|
|
15
|
+
id: "classic",
|
|
16
|
+
label: "Classic",
|
|
17
|
+
description: "Traditional invoice with header, lined items, and totals footer."
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: "modern",
|
|
21
|
+
label: "Modern",
|
|
22
|
+
description: "Clean layout with accent bar and spacious typography."
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: "compact",
|
|
26
|
+
label: "Compact",
|
|
27
|
+
description: "Dense single-page layout for high line-item counts."
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: "bold",
|
|
31
|
+
label: "Bold",
|
|
32
|
+
description: "Strong header band and clear payment summary block."
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
id: "service_detailed",
|
|
36
|
+
label: "Service Detailed",
|
|
37
|
+
description: "Detailed service invoice with order date, service date, time slot, and assigned technician."
|
|
38
|
+
}
|
|
39
|
+
];
|
|
40
|
+
function normalizeInvoiceTemplateId(raw) {
|
|
41
|
+
const v = String(raw ?? "").trim().toLowerCase();
|
|
42
|
+
if (v === "service_qr") return "service_detailed";
|
|
43
|
+
return INVOICE_TEMPLATE_IDS.includes(v) ? v : "classic";
|
|
44
|
+
}
|
|
45
|
+
chunkUSNT2KNT_cjs.__name(normalizeInvoiceTemplateId, "normalizeInvoiceTemplateId");
|
|
46
|
+
|
|
47
|
+
exports.INVOICE_TEMPLATE_IDS = INVOICE_TEMPLATE_IDS;
|
|
48
|
+
exports.INVOICE_TEMPLATE_OPTIONS = INVOICE_TEMPLATE_OPTIONS;
|
|
49
|
+
exports.normalizeInvoiceTemplateId = normalizeInvoiceTemplateId;
|