@walletpass/pass-js
Version:
Apple Wallet Pass generating and pushing updates from Node.js
261 lines • 7.5 kB
JavaScript
// SPDX-License-Identifier: AGPL-3.0-or-later
// Copyright (C) 2017-2026 Konstantin Vyatkin <tino@vtkn.io>
export const PASS_MIME_TYPE = 'application/vnd.apple.pkpass';
export const TRANSIT = {
AIR: 'PKTransitTypeAir',
BOAT: 'PKTransitTypeBoat',
BUS: 'PKTransitTypeBus',
TRAIN: 'PKTransitTypeTrain',
GENERIC: 'PKTransitTypeGeneric',
};
export const textDirection = {
LEFT: 'PKTextAlignmentLeft',
CENTER: 'PKTextAlignmentCenter',
RIGHT: 'PKTextAlignmentRight',
NATURAL: 'PKTextAlignmentNatural',
};
export const barcodeFormat = {
QR: 'PKBarcodeFormatQR',
PDF417: 'PKBarcodeFormatPDF417',
Aztec: 'PKBarcodeFormatAztec',
Code128: 'PKBarcodeFormatCode128',
};
export const dateTimeFormat = {
NONE: 'PKDateStyleNone',
SHORT: 'PKDateStyleShort',
MEDIUM: 'PKDateStyleMedium',
LONG: 'PKDateStyleLong',
FULL: 'PKDateStyleFull',
};
export const dataDetector = {
PHONE: 'PKDataDetectorTypePhoneNumber',
LINK: 'PKDataDetectorTypeLink',
ADDRESS: 'PKDataDetectorTypeAddress',
CALENDAR: 'PKDataDetectorTypeCalendarEvent',
};
export const numberStyle = {
DECIMAL: 'PKNumberStyleDecimal',
PERCENT: 'PKNumberStylePercent',
SCIENTIFIC: 'PKNumberStyleScientific',
SPELL_OUT: 'PKNumberStyleSpellOut',
};
/**
* Supported images.
*/
export const IMAGES = {
icon: {
width: 29,
height: 29,
required: true,
},
logo: {
width: 160,
height: 50,
required: true,
},
background: {
width: 180,
height: 220,
},
footer: {
width: 295,
height: 15,
},
strip: {
width: 375,
height: 123,
},
thumbnail: {
width: 90,
height: 90,
},
personalizationLogo: {
width: 150,
height: 40,
},
};
export const DENSITIES = new Set(['1x', '2x', '3x']);
// Supported passbook styles.
export const PASS_STYLES = new Set([
'boardingPass',
'coupon',
'eventTicket',
'storeCard',
'generic',
]);
// Optional top level fields
// Top-level pass fields.
// https://developer.apple.com/library/content/documentation/UserExperience/Reference/PassKit_Bundle/Chapters/TopLevel.html#//apple_ref/doc/uid/TP40012026-CH2-SW1
export const TOP_LEVEL_FIELDS = {
// Standard Keys
description: {
required: true,
type: 'string',
templatable: true,
localizable: true,
},
organizationName: {
required: true,
type: 'string',
templatable: true,
localizable: true,
},
passTypeIdentifier: {
required: true,
type: 'string',
templatable: true,
},
serialNumber: {
required: true,
type: 'string',
},
teamIdentifier: {
required: true,
type: 'string',
templatable: true,
},
sharingProhibited: {
required: false,
type: Boolean,
templatable: true,
},
associatedStoreIdentifiers: {
required: false,
type: Array,
templatable: true,
},
appLaunchURL: {
required: false,
type: 'string',
templatable: true,
},
// Expiration Keys
expirationDate: {
type: 'string', // W3C date, as a string
},
voided: {
type: Boolean,
},
// Relevance Keys
beacons: {
type: Array,
},
locations: {
type: Array,
},
maxDistance: {
type: 'number',
},
relevantDate: {
type: 'string', // W3C date, as a string
},
relevantDates: {
type: Array,
},
calendarEvent: {
type: Object,
templatable: true,
},
// Visual Appearance Keys
barcodes: {
type: Array,
},
preferredStyleSchemes: {
type: Array,
templatable: true,
},
backgroundColor: {
type: 'string',
templatable: true,
},
foregroundColor: {
type: 'string',
templatable: true,
},
groupingIdentifier: {
type: 'string',
},
labelColor: {
type: 'string',
templatable: true,
},
logoText: {
type: 'string',
templatable: true,
localizable: true,
},
semantics: {
type: Object,
},
userInfo: {
type: Object,
templatable: true,
},
suppressStripShine: {
type: Boolean,
templatable: true,
},
// Web Service Keys
authenticationToken: {
type: 'string',
minlength: 16,
},
webServiceURL: {
type: 'string',
templatable: true,
},
// iOS 18 Event Ticket Keys — Event Guide URLs, contact, transfer/sell
bagPolicyURL: { type: 'string', templatable: true },
orderFoodURL: { type: 'string', templatable: true },
parkingInformationURL: { type: 'string', templatable: true },
directionsInformationURL: { type: 'string', templatable: true },
purchaseParkingURL: { type: 'string', templatable: true },
merchandiseURL: { type: 'string', templatable: true },
transitInformationURL: { type: 'string', templatable: true },
accessibilityURL: { type: 'string', templatable: true },
addOnURL: { type: 'string', templatable: true },
contactVenueEmail: { type: 'string', templatable: true },
contactVenuePhoneNumber: { type: 'string', templatable: true },
contactVenueWebsite: { type: 'string', templatable: true },
transferURL: { type: 'string', templatable: true },
sellURL: { type: 'string', templatable: true },
// iOS 18 Event Ticket Keys — styling + misc
suppressHeaderDarkening: { type: Boolean, templatable: true },
footerBackgroundColor: { type: 'string', templatable: true },
useAutomaticColors: { type: Boolean, templatable: true },
auxiliaryStoreIdentifiers: { type: Array, templatable: true },
eventLogoText: { type: 'string', templatable: true, localizable: true },
// iOS 26 Enhanced / Semantic Boarding Pass Keys
changeSeatURL: { type: 'string', templatable: true },
entertainmentURL: { type: 'string', templatable: true },
purchaseAdditionalBaggageURL: { type: 'string', templatable: true },
purchaseLoungeAccessURL: { type: 'string', templatable: true },
purchaseWifiURL: { type: 'string', templatable: true },
upgradeURL: { type: 'string', templatable: true },
managementURL: { type: 'string', templatable: true },
registerServiceAnimalURL: { type: 'string', templatable: true },
reportLostBagURL: { type: 'string', templatable: true },
requestWheelchairURL: { type: 'string', templatable: true },
transitProviderWebsiteURL: { type: 'string', templatable: true },
transitProviderEmail: { type: 'string', templatable: true },
transitProviderPhoneNumber: { type: 'string', templatable: true },
// iOS 26 Poster Event Ticket — upcoming chained events
upcomingPassInformation: { type: Array },
};
// Pass structure keys.
// https://developer.apple.com/library/content/documentation/UserExperience/Reference/PassKit_Bundle/Chapters/LowerLevel.html#//apple_ref/doc/uid/TP40012026-CH3-SW3
export const STRUCTURE_FIELDS = [
'additionalInfoFields',
'auxiliaryFields',
'backFields',
'headerFields',
'primaryFields',
'secondaryFields',
];
export const BARCODES_FORMAT = new Set([
'PKBarcodeFormatQR',
'PKBarcodeFormatPDF417',
'PKBarcodeFormatAztec',
'PKBarcodeFormatCode128',
]);
//# sourceMappingURL=constants.js.map