@infuro/cms-core 1.0.31 → 1.0.33

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.
@@ -0,0 +1,32 @@
1
+ import { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ export class AddQrTokenToOrders1778660000003
4
+ implements MigrationInterface
5
+ {
6
+ name = 'AddQrTokenToOrders1778660000003';
7
+
8
+ public async up(queryRunner: QueryRunner): Promise<void> {
9
+ await queryRunner.query(`
10
+ ALTER TABLE "orders"
11
+ ADD COLUMN "qrToken" character varying
12
+ `);
13
+
14
+ await queryRunner.query(`
15
+ ALTER TABLE "orders"
16
+ ADD CONSTRAINT "UQ_orders_qrToken"
17
+ UNIQUE ("qrToken")
18
+ `);
19
+ }
20
+
21
+ public async down(queryRunner: QueryRunner): Promise<void> {
22
+ await queryRunner.query(`
23
+ ALTER TABLE "orders"
24
+ DROP CONSTRAINT "UQ_orders_qrToken"
25
+ `);
26
+
27
+ await queryRunner.query(`
28
+ ALTER TABLE "orders"
29
+ DROP COLUMN "qrToken"
30
+ `);
31
+ }
32
+ }
@@ -0,0 +1,16 @@
1
+ import type { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ /** Tracks when a lead notification email was sent for a chat conversation (avoid duplicates). */
4
+ export class ChatConversationLeadEmailSent1779100000000 implements MigrationInterface {
5
+ name = 'ChatConversationLeadEmailSent1779100000000';
6
+
7
+ public async up(queryRunner: QueryRunner): Promise<void> {
8
+ await queryRunner.query(
9
+ `ALTER TABLE "chat_conversations" ADD COLUMN IF NOT EXISTS "leadEmailSentAt" TIMESTAMP`
10
+ );
11
+ }
12
+
13
+ public async down(queryRunner: QueryRunner): Promise<void> {
14
+ await queryRunner.query(`ALTER TABLE "chat_conversations" DROP COLUMN IF EXISTS "leadEmailSentAt"`);
15
+ }
16
+ }
@@ -0,0 +1,72 @@
1
+ import type { MigrationInterface, QueryRunner } from 'typeorm';
2
+
3
+ /**
4
+ * Adds `llm_agents.scope` (chatbot, blog_creation, social_media_post, blog_metadata, email_intent_chatbot),
5
+ * backfills existing rows by slug, seeds the email-intent classifier agent, and enforces one active row per scope.
6
+ */
7
+ const EMAIL_INTENT_AGENT_NAME = 'Chat Lead Intent Classifier';
8
+ const EMAIL_INTENT_AGENT_SLUG = 'email-intent-chatbot';
9
+ const EMAIL_INTENT_SCOPE = 'email_intent_chatbot';
10
+
11
+ const EMAIL_INTENT_SYSTEM = `Classify the visitor message using the configured intent table.
12
+ Prefer a specific business intent when the visitor shows clear buying, support, or partnership signals.
13
+ Use NONE for greetings-only, FAQ, spam, or off-topic messages.`;
14
+
15
+ export class LlmAgentScope1779200000000 implements MigrationInterface {
16
+ name = 'LlmAgentScope1779200000000';
17
+
18
+ public async up(queryRunner: QueryRunner): Promise<void> {
19
+ await queryRunner.query(`
20
+ ALTER TABLE "llm_agents"
21
+ ADD COLUMN IF NOT EXISTS "scope" character varying
22
+ `);
23
+
24
+ await queryRunner.query(`
25
+ UPDATE "llm_agents"
26
+ SET "scope" = 'chatbot'
27
+ WHERE "deleted" = false AND "scope" IS NULL AND "slug" = 'site-chat-assistant'
28
+ `);
29
+ await queryRunner.query(`
30
+ UPDATE "llm_agents"
31
+ SET "scope" = 'blog_creation'
32
+ WHERE "deleted" = false AND "scope" IS NULL AND "slug" = 'blog-generator'
33
+ `);
34
+ await queryRunner.query(`
35
+ UPDATE "llm_agents"
36
+ SET "scope" = 'social_media_post'
37
+ WHERE "deleted" = false AND "scope" IS NULL AND "slug" = 'blog-generator-social'
38
+ `);
39
+ await queryRunner.query(`
40
+ UPDATE "llm_agents"
41
+ SET "scope" = 'blog_metadata'
42
+ WHERE "deleted" = false AND "scope" IS NULL AND "slug" = 'blog-generator-metadata'
43
+ `);
44
+
45
+ await queryRunner.query(
46
+ `
47
+ INSERT INTO "llm_agents" ("name", "slug", "scope", "system_instruction", "enabled", "createdAt", "updatedAt", "deleted")
48
+ SELECT $1::varchar, $2::varchar, $3::varchar, $4::text, true, now(), now(), false
49
+ WHERE NOT EXISTS (
50
+ SELECT 1 FROM "llm_agents" a
51
+ WHERE a."deleted" = false AND (a."scope" = $3::varchar OR a."slug" = $2::varchar)
52
+ )
53
+ `,
54
+ [EMAIL_INTENT_AGENT_NAME, EMAIL_INTENT_AGENT_SLUG, EMAIL_INTENT_SCOPE, EMAIL_INTENT_SYSTEM]
55
+ );
56
+
57
+ await queryRunner.query(`
58
+ CREATE UNIQUE INDEX IF NOT EXISTS "UQ_llm_agents_scope_active"
59
+ ON "llm_agents" ("scope")
60
+ WHERE "deleted" = false AND "scope" IS NOT NULL
61
+ `);
62
+ }
63
+
64
+ public async down(queryRunner: QueryRunner): Promise<void> {
65
+ await queryRunner.query(`DROP INDEX IF EXISTS "UQ_llm_agents_scope_active"`);
66
+ await queryRunner.query(`
67
+ DELETE FROM "llm_agents"
68
+ WHERE "slug" = $1 AND "scope" = $2
69
+ `, [EMAIL_INTENT_AGENT_SLUG, EMAIL_INTENT_SCOPE]);
70
+ await queryRunner.query(`ALTER TABLE "llm_agents" DROP COLUMN IF EXISTS "scope"`);
71
+ }
72
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infuro/cms-core",
3
- "version": "1.0.31",
3
+ "version": "1.0.33",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -130,6 +130,7 @@
130
130
  "cron-parser": "^4.9.0",
131
131
  "razorpay": "^2.9.6",
132
132
  "react-chartjs-2": "^5.3.0",
133
+ "react-qr-code": "^2.0.21",
133
134
  "reflect-metadata": "^0.2.2",
134
135
  "rss-parser": "^3.13.0",
135
136
  "sonner": "^2.0.6",