@vivlab/api-database
Advanced tools
Comparing version 1.1.7 to 1.1.8
import type { Checkout, Tax } from "@vivlab/types"; | ||
export interface ArticlesAccount { | ||
articles: Checkout.Article[]; | ||
articles: Array<Checkout.Article & { | ||
options: Record<string, string>; | ||
}>; | ||
taxDefault: Tax.Data | null; | ||
@@ -8,3 +10,7 @@ stripeAccount: string; | ||
export interface CalculateAccount { | ||
data: Checkout.BodyCart; | ||
data: Omit<Checkout.BodyCart, "articles"> & { | ||
articles: Array<Checkout.Article & { | ||
options: Record<string, string>; | ||
}>; | ||
}; | ||
stripeAccount: string; | ||
@@ -14,7 +20,11 @@ } | ||
id: string; | ||
products: Checkout.ProductItem[]; | ||
products: Array<Checkout.ProductItem & { | ||
options: Record<string, string>; | ||
}>; | ||
stripeAccount: string; | ||
} | ||
export declare function calculate({ data, stripeAccount }: CalculateAccount): Promise<{ | ||
products: Checkout.ProductItem[]; | ||
products: (Checkout.ProductItem & { | ||
options: Record<string, string>; | ||
})[]; | ||
coupon: Checkout.Coupon | null; | ||
@@ -30,4 +40,6 @@ shipping: Checkout.Shipping | null; | ||
}>; | ||
export declare function getProducts({ articles, taxDefault, stripeAccount }: ArticlesAccount): Promise<Checkout.ProductItem[]>; | ||
export declare function getProducts({ articles, taxDefault, stripeAccount }: ArticlesAccount): Promise<(Checkout.ProductItem & { | ||
options: Record<string, string>; | ||
})[]>; | ||
export declare function getShipping({ id, products, stripeAccount }: IdProductsAccount): Promise<Checkout.Shipping>; | ||
export declare function getCoupon({ id, products, stripeAccount }: IdProductsAccount): Promise<Checkout.Coupon>; |
@@ -10,3 +10,3 @@ import type { Checkout } from "@vivlab/types"; | ||
articles: Array<Checkout.Article & { | ||
options: Record<string, string> | null; | ||
options: Record<string, string>; | ||
}>; | ||
@@ -16,5 +16,13 @@ }; | ||
} | ||
export declare function calculateCarts({ data, stripeAccount }: CalculateAccount): Promise<{ | ||
export declare function calculateCarts({ data, stripeAccount }: Omit<CalculateAccount, "data"> & { | ||
data: Checkout.BodyPayment & { | ||
articles: Array<Checkout.Article & { | ||
options: Record<string, string>; | ||
}>; | ||
}; | ||
}): Promise<{ | ||
shippings: Checkout.Shipping[]; | ||
products: Checkout.ProductItem[]; | ||
products: (Checkout.ProductItem & { | ||
options: Record<string, string>; | ||
})[]; | ||
coupon: Checkout.Coupon | null; | ||
@@ -31,3 +39,13 @@ shipping: Checkout.Shipping | null; | ||
export declare function createStripePaymentCarts({ data, stripeAccount }: CalculateAccount): Promise<Checkout.CartPayload>; | ||
export declare function updateStripePaymentCarts({ data, stripeAccount }: CalculateAccount): Promise<Checkout.CartPayload>; | ||
export declare function updateStripePaymentCarts({ data, stripeAccount }: Omit<CalculateAccount, "data"> & { | ||
data: Checkout.BodyPayment & { | ||
articles: Array<Checkout.Article & { | ||
options: Record<string, string>; | ||
}>; | ||
}; | ||
}): Promise<Omit<Checkout.CartPayload, "products"> & { | ||
products: Array<Checkout.ProductItem & { | ||
options: Record<string, string>; | ||
}>; | ||
}>; | ||
export declare function validateStripePaymentCarts({ data, stripeAccount }: ValidateAccount): Promise<{ | ||
@@ -34,0 +52,0 @@ status: string; |
@@ -7,11 +7,17 @@ import type { Shipping, Product, Checkout } from "@vivlab/types"; | ||
}; | ||
article: Checkout.Article; | ||
article: Checkout.Article & { | ||
options: Record<string, string>; | ||
}; | ||
} | ||
interface ShippingCal { | ||
data: Shipping.ApiProductData; | ||
products: Checkout.ProductItem[]; | ||
products: Array<Checkout.ProductItem & { | ||
options: Record<string, string>; | ||
}>; | ||
} | ||
export declare function productCalculate({ data, article }: ProductCal): Checkout.ProductItem; | ||
export declare function productCalculate({ data, article }: ProductCal): Checkout.ProductItem & { | ||
options: Record<string, string>; | ||
}; | ||
export declare function shippingCalculate({ data, products }: ShippingCal): Checkout.Shipping; | ||
export declare function stripePaymentIntent(data: Stripe.PaymentIntent): Checkout.Provider; | ||
export {}; |
@@ -21,2 +21,3 @@ "use strict"; | ||
stock: data.stock, | ||
options: article.options, | ||
total, | ||
@@ -23,0 +24,0 @@ tax: Math.round(total - total / (1 + (data.product.tax ?? 0) / 1e2)) |
@@ -94,4 +94,9 @@ "use strict"; | ||
type: "object", | ||
maxProperties: 20, | ||
patternProperties: { | ||
"^.{20}$": { type: "string" } | ||
"^.{20}$": { | ||
type: "array", | ||
maxItems: 250, | ||
items: { type: "string", maxlen: 500 } | ||
} | ||
} | ||
@@ -98,0 +103,0 @@ }, |
@@ -39,6 +39,8 @@ "use strict"; | ||
type: "object", | ||
maxProperties: 20, | ||
patternProperties: { | ||
"^.{20}$": { | ||
type: "array", | ||
items: { type: "string" } | ||
maxItems: 250, | ||
items: { type: "string", maxlen: 500 } | ||
} | ||
@@ -45,0 +47,0 @@ } |
{ | ||
"name": "@vivlab/api-database", | ||
"version": "1.1.7", | ||
"version": "1.1.8", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
386502
6131