@01.software/sdk 0.4.0 → 0.4.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.
Files changed (39) hide show
  1. package/dist/auth.d.cts +1 -1
  2. package/dist/auth.d.ts +1 -1
  3. package/dist/{const-BpirbGBD.d.cts → const-BsO3aVX_.d.cts} +1 -1
  4. package/dist/{const-qZSQiSSC.d.ts → const-DZyvV9wU.d.ts} +1 -1
  5. package/dist/index.cjs +57 -8
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +6 -6
  8. package/dist/index.d.ts +6 -6
  9. package/dist/index.js +57 -8
  10. package/dist/index.js.map +1 -1
  11. package/dist/{payload-types-CZiaL4Wr.d.cts → payload-types-BsjHfeAF.d.cts} +62 -2
  12. package/dist/{payload-types-CZiaL4Wr.d.ts → payload-types-BsjHfeAF.d.ts} +62 -2
  13. package/dist/realtime.cjs +5 -3
  14. package/dist/realtime.cjs.map +1 -1
  15. package/dist/realtime.d.cts +2 -2
  16. package/dist/realtime.d.ts +2 -2
  17. package/dist/realtime.js +5 -3
  18. package/dist/realtime.js.map +1 -1
  19. package/dist/ui/flow.cjs +264 -36
  20. package/dist/ui/flow.cjs.map +1 -1
  21. package/dist/ui/flow.d.cts +104 -3
  22. package/dist/ui/flow.d.ts +104 -3
  23. package/dist/ui/flow.js +252 -21
  24. package/dist/ui/flow.js.map +1 -1
  25. package/dist/ui/form.d.cts +1 -1
  26. package/dist/ui/form.d.ts +1 -1
  27. package/dist/ui/rich-text.cjs +8 -1
  28. package/dist/ui/rich-text.cjs.map +1 -1
  29. package/dist/ui/rich-text.d.cts +20 -1
  30. package/dist/ui/rich-text.d.ts +20 -1
  31. package/dist/ui/rich-text.js +8 -1
  32. package/dist/ui/rich-text.js.map +1 -1
  33. package/dist/ui/video.d.cts +1 -1
  34. package/dist/ui/video.d.ts +1 -1
  35. package/dist/{webhook-DuTqrH9x.d.ts → webhook-BBWl8O2f.d.ts} +2 -2
  36. package/dist/{webhook-3iL9OEyq.d.cts → webhook-CkL56e65.d.cts} +2 -2
  37. package/dist/webhook.d.cts +3 -3
  38. package/dist/webhook.d.ts +3 -3
  39. package/package.json +2 -1
