@01.software/sdk 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,13 +1,12 @@
1
- import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, C as CartItem, P as ProductOption } from './payload-types-D0px2DCK.cjs';
2
- export { k as ApiUsage, ae as ApiUsageSelect, A as Audience, aa as AudiencesSelect, b0 as Auth, m as BillingHistory, ag as BillingHistorySelect, u as Brand, B as BrandLogo, aq as BrandLogosSelect, ap as BrandsSelect, K as Cart, aG as CartItemsSelect, aF as CartsSelect, f as CodeBlock, a$ as CollectionsWidget, c as Config, w as Customer, z as CustomerAddress, aC as CustomerAddressesSelect, d as CustomerAuthOperations, x as CustomerGroup, y as CustomerGroupImage, aE as CustomerGroupImagesSelect, aD as CustomerGroupsSelect, aB as CustomersSelect, L as Discount, aH as DiscountsSelect, Y as Document, aP as DocumentCategoriesSelect, $ as DocumentCategory, _ as DocumentImage, aR as DocumentImagesSelect, Z as DocumentType, aQ as DocumentTypesSelect, aO as DocumentsSelect, E as EmailLog, ab as EmailLogsSelect, G as Exchange, H as ExchangeProduct, ax as ExchangeProductsSelect, aw as ExchangesSelect, F as Form, a3 as FormSubmission, aW as FormSubmissionsSelect, aV as FormsSelect, J as FulfillmentItem, az as FulfillmentItemsSelect, ay as FulfillmentsSelect, I as IframeBlock, M as Media, a9 as MediaSelect, a1 as Music, aT as MusicsSelect, at as OrderProductsSelect, as as OrdersSelect, a4 as PayloadKv, aX as PayloadKvSelect, a5 as PayloadLockedDocument, aY as PayloadLockedDocumentsSelect, a7 as PayloadMigration, a_ as PayloadMigrationsSelect, a6 as PayloadPreference, aZ as PayloadPreferencesSelect, e as PlayerBlock, a0 as Playlist, a2 as PlaylistImage, aU as PlaylistImagesSelect, aS as PlaylistsSelect, N as Post, V as PostAuthor, aK as PostAuthorsSelect, aL as PostCategoriesSelect, W as PostCategory, Q as PostImage, aN as PostImagesSelect, X as PostTag, aM as PostTagsSelect, aJ as PostsSelect, o as Product, am as ProductCategoriesSelect, r as ProductCategory, t as ProductCollection, ao as ProductCollectionsSelect, p as ProductImage, ar as ProductImagesSelect, al as ProductOptionsSelect, s as ProductTag, an as ProductTagsSelect, q as ProductVariant, ak as ProductVariantsSelect, aj as ProductsSelect, D as ReturnProduct, av as ReturnProductsSelect, au as ReturnsSelect, aI as ShippingPoliciesSelect, v as ShippingPolicy, l as Subscription, af as SubscriptionsSelect, S as SupportedTimezones, h as Tenant, n as TenantLogo, ah as TenantLogosSelect, ad as TenantMetadataSelect, i as TenantMetadatum, j as TenantOgImage, ai as TenantOgImagesSelect, ac as TenantsSelect, aA as TransactionsSelect, g as User, U as UserAuthOperations, a8 as UsersSelect } from './payload-types-D0px2DCK.cjs';
3
- import { F as FetchOptions, A as ApiQueryOptions, P as PayloadFindResponse, a as PayloadMutationResponse, C as ClientBrowserConfig, b as ClientState, c as ClientServerConfig } from './auth-BICuhJxS.cjs';
4
- export { t as API_URLS, f as ApiError, y as ApiQueryReactOptions, w as ClientMetadata, g as ConfigError, d as DebugConfig, D as DeepPartial, s as Environment, e as ErrorLogger, E as ExtractArrayType, J as JwtPayload, N as NetworkError, x as PaginationMeta, R as RetryConfig, S as SDKError, T as TimeoutError, U as UsageLimitError, V as ValidationError, q as createApiKey, o as createServerToken, p as decodeServerToken, k as isApiError, l as isConfigError, h as isNetworkError, i as isSDKError, m as isTimeoutError, n as isUsageLimitError, j as isValidationError, r as parseApiKey, u as resolveApiUrl, v as verifyServerToken } from './auth-BICuhJxS.cjs';
1
+ import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, C as CartItem, P as ProductOption } from './payload-types-CRSz8jfP.cjs';
2
+ export { k as ApiUsage, ae as ApiUsageSelect, A as Audience, aa as AudiencesSelect, b0 as Auth, m as BillingHistory, ag as BillingHistorySelect, u as Brand, B as BrandLogo, aq as BrandLogosSelect, ap as BrandsSelect, K as Cart, aG as CartItemsSelect, aF as CartsSelect, f as CodeBlock, a$ as CollectionsWidget, c as Config, w as Customer, z as CustomerAddress, aC as CustomerAddressesSelect, d as CustomerAuthOperations, x as CustomerGroup, y as CustomerGroupImage, aE as CustomerGroupImagesSelect, aD as CustomerGroupsSelect, aB as CustomersSelect, L as Discount, aH as DiscountsSelect, Y as Document, aP as DocumentCategoriesSelect, $ as DocumentCategory, _ as DocumentImage, aR as DocumentImagesSelect, Z as DocumentType, aQ as DocumentTypesSelect, aO as DocumentsSelect, E as EmailLog, ab as EmailLogsSelect, G as Exchange, H as ExchangeProduct, ax as ExchangeProductsSelect, aw as ExchangesSelect, F as Form, a3 as FormSubmission, aW as FormSubmissionsSelect, aV as FormsSelect, J as FulfillmentItem, az as FulfillmentItemsSelect, ay as FulfillmentsSelect, I as IframeBlock, M as Media, a9 as MediaSelect, a1 as Music, aT as MusicsSelect, at as OrderProductsSelect, as as OrdersSelect, a4 as PayloadKv, aX as PayloadKvSelect, a5 as PayloadLockedDocument, aY as PayloadLockedDocumentsSelect, a7 as PayloadMigration, a_ as PayloadMigrationsSelect, a6 as PayloadPreference, aZ as PayloadPreferencesSelect, e as PlayerBlock, a0 as Playlist, a2 as PlaylistImage, aU as PlaylistImagesSelect, aS as PlaylistsSelect, N as Post, V as PostAuthor, aK as PostAuthorsSelect, aL as PostCategoriesSelect, W as PostCategory, Q as PostImage, aN as PostImagesSelect, X as PostTag, aM as PostTagsSelect, aJ as PostsSelect, o as Product, am as ProductCategoriesSelect, r as ProductCategory, t as ProductCollection, ao as ProductCollectionsSelect, p as ProductImage, ar as ProductImagesSelect, al as ProductOptionsSelect, s as ProductTag, an as ProductTagsSelect, q as ProductVariant, ak as ProductVariantsSelect, aj as ProductsSelect, D as ReturnProduct, av as ReturnProductsSelect, au as ReturnsSelect, aI as ShippingPoliciesSelect, v as ShippingPolicy, l as Subscription, af as SubscriptionsSelect, S as SupportedTimezones, h as Tenant, n as TenantLogo, ah as TenantLogosSelect, ad as TenantMetadataSelect, i as TenantMetadatum, j as TenantOgImage, ai as TenantOgImagesSelect, ac as TenantsSelect, aA as TransactionsSelect, g as User, U as UserAuthOperations, a8 as UsersSelect } from './payload-types-CRSz8jfP.cjs';
3
+ import { F as FetchOptions, A as ApiQueryOptions, P as PayloadFindResponse, a as PayloadMutationResponse, C as ClientBrowserConfig, b as ClientState, c as ClientServerConfig } from './auth-ZBsN9vPn.cjs';
4
+ export { t as API_URLS, f as ApiError, y as ApiQueryReactOptions, w as ClientMetadata, g as ConfigError, d as DebugConfig, D as DeepPartial, s as Environment, e as ErrorLogger, E as ExtractArrayType, J as JwtPayload, N as NetworkError, x as PaginationMeta, R as RetryConfig, S as SDKError, T as TimeoutError, U as UsageLimitError, V as ValidationError, q as createApiKey, o as createServerToken, p as decodeServerToken, k as isApiError, l as isConfigError, h as isNetworkError, i as isSDKError, m as isTimeoutError, n as isUsageLimitError, j as isValidationError, r as parseApiKey, u as resolveApiUrl, v as verifyServerToken } from './auth-ZBsN9vPn.cjs';
5
5
  import * as _tanstack_react_query from '@tanstack/react-query';
