@jsdev_ninja/core 0.15.0 → 0.15.2

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 (51) hide show
  1. package/dist/core.cjs +1 -1
  2. package/dist/core.cjs.map +1 -1
  3. package/dist/core.es.js +497 -530
  4. package/dist/core.es.js.map +1 -1
  5. package/dist/core.umd.js +1 -1
  6. package/dist/core.umd.js.map +1 -1
  7. package/dist/lib/entities/Budget.d.ts +68 -59
  8. package/dist/lib/entities/Budget.d.ts.map +1 -1
  9. package/dist/lib/entities/Budget.js +47 -36
  10. package/dist/lib/entities/Cart.d.ts +2257 -10
  11. package/dist/lib/entities/Cart.d.ts.map +1 -1
  12. package/dist/lib/entities/Cart.js +16 -0
  13. package/dist/lib/entities/DeliveryNote.d.ts +0 -1
  14. package/dist/lib/entities/DeliveryNote.d.ts.map +1 -1
  15. package/dist/lib/entities/Discount/index.d.ts +0 -1
  16. package/dist/lib/entities/Discount/index.d.ts.map +1 -1
  17. package/dist/lib/entities/Discount/index.js +0 -1
  18. package/dist/lib/entities/Invoice.d.ts +0 -2
  19. package/dist/lib/entities/Invoice.d.ts.map +1 -1
  20. package/dist/lib/entities/Locale.d.ts +0 -10
  21. package/dist/lib/entities/Locale.d.ts.map +1 -1
  22. package/dist/lib/entities/Locale.js +0 -1
  23. package/dist/lib/entities/Order.d.ts +1138 -2
  24. package/dist/lib/entities/Order.d.ts.map +1 -1
  25. package/dist/lib/entities/Order.js +3 -0
  26. package/dist/lib/entities/SupplierInvoice.d.ts +6 -1
  27. package/dist/lib/entities/SupplierInvoice.d.ts.map +1 -1
  28. package/dist/lib/entities/SupplierInvoice.js +4 -0
  29. package/dist/lib/entities/index.d.ts +0 -1
  30. package/dist/lib/entities/index.d.ts.map +1 -1
  31. package/dist/lib/entities/index.js +0 -1
  32. package/dist/lib/firebase-api/index.d.ts +15 -0
  33. package/dist/lib/firebase-api/index.d.ts.map +1 -1
  34. package/dist/lib/firebase-api/index.js +5 -0
  35. package/dist/lib/index.d.ts +1 -1
  36. package/dist/lib/index.d.ts.map +1 -1
  37. package/dist/lib/index.js +1 -1
  38. package/dist/tsconfig.app.tsbuildinfo +1 -1
  39. package/package.json +58 -58
  40. package/dist/lib/entities/Chatbot/index.d.ts +0 -96
  41. package/dist/lib/entities/Chatbot/index.d.ts.map +0 -1
  42. package/dist/lib/entities/Chatbot/index.js +0 -37
  43. package/dist/lib/entities/Discount/__tests__/utils.test.d.ts +0 -2
  44. package/dist/lib/entities/Discount/__tests__/utils.test.d.ts.map +0 -1
  45. package/dist/lib/entities/Discount/__tests__/utils.test.js +0 -55
  46. package/dist/lib/entities/Discount/utils.d.ts +0 -29
  47. package/dist/lib/entities/Discount/utils.d.ts.map +0 -1
  48. package/dist/lib/entities/Discount/utils.js +0 -39
  49. package/dist/lib/firebase-api/app.d.ts +0 -2
  50. package/dist/lib/firebase-api/app.d.ts.map +0 -1
  51. package/dist/lib/firebase-api/app.js +0 -16
