arky-sdk 0.1.0 → 0.1.1
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/config-CPkOgumU.d.cts +16 -0
- package/dist/config-CPkOgumU.d.ts +16 -0
- package/dist/index.cjs +1517 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +268 -0
- package/dist/index.d.ts +268 -26
- package/dist/index.js +1457 -56
- package/dist/index.js.map +1 -0
- package/dist/stores.cjs +2148 -0
- package/dist/stores.cjs.map +1 -0
- package/dist/stores.d.cts +218 -0
- package/dist/stores.d.ts +218 -0
- package/dist/stores.js +2111 -0
- package/dist/stores.js.map +1 -0
- package/dist/types.cjs +13 -0
- package/dist/types.cjs.map +1 -0
- package/dist/{types/index.d.ts → types.d.cts} +25 -24
- package/dist/types.d.ts +245 -0
- package/dist/types.js +11 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.cjs +725 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +9 -0
- package/dist/utils.d.ts +9 -0
- package/dist/utils.js +680 -0
- package/dist/utils.js.map +1 -0
- package/dist/validation-C9UAYKke.d.cts +245 -0
- package/dist/validation-DIvAzYjG.d.ts +245 -0
- package/package.json +17 -11
- package/dist/api/cms.d.ts +0 -19
- package/dist/api/cms.d.ts.map +0 -1
- package/dist/api/cms.js +0 -41
- package/dist/api/eshop.d.ts +0 -89
- package/dist/api/eshop.d.ts.map +0 -1
- package/dist/api/eshop.js +0 -183
- package/dist/api/index.d.ts +0 -6
- package/dist/api/index.d.ts.map +0 -1
- package/dist/api/index.js +0 -5
- package/dist/api/newsletter.d.ts +0 -32
- package/dist/api/newsletter.d.ts.map +0 -1
- package/dist/api/newsletter.js +0 -70
- package/dist/api/reservation.d.ts +0 -84
- package/dist/api/reservation.d.ts.map +0 -1
- package/dist/api/reservation.js +0 -239
- package/dist/config.d.ts +0 -15
- package/dist/config.d.ts.map +0 -1
- package/dist/config.js +0 -20
- package/dist/index.d.ts.map +0 -1
- package/dist/services/auth.d.ts +0 -17
- package/dist/services/auth.d.ts.map +0 -1
- package/dist/services/auth.js +0 -62
- package/dist/services/http.d.ts +0 -20
- package/dist/services/http.d.ts.map +0 -1
- package/dist/services/http.js +0 -73
- package/dist/stores/business.d.ts +0 -28
- package/dist/stores/business.d.ts.map +0 -1
- package/dist/stores/business.js +0 -122
- package/dist/stores/cart.d.ts +0 -8
- package/dist/stores/cart.d.ts.map +0 -1
- package/dist/stores/cart.js +0 -20
- package/dist/stores/eshop.d.ts +0 -121
- package/dist/stores/eshop.d.ts.map +0 -1
- package/dist/stores/eshop.js +0 -377
- package/dist/stores/index.d.ts +0 -7
- package/dist/stores/index.d.ts.map +0 -1
- package/dist/stores/index.js +0 -19
- package/dist/stores/reservation.d.ts +0 -237
- package/dist/stores/reservation.d.ts.map +0 -1
- package/dist/stores/reservation.js +0 -853
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -8
- package/dist/utils/blocks.d.ts +0 -30
- package/dist/utils/blocks.d.ts.map +0 -1
- package/dist/utils/blocks.js +0 -237
- package/dist/utils/currency.d.ts +0 -9
- package/dist/utils/currency.d.ts.map +0 -1
- package/dist/utils/currency.js +0 -99
- package/dist/utils/errors.d.ts +0 -121
- package/dist/utils/errors.d.ts.map +0 -1
- package/dist/utils/errors.js +0 -114
- package/dist/utils/i18n.d.ts +0 -5
- package/dist/utils/i18n.d.ts.map +0 -1
- package/dist/utils/i18n.js +0 -37
- package/dist/utils/index.d.ts +0 -9
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -10
- package/dist/utils/price.d.ts +0 -33
- package/dist/utils/price.d.ts.map +0 -1
- package/dist/utils/price.js +0 -141
- package/dist/utils/queryParams.d.ts +0 -21
- package/dist/utils/queryParams.d.ts.map +0 -1
- package/dist/utils/queryParams.js +0 -47
- package/dist/utils/svg.d.ts +0 -17
- package/dist/utils/svg.d.ts.map +0 -1
- package/dist/utils/svg.js +0 -62
- package/dist/utils/text.d.ts +0 -26
- package/dist/utils/text.d.ts.map +0 -1
- package/dist/utils/text.js +0 -64
- package/dist/utils/timezone.d.ts +0 -9
- package/dist/utils/timezone.d.ts.map +0 -1
- package/dist/utils/timezone.js +0 -49
- package/dist/utils/validation.d.ts +0 -9
- package/dist/utils/validation.d.ts.map +0 -1
- package/dist/utils/validation.js +0 -44
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
interface Payment {
|
|
2
2
|
currency: string;
|
|
3
3
|
market: string;
|
|
4
4
|
subtotal: number;
|
|
@@ -16,12 +16,12 @@ export interface Payment {
|
|
|
16
16
|
subscriptionId?: string;
|
|
17
17
|
priceId?: string;
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
declare enum PaymentMethod {
|
|
20
20
|
Cash = "CASH",
|
|
21
21
|
CreditCard = "CREDIT_CARD",
|
|
22
22
|
Free = "FREE"
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
interface QuoteLineItem {
|
|
25
25
|
itemType: string;
|
|
26
26
|
id: string;
|
|
27
27
|
name: string;
|
|
@@ -29,14 +29,14 @@ export interface QuoteLineItem {
|
|
|
29
29
|
unitPrice: number;
|
|
30
30
|
total: number;
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
interface PromoCodeValidation {
|
|
33
33
|
id: string;
|
|
34
34
|
code: string;
|
|
35
35
|
discountType: any;
|
|
36
36
|
discountValue: number;
|
|
37
37
|
conditions: any[];
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
interface Quote {
|
|
40
40
|
currency: string;
|
|
41
41
|
market: string;
|
|
42
42
|
subtotal: number;
|
|
@@ -50,12 +50,12 @@ export interface Quote {
|
|
|
50
50
|
payment: Payment;
|
|
51
51
|
chargeAmount: number;
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
interface Price {
|
|
54
54
|
market: string;
|
|
55
55
|
amount: number;
|
|
56
56
|
compareAt?: number;
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
interface Location {
|
|
59
59
|
country?: string | null;
|
|
60
60
|
address?: string | null;
|
|
61
61
|
city?: string | null;
|
|
@@ -66,14 +66,14 @@ export interface Location {
|
|
|
66
66
|
lon: number;
|
|
67
67
|
} | null;
|
|
68
68
|
}
|
|
69
|
-
|
|
69
|
+
interface Zone {
|
|
70
70
|
id: string;
|
|
71
71
|
name: string;
|
|
72
72
|
countries: string[];
|
|
73
73
|
taxBps: number;
|
|
74
74
|
shippingMethods: ShippingMethod[];
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
interface EshopCartItem {
|
|
77
77
|
id: string;
|
|
78
78
|
productId: string;
|
|
79
79
|
variantId: string;
|
|
@@ -84,7 +84,7 @@ export interface EshopCartItem {
|
|
|
84
84
|
quantity: number;
|
|
85
85
|
addedAt: number;
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
interface ReservationCartPart {
|
|
88
88
|
id: string;
|
|
89
89
|
serviceId: string;
|
|
90
90
|
serviceName: string;
|
|
@@ -97,13 +97,13 @@ export interface ReservationCartPart {
|
|
|
97
97
|
providerId?: string;
|
|
98
98
|
blocks: any[];
|
|
99
99
|
}
|
|
100
|
-
|
|
100
|
+
interface PaymentProviderConfig {
|
|
101
101
|
type: "STRIPE";
|
|
102
102
|
publicKey: string;
|
|
103
103
|
secretKey: string;
|
|
104
104
|
webhookSecret: string;
|
|
105
105
|
}
|
|
106
|
-
|
|
106
|
+
interface Market {
|
|
107
107
|
id: string;
|
|
108
108
|
name: string;
|
|
109
109
|
currency: string;
|
|
@@ -111,7 +111,7 @@ export interface Market {
|
|
|
111
111
|
taxBps: number;
|
|
112
112
|
paymentMethods: BusinessPaymentMethod[];
|
|
113
113
|
}
|
|
114
|
-
|
|
114
|
+
interface ShippingMethod {
|
|
115
115
|
id: string;
|
|
116
116
|
type: 'SHIPPING' | 'PICKUP';
|
|
117
117
|
prices: Price[];
|
|
@@ -119,10 +119,10 @@ export interface ShippingMethod {
|
|
|
119
119
|
etaText: string;
|
|
120
120
|
location?: Location;
|
|
121
121
|
}
|
|
122
|
-
|
|
122
|
+
interface BusinessPaymentMethod {
|
|
123
123
|
method: PaymentMethod;
|
|
124
124
|
}
|
|
125
|
-
|
|
125
|
+
interface BusinessConfig {
|
|
126
126
|
orderBlocks?: any[];
|
|
127
127
|
reservationBlocks?: any[];
|
|
128
128
|
markets?: Market[];
|
|
@@ -130,12 +130,12 @@ export interface BusinessConfig {
|
|
|
130
130
|
paymentProvider?: PaymentProviderConfig;
|
|
131
131
|
aiProvider?: any;
|
|
132
132
|
}
|
|
133
|
-
|
|
133
|
+
interface Business {
|
|
134
134
|
id: string;
|
|
135
135
|
name: string;
|
|
136
136
|
configs?: BusinessConfig;
|
|
137
137
|
}
|
|
138
|
-
|
|
138
|
+
interface EshopStoreState {
|
|
139
139
|
businessId: string;
|
|
140
140
|
selectedShippingMethodId: string | null;
|
|
141
141
|
userToken: string | null;
|
|
@@ -147,14 +147,14 @@ export interface EshopStoreState {
|
|
|
147
147
|
verificationCode: string;
|
|
148
148
|
verifyError: string | null;
|
|
149
149
|
}
|
|
150
|
-
|
|
150
|
+
interface Block {
|
|
151
151
|
id: string;
|
|
152
152
|
key: string;
|
|
153
153
|
type: string;
|
|
154
154
|
properties?: any;
|
|
155
155
|
value?: any;
|
|
156
156
|
}
|
|
157
|
-
|
|
157
|
+
interface ApiResponse<T> {
|
|
158
158
|
success: boolean;
|
|
159
159
|
data?: T;
|
|
160
160
|
error?: string;
|
|
@@ -162,7 +162,7 @@ export interface ApiResponse<T> {
|
|
|
162
162
|
cursor?: string;
|
|
163
163
|
total?: number;
|
|
164
164
|
}
|
|
165
|
-
|
|
165
|
+
interface PaginatedResponse<T> {
|
|
166
166
|
data: T[];
|
|
167
167
|
meta?: {
|
|
168
168
|
total: number;
|
|
@@ -170,7 +170,7 @@ export interface PaginatedResponse<T> {
|
|
|
170
170
|
per_page: number;
|
|
171
171
|
};
|
|
172
172
|
}
|
|
173
|
-
|
|
173
|
+
interface Newsletter {
|
|
174
174
|
id: string;
|
|
175
175
|
businessId: string;
|
|
176
176
|
name: string;
|
|
@@ -185,7 +185,7 @@ export interface Newsletter {
|
|
|
185
185
|
createdAt: number;
|
|
186
186
|
updatedAt: number;
|
|
187
187
|
}
|
|
188
|
-
|
|
188
|
+
interface MarketConfigClient {
|
|
189
189
|
currency: string;
|
|
190
190
|
taxMode: string;
|
|
191
191
|
defaultTaxRate: number;
|
|
@@ -193,7 +193,7 @@ export interface MarketConfigClient {
|
|
|
193
193
|
showTaxIncluded: boolean;
|
|
194
194
|
shippingMethods?: ShippingMethod[];
|
|
195
195
|
}
|
|
196
|
-
|
|
196
|
+
interface ReservationStoreState {
|
|
197
197
|
currentStep: number;
|
|
198
198
|
totalSteps: number;
|
|
199
199
|
steps: Record<number, {
|
|
@@ -241,4 +241,5 @@ export interface ReservationStoreState {
|
|
|
241
241
|
enabled: boolean;
|
|
242
242
|
};
|
|
243
243
|
}
|
|
244
|
-
|
|
244
|
+
|
|
245
|
+
export { type ApiResponse, type Block, type Business, type BusinessConfig, type BusinessPaymentMethod, type EshopCartItem, type EshopStoreState, type Location, type Market, type MarketConfigClient, type Newsletter, type PaginatedResponse, type Payment, PaymentMethod, type PaymentProviderConfig, type Price, type PromoCodeValidation, type Quote, type QuoteLineItem, type ReservationCartPart, type ReservationStoreState, type ShippingMethod, type Zone };
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
interface Payment {
|
|
2
|
+
currency: string;
|
|
3
|
+
market: string;
|
|
4
|
+
subtotal: number;
|
|
5
|
+
shipping: number;
|
|
6
|
+
discount: number;
|
|
7
|
+
tax: number;
|
|
8
|
+
total: number;
|
|
9
|
+
promoCodeId?: string;
|
|
10
|
+
promoCode?: string;
|
|
11
|
+
promoType?: string;
|
|
12
|
+
promoValue?: number;
|
|
13
|
+
method: PaymentMethod;
|
|
14
|
+
customerId?: string;
|
|
15
|
+
paymentIntentId?: string;
|
|
16
|
+
subscriptionId?: string;
|
|
17
|
+
priceId?: string;
|
|
18
|
+
}
|
|
19
|
+
declare enum PaymentMethod {
|
|
20
|
+
Cash = "CASH",
|
|
21
|
+
CreditCard = "CREDIT_CARD",
|
|
22
|
+
Free = "FREE"
|
|
23
|
+
}
|
|
24
|
+
interface QuoteLineItem {
|
|
25
|
+
itemType: string;
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
quantity: number;
|
|
29
|
+
unitPrice: number;
|
|
30
|
+
total: number;
|
|
31
|
+
}
|
|
32
|
+
interface PromoCodeValidation {
|
|
33
|
+
id: string;
|
|
34
|
+
code: string;
|
|
35
|
+
discountType: any;
|
|
36
|
+
discountValue: number;
|
|
37
|
+
conditions: any[];
|
|
38
|
+
}
|
|
39
|
+
interface Quote {
|
|
40
|
+
currency: string;
|
|
41
|
+
market: string;
|
|
42
|
+
subtotal: number;
|
|
43
|
+
shipping: number;
|
|
44
|
+
discount: number;
|
|
45
|
+
tax: number;
|
|
46
|
+
total: number;
|
|
47
|
+
lineItems: QuoteLineItem[];
|
|
48
|
+
shippingMethod: ShippingMethod | null;
|
|
49
|
+
promoCode: PromoCodeValidation | null;
|
|
50
|
+
payment: Payment;
|
|
51
|
+
chargeAmount: number;
|
|
52
|
+
}
|
|
53
|
+
interface Price {
|
|
54
|
+
market: string;
|
|
55
|
+
amount: number;
|
|
56
|
+
compareAt?: number;
|
|
57
|
+
}
|
|
58
|
+
interface Location {
|
|
59
|
+
country?: string | null;
|
|
60
|
+
address?: string | null;
|
|
61
|
+
city?: string | null;
|
|
62
|
+
postalCode?: string | null;
|
|
63
|
+
countryCode?: string | null;
|
|
64
|
+
coordinates?: {
|
|
65
|
+
lat: number;
|
|
66
|
+
lon: number;
|
|
67
|
+
} | null;
|
|
68
|
+
}
|
|
69
|
+
interface Zone {
|
|
70
|
+
id: string;
|
|
71
|
+
name: string;
|
|
72
|
+
countries: string[];
|
|
73
|
+
taxBps: number;
|
|
74
|
+
shippingMethods: ShippingMethod[];
|
|
75
|
+
}
|
|
76
|
+
interface EshopCartItem {
|
|
77
|
+
id: string;
|
|
78
|
+
productId: string;
|
|
79
|
+
variantId: string;
|
|
80
|
+
productName: string;
|
|
81
|
+
productSlug: string;
|
|
82
|
+
variantAttributes: Record<string, any>;
|
|
83
|
+
price: Price;
|
|
84
|
+
quantity: number;
|
|
85
|
+
addedAt: number;
|
|
86
|
+
}
|
|
87
|
+
interface ReservationCartPart {
|
|
88
|
+
id: string;
|
|
89
|
+
serviceId: string;
|
|
90
|
+
serviceName: string;
|
|
91
|
+
date: string;
|
|
92
|
+
from: number;
|
|
93
|
+
to: number;
|
|
94
|
+
timeText: string;
|
|
95
|
+
isMultiDay: boolean;
|
|
96
|
+
reservationMethod: string;
|
|
97
|
+
providerId?: string;
|
|
98
|
+
blocks: any[];
|
|
99
|
+
}
|
|
100
|
+
interface PaymentProviderConfig {
|
|
101
|
+
type: "STRIPE";
|
|
102
|
+
publicKey: string;
|
|
103
|
+
secretKey: string;
|
|
104
|
+
webhookSecret: string;
|
|
105
|
+
}
|
|
106
|
+
interface Market {
|
|
107
|
+
id: string;
|
|
108
|
+
name: string;
|
|
109
|
+
currency: string;
|
|
110
|
+
taxMode: "INCLUSIVE" | "EXCLUSIVE";
|
|
111
|
+
taxBps: number;
|
|
112
|
+
paymentMethods: BusinessPaymentMethod[];
|
|
113
|
+
}
|
|
114
|
+
interface ShippingMethod {
|
|
115
|
+
id: string;
|
|
116
|
+
type: 'SHIPPING' | 'PICKUP';
|
|
117
|
+
prices: Price[];
|
|
118
|
+
taxable: boolean;
|
|
119
|
+
etaText: string;
|
|
120
|
+
location?: Location;
|
|
121
|
+
}
|
|
122
|
+
interface BusinessPaymentMethod {
|
|
123
|
+
method: PaymentMethod;
|
|
124
|
+
}
|
|
125
|
+
interface BusinessConfig {
|
|
126
|
+
orderBlocks?: any[];
|
|
127
|
+
reservationBlocks?: any[];
|
|
128
|
+
markets?: Market[];
|
|
129
|
+
zones?: Zone[];
|
|
130
|
+
paymentProvider?: PaymentProviderConfig;
|
|
131
|
+
aiProvider?: any;
|
|
132
|
+
}
|
|
133
|
+
interface Business {
|
|
134
|
+
id: string;
|
|
135
|
+
name: string;
|
|
136
|
+
configs?: BusinessConfig;
|
|
137
|
+
}
|
|
138
|
+
interface EshopStoreState {
|
|
139
|
+
businessId: string;
|
|
140
|
+
selectedShippingMethodId: string | null;
|
|
141
|
+
userToken: string | null;
|
|
142
|
+
processingCheckout: boolean;
|
|
143
|
+
loading: boolean;
|
|
144
|
+
error: string | null;
|
|
145
|
+
phoneNumber: string;
|
|
146
|
+
phoneError: string | null;
|
|
147
|
+
verificationCode: string;
|
|
148
|
+
verifyError: string | null;
|
|
149
|
+
}
|
|
150
|
+
interface Block {
|
|
151
|
+
id: string;
|
|
152
|
+
key: string;
|
|
153
|
+
type: string;
|
|
154
|
+
properties?: any;
|
|
155
|
+
value?: any;
|
|
156
|
+
}
|
|
157
|
+
interface ApiResponse<T> {
|
|
158
|
+
success: boolean;
|
|
159
|
+
data?: T;
|
|
160
|
+
error?: string;
|
|
161
|
+
code?: string;
|
|
162
|
+
cursor?: string;
|
|
163
|
+
total?: number;
|
|
164
|
+
}
|
|
165
|
+
interface PaginatedResponse<T> {
|
|
166
|
+
data: T[];
|
|
167
|
+
meta?: {
|
|
168
|
+
total: number;
|
|
169
|
+
page: number;
|
|
170
|
+
per_page: number;
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
interface Newsletter {
|
|
174
|
+
id: string;
|
|
175
|
+
businessId: string;
|
|
176
|
+
name: string;
|
|
177
|
+
description: string;
|
|
178
|
+
newsletterType: "FREE" | "PAID";
|
|
179
|
+
statuses: any[];
|
|
180
|
+
prices: Price[];
|
|
181
|
+
paymentProduct?: {
|
|
182
|
+
priceId: string;
|
|
183
|
+
};
|
|
184
|
+
unsubscribeRedirectUrl: string;
|
|
185
|
+
createdAt: number;
|
|
186
|
+
updatedAt: number;
|
|
187
|
+
}
|
|
188
|
+
interface MarketConfigClient {
|
|
189
|
+
currency: string;
|
|
190
|
+
taxMode: string;
|
|
191
|
+
defaultTaxRate: number;
|
|
192
|
+
paymentMethods: string[];
|
|
193
|
+
showTaxIncluded: boolean;
|
|
194
|
+
shippingMethods?: ShippingMethod[];
|
|
195
|
+
}
|
|
196
|
+
interface ReservationStoreState {
|
|
197
|
+
currentStep: number;
|
|
198
|
+
totalSteps: number;
|
|
199
|
+
steps: Record<number, {
|
|
200
|
+
name: string;
|
|
201
|
+
labelKey: string;
|
|
202
|
+
}>;
|
|
203
|
+
weekdays: string[];
|
|
204
|
+
monthYear: string;
|
|
205
|
+
days: any[];
|
|
206
|
+
current: Date;
|
|
207
|
+
selectedDate: string | null;
|
|
208
|
+
slots: any[];
|
|
209
|
+
selectedSlot: any | null;
|
|
210
|
+
selectedMethod: string | null;
|
|
211
|
+
selectedProvider: any | null;
|
|
212
|
+
providers: any[];
|
|
213
|
+
loading: boolean;
|
|
214
|
+
startDate: string | null;
|
|
215
|
+
endDate: string | null;
|
|
216
|
+
isMultiDay: boolean;
|
|
217
|
+
phoneNumber: string;
|
|
218
|
+
phoneError: string | null;
|
|
219
|
+
phoneSuccess: string | null;
|
|
220
|
+
verificationCode: string;
|
|
221
|
+
verifyError: string | null;
|
|
222
|
+
isPhoneVerified: boolean;
|
|
223
|
+
isSendingCode: boolean;
|
|
224
|
+
isVerifying: boolean;
|
|
225
|
+
codeSentAt: number | null;
|
|
226
|
+
canResendAt: number | null;
|
|
227
|
+
guestToken: string | null;
|
|
228
|
+
service: any | null;
|
|
229
|
+
business: Business | null;
|
|
230
|
+
currency: string;
|
|
231
|
+
reservationBlocks: Block[];
|
|
232
|
+
apiUrl: string;
|
|
233
|
+
businessId: string;
|
|
234
|
+
storageUrl: string;
|
|
235
|
+
timezone: string;
|
|
236
|
+
tzGroups: any;
|
|
237
|
+
parts: ReservationCartPart[];
|
|
238
|
+
allowedPaymentMethods: string[];
|
|
239
|
+
paymentConfig: {
|
|
240
|
+
provider: PaymentProviderConfig | null;
|
|
241
|
+
enabled: boolean;
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export { type ApiResponse, type Block, type Business, type BusinessConfig, type BusinessPaymentMethod, type EshopCartItem, type EshopStoreState, type Location, type Market, type MarketConfigClient, type Newsletter, type PaginatedResponse, type Payment, PaymentMethod, type PaymentProviderConfig, type Price, type PromoCodeValidation, type Quote, type QuoteLineItem, type ReservationCartPart, type ReservationStoreState, type ShippingMethod, type Zone };
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// src/types/index.ts
|
|
2
|
+
var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
|
|
3
|
+
PaymentMethod2["Cash"] = "CASH";
|
|
4
|
+
PaymentMethod2["CreditCard"] = "CREDIT_CARD";
|
|
5
|
+
PaymentMethod2["Free"] = "FREE";
|
|
6
|
+
return PaymentMethod2;
|
|
7
|
+
})(PaymentMethod || {});
|
|
8
|
+
|
|
9
|
+
export { PaymentMethod };
|
|
10
|
+
//# sourceMappingURL=types.js.map
|
|
11
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types/index.ts"],"names":["PaymentMethod"],"mappings":";AAuBO,IAAK,aAAA,qBAAAA,cAAAA,KAAL;AACN,EAAAA,eAAA,MAAA,CAAA,GAAO,MAAA;AACP,EAAAA,eAAA,YAAA,CAAA,GAAa,aAAA;AACb,EAAAA,eAAA,MAAA,CAAA,GAAO,MAAA;AAHI,EAAA,OAAAA,cAAAA;AAAA,CAAA,EAAA,aAAA,IAAA,EAAA","file":"types.js","sourcesContent":["// Core type definitions\n// All types are exported individually for better tree-shaking\n\n// NEW: Payment structure (matches backend)\nexport interface Payment {\n\tcurrency: string;\n\tmarket: string;\n\tsubtotal: number;\n\tshipping: number;\n\tdiscount: number;\n\ttax: number;\n\ttotal: number;\n\tpromoCodeId?: string;\n\tpromoCode?: string;\n\tpromoType?: string;\n\tpromoValue?: number;\n\tmethod: PaymentMethod;\n\tcustomerId?: string;\n\tpaymentIntentId?: string;\n\tsubscriptionId?: string;\n\tpriceId?: string;\n}\n\nexport enum PaymentMethod {\n\tCash = \"CASH\",\n\tCreditCard = \"CREDIT_CARD\",\n\tFree = \"FREE\",\n}\n\n// Quote line item (from quote engine)\nexport interface QuoteLineItem {\n\titemType: string;\n\tid: string;\n\tname: string;\n\tquantity: number;\n\tunitPrice: number;\n\ttotal: number;\n}\n\n// Promo code validation result\nexport interface PromoCodeValidation {\n\tid: string;\n\tcode: string;\n\tdiscountType: any;\n\tdiscountValue: number;\n\tconditions: any[];\n}\n\n// Quote response from backend (full pricing breakdown)\nexport interface Quote {\n\tcurrency: string;\n\tmarket: string;\n\tsubtotal: number;\n\tshipping: number;\n\tdiscount: number;\n\ttax: number;\n\ttotal: number;\n\tlineItems: QuoteLineItem[];\n\tshippingMethod: ShippingMethod | null;\n\tpromoCode: PromoCodeValidation | null;\n\tpayment: Payment;\n\tchargeAmount: number;\n}\n\n// Market-based price structure (for product variants)\nexport interface Price {\n\tmarket: string;\n\tamount: number;\n\tcompareAt?: number;\n}\n\n// Location structure (for shipping addresses, pickup points, etc.)\nexport interface Location {\n\tcountry?: string | null;\n\taddress?: string | null;\n\tcity?: string | null;\n\tpostalCode?: string | null;\n\tcountryCode?: string | null;\n\tcoordinates?: { lat: number; lon: number } | null;\n}\n\n// Zone structure (logistics grouping - countries, tax rates, shipping methods)\nexport interface Zone {\n\tid: string;\n\tname: string;\n\tcountries: string[]; // Empty array = \"All Countries\"\n\ttaxBps: number;\n\tshippingMethods: ShippingMethod[];\n}\n\n// Cart types\nexport interface EshopCartItem {\n\tid: string;\n\tproductId: string;\n\tvariantId: string;\n\tproductName: string;\n\tproductSlug: string;\n\tvariantAttributes: Record<string, any>;\n\tprice: Price; // Minor units (backend format)\n\tquantity: number;\n\taddedAt: number;\n}\n\nexport interface ReservationCartPart {\n\tid: string;\n\tserviceId: string;\n\tserviceName: string;\n\tdate: string;\n\tfrom: number;\n\tto: number;\n\ttimeText: string;\n\tisMultiDay: boolean;\n\treservationMethod: string;\n\tproviderId?: string;\n\tblocks: any[];\n}\n\n// Payment provider types\nexport interface PaymentProviderConfig {\n\ttype: \"STRIPE\";\n\tpublicKey: string;\n\tsecretKey: string;\n\twebhookSecret: string;\n}\n\n// Market types (business-owned) - camelCase for frontend\nexport interface Market {\n\tid: string;\n\tname: string;\n\tcurrency: string;\n\ttaxMode: \"INCLUSIVE\" | \"EXCLUSIVE\";\n\ttaxBps: number;\n\tpaymentMethods: BusinessPaymentMethod[];\n}\n\nexport interface ShippingMethod {\n id: string;\n type: 'SHIPPING' | 'PICKUP';\n prices: Price[]; // Market-based pricing with free thresholds\n taxable: boolean;\n etaText: string; // e.g., \"3-5 business days\"\n location?: Location; // Pickup address (only for PICKUP type)\n}\n\nexport interface BusinessPaymentMethod {\n\tmethod: PaymentMethod;\n}\n\n// Business types\nexport interface BusinessConfig {\n\torderBlocks?: any[];\n\treservationBlocks?: any[];\n\tmarkets?: Market[];\n\tzones?: Zone[];\n\tpaymentProvider?: PaymentProviderConfig;\n\taiProvider?: any;\n}\n\nexport interface Business {\n\tid: string;\n\tname: string;\n\tconfigs?: BusinessConfig;\n}\n\n// Store state types - Simplified (business data moved to business store)\nexport interface EshopStoreState {\n\tbusinessId: string;\n\tselectedShippingMethodId: string | null;\n\tuserToken: string | null;\n\tprocessingCheckout: boolean;\n\tloading: boolean;\n\terror: string | null;\n\tphoneNumber: string;\n\tphoneError: string | null;\n\tverificationCode: string;\n\tverifyError: string | null;\n}\n\nexport interface Block {\n\tid: string;\n\tkey: string;\n\ttype: string;\n\tproperties?: any;\n\tvalue?: any;\n}\n\n// API Response types\nexport interface ApiResponse<T> {\n success: boolean;\n data?: T;\n error?: string;\n code?: string;\n cursor?: string;\n total?: number;\n}\n\nexport interface PaginatedResponse<T> {\n\tdata: T[];\n\tmeta?: {\n\t\ttotal: number;\n\t\tpage: number;\n\t\tper_page: number;\n\t};\n}\n\n// Newsletter types\nexport interface Newsletter {\n\tid: string;\n\tbusinessId: string;\n\tname: string;\n\tdescription: string;\n\tnewsletterType: \"FREE\" | \"PAID\";\n\tstatuses: any[];\n\tprices: Price[]; // NEW: Market-based pricing\n\tpaymentProduct?: {\n\t\tpriceId: string;\n\t};\n\tunsubscribeRedirectUrl: string;\n\tcreatedAt: number;\n\tupdatedAt: number;\n}\n\n// Legacy types - kept for compatibility\nexport interface MarketConfigClient {\n\tcurrency: string;\n\ttaxMode: string;\n\tdefaultTaxRate: number;\n\tpaymentMethods: string[];\n\tshowTaxIncluded: boolean;\n\tshippingMethods?: ShippingMethod[];\n}\n\nexport interface ReservationStoreState {\n\tcurrentStep: number;\n\ttotalSteps: number;\n\tsteps: Record<number, { name: string; labelKey: string }>;\n\n\t// Calendar data\n\tweekdays: string[];\n\tmonthYear: string;\n\tdays: any[];\n\tcurrent: Date;\n\n\t// Selection state\n\tselectedDate: string | null;\n\tslots: any[];\n\tselectedSlot: any | null;\n\tselectedMethod: string | null;\n\tselectedProvider: any | null;\n\tproviders: any[];\n\n\t// Status flags\n\tloading: boolean;\n\tstartDate: string | null;\n\tendDate: string | null;\n\tisMultiDay: boolean;\n\n\t// Phone verification\n\tphoneNumber: string;\n\tphoneError: string | null;\n\tphoneSuccess: string | null;\n\tverificationCode: string;\n\tverifyError: string | null;\n\tisPhoneVerified: boolean;\n\tisSendingCode: boolean;\n\tisVerifying: boolean;\n\tcodeSentAt: number | null;\n\tcanResendAt: number | null;\n\n\t// Service & config\n\tguestToken: string | null;\n\tservice: any | null;\n\tbusiness: Business | null;\n\tcurrency: string;\n\treservationBlocks: Block[];\n\tapiUrl: string;\n\tbusinessId: string;\n\tstorageUrl: string;\n\ttimezone: string;\n\ttzGroups: any;\n\tparts: ReservationCartPart[];\n\n\t// Payment configuration\n\tallowedPaymentMethods: string[];\n\tpaymentConfig: {\n\t\tprovider: PaymentProviderConfig | null;\n\t\tenabled: boolean;\n\t};\n}\n"]}
|