export type PhoneNumberServiceNormalizedPhoneNumberNormalizedE164PhoneNumber = {value: string}; export type Point = {latitude: number, longitude: number}; export type NewStreetAddressDto = {name: string, line1: string, line2?: string | undefined, city: string, province: string, postalCode: string, telephone: PhoneNumberServiceNormalizedPhoneNumberNormalizedE164PhoneNumber, instructions?: string | undefined, buildingType?: number | undefined, location?: Point | undefined}; export type DayId = 1 | 2 | 3 | 4 | 5 | 6 | 7; export type GoogleRecaptchaServiceRecaptchaTypes = 'V3' | 'V2'; export type RegistrationPropertiesOnboardingItem = Record; export type FeatureFlag = {id: string, data: {[key: string]: unknown}}; export type RegistrationProperties = {initialLandingPage: string | null, conversionLandingPage: string | null, hasBagSubscription: boolean, hasProductSubscription: boolean, preselectedItems: Array, onboardingItems: Array, ipv4Address: string, featureFlags: Array | null, couponCode: string | null}; export type ShoppingCartItem = Record; export type Coupon = Record; export type GuestShoppingCart = {sessionId?: string | undefined, date?: string | undefined, items?: Array | undefined, itemsSubtotal?: number | undefined, coupon?: (Coupon | null) | undefined, preselectedCartItems?: Array | undefined}; export type GuestRegistrationInfo = {deliveryAddress: NewStreetAddressDto, billingAddress: NewStreetAddressDto, isBillingAddressSameAsDelivery: boolean, deliveryDay: DayId, firstName: string, lastName: string, email: string, phone: PhoneNumberServiceNormalizedPhoneNumberNormalizedE164PhoneNumber, password: string, stripeToken: string, captchaToken: string, captchaType: GoogleRecaptchaServiceRecaptchaTypes, couponCode: string, referralMethodId: number, subscribeToMarketingEmail: boolean, subscribeToMarketingSms: boolean, properties: RegistrationProperties}; export type GuestRegistrationInfoStorage = {sessionId?: string | undefined, guestRegistrationInfo?: GuestRegistrationInfo | undefined}; export type GuestRegistrationInfoState = 'EMAIL' | 'CONTACT' | 'DELIVERY'; export type CreateApiOndSignupInfoArgs = {body: {deliveryAddress: NewStreetAddressDto, billingAddress: NewStreetAddressDto, isBillingAddressSameAsDelivery: boolean, deliveryDay: DayId, firstName: string, lastName: string, email: string, phone: PhoneNumberServiceNormalizedPhoneNumberNormalizedE164PhoneNumber, password: string, stripeToken: string, captchaToken: string, captchaType: GoogleRecaptchaServiceRecaptchaTypes, couponCode: string, referralMethodId: number, subscribeToMarketingEmail: boolean, subscribeToMarketingSms: boolean, properties: RegistrationProperties, guestCart?: GuestShoppingCart | undefined, guestRegistrationInfoStorage?: GuestRegistrationInfoStorage | undefined, state?: GuestRegistrationInfoState | undefined}}; export type CreateApiOndSignupInfoOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * POST /ond/signup/info */ export const createApiOndSignupInfo = async (args: CreateApiOndSignupInfoArgs, options: CreateApiOndSignupInfoOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/ond/signup/info${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };