@infuro/cms-core 1.0.46 → 1.0.50
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/README.md +30 -16
- package/dist/admin.cjs +4568 -2716
- package/dist/admin.d.cts +18 -4
- package/dist/admin.d.ts +18 -4
- package/dist/admin.js +3475 -1625
- package/dist/api.cjs +38 -39
- package/dist/api.d.cts +9 -3
- package/dist/api.d.ts +9 -3
- package/dist/api.js +6 -7
- package/dist/auth.cjs +84 -51
- package/dist/auth.d.cts +105 -4
- package/dist/auth.d.ts +105 -4
- package/dist/auth.js +4 -3
- package/dist/chunk-2IAXTKQN.cjs +19 -0
- package/dist/chunk-3EOM4V2M.cjs +452 -0
- package/dist/{chunk-X6UQFV4X.cjs → chunk-77NUXO6A.cjs} +14 -12
- package/dist/{chunk-KFFB6EMZ.js → chunk-AYERBA7I.js} +3 -7
- package/dist/chunk-EIZKW2PF.js +13 -0
- package/dist/{chunk-CRYKVJTO.js → chunk-IPDHT2UV.js} +1420 -3
- package/dist/{chunk-UDVLFVEC.cjs → chunk-JCMOOPNX.cjs} +3820 -2907
- 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-UKC3HYXI.js → chunk-LT2WOPKA.js} +3733 -2813
- package/dist/chunk-RK5ETF2I.js +434 -0
- package/dist/{chunk-SPQFNIYJ.cjs → chunk-TJ2MIQUT.cjs} +3 -7
- package/dist/{chunk-TCSGFAWB.cjs → chunk-UUWAUHUW.cjs} +1451 -3
- package/dist/{chunk-57O3HZPG.js → chunk-WRKV6MHB.js} +415 -3
- package/dist/{chunk-FBKDMRQL.cjs → chunk-YV5PK4JW.cjs} +427 -7
- package/dist/cli.cjs +13 -22
- package/dist/cli.js +13 -22
- 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-DU7V3YND.cjs} +9 -9
- package/dist/{event-order-defaults-SDRNAZHC.js → event-order-defaults-H4RT7NMR.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 +479 -339
- package/dist/index.d.cts +181 -20
- package/dist/index.d.ts +181 -20
- package/dist/index.js +115 -13
- package/dist/migrations/1782200000000-VendorTeamProfiles.ts +233 -0
- package/dist/migrations/1782300000000-AddTypeToOrderNotificationBindings.ts +75 -0
- package/dist/migrations/1782400000000-CreateUserDeviceTokens.ts +36 -0
- package/dist/migrations/1782500000000-AddPushToOrderNotificationBindingsChannelEnum.ts +15 -0
- package/dist/{order-notification-dispatcher-ZJZB2HUN.js → order-notification-dispatcher-3TA4ETYJ.js} +1 -2
- package/dist/{order-notification-dispatcher-SBQAMM5V.cjs → order-notification-dispatcher-ZEAZ5SHV.cjs} +7 -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-NBY4NVTY.cjs +0 -182
- package/dist/chunk-SF2XKMCI.js +0 -171
- 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
|
@@ -59,6 +59,7 @@ async function emitOrderNotificationTrigger(triggerKey, orderId, deps, extra) {
|
|
|
59
59
|
total: fo.total ?? 0,
|
|
60
60
|
currency: String(fo.currency ?? "INR"),
|
|
61
61
|
vendorId: fo.vendorId ?? null,
|
|
62
|
+
...extra?.extraVariables ?? {},
|
|
62
63
|
...extra?.refundAmount != null ? {
|
|
63
64
|
refundAmount: extra.refundAmount
|
|
64
65
|
} : {}
|
|
@@ -48,12 +48,13 @@ __name(getPermissionableEntityKeys, "getPermissionableEntityKeys");
|
|
|
48
48
|
function permissionRowsToRecord(rows) {
|
|
49
49
|
const out = {};
|
|
50
50
|
if (!rows?.length) return out;
|
|
51
|
+
const flag = /* @__PURE__ */ __name((v) => v === true || v === 1 || v === "1" || v === "t" || v === "true", "flag");
|
|
51
52
|
for (const p of rows) {
|
|
52
53
|
out[p.entity] = {
|
|
53
|
-
c:
|
|
54
|
-
r:
|
|
55
|
-
u:
|
|
56
|
-
d:
|
|
54
|
+
c: flag(p.canCreate),
|
|
55
|
+
r: flag(p.canRead),
|
|
56
|
+
u: flag(p.canUpdate),
|
|
57
|
+
d: flag(p.canDelete)
|
|
57
58
|
};
|
|
58
59
|
}
|
|
59
60
|
return out;
|
|
@@ -136,11 +137,12 @@ var VENDOR_STORE_RBAC_ENTITIES = /* @__PURE__ */ new Set([
|
|
|
136
137
|
"order_addresses",
|
|
137
138
|
"event_products"
|
|
138
139
|
]);
|
|
139
|
-
var
|
|
140
|
+
var VENDOR_GROUP_NAME = "Vendor";
|
|
141
|
+
var VENDOR_OWNER_GROUP_NAME = VENDOR_GROUP_NAME;
|
|
140
142
|
function isVendorGroupName(name) {
|
|
141
143
|
if (!name?.trim()) return false;
|
|
142
144
|
const n = name.trim().toLowerCase();
|
|
143
|
-
return n ===
|
|
145
|
+
return n === "vendor" || n === "vendor owner" || n.includes("vendor");
|
|
144
146
|
}
|
|
145
147
|
__name(isVendorGroupName, "isVendorGroupName");
|
|
146
148
|
function isPlatformAdministrator(user) {
|
|
@@ -163,10 +165,8 @@ function isVendorOwner(user) {
|
|
|
163
165
|
if (user?.isVendorOwner === true) return true;
|
|
164
166
|
if (!user?.email || isPlatformAdministrator(user)) return false;
|
|
165
167
|
if (user.isVendorRoleOwner === true) return true;
|
|
166
|
-
if (user.vendorRole === "staff") return false;
|
|
167
168
|
if (user.vendorRole === "owner") return true;
|
|
168
|
-
|
|
169
|
-
return user.groupName?.trim().toLowerCase() === VENDOR_OWNER_GROUP_NAME.toLowerCase();
|
|
169
|
+
return false;
|
|
170
170
|
}
|
|
171
171
|
__name(isVendorOwner, "isVendorOwner");
|
|
172
172
|
function canManageVendorTeam(user) {
|
|
@@ -204,7 +204,7 @@ __name(resolveVendorScopeFromSessionUser, "resolveVendorScopeFromSessionUser");
|
|
|
204
204
|
function vendorPortalFlagsFromUser(input) {
|
|
205
205
|
const vendorIds = input.vendorIds ?? [];
|
|
206
206
|
const isVendorPortal = !input.isRBACAdmin && (vendorIds.length > 0 || isVendorGroupName(input.groupName));
|
|
207
|
-
const isVendorOwner2 = isVendorPortal && (input.isVendorRoleOwner === true || input.vendorRole
|
|
207
|
+
const isVendorOwner2 = isVendorPortal && (input.isVendorRoleOwner === true || input.vendorRole === "owner");
|
|
208
208
|
return {
|
|
209
209
|
isVendorPortal,
|
|
210
210
|
isVendorOwner: isVendorOwner2
|
|
@@ -461,7 +461,8 @@ function explainSessionEntityAccess(user, entity, action) {
|
|
|
461
461
|
const isStaff = user.vendorRole === "staff";
|
|
462
462
|
const vendorPerms = user.vendorEntityPerms;
|
|
463
463
|
const hasVendorRolePerms = vendorPerms != null && Object.keys(vendorPerms).length > 0;
|
|
464
|
-
|
|
464
|
+
const enforceVendorRoleMatrix = vendorIds.length > 0 && (hasVendorRolePerms || user.vendorRoleId != null);
|
|
465
|
+
if (enforceVendorRoleMatrix) {
|
|
465
466
|
const vendorRbacSet = new Set(VENDOR_RBAC_ENTITIES);
|
|
466
467
|
if (vendorRbacSet.has(entity) || entity === "analytics") {
|
|
467
468
|
if (entity === "analytics" && action === "read") {
|
|
@@ -603,7 +604,7 @@ async function logEntityAccessDecision(dataSource, context, user, entity, action
|
|
|
603
604
|
const id = Number(user.id);
|
|
604
605
|
if (Number.isFinite(id)) {
|
|
605
606
|
try {
|
|
606
|
-
const { loadDbPermissionsForUser } = await import('./rbac-debug-db-
|
|
607
|
+
const { loadDbPermissionsForUser } = await import('./rbac-debug-db-6EMIVMGF.js');
|
|
607
608
|
dbPermissions = await loadDbPermissionsForUser(dataSource, id);
|
|
608
609
|
} catch (e) {
|
|
609
610
|
dbPermissions = {
|
|
@@ -624,4 +625,4 @@ async function logEntityAccessDecision(dataSource, context, user, entity, action
|
|
|
624
625
|
}
|
|
625
626
|
__name(logEntityAccessDecision, "logEntityAccessDecision");
|
|
626
627
|
|
|
627
|
-
export { ADMIN_GROUP_NAME, DEFAULT_VENDOR_ROLE_DEFS, SUPER_ADMIN_GROUP_ID, VENDOR_ADMIN_GROUP_ID, VENDOR_OWNER_GROUP_NAME, VENDOR_RBAC_ENTITIES, VENDOR_SCOPED_STORE_ENTITIES, VENDOR_STORE_RBAC_ENTITIES, VENDOR_VIEWER_ROLE_NAME, canManageVendorRoles, canManageVendorTeam, canOnboardVendors, explainSessionEntityAccess, getPermissionableEntityKeys, hasEntityPermission, isPlatformAdministrator, isRbacDebugEnabled, isSuperAdmin, isSuperAdminGroupName, isVendorAdmin, isVendorGroupName, isVendorOwner, isVendorPortalUser, isVendorStaff, logEntityAccessDecision, logRbac, permissionRowsToRecord, resolveDisabledMultiVendorScope, resolveVendorScopeFromSessionUser, summarizeEntityPerms, vendorPortalFlagsFromUser };
|
|
628
|
+
export { ADMIN_GROUP_NAME, DEFAULT_VENDOR_ROLE_DEFS, SUPER_ADMIN_GROUP_ID, VENDOR_ADMIN_GROUP_ID, VENDOR_GROUP_NAME, VENDOR_OWNER_GROUP_NAME, VENDOR_RBAC_ENTITIES, VENDOR_SCOPED_STORE_ENTITIES, VENDOR_STORE_RBAC_ENTITIES, VENDOR_VIEWER_ROLE_NAME, canManageVendorRoles, canManageVendorTeam, canOnboardVendors, explainSessionEntityAccess, getPermissionableEntityKeys, hasEntityPermission, isPlatformAdministrator, isRbacDebugEnabled, isSuperAdmin, isSuperAdminGroupName, isVendorAdmin, isVendorGroupName, isVendorOwner, isVendorPortalUser, isVendorStaff, logEntityAccessDecision, logRbac, permissionRowsToRecord, resolveDisabledMultiVendorScope, resolveVendorScopeFromSessionUser, summarizeEntityPerms, vendorPortalFlagsFromUser };
|
|
@@ -61,6 +61,7 @@ async function emitOrderNotificationTrigger(triggerKey, orderId, deps, extra) {
|
|
|
61
61
|
total: fo.total ?? 0,
|
|
62
62
|
currency: String(fo.currency ?? "INR"),
|
|
63
63
|
vendorId: fo.vendorId ?? null,
|
|
64
|
+
...extra?.extraVariables ?? {},
|
|
64
65
|
...extra?.refundAmount != null ? {
|
|
65
66
|
refundAmount: extra.refundAmount
|
|
66
67
|
} : {}
|