@chipi-stack/nextjs 9.0.0 → 11.0.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.
Files changed (38) hide show
  1. package/README.md +24 -140
  2. package/dist/ChipiClientProvider.d.mts +2 -2
  3. package/dist/cjs/ChipiClientProvider.d.ts +2 -2
  4. package/dist/cjs/ChipiClientProvider.js +21 -3
  5. package/dist/cjs/ChipiClientProvider.js.map +1 -1
  6. package/dist/cjs/app-router/server/ChipiProvider.js +1 -1
  7. package/dist/cjs/app-router/server/ChipiProvider.js.map +1 -1
  8. package/dist/cjs/client/ChipiProvider.d.ts +6 -12
  9. package/dist/cjs/client/ChipiProvider.js +2 -27
  10. package/dist/cjs/client/ChipiProvider.js.map +1 -1
  11. package/dist/cjs/client/index.d.ts +0 -2
  12. package/dist/cjs/client/index.js +0 -3
  13. package/dist/cjs/client/index.js.map +1 -1
  14. package/dist/cjs/hooks.d.ts +1 -1
  15. package/dist/cjs/hooks.js +0 -2
  16. package/dist/cjs/hooks.js.map +1 -1
  17. package/dist/cjs/index.d.ts +1 -1
  18. package/dist/client/ChipiProvider.d.mts +6 -12
  19. package/dist/client/index.d.mts +0 -2
  20. package/dist/esm/ChipiClientProvider.js +11 -3
  21. package/dist/esm/ChipiClientProvider.js.map +1 -1
  22. package/dist/esm/app-router/server/ChipiProvider.js +1 -1
  23. package/dist/esm/app-router/server/ChipiProvider.js.map +1 -1
  24. package/dist/esm/client/ChipiProvider.js +2 -27
  25. package/dist/esm/client/ChipiProvider.js.map +1 -1
  26. package/dist/esm/client/index.js +0 -2
  27. package/dist/esm/client/index.js.map +1 -1
  28. package/dist/esm/hooks.js +0 -2
  29. package/dist/esm/hooks.js.map +1 -1
  30. package/dist/hooks.d.mts +1 -1
  31. package/dist/index.d.mts +1 -1
  32. package/package.json +5 -5
  33. package/dist/cjs/client/ChipiClientWrapper.d.ts +0 -15
  34. package/dist/cjs/client/ChipiClientWrapper.js +0 -74
  35. package/dist/cjs/client/ChipiClientWrapper.js.map +0 -1
  36. package/dist/client/ChipiClientWrapper.d.mts +0 -15
  37. package/dist/esm/client/ChipiClientWrapper.js +0 -40
  38. package/dist/esm/client/ChipiClientWrapper.js.map +0 -1
package/README.md CHANGED
@@ -1,159 +1,43 @@
1
- # @chipi-stack/nextjs
1
+ # Chipi SDK
2
2
 
3
- Next.js SDK for Chipi Pay with server-side support.
3
+ Chipi SDK is the easiest way to integrate USDC staking and withdrawal functionality into your React/Next.js application. Add secure wallet management, token staking, and withdrawals to your application in minutes. All transactions are sponsored thanks to Avnu's paymaster.
4
4
 
5
- ## Installation
6
-
7
- ```bash
8
- npm install @chipi-stack/nextjs
9
- ```
10
-
11
- ## Usage
5
+ ## Prerequisites
12
6
 
