@salesforce/afv-skills 1.12.0 → 1.14.0
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 +3 -3
- package/skills/building-mobile-apps/SKILL.md +70 -0
- package/skills/building-ui-bundle-app/SKILL.md +33 -8
- package/skills/generating-custom-application/SKILL.md +1 -1
- package/skills/generating-ui-bundle-custom-app/SKILL.md +93 -0
- package/skills/generating-ui-bundle-custom-app/docs/configure-metadata-custom-application.md +70 -0
- package/skills/generating-ui-bundle-metadata/SKILL.md +39 -1
- package/skills/reviewing-lwc-mobile-offline/SKILL.md +168 -0
- package/skills/reviewing-lwc-mobile-offline/references/grounding.md +7 -0
- package/skills/reviewing-lwc-mobile-offline/references/inline-graphql.md +43 -0
- package/skills/reviewing-lwc-mobile-offline/references/komaci-eslint.md +125 -0
- package/skills/reviewing-lwc-mobile-offline/references/lwc-if.md +78 -0
- package/skills/reviewing-lwc-mobile-offline/scripts/komaci.config.mjs +18 -0
- package/skills/reviewing-lwc-mobile-offline/scripts/package.json +10 -0
- package/skills/reviewing-lwc-mobile-offline/scripts/run-komaci.sh +69 -0
- package/skills/using-mobile-native-capabilities/SKILL.md +182 -0
- package/skills/using-mobile-native-capabilities/references/app-review.md +68 -0
- package/skills/using-mobile-native-capabilities/references/ar-space-capture.md +125 -0
- package/skills/using-mobile-native-capabilities/references/barcode-scanner.md +219 -0
- package/skills/using-mobile-native-capabilities/references/base-capability.md +22 -0
- package/skills/using-mobile-native-capabilities/references/biometrics.md +90 -0
- package/skills/using-mobile-native-capabilities/references/calendar.md +213 -0
- package/skills/using-mobile-native-capabilities/references/contacts.md +232 -0
- package/skills/using-mobile-native-capabilities/references/document-scanner.md +342 -0
- package/skills/using-mobile-native-capabilities/references/geofencing.md +123 -0
- package/skills/using-mobile-native-capabilities/references/location.md +158 -0
- package/skills/using-mobile-native-capabilities/references/mobile-capabilities.md +30 -0
- package/skills/using-mobile-native-capabilities/references/nfc.md +181 -0
- package/skills/using-mobile-native-capabilities/references/payments.md +95 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# Barcode Scanner Service Grounding Context
|
|
2
|
+
|
|
3
|
+
The following content provides grounding information for generating a Salesforce LWC that leverages barcode scanning facilities on mobile devices. Specifically, this context will cover the API types and methods available to leverage the barcode scanning API of the mobile device, within the LWC.
|
|
4
|
+
|
|
5
|
+
## Barcode Scanner Service API
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
/*
|
|
9
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
|
10
|
+
* All rights reserved.
|
|
11
|
+
* For full license text, see the LICENSE.txt file
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { BaseCapability } from '../BaseCapability.js';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Use this factory function to get an instance of {@linkcode BarcodeScanner}.
|
|
18
|
+
* @returns An instance of {@linkcode BarcodeScanner}.
|
|
19
|
+
*/
|
|
20
|
+
export function getBarcodeScanner(): BarcodeScanner;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Scan barcodes from a Lightning web component.
|
|
24
|
+
* @see {@link https://developer.salesforce.com/docs/platform/lwc/guide/reference-lightning-barcodescanner.html|BarcodeScanner API}
|
|
25
|
+
*/
|
|
26
|
+
export interface BarcodeScanner extends BaseCapability {
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Use this function to start a new scanning session. Consider using scan() instead.
|
|
29
|
+
* @param options A {@linkcode BarcodeScannerOptions} object to configure the scanning session.
|
|
30
|
+
* @returns A resolved promise returns {@linkcode Barcode} object.
|
|
31
|
+
*/
|
|
32
|
+
beginCapture(options?: BarcodeScannerOptions): Promise<Barcode>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @deprecated Use this function to continue a scanning session. Consider using scan() instead.
|
|
36
|
+
* @returns A resolved promise returns {@linkcode Barcode} object.
|
|
37
|
+
*/
|
|
38
|
+
resumeCapture(): Promise<Barcode>;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated Use this function to end a scanning session, close the mobile OS scanning interface, and dispose resources. Consider using dismiss() instead.
|
|
42
|
+
*/
|
|
43
|
+
endCapture(): void;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Use this function to start scanning barcodes.
|
|
47
|
+
* @returns A resolved promise returns an array of {@linkcode Barcode} objects.
|
|
48
|
+
*/
|
|
49
|
+
scan(options: BarcodeScannerOptions): Promise<Barcode[]>;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Use this function to end a scanning session, close the mobile OS scanning interface, and dispose of resources.
|
|
53
|
+
*/
|
|
54
|
+
dismiss(): void;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Available values of barcode types as defined by {@linkcode BarcodeType}.
|
|
58
|
+
*/
|
|
59
|
+
barcodeTypes: BarcodeType;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* An object representing a scanned barcode.
|
|
64
|
+
*/
|
|
65
|
+
export interface Barcode {
|
|
66
|
+
/**
|
|
67
|
+
* The type of barcode that was recognized. Available values are enumerated in BarcodeScanner.barcodeTypes.
|
|
68
|
+
*/
|
|
69
|
+
type: BarcodeType;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The decoded value of the barcode.
|
|
73
|
+
*/
|
|
74
|
+
value: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* An object enumerating the barcode symbologies supported by {@linkcode BarcodeScanner}.
|
|
79
|
+
*/
|
|
80
|
+
export interface BarcodeType {
|
|
81
|
+
CODE_128: 'code128';
|
|
82
|
+
CODE_39: 'code39';
|
|
83
|
+
CODE_93: 'code93';
|
|
84
|
+
DATA_MATRIX: 'datamatrix';
|
|
85
|
+
EAN_13: 'ean13';
|
|
86
|
+
EAN_8: 'ean8';
|
|
87
|
+
ITF: 'itf';
|
|
88
|
+
UPC_A: 'upca';
|
|
89
|
+
UPC_E: 'upce';
|
|
90
|
+
PDF_417: 'pdf417';
|
|
91
|
+
QR: 'qr';
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* An object representing an error that occurred when attempting to scan a barcode.
|
|
96
|
+
*/
|
|
97
|
+
export interface BarcodeScannerFailure {
|
|
98
|
+
/**
|
|
99
|
+
* A value representing the reason for the scanning failure
|
|
100
|
+
*/
|
|
101
|
+
code: BarcodeScannerFailureCode;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* A string value explaining the reason for the scanning failure.
|
|
105
|
+
* This value is suitable for use in user interface messages.
|
|
106
|
+
* The message is provided in English, and isn’t localized.
|
|
107
|
+
*/
|
|
108
|
+
message: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Possible failure codes.
|
|
113
|
+
*/
|
|
114
|
+
export type BarcodeScannerFailureCode =
|
|
115
|
+
| 'USER_DISMISSED' // The user clicked the button to dismiss the scanner
|
|
116
|
+
| 'USER_DENIED_PERMISSION' // This is only ever returned on android. android: permission was denied by user when prompt, could ask again.
|
|
117
|
+
| 'USER_DISABLED_PERMISSION' // Both ios and android will use this as it requires the same action of the user going to settings.
|
|
118
|
+
// Android: permission was denied along "don't ask again" when prompt, will need to go app setting to turn on.
|
|
119
|
+
// iOS: permission was disabled by the user and will need to be turned on in settings
|
|
120
|
+
| 'INVALID_BARCODE_TYPE_REQUESTED' // One or more invalid barcode types were passed to the scanner for scanning
|
|
121
|
+
| 'SERVICE_NOT_ENABLED' // The service is not enabled and therefore cannot be used.
|
|
122
|
+
| 'UNKNOWN_REASON'; // A hardware or unknown failure happened when trying to use the camera or other reason, like FirebaseVision failure. This is not caused by a lack of permission.
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* ScannerSize values.
|
|
126
|
+
*/
|
|
127
|
+
export type ScannerSize = 'SMALL' | 'MEDIUM' | 'LARGE' | 'XLARGE' | 'FULLSCREEN';
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* CameraFacing values.
|
|
131
|
+
*/
|
|
132
|
+
export type CameraFacing = 'FRONT' | 'BACK';
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* An object representing configuration details for a barcode scanning session.
|
|
136
|
+
*/
|
|
137
|
+
export interface BarcodeScannerOptions {
|
|
138
|
+
/**
|
|
139
|
+
* Optional. Specifies the types of barcodes to scan for. Available values are enumerated in BarcodeScanner.barcodeTypes. Defaults to all supported barcode types.
|
|
140
|
+
*/
|
|
141
|
+
barcodeTypes?: string[];
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Optional. Provides instructions to display in the scanning interface. Defaults to no text.
|
|
145
|
+
*/
|
|
146
|
+
instructionText?: string;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Optional. Provides a message to display in the scanning interface when a barcode is successfully scanned. Defaults to no text.
|
|
150
|
+
*/
|
|
151
|
+
successText?: string;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Optional. Indicates whether or not a check mark is displayed upon a successful scan. Defaults to true.
|
|
155
|
+
*/
|
|
156
|
+
showSuccessCheckMark?: boolean;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Optional. Determines whether the device vibrates when a scan is successful. Defaults to true.
|
|
160
|
+
*/
|
|
161
|
+
vibrateOnSuccess?: boolean;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Optional. Modifies the size of the scanner camera view. The available options represent a percentage of the user's device screen size.
|
|
165
|
+
*/
|
|
166
|
+
scannerSize?: ScannerSize;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Optional. Specifies whether the front- or rear-facing camera is used. Defaults to "BACK". Available options include "FRONT" and "BACK". If the user's device doesn't support the specified camera facing, an error is returned.
|
|
170
|
+
*/
|
|
171
|
+
cameraFacing?: CameraFacing;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Optional. Defines a custom user interface for the scanner instead of using the standard UI. Defaults to null. If nothing is passed in for this parameter, the standard UI is used. If a custom UI is used, it completely replaces the standard UI,
|
|
175
|
+
* including the standard Cancel button used for dismissing the scanner. When defining a custom UI, it's the responsibility of the caller to handle dismissing the scanner.
|
|
176
|
+
*/
|
|
177
|
+
backgroundViewHTML?: string;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Optional. Determines whether the scanner animates in and out when presented and dismissed. Defaults to true.
|
|
181
|
+
*/
|
|
182
|
+
presentWithAnimation?: boolean;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Optional. Determines whether the user has to manually confirm that a detected barcode should be scanned. Defaults to false.
|
|
186
|
+
*/
|
|
187
|
+
manualConfirmation?: boolean;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Optional. Determines whether the scanner displays the barcode data while scanning. Defaults to true. Previewing barcode is only supported when backgroundViewHTML is omitted.
|
|
191
|
+
*/
|
|
192
|
+
previewBarcodeData?: boolean;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Optional. Determines whether the scanner collects the results of scanned barcodes before sending them back to the caller. Defaults to false. When set to true, the scanner
|
|
196
|
+
* collects the results of scanned barcodes and displays them on the screen. When the user taps done, the scanned barcode data is sent back to the caller.
|
|
197
|
+
*/
|
|
198
|
+
enableBulkScan?: boolean;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Optional. Determines whether the scanner detects multiple barcodes simultaneously. Defaults to false. Setting this parameter to true will automatically set the enableBulkScan parameter to true as well.
|
|
202
|
+
*/
|
|
203
|
+
enableMultiScan?: boolean;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Optional. Enable flashlight. Defaults to false.
|
|
207
|
+
*/
|
|
208
|
+
enableFlashlight?: boolean;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Optional. Defaults to 1.0 or 1x magnification. Sets the initial magnification level of the camera when launching the scanner.
|
|
212
|
+
* A value of 1.0 represents no magnification (1x). Higher values (e.g., 2.0 or 4.0) can be useful for scanning small barcodes
|
|
213
|
+
* without requiring manual zoom gestures. Users can still adjust the zoom level using pinch-to-zoom gestures.
|
|
214
|
+
* Note: If the provided zoom factor exceeds the device camera's supported range, the value will be clamped to the nearest
|
|
215
|
+
* supported min/max zoom factor.
|
|
216
|
+
*/
|
|
217
|
+
initialZoomFactor?: number;
|
|
218
|
+
}
|
|
219
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# BaseCapability
|
|
2
|
+
|
|
3
|
+
Common interface implemented by every mobile native capability. Use `isAvailable()` to gate code paths so the LWC degrades gracefully on unsupported surfaces (desktop, mobile web).
|
|
4
|
+
|
|
5
|
+
```typescript
|
|
6
|
+
/*
|
|
7
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
|
8
|
+
* All rights reserved.
|
|
9
|
+
* For full license text, see the LICENSE.txt file
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Provide all services with common functionalities.
|
|
14
|
+
*/
|
|
15
|
+
export interface BaseCapability {
|
|
16
|
+
/**
|
|
17
|
+
* Use this function to determine whether the respective service functionality is available.
|
|
18
|
+
* @returns Returns true when used on a supported device and false otherwise.
|
|
19
|
+
*/
|
|
20
|
+
isAvailable(): boolean;
|
|
21
|
+
}
|
|
22
|
+
```
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Biometrics Service Grounding Context
|
|
2
|
+
|
|
3
|
+
The following content provides grounding information for generating a Salesforce LWC that leverages biometrics scanning facilities on mobile devices. Specifically, this context will cover the API types and methods available to leverage the face recognition and the finger printing scanner of the mobile device to authorize the user, within the LWC.
|
|
4
|
+
|
|
5
|
+
## Biometrics Service API
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
/*
|
|
9
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
|
10
|
+
* All rights reserved.
|
|
11
|
+
* For full license text, see the LICENSE.txt file
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { BaseCapability } from '../BaseCapability.js';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Use this factory function to get an instance of {@linkcode BiometricsService}.
|
|
18
|
+
* @returns An instance of {@linkcode BiometricsService}.
|
|
19
|
+
*/
|
|
20
|
+
export function getBiometricsService(): BiometricsService;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Access a device’s biometrics capabilities from a Lightning web component.
|
|
24
|
+
* @see {@link https://developer.salesforce.com/docs/platform/lwc/guide/reference-lightning-biometricsservice.html|BiometricsService API}
|
|
25
|
+
*/
|
|
26
|
+
export interface BiometricsService extends BaseCapability {
|
|
27
|
+
/**
|
|
28
|
+
* Verify if the biometrics hardware or pin code is available to use to verify the user’s device ownership.
|
|
29
|
+
* @param options A {@linkcode BiometricsServiceOptions} object to configure the {@linkcode BiometricsService} request.
|
|
30
|
+
* @returns A Promise object that resolves as a Boolean value. True if the biometrics hardware or pin code is available for use and false otherwise.
|
|
31
|
+
*/
|
|
32
|
+
isBiometricsReady(options?: BiometricsServiceOptions): Promise<boolean>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Verify if the user is the device owner using the device’s biometrics hardware or pin code.
|
|
36
|
+
* @param options A {@linkcode BiometricsServiceOptions} object to configure the {@linkcode BiometricsService} request.
|
|
37
|
+
* @returns A Promise object that resolves as a Boolean value. True if the user is the registered device owner and false otherwise.
|
|
38
|
+
*/
|
|
39
|
+
checkUserIsDeviceOwner(options?: BiometricsServiceOptions): Promise<boolean>;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* An object for specifying which instances of a recurring event are affected by an update to or deletion of one instance of the event.
|
|
44
|
+
*/
|
|
45
|
+
export interface BiometricsServiceOptions {
|
|
46
|
+
/**
|
|
47
|
+
* Reason to use biometrics scanner.
|
|
48
|
+
*/
|
|
49
|
+
permissionRequestBody?: string;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Title used in the dialog when the reason text is displayed. Allowed on iOS, but effective only on Android.
|
|
53
|
+
*/
|
|
54
|
+
permissionRequestTitle?: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Policies specified in the array allows customization of the biometrics scan behavior.
|
|
58
|
+
*/
|
|
59
|
+
additionalSupportedPolicies?: BiometricsServicePolicy[];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* An object representing policy to use pin code as an alternative to biometrics.
|
|
64
|
+
*/
|
|
65
|
+
export type BiometricsServicePolicy = /** User cancelled the operation. */ 'PIN_CODE';
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* An object representing an error that occurred when accessing {@linkcode BiometricsService} features.
|
|
69
|
+
*/
|
|
70
|
+
interface BiometricsServiceFailure {
|
|
71
|
+
/**
|
|
72
|
+
* A value representing the reason for a biometrics service error. See {@linkcode BiometricsServiceFailureCode} for the list of possible values.
|
|
73
|
+
*/
|
|
74
|
+
code: BiometricsServiceFailureCode;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* A string value describing the reason for the failure. This value is suitable for use in user interface messages. The message is provided in English and isn’t localized.
|
|
78
|
+
*/
|
|
79
|
+
message: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Correlates with the code property on the {@linkcode BiometricsServiceFailure} object.
|
|
84
|
+
*/
|
|
85
|
+
type BiometricsServiceFailureCode =
|
|
86
|
+
| 'HARDWARE_NOT_AVAILABLE' // There is no fingerprint scanner or face recognition hardware found.
|
|
87
|
+
| 'NOT_CONFIGURED' // Biometrics hardware was found but has not been set up yet.
|
|
88
|
+
| 'SERVICE_NOT_ENABLED' // BiometricsService is not enabled and cannot be used.
|
|
89
|
+
| 'UNKNOWN_REASON'; // An error occurred in the native code that isn’t related to permissions or hardware issues. More information is provided in the BiometricsServiceFailure message.
|
|
90
|
+
```
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
# Calendar Service Grounding Context
|
|
2
|
+
|
|
3
|
+
The following content provides grounding information for generating a Salesforce LWC that leverages calendar facilities on mobile devices. Specifically, this context will cover the API types and methods available to leverage the calendar API of the mobile device, within the LWC.
|
|
4
|
+
|
|
5
|
+
## Calendar Service API
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
/*
|
|
9
|
+
* Copyright (c) 2024, Salesforce, Inc.
|
|
10
|
+
* All rights reserved.
|
|
11
|
+
* For full license text, see the LICENSE.txt file
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { BaseCapability } from '../BaseCapability.js';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Use this factory function to get an instance of {@linkcode CalendarService}.
|
|
18
|
+
* @returns An instance of {@linkcode CalendarService}.
|
|
19
|
+
*/
|
|
20
|
+
export function getCalendarService(): CalendarService;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Manage calendar events from a Lightning web component.
|
|
24
|
+
* @see {@link https://developer.salesforce.com/docs/platform/lwc/guide/reference-lightning-calendarservice.html|CalendarService API}
|
|
25
|
+
*/
|
|
26
|
+
export interface CalendarService extends BaseCapability {
|
|
27
|
+
/**
|
|
28
|
+
* Returns all available calendars from the device’s native Calendar application.
|
|
29
|
+
* If needed, a permission pop-up for the user to grant calendar access is presented first.
|
|
30
|
+
* @param options A {@linkcode CalendarServiceOptions} object to configure the {@linkcode CalendarService} request.
|
|
31
|
+
* @returns A Promise object that resolves as an array of {@linkcode Calendar} objects.
|
|
32
|
+
*/
|
|
33
|
+
getCalendars(options?: CalendarServiceOptions): Promise<Calendar[]>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Returns all events of all available calendar events in a specified date range from the specified calendars.
|
|
37
|
+
* @param startDateSecondsUTC The start of the date range.
|
|
38
|
+
* @param endDateSecondsUTC The end of the date range.
|
|
39
|
+
* @param calendars The titles of calendars to get events from. If not provided, or null is passed in, events are fetched from all available calendars.
|
|
40
|
+
* @param options A {@linkcode CalendarServiceOptions} object to configure the {@linkcode CalendarService} request.
|
|
41
|
+
* @returns A Promise object that resolves as an array of {@linkcode CalendarEvent} objects.
|
|
42
|
+
*/
|
|
43
|
+
getEvents(
|
|
44
|
+
startDateSecondsUTC: number,
|
|
45
|
+
endDateSecondsUTC: number,
|
|
46
|
+
calendars?: string[],
|
|
47
|
+
options?: CalendarServiceOptions,
|
|
48
|
+
): Promise<CalendarEvent[]>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Adds an event to the device’s calendar.
|
|
52
|
+
* @param event A {@linkcode CalendarEvent} object to be added to the device’s calendar.
|
|
53
|
+
* @param options A {@linkcode CalendarServiceOptions} object to configure the {@linkcode CalendarService} request.
|
|
54
|
+
* @returns A Promise object that resolves as a coerced version of the {@linkcode CalendarEvent} parameter.
|
|
55
|
+
*/
|
|
56
|
+
addEvent(event: CalendarEvent, options?: CalendarServiceOptions): Promise<CalendarEvent>;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Updates an event in the device’s calendar.
|
|
60
|
+
* @param updatedEvent A {@linkcode CalendarEvent} object with updated data to replace the existing data in the corresponding event on the device’s calendar.
|
|
61
|
+
* @param options A {@linkcode CalendarServiceOptions} object to configure the {@linkcode CalendarService} request.
|
|
62
|
+
* @returns A Promise object that resolves as a coerced version of the {@linkcode CalendarEvent} parameter.
|
|
63
|
+
*/
|
|
64
|
+
updateEvent(updatedEvent: CalendarEvent, options?: CalendarServiceOptions): Promise<CalendarEvent>;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Removes an event from a device’s calendar.
|
|
68
|
+
* @param event The {@linkcode CalendarEvent} object to be removed from the device’s calendar.
|
|
69
|
+
* @param options A {@linkcode CalendarServiceOptions} object to configure the {@linkcode CalendarService} request.
|
|
70
|
+
* @returns If successful, null is returned.
|
|
71
|
+
*/
|
|
72
|
+
removeEvent(event: CalendarEvent, options?: CalendarServiceOptions): Promise<null>;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Calendar interface.
|
|
77
|
+
*/
|
|
78
|
+
export interface Calendar {
|
|
79
|
+
id: string;
|
|
80
|
+
title: string;
|
|
81
|
+
allowsContentModifications: boolean; // indicates whether the calendar is read-only
|
|
82
|
+
hexColor: string; // includes # + hex color value, e.g #c603fc
|
|
83
|
+
type: string; // a string hinting about calendar type. It is platform specific. on iOS it is set to EKSource.sourceType+EKSource.title and on Android it is set to CalendarContract.Calendars.ACCOUNT_TYPE+CalendarContract.Calendars.ACCOUNT_NAME
|
|
84
|
+
isPrimary: boolean; // indicates whether it is the primary/default calendar
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Event interface.
|
|
89
|
+
*/
|
|
90
|
+
export interface CalendarEvent {
|
|
91
|
+
id: string;
|
|
92
|
+
isAllDay: boolean; // defaults to False
|
|
93
|
+
startDateSecondsUTC: number;
|
|
94
|
+
endDateSecondsUTC: number;
|
|
95
|
+
availability: EventAvailability; // defaults to Busy
|
|
96
|
+
status: EventStatus; // read-only - value set by caller will be ignored and overwritten by the plugin
|
|
97
|
+
calendarId?: string;
|
|
98
|
+
title: string;
|
|
99
|
+
location?: string;
|
|
100
|
+
notes?: string;
|
|
101
|
+
alarms?: Alarm[];
|
|
102
|
+
attendees?: Participant[]; // Note: on iOS this field can only be used for fetching attendee info of an existing event, but you cannot create an event with attendee info (which is an EventKit limitation as mentioned here https://apple.co/3toRnDO)
|
|
103
|
+
recurrenceRules?: RecurrenceRule[];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* EventAvailability values.
|
|
108
|
+
*/
|
|
109
|
+
export type EventAvailability = 'Busy' | 'Free' | 'Tentative';
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* EventStatus values.
|
|
113
|
+
*/
|
|
114
|
+
export type EventStatus = 'Canceled' | 'Confirmed' | 'Tentative';
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Alarm interface.
|
|
118
|
+
*/
|
|
119
|
+
export interface Alarm {
|
|
120
|
+
relativeOffsetSeconds: number;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Participant interface.
|
|
125
|
+
*/
|
|
126
|
+
export interface Participant {
|
|
127
|
+
name: string;
|
|
128
|
+
email: string | null;
|
|
129
|
+
role: ParticipantRole;
|
|
130
|
+
status: ParticipantStatus;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* ParticipantRole values.
|
|
135
|
+
*/
|
|
136
|
+
export type ParticipantRole = 'Required' | 'Optional' | 'Unknown';
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* ParticipantStatus values.
|
|
140
|
+
*/
|
|
141
|
+
export type ParticipantStatus = 'Accepted' | 'Declined' | 'Pending' | 'Tentative' | 'Unknown';
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* The recurrence rule as defined by https://datatracker.ietf.org/doc/html/rfc5545#section-3.3.10.
|
|
145
|
+
*/
|
|
146
|
+
export interface RecurrenceRule {
|
|
147
|
+
frequency: RecurrenceFrequency;
|
|
148
|
+
interval: number;
|
|
149
|
+
daysOfTheWeek?: RecurrenceDayOfWeek[];
|
|
150
|
+
daysOfTheMonth?: number[];
|
|
151
|
+
monthsOfTheYear?: number[];
|
|
152
|
+
weeksOfTheYear?: number[];
|
|
153
|
+
daysOfTheYear?: number[];
|
|
154
|
+
setPositions?: number[];
|
|
155
|
+
end?: RecurrenceEnd;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* RecurrenceFrequency values.
|
|
160
|
+
*/
|
|
161
|
+
export type RecurrenceFrequency = 'Daily' | 'Weekly' | 'Monthly' | 'Yearly';
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* RecurrenceDayOfWeek interface.
|
|
165
|
+
*/
|
|
166
|
+
export interface RecurrenceDayOfWeek {
|
|
167
|
+
dayOfTheWeek: Weekday;
|
|
168
|
+
weekNumber: number;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Weekday values.
|
|
173
|
+
*/
|
|
174
|
+
export type Weekday = 'Sunday' | 'Monday' | 'Tuesday' | 'Wednesday' | 'Thursday' | 'Friday' | 'Saturday';
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* RecurrenceEnd interface.
|
|
178
|
+
*/
|
|
179
|
+
export interface RecurrenceEnd {
|
|
180
|
+
endDateSecondsUTC?: number;
|
|
181
|
+
occurrenceCount?: number;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* CalendarServiceOptions interface.
|
|
186
|
+
*/
|
|
187
|
+
export interface CalendarServiceOptions {
|
|
188
|
+
permissionRationaleText?: string;
|
|
189
|
+
span?: Span;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Span values.
|
|
194
|
+
*/
|
|
195
|
+
export type Span = 'ThisEvent' | 'ThisAndFollowingEvents';
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* CalendarServiceFailure interface.
|
|
199
|
+
*/
|
|
200
|
+
export interface CalendarServiceFailure {
|
|
201
|
+
code: CalendarServiceFailureCode;
|
|
202
|
+
message: string;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Possible failure codes.
|
|
207
|
+
*/
|
|
208
|
+
export type CalendarServiceFailureCode =
|
|
209
|
+
| 'USER_DENIED_PERMISSION' // Permission was denied by user when prompt.
|
|
210
|
+
| 'NOT_FOUND' // A specified item (calendar or event) was not found.
|
|
211
|
+
| 'SERVICE_NOT_ENABLED' // The service is not enabled and therefore cannot be used.
|
|
212
|
+
| 'UNKNOWN_REASON'; // An error happened in the native code that is not permission based. Will give more information in the CalendarServiceFailure message.
|
|
213
|
+
```
|