@anker-in/shopify-react 0.1.1-beta.19 → 0.1.1-beta.20
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/adapters/index.d.mts +2 -2
- package/dist/adapters/index.d.ts +2 -2
- package/dist/hooks/index.d.mts +12 -14
- package/dist/hooks/index.d.ts +12 -14
- package/dist/hooks/index.js +5 -19
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +5 -17
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +18 -43
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -18
- package/dist/index.mjs.map +1 -1
- package/dist/provider/index.d.mts +7 -9
- package/dist/provider/index.d.ts +7 -9
- package/dist/provider/index.js +12 -17
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/index.mjs +11 -16
- package/dist/provider/index.mjs.map +1 -1
- package/dist/{types-DX-2ABDs.d.mts → types-C1So3siD.d.mts} +2 -16
- package/dist/{types-DX-2ABDs.d.ts → types-C1So3siD.d.ts} +2 -16
- package/dist/{types-BLMoxbOk.d.mts → types-Dt0DUG00.d.mts} +1 -9
- package/dist/{types-BLMoxbOk.d.ts → types-Dt0DUG00.d.ts} +1 -9
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CookieAdapter } from '../types-
|
|
2
|
-
export {
|
|
1
|
+
import { C as CookieAdapter } from '../types-Dt0DUG00.mjs';
|
|
2
|
+
export { a as CookieOptions, R as RouterAdapter, U as UserContextAdapter } from '../types-Dt0DUG00.mjs';
|
|
3
3
|
import { CartCookieAdapter } from '@anker-in/shopify-sdk';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/adapters/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CookieAdapter } from '../types-
|
|
2
|
-
export {
|
|
1
|
+
import { C as CookieAdapter } from '../types-Dt0DUG00.js';
|
|
2
|
+
export { a as CookieOptions, R as RouterAdapter, U as UserContextAdapter } from '../types-Dt0DUG00.js';
|
|
3
3
|
import { CartCookieAdapter } from '@anker-in/shopify-sdk';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/hooks/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
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
|
-
import { CartLineInput
|
|
5
|
-
import { A as AddToCartLineItem, G as GtmParams, B as BuyNowTrackConfig, d as PlusMemberShippingMethodConfig, e as PlusMemberSettingsMetafields, D as DeliveryPlusType, f as SelectedPlusMemberProduct, h as DeliveryData } from '../types-
|
|
6
|
-
export { a as AddToCartInput, g as DeliveryCustomData,
|
|
4
|
+
import { CartLineInput, NormalizedCart, UpdateCartLinesOptions, HasMetafieldsIdentifier, NormalizedProduct, NormalizedProductVariant, NormalizedLineItem, NormalizedAttribute, Media, NormalizedCollection, CollectionsConnection, NormalizedBlog, NormalizedArticle } from '@anker-in/shopify-sdk';
|
|
5
|
+
import { A as AddToCartLineItem, G as GtmParams, B as BuyNowTrackConfig, d as PlusMemberShippingMethodConfig, e as PlusMemberSettingsMetafields, D as DeliveryPlusType, f as SelectedPlusMemberProduct, h as DeliveryData } from '../types-C1So3siD.mjs';
|
|
6
|
+
export { a as AddToCartInput, g as DeliveryCustomData, P as PLUS_MEMBER_TYPE, b as PlusMemberMode, c as PlusMemberShippingMethodMetafields, S as ShippingMethodMode, U as UseAddToCartOptions, u as useAddToCart } from '../types-C1So3siD.mjs';
|
|
7
7
|
import Decimal from 'decimal.js';
|
|
8
8
|
import * as swr from 'swr';
|
|
9
9
|
import swr__default, { SWRConfiguration } from 'swr';
|
|
@@ -14,7 +14,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
14
14
|
|
|
15
15
|
interface CreateCartInput {
|
|
16
16
|
/** Lines to add to the cart */
|
|
17
|
-
lines?: CartLineInput
|
|
17
|
+
lines?: CartLineInput[];
|
|
18
18
|
/** Buyer identity for cart creation */
|
|
19
19
|
buyerIdentity?: {
|
|
20
20
|
email?: string;
|
|
@@ -63,7 +63,7 @@ interface AddCartLinesInput {
|
|
|
63
63
|
/** Cart ID (optional, will use cookie or create new cart) */
|
|
64
64
|
cartId?: string;
|
|
65
65
|
/** Lines to add */
|
|
66
|
-
lines: CartLineInput
|
|
66
|
+
lines: CartLineInput[];
|
|
67
67
|
/** Buyer identity for new cart */
|
|
68
68
|
buyerIdentity?: {
|
|
69
69
|
email?: string;
|
|
@@ -403,9 +403,9 @@ interface FunctionGiftResult {
|
|
|
403
403
|
}
|
|
404
404
|
interface FormattedGift {
|
|
405
405
|
tier: GiftTier;
|
|
406
|
-
itemsToAdd:
|
|
406
|
+
itemsToAdd: AutoFreeGiftCartLineInput[];
|
|
407
407
|
}
|
|
408
|
-
interface
|
|
408
|
+
interface AutoFreeGiftCartLineInput {
|
|
409
409
|
variant: {
|
|
410
410
|
id: string;
|
|
411
411
|
handle: string;
|
|
@@ -490,7 +490,7 @@ interface UseCalcGiftsFromLinesResult {
|
|
|
490
490
|
/** Script gift calculation result */
|
|
491
491
|
scriptGift: UseScriptAutoFreeGiftResult;
|
|
492
492
|
/** All gift lines that need to be added to cart (combined from both) */
|
|
493
|
-
allGiftLines:
|
|
493
|
+
allGiftLines: AutoFreeGiftCartLineInput[];
|
|
494
494
|
/** Whether any gifts are available */
|
|
495
495
|
hasGifts: boolean;
|
|
496
496
|
}
|
|
@@ -995,7 +995,7 @@ declare const PlusMemberProvider: <TProduct = any, TVariant = any, TProfile = an
|
|
|
995
995
|
|
|
996
996
|
declare const getReferralAttributes: () => {
|
|
997
997
|
key: string;
|
|
998
|
-
value:
|
|
998
|
+
value: any;
|
|
999
999
|
}[];
|
|
1000
1000
|
declare const useCartAttributes: ({ profile, customer, cart, memberSetting, }: {
|
|
1001
1001
|
profile: any;
|
|
@@ -1080,8 +1080,6 @@ declare function normalizeAddToCartLines(lines: AddToCartLineItem[]): Normalized
|
|
|
1080
1080
|
declare function createMockCartFromLines(lines: AddToCartLineItem[], existingCart?: any): any;
|
|
1081
1081
|
|
|
1082
1082
|
declare const getQuery: () => Record<string, string>;
|
|
1083
|
-
declare function atobID(id: string): string | undefined;
|
|
1084
|
-
declare function btoaID(id: string, type?: 'ProductVariant' | 'Product'): string;
|
|
1085
1083
|
|
|
1086
1084
|
declare const getMatchedMainProductSubTotal: (cartData: any, variant_list: AutoFreeGiftMainProduct["variant_id_list"], main_product: AutoFreeGiftMainProduct) => any;
|
|
1087
1085
|
declare const safeParse: (str: string) => any;
|
|
@@ -1587,7 +1585,7 @@ interface UseArticlesInBlogOptions extends SWRConfiguration<NormalizedArticle[]>
|
|
|
1587
1585
|
declare function useArticlesInBlog(options?: UseArticlesInBlogOptions): swr.SWRResponse<NormalizedArticle[], any, SWRConfiguration<NormalizedArticle[], any, ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<NormalizedArticle[]>) | ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<NormalizedArticle[]>)> | undefined>;
|
|
1588
1586
|
|
|
1589
1587
|
type SearchResultType = 'ARTICLE' | 'PAGE' | 'PRODUCT';
|
|
1590
|
-
interface
|
|
1588
|
+
interface NormalizedSearchResultItem {
|
|
1591
1589
|
type: SearchResultType;
|
|
1592
1590
|
id?: string;
|
|
1593
1591
|
handle?: string;
|
|
@@ -1600,7 +1598,7 @@ interface SearchResultItem {
|
|
|
1600
1598
|
};
|
|
1601
1599
|
}
|
|
1602
1600
|
interface SearchResult {
|
|
1603
|
-
items:
|
|
1601
|
+
items: NormalizedSearchResultItem[];
|
|
1604
1602
|
totalCount: number;
|
|
1605
1603
|
pageInfo?: {
|
|
1606
1604
|
hasNextPage: boolean;
|
|
@@ -1878,4 +1876,4 @@ declare function getCachedGeoLocation(cacheKey?: string): GeoLocationData | unde
|
|
|
1878
1876
|
*/
|
|
1879
1877
|
declare function clearGeoLocationCache(cacheKey?: string): void;
|
|
1880
1878
|
|
|
1881
|
-
export { type AddCartLinesInput, AddToCartLineItem, type ApplyCartCodesInput, type AutoFreeGift, type AutoFreeGiftConfig, type AutoFreeGiftItem, type AutoFreeGiftList, type AutoFreeGiftMainProduct, type BuyNowInput, BuyRuleType, CODE_AMOUNT_KEY, CUSTOMER_ATTRIBUTE_KEY, CUSTOMER_SCRIPT_GIFT_KEY, type
|
|
1879
|
+
export { type AddCartLinesInput, 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, SelectedPlusMemberProduct, type ShippingMethodsContext, type SiteInfo, SpendMoneyType, type TieredDiscount, type UpdateCartAttributesInput, type UseAllBlogsOptions, type UseAllCollectionsOptions, type UseAllProductsOptions, type UseArticleOptions, type UseArticlesInBlogOptions, type UseArticlesOptions, type UseAutoRemovePlusMemberInCartProps, type UseBlogOptions, type UseBuyNowOptions, type UseCalcGiftsFromLinesOptions, type UseCalcGiftsFromLinesResult, type UseCollectionOptions, type UseCollectionsOptions, type UseExposureOptions, type UseGeoLocationOptions, type UseHasPlusMemberInCartProps, type UseIntersectionOptions, type UsePriceOptions, type UsePriceResult, type UseProductOptions, type UseProductsByHandlesOptions, type UseScriptAutoFreeGiftResult, type UseSearchOptions, type UseShippingMethodsOptions, type UseShippingMethodsResult, type UseSiteOptions, type UseUpdatePlusMemberDeliveryOptionsProps, type VariantItem, type VariantMedia, type VideoMedia, checkAttributesUpdateNeeded, clearGeoLocationCache, createMockCartFromLines, currencyCodeMapping, defaultSWRMutationConfiguration, formatFunctionAutoFreeGift, formatScriptAutoFreeGift, getCachedGeoLocation, getDiscountEnvAttributeValue, getMatchedMainProductSubTotal, getQuery, getReferralAttributes, normalizeAddToCartLines, preCheck, safeParse, useAddCartLines, useAddPlusMemberProductsToCart, useAllBlogs, useAllCollections, useAllProducts, useApplyCartCodes, useArticle, useArticles, useArticlesInBlog, useAutoRemovePlusMemberInCart, useBlog, useBuyNow, useCalcAutoFreeGift, useCalcGiftsFromLines, useCalcOrderDiscount, useCartAttributes, useCartItemQuantityLimit, useCollection, useCollections, useCreateCart, useExposure, useGeoLocation, useHasPlusMemberInCart, useIntersection, usePlusAnnualProductVariant, usePlusMemberCheckoutCustomAttributes, usePlusMemberContext, usePlusMemberDeliveryCodes, usePlusMemberItemCustomAttributes, usePlusMonthlyProductVariant, 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
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
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
|
-
import { CartLineInput
|
|
5
|
-
import { A as AddToCartLineItem, G as GtmParams, B as BuyNowTrackConfig, d as PlusMemberShippingMethodConfig, e as PlusMemberSettingsMetafields, D as DeliveryPlusType, f as SelectedPlusMemberProduct, h as DeliveryData } from '../types-
|
|
6
|
-
export { a as AddToCartInput, g as DeliveryCustomData,
|
|
4
|
+
import { CartLineInput, NormalizedCart, UpdateCartLinesOptions, HasMetafieldsIdentifier, NormalizedProduct, NormalizedProductVariant, NormalizedLineItem, NormalizedAttribute, Media, NormalizedCollection, CollectionsConnection, NormalizedBlog, NormalizedArticle } from '@anker-in/shopify-sdk';
|
|
5
|
+
import { A as AddToCartLineItem, G as GtmParams, B as BuyNowTrackConfig, d as PlusMemberShippingMethodConfig, e as PlusMemberSettingsMetafields, D as DeliveryPlusType, f as SelectedPlusMemberProduct, h as DeliveryData } from '../types-C1So3siD.js';
|
|
6
|
+
export { a as AddToCartInput, g as DeliveryCustomData, P as PLUS_MEMBER_TYPE, b as PlusMemberMode, c as PlusMemberShippingMethodMetafields, S as ShippingMethodMode, U as UseAddToCartOptions, u as useAddToCart } from '../types-C1So3siD.js';
|
|
7
7
|
import Decimal from 'decimal.js';
|
|
8
8
|
import * as swr from 'swr';
|
|
9
9
|
import swr__default, { SWRConfiguration } from 'swr';
|
|
@@ -14,7 +14,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
14
14
|
|
|
15
15
|
interface CreateCartInput {
|
|
16
16
|
/** Lines to add to the cart */
|
|
17
|
-
lines?: CartLineInput
|
|
17
|
+
lines?: CartLineInput[];
|
|
18
18
|
/** Buyer identity for cart creation */
|
|
19
19
|
buyerIdentity?: {
|
|
20
20
|
email?: string;
|
|
@@ -63,7 +63,7 @@ interface AddCartLinesInput {
|
|
|
63
63
|
/** Cart ID (optional, will use cookie or create new cart) */
|
|
64
64
|
cartId?: string;
|
|
65
65
|
/** Lines to add */
|
|
66
|
-
lines: CartLineInput
|
|
66
|
+
lines: CartLineInput[];
|
|
67
67
|
/** Buyer identity for new cart */
|
|
68
68
|
buyerIdentity?: {
|
|
69
69
|
email?: string;
|
|
@@ -403,9 +403,9 @@ interface FunctionGiftResult {
|
|
|
403
403
|
}
|
|
404
404
|
interface FormattedGift {
|
|
405
405
|
tier: GiftTier;
|
|
406
|
-
itemsToAdd:
|
|
406
|
+
itemsToAdd: AutoFreeGiftCartLineInput[];
|
|
407
407
|
}
|
|
408
|
-
interface
|
|
408
|
+
interface AutoFreeGiftCartLineInput {
|
|
409
409
|
variant: {
|
|
410
410
|
id: string;
|
|
411
411
|
handle: string;
|
|
@@ -490,7 +490,7 @@ interface UseCalcGiftsFromLinesResult {
|
|
|
490
490
|
/** Script gift calculation result */
|
|
491
491
|
scriptGift: UseScriptAutoFreeGiftResult;
|
|
492
492
|
/** All gift lines that need to be added to cart (combined from both) */
|
|
493
|
-
allGiftLines:
|
|
493
|
+
allGiftLines: AutoFreeGiftCartLineInput[];
|
|
494
494
|
/** Whether any gifts are available */
|
|
495
495
|
hasGifts: boolean;
|
|
496
496
|
}
|
|
@@ -995,7 +995,7 @@ declare const PlusMemberProvider: <TProduct = any, TVariant = any, TProfile = an
|
|
|
995
995
|
|
|
996
996
|
declare const getReferralAttributes: () => {
|
|
997
997
|
key: string;
|
|
998
|
-
value:
|
|
998
|
+
value: any;
|
|
999
999
|
}[];
|
|
1000
1000
|
declare const useCartAttributes: ({ profile, customer, cart, memberSetting, }: {
|
|
1001
1001
|
profile: any;
|
|
@@ -1080,8 +1080,6 @@ declare function normalizeAddToCartLines(lines: AddToCartLineItem[]): Normalized
|
|
|
1080
1080
|
declare function createMockCartFromLines(lines: AddToCartLineItem[], existingCart?: any): any;
|
|
1081
1081
|
|
|
1082
1082
|
declare const getQuery: () => Record<string, string>;
|
|
1083
|
-
declare function atobID(id: string): string | undefined;
|
|
1084
|
-
declare function btoaID(id: string, type?: 'ProductVariant' | 'Product'): string;
|
|
1085
1083
|
|
|
1086
1084
|
declare const getMatchedMainProductSubTotal: (cartData: any, variant_list: AutoFreeGiftMainProduct["variant_id_list"], main_product: AutoFreeGiftMainProduct) => any;
|
|
1087
1085
|
declare const safeParse: (str: string) => any;
|
|
@@ -1587,7 +1585,7 @@ interface UseArticlesInBlogOptions extends SWRConfiguration<NormalizedArticle[]>
|
|
|
1587
1585
|
declare function useArticlesInBlog(options?: UseArticlesInBlogOptions): swr.SWRResponse<NormalizedArticle[], any, SWRConfiguration<NormalizedArticle[], any, ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<NormalizedArticle[]>) | ((arg: readonly [any, ...unknown[]]) => swr__internal.FetcherResponse<NormalizedArticle[]>)> | undefined>;
|
|
1588
1586
|
|
|
1589
1587
|
type SearchResultType = 'ARTICLE' | 'PAGE' | 'PRODUCT';
|
|
1590
|
-
interface
|
|
1588
|
+
interface NormalizedSearchResultItem {
|
|
1591
1589
|
type: SearchResultType;
|
|
1592
1590
|
id?: string;
|
|
1593
1591
|
handle?: string;
|
|
@@ -1600,7 +1598,7 @@ interface SearchResultItem {
|
|
|
1600
1598
|
};
|
|
1601
1599
|
}
|
|
1602
1600
|
interface SearchResult {
|
|
1603
|
-
items:
|
|
1601
|
+
items: NormalizedSearchResultItem[];
|
|
1604
1602
|
totalCount: number;
|
|
1605
1603
|
pageInfo?: {
|
|
1606
1604
|
hasNextPage: boolean;
|
|
@@ -1878,4 +1876,4 @@ declare function getCachedGeoLocation(cacheKey?: string): GeoLocationData | unde
|
|
|
1878
1876
|
*/
|
|
1879
1877
|
declare function clearGeoLocationCache(cacheKey?: string): void;
|
|
1880
1878
|
|
|
1881
|
-
export { type AddCartLinesInput, AddToCartLineItem, type ApplyCartCodesInput, type AutoFreeGift, type AutoFreeGiftConfig, type AutoFreeGiftItem, type AutoFreeGiftList, type AutoFreeGiftMainProduct, type BuyNowInput, BuyRuleType, CODE_AMOUNT_KEY, CUSTOMER_ATTRIBUTE_KEY, CUSTOMER_SCRIPT_GIFT_KEY, type
|
|
1879
|
+
export { type AddCartLinesInput, 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, SelectedPlusMemberProduct, type ShippingMethodsContext, type SiteInfo, SpendMoneyType, type TieredDiscount, type UpdateCartAttributesInput, type UseAllBlogsOptions, type UseAllCollectionsOptions, type UseAllProductsOptions, type UseArticleOptions, type UseArticlesInBlogOptions, type UseArticlesOptions, type UseAutoRemovePlusMemberInCartProps, type UseBlogOptions, type UseBuyNowOptions, type UseCalcGiftsFromLinesOptions, type UseCalcGiftsFromLinesResult, type UseCollectionOptions, type UseCollectionsOptions, type UseExposureOptions, type UseGeoLocationOptions, type UseHasPlusMemberInCartProps, type UseIntersectionOptions, type UsePriceOptions, type UsePriceResult, type UseProductOptions, type UseProductsByHandlesOptions, type UseScriptAutoFreeGiftResult, type UseSearchOptions, type UseShippingMethodsOptions, type UseShippingMethodsResult, type UseSiteOptions, type UseUpdatePlusMemberDeliveryOptionsProps, type VariantItem, type VariantMedia, type VideoMedia, checkAttributesUpdateNeeded, clearGeoLocationCache, createMockCartFromLines, currencyCodeMapping, defaultSWRMutationConfiguration, formatFunctionAutoFreeGift, formatScriptAutoFreeGift, getCachedGeoLocation, getDiscountEnvAttributeValue, getMatchedMainProductSubTotal, getQuery, getReferralAttributes, normalizeAddToCartLines, preCheck, safeParse, useAddCartLines, useAddPlusMemberProductsToCart, useAllBlogs, useAllCollections, useAllProducts, useApplyCartCodes, useArticle, useArticles, useArticlesInBlog, useAutoRemovePlusMemberInCart, useBlog, useBuyNow, useCalcAutoFreeGift, useCalcGiftsFromLines, useCalcOrderDiscount, useCartAttributes, useCartItemQuantityLimit, useCollection, useCollections, useCreateCart, useExposure, useGeoLocation, useHasPlusMemberInCart, useIntersection, usePlusAnnualProductVariant, usePlusMemberCheckoutCustomAttributes, usePlusMemberContext, usePlusMemberDeliveryCodes, usePlusMemberItemCustomAttributes, usePlusMonthlyProductVariant, usePrice, useProduct, useProductUrl, useProductsByHandles, useRemoveCartCodes, useRemoveCartLines, useReplaceCartPlusMember, useScriptAutoFreeGift, useSearch, useSelectedOptions, useShippingMethodAvailableCheck, useShippingMethods, useSite, useUpdateCartAttributes, useUpdateCartLines, useUpdateLineCodeAmountAttributes, useUpdatePlusMemberDeliveryOptions, useUpdateVariantQuery, useVariant, useVariantMedia };
|
package/dist/hooks/index.js
CHANGED
|
@@ -163,22 +163,12 @@ var getQuery = () => {
|
|
|
163
163
|
}
|
|
164
164
|
return theRequest;
|
|
165
165
|
};
|
|
166
|
-
function atobID(id) {
|
|
167
|
-
if (id && typeof id === "string" && id.includes("/")) {
|
|
168
|
-
return id.split("/").pop()?.split("?")?.shift();
|
|
169
|
-
} else {
|
|
170
|
-
return id;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
function btoaID(id, type = "ProductVariant") {
|
|
174
|
-
return `gid://shopify/${type}/${id}`;
|
|
175
|
-
}
|
|
176
166
|
var getMatchedMainProductSubTotal = (cartData, variant_list, main_product) => {
|
|
177
167
|
const isAllStoreVariant = main_product?.all_store_variant ?? false;
|
|
178
168
|
const matchedList = cartData?.lineItems?.filter((line) => {
|
|
179
169
|
const { is_gift } = getDiscountEnvAttributeValue(line.customAttributes);
|
|
180
170
|
return isAllStoreVariant ? !is_gift : variant_list?.find((item) => {
|
|
181
|
-
return !is_gift && atobID(line.variantId) === item;
|
|
171
|
+
return !is_gift && shopifySdk.atobID(line.variantId) === item;
|
|
182
172
|
});
|
|
183
173
|
});
|
|
184
174
|
return matchedList?.reduce((acc, line) => {
|
|
@@ -421,7 +411,7 @@ var useCalcAutoFreeGift = (cart, autoFreeGiftConfig, customer, lines) => {
|
|
|
421
411
|
if (!giftProduct) return null;
|
|
422
412
|
return {
|
|
423
413
|
variant: {
|
|
424
|
-
id: btoaID(giftProduct.variant_id),
|
|
414
|
+
id: shopifySdk.btoaID(giftProduct.variant_id),
|
|
425
415
|
handle: giftProduct.handle,
|
|
426
416
|
sku: giftProduct.sku
|
|
427
417
|
},
|
|
@@ -1292,12 +1282,10 @@ function useHasPlusMemberInCart({
|
|
|
1292
1282
|
};
|
|
1293
1283
|
}, [cart?.lineItems, plus_monthly_product, plus_annual_product]);
|
|
1294
1284
|
}
|
|
1295
|
-
|
|
1296
|
-
// src/hooks/cart/feature/use-cart-attributes.ts
|
|
1297
1285
|
var getReferralAttributes = () => {
|
|
1298
|
-
const inviteCode = Cookies5__default.default.get("invite_code");
|
|
1299
|
-
const playModeId = Cookies5__default.default.get("playModeId");
|
|
1300
|
-
const popup = Cookies5__default.default.get("_popup");
|
|
1286
|
+
const inviteCode = shopifySdk.getLocalStorage("invite_code") || Cookies5__default.default.get("invite_code");
|
|
1287
|
+
const playModeId = shopifySdk.getLocalStorage("playModeId") || Cookies5__default.default.get("playModeId");
|
|
1288
|
+
const popup = shopifySdk.getLocalStorage("_popup") || Cookies5__default.default.get("_popup");
|
|
1301
1289
|
if (inviteCode && playModeId) {
|
|
1302
1290
|
return popup ? [
|
|
1303
1291
|
{ key: "_invite_code", value: inviteCode ? inviteCode : "" },
|
|
@@ -3056,8 +3044,6 @@ exports.RuleType = RuleType;
|
|
|
3056
3044
|
exports.SCRIPT_CODE_AMOUNT_KEY = SCRIPT_CODE_AMOUNT_KEY;
|
|
3057
3045
|
exports.ShippingMethodMode = ShippingMethodMode;
|
|
3058
3046
|
exports.SpendMoneyType = SpendMoneyType;
|
|
3059
|
-
exports.atobID = atobID;
|
|
3060
|
-
exports.btoaID = btoaID;
|
|
3061
3047
|
exports.checkAttributesUpdateNeeded = checkAttributesUpdateNeeded;
|
|
3062
3048
|
exports.clearGeoLocationCache = clearGeoLocationCache;
|
|
3063
3049
|
exports.createMockCartFromLines = createMockCartFromLines;
|