package/dist/index.d.cts CHANGED
@@ -1,13 +1,13 @@
1
- import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, E as Exchange, c as Cart, d as CartItem, P as Product } from './payload-types-CZiaL4Wr.cjs';
2
- export { o as ApiUsage, as as ApiUsageSelect, A as Audience, ao as AudiencesSelect, bo as Auth, q as BillingHistory, au as BillingHistorySelect, y as Brand, B as BrandLogo, aD as BrandLogosSelect, aC as BrandsSelect, aT as CartItemsSelect, aS as CartsSelect, g as CodeBlock, bn as CollectionsWidget, C as Config, G as Customer, J as CustomerAddress, aQ as CustomerAddressesSelect, e as CustomerAuthOperations, H as CustomerGroup, aR as CustomerGroupsSelect, aP as CustomersSelect, W as Discount, aU as DiscountsSelect, $ as Document, a_ as DocumentCategoriesSelect, a1 as DocumentCategory, a0 as DocumentType, a$ as DocumentTypesSelect, aZ as DocumentsSelect, m as EmailLog, ap as EmailLogsSelect, N as ExchangeProduct, aN as ExchangeProductsSelect, aM as ExchangesSelect, j as FieldConfig, al as FieldConfigsSelect, aa as Flow, bb as FlowCategoriesSelect, ab as FlowCategory, ae as FlowEdgeType, ba as FlowEdgeTypesSelect, ad as FlowNodeType, b9 as FlowNodeTypesSelect, ac as FlowTag, bc as FlowTagsSelect, b8 as FlowsSelect, F as Form, af as FormSubmission, bi as FormSubmissionsSelect, bh as FormsSelect, K as FulfillmentItem, aJ as FulfillmentItemsSelect, aI as FulfillmentsSelect, b4 as GalleriesSelect, a6 as Gallery, b5 as GalleryCategoriesSelect, a7 as GalleryCategory, a9 as GalleryItem, b7 as GalleryItemsSelect, a8 as GalleryTag, b6 as GalleryTagsSelect, I as IframeBlock, k as Image, am as ImagesSelect, L as LiveStream, bg as LiveStreamsSelect, a5 as Music, b3 as MusicsSelect, aF as OrderProductsSelect, Q as OrderStatusLog, aH as OrderStatusLogsSelect, aE as OrdersSelect, ag as PayloadKv, bj as PayloadKvSelect, ah as PayloadLockedDocument, bk as PayloadLockedDocumentsSelect, aj as PayloadMigration, bm as PayloadMigrationsSelect, ai as PayloadPreference, bl as PayloadPreferencesSelect, f as PlayerBlock, a2 as Playlist, b1 as PlaylistCategoriesSelect, a3 as PlaylistCategory, a4 as PlaylistTag, b2 as PlaylistTagsSelect, b0 as PlaylistsSelect, X as Post, Y as PostAuthor, aW as PostAuthorsSelect, aX as PostCategoriesSelect, Z as PostCategory, _ as PostTag, aY as PostTagsSelect, aV as PostsSelect, az as ProductCategoriesSelect, w as ProductCategory, D as ProductCollection, aB as ProductCollectionsSelect, v as ProductOption, ay as ProductOptionsSelect, x as ProductTag, aA as ProductTagsSelect, u as ProductVariant, ax as ProductVariantsSelect, aw as ProductsSelect, M as ReturnProduct, aL as ReturnProductsSelect, aK as ReturnsSelect, aO as ShippingPoliciesSelect, z as ShippingPolicy, p as Subscription, at as SubscriptionsSelect, S as SupportedTimezones, l as SystemMedia, an as SystemMediaSelect, i as Tenant, r as TenantLogo, av as TenantLogosSelect, ar as TenantMetadataSelect, n as TenantMetadatum, aq as TenantsSelect, aG as TransactionsSelect, h as User, U as UserAuthOperations, ak as UsersSelect, V as Video, be as VideoCategoriesSelect, s as VideoCategory, t as VideoTag, bf as VideoTagsSelect, bd as VideosSelect } from './payload-types-CZiaL4Wr.cjs';
1
+ import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, E as Exchange, c as Cart, d as CartItem, P as Product } from './payload-types-BsjHfeAF.cjs';
2
+ export { o as ApiUsage, as as ApiUsageSelect, A as Audience, ao as AudiencesSelect, bo as Auth, q as BillingHistory, au as BillingHistorySelect, y as Brand, B as BrandLogo, aD as BrandLogosSelect, aC as BrandsSelect, aT as CartItemsSelect, aS as CartsSelect, g as CodeBlock, bn as CollectionsWidget, C as Config, G as Customer, J as CustomerAddress, aQ as CustomerAddressesSelect, e as CustomerAuthOperations, H as CustomerGroup, aR as CustomerGroupsSelect, aP as CustomersSelect, W as Discount, aU as DiscountsSelect, $ as Document, a_ as DocumentCategoriesSelect, a1 as DocumentCategory, a0 as DocumentType, a$ as DocumentTypesSelect, aZ as DocumentsSelect, m as EmailLog, ap as EmailLogsSelect, N as ExchangeProduct, aN as ExchangeProductsSelect, aM as ExchangesSelect, j as FieldConfig, al as FieldConfigsSelect, aa as Flow, bb as FlowCategoriesSelect, ab as FlowCategory, ae as FlowEdgeType, ba as FlowEdgeTypesSelect, ad as FlowNodeType, b9 as FlowNodeTypesSelect, ac as FlowTag, bc as FlowTagsSelect, b8 as FlowsSelect, F as Form, af as FormSubmission, bi as FormSubmissionsSelect, bh as FormsSelect, K as FulfillmentItem, aJ as FulfillmentItemsSelect, aI as FulfillmentsSelect, b4 as GalleriesSelect, a6 as Gallery, b5 as GalleryCategoriesSelect, a7 as GalleryCategory, a9 as GalleryItem, b7 as GalleryItemsSelect, a8 as GalleryTag, b6 as GalleryTagsSelect, I as IframeBlock, k as Image, am as ImagesSelect, L as LiveStream, bg as LiveStreamsSelect, a5 as Music, b3 as MusicsSelect, aF as OrderProductsSelect, Q as OrderStatusLog, aH as OrderStatusLogsSelect, aE as OrdersSelect, ag as PayloadKv, bj as PayloadKvSelect, ah as PayloadLockedDocument, bk as PayloadLockedDocumentsSelect, aj as PayloadMigration, bm as PayloadMigrationsSelect, ai as PayloadPreference, bl as PayloadPreferencesSelect, f as PlayerBlock, a2 as Playlist, b1 as PlaylistCategoriesSelect, a3 as PlaylistCategory, a4 as PlaylistTag, b2 as PlaylistTagsSelect, b0 as PlaylistsSelect, X as Post, Y as PostAuthor, aW as PostAuthorsSelect, aX as PostCategoriesSelect, Z as PostCategory, _ as PostTag, aY as PostTagsSelect, aV as PostsSelect, az as ProductCategoriesSelect, w as ProductCategory, D as ProductCollection, aB as ProductCollectionsSelect, v as ProductOption, ay as ProductOptionsSelect, x as ProductTag, aA as ProductTagsSelect, u as ProductVariant, ax as ProductVariantsSelect, aw as ProductsSelect, M as ReturnProduct, aL as ReturnProductsSelect, aK as ReturnsSelect, aO as ShippingPoliciesSelect, z as ShippingPolicy, p as Subscription, at as SubscriptionsSelect, S as SupportedTimezones, l as SystemMedia, an as SystemMediaSelect, i as Tenant, r as TenantLogo, av as TenantLogosSelect, ar as TenantMetadataSelect, n as TenantMetadatum, aq as TenantsSelect, aG as TransactionsSelect, h as User, U as UserAuthOperations, ak as UsersSelect, V as Video, be as VideoCategoriesSelect, s as VideoCategory, t as VideoTag, bf as VideoTagsSelect, bd as VideosSelect } from './payload-types-BsjHfeAF.cjs';
3
3
  import { Sort, Where } from 'payload';
