@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
package/dist/hooks/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createContext, useMemo, useRef, useState, useEffect, useCallback, useContext } from 'react';
|
|
2
2
|
import useSWRMutation from 'swr/mutation';
|
|
3
|
-
import { getProductsByHandles, createCart, updateCartCodes, addCartLines, updateCartLines, removeCartLines, updateCartAttributes, getProduct, getAllProducts, getCollection, getAllCollections, getCollections, getBlog, getAllBlogs, getArticle, getArticles, getArticlesInBlog,
|
|
3
|
+
import { atobID, btoaID, getProductsByHandles, createCart, updateCartCodes, addCartLines, updateCartLines, removeCartLines, updateCartAttributes, getLocalStorage, getProduct, getAllProducts, getCollection, getAllCollections, getCollections, getBlog, getAllBlogs, getArticle, getArticles, getArticlesInBlog, setLocalStorage, updateCartDeliveryOptions } from '@anker-in/shopify-sdk';
|
|
4
4
|
import Cookies5 from 'js-cookie';
|
|
5
5
|
import { jsx } from 'react/jsx-runtime';
|
|
6
6
|
import Decimal2 from 'decimal.js';
|
|
@@ -154,16 +154,6 @@ var getQuery = () => {
|
|
|
154
154
|
}
|
|
155
155
|
return theRequest;
|
|
156
156
|
};
|
|
157
|
-
function atobID(id) {
|
|
158
|
-
if (id && typeof id === "string" && id.includes("/")) {
|
|
159
|
-
return id.split("/").pop()?.split("?")?.shift();
|
|
160
|
-
} else {
|
|
161
|
-
return id;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
function btoaID(id, type = "ProductVariant") {
|
|
165
|
-
return `gid://shopify/${type}/${id}`;
|
|
166
|
-
}
|
|
167
157
|
var getMatchedMainProductSubTotal = (cartData, variant_list, main_product) => {
|
|
168
158
|
const isAllStoreVariant = main_product?.all_store_variant ?? false;
|
|
169
159
|
const matchedList = cartData?.lineItems?.filter((line) => {
|
|
@@ -1283,12 +1273,10 @@ function useHasPlusMemberInCart({
|
|
|
1283
1273
|
};
|
|
1284
1274
|
}, [cart?.lineItems, plus_monthly_product, plus_annual_product]);
|
|
1285
1275
|
}
|
|
1286
|
-
|
|
1287
|
-
// src/hooks/cart/feature/use-cart-attributes.ts
|
|
1288
1276
|
var getReferralAttributes = () => {
|
|
1289
|
-
const inviteCode = Cookies5.get("invite_code");
|
|
1290
|
-
const playModeId = Cookies5.get("playModeId");
|
|
1291
|
-
const popup = Cookies5.get("_popup");
|
|
1277
|
+
const inviteCode = getLocalStorage("invite_code") || Cookies5.get("invite_code");
|
|
1278
|
+
const playModeId = getLocalStorage("playModeId") || Cookies5.get("playModeId");
|
|
1279
|
+
const popup = getLocalStorage("_popup") || Cookies5.get("_popup");
|
|
1292
1280
|
if (inviteCode && playModeId) {
|
|
1293
1281
|
return popup ? [
|
|
1294
1282
|
{ key: "_invite_code", value: inviteCode ? inviteCode : "" },
|
|
@@ -3029,6 +3017,6 @@ function clearGeoLocationCache(cacheKey = "geoLocation") {
|
|
|
3029
3017
|
}
|
|
3030
3018
|
}
|
|
3031
3019
|
|
|
3032
|
-
export { BuyRuleType, CODE_AMOUNT_KEY, CUSTOMER_ATTRIBUTE_KEY, CUSTOMER_SCRIPT_GIFT_KEY, DeliveryPlusType, MAIN_PRODUCT_CODE, OrderBasePriceType, OrderDiscountType, PLUS_MEMBER_TYPE, PlusMemberContext, PlusMemberMode, PlusMemberProvider, PriceBasePriceType, PriceDiscountType, RuleType, SCRIPT_CODE_AMOUNT_KEY, ShippingMethodMode, SpendMoneyType,
|
|
3020
|
+
export { BuyRuleType, CODE_AMOUNT_KEY, CUSTOMER_ATTRIBUTE_KEY, CUSTOMER_SCRIPT_GIFT_KEY, DeliveryPlusType, MAIN_PRODUCT_CODE, OrderBasePriceType, OrderDiscountType, PLUS_MEMBER_TYPE, PlusMemberContext, PlusMemberMode, PlusMemberProvider, PriceBasePriceType, PriceDiscountType, RuleType, SCRIPT_CODE_AMOUNT_KEY, ShippingMethodMode, SpendMoneyType, checkAttributesUpdateNeeded, clearGeoLocationCache, createMockCartFromLines, currencyCodeMapping, defaultSWRMutationConfiguration, formatFunctionAutoFreeGift, formatScriptAutoFreeGift, getCachedGeoLocation, getDiscountEnvAttributeValue, getMatchedMainProductSubTotal, getQuery, getReferralAttributes, normalizeAddToCartLines, preCheck, safeParse, useAddCartLines, useAddPlusMemberProductsToCart, useAddToCart, 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 };
|
|
3033
3021
|
//# sourceMappingURL=index.mjs.map
|
|
3034
3022
|
//# sourceMappingURL=index.mjs.map
|