13
- ### 1. Set up the Provider
14
-
15
- In your `app/layout.tsx`:
16
-
17
- ```tsx
18
- import { ChipiProvider } from '@chipi-stack/nextjs';
19
-
20
- export default function RootLayout({
21
- children,
22
- }: {
23
- children: React.ReactNode;
24
- }) {
25
- return (
26
- <html lang="en">
27
- <body>
28
- <ChipiProvider>
29
- {children}
30
- </ChipiProvider>
31
- </body>
32
- </html>
33
- );
34
- }
35
- ```
7
+ - React 18 or later
8
+ - Node.js >=18.17.0 or later
9
+ - A Chipi account. [Create your account for free](https://dashboard.chipipay.com)
36
10
 
37
- ### 2. Environment Variables
11
+ ## Installation
38
12
 
39
- Create a `.env.local` file:
13
+ The fastest way to get started with Chipi SDK is by following our [Quickstart Guide](https://docs.chipipay.com/gasless/quickstart).
40
14
 
41
15
  ```bash
42
- # Required: Public API key (exposed to client)
43
- NEXT_PUBLIC_CHIPI_API_KEY=your_public_api_key
44
-
45
- # Required: Secret key (server-side only, never exposed to client)
46
- CHIPI_SECRET_KEY=your_secret_key
47
- ```
48
-
49
- ### 3. Client-side Usage (Components and Hooks)
50
-
51
- ```tsx
52
- 'use client';
53
-
54
- import { useCreateWallet, useWallets } from '@chipi-stack/nextjs';
55
-
56
- export function WalletManager() {
57
- const { createWallet, isLoading } = useCreateWallet();
58
- const { data: wallets } = useWallets();
59
-
60
- const handleCreateWallet = () => {
61
- createWallet({
62
- encryptKey: 'your-encrypt-key',
63
- bearerToken: 'your-bearer-token'
64
- });
65
- };
66
-
67
- return (
68
- <div>
69
- <button onClick={handleCreateWallet} disabled={isLoading}>
70
- Create Wallet
71
- </button>
72
-
73
- {wallets?.map(wallet => (
74
- <div key={wallet.id}>{wallet.address}</div>
75
- ))}
76
- </div>
77
- );
78
- }
79
- ```
80
-
81
- ### 4. Server-side Usage (API Routes, Server Components)
82
-
83
- ```tsx
84
- // In API routes or Server Components
85
- import { getChipiServer } from '@chipi-stack/nextjs/server';
86
-
87
- export async function GET() {
88
- const chipiServer = getChipiServer();
89
-
90
- try {
91
- const wallets = await chipiServer.getWallets();
92
- return Response.json({ wallets });
93
- } catch (error) {
94
- return Response.json({ error: 'Failed to fetch wallets' }, { status: 500 });
95
- }
96
- }
97
- ```
98
-
99
- ## Key Features
100
-
101
- - **Automatic Environment Variable Configuration**: Reads from `NEXT_PUBLIC_CHIPI_API_KEY` and `CHIPI_SECRET_KEY`
102
- - **Server/Client Separation**: Server utilities from `/server`, client hooks from main package
103
- - **App Router Support**: Optimized for Next.js 13+ App Router
104
- - **Type Safety**: Full TypeScript support with proper types
105
- - **React Query Integration**: Built-in caching and state management
106
-
107
- ## Import Patterns
108
-
109
- ```tsx
110
- // ✅ Client-side (components, hooks)
111
- import { ChipiProvider, useCreateWallet, useWallets } from '@chipi-stack/nextjs';
112
-
113
- // ✅ Server-side (API routes, Server Components)
114
- import { getChipiServer, createChipiServer } from '@chipi-stack/nextjs/server';
115
-
116
- // ✅ Types
117
- import type { ChipiServerConfig } from '@chipi-stack/nextjs/server';
16
+ npm install @chipi-stack/nextjs
17
+ # or
18
+ yarn add @chipi-stack/nextjs
118
19
  ```
119
20
 
120
- ## Error Handling
21
+ ## Usage
121
22
 
122
- The provider will throw helpful errors if environment variables are missing:
23
+ For detailed information, guides, and examples visit our [documentation](https://docs.chipipay.com).
123
24
 
124
- - Missing `NEXT_PUBLIC_CHIPI_API_KEY`: Throws error on both client and server
125
- - Missing `CHIPI_SECRET_KEY`: Throws error on server-side initialization
25
+ ## Support
126
26
 
127
- ## Advanced Usage
27
+ You can get in touch with us in any of the following ways:
128
28
 
129
- ### Custom Client Provider
29
+ - Join our [Telegram community](https://t.me/chipi_pay)
30
+ - Visit our [YouTube channel](https://www.youtube.com/@chipipay) for tutorials
31
+ - Email us at support@chipi.com
130
32
 
131
- ```tsx
132
- 'use client';
33
+ ## Contributing
133
34
 
134
- import { ChipiClientProvider } from '@chipi-stack/nextjs';
35
+ We're open to all community contributions! If you'd like to contribute in any way, please read our contribution guidelines and code of conduct.
135
36
 
136
- export function CustomProvider({ children }: { children: React.ReactNode }) {
137
- return (
138
- <ChipiClientProvider
139
- apiPublicKey="custom-key"
140
- environment="production"
141
- >
142
- {children}
143
- </ChipiClientProvider>
144
- );
145
- }
146
- ```
37
+ ## Security
147
38
 
148
- ### Server SDK Configuration
39
+ @chipi-stack/nextjs follows best practices for security, but 100% security cannot be assured.
149
40
 
150
- ```tsx
151
- import { createChipiServer } from '@chipi-stack/nextjs/server';
41
+ @chipi-stack/nextjs is provided "as is" without any warranty. Use at your own risk.
152
42
 
153
- // Initialize with custom config
154
- createChipiServer({
155
- secretKey: 'your-secret-key',
156
- apiPublicKey: 'your-public-key',
157
- environment: 'production'
158
- });
159
- ```
43
+ For more information and to report security issues, please refer to our [security documentation](https://docs.chipipay.com).
@@ -4,12 +4,12 @@ import React from 'react';
4
4
  interface ChipiClientProviderProps {
5
5
  children: React.ReactNode;
6
6
  apiPublicKey: string;
7
- environment: 'development' | 'production';
7
+ environment?: "development" | "production";
8
8
  }
9
9
  /**
10
10
  * Pure client component that handles all React hook imports
11
11
  * This component is marked with 'use client' to avoid server-side issues
12
12
  */
13
- declare function ChipiClientProvider({ children, apiPublicKey, environment }: ChipiClientProviderProps): react_jsx_runtime.JSX.Element;
13
+ declare function ChipiClientProvider({ children, apiPublicKey, environment, }: ChipiClientProviderProps): react_jsx_runtime.JSX.Element;
14
14
 
15
15
  export { ChipiClientProvider };
@@ -4,12 +4,12 @@ import React from 'react';
4
4
  interface ChipiClientProviderProps {
5
5
  children: React.ReactNode;
6
6
  apiPublicKey: string;
7
- environment: 'development' | 'production';
7
+ environment?: "development" | "production";
8
8
  }
9
9
  /**
10
10
  * Pure client component that handles all React hook imports
11
11
  * This component is marked with 'use client' to avoid server-side issues
12
12
  */
13
- declare function ChipiClientProvider({ children, apiPublicKey, environment }: ChipiClientProviderProps): react_jsx_runtime.JSX.Element;
13
+ declare function ChipiClientProvider({ children, apiPublicKey, environment, }: ChipiClientProviderProps): react_jsx_runtime.JSX.Element;
14
14
 
15
15
  export { ChipiClientProvider };
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  "use client";
3
+ var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
10
  for (var name in all)
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
16
18
  }
17
19
  return to;
18
20
  };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
19
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
30
  var ChipiClientProvider_exports = {};
21
31
  __export(ChipiClientProvider_exports, {
@@ -23,13 +33,21 @@ __export(ChipiClientProvider_exports, {
23
33
  });
24
34
  module.exports = __toCommonJS(ChipiClientProvider_exports);
25
35
  var import_jsx_runtime = require("react/jsx-runtime");
26
- var import_ChipiClientWrapper = require("./client/ChipiClientWrapper");
36
+ var import_react = __toESM(require("react"));
37
+ var import_chipi_react = require("@chipi-stack/chipi-react");
27
38
  function ChipiClientProvider({
28
39
  children,
29
40
  apiPublicKey,
30
- environment
41
+ environment = "production"
31
42
  }) {
32
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ChipiClientWrapper.ChipiClientWrapper, { apiPublicKey, environment, children });
43
+ const config = import_react.default.useMemo(
44
+ () => ({
45
+ apiPublicKey,
46
+ environment
47
+ }),
48
+ [apiPublicKey, environment]
49
+ );
50
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_chipi_react.ChipiProvider, { config, children });
33
51
  }
34
52
  // Annotate the CommonJS export names for ESM import in node:
35
53
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ChipiClientProvider.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { ChipiClientWrapper } from './client/ChipiClientWrapper';\n\ninterface ChipiClientProviderProps {\n children: React.ReactNode;\n apiPublicKey: string;\n environment: 'development' | 'production';\n}\n\n/**\n * Pure client component that handles all React hook imports\n * This component is marked with 'use client' to avoid server-side issues\n */\nexport function ChipiClientProvider({ \n children, \n apiPublicKey, \n environment \n}: ChipiClientProviderProps) {\n return (\n <ChipiClientWrapper apiPublicKey={apiPublicKey} environment={environment}>\n {children}\n </ChipiClientWrapper>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAqBI;AAlBJ,gCAAmC;AAY5B,SAAS,oBAAoB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AACF,GAA6B;AAC3B,SACE,4CAAC,gDAAmB,cAA4B,aAC7C,UACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/ChipiClientProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\nimport { ChipiProvider } from \"@chipi-stack/chipi-react\";\nimport type { ChipiSDKConfig } from \"@chipi-stack/types\";\n\ninterface ChipiClientProviderProps {\n children: React.ReactNode;\n apiPublicKey: string;\n environment?: \"development\" | \"production\";\n}\n\n/**\n * Pure client component that handles all React hook imports\n * This component is marked with 'use client' to avoid server-side issues\n */\nexport function ChipiClientProvider({\n children,\n apiPublicKey,\n environment = \"production\",\n}: ChipiClientProviderProps) {\n // Create config\n const config = React.useMemo(\n (): ChipiSDKConfig => ({\n apiPublicKey,\n environment,\n }),\n [apiPublicKey, environment]\n );\n\n return <ChipiProvider config={config}>{children}</ChipiProvider>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA8BS;AA5BT,mBAAkB;AAClB,yBAA8B;AAavB,SAAS,oBAAoB;AAAA,EAClC;AAAA,EACA;AAAA,EACA,cAAc;AAChB,GAA6B;AAE3B,QAAM,SAAS,aAAAA,QAAM;AAAA,IACnB,OAAuB;AAAA,MACrB;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,cAAc,WAAW;AAAA,EAC5B;AAEA,SAAO,4CAAC,oCAAc,QAAiB,UAAS;AAClD;","names":["React"]}
@@ -35,7 +35,7 @@ async function ChipiProvider({ children }) {
35
35
  if (process.env.NEXT_PUBLIC_CHIPI_ENV === "development") {
36
36
  environment = "development";
37
37
  }
38
- console.log("environment", environment);
38
+ console.log("environment?", environment);
39
39
  if (!apiPublicKey) {
40
40
  throw new Error(
41
41
  " NEXT_PUBLIC_CHIPI_API_KEY environment variable. Please add it to your .env file."
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/app-router/server/ChipiProvider.tsx"],"sourcesContent":["import React from \"react\";\nimport { createChipiServer } from \"../../server/createChipiServer\";\nimport { ChipiProvider as ChipiClientProvider } from \"../client/ChipiProvider\";\n\nexport interface ChipiProviderProps {\n children: React.ReactNode;\n}\n\n/**\n * Server-side Chipi Provider for Next.js App Router\n *\n * This is the server component version that runs during SSR.\n * It initializes the server SDK and passes configuration to the client provider.\n */\nexport async function ChipiProvider({ children }: ChipiProviderProps) {\n // Read environment variables on the server\n const apiPublicKey = process.env.NEXT_PUBLIC_CHIPI_API_KEY;\n const secretKey = process.env.CHIPI_SECRET_KEY;\n let environment = \"production\" as \"production\" | \"development\";\n console.log(\n \"process.env.NEXT_PUBLIC_CHIPI_ENV\",\n process.env.NEXT_PUBLIC_CHIPI_ENV\n );\n if (process.env.NEXT_PUBLIC_CHIPI_ENV === \"development\") {\n environment = \"development\";\n }\n\n console.log(\"environment\", environment);\n // Validate required environment variables\n if (!apiPublicKey) {\n throw new Error(\n \" NEXT_PUBLIC_CHIPI_API_KEY environment variable. Please add it to your .env file.\"\n );\n }\n\n if (!secretKey) {\n throw new Error(\n \"Missing CHIPI_SECRET_KEY environment variable. Server-side features will not work properly.\"\n );\n }\n\n // Initialize server SDK (this runs on server only)\n createChipiServer({\n secretKey,\n apiPublicKey,\n environment,\n debug: environment === \"development\",\n });\n\n // Return the client provider which will hydrate on the client\n // Note: This works because ChipiClientProvider is marked with 'use client'\n return (\n <ChipiClientProvider apiPublicKey={apiPublicKey} environment={environment}>\n {children}\n </ChipiClientProvider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoDI;AAnDJ,+BAAkC;AAClC,2BAAqD;AAYrD,eAAsB,cAAc,EAAE,SAAS,GAAuB;AAEpE,QAAM,eAAe,QAAQ,IAAI;AACjC,QAAM,YAAY,QAAQ,IAAI;AAC9B,MAAI,cAAc;AAClB,UAAQ;AAAA,IACN;AAAA,IACA,QAAQ,IAAI;AAAA,EACd;AACA,MAAI,QAAQ,IAAI,0BAA0B,eAAe;AACvD,kBAAc;AAAA,EAChB;AAEA,UAAQ,IAAI,eAAe,WAAW;AAEtC,MAAI,CAAC,cAAc;AACjB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AACd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAGA,kDAAkB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,gBAAgB;AAAA,EACzB,CAAC;AAID,SACE,4CAAC,qBAAAA,eAAA,EAAoB,cAA4B,aAC9C,UACH;AAEJ;","names":["ChipiClientProvider"]}
1
+ {"version":3,"sources":["../../../../src/app-router/server/ChipiProvider.tsx"],"sourcesContent":["import React from \"react\";\nimport { createChipiServer } from \"../../server/createChipiServer\";\nimport { ChipiProvider as ChipiClientProvider } from \"../client/ChipiProvider\";\n\nexport interface ChipiProviderProps {\n children: React.ReactNode;\n}\n\n/**\n * Server-side Chipi Provider for Next.js App Router\n *\n * This is the server component version that runs during SSR.\n * It initializes the server SDK and passes configuration to the client provider.\n */\nexport async function ChipiProvider({ children }: ChipiProviderProps) {\n // Read environment variables on the server\n const apiPublicKey = process.env.NEXT_PUBLIC_CHIPI_API_KEY;\n const secretKey = process.env.CHIPI_SECRET_KEY;\n let environment = \"production\" as \"production\" | \"development\";\n console.log(\n \"process.env.NEXT_PUBLIC_CHIPI_ENV\",\n process.env.NEXT_PUBLIC_CHIPI_ENV\n );\n if (process.env.NEXT_PUBLIC_CHIPI_ENV === \"development\") {\n environment = \"development\";\n }\n\n console.log(\"environment?\", environment);\n // Validate required environment variables\n if (!apiPublicKey) {\n throw new Error(\n \" NEXT_PUBLIC_CHIPI_API_KEY environment variable. Please add it to your .env file.\"\n );\n }\n\n if (!secretKey) {\n throw new Error(\n \"Missing CHIPI_SECRET_KEY environment variable. Server-side features will not work properly.\"\n );\n }\n\n // Initialize server SDK (this runs on server only)\n createChipiServer({\n secretKey,\n apiPublicKey,\n environment,\n debug: environment === \"development\",\n });\n\n // Return the client provider which will hydrate on the client\n // Note: This works because ChipiClientProvider is marked with 'use client'\n return (\n <ChipiClientProvider apiPublicKey={apiPublicKey} environment={environment}>\n {children}\n </ChipiClientProvider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoDI;AAnDJ,+BAAkC;AAClC,2BAAqD;AAYrD,eAAsB,cAAc,EAAE,SAAS,GAAuB;AAEpE,QAAM,eAAe,QAAQ,IAAI;AACjC,QAAM,YAAY,QAAQ,IAAI;AAC9B,MAAI,cAAc;AAClB,UAAQ;AAAA,IACN;AAAA,IACA,QAAQ,IAAI;AAAA,EACd;AACA,MAAI,QAAQ,IAAI,0BAA0B,eAAe;AACvD,kBAAc;AAAA,EAChB;AAEA,UAAQ,IAAI,gBAAgB,WAAW;AAEvC,MAAI,CAAC,cAAc;AACjB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AACd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAGA,kDAAkB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,gBAAgB;AAAA,EACzB,CAAC;AAID,SACE,4CAAC,qBAAAA,eAAA,EAAoB,cAA4B,aAC9C,UACH;AAEJ;","names":["ChipiClientProvider"]}
@@ -1,6 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React from 'react';
3
- import { QueryClient } from '@tanstack/react-query';
4
3
  import { ChipiSDKConfig } from '@chipi-stack/types';
5
4
 
6
5
  interface ChipiProviderProps {
@@ -9,17 +8,12 @@ interface ChipiProviderProps {
9
8
  * Configuration for the Chipi SDK
10
9
  */
11
10
  config?: Partial<ChipiSDKConfig>;
12
- /**
13
- * Custom QueryClient instance for React Query
14
- * If not provided, a default one will be created
15
- */
16
- queryClient?: QueryClient;
17
11
  }
18
12
  /**
19
13
  * Client-side Chipi Provider for Next.js applications
20
14
  *
21
- * This provider wraps the base ChipiProvider with React Query
22
- * and provides Next.js-specific optimizations.
15
+ * This provider wraps the base ChipiProvider and provides Next.js-specific
16
+ * optimizations like automatic environment variable configuration.
23
17
  *
24
18
  * Note: For most use cases, use the main ChipiProvider from '@chipi-stack/nextjs'
25
19
  * instead of this client-only provider.
@@ -29,22 +23,22 @@ interface ChipiProviderProps {
29
23
  * // Advanced usage - client-only provider
30
24
  * 'use client';
31
25
  *
32
- * import { ChipiClientProvider } from '@chipi-stack/nextjs';
26
+ * import { ChipiProvider } from '@chipi-stack/nextjs/client';
33
27
  *
34
28
  * export function ClientProviders({ children }: { children: React.ReactNode }) {
35
29
  * return (
36
- * <ChipiClientProvider
30
+ * <ChipiProvider
37
31
  * config={{
38
32
  * apiPublicKey: process.env.NEXT_PUBLIC_CHIPI_API_KEY!,
39
33
  * environment: 'production'
40
34
  * }}
41
35
  * >
42
36
  * {children}
43
- * </ChipiClientProvider>
37
+ * </ChipiProvider>
44
38
  * );
45
39
  * }
46
40
  * ```
47
41
  */
48
- declare function ChipiProvider({ children, config: userConfig, queryClient }: ChipiProviderProps): react_jsx_runtime.JSX.Element;
42
+ declare function ChipiProvider({ children, config: userConfig, }: ChipiProviderProps): react_jsx_runtime.JSX.Element;
49
43
 
50
44
  export { ChipiProvider, type ChipiProviderProps };
@@ -34,31 +34,10 @@ __export(ChipiProvider_exports, {
34
34
  module.exports = __toCommonJS(ChipiProvider_exports);
35
35
  var import_jsx_runtime = require("react/jsx-runtime");
36
36
  var import_react = __toESM(require("react"));
37
- var import_react_query = require("@tanstack/react-query");
38
37
  var import_chipi_react = require("@chipi-stack/chipi-react");
39
- const createDefaultQueryClient = () => new import_react_query.QueryClient({
40
- defaultOptions: {
41
- queries: {
42
- staleTime: 60 * 1e3,
43
- // 1 minute
44
- gcTime: 10 * 60 * 1e3,
45
- // 10 minutes (formerly cacheTime)
46
- retry: (failureCount, error) => {
47
- if (error?.status >= 400 && error?.status < 500) {
48
- return false;
49
- }
50
- return failureCount < 3;
51
- }
52
- },
53
- mutations: {
54
- retry: false
55
- }
56
- }
57
- });
58
38
  function ChipiProvider({
59
39
  children,
60
- config: userConfig,
61
- queryClient
40
+ config: userConfig
62
41
  }) {
63
42
  const config = import_react.default.useMemo(() => {
64
43
  const envConfig = {
@@ -67,16 +46,12 @@ function ChipiProvider({
67
46
  };
68
47
  return { ...envConfig, ...userConfig };
69
48
  }, [userConfig]);
70
- const client = import_react.default.useMemo(
71
- () => queryClient || createDefaultQueryClient(),
72
- [queryClient]
73
- );
74
49
  if (!config.apiPublicKey) {
75
50
  throw new Error(
76
51
  "Missing NEXT_PUBLIC_CHIPI_API_KEY environment variable. Please add it to your .env.local file."
77
52
  );
78
53
  }
79
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_query.QueryClientProvider, { client, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_chipi_react.ChipiProvider, { config, children }) });
54
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_chipi_react.ChipiProvider, { config, children });
80
55
  }
81
56
  // Annotate the CommonJS export names for ESM import in node:
82
57
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/ChipiProvider.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { ChipiProvider as BaseChipiProvider } from '@chipi-stack/chipi-react';\nimport type { ChipiSDKConfig } from '@chipi-stack/types';\n\nexport interface ChipiProviderProps {\n children: React.ReactNode;\n /**\n * Configuration for the Chipi SDK\n */\n config?: Partial<ChipiSDKConfig>;\n /**\n * Custom QueryClient instance for React Query\n * If not provided, a default one will be created\n */\n queryClient?: QueryClient;\n}\n\n// Default QueryClient configuration\nconst createDefaultQueryClient = () =>\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 60 * 1000, // 1 minute\n gcTime: 10 * 60 * 1000, // 10 minutes (formerly cacheTime)\n retry: (failureCount, error: any) => {\n // Don't retry on 4xx errors\n if (error?.status >= 400 && error?.status < 500) {\n return false;\n }\n return failureCount < 3;\n },\n },\n mutations: {\n retry: false,\n },\n },\n });\n\n/**\n * Client-side Chipi Provider for Next.js applications\n * \n * This provider wraps the base ChipiProvider with React Query\n * and provides Next.js-specific optimizations.\n * \n * Note: For most use cases, use the main ChipiProvider from '@chipi-stack/nextjs'\n * instead of this client-only provider.\n * \n * @example\n * ```tsx\n * // Advanced usage - client-only provider\n * 'use client';\n * \n * import { ChipiClientProvider } from '@chipi-stack/nextjs';\n * \n * export function ClientProviders({ children }: { children: React.ReactNode }) {\n * return (\n * <ChipiClientProvider \n * config={{ \n * apiPublicKey: process.env.NEXT_PUBLIC_CHIPI_API_KEY!,\n * environment: 'production'\n * }}\n * >\n * {children}\n * </ChipiClientProvider>\n * );\n * }\n * ```\n */\nexport function ChipiProvider({ \n children, \n config: userConfig,\n queryClient \n}: ChipiProviderProps) {\n // Automatically get configuration from environment variables\n // Siento que esta madre no se usa\n const config = React.useMemo(() => {\n const envConfig: ChipiSDKConfig = {\n apiPublicKey: process.env.NEXT_PUBLIC_CHIPI_API_KEY!,\n environment: (process.env.NEXT_PUBLIC_CHIPI_ENV === 'development' ? 'development' : 'production') as 'development' | 'production',\n };\n \n // Merge with user-provided config\n return { ...envConfig, ...userConfig };\n }, [userConfig]);\n\n // Create or use provided QueryClient\n const client = React.useMemo(\n () => queryClient || createDefaultQueryClient(),\n [queryClient]\n );\n\n // Validate required configuration\n if (!config.apiPublicKey) {\n throw new Error(\n 'Missing NEXT_PUBLIC_CHIPI_API_KEY environment variable. Please add it to your .env.local file.'\n );\n }\n\n return (\n <QueryClientProvider client={client}>\n <BaseChipiProvider config={config}>\n {children}\n </BaseChipiProvider>\n </QueryClientProvider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAuGM;AArGN,mBAAkB;AAClB,yBAAiD;AACjD,yBAAmD;AAiBnD,MAAM,2BAA2B,MAC/B,IAAI,+BAAY;AAAA,EACd,gBAAgB;AAAA,IACd,SAAS;AAAA,MACP,WAAW,KAAK;AAAA;AAAA,MAChB,QAAQ,KAAK,KAAK;AAAA;AAAA,MAClB,OAAO,CAAC,cAAc,UAAe;AAEnC,YAAI,OAAO,UAAU,OAAO,OAAO,SAAS,KAAK;AAC/C,iBAAO;AAAA,QACT;AACA,eAAO,eAAe;AAAA,MACxB;AAAA,IACF;AAAA,IACA,WAAW;AAAA,MACT,OAAO;AAAA,IACT;AAAA,EACF;AACF,CAAC;AAgCI,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA,QAAQ;AAAA,EACR;AACF,GAAuB;AAGrB,QAAM,SAAS,aAAAA,QAAM,QAAQ,MAAM;AACjC,UAAM,YAA4B;AAAA,MAChC,cAAc,QAAQ,IAAI;AAAA,MAC1B,aAAc,QAAQ,IAAI,0BAA0B,gBAAgB,gBAAgB;AAAA,IACtF;AAGA,WAAO,EAAE,GAAG,WAAW,GAAG,WAAW;AAAA,EACvC,GAAG,CAAC,UAAU,CAAC;AAGf,QAAM,SAAS,aAAAA,QAAM;AAAA,IACnB,MAAM,eAAe,yBAAyB;AAAA,IAC9C,CAAC,WAAW;AAAA,EACd;AAGA,MAAI,CAAC,OAAO,cAAc;AACxB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SACE,4CAAC,0CAAoB,QACnB,sDAAC,mBAAAC,eAAA,EAAkB,QAChB,UACH,GACF;AAEJ;","names":["React","BaseChipiProvider"]}
1
+ {"version":3,"sources":["../../../src/client/ChipiProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\nimport { ChipiProvider as BaseChipiProvider } from \"@chipi-stack/chipi-react\";\nimport type { ChipiSDKConfig } from \"@chipi-stack/types\";\n\nexport interface ChipiProviderProps {\n children: React.ReactNode;\n /**\n * Configuration for the Chipi SDK\n */\n config?: Partial<ChipiSDKConfig>;\n}\n\n/**\n * Client-side Chipi Provider for Next.js applications\n *\n * This provider wraps the base ChipiProvider and provides Next.js-specific\n * optimizations like automatic environment variable configuration.\n *\n * Note: For most use cases, use the main ChipiProvider from '@chipi-stack/nextjs'\n * instead of this client-only provider.\n *\n * @example\n * ```tsx\n * // Advanced usage - client-only provider\n * 'use client';\n *\n * import { ChipiProvider } from '@chipi-stack/nextjs/client';\n *\n * export function ClientProviders({ children }: { children: React.ReactNode }) {\n * return (\n * <ChipiProvider\n * config={{\n * apiPublicKey: process.env.NEXT_PUBLIC_CHIPI_API_KEY!,\n * environment: 'production'\n * }}\n * >\n * {children}\n * </ChipiProvider>\n * );\n * }\n * ```\n */\nexport function ChipiProvider({\n children,\n config: userConfig,\n}: ChipiProviderProps) {\n // Automatically get configuration from environment variables\n // Siento que esta madre no se usa\n const config = React.useMemo(() => {\n const envConfig: ChipiSDKConfig = {\n apiPublicKey: process.env.NEXT_PUBLIC_CHIPI_API_KEY!,\n environment: (process.env.NEXT_PUBLIC_CHIPI_ENV === \"development\"\n ? \"development\"\n : \"production\") as \"development\" | \"production\",\n };\n\n // Merge with user-provided config\n return { ...envConfig, ...userConfig };\n }, [userConfig]);\n\n // Validate required configuration\n if (!config.apiPublicKey) {\n throw new Error(\n \"Missing NEXT_PUBLIC_CHIPI_API_KEY environment variable. Please add it to your .env.local file.\"\n );\n }\n\n return <BaseChipiProvider config={config}>{children}</BaseChipiProvider>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAqES;AAnET,mBAAkB;AAClB,yBAAmD;AAyC5C,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA,QAAQ;AACV,GAAuB;AAGrB,QAAM,SAAS,aAAAA,QAAM,QAAQ,MAAM;AACjC,UAAM,YAA4B;AAAA,MAChC,cAAc,QAAQ,IAAI;AAAA,MAC1B,aAAc,QAAQ,IAAI,0BAA0B,gBAChD,gBACA;AAAA,IACN;AAGA,WAAO,EAAE,GAAG,WAAW,GAAG,WAAW;AAAA,EACvC,GAAG,CAAC,UAAU,CAAC;AAGf,MAAI,CAAC,OAAO,cAAc;AACxB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,4CAAC,mBAAAC,eAAA,EAAkB,QAAiB,UAAS;AACtD;","names":["React","BaseChipiProvider"]}
@@ -1,6 +1,4 @@
1
1
  export { ChipiProvider, ChipiProviderProps } from './ChipiProvider.js';
2
- export { ChipiClientWrapper } from './ChipiClientWrapper.js';
3
2
  import 'react/jsx-runtime';
4
3
  import 'react';
5
- import '@tanstack/react-query';
6
4
  import '@chipi-stack/types';
@@ -18,15 +18,12 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var client_exports = {};
20
20
  __export(client_exports, {
21
- ChipiClientWrapper: () => import_ChipiClientWrapper.ChipiClientWrapper,
22
21
  ChipiProvider: () => import_ChipiProvider.ChipiProvider
23
22
  });
24
23
  module.exports = __toCommonJS(client_exports);
25
24
  var import_ChipiProvider = require("./ChipiProvider");
26
- var import_ChipiClientWrapper = require("./ChipiClientWrapper");
27
25
  // Annotate the CommonJS export names for ESM import in node:
28
26
  0 && (module.exports = {
29
- ChipiClientWrapper,
30
27
  ChipiProvider
31
28
  });
32
29
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/index.ts"],"sourcesContent":["// Client-side exports\nexport { ChipiProvider } from './ChipiProvider';\nexport { ChipiClientWrapper } from './ChipiClientWrapper';\nexport type { ChipiProviderProps } from './ChipiProvider';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,2BAA8B;AAC9B,gCAAmC;","names":[]}
1
+ {"version":3,"sources":["../../../src/client/index.ts"],"sourcesContent":["// Client-side exports\nexport { ChipiProvider } from \"./ChipiProvider\";\nexport type { ChipiProviderProps } from \"./ChipiProvider\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,2BAA8B;","names":[]}
@@ -1 +1 @@
1
- export { useApprove, useCallAnyContract, useChipiContext, useCreateWallet, useExecuteTransaction, useGetWallet, useRecordSendTransaction, useStakeVesuUsdc, useTransfer, useWithdrawVesuUsdc } from '@chipi-stack/chipi-react';
1
+ export { useApprove, useCallAnyContract, useChipiContext, useCreateWallet, useGetWallet, useRecordSendTransaction, useStakeVesuUsdc, useTransfer, useWithdrawVesuUsdc } from '@chipi-stack/chipi-react';
package/dist/cjs/hooks.js CHANGED
@@ -23,7 +23,6 @@ __export(hooks_exports, {
23
23
  useCallAnyContract: () => import_chipi_react.useCallAnyContract,
24
24
  useChipiContext: () => import_chipi_react.useChipiContext,
25
25
  useCreateWallet: () => import_chipi_react.useCreateWallet,
26
- useExecuteTransaction: () => import_chipi_react.useExecuteTransaction,
27
26
  useGetWallet: () => import_chipi_react.useGetWallet,
28
27
  useRecordSendTransaction: () => import_chipi_react.useRecordSendTransaction,
29
28
  useStakeVesuUsdc: () => import_chipi_react.useStakeVesuUsdc,
@@ -38,7 +37,6 @@ var import_chipi_react = require("@chipi-stack/chipi-react");
38
37
  useCallAnyContract,
39
38
  useChipiContext,
40
39
  useCreateWallet,
41
- useExecuteTransaction,
42
40
  useGetWallet,
43
41
  useRecordSendTransaction,
44
42
  useStakeVesuUsdc,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks.ts"],"sourcesContent":["\"use client\";\n\n// Client-side hooks for Next.js Chipi SDK\n// These are re-exported from @chipi-stack/chipi-react for convenience\n// This file is marked as 'use client' to ensure it only runs on the client\n\nexport {\n // Context hook\n useChipiContext,\n\n // Wallet hooks\n useCreateWallet,\n useGetWallet,\n\n // Transaction hooks\n useApprove,\n useTransfer,\n useExecuteTransaction,\n\n // SKU hooks\n\n // Specialized transaction hooks\n useStakeVesuUsdc,\n useWithdrawVesuUsdc,\n useCallAnyContract,\n\n // Record send transaction hook\n useRecordSendTransaction,\n} from \"@chipi-stack/chipi-react\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,yBAsBO;","names":[]}
1
+ {"version":3,"sources":["../../src/hooks.ts"],"sourcesContent":["\"use client\";\n\n// Client-side hooks for Next.js Chipi SDK\n// These are re-exported from @chipi-stack/chipi-react for convenience\n// This file is marked as 'use client' to ensure it only runs on the client\n\nexport {\n // Context hook\n useChipiContext,\n\n // Wallet hooks\n useCreateWallet,\n useGetWallet,\n\n // Transaction hooks\n useApprove,\n useTransfer,\n\n // SKU hooks\n\n // Specialized transaction hooks\n useStakeVesuUsdc,\n useWithdrawVesuUsdc,\n useCallAnyContract,\n\n // Record send transaction hook\n useRecordSendTransaction,\n} from \"@chipi-stack/chipi-react\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,yBAqBO;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import { ServerComponentsServerModuleTypes } from './components.server.js';
2
2
  export { ChipiProvider as ChipiClientProvider } from './app-router/client/ChipiProvider.js';
3
- export { useApprove, useCallAnyContract, useChipiContext, useCreateWallet, useExecuteTransaction, useGetWallet, useRecordSendTransaction, useStakeVesuUsdc, useTransfer, useWithdrawVesuUsdc } from '@chipi-stack/chipi-react';
3
+ export { useApprove, useCallAnyContract, useChipiContext, useCreateWallet, useGetWallet, useRecordSendTransaction, useStakeVesuUsdc, useTransfer, useWithdrawVesuUsdc } from '@chipi-stack/chipi-react';
4
4
  export * from '@chipi-stack/types';
5
5
  import './app-router/server/ChipiProvider.js';
6
6
  import 'react/jsx-runtime';
@@ -1,6 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React from 'react';
3
- import { QueryClient } from '@tanstack/react-query';
4
3
  import { ChipiSDKConfig } from '@chipi-stack/types';
5
4
 
6
5
  interface ChipiProviderProps {
@@ -9,17 +8,12 @@ interface ChipiProviderProps {
9
8
  * Configuration for the Chipi SDK
10
9
  */
11
10
  config?: Partial<ChipiSDKConfig>;
12
- /**
13
- * Custom QueryClient instance for React Query
14
- * If not provided, a default one will be created
15
- */
16
- queryClient?: QueryClient;
17
11
  }
18
12
  /**
19
13
  * Client-side Chipi Provider for Next.js applications
20
14
  *
21
- * This provider wraps the base ChipiProvider with React Query
22
- * and provides Next.js-specific optimizations.
15
+ * This provider wraps the base ChipiProvider and provides Next.js-specific
16
+ * optimizations like automatic environment variable configuration.
23
17
  *
24
18
  * Note: For most use cases, use the main ChipiProvider from '@chipi-stack/nextjs'
25
19
  * instead of this client-only provider.
@@ -29,22 +23,22 @@ interface ChipiProviderProps {
29
23
  * // Advanced usage - client-only provider
30
24
  * 'use client';
31
25
  *
32
- * import { ChipiClientProvider } from '@chipi-stack/nextjs';
26
+ * import { ChipiProvider } from '@chipi-stack/nextjs/client';
33
27
  *
34
28
  * export function ClientProviders({ children }: { children: React.ReactNode }) {
35
29
  * return (
36
- * <ChipiClientProvider
30
+ * <ChipiProvider
37
31
  * config={{
38
32
  * apiPublicKey: process.env.NEXT_PUBLIC_CHIPI_API_KEY!,
39
33
  * environment: 'production'
40
34
  * }}
41
35
  * >
42
36
  * {children}
43
- * </ChipiClientProvider>
37
+ * </ChipiProvider>
44
38
  * );
45
39
  * }
46
40
  * ```
47
41
  */
48
- declare function ChipiProvider({ children, config: userConfig, queryClient }: ChipiProviderProps): react_jsx_runtime.JSX.Element;
42
+ declare function ChipiProvider({ children, config: userConfig, }: ChipiProviderProps): react_jsx_runtime.JSX.Element;
49
43
 
50
44
  export { ChipiProvider, type ChipiProviderProps };
@@ -1,6 +1,4 @@
1
1
  export { ChipiProvider, ChipiProviderProps } from './ChipiProvider.mjs';
2
- export { ChipiClientWrapper } from './ChipiClientWrapper.mjs';
3
2
  import 'react/jsx-runtime';
4
3
  import 'react';
5
- import '@tanstack/react-query';
6
4
  import '@chipi-stack/types';
@@ -1,12 +1,20 @@
1
1
  "use client";
2
2
  import { jsx } from "react/jsx-runtime";
3
- import { ChipiClientWrapper } from "./client/ChipiClientWrapper";
3
+ import React from "react";
4
+ import { ChipiProvider } from "@chipi-stack/chipi-react";
4
5
  function ChipiClientProvider({
5
6
  children,
6
7
  apiPublicKey,
7
- environment
8
+ environment = "production"
8
9
  }) {
9
- return /* @__PURE__ */ jsx(ChipiClientWrapper, { apiPublicKey, environment, children });
10
+ const config = React.useMemo(
11
+ () => ({
12
+ apiPublicKey,
13
+ environment
14
+ }),
15
+ [apiPublicKey, environment]
16
+ );
17
+ return /* @__PURE__ */ jsx(ChipiProvider, { config, children });
10
18
  }
11
19
  export {
12
20
  ChipiClientProvider
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/ChipiClientProvider.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { ChipiClientWrapper } from './client/ChipiClientWrapper';\n\ninterface ChipiClientProviderProps {\n children: React.ReactNode;\n apiPublicKey: string;\n environment: 'development' | 'production';\n}\n\n/**\n * Pure client component that handles all React hook imports\n * This component is marked with 'use client' to avoid server-side issues\n */\nexport function ChipiClientProvider({ \n children, \n apiPublicKey, \n environment \n}: ChipiClientProviderProps) {\n return (\n <ChipiClientWrapper apiPublicKey={apiPublicKey} environment={environment}>\n {children}\n </ChipiClientWrapper>\n );\n}\n"],"mappings":";AAqBI;AAlBJ,SAAS,0BAA0B;AAY5B,SAAS,oBAAoB;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AACF,GAA6B;AAC3B,SACE,oBAAC,sBAAmB,cAA4B,aAC7C,UACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/ChipiClientProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\nimport { ChipiProvider } from \"@chipi-stack/chipi-react\";\nimport type { ChipiSDKConfig } from \"@chipi-stack/types\";\n\ninterface ChipiClientProviderProps {\n children: React.ReactNode;\n apiPublicKey: string;\n environment?: \"development\" | \"production\";\n}\n\n/**\n * Pure client component that handles all React hook imports\n * This component is marked with 'use client' to avoid server-side issues\n */\nexport function ChipiClientProvider({\n children,\n apiPublicKey,\n environment = \"production\",\n}: ChipiClientProviderProps) {\n // Create config\n const config = React.useMemo(\n (): ChipiSDKConfig => ({\n apiPublicKey,\n environment,\n }),\n [apiPublicKey, environment]\n );\n\n return <ChipiProvider config={config}>{children}</ChipiProvider>;\n}\n"],"mappings":";AA8BS;AA5BT,OAAO,WAAW;AAClB,SAAS,qBAAqB;AAavB,SAAS,oBAAoB;AAAA,EAClC;AAAA,EACA;AAAA,EACA,cAAc;AAChB,GAA6B;AAE3B,QAAM,SAAS,MAAM;AAAA,IACnB,OAAuB;AAAA,MACrB;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,cAAc,WAAW;AAAA,EAC5B;AAEA,SAAO,oBAAC,iBAAc,QAAiB,UAAS;AAClD;","names":[]}
@@ -12,7 +12,7 @@ async function ChipiProvider({ children }) {
12
12
  if (process.env.NEXT_PUBLIC_CHIPI_ENV === "development") {
13
13
  environment = "development";
14
14
  }
15
- console.log("environment", environment);
15
+ console.log("environment?", environment);
16
16
  if (!apiPublicKey) {
17
17
  throw new Error(
18
18
  " NEXT_PUBLIC_CHIPI_API_KEY environment variable. Please add it to your .env file."
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/app-router/server/ChipiProvider.tsx"],"sourcesContent":["import React from \"react\";\nimport { createChipiServer } from \"../../server/createChipiServer\";\nimport { ChipiProvider as ChipiClientProvider } from \"../client/ChipiProvider\";\n\nexport interface ChipiProviderProps {\n children: React.ReactNode;\n}\n\n/**\n * Server-side Chipi Provider for Next.js App Router\n *\n * This is the server component version that runs during SSR.\n * It initializes the server SDK and passes configuration to the client provider.\n */\nexport async function ChipiProvider({ children }: ChipiProviderProps) {\n // Read environment variables on the server\n const apiPublicKey = process.env.NEXT_PUBLIC_CHIPI_API_KEY;\n const secretKey = process.env.CHIPI_SECRET_KEY;\n let environment = \"production\" as \"production\" | \"development\";\n console.log(\n \"process.env.NEXT_PUBLIC_CHIPI_ENV\",\n process.env.NEXT_PUBLIC_CHIPI_ENV\n );\n if (process.env.NEXT_PUBLIC_CHIPI_ENV === \"development\") {\n environment = \"development\";\n }\n\n console.log(\"environment\", environment);\n // Validate required environment variables\n if (!apiPublicKey) {\n throw new Error(\n \" NEXT_PUBLIC_CHIPI_API_KEY environment variable. Please add it to your .env file.\"\n );\n }\n\n if (!secretKey) {\n throw new Error(\n \"Missing CHIPI_SECRET_KEY environment variable. Server-side features will not work properly.\"\n );\n }\n\n // Initialize server SDK (this runs on server only)\n createChipiServer({\n secretKey,\n apiPublicKey,\n environment,\n debug: environment === \"development\",\n });\n\n // Return the client provider which will hydrate on the client\n // Note: This works because ChipiClientProvider is marked with 'use client'\n return (\n <ChipiClientProvider apiPublicKey={apiPublicKey} environment={environment}>\n {children}\n </ChipiClientProvider>\n );\n}\n"],"mappings":"AAoDI;AAnDJ,SAAS,yBAAyB;AAClC,SAAS,iBAAiB,2BAA2B;AAYrD,eAAsB,cAAc,EAAE,SAAS,GAAuB;AAEpE,QAAM,eAAe,QAAQ,IAAI;AACjC,QAAM,YAAY,QAAQ,IAAI;AAC9B,MAAI,cAAc;AAClB,UAAQ;AAAA,IACN;AAAA,IACA,QAAQ,IAAI;AAAA,EACd;AACA,MAAI,QAAQ,IAAI,0BAA0B,eAAe;AACvD,kBAAc;AAAA,EAChB;AAEA,UAAQ,IAAI,eAAe,WAAW;AAEtC,MAAI,CAAC,cAAc;AACjB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AACd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAGA,oBAAkB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,gBAAgB;AAAA,EACzB,CAAC;AAID,SACE,oBAAC,uBAAoB,cAA4B,aAC9C,UACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../../src/app-router/server/ChipiProvider.tsx"],"sourcesContent":["import React from \"react\";\nimport { createChipiServer } from \"../../server/createChipiServer\";\nimport { ChipiProvider as ChipiClientProvider } from \"../client/ChipiProvider\";\n\nexport interface ChipiProviderProps {\n children: React.ReactNode;\n}\n\n/**\n * Server-side Chipi Provider for Next.js App Router\n *\n * This is the server component version that runs during SSR.\n * It initializes the server SDK and passes configuration to the client provider.\n */\nexport async function ChipiProvider({ children }: ChipiProviderProps) {\n // Read environment variables on the server\n const apiPublicKey = process.env.NEXT_PUBLIC_CHIPI_API_KEY;\n const secretKey = process.env.CHIPI_SECRET_KEY;\n let environment = \"production\" as \"production\" | \"development\";\n console.log(\n \"process.env.NEXT_PUBLIC_CHIPI_ENV\",\n process.env.NEXT_PUBLIC_CHIPI_ENV\n );\n if (process.env.NEXT_PUBLIC_CHIPI_ENV === \"development\") {\n environment = \"development\";\n }\n\n console.log(\"environment?\", environment);\n // Validate required environment variables\n if (!apiPublicKey) {\n throw new Error(\n \" NEXT_PUBLIC_CHIPI_API_KEY environment variable. Please add it to your .env file.\"\n );\n }\n\n if (!secretKey) {\n throw new Error(\n \"Missing CHIPI_SECRET_KEY environment variable. Server-side features will not work properly.\"\n );\n }\n\n // Initialize server SDK (this runs on server only)\n createChipiServer({\n secretKey,\n apiPublicKey,\n environment,\n debug: environment === \"development\",\n });\n\n // Return the client provider which will hydrate on the client\n // Note: This works because ChipiClientProvider is marked with 'use client'\n return (\n <ChipiClientProvider apiPublicKey={apiPublicKey} environment={environment}>\n {children}\n </ChipiClientProvider>\n );\n}\n"],"mappings":"AAoDI;AAnDJ,SAAS,yBAAyB;AAClC,SAAS,iBAAiB,2BAA2B;AAYrD,eAAsB,cAAc,EAAE,SAAS,GAAuB;AAEpE,QAAM,eAAe,QAAQ,IAAI;AACjC,QAAM,YAAY,QAAQ,IAAI;AAC9B,MAAI,cAAc;AAClB,UAAQ;AAAA,IACN;AAAA,IACA,QAAQ,IAAI;AAAA,EACd;AACA,MAAI,QAAQ,IAAI,0BAA0B,eAAe;AACvD,kBAAc;AAAA,EAChB;AAEA,UAAQ,IAAI,gBAAgB,WAAW;AAEvC,MAAI,CAAC,cAAc;AACjB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,MAAI,CAAC,WAAW;AACd,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAGA,oBAAkB;AAAA,IAChB;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,gBAAgB;AAAA,EACzB,CAAC;AAID,SACE,oBAAC,uBAAoB,cAA4B,aAC9C,UACH;AAEJ;","names":[]}
@@ -1,31 +1,10 @@
1
1
  "use client";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import React from "react";
4
- import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
5
4
  import { ChipiProvider as BaseChipiProvider } from "@chipi-stack/chipi-react";
6
- const createDefaultQueryClient = () => new QueryClient({
7
- defaultOptions: {
8
- queries: {
9
- staleTime: 60 * 1e3,
10
- // 1 minute
11
- gcTime: 10 * 60 * 1e3,
12
- // 10 minutes (formerly cacheTime)
13
- retry: (failureCount, error) => {
14
- if (error?.status >= 400 && error?.status < 500) {
15
- return false;
16
- }
17
- return failureCount < 3;
18
- }
19
- },
20
- mutations: {
21
- retry: false
22
- }
23
- }
24
- });
25
5
  function ChipiProvider({
26
6
  children,
27
- config: userConfig,
28
- queryClient
7
+ config: userConfig
29
8
  }) {
30
9
  const config = React.useMemo(() => {
31
10
  const envConfig = {
@@ -34,16 +13,12 @@ function ChipiProvider({
34
13
  };
35
14
  return { ...envConfig, ...userConfig };
36
15
  }, [userConfig]);
37
- const client = React.useMemo(
38
- () => queryClient || createDefaultQueryClient(),
39
- [queryClient]
40
- );
41
16
  if (!config.apiPublicKey) {
42
17
  throw new Error(
43
18
  "Missing NEXT_PUBLIC_CHIPI_API_KEY environment variable. Please add it to your .env.local file."
44
19
  );
45
20
  }
46
- return /* @__PURE__ */ jsx(QueryClientProvider, { client, children: /* @__PURE__ */ jsx(BaseChipiProvider, { config, children }) });
21
+ return /* @__PURE__ */ jsx(BaseChipiProvider, { config, children });
47
22
  }
48
23
  export {
49
24
  ChipiProvider
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/ChipiProvider.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { ChipiProvider as BaseChipiProvider } from '@chipi-stack/chipi-react';\nimport type { ChipiSDKConfig } from '@chipi-stack/types';\n\nexport interface ChipiProviderProps {\n children: React.ReactNode;\n /**\n * Configuration for the Chipi SDK\n */\n config?: Partial<ChipiSDKConfig>;\n /**\n * Custom QueryClient instance for React Query\n * If not provided, a default one will be created\n */\n queryClient?: QueryClient;\n}\n\n// Default QueryClient configuration\nconst createDefaultQueryClient = () =>\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 60 * 1000, // 1 minute\n gcTime: 10 * 60 * 1000, // 10 minutes (formerly cacheTime)\n retry: (failureCount, error: any) => {\n // Don't retry on 4xx errors\n if (error?.status >= 400 && error?.status < 500) {\n return false;\n }\n return failureCount < 3;\n },\n },\n mutations: {\n retry: false,\n },\n },\n });\n\n/**\n * Client-side Chipi Provider for Next.js applications\n * \n * This provider wraps the base ChipiProvider with React Query\n * and provides Next.js-specific optimizations.\n * \n * Note: For most use cases, use the main ChipiProvider from '@chipi-stack/nextjs'\n * instead of this client-only provider.\n * \n * @example\n * ```tsx\n * // Advanced usage - client-only provider\n * 'use client';\n * \n * import { ChipiClientProvider } from '@chipi-stack/nextjs';\n * \n * export function ClientProviders({ children }: { children: React.ReactNode }) {\n * return (\n * <ChipiClientProvider \n * config={{ \n * apiPublicKey: process.env.NEXT_PUBLIC_CHIPI_API_KEY!,\n * environment: 'production'\n * }}\n * >\n * {children}\n * </ChipiClientProvider>\n * );\n * }\n * ```\n */\nexport function ChipiProvider({ \n children, \n config: userConfig,\n queryClient \n}: ChipiProviderProps) {\n // Automatically get configuration from environment variables\n // Siento que esta madre no se usa\n const config = React.useMemo(() => {\n const envConfig: ChipiSDKConfig = {\n apiPublicKey: process.env.NEXT_PUBLIC_CHIPI_API_KEY!,\n environment: (process.env.NEXT_PUBLIC_CHIPI_ENV === 'development' ? 'development' : 'production') as 'development' | 'production',\n };\n \n // Merge with user-provided config\n return { ...envConfig, ...userConfig };\n }, [userConfig]);\n\n // Create or use provided QueryClient\n const client = React.useMemo(\n () => queryClient || createDefaultQueryClient(),\n [queryClient]\n );\n\n // Validate required configuration\n if (!config.apiPublicKey) {\n throw new Error(\n 'Missing NEXT_PUBLIC_CHIPI_API_KEY environment variable. Please add it to your .env.local file.'\n );\n }\n\n return (\n <QueryClientProvider client={client}>\n <BaseChipiProvider config={config}>\n {children}\n </BaseChipiProvider>\n </QueryClientProvider>\n );\n}\n"],"mappings":";AAuGM;AArGN,OAAO,WAAW;AAClB,SAAS,aAAa,2BAA2B;AACjD,SAAS,iBAAiB,yBAAyB;AAiBnD,MAAM,2BAA2B,MAC/B,IAAI,YAAY;AAAA,EACd,gBAAgB;AAAA,IACd,SAAS;AAAA,MACP,WAAW,KAAK;AAAA;AAAA,MAChB,QAAQ,KAAK,KAAK;AAAA;AAAA,MAClB,OAAO,CAAC,cAAc,UAAe;AAEnC,YAAI,OAAO,UAAU,OAAO,OAAO,SAAS,KAAK;AAC/C,iBAAO;AAAA,QACT;AACA,eAAO,eAAe;AAAA,MACxB;AAAA,IACF;AAAA,IACA,WAAW;AAAA,MACT,OAAO;AAAA,IACT;AAAA,EACF;AACF,CAAC;AAgCI,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA,QAAQ;AAAA,EACR;AACF,GAAuB;AAGrB,QAAM,SAAS,MAAM,QAAQ,MAAM;AACjC,UAAM,YAA4B;AAAA,MAChC,cAAc,QAAQ,IAAI;AAAA,MAC1B,aAAc,QAAQ,IAAI,0BAA0B,gBAAgB,gBAAgB;AAAA,IACtF;AAGA,WAAO,EAAE,GAAG,WAAW,GAAG,WAAW;AAAA,EACvC,GAAG,CAAC,UAAU,CAAC;AAGf,QAAM,SAAS,MAAM;AAAA,IACnB,MAAM,eAAe,yBAAyB;AAAA,IAC9C,CAAC,WAAW;AAAA,EACd;AAGA,MAAI,CAAC,OAAO,cAAc;AACxB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SACE,oBAAC,uBAAoB,QACnB,8BAAC,qBAAkB,QAChB,UACH,GACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../../src/client/ChipiProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport React from \"react\";\nimport { ChipiProvider as BaseChipiProvider } from \"@chipi-stack/chipi-react\";\nimport type { ChipiSDKConfig } from \"@chipi-stack/types\";\n\nexport interface ChipiProviderProps {\n children: React.ReactNode;\n /**\n * Configuration for the Chipi SDK\n */\n config?: Partial<ChipiSDKConfig>;\n}\n\n/**\n * Client-side Chipi Provider for Next.js applications\n *\n * This provider wraps the base ChipiProvider and provides Next.js-specific\n * optimizations like automatic environment variable configuration.\n *\n * Note: For most use cases, use the main ChipiProvider from '@chipi-stack/nextjs'\n * instead of this client-only provider.\n *\n * @example\n * ```tsx\n * // Advanced usage - client-only provider\n * 'use client';\n *\n * import { ChipiProvider } from '@chipi-stack/nextjs/client';\n *\n * export function ClientProviders({ children }: { children: React.ReactNode }) {\n * return (\n * <ChipiProvider\n * config={{\n * apiPublicKey: process.env.NEXT_PUBLIC_CHIPI_API_KEY!,\n * environment: 'production'\n * }}\n * >\n * {children}\n * </ChipiProvider>\n * );\n * }\n * ```\n */\nexport function ChipiProvider({\n children,\n config: userConfig,\n}: ChipiProviderProps) {\n // Automatically get configuration from environment variables\n // Siento que esta madre no se usa\n const config = React.useMemo(() => {\n const envConfig: ChipiSDKConfig = {\n apiPublicKey: process.env.NEXT_PUBLIC_CHIPI_API_KEY!,\n environment: (process.env.NEXT_PUBLIC_CHIPI_ENV === \"development\"\n ? \"development\"\n : \"production\") as \"development\" | \"production\",\n };\n\n // Merge with user-provided config\n return { ...envConfig, ...userConfig };\n }, [userConfig]);\n\n // Validate required configuration\n if (!config.apiPublicKey) {\n throw new Error(\n \"Missing NEXT_PUBLIC_CHIPI_API_KEY environment variable. Please add it to your .env.local file.\"\n );\n }\n\n return <BaseChipiProvider config={config}>{children}</BaseChipiProvider>;\n}\n"],"mappings":";AAqES;AAnET,OAAO,WAAW;AAClB,SAAS,iBAAiB,yBAAyB;AAyC5C,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA,QAAQ;AACV,GAAuB;AAGrB,QAAM,SAAS,MAAM,QAAQ,MAAM;AACjC,UAAM,YAA4B;AAAA,MAChC,cAAc,QAAQ,IAAI;AAAA,MAC1B,aAAc,QAAQ,IAAI,0BAA0B,gBAChD,gBACA;AAAA,IACN;AAGA,WAAO,EAAE,GAAG,WAAW,GAAG,WAAW;AAAA,EACvC,GAAG,CAAC,UAAU,CAAC;AAGf,MAAI,CAAC,OAAO,cAAc;AACxB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AAEA,SAAO,oBAAC,qBAAkB,QAAiB,UAAS;AACtD;","names":[]}
@@ -1,7 +1,5 @@
1
1
  import { ChipiProvider } from "./ChipiProvider";
2
- import { ChipiClientWrapper } from "./ChipiClientWrapper";
3
2
  export {
4
- ChipiClientWrapper,
5
3
  ChipiProvider
6
4
  };
7
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/index.ts"],"sourcesContent":["// Client-side exports\nexport { ChipiProvider } from './ChipiProvider';\nexport { ChipiClientWrapper } from './ChipiClientWrapper';\nexport type { ChipiProviderProps } from './ChipiProvider';\n"],"mappings":"AACA,SAAS,qBAAqB;AAC9B,SAAS,0BAA0B;","names":[]}
1
+ {"version":3,"sources":["../../../src/client/index.ts"],"sourcesContent":["// Client-side exports\nexport { ChipiProvider } from \"./ChipiProvider\";\nexport type { ChipiProviderProps } from \"./ChipiProvider\";\n"],"mappings":"AACA,SAAS,qBAAqB;","names":[]}
package/dist/esm/hooks.js CHANGED
@@ -5,7 +5,6 @@ import {
5
5
  useGetWallet,
6
6
  useApprove,
7
7
  useTransfer,
8
- useExecuteTransaction,
9
8
  useStakeVesuUsdc,
10
9
  useWithdrawVesuUsdc,
11
10
  useCallAnyContract,
@@ -16,7 +15,6 @@ export {
16
15
  useCallAnyContract,
17
16
  useChipiContext,
18
17
  useCreateWallet,
19
- useExecuteTransaction,
20
18
  useGetWallet,
21
19
  useRecordSendTransaction,
22
20
  useStakeVesuUsdc,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/hooks.ts"],"sourcesContent":["\"use client\";\n\n// Client-side hooks for Next.js Chipi SDK\n// These are re-exported from @chipi-stack/chipi-react for convenience\n// This file is marked as 'use client' to ensure it only runs on the client\n\nexport {\n // Context hook\n useChipiContext,\n\n // Wallet hooks\n useCreateWallet,\n useGetWallet,\n\n // Transaction hooks\n useApprove,\n useTransfer,\n useExecuteTransaction,\n\n // SKU hooks\n\n // Specialized transaction hooks\n useStakeVesuUsdc,\n useWithdrawVesuUsdc,\n useCallAnyContract,\n\n // Record send transaction hook\n useRecordSendTransaction,\n} from \"@chipi-stack/chipi-react\";\n"],"mappings":";AAMA;AAAA,EAEE;AAAA,EAGA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EAKA;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,OACK;","names":[]}
1
+ {"version":3,"sources":["../../src/hooks.ts"],"sourcesContent":["\"use client\";\n\n// Client-side hooks for Next.js Chipi SDK\n// These are re-exported from @chipi-stack/chipi-react for convenience\n// This file is marked as 'use client' to ensure it only runs on the client\n\nexport {\n // Context hook\n useChipiContext,\n\n // Wallet hooks\n useCreateWallet,\n useGetWallet,\n\n // Transaction hooks\n useApprove,\n useTransfer,\n\n // SKU hooks\n\n // Specialized transaction hooks\n useStakeVesuUsdc,\n useWithdrawVesuUsdc,\n useCallAnyContract,\n\n // Record send transaction hook\n useRecordSendTransaction,\n} from \"@chipi-stack/chipi-react\";\n"],"mappings":";AAMA;AAAA,EAEE;AAAA,EAGA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EAKA;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,OACK;","names":[]}
package/dist/hooks.d.mts CHANGED
@@ -1 +1 @@
1
- export { useApprove, useCallAnyContract, useChipiContext, useCreateWallet, useExecuteTransaction, useGetWallet, useRecordSendTransaction, useStakeVesuUsdc, useTransfer, useWithdrawVesuUsdc } from '@chipi-stack/chipi-react';
1
+ export { useApprove, useCallAnyContract, useChipiContext, useCreateWallet, useGetWallet, useRecordSendTransaction, useStakeVesuUsdc, useTransfer, useWithdrawVesuUsdc } from '@chipi-stack/chipi-react';
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ServerComponentsServerModuleTypes } from './components.server.mjs';
2
2
  export { ChipiProvider as ChipiClientProvider } from './app-router/client/ChipiProvider.mjs';
3
- export { useApprove, useCallAnyContract, useChipiContext, useCreateWallet, useExecuteTransaction, useGetWallet, useRecordSendTransaction, useStakeVesuUsdc, useTransfer, useWithdrawVesuUsdc } from '@chipi-stack/chipi-react';
3
+ export { useApprove, useCallAnyContract, useChipiContext, useCreateWallet, useGetWallet, useRecordSendTransaction, useStakeVesuUsdc, useTransfer, useWithdrawVesuUsdc } from '@chipi-stack/chipi-react';
4
4
  export * from '@chipi-stack/types';
5
5
  import './app-router/server/ChipiProvider.mjs';
6
6
  import 'react/jsx-runtime';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chipi-stack/nextjs",
3
- "version": "9.0.0",
3
+ "version": "11.0.0",
4
4
  "description": "Chipi SDK for Next.js applications with server-side support",
5
5
  "keywords": [
6
6
  "chipi",
@@ -73,10 +73,10 @@
73
73
  },
74
74
  "dependencies": {
75
75
  "@tanstack/react-query": "^5.85.0",
76
- "@chipi-stack/types": "^9.0.0",
77
- "@chipi-stack/chipi-react": "^9.0.0",
78
- "@chipi-stack/backend": "^9.0.0",
79
- "@chipi-stack/shared": "^9.0.0"
76
+ "@chipi-stack/chipi-react": "^11.0.0",
77
+ "@chipi-stack/backend": "^11.0.0",
78
+ "@chipi-stack/types": "^11.0.0",
79
+ "@chipi-stack/shared": "^11.0.0"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "next": ">=13.0.0",
@@ -1,15 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import React from 'react';
3
-
4
- interface ChipiClientWrapperProps {
5
- children: React.ReactNode;
6
- apiPublicKey: string;
7
- environment?: 'development' | 'production';
8
- }
9
- /**
10
- * Client-side wrapper for Chipi SDK in Next.js
11
- * This component runs on the client and receives the API key as a prop
12
- */
13
- declare function ChipiClientWrapper({ children, apiPublicKey, environment }: ChipiClientWrapperProps): react_jsx_runtime.JSX.Element;
14
-
15
- export { ChipiClientWrapper };
@@ -1,74 +0,0 @@
1
- "use strict";
2
- "use client";
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __export = (target, all) => {
10
- for (var name in all)
11
- __defProp(target, name, { get: all[name], enumerable: true });
12
- };
13
- var __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from === "object" || typeof from === "function") {
15
- for (let key of __getOwnPropNames(from))
16
- if (!__hasOwnProp.call(to, key) && key !== except)
17
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
- }
19
- return to;
20
- };
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
- var ChipiClientWrapper_exports = {};
31
- __export(ChipiClientWrapper_exports, {
32
- ChipiClientWrapper: () => ChipiClientWrapper
33
- });
34
- module.exports = __toCommonJS(ChipiClientWrapper_exports);
35
- var import_jsx_runtime = require("react/jsx-runtime");
36
- var import_react = __toESM(require("react"));
37
- var import_react_query = require("@tanstack/react-query");
38
- var import_chipi_react = require("@chipi-stack/chipi-react");
39
- const createDefaultQueryClient = () => new import_react_query.QueryClient({
40
- defaultOptions: {
41
- queries: {
42
- staleTime: 60 * 1e3,
43
- // 1 minute
44
- gcTime: 10 * 60 * 1e3,
45
- // 10 minutes (formerly cacheTime)
46
- retry: (failureCount, error) => {
47
- if (error?.status >= 400 && error?.status < 500) {
48
- return false;
49
- }
50
- return failureCount < 3;
51
- }
52
- },
53
- mutations: {
54
- retry: false
55
- }
56
- }
57
- });
58
- function ChipiClientWrapper({
59
- children,
60
- apiPublicKey,
61
- environment = "development"
62
- }) {
63
- const queryClient = import_react.default.useMemo(() => createDefaultQueryClient(), []);
64
- const config = import_react.default.useMemo(() => ({
65
- apiPublicKey,
66
- environment
67
- }), [apiPublicKey, environment]);
68
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_query.QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_chipi_react.ChipiProvider, { config, children }) });
69
- }
70
- // Annotate the CommonJS export names for ESM import in node:
71
- 0 && (module.exports = {
72
- ChipiClientWrapper
73
- });
74
- //# sourceMappingURL=ChipiClientWrapper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/client/ChipiClientWrapper.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { ChipiProvider as BaseChipiProvider } from '@chipi-stack/chipi-react';\nimport type { ChipiSDKConfig } from '@chipi-stack/types';\n\ninterface ChipiClientWrapperProps {\n children: React.ReactNode;\n apiPublicKey: string;\n environment?: 'development' | 'production';\n}\n\n// Default QueryClient configuration for Next.js\nconst createDefaultQueryClient = () =>\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 60 * 1000, // 1 minute\n gcTime: 10 * 60 * 1000, // 10 minutes (formerly cacheTime)\n retry: (failureCount, error: any) => {\n // Don't retry on 4xx errors\n if (error?.status >= 400 && error?.status < 500) {\n return false;\n }\n return failureCount < 3;\n },\n },\n mutations: {\n retry: false,\n },\n },\n });\n\n/**\n * Client-side wrapper for Chipi SDK in Next.js\n * This component runs on the client and receives the API key as a prop\n */\nexport function ChipiClientWrapper({ \n children, \n apiPublicKey,\n environment = 'development'\n}: ChipiClientWrapperProps) {\n // Create QueryClient\n const queryClient = React.useMemo(() => createDefaultQueryClient(), []);\n\n // Create config\n const config = React.useMemo((): ChipiSDKConfig => ({\n apiPublicKey,\n environment,\n }), [apiPublicKey, environment]);\n\n return (\n <QueryClientProvider client={queryClient}>\n <BaseChipiProvider config={config}>\n {children}\n </BaseChipiProvider>\n </QueryClientProvider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsDM;AApDN,mBAAkB;AAClB,yBAAiD;AACjD,yBAAmD;AAUnD,MAAM,2BAA2B,MAC/B,IAAI,+BAAY;AAAA,EACd,gBAAgB;AAAA,IACd,SAAS;AAAA,MACP,WAAW,KAAK;AAAA;AAAA,MAChB,QAAQ,KAAK,KAAK;AAAA;AAAA,MAClB,OAAO,CAAC,cAAc,UAAe;AAEnC,YAAI,OAAO,UAAU,OAAO,OAAO,SAAS,KAAK;AAC/C,iBAAO;AAAA,QACT;AACA,eAAO,eAAe;AAAA,MACxB;AAAA,IACF;AAAA,IACA,WAAW;AAAA,MACT,OAAO;AAAA,IACT;AAAA,EACF;AACF,CAAC;AAMI,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AAAA,EACA,cAAc;AAChB,GAA4B;AAE1B,QAAM,cAAc,aAAAA,QAAM,QAAQ,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAGtE,QAAM,SAAS,aAAAA,QAAM,QAAQ,OAAuB;AAAA,IAClD;AAAA,IACA;AAAA,EACF,IAAI,CAAC,cAAc,WAAW,CAAC;AAE/B,SACE,4CAAC,0CAAoB,QAAQ,aAC3B,sDAAC,mBAAAC,eAAA,EAAkB,QAChB,UACH,GACF;AAEJ;","names":["React","BaseChipiProvider"]}
@@ -1,15 +0,0 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import React from 'react';
3
-
4
- interface ChipiClientWrapperProps {
5
- children: React.ReactNode;
6
- apiPublicKey: string;
7
- environment?: 'development' | 'production';
8
- }
9
- /**
10
- * Client-side wrapper for Chipi SDK in Next.js
11
- * This component runs on the client and receives the API key as a prop
12
- */
13
- declare function ChipiClientWrapper({ children, apiPublicKey, environment }: ChipiClientWrapperProps): react_jsx_runtime.JSX.Element;
14
-
15
- export { ChipiClientWrapper };
@@ -1,40 +0,0 @@
1
- "use client";
2
- import { jsx } from "react/jsx-runtime";
3
- import React from "react";
4
- import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
5
- import { ChipiProvider as BaseChipiProvider } from "@chipi-stack/chipi-react";
6
- const createDefaultQueryClient = () => new QueryClient({
7
- defaultOptions: {
8
- queries: {
9
- staleTime: 60 * 1e3,
10
- // 1 minute
11
- gcTime: 10 * 60 * 1e3,
12
- // 10 minutes (formerly cacheTime)
13
- retry: (failureCount, error) => {
14
- if (error?.status >= 400 && error?.status < 500) {
15
- return false;
16
- }
17
- return failureCount < 3;
18
- }
19
- },
20
- mutations: {
21
- retry: false
22
- }
23
- }
24
- });
25
- function ChipiClientWrapper({
26
- children,
27
- apiPublicKey,
28
- environment = "development"
29
- }) {
30
- const queryClient = React.useMemo(() => createDefaultQueryClient(), []);
31
- const config = React.useMemo(() => ({
32
- apiPublicKey,
33
- environment
34
- }), [apiPublicKey, environment]);
35
- return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsx(BaseChipiProvider, { config, children }) });
36
- }
37
- export {
38
- ChipiClientWrapper
39
- };
40
- //# sourceMappingURL=ChipiClientWrapper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/client/ChipiClientWrapper.tsx"],"sourcesContent":["'use client';\n\nimport React from 'react';\nimport { QueryClient, QueryClientProvider } from '@tanstack/react-query';\nimport { ChipiProvider as BaseChipiProvider } from '@chipi-stack/chipi-react';\nimport type { ChipiSDKConfig } from '@chipi-stack/types';\n\ninterface ChipiClientWrapperProps {\n children: React.ReactNode;\n apiPublicKey: string;\n environment?: 'development' | 'production';\n}\n\n// Default QueryClient configuration for Next.js\nconst createDefaultQueryClient = () =>\n new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: 60 * 1000, // 1 minute\n gcTime: 10 * 60 * 1000, // 10 minutes (formerly cacheTime)\n retry: (failureCount, error: any) => {\n // Don't retry on 4xx errors\n if (error?.status >= 400 && error?.status < 500) {\n return false;\n }\n return failureCount < 3;\n },\n },\n mutations: {\n retry: false,\n },\n },\n });\n\n/**\n * Client-side wrapper for Chipi SDK in Next.js\n * This component runs on the client and receives the API key as a prop\n */\nexport function ChipiClientWrapper({ \n children, \n apiPublicKey,\n environment = 'development'\n}: ChipiClientWrapperProps) {\n // Create QueryClient\n const queryClient = React.useMemo(() => createDefaultQueryClient(), []);\n\n // Create config\n const config = React.useMemo((): ChipiSDKConfig => ({\n apiPublicKey,\n environment,\n }), [apiPublicKey, environment]);\n\n return (\n <QueryClientProvider client={queryClient}>\n <BaseChipiProvider config={config}>\n {children}\n </BaseChipiProvider>\n </QueryClientProvider>\n );\n}\n"],"mappings":";AAsDM;AApDN,OAAO,WAAW;AAClB,SAAS,aAAa,2BAA2B;AACjD,SAAS,iBAAiB,yBAAyB;AAUnD,MAAM,2BAA2B,MAC/B,IAAI,YAAY;AAAA,EACd,gBAAgB;AAAA,IACd,SAAS;AAAA,MACP,WAAW,KAAK;AAAA;AAAA,MAChB,QAAQ,KAAK,KAAK;AAAA;AAAA,MAClB,OAAO,CAAC,cAAc,UAAe;AAEnC,YAAI,OAAO,UAAU,OAAO,OAAO,SAAS,KAAK;AAC/C,iBAAO;AAAA,QACT;AACA,eAAO,eAAe;AAAA,MACxB;AAAA,IACF;AAAA,IACA,WAAW;AAAA,MACT,OAAO;AAAA,IACT;AAAA,EACF;AACF,CAAC;AAMI,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AAAA,EACA,cAAc;AAChB,GAA4B;AAE1B,QAAM,cAAc,MAAM,QAAQ,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAGtE,QAAM,SAAS,MAAM,QAAQ,OAAuB;AAAA,IAClD;AAAA,IACA;AAAA,EACF,IAAI,CAAC,cAAc,WAAW,CAAC;AAE/B,SACE,oBAAC,uBAAoB,QAAQ,aAC3B,8BAAC,qBAAkB,QAChB,UACH,GACF;AAEJ;","names":[]}