4
4
  import * as _tanstack_react_query from '@tanstack/react-query';
5
5
  import { QueryClient } from '@tanstack/react-query';
6
- import { P as PublicCollection } from './const-BpirbGBD.cjs';
7
- export { a as COLLECTIONS, C as Collection } from './const-BpirbGBD.cjs';
6
+ import { P as PublicCollection } from './const-BsO3aVX_.cjs';
7
+ export { a as COLLECTIONS, C as Collection } from './const-BsO3aVX_.cjs';
8
8
  import { Metadata } from 'next';
9
- import { C as CollectionType } from './webhook-3iL9OEyq.cjs';
10
- export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, d as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-3iL9OEyq.cjs';
9
+ import { C as CollectionType } from './webhook-CkL56e65.cjs';
10
+ export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, d as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-CkL56e65.cjs';
11
11
  export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-DupPIYx-.cjs';
12
12
  export { b as IMAGE_SIZES, I as ImageData, a as ImagePalette, f as ImagePlaceholderOptions, d as getImageLqip, e as getImagePalette, h as getImagePlaceholderStyle, c as getImageSrcSet, g as getImageUrl } from './image-TT8lTsk5.cjs';
13
13
  export { e as VideoGifOptions, V as VideoThumbnailOptions, a as getVideoGif, c as getVideoMp4Url, d as getVideoStoryboard, b as getVideoStreamUrl, g as getVideoThumbnail } from './video-DbLL8yuc.cjs';
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, E as Exchange, c as Cart, d as CartItem, P as Product } from './payload-types-CZiaL4Wr.js';
2
- export { o as ApiUsage, as as ApiUsageSelect, A as Audience, ao as AudiencesSelect, bo as Auth, q as BillingHistory, au as BillingHistorySelect, y as Brand, B as BrandLogo, aD as BrandLogosSelect, aC as BrandsSelect, aT as CartItemsSelect, aS as CartsSelect, g as CodeBlock, bn as CollectionsWidget, C as Config, G as Customer, J as CustomerAddress, aQ as CustomerAddressesSelect, e as CustomerAuthOperations, H as CustomerGroup, aR as CustomerGroupsSelect, aP as CustomersSelect, W as Discount, aU as DiscountsSelect, $ as Document, a_ as DocumentCategoriesSelect, a1 as DocumentCategory, a0 as DocumentType, a$ as DocumentTypesSelect, aZ as DocumentsSelect, m as EmailLog, ap as EmailLogsSelect, N as ExchangeProduct, aN as ExchangeProductsSelect, aM as ExchangesSelect, j as FieldConfig, al as FieldConfigsSelect, aa as Flow, bb as FlowCategoriesSelect, ab as FlowCategory, ae as FlowEdgeType, ba as FlowEdgeTypesSelect, ad as FlowNodeType, b9 as FlowNodeTypesSelect, ac as FlowTag, bc as FlowTagsSelect, b8 as FlowsSelect, F as Form, af as FormSubmission, bi as FormSubmissionsSelect, bh as FormsSelect, K as FulfillmentItem, aJ as FulfillmentItemsSelect, aI as FulfillmentsSelect, b4 as GalleriesSelect, a6 as Gallery, b5 as GalleryCategoriesSelect, a7 as GalleryCategory, a9 as GalleryItem, b7 as GalleryItemsSelect, a8 as GalleryTag, b6 as GalleryTagsSelect, I as IframeBlock, k as Image, am as ImagesSelect, L as LiveStream, bg as LiveStreamsSelect, a5 as Music, b3 as MusicsSelect, aF as OrderProductsSelect, Q as OrderStatusLog, aH as OrderStatusLogsSelect, aE as OrdersSelect, ag as PayloadKv, bj as PayloadKvSelect, ah as PayloadLockedDocument, bk as PayloadLockedDocumentsSelect, aj as PayloadMigration, bm as PayloadMigrationsSelect, ai as PayloadPreference, bl as PayloadPreferencesSelect, f as PlayerBlock, a2 as Playlist, b1 as PlaylistCategoriesSelect, a3 as PlaylistCategory, a4 as PlaylistTag, b2 as PlaylistTagsSelect, b0 as PlaylistsSelect, X as Post, Y as PostAuthor, aW as PostAuthorsSelect, aX as PostCategoriesSelect, Z as PostCategory, _ as PostTag, aY as PostTagsSelect, aV as PostsSelect, az as ProductCategoriesSelect, w as ProductCategory, D as ProductCollection, aB as ProductCollectionsSelect, v as ProductOption, ay as ProductOptionsSelect, x as ProductTag, aA as ProductTagsSelect, u as ProductVariant, ax as ProductVariantsSelect, aw as ProductsSelect, M as ReturnProduct, aL as ReturnProductsSelect, aK as ReturnsSelect, aO as ShippingPoliciesSelect, z as ShippingPolicy, p as Subscription, at as SubscriptionsSelect, S as SupportedTimezones, l as SystemMedia, an as SystemMediaSelect, i as Tenant, r as TenantLogo, av as TenantLogosSelect, ar as TenantMetadataSelect, n as TenantMetadatum, aq as TenantsSelect, aG as TransactionsSelect, h as User, U as UserAuthOperations, ak as UsersSelect, V as Video, be as VideoCategoriesSelect, s as VideoCategory, t as VideoTag, bf as VideoTagsSelect, bd as VideosSelect } from './payload-types-CZiaL4Wr.js';
1
+ import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, E as Exchange, c as Cart, d as CartItem, P as Product } from './payload-types-BsjHfeAF.js';
2
+ export { o as ApiUsage, as as ApiUsageSelect, A as Audience, ao as AudiencesSelect, bo as Auth, q as BillingHistory, au as BillingHistorySelect, y as Brand, B as BrandLogo, aD as BrandLogosSelect, aC as BrandsSelect, aT as CartItemsSelect, aS as CartsSelect, g as CodeBlock, bn as CollectionsWidget, C as Config, G as Customer, J as CustomerAddress, aQ as CustomerAddressesSelect, e as CustomerAuthOperations, H as CustomerGroup, aR as CustomerGroupsSelect, aP as CustomersSelect, W as Discount, aU as DiscountsSelect, $ as Document, a_ as DocumentCategoriesSelect, a1 as DocumentCategory, a0 as DocumentType, a$ as DocumentTypesSelect, aZ as DocumentsSelect, m as EmailLog, ap as EmailLogsSelect, N as ExchangeProduct, aN as ExchangeProductsSelect, aM as ExchangesSelect, j as FieldConfig, al as FieldConfigsSelect, aa as Flow, bb as FlowCategoriesSelect, ab as FlowCategory, ae as FlowEdgeType, ba as FlowEdgeTypesSelect, ad as FlowNodeType, b9 as FlowNodeTypesSelect, ac as FlowTag, bc as FlowTagsSelect, b8 as FlowsSelect, F as Form, af as FormSubmission, bi as FormSubmissionsSelect, bh as FormsSelect, K as FulfillmentItem, aJ as FulfillmentItemsSelect, aI as FulfillmentsSelect, b4 as GalleriesSelect, a6 as Gallery, b5 as GalleryCategoriesSelect, a7 as GalleryCategory, a9 as GalleryItem, b7 as GalleryItemsSelect, a8 as GalleryTag, b6 as GalleryTagsSelect, I as IframeBlock, k as Image, am as ImagesSelect, L as LiveStream, bg as LiveStreamsSelect, a5 as Music, b3 as MusicsSelect, aF as OrderProductsSelect, Q as OrderStatusLog, aH as OrderStatusLogsSelect, aE as OrdersSelect, ag as PayloadKv, bj as PayloadKvSelect, ah as PayloadLockedDocument, bk as PayloadLockedDocumentsSelect, aj as PayloadMigration, bm as PayloadMigrationsSelect, ai as PayloadPreference, bl as PayloadPreferencesSelect, f as PlayerBlock, a2 as Playlist, b1 as PlaylistCategoriesSelect, a3 as PlaylistCategory, a4 as PlaylistTag, b2 as PlaylistTagsSelect, b0 as PlaylistsSelect, X as Post, Y as PostAuthor, aW as PostAuthorsSelect, aX as PostCategoriesSelect, Z as PostCategory, _ as PostTag, aY as PostTagsSelect, aV as PostsSelect, az as ProductCategoriesSelect, w as ProductCategory, D as ProductCollection, aB as ProductCollectionsSelect, v as ProductOption, ay as ProductOptionsSelect, x as ProductTag, aA as ProductTagsSelect, u as ProductVariant, ax as ProductVariantsSelect, aw as ProductsSelect, M as ReturnProduct, aL as ReturnProductsSelect, aK as ReturnsSelect, aO as ShippingPoliciesSelect, z as ShippingPolicy, p as Subscription, at as SubscriptionsSelect, S as SupportedTimezones, l as SystemMedia, an as SystemMediaSelect, i as Tenant, r as TenantLogo, av as TenantLogosSelect, ar as TenantMetadataSelect, n as TenantMetadatum, aq as TenantsSelect, aG as TransactionsSelect, h as User, U as UserAuthOperations, ak as UsersSelect, V as Video, be as VideoCategoriesSelect, s as VideoCategory, t as VideoTag, bf as VideoTagsSelect, bd as VideosSelect } from './payload-types-BsjHfeAF.js';
3
3
  import { Sort, Where } from 'payload';
