@anker-in/shopify-react 0.1.1-beta.40 → 0.1.1-beta.42
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/hooks/index.d.mts +66 -28
- package/dist/hooks/index.d.ts +66 -28
- package/dist/hooks/index.js +183 -132
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +182 -131
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +188 -133
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +187 -132
- package/dist/index.mjs.map +1 -1
- package/dist/provider/index.d.mts +1 -1
- package/dist/provider/index.d.ts +1 -1
- package/dist/provider/index.js +21 -11
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/index.mjs +21 -11
- package/dist/provider/index.mjs.map +1 -1
- package/dist/{types-BSsb8OPm.d.mts → types-DntkHhf8.d.mts} +8 -5
- package/dist/{types-BSsb8OPm.d.ts → types-DntkHhf8.d.ts} +8 -5
- package/package.json +3 -3
package/dist/hooks/index.d.mts
CHANGED
|
@@ -2,8 +2,8 @@ import * as swr_mutation from 'swr/mutation';
|
|
|
2
2
|
import { SWRMutationConfiguration } from 'swr/mutation';
|
|
3
3
|
import * as _anker_in_shopify_sdk from '@anker-in/shopify-sdk';
|
|
4
4
|
import { CartLineInput, NormalizedCart, NormalizedProduct, NormalizedProductVariant, NormalizedLineItem, UpdateCartLinesOptions, HasMetafieldsIdentifier, NormalizedAttribute, Media, NormalizedCollection, CollectionsConnection, NormalizedBlog, NormalizedArticle } from '@anker-in/shopify-sdk';
|
|
5
|
-
import { U as UseAddToCartOptions, a as AddToCartInput, A as AddToCartLineItem, G as GtmParams, B as BuyNowTrackConfig, d as PlusMemberShippingMethodConfig, e as PlusMemberSettingsMetafields, D as DeliveryPlusType, f as
|
|
6
|
-
export { g as DeliveryCustomData, P as PLUS_MEMBER_TYPE, b as PlusMemberMode, c as PlusMemberShippingMethodMetafields, S as ShippingMethodMode } from '../types-
|
|
5
|
+
import { U as UseAddToCartOptions, a as AddToCartInput, A as AddToCartLineItem, G as GtmParams, B as BuyNowTrackConfig, d as PlusMemberShippingMethodConfig, e as PlusMemberSettingsMetafields, D as DeliveryPlusType, f as SelectedPlusMemberVariant, h as DeliveryData } from '../types-DntkHhf8.mjs';
|
|
6
|
+
export { g as DeliveryCustomData, P as PLUS_MEMBER_TYPE, b as PlusMemberMode, c as PlusMemberShippingMethodMetafields, S as ShippingMethodMode } from '../types-DntkHhf8.mjs';
|
|
7
7
|
import Decimal from 'decimal.js';
|
|
8
8
|
import * as swr from 'swr';
|
|
9
9
|
import swr__default, { SWRConfiguration } from 'swr';
|
|
@@ -455,15 +455,34 @@ interface UpdateCartAttributesInput {
|
|
|
455
455
|
value: string;
|
|
456
456
|
}>;
|
|
457
457
|
}
|
|
458
|
+
interface UseUpdateCartAttributesOptions {
|
|
459
|
+
/** Function to update cart state */
|
|
460
|
+
mutate: (cart: NormalizedCart | undefined) => void;
|
|
461
|
+
/** Metafield identifiers for variant and product */
|
|
462
|
+
metafieldIdentifiers?: {
|
|
463
|
+
variant: HasMetafieldsIdentifier[];
|
|
464
|
+
product: HasMetafieldsIdentifier[];
|
|
465
|
+
};
|
|
466
|
+
/** Disable the mutation */
|
|
467
|
+
disabled?: boolean;
|
|
468
|
+
/** SWR mutation configuration */
|
|
469
|
+
swrOptions?: SWRMutationConfiguration<NormalizedCart | undefined, Error, 'update-cart-attributes', UpdateCartAttributesInput>;
|
|
470
|
+
}
|
|
458
471
|
/**
|
|
459
472
|
* Hook for updating cart attributes (custom key-value pairs)
|
|
460
473
|
*
|
|
461
|
-
* @param options -
|
|
474
|
+
* @param options - Hook configuration options
|
|
462
475
|
* @returns SWR mutation with trigger function
|
|
463
476
|
*
|
|
464
477
|
* @example
|
|
465
478
|
* ```tsx
|
|
466
|
-
* const { trigger, isMutating } = useUpdateCartAttributes(
|
|
479
|
+
* const { trigger, isMutating } = useUpdateCartAttributes({
|
|
480
|
+
* mutate: mutateCart,
|
|
481
|
+
* metafieldIdentifiers: {
|
|
482
|
+
* variant: [...],
|
|
483
|
+
* product: [...]
|
|
484
|
+
* }
|
|
485
|
+
* })
|
|
467
486
|
*
|
|
468
487
|
* await trigger({
|
|
469
488
|
* attributes: [
|
|
@@ -473,10 +492,7 @@ interface UpdateCartAttributesInput {
|
|
|
473
492
|
* })
|
|
474
493
|
* ```
|
|
475
494
|
*/
|
|
476
|
-
declare function useUpdateCartAttributes(mutate:
|
|
477
|
-
variant: HasMetafieldsIdentifier[];
|
|
478
|
-
product: HasMetafieldsIdentifier[];
|
|
479
|
-
}, options?: SWRMutationConfiguration<NormalizedCart | undefined, Error, 'update-cart-attributes', UpdateCartAttributesInput>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, "update-cart-attributes", UpdateCartAttributesInput>;
|
|
495
|
+
declare function useUpdateCartAttributes({ mutate, metafieldIdentifiers, disabled, swrOptions, }: UseUpdateCartAttributesOptions): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, "update-cart-attributes", UpdateCartAttributesInput>;
|
|
480
496
|
|
|
481
497
|
interface BuyNowInput {
|
|
482
498
|
/** Metafield identifiers */
|
|
@@ -607,7 +623,7 @@ interface UseCalcGiftsFromLinesResult {
|
|
|
607
623
|
/** Script gift calculation result */
|
|
608
624
|
scriptGift: UseScriptAutoFreeGiftResult;
|
|
609
625
|
/** All gift lines that need to be added to cart (combined from both) */
|
|
610
|
-
allGiftLines:
|
|
626
|
+
allGiftLines: AddToCartLineItem[];
|
|
611
627
|
/** Whether any gifts are available */
|
|
612
628
|
hasGifts: boolean;
|
|
613
629
|
}
|
|
@@ -700,8 +716,13 @@ interface PlusMemberContextValue<TProduct = any, TVariant = any, TProfile = any>
|
|
|
700
716
|
variant: TVariant;
|
|
701
717
|
product: TProduct;
|
|
702
718
|
shippingMethodsContext: ShippingMethodsContext;
|
|
703
|
-
|
|
704
|
-
|
|
719
|
+
selectedPlusMemberVariant: SelectedPlusMemberVariant;
|
|
720
|
+
monthlyVariant?: NormalizedProductVariant & {
|
|
721
|
+
product: NormalizedProduct | undefined;
|
|
722
|
+
};
|
|
723
|
+
annualVariant?: NormalizedProductVariant & {
|
|
724
|
+
product: NormalizedProduct | undefined;
|
|
725
|
+
};
|
|
705
726
|
showPlusMemberBenefit: boolean;
|
|
706
727
|
setShowPlusMemberBenefit: (value: boolean) => void;
|
|
707
728
|
deleteMarginBottom: boolean;
|
|
@@ -717,14 +738,35 @@ declare const PlusMemberContext: React$1.Context<PlusMemberContextValue<any, any
|
|
|
717
738
|
declare function usePlusMemberContext<TProduct = any, TVariant = any>(): PlusMemberContextValue<any, any, any>;
|
|
718
739
|
|
|
719
740
|
/**
|
|
720
|
-
* Hook to get Plus
|
|
741
|
+
* Hook to get Plus Member Product Variants (Monthly and Annual)
|
|
721
742
|
*/
|
|
722
|
-
declare function usePlusMonthlyProductVariant<TVariant = any>(): TVariant | undefined;
|
|
723
743
|
|
|
744
|
+
interface UsePlusMemberVariantsOptions {
|
|
745
|
+
/** Plus member metafields configuration */
|
|
746
|
+
memberSetting: PlusMemberSettingsMetafields;
|
|
747
|
+
}
|
|
748
|
+
interface UsePlusMemberVariantsResult {
|
|
749
|
+
monthlyVariant?: NormalizedProductVariant & {
|
|
750
|
+
product: NormalizedProduct | undefined;
|
|
751
|
+
};
|
|
752
|
+
annualVariant?: NormalizedProductVariant & {
|
|
753
|
+
product: NormalizedProduct | undefined;
|
|
754
|
+
};
|
|
755
|
+
}
|
|
724
756
|
/**
|
|
725
|
-
*
|
|
757
|
+
* Get Plus Member product variants (monthly and annual)
|
|
758
|
+
*
|
|
759
|
+
* @param options - Configuration options
|
|
760
|
+
* @returns Monthly and annual variants
|
|
761
|
+
*
|
|
762
|
+
* @example
|
|
763
|
+
* ```tsx
|
|
764
|
+
* const { monthlyVariant, annualVariant } = usePlusMemberVariants({
|
|
765
|
+
* plusMemberMetafields
|
|
766
|
+
* })
|
|
767
|
+
* ```
|
|
726
768
|
*/
|
|
727
|
-
declare function
|
|
769
|
+
declare function usePlusMemberVariants({ memberSetting, }: UsePlusMemberVariantsOptions): UsePlusMemberVariantsResult;
|
|
728
770
|
|
|
729
771
|
/**
|
|
730
772
|
* Hook to calculate available shipping methods based on product weight and member status
|
|
@@ -1018,25 +1060,18 @@ declare function useHasPlusMemberInCart({ memberSetting, cart, }: UseHasPlusMemb
|
|
|
1018
1060
|
*
|
|
1019
1061
|
* @example
|
|
1020
1062
|
* ```tsx
|
|
1021
|
-
* const
|
|
1063
|
+
* const plusMemberVariant = usePlusMemberNeedAddToCart({
|
|
1022
1064
|
* cart,
|
|
1023
1065
|
* })
|
|
1024
1066
|
*
|
|
1025
|
-
* // plusMemberProduct 格式:
|
|
1026
|
-
* // {
|
|
1027
|
-
* // product: NormalizedProduct,
|
|
1028
|
-
* // variant: NormalizedProductVariant
|
|
1029
|
-
* // }
|
|
1030
|
-
* // 或 undefined (当不需要添加会员产品时)
|
|
1031
1067
|
* ```
|
|
1032
1068
|
*/
|
|
1033
1069
|
declare function usePlusMemberNeedAddToCart({ cart, profile, }: {
|
|
1034
1070
|
cart: NormalizedCart;
|
|
1035
1071
|
profile?: any;
|
|
1036
|
-
}): {
|
|
1037
|
-
product: _anker_in_shopify_sdk.NormalizedProduct;
|
|
1038
|
-
|
|
1039
|
-
} | undefined;
|
|
1072
|
+
}): (_anker_in_shopify_sdk.NormalizedProductVariant & {
|
|
1073
|
+
product: _anker_in_shopify_sdk.NormalizedProduct | undefined;
|
|
1074
|
+
}) | undefined;
|
|
1040
1075
|
|
|
1041
1076
|
interface UseAvailableDeliveryCouponResult {
|
|
1042
1077
|
nddCoupon?: string;
|
|
@@ -1079,7 +1114,9 @@ interface PlusMemberProviderProps<TProduct = any, TVariant = any, TProfile = any
|
|
|
1079
1114
|
* </PlusMemberProvider>
|
|
1080
1115
|
* ```
|
|
1081
1116
|
*/
|
|
1082
|
-
declare const PlusMemberProvider: <TProduct = any, TVariant
|
|
1117
|
+
declare const PlusMemberProvider: <TProduct = any, TVariant extends {
|
|
1118
|
+
weight?: number;
|
|
1119
|
+
} = any, TProfile extends {
|
|
1083
1120
|
isPlus?: boolean;
|
|
1084
1121
|
} = any>({ variant, product, memberSetting, initialSelectedPlusMemberMode, profile, children, }: PropsWithChildren<PlusMemberProviderProps<TProduct, TVariant, TProfile>>) => react_jsx_runtime.JSX.Element;
|
|
1085
1122
|
|
|
@@ -1139,6 +1176,7 @@ declare const CUSTOMER_ATTRIBUTE_KEY = "_discounts_function_env";
|
|
|
1139
1176
|
declare const CUSTOMER_SCRIPT_GIFT_KEY = "_giveaway_gradient_gifts";
|
|
1140
1177
|
declare const CODE_AMOUNT_KEY = "_sku_code_money";
|
|
1141
1178
|
declare const SCRIPT_CODE_AMOUNT_KEY = "_code_money";
|
|
1179
|
+
declare const MEMBER_PRICE_ATTRIBUTE_KEY = "_member_price";
|
|
1142
1180
|
declare const MAIN_PRODUCT_CODE: string[];
|
|
1143
1181
|
|
|
1144
1182
|
/**
|
|
@@ -1949,4 +1987,4 @@ declare function getCachedGeoLocation(cacheKey?: string): GeoLocationData | unde
|
|
|
1949
1987
|
*/
|
|
1950
1988
|
declare function clearGeoLocationCache(cacheKey?: string): void;
|
|
1951
1989
|
|
|
1952
|
-
export { type AddCartLinesInput, AddToCartInput, AddToCartLineItem, type ApplyCartCodesInput, type AutoFreeGift, type AutoFreeGiftCartLineInput, type AutoFreeGiftConfig, type AutoFreeGiftItem, type AutoFreeGiftList, type AutoFreeGiftMainProduct, type BuyNowInput, BuyRuleType, CODE_AMOUNT_KEY, CUSTOMER_ATTRIBUTE_KEY, CUSTOMER_SCRIPT_GIFT_KEY, type Config, type CreateCartInput, DeliveryData, DeliveryPlusType, type DiscountLabel, type FormattedGift, type FunctionGiftResult, type GeoLocationData, type GiftProduct, type GiftProductItem, type GiftTier, type HasPlusMemberInCartResult, type ImageMedia, type LocaleMapping, MAIN_PRODUCT_CODE, type MainProductInfo, type NormalizedSearchResultItem, type Options, OrderBasePriceType, type OrderDiscountConfig, type OrderDiscountResult, OrderDiscountType, PlusMemberContext, type PlusMemberContextValue, PlusMemberProvider, type PlusMemberProviderProps, PlusMemberSettingsMetafields, PlusMemberShippingMethodConfig, PriceBasePriceType, type PriceDiscountConfig, PriceDiscountType, type RemoveCartCodesInput, type RemoveCartLinesInput, type RewardItem, type RuleCondition, RuleType, SCRIPT_CODE_AMOUNT_KEY, type SearchResult, type SearchResultType, type SelectedOptionsResult,
|
|
1990
|
+
export { type AddCartLinesInput, AddToCartInput, AddToCartLineItem, type ApplyCartCodesInput, type AutoFreeGift, type AutoFreeGiftCartLineInput, type AutoFreeGiftConfig, type AutoFreeGiftItem, type AutoFreeGiftList, type AutoFreeGiftMainProduct, type BuyNowInput, BuyRuleType, CODE_AMOUNT_KEY, CUSTOMER_ATTRIBUTE_KEY, CUSTOMER_SCRIPT_GIFT_KEY, type Config, type CreateCartInput, DeliveryData, DeliveryPlusType, type DiscountLabel, type FormattedGift, type FunctionGiftResult, type GeoLocationData, type GiftProduct, type GiftProductItem, type GiftTier, type HasPlusMemberInCartResult, type ImageMedia, type LocaleMapping, MAIN_PRODUCT_CODE, MEMBER_PRICE_ATTRIBUTE_KEY, type MainProductInfo, type NormalizedSearchResultItem, type Options, OrderBasePriceType, type OrderDiscountConfig, type OrderDiscountResult, OrderDiscountType, PlusMemberContext, type PlusMemberContextValue, PlusMemberProvider, type PlusMemberProviderProps, PlusMemberSettingsMetafields, PlusMemberShippingMethodConfig, PriceBasePriceType, type PriceDiscountConfig, PriceDiscountType, type RemoveCartCodesInput, type RemoveCartLinesInput, type RewardItem, type RuleCondition, RuleType, SCRIPT_CODE_AMOUNT_KEY, type SearchResult, type SearchResultType, type SelectedOptionsResult, SelectedPlusMemberVariant, type ShippingMethodsContext, type SiteInfo, SpendMoneyType, type TieredDiscount, type UpdateCartAttributesInput, UseAddToCartOptions, type UseAllBlogsOptions, type UseAllCollectionsOptions, type UseAllProductsOptions, type UseArticleOptions, type UseArticlesInBlogOptions, type UseArticlesOptions, type UseAutoRemovePlusMemberInCartProps, type UseAvailableDeliveryCouponResult, type UseBlogOptions, type UseBuyNowOptions, type UseCalcGiftsFromLinesOptions, type UseCalcGiftsFromLinesResult, type UseCollectionOptions, type UseCollectionsOptions, type UseExposureOptions, type UseGeoLocationOptions, type UseHasPlusMemberInCartProps, type UseIntersectionOptions, type UsePlusMemberVariantsOptions, type UsePlusMemberVariantsResult, type UsePriceOptions, type UsePriceResult, type UseProductOptions, type UseProductsByHandlesOptions, type UseScriptAutoFreeGiftResult, type UseSearchOptions, type UseShippingMethodsOptions, type UseShippingMethodsResult, type UseSiteOptions, type UseUpdateCartAttributesOptions, type UseUpdatePlusMemberDeliveryOptionsProps, type VariantItem, type VariantMedia, type VideoMedia, checkAttributesUpdateNeeded, clearGeoLocationCache, createMockCartFromLines, currencyCodeMapping, defaultSWRMutationConfiguration, formatFunctionAutoFreeGift, formatScriptAutoFreeGift, getCachedGeoLocation, getDiscountEnvAttributeValue, getMatchedMainProductSubTotal, getQuery, getReferralAttributes, normalizeAddToCartLines, preCheck, safeParse, useAddCartLines, useAddToCart, useAllBlogs, useAllCollections, useAllProducts, useApplyCartCodes, useArticle, useArticles, useArticlesInBlog, useAutoRemovePlusMemberInCart, useAvailableDeliveryCoupon, useBlog, useBuyNow, useCalcAutoFreeGift, useCalcGiftsFromLines, useCalcOrderDiscount, useCartAttributes, useCartItemQuantityLimit, useCollection, useCollections, useCreateCart, useExposure, useGeoLocation, useHasPlusMemberInCart, useIntersection, usePlusMemberCheckoutCustomAttributes, usePlusMemberContext, usePlusMemberDeliveryCodes, usePlusMemberItemCustomAttributes, usePlusMemberNeedAddToCart, usePlusMemberVariants, usePrice, useProduct, useProductUrl, useProductsByHandles, useRemoveCartCodes, useRemoveCartLines, useReplaceCartPlusMember, useScriptAutoFreeGift, useSearch, useSelectedOptions, useShippingMethodAvailableCheck, useShippingMethods, useSite, useUpdateCartAttributes, useUpdateCartLines, useUpdateLineCodeAmountAttributes, useUpdatePlusMemberDeliveryOptions, useUpdateVariantQuery, useVariant, useVariantMedia };
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import * as swr_mutation from 'swr/mutation';
|
|
|
2
2
|
import { SWRMutationConfiguration } from 'swr/mutation';
|
|
3
3
|
import * as _anker_in_shopify_sdk from '@anker-in/shopify-sdk';
|
|
4
4
|
import { CartLineInput, NormalizedCart, NormalizedProduct, NormalizedProductVariant, NormalizedLineItem, UpdateCartLinesOptions, HasMetafieldsIdentifier, NormalizedAttribute, Media, NormalizedCollection, CollectionsConnection, NormalizedBlog, NormalizedArticle } from '@anker-in/shopify-sdk';
|
|
5
|
-
import { U as UseAddToCartOptions, a as AddToCartInput, A as AddToCartLineItem, G as GtmParams, B as BuyNowTrackConfig, d as PlusMemberShippingMethodConfig, e as PlusMemberSettingsMetafields, D as DeliveryPlusType, f as
|
|
6
|
-
export { g as DeliveryCustomData, P as PLUS_MEMBER_TYPE, b as PlusMemberMode, c as PlusMemberShippingMethodMetafields, S as ShippingMethodMode } from '../types-
|
|
5
|
+
import { U as UseAddToCartOptions, a as AddToCartInput, A as AddToCartLineItem, G as GtmParams, B as BuyNowTrackConfig, d as PlusMemberShippingMethodConfig, e as PlusMemberSettingsMetafields, D as DeliveryPlusType, f as SelectedPlusMemberVariant, h as DeliveryData } from '../types-DntkHhf8.js';
|
|
6
|
+
export { g as DeliveryCustomData, P as PLUS_MEMBER_TYPE, b as PlusMemberMode, c as PlusMemberShippingMethodMetafields, S as ShippingMethodMode } from '../types-DntkHhf8.js';
|
|
7
7
|
import Decimal from 'decimal.js';
|
|
8
8
|
import * as swr from 'swr';
|
|
9
9
|
import swr__default, { SWRConfiguration } from 'swr';
|
|
@@ -455,15 +455,34 @@ interface UpdateCartAttributesInput {
|
|
|
455
455
|
value: string;
|
|
456
456
|
}>;
|
|
457
457
|
}
|
|
458
|
+
interface UseUpdateCartAttributesOptions {
|
|
459
|
+
/** Function to update cart state */
|
|
460
|
+
mutate: (cart: NormalizedCart | undefined) => void;
|
|
461
|
+
/** Metafield identifiers for variant and product */
|
|
462
|
+
metafieldIdentifiers?: {
|
|
463
|
+
variant: HasMetafieldsIdentifier[];
|
|
464
|
+
product: HasMetafieldsIdentifier[];
|
|
465
|
+
};
|
|
466
|
+
/** Disable the mutation */
|
|
467
|
+
disabled?: boolean;
|
|
468
|
+
/** SWR mutation configuration */
|
|
469
|
+
swrOptions?: SWRMutationConfiguration<NormalizedCart | undefined, Error, 'update-cart-attributes', UpdateCartAttributesInput>;
|
|
470
|
+
}
|
|
458
471
|
/**
|
|
459
472
|
* Hook for updating cart attributes (custom key-value pairs)
|
|
460
473
|
*
|
|
461
|
-
* @param options -
|
|
474
|
+
* @param options - Hook configuration options
|
|
462
475
|
* @returns SWR mutation with trigger function
|
|
463
476
|
*
|
|
464
477
|
* @example
|
|
465
478
|
* ```tsx
|
|
466
|
-
* const { trigger, isMutating } = useUpdateCartAttributes(
|
|
479
|
+
* const { trigger, isMutating } = useUpdateCartAttributes({
|
|
480
|
+
* mutate: mutateCart,
|
|
481
|
+
* metafieldIdentifiers: {
|
|
482
|
+
* variant: [...],
|
|
483
|
+
* product: [...]
|
|
484
|
+
* }
|
|
485
|
+
* })
|
|
467
486
|
*
|
|
468
487
|
* await trigger({
|
|
469
488
|
* attributes: [
|
|
@@ -473,10 +492,7 @@ interface UpdateCartAttributesInput {
|
|
|
473
492
|
* })
|
|
474
493
|
* ```
|
|
475
494
|
*/
|
|
476
|
-
declare function useUpdateCartAttributes(mutate:
|
|
477
|
-
variant: HasMetafieldsIdentifier[];
|
|
478
|
-
product: HasMetafieldsIdentifier[];
|
|
479
|
-
}, options?: SWRMutationConfiguration<NormalizedCart | undefined, Error, 'update-cart-attributes', UpdateCartAttributesInput>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, "update-cart-attributes", UpdateCartAttributesInput>;
|
|
495
|
+
declare function useUpdateCartAttributes({ mutate, metafieldIdentifiers, disabled, swrOptions, }: UseUpdateCartAttributesOptions): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, "update-cart-attributes", UpdateCartAttributesInput>;
|
|
480
496
|
|
|
481
497
|
interface BuyNowInput {
|
|
482
498
|
/** Metafield identifiers */
|
|
@@ -607,7 +623,7 @@ interface UseCalcGiftsFromLinesResult {
|
|
|
607
623
|
/** Script gift calculation result */
|
|
608
624
|
scriptGift: UseScriptAutoFreeGiftResult;
|
|
609
625
|
/** All gift lines that need to be added to cart (combined from both) */
|
|
610
|
-
allGiftLines:
|
|
626
|
+
allGiftLines: AddToCartLineItem[];
|
|
611
627
|
/** Whether any gifts are available */
|
|
612
628
|
hasGifts: boolean;
|
|
613
629
|
}
|
|
@@ -700,8 +716,13 @@ interface PlusMemberContextValue<TProduct = any, TVariant = any, TProfile = any>
|
|
|
700
716
|
variant: TVariant;
|
|
701
717
|
product: TProduct;
|
|
702
718
|
shippingMethodsContext: ShippingMethodsContext;
|
|
703
|
-
|
|
704
|
-
|
|
719
|
+
selectedPlusMemberVariant: SelectedPlusMemberVariant;
|
|
720
|
+
monthlyVariant?: NormalizedProductVariant & {
|
|
721
|
+
product: NormalizedProduct | undefined;
|
|
722
|
+
};
|
|
723
|
+
annualVariant?: NormalizedProductVariant & {
|
|
724
|
+
product: NormalizedProduct | undefined;
|
|
725
|
+
};
|
|
705
726
|
showPlusMemberBenefit: boolean;
|
|
706
727
|
setShowPlusMemberBenefit: (value: boolean) => void;
|
|
707
728
|
deleteMarginBottom: boolean;
|
|
@@ -717,14 +738,35 @@ declare const PlusMemberContext: React$1.Context<PlusMemberContextValue<any, any
|
|
|
717
738
|
declare function usePlusMemberContext<TProduct = any, TVariant = any>(): PlusMemberContextValue<any, any, any>;
|
|
718
739
|
|
|
719
740
|
/**
|
|
720
|
-
* Hook to get Plus
|
|
741
|
+
* Hook to get Plus Member Product Variants (Monthly and Annual)
|
|
721
742
|
*/
|
|
722
|
-
declare function usePlusMonthlyProductVariant<TVariant = any>(): TVariant | undefined;
|
|
723
743
|
|
|
744
|
+
interface UsePlusMemberVariantsOptions {
|
|
745
|
+
/** Plus member metafields configuration */
|
|
746
|
+
memberSetting: PlusMemberSettingsMetafields;
|
|
747
|
+
}
|
|
748
|
+
interface UsePlusMemberVariantsResult {
|
|
749
|
+
monthlyVariant?: NormalizedProductVariant & {
|
|
750
|
+
product: NormalizedProduct | undefined;
|
|
751
|
+
};
|
|
752
|
+
annualVariant?: NormalizedProductVariant & {
|
|
753
|
+
product: NormalizedProduct | undefined;
|
|
754
|
+
};
|
|
755
|
+
}
|
|
724
756
|
/**
|
|
725
|
-
*
|
|
757
|
+
* Get Plus Member product variants (monthly and annual)
|
|
758
|
+
*
|
|
759
|
+
* @param options - Configuration options
|
|
760
|
+
* @returns Monthly and annual variants
|
|
761
|
+
*
|
|
762
|
+
* @example
|
|
763
|
+
* ```tsx
|
|
764
|
+
* const { monthlyVariant, annualVariant } = usePlusMemberVariants({
|
|
765
|
+
* plusMemberMetafields
|
|
766
|
+
* })
|
|
767
|
+
* ```
|
|
726
768
|
*/
|
|
727
|
-
declare function
|
|
769
|
+
declare function usePlusMemberVariants({ memberSetting, }: UsePlusMemberVariantsOptions): UsePlusMemberVariantsResult;
|
|
728
770
|
|
|
729
771
|
/**
|
|
730
772
|
* Hook to calculate available shipping methods based on product weight and member status
|
|
@@ -1018,25 +1060,18 @@ declare function useHasPlusMemberInCart({ memberSetting, cart, }: UseHasPlusMemb
|
|
|
1018
1060
|
*
|
|
1019
1061
|
* @example
|
|
1020
1062
|
* ```tsx
|
|
1021
|
-
* const
|
|
1063
|
+
* const plusMemberVariant = usePlusMemberNeedAddToCart({
|
|
1022
1064
|
* cart,
|
|
1023
1065
|
* })
|
|
1024
1066
|
*
|
|
1025
|
-
* // plusMemberProduct 格式:
|
|
1026
|
-
* // {
|
|
1027
|
-
* // product: NormalizedProduct,
|
|
1028
|
-
* // variant: NormalizedProductVariant
|
|
1029
|
-
* // }
|
|
1030
|
-
* // 或 undefined (当不需要添加会员产品时)
|
|
1031
1067
|
* ```
|
|
1032
1068
|
*/
|
|
1033
1069
|
declare function usePlusMemberNeedAddToCart({ cart, profile, }: {
|
|
1034
1070
|
cart: NormalizedCart;
|
|
1035
1071
|
profile?: any;
|
|
1036
|
-
}): {
|
|
1037
|
-
product: _anker_in_shopify_sdk.NormalizedProduct;
|
|
1038
|
-
|
|
1039
|
-
} | undefined;
|
|
1072
|
+
}): (_anker_in_shopify_sdk.NormalizedProductVariant & {
|
|
1073
|
+
product: _anker_in_shopify_sdk.NormalizedProduct | undefined;
|
|
1074
|
+
}) | undefined;
|
|
1040
1075
|
|
|
1041
1076
|
interface UseAvailableDeliveryCouponResult {
|
|
1042
1077
|
nddCoupon?: string;
|
|
@@ -1079,7 +1114,9 @@ interface PlusMemberProviderProps<TProduct = any, TVariant = any, TProfile = any
|
|
|
1079
1114
|
* </PlusMemberProvider>
|
|
1080
1115
|
* ```
|
|
1081
1116
|
*/
|
|
1082
|
-
declare const PlusMemberProvider: <TProduct = any, TVariant
|
|
1117
|
+
declare const PlusMemberProvider: <TProduct = any, TVariant extends {
|
|
1118
|
+
weight?: number;
|
|
1119
|
+
} = any, TProfile extends {
|
|
1083
1120
|
isPlus?: boolean;
|
|
1084
1121
|
} = any>({ variant, product, memberSetting, initialSelectedPlusMemberMode, profile, children, }: PropsWithChildren<PlusMemberProviderProps<TProduct, TVariant, TProfile>>) => react_jsx_runtime.JSX.Element;
|
|
1085
1122
|
|
|
@@ -1139,6 +1176,7 @@ declare const CUSTOMER_ATTRIBUTE_KEY = "_discounts_function_env";
|
|
|
1139
1176
|
declare const CUSTOMER_SCRIPT_GIFT_KEY = "_giveaway_gradient_gifts";
|
|
1140
1177
|
declare const CODE_AMOUNT_KEY = "_sku_code_money";
|
|
1141
1178
|
declare const SCRIPT_CODE_AMOUNT_KEY = "_code_money";
|
|
1179
|
+
declare const MEMBER_PRICE_ATTRIBUTE_KEY = "_member_price";
|
|
1142
1180
|
declare const MAIN_PRODUCT_CODE: string[];
|
|
1143
1181
|
|
|
1144
1182
|
/**
|
|
@@ -1949,4 +1987,4 @@ declare function getCachedGeoLocation(cacheKey?: string): GeoLocationData | unde
|
|
|
1949
1987
|
*/
|
|
1950
1988
|
declare function clearGeoLocationCache(cacheKey?: string): void;
|
|
1951
1989
|
|
|
1952
|
-
export { type AddCartLinesInput, AddToCartInput, AddToCartLineItem, type ApplyCartCodesInput, type AutoFreeGift, type AutoFreeGiftCartLineInput, type AutoFreeGiftConfig, type AutoFreeGiftItem, type AutoFreeGiftList, type AutoFreeGiftMainProduct, type BuyNowInput, BuyRuleType, CODE_AMOUNT_KEY, CUSTOMER_ATTRIBUTE_KEY, CUSTOMER_SCRIPT_GIFT_KEY, type Config, type CreateCartInput, DeliveryData, DeliveryPlusType, type DiscountLabel, type FormattedGift, type FunctionGiftResult, type GeoLocationData, type GiftProduct, type GiftProductItem, type GiftTier, type HasPlusMemberInCartResult, type ImageMedia, type LocaleMapping, MAIN_PRODUCT_CODE, type MainProductInfo, type NormalizedSearchResultItem, type Options, OrderBasePriceType, type OrderDiscountConfig, type OrderDiscountResult, OrderDiscountType, PlusMemberContext, type PlusMemberContextValue, PlusMemberProvider, type PlusMemberProviderProps, PlusMemberSettingsMetafields, PlusMemberShippingMethodConfig, PriceBasePriceType, type PriceDiscountConfig, PriceDiscountType, type RemoveCartCodesInput, type RemoveCartLinesInput, type RewardItem, type RuleCondition, RuleType, SCRIPT_CODE_AMOUNT_KEY, type SearchResult, type SearchResultType, type SelectedOptionsResult,
|
|
1990
|
+
export { type AddCartLinesInput, AddToCartInput, AddToCartLineItem, type ApplyCartCodesInput, type AutoFreeGift, type AutoFreeGiftCartLineInput, type AutoFreeGiftConfig, type AutoFreeGiftItem, type AutoFreeGiftList, type AutoFreeGiftMainProduct, type BuyNowInput, BuyRuleType, CODE_AMOUNT_KEY, CUSTOMER_ATTRIBUTE_KEY, CUSTOMER_SCRIPT_GIFT_KEY, type Config, type CreateCartInput, DeliveryData, DeliveryPlusType, type DiscountLabel, type FormattedGift, type FunctionGiftResult, type GeoLocationData, type GiftProduct, type GiftProductItem, type GiftTier, type HasPlusMemberInCartResult, type ImageMedia, type LocaleMapping, MAIN_PRODUCT_CODE, MEMBER_PRICE_ATTRIBUTE_KEY, type MainProductInfo, type NormalizedSearchResultItem, type Options, OrderBasePriceType, type OrderDiscountConfig, type OrderDiscountResult, OrderDiscountType, PlusMemberContext, type PlusMemberContextValue, PlusMemberProvider, type PlusMemberProviderProps, PlusMemberSettingsMetafields, PlusMemberShippingMethodConfig, PriceBasePriceType, type PriceDiscountConfig, PriceDiscountType, type RemoveCartCodesInput, type RemoveCartLinesInput, type RewardItem, type RuleCondition, RuleType, SCRIPT_CODE_AMOUNT_KEY, type SearchResult, type SearchResultType, type SelectedOptionsResult, SelectedPlusMemberVariant, type ShippingMethodsContext, type SiteInfo, SpendMoneyType, type TieredDiscount, type UpdateCartAttributesInput, UseAddToCartOptions, type UseAllBlogsOptions, type UseAllCollectionsOptions, type UseAllProductsOptions, type UseArticleOptions, type UseArticlesInBlogOptions, type UseArticlesOptions, type UseAutoRemovePlusMemberInCartProps, type UseAvailableDeliveryCouponResult, type UseBlogOptions, type UseBuyNowOptions, type UseCalcGiftsFromLinesOptions, type UseCalcGiftsFromLinesResult, type UseCollectionOptions, type UseCollectionsOptions, type UseExposureOptions, type UseGeoLocationOptions, type UseHasPlusMemberInCartProps, type UseIntersectionOptions, type UsePlusMemberVariantsOptions, type UsePlusMemberVariantsResult, type UsePriceOptions, type UsePriceResult, type UseProductOptions, type UseProductsByHandlesOptions, type UseScriptAutoFreeGiftResult, type UseSearchOptions, type UseShippingMethodsOptions, type UseShippingMethodsResult, type UseSiteOptions, type UseUpdateCartAttributesOptions, type UseUpdatePlusMemberDeliveryOptionsProps, type VariantItem, type VariantMedia, type VideoMedia, checkAttributesUpdateNeeded, clearGeoLocationCache, createMockCartFromLines, currencyCodeMapping, defaultSWRMutationConfiguration, formatFunctionAutoFreeGift, formatScriptAutoFreeGift, getCachedGeoLocation, getDiscountEnvAttributeValue, getMatchedMainProductSubTotal, getQuery, getReferralAttributes, normalizeAddToCartLines, preCheck, safeParse, useAddCartLines, useAddToCart, useAllBlogs, useAllCollections, useAllProducts, useApplyCartCodes, useArticle, useArticles, useArticlesInBlog, useAutoRemovePlusMemberInCart, useAvailableDeliveryCoupon, useBlog, useBuyNow, useCalcAutoFreeGift, useCalcGiftsFromLines, useCalcOrderDiscount, useCartAttributes, useCartItemQuantityLimit, useCollection, useCollections, useCreateCart, useExposure, useGeoLocation, useHasPlusMemberInCart, useIntersection, usePlusMemberCheckoutCustomAttributes, usePlusMemberContext, usePlusMemberDeliveryCodes, usePlusMemberItemCustomAttributes, usePlusMemberNeedAddToCart, usePlusMemberVariants, usePrice, useProduct, useProductUrl, useProductsByHandles, useRemoveCartCodes, useRemoveCartLines, useReplaceCartPlusMember, useScriptAutoFreeGift, useSearch, useSelectedOptions, useShippingMethodAvailableCheck, useShippingMethods, useSite, useUpdateCartAttributes, useUpdateCartLines, useUpdateLineCodeAmountAttributes, useUpdatePlusMemberDeliveryOptions, useUpdateVariantQuery, useVariant, useVariantMedia };
|