@cimplify/sdk 0.2.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +360 -56
- package/dist/index.d.ts +360 -56
- package/dist/index.js +392 -89
- package/dist/index.mjs +376 -90
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -15,18 +15,81 @@ interface Pagination {
|
|
|
15
15
|
page_size: number;
|
|
16
16
|
total_pages: number;
|
|
17
17
|
}
|
|
18
|
+
/** Strongly-typed error codes for better DX */
|
|
19
|
+
declare const ErrorCode: {
|
|
20
|
+
readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
|
|
21
|
+
readonly NETWORK_ERROR: "NETWORK_ERROR";
|
|
22
|
+
readonly TIMEOUT: "TIMEOUT";
|
|
23
|
+
readonly UNAUTHORIZED: "UNAUTHORIZED";
|
|
24
|
+
readonly FORBIDDEN: "FORBIDDEN";
|
|
25
|
+
readonly NOT_FOUND: "NOT_FOUND";
|
|
26
|
+
readonly VALIDATION_ERROR: "VALIDATION_ERROR";
|
|
27
|
+
readonly CART_EMPTY: "CART_EMPTY";
|
|
28
|
+
readonly CART_EXPIRED: "CART_EXPIRED";
|
|
29
|
+
readonly CART_NOT_FOUND: "CART_NOT_FOUND";
|
|
30
|
+
readonly ITEM_UNAVAILABLE: "ITEM_UNAVAILABLE";
|
|
31
|
+
readonly VARIANT_NOT_FOUND: "VARIANT_NOT_FOUND";
|
|
32
|
+
readonly VARIANT_OUT_OF_STOCK: "VARIANT_OUT_OF_STOCK";
|
|
33
|
+
readonly ADDON_REQUIRED: "ADDON_REQUIRED";
|
|
34
|
+
readonly ADDON_MAX_EXCEEDED: "ADDON_MAX_EXCEEDED";
|
|
35
|
+
readonly CHECKOUT_VALIDATION_FAILED: "CHECKOUT_VALIDATION_FAILED";
|
|
36
|
+
readonly DELIVERY_ADDRESS_REQUIRED: "DELIVERY_ADDRESS_REQUIRED";
|
|
37
|
+
readonly CUSTOMER_INFO_REQUIRED: "CUSTOMER_INFO_REQUIRED";
|
|
38
|
+
readonly PAYMENT_FAILED: "PAYMENT_FAILED";
|
|
39
|
+
readonly PAYMENT_CANCELLED: "PAYMENT_CANCELLED";
|
|
40
|
+
readonly INSUFFICIENT_FUNDS: "INSUFFICIENT_FUNDS";
|
|
41
|
+
readonly CARD_DECLINED: "CARD_DECLINED";
|
|
42
|
+
readonly INVALID_OTP: "INVALID_OTP";
|
|
43
|
+
readonly OTP_EXPIRED: "OTP_EXPIRED";
|
|
44
|
+
readonly AUTHORIZATION_FAILED: "AUTHORIZATION_FAILED";
|
|
45
|
+
readonly PAYMENT_ACTION_NOT_COMPLETED: "PAYMENT_ACTION_NOT_COMPLETED";
|
|
46
|
+
readonly SLOT_UNAVAILABLE: "SLOT_UNAVAILABLE";
|
|
47
|
+
readonly BOOKING_CONFLICT: "BOOKING_CONFLICT";
|
|
48
|
+
readonly SERVICE_NOT_FOUND: "SERVICE_NOT_FOUND";
|
|
49
|
+
readonly OUT_OF_STOCK: "OUT_OF_STOCK";
|
|
50
|
+
readonly INSUFFICIENT_QUANTITY: "INSUFFICIENT_QUANTITY";
|
|
51
|
+
};
|
|
52
|
+
type ErrorCodeType = (typeof ErrorCode)[keyof typeof ErrorCode];
|
|
18
53
|
/** API error structure */
|
|
19
54
|
interface ApiError {
|
|
20
55
|
code: string;
|
|
21
56
|
message: string;
|
|
22
57
|
retryable: boolean;
|
|
23
58
|
}
|
|
24
|
-
/**
|
|
59
|
+
/**
|
|
60
|
+
* Custom error class for SDK errors with typed error codes.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* try {
|
|
65
|
+
* await client.cart.addItem({ item_id: "prod_123" });
|
|
66
|
+
* } catch (error) {
|
|
67
|
+
* if (isCimplifyError(error)) {
|
|
68
|
+
* switch (error.code) {
|
|
69
|
+
* case ErrorCode.ITEM_UNAVAILABLE:
|
|
70
|
+
* toast.error("This item is no longer available");
|
|
71
|
+
* break;
|
|
72
|
+
* case ErrorCode.VARIANT_OUT_OF_STOCK:
|
|
73
|
+
* toast.error("Selected option is out of stock");
|
|
74
|
+
* break;
|
|
75
|
+
* default:
|
|
76
|
+
* toast.error(error.message);
|
|
77
|
+
* }
|
|
78
|
+
* }
|
|
79
|
+
* }
|
|
80
|
+
* ```
|
|
81
|
+
*/
|
|
25
82
|
declare class CimplifyError extends Error {
|
|
26
83
|
code: string;
|
|
27
84
|
retryable: boolean;
|
|
28
85
|
constructor(code: string, message: string, retryable?: boolean);
|
|
86
|
+
/** User-friendly message safe to display */
|
|
87
|
+
get userMessage(): string;
|
|
29
88
|
}
|
|
89
|
+
/** Type guard for CimplifyError */
|
|
90
|
+
declare function isCimplifyError(error: unknown): error is CimplifyError;
|
|
91
|
+
/** Check if error is retryable */
|
|
92
|
+
declare function isRetryableError(error: unknown): boolean;
|
|
30
93
|
|
|
31
94
|
type ProductType = "product" | "service" | "digital" | "bundle" | "composite";
|
|
32
95
|
type InventoryType = "one_to_one" | "composition" | "none";
|
|
@@ -1012,6 +1075,172 @@ interface CartSummary {
|
|
|
1012
1075
|
currency: string;
|
|
1013
1076
|
}
|
|
1014
1077
|
|
|
1078
|
+
/**
|
|
1079
|
+
* A Result type that makes errors explicit in the type system.
|
|
1080
|
+
* Inspired by Rust's Result and fp-ts Either.
|
|
1081
|
+
*
|
|
1082
|
+
* @example
|
|
1083
|
+
* ```typescript
|
|
1084
|
+
* const result = await client.cart.addItemSafe({ item_id: "prod_123" });
|
|
1085
|
+
*
|
|
1086
|
+
* if (result.ok) {
|
|
1087
|
+
* console.log(result.value); // Cart
|
|
1088
|
+
* } else {
|
|
1089
|
+
* console.log(result.error); // CimplifyError
|
|
1090
|
+
* }
|
|
1091
|
+
* ```
|
|
1092
|
+
*/
|
|
1093
|
+
type Result<T, E = Error> = Ok<T> | Err<E>;
|
|
1094
|
+
interface Ok<T> {
|
|
1095
|
+
readonly ok: true;
|
|
1096
|
+
readonly value: T;
|
|
1097
|
+
}
|
|
1098
|
+
interface Err<E> {
|
|
1099
|
+
readonly ok: false;
|
|
1100
|
+
readonly error: E;
|
|
1101
|
+
}
|
|
1102
|
+
/** Create a successful Result */
|
|
1103
|
+
declare function ok<T>(value: T): Ok<T>;
|
|
1104
|
+
/** Create a failed Result */
|
|
1105
|
+
declare function err<E>(error: E): Err<E>;
|
|
1106
|
+
/** Check if Result is Ok */
|
|
1107
|
+
declare function isOk<T, E>(result: Result<T, E>): result is Ok<T>;
|
|
1108
|
+
/** Check if Result is Err */
|
|
1109
|
+
declare function isErr<T, E>(result: Result<T, E>): result is Err<E>;
|
|
1110
|
+
/**
|
|
1111
|
+
* Transform the success value of a Result.
|
|
1112
|
+
*
|
|
1113
|
+
* @example
|
|
1114
|
+
* ```typescript
|
|
1115
|
+
* const result = ok(5);
|
|
1116
|
+
* const doubled = mapResult(result, (n) => n * 2);
|
|
1117
|
+
* // doubled = { ok: true, value: 10 }
|
|
1118
|
+
* ```
|
|
1119
|
+
*/
|
|
1120
|
+
declare function mapResult<T, U, E>(result: Result<T, E>, fn: (value: T) => U): Result<U, E>;
|
|
1121
|
+
/**
|
|
1122
|
+
* Transform the error value of a Result.
|
|
1123
|
+
*
|
|
1124
|
+
* @example
|
|
1125
|
+
* ```typescript
|
|
1126
|
+
* const result = err(new Error("oops"));
|
|
1127
|
+
* const mapped = mapError(result, (e) => new CustomError(e.message));
|
|
1128
|
+
* ```
|
|
1129
|
+
*/
|
|
1130
|
+
declare function mapError<T, E, F>(result: Result<T, E>, fn: (error: E) => F): Result<T, F>;
|
|
1131
|
+
/**
|
|
1132
|
+
* Chain Results together. If the first Result is Ok, apply the function.
|
|
1133
|
+
* If it's Err, propagate the error.
|
|
1134
|
+
*
|
|
1135
|
+
* @example
|
|
1136
|
+
* ```typescript
|
|
1137
|
+
* const getUser = (id: string): Result<User, Error> => { ... }
|
|
1138
|
+
* const getOrders = (user: User): Result<Order[], Error> => { ... }
|
|
1139
|
+
*
|
|
1140
|
+
* const result = flatMap(getUser("123"), (user) => getOrders(user));
|
|
1141
|
+
* ```
|
|
1142
|
+
*/
|
|
1143
|
+
declare function flatMap<T, U, E>(result: Result<T, E>, fn: (value: T) => Result<U, E>): Result<U, E>;
|
|
1144
|
+
/**
|
|
1145
|
+
* Get the value or a default if the Result is Err.
|
|
1146
|
+
*
|
|
1147
|
+
* @example
|
|
1148
|
+
* ```typescript
|
|
1149
|
+
* const result = err(new Error("failed"));
|
|
1150
|
+
* const value = getOrElse(result, () => defaultCart);
|
|
1151
|
+
* ```
|
|
1152
|
+
*/
|
|
1153
|
+
declare function getOrElse<T, E>(result: Result<T, E>, defaultFn: () => T): T;
|
|
1154
|
+
/**
|
|
1155
|
+
* Get the value or throw the error.
|
|
1156
|
+
* Use sparingly - defeats the purpose of Result!
|
|
1157
|
+
*
|
|
1158
|
+
* @example
|
|
1159
|
+
* ```typescript
|
|
1160
|
+
* const cart = unwrap(result); // throws if Err
|
|
1161
|
+
* ```
|
|
1162
|
+
*/
|
|
1163
|
+
declare function unwrap<T, E>(result: Result<T, E>): T;
|
|
1164
|
+
/**
|
|
1165
|
+
* Get the value or undefined if Err.
|
|
1166
|
+
*
|
|
1167
|
+
* @example
|
|
1168
|
+
* ```typescript
|
|
1169
|
+
* const cart = toNullable(result); // Cart | undefined
|
|
1170
|
+
* ```
|
|
1171
|
+
*/
|
|
1172
|
+
declare function toNullable<T, E>(result: Result<T, E>): T | undefined;
|
|
1173
|
+
/**
|
|
1174
|
+
* Convert a Promise that might throw into a Result.
|
|
1175
|
+
*
|
|
1176
|
+
* @example
|
|
1177
|
+
* ```typescript
|
|
1178
|
+
* const result = await fromPromise(
|
|
1179
|
+
* fetch("/api/data"),
|
|
1180
|
+
* (error) => new NetworkError(error.message)
|
|
1181
|
+
* );
|
|
1182
|
+
* ```
|
|
1183
|
+
*/
|
|
1184
|
+
declare function fromPromise<T, E>(promise: Promise<T>, mapError: (error: unknown) => E): Promise<Result<T, E>>;
|
|
1185
|
+
/**
|
|
1186
|
+
* Convert a function that might throw into one that returns Result.
|
|
1187
|
+
*
|
|
1188
|
+
* @example
|
|
1189
|
+
* ```typescript
|
|
1190
|
+
* const safeParse = tryCatch(
|
|
1191
|
+
* () => JSON.parse(input),
|
|
1192
|
+
* (e) => new ParseError(e.message)
|
|
1193
|
+
* );
|
|
1194
|
+
* ```
|
|
1195
|
+
*/
|
|
1196
|
+
declare function tryCatch<T, E>(fn: () => T, mapError: (error: unknown) => E): Result<T, E>;
|
|
1197
|
+
/**
|
|
1198
|
+
* Combine multiple Results. Returns Ok with array of values if all succeed,
|
|
1199
|
+
* or the first Err encountered.
|
|
1200
|
+
*
|
|
1201
|
+
* @example
|
|
1202
|
+
* ```typescript
|
|
1203
|
+
* const results = await Promise.all([
|
|
1204
|
+
* client.cart.getSafe(),
|
|
1205
|
+
* client.business.getSafe(),
|
|
1206
|
+
* ]);
|
|
1207
|
+
* const combined = combine(results);
|
|
1208
|
+
* // Result<[Cart, Business], CimplifyError>
|
|
1209
|
+
* ```
|
|
1210
|
+
*/
|
|
1211
|
+
declare function combine<T, E>(results: Result<T, E>[]): Result<T[], E>;
|
|
1212
|
+
/**
|
|
1213
|
+
* Like combine, but for an object of Results.
|
|
1214
|
+
*
|
|
1215
|
+
* @example
|
|
1216
|
+
* ```typescript
|
|
1217
|
+
* const data = combineObject({
|
|
1218
|
+
* cart: await client.cart.getSafe(),
|
|
1219
|
+
* business: await client.business.getSafe(),
|
|
1220
|
+
* });
|
|
1221
|
+
* // Result<{ cart: Cart, business: Business }, CimplifyError>
|
|
1222
|
+
* ```
|
|
1223
|
+
*/
|
|
1224
|
+
declare function combineObject<T extends Record<string, Result<unknown, unknown>>>(results: T): Result<{
|
|
1225
|
+
[K in keyof T]: T[K] extends Result<infer V, unknown> ? V : never;
|
|
1226
|
+
}, T[keyof T] extends Result<unknown, infer E> ? E : never>;
|
|
1227
|
+
|
|
1228
|
+
/**
|
|
1229
|
+
* Cart operations with explicit error handling via Result type.
|
|
1230
|
+
*
|
|
1231
|
+
* All methods return `Result<T, CimplifyError>` - no exceptions thrown.
|
|
1232
|
+
*
|
|
1233
|
+
* @example
|
|
1234
|
+
* ```typescript
|
|
1235
|
+
* const result = await client.cart.addItem({ item_id: "prod_123" });
|
|
1236
|
+
*
|
|
1237
|
+
* if (result.ok) {
|
|
1238
|
+
* console.log("Added!", result.value);
|
|
1239
|
+
* } else {
|
|
1240
|
+
* console.error("Failed:", result.error.code);
|
|
1241
|
+
* }
|
|
1242
|
+
* ```
|
|
1243
|
+
*/
|
|
1015
1244
|
declare class CartOperations {
|
|
1016
1245
|
private client;
|
|
1017
1246
|
constructor(client: CimplifyClient);
|
|
@@ -1019,22 +1248,46 @@ declare class CartOperations {
|
|
|
1019
1248
|
* Get the enriched cart with product names, images, and details.
|
|
1020
1249
|
* This is the main method for storefront display.
|
|
1021
1250
|
*/
|
|
1022
|
-
get(): Promise<UICart
|
|
1023
|
-
getRaw(): Promise<Cart
|
|
1024
|
-
getItems(): Promise<CartItem[]
|
|
1025
|
-
getCount(): Promise<number
|
|
1026
|
-
getTotal(): Promise<string
|
|
1027
|
-
getSummary(): Promise<CartSummary
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1251
|
+
get(): Promise<Result<UICart, CimplifyError>>;
|
|
1252
|
+
getRaw(): Promise<Result<Cart, CimplifyError>>;
|
|
1253
|
+
getItems(): Promise<Result<CartItem[], CimplifyError>>;
|
|
1254
|
+
getCount(): Promise<Result<number, CimplifyError>>;
|
|
1255
|
+
getTotal(): Promise<Result<string, CimplifyError>>;
|
|
1256
|
+
getSummary(): Promise<Result<CartSummary, CimplifyError>>;
|
|
1257
|
+
/**
|
|
1258
|
+
* Add an item to the cart.
|
|
1259
|
+
*
|
|
1260
|
+
* @example
|
|
1261
|
+
* ```typescript
|
|
1262
|
+
* const result = await client.cart.addItem({
|
|
1263
|
+
* item_id: "prod_burger",
|
|
1264
|
+
* quantity: 2,
|
|
1265
|
+
* variant_id: "var_large",
|
|
1266
|
+
* add_on_options: ["addon_cheese", "addon_bacon"],
|
|
1267
|
+
* });
|
|
1268
|
+
*
|
|
1269
|
+
* if (!result.ok) {
|
|
1270
|
+
* switch (result.error.code) {
|
|
1271
|
+
* case ErrorCode.ITEM_UNAVAILABLE:
|
|
1272
|
+
* toast.error("Item no longer available");
|
|
1273
|
+
* break;
|
|
1274
|
+
* case ErrorCode.VARIANT_OUT_OF_STOCK:
|
|
1275
|
+
* toast.error("Selected option is out of stock");
|
|
1276
|
+
* break;
|
|
1277
|
+
* }
|
|
1278
|
+
* }
|
|
1279
|
+
* ```
|
|
1280
|
+
*/
|
|
1281
|
+
addItem(input: AddToCartInput): Promise<Result<Cart, CimplifyError>>;
|
|
1282
|
+
updateItem(cartItemId: string, updates: UpdateCartItemInput): Promise<Result<Cart, CimplifyError>>;
|
|
1283
|
+
updateQuantity(cartItemId: string, quantity: number): Promise<Result<Cart, CimplifyError>>;
|
|
1284
|
+
removeItem(cartItemId: string): Promise<Result<Cart, CimplifyError>>;
|
|
1285
|
+
clear(): Promise<Result<Cart, CimplifyError>>;
|
|
1286
|
+
applyCoupon(code: string): Promise<Result<Cart, CimplifyError>>;
|
|
1287
|
+
removeCoupon(): Promise<Result<Cart, CimplifyError>>;
|
|
1288
|
+
isEmpty(): Promise<Result<boolean, CimplifyError>>;
|
|
1289
|
+
hasItem(productId: string, variantId?: string): Promise<Result<boolean, CimplifyError>>;
|
|
1290
|
+
findItem(productId: string, variantId?: string): Promise<Result<CartItem | undefined, CimplifyError>>;
|
|
1038
1291
|
}
|
|
1039
1292
|
|
|
1040
1293
|
type OrderStatus = "pending" | "created" | "confirmed" | "in_preparation" | "ready_to_serve" | "partially_served" | "served" | "delivered" | "picked_up" | "completed" | "cancelled" | "refunded";
|
|
@@ -1703,15 +1956,61 @@ interface CheckoutResult {
|
|
|
1703
1956
|
public_key?: string;
|
|
1704
1957
|
}
|
|
1705
1958
|
|
|
1959
|
+
/**
|
|
1960
|
+
* Checkout service with explicit error handling via Result type.
|
|
1961
|
+
*
|
|
1962
|
+
* All methods return `Result<T, CimplifyError>` - no exceptions thrown.
|
|
1963
|
+
*
|
|
1964
|
+
* @example
|
|
1965
|
+
* ```typescript
|
|
1966
|
+
* const result = await client.checkout.process(formData);
|
|
1967
|
+
*
|
|
1968
|
+
* if (result.ok) {
|
|
1969
|
+
* const checkout = result.value;
|
|
1970
|
+
* if (checkout.requires_authorization) {
|
|
1971
|
+
* // Handle OTP flow
|
|
1972
|
+
* } else if (checkout.client_secret) {
|
|
1973
|
+
* // Open Paystack popup
|
|
1974
|
+
* }
|
|
1975
|
+
* } else {
|
|
1976
|
+
* toast.error(result.error.message);
|
|
1977
|
+
* }
|
|
1978
|
+
* ```
|
|
1979
|
+
*/
|
|
1706
1980
|
declare class CheckoutService {
|
|
1707
1981
|
private client;
|
|
1708
1982
|
constructor(client: CimplifyClient);
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1983
|
+
/**
|
|
1984
|
+
* Process checkout with cart data.
|
|
1985
|
+
*
|
|
1986
|
+
* @example
|
|
1987
|
+
* ```typescript
|
|
1988
|
+
* const result = await client.checkout.process({
|
|
1989
|
+
* cart_id: cart.id,
|
|
1990
|
+
* customer: { name, email, phone, save_details: true },
|
|
1991
|
+
* order_type: "pickup",
|
|
1992
|
+
* payment_method: "mobile_money",
|
|
1993
|
+
* mobile_money_details: { phone_number, provider: "mtn" },
|
|
1994
|
+
* });
|
|
1995
|
+
*
|
|
1996
|
+
* if (!result.ok) {
|
|
1997
|
+
* switch (result.error.code) {
|
|
1998
|
+
* case ErrorCode.CART_EMPTY:
|
|
1999
|
+
* toast.error("Your cart is empty");
|
|
2000
|
+
* break;
|
|
2001
|
+
* case ErrorCode.PAYMENT_FAILED:
|
|
2002
|
+
* toast.error("Payment failed. Please try again.");
|
|
2003
|
+
* break;
|
|
2004
|
+
* }
|
|
2005
|
+
* }
|
|
2006
|
+
* ```
|
|
2007
|
+
*/
|
|
2008
|
+
process(data: CheckoutFormData): Promise<Result<CheckoutResult, CimplifyError>>;
|
|
2009
|
+
initializePayment(orderId: string, method: PaymentMethod): Promise<Result<InitializePaymentResult, CimplifyError>>;
|
|
2010
|
+
submitAuthorization(input: SubmitAuthorizationInput): Promise<Result<CheckoutResult, CimplifyError>>;
|
|
2011
|
+
pollPaymentStatus(orderId: string): Promise<Result<PaymentStatusResponse, CimplifyError>>;
|
|
2012
|
+
updateOrderCustomer(orderId: string, customer: CheckoutCustomerInfo): Promise<Result<Order, CimplifyError>>;
|
|
2013
|
+
verifyPayment(orderId: string): Promise<Result<Order, CimplifyError>>;
|
|
1715
2014
|
}
|
|
1716
2015
|
|
|
1717
2016
|
interface GetOrdersOptions {
|
|
@@ -1733,41 +2032,46 @@ interface SuccessResult {
|
|
|
1733
2032
|
success: boolean;
|
|
1734
2033
|
message?: string;
|
|
1735
2034
|
}
|
|
2035
|
+
/**
|
|
2036
|
+
* Cimplify Link service for express checkout with saved customer data.
|
|
2037
|
+
*
|
|
2038
|
+
* All methods return `Result<T, CimplifyError>` - no exceptions thrown.
|
|
2039
|
+
*/
|
|
1736
2040
|
declare class LinkService {
|
|
1737
2041
|
private client;
|
|
1738
2042
|
constructor(client: CimplifyClient);
|
|
1739
|
-
requestOtp(input: RequestOtpInput): Promise<SuccessResult
|
|
1740
|
-
verifyOtp(input: VerifyOtpInput): Promise<AuthResponse
|
|
1741
|
-
logout(): Promise<SuccessResult
|
|
1742
|
-
checkStatus(contact: string): Promise<LinkStatusResult
|
|
1743
|
-
getLinkData(): Promise<LinkData
|
|
1744
|
-
getAddresses(): Promise<CustomerAddress[]
|
|
1745
|
-
getMobileMoney(): Promise<CustomerMobileMoney[]
|
|
1746
|
-
getPreferences(): Promise<CustomerLinkPreferences
|
|
1747
|
-
enroll(data: EnrollmentData): Promise<LinkEnrollResult
|
|
1748
|
-
enrollAndLinkOrder(data: EnrollAndLinkOrderInput): Promise<EnrollAndLinkOrderResult
|
|
1749
|
-
updatePreferences(preferences: Partial<CustomerLinkPreferences>): Promise<SuccessResult
|
|
1750
|
-
createAddress(input: CreateAddressInput): Promise<CustomerAddress
|
|
1751
|
-
updateAddress(input: UpdateAddressInput): Promise<SuccessResult
|
|
1752
|
-
deleteAddress(addressId: string): Promise<SuccessResult
|
|
1753
|
-
setDefaultAddress(addressId: string): Promise<SuccessResult
|
|
1754
|
-
trackAddressUsage(addressId: string): Promise<SuccessResult
|
|
1755
|
-
createMobileMoney(input: CreateMobileMoneyInput): Promise<CustomerMobileMoney
|
|
1756
|
-
deleteMobileMoney(mobileMoneyId: string): Promise<SuccessResult
|
|
1757
|
-
setDefaultMobileMoney(mobileMoneyId: string): Promise<SuccessResult
|
|
1758
|
-
trackMobileMoneyUsage(mobileMoneyId: string): Promise<SuccessResult
|
|
1759
|
-
verifyMobileMoney(mobileMoneyId: string): Promise<SuccessResult
|
|
1760
|
-
getSessions(): Promise<LinkSession[]
|
|
1761
|
-
revokeSession(sessionId: string): Promise<RevokeSessionResult
|
|
1762
|
-
revokeAllSessions(): Promise<RevokeAllSessionsResult
|
|
1763
|
-
getAddressesRest(): Promise<CustomerAddress[]
|
|
1764
|
-
createAddressRest(input: CreateAddressInput): Promise<CustomerAddress
|
|
1765
|
-
deleteAddressRest(addressId: string): Promise<SuccessResult
|
|
1766
|
-
setDefaultAddressRest(addressId: string): Promise<SuccessResult
|
|
1767
|
-
getMobileMoneyRest(): Promise<CustomerMobileMoney[]
|
|
1768
|
-
createMobileMoneyRest(input: CreateMobileMoneyInput): Promise<CustomerMobileMoney
|
|
1769
|
-
deleteMobileMoneyRest(mobileMoneyId: string): Promise<SuccessResult
|
|
1770
|
-
setDefaultMobileMoneyRest(mobileMoneyId: string): Promise<SuccessResult
|
|
2043
|
+
requestOtp(input: RequestOtpInput): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2044
|
+
verifyOtp(input: VerifyOtpInput): Promise<Result<AuthResponse, CimplifyError>>;
|
|
2045
|
+
logout(): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2046
|
+
checkStatus(contact: string): Promise<Result<LinkStatusResult, CimplifyError>>;
|
|
2047
|
+
getLinkData(): Promise<Result<LinkData, CimplifyError>>;
|
|
2048
|
+
getAddresses(): Promise<Result<CustomerAddress[], CimplifyError>>;
|
|
2049
|
+
getMobileMoney(): Promise<Result<CustomerMobileMoney[], CimplifyError>>;
|
|
2050
|
+
getPreferences(): Promise<Result<CustomerLinkPreferences, CimplifyError>>;
|
|
2051
|
+
enroll(data: EnrollmentData): Promise<Result<LinkEnrollResult, CimplifyError>>;
|
|
2052
|
+
enrollAndLinkOrder(data: EnrollAndLinkOrderInput): Promise<Result<EnrollAndLinkOrderResult, CimplifyError>>;
|
|
2053
|
+
updatePreferences(preferences: Partial<CustomerLinkPreferences>): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2054
|
+
createAddress(input: CreateAddressInput): Promise<Result<CustomerAddress, CimplifyError>>;
|
|
2055
|
+
updateAddress(input: UpdateAddressInput): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2056
|
+
deleteAddress(addressId: string): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2057
|
+
setDefaultAddress(addressId: string): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2058
|
+
trackAddressUsage(addressId: string): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2059
|
+
createMobileMoney(input: CreateMobileMoneyInput): Promise<Result<CustomerMobileMoney, CimplifyError>>;
|
|
2060
|
+
deleteMobileMoney(mobileMoneyId: string): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2061
|
+
setDefaultMobileMoney(mobileMoneyId: string): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2062
|
+
trackMobileMoneyUsage(mobileMoneyId: string): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2063
|
+
verifyMobileMoney(mobileMoneyId: string): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2064
|
+
getSessions(): Promise<Result<LinkSession[], CimplifyError>>;
|
|
2065
|
+
revokeSession(sessionId: string): Promise<Result<RevokeSessionResult, CimplifyError>>;
|
|
2066
|
+
revokeAllSessions(): Promise<Result<RevokeAllSessionsResult, CimplifyError>>;
|
|
2067
|
+
getAddressesRest(): Promise<Result<CustomerAddress[], CimplifyError>>;
|
|
2068
|
+
createAddressRest(input: CreateAddressInput): Promise<Result<CustomerAddress, CimplifyError>>;
|
|
2069
|
+
deleteAddressRest(addressId: string): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2070
|
+
setDefaultAddressRest(addressId: string): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2071
|
+
getMobileMoneyRest(): Promise<Result<CustomerMobileMoney[], CimplifyError>>;
|
|
2072
|
+
createMobileMoneyRest(input: CreateMobileMoneyInput): Promise<Result<CustomerMobileMoney, CimplifyError>>;
|
|
2073
|
+
deleteMobileMoneyRest(mobileMoneyId: string): Promise<Result<SuccessResult, CimplifyError>>;
|
|
2074
|
+
setDefaultMobileMoneyRest(mobileMoneyId: string): Promise<Result<SuccessResult, CimplifyError>>;
|
|
1771
2075
|
}
|
|
1772
2076
|
|
|
1773
2077
|
interface AuthStatus {
|
|
@@ -2971,4 +3275,4 @@ interface ApiResponse<T> {
|
|
|
2971
3275
|
metadata?: ResponseMetadata;
|
|
2972
3276
|
}
|
|
2973
3277
|
|
|
2974
|
-
export { AUTHORIZATION_TYPE, AUTH_MUTATION, type AddOn, type AddOnDetails, type AddOnGroupDetails, type AddOnOption, type AddOnOptionDetails, type AddOnOptionPrice, type AddOnWithOptions, type AddToCartInput, type AddressData, type AdjustmentType, type AmountToPay, type ApiError, type ApiResponse, type AppliedDiscount, type AuthResponse, AuthService, type AuthStatus, type AuthorizationType, type AvailabilityCheck, type AvailabilityResult, type AvailableSlot, type BenefitType, type Booking, type BookingRequirementOverride, type BookingStatus, type BookingWithDetails, type BufferTimes, type Bundle, type BundleComponentData, type BundleComponentInfo, type BundlePriceType, type BundleProduct, type BundleSelectionData, type BundleSelectionInput, type BundleStoredSelection, type BundleSummary, type BundleWithDetails, type Business, type BusinessHours, type BusinessPreferences, BusinessService, type BusinessSettings, type BusinessType, type BusinessWithLocations, CHECKOUT_MODE, CHECKOUT_MUTATION, CHECKOUT_STEP, CURRENCY_SYMBOLS, type CancelBookingInput, type CancelOrderInput, type CancellationPolicy, type Cart, type CartAddOn, type CartChannel, type CartItem, type CartItemDetails, CartOperations, type CartStatus, type CartSummary, type CartTotals, CatalogueQueries, type Category, type CategoryInfo, type CategorySummary, type ChangePasswordInput, type CheckSlotAvailabilityInput, type CheckoutAddressInfo, type CheckoutCustomerInfo, type CheckoutFormData, type CheckoutInput, type CheckoutMode, CheckoutService as CheckoutOperations, type CheckoutOrderType, type CheckoutPaymentMethod, type CheckoutResult, CheckoutService, type CheckoutStep, type ChosenPrice, CimplifyClient, type CimplifyConfig, CimplifyError, type Collection, type CollectionProduct, type CollectionSummary, type ComponentGroup, type ComponentGroupWithComponents, type ComponentPriceBreakdown, type ComponentSelectionInput, type ComponentSourceType, type Composite, type CompositeComponent, type CompositePriceBreakdown, type CompositePriceResult, type CompositePricingMode, type CompositeSelectionData, type ComponentSelectionInput as CompositeSelectionInput, type CompositeStoredSelection, type CompositeWithDetails, type ContactType, type CreateAddressInput, type CreateMobileMoneyInput, type Currency, type Customer, type CustomerAddress, type CustomerLinkPreferences, type CustomerMobileMoney, type CustomerServicePreferences, DEFAULT_COUNTRY, DEFAULT_CURRENCY, type DayAvailability, type DepositResult, type DepositType, type DeviceType, type DigitalProductType, type DiscountBreakdown, type DiscountDetails, type DisplayAddOn, type DisplayAddOnOption, type DisplayCart, type DisplayCartItem, type EnrollAndLinkOrderInput, type EnrollAndLinkOrderResult, type EnrollmentData, type FeeBearerType, type FormatCompactOptions, type FormatPriceOptions, type FulfillmentLink, type FulfillmentStatus, type FulfillmentType, type GetAvailableSlotsInput, type GetOrdersOptions, type GetProductsOptions, type GroupPricingBehavior, type InitializePaymentResult, InventoryService, type InventorySummary, type InventoryType, type KitchenOrderItem, type KitchenOrderResult, LINK_MUTATION, LINK_QUERY, type LineConfiguration, type LineItem, type LineType, type LinkData, type LinkEnrollResult, LinkService, type LinkSession, type LinkStatusResult, type LiteBootstrap, LiteService, type Location, type LocationAppointment, type LocationProductPrice, type LocationStock, type LocationTaxBehavior, type LocationTaxOverrides, type LocationTimeProfile, type LocationWithDetails, MOBILE_MONEY_PROVIDER, MOBILE_MONEY_PROVIDERS, type MobileMoneyData, type MobileMoneyDetails, type MobileMoneyProvider, type Money, type MutationRequest, ORDER_MUTATION, ORDER_TYPE, type Order, type OrderChannel, type OrderFilter, type OrderFulfillmentSummary, type OrderGroup, type OrderGroupDetails, type OrderGroupPayment, type OrderGroupPaymentState, type OrderGroupPaymentSummary, type OrderHistory, type OrderLineState, type OrderLineStatus, type OrderPaymentEvent, OrderQueries, type OrderSplitDetail, type OrderStatus, type OtpResult, PAYMENT_METHOD, PAYMENT_MUTATION, PAYMENT_STATE, PICKUP_TIME_TYPE, type Pagination, type PaginationParams, type ParsedPrice, type Payment, type PaymentErrorDetails, type PaymentMethod, type PaymentMethodType, type PaymentProcessingState, type PaymentProvider, type PaymentResponse, type PaymentState, type PaymentStatus, type PaymentStatusResponse, type PickupTime, type PickupTimeType, type Price, type PriceAdjustment, type PriceDecisionPath, type PriceEntryType, type PriceInfo, type PricePathTaxInfo, type PriceSource, type PricingOverrides, type Product, type ProductAddOn, type ProductAvailability, type ProductStock, type ProductTimeProfile, type ProductType, type ProductVariant, type ProductVariantValue, type ProductWithDetails, type ProductWithPrice, QueryBuilder, type QueryRequest, type RefundOrderInput, type ReminderMethod, type ReminderSettings, type RequestOtpInput, type RescheduleBookingInput, type ResourceAssignment, type ResourceAvailabilityException, type ResourceAvailabilityRule, type ResourceType, type ResponseMetadata, type RevokeAllSessionsResult, type RevokeSessionResult, type Room, type SalesChannel, type SchedulingMetadata, type SchedulingResult, SchedulingService, type SearchOptions, type SelectedAddOnOption, type Service, type ServiceAvailabilityException, type ServiceAvailabilityParams, type ServiceAvailabilityResult, type ServiceAvailabilityRule, type ServiceCharge, type ServiceNotes, type ServiceScheduleRequest, type ServiceStaffRequirement, type ServiceStatus, type ServiceWithStaff, type Staff, type StaffAssignment, type StaffAvailabilityException, type StaffAvailabilityRule, type StaffBookingProfile, type StaffRole, type StaffScheduleItem, type Stock, type StockLevel, type StockOwnershipType, type StockStatus, type StorefrontBootstrap, type SubmitAuthorizationInput, type Table, type TableInfo, type TaxComponent, type TaxInfo, type TaxPathComponent, type TimeRange, type TimeRanges, type TimeSlot, type UICart, type UICartBusiness, type UICartCustomer, type UICartLocation, type UICartPricing, type UpdateAddressInput, type UpdateCartItemInput, type UpdateOrderStatusInput, type UpdateProfileInput, type VariantAxis, type VariantAxisSelection, type VariantAxisValue, type VariantAxisWithValues, type VariantDetails, type VariantDetailsDTO, type VariantDisplayAttribute, type VariantLocationAvailability, type VariantStock, type VariantStrategy, type VerifyOtpInput, categorizePaymentError, createCimplifyClient, detectMobileMoneyProvider, extractPriceInfo, formatMoney, formatNumberCompact, formatPrice, formatPriceAdjustment, formatPriceCompact, formatProductPrice, getBasePrice, getCurrencySymbol, getDiscountPercentage, getDisplayPrice, getMarkupPercentage, getProductCurrency, isOnSale, normalizePaymentResponse, normalizeStatusResponse, parsePrice, parsePricePath, parsedPriceToPriceInfo, query };
|
|
3278
|
+
export { AUTHORIZATION_TYPE, AUTH_MUTATION, type AddOn, type AddOnDetails, type AddOnGroupDetails, type AddOnOption, type AddOnOptionDetails, type AddOnOptionPrice, type AddOnWithOptions, type AddToCartInput, type AddressData, type AdjustmentType, type AmountToPay, type ApiError, type ApiResponse, type AppliedDiscount, type AuthResponse, AuthService, type AuthStatus, type AuthorizationType, type AvailabilityCheck, type AvailabilityResult, type AvailableSlot, type BenefitType, type Booking, type BookingRequirementOverride, type BookingStatus, type BookingWithDetails, type BufferTimes, type Bundle, type BundleComponentData, type BundleComponentInfo, type BundlePriceType, type BundleProduct, type BundleSelectionData, type BundleSelectionInput, type BundleStoredSelection, type BundleSummary, type BundleWithDetails, type Business, type BusinessHours, type BusinessPreferences, BusinessService, type BusinessSettings, type BusinessType, type BusinessWithLocations, CHECKOUT_MODE, CHECKOUT_MUTATION, CHECKOUT_STEP, CURRENCY_SYMBOLS, type CancelBookingInput, type CancelOrderInput, type CancellationPolicy, type Cart, type CartAddOn, type CartChannel, type CartItem, type CartItemDetails, CartOperations, type CartStatus, type CartSummary, type CartTotals, CatalogueQueries, type Category, type CategoryInfo, type CategorySummary, type ChangePasswordInput, type CheckSlotAvailabilityInput, type CheckoutAddressInfo, type CheckoutCustomerInfo, type CheckoutFormData, type CheckoutInput, type CheckoutMode, CheckoutService as CheckoutOperations, type CheckoutOrderType, type CheckoutPaymentMethod, type CheckoutResult, CheckoutService, type CheckoutStep, type ChosenPrice, CimplifyClient, type CimplifyConfig, CimplifyError, type Collection, type CollectionProduct, type CollectionSummary, type ComponentGroup, type ComponentGroupWithComponents, type ComponentPriceBreakdown, type ComponentSelectionInput, type ComponentSourceType, type Composite, type CompositeComponent, type CompositePriceBreakdown, type CompositePriceResult, type CompositePricingMode, type CompositeSelectionData, type ComponentSelectionInput as CompositeSelectionInput, type CompositeStoredSelection, type CompositeWithDetails, type ContactType, type CreateAddressInput, type CreateMobileMoneyInput, type Currency, type Customer, type CustomerAddress, type CustomerLinkPreferences, type CustomerMobileMoney, type CustomerServicePreferences, DEFAULT_COUNTRY, DEFAULT_CURRENCY, type DayAvailability, type DepositResult, type DepositType, type DeviceType, type DigitalProductType, type DiscountBreakdown, type DiscountDetails, type DisplayAddOn, type DisplayAddOnOption, type DisplayCart, type DisplayCartItem, type EnrollAndLinkOrderInput, type EnrollAndLinkOrderResult, type EnrollmentData, type Err, ErrorCode, type ErrorCodeType, type FeeBearerType, type FormatCompactOptions, type FormatPriceOptions, type FulfillmentLink, type FulfillmentStatus, type FulfillmentType, type GetAvailableSlotsInput, type GetOrdersOptions, type GetProductsOptions, type GroupPricingBehavior, type InitializePaymentResult, InventoryService, type InventorySummary, type InventoryType, type KitchenOrderItem, type KitchenOrderResult, LINK_MUTATION, LINK_QUERY, type LineConfiguration, type LineItem, type LineType, type LinkData, type LinkEnrollResult, LinkService, type LinkSession, type LinkStatusResult, type LiteBootstrap, LiteService, type Location, type LocationAppointment, type LocationProductPrice, type LocationStock, type LocationTaxBehavior, type LocationTaxOverrides, type LocationTimeProfile, type LocationWithDetails, MOBILE_MONEY_PROVIDER, MOBILE_MONEY_PROVIDERS, type MobileMoneyData, type MobileMoneyDetails, type MobileMoneyProvider, type Money, type MutationRequest, ORDER_MUTATION, ORDER_TYPE, type Ok, type Order, type OrderChannel, type OrderFilter, type OrderFulfillmentSummary, type OrderGroup, type OrderGroupDetails, type OrderGroupPayment, type OrderGroupPaymentState, type OrderGroupPaymentSummary, type OrderHistory, type OrderLineState, type OrderLineStatus, type OrderPaymentEvent, OrderQueries, type OrderSplitDetail, type OrderStatus, type OtpResult, PAYMENT_METHOD, PAYMENT_MUTATION, PAYMENT_STATE, PICKUP_TIME_TYPE, type Pagination, type PaginationParams, type ParsedPrice, type Payment, type PaymentErrorDetails, type PaymentMethod, type PaymentMethodType, type PaymentProcessingState, type PaymentProvider, type PaymentResponse, type PaymentState, type PaymentStatus, type PaymentStatusResponse, type PickupTime, type PickupTimeType, type Price, type PriceAdjustment, type PriceDecisionPath, type PriceEntryType, type PriceInfo, type PricePathTaxInfo, type PriceSource, type PricingOverrides, type Product, type ProductAddOn, type ProductAvailability, type ProductStock, type ProductTimeProfile, type ProductType, type ProductVariant, type ProductVariantValue, type ProductWithDetails, type ProductWithPrice, QueryBuilder, type QueryRequest, type RefundOrderInput, type ReminderMethod, type ReminderSettings, type RequestOtpInput, type RescheduleBookingInput, type ResourceAssignment, type ResourceAvailabilityException, type ResourceAvailabilityRule, type ResourceType, type ResponseMetadata, type Result, type RevokeAllSessionsResult, type RevokeSessionResult, type Room, type SalesChannel, type SchedulingMetadata, type SchedulingResult, SchedulingService, type SearchOptions, type SelectedAddOnOption, type Service, type ServiceAvailabilityException, type ServiceAvailabilityParams, type ServiceAvailabilityResult, type ServiceAvailabilityRule, type ServiceCharge, type ServiceNotes, type ServiceScheduleRequest, type ServiceStaffRequirement, type ServiceStatus, type ServiceWithStaff, type Staff, type StaffAssignment, type StaffAvailabilityException, type StaffAvailabilityRule, type StaffBookingProfile, type StaffRole, type StaffScheduleItem, type Stock, type StockLevel, type StockOwnershipType, type StockStatus, type StorefrontBootstrap, type SubmitAuthorizationInput, type Table, type TableInfo, type TaxComponent, type TaxInfo, type TaxPathComponent, type TimeRange, type TimeRanges, type TimeSlot, type UICart, type UICartBusiness, type UICartCustomer, type UICartLocation, type UICartPricing, type UpdateAddressInput, type UpdateCartItemInput, type UpdateOrderStatusInput, type UpdateProfileInput, type VariantAxis, type VariantAxisSelection, type VariantAxisValue, type VariantAxisWithValues, type VariantDetails, type VariantDetailsDTO, type VariantDisplayAttribute, type VariantLocationAvailability, type VariantStock, type VariantStrategy, type VerifyOtpInput, categorizePaymentError, combine, combineObject, createCimplifyClient, detectMobileMoneyProvider, err, extractPriceInfo, flatMap, formatMoney, formatNumberCompact, formatPrice, formatPriceAdjustment, formatPriceCompact, formatProductPrice, fromPromise, getBasePrice, getCurrencySymbol, getDiscountPercentage, getDisplayPrice, getMarkupPercentage, getOrElse, getProductCurrency, isCimplifyError, isErr, isOk, isOnSale, isRetryableError, mapError, mapResult, normalizePaymentResponse, normalizeStatusResponse, ok, parsePrice, parsePricePath, parsedPriceToPriceInfo, query, toNullable, tryCatch, unwrap };
|