@rovela-ai/sdk 0.1.11 → 0.1.12
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/api/check.d.ts +38 -0
- package/dist/admin/api/check.d.ts.map +1 -0
- package/dist/admin/api/check.js +52 -0
- package/dist/admin/api/check.js.map +1 -0
- package/dist/admin/api/index.d.ts +8 -0
- package/dist/admin/api/index.d.ts.map +1 -1
- package/dist/admin/api/index.js +13 -1
- package/dist/admin/api/index.js.map +1 -1
- package/dist/admin/api/setup.d.ts +60 -0
- package/dist/admin/api/setup.d.ts.map +1 -0
- package/dist/admin/api/setup.js +129 -0
- package/dist/admin/api/setup.js.map +1 -0
- package/dist/admin/components/AdminSetupForm.d.ts +28 -0
- package/dist/admin/components/AdminSetupForm.d.ts.map +1 -0
- package/dist/admin/components/AdminSetupForm.js +83 -0
- package/dist/admin/components/AdminSetupForm.js.map +1 -0
- package/dist/admin/components/index.d.ts +2 -0
- package/dist/admin/components/index.d.ts.map +1 -1
- package/dist/admin/components/index.js +3 -1
- package/dist/admin/components/index.js.map +1 -1
- package/dist/admin/index.d.ts +3 -2
- package/dist/admin/index.d.ts.map +1 -1
- package/dist/admin/index.js +7 -2
- package/dist/admin/index.js.map +1 -1
- package/package.json +9 -1
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @rovela/sdk/admin/api/check
|
|
3
|
+
*
|
|
4
|
+
* Admin check API route handler.
|
|
5
|
+
* Returns whether any admin exists and the store owner email for pre-filling.
|
|
6
|
+
*/
|
|
7
|
+
import { NextResponse } from 'next/server';
|
|
8
|
+
/**
|
|
9
|
+
* Response for admin check
|
|
10
|
+
*/
|
|
11
|
+
interface AdminCheckResponse {
|
|
12
|
+
hasAdmin: boolean;
|
|
13
|
+
ownerEmail: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* GET handler to check if any admin exists.
|
|
17
|
+
*
|
|
18
|
+
* This is used by the login page to determine whether to show
|
|
19
|
+
* the setup form or the login form.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* // app/api/admin/check/route.ts
|
|
24
|
+
* export { GET } from '@rovela-ai/sdk/admin/api/check'
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```typescript
|
|
29
|
+
* // Response
|
|
30
|
+
* {
|
|
31
|
+
* "hasAdmin": false,
|
|
32
|
+
* "ownerEmail": "owner@store.com"
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare function GET(): Promise<NextResponse<AdminCheckResponse>>;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../../src/admin/api/check.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAG1C;;GAEG;AACH,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,GAAG,IAAI,OAAO,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAmBrE"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @rovela/sdk/admin/api/check
|
|
4
|
+
*
|
|
5
|
+
* Admin check API route handler.
|
|
6
|
+
* Returns whether any admin exists and the store owner email for pre-filling.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.GET = GET;
|
|
10
|
+
const server_1 = require("next/server");
|
|
11
|
+
const admin_service_1 = require("../server/admin-service");
|
|
12
|
+
/**
|
|
13
|
+
* GET handler to check if any admin exists.
|
|
14
|
+
*
|
|
15
|
+
* This is used by the login page to determine whether to show
|
|
16
|
+
* the setup form or the login form.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* // app/api/admin/check/route.ts
|
|
21
|
+
* export { GET } from '@rovela-ai/sdk/admin/api/check'
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* // Response
|
|
27
|
+
* {
|
|
28
|
+
* "hasAdmin": false,
|
|
29
|
+
* "ownerEmail": "owner@store.com"
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
async function GET() {
|
|
34
|
+
try {
|
|
35
|
+
const adminCount = await (0, admin_service_1.countAdmins)();
|
|
36
|
+
const ownerEmail = process.env.STORE_OWNER_EMAIL || '';
|
|
37
|
+
return server_1.NextResponse.json({
|
|
38
|
+
hasAdmin: adminCount > 0,
|
|
39
|
+
ownerEmail,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
console.error('[Admin Check] Error:', error);
|
|
44
|
+
// On error, assume no admin exists to allow setup
|
|
45
|
+
// This is safer than blocking setup due to a DB error
|
|
46
|
+
return server_1.NextResponse.json({
|
|
47
|
+
hasAdmin: false,
|
|
48
|
+
ownerEmail: process.env.STORE_OWNER_EMAIL || '',
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../../src/admin/api/check.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AAkCH,kBAmBC;AAnDD,wCAA0C;AAC1C,2DAAqD;AAUrD;;;;;;;;;;;;;;;;;;;;GAoBG;AACI,KAAK,UAAU,GAAG;IACvB,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,MAAM,IAAA,2BAAW,GAAE,CAAA;QACtC,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE,CAAA;QAEtD,OAAO,qBAAY,CAAC,IAAI,CAAC;YACvB,QAAQ,EAAE,UAAU,GAAG,CAAC;YACxB,UAAU;SACX,CAAC,CAAA;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAA;QAE5C,kDAAkD;QAClD,sDAAsD;QACtD,OAAO,qBAAY,CAAC,IAAI,CAAC;YACvB,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE;SAChD,CAAC,CAAA;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -44,6 +44,12 @@
|
|
|
44
44
|
*
|
|
45
45
|
* // app/api/admin/stats/route.ts
|
|
46
46
|
* export { GET } from '@rovela/sdk/admin/api/stats'
|
|
47
|
+
*
|
|
48
|
+
* // app/api/admin/setup/route.ts (first-time admin creation)
|
|
49
|
+
* export { POST } from '@rovela/sdk/admin/api/setup'
|
|
50
|
+
*
|
|
51
|
+
* // app/api/admin/check/route.ts (check if admin exists)
|
|
52
|
+
* export { GET } from '@rovela/sdk/admin/api/check'
|
|
47
53
|
* ```
|
|
48
54
|
*/
|
|
49
55
|
export { createAdminAuthHandlers } from './auth';
|
|
@@ -53,4 +59,6 @@ export { POST as processRefund } from './refund';
|
|
|
53
59
|
export { GET as getStats } from './stats';
|
|
54
60
|
export { GET as getCategories, POST as createCategory, getCategory, PUT as updateCategory, DELETE as deleteCategory, } from './categories';
|
|
55
61
|
export { GET as getCustomers, getCustomer, } from './customers';
|
|
62
|
+
export { POST as setupAdmin } from './setup';
|
|
63
|
+
export { GET as checkAdminExists } from './check';
|
|
56
64
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/admin/api/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/admin/api/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,QAAQ,CAAA;AAGhD,OAAO,EACL,GAAG,IAAI,WAAW,EAClB,IAAI,IAAI,aAAa,EACrB,UAAU,EACV,GAAG,IAAI,aAAa,EACpB,MAAM,IAAI,aAAa,EACvB,UAAU,EACV,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,YAAY,CAAA;AAGnB,OAAO,EACL,GAAG,IAAI,SAAS,EAChB,QAAQ,EACR,GAAG,IAAI,WAAW,GACnB,MAAM,UAAU,CAAA;AAGjB,OAAO,EAAE,IAAI,IAAI,aAAa,EAAE,MAAM,UAAU,CAAA;AAGhD,OAAO,EAAE,GAAG,IAAI,QAAQ,EAAE,MAAM,SAAS,CAAA;AAGzC,OAAO,EACL,GAAG,IAAI,aAAa,EACpB,IAAI,IAAI,cAAc,EACtB,WAAW,EACX,GAAG,IAAI,cAAc,EACrB,MAAM,IAAI,cAAc,GACzB,MAAM,cAAc,CAAA;AAGrB,OAAO,EACL,GAAG,IAAI,YAAY,EACnB,WAAW,GACZ,MAAM,aAAa,CAAA;AAGpB,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,SAAS,CAAA;AAG5C,OAAO,EAAE,GAAG,IAAI,gBAAgB,EAAE,MAAM,SAAS,CAAA"}
|
package/dist/admin/api/index.js
CHANGED
|
@@ -45,10 +45,16 @@
|
|
|
45
45
|
*
|
|
46
46
|
* // app/api/admin/stats/route.ts
|
|
47
47
|
* export { GET } from '@rovela/sdk/admin/api/stats'
|
|
48
|
+
*
|
|
49
|
+
* // app/api/admin/setup/route.ts (first-time admin creation)
|
|
50
|
+
* export { POST } from '@rovela/sdk/admin/api/setup'
|
|
51
|
+
*
|
|
52
|
+
* // app/api/admin/check/route.ts (check if admin exists)
|
|
53
|
+
* export { GET } from '@rovela/sdk/admin/api/check'
|
|
48
54
|
* ```
|
|
49
55
|
*/
|
|
50
56
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
-
exports.getCustomer = exports.getCustomers = exports.deleteCategory = exports.updateCategory = exports.getCategory = exports.createCategory = exports.getCategories = exports.getStats = exports.processRefund = exports.updateOrder = exports.getOrder = exports.getOrders = exports.deleteVariantHandler = exports.updateVariantHandler = exports.addVariant = exports.deleteProduct = exports.updateProduct = exports.getProduct = exports.createProduct = exports.getProducts = exports.createAdminAuthHandlers = void 0;
|
|
57
|
+
exports.checkAdminExists = exports.setupAdmin = exports.getCustomer = exports.getCustomers = exports.deleteCategory = exports.updateCategory = exports.getCategory = exports.createCategory = exports.getCategories = exports.getStats = exports.processRefund = exports.updateOrder = exports.getOrder = exports.getOrders = exports.deleteVariantHandler = exports.updateVariantHandler = exports.addVariant = exports.deleteProduct = exports.updateProduct = exports.getProduct = exports.createProduct = exports.getProducts = exports.createAdminAuthHandlers = void 0;
|
|
52
58
|
// Auth
|
|
53
59
|
var auth_1 = require("./auth");
|
|
54
60
|
Object.defineProperty(exports, "createAdminAuthHandlers", { enumerable: true, get: function () { return auth_1.createAdminAuthHandlers; } });
|
|
@@ -84,4 +90,10 @@ Object.defineProperty(exports, "deleteCategory", { enumerable: true, get: functi
|
|
|
84
90
|
var customers_1 = require("./customers");
|
|
85
91
|
Object.defineProperty(exports, "getCustomers", { enumerable: true, get: function () { return customers_1.GET; } });
|
|
86
92
|
Object.defineProperty(exports, "getCustomer", { enumerable: true, get: function () { return customers_1.getCustomer; } });
|
|
93
|
+
// Setup (first-time admin creation)
|
|
94
|
+
var setup_1 = require("./setup");
|
|
95
|
+
Object.defineProperty(exports, "setupAdmin", { enumerable: true, get: function () { return setup_1.POST; } });
|
|
96
|
+
// Check (check if admin exists)
|
|
97
|
+
var check_1 = require("./check");
|
|
98
|
+
Object.defineProperty(exports, "checkAdminExists", { enumerable: true, get: function () { return check_1.GET; } });
|
|
87
99
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/admin/api/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/admin/api/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;;;AAEH,OAAO;AACP,+BAAgD;AAAvC,+GAAA,uBAAuB,OAAA;AAEhC,WAAW;AACX,uCASmB;AARjB,uGAAA,GAAG,OAAe;AAClB,yGAAA,IAAI,OAAiB;AACrB,sGAAA,UAAU,OAAA;AACV,yGAAA,GAAG,OAAiB;AACpB,yGAAA,MAAM,OAAiB;AACvB,sGAAA,UAAU,OAAA;AACV,gHAAA,oBAAoB,OAAA;AACpB,gHAAA,oBAAoB,OAAA;AAGtB,SAAS;AACT,mCAIiB;AAHf,mGAAA,GAAG,OAAa;AAChB,kGAAA,QAAQ,OAAA;AACR,qGAAA,GAAG,OAAe;AAGpB,SAAS;AACT,mCAAgD;AAAvC,uGAAA,IAAI,OAAiB;AAE9B,QAAQ;AACR,iCAAyC;AAAhC,iGAAA,GAAG,OAAY;AAExB,aAAa;AACb,2CAMqB;AALnB,2GAAA,GAAG,OAAiB;AACpB,4GAAA,IAAI,OAAkB;AACtB,yGAAA,WAAW,OAAA;AACX,4GAAA,GAAG,OAAkB;AACrB,4GAAA,MAAM,OAAkB;AAG1B,YAAY;AACZ,yCAGoB;AAFlB,yGAAA,GAAG,OAAgB;AACnB,wGAAA,WAAW,OAAA;AAGb,oCAAoC;AACpC,iCAA4C;AAAnC,mGAAA,IAAI,OAAc;AAE3B,gCAAgC;AAChC,iCAAiD;AAAxC,yGAAA,GAAG,OAAoB"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @rovela/sdk/admin/api/setup
|
|
3
|
+
*
|
|
4
|
+
* Admin setup API route handler for first-time admin account creation.
|
|
5
|
+
* This endpoint is only accessible when no admins exist for the tenant.
|
|
6
|
+
*/
|
|
7
|
+
import { NextResponse } from 'next/server';
|
|
8
|
+
/**
|
|
9
|
+
* Success response
|
|
10
|
+
*/
|
|
11
|
+
interface AdminSetupResponse {
|
|
12
|
+
success: true;
|
|
13
|
+
message: string;
|
|
14
|
+
adminId: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Error response
|
|
18
|
+
*/
|
|
19
|
+
interface AdminSetupError {
|
|
20
|
+
error: string;
|
|
21
|
+
code: 'SETUP_DISABLED' | 'VALIDATION_ERROR' | 'EMAIL_EXISTS' | 'SERVER_ERROR';
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* POST handler for first-time admin setup.
|
|
25
|
+
*
|
|
26
|
+
* SECURITY: This endpoint only works when countAdmins() === 0.
|
|
27
|
+
* Once an owner is created, this endpoint returns 403 Forbidden.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```typescript
|
|
31
|
+
* // app/api/admin/setup/route.ts
|
|
32
|
+
* export { POST } from '@rovela-ai/sdk/admin/api/setup'
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* // Request body
|
|
38
|
+
* {
|
|
39
|
+
* "email": "owner@store.com",
|
|
40
|
+
* "password": "securePassword123",
|
|
41
|
+
* "name": "Store Owner"
|
|
42
|
+
* }
|
|
43
|
+
*
|
|
44
|
+
* // Success response (201)
|
|
45
|
+
* {
|
|
46
|
+
* "success": true,
|
|
47
|
+
* "message": "Admin account created successfully.",
|
|
48
|
+
* "adminId": "uuid"
|
|
49
|
+
* }
|
|
50
|
+
*
|
|
51
|
+
* // Error response (403) - Setup already completed
|
|
52
|
+
* {
|
|
53
|
+
* "error": "Admin setup has already been completed.",
|
|
54
|
+
* "code": "SETUP_DISABLED"
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare function POST(request: Request): Promise<NextResponse<AdminSetupResponse | AdminSetupError>>;
|
|
59
|
+
export {};
|
|
60
|
+
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../src/admin/api/setup.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAa1C;;GAEG;AACH,UAAU,kBAAkB;IAC1B,OAAO,EAAE,IAAI,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,gBAAgB,GAAG,kBAAkB,GAAG,cAAc,GAAG,cAAc,CAAA;CAC9E;AAUD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,IAAI,CACxB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,YAAY,CAAC,kBAAkB,GAAG,eAAe,CAAC,CAAC,CAmH7D"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @rovela/sdk/admin/api/setup
|
|
4
|
+
*
|
|
5
|
+
* Admin setup API route handler for first-time admin account creation.
|
|
6
|
+
* This endpoint is only accessible when no admins exist for the tenant.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.POST = POST;
|
|
10
|
+
const server_1 = require("next/server");
|
|
11
|
+
const admin_service_1 = require("../server/admin-service");
|
|
12
|
+
const password_1 = require("../../auth/server/password");
|
|
13
|
+
/**
|
|
14
|
+
* Validate email format
|
|
15
|
+
*/
|
|
16
|
+
function isValidEmail(email) {
|
|
17
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
18
|
+
return emailRegex.test(email);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* POST handler for first-time admin setup.
|
|
22
|
+
*
|
|
23
|
+
* SECURITY: This endpoint only works when countAdmins() === 0.
|
|
24
|
+
* Once an owner is created, this endpoint returns 403 Forbidden.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* // app/api/admin/setup/route.ts
|
|
29
|
+
* export { POST } from '@rovela-ai/sdk/admin/api/setup'
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* // Request body
|
|
35
|
+
* {
|
|
36
|
+
* "email": "owner@store.com",
|
|
37
|
+
* "password": "securePassword123",
|
|
38
|
+
* "name": "Store Owner"
|
|
39
|
+
* }
|
|
40
|
+
*
|
|
41
|
+
* // Success response (201)
|
|
42
|
+
* {
|
|
43
|
+
* "success": true,
|
|
44
|
+
* "message": "Admin account created successfully.",
|
|
45
|
+
* "adminId": "uuid"
|
|
46
|
+
* }
|
|
47
|
+
*
|
|
48
|
+
* // Error response (403) - Setup already completed
|
|
49
|
+
* {
|
|
50
|
+
* "error": "Admin setup has already been completed.",
|
|
51
|
+
* "code": "SETUP_DISABLED"
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
async function POST(request) {
|
|
56
|
+
try {
|
|
57
|
+
// CRITICAL: Check if any admins exist
|
|
58
|
+
// If admins exist, setup is disabled
|
|
59
|
+
const adminCount = await (0, admin_service_1.countAdmins)();
|
|
60
|
+
if (adminCount > 0) {
|
|
61
|
+
return server_1.NextResponse.json({
|
|
62
|
+
error: 'Admin setup has already been completed.',
|
|
63
|
+
code: 'SETUP_DISABLED',
|
|
64
|
+
}, { status: 403 });
|
|
65
|
+
}
|
|
66
|
+
// Parse request body
|
|
67
|
+
const body = (await request.json());
|
|
68
|
+
// Validate required fields
|
|
69
|
+
if (!body.email || !body.password || !body.name) {
|
|
70
|
+
return server_1.NextResponse.json({
|
|
71
|
+
error: 'Email, password, and name are required.',
|
|
72
|
+
code: 'VALIDATION_ERROR',
|
|
73
|
+
}, { status: 400 });
|
|
74
|
+
}
|
|
75
|
+
// Validate email format
|
|
76
|
+
if (!isValidEmail(body.email)) {
|
|
77
|
+
return server_1.NextResponse.json({
|
|
78
|
+
error: 'Please enter a valid email address.',
|
|
79
|
+
code: 'VALIDATION_ERROR',
|
|
80
|
+
}, { status: 400 });
|
|
81
|
+
}
|
|
82
|
+
// Validate name
|
|
83
|
+
if (body.name.trim().length < 2) {
|
|
84
|
+
return server_1.NextResponse.json({
|
|
85
|
+
error: 'Name must be at least 2 characters.',
|
|
86
|
+
code: 'VALIDATION_ERROR',
|
|
87
|
+
}, { status: 400 });
|
|
88
|
+
}
|
|
89
|
+
// Validate password
|
|
90
|
+
const passwordValidation = (0, password_1.validatePassword)(body.password);
|
|
91
|
+
if (!passwordValidation.valid) {
|
|
92
|
+
return server_1.NextResponse.json({
|
|
93
|
+
error: passwordValidation.error,
|
|
94
|
+
code: 'VALIDATION_ERROR',
|
|
95
|
+
}, { status: 400 });
|
|
96
|
+
}
|
|
97
|
+
// Check if email already exists (edge case: race condition)
|
|
98
|
+
const emailExists = await (0, admin_service_1.adminEmailExists)(body.email);
|
|
99
|
+
if (emailExists) {
|
|
100
|
+
return server_1.NextResponse.json({
|
|
101
|
+
error: 'An admin with this email already exists.',
|
|
102
|
+
code: 'EMAIL_EXISTS',
|
|
103
|
+
}, { status: 409 });
|
|
104
|
+
}
|
|
105
|
+
// Create the admin as 'owner' (first admin is always owner)
|
|
106
|
+
const { admin } = await (0, admin_service_1.createAdmin)(body.email, body.password, body.name.trim(), 'owner');
|
|
107
|
+
console.log(`[Admin Setup] First admin created: ${admin.email} (owner)`);
|
|
108
|
+
return server_1.NextResponse.json({
|
|
109
|
+
success: true,
|
|
110
|
+
message: 'Admin account created successfully.',
|
|
111
|
+
adminId: admin.id,
|
|
112
|
+
}, { status: 201 });
|
|
113
|
+
}
|
|
114
|
+
catch (error) {
|
|
115
|
+
console.error('[Admin Setup] Error:', error);
|
|
116
|
+
// Handle duplicate email (database constraint)
|
|
117
|
+
if (error instanceof Error && error.message.includes('already exists')) {
|
|
118
|
+
return server_1.NextResponse.json({
|
|
119
|
+
error: 'An admin with this email already exists.',
|
|
120
|
+
code: 'EMAIL_EXISTS',
|
|
121
|
+
}, { status: 409 });
|
|
122
|
+
}
|
|
123
|
+
return server_1.NextResponse.json({
|
|
124
|
+
error: 'Failed to create admin account. Please try again.',
|
|
125
|
+
code: 'SERVER_ERROR',
|
|
126
|
+
}, { status: 500 });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../../src/admin/api/setup.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AA2EH,oBAqHC;AA9LD,wCAA0C;AAC1C,2DAAoF;AACpF,yDAA6D;AA4B7D;;GAEG;AACH,SAAS,YAAY,CAAC,KAAa;IACjC,MAAM,UAAU,GAAG,4BAA4B,CAAA;IAC/C,OAAO,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AAC/B,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACI,KAAK,UAAU,IAAI,CACxB,OAAgB;IAEhB,IAAI,CAAC;QACH,sCAAsC;QACtC,qCAAqC;QACrC,MAAM,UAAU,GAAG,MAAM,IAAA,2BAAW,GAAE,CAAA;QACtC,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;YACnB,OAAO,qBAAY,CAAC,IAAI,CACtB;gBACE,KAAK,EAAE,yCAAyC;gBAChD,IAAI,EAAE,gBAAgB;aACvB,E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AC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Props for AdminSetupForm component
|
|
3
|
+
*/
|
|
4
|
+
export interface AdminSetupFormProps {
|
|
5
|
+
/** Pre-filled email from STORE_OWNER_EMAIL */
|
|
6
|
+
defaultEmail?: string;
|
|
7
|
+
/** Callback on successful setup */
|
|
8
|
+
onSuccess?: () => void;
|
|
9
|
+
/** Additional CSS classes */
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Admin setup form for first-time account creation.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* // Basic usage
|
|
18
|
+
* <AdminSetupForm />
|
|
19
|
+
*
|
|
20
|
+
* // With pre-filled email
|
|
21
|
+
* <AdminSetupForm
|
|
22
|
+
* defaultEmail="owner@store.com"
|
|
23
|
+
* onSuccess={() => console.log('Account created!')}
|
|
24
|
+
* />
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function AdminSetupForm({ defaultEmail, onSuccess, className, }: AdminSetupFormProps): import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
//# sourceMappingURL=AdminSetupForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdminSetupForm.d.ts","sourceRoot":"","sources":["../../../src/admin/components/AdminSetupForm.tsx"],"names":[],"mappings":"AAWA;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,mCAAmC;IACnC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,EAC7B,YAAiB,EACjB,SAAS,EACT,SAAc,GACf,EAAE,mBAAmB,2CAyLrB"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.AdminSetupForm = AdminSetupForm;
|
|
5
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
+
/**
|
|
7
|
+
* @rovela/sdk/admin/components/AdminSetupForm
|
|
8
|
+
*
|
|
9
|
+
* First-time admin account setup form.
|
|
10
|
+
* Used when no admin exists for the store.
|
|
11
|
+
*/
|
|
12
|
+
const react_1 = require("react");
|
|
13
|
+
/**
|
|
14
|
+
* Admin setup form for first-time account creation.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* // Basic usage
|
|
19
|
+
* <AdminSetupForm />
|
|
20
|
+
*
|
|
21
|
+
* // With pre-filled email
|
|
22
|
+
* <AdminSetupForm
|
|
23
|
+
* defaultEmail="owner@store.com"
|
|
24
|
+
* onSuccess={() => console.log('Account created!')}
|
|
25
|
+
* />
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
function AdminSetupForm({ defaultEmail = '', onSuccess, className = '', }) {
|
|
29
|
+
const [email, setEmail] = (0, react_1.useState)(defaultEmail);
|
|
30
|
+
const [name, setName] = (0, react_1.useState)('');
|
|
31
|
+
const [password, setPassword] = (0, react_1.useState)('');
|
|
32
|
+
const [confirmPassword, setConfirmPassword] = (0, react_1.useState)('');
|
|
33
|
+
const [error, setError] = (0, react_1.useState)(null);
|
|
34
|
+
const [isSubmitting, setIsSubmitting] = (0, react_1.useState)(false);
|
|
35
|
+
const handleSubmit = (0, react_1.useCallback)(async (e) => {
|
|
36
|
+
e.preventDefault();
|
|
37
|
+
setError(null);
|
|
38
|
+
// Validate passwords match
|
|
39
|
+
if (password !== confirmPassword) {
|
|
40
|
+
setError('Passwords do not match');
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
// Validate password length
|
|
44
|
+
if (password.length < 8) {
|
|
45
|
+
setError('Password must be at least 8 characters');
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
// Validate name
|
|
49
|
+
if (name.trim().length < 2) {
|
|
50
|
+
setError('Name must be at least 2 characters');
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
setIsSubmitting(true);
|
|
54
|
+
try {
|
|
55
|
+
const response = await fetch('/api/admin/setup', {
|
|
56
|
+
method: 'POST',
|
|
57
|
+
headers: { 'Content-Type': 'application/json' },
|
|
58
|
+
body: JSON.stringify({
|
|
59
|
+
email: email.trim(),
|
|
60
|
+
password,
|
|
61
|
+
name: name.trim(),
|
|
62
|
+
}),
|
|
63
|
+
});
|
|
64
|
+
const data = await response.json();
|
|
65
|
+
if (!response.ok) {
|
|
66
|
+
setError(data.error || 'Setup failed');
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
// Success - call callback
|
|
70
|
+
onSuccess?.();
|
|
71
|
+
// Reload page to switch to login view
|
|
72
|
+
window.location.reload();
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
setError('An unexpected error occurred');
|
|
76
|
+
}
|
|
77
|
+
finally {
|
|
78
|
+
setIsSubmitting(false);
|
|
79
|
+
}
|
|
80
|
+
}, [email, name, password, confirmPassword, onSuccess]);
|
|
81
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: `w-full max-w-sm ${className}`, children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-8 text-center", children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-2xl font-semibold text-foreground", children: "Set Up Admin Account" }), (0, jsx_runtime_1.jsx)("p", { className: "mt-2 text-sm text-muted-foreground", children: "Create your admin account to manage your store" })] }), (0, jsx_runtime_1.jsxs)("form", { onSubmit: handleSubmit, className: "space-y-4", children: [error && ((0, jsx_runtime_1.jsx)("div", { className: "rounded-md bg-destructive/10 px-4 py-3 text-sm text-destructive", children: error })), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("label", { htmlFor: "setup-email", className: "block text-sm font-medium text-foreground", children: "Email" }), (0, jsx_runtime_1.jsx)("input", { id: "setup-email", type: "email", value: email, onChange: (e) => setEmail(e.target.value), required: true, autoComplete: "email", disabled: isSubmitting, className: "mt-1 block w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary disabled:cursor-not-allowed disabled:opacity-50", placeholder: "admin@example.com" }), defaultEmail && email === defaultEmail && ((0, jsx_runtime_1.jsx)("p", { className: "mt-1 text-xs text-muted-foreground", children: "Pre-filled with store owner email" }))] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("label", { htmlFor: "setup-name", className: "block text-sm font-medium text-foreground", children: "Name" }), (0, jsx_runtime_1.jsx)("input", { id: "setup-name", type: "text", value: name, onChange: (e) => setName(e.target.value), required: true, autoComplete: "name", disabled: isSubmitting, className: "mt-1 block w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary disabled:cursor-not-allowed disabled:opacity-50", placeholder: "Your name" })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("label", { htmlFor: "setup-password", className: "block text-sm font-medium text-foreground", children: "Password" }), (0, jsx_runtime_1.jsx)("input", { id: "setup-password", type: "password", value: password, onChange: (e) => setPassword(e.target.value), required: true, autoComplete: "new-password", disabled: isSubmitting, className: "mt-1 block w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary disabled:cursor-not-allowed disabled:opacity-50", placeholder: "At least 8 characters" })] }), (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("label", { htmlFor: "setup-confirm-password", className: "block text-sm font-medium text-foreground", children: "Confirm Password" }), (0, jsx_runtime_1.jsx)("input", { id: "setup-confirm-password", type: "password", value: confirmPassword, onChange: (e) => setConfirmPassword(e.target.value), required: true, autoComplete: "new-password", disabled: isSubmitting, className: "mt-1 block w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary disabled:cursor-not-allowed disabled:opacity-50", placeholder: "Confirm your password" })] }), (0, jsx_runtime_1.jsx)("button", { type: "submit", disabled: isSubmitting, className: "w-full rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", children: isSubmitting ? ((0, jsx_runtime_1.jsxs)("span", { className: "flex items-center justify-center gap-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent" }), "Creating account..."] })) : ('Create Admin Account') })] })] }));
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=AdminSetupForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdminSetupForm.js","sourceRoot":"","sources":["../../../src/admin/components/AdminSetupForm.tsx"],"names":[],"mappings":";AAAA,YAAY,CAAA;;AAsCZ,wCA6LC;;AAjOD;;;;;GAKG;AAEH,iCAA6C;AAc7C;;;;;;;;;;;;;;GAcG;AACH,SAAgB,cAAc,CAAC,EAC7B,YAAY,GAAG,EAAE,EACjB,SAAS,EACT,SAAS,GAAG,EAAE,GACM;IACpB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAAC,YAAY,CAAC,CAAA;IAChD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAA;IACpC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAA;IAC5C,MAAM,CAAC,eAAe,EAAE,kBAAkB,CAAC,GAA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SAAS,EAAC,wCAAwC,aACtD,iCAAM,SAAS,EAAC,gFAAgF,GAAG,2BAE9F,CACR,CAAC,CAAC,CAAC,CACF,sBAAsB,CACvB,GACM,IACJ,IACH,CACP,CAAA;AACH,CAAC"}
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export { AdminGuard } from './AdminGuard';
|
|
7
7
|
export { AdminLoginForm } from './AdminLoginForm';
|
|
8
|
+
export { AdminSetupForm } from './AdminSetupForm';
|
|
9
|
+
export type { AdminSetupFormProps } from './AdminSetupForm';
|
|
8
10
|
export { AdminLayout } from './AdminLayout';
|
|
9
11
|
export { AdminNav } from './AdminNav';
|
|
10
12
|
export { AdminHeader } from './AdminHeader';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/admin/components/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/admin/components/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAM3D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAM3C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAM/C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAMnD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAM7C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Admin dashboard UI components.
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.StoreSettings = exports.RefundDialog = exports.OrderDetails = exports.OrderTable = exports.InventoryEditor = exports.ProductForm = exports.ProductTable = exports.LowStockAlert = exports.RecentOrders = exports.StatsCards = exports.AdminHeader = exports.AdminNav = exports.AdminLayout = exports.AdminLoginForm = exports.AdminGuard = void 0;
|
|
8
|
+
exports.StoreSettings = exports.RefundDialog = exports.OrderDetails = exports.OrderTable = exports.InventoryEditor = exports.ProductForm = exports.ProductTable = exports.LowStockAlert = exports.RecentOrders = exports.StatsCards = exports.AdminHeader = exports.AdminNav = exports.AdminLayout = exports.AdminSetupForm = exports.AdminLoginForm = exports.AdminGuard = void 0;
|
|
9
9
|
// =============================================================================
|
|
10
10
|
// Auth Components
|
|
11
11
|
// =============================================================================
|
|
@@ -13,6 +13,8 @@ var AdminGuard_1 = require("./AdminGuard");
|
|
|
13
13
|
Object.defineProperty(exports, "AdminGuard", { enumerable: true, get: function () { return AdminGuard_1.AdminGuard; } });
|
|
14
14
|
var AdminLoginForm_1 = require("./AdminLoginForm");
|
|
15
15
|
Object.defineProperty(exports, "AdminLoginForm", { enumerable: true, get: function () { return AdminLoginForm_1.AdminLoginForm; } });
|
|
16
|
+
var AdminSetupForm_1 = require("./AdminSetupForm");
|
|
17
|
+
Object.defineProperty(exports, "AdminSetupForm", { enumerable: true, get: function () { return AdminSetupForm_1.AdminSetupForm; } });
|
|
16
18
|
// =============================================================================
|
|
17
19
|
// Layout Components
|
|
18
20
|
// =============================================================================
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/admin/components/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,gFAAgF;AAChF,kBAAkB;AAClB,gFAAgF;AAEhF,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AACnB,mDAAiD;AAAxC,gHAAA,cAAc,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/admin/components/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,gFAAgF;AAChF,kBAAkB;AAClB,gFAAgF;AAEhF,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AACnB,mDAAiD;AAAxC,gHAAA,cAAc,OAAA;AACvB,mDAAiD;AAAxC,gHAAA,cAAc,OAAA;AAGvB,gFAAgF;AAChF,oBAAoB;AACpB,gFAAgF;AAEhF,6CAA2C;AAAlC,0GAAA,WAAW,OAAA;AACpB,uCAAqC;AAA5B,oGAAA,QAAQ,OAAA;AACjB,6CAA2C;AAAlC,0GAAA,WAAW,OAAA;AAEpB,gFAAgF;AAChF,uBAAuB;AACvB,gFAAgF;AAEhF,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AACnB,+CAA6C;AAApC,4GAAA,YAAY,OAAA;AACrB,iDAA+C;AAAtC,8GAAA,aAAa,OAAA;AAEtB,gFAAgF;AAChF,qBAAqB;AACrB,gFAAgF;AAEhF,+CAA6C;AAApC,4GAAA,YAAY,OAAA;AACrB,6CAA2C;AAAlC,0GAAA,WAAW,OAAA;AACpB,qDAAmD;AAA1C,kHAAA,eAAe,OAAA;AAExB,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF,2CAAyC;AAAhC,wGAAA,UAAU,OAAA;AACnB,+CAA6C;AAApC,4GAAA,YAAY,OAAA;AACrB,+CAA6C;AAApC,4GAAA,YAAY,OAAA;AAErB,gFAAgF;AAChF,sBAAsB;AACtB,gFAAgF;AAEhF,iDAA+C;AAAtC,8GAAA,aAAa,OAAA"}
|
package/dist/admin/index.d.ts
CHANGED
|
@@ -57,7 +57,8 @@
|
|
|
57
57
|
export type { OrderStatus, ProductStatus, AdminRole, Order, OrderItem, Product, ProductVariant, Customer, StoreAdmin, Category, PaginatedResponse, ApiError, Address, AdminApiError, AdminSession, AdminAuthState, AdminSignInOptions, AdminSignInResult, DashboardStats, LowStockItem, RecentOrder, UseAdminStatsOptions, ProductFormData, VariantFormData, CategoryFormData, ProductListOptions, OrderListOptions, CustomerListOptions, CrudResult, RefundResult, StoreSettingsData, AdminOrderListItem, AdminOrderDetail, AdminOrderItem, AdminProductListItem, AdminProductDetail, AdminProductVariant, AdminCustomerListItem, AdminCustomerDetail, AdminCategoryListItem, AdminLayoutProps, AdminGuardProps, AdminLoginFormProps, AdminNavProps, AdminHeaderProps, StatsCardsProps, RecentOrdersProps, LowStockAlertProps, ProductTableProps, ProductFormProps, InventoryEditorProps, OrderTableProps, OrderDetailsProps, RefundDialogProps, StoreSettingsProps, CustomerTableProps, AdminAuthConfigOptions, UseAdminAuthReturn, UseAdminStatsReturn, UseAdminOrdersReturn, UseAdminProductsReturn, UseAdminCustomersReturn, UseAdminCategoriesReturn, } from './types';
|
|
58
58
|
export { createAdminAuthOptions, adminAuthConfig, adminAuthHandlers, createAdminNextAuthHandler, getAdminSession, } from './config';
|
|
59
59
|
export { authenticateAdmin, createAdmin, updateAdminPassword, findAdminForSession, findAdminByEmail, findAdminById, updateAdmin, adminEmailExists, countAdmins, } from './server';
|
|
60
|
-
export { createAdminAuthHandlers, getProducts, createProduct, getProduct, updateProduct, deleteProduct, addVariant, updateVariantHandler, deleteVariantHandler, getOrders, getOrder, updateOrder, processRefund, getStats, getCategories, createCategory, getCategory, updateCategory, deleteCategory, getCustomers, getCustomer, } from './api';
|
|
60
|
+
export { createAdminAuthHandlers, getProducts, createProduct, getProduct, updateProduct, deleteProduct, addVariant, updateVariantHandler, deleteVariantHandler, getOrders, getOrder, updateOrder, processRefund, getStats, getCategories, createCategory, getCategory, updateCategory, deleteCategory, getCustomers, getCustomer, setupAdmin, checkAdminExists, } from './api';
|
|
61
61
|
export { useAdminAuth, useAdminStats, useAdminProducts, useAdminOrders, } from './hooks';
|
|
62
|
-
export { AdminGuard, AdminLoginForm, AdminLayout, AdminNav, AdminHeader, StatsCards, RecentOrders, LowStockAlert, ProductTable, ProductForm, InventoryEditor, OrderTable, OrderDetails, RefundDialog, StoreSettings, } from './components';
|
|
62
|
+
export { AdminGuard, AdminLoginForm, AdminSetupForm, AdminLayout, AdminNav, AdminHeader, StatsCards, RecentOrders, LowStockAlert, ProductTable, ProductForm, InventoryEditor, OrderTable, OrderDetails, RefundDialog, StoreSettings, } from './components';
|
|
63
|
+
export type { AdminSetupFormProps } from './components';
|
|
63
64
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAMH,YAAY,EAEV,WAAW,EACX,aAAa,EACb,SAAS,EACT,KAAK,EACL,SAAS,EACT,OAAO,EACP,cAAc,EACd,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,iBAAiB,EACjB,QAAQ,EACR,OAAO,EAGP,aAAa,EAGb,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACV,YAAY,EACZ,iBAAiB,EAGjB,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EAGrB,gBAAgB,EAChB,eAAe,EACf,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAGlB,sBAAsB,EAGtB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,GACzB,MAAM,SAAS,CAAA;AAMhB,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,0BAA0B,EAC1B,eAAe,GAChB,MAAM,UAAU,CAAA;AAMjB,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,WAAW,GACZ,MAAM,UAAU,CAAA;AAOjB,OAAO,EACL,uBAAuB,EACvB,WAAW,EACX,aAAa,EACb,UAAU,EACV,aAAa,EACb,aAAa,EACb,UAAU,EACV,oBAAoB,EACpB,oBAAoB,EACpB,SAAS,EACT,QAAQ,EACR,WAAW,EACX,aAAa,EACb,QAAQ,EACR,aAAa,EACb,cAAc,EACd,WAAW,EACX,cAAc,EACd,cAAc,EACd,YAAY,EACZ,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAMH,YAAY,EAEV,WAAW,EACX,aAAa,EACb,SAAS,EACT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Aa,EACb,QAAQ,EACR,aAAa,EACb,cAAc,EACd,WAAW,EACX,cAAc,EACd,cAAc,EACd,YAAY,EACZ,WAAW,EAEX,UAAU,EAEV,gBAAgB,GACjB,MAAM,OAAO,CAAA;AAMd,OAAO,EACL,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,cAAc,GACf,MAAM,SAAS,CAAA;AAMhB,OAAO,EAEL,UAAU,EACV,cAAc,EACd,cAAc,EAEd,WAAW,EACX,QAAQ,EACR,WAAW,EAEX,UAAU,EACV,YAAY,EACZ,aAAa,EAEb,YAAY,EACZ,WAAW,EACX,eAAe,EAEf,UAAU,EACV,YAAY,EACZ,YAAY,EAEZ,aAAa,GACd,MAAM,cAAc,CAAA;AAGrB,YAAY,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA"}
|
package/dist/admin/index.js
CHANGED
|
@@ -56,8 +56,8 @@
|
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
58
58
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
|
-
exports.
|
|
60
|
-
exports.StoreSettings = exports.RefundDialog = exports.OrderDetails = exports.OrderTable = void 0;
|
|
59
|
+
exports.LowStockAlert = exports.RecentOrders = exports.StatsCards = exports.AdminHeader = exports.AdminNav = exports.AdminLayout = exports.AdminSetupForm = exports.AdminLoginForm = exports.AdminGuard = exports.useAdminOrders = exports.useAdminProducts = exports.useAdminStats = exports.useAdminAuth = exports.checkAdminExists = exports.setupAdmin = exports.getCustomer = exports.getCustomers = exports.deleteCategory = exports.updateCategory = exports.getCategory = exports.createCategory = exports.getCategories = exports.getStats = exports.processRefund = exports.updateOrder = exports.getOrder = exports.getOrders = exports.deleteVariantHandler = exports.updateVariantHandler = exports.addVariant = exports.deleteProduct = exports.updateProduct = exports.getProduct = exports.createProduct = exports.getProducts = exports.createAdminAuthHandlers = exports.countAdmins = exports.adminEmailExists = exports.updateAdmin = exports.findAdminById = exports.findAdminByEmail = exports.findAdminForSession = exports.updateAdminPassword = exports.createAdmin = exports.authenticateAdmin = exports.getAdminSession = exports.createAdminNextAuthHandler = exports.adminAuthHandlers = exports.adminAuthConfig = exports.createAdminAuthOptions = void 0;
|
|
60
|
+
exports.StoreSettings = exports.RefundDialog = exports.OrderDetails = exports.OrderTable = exports.InventoryEditor = exports.ProductForm = exports.ProductTable = void 0;
|
|
61
61
|
// =============================================================================
|
|
62
62
|
// Configuration (NextAuth)
|
|
63
63
|
// =============================================================================
|
|
@@ -106,6 +106,10 @@ Object.defineProperty(exports, "updateCategory", { enumerable: true, get: functi
|
|
|
106
106
|
Object.defineProperty(exports, "deleteCategory", { enumerable: true, get: function () { return api_1.deleteCategory; } });
|
|
107
107
|
Object.defineProperty(exports, "getCustomers", { enumerable: true, get: function () { return api_1.getCustomers; } });
|
|
108
108
|
Object.defineProperty(exports, "getCustomer", { enumerable: true, get: function () { return api_1.getCustomer; } });
|
|
109
|
+
// Setup (first-time admin creation)
|
|
110
|
+
Object.defineProperty(exports, "setupAdmin", { enumerable: true, get: function () { return api_1.setupAdmin; } });
|
|
111
|
+
// Check (check if admin exists)
|
|
112
|
+
Object.defineProperty(exports, "checkAdminExists", { enumerable: true, get: function () { return api_1.checkAdminExists; } });
|
|
109
113
|
// =============================================================================
|
|
110
114
|
// React Hooks
|
|
111
115
|
// =============================================================================
|
|
@@ -121,6 +125,7 @@ var components_1 = require("./components");
|
|
|
121
125
|
// Auth
|
|
122
126
|
Object.defineProperty(exports, "AdminGuard", { enumerable: true, get: function () { return components_1.AdminGuard; } });
|
|
123
127
|
Object.defineProperty(exports, "AdminLoginForm", { enumerable: true, get: function () { return components_1.AdminLoginForm; } });
|
|
128
|
+
Object.defineProperty(exports, "AdminSetupForm", { enumerable: true, get: function () { return components_1.AdminSetupForm; } });
|
|
124
129
|
// Layout
|
|
125
130
|
Object.defineProperty(exports, "AdminLayout", { enumerable: true, get: function () { return components_1.AdminLayout; } });
|
|
126
131
|
Object.defineProperty(exports, "AdminNav", { enumerable: true, get: function () { return components_1.AdminNav; } });
|
package/dist/admin/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;;;;AAqFH,gFAAgF;AAChF,2BAA2B;AAC3B,gFAAgF;AAEhF,mCAMiB;AALf,gHAAA,sBAAsB,OAAA;AACtB,yGAAA,eAAe,OAAA;AACf,2GAAA,iBAAiB,OAAA;AACjB,oHAAA,0BAA0B,OAAA;AAC1B,yGAAA,eAAe,OAAA;AAGjB,gFAAgF;AAChF,uBAAuB;AACvB,gFAAgF;AAEhF,mCAUiB;AATf,2GAAA,iBAAiB,OAAA;AACjB,qGAAA,WAAW,OAAA;AACX,6GAAA,mBAAmB,OAAA;AACnB,6GAAA,mBAAmB,OAAA;AACnB,0GAAA,gBAAgB,OAAA;AAChB,uGAAA,aAAa,OAAA;AACb,qGAAA,WAAW,OAAA;AACX,0GAAA,gBAAgB,OAAA;AAChB,qGAAA,WAAW,OAAA;AAGb,gFAAgF;AAChF,mDAAmD;AACnD,0EAA0E;AAC1E,gFAAgF;AAEhF,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;;;;AAqFH,gFAAgF;AAChF,2BAA2B;AAC3B,gFAAgF;AAEhF,mCAMiB;AALf,gHAAA,sBAAsB,OAAA;AACtB,yGAAA,eAAe,OAAA;AACf,2GAAA,iBAAiB,OAAA;AACjB,oHAAA,0BAA0B,OAAA;AAC1B,yGAAA,eAAe,OAAA;AAGjB,gFAAgF;AAChF,uBAAuB;AACvB,gFAAgF;AAEhF,mCAUiB;AATf,2GAAA,iBAAiB,OAAA;AACjB,qGAAA,WAAW,OAAA;AACX,6G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,WAAW,OAAA;AACX,YAAY;AACZ,wGAAA,UAAU,OAAA;AACV,0GAAA,YAAY,OAAA;AACZ,2GAAA,aAAa,OAAA;AACb,WAAW;AACX,0GAAA,YAAY,OAAA;AACZ,yGAAA,WAAW,OAAA;AACX,6GAAA,eAAe,OAAA;AACf,SAAS;AACT,wGAAA,UAAU,OAAA;AACV,0GAAA,YAAY,OAAA;AACZ,0GAAA,YAAY,OAAA;AACZ,WAAW;AACX,2GAAA,aAAa,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rovela-ai/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "Rovela SDK - Pre-built e-commerce components for AI-powered store generation",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Rovela AI",
|
|
@@ -119,6 +119,14 @@
|
|
|
119
119
|
"types": "./dist/admin/api/index.d.ts",
|
|
120
120
|
"default": "./dist/admin/api/index.js"
|
|
121
121
|
},
|
|
122
|
+
"./admin/api/setup": {
|
|
123
|
+
"types": "./dist/admin/api/setup.d.ts",
|
|
124
|
+
"default": "./dist/admin/api/setup.js"
|
|
125
|
+
},
|
|
126
|
+
"./admin/api/check": {
|
|
127
|
+
"types": "./dist/admin/api/check.d.ts",
|
|
128
|
+
"default": "./dist/admin/api/check.js"
|
|
129
|
+
},
|
|
122
130
|
"./admin/hooks": {
|
|
123
131
|
"types": "./dist/admin/hooks/index.d.ts",
|
|
124
132
|
"default": "./dist/admin/hooks/index.js"
|