Added upcomingPassInformation getter

This commit is contained in:
Alexander Cerutti
2025-09-17 22:51:28 +02:00
parent 4dec0d9b05
commit 56572214c6
2 changed files with 14 additions and 2 deletions

View File

@@ -276,7 +276,7 @@ export default class PKPass extends Bundle {
if (this.type !== "eventTicket") { if (this.type !== "eventTicket") {
throw new TypeError( throw new TypeError(
Messages.UPCOMING_PASS_INFORMATION.UNEXPECTED_PASS_TYPE, Messages.UPCOMING_PASS_INFORMATION.UNEXPECTED_PASS_TYPE_SET,
); );
} }
@@ -297,6 +297,16 @@ export default class PKPass extends Bundle {
this[propsSymbol].upcomingPassInformation = value; this[propsSymbol].upcomingPassInformation = value;
} }
public get upcomingPassInformation(): Schemas.UpcomingPassInformationEntry[] {
if (this.type !== "eventTicket") {
throw new TypeError(
Messages.UPCOMING_PASS_INFORMATION.UNEXPECTED_PASS_TYPE_GET,
);
}
return this[propsSymbol].upcomingPassInformation || [];
}
/** /**
* Allows setting a transitType property * Allows setting a transitType property
* for a boardingPass. * for a boardingPass.

View File

@@ -25,8 +25,10 @@ export const PREFERRED_STYLE_SCHEMES = {
} as const; } as const;
export const UPCOMING_PASS_INFORMATION = { export const UPCOMING_PASS_INFORMATION = {
UNEXPECTED_PASS_TYPE: UNEXPECTED_PASS_TYPE_SET:
"Cannot set upcomingPassInformation on a pass with type different from eventTicket.", "Cannot set upcomingPassInformation on a pass with type different from eventTicket.",
UNEXPECTED_PASS_TYPE_GET:
"Cannot get upcomingPassInformation on a pass with type different from eventTicket.",
UNEXPECTED_STYLE_SCHEME: UNEXPECTED_STYLE_SCHEME:
"Cannot set upcomingPassInformation because 'preferredStyleSchemes' does not include 'posterEventTicket' style.", "Cannot set upcomingPassInformation because 'preferredStyleSchemes' does not include 'posterEventTicket' style.",
INVALID: INVALID: