craft-native 0.0.76 → 0.0.78

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.
@@ -1,527 +0,0 @@
1
- /**
2
- * Craft iOS Bridge
3
- * Complete iOS native bridge with WebView, permissions, haptics, and platform APIs
4
- */
5
- export interface IOSWebViewConfig {
6
- url?: string;
7
- html?: string;
8
- allowsBackForwardNavigationGestures?: boolean;
9
- allowsInlineMediaPlayback?: boolean;
10
- mediaTypesRequiringUserAction?: ('audio' | 'video' | 'all' | 'none')[];
11
- suppressesIncrementalRendering?: boolean;
12
- allowsAirPlayForMediaPlayback?: boolean;
13
- scrollEnabled?: boolean;
14
- bounces?: boolean;
15
- contentInsetAdjustmentBehavior?: 'automatic' | 'scrollableAxes' | 'never' | 'always';
16
- }
17
- export interface IOSPermission {
18
- type: 'camera' | 'microphone' | 'photos' | 'location' | 'locationAlways' | 'contacts' | 'calendar' | 'reminders' | 'notifications' | 'bluetooth' | 'healthKit' | 'motion' | 'speechRecognition' | 'mediaLibrary' | 'siri' | 'faceID' | 'tracking';
19
- status: 'notDetermined' | 'restricted' | 'denied' | 'authorized' | 'authorizedWhenInUse' | 'provisional';
20
- }
21
- export interface IOSHapticFeedback {
22
- type: 'impact' | 'notification' | 'selection';
23
- style?: 'light' | 'medium' | 'heavy' | 'soft' | 'rigid';
24
- notificationType?: 'success' | 'warning' | 'error';
25
- }
26
- export interface IOSAppClipConfig {
27
- invocationURL: string;
28
- experienceType: 'default' | 'locationBased';
29
- businessCategory?: string;
30
- subtitle?: string;
31
- }
32
- export interface IOSSharePlayActivity {
33
- activityIdentifier: string;
34
- fallbackURL?: string;
35
- title: string;
36
- subtitle?: string;
37
- image?: string;
38
- }
39
- export interface IOSLiveActivity {
40
- activityId: string;
41
- contentState: Record<string, unknown>;
42
- staleDate?: Date;
43
- relevanceScore?: number;
44
- }
45
- export interface IOSFocusFilter {
46
- identifier: string;
47
- name: string;
48
- iconSystemName?: string;
49
- parameters: Record<string, unknown>;
50
- }
51
- export interface IOSAppIntent {
52
- identifier: string;
53
- title: string;
54
- description?: string;
55
- parameters?: Array<{
56
- name: string;
57
- type: 'string' | 'number' | 'boolean' | 'date' | 'url';
58
- required?: boolean;
59
- }>;
60
- }
61
- export interface IOSTipKitTip {
62
- identifier: string;
63
- title: string;
64
- message: string;
65
- imageName?: string;
66
- actions?: Array<{
67
- identifier: string;
68
- title: string;
69
- }>;
70
- }
71
- export interface IOSStoreKitProduct {
72
- productId: string;
73
- displayName: string;
74
- description: string;
75
- price: number;
76
- displayPrice: string;
77
- type: 'consumable' | 'nonConsumable' | 'autoRenewable' | 'nonRenewable';
78
- }
79
- export interface IOSCarPlayTemplate {
80
- type: 'list' | 'grid' | 'tab' | 'information' | 'pointOfInterest' | 'nowPlaying' | 'alert' | 'action';
81
- title: string;
82
- items?: Array<{
83
- title: string;
84
- subtitle?: string;
85
- image?: string;
86
- handler?: string;
87
- }>;
88
- }
89
- export declare class IOSWebView {
90
- private id;
91
- private config;
92
- constructor(config?: IOSWebViewConfig);
93
- /**
94
- * Create the WebView (calls Objective-C runtime)
95
- */
96
- create(): Promise<void>;
97
- /**
98
- * Load a URL
99
- */
100
- loadURL(url: string): Promise<void>;
101
- /**
102
- * Load HTML content
103
- */
104
- loadHTML(html: string, baseURL?: string): Promise<void>;
105
- /**
106
- * Evaluate JavaScript in the WebView
107
- */
108
- evaluateJavaScript<T = unknown>(script: string): Promise<T>;
109
- /**
110
- * Go back in history
111
- */
112
- goBack(): Promise<void>;
113
- /**
114
- * Go forward in history
115
- */
116
- goForward(): Promise<void>;
117
- /**
118
- * Reload the current page
119
- */
120
- reload(): Promise<void>;
121
- /**
122
- * Stop loading
123
- */
124
- stopLoading(): Promise<void>;
125
- /**
126
- * Take a snapshot of the WebView
127
- */
128
- takeSnapshot(): Promise<string>;
129
- /**
130
- * Destroy the WebView
131
- */
132
- destroy(): Promise<void>;
133
- private callNative;
134
- }
135
- export declare class IOSPermissions {
136
- /**
137
- * Check permission status
138
- */
139
- check(type: IOSPermission['type']): Promise<IOSPermission['status']>;
140
- /**
141
- * Request permission
142
- */
143
- request(type: IOSPermission['type']): Promise<IOSPermission['status']>;
144
- /**
145
- * Open app settings
146
- */
147
- openSettings(): Promise<void>;
148
- /**
149
- * Check if can open settings
150
- */
151
- canOpenSettings(): Promise<boolean>;
152
- private callNative;
153
- }
154
- export declare class IOSHaptics {
155
- /**
156
- * Trigger impact feedback
157
- */
158
- impact(style?: IOSHapticFeedback['style']): Promise<void>;
159
- /**
160
- * Trigger notification feedback
161
- */
162
- notification(type?: IOSHapticFeedback['notificationType']): Promise<void>;
163
- /**
164
- * Trigger selection feedback
165
- */
166
- selection(): Promise<void>;
167
- private callNative;
168
- }
169
- export declare class IOSAppClips {
170
- /**
171
- * Configure App Clip experience
172
- */
173
- configure(config: IOSAppClipConfig): Promise<void>;
174
- /**
175
- * Get invocation URL
176
- */
177
- getInvocationURL(): Promise<string | null>;
178
- /**
179
- * Check if running as App Clip
180
- */
181
- isAppClip(): Promise<boolean>;
182
- /**
183
- * Request full app installation
184
- */
185
- requestFullAppInstallation(): Promise<void>;
186
- private callNative;
187
- }
188
- export declare class IOSSharePlay {
189
- private activity;
190
- /**
191
- * Start a SharePlay activity
192
- */
193
- startActivity(activity: IOSSharePlayActivity): Promise<void>;
194
- /**
195
- * End the current SharePlay activity
196
- */
197
- endActivity(): Promise<void>;
198
- /**
199
- * Check if SharePlay is available
200
- */
201
- isAvailable(): Promise<boolean>;
202
- /**
203
- * Send message to participants
204
- */
205
- sendMessage(data: unknown): Promise<void>;
206
- /**
207
- * Listen for messages
208
- */
209
- onMessage(callback: (data: unknown) => void): () => void;
210
- private callNative;
211
- }
212
- export declare class IOSLiveActivities {
213
- /**
214
- * Start a Live Activity
215
- */
216
- start(activity: Omit<IOSLiveActivity, 'activityId'>): Promise<string>;
217
- /**
218
- * Update a Live Activity
219
- */
220
- update(activityId: string, contentState: Record<string, unknown>): Promise<void>;
221
- /**
222
- * End a Live Activity
223
- */
224
- end(activityId: string, dismissalPolicy?: 'immediate' | 'default' | 'after'): Promise<void>;
225
- /**
226
- * Get all active Live Activities
227
- */
228
- getAll(): Promise<IOSLiveActivity[]>;
229
- /**
230
- * Check if Live Activities are supported
231
- */
232
- areSupported(): Promise<boolean>;
233
- private callNative;
234
- }
235
- export declare class IOSFocusFilters {
236
- /**
237
- * Register a focus filter
238
- */
239
- register(filter: IOSFocusFilter): Promise<void>;
240
- /**
241
- * Get current focus filter
242
- */
243
- getCurrent(): Promise<IOSFocusFilter | null>;
244
- /**
245
- * Check if a focus is active
246
- */
247
- isFocusActive(): Promise<boolean>;
248
- private callNative;
249
- }
250
- export declare class IOSAppIntents {
251
- /**
252
- * Register an App Intent
253
- */
254
- register(intent: IOSAppIntent): Promise<void>;
255
- /**
256
- * Donate an intent (for suggestions)
257
- */
258
- donate(intentIdentifier: string, parameters?: Record<string, unknown>): Promise<void>;
259
- /**
260
- * Handle intent execution
261
- */
262
- onExecute(callback: (intent: IOSAppIntent, parameters: Record<string, unknown>) => Promise<unknown>): () => void;
263
- private callNative;
264
- }
265
- export declare class IOSTipKit {
266
- /**
267
- * Configure TipKit
268
- */
269
- configure(options?: {
270
- displayFrequency?: 'immediate' | 'hourly' | 'daily' | 'weekly' | 'monthly';
271
- }): Promise<void>;
272
- /**
273
- * Register a tip
274
- */
275
- registerTip(tip: IOSTipKitTip): Promise<void>;
276
- /**
277
- * Show a tip
278
- */
279
- showTip(identifier: string): Promise<void>;
280
- /**
281
- * Invalidate a tip
282
- */
283
- invalidateTip(identifier: string): Promise<void>;
284
- /**
285
- * Reset all tips
286
- */
287
- resetAllTips(): Promise<void>;
288
- private callNative;
289
- }
290
- export declare class IOSStoreKit {
291
- /**
292
- * Get available products
293
- */
294
- getProducts(productIds: string[]): Promise<IOSStoreKitProduct[]>;
295
- /**
296
- * Purchase a product
297
- */
298
- purchase(productId: string): Promise<{
299
- transactionId: string;
300
- status: 'purchased' | 'pending' | 'cancelled';
301
- }>;
302
- /**
303
- * Restore purchases
304
- */
305
- restorePurchases(): Promise<Array<{
306
- productId: string;
307
- transactionId: string;
308
- }>>;
309
- /**
310
- * Check entitlement
311
- */
312
- checkEntitlement(productId: string): Promise<boolean>;
313
- /**
314
- * Get subscription status
315
- */
316
- getSubscriptionStatus(productId: string): Promise<{
317
- isActive: boolean;
318
- willRenew: boolean;
319
- expirationDate?: string;
320
- gracePeriodExpirationDate?: string;
321
- } | null>;
322
- /**
323
- * Present offer code redemption sheet
324
- */
325
- presentOfferCodeRedemption(): Promise<void>;
326
- /**
327
- * Listen for transaction updates
328
- */
329
- onTransactionUpdate(callback: (transaction: {
330
- productId: string;
331
- transactionId: string;
332
- status: string;
333
- }) => void): () => void;
334
- private callNative;
335
- }
336
- export declare class IOSCarPlay {
337
- private connected;
338
- /**
339
- * Check if CarPlay is connected
340
- */
341
- isConnected(): Promise<boolean>;
342
- /**
343
- * Set root template
344
- */
345
- setRootTemplate(template: IOSCarPlayTemplate): Promise<void>;
346
- /**
347
- * Push a template
348
- */
349
- pushTemplate(template: IOSCarPlayTemplate, animated?: boolean): Promise<void>;
350
- /**
351
- * Pop the current template
352
- */
353
- popTemplate(animated?: boolean): Promise<void>;
354
- /**
355
- * Present an alert
356
- */
357
- presentAlert(title: string, message?: string, actions?: Array<{
358
- title: string;
359
- style?: 'default' | 'cancel' | 'destructive';
360
- }>): Promise<number>;
361
- /**
362
- * Update Now Playing info
363
- */
364
- updateNowPlaying(info: {
365
- title: string;
366
- artist?: string;
367
- album?: string;
368
- artwork?: string;
369
- duration?: number;
370
- elapsedTime?: number;
371
- playbackRate?: number;
372
- }): Promise<void>;
373
- /**
374
- * Listen for CarPlay connection changes
375
- */
376
- onConnectionChange(callback: (connected: boolean) => void): () => void;
377
- private callNative;
378
- }
379
- export declare class IOSNativeComponents {
380
- /**
381
- * Create a native navigation controller
382
- */
383
- createNavigationController(config: {
384
- title?: string;
385
- largeTitleDisplayMode?: 'automatic' | 'always' | 'never';
386
- prefersLargeTitles?: boolean;
387
- tintColor?: string;
388
- }): Promise<string>;
389
- /**
390
- * Create a native tab bar controller
391
- */
392
- createTabBarController(tabs: Array<{
393
- title: string;
394
- icon: string;
395
- selectedIcon?: string;
396
- badgeValue?: string;
397
- }>): Promise<string>;
398
- /**
399
- * Create a native collection view
400
- */
401
- createCollectionView(config: {
402
- layout: 'flow' | 'compositional' | 'list';
403
- itemSize?: {
404
- width: number;
405
- height: number;
406
- };
407
- sectionInsets?: {
408
- top: number;
409
- left: number;
410
- bottom: number;
411
- right: number;
412
- };
413
- minimumLineSpacing?: number;
414
- minimumInteritemSpacing?: number;
415
- }): Promise<string>;
416
- /**
417
- * Show SwiftUI view
418
- */
419
- showSwiftUIView(viewName: string, props?: Record<string, unknown>): Promise<void>;
420
- private callNative;
421
- }
422
- export declare class IOSPushNotifications {
423
- /**
424
- * Register for remote notifications
425
- */
426
- register(): Promise<string>;
427
- /**
428
- * Get APNs device token
429
- */
430
- getDeviceToken(): Promise<string | null>;
431
- /**
432
- * Schedule a local notification
433
- */
434
- scheduleLocal(notification: {
435
- identifier: string;
436
- title: string;
437
- body: string;
438
- subtitle?: string;
439
- badge?: number;
440
- sound?: string | 'default';
441
- userInfo?: Record<string, unknown>;
442
- trigger: {
443
- type: 'timeInterval';
444
- seconds: number;
445
- repeats?: boolean;
446
- } | {
447
- type: 'calendar';
448
- dateComponents: Record<string, number>;
449
- repeats?: boolean;
450
- } | {
451
- type: 'location';
452
- latitude: number;
453
- longitude: number;
454
- radius: number;
455
- notifyOnEntry?: boolean;
456
- notifyOnExit?: boolean;
457
- };
458
- categoryIdentifier?: string;
459
- threadIdentifier?: string;
460
- interruptionLevel?: 'passive' | 'active' | 'timeSensitive' | 'critical';
461
- relevanceScore?: number;
462
- }): Promise<void>;
463
- /**
464
- * Cancel pending notifications
465
- */
466
- cancelPending(identifiers: string[]): Promise<void>;
467
- /**
468
- * Get pending notifications
469
- */
470
- getPending(): Promise<Array<{
471
- identifier: string;
472
- trigger: unknown;
473
- }>>;
474
- /**
475
- * Handle notification response
476
- */
477
- onNotificationResponse(callback: (response: {
478
- identifier: string;
479
- actionIdentifier: string;
480
- userInfo: Record<string, unknown>;
481
- }) => void): () => void;
482
- private callNative;
483
- }
484
- export declare class IOSAppLifecycle {
485
- /**
486
- * Get current app state
487
- */
488
- getState(): Promise<'active' | 'inactive' | 'background'>;
489
- /**
490
- * Register for state restoration
491
- */
492
- registerStateRestoration(activityType: string): Promise<void>;
493
- /**
494
- * Save user activity for state restoration
495
- */
496
- saveUserActivity(activityType: string, userInfo: Record<string, unknown>): Promise<void>;
497
- /**
498
- * Register background task
499
- */
500
- registerBackgroundTask(identifier: string, handler: () => Promise<void>): Promise<void>;
501
- /**
502
- * Schedule background refresh
503
- */
504
- scheduleBackgroundRefresh(identifier: string, earliestBeginDate?: Date): Promise<void>;
505
- /**
506
- * Listen for app state changes
507
- */
508
- onStateChange(callback: (state: 'active' | 'inactive' | 'background') => void): () => void;
509
- private callNative;
510
- }
511
- export declare const ios: {
512
- WebView: typeof IOSWebView;
513
- Permissions: IOSPermissions;
514
- Haptics: IOSHaptics;
515
- AppClips: IOSAppClips;
516
- SharePlay: IOSSharePlay;
517
- LiveActivities: IOSLiveActivities;
518
- FocusFilters: IOSFocusFilters;
519
- AppIntents: IOSAppIntents;
520
- TipKit: IOSTipKit;
521
- StoreKit: IOSStoreKit;
522
- CarPlay: IOSCarPlay;
523
- NativeComponents: IOSNativeComponents;
524
- PushNotifications: IOSPushNotifications;
525
- AppLifecycle: IOSAppLifecycle;
526
- };
527
- export default ios;