@leisuresaas/react-native 0.6.5 → 0.6.6-dev.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leisuresaas/react-native",
3
- "version": "0.6.5",
3
+ "version": "0.6.6-dev.2",
4
4
  "description": "React Native SDK for LeisureSaas: OAuth, Public Ads/App Config, Drive User Plane (publishable keys). Frontend-only — no Integration Key.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/src/drive.ts CHANGED
@@ -32,6 +32,12 @@ export type DriveRequestContext = {
32
32
  platform?: MobilePlatform | "web";
33
33
  bundleId?: string;
34
34
  origin?: string;
35
+ /**
36
+ * Care Delegation id: every Drive call then operates the grantor's Drive (sent as
37
+ * `X-Delegation-Id`), limited to the root folders the delegation scope allows. Usage and quota
38
+ * are the grantor's. Omit for the caller's own Drive.
39
+ */
40
+ delegationId?: string;
35
41
  };
36
42
 
37
43
  export type UploadProgressHandler = (progress: UploadProgress) => void;
@@ -66,6 +72,10 @@ function driveHeaders(ctx: DriveRequestContext): Record<string, string> {
66
72
  headers["X-Ads-Bundle-Id"] = bundle;
67
73
  }
68
74
  }
75
+ const delegation = ctx.delegationId?.trim();
76
+ if (delegation) {
77
+ headers["X-Delegation-Id"] = delegation;
78
+ }
69
79
  return headers;
70
80
  }
71
81
 
package/src/errors.ts CHANGED
@@ -39,6 +39,14 @@ export const ErrorReason = {
39
39
  QuotaExceeded: "QUOTA_EXCEEDED",
40
40
  CapacityExceeded: "CAPACITY_EXCEEDED",
41
41
  FileTooLarge: "FILE_TOO_LARGE",
42
+ // Drive with `delegationId`: the delegation does not exist / was revoked by the grantor / is not
43
+ // the caller's or another product's / its scope does not allow Drive access / is expired or
44
+ // otherwise unusable. A node outside the allowed root folders is PermissionDenied.
45
+ CareDelegationNotFound: "CARE_DELEGATION_NOT_FOUND",
46
+ CareDelegationRevoked: "CARE_DELEGATION_REVOKED",
47
+ CareDelegationForbidden: "CARE_DELEGATION_FORBIDDEN",
48
+ CareDelegationDriveNotAllowed: "CARE_DELEGATION_DRIVE_NOT_ALLOWED",
49
+ CareDelegationInvalid: "CARE_DELEGATION_INVALID",
42
50
  Network: "NETWORK",
43
51
  Unknown: "UNKNOWN",
44
52
  } as const;
@@ -298,7 +298,8 @@ export function startHeartbeat(
298
298
  ): () => void {
299
299
  const intervalMs = options.intervalMs ?? 60_000;
300
300
  let stopped = false;
301
- let appState: AppStateStatus = AppState.currentState;
301
+ // RN 0.87 generated types declare currentState as a nullable string.
302
+ let appState = (AppState.currentState ?? "unknown") as AppStateStatus;
302
303
 
303
304
  const beat = async () => {
304
305
  if (stopped || appState !== "active") {