@boulevard/blvd-book-sdk
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -221,3 +221,3 @@ import { Node, PlatformClient, PlatformTarget } from "./platformClient"; | ||
*/ | ||
addBookableItem(item: CartBookableItem, opts?: { | ||
addBookableItem(item: CartAvailableBookableItem, opts?: { | ||
discountCode?: string; | ||
@@ -238,3 +238,3 @@ guest?: CartGuest; | ||
*/ | ||
addGiftCardItem(item: CartGiftCardItem, price: Scalars["Money"]): Promise<Cart>; | ||
addGiftCardItem(item: CartAvailableGiftCardItem, price: Scalars["Money"]): Promise<Cart>; | ||
/** | ||
@@ -250,6 +250,23 @@ * Add a purchasable item to a cart | ||
*/ | ||
addPurchasableItem(item: CartPurchasableItem, opts?: { | ||
addPurchasableItem(item: CartAvailablePurchasableItem, opts?: { | ||
discountCode?: string; | ||
}): Promise<Cart>; | ||
/** | ||
* Creates a waitlist entry for the cart with the specified date and time ranges as the boundary for the preferred bookable time. | ||
* Only selected bookable items will be included in the waitlist entry for the cart. | ||
* | ||
* This mutation marks the cart as completed, it can no longer be modified. | ||
* | ||
* @async | ||
* @category Purchasable Items | ||
* @param preferredTimeLower The preferred lower bound date and time of the bookable items. | ||
* @param preferredTimeUpper The preferred upper bound date and time of the bookable items. | ||
* @param opts.timezone Optional override for the timezone set in {@link Carts.create} | ||
* @public | ||
* @returns Promise containing the updated cart | ||
*/ | ||
addToWaitlist(preferredTimeLower?: Scalars["NaiveDateTime"], preferredTimeUpper?: Scalars["NaiveDateTime"], opts?: { | ||
timezone?: string; | ||
}): Promise<Cart>; | ||
/** | ||
* Completes the checkout process. | ||
@@ -358,3 +375,3 @@ * | ||
*/ | ||
getBookableDates(opts: { | ||
getBookableDates(opts?: { | ||
searchRangeLower?: Scalars["Date"]; | ||
@@ -361,0 +378,0 @@ searchRangeUpper?: Scalars["Date"]; |
export declare const addBookableItemMutation: string; | ||
export declare const addGiftCardItemMutation: string; | ||
export declare const addPurchasableItemMutation: string; | ||
export declare const addToWaitlistMutation: string; | ||
export declare const availableCategoriesQuery: string; | ||
@@ -5,0 +6,0 @@ export declare const availablePaymentMethodsQuery: string; |
{ | ||
"name": "@boulevard/blvd-book-sdk", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "A JS client for the Boulevard API", | ||
@@ -5,0 +5,0 @@ "main": "lib/blvd.js", |
@@ -124,2 +124,44 @@ import { Blvd } from "../src/blvd"; | ||
}, 10000); | ||
test("waitlist", async () => { | ||
const locations = await anon.locations.list(); | ||
let cart = await anon.carts.create(locations[0]); | ||
const categories = await cart.getAvailableCategories(); | ||
const services = categories[0]; | ||
const service = services.availableItems[0]; | ||
cart = await cart.addBookableItem(service as CartAvailableBookableItem); | ||
const dates = await cart.getBookableDates(); | ||
const date = dates[0]; | ||
const times = await cart.getBookableTimes(date); | ||
const time = times[0]; | ||
cart = await cart.reserveBookableItems(time); | ||
cart = await cart.update({ | ||
clientInformation: { | ||
firstName: "John", | ||
lastName: "Doe", | ||
email: "test@test.com" | ||
} | ||
}); | ||
cart = await cart.addCardPaymentMethod({ | ||
card: { | ||
name: "John Doe", | ||
number: "4242424242424242", | ||
cvv: "111", | ||
exp_month: 1, | ||
exp_year: 2025 | ||
} | ||
}); | ||
const dateFrom = new Date(); | ||
const dateTo = new Date(); | ||
dateTo.setDate(dateTo.getDate() + 7); | ||
cart = await cart.addToWaitlist(dateFrom, dateTo); | ||
expect(cart.errors).toEqual([]); | ||
expect(cart.completedAt).toBeTruthy(); | ||
}, 10000); | ||
}); | ||
@@ -126,0 +168,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
613920
7627