@weft-js/pay 0.1.1 → 0.1.3

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.
@@ -1,5 +1,10 @@
1
1
  import type { PluginInstance } from '@weft-js/core/plugin'
2
2
 
3
- declare const plugin: (options?: { prices?: Record<string, string>; api?: string; apiVersion?: string; tolerance?: number }) => PluginInstance<unknown>
3
+ declare const plugin: (options?: {
4
+ prices?: Record<string, string>
5
+ api?: string
6
+ apiVersion?: string
7
+ tolerance?: number
8
+ }) => PluginInstance<unknown>
4
9
  /** `stripe()` for `weft.config.ts`: Stripe as a `pay.rail` provider. Keys stay in the environment. */
5
10
  export default plugin
package/stripe-plugin.mjs CHANGED
@@ -2,17 +2,36 @@
2
2
  // module, so they name env vars and never hold a key (PAY003). Another provider is this one line swapped for another.
3
3
  import { definePlugin, defineSlot, provide } from '@weft-js/core/plugin'
4
4
 
5
- const slot = defineSlot({ id: 'pay.rail', version: 1, cardinality: 'keyed', sides: ['server', 'client', 'native'] })
5
+ const slot = defineSlot({
6
+ id: 'pay.rail',
7
+ version: 1,
8
+ cardinality: 'keyed',
9
+ sides: ['server', 'client', 'native'],
10
+ })
6
11
 
7
12
  export const stripe = definePlugin({
8
13
  name: '@weft-js/pay/stripe',
9
14
  version: '0.0.0',
10
15
  weft: '*',
11
16
  permissions: { net: ['api.stripe.com'], env: ['STRIPE_SECRET_KEY', 'STRIPE_WEBHOOK_SECRET'] },
12
- contribute: options => ({
13
- provides: [provide(slot, { key: 'stripe', sides: { server: { module: '@weft-js/pay/stripe', export: 'stripeRail', options } } })],
14
- agents: { title: 'Pay rail: Stripe', text: 'Stripe Checkout, server side only: `STRIPE_SECRET_KEY`, and `STRIPE_WEBHOOK_SECRET` for `/_weft/x/pay/stripe`, the webhook URL to give Stripe.' },
15
- map: [{ want: 'Change the payment provider', call: 'replace this plugin in `plugins`: app code stays', have: 'Stripe Checkout' }],
17
+ contribute: (options) => ({
18
+ provides: [
19
+ provide(slot, {
20
+ key: 'stripe',
21
+ sides: { server: { module: '@weft-js/pay/stripe', export: 'stripeRail', options } },
22
+ }),
23
+ ],
24
+ agents: {
25
+ title: 'Pay rail: Stripe',
26
+ text: 'Stripe Checkout, server side only: `STRIPE_SECRET_KEY`, and `STRIPE_WEBHOOK_SECRET` for `/_weft/x/pay/stripe`, the webhook URL to give Stripe.',
27
+ },
28
+ map: [
29
+ {
30
+ want: 'Change the payment provider',
31
+ call: 'replace this plugin in `plugins`: app code stays',
32
+ have: 'Stripe Checkout',
33
+ },
34
+ ],
16
35
  }),
17
36
  })
18
37