@xbstracts/medusa-coupons 0.0.4 → 0.0.5
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/.medusa/server/src/admin/index.js +75 -21
- package/.medusa/server/src/admin/index.mjs +75 -21
- package/.medusa/server/src/api/validators.js +10 -2
- package/.medusa/server/src/modules/coupon/index.js +3 -2
- package/.medusa/server/src/modules/coupon/loaders/validate-options.js +8 -0
- package/.medusa/server/src/modules/coupon/migrations/Migration20260725000000.js +26 -0
- package/.medusa/server/src/modules/coupon/service.js +5 -4
- package/.medusa/server/src/modules/coupon/utils.js +181 -18
- package/.medusa/server/src/vendor/index.mjs +75 -21
- package/README.md +24 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -48,6 +48,30 @@ coupons preserve `each` or `once` allocation. Order-scoped coupons persist
|
|
|
48
48
|
`allocation = "across"`. The target and allocation are copied into immutable
|
|
49
49
|
issuance and entitlement snapshots.
|
|
50
50
|
|
|
51
|
+
## Expiration Policies
|
|
52
|
+
|
|
53
|
+
Configure the coupon module with an IANA timezone. It defaults to `UTC` and is
|
|
54
|
+
copied into every issuance and entitlement expiration-policy snapshot:
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
{
|
|
58
|
+
resolve: "@xbstracts/medusa-coupons/coupon",
|
|
59
|
+
options: { expiration_timezone: "Asia/Bangkok" },
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Coupon products support no expiration (`none`), the end of the issue month
|
|
64
|
+
(`month_end`), a calendar duration in days or months (`duration`), and an
|
|
65
|
+
explicit instant (`fixed`). Dynamic policies use either the exact issue clock
|
|
66
|
+
or the end of the resolved local day. Month arithmetic clamps missing target
|
|
67
|
+
days to the target month's last day, including February in leap years. A
|
|
68
|
+
campaign or explicit cap is applied only after the policy expiry is resolved.
|
|
69
|
+
|
|
70
|
+
Legacy `{ type: "duration", duration_days: N }` values remain readable and are
|
|
71
|
+
normalized to `duration`, `days`, and `exactly`; the module migration updates
|
|
72
|
+
stored configurations and snapshots without changing an entitlement's concrete
|
|
73
|
+
`expires_at` value.
|
|
74
|
+
|
|
51
75
|
## Purchase Conditions
|
|
52
76
|
|
|
53
77
|
Coupon products can restrict purchase by customer group, region, shipping
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xbstracts/medusa-coupons",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Reusable Medusa coupon product plugin.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/xbstracts/medusa-coupons#readme",
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"prepack": "npm run build"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
+
"dayjs": "^1.11.21",
|
|
53
54
|
"multer": "^2.0.2"
|
|
54
55
|
},
|
|
55
56
|
"devDependencies": {
|