package/package.json CHANGED
@@ -1,60 +1,60 @@
1
1
  {
2
- "name": "@jsdev_ninja/core",
3
- "version": "0.15.0",
4
- "type": "module",
5
- "main": "dist/core.cjs",
6
- "module": "dist/core.es.js",
7
- "types": "dist/lib/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "import": "./dist/core.es.js",
11
- "require": "./dist/core.cjs",
12
- "types": "./dist/lib/index.d.ts"
13
- }
14
- },
15
- "repository": {
16
- "type": "git",
17
- "url": "https://github.com/jsdev-ninja/stores.git"
18
- },
19
- "files": [
20
- "dist",
21
- "package.json",
22
- "README.md"
23
- ],
24
- "publishConfig": {
25
- "access": "public",
26
- "registry": "https://registry.npmjs.org"
27
- },
28
- "scripts": {
29
- "dev": "vite",
30
- "build": "vite build && tsc -b",
31
- "prepare": "yarn build",
32
- "prepublishOnly": "yarn build",
33
- "lint": "eslint .",
34
- "preview": "vite preview",
35
- "publish_core": "yarn publish --non-interactive",
36
- "test": "vitest",
37
- "test:run": "vitest run"
38
- },
39
- "dependencies": {
40
- "zod": "^3.23.8"
41
- },
42
- "devDependencies": {
43
- "@eslint/js": "^9.9.0",
44
- "@types/node": "^24.0.15",
45
- "@types/react": "^18.3.3",
46
- "@types/react-dom": "^18.3.0",
47
- "@vitejs/plugin-react-swc": "^3.5.0",
48
- "eslint": "^9.9.0",
49
- "eslint-plugin-react-hooks": "^5.1.0-rc.0",
50
- "eslint-plugin-react-refresh": "^0.4.9",
51
- "globals": "^15.9.0",
52
- "react": "^18.3.1",
53
- "react-dom": "^18.3.1",
54
- "ts-node": "^10.9.2",
55
- "typescript": "^5.5.3",
56
- "typescript-eslint": "^8.0.1",
57
- "vite": "^5.4.1",
58
- "vitest": "^3.2.4"
59
- }
2
+ "name": "@jsdev_ninja/core",
3
+ "version": "0.15.2",
4
+ "type": "module",
5
+ "main": "dist/core.cjs",
6
+ "module": "dist/core.es.js",
7
+ "types": "dist/lib/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/core.es.js",
11
+ "require": "./dist/core.cjs",
12
+ "types": "./dist/lib/index.d.ts"
13
+ }
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/jsdev-ninja/stores.git"
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "package.json",
22
+ "README.md"
23
+ ],
24
+ "publishConfig": {
25
+ "access": "public",
26
+ "registry": "https://registry.npmjs.org"
27
+ },
28
+ "scripts": {
29
+ "dev": "vite",
30
+ "build": "vite build && tsc -b",
31
+ "prepare": "yarn build",
32
+ "prepublishOnly": "yarn build",
33
+ "lint": "eslint .",
34
+ "preview": "vite preview",
35
+ "publish_core": "yarn publish --non-interactive",
36
+ "test": "vitest",
37
+ "test:run": "vitest run"
38
+ },
39
+ "dependencies": {
40
+ "zod": "^3.23.8"
41
+ },
42
+ "devDependencies": {
43
+ "@eslint/js": "^9.9.0",
44
+ "@types/node": "^24.0.15",
45
+ "@types/react": "^18.3.3",
46
+ "@types/react-dom": "^18.3.0",
47
+ "@vitejs/plugin-react-swc": "^3.5.0",
48
+ "eslint": "^9.9.0",
49
+ "eslint-plugin-react-hooks": "^5.1.0-rc.0",
50
+ "eslint-plugin-react-refresh": "^0.4.9",
51
+ "globals": "^15.9.0",
52
+ "react": "^18.3.1",
53
+ "react-dom": "^18.3.1",
54
+ "ts-node": "^10.9.2",
55
+ "typescript": "^5.5.3",
56
+ "typescript-eslint": "^8.0.1",
57
+ "vite": "^5.4.1",
58
+ "vitest": "^3.2.4"
59
+ }
60
60
  }
