diff --git a/CHANGELOG.md b/CHANGELOG.md index b2f8eb5..edbb586 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 3.1.9 - 03 Apr 2023 + + Fixed transitType which wasn't being imported when a boardingPass was getting read (PR#138) + Improved types for property in Field type (PR#139) + ## 3.1.8 - 26 Mar 2023 Fixed Typescript type for Semantics.WifiAccess (PR#136) diff --git a/package-lock.json b/package-lock.json index 38982b9..7d73e83 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "passkit-generator", - "version": "3.1.8", + "version": "3.1.9", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "passkit-generator", - "version": "3.1.8", + "version": "3.1.9", "license": "MIT", "dependencies": { "do-not-zip": "^1.0.0", diff --git a/package.json b/package.json index a1bad16..b3749cd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "passkit-generator", - "version": "3.1.8", + "version": "3.1.9", "description": "The easiest way to generate custom Apple Wallet passes in Node.js", "main": "lib/index.js", "scripts": { diff --git a/src/PKPass.ts b/src/PKPass.ts index e1347f4..00d8bc8 100644 --- a/src/PKPass.ts +++ b/src/PKPass.ts @@ -556,6 +556,7 @@ export default class PKPass extends Bundle { secondaryFields = [], auxiliaryFields = [], backFields = [], + transitType, } = data[type] || {}; this.headerFields.push(...headerFields); @@ -563,6 +564,10 @@ export default class PKPass extends Bundle { this.secondaryFields.push(...secondaryFields); this.auxiliaryFields.push(...auxiliaryFields); this.backFields.push(...backFields); + + if (this.type === "boardingPass") { + this.transitType = transitType; + } } } diff --git a/src/schemas/Field.ts b/src/schemas/Field.ts index 1c837c5..f9852a3 100644 --- a/src/schemas/Field.ts +++ b/src/schemas/Field.ts @@ -1,6 +1,31 @@ import Joi from "joi"; import { Semantics } from "./Semantics"; +export type PKDataDetectorType = + | "PKDataDetectorTypePhoneNumber" + | "PKDataDetectorTypeLink" + | "PKDataDetectorTypeAddress" + | "PKDataDetectorTypeCalendarEvent"; + +export type PKTextAlignmentType = + | "PKTextAlignmentLeft" + | "PKTextAlignmentCenter" + | "PKTextAlignmentRight" + | "PKTextAlignmentNatural"; + +export type PKDateStyleType = + | "PKDateStyleNone" + | "PKDateStyleShort" + | "PKDateStyleMedium" + | "PKDateStyleLong" + | "PKDateStyleFull"; + +export type PKNumberStyleType = + | "PKNumberStyleDecimal" + | "PKNumberStylePercent" + | "PKNumberStyleScientific" + | "PKNumberStyleSpellOut"; + /** * @see https://developer.apple.com/documentation/walletpasses/passfieldcontent */ @@ -8,18 +33,18 @@ import { Semantics } from "./Semantics"; export interface Field { attributedValue?: string | number | Date; changeMessage?: string; - dataDetectorTypes?: string[]; + dataDetectorTypes?: PKDataDetectorType[]; label?: string; - textAlignment?: string; + textAlignment?: PKTextAlignmentType; key: string; value: string | number | Date; semantics?: Semantics; - dateStyle?: string; + dateStyle?: PKDateStyleType; ignoresTimeZone?: boolean; isRelative?: boolean; timeStyle?: string; currencyCode?: string; - numberStyle?: string; + numberStyle?: PKNumberStyleType; } export interface FieldWithRow extends Field {