react-autoql 8.30.1 → 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.
- package/README.md +29 -0
- package/dist/autoql.cjs.js +2 -2
- package/dist/autoql.cjs.js.gz +0 -0
- package/dist/autoql.esm.css +1 -1
- package/dist/autoql.esm.css.gz +0 -0
- package/dist/autoql.esm.js +2 -2
- package/dist/autoql.esm.js.gz +0 -0
- package/package.json +2 -2
- package/src/index.d.ts +158 -5
package/README.md
CHANGED
|
@@ -102,3 +102,32 @@ export default class App extends Component {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
```
|
|
105
|
+
|
|
106
|
+
## Billing hooks
|
|
107
|
+
|
|
108
|
+
Authenticated applications can compose their own billing UI with the package's billing hooks:
|
|
109
|
+
|
|
110
|
+
```jsx
|
|
111
|
+
import { useBillingCustomerKey, useBillingHistory, useBillingQuotaUpdate, useBillingUsage } from 'react-autoql'
|
|
112
|
+
|
|
113
|
+
const { billingCustomerKey } = useBillingCustomerKey({ authentication })
|
|
114
|
+
const { data: usage, state: usageState } = useBillingUsage({
|
|
115
|
+
authentication,
|
|
116
|
+
billingCustomerKey,
|
|
117
|
+
})
|
|
118
|
+
const { items: history } = useBillingHistory({ authentication, billingCustomerKey })
|
|
119
|
+
const { updateQuota, isSaving } = useBillingQuotaUpdate({
|
|
120
|
+
authentication,
|
|
121
|
+
billingCustomerKey,
|
|
122
|
+
})
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
The current-period usage response includes gross `usage_to_date_micros` plus
|
|
126
|
+
`free_allowance_micros`, `allowance_applied_to_date_micros`,
|
|
127
|
+
`allowance_remaining_micros`, and `estimated_billable_usage_micros`. These are integer micros.
|
|
128
|
+
The estimated billable value uses the current allowance configuration; final invoicing uses the
|
|
129
|
+
allowance snapshotted by Billing Service. Allowance is an invoice credit and remains separate from
|
|
130
|
+
the gross-usage quota, remaining quota, and quota status.
|
|
131
|
+
|
|
132
|
+
The package root also includes billing period/currency formatting helpers and opt-in billing customer
|
|
133
|
+
key storage helpers. The storage helpers are not used automatically by the hooks.
|