@porulle/plugin-giftcards 0.6.0 → 0.8.0
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/README.md +16 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -39,6 +39,22 @@ Persists gift cards and append-only transactions; supports partial redemption, c
|
|
|
39
39
|
- **`/gift-cards`** — Admin: `POST/GET /`, `GET /{id}`, `POST /{id}/disable`, `POST /{id}/adjust`. Public: `POST /check-balance`.
|
|
40
40
|
- **`/me/gift-cards`** — Customer: `GET /` (authenticated).
|
|
41
41
|
|
|
42
|
+
### Permissions
|
|
43
|
+
|
|
44
|
+
All admin routes require the **`gift-cards:admin`** scope (`gift-cards:*` and `*:*` wildcards also pass). Grant it to a role in `commerce.config.ts` (`auth.roles`), or to a server-to-server API key via `auth.apiKeyScopes`:
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
auth: {
|
|
48
|
+
apiKeyScopes: {
|
|
49
|
+
giftcards_admin: {
|
|
50
|
+
prefix: "uc_gcadm_",
|
|
51
|
+
description: "Issue, list, disable, and adjust gift cards",
|
|
52
|
+
permissions: { "gift-cards": ["admin"] },
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
```
|
|
57
|
+
|
|
42
58
|
## Hooks
|
|
43
59
|
|
|
44
60
|
Only **`giftCardPluginWithHooks`** registers hooks:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@porulle/plugin-giftcards",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@hono/zod-openapi": "^1.2.2",
|
|
21
21
|
"hono": "^4.12.5",
|
|
22
|
-
"@porulle/core": "0.
|
|
22
|
+
"@porulle/core": "0.8.0"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/node": "^24.5.2",
|
|
26
26
|
"eslint": "^9.39.1",
|
|
27
27
|
"typescript": "5.9.2",
|
|
28
28
|
"vitest": "^3.2.4",
|
|
29
|
-
"@porulle/
|
|
30
|
-
"@porulle/
|
|
29
|
+
"@porulle/eslint-config": "0.1.0",
|
|
30
|
+
"@porulle/typescript-config": "0.1.0"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
33
33
|
"access": "public"
|