@appcorp/stellar-solutions-invoice-module 0.1.55 → 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.
- package/base-modules/invoice/add-service-product-section.d.ts +12 -2
- package/base-modules/invoice/add-service-product-section.js +20 -10
- package/base-modules/invoice/company-form-section.d.ts +12 -2
- package/base-modules/invoice/company-form-section.js +118 -10
- package/base-modules/invoice/constants.d.ts +18 -25
- package/base-modules/invoice/constants.js +66 -548
- package/base-modules/invoice/context.d.ts +42 -2
- package/base-modules/invoice/context.js +259 -317
- package/base-modules/invoice/customer-form-section.d.ts +12 -2
- package/base-modules/invoice/customer-form-section.js +91 -9
- package/base-modules/invoice/drawer.d.ts +9 -4
- package/base-modules/invoice/drawer.js +32 -6
- package/base-modules/invoice/form.d.ts +2 -4
- package/base-modules/invoice/form.js +7 -6
- package/base-modules/invoice/invoice.d.ts +2 -2
- package/base-modules/invoice/invoice.js +33 -42
- package/base-modules/invoice/pricing-form-section.d.ts +12 -2
- package/base-modules/invoice/pricing-form-section.js +65 -9
- package/base-modules/invoice/products-form-section.d.ts +12 -2
- package/base-modules/invoice/products-form-section.js +57 -31
- package/base-modules/invoice/reducer.d.ts +2 -2
- package/base-modules/invoice/reducer.js +57 -56
- package/base-modules/invoice/services-form-section.d.ts +12 -2
- package/base-modules/invoice/services-form-section.js +61 -14
- package/base-modules/invoice/types.d.ts +43 -23
- package/base-modules/invoice/validate.d.ts +869 -17
- package/base-modules/invoice/validate.js +94 -35
- package/base-modules/quote/actions.d.ts +215 -0
- package/base-modules/quote/actions.js +38 -0
- package/base-modules/quote/add-service-product-section.d.ts +12 -0
- package/base-modules/quote/add-service-product-section.js +31 -0
- package/base-modules/quote/calculate-subtotal.d.ts +1 -0
- package/base-modules/quote/calculate-subtotal.js +6 -0
- package/base-modules/quote/calculate-total.d.ts +1 -0
- package/base-modules/quote/calculate-total.js +6 -0
- package/base-modules/quote/company-form-section.d.ts +12 -0
- package/base-modules/quote/company-form-section.js +125 -0
- package/base-modules/quote/constants.d.ts +64 -0
- package/base-modules/quote/constants.js +107 -0
- package/base-modules/quote/context.d.ts +50 -0
- package/base-modules/quote/context.js +822 -0
- package/base-modules/quote/customer-form-section.d.ts +12 -0
- package/base-modules/quote/customer-form-section.js +99 -0
- package/base-modules/quote/drawer.d.ts +13 -0
- package/base-modules/quote/drawer.js +45 -0
- package/base-modules/quote/form.d.ts +6 -0
- package/base-modules/quote/form.js +27 -0
- package/base-modules/quote/pricing-form-section.d.ts +12 -0
- package/base-modules/quote/pricing-form-section.js +76 -0
- package/base-modules/quote/products-form-section.d.ts +12 -0
- package/base-modules/quote/products-form-section.js +71 -0
- package/base-modules/quote/quote.d.ts +8 -0
- package/base-modules/quote/quote.js +69 -0
- package/base-modules/quote/reducer.d.ts +4 -0
- package/base-modules/quote/reducer.js +181 -0
- package/base-modules/quote/services-form-section.d.ts +12 -0
- package/base-modules/quote/services-form-section.js +73 -0
- package/base-modules/quote/types.d.ts +126 -0
- package/base-modules/quote/types.js +35 -0
- package/base-modules/quote/validate.d.ts +856 -0
- package/base-modules/quote/validate.js +85 -0
- package/package.json +23 -8
- package/base-modules/invoice/company-form-elements.d.ts +0 -3
- package/base-modules/invoice/company-form-elements.js +0 -41
- package/base-modules/invoice/customer-form-elements.d.ts +0 -3
- package/base-modules/invoice/customer-form-elements.js +0 -41
- package/base-modules/invoice/pricing-form-elements.d.ts +0 -3
- 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,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appcorp/stellar-solutions-invoice-module",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.57",
|
|
4
4
|
"scripts": {
|
|
5
|
+
"automate": "./automate.sh",
|
|
5
6
|
"build": "yarn clean && yarn build:ts && cp package.json lib && cp README.md lib && cp yarn.lock lib",
|
|
6
7
|
"build:next": "next build",
|
|
7
8
|
"build:ts": "tsc --project tsconfig.build.json",
|
|
@@ -14,17 +15,27 @@
|
|
|
14
15
|
"prepare": "husky",
|
|
15
16
|
"publish:npm": "yarn build && cd lib/ && npm publish --access public && cd ..",
|
|
16
17
|
"start": "next start",
|
|
17
|
-
"upgrade": "ncu -u"
|
|
18
|
+
"upgrade": "ncu -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"
|
|
18
20
|
},
|
|
19
21
|
"devDependencies": {
|
|
20
|
-
"@appcorp/app-corp-vista": "^0.3.
|
|
21
|
-
"@appcorp/
|
|
22
|
-
"@appcorp/stellar-solutions-
|
|
23
|
-
"@appcorp/stellar-solutions-
|
|
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",
|
|
24
27
|
"@eslint/eslintrc": "^3",
|
|
25
28
|
"@headlessui/react": "^2",
|
|
26
29
|
"@heroicons/react": "^2",
|
|
27
|
-
"@
|
|
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",
|
|
28
39
|
"@supabase/supabase-js": "^2",
|
|
29
40
|
"@tailwindcss/forms": "^0",
|
|
30
41
|
"@tailwindcss/postcss": "^4",
|
|
@@ -32,14 +43,18 @@
|
|
|
32
43
|
"@types/react": "^19",
|
|
33
44
|
"@types/react-dom": "^19",
|
|
34
45
|
"@types/react-slick": "^0",
|
|
46
|
+
"class-variance-authority": "^0",
|
|
47
|
+
"cmdk": "^1.1.1",
|
|
35
48
|
"date-fns": "^4",
|
|
36
49
|
"dayjs": "^1",
|
|
37
50
|
"eslint": "^9",
|
|
38
51
|
"eslint-config-next": "^15",
|
|
39
52
|
"husky": "^9",
|
|
40
53
|
"libphonenumber-js": "^1",
|
|
54
|
+
"lucide-react": "^0",
|
|
41
55
|
"next": "^15",
|
|
42
56
|
"next-intl": "^4",
|
|
57
|
+
"next-themes": "^0",
|
|
43
58
|
"react": "^19",
|
|
44
59
|
"react-copy-to-clipboard": "^5",
|
|
45
60
|
"react-dom": "^19",
|
|
@@ -55,5 +70,5 @@
|
|
|
55
70
|
"webp-converter-browser": "^1",
|
|
56
71
|
"zod": "^4"
|
|
57
72
|
},
|
|
58
|
-
"packageManager": "yarn@4.
|
|
73
|
+
"packageManager": "yarn@4.10.3"
|
|
59
74
|
}
|
|
@@ -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,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,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;
|