@arcenpay/react 0.0.1

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 (101) hide show
  1. package/README.md +124 -0
  2. package/dist/add-LG363GP4.mjs +34 -0
  3. package/dist/all-wallets-UW4KSWDQ.mjs +25 -0
  4. package/dist/app-store-GOSERMQC.mjs +36 -0
  5. package/dist/apple-Y34SY63H.mjs +37 -0
  6. package/dist/arrow-bottom-YDRRJYRC.mjs +27 -0
  7. package/dist/arrow-bottom-circle-XSCE7Y52.mjs +30 -0
  8. package/dist/arrow-left-VMP4J3ME.mjs +27 -0
  9. package/dist/arrow-right-FSU7ZETV.mjs +27 -0
  10. package/dist/arrow-top-SQNMDYUF.mjs +27 -0
  11. package/dist/bank-DO6DNPBT.mjs +33 -0
  12. package/dist/basic-3OAVXLDO.mjs +10769 -0
  13. package/dist/browser-BI7YYLKK.mjs +33 -0
  14. package/dist/card-F2CIEB7K.mjs +33 -0
  15. package/dist/checkmark-YASK3T7D.mjs +30 -0
  16. package/dist/checkmark-bold-UJRS6R4T.mjs +27 -0
  17. package/dist/chevron-bottom-Z7YOJH7F.mjs +27 -0
  18. package/dist/chevron-left-YPDPGZVV.mjs +27 -0
  19. package/dist/chevron-right-4464VKIO.mjs +27 -0
  20. package/dist/chevron-top-6F4WXRKZ.mjs +27 -0
  21. package/dist/chrome-store-KH57RD54.mjs +80 -0
  22. package/dist/chunk-5MZNFSFK.mjs +1273 -0
  23. package/dist/chunk-ALKFEKMG.mjs +8108 -0
  24. package/dist/chunk-GUHCPHEG.mjs +768 -0
  25. package/dist/chunk-HPVNNTYF.mjs +7546 -0
  26. package/dist/chunk-LACDYDLO.mjs +402 -0
  27. package/dist/chunk-LGBIIGSV.mjs +39793 -0
  28. package/dist/chunk-M4NAIVF3.mjs +93283 -0
  29. package/dist/chunk-QILMZVJE.mjs +11957 -0
  30. package/dist/chunk-RKV353G3.mjs +272 -0
  31. package/dist/chunk-X2BMVUAF.mjs +50 -0
  32. package/dist/chunk-ZKNFAGRN.mjs +1414 -0
  33. package/dist/clock-WGC5S5SU.mjs +27 -0
  34. package/dist/close-HJ6ZBPVZ.mjs +27 -0
  35. package/dist/coinPlaceholder-UOKFKY4T.mjs +27 -0
  36. package/dist/compass-WAYDVX5E.mjs +27 -0
  37. package/dist/copy-OPJY4AKY.mjs +34 -0
  38. package/dist/core-GECUTVXD.mjs +10138 -0
  39. package/dist/cursor-PAYF2D2S.mjs +22 -0
  40. package/dist/cursor-transparent-T4M3KZJ2.mjs +31 -0
  41. package/dist/desktop-QSXXA65J.mjs +28 -0
  42. package/dist/disconnect-7NMPCP66.mjs +27 -0
  43. package/dist/discord-KRLKWIM5.mjs +36 -0
  44. package/dist/etherscan-TAXMMDC4.mjs +25 -0
  45. package/dist/exclamation-triangle-MW7PXM5B.mjs +23 -0
  46. package/dist/extension-LAAZQU7X.mjs +27 -0
  47. package/dist/external-link-IFBQ3MSI.mjs +27 -0
  48. package/dist/facebook-PAENGKOR.mjs +45 -0
  49. package/dist/farcaster-P47HCAAY.mjs +31 -0
  50. package/dist/filters-4HNPLZQV.mjs +27 -0
  51. package/dist/github-RO4C47BJ.mjs +37 -0
  52. package/dist/google-RIBTWZH2.mjs +37 -0
  53. package/dist/help-circle-PN7NOOY4.mjs +31 -0
  54. package/dist/id-JYBNXVYQ.mjs +31 -0
  55. package/dist/image-FUPENKKO.mjs +23 -0
  56. package/dist/index.d.mts +288 -0
  57. package/dist/index.d.ts +288 -0
  58. package/dist/index.js +295316 -0
  59. package/dist/index.mjs +7936 -0
  60. package/dist/info-34PNUQRI.mjs +22 -0
  61. package/dist/info-circle-M5CXNBEA.mjs +31 -0
  62. package/dist/lightbulb-CPZO66W6.mjs +22 -0
  63. package/dist/mail-RAF36J77.mjs +27 -0
  64. package/dist/mobile-ZLFYOCHK.mjs +28 -0
  65. package/dist/more-CIHKDQMO.mjs +30 -0
  66. package/dist/network-placeholder-QOMFBWMT.mjs +33 -0
  67. package/dist/nftPlaceholder-7TK2T2QP.mjs +27 -0
  68. package/dist/off-WWNLGDOR.mjs +27 -0
  69. package/dist/play-store-HLZSDCUP.mjs +51 -0
  70. package/dist/plus-SCLTSRAT.mjs +32 -0
  71. package/dist/qr-code-T7FWUJU6.mjs +25 -0
  72. package/dist/recycle-horizontal-WRR5I5MX.mjs +28 -0
  73. package/dist/refresh-6AQ524CD.mjs +27 -0
  74. package/dist/reown-logo-NJCCGFTU.mjs +31 -0
  75. package/dist/search-HXD6I5XQ.mjs +27 -0
  76. package/dist/send-3N2W3TJ6.mjs +34 -0
  77. package/dist/src-DKYFVWPL.mjs +7 -0
  78. package/dist/src-HMFDWVJP.mjs +5 -0
  79. package/dist/src-TV3VFBF5.mjs +98950 -0
  80. package/dist/swapHorizontal-KPYCPFL4.mjs +27 -0
  81. package/dist/swapHorizontalBold-WCO2BX6U.mjs +27 -0
  82. package/dist/swapHorizontalMedium-SCPLSG7N.mjs +35 -0
  83. package/dist/swapHorizontalRoundedBold-YX7IIFNL.mjs +27 -0
  84. package/dist/swapVertical-XS35BJ2R.mjs +27 -0
  85. package/dist/telegram-RIP72IGI.mjs +35 -0
  86. package/dist/three-dots-IPE2YG6Z.mjs +24 -0
  87. package/dist/twitch-5K6DAEPG.mjs +37 -0
  88. package/dist/twitterIcon-U3V7EFPB.mjs +25 -0
  89. package/dist/verify-JML7EMVO.mjs +27 -0
  90. package/dist/verify-filled-R5MYOEEJ.mjs +27 -0
  91. package/dist/w3m-modal-LW2TBGRA.mjs +2042 -0
  92. package/dist/wallet-AJFVN7JZ.mjs +27 -0
  93. package/dist/wallet-placeholder-4QSRXVF5.mjs +33 -0
  94. package/dist/walletconnect-G267PBVT.mjs +53 -0
  95. package/dist/warning-circle-2KJXNGLQ.mjs +31 -0
  96. package/dist/x-MTQL7KFF.mjs +31 -0
  97. package/dist/zerodev.d.mts +106 -0
  98. package/dist/zerodev.d.ts +106 -0
  99. package/dist/zerodev.js +420 -0
  100. package/dist/zerodev.mjs +17 -0
  101. package/package.json +78 -0
