about summary refs log tree commit diff
path: root/src/state/ageAssurance/types.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/state/ageAssurance/types.ts')
-rw-r--r--src/state/ageAssurance/types.ts33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/state/ageAssurance/types.ts b/src/state/ageAssurance/types.ts
new file mode 100644
index 000000000..63febb3cf
--- /dev/null
+++ b/src/state/ageAssurance/types.ts
@@ -0,0 +1,33 @@
+import {type AppBskyUnspeccedDefs} from '@atproto/api'
+import {type QueryObserverBaseResult} from '@tanstack/react-query'
+
+export type AgeAssuranceContextType = {
+  /**
+   * Whether the age assurance state has been fetched from the server. If user
+   * is not in a region that requires AA, or AA is otherwise disabled, this
+   * will always be `true`.
+   */
+  isReady: boolean
+  /**
+   * The server-reported status of the user's age verification process.
+   */
+  status: AppBskyUnspeccedDefs.AgeAssuranceState['status']
+  /**
+   * The last time the age assurance state was attempted by the user.
+   */
+  lastInitiatedAt: AppBskyUnspeccedDefs.AgeAssuranceState['lastInitiatedAt']
+  /**
+   * Indicates the user is age restricted based on the requirements of their
+   * region, and their server-provided age assurance status. Does not factor in
+   * the user's declared age. If AA is otherise disabled, this will always be
+   * `false`.
+   */
+  isAgeRestricted: boolean
+}
+
+export type AgeAssuranceAPIContextType = {
+  /**
+   * Refreshes the age assurance state by fetching it from the server.
+   */
+  refetch: QueryObserverBaseResult['refetch']
+}