@betterstore/sdk 0.3.76 → 0.3.78
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 +135 -85
- package/dist/index.d.ts +135 -85
- package/dist/index.js +47 -1
- package/dist/index.mjs +47 -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,50 @@ 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
|
-
|
|
211
|
-
|
|
212
|
-
}[];
|
|
213
|
-
productId: string;
|
|
214
|
-
product?: Pick<Product, "title" | "priceInCents" | "images" | "description">;
|
|
215
|
-
metadata?: RecursiveRecord;
|
|
299
|
+
interface MagicLinkLoginParams {
|
|
300
|
+
email: string;
|
|
301
|
+
callbackUrl: string;
|
|
302
|
+
customValidationUrl: string;
|
|
216
303
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
customerId?: string;
|
|
221
|
-
lineItems: LineItemCreate[];
|
|
222
|
-
currency?: Currency;
|
|
223
|
-
discountCodes?: string[];
|
|
304
|
+
interface MagicLinkSignupParams extends MagicLinkLoginParams {
|
|
305
|
+
firstName: string;
|
|
306
|
+
lastName: string;
|
|
224
307
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
trackingUrl?: string;
|
|
233
|
-
};
|
|
308
|
+
|
|
309
|
+
declare class MagicLink {
|
|
310
|
+
private apiClient;
|
|
311
|
+
constructor(apiClient: ReturnType<typeof createApiClient>);
|
|
312
|
+
signup(params: MagicLinkSignupParams): Promise<void>;
|
|
313
|
+
login(params: MagicLinkLoginParams): Promise<void>;
|
|
314
|
+
verify(token: string): Promise<CustomerSession>;
|
|
234
315
|
}
|
|
235
316
|
|
|
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";
|
|
317
|
+
declare class Auth {
|
|
318
|
+
private apiClient;
|
|
319
|
+
magicLink: MagicLink;
|
|
320
|
+
constructor(apiKey: string, proxy?: string);
|
|
321
|
+
retrieveSession(id: string): Promise<CustomerSession | null>;
|
|
270
322
|
}
|
|
271
|
-
type RecursiveRecord = {
|
|
272
|
-
[key: string]: any;
|
|
273
|
-
};
|
|
274
323
|
|
|
275
324
|
declare class Checkout {
|
|
276
325
|
private apiClient;
|
|
@@ -425,6 +474,7 @@ declare function createBetterStore(config: {
|
|
|
425
474
|
discounts: Discounts;
|
|
426
475
|
collections: Collections;
|
|
427
476
|
products: Products;
|
|
477
|
+
auth: Auth;
|
|
428
478
|
};
|
|
429
479
|
declare function createStoreClient(config?: {
|
|
430
480
|
proxy?: string;
|
|
@@ -433,4 +483,4 @@ declare function createStoreHelpers(config?: {
|
|
|
433
483
|
proxy?: string;
|
|
434
484
|
}): Helpers;
|
|
435
485
|
|
|
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 };
|
|
486
|
+
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 MagicLinkLoginParams, type MagicLinkSignupParams, 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,50 @@ 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
|
-
|
|
211
|
-
|
|
212
|
-
}[];
|
|
213
|
-
productId: string;
|
|
214
|
-
product?: Pick<Product, "title" | "priceInCents" | "images" | "description">;
|
|
215
|
-
metadata?: RecursiveRecord;
|
|
299
|
+
interface MagicLinkLoginParams {
|
|
300
|
+
email: string;
|
|
301
|
+
callbackUrl: string;
|
|
302
|
+
customValidationUrl: string;
|
|
216
303
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
customerId?: string;
|
|
221
|
-
lineItems: LineItemCreate[];
|
|
222
|
-
currency?: Currency;
|
|
223
|
-
discountCodes?: string[];
|
|
304
|
+
interface MagicLinkSignupParams extends MagicLinkLoginParams {
|
|
305
|
+
firstName: string;
|
|
306
|
+
lastName: string;
|
|
224
307
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
trackingUrl?: string;
|
|
233
|
-
};
|
|
308
|
+
|
|
309
|
+
declare class MagicLink {
|
|
310
|
+
private apiClient;
|
|
311
|
+
constructor(apiClient: ReturnType<typeof createApiClient>);
|
|
312
|
+
signup(params: MagicLinkSignupParams): Promise<void>;
|
|
313
|
+
login(params: MagicLinkLoginParams): Promise<void>;
|
|
314
|
+
verify(token: string): Promise<CustomerSession>;
|
|
234
315
|
}
|
|
235
316
|
|
|
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";
|
|
317
|
+
declare class Auth {
|
|
318
|
+
private apiClient;
|
|
319
|
+
magicLink: MagicLink;
|
|
320
|
+
constructor(apiKey: string, proxy?: string);
|
|
321
|
+
retrieveSession(id: string): Promise<CustomerSession | null>;
|
|
270
322
|
}
|
|
271
|
-
type RecursiveRecord = {
|
|
272
|
-
[key: string]: any;
|
|
273
|
-
};
|
|
274
323
|
|
|
275
324
|
declare class Checkout {
|
|
276
325
|
private apiClient;
|
|
@@ -425,6 +474,7 @@ declare function createBetterStore(config: {
|
|
|
425
474
|
discounts: Discounts;
|
|
426
475
|
collections: Collections;
|
|
427
476
|
products: Products;
|
|
477
|
+
auth: Auth;
|
|
428
478
|
};
|
|
429
479
|
declare function createStoreClient(config?: {
|
|
430
480
|
proxy?: string;
|
|
@@ -433,4 +483,4 @@ declare function createStoreHelpers(config?: {
|
|
|
433
483
|
proxy?: string;
|
|
434
484
|
}): Helpers;
|
|
435
485
|
|
|
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 };
|
|
486
|
+
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 MagicLinkLoginParams, type MagicLinkSignupParams, 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,51 @@ var createApiClient = (apiKey, proxy) => {
|
|
|
100
100
|
return client;
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
+
// src/auth/providers/magic-link.ts
|
|
104
|
+
var MagicLink = class {
|
|
105
|
+
constructor(apiClient) {
|
|
106
|
+
this.apiClient = apiClient;
|
|
107
|
+
}
|
|
108
|
+
signup(params) {
|
|
109
|
+
return __async(this, null, function* () {
|
|
110
|
+
yield this.apiClient.post("/auth/magic-link/signup", params);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
login(params) {
|
|
114
|
+
return __async(this, null, function* () {
|
|
115
|
+
yield this.apiClient.post("/auth/magic-link/login", params);
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
verify(token) {
|
|
119
|
+
return __async(this, null, function* () {
|
|
120
|
+
const data = yield this.apiClient.post(
|
|
121
|
+
"/auth/magic-link/verify",
|
|
122
|
+
{
|
|
123
|
+
token
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
return data;
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
// src/auth/index.ts
|
|
132
|
+
var Auth = class {
|
|
133
|
+
constructor(apiKey, proxy) {
|
|
134
|
+
this.apiClient = createApiClient(apiKey, proxy);
|
|
135
|
+
this.magicLink = new MagicLink(this.apiClient);
|
|
136
|
+
}
|
|
137
|
+
retrieveSession(id) {
|
|
138
|
+
return __async(this, null, function* () {
|
|
139
|
+
const data = yield this.apiClient.get(
|
|
140
|
+
`/auth/session/${id}`
|
|
141
|
+
);
|
|
142
|
+
return data;
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
var auth_default = Auth;
|
|
147
|
+
|
|
103
148
|
// src/checkout/index.ts
|
|
104
149
|
var Checkout = class {
|
|
105
150
|
constructor(apiKey, proxy) {
|
|
@@ -634,7 +679,8 @@ function createBetterStore(config) {
|
|
|
634
679
|
customer: new customer_default(config.apiKey, config.proxy),
|
|
635
680
|
discounts: new discounts_default(config.apiKey, config.proxy),
|
|
636
681
|
collections: new collections_default(config.apiKey, config.proxy),
|
|
637
|
-
products: new products_default(config.apiKey, config.proxy)
|
|
682
|
+
products: new products_default(config.apiKey, config.proxy),
|
|
683
|
+
auth: new auth_default(config.apiKey, config.proxy)
|
|
638
684
|
};
|
|
639
685
|
}
|
|
640
686
|
function createStoreClient(config) {
|
package/dist/index.mjs
CHANGED
|
@@ -63,6 +63,51 @@ var createApiClient = (apiKey, proxy) => {
|
|
|
63
63
|
return client;
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
+
// src/auth/providers/magic-link.ts
|
|
67
|
+
var MagicLink = class {
|
|
68
|
+
constructor(apiClient) {
|
|
69
|
+
this.apiClient = apiClient;
|
|
70
|
+
}
|
|
71
|
+
signup(params) {
|
|
72
|
+
return __async(this, null, function* () {
|
|
73
|
+
yield this.apiClient.post("/auth/magic-link/signup", params);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
login(params) {
|
|
77
|
+
return __async(this, null, function* () {
|
|
78
|
+
yield this.apiClient.post("/auth/magic-link/login", params);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
verify(token) {
|
|
82
|
+
return __async(this, null, function* () {
|
|
83
|
+
const data = yield this.apiClient.post(
|
|
84
|
+
"/auth/magic-link/verify",
|
|
85
|
+
{
|
|
86
|
+
token
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
return data;
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// src/auth/index.ts
|
|
95
|
+
var Auth = class {
|
|
96
|
+
constructor(apiKey, proxy) {
|
|
97
|
+
this.apiClient = createApiClient(apiKey, proxy);
|
|
98
|
+
this.magicLink = new MagicLink(this.apiClient);
|
|
99
|
+
}
|
|
100
|
+
retrieveSession(id) {
|
|
101
|
+
return __async(this, null, function* () {
|
|
102
|
+
const data = yield this.apiClient.get(
|
|
103
|
+
`/auth/session/${id}`
|
|
104
|
+
);
|
|
105
|
+
return data;
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
var auth_default = Auth;
|
|
110
|
+
|
|
66
111
|
// src/checkout/index.ts
|
|
67
112
|
var Checkout = class {
|
|
68
113
|
constructor(apiKey, proxy) {
|
|
@@ -597,7 +642,8 @@ function createBetterStore(config) {
|
|
|
597
642
|
customer: new customer_default(config.apiKey, config.proxy),
|
|
598
643
|
discounts: new discounts_default(config.apiKey, config.proxy),
|
|
599
644
|
collections: new collections_default(config.apiKey, config.proxy),
|
|
600
|
-
products: new products_default(config.apiKey, config.proxy)
|
|
645
|
+
products: new products_default(config.apiKey, config.proxy),
|
|
646
|
+
auth: new auth_default(config.apiKey, config.proxy)
|
|
601
647
|
};
|
|
602
648
|
}
|
|
603
649
|
function createStoreClient(config) {
|