Skip to content

Commit 273513d

Browse files
authored
feat: add coming-from parameter (#837)
1 parent 2d006c9 commit 273513d

File tree

7 files changed

+26
-1
lines changed

7 files changed

+26
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Changelog
22

3+
- feat: Add `coming-from` parameter ([#837](https://github.com/getsentry/sentry-wizard/pull/837))
4+
35
## 4.1.0
46

57
- feat(nuxt): More granular error catching while modifying config ([#833](https://github.com/getsentry/sentry-wizard/pull/833))

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ The following CLI arguments are available:
7171
| `-s, --signup` | Redirect to signup page if not logged in | boolean | `false` | | |
7272
| `--disable-telemetry` | Don't send telemetry data to Sentry | boolean | `false` | | |
7373
| `--force-install` | Force install the SDK NPM package (use with caution!) | boolean | `false` | | |
74+
| `--coming-from` | Specify the partner organization initiating this command. | string | | | |
7475

7576
## Resources
7677

lib/Constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export interface Args {
113113
signup: boolean;
114114
promoCode?: string;
115115
disableTelemetry?: boolean;
116+
comingFrom?: string;
116117
}
117118

118119
export const DEFAULT_URL = 'https://sentry.io/';

lib/Steps/OpenSentry.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ export class OpenSentry extends BaseStep {
5151
}
5252
}
5353

54+
if (this._argv.comingFrom) {
55+
// Used to display login/signup instructions when the user is coming from a partner site (e.g. Vercel)
56+
urlObj.searchParams.set('partner', this._argv.comingFrom);
57+
}
58+
5459
const urlToOpen = urlObj.toString();
5560

5661
// opn throws in environments that don't have a browser (e.g. remote shells) so we just noop here

src/run.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ type Args = {
5757
project?: string;
5858
saas?: boolean;
5959
forceInstall?: boolean;
60+
comingFrom?: string;
6061
};
6162

6263
function preSelectedProjectArgsToObject(
@@ -134,6 +135,7 @@ export async function run(argv: Args) {
134135
saas: finalArgs.saas,
135136
preSelectedProject: preSelectedProjectArgsToObject(finalArgs),
136137
forceInstall: finalArgs.forceInstall,
138+
comingFrom: finalArgs.comingFrom,
137139
};
138140

139141
switch (integration) {

src/utils/clack-utils.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,7 @@ export async function getOrAskForProjectData(
902902
platform: platform,
903903
orgSlug: options.orgSlug,
904904
projectSlug: options.projectSlug,
905+
comingFrom: options.comingFrom,
905906
}),
906907
);
907908

@@ -1044,8 +1045,10 @@ export async function askForWizardLogin(options: {
10441045
| 'flutter';
10451046
orgSlug?: string;
10461047
projectSlug?: string;
1048+
comingFrom?: string;
10471049
}): Promise<WizardProjectData> {
1048-
const { orgSlug, projectSlug, url, platform, promoCode } = options;
1050+
const { orgSlug, projectSlug, url, platform, promoCode, comingFrom } =
1051+
options;
10491052

10501053
Sentry.setTag('has-promo-code', !!promoCode);
10511054

@@ -1080,6 +1083,10 @@ export async function askForWizardLogin(options: {
10801083
loginUrl.searchParams.set('code', promoCode);
10811084
}
10821085

1086+
if (comingFrom) {
1087+
loginUrl.searchParams.set('partner', comingFrom);
1088+
}
1089+
10831090
const urlToOpen = loginUrl.toString();
10841091
clack.log.info(
10851092
`${chalk.bold(

src/utils/types.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ export type WizardOptions = {
6767
* Does not apply to all wizard flows (currently NPM only)
6868
*/
6969
forceInstall?: boolean;
70+
71+
/**
72+
* Used when the wizard command is copied from partner sites (e.g. Vercel)
73+
* to display login/signup instructions specific to organizations provisioned
74+
* through the partner.
75+
*/
76+
comingFrom?: string;
7077
};
7178

7279
export interface Feature {

0 commit comments

Comments
 (0)