@anker-in/shopify-sdk 1.2.0-beta.10 → 1.2.0-beta.11

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.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ShopifyClient } from './client/index.js';
2
2
  export { FetchOptions, GraphQLError, GraphQLRequest, GraphQLResponse, createShopifyClient } from './client/index.js';
3
- export { articleFragment, articleWithMetafieldsFragment, blogFragment, blogWithMetafieldsFragment, cartFragment, collectionFragment, imageFragment, metafieldFragment, metafieldFragmentStr, pageInfoFragment, productFragment, seoFragment, variantFragment } from './fragments/index.js';
3
+ export { articleFragment, articleWithMetafieldsFragment, blogFragment, blogWithMetafieldsFragment, cartFragment, collectionFragment, imageFragment, metafieldFragment, metafieldFragmentStr, pageFragment, pageInfoFragment, pageWithMetafieldsFragment, productFragment, seoFragment, shopFragment, shopWithMetafieldsFragment, variantFragment } from './fragments/index.js';
4
4
  export { getAllProductsPathsQuery, getCartQuery, getCollectionsByHandlesQuery, getProductQuery, getProductsByHandlesQuery, getProductsQuery } from './queries/index.js';
5
5
  export { addCartItemsMutation, createCartMutation, removeCartItemsMutation, updateBuyerIdentityMutation, updateCartAttributesMutation, updateCartDeliveryOptionsMutation, updateCartDiscountCodeMutation, updateCartItemsMutation } from './mutations/index.js';
6
6
  export * from '@anker-in/shopify-core';
