starti.app 2.0.161 → 2.0.162

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.
@@ -0,0 +1,95 @@
1
+ import { Startiapp } from "../../startiapp";
2
+ /**
3
+ * AppStorage provides a unified storage API that uses native storage when available
4
+ * and falls back to localStorage in older apps or non-MAUI environments.
5
+ *
6
+ * All keys are internally namespaced with "startiapp:" to avoid collisions.
7
+ *
8
+ * **Important notes:**
9
+ * - All methods are asynchronous and return Promises
10
+ * - Data is stored as strings
11
+ * - Data is NOT encrypted - do not store secrets
12
+ * - Storage is local to the app installation and shared across all domains
13
+ * - Size limits: up to 256 KB per value, up to 50 MB total
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * // Store a value
18
+ * await startiapp.Storage.app.setItem("user-preference", "dark-mode");
19
+ *
20
+ * // Retrieve a value
21
+ * const preference = await startiapp.Storage.app.getItem("user-preference");
22
+ *
23
+ * // Remove a value
24
+ * await startiapp.Storage.app.removeItem("user-preference");
25
+ *
26
+ * // Clear all appStorage data
27
+ * await startiapp.Storage.app.clear();
28
+ * ```
29
+ */
30
+ export declare class AppStorage extends EventTarget {
31
+ private readonly startiapp;
32
+ private integration;
33
+ private _useNativeBridge;
34
+ constructor(startiapp: Startiapp);
35
+ /**
36
+ * Checks if the native appStorage bridge is available.
37
+ * Caches the result after first check.
38
+ */
39
+ private get useNativeBridge();
40
+ /**
41
+ * Retrieves a value from storage.
42
+ *
43
+ * @param key - The key to retrieve
44
+ * @returns The stored value, or null if the key doesn't exist
45
+ *
46
+ * @example
47
+ * ```typescript
48
+ * const value = await startiapp.Storage.app.getItem("my-key");
49
+ * if (value !== null) {
50
+ * console.log("Found:", value);
51
+ * }
52
+ * ```
53
+ */
54
+ getItem(key: string): Promise<string | null>;
55
+ /**
56
+ * Stores a value in storage.
57
+ *
58
+ * @param key - The key to store
59
+ * @param value - The string value to store (max 256 KB)
60
+ *
61
+ * @example
62
+ * ```typescript
63
+ * await startiapp.Storage.app.setItem("user-name", "John");
64
+ * ```
65
+ */
66
+ setItem(key: string, value: string): Promise<void>;
67
+ /**
68
+ * Removes a value from storage.
69
+ *
70
+ * @param key - The key to remove
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * await startiapp.Storage.app.removeItem("user-name");
75
+ * ```
76
+ */
77
+ removeItem(key: string): Promise<void>;
78
+ /**
79
+ * Clears all appStorage entries (only those with the "startiapp:" prefix).
80
+ * Does NOT clear other localStorage entries.
81
+ *
82
+ * @example
83
+ * ```typescript
84
+ * await startiapp.Storage.app.clear();
85
+ * ```
86
+ */
87
+ clear(): Promise<void>;
88
+ /**
89
+ * Checks if the native appStorage bridge is being used.
90
+ * Useful for debugging or conditional logic.
91
+ *
92
+ * @returns true if using native storage, false if using localStorage fallback
93
+ */
94
+ isUsingNativeBridge(): boolean;
95
+ }
@@ -1,10 +1,25 @@
1
1
  import { Startiapp } from "../../startiapp";
2
+ import { AppStorage } from "../AppStorage/AppStorageIntegration";
2
3
  export declare class Storage extends EventTarget {
3
4
  private readonly startiapp;
4
5
  private integration;
6
+ /**
7
+ * Persistent key-value storage using native platform storage.
8
+ * Falls back to localStorage in older apps or non-MAUI environments.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * // Store a value
13
+ * await startiapp.Storage.app.setItem("key", "value");
14
+ *
15
+ * // Retrieve a value
16
+ * const value = await startiapp.Storage.app.getItem("key");
17
+ * ```
18
+ */
19
+ app: AppStorage;
5
20
  constructor(startiapp: Startiapp);
6
21
  /**
7
- * Clears all web data stored by the app.
22
+ * Clears all web data stored by the app (cookies, localStorage, cache).
8
23
  *
9
24
  * @example
10
25
  * ```typescript
@@ -125,6 +125,12 @@ type DeveloperIntegration = {
125
125
  type StorageIntegration = {
126
126
  clearWebData(): void;
127
127
  };
128
+ type AppStorageIntegration = {
129
+ getItem(key: string): string | null;
130
+ setItem(key: string, value: string): void;
131
+ removeItem(key: string): void;
132
+ clear(): void;
133
+ };
128
134
  type AuthIntegration = {
129
135
  signIn(providerName: string): void;
130
136
  signOut(): void;
@@ -168,6 +174,7 @@ export type Integrations = {
168
174
  IapIntegration: IapIntegration;
169
175
  DeveloperIntegration: DeveloperIntegration;
170
176
  StorageIntegration: StorageIntegration;
177
+ AppStorageIntegration: AppStorageIntegration;
171
178
  LocationIntegration: LocationIntegration;
172
179
  MediaIntegration: MediaIntegration;
173
180
  ExternalPurchaseCustomLinkIntegration: ExternalPurchaseCustomLinkIntegration;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "starti.app",
3
3
  "author": "starti.app",
4
4
  "license": "MIT",
5
- "version": "2.0.161",
5
+ "version": "2.0.162",
6
6
  "description": "Use this package for easy communication with the starti.app API.",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",