UNPKG

@1amageek/passkit

Version:
103 lines (102 loc) 3.77 kB
import Assets from './assets'; import Template from './template'; export { Assets, Template }; export declare type Style = "boardingPass" | "coupon" | "eventTicket" | "generic" | "storeCard"; export interface CertificateLodingDelegate { loadSecret(identifier: string): Promise<string>; loadWWDR(): Promise<string>; } export declare type Options = { secret?: string; wwdr?: string; secretURL?: string; wwdrURL?: string; delegate?: CertificateLodingDelegate; passTypeIdentifier: string; teamIdentifier: string; password: string; }; export declare class Certificates { secret?: string; wwdr?: string; options: Options; constructor(options: Options); mountCertificate(url: string, destination: string): Promise<string>; mountIfNeeded(): Promise<void>; isExistFile(file: string): boolean; } export declare let certificates: Certificates; export declare const initialize: (options?: Options) => void; export declare type TransitType = "PKTransitTypeAir" | "PKTransitTypeBoat" | "PKTransitTypeBus" | "PKTransitTypeGeneric" | "PKTransitTypeTrain"; export interface StandardField { attributedValue?: any; changeMessage?: string; dataDetectorTypes?: DataDetectorTypes[]; key: string; label?: string; textAlignment?: TextAlignment; value: any; } export interface DateField extends StandardField { dateStyle: DateStyle; ignoresTimeZone: boolean; isRelative: boolean; timeStyle: DateStyle; } export declare type DateStyle = "PKDateStyleNone" | "PKDateStyleShort" | "PKDateStyleMedium" | "PKDateStyleLong" | "PKDateStyleFull"; export interface NumberField extends StandardField { currencyCode: string; numberStyle: NumberStyle; } export declare type Field = StandardField | NumberField | DateField; export declare type NumberStyle = "PKNumberStyleDecimal" | "PKNumberStylePercent" | "PKNumberStyleScientific" | "PKNumberStyleSpellOut"; export declare type Pass = { headerFields?: Field[]; primaryFields?: Field[]; secondaryFields?: Field[]; auxiliaryFields?: Field[]; backFields?: Field[]; transitType?: TransitType; }; export declare type Beacon = { major: string; minor: string; proximityUUID: string; relevantText: string; }; export declare type Location = { altitude?: number; latitude: number; longitude: number; relevantText?: string; }; export declare type BarcodeFormat = "PKBarcodeFormatQR" | "PKBarcodeFormatPDF417" | "PKBarcodeFormatAztec" | "PKBarcodeFormatCode128"; export declare type Barcode = { altText?: string; format: BarcodeFormat; message: string; messageEncoding: "iso-8859-1" | string; }; export declare type NFC = { message: string; encryptionPublicKey?: string; }; export declare class RGB { r: number; g: number; b: number; constructor(r: number, g: number, b: number); toValue(): { [key: string]: number; }; toString(): string; } export declare type PersonalizationField = "PKPassPersonalizationFieldName" | "PKPassPersonalizationFieldPostalCode" | "PKPassPersonalizationFieldEmailAddress" | "PKPassPersonalizationFieldPhoneNumber"; export declare type Personalization = { requiredPersonalizationFields: PersonalizationField[]; description: string; termsAndConditions?: string; }; export declare type DataDetectorTypes = "PKDataDetectorTypePhoneNumber" | "PKDataDetectorTypeLink" | "PKDataDetectorTypeAddress" | "PKDataDetectorTypeCalendarEvent"; export declare type TextAlignment = "PKTextAlignmentLeft" | "PKTextAlignmentCenter" | "PKTextAlignmentRight" | "PKTextAlignmentNatural"; export declare const generate: (template: Template, assets: Assets, personalization?: Personalization) => Promise<string>;