arky-sdk 0.3.166 → 0.3.167
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 +1 -179
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -31
- package/dist/index.d.ts +2 -31
- package/dist/index.js +1 -179
- package/dist/index.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +3 -105
- package/dist/types.d.ts +3 -105
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -240,9 +240,6 @@ var createAccountApi = (apiConfig) => {
|
|
|
240
240
|
}
|
|
241
241
|
});
|
|
242
242
|
},
|
|
243
|
-
async setRole(params, options) {
|
|
244
|
-
return apiConfig.httpClient.put("/v1/accounts/set-role", params, options);
|
|
245
|
-
},
|
|
246
243
|
// ===== SUBSCRIPTION =====
|
|
247
244
|
async subscribe(params, options) {
|
|
248
245
|
return apiConfig.httpClient.post("/v1/accounts/subscribe", params, options);
|
|
@@ -520,50 +517,6 @@ var createMediaApi = (apiConfig) => {
|
|
|
520
517
|
};
|
|
521
518
|
};
|
|
522
519
|
|
|
523
|
-
// src/api/role.ts
|
|
524
|
-
var createRoleApi = (apiConfig) => {
|
|
525
|
-
return {
|
|
526
|
-
async createRole(params, options) {
|
|
527
|
-
return apiConfig.httpClient.post(
|
|
528
|
-
`/v1/businesses/${apiConfig.businessId}/roles`,
|
|
529
|
-
params,
|
|
530
|
-
options
|
|
531
|
-
);
|
|
532
|
-
},
|
|
533
|
-
async updateRole(params, options) {
|
|
534
|
-
return apiConfig.httpClient.put(
|
|
535
|
-
`/v1/businesses/${apiConfig.businessId}/roles/${params.id}`,
|
|
536
|
-
params,
|
|
537
|
-
options
|
|
538
|
-
);
|
|
539
|
-
},
|
|
540
|
-
async deleteRole(params, options) {
|
|
541
|
-
return apiConfig.httpClient.delete(
|
|
542
|
-
`/v1/businesses/${apiConfig.businessId}/roles/${params.id}`,
|
|
543
|
-
options
|
|
544
|
-
);
|
|
545
|
-
},
|
|
546
|
-
async getRole(params, options) {
|
|
547
|
-
return apiConfig.httpClient.get(
|
|
548
|
-
`/v1/businesses/${apiConfig.businessId}/roles/${params.id}`,
|
|
549
|
-
options
|
|
550
|
-
);
|
|
551
|
-
},
|
|
552
|
-
async getRoles(params, options) {
|
|
553
|
-
return apiConfig.httpClient.get(
|
|
554
|
-
`/v1/businesses/${apiConfig.businessId}/roles`,
|
|
555
|
-
{
|
|
556
|
-
...options,
|
|
557
|
-
params: {
|
|
558
|
-
action: params.action,
|
|
559
|
-
ids: params.ids
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
);
|
|
563
|
-
}
|
|
564
|
-
};
|
|
565
|
-
};
|
|
566
|
-
|
|
567
520
|
// src/api/notification.ts
|
|
568
521
|
var createNotificationApi = (apiConfig) => {
|
|
569
522
|
return {
|
|
@@ -1262,135 +1215,6 @@ var createDatabaseApi = (apiConfig) => {
|
|
|
1262
1215
|
};
|
|
1263
1216
|
};
|
|
1264
1217
|
|
|
1265
|
-
// src/api/featureFlags.ts
|
|
1266
|
-
var createFeatureFlagsApi = (apiConfig) => {
|
|
1267
|
-
return {
|
|
1268
|
-
/**
|
|
1269
|
-
* Create a new feature flag
|
|
1270
|
-
*/
|
|
1271
|
-
async createFlag(params, options) {
|
|
1272
|
-
return apiConfig.httpClient.post(
|
|
1273
|
-
`/v1/businesses/${apiConfig.businessId}/feature-flags`,
|
|
1274
|
-
params,
|
|
1275
|
-
options
|
|
1276
|
-
);
|
|
1277
|
-
},
|
|
1278
|
-
/**
|
|
1279
|
-
* Get a feature flag by ID
|
|
1280
|
-
*/
|
|
1281
|
-
async getFlag(params, options) {
|
|
1282
|
-
return apiConfig.httpClient.get(
|
|
1283
|
-
`/v1/businesses/${apiConfig.businessId}/feature-flags/${params.id}`,
|
|
1284
|
-
options
|
|
1285
|
-
);
|
|
1286
|
-
},
|
|
1287
|
-
/**
|
|
1288
|
-
* List all feature flags for the business
|
|
1289
|
-
*/
|
|
1290
|
-
async getFlags(params, options) {
|
|
1291
|
-
return apiConfig.httpClient.get(
|
|
1292
|
-
`/v1/businesses/${apiConfig.businessId}/feature-flags`,
|
|
1293
|
-
{
|
|
1294
|
-
...options,
|
|
1295
|
-
params
|
|
1296
|
-
}
|
|
1297
|
-
);
|
|
1298
|
-
},
|
|
1299
|
-
/**
|
|
1300
|
-
* Update a feature flag
|
|
1301
|
-
*/
|
|
1302
|
-
async updateFlag(params, options) {
|
|
1303
|
-
const { id, ...body } = params;
|
|
1304
|
-
return apiConfig.httpClient.put(
|
|
1305
|
-
`/v1/businesses/${apiConfig.businessId}/feature-flags/${id}`,
|
|
1306
|
-
body,
|
|
1307
|
-
options
|
|
1308
|
-
);
|
|
1309
|
-
},
|
|
1310
|
-
/**
|
|
1311
|
-
* Delete a feature flag
|
|
1312
|
-
*/
|
|
1313
|
-
async deleteFlag(params, options) {
|
|
1314
|
-
return apiConfig.httpClient.delete(
|
|
1315
|
-
`/v1/businesses/${apiConfig.businessId}/feature-flags/${params.id}`,
|
|
1316
|
-
options
|
|
1317
|
-
);
|
|
1318
|
-
},
|
|
1319
|
-
/**
|
|
1320
|
-
* Get experiment results for a feature flag
|
|
1321
|
-
*/
|
|
1322
|
-
async getResults(params, options) {
|
|
1323
|
-
return apiConfig.httpClient.get(
|
|
1324
|
-
`/v1/businesses/${apiConfig.businessId}/feature-flags/${params.id}/results`,
|
|
1325
|
-
options
|
|
1326
|
-
);
|
|
1327
|
-
},
|
|
1328
|
-
/**
|
|
1329
|
-
* Get the variant assignment for the current user
|
|
1330
|
-
* This is the main method for feature flag evaluation
|
|
1331
|
-
*/
|
|
1332
|
-
async getVariant(params, options) {
|
|
1333
|
-
return apiConfig.httpClient.get(
|
|
1334
|
-
`/v1/businesses/${apiConfig.businessId}/feature-flags/key/${params.flagKey}/variant`,
|
|
1335
|
-
options
|
|
1336
|
-
);
|
|
1337
|
-
},
|
|
1338
|
-
/**
|
|
1339
|
-
* Track a conversion event for A/B testing
|
|
1340
|
-
*/
|
|
1341
|
-
async trackEvent(params, options) {
|
|
1342
|
-
return apiConfig.httpClient.post(
|
|
1343
|
-
`/v1/businesses/${apiConfig.businessId}/feature-flags/track`,
|
|
1344
|
-
params,
|
|
1345
|
-
options
|
|
1346
|
-
);
|
|
1347
|
-
},
|
|
1348
|
-
// ===== CONVENIENCE METHODS =====
|
|
1349
|
-
/**
|
|
1350
|
-
* Check if a feature is enabled (returns true if variant is not 'control')
|
|
1351
|
-
* Convenience method for simple on/off flags
|
|
1352
|
-
*/
|
|
1353
|
-
async isEnabled(flagKey) {
|
|
1354
|
-
try {
|
|
1355
|
-
const response = await this.getVariant({ flagKey });
|
|
1356
|
-
return response.variantKey !== "control";
|
|
1357
|
-
} catch {
|
|
1358
|
-
return false;
|
|
1359
|
-
}
|
|
1360
|
-
},
|
|
1361
|
-
/**
|
|
1362
|
-
* Get variant with payload, returning a default if flag not found
|
|
1363
|
-
* Useful for getting configuration values from variants
|
|
1364
|
-
*/
|
|
1365
|
-
async getVariantWithDefault(flagKey, defaultValue) {
|
|
1366
|
-
try {
|
|
1367
|
-
const response = await this.getVariant({ flagKey });
|
|
1368
|
-
return {
|
|
1369
|
-
variantKey: response.variantKey,
|
|
1370
|
-
payload: response.payload ?? defaultValue
|
|
1371
|
-
};
|
|
1372
|
-
} catch {
|
|
1373
|
-
return {
|
|
1374
|
-
variantKey: "control",
|
|
1375
|
-
payload: defaultValue
|
|
1376
|
-
};
|
|
1377
|
-
}
|
|
1378
|
-
},
|
|
1379
|
-
/**
|
|
1380
|
-
* Activate a draft flag
|
|
1381
|
-
*/
|
|
1382
|
-
async activateFlag(id) {
|
|
1383
|
-
return this.updateFlag({ id, status: "ACTIVE" });
|
|
1384
|
-
},
|
|
1385
|
-
/**
|
|
1386
|
-
* Archive an active flag
|
|
1387
|
-
*/
|
|
1388
|
-
async archiveFlag(id) {
|
|
1389
|
-
return this.updateFlag({ id, status: "ARCHIVED" });
|
|
1390
|
-
}
|
|
1391
|
-
};
|
|
1392
|
-
};
|
|
1393
|
-
|
|
1394
1218
|
// src/api/location.ts
|
|
1395
1219
|
var createLocationApi = (apiConfig) => {
|
|
1396
1220
|
return {
|
|
@@ -1938,7 +1762,7 @@ function nameToKey(name) {
|
|
|
1938
1762
|
}
|
|
1939
1763
|
|
|
1940
1764
|
// src/index.ts
|
|
1941
|
-
var SDK_VERSION = "0.3.
|
|
1765
|
+
var SDK_VERSION = "0.3.167";
|
|
1942
1766
|
var SUPPORTED_FRAMEWORKS = [
|
|
1943
1767
|
"astro",
|
|
1944
1768
|
"react",
|
|
@@ -1965,7 +1789,6 @@ async function createArkySDK(config) {
|
|
|
1965
1789
|
account: accountApi,
|
|
1966
1790
|
business: createBusinessApi(apiConfig),
|
|
1967
1791
|
media: createMediaApi(apiConfig),
|
|
1968
|
-
role: createRoleApi(apiConfig),
|
|
1969
1792
|
notification: createNotificationApi(apiConfig),
|
|
1970
1793
|
promoCode: createPromoCodeApi(apiConfig),
|
|
1971
1794
|
analytics: createAnalyticsApi(apiConfig),
|
|
@@ -1973,7 +1796,6 @@ async function createArkySDK(config) {
|
|
|
1973
1796
|
eshop: createEshopApi(apiConfig),
|
|
1974
1797
|
reservation: createReservationApi(apiConfig),
|
|
1975
1798
|
database: createDatabaseApi(apiConfig),
|
|
1976
|
-
featureFlags: createFeatureFlagsApi(apiConfig),
|
|
1977
1799
|
location: createLocationApi(apiConfig),
|
|
1978
1800
|
network: createNetworkApi(apiConfig),
|
|
1979
1801
|
workflow: createWorkflowApi(apiConfig),
|