4
4
  import * as _tanstack_react_query from '@tanstack/react-query';
5
5
  import { QueryClient } from '@tanstack/react-query';
6
- import { P as PublicCollection } from './const-qZSQiSSC.js';
7
- export { a as COLLECTIONS, C as Collection } from './const-qZSQiSSC.js';
6
+ import { P as PublicCollection } from './const-DZyvV9wU.js';
7
+ export { a as COLLECTIONS, C as Collection } from './const-DZyvV9wU.js';
8
8
  import { Metadata } from 'next';
9
- import { C as CollectionType } from './webhook-DuTqrH9x.js';
10
- export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, d as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-DuTqrH9x.js';
9
+ import { C as CollectionType } from './webhook-BBWl8O2f.js';
10
+ export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, d as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-BBWl8O2f.js';
11
11
  export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-DupPIYx-.js';
12
12
  export { b as IMAGE_SIZES, I as ImageData, a as ImagePalette, f as ImagePlaceholderOptions, d as getImageLqip, e as getImagePalette, h as getImagePlaceholderStyle, c as getImageSrcSet, g as getImageUrl } from './image-TT8lTsk5.js';
13
13
  export { e as VideoGifOptions, V as VideoThumbnailOptions, a as getVideoGif, c as getVideoMp4Url, d as getVideoStoryboard, b as getVideoStreamUrl, g as getVideoThumbnail } from './video-DbLL8yuc.js';
