@paykit-sdk/react 1.1.7 → 1.1.9

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 CHANGED
@@ -10,13 +10,23 @@ npm install @paykit-sdk/react
10
10
 
11
11
  ## Quick Start
12
12
 
13
- ### 1. Setup Provider
13
+ ### 1. Setup PayKit
14
14
 
15
15
  ```tsx
16
- import { PaykitProvider } from '@paykit-sdk/react';
17
- import { stripe } from '@paykit-sdk/stripe';
16
+ import { PayKit } from '@paykit-sdk/core';
17
+ import { local } from '@paykit-sdk/local';
18
+
19
+ const provider = local();
20
+ const paykit = new PayKit(provider);
21
+
22
+ export { provider, paykit };
23
+ ```
18
24
 
19
- const provider = stripe();
25
+ ### 2. Setup Provider
26
+
27
+ ```tsx
28
+ import { provider } from '@lib/paykit';
29
+ import { PaykitProvider } from '@paykit-sdk/react';
20
30
 
21
31
  function App() {
22
32
  return (
@@ -27,7 +37,7 @@ function App() {
27
37
  }
28
38
  ```
29
39
 
30
- ### 2. Use Hooks
40
+ ### 3. Use Hooks
31
41
 
32
42
  ```tsx
33
43
  import * as React from 'react';
@@ -61,9 +71,9 @@ Works with any PayKit provider including Stripe, Polar, Gumroad, and more.
61
71
 
62
72
  ## Documentation
63
73
 
64
- - [React Documentation](https://usepaykit.dev/docs/react)
65
- - [PayKit Documentation](https://usepaykit.dev)
66
- - [Production Examples](https://usepaykit.dev/docs/examples)
74
+ - [React Documentation](https://www.usepaykit.dev/docs/concepts/client-side-usage)
75
+ - [PayKit Documentation](https://usepaykit.dev/docs)
76
+ - [Framework Examples](https://usepaykit.dev/docs/framework-examples)
67
77
 
68
78
  ## TypeScript Support
69
79
 
package/dist/index.d.mts CHANGED
@@ -1,6 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import * as _paykit_sdk_core from '@paykit-sdk/core';
4
3
  import { PayKitProvider } from '@paykit-sdk/core';
5
4
 
6
5
  interface PaykitProviderProps {
@@ -14,7 +13,12 @@ declare const usePaykitContext: () => {
14
13
 
15
14
  declare const useCustomer: () => {
16
15
  retrieve: {
17
- run: (id: string) => Promise<[data: undefined, error: Error] | [data: _paykit_sdk_core.Customer | null, error: undefined]>;
16
+ run: (id: string) => Promise<[data: undefined, error: Error] | [data: {
17
+ id: string;
18
+ email?: string | undefined;
19
+ metadata?: Record<string, string> | undefined;
20
+ name?: string | undefined;
21
+ } | null, error: undefined]>;
18
22
  loading: boolean;
19
23
  };
20
24
  create: {
@@ -22,7 +26,12 @@ declare const useCustomer: () => {
22
26
  email: string;
23
27
  metadata?: Record<string, string> | undefined;
24
28
  name?: string | undefined;
25
- }) => Promise<[data: undefined, error: Error] | [data: _paykit_sdk_core.Customer, error: undefined]>;
29
+ }) => Promise<[data: undefined, error: Error] | [data: {
30
+ id: string;
31
+ email?: string | undefined;
32
+ metadata?: Record<string, string> | undefined;
33
+ name?: string | undefined;
34
+ }, error: undefined]>;
26
35
  loading: boolean;
27
36
  };
28
37
  update: {
@@ -30,20 +39,55 @@ declare const useCustomer: () => {
30
39
  email?: string | undefined;
31
40
  metadata?: Record<string, string> | undefined;
32
41
  name?: string | undefined;
33
- }) => Promise<[data: undefined, error: Error] | [data: _paykit_sdk_core.Customer, error: undefined]>;
42
+ }) => Promise<[data: undefined, error: Error] | [data: {
43
+ id: string;
44
+ email?: string | undefined;
45
+ metadata?: Record<string, string> | undefined;
46
+ name?: string | undefined;
47
+ }, error: undefined]>;
34
48
  loading: boolean;
35
49
  };
36
50
  };
37
51
 
38
52
  declare const useSubscription: () => {
39
53
  retrieve: {
40
- run: (id: string) => Promise<[data: undefined, error: Error] | [data: _paykit_sdk_core.Subscription | null, error: undefined]>;
54
+ run: (id: string) => Promise<[data: undefined, error: Error] | [data: {
55
+ customer_id: string;
56
+ status: "active" | "past_due" | "canceled" | "expired";
57
+ item_id: string;
58
+ billing_interval: "day" | "week" | "month" | "year";
59
+ billing_interval_count: number;
60
+ id: string;
61
+ currency: string;
62
+ amount: number;
63
+ current_period_start: Date;
64
+ current_period_end: Date;
65
+ current_cycle: number;
66
+ total_cycles: number;
67
+ custom_fields: Record<string, any> | null;
68
+ metadata?: Record<string, string> | null | undefined;
69
+ } | null, error: undefined]>;
41
70
  loading: boolean;
42
71
  };
43
72
  update: {
44
73
  run: (id: string, params: {
45
74
  metadata?: Record<string, string> | undefined;
46
- }) => Promise<[data: undefined, error: Error] | [data: _paykit_sdk_core.Subscription, error: undefined]>;
75
+ }) => Promise<[data: undefined, error: Error] | [data: {
76
+ customer_id: string;
77
+ status: "active" | "past_due" | "canceled" | "expired";
78
+ item_id: string;
79
+ billing_interval: "day" | "week" | "month" | "year";
80
+ billing_interval_count: number;
81
+ id: string;
82
+ currency: string;
83
+ amount: number;
84
+ current_period_start: Date;
85
+ current_period_end: Date;
86
+ current_cycle: number;
87
+ total_cycles: number;
88
+ custom_fields: Record<string, any> | null;
89
+ metadata?: Record<string, string> | null | undefined;
90
+ }, error: undefined]>;
47
91
  loading: boolean;
48
92
  };
49
93
  cancel: {
@@ -59,12 +103,49 @@ declare const useCheckout: () => {
59
103
  metadata: Record<string, string>;
60
104
  session_type: "one_time" | "recurring";
61
105
  item_id: string;
62
- provider_metadata?: Record<string, unknown> | undefined;
63
- }) => Promise<[data: undefined, error: Error] | [data: _paykit_sdk_core.Checkout, error: undefined]>;
106
+ quantity: number;
107
+ subscription?: {
108
+ billing_interval: "day" | "week" | "month" | "year";
109
+ billing_interval_count: number;
110
+ } | undefined;
111
+ provider_metadata?: Record<string, string> | undefined;
112
+ }) => Promise<[data: undefined, error: Error] | [data: {
113
+ customer_id: string;
114
+ session_type: "one_time" | "recurring";
115
+ id: string;
116
+ payment_url: string;
117
+ products: {
118
+ quantity: number;
119
+ id: string;
120
+ }[];
121
+ currency: string;
122
+ amount: number;
123
+ metadata?: Record<string, string> | null | undefined;
124
+ subscription?: {
125
+ billing_interval: "day" | "week" | "month" | "year";
126
+ billing_interval_count: number;
127
+ } | null | undefined;
128
+ }, error: undefined]>;
64
129
  loading: boolean;
65
130
  };
66
131
  retrieve: {
67
- run: (id: string) => Promise<[data: undefined, error: Error] | [data: _paykit_sdk_core.Checkout | null, error: undefined]>;
132
+ run: (id: string) => Promise<[data: undefined, error: Error] | [data: {
133
+ customer_id: string;
134
+ session_type: "one_time" | "recurring";
135
+ id: string;
136
+ payment_url: string;
137
+ products: {
138
+ quantity: number;
139
+ id: string;
140
+ }[];
141
+ currency: string;
142
+ amount: number;
143
+ metadata?: Record<string, string> | null | undefined;
144
+ subscription?: {
145
+ billing_interval: "day" | "week" | "month" | "year";
146
+ billing_interval_count: number;
147
+ } | null | undefined;
148
+ } | null, error: undefined]>;
68
149
  loading: boolean;
69
150
  };
70
151
  };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import * as _paykit_sdk_core from '@paykit-sdk/core';
4
3
  import { PayKitProvider } from '@paykit-sdk/core';
5
4
 
6
5
  interface PaykitProviderProps {
@@ -14,7 +13,12 @@ declare const usePaykitContext: () => {
14
13
 
15
14
  declare const useCustomer: () => {
16
15
  retrieve: {
17
- run: (id: string) => Promise<[data: undefined, error: Error] | [data: _paykit_sdk_core.Customer | null, error: undefined]>;
16
+ run: (id: string) => Promise<[data: undefined, error: Error] | [data: {
17
+ id: string;
18
+ email?: string | undefined;
19
+ metadata?: Record<string, string> | undefined;
20
+ name?: string | undefined;
21
+ } | null, error: undefined]>;
18
22
  loading: boolean;
19
23
  };
20
24
  create: {
@@ -22,7 +26,12 @@ declare const useCustomer: () => {
22
26
  email: string;
23
27
  metadata?: Record<string, string> | undefined;
24
28
  name?: string | undefined;
25
- }) => Promise<[data: undefined, error: Error] | [data: _paykit_sdk_core.Customer, error: undefined]>;
29
+ }) => Promise<[data: undefined, error: Error] | [data: {
30
+ id: string;
31
+ email?: string | undefined;
32
+ metadata?: Record<string, string> | undefined;
33
+ name?: string | undefined;
34
+ }, error: undefined]>;
26
35
  loading: boolean;
27
36
  };
28
37
  update: {
@@ -30,20 +39,55 @@ declare const useCustomer: () => {
30
39
  email?: string | undefined;
31
40
  metadata?: Record<string, string> | undefined;
32
41
  name?: string | undefined;
33
- }) => Promise<[data: undefined, error: Error] | [data: _paykit_sdk_core.Customer, error: undefined]>;
42
+ }) => Promise<[data: undefined, error: Error] | [data: {
43
+ id: string;
44
+ email?: string | undefined;
45
+ metadata?: Record<string, string> | undefined;
46
+ name?: string | undefined;
47
+ }, error: undefined]>;
34
48
  loading: boolean;
35
49
  };
36
50
  };
37
51
 
38
52
  declare const useSubscription: () => {
39
53
  retrieve: {
40
- run: (id: string) => Promise<[data: undefined, error: Error] | [data: _paykit_sdk_core.Subscription | null, error: undefined]>;
54
+ run: (id: string) => Promise<[data: undefined, error: Error] | [data: {
55
+ customer_id: string;
56
+ status: "active" | "past_due" | "canceled" | "expired";
57
+ item_id: string;
58
+ billing_interval: "day" | "week" | "month" | "year";
59
+ billing_interval_count: number;
60
+ id: string;
61
+ currency: string;
62
+ amount: number;
63
+ current_period_start: Date;
64
+ current_period_end: Date;
65
+ current_cycle: number;
66
+ total_cycles: number;
67
+ custom_fields: Record<string, any> | null;
68
+ metadata?: Record<string, string> | null | undefined;
69
+ } | null, error: undefined]>;
41
70
  loading: boolean;
42
71
  };
43
72
  update: {
44
73
  run: (id: string, params: {
45
74
  metadata?: Record<string, string> | undefined;
46
- }) => Promise<[data: undefined, error: Error] | [data: _paykit_sdk_core.Subscription, error: undefined]>;
75
+ }) => Promise<[data: undefined, error: Error] | [data: {
76
+ customer_id: string;
77
+ status: "active" | "past_due" | "canceled" | "expired";
78
+ item_id: string;
79
+ billing_interval: "day" | "week" | "month" | "year";
80
+ billing_interval_count: number;
81
+ id: string;
82
+ currency: string;
83
+ amount: number;
84
+ current_period_start: Date;
85
+ current_period_end: Date;
86
+ current_cycle: number;
87
+ total_cycles: number;
88
+ custom_fields: Record<string, any> | null;
89
+ metadata?: Record<string, string> | null | undefined;
90
+ }, error: undefined]>;
47
91
  loading: boolean;
48
92
  };
49
93
  cancel: {
@@ -59,12 +103,49 @@ declare const useCheckout: () => {
59
103
  metadata: Record<string, string>;
60
104
  session_type: "one_time" | "recurring";
61
105
  item_id: string;
62
- provider_metadata?: Record<string, unknown> | undefined;
63
- }) => Promise<[data: undefined, error: Error] | [data: _paykit_sdk_core.Checkout, error: undefined]>;
106
+ quantity: number;
107
+ subscription?: {
108
+ billing_interval: "day" | "week" | "month" | "year";
109
+ billing_interval_count: number;
110
+ } | undefined;
111
+ provider_metadata?: Record<string, string> | undefined;
112
+ }) => Promise<[data: undefined, error: Error] | [data: {
113
+ customer_id: string;
114
+ session_type: "one_time" | "recurring";
115
+ id: string;
116
+ payment_url: string;
117
+ products: {
118
+ quantity: number;
119
+ id: string;
120
+ }[];
121
+ currency: string;
122
+ amount: number;
123
+ metadata?: Record<string, string> | null | undefined;
124
+ subscription?: {
125
+ billing_interval: "day" | "week" | "month" | "year";
126
+ billing_interval_count: number;
127
+ } | null | undefined;
128
+ }, error: undefined]>;
64
129
  loading: boolean;
65
130
  };
66
131
  retrieve: {
67
- run: (id: string) => Promise<[data: undefined, error: Error] | [data: _paykit_sdk_core.Checkout | null, error: undefined]>;
132
+ run: (id: string) => Promise<[data: undefined, error: Error] | [data: {
133
+ customer_id: string;
134
+ session_type: "one_time" | "recurring";
135
+ id: string;
136
+ payment_url: string;
137
+ products: {
138
+ quantity: number;
139
+ id: string;
140
+ }[];
141
+ currency: string;
142
+ amount: number;
143
+ metadata?: Record<string, string> | null | undefined;
144
+ subscription?: {
145
+ billing_interval: "day" | "week" | "month" | "year";
146
+ billing_interval_count: number;
147
+ } | null | undefined;
148
+ } | null, error: undefined]>;
68
149
  loading: boolean;
69
150
  };
70
151
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paykit-sdk/react",
3
- "version": "1.1.7",
3
+ "version": "1.1.9",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",
@@ -26,7 +26,7 @@
26
26
  "peerDependencies": {
27
27
  "react": ">=16.8.0",
28
28
  "react-dom": ">=16.8.0",
29
- "@paykit-sdk/core": ">=1.1.6"
29
+ "@paykit-sdk/core": ">=1.1.8"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@swc/core": "^1.12.9",
@@ -50,6 +50,6 @@
50
50
  "checkout"
51
51
  ],
52
52
  "author": "Emmanuel Odii",
53
- "license": "ISC",
53
+ "license": "GPL-3.0",
54
54
  "homepage": "https://usepaykit.dev"
55
55
  }