@calm-xyz/stripe 0.0.0-stage → 0.16.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.
- package/README.md +2 -2
- package/dist/index.d.ts +85 -0
- package/dist/index.js +3933 -0
- package/dist/styles.css +2 -0
- package/package.json +96 -4
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@calm-xyz/stripe`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**[docs.calmtreasury.xyz](https://docs.calmtreasury.xyz)**
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ApiError } from "@calm-xyz/core";
|
|
3
|
+
import "@tanstack/react-query";
|
|
4
|
+
import { Address } from "viem";
|
|
5
|
+
declare const CHAIN_IDS: readonly [1, 8453, 999, 1337, 4326, 143, 137, 42161, 4663, 3586256];
|
|
6
|
+
type Chain = (typeof CHAIN_IDS)[number];
|
|
7
|
+
declare const CURRENCIES: readonly ["USD", "GBP", "EUR"];
|
|
8
|
+
type Currency = (typeof CURRENCIES)[number];
|
|
9
|
+
declare const DESTINATION_TOKENS: readonly ["USDC", "USDm", "AUSD", "USDC.e", "USDG"];
|
|
10
|
+
type DestinationToken = (typeof DESTINATION_TOKENS)[number];
|
|
11
|
+
type CalmStripeDialogProps = {
|
|
12
|
+
children: React.ReactElement;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Calm's Stripe card payments in a modal dialog. Each open starts afresh.
|
|
16
|
+
*/
|
|
17
|
+
declare function CalmStripeDialog({ children }: CalmStripeDialogProps): React.JSX.Element;
|
|
18
|
+
type CalmToken = "--calm-popover" | "--calm-popover-foreground" | "--calm-primary" | "--calm-primary-foreground" | "--calm-secondary" | "--calm-secondary-foreground" | "--calm-muted" | "--calm-muted-foreground" | "--calm-accent" | "--calm-accent-foreground" | "--calm-destructive" | "--calm-destructive-foreground" | "--calm-success" | "--calm-success-foreground" | "--calm-border" | "--calm-input" | "--calm-ring" | "--calm-overlay" | "--calm-radius" | "--calm-spacing" | "--calm-text-base" | "--calm-font-sans" | "--calm-shadow-edge" | "--calm-shadow-modal";
|
|
19
|
+
type CalmTheme = Partial<Record<CalmToken, string>>;
|
|
20
|
+
type TokenStorage = {
|
|
21
|
+
kind: "sync";
|
|
22
|
+
getItem(key: string): string | null;
|
|
23
|
+
setItem(key: string, value: string): void;
|
|
24
|
+
removeItem(key: string): void;
|
|
25
|
+
} | {
|
|
26
|
+
kind: "async";
|
|
27
|
+
getItem(key: string): Promise<string | null>;
|
|
28
|
+
setItem(key: string, value: string): Promise<void>;
|
|
29
|
+
removeItem(key: string): Promise<void>;
|
|
30
|
+
};
|
|
31
|
+
type CalmRequest = {
|
|
32
|
+
apiUrl: string;
|
|
33
|
+
headers: Record<string, string>;
|
|
34
|
+
};
|
|
35
|
+
type CalmConfig = CalmRequest & {
|
|
36
|
+
publishableKey: string;
|
|
37
|
+
assetUrl: string;
|
|
38
|
+
name: string;
|
|
39
|
+
};
|
|
40
|
+
type CalmWallet = {
|
|
41
|
+
address: Address;
|
|
42
|
+
};
|
|
43
|
+
type CalmDestination = {
|
|
44
|
+
chain: Chain;
|
|
45
|
+
setChain: (next: Chain) => void;
|
|
46
|
+
destinationToken: DestinationToken;
|
|
47
|
+
};
|
|
48
|
+
type CalmRegion = {
|
|
49
|
+
country: string | undefined;
|
|
50
|
+
currency: Currency | undefined;
|
|
51
|
+
setCountry: (next: string) => void;
|
|
52
|
+
locale: string;
|
|
53
|
+
};
|
|
54
|
+
type CalmSession = {
|
|
55
|
+
sessionToken: string | null;
|
|
56
|
+
restoring: boolean;
|
|
57
|
+
setSessionToken: (token: string | null) => void;
|
|
58
|
+
forgetSessionToken: (token: string) => void;
|
|
59
|
+
signOut: () => Promise<void>;
|
|
60
|
+
};
|
|
61
|
+
type CalmStripeProviderProps = {
|
|
62
|
+
address: Address;
|
|
63
|
+
apiUrl?: string;
|
|
64
|
+
name: string;
|
|
65
|
+
chain: Chain;
|
|
66
|
+
destinationToken: DestinationToken;
|
|
67
|
+
country?: string;
|
|
68
|
+
locale?: string;
|
|
69
|
+
assetUrl?: string;
|
|
70
|
+
children: React.ReactNode;
|
|
71
|
+
publishableKey: string;
|
|
72
|
+
tokenStorage: TokenStorage;
|
|
73
|
+
};
|
|
74
|
+
type CalmContext = Pick<CalmConfig, "apiUrl" | "name" | "assetUrl"> & Pick<CalmWallet, "address"> & CalmDestination & CalmRegion & Pick<CalmSession, "signOut">;
|
|
75
|
+
/**
|
|
76
|
+
* Reads the Calm context from the nearest `<CalmProvider>`.
|
|
77
|
+
*
|
|
78
|
+
* @see https://docs.calmtreasury.xyz/sdk/react/useCalm
|
|
79
|
+
*/
|
|
80
|
+
declare function useCalm(): CalmContext;
|
|
81
|
+
type CalmProviderProps = Omit<CalmStripeProviderProps, "tokenStorage"> & {
|
|
82
|
+
theme?: CalmTheme;
|
|
83
|
+
};
|
|
84
|
+
declare function CalmProvider({ locale, theme, children, ...props }: CalmProviderProps): React.JSX.Element;
|
|
85
|
+
export { type CalmContext, CalmProvider, type CalmProviderProps, CalmStripeDialog, type CalmStripeDialogProps, type CalmTheme, type CalmToken, type Chain, type Currency, type DestinationToken, useCalm };
|