react-autoql 8.31.0 → 8.32.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.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-autoql",
3
- "version": "8.31.0",
3
+ "version": "8.32.0",
4
4
  "description": "React Widget Library",
5
5
  "main": "dist/autoql.cjs.js",
6
6
  "module": "dist/autoql.esm.js",
@@ -33,7 +33,7 @@
33
33
  "test:coverage": "npm test -- --coverage",
34
34
  "test:badges": "npm run test:coverage && npx make-coverage-badge --output-path ./public/badge.svg",
35
35
  "test:staged": "cross-env NODE_OPTIONS= jest --findRelatedTests",
36
- "build": "cross-env NODE_OPTIONS=--experimental-global-webcrypto rollup -c",
36
+ "build": "rollup -c",
37
37
  "lint": "eslint src/**/*.js",
38
38
  "lint:fix": "eslint --fix 'src/**/*.js'",
39
39
  "format": "prettier --write 'src/**/*.{js,css,md,json}' --config ./.prettierrc",
package/src/index.d.ts CHANGED
@@ -1,15 +1,164 @@
1
1
  import * as React from 'react'
2
+ import type { Authentication } from 'autoql-fe-utils'
2
3
 
3
4
  export * from 'autoql-fe-utils'
4
5
 
5
- // ─── Shared config interfaces ────────────────────────────────────────────────
6
+ export type BillingQuotaStatus = 'no_quota' | 'under_quota' | 'at_or_over_quota'
7
+
8
+ export type BillingCustomerKeyState = 'idle' | 'loading' | 'success' | 'missing_customer' | 'error'
9
+
10
+ export type BillingUsageState = 'idle' | 'loading' | 'success' | 'missing_customer' | 'unavailable' | 'error'
11
+
12
+ export type BillingHistoryState = 'idle' | 'loading' | 'success' | 'unavailable' | 'error'
13
+
14
+ export interface BillingCustomerScope {
15
+ scope_type?: string
16
+ scope_id?: string
17
+ }
18
+
19
+ export type BillingExecutionType = 'STRIPE' | 'EXPORT'
20
+
21
+ export interface BillingCustomerKeyResponse {
22
+ billing_customer_key: string
23
+ scope?: BillingCustomerScope | null
24
+ billing_execution_type?: BillingExecutionType
25
+ }
26
+
27
+ export interface BillingCurrentUsage {
28
+ integrator_id: number
29
+ billing_customer_key: string
30
+ billing_period: string
31
+ usage_to_date_micros: number
32
+ free_allowance_micros: number
33
+ allowance_applied_to_date_micros: number
34
+ allowance_remaining_micros: number
35
+ estimated_billable_usage_micros: number
36
+ active_monthly_quota_micros: number | null
37
+ pending_monthly_quota_micros: number | null
38
+ pending_effective_billing_period: string | null
39
+ remaining_quota_micros: number | null
40
+ quota_status: BillingQuotaStatus
41
+ }
42
+
43
+ export interface BillingHistoryItem {
44
+ billing_period: string
45
+ usage_to_date_micros: number
46
+ quota_projection_label: 'current_quota_projection'
47
+ current_quota_projection_monthly_micros?: number | null
48
+ current_quota_projection_status: BillingQuotaStatus
49
+ }
50
+
51
+ export interface BillingQuotaUpdateResponse {
52
+ integrator_id: number
53
+ billing_customer_key: string
54
+ currency: string
55
+ active_monthly_quota_micros: number | null
56
+ active_effective_billing_period: string | null
57
+ pending_monthly_quota_micros: number | null
58
+ pending_effective_billing_period: string | null
59
+ current_billing_period: string
60
+ current_period_usage_micros: number
61
+ upsert_result: 'created' | 'updated' | 'noop'
62
+ effective_update_mode: 'immediate' | 'scheduled' | 'none'
63
+ updated_by?: string | null
64
+ updated_by_type?: string | null
65
+ }
66
+
67
+ export interface UseBillingCustomerKeyArgs {
68
+ authentication: Authentication
69
+ }
70
+
71
+ export interface UseBillingCustomerKeyResult {
72
+ billingCustomerKey: string | null
73
+ data: BillingCustomerKeyResponse | null
74
+ scope: BillingCustomerScope | null
75
+ state: BillingCustomerKeyState
76
+ }
77
+
78
+ export interface UseBillingUsageArgs {
79
+ authentication: Authentication
80
+ billingCustomerKey?: string | null
81
+ refreshKey?: number
82
+ }
83
+
84
+ export interface UseBillingUsageResult {
85
+ data: BillingCurrentUsage | null
86
+ state: BillingUsageState
87
+ }
6
88
 
