@zosmaai/medusa-documents-v2 0.2.13

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 (96) hide show
  1. package/.medusa/server/src/admin/index.js +1884 -0
  2. package/.medusa/server/src/admin/index.mjs +1881 -0
  3. package/.medusa/server/src/api/admin/documents/document-invoice-settings/invoice-template/route.js +40 -0
  4. package/.medusa/server/src/api/admin/documents/document-invoice-settings/route.js +62 -0
  5. package/.medusa/server/src/api/admin/documents/document-packing-slip-settings/route.js +62 -0
  6. package/.medusa/server/src/api/admin/documents/document-packing-slip-settings/template/route.js +40 -0
  7. package/.medusa/server/src/api/admin/documents/document-settings/document-address/route.js +47 -0
  8. package/.medusa/server/src/api/admin/documents/document-settings/india-gst/route.js +67 -0
  9. package/.medusa/server/src/api/admin/documents/document-settings/logo/route.js +67 -0
  10. package/.medusa/server/src/api/admin/documents/document-settings/route.js +36 -0
  11. package/.medusa/server/src/api/admin/documents/invoice/display-number/route.js +34 -0
  12. package/.medusa/server/src/api/admin/documents/invoice/generate/route.js +47 -0
  13. package/.medusa/server/src/api/admin/documents/invoice/route.js +112 -0
  14. package/.medusa/server/src/api/admin/documents/packing-slip/preview/route.js +47 -0
  15. package/.medusa/server/src/api/admin/documents/packing-slip/route.js +112 -0
  16. package/.medusa/server/src/links/invoice-order.js +13 -0
  17. package/.medusa/server/src/links/packing-slip-order.js +13 -0
  18. package/.medusa/server/src/modules/documents/assets/fonts/IBMPlexSans-Bold.ttf +0 -0
  19. package/.medusa/server/src/modules/documents/assets/fonts/IBMPlexSans-Regular.ttf +0 -0
  20. package/.medusa/server/src/modules/documents/assets/i18n/locales/de-AT/translation.json +26 -0
  21. package/.medusa/server/src/modules/documents/assets/i18n/locales/en/translation.json +26 -0
  22. package/.medusa/server/src/modules/documents/assets/i18n/locales/es/translation.json +26 -0
  23. package/.medusa/server/src/modules/documents/assets/i18n/locales/fr/translation.json +26 -0
  24. package/.medusa/server/src/modules/documents/assets/i18n/locales/pl/translation.json +26 -0
  25. package/.medusa/server/src/modules/documents/index.js +26 -0
  26. package/.medusa/server/src/modules/documents/loaders/i18next.js +49 -0
  27. package/.medusa/server/src/modules/documents/migrations/Migration20250228142557.js +39 -0
  28. package/.medusa/server/src/modules/documents/migrations/Migration20260810120000.js +14 -0
  29. package/.medusa/server/src/modules/documents/models/document-invoice-settings.js +29 -0
  30. package/.medusa/server/src/modules/documents/models/document-invoice.js +32 -0
  31. package/.medusa/server/src/modules/documents/models/document-packing-slip-settings.js +29 -0
  32. package/.medusa/server/src/modules/documents/models/document-packing-slip.js +32 -0
  33. package/.medusa/server/src/modules/documents/models/document-settings.js +33 -0
  34. package/.medusa/server/src/modules/documents/service.js +502 -0
  35. package/.medusa/server/src/modules/documents/services/generators/invoice-generator.js +78 -0
  36. package/.medusa/server/src/modules/documents/services/generators/packing-slip-generator.js +73 -0
  37. package/.medusa/server/src/modules/documents/services/templates/invoices/basic/basic-logo.js +55 -0
  38. package/.medusa/server/src/modules/documents/services/templates/invoices/basic/basic.js +52 -0
  39. package/.medusa/server/src/modules/documents/services/templates/invoices/basic/parts/customer-info.js +69 -0
  40. package/.medusa/server/src/modules/documents/services/templates/invoices/basic/parts/header-for-logo.js +32 -0
  41. package/.medusa/server/src/modules/documents/services/templates/invoices/basic/parts/header-logo.js +29 -0
  42. package/.medusa/server/src/modules/documents/services/templates/invoices/basic/parts/header.js +35 -0
  43. package/.medusa/server/src/modules/documents/services/templates/invoices/basic/parts/hr.js +23 -0
  44. package/.medusa/server/src/modules/documents/services/templates/invoices/basic/parts/invoice-info.js +35 -0
  45. package/.medusa/server/src/modules/documents/services/templates/invoices/basic/parts/table.js +97 -0
  46. package/.medusa/server/src/modules/documents/services/templates/invoices/india-gst/india-gst.js +72 -0
  47. package/.medusa/server/src/modules/documents/services/templates/invoices/india-gst/parts/footer.js +41 -0
  48. package/.medusa/server/src/modules/documents/services/templates/invoices/india-gst/parts/invoice-meta.js +22 -0
  49. package/.medusa/server/src/modules/documents/services/templates/invoices/india-gst/parts/seller-info.js +42 -0
  50. package/.medusa/server/src/modules/documents/services/templates/invoices/india-gst/parts/table.js +88 -0
  51. package/.medusa/server/src/modules/documents/services/templates/packing-slips/basic/basic.js +52 -0
  52. package/.medusa/server/src/modules/documents/services/templates/packing-slips/basic/parts/customer-info-small.js +69 -0
  53. package/.medusa/server/src/modules/documents/services/templates/packing-slips/basic/parts/customer-info.js +65 -0
  54. package/.medusa/server/src/modules/documents/services/templates/packing-slips/basic/parts/header-small.js +37 -0
  55. package/.medusa/server/src/modules/documents/services/templates/packing-slips/basic/parts/header.js +37 -0
  56. package/.medusa/server/src/modules/documents/services/templates/packing-slips/basic/parts/hr.js +32 -0
  57. package/.medusa/server/src/modules/documents/services/templates/packing-slips/basic/parts/table-items-small.js +44 -0
  58. package/.medusa/server/src/modules/documents/services/templates/packing-slips/basic/parts/table-items.js +44 -0
  59. package/.medusa/server/src/modules/documents/services/templates/packing-slips/basic/parts/table-order-info-small.js +35 -0
  60. package/.medusa/server/src/modules/documents/services/templates/packing-slips/basic/parts/table-order-info.js +36 -0
  61. package/.medusa/server/src/modules/documents/services/templates/packing-slips/basic/small.js +53 -0
  62. package/.medusa/server/src/modules/documents/types/api.js +14 -0
  63. package/.medusa/server/src/modules/documents/types/constants.js +17 -0
  64. package/.medusa/server/src/modules/documents/types/dto.js +14 -0
  65. package/.medusa/server/src/modules/documents/types/template-kind.js +26 -0
  66. package/.medusa/server/src/modules/documents/utils/currency.js +18 -0
  67. package/.medusa/server/src/ui-components/actions-dropdown/actions-dropdown.js +15 -0
  68. package/.medusa/server/src/ui-components/actions-dropdown/invoice/button-generate-invoice.js +75 -0
  69. package/.medusa/server/src/ui-components/actions-dropdown/packing-slip/button-generate-packing-slip.js +72 -0
  70. package/.medusa/server/src/ui-components/index.js +21 -0
  71. package/.medusa/server/src/ui-components/orders/order-table/invoice-number-from-order.js +107 -0
  72. package/.medusa/server/src/ui-components/orders/order-table/packing-slip-number.js +107 -0
  73. package/.medusa/server/src/ui-components/orders/order-table/use-columns.js +172 -0
  74. package/.medusa/server/src/ui-components/orders/order-table/use-orders.js +145 -0
  75. package/.medusa/server/src/ui-components/orders/order-table/utils/currencies.js +1077 -0
  76. package/.medusa/server/src/ui-components/orders/order-table/utils/time.js +53 -0
  77. package/.medusa/server/src/ui-components/orders/order-table.js +134 -0
  78. package/.medusa/server/src/ui-components/settings/settings-address.js +90 -0
  79. package/.medusa/server/src/ui-components/settings/settings-india-gst.js +90 -0
  80. package/.medusa/server/src/ui-components/settings/settings-invoice-display-number.js +55 -0
  81. package/.medusa/server/src/ui-components/settings/settings-invoice.js +139 -0
  82. package/.medusa/server/src/ui-components/settings/settings-logo.js +108 -0
  83. package/.medusa/server/src/ui-components/tabs/orders-tab.js +28 -0
  84. package/.medusa/server/src/ui-components/tabs/pro-tab.js +23 -0
  85. package/.medusa/server/src/ui-components/tabs/settings-tab.js +29 -0
  86. package/.medusa/server/src/ui-components/tabs/templates-tab/templates-invoice-tab.js +153 -0
  87. package/.medusa/server/src/ui-components/tabs/templates-tab/templates-packing-slip-tab.js +155 -0
  88. package/.medusa/server/src/ui-components/tabs/templates-tab/templates-tab.js +24 -0
  89. package/.medusa/server/src/ui-components/types/api.js +14 -0
  90. package/.medusa/server/src/ui-components/types/invoice.js +14 -0
  91. package/.medusa/server/src/ui-components/types/packing-slip.js +14 -0
  92. package/.medusa/server/src/ui-components/types/template-kind.js +26 -0
  93. package/.medusa/server/src/workflows/assign-invoice.js +31 -0
  94. package/.medusa/server/src/workflows/assign-packing-slip.js +31 -0
  95. package/README.md +171 -0
  96. package/package.json +103 -0
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2024 RSC-Labs, https://rsoftcon.com/
4
+ *
5
+ * MIT License
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software
8
+ * distributed under the License is distributed on an "AS IS" BASIS,
9
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ * See the License for the specific language governing permissions and
11
+ * limitations under the License.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW52b2ljZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy91aS1jb21wb25lbnRzL3R5cGVzL2ludm9pY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7O0dBVUcifQ==
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2024 RSC-Labs, https://rsoftcon.com/
4
+ *
5
+ * MIT License
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software
8
+ * distributed under the License is distributed on an "AS IS" BASIS,
9
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ * See the License for the specific language governing permissions and
11
+ * limitations under the License.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFja2luZy1zbGlwLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vc3JjL3VpLWNvbXBvbmVudHMvdHlwZXMvcGFja2luZy1zbGlwLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7Ozs7OztHQVVHIn0=
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /*
3
+ * Copyright 2024 RSC-Labs, https://rsoftcon.com/
4
+ *
5
+ * MIT License
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software
8
+ * distributed under the License is distributed on an "AS IS" BASIS,
9
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ * See the License for the specific language governing permissions and
11
+ * limitations under the License.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.PackingSlipTemplateKind = exports.InvoiceTemplateKind = void 0;
15
+ var InvoiceTemplateKind;
16
+ (function (InvoiceTemplateKind) {
17
+ InvoiceTemplateKind["BASIC"] = "BASIC";
18
+ InvoiceTemplateKind["BASIC_LOGO"] = "BASIC_LOGO";
19
+ InvoiceTemplateKind["INDIA_GST"] = "INDIA_GST";
20
+ })(InvoiceTemplateKind || (exports.InvoiceTemplateKind = InvoiceTemplateKind = {}));
21
+ var PackingSlipTemplateKind;
22
+ (function (PackingSlipTemplateKind) {
23
+ PackingSlipTemplateKind["BASIC"] = "BASIC";
24
+ PackingSlipTemplateKind["BASIC_SMALL"] = "BASIC_SMALL";
25
+ })(PackingSlipTemplateKind || (exports.PackingSlipTemplateKind = PackingSlipTemplateKind = {}));
26
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVtcGxhdGUta2luZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3NyYy91aS1jb21wb25lbnRzL3R5cGVzL3RlbXBsYXRlLWtpbmQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7O0dBVUc7OztBQUVILElBQVksbUJBSVg7QUFKRCxXQUFZLG1CQUFtQjtJQUM3QixzQ0FBZSxDQUFBO0lBQ2YsZ0RBQXlCLENBQUE7SUFDekIsOENBQXVCLENBQUE7QUFDekIsQ0FBQyxFQUpXLG1CQUFtQixtQ0FBbkIsbUJBQW1CLFFBSTlCO0FBRUQsSUFBWSx1QkFHWDtBQUhELFdBQVksdUJBQXVCO0lBQ2pDLDBDQUFlLENBQUE7SUFDZixzREFBMkIsQ0FBQTtBQUM3QixDQUFDLEVBSFcsdUJBQXVCLHVDQUF2Qix1QkFBdUIsUUFHbEMifQ==
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const workflows_sdk_1 = require("@medusajs/framework/workflows-sdk");
4
+ const core_flows_1 = require("@medusajs/medusa/core-flows");
5
+ const utils_1 = require("@medusajs/framework/utils");
6
+ const documents_1 = require("../modules/documents");
7
+ const assignInvoiceToOrderWorkflow = (0, workflows_sdk_1.createWorkflow)("assign-invoice-to-order", function (input) {
8
+ (0, workflows_sdk_1.when)(input, (input) => {
9
+ return input.oldInvoiceId !== undefined;
10
+ }).then(() => {
11
+ (0, core_flows_1.dismissRemoteLinkStep)([{
12
+ [utils_1.Modules.ORDER]: {
13
+ order_id: input.orderId
14
+ },
15
+ [documents_1.DOCUMENTS_MODULE]: {
16
+ document_invoice_id: input.oldInvoiceId
17
+ }
18
+ }]);
19
+ });
20
+ (0, core_flows_1.createRemoteLinkStep)([{
21
+ [utils_1.Modules.ORDER]: {
22
+ order_id: input.orderId
23
+ },
24
+ [documents_1.DOCUMENTS_MODULE]: {
25
+ document_invoice_id: input.newInvoiceId
26
+ }
27
+ }]);
28
+ return new workflows_sdk_1.WorkflowResponse({});
29
+ });
30
+ exports.default = assignInvoiceToOrderWorkflow;
31
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXNzaWduLWludm9pY2UuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvd29ya2Zsb3dzL2Fzc2lnbi1pbnZvaWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEscUVBSTBDO0FBQzFDLDREQUEwRjtBQUMxRixxREFBb0Q7QUFDcEQsb0RBQXdEO0FBUXhELE1BQU0sNEJBQTRCLEdBQUcsSUFBQSw4QkFBYyxFQUNqRCx5QkFBeUIsRUFDekIsVUFBVSxLQUFnQztJQUV4QyxJQUFBLG9CQUFJLEVBQ0YsS0FBSyxFQUNMLENBQUMsS0FBSyxFQUFFLEVBQUU7UUFDUixPQUFPLEtBQUssQ0FBQyxZQUFZLEtBQUssU0FBUyxDQUFDO0lBQzFDLENBQUMsQ0FDRixDQUFDLElBQUksQ0FBQyxHQUFHLEVBQUU7UUFDVixJQUFBLGtDQUFxQixFQUFDLENBQUM7Z0JBQ3JCLENBQUMsZUFBTyxDQUFDLEtBQUssQ0FBQyxFQUFFO29CQUNmLFFBQVEsRUFBRSxLQUFLLENBQUMsT0FBTztpQkFDeEI7Z0JBQ0QsQ0FBQyw0QkFBZ0IsQ0FBQyxFQUFFO29CQUNsQixtQkFBbUIsRUFBRSxLQUFLLENBQUMsWUFBWTtpQkFDeEM7YUFDRixDQUFDLENBQUMsQ0FBQTtJQUNMLENBQUMsQ0FBQyxDQUFBO0lBRUYsSUFBQSxpQ0FBb0IsRUFBQyxDQUFDO1lBQ3BCLENBQUMsZUFBTyxDQUFDLEtBQUssQ0FBQyxFQUFFO2dCQUNmLFFBQVEsRUFBRSxLQUFLLENBQUMsT0FBTzthQUN4QjtZQUNELENBQUMsNEJBQWdCLENBQUMsRUFBRTtnQkFDbEIsbUJBQW1CLEVBQUUsS0FBSyxDQUFDLFlBQVk7YUFDeEM7U0FDRixDQUFDLENBQUMsQ0FBQTtJQUVILE9BQU8sSUFBSSxnQ0FBZ0IsQ0FBQyxFQUFFLENBQUMsQ0FBQTtBQUNqQyxDQUFDLENBQ0YsQ0FBQTtBQUVELGtCQUFlLDRCQUE0QixDQUFBIn0=
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const workflows_sdk_1 = require("@medusajs/framework/workflows-sdk");
4
+ const core_flows_1 = require("@medusajs/medusa/core-flows");
5
+ const utils_1 = require("@medusajs/framework/utils");
6
+ const documents_1 = require("../modules/documents");
7
+ const assignPackingSlipToOrderWorkflow = (0, workflows_sdk_1.createWorkflow)("assign-packing-slip-to-order", function (input) {
8
+ (0, workflows_sdk_1.when)(input, (input) => {
9
+ return input.oldPackingSlipId !== undefined;
10
+ }).then(() => {
11
+ (0, core_flows_1.dismissRemoteLinkStep)([{
12
+ [utils_1.Modules.ORDER]: {
13
+ order_id: input.orderId
14
+ },
15
+ [documents_1.DOCUMENTS_MODULE]: {
16
+ document_packing_slip_id: input.oldPackingSlipId
17
+ }
18
+ }]);
19
+ });
20
+ (0, core_flows_1.createRemoteLinkStep)([{
21
+ [utils_1.Modules.ORDER]: {
22
+ order_id: input.orderId
23
+ },
24
+ [documents_1.DOCUMENTS_MODULE]: {
25
+ document_packing_slip_id: input.newPackingSlipId
26
+ }
27
+ }]);
28
+ return new workflows_sdk_1.WorkflowResponse({});
29
+ });
30
+ exports.default = assignPackingSlipToOrderWorkflow;
31
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXNzaWduLXBhY2tpbmctc2xpcC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy93b3JrZmxvd3MvYXNzaWduLXBhY2tpbmctc2xpcC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHFFQUkwQztBQUMxQyw0REFBMEY7QUFDMUYscURBQW9EO0FBQ3BELG9EQUF3RDtBQVF4RCxNQUFNLGdDQUFnQyxHQUFHLElBQUEsOEJBQWMsRUFDckQsOEJBQThCLEVBQzlCLFVBQVUsS0FBb0M7SUFFNUMsSUFBQSxvQkFBSSxFQUNGLEtBQUssRUFDTCxDQUFDLEtBQUssRUFBRSxFQUFFO1FBQ1IsT0FBTyxLQUFLLENBQUMsZ0JBQWdCLEtBQUssU0FBUyxDQUFDO0lBQzlDLENBQUMsQ0FDRixDQUFDLElBQUksQ0FBQyxHQUFHLEVBQUU7UUFDVixJQUFBLGtDQUFxQixFQUFDLENBQUM7Z0JBQ3JCLENBQUMsZUFBTyxDQUFDLEtBQUssQ0FBQyxFQUFFO29CQUNmLFFBQVEsRUFBRSxLQUFLLENBQUMsT0FBTztpQkFDeEI7Z0JBQ0QsQ0FBQyw0QkFBZ0IsQ0FBQyxFQUFFO29CQUNsQix3QkFBd0IsRUFBRSxLQUFLLENBQUMsZ0JBQWdCO2lCQUNqRDthQUNGLENBQUMsQ0FBQyxDQUFBO0lBQ0wsQ0FBQyxDQUFDLENBQUE7SUFFRixJQUFBLGlDQUFvQixFQUFDLENBQUM7WUFDcEIsQ0FBQyxlQUFPLENBQUMsS0FBSyxDQUFDLEVBQUU7Z0JBQ2YsUUFBUSxFQUFFLEtBQUssQ0FBQyxPQUFPO2FBQ3hCO1lBQ0QsQ0FBQyw0QkFBZ0IsQ0FBQyxFQUFFO2dCQUNsQix3QkFBd0IsRUFBRSxLQUFLLENBQUMsZ0JBQWdCO2FBQ2pEO1NBQ0YsQ0FBQyxDQUFDLENBQUE7SUFFSCxPQUFPLElBQUksZ0NBQWdCLENBQUMsRUFBRSxDQUFDLENBQUE7QUFDakMsQ0FBQyxDQUNGLENBQUE7QUFFRCxrQkFBZSxnQ0FBZ0MsQ0FBQSJ9
package/README.md ADDED
@@ -0,0 +1,171 @@
1
+ Medusa documents is a plugin which provides you ability to generate various documents in PDF format. For supported documents, go to [Supported documents](#supported-documents)
2
+
3
+ ## How to install?
4
+
5
+ 1. Install plugin by adding to your `package.json`:
6
+
7
+ ```json
8
+ ...
9
+ "@zosmaai/medusa-documents-v2": "0.1.6" // or other available version
10
+ ...
11
+ ```
12
+ and execute install, e.g. `yarn install`.
13
+
14
+ 2. Add plugin to your `medusa-config.js` with the licence key, which you received:
15
+
16
+ ```js
17
+ ...
18
+ plugins: [
19
+ {
20
+ resolve: "@zosmaai/medusa-documents-v2",
21
+ options: {}
22
+ }
23
+ ]
24
+ ...
25
+ ```
26
+
27
+ 3. Run migrations, e.g. `npx medusa db:migrate`
28
+
29
+ ## Getting started
30
+
31
+ After installation of a plugin, you will see new option on the sidebar named `Documents`. This will lead you to such view:
32
+
33
+ <p align="center">
34
+ <picture>
35
+ <img alt="Medusa documents orders" src="https://raw.githubusercontent.com/RSC-Labs/medusa-documents/refs/heads/main/v2/docs/screenshot-1.JPG">
36
+ </picture>
37
+ </p>
38
+
39
+
40
+ **_NOTE:_** This README describes `Invoice` as an example of document.
41
+
42
+ This is a view of your orders. You can notice that it is very similar to `Orders` view. The important difference is in the last column, when you can see `Actions`. `Actions` can handle different documents.
43
+
44
+ Before you can generate `Invoice` you need to be familiar with two things - `Templates` and `Settings`. Let's go firstly to `Settings`.
45
+
46
+ ### Settings
47
+
48
+ This tab contains settings which are used to generate documents. The most important setting which needs to be set is address. Address reflects information about your company or store, which will be inserted in documents. Go to `Change adddress` to set it.
49
+
50
+ Depends on the used template, you may want to change a logo or adjust invoice number. Let's just jump now to `Templates`.
51
+
52
+ ### Templates
53
+
54
+ This tab contains supported templates which are used to generate documents. You may see there very basic templates which will be extended in the future. If you set your `Address` correctly and you have at least one `Order`, you may see a preview how invoice will look like.
55
+
56
+ <p align="center">
57
+ <picture>
58
+ <img alt="Medusa documents template" src="https://raw.githubusercontent.com/RSC-Labs/medusa-documents/refs/heads/main/v2/docs/screenshot-2.JPG">
59
+ </picture>
60
+ </p>
61
+
62
+
63
+ <b>Note:</b> In preview mode, invoice number is set to 1.
64
+
65
+ <b>Note:</b> If you have picture of template which you would like to have supported, please raise [issue](https://github.com/RSC-Labs/medusa-documents/issues).
66
+
67
+
68
+ ### Supported documents
69
+
70
+ | Name | Status |
71
+ | --- | --- |
72
+ | Invoice | :white_check_mark: |
73
+ | Packing slip | :white_check_mark: |
74
+
75
+ ### Generating invoice
76
+
77
+ If you have your `Template` chosen and `Address` set, then you are able to generate invoice. Go to `Orders`, click on `...` and choose `Generate invoice`. You will see new card opened with your invoice.
78
+
79
+ <b>Note: [We do not store documents, see what it means](#what-means-we-do-not-store-documents)</b>
80
+
81
+ After invoice generation, you will see assigned number in the column `Last generated invoice`. This is useful, if you want to download your invoice again or decide to generate new one.
82
+
83
+ ### View invoice
84
+
85
+ If you forgot download your invoice, you may click on document in `Documents` column to see it again.
86
+
87
+ ### Invoice number
88
+
89
+ By default, invoice number is generated based on the last assigned invoice number. In other words - plugin takes the last generated invoice and takes its number to increment it.
90
+
91
+ We know that your businesss may require different numbering. In such case - go to `Settings` tab and click `Change settings` in `Invoice`. You will see that you can change how your invoice number will look like. For instance, you can make something like `ABC123{invoice_number}`. If your last invoice has base number `10`, then you will get `ABC12311` as your next invoice number.
92
+
93
+ Sometimes you may want to set your next invoice number (for instance when you have many different clients). You can do it by setting `Forced number` in `Settings`. Please remember that this setting will be applied for newly generated invoice and the incrementation will start over from this new number.
94
+
95
+ <b>Protip:</b> After setting change, you can always go to `Templates` to see a preview with your next invoice number.
96
+
97
+ ## Translation
98
+
99
+ You can now configure language for generated documents.
100
+
101
+ **_NOTE:_** We do not support translations of frontend.
102
+
103
+ You can configure language of documents using `medusa-config.js` file. Here is the example of Polish language:
104
+
105
+ ```js
106
+ {
107
+ resolve: `@zosmaai/medusa-documents-v2`,
108
+ options: {
109
+ document_language: 'pl'
110
+ }
111
+ }
112
+ ```
113
+
114
+ Available translations can be found here: https://github.com/RSC-Labs/medusa-documents/tree/main/v2/src/modules/documents/assets/i18n/locales.
115
+
116
+ ### How to add my own translations?
117
+
118
+ You have two options:
119
+
120
+ - create `translation.json` under `/assets/i18n/locales/{your-language}` and create a pull requests - we will be more than happy to merge it
121
+
122
+ - create `translation.json` only for local purposes. Then you need to go to `node_modules/@zosmaai/medusa-documents/assets/i18n/locales/{your-language}` and paste there your translation file.
123
+
124
+ Please remember that `documentLanguage` in `medusa-config.js` needs to be equal to `{your-language}`.
125
+
126
+ ## Q&A
127
+
128
+ ### What means "We do not store documents"?
129
+
130
+ It is simple - every time when you click `Generate invoice` we are taking an `Order` and based on that we generate invoice. The same happens with `View invoice`. It means that if you click generate invoice and your `Order` will change (e.g. line items changed, customer address changed etc.), then `View invoice` will show you the <b>last</b> state of your `Order`. <b>We do not remember Order's state</b>.
131
+
132
+ However, we remember such things like: invoice number, address or logo, so everything which you set in `Settings`.
133
+
134
+ Anyway, we encourage you to save your invoice when you generate.
135
+
136
+ ### I clicked generate invoice, invoice number has been assigned, but I want to go back to previous number
137
+
138
+ Now you can do it! Just got to `Settings` tab and click `Change settings` in `Invoice`. Use `Forced number` field to put your next invoice number.
139
+
140
+ ### Provided templates are not enough for me, I want more of them, I want customization, I want hide some information etc.
141
+
142
+ We also see here endless possibilities.. :) Unfortunately, this is a very basic version, but for sure in the future there will be more functionalities.
143
+
144
+ ## Proposals, bugs, improvements
145
+
146
+ If you have an idea, what could be the next highest priority functionality, do not hesistate raise issue here: [Github issues](https://github.com/RSC-Labs/medusa-documents/issues)
147
+
148
+ ## License
149
+
150
+ MIT
151
+
152
+ ## Pro version
153
+
154
+ The Pro version of medusa-documents expands on the features of the free version with more advanced capabilities such as:
155
+ - automatically send invoices to customers
156
+ - new premium templates
157
+ - additional options for configurations, e.g. setting different addresses for various document type
158
+ - and a lot more.
159
+
160
+ The Pro version is available under commercial licence - contact labs@rsoftcon.com for more information.
161
+
162
+ ### Hide Pro version tab
163
+
164
+ We show what advanced features we offer in "Pro version" tab. We try to keep it non-intruisive, but if you feel it differently, you can always hide this tab by setting following environment variable:
165
+ `VITE_MEDUSA_ADMIN_MEDUSA_DOCUMENTS_HIDE_PRO=true`
166
+
167
+ After restarting your admin application, you shall have this tab hidden.
168
+
169
+ ---
170
+
171
+ © 2025 RSC https://rsoftcon.com/
package/package.json ADDED
@@ -0,0 +1,103 @@
1
+ {
2
+ "name": "@zosmaai/medusa-documents-v2",
3
+ "version": "0.2.13",
4
+ "description": "Generate documents from Medusa",
5
+ "author": "SensaLab <info@sensalab.com>",
6
+ "license": "MIT",
7
+ "files": [
8
+ ".medusa/server"
9
+ ],
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/SensaLab/medusa-documents"
13
+ },
14
+ "keywords": [
15
+ "medusa-plugin",
16
+ "medusa-v2",
17
+ "medusa-plugin-documents",
18
+ "documents",
19
+ "invoice",
20
+ "pdf"
21
+ ],
22
+ "scripts": {
23
+ "build": "medusa plugin:build && cp -r src/modules/documents/assets .medusa/server/src/modules/documents/assets",
24
+ "prepare": "pnpm run build",
25
+ "dev": "medusa plugin:develop"
26
+ },
27
+ "dependencies": {
28
+ "@mui/material": "^6.4.1",
29
+ "@emotion/react": "^11.14.0",
30
+ "@emotion/styled": "^11.14.0",
31
+ "react-hook-form": "^7.49.2",
32
+ "lodash": "4.17.21",
33
+ "pdfkit": "0.15.0",
34
+ "moment": "^2.30.1",
35
+ "i18next": "23.15.1",
36
+ "react-table": "^7.8.0",
37
+ "clsx": "^2.1.1"
38
+ },
39
+ "devDependencies": {
40
+ "@medusajs/admin-sdk": "^2.7.0",
41
+ "@medusajs/admin-shared": "^2.7.0",
42
+ "@medusajs/cli": "^2.7.0",
43
+ "@medusajs/framework": "^2.7.0",
44
+ "@medusajs/medusa": "^2.7.0",
45
+ "@medusajs/test-utils": "^2.7.0",
46
+ "@medusajs/ui": "4.0.4",
47
+ "@medusajs/icons": "^2.7.0",
48
+ "@medusajs/utils": "^2.7.0",
49
+ "@mikro-orm/cli": "6.4.3",
50
+ "@mikro-orm/core": "6.4.3",
51
+ "@mikro-orm/knex": "6.4.3",
52
+ "@mikro-orm/migrations": "6.4.3",
53
+ "@mikro-orm/postgresql": "6.4.3",
54
+ "@swc/core": "^1.7.28",
55
+ "@types/node": "^20.0.0",
56
+ "@types/react": "^18.3.2",
57
+ "@types/react-dom": "^18.2.25",
58
+ "awilix": "^8.0.1",
59
+ "pg": "^8.13.0",
60
+ "prop-types": "^15.8.1",
61
+ "react": "^18.2.0",
62
+ "react-country-flag": "^3.1.0",
63
+ "react-dom": "^18.2.0",
64
+ "react-router-dom": "^6.26.0",
65
+ "ts-node": "^10.9.2",
66
+ "typescript": "^5.6.2",
67
+ "vite": "^5.2.11",
68
+ "yalc": "^1.0.0-pre.53"
69
+ },
70
+ "peerDependencies": {
71
+ "@medusajs/admin-sdk": "^2.7.0",
72
+ "@medusajs/cli": "^2.7.0",
73
+ "@medusajs/framework": "^2.7.0",
74
+ "@medusajs/test-utils": "^2.7.0",
75
+ "@medusajs/medusa": "^2.7.0",
76
+ "@medusajs/ui": "4.0.3",
77
+ "@medusajs/icons": "^2.7.0",
78
+ "@mikro-orm/cli": "6.4.3",
79
+ "@mikro-orm/core": "6.4.3",
80
+ "@mikro-orm/knex": "6.4.3",
81
+ "@mikro-orm/migrations": "6.4.3",
82
+ "@mikro-orm/postgresql": "6.4.3",
83
+ "awilix": "^8.0.1",
84
+ "pg": "^8.13.0"
85
+ },
86
+ "engines": {
87
+ "node": ">=20"
88
+ },
89
+ "packageManager": "pnpm@11.11.0",
90
+ "exports": {
91
+ "./package.json": "./package.json",
92
+ "./workflows": "./.medusa/server/src/workflows/index.js",
93
+ "./.medusa/server/src/modules/*": "./.medusa/server/src/modules/*/index.js",
94
+ "./modules/*": "./.medusa/server/src/modules/*/index.js",
95
+ "./providers/*": "./.medusa/server/src/providers/*/index.js",
96
+ "./*": "./.medusa/server/src/*.js",
97
+ "./admin": {
98
+ "import": "./.medusa/server/src/admin/index.mjs",
99
+ "require": "./.medusa/server/src/admin/index.js",
100
+ "default": "./.medusa/server/src/admin/index.js"
101
+ }
102
+ }
103
+ }