@tagadapay/plugin-sdk 2.6.17 → 2.7.0
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/v2/core/resources/customer.d.ts +150 -0
- package/dist/v2/core/resources/customer.js +53 -0
- package/dist/v2/core/resources/index.d.ts +3 -1
- package/dist/v2/core/resources/index.js +3 -1
- package/dist/v2/core/resources/session.d.ts +27 -0
- package/dist/v2/core/resources/session.js +56 -0
- package/dist/v2/index.d.ts +9 -2
- package/dist/v2/index.js +1 -1
- package/dist/v2/react/hooks/useAuth.d.ts +8 -0
- package/dist/v2/react/hooks/useAuth.js +9 -0
- package/dist/v2/react/hooks/useClubOffers.d.ts +101 -0
- package/dist/v2/react/hooks/useClubOffers.js +126 -0
- package/dist/v2/react/hooks/useCustomer.d.ts +11 -0
- package/dist/v2/react/hooks/useCustomer.js +11 -0
- package/dist/v2/react/hooks/useCustomerInfos.d.ts +12 -0
- package/dist/v2/react/hooks/useCustomerInfos.js +53 -0
- package/dist/v2/react/hooks/useCustomerOrders.d.ts +17 -0
- package/dist/v2/react/hooks/useCustomerOrders.js +51 -0
- package/dist/v2/react/hooks/useCustomerSubscriptions.d.ts +23 -0
- package/dist/v2/react/hooks/useCustomerSubscriptions.js +94 -0
- package/dist/v2/react/hooks/useLogin.d.ts +53 -0
- package/dist/v2/react/hooks/useLogin.js +75 -0
- package/dist/v2/react/hooks/useTranslation.js +1 -1
- package/dist/v2/react/index.d.ts +15 -4
- package/dist/v2/react/index.js +8 -2
- package/dist/v2/react/providers/TagadaProvider.d.ts +0 -3
- package/dist/v2/react/providers/TagadaProvider.js +44 -32
- package/package.json +1 -1
- package/dist/v2/react/hooks/useDiscountQuery.d.ts +0 -79
- package/dist/v2/react/hooks/useDiscountQuery.js +0 -24
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Single Discount Hook using TanStack Query
|
|
3
|
-
* Fetches a specific discount for a given store
|
|
4
|
-
*/
|
|
5
|
-
import { UseQueryResult } from '@tanstack/react-query';
|
|
6
|
-
export interface StoreDiscountRuleAmount {
|
|
7
|
-
rate: number;
|
|
8
|
-
amount: number;
|
|
9
|
-
lock: boolean;
|
|
10
|
-
date: string;
|
|
11
|
-
}
|
|
12
|
-
export interface StoreDiscountRule {
|
|
13
|
-
id: string;
|
|
14
|
-
createdAt: string;
|
|
15
|
-
updatedAt: string;
|
|
16
|
-
promotionId: string;
|
|
17
|
-
type: string;
|
|
18
|
-
productId: string | null;
|
|
19
|
-
minimumQuantity: number | null;
|
|
20
|
-
minimumAmount: Record<string, StoreDiscountRuleAmount> | null;
|
|
21
|
-
variantIds: string[] | null;
|
|
22
|
-
}
|
|
23
|
-
export interface StoreDiscountAction {
|
|
24
|
-
id: string;
|
|
25
|
-
createdAt: string;
|
|
26
|
-
updatedAt: string;
|
|
27
|
-
promotionId: string;
|
|
28
|
-
type: string;
|
|
29
|
-
adjustmentAmount: number | null;
|
|
30
|
-
adjustmentPercentage: number | null;
|
|
31
|
-
adjustmentType: string | null;
|
|
32
|
-
freeShipping: boolean | null;
|
|
33
|
-
priceIdToAdd: string | null;
|
|
34
|
-
productIdToAdd: string | null;
|
|
35
|
-
variantIdToAdd: string | null;
|
|
36
|
-
subscriptionFreeTrialDuration: number | null;
|
|
37
|
-
subscriptionFreeTrialDurationType: string | null;
|
|
38
|
-
targetProductId: string | null;
|
|
39
|
-
targetVariantIds: string[] | null;
|
|
40
|
-
maxQuantityDiscounted: number | null;
|
|
41
|
-
appliesOnEachItem: boolean | null;
|
|
42
|
-
}
|
|
43
|
-
export interface StoreDiscount {
|
|
44
|
-
id: string;
|
|
45
|
-
createdAt: string;
|
|
46
|
-
updatedAt: string;
|
|
47
|
-
storeId: string;
|
|
48
|
-
accountId: string;
|
|
49
|
-
name: string;
|
|
50
|
-
code: string;
|
|
51
|
-
automatic: boolean;
|
|
52
|
-
usageLimit: number | null;
|
|
53
|
-
usageCount: number;
|
|
54
|
-
startDate: string;
|
|
55
|
-
endDate: string | null;
|
|
56
|
-
enabled: boolean;
|
|
57
|
-
archived: boolean;
|
|
58
|
-
ruleOperator: string;
|
|
59
|
-
externalId: string | null;
|
|
60
|
-
combinesWithOrderLevelDiscounts: boolean;
|
|
61
|
-
combinesWithLineItemDiscounts: boolean;
|
|
62
|
-
combinesWithShippingDiscounts: boolean;
|
|
63
|
-
forceCombine: boolean;
|
|
64
|
-
isTemporary: boolean;
|
|
65
|
-
rules: StoreDiscountRule[];
|
|
66
|
-
actions: StoreDiscountAction[];
|
|
67
|
-
}
|
|
68
|
-
export interface UseDiscountQueryOptions {
|
|
69
|
-
storeId?: string;
|
|
70
|
-
discountId?: string;
|
|
71
|
-
enabled?: boolean;
|
|
72
|
-
}
|
|
73
|
-
export interface UseDiscountQueryResult<TData = StoreDiscount> {
|
|
74
|
-
discount: TData | undefined;
|
|
75
|
-
isLoading: boolean;
|
|
76
|
-
error: Error | null;
|
|
77
|
-
refetch: UseQueryResult<TData>['refetch'];
|
|
78
|
-
}
|
|
79
|
-
export declare function useDiscountQuery<TData = StoreDiscount>(options: UseDiscountQueryOptions): UseDiscountQueryResult<TData>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Single Discount Hook using TanStack Query
|
|
3
|
-
* Fetches a specific discount for a given store
|
|
4
|
-
*/
|
|
5
|
-
import { useMemo } from 'react';
|
|
6
|
-
import { useApiQuery } from './useApiQuery';
|
|
7
|
-
import { usePluginConfig } from './usePluginConfig';
|
|
8
|
-
export function useDiscountQuery(options) {
|
|
9
|
-
const { storeId: storeIdFromConfig } = usePluginConfig();
|
|
10
|
-
const { storeId = storeIdFromConfig, discountId, enabled = true } = options;
|
|
11
|
-
const key = useMemo(() => ['discount', storeId, discountId], [storeId, discountId]);
|
|
12
|
-
const url = useMemo(() => {
|
|
13
|
-
if (!storeId || !discountId)
|
|
14
|
-
return null;
|
|
15
|
-
return `/api/v1/stores/${storeId}/discounts/${discountId}`;
|
|
16
|
-
}, [storeId, discountId]);
|
|
17
|
-
const query = useApiQuery(key, url, { enabled });
|
|
18
|
-
return {
|
|
19
|
-
discount: query.data,
|
|
20
|
-
isLoading: query.isLoading,
|
|
21
|
-
error: query.error || null,
|
|
22
|
-
refetch: query.refetch,
|
|
23
|
-
};
|
|
24
|
-
}
|