Added a new setter and getter for preferredStyleSchemes to throw if type is not an eventTicket and moved PreferredStyleSchemes schemas

This commit is contained in:
Alexander Cerutti
2024-06-15 23:48:33 +02:00
parent 593b64a676
commit 432e380429
4 changed files with 56 additions and 6 deletions

View File

@@ -316,6 +316,44 @@ export default class PKPass extends Bundle {
return this[propsSymbol][this.type].backFields;
}
/**
* Allows accessing to iOS 18 new Event Ticket
* property `preferredStyleSchemes`.
*
* @throws (automatically) if current type is not
* "eventTicket".
*/
public get preferredStyleSchemes(): Schemas.PreferredStyleSchemes {
return this[propsSymbol]["eventTicket"].preferredStyleSchemes;
}
/**
* Allows setting a preferredStyleSchemes property
* for a eventTicket.
*
* @throws if current type is not "eventTicket".
* @param value
*/
public set preferredStyleSchemes(value: Schemas.PreferredStyleSchemes) {
Utils.assertUnfrozen(this);
if (this.type !== "eventTicket") {
throw new TypeError(
Messages.PREFERRED_STYLE_SCHEMES.UNEXPECTED_PASS_TYPE,
);
}
Schemas.assertValidity(
Schemas.PreferredStyleSchemes,
value,
Messages.PREFERRED_STYLE_SCHEMES.INVALID,
);
this[propsSymbol]["eventTicket"].preferredStyleSchemes = value;
}
/**
* Allows setting a pass type.
*