From 9d033bd6d7d5930127be9174bdc93273a36bc6ab Mon Sep 17 00:00:00 2001 From: Alexander Cerutti Date: Fri, 14 Jun 2024 23:12:38 +0200 Subject: [PATCH] Added support to eventTicket.preferredStyleSchemes --- src/schemas/index.ts | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/schemas/index.ts b/src/schemas/index.ts index 9f45dc5..16c6703 100644 --- a/src/schemas/index.ts +++ b/src/schemas/index.ts @@ -63,7 +63,20 @@ export interface PassProps { locations?: Location[]; boardingPass?: PassFields & { transitType: TransitType }; - eventTicket?: PassFields; + eventTicket?: PassFields & { + /** + * New field coming in iOS 18 + * `"eventTicket"` is the legacy style. + * + * If used, passkit will try to render following the old style + * first. + * + * Which means that `primaryFields`, `secondaryFields` and + * so on, are not necessary anymore for the new style, + * as semantics are preferred. + */ + preferredStyleSchemes?: ("posterEventTicket" | "eventTicket")[]; + }; coupon?: PassFields; generic?: PassFields; storeCard?: PassFields; @@ -132,7 +145,24 @@ export const PassKindsProps = Joi.object({ coupon: PassFields.disallow("transitType"), generic: PassFields.disallow("transitType"), storeCard: PassFields.disallow("transitType"), - eventTicket: PassFields.disallow("transitType"), + eventTicket: PassFields.disallow("transitType").append( + Joi.object().keys({ + /** + * New field coming in iOS 18 + * `"eventTicket"` is the legacy style. + * + * If used, passkit will try to render following the old style + * first. + * + * Which means that `primaryFields`, `secondaryFields` and + * so on, are not necessary anymore for the new style, + * as semantics are preferred. + */ + preferredStyleSchemes: Joi.array().items( + Joi.string().allow("posterEventTicket", "eventTicket"), + ), + }), + ), boardingPass: PassFields, });