@@ -1,96 +0,0 @@
1
- import { z } from "zod";
2
- export declare const ChatSessionSchema: z.ZodObject<{
3
- type: z.ZodLiteral<"ChatSession">;
4
- id: z.ZodString;
5
- storeId: z.ZodString;
6
- companyId: z.ZodString;
7
- tenantId: z.ZodString;
8
- userId: z.ZodNullable<z.ZodString>;
9
- userType: z.ZodEnum<["anonymous", "client", "admin", "superAdmin"]>;
10
- createdAt: z.ZodNumber;
11
- updatedAt: z.ZodNumber;
12
- messageCount: z.ZodNumber;
13
- status: z.ZodEnum<["active", "archived"]>;
14
- }, "strip", z.ZodTypeAny, {
15
- type: "ChatSession";
16
- status: "active" | "archived";
17
- id: string;
18
- companyId: string;
19
- storeId: string;
20
- userId: string | null;
21
- tenantId: string;
22
- createdAt: number;
23
- userType: "admin" | "client" | "anonymous" | "superAdmin";
24
- updatedAt: number;
25
- messageCount: number;
26
- }, {
27
- type: "ChatSession";
28
- status: "active" | "archived";
29
- id: string;
30
- companyId: string;
31
- storeId: string;
32
- userId: string | null;
33
- tenantId: string;
34
- createdAt: number;
35
- userType: "admin" | "client" | "anonymous" | "superAdmin";
36
- updatedAt: number;
37
- messageCount: number;
38
- }>;
39
- export type TChatSession = z.infer<typeof ChatSessionSchema>;
40
- export declare const ChatSessionMessageSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
41
- type: z.ZodLiteral<"message">;
42
- id: z.ZodString;
43
- role: z.ZodEnum<["user", "assistant", "system"]>;
44
- content: z.ZodString;
45
- timestamp: z.ZodNumber;
46
- }, "strip", z.ZodTypeAny, {
47
- type: "message";
48
- id: string;
49
- role: "user" | "assistant" | "system";
50
- content: string;
51
- timestamp: number;
52
- }, {
53
- type: "message";
54
- id: string;
55
- role: "user" | "assistant" | "system";
56
- content: string;
57
- timestamp: number;
58
- }>, z.ZodObject<{
59
- type: z.ZodLiteral<"function_call">;
60
- id: z.ZodString;
61
- name: z.ZodString;
62
- arguments: z.ZodRecord<z.ZodString, z.ZodAny>;
63
- timestamp: z.ZodNumber;
64
- }, "strip", z.ZodTypeAny, {
65
- type: "function_call";
66
- id: string;
67
- name: string;
68
- timestamp: number;
69
- arguments: Record<string, any>;
70
- }, {
71
- type: "function_call";
72
- id: string;
73
- name: string;
74
- timestamp: number;
75
- arguments: Record<string, any>;
76
- }>, z.ZodObject<{
77
- type: z.ZodLiteral<"tool_result">;
78
- id: z.ZodString;
79
- name: z.ZodString;
80
- result: z.ZodAny;
81
- timestamp: z.ZodNumber;
82
- }, "strip", z.ZodTypeAny, {
83
- type: "tool_result";
84
- id: string;
85
- name: string;
86
- timestamp: number;
87
- result?: any;
88
- }, {
89
- type: "tool_result";
90
- id: string;
91
- name: string;
92
- timestamp: number;
93
- result?: any;
94
- }>]>;
95
- export type TChatSessionMessage = z.infer<typeof ChatSessionMessageSchema>;
96
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/entities/Chatbot/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAY5B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE7D,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsBnC,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC"}
@@ -1,37 +0,0 @@
1
- import { z } from "zod";
2
- export const ChatSessionSchema = z.object({
3
- type: z.literal("ChatSession"),
4
- id: z.string(),
5
- storeId: z.string(),
6
- companyId: z.string(),
7
- tenantId: z.string(),
8
- userId: z.string().nullable(),
9
- userType: z.enum(["anonymous", "client", "admin", "superAdmin"]),
10
- createdAt: z.number(),
11
- updatedAt: z.number(),
12
- messageCount: z.number(),
13
- status: z.enum(["active", "archived"]),
14
- });
15
- export const ChatSessionMessageSchema = z.discriminatedUnion("type", [
16
- z.object({
17
- type: z.literal("message"),
18
- id: z.string(),
19
- role: z.enum(["user", "assistant", "system"]),
20
- content: z.string(),
21
- timestamp: z.number(),
22
- }),
23
- z.object({
24
- type: z.literal("function_call"),
25
- id: z.string(),
26
- name: z.string(),
27
- arguments: z.record(z.string(), z.any()),
28
- timestamp: z.number(),
29
- }),
30
- z.object({
31
- type: z.literal("tool_result"),
32
- id: z.string(),
33
- name: z.string(),
34
- result: z.any(),
35
- timestamp: z.number(),
36
- }),
37
- ]);
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=utils.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.test.d.ts","sourceRoot":"","sources":["../../../../../lib/entities/Discount/__tests__/utils.test.ts"],"names":[],"mappings":""}
@@ -1,55 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { formatCurrency, formatCurrencyString, ensureNonNegative, calculatePercentageDiscount } from "../utils";
3
- describe("Discount Utils", () => {
4
- describe("formatCurrency", () => {
5
- it("should format numbers to 2 decimal places", () => {
6
- expect(formatCurrency(10)).toBe(10.00);
7
- expect(formatCurrency(10.123)).toBe(10.12);
8
- expect(formatCurrency(10.125)).toBe(10.13); // Rounds up
9
- expect(formatCurrency(10.124)).toBe(10.12); // Rounds down
10
- expect(formatCurrency(0)).toBe(0.00);
11
- });
12
- it("should return a number type", () => {
13
- const result = formatCurrency(10.123);
14
- expect(typeof result).toBe("number");
15
- });
16
- });
17
- describe("formatCurrencyString", () => {
18
- it("should format numbers to 2 decimal places as string", () => {
19
- expect(formatCurrencyString(10)).toBe("10.00");
20
- expect(formatCurrencyString(10.123)).toBe("10.12");
21
- expect(formatCurrencyString(10.125)).toBe("10.13");
22
- expect(formatCurrencyString(0)).toBe("0.00");
23
- });
24
- it("should return a string type", () => {
25
- const result = formatCurrencyString(10.123);
26
- expect(typeof result).toBe("string");
27
- });
28
- });
29
- describe("ensureNonNegative", () => {
30
- it("should return 0 for negative values", () => {
31
- expect(ensureNonNegative(-5)).toBe(0.00);
32
- expect(ensureNonNegative(-0.01)).toBe(0.00);
33
- });
34
- it("should return formatted value for positive values", () => {
35
- expect(ensureNonNegative(10.123)).toBe(10.12);
36
- expect(ensureNonNegative(0)).toBe(0.00);
37
- });
38
- });
39
- describe("calculatePercentageDiscount", () => {
40
- it("should calculate percentage discount correctly", () => {
41
- expect(calculatePercentageDiscount(100, 80)).toBe(20.00); // 20% discount
42
- expect(calculatePercentageDiscount(50, 25)).toBe(50.00); // 50% discount
43
- expect(calculatePercentageDiscount(100, 100)).toBe(0.00); // No discount
44
- });
45
- it("should handle edge cases", () => {
46
- expect(calculatePercentageDiscount(0, 0)).toBe(0.00);
47
- expect(calculatePercentageDiscount(100, 0)).toBe(100.00); // 100% discount
48
- });
49
- it("should return formatted number", () => {
50
- const result = calculatePercentageDiscount(100, 90.5);
51
- expect(typeof result).toBe("number");
52
- expect(result).toBe(9.50); // 9.5% discount
53
- });
54
- });
55
- });
@@ -1,29 +0,0 @@
1
- /**
2
- * Utility functions for discount calculations
3
- */
4
- /**
5
- * Formats a number to 2 decimal places and returns as a number
6
- * @param value - The number to format
7
- * @returns The formatted number with 2 decimal places
8
- */
9
- export declare function formatCurrency(value: number): number;
10
- /**
11
- * Formats a number to 2 decimal places and returns as a string
12
- * @param value - The number to format
13
- * @returns The formatted string with 2 decimal places
14
- */
15
- export declare function formatCurrencyString(value: number): string;
16
- /**
17
- * Ensures a monetary value is never negative
18
- * @param value - The value to check
19
- * @returns The value, or 0 if negative
20
- */
21
- export declare function ensureNonNegative(value: number): number;
22
- /**
23
- * Calculates the percentage discount
24
- * @param originalPrice - The original price
25
- * @param discountedPrice - The discounted price
26
- * @returns The percentage discount (0-100)
27
- */
28
- export declare function calculatePercentageDiscount(originalPrice: number, discountedPrice: number): number;
29
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../lib/entities/Discount/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,aAAa,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,CAIlG"}
@@ -1,39 +0,0 @@
1
- /**
2
- * Utility functions for discount calculations
3
- */
4
- /**
5
- * Formats a number to 2 decimal places and returns as a number
6
- * @param value - The number to format
7
- * @returns The formatted number with 2 decimal places
8
- */
9
- export function formatCurrency(value) {
10
- return Number(value.toFixed(2));
11
- }
12
- /**
13
- * Formats a number to 2 decimal places and returns as a string
14
- * @param value - The number to format
15
- * @returns The formatted string with 2 decimal places
16
- */
17
- export function formatCurrencyString(value) {
18
- return value.toFixed(2);
19
- }
20
- /**
21
- * Ensures a monetary value is never negative
22
- * @param value - The value to check
23
- * @returns The value, or 0 if negative
24
- */
25
- export function ensureNonNegative(value) {
26
- return Math.max(0, formatCurrency(value));
27
- }
28
- /**
29
- * Calculates the percentage discount
30
- * @param originalPrice - The original price
31
- * @param discountedPrice - The discounted price
32
- * @returns The percentage discount (0-100)
33
- */
34
- export function calculatePercentageDiscount(originalPrice, discountedPrice) {
35
- if (originalPrice <= 0)
36
- return 0;
37
- const discount = originalPrice - discountedPrice;
38
- return formatCurrency((discount / originalPrice) * 100);
39
- }
@@ -1,2 +0,0 @@
1
- export declare const app: import("@firebase/app").FirebaseApp;
2
- //# sourceMappingURL=app.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../lib/firebase-api/app.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,GAAG,qCAAgC,CAAC"}
@@ -1,16 +0,0 @@
1
- // Import the functions you need from the SDKs you need
2
- import { initializeApp } from "firebase/app";
3
- // Your web app's Firebase configuration
4
- // For Firebase JS SDK v7.20.0 and later, measurementId is optional
5
- const firebaseConfig = {
6
- apiKey: "AIzaSyAXtA4pdBs7GLX45lK3jYZRiUwo7M06-_s",
7
- authDomain: "jsdev-stores-prod.firebaseapp.com",
8
- projectId: "jsdev-stores-prod",
9
- storageBucket: "jsdev-stores-prod.appspot.com",
10
- messagingSenderId: "333321054844",
11
- appId: "1:333321054844:web:7d3c15617daa54107537f9",
12
- measurementId: "G-CJ44QNETK8",
13
- };
14
- // Initialize Firebase
15
- export const app = initializeApp(firebaseConfig);
16
- // TESTER