@appcorp/stellar-solutions-invoice-module 0.1.56 → 0.1.57

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 (68) hide show
  1. package/base-modules/invoice/add-service-product-section.d.ts +12 -2
  2. package/base-modules/invoice/add-service-product-section.js +20 -10
  3. package/base-modules/invoice/company-form-section.d.ts +12 -2
  4. package/base-modules/invoice/company-form-section.js +118 -10
  5. package/base-modules/invoice/constants.d.ts +9 -25
  6. package/base-modules/invoice/constants.js +66 -557
  7. package/base-modules/invoice/context.d.ts +42 -2
  8. package/base-modules/invoice/context.js +220 -311
  9. package/base-modules/invoice/customer-form-section.d.ts +12 -2
  10. package/base-modules/invoice/customer-form-section.js +91 -9
  11. package/base-modules/invoice/drawer.d.ts +9 -4
  12. package/base-modules/invoice/drawer.js +32 -6
  13. package/base-modules/invoice/form.d.ts +2 -4
  14. package/base-modules/invoice/form.js +7 -6
  15. package/base-modules/invoice/invoice.d.ts +2 -2
  16. package/base-modules/invoice/invoice.js +33 -42
  17. package/base-modules/invoice/pricing-form-section.d.ts +12 -2
  18. package/base-modules/invoice/pricing-form-section.js +65 -9
  19. package/base-modules/invoice/products-form-section.d.ts +12 -2
  20. package/base-modules/invoice/products-form-section.js +57 -32
  21. package/base-modules/invoice/reducer.d.ts +2 -2
  22. package/base-modules/invoice/reducer.js +56 -53
  23. package/base-modules/invoice/services-form-section.d.ts +12 -2
  24. package/base-modules/invoice/services-form-section.js +61 -15
  25. package/base-modules/invoice/types.d.ts +16 -21
  26. package/base-modules/invoice/validate.d.ts +23 -3
  27. package/base-modules/invoice/validate.js +61 -61
  28. package/base-modules/quote/actions.d.ts +215 -0
  29. package/base-modules/quote/actions.js +38 -0
  30. package/base-modules/quote/add-service-product-section.d.ts +12 -0
  31. package/base-modules/quote/add-service-product-section.js +31 -0
  32. package/base-modules/quote/calculate-subtotal.d.ts +1 -0
  33. package/base-modules/quote/calculate-subtotal.js +6 -0
  34. package/base-modules/quote/calculate-total.d.ts +1 -0
  35. package/base-modules/quote/calculate-total.js +6 -0
  36. package/base-modules/quote/company-form-section.d.ts +12 -0
  37. package/base-modules/quote/company-form-section.js +125 -0
  38. package/base-modules/quote/constants.d.ts +64 -0
  39. package/base-modules/quote/constants.js +107 -0
  40. package/base-modules/quote/context.d.ts +50 -0
  41. package/base-modules/quote/context.js +822 -0
  42. package/base-modules/quote/customer-form-section.d.ts +12 -0
  43. package/base-modules/quote/customer-form-section.js +99 -0
  44. package/base-modules/quote/drawer.d.ts +13 -0
  45. package/base-modules/quote/drawer.js +45 -0
  46. package/base-modules/quote/form.d.ts +6 -0
  47. package/base-modules/quote/form.js +27 -0
  48. package/base-modules/quote/pricing-form-section.d.ts +12 -0
  49. package/base-modules/quote/pricing-form-section.js +76 -0
  50. package/base-modules/quote/products-form-section.d.ts +12 -0
  51. package/base-modules/quote/products-form-section.js +71 -0
  52. package/base-modules/quote/quote.d.ts +8 -0
  53. package/base-modules/quote/quote.js +69 -0
  54. package/base-modules/quote/reducer.d.ts +4 -0
  55. package/base-modules/quote/reducer.js +181 -0
  56. package/base-modules/quote/services-form-section.d.ts +12 -0
  57. package/base-modules/quote/services-form-section.js +73 -0
  58. package/base-modules/quote/types.d.ts +126 -0
  59. package/base-modules/quote/types.js +35 -0
  60. package/base-modules/quote/validate.d.ts +856 -0
  61. package/base-modules/quote/validate.js +85 -0
  62. package/package.json +21 -8
  63. package/base-modules/invoice/company-form-elements.d.ts +0 -3
  64. package/base-modules/invoice/company-form-elements.js +0 -41
  65. package/base-modules/invoice/customer-form-elements.d.ts +0 -3
  66. package/base-modules/invoice/customer-form-elements.js +0 -41
  67. package/base-modules/invoice/pricing-form-elements.d.ts +0 -3
  68. package/base-modules/invoice/pricing-form-elements.js +0 -41
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.formValidation = exports.formValid = void 0;
7
+ var zod_1 = __importDefault(require("zod"));
8
+ var constants_1 = require("./constants");
9
+ var types_1 = require("./types");
10
+ var services = zod_1.default.object({
11
+ name: zod_1.default.string().nonempty(constants_1.validationErrors.services.name),
12
+ description: zod_1.default.string().nonempty(constants_1.validationErrors.services.description),
13
+ quantity: zod_1.default.string().nonempty(constants_1.validationErrors.services.quantity),
14
+ price: zod_1.default.string().nonempty(constants_1.validationErrors.services.price),
15
+ rowTotal: zod_1.default.string().nonempty(constants_1.validationErrors.services.total),
16
+ });
17
+ // ============================================================================
18
+ // PRODUCT ITEM SCHEMA
19
+ // ============================================================================
20
+ var products = zod_1.default.object({
21
+ id: zod_1.default.string().nonempty(constants_1.validationErrors.products.id),
22
+ quantity: zod_1.default.string().nonempty(constants_1.validationErrors.products.quantity),
23
+ price: zod_1.default.string().nonempty(constants_1.validationErrors.products.price),
24
+ rowTotal: zod_1.default.string().nonempty(constants_1.validationErrors.products.total),
25
+ });
26
+ // ============================================================================
27
+ // PRICING SCHEMA
28
+ // ============================================================================
29
+ var pricingSchema = zod_1.default.object({
30
+ // companyId: z.string().optional(),
31
+ // ref: z.string().nonempty(validationErrors.ref),
32
+ // date: z.string().nonempty(validationErrors.date),
33
+ // expiryDate: z
34
+ // .string()
35
+ // .nonempty(validationErrors.expiryDate),
36
+ // note: z.string().optional(),
37
+ // currency: z
38
+ // .string()
39
+ // .nonempty(validationErrors.currency),
40
+ discountUnit: zod_1.default.string().nonempty(""),
41
+ discount: zod_1.default.string().nonempty(""),
42
+ total: zod_1.default.string().nonempty(constants_1.validationErrors.total),
43
+ subTotal: zod_1.default.string().nonempty(constants_1.validationErrors.subTotal),
44
+ taxRate: zod_1.default.string().nonempty(constants_1.validationErrors.taxRate),
45
+ // servicesList: z.array(services),
46
+ // productsList: z.array(products),
47
+ });
48
+ // ============================================================================
49
+ // CUSTOMER INVOICE SCHEMA
50
+ // ============================================================================
51
+ var customerSchema = zod_1.default.object({
52
+ address: zod_1.default.string().nonempty(constants_1.validationErrors.customerAddress),
53
+ city: zod_1.default.string().nonempty(constants_1.validationErrors.customerCity),
54
+ country: zod_1.default.string().nonempty(constants_1.validationErrors.customerCountry),
55
+ currency: zod_1.default.string(),
56
+ drawer: zod_1.default.literal(types_1.QUOTE_DRAWER.QUOTE_CUSTOMER_FORM_DRAWER),
57
+ email: zod_1.default.string().nonempty(constants_1.validationErrors.customerEmail),
58
+ firstName: zod_1.default.string().nonempty(constants_1.validationErrors.customerFirstName),
59
+ lastName: zod_1.default.string().nonempty(constants_1.validationErrors.customerLastName),
60
+ phone: zod_1.default.string().nonempty(constants_1.validationErrors.customerPhone),
61
+ servicesList: zod_1.default.array(services).optional(),
62
+ productsList: zod_1.default.array(products).optional(),
63
+ });
64
+ // ============================================================================
65
+ // COMPANY INVOICE SCHEMA
66
+ // ============================================================================
67
+ var companySchema = zod_1.default.object({
68
+ companyId: zod_1.default.string().nonempty(constants_1.validationErrors.companyId),
69
+ currency: zod_1.default.string().nonempty(constants_1.validationErrors.currency),
70
+ date: zod_1.default.string().nonempty(constants_1.validationErrors.date),
71
+ drawer: zod_1.default.literal(types_1.QUOTE_DRAWER.QUOTE_COMPANY_FORM_DRAWER),
72
+ expiryDate: zod_1.default.string().nonempty(constants_1.validationErrors.expiryDate),
73
+ note: zod_1.default.string().optional(),
74
+ ref: zod_1.default.string().nonempty(constants_1.validationErrors.ref),
75
+ servicesList: zod_1.default.array(services).optional(),
76
+ productsList: zod_1.default.array(products).optional(),
77
+ });
78
+ // ============================================================================
79
+ // MAIN FORM VALIDATION (DISCRIMINATED UNION)
80
+ // ============================================================================
81
+ exports.formValid = zod_1.default.discriminatedUnion("drawer", [
82
+ customerSchema,
83
+ companySchema,
84
+ ]);
85
+ exports.formValidation = zod_1.default.object(pricingSchema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@appcorp/stellar-solutions-invoice-module",
3
- "version": "0.1.56",
3
+ "version": "0.1.57",
4
4
  "scripts": {
5
5
  "automate": "./automate.sh",
6
6
  "build": "yarn clean && yarn build:ts && cp package.json lib && cp README.md lib && cp yarn.lock lib",
@@ -16,17 +16,26 @@
16
16
  "publish:npm": "yarn build && cd lib/ && npm publish --access public && cd ..",
17
17
  "start": "next start",
18
18
  "upgrade": "ncu -u",
19
- "upgrade:own": "ncu -f '@appcorp/app-corp-vista, @appcorp/stellar-solutions-company-module, @appcorp/stellar-solutions-modules, @appcorp/stellar-solutions-product-module, @react-pakistan/util-functions' -u"
19
+ "upgrade:own": "ncu -f '@appcorp/app-corp-vista, @appcorp/shadcn, @appcorp/stellar-solutions-company-module, @appcorp/stellar-solutions-modules, @appcorp/stellar-solutions-product-module, @react-pakistan/util-functions' -u"
20
20
  },
21
21
  "devDependencies": {
22
- "@appcorp/app-corp-vista": "^0.3.20",
23
- "@appcorp/stellar-solutions-company-module": "^0.1.33",
24
- "@appcorp/stellar-solutions-modules": "^0.1.33",
25
- "@appcorp/stellar-solutions-product-module": "^0.2.11",
22
+ "@appcorp/app-corp-vista": "^0.3.48",
23
+ "@appcorp/shadcn": "^1.0.32",
24
+ "@appcorp/stellar-solutions-company-module": "^0.1.37",
25
+ "@appcorp/stellar-solutions-modules": "^0.1.59",
26
+ "@appcorp/stellar-solutions-product-module": "^0.2.17",
26
27
  "@eslint/eslintrc": "^3",
27
28
  "@headlessui/react": "^2",
28
29
  "@heroicons/react": "^2",
29
- "@react-pakistan/util-functions": "^1.24.56",
30
+ "@radix-ui/react-checkbox": "^1",
31
+ "@radix-ui/react-dropdown-menu": "^2",
32
+ "@radix-ui/react-label": "^2",
33
+ "@radix-ui/react-popover": "^1",
34
+ "@radix-ui/react-select": "^2",
35
+ "@radix-ui/react-separator": "^1",
36
+ "@radix-ui/react-slot": "^1",
37
+ "@radix-ui/react-switch": "^1",
38
+ "@react-pakistan/util-functions": "^1.24.78",
30
39
  "@supabase/supabase-js": "^2",
31
40
  "@tailwindcss/forms": "^0",
32
41
  "@tailwindcss/postcss": "^4",
@@ -34,14 +43,18 @@
34
43
  "@types/react": "^19",
35
44
  "@types/react-dom": "^19",
36
45
  "@types/react-slick": "^0",
46
+ "class-variance-authority": "^0",
47
+ "cmdk": "^1.1.1",
37
48
  "date-fns": "^4",
38
49
  "dayjs": "^1",
39
50
  "eslint": "^9",
40
51
  "eslint-config-next": "^15",
41
52
  "husky": "^9",
42
53
  "libphonenumber-js": "^1",
54
+ "lucide-react": "^0",
43
55
  "next": "^15",
44
56
  "next-intl": "^4",
57
+ "next-themes": "^0",
45
58
  "react": "^19",
46
59
  "react-copy-to-clipboard": "^5",
47
60
  "react-dom": "^19",
@@ -57,5 +70,5 @@
57
70
  "webp-converter-browser": "^1",
58
71
  "zod": "^4"
59
72
  },
60
- "packageManager": "yarn@4.9.2"
73
+ "packageManager": "yarn@4.10.3"
61
74
  }
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import { VistaFormElements } from '@appcorp/app-corp-vista/type/vista-form-elements';
3
- export declare const renderCompanyFormElements: (elementProps: VistaFormElements) => React.JSX.Element;
@@ -1,41 +0,0 @@
1
- "use strict";
2
- /* eslint-disable */
3
- var __assign = (this && this.__assign) || function () {
4
- __assign = Object.assign || function(t) {
5
- for (var s, i = 1, n = arguments.length; i < n; i++) {
6
- s = arguments[i];
7
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
8
- t[p] = s[p];
9
- }
10
- return t;
11
- };
12
- return __assign.apply(this, arguments);
13
- };
14
- var __importDefault = (this && this.__importDefault) || function (mod) {
15
- return (mod && mod.__esModule) ? mod : { "default": mod };
16
- };
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.renderCompanyFormElements = void 0;
19
- var react_1 = __importDefault(require("react"));
20
- var form_schema_1 = require("@appcorp/app-corp-vista/utils/form-schema");
21
- var renderCompanyFormElements = function (elementProps) {
22
- var _a;
23
- var elementsArray = (_a = Object.entries(form_schema_1.vistaFormSchema)
24
- .flatMap(function (_a) {
25
- var _b, _c;
26
- var key = _a[0], config = _a[1];
27
- var Component = config;
28
- return (_c = (_b = (elementProps[key] || [])) === null || _b === void 0 ? void 0 : _b.filter(function (props) { return props.enabled; })) === null || _c === void 0 ? void 0 : _c.map(function (props) { return ({
29
- Component: Component,
30
- key: key,
31
- order: props.order,
32
- props: props,
33
- }); });
34
- })) === null || _a === void 0 ? void 0 : _a.sort(function (a, b) { return a.order - b.order; });
35
- return (react_1.default.createElement("div", { className: "grid grid-cols-3 gap-4" }, elementsArray === null || elementsArray === void 0 ? void 0 : elementsArray.map(function (_a, index) {
36
- var key = _a.key, Component = _a.Component, props = _a.props;
37
- return (react_1.default.createElement("div", { key: "".concat(key, "-").concat(index) },
38
- react_1.default.createElement(Component, __assign({}, props))));
39
- })));
40
- };
41
- exports.renderCompanyFormElements = renderCompanyFormElements;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import { VistaFormElements } from '@appcorp/app-corp-vista/type/vista-form-elements';
3
- export declare const renderCustomerFormElements: (elementProps: VistaFormElements) => React.JSX.Element;
@@ -1,41 +0,0 @@
1
- "use strict";
2
- /* eslint-disable */
3
- var __assign = (this && this.__assign) || function () {
4
- __assign = Object.assign || function(t) {
5
- for (var s, i = 1, n = arguments.length; i < n; i++) {
6
- s = arguments[i];
7
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
8
- t[p] = s[p];
9
- }
10
- return t;
11
- };
12
- return __assign.apply(this, arguments);
13
- };
14
- var __importDefault = (this && this.__importDefault) || function (mod) {
15
- return (mod && mod.__esModule) ? mod : { "default": mod };
16
- };
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.renderCustomerFormElements = void 0;
19
- var react_1 = __importDefault(require("react"));
20
- var form_schema_1 = require("@appcorp/app-corp-vista/utils/form-schema");
21
- var renderCustomerFormElements = function (elementProps) {
22
- var _a;
23
- var elementsArray = (_a = Object.entries(form_schema_1.vistaFormSchema)
24
- .flatMap(function (_a) {
25
- var _b, _c;
26
- var key = _a[0], config = _a[1];
27
- var Component = config;
28
- return (_c = (_b = (elementProps[key] || [])) === null || _b === void 0 ? void 0 : _b.filter(function (props) { return props.enabled; })) === null || _c === void 0 ? void 0 : _c.map(function (props) { return ({
29
- Component: Component,
30
- key: key,
31
- order: props.order,
32
- props: props,
33
- }); });
34
- })) === null || _a === void 0 ? void 0 : _a.sort(function (a, b) { return a.order - b.order; });
35
- return (react_1.default.createElement("div", { className: "grid grid-cols-4 gap-4" }, elementsArray === null || elementsArray === void 0 ? void 0 : elementsArray.map(function (_a, index) {
36
- var key = _a.key, Component = _a.Component, props = _a.props;
37
- return (react_1.default.createElement("div", { key: "".concat(key, "-").concat(index), className: props.className },
38
- react_1.default.createElement(Component, __assign({}, props))));
39
- })));
40
- };
41
- exports.renderCustomerFormElements = renderCustomerFormElements;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- import { VistaFormElements } from '@appcorp/app-corp-vista/type/vista-form-elements';
3
- export declare const renderPricingFormElements: (elementProps: VistaFormElements) => React.JSX.Element;
@@ -1,41 +0,0 @@
1
- "use strict";
2
- /* eslint-disable */
3
- var __assign = (this && this.__assign) || function () {
4
- __assign = Object.assign || function(t) {
5
- for (var s, i = 1, n = arguments.length; i < n; i++) {
6
- s = arguments[i];
7
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
8
- t[p] = s[p];
9
- }
10
- return t;
11
- };
12
- return __assign.apply(this, arguments);
13
- };
14
- var __importDefault = (this && this.__importDefault) || function (mod) {
15
- return (mod && mod.__esModule) ? mod : { "default": mod };
16
- };
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.renderPricingFormElements = void 0;
19
- var react_1 = __importDefault(require("react"));
20
- var form_schema_1 = require("@appcorp/app-corp-vista/utils/form-schema");
21
- var renderPricingFormElements = function (elementProps) {
22
- var _a;
23
- var elementsArray = (_a = Object.entries(form_schema_1.vistaFormSchema)
24
- .flatMap(function (_a) {
25
- var _b, _c;
26
- var key = _a[0], config = _a[1];
27
- var Component = config;
28
- return (_c = (_b = (elementProps[key] || [])) === null || _b === void 0 ? void 0 : _b.filter(function (props) { return props.enabled; })) === null || _c === void 0 ? void 0 : _c.map(function (props) { return ({
29
- Component: Component,
30
- key: key,
31
- order: props.order,
32
- props: props,
33
- }); });
34
- })) === null || _a === void 0 ? void 0 : _a.sort(function (a, b) { return a.order - b.order; });
35
- return (react_1.default.createElement("div", { className: "grid grid-cols-1 gap-4" }, elementsArray === null || elementsArray === void 0 ? void 0 : elementsArray.map(function (_a, index) {
36
- var key = _a.key, Component = _a.Component, props = _a.props;
37
- return (react_1.default.createElement("div", { key: "".concat(key, "-").concat(index) },
38
- react_1.default.createElement(Component, __assign({}, props))));
39
- })));
40
- };
41
- exports.renderPricingFormElements = renderPricingFormElements;