@tagadapay/plugin-sdk 2.6.4 → 2.6.6
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/react/components/GooglePayButton.d.ts +12 -0
- package/dist/react/components/GooglePayButton.js +340 -0
- package/dist/react/components/index.d.ts +3 -2
- package/dist/react/components/index.js +3 -2
- package/dist/react/hooks/useApplePay.js +38 -10
- package/dist/react/hooks/useGoogleAutocomplete.d.ts +2 -0
- package/dist/react/hooks/useGoogleAutocomplete.js +18 -2
- package/dist/react/hooks/useGooglePay.d.ts +22 -0
- package/dist/react/hooks/useGooglePay.js +32 -0
- package/dist/react/index.d.ts +2 -1
- package/dist/react/index.js +3 -1
- package/dist/react/types/apple-pay.d.ts +0 -25
- package/dist/v2/core/googleAutocomplete.d.ts +2 -0
- package/dist/v2/core/googleAutocomplete.js +21 -8
- package/dist/v2/core/resources/checkout.d.ts +70 -2
- package/dist/v2/core/resources/discounts.d.ts +53 -0
- package/dist/v2/core/resources/discounts.js +29 -0
- package/dist/v2/core/resources/expressPaymentMethods.d.ts +56 -0
- package/dist/v2/core/resources/expressPaymentMethods.js +27 -0
- package/dist/v2/core/resources/index.d.ts +7 -4
- package/dist/v2/core/resources/index.js +7 -4
- package/dist/v2/core/resources/shippingRates.d.ts +36 -0
- package/dist/v2/core/resources/shippingRates.js +23 -0
- package/dist/v2/core/resources/vipOffers.d.ts +37 -0
- package/dist/v2/core/resources/vipOffers.js +27 -0
- package/dist/v2/core/utils/order.d.ts +1 -0
- package/dist/v2/core/utils/pluginConfig.d.ts +6 -6
- package/dist/v2/index.d.ts +12 -9
- package/dist/v2/index.js +3 -3
- package/dist/v2/react/components/ApplePayButton.d.ts +141 -0
- package/dist/v2/react/components/ApplePayButton.js +320 -0
- package/dist/v2/react/components/GooglePayButton.d.ts +19 -0
- package/dist/v2/react/components/GooglePayButton.js +355 -0
- package/dist/v2/react/hooks/useApiQuery.d.ts +4 -1
- package/dist/v2/react/hooks/useApiQuery.js +4 -1
- package/dist/v2/react/hooks/useDiscountsQuery.d.ts +30 -0
- package/dist/v2/react/hooks/useDiscountsQuery.js +175 -0
- package/dist/v2/react/hooks/useExpressPaymentMethods.d.ts +12 -0
- package/dist/v2/react/hooks/useExpressPaymentMethods.js +17 -0
- package/dist/v2/react/hooks/useGoogleAutocomplete.d.ts +2 -0
- package/dist/v2/react/hooks/useGoogleAutocomplete.js +18 -2
- package/dist/v2/react/hooks/useShippingRatesQuery.d.ts +22 -0
- package/dist/v2/react/hooks/useShippingRatesQuery.js +134 -0
- package/dist/v2/react/hooks/useVipOffersQuery.d.ts +72 -0
- package/dist/v2/react/hooks/useVipOffersQuery.js +140 -0
- package/dist/v2/react/index.d.ts +30 -17
- package/dist/v2/react/index.js +18 -10
- package/dist/v2/react/providers/ExpressPaymentMethodsProvider.d.ts +59 -0
- package/dist/v2/react/providers/ExpressPaymentMethodsProvider.js +165 -0
- package/package.json +1 -1
|
@@ -25,10 +25,7 @@ export class GoogleAutocompleteCore {
|
|
|
25
25
|
types: options.types || ['address'],
|
|
26
26
|
componentRestrictions: options.componentRestrictions,
|
|
27
27
|
}, (predictions, status) => {
|
|
28
|
-
if (
|
|
29
|
-
window.google?.maps?.places &&
|
|
30
|
-
status === window.google.maps.places.PlacesServiceStatus.OK &&
|
|
31
|
-
predictions) {
|
|
28
|
+
if (status === window.google?.maps?.places?.PlacesServiceStatus.OK && predictions) {
|
|
32
29
|
resolve(predictions);
|
|
33
30
|
}
|
|
34
31
|
else {
|
|
@@ -50,10 +47,7 @@ export class GoogleAutocompleteCore {
|
|
|
50
47
|
placeId,
|
|
51
48
|
fields: ['place_id', 'formatted_address', 'address_components', 'geometry'],
|
|
52
49
|
}, (place, status) => {
|
|
53
|
-
if (
|
|
54
|
-
window.google?.maps?.places &&
|
|
55
|
-
status === window.google.maps.places.PlacesServiceStatus.OK &&
|
|
56
|
-
place) {
|
|
50
|
+
if (status === window.google?.maps?.places?.PlacesServiceStatus.OK && place) {
|
|
57
51
|
resolve(place);
|
|
58
52
|
}
|
|
59
53
|
else {
|
|
@@ -79,6 +73,15 @@ export class GoogleAutocompleteCore {
|
|
|
79
73
|
components.city = component.long_name;
|
|
80
74
|
components.locality = component.long_name;
|
|
81
75
|
}
|
|
76
|
+
else if (types.includes('administrative_area_level_2')) {
|
|
77
|
+
components.administrativeAreaLevel2 = component.short_name;
|
|
78
|
+
components.administrativeAreaLevel2Long = component.long_name;
|
|
79
|
+
// Use level_2 as fallback for city if city is not set
|
|
80
|
+
if (!components.city) {
|
|
81
|
+
components.city = component.long_name;
|
|
82
|
+
components.locality = component.long_name;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
82
85
|
else if (types.includes('administrative_area_level_1')) {
|
|
83
86
|
components.state = component.long_name;
|
|
84
87
|
components.administrativeAreaLevel1 = component.short_name;
|
|
@@ -93,6 +96,16 @@ export class GoogleAutocompleteCore {
|
|
|
93
96
|
components.iso = component.short_name;
|
|
94
97
|
}
|
|
95
98
|
}
|
|
99
|
+
// For countries like France where administrative_area_level_1 (région) may be missing,
|
|
100
|
+
// use administrative_area_level_2 (département) as the primary state/province value
|
|
101
|
+
// We prefer the long_name (e.g., "Bouches-du-Rhône") over short_name (e.g., "13")
|
|
102
|
+
// because it's more likely to match our state database entries
|
|
103
|
+
if (!components.administrativeAreaLevel1 && components.administrativeAreaLevel2) {
|
|
104
|
+
// Use long name as the primary state value (e.g., "Bouches-du-Rhône" instead of "13")
|
|
105
|
+
components.state = components.administrativeAreaLevel2Long || components.administrativeAreaLevel2;
|
|
106
|
+
components.administrativeAreaLevel1 = components.administrativeAreaLevel2;
|
|
107
|
+
components.administrativeAreaLevel1Long = components.administrativeAreaLevel2Long;
|
|
108
|
+
}
|
|
96
109
|
return components;
|
|
97
110
|
}
|
|
98
111
|
}
|
|
@@ -40,12 +40,80 @@ export interface CheckoutSession {
|
|
|
40
40
|
selectedPresentmentCurrency: string;
|
|
41
41
|
[key: string]: any;
|
|
42
42
|
}
|
|
43
|
+
export interface CheckoutSummaryItem {
|
|
44
|
+
id: string;
|
|
45
|
+
productId: string;
|
|
46
|
+
variantId: string;
|
|
47
|
+
priceId: string;
|
|
48
|
+
product: {
|
|
49
|
+
name: string;
|
|
50
|
+
description: string;
|
|
51
|
+
};
|
|
52
|
+
variant: {
|
|
53
|
+
name: string;
|
|
54
|
+
description: string;
|
|
55
|
+
imageUrl: string;
|
|
56
|
+
grams: number;
|
|
57
|
+
};
|
|
58
|
+
sku: string;
|
|
59
|
+
unitAmount: number;
|
|
60
|
+
quantity: number;
|
|
61
|
+
amount: number;
|
|
62
|
+
adjustedAmount: number;
|
|
63
|
+
currency: string;
|
|
64
|
+
adjustments: any[];
|
|
65
|
+
recurring: boolean;
|
|
66
|
+
interval?: 'day' | 'week' | 'month' | 'year';
|
|
67
|
+
intervalCount?: number;
|
|
68
|
+
totalBillingCycles?: number;
|
|
69
|
+
unitAmountAfterFirstCycle?: number;
|
|
70
|
+
orderLineItemProduct: {
|
|
71
|
+
name: string;
|
|
72
|
+
};
|
|
73
|
+
orderLineItemVariant: {
|
|
74
|
+
name: string;
|
|
75
|
+
imageUrl: string;
|
|
76
|
+
};
|
|
77
|
+
metadata: {
|
|
78
|
+
originalIds: string[];
|
|
79
|
+
isConsolidated: boolean;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export interface CheckoutSummary {
|
|
83
|
+
currency: string;
|
|
84
|
+
items: CheckoutSummaryItem[];
|
|
85
|
+
subtotalAmount: number;
|
|
86
|
+
subtotalAdjustedAmount: number;
|
|
87
|
+
shippingCost: number;
|
|
88
|
+
shippingCostIsFree: boolean;
|
|
89
|
+
totalAmount: number;
|
|
90
|
+
totalAdjustedAmount: number;
|
|
91
|
+
totalPromotionAmount: number;
|
|
92
|
+
totalTaxAmount: number;
|
|
93
|
+
lineItemsPromotionAmount: number;
|
|
94
|
+
lineItemsTaxAmount: number;
|
|
95
|
+
totalWeight: number;
|
|
96
|
+
_consolidated: boolean;
|
|
97
|
+
adjustments: {
|
|
98
|
+
type: string;
|
|
99
|
+
description: string;
|
|
100
|
+
amount: number;
|
|
101
|
+
}[];
|
|
102
|
+
}
|
|
103
|
+
export interface Promotion {
|
|
104
|
+
id: string;
|
|
105
|
+
name: string;
|
|
106
|
+
description: string | null;
|
|
107
|
+
type: string;
|
|
108
|
+
rules: any[];
|
|
109
|
+
actions: any[];
|
|
110
|
+
}
|
|
43
111
|
export interface CheckoutData {
|
|
44
112
|
checkoutSession: CheckoutSession;
|
|
45
113
|
customerIsClubMember: boolean;
|
|
46
114
|
clubProductId?: string;
|
|
47
|
-
summary:
|
|
48
|
-
availablePromotions:
|
|
115
|
+
summary: CheckoutSummary;
|
|
116
|
+
availablePromotions: Promotion[];
|
|
49
117
|
}
|
|
50
118
|
export interface Promotion {
|
|
51
119
|
id: string;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discounts Resource Client
|
|
3
|
+
* Axios-based API client for discount/promotion code endpoints
|
|
4
|
+
*/
|
|
5
|
+
import { ApiClient } from './apiClient';
|
|
6
|
+
export interface Discount {
|
|
7
|
+
id: string;
|
|
8
|
+
promotionId: string;
|
|
9
|
+
promotionCodeId: string | null;
|
|
10
|
+
appliedAt: string;
|
|
11
|
+
appliedManually: boolean;
|
|
12
|
+
promotion: {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface DiscountCodeValidation {
|
|
18
|
+
isValid: boolean;
|
|
19
|
+
code: string;
|
|
20
|
+
error?: string;
|
|
21
|
+
discount?: {
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
type: string;
|
|
25
|
+
value: number;
|
|
26
|
+
currency: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface ApplyDiscountResponse {
|
|
30
|
+
success: boolean;
|
|
31
|
+
error?: any;
|
|
32
|
+
promotion?: Discount;
|
|
33
|
+
}
|
|
34
|
+
export interface RemoveDiscountResponse {
|
|
35
|
+
success: boolean;
|
|
36
|
+
error?: any;
|
|
37
|
+
}
|
|
38
|
+
export declare class DiscountsResource {
|
|
39
|
+
private apiClient;
|
|
40
|
+
constructor(apiClient: ApiClient);
|
|
41
|
+
/**
|
|
42
|
+
* Get applied discounts for a checkout session
|
|
43
|
+
*/
|
|
44
|
+
getAppliedDiscounts(sessionId: string): Promise<Discount[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Apply a discount code to a checkout session
|
|
47
|
+
*/
|
|
48
|
+
applyDiscountCode(sessionId: string, code: string): Promise<ApplyDiscountResponse>;
|
|
49
|
+
/**
|
|
50
|
+
* Remove a discount from a checkout session
|
|
51
|
+
*/
|
|
52
|
+
removeDiscount(sessionId: string, discountId: string): Promise<RemoveDiscountResponse>;
|
|
53
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discounts Resource Client
|
|
3
|
+
* Axios-based API client for discount/promotion code endpoints
|
|
4
|
+
*/
|
|
5
|
+
export class DiscountsResource {
|
|
6
|
+
constructor(apiClient) {
|
|
7
|
+
this.apiClient = apiClient;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Get applied discounts for a checkout session
|
|
11
|
+
*/
|
|
12
|
+
async getAppliedDiscounts(sessionId) {
|
|
13
|
+
return this.apiClient.get(`/api/v1/checkout-sessions/${sessionId}/promotions`);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Apply a discount code to a checkout session
|
|
17
|
+
*/
|
|
18
|
+
async applyDiscountCode(sessionId, code) {
|
|
19
|
+
return this.apiClient.post(`/api/v1/checkout-sessions/${sessionId}/promotions/apply`, {
|
|
20
|
+
code: code.trim(),
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Remove a discount from a checkout session
|
|
25
|
+
*/
|
|
26
|
+
async removeDiscount(sessionId, discountId) {
|
|
27
|
+
return this.apiClient.delete(`/api/v1/checkout-sessions/${sessionId}/promotions/${discountId}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Express Payment Methods Resource Client
|
|
3
|
+
* Axios-based API client for express payment methods
|
|
4
|
+
*/
|
|
5
|
+
import { ApiClient } from './apiClient';
|
|
6
|
+
export interface PaymentMethod {
|
|
7
|
+
id: string;
|
|
8
|
+
type: string;
|
|
9
|
+
title: string;
|
|
10
|
+
iconUrl: string;
|
|
11
|
+
default: boolean;
|
|
12
|
+
metadata?: Record<string, unknown>;
|
|
13
|
+
}
|
|
14
|
+
export interface Address {
|
|
15
|
+
address1: string;
|
|
16
|
+
address2?: string;
|
|
17
|
+
lastName?: string;
|
|
18
|
+
firstName?: string;
|
|
19
|
+
city?: string;
|
|
20
|
+
state?: string;
|
|
21
|
+
country?: string;
|
|
22
|
+
postal?: string;
|
|
23
|
+
phone?: string;
|
|
24
|
+
email?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface UpdateAddressRequest {
|
|
27
|
+
data: {
|
|
28
|
+
shippingAddress: Address;
|
|
29
|
+
billingAddress?: Address | null;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export interface UpdateCustomerEmailRequest {
|
|
33
|
+
data: {
|
|
34
|
+
email: string;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export declare class ExpressPaymentMethodsResource {
|
|
38
|
+
private apiClient;
|
|
39
|
+
constructor(apiClient: ApiClient);
|
|
40
|
+
/**
|
|
41
|
+
* Get enabled payment methods for a checkout session
|
|
42
|
+
*/
|
|
43
|
+
getPaymentMethods(sessionId: string): Promise<PaymentMethod[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Update checkout session address (for express checkout flows)
|
|
46
|
+
*/
|
|
47
|
+
updateCheckoutSessionAddress(sessionId: string, data: UpdateAddressRequest): Promise<{
|
|
48
|
+
success: boolean;
|
|
49
|
+
}>;
|
|
50
|
+
/**
|
|
51
|
+
* Update customer email
|
|
52
|
+
*/
|
|
53
|
+
updateCustomerEmail(customerId: string, data: UpdateCustomerEmailRequest): Promise<{
|
|
54
|
+
success: boolean;
|
|
55
|
+
}>;
|
|
56
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Express Payment Methods Resource Client
|
|
3
|
+
* Axios-based API client for express payment methods
|
|
4
|
+
*/
|
|
5
|
+
export class ExpressPaymentMethodsResource {
|
|
6
|
+
constructor(apiClient) {
|
|
7
|
+
this.apiClient = apiClient;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Get enabled payment methods for a checkout session
|
|
11
|
+
*/
|
|
12
|
+
async getPaymentMethods(sessionId) {
|
|
13
|
+
return this.apiClient.get(`/api/v1/payment-methods?checkoutSessionId=${encodeURIComponent(sessionId)}`);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Update checkout session address (for express checkout flows)
|
|
17
|
+
*/
|
|
18
|
+
async updateCheckoutSessionAddress(sessionId, data) {
|
|
19
|
+
return this.apiClient.post(`/api/v1/checkout-sessions/${sessionId}/address`, data);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Update customer email
|
|
23
|
+
*/
|
|
24
|
+
async updateCustomerEmail(customerId, data) {
|
|
25
|
+
return this.apiClient.post(`/api/v1/customers/${customerId}`, data);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -3,11 +3,14 @@
|
|
|
3
3
|
* Axios-based API clients for all endpoints
|
|
4
4
|
*/
|
|
5
5
|
export * from './apiClient';
|
|
6
|
-
export * from './
|
|
6
|
+
export * from './checkout';
|
|
7
|
+
export * from './discounts';
|
|
8
|
+
export * from './offers';
|
|
7
9
|
export * from './orders';
|
|
8
10
|
export * from './payments';
|
|
9
|
-
export * from './checkout';
|
|
10
|
-
export * from './promotions';
|
|
11
11
|
export * from './postPurchases';
|
|
12
|
-
export * from './
|
|
12
|
+
export * from './products';
|
|
13
|
+
export * from './promotions';
|
|
14
|
+
export * from './shippingRates';
|
|
13
15
|
export * from './threeds';
|
|
16
|
+
export * from './vipOffers';
|
|
@@ -3,11 +3,14 @@
|
|
|
3
3
|
* Axios-based API clients for all endpoints
|
|
4
4
|
*/
|
|
5
5
|
export * from './apiClient';
|
|
6
|
-
export * from './
|
|
6
|
+
export * from './checkout';
|
|
7
|
+
export * from './discounts';
|
|
8
|
+
export * from './offers';
|
|
7
9
|
export * from './orders';
|
|
8
10
|
export * from './payments';
|
|
9
|
-
export * from './checkout';
|
|
10
|
-
export * from './promotions';
|
|
11
11
|
export * from './postPurchases';
|
|
12
|
-
export * from './
|
|
12
|
+
export * from './products';
|
|
13
|
+
export * from './promotions';
|
|
14
|
+
export * from './shippingRates';
|
|
13
15
|
export * from './threeds';
|
|
16
|
+
export * from './vipOffers';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shipping Rates Resource Client
|
|
3
|
+
* Axios-based API client for shipping rates endpoints
|
|
4
|
+
*/
|
|
5
|
+
import { ApiClient } from './apiClient';
|
|
6
|
+
export interface ShippingRate {
|
|
7
|
+
id: string;
|
|
8
|
+
shippingRateName: string;
|
|
9
|
+
amount: number;
|
|
10
|
+
currency: string;
|
|
11
|
+
isFree: boolean;
|
|
12
|
+
description?: string;
|
|
13
|
+
highlighted?: boolean;
|
|
14
|
+
icon?: string;
|
|
15
|
+
isPickupPoint?: boolean;
|
|
16
|
+
pickupPointCarriers?: string[];
|
|
17
|
+
}
|
|
18
|
+
export interface ShippingRatesResponse {
|
|
19
|
+
rates: ShippingRate[];
|
|
20
|
+
forceCheckoutSessionRefetch?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare class ShippingRatesResource {
|
|
23
|
+
private apiClient;
|
|
24
|
+
constructor(apiClient: ApiClient);
|
|
25
|
+
/**
|
|
26
|
+
* Get shipping rates for a checkout session
|
|
27
|
+
*/
|
|
28
|
+
getShippingRates(sessionId: string): Promise<ShippingRatesResponse>;
|
|
29
|
+
/**
|
|
30
|
+
* Set selected shipping rate for a checkout session
|
|
31
|
+
*/
|
|
32
|
+
setShippingRate(sessionId: string, shippingRateId: string): Promise<{
|
|
33
|
+
success: boolean;
|
|
34
|
+
error?: any;
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shipping Rates Resource Client
|
|
3
|
+
* Axios-based API client for shipping rates endpoints
|
|
4
|
+
*/
|
|
5
|
+
export class ShippingRatesResource {
|
|
6
|
+
constructor(apiClient) {
|
|
7
|
+
this.apiClient = apiClient;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Get shipping rates for a checkout session
|
|
11
|
+
*/
|
|
12
|
+
async getShippingRates(sessionId) {
|
|
13
|
+
return this.apiClient.get(`/api/v1/checkout-sessions/${sessionId}/shipping-rates`);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Set selected shipping rate for a checkout session
|
|
17
|
+
*/
|
|
18
|
+
async setShippingRate(sessionId, shippingRateId) {
|
|
19
|
+
return this.apiClient.post(`/api/v1/checkout-sessions/${sessionId}/shipping-rate`, {
|
|
20
|
+
shippingRateId,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VIP Offers Resource Client
|
|
3
|
+
* Axios-based API client for VIP offer endpoints
|
|
4
|
+
*/
|
|
5
|
+
import { ApiClient } from './apiClient';
|
|
6
|
+
export interface VipOffer {
|
|
7
|
+
id: string;
|
|
8
|
+
productId: string;
|
|
9
|
+
variantId: string;
|
|
10
|
+
}
|
|
11
|
+
export interface VipPreviewResponse {
|
|
12
|
+
savings: number;
|
|
13
|
+
currency: string;
|
|
14
|
+
selectedOffers: {
|
|
15
|
+
productId: string;
|
|
16
|
+
variantId: string;
|
|
17
|
+
isSelected: boolean;
|
|
18
|
+
}[];
|
|
19
|
+
savingsPct: number;
|
|
20
|
+
}
|
|
21
|
+
export interface ToggleOrderBumpResponse {
|
|
22
|
+
success: boolean;
|
|
23
|
+
summary: any;
|
|
24
|
+
availablePromotions: any[];
|
|
25
|
+
}
|
|
26
|
+
export declare class VipOffersResource {
|
|
27
|
+
private apiClient;
|
|
28
|
+
constructor(apiClient: ApiClient);
|
|
29
|
+
/**
|
|
30
|
+
* Get VIP preview showing potential savings
|
|
31
|
+
*/
|
|
32
|
+
getVipPreview(sessionId: string, vipOfferIds: string[]): Promise<VipPreviewResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* Toggle an order bump (used for VIP offers)
|
|
35
|
+
*/
|
|
36
|
+
toggleOrderBump(sessionId: string, orderBumpOfferId: string, selected: boolean): Promise<ToggleOrderBumpResponse>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* VIP Offers Resource Client
|
|
3
|
+
* Axios-based API client for VIP offer endpoints
|
|
4
|
+
*/
|
|
5
|
+
export class VipOffersResource {
|
|
6
|
+
constructor(apiClient) {
|
|
7
|
+
this.apiClient = apiClient;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Get VIP preview showing potential savings
|
|
11
|
+
*/
|
|
12
|
+
async getVipPreview(sessionId, vipOfferIds) {
|
|
13
|
+
return this.apiClient.post(`/api/v1/checkout-sessions/${sessionId}/vip-preview`, {
|
|
14
|
+
orderBumpOfferIds: vipOfferIds,
|
|
15
|
+
orderBumpType: 'vip',
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Toggle an order bump (used for VIP offers)
|
|
20
|
+
*/
|
|
21
|
+
async toggleOrderBump(sessionId, orderBumpOfferId, selected) {
|
|
22
|
+
return this.apiClient.post(`/api/v1/checkout-sessions/${sessionId}/toggle-order-bump`, {
|
|
23
|
+
orderBumpOfferId,
|
|
24
|
+
selected,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* Plugin Configuration Utility Functions
|
|
3
3
|
* Pure functions for plugin configuration management
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
5
|
+
export type PluginConfig<TConfig = Record<string, any>> = {
|
|
6
6
|
storeId?: string;
|
|
7
7
|
accountId?: string;
|
|
8
8
|
basePath?: string;
|
|
9
|
-
config?:
|
|
9
|
+
config?: any;
|
|
10
10
|
productId?: string;
|
|
11
11
|
variants?: Record<string, string>;
|
|
12
12
|
prices?: Record<string, any>;
|
|
@@ -15,13 +15,13 @@ export interface PluginConfig<TConfig = Record<string, any>> {
|
|
|
15
15
|
upsellId?: string;
|
|
16
16
|
googleApiKey?: string;
|
|
17
17
|
branding?: any;
|
|
18
|
-
}
|
|
19
|
-
export
|
|
18
|
+
} & TConfig;
|
|
19
|
+
export type RawPluginConfig<TConfig = Record<string, any>> = {
|
|
20
20
|
storeId?: string;
|
|
21
21
|
accountId?: string;
|
|
22
22
|
basePath?: string;
|
|
23
|
-
config?:
|
|
24
|
-
}
|
|
23
|
+
config?: any;
|
|
24
|
+
} & TConfig;
|
|
25
25
|
/**
|
|
26
26
|
* Core plugin config loading function
|
|
27
27
|
* Handles local dev, production, and raw config
|
package/dist/v2/index.d.ts
CHANGED
|
@@ -5,15 +5,18 @@
|
|
|
5
5
|
* - core: Pure functions without React dependencies
|
|
6
6
|
* - react: React hooks and components using core functions
|
|
7
7
|
*/
|
|
8
|
-
export * from './core/utils/pluginConfig';
|
|
9
|
-
export * from './core/utils/products';
|
|
10
8
|
export * from './core/googleAutocomplete';
|
|
11
9
|
export * from './core/isoData';
|
|
12
10
|
export * from './core/utils/currency';
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export type {
|
|
16
|
-
export type {
|
|
17
|
-
export type {
|
|
18
|
-
export type {
|
|
19
|
-
export {
|
|
11
|
+
export * from './core/utils/pluginConfig';
|
|
12
|
+
export * from './core/utils/products';
|
|
13
|
+
export type { CheckoutData, CheckoutInitParams, CheckoutLineItem, CheckoutSession, Promotion } from './core/resources/checkout';
|
|
14
|
+
export type { Order, OrderLineItem } from './core/utils/order';
|
|
15
|
+
export type { PostPurchaseOffer, PostPurchaseOfferItem, PostPurchaseOfferSummary } from './core/resources/postPurchases';
|
|
16
|
+
export type { Offer, OfferItem, OfferSummary } from './core/resources/offers';
|
|
17
|
+
export type { OrderBumpOffer, OrderBumpPreview } from './core/utils/orderBump';
|
|
18
|
+
export type { ApplePayToken, CardPaymentMethod, Payment, PaymentInstrumentCustomer, PaymentInstrumentCustomerResponse, PaymentInstrumentResponse, PaymentOptions, PaymentResponse } from './core/resources/payments';
|
|
19
|
+
export type { ShippingRate, ShippingRatesResponse } from './core/resources/shippingRates';
|
|
20
|
+
export type { ApplyDiscountResponse, Discount, DiscountCodeValidation, RemoveDiscountResponse } from './core/resources/discounts';
|
|
21
|
+
export type { ToggleOrderBumpResponse, VipOffer, VipPreviewResponse } from './core/resources/vipOffers';
|
|
22
|
+
export { ApplePayButton, ExpressPaymentMethodsProvider, formatMoney, getAvailableLanguages, GooglePayButton, queryKeys, TagadaProvider, useApiMutation, useApiQuery, useCheckout, useCheckoutToken, useCountryOptions, useCurrency, useDiscounts, useExpressPaymentMethods, useGeoLocation, useGoogleAutocomplete, useInvalidateQuery, useISOData, useLanguageImport, useOffers, useOrder, useOrderBump, usePayment, usePluginConfig, usePostPurchases, usePreloadQuery, useProducts, usePromotions, useRegionOptions, useShippingRates, useTagadaContext, useThreeds, useThreedsModal, useVipOffers } from './react';
|
package/dist/v2/index.js
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
* - react: React hooks and components using core functions
|
|
7
7
|
*/
|
|
8
8
|
// Core exports (selective to avoid conflicts)
|
|
9
|
-
export * from './core/utils/pluginConfig';
|
|
10
|
-
export * from './core/utils/products';
|
|
11
9
|
export * from './core/googleAutocomplete';
|
|
12
10
|
export * from './core/isoData';
|
|
13
11
|
export * from './core/utils/currency';
|
|
12
|
+
export * from './core/utils/pluginConfig';
|
|
13
|
+
export * from './core/utils/products';
|
|
14
14
|
// React exports (hooks and components only, types are exported above)
|
|
15
|
-
export {
|
|
15
|
+
export { ApplePayButton, ExpressPaymentMethodsProvider, formatMoney, getAvailableLanguages, GooglePayButton, queryKeys, TagadaProvider, useApiMutation, useApiQuery, useCheckout, useCheckoutToken, useCountryOptions, useCurrency, useDiscounts, useExpressPaymentMethods, useGeoLocation, useGoogleAutocomplete, useInvalidateQuery, useISOData, useLanguageImport, useOffers, useOrder, useOrderBump, usePayment, usePluginConfig, usePostPurchases, usePreloadQuery, useProducts, usePromotions, useRegionOptions, useShippingRates, useTagadaContext, useThreeds, useThreedsModal, useVipOffers } from './react';
|