@easy-cms/plugin-ecommerce 0.67.0 → 0.67.2
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 +1 -1
- package/dist/{chunk-QW3XTC5J.js → chunk-DKVZROE5.js} +12 -4
- package/dist/{chunk-4DBRFOY7.js → chunk-PXMODGBG.js} +1 -1
- package/dist/client.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react.js +1 -1
- package/dist/stripe.d.ts +9 -1
- package/dist/stripe.js +13 -4
- package/dist/vue.js +1 -1
- package/package.json +8 -6
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@ A shop for Easy CMS: products with variants and prices in several currencies, ca
|
|
|
11
11
|
npm install @easy-cms/plugin-ecommerce
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Or `pnpm add`, `yarn add` or `bun add`. For Stripe, also install `stripe
|
|
14
|
+
Or `pnpm add`, `yarn add` or `bun add`. For Stripe, also install `stripe` (17 to 23).
|
|
15
15
|
|
|
16
16
|
## Usage
|
|
17
17
|
|
|
@@ -783,7 +783,7 @@ var INFO = {
|
|
|
783
783
|
name: "@easy-cms/plugin-ecommerce",
|
|
784
784
|
// The plugin API it is written for (`PLUGIN_API_VERSION` of @easy-cms/core).
|
|
785
785
|
apiVersion: 1,
|
|
786
|
-
...true ? { version: "0.67.
|
|
786
|
+
...true ? { version: "0.67.2" } : {}
|
|
787
787
|
};
|
|
788
788
|
|
|
789
789
|
// src/shop.ts
|
|
@@ -1694,15 +1694,23 @@ function ecommercePlugin(options) {
|
|
|
1694
1694
|
return found;
|
|
1695
1695
|
};
|
|
1696
1696
|
const who = (req) => ({ user: req.user, context: req.context });
|
|
1697
|
-
const settings = () => ({
|
|
1697
|
+
const settings = (locale) => ({
|
|
1698
1698
|
currencies,
|
|
1699
1699
|
defaultCurrency,
|
|
1700
|
-
|
|
1700
|
+
// Labels in the page's language (`?locale=`), as the order emails use the order's.
|
|
1701
|
+
paymentMethods: [...methods.values()].map((m) => ({
|
|
1702
|
+
name: m.name,
|
|
1703
|
+
label: labelText(m.label, locale)
|
|
1704
|
+
})),
|
|
1701
1705
|
guests: shop.guests,
|
|
1702
1706
|
countries
|
|
1703
1707
|
});
|
|
1704
1708
|
const endpoints = [
|
|
1705
|
-
{
|
|
1709
|
+
{
|
|
1710
|
+
path: "/shop/config",
|
|
1711
|
+
method: "get",
|
|
1712
|
+
handler: ({ url }) => settings(url.searchParams.get("locale") ?? void 0)
|
|
1713
|
+
},
|
|
1706
1714
|
{
|
|
1707
1715
|
path: "/shop/cart",
|
|
1708
1716
|
method: "post",
|
|
@@ -147,7 +147,7 @@ function createShopClient(options = {}) {
|
|
|
147
147
|
async load() {
|
|
148
148
|
try {
|
|
149
149
|
const [settings, user] = await Promise.all([
|
|
150
|
-
call("GET",
|
|
150
|
+
call("GET", `/shop/config?locale=${encodeURIComponent(locale)}`),
|
|
151
151
|
me().catch(() => null)
|
|
152
152
|
]);
|
|
153
153
|
set({ settings, user });
|
package/dist/client.js
CHANGED
package/dist/index.js
CHANGED
package/dist/react.js
CHANGED
package/dist/stripe.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { Label } from '@easy-cms/core';
|
|
2
2
|
import { P as PaymentAdapter } from './payments-DZKeAbza.js';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* The Stripe API version the adapter asks for and is tested with, whichever `stripe` package
|
|
6
|
+
* (17 to 23) is installed, so a new major of the package doesn't change answers under a shop.
|
|
7
|
+
*/
|
|
8
|
+
declare const STRIPE_API_VERSION = "2026-09-30.endive";
|
|
9
|
+
|
|
4
10
|
/** The parts of the `stripe` package's client the adapter uses. */
|
|
5
11
|
interface StripeClient {
|
|
6
12
|
readonly paymentIntents: {
|
|
@@ -45,6 +51,8 @@ interface StripeAdapterOptions {
|
|
|
45
51
|
readonly label?: Label;
|
|
46
52
|
/** Extra `PaymentIntent` parameters, e.g. `{ payment_method_types: ['card', 'promptpay'] }`. */
|
|
47
53
|
readonly paymentIntent?: Record<string, unknown>;
|
|
54
|
+
/** Default `STRIPE_API_VERSION`. Not used with `client`, which has its own. */
|
|
55
|
+
readonly apiVersion?: string;
|
|
48
56
|
/** A Stripe client of your own (or a stand-in in tests). Default: `new Stripe(secretKey)`. */
|
|
49
57
|
readonly client?: StripeClient;
|
|
50
58
|
}
|
|
@@ -55,4 +63,4 @@ interface StripeAdapterOptions {
|
|
|
55
63
|
*/
|
|
56
64
|
declare function stripeAdapter(options: StripeAdapterOptions): PaymentAdapter;
|
|
57
65
|
|
|
58
|
-
export { type StripeAdapterOptions, type StripeClient, stripeAdapter };
|
|
66
|
+
export { STRIPE_API_VERSION, type StripeAdapterOptions, type StripeClient, stripeAdapter };
|
package/dist/stripe.js
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
paymentFailed,
|
|
3
3
|
paymentSucceeded
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DKVZROE5.js";
|
|
5
|
+
|
|
6
|
+
// src/stripe-client.ts
|
|
7
|
+
var STRIPE_API_VERSION = "2026-09-30.endive";
|
|
8
|
+
function createStripeClient(Stripe, options, config = {}) {
|
|
9
|
+
return new Stripe(options.secretKey, {
|
|
10
|
+
apiVersion: options.apiVersion ?? STRIPE_API_VERSION,
|
|
11
|
+
appInfo: { name: "Easy CMS ecommerce", url: "https://github.com/maritonx/easy-cms" },
|
|
12
|
+
...config
|
|
13
|
+
});
|
|
14
|
+
}
|
|
5
15
|
|
|
6
16
|
// src/stripe.ts
|
|
7
17
|
function stripeAdapter(options) {
|
|
@@ -10,9 +20,7 @@ function stripeAdapter(options) {
|
|
|
10
20
|
if (options.client) return Promise.resolve(options.client);
|
|
11
21
|
const name = "stripe";
|
|
12
22
|
client ??= import(name).then(
|
|
13
|
-
(mod) =>
|
|
14
|
-
appInfo: { name: "Easy CMS ecommerce", url: "https://github.com/maritonx/easy-cms" }
|
|
15
|
-
})
|
|
23
|
+
(mod) => createStripeClient(mod.default, options)
|
|
16
24
|
);
|
|
17
25
|
return client;
|
|
18
26
|
};
|
|
@@ -86,5 +94,6 @@ function stripeAdapter(options) {
|
|
|
86
94
|
};
|
|
87
95
|
}
|
|
88
96
|
export {
|
|
97
|
+
STRIPE_API_VERSION,
|
|
89
98
|
stripeAdapter
|
|
90
99
|
};
|
package/dist/vue.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easy-cms/plugin-ecommerce",
|
|
3
|
-
"version": "0.67.
|
|
3
|
+
"version": "0.67.2",
|
|
4
4
|
"description": "A shop for Easy CMS: products and variants, prices in several currencies, carts (guests too), checkout with Stripe or bank transfer, orders, stock, customer accounts, and React and Vue hooks (experimental)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
],
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"react": ">=18.0.0",
|
|
37
|
-
"stripe": ">=17.0.0",
|
|
37
|
+
"stripe": ">=17.0.0 <24.0.0",
|
|
38
38
|
"vue": "^3.4.0",
|
|
39
|
-
"@easy-cms/core": "^0.67.
|
|
39
|
+
"@easy-cms/core": "^0.67.2"
|
|
40
40
|
},
|
|
41
41
|
"peerDependenciesMeta": {
|
|
42
42
|
"react": {
|
|
@@ -53,10 +53,12 @@
|
|
|
53
53
|
"@types/react": "^19.2.0",
|
|
54
54
|
"happy-dom": "^20.14.5",
|
|
55
55
|
"react": "^19.2.0",
|
|
56
|
+
"stripe": "^23.0.0",
|
|
57
|
+
"stripe-17": "npm:stripe@^17.7.0",
|
|
56
58
|
"vue": "^3.5.43",
|
|
57
|
-
"@easy-cms/core": "^0.67.
|
|
58
|
-
"@easy-cms/db-sqlite": "^0.67.
|
|
59
|
-
"@easy-cms/plugin-multi-tenant": "^0.67.
|
|
59
|
+
"@easy-cms/core": "^0.67.2",
|
|
60
|
+
"@easy-cms/db-sqlite": "^0.67.2",
|
|
61
|
+
"@easy-cms/plugin-multi-tenant": "^0.67.2"
|
|
60
62
|
},
|
|
61
63
|
"engines": {
|
|
62
64
|
"node": ">=22.12"
|