@merit-systems/echo-react-sdk 1.0.29 → 1.0.31
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/LICENSE +13 -0
- package/dist/index.cjs +3 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -18
- package/dist/index.d.ts +12 -18
- package/dist/index.js +3 -4
- package/dist/index.js.map +1 -1
- package/package.json +25 -25
package/dist/index.d.cts
CHANGED
|
@@ -2,9 +2,12 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import * as React$1 from 'react';
|
|
3
3
|
import React__default, { ReactNode } from 'react';
|
|
4
4
|
import { User } from 'oidc-client-ts';
|
|
5
|
-
import
|
|
6
|
-
import { EchoConfig, Balance, EchoClient, FreeBalance } from '@merit-systems/echo-typescript-sdk';
|
|
5
|
+
import { EchoConfig, GetUserResponse, GetBalanceResponse, EchoClient, GetBalanceByIdFreeResponse } from '@merit-systems/echo-typescript-sdk';
|
|
7
6
|
import * as openai from 'openai';
|
|
7
|
+
import * as _openrouter_ai_sdk_provider from '@openrouter/ai-sdk-provider';
|
|
8
|
+
import * as _ai_sdk_google from '@ai-sdk/google';
|
|
9
|
+
import * as _ai_sdk_anthropic from '@ai-sdk/anthropic';
|
|
10
|
+
import * as _ai_sdk_openai from '@ai-sdk/openai';
|
|
8
11
|
import * as ai from 'ai';
|
|
9
12
|
import { ChatTransport, UIMessage, UIMessageChunk } from 'ai';
|
|
10
13
|
import * as _ai_sdk_react from '@ai-sdk/react';
|
|
@@ -13,17 +16,8 @@ interface EchoAuthConfig extends EchoConfig {
|
|
|
13
16
|
redirectUri?: string;
|
|
14
17
|
scope?: string;
|
|
15
18
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
email: string;
|
|
19
|
-
name?: string;
|
|
20
|
-
picture?: string;
|
|
21
|
-
totalPaid?: number;
|
|
22
|
-
totalSpent?: number;
|
|
23
|
-
createdAt: string;
|
|
24
|
-
updatedAt: string;
|
|
25
|
-
}
|
|
26
|
-
type EchoBalance = Balance;
|
|
19
|
+
type EchoUser = GetUserResponse;
|
|
20
|
+
type EchoBalance = GetBalanceResponse;
|
|
27
21
|
interface EchoSignInProps {
|
|
28
22
|
onSuccess?: (user: EchoUser) => void;
|
|
29
23
|
onError?: (error: Error) => void;
|
|
@@ -122,10 +116,10 @@ interface UseEchoOpenAIResult {
|
|
|
122
116
|
declare function useEchoOpenAI(options?: UseEchoOpenAIOptions): UseEchoOpenAIResult;
|
|
123
117
|
|
|
124
118
|
declare const useEchoModelProviders: () => {
|
|
125
|
-
openai:
|
|
126
|
-
anthropic:
|
|
127
|
-
google:
|
|
128
|
-
openrouter:
|
|
119
|
+
openai: _ai_sdk_openai.OpenAIProvider;
|
|
120
|
+
anthropic: _ai_sdk_anthropic.AnthropicProvider;
|
|
121
|
+
google: _ai_sdk_google.GoogleGenerativeAIProvider;
|
|
122
|
+
openrouter: _openrouter_ai_sdk_provider.OpenRouterProvider;
|
|
129
123
|
};
|
|
130
124
|
|
|
131
125
|
type ChatSendParams = Parameters<ChatTransport<UIMessage>['sendMessages']>[0];
|
|
@@ -148,7 +142,7 @@ interface EchoContextValue {
|
|
|
148
142
|
isLoading: boolean;
|
|
149
143
|
error: string | null;
|
|
150
144
|
user: EchoUser | null;
|
|
151
|
-
freeTierBalance:
|
|
145
|
+
freeTierBalance: GetBalanceByIdFreeResponse | null;
|
|
152
146
|
balance: EchoBalance | null;
|
|
153
147
|
refreshBalance: () => Promise<any>;
|
|
154
148
|
createPaymentLink: (amount: number, description?: string, successUrl?: string) => Promise<string>;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,9 +2,12 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import * as React$1 from 'react';
|
|
3
3
|
import React__default, { ReactNode } from 'react';
|
|
4
4
|
import { User } from 'oidc-client-ts';
|
|
5
|
-
import
|
|
6
|
-
import { EchoConfig, Balance, EchoClient, FreeBalance } from '@merit-systems/echo-typescript-sdk';
|
|
5
|
+
import { EchoConfig, GetUserResponse, GetBalanceResponse, EchoClient, GetBalanceByIdFreeResponse } from '@merit-systems/echo-typescript-sdk';
|
|
7
6
|
import * as openai from 'openai';
|
|
7
|
+
import * as _openrouter_ai_sdk_provider from '@openrouter/ai-sdk-provider';
|
|
8
|
+
import * as _ai_sdk_google from '@ai-sdk/google';
|
|
9
|
+
import * as _ai_sdk_anthropic from '@ai-sdk/anthropic';
|
|
10
|
+
import * as _ai_sdk_openai from '@ai-sdk/openai';
|
|
8
11
|
import * as ai from 'ai';
|
|
9
12
|
import { ChatTransport, UIMessage, UIMessageChunk } from 'ai';
|
|
10
13
|
import * as _ai_sdk_react from '@ai-sdk/react';
|
|
@@ -13,17 +16,8 @@ interface EchoAuthConfig extends EchoConfig {
|
|
|
13
16
|
redirectUri?: string;
|
|
14
17
|
scope?: string;
|
|
15
18
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
email: string;
|
|
19
|
-
name?: string;
|
|
20
|
-
picture?: string;
|
|
21
|
-
totalPaid?: number;
|
|
22
|
-
totalSpent?: number;
|
|
23
|
-
createdAt: string;
|
|
24
|
-
updatedAt: string;
|
|
25
|
-
}
|
|
26
|
-
type EchoBalance = Balance;
|
|
19
|
+
type EchoUser = GetUserResponse;
|
|
20
|
+
type EchoBalance = GetBalanceResponse;
|
|
27
21
|
interface EchoSignInProps {
|
|
28
22
|
onSuccess?: (user: EchoUser) => void;
|
|
29
23
|
onError?: (error: Error) => void;
|
|
@@ -122,10 +116,10 @@ interface UseEchoOpenAIResult {
|
|
|
122
116
|
declare function useEchoOpenAI(options?: UseEchoOpenAIOptions): UseEchoOpenAIResult;
|
|
123
117
|
|
|
124
118
|
declare const useEchoModelProviders: () => {
|
|
125
|
-
openai:
|
|
126
|
-
anthropic:
|
|
127
|
-
google:
|
|
128
|
-
openrouter:
|
|
119
|
+
openai: _ai_sdk_openai.OpenAIProvider;
|
|
120
|
+
anthropic: _ai_sdk_anthropic.AnthropicProvider;
|
|
121
|
+
google: _ai_sdk_google.GoogleGenerativeAIProvider;
|
|
122
|
+
openrouter: _openrouter_ai_sdk_provider.OpenRouterProvider;
|
|
129
123
|
};
|
|
130
124
|
|
|
131
125
|
type ChatSendParams = Parameters<ChatTransport<UIMessage>['sendMessages']>[0];
|
|
@@ -148,7 +142,7 @@ interface EchoContextValue {
|
|
|
148
142
|
isLoading: boolean;
|
|
149
143
|
error: string | null;
|
|
150
144
|
user: EchoUser | null;
|
|
151
|
-
freeTierBalance:
|
|
145
|
+
freeTierBalance: GetBalanceByIdFreeResponse | null;
|
|
152
146
|
balance: EchoBalance | null;
|
|
153
147
|
refreshBalance: () => Promise<any>;
|
|
154
148
|
createPaymentLink: (amount: number, description?: string, successUrl?: string) => Promise<string>;
|
package/dist/index.js
CHANGED
|
@@ -134241,8 +134241,8 @@ import {
|
|
|
134241
134241
|
} from "react-oidc-context";
|
|
134242
134242
|
|
|
134243
134243
|
// src/hooks/useEchoBalance.ts
|
|
134244
|
-
import { parseEchoError } from "@merit-systems/echo-typescript-sdk";
|
|
134245
134244
|
import useSWR from "swr";
|
|
134245
|
+
import { parseEchoError } from "@merit-systems/echo-typescript-sdk";
|
|
134246
134246
|
function useEchoBalance(echoClient, appId) {
|
|
134247
134247
|
const { data, error: error2, isLoading, mutate } = useSWR(
|
|
134248
134248
|
echoClient && appId ? ["balance", appId] : null,
|
|
@@ -135560,7 +135560,6 @@ function EchoTokens({
|
|
|
135560
135560
|
balance,
|
|
135561
135561
|
freeTierBalance,
|
|
135562
135562
|
isLoading,
|
|
135563
|
-
isLoggedIn,
|
|
135564
135563
|
refreshBalance,
|
|
135565
135564
|
isInsufficientFunds,
|
|
135566
135565
|
setIsInsufficientFunds
|
|
@@ -135708,10 +135707,10 @@ function EchoTokens({
|
|
|
135708
135707
|
onMouseEnter: () => setIsHovered(true),
|
|
135709
135708
|
onMouseLeave: () => setIsHovered(false),
|
|
135710
135709
|
children: [
|
|
135711
|
-
showAvatar && user?.
|
|
135710
|
+
showAvatar && user?.image ? /* @__PURE__ */ jsx6(
|
|
135712
135711
|
"img",
|
|
135713
135712
|
{
|
|
135714
|
-
src: user.
|
|
135713
|
+
src: user.image,
|
|
135715
135714
|
alt: user.name || user.email || "User avatar",
|
|
135716
135715
|
style: {
|
|
135717
135716
|
width: "24px",
|