11import { z } from "zod" ;
22import { PassFieldContent } from "./PassFieldContent.js" ;
33import { Semantics } from "./Semantics.js" ;
4- import { URL_REGEX } from "./regexps .js" ;
4+ import { dateTimeSchema , httpAddressSchema } from "./sharedSchemas .js" ;
55
6- const dateTimeSchema = z . iso . datetime ( {
7- offset : true ,
8- local : true ,
6+ const httpsAddressSchema = z . url ( {
7+ protocol : / ^ h t t p s $ / ,
98} ) ;
109
1110/**
@@ -19,7 +18,7 @@ const ImageURLEntry = z.object({
1918 SHA256 : z . string ( ) ,
2019
2120 /** The URL that points to the image asset to be downloaded. This must be an https link. */
22- URL : z . string ( ) . check ( z . regex ( URL_REGEX ) ) ,
21+ URL : httpsAddressSchema ,
2322
2423 /** The scale of the image. If unspecified, defaults to 1. */
2524 scale : z . number ( ) . default ( 1 ) . optional ( ) ,
@@ -89,7 +88,7 @@ const URLs = z.object({
8988 /**
9089 * A URL that links to your or the venue's accessibility content.
9190 */
92- accessibilityURL : z . string ( ) . check ( z . regex ( URL_REGEX ) ) . optional ( ) ,
91+ accessibilityURL : httpAddressSchema . optional ( ) ,
9392
9493 /**
9594 * A URL that links to experiences that you can add on to your ticket
@@ -98,12 +97,12 @@ const URLs = z.object({
9897 * access the experience. For example, loaded value or upgrades for
9998 * an experience.
10099 */
101- addOnURL : z . string ( ) . check ( z . regex ( URL_REGEX ) ) . optional ( ) ,
100+ addOnURL : httpAddressSchema . optional ( ) ,
102101
103102 /**
104103 * A URL that links out to the bag policy of the venue.
105104 */
106- bagPolicyURL : z . string ( ) . check ( z . regex ( URL_REGEX ) ) . optional ( ) ,
105+ bagPolicyURL : httpAddressSchema . optional ( ) ,
107106
108107 /**
109108 * Joi's email schema validates email TLDs and only allows TLDs that are registered in the IANA Registry.
@@ -126,12 +125,12 @@ const URLs = z.object({
126125 /**
127126 * A URL that links the user to the website of the venue, event, or issuer.
128127 */
129- contactVenueWebsite : z . string ( ) . check ( z . regex ( URL_REGEX ) ) . optional ( ) ,
128+ contactVenueWebsite : httpAddressSchema . optional ( ) ,
130129
131130 /**
132131 * A URL that links to content you have about getting to the venue.
133132 */
134- directionsInformationURL : z . string ( ) . check ( z . regex ( URL_REGEX ) ) . optional ( ) ,
133+ directionsInformationURL : httpAddressSchema . optional ( ) ,
135134
136135 /**
137136 * A URL that links to order merchandise for the specific event.
@@ -145,43 +144,43 @@ const URLs = z.object({
145144 * This can be done through a pass update. For more information on updating a
146145 * pass, see Distributing and updating a pass.
147146 */
148- merchandiseURL : z . string ( ) . check ( z . regex ( URL_REGEX ) ) . optional ( ) ,
147+ merchandiseURL : httpAddressSchema . optional ( ) ,
149148
150149 /**
151150 * A URL that links out to the food-ordering page for the venue.
152151 * This can be in-seat food delivery, pre-order for pickup at a vendor,
153152 * or other appropriate food-ordering service.
154153 */
155- orderFoodURL : z . string ( ) . check ( z . regex ( URL_REGEX ) ) . optional ( ) ,
154+ orderFoodURL : httpAddressSchema . optional ( ) ,
156155
157156 /**
158157 * A URL that links to any information you have about parking.
159158 */
160- parkingInformationURL : z . string ( ) . check ( z . regex ( URL_REGEX ) ) . optional ( ) ,
159+ parkingInformationURL : httpAddressSchema . optional ( ) ,
161160
162161 /**
163162 * A URL that links to your experience to buy or access prepaid parking
164163 * or general parking information.
165164 */
166- purchaseParkingURL : z . string ( ) . check ( z . regex ( URL_REGEX ) ) . optional ( ) ,
165+ purchaseParkingURL : httpAddressSchema . optional ( ) ,
167166
168167 /**
169168 * A URL that launches the user into the issuer's flow for selling their
170169 * current ticket. Provide as deep a link as possible into the sale flow.
171170 */
172- sellURL : z . string ( ) . check ( z . regex ( URL_REGEX ) ) . optional ( ) ,
171+ sellURL : httpAddressSchema . optional ( ) ,
173172
174173 /**
175174 * A URL that launches the user into the issuer's flow for transferring
176175 * the current ticket. Provide as deep a link as possible into the transfer flow.
177176 */
178- transferURL : z . string ( ) . check ( z . regex ( URL_REGEX ) ) . optional ( ) ,
177+ transferURL : httpAddressSchema . optional ( ) ,
179178
180179 /**
181180 * A URL that links to documentation you have about public or private
182181 * transit to the venue.
183182 */
184- transitInformationURL : z . string ( ) . check ( z . regex ( URL_REGEX ) ) . optional ( ) ,
183+ transitInformationURL : httpAddressSchema . optional ( ) ,
185184} ) ;
186185
187186/**
0 commit comments