@arcenpay/react 0.0.1 → 0.0.2
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/dist/{basic-3OAVXLDO.mjs → basic-62X6SHFT.mjs} +7 -7
- package/dist/chains-SU7HOTC2.mjs +21 -0
- package/dist/chunk-GY2HMODH.mjs +94 -0
- package/dist/chunk-JFY4DVS7.mjs +1174 -0
- package/dist/{core-GECUTVXD.mjs → core-Y4UECIAE.mjs} +2 -2
- package/dist/index.d.mts +232 -4
- package/dist/index.d.ts +232 -4
- package/dist/index.js +1045 -175
- package/dist/index.mjs +89 -60
- package/dist/{src-TV3VFBF5.mjs → src-SAIIENMZ.mjs} +28 -28
- package/dist/{w3m-modal-LW2TBGRA.mjs → w3m-modal-T32JFEZB.mjs} +1 -1
- package/dist/zerodev.js +608 -35
- package/dist/zerodev.mjs +2 -1
- package/package.json +6 -2
- package/dist/chunk-LACDYDLO.mjs +0 -402
- /package/dist/{chunk-ZKNFAGRN.mjs → chunk-DK2DW6NJ.mjs} +0 -0
|
@@ -10087,8 +10087,8 @@ var init_appkit_core = __esm({
|
|
|
10087
10087
|
}
|
|
10088
10088
|
async injectModalUi() {
|
|
10089
10089
|
if (!isInitialized && CoreHelperUtil.isClient()) {
|
|
10090
|
-
await import("./basic-
|
|
10091
|
-
await import("./w3m-modal-
|
|
10090
|
+
await import("./basic-62X6SHFT.mjs");
|
|
10091
|
+
await import("./w3m-modal-T32JFEZB.mjs");
|
|
10092
10092
|
const isElementCreated = document.querySelector("w3m-modal");
|
|
10093
10093
|
if (!isElementCreated) {
|
|
10094
10094
|
const modal = document.createElement("w3m-modal");
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,235 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
|
|
4
|
+
interface Plan {
|
|
5
|
+
id: bigint;
|
|
6
|
+
provider: string;
|
|
7
|
+
name: string;
|
|
8
|
+
tier: PlanTier;
|
|
9
|
+
price: bigint;
|
|
10
|
+
billingInterval: number;
|
|
11
|
+
acceptedToken: string;
|
|
12
|
+
active: boolean;
|
|
13
|
+
metadataURI: string;
|
|
14
|
+
}
|
|
15
|
+
type PlanTier = "starter" | "pro" | "enterprise" | string;
|
|
16
|
+
type EnvironmentMode = "DEVELOPMENT" | "PRODUCTION";
|
|
17
|
+
interface InvoiceSummary {
|
|
18
|
+
id: string;
|
|
19
|
+
number?: string | null;
|
|
20
|
+
status: "DRAFT" | "ISSUED" | "PAID" | "VOID" | "OVERDUE";
|
|
21
|
+
currency: string;
|
|
22
|
+
customerEmail?: string | null;
|
|
23
|
+
customerWallet?: string | null;
|
|
24
|
+
subtotal: string;
|
|
25
|
+
taxTotal: string;
|
|
26
|
+
total: string;
|
|
27
|
+
issuedAt?: string | null;
|
|
28
|
+
dueAt?: string | null;
|
|
29
|
+
environmentMode: EnvironmentMode;
|
|
30
|
+
}
|
|
31
|
+
interface EntitlementSourceStatus {
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
lastUpdatedAt: number | null;
|
|
34
|
+
}
|
|
35
|
+
interface EntitlementSources {
|
|
36
|
+
onChain: EntitlementSourceStatus;
|
|
37
|
+
tableland: EntitlementSourceStatus;
|
|
38
|
+
lit: EntitlementSourceStatus;
|
|
39
|
+
}
|
|
40
|
+
interface EntitlementFreshness {
|
|
41
|
+
resolvedAt: number | null;
|
|
42
|
+
staleAfterMs: number;
|
|
43
|
+
}
|
|
44
|
+
interface NetworkConfig {
|
|
45
|
+
chainId: number;
|
|
46
|
+
name: string;
|
|
47
|
+
rpcUrl: string;
|
|
48
|
+
contracts: ContractAddresses;
|
|
49
|
+
}
|
|
50
|
+
interface ContractAddresses {
|
|
51
|
+
subscriptionRegistry: string;
|
|
52
|
+
autopayModule: string;
|
|
53
|
+
planFactory: string;
|
|
54
|
+
feeCollector: string;
|
|
55
|
+
sessionVault: string;
|
|
56
|
+
zkUsageVerifier: string;
|
|
57
|
+
mirrorRegistry?: string;
|
|
58
|
+
/** Optional ERC-4626 yield vault — set ARCENPAY_CONTRACT_<chainId>_yieldSessionVault to enable */
|
|
59
|
+
yieldSessionVault?: string;
|
|
60
|
+
}
|
|
61
|
+
interface ComponentEntitlement {
|
|
62
|
+
featureKey: string;
|
|
63
|
+
name: string;
|
|
64
|
+
value: boolean | string | number;
|
|
65
|
+
featureType?: "boolean" | "event_based" | "trait_based" | "credit";
|
|
66
|
+
limit?: number;
|
|
67
|
+
usage?: number;
|
|
68
|
+
exceeded?: boolean;
|
|
69
|
+
unitSingular?: string;
|
|
70
|
+
unitPlural?: string;
|
|
71
|
+
}
|
|
72
|
+
interface ComponentUsageItem {
|
|
73
|
+
featureKey: string;
|
|
74
|
+
name: string;
|
|
75
|
+
used: number;
|
|
76
|
+
limit?: number;
|
|
77
|
+
unitSingular: string | null;
|
|
78
|
+
unitPlural?: string | null;
|
|
79
|
+
}
|
|
80
|
+
interface ComponentPlanEntitlement {
|
|
81
|
+
featureName: string;
|
|
82
|
+
featureKey: string;
|
|
83
|
+
type: "BOOLEAN" | "NUMERIC" | "UNLIMITED";
|
|
84
|
+
value: boolean | number | null;
|
|
85
|
+
enabled: boolean;
|
|
86
|
+
}
|
|
87
|
+
interface ComponentPlanSummary {
|
|
88
|
+
id: string;
|
|
89
|
+
name: string;
|
|
90
|
+
price: string;
|
|
91
|
+
annualPrice?: string | null;
|
|
92
|
+
tier: string;
|
|
93
|
+
billingInterval: number;
|
|
94
|
+
acceptedToken?: string;
|
|
95
|
+
acceptedChainId?: number;
|
|
96
|
+
onChainPlanId?: string | null;
|
|
97
|
+
description?: string;
|
|
98
|
+
metadata?: {
|
|
99
|
+
entitlements?: ComponentPlanEntitlement[];
|
|
100
|
+
[key: string]: unknown;
|
|
101
|
+
} | null;
|
|
102
|
+
}
|
|
103
|
+
interface ComponentInvoiceSummary {
|
|
104
|
+
id: string;
|
|
105
|
+
number: string | null;
|
|
106
|
+
total: string;
|
|
107
|
+
currency: string;
|
|
108
|
+
status: string;
|
|
109
|
+
issuedAt: string | null;
|
|
110
|
+
dueAt?: string | null;
|
|
111
|
+
paidAt?: string | null;
|
|
112
|
+
customerEmail?: string | null;
|
|
113
|
+
customerWallet?: string | null;
|
|
114
|
+
downloadUrl?: string | null;
|
|
115
|
+
}
|
|
116
|
+
interface ComponentPaymentMethod {
|
|
117
|
+
walletAddress: string | null;
|
|
118
|
+
token: string | null;
|
|
119
|
+
chainId: number | null;
|
|
120
|
+
}
|
|
121
|
+
interface ComponentSubscriptionTransition {
|
|
122
|
+
mode?: string | null;
|
|
123
|
+
targetPlanId?: string | null;
|
|
124
|
+
targetPlanName?: string | null;
|
|
125
|
+
targetBillingPeriod?: "monthly" | "annual" | null;
|
|
126
|
+
previousPlanId?: string | null;
|
|
127
|
+
previousBillingPeriod?: "monthly" | "annual" | null;
|
|
128
|
+
requestedAt?: string | null;
|
|
129
|
+
effectiveAt?: string | null;
|
|
130
|
+
source?: string | null;
|
|
131
|
+
}
|
|
132
|
+
interface ComponentElement {
|
|
133
|
+
type: "planManager" | "meteredFeatures" | "includedFeatures" | "plansTable" | "nextBillDue" | "paymentMethod" | "invoices" | "unsubscribe" | "text" | "button" | string;
|
|
134
|
+
config?: Record<string, unknown>;
|
|
135
|
+
[key: string]: unknown;
|
|
136
|
+
}
|
|
137
|
+
interface ComponentDesign {
|
|
138
|
+
primaryColor?: string;
|
|
139
|
+
secondaryColor?: string;
|
|
140
|
+
fontFamily?: string;
|
|
141
|
+
fontSize?: string | number;
|
|
142
|
+
cardStyle?: "minimal" | "bordered" | "elevated";
|
|
143
|
+
columns?: number;
|
|
144
|
+
sections?: "merged" | "separate";
|
|
145
|
+
fontColor?: string;
|
|
146
|
+
backgroundColor?: string;
|
|
147
|
+
borderRadius?: string | number;
|
|
148
|
+
}
|
|
149
|
+
interface ComponentRenderData {
|
|
150
|
+
component: {
|
|
151
|
+
id: string;
|
|
152
|
+
name: string;
|
|
153
|
+
elements: ComponentElement[];
|
|
154
|
+
design: ComponentDesign;
|
|
155
|
+
};
|
|
156
|
+
activePlan: ComponentPlanSummary | null;
|
|
157
|
+
entitlements: ComponentEntitlement[];
|
|
158
|
+
usage: ComponentUsageItem[];
|
|
159
|
+
plans: ComponentPlanSummary[];
|
|
160
|
+
company?: Record<string, unknown> | null;
|
|
161
|
+
userId?: string | null;
|
|
162
|
+
providerWallet?: string | null;
|
|
163
|
+
nextBillingAt?: string | null;
|
|
164
|
+
billingPeriod?: "monthly" | "annual" | null;
|
|
165
|
+
paymentMethod?: ComponentPaymentMethod | null;
|
|
166
|
+
recentInvoices?: ComponentInvoiceSummary[];
|
|
167
|
+
subscriptionTransition?: ComponentSubscriptionTransition | null;
|
|
168
|
+
}
|
|
169
|
+
/** Keys used to identify a company in API calls */
|
|
170
|
+
interface ArcenCompanyKeys {
|
|
171
|
+
/** Caller's own internal company ID (maps to externalId) */
|
|
172
|
+
id?: string;
|
|
173
|
+
/** Wallet address (checksummed or lowercase) */
|
|
174
|
+
wallet?: string;
|
|
175
|
+
/** Company email address */
|
|
176
|
+
email?: string;
|
|
177
|
+
}
|
|
178
|
+
/** Keys used to identify a user in API calls */
|
|
179
|
+
interface ArcenUserKeys {
|
|
180
|
+
/** Caller's own internal user ID (maps to externalId) */
|
|
181
|
+
id?: string;
|
|
182
|
+
/** Clerk user ID */
|
|
183
|
+
clerkUserId?: string;
|
|
184
|
+
/** Wallet address */
|
|
185
|
+
wallet?: string;
|
|
186
|
+
/** User email address */
|
|
187
|
+
email?: string;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Result of checkFlag() — boolean feature gating.
|
|
191
|
+
* Use for "should this feature be visible/enabled?"
|
|
192
|
+
*/
|
|
193
|
+
interface FlagResult {
|
|
194
|
+
key: string;
|
|
195
|
+
/** Whether the feature is enabled for this company/user */
|
|
196
|
+
enabled: boolean;
|
|
197
|
+
/** Machine-readable reason: 'override', 'rule:<ruleId>', 'default' */
|
|
198
|
+
reason: string;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Result of checkEntitlement() — quota-aware feature gating.
|
|
202
|
+
* Use for "can this action still be performed under the customer's plan limits?"
|
|
203
|
+
*/
|
|
204
|
+
interface EntitlementResult {
|
|
205
|
+
key: string;
|
|
206
|
+
/** Whether the feature/action is currently allowed */
|
|
207
|
+
enabled: boolean;
|
|
208
|
+
/** Machine-readable reason */
|
|
209
|
+
reason: string;
|
|
210
|
+
/** Maximum allowed usage. null = unlimited */
|
|
211
|
+
allocation: number | null;
|
|
212
|
+
/** Current usage count in the active billing period */
|
|
213
|
+
usage: number;
|
|
214
|
+
/** true when usage >= allocation (and allocation is not null) */
|
|
215
|
+
exceeded: boolean;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Result of consumeEntitlement() — quota-aware metered action enforcement.
|
|
219
|
+
* `consumed` is true only when a usage unit was actually recorded.
|
|
220
|
+
*/
|
|
221
|
+
interface ConsumeEntitlementResult extends EntitlementResult {
|
|
222
|
+
consumed: boolean;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Result of identify() — creates/updates company+user and returns a session token.
|
|
226
|
+
*/
|
|
227
|
+
interface IdentifyResult {
|
|
228
|
+
token: string;
|
|
229
|
+
companyId: string;
|
|
230
|
+
userId?: string;
|
|
231
|
+
expiresAt: string;
|
|
232
|
+
}
|
|
5
233
|
|
|
6
234
|
interface ArcenPayContextValue {
|
|
7
235
|
session: ArcenSessionValue;
|
|
@@ -158,7 +386,7 @@ interface FeatureFlagGuardProps {
|
|
|
158
386
|
declare function FeatureFlagGuard({ featureKey, walletAddress, children, fallback, className, requireDecryption, decryptEndpoint, decryptPayload, onDecryptionSuccess, onDecryptionError, }: FeatureFlagGuardProps): react_jsx_runtime.JSX.Element;
|
|
159
387
|
|
|
160
388
|
type TemplateBlock = {
|
|
161
|
-
type:
|
|
389
|
+
type: "heading" | "text" | "price" | "feature-list" | "cta";
|
|
162
390
|
content?: string;
|
|
163
391
|
amount?: string;
|
|
164
392
|
interval?: string;
|
|
@@ -285,4 +513,4 @@ declare function useTrack(): {
|
|
|
285
513
|
|
|
286
514
|
declare function createPaymentLinkCheckoutUrl(slug: string, baseUrl?: string): string;
|
|
287
515
|
|
|
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 };
|
|
516
|
+
export { type ArcenCompanyIdentity, type ArcenCompanyKeys, ArcenEmbed, type ArcenEmbedProps, type ArcenIdentifyInput, type ArcenPayContextValue, ArcenPayProvider, type ArcenPayProviderProps, type ArcenSessionValue, type ArcenUserIdentity, type ArcenUserKeys, ArcenpayEmbed, type ArcenpayEmbedProps, type ComponentDesign, type ComponentElement, type ComponentRenderData, type ConsumeEntitlementResult, ENTITLEMENT_ERROR_CODES, EntitlementError, type EntitlementErrorCode, type EntitlementResult, FeatureFlagGuard, type FlagResult, type IdentifyResult, type InvoiceSummary, type Plan, type TemplateBlock, TemplateRenderer, type TemplateRendererProps, type Tokens, type TrackEventInput, createPaymentLinkCheckoutUrl, getDesignTokens, renderElement, useArcenPay, useConsumeEntitlement, useEntitlement, useFlag, useFlags, useTrack };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,235 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React, { ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
|
|
4
|
+
interface Plan {
|
|
5
|
+
id: bigint;
|
|
6
|
+
provider: string;
|
|
7
|
+
name: string;
|
|
8
|
+
tier: PlanTier;
|
|
9
|
+
price: bigint;
|
|
10
|
+
billingInterval: number;
|
|
11
|
+
acceptedToken: string;
|
|
12
|
+
active: boolean;
|
|
13
|
+
metadataURI: string;
|
|
14
|
+
}
|
|
15
|
+
type PlanTier = "starter" | "pro" | "enterprise" | string;
|
|
16
|
+
type EnvironmentMode = "DEVELOPMENT" | "PRODUCTION";
|
|
17
|
+
interface InvoiceSummary {
|
|
18
|
+
id: string;
|
|
19
|
+
number?: string | null;
|
|
20
|
+
status: "DRAFT" | "ISSUED" | "PAID" | "VOID" | "OVERDUE";
|
|
21
|
+
currency: string;
|
|
22
|
+
customerEmail?: string | null;
|
|
23
|
+
customerWallet?: string | null;
|
|
24
|
+
subtotal: string;
|
|
25
|
+
taxTotal: string;
|
|
26
|
+
total: string;
|
|
27
|
+
issuedAt?: string | null;
|
|
28
|
+
dueAt?: string | null;
|
|
29
|
+
environmentMode: EnvironmentMode;
|
|
30
|
+
}
|
|
31
|
+
interface EntitlementSourceStatus {
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
lastUpdatedAt: number | null;
|
|
34
|
+
}
|
|
35
|
+
interface EntitlementSources {
|
|
36
|
+
onChain: EntitlementSourceStatus;
|
|
37
|
+
tableland: EntitlementSourceStatus;
|
|
38
|
+
lit: EntitlementSourceStatus;
|
|
39
|
+
}
|
|
40
|
+
interface EntitlementFreshness {
|
|
41
|
+
resolvedAt: number | null;
|
|
42
|
+
staleAfterMs: number;
|
|
43
|
+
}
|
|
44
|
+
interface NetworkConfig {
|
|
45
|
+
chainId: number;
|
|
46
|
+
name: string;
|
|
47
|
+
rpcUrl: string;
|
|
48
|
+
contracts: ContractAddresses;
|
|
49
|
+
}
|
|
50
|
+
interface ContractAddresses {
|
|
51
|
+
subscriptionRegistry: string;
|
|
52
|
+
autopayModule: string;
|
|
53
|
+
planFactory: string;
|
|
54
|
+
feeCollector: string;
|
|
55
|
+
sessionVault: string;
|
|
56
|
+
zkUsageVerifier: string;
|
|
57
|
+
mirrorRegistry?: string;
|
|
58
|
+
/** Optional ERC-4626 yield vault — set ARCENPAY_CONTRACT_<chainId>_yieldSessionVault to enable */
|
|
59
|
+
yieldSessionVault?: string;
|
|
60
|
+
}
|
|
61
|
+
interface ComponentEntitlement {
|
|
62
|
+
featureKey: string;
|
|
63
|
+
name: string;
|
|
64
|
+
value: boolean | string | number;
|
|
65
|
+
featureType?: "boolean" | "event_based" | "trait_based" | "credit";
|
|
66
|
+
limit?: number;
|
|
67
|
+
usage?: number;
|
|
68
|
+
exceeded?: boolean;
|
|
69
|
+
unitSingular?: string;
|
|
70
|
+
unitPlural?: string;
|
|
71
|
+
}
|
|
72
|
+
interface ComponentUsageItem {
|
|
73
|
+
featureKey: string;
|
|
74
|
+
name: string;
|
|
75
|
+
used: number;
|
|
76
|
+
limit?: number;
|
|
77
|
+
unitSingular: string | null;
|
|
78
|
+
unitPlural?: string | null;
|
|
79
|
+
}
|
|
80
|
+
interface ComponentPlanEntitlement {
|
|
81
|
+
featureName: string;
|
|
82
|
+
featureKey: string;
|
|
83
|
+
type: "BOOLEAN" | "NUMERIC" | "UNLIMITED";
|
|
84
|
+
value: boolean | number | null;
|
|
85
|
+
enabled: boolean;
|
|
86
|
+
}
|
|
87
|
+
interface ComponentPlanSummary {
|
|
88
|
+
id: string;
|
|
89
|
+
name: string;
|
|
90
|
+
price: string;
|
|
91
|
+
annualPrice?: string | null;
|
|
92
|
+
tier: string;
|
|
93
|
+
billingInterval: number;
|
|
94
|
+
acceptedToken?: string;
|
|
95
|
+
acceptedChainId?: number;
|
|
96
|
+
onChainPlanId?: string | null;
|
|
97
|
+
description?: string;
|
|
98
|
+
metadata?: {
|
|
99
|
+
entitlements?: ComponentPlanEntitlement[];
|
|
100
|
+
[key: string]: unknown;
|
|
101
|
+
} | null;
|
|
102
|
+
}
|
|
103
|
+
interface ComponentInvoiceSummary {
|
|
104
|
+
id: string;
|
|
105
|
+
number: string | null;
|
|
106
|
+
total: string;
|
|
107
|
+
currency: string;
|
|
108
|
+
status: string;
|
|
109
|
+
issuedAt: string | null;
|
|
110
|
+
dueAt?: string | null;
|
|
111
|
+
paidAt?: string | null;
|
|
112
|
+
customerEmail?: string | null;
|
|
113
|
+
customerWallet?: string | null;
|
|
114
|
+
downloadUrl?: string | null;
|
|
115
|
+
}
|
|
116
|
+
interface ComponentPaymentMethod {
|
|
117
|
+
walletAddress: string | null;
|
|
118
|
+
token: string | null;
|
|
119
|
+
chainId: number | null;
|
|
120
|
+
}
|
|
121
|
+
interface ComponentSubscriptionTransition {
|
|
122
|
+
mode?: string | null;
|
|
123
|
+
targetPlanId?: string | null;
|
|
124
|
+
targetPlanName?: string | null;
|
|
125
|
+
targetBillingPeriod?: "monthly" | "annual" | null;
|
|
126
|
+
previousPlanId?: string | null;
|
|
127
|
+
previousBillingPeriod?: "monthly" | "annual" | null;
|
|
128
|
+
requestedAt?: string | null;
|
|
129
|
+
effectiveAt?: string | null;
|
|
130
|
+
source?: string | null;
|
|
131
|
+
}
|
|
132
|
+
interface ComponentElement {
|
|
133
|
+
type: "planManager" | "meteredFeatures" | "includedFeatures" | "plansTable" | "nextBillDue" | "paymentMethod" | "invoices" | "unsubscribe" | "text" | "button" | string;
|
|
134
|
+
config?: Record<string, unknown>;
|
|
135
|
+
[key: string]: unknown;
|
|
136
|
+
}
|
|
137
|
+
interface ComponentDesign {
|
|
138
|
+
primaryColor?: string;
|
|
139
|
+
secondaryColor?: string;
|
|
140
|
+
fontFamily?: string;
|
|
141
|
+
fontSize?: string | number;
|
|
142
|
+
cardStyle?: "minimal" | "bordered" | "elevated";
|
|
143
|
+
columns?: number;
|
|
144
|
+
sections?: "merged" | "separate";
|
|
145
|
+
fontColor?: string;
|
|
146
|
+
backgroundColor?: string;
|
|
147
|
+
borderRadius?: string | number;
|
|
148
|
+
}
|
|
149
|
+
interface ComponentRenderData {
|
|
150
|
+
component: {
|
|
151
|
+
id: string;
|
|
152
|
+
name: string;
|
|
153
|
+
elements: ComponentElement[];
|
|
154
|
+
design: ComponentDesign;
|
|
155
|
+
};
|
|
156
|
+
activePlan: ComponentPlanSummary | null;
|
|
157
|
+
entitlements: ComponentEntitlement[];
|
|
158
|
+
usage: ComponentUsageItem[];
|
|
159
|
+
plans: ComponentPlanSummary[];
|
|
160
|
+
company?: Record<string, unknown> | null;
|
|
161
|
+
userId?: string | null;
|
|
162
|
+
providerWallet?: string | null;
|
|
163
|
+
nextBillingAt?: string | null;
|
|
164
|
+
billingPeriod?: "monthly" | "annual" | null;
|
|
165
|
+
paymentMethod?: ComponentPaymentMethod | null;
|
|
166
|
+
recentInvoices?: ComponentInvoiceSummary[];
|
|
167
|
+
subscriptionTransition?: ComponentSubscriptionTransition | null;
|
|
168
|
+
}
|
|
169
|
+
/** Keys used to identify a company in API calls */
|
|
170
|
+
interface ArcenCompanyKeys {
|
|
171
|
+
/** Caller's own internal company ID (maps to externalId) */
|
|
172
|
+
id?: string;
|
|
173
|
+
/** Wallet address (checksummed or lowercase) */
|
|
174
|
+
wallet?: string;
|
|
175
|
+
/** Company email address */
|
|
176
|
+
email?: string;
|
|
177
|
+
}
|
|
178
|
+
/** Keys used to identify a user in API calls */
|
|
179
|
+
interface ArcenUserKeys {
|
|
180
|
+
/** Caller's own internal user ID (maps to externalId) */
|
|
181
|
+
id?: string;
|
|
182
|
+
/** Clerk user ID */
|
|
183
|
+
clerkUserId?: string;
|
|
184
|
+
/** Wallet address */
|
|
185
|
+
wallet?: string;
|
|
186
|
+
/** User email address */
|
|
187
|
+
email?: string;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Result of checkFlag() — boolean feature gating.
|
|
191
|
+
* Use for "should this feature be visible/enabled?"
|
|
192
|
+
*/
|
|
193
|
+
interface FlagResult {
|
|
194
|
+
key: string;
|
|
195
|
+
/** Whether the feature is enabled for this company/user */
|
|
196
|
+
enabled: boolean;
|
|
197
|
+
/** Machine-readable reason: 'override', 'rule:<ruleId>', 'default' */
|
|
198
|
+
reason: string;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Result of checkEntitlement() — quota-aware feature gating.
|
|
202
|
+
* Use for "can this action still be performed under the customer's plan limits?"
|
|
203
|
+
*/
|
|
204
|
+
interface EntitlementResult {
|
|
205
|
+
key: string;
|
|
206
|
+
/** Whether the feature/action is currently allowed */
|
|
207
|
+
enabled: boolean;
|
|
208
|
+
/** Machine-readable reason */
|
|
209
|
+
reason: string;
|
|
210
|
+
/** Maximum allowed usage. null = unlimited */
|
|
211
|
+
allocation: number | null;
|
|
212
|
+
/** Current usage count in the active billing period */
|
|
213
|
+
usage: number;
|
|
214
|
+
/** true when usage >= allocation (and allocation is not null) */
|
|
215
|
+
exceeded: boolean;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Result of consumeEntitlement() — quota-aware metered action enforcement.
|
|
219
|
+
* `consumed` is true only when a usage unit was actually recorded.
|
|
220
|
+
*/
|
|
221
|
+
interface ConsumeEntitlementResult extends EntitlementResult {
|
|
222
|
+
consumed: boolean;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Result of identify() — creates/updates company+user and returns a session token.
|
|
226
|
+
*/
|
|
227
|
+
interface IdentifyResult {
|
|
228
|
+
token: string;
|
|
229
|
+
companyId: string;
|
|
230
|
+
userId?: string;
|
|
231
|
+
expiresAt: string;
|
|
232
|
+
}
|
|
5
233
|
|
|
6
234
|
interface ArcenPayContextValue {
|
|
7
235
|
session: ArcenSessionValue;
|
|
@@ -158,7 +386,7 @@ interface FeatureFlagGuardProps {
|
|
|
158
386
|
declare function FeatureFlagGuard({ featureKey, walletAddress, children, fallback, className, requireDecryption, decryptEndpoint, decryptPayload, onDecryptionSuccess, onDecryptionError, }: FeatureFlagGuardProps): react_jsx_runtime.JSX.Element;
|
|
159
387
|
|
|
160
388
|
type TemplateBlock = {
|
|
161
|
-
type:
|
|
389
|
+
type: "heading" | "text" | "price" | "feature-list" | "cta";
|
|
162
390
|
content?: string;
|
|
163
391
|
amount?: string;
|
|
164
392
|
interval?: string;
|
|
@@ -285,4 +513,4 @@ declare function useTrack(): {
|
|
|
285
513
|
|
|
286
514
|
declare function createPaymentLinkCheckoutUrl(slug: string, baseUrl?: string): string;
|
|
287
515
|
|
|
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 };
|
|
516
|
+
export { type ArcenCompanyIdentity, type ArcenCompanyKeys, ArcenEmbed, type ArcenEmbedProps, type ArcenIdentifyInput, type ArcenPayContextValue, ArcenPayProvider, type ArcenPayProviderProps, type ArcenSessionValue, type ArcenUserIdentity, type ArcenUserKeys, ArcenpayEmbed, type ArcenpayEmbedProps, type ComponentDesign, type ComponentElement, type ComponentRenderData, type ConsumeEntitlementResult, ENTITLEMENT_ERROR_CODES, EntitlementError, type EntitlementErrorCode, type EntitlementResult, FeatureFlagGuard, type FlagResult, type IdentifyResult, type InvoiceSummary, type Plan, type TemplateBlock, TemplateRenderer, type TemplateRendererProps, type Tokens, type TrackEventInput, createPaymentLinkCheckoutUrl, getDesignTokens, renderElement, useArcenPay, useConsumeEntitlement, useEntitlement, useFlag, useFlags, useTrack };
|