7
- export interface Authentication {
8
- token?: string
9
- apiKey?: string
10
- domain?: string
89
+ export interface UseBillingHistoryArgs {
90
+ authentication: Authentication
91
+ billingCustomerKey?: string | null
92
+ from?: string
93
+ to?: string
11
94
  }
12
95
 
96
+ export interface UseBillingHistoryResult {
97
+ items: BillingHistoryItem[]
98
+ state: BillingHistoryState
99
+ }
100
+
101
+ export interface UseBillingQuotaUpdateArgs {
102
+ authentication: Authentication
103
+ billingCustomerKey?: string | null
104
+ }
105
+
106
+ export interface UseBillingQuotaUpdateResult {
107
+ isSaving: boolean
108
+ updateQuota: (monthlyQuotaMicros: number) => Promise<BillingQuotaUpdateResponse>
109
+ }
110
+
111
+ export declare function useBillingCustomerKey(args: UseBillingCustomerKeyArgs): UseBillingCustomerKeyResult
112
+ export declare function useBillingUsage(args: UseBillingUsageArgs): UseBillingUsageResult
113
+ export declare function useBillingHistory(args: UseBillingHistoryArgs): UseBillingHistoryResult
114
+ export declare function useBillingQuotaUpdate(args: UseBillingQuotaUpdateArgs): UseBillingQuotaUpdateResult
115
+
116
+ export type MagicWandBillingGateState = 'over_quota' | 'unavailable' | null
117
+
118
+ export interface UseMagicWandBillingGateArgs {
119
+ authentication?: Authentication
120
+ enabled?: boolean
121
+ }
122
+
123
+ export interface UseMagicWandBillingGateResult {
124
+ quotaStatus?: BillingQuotaStatus
125
+ billingExecutionType?: BillingExecutionType
126
+ }
127
+
128
+ export declare function useMagicWandBillingGate(
129
+ args?: UseMagicWandBillingGateArgs,
130
+ ): UseMagicWandBillingGateResult
131
+
132
+ export declare function getMagicWandBillingErrorState(error: any): MagicWandBillingGateState
133
+
134
+ export declare const MAGIC_WAND_BILLING_GATE_MESSAGES: {
135
+ over_quota: string
136
+ over_quota_summary: string
137
+ unavailable: string
138
+ }
139
+
140
+ // Broadcasts to every mounted useMagicWandBillingGate instance that billing usage may have
141
+ // changed (e.g. call this after a quota-increase flow completes) so proactive blocking clears
142
+ // without waiting for a remount.
143
+ export declare function refreshBillingUsage(): void
144
+
145
+ export declare function formatMicrosAsCurrency(
146
+ micros?: number | null,
147
+ emptyLabel?: string,
148
+ currency?: string,
149
+ locale?: string,
150
+ ): string
151
+ export declare function microsFromCurrencyInput(value: string): number | null
152
+ export declare function currencyInputFromMicros(micros?: number | null, currency?: string): string
153
+ export declare function formatBillingPeriod(period?: string | null): string
154
+ export declare function getDefaultBillingHistoryRange(): { from: string; to: string }
155
+
156
+ export declare function getStoredBillingCustomerKey(apiKey?: string): string | null
157
+ export declare function setStoredBillingCustomerKey(billingCustomerKey: string, apiKey?: string): void
158
+ export declare function clearStoredBillingCustomerKey(apiKey?: string): void
159
+
160
+ // ─── Shared config interfaces ────────────────────────────────────────────────
161
+
13
162
  export interface AutoQLConfig {
14
163
  translation?: string
15
164
  test?: boolean
@@ -91,6 +240,8 @@ export interface DashboardProps {
91
240
  enableCyclicalDates?: boolean
92
241
  enableMagicWand?: boolean
93
242
  showMagicWandQuoteButton?: boolean
243
+ enableBillingGate?: boolean
244
+ onQuotaExceeded?: () => void
94
245
  enableCustomColumns?: boolean
95
246
  preferRegularTableInitialDisplayType?: boolean
96
247
  source?: string | string[]
@@ -139,6 +290,8 @@ export interface DataMessengerProps {
139
290
  disableColumnSelectionForDataExplorer?: boolean
140
291
  enableMagicWand?: boolean
141
292
  showMagicWandQuoteButton?: boolean
293
+ enableBillingGate?: boolean
294
+ onQuotaExceeded?: () => void
142
295
  enableCyclicalDates?: boolean
143
296
  projectSelectList?: Array<{ projectId: string; displayName: string }>
144
297
  selectedProjectId?: string