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
## 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)

4
package-lock.json generated
View File

@@ -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",

View File

@@ -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": {

View File

@@ -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;
}
}
}

View File

@@ -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 {