@anker-in/shopify-react 0.1.1-beta.21 → 0.1.1-beta.23
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 +245 -210
- package/dist/hooks/index.d.ts +245 -210
- package/dist/hooks/index.js +72 -9
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +71 -8
- 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 +72 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +71 -8
- package/dist/index.mjs.map +1 -1
- package/dist/provider/index.d.mts +1 -2
- package/dist/provider/index.d.ts +1 -2
- package/dist/provider/index.js +9 -7
- package/dist/provider/index.js.map +1 -1
- package/dist/provider/index.mjs +8 -6
- package/dist/provider/index.mjs.map +1 -1
- package/dist/{types-C1So3siD.d.mts → types-BSsb8OPm.d.mts} +1 -34
- package/dist/{types-C1So3siD.d.ts → types-BSsb8OPm.d.ts} +1 -34
- package/package.json +3 -3
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import * as swr_mutation from 'swr/mutation';
|
|
2
|
-
import { SWRMutationConfiguration } from 'swr/mutation';
|
|
3
1
|
import { NormalizedProductVariant, NormalizedProduct, MoneyV2, NormalizedCart, MailingAddress } from '@anker-in/shopify-sdk';
|
|
4
2
|
|
|
5
3
|
/**
|
|
@@ -131,37 +129,6 @@ interface UseAddToCartOptions {
|
|
|
131
129
|
/** Enable tracking (GA and FBQ) */
|
|
132
130
|
withTrack?: boolean;
|
|
133
131
|
}
|
|
134
|
-
/**
|
|
135
|
-
* Hook for adding items to cart with tracking support
|
|
136
|
-
*
|
|
137
|
-
* This is the enhanced version that includes:
|
|
138
|
-
* - Automatic cart creation if needed
|
|
139
|
-
* - Discount code validation
|
|
140
|
-
* - Google Analytics tracking
|
|
141
|
-
* - Facebook Pixel tracking
|
|
142
|
-
* - Invalid code handling
|
|
143
|
-
*
|
|
144
|
-
* @param options - Hook configuration
|
|
145
|
-
* @param swrOptions - SWR mutation configuration
|
|
146
|
-
* @returns SWR mutation with trigger function
|
|
147
|
-
*
|
|
148
|
-
* @example
|
|
149
|
-
* ```tsx
|
|
150
|
-
* const { trigger, isMutating } = useAddToCart({ withTrack: true})
|
|
151
|
-
*
|
|
152
|
-
* await trigger({
|
|
153
|
-
* lineItems: [{
|
|
154
|
-
* variantId: 'gid://shopify/ProductVariant/123',
|
|
155
|
-
* quantity: 2
|
|
156
|
-
* }],
|
|
157
|
-
* gtmParams: {
|
|
158
|
-
* pageGroup: 'PDP',
|
|
159
|
-
* position: 'Add to Cart Button'
|
|
160
|
-
* }
|
|
161
|
-
* })
|
|
162
|
-
* ```
|
|
163
|
-
*/
|
|
164
|
-
declare function useAddToCart({ withTrack }?: UseAddToCartOptions, swrOptions?: SWRMutationConfiguration<NormalizedCart | undefined, Error, string, AddToCartInput>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, string, AddToCartInput>;
|
|
165
132
|
|
|
166
133
|
/**
|
|
167
134
|
* Plus Member Types
|
|
@@ -544,4 +511,4 @@ type DeliveryData = {
|
|
|
544
511
|
deliveryCustomData: DeliveryCustomData;
|
|
545
512
|
};
|
|
546
513
|
|
|
547
|
-
export { type AddToCartLineItem as A, type BuyNowTrackConfig as B, DeliveryPlusType as D, type GtmParams as G, PLUS_MEMBER_TYPE as P, ShippingMethodMode as S, type UseAddToCartOptions as U, type AddToCartInput as a, PlusMemberMode as b, type PlusMemberShippingMethodMetafields as c, type PlusMemberShippingMethodConfig as d, type PlusMemberSettingsMetafields as e, type SelectedPlusMemberProduct as f, type DeliveryCustomData as g, type DeliveryData as h, gaTrack as i, trackBeginCheckoutGA as j, trackBuyNowGA as k, trackAddToCartFBQ as l, trackBuyNowFBQ as m, trackAddToCartGA as t
|
|
514
|
+
export { type AddToCartLineItem as A, type BuyNowTrackConfig as B, DeliveryPlusType as D, type GtmParams as G, PLUS_MEMBER_TYPE as P, ShippingMethodMode as S, type UseAddToCartOptions as U, type AddToCartInput as a, PlusMemberMode as b, type PlusMemberShippingMethodMetafields as c, type PlusMemberShippingMethodConfig as d, type PlusMemberSettingsMetafields as e, type SelectedPlusMemberProduct as f, type DeliveryCustomData as g, type DeliveryData as h, gaTrack as i, trackBeginCheckoutGA as j, trackBuyNowGA as k, trackAddToCartFBQ as l, trackBuyNowFBQ as m, trackAddToCartGA as t };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import * as swr_mutation from 'swr/mutation';
|
|
2
|
-
import { SWRMutationConfiguration } from 'swr/mutation';
|
|
3
1
|
import { NormalizedProductVariant, NormalizedProduct, MoneyV2, NormalizedCart, MailingAddress } from '@anker-in/shopify-sdk';
|
|
4
2
|
|
|
5
3
|
/**
|
|
@@ -131,37 +129,6 @@ interface UseAddToCartOptions {
|
|
|
131
129
|
/** Enable tracking (GA and FBQ) */
|
|
132
130
|
withTrack?: boolean;
|
|
133
131
|
}
|
|
134
|
-
/**
|
|
135
|
-
* Hook for adding items to cart with tracking support
|
|
136
|
-
*
|
|
137
|
-
* This is the enhanced version that includes:
|
|
138
|
-
* - Automatic cart creation if needed
|
|
139
|
-
* - Discount code validation
|
|
140
|
-
* - Google Analytics tracking
|
|
141
|
-
* - Facebook Pixel tracking
|
|
142
|
-
* - Invalid code handling
|
|
143
|
-
*
|
|
144
|
-
* @param options - Hook configuration
|
|
145
|
-
* @param swrOptions - SWR mutation configuration
|
|
146
|
-
* @returns SWR mutation with trigger function
|
|
147
|
-
*
|
|
148
|
-
* @example
|
|
149
|
-
* ```tsx
|
|
150
|
-
* const { trigger, isMutating } = useAddToCart({ withTrack: true})
|
|
151
|
-
*
|
|
152
|
-
* await trigger({
|
|
153
|
-
* lineItems: [{
|
|
154
|
-
* variantId: 'gid://shopify/ProductVariant/123',
|
|
155
|
-
* quantity: 2
|
|
156
|
-
* }],
|
|
157
|
-
* gtmParams: {
|
|
158
|
-
* pageGroup: 'PDP',
|
|
159
|
-
* position: 'Add to Cart Button'
|
|
160
|
-
* }
|
|
161
|
-
* })
|
|
162
|
-
* ```
|
|
163
|
-
*/
|
|
164
|
-
declare function useAddToCart({ withTrack }?: UseAddToCartOptions, swrOptions?: SWRMutationConfiguration<NormalizedCart | undefined, Error, string, AddToCartInput>): swr_mutation.SWRMutationResponse<NormalizedCart | undefined, Error, string, AddToCartInput>;
|
|
165
132
|
|
|
166
133
|
/**
|
|
167
134
|
* Plus Member Types
|
|
@@ -544,4 +511,4 @@ type DeliveryData = {
|
|
|
544
511
|
deliveryCustomData: DeliveryCustomData;
|
|
545
512
|
};
|
|
546
513
|
|
|
547
|
-
export { type AddToCartLineItem as A, type BuyNowTrackConfig as B, DeliveryPlusType as D, type GtmParams as G, PLUS_MEMBER_TYPE as P, ShippingMethodMode as S, type UseAddToCartOptions as U, type AddToCartInput as a, PlusMemberMode as b, type PlusMemberShippingMethodMetafields as c, type PlusMemberShippingMethodConfig as d, type PlusMemberSettingsMetafields as e, type SelectedPlusMemberProduct as f, type DeliveryCustomData as g, type DeliveryData as h, gaTrack as i, trackBeginCheckoutGA as j, trackBuyNowGA as k, trackAddToCartFBQ as l, trackBuyNowFBQ as m, trackAddToCartGA as t
|
|
514
|
+
export { type AddToCartLineItem as A, type BuyNowTrackConfig as B, DeliveryPlusType as D, type GtmParams as G, PLUS_MEMBER_TYPE as P, ShippingMethodMode as S, type UseAddToCartOptions as U, type AddToCartInput as a, PlusMemberMode as b, type PlusMemberShippingMethodMetafields as c, type PlusMemberShippingMethodConfig as d, type PlusMemberSettingsMetafields as e, type SelectedPlusMemberProduct as f, type DeliveryCustomData as g, type DeliveryData as h, gaTrack as i, trackBeginCheckoutGA as j, trackBuyNowGA as k, trackAddToCartFBQ as l, trackBuyNowFBQ as m, trackAddToCartGA as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anker-in/shopify-react",
|
|
3
|
-
"version": "0.1.1-beta.
|
|
3
|
+
"version": "0.1.1-beta.23",
|
|
4
4
|
"description": "React hooks and components for Shopify SDK",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"decimal.js": "^10.6.0",
|
|
32
32
|
"js-cookie": "^3.0.5",
|
|
33
33
|
"swr": "^2.2.0",
|
|
34
|
-
"@anker-in/shopify-
|
|
35
|
-
"@anker-in/shopify-
|
|
34
|
+
"@anker-in/shopify-core": "0.1.1-beta.7",
|
|
35
|
+
"@anker-in/shopify-sdk": "0.1.1-beta.11"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"react": ">=18.0.0",
|