@unchainedshop/core-quotations 5.0.0-alpha.5 → 5.0.0-alpha.8

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 (2) hide show
  1. package/README.md +10 -78
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -13,89 +13,21 @@ npm install @unchainedshop/core-quotations
13
13
 
14
14
  ## Usage
15
15
 
16
- ```typescript
17
- import { configureQuotationsModule, QuotationStatus } from '@unchainedshop/core-quotations';
18
-
19
- const quotationsModule = await configureQuotationsModule({ db });
20
-
21
- // Create a quotation request
22
- const quotationId = await quotationsModule.create({
23
- userId: 'user-123',
24
- productId: 'custom-product-456',
25
- configuration: [{ key: 'quantity', value: '1000' }],
26
- });
16
+ The platform initializes this module as `platform.unchainedAPI.modules.quotations`.
27
17
 
28
- // Propose a quote
29
- await quotationsModule.propose(quotationId, {
30
- price: { amount: 5000, currency: 'CHF' },
31
- expiresAt: new Date('2024-12-31'),
32
- });
18
+ ```typescript
19
+ import { QuotationStatus } from '@unchainedshop/core-quotations';
33
20
 
34
- // Find quotations
35
- const quotations = await quotationsModule.findQuotations({
36
- status: QuotationStatus.PROPOSED,
37
- });
21
+ const { quotations } = platform.unchainedAPI.modules;
22
+ const userQuotations = await quotations.findQuotations({ userId: 'user-123' });
23
+ const proposals = userQuotations.filter(
24
+ (quotation) => quotations.normalizedStatus(quotation) === QuotationStatus.PROPOSED,
25
+ );
38
26
  ```
39
27
 
40
- ## API Overview
41
-
42
- ### Module Configuration
43
-
44
- | Export | Description |
45
- |--------|-------------|
46
- | `configureQuotationsModule` | Configure and return the quotations module |
47
-
48
- ### Queries
49
-
50
- | Method | Description |
51
- |--------|-------------|
52
- | `findQuotation` | Find quotation by ID |
53
- | `findQuotations` | Find quotations with filtering and pagination |
54
- | `count` | Count quotations matching query |
55
- | `quotationExists` | Check if quotation exists |
56
-
57
- ### Mutations
58
-
59
- | Method | Description |
60
- |--------|-------------|
61
- | `create` | Create a quotation request |
62
- | `update` | Update quotation data |
63
- | `delete` | Delete a quotation |
64
- | `propose` | Propose a quote |
65
- | `verify` | Verify a quotation |
66
- | `reject` | Reject a quotation |
67
- | `fulfill` | Mark quotation as fulfilled |
68
-
69
- ### Constants
70
-
71
- | Export | Description |
72
- |--------|-------------|
73
- | `QuotationStatus` | Status values (REQUESTED, PROCESSING, PROPOSED, FULFILLED, REJECTED) |
74
-
75
- ### Settings
76
-
77
- | Export | Description |
78
- |--------|-------------|
79
- | `quotationsSettings` | Access quotation module settings |
80
-
81
- ### Types
82
-
83
- | Export | Description |
84
- |--------|-------------|
85
- | `Quotation` | Quotation document type |
86
- | `QuotationConfiguration` | Configuration item type |
87
- | `QuotationsModule` | Module interface type |
88
-
89
- ## Events
28
+ Use the GraphQL quotation mutations or `unchainedAPI.services.quotations` to request, propose, and verify quotations through the configured adapter. A proposal's `price` is an integer amount in the quotation currency's minor units, and its expiration field is `expires`.
90
29
 
91
- | Event | Description |
92
- |-------|-------------|
93
- | `QUOTATION_CREATE` | Quotation requested |
94
- | `QUOTATION_UPDATE` | Quotation updated |
95
- | `QUOTATION_REMOVE` | Quotation deleted |
96
- | `QUOTATION_PROPOSE` | Quote proposed |
97
- | `QUOTATION_REJECT` | Quotation rejected |
98
- | `QUOTATION_FULLFILL` | Quotation fulfilled |
30
+ See the [module guide](https://docs.unchained.shop/platform-configuration/modules/quotations), [quotation extension guide](https://docs.unchained.shop/extend/quotation), [public exports](src/quotations-index.ts), and [module implementation](src/module/configureQuotationsModule.ts).
99
31
 
100
32
  ## License
101
33
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unchainedshop/core-quotations",
3
3
  "description": "Quotation and RFQ management module for the Unchained Engine",
4
- "version": "5.0.0-alpha.5",
4
+ "version": "5.0.0-alpha.8",
5
5
  "main": "lib/quotations-index.js",
6
6
  "types": "lib/quotations-index.d.ts",
7
7
  "type": "module",
@@ -35,9 +35,9 @@
35
35
  },
36
36
  "homepage": "https://github.com/unchainedshop/unchained#readme",
37
37
  "dependencies": {
38
- "@unchainedshop/events": "^5.0.0-alpha.5",
39
- "@unchainedshop/mongodb": "^5.0.0-alpha.5",
40
- "@unchainedshop/utils": "^5.0.0-alpha.5"
38
+ "@unchainedshop/events": "^5.0.0-alpha.8",
39
+ "@unchainedshop/mongodb": "^5.0.0-alpha.8",
40
+ "@unchainedshop/utils": "^5.0.0-alpha.8"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@types/node": "^26.2.0",