Merge branch 'master' into feature/improved-tests

This commit is contained in:
Alexander Cerutti
2023-04-04 20:34:31 +02:00
5 changed files with 42 additions and 7 deletions

View File

@@ -1,5 +1,10 @@
# Changelog # 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 ## 3.1.8 - 26 Mar 2023
Fixed Typescript type for Semantics.WifiAccess (PR#136) Fixed Typescript type for Semantics.WifiAccess (PR#136)

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "passkit-generator", "name": "passkit-generator",
"version": "3.1.8", "version": "3.1.9",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "passkit-generator", "name": "passkit-generator",
"version": "3.1.8", "version": "3.1.9",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"do-not-zip": "^1.0.0", "do-not-zip": "^1.0.0",

View File

@@ -1,6 +1,6 @@
{ {
"name": "passkit-generator", "name": "passkit-generator",
"version": "3.1.8", "version": "3.1.9",
"description": "The easiest way to generate custom Apple Wallet passes in Node.js", "description": "The easiest way to generate custom Apple Wallet passes in Node.js",
"main": "lib/index.js", "main": "lib/index.js",
"scripts": { "scripts": {

View File

@@ -556,6 +556,7 @@ export default class PKPass extends Bundle {
secondaryFields = [], secondaryFields = [],
auxiliaryFields = [], auxiliaryFields = [],
backFields = [], backFields = [],
transitType,
} = data[type] || {}; } = data[type] || {};
this.headerFields.push(...headerFields); this.headerFields.push(...headerFields);
@@ -563,6 +564,10 @@ export default class PKPass extends Bundle {
this.secondaryFields.push(...secondaryFields); this.secondaryFields.push(...secondaryFields);
this.auxiliaryFields.push(...auxiliaryFields); this.auxiliaryFields.push(...auxiliaryFields);
this.backFields.push(...backFields); this.backFields.push(...backFields);
if (this.type === "boardingPass") {
this.transitType = transitType;
}
} }
} }

View File

@@ -1,6 +1,31 @@
import Joi from "joi"; import Joi from "joi";
import { Semantics } from "./Semantics"; 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 * @see https://developer.apple.com/documentation/walletpasses/passfieldcontent
*/ */
@@ -8,18 +33,18 @@ import { Semantics } from "./Semantics";
export interface Field { export interface Field {
attributedValue?: string | number | Date; attributedValue?: string | number | Date;
changeMessage?: string; changeMessage?: string;
dataDetectorTypes?: string[]; dataDetectorTypes?: PKDataDetectorType[];
label?: string; label?: string;
textAlignment?: string; textAlignment?: PKTextAlignmentType;
key: string; key: string;
value: string | number | Date; value: string | number | Date;
semantics?: Semantics; semantics?: Semantics;
dateStyle?: string; dateStyle?: PKDateStyleType;
ignoresTimeZone?: boolean; ignoresTimeZone?: boolean;
isRelative?: boolean; isRelative?: boolean;
timeStyle?: string; timeStyle?: string;
currencyCode?: string; currencyCode?: string;
numberStyle?: string; numberStyle?: PKNumberStyleType;
} }
export interface FieldWithRow extends Field { export interface FieldWithRow extends Field {