@betterstore/sdk 0.3.78 → 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 +6 -0
- package/dist/index.d.mts +25 -10
- package/dist/index.d.ts +25 -10
- package/dist/index.js +14 -6
- package/dist/index.mjs +14 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -296,27 +296,42 @@ interface CustomerSession {
|
|
|
296
296
|
address: Address;
|
|
297
297
|
};
|
|
298
298
|
}
|
|
299
|
-
interface
|
|
299
|
+
interface OTPLoginParams {
|
|
300
300
|
email: string;
|
|
301
|
-
callbackUrl: string;
|
|
302
|
-
customValidationUrl: string;
|
|
303
301
|
}
|
|
304
|
-
interface
|
|
302
|
+
interface OTPSignupParams extends OTPLoginParams {
|
|
305
303
|
firstName: string;
|
|
306
304
|
lastName: string;
|
|
307
305
|
}
|
|
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
|
+
};
|
|
308
323
|
|
|
309
|
-
declare class
|
|
324
|
+
declare class OTP {
|
|
310
325
|
private apiClient;
|
|
311
326
|
constructor(apiClient: ReturnType<typeof createApiClient>);
|
|
312
|
-
signup(params:
|
|
313
|
-
login(params:
|
|
314
|
-
verify(token: string): Promise<
|
|
327
|
+
signup(params: OTPSignupParams): Promise<OTPSignupResponse>;
|
|
328
|
+
login(params: OTPLoginParams): Promise<OTPLoginResponse>;
|
|
329
|
+
verify(token: string): Promise<OTPVerifyResponse>;
|
|
315
330
|
}
|
|
316
331
|
|
|
317
332
|
declare class Auth {
|
|
318
333
|
private apiClient;
|
|
319
|
-
|
|
334
|
+
otp: OTP;
|
|
320
335
|
constructor(apiKey: string, proxy?: string);
|
|
321
336
|
retrieveSession(id: string): Promise<CustomerSession | null>;
|
|
322
337
|
}
|
|
@@ -483,4 +498,4 @@ declare function createStoreHelpers(config?: {
|
|
|
483
498
|
proxy?: string;
|
|
484
499
|
}): Helpers;
|
|
485
500
|
|
|
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
|
|
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
|
@@ -296,27 +296,42 @@ interface CustomerSession {
|
|
|
296
296
|
address: Address;
|
|
297
297
|
};
|
|
298
298
|
}
|
|
299
|
-
interface
|
|
299
|
+
interface OTPLoginParams {
|
|
300
300
|
email: string;
|
|
301
|
-
callbackUrl: string;
|
|
302
|
-
customValidationUrl: string;
|
|
303
301
|
}
|
|
304
|
-
interface
|
|
302
|
+
interface OTPSignupParams extends OTPLoginParams {
|
|
305
303
|
firstName: string;
|
|
306
304
|
lastName: string;
|
|
307
305
|
}
|
|
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
|
+
};
|
|
308
323
|
|
|
309
|
-
declare class
|
|
324
|
+
declare class OTP {
|
|
310
325
|
private apiClient;
|
|
311
326
|
constructor(apiClient: ReturnType<typeof createApiClient>);
|
|
312
|
-
signup(params:
|
|
313
|
-
login(params:
|
|
314
|
-
verify(token: string): Promise<
|
|
327
|
+
signup(params: OTPSignupParams): Promise<OTPSignupResponse>;
|
|
328
|
+
login(params: OTPLoginParams): Promise<OTPLoginResponse>;
|
|
329
|
+
verify(token: string): Promise<OTPVerifyResponse>;
|
|
315
330
|
}
|
|
316
331
|
|
|
317
332
|
declare class Auth {
|
|
318
333
|
private apiClient;
|
|
319
|
-
|
|
334
|
+
otp: OTP;
|
|
320
335
|
constructor(apiKey: string, proxy?: string);
|
|
321
336
|
retrieveSession(id: string): Promise<CustomerSession | null>;
|
|
322
337
|
}
|
|
@@ -483,4 +498,4 @@ declare function createStoreHelpers(config?: {
|
|
|
483
498
|
proxy?: string;
|
|
484
499
|
}): Helpers;
|
|
485
500
|
|
|
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
|
|
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,25 +100,33 @@ var createApiClient = (apiKey, proxy) => {
|
|
|
100
100
|
return client;
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
-
// src/auth/providers/
|
|
104
|
-
var
|
|
103
|
+
// src/auth/providers/otp.ts
|
|
104
|
+
var OTP = class {
|
|
105
105
|
constructor(apiClient) {
|
|
106
106
|
this.apiClient = apiClient;
|
|
107
107
|
}
|
|
108
108
|
signup(params) {
|
|
109
109
|
return __async(this, null, function* () {
|
|
110
|
-
yield this.apiClient.post(
|
|
110
|
+
const data = yield this.apiClient.post(
|
|
111
|
+
"/auth/otp/signup",
|
|
112
|
+
params
|
|
113
|
+
);
|
|
114
|
+
return data;
|
|
111
115
|
});
|
|
112
116
|
}
|
|
113
117
|
login(params) {
|
|
114
118
|
return __async(this, null, function* () {
|
|
115
|
-
yield this.apiClient.post(
|
|
119
|
+
const data = yield this.apiClient.post(
|
|
120
|
+
"/auth/otp/login",
|
|
121
|
+
params
|
|
122
|
+
);
|
|
123
|
+
return data;
|
|
116
124
|
});
|
|
117
125
|
}
|
|
118
126
|
verify(token) {
|
|
119
127
|
return __async(this, null, function* () {
|
|
120
128
|
const data = yield this.apiClient.post(
|
|
121
|
-
"/auth/
|
|
129
|
+
"/auth/otp/verify",
|
|
122
130
|
{
|
|
123
131
|
token
|
|
124
132
|
}
|
|
@@ -132,7 +140,7 @@ var MagicLink = class {
|
|
|
132
140
|
var Auth = class {
|
|
133
141
|
constructor(apiKey, proxy) {
|
|
134
142
|
this.apiClient = createApiClient(apiKey, proxy);
|
|
135
|
-
this.
|
|
143
|
+
this.otp = new OTP(this.apiClient);
|
|
136
144
|
}
|
|
137
145
|
retrieveSession(id) {
|
|
138
146
|
return __async(this, null, function* () {
|
package/dist/index.mjs
CHANGED
|
@@ -63,25 +63,33 @@ var createApiClient = (apiKey, proxy) => {
|
|
|
63
63
|
return client;
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
// src/auth/providers/
|
|
67
|
-
var
|
|
66
|
+
// src/auth/providers/otp.ts
|
|
67
|
+
var OTP = class {
|
|
68
68
|
constructor(apiClient) {
|
|
69
69
|
this.apiClient = apiClient;
|
|
70
70
|
}
|
|
71
71
|
signup(params) {
|
|
72
72
|
return __async(this, null, function* () {
|
|
73
|
-
yield this.apiClient.post(
|
|
73
|
+
const data = yield this.apiClient.post(
|
|
74
|
+
"/auth/otp/signup",
|
|
75
|
+
params
|
|
76
|
+
);
|
|
77
|
+
return data;
|
|
74
78
|
});
|
|
75
79
|
}
|
|
76
80
|
login(params) {
|
|
77
81
|
return __async(this, null, function* () {
|
|
78
|
-
yield this.apiClient.post(
|
|
82
|
+
const data = yield this.apiClient.post(
|
|
83
|
+
"/auth/otp/login",
|
|
84
|
+
params
|
|
85
|
+
);
|
|
86
|
+
return data;
|
|
79
87
|
});
|
|
80
88
|
}
|
|
81
89
|
verify(token) {
|
|
82
90
|
return __async(this, null, function* () {
|
|
83
91
|
const data = yield this.apiClient.post(
|
|
84
|
-
"/auth/
|
|
92
|
+
"/auth/otp/verify",
|
|
85
93
|
{
|
|
86
94
|
token
|
|
87
95
|
}
|
|
@@ -95,7 +103,7 @@ var MagicLink = class {
|
|
|
95
103
|
var Auth = class {
|
|
96
104
|
constructor(apiKey, proxy) {
|
|
97
105
|
this.apiClient = createApiClient(apiKey, proxy);
|
|
98
|
-
this.
|
|
106
|
+
this.otp = new OTP(this.apiClient);
|
|
99
107
|
}
|
|
100
108
|
retrieveSession(id) {
|
|
101
109
|
return __async(this, null, function* () {
|