@drip-apex/apex-cli 0.14.0 → 0.14.1
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/cli.js +38 -9
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -7325,7 +7325,7 @@ async function checkForUpdate(current) {
|
|
|
7325
7325
|
// package.json
|
|
7326
7326
|
var package_default = {
|
|
7327
7327
|
name: "@drip-apex/apex-cli",
|
|
7328
|
-
version: "0.14.
|
|
7328
|
+
version: "0.14.1",
|
|
7329
7329
|
license: "MIT",
|
|
7330
7330
|
description: "Apex CLI for managing experiments, approved roadmap ideas, and draft workspaces.",
|
|
7331
7331
|
private: false,
|
|
@@ -8336,11 +8336,19 @@ function listExperiments(creds, opts) {
|
|
|
8336
8336
|
const qs = params.toString();
|
|
8337
8337
|
return request(creds, "GET", `/api/v1/experiments${qs ? `?${qs}` : ""}`);
|
|
8338
8338
|
}
|
|
8339
|
-
function getExperiment(creds, id) {
|
|
8340
|
-
return request(
|
|
8339
|
+
function getExperiment(creds, id, includePreviewTarget = false) {
|
|
8340
|
+
return request(
|
|
8341
|
+
creds,
|
|
8342
|
+
"GET",
|
|
8343
|
+
`/api/v1/experiments/${id}${includePreviewTarget ? "?include=preview_target" : ""}`
|
|
8344
|
+
);
|
|
8341
8345
|
}
|
|
8342
|
-
function getExperimentBySlug(creds, slug) {
|
|
8343
|
-
return request(
|
|
8346
|
+
function getExperimentBySlug(creds, slug, includePreviewTarget = false) {
|
|
8347
|
+
return request(
|
|
8348
|
+
creds,
|
|
8349
|
+
"GET",
|
|
8350
|
+
`/api/v1/experiments/by-slug/${slug}${includePreviewTarget ? "?include=preview_target" : ""}`
|
|
8351
|
+
);
|
|
8344
8352
|
}
|
|
8345
8353
|
function upsertExperimentBySlug(creds, slug, body5) {
|
|
8346
8354
|
return request(creds, "PUT", `/api/v1/experiments/by-slug/${slug}`, body5);
|
|
@@ -12842,6 +12850,14 @@ var previewCommand = new Command("preview").description(
|
|
|
12842
12850
|
const data = created.data;
|
|
12843
12851
|
output(previewCommand, data, () => {
|
|
12844
12852
|
console.log(source_default.cyan(data.preview_url));
|
|
12853
|
+
if (data.preview_target) {
|
|
12854
|
+
console.log(`Chosen page: ${data.preview_target.url} (${data.preview_target.source})`);
|
|
12855
|
+
if (!data.preview_target.matches_targeting) {
|
|
12856
|
+
console.log(
|
|
12857
|
+
`The test will not show on this page: ${data.preview_target.reason ?? "The page does not match URL targeting."}`
|
|
12858
|
+
);
|
|
12859
|
+
}
|
|
12860
|
+
}
|
|
12845
12861
|
console.log(
|
|
12846
12862
|
data.qa_run.created ? `QA run ${data.qa_run.id} created` : `QA run ${data.qa_run.id} refreshed (${data.qa_run.automated_evidence_count} automated evidence records)`
|
|
12847
12863
|
);
|
|
@@ -12867,7 +12883,7 @@ var previewCommand = new Command("preview").description(
|
|
|
12867
12883
|
const spinner = await createSpinner("Fetching experiment...");
|
|
12868
12884
|
let exp;
|
|
12869
12885
|
if (/^[0-9a-f-]{36}$/i.test(idOrSlug)) {
|
|
12870
|
-
const res = await getExperiment(creds, idOrSlug);
|
|
12886
|
+
const res = await getExperiment(creds, idOrSlug, !opts?.storeUrl);
|
|
12871
12887
|
if (!res.ok) {
|
|
12872
12888
|
spinner.fail(`Experiment "${idOrSlug}" not found`);
|
|
12873
12889
|
fail(
|
|
@@ -12880,7 +12896,7 @@ var previewCommand = new Command("preview").description(
|
|
|
12880
12896
|
exp = res.data;
|
|
12881
12897
|
} else {
|
|
12882
12898
|
const slug = idOrSlug.startsWith("slug:") ? idOrSlug.slice(5) : idOrSlug;
|
|
12883
|
-
const res = await getExperimentBySlug(creds, slug);
|
|
12899
|
+
const res = await getExperimentBySlug(creds, slug, !opts?.storeUrl);
|
|
12884
12900
|
if (!res.ok) {
|
|
12885
12901
|
spinner.fail(`Experiment "${slug}" not found`);
|
|
12886
12902
|
fail(
|
|
@@ -12915,7 +12931,7 @@ var previewCommand = new Command("preview").description(
|
|
|
12915
12931
|
variation = exp.variations.find((v) => !v.is_control) ?? exp.variations[0];
|
|
12916
12932
|
}
|
|
12917
12933
|
spinner.stop();
|
|
12918
|
-
const storeUrl = opts?.storeUrl ?? exp.store_url;
|
|
12934
|
+
const storeUrl = opts?.storeUrl ?? exp.preview_target?.url ?? exp.store_url;
|
|
12919
12935
|
if (!storeUrl) {
|
|
12920
12936
|
fail(
|
|
12921
12937
|
previewCommand,
|
|
@@ -12933,11 +12949,24 @@ var previewCommand = new Command("preview").description(
|
|
|
12933
12949
|
}
|
|
12934
12950
|
output(
|
|
12935
12951
|
previewCommand,
|
|
12936
|
-
{
|
|
12952
|
+
{
|
|
12953
|
+
experimentId: exp.id,
|
|
12954
|
+
variationId: variation.id,
|
|
12955
|
+
previewUrl: previewUrl.toString(),
|
|
12956
|
+
...!opts?.storeUrl && exp.preview_target ? { previewTarget: exp.preview_target } : {}
|
|
12957
|
+
},
|
|
12937
12958
|
() => {
|
|
12938
12959
|
console.log();
|
|
12939
12960
|
console.log(source_default.bold(`Preview: ${exp.name}`));
|
|
12940
12961
|
console.log(`Variation: ${variation.name}${variation.is_control ? " (control)" : ""}`);
|
|
12962
|
+
if (!opts?.storeUrl && exp.preview_target) {
|
|
12963
|
+
console.log(`Chosen page: ${exp.preview_target.url} (${exp.preview_target.source})`);
|
|
12964
|
+
if (!exp.preview_target.matches_targeting) {
|
|
12965
|
+
console.log(
|
|
12966
|
+
`The test will not show on this page: ${exp.preview_target.reason ?? "The page does not match URL targeting."}`
|
|
12967
|
+
);
|
|
12968
|
+
}
|
|
12969
|
+
}
|
|
12941
12970
|
console.log();
|
|
12942
12971
|
console.log(source_default.cyan(previewUrl.toString()));
|
|
12943
12972
|
console.log();
|