@51eat/sdk 0.0.51 → 0.0.53

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.
Files changed (140) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/Client.d.ts +3 -0
  3. package/dist/cjs/Client.js +17 -12
  4. package/dist/cjs/api/resources/business/resources/productOrders/client/Client.d.ts +33 -0
  5. package/dist/cjs/api/resources/business/resources/productOrders/client/Client.js +123 -0
  6. package/dist/cjs/api/resources/business/resources/productOrders/client/requests/GetLabelRatesProductOrdersRequest.d.ts +10 -0
  7. package/dist/cjs/api/resources/business/resources/productOrders/client/requests/GetLabelRatesProductOrdersRequest.js +3 -0
  8. package/dist/cjs/api/resources/business/resources/productOrders/client/requests/PurchaseLabelRequest.d.ts +12 -0
  9. package/dist/cjs/api/resources/business/resources/productOrders/client/requests/PurchaseLabelRequest.js +3 -0
  10. package/dist/cjs/api/resources/business/resources/productOrders/client/requests/index.d.ts +2 -0
  11. package/dist/cjs/api/resources/business/resources/productOrders/types/PurchaseLabelProductOrdersResponse.d.ts +4 -0
  12. package/dist/cjs/api/resources/business/resources/productOrders/types/PurchaseLabelProductOrdersResponse.js +3 -0
  13. package/dist/cjs/api/resources/business/resources/productOrders/types/index.d.ts +1 -0
  14. package/dist/cjs/api/resources/business/resources/productOrders/types/index.js +1 -0
  15. package/dist/cjs/api/resources/businessShipping/client/Client.d.ts +138 -0
  16. package/dist/cjs/api/resources/businessShipping/client/Client.js +566 -0
  17. package/dist/cjs/api/resources/businessShipping/client/index.d.ts +1 -0
  18. package/dist/cjs/api/resources/businessShipping/client/index.js +17 -0
  19. package/dist/cjs/api/resources/businessShipping/client/requests/DeleteBusinessShippingRateRequest.d.ts +10 -0
  20. package/dist/cjs/api/resources/businessShipping/client/requests/DeleteBusinessShippingRateRequest.js +3 -0
  21. package/dist/cjs/api/resources/businessShipping/client/requests/SetupShippingAccountRequest.d.ts +12 -0
  22. package/dist/cjs/api/resources/businessShipping/client/requests/SetupShippingAccountRequest.js +3 -0
  23. package/dist/cjs/api/resources/businessShipping/client/requests/StoreShippingRateRequest.d.ts +23 -0
  24. package/dist/cjs/api/resources/businessShipping/client/requests/StoreShippingRateRequest.js +11 -0
  25. package/dist/cjs/api/resources/businessShipping/client/requests/UpdateShippingAccountRequest.d.ts +9 -0
  26. package/dist/cjs/api/resources/businessShipping/client/requests/UpdateShippingAccountRequest.js +3 -0
  27. package/dist/cjs/api/resources/businessShipping/client/requests/UpdateShippingRateRequest.d.ts +26 -0
  28. package/dist/cjs/api/resources/businessShipping/client/requests/UpdateShippingRateRequest.js +11 -0
  29. package/dist/cjs/api/resources/businessShipping/client/requests/index.d.ts +5 -0
  30. package/dist/cjs/api/resources/businessShipping/client/requests/index.js +7 -0
  31. package/dist/cjs/api/resources/businessShipping/exports.d.ts +2 -0
  32. package/dist/cjs/api/resources/businessShipping/exports.js +21 -0
  33. package/dist/cjs/api/resources/businessShipping/index.d.ts +2 -0
  34. package/dist/cjs/api/resources/businessShipping/index.js +18 -0
  35. package/dist/cjs/api/resources/businessShipping/types/CreateBusinessShippingRateResponse.d.ts +4 -0
  36. package/dist/cjs/api/resources/businessShipping/types/CreateBusinessShippingRateResponse.js +3 -0
  37. package/dist/cjs/api/resources/businessShipping/types/GetBusinessShippingAccountResponse.d.ts +6 -0
  38. package/dist/cjs/api/resources/businessShipping/types/GetBusinessShippingAccountResponse.js +3 -0
  39. package/dist/cjs/api/resources/businessShipping/types/GetBusinessShippingSetupIntentResponse.d.ts +3 -0
  40. package/dist/cjs/api/resources/businessShipping/types/GetBusinessShippingSetupIntentResponse.js +3 -0
  41. package/dist/cjs/api/resources/businessShipping/types/ListBusinessShippingRatesResponse.d.ts +4 -0
  42. package/dist/cjs/api/resources/businessShipping/types/ListBusinessShippingRatesResponse.js +3 -0
  43. package/dist/cjs/api/resources/businessShipping/types/UpdateBusinessShippingAccountResponse.d.ts +4 -0
  44. package/dist/cjs/api/resources/businessShipping/types/UpdateBusinessShippingAccountResponse.js +3 -0
  45. package/dist/cjs/api/resources/businessShipping/types/UpdateBusinessShippingRateResponse.d.ts +4 -0
  46. package/dist/cjs/api/resources/businessShipping/types/UpdateBusinessShippingRateResponse.js +3 -0
  47. package/dist/cjs/api/resources/businessShipping/types/index.d.ts +6 -0
  48. package/dist/cjs/api/resources/businessShipping/types/index.js +22 -0
  49. package/dist/cjs/api/resources/customer/resources/cart/client/Client.d.ts +44 -0
  50. package/dist/cjs/api/resources/customer/resources/cart/client/Client.js +131 -0
  51. package/dist/cjs/api/resources/customer/resources/cart/client/requests/GetShippingOptionsRequest.d.ts +28 -0
  52. package/dist/cjs/api/resources/customer/resources/cart/client/requests/GetShippingOptionsRequest.js +3 -0
  53. package/dist/cjs/api/resources/customer/resources/cart/client/requests/SelectShippingOptionRequest.d.ts +12 -0
  54. package/dist/cjs/api/resources/customer/resources/cart/client/requests/SelectShippingOptionRequest.js +3 -0
  55. package/dist/cjs/api/resources/customer/resources/cart/client/requests/index.d.ts +2 -0
  56. package/dist/cjs/api/resources/customer/resources/cart/types/SelectShippingOptionCartResponse.d.ts +11 -0
  57. package/dist/cjs/api/resources/customer/resources/cart/types/SelectShippingOptionCartResponse.js +3 -0
  58. package/dist/cjs/api/resources/customer/resources/cart/types/index.d.ts +1 -0
  59. package/dist/cjs/api/resources/customer/resources/cart/types/index.js +1 -0
  60. package/dist/cjs/api/resources/index.d.ts +3 -0
  61. package/dist/cjs/api/resources/index.js +4 -1
  62. package/dist/cjs/api/types/ShippingAccountResource.d.ts +10 -0
  63. package/dist/cjs/api/types/ShippingAccountResource.js +3 -0
  64. package/dist/cjs/api/types/ShippingRateResource.d.ts +12 -0
  65. package/dist/cjs/api/types/ShippingRateResource.js +3 -0
  66. package/dist/cjs/api/types/index.d.ts +2 -0
  67. package/dist/cjs/api/types/index.js +2 -0
  68. package/dist/cjs/version.d.ts +1 -1
  69. package/dist/cjs/version.js +1 -1
  70. package/dist/esm/BaseClient.mjs +2 -2
  71. package/dist/esm/Client.d.mts +3 -0
  72. package/dist/esm/Client.mjs +5 -0
  73. package/dist/esm/api/resources/business/resources/productOrders/client/Client.d.mts +33 -0
  74. package/dist/esm/api/resources/business/resources/productOrders/client/Client.mjs +123 -0
  75. package/dist/esm/api/resources/business/resources/productOrders/client/requests/GetLabelRatesProductOrdersRequest.d.mts +10 -0
  76. package/dist/esm/api/resources/business/resources/productOrders/client/requests/GetLabelRatesProductOrdersRequest.mjs +2 -0
  77. package/dist/esm/api/resources/business/resources/productOrders/client/requests/PurchaseLabelRequest.d.mts +12 -0
  78. package/dist/esm/api/resources/business/resources/productOrders/client/requests/PurchaseLabelRequest.mjs +2 -0
  79. package/dist/esm/api/resources/business/resources/productOrders/client/requests/index.d.mts +2 -0
  80. package/dist/esm/api/resources/business/resources/productOrders/types/PurchaseLabelProductOrdersResponse.d.mts +4 -0
  81. package/dist/esm/api/resources/business/resources/productOrders/types/PurchaseLabelProductOrdersResponse.mjs +2 -0
  82. package/dist/esm/api/resources/business/resources/productOrders/types/index.d.mts +1 -0
  83. package/dist/esm/api/resources/business/resources/productOrders/types/index.mjs +1 -0
  84. package/dist/esm/api/resources/businessShipping/client/Client.d.mts +138 -0
  85. package/dist/esm/api/resources/businessShipping/client/Client.mjs +529 -0
  86. package/dist/esm/api/resources/businessShipping/client/index.d.mts +1 -0
  87. package/dist/esm/api/resources/businessShipping/client/index.mjs +1 -0
  88. package/dist/esm/api/resources/businessShipping/client/requests/DeleteBusinessShippingRateRequest.d.mts +10 -0
  89. package/dist/esm/api/resources/businessShipping/client/requests/DeleteBusinessShippingRateRequest.mjs +2 -0
  90. package/dist/esm/api/resources/businessShipping/client/requests/SetupShippingAccountRequest.d.mts +12 -0
  91. package/dist/esm/api/resources/businessShipping/client/requests/SetupShippingAccountRequest.mjs +2 -0
  92. package/dist/esm/api/resources/businessShipping/client/requests/StoreShippingRateRequest.d.mts +23 -0
  93. package/dist/esm/api/resources/businessShipping/client/requests/StoreShippingRateRequest.mjs +8 -0
  94. package/dist/esm/api/resources/businessShipping/client/requests/UpdateShippingAccountRequest.d.mts +9 -0
  95. package/dist/esm/api/resources/businessShipping/client/requests/UpdateShippingAccountRequest.mjs +2 -0
  96. package/dist/esm/api/resources/businessShipping/client/requests/UpdateShippingRateRequest.d.mts +26 -0
  97. package/dist/esm/api/resources/businessShipping/client/requests/UpdateShippingRateRequest.mjs +8 -0
  98. package/dist/esm/api/resources/businessShipping/client/requests/index.d.mts +5 -0
  99. package/dist/esm/api/resources/businessShipping/client/requests/index.mjs +2 -0
  100. package/dist/esm/api/resources/businessShipping/exports.d.mts +2 -0
  101. package/dist/esm/api/resources/businessShipping/exports.mjs +3 -0
  102. package/dist/esm/api/resources/businessShipping/index.d.mts +2 -0
  103. package/dist/esm/api/resources/businessShipping/index.mjs +2 -0
  104. package/dist/esm/api/resources/businessShipping/types/CreateBusinessShippingRateResponse.d.mts +4 -0
  105. package/dist/esm/api/resources/businessShipping/types/CreateBusinessShippingRateResponse.mjs +2 -0
  106. package/dist/esm/api/resources/businessShipping/types/GetBusinessShippingAccountResponse.d.mts +6 -0
  107. package/dist/esm/api/resources/businessShipping/types/GetBusinessShippingAccountResponse.mjs +2 -0
  108. package/dist/esm/api/resources/businessShipping/types/GetBusinessShippingSetupIntentResponse.d.mts +3 -0
  109. package/dist/esm/api/resources/businessShipping/types/GetBusinessShippingSetupIntentResponse.mjs +2 -0
  110. package/dist/esm/api/resources/businessShipping/types/ListBusinessShippingRatesResponse.d.mts +4 -0
  111. package/dist/esm/api/resources/businessShipping/types/ListBusinessShippingRatesResponse.mjs +2 -0
  112. package/dist/esm/api/resources/businessShipping/types/UpdateBusinessShippingAccountResponse.d.mts +4 -0
  113. package/dist/esm/api/resources/businessShipping/types/UpdateBusinessShippingAccountResponse.mjs +2 -0
  114. package/dist/esm/api/resources/businessShipping/types/UpdateBusinessShippingRateResponse.d.mts +4 -0
  115. package/dist/esm/api/resources/businessShipping/types/UpdateBusinessShippingRateResponse.mjs +2 -0
  116. package/dist/esm/api/resources/businessShipping/types/index.d.mts +6 -0
  117. package/dist/esm/api/resources/businessShipping/types/index.mjs +6 -0
  118. package/dist/esm/api/resources/customer/resources/cart/client/Client.d.mts +44 -0
  119. package/dist/esm/api/resources/customer/resources/cart/client/Client.mjs +131 -0
  120. package/dist/esm/api/resources/customer/resources/cart/client/requests/GetShippingOptionsRequest.d.mts +28 -0
  121. package/dist/esm/api/resources/customer/resources/cart/client/requests/GetShippingOptionsRequest.mjs +2 -0
  122. package/dist/esm/api/resources/customer/resources/cart/client/requests/SelectShippingOptionRequest.d.mts +12 -0
  123. package/dist/esm/api/resources/customer/resources/cart/client/requests/SelectShippingOptionRequest.mjs +2 -0
  124. package/dist/esm/api/resources/customer/resources/cart/client/requests/index.d.mts +2 -0
  125. package/dist/esm/api/resources/customer/resources/cart/types/SelectShippingOptionCartResponse.d.mts +11 -0
  126. package/dist/esm/api/resources/customer/resources/cart/types/SelectShippingOptionCartResponse.mjs +2 -0
  127. package/dist/esm/api/resources/customer/resources/cart/types/index.d.mts +1 -0
  128. package/dist/esm/api/resources/customer/resources/cart/types/index.mjs +1 -0
  129. package/dist/esm/api/resources/index.d.mts +3 -0
  130. package/dist/esm/api/resources/index.mjs +3 -0
  131. package/dist/esm/api/types/ShippingAccountResource.d.mts +10 -0
  132. package/dist/esm/api/types/ShippingAccountResource.mjs +2 -0
  133. package/dist/esm/api/types/ShippingRateResource.d.mts +12 -0
  134. package/dist/esm/api/types/ShippingRateResource.mjs +2 -0
  135. package/dist/esm/api/types/index.d.mts +2 -0
  136. package/dist/esm/api/types/index.mjs +2 -0
  137. package/dist/esm/version.d.mts +1 -1
  138. package/dist/esm/version.mjs +1 -1
  139. package/package.json +12 -1
  140. package/reference.md +696 -0
