mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 10:25:16 +00:00
Added implementation method to add upcoming pass information
This commit is contained in:
@@ -261,6 +261,34 @@ export default class PKPass extends Bundle {
|
||||
this[propsSymbol].preferredStyleSchemes = value;
|
||||
}
|
||||
|
||||
public set upcomingPassInformation(
|
||||
value: Schemas.UpcomingPassInformationEntry[],
|
||||
) {
|
||||
Utils.assertUnfrozen(this);
|
||||
|
||||
if (this.type !== "eventTicket") {
|
||||
throw new TypeError(
|
||||
Messages.UPCOMING_PASS_INFORMATION.UNEXPECTED_PASS_TYPE,
|
||||
);
|
||||
}
|
||||
|
||||
if (!this.preferredStyleSchemes?.includes("posterEventTicket")) {
|
||||
throw new TypeError(
|
||||
Messages.UPCOMING_PASS_INFORMATION.UNEXPECTED_STYLE_SCHEME,
|
||||
);
|
||||
}
|
||||
|
||||
for (const entry of value) {
|
||||
Schemas.assertValidity(
|
||||
Schemas.UpcomingPassInformationEntry,
|
||||
entry,
|
||||
Messages.UPCOMING_PASS_INFORMATION.INVALID,
|
||||
);
|
||||
}
|
||||
|
||||
this[propsSymbol].upcomingPassInformation = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows setting a transitType property
|
||||
* for a boardingPass.
|
||||
|
||||
@@ -24,6 +24,15 @@ export const PREFERRED_STYLE_SCHEMES = {
|
||||
"Cannot set preferredStyleSchemes because not compliant with Apple specifications - %s",
|
||||
} as const;
|
||||
|
||||
export const UPCOMING_PASS_INFORMATION = {
|
||||
UNEXPECTED_PASS_TYPE:
|
||||
"Cannot set upcomingPassInformation on a pass with type different from eventTicket.",
|
||||
UNEXPECTED_STYLE_SCHEME:
|
||||
"Cannot set upcomingPassInformation because 'preferredStyleSchemes' does not include 'posterEventTicket' style.",
|
||||
INVALID:
|
||||
"Cannot set upcomingPassInformation: validation failed. Be sure to follow the Apple specifications. - %s",
|
||||
} as const;
|
||||
|
||||
export const PASS_TYPE = {
|
||||
INVALID:
|
||||
"Cannot set type because not compliant with Apple specifications. Refer to https://apple.co/3aFpSfg for a list of valid props - %s",
|
||||
|
||||
Reference in New Issue
Block a user