arky-sdk 0.3.151 → 0.3.152
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 +27 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -15
- package/dist/index.d.ts +9 -15
- package/dist/index.js +27 -67
- package/dist/index.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +13 -59
- package/dist/types.d.ts +13 -59
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Price, Payment,
|
|
1
|
+
import { Price, Payment, UpdateAccountProfileParams, RequestOptions, DeleteAccountParams, AddPhoneNumberParams, PhoneNumberConfirmParams, GetMeParams, SearchAccountsParams, SetRoleParams, LoginAccountParams, LogoutParams, MagicLinkRequestParams, MagicLinkVerifyParams, AccountSubscribeParams, CreateBusinessParams, UpdateBusinessParams, DeleteBusinessParams, GetBusinessParams, GetBusinessesParams, GetBusinessParentsParams, TriggerBuildsParams, GetSubscriptionPlansParams, GetSubscriptionParams, SubscribeParams, CreatePortalSessionParams, InviteUserParams, HandleInvitationParams, TestWebhookParams, GetBusinessMediaParams2, ProcessRefundParams, UploadBusinessMediaParams, DeleteBusinessMediaParams, GetBusinessMediaParams, UpdateMediaParams, CreateRoleParams, UpdateRoleParams, DeleteRoleParams, GetRoleParams, GetRolesParams, TrackEmailOpenParams, GetDeliveryStatsParams, CreatePromoCodeParams, UpdatePromoCodeParams, DeletePromoCodeParams, GetPromoCodeParams, GetPromoCodesParams, GetAnalyticsParams, CreateNodeParams, UpdateNodeParams, DeleteNodeParams, GetNodeParams, GetNodesParams, GetNodeChildrenParams, GenerateBlocksParams, GetVariableMetadataParams, CreateProductParams, UpdateProductParams, DeleteProductParams, GetProductParams, GetProductsParams, CreateOrderParams, UpdateOrderParams, GetOrderParams, GetOrdersParams, GetQuoteParams, OrderCheckoutParams, Slot, CreateReservationParams, UpdateReservationParams, ReservationCheckoutParams, GetReservationParams, SearchReservationsParams, GetReservationQuoteParams, CreateServiceParams, UpdateServiceParams, DeleteServiceParams, BulkScheduleParams, GetServiceParams, GetServicesParams, CreateProviderParams, UpdateProviderParams, DeleteProviderParams, GetProviderParams, GetProvidersParams, GetBusinessServiceWorkingTimeParams, CreateFeatureFlagParams, FeatureFlag, GetFeatureFlagParams, GetFeatureFlagsParams, UpdateFeatureFlagParams, DeleteFeatureFlagParams, GetFeatureFlagResultsParams, FlagResults, GetVariantParams, GetVariantResponse, TrackEventParams, TrackEventResponse, CreateWorkflowParams, UpdateWorkflowParams, DeleteWorkflowParams, GetWorkflowParams, GetWorkflowsParams, TriggerWorkflowParams } from './types.cjs';
|
|
2
2
|
export { ApiResponse, Block, Business, BusinessConfig, DayAvailability, EshopCartItem, EshopStoreState, GetAvailabilityParams, GetSlotsForDateParams, Language, Location, Market, Media, MediaResolution, Node, PaginatedResponse, PaymentMethod, PaymentMethodType, PaymentProviderConfig, PaymentRefund, PromoCodeValidation, ProviderWithTimeline, Quote, ReservationCartItem, ReservationStoreState, Seo, ShippingMethod, ShippingWeightTier, SystemTemplateKey, Workflow, WorkflowEdge, WorkflowHttpMethod, WorkflowHttpNode, WorkflowIfNode, WorkflowLoopNode, WorkflowNode, WorkflowTriggerNode, WorkflowWaitNode, Zone } from './types.cjs';
|
|
3
3
|
import { isValidKey, validateKey, toKey, nameToKey } from './utils.cjs';
|
|
4
4
|
|
|
@@ -189,23 +189,19 @@ declare function createArkySDK(config: HttpClientConfig & {
|
|
|
189
189
|
market: string;
|
|
190
190
|
locale?: string;
|
|
191
191
|
}): Promise<{
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
192
|
+
account: {
|
|
193
|
+
updateAccount(params: UpdateAccountProfileParams, options?: RequestOptions): Promise<any>;
|
|
194
|
+
deleteAccount(params: DeleteAccountParams, options?: RequestOptions): Promise<any>;
|
|
195
195
|
addPhoneNumber(params: AddPhoneNumberParams, options?: RequestOptions): Promise<any>;
|
|
196
196
|
phoneNumberConfirm(params: PhoneNumberConfirmParams, options?: RequestOptions): Promise<any>;
|
|
197
197
|
getMe(params: GetMeParams, options?: RequestOptions): Promise<any>;
|
|
198
|
-
|
|
198
|
+
searchAccounts(params: SearchAccountsParams, options?: RequestOptions): Promise<any>;
|
|
199
199
|
setRole(params: SetRoleParams, options?: RequestOptions): Promise<any>;
|
|
200
|
-
|
|
201
|
-
registerUser(params: RegisterUserParams, options?: RequestOptions): Promise<any>;
|
|
200
|
+
login(params: LoginAccountParams, options?: RequestOptions): Promise<any>;
|
|
202
201
|
logout(params: LogoutParams, options?: RequestOptions): Promise<any>;
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
resetForgotPassword(params: ResetForgotPasswordParams, options?: RequestOptions): Promise<any>;
|
|
207
|
-
resetPassword(params: ResetPasswordParams, options?: RequestOptions): Promise<any>;
|
|
208
|
-
subscribe(params: UserSubscribeParams, options?: RequestOptions): Promise<any>;
|
|
202
|
+
requestMagicLink(params: MagicLinkRequestParams, options?: RequestOptions): Promise<any>;
|
|
203
|
+
verifyMagicLink(params: MagicLinkVerifyParams, options?: RequestOptions): Promise<any>;
|
|
204
|
+
subscribe(params: AccountSubscribeParams, options?: RequestOptions): Promise<any>;
|
|
209
205
|
};
|
|
210
206
|
business: {
|
|
211
207
|
createBusiness(params: CreateBusinessParams, options?: RequestOptions): Promise<any>;
|
|
@@ -354,8 +350,6 @@ declare function createArkySDK(config: HttpClientConfig & {
|
|
|
354
350
|
getWorkflow(params: GetWorkflowParams, options?: RequestOptions): Promise<any>;
|
|
355
351
|
getWorkflows(params?: GetWorkflowsParams, options?: RequestOptions): Promise<any>;
|
|
356
352
|
triggerWorkflow(params: TriggerWorkflowParams, options?: RequestOptions): Promise<any>;
|
|
357
|
-
getWorkflowExecutions(params: GetWorkflowExecutionsParams, options?: RequestOptions): Promise<any>;
|
|
358
|
-
getWorkflowExecution(params: GetWorkflowExecutionParams, options?: RequestOptions): Promise<any>;
|
|
359
353
|
};
|
|
360
354
|
setBusinessId: (businessId: string) => void;
|
|
361
355
|
getBusinessId: () => string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Price, Payment,
|
|
1
|
+
import { Price, Payment, UpdateAccountProfileParams, RequestOptions, DeleteAccountParams, AddPhoneNumberParams, PhoneNumberConfirmParams, GetMeParams, SearchAccountsParams, SetRoleParams, LoginAccountParams, LogoutParams, MagicLinkRequestParams, MagicLinkVerifyParams, AccountSubscribeParams, CreateBusinessParams, UpdateBusinessParams, DeleteBusinessParams, GetBusinessParams, GetBusinessesParams, GetBusinessParentsParams, TriggerBuildsParams, GetSubscriptionPlansParams, GetSubscriptionParams, SubscribeParams, CreatePortalSessionParams, InviteUserParams, HandleInvitationParams, TestWebhookParams, GetBusinessMediaParams2, ProcessRefundParams, UploadBusinessMediaParams, DeleteBusinessMediaParams, GetBusinessMediaParams, UpdateMediaParams, CreateRoleParams, UpdateRoleParams, DeleteRoleParams, GetRoleParams, GetRolesParams, TrackEmailOpenParams, GetDeliveryStatsParams, CreatePromoCodeParams, UpdatePromoCodeParams, DeletePromoCodeParams, GetPromoCodeParams, GetPromoCodesParams, GetAnalyticsParams, CreateNodeParams, UpdateNodeParams, DeleteNodeParams, GetNodeParams, GetNodesParams, GetNodeChildrenParams, GenerateBlocksParams, GetVariableMetadataParams, CreateProductParams, UpdateProductParams, DeleteProductParams, GetProductParams, GetProductsParams, CreateOrderParams, UpdateOrderParams, GetOrderParams, GetOrdersParams, GetQuoteParams, OrderCheckoutParams, Slot, CreateReservationParams, UpdateReservationParams, ReservationCheckoutParams, GetReservationParams, SearchReservationsParams, GetReservationQuoteParams, CreateServiceParams, UpdateServiceParams, DeleteServiceParams, BulkScheduleParams, GetServiceParams, GetServicesParams, CreateProviderParams, UpdateProviderParams, DeleteProviderParams, GetProviderParams, GetProvidersParams, GetBusinessServiceWorkingTimeParams, CreateFeatureFlagParams, FeatureFlag, GetFeatureFlagParams, GetFeatureFlagsParams, UpdateFeatureFlagParams, DeleteFeatureFlagParams, GetFeatureFlagResultsParams, FlagResults, GetVariantParams, GetVariantResponse, TrackEventParams, TrackEventResponse, CreateWorkflowParams, UpdateWorkflowParams, DeleteWorkflowParams, GetWorkflowParams, GetWorkflowsParams, TriggerWorkflowParams } from './types.js';
|
|
2
2
|
export { ApiResponse, Block, Business, BusinessConfig, DayAvailability, EshopCartItem, EshopStoreState, GetAvailabilityParams, GetSlotsForDateParams, Language, Location, Market, Media, MediaResolution, Node, PaginatedResponse, PaymentMethod, PaymentMethodType, PaymentProviderConfig, PaymentRefund, PromoCodeValidation, ProviderWithTimeline, Quote, ReservationCartItem, ReservationStoreState, Seo, ShippingMethod, ShippingWeightTier, SystemTemplateKey, Workflow, WorkflowEdge, WorkflowHttpMethod, WorkflowHttpNode, WorkflowIfNode, WorkflowLoopNode, WorkflowNode, WorkflowTriggerNode, WorkflowWaitNode, Zone } from './types.js';
|
|
3
3
|
import { isValidKey, validateKey, toKey, nameToKey } from './utils.js';
|
|
4
4
|
|
|
@@ -189,23 +189,19 @@ declare function createArkySDK(config: HttpClientConfig & {
|
|
|
189
189
|
market: string;
|
|
190
190
|
locale?: string;
|
|
191
191
|
}): Promise<{
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
192
|
+
account: {
|
|
193
|
+
updateAccount(params: UpdateAccountProfileParams, options?: RequestOptions): Promise<any>;
|
|
194
|
+
deleteAccount(params: DeleteAccountParams, options?: RequestOptions): Promise<any>;
|
|
195
195
|
addPhoneNumber(params: AddPhoneNumberParams, options?: RequestOptions): Promise<any>;
|
|
196
196
|
phoneNumberConfirm(params: PhoneNumberConfirmParams, options?: RequestOptions): Promise<any>;
|
|
197
197
|
getMe(params: GetMeParams, options?: RequestOptions): Promise<any>;
|
|
198
|
-
|
|
198
|
+
searchAccounts(params: SearchAccountsParams, options?: RequestOptions): Promise<any>;
|
|
199
199
|
setRole(params: SetRoleParams, options?: RequestOptions): Promise<any>;
|
|
200
|
-
|
|
201
|
-
registerUser(params: RegisterUserParams, options?: RequestOptions): Promise<any>;
|
|
200
|
+
login(params: LoginAccountParams, options?: RequestOptions): Promise<any>;
|
|
202
201
|
logout(params: LogoutParams, options?: RequestOptions): Promise<any>;
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
resetForgotPassword(params: ResetForgotPasswordParams, options?: RequestOptions): Promise<any>;
|
|
207
|
-
resetPassword(params: ResetPasswordParams, options?: RequestOptions): Promise<any>;
|
|
208
|
-
subscribe(params: UserSubscribeParams, options?: RequestOptions): Promise<any>;
|
|
202
|
+
requestMagicLink(params: MagicLinkRequestParams, options?: RequestOptions): Promise<any>;
|
|
203
|
+
verifyMagicLink(params: MagicLinkVerifyParams, options?: RequestOptions): Promise<any>;
|
|
204
|
+
subscribe(params: AccountSubscribeParams, options?: RequestOptions): Promise<any>;
|
|
209
205
|
};
|
|
210
206
|
business: {
|
|
211
207
|
createBusiness(params: CreateBusinessParams, options?: RequestOptions): Promise<any>;
|
|
@@ -354,8 +350,6 @@ declare function createArkySDK(config: HttpClientConfig & {
|
|
|
354
350
|
getWorkflow(params: GetWorkflowParams, options?: RequestOptions): Promise<any>;
|
|
355
351
|
getWorkflows(params?: GetWorkflowsParams, options?: RequestOptions): Promise<any>;
|
|
356
352
|
triggerWorkflow(params: TriggerWorkflowParams, options?: RequestOptions): Promise<any>;
|
|
357
|
-
getWorkflowExecutions(params: GetWorkflowExecutionsParams, options?: RequestOptions): Promise<any>;
|
|
358
|
-
getWorkflowExecution(params: GetWorkflowExecutionParams, options?: RequestOptions): Promise<any>;
|
|
359
353
|
};
|
|
360
354
|
setBusinessId: (businessId: string) => void;
|
|
361
355
|
getBusinessId: () => string;
|
package/dist/index.js
CHANGED
|
@@ -44,7 +44,7 @@ function buildQueryString(params) {
|
|
|
44
44
|
|
|
45
45
|
// src/services/createHttpClient.ts
|
|
46
46
|
function createHttpClient(cfg) {
|
|
47
|
-
const refreshEndpoint = `${cfg.baseUrl}/v1/
|
|
47
|
+
const refreshEndpoint = `${cfg.baseUrl}/v1/accounts/refresh-access-token`;
|
|
48
48
|
let refreshPromise = null;
|
|
49
49
|
async function ensureFreshToken() {
|
|
50
50
|
if (refreshPromise) {
|
|
@@ -210,32 +210,31 @@ function createHttpClient(cfg) {
|
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
-
// src/api/
|
|
214
|
-
var
|
|
213
|
+
// src/api/account.ts
|
|
214
|
+
var createAccountApi = (apiConfig) => {
|
|
215
215
|
return {
|
|
216
|
-
// =====
|
|
217
|
-
async
|
|
216
|
+
// ===== ACCOUNT PROFILE =====
|
|
217
|
+
async updateAccount(params, options) {
|
|
218
218
|
const payload = {};
|
|
219
|
-
if (params.name !== void 0) payload.name = params.name;
|
|
220
219
|
if (params.phoneNumbers !== void 0) payload.phoneNumbers = params.phoneNumbers;
|
|
221
220
|
if (params.addresses !== void 0) payload.addresses = params.addresses;
|
|
222
221
|
if (params.apiTokens !== void 0) payload.apiTokens = params.apiTokens;
|
|
223
|
-
return apiConfig.httpClient.put("/v1/
|
|
222
|
+
return apiConfig.httpClient.put("/v1/accounts", payload, options);
|
|
224
223
|
},
|
|
225
|
-
async
|
|
226
|
-
return apiConfig.httpClient.delete("/v1/
|
|
224
|
+
async deleteAccount(params, options) {
|
|
225
|
+
return apiConfig.httpClient.delete("/v1/accounts", options);
|
|
227
226
|
},
|
|
228
227
|
async addPhoneNumber(params, options) {
|
|
229
|
-
return apiConfig.httpClient.post("/v1/
|
|
228
|
+
return apiConfig.httpClient.post("/v1/accounts/phone-number", params, options);
|
|
230
229
|
},
|
|
231
230
|
async phoneNumberConfirm(params, options) {
|
|
232
|
-
return apiConfig.httpClient.post("/v1/
|
|
231
|
+
return apiConfig.httpClient.post("/v1/accounts/phone-number/confirm", params, options);
|
|
233
232
|
},
|
|
234
233
|
async getMe(params, options) {
|
|
235
|
-
return apiConfig.httpClient.get("/v1/
|
|
234
|
+
return apiConfig.httpClient.get("/v1/accounts/me", options);
|
|
236
235
|
},
|
|
237
|
-
async
|
|
238
|
-
return apiConfig.httpClient.get("/v1/
|
|
236
|
+
async searchAccounts(params, options) {
|
|
237
|
+
return apiConfig.httpClient.get("/v1/accounts/search", {
|
|
239
238
|
...options,
|
|
240
239
|
params: {
|
|
241
240
|
...params,
|
|
@@ -244,39 +243,25 @@ var createUserApi = (apiConfig) => {
|
|
|
244
243
|
});
|
|
245
244
|
},
|
|
246
245
|
async setRole(params, options) {
|
|
247
|
-
return apiConfig.httpClient.put("/v1/
|
|
246
|
+
return apiConfig.httpClient.put("/v1/accounts/set-role", params, options);
|
|
248
247
|
},
|
|
249
248
|
// ===== AUTHENTICATION =====
|
|
250
|
-
async
|
|
251
|
-
return apiConfig.httpClient.post("/v1/
|
|
252
|
-
},
|
|
253
|
-
async registerUser(params, options) {
|
|
254
|
-
return apiConfig.httpClient.post("/v1/users/register", params, options);
|
|
249
|
+
async login(params, options) {
|
|
250
|
+
return apiConfig.httpClient.post("/v1/accounts/login", params, options);
|
|
255
251
|
},
|
|
256
252
|
async logout(params, options) {
|
|
257
|
-
return apiConfig.httpClient.post("/v1/
|
|
258
|
-
},
|
|
259
|
-
async confirmUser(params, options) {
|
|
260
|
-
return apiConfig.httpClient.put("/v1/users/confirm", params, options);
|
|
261
|
-
},
|
|
262
|
-
async getLoginUrl(params, options) {
|
|
263
|
-
return apiConfig.httpClient.get("/v1/users/login/url", {
|
|
264
|
-
...options,
|
|
265
|
-
params
|
|
266
|
-
});
|
|
253
|
+
return apiConfig.httpClient.post("/v1/accounts/logout", {}, options);
|
|
267
254
|
},
|
|
268
|
-
// =====
|
|
269
|
-
async
|
|
270
|
-
return apiConfig.httpClient.post("/v1/
|
|
255
|
+
// ===== MAGIC LINK =====
|
|
256
|
+
async requestMagicLink(params, options) {
|
|
257
|
+
return apiConfig.httpClient.post("/v1/accounts/magic-link/request", params, options);
|
|
271
258
|
},
|
|
272
|
-
async
|
|
273
|
-
return apiConfig.httpClient.post("/v1/
|
|
274
|
-
},
|
|
275
|
-
async resetPassword(params, options) {
|
|
276
|
-
return apiConfig.httpClient.post("/v1/users/reset-password", params, options);
|
|
259
|
+
async verifyMagicLink(params, options) {
|
|
260
|
+
return apiConfig.httpClient.post("/v1/accounts/magic-link/verify", params, options);
|
|
277
261
|
},
|
|
262
|
+
// ===== SUBSCRIPTION =====
|
|
278
263
|
async subscribe(params, options) {
|
|
279
|
-
return apiConfig.httpClient.post("/v1/
|
|
264
|
+
return apiConfig.httpClient.post("/v1/accounts/subscribe", params, options);
|
|
280
265
|
}
|
|
281
266
|
};
|
|
282
267
|
};
|
|
@@ -1522,31 +1507,6 @@ var createWorkflowApi = (apiConfig) => {
|
|
|
1522
1507
|
async triggerWorkflow(params, options) {
|
|
1523
1508
|
const { secret, ...input } = params;
|
|
1524
1509
|
return apiConfig.httpClient.post(`/v1/workflows/trigger/${secret}`, input, options);
|
|
1525
|
-
},
|
|
1526
|
-
/**
|
|
1527
|
-
* Get executions for a workflow
|
|
1528
|
-
*/
|
|
1529
|
-
async getWorkflowExecutions(params, options) {
|
|
1530
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
1531
|
-
const { workflowId, limit, cursor } = params;
|
|
1532
|
-
return apiConfig.httpClient.get(
|
|
1533
|
-
`/v1/businesses/${businessId}/workflows/${workflowId}/executions`,
|
|
1534
|
-
{
|
|
1535
|
-
...options,
|
|
1536
|
-
params: { limit, cursor }
|
|
1537
|
-
}
|
|
1538
|
-
);
|
|
1539
|
-
},
|
|
1540
|
-
/**
|
|
1541
|
-
* Get a specific workflow execution
|
|
1542
|
-
*/
|
|
1543
|
-
async getWorkflowExecution(params, options) {
|
|
1544
|
-
const businessId = params.businessId || apiConfig.businessId;
|
|
1545
|
-
const { workflowId, executionId } = params;
|
|
1546
|
-
return apiConfig.httpClient.get(
|
|
1547
|
-
`/v1/businesses/${businessId}/workflows/${workflowId}/executions/${executionId}`,
|
|
1548
|
-
options
|
|
1549
|
-
);
|
|
1550
1510
|
}
|
|
1551
1511
|
};
|
|
1552
1512
|
};
|
|
@@ -1957,13 +1917,13 @@ async function createArkySDK(config) {
|
|
|
1957
1917
|
setToken: config.setToken,
|
|
1958
1918
|
getToken: config.getToken
|
|
1959
1919
|
};
|
|
1960
|
-
const
|
|
1920
|
+
const accountApi = createAccountApi(apiConfig);
|
|
1961
1921
|
const autoGuest = config.autoGuest !== void 0 ? config.autoGuest : true;
|
|
1962
1922
|
if (autoGuest) {
|
|
1963
1923
|
try {
|
|
1964
1924
|
const tokens = await config.getToken();
|
|
1965
1925
|
if (!tokens.accessToken && !tokens.refreshToken) {
|
|
1966
|
-
const result = await httpClient.post("/v1/
|
|
1926
|
+
const result = await httpClient.post("/v1/accounts/login", {
|
|
1967
1927
|
provider: "GUEST"
|
|
1968
1928
|
});
|
|
1969
1929
|
const token = result.accessToken || result.token || "";
|
|
@@ -1975,7 +1935,7 @@ async function createArkySDK(config) {
|
|
|
1975
1935
|
}
|
|
1976
1936
|
}
|
|
1977
1937
|
const sdk = {
|
|
1978
|
-
|
|
1938
|
+
account: accountApi,
|
|
1979
1939
|
business: createBusinessApi(apiConfig),
|
|
1980
1940
|
media: createMediaApi(apiConfig),
|
|
1981
1941
|
role: createRoleApi(apiConfig),
|