@capgo/capacitor-watch 8.0.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.
@@ -0,0 +1,371 @@
1
+ import type { PluginListenerHandle } from '@capacitor/core';
2
+ /**
3
+ * Data that can be sent between iPhone and Apple Watch.
4
+ * Values must be serializable (string, number, boolean, arrays, or nested objects).
5
+ *
6
+ * @since 8.0.0
7
+ */
8
+ export type WatchMessageData = Record<string, unknown>;
9
+ /**
10
+ * Options for sending a message to the watch.
11
+ *
12
+ * @since 8.0.0
13
+ */
14
+ export interface SendMessageOptions {
15
+ /**
16
+ * The data to send to the watch.
17
+ * Must be serializable (string, number, boolean, arrays, or nested objects).
18
+ */
19
+ data: WatchMessageData;
20
+ }
21
+ /**
22
+ * Options for updating the application context.
23
+ *
24
+ * @since 8.0.0
25
+ */
26
+ export interface UpdateContextOptions {
27
+ /**
28
+ * The context data to sync with the watch.
29
+ * Only the latest context is kept - previous values are overwritten.
30
+ */
31
+ context: WatchMessageData;
32
+ }
33
+ /**
34
+ * Options for transferring user info.
35
+ *
36
+ * @since 8.0.0
37
+ */
38
+ export interface TransferUserInfoOptions {
39
+ /**
40
+ * The user info data to transfer.
41
+ * Transfers are queued and delivered in order.
42
+ */
43
+ userInfo: WatchMessageData;
44
+ }
45
+ /**
46
+ * Options for replying to a message from the watch.
47
+ *
48
+ * @since 8.0.0
49
+ */
50
+ export interface ReplyMessageOptions {
51
+ /**
52
+ * The callback ID received in the messageReceivedWithReply event.
53
+ */
54
+ callbackId: string;
55
+ /**
56
+ * The reply data to send back to the watch.
57
+ */
58
+ data: WatchMessageData;
59
+ }
60
+ /**
61
+ * Information about Watch connectivity status.
62
+ *
63
+ * @since 8.0.0
64
+ */
65
+ export interface WatchInfo {
66
+ /**
67
+ * Whether WatchConnectivity is supported on this device.
68
+ * Always false on iPad, web, and Android.
69
+ */
70
+ isSupported: boolean;
71
+ /**
72
+ * Whether an Apple Watch is paired with this iPhone.
73
+ */
74
+ isPaired: boolean;
75
+ /**
76
+ * Whether the paired watch has the companion app installed.
77
+ */
78
+ isWatchAppInstalled: boolean;
79
+ /**
80
+ * Whether the watch is currently reachable for immediate messaging.
81
+ */
82
+ isReachable: boolean;
83
+ /**
84
+ * The current activation state of the WCSession.
85
+ * 0 = notActivated, 1 = inactive, 2 = activated
86
+ */
87
+ activationState: number;
88
+ }
89
+ /**
90
+ * Event data for received messages.
91
+ *
92
+ * @since 8.0.0
93
+ */
94
+ export interface MessageReceivedEvent {
95
+ /**
96
+ * The message data received from the watch.
97
+ */
98
+ message: WatchMessageData;
99
+ }
100
+ /**
101
+ * Event data for messages that require a reply.
102
+ *
103
+ * @since 8.0.0
104
+ */
105
+ export interface MessageReceivedWithReplyEvent {
106
+ /**
107
+ * The message data received from the watch.
108
+ */
109
+ message: WatchMessageData;
110
+ /**
111
+ * The callback ID to use when replying with replyToMessage().
112
+ */
113
+ callbackId: string;
114
+ }
115
+ /**
116
+ * Event data for application context updates.
117
+ *
118
+ * @since 8.0.0
119
+ */
120
+ export interface ContextReceivedEvent {
121
+ /**
122
+ * The context data received from the watch.
123
+ */
124
+ context: WatchMessageData;
125
+ }
126
+ /**
127
+ * Event data for user info transfers.
128
+ *
129
+ * @since 8.0.0
130
+ */
131
+ export interface UserInfoReceivedEvent {
132
+ /**
133
+ * The user info data received from the watch.
134
+ */
135
+ userInfo: WatchMessageData;
136
+ }
137
+ /**
138
+ * Event data for reachability changes.
139
+ *
140
+ * @since 8.0.0
141
+ */
142
+ export interface ReachabilityChangedEvent {
143
+ /**
144
+ * Whether the watch is now reachable.
145
+ */
146
+ isReachable: boolean;
147
+ }
148
+ /**
149
+ * Event data for activation state changes.
150
+ *
151
+ * @since 8.0.0
152
+ */
153
+ export interface ActivationStateChangedEvent {
154
+ /**
155
+ * The new activation state.
156
+ * 0 = notActivated, 1 = inactive, 2 = activated
157
+ */
158
+ state: number;
159
+ }
160
+ /**
161
+ * Apple Watch communication plugin for Capacitor.
162
+ * Provides bidirectional messaging between iPhone and Apple Watch using WatchConnectivity.
163
+ *
164
+ * @since 8.0.0
165
+ */
166
+ export interface CapgoWatchPlugin {
167
+ /**
168
+ * Send an interactive message to the watch.
169
+ * The watch must be reachable for this to succeed.
170
+ * Use this for time-sensitive, interactive communication.
171
+ *
172
+ * @param options - The message options
173
+ * @returns Promise that resolves when the message is sent
174
+ * @throws Error if the watch is not reachable or session is not active
175
+ * @since 8.0.0
176
+ * @example
177
+ * ```typescript
178
+ * await CapgoWatch.sendMessage({
179
+ * data: { action: 'refresh', timestamp: Date.now() }
180
+ * });
181
+ * ```
182
+ */
183
+ sendMessage(options: SendMessageOptions): Promise<void>;
184
+ /**
185
+ * Update the application context shared with the watch.
186
+ * Only the latest context is kept - this overwrites any previous context.
187
+ * Use this for syncing app state that the watch needs to display.
188
+ *
189
+ * @param options - The context options
190
+ * @returns Promise that resolves when the context is updated
191
+ * @throws Error if session is not active
192
+ * @since 8.0.0
193
+ * @example
194
+ * ```typescript
195
+ * await CapgoWatch.updateApplicationContext({
196
+ * context: { theme: 'dark', lastSync: Date.now() }
197
+ * });
198
+ * ```
199
+ */
200
+ updateApplicationContext(options: UpdateContextOptions): Promise<void>;
201
+ /**
202
+ * Transfer user info to the watch.
203
+ * Transfers are queued and delivered in order, even if the watch is not currently reachable.
204
+ * Use this for important data that must be delivered reliably.
205
+ *
206
+ * @param options - The user info options
207
+ * @returns Promise that resolves when the transfer is queued
208
+ * @throws Error if session is not active
209
+ * @since 8.0.0
210
+ * @example
211
+ * ```typescript
212
+ * await CapgoWatch.transferUserInfo({
213
+ * userInfo: { recordId: '123', action: 'created' }
214
+ * });
215
+ * ```
216
+ */
217
+ transferUserInfo(options: TransferUserInfoOptions): Promise<void>;
218
+ /**
219
+ * Reply to a message from the watch that requested a reply.
220
+ * Use this in response to the messageReceivedWithReply event.
221
+ *
222
+ * @param options - The reply options including the callbackId
223
+ * @returns Promise that resolves when the reply is sent
224
+ * @throws Error if the callback ID is invalid or session is not active
225
+ * @since 8.0.0
226
+ * @example
227
+ * ```typescript
228
+ * CapgoWatch.addListener('messageReceivedWithReply', async (event) => {
229
+ * const result = await processRequest(event.message);
230
+ * await CapgoWatch.replyToMessage({
231
+ * callbackId: event.callbackId,
232
+ * data: { result }
233
+ * });
234
+ * });
235
+ * ```
236
+ */
237
+ replyToMessage(options: ReplyMessageOptions): Promise<void>;
238
+ /**
239
+ * Get information about the watch connectivity status.
240
+ *
241
+ * @returns Promise that resolves with watch connectivity info
242
+ * @since 8.0.0
243
+ * @example
244
+ * ```typescript
245
+ * const info = await CapgoWatch.getInfo();
246
+ * if (info.isReachable) {
247
+ * await CapgoWatch.sendMessage({ data: { ping: true } });
248
+ * }
249
+ * ```
250
+ */
251
+ getInfo(): Promise<WatchInfo>;
252
+ /**
253
+ * Get the native Capacitor plugin version.
254
+ *
255
+ * @returns Promise that resolves with the plugin version
256
+ * @since 8.0.0
257
+ * @example
258
+ * ```typescript
259
+ * const { version } = await CapgoWatch.getPluginVersion();
260
+ * console.log('Plugin version:', version);
261
+ * ```
262
+ */
263
+ getPluginVersion(): Promise<{
264
+ version: string;
265
+ }>;
266
+ /**
267
+ * Listen for messages received from the watch.
268
+ *
269
+ * @param eventName - The event name
270
+ * @param listenerFunc - Callback function
271
+ * @returns Handle to remove the listener
272
+ * @since 8.0.0
273
+ * @example
274
+ * ```typescript
275
+ * const handle = await CapgoWatch.addListener('messageReceived', (event) => {
276
+ * console.log('Message from watch:', event.message);
277
+ * });
278
+ * // Later: handle.remove();
279
+ * ```
280
+ */
281
+ addListener(eventName: 'messageReceived', listenerFunc: (event: MessageReceivedEvent) => void): Promise<PluginListenerHandle>;
282
+ /**
283
+ * Listen for messages from the watch that require a reply.
284
+ *
285
+ * @param eventName - The event name
286
+ * @param listenerFunc - Callback function
287
+ * @returns Handle to remove the listener
288
+ * @since 8.0.0
289
+ * @example
290
+ * ```typescript
291
+ * await CapgoWatch.addListener('messageReceivedWithReply', async (event) => {
292
+ * const response = await handleRequest(event.message);
293
+ * await CapgoWatch.replyToMessage({
294
+ * callbackId: event.callbackId,
295
+ * data: response
296
+ * });
297
+ * });
298
+ * ```
299
+ */
300
+ addListener(eventName: 'messageReceivedWithReply', listenerFunc: (event: MessageReceivedWithReplyEvent) => void): Promise<PluginListenerHandle>;
301
+ /**
302
+ * Listen for application context updates from the watch.
303
+ *
304
+ * @param eventName - The event name
305
+ * @param listenerFunc - Callback function
306
+ * @returns Handle to remove the listener
307
+ * @since 8.0.0
308
+ * @example
309
+ * ```typescript
310
+ * await CapgoWatch.addListener('applicationContextReceived', (event) => {
311
+ * console.log('Context from watch:', event.context);
312
+ * });
313
+ * ```
314
+ */
315
+ addListener(eventName: 'applicationContextReceived', listenerFunc: (event: ContextReceivedEvent) => void): Promise<PluginListenerHandle>;
316
+ /**
317
+ * Listen for user info transfers from the watch.
318
+ *
319
+ * @param eventName - The event name
320
+ * @param listenerFunc - Callback function
321
+ * @returns Handle to remove the listener
322
+ * @since 8.0.0
323
+ * @example
324
+ * ```typescript
325
+ * await CapgoWatch.addListener('userInfoReceived', (event) => {
326
+ * console.log('User info from watch:', event.userInfo);
327
+ * });
328
+ * ```
329
+ */
330
+ addListener(eventName: 'userInfoReceived', listenerFunc: (event: UserInfoReceivedEvent) => void): Promise<PluginListenerHandle>;
331
+ /**
332
+ * Listen for watch reachability changes.
333
+ *
334
+ * @param eventName - The event name
335
+ * @param listenerFunc - Callback function
336
+ * @returns Handle to remove the listener
337
+ * @since 8.0.0
338
+ * @example
339
+ * ```typescript
340
+ * await CapgoWatch.addListener('reachabilityChanged', (event) => {
341
+ * console.log('Watch reachable:', event.isReachable);
342
+ * });
343
+ * ```
344
+ */
345
+ addListener(eventName: 'reachabilityChanged', listenerFunc: (event: ReachabilityChangedEvent) => void): Promise<PluginListenerHandle>;
346
+ /**
347
+ * Listen for session activation state changes.
348
+ *
349
+ * @param eventName - The event name
350
+ * @param listenerFunc - Callback function
351
+ * @returns Handle to remove the listener
352
+ * @since 8.0.0
353
+ * @example
354
+ * ```typescript
355
+ * await CapgoWatch.addListener('activationStateChanged', (event) => {
356
+ * console.log('Activation state:', event.state);
357
+ * });
358
+ * ```
359
+ */
360
+ addListener(eventName: 'activationStateChanged', listenerFunc: (event: ActivationStateChangedEvent) => void): Promise<PluginListenerHandle>;
361
+ /**
362
+ * Remove all listeners for this plugin.
363
+ *
364
+ * @since 8.0.0
365
+ * @example
366
+ * ```typescript
367
+ * await CapgoWatch.removeAllListeners();
368
+ * ```
369
+ */
370
+ removeAllListeners(): Promise<void>;
371
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=definitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\n/**\n * Data that can be sent between iPhone and Apple Watch.\n * Values must be serializable (string, number, boolean, arrays, or nested objects).\n *\n * @since 8.0.0\n */\nexport type WatchMessageData = Record<string, unknown>;\n\n/**\n * Options for sending a message to the watch.\n *\n * @since 8.0.0\n */\nexport interface SendMessageOptions {\n /**\n * The data to send to the watch.\n * Must be serializable (string, number, boolean, arrays, or nested objects).\n */\n data: WatchMessageData;\n}\n\n/**\n * Options for updating the application context.\n *\n * @since 8.0.0\n */\nexport interface UpdateContextOptions {\n /**\n * The context data to sync with the watch.\n * Only the latest context is kept - previous values are overwritten.\n */\n context: WatchMessageData;\n}\n\n/**\n * Options for transferring user info.\n *\n * @since 8.0.0\n */\nexport interface TransferUserInfoOptions {\n /**\n * The user info data to transfer.\n * Transfers are queued and delivered in order.\n */\n userInfo: WatchMessageData;\n}\n\n/**\n * Options for replying to a message from the watch.\n *\n * @since 8.0.0\n */\nexport interface ReplyMessageOptions {\n /**\n * The callback ID received in the messageReceivedWithReply event.\n */\n callbackId: string;\n /**\n * The reply data to send back to the watch.\n */\n data: WatchMessageData;\n}\n\n/**\n * Information about Watch connectivity status.\n *\n * @since 8.0.0\n */\nexport interface WatchInfo {\n /**\n * Whether WatchConnectivity is supported on this device.\n * Always false on iPad, web, and Android.\n */\n isSupported: boolean;\n /**\n * Whether an Apple Watch is paired with this iPhone.\n */\n isPaired: boolean;\n /**\n * Whether the paired watch has the companion app installed.\n */\n isWatchAppInstalled: boolean;\n /**\n * Whether the watch is currently reachable for immediate messaging.\n */\n isReachable: boolean;\n /**\n * The current activation state of the WCSession.\n * 0 = notActivated, 1 = inactive, 2 = activated\n */\n activationState: number;\n}\n\n/**\n * Event data for received messages.\n *\n * @since 8.0.0\n */\nexport interface MessageReceivedEvent {\n /**\n * The message data received from the watch.\n */\n message: WatchMessageData;\n}\n\n/**\n * Event data for messages that require a reply.\n *\n * @since 8.0.0\n */\nexport interface MessageReceivedWithReplyEvent {\n /**\n * The message data received from the watch.\n */\n message: WatchMessageData;\n /**\n * The callback ID to use when replying with replyToMessage().\n */\n callbackId: string;\n}\n\n/**\n * Event data for application context updates.\n *\n * @since 8.0.0\n */\nexport interface ContextReceivedEvent {\n /**\n * The context data received from the watch.\n */\n context: WatchMessageData;\n}\n\n/**\n * Event data for user info transfers.\n *\n * @since 8.0.0\n */\nexport interface UserInfoReceivedEvent {\n /**\n * The user info data received from the watch.\n */\n userInfo: WatchMessageData;\n}\n\n/**\n * Event data for reachability changes.\n *\n * @since 8.0.0\n */\nexport interface ReachabilityChangedEvent {\n /**\n * Whether the watch is now reachable.\n */\n isReachable: boolean;\n}\n\n/**\n * Event data for activation state changes.\n *\n * @since 8.0.0\n */\nexport interface ActivationStateChangedEvent {\n /**\n * The new activation state.\n * 0 = notActivated, 1 = inactive, 2 = activated\n */\n state: number;\n}\n\n/**\n * Apple Watch communication plugin for Capacitor.\n * Provides bidirectional messaging between iPhone and Apple Watch using WatchConnectivity.\n *\n * @since 8.0.0\n */\nexport interface CapgoWatchPlugin {\n /**\n * Send an interactive message to the watch.\n * The watch must be reachable for this to succeed.\n * Use this for time-sensitive, interactive communication.\n *\n * @param options - The message options\n * @returns Promise that resolves when the message is sent\n * @throws Error if the watch is not reachable or session is not active\n * @since 8.0.0\n * @example\n * ```typescript\n * await CapgoWatch.sendMessage({\n * data: { action: 'refresh', timestamp: Date.now() }\n * });\n * ```\n */\n sendMessage(options: SendMessageOptions): Promise<void>;\n\n /**\n * Update the application context shared with the watch.\n * Only the latest context is kept - this overwrites any previous context.\n * Use this for syncing app state that the watch needs to display.\n *\n * @param options - The context options\n * @returns Promise that resolves when the context is updated\n * @throws Error if session is not active\n * @since 8.0.0\n * @example\n * ```typescript\n * await CapgoWatch.updateApplicationContext({\n * context: { theme: 'dark', lastSync: Date.now() }\n * });\n * ```\n */\n updateApplicationContext(options: UpdateContextOptions): Promise<void>;\n\n /**\n * Transfer user info to the watch.\n * Transfers are queued and delivered in order, even if the watch is not currently reachable.\n * Use this for important data that must be delivered reliably.\n *\n * @param options - The user info options\n * @returns Promise that resolves when the transfer is queued\n * @throws Error if session is not active\n * @since 8.0.0\n * @example\n * ```typescript\n * await CapgoWatch.transferUserInfo({\n * userInfo: { recordId: '123', action: 'created' }\n * });\n * ```\n */\n transferUserInfo(options: TransferUserInfoOptions): Promise<void>;\n\n /**\n * Reply to a message from the watch that requested a reply.\n * Use this in response to the messageReceivedWithReply event.\n *\n * @param options - The reply options including the callbackId\n * @returns Promise that resolves when the reply is sent\n * @throws Error if the callback ID is invalid or session is not active\n * @since 8.0.0\n * @example\n * ```typescript\n * CapgoWatch.addListener('messageReceivedWithReply', async (event) => {\n * const result = await processRequest(event.message);\n * await CapgoWatch.replyToMessage({\n * callbackId: event.callbackId,\n * data: { result }\n * });\n * });\n * ```\n */\n replyToMessage(options: ReplyMessageOptions): Promise<void>;\n\n /**\n * Get information about the watch connectivity status.\n *\n * @returns Promise that resolves with watch connectivity info\n * @since 8.0.0\n * @example\n * ```typescript\n * const info = await CapgoWatch.getInfo();\n * if (info.isReachable) {\n * await CapgoWatch.sendMessage({ data: { ping: true } });\n * }\n * ```\n */\n getInfo(): Promise<WatchInfo>;\n\n /**\n * Get the native Capacitor plugin version.\n *\n * @returns Promise that resolves with the plugin version\n * @since 8.0.0\n * @example\n * ```typescript\n * const { version } = await CapgoWatch.getPluginVersion();\n * console.log('Plugin version:', version);\n * ```\n */\n getPluginVersion(): Promise<{ version: string }>;\n\n /**\n * Listen for messages received from the watch.\n *\n * @param eventName - The event name\n * @param listenerFunc - Callback function\n * @returns Handle to remove the listener\n * @since 8.0.0\n * @example\n * ```typescript\n * const handle = await CapgoWatch.addListener('messageReceived', (event) => {\n * console.log('Message from watch:', event.message);\n * });\n * // Later: handle.remove();\n * ```\n */\n addListener(\n eventName: 'messageReceived',\n listenerFunc: (event: MessageReceivedEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for messages from the watch that require a reply.\n *\n * @param eventName - The event name\n * @param listenerFunc - Callback function\n * @returns Handle to remove the listener\n * @since 8.0.0\n * @example\n * ```typescript\n * await CapgoWatch.addListener('messageReceivedWithReply', async (event) => {\n * const response = await handleRequest(event.message);\n * await CapgoWatch.replyToMessage({\n * callbackId: event.callbackId,\n * data: response\n * });\n * });\n * ```\n */\n addListener(\n eventName: 'messageReceivedWithReply',\n listenerFunc: (event: MessageReceivedWithReplyEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for application context updates from the watch.\n *\n * @param eventName - The event name\n * @param listenerFunc - Callback function\n * @returns Handle to remove the listener\n * @since 8.0.0\n * @example\n * ```typescript\n * await CapgoWatch.addListener('applicationContextReceived', (event) => {\n * console.log('Context from watch:', event.context);\n * });\n * ```\n */\n addListener(\n eventName: 'applicationContextReceived',\n listenerFunc: (event: ContextReceivedEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for user info transfers from the watch.\n *\n * @param eventName - The event name\n * @param listenerFunc - Callback function\n * @returns Handle to remove the listener\n * @since 8.0.0\n * @example\n * ```typescript\n * await CapgoWatch.addListener('userInfoReceived', (event) => {\n * console.log('User info from watch:', event.userInfo);\n * });\n * ```\n */\n addListener(\n eventName: 'userInfoReceived',\n listenerFunc: (event: UserInfoReceivedEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for watch reachability changes.\n *\n * @param eventName - The event name\n * @param listenerFunc - Callback function\n * @returns Handle to remove the listener\n * @since 8.0.0\n * @example\n * ```typescript\n * await CapgoWatch.addListener('reachabilityChanged', (event) => {\n * console.log('Watch reachable:', event.isReachable);\n * });\n * ```\n */\n addListener(\n eventName: 'reachabilityChanged',\n listenerFunc: (event: ReachabilityChangedEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Listen for session activation state changes.\n *\n * @param eventName - The event name\n * @param listenerFunc - Callback function\n * @returns Handle to remove the listener\n * @since 8.0.0\n * @example\n * ```typescript\n * await CapgoWatch.addListener('activationStateChanged', (event) => {\n * console.log('Activation state:', event.state);\n * });\n * ```\n */\n addListener(\n eventName: 'activationStateChanged',\n listenerFunc: (event: ActivationStateChangedEvent) => void,\n ): Promise<PluginListenerHandle>;\n\n /**\n * Remove all listeners for this plugin.\n *\n * @since 8.0.0\n * @example\n * ```typescript\n * await CapgoWatch.removeAllListeners();\n * ```\n */\n removeAllListeners(): Promise<void>;\n}\n"]}
@@ -0,0 +1,4 @@
1
+ import type { CapgoWatchPlugin } from './definitions';
2
+ declare const CapgoWatch: CapgoWatchPlugin;
3
+ export * from './definitions';
4
+ export { CapgoWatch };
@@ -0,0 +1,7 @@
1
+ import { registerPlugin } from '@capacitor/core';
2
+ const CapgoWatch = registerPlugin('CapgoWatch', {
3
+ web: () => import('./web').then((m) => new m.CapgoWatchWeb()),
4
+ });
5
+ export * from './definitions';
6
+ export { CapgoWatch };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,UAAU,GAAG,cAAc,CAAmB,YAAY,EAAE;IAChE,GAAG,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;CAC9D,CAAC,CAAC;AAEH,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import { registerPlugin } from '@capacitor/core';\n\nimport type { CapgoWatchPlugin } from './definitions';\n\nconst CapgoWatch = registerPlugin<CapgoWatchPlugin>('CapgoWatch', {\n web: () => import('./web').then((m) => new m.CapgoWatchWeb()),\n});\n\nexport * from './definitions';\nexport { CapgoWatch };\n"]}
@@ -0,0 +1,12 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ import type { CapgoWatchPlugin, SendMessageOptions, UpdateContextOptions, TransferUserInfoOptions, ReplyMessageOptions, WatchInfo } from './definitions';
3
+ export declare class CapgoWatchWeb extends WebPlugin implements CapgoWatchPlugin {
4
+ sendMessage(_options: SendMessageOptions): Promise<void>;
5
+ updateApplicationContext(_options: UpdateContextOptions): Promise<void>;
6
+ transferUserInfo(_options: TransferUserInfoOptions): Promise<void>;
7
+ replyToMessage(_options: ReplyMessageOptions): Promise<void>;
8
+ getInfo(): Promise<WatchInfo>;
9
+ getPluginVersion(): Promise<{
10
+ version: string;
11
+ }>;
12
+ }
@@ -0,0 +1,28 @@
1
+ import { WebPlugin } from '@capacitor/core';
2
+ export class CapgoWatchWeb extends WebPlugin {
3
+ async sendMessage(_options) {
4
+ throw this.unavailable('Apple Watch is not available on web');
5
+ }
6
+ async updateApplicationContext(_options) {
7
+ throw this.unavailable('Apple Watch is not available on web');
8
+ }
9
+ async transferUserInfo(_options) {
10
+ throw this.unavailable('Apple Watch is not available on web');
11
+ }
12
+ async replyToMessage(_options) {
13
+ throw this.unavailable('Apple Watch is not available on web');
14
+ }
15
+ async getInfo() {
16
+ return {
17
+ isSupported: false,
18
+ isPaired: false,
19
+ isWatchAppInstalled: false,
20
+ isReachable: false,
21
+ activationState: 0,
22
+ };
23
+ }
24
+ async getPluginVersion() {
25
+ return { version: 'web' };
26
+ }
27
+ }
28
+ //# sourceMappingURL=web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAW5C,MAAM,OAAO,aAAc,SAAQ,SAAS;IAC1C,KAAK,CAAC,WAAW,CAAC,QAA4B;QAC5C,MAAM,IAAI,CAAC,WAAW,CAAC,qCAAqC,CAAC,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,wBAAwB,CAAC,QAA8B;QAC3D,MAAM,IAAI,CAAC,WAAW,CAAC,qCAAqC,CAAC,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,gBAAgB,CAAC,QAAiC;QACtD,MAAM,IAAI,CAAC,WAAW,CAAC,qCAAqC,CAAC,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,QAA6B;QAChD,MAAM,IAAI,CAAC,WAAW,CAAC,qCAAqC,CAAC,CAAC;IAChE,CAAC;IAED,KAAK,CAAC,OAAO;QACX,OAAO;YACL,WAAW,EAAE,KAAK;YAClB,QAAQ,EAAE,KAAK;YACf,mBAAmB,EAAE,KAAK;YAC1B,WAAW,EAAE,KAAK;YAClB,eAAe,EAAE,CAAC;SACnB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAC5B,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n CapgoWatchPlugin,\n SendMessageOptions,\n UpdateContextOptions,\n TransferUserInfoOptions,\n ReplyMessageOptions,\n WatchInfo,\n} from './definitions';\n\nexport class CapgoWatchWeb extends WebPlugin implements CapgoWatchPlugin {\n async sendMessage(_options: SendMessageOptions): Promise<void> {\n throw this.unavailable('Apple Watch is not available on web');\n }\n\n async updateApplicationContext(_options: UpdateContextOptions): Promise<void> {\n throw this.unavailable('Apple Watch is not available on web');\n }\n\n async transferUserInfo(_options: TransferUserInfoOptions): Promise<void> {\n throw this.unavailable('Apple Watch is not available on web');\n }\n\n async replyToMessage(_options: ReplyMessageOptions): Promise<void> {\n throw this.unavailable('Apple Watch is not available on web');\n }\n\n async getInfo(): Promise<WatchInfo> {\n return {\n isSupported: false,\n isPaired: false,\n isWatchAppInstalled: false,\n isReachable: false,\n activationState: 0,\n };\n }\n\n async getPluginVersion(): Promise<{ version: string }> {\n return { version: 'web' };\n }\n}\n"]}
@@ -0,0 +1,42 @@
1
+ 'use strict';
2
+
3
+ var core = require('@capacitor/core');
4
+
5
+ const CapgoWatch = core.registerPlugin('CapgoWatch', {
6
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CapgoWatchWeb()),
7
+ });
8
+
9
+ class CapgoWatchWeb extends core.WebPlugin {
10
+ async sendMessage(_options) {
11
+ throw this.unavailable('Apple Watch is not available on web');
12
+ }
13
+ async updateApplicationContext(_options) {
14
+ throw this.unavailable('Apple Watch is not available on web');
15
+ }
16
+ async transferUserInfo(_options) {
17
+ throw this.unavailable('Apple Watch is not available on web');
18
+ }
19
+ async replyToMessage(_options) {
20
+ throw this.unavailable('Apple Watch is not available on web');
21
+ }
22
+ async getInfo() {
23
+ return {
24
+ isSupported: false,
25
+ isPaired: false,
26
+ isWatchAppInstalled: false,
27
+ isReachable: false,
28
+ activationState: 0,
29
+ };
30
+ }
31
+ async getPluginVersion() {
32
+ return { version: 'web' };
33
+ }
34
+ }
35
+
36
+ var web = /*#__PURE__*/Object.freeze({
37
+ __proto__: null,
38
+ CapgoWatchWeb: CapgoWatchWeb
39
+ });
40
+
41
+ exports.CapgoWatch = CapgoWatch;
42
+ //# sourceMappingURL=plugin.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapgoWatch = registerPlugin('CapgoWatch', {\n web: () => import('./web').then((m) => new m.CapgoWatchWeb()),\n});\nexport * from './definitions';\nexport { CapgoWatch };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapgoWatchWeb extends WebPlugin {\n async sendMessage(_options) {\n throw this.unavailable('Apple Watch is not available on web');\n }\n async updateApplicationContext(_options) {\n throw this.unavailable('Apple Watch is not available on web');\n }\n async transferUserInfo(_options) {\n throw this.unavailable('Apple Watch is not available on web');\n }\n async replyToMessage(_options) {\n throw this.unavailable('Apple Watch is not available on web');\n }\n async getInfo() {\n return {\n isSupported: false,\n isPaired: false,\n isWatchAppInstalled: false,\n isReachable: false,\n activationState: 0,\n };\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,UAAU,GAAGA,mBAAc,CAAC,YAAY,EAAE;AAChD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;AACjE,CAAC;;ACFM,MAAM,aAAa,SAASC,cAAS,CAAC;AAC7C,IAAI,MAAM,WAAW,CAAC,QAAQ,EAAE;AAChC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,qCAAqC,CAAC;AACrE,IAAI;AACJ,IAAI,MAAM,wBAAwB,CAAC,QAAQ,EAAE;AAC7C,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,qCAAqC,CAAC;AACrE,IAAI;AACJ,IAAI,MAAM,gBAAgB,CAAC,QAAQ,EAAE;AACrC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,qCAAqC,CAAC;AACrE,IAAI;AACJ,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE;AACnC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,qCAAqC,CAAC;AACrE,IAAI;AACJ,IAAI,MAAM,OAAO,GAAG;AACpB,QAAQ,OAAO;AACf,YAAY,WAAW,EAAE,KAAK;AAC9B,YAAY,QAAQ,EAAE,KAAK;AAC3B,YAAY,mBAAmB,EAAE,KAAK;AACtC,YAAY,WAAW,EAAE,KAAK;AAC9B,YAAY,eAAe,EAAE,CAAC;AAC9B,SAAS;AACT,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;AACjC,IAAI;AACJ;;;;;;;;;"}
package/dist/plugin.js ADDED
@@ -0,0 +1,45 @@
1
+ var capacitorCapgoWatch = (function (exports, core) {
2
+ 'use strict';
3
+
4
+ const CapgoWatch = core.registerPlugin('CapgoWatch', {
5
+ web: () => Promise.resolve().then(function () { return web; }).then((m) => new m.CapgoWatchWeb()),
6
+ });
7
+
8
+ class CapgoWatchWeb extends core.WebPlugin {
9
+ async sendMessage(_options) {
10
+ throw this.unavailable('Apple Watch is not available on web');
11
+ }
12
+ async updateApplicationContext(_options) {
13
+ throw this.unavailable('Apple Watch is not available on web');
14
+ }
15
+ async transferUserInfo(_options) {
16
+ throw this.unavailable('Apple Watch is not available on web');
17
+ }
18
+ async replyToMessage(_options) {
19
+ throw this.unavailable('Apple Watch is not available on web');
20
+ }
21
+ async getInfo() {
22
+ return {
23
+ isSupported: false,
24
+ isPaired: false,
25
+ isWatchAppInstalled: false,
26
+ isReachable: false,
27
+ activationState: 0,
28
+ };
29
+ }
30
+ async getPluginVersion() {
31
+ return { version: 'web' };
32
+ }
33
+ }
34
+
35
+ var web = /*#__PURE__*/Object.freeze({
36
+ __proto__: null,
37
+ CapgoWatchWeb: CapgoWatchWeb
38
+ });
39
+
40
+ exports.CapgoWatch = CapgoWatch;
41
+
42
+ return exports;
43
+
44
+ })({}, capacitorExports);
45
+ //# sourceMappingURL=plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapgoWatch = registerPlugin('CapgoWatch', {\n web: () => import('./web').then((m) => new m.CapgoWatchWeb()),\n});\nexport * from './definitions';\nexport { CapgoWatch };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapgoWatchWeb extends WebPlugin {\n async sendMessage(_options) {\n throw this.unavailable('Apple Watch is not available on web');\n }\n async updateApplicationContext(_options) {\n throw this.unavailable('Apple Watch is not available on web');\n }\n async transferUserInfo(_options) {\n throw this.unavailable('Apple Watch is not available on web');\n }\n async replyToMessage(_options) {\n throw this.unavailable('Apple Watch is not available on web');\n }\n async getInfo() {\n return {\n isSupported: false,\n isPaired: false,\n isWatchAppInstalled: false,\n isReachable: false,\n activationState: 0,\n };\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,UAAU,GAAGA,mBAAc,CAAC,YAAY,EAAE;IAChD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;IACjE,CAAC;;ICFM,MAAM,aAAa,SAASC,cAAS,CAAC;IAC7C,IAAI,MAAM,WAAW,CAAC,QAAQ,EAAE;IAChC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,qCAAqC,CAAC;IACrE,IAAI;IACJ,IAAI,MAAM,wBAAwB,CAAC,QAAQ,EAAE;IAC7C,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,qCAAqC,CAAC;IACrE,IAAI;IACJ,IAAI,MAAM,gBAAgB,CAAC,QAAQ,EAAE;IACrC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,qCAAqC,CAAC;IACrE,IAAI;IACJ,IAAI,MAAM,cAAc,CAAC,QAAQ,EAAE;IACnC,QAAQ,MAAM,IAAI,CAAC,WAAW,CAAC,qCAAqC,CAAC;IACrE,IAAI;IACJ,IAAI,MAAM,OAAO,GAAG;IACpB,QAAQ,OAAO;IACf,YAAY,WAAW,EAAE,KAAK;IAC9B,YAAY,QAAQ,EAAE,KAAK;IAC3B,YAAY,mBAAmB,EAAE,KAAK;IACtC,YAAY,WAAW,EAAE,KAAK;IAC9B,YAAY,eAAe,EAAE,CAAC;IAC9B,SAAS;IACT,IAAI;IACJ,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;IACjC,IAAI;IACJ;;;;;;;;;;;;;;;"}