arky-sdk 0.9.0 → 0.9.6
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/README.md +2 -2
- package/dist/{admin-CfHen7c5.d.cts → admin-DjYydKeB.d.ts} +477 -124
- package/dist/{admin-ru7pX5bd.d.ts → admin-DlL8mCxL.d.cts} +477 -124
- package/dist/admin.cjs +592 -202
- package/dist/admin.cjs.map +1 -1
- package/dist/admin.d.cts +3 -3
- package/dist/admin.d.ts +3 -3
- package/dist/admin.js +592 -202
- package/dist/admin.js.map +1 -1
- package/dist/api-BbBHcd4p.d.cts +3289 -0
- package/dist/api-BbBHcd4p.d.ts +3289 -0
- package/dist/{index-C5gikdBg.d.cts → index-CZxubTDA.d.ts} +1 -1
- package/dist/{index-MFMjlIfS.d.ts → index-nCF3Z6Af.d.cts} +1 -1
- package/dist/index.cjs +666 -319
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +666 -319
- package/dist/index.js.map +1 -1
- package/dist/storefront-store.cjs +149 -134
- package/dist/storefront-store.cjs.map +1 -1
- package/dist/storefront-store.d.cts +3 -3
- package/dist/storefront-store.d.ts +3 -3
- package/dist/storefront-store.js +149 -134
- package/dist/storefront-store.js.map +1 -1
- package/dist/storefront.cjs +149 -134
- package/dist/storefront.cjs.map +1 -1
- package/dist/storefront.d.cts +45 -102
- package/dist/storefront.d.ts +45 -102
- package/dist/storefront.js +149 -134
- package/dist/storefront.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +1 -2666
- package/dist/types.d.ts +1 -2666
- package/dist/types.js.map +1 -1
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.ts +2 -2
- package/package.json +3 -2
package/dist/admin.cjs
CHANGED
|
@@ -435,7 +435,7 @@ var createAuthApi = (apiConfig, updateSession) => {
|
|
|
435
435
|
};
|
|
436
436
|
|
|
437
437
|
// src/api/store.ts
|
|
438
|
-
var createStoreApi = (apiConfig,
|
|
438
|
+
var createStoreApi = (apiConfig, _updateSession) => {
|
|
439
439
|
return {
|
|
440
440
|
async createStore(params, options) {
|
|
441
441
|
return apiConfig.httpClient.post(`/v1/stores`, params, options);
|
|
@@ -485,10 +485,19 @@ var createStoreApi = (apiConfig, updateSession) => {
|
|
|
485
485
|
options
|
|
486
486
|
);
|
|
487
487
|
},
|
|
488
|
+
async addMember(params, options) {
|
|
489
|
+
const { store_id, ...payload } = params;
|
|
490
|
+
return apiConfig.httpClient.post(
|
|
491
|
+
`/v1/stores/${store_id || apiConfig.storeId}/members`,
|
|
492
|
+
payload,
|
|
493
|
+
options
|
|
494
|
+
);
|
|
495
|
+
},
|
|
488
496
|
async inviteUser(params, options) {
|
|
497
|
+
const { store_id, ...payload } = params;
|
|
489
498
|
return apiConfig.httpClient.post(
|
|
490
|
-
`/v1/stores/${apiConfig.storeId}/
|
|
491
|
-
|
|
499
|
+
`/v1/stores/${store_id || apiConfig.storeId}/members`,
|
|
500
|
+
payload,
|
|
492
501
|
options
|
|
493
502
|
);
|
|
494
503
|
},
|
|
@@ -498,22 +507,6 @@ var createStoreApi = (apiConfig, updateSession) => {
|
|
|
498
507
|
options
|
|
499
508
|
);
|
|
500
509
|
},
|
|
501
|
-
async handleInvitation(params, options) {
|
|
502
|
-
const { store_id, ...payload } = params;
|
|
503
|
-
const result = await apiConfig.httpClient.put(
|
|
504
|
-
`/v1/stores/${store_id || apiConfig.storeId}/invitation`,
|
|
505
|
-
payload,
|
|
506
|
-
options
|
|
507
|
-
);
|
|
508
|
-
if (params.action === "accept" && result?.auth?.access_token) {
|
|
509
|
-
updateSession(() => ({
|
|
510
|
-
access_token: result.auth.access_token,
|
|
511
|
-
refresh_token: result.auth.refresh_token,
|
|
512
|
-
access_expires_at: result.auth.access_expires_at
|
|
513
|
-
}));
|
|
514
|
-
}
|
|
515
|
-
return result;
|
|
516
|
-
},
|
|
517
510
|
async testWebhook(params, options) {
|
|
518
511
|
return apiConfig.httpClient.post(
|
|
519
512
|
`/v1/stores/${apiConfig.storeId}/webhooks/test`,
|
|
@@ -526,7 +519,7 @@ var createStoreApi = (apiConfig, updateSession) => {
|
|
|
526
519
|
limit: params.limit
|
|
527
520
|
};
|
|
528
521
|
if (params.cursor) queryParams.cursor = params.cursor;
|
|
529
|
-
if (params.ids && params.ids.length > 0) queryParams.ids = params.ids
|
|
522
|
+
if (params.ids && params.ids.length > 0) queryParams.ids = JSON.stringify(params.ids);
|
|
530
523
|
if (params.query) queryParams.query = params.query;
|
|
531
524
|
if (params.mime_type) queryParams.mime_type = params.mime_type;
|
|
532
525
|
if (params.sort_field) queryParams.sort_field = params.sort_field;
|
|
@@ -658,7 +651,7 @@ var createMediaApi = (apiConfig) => {
|
|
|
658
651
|
const url = `${apiConfig.baseUrl}/v1/stores/${target_store_id}/media`;
|
|
659
652
|
const queryParams = { limit: String(limit) };
|
|
660
653
|
if (cursor) queryParams.cursor = cursor;
|
|
661
|
-
if (ids && ids.length > 0) queryParams.ids =
|
|
654
|
+
if (ids && ids.length > 0) queryParams.ids = JSON.stringify(ids);
|
|
662
655
|
if (query) queryParams.query = query;
|
|
663
656
|
if (mime_type) queryParams.mime_type = mime_type;
|
|
664
657
|
if (sort_field) queryParams.sort_field = sort_field;
|
|
@@ -1278,7 +1271,7 @@ var createMarketApi = (apiConfig) => {
|
|
|
1278
1271
|
var createActivityAdminApi = (apiConfig) => ({
|
|
1279
1272
|
async timeline(params, options) {
|
|
1280
1273
|
const store_id = params.store_id || apiConfig.storeId;
|
|
1281
|
-
const queryParams = {
|
|
1274
|
+
const queryParams = { profile_id: params.profile_id };
|
|
1282
1275
|
if (params.limit !== void 0) queryParams.limit = params.limit;
|
|
1283
1276
|
if (params.cursor) queryParams.cursor = params.cursor;
|
|
1284
1277
|
return apiConfig.httpClient.get(
|
|
@@ -1289,7 +1282,7 @@ var createActivityAdminApi = (apiConfig) => ({
|
|
|
1289
1282
|
async find(params, options) {
|
|
1290
1283
|
const store_id = params.store_id || apiConfig.storeId;
|
|
1291
1284
|
const queryParams = {};
|
|
1292
|
-
if (params.
|
|
1285
|
+
if (params.profile_id) queryParams.profile_id = params.profile_id;
|
|
1293
1286
|
if (params.types && params.types.length > 0) queryParams.types = params.types;
|
|
1294
1287
|
if (params.from !== void 0) queryParams.from = params.from;
|
|
1295
1288
|
if (params.to !== void 0) queryParams.to = params.to;
|
|
@@ -1301,25 +1294,26 @@ var createActivityAdminApi = (apiConfig) => ({
|
|
|
1301
1294
|
);
|
|
1302
1295
|
}
|
|
1303
1296
|
});
|
|
1304
|
-
var
|
|
1297
|
+
var createProfileApi = (apiConfig) => {
|
|
1305
1298
|
return {
|
|
1306
1299
|
async create(params, options) {
|
|
1307
1300
|
const { store_id, ...payload } = params;
|
|
1308
1301
|
return apiConfig.httpClient.post(
|
|
1309
|
-
`/v1/stores/${store_id || apiConfig.storeId}/
|
|
1302
|
+
`/v1/stores/${store_id || apiConfig.storeId}/profiles`,
|
|
1310
1303
|
payload,
|
|
1311
1304
|
options
|
|
1312
1305
|
);
|
|
1313
1306
|
},
|
|
1314
1307
|
async get(params, options) {
|
|
1315
1308
|
return apiConfig.httpClient.get(
|
|
1316
|
-
`/v1/stores/${params.store_id || apiConfig.storeId}/
|
|
1309
|
+
`/v1/stores/${params.store_id || apiConfig.storeId}/profiles/${params.id}`,
|
|
1317
1310
|
options
|
|
1318
1311
|
);
|
|
1319
1312
|
},
|
|
1320
1313
|
async find(params, options) {
|
|
1321
1314
|
const store_id = params?.store_id || apiConfig.storeId;
|
|
1322
1315
|
const queryParams = {};
|
|
1316
|
+
if (params?.ids && params.ids.length > 0) queryParams.ids = JSON.stringify(params.ids);
|
|
1323
1317
|
if (params?.limit !== void 0) queryParams.limit = params.limit;
|
|
1324
1318
|
if (params?.cursor) queryParams.cursor = params.cursor;
|
|
1325
1319
|
if (params?.query) queryParams.query = params.query;
|
|
@@ -1330,7 +1324,7 @@ var createCustomerApi = (apiConfig) => {
|
|
|
1330
1324
|
if (params?.sort_field) queryParams.sort_field = params.sort_field;
|
|
1331
1325
|
if (params?.sort_direction) queryParams.sort_direction = params.sort_direction;
|
|
1332
1326
|
return apiConfig.httpClient.get(
|
|
1333
|
-
`/v1/stores/${store_id}/
|
|
1327
|
+
`/v1/stores/${store_id}/profiles`,
|
|
1334
1328
|
{
|
|
1335
1329
|
...options,
|
|
1336
1330
|
params: queryParams
|
|
@@ -1340,7 +1334,7 @@ var createCustomerApi = (apiConfig) => {
|
|
|
1340
1334
|
async update(params, options) {
|
|
1341
1335
|
const { id, store_id, ...body } = params;
|
|
1342
1336
|
return apiConfig.httpClient.put(
|
|
1343
|
-
`/v1/stores/${store_id || apiConfig.storeId}/
|
|
1337
|
+
`/v1/stores/${store_id || apiConfig.storeId}/profiles/${id}`,
|
|
1344
1338
|
body,
|
|
1345
1339
|
options
|
|
1346
1340
|
);
|
|
@@ -1348,87 +1342,574 @@ var createCustomerApi = (apiConfig) => {
|
|
|
1348
1342
|
async merge(params, options) {
|
|
1349
1343
|
const store_id = params.store_id || apiConfig.storeId;
|
|
1350
1344
|
return apiConfig.httpClient.post(
|
|
1351
|
-
`/v1/stores/${store_id}/
|
|
1345
|
+
`/v1/stores/${store_id}/profiles/${params.target_id}/merge`,
|
|
1352
1346
|
{ source_id: params.source_id, store_id },
|
|
1353
1347
|
options
|
|
1354
1348
|
);
|
|
1355
1349
|
},
|
|
1350
|
+
"import": async (params, options) => {
|
|
1351
|
+
const { store_id, ...payload } = params;
|
|
1352
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1353
|
+
return apiConfig.httpClient.post(
|
|
1354
|
+
`/v1/stores/${target_store_id}/profiles/import`,
|
|
1355
|
+
payload,
|
|
1356
|
+
options
|
|
1357
|
+
);
|
|
1358
|
+
},
|
|
1359
|
+
previewImport: async (params, options) => {
|
|
1360
|
+
const { store_id, ...payload } = params;
|
|
1361
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1362
|
+
return apiConfig.httpClient.post(
|
|
1363
|
+
`/v1/stores/${target_store_id}/profiles/import/preview`,
|
|
1364
|
+
payload,
|
|
1365
|
+
options
|
|
1366
|
+
);
|
|
1367
|
+
},
|
|
1356
1368
|
async revokeToken(params, options) {
|
|
1357
1369
|
const store_id = params.store_id || apiConfig.storeId;
|
|
1358
1370
|
return apiConfig.httpClient.delete(
|
|
1359
|
-
`/v1/stores/${store_id}/
|
|
1371
|
+
`/v1/stores/${store_id}/profiles/${params.id}/sessions/${params.token_id}`,
|
|
1360
1372
|
options
|
|
1361
1373
|
);
|
|
1362
1374
|
},
|
|
1363
1375
|
async revokeAllTokens(params, options) {
|
|
1364
1376
|
const store_id = params.store_id || apiConfig.storeId;
|
|
1365
1377
|
return apiConfig.httpClient.delete(
|
|
1366
|
-
`/v1/stores/${store_id}/
|
|
1378
|
+
`/v1/stores/${store_id}/profiles/${params.id}/sessions`,
|
|
1367
1379
|
options
|
|
1368
1380
|
);
|
|
1369
1381
|
},
|
|
1370
|
-
|
|
1382
|
+
profileList: {
|
|
1371
1383
|
async create(params, options) {
|
|
1384
|
+
const { store_id, ...payload } = params;
|
|
1385
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1372
1386
|
return apiConfig.httpClient.post(
|
|
1373
|
-
`/v1/stores/${
|
|
1374
|
-
|
|
1387
|
+
`/v1/stores/${target_store_id}/profile-lists`,
|
|
1388
|
+
payload,
|
|
1375
1389
|
options
|
|
1376
1390
|
);
|
|
1377
1391
|
},
|
|
1378
1392
|
async update(params, options) {
|
|
1393
|
+
const { id, store_id, ...payload } = params;
|
|
1394
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1379
1395
|
return apiConfig.httpClient.put(
|
|
1380
|
-
`/v1/stores/${
|
|
1381
|
-
|
|
1396
|
+
`/v1/stores/${target_store_id}/profile-lists/${id}`,
|
|
1397
|
+
payload,
|
|
1382
1398
|
options
|
|
1383
1399
|
);
|
|
1384
1400
|
},
|
|
1385
1401
|
async get(params, options) {
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1402
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1403
|
+
return apiConfig.httpClient.get(
|
|
1404
|
+
`/v1/stores/${target_store_id}/profile-lists/${params.id}`,
|
|
1405
|
+
options
|
|
1406
|
+
);
|
|
1407
|
+
},
|
|
1408
|
+
async find(params, options) {
|
|
1409
|
+
const { store_id, ...queryParams } = params || {};
|
|
1410
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1411
|
+
return apiConfig.httpClient.get(
|
|
1412
|
+
`/v1/stores/${target_store_id}/profile-lists`,
|
|
1413
|
+
{ ...options, params: queryParams }
|
|
1414
|
+
);
|
|
1415
|
+
},
|
|
1416
|
+
async importProfiles(params, options) {
|
|
1417
|
+
const { store_id, profile_list_id, ...payload } = params;
|
|
1418
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1419
|
+
return apiConfig.httpClient.post(
|
|
1420
|
+
`/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/profiles/import`,
|
|
1421
|
+
payload,
|
|
1422
|
+
options
|
|
1423
|
+
);
|
|
1424
|
+
},
|
|
1425
|
+
async previewImportProfiles(params, options) {
|
|
1426
|
+
const { store_id, profile_list_id, ...payload } = params;
|
|
1427
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1428
|
+
return apiConfig.httpClient.post(
|
|
1429
|
+
`/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/profiles/import/preview`,
|
|
1430
|
+
payload,
|
|
1431
|
+
options
|
|
1432
|
+
);
|
|
1433
|
+
},
|
|
1434
|
+
members: {
|
|
1435
|
+
async add(params, options) {
|
|
1436
|
+
const { store_id, profile_list_id, profile_id, fields, lead_description } = params;
|
|
1437
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1438
|
+
return apiConfig.httpClient.post(
|
|
1439
|
+
`/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/members/${profile_id}`,
|
|
1440
|
+
{ fields, lead_description },
|
|
1441
|
+
options
|
|
1442
|
+
);
|
|
1443
|
+
},
|
|
1444
|
+
async update(params, options) {
|
|
1445
|
+
const { store_id, profile_list_id, profile_id, status, fields, lead_description } = params;
|
|
1446
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1447
|
+
return apiConfig.httpClient.patch(
|
|
1448
|
+
`/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/members/${profile_id}`,
|
|
1449
|
+
{ status, fields, lead_description },
|
|
1450
|
+
options
|
|
1451
|
+
);
|
|
1452
|
+
},
|
|
1453
|
+
async remove(params, options) {
|
|
1454
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1455
|
+
return apiConfig.httpClient.delete(
|
|
1456
|
+
`/v1/stores/${target_store_id}/profile-lists/${params.profile_list_id}/members/${params.profile_id}`,
|
|
1457
|
+
options
|
|
1458
|
+
);
|
|
1459
|
+
},
|
|
1460
|
+
async find(params, options) {
|
|
1461
|
+
const { store_id, profile_list_id, ...queryParams } = params;
|
|
1462
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1463
|
+
const path = profile_list_id ? `/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/members` : `/v1/stores/${target_store_id}/profile-list-members`;
|
|
1464
|
+
return apiConfig.httpClient.get(
|
|
1465
|
+
path,
|
|
1466
|
+
{ ...options, params: queryParams }
|
|
1467
|
+
);
|
|
1393
1468
|
}
|
|
1469
|
+
},
|
|
1470
|
+
profiles: {
|
|
1471
|
+
async add(params, options) {
|
|
1472
|
+
const { store_id, profile_list_id, profile_id, fields, lead_description } = params;
|
|
1473
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1474
|
+
return apiConfig.httpClient.post(
|
|
1475
|
+
`/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/members/${profile_id}`,
|
|
1476
|
+
{ fields, lead_description },
|
|
1477
|
+
options
|
|
1478
|
+
);
|
|
1479
|
+
},
|
|
1480
|
+
async update(params, options) {
|
|
1481
|
+
const { store_id, profile_list_id, profile_id, status, fields, lead_description } = params;
|
|
1482
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1483
|
+
return apiConfig.httpClient.patch(
|
|
1484
|
+
`/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/members/${profile_id}`,
|
|
1485
|
+
{ status, fields, lead_description },
|
|
1486
|
+
options
|
|
1487
|
+
);
|
|
1488
|
+
},
|
|
1489
|
+
async remove(params, options) {
|
|
1490
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1491
|
+
return apiConfig.httpClient.delete(
|
|
1492
|
+
`/v1/stores/${target_store_id}/profile-lists/${params.profile_list_id}/members/${params.profile_id}`,
|
|
1493
|
+
options
|
|
1494
|
+
);
|
|
1495
|
+
},
|
|
1496
|
+
async find(params, options) {
|
|
1497
|
+
const { store_id, profile_list_id, ...queryParams } = params;
|
|
1498
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1499
|
+
const path = profile_list_id ? `/v1/stores/${target_store_id}/profile-lists/${profile_list_id}/members` : `/v1/stores/${target_store_id}/profile-list-members`;
|
|
1500
|
+
return apiConfig.httpClient.get(
|
|
1501
|
+
path,
|
|
1502
|
+
{ ...options, params: queryParams }
|
|
1503
|
+
);
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
},
|
|
1507
|
+
mailbox: {
|
|
1508
|
+
async create(params, options) {
|
|
1509
|
+
const { store_id, ...payload } = params;
|
|
1510
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1511
|
+
return apiConfig.httpClient.post(
|
|
1512
|
+
`/v1/stores/${target_store_id}/mailboxes`,
|
|
1513
|
+
payload,
|
|
1514
|
+
options
|
|
1515
|
+
);
|
|
1516
|
+
},
|
|
1517
|
+
async update(params, options) {
|
|
1518
|
+
const { id, store_id, ...payload } = params;
|
|
1519
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1520
|
+
return apiConfig.httpClient.put(
|
|
1521
|
+
`/v1/stores/${target_store_id}/mailboxes/${id}`,
|
|
1522
|
+
payload,
|
|
1523
|
+
options
|
|
1524
|
+
);
|
|
1525
|
+
},
|
|
1526
|
+
async get(params, options) {
|
|
1527
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1528
|
+
return apiConfig.httpClient.get(
|
|
1529
|
+
`/v1/stores/${target_store_id}/mailboxes/${params.id}`,
|
|
1530
|
+
options
|
|
1531
|
+
);
|
|
1532
|
+
},
|
|
1533
|
+
async test(params, options) {
|
|
1534
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1535
|
+
return apiConfig.httpClient.post(
|
|
1536
|
+
`/v1/stores/${target_store_id}/mailboxes/${params.id}/test`,
|
|
1537
|
+
{},
|
|
1538
|
+
options
|
|
1539
|
+
);
|
|
1540
|
+
},
|
|
1541
|
+
async prepare(params, options) {
|
|
1542
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1543
|
+
return apiConfig.httpClient.post(
|
|
1544
|
+
`/v1/stores/${target_store_id}/mailboxes/${params.id}/prepare`,
|
|
1545
|
+
{},
|
|
1546
|
+
options
|
|
1547
|
+
);
|
|
1548
|
+
},
|
|
1549
|
+
async find(params, options) {
|
|
1550
|
+
const { store_id, ...queryParams } = params || {};
|
|
1551
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1552
|
+
return apiConfig.httpClient.get(
|
|
1553
|
+
`/v1/stores/${target_store_id}/mailboxes`,
|
|
1554
|
+
{ ...options, params: queryParams }
|
|
1555
|
+
);
|
|
1556
|
+
}
|
|
1557
|
+
},
|
|
1558
|
+
campaign: {
|
|
1559
|
+
async create(params, options) {
|
|
1560
|
+
const { store_id, ...payload } = params;
|
|
1561
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1562
|
+
return apiConfig.httpClient.post(
|
|
1563
|
+
`/v1/stores/${target_store_id}/campaigns`,
|
|
1564
|
+
payload,
|
|
1565
|
+
options
|
|
1566
|
+
);
|
|
1567
|
+
},
|
|
1568
|
+
async update(params, options) {
|
|
1569
|
+
const { id, store_id, ...payload } = params;
|
|
1570
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1571
|
+
return apiConfig.httpClient.put(
|
|
1572
|
+
`/v1/stores/${target_store_id}/campaigns/${id}`,
|
|
1573
|
+
payload,
|
|
1574
|
+
options
|
|
1575
|
+
);
|
|
1576
|
+
},
|
|
1577
|
+
async get(params, options) {
|
|
1578
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1579
|
+
return apiConfig.httpClient.get(
|
|
1580
|
+
`/v1/stores/${target_store_id}/campaigns/${params.id}`,
|
|
1581
|
+
options
|
|
1582
|
+
);
|
|
1583
|
+
},
|
|
1584
|
+
async find(params, options) {
|
|
1585
|
+
const { store_id, ...queryParams } = params || {};
|
|
1586
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1587
|
+
return apiConfig.httpClient.get(
|
|
1588
|
+
`/v1/stores/${target_store_id}/campaigns`,
|
|
1589
|
+
{ ...options, params: queryParams }
|
|
1590
|
+
);
|
|
1591
|
+
},
|
|
1592
|
+
async launch(params, options) {
|
|
1593
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1594
|
+
return apiConfig.httpClient.post(
|
|
1595
|
+
`/v1/stores/${target_store_id}/campaigns/${params.id}/launch`,
|
|
1596
|
+
{},
|
|
1597
|
+
options
|
|
1598
|
+
);
|
|
1599
|
+
},
|
|
1600
|
+
async duplicate(params, options) {
|
|
1601
|
+
const { id, store_id, ...payload } = params;
|
|
1602
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1603
|
+
return apiConfig.httpClient.post(
|
|
1604
|
+
`/v1/stores/${target_store_id}/campaigns/${id}/duplicate`,
|
|
1605
|
+
payload,
|
|
1606
|
+
options
|
|
1607
|
+
);
|
|
1608
|
+
},
|
|
1609
|
+
async launchReadiness(params, options) {
|
|
1610
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1394
1611
|
return apiConfig.httpClient.get(
|
|
1395
|
-
`/v1/stores/${
|
|
1612
|
+
`/v1/stores/${target_store_id}/campaigns/${params.id}/launch-readiness`,
|
|
1396
1613
|
options
|
|
1397
1614
|
);
|
|
1398
1615
|
},
|
|
1616
|
+
async importRecipients(params, options) {
|
|
1617
|
+
const { id, store_id, ...payload } = params;
|
|
1618
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1619
|
+
return apiConfig.httpClient.post(
|
|
1620
|
+
`/v1/stores/${target_store_id}/campaigns/${id}/recipients/import`,
|
|
1621
|
+
payload,
|
|
1622
|
+
options
|
|
1623
|
+
);
|
|
1624
|
+
},
|
|
1625
|
+
async generatePersonalizedDrafts(params, options) {
|
|
1626
|
+
const { id, store_id, ...payload } = params;
|
|
1627
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1628
|
+
return apiConfig.httpClient.post(
|
|
1629
|
+
`/v1/stores/${target_store_id}/campaigns/${id}/personalized-drafts`,
|
|
1630
|
+
payload,
|
|
1631
|
+
options
|
|
1632
|
+
);
|
|
1633
|
+
}
|
|
1634
|
+
},
|
|
1635
|
+
campaignRecipient: {
|
|
1399
1636
|
async find(params, options) {
|
|
1637
|
+
const { store_id, ...queryParams } = params || {};
|
|
1638
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1639
|
+
return apiConfig.httpClient.get(
|
|
1640
|
+
`/v1/stores/${target_store_id}/campaign-recipients`,
|
|
1641
|
+
{ ...options, params: queryParams }
|
|
1642
|
+
);
|
|
1643
|
+
},
|
|
1644
|
+
async get(params, options) {
|
|
1645
|
+
const { store_id, id, ...queryParams } = params;
|
|
1646
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1400
1647
|
return apiConfig.httpClient.get(
|
|
1401
|
-
`/v1/stores/${
|
|
1402
|
-
{ ...options, params }
|
|
1648
|
+
`/v1/stores/${target_store_id}/campaign-recipients/${id}`,
|
|
1649
|
+
{ ...options, params: { ...queryParams, store_id: target_store_id } }
|
|
1403
1650
|
);
|
|
1404
1651
|
},
|
|
1405
|
-
async
|
|
1652
|
+
async update(params, options) {
|
|
1653
|
+
const { store_id, id, ...payload } = params;
|
|
1654
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1655
|
+
return apiConfig.httpClient.put(
|
|
1656
|
+
`/v1/stores/${target_store_id}/campaign-recipients/${id}`,
|
|
1657
|
+
payload,
|
|
1658
|
+
options
|
|
1659
|
+
);
|
|
1660
|
+
},
|
|
1661
|
+
async updateDraft(params, options) {
|
|
1662
|
+
const { store_id, id, draft_id, ...payload } = params;
|
|
1663
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1664
|
+
return apiConfig.httpClient.put(
|
|
1665
|
+
`/v1/stores/${target_store_id}/campaign-recipients/${id}/drafts/${draft_id}`,
|
|
1666
|
+
payload,
|
|
1667
|
+
options
|
|
1668
|
+
);
|
|
1669
|
+
},
|
|
1670
|
+
async reply(params, options) {
|
|
1671
|
+
const { store_id, id, ...payload } = params;
|
|
1672
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1673
|
+
return apiConfig.httpClient.post(
|
|
1674
|
+
`/v1/stores/${target_store_id}/campaign-recipients/${id}/reply`,
|
|
1675
|
+
payload,
|
|
1676
|
+
options
|
|
1677
|
+
);
|
|
1678
|
+
},
|
|
1679
|
+
async stop(params, options) {
|
|
1680
|
+
const { store_id, id, ...payload } = params;
|
|
1681
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1682
|
+
return apiConfig.httpClient.post(
|
|
1683
|
+
`/v1/stores/${target_store_id}/campaign-recipients/${id}/stop`,
|
|
1684
|
+
payload,
|
|
1685
|
+
options
|
|
1686
|
+
);
|
|
1687
|
+
}
|
|
1688
|
+
},
|
|
1689
|
+
campaignMessage: {
|
|
1690
|
+
async find(params, options) {
|
|
1691
|
+
const { store_id, ...queryParams } = params || {};
|
|
1692
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1406
1693
|
return apiConfig.httpClient.get(
|
|
1407
|
-
`/v1/stores/${
|
|
1408
|
-
{
|
|
1409
|
-
...options,
|
|
1410
|
-
params: { limit: params.limit, cursor: params.cursor }
|
|
1411
|
-
}
|
|
1694
|
+
`/v1/stores/${target_store_id}/campaign-messages`,
|
|
1695
|
+
{ ...options, params: queryParams }
|
|
1412
1696
|
);
|
|
1413
1697
|
},
|
|
1414
|
-
async
|
|
1698
|
+
async update(params, options) {
|
|
1699
|
+
const { id, store_id, ...payload } = params;
|
|
1700
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1701
|
+
return apiConfig.httpClient.put(
|
|
1702
|
+
`/v1/stores/${target_store_id}/campaign-messages/${id}`,
|
|
1703
|
+
payload,
|
|
1704
|
+
options
|
|
1705
|
+
);
|
|
1706
|
+
}
|
|
1707
|
+
},
|
|
1708
|
+
suppression: {
|
|
1709
|
+
async create(params, options) {
|
|
1710
|
+
const { store_id, ...payload } = params;
|
|
1711
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1415
1712
|
return apiConfig.httpClient.post(
|
|
1416
|
-
`/v1/stores/${
|
|
1417
|
-
|
|
1713
|
+
`/v1/stores/${target_store_id}/suppressions`,
|
|
1714
|
+
payload,
|
|
1418
1715
|
options
|
|
1419
1716
|
);
|
|
1420
1717
|
},
|
|
1421
|
-
async
|
|
1422
|
-
|
|
1423
|
-
|
|
1718
|
+
async update(params, options) {
|
|
1719
|
+
const { id, store_id, ...payload } = params;
|
|
1720
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1721
|
+
return apiConfig.httpClient.put(
|
|
1722
|
+
`/v1/stores/${target_store_id}/suppressions/${id}`,
|
|
1723
|
+
payload,
|
|
1424
1724
|
options
|
|
1425
1725
|
);
|
|
1726
|
+
},
|
|
1727
|
+
async get(params, options) {
|
|
1728
|
+
const target_store_id = params.store_id || apiConfig.storeId;
|
|
1729
|
+
return apiConfig.httpClient.get(
|
|
1730
|
+
`/v1/stores/${target_store_id}/suppressions/${params.id}`,
|
|
1731
|
+
options
|
|
1732
|
+
);
|
|
1733
|
+
},
|
|
1734
|
+
async find(params, options) {
|
|
1735
|
+
const { store_id, ...queryParams } = params || {};
|
|
1736
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
1737
|
+
return apiConfig.httpClient.get(
|
|
1738
|
+
`/v1/stores/${target_store_id}/suppressions`,
|
|
1739
|
+
{ ...options, params: queryParams }
|
|
1740
|
+
);
|
|
1426
1741
|
}
|
|
1427
1742
|
},
|
|
1428
1743
|
activity: createActivityAdminApi(apiConfig)
|
|
1429
1744
|
};
|
|
1430
1745
|
};
|
|
1431
1746
|
|
|
1747
|
+
// src/api/support.ts
|
|
1748
|
+
function supportConversationQuery(params) {
|
|
1749
|
+
const qs = new URLSearchParams({ store_id: params.store_id });
|
|
1750
|
+
if (params.message_limit) qs.set("message_limit", String(params.message_limit));
|
|
1751
|
+
if (typeof params.after_created_at === "number") qs.set("after_created_at", String(params.after_created_at));
|
|
1752
|
+
if (params.after_id) qs.set("after_id", params.after_id);
|
|
1753
|
+
return qs.toString();
|
|
1754
|
+
}
|
|
1755
|
+
function createAdminSupportApi(config) {
|
|
1756
|
+
const { httpClient } = config;
|
|
1757
|
+
return {
|
|
1758
|
+
agent: {
|
|
1759
|
+
async create(params, opts) {
|
|
1760
|
+
return httpClient.post(
|
|
1761
|
+
`/v1/stores/${params.store_id}/support/agents`,
|
|
1762
|
+
params,
|
|
1763
|
+
opts
|
|
1764
|
+
);
|
|
1765
|
+
},
|
|
1766
|
+
async get(params, opts) {
|
|
1767
|
+
return httpClient.get(
|
|
1768
|
+
`/v1/stores/${params.store_id}/support/agents/${params.id}?store_id=${params.store_id}`,
|
|
1769
|
+
opts
|
|
1770
|
+
);
|
|
1771
|
+
},
|
|
1772
|
+
async find(params, opts) {
|
|
1773
|
+
const qs = new URLSearchParams({ store_id: params.store_id });
|
|
1774
|
+
if (params.status) qs.set("status", params.status);
|
|
1775
|
+
if (params.limit) qs.set("limit", String(params.limit));
|
|
1776
|
+
if (params.cursor) qs.set("cursor", params.cursor);
|
|
1777
|
+
return httpClient.get(
|
|
1778
|
+
`/v1/stores/${params.store_id}/support/agents?${qs}`,
|
|
1779
|
+
opts
|
|
1780
|
+
);
|
|
1781
|
+
},
|
|
1782
|
+
async update(params, opts) {
|
|
1783
|
+
return httpClient.put(
|
|
1784
|
+
`/v1/stores/${params.store_id}/support/agents/${params.id}`,
|
|
1785
|
+
params,
|
|
1786
|
+
opts
|
|
1787
|
+
);
|
|
1788
|
+
},
|
|
1789
|
+
async delete(params, opts) {
|
|
1790
|
+
return httpClient.delete(
|
|
1791
|
+
`/v1/stores/${params.store_id}/support/agents/${params.id}?store_id=${params.store_id}`,
|
|
1792
|
+
opts
|
|
1793
|
+
);
|
|
1794
|
+
}
|
|
1795
|
+
},
|
|
1796
|
+
conversation: {
|
|
1797
|
+
async find(params, opts) {
|
|
1798
|
+
const qs = new URLSearchParams({ store_id: params.store_id });
|
|
1799
|
+
if (params.status) qs.set("status", params.status);
|
|
1800
|
+
if (params.agent_id) qs.set("agent_id", params.agent_id);
|
|
1801
|
+
if (params.limit) qs.set("limit", String(params.limit));
|
|
1802
|
+
if (params.cursor) qs.set("cursor", params.cursor);
|
|
1803
|
+
return httpClient.get(
|
|
1804
|
+
`/v1/stores/${params.store_id}/support/conversations?${qs}`,
|
|
1805
|
+
opts
|
|
1806
|
+
);
|
|
1807
|
+
},
|
|
1808
|
+
async get(params, opts) {
|
|
1809
|
+
const qs = supportConversationQuery(params);
|
|
1810
|
+
return httpClient.get(
|
|
1811
|
+
`/v1/stores/${params.store_id}/support/conversations/${params.conversation_id}?${qs}`,
|
|
1812
|
+
opts
|
|
1813
|
+
);
|
|
1814
|
+
},
|
|
1815
|
+
async sendMessage(params, opts) {
|
|
1816
|
+
return httpClient.post(
|
|
1817
|
+
`/v1/stores/${params.store_id}/support/conversations/${params.conversation_id}/messages`,
|
|
1818
|
+
params,
|
|
1819
|
+
opts
|
|
1820
|
+
);
|
|
1821
|
+
},
|
|
1822
|
+
async reply(params, opts) {
|
|
1823
|
+
return httpClient.post(
|
|
1824
|
+
`/v1/stores/${params.store_id}/support/conversations/${params.conversation_id}/reply`,
|
|
1825
|
+
params,
|
|
1826
|
+
opts
|
|
1827
|
+
);
|
|
1828
|
+
},
|
|
1829
|
+
async resolve(params, opts) {
|
|
1830
|
+
return httpClient.post(
|
|
1831
|
+
`/v1/stores/${params.store_id}/support/conversations/${params.conversation_id}/resolve`,
|
|
1832
|
+
params,
|
|
1833
|
+
opts
|
|
1834
|
+
);
|
|
1835
|
+
},
|
|
1836
|
+
async assign(params, opts) {
|
|
1837
|
+
return httpClient.post(
|
|
1838
|
+
`/v1/stores/${params.store_id}/support/conversations/${params.conversation_id}/assign`,
|
|
1839
|
+
params,
|
|
1840
|
+
opts
|
|
1841
|
+
);
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
};
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
// src/api/leadResearch.ts
|
|
1848
|
+
var createLeadResearchApi = (apiConfig) => {
|
|
1849
|
+
const storeId = (store_id) => store_id || apiConfig.storeId;
|
|
1850
|
+
return {
|
|
1851
|
+
async createRun(params, options) {
|
|
1852
|
+
const { store_id, ...payload } = params;
|
|
1853
|
+
return apiConfig.httpClient.post(
|
|
1854
|
+
`/v1/stores/${storeId(store_id)}/lead-research/runs`,
|
|
1855
|
+
payload,
|
|
1856
|
+
options
|
|
1857
|
+
);
|
|
1858
|
+
},
|
|
1859
|
+
async findRuns(params, options) {
|
|
1860
|
+
const { store_id, ...queryParams } = params || {};
|
|
1861
|
+
return apiConfig.httpClient.get(
|
|
1862
|
+
`/v1/stores/${storeId(store_id)}/lead-research/runs`,
|
|
1863
|
+
{ ...options, params: queryParams }
|
|
1864
|
+
);
|
|
1865
|
+
},
|
|
1866
|
+
async getRun(params, options) {
|
|
1867
|
+
return apiConfig.httpClient.get(
|
|
1868
|
+
`/v1/stores/${storeId(params.store_id)}/lead-research/runs/${params.id}`,
|
|
1869
|
+
options
|
|
1870
|
+
);
|
|
1871
|
+
},
|
|
1872
|
+
async updateRun(params, options) {
|
|
1873
|
+
const { store_id, id, ...payload } = params;
|
|
1874
|
+
return apiConfig.httpClient.patch(
|
|
1875
|
+
`/v1/stores/${storeId(store_id)}/lead-research/runs/${id}`,
|
|
1876
|
+
payload,
|
|
1877
|
+
options
|
|
1878
|
+
);
|
|
1879
|
+
},
|
|
1880
|
+
async cancelRun(params, options) {
|
|
1881
|
+
return apiConfig.httpClient.post(
|
|
1882
|
+
`/v1/stores/${storeId(params.store_id)}/lead-research/runs/${params.id}/cancel`,
|
|
1883
|
+
{},
|
|
1884
|
+
options
|
|
1885
|
+
);
|
|
1886
|
+
},
|
|
1887
|
+
async sendMessage(params, options) {
|
|
1888
|
+
const { store_id, run_id, ...payload } = params;
|
|
1889
|
+
return apiConfig.httpClient.post(
|
|
1890
|
+
`/v1/stores/${storeId(store_id)}/lead-research/runs/${run_id}/messages`,
|
|
1891
|
+
payload,
|
|
1892
|
+
options
|
|
1893
|
+
);
|
|
1894
|
+
},
|
|
1895
|
+
async findMessages(params, options) {
|
|
1896
|
+
const { store_id, run_id, ...queryParams } = params;
|
|
1897
|
+
return apiConfig.httpClient.get(
|
|
1898
|
+
`/v1/stores/${storeId(store_id)}/lead-research/runs/${run_id}/messages`,
|
|
1899
|
+
{ ...options, params: queryParams }
|
|
1900
|
+
);
|
|
1901
|
+
},
|
|
1902
|
+
async validateEmail(params, options) {
|
|
1903
|
+
const { store_id, ...payload } = params;
|
|
1904
|
+
return apiConfig.httpClient.post(
|
|
1905
|
+
`/v1/stores/${storeId(store_id)}/lead-research/validate-email`,
|
|
1906
|
+
payload,
|
|
1907
|
+
options
|
|
1908
|
+
);
|
|
1909
|
+
}
|
|
1910
|
+
};
|
|
1911
|
+
};
|
|
1912
|
+
|
|
1432
1913
|
// src/api/workflow.ts
|
|
1433
1914
|
var createWorkflowApi = (apiConfig) => {
|
|
1434
1915
|
return {
|
|
@@ -1554,121 +2035,6 @@ var createShippingApi = (apiConfig) => {
|
|
|
1554
2035
|
};
|
|
1555
2036
|
};
|
|
1556
2037
|
|
|
1557
|
-
// src/api/agent.ts
|
|
1558
|
-
var createAgentApi = (apiConfig) => {
|
|
1559
|
-
return {
|
|
1560
|
-
async createAgent(params, options) {
|
|
1561
|
-
const { store_id, ...payload } = params;
|
|
1562
|
-
const target_store_id = store_id || apiConfig.storeId;
|
|
1563
|
-
return apiConfig.httpClient.post(
|
|
1564
|
-
`/v1/stores/${target_store_id}/agents`,
|
|
1565
|
-
{ ...payload, store_id: target_store_id },
|
|
1566
|
-
options
|
|
1567
|
-
);
|
|
1568
|
-
},
|
|
1569
|
-
async updateAgent(params, options) {
|
|
1570
|
-
const { store_id, id, ...payload } = params;
|
|
1571
|
-
const target_store_id = store_id || apiConfig.storeId;
|
|
1572
|
-
return apiConfig.httpClient.put(
|
|
1573
|
-
`/v1/stores/${target_store_id}/agents/${id}`,
|
|
1574
|
-
payload,
|
|
1575
|
-
options
|
|
1576
|
-
);
|
|
1577
|
-
},
|
|
1578
|
-
async deleteAgent(params, options) {
|
|
1579
|
-
const store_id = params.store_id || apiConfig.storeId;
|
|
1580
|
-
return apiConfig.httpClient.delete(
|
|
1581
|
-
`/v1/stores/${store_id}/agents/${params.id}`,
|
|
1582
|
-
options
|
|
1583
|
-
);
|
|
1584
|
-
},
|
|
1585
|
-
async getAgent(params, options) {
|
|
1586
|
-
const store_id = params.store_id || apiConfig.storeId;
|
|
1587
|
-
return apiConfig.httpClient.get(
|
|
1588
|
-
`/v1/stores/${store_id}/agents/${params.id}`,
|
|
1589
|
-
options
|
|
1590
|
-
);
|
|
1591
|
-
},
|
|
1592
|
-
async getAgents(params, options) {
|
|
1593
|
-
const store_id = params?.store_id || apiConfig.storeId;
|
|
1594
|
-
const { store_id: _, ...queryParams } = params || {};
|
|
1595
|
-
return apiConfig.httpClient.get(`/v1/stores/${store_id}/agents`, {
|
|
1596
|
-
...options,
|
|
1597
|
-
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
1598
|
-
});
|
|
1599
|
-
},
|
|
1600
|
-
async sendMessage(params, options) {
|
|
1601
|
-
const store_id = params.store_id || apiConfig.storeId;
|
|
1602
|
-
const body = { message: params.message };
|
|
1603
|
-
if (params.chat_id) body.chat_id = params.chat_id;
|
|
1604
|
-
if (params.direct) body.direct = params.direct;
|
|
1605
|
-
return apiConfig.httpClient.post(
|
|
1606
|
-
`/v1/stores/${store_id}/agents/${params.id}/chats/messages`,
|
|
1607
|
-
body,
|
|
1608
|
-
options
|
|
1609
|
-
);
|
|
1610
|
-
},
|
|
1611
|
-
async getChats(params, options) {
|
|
1612
|
-
const store_id = params.store_id || apiConfig.storeId;
|
|
1613
|
-
const queryParams = {};
|
|
1614
|
-
if (params.limit) queryParams.limit = String(params.limit);
|
|
1615
|
-
if (params.cursor) queryParams.cursor = params.cursor;
|
|
1616
|
-
return apiConfig.httpClient.get(
|
|
1617
|
-
`/v1/stores/${store_id}/agents/${params.id}/chats`,
|
|
1618
|
-
{
|
|
1619
|
-
...options,
|
|
1620
|
-
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
1621
|
-
}
|
|
1622
|
-
);
|
|
1623
|
-
},
|
|
1624
|
-
async getChat(params, options) {
|
|
1625
|
-
const store_id = params.store_id || apiConfig.storeId;
|
|
1626
|
-
return apiConfig.httpClient.get(
|
|
1627
|
-
`/v1/stores/${store_id}/agents/${params.id}/chats/${params.chat_id}`,
|
|
1628
|
-
options
|
|
1629
|
-
);
|
|
1630
|
-
},
|
|
1631
|
-
async updateChat(params, options) {
|
|
1632
|
-
const store_id = params.store_id || apiConfig.storeId;
|
|
1633
|
-
return apiConfig.httpClient.put(
|
|
1634
|
-
`/v1/stores/${store_id}/agents/${params.id}/chats/${params.chat_id}`,
|
|
1635
|
-
{ status: params.status },
|
|
1636
|
-
options
|
|
1637
|
-
);
|
|
1638
|
-
},
|
|
1639
|
-
async rateChat(params, options) {
|
|
1640
|
-
const store_id = params.store_id || apiConfig.storeId;
|
|
1641
|
-
const body = { rating: params.rating };
|
|
1642
|
-
if (params.comment) body.comment = params.comment;
|
|
1643
|
-
return apiConfig.httpClient.post(
|
|
1644
|
-
`/v1/stores/${store_id}/agents/${params.id}/chats/${params.chat_id}/rate`,
|
|
1645
|
-
body,
|
|
1646
|
-
options
|
|
1647
|
-
);
|
|
1648
|
-
},
|
|
1649
|
-
async getStoreChats(params, options) {
|
|
1650
|
-
const store_id = params.store_id || apiConfig.storeId;
|
|
1651
|
-
const { store_id: _, ...queryParams } = params;
|
|
1652
|
-
return apiConfig.httpClient.get(`/v1/stores/${store_id}/chats`, {
|
|
1653
|
-
...options,
|
|
1654
|
-
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
1655
|
-
});
|
|
1656
|
-
},
|
|
1657
|
-
async getChatMessages(params, options) {
|
|
1658
|
-
const store_id = params.store_id || apiConfig.storeId;
|
|
1659
|
-
const queryParams = {};
|
|
1660
|
-
if (params.limit) queryParams.limit = String(params.limit);
|
|
1661
|
-
return apiConfig.httpClient.get(
|
|
1662
|
-
`/v1/stores/${store_id}/agents/${params.id}/chats/${params.chat_id}/messages`,
|
|
1663
|
-
{
|
|
1664
|
-
...options,
|
|
1665
|
-
params: Object.keys(queryParams).length > 0 ? queryParams : void 0
|
|
1666
|
-
}
|
|
1667
|
-
);
|
|
1668
|
-
}
|
|
1669
|
-
};
|
|
1670
|
-
};
|
|
1671
|
-
|
|
1672
2038
|
// src/api/emailTemplate.ts
|
|
1673
2039
|
var createEmailTemplateApi = (apiConfig) => {
|
|
1674
2040
|
return {
|
|
@@ -1722,6 +2088,15 @@ var createEmailTemplateApi = (apiConfig) => {
|
|
|
1722
2088
|
params: queryParams
|
|
1723
2089
|
}
|
|
1724
2090
|
);
|
|
2091
|
+
},
|
|
2092
|
+
async previewEmailTemplate(params, options) {
|
|
2093
|
+
const { store_id, id, ...payload } = params;
|
|
2094
|
+
const target_store_id = store_id || apiConfig.storeId;
|
|
2095
|
+
return apiConfig.httpClient.post(
|
|
2096
|
+
`/v1/stores/${target_store_id}/email-templates/${id}/preview`,
|
|
2097
|
+
payload,
|
|
2098
|
+
options
|
|
2099
|
+
);
|
|
1725
2100
|
}
|
|
1726
2101
|
};
|
|
1727
2102
|
};
|
|
@@ -2270,15 +2645,42 @@ function createAdmin(config) {
|
|
|
2270
2645
|
};
|
|
2271
2646
|
const accountApi = createAccountApi(apiConfig);
|
|
2272
2647
|
const authApi = createAuthApi(apiConfig, updateSession);
|
|
2273
|
-
const storeApi = createStoreApi(apiConfig
|
|
2648
|
+
const storeApi = createStoreApi(apiConfig);
|
|
2274
2649
|
const platformApi = createPlatformApi(apiConfig);
|
|
2275
2650
|
const cmsApi = createCmsApi(apiConfig);
|
|
2276
2651
|
const eshopApi = createEshopApi(apiConfig);
|
|
2277
2652
|
const promoCodeApi = createPromoCodeApi(apiConfig);
|
|
2278
|
-
const crmApi =
|
|
2653
|
+
const crmApi = createProfileApi(apiConfig);
|
|
2654
|
+
const supportApi = createAdminSupportApi(apiConfig);
|
|
2655
|
+
const leadResearchApi = createLeadResearchApi(apiConfig);
|
|
2656
|
+
const leadResearch = {
|
|
2657
|
+
run: {
|
|
2658
|
+
create: leadResearchApi.createRun,
|
|
2659
|
+
find: leadResearchApi.findRuns,
|
|
2660
|
+
get: leadResearchApi.getRun,
|
|
2661
|
+
update: leadResearchApi.updateRun,
|
|
2662
|
+
cancel: leadResearchApi.cancelRun,
|
|
2663
|
+
sendMessage: leadResearchApi.sendMessage,
|
|
2664
|
+
findMessages: leadResearchApi.findMessages
|
|
2665
|
+
},
|
|
2666
|
+
message: {
|
|
2667
|
+
send: leadResearchApi.sendMessage,
|
|
2668
|
+
find: leadResearchApi.findMessages
|
|
2669
|
+
},
|
|
2670
|
+
email: {
|
|
2671
|
+
validate: leadResearchApi.validateEmail
|
|
2672
|
+
},
|
|
2673
|
+
createRun: leadResearchApi.createRun,
|
|
2674
|
+
findRuns: leadResearchApi.findRuns,
|
|
2675
|
+
getRun: leadResearchApi.getRun,
|
|
2676
|
+
updateRun: leadResearchApi.updateRun,
|
|
2677
|
+
cancelRun: leadResearchApi.cancelRun,
|
|
2678
|
+
sendMessage: leadResearchApi.sendMessage,
|
|
2679
|
+
findMessages: leadResearchApi.findMessages,
|
|
2680
|
+
validateEmail: leadResearchApi.validateEmail
|
|
2681
|
+
};
|
|
2279
2682
|
const locationApi = createLocationApi(apiConfig);
|
|
2280
2683
|
const marketApi = createMarketApi(apiConfig);
|
|
2281
|
-
const agentApi = createAgentApi(apiConfig);
|
|
2282
2684
|
const workflowApi = createWorkflowApi(apiConfig);
|
|
2283
2685
|
const formApi = createFormApi(apiConfig);
|
|
2284
2686
|
const taxonomyApi = createTaxonomyApi(apiConfig);
|
|
@@ -2330,7 +2732,8 @@ function createAdmin(config) {
|
|
|
2330
2732
|
update: emailTemplateApi.updateEmailTemplate,
|
|
2331
2733
|
delete: emailTemplateApi.deleteEmailTemplate,
|
|
2332
2734
|
get: emailTemplateApi.getEmailTemplate,
|
|
2333
|
-
find: emailTemplateApi.getEmailTemplates
|
|
2735
|
+
find: emailTemplateApi.getEmailTemplates,
|
|
2736
|
+
preview: emailTemplateApi.previewEmailTemplate
|
|
2334
2737
|
}
|
|
2335
2738
|
},
|
|
2336
2739
|
eshop: {
|
|
@@ -2381,41 +2784,27 @@ function createAdmin(config) {
|
|
|
2381
2784
|
promoCode: promoCodeApi
|
|
2382
2785
|
},
|
|
2383
2786
|
crm: {
|
|
2384
|
-
|
|
2787
|
+
profile: {
|
|
2385
2788
|
create: crmApi.create,
|
|
2386
2789
|
get: crmApi.get,
|
|
2387
2790
|
find: crmApi.find,
|
|
2388
2791
|
update: crmApi.update,
|
|
2389
2792
|
merge: crmApi.merge,
|
|
2793
|
+
import: crmApi.import,
|
|
2390
2794
|
revokeToken: crmApi.revokeToken,
|
|
2391
2795
|
revokeAllTokens: crmApi.revokeAllTokens
|
|
2392
2796
|
},
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
removeSubscriber: crmApi.audiences.removeSubscriber
|
|
2401
|
-
},
|
|
2797
|
+
profileList: crmApi.profileList,
|
|
2798
|
+
mailbox: crmApi.mailbox,
|
|
2799
|
+
campaign: crmApi.campaign,
|
|
2800
|
+
campaignRecipient: crmApi.campaignRecipient,
|
|
2801
|
+
campaignMessage: crmApi.campaignMessage,
|
|
2802
|
+
suppression: crmApi.suppression,
|
|
2803
|
+
leadResearch,
|
|
2402
2804
|
activity: crmApi.activity
|
|
2403
2805
|
},
|
|
2806
|
+
leadResearch,
|
|
2404
2807
|
automation: {
|
|
2405
|
-
agent: {
|
|
2406
|
-
create: agentApi.createAgent,
|
|
2407
|
-
update: agentApi.updateAgent,
|
|
2408
|
-
delete: agentApi.deleteAgent,
|
|
2409
|
-
get: agentApi.getAgent,
|
|
2410
|
-
find: agentApi.getAgents,
|
|
2411
|
-
sendMessage: agentApi.sendMessage,
|
|
2412
|
-
getChats: agentApi.getChats,
|
|
2413
|
-
getChat: agentApi.getChat,
|
|
2414
|
-
updateChat: agentApi.updateChat,
|
|
2415
|
-
rateChat: agentApi.rateChat,
|
|
2416
|
-
getStoreChats: agentApi.getStoreChats,
|
|
2417
|
-
getChatMessages: agentApi.getChatMessages
|
|
2418
|
-
},
|
|
2419
2808
|
workflow: {
|
|
2420
2809
|
create: workflowApi.createWorkflow,
|
|
2421
2810
|
update: workflowApi.updateWorkflow,
|
|
@@ -2425,7 +2814,8 @@ function createAdmin(config) {
|
|
|
2425
2814
|
trigger: workflowApi.triggerWorkflow,
|
|
2426
2815
|
getExecutions: workflowApi.getWorkflowExecutions,
|
|
2427
2816
|
getExecution: workflowApi.getWorkflowExecution
|
|
2428
|
-
}
|
|
2817
|
+
},
|
|
2818
|
+
support: supportApi
|
|
2429
2819
|
},
|
|
2430
2820
|
analytics: analyticsApi,
|
|
2431
2821
|
setStoreId: (storeId) => {
|