@actuate-media/plugin-commerce 0.0.12 → 0.0.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.
- package/CHANGELOG.md +22 -0
- package/dist/hooks.d.ts +2 -4
- package/dist/hooks.d.ts.map +1 -1
- package/dist/hooks.js +11 -10
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +2 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @actuate-media/plugin-commerce
|
|
2
2
|
|
|
3
|
+
## 0.0.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 041a228: Add the MIT `license` field to every published package (previously missing) and correct `repository.url` to `github.com/actuate-media/actuatecms` (13 packages carried the wrong org).
|
|
8
|
+
- de419f2: Give plugin hooks a frozen, typed event contract. cms-core now exports
|
|
9
|
+
`PluginHook`, `PluginHookEvent`, and `PluginHookPayload` (document + upload
|
|
10
|
+
variants) as the single source of truth, and dispatches a complete, consistent
|
|
11
|
+
set of events: `afterCreate` / `afterUpdate` / `afterDelete` — each also in a
|
|
12
|
+
collection-namespaced form (`afterUpdate:navigations`, `afterCreate:orders`) —
|
|
13
|
+
plus `afterUpload` (fired post-upload from the media route). Every handler now
|
|
14
|
+
receives one typed payload; document field values live on `payload.data`.
|
|
15
|
+
|
|
16
|
+
Previously core fired only bare `afterCreate`/`afterUpdate` with the raw row, so
|
|
17
|
+
several shipped plugins' hooks were dead: `plugin-media`'s `afterUpload` never
|
|
18
|
+
fired, `plugin-navigation` read fields that didn't exist, and the namespaced
|
|
19
|
+
events `plugin-forms`/`plugin-commerce` declared were never dispatched. Each
|
|
20
|
+
plugin has been aligned to the shared type and dispatched events (and
|
|
21
|
+
`plugin-redirects`' request-time `onRedirectMatch` hook — which the lifecycle
|
|
22
|
+
bus never dispatched — was removed). Undispatched event names are now a
|
|
23
|
+
compile-time error.
|
|
24
|
+
|
|
3
25
|
## 0.0.12
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/dist/hooks.d.ts
CHANGED
package/dist/hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EAGX,MAAM,yBAAyB,CAAA;AAEhC,eAAO,MAAM,aAAa,EAAE,UAAU,EAmCrC,CAAA"}
|
package/dist/hooks.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export const commerceHooks = [
|
|
2
2
|
{
|
|
3
3
|
event: 'afterCreate:orders',
|
|
4
|
-
handler: async (
|
|
5
|
-
|
|
6
|
-
const orderId =
|
|
7
|
-
const total =
|
|
8
|
-
const currency =
|
|
4
|
+
handler: async (payload) => {
|
|
5
|
+
// Document-lifecycle event: payload is the document; field values live in payload.data.
|
|
6
|
+
const { id: orderId, data } = payload;
|
|
7
|
+
const total = data?.['total'];
|
|
8
|
+
const currency = data?.['currency'] ?? 'USD';
|
|
9
9
|
if (!orderId || total === undefined)
|
|
10
10
|
return;
|
|
11
11
|
// TODO: Integrate with Stripe payment intent creation
|
|
@@ -14,11 +14,12 @@ export const commerceHooks = [
|
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
event: 'afterUpdate:products',
|
|
17
|
-
handler: async (
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const
|
|
17
|
+
handler: async (payload) => {
|
|
18
|
+
// Document-lifecycle event: payload is the document; field values live in payload.data.
|
|
19
|
+
const { data } = payload;
|
|
20
|
+
const name = data?.['name'];
|
|
21
|
+
const trackInventory = data?.['trackInventory'];
|
|
22
|
+
const inventoryCount = data?.['inventoryCount'];
|
|
22
23
|
if (!trackInventory || inventoryCount === undefined)
|
|
23
24
|
return;
|
|
24
25
|
const LOW_STOCK_THRESHOLD = 5;
|
package/dist/hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,aAAa,GAAiB;IACzC;QACE,KAAK,EAAE,oBAAoB;QAC3B,OAAO,EAAE,KAAK,EAAE,OAA0B,EAAiB,EAAE;YAC3D,wFAAwF;YACxF,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,OAAoC,CAAA;YAClE,MAAM,KAAK,GAAG,IAAI,EAAE,CAAC,OAAO,CAAuB,CAAA;YACnD,MAAM,QAAQ,GAAI,IAAI,EAAE,CAAC,UAAU,CAAY,IAAI,KAAK,CAAA;YAExD,IAAI,CAAC,OAAO,IAAI,KAAK,KAAK,SAAS;gBAAE,OAAM;YAE3C,sDAAsD;YACtD,OAAO,CAAC,IAAI,CAAC,4BAA4B,OAAO,gBAAgB,QAAQ,IAAI,KAAK,EAAE,CAAC,CAAA;QACtF,CAAC;KACF;IACD;QACE,KAAK,EAAE,sBAAsB;QAC7B,OAAO,EAAE,KAAK,EAAE,OAA0B,EAAiB,EAAE;YAC3D,wFAAwF;YACxF,MAAM,EAAE,IAAI,EAAE,GAAG,OAAoC,CAAA;YACrD,MAAM,IAAI,GAAG,IAAI,EAAE,CAAC,MAAM,CAAuB,CAAA;YACjD,MAAM,cAAc,GAAG,IAAI,EAAE,CAAC,gBAAgB,CAAwB,CAAA;YACtE,MAAM,cAAc,GAAG,IAAI,EAAE,CAAC,gBAAgB,CAAuB,CAAA;YAErE,IAAI,CAAC,cAAc,IAAI,cAAc,KAAK,SAAS;gBAAE,OAAM;YAE3D,MAAM,mBAAmB,GAAG,CAAC,CAAA;YAC7B,IAAI,cAAc,IAAI,mBAAmB,EAAE,CAAC;gBAC1C,qDAAqD;gBACrD,OAAO,CAAC,IAAI,CACV,gCAAgC,IAAI,SAAS,cAAc,oBAAoB,CAChF,CAAA;YACH,CAAC;QACH,CAAC;KACF;CACF,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FieldDefinition, CollectionDefinition } from '@actuate-media/cms-core';
|
|
1
|
+
import type { FieldDefinition, CollectionDefinition, PluginHook } from '@actuate-media/cms-core';
|
|
2
2
|
export interface CommercePluginConfig {
|
|
3
3
|
stripe?: {
|
|
4
4
|
secretKey: string;
|
|
@@ -21,10 +21,7 @@ interface ActuatePlugin {
|
|
|
21
21
|
icon: string;
|
|
22
22
|
path: string;
|
|
23
23
|
}>;
|
|
24
|
-
hooks?:
|
|
25
|
-
event: string;
|
|
26
|
-
handler: (...args: unknown[]) => Promise<void> | void;
|
|
27
|
-
}>;
|
|
24
|
+
hooks?: PluginHook[];
|
|
28
25
|
}
|
|
29
26
|
/** Creates the Actuate Commerce plugin with optional Stripe, tax, and shipping configuration. */
|
|
30
27
|
export declare function commercePlugin(config?: CommercePluginConfig): ActuatePlugin;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAKhG,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE;QACP,SAAS,EAAE,MAAM,CAAA;QACjB,aAAa,EAA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
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAwB1C,iGAAiG;AACjG,MAAM,UAAU,cAAc,CAAC,SAA+B,EAAE;IAC9D,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,MAAM,EAAE,cAAc;QACtB,WAAW,EAAE,mBAAmB;QAChC,aAAa,EAAE;YACb,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,oBAAoB,EAAE;YAClE,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,kBAAkB,EAAE;YACpE,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,qBAAqB,EAAE;YACpE;gBACE,KAAK,EAAE,oBAAoB;gBAC3B,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,qBAAqB;aAC5B;SACF;QACD,KAAK,EAAE,aAAa;KACrB,CAAA;AACH,CAAC;AAGD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@actuate-media/plugin-commerce",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
|
+
"license": "MIT",
|
|
4
5
|
"repository": {
|
|
5
6
|
"type": "git",
|
|
6
|
-
"url": "https://github.com/
|
|
7
|
+
"url": "https://github.com/actuate-media/actuatecms.git",
|
|
7
8
|
"directory": "packages/plugin-commerce"
|
|
8
9
|
},
|
|
9
10
|
"publishConfig": {
|
|
@@ -27,7 +28,7 @@
|
|
|
27
28
|
"@types/react": "^19.0.0",
|
|
28
29
|
"typescript": "^5.7.0",
|
|
29
30
|
"vitest": "^4.1.0",
|
|
30
|
-
"@actuate-media/cms-core": "0.
|
|
31
|
+
"@actuate-media/cms-core": "0.91.0"
|
|
31
32
|
},
|
|
32
33
|
"peerDependencies": {
|
|
33
34
|
"@actuate-media/cms-core": ">=0.1.0",
|