package/dist/index.js CHANGED
@@ -261,9 +261,11 @@ var createUsageLimitError = (message, usage, details, userMessage, suggestion) =
261
261
 
262
262
  // src/core/client/types.ts
263
263
  function resolveApiUrl() {
264
- const envUrl = process.env.SOFTWARE_API_URL || process.env.NEXT_PUBLIC_SOFTWARE_API_URL;
265
- if (envUrl) {
266
- return envUrl.replace(/\/$/, "");
264
+ if (typeof process !== "undefined" && process.env) {
265
+ const envUrl = process.env.SOFTWARE_API_URL || process.env.NEXT_PUBLIC_SOFTWARE_API_URL;
266
+ if (envUrl) {
267
+ return envUrl.replace(/\/$/, "");
268
+ }
267
269
  }
268
270
  return "https://api.01.software";
269
271
  }
@@ -284,10 +286,50 @@ function debugLog(debug, type, message, data) {
284
286
  }
285
287
  function getErrorSuggestion(status) {
286
288
  if (status === 401) return "Please check your authentication credentials.";
289
+ if (status === 403) return "Access denied. Check your credentials or permissions.";
287
290
  if (status === 404) return "The requested resource was not found.";
291
+ if (status === 422) return "The request data failed validation.";
288
292
  if (status >= 500) return "A server error occurred. Please try again later.";
289
293
  return void 0;
290
294
  }
295
+ function parseErrorBody(response) {
296
+ return __async(this, null, function* () {
297
+ const fallback = {
298
+ errorMessage: `HTTP ${response.status}: ${response.statusText}`,
299
+ userMessage: `Request failed (status: ${response.status})`
300
+ };
301
+ try {
302
+ const body = yield response.json();
303
+ if (body.errors && Array.isArray(body.errors)) {
304
+ const details = body.errors.map(
305
+ (e) => e.field ? `${e.field}: ${e.message}` : e.message
306
+ ).filter(Boolean).join("; ");
307
+ if (details) {
308
+ return {
309
+ errorMessage: `HTTP ${response.status}: ${details}`,
310
+ userMessage: details,
311
+ errors: body.errors
312
+ };
313
+ }
314
+ }
315
+ if (typeof body.error === "string") {
316
+ return {
317
+ errorMessage: `HTTP ${response.status}: ${body.error}`,
318
+ userMessage: body.error
319
+ };
320
+ }
321
+ if (body.message) {
322
+ return {
323
+ errorMessage: `HTTP ${response.status}: ${body.message}`,
324
+ userMessage: body.message
325
+ };
326
+ }
327
+ return fallback;
328
+ } catch (e) {
329
+ return fallback;
330
+ }
331
+ });
332
+ }
291
333
  function delay(ms) {
292
334
  return __async(this, null, function* () {
293
335
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -396,19 +438,26 @@ function httpFetch(url, options) {
396
438
  }
397
439
  }
398
440
  if (NON_RETRYABLE_STATUSES.includes(response.status)) {
441
+ const parsed2 = yield parseErrorBody(response);
442
+ const details = __spreadValues({
443
+ url,
444
+ method: requestInit.method || "GET",
445
+ attempt: attempt + 1
446
+ }, parsed2.errors && { errors: parsed2.errors });
399
447
  throw createNetworkError(
400
- `HTTP ${response.status}: ${response.statusText}`,
448
+ parsed2.errorMessage,
401
449
  response.status,
402
- { url, method: requestInit.method || "GET", attempt: attempt + 1 },
403
- `Request failed (status: ${response.status})`,
450
+ details,
451
+ parsed2.userMessage,
404
452
  getErrorSuggestion(response.status)
405
453
  );
406
454
  }
455
+ const parsed = yield parseErrorBody(response);
407
456
  const error = createNetworkError(
408
- `HTTP ${response.status}: ${response.statusText}`,
457
+ parsed.errorMessage,
409
458
  response.status,
410
459
  { url, method: requestInit.method || "GET", attempt: attempt + 1 },
411
- `Request failed (status: ${response.status})`,
460
+ parsed.userMessage,
412
461
  getErrorSuggestion(response.status)
413
462
  );
414
463
  const method = (requestInit.method || "GET").toUpperCase();