@betterstore/sdk 0.3.77 → 0.3.79
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/CHANGELOG.md +12 -0
- package/dist/index.d.mts +150 -85
- package/dist/index.d.ts +150 -85
- package/dist/index.js +55 -1
- package/dist/index.mjs +55 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,98 @@
|
|
|
1
|
+
import * as axios from 'axios';
|
|
2
|
+
|
|
3
|
+
declare const createApiClient: (apiKey: string, proxy?: string) => axios.AxiosInstance;
|
|
4
|
+
|
|
5
|
+
type ShippingRate = ZasilkovnaRate;
|
|
6
|
+
interface BaseRate {
|
|
7
|
+
provider: string;
|
|
8
|
+
name: string;
|
|
9
|
+
price: number;
|
|
10
|
+
}
|
|
11
|
+
interface ZasilkovnaRate extends BaseRate {
|
|
12
|
+
provider: "zasilkovna";
|
|
13
|
+
clientSecret: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type ProductData = Pick<Product, "title" | "description" | "images" | "category" | "tags" | "sku" | "barcode" | "vendor" | "isPhysical" | "weightInGrams" | "heightInCm" | "widthInCm" | "lengthInCm" | "priceInCents" | "billingType" | "billingInterval" | "billingIntervalCount"> & {
|
|
17
|
+
productId: string;
|
|
18
|
+
selectedVariant: Pick<ProductVariant, "title" | "sku" | "barcode" | "images" | "isPhysical" | "weightInGrams" | "heightInCm" | "widthInCm" | "lengthInCm" | "priceInCents" | "billingType" | "billingInterval" | "billingIntervalCount" | "variantOptions">;
|
|
19
|
+
};
|
|
20
|
+
interface LineItem {
|
|
21
|
+
quantity: number;
|
|
22
|
+
variantOptions: {
|
|
23
|
+
name: string;
|
|
24
|
+
value: string;
|
|
25
|
+
}[];
|
|
26
|
+
productData: ProductData;
|
|
27
|
+
metadata?: string;
|
|
28
|
+
}
|
|
29
|
+
interface LineItemCreate extends Omit<LineItem, "productData" | "product" | "metadata" | "variantOptions"> {
|
|
30
|
+
variantOptions?: {
|
|
31
|
+
name: string;
|
|
32
|
+
value: string;
|
|
33
|
+
}[];
|
|
34
|
+
productId: string;
|
|
35
|
+
product?: Pick<Product, "id" | "title" | "description" | "images" | "priceInCents">;
|
|
36
|
+
metadata?: RecursiveRecord;
|
|
37
|
+
}
|
|
38
|
+
type Currency = string;
|
|
39
|
+
interface CheckoutCreateParams {
|
|
40
|
+
type: "hosted" | "embed";
|
|
41
|
+
customerId?: string;
|
|
42
|
+
lineItems: LineItemCreate[];
|
|
43
|
+
currency?: Currency;
|
|
44
|
+
discountCodes?: string[];
|
|
45
|
+
}
|
|
46
|
+
interface CheckoutUpdateParams {
|
|
47
|
+
customerId?: string;
|
|
48
|
+
shipmentData?: {
|
|
49
|
+
provider: string;
|
|
50
|
+
name?: string;
|
|
51
|
+
pickupPointId?: string;
|
|
52
|
+
trackingNumber?: string;
|
|
53
|
+
trackingUrl?: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
type ShipmentData = {
|
|
58
|
+
provider: string;
|
|
59
|
+
name?: string;
|
|
60
|
+
service?: string;
|
|
61
|
+
pickupPointId?: string;
|
|
62
|
+
trackingId?: string;
|
|
63
|
+
trackingUrl?: string;
|
|
64
|
+
};
|
|
65
|
+
interface CheckoutSession {
|
|
66
|
+
id: string;
|
|
67
|
+
testmode: boolean;
|
|
68
|
+
clientSecret: string;
|
|
69
|
+
customer?: {
|
|
70
|
+
id: string;
|
|
71
|
+
address?: Address;
|
|
72
|
+
email?: string;
|
|
73
|
+
};
|
|
74
|
+
lineItems: LineItem[];
|
|
75
|
+
tax: number | null;
|
|
76
|
+
shipping: number | null;
|
|
77
|
+
discountAmount: number | null;
|
|
78
|
+
appliedDiscounts: {
|
|
79
|
+
id: string;
|
|
80
|
+
amount: number;
|
|
81
|
+
allowedLineItems: {
|
|
82
|
+
productId: string;
|
|
83
|
+
quantity: number;
|
|
84
|
+
}[];
|
|
85
|
+
discount: Discount;
|
|
86
|
+
}[];
|
|
87
|
+
currency: string;
|
|
88
|
+
exchangeRate: number | null;
|
|
89
|
+
shipmentData: ShipmentData | null;
|
|
90
|
+
status: "IN_PROGRESS" | "PAYMENT_PENDING" | "ABANDONED" | "CANCELED" | "FAILED";
|
|
91
|
+
}
|
|
92
|
+
type RecursiveRecord = {
|
|
93
|
+
[key: string]: any;
|
|
94
|
+
};
|
|
95
|
+
|
|
1
96
|
interface VariantOption {
|
|
2
97
|
name: string;
|
|
3
98
|
value: string;
|
|
@@ -181,96 +276,65 @@ type RetrieveDiscountParams = {
|
|
|
181
276
|
code: string;
|
|
182
277
|
};
|
|
183
278
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
value: string;
|
|
204
|
-
}[];
|
|
205
|
-
productData: ProductData;
|
|
206
|
-
metadata?: string;
|
|
279
|
+
interface CustomerSession {
|
|
280
|
+
customerId: string;
|
|
281
|
+
expiresAt: Date;
|
|
282
|
+
testmode: boolean;
|
|
283
|
+
customer: {
|
|
284
|
+
createdAt: Date;
|
|
285
|
+
updatedAt: Date;
|
|
286
|
+
firstName: string;
|
|
287
|
+
lastName: string;
|
|
288
|
+
email: string;
|
|
289
|
+
phone?: string;
|
|
290
|
+
password?: string;
|
|
291
|
+
image?: string;
|
|
292
|
+
metadata?: string;
|
|
293
|
+
stripeCustomerId: string;
|
|
294
|
+
isSubscribedEmail: boolean;
|
|
295
|
+
isSubscribedSMS: boolean;
|
|
296
|
+
address: Address;
|
|
297
|
+
};
|
|
207
298
|
}
|
|
208
|
-
interface
|
|
209
|
-
|
|
210
|
-
name: string;
|
|
211
|
-
value: string;
|
|
212
|
-
}[];
|
|
213
|
-
productId: string;
|
|
214
|
-
product?: Pick<Product, "id" | "title" | "description" | "images" | "priceInCents">;
|
|
215
|
-
metadata?: RecursiveRecord;
|
|
299
|
+
interface OTPLoginParams {
|
|
300
|
+
email: string;
|
|
216
301
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
customerId?: string;
|
|
221
|
-
lineItems: LineItemCreate[];
|
|
222
|
-
currency?: Currency;
|
|
223
|
-
discountCodes?: string[];
|
|
302
|
+
interface OTPSignupParams extends OTPLoginParams {
|
|
303
|
+
firstName: string;
|
|
304
|
+
lastName: string;
|
|
224
305
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
306
|
+
type OTPLoginResponse = {
|
|
307
|
+
success: true;
|
|
308
|
+
token: string;
|
|
309
|
+
} | {
|
|
310
|
+
success: false;
|
|
311
|
+
code: string;
|
|
312
|
+
error: string;
|
|
313
|
+
};
|
|
314
|
+
type OTPSignupResponse = OTPLoginResponse;
|
|
315
|
+
type OTPVerifyResponse = {
|
|
316
|
+
success: true;
|
|
317
|
+
customerSession: CustomerSession;
|
|
318
|
+
} | {
|
|
319
|
+
success: false;
|
|
320
|
+
code: string;
|
|
321
|
+
error: string;
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
declare class OTP {
|
|
325
|
+
private apiClient;
|
|
326
|
+
constructor(apiClient: ReturnType<typeof createApiClient>);
|
|
327
|
+
signup(params: OTPSignupParams): Promise<OTPSignupResponse>;
|
|
328
|
+
login(params: OTPLoginParams): Promise<OTPLoginResponse>;
|
|
329
|
+
verify(token: string): Promise<OTPVerifyResponse>;
|
|
234
330
|
}
|
|
235
331
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
trackingId?: string;
|
|
242
|
-
trackingUrl?: string;
|
|
243
|
-
};
|
|
244
|
-
interface CheckoutSession {
|
|
245
|
-
id: string;
|
|
246
|
-
testmode: boolean;
|
|
247
|
-
clientSecret: string;
|
|
248
|
-
customer?: {
|
|
249
|
-
id: string;
|
|
250
|
-
address?: Address;
|
|
251
|
-
email?: string;
|
|
252
|
-
};
|
|
253
|
-
lineItems: LineItem[];
|
|
254
|
-
tax: number | null;
|
|
255
|
-
shipping: number | null;
|
|
256
|
-
discountAmount: number | null;
|
|
257
|
-
appliedDiscounts: {
|
|
258
|
-
id: string;
|
|
259
|
-
amount: number;
|
|
260
|
-
allowedLineItems: {
|
|
261
|
-
productId: string;
|
|
262
|
-
quantity: number;
|
|
263
|
-
}[];
|
|
264
|
-
discount: Discount;
|
|
265
|
-
}[];
|
|
266
|
-
currency: string;
|
|
267
|
-
exchangeRate: number | null;
|
|
268
|
-
shipmentData: ShipmentData | null;
|
|
269
|
-
status: "IN_PROGRESS" | "PAYMENT_PENDING" | "ABANDONED" | "CANCELED" | "FAILED";
|
|
332
|
+
declare class Auth {
|
|
333
|
+
private apiClient;
|
|
334
|
+
otp: OTP;
|
|
335
|
+
constructor(apiKey: string, proxy?: string);
|
|
336
|
+
retrieveSession(id: string): Promise<CustomerSession | null>;
|
|
270
337
|
}
|
|
271
|
-
type RecursiveRecord = {
|
|
272
|
-
[key: string]: any;
|
|
273
|
-
};
|
|
274
338
|
|
|
275
339
|
declare class Checkout {
|
|
276
340
|
private apiClient;
|
|
@@ -425,6 +489,7 @@ declare function createBetterStore(config: {
|
|
|
425
489
|
discounts: Discounts;
|
|
426
490
|
collections: Collections;
|
|
427
491
|
products: Products;
|
|
492
|
+
auth: Auth;
|
|
428
493
|
};
|
|
429
494
|
declare function createStoreClient(config?: {
|
|
430
495
|
proxy?: string;
|
|
@@ -433,4 +498,4 @@ declare function createStoreHelpers(config?: {
|
|
|
433
498
|
proxy?: string;
|
|
434
499
|
}): Helpers;
|
|
435
500
|
|
|
436
|
-
export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Collection, type CollectionWithProducts, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerSubscription, type CustomerSubscriptionUpdateParams, type CustomerUpdateParams, type Discount, type LineItem, type LineItemCreate, type ListCollectionsParams, type ListCollectionsQuery, type ListCollectionsSortBy, type ListProductsParams, type ListProductsQuery, type ListProductsSortBy, type Product, type ProductBillingInterval, type ProductBillingType, type ProductOption, type ProductStatus, type ProductVariant, type ProductWithoutVariants, type RetrieveCollectionParams, type RetrieveDiscountParams, type RetrieveProductParams, type ShippingRate, type SortOrder, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
|
|
501
|
+
export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Collection, type CollectionWithProducts, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerSession, type CustomerSubscription, type CustomerSubscriptionUpdateParams, type CustomerUpdateParams, type Discount, type LineItem, type LineItemCreate, type ListCollectionsParams, type ListCollectionsQuery, type ListCollectionsSortBy, type ListProductsParams, type ListProductsQuery, type ListProductsSortBy, type OTPLoginParams, type OTPLoginResponse, type OTPSignupParams, type OTPSignupResponse, type OTPVerifyResponse, type Product, type ProductBillingInterval, type ProductBillingType, type ProductOption, type ProductStatus, type ProductVariant, type ProductWithoutVariants, type RetrieveCollectionParams, type RetrieveDiscountParams, type RetrieveProductParams, type ShippingRate, type SortOrder, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,98 @@
|
|
|
1
|
+
import * as axios from 'axios';
|
|
2
|
+
|
|
3
|
+
declare const createApiClient: (apiKey: string, proxy?: string) => axios.AxiosInstance;
|
|
4
|
+
|
|
5
|
+
type ShippingRate = ZasilkovnaRate;
|
|
6
|
+
interface BaseRate {
|
|
7
|
+
provider: string;
|
|
8
|
+
name: string;
|
|
9
|
+
price: number;
|
|
10
|
+
}
|
|
11
|
+
interface ZasilkovnaRate extends BaseRate {
|
|
12
|
+
provider: "zasilkovna";
|
|
13
|
+
clientSecret: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type ProductData = Pick<Product, "title" | "description" | "images" | "category" | "tags" | "sku" | "barcode" | "vendor" | "isPhysical" | "weightInGrams" | "heightInCm" | "widthInCm" | "lengthInCm" | "priceInCents" | "billingType" | "billingInterval" | "billingIntervalCount"> & {
|
|
17
|
+
productId: string;
|
|
18
|
+
selectedVariant: Pick<ProductVariant, "title" | "sku" | "barcode" | "images" | "isPhysical" | "weightInGrams" | "heightInCm" | "widthInCm" | "lengthInCm" | "priceInCents" | "billingType" | "billingInterval" | "billingIntervalCount" | "variantOptions">;
|
|
19
|
+
};
|
|
20
|
+
interface LineItem {
|
|
21
|
+
quantity: number;
|
|
22
|
+
variantOptions: {
|
|
23
|
+
name: string;
|
|
24
|
+
value: string;
|
|
25
|
+
}[];
|
|
26
|
+
productData: ProductData;
|
|
27
|
+
metadata?: string;
|
|
28
|
+
}
|
|
29
|
+
interface LineItemCreate extends Omit<LineItem, "productData" | "product" | "metadata" | "variantOptions"> {
|
|
30
|
+
variantOptions?: {
|
|
31
|
+
name: string;
|
|
32
|
+
value: string;
|
|
33
|
+
}[];
|
|
34
|
+
productId: string;
|
|
35
|
+
product?: Pick<Product, "id" | "title" | "description" | "images" | "priceInCents">;
|
|
36
|
+
metadata?: RecursiveRecord;
|
|
37
|
+
}
|
|
38
|
+
type Currency = string;
|
|
39
|
+
interface CheckoutCreateParams {
|
|
40
|
+
type: "hosted" | "embed";
|
|
41
|
+
customerId?: string;
|
|
42
|
+
lineItems: LineItemCreate[];
|
|
43
|
+
currency?: Currency;
|
|
44
|
+
discountCodes?: string[];
|
|
45
|
+
}
|
|
46
|
+
interface CheckoutUpdateParams {
|
|
47
|
+
customerId?: string;
|
|
48
|
+
shipmentData?: {
|
|
49
|
+
provider: string;
|
|
50
|
+
name?: string;
|
|
51
|
+
pickupPointId?: string;
|
|
52
|
+
trackingNumber?: string;
|
|
53
|
+
trackingUrl?: string;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
type ShipmentData = {
|
|
58
|
+
provider: string;
|
|
59
|
+
name?: string;
|
|
60
|
+
service?: string;
|
|
61
|
+
pickupPointId?: string;
|
|
62
|
+
trackingId?: string;
|
|
63
|
+
trackingUrl?: string;
|
|
64
|
+
};
|
|
65
|
+
interface CheckoutSession {
|
|
66
|
+
id: string;
|
|
67
|
+
testmode: boolean;
|
|
68
|
+
clientSecret: string;
|
|
69
|
+
customer?: {
|
|
70
|
+
id: string;
|
|
71
|
+
address?: Address;
|
|
72
|
+
email?: string;
|
|
73
|
+
};
|
|
74
|
+
lineItems: LineItem[];
|
|
75
|
+
tax: number | null;
|
|
76
|
+
shipping: number | null;
|
|
77
|
+
discountAmount: number | null;
|
|
78
|
+
appliedDiscounts: {
|
|
79
|
+
id: string;
|
|
80
|
+
amount: number;
|
|
81
|
+
allowedLineItems: {
|
|
82
|
+
productId: string;
|
|
83
|
+
quantity: number;
|
|
84
|
+
}[];
|
|
85
|
+
discount: Discount;
|
|
86
|
+
}[];
|
|
87
|
+
currency: string;
|
|
88
|
+
exchangeRate: number | null;
|
|
89
|
+
shipmentData: ShipmentData | null;
|
|
90
|
+
status: "IN_PROGRESS" | "PAYMENT_PENDING" | "ABANDONED" | "CANCELED" | "FAILED";
|
|
91
|
+
}
|
|
92
|
+
type RecursiveRecord = {
|
|
93
|
+
[key: string]: any;
|
|
94
|
+
};
|
|
95
|
+
|
|
1
96
|
interface VariantOption {
|
|
2
97
|
name: string;
|
|
3
98
|
value: string;
|
|
@@ -181,96 +276,65 @@ type RetrieveDiscountParams = {
|
|
|
181
276
|
code: string;
|
|
182
277
|
};
|
|
183
278
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
value: string;
|
|
204
|
-
}[];
|
|
205
|
-
productData: ProductData;
|
|
206
|
-
metadata?: string;
|
|
279
|
+
interface CustomerSession {
|
|
280
|
+
customerId: string;
|
|
281
|
+
expiresAt: Date;
|
|
282
|
+
testmode: boolean;
|
|
283
|
+
customer: {
|
|
284
|
+
createdAt: Date;
|
|
285
|
+
updatedAt: Date;
|
|
286
|
+
firstName: string;
|
|
287
|
+
lastName: string;
|
|
288
|
+
email: string;
|
|
289
|
+
phone?: string;
|
|
290
|
+
password?: string;
|
|
291
|
+
image?: string;
|
|
292
|
+
metadata?: string;
|
|
293
|
+
stripeCustomerId: string;
|
|
294
|
+
isSubscribedEmail: boolean;
|
|
295
|
+
isSubscribedSMS: boolean;
|
|
296
|
+
address: Address;
|
|
297
|
+
};
|
|
207
298
|
}
|
|
208
|
-
interface
|
|
209
|
-
|
|
210
|
-
name: string;
|
|
211
|
-
value: string;
|
|
212
|
-
}[];
|
|
213
|
-
productId: string;
|
|
214
|
-
product?: Pick<Product, "id" | "title" | "description" | "images" | "priceInCents">;
|
|
215
|
-
metadata?: RecursiveRecord;
|
|
299
|
+
interface OTPLoginParams {
|
|
300
|
+
email: string;
|
|
216
301
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
customerId?: string;
|
|
221
|
-
lineItems: LineItemCreate[];
|
|
222
|
-
currency?: Currency;
|
|
223
|
-
discountCodes?: string[];
|
|
302
|
+
interface OTPSignupParams extends OTPLoginParams {
|
|
303
|
+
firstName: string;
|
|
304
|
+
lastName: string;
|
|
224
305
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
306
|
+
type OTPLoginResponse = {
|
|
307
|
+
success: true;
|
|
308
|
+
token: string;
|
|
309
|
+
} | {
|
|
310
|
+
success: false;
|
|
311
|
+
code: string;
|
|
312
|
+
error: string;
|
|
313
|
+
};
|
|
314
|
+
type OTPSignupResponse = OTPLoginResponse;
|
|
315
|
+
type OTPVerifyResponse = {
|
|
316
|
+
success: true;
|
|
317
|
+
customerSession: CustomerSession;
|
|
318
|
+
} | {
|
|
319
|
+
success: false;
|
|
320
|
+
code: string;
|
|
321
|
+
error: string;
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
declare class OTP {
|
|
325
|
+
private apiClient;
|
|
326
|
+
constructor(apiClient: ReturnType<typeof createApiClient>);
|
|
327
|
+
signup(params: OTPSignupParams): Promise<OTPSignupResponse>;
|
|
328
|
+
login(params: OTPLoginParams): Promise<OTPLoginResponse>;
|
|
329
|
+
verify(token: string): Promise<OTPVerifyResponse>;
|
|
234
330
|
}
|
|
235
331
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
trackingId?: string;
|
|
242
|
-
trackingUrl?: string;
|
|
243
|
-
};
|
|
244
|
-
interface CheckoutSession {
|
|
245
|
-
id: string;
|
|
246
|
-
testmode: boolean;
|
|
247
|
-
clientSecret: string;
|
|
248
|
-
customer?: {
|
|
249
|
-
id: string;
|
|
250
|
-
address?: Address;
|
|
251
|
-
email?: string;
|
|
252
|
-
};
|
|
253
|
-
lineItems: LineItem[];
|
|
254
|
-
tax: number | null;
|
|
255
|
-
shipping: number | null;
|
|
256
|
-
discountAmount: number | null;
|
|
257
|
-
appliedDiscounts: {
|
|
258
|
-
id: string;
|
|
259
|
-
amount: number;
|
|
260
|
-
allowedLineItems: {
|
|
261
|
-
productId: string;
|
|
262
|
-
quantity: number;
|
|
263
|
-
}[];
|
|
264
|
-
discount: Discount;
|
|
265
|
-
}[];
|
|
266
|
-
currency: string;
|
|
267
|
-
exchangeRate: number | null;
|
|
268
|
-
shipmentData: ShipmentData | null;
|
|
269
|
-
status: "IN_PROGRESS" | "PAYMENT_PENDING" | "ABANDONED" | "CANCELED" | "FAILED";
|
|
332
|
+
declare class Auth {
|
|
333
|
+
private apiClient;
|
|
334
|
+
otp: OTP;
|
|
335
|
+
constructor(apiKey: string, proxy?: string);
|
|
336
|
+
retrieveSession(id: string): Promise<CustomerSession | null>;
|
|
270
337
|
}
|
|
271
|
-
type RecursiveRecord = {
|
|
272
|
-
[key: string]: any;
|
|
273
|
-
};
|
|
274
338
|
|
|
275
339
|
declare class Checkout {
|
|
276
340
|
private apiClient;
|
|
@@ -425,6 +489,7 @@ declare function createBetterStore(config: {
|
|
|
425
489
|
discounts: Discounts;
|
|
426
490
|
collections: Collections;
|
|
427
491
|
products: Products;
|
|
492
|
+
auth: Auth;
|
|
428
493
|
};
|
|
429
494
|
declare function createStoreClient(config?: {
|
|
430
495
|
proxy?: string;
|
|
@@ -433,4 +498,4 @@ declare function createStoreHelpers(config?: {
|
|
|
433
498
|
proxy?: string;
|
|
434
499
|
}): Helpers;
|
|
435
500
|
|
|
436
|
-
export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Collection, type CollectionWithProducts, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerSubscription, type CustomerSubscriptionUpdateParams, type CustomerUpdateParams, type Discount, type LineItem, type LineItemCreate, type ListCollectionsParams, type ListCollectionsQuery, type ListCollectionsSortBy, type ListProductsParams, type ListProductsQuery, type ListProductsSortBy, type Product, type ProductBillingInterval, type ProductBillingType, type ProductOption, type ProductStatus, type ProductVariant, type ProductWithoutVariants, type RetrieveCollectionParams, type RetrieveDiscountParams, type RetrieveProductParams, type ShippingRate, type SortOrder, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
|
|
501
|
+
export { type Address, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Collection, type CollectionWithProducts, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerSession, type CustomerSubscription, type CustomerSubscriptionUpdateParams, type CustomerUpdateParams, type Discount, type LineItem, type LineItemCreate, type ListCollectionsParams, type ListCollectionsQuery, type ListCollectionsSortBy, type ListProductsParams, type ListProductsQuery, type ListProductsSortBy, type OTPLoginParams, type OTPLoginResponse, type OTPSignupParams, type OTPSignupResponse, type OTPVerifyResponse, type Product, type ProductBillingInterval, type ProductBillingType, type ProductOption, type ProductStatus, type ProductVariant, type ProductWithoutVariants, type RetrieveCollectionParams, type RetrieveDiscountParams, type RetrieveProductParams, type ShippingRate, type SortOrder, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
|
package/dist/index.js
CHANGED
|
@@ -100,6 +100,59 @@ var createApiClient = (apiKey, proxy) => {
|
|
|
100
100
|
return client;
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
+
// src/auth/providers/otp.ts
|
|
104
|
+
var OTP = class {
|
|
105
|
+
constructor(apiClient) {
|
|
106
|
+
this.apiClient = apiClient;
|
|
107
|
+
}
|
|
108
|
+
signup(params) {
|
|
109
|
+
return __async(this, null, function* () {
|
|
110
|
+
const data = yield this.apiClient.post(
|
|
111
|
+
"/auth/otp/signup",
|
|
112
|
+
params
|
|
113
|
+
);
|
|
114
|
+
return data;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
login(params) {
|
|
118
|
+
return __async(this, null, function* () {
|
|
119
|
+
const data = yield this.apiClient.post(
|
|
120
|
+
"/auth/otp/login",
|
|
121
|
+
params
|
|
122
|
+
);
|
|
123
|
+
return data;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
verify(token) {
|
|
127
|
+
return __async(this, null, function* () {
|
|
128
|
+
const data = yield this.apiClient.post(
|
|
129
|
+
"/auth/otp/verify",
|
|
130
|
+
{
|
|
131
|
+
token
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
return data;
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// src/auth/index.ts
|
|
140
|
+
var Auth = class {
|
|
141
|
+
constructor(apiKey, proxy) {
|
|
142
|
+
this.apiClient = createApiClient(apiKey, proxy);
|
|
143
|
+
this.otp = new OTP(this.apiClient);
|
|
144
|
+
}
|
|
145
|
+
retrieveSession(id) {
|
|
146
|
+
return __async(this, null, function* () {
|
|
147
|
+
const data = yield this.apiClient.get(
|
|
148
|
+
`/auth/session/${id}`
|
|
149
|
+
);
|
|
150
|
+
return data;
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
var auth_default = Auth;
|
|
155
|
+
|
|
103
156
|
// src/checkout/index.ts
|
|
104
157
|
var Checkout = class {
|
|
105
158
|
constructor(apiKey, proxy) {
|
|
@@ -634,7 +687,8 @@ function createBetterStore(config) {
|
|
|
634
687
|
customer: new customer_default(config.apiKey, config.proxy),
|
|
635
688
|
discounts: new discounts_default(config.apiKey, config.proxy),
|
|
636
689
|
collections: new collections_default(config.apiKey, config.proxy),
|
|
637
|
-
products: new products_default(config.apiKey, config.proxy)
|
|
690
|
+
products: new products_default(config.apiKey, config.proxy),
|
|
691
|
+
auth: new auth_default(config.apiKey, config.proxy)
|
|
638
692
|
};
|
|
639
693
|
}
|
|
640
694
|
function createStoreClient(config) {
|
package/dist/index.mjs
CHANGED
|
@@ -63,6 +63,59 @@ var createApiClient = (apiKey, proxy) => {
|
|
|
63
63
|
return client;
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
+
// src/auth/providers/otp.ts
|
|
67
|
+
var OTP = class {
|
|
68
|
+
constructor(apiClient) {
|
|
69
|
+
this.apiClient = apiClient;
|
|
70
|
+
}
|
|
71
|
+
signup(params) {
|
|
72
|
+
return __async(this, null, function* () {
|
|
73
|
+
const data = yield this.apiClient.post(
|
|
74
|
+
"/auth/otp/signup",
|
|
75
|
+
params
|
|
76
|
+
);
|
|
77
|
+
return data;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
login(params) {
|
|
81
|
+
return __async(this, null, function* () {
|
|
82
|
+
const data = yield this.apiClient.post(
|
|
83
|
+
"/auth/otp/login",
|
|
84
|
+
params
|
|
85
|
+
);
|
|
86
|
+
return data;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
verify(token) {
|
|
90
|
+
return __async(this, null, function* () {
|
|
91
|
+
const data = yield this.apiClient.post(
|
|
92
|
+
"/auth/otp/verify",
|
|
93
|
+
{
|
|
94
|
+
token
|
|
95
|
+
}
|
|
96
|
+
);
|
|
97
|
+
return data;
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// src/auth/index.ts
|
|
103
|
+
var Auth = class {
|
|
104
|
+
constructor(apiKey, proxy) {
|
|
105
|
+
this.apiClient = createApiClient(apiKey, proxy);
|
|
106
|
+
this.otp = new OTP(this.apiClient);
|
|
107
|
+
}
|
|
108
|
+
retrieveSession(id) {
|
|
109
|
+
return __async(this, null, function* () {
|
|
110
|
+
const data = yield this.apiClient.get(
|
|
111
|
+
`/auth/session/${id}`
|
|
112
|
+
);
|
|
113
|
+
return data;
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
var auth_default = Auth;
|
|
118
|
+
|
|
66
119
|
// src/checkout/index.ts
|
|
67
120
|
var Checkout = class {
|
|
68
121
|
constructor(apiKey, proxy) {
|
|
@@ -597,7 +650,8 @@ function createBetterStore(config) {
|
|
|
597
650
|
customer: new customer_default(config.apiKey, config.proxy),
|
|
598
651
|
discounts: new discounts_default(config.apiKey, config.proxy),
|
|
599
652
|
collections: new collections_default(config.apiKey, config.proxy),
|
|
600
|
-
products: new products_default(config.apiKey, config.proxy)
|
|
653
|
+
products: new products_default(config.apiKey, config.proxy),
|
|
654
|
+
auth: new auth_default(config.apiKey, config.proxy)
|
|
601
655
|
};
|
|
602
656
|
}
|
|
603
657
|
function createStoreClient(config) {
|