6
6
  import { QueryClient } from '@tanstack/react-query';
7
- import { P as PublicCollection, C as CollectionType } from './webhook--_n7O-Ed.cjs';
8
- export { b as COLLECTIONS, a as Collection, c as WebhookEvent, d as WebhookHandler, W as WebhookOperation, e as WebhookOptions, f as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook--_n7O-Ed.cjs';
7
+ import { P as PublicCollection, C as CollectionType } from './webhook-Dn5o0LXq.cjs';
8
+ export { b as COLLECTIONS, a as Collection, c as WebhookEvent, d as WebhookHandler, W as WebhookOperation, e as WebhookOptions, f as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-Dn5o0LXq.cjs';
9
9
  import { Metadata } from 'next';
10
- import { GenerateMetadataOptions } from './metadata.cjs';
11
10
  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';
12
11
  import 'payload';
13
12
 
@@ -167,6 +166,12 @@ declare class ProductApi {
167
166
  stockCheck(params: StockCheckParams): Promise<StockCheckResponse>;
168
167
  }
169
168
 
169
+ interface GenerateMetadataOptions {
170
+ title?: string;
171
+ description?: string;
172
+ siteName?: string;
173
+ }
174
+
170
175
  declare class HttpClient {
171
176
  protected clientKey: string;
172
177
  protected secretKey?: string;
@@ -664,4 +669,4 @@ declare const resolveRelation: <T>(ref: T | string | number | null | undefined)
664
669
  /** @deprecated Use `resolveRelation` instead */
665
670
  declare const objectFor: <T>(ref: T | string | number | null | undefined) => T | null;
666
671
 
667
- export { type AddItemParams, ApiQueryOptions, BrowserClient, BrowserClient as BrowserClientType, CartApi, type CartApiOptions, CartItem, type CheckoutParams, ClientBrowserConfig, ClientServerConfig, ClientState, CollectionClient, type CollectionDetailQueryParams, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, Fulfillment, type GetOrderParams, Order, OrderApi, type OrderApiOptions, OrderProduct, PayloadFindResponse, PayloadMutationResponse, ProductApi, type ProductApiOptions, ProductOption, PublicCollection, QueryHooks, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveItemParams, Return, type ReturnWithRefundParams, ServerClient, ServerClient as ServerClientType, type StockCheckParams, type StockCheckResponse, type StockCheckResult, Transaction, type UpdateItemParams, type UpdateOrderParams, type UpdateReturnParams, type UpdateTransactionParams, collectionKeys, createBrowserClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, objectFor, resolveRelation };
672
+ export { type AddItemParams, ApiQueryOptions, BrowserClient, BrowserClient as BrowserClientType, CartApi, type CartApiOptions, CartItem, type CheckoutParams, ClientBrowserConfig, ClientServerConfig, ClientState, CollectionClient, type CollectionDetailQueryParams, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, Fulfillment, type GenerateMetadataOptions, type GetOrderParams, Order, OrderApi, type OrderApiOptions, OrderProduct, PayloadFindResponse, PayloadMutationResponse, ProductApi, type ProductApiOptions, ProductOption, PublicCollection, QueryHooks, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveItemParams, Return, type ReturnWithRefundParams, ServerClient, ServerClient as ServerClientType, type StockCheckParams, type StockCheckResponse, type StockCheckResult, Transaction, type UpdateItemParams, type UpdateOrderParams, type UpdateReturnParams, type UpdateTransactionParams, collectionKeys, createBrowserClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, objectFor, resolveRelation };
package/dist/index.d.ts CHANGED
@@ -1,13 +1,12 @@
1
- import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, C as CartItem, P as ProductOption } from './payload-types-D0px2DCK.js';
2
- export { k as ApiUsage, ae as ApiUsageSelect, A as Audience, aa as AudiencesSelect, b0 as Auth, m as BillingHistory, ag as BillingHistorySelect, u as Brand, B as BrandLogo, aq as BrandLogosSelect, ap as BrandsSelect, K as Cart, aG as CartItemsSelect, aF as CartsSelect, f as CodeBlock, a$ as CollectionsWidget, c as Config, w as Customer, z as CustomerAddress, aC as CustomerAddressesSelect, d as CustomerAuthOperations, x as CustomerGroup, y as CustomerGroupImage, aE as CustomerGroupImagesSelect, aD as CustomerGroupsSelect, aB as CustomersSelect, L as Discount, aH as DiscountsSelect, Y as Document, aP as DocumentCategoriesSelect, $ as DocumentCategory, _ as DocumentImage, aR as DocumentImagesSelect, Z as DocumentType, aQ as DocumentTypesSelect, aO as DocumentsSelect, E as EmailLog, ab as EmailLogsSelect, G as Exchange, H as ExchangeProduct, ax as ExchangeProductsSelect, aw as ExchangesSelect, F as Form, a3 as FormSubmission, aW as FormSubmissionsSelect, aV as FormsSelect, J as FulfillmentItem, az as FulfillmentItemsSelect, ay as FulfillmentsSelect, I as IframeBlock, M as Media, a9 as MediaSelect, a1 as Music, aT as MusicsSelect, at as OrderProductsSelect, as as OrdersSelect, a4 as PayloadKv, aX as PayloadKvSelect, a5 as PayloadLockedDocument, aY as PayloadLockedDocumentsSelect, a7 as PayloadMigration, a_ as PayloadMigrationsSelect, a6 as PayloadPreference, aZ as PayloadPreferencesSelect, e as PlayerBlock, a0 as Playlist, a2 as PlaylistImage, aU as PlaylistImagesSelect, aS as PlaylistsSelect, N as Post, V as PostAuthor, aK as PostAuthorsSelect, aL as PostCategoriesSelect, W as PostCategory, Q as PostImage, aN as PostImagesSelect, X as PostTag, aM as PostTagsSelect, aJ as PostsSelect, o as Product, am as ProductCategoriesSelect, r as ProductCategory, t as ProductCollection, ao as ProductCollectionsSelect, p as ProductImage, ar as ProductImagesSelect, al as ProductOptionsSelect, s as ProductTag, an as ProductTagsSelect, q as ProductVariant, ak as ProductVariantsSelect, aj as ProductsSelect, D as ReturnProduct, av as ReturnProductsSelect, au as ReturnsSelect, aI as ShippingPoliciesSelect, v as ShippingPolicy, l as Subscription, af as SubscriptionsSelect, S as SupportedTimezones, h as Tenant, n as TenantLogo, ah as TenantLogosSelect, ad as TenantMetadataSelect, i as TenantMetadatum, j as TenantOgImage, ai as TenantOgImagesSelect, ac as TenantsSelect, aA as TransactionsSelect, g as User, U as UserAuthOperations, a8 as UsersSelect } from './payload-types-D0px2DCK.js';
3
- import { F as FetchOptions, A as ApiQueryOptions, P as PayloadFindResponse, a as PayloadMutationResponse, C as ClientBrowserConfig, b as ClientState, c as ClientServerConfig } from './auth-Cj3nVn_P.js';
4
- export { t as API_URLS, f as ApiError, y as ApiQueryReactOptions, w as ClientMetadata, g as ConfigError, d as DebugConfig, D as DeepPartial, s as Environment, e as ErrorLogger, E as ExtractArrayType, J as JwtPayload, N as NetworkError, x as PaginationMeta, R as RetryConfig, S as SDKError, T as TimeoutError, U as UsageLimitError, V as ValidationError, q as createApiKey, o as createServerToken, p as decodeServerToken, k as isApiError, l as isConfigError, h as isNetworkError, i as isSDKError, m as isTimeoutError, n as isUsageLimitError, j as isValidationError, r as parseApiKey, u as resolveApiUrl, v as verifyServerToken } from './auth-Cj3nVn_P.js';
1
+ import { O as Order, a as OrderProduct, T as Transaction, b as Fulfillment, R as Return, C as CartItem, P as ProductOption } from './payload-types-CRSz8jfP.js';
2
+ export { k as ApiUsage, ae as ApiUsageSelect, A as Audience, aa as AudiencesSelect, b0 as Auth, m as BillingHistory, ag as BillingHistorySelect, u as Brand, B as BrandLogo, aq as BrandLogosSelect, ap as BrandsSelect, K as Cart, aG as CartItemsSelect, aF as CartsSelect, f as CodeBlock, a$ as CollectionsWidget, c as Config, w as Customer, z as CustomerAddress, aC as CustomerAddressesSelect, d as CustomerAuthOperations, x as CustomerGroup, y as CustomerGroupImage, aE as CustomerGroupImagesSelect, aD as CustomerGroupsSelect, aB as CustomersSelect, L as Discount, aH as DiscountsSelect, Y as Document, aP as DocumentCategoriesSelect, $ as DocumentCategory, _ as DocumentImage, aR as DocumentImagesSelect, Z as DocumentType, aQ as DocumentTypesSelect, aO as DocumentsSelect, E as EmailLog, ab as EmailLogsSelect, G as Exchange, H as ExchangeProduct, ax as ExchangeProductsSelect, aw as ExchangesSelect, F as Form, a3 as FormSubmission, aW as FormSubmissionsSelect, aV as FormsSelect, J as FulfillmentItem, az as FulfillmentItemsSelect, ay as FulfillmentsSelect, I as IframeBlock, M as Media, a9 as MediaSelect, a1 as Music, aT as MusicsSelect, at as OrderProductsSelect, as as OrdersSelect, a4 as PayloadKv, aX as PayloadKvSelect, a5 as PayloadLockedDocument, aY as PayloadLockedDocumentsSelect, a7 as PayloadMigration, a_ as PayloadMigrationsSelect, a6 as PayloadPreference, aZ as PayloadPreferencesSelect, e as PlayerBlock, a0 as Playlist, a2 as PlaylistImage, aU as PlaylistImagesSelect, aS as PlaylistsSelect, N as Post, V as PostAuthor, aK as PostAuthorsSelect, aL as PostCategoriesSelect, W as PostCategory, Q as PostImage, aN as PostImagesSelect, X as PostTag, aM as PostTagsSelect, aJ as PostsSelect, o as Product, am as ProductCategoriesSelect, r as ProductCategory, t as ProductCollection, ao as ProductCollectionsSelect, p as ProductImage, ar as ProductImagesSelect, al as ProductOptionsSelect, s as ProductTag, an as ProductTagsSelect, q as ProductVariant, ak as ProductVariantsSelect, aj as ProductsSelect, D as ReturnProduct, av as ReturnProductsSelect, au as ReturnsSelect, aI as ShippingPoliciesSelect, v as ShippingPolicy, l as Subscription, af as SubscriptionsSelect, S as SupportedTimezones, h as Tenant, n as TenantLogo, ah as TenantLogosSelect, ad as TenantMetadataSelect, i as TenantMetadatum, j as TenantOgImage, ai as TenantOgImagesSelect, ac as TenantsSelect, aA as TransactionsSelect, g as User, U as UserAuthOperations, a8 as UsersSelect } from './payload-types-CRSz8jfP.js';
3
+ import { F as FetchOptions, A as ApiQueryOptions, P as PayloadFindResponse, a as PayloadMutationResponse, C as ClientBrowserConfig, b as ClientState, c as ClientServerConfig } from './auth-D-_Ju7m5.js';
4
+ export { t as API_URLS, f as ApiError, y as ApiQueryReactOptions, w as ClientMetadata, g as ConfigError, d as DebugConfig, D as DeepPartial, s as Environment, e as ErrorLogger, E as ExtractArrayType, J as JwtPayload, N as NetworkError, x as PaginationMeta, R as RetryConfig, S as SDKError, T as TimeoutError, U as UsageLimitError, V as ValidationError, q as createApiKey, o as createServerToken, p as decodeServerToken, k as isApiError, l as isConfigError, h as isNetworkError, i as isSDKError, m as isTimeoutError, n as isUsageLimitError, j as isValidationError, r as parseApiKey, u as resolveApiUrl, v as verifyServerToken } from './auth-D-_Ju7m5.js';
5
5
  import * as _tanstack_react_query from '@tanstack/react-query';
6
6
  import { QueryClient } from '@tanstack/react-query';
7
- import { P as PublicCollection, C as CollectionType } from './webhook-vrlAV1K7.js';
8
- export { b as COLLECTIONS, a as Collection, c as WebhookEvent, d as WebhookHandler, W as WebhookOperation, e as WebhookOptions, f as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-vrlAV1K7.js';
7
+ import { P as PublicCollection, C as CollectionType } from './webhook-C_DHB0Sw.js';
8
+ export { b as COLLECTIONS, a as Collection, c as WebhookEvent, d as WebhookHandler, W as WebhookOperation, e as WebhookOptions, f as createTypedWebhookHandler, h as handleWebhook, i as isValidWebhookEvent } from './webhook-C_DHB0Sw.js';
9
9
  import { Metadata } from 'next';
10
- import { GenerateMetadataOptions } from './metadata.js';
11
10
  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';
12
11
  import 'payload';
13
12
 
@@ -167,6 +166,12 @@ declare class ProductApi {
167
166
  stockCheck(params: StockCheckParams): Promise<StockCheckResponse>;
168
167
  }
169
168
 
169
+ interface GenerateMetadataOptions {
170
+ title?: string;
171
+ description?: string;
172
+ siteName?: string;
173
+ }
174
+
170
175
  declare class HttpClient {
171
176
  protected clientKey: string;
172
177
  protected secretKey?: string;
@@ -664,4 +669,4 @@ declare const resolveRelation: <T>(ref: T | string | number | null | undefined)
664
669
  /** @deprecated Use `resolveRelation` instead */
665
670
  declare const objectFor: <T>(ref: T | string | number | null | undefined) => T | null;
666
671
 
667
- export { type AddItemParams, ApiQueryOptions, BrowserClient, BrowserClient as BrowserClientType, CartApi, type CartApiOptions, CartItem, type CheckoutParams, ClientBrowserConfig, ClientServerConfig, ClientState, CollectionClient, type CollectionDetailQueryParams, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, Fulfillment, type GetOrderParams, Order, OrderApi, type OrderApiOptions, OrderProduct, PayloadFindResponse, PayloadMutationResponse, ProductApi, type ProductApiOptions, ProductOption, PublicCollection, QueryHooks, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveItemParams, Return, type ReturnWithRefundParams, ServerClient, ServerClient as ServerClientType, type StockCheckParams, type StockCheckResponse, type StockCheckResult, Transaction, type UpdateItemParams, type UpdateOrderParams, type UpdateReturnParams, type UpdateTransactionParams, collectionKeys, createBrowserClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, objectFor, resolveRelation };
672
+ export { type AddItemParams, ApiQueryOptions, BrowserClient, BrowserClient as BrowserClientType, CartApi, type CartApiOptions, CartItem, type CheckoutParams, ClientBrowserConfig, ClientServerConfig, ClientState, CollectionClient, type CollectionDetailQueryParams, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, Fulfillment, type GenerateMetadataOptions, type GetOrderParams, Order, OrderApi, type OrderApiOptions, OrderProduct, PayloadFindResponse, PayloadMutationResponse, ProductApi, type ProductApiOptions, ProductOption, PublicCollection, QueryHooks, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveItemParams, Return, type ReturnWithRefundParams, ServerClient, ServerClient as ServerClientType, type StockCheckParams, type StockCheckResponse, type StockCheckResult, Transaction, type UpdateItemParams, type UpdateOrderParams, type UpdateReturnParams, type UpdateTransactionParams, collectionKeys, createBrowserClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, objectFor, resolveRelation };
package/dist/index.js CHANGED
@@ -640,12 +640,27 @@ var resolveRelation = (ref) => {
640
640
  var objectFor = resolveRelation;
641
641
 
642
642
  // src/core/metadata/index.ts
643
- function generateMetadata(doc, options) {
643
+ var COLLECTION_META_FIELDS = {
644
+ products: { description: "subtitle", image: "thumbnail" },
645
+ posts: { description: "excerpt", image: "thumbnail" },
646
+ documents: { description: "summary", image: "" },
647
+ playlists: { description: "description", image: "image" }
648
+ };
649
+ var DEFAULT_META_FIELDS = { description: "description", image: "thumbnail" };
650
+ function extractMetaFields(collection, doc) {
651
+ var _a, _b, _c, _d;
652
+ const mapping = (_a = COLLECTION_META_FIELDS[collection]) != null ? _a : DEFAULT_META_FIELDS;
653
+ return {
654
+ title: (_b = doc.title) != null ? _b : null,
655
+ description: mapping.description ? (_c = doc[mapping.description]) != null ? _c : null : null,
656
+ image: mapping.image ? (_d = doc[mapping.image]) != null ? _d : null : null
657
+ };
658
+ }
659
+ function generateMetadata(input, options) {
644
660
  var _a, _b, _c, _d;
645
- const meta = doc == null ? void 0 : doc.meta;
646
- const title = (_b = (_a = meta == null ? void 0 : meta.title) != null ? _a : options == null ? void 0 : options.title) != null ? _b : void 0;
647
- const description = (_d = (_c = meta == null ? void 0 : meta.description) != null ? _c : options == null ? void 0 : options.description) != null ? _d : void 0;
648
- const image = resolveMetaImage(meta == null ? void 0 : meta.image);
661
+ const title = (_b = (_a = input.title) != null ? _a : options == null ? void 0 : options.title) != null ? _b : void 0;
662
+ const description = (_d = (_c = input.description) != null ? _c : options == null ? void 0 : options.description) != null ? _d : void 0;
663
+ const image = resolveMetaImage(input.image);
649
664
  return {
650
665
  title,
651
666
  description,
@@ -656,11 +671,17 @@ function generateMetadata(doc, options) {
656
671
  };
657
672
  }
658
673
  function resolveMetaImage(ref) {
659
- const media = resolveRelation(ref);
660
- if (!(media == null ? void 0 : media.url)) return null;
674
+ var _a;
675
+ const image = resolveRelation(ref);
676
+ if (!image) return null;
677
+ const sized = (_a = image.sizes) == null ? void 0 : _a["1536"];
678
+ const url = (sized == null ? void 0 : sized.url) || image.url;
679
+ if (!url) return null;
680
+ const width = (sized == null ? void 0 : sized.url) ? sized.width : image.width;
681
+ const height = (sized == null ? void 0 : sized.url) ? sized.height : image.height;
661
682
  return __spreadValues(__spreadValues(__spreadValues({
662
- url: media.url
663
- }, media.width && { width: media.width }), media.height && { height: media.height }), media.alt && { alt: media.alt });
683
+ url
684
+ }, width && { width }), height && { height }), image.alt && { alt: image.alt });
664
685
  }
665
686
 
666
687
  // src/core/collection/query-builder.ts
@@ -745,7 +766,7 @@ var CollectionQueryBuilder = class {
745
766
  const doc = docs[0];
746
767
  if (!doc) return null;
747
768
  return generateMetadata(
748
- doc,
769
+ extractMetaFields(String(this.collection), doc),
749
770
  metadataOptions
750
771
  );
751
772
  });
@@ -759,7 +780,7 @@ var CollectionQueryBuilder = class {
759
780
  return __async(this, null, function* () {
760
781
  const doc = yield this.findById(id, { depth: 1 });
761
782
  return generateMetadata(
762
- doc,
783
+ extractMetaFields(String(this.collection), doc),
763
784
  metadataOptions
764
785
  );
765
786
  });