arky-sdk 0.5.83 → 0.5.84
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/index.cjs +32 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -3
- package/dist/index.d.ts +14 -3
- package/dist/index.js +32 -20
- package/dist/index.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +0 -2
- package/dist/types.d.ts +0 -2
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -238,26 +238,6 @@ var createAccountApi = (apiConfig) => {
|
|
|
238
238
|
// src/api/auth.ts
|
|
239
239
|
var createAuthApi = (apiConfig) => {
|
|
240
240
|
return {
|
|
241
|
-
async session(options) {
|
|
242
|
-
return apiConfig.httpClient.post("/v1/auth/session", {}, options);
|
|
243
|
-
},
|
|
244
|
-
async signInAnonymously(options) {
|
|
245
|
-
const tokens = await apiConfig.getToken();
|
|
246
|
-
if (tokens?.accessToken) {
|
|
247
|
-
return tokens;
|
|
248
|
-
}
|
|
249
|
-
const result = await apiConfig.httpClient.post("/v1/auth/session", {}, options);
|
|
250
|
-
if (result?.accessToken) {
|
|
251
|
-
apiConfig.setToken({ ...result, isGuest: true });
|
|
252
|
-
}
|
|
253
|
-
return result;
|
|
254
|
-
},
|
|
255
|
-
async isGuest() {
|
|
256
|
-
const tokens = await apiConfig.getToken();
|
|
257
|
-
if (!tokens?.accessToken) return true;
|
|
258
|
-
const email = tokens.email || "";
|
|
259
|
-
return !email || email.startsWith("guest+");
|
|
260
|
-
},
|
|
261
241
|
async code(params, options) {
|
|
262
242
|
return apiConfig.httpClient.post("/v1/auth/code", params, options);
|
|
263
243
|
},
|
|
@@ -1128,6 +1108,38 @@ var createLocationApi = (apiConfig) => {
|
|
|
1128
1108
|
// src/api/crm.ts
|
|
1129
1109
|
var createCustomerApi = (apiConfig) => {
|
|
1130
1110
|
return {
|
|
1111
|
+
// Auth methods
|
|
1112
|
+
async requestCode(params, options) {
|
|
1113
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
1114
|
+
return apiConfig.httpClient.post(
|
|
1115
|
+
`/v1/businesses/${businessId}/customers/auth/code`,
|
|
1116
|
+
{ email: params.email },
|
|
1117
|
+
options
|
|
1118
|
+
);
|
|
1119
|
+
},
|
|
1120
|
+
async verify(params, options) {
|
|
1121
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
1122
|
+
return apiConfig.httpClient.post(
|
|
1123
|
+
`/v1/businesses/${businessId}/customers/auth/verify`,
|
|
1124
|
+
{ email: params.email, code: params.code },
|
|
1125
|
+
options
|
|
1126
|
+
);
|
|
1127
|
+
},
|
|
1128
|
+
async refreshToken(params, options) {
|
|
1129
|
+
const businessId = params.businessId || apiConfig.businessId;
|
|
1130
|
+
return apiConfig.httpClient.post(
|
|
1131
|
+
`/v1/businesses/${businessId}/customers/auth/refresh`,
|
|
1132
|
+
{ refreshToken: params.refreshToken },
|
|
1133
|
+
options
|
|
1134
|
+
);
|
|
1135
|
+
},
|
|
1136
|
+
async getMe(options) {
|
|
1137
|
+
return apiConfig.httpClient.get(
|
|
1138
|
+
`/v1/businesses/${apiConfig.businessId}/customers/me`,
|
|
1139
|
+
options
|
|
1140
|
+
);
|
|
1141
|
+
},
|
|
1142
|
+
// CRUD methods
|
|
1131
1143
|
async create(params, options) {
|
|
1132
1144
|
return apiConfig.httpClient.post(
|
|
1133
1145
|
`/v1/businesses/${params.businessId || apiConfig.businessId}/customers`,
|