@goodwidget/ai-credits-widget 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/chunk-635NKGPL.js +6815 -0
- package/dist/chunk-635NKGPL.js.map +1 -0
- package/dist/{chunk-YIXMIOVW.js → chunk-QNDSSO77.js} +1 -1
- package/dist/element.cjs +3481 -1262
- package/dist/element.cjs.map +1 -1
- package/dist/element.js +1 -1
- package/dist/index.cjs +3500 -1261
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +42 -4
- package/dist/index.d.ts +42 -4
- package/dist/index.js +22 -2
- package/dist/mocked/index.cjs +3539 -1298
- package/dist/mocked/index.cjs.map +1 -1
- package/dist/mocked/index.d.cts +13 -5
- package/dist/mocked/index.d.ts +13 -5
- package/dist/mocked/index.js +46 -24
- package/dist/mocked/index.js.map +1 -1
- package/dist/register.cjs +3589 -1324
- package/dist/register.cjs.map +1 -1
- package/dist/{widgetRuntimeContract-BPILUGC4.d.cts → widgetRuntimeContract-Bcb5Ej6O.d.cts} +142 -29
- package/dist/{widgetRuntimeContract-BPILUGC4.d.ts → widgetRuntimeContract-Bcb5Ej6O.d.ts} +142 -29
- package/package.json +6 -1
- package/dist/chunk-5ABKU4SW.js +0 -4518
- package/dist/chunk-5ABKU4SW.js.map +0 -1
- /package/dist/{chunk-YIXMIOVW.js.map → chunk-QNDSSO77.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AiCreditsWidgetEnvironment, a as AiCreditsPaySuccessDetail, b as AiCreditsPayErrorDetail, c as AiCreditsBackendClient, d as AiCreditsChainClient, e as AccountRef, f as AiCreditsWidgetAdapterResult, g as AiCreditsWidgetProps } from './widgetRuntimeContract-
|
|
2
|
-
export { h as AccountEnrichment, i as AccountStatusResponse, i as AccountView, j as AiCreditsQuote, k as AiCreditsWidgetAdapterActions, l as AiCreditsWidgetAdapterFactory, m as AiCreditsWidgetAdapterFactoryInput, n as AiCreditsWidgetAdapterState, o as AiCreditsWidgetStatus, p as AiCreditsWidgetTab,
|
|
1
|
+
import { A as AiCreditsWidgetEnvironment, a as AiCreditsPaySuccessDetail, b as AiCreditsPayErrorDetail, c as AiCreditsBackendClient, d as AiCreditsChainClient, e as AccountRef, f as AiCreditsWidgetAdapterResult, g as AiCreditsWidgetProps } from './widgetRuntimeContract-Bcb5Ej6O.cjs';
|
|
2
|
+
export { h as AccountEnrichment, i as AccountStatusResponse, i as AccountView, j as AiCreditsQuote, k as AiCreditsWidgetAdapterActions, l as AiCreditsWidgetAdapterFactory, m as AiCreditsWidgetAdapterFactoryInput, n as AiCreditsWidgetAdapterState, o as AiCreditsWidgetStatus, p as AiCreditsWidgetTab, C as CELO_GOODID_ADDRESS, D as DEFAULT_BASE_RPC_URL, q as DEFAULT_CELO_RPC_URL, r as DEFAULT_DISCOUNT_CONFIG, s as DiscountConfig, E as Eip712SigningPayload, G as GdCreditEntry, P as ProductionAiCreditsBackendClient, S as SignerOperatorStatus, U as UnavailableAiCreditsBackendClient, t as buildAccountView, u as createBackendClient, v as createChainClient, w as enrichAccountView, x as totalCreditUsdFromProfile, y as totalCreditUsdFromStatus } from './widgetRuntimeContract-Bcb5Ej6O.cjs';
|
|
3
3
|
import { Address } from 'viem';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import '@goodwidget/ui';
|
|
@@ -15,6 +15,44 @@ type AiCreditsIntegration = typeof aiCreditsIntegration;
|
|
|
15
15
|
|
|
16
16
|
declare function usdToCredits(usd: string): string;
|
|
17
17
|
|
|
18
|
+
type SignerKeyEntry = {
|
|
19
|
+
privateKey?: string;
|
|
20
|
+
operatorSignature?: string;
|
|
21
|
+
operatorConsented?: boolean;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type DeepLinkParams = {
|
|
25
|
+
signerAddress: string;
|
|
26
|
+
operatorSignature: string;
|
|
27
|
+
};
|
|
28
|
+
type DeepLinkParseResult = {
|
|
29
|
+
status: 'absent';
|
|
30
|
+
} | {
|
|
31
|
+
status: 'partial';
|
|
32
|
+
present: 'signerAddress' | 'operatorSignature';
|
|
33
|
+
} | {
|
|
34
|
+
status: 'invalid';
|
|
35
|
+
reason: string;
|
|
36
|
+
} | {
|
|
37
|
+
status: 'complete';
|
|
38
|
+
value: DeepLinkParams;
|
|
39
|
+
source: 'url' | 'storage';
|
|
40
|
+
};
|
|
41
|
+
declare const DEEP_LINK_MANUAL_FALLBACK_HINT = "Generate or import a signer key manually to continue.";
|
|
42
|
+
declare function isValidSignerAddress(value: string): boolean;
|
|
43
|
+
declare function isValidOperatorSignature(value: string): boolean;
|
|
44
|
+
declare function deepLinkManualFallbackMessage(reason: string): string;
|
|
45
|
+
declare function readStoredDeepLinkParams(): DeepLinkParams | null;
|
|
46
|
+
declare function storeDeepLinkParams(value: DeepLinkParams): void;
|
|
47
|
+
declare function clearStoredDeepLinkParams(): void;
|
|
48
|
+
declare function parseDeepLinkParams(search?: string | URLSearchParams): DeepLinkParseResult;
|
|
49
|
+
/**
|
|
50
|
+
* Prefer live URL params; persist complete pairs to localStorage for refresh.
|
|
51
|
+
* If the URL has no deep-link params, fall back to a previously stored pair.
|
|
52
|
+
*/
|
|
53
|
+
declare function resolveDeepLinkParams(search?: string | URLSearchParams): DeepLinkParseResult;
|
|
54
|
+
declare function clearDeepLinkArtifacts(): void;
|
|
55
|
+
|
|
18
56
|
interface UseAiCreditsAdapterOptions {
|
|
19
57
|
environment?: AiCreditsWidgetEnvironment;
|
|
20
58
|
backendUrl?: string;
|
|
@@ -33,6 +71,6 @@ interface UseAiCreditsAdapterOptions {
|
|
|
33
71
|
}
|
|
34
72
|
declare function useAiCreditsAdapter({ environment, backendUrl, baseRpcUrl, celoRpcUrl, fundingVaultAddress, vaultAddress, goodIdAddress, goodIdReturnUrl, onPaySuccess, onPayError, backendClient: backendClientOverride, chainClient: chainClientOverride, skipVaultPaymentValidation, prepareSettlement, }: UseAiCreditsAdapterOptions): AiCreditsWidgetAdapterResult;
|
|
35
73
|
|
|
36
|
-
declare function AiCreditsWidget({ provider, connectOverride, environment, backendUrl, baseRpcUrl, celoRpcUrl, fundingVaultAddress, vaultAddress, goodIdAddress, themeOverrides, config, defaultTheme, onPaySuccess, onPayError, adapterFactory, adapterOptions, testId, }: AiCreditsWidgetProps): react_jsx_runtime.JSX.Element;
|
|
74
|
+
declare function AiCreditsWidget({ provider, connectOverride, showWalletControls, disconnectOverride, disconnectLabel, disconnectIcon, addressOverride, chainIdOverride, switchChainOverride, availableChainIdsOverride, environment, backendUrl, baseRpcUrl, celoRpcUrl, fundingVaultAddress, vaultAddress, goodIdAddress, themeOverrides, config, defaultTheme, onPaySuccess, onPayError, adapterFactory, adapterOptions, testId, }: AiCreditsWidgetProps): react_jsx_runtime.JSX.Element;
|
|
37
75
|
|
|
38
|
-
export { AccountRef, AiCreditsBackendClient, AiCreditsChainClient, type AiCreditsIntegration, AiCreditsPayErrorDetail, AiCreditsPaySuccessDetail, AiCreditsWidget, AiCreditsWidgetAdapterResult, AiCreditsWidgetEnvironment, AiCreditsWidgetProps, type UseAiCreditsAdapterOptions, aiCreditsIntegration, usdToCredits, useAiCreditsAdapter };
|
|
76
|
+
export { AccountRef, AiCreditsBackendClient, AiCreditsChainClient, type AiCreditsIntegration, AiCreditsPayErrorDetail, AiCreditsPaySuccessDetail, AiCreditsWidget, AiCreditsWidgetAdapterResult, AiCreditsWidgetEnvironment, AiCreditsWidgetProps, DEEP_LINK_MANUAL_FALLBACK_HINT, type DeepLinkParams, type DeepLinkParseResult, type SignerKeyEntry, type UseAiCreditsAdapterOptions, aiCreditsIntegration, clearDeepLinkArtifacts, clearStoredDeepLinkParams, deepLinkManualFallbackMessage, isValidOperatorSignature, isValidSignerAddress, parseDeepLinkParams, readStoredDeepLinkParams, resolveDeepLinkParams, storeDeepLinkParams, usdToCredits, useAiCreditsAdapter };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AiCreditsWidgetEnvironment, a as AiCreditsPaySuccessDetail, b as AiCreditsPayErrorDetail, c as AiCreditsBackendClient, d as AiCreditsChainClient, e as AccountRef, f as AiCreditsWidgetAdapterResult, g as AiCreditsWidgetProps } from './widgetRuntimeContract-
|
|
2
|
-
export { h as AccountEnrichment, i as AccountStatusResponse, i as AccountView, j as AiCreditsQuote, k as AiCreditsWidgetAdapterActions, l as AiCreditsWidgetAdapterFactory, m as AiCreditsWidgetAdapterFactoryInput, n as AiCreditsWidgetAdapterState, o as AiCreditsWidgetStatus, p as AiCreditsWidgetTab,
|
|
1
|
+
import { A as AiCreditsWidgetEnvironment, a as AiCreditsPaySuccessDetail, b as AiCreditsPayErrorDetail, c as AiCreditsBackendClient, d as AiCreditsChainClient, e as AccountRef, f as AiCreditsWidgetAdapterResult, g as AiCreditsWidgetProps } from './widgetRuntimeContract-Bcb5Ej6O.js';
|
|
2
|
+
export { h as AccountEnrichment, i as AccountStatusResponse, i as AccountView, j as AiCreditsQuote, k as AiCreditsWidgetAdapterActions, l as AiCreditsWidgetAdapterFactory, m as AiCreditsWidgetAdapterFactoryInput, n as AiCreditsWidgetAdapterState, o as AiCreditsWidgetStatus, p as AiCreditsWidgetTab, C as CELO_GOODID_ADDRESS, D as DEFAULT_BASE_RPC_URL, q as DEFAULT_CELO_RPC_URL, r as DEFAULT_DISCOUNT_CONFIG, s as DiscountConfig, E as Eip712SigningPayload, G as GdCreditEntry, P as ProductionAiCreditsBackendClient, S as SignerOperatorStatus, U as UnavailableAiCreditsBackendClient, t as buildAccountView, u as createBackendClient, v as createChainClient, w as enrichAccountView, x as totalCreditUsdFromProfile, y as totalCreditUsdFromStatus } from './widgetRuntimeContract-Bcb5Ej6O.js';
|
|
3
3
|
import { Address } from 'viem';
|
|
4
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
5
|
import '@goodwidget/ui';
|
|
@@ -15,6 +15,44 @@ type AiCreditsIntegration = typeof aiCreditsIntegration;
|
|
|
15
15
|
|
|
16
16
|
declare function usdToCredits(usd: string): string;
|
|
17
17
|
|
|
18
|
+
type SignerKeyEntry = {
|
|
19
|
+
privateKey?: string;
|
|
20
|
+
operatorSignature?: string;
|
|
21
|
+
operatorConsented?: boolean;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type DeepLinkParams = {
|
|
25
|
+
signerAddress: string;
|
|
26
|
+
operatorSignature: string;
|
|
27
|
+
};
|
|
28
|
+
type DeepLinkParseResult = {
|
|
29
|
+
status: 'absent';
|
|
30
|
+
} | {
|
|
31
|
+
status: 'partial';
|
|
32
|
+
present: 'signerAddress' | 'operatorSignature';
|
|
33
|
+
} | {
|
|
34
|
+
status: 'invalid';
|
|
35
|
+
reason: string;
|
|
36
|
+
} | {
|
|
37
|
+
status: 'complete';
|
|
38
|
+
value: DeepLinkParams;
|
|
39
|
+
source: 'url' | 'storage';
|
|
40
|
+
};
|
|
41
|
+
declare const DEEP_LINK_MANUAL_FALLBACK_HINT = "Generate or import a signer key manually to continue.";
|
|
42
|
+
declare function isValidSignerAddress(value: string): boolean;
|
|
43
|
+
declare function isValidOperatorSignature(value: string): boolean;
|
|
44
|
+
declare function deepLinkManualFallbackMessage(reason: string): string;
|
|
45
|
+
declare function readStoredDeepLinkParams(): DeepLinkParams | null;
|
|
46
|
+
declare function storeDeepLinkParams(value: DeepLinkParams): void;
|
|
47
|
+
declare function clearStoredDeepLinkParams(): void;
|
|
48
|
+
declare function parseDeepLinkParams(search?: string | URLSearchParams): DeepLinkParseResult;
|
|
49
|
+
/**
|
|
50
|
+
* Prefer live URL params; persist complete pairs to localStorage for refresh.
|
|
51
|
+
* If the URL has no deep-link params, fall back to a previously stored pair.
|
|
52
|
+
*/
|
|
53
|
+
declare function resolveDeepLinkParams(search?: string | URLSearchParams): DeepLinkParseResult;
|
|
54
|
+
declare function clearDeepLinkArtifacts(): void;
|
|
55
|
+
|
|
18
56
|
interface UseAiCreditsAdapterOptions {
|
|
19
57
|
environment?: AiCreditsWidgetEnvironment;
|
|
20
58
|
backendUrl?: string;
|
|
@@ -33,6 +71,6 @@ interface UseAiCreditsAdapterOptions {
|
|
|
33
71
|
}
|
|
34
72
|
declare function useAiCreditsAdapter({ environment, backendUrl, baseRpcUrl, celoRpcUrl, fundingVaultAddress, vaultAddress, goodIdAddress, goodIdReturnUrl, onPaySuccess, onPayError, backendClient: backendClientOverride, chainClient: chainClientOverride, skipVaultPaymentValidation, prepareSettlement, }: UseAiCreditsAdapterOptions): AiCreditsWidgetAdapterResult;
|
|
35
73
|
|
|
36
|
-
declare function AiCreditsWidget({ provider, connectOverride, environment, backendUrl, baseRpcUrl, celoRpcUrl, fundingVaultAddress, vaultAddress, goodIdAddress, themeOverrides, config, defaultTheme, onPaySuccess, onPayError, adapterFactory, adapterOptions, testId, }: AiCreditsWidgetProps): react_jsx_runtime.JSX.Element;
|
|
74
|
+
declare function AiCreditsWidget({ provider, connectOverride, showWalletControls, disconnectOverride, disconnectLabel, disconnectIcon, addressOverride, chainIdOverride, switchChainOverride, availableChainIdsOverride, environment, backendUrl, baseRpcUrl, celoRpcUrl, fundingVaultAddress, vaultAddress, goodIdAddress, themeOverrides, config, defaultTheme, onPaySuccess, onPayError, adapterFactory, adapterOptions, testId, }: AiCreditsWidgetProps): react_jsx_runtime.JSX.Element;
|
|
37
75
|
|
|
38
|
-
export { AccountRef, AiCreditsBackendClient, AiCreditsChainClient, type AiCreditsIntegration, AiCreditsPayErrorDetail, AiCreditsPaySuccessDetail, AiCreditsWidget, AiCreditsWidgetAdapterResult, AiCreditsWidgetEnvironment, AiCreditsWidgetProps, type UseAiCreditsAdapterOptions, aiCreditsIntegration, usdToCredits, useAiCreditsAdapter };
|
|
76
|
+
export { AccountRef, AiCreditsBackendClient, AiCreditsChainClient, type AiCreditsIntegration, AiCreditsPayErrorDetail, AiCreditsPaySuccessDetail, AiCreditsWidget, AiCreditsWidgetAdapterResult, AiCreditsWidgetEnvironment, AiCreditsWidgetProps, DEEP_LINK_MANUAL_FALLBACK_HINT, type DeepLinkParams, type DeepLinkParseResult, type SignerKeyEntry, type UseAiCreditsAdapterOptions, aiCreditsIntegration, clearDeepLinkArtifacts, clearStoredDeepLinkParams, deepLinkManualFallbackMessage, isValidOperatorSignature, isValidSignerAddress, parseDeepLinkParams, readStoredDeepLinkParams, resolveDeepLinkParams, storeDeepLinkParams, usdToCredits, useAiCreditsAdapter };
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1,37 @@
|
|
|
1
1
|
import {
|
|
2
2
|
aiCreditsIntegration
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QNDSSO77.js";
|
|
4
4
|
import {
|
|
5
5
|
AiCreditsWidget,
|
|
6
6
|
CELO_GOODID_ADDRESS,
|
|
7
|
+
DEEP_LINK_MANUAL_FALLBACK_HINT,
|
|
7
8
|
DEFAULT_BASE_RPC_URL,
|
|
8
9
|
DEFAULT_CELO_RPC_URL,
|
|
9
10
|
DEFAULT_DISCOUNT_CONFIG,
|
|
10
11
|
ProductionAiCreditsBackendClient,
|
|
11
12
|
UnavailableAiCreditsBackendClient,
|
|
12
13
|
buildAccountView,
|
|
14
|
+
clearDeepLinkArtifacts,
|
|
15
|
+
clearStoredDeepLinkParams,
|
|
13
16
|
createBackendClient,
|
|
14
17
|
createChainClient,
|
|
18
|
+
deepLinkManualFallbackMessage,
|
|
15
19
|
enrichAccountView,
|
|
20
|
+
isValidOperatorSignature,
|
|
21
|
+
isValidSignerAddress,
|
|
22
|
+
parseDeepLinkParams,
|
|
23
|
+
readStoredDeepLinkParams,
|
|
24
|
+
resolveDeepLinkParams,
|
|
25
|
+
storeDeepLinkParams,
|
|
16
26
|
totalCreditUsdFromProfile,
|
|
17
27
|
totalCreditUsdFromStatus,
|
|
18
28
|
usdToCredits,
|
|
19
29
|
useAiCreditsAdapter
|
|
20
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-635NKGPL.js";
|
|
21
31
|
export {
|
|
22
32
|
AiCreditsWidget,
|
|
23
33
|
CELO_GOODID_ADDRESS,
|
|
34
|
+
DEEP_LINK_MANUAL_FALLBACK_HINT,
|
|
24
35
|
DEFAULT_BASE_RPC_URL,
|
|
25
36
|
DEFAULT_CELO_RPC_URL,
|
|
26
37
|
DEFAULT_DISCOUNT_CONFIG,
|
|
@@ -28,9 +39,18 @@ export {
|
|
|
28
39
|
UnavailableAiCreditsBackendClient,
|
|
29
40
|
aiCreditsIntegration,
|
|
30
41
|
buildAccountView,
|
|
42
|
+
clearDeepLinkArtifacts,
|
|
43
|
+
clearStoredDeepLinkParams,
|
|
31
44
|
createBackendClient,
|
|
32
45
|
createChainClient,
|
|
46
|
+
deepLinkManualFallbackMessage,
|
|
33
47
|
enrichAccountView,
|
|
48
|
+
isValidOperatorSignature,
|
|
49
|
+
isValidSignerAddress,
|
|
50
|
+
parseDeepLinkParams,
|
|
51
|
+
readStoredDeepLinkParams,
|
|
52
|
+
resolveDeepLinkParams,
|
|
53
|
+
storeDeepLinkParams,
|
|
34
54
|
totalCreditUsdFromProfile,
|
|
35
55
|
totalCreditUsdFromStatus,
|
|
36
56
|
usdToCredits,
|