launch-sdk 0.0.0-stage → 0.0.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.
@@ -0,0 +1,3 @@
1
+ export type { LaunchAppStoreOptions, LaunchMetaVrOptions, LaunchOptions, LaunchPlayStoreOptions, LaunchTarget, } from './utils/options';
2
+ export type { LaunchAppStoreResult, LaunchEasHostingResult, LaunchMetaVrResult, LaunchPlayStoreResult, LaunchResult, LaunchWorkflowResult, } from './utils/result';
3
+ export { createLaunchUrl, type LaunchUrlOptions } from './utils/url';
@@ -0,0 +1,2 @@
1
+ export { createLaunchUrl } from './utils/url';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,eAAe,EAAyB,MAAM,aAAa,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { LaunchResult } from './utils/result';
2
+ /**
3
+ * Emit the Launch results from the workflow status page at the end of a Launch.
4
+ * When Launch is embedded within a partner system, this sends the information back to the partner.
5
+ */
6
+ export declare function emitLaunchResult(result: LaunchResult): void;
@@ -0,0 +1,14 @@
1
+ import { getLaunchEmbedderOrigin, LAUNCH_RESULT_TYPE } from './utils/message';
2
+ /**
3
+ * Emit the Launch results from the workflow status page at the end of a Launch.
4
+ * When Launch is embedded within a partner system, this sends the information back to the partner.
5
+ */
6
+ export function emitLaunchResult(result) {
7
+ if (window.parent === window)
8
+ return;
9
+ const target = getLaunchEmbedderOrigin();
10
+ if (!target)
11
+ return;
12
+ window.parent.postMessage({ type: LAUNCH_RESULT_TYPE, result }, target);
13
+ }
14
+ //# sourceMappingURL=internal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAG9E;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAoB;IACnD,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM;QAAE,OAAO;IAErC,MAAM,MAAM,GAAG,uBAAuB,EAAE,CAAC;IACzC,IAAI,CAAC,MAAM;QAAE,OAAO;IAEpB,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,CAAC;AAC1E,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { type ComponentProps } from 'react';
2
+ import type { LaunchResult } from './utils/result';
3
+ import { type LaunchUrlOptions } from './utils/url';
4
+ interface LaunchFrameProps extends LaunchUrlOptions, Omit<ComponentProps<'iframe'>, 'src'> {
5
+ /**
6
+ * Event handler when the user completed a Launch target and kicked off a new workflow.
7
+ * When using iFrames, the user cannot cancel the flow from within Launch.
8
+ *
9
+ * @note This method may be called multiple times with the same information, or when the workflow status has been updated.
10
+ */
11
+ onLaunch?(result: LaunchResult): unknown;
12
+ }
13
+ export declare function LaunchFrame({ ref, onLaunch, appleAppId, appleAppName, appleBundleId, expoSession, googlePackageName, launchUrl, metaAppId, metaPackageName, projectId, projectName, targets, partner, ...props }: LaunchFrameProps): import("react").JSX.Element;
14
+ export declare namespace LaunchFrame {
15
+ var recommendedStyle: {
16
+ border: number;
17
+ width: string;
18
+ maxWidth: string;
19
+ height: string;
20
+ minHeight: number;
21
+ flexGrow: number;
22
+ flexShrink: number;
23
+ flexBasis: string;
24
+ };
25
+ }
26
+ export {};
@@ -0,0 +1,58 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useImperativeHandle, useRef, } from 'react';
3
+ import { isLaunchResultMessage } from './utils/message';
4
+ import { createLaunchUrl } from './utils/url';
5
+ export function LaunchFrame({ ref, onLaunch, appleAppId, appleAppName, appleBundleId, expoSession, googlePackageName, launchUrl, metaAppId, metaPackageName, projectId, projectName, targets, partner, ...props }) {
6
+ const frameRef = useRef(null);
7
+ const url = createLaunchUrl({
8
+ appleAppId,
9
+ appleAppName,
10
+ appleBundleId,
11
+ expoSession,
12
+ googlePackageName,
13
+ launchUrl,
14
+ metaAppId,
15
+ metaPackageName,
16
+ projectId,
17
+ projectName,
18
+ targets,
19
+ partner,
20
+ });
21
+ useImperativeHandle(ref, () => frameRef.current, []);
22
+ useEffect(() => {
23
+ if (!onLaunch)
24
+ return;
25
+ const launchOrigin = new URL(url).origin;
26
+ function onMessage(event) {
27
+ if (!onLaunch)
28
+ return;
29
+ if (event.origin !== launchOrigin)
30
+ return;
31
+ if (!frameRef.current || event.source !== frameRef.current.contentWindow)
32
+ return;
33
+ if (!isLaunchResultMessage(event.data))
34
+ return;
35
+ onLaunch(event.data.result);
36
+ }
37
+ window.addEventListener('message', onMessage);
38
+ return () => window.removeEventListener('message', onMessage);
39
+ }, [url, onLaunch]);
40
+ return (_jsx("iframe", { allowTransparency: !!partner, ...props,
41
+ // Avoid opaque iframe backgrounds when the parent uses a different color scheme than Launch
42
+ style: { colorScheme: 'dark', ...props.style }, src: url, ref: frameRef }));
43
+ }
44
+ /**
45
+ * The recommended styling of the Launch frame.
46
+ * This is defined separately as the partners can implement this however they like.
47
+ */
48
+ LaunchFrame.recommendedStyle = {
49
+ border: 0,
50
+ width: '100%',
51
+ maxWidth: '28rem',
52
+ height: '100%',
53
+ minHeight: 0,
54
+ flexGrow: 0,
55
+ flexShrink: 1,
56
+ flexBasis: 'auto',
57
+ };
58
+ //# sourceMappingURL=react.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/react.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,MAAM,GAGP,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,OAAO,EAAE,eAAe,EAAyB,MAAM,aAAa,CAAC;AAYrE,MAAM,UAAU,WAAW,CAAC,E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,QAAQ,CAAC,CAAC,CAAC;IAEpB,OAAO,CACL,iBACE,iBAAiB,EAAE,CAAC,CAAC,OAAO,KACxB,KAAK;QACT,4FAA4F;QAC5F,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,EAC9C,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,QAAQ,GACb,CACH,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,WAAW,CAAC,gBAAgB,GAAG;IAC7B,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,OAAO;IACjB,MAAM,EAAE,MAAM;IACd,SAAS,EAAE,CAAC;IACZ,QAAQ,EAAE,CAAC;IACX,UAAU,EAAE,CAAC;IACb,SAAS,EAAE,MAAM;CACM,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { LaunchResult } from './result';
2
+ /** The `postMessage` message type to transport launch results to embedders of Launch. */
3
+ export declare const LAUNCH_RESULT_TYPE = "launch.dev:result";
4
+ export interface LaunchResultMessage {
5
+ type: typeof LAUNCH_RESULT_TYPE;
6
+ result: LaunchResult;
7
+ }
8
+ /**
9
+ * Check if the data object is the Launch result message as we know it.
10
+ * This is required as the `window.parent.postMessage` / `window.addEventListener('message', ...)`
11
+ * system works as a global instance.
12
+ */
13
+ export declare function isLaunchResultMessage(data: unknown): data is LaunchResultMessage;
14
+ /**
15
+ * Try to find the embedder origin when Launch is used as an iFrame or popup.
16
+ * This attempts to resolve the `window.location.ancestorOrigins`, or `document.referrer`.
17
+ * When Launch is not embedded, this returns `null`.
18
+ */
19
+ export declare function getLaunchEmbedderOrigin(): string | null;
@@ -0,0 +1,37 @@
1
+ /** The `postMessage` message type to transport launch results to embedders of Launch. */
2
+ export const LAUNCH_RESULT_TYPE = 'launch.dev:result';
3
+ /**
4
+ * Check if the data object is the Launch result message as we know it.
5
+ * This is required as the `window.parent.postMessage` / `window.addEventListener('message', ...)`
6
+ * system works as a global instance.
7
+ */
8
+ export function isLaunchResultMessage(data) {
9
+ return (data !== null &&
10
+ typeof data === 'object' &&
11
+ 'type' in data &&
12
+ data.type === LAUNCH_RESULT_TYPE &&
13
+ 'result' in data &&
14
+ !!data.result);
15
+ }
16
+ /**
17
+ * Try to find the embedder origin when Launch is used as an iFrame or popup.
18
+ * This attempts to resolve the `window.location.ancestorOrigins`, or `document.referrer`.
19
+ * When Launch is not embedded, this returns `null`.
20
+ */
21
+ export function getLaunchEmbedderOrigin() {
22
+ if (typeof window === 'undefined' || window.parent === window)
23
+ return null;
24
+ // Chrome/Safari, the browser supplies the origin which cannot be changed
25
+ const ancestor = window.location.ancestorOrigins?.[0];
26
+ if (ancestor)
27
+ return ancestor;
28
+ // Firefox, use the referrer which is controlled by `referrerpolicy`
29
+ // See: https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy
30
+ try {
31
+ return document.referrer ? new URL(document.referrer).origin : null;
32
+ }
33
+ catch {
34
+ return null;
35
+ }
36
+ }
37
+ //# sourceMappingURL=message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/utils/message.ts"],"names":[],"mappings":"AAEA,yFAAyF;AACzF,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AAOtD;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAa;IACjD,OAAO,CACL,IAAI,KAAK,IAAI;QACb,OAAO,IAAI,KAAK,QAAQ;QACxB,MAAM,IAAI,IAAI;QACd,IAAI,CAAC,IAAI,KAAK,kBAAkB;QAChC,QAAQ,IAAI,IAAI;QAChB,CAAC,CAAC,IAAI,CAAC,MAAM,CACd,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB;IACrC,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC;IAC3E,yEAAyE;IACzE,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,CAAC;IACtD,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC9B,oEAAoE;IACpE,yFAAyF;IACzF,IAAI,CAAC;QACH,OAAO,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IACtE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,78 @@
1
+ export type LaunchTarget = 'app-store' | 'play-store' | 'meta-vr' | 'eas-hosting';
2
+ export interface LaunchOptions extends LaunchAppStoreOptions, LaunchMetaVrOptions, LaunchPlayStoreOptions {
3
+ /**
4
+ * Only enable the following launch targets, and hide the rest.
5
+ * When omitted, all launch targets are visible but may still be blocked due to missing project prerequisites.
6
+ */
7
+ targets?: LaunchTarget[];
8
+ /**
9
+ * The Expo project identifier to auto-select when the user has access to this project.
10
+ */
11
+ projectId?: string;
12
+ /**
13
+ * The default value to use when asking users to create a new Expo project.
14
+ */
15
+ projectName?: string;
16
+ }
17
+ export interface LaunchAppStoreOptions {
18
+ /**
19
+ * The App Store Connect listing identifier to auto-select.
20
+ * When the user does not have access to this app store listing,
21
+ * Launch will show the App Store Connect app selection step.
22
+ *
23
+ * @note `app-store` only
24
+ */
25
+ appleAppId?: string;
26
+ /**
27
+ * The default value to use when letting users create a new App Store Connect listing.
28
+ *
29
+ * @note `app-store` only
30
+ */
31
+ appleAppName?: string;
32
+ /**
33
+ * The default App Store Connect bundle identifier to use when letting users create a new App Store Connect listing.
34
+ *
35
+ * @note
36
+ * When using a bundle identifier ending with a `.` character, the bundle identifier is considered a prefix.
37
+ * The app name will be sluggified and appended after the `.` by default in attempt to keep this as unique as possible.
38
+ *
39
+ * When using a bundle identifier NOT ending with a `.` character, the bundle identifier is considered an absolute value.
40
+ * Make sure these bundle identifiers are unique enough to be registered when needed.
41
+ *
42
+ * @note `app-store` only
43
+ */
44
+ appleBundleId?: string;
45
+ }
46
+ export interface LaunchMetaVrOptions {
47
+ /**
48
+ * The Meta VR application identifier Launch should prefill when connecting the Meta VR app.
49
+ * When the app already is connected, we avoid this step completely.
50
+ *
51
+ * @note `meta-vr` only
52
+ */
53
+ metaAppId?: string;
54
+ /**
55
+ * The Meta VR package name Launch should prefill when uploading the _first binary_.
56
+ * After successfully uploading the first binary, this package name cannot be changed.
57
+ *
58
+ * @note
59
+ * When using a bundle identifier ending with a `.` character, the bundle identifier is considered a prefix.
60
+ * The app name will be sluggified and appended after the `.` by default in attempt to keep this as unique as possible.
61
+ *
62
+ * When using a bundle identifier NOT ending with a `.` character, the bundle identifier is considered an absolute value.
63
+ * Make sure these bundle identifiers are unique enough to be registered when needed.
64
+ *
65
+ * @note `meta-vr` only
66
+ */
67
+ metaPackageName?: string;
68
+ }
69
+ export interface LaunchPlayStoreOptions {
70
+ /**
71
+ * The Play Store package name Launch should attempt to auto-select.
72
+ * If the user does not have access to an app with this package name,
73
+ * the user is asked what Play Store app they want to use.
74
+ *
75
+ * @note `play-store` only
76
+ */
77
+ googlePackageName?: string;
78
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["../../../src/utils/options.ts"],"names":[],"mappings":""}
@@ -0,0 +1,92 @@
1
+ import type { LaunchTarget } from './options';
2
+ export interface LaunchResult {
3
+ /** The Launch session identifier containing the project information */
4
+ id: string;
5
+ /** The Launch workflow that was started when the user finished the Launch flow */
6
+ workflow: LaunchWorkflowResult;
7
+ /** The Launch target that was finished by the user */
8
+ target: {
9
+ [T in LaunchTarget]: {
10
+ type: T;
11
+ } & LaunchTargetResults[T];
12
+ }[LaunchTarget];
13
+ }
14
+ interface LaunchTargetResults {
15
+ 'app-store': LaunchAppStoreResult;
16
+ 'play-store': LaunchPlayStoreResult;
17
+ 'meta-vr': LaunchMetaVrResult;
18
+ 'eas-hosting': LaunchEasHostingResult;
19
+ }
20
+ export interface LaunchWorkflowResult {
21
+ /** The Launch workflow identifier */
22
+ id: string;
23
+ /** The last known Launch workflow status */
24
+ status: 'NEW' | 'WAITING' | 'IN_PROGRESS' | 'ACTION_REQUIRED' | 'SUCCESS' | 'FAILURE' | 'CANCELED';
25
+ /** If the Launch workflow has ended, either successfully, failed, or canceled manually */
26
+ isFinished: boolean;
27
+ /** When the Launch workflow was started */
28
+ startedAt: string;
29
+ /** The Expo dashboard URL of the workflow itself */
30
+ dashboardUrl: string;
31
+ /** The Expo project identifier where the workflow is running */
32
+ projectId: string;
33
+ }
34
+ export interface LaunchAppStoreResult {
35
+ /** The App Store Connect URL of the app store listing itself */
36
+ appStoreConnectUrl: string;
37
+ /** The App Store Connect app store listing identifier */
38
+ appId: string;
39
+ /** The App Store Connect app store listing name, defined by the user */
40
+ appName: string;
41
+ /** The App Store Connect registered bundle identifier */
42
+ appBundleId: string;
43
+ /** The build version of the launched binary, only available after successful launch */
44
+ appBuildVersion: string | null;
45
+ /** The build number of the launched binary, only available after successful launch */
46
+ appBuildNumber: string | null;
47
+ }
48
+ export interface LaunchPlayStoreResult {
49
+ /** The Play Store Console URL of the app listing itself */
50
+ playConsoleUrl: string;
51
+ /** The Play Store Console app listing name, defined by the user */
52
+ appName: string;
53
+ /** The Play Store Console registered package name */
54
+ appPackageName: string;
55
+ /** The build version of the launched binary, only available after successful launch */
56
+ appBuildVersion: string | null;
57
+ /** The build number of the launched binary, only available after successful launch */
58
+ appBuildNumber: string | null;
59
+ /** The Play Store console release track the binary was launched to */
60
+ appTrackName: string;
61
+ }
62
+ export interface LaunchMetaVrResult {
63
+ /** The Meta VR dashboard URL of the app itself */
64
+ metaVrStoreUrl: string;
65
+ /** The Meta VR application identifier */
66
+ appId: string;
67
+ /** The Meta VR application name, defined by the user */
68
+ appName: string;
69
+ /** The Meta VR registered package name */
70
+ appPackageName: string;
71
+ /** The Meta VR release channel the binary was launched to */
72
+ appChannelName: string;
73
+ /**
74
+ * The Meta VR release channel invitation URL for testers.
75
+ * only available when this was turned on in the Meta VR dashboard at launch time.
76
+ */
77
+ appChannelShareUrl: string | null;
78
+ /** The Meta VR dashboard URL to change the release channel settings, like enabling share URLs */
79
+ appChannelSettingsUrl: string;
80
+ /** The build version of the launched binary, only available after successful launch */
81
+ appBuildVersion: string | null;
82
+ /** The build number of the launched binary, only available after successful launch */
83
+ appBuildNumber: string | null;
84
+ }
85
+ export interface LaunchEasHostingResult {
86
+ /**
87
+ * The EAS Hosting URL where the deployment was launched to.
88
+ * This can either be the production, alias, or unique deployment URL, in this exact order.
89
+ */
90
+ appUrl: string | null;
91
+ }
92
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result.js","sourceRoot":"","sources":["../../../src/utils/result.ts"],"names":[],"mappings":""}
@@ -0,0 +1,44 @@
1
+ import type { LaunchOptions } from './options';
2
+ export interface LaunchUrlOptions extends LaunchOptions {
3
+ /**
4
+ * The existing Launch URL to use instead of letting the user create a new Launch.
5
+ * This is returned when creating a new Launch session through the 3rd party API.
6
+ *
7
+ * @note
8
+ * Only use the exact Launch URL returned from the API, or define a different host.
9
+ * Do not define your own URL with custom paths, it's not guaranteed to work.
10
+ * @example
11
+ * https://launch.dev/expo/xxxxx
12
+ * https://launch--preview.expo.app/
13
+ */
14
+ launchUrl?: string;
15
+ /**
16
+ * The Expo session secret to authenticate users using provisioned Expo users.
17
+ * This will tie all created projects, certificates, and keystores, to this Expo account.
18
+ * You can reuse this Expo account to have all required Launch information repopulated on consecutive launches.
19
+ *
20
+ * @note Make sure you only share 1 Expo account with your own internal user.
21
+ */
22
+ expoSession?: string;
23
+ /**
24
+ * The name of the Launch partner which may enable specific styling.
25
+ * @note The value is defined by Expo
26
+ */
27
+ partner?: string;
28
+ }
29
+ /**
30
+ * Create a new Launch URL with the provided customizations.
31
+ * This URL can be used as either an iframe, or popup, to integrate with Launch.
32
+ */
33
+ export declare function createLaunchUrl(options: LaunchUrlOptions): string;
34
+ export interface LaunchAuthUrlOptions extends Required<Pick<LaunchUrlOptions, 'expoSession'>>, Pick<LaunchUrlOptions, 'launchUrl'> {
35
+ /**
36
+ * The URL Launch should redirect to after authenticating the user.
37
+ */
38
+ redirect: string;
39
+ }
40
+ /**
41
+ * Create a new Launch authentication redirect URL.
42
+ * This can only be used with the Expo Partner API.
43
+ */
44
+ export declare function createLaunchAuthUrl(options: LaunchAuthUrlOptions): string;
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Create a new Launch URL with the provided customizations.
3
+ * This URL can be used as either an iframe, or popup, to integrate with Launch.
4
+ */
5
+ export function createLaunchUrl(options) {
6
+ const launchUrl = new URL(options.launchUrl || 'https://launch.dev');
7
+ // Options - shared
8
+ if (options.targets)
9
+ launchUrl.searchParams.set('targets', options.targets.join(','));
10
+ if (options.projectId)
11
+ launchUrl.searchParams.set('projectId', options.projectId);
12
+ if (options.projectName)
13
+ launchUrl.searchParams.set('projectName', options.projectName);
14
+ // Options - App Store
15
+ if (options.appleAppId)
16
+ launchUrl.searchParams.set('appId', options.appleAppId);
17
+ if (options.appleAppName)
18
+ launchUrl.searchParams.set('appName', options.appleAppName);
19
+ if (options.appleBundleId)
20
+ launchUrl.searchParams.set('appBundleId', options.appleBundleId);
21
+ // Options - Meta VR
22
+ if (options.metaAppId)
23
+ launchUrl.searchParams.set('metaAppId', options.metaAppId);
24
+ if (options.metaPackageName) {
25
+ launchUrl.searchParams.set('metaPackageName', options.metaPackageName);
26
+ }
27
+ // Options - Play Store
28
+ if (options.googlePackageName) {
29
+ launchUrl.searchParams.set('googlePackageName', options.googlePackageName);
30
+ }
31
+ // Options - Launch styling
32
+ if (options.partner)
33
+ launchUrl.searchParams.set('partner', options.partner);
34
+ if (options.expoSession) {
35
+ return createLaunchAuthUrl({
36
+ expoSession: options.expoSession,
37
+ launchUrl: options.launchUrl,
38
+ redirect: launchUrl.toString(),
39
+ });
40
+ }
41
+ return launchUrl.toString();
42
+ }
43
+ /**
44
+ * Create a new Launch authentication redirect URL.
45
+ * This can only be used with the Expo Partner API.
46
+ */
47
+ export function createLaunchAuthUrl(options) {
48
+ const authUrl = new URL(options.launchUrl || 'https://launch.dev');
49
+ authUrl.pathname = '/auth';
50
+ authUrl.searchParams.set('token', options.expoSession);
51
+ authUrl.searchParams.set('redirect', options.redirect);
52
+ return authUrl.toString();
53
+ }
54
+ //# sourceMappingURL=url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"url.js","sourceRoot":"","sources":["../../../src/utils/url.ts"],"names":[],"mappings":"AAgCA;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,OAAyB;IACvD,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,SAAS,IAAI,oBAAoB,CAAC,CAAC;IAErE,mBAAmB;IACnB,IAAI,OAAO,CAAC,OAAO;QAAE,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACtF,IAAI,OAAO,CAAC,SAAS;QAAE,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAClF,IAAI,OAAO,CAAC,WAAW;QAAE,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;IAExF,sBAAsB;IACtB,IAAI,OAAO,CAAC,UAAU;QAAE,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAChF,IAAI,OAAO,CAAC,YAAY;QAAE,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC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,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEvD,OAAO,OAAO,CAAC,QAAQ,EAAE,CAAC;AAC5B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,53 @@
1
1
  {
2
2
  "name": "launch-sdk",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.1",
4
+ "description": "Integrate with Launch and let your users launch apps to app stores.",
5
+ "homepage": "https://launch.dev",
6
+ "author": {
7
+ "name": "Cedric van Putten",
8
+ "email": "npm@cedric.dev",
9
+ "url": "https://cedric.dev"
10
+ },
11
+ "files": [
12
+ "build",
13
+ "!**/*.tsbuildinfo",
14
+ "!**/__tests__/"
15
+ ],
16
+ "type": "module",
17
+ "exports": {
18
+ "./package.json": "./package.json",
19
+ ".": {
20
+ "types": "./build/src/index.d.ts",
21
+ "import": "./build/src/index.js"
22
+ },
23
+ "./internal": {
24
+ "types": "./build/src/internal.d.ts",
25
+ "import": "./build/src/internal.js"
26
+ },
27
+ "./react": {
28
+ "types": "./build/src/react.d.ts",
29
+ "import": "./build/src/react.js"
30
+ }
31
+ },
32
+ "scripts": {
33
+ "build": "tsc",
34
+ "format": "oxfmt",
35
+ "lint": "oxlint",
36
+ "test": "bun test",
37
+ "typecheck": "tsc --noEmit",
38
+ "prepack": "bun run build"
39
+ },
40
+ "devDependencies": {
41
+ "@types/react": "~19.2.18",
42
+ "react": "19.2.3",
43
+ "react-dom": "19.2.3"
44
+ },
45
+ "peerDependencies": {
46
+ "react": ">=19"
47
+ },
48
+ "peerDependenciesMeta": {
49
+ "react": {
50
+ "optional": true
51
+ }
52
+ }
53
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.