@bridge-ai-dev/ecom-chat 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/bin/cli.js +10 -26
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -21,32 +21,16 @@ const log = {
21
21
  step: (msg) => console.log(`${colors.bold}🚀 ${msg}${colors.reset}`)
22
22
  };
23
23
 
24
- // The API route content that will be created
25
- const apiRouteContent = `import { NextRequest, NextResponse } from "next/server";
26
-
27
- /**
28
- * Bridge Auth API Route
29
- *
30
- * This route acts as a secure bridge to retrieve HttpOnly cookies
31
- * that cannot be accessed from client-side JavaScript.
32
- *
33
- * The ChatComponent uses this route to get authentication context
34
- * before initializing the chat widget.
35
- */
36
- export const GET = async (request: NextRequest) => {
37
- const cookies = request.cookies;
38
-
39
- // Retrieve the secure cookies
40
- // Note: cart-context is now retrieved from the URL query params in the client component
41
- const identity = cookies.get(".AspNetCore.Identity.Application")?.value;
42
-
43
- return NextResponse.json({
44
- identity: identity || null,
45
- // Optional: Include the raw cookie string if your backend needs it
46
- raw: request.headers.get("cookie")
47
- });
48
- };
49
- `;
24
+ // Read the API route content from the template file
25
+ const templatePath = path.join(__dirname, '..', 'templates', 'route.ts.template');
26
+ let apiRouteContent;
27
+
28
+ try {
29
+ apiRouteContent = fs.readFileSync(templatePath, 'utf8');
30
+ } catch (error) {
31
+ console.error(`${colors.red}❌ Error reading template file: ${error.message}${colors.reset}`);
32
+ process.exit(1);
33
+ }
50
34
 
51
35
  function isNextJsProject(cwd) {
52
36
  // Check for Next.js indicators
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bridge-ai-dev/ecom-chat",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Bridge E-commerce Chat widget integration for Next.js with Litium authentication",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",