@@ -11029,17 +11029,15 @@ declare function getCollections(client: ShopifyClient, options: GetCollectionsOp
11029
11029
  /**
11030
11030
  * 批量获取 Collections(支持 product 和 variant metafields)
11031
11031
  *
11032
- * @param locale - 语言区域
11033
- * @param handles - Collection handles 数组
11034
- * @param metafieldsIdentifiers - Metafields 标识符(collection/product/variant)
11032
+ * @param client - Shopify GraphQL client
11033
+ * @param options - Get collections by handles options
11035
11034
  * @returns Collections 数组
11036
11035
  *
11037
11036
  * @example
11038
11037
  * ```tsx
11039
- * const collections = await getCollectionsByHandles({
11040
- * locale: 'EN-US',
11038
+ * const collections = await getCollectionsByHandles(client, {
11041
11039
  * handles: ['power-banks', 'chargers'],
11042
- * metafieldsIdentifiers: {
11040
+ * metafieldIdentifiers: {
11043
11041
  * collection: collectionMetafieldIdentifiers,
11044
11042
  * product: productMetafieldIdentifiers,
11045
11043
  * variant: variantMetafieldIdentifiers,
@@ -11047,10 +11045,7 @@ declare function getCollections(client: ShopifyClient, options: GetCollectionsOp
11047
11045
  * })
11048
11046
  * ```
11049
11047
  */
11050
- declare const getCollectionsByHandles: ({ client, options, }: {
11051
- client: ShopifyClient;
11052
- options: GetCollectionsByHandlesOptions;
11053
- }) => Promise<(NormalizedCollection | undefined)[]>;
11048
+ declare function getCollectionsByHandles(client: ShopifyClient, options: GetCollectionsByHandlesOptions): Promise<(NormalizedCollection | undefined)[]>;
11054
11049
 
11055
11050
  /**
11056
11051
  * Blog API Types
@@ -11178,4 +11173,86 @@ declare function getArticles(client: ShopifyClient, options: GetArticlesOptions)
11178
11173
 
11179
11174
  declare function getArticlesInBlog(client: ShopifyClient, options: GetArticlesInBlogOptions): Promise<NormalizedArticle[]>;
11180
11175
 
11181
- export { type AddCartLinesOptions, type AddToCartMutation, type AddToCartMutationVariables, type ApiVersion, type ApplePayWalletContentInput, type ApplePayWalletHeaderInput, type AppliedGiftCard, type Article, type ArticleAuthor, type ArticleCommentsArgs, type ArticleConnection, type ArticleContentArgs, type ArticleEdge, type ArticleExcerptArgs, type ArticleFragment, type ArticleMetafieldArgs, type ArticleMetafieldsArgs, ArticleSortKeys, type ArticleWithMetafieldsFragment, type Attribute, type AttributeInput, type AutomaticDiscountApplication, type BaseCartLine, type BaseCartLineAttributeArgs, type BaseCartLineConnection, type BaseCartLineEdge, type Blog, type BlogArticleByHandleArgs, type BlogArticlesArgs, type BlogConnection, type BlogEdge, type BlogFragment, type BlogMetafieldArgs, type BlogMetafieldsArgs, BlogSortKeys, type BlogWithMetafieldsFragment, type Brand, type BrandColorGroup, type BrandColors, type BuyerIdentityInput, type BuyerInput, CardBrand, type Cart, type CartAPIOptions, type CartAddress, type CartAddressInput, type CartAttributeArgs, type CartAttributesUpdateMutation, type CartAttributesUpdateMutationVariables, type CartAttributesUpdatePayload, type CartAutomaticDiscountAllocation, type CartBillingAddressUpdatePayload, type CartBuyerIdentity, type CartBuyerIdentityInput, type CartBuyerIdentityUpdatePayload, CartCardSource, type CartCodeDiscountAllocation, type CartCompletionAction, type CartCompletionActionRequired, type CartCompletionAttemptResult, type CartCompletionFailed, type CartCompletionProcessing, type CartCompletionSuccess, type CartCookieAdapter, type CartCost, type CartCreatePayload, type CartCustomDiscountAllocation, type CartDelivery, type CartDeliveryAddress, type CartDeliveryAddressFormattedArgs, type CartDeliveryAddressInput, type CartDeliveryAddressesAddPayload, type CartDeliveryAddressesArgs, type CartDeliveryAddressesRemovePayload, type CartDeliveryAddressesUpdatePayload, type CartDeliveryCoordinatesPreference, type CartDeliveryCoordinatesPreferenceInput, type CartDeliveryGroup, type CartDeliveryGroupCartLinesArgs, type CartDeliveryGroupConnection, type CartDeliveryGroupEdge, CartDeliveryGroupType, type CartDeliveryGroupsArgs, type CartDeliveryInput, type CartDeliveryOption, type CartDeliveryPreference, type CartDeliveryPreferenceInput, type CartDirectPaymentMethodInput, type CartDiscountAllocation, type CartDiscountApplication, type CartDiscountCode, type CartDiscountCodesUpdateMutation, type CartDiscountCodesUpdateMutationVariables, type CartDiscountCodesUpdatePayload, CartErrorCode, type CartEstimatedCost, type CartFragment, type CartFreePaymentMethodInput, type CartGiftCardCodesRemovePayload, type CartGiftCardCodesUpdatePayload, type CartInput, type CartInputMetafieldInput, type CartLine, type CartLineAttributeArgs, type CartLineCost, type CartLineEstimatedCost, type CartLineInput, type CartLineUpdateInput, type CartLinesAddPayload, type CartLinesArgs, type CartLinesRemovePayload, type CartLinesUpdatePayload, type CartMetafieldArgs, type CartMetafieldDeleteInput, type CartMetafieldDeletePayload, type CartMetafieldsArgs, type CartMetafieldsSetInput, type CartMetafieldsSetPayload, type CartNoteUpdatePayload, type CartOperationError, type CartOperationResult, type CartPaymentInput, type CartPaymentUpdatePayload, type CartPreferences, type CartPreferencesInput, type CartPrepareForCompletionPayload, type CartPrepareForCompletionResult, type CartSelectableAddress, type CartSelectableAddressInput, type CartSelectableAddressUpdateInput, type CartSelectedDeliveryOptionInput, type CartSelectedDeliveryOptionsUpdatePayload, type CartStatusNotReady, type CartStatusReady, type CartSubmitForCompletionPayload, type CartSubmitForCompletionResult, type CartThrottled, type CartUserError, type CartWalletPaymentMethodInput, type CartWarning, CartWarningCode, type CategoryFilter, type Collection, type CollectionConnection, type CollectionDescriptionArgs, type CollectionEdge, type CollectionFragment, type CollectionMetafieldArgs, type CollectionMetafieldsArgs, type CollectionProductsArgs, CollectionSortKeys, type CollectionsConnection, type Comment, type CommentAuthor, type CommentConnection, type CommentContentArgs, type CommentEdge, type Company, type CompanyContact, type CompanyLocation, type CompanyLocationMetafieldArgs, type CompanyLocationMetafieldsArgs, type CompanyMetafieldArgs, type CompanyMetafieldsArgs, type CompletePaymentChallenge, type CompletionError, CompletionErrorCode, type ComponentizableCartLine, type ComponentizableCartLineAttributeArgs, type Count, CountPrecision, type Country, CountryCode, type CreateCartMutation, type CreateCartMutationVariables, type CreateCartOptions, CropRegion, type Currency, CurrencyCode, type Customer, type CustomerAccessToken, type CustomerAccessTokenCreateInput, type CustomerAccessTokenCreatePayload, type CustomerAccessTokenCreateWithMultipassPayload, type CustomerAccessTokenDeletePayload, type CustomerAccessTokenRenewPayload, type CustomerActivateByUrlPayload, type CustomerActivateInput, type CustomerActivatePayload, type CustomerAddressCreatePayload, type CustomerAddressDeletePayload, type CustomerAddressUpdatePayload, type CustomerAddressesArgs, type CustomerCreateInput, type CustomerCreatePayload, type CustomerDefaultAddressUpdatePayload, CustomerErrorCode, type CustomerMetafieldArgs, type CustomerMetafieldsArgs, type CustomerOrdersArgs, type CustomerRecoverPayload, type CustomerResetByUrlPayload, type CustomerResetInput, type CustomerResetPayload, type CustomerUpdateInput, type CustomerUpdatePayload, type CustomerUserError, type DeliveryAddress, type DeliveryAddressInput, DeliveryAddressValidationStrategy, DeliveryMethodType, DigitalWallet, type DiscountAllocation, type DiscountApplication, DiscountApplicationAllocationMethod, type DiscountApplicationConnection, type DiscountApplicationEdge, DiscountApplicationTargetSelection, DiscountApplicationTargetType, type DiscountCodeApplication, type DisplayableError, type Domain, type EditCartItemsMutation, type EditCartItemsMutationVariables, type Exact, type ExternalVideo, type Filter, FilterPresentation, FilterType, type FilterValue, type Fulfillment, type FulfillmentFulfillmentLineItemsArgs, type FulfillmentLineItem, type FulfillmentLineItemConnection, type FulfillmentLineItemEdge, type FulfillmentTrackingInfo, type FulfillmentTrackingInfoArgs, type GenericFile, type GeoCoordinateInput, type GetAllBlogsOptions, type GetAllProductPathsQuery, type GetAllProductPathsQueryVariables, type GetAllProductsOptions, type GetArticleOptions, type GetArticlesInBlogOptions, type GetArticlesOptions, type GetBlogOptions, type GetCartOptions, type GetCartQuery, type GetCartQueryVariables, type GetCollectionOptions, type GetCollectionsByHandlesOptions, type GetCollectionsOptions, type GetProductByHandleQuery, type GetProductByHandleQueryVariables, type GetProductOptions, type GetProductsByHandlesOptions, type GetProductsQuery, type GetProductsQueryVariables, type HasMetafields, type HasMetafieldsIdentifier, type HasMetafieldsMetafieldArgs, type HasMetafieldsMetafieldsArgs, type Image, type ImageConnection, ImageContentType, type ImageEdge, type ImageFragment, type ImageTransformInput, type ImageTransformedSrcArgs, type ImageUrlArgs, type InContextAnnotation, type InContextAnnotationType, type Incremental, type InputMaybe, type Language, LanguageCode, type Localization, type Location, type LocationAddress, type LocationConnection, type LocationEdge, type LocationMetafieldArgs, type LocationMetafieldsArgs, LocationSortKeys, type MailingAddress, type MailingAddressConnection, type MailingAddressEdge, type MailingAddressFormattedArgs, type MailingAddressInput, type MakeEmpty, type MakeMaybe, type MakeOptional, type ManualDiscountApplication, type Market, type MarketMetafieldArgs, type MarketMetafieldsArgs, type Maybe, type Media, type MediaConnection, MediaContentType, type MediaEdge, MediaHost, type MediaImage, type MediaPresentation, type MediaPresentationAsJsonArgs, MediaPresentationFormat, type Menu, type MenuItem, type MenuItemResource, MenuItemType, type Merchandise, type Metafield, MetafieldDeleteErrorCode, type MetafieldDeleteUserError, type MetafieldFilter, type MetafieldFragment, type MetafieldParentResource, type MetafieldReference, type MetafieldReferenceConnection, type MetafieldReferenceEdge, type MetafieldReferencesArgs, type MetafieldsSetUserError, MetafieldsSetUserErrorCode, type Metaobject, type MetaobjectConnection, type MetaobjectEdge, type MetaobjectField, type MetaobjectFieldArgs, type MetaobjectFieldReferencesArgs, type MetaobjectHandleInput, type MetaobjectSeo, type Model3d, type Model3dSource, type MoneyInput, type MoneyV2, type Mutation, type MutationCartAttributesUpdateArgs, type MutationCartBillingAddressUpdateArgs, type MutationCartBuyerIdentityUpdateArgs, type MutationCartCreateArgs, type MutationCartDeliveryAddressesAddArgs, type MutationCartDeliveryAddressesRemoveArgs, type MutationCartDeliveryAddressesUpdateArgs, type MutationCartDiscountCodesUpdateArgs, type MutationCartGiftCardCodesRemoveArgs, type MutationCartGiftCardCodesUpdateArgs, type MutationCartLinesAddArgs, type MutationCartLinesRemoveArgs, type MutationCartLinesUpdateArgs, type MutationCartMetafieldDeleteArgs, type MutationCartMetafieldsSetArgs, type MutationCartNoteUpdateArgs, type MutationCartPaymentUpdateArgs, type MutationCartPrepareForCompletionArgs, type MutationCartSelectedDeliveryOptionsUpdateArgs, type MutationCartSubmitForCompletionArgs, type MutationCustomerAccessTokenCreateArgs, type MutationCustomerAccessTokenCreateWithMultipassArgs, type MutationCustomerAccessTokenDeleteArgs, type MutationCustomerAccessTokenRenewArgs, type MutationCustomerActivateArgs, type MutationCustomerActivateByUrlArgs, type MutationCustomerAddressCreateArgs, type MutationCustomerAddressDeleteArgs, type MutationCustomerAddressUpdateArgs, type MutationCustomerCreateArgs, type MutationCustomerDefaultAddressUpdateArgs, type MutationCustomerRecoverArgs, type MutationCustomerResetArgs, type MutationCustomerResetByUrlArgs, type MutationCustomerUpdateArgs, type MutationShopPayPaymentRequestSessionCreateArgs, type MutationShopPayPaymentRequestSessionSubmitArgs, type Node, type NormalizedArticle, type NormalizedAttribute, type NormalizedBlog, type NormalizedCart, type NormalizedCollection, type NormalizedLineItem, type NormalizedProduct, type NormalizedProductVariant, type NormalizedProductsConnection, type NormalizedSellingPlanGroup, type OnlineStorePublishable, type Order, OrderCancelReason, type OrderConnection, type OrderDiscountApplicationsArgs, type OrderEdge, OrderFinancialStatus, OrderFulfillmentStatus, type OrderLineItem, type OrderLineItemConnection, type OrderLineItemEdge, type OrderLineItemsArgs, type OrderMetafieldArgs, type OrderMetafieldsArgs, OrderSortKeys, type OrderSuccessfulFulfillmentsArgs, type Page, type PageConnection, type PageEdge, type PageInfo, type PageInfoFragment, type PageMetafieldArgs, type PageMetafieldsArgs, PageSortKeys, type PaginatedSitemapResources, type PaymentSettings, PredictiveSearchLimitScope, type PredictiveSearchResult, PredictiveSearchType, PreferenceDeliveryMethodType, type PriceRangeFilter, type PricingPercentageValue, type PricingValue, type Product, type ProductAdjacentVariantsArgs, ProductCollectionSortKeys, type ProductCollectionsArgs, type ProductConnection, type ProductDescriptionArgs, type ProductEdge, type ProductFilter, type ProductFragment, ProductImageSortKeys, type ProductImagesArgs, type ProductMediaArgs, ProductMediaSortKeys, type ProductMetafieldArgs, type ProductMetafieldsArgs, type ProductOption, type ProductOptionValue, type ProductOptionValueSwatch, type ProductOptionsArgs, type ProductPriceRange, ProductRecommendationIntent, type ProductSelectedOrFirstAvailableVariantArgs, type ProductSellingPlanGroupsArgs, ProductSortKeys, type ProductVariant, type ProductVariantBySelectedOptionsArgs, type ProductVariantComponent, type ProductVariantComponentConnection, type ProductVariantComponentEdge, type ProductVariantComponentsArgs, type ProductVariantConnection, type ProductVariantEdge, type ProductVariantGroupedByArgs, type ProductVariantMetafieldArgs, type ProductVariantMetafieldsArgs, type ProductVariantQuantityPriceBreaksArgs, type ProductVariantSellingPlanAllocationsArgs, ProductVariantSortKeys, type ProductVariantStoreAvailabilityArgs, type ProductVariantsArgs, type PurchasingCompany, type QuantityPriceBreak, type QuantityPriceBreakConnection, type QuantityPriceBreakEdge, type QuantityRule, type QueryRoot, type QueryRootArticleArgs, type QueryRootArticlesArgs, type QueryRootBlogArgs, type QueryRootBlogByHandleArgs, type QueryRootBlogsArgs, type QueryRootCartArgs, type QueryRootCartCompletionAttemptArgs, type QueryRootCollectionArgs, type QueryRootCollectionByHandleArgs, type QueryRootCollectionsArgs, type QueryRootCustomerArgs, type QueryRootLocationsArgs, type QueryRootMenuArgs, type QueryRootMetaobjectArgs, type QueryRootMetaobjectsArgs, type QueryRootNodeArgs, type QueryRootNodesArgs, type QueryRootPageArgs, type QueryRootPageByHandleArgs, type QueryRootPagesArgs, type QueryRootPredictiveSearchArgs, type QueryRootProductArgs, type QueryRootProductByHandleArgs, type QueryRootProductRecommendationsArgs, type QueryRootProductTagsArgs, type QueryRootProductTypesArgs, type QueryRootProductsArgs, type QueryRootSearchArgs, type QueryRootSitemapArgs, type QueryRootUrlRedirectsArgs, type RemoveCartLinesOptions, type RemoveFromCartMutation, type RemoveFromCartMutationVariables, type Scalars, type ScriptDiscountApplication, SearchPrefixQueryType, type SearchQuerySuggestion, type SearchResultItem, type SearchResultItemConnection, type SearchResultItemEdge, SearchSortKeys, SearchType, SearchUnavailableProductsType, SearchableField, type SelectedOption, type SelectedOptionInput, type SellingPlan, type SellingPlanAllocation, type SellingPlanAllocationConnection, type SellingPlanAllocationEdge, type SellingPlanAllocationPriceAdjustment, type SellingPlanBillingPolicy, type SellingPlanCheckoutCharge, type SellingPlanCheckoutChargePercentageValue, SellingPlanCheckoutChargeType, type SellingPlanCheckoutChargeValue, type SellingPlanConnection, type SellingPlanDeliveryPolicy, type SellingPlanEdge, type SellingPlanFixedAmountPriceAdjustment, type SellingPlanFixedPriceAdjustment, type SellingPlanGroup, type SellingPlanGroupConnection, type SellingPlanGroupEdge, type SellingPlanGroupOption, type SellingPlanGroupSellingPlansArgs, SellingPlanInterval, type SellingPlanMetafieldArgs, type SellingPlanMetafieldsArgs, type SellingPlanOption, type SellingPlanPercentagePriceAdjustment, type SellingPlanPriceAdjustment, type SellingPlanPriceAdjustmentValue, type SellingPlanRecurringBillingPolicy, type SellingPlanRecurringDeliveryPolicy, type Seo, type SeoFragment, type Shop, type ShopMetafieldArgs, type ShopMetafieldsArgs, type ShopPayInstallmentsFinancingPlan, ShopPayInstallmentsFinancingPlanFrequency, type ShopPayInstallmentsFinancingPlanTerm, ShopPayInstallmentsLoan, type ShopPayInstallmentsPricing, type ShopPayInstallmentsProductVariantPricing, type ShopPayPaymentRequest, type ShopPayPaymentRequestContactField, type ShopPayPaymentRequestDeliveryMethod, type ShopPayPaymentRequestDeliveryMethodInput, ShopPayPaymentRequestDeliveryMethodType, type ShopPayPaymentRequestDiscount, type ShopPayPaymentRequestDiscountInput, type ShopPayPaymentRequestImage, type ShopPayPaymentRequestImageInput, type ShopPayPaymentRequestInput, type ShopPayPaymentRequestLineItem, type ShopPayPaymentRequestLineItemInput, type ShopPayPaymentRequestReceipt, type ShopPayPaymentRequestSession, type ShopPayPaymentRequestSessionCreatePayload, type ShopPayPaymentRequestSessionSubmitPayload, type ShopPayPaymentRequestShippingLine, type ShopPayPaymentRequestShippingLineInput, type ShopPayPaymentRequestTotalShippingPrice, type ShopPayPaymentRequestTotalShippingPriceInput, type ShopPayWalletContentInput, type ShopPolicy, type ShopPolicyWithDefault, ShopifyClient, type Sitemap, type SitemapImage, type SitemapResource, type SitemapResourceInterface, type SitemapResourceMetaobject, type SitemapResourcesArgs, SitemapType, type StoreAvailability, type StoreAvailabilityConnection, type StoreAvailabilityEdge, type StringConnection, type StringEdge, type SubmissionError, SubmissionErrorCode, type SubmitAlreadyAccepted, type SubmitFailed, type SubmitSuccess, type SubmitThrottled, type Swatch, type TaxonomyCategory, type TaxonomyMetafieldFilter, type Trackable, type UnitPriceMeasurement, UnitPriceMeasurementMeasuredType, UnitPriceMeasurementMeasuredUnit, UnitSystem, type UpdateBuyerIdentityOptions, type UpdateCartAttributesOptions, type UpdateCartCodesOptions, type UpdateCartDeliveryOptions, type UpdateCartDeliveryOptionsMutation, type UpdateCartDeliveryOptionsMutationVariables, type UpdateCartLinesOptions, type UrlRedirect, type UrlRedirectConnection, type UrlRedirectEdge, type UserError, type UserErrorsShopPayPaymentRequestSessionUserErrors, UserErrorsShopPayPaymentRequestSessionUserErrorsCode, type VariantFragment, type VariantOptionFilter, type Video, type VideoSource, WeightUnit, addCartLines, createCart, getAllBlogs, getAllCollections, getAllProducts, getArticle, getArticles, getArticlesInBlog, getBlog, getCart, getCollection, getCollections, getCollectionsByHandles, getProduct, getProducts, getProductsByHandles, normalizeArticle, normalizeBlog, normalizeCart, normalizeCollection, normalizeLineItem, normalizeProduct, removeCartLines, updateBuyerIdentity, updateCartAttributes, updateCartCodes, updateCartDeliveryOptions, updateCartLines };
11176
+ /**
11177
+ * Page API Types
11178
+ */
11179
+
11180
+ interface NormalizedPage {
11181
+ id: string;
11182
+ handle: string;
11183
+ title: string;
11184
+ body?: string;
11185
+ bodySummary?: string;
11186
+ createdAt: string;
11187
+ updatedAt: string;
11188
+ seo?: Seo;
11189
+ metafields?: Record<string, Metafield>;
11190
+ }
11191
+ interface GetPageOptions {
11192
+ handle: string;
11193
+ locale: string;
11194
+ graphqlQuery?: string;
11195
+ metafieldIdentifiers?: Array<{
11196
+ namespace: string;
11197
+ key: string;
11198
+ }>;
11199
+ }
11200
+
11201
+ /**
11202
+ * Get Page API
11203
+ */
11204
+
11205
+ declare function getPage(client: ShopifyClient, options: GetPageOptions): Promise<NormalizedPage | undefined>;
11206
+
11207
+ /**
11208
+ * Page Normalization Functions
11209
+ */
11210
+
11211
+ declare function normalizePage(page: any): NormalizedPage;
11212
+
11213
+ /**
11214
+ * Shop API Types
11215
+ */
11216
+
11217
+ interface NormalizedShop {
11218
+ name: string;
11219
+ description?: string;
11220
+ primaryDomain: {
11221
+ url: string;
11222
+ host: string;
11223
+ };
11224
+ brand?: {
11225
+ logo?: {
11226
+ image?: {
11227
+ url: string;
11228
+ };
11229
+ };
11230
+ colors?: {
11231
+ primary?: string;
11232
+ secondary?: string;
11233
+ };
11234
+ };
11235
+ metafields?: Record<string, Metafield>;
11236
+ }
11237
+ interface GetShopOptions {
11238
+ locale: string;
11239
+ graphqlQuery?: string;
11240
+ metafieldIdentifiers?: Array<{
11241
+ namespace: string;
11242
+ key: string;
11243
+ }>;
11244
+ }
11245
+
11246
+ /**
11247
+ * Get Shop API
11248
+ */
11249
+
11250
+ declare function getShop(client: ShopifyClient, options: GetShopOptions): Promise<NormalizedShop | undefined>;
11251
+
11252
+ /**
11253
+ * Shop Normalization Functions
11254
+ */
11255
+
11256
+ declare function normalizeShop(shop: any): NormalizedShop;
11257
+
11258
+ export { type AddCartLinesOptions, type AddToCartMutation, type AddToCartMutationVariables, type ApiVersion, type ApplePayWalletContentInput, type ApplePayWalletHeaderInput, type AppliedGiftCard, type Article, type ArticleAuthor, type ArticleCommentsArgs, type ArticleConnection, type ArticleContentArgs, type ArticleEdge, type ArticleExcerptArgs, type ArticleFragment, type ArticleMetafieldArgs, type ArticleMetafieldsArgs, ArticleSortKeys, type ArticleWithMetafieldsFragment, type Attribute, type AttributeInput, type AutomaticDiscountApplication, type BaseCartLine, type BaseCartLineAttributeArgs, type BaseCartLineConnection, type BaseCartLineEdge, type Blog, type BlogArticleByHandleArgs, type BlogArticlesArgs, type BlogConnection, type BlogEdge, type BlogFragment, type BlogMetafieldArgs, type BlogMetafieldsArgs, BlogSortKeys, type BlogWithMetafieldsFragment, type Brand, type BrandColorGroup, type BrandColors, type BuyerIdentityInput, type BuyerInput, CardBrand, type Cart, type CartAPIOptions, type CartAddress, type CartAddressInput, type CartAttributeArgs, type CartAttributesUpdateMutation, type CartAttributesUpdateMutationVariables, type CartAttributesUpdatePayload, type CartAutomaticDiscountAllocation, type CartBillingAddressUpdatePayload, type CartBuyerIdentity, type CartBuyerIdentityInput, type CartBuyerIdentityUpdatePayload, CartCardSource, type CartCodeDiscountAllocation, type CartCompletionAction, type CartCompletionActionRequired, type CartCompletionAttemptResult, type CartCompletionFailed, type CartCompletionProcessing, type CartCompletionSuccess, type CartCookieAdapter, type CartCost, type CartCreatePayload, type CartCustomDiscountAllocation, type CartDelivery, type CartDeliveryAddress, type CartDeliveryAddressFormattedArgs, type CartDeliveryAddressInput, type CartDeliveryAddressesAddPayload, type CartDeliveryAddressesArgs, type CartDeliveryAddressesRemovePayload, type CartDeliveryAddressesUpdatePayload, type CartDeliveryCoordinatesPreference, type CartDeliveryCoordinatesPreferenceInput, type CartDeliveryGroup, type CartDeliveryGroupCartLinesArgs, type CartDeliveryGroupConnection, type CartDeliveryGroupEdge, CartDeliveryGroupType, type CartDeliveryGroupsArgs, type CartDeliveryInput, type CartDeliveryOption, type CartDeliveryPreference, type CartDeliveryPreferenceInput, type CartDirectPaymentMethodInput, type CartDiscountAllocation, type CartDiscountApplication, type CartDiscountCode, type CartDiscountCodesUpdateMutation, type CartDiscountCodesUpdateMutationVariables, type CartDiscountCodesUpdatePayload, CartErrorCode, type CartEstimatedCost, type CartFragment, type CartFreePaymentMethodInput, type CartGiftCardCodesRemovePayload, type CartGiftCardCodesUpdatePayload, type CartInput, type CartInputMetafieldInput, type CartLine, type CartLineAttributeArgs, type CartLineCost, type CartLineEstimatedCost, type CartLineInput, type CartLineUpdateInput, type CartLinesAddPayload, type CartLinesArgs, type CartLinesRemovePayload, type CartLinesUpdatePayload, type CartMetafieldArgs, type CartMetafieldDeleteInput, type CartMetafieldDeletePayload, type CartMetafieldsArgs, type CartMetafieldsSetInput, type CartMetafieldsSetPayload, type CartNoteUpdatePayload, type CartOperationError, type CartOperationResult, type CartPaymentInput, type CartPaymentUpdatePayload, type CartPreferences, type CartPreferencesInput, type CartPrepareForCompletionPayload, type CartPrepareForCompletionResult, type CartSelectableAddress, type CartSelectableAddressInput, type CartSelectableAddressUpdateInput, type CartSelectedDeliveryOptionInput, type CartSelectedDeliveryOptionsUpdatePayload, type CartStatusNotReady, type CartStatusReady, type CartSubmitForCompletionPayload, type CartSubmitForCompletionResult, type CartThrottled, type CartUserError, type CartWalletPaymentMethodInput, type CartWarning, CartWarningCode, type CategoryFilter, type Collection, type CollectionConnection, type CollectionDescriptionArgs, type CollectionEdge, type CollectionFragment, type CollectionMetafieldArgs, type CollectionMetafieldsArgs, type CollectionProductsArgs, CollectionSortKeys, type CollectionsConnection, type Comment, type CommentAuthor, type CommentConnection, type CommentContentArgs, type CommentEdge, type Company, type CompanyContact, type CompanyLocation, type CompanyLocationMetafieldArgs, type CompanyLocationMetafieldsArgs, type CompanyMetafieldArgs, type CompanyMetafieldsArgs, type CompletePaymentChallenge, type CompletionError, CompletionErrorCode, type ComponentizableCartLine, type ComponentizableCartLineAttributeArgs, type Count, CountPrecision, type Country, CountryCode, type CreateCartMutation, type CreateCartMutationVariables, type CreateCartOptions, CropRegion, type Currency, CurrencyCode, type Customer, type CustomerAccessToken, type CustomerAccessTokenCreateInput, type CustomerAccessTokenCreatePayload, type CustomerAccessTokenCreateWithMultipassPayload, type CustomerAccessTokenDeletePayload, type CustomerAccessTokenRenewPayload, type CustomerActivateByUrlPayload, type CustomerActivateInput, type CustomerActivatePayload, type CustomerAddressCreatePayload, type CustomerAddressDeletePayload, type CustomerAddressUpdatePayload, type CustomerAddressesArgs, type CustomerCreateInput, type CustomerCreatePayload, type CustomerDefaultAddressUpdatePayload, CustomerErrorCode, type CustomerMetafieldArgs, type CustomerMetafieldsArgs, type CustomerOrdersArgs, type CustomerRecoverPayload, type CustomerResetByUrlPayload, type CustomerResetInput, type CustomerResetPayload, type CustomerUpdateInput, type CustomerUpdatePayload, type CustomerUserError, type DeliveryAddress, type DeliveryAddressInput, DeliveryAddressValidationStrategy, DeliveryMethodType, DigitalWallet, type DiscountAllocation, type DiscountApplication, DiscountApplicationAllocationMethod, type DiscountApplicationConnection, type DiscountApplicationEdge, DiscountApplicationTargetSelection, DiscountApplicationTargetType, type DiscountCodeApplication, type DisplayableError, type Domain, type EditCartItemsMutation, type EditCartItemsMutationVariables, type Exact, type ExternalVideo, type Filter, FilterPresentation, FilterType, type FilterValue, type Fulfillment, type FulfillmentFulfillmentLineItemsArgs, type FulfillmentLineItem, type FulfillmentLineItemConnection, type FulfillmentLineItemEdge, type FulfillmentTrackingInfo, type FulfillmentTrackingInfoArgs, type GenericFile, type GeoCoordinateInput, type GetAllBlogsOptions, type GetAllProductPathsQuery, type GetAllProductPathsQueryVariables, type GetAllProductsOptions, type GetArticleOptions, type GetArticlesInBlogOptions, type GetArticlesOptions, type GetBlogOptions, type GetCartOptions, type GetCartQuery, type GetCartQueryVariables, type GetCollectionOptions, type GetCollectionsByHandlesOptions, type GetCollectionsOptions, type GetPageOptions, type GetProductByHandleQuery, type GetProductByHandleQueryVariables, type GetProductOptions, type GetProductsByHandlesOptions, type GetProductsQuery, type GetProductsQueryVariables, type GetShopOptions, type HasMetafields, type HasMetafieldsIdentifier, type HasMetafieldsMetafieldArgs, type HasMetafieldsMetafieldsArgs, type Image, type ImageConnection, ImageContentType, type ImageEdge, type ImageFragment, type ImageTransformInput, type ImageTransformedSrcArgs, type ImageUrlArgs, type InContextAnnotation, type InContextAnnotationType, type Incremental, type InputMaybe, type Language, LanguageCode, type Localization, type Location, type LocationAddress, type LocationConnection, type LocationEdge, type LocationMetafieldArgs, type LocationMetafieldsArgs, LocationSortKeys, type MailingAddress, type MailingAddressConnection, type MailingAddressEdge, type MailingAddressFormattedArgs, type MailingAddressInput, type MakeEmpty, type MakeMaybe, type MakeOptional, type ManualDiscountApplication, type Market, type MarketMetafieldArgs, type MarketMetafieldsArgs, type Maybe, type Media, type MediaConnection, MediaContentType, type MediaEdge, MediaHost, type MediaImage, type MediaPresentation, type MediaPresentationAsJsonArgs, MediaPresentationFormat, type Menu, type MenuItem, type MenuItemResource, MenuItemType, type Merchandise, type Metafield, MetafieldDeleteErrorCode, type MetafieldDeleteUserError, type MetafieldFilter, type MetafieldFragment, type MetafieldParentResource, type MetafieldReference, type MetafieldReferenceConnection, type MetafieldReferenceEdge, type MetafieldReferencesArgs, type MetafieldsSetUserError, MetafieldsSetUserErrorCode, type Metaobject, type MetaobjectConnection, type MetaobjectEdge, type MetaobjectField, type MetaobjectFieldArgs, type MetaobjectFieldReferencesArgs, type MetaobjectHandleInput, type MetaobjectSeo, type Model3d, type Model3dSource, type MoneyInput, type MoneyV2, type Mutation, type MutationCartAttributesUpdateArgs, type MutationCartBillingAddressUpdateArgs, type MutationCartBuyerIdentityUpdateArgs, type MutationCartCreateArgs, type MutationCartDeliveryAddressesAddArgs, type MutationCartDeliveryAddressesRemoveArgs, type MutationCartDeliveryAddressesUpdateArgs, type MutationCartDiscountCodesUpdateArgs, type MutationCartGiftCardCodesRemoveArgs, type MutationCartGiftCardCodesUpdateArgs, type MutationCartLinesAddArgs, type MutationCartLinesRemoveArgs, type MutationCartLinesUpdateArgs, type MutationCartMetafieldDeleteArgs, type MutationCartMetafieldsSetArgs, type MutationCartNoteUpdateArgs, type MutationCartPaymentUpdateArgs, type MutationCartPrepareForCompletionArgs, type MutationCartSelectedDeliveryOptionsUpdateArgs, type MutationCartSubmitForCompletionArgs, type MutationCustomerAccessTokenCreateArgs, type MutationCustomerAccessTokenCreateWithMultipassArgs, type MutationCustomerAccessTokenDeleteArgs, type MutationCustomerAccessTokenRenewArgs, type MutationCustomerActivateArgs, type MutationCustomerActivateByUrlArgs, type MutationCustomerAddressCreateArgs, type MutationCustomerAddressDeleteArgs, type MutationCustomerAddressUpdateArgs, type MutationCustomerCreateArgs, type MutationCustomerDefaultAddressUpdateArgs, type MutationCustomerRecoverArgs, type MutationCustomerResetArgs, type MutationCustomerResetByUrlArgs, type MutationCustomerUpdateArgs, type MutationShopPayPaymentRequestSessionCreateArgs, type MutationShopPayPaymentRequestSessionSubmitArgs, type Node, type NormalizedArticle, type NormalizedAttribute, type NormalizedBlog, type NormalizedCart, type NormalizedCollection, type NormalizedLineItem, type NormalizedPage, type NormalizedProduct, type NormalizedProductVariant, type NormalizedProductsConnection, type NormalizedSellingPlanGroup, type NormalizedShop, type OnlineStorePublishable, type Order, OrderCancelReason, type OrderConnection, type OrderDiscountApplicationsArgs, type OrderEdge, OrderFinancialStatus, OrderFulfillmentStatus, type OrderLineItem, type OrderLineItemConnection, type OrderLineItemEdge, type OrderLineItemsArgs, type OrderMetafieldArgs, type OrderMetafieldsArgs, OrderSortKeys, type OrderSuccessfulFulfillmentsArgs, type Page, type PageConnection, type PageEdge, type PageInfo, type PageInfoFragment, type PageMetafieldArgs, type PageMetafieldsArgs, PageSortKeys, type PaginatedSitemapResources, type PaymentSettings, PredictiveSearchLimitScope, type PredictiveSearchResult, PredictiveSearchType, PreferenceDeliveryMethodType, type PriceRangeFilter, type PricingPercentageValue, type PricingValue, type Product, type ProductAdjacentVariantsArgs, ProductCollectionSortKeys, type ProductCollectionsArgs, type ProductConnection, type ProductDescriptionArgs, type ProductEdge, type ProductFilter, type ProductFragment, ProductImageSortKeys, type ProductImagesArgs, type ProductMediaArgs, ProductMediaSortKeys, type ProductMetafieldArgs, type ProductMetafieldsArgs, type ProductOption, type ProductOptionValue, type ProductOptionValueSwatch, type ProductOptionsArgs, type ProductPriceRange, ProductRecommendationIntent, type ProductSelectedOrFirstAvailableVariantArgs, type ProductSellingPlanGroupsArgs, ProductSortKeys, type ProductVariant, type ProductVariantBySelectedOptionsArgs, type ProductVariantComponent, type ProductVariantComponentConnection, type ProductVariantComponentEdge, type ProductVariantComponentsArgs, type ProductVariantConnection, type ProductVariantEdge, type ProductVariantGroupedByArgs, type ProductVariantMetafieldArgs, type ProductVariantMetafieldsArgs, type ProductVariantQuantityPriceBreaksArgs, type ProductVariantSellingPlanAllocationsArgs, ProductVariantSortKeys, type ProductVariantStoreAvailabilityArgs, type ProductVariantsArgs, type PurchasingCompany, type QuantityPriceBreak, type QuantityPriceBreakConnection, type QuantityPriceBreakEdge, type QuantityRule, type QueryRoot, type QueryRootArticleArgs, type QueryRootArticlesArgs, type QueryRootBlogArgs, type QueryRootBlogByHandleArgs, type QueryRootBlogsArgs, type QueryRootCartArgs, type QueryRootCartCompletionAttemptArgs, type QueryRootCollectionArgs, type QueryRootCollectionByHandleArgs, type QueryRootCollectionsArgs, type QueryRootCustomerArgs, type QueryRootLocationsArgs, type QueryRootMenuArgs, type QueryRootMetaobjectArgs, type QueryRootMetaobjectsArgs, type QueryRootNodeArgs, type QueryRootNodesArgs, type QueryRootPageArgs, type QueryRootPageByHandleArgs, type QueryRootPagesArgs, type QueryRootPredictiveSearchArgs, type QueryRootProductArgs, type QueryRootProductByHandleArgs, type QueryRootProductRecommendationsArgs, type QueryRootProductTagsArgs, type QueryRootProductTypesArgs, type QueryRootProductsArgs, type QueryRootSearchArgs, type QueryRootSitemapArgs, type QueryRootUrlRedirectsArgs, type RemoveCartLinesOptions, type RemoveFromCartMutation, type RemoveFromCartMutationVariables, type Scalars, type ScriptDiscountApplication, SearchPrefixQueryType, type SearchQuerySuggestion, type SearchResultItem, type SearchResultItemConnection, type SearchResultItemEdge, SearchSortKeys, SearchType, SearchUnavailableProductsType, SearchableField, type SelectedOption, type SelectedOptionInput, type SellingPlan, type SellingPlanAllocation, type SellingPlanAllocationConnection, type SellingPlanAllocationEdge, type SellingPlanAllocationPriceAdjustment, type SellingPlanBillingPolicy, type SellingPlanCheckoutCharge, type SellingPlanCheckoutChargePercentageValue, SellingPlanCheckoutChargeType, type SellingPlanCheckoutChargeValue, type SellingPlanConnection, type SellingPlanDeliveryPolicy, type SellingPlanEdge, type SellingPlanFixedAmountPriceAdjustment, type SellingPlanFixedPriceAdjustment, type SellingPlanGroup, type SellingPlanGroupConnection, type SellingPlanGroupEdge, type SellingPlanGroupOption, type SellingPlanGroupSellingPlansArgs, SellingPlanInterval, type SellingPlanMetafieldArgs, type SellingPlanMetafieldsArgs, type SellingPlanOption, type SellingPlanPercentagePriceAdjustment, type SellingPlanPriceAdjustment, type SellingPlanPriceAdjustmentValue, type SellingPlanRecurringBillingPolicy, type SellingPlanRecurringDeliveryPolicy, type Seo, type SeoFragment, type Shop, type ShopMetafieldArgs, type ShopMetafieldsArgs, type ShopPayInstallmentsFinancingPlan, ShopPayInstallmentsFinancingPlanFrequency, type ShopPayInstallmentsFinancingPlanTerm, ShopPayInstallmentsLoan, type ShopPayInstallmentsPricing, type ShopPayInstallmentsProductVariantPricing, type ShopPayPaymentRequest, type ShopPayPaymentRequestContactField, type ShopPayPaymentRequestDeliveryMethod, type ShopPayPaymentRequestDeliveryMethodInput, ShopPayPaymentRequestDeliveryMethodType, type ShopPayPaymentRequestDiscount, type ShopPayPaymentRequestDiscountInput, type ShopPayPaymentRequestImage, type ShopPayPaymentRequestImageInput, type ShopPayPaymentRequestInput, type ShopPayPaymentRequestLineItem, type ShopPayPaymentRequestLineItemInput, type ShopPayPaymentRequestReceipt, type ShopPayPaymentRequestSession, type ShopPayPaymentRequestSessionCreatePayload, type ShopPayPaymentRequestSessionSubmitPayload, type ShopPayPaymentRequestShippingLine, type ShopPayPaymentRequestShippingLineInput, type ShopPayPaymentRequestTotalShippingPrice, type ShopPayPaymentRequestTotalShippingPriceInput, type ShopPayWalletContentInput, type ShopPolicy, type ShopPolicyWithDefault, ShopifyClient, type Sitemap, type SitemapImage, type SitemapResource, type SitemapResourceInterface, type SitemapResourceMetaobject, type SitemapResourcesArgs, SitemapType, type StoreAvailability, type StoreAvailabilityConnection, type StoreAvailabilityEdge, type StringConnection, type StringEdge, type SubmissionError, SubmissionErrorCode, type SubmitAlreadyAccepted, type SubmitFailed, type SubmitSuccess, type SubmitThrottled, type Swatch, type TaxonomyCategory, type TaxonomyMetafieldFilter, type Trackable, type UnitPriceMeasurement, UnitPriceMeasurementMeasuredType, UnitPriceMeasurementMeasuredUnit, UnitSystem, type UpdateBuyerIdentityOptions, type UpdateCartAttributesOptions, type UpdateCartCodesOptions, type UpdateCartDeliveryOptions, type UpdateCartDeliveryOptionsMutation, type UpdateCartDeliveryOptionsMutationVariables, type UpdateCartLinesOptions, type UrlRedirect, type UrlRedirectConnection, type UrlRedirectEdge, type UserError, type UserErrorsShopPayPaymentRequestSessionUserErrors, UserErrorsShopPayPaymentRequestSessionUserErrorsCode, type VariantFragment, type VariantOptionFilter, type Video, type VideoSource, WeightUnit, addCartLines, createCart, getAllBlogs, getAllCollections, getAllProducts, getArticle, getArticles, getArticlesInBlog, getBlog, getCart, getCollection, getCollections, getCollectionsByHandles, getPage, getProduct, getProducts, getProductsByHandles, getShop, normalizeArticle, normalizeBlog, normalizeCart, normalizeCollection, normalizeLineItem, normalizePage, normalizeProduct, normalizeShop, removeCartLines, updateBuyerIdentity, updateCartAttributes, updateCartCodes, updateCartDeliveryOptions, updateCartLines };
package/dist/index.js CHANGED
@@ -767,6 +767,110 @@ var blogWithMetafieldsFragment = (
767
767
  `
768
768
  );
769
769
 
770
+ // src/fragments/page.ts
771
+ var pageFragment = (
772
+ /* GraphQL */
773
+ `
774
+ fragment page on Page {
775
+ id
776
+ handle
777
+ title
778
+ body
779
+ bodySummary
780
+ createdAt
781
+ updatedAt
782
+ seo {
783
+ ...seo
784
+ }
785
+ }
786
+ ${seoFragment}
787
+ `
788
+ );
789
+ var pageWithMetafieldsFragment = (
790
+ /* GraphQL */
791
+ `
792
+ fragment pageWithMetafields on Page {
793
+ id
794
+ handle
795
+ title
796
+ body
797
+ bodySummary
798
+ createdAt
799
+ updatedAt
800
+ seo {
801
+ ...seo
802
+ }
803
+ metafields(identifiers: $pageMetafieldIdentifiers) {
804
+ ...metafield
805
+ }
806
+ }
807
+ ${seoFragment}
808
+ ${metafieldFragment}
809
+ `
810
+ );
811
+
812
+ // src/fragments/shop.ts
813
+ var shopFragment = (
814
+ /* GraphQL */
815
+ `
816
+ fragment shop on Shop {
817
+ name
818
+ description
819
+ primaryDomain {
820
+ url
821
+ host
822
+ }
823
+ brand {
824
+ logo {
825
+ image {
826
+ url
827
+ }
828
+ }
829
+ colors {
830
+ primary {
831
+ background
832
+ }
833
+ secondary {
834
+ background
835
+ }
836
+ }
837
+ }
838
+ }
839
+ `
840
+ );
841
+ var shopWithMetafieldsFragment = (
842
+ /* GraphQL */
843
+ `
844
+ fragment shopWithMetafields on Shop {
845
+ name
846
+ description
847
+ primaryDomain {
848
+ url
849
+ host
850
+ }
851
+ brand {
852
+ logo {
853
+ image {
854
+ url
855
+ }
856
+ }
857
+ colors {
858
+ primary {
859
+ background
860
+ }
861
+ secondary {
862
+ background
863
+ }
864
+ }
865
+ }
866
+ metafields(identifiers: $shopMetafieldIdentifiers) {
867
+ ...metafield
868
+ }
869
+ }
870
+ ${metafieldFragment}
871
+ `
872
+ );
873
+
770
874
  // src/queries/product/get-product.ts
771
875
  var getProductQuery = (
772
876
  /* GraphQL */
@@ -2069,10 +2173,7 @@ async function getCollections(client, options) {
2069
2173
  }
2070
2174
 
2071
2175
  // src/api/collection/get-collections-by-handles.ts
2072
- var getCollectionsByHandles = async ({
2073
- client,
2074
- options
2075
- }) => {
2176
+ async function getCollectionsByHandles(client, options) {
2076
2177
  const { handles, graphqlQuery, metafieldIdentifiers } = options;
2077
2178
  if (handles.length === 0) {
2078
2179
  return [];
@@ -2096,7 +2197,7 @@ var getCollectionsByHandles = async ({
2096
2197
  return normalizeCollection(item);
2097
2198
  });
2098
2199
  return collections;
2099
- };
2200
+ }
2100
2201
 
2101
2202
  // src/api/blog/normalize.ts
2102
2203
  function normalizeBlog(blog) {
@@ -2417,6 +2518,121 @@ async function getArticlesInBlog(client, options) {
2417
2518
  return fetchAllPages5(client, options);
2418
2519
  }
2419
2520
 
2521
+ // src/api/page/normalize.ts
2522
+ function normalizePage(page) {
2523
+ return {
2524
+ id: page.id,
2525
+ handle: page.handle,
2526
+ title: page.title,
2527
+ body: page.body,
2528
+ bodySummary: page.bodySummary,
2529
+ createdAt: page.createdAt,
2530
+ updatedAt: page.updatedAt,
2531
+ seo: page.seo,
2532
+ metafields: normalizeMetafields3(page.metafields)
2533
+ };
2534
+ }
2535
+ function normalizeMetafields3(metafields) {
2536
+ if (!metafields || metafields.length === 0) {
2537
+ return void 0;
2538
+ }
2539
+ return metafields.reduce((acc, metafield) => {
2540
+ if (metafield && metafield.key) {
2541
+ acc[metafield.key] = metafield.value;
2542
+ }
2543
+ return acc;
2544
+ }, {});
2545
+ }
2546
+
2547
+ // src/api/page/get-page.ts
2548
+ async function getPage(client, options) {
2549
+ const { handle, graphqlQuery, metafieldIdentifiers } = options;
2550
+ const hasMetafields = metafieldIdentifiers && metafieldIdentifiers.length > 0;
2551
+ const fragment = hasMetafields ? pageWithMetafieldsFragment : pageFragment;
2552
+ const defaultQuery = (
2553
+ /* GraphQL */
2554
+ `
2555
+ query getPage(
2556
+ $handle: String!
2557
+ ${hasMetafields ? "$pageMetafieldIdentifiers: [HasMetafieldsIdentifier!]!" : ""}
2558
+ ) {
2559
+ page(handle: $handle) {
2560
+ ...${hasMetafields ? "pageWithMetafields" : "page"}
2561
+ }
2562
+ }
2563
+ ${fragment}
2564
+ `
2565
+ );
2566
+ const query = graphqlQuery || defaultQuery;
2567
+ const variables = { handle };
2568
+ if (hasMetafields) {
2569
+ variables.pageMetafieldIdentifiers = metafieldIdentifiers;
2570
+ }
2571
+ const data = await client.query(query, variables);
2572
+ if (!data || !data.page) {
2573
+ return void 0;
2574
+ }
2575
+ return normalizePage(data.page);
2576
+ }
2577
+
2578
+ // src/api/shop/normalize.ts
2579
+ function normalizeShop(shop) {
2580
+ return {
2581
+ name: shop.name,
2582
+ description: shop.description,
2583
+ primaryDomain: shop.primaryDomain,
2584
+ brand: shop.brand ? {
2585
+ logo: shop.brand.logo,
2586
+ colors: shop.brand.colors ? {
2587
+ primary: shop.brand.colors.primary?.background,
2588
+ secondary: shop.brand.colors.secondary?.background
2589
+ } : void 0
2590
+ } : void 0,
2591
+ metafields: normalizeMetafields4(shop.metafields)
2592
+ };
2593
+ }
2594
+ function normalizeMetafields4(metafields) {
2595
+ if (!metafields || metafields.length === 0) {
2596
+ return void 0;
2597
+ }
2598
+ return metafields.reduce((acc, metafield) => {
2599
+ if (metafield && metafield.key) {
2600
+ acc[metafield.key] = metafield.value;
2601
+ }
2602
+ return acc;
2603
+ }, {});
2604
+ }
2605
+
2606
+ // src/api/shop/get-shop.ts
2607
+ async function getShop(client, options) {
2608
+ const { graphqlQuery, metafieldIdentifiers } = options;
2609
+ const hasMetafields = metafieldIdentifiers && metafieldIdentifiers.length > 0;
2610
+ const fragment = hasMetafields ? shopWithMetafieldsFragment : shopFragment;
2611
+ const defaultQuery = (
2612
+ /* GraphQL */
2613
+ `
2614
+ query getShop(
2615
+ ${hasMetafields ? "$shopMetafieldIdentifiers: [HasMetafieldsIdentifier!]!" : ""}
2616
+ ) {
2617
+ shop {
2618
+ ...${hasMetafields ? "shopWithMetafields" : "shop"}
2619
+ }
2620
+ }
2621
+ ${fragment}
2622
+ `
2623
+ );
2624
+ const query = graphqlQuery || defaultQuery;
2625
+ const variables = {};
2626
+ if (hasMetafields) {
2627
+ variables.shopMetafieldIdentifiers = metafieldIdentifiers;
2628
+ }
2629
+ const data = await client.query(query, variables);
2630
+ if (!data || !data.shop) {
2631
+ return void 0;
2632
+ }
2633
+ return normalizeShop(data.shop);
2634
+ }
2635
+
2420
2636
  exports.ShopifyClient = ShopifyClient;
2421
2637
  exports.addCartItemsMutation = addCartItemsMutation;
2422
2638
  exports.addCartLines = addCartLines;
@@ -2443,12 +2659,14 @@ exports.getCollection = getCollection;
2443
2659
  exports.getCollections = getCollections;
2444
2660
  exports.getCollectionsByHandles = getCollectionsByHandles;
2445
2661
  exports.getCollectionsByHandlesQuery = getCollectionsByHandlesQuery;
2662
+ exports.getPage = getPage;
2446
2663
  exports.getProduct = getProduct;
2447
2664
  exports.getProductQuery = getProductQuery;
2448
2665
  exports.getProducts = getProducts;
2449
2666
  exports.getProductsByHandles = getProductsByHandles;
2450
2667
  exports.getProductsByHandlesQuery = getProductsByHandlesQuery;
2451
2668
  exports.getProductsQuery = getProductsQuery;
2669
+ exports.getShop = getShop;
2452
2670
  exports.imageFragment = imageFragment;
2453
2671
  exports.metafieldFragment = metafieldFragment;
2454
2672
  exports.metafieldFragmentStr = metafieldFragmentStr;
@@ -2457,12 +2675,18 @@ exports.normalizeBlog = normalizeBlog;
2457
2675
  exports.normalizeCart = normalizeCart;
2458
2676
  exports.normalizeCollection = normalizeCollection;
2459
2677
  exports.normalizeLineItem = normalizeLineItem;
2678
+ exports.normalizePage = normalizePage;
2460
2679
  exports.normalizeProduct = normalizeProduct;
2680
+ exports.normalizeShop = normalizeShop;
2681
+ exports.pageFragment = pageFragment;
2461
2682
  exports.pageInfoFragment = pageInfoFragment;
2683
+ exports.pageWithMetafieldsFragment = pageWithMetafieldsFragment;
2462
2684
  exports.productFragment = productFragment;
2463
2685
  exports.removeCartItemsMutation = removeCartItemsMutation;
2464
2686
  exports.removeCartLines = removeCartLines;
2465
2687
  exports.seoFragment = seoFragment;
2688
+ exports.shopFragment = shopFragment;
2689
+ exports.shopWithMetafieldsFragment = shopWithMetafieldsFragment;
2466
2690
  exports.updateBuyerIdentity = updateBuyerIdentity;
2467
2691
  exports.updateBuyerIdentityMutation = updateBuyerIdentityMutation;
2468
2692
  exports.updateCartAttributes = updateCartAttributes;