@cimplify/sdk 0.5.3 → 0.6.1

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/README.md CHANGED
@@ -29,6 +29,11 @@ await cimplify.cart.addItem({ item_id: "product-id", quantity: 1 });
29
29
  const cart = await cimplify.cart.get();
30
30
  ```
31
31
 
32
+ ## Pricing Guide
33
+
34
+ - See `./sdk-pricing-flow.md` for the quote-first pricing flow and end-to-end examples.
35
+ - Runtime backend contract: `../../src/salesman/pricing-contract.md` (quote/recompute behavior and channel mapping).
36
+
32
37
  ## Services
33
38
 
34
39
  ### Catalogue
@@ -628,221 +628,6 @@ interface ProductTimeProfile {
628
628
  metadata?: Record<string, unknown>;
629
629
  }
630
630
 
631
- /**
632
- * A Result type that makes errors explicit in the type system.
633
- * Inspired by Rust's Result and fp-ts Either.
634
- *
635
- * @example
636
- * ```typescript
637
- * const result = await client.cart.addItemSafe({ item_id: "prod_123" });
638
- *
639
- * if (result.ok) {
640
- * console.log(result.value); // Cart
641
- * } else {
642
- * console.log(result.error); // CimplifyError
643
- * }
644
- * ```
645
- */
646
- type Result<T, E = Error> = Ok<T> | Err<E>;
647
- interface Ok<T> {
648
- readonly ok: true;
649
- readonly value: T;
650
- }
651
- interface Err<E> {
652
- readonly ok: false;
653
- readonly error: E;
654
- }
655
- /** Create a successful Result */
656
- declare function ok<T>(value: T): Ok<T>;
657
- /** Create a failed Result */
658
- declare function err<E>(error: E): Err<E>;
659
- /** Check if Result is Ok */
660
- declare function isOk<T, E>(result: Result<T, E>): result is Ok<T>;
661
- /** Check if Result is Err */
662
- declare function isErr<T, E>(result: Result<T, E>): result is Err<E>;
663
- /**
664
- * Transform the success value of a Result.
665
- *
666
- * @example
667
- * ```typescript
668
- * const result = ok(5);
669
- * const doubled = mapResult(result, (n) => n * 2);
670
- * // doubled = { ok: true, value: 10 }
671
- * ```
672
- */
673
- declare function mapResult<T, U, E>(result: Result<T, E>, fn: (value: T) => U): Result<U, E>;
674
- /**
675
- * Transform the error value of a Result.
676
- *
677
- * @example
678
- * ```typescript
679
- * const result = err(new Error("oops"));
680
- * const mapped = mapError(result, (e) => new CustomError(e.message));
681
- * ```
682
- */
683
- declare function mapError<T, E, F>(result: Result<T, E>, fn: (error: E) => F): Result<T, F>;
684
- /**
685
- * Chain Results together. If the first Result is Ok, apply the function.
686
- * If it's Err, propagate the error.
687
- *
688
- * @example
689
- * ```typescript
690
- * const getUser = (id: string): Result<User, Error> => { ... }
691
- * const getOrders = (user: User): Result<Order[], Error> => { ... }
692
- *
693
- * const result = flatMap(getUser("123"), (user) => getOrders(user));
694
- * ```
695
- */
696
- declare function flatMap<T, U, E>(result: Result<T, E>, fn: (value: T) => Result<U, E>): Result<U, E>;
697
- /**
698
- * Get the value or a default if the Result is Err.
699
- *
700
- * @example
701
- * ```typescript
702
- * const result = err(new Error("failed"));
703
- * const value = getOrElse(result, () => defaultCart);
704
- * ```
705
- */
706
- declare function getOrElse<T, E>(result: Result<T, E>, defaultFn: () => T): T;
707
- /**
708
- * Get the value or throw the error.
709
- * Use sparingly - defeats the purpose of Result!
710
- *
711
- * @example
712
- * ```typescript
713
- * const cart = unwrap(result); // throws if Err
714
- * ```
715
- */
716
- declare function unwrap<T, E>(result: Result<T, E>): T;
717
- /**
718
- * Get the value or undefined if Err.
719
- *
720
- * @example
721
- * ```typescript
722
- * const cart = toNullable(result); // Cart | undefined
723
- * ```
724
- */
725
- declare function toNullable<T, E>(result: Result<T, E>): T | undefined;
726
- /**
727
- * Convert a Promise that might throw into a Result.
728
- *
729
- * @example
730
- * ```typescript
731
- * const result = await fromPromise(
732
- * fetch("/api/data"),
733
- * (error) => new NetworkError(error.message)
734
- * );
735
- * ```
736
- */
737
- declare function fromPromise<T, E>(promise: Promise<T>, mapError: (error: unknown) => E): Promise<Result<T, E>>;
738
- /**
739
- * Convert a function that might throw into one that returns Result.
740
- *
741
- * @example
742
- * ```typescript
743
- * const safeParse = tryCatch(
744
- * () => JSON.parse(input),
745
- * (e) => new ParseError(e.message)
746
- * );
747
- * ```
748
- */
749
- declare function tryCatch<T, E>(fn: () => T, mapError: (error: unknown) => E): Result<T, E>;
750
- /**
751
- * Combine multiple Results. Returns Ok with array of values if all succeed,
752
- * or the first Err encountered.
753
- *
754
- * @example
755
- * ```typescript
756
- * const results = await Promise.all([
757
- * client.cart.getSafe(),
758
- * client.business.getSafe(),
759
- * ]);
760
- * const combined = combine(results);
761
- * // Result<[Cart, Business], CimplifyError>
762
- * ```
763
- */
764
- declare function combine<T, E>(results: Result<T, E>[]): Result<T[], E>;
765
- /**
766
- * Like combine, but for an object of Results.
767
- *
768
- * @example
769
- * ```typescript
770
- * const data = combineObject({
771
- * cart: await client.cart.getSafe(),
772
- * business: await client.business.getSafe(),
773
- * });
774
- * // Result<{ cart: Cart, business: Business }, CimplifyError>
775
- * ```
776
- */
777
- declare function combineObject<T extends Record<string, Result<unknown, unknown>>>(results: T): Result<{
778
- [K in keyof T]: T[K] extends Result<infer V, unknown> ? V : never;
779
- }, T[keyof T] extends Result<unknown, infer E> ? E : never>;
780
-
781
- interface GetProductsOptions {
782
- category?: string;
783
- collection?: string;
784
- search?: string;
785
- limit?: number;
786
- offset?: number;
787
- tags?: string[];
788
- featured?: boolean;
789
- in_stock?: boolean;
790
- min_price?: number;
791
- max_price?: number;
792
- sort_by?: "name" | "price" | "created_at";
793
- sort_order?: "asc" | "desc";
794
- }
795
- interface SearchOptions {
796
- limit?: number;
797
- category?: string;
798
- }
799
- declare class CatalogueQueries {
800
- private client;
801
- constructor(client: CimplifyClient);
802
- getProducts(options?: GetProductsOptions): Promise<Result<Product[], CimplifyError>>;
803
- getProduct(id: string): Promise<Result<ProductWithDetails, CimplifyError>>;
804
- getProductBySlug(slug: string): Promise<Result<ProductWithDetails, CimplifyError>>;
805
- getVariants(productId: string): Promise<Result<ProductVariant[], CimplifyError>>;
806
- getVariantAxes(productId: string): Promise<Result<VariantAxis[], CimplifyError>>;
807
- /**
808
- * Find a variant by axis selections (e.g., { "Size": "Large", "Color": "Red" })
809
- * Returns the matching variant or null if no match found.
810
- */
811
- getVariantByAxisSelections(productId: string, selections: VariantAxisSelection): Promise<Result<ProductVariant | null, CimplifyError>>;
812
- /**
813
- * Get a specific variant by its ID
814
- */
815
- getVariantById(productId: string, variantId: string): Promise<Result<ProductVariant, CimplifyError>>;
816
- getAddOns(productId: string): Promise<Result<AddOn[], CimplifyError>>;
817
- getCategories(): Promise<Result<Category[], CimplifyError>>;
818
- getCategory(id: string): Promise<Result<Category, CimplifyError>>;
819
- getCategoryBySlug(slug: string): Promise<Result<Category, CimplifyError>>;
820
- getCategoryProducts(categoryId: string): Promise<Result<Product[], CimplifyError>>;
821
- getCollections(): Promise<Result<Collection[], CimplifyError>>;
822
- getCollection(id: string): Promise<Result<Collection, CimplifyError>>;
823
- getCollectionBySlug(slug: string): Promise<Result<Collection, CimplifyError>>;
824
- getCollectionProducts(collectionId: string): Promise<Result<Product[], CimplifyError>>;
825
- searchCollections(query: string, limit?: number): Promise<Result<Collection[], CimplifyError>>;
826
- getBundles(): Promise<Result<Bundle[], CimplifyError>>;
827
- getBundle(id: string): Promise<Result<BundleWithDetails, CimplifyError>>;
828
- getBundleBySlug(slug: string): Promise<Result<BundleWithDetails, CimplifyError>>;
829
- searchBundles(query: string, limit?: number): Promise<Result<Bundle[], CimplifyError>>;
830
- getComposites(options?: {
831
- limit?: number;
832
- }): Promise<Result<Composite[], CimplifyError>>;
833
- getComposite(id: string): Promise<Result<CompositeWithDetails, CimplifyError>>;
834
- getCompositeByProductId(productId: string): Promise<Result<CompositeWithDetails, CimplifyError>>;
835
- calculateCompositePrice(compositeId: string, selections: ComponentSelectionInput[], locationId?: string): Promise<Result<CompositePriceResult, CimplifyError>>;
836
- search(query: string, options?: SearchOptions): Promise<Result<Product[], CimplifyError>>;
837
- searchProducts(query: string, options?: SearchOptions): Promise<Result<Product[], CimplifyError>>;
838
- getMenu(options?: {
839
- category?: string;
840
- limit?: number;
841
- }): Promise<Result<Product[], CimplifyError>>;
842
- getMenuCategory(categoryId: string): Promise<Result<Product[], CimplifyError>>;
843
- getMenuItem(itemId: string): Promise<Result<ProductWithDetails, CimplifyError>>;
844
- }
845
-
846
631
  type CartStatus = "active" | "converting" | "converted" | "expired" | "abandoned";
847
632
  type CartChannel = "qr" | "taker" | "staff" | "web" | "dashboard";
848
633
  type PriceSource = {
@@ -1284,10 +1069,17 @@ interface UICart {
1284
1069
  pricing: UICartPricing;
1285
1070
  metadata?: Record<string, unknown>;
1286
1071
  }
1072
+ /** Envelope returned by cart#enriched query */
1073
+ interface UICartResponse {
1074
+ cart: UICart;
1075
+ cart_count: number;
1076
+ message?: string | null;
1077
+ }
1287
1078
  interface AddToCartInput {
1288
1079
  item_id: string;
1289
1080
  quantity?: number;
1290
1081
  variant_id?: string;
1082
+ quote_id?: string;
1291
1083
  add_on_options?: string[];
1292
1084
  special_instructions?: string;
1293
1085
  bundle_selections?: BundleSelectionInput[];
@@ -1317,6 +1109,295 @@ interface CartSummary {
1317
1109
  currency: string;
1318
1110
  }
1319
1111
 
1112
+ /**
1113
+ * A Result type that makes errors explicit in the type system.
1114
+ * Inspired by Rust's Result and fp-ts Either.
1115
+ *
1116
+ * @example
1117
+ * ```typescript
1118
+ * const result = await client.cart.addItemSafe({ item_id: "prod_123" });
1119
+ *
1120
+ * if (result.ok) {
1121
+ * console.log(result.value); // Cart
1122
+ * } else {
1123
+ * console.log(result.error); // CimplifyError
1124
+ * }
1125
+ * ```
1126
+ */
1127
+ type Result<T, E = Error> = Ok<T> | Err<E>;
1128
+ interface Ok<T> {
1129
+ readonly ok: true;
1130
+ readonly value: T;
1131
+ }
1132
+ interface Err<E> {
1133
+ readonly ok: false;
1134
+ readonly error: E;
1135
+ }
1136
+ /** Create a successful Result */
1137
+ declare function ok<T>(value: T): Ok<T>;
1138
+ /** Create a failed Result */
1139
+ declare function err<E>(error: E): Err<E>;
1140
+ /** Check if Result is Ok */
1141
+ declare function isOk<T, E>(result: Result<T, E>): result is Ok<T>;
1142
+ /** Check if Result is Err */
1143
+ declare function isErr<T, E>(result: Result<T, E>): result is Err<E>;
1144
+ /**
1145
+ * Transform the success value of a Result.
1146
+ *
1147
+ * @example
1148
+ * ```typescript
1149
+ * const result = ok(5);
1150
+ * const doubled = mapResult(result, (n) => n * 2);
1151
+ * // doubled = { ok: true, value: 10 }
1152
+ * ```
1153
+ */
1154
+ declare function mapResult<T, U, E>(result: Result<T, E>, fn: (value: T) => U): Result<U, E>;
1155
+ /**
1156
+ * Transform the error value of a Result.
1157
+ *
1158
+ * @example
1159
+ * ```typescript
1160
+ * const result = err(new Error("oops"));
1161
+ * const mapped = mapError(result, (e) => new CustomError(e.message));
1162
+ * ```
1163
+ */
1164
+ declare function mapError<T, E, F>(result: Result<T, E>, fn: (error: E) => F): Result<T, F>;
1165
+ /**
1166
+ * Chain Results together. If the first Result is Ok, apply the function.
1167
+ * If it's Err, propagate the error.
1168
+ *
1169
+ * @example
1170
+ * ```typescript
1171
+ * const getUser = (id: string): Result<User, Error> => { ... }
1172
+ * const getOrders = (user: User): Result<Order[], Error> => { ... }
1173
+ *
1174
+ * const result = flatMap(getUser("123"), (user) => getOrders(user));
1175
+ * ```
1176
+ */
1177
+ declare function flatMap<T, U, E>(result: Result<T, E>, fn: (value: T) => Result<U, E>): Result<U, E>;
1178
+ /**
1179
+ * Get the value or a default if the Result is Err.
1180
+ *
1181
+ * @example
1182
+ * ```typescript
1183
+ * const result = err(new Error("failed"));
1184
+ * const value = getOrElse(result, () => defaultCart);
1185
+ * ```
1186
+ */
1187
+ declare function getOrElse<T, E>(result: Result<T, E>, defaultFn: () => T): T;
1188
+ /**
1189
+ * Get the value or throw the error.
1190
+ * Use sparingly - defeats the purpose of Result!
1191
+ *
1192
+ * @example
1193
+ * ```typescript
1194
+ * const cart = unwrap(result); // throws if Err
1195
+ * ```
1196
+ */
1197
+ declare function unwrap<T, E>(result: Result<T, E>): T;
1198
+ /**
1199
+ * Get the value or undefined if Err.
1200
+ *
1201
+ * @example
1202
+ * ```typescript
1203
+ * const cart = toNullable(result); // Cart | undefined
1204
+ * ```
1205
+ */
1206
+ declare function toNullable<T, E>(result: Result<T, E>): T | undefined;
1207
+ /**
1208
+ * Convert a Promise that might throw into a Result.
1209
+ *
1210
+ * @example
1211
+ * ```typescript
1212
+ * const result = await fromPromise(
1213
+ * fetch("/api/data"),
1214
+ * (error) => new NetworkError(error.message)
1215
+ * );
1216
+ * ```
1217
+ */
1218
+ declare function fromPromise<T, E>(promise: Promise<T>, mapError: (error: unknown) => E): Promise<Result<T, E>>;
1219
+ /**
1220
+ * Convert a function that might throw into one that returns Result.
1221
+ *
1222
+ * @example
1223
+ * ```typescript
1224
+ * const safeParse = tryCatch(
1225
+ * () => JSON.parse(input),
1226
+ * (e) => new ParseError(e.message)
1227
+ * );
1228
+ * ```
1229
+ */
1230
+ declare function tryCatch<T, E>(fn: () => T, mapError: (error: unknown) => E): Result<T, E>;
1231
+ /**
1232
+ * Combine multiple Results. Returns Ok with array of values if all succeed,
1233
+ * or the first Err encountered.
1234
+ *
1235
+ * @example
1236
+ * ```typescript
1237
+ * const results = await Promise.all([
1238
+ * client.cart.getSafe(),
1239
+ * client.business.getSafe(),
1240
+ * ]);
1241
+ * const combined = combine(results);
1242
+ * // Result<[Cart, Business], CimplifyError>
1243
+ * ```
1244
+ */
1245
+ declare function combine<T, E>(results: Result<T, E>[]): Result<T[], E>;
1246
+ /**
1247
+ * Like combine, but for an object of Results.
1248
+ *
1249
+ * @example
1250
+ * ```typescript
1251
+ * const data = combineObject({
1252
+ * cart: await client.cart.getSafe(),
1253
+ * business: await client.business.getSafe(),
1254
+ * });
1255
+ * // Result<{ cart: Cart, business: Business }, CimplifyError>
1256
+ * ```
1257
+ */
1258
+ declare function combineObject<T extends Record<string, Result<unknown, unknown>>>(results: T): Result<{
1259
+ [K in keyof T]: T[K] extends Result<infer V, unknown> ? V : never;
1260
+ }, T[keyof T] extends Result<unknown, infer E> ? E : never>;
1261
+
1262
+ interface GetProductsOptions {
1263
+ category?: string;
1264
+ collection?: string;
1265
+ search?: string;
1266
+ limit?: number;
1267
+ offset?: number;
1268
+ tags?: string[];
1269
+ featured?: boolean;
1270
+ in_stock?: boolean;
1271
+ min_price?: number;
1272
+ max_price?: number;
1273
+ sort_by?: "name" | "price" | "created_at";
1274
+ sort_order?: "asc" | "desc";
1275
+ }
1276
+ interface SearchOptions {
1277
+ limit?: number;
1278
+ category?: string;
1279
+ }
1280
+ interface QuoteCompositeSelectionInput {
1281
+ component_id: string;
1282
+ quantity: number;
1283
+ variant_id?: string;
1284
+ add_on_option_id?: string;
1285
+ }
1286
+ interface QuoteBundleSelectionInput {
1287
+ component_id: string;
1288
+ quantity: number;
1289
+ variant_id?: string;
1290
+ }
1291
+ interface FetchQuoteInput {
1292
+ product_id: string;
1293
+ variant_id?: string;
1294
+ location_id?: string;
1295
+ quantity?: number;
1296
+ add_on_option_ids?: string[];
1297
+ bundle_selections?: QuoteBundleSelectionInput[];
1298
+ composite_selections?: QuoteCompositeSelectionInput[];
1299
+ }
1300
+ interface RefreshQuoteInput {
1301
+ quote_id: string;
1302
+ product_id?: string;
1303
+ variant_id?: string;
1304
+ location_id?: string;
1305
+ quantity?: number;
1306
+ add_on_option_ids?: string[];
1307
+ bundle_selections?: QuoteBundleSelectionInput[];
1308
+ composite_selections?: QuoteCompositeSelectionInput[];
1309
+ }
1310
+ type QuoteStatus = "pending" | "used" | "expired";
1311
+ interface QuoteDynamicBuckets {
1312
+ intent: string;
1313
+ demand: string;
1314
+ inventory: string;
1315
+ competition?: string;
1316
+ }
1317
+ interface QuoteUiMessage {
1318
+ code: string;
1319
+ level: "info" | "warn" | "error" | string;
1320
+ text: string;
1321
+ countdown_seconds?: number;
1322
+ }
1323
+ interface PriceQuote {
1324
+ quote_id: string;
1325
+ business_id: string;
1326
+ product_id: string;
1327
+ variant_id?: string;
1328
+ location_id?: string;
1329
+ source: string;
1330
+ quantity: number;
1331
+ currency?: string;
1332
+ item_price_info: ChosenPrice;
1333
+ variant_price_info?: ChosenPrice;
1334
+ final_price_info: ChosenPrice;
1335
+ add_on_option_ids: string[];
1336
+ bundle_selections?: QuoteBundleSelectionInput[];
1337
+ add_ons_price_info?: ChosenPrice;
1338
+ quoted_total_price_info?: ChosenPrice;
1339
+ composite_selections?: QuoteCompositeSelectionInput[];
1340
+ dynamic_buckets: QuoteDynamicBuckets;
1341
+ ui_messages: QuoteUiMessage[];
1342
+ created_at: string;
1343
+ expires_at: string;
1344
+ next_change_at?: string;
1345
+ status: QuoteStatus;
1346
+ }
1347
+ interface RefreshQuoteResult {
1348
+ previous_quote_id: string;
1349
+ quote: PriceQuote;
1350
+ }
1351
+ declare class CatalogueQueries {
1352
+ private client;
1353
+ constructor(client: CimplifyClient);
1354
+ getProducts(options?: GetProductsOptions): Promise<Result<Product[], CimplifyError>>;
1355
+ getProduct(id: string): Promise<Result<ProductWithDetails, CimplifyError>>;
1356
+ getProductBySlug(slug: string): Promise<Result<ProductWithDetails, CimplifyError>>;
1357
+ getVariants(productId: string): Promise<Result<ProductVariant[], CimplifyError>>;
1358
+ getVariantAxes(productId: string): Promise<Result<VariantAxis[], CimplifyError>>;
1359
+ /**
1360
+ * Find a variant by axis selections (e.g., { "Size": "Large", "Color": "Red" })
1361
+ * Returns the matching variant or null if no match found.
1362
+ */
1363
+ getVariantByAxisSelections(productId: string, selections: VariantAxisSelection): Promise<Result<ProductVariant | null, CimplifyError>>;
1364
+ /**
1365
+ * Get a specific variant by its ID
1366
+ */
1367
+ getVariantById(productId: string, variantId: string): Promise<Result<ProductVariant, CimplifyError>>;
1368
+ getAddOns(productId: string): Promise<Result<AddOn[], CimplifyError>>;
1369
+ getCategories(): Promise<Result<Category[], CimplifyError>>;
1370
+ getCategory(id: string): Promise<Result<Category, CimplifyError>>;
1371
+ getCategoryBySlug(slug: string): Promise<Result<Category, CimplifyError>>;
1372
+ getCategoryProducts(categoryId: string): Promise<Result<Product[], CimplifyError>>;
1373
+ getCollections(): Promise<Result<Collection[], CimplifyError>>;
1374
+ getCollection(id: string): Promise<Result<Collection, CimplifyError>>;
1375
+ getCollectionBySlug(slug: string): Promise<Result<Collection, CimplifyError>>;
1376
+ getCollectionProducts(collectionId: string): Promise<Result<Product[], CimplifyError>>;
1377
+ searchCollections(query: string, limit?: number): Promise<Result<Collection[], CimplifyError>>;
1378
+ getBundles(): Promise<Result<Bundle[], CimplifyError>>;
1379
+ getBundle(id: string): Promise<Result<BundleWithDetails, CimplifyError>>;
1380
+ getBundleBySlug(slug: string): Promise<Result<BundleWithDetails, CimplifyError>>;
1381
+ searchBundles(query: string, limit?: number): Promise<Result<Bundle[], CimplifyError>>;
1382
+ getComposites(options?: {
1383
+ limit?: number;
1384
+ }): Promise<Result<Composite[], CimplifyError>>;
1385
+ getComposite(id: string): Promise<Result<CompositeWithDetails, CimplifyError>>;
1386
+ getCompositeByProductId(productId: string): Promise<Result<CompositeWithDetails, CimplifyError>>;
1387
+ calculateCompositePrice(compositeId: string, selections: ComponentSelectionInput[], locationId?: string): Promise<Result<CompositePriceResult, CimplifyError>>;
1388
+ fetchQuote(input: FetchQuoteInput): Promise<Result<PriceQuote, CimplifyError>>;
1389
+ getQuote(quoteId: string): Promise<Result<PriceQuote, CimplifyError>>;
1390
+ refreshQuote(input: RefreshQuoteInput): Promise<Result<RefreshQuoteResult, CimplifyError>>;
1391
+ search(query: string, options?: SearchOptions): Promise<Result<Product[], CimplifyError>>;
1392
+ searchProducts(query: string, options?: SearchOptions): Promise<Result<Product[], CimplifyError>>;
1393
+ getMenu(options?: {
1394
+ category?: string;
1395
+ limit?: number;
1396
+ }): Promise<Result<Product[], CimplifyError>>;
1397
+ getMenuCategory(categoryId: string): Promise<Result<Product[], CimplifyError>>;
1398
+ getMenuItem(itemId: string): Promise<Result<ProductWithDetails, CimplifyError>>;
1399
+ }
1400
+
1320
1401
  declare class CartOperations {
1321
1402
  private client;
1322
1403
  constructor(client: CimplifyClient);
@@ -2090,6 +2171,8 @@ interface CheckoutFormData {
2090
2171
  idempotency_key?: string;
2091
2172
  /** Optional metadata passed through to the payment provider (e.g. success_url, cancel_url) */
2092
2173
  metadata?: Record<string, unknown>;
2174
+ pay_currency?: string;
2175
+ fx_quote_id?: string;
2093
2176
  }
2094
2177
  interface CheckoutResult {
2095
2178
  order_id: string;
@@ -2103,6 +2186,14 @@ interface CheckoutResult {
2103
2186
  provider?: string;
2104
2187
  client_secret?: string;
2105
2188
  public_key?: string;
2189
+ fx?: {
2190
+ base_currency: string;
2191
+ base_amount: number;
2192
+ pay_currency: string;
2193
+ pay_amount: number;
2194
+ rate: number;
2195
+ quote_id: string;
2196
+ };
2106
2197
  }
2107
2198
 
2108
2199
  declare function generateIdempotencyKey(): string;
@@ -2893,6 +2984,38 @@ declare class LiteService {
2893
2984
  getMenuByCategory(categoryId: string): Promise<Result<Product[], CimplifyError>>;
2894
2985
  }
2895
2986
 
2987
+ interface FxQuoteRequest {
2988
+ from: string;
2989
+ to: string;
2990
+ amount: number;
2991
+ }
2992
+ interface FxQuote {
2993
+ id: string;
2994
+ base_currency: string;
2995
+ pay_currency: string;
2996
+ rate: number;
2997
+ inverse_rate: number;
2998
+ base_amount: number;
2999
+ converted_amount: number;
3000
+ quoted_at: string;
3001
+ valid_until: string;
3002
+ }
3003
+ interface FxRateResponse {
3004
+ from: string;
3005
+ to: string;
3006
+ rate: number;
3007
+ inverse_rate: number;
3008
+ quoted_at: string;
3009
+ valid_until: string;
3010
+ }
3011
+
3012
+ declare class FxService {
3013
+ private client;
3014
+ constructor(client: CimplifyClient);
3015
+ getRate(from: string, to: string): Promise<Result<FxRateResponse, CimplifyError>>;
3016
+ lockQuote(request: FxQuoteRequest): Promise<Result<FxQuote, CimplifyError>>;
3017
+ }
3018
+
2896
3019
  declare const ELEMENT_TYPES: {
2897
3020
  readonly AUTH: "auth";
2898
3021
  readonly ADDRESS: "address";
@@ -3122,6 +3245,7 @@ declare class CimplifyClient {
3122
3245
  private _inventory?;
3123
3246
  private _scheduling?;
3124
3247
  private _lite?;
3248
+ private _fx?;
3125
3249
  constructor(config?: CimplifyConfig);
3126
3250
  /** @deprecated Use getAccessToken() instead */
3127
3251
  getSessionToken(): string | null;
@@ -3160,6 +3284,7 @@ declare class CimplifyClient {
3160
3284
  get inventory(): InventoryService;
3161
3285
  get scheduling(): SchedulingService;
3162
3286
  get lite(): LiteService;
3287
+ get fx(): FxService;
3163
3288
  /**
3164
3289
  * Create a CimplifyElements instance for embedding checkout components.
3165
3290
  * Like Stripe's stripe.elements().
@@ -3197,4 +3322,4 @@ interface AdContextValue {
3197
3322
  isLoading: boolean;
3198
3323
  }
3199
3324
 
3200
- export { PICKUP_TIME_TYPE as $, type ApiError as A, BusinessService as B, CimplifyClient as C, type CheckoutOrderType as D, EVENT_TYPES as E, type CheckoutPaymentMethod as F, type GetProductsOptions as G, type CheckoutStep as H, InventoryService as I, type CheckoutFormData as J, type KitchenOrderItem as K, LinkService as L, MESSAGE_TYPES as M, type CheckoutResult as N, OrderQueries as O, type PaymentErrorDetails as P, type MobileMoneyProvider as Q, type DeviceType as R, type SearchOptions as S, type TableInfo as T, type UpdateProfileInput as U, type ContactType as V, CHECKOUT_MODE as W, ORDER_TYPE as X, PAYMENT_METHOD as Y, CHECKOUT_STEP as Z, PAYMENT_STATE as _, type PaymentResponse as a, type CollectionProduct as a$, MOBILE_MONEY_PROVIDER as a0, AUTHORIZATION_TYPE as a1, DEVICE_TYPE as a2, CONTACT_TYPE as a3, LINK_QUERY as a4, LINK_MUTATION as a5, AUTH_MUTATION as a6, CHECKOUT_MUTATION as a7, PAYMENT_MUTATION as a8, ORDER_MUTATION as a9, combine as aA, combineObject as aB, type ProductType as aC, type InventoryType as aD, type VariantStrategy as aE, type DigitalProductType as aF, type DepositType as aG, type SalesChannel as aH, type Product as aI, type ProductWithDetails as aJ, type ProductVariant as aK, type VariantDisplayAttribute as aL, type VariantAxis as aM, type VariantAxisWithValues as aN, type VariantAxisValue as aO, type ProductVariantValue as aP, type VariantLocationAvailability as aQ, type VariantAxisSelection as aR, type AddOn as aS, type AddOnWithOptions as aT, type AddOnOption as aU, type AddOnOptionPrice as aV, type ProductAddOn as aW, type Category as aX, type CategorySummary as aY, type Collection as aZ, type CollectionSummary as a_, DEFAULT_CURRENCY as aa, DEFAULT_COUNTRY as ab, type Money as ac, type Currency as ad, type PaginationParams as ae, type Pagination as af, ErrorCode as ag, type ErrorCodeType as ah, CimplifyError as ai, isCimplifyError as aj, isRetryableError as ak, type Result as al, type Ok as am, type Err as an, ok as ao, err as ap, isOk as aq, isErr as ar, mapResult as as, mapError as at, flatMap as au, getOrElse as av, unwrap as aw, toNullable as ax, fromPromise as ay, tryCatch as az, type PaymentStatusResponse as b, type AddToCartInput as b$, type BundlePriceType as b0, type Bundle as b1, type BundleSummary as b2, type BundleProduct as b3, type BundleWithDetails as b4, type BundleComponentData as b5, type BundleComponentInfo as b6, type CompositePricingMode as b7, type GroupPricingBehavior as b8, type ComponentSourceType as b9, type SelectedAddOnOption as bA, type AddOnDetails as bB, type CartAddOn as bC, type VariantDetails as bD, type BundleSelectionInput as bE, type BundleStoredSelection as bF, type BundleSelectionData as bG, type CompositeStoredSelection as bH, type CompositePriceBreakdown as bI, type CompositeSelectionData as bJ, type LineConfiguration as bK, type Cart as bL, type CartItem as bM, type CartTotals as bN, type DisplayCart as bO, type DisplayCartItem as bP, type DisplayAddOn as bQ, type DisplayAddOnOption as bR, type UICartBusiness as bS, type UICartLocation as bT, type UICartCustomer as bU, type UICartPricing as bV, type AddOnOptionDetails as bW, type AddOnGroupDetails as bX, type VariantDetailsDTO as bY, type CartItemDetails as bZ, type UICart as b_, type Composite as ba, type CompositeWithDetails as bb, type ComponentGroup as bc, type ComponentGroupWithComponents as bd, type CompositeComponent as be, type ComponentSelectionInput as bf, type CompositePriceResult as bg, type ComponentPriceBreakdown as bh, type PriceEntryType as bi, type Price as bj, type LocationProductPrice as bk, type ProductAvailability as bl, type ProductTimeProfile as bm, type CartStatus as bn, type CartChannel as bo, type PriceSource as bp, type AdjustmentType as bq, type PriceAdjustment as br, type TaxPathComponent as bs, type PricePathTaxInfo as bt, type PriceDecisionPath as bu, type ChosenPrice as bv, type BenefitType as bw, type AppliedDiscount as bx, type DiscountBreakdown as by, type DiscountDetails as bz, createCimplifyClient as c, type LocationTimeProfile as c$, type UpdateCartItemInput as c0, type CartSummary as c1, type OrderStatus as c2, type PaymentState as c3, type OrderChannel as c4, type LineType as c5, type OrderLineState as c6, type OrderLineStatus as c7, type FulfillmentType as c8, type FulfillmentStatus as c9, type ServiceNotes as cA, type PricingOverrides as cB, type SchedulingMetadata as cC, type StaffAssignment as cD, type ResourceAssignment as cE, type SchedulingResult as cF, type DepositResult as cG, type ServiceScheduleRequest as cH, type StaffScheduleItem as cI, type LocationAppointment as cJ, type PaymentStatus as cK, type PaymentProvider as cL, type PaymentMethodType as cM, type AuthorizationType as cN, type PaymentProcessingState as cO, type PaymentMethod as cP, type Payment as cQ, type InitializePaymentResult as cR, type SubmitAuthorizationInput as cS, type BusinessType as cT, type BusinessPreferences as cU, type Business as cV, type LocationTaxBehavior as cW, type LocationTaxOverrides as cX, type Location as cY, type TimeRange as cZ, type TimeRanges as c_, type FulfillmentLink as ca, type OrderFulfillmentSummary as cb, type FeeBearerType as cc, type AmountToPay as cd, type LineItem as ce, type Order as cf, type OrderHistory as cg, type OrderGroupPaymentState as ch, type OrderGroup as ci, type OrderGroupPayment as cj, type OrderSplitDetail as ck, type OrderGroupPaymentSummary as cl, type OrderGroupDetails as cm, type OrderPaymentEvent as cn, type OrderFilter as co, type CheckoutInput as cp, type UpdateOrderStatusInput as cq, type CancelOrderInput as cr, type RefundOrderInput as cs, type ServiceStatus as ct, type StaffRole as cu, type ReminderMethod as cv, type CustomerServicePreferences as cw, type BufferTimes as cx, type ReminderSettings as cy, type CancellationPolicy as cz, type CimplifyConfig as d, type RequestOtpInput as d$, type Table as d0, type Room as d1, type ServiceCharge as d2, type StorefrontBootstrap as d3, type BusinessWithLocations as d4, type LocationWithDetails as d5, type BusinessSettings as d6, type BusinessHours as d7, type CategoryInfo as d8, type ServiceAvailabilityRule as d9, type StockStatus as dA, type Stock as dB, type StockLevel as dC, type ProductStock as dD, type VariantStock as dE, type LocationStock as dF, type AvailabilityCheck as dG, type AvailabilityResult as dH, type InventorySummary as dI, type Customer as dJ, type CustomerAddress as dK, type CustomerMobileMoney as dL, type CustomerLinkPreferences as dM, type LinkData as dN, type CreateAddressInput as dO, type UpdateAddressInput as dP, type CreateMobileMoneyInput as dQ, type EnrollmentData as dR, type AddressData as dS, type MobileMoneyData as dT, type EnrollAndLinkOrderInput as dU, type LinkStatusResult as dV, type LinkEnrollResult as dW, type EnrollAndLinkOrderResult as dX, type LinkSession as dY, type RevokeSessionResult as dZ, type RevokeAllSessionsResult as d_, type ServiceAvailabilityException as da, type StaffAvailabilityRule as db, type StaffAvailabilityException as dc, type ResourceAvailabilityRule as dd, type ResourceAvailabilityException as de, type StaffBookingProfile as df, type ServiceStaffRequirement as dg, type BookingRequirementOverride as dh, type ResourceType as di, type Service as dj, type ServiceWithStaff as dk, type Staff as dl, type TimeSlot as dm, type AvailableSlot as dn, type DayAvailability as dp, type BookingStatus as dq, type Booking as dr, type BookingWithDetails as ds, type GetAvailableSlotsInput as dt, type CheckSlotAvailabilityInput as du, type RescheduleBookingInput as dv, type CancelBookingInput as dw, type ServiceAvailabilityParams as dx, type ServiceAvailabilityResult as dy, type StockOwnershipType as dz, CatalogueQueries as e, type VerifyOtpInput as e0, type AuthResponse as e1, type PickupTimeType as e2, type PickupTime as e3, type CheckoutAddressInfo as e4, type MobileMoneyDetails as e5, type CheckoutCustomerInfo as e6, type RequestContext as e7, type RequestStartEvent as e8, type RequestSuccessEvent as e9, type RequestErrorEvent as ea, type RetryEvent as eb, type SessionChangeEvent as ec, type ObservabilityHooks as ed, type ElementAppearance as ee, type AddressInfo as ef, type PaymentMethodInfo as eg, type AuthenticatedData as eh, type ElementsCheckoutData as ei, type ElementsCheckoutResult as ej, type ParentToIframeMessage as ek, type IframeToParentMessage as el, type ElementEventHandler as em, type AdSlot as en, type AdPosition as eo, type AdTheme as ep, type AdConfig as eq, type AdCreative as er, type AdContextValue as es, CartOperations as f, CheckoutService as g, generateIdempotencyKey as h, type GetOrdersOptions as i, AuthService as j, type AuthStatus as k, type OtpResult as l, type ChangePasswordInput as m, SchedulingService as n, LiteService as o, type LiteBootstrap as p, type KitchenOrderResult as q, CimplifyElements as r, CimplifyElement as s, createElements as t, ELEMENT_TYPES as u, type ElementsOptions as v, type ElementOptions as w, type ElementType as x, type ElementEventType as y, type CheckoutMode as z };
3325
+ export { type CheckoutFormData as $, type ApiError as A, BusinessService as B, CimplifyClient as C, createElements as D, EVENT_TYPES as E, type FetchQuoteInput as F, type GetProductsOptions as G, ELEMENT_TYPES as H, InventoryService as I, type ElementsOptions as J, type KitchenOrderItem as K, LinkService as L, MESSAGE_TYPES as M, type ElementOptions as N, OrderQueries as O, type PaymentErrorDetails as P, type QuoteCompositeSelectionInput as Q, type RefreshQuoteInput as R, type SearchOptions as S, type TableInfo as T, type UpdateProfileInput as U, type ElementType as V, type ElementEventType as W, type CheckoutMode as X, type CheckoutOrderType as Y, type CheckoutPaymentMethod as Z, type CheckoutStep as _, type PaymentResponse as a, type VariantAxisSelection as a$, type CheckoutResult as a0, type MobileMoneyProvider as a1, type DeviceType as a2, type ContactType as a3, CHECKOUT_MODE as a4, ORDER_TYPE as a5, PAYMENT_METHOD as a6, CHECKOUT_STEP as a7, PAYMENT_STATE as a8, PICKUP_TIME_TYPE as a9, isOk as aA, isErr as aB, mapResult as aC, mapError as aD, flatMap as aE, getOrElse as aF, unwrap as aG, toNullable as aH, fromPromise as aI, tryCatch as aJ, combine as aK, combineObject as aL, type ProductType as aM, type InventoryType as aN, type VariantStrategy as aO, type DigitalProductType as aP, type DepositType as aQ, type SalesChannel as aR, type Product as aS, type ProductWithDetails as aT, type ProductVariant as aU, type VariantDisplayAttribute as aV, type VariantAxis as aW, type VariantAxisWithValues as aX, type VariantAxisValue as aY, type ProductVariantValue as aZ, type VariantLocationAvailability as a_, MOBILE_MONEY_PROVIDER as aa, AUTHORIZATION_TYPE as ab, DEVICE_TYPE as ac, CONTACT_TYPE as ad, LINK_QUERY as ae, LINK_MUTATION as af, AUTH_MUTATION as ag, CHECKOUT_MUTATION as ah, PAYMENT_MUTATION as ai, ORDER_MUTATION as aj, DEFAULT_CURRENCY as ak, DEFAULT_COUNTRY as al, type Money as am, type Currency as an, type PaginationParams as ao, type Pagination as ap, ErrorCode as aq, type ErrorCodeType as ar, CimplifyError as as, isCimplifyError as at, isRetryableError as au, type Result as av, type Ok as aw, type Err as ax, ok as ay, err as az, type PaymentStatusResponse as b, type DisplayAddOnOption as b$, type AddOn as b0, type AddOnWithOptions as b1, type AddOnOption as b2, type AddOnOptionPrice as b3, type ProductAddOn as b4, type Category as b5, type CategorySummary as b6, type Collection as b7, type CollectionSummary as b8, type CollectionProduct as b9, type AdjustmentType as bA, type PriceAdjustment as bB, type TaxPathComponent as bC, type PricePathTaxInfo as bD, type PriceDecisionPath as bE, type ChosenPrice as bF, type BenefitType as bG, type AppliedDiscount as bH, type DiscountBreakdown as bI, type DiscountDetails as bJ, type SelectedAddOnOption as bK, type AddOnDetails as bL, type CartAddOn as bM, type VariantDetails as bN, type BundleSelectionInput as bO, type BundleStoredSelection as bP, type BundleSelectionData as bQ, type CompositeStoredSelection as bR, type CompositePriceBreakdown as bS, type CompositeSelectionData as bT, type LineConfiguration as bU, type Cart as bV, type CartItem as bW, type CartTotals as bX, type DisplayCart as bY, type DisplayCartItem as bZ, type DisplayAddOn as b_, type BundlePriceType as ba, type Bundle as bb, type BundleSummary as bc, type BundleProduct as bd, type BundleWithDetails as be, type BundleComponentData as bf, type BundleComponentInfo as bg, type CompositePricingMode as bh, type GroupPricingBehavior as bi, type ComponentSourceType as bj, type Composite as bk, type CompositeWithDetails as bl, type ComponentGroup as bm, type ComponentGroupWithComponents as bn, type CompositeComponent as bo, type ComponentSelectionInput as bp, type CompositePriceResult as bq, type ComponentPriceBreakdown as br, type PriceEntryType as bs, type Price as bt, type LocationProductPrice as bu, type ProductAvailability as bv, type ProductTimeProfile as bw, type CartStatus as bx, type CartChannel as by, type PriceSource as bz, createCimplifyClient as c, type Payment as c$, type UICartBusiness as c0, type UICartLocation as c1, type UICartCustomer as c2, type UICartPricing as c3, type AddOnOptionDetails as c4, type AddOnGroupDetails as c5, type VariantDetailsDTO as c6, type CartItemDetails as c7, type UICart as c8, type UICartResponse as c9, type CheckoutInput as cA, type UpdateOrderStatusInput as cB, type CancelOrderInput as cC, type RefundOrderInput as cD, type ServiceStatus as cE, type StaffRole as cF, type ReminderMethod as cG, type CustomerServicePreferences as cH, type BufferTimes as cI, type ReminderSettings as cJ, type CancellationPolicy as cK, type ServiceNotes as cL, type PricingOverrides as cM, type SchedulingMetadata as cN, type StaffAssignment as cO, type ResourceAssignment as cP, type SchedulingResult as cQ, type DepositResult as cR, type ServiceScheduleRequest as cS, type StaffScheduleItem as cT, type LocationAppointment as cU, type PaymentStatus as cV, type PaymentProvider as cW, type PaymentMethodType as cX, type AuthorizationType as cY, type PaymentProcessingState as cZ, type PaymentMethod as c_, type AddToCartInput as ca, type UpdateCartItemInput as cb, type CartSummary as cc, type OrderStatus as cd, type PaymentState as ce, type OrderChannel as cf, type LineType as cg, type OrderLineState as ch, type OrderLineStatus as ci, type FulfillmentType as cj, type FulfillmentStatus as ck, type FulfillmentLink as cl, type OrderFulfillmentSummary as cm, type FeeBearerType as cn, type AmountToPay as co, type LineItem as cp, type Order as cq, type OrderHistory as cr, type OrderGroupPaymentState as cs, type OrderGroup as ct, type OrderGroupPayment as cu, type OrderSplitDetail as cv, type OrderGroupPaymentSummary as cw, type OrderGroupDetails as cx, type OrderPaymentEvent as cy, type OrderFilter as cz, type CimplifyConfig as d, type CreateMobileMoneyInput as d$, type InitializePaymentResult as d0, type SubmitAuthorizationInput as d1, type BusinessType as d2, type BusinessPreferences as d3, type Business as d4, type LocationTaxBehavior as d5, type LocationTaxOverrides as d6, type Location as d7, type TimeRange as d8, type TimeRanges as d9, type DayAvailability as dA, type BookingStatus as dB, type Booking as dC, type BookingWithDetails as dD, type GetAvailableSlotsInput as dE, type CheckSlotAvailabilityInput as dF, type RescheduleBookingInput as dG, type CancelBookingInput as dH, type ServiceAvailabilityParams as dI, type ServiceAvailabilityResult as dJ, type StockOwnershipType as dK, type StockStatus as dL, type Stock as dM, type StockLevel as dN, type ProductStock as dO, type VariantStock as dP, type LocationStock as dQ, type AvailabilityCheck as dR, type AvailabilityResult as dS, type InventorySummary as dT, type Customer as dU, type CustomerAddress as dV, type CustomerMobileMoney as dW, type CustomerLinkPreferences as dX, type LinkData as dY, type CreateAddressInput as dZ, type UpdateAddressInput as d_, type LocationTimeProfile as da, type Table as db, type Room as dc, type ServiceCharge as dd, type StorefrontBootstrap as de, type BusinessWithLocations as df, type LocationWithDetails as dg, type BusinessSettings as dh, type BusinessHours as di, type CategoryInfo as dj, type ServiceAvailabilityRule as dk, type ServiceAvailabilityException as dl, type StaffAvailabilityRule as dm, type StaffAvailabilityException as dn, type ResourceAvailabilityRule as dp, type ResourceAvailabilityException as dq, type StaffBookingProfile as dr, type ServiceStaffRequirement as ds, type BookingRequirementOverride as dt, type ResourceType as du, type Service as dv, type ServiceWithStaff as dw, type Staff as dx, type TimeSlot as dy, type AvailableSlot as dz, CatalogueQueries as e, type EnrollmentData as e0, type AddressData as e1, type MobileMoneyData as e2, type EnrollAndLinkOrderInput as e3, type LinkStatusResult as e4, type LinkEnrollResult as e5, type EnrollAndLinkOrderResult as e6, type LinkSession as e7, type RevokeSessionResult as e8, type RevokeAllSessionsResult as e9, type ElementEventHandler as eA, type AdSlot as eB, type AdPosition as eC, type AdTheme as eD, type AdConfig as eE, type AdCreative as eF, type AdContextValue as eG, type RequestOtpInput as ea, type VerifyOtpInput as eb, type AuthResponse as ec, type PickupTimeType as ed, type PickupTime as ee, type CheckoutAddressInfo as ef, type MobileMoneyDetails as eg, type CheckoutCustomerInfo as eh, type FxQuoteRequest as ei, type FxQuote as ej, type FxRateResponse as ek, type RequestContext as el, type RequestStartEvent as em, type RequestSuccessEvent as en, type RequestErrorEvent as eo, type RetryEvent as ep, type SessionChangeEvent as eq, type ObservabilityHooks as er, type ElementAppearance as es, type AddressInfo as et, type PaymentMethodInfo as eu, type AuthenticatedData as ev, type ElementsCheckoutData as ew, type ElementsCheckoutResult as ex, type ParentToIframeMessage as ey, type IframeToParentMessage as ez, type QuoteBundleSelectionInput as f, type QuoteStatus as g, type QuoteDynamicBuckets as h, type QuoteUiMessage as i, type PriceQuote as j, type RefreshQuoteResult as k, CartOperations as l, CheckoutService as m, generateIdempotencyKey as n, type GetOrdersOptions as o, AuthService as p, type AuthStatus as q, type OtpResult as r, type ChangePasswordInput as s, SchedulingService as t, LiteService as u, FxService as v, type LiteBootstrap as w, type KitchenOrderResult as x, CimplifyElements as y, CimplifyElement as z };