@@ -32,12 +32,34 @@ export type NumberStyle =
3232 | 'PKNumberStyleScientific'
3333 | 'PKNumberStyleSpellOut' ;
3434
35+ export interface SemanticTagObject {
36+ [ key : string ] : SemanticTagValue ;
37+ }
38+
39+ export type SemanticTagValue =
40+ | string
41+ | number
42+ | boolean
43+ | Date
44+ | SemanticTagObject
45+ | SemanticTagValue [ ] ;
46+
47+ /**
48+ * Machine-readable metadata that Wallet uses to offer a pass and suggest
49+ * related actions.
50+ *
51+ * @see {@link https://developer.apple.com/documentation/walletpasses/supporting-semantic-tags-in-wallet-passes }
52+ * @see {@link https://developer.apple.com/documentation/walletpasses/semantictags }
53+ */
54+ export type SemanticTags = SemanticTagObject ;
55+
3556export type FieldDescriptor = {
3657 // Standard Field Dictionary Keys
3758 label ?: string ;
3859 attributedValue ?: string | number ;
3960 changeMessage ?: string ;
4061 dataDetectorTypes ?: DataDetectors [ ] ;
62+ semantics ?: SemanticTags ;
4163} & (
4264 | {
4365 value : string ;
@@ -176,6 +198,14 @@ export interface PassCompanionAppKeys {
176198 userInfo ?: any ; // eslint-disable-line @typescript-eslint/no-explicit-any
177199}
178200
201+ export interface PassSemanticKeys {
202+ /**
203+ * Machine-readable metadata for Wallet suggestions. This dictionary may also
204+ * be specified on individual pass fields.
205+ */
206+ semantics ?: SemanticTags ;
207+ }
208+
179209/**
180210 * Information about when a pass expires and whether it is still valid.
181211 * A pass is marked as expired if the current date is after the pass’s expiration date,
@@ -442,6 +472,7 @@ export type PassStructureFields =
442472export type ApplePass = PassStandardKeys &
443473 PassAssociatedAppKeys &
444474 PassCompanionAppKeys &
475+ PassSemanticKeys &
445476 PassExpirationKeys &
446477 PassRelevanceKeys &
447478 PassVisualAppearanceKeys &
@@ -450,4 +481,4 @@ export type ApplePass = PassStandardKeys &
450481
451482 export interface Options {
452483 allowHttp : boolean
453- }
484+ }
0 commit comments