@@ -0,0 +1,288 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React, { ReactNode } from 'react';
3
+ import { NetworkConfig, PlanTier, ContractAddresses, ComponentRenderData, ComponentDesign, ComponentElement, ArcenCompanyKeys, ArcenUserKeys, EntitlementSources, EntitlementFreshness, ConsumeEntitlementResult } from '@arcenpay/sdk';
4
+ export { ArcenCompanyKeys, ArcenUserKeys, ComponentDesign, ComponentElement, ComponentRenderData, ConsumeEntitlementResult, EntitlementResult, FlagResult, IdentifyResult, InvoiceSummary, Plan } from '@arcenpay/sdk';
5
+
6
+ interface ArcenPayContextValue {
7
+ session: ArcenSessionValue;
8
+ identify: ArcenSessionValue["identify"];
9
+ config: ArcenPayConfig;
10
+ contracts: ContractAddresses;
11
+ network: NetworkConfig;
12
+ isTestnet: boolean;
13
+ /** Resolved component ID for ArcenEmbed. */
14
+ componentId: string;
15
+ }
16
+ interface ArcenPayConfig {
17
+ network: NetworkConfig;
18
+ litNetwork?: string;
19
+ tablelandConfig?: {
20
+ providerUrl?: string;
21
+ featureFlagsEndpoint?: string;
22
+ };
23
+ tierFeatureFallback?: Partial<Record<PlanTier, Record<string, boolean | string | number>>>;
24
+ }
25
+ interface ArcenSessionValue {
26
+ /** Whether the provider is initialized and ready */
27
+ isReady: boolean;
28
+ /** Current session token (auto-managed) */
29
+ token: string | null;
30
+ /** Identified company */
31
+ company: ArcenCompanyIdentity | null;
32
+ /** Identified user */
33
+ user: ArcenUserIdentity | null;
34
+ /**
35
+ * Identify a company/user to establish context for all hooks/components.
36
+ * Call once after your app's auth flow resolves.
37
+ */
38
+ identify: (input: ArcenIdentifyInput) => Promise<void>;
39
+ }
40
+ interface ArcenCompanyIdentity {
41
+ id?: string;
42
+ wallet?: string;
43
+ email?: string;
44
+ name?: string;
45
+ traits?: Record<string, unknown>;
46
+ }
47
+ interface ArcenUserIdentity {
48
+ id?: string;
49
+ clerkUserId?: string;
50
+ wallet?: string;
51
+ email?: string;
52
+ name?: string;
53
+ }
54
+ interface ArcenIdentifyInput {
55
+ company?: ArcenCompanyIdentity;
56
+ user?: ArcenUserIdentity;
57
+ }
58
+ interface ArcenPayProviderProps {
59
+ children: ReactNode;
60
+ /** Optional config overrides for advanced/custom integrations. */
61
+ config?: Partial<ArcenPayConfig>;
62
+ /**
63
+ * API key from the ArcenPay dashboard (Settings → API Keys).
64
+ * This is the ONLY required prop. Everything else is auto-detected.
65
+ */
66
+ publishableKey?: string;
67
+ /**
68
+ * Component ID for ArcenEmbed.
69
+ * Reads NEXT_PUBLIC_ARCENPAY_COMPONENT_ID env var by default.
70
+ */
71
+ componentId?: string;
72
+ /** @deprecated Use env vars or defaults. Auto-detected from NEXT_PUBLIC_CHAIN_ID, defaults to Base Sepolia. */
73
+ chainId?: number;
74
+ /** @deprecated Auto-detected. Only pass for local or staging overrides. */
75
+ baseUrl?: string;
76
+ /** @deprecated Auto-detected. */
77
+ walletConnectProjectId?: string;
78
+ }
79
+ declare function ArcenPayProvider(props: ArcenPayProviderProps): react_jsx_runtime.JSX.Element;
80
+ /**
81
+ * Access the full ArcenPay context.
82
+ * Must be called inside an <ArcenPayProvider>.
83
+ *
84
+ * @example
85
+ * const { session, identify } = useArcenPay();
86
+ * await identify({ company: { id: "company_1" } });
87
+ */
88
+ declare function useArcenPay(): ArcenPayContextValue & {
89
+ identify: ArcenSessionValue["identify"];
90
+ };
91
+
92
+ interface ArcenEmbedProps {
93
+ /** Short-lived access token. When omitted, auto-reads from NEXT_PUBLIC_ARCENPAY_ACCESS_TOKEN env var. */
94
+ accessToken?: string;
95
+ /** Component ID from the dashboard. Reads NEXT_PUBLIC_ARCENPAY_COMPONENT_ID env var by default. */
96
+ componentId?: string;
97
+ /** @deprecated Use componentId */
98
+ id?: string;
99
+ className?: string;
100
+ style?: React.CSSProperties;
101
+ mockData?: ComponentRenderData;
102
+ initialView?: PortalView;
103
+ onViewChange?: (view: PortalView) => void;
104
+ onPlanChange?: (planId: string) => void;
105
+ mode?: "inline" | "modal";
106
+ }
107
+ type PortalView = "portal" | "checkout" | "payment" | "unsubscribe" | "success";
108
+ declare function getDesignTokens(design: ComponentDesign): {
109
+ primary: string;
110
+ font: string;
111
+ size: number;
112
+ textColor: string;
113
+ bg: string;
114
+ radius: number;
115
+ cardBorder: string;
116
+ cardShadow: string;
117
+ mutedColor: string;
118
+ columns: number;
119
+ sections: "merged" | "separate";
120
+ };
121
+ type Tokens = ReturnType<typeof getDesignTokens>;
122
+
123
+ declare function renderElement(el: ComponentElement & Record<string, unknown>, index: number, data: ComponentRenderData, tokens: Tokens, onChangePlan: () => void, onUnsubscribe: () => void, onResumeSubscription: () => void, allowPlanChanges?: boolean, allowCancellation?: boolean): React.ReactNode;
124
+ declare function ArcenEmbed({ accessToken, componentId, id, className, style, mockData, initialView, onViewChange, onPlanChange, mode, }: ArcenEmbedProps): react_jsx_runtime.JSX.Element | null;
125
+ /**
126
+ * ArcenpayEmbed — alias for `ArcenEmbed`.
127
+ *
128
+ * @example
129
+ * import { ArcenpayEmbed } from '@arcenpay/react';
130
+ *
131
+ * <ArcenpayEmbed
132
+ * accessToken={tokenFromBackend}
133
+ * id="cmn_xxx"
134
+ * />
135
+ */
136
+ declare const ArcenpayEmbed: typeof ArcenEmbed;
137
+ type ArcenpayEmbedProps = ArcenEmbedProps;
138
+
139
+ interface FeatureFlagGuardProps {
140
+ featureKey: string;
141
+ walletAddress: string;
142
+ children: ReactNode;
143
+ fallback?: ReactNode;
144
+ className?: string;
145
+ /** Require a successful Lit decrypt probe in addition to feature entitlement. */
146
+ requireDecryption?: boolean;
147
+ /**
148
+ * Optional Lit decrypt endpoint (HTTP proxy mode).
149
+ * Supports `{wallet}` and `{feature}` placeholders.
150
+ * If omitted and requireDecryption=true, falls back to direct Lit SDK.
151
+ */
152
+ decryptEndpoint?: string;
153
+ /** Optional request payload merged into the decryption request body. */
154
+ decryptPayload?: Record<string, unknown>;
155
+ onDecryptionSuccess?: (result: unknown) => void;
156
+ onDecryptionError?: (error: Error) => void;
157
+ }
158
+ declare function FeatureFlagGuard({ featureKey, walletAddress, children, fallback, className, requireDecryption, decryptEndpoint, decryptPayload, onDecryptionSuccess, onDecryptionError, }: FeatureFlagGuardProps): react_jsx_runtime.JSX.Element;
159
+
160
+ type TemplateBlock = {
161
+ type: 'heading' | 'text' | 'price' | 'feature-list' | 'cta';
162
+ content?: string;
163
+ amount?: string;
164
+ interval?: string;
165
+ items?: string[];
166
+ href?: string;
167
+ };
168
+ interface TemplateRendererProps {
169
+ name: string;
170
+ blocks: TemplateBlock[];
171
+ className?: string;
172
+ }
173
+ /**
174
+ * Renders a billing template from JSON blocks.
175
+ * This powers the internal template library install output.
176
+ */
177
+ declare function TemplateRenderer({ name, blocks, className, }: TemplateRendererProps): react_jsx_runtime.JSX.Element;
178
+
179
+ /**
180
+ * Check a single feature flag.
181
+ *
182
+ * @example
183
+ * // Inside <ArcenPayProvider> with company identified
184
+ * const isEnabled = useFlag("premium-features");
185
+ */
186
+ declare function useFlag(featureKey: string): boolean;
187
+ /** @deprecated Pass companyKeys via ArcenPayProvider.identify() instead. */
188
+ declare function useFlag(featureKey: string, companyKeys: ArcenCompanyKeys, userKeys?: ArcenUserKeys): boolean;
189
+ /**
190
+ * Check multiple feature flags at once.
191
+ *
192
+ * @example
193
+ * const flags = useFlags(["premium", "beta", "api-access"]);
194
+ * // flags = { premium: true, beta: false, "api-access": true }
195
+ */
196
+ declare function useFlags(featureKeys: string[]): Record<string, boolean>;
197
+ /** @deprecated Pass companyKeys via ArcenPayProvider.identify() instead. */
198
+ declare function useFlags(featureKeys: string[], companyKeys: ArcenCompanyKeys, userKeys?: ArcenUserKeys): Record<string, boolean>;
199
+
200
+ interface UseEntitlementReturn {
201
+ isSubscribed: boolean;
202
+ planTier: PlanTier | null;
203
+ features: Record<string, boolean | string | number>;
204
+ expiresAt: bigint | null;
205
+ tokenId: bigint | null;
206
+ sources: EntitlementSources;
207
+ freshness: EntitlementFreshness;
208
+ isLoading: boolean;
209
+ error: Error | null;
210
+ refetch: () => void;
211
+ }
212
+ declare const ENTITLEMENT_ERROR_CODES: {
213
+ readonly INVALID_WALLET_ADDRESS: "INVALID_WALLET_ADDRESS";
214
+ readonly ONCHAIN_READ_FAILED: "ONCHAIN_READ_FAILED";
215
+ readonly TABLELAND_FETCH_FAILED: "TABLELAND_FETCH_FAILED";
216
+ readonly DASHBOARD_FETCH_FAILED: "DASHBOARD_FETCH_FAILED";
217
+ readonly UNKNOWN: "UNKNOWN";
218
+ };
219
+ type EntitlementErrorCode = (typeof ENTITLEMENT_ERROR_CODES)[keyof typeof ENTITLEMENT_ERROR_CODES];
220
+ declare class EntitlementError extends Error {
221
+ readonly code: EntitlementErrorCode;
222
+ readonly cause?: unknown;
223
+ constructor(code: EntitlementErrorCode, message: string, cause?: unknown);
224
+ }
225
+ /**
226
+ * useEntitlement — Programmatic access to entitlement state
227
+ *
228
+ * Performs real on-chain reads against SubscriptionRegistry:
229
+ * 1. getWalletSubscription(wallet) → tokenId
230
+ * 2. hasActiveSubscription(wallet) → confirm the mapping still points to a live token
231
+ * 3. isValid(tokenId)
232
+ * 4. expiresAt(tokenId)
233
+ * 5. getPlanFeatures(tokenId) → { planId, planTier }
234
+ *
235
+ * Feature values are resolved with this precedence:
236
+ * 1. dashboard company entitlements when an Arcen session token is available
237
+ * 2. wallet/provider compatibility endpoint
238
+ * 3. on-chain tierFeatureFallback
239
+ *
240
+ * When featureKey is provided, the resolved features map is filtered to that
241
+ * single key — useful for lightweight gating checks.
242
+ *
243
+ * @param walletAddress - The wallet address to check
244
+ * @param featureKey - Optional: restrict resolved features to this single key
245
+ *
246
+ * @example
247
+ * ```tsx
248
+ * const { isSubscribed, planTier, expiresAt } = useEntitlement(address);
249
+ * const { features } = useEntitlement(address, 'analytics_dashboard');
250
+ * ```
251
+ */
252
+ declare function useEntitlement(walletAddress?: string, featureKey?: string): UseEntitlementReturn;
253
+
254
+ /**
255
+ * Consume a metered entitlement (e.g., "api-calls").
256
+ * Company context comes from ArcenPayProvider.
257
+ *
258
+ * @example
259
+ * const { consume } = useConsumeEntitlement();
260
+ * const result = await consume("api-calls");
261
+ * // result = { enabled: true, consumed: true, usage: 5, limit: 100 }
262
+ */
263
+ declare function useConsumeEntitlement(): {
264
+ consume: (featureKey: string) => Promise<ConsumeEntitlementResult>;
265
+ loading: boolean;
266
+ error: string | null;
267
+ };
268
+
269
+ interface TrackEventInput {
270
+ name: string;
271
+ traits?: Record<string, unknown>;
272
+ idempotencyKey?: string;
273
+ }
274
+ /**
275
+ * Send usage/analytics events to the ArcenPay dashboard.
276
+ * Company/user context is read from the Provider.
277
+ *
278
+ * @example
279
+ * const { track } = useTrack();
280
+ * track("page_view", { page: "/dashboard" });
281
+ */
282
+ declare function useTrack(): {
283
+ track: (name: string, traits?: Record<string, unknown>) => Promise<void>;
284
+ };
285
+
286
+ declare function createPaymentLinkCheckoutUrl(slug: string, baseUrl?: string): string;
287
+
288
+ export { type ArcenCompanyIdentity, ArcenEmbed, type ArcenEmbedProps, type ArcenIdentifyInput, type ArcenPayContextValue, ArcenPayProvider, type ArcenPayProviderProps, type ArcenSessionValue, type ArcenUserIdentity, ArcenpayEmbed, type ArcenpayEmbedProps, ENTITLEMENT_ERROR_CODES, EntitlementError, type EntitlementErrorCode, FeatureFlagGuard, type TemplateBlock, TemplateRenderer, type TemplateRendererProps, type Tokens, type TrackEventInput, createPaymentLinkCheckoutUrl, getDesignTokens, renderElement, useArcenPay, useConsumeEntitlement, useEntitlement, useFlag, useFlags, useTrack };
@@ -0,0 +1,288 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React, { ReactNode } from 'react';
3
+ import { NetworkConfig, PlanTier, ContractAddresses, ComponentRenderData, ComponentDesign, ComponentElement, ArcenCompanyKeys, ArcenUserKeys, EntitlementSources, EntitlementFreshness, ConsumeEntitlementResult } from '@arcenpay/sdk';
4
+ export { ArcenCompanyKeys, ArcenUserKeys, ComponentDesign, ComponentElement, ComponentRenderData, ConsumeEntitlementResult, EntitlementResult, FlagResult, IdentifyResult, InvoiceSummary, Plan } from '@arcenpay/sdk';
5
+
6
+ interface ArcenPayContextValue {
7
+ session: ArcenSessionValue;
8
+ identify: ArcenSessionValue["identify"];
9
+ config: ArcenPayConfig;
10
+ contracts: ContractAddresses;
11
+ network: NetworkConfig;
12
+ isTestnet: boolean;
13
+ /** Resolved component ID for ArcenEmbed. */
14
+ componentId: string;
15
+ }
16
+ interface ArcenPayConfig {
17
+ network: NetworkConfig;
18
+ litNetwork?: string;
19
+ tablelandConfig?: {
20
+ providerUrl?: string;
21
+ featureFlagsEndpoint?: string;
22
+ };
23
+ tierFeatureFallback?: Partial<Record<PlanTier, Record<string, boolean | string | number>>>;
24
+ }
25
+ interface ArcenSessionValue {
26
+ /** Whether the provider is initialized and ready */
27
+ isReady: boolean;
28
+ /** Current session token (auto-managed) */
29
+ token: string | null;
30
+ /** Identified company */
31
+ company: ArcenCompanyIdentity | null;
32
+ /** Identified user */
33
+ user: ArcenUserIdentity | null;
34
+ /**
35
+ * Identify a company/user to establish context for all hooks/components.
36
+ * Call once after your app's auth flow resolves.
37
+ */
38
+ identify: (input: ArcenIdentifyInput) => Promise<void>;
39
+ }
40
+ interface ArcenCompanyIdentity {
41
+ id?: string;
42
+ wallet?: string;
43
+ email?: string;
44
+ name?: string;
45
+ traits?: Record<string, unknown>;
46
+ }
47
+ interface ArcenUserIdentity {
48
+ id?: string;
49
+ clerkUserId?: string;
50
+ wallet?: string;
51
+ email?: string;
52
+ name?: string;
53
+ }
54
+ interface ArcenIdentifyInput {
55
+ company?: ArcenCompanyIdentity;
56
+ user?: ArcenUserIdentity;
57
+ }
58
+ interface ArcenPayProviderProps {
59
+ children: ReactNode;
60
+ /** Optional config overrides for advanced/custom integrations. */
61
+ config?: Partial<ArcenPayConfig>;
62
+ /**
63
+ * API key from the ArcenPay dashboard (Settings → API Keys).
64
+ * This is the ONLY required prop. Everything else is auto-detected.
65
+ */
66
+ publishableKey?: string;
67
+ /**
68
+ * Component ID for ArcenEmbed.
69
+ * Reads NEXT_PUBLIC_ARCENPAY_COMPONENT_ID env var by default.
70
+ */
71
+ componentId?: string;
72
+ /** @deprecated Use env vars or defaults. Auto-detected from NEXT_PUBLIC_CHAIN_ID, defaults to Base Sepolia. */
73
+ chainId?: number;
74
+ /** @deprecated Auto-detected. Only pass for local or staging overrides. */
75
+ baseUrl?: string;
76
+ /** @deprecated Auto-detected. */
77
+ walletConnectProjectId?: string;
78
+ }
79
+ declare function ArcenPayProvider(props: ArcenPayProviderProps): react_jsx_runtime.JSX.Element;
80
+ /**
81
+ * Access the full ArcenPay context.
82
+ * Must be called inside an <ArcenPayProvider>.
83
+ *
84
+ * @example
85
+ * const { session, identify } = useArcenPay();
86
+ * await identify({ company: { id: "company_1" } });
87
+ */
88
+ declare function useArcenPay(): ArcenPayContextValue & {
89
+ identify: ArcenSessionValue["identify"];
90
+ };
91
+
92
+ interface ArcenEmbedProps {
93
+ /** Short-lived access token. When omitted, auto-reads from NEXT_PUBLIC_ARCENPAY_ACCESS_TOKEN env var. */
94
+ accessToken?: string;
95
+ /** Component ID from the dashboard. Reads NEXT_PUBLIC_ARCENPAY_COMPONENT_ID env var by default. */
96
+ componentId?: string;
97
+ /** @deprecated Use componentId */
98
+ id?: string;
99
+ className?: string;
100
+ style?: React.CSSProperties;
101
+ mockData?: ComponentRenderData;
102
+ initialView?: PortalView;
103
+ onViewChange?: (view: PortalView) => void;
104
+ onPlanChange?: (planId: string) => void;
105
+ mode?: "inline" | "modal";
106
+ }
107
+ type PortalView = "portal" | "checkout" | "payment" | "unsubscribe" | "success";
108
+ declare function getDesignTokens(design: ComponentDesign): {
109
+ primary: string;
110
+ font: string;
111
+ size: number;
112
+ textColor: string;
113
+ bg: string;
114
+ radius: number;
115
+ cardBorder: string;
116
+ cardShadow: string;
117
+ mutedColor: string;
118
+ columns: number;
119
+ sections: "merged" | "separate";
120
+ };
121
+ type Tokens = ReturnType<typeof getDesignTokens>;
122
+
123
+ declare function renderElement(el: ComponentElement & Record<string, unknown>, index: number, data: ComponentRenderData, tokens: Tokens, onChangePlan: () => void, onUnsubscribe: () => void, onResumeSubscription: () => void, allowPlanChanges?: boolean, allowCancellation?: boolean): React.ReactNode;
124
+ declare function ArcenEmbed({ accessToken, componentId, id, className, style, mockData, initialView, onViewChange, onPlanChange, mode, }: ArcenEmbedProps): react_jsx_runtime.JSX.Element | null;
125
+ /**
126
+ * ArcenpayEmbed — alias for `ArcenEmbed`.
127
+ *
128
+ * @example
129
+ * import { ArcenpayEmbed } from '@arcenpay/react';
130
+ *
131
+ * <ArcenpayEmbed
132
+ * accessToken={tokenFromBackend}
133
+ * id="cmn_xxx"
134
+ * />
135
+ */
136
+ declare const ArcenpayEmbed: typeof ArcenEmbed;
137
+ type ArcenpayEmbedProps = ArcenEmbedProps;
138
+
139
+ interface FeatureFlagGuardProps {
140
+ featureKey: string;
141
+ walletAddress: string;
142
+ children: ReactNode;
143
+ fallback?: ReactNode;
144
+ className?: string;
145
+ /** Require a successful Lit decrypt probe in addition to feature entitlement. */
146
+ requireDecryption?: boolean;
147
+ /**
148
+ * Optional Lit decrypt endpoint (HTTP proxy mode).
149
+ * Supports `{wallet}` and `{feature}` placeholders.
150
+ * If omitted and requireDecryption=true, falls back to direct Lit SDK.
151
+ */
152
+ decryptEndpoint?: string;
153
+ /** Optional request payload merged into the decryption request body. */
154
+ decryptPayload?: Record<string, unknown>;
155
+ onDecryptionSuccess?: (result: unknown) => void;
156
+ onDecryptionError?: (error: Error) => void;
157
+ }
158
+ declare function FeatureFlagGuard({ featureKey, walletAddress, children, fallback, className, requireDecryption, decryptEndpoint, decryptPayload, onDecryptionSuccess, onDecryptionError, }: FeatureFlagGuardProps): react_jsx_runtime.JSX.Element;
159
+
160
+ type TemplateBlock = {
161
+ type: 'heading' | 'text' | 'price' | 'feature-list' | 'cta';
162
+ content?: string;
163
+ amount?: string;
164
+ interval?: string;
165
+ items?: string[];
166
+ href?: string;
167
+ };
168
+ interface TemplateRendererProps {
169
+ name: string;
170
+ blocks: TemplateBlock[];
171
+ className?: string;
172
+ }
173
+ /**
174
+ * Renders a billing template from JSON blocks.
175
+ * This powers the internal template library install output.
176
+ */
177
+ declare function TemplateRenderer({ name, blocks, className, }: TemplateRendererProps): react_jsx_runtime.JSX.Element;
178
+
179
+ /**
180
+ * Check a single feature flag.
181
+ *
182
+ * @example
183
+ * // Inside <ArcenPayProvider> with company identified
184
+ * const isEnabled = useFlag("premium-features");
185
+ */
186
+ declare function useFlag(featureKey: string): boolean;
187
+ /** @deprecated Pass companyKeys via ArcenPayProvider.identify() instead. */
188
+ declare function useFlag(featureKey: string, companyKeys: ArcenCompanyKeys, userKeys?: ArcenUserKeys): boolean;
189
+ /**
190
+ * Check multiple feature flags at once.
191
+ *
192
+ * @example
193
+ * const flags = useFlags(["premium", "beta", "api-access"]);
194
+ * // flags = { premium: true, beta: false, "api-access": true }
195
+ */
196
+ declare function useFlags(featureKeys: string[]): Record<string, boolean>;
197
+ /** @deprecated Pass companyKeys via ArcenPayProvider.identify() instead. */
198
+ declare function useFlags(featureKeys: string[], companyKeys: ArcenCompanyKeys, userKeys?: ArcenUserKeys): Record<string, boolean>;
199
+
200
+ interface UseEntitlementReturn {
201
+ isSubscribed: boolean;
202
+ planTier: PlanTier | null;
203
+ features: Record<string, boolean | string | number>;
204
+ expiresAt: bigint | null;
205
+ tokenId: bigint | null;
206
+ sources: EntitlementSources;
207
+ freshness: EntitlementFreshness;
208
+ isLoading: boolean;
209
+ error: Error | null;
210
+ refetch: () => void;
211
+ }
212
+ declare const ENTITLEMENT_ERROR_CODES: {
213
+ readonly INVALID_WALLET_ADDRESS: "INVALID_WALLET_ADDRESS";
214
+ readonly ONCHAIN_READ_FAILED: "ONCHAIN_READ_FAILED";
215
+ readonly TABLELAND_FETCH_FAILED: "TABLELAND_FETCH_FAILED";
216
+ readonly DASHBOARD_FETCH_FAILED: "DASHBOARD_FETCH_FAILED";
217
+ readonly UNKNOWN: "UNKNOWN";
218
+ };
219
+ type EntitlementErrorCode = (typeof ENTITLEMENT_ERROR_CODES)[keyof typeof ENTITLEMENT_ERROR_CODES];
220
+ declare class EntitlementError extends Error {
221
+ readonly code: EntitlementErrorCode;
222
+ readonly cause?: unknown;
223
+ constructor(code: EntitlementErrorCode, message: string, cause?: unknown);
224
+ }
225
+ /**
226
+ * useEntitlement — Programmatic access to entitlement state
227
+ *
228
+ * Performs real on-chain reads against SubscriptionRegistry:
229
+ * 1. getWalletSubscription(wallet) → tokenId
230
+ * 2. hasActiveSubscription(wallet) → confirm the mapping still points to a live token
231
+ * 3. isValid(tokenId)
232
+ * 4. expiresAt(tokenId)
233
+ * 5. getPlanFeatures(tokenId) → { planId, planTier }
234
+ *
235
+ * Feature values are resolved with this precedence:
236
+ * 1. dashboard company entitlements when an Arcen session token is available
237
+ * 2. wallet/provider compatibility endpoint
238
+ * 3. on-chain tierFeatureFallback
239
+ *
240
+ * When featureKey is provided, the resolved features map is filtered to that
241
+ * single key — useful for lightweight gating checks.
242
+ *
243
+ * @param walletAddress - The wallet address to check
244
+ * @param featureKey - Optional: restrict resolved features to this single key
245
+ *
246
+ * @example
247
+ * ```tsx
248
+ * const { isSubscribed, planTier, expiresAt } = useEntitlement(address);
249
+ * const { features } = useEntitlement(address, 'analytics_dashboard');
250
+ * ```
251
+ */
252
+ declare function useEntitlement(walletAddress?: string, featureKey?: string): UseEntitlementReturn;
253
+
254
+ /**
255
+ * Consume a metered entitlement (e.g., "api-calls").
256
+ * Company context comes from ArcenPayProvider.
257
+ *
258
+ * @example
259
+ * const { consume } = useConsumeEntitlement();
260
+ * const result = await consume("api-calls");
261
+ * // result = { enabled: true, consumed: true, usage: 5, limit: 100 }
262
+ */
263
+ declare function useConsumeEntitlement(): {
264
+ consume: (featureKey: string) => Promise<ConsumeEntitlementResult>;
265
+ loading: boolean;
266
+ error: string | null;
267
+ };
268
+
269
+ interface TrackEventInput {
270
+ name: string;
271
+ traits?: Record<string, unknown>;
272
+ idempotencyKey?: string;
273
+ }
274
+ /**
275
+ * Send usage/analytics events to the ArcenPay dashboard.
276
+ * Company/user context is read from the Provider.
277
+ *
278
+ * @example
279
+ * const { track } = useTrack();
280
+ * track("page_view", { page: "/dashboard" });
281
+ */
282
+ declare function useTrack(): {
283
+ track: (name: string, traits?: Record<string, unknown>) => Promise<void>;
284
+ };
285
+
286
+ declare function createPaymentLinkCheckoutUrl(slug: string, baseUrl?: string): string;
287
+
288
+ export { type ArcenCompanyIdentity, ArcenEmbed, type ArcenEmbedProps, type ArcenIdentifyInput, type ArcenPayContextValue, ArcenPayProvider, type ArcenPayProviderProps, type ArcenSessionValue, type ArcenUserIdentity, ArcenpayEmbed, type ArcenpayEmbedProps, ENTITLEMENT_ERROR_CODES, EntitlementError, type EntitlementErrorCode, FeatureFlagGuard, type TemplateBlock, TemplateRenderer, type TemplateRendererProps, type Tokens, type TrackEventInput, createPaymentLinkCheckoutUrl, getDesignTokens, renderElement, useArcenPay, useConsumeEntitlement, useEntitlement, useFlag, useFlags, useTrack };