@@ -0,0 +1,5 @@
1
+ export type { DeleteBusinessShippingRateRequest } from "./DeleteBusinessShippingRateRequest.mjs";
2
+ export type { SetupShippingAccountRequest } from "./SetupShippingAccountRequest.mjs";
3
+ export { StoreShippingRateRequest } from "./StoreShippingRateRequest.mjs";
4
+ export type { UpdateShippingAccountRequest } from "./UpdateShippingAccountRequest.mjs";
5
+ export { UpdateShippingRateRequest } from "./UpdateShippingRateRequest.mjs";
@@ -0,0 +1,2 @@
1
+ export { StoreShippingRateRequest } from "./StoreShippingRateRequest.mjs";
2
+ export { UpdateShippingRateRequest } from "./UpdateShippingRateRequest.mjs";
@@ -0,0 +1,2 @@
1
+ export { BusinessShippingClient } from "./client/Client.mjs";
2
+ export * from "./client/index.mjs";
@@ -0,0 +1,3 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export { BusinessShippingClient } from "./client/Client.mjs";
3
+ export * from "./client/index.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.mjs";
2
+ export * from "./types/index.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.mjs";
2
+ export * from "./types/index.mjs";
@@ -0,0 +1,4 @@
1
+ import type * as FiveOneEat from "../../../index.mjs";
2
+ export interface CreateBusinessShippingRateResponse {
3
+ data: FiveOneEat.ShippingRateResource;
4
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,6 @@
1
+ import type * as FiveOneEat from "../../../index.mjs";
2
+ export type GetBusinessShippingAccountResponse = {
3
+ data: FiveOneEat.ShippingAccountResource;
4
+ } | {
5
+ data: unknown | null;
6
+ };
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,3 @@
1
+ export interface GetBusinessShippingSetupIntentResponse {
2
+ client_secret: string;
3
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,4 @@
1
+ import type * as FiveOneEat from "../../../index.mjs";
2
+ export interface ListBusinessShippingRatesResponse {
3
+ data: FiveOneEat.ShippingRateResource[];
4
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,4 @@
1
+ import type * as FiveOneEat from "../../../index.mjs";
2
+ export interface UpdateBusinessShippingAccountResponse {
3
+ data: FiveOneEat.ShippingAccountResource;
4
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,4 @@
1
+ import type * as FiveOneEat from "../../../index.mjs";
2
+ export interface UpdateBusinessShippingRateResponse {
3
+ data: FiveOneEat.ShippingRateResource;
4
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,6 @@
1
+ export * from "./CreateBusinessShippingRateResponse.mjs";
2
+ export * from "./GetBusinessShippingAccountResponse.mjs";
3
+ export * from "./GetBusinessShippingSetupIntentResponse.mjs";
4
+ export * from "./ListBusinessShippingRatesResponse.mjs";
5
+ export * from "./UpdateBusinessShippingAccountResponse.mjs";
6
+ export * from "./UpdateBusinessShippingRateResponse.mjs";
@@ -0,0 +1,6 @@
1
+ export * from "./CreateBusinessShippingRateResponse.mjs";
2
+ export * from "./GetBusinessShippingAccountResponse.mjs";
3
+ export * from "./GetBusinessShippingSetupIntentResponse.mjs";
4
+ export * from "./ListBusinessShippingRatesResponse.mjs";
5
+ export * from "./UpdateBusinessShippingAccountResponse.mjs";
6
+ export * from "./UpdateBusinessShippingRateResponse.mjs";
@@ -132,4 +132,48 @@ export declare class CartClient {
132
132
  */
133
133
  removeItem(request: FiveOneEat.customer.RemoveItemCartRequest, requestOptions?: CartClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.RemoveItemCartResponse>;
134
134
  private __removeItem;
135
+ /**
136
+ * Returns flat/free rates and live carrier rates (if enabled) for the given address.
137
+ * Free-shipping thresholds are applied automatically — qualifying rates show as $0.
138
+ * Cache live rates for 10 minutes per address/cart combination.
139
+ * Pass `shipping_rate_id` for flat/free options, or `provider_rate_id` for live rates.
140
+ *
141
+ * @param {FiveOneEat.customer.GetShippingOptionsRequest} request
142
+ * @param {CartClient.RequestOptions} requestOptions - Request-specific configuration.
143
+ *
144
+ * @throws {@link FiveOneEat.UnauthorizedError}
145
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
146
+ *
147
+ * @example
148
+ * await client.customer.cart.getShippingOptions({
149
+ * business: "katzs-deli",
150
+ * shipping_address: {
151
+ * line1: "line1",
152
+ * city: "city",
153
+ * state: "state",
154
+ * postal_code: "postal_code"
155
+ * }
156
+ * })
157
+ */
158
+ getShippingOptions(request: FiveOneEat.customer.GetShippingOptionsRequest, requestOptions?: CartClient.RequestOptions): core.HttpResponsePromise<unknown[]>;
159
+ private __getShippingOptions;
160
+ /**
161
+ * Pass either `shipping_rate_id` (for flat/free rates) or `provider_rate_id`
162
+ * (for live carrier rates). Never both. Amounts are resolved server-side —
163
+ * the client never submits a price.
164
+ *
165
+ * @param {FiveOneEat.customer.SelectShippingOptionRequest} request
166
+ * @param {CartClient.RequestOptions} requestOptions - Request-specific configuration.
167
+ *
168
+ * @throws {@link FiveOneEat.UnauthorizedError}
169
+ * @throws {@link FiveOneEat.NotFoundError}
170
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
171
+ *
172
+ * @example
173
+ * await client.customer.cart.selectShippingOption({
174
+ * business: "katzs-deli"
175
+ * })
176
+ */
177
+ selectShippingOption(request: FiveOneEat.customer.SelectShippingOptionRequest, requestOptions?: CartClient.RequestOptions): core.HttpResponsePromise<FiveOneEat.customer.SelectShippingOptionCartResponse>;
178
+ private __selectShippingOption;
135
179
  }
@@ -450,4 +450,135 @@ export class CartClient {
450
450
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/customer/cart/items/{cartItem}");
451
451
  });
452
452
  }
453
+ /**
454
+ * Returns flat/free rates and live carrier rates (if enabled) for the given address.
455
+ * Free-shipping thresholds are applied automatically — qualifying rates show as $0.
456
+ * Cache live rates for 10 minutes per address/cart combination.
457
+ * Pass `shipping_rate_id` for flat/free options, or `provider_rate_id` for live rates.
458
+ *
459
+ * @param {FiveOneEat.customer.GetShippingOptionsRequest} request
460
+ * @param {CartClient.RequestOptions} requestOptions - Request-specific configuration.
461
+ *
462
+ * @throws {@link FiveOneEat.UnauthorizedError}
463
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
464
+ *
465
+ * @example
466
+ * await client.customer.cart.getShippingOptions({
467
+ * business: "katzs-deli",
468
+ * shipping_address: {
469
+ * line1: "line1",
470
+ * city: "city",
471
+ * state: "state",
472
+ * postal_code: "postal_code"
473
+ * }
474
+ * })
475
+ */
476
+ getShippingOptions(request, requestOptions) {
477
+ return core.HttpResponsePromise.fromPromise(this.__getShippingOptions(request, requestOptions));
478
+ }
479
+ __getShippingOptions(request, requestOptions) {
480
+ return __awaiter(this, void 0, void 0, function* () {
481
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
482
+ const { business } = request, _body = __rest(request, ["business"]);
483
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
484
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
485
+ const _response = yield core.fetcher({
486
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, `customer/businesses/${core.url.encodePathParam(business)}/cart/shipping-options`),
487
+ method: "POST",
488
+ headers: _headers,
489
+ contentType: "application/json",
490
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
491
+ requestType: "json",
492
+ body: _body,
493
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
494
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
495
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
496
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
497
+ logging: this._options.logging,
498
+ });
499
+ if (_response.ok) {
500
+ return { data: _response.body, rawResponse: _response.rawResponse };
501
+ }
502
+ if (_response.error.reason === "status-code") {
503
+ switch (_response.error.statusCode) {
504
+ case 401:
505
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
506
+ case 422:
507
+ throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
508
+ default:
509
+ throw new errors.FiveOneEatError({
510
+ statusCode: _response.error.statusCode,
511
+ body: _response.error.body,
512
+ rawResponse: _response.rawResponse,
513
+ });
514
+ }
515
+ }
516
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/customer/businesses/{business}/cart/shipping-options");
517
+ });
518
+ }
519
+ /**
520
+ * Pass either `shipping_rate_id` (for flat/free rates) or `provider_rate_id`
521
+ * (for live carrier rates). Never both. Amounts are resolved server-side —
522
+ * the client never submits a price.
523
+ *
524
+ * @param {FiveOneEat.customer.SelectShippingOptionRequest} request
525
+ * @param {CartClient.RequestOptions} requestOptions - Request-specific configuration.
526
+ *
527
+ * @throws {@link FiveOneEat.UnauthorizedError}
528
+ * @throws {@link FiveOneEat.NotFoundError}
529
+ * @throws {@link FiveOneEat.UnprocessableEntityError}
530
+ *
531
+ * @example
532
+ * await client.customer.cart.selectShippingOption({
533
+ * business: "katzs-deli"
534
+ * })
535
+ */
536
+ selectShippingOption(request, requestOptions) {
537
+ return core.HttpResponsePromise.fromPromise(this.__selectShippingOption(request, requestOptions));
538
+ }
539
+ __selectShippingOption(request, requestOptions) {
540
+ return __awaiter(this, void 0, void 0, function* () {
541
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
542
+ const { business } = request, _body = __rest(request, ["business"]);
543
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
544
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
545
+ const _response = yield core.fetcher({
546
+ url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.FiveOneEatEnvironment.Production, `customer/businesses/${core.url.encodePathParam(business)}/cart/shipping-option`),
547
+ method: "POST",
548
+ headers: _headers,
549
+ contentType: "application/json",
550
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
551
+ requestType: "json",
552
+ body: _body,
553
+ timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
554
+ maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
555
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
556
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
557
+ logging: this._options.logging,
558
+ });
559
+ if (_response.ok) {
560
+ return {
561
+ data: _response.body,
562
+ rawResponse: _response.rawResponse,
563
+ };
564
+ }
565
+ if (_response.error.reason === "status-code") {
566
+ switch (_response.error.statusCode) {
567
+ case 401:
568
+ throw new FiveOneEat.UnauthorizedError(_response.error.body, _response.rawResponse);
569
+ case 404:
570
+ throw new FiveOneEat.NotFoundError(_response.error.body, _response.rawResponse);
571
+ case 422:
572
+ throw new FiveOneEat.UnprocessableEntityError(_response.error.body, _response.rawResponse);
573
+ default:
574
+ throw new errors.FiveOneEatError({
575
+ statusCode: _response.error.statusCode,
576
+ body: _response.error.body,
577
+ rawResponse: _response.rawResponse,
578
+ });
579
+ }
580
+ }
581
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/customer/businesses/{business}/cart/shipping-option");
582
+ });
583
+ }
453
584
  }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * business: "katzs-deli",
5
+ * shipping_address: {
6
+ * line1: "line1",
7
+ * city: "city",
8
+ * state: "state",
9
+ * postal_code: "postal_code"
10
+ * }
11
+ * }
12
+ */
13
+ export interface GetShippingOptionsRequest {
14
+ /** The business handle */
15
+ business: string;
16
+ shipping_address: GetShippingOptionsRequest.ShippingAddress;
17
+ }
18
+ export declare namespace GetShippingOptionsRequest {
19
+ interface ShippingAddress {
20
+ name?: (string | null) | undefined;
21
+ line1: string;
22
+ line2?: (string | null) | undefined;
23
+ city: string;
24
+ state: string;
25
+ postal_code: string;
26
+ country?: (string | null) | undefined;
27
+ }
28
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * business: "katzs-deli"
5
+ * }
6
+ */
7
+ export interface SelectShippingOptionRequest {
8
+ /** The business handle */
9
+ business: string;
10
+ shipping_rate_id?: string | null;
11
+ provider_rate_id?: string | null;
12
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -3,5 +3,7 @@ export { CheckoutRequest } from "./CheckoutRequest.mjs";
3
3
  export type { ClearCartRequest } from "./ClearCartRequest.mjs";
4
4
  export { CreatePaymentIntentRequest } from "./CreatePaymentIntentRequest.mjs";
5
5
  export type { GetCartRequest } from "./GetCartRequest.mjs";
6
+ export type { GetShippingOptionsRequest } from "./GetShippingOptionsRequest.mjs";
6
7
  export type { RemoveItemCartRequest } from "./RemoveItemCartRequest.mjs";
8
+ export type { SelectShippingOptionRequest } from "./SelectShippingOptionRequest.mjs";
7
9
  export type { UpdateCartItemRequest } from "./UpdateCartItemRequest.mjs";
@@ -0,0 +1,11 @@
1
+ export type SelectShippingOptionCartResponse = {
2
+ shipping_amount: string;
3
+ shipping_amount_cents: number;
4
+ shipping_method: string;
5
+ total_amount: string;
6
+ } | {
7
+ shipping_amount: string;
8
+ shipping_amount_cents: number;
9
+ shipping_method: string;
10
+ total_amount: string;
11
+ };
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -4,4 +4,5 @@ export * from "./ClearCartResponse.mjs";
4
4
  export * from "./CreatePaymentIntentCartResponse.mjs";
5
5
  export * from "./GetCartResponse.mjs";
6
6
  export * from "./RemoveItemCartResponse.mjs";
7
+ export * from "./SelectShippingOptionCartResponse.mjs";
7
8
  export * from "./UpdateItemCartResponse.mjs";
@@ -4,4 +4,5 @@ export * from "./ClearCartResponse.mjs";
4
4
  export * from "./CreatePaymentIntentCartResponse.mjs";
5
5
  export * from "./GetCartResponse.mjs";
6
6
  export * from "./RemoveItemCartResponse.mjs";
7
+ export * from "./SelectShippingOptionCartResponse.mjs";
7
8
  export * from "./UpdateItemCartResponse.mjs";
@@ -5,6 +5,9 @@ export * from "./businessMessaging/types/index.mjs";
5
5
  export * from "./businessProducts/client/requests/index.mjs";
6
6
  export * as businessProducts from "./businessProducts/index.mjs";
7
7
  export * from "./businessProducts/types/index.mjs";
8
+ export * from "./businessShipping/client/requests/index.mjs";
9
+ export * as businessShipping from "./businessShipping/index.mjs";
10
+ export * from "./businessShipping/types/index.mjs";
8
11
  export * from "./customer/client/requests/index.mjs";
9
12
  export * as customer from "./customer/index.mjs";
10
13
  export * from "./customer/types/index.mjs";
@@ -5,6 +5,9 @@ export * from "./businessMessaging/types/index.mjs";
5
5
  export * from "./businessProducts/client/requests/index.mjs";
6
6
  export * as businessProducts from "./businessProducts/index.mjs";
7
7
  export * from "./businessProducts/types/index.mjs";
8
+ export * from "./businessShipping/client/requests/index.mjs";
9
+ export * as businessShipping from "./businessShipping/index.mjs";
10
+ export * from "./businessShipping/types/index.mjs";
8
11
  export * from "./customer/client/requests/index.mjs";
9
12
  export * as customer from "./customer/index.mjs";
10
13
  export * from "./customer/types/index.mjs";
@@ -0,0 +1,10 @@
1
+ export interface ShippingAccountResource {
2
+ id: string;
3
+ ship_from_name: string;
4
+ ship_from_phone: string | null;
5
+ is_active: boolean;
6
+ live_rates_enabled: boolean;
7
+ card?: string | undefined;
8
+ created_at: string | null;
9
+ updated_at: string | null;
10
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,12 @@
1
+ export interface ShippingRateResource {
2
+ id: string;
3
+ name: string;
4
+ rate_type: string;
5
+ flat_rate: number | null;
6
+ free_shipping_threshold: number | null;
7
+ estimated_days_min: string;
8
+ estimated_days_max: string;
9
+ is_active: string;
10
+ created_at: string;
11
+ updated_at: string;
12
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -132,6 +132,8 @@ export * from "./RsvpItem.mjs";
132
132
  export * from "./RsvpResponse.mjs";
133
133
  export * from "./SearchResults.mjs";
134
134
  export * from "./ServiceUnavailableErrorBody.mjs";
135
+ export * from "./ShippingAccountResource.mjs";
136
+ export * from "./ShippingRateResource.mjs";
135
137
  export * from "./StoreAddressRequest.mjs";
136
138
  export * from "./StoreProductImageRequest.mjs";
137
139
  export * from "./Ticket.mjs";
@@ -132,6 +132,8 @@ export * from "./RsvpItem.mjs";
132
132
  export * from "./RsvpResponse.mjs";
133
133
  export * from "./SearchResults.mjs";
134
134
  export * from "./ServiceUnavailableErrorBody.mjs";
135
+ export * from "./ShippingAccountResource.mjs";
136
+ export * from "./ShippingRateResource.mjs";
135
137
  export * from "./StoreAddressRequest.mjs";
136
138
  export * from "./StoreProductImageRequest.mjs";
137
139
  export * from "./Ticket.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "0.0.51";
1
+ export declare const SDK_VERSION = "0.0.53";
@@ -1 +1 @@
1
- export const SDK_VERSION = "0.0.51";
1
+ export const SDK_VERSION = "0.0.53";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@51eat/sdk",
3
- "version": "0.0.51",
3
+ "version": "0.0.53",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -44,6 +44,17 @@
44
44
  },
45
45
  "default": "./dist/cjs/api/resources/businessProducts/exports.js"
46
46
  },
47
+ "./businessShipping": {
48
+ "import": {
49
+ "types": "./dist/esm/api/resources/businessShipping/exports.d.mts",
50
+ "default": "./dist/esm/api/resources/businessShipping/exports.mjs"
51
+ },
52
+ "require": {
53
+ "types": "./dist/cjs/api/resources/businessShipping/exports.d.ts",
54
+ "default": "./dist/cjs/api/resources/businessShipping/exports.js"
55
+ },
56
+ "default": "./dist/cjs/api/resources/businessShipping/exports.js"
57
+ },
47
58
  "./customerEvents": {
48
59
  "import": {
49
60
  "types": "./dist/esm/api/resources/customerEvents/exports.d.mts",