@whop/react-native 0.1.5 → 0.1.7
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/index.js +7 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +7 -2
- package/dist/cli/index.mjs.map +1 -1
- package/dist/lib/index.d.mts +5 -2
- package/dist/lib/index.d.ts +5 -2
- package/dist/lib/index.js +12 -2
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +12 -2
- package/dist/lib/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/cli/index.js
CHANGED
|
@@ -57,14 +57,19 @@ function env(key) {
|
|
|
57
57
|
}
|
|
58
58
|
return value;
|
|
59
59
|
}
|
|
60
|
+
var BASE_URL = process.env.WHOP_BASE_URL;
|
|
60
61
|
var COMPANY_ID = process.env.NEXT_PUBLIC_WHOP_COMPANY_ID;
|
|
61
62
|
var APP_ID = env("NEXT_PUBLIC_WHOP_APP_ID");
|
|
62
63
|
var AI_PROMPT_ID = process.env.AI_PROMPT_ID;
|
|
63
64
|
var oldWhopSdk = (0, import_api.WhopServerSdk)({
|
|
64
65
|
appApiKey: env("WHOP_API_KEY"),
|
|
65
|
-
appId: APP_ID
|
|
66
|
+
appId: APP_ID,
|
|
67
|
+
apiOrigin: BASE_URL ? new URL(BASE_URL).origin : void 0
|
|
68
|
+
});
|
|
69
|
+
var whopSdk = new import_sdk.default({
|
|
70
|
+
appID: APP_ID,
|
|
71
|
+
baseURL: BASE_URL ? new URL("/api/v1", BASE_URL).href : void 0
|
|
66
72
|
});
|
|
67
|
-
var whopSdk = new import_sdk.default({ appID: APP_ID });
|
|
68
73
|
|
|
69
74
|
// src/cli/file.ts
|
|
70
75
|
async function uploadFile(data, name, contentType) {
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/index.ts","../../src/cli/mobile.ts","../../src/cli/file.ts","../../src/cli/sdk.ts","../../src/cli/load-metro-config.ts","../../src/cli/valid-view-type.ts","../../src/cli/web.ts","../../src/cli/reanimated-bable.ts","../../src/cli/strip-flow.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { parseArgs } from \"node:util\";\nimport { findUp } from \"find-up\";\nimport qrcode from \"qrcode-terminal\";\nimport { rimraf } from \"rimraf\";\nimport { buildAndPublish } from \"./mobile\";\nimport { env } from \"./sdk\";\nimport { buildAndPublish as buildAndPublishWeb } from \"./web\";\n\nasync function main() {\n\tconst args = parseArgs({\n\t\toptions: {\n\t\t\tios: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t\tandroid: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t\tweb: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t},\n\t\tstrict: true,\n\t\tallowPositionals: true,\n\t\targs: process.argv.slice(2),\n\t});\n\n\tconst [command] = args.positionals;\n\n\tif (command === \"install\") {\n\t\tawait handleInstall();\n\t\treturn;\n\t}\n\n\tlet shouldBuild = true;\n\tlet shouldUpload = true;\n\tlet shouldClean = true;\n\tif (command === \"build\") {\n\t\tshouldUpload = false;\n\t} else if (command === \"ship\") {\n\t\tshouldBuild = true;\n\t\tshouldUpload = true;\n\t} else if (command === \"upload\") {\n\t\tshouldBuild = false;\n\t\tshouldClean = false;\n\t} else if (command === \"clean\") {\n\t\tshouldBuild = false;\n\t\tshouldUpload = false;\n\t} else {\n\t\tconsole.error(\n\t\t\t`Usage:\n\twhop-react-native ship [--ios] [--android] [--web] # runs build and then publishes it as a dev build to whop.\n\twhop-react-native build [--ios] [--android] [--web] # builds your app into a distributable bundle in the build/ directory.\n\twhop-react-native upload [--ios] [--android] [--web] # uploads the existing build directory to whop.\n\twhop-react-native clean # cleans the build directory.`,\n\t\t);\n\t\tprocess.exit(1);\n\t}\n\n\tconst root = await getRootProjectDirectory();\n\n\tif (shouldClean) {\n\t\tawait cleanBuildDirectory(root);\n\t}\n\n\tconst didProvidePlatform =\n\t\targs.values.ios || args.values.android || args.values.web;\n\n\tconst opts = { shouldBuild, shouldUpload };\n\tconst promises: Promise<void>[] = [];\n\n\tif (args.values.ios || !didProvidePlatform) {\n\t\tpromises.push(buildAndPublish(root, \"ios\", opts));\n\t}\n\tif (args.values.android || !didProvidePlatform) {\n\t\tpromises.push(buildAndPublish(root, \"android\", opts));\n\t}\n\tif (args.values.web || !didProvidePlatform) {\n\t\tpromises.push(buildAndPublishWeb(root, opts));\n\t}\n\n\tawait Promise.all(promises);\n}\n\nasync function cleanBuildDirectory(root: string) {\n\tconst buildDirectory = path.join(root, \"build\");\n\tif (existsSync(buildDirectory)) {\n\t\tawait rimraf(buildDirectory);\n\t}\n\tconsole.log(\" ✔︎ cleaned build directory\");\n}\n\nasync function getRootProjectDirectory() {\n\tconst file = await findUp(\"package.json\", { cwd: process.cwd() });\n\tif (!file) {\n\t\tthrow new Error(\n\t\t\t\"please run this command inside a whop react native project\",\n\t\t);\n\t}\n\tconst root = path.dirname(file);\n\treturn root;\n}\n\nasync function handleInstall() {\n\tconst appId = env(\"NEXT_PUBLIC_WHOP_APP_ID\");\n\tconst installLink = `https://whop.com/apps/${appId}/install`;\n\n\tconsole.log(`\nOpen this link in your browser to install the app into your whop.\n${installLink}\n\nOr scan the QR code with your iPhone:\n\t`);\n\n\tqrcode.generate(installLink, { small: true });\n}\n\nmain()\n\t.catch((err) => {\n\t\tconsole.error(err);\n\t\tprocess.exit(1);\n\t})\n\t.then(() => {\n\t\tprocess.exit(0);\n\t});\n","import { existsSync, readFileSync, readdirSync, statSync } from \"node:fs\";\nimport { mkdir, rename, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { getDefaultConfig, mergeConfig } from \"@react-native/metro-config\";\nimport { findUp } from \"find-up\";\nimport JSZip from \"jszip\";\nimport { type ReportableEvent, type Reporter, runBuild } from \"metro\";\nimport { getChecksum, uploadFile } from \"./file\";\nimport { loadMetroConfig } from \"./load-metro-config\";\nimport { AI_PROMPT_ID, APP_ID, COMPANY_ID, whopSdk } from \"./sdk\";\nimport { getSupportedAppViewTypes } from \"./valid-view-type\";\n\nexport async function buildAndPublish(\n\troot: string,\n\tplatform: \"ios\" | \"android\",\n\t{\n\t\tshouldBuild = true,\n\t\tshouldUpload = true,\n\t}: { shouldBuild: boolean; shouldUpload: boolean } = {\n\t\tshouldBuild: true,\n\t\tshouldUpload: true,\n\t},\n) {\n\tif (shouldBuild) {\n\t\tawait bundle(root, platform);\n\t}\n\tif (shouldUpload) {\n\t\tawait createMobileBuild(root, platform);\n\t}\n}\n\nexport async function bundle(root: string, platform: \"ios\" | \"android\") {\n\tawait makeEntrypoint(root, platform);\n\n\tconst outputFile = path.join(\n\t\troot,\n\t\t\"build\",\n\t\t\"output\",\n\t\tplatform,\n\t\t\"main_js_bundle\",\n\t);\n\n\tawait mkdir(path.dirname(outputFile), { recursive: true });\n\n\tconst babelLocation = require.resolve(\"@babel/runtime/package\");\n\n\tconst bableNodeModules = await findUp(\"node_modules\", {\n\t\tcwd: babelLocation,\n\t\ttype: \"directory\",\n\t});\n\n\tif (!bableNodeModules) {\n\t\tthrow new Error(\"babel node_modules parent folder not found\");\n\t}\n\n\tconst defaultConfig = getDefaultConfig(root);\n\tconst projectConfig = await loadMetroConfig(root);\n\n\tconst defaultMetroConfig = mergeConfig(defaultConfig, projectConfig);\n\n\tconst metroConfig = mergeConfig(defaultMetroConfig, {\n\t\tprojectRoot: root,\n\t\ttransformer: {\n\t\t\tbabelTransformerPath: require.resolve(\n\t\t\t\t\"./whop-react-native-babel-transformer.js\",\n\t\t\t),\n\t\t},\n\t\tcacheStores: [],\n\t\twatchFolders: [root, path.resolve(root, \"node_modules\"), bableNodeModules],\n\t\treporter: new CustomReporter(),\n\t\tresolver: {\n\t\t\tnodeModulesPaths: [\n\t\t\t\t...(defaultMetroConfig.resolver?.nodeModulesPaths ?? []),\n\t\t\t\tbableNodeModules,\n\t\t\t],\n\t\t},\n\t});\n\n\tawait runBuild(metroConfig, {\n\t\tdev: false,\n\t\tentry: `build/entrypoints/${platform}/index.js`,\n\t\tminify: false,\n\t\tplatform: platform,\n\t\tsourceMap: false,\n\t\tout: outputFile,\n\t});\n\n\tawait rename(\n\t\t`${outputFile}.js`,\n\t\tpath.join(root, \"build\", \"output\", platform, \"main_js_bundle.hbc\"),\n\t);\n\n\tconsole.log(` ✔︎ [${platform}] bundle created`);\n}\n\n// getSupportedAppViewTypes moved to valid-view-type.ts\n\nasync function makeEntrypoint(\n\troot: string,\n\tplatform: \"ios\" | \"android\",\n): Promise<string> {\n\tconst entrypoint = path.join(\n\t\troot,\n\t\t\"build\",\n\t\t\"entrypoints\",\n\t\tplatform,\n\t\t\"index.js\",\n\t);\n\n\tconst files = await getSupportedAppViewTypes(root);\n\n\tconst pascalCase = (str: string) =>\n\t\tstr\n\t\t\t.split(\"-\")\n\t\t\t.map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n\t\t\t.join(\"\");\n\n\tconst imports = files.map(\n\t\t(file) =>\n\t\t\t`import { ${pascalCase(file)} } from \"../../../src/views/${file}\";`,\n\t);\n\tconst registry = files.map(\n\t\t(file) =>\n\t\t\t`AppRegistry.registerComponent(\"${pascalCase(file)}\", () => ${pascalCase(\n\t\t\t\tfile,\n\t\t\t)});`,\n\t);\n\n\tconst entrypointContent = `import { AppRegistry } from \"react-native\";\n${imports.join(\"\\n\")}\n\n${registry.join(\"\\n\")}\n`;\n\n\tconst entrypointDir = path.dirname(entrypoint);\n\tawait mkdir(entrypointDir, { recursive: true });\n\tawait writeFile(entrypoint, entrypointContent, \"utf-8\");\n\n\tconsole.log(` ✔︎ [${platform}] entrypoint created`);\n\n\treturn entrypoint;\n}\n\nexport async function createMobileBuild(\n\troot: string,\n\tplatform: \"ios\" | \"android\",\n) {\n\tconst viewTypes = await getSupportedAppViewTypes(root);\n\n\tconst fullDirectory = path.join(root, \"build\", \"output\", platform);\n\n\t// Check if the directory contains a file called `main_js_bundle.hbc`\n\tconst mainJsBundle = path.join(fullDirectory, \"main_js_bundle.hbc\");\n\n\tif (!existsSync(mainJsBundle)) {\n\t\tthrow new Error(`main_js_bundle.hbc not found in ${fullDirectory}`);\n\t}\n\n\t// check that that folder only contains the main_js_bundle.hbc file and an optional `assets` folder\n\tconst files = readdirSync(fullDirectory);\n\tif (\n\t\tfiles.length > 2 ||\n\t\tfiles.length < 1 ||\n\t\t!files.includes(\"main_js_bundle.hbc\")\n\t) {\n\t\tthrow new Error(\n\t\t\t\"Directory must contain only the main_js_bundle.hbc file and an optional `assets` folder\",\n\t\t);\n\t}\n\tif (files.length === 2 && !files.includes(\"assets\")) {\n\t\tthrow new Error(\n\t\t\t\"Directory must contain only the main_js_bundle.hbc file and an optional `assets` folder\",\n\t\t);\n\t}\n\n\t// Zip the directory\n\tconst zipData = await zipDirectory(fullDirectory);\n\n\tconst checksum = await getChecksum(zipData);\n\n\tconsole.log(` ✔︎ [${platform}] build zipped with checksum: ${checksum}`);\n\n\tconst fileName = `app_build_${platform}.zip`;\n\tconst uploadedFile = await uploadFile(zipData, fileName, \"application/zip\");\n\n\tconsole.log(\n\t\t` ✔︎ [${platform}] uploaded build: ${fileName} (${(\n\t\t\tzipData.length / 1024\n\t\t).toFixed(0)} KB)`,\n\t);\n\n\tconst build = await whopSdk.appBuilds.create({\n\t\tattachment: { direct_upload_id: uploadedFile.directUploadId },\n\t\tchecksum,\n\t\tapp_id: APP_ID,\n\t\tplatform,\n\t\tai_prompt_id: AI_PROMPT_ID,\n\t\tsupported_app_view_types: viewTypes.map(\n\t\t\t(view) =>\n\t\t\t\t({\n\t\t\t\t\t\"experience-view\": \"hub\" as const,\n\t\t\t\t\t\"discover-view\": \"discover\" as const,\n\t\t\t\t\t\"dashboard-view\": \"dashboard\" as const,\n\t\t\t\t})[view],\n\t\t),\n\t});\n\n\tif (!build) {\n\t\tthrow new Error(\"Failed to create app build\");\n\t}\n\n\tconst companyPart = COMPANY_ID ? `${COMPANY_ID}/` : \"\";\n\tconst dashboardUrl = `https://whop.com/dashboard/${companyPart}developer/apps/${APP_ID}/builds/?platform=${platform}`;\n\n\tconsole.log(`\\n ✔︎ [${platform}] deployed as development build ✔︎\n - build id: ${build.id}\n - view types: ${build.supported_app_view_types.join(\", \")}\n - promote to production here: ${dashboardUrl}\\n`);\n\n\treturn build;\n}\n\nasync function zipDirectory(\n\tdirectory: string,\n): Promise<Buffer<ArrayBufferLike>> {\n\tconst zip = new JSZip();\n\n\t// Recursively add files to zip\n\tfunction addFilesToZip(currentPath: string, relativePath = \"\") {\n\t\tconst items = readdirSync(currentPath);\n\n\t\tfor (const item of items) {\n\t\t\tconst fullPath = path.join(currentPath, item);\n\t\t\tconst zipPath = relativePath ? path.join(relativePath, item) : item;\n\t\t\tconst stats = statSync(fullPath);\n\n\t\t\tif (stats.isDirectory()) {\n\t\t\t\taddFilesToZip(fullPath, zipPath);\n\t\t\t} else {\n\t\t\t\tconst fileContent = readFileSync(fullPath);\n\t\t\t\tzip.file(zipPath, fileContent);\n\t\t\t}\n\t\t}\n\t}\n\n\taddFilesToZip(directory);\n\n\t// Generate zip file\n\tconst zipData = await zip.generateAsync({ type: \"nodebuffer\" });\n\n\treturn zipData;\n}\n\nclass CustomReporter implements Reporter {\n\tupdate(event: ReportableEvent) {\n\t\t// Do nothing.\n\t}\n}\n","import { createHash } from \"node:crypto\";\nimport { APP_ID, oldWhopSdk } from \"./sdk\";\n\nexport async function uploadFile(\n\tdata: Buffer<ArrayBufferLike>,\n\tname: string,\n\tcontentType: string,\n) {\n\tconst file = new File([data], name, {\n\t\ttype: contentType,\n\t});\n\n\tconst uploadedFile = await oldWhopSdk.attachments.uploadAttachment({\n\t\tfile,\n\t\trecord: \"app\",\n\t\tid: APP_ID,\n\t});\n\n\treturn uploadedFile;\n}\n\nexport async function getChecksum(data: Buffer<ArrayBufferLike>) {\n\tconst hash = createHash(\"sha256\");\n\thash.update(data);\n\treturn hash.digest(\"hex\");\n}\n","import { WhopServerSdk } from \"@whop/api\";\nimport Whop from \"@whop/sdk\";\nimport { config } from \"dotenv\";\n\nconfig({\n\tpath: [\".env\", \".env.local\", \".env.development\", \".env.production\"],\n});\n\nexport function env(key: string) {\n\tconst value = process.env[key];\n\tif (!value) {\n\t\tthrow new Error(`Missing environment variable: ${key}`);\n\t}\n\treturn value;\n}\n\nexport const COMPANY_ID = process.env.NEXT_PUBLIC_WHOP_COMPANY_ID;\nexport const APP_ID = env(\"NEXT_PUBLIC_WHOP_APP_ID\");\nexport const AI_PROMPT_ID = process.env.AI_PROMPT_ID;\n\nexport const oldWhopSdk: WhopServerSdk = WhopServerSdk({\n\tappApiKey: env(\"WHOP_API_KEY\"),\n\tappId: APP_ID,\n});\n\nexport const whopSdk = new Whop({ appID: APP_ID });\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { loadConfig } from \"metro\";\n\nexport async function loadMetroConfig(projectRoot: string) {\n\tconst file = fs.existsSync(path.join(projectRoot, \"metro.config.js\"));\n\tif (!file) return {};\n\treturn await loadConfig({ cwd: projectRoot }, {});\n}\n","import { readdir } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nexport const VALID_VIEW_TYPES = [\n\t\"experience-view\",\n\t\"discover-view\",\n\t\"dashboard-view\",\n] as const;\n\nexport async function getSupportedAppViewTypes(\n\troot: string,\n): Promise<(typeof VALID_VIEW_TYPES)[number][]> {\n\tconst views = await readdir(path.join(root, \"src\", \"views\"), {\n\t\twithFileTypes: true,\n\t\trecursive: false,\n\t});\n\tconst files = views\n\t\t.filter((file) => file.isFile())\n\t\t.map((file) => file.name.split(\".\")[0])\n\t\t.filter((file) => !!file);\n\n\tconst validViews = files.filter((file) =>\n\t\tVALID_VIEW_TYPES.includes(file as (typeof VALID_VIEW_TYPES)[number]),\n\t) as (typeof VALID_VIEW_TYPES)[number][];\n\n\tif (validViews.length === 0) {\n\t\tthrow new Error(\n\t\t\t`No valid views found, please create a view in the src/views folder and name it with a valid view type: ${VALID_VIEW_TYPES.join(\", \")}`,\n\t\t);\n\t}\n\n\treturn validViews;\n}\n","import { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { build } from \"esbuild\";\nimport { getChecksum, uploadFile } from \"./file\";\nimport { reanimatedBabelPlugin } from \"./reanimated-bable\";\nimport { AI_PROMPT_ID, APP_ID, COMPANY_ID, whopSdk } from \"./sdk\";\nimport { stripFlowWithBabel } from \"./strip-flow\";\nimport { getSupportedAppViewTypes } from \"./valid-view-type\";\n\nfunction aliasReactNativePlugin() {\n\treturn {\n\t\tname: \"alias-react-native\",\n\t\tsetup(b: import(\"esbuild\").PluginBuild) {\n\t\t\tb.onResolve({ filter: /^react-native$/ }, () => ({\n\t\t\t\tpath: require.resolve(\"react-native-web\"),\n\t\t\t}));\n\t\t},\n\t} satisfies import(\"esbuild\").Plugin;\n}\n\nfunction forceSingleReact() {\n\tconst map = new Map<string, string>([\n\t\t[\"react\", require.resolve(\"react\")],\n\t\t[\"react/jsx-runtime\", require.resolve(\"react/jsx-runtime\")],\n\t\t[\"react/jsx-dev-runtime\", require.resolve(\"react/jsx-dev-runtime\")],\n\t\t[\"react-dom\", require.resolve(\"react-dom\")],\n\t\t[\"react-dom/client\", require.resolve(\"react-dom/client\")],\n\t]);\n\n\tconst rx = /^(react(?:\\/jsx-(?:dev-)?runtime)?|react-dom(?:\\/client)?)$/;\n\n\treturn {\n\t\tname: \"force-single-react\",\n\t\tsetup(b: import(\"esbuild\").PluginBuild) {\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: <explanation>\n\t\t\tb.onResolve({ filter: rx }, (args) => ({ path: map.get(args.path)! }));\n\t\t},\n\t} satisfies import(\"esbuild\").Plugin;\n}\n\nfunction toPascalCase(str: string) {\n\treturn str\n\t\t.split(\"-\")\n\t\t.map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n\t\t.join(\"\");\n}\n\nasync function makeWebEntrypoint(root: string) {\n\tconst files = await getSupportedAppViewTypes(root);\n\n\tconst packageJsonPath = path.join(root, \"package.json\");\n\tconst packageJson = JSON.parse(await readFile(packageJsonPath, \"utf-8\"));\n\tconst hasReactNativeReanimated =\n\t\tpackageJson.dependencies?.[\"react-native-reanimated\"];\n\n\tconst imports = files.map(\n\t\t(file) =>\n\t\t\t`import { ${toPascalCase(file)} } from \"../../../src/views/${file}\";`,\n\t);\n\tconst registry = files.map(\n\t\t(file) =>\n\t\t\t`AppRegistry.registerComponent(\"${toPascalCase(\n\t\t\t\tfile,\n\t\t\t)}\", () => WhopNavigationWrapper(React, \"${toPascalCase(\n\t\t\t\tfile,\n\t\t\t)}\", ${toPascalCase(file)}));`,\n\t);\n\n\tconst defaultKey = toPascalCase(files[0] ?? \"experience-view\");\n\tconst reanimatedImport = hasReactNativeReanimated\n\t\t? `import \"react-native-reanimated\";`\n\t\t: \"\";\n\n\tconst entry = `import { AppRegistry } from \"react-native\";\nimport * as React from \"react\";\nimport { WhopNavigationWrapper } from \"@whop/react-native/web\";\n${reanimatedImport}\n\n${imports.join(\"\\n\")}\n\n${registry.join(\"\\n\")}\n\nconst viewType = new URLSearchParams(window.location.search).get(\"app_view\") ?? \"${defaultKey}\";\n\nconst root = document.getElementById(\"root\") || (() => {\n\tconst d = document.createElement(\"div\");\n\td.id = \"root\";\n\tdocument.body.appendChild(d);\n\treturn d;\n})();\nAppRegistry.runApplication(viewType, { rootTag: root });\n`;\n\n\tconst entryFile = path.join(root, \"build\", \"entrypoints\", \"web\", \"index.tsx\");\n\tawait mkdir(path.dirname(entryFile), { recursive: true });\n\tawait writeFile(entryFile, entry, \"utf-8\");\n\n\treturn entryFile;\n}\n\nexport async function bundleWeb(root: string) {\n\tconst entry = await makeWebEntrypoint(root);\n\n\tconst outDir = path.join(root, \"build\", \"output\", \"web\");\n\tawait mkdir(outDir, { recursive: true });\n\n\tawait build({\n\t\tentryPoints: [entry],\n\t\toutfile: path.join(outDir, \"main.js\"),\n\t\tbundle: true,\n\t\tminify: false,\n\t\tformat: \"esm\",\n\t\tplatform: \"browser\",\n\t\tsourcemap: false,\n\t\tjsx: \"automatic\",\n\t\tmainFields: [\"browser\", \"module\", \"main\"],\n\t\tconditions: [\"browser\", \"import\", \"default\"],\n\t\tdefine: {\n\t\t\tprocess: \"{}\",\n\t\t\t\"process.env\": \"{}\",\n\t\t\t\"process.env.NODE_ENV\": '\"production\"',\n\t\t\t__DEV__: \"false\",\n\t\t\t\"process.env.NEXT_PUBLIC_WHOP_APP_ID\": `\"${APP_ID}\"`,\n\t\t\t// Some RN libraries (e.g., RNGH) expect a Node-like global in the browser\n\t\t\tglobal: \"globalThis\",\n\t\t},\n\t\tresolveExtensions: [\n\t\t\t\".web.tsx\",\n\t\t\t\".web.ts\",\n\t\t\t\".web.js\",\n\t\t\t\".tsx\",\n\t\t\t\".ts\",\n\t\t\t\".jsx\",\n\t\t\t\".js\",\n\t\t],\n\t\tloader: {\n\t\t\t\".png\": \"dataurl\",\n\t\t\t\".jpg\": \"dataurl\",\n\t\t\t\".jpeg\": \"dataurl\",\n\t\t\t\".svg\": \"dataurl\",\n\t\t\t\".ttf\": \"dataurl\",\n\t\t\t\".woff\": \"dataurl\",\n\t\t\t\".woff2\": \"dataurl\",\n\t\t\t\".js\": \"jsx\",\n\t\t\t\".jsx\": \"jsx\",\n\t\t},\n\t\tplugins: [\n\t\t\tforceSingleReact(),\n\t\t\taliasReactNativePlugin(),\n\t\t\treanimatedBabelPlugin(),\n\t\t\tstripFlowWithBabel(),\n\t\t\t{\n\t\t\t\tname: \"force-native-web-stub\",\n\t\t\t\tsetup(b) {\n\t\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\t\t\t\tb.onResolve({ filter: /^\\.\\/native-whop-core$/ }, (args: any) => {\n\t\t\t\t\t\t// Always resolve the local source file so extension resolution (.web.ts) applies\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tpath: path.join(args.resolveDir, \"native-whop-core\"),\n\t\t\t\t\t\t\tnamespace: \"file\",\n\t\t\t\t\t\t};\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t});\n\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\" />\n\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n\t\t<title>Whop App (Web)</title>\n\t\t<style>\n\t\t\t#root {\n\t\t\t\twidth: 100vw;\n\t\t\t\theight: 100vh;\n\t\t\t\tmargin: 0;\n\t\t\t\tpadding: 0;\n\t\t\t\toverflow: hidden;\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: stretch;\n\t\t\t\tjustify-content: start;\n\t\t\t}\n\t\t</style>\n\t</head>\n\t<body>\n\t\t<div id=\"root\"></div>\n\t\t<script type=\"module\" src=\"./main.js\"></script>\n\t</body>\n</html>`;\n\tawait writeFile(path.join(outDir, \"index.html\"), html, \"utf-8\");\n\n\tconsole.log(\" ✔︎ [web] bundle created at build/output/web/main.js\");\n}\n\nexport async function buildAndPublish(\n\troot: string,\n\t{\n\t\tshouldBuild = true,\n\t\tshouldUpload = true,\n\t}: { shouldBuild: boolean; shouldUpload: boolean } = {\n\t\tshouldBuild: true,\n\t\tshouldUpload: true,\n\t},\n) {\n\tif (shouldBuild) {\n\t\tawait bundleWeb(root);\n\t}\n\tif (shouldUpload) {\n\t\tawait createWebBuild(root);\n\t}\n}\n\nexport async function createWebBuild(root: string) {\n\tconst viewTypes = await getSupportedAppViewTypes(root);\n\n\tconst fullDirectory = path.join(root, \"build\", \"output\", \"web\");\n\tconst mainJsFile = path.join(fullDirectory, \"main.js\");\n\n\t// Verify bundle exists\n\ttry {\n\t\tawait readFile(mainJsFile);\n\t} catch {\n\t\tthrow new Error(`main.js not found in ${fullDirectory}`);\n\t}\n\n\tconst buf = await readFile(mainJsFile);\n\tconst checksum = await getChecksum(buf);\n\n\tconsole.log(` ✔︎ [web] build checksummed: ${checksum}`);\n\n\tconst fileName = `rnweb_${checksum}.js`;\n\tconst uploadedFile = await uploadFile(\n\t\tbuf,\n\t\tfileName,\n\t\t\"application/javascript\",\n\t);\n\n\tconsole.log(\n\t\t` ✔︎ [web] uploaded build: ${fileName} (${(buf.length / 1024).toFixed(\n\t\t\t0,\n\t\t)} KB)`,\n\t);\n\n\tconst build = await whopSdk.appBuilds.create({\n\t\tattachment: { direct_upload_id: uploadedFile.directUploadId },\n\t\tchecksum,\n\t\tapp_id: APP_ID,\n\t\tplatform: \"web\",\n\t\tai_prompt_id: AI_PROMPT_ID,\n\t\tsupported_app_view_types: viewTypes.map(\n\t\t\t(view) =>\n\t\t\t\t({\n\t\t\t\t\t\"experience-view\": \"hub\" as const,\n\t\t\t\t\t\"discover-view\": \"discover\" as const,\n\t\t\t\t\t\"dashboard-view\": \"dashboard\" as const,\n\t\t\t\t})[view],\n\t\t),\n\t});\n\n\tif (!build) {\n\t\tthrow new Error(\"Failed to create app build\");\n\t}\n\n\tconst companyPart = COMPANY_ID ? `${COMPANY_ID}/` : \"\";\n\tconst dashboardUrl = `https://whop.com/dashboard/${companyPart}developer/apps/${APP_ID}/builds/?platform=web`;\n\n\tconsole.log(\n\t\t`\\n ✔︎ [web] deployed as development build ✔︎\\n - build id: ${\n\t\t\tbuild.id\n\t\t}\\n - view types: ${build.supported_app_view_types.join(\n\t\t\t\", \",\n\t\t)}\\n - promote to production here: ${dashboardUrl}\\n`,\n\t);\n\n\treturn build;\n}\n","import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n// build/plugins/reanimatedBabel.ts\nimport * as babel from \"@babel/core\";\n\nconst JS_RE = /\\.(m|c)?(t|j)sx?$/;\n\nexport function reanimatedBabelPlugin() {\n\t// Transform only: your app source (outside node_modules) and reanimated itself.\n\tconst shouldTransform = (p: string) => {\n\t\tif (!JS_RE.test(p)) return false;\n\t\t// Always run on reanimated’s files\n\t\tif (p.includes(`${path.sep}react-native-reanimated${path.sep}`))\n\t\t\treturn true;\n\t\t// Never touch third-party deps\n\t\tif (p.includes(`${path.sep}node_modules${path.sep}`)) return false;\n\t\t// Run on app code under src/\n\t\treturn p.includes(`${path.sep}src${path.sep}`);\n\t};\n\n\treturn {\n\t\tname: \"reanimated-babel\",\n\t\tsetup(b: import(\"esbuild\").PluginBuild) {\n\t\t\tb.onLoad({ filter: JS_RE }, async (args) => {\n\t\t\t\tif (!shouldTransform(args.path)) {\n\t\t\t\t\t// Skip non-target files so other plugins (and esbuild) can process them\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst code = await fs.readFile(args.path, \"utf8\");\n\t\t\t\tconst result = await babel.transformAsync(code, {\n\t\t\t\t\tfilename: args.path,\n\t\t\t\t\tsourceMaps: false,\n\t\t\t\t\tbabelrc: false,\n\t\t\t\t\tconfigFile: false,\n\t\t\t\t\t// ORDER MATTERS: Reanimated plugin MUST BE LAST\n\t\t\t\t\tplugins: [\n\t\t\t\t\t\t// Needed by Reanimated on web per docs\n\t\t\t\t\t\t\"@babel/plugin-transform-export-namespace-from\",\n\t\t\t\t\t\t// Handle Flow types present in some RN libs\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"@babel/plugin-transform-flow-strip-types\",\n\t\t\t\t\t\t\t{ allowDeclareFields: true },\n\t\t\t\t\t\t],\n\t\t\t\t\t\t// MUST be last\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"react-native-reanimated/plugin\",\n\t\t\t\t\t\t\t{ relativeSourceLocation: true },\n\t\t\t\t\t\t],\n\t\t\t\t\t],\n\t\t\t\t\tpresets: [], // esbuild handles TS/JSX syntax; no preset-env/preset-react\n\t\t\t\t\tcaller: { name: \"esbuild\" },\n\t\t\t\t\t// Let Babel parse TS/JSX/Flow; keep it broad\n\t\t\t\t\tparserOpts: { plugins: [\"jsx\", \"typescript\"] },\n\t\t\t\t\tgeneratorOpts: { decoratorsBeforeExport: true },\n\t\t\t\t});\n\n\t\t\t\treturn {\n\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: <explanation>\n\t\t\t\t\tcontents: result!.code!,\n\t\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\t\t\t\tloader: pickLoader(args.path) as any,\n\t\t\t\t};\n\t\t\t});\n\t\t},\n\t};\n}\n\nfunction pickLoader(file: string) {\n\tconst ext = path.extname(file).toLowerCase();\n\tif (ext === \".tsx\") return \"tsx\";\n\tif (ext === \".ts\") return \"ts\";\n\tif (ext === \".jsx\") return \"jsx\";\n\t// For .js: many RN libs contain JSX; be permissive\n\treturn \"jsx\";\n}\n","import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n// stripFlowWithBabel.ts\nimport * as babel from \"@babel/core\";\n\nexport function stripFlowWithBabel() {\n\tconst filter = /\\.(m|c)?jsx?$/;\n\treturn {\n\t\tname: \"strip-flow-with-babel\",\n\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\tsetup(b: any) {\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\t\tb.onLoad({ filter }, async (args: any) => {\n\t\t\t\t// Only process react-native core files that contain Flow\n\t\t\t\tif (!args.path.includes(`${path.sep}react-native${path.sep}`)) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst code = await fs.readFile(args.path, \"utf8\");\n\t\t\t\tconst out = await babel.transformAsync(code, {\n\t\t\t\t\tfilename: args.path,\n\t\t\t\t\tbabelrc: false,\n\t\t\t\t\tconfigFile: false,\n\t\t\t\t\tplugins: [\n\t\t\t\t\t\t// Use Hermes parser to handle modern Flow syntax (as casts, type predicates, mapped types, etc.)\n\t\t\t\t\t\t\"babel-plugin-syntax-hermes-parser\",\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"@babel/plugin-transform-flow-strip-types\",\n\t\t\t\t\t\t\t{ allowDeclareFields: true },\n\t\t\t\t\t\t],\n\t\t\t\t\t],\n\t\t\t\t\tsourceMaps: false,\n\t\t\t\t});\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: <explanation>\n\t\t\t\treturn { contents: out!.code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ro","Whop","fs","path","import_node_path","path","path","build","JSZip","import_promises","import_node_path","fs","path","fs","path","babel","path","buildAndPublish","build","buildAndPublish","path","qrcode"]}
|
|
1
|
+
{"version":3,"sources":["../../src/cli/index.ts","../../src/cli/mobile.ts","../../src/cli/file.ts","../../src/cli/sdk.ts","../../src/cli/load-metro-config.ts","../../src/cli/valid-view-type.ts","../../src/cli/web.ts","../../src/cli/reanimated-bable.ts","../../src/cli/strip-flow.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { parseArgs } from \"node:util\";\nimport { findUp } from \"find-up\";\nimport qrcode from \"qrcode-terminal\";\nimport { rimraf } from \"rimraf\";\nimport { buildAndPublish } from \"./mobile\";\nimport { env } from \"./sdk\";\nimport { buildAndPublish as buildAndPublishWeb } from \"./web\";\n\nasync function main() {\n\tconst args = parseArgs({\n\t\toptions: {\n\t\t\tios: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t\tandroid: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t\tweb: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t},\n\t\tstrict: true,\n\t\tallowPositionals: true,\n\t\targs: process.argv.slice(2),\n\t});\n\n\tconst [command] = args.positionals;\n\n\tif (command === \"install\") {\n\t\tawait handleInstall();\n\t\treturn;\n\t}\n\n\tlet shouldBuild = true;\n\tlet shouldUpload = true;\n\tlet shouldClean = true;\n\tif (command === \"build\") {\n\t\tshouldUpload = false;\n\t} else if (command === \"ship\") {\n\t\tshouldBuild = true;\n\t\tshouldUpload = true;\n\t} else if (command === \"upload\") {\n\t\tshouldBuild = false;\n\t\tshouldClean = false;\n\t} else if (command === \"clean\") {\n\t\tshouldBuild = false;\n\t\tshouldUpload = false;\n\t} else {\n\t\tconsole.error(\n\t\t\t`Usage:\n\twhop-react-native ship [--ios] [--android] [--web] # runs build and then publishes it as a dev build to whop.\n\twhop-react-native build [--ios] [--android] [--web] # builds your app into a distributable bundle in the build/ directory.\n\twhop-react-native upload [--ios] [--android] [--web] # uploads the existing build directory to whop.\n\twhop-react-native clean # cleans the build directory.`,\n\t\t);\n\t\tprocess.exit(1);\n\t}\n\n\tconst root = await getRootProjectDirectory();\n\n\tif (shouldClean) {\n\t\tawait cleanBuildDirectory(root);\n\t}\n\n\tconst didProvidePlatform =\n\t\targs.values.ios || args.values.android || args.values.web;\n\n\tconst opts = { shouldBuild, shouldUpload };\n\tconst promises: Promise<void>[] = [];\n\n\tif (args.values.ios || !didProvidePlatform) {\n\t\tpromises.push(buildAndPublish(root, \"ios\", opts));\n\t}\n\tif (args.values.android || !didProvidePlatform) {\n\t\tpromises.push(buildAndPublish(root, \"android\", opts));\n\t}\n\tif (args.values.web || !didProvidePlatform) {\n\t\tpromises.push(buildAndPublishWeb(root, opts));\n\t}\n\n\tawait Promise.all(promises);\n}\n\nasync function cleanBuildDirectory(root: string) {\n\tconst buildDirectory = path.join(root, \"build\");\n\tif (existsSync(buildDirectory)) {\n\t\tawait rimraf(buildDirectory);\n\t}\n\tconsole.log(\" ✔︎ cleaned build directory\");\n}\n\nasync function getRootProjectDirectory() {\n\tconst file = await findUp(\"package.json\", { cwd: process.cwd() });\n\tif (!file) {\n\t\tthrow new Error(\n\t\t\t\"please run this command inside a whop react native project\",\n\t\t);\n\t}\n\tconst root = path.dirname(file);\n\treturn root;\n}\n\nasync function handleInstall() {\n\tconst appId = env(\"NEXT_PUBLIC_WHOP_APP_ID\");\n\tconst installLink = `https://whop.com/apps/${appId}/install`;\n\n\tconsole.log(`\nOpen this link in your browser to install the app into your whop.\n${installLink}\n\nOr scan the QR code with your iPhone:\n\t`);\n\n\tqrcode.generate(installLink, { small: true });\n}\n\nmain()\n\t.catch((err) => {\n\t\tconsole.error(err);\n\t\tprocess.exit(1);\n\t})\n\t.then(() => {\n\t\tprocess.exit(0);\n\t});\n","import { existsSync, readFileSync, readdirSync, statSync } from \"node:fs\";\nimport { mkdir, rename, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { getDefaultConfig, mergeConfig } from \"@react-native/metro-config\";\nimport { findUp } from \"find-up\";\nimport JSZip from \"jszip\";\nimport { type ReportableEvent, type Reporter, runBuild } from \"metro\";\nimport { getChecksum, uploadFile } from \"./file\";\nimport { loadMetroConfig } from \"./load-metro-config\";\nimport { AI_PROMPT_ID, APP_ID, COMPANY_ID, whopSdk } from \"./sdk\";\nimport { getSupportedAppViewTypes } from \"./valid-view-type\";\n\nexport async function buildAndPublish(\n\troot: string,\n\tplatform: \"ios\" | \"android\",\n\t{\n\t\tshouldBuild = true,\n\t\tshouldUpload = true,\n\t}: { shouldBuild: boolean; shouldUpload: boolean } = {\n\t\tshouldBuild: true,\n\t\tshouldUpload: true,\n\t},\n) {\n\tif (shouldBuild) {\n\t\tawait bundle(root, platform);\n\t}\n\tif (shouldUpload) {\n\t\tawait createMobileBuild(root, platform);\n\t}\n}\n\nexport async function bundle(root: string, platform: \"ios\" | \"android\") {\n\tawait makeEntrypoint(root, platform);\n\n\tconst outputFile = path.join(\n\t\troot,\n\t\t\"build\",\n\t\t\"output\",\n\t\tplatform,\n\t\t\"main_js_bundle\",\n\t);\n\n\tawait mkdir(path.dirname(outputFile), { recursive: true });\n\n\tconst babelLocation = require.resolve(\"@babel/runtime/package\");\n\n\tconst bableNodeModules = await findUp(\"node_modules\", {\n\t\tcwd: babelLocation,\n\t\ttype: \"directory\",\n\t});\n\n\tif (!bableNodeModules) {\n\t\tthrow new Error(\"babel node_modules parent folder not found\");\n\t}\n\n\tconst defaultConfig = getDefaultConfig(root);\n\tconst projectConfig = await loadMetroConfig(root);\n\n\tconst defaultMetroConfig = mergeConfig(defaultConfig, projectConfig);\n\n\tconst metroConfig = mergeConfig(defaultMetroConfig, {\n\t\tprojectRoot: root,\n\t\ttransformer: {\n\t\t\tbabelTransformerPath: require.resolve(\n\t\t\t\t\"./whop-react-native-babel-transformer.js\",\n\t\t\t),\n\t\t},\n\t\tcacheStores: [],\n\t\twatchFolders: [root, path.resolve(root, \"node_modules\"), bableNodeModules],\n\t\treporter: new CustomReporter(),\n\t\tresolver: {\n\t\t\tnodeModulesPaths: [\n\t\t\t\t...(defaultMetroConfig.resolver?.nodeModulesPaths ?? []),\n\t\t\t\tbableNodeModules,\n\t\t\t],\n\t\t},\n\t});\n\n\tawait runBuild(metroConfig, {\n\t\tdev: false,\n\t\tentry: `build/entrypoints/${platform}/index.js`,\n\t\tminify: false,\n\t\tplatform: platform,\n\t\tsourceMap: false,\n\t\tout: outputFile,\n\t});\n\n\tawait rename(\n\t\t`${outputFile}.js`,\n\t\tpath.join(root, \"build\", \"output\", platform, \"main_js_bundle.hbc\"),\n\t);\n\n\tconsole.log(` ✔︎ [${platform}] bundle created`);\n}\n\n// getSupportedAppViewTypes moved to valid-view-type.ts\n\nasync function makeEntrypoint(\n\troot: string,\n\tplatform: \"ios\" | \"android\",\n): Promise<string> {\n\tconst entrypoint = path.join(\n\t\troot,\n\t\t\"build\",\n\t\t\"entrypoints\",\n\t\tplatform,\n\t\t\"index.js\",\n\t);\n\n\tconst files = await getSupportedAppViewTypes(root);\n\n\tconst pascalCase = (str: string) =>\n\t\tstr\n\t\t\t.split(\"-\")\n\t\t\t.map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n\t\t\t.join(\"\");\n\n\tconst imports = files.map(\n\t\t(file) =>\n\t\t\t`import { ${pascalCase(file)} } from \"../../../src/views/${file}\";`,\n\t);\n\tconst registry = files.map(\n\t\t(file) =>\n\t\t\t`AppRegistry.registerComponent(\"${pascalCase(file)}\", () => ${pascalCase(\n\t\t\t\tfile,\n\t\t\t)});`,\n\t);\n\n\tconst entrypointContent = `import { AppRegistry } from \"react-native\";\n${imports.join(\"\\n\")}\n\n${registry.join(\"\\n\")}\n`;\n\n\tconst entrypointDir = path.dirname(entrypoint);\n\tawait mkdir(entrypointDir, { recursive: true });\n\tawait writeFile(entrypoint, entrypointContent, \"utf-8\");\n\n\tconsole.log(` ✔︎ [${platform}] entrypoint created`);\n\n\treturn entrypoint;\n}\n\nexport async function createMobileBuild(\n\troot: string,\n\tplatform: \"ios\" | \"android\",\n) {\n\tconst viewTypes = await getSupportedAppViewTypes(root);\n\n\tconst fullDirectory = path.join(root, \"build\", \"output\", platform);\n\n\t// Check if the directory contains a file called `main_js_bundle.hbc`\n\tconst mainJsBundle = path.join(fullDirectory, \"main_js_bundle.hbc\");\n\n\tif (!existsSync(mainJsBundle)) {\n\t\tthrow new Error(`main_js_bundle.hbc not found in ${fullDirectory}`);\n\t}\n\n\t// check that that folder only contains the main_js_bundle.hbc file and an optional `assets` folder\n\tconst files = readdirSync(fullDirectory);\n\tif (\n\t\tfiles.length > 2 ||\n\t\tfiles.length < 1 ||\n\t\t!files.includes(\"main_js_bundle.hbc\")\n\t) {\n\t\tthrow new Error(\n\t\t\t\"Directory must contain only the main_js_bundle.hbc file and an optional `assets` folder\",\n\t\t);\n\t}\n\tif (files.length === 2 && !files.includes(\"assets\")) {\n\t\tthrow new Error(\n\t\t\t\"Directory must contain only the main_js_bundle.hbc file and an optional `assets` folder\",\n\t\t);\n\t}\n\n\t// Zip the directory\n\tconst zipData = await zipDirectory(fullDirectory);\n\n\tconst checksum = await getChecksum(zipData);\n\n\tconsole.log(` ✔︎ [${platform}] build zipped with checksum: ${checksum}`);\n\n\tconst fileName = `app_build_${platform}.zip`;\n\tconst uploadedFile = await uploadFile(zipData, fileName, \"application/zip\");\n\n\tconsole.log(\n\t\t` ✔︎ [${platform}] uploaded build: ${fileName} (${(\n\t\t\tzipData.length / 1024\n\t\t).toFixed(0)} KB)`,\n\t);\n\n\tconst build = await whopSdk.appBuilds.create({\n\t\tattachment: { direct_upload_id: uploadedFile.directUploadId },\n\t\tchecksum,\n\t\tapp_id: APP_ID,\n\t\tplatform,\n\t\tai_prompt_id: AI_PROMPT_ID,\n\t\tsupported_app_view_types: viewTypes.map(\n\t\t\t(view) =>\n\t\t\t\t({\n\t\t\t\t\t\"experience-view\": \"hub\" as const,\n\t\t\t\t\t\"discover-view\": \"discover\" as const,\n\t\t\t\t\t\"dashboard-view\": \"dashboard\" as const,\n\t\t\t\t})[view],\n\t\t),\n\t});\n\n\tif (!build) {\n\t\tthrow new Error(\"Failed to create app build\");\n\t}\n\n\tconst companyPart = COMPANY_ID ? `${COMPANY_ID}/` : \"\";\n\tconst dashboardUrl = `https://whop.com/dashboard/${companyPart}developer/apps/${APP_ID}/builds/?platform=${platform}`;\n\n\tconsole.log(`\\n ✔︎ [${platform}] deployed as development build ✔︎\n - build id: ${build.id}\n - view types: ${build.supported_app_view_types.join(\", \")}\n - promote to production here: ${dashboardUrl}\\n`);\n\n\treturn build;\n}\n\nasync function zipDirectory(\n\tdirectory: string,\n): Promise<Buffer<ArrayBufferLike>> {\n\tconst zip = new JSZip();\n\n\t// Recursively add files to zip\n\tfunction addFilesToZip(currentPath: string, relativePath = \"\") {\n\t\tconst items = readdirSync(currentPath);\n\n\t\tfor (const item of items) {\n\t\t\tconst fullPath = path.join(currentPath, item);\n\t\t\tconst zipPath = relativePath ? path.join(relativePath, item) : item;\n\t\t\tconst stats = statSync(fullPath);\n\n\t\t\tif (stats.isDirectory()) {\n\t\t\t\taddFilesToZip(fullPath, zipPath);\n\t\t\t} else {\n\t\t\t\tconst fileContent = readFileSync(fullPath);\n\t\t\t\tzip.file(zipPath, fileContent);\n\t\t\t}\n\t\t}\n\t}\n\n\taddFilesToZip(directory);\n\n\t// Generate zip file\n\tconst zipData = await zip.generateAsync({ type: \"nodebuffer\" });\n\n\treturn zipData;\n}\n\nclass CustomReporter implements Reporter {\n\tupdate(event: ReportableEvent) {\n\t\t// Do nothing.\n\t}\n}\n","import { createHash } from \"node:crypto\";\nimport { APP_ID, oldWhopSdk } from \"./sdk\";\n\nexport async function uploadFile(\n\tdata: Buffer<ArrayBufferLike>,\n\tname: string,\n\tcontentType: string,\n) {\n\tconst file = new File([data], name, {\n\t\ttype: contentType,\n\t});\n\n\tconst uploadedFile = await oldWhopSdk.attachments.uploadAttachment({\n\t\tfile,\n\t\trecord: \"app\",\n\t\tid: APP_ID,\n\t});\n\n\treturn uploadedFile;\n}\n\nexport async function getChecksum(data: Buffer<ArrayBufferLike>) {\n\tconst hash = createHash(\"sha256\");\n\thash.update(data);\n\treturn hash.digest(\"hex\");\n}\n","import { WhopServerSdk } from \"@whop/api\";\nimport Whop from \"@whop/sdk\";\nimport { config } from \"dotenv\";\n\nconfig({\n\tpath: [\".env\", \".env.local\", \".env.development\", \".env.production\"],\n});\n\nexport function env(key: string) {\n\tconst value = process.env[key];\n\tif (!value) {\n\t\tthrow new Error(`Missing environment variable: ${key}`);\n\t}\n\treturn value;\n}\n\nconst BASE_URL = process.env.WHOP_BASE_URL;\n\nexport const COMPANY_ID = process.env.NEXT_PUBLIC_WHOP_COMPANY_ID;\nexport const APP_ID = env(\"NEXT_PUBLIC_WHOP_APP_ID\");\nexport const AI_PROMPT_ID = process.env.AI_PROMPT_ID;\n\nexport const oldWhopSdk: WhopServerSdk = WhopServerSdk({\n\tappApiKey: env(\"WHOP_API_KEY\"),\n\tappId: APP_ID,\n\tapiOrigin: BASE_URL ? new URL(BASE_URL).origin : undefined,\n});\n\nexport const whopSdk = new Whop({\n\tappID: APP_ID,\n\tbaseURL: BASE_URL ? new URL(\"/api/v1\", BASE_URL).href : undefined,\n});\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { loadConfig } from \"metro\";\n\nexport async function loadMetroConfig(projectRoot: string) {\n\tconst file = fs.existsSync(path.join(projectRoot, \"metro.config.js\"));\n\tif (!file) return {};\n\treturn await loadConfig({ cwd: projectRoot }, {});\n}\n","import { readdir } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nexport const VALID_VIEW_TYPES = [\n\t\"experience-view\",\n\t\"discover-view\",\n\t\"dashboard-view\",\n] as const;\n\nexport async function getSupportedAppViewTypes(\n\troot: string,\n): Promise<(typeof VALID_VIEW_TYPES)[number][]> {\n\tconst views = await readdir(path.join(root, \"src\", \"views\"), {\n\t\twithFileTypes: true,\n\t\trecursive: false,\n\t});\n\tconst files = views\n\t\t.filter((file) => file.isFile())\n\t\t.map((file) => file.name.split(\".\")[0])\n\t\t.filter((file) => !!file);\n\n\tconst validViews = files.filter((file) =>\n\t\tVALID_VIEW_TYPES.includes(file as (typeof VALID_VIEW_TYPES)[number]),\n\t) as (typeof VALID_VIEW_TYPES)[number][];\n\n\tif (validViews.length === 0) {\n\t\tthrow new Error(\n\t\t\t`No valid views found, please create a view in the src/views folder and name it with a valid view type: ${VALID_VIEW_TYPES.join(\", \")}`,\n\t\t);\n\t}\n\n\treturn validViews;\n}\n","import { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { build } from \"esbuild\";\nimport { getChecksum, uploadFile } from \"./file\";\nimport { reanimatedBabelPlugin } from \"./reanimated-bable\";\nimport { AI_PROMPT_ID, APP_ID, COMPANY_ID, whopSdk } from \"./sdk\";\nimport { stripFlowWithBabel } from \"./strip-flow\";\nimport { getSupportedAppViewTypes } from \"./valid-view-type\";\n\nfunction aliasReactNativePlugin() {\n\treturn {\n\t\tname: \"alias-react-native\",\n\t\tsetup(b: import(\"esbuild\").PluginBuild) {\n\t\t\tb.onResolve({ filter: /^react-native$/ }, () => ({\n\t\t\t\tpath: require.resolve(\"react-native-web\"),\n\t\t\t}));\n\t\t},\n\t} satisfies import(\"esbuild\").Plugin;\n}\n\nfunction forceSingleReact() {\n\tconst map = new Map<string, string>([\n\t\t[\"react\", require.resolve(\"react\")],\n\t\t[\"react/jsx-runtime\", require.resolve(\"react/jsx-runtime\")],\n\t\t[\"react/jsx-dev-runtime\", require.resolve(\"react/jsx-dev-runtime\")],\n\t\t[\"react-dom\", require.resolve(\"react-dom\")],\n\t\t[\"react-dom/client\", require.resolve(\"react-dom/client\")],\n\t]);\n\n\tconst rx = /^(react(?:\\/jsx-(?:dev-)?runtime)?|react-dom(?:\\/client)?)$/;\n\n\treturn {\n\t\tname: \"force-single-react\",\n\t\tsetup(b: import(\"esbuild\").PluginBuild) {\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: <explanation>\n\t\t\tb.onResolve({ filter: rx }, (args) => ({ path: map.get(args.path)! }));\n\t\t},\n\t} satisfies import(\"esbuild\").Plugin;\n}\n\nfunction toPascalCase(str: string) {\n\treturn str\n\t\t.split(\"-\")\n\t\t.map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n\t\t.join(\"\");\n}\n\nasync function makeWebEntrypoint(root: string) {\n\tconst files = await getSupportedAppViewTypes(root);\n\n\tconst packageJsonPath = path.join(root, \"package.json\");\n\tconst packageJson = JSON.parse(await readFile(packageJsonPath, \"utf-8\"));\n\tconst hasReactNativeReanimated =\n\t\tpackageJson.dependencies?.[\"react-native-reanimated\"];\n\n\tconst imports = files.map(\n\t\t(file) =>\n\t\t\t`import { ${toPascalCase(file)} } from \"../../../src/views/${file}\";`,\n\t);\n\tconst registry = files.map(\n\t\t(file) =>\n\t\t\t`AppRegistry.registerComponent(\"${toPascalCase(\n\t\t\t\tfile,\n\t\t\t)}\", () => WhopNavigationWrapper(React, \"${toPascalCase(\n\t\t\t\tfile,\n\t\t\t)}\", ${toPascalCase(file)}));`,\n\t);\n\n\tconst defaultKey = toPascalCase(files[0] ?? \"experience-view\");\n\tconst reanimatedImport = hasReactNativeReanimated\n\t\t? `import \"react-native-reanimated\";`\n\t\t: \"\";\n\n\tconst entry = `import { AppRegistry } from \"react-native\";\nimport * as React from \"react\";\nimport { WhopNavigationWrapper } from \"@whop/react-native/web\";\n${reanimatedImport}\n\n${imports.join(\"\\n\")}\n\n${registry.join(\"\\n\")}\n\nconst viewType = new URLSearchParams(window.location.search).get(\"app_view\") ?? \"${defaultKey}\";\n\nconst root = document.getElementById(\"root\") || (() => {\n\tconst d = document.createElement(\"div\");\n\td.id = \"root\";\n\tdocument.body.appendChild(d);\n\treturn d;\n})();\nAppRegistry.runApplication(viewType, { rootTag: root });\n`;\n\n\tconst entryFile = path.join(root, \"build\", \"entrypoints\", \"web\", \"index.tsx\");\n\tawait mkdir(path.dirname(entryFile), { recursive: true });\n\tawait writeFile(entryFile, entry, \"utf-8\");\n\n\treturn entryFile;\n}\n\nexport async function bundleWeb(root: string) {\n\tconst entry = await makeWebEntrypoint(root);\n\n\tconst outDir = path.join(root, \"build\", \"output\", \"web\");\n\tawait mkdir(outDir, { recursive: true });\n\n\tawait build({\n\t\tentryPoints: [entry],\n\t\toutfile: path.join(outDir, \"main.js\"),\n\t\tbundle: true,\n\t\tminify: false,\n\t\tformat: \"esm\",\n\t\tplatform: \"browser\",\n\t\tsourcemap: false,\n\t\tjsx: \"automatic\",\n\t\tmainFields: [\"browser\", \"module\", \"main\"],\n\t\tconditions: [\"browser\", \"import\", \"default\"],\n\t\tdefine: {\n\t\t\tprocess: \"{}\",\n\t\t\t\"process.env\": \"{}\",\n\t\t\t\"process.env.NODE_ENV\": '\"production\"',\n\t\t\t__DEV__: \"false\",\n\t\t\t\"process.env.NEXT_PUBLIC_WHOP_APP_ID\": `\"${APP_ID}\"`,\n\t\t\t// Some RN libraries (e.g., RNGH) expect a Node-like global in the browser\n\t\t\tglobal: \"globalThis\",\n\t\t},\n\t\tresolveExtensions: [\n\t\t\t\".web.tsx\",\n\t\t\t\".web.ts\",\n\t\t\t\".web.js\",\n\t\t\t\".tsx\",\n\t\t\t\".ts\",\n\t\t\t\".jsx\",\n\t\t\t\".js\",\n\t\t],\n\t\tloader: {\n\t\t\t\".png\": \"dataurl\",\n\t\t\t\".jpg\": \"dataurl\",\n\t\t\t\".jpeg\": \"dataurl\",\n\t\t\t\".svg\": \"dataurl\",\n\t\t\t\".ttf\": \"dataurl\",\n\t\t\t\".woff\": \"dataurl\",\n\t\t\t\".woff2\": \"dataurl\",\n\t\t\t\".js\": \"jsx\",\n\t\t\t\".jsx\": \"jsx\",\n\t\t},\n\t\tplugins: [\n\t\t\tforceSingleReact(),\n\t\t\taliasReactNativePlugin(),\n\t\t\treanimatedBabelPlugin(),\n\t\t\tstripFlowWithBabel(),\n\t\t\t{\n\t\t\t\tname: \"force-native-web-stub\",\n\t\t\t\tsetup(b) {\n\t\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\t\t\t\tb.onResolve({ filter: /^\\.\\/native-whop-core$/ }, (args: any) => {\n\t\t\t\t\t\t// Always resolve the local source file so extension resolution (.web.ts) applies\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tpath: path.join(args.resolveDir, \"native-whop-core\"),\n\t\t\t\t\t\t\tnamespace: \"file\",\n\t\t\t\t\t\t};\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t});\n\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\" />\n\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n\t\t<title>Whop App (Web)</title>\n\t\t<style>\n\t\t\t#root {\n\t\t\t\twidth: 100vw;\n\t\t\t\theight: 100vh;\n\t\t\t\tmargin: 0;\n\t\t\t\tpadding: 0;\n\t\t\t\toverflow: hidden;\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: stretch;\n\t\t\t\tjustify-content: start;\n\t\t\t}\n\t\t</style>\n\t</head>\n\t<body>\n\t\t<div id=\"root\"></div>\n\t\t<script type=\"module\" src=\"./main.js\"></script>\n\t</body>\n</html>`;\n\tawait writeFile(path.join(outDir, \"index.html\"), html, \"utf-8\");\n\n\tconsole.log(\" ✔︎ [web] bundle created at build/output/web/main.js\");\n}\n\nexport async function buildAndPublish(\n\troot: string,\n\t{\n\t\tshouldBuild = true,\n\t\tshouldUpload = true,\n\t}: { shouldBuild: boolean; shouldUpload: boolean } = {\n\t\tshouldBuild: true,\n\t\tshouldUpload: true,\n\t},\n) {\n\tif (shouldBuild) {\n\t\tawait bundleWeb(root);\n\t}\n\tif (shouldUpload) {\n\t\tawait createWebBuild(root);\n\t}\n}\n\nexport async function createWebBuild(root: string) {\n\tconst viewTypes = await getSupportedAppViewTypes(root);\n\n\tconst fullDirectory = path.join(root, \"build\", \"output\", \"web\");\n\tconst mainJsFile = path.join(fullDirectory, \"main.js\");\n\n\t// Verify bundle exists\n\ttry {\n\t\tawait readFile(mainJsFile);\n\t} catch {\n\t\tthrow new Error(`main.js not found in ${fullDirectory}`);\n\t}\n\n\tconst buf = await readFile(mainJsFile);\n\tconst checksum = await getChecksum(buf);\n\n\tconsole.log(` ✔︎ [web] build checksummed: ${checksum}`);\n\n\tconst fileName = `rnweb_${checksum}.js`;\n\tconst uploadedFile = await uploadFile(\n\t\tbuf,\n\t\tfileName,\n\t\t\"application/javascript\",\n\t);\n\n\tconsole.log(\n\t\t` ✔︎ [web] uploaded build: ${fileName} (${(buf.length / 1024).toFixed(\n\t\t\t0,\n\t\t)} KB)`,\n\t);\n\n\tconst build = await whopSdk.appBuilds.create({\n\t\tattachment: { direct_upload_id: uploadedFile.directUploadId },\n\t\tchecksum,\n\t\tapp_id: APP_ID,\n\t\tplatform: \"web\",\n\t\tai_prompt_id: AI_PROMPT_ID,\n\t\tsupported_app_view_types: viewTypes.map(\n\t\t\t(view) =>\n\t\t\t\t({\n\t\t\t\t\t\"experience-view\": \"hub\" as const,\n\t\t\t\t\t\"discover-view\": \"discover\" as const,\n\t\t\t\t\t\"dashboard-view\": \"dashboard\" as const,\n\t\t\t\t})[view],\n\t\t),\n\t});\n\n\tif (!build) {\n\t\tthrow new Error(\"Failed to create app build\");\n\t}\n\n\tconst companyPart = COMPANY_ID ? `${COMPANY_ID}/` : \"\";\n\tconst dashboardUrl = `https://whop.com/dashboard/${companyPart}developer/apps/${APP_ID}/builds/?platform=web`;\n\n\tconsole.log(\n\t\t`\\n ✔︎ [web] deployed as development build ✔︎\\n - build id: ${\n\t\t\tbuild.id\n\t\t}\\n - view types: ${build.supported_app_view_types.join(\n\t\t\t\", \",\n\t\t)}\\n - promote to production here: ${dashboardUrl}\\n`,\n\t);\n\n\treturn build;\n}\n","import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n// build/plugins/reanimatedBabel.ts\nimport * as babel from \"@babel/core\";\n\nconst JS_RE = /\\.(m|c)?(t|j)sx?$/;\n\nexport function reanimatedBabelPlugin() {\n\t// Transform only: your app source (outside node_modules) and reanimated itself.\n\tconst shouldTransform = (p: string) => {\n\t\tif (!JS_RE.test(p)) return false;\n\t\t// Always run on reanimated’s files\n\t\tif (p.includes(`${path.sep}react-native-reanimated${path.sep}`))\n\t\t\treturn true;\n\t\t// Never touch third-party deps\n\t\tif (p.includes(`${path.sep}node_modules${path.sep}`)) return false;\n\t\t// Run on app code under src/\n\t\treturn p.includes(`${path.sep}src${path.sep}`);\n\t};\n\n\treturn {\n\t\tname: \"reanimated-babel\",\n\t\tsetup(b: import(\"esbuild\").PluginBuild) {\n\t\t\tb.onLoad({ filter: JS_RE }, async (args) => {\n\t\t\t\tif (!shouldTransform(args.path)) {\n\t\t\t\t\t// Skip non-target files so other plugins (and esbuild) can process them\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst code = await fs.readFile(args.path, \"utf8\");\n\t\t\t\tconst result = await babel.transformAsync(code, {\n\t\t\t\t\tfilename: args.path,\n\t\t\t\t\tsourceMaps: false,\n\t\t\t\t\tbabelrc: false,\n\t\t\t\t\tconfigFile: false,\n\t\t\t\t\t// ORDER MATTERS: Reanimated plugin MUST BE LAST\n\t\t\t\t\tplugins: [\n\t\t\t\t\t\t// Needed by Reanimated on web per docs\n\t\t\t\t\t\t\"@babel/plugin-transform-export-namespace-from\",\n\t\t\t\t\t\t// Handle Flow types present in some RN libs\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"@babel/plugin-transform-flow-strip-types\",\n\t\t\t\t\t\t\t{ allowDeclareFields: true },\n\t\t\t\t\t\t],\n\t\t\t\t\t\t// MUST be last\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"react-native-reanimated/plugin\",\n\t\t\t\t\t\t\t{ relativeSourceLocation: true },\n\t\t\t\t\t\t],\n\t\t\t\t\t],\n\t\t\t\t\tpresets: [], // esbuild handles TS/JSX syntax; no preset-env/preset-react\n\t\t\t\t\tcaller: { name: \"esbuild\" },\n\t\t\t\t\t// Let Babel parse TS/JSX/Flow; keep it broad\n\t\t\t\t\tparserOpts: { plugins: [\"jsx\", \"typescript\"] },\n\t\t\t\t\tgeneratorOpts: { decoratorsBeforeExport: true },\n\t\t\t\t});\n\n\t\t\t\treturn {\n\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: <explanation>\n\t\t\t\t\tcontents: result!.code!,\n\t\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\t\t\t\tloader: pickLoader(args.path) as any,\n\t\t\t\t};\n\t\t\t});\n\t\t},\n\t};\n}\n\nfunction pickLoader(file: string) {\n\tconst ext = path.extname(file).toLowerCase();\n\tif (ext === \".tsx\") return \"tsx\";\n\tif (ext === \".ts\") return \"ts\";\n\tif (ext === \".jsx\") return \"jsx\";\n\t// For .js: many RN libs contain JSX; be permissive\n\treturn \"jsx\";\n}\n","import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n// stripFlowWithBabel.ts\nimport * as babel from \"@babel/core\";\n\nexport function stripFlowWithBabel() {\n\tconst filter = /\\.(m|c)?jsx?$/;\n\treturn {\n\t\tname: \"strip-flow-with-babel\",\n\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\tsetup(b: any) {\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\t\tb.onLoad({ filter }, async (args: any) => {\n\t\t\t\t// Only process react-native core files that contain Flow\n\t\t\t\tif (!args.path.includes(`${path.sep}react-native${path.sep}`)) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst code = await fs.readFile(args.path, \"utf8\");\n\t\t\t\tconst out = await babel.transformAsync(code, {\n\t\t\t\t\tfilename: args.path,\n\t\t\t\t\tbabelrc: false,\n\t\t\t\t\tconfigFile: false,\n\t\t\t\t\tplugins: [\n\t\t\t\t\t\t// Use Hermes parser to handle modern Flow syntax (as casts, type predicates, mapped types, etc.)\n\t\t\t\t\t\t\"babel-plugin-syntax-hermes-parser\",\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"@babel/plugin-transform-flow-strip-types\",\n\t\t\t\t\t\t\t{ allowDeclareFields: true },\n\t\t\t\t\t\t],\n\t\t\t\t\t],\n\t\t\t\t\tsourceMaps: false,\n\t\t\t\t});\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: <explanation>\n\t\t\t\treturn { contents: out!.code!, loader: \"jsx\" };\n\t\t\t});\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,kBAA2B;AAC3B,IAAAC,oBAAiB;AACjB,uBAA0B;AAC1B,IAAAC,kBAAuB;AACvB,6BAAmB;AACnB,oBAAuB;;;ACLvB,IAAAC,kBAAgE;AAChE,IAAAC,mBAAyC;AACzC,IAAAC,oBAAiB;AACjB,0BAA8C;AAC9C,qBAAuB;AACvB,mBAAkB;AAClB,IAAAC,gBAA8D;;;ACN9D,yBAA2B;;;ACA3B,iBAA8B;AAC9B,iBAAiB;AACjB,oBAAuB;AAAA,IAEvB,sBAAO;AAAA,EACN,MAAM,CAAC,QAAQ,cAAc,oBAAoB,iBAAiB;AACnE,CAAC;AAEM,SAAS,IAAI,KAAa;AAChC,QAAM,QAAQ,QAAQ,IAAI,GAAG;AAC7B,MAAI,CAAC,OAAO;AACX,UAAM,IAAI,MAAM,iCAAiC,GAAG,EAAE;AAAA,EACvD;AACA,SAAO;AACR;AAEA,IAAM,WAAW,QAAQ,IAAI;AAEtB,IAAM,aAAa,QAAQ,IAAI;AAC/B,IAAM,SAAS,IAAI,yBAAyB;AAC5C,IAAM,eAAe,QAAQ,IAAI;AAEjC,IAAM,iBAA4B,0BAAc;AAAA,EACtD,WAAW,IAAI,cAAc;AAAA,EAC7B,OAAO;AAAA,EACP,WAAW,WAAW,IAAI,IAAI,QAAQ,EAAE,SAAS;AAClD,CAAC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AAO,kBAAAA,QAAK,QAAQ,IAAI;AAC9B,SAAO;AACR;AAEA,eAAe,gBAAgB;AAC9B,QAAM,QAAQ,IAAI,yBAAyB;AAC3C,QAAM,cAAc,yBAAyB,KAAK;AAElD,UAAQ,IAAI;AAAA;AAAA,EAEX,WAAW;AAAA;AAAA;AAAA,EAGX;AAED,yBAAAC,QAAO,SAAS,aAAa,EAAE,OAAO,KAAK,CAAC;AAC7C;AAEA,KAAK,EACH,MAAM,CAAC,QAAQ;AACf,UAAQ,MAAM,GAAG;AACjB,UAAQ,KAAK,CAAC;AACf,CAAC,EACA,KAAK,MAAM;AACX,UAAQ,KAAK,CAAC;AACf,CAAC;","names":["import_node_fs","import_node_path","import_find_up","import_node_fs","import_promises","import_node_path","import_metro","Whop","fs","path","import_node_path","path","path","build","JSZip","import_promises","import_node_path","fs","path","fs","path","babel","path","buildAndPublish","build","buildAndPublish","path","qrcode"]}
|
package/dist/cli/index.mjs
CHANGED
|
@@ -37,14 +37,19 @@ function env(key) {
|
|
|
37
37
|
}
|
|
38
38
|
return value;
|
|
39
39
|
}
|
|
40
|
+
var BASE_URL = process.env.WHOP_BASE_URL;
|
|
40
41
|
var COMPANY_ID = process.env.NEXT_PUBLIC_WHOP_COMPANY_ID;
|
|
41
42
|
var APP_ID = env("NEXT_PUBLIC_WHOP_APP_ID");
|
|
42
43
|
var AI_PROMPT_ID = process.env.AI_PROMPT_ID;
|
|
43
44
|
var oldWhopSdk = WhopServerSdk({
|
|
44
45
|
appApiKey: env("WHOP_API_KEY"),
|
|
45
|
-
appId: APP_ID
|
|
46
|
+
appId: APP_ID,
|
|
47
|
+
apiOrigin: BASE_URL ? new URL(BASE_URL).origin : void 0
|
|
48
|
+
});
|
|
49
|
+
var whopSdk = new Whop({
|
|
50
|
+
appID: APP_ID,
|
|
51
|
+
baseURL: BASE_URL ? new URL("/api/v1", BASE_URL).href : void 0
|
|
46
52
|
});
|
|
47
|
-
var whopSdk = new Whop({ appID: APP_ID });
|
|
48
53
|
|
|
49
54
|
// src/cli/file.ts
|
|
50
55
|
async function uploadFile(data, name, contentType) {
|
package/dist/cli/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/index.ts","../../src/cli/mobile.ts","../../src/cli/file.ts","../../src/cli/sdk.ts","../../src/cli/load-metro-config.ts","../../src/cli/valid-view-type.ts","../../src/cli/web.ts","../../src/cli/reanimated-bable.ts","../../src/cli/strip-flow.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { parseArgs } from \"node:util\";\nimport { findUp } from \"find-up\";\nimport qrcode from \"qrcode-terminal\";\nimport { rimraf } from \"rimraf\";\nimport { buildAndPublish } from \"./mobile\";\nimport { env } from \"./sdk\";\nimport { buildAndPublish as buildAndPublishWeb } from \"./web\";\n\nasync function main() {\n\tconst args = parseArgs({\n\t\toptions: {\n\t\t\tios: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t\tandroid: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t\tweb: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t},\n\t\tstrict: true,\n\t\tallowPositionals: true,\n\t\targs: process.argv.slice(2),\n\t});\n\n\tconst [command] = args.positionals;\n\n\tif (command === \"install\") {\n\t\tawait handleInstall();\n\t\treturn;\n\t}\n\n\tlet shouldBuild = true;\n\tlet shouldUpload = true;\n\tlet shouldClean = true;\n\tif (command === \"build\") {\n\t\tshouldUpload = false;\n\t} else if (command === \"ship\") {\n\t\tshouldBuild = true;\n\t\tshouldUpload = true;\n\t} else if (command === \"upload\") {\n\t\tshouldBuild = false;\n\t\tshouldClean = false;\n\t} else if (command === \"clean\") {\n\t\tshouldBuild = false;\n\t\tshouldUpload = false;\n\t} else {\n\t\tconsole.error(\n\t\t\t`Usage:\n\twhop-react-native ship [--ios] [--android] [--web] # runs build and then publishes it as a dev build to whop.\n\twhop-react-native build [--ios] [--android] [--web] # builds your app into a distributable bundle in the build/ directory.\n\twhop-react-native upload [--ios] [--android] [--web] # uploads the existing build directory to whop.\n\twhop-react-native clean # cleans the build directory.`,\n\t\t);\n\t\tprocess.exit(1);\n\t}\n\n\tconst root = await getRootProjectDirectory();\n\n\tif (shouldClean) {\n\t\tawait cleanBuildDirectory(root);\n\t}\n\n\tconst didProvidePlatform =\n\t\targs.values.ios || args.values.android || args.values.web;\n\n\tconst opts = { shouldBuild, shouldUpload };\n\tconst promises: Promise<void>[] = [];\n\n\tif (args.values.ios || !didProvidePlatform) {\n\t\tpromises.push(buildAndPublish(root, \"ios\", opts));\n\t}\n\tif (args.values.android || !didProvidePlatform) {\n\t\tpromises.push(buildAndPublish(root, \"android\", opts));\n\t}\n\tif (args.values.web || !didProvidePlatform) {\n\t\tpromises.push(buildAndPublishWeb(root, opts));\n\t}\n\n\tawait Promise.all(promises);\n}\n\nasync function cleanBuildDirectory(root: string) {\n\tconst buildDirectory = path.join(root, \"build\");\n\tif (existsSync(buildDirectory)) {\n\t\tawait rimraf(buildDirectory);\n\t}\n\tconsole.log(\" ✔︎ cleaned build directory\");\n}\n\nasync function getRootProjectDirectory() {\n\tconst file = await findUp(\"package.json\", { cwd: process.cwd() });\n\tif (!file) {\n\t\tthrow new Error(\n\t\t\t\"please run this command inside a whop react native project\",\n\t\t);\n\t}\n\tconst root = path.dirname(file);\n\treturn root;\n}\n\nasync function handleInstall() {\n\tconst appId = env(\"NEXT_PUBLIC_WHOP_APP_ID\");\n\tconst installLink = `https://whop.com/apps/${appId}/install`;\n\n\tconsole.log(`\nOpen this link in your browser to install the app into your whop.\n${installLink}\n\nOr scan the QR code with your iPhone:\n\t`);\n\n\tqrcode.generate(installLink, { small: true });\n}\n\nmain()\n\t.catch((err) => {\n\t\tconsole.error(err);\n\t\tprocess.exit(1);\n\t})\n\t.then(() => {\n\t\tprocess.exit(0);\n\t});\n","import { existsSync, readFileSync, readdirSync, statSync } from \"node:fs\";\nimport { mkdir, rename, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { getDefaultConfig, mergeConfig } from \"@react-native/metro-config\";\nimport { findUp } from \"find-up\";\nimport JSZip from \"jszip\";\nimport { type ReportableEvent, type Reporter, runBuild } from \"metro\";\nimport { getChecksum, uploadFile } from \"./file\";\nimport { loadMetroConfig } from \"./load-metro-config\";\nimport { AI_PROMPT_ID, APP_ID, COMPANY_ID, whopSdk } from \"./sdk\";\nimport { getSupportedAppViewTypes } from \"./valid-view-type\";\n\nexport async function buildAndPublish(\n\troot: string,\n\tplatform: \"ios\" | \"android\",\n\t{\n\t\tshouldBuild = true,\n\t\tshouldUpload = true,\n\t}: { shouldBuild: boolean; shouldUpload: boolean } = {\n\t\tshouldBuild: true,\n\t\tshouldUpload: true,\n\t},\n) {\n\tif (shouldBuild) {\n\t\tawait bundle(root, platform);\n\t}\n\tif (shouldUpload) {\n\t\tawait createMobileBuild(root, platform);\n\t}\n}\n\nexport async function bundle(root: string, platform: \"ios\" | \"android\") {\n\tawait makeEntrypoint(root, platform);\n\n\tconst outputFile = path.join(\n\t\troot,\n\t\t\"build\",\n\t\t\"output\",\n\t\tplatform,\n\t\t\"main_js_bundle\",\n\t);\n\n\tawait mkdir(path.dirname(outputFile), { recursive: true });\n\n\tconst babelLocation = require.resolve(\"@babel/runtime/package\");\n\n\tconst bableNodeModules = await findUp(\"node_modules\", {\n\t\tcwd: babelLocation,\n\t\ttype: \"directory\",\n\t});\n\n\tif (!bableNodeModules) {\n\t\tthrow new Error(\"babel node_modules parent folder not found\");\n\t}\n\n\tconst defaultConfig = getDefaultConfig(root);\n\tconst projectConfig = await loadMetroConfig(root);\n\n\tconst defaultMetroConfig = mergeConfig(defaultConfig, projectConfig);\n\n\tconst metroConfig = mergeConfig(defaultMetroConfig, {\n\t\tprojectRoot: root,\n\t\ttransformer: {\n\t\t\tbabelTransformerPath: require.resolve(\n\t\t\t\t\"./whop-react-native-babel-transformer.js\",\n\t\t\t),\n\t\t},\n\t\tcacheStores: [],\n\t\twatchFolders: [root, path.resolve(root, \"node_modules\"), bableNodeModules],\n\t\treporter: new CustomReporter(),\n\t\tresolver: {\n\t\t\tnodeModulesPaths: [\n\t\t\t\t...(defaultMetroConfig.resolver?.nodeModulesPaths ?? []),\n\t\t\t\tbableNodeModules,\n\t\t\t],\n\t\t},\n\t});\n\n\tawait runBuild(metroConfig, {\n\t\tdev: false,\n\t\tentry: `build/entrypoints/${platform}/index.js`,\n\t\tminify: false,\n\t\tplatform: platform,\n\t\tsourceMap: false,\n\t\tout: outputFile,\n\t});\n\n\tawait rename(\n\t\t`${outputFile}.js`,\n\t\tpath.join(root, \"build\", \"output\", platform, \"main_js_bundle.hbc\"),\n\t);\n\n\tconsole.log(` ✔︎ [${platform}] bundle created`);\n}\n\n// getSupportedAppViewTypes moved to valid-view-type.ts\n\nasync function makeEntrypoint(\n\troot: string,\n\tplatform: \"ios\" | \"android\",\n): Promise<string> {\n\tconst entrypoint = path.join(\n\t\troot,\n\t\t\"build\",\n\t\t\"entrypoints\",\n\t\tplatform,\n\t\t\"index.js\",\n\t);\n\n\tconst files = await getSupportedAppViewTypes(root);\n\n\tconst pascalCase = (str: string) =>\n\t\tstr\n\t\t\t.split(\"-\")\n\t\t\t.map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n\t\t\t.join(\"\");\n\n\tconst imports = files.map(\n\t\t(file) =>\n\t\t\t`import { ${pascalCase(file)} } from \"../../../src/views/${file}\";`,\n\t);\n\tconst registry = files.map(\n\t\t(file) =>\n\t\t\t`AppRegistry.registerComponent(\"${pascalCase(file)}\", () => ${pascalCase(\n\t\t\t\tfile,\n\t\t\t)});`,\n\t);\n\n\tconst entrypointContent = `import { AppRegistry } from \"react-native\";\n${imports.join(\"\\n\")}\n\n${registry.join(\"\\n\")}\n`;\n\n\tconst entrypointDir = path.dirname(entrypoint);\n\tawait mkdir(entrypointDir, { recursive: true });\n\tawait writeFile(entrypoint, entrypointContent, \"utf-8\");\n\n\tconsole.log(` ✔︎ [${platform}] entrypoint created`);\n\n\treturn entrypoint;\n}\n\nexport async function createMobileBuild(\n\troot: string,\n\tplatform: \"ios\" | \"android\",\n) {\n\tconst viewTypes = await getSupportedAppViewTypes(root);\n\n\tconst fullDirectory = path.join(root, \"build\", \"output\", platform);\n\n\t// Check if the directory contains a file called `main_js_bundle.hbc`\n\tconst mainJsBundle = path.join(fullDirectory, \"main_js_bundle.hbc\");\n\n\tif (!existsSync(mainJsBundle)) {\n\t\tthrow new Error(`main_js_bundle.hbc not found in ${fullDirectory}`);\n\t}\n\n\t// check that that folder only contains the main_js_bundle.hbc file and an optional `assets` folder\n\tconst files = readdirSync(fullDirectory);\n\tif (\n\t\tfiles.length > 2 ||\n\t\tfiles.length < 1 ||\n\t\t!files.includes(\"main_js_bundle.hbc\")\n\t) {\n\t\tthrow new Error(\n\t\t\t\"Directory must contain only the main_js_bundle.hbc file and an optional `assets` folder\",\n\t\t);\n\t}\n\tif (files.length === 2 && !files.includes(\"assets\")) {\n\t\tthrow new Error(\n\t\t\t\"Directory must contain only the main_js_bundle.hbc file and an optional `assets` folder\",\n\t\t);\n\t}\n\n\t// Zip the directory\n\tconst zipData = await zipDirectory(fullDirectory);\n\n\tconst checksum = await getChecksum(zipData);\n\n\tconsole.log(` ✔︎ [${platform}] build zipped with checksum: ${checksum}`);\n\n\tconst fileName = `app_build_${platform}.zip`;\n\tconst uploadedFile = await uploadFile(zipData, fileName, \"application/zip\");\n\n\tconsole.log(\n\t\t` ✔︎ [${platform}] uploaded build: ${fileName} (${(\n\t\t\tzipData.length / 1024\n\t\t).toFixed(0)} KB)`,\n\t);\n\n\tconst build = await whopSdk.appBuilds.create({\n\t\tattachment: { direct_upload_id: uploadedFile.directUploadId },\n\t\tchecksum,\n\t\tapp_id: APP_ID,\n\t\tplatform,\n\t\tai_prompt_id: AI_PROMPT_ID,\n\t\tsupported_app_view_types: viewTypes.map(\n\t\t\t(view) =>\n\t\t\t\t({\n\t\t\t\t\t\"experience-view\": \"hub\" as const,\n\t\t\t\t\t\"discover-view\": \"discover\" as const,\n\t\t\t\t\t\"dashboard-view\": \"dashboard\" as const,\n\t\t\t\t})[view],\n\t\t),\n\t});\n\n\tif (!build) {\n\t\tthrow new Error(\"Failed to create app build\");\n\t}\n\n\tconst companyPart = COMPANY_ID ? `${COMPANY_ID}/` : \"\";\n\tconst dashboardUrl = `https://whop.com/dashboard/${companyPart}developer/apps/${APP_ID}/builds/?platform=${platform}`;\n\n\tconsole.log(`\\n ✔︎ [${platform}] deployed as development build ✔︎\n - build id: ${build.id}\n - view types: ${build.supported_app_view_types.join(\", \")}\n - promote to production here: ${dashboardUrl}\\n`);\n\n\treturn build;\n}\n\nasync function zipDirectory(\n\tdirectory: string,\n): Promise<Buffer<ArrayBufferLike>> {\n\tconst zip = new JSZip();\n\n\t// Recursively add files to zip\n\tfunction addFilesToZip(currentPath: string, relativePath = \"\") {\n\t\tconst items = readdirSync(currentPath);\n\n\t\tfor (const item of items) {\n\t\t\tconst fullPath = path.join(currentPath, item);\n\t\t\tconst zipPath = relativePath ? path.join(relativePath, item) : item;\n\t\t\tconst stats = statSync(fullPath);\n\n\t\t\tif (stats.isDirectory()) {\n\t\t\t\taddFilesToZip(fullPath, zipPath);\n\t\t\t} else {\n\t\t\t\tconst fileContent = readFileSync(fullPath);\n\t\t\t\tzip.file(zipPath, fileContent);\n\t\t\t}\n\t\t}\n\t}\n\n\taddFilesToZip(directory);\n\n\t// Generate zip file\n\tconst zipData = await zip.generateAsync({ type: \"nodebuffer\" });\n\n\treturn zipData;\n}\n\nclass CustomReporter implements Reporter {\n\tupdate(event: ReportableEvent) {\n\t\t// Do nothing.\n\t}\n}\n","import { createHash } from \"node:crypto\";\nimport { APP_ID, oldWhopSdk } from \"./sdk\";\n\nexport async function uploadFile(\n\tdata: Buffer<ArrayBufferLike>,\n\tname: string,\n\tcontentType: string,\n) {\n\tconst file = new File([data], name, {\n\t\ttype: contentType,\n\t});\n\n\tconst uploadedFile = await oldWhopSdk.attachments.uploadAttachment({\n\t\tfile,\n\t\trecord: \"app\",\n\t\tid: APP_ID,\n\t});\n\n\treturn uploadedFile;\n}\n\nexport async function getChecksum(data: Buffer<ArrayBufferLike>) {\n\tconst hash = createHash(\"sha256\");\n\thash.update(data);\n\treturn hash.digest(\"hex\");\n}\n","import { WhopServerSdk } from \"@whop/api\";\nimport Whop from \"@whop/sdk\";\nimport { config } from \"dotenv\";\n\nconfig({\n\tpath: [\".env\", \".env.local\", \".env.development\", \".env.production\"],\n});\n\nexport function env(key: string) {\n\tconst value = process.env[key];\n\tif (!value) {\n\t\tthrow new Error(`Missing environment variable: ${key}`);\n\t}\n\treturn value;\n}\n\nexport const COMPANY_ID = process.env.NEXT_PUBLIC_WHOP_COMPANY_ID;\nexport const APP_ID = env(\"NEXT_PUBLIC_WHOP_APP_ID\");\nexport const AI_PROMPT_ID = process.env.AI_PROMPT_ID;\n\nexport const oldWhopSdk: WhopServerSdk = WhopServerSdk({\n\tappApiKey: env(\"WHOP_API_KEY\"),\n\tappId: APP_ID,\n});\n\nexport const whopSdk = new Whop({ appID: APP_ID });\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { loadConfig } from \"metro\";\n\nexport async function loadMetroConfig(projectRoot: string) {\n\tconst file = fs.existsSync(path.join(projectRoot, \"metro.config.js\"));\n\tif (!file) return {};\n\treturn await loadConfig({ cwd: projectRoot }, {});\n}\n","import { readdir } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nexport const VALID_VIEW_TYPES = [\n\t\"experience-view\",\n\t\"discover-view\",\n\t\"dashboard-view\",\n] as const;\n\nexport async function getSupportedAppViewTypes(\n\troot: string,\n): Promise<(typeof VALID_VIEW_TYPES)[number][]> {\n\tconst views = await readdir(path.join(root, \"src\", \"views\"), {\n\t\twithFileTypes: true,\n\t\trecursive: false,\n\t});\n\tconst files = views\n\t\t.filter((file) => file.isFile())\n\t\t.map((file) => file.name.split(\".\")[0])\n\t\t.filter((file) => !!file);\n\n\tconst validViews = files.filter((file) =>\n\t\tVALID_VIEW_TYPES.includes(file as (typeof VALID_VIEW_TYPES)[number]),\n\t) as (typeof VALID_VIEW_TYPES)[number][];\n\n\tif (validViews.length === 0) {\n\t\tthrow new Error(\n\t\t\t`No valid views found, please create a view in the src/views folder and name it with a valid view type: ${VALID_VIEW_TYPES.join(\", \")}`,\n\t\t);\n\t}\n\n\treturn validViews;\n}\n","import { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { build } from \"esbuild\";\nimport { getChecksum, uploadFile } from \"./file\";\nimport { reanimatedBabelPlugin } from \"./reanimated-bable\";\nimport { AI_PROMPT_ID, APP_ID, COMPANY_ID, whopSdk } from \"./sdk\";\nimport { stripFlowWithBabel } from \"./strip-flow\";\nimport { getSupportedAppViewTypes } from \"./valid-view-type\";\n\nfunction aliasReactNativePlugin() {\n\treturn {\n\t\tname: \"alias-react-native\",\n\t\tsetup(b: import(\"esbuild\").PluginBuild) {\n\t\t\tb.onResolve({ filter: /^react-native$/ }, () => ({\n\t\t\t\tpath: require.resolve(\"react-native-web\"),\n\t\t\t}));\n\t\t},\n\t} satisfies import(\"esbuild\").Plugin;\n}\n\nfunction forceSingleReact() {\n\tconst map = new Map<string, string>([\n\t\t[\"react\", require.resolve(\"react\")],\n\t\t[\"react/jsx-runtime\", require.resolve(\"react/jsx-runtime\")],\n\t\t[\"react/jsx-dev-runtime\", require.resolve(\"react/jsx-dev-runtime\")],\n\t\t[\"react-dom\", require.resolve(\"react-dom\")],\n\t\t[\"react-dom/client\", require.resolve(\"react-dom/client\")],\n\t]);\n\n\tconst rx = /^(react(?:\\/jsx-(?:dev-)?runtime)?|react-dom(?:\\/client)?)$/;\n\n\treturn {\n\t\tname: \"force-single-react\",\n\t\tsetup(b: import(\"esbuild\").PluginBuild) {\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: <explanation>\n\t\t\tb.onResolve({ filter: rx }, (args) => ({ path: map.get(args.path)! }));\n\t\t},\n\t} satisfies import(\"esbuild\").Plugin;\n}\n\nfunction toPascalCase(str: string) {\n\treturn str\n\t\t.split(\"-\")\n\t\t.map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n\t\t.join(\"\");\n}\n\nasync function makeWebEntrypoint(root: string) {\n\tconst files = await getSupportedAppViewTypes(root);\n\n\tconst packageJsonPath = path.join(root, \"package.json\");\n\tconst packageJson = JSON.parse(await readFile(packageJsonPath, \"utf-8\"));\n\tconst hasReactNativeReanimated =\n\t\tpackageJson.dependencies?.[\"react-native-reanimated\"];\n\n\tconst imports = files.map(\n\t\t(file) =>\n\t\t\t`import { ${toPascalCase(file)} } from \"../../../src/views/${file}\";`,\n\t);\n\tconst registry = files.map(\n\t\t(file) =>\n\t\t\t`AppRegistry.registerComponent(\"${toPascalCase(\n\t\t\t\tfile,\n\t\t\t)}\", () => WhopNavigationWrapper(React, \"${toPascalCase(\n\t\t\t\tfile,\n\t\t\t)}\", ${toPascalCase(file)}));`,\n\t);\n\n\tconst defaultKey = toPascalCase(files[0] ?? \"experience-view\");\n\tconst reanimatedImport = hasReactNativeReanimated\n\t\t? `import \"react-native-reanimated\";`\n\t\t: \"\";\n\n\tconst entry = `import { AppRegistry } from \"react-native\";\nimport * as React from \"react\";\nimport { WhopNavigationWrapper } from \"@whop/react-native/web\";\n${reanimatedImport}\n\n${imports.join(\"\\n\")}\n\n${registry.join(\"\\n\")}\n\nconst viewType = new URLSearchParams(window.location.search).get(\"app_view\") ?? \"${defaultKey}\";\n\nconst root = document.getElementById(\"root\") || (() => {\n\tconst d = document.createElement(\"div\");\n\td.id = \"root\";\n\tdocument.body.appendChild(d);\n\treturn d;\n})();\nAppRegistry.runApplication(viewType, { rootTag: root });\n`;\n\n\tconst entryFile = path.join(root, \"build\", \"entrypoints\", \"web\", \"index.tsx\");\n\tawait mkdir(path.dirname(entryFile), { recursive: true });\n\tawait writeFile(entryFile, entry, \"utf-8\");\n\n\treturn entryFile;\n}\n\nexport async function bundleWeb(root: string) {\n\tconst entry = await makeWebEntrypoint(root);\n\n\tconst outDir = path.join(root, \"build\", \"output\", \"web\");\n\tawait mkdir(outDir, { recursive: true });\n\n\tawait build({\n\t\tentryPoints: [entry],\n\t\toutfile: path.join(outDir, \"main.js\"),\n\t\tbundle: true,\n\t\tminify: false,\n\t\tformat: \"esm\",\n\t\tplatform: \"browser\",\n\t\tsourcemap: false,\n\t\tjsx: \"automatic\",\n\t\tmainFields: [\"browser\", \"module\", \"main\"],\n\t\tconditions: [\"browser\", \"import\", \"default\"],\n\t\tdefine: {\n\t\t\tprocess: \"{}\",\n\t\t\t\"process.env\": \"{}\",\n\t\t\t\"process.env.NODE_ENV\": '\"production\"',\n\t\t\t__DEV__: \"false\",\n\t\t\t\"process.env.NEXT_PUBLIC_WHOP_APP_ID\": `\"${APP_ID}\"`,\n\t\t\t// Some RN libraries (e.g., RNGH) expect a Node-like global in the browser\n\t\t\tglobal: \"globalThis\",\n\t\t},\n\t\tresolveExtensions: [\n\t\t\t\".web.tsx\",\n\t\t\t\".web.ts\",\n\t\t\t\".web.js\",\n\t\t\t\".tsx\",\n\t\t\t\".ts\",\n\t\t\t\".jsx\",\n\t\t\t\".js\",\n\t\t],\n\t\tloader: {\n\t\t\t\".png\": \"dataurl\",\n\t\t\t\".jpg\": \"dataurl\",\n\t\t\t\".jpeg\": \"dataurl\",\n\t\t\t\".svg\": \"dataurl\",\n\t\t\t\".ttf\": \"dataurl\",\n\t\t\t\".woff\": \"dataurl\",\n\t\t\t\".woff2\": \"dataurl\",\n\t\t\t\".js\": \"jsx\",\n\t\t\t\".jsx\": \"jsx\",\n\t\t},\n\t\tplugins: [\n\t\t\tforceSingleReact(),\n\t\t\taliasReactNativePlugin(),\n\t\t\treanimatedBabelPlugin(),\n\t\t\tstripFlowWithBabel(),\n\t\t\t{\n\t\t\t\tname: \"force-native-web-stub\",\n\t\t\t\tsetup(b) {\n\t\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\t\t\t\tb.onResolve({ filter: /^\\.\\/native-whop-core$/ }, (args: any) => {\n\t\t\t\t\t\t// Always resolve the local source file so extension resolution (.web.ts) applies\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tpath: path.join(args.resolveDir, \"native-whop-core\"),\n\t\t\t\t\t\t\tnamespace: \"file\",\n\t\t\t\t\t\t};\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t});\n\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\" />\n\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n\t\t<title>Whop App (Web)</title>\n\t\t<style>\n\t\t\t#root {\n\t\t\t\twidth: 100vw;\n\t\t\t\theight: 100vh;\n\t\t\t\tmargin: 0;\n\t\t\t\tpadding: 0;\n\t\t\t\toverflow: hidden;\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: stretch;\n\t\t\t\tjustify-content: start;\n\t\t\t}\n\t\t</style>\n\t</head>\n\t<body>\n\t\t<div id=\"root\"></div>\n\t\t<script type=\"module\" src=\"./main.js\"></script>\n\t</body>\n</html>`;\n\tawait writeFile(path.join(outDir, \"index.html\"), html, \"utf-8\");\n\n\tconsole.log(\" ✔︎ [web] bundle created at build/output/web/main.js\");\n}\n\nexport async function buildAndPublish(\n\troot: string,\n\t{\n\t\tshouldBuild = true,\n\t\tshouldUpload = true,\n\t}: { shouldBuild: boolean; shouldUpload: boolean } = {\n\t\tshouldBuild: true,\n\t\tshouldUpload: true,\n\t},\n) {\n\tif (shouldBuild) {\n\t\tawait bundleWeb(root);\n\t}\n\tif (shouldUpload) {\n\t\tawait createWebBuild(root);\n\t}\n}\n\nexport async function createWebBuild(root: string) {\n\tconst viewTypes = await getSupportedAppViewTypes(root);\n\n\tconst fullDirectory = path.join(root, \"build\", \"output\", \"web\");\n\tconst mainJsFile = path.join(fullDirectory, \"main.js\");\n\n\t// Verify bundle exists\n\ttry {\n\t\tawait readFile(mainJsFile);\n\t} catch {\n\t\tthrow new Error(`main.js not found in ${fullDirectory}`);\n\t}\n\n\tconst buf = await readFile(mainJsFile);\n\tconst checksum = await getChecksum(buf);\n\n\tconsole.log(` ✔︎ [web] build checksummed: ${checksum}`);\n\n\tconst fileName = `rnweb_${checksum}.js`;\n\tconst uploadedFile = await uploadFile(\n\t\tbuf,\n\t\tfileName,\n\t\t\"application/javascript\",\n\t);\n\n\tconsole.log(\n\t\t` ✔︎ [web] uploaded build: ${fileName} (${(buf.length / 1024).toFixed(\n\t\t\t0,\n\t\t)} KB)`,\n\t);\n\n\tconst build = await whopSdk.appBuilds.create({\n\t\tattachment: { direct_upload_id: uploadedFile.directUploadId },\n\t\tchecksum,\n\t\tapp_id: APP_ID,\n\t\tplatform: \"web\",\n\t\tai_prompt_id: AI_PROMPT_ID,\n\t\tsupported_app_view_types: viewTypes.map(\n\t\t\t(view) =>\n\t\t\t\t({\n\t\t\t\t\t\"experience-view\": \"hub\" as const,\n\t\t\t\t\t\"discover-view\": \"discover\" as const,\n\t\t\t\t\t\"dashboard-view\": \"dashboard\" as const,\n\t\t\t\t})[view],\n\t\t),\n\t});\n\n\tif (!build) {\n\t\tthrow new Error(\"Failed to create app build\");\n\t}\n\n\tconst companyPart = COMPANY_ID ? `${COMPANY_ID}/` : \"\";\n\tconst dashboardUrl = `https://whop.com/dashboard/${companyPart}developer/apps/${APP_ID}/builds/?platform=web`;\n\n\tconsole.log(\n\t\t`\\n ✔︎ [web] deployed as development build ✔︎\\n - build id: ${\n\t\t\tbuild.id\n\t\t}\\n - view types: ${build.supported_app_view_types.join(\n\t\t\t\", \",\n\t\t)}\\n - promote to production here: ${dashboardUrl}\\n`,\n\t);\n\n\treturn build;\n}\n","import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n// build/plugins/reanimatedBabel.ts\nimport * as babel from \"@babel/core\";\n\nconst JS_RE = /\\.(m|c)?(t|j)sx?$/;\n\nexport function reanimatedBabelPlugin() {\n\t// Transform only: your app source (outside node_modules) and reanimated itself.\n\tconst shouldTransform = (p: string) => {\n\t\tif (!JS_RE.test(p)) return false;\n\t\t// Always run on reanimated’s files\n\t\tif (p.includes(`${path.sep}react-native-reanimated${path.sep}`))\n\t\t\treturn true;\n\t\t// Never touch third-party deps\n\t\tif (p.includes(`${path.sep}node_modules${path.sep}`)) return false;\n\t\t// Run on app code under src/\n\t\treturn p.includes(`${path.sep}src${path.sep}`);\n\t};\n\n\treturn {\n\t\tname: \"reanimated-babel\",\n\t\tsetup(b: import(\"esbuild\").PluginBuild) {\n\t\t\tb.onLoad({ filter: JS_RE }, async (args) => {\n\t\t\t\tif (!shouldTransform(args.path)) {\n\t\t\t\t\t// Skip non-target files so other plugins (and esbuild) can process them\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst code = await fs.readFile(args.path, \"utf8\");\n\t\t\t\tconst result = await babel.transformAsync(code, {\n\t\t\t\t\tfilename: args.path,\n\t\t\t\t\tsourceMaps: false,\n\t\t\t\t\tbabelrc: false,\n\t\t\t\t\tconfigFile: false,\n\t\t\t\t\t// ORDER MATTERS: Reanimated plugin MUST BE LAST\n\t\t\t\t\tplugins: [\n\t\t\t\t\t\t// Needed by Reanimated on web per docs\n\t\t\t\t\t\t\"@babel/plugin-transform-export-namespace-from\",\n\t\t\t\t\t\t// Handle Flow types present in some RN libs\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"@babel/plugin-transform-flow-strip-types\",\n\t\t\t\t\t\t\t{ allowDeclareFields: true },\n\t\t\t\t\t\t],\n\t\t\t\t\t\t// MUST be last\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"react-native-reanimated/plugin\",\n\t\t\t\t\t\t\t{ relativeSourceLocation: true },\n\t\t\t\t\t\t],\n\t\t\t\t\t],\n\t\t\t\t\tpresets: [], // esbuild handles TS/JSX syntax; no preset-env/preset-react\n\t\t\t\t\tcaller: { name: \"esbuild\" },\n\t\t\t\t\t// Let Babel parse TS/JSX/Flow; keep it broad\n\t\t\t\t\tparserOpts: { plugins: [\"jsx\", \"typescript\"] },\n\t\t\t\t\tgeneratorOpts: { decoratorsBeforeExport: true },\n\t\t\t\t});\n\n\t\t\t\treturn {\n\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: <explanation>\n\t\t\t\t\tcontents: result!.code!,\n\t\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\t\t\t\tloader: pickLoader(args.path) as any,\n\t\t\t\t};\n\t\t\t});\n\t\t},\n\t};\n}\n\nfunction pickLoader(file: string) {\n\tconst ext = path.extname(file).toLowerCase();\n\tif (ext === \".tsx\") return \"tsx\";\n\tif (ext === \".ts\") return \"ts\";\n\tif (ext === \".jsx\") return \"jsx\";\n\t// For .js: many RN libs contain JSX; be permissive\n\treturn \"jsx\";\n}\n","import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n// stripFlowWithBabel.ts\nimport * as babel from \"@babel/core\";\n\nexport function stripFlowWithBabel() {\n\tconst filter = /\\.(m|c)?jsx?$/;\n\treturn {\n\t\tname: \"strip-flow-with-babel\",\n\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\tsetup(b: any) {\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\t\tb.onLoad({ filter }, async (args: any) => {\n\t\t\t\t// Only process react-native core files that contain Flow\n\t\t\t\tif (!args.path.includes(`${path.sep}react-native${path.sep}`)) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst code = await fs.readFile(args.path, \"utf8\");\n\t\t\t\tconst out = await babel.transformAsync(code, {\n\t\t\t\t\tfilename: args.path,\n\t\t\t\t\tbabelrc: false,\n\t\t\t\t\tconfigFile: false,\n\t\t\t\t\tplugins: [\n\t\t\t\t\t\t// Use Hermes parser to handle modern Flow syntax (as casts, type predicates, mapped types, etc.)\n\t\t\t\t\t\t\"babel-plugin-syntax-hermes-parser\",\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"@babel/plugin-transform-flow-strip-types\",\n\t\t\t\t\t\t\t{ allowDeclareFields: true },\n\t\t\t\t\t\t],\n\t\t\t\t\t],\n\t\t\t\t\tsourceMaps: false,\n\t\t\t\t});\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: <explanation>\n\t\t\t\treturn { contents: out!.code!, loader: \"jsx\" };\n\t\t\t});\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;AAAA,SAAS,cAAAA,mBAAkB;AAC3B,OAAOC,WAAU;AACjB,SAAS,iBAAiB;AAC1B,SAAS,UAAAC,eAAc;AACvB,OAAO,YAAY;AACnB,SAAS,cAAc;;;ACLvB,SAAS,YAAY,cAAc,aAAa,gBAAgB;AAChE,SAAS,OAAO,QAAQ,iBAAiB;AACzC,OAAOC,WAAU;AACjB,SAAS,kBAAkB,mBAAmB;AAC9C,SAAS,cAAc;AACvB,OAAO,WAAW;AAClB,SAA8C,gBAAgB;;;ACN9D,SAAS,kBAAkB;;;ACA3B,SAAS,qBAAqB;AAC9B,OAAO,UAAU;AACjB,SAAS,cAAc;AAEvB,OAAO;AAAA,EACN,MAAM,CAAC,QAAQ,cAAc,oBAAoB,iBAAiB;AACnE,CAAC;AAEM,SAAS,IAAI,KAAa;AAChC,QAAM,QAAQ,QAAQ,IAAI,GAAG;AAC7B,MAAI,CAAC,OAAO;AACX,UAAM,IAAI,MAAM,iCAAiC,GAAG,EAAE;AAAA,EACvD;AACA,SAAO;AACR;AAEO,IAAM,aAAa,QAAQ,IAAI;AAC/B,IAAM,SAAS,IAAI,yBAAyB;AAC5C,IAAM,eAAe,QAAQ,IAAI;AAEjC,IAAM,aAA4B,cAAc;AAAA,EACtD,WAAW,IAAI,cAAc;AAAA,EAC7B,OAAO;AACR,CAAC;AAEM,IAAM,UAAU,IAAI,KAAK,EAAE,OAAO,OAAO,CAAC;;;ADtBjD,eAAsB,WACrB,MACA,MACA,aACC;AACD,QAAM,OAAO,IAAI,KAAK,CAAC,IAAI,GAAG,MAAM;AAAA,IACnC,M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Q,KAAK,CAAC;AACf,CAAC,EACA,KAAK,MAAM;AACX,UAAQ,KAAK,CAAC;AACf,CAAC;","names":["existsSync","path","findUp","path","path","path","build","mkdir","readFile","writeFile","path","fs","path","fs","path","babel","path","readFile","mkdir","writeFile","buildAndPublish","build","buildAndPublish","path","existsSync","findUp"]}
|
|
1
|
+
{"version":3,"sources":["../../src/cli/index.ts","../../src/cli/mobile.ts","../../src/cli/file.ts","../../src/cli/sdk.ts","../../src/cli/load-metro-config.ts","../../src/cli/valid-view-type.ts","../../src/cli/web.ts","../../src/cli/reanimated-bable.ts","../../src/cli/strip-flow.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport { parseArgs } from \"node:util\";\nimport { findUp } from \"find-up\";\nimport qrcode from \"qrcode-terminal\";\nimport { rimraf } from \"rimraf\";\nimport { buildAndPublish } from \"./mobile\";\nimport { env } from \"./sdk\";\nimport { buildAndPublish as buildAndPublishWeb } from \"./web\";\n\nasync function main() {\n\tconst args = parseArgs({\n\t\toptions: {\n\t\t\tios: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t\tandroid: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t\tweb: {\n\t\t\t\ttype: \"boolean\",\n\t\t\t},\n\t\t},\n\t\tstrict: true,\n\t\tallowPositionals: true,\n\t\targs: process.argv.slice(2),\n\t});\n\n\tconst [command] = args.positionals;\n\n\tif (command === \"install\") {\n\t\tawait handleInstall();\n\t\treturn;\n\t}\n\n\tlet shouldBuild = true;\n\tlet shouldUpload = true;\n\tlet shouldClean = true;\n\tif (command === \"build\") {\n\t\tshouldUpload = false;\n\t} else if (command === \"ship\") {\n\t\tshouldBuild = true;\n\t\tshouldUpload = true;\n\t} else if (command === \"upload\") {\n\t\tshouldBuild = false;\n\t\tshouldClean = false;\n\t} else if (command === \"clean\") {\n\t\tshouldBuild = false;\n\t\tshouldUpload = false;\n\t} else {\n\t\tconsole.error(\n\t\t\t`Usage:\n\twhop-react-native ship [--ios] [--android] [--web] # runs build and then publishes it as a dev build to whop.\n\twhop-react-native build [--ios] [--android] [--web] # builds your app into a distributable bundle in the build/ directory.\n\twhop-react-native upload [--ios] [--android] [--web] # uploads the existing build directory to whop.\n\twhop-react-native clean # cleans the build directory.`,\n\t\t);\n\t\tprocess.exit(1);\n\t}\n\n\tconst root = await getRootProjectDirectory();\n\n\tif (shouldClean) {\n\t\tawait cleanBuildDirectory(root);\n\t}\n\n\tconst didProvidePlatform =\n\t\targs.values.ios || args.values.android || args.values.web;\n\n\tconst opts = { shouldBuild, shouldUpload };\n\tconst promises: Promise<void>[] = [];\n\n\tif (args.values.ios || !didProvidePlatform) {\n\t\tpromises.push(buildAndPublish(root, \"ios\", opts));\n\t}\n\tif (args.values.android || !didProvidePlatform) {\n\t\tpromises.push(buildAndPublish(root, \"android\", opts));\n\t}\n\tif (args.values.web || !didProvidePlatform) {\n\t\tpromises.push(buildAndPublishWeb(root, opts));\n\t}\n\n\tawait Promise.all(promises);\n}\n\nasync function cleanBuildDirectory(root: string) {\n\tconst buildDirectory = path.join(root, \"build\");\n\tif (existsSync(buildDirectory)) {\n\t\tawait rimraf(buildDirectory);\n\t}\n\tconsole.log(\" ✔︎ cleaned build directory\");\n}\n\nasync function getRootProjectDirectory() {\n\tconst file = await findUp(\"package.json\", { cwd: process.cwd() });\n\tif (!file) {\n\t\tthrow new Error(\n\t\t\t\"please run this command inside a whop react native project\",\n\t\t);\n\t}\n\tconst root = path.dirname(file);\n\treturn root;\n}\n\nasync function handleInstall() {\n\tconst appId = env(\"NEXT_PUBLIC_WHOP_APP_ID\");\n\tconst installLink = `https://whop.com/apps/${appId}/install`;\n\n\tconsole.log(`\nOpen this link in your browser to install the app into your whop.\n${installLink}\n\nOr scan the QR code with your iPhone:\n\t`);\n\n\tqrcode.generate(installLink, { small: true });\n}\n\nmain()\n\t.catch((err) => {\n\t\tconsole.error(err);\n\t\tprocess.exit(1);\n\t})\n\t.then(() => {\n\t\tprocess.exit(0);\n\t});\n","import { existsSync, readFileSync, readdirSync, statSync } from \"node:fs\";\nimport { mkdir, rename, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { getDefaultConfig, mergeConfig } from \"@react-native/metro-config\";\nimport { findUp } from \"find-up\";\nimport JSZip from \"jszip\";\nimport { type ReportableEvent, type Reporter, runBuild } from \"metro\";\nimport { getChecksum, uploadFile } from \"./file\";\nimport { loadMetroConfig } from \"./load-metro-config\";\nimport { AI_PROMPT_ID, APP_ID, COMPANY_ID, whopSdk } from \"./sdk\";\nimport { getSupportedAppViewTypes } from \"./valid-view-type\";\n\nexport async function buildAndPublish(\n\troot: string,\n\tplatform: \"ios\" | \"android\",\n\t{\n\t\tshouldBuild = true,\n\t\tshouldUpload = true,\n\t}: { shouldBuild: boolean; shouldUpload: boolean } = {\n\t\tshouldBuild: true,\n\t\tshouldUpload: true,\n\t},\n) {\n\tif (shouldBuild) {\n\t\tawait bundle(root, platform);\n\t}\n\tif (shouldUpload) {\n\t\tawait createMobileBuild(root, platform);\n\t}\n}\n\nexport async function bundle(root: string, platform: \"ios\" | \"android\") {\n\tawait makeEntrypoint(root, platform);\n\n\tconst outputFile = path.join(\n\t\troot,\n\t\t\"build\",\n\t\t\"output\",\n\t\tplatform,\n\t\t\"main_js_bundle\",\n\t);\n\n\tawait mkdir(path.dirname(outputFile), { recursive: true });\n\n\tconst babelLocation = require.resolve(\"@babel/runtime/package\");\n\n\tconst bableNodeModules = await findUp(\"node_modules\", {\n\t\tcwd: babelLocation,\n\t\ttype: \"directory\",\n\t});\n\n\tif (!bableNodeModules) {\n\t\tthrow new Error(\"babel node_modules parent folder not found\");\n\t}\n\n\tconst defaultConfig = getDefaultConfig(root);\n\tconst projectConfig = await loadMetroConfig(root);\n\n\tconst defaultMetroConfig = mergeConfig(defaultConfig, projectConfig);\n\n\tconst metroConfig = mergeConfig(defaultMetroConfig, {\n\t\tprojectRoot: root,\n\t\ttransformer: {\n\t\t\tbabelTransformerPath: require.resolve(\n\t\t\t\t\"./whop-react-native-babel-transformer.js\",\n\t\t\t),\n\t\t},\n\t\tcacheStores: [],\n\t\twatchFolders: [root, path.resolve(root, \"node_modules\"), bableNodeModules],\n\t\treporter: new CustomReporter(),\n\t\tresolver: {\n\t\t\tnodeModulesPaths: [\n\t\t\t\t...(defaultMetroConfig.resolver?.nodeModulesPaths ?? []),\n\t\t\t\tbableNodeModules,\n\t\t\t],\n\t\t},\n\t});\n\n\tawait runBuild(metroConfig, {\n\t\tdev: false,\n\t\tentry: `build/entrypoints/${platform}/index.js`,\n\t\tminify: false,\n\t\tplatform: platform,\n\t\tsourceMap: false,\n\t\tout: outputFile,\n\t});\n\n\tawait rename(\n\t\t`${outputFile}.js`,\n\t\tpath.join(root, \"build\", \"output\", platform, \"main_js_bundle.hbc\"),\n\t);\n\n\tconsole.log(` ✔︎ [${platform}] bundle created`);\n}\n\n// getSupportedAppViewTypes moved to valid-view-type.ts\n\nasync function makeEntrypoint(\n\troot: string,\n\tplatform: \"ios\" | \"android\",\n): Promise<string> {\n\tconst entrypoint = path.join(\n\t\troot,\n\t\t\"build\",\n\t\t\"entrypoints\",\n\t\tplatform,\n\t\t\"index.js\",\n\t);\n\n\tconst files = await getSupportedAppViewTypes(root);\n\n\tconst pascalCase = (str: string) =>\n\t\tstr\n\t\t\t.split(\"-\")\n\t\t\t.map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n\t\t\t.join(\"\");\n\n\tconst imports = files.map(\n\t\t(file) =>\n\t\t\t`import { ${pascalCase(file)} } from \"../../../src/views/${file}\";`,\n\t);\n\tconst registry = files.map(\n\t\t(file) =>\n\t\t\t`AppRegistry.registerComponent(\"${pascalCase(file)}\", () => ${pascalCase(\n\t\t\t\tfile,\n\t\t\t)});`,\n\t);\n\n\tconst entrypointContent = `import { AppRegistry } from \"react-native\";\n${imports.join(\"\\n\")}\n\n${registry.join(\"\\n\")}\n`;\n\n\tconst entrypointDir = path.dirname(entrypoint);\n\tawait mkdir(entrypointDir, { recursive: true });\n\tawait writeFile(entrypoint, entrypointContent, \"utf-8\");\n\n\tconsole.log(` ✔︎ [${platform}] entrypoint created`);\n\n\treturn entrypoint;\n}\n\nexport async function createMobileBuild(\n\troot: string,\n\tplatform: \"ios\" | \"android\",\n) {\n\tconst viewTypes = await getSupportedAppViewTypes(root);\n\n\tconst fullDirectory = path.join(root, \"build\", \"output\", platform);\n\n\t// Check if the directory contains a file called `main_js_bundle.hbc`\n\tconst mainJsBundle = path.join(fullDirectory, \"main_js_bundle.hbc\");\n\n\tif (!existsSync(mainJsBundle)) {\n\t\tthrow new Error(`main_js_bundle.hbc not found in ${fullDirectory}`);\n\t}\n\n\t// check that that folder only contains the main_js_bundle.hbc file and an optional `assets` folder\n\tconst files = readdirSync(fullDirectory);\n\tif (\n\t\tfiles.length > 2 ||\n\t\tfiles.length < 1 ||\n\t\t!files.includes(\"main_js_bundle.hbc\")\n\t) {\n\t\tthrow new Error(\n\t\t\t\"Directory must contain only the main_js_bundle.hbc file and an optional `assets` folder\",\n\t\t);\n\t}\n\tif (files.length === 2 && !files.includes(\"assets\")) {\n\t\tthrow new Error(\n\t\t\t\"Directory must contain only the main_js_bundle.hbc file and an optional `assets` folder\",\n\t\t);\n\t}\n\n\t// Zip the directory\n\tconst zipData = await zipDirectory(fullDirectory);\n\n\tconst checksum = await getChecksum(zipData);\n\n\tconsole.log(` ✔︎ [${platform}] build zipped with checksum: ${checksum}`);\n\n\tconst fileName = `app_build_${platform}.zip`;\n\tconst uploadedFile = await uploadFile(zipData, fileName, \"application/zip\");\n\n\tconsole.log(\n\t\t` ✔︎ [${platform}] uploaded build: ${fileName} (${(\n\t\t\tzipData.length / 1024\n\t\t).toFixed(0)} KB)`,\n\t);\n\n\tconst build = await whopSdk.appBuilds.create({\n\t\tattachment: { direct_upload_id: uploadedFile.directUploadId },\n\t\tchecksum,\n\t\tapp_id: APP_ID,\n\t\tplatform,\n\t\tai_prompt_id: AI_PROMPT_ID,\n\t\tsupported_app_view_types: viewTypes.map(\n\t\t\t(view) =>\n\t\t\t\t({\n\t\t\t\t\t\"experience-view\": \"hub\" as const,\n\t\t\t\t\t\"discover-view\": \"discover\" as const,\n\t\t\t\t\t\"dashboard-view\": \"dashboard\" as const,\n\t\t\t\t})[view],\n\t\t),\n\t});\n\n\tif (!build) {\n\t\tthrow new Error(\"Failed to create app build\");\n\t}\n\n\tconst companyPart = COMPANY_ID ? `${COMPANY_ID}/` : \"\";\n\tconst dashboardUrl = `https://whop.com/dashboard/${companyPart}developer/apps/${APP_ID}/builds/?platform=${platform}`;\n\n\tconsole.log(`\\n ✔︎ [${platform}] deployed as development build ✔︎\n - build id: ${build.id}\n - view types: ${build.supported_app_view_types.join(\", \")}\n - promote to production here: ${dashboardUrl}\\n`);\n\n\treturn build;\n}\n\nasync function zipDirectory(\n\tdirectory: string,\n): Promise<Buffer<ArrayBufferLike>> {\n\tconst zip = new JSZip();\n\n\t// Recursively add files to zip\n\tfunction addFilesToZip(currentPath: string, relativePath = \"\") {\n\t\tconst items = readdirSync(currentPath);\n\n\t\tfor (const item of items) {\n\t\t\tconst fullPath = path.join(currentPath, item);\n\t\t\tconst zipPath = relativePath ? path.join(relativePath, item) : item;\n\t\t\tconst stats = statSync(fullPath);\n\n\t\t\tif (stats.isDirectory()) {\n\t\t\t\taddFilesToZip(fullPath, zipPath);\n\t\t\t} else {\n\t\t\t\tconst fileContent = readFileSync(fullPath);\n\t\t\t\tzip.file(zipPath, fileContent);\n\t\t\t}\n\t\t}\n\t}\n\n\taddFilesToZip(directory);\n\n\t// Generate zip file\n\tconst zipData = await zip.generateAsync({ type: \"nodebuffer\" });\n\n\treturn zipData;\n}\n\nclass CustomReporter implements Reporter {\n\tupdate(event: ReportableEvent) {\n\t\t// Do nothing.\n\t}\n}\n","import { createHash } from \"node:crypto\";\nimport { APP_ID, oldWhopSdk } from \"./sdk\";\n\nexport async function uploadFile(\n\tdata: Buffer<ArrayBufferLike>,\n\tname: string,\n\tcontentType: string,\n) {\n\tconst file = new File([data], name, {\n\t\ttype: contentType,\n\t});\n\n\tconst uploadedFile = await oldWhopSdk.attachments.uploadAttachment({\n\t\tfile,\n\t\trecord: \"app\",\n\t\tid: APP_ID,\n\t});\n\n\treturn uploadedFile;\n}\n\nexport async function getChecksum(data: Buffer<ArrayBufferLike>) {\n\tconst hash = createHash(\"sha256\");\n\thash.update(data);\n\treturn hash.digest(\"hex\");\n}\n","import { WhopServerSdk } from \"@whop/api\";\nimport Whop from \"@whop/sdk\";\nimport { config } from \"dotenv\";\n\nconfig({\n\tpath: [\".env\", \".env.local\", \".env.development\", \".env.production\"],\n});\n\nexport function env(key: string) {\n\tconst value = process.env[key];\n\tif (!value) {\n\t\tthrow new Error(`Missing environment variable: ${key}`);\n\t}\n\treturn value;\n}\n\nconst BASE_URL = process.env.WHOP_BASE_URL;\n\nexport const COMPANY_ID = process.env.NEXT_PUBLIC_WHOP_COMPANY_ID;\nexport const APP_ID = env(\"NEXT_PUBLIC_WHOP_APP_ID\");\nexport const AI_PROMPT_ID = process.env.AI_PROMPT_ID;\n\nexport const oldWhopSdk: WhopServerSdk = WhopServerSdk({\n\tappApiKey: env(\"WHOP_API_KEY\"),\n\tappId: APP_ID,\n\tapiOrigin: BASE_URL ? new URL(BASE_URL).origin : undefined,\n});\n\nexport const whopSdk = new Whop({\n\tappID: APP_ID,\n\tbaseURL: BASE_URL ? new URL(\"/api/v1\", BASE_URL).href : undefined,\n});\n","import fs from \"node:fs\";\nimport path from \"node:path\";\nimport { loadConfig } from \"metro\";\n\nexport async function loadMetroConfig(projectRoot: string) {\n\tconst file = fs.existsSync(path.join(projectRoot, \"metro.config.js\"));\n\tif (!file) return {};\n\treturn await loadConfig({ cwd: projectRoot }, {});\n}\n","import { readdir } from \"node:fs/promises\";\nimport path from \"node:path\";\n\nexport const VALID_VIEW_TYPES = [\n\t\"experience-view\",\n\t\"discover-view\",\n\t\"dashboard-view\",\n] as const;\n\nexport async function getSupportedAppViewTypes(\n\troot: string,\n): Promise<(typeof VALID_VIEW_TYPES)[number][]> {\n\tconst views = await readdir(path.join(root, \"src\", \"views\"), {\n\t\twithFileTypes: true,\n\t\trecursive: false,\n\t});\n\tconst files = views\n\t\t.filter((file) => file.isFile())\n\t\t.map((file) => file.name.split(\".\")[0])\n\t\t.filter((file) => !!file);\n\n\tconst validViews = files.filter((file) =>\n\t\tVALID_VIEW_TYPES.includes(file as (typeof VALID_VIEW_TYPES)[number]),\n\t) as (typeof VALID_VIEW_TYPES)[number][];\n\n\tif (validViews.length === 0) {\n\t\tthrow new Error(\n\t\t\t`No valid views found, please create a view in the src/views folder and name it with a valid view type: ${VALID_VIEW_TYPES.join(\", \")}`,\n\t\t);\n\t}\n\n\treturn validViews;\n}\n","import { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { build } from \"esbuild\";\nimport { getChecksum, uploadFile } from \"./file\";\nimport { reanimatedBabelPlugin } from \"./reanimated-bable\";\nimport { AI_PROMPT_ID, APP_ID, COMPANY_ID, whopSdk } from \"./sdk\";\nimport { stripFlowWithBabel } from \"./strip-flow\";\nimport { getSupportedAppViewTypes } from \"./valid-view-type\";\n\nfunction aliasReactNativePlugin() {\n\treturn {\n\t\tname: \"alias-react-native\",\n\t\tsetup(b: import(\"esbuild\").PluginBuild) {\n\t\t\tb.onResolve({ filter: /^react-native$/ }, () => ({\n\t\t\t\tpath: require.resolve(\"react-native-web\"),\n\t\t\t}));\n\t\t},\n\t} satisfies import(\"esbuild\").Plugin;\n}\n\nfunction forceSingleReact() {\n\tconst map = new Map<string, string>([\n\t\t[\"react\", require.resolve(\"react\")],\n\t\t[\"react/jsx-runtime\", require.resolve(\"react/jsx-runtime\")],\n\t\t[\"react/jsx-dev-runtime\", require.resolve(\"react/jsx-dev-runtime\")],\n\t\t[\"react-dom\", require.resolve(\"react-dom\")],\n\t\t[\"react-dom/client\", require.resolve(\"react-dom/client\")],\n\t]);\n\n\tconst rx = /^(react(?:\\/jsx-(?:dev-)?runtime)?|react-dom(?:\\/client)?)$/;\n\n\treturn {\n\t\tname: \"force-single-react\",\n\t\tsetup(b: import(\"esbuild\").PluginBuild) {\n\t\t\t// biome-ignore lint/style/noNonNullAssertion: <explanation>\n\t\t\tb.onResolve({ filter: rx }, (args) => ({ path: map.get(args.path)! }));\n\t\t},\n\t} satisfies import(\"esbuild\").Plugin;\n}\n\nfunction toPascalCase(str: string) {\n\treturn str\n\t\t.split(\"-\")\n\t\t.map((word) => word.charAt(0).toUpperCase() + word.slice(1))\n\t\t.join(\"\");\n}\n\nasync function makeWebEntrypoint(root: string) {\n\tconst files = await getSupportedAppViewTypes(root);\n\n\tconst packageJsonPath = path.join(root, \"package.json\");\n\tconst packageJson = JSON.parse(await readFile(packageJsonPath, \"utf-8\"));\n\tconst hasReactNativeReanimated =\n\t\tpackageJson.dependencies?.[\"react-native-reanimated\"];\n\n\tconst imports = files.map(\n\t\t(file) =>\n\t\t\t`import { ${toPascalCase(file)} } from \"../../../src/views/${file}\";`,\n\t);\n\tconst registry = files.map(\n\t\t(file) =>\n\t\t\t`AppRegistry.registerComponent(\"${toPascalCase(\n\t\t\t\tfile,\n\t\t\t)}\", () => WhopNavigationWrapper(React, \"${toPascalCase(\n\t\t\t\tfile,\n\t\t\t)}\", ${toPascalCase(file)}));`,\n\t);\n\n\tconst defaultKey = toPascalCase(files[0] ?? \"experience-view\");\n\tconst reanimatedImport = hasReactNativeReanimated\n\t\t? `import \"react-native-reanimated\";`\n\t\t: \"\";\n\n\tconst entry = `import { AppRegistry } from \"react-native\";\nimport * as React from \"react\";\nimport { WhopNavigationWrapper } from \"@whop/react-native/web\";\n${reanimatedImport}\n\n${imports.join(\"\\n\")}\n\n${registry.join(\"\\n\")}\n\nconst viewType = new URLSearchParams(window.location.search).get(\"app_view\") ?? \"${defaultKey}\";\n\nconst root = document.getElementById(\"root\") || (() => {\n\tconst d = document.createElement(\"div\");\n\td.id = \"root\";\n\tdocument.body.appendChild(d);\n\treturn d;\n})();\nAppRegistry.runApplication(viewType, { rootTag: root });\n`;\n\n\tconst entryFile = path.join(root, \"build\", \"entrypoints\", \"web\", \"index.tsx\");\n\tawait mkdir(path.dirname(entryFile), { recursive: true });\n\tawait writeFile(entryFile, entry, \"utf-8\");\n\n\treturn entryFile;\n}\n\nexport async function bundleWeb(root: string) {\n\tconst entry = await makeWebEntrypoint(root);\n\n\tconst outDir = path.join(root, \"build\", \"output\", \"web\");\n\tawait mkdir(outDir, { recursive: true });\n\n\tawait build({\n\t\tentryPoints: [entry],\n\t\toutfile: path.join(outDir, \"main.js\"),\n\t\tbundle: true,\n\t\tminify: false,\n\t\tformat: \"esm\",\n\t\tplatform: \"browser\",\n\t\tsourcemap: false,\n\t\tjsx: \"automatic\",\n\t\tmainFields: [\"browser\", \"module\", \"main\"],\n\t\tconditions: [\"browser\", \"import\", \"default\"],\n\t\tdefine: {\n\t\t\tprocess: \"{}\",\n\t\t\t\"process.env\": \"{}\",\n\t\t\t\"process.env.NODE_ENV\": '\"production\"',\n\t\t\t__DEV__: \"false\",\n\t\t\t\"process.env.NEXT_PUBLIC_WHOP_APP_ID\": `\"${APP_ID}\"`,\n\t\t\t// Some RN libraries (e.g., RNGH) expect a Node-like global in the browser\n\t\t\tglobal: \"globalThis\",\n\t\t},\n\t\tresolveExtensions: [\n\t\t\t\".web.tsx\",\n\t\t\t\".web.ts\",\n\t\t\t\".web.js\",\n\t\t\t\".tsx\",\n\t\t\t\".ts\",\n\t\t\t\".jsx\",\n\t\t\t\".js\",\n\t\t],\n\t\tloader: {\n\t\t\t\".png\": \"dataurl\",\n\t\t\t\".jpg\": \"dataurl\",\n\t\t\t\".jpeg\": \"dataurl\",\n\t\t\t\".svg\": \"dataurl\",\n\t\t\t\".ttf\": \"dataurl\",\n\t\t\t\".woff\": \"dataurl\",\n\t\t\t\".woff2\": \"dataurl\",\n\t\t\t\".js\": \"jsx\",\n\t\t\t\".jsx\": \"jsx\",\n\t\t},\n\t\tplugins: [\n\t\t\tforceSingleReact(),\n\t\t\taliasReactNativePlugin(),\n\t\t\treanimatedBabelPlugin(),\n\t\t\tstripFlowWithBabel(),\n\t\t\t{\n\t\t\t\tname: \"force-native-web-stub\",\n\t\t\t\tsetup(b) {\n\t\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\t\t\t\tb.onResolve({ filter: /^\\.\\/native-whop-core$/ }, (args: any) => {\n\t\t\t\t\t\t// Always resolve the local source file so extension resolution (.web.ts) applies\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tpath: path.join(args.resolveDir, \"native-whop-core\"),\n\t\t\t\t\t\t\tnamespace: \"file\",\n\t\t\t\t\t\t};\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t});\n\n\tconst html = `<!doctype html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\" />\n\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n\t\t<title>Whop App (Web)</title>\n\t\t<style>\n\t\t\t#root {\n\t\t\t\twidth: 100vw;\n\t\t\t\theight: 100vh;\n\t\t\t\tmargin: 0;\n\t\t\t\tpadding: 0;\n\t\t\t\toverflow: hidden;\n\t\t\t\tdisplay: flex;\n\t\t\t\tflex-direction: column;\n\t\t\t\talign-items: stretch;\n\t\t\t\tjustify-content: start;\n\t\t\t}\n\t\t</style>\n\t</head>\n\t<body>\n\t\t<div id=\"root\"></div>\n\t\t<script type=\"module\" src=\"./main.js\"></script>\n\t</body>\n</html>`;\n\tawait writeFile(path.join(outDir, \"index.html\"), html, \"utf-8\");\n\n\tconsole.log(\" ✔︎ [web] bundle created at build/output/web/main.js\");\n}\n\nexport async function buildAndPublish(\n\troot: string,\n\t{\n\t\tshouldBuild = true,\n\t\tshouldUpload = true,\n\t}: { shouldBuild: boolean; shouldUpload: boolean } = {\n\t\tshouldBuild: true,\n\t\tshouldUpload: true,\n\t},\n) {\n\tif (shouldBuild) {\n\t\tawait bundleWeb(root);\n\t}\n\tif (shouldUpload) {\n\t\tawait createWebBuild(root);\n\t}\n}\n\nexport async function createWebBuild(root: string) {\n\tconst viewTypes = await getSupportedAppViewTypes(root);\n\n\tconst fullDirectory = path.join(root, \"build\", \"output\", \"web\");\n\tconst mainJsFile = path.join(fullDirectory, \"main.js\");\n\n\t// Verify bundle exists\n\ttry {\n\t\tawait readFile(mainJsFile);\n\t} catch {\n\t\tthrow new Error(`main.js not found in ${fullDirectory}`);\n\t}\n\n\tconst buf = await readFile(mainJsFile);\n\tconst checksum = await getChecksum(buf);\n\n\tconsole.log(` ✔︎ [web] build checksummed: ${checksum}`);\n\n\tconst fileName = `rnweb_${checksum}.js`;\n\tconst uploadedFile = await uploadFile(\n\t\tbuf,\n\t\tfileName,\n\t\t\"application/javascript\",\n\t);\n\n\tconsole.log(\n\t\t` ✔︎ [web] uploaded build: ${fileName} (${(buf.length / 1024).toFixed(\n\t\t\t0,\n\t\t)} KB)`,\n\t);\n\n\tconst build = await whopSdk.appBuilds.create({\n\t\tattachment: { direct_upload_id: uploadedFile.directUploadId },\n\t\tchecksum,\n\t\tapp_id: APP_ID,\n\t\tplatform: \"web\",\n\t\tai_prompt_id: AI_PROMPT_ID,\n\t\tsupported_app_view_types: viewTypes.map(\n\t\t\t(view) =>\n\t\t\t\t({\n\t\t\t\t\t\"experience-view\": \"hub\" as const,\n\t\t\t\t\t\"discover-view\": \"discover\" as const,\n\t\t\t\t\t\"dashboard-view\": \"dashboard\" as const,\n\t\t\t\t})[view],\n\t\t),\n\t});\n\n\tif (!build) {\n\t\tthrow new Error(\"Failed to create app build\");\n\t}\n\n\tconst companyPart = COMPANY_ID ? `${COMPANY_ID}/` : \"\";\n\tconst dashboardUrl = `https://whop.com/dashboard/${companyPart}developer/apps/${APP_ID}/builds/?platform=web`;\n\n\tconsole.log(\n\t\t`\\n ✔︎ [web] deployed as development build ✔︎\\n - build id: ${\n\t\t\tbuild.id\n\t\t}\\n - view types: ${build.supported_app_view_types.join(\n\t\t\t\", \",\n\t\t)}\\n - promote to production here: ${dashboardUrl}\\n`,\n\t);\n\n\treturn build;\n}\n","import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n// build/plugins/reanimatedBabel.ts\nimport * as babel from \"@babel/core\";\n\nconst JS_RE = /\\.(m|c)?(t|j)sx?$/;\n\nexport function reanimatedBabelPlugin() {\n\t// Transform only: your app source (outside node_modules) and reanimated itself.\n\tconst shouldTransform = (p: string) => {\n\t\tif (!JS_RE.test(p)) return false;\n\t\t// Always run on reanimated’s files\n\t\tif (p.includes(`${path.sep}react-native-reanimated${path.sep}`))\n\t\t\treturn true;\n\t\t// Never touch third-party deps\n\t\tif (p.includes(`${path.sep}node_modules${path.sep}`)) return false;\n\t\t// Run on app code under src/\n\t\treturn p.includes(`${path.sep}src${path.sep}`);\n\t};\n\n\treturn {\n\t\tname: \"reanimated-babel\",\n\t\tsetup(b: import(\"esbuild\").PluginBuild) {\n\t\t\tb.onLoad({ filter: JS_RE }, async (args) => {\n\t\t\t\tif (!shouldTransform(args.path)) {\n\t\t\t\t\t// Skip non-target files so other plugins (and esbuild) can process them\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst code = await fs.readFile(args.path, \"utf8\");\n\t\t\t\tconst result = await babel.transformAsync(code, {\n\t\t\t\t\tfilename: args.path,\n\t\t\t\t\tsourceMaps: false,\n\t\t\t\t\tbabelrc: false,\n\t\t\t\t\tconfigFile: false,\n\t\t\t\t\t// ORDER MATTERS: Reanimated plugin MUST BE LAST\n\t\t\t\t\tplugins: [\n\t\t\t\t\t\t// Needed by Reanimated on web per docs\n\t\t\t\t\t\t\"@babel/plugin-transform-export-namespace-from\",\n\t\t\t\t\t\t// Handle Flow types present in some RN libs\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"@babel/plugin-transform-flow-strip-types\",\n\t\t\t\t\t\t\t{ allowDeclareFields: true },\n\t\t\t\t\t\t],\n\t\t\t\t\t\t// MUST be last\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"react-native-reanimated/plugin\",\n\t\t\t\t\t\t\t{ relativeSourceLocation: true },\n\t\t\t\t\t\t],\n\t\t\t\t\t],\n\t\t\t\t\tpresets: [], // esbuild handles TS/JSX syntax; no preset-env/preset-react\n\t\t\t\t\tcaller: { name: \"esbuild\" },\n\t\t\t\t\t// Let Babel parse TS/JSX/Flow; keep it broad\n\t\t\t\t\tparserOpts: { plugins: [\"jsx\", \"typescript\"] },\n\t\t\t\t\tgeneratorOpts: { decoratorsBeforeExport: true },\n\t\t\t\t});\n\n\t\t\t\treturn {\n\t\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: <explanation>\n\t\t\t\t\tcontents: result!.code!,\n\t\t\t\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\t\t\t\tloader: pickLoader(args.path) as any,\n\t\t\t\t};\n\t\t\t});\n\t\t},\n\t};\n}\n\nfunction pickLoader(file: string) {\n\tconst ext = path.extname(file).toLowerCase();\n\tif (ext === \".tsx\") return \"tsx\";\n\tif (ext === \".ts\") return \"ts\";\n\tif (ext === \".jsx\") return \"jsx\";\n\t// For .js: many RN libs contain JSX; be permissive\n\treturn \"jsx\";\n}\n","import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n// stripFlowWithBabel.ts\nimport * as babel from \"@babel/core\";\n\nexport function stripFlowWithBabel() {\n\tconst filter = /\\.(m|c)?jsx?$/;\n\treturn {\n\t\tname: \"strip-flow-with-babel\",\n\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\tsetup(b: any) {\n\t\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\t\tb.onLoad({ filter }, async (args: any) => {\n\t\t\t\t// Only process react-native core files that contain Flow\n\t\t\t\tif (!args.path.includes(`${path.sep}react-native${path.sep}`)) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\tconst code = await fs.readFile(args.path, \"utf8\");\n\t\t\t\tconst out = await babel.transformAsync(code, {\n\t\t\t\t\tfilename: args.path,\n\t\t\t\t\tbabelrc: false,\n\t\t\t\t\tconfigFile: false,\n\t\t\t\t\tplugins: [\n\t\t\t\t\t\t// Use Hermes parser to handle modern Flow syntax (as casts, type predicates, mapped types, etc.)\n\t\t\t\t\t\t\"babel-plugin-syntax-hermes-parser\",\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"@babel/plugin-transform-flow-strip-types\",\n\t\t\t\t\t\t\t{ allowDeclareFields: true },\n\t\t\t\t\t\t],\n\t\t\t\t\t],\n\t\t\t\t\tsourceMaps: false,\n\t\t\t\t});\n\t\t\t\t// biome-ignore lint/style/noNonNullAssertion: <explanation>\n\t\t\t\treturn { contents: out!.code!, loader: \"jsx\" };\n\t\t\t});\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;AAAA,SAAS,cAAAA,mBAAkB;AAC3B,OAAOC,WAAU;AACjB,SAAS,iBAAiB;AAC1B,SAAS,UAAAC,eAAc;AACvB,OAAO,YAAY;AACnB,SAAS,cAAc;;;ACLvB,SAAS,YAAY,cAAc,aAAa,gBAAgB;AAChE,SAAS,OAAO,QAAQ,iBAAiB;AACzC,OAAOC,WAAU;AACjB,SAAS,kBAAkB,mBAAmB;AAC9C,SAAS,cAAc;AACvB,OAAO,WAAW;AAClB,SAA8C,gBAAgB;;;ACN9D,SAAS,kBAAkB;;;ACA3B,SAAS,qBAAqB;AAC9B,OAAO,UAAU;AACjB,SAAS,cAAc;AAEvB,OAAO;AAAA,EACN,MAAM,CAAC,QAAQ,cAAc,oBAAoB,iBAAiB;AACnE,CAAC;AAEM,SAAS,IAAI,KAAa;AAChC,QAAM,QAAQ,QAAQ,IAAI,GAAG;AAC7B,MAAI,CAAC,OAAO;AACX,UAAM,IAAI,MAAM,iCAAiC,GAAG,EAAE;AAAA,EACvD;AACA,SAAO;AACR;AAEA,IAAM,WAAW,QAAQ,IAAI;AAEtB,IAAM,aAAa,QAAQ,IAAI;AAC/B,IAAM,SAAS,IAAI,yBAAyB;AAC5C,IAAM,eAAe,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UAAM,IAAI;AAAA,MACT;AAAA,IACD;AAAA,EACD;AACA,QAAM,OAAOF,MAAK,QAAQ,IAAI;AAC9B,SAAO;AACR;AAEA,eAAe,gBAAgB;AAC9B,QAAM,QAAQ,IAAI,yBAAyB;AAC3C,QAAM,cAAc,yBAAyB,KAAK;AAElD,UAAQ,IAAI;AAAA;AAAA,EAEX,WAAW;AAAA;AAAA;AAAA,EAGX;AAED,SAAO,SAAS,aAAa,EAAE,OAAO,KAAK,CAAC;AAC7C;AAEA,KAAK,EACH,MAAM,CAAC,QAAQ;AACf,UAAQ,MAAM,GAAG;AACjB,UAAQ,KAAK,CAAC;AACf,CAAC,EACA,KAAK,MAAM;AACX,UAAQ,KAAK,CAAC;AACf,CAAC;","names":["existsSync","path","findUp","path","path","path","build","mkdir","readFile","writeFile","path","fs","path","fs","path","babel","path","readFile","mkdir","writeFile","buildAndPublish","build","buildAndPublish","path","existsSync","findUp"]}
|
package/dist/lib/index.d.mts
CHANGED
|
@@ -7,6 +7,9 @@ interface PathParams {
|
|
|
7
7
|
path: string[];
|
|
8
8
|
params: Record<string, string>;
|
|
9
9
|
}
|
|
10
|
+
interface PathParamsWithOrigin extends PathParams {
|
|
11
|
+
origin?: string | null | undefined;
|
|
12
|
+
}
|
|
10
13
|
interface BaseViewProps extends PathParams {
|
|
11
14
|
currentUserId: string | undefined | null;
|
|
12
15
|
}
|
|
@@ -34,7 +37,7 @@ interface ExecSyncApi {
|
|
|
34
37
|
key?: string | null;
|
|
35
38
|
data?: string | null;
|
|
36
39
|
}): EmptyObject;
|
|
37
|
-
routerPush(params:
|
|
40
|
+
routerPush(params: PathParamsWithOrigin): EmptyObject;
|
|
38
41
|
routerPop(params: EmptyObject): EmptyObject;
|
|
39
42
|
routerGetCurrent(params: EmptyObject): PathParams;
|
|
40
43
|
setNavigationBarData(params: {
|
|
@@ -81,4 +84,4 @@ declare const Haptics: {
|
|
|
81
84
|
trigger(type: HapticType, options?: HapticOptions): Promise<void>;
|
|
82
85
|
};
|
|
83
86
|
|
|
84
|
-
export { type DashboardViewProps, type DiscoverViewProps, type ExecAsyncApi, type ExecSyncApi, type ExperienceViewProps, Haptics, type PathParams, __internal_execAsync, __internal_execSync, whopSdk };
|
|
87
|
+
export { type DashboardViewProps, type DiscoverViewProps, type ExecAsyncApi, type ExecSyncApi, type ExperienceViewProps, Haptics, type PathParams, type PathParamsWithOrigin, __internal_execAsync, __internal_execSync, whopSdk };
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -7,6 +7,9 @@ interface PathParams {
|
|
|
7
7
|
path: string[];
|
|
8
8
|
params: Record<string, string>;
|
|
9
9
|
}
|
|
10
|
+
interface PathParamsWithOrigin extends PathParams {
|
|
11
|
+
origin?: string | null | undefined;
|
|
12
|
+
}
|
|
10
13
|
interface BaseViewProps extends PathParams {
|
|
11
14
|
currentUserId: string | undefined | null;
|
|
12
15
|
}
|
|
@@ -34,7 +37,7 @@ interface ExecSyncApi {
|
|
|
34
37
|
key?: string | null;
|
|
35
38
|
data?: string | null;
|
|
36
39
|
}): EmptyObject;
|
|
37
|
-
routerPush(params:
|
|
40
|
+
routerPush(params: PathParamsWithOrigin): EmptyObject;
|
|
38
41
|
routerPop(params: EmptyObject): EmptyObject;
|
|
39
42
|
routerGetCurrent(params: EmptyObject): PathParams;
|
|
40
43
|
setNavigationBarData(params: {
|
|
@@ -81,4 +84,4 @@ declare const Haptics: {
|
|
|
81
84
|
trigger(type: HapticType, options?: HapticOptions): Promise<void>;
|
|
82
85
|
};
|
|
83
86
|
|
|
84
|
-
export { type DashboardViewProps, type DiscoverViewProps, type ExecAsyncApi, type ExecSyncApi, type ExperienceViewProps, Haptics, type PathParams, __internal_execAsync, __internal_execSync, whopSdk };
|
|
87
|
+
export { type DashboardViewProps, type DiscoverViewProps, type ExecAsyncApi, type ExecSyncApi, type ExperienceViewProps, Haptics, type PathParams, type PathParamsWithOrigin, __internal_execAsync, __internal_execSync, whopSdk };
|
package/dist/lib/index.js
CHANGED
|
@@ -192,7 +192,16 @@ var syncHandlers = {
|
|
|
192
192
|
return {};
|
|
193
193
|
},
|
|
194
194
|
routerPush(route) {
|
|
195
|
-
|
|
195
|
+
if (route.origin) {
|
|
196
|
+
const path = `/${route.path.join("/")}`;
|
|
197
|
+
const url = new URL(path, route.origin);
|
|
198
|
+
for (const [k, v] of Object.entries(route.params ?? {})) {
|
|
199
|
+
url.searchParams.set(k, v);
|
|
200
|
+
}
|
|
201
|
+
loadIframeSdk().then((sdk) => sdk.openExternalUrl({ url: url.href }));
|
|
202
|
+
} else {
|
|
203
|
+
navigation.push(route);
|
|
204
|
+
}
|
|
196
205
|
return {};
|
|
197
206
|
},
|
|
198
207
|
routerPop() {
|
|
@@ -246,7 +255,8 @@ async function loadIframeSdk() {
|
|
|
246
255
|
if (!iframeSdk) {
|
|
247
256
|
const module2 = await loadIframeModule();
|
|
248
257
|
iframeSdk = module2.createSdk({
|
|
249
|
-
appId: process.env.NEXT_PUBLIC_WHOP_APP_ID
|
|
258
|
+
appId: process.env.NEXT_PUBLIC_WHOP_APP_ID,
|
|
259
|
+
overrideParentOrigins: ["https://whop.com", "http://localhost:8004"]
|
|
250
260
|
});
|
|
251
261
|
}
|
|
252
262
|
return iframeSdk;
|
package/dist/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/index.ts","../../src/lib/client-sdk.ts","../../src/lib/native-whop-core.ts","../../src/lib/native-whop-core-stub.ts","../../src/lib/native-whop-core-wrapper.ts","../../src/lib/haptics.ts"],"sourcesContent":["export * from \"./client-sdk\";\nexport * from \"./native-whop-core-wrapper\";\nexport * from \"./props\";\nimport Haptics from \"./haptics\";\n\nexport { Haptics };\n","import Whop from \"@whop/sdk\";\nimport { Platform } from \"react-native\";\nimport { __internal_execSync } from \"./native-whop-core-wrapper\";\n\nfunction getAppOrigin() {\n\tif (Platform.OS === \"android\" || Platform.OS === \"ios\") {\n\t\treturn __internal_execSync(\"getAppApiOrigin\", {}).apiOrigin;\n\t}\n\n\tif (Platform.OS === \"web\" && typeof window !== \"undefined\") {\n\t\treturn window.location.origin;\n\t}\n\n\tthrow new Error(`Unsupported platform: ${Platform.OS}`);\n}\n\nconst appOrigin = getAppOrigin();\n\nexport const whopSdk = new Whop({\n\tapiKey: \"client\",\n\tappID: \"client\",\n\tbaseURL: new URL(\"/_whop/api/v1/\", appOrigin).href,\n});\n\nexport * from \"@whop/sdk\";\n","import type { TurboModule } from \"react-native\";\nimport { TurboModuleRegistry } from \"react-native\";\nimport stub from \"./native-whop-core-stub\";\n\nexport type FunctionCallResult = {\n\tisOk: boolean;\n\tdata: string | null;\n\terrorMessage: string | null;\n};\n\nexport interface Spec extends TurboModule {\n\texecSync(name: string, paramsJson: string): FunctionCallResult;\n\texecAsync(name: string, paramsJson: string): Promise<FunctionCallResult>;\n}\n\nfunction resolveNative(): Spec | null {\n\ttry {\n\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\tconst registry: any = TurboModuleRegistry as any;\n\t\tconst get = registry?.getEnforcing ?? registry?.get;\n\t\tif (typeof get === \"function\") {\n\t\t\treturn get.call(registry, \"NativeWhopCore\") as Spec;\n\t\t}\n\t\treturn null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nconst native = resolveNative();\n\nexport default native ?? (stub as Spec);\n","import { Platform } from \"react-native\";\nimport type { ExecAsyncApi, ExecSyncApi } from \"./native-whop-core-wrapper\";\n\nexport type FunctionCallResult = {\n\tisOk: boolean;\n\tdata: string | null;\n\terrorMessage: string | null;\n};\n\ntype Route = { path: string[]; params: Record<string, string> };\n\nclass WhopCoreObservable<T> {\n\tprivate subscribers: Set<(value: T) => void> = new Set();\n\tprivate value: T;\n\n\tconstructor(value: T) {\n\t\tthis.value = value;\n\t}\n\n\tsetValue(value: T) {\n\t\tthis.value = value;\n\t\tfor (const callback of this.subscribers) {\n\t\t\tcallback(value);\n\t\t}\n\t}\n\n\tgetValue() {\n\t\treturn this.value;\n\t}\n\n\tsubscribe(callback: (value: T) => void) {\n\t\tthis.subscribers.add(callback);\n\t\treturn () => {\n\t\t\tthis.subscribers.delete(callback);\n\t\t};\n\t}\n}\n\nclass WhopCoreNavigation {\n\tpublic path = new WhopCoreObservable<Route[]>([]);\n\tpublic sheet = new WhopCoreObservable<Route | null>(null);\n\n\tconstructor() {\n\t\tthis.getFullStack = this.getFullStack.bind(this);\n\t\tthis.getCurrentSheet = this.getCurrentSheet.bind(this);\n\t\tthis.subscribeToPath = this.subscribeToPath.bind(this);\n\t\tthis.subscribeToSheet = this.subscribeToSheet.bind(this);\n\t}\n\n\tpush(route: Route) {\n\t\tif (this.getCurrent().path.join(\"/\") === route.path.join(\"/\")) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.path.setValue([...this.path.getValue(), route]);\n\t\tif (typeof window !== \"undefined\" && window.history) {\n\t\t\ttry {\n\t\t\t\tconst pathBits = route.path.join(\"/\");\n\t\t\t\tconst paramsBits = Object.entries(route.params)\n\t\t\t\t\t.map(([key, value]) => `${key}=${value}`)\n\t\t\t\t\t.join(\"&\");\n\t\t\t\twindow.history.pushState(\n\t\t\t\t\t{ route, index: this.path.getValue().length },\n\t\t\t\t\t\"\",\n\t\t\t\t\t`#${pathBits}?${paramsBits}`,\n\t\t\t\t);\n\t\t\t} catch {}\n\t\t}\n\t}\n\n\tpop() {\n\t\tif (typeof window !== \"undefined\" && window.history) {\n\t\t\ttry {\n\t\t\t\twindow.history.back();\n\t\t\t} catch {}\n\t\t}\n\t}\n\n\tgetFullStack() {\n\t\treturn this.path.getValue();\n\t}\n\n\tgetCurrent() {\n\t\treturn (\n\t\t\tthis.path.getValue()[this.path.getValue().length - 1] ?? {\n\t\t\t\tpath: [],\n\t\t\t\tparams: {},\n\t\t\t}\n\t\t);\n\t}\n\n\tpresentSheet(route: Route) {\n\t\tthis.sheet.setValue(route);\n\t}\n\n\tdismissSheet() {\n\t\tthis.sheet.setValue(null);\n\t}\n\n\tgetCurrentSheet() {\n\t\treturn this.sheet.getValue() ?? null;\n\t}\n\n\tsubscribeToPath(callback: (route: Route[]) => void) {\n\t\treturn this.path.subscribe(callback);\n\t}\n\n\tsubscribeToSheet(callback: (route: Route | null) => void) {\n\t\treturn this.sheet.subscribe(callback);\n\t}\n}\n\nexport type TWhopCoreNavigation = WhopCoreNavigation;\n\nconst navigation = new WhopCoreNavigation();\nif (typeof window !== \"undefined\" && Platform.OS === \"web\") {\n\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t(window as any).whopCoreNavigation = navigation;\n\n\twindow.addEventListener(\"popstate\", (e) => {\n\t\tconst currentLength = navigation.path.getValue().length;\n\t\tif (!e.state) {\n\t\t\tnavigation.path.setValue(navigation.path.getValue().slice(0, -1));\n\t\t\treturn;\n\t\t}\n\t\tconst index = e.state.index;\n\t\tconst route = e.state.route;\n\t\tif (index < currentLength) {\n\t\t\tnavigation.path.setValue(navigation.path.getValue().slice(0, -1));\n\t\t} else {\n\t\t\tnavigation.path.setValue([...navigation.path.getValue(), route]);\n\t\t}\n\t});\n}\n\nfunction ok(data: unknown): FunctionCallResult {\n\treturn { isOk: true, data: JSON.stringify(data), errorMessage: null };\n}\n\nfunction err(message: string): FunctionCallResult {\n\treturn { isOk: false, data: null, errorMessage: message };\n}\n\nfunction getOrigin(): string {\n\tif (typeof window !== \"undefined\" && window.location) {\n\t\treturn window.location.origin;\n\t}\n\treturn \"\";\n}\n\nconst syncHandlers: ExecSyncApi = {\n\tgetAppApiOrigin() {\n\t\treturn { apiOrigin: getOrigin() };\n\t},\n\tcacheGet({ key }: { key?: string | null }) {\n\t\ttry {\n\t\t\tif (typeof window !== \"undefined\" && window.localStorage && key) {\n\t\t\t\treturn { data: window.localStorage.getItem(key) };\n\t\t\t}\n\t\t\treturn { data: null };\n\t\t} catch {\n\t\t\treturn { data: null };\n\t\t}\n\t},\n\tcacheSet({ key, data }: { key?: string | null; data?: string | null }) {\n\t\ttry {\n\t\t\tif (typeof window !== \"undefined\" && window.localStorage && key != null) {\n\t\t\t\tif (data == null) {\n\t\t\t\t\twindow.localStorage.removeItem(key);\n\t\t\t\t} else {\n\t\t\t\t\twindow.localStorage.setItem(key, data);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {}\n\t\treturn {};\n\t},\n\trouterPush(route: Route) {\n\t\tnavigation.push(route);\n\t\treturn {};\n\t},\n\trouterPop() {\n\t\tnavigation.pop();\n\t\treturn {};\n\t},\n\trouterGetCurrent() {\n\t\treturn navigation.getCurrent();\n\t},\n\tsetNavigationBarData() {\n\t\treturn {};\n\t},\n\trouterPresentSheet({ path, params }: Route) {\n\t\tnavigation.presentSheet({\n\t\t\tpath: Array.from(path ?? []),\n\t\t\tparams: params ?? {},\n\t\t});\n\t\treturn {};\n\t},\n\trouterDismissSheet() {\n\t\tnavigation.dismissSheet();\n\t\treturn {};\n\t},\n\trouterGetCurrentSheet() {\n\t\treturn navigation.getCurrentSheet() ?? null;\n\t},\n\tdowngradeToWebView() {\n\t\treturn {};\n\t},\n\tgetHostAppDetails() {\n\t\treturn {\n\t\t\tbuild: \"web\",\n\t\t\tversion: \"0.0.0\",\n\t\t\tplatform: \"web\",\n\t\t\tbuildType: \"appstore\",\n\t\t};\n\t},\n\tsetScreenOrientationMode() {\n\t\treturn {};\n\t},\n};\n\nlet iframeModulePromise: Promise<typeof import(\"@whop/iframe\")> | null = null;\n\nasync function loadIframeModule() {\n\tif (!iframeModulePromise) {\n\t\tiframeModulePromise = import(\"@whop/iframe\");\n\t}\n\treturn await iframeModulePromise;\n}\n\nlet iframeSdk: ReturnType<typeof import(\"@whop/iframe\").createSdk> | null =\n\tnull;\n\nasync function loadIframeSdk() {\n\tif (!iframeSdk) {\n\t\tconst module = await loadIframeModule();\n\t\tiframeSdk = module.createSdk({\n\t\t\tappId: process.env.NEXT_PUBLIC_WHOP_APP_ID,\n\t\t});\n\t}\n\treturn iframeSdk;\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: <explanation>\ntype MakeAsync<T extends Record<string, any>> = {\n\t[K in keyof T]: (params: Parameters<T[K]>[0]) => Promise<ReturnType<T[K]>>;\n};\n\nconst asyncHandlers: MakeAsync<Pick<ExecAsyncApi, \"inAppPurchase\">> = {\n\tinAppPurchase: async ({ planId, id }) => {\n\t\tconst sdk = await loadIframeSdk();\n\t\tconst result = await sdk.inAppPurchase({ planId, id: id ?? undefined });\n\t\tif (result.status === \"ok\") {\n\t\t\treturn {\n\t\t\t\tsessionId: result.data.sessionId,\n\t\t\t\treceiptId: result.data.receiptId,\n\t\t\t};\n\t\t}\n\t\tthrow new Error(result.error);\n\t},\n};\n\nconst nativeWhopCoreStub = {\n\texecSync(name: string, paramsJson: string): FunctionCallResult {\n\t\ttry {\n\t\t\tconst params = paramsJson ? JSON.parse(paramsJson) : {};\n\t\t\tconst handler = syncHandlers[name as keyof typeof syncHandlers];\n\t\t\tif (!handler) return err(`Unknown sync method: ${name}`);\n\t\t\tconst result = handler(params);\n\t\t\treturn ok(result);\n\t\t} catch (e) {\n\t\t\treturn err(e instanceof Error ? e.message : \"Unknown error\");\n\t\t}\n\t},\n\tasync execAsync(\n\t\tname: string,\n\t\tparamsJson: string,\n\t): Promise<FunctionCallResult> {\n\t\ttry {\n\t\t\tconst params = paramsJson ? JSON.parse(paramsJson) : {};\n\t\t\tconst handler = (\n\t\t\t\tasyncHandlers as Record<string, (p: unknown) => Promise<unknown>>\n\t\t\t)[name];\n\t\t\tif (!handler) return err(`Unknown async method: ${name}`);\n\t\t\tconst result = await handler(params);\n\t\t\treturn ok(result);\n\t\t} catch (e) {\n\t\t\treturn err(e instanceof Error ? e.message : \"Unknown error\");\n\t\t}\n\t},\n};\n\nexport default nativeWhopCoreStub;\n","import nativeWhopCore from \"./native-whop-core\";\nimport type { PathParams } from \"./props\";\n\n// biome-ignore lint/complexity/noBannedTypes: allow here\ntype EmptyObject = {};\n\nexport interface ExecSyncApi {\n\tgetAppApiOrigin(params: EmptyObject): { apiOrigin: string };\n\tcacheGet(params: { key?: string | null }): { data?: string | null };\n\tcacheSet(params: { key?: string | null; data?: string | null }): EmptyObject;\n\trouterPush(params: PathParams): EmptyObject;\n\trouterPop(params: EmptyObject): EmptyObject;\n\trouterGetCurrent(params: EmptyObject): PathParams;\n\tsetNavigationBarData(params: {\n\t\ttitle?: string | null;\n\t\tdescription?: string | null;\n\t}): EmptyObject;\n\trouterPresentSheet(params: PathParams): EmptyObject;\n\trouterDismissSheet(params: EmptyObject): EmptyObject;\n\trouterGetCurrentSheet(params: EmptyObject): PathParams | null | undefined;\n\tdowngradeToWebView(params: EmptyObject): EmptyObject;\n\tgetHostAppDetails(params: EmptyObject): {\n\t\tbuild: string;\n\t\tversion: string;\n\t\tplatform: \"ios\" | \"android\" | \"web\";\n\t\tbuildType: \"appstore\" | \"testflight\" | \"debug\";\n\t};\n\tsetScreenOrientationMode(params: {\n\t\ttargetScreenOrientationMode: \"portrait\" | \"landscape\" | \"rotate\";\n\t}): EmptyObject;\n}\n\nexport interface ExecAsyncApi extends ExecSyncApi {\n\tinAppPurchase(params: {\n\t\tid?: string | null;\n\t\tplanId: string;\n\t}): {\n\t\tsessionId: string;\n\t\treceiptId: string;\n\t};\n}\n\nexport function __internal_execSync<F extends keyof ExecSyncApi>(\n\tname: F,\n\tparams: Parameters<ExecSyncApi[F]>[0],\n): ReturnType<ExecSyncApi[F]> {\n\tconst resultJson = nativeWhopCore.execSync(name, JSON.stringify(params));\n\tif (!resultJson.isOk) {\n\t\tthrow new Error(`Failed to execute ${name}: ${resultJson.errorMessage}`);\n\t}\n\n\treturn JSON.parse(resultJson.data || \"{}\") as ReturnType<ExecSyncApi[F]>;\n}\n\nexport async function __internal_execAsync<F extends keyof ExecAsyncApi>(\n\tname: F,\n\tparams: Parameters<ExecAsyncApi[F]>[0],\n): Promise<ReturnType<ExecAsyncApi[F]>> {\n\tconst resultJson = await nativeWhopCore.execAsync(\n\t\tname,\n\t\tJSON.stringify(params),\n\t);\n\n\tif (!resultJson.isOk) {\n\t\tthrow new Error(`Failed to execute ${name}: ${resultJson.errorMessage}`);\n\t}\n\n\treturn JSON.parse(resultJson.data || \"{}\") as ReturnType<ExecAsyncApi[F]>;\n}\n","/**\n * Web-safe wrapper for react-native-haptic-feedback.\n * - Lazily imports the native module only in native environments.\n * - Provides a no-op fallback on web to avoid runtime crashes.\n */\n\ntype HapticType =\n\t| \"selection\"\n\t| \"impactLight\"\n\t| \"impactMedium\"\n\t| \"impactHeavy\"\n\t| \"notificationSuccess\"\n\t| \"notificationWarning\"\n\t| \"notificationError\";\n\ntype HapticOptions = {\n\tenableVibrateFallback?: boolean;\n\tignoreAndroidSystemSettings?: boolean;\n};\n\n// Singleton holder for the native module once loaded\nlet nativeModule: {\n\ttrigger: (type: HapticType, options?: HapticOptions) => void;\n} | null = null;\nlet loadingPromise: Promise<void> | null = null;\n\nasync function ensureNativeLoaded(): Promise<void> {\n\t// If on web, skip loading entirely\n\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t// @ts-ignore - process may not be typed in RN web builds\n\tconst isWeb =\n\t\ttypeof document !== \"undefined\" && typeof window !== \"undefined\";\n\tif (isWeb) return;\n\n\tif (nativeModule || loadingPromise) {\n\t\treturn loadingPromise ?? Promise.resolve();\n\t}\n\n\tloadingPromise = import(\"react-native-haptic-feedback\")\n\t\t.then((mod) => {\n\t\t\tnativeModule = { trigger: mod.default.trigger };\n\t\t})\n\t\t.catch(() => {\n\t\t\t// Keep nativeModule null; fall back to noop\n\t\t})\n\t\t.finally(() => {\n\t\t\tloadingPromise = null;\n\t\t});\n\n\treturn loadingPromise;\n}\n\nconst HAPTIC_NOOP = {\n\ttrigger: (_type: HapticType, _options?: HapticOptions) => {\n\t\t// no-op on web\n\t},\n};\n\nconst Haptics = {\n\tasync trigger(type: HapticType, options?: HapticOptions): Promise<void> {\n\t\tawait ensureNativeLoaded();\n\t\tif (nativeModule) {\n\t\t\ttry {\n\t\t\t\tnativeModule.trigger(type, options);\n\t\t\t} catch {\n\t\t\t\t// ignore\n\t\t\t}\n\t\t\treturn;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;AKqBA,IAAI,eAEO;AACX,IAAI,iBAAuC;AAE3C,eAAe,qBAAoC;AAIlD,QAAM,QACL,OAAO,aAAa,eAAe,OAAO,WAAW;AACtD,MAAI,MAAO;AAEX,MAAI,gBAAgB,gBAAgB;AACnC,WAAO,kBAAkB,QAAQ,QAAQ;AAAA,EAC1C;AAEA,mBAAiB,OAAO,8BAA8B,EACpD,KAAK,CAAC,QAAQ;AACd,mBAAe,EAAE,SAAS,IAAI,QAAQ,QAAQ;AAAA,EAC/C,CAAC,EACA,MAAM,MAAM;AAAA,EAEb,CAAC,EACA,QAAQ,MAAM;AACd,qBAAiB;AAAA,EAClB,CAAC;AAEF,SAAO;AACR;AAEA,IAAM,cAAc;AAAA,EACnB,SAAS,CAAC,OAAmB,aAA6B;AAAA,EAE1D;AACD;AAEA,IAAM,UAAU;AAAA,EACf,MAAM,QAAQ,MAAkB,SAAwC;AACvE,UAAM,mBAAmB;AACzB,QAAI,cAAc;AACjB,UAAI;AACH,qBAAa,QAAQ,MAAM,OAAO;AAAA,MACnC,QAAQ;AAAA,MAER;AACA;AAAA,IACD;AACA,gBAAY,QAAQ,MAAM,OAAO;AAAA,EAClC;AACD;AAEA,IAAO,kBAAQ;","names":["import_react_native","import_react_native","module","Whop"]}
|
|
1
|
+
{"version":3,"sources":["../../src/lib/index.ts","../../src/lib/client-sdk.ts","../../src/lib/native-whop-core.ts","../../src/lib/native-whop-core-stub.ts","../../src/lib/native-whop-core-wrapper.ts","../../src/lib/haptics.ts"],"sourcesContent":["export * from \"./client-sdk\";\nexport * from \"./native-whop-core-wrapper\";\nexport * from \"./props\";\nimport Haptics from \"./haptics\";\n\nexport { Haptics };\n","import Whop from \"@whop/sdk\";\nimport { Platform } from \"react-native\";\nimport { __internal_execSync } from \"./native-whop-core-wrapper\";\n\nfunction getAppOrigin() {\n\tif (Platform.OS === \"android\" || Platform.OS === \"ios\") {\n\t\treturn __internal_execSync(\"getAppApiOrigin\", {}).apiOrigin;\n\t}\n\n\tif (Platform.OS === \"web\" && typeof window !== \"undefined\") {\n\t\treturn window.location.origin;\n\t}\n\n\tthrow new Error(`Unsupported platform: ${Platform.OS}`);\n}\n\nconst appOrigin = getAppOrigin();\n\nexport const whopSdk = new Whop({\n\tapiKey: \"client\",\n\tappID: \"client\",\n\tbaseURL: new URL(\"/_whop/api/v1/\", appOrigin).href,\n});\n\nexport * from \"@whop/sdk\";\n","import type { TurboModule } from \"react-native\";\nimport { TurboModuleRegistry } from \"react-native\";\nimport stub from \"./native-whop-core-stub\";\n\nexport type FunctionCallResult = {\n\tisOk: boolean;\n\tdata: string | null;\n\terrorMessage: string | null;\n};\n\nexport interface Spec extends TurboModule {\n\texecSync(name: string, paramsJson: string): FunctionCallResult;\n\texecAsync(name: string, paramsJson: string): Promise<FunctionCallResult>;\n}\n\nfunction resolveNative(): Spec | null {\n\ttry {\n\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\tconst registry: any = TurboModuleRegistry as any;\n\t\tconst get = registry?.getEnforcing ?? registry?.get;\n\t\tif (typeof get === \"function\") {\n\t\t\treturn get.call(registry, \"NativeWhopCore\") as Spec;\n\t\t}\n\t\treturn null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nconst native = resolveNative();\n\nexport default native ?? (stub as Spec);\n","import { Platform } from \"react-native\";\nimport type { ExecAsyncApi, ExecSyncApi } from \"./native-whop-core-wrapper\";\n\nexport type FunctionCallResult = {\n\tisOk: boolean;\n\tdata: string | null;\n\terrorMessage: string | null;\n};\n\ntype Route = { path: string[]; params: Record<string, string> };\n\nclass WhopCoreObservable<T> {\n\tprivate subscribers: Set<(value: T) => void> = new Set();\n\tprivate value: T;\n\n\tconstructor(value: T) {\n\t\tthis.value = value;\n\t}\n\n\tsetValue(value: T) {\n\t\tthis.value = value;\n\t\tfor (const callback of this.subscribers) {\n\t\t\tcallback(value);\n\t\t}\n\t}\n\n\tgetValue() {\n\t\treturn this.value;\n\t}\n\n\tsubscribe(callback: (value: T) => void) {\n\t\tthis.subscribers.add(callback);\n\t\treturn () => {\n\t\t\tthis.subscribers.delete(callback);\n\t\t};\n\t}\n}\n\nclass WhopCoreNavigation {\n\tpublic path = new WhopCoreObservable<Route[]>([]);\n\tpublic sheet = new WhopCoreObservable<Route | null>(null);\n\n\tconstructor() {\n\t\tthis.getFullStack = this.getFullStack.bind(this);\n\t\tthis.getCurrentSheet = this.getCurrentSheet.bind(this);\n\t\tthis.subscribeToPath = this.subscribeToPath.bind(this);\n\t\tthis.subscribeToSheet = this.subscribeToSheet.bind(this);\n\t}\n\n\tpush(route: Route) {\n\t\tif (this.getCurrent().path.join(\"/\") === route.path.join(\"/\")) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.path.setValue([...this.path.getValue(), route]);\n\t\tif (typeof window !== \"undefined\" && window.history) {\n\t\t\ttry {\n\t\t\t\tconst pathBits = route.path.join(\"/\");\n\t\t\t\tconst paramsBits = Object.entries(route.params)\n\t\t\t\t\t.map(([key, value]) => `${key}=${value}`)\n\t\t\t\t\t.join(\"&\");\n\t\t\t\twindow.history.pushState(\n\t\t\t\t\t{ route, index: this.path.getValue().length },\n\t\t\t\t\t\"\",\n\t\t\t\t\t`#${pathBits}?${paramsBits}`,\n\t\t\t\t);\n\t\t\t} catch {}\n\t\t}\n\t}\n\n\tpop() {\n\t\tif (typeof window !== \"undefined\" && window.history) {\n\t\t\ttry {\n\t\t\t\twindow.history.back();\n\t\t\t} catch {}\n\t\t}\n\t}\n\n\tgetFullStack() {\n\t\treturn this.path.getValue();\n\t}\n\n\tgetCurrent() {\n\t\treturn (\n\t\t\tthis.path.getValue()[this.path.getValue().length - 1] ?? {\n\t\t\t\tpath: [],\n\t\t\t\tparams: {},\n\t\t\t}\n\t\t);\n\t}\n\n\tpresentSheet(route: Route) {\n\t\tthis.sheet.setValue(route);\n\t}\n\n\tdismissSheet() {\n\t\tthis.sheet.setValue(null);\n\t}\n\n\tgetCurrentSheet() {\n\t\treturn this.sheet.getValue() ?? null;\n\t}\n\n\tsubscribeToPath(callback: (route: Route[]) => void) {\n\t\treturn this.path.subscribe(callback);\n\t}\n\n\tsubscribeToSheet(callback: (route: Route | null) => void) {\n\t\treturn this.sheet.subscribe(callback);\n\t}\n}\n\nexport type TWhopCoreNavigation = WhopCoreNavigation;\n\nconst navigation = new WhopCoreNavigation();\nif (typeof window !== \"undefined\" && Platform.OS === \"web\") {\n\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t(window as any).whopCoreNavigation = navigation;\n\n\twindow.addEventListener(\"popstate\", (e) => {\n\t\tconst currentLength = navigation.path.getValue().length;\n\t\tif (!e.state) {\n\t\t\tnavigation.path.setValue(navigation.path.getValue().slice(0, -1));\n\t\t\treturn;\n\t\t}\n\t\tconst index = e.state.index;\n\t\tconst route = e.state.route;\n\t\tif (index < currentLength) {\n\t\t\tnavigation.path.setValue(navigation.path.getValue().slice(0, -1));\n\t\t} else {\n\t\t\tnavigation.path.setValue([...navigation.path.getValue(), route]);\n\t\t}\n\t});\n}\n\nfunction ok(data: unknown): FunctionCallResult {\n\treturn { isOk: true, data: JSON.stringify(data), errorMessage: null };\n}\n\nfunction err(message: string): FunctionCallResult {\n\treturn { isOk: false, data: null, errorMessage: message };\n}\n\nfunction getOrigin(): string {\n\tif (typeof window !== \"undefined\" && window.location) {\n\t\treturn window.location.origin;\n\t}\n\treturn \"\";\n}\n\nconst syncHandlers: ExecSyncApi = {\n\tgetAppApiOrigin() {\n\t\treturn { apiOrigin: getOrigin() };\n\t},\n\tcacheGet({ key }: { key?: string | null }) {\n\t\ttry {\n\t\t\tif (typeof window !== \"undefined\" && window.localStorage && key) {\n\t\t\t\treturn { data: window.localStorage.getItem(key) };\n\t\t\t}\n\t\t\treturn { data: null };\n\t\t} catch {\n\t\t\treturn { data: null };\n\t\t}\n\t},\n\tcacheSet({ key, data }: { key?: string | null; data?: string | null }) {\n\t\ttry {\n\t\t\tif (typeof window !== \"undefined\" && window.localStorage && key != null) {\n\t\t\t\tif (data == null) {\n\t\t\t\t\twindow.localStorage.removeItem(key);\n\t\t\t\t} else {\n\t\t\t\t\twindow.localStorage.setItem(key, data);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {}\n\t\treturn {};\n\t},\n\trouterPush(route) {\n\t\tif (route.origin) {\n\t\t\tconst path = `/${route.path.join(\"/\")}`;\n\t\t\tconst url = new URL(path, route.origin);\n\t\t\tfor (const [k, v] of Object.entries(route.params ?? {})) {\n\t\t\t\turl.searchParams.set(k, v);\n\t\t\t}\n\t\t\tloadIframeSdk().then((sdk) => sdk.openExternalUrl({ url: url.href }));\n\t\t} else {\n\t\t\tnavigation.push(route);\n\t\t}\n\t\treturn {};\n\t},\n\trouterPop() {\n\t\tnavigation.pop();\n\t\treturn {};\n\t},\n\trouterGetCurrent() {\n\t\treturn navigation.getCurrent();\n\t},\n\tsetNavigationBarData() {\n\t\treturn {};\n\t},\n\trouterPresentSheet({ path, params }: Route) {\n\t\tnavigation.presentSheet({\n\t\t\tpath: Array.from(path ?? []),\n\t\t\tparams: params ?? {},\n\t\t});\n\t\treturn {};\n\t},\n\trouterDismissSheet() {\n\t\tnavigation.dismissSheet();\n\t\treturn {};\n\t},\n\trouterGetCurrentSheet() {\n\t\treturn navigation.getCurrentSheet() ?? null;\n\t},\n\tdowngradeToWebView() {\n\t\treturn {};\n\t},\n\tgetHostAppDetails() {\n\t\treturn {\n\t\t\tbuild: \"web\",\n\t\t\tversion: \"0.0.0\",\n\t\t\tplatform: \"web\",\n\t\t\tbuildType: \"appstore\",\n\t\t};\n\t},\n\tsetScreenOrientationMode() {\n\t\treturn {};\n\t},\n};\n\nlet iframeModulePromise: Promise<typeof import(\"@whop/iframe\")> | null = null;\n\nasync function loadIframeModule() {\n\tif (!iframeModulePromise) {\n\t\tiframeModulePromise = import(\"@whop/iframe\");\n\t}\n\treturn await iframeModulePromise;\n}\n\nlet iframeSdk: ReturnType<typeof import(\"@whop/iframe\").createSdk> | null =\n\tnull;\n\nasync function loadIframeSdk() {\n\tif (!iframeSdk) {\n\t\tconst module = await loadIframeModule();\n\t\tiframeSdk = module.createSdk({\n\t\t\tappId: process.env.NEXT_PUBLIC_WHOP_APP_ID,\n\t\t\toverrideParentOrigins: [\"https://whop.com\", \"http://localhost:8004\"],\n\t\t});\n\t}\n\treturn iframeSdk;\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: <explanation>\ntype MakeAsync<T extends Record<string, any>> = {\n\t[K in keyof T]: (params: Parameters<T[K]>[0]) => Promise<ReturnType<T[K]>>;\n};\n\nconst asyncHandlers: MakeAsync<Pick<ExecAsyncApi, \"inAppPurchase\">> = {\n\tinAppPurchase: async ({ planId, id }) => {\n\t\tconst sdk = await loadIframeSdk();\n\t\tconst result = await sdk.inAppPurchase({ planId, id: id ?? undefined });\n\t\tif (result.status === \"ok\") {\n\t\t\treturn {\n\t\t\t\tsessionId: result.data.sessionId,\n\t\t\t\treceiptId: result.data.receiptId,\n\t\t\t};\n\t\t}\n\t\tthrow new Error(result.error);\n\t},\n};\n\nconst nativeWhopCoreStub = {\n\texecSync(name: string, paramsJson: string): FunctionCallResult {\n\t\ttry {\n\t\t\tconst params = paramsJson ? JSON.parse(paramsJson) : {};\n\t\t\tconst handler = syncHandlers[name as keyof typeof syncHandlers];\n\t\t\tif (!handler) return err(`Unknown sync method: ${name}`);\n\t\t\tconst result = handler(params);\n\t\t\treturn ok(result);\n\t\t} catch (e) {\n\t\t\treturn err(e instanceof Error ? e.message : \"Unknown error\");\n\t\t}\n\t},\n\tasync execAsync(\n\t\tname: string,\n\t\tparamsJson: string,\n\t): Promise<FunctionCallResult> {\n\t\ttry {\n\t\t\tconst params = paramsJson ? JSON.parse(paramsJson) : {};\n\t\t\tconst handler = (\n\t\t\t\tasyncHandlers as Record<string, (p: unknown) => Promise<unknown>>\n\t\t\t)[name];\n\t\t\tif (!handler) return err(`Unknown async method: ${name}`);\n\t\t\tconst result = await handler(params);\n\t\t\treturn ok(result);\n\t\t} catch (e) {\n\t\t\treturn err(e instanceof Error ? e.message : \"Unknown error\");\n\t\t}\n\t},\n};\n\nexport default nativeWhopCoreStub;\n","import nativeWhopCore from \"./native-whop-core\";\nimport type { PathParams, PathParamsWithOrigin } from \"./props\";\n\n// biome-ignore lint/complexity/noBannedTypes: allow here\ntype EmptyObject = {};\n\nexport interface ExecSyncApi {\n\tgetAppApiOrigin(params: EmptyObject): { apiOrigin: string };\n\tcacheGet(params: { key?: string | null }): { data?: string | null };\n\tcacheSet(params: { key?: string | null; data?: string | null }): EmptyObject;\n\trouterPush(params: PathParamsWithOrigin): EmptyObject;\n\trouterPop(params: EmptyObject): EmptyObject;\n\trouterGetCurrent(params: EmptyObject): PathParams;\n\tsetNavigationBarData(params: {\n\t\ttitle?: string | null;\n\t\tdescription?: string | null;\n\t}): EmptyObject;\n\trouterPresentSheet(params: PathParams): EmptyObject;\n\trouterDismissSheet(params: EmptyObject): EmptyObject;\n\trouterGetCurrentSheet(params: EmptyObject): PathParams | null | undefined;\n\tdowngradeToWebView(params: EmptyObject): EmptyObject;\n\tgetHostAppDetails(params: EmptyObject): {\n\t\tbuild: string;\n\t\tversion: string;\n\t\tplatform: \"ios\" | \"android\" | \"web\";\n\t\tbuildType: \"appstore\" | \"testflight\" | \"debug\";\n\t};\n\tsetScreenOrientationMode(params: {\n\t\ttargetScreenOrientationMode: \"portrait\" | \"landscape\" | \"rotate\";\n\t}): EmptyObject;\n}\n\nexport interface ExecAsyncApi extends ExecSyncApi {\n\tinAppPurchase(params: { id?: string | null; planId: string }): {\n\t\tsessionId: string;\n\t\treceiptId: string;\n\t};\n}\n\nexport function __internal_execSync<F extends keyof ExecSyncApi>(\n\tname: F,\n\tparams: Parameters<ExecSyncApi[F]>[0],\n): ReturnType<ExecSyncApi[F]> {\n\tconst resultJson = nativeWhopCore.execSync(name, JSON.stringify(params));\n\tif (!resultJson.isOk) {\n\t\tthrow new Error(`Failed to execute ${name}: ${resultJson.errorMessage}`);\n\t}\n\n\treturn JSON.parse(resultJson.data || \"{}\") as ReturnType<ExecSyncApi[F]>;\n}\n\nexport async function __internal_execAsync<F extends keyof ExecAsyncApi>(\n\tname: F,\n\tparams: Parameters<ExecAsyncApi[F]>[0],\n): Promise<ReturnType<ExecAsyncApi[F]>> {\n\tconst resultJson = await nativeWhopCore.execAsync(\n\t\tname,\n\t\tJSON.stringify(params),\n\t);\n\n\tif (!resultJson.isOk) {\n\t\tthrow new Error(`Failed to execute ${name}: ${resultJson.errorMessage}`);\n\t}\n\n\treturn JSON.parse(resultJson.data || \"{}\") as ReturnType<ExecAsyncApi[F]>;\n}\n","/**\n * Web-safe wrapper for react-native-haptic-feedback.\n * - Lazily imports the native module only in native environments.\n * - Provides a no-op fallback on web to avoid runtime crashes.\n */\n\ntype HapticType =\n\t| \"selection\"\n\t| \"impactLight\"\n\t| \"impactMedium\"\n\t| \"impactHeavy\"\n\t| \"notificationSuccess\"\n\t| \"notificationWarning\"\n\t| \"notificationError\";\n\ntype HapticOptions = {\n\tenableVibrateFallback?: boolean;\n\tignoreAndroidSystemSettings?: boolean;\n};\n\n// Singleton holder for the native module once loaded\nlet nativeModule: {\n\ttrigger: (type: HapticType, options?: HapticOptions) => void;\n} | null = null;\nlet loadingPromise: Promise<void> | null = null;\n\nasync function ensureNativeLoaded(): Promise<void> {\n\t// If on web, skip loading entirely\n\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t// @ts-ignore - process may not be typed in RN web builds\n\tconst isWeb =\n\t\ttypeof document !== \"undefined\" && typeof window !== \"undefined\";\n\tif (isWeb) return;\n\n\tif (nativeModule || loadingPromise) {\n\t\treturn loadingPromise ?? Promise.resolve();\n\t}\n\n\tloadingPromise = import(\"react-native-haptic-feedback\")\n\t\t.then((mod) => {\n\t\t\tnativeModule = { trigger: mod.default.trigger };\n\t\t})\n\t\t.catch(() => {\n\t\t\t// Keep nativeModule null; fall back to noop\n\t\t})\n\t\t.finally(() => {\n\t\t\tloadingPromise = null;\n\t\t});\n\n\treturn loadingPromise;\n}\n\nconst HAPTIC_NOOP = {\n\ttrigger: (_type: HapticType, _options?: HapticOptions) => {\n\t\t// no-op on web\n\t},\n};\n\nconst Haptics = {\n\tasync trigger(type: HapticType, options?: HapticOptions): Promise<void> {\n\t\tawait ensureNativeLoaded();\n\t\tif (nativeModule) {\n\t\t\ttry {\n\t\t\t\tnativeModule.trigger(type, options);\n\t\t\t} catch {\n\t\t\t\t// ignore\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tHAPTIC_NOOP.trigger(type, options);\n\t},\n};\n\nexport default Haptics;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA,iBAAiB;AACjB,IAAAA,uBAAyB;;;ACAzB,IAAAC,uBAAoC;;;ACDpC,0BAAyB;AAWzB,IAAM,qBAAN,MAA4B;AAAA,EACnB,cAAuC,oBAAI,IAAI;AAAA,EAC/C;AAAA,EAER,YAAY,OAAU;AACrB,SAAK,QAAQ;AAAA,EACd;AAAA,EAEA,SAAS,OAAU;AAClB,SAAK,QAAQ;AACb,eAAW,YAAY,KAAK,aAAa;AACxC,eAAS,KAAK;AAAA,IACf;AAAA,EACD;AAAA,EAEA,WAAW;AACV,WAAO,KAAK;AAAA,EACb;AAAA,EAEA,UAAU,UAA8B;AACvC,SAAK,YAAY,IAAI,QAAQ;AAC7B,WAAO,MAAM;AACZ,WAAK,YAAY,OAAO,QAAQ;AAAA,IACjC;AAAA,EACD;AACD;AAEA,IAAM,qBAAN,MAAyB;AAAA,EACjB,OAAO,IAAI,mBAA4B,CAAC,CAAC;AAAA,EACzC,QAAQ,IAAI,mBAAiC,IAAI;AAAA,EAExD,cAAc;AACb,SAAK,eAAe,KAAK,aAAa,KAAK,IAAI;AAC/C,SAAK,kBAAkB,KAAK,gBAAgB,KAAK,IAAI;AACrD,SAAK,kBAAkB,KAAK,gBAAgB,KAAK,IAAI;AACrD,SAAK,mBAAmB,KA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AACvE,UAAM,mBAAmB;AACzB,QAAI,cAAc;AACjB,UAAI;AACH,qBAAa,QAAQ,MAAM,OAAO;AAAA,MACnC,QAAQ;AAAA,MAER;AACA;AAAA,IACD;AACA,gBAAY,QAAQ,MAAM,OAAO;AAAA,EAClC;AACD;AAEA,IAAO,kBAAQ;","names":["import_react_native","import_react_native","module","Whop"]}
|
package/dist/lib/index.mjs
CHANGED
|
@@ -166,7 +166,16 @@ var syncHandlers = {
|
|
|
166
166
|
return {};
|
|
167
167
|
},
|
|
168
168
|
routerPush(route) {
|
|
169
|
-
|
|
169
|
+
if (route.origin) {
|
|
170
|
+
const path = `/${route.path.join("/")}`;
|
|
171
|
+
const url = new URL(path, route.origin);
|
|
172
|
+
for (const [k, v] of Object.entries(route.params ?? {})) {
|
|
173
|
+
url.searchParams.set(k, v);
|
|
174
|
+
}
|
|
175
|
+
loadIframeSdk().then((sdk) => sdk.openExternalUrl({ url: url.href }));
|
|
176
|
+
} else {
|
|
177
|
+
navigation.push(route);
|
|
178
|
+
}
|
|
170
179
|
return {};
|
|
171
180
|
},
|
|
172
181
|
routerPop() {
|
|
@@ -220,7 +229,8 @@ async function loadIframeSdk() {
|
|
|
220
229
|
if (!iframeSdk) {
|
|
221
230
|
const module = await loadIframeModule();
|
|
222
231
|
iframeSdk = module.createSdk({
|
|
223
|
-
appId: process.env.NEXT_PUBLIC_WHOP_APP_ID
|
|
232
|
+
appId: process.env.NEXT_PUBLIC_WHOP_APP_ID,
|
|
233
|
+
overrideParentOrigins: ["https://whop.com", "http://localhost:8004"]
|
|
224
234
|
});
|
|
225
235
|
}
|
|
226
236
|
return iframeSdk;
|
package/dist/lib/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/index.ts","../../src/lib/client-sdk.ts","../../src/lib/native-whop-core.ts","../../src/lib/native-whop-core-stub.ts","../../src/lib/native-whop-core-wrapper.ts","../../src/lib/haptics.ts"],"sourcesContent":["export * from \"./client-sdk\";\nexport * from \"./native-whop-core-wrapper\";\nexport * from \"./props\";\nimport Haptics from \"./haptics\";\n\nexport { Haptics };\n","import Whop from \"@whop/sdk\";\nimport { Platform } from \"react-native\";\nimport { __internal_execSync } from \"./native-whop-core-wrapper\";\n\nfunction getAppOrigin() {\n\tif (Platform.OS === \"android\" || Platform.OS === \"ios\") {\n\t\treturn __internal_execSync(\"getAppApiOrigin\", {}).apiOrigin;\n\t}\n\n\tif (Platform.OS === \"web\" && typeof window !== \"undefined\") {\n\t\treturn window.location.origin;\n\t}\n\n\tthrow new Error(`Unsupported platform: ${Platform.OS}`);\n}\n\nconst appOrigin = getAppOrigin();\n\nexport const whopSdk = new Whop({\n\tapiKey: \"client\",\n\tappID: \"client\",\n\tbaseURL: new URL(\"/_whop/api/v1/\", appOrigin).href,\n});\n\nexport * from \"@whop/sdk\";\n","import type { TurboModule } from \"react-native\";\nimport { TurboModuleRegistry } from \"react-native\";\nimport stub from \"./native-whop-core-stub\";\n\nexport type FunctionCallResult = {\n\tisOk: boolean;\n\tdata: string | null;\n\terrorMessage: string | null;\n};\n\nexport interface Spec extends TurboModule {\n\texecSync(name: string, paramsJson: string): FunctionCallResult;\n\texecAsync(name: string, paramsJson: string): Promise<FunctionCallResult>;\n}\n\nfunction resolveNative(): Spec | null {\n\ttry {\n\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\tconst registry: any = TurboModuleRegistry as any;\n\t\tconst get = registry?.getEnforcing ?? registry?.get;\n\t\tif (typeof get === \"function\") {\n\t\t\treturn get.call(registry, \"NativeWhopCore\") as Spec;\n\t\t}\n\t\treturn null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nconst native = resolveNative();\n\nexport default native ?? (stub as Spec);\n","import { Platform } from \"react-native\";\nimport type { ExecAsyncApi, ExecSyncApi } from \"./native-whop-core-wrapper\";\n\nexport type FunctionCallResult = {\n\tisOk: boolean;\n\tdata: string | null;\n\terrorMessage: string | null;\n};\n\ntype Route = { path: string[]; params: Record<string, string> };\n\nclass WhopCoreObservable<T> {\n\tprivate subscribers: Set<(value: T) => void> = new Set();\n\tprivate value: T;\n\n\tconstructor(value: T) {\n\t\tthis.value = value;\n\t}\n\n\tsetValue(value: T) {\n\t\tthis.value = value;\n\t\tfor (const callback of this.subscribers) {\n\t\t\tcallback(value);\n\t\t}\n\t}\n\n\tgetValue() {\n\t\treturn this.value;\n\t}\n\n\tsubscribe(callback: (value: T) => void) {\n\t\tthis.subscribers.add(callback);\n\t\treturn () => {\n\t\t\tthis.subscribers.delete(callback);\n\t\t};\n\t}\n}\n\nclass WhopCoreNavigation {\n\tpublic path = new WhopCoreObservable<Route[]>([]);\n\tpublic sheet = new WhopCoreObservable<Route | null>(null);\n\n\tconstructor() {\n\t\tthis.getFullStack = this.getFullStack.bind(this);\n\t\tthis.getCurrentSheet = this.getCurrentSheet.bind(this);\n\t\tthis.subscribeToPath = this.subscribeToPath.bind(this);\n\t\tthis.subscribeToSheet = this.subscribeToSheet.bind(this);\n\t}\n\n\tpush(route: Route) {\n\t\tif (this.getCurrent().path.join(\"/\") === route.path.join(\"/\")) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.path.setValue([...this.path.getValue(), route]);\n\t\tif (typeof window !== \"undefined\" && window.history) {\n\t\t\ttry {\n\t\t\t\tconst pathBits = route.path.join(\"/\");\n\t\t\t\tconst paramsBits = Object.entries(route.params)\n\t\t\t\t\t.map(([key, value]) => `${key}=${value}`)\n\t\t\t\t\t.join(\"&\");\n\t\t\t\twindow.history.pushState(\n\t\t\t\t\t{ route, index: this.path.getValue().length },\n\t\t\t\t\t\"\",\n\t\t\t\t\t`#${pathBits}?${paramsBits}`,\n\t\t\t\t);\n\t\t\t} catch {}\n\t\t}\n\t}\n\n\tpop() {\n\t\tif (typeof window !== \"undefined\" && window.history) {\n\t\t\ttry {\n\t\t\t\twindow.history.back();\n\t\t\t} catch {}\n\t\t}\n\t}\n\n\tgetFullStack() {\n\t\treturn this.path.getValue();\n\t}\n\n\tgetCurrent() {\n\t\treturn (\n\t\t\tthis.path.getValue()[this.path.getValue().length - 1] ?? {\n\t\t\t\tpath: [],\n\t\t\t\tparams: {},\n\t\t\t}\n\t\t);\n\t}\n\n\tpresentSheet(route: Route) {\n\t\tthis.sheet.setValue(route);\n\t}\n\n\tdismissSheet() {\n\t\tthis.sheet.setValue(null);\n\t}\n\n\tgetCurrentSheet() {\n\t\treturn this.sheet.getValue() ?? null;\n\t}\n\n\tsubscribeToPath(callback: (route: Route[]) => void) {\n\t\treturn this.path.subscribe(callback);\n\t}\n\n\tsubscribeToSheet(callback: (route: Route | null) => void) {\n\t\treturn this.sheet.subscribe(callback);\n\t}\n}\n\nexport type TWhopCoreNavigation = WhopCoreNavigation;\n\nconst navigation = new WhopCoreNavigation();\nif (typeof window !== \"undefined\" && Platform.OS === \"web\") {\n\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t(window as any).whopCoreNavigation = navigation;\n\n\twindow.addEventListener(\"popstate\", (e) => {\n\t\tconst currentLength = navigation.path.getValue().length;\n\t\tif (!e.state) {\n\t\t\tnavigation.path.setValue(navigation.path.getValue().slice(0, -1));\n\t\t\treturn;\n\t\t}\n\t\tconst index = e.state.index;\n\t\tconst route = e.state.route;\n\t\tif (index < currentLength) {\n\t\t\tnavigation.path.setValue(navigation.path.getValue().slice(0, -1));\n\t\t} else {\n\t\t\tnavigation.path.setValue([...navigation.path.getValue(), route]);\n\t\t}\n\t});\n}\n\nfunction ok(data: unknown): FunctionCallResult {\n\treturn { isOk: true, data: JSON.stringify(data), errorMessage: null };\n}\n\nfunction err(message: string): FunctionCallResult {\n\treturn { isOk: false, data: null, errorMessage: message };\n}\n\nfunction getOrigin(): string {\n\tif (typeof window !== \"undefined\" && window.location) {\n\t\treturn window.location.origin;\n\t}\n\treturn \"\";\n}\n\nconst syncHandlers: ExecSyncApi = {\n\tgetAppApiOrigin() {\n\t\treturn { apiOrigin: getOrigin() };\n\t},\n\tcacheGet({ key }: { key?: string | null }) {\n\t\ttry {\n\t\t\tif (typeof window !== \"undefined\" && window.localStorage && key) {\n\t\t\t\treturn { data: window.localStorage.getItem(key) };\n\t\t\t}\n\t\t\treturn { data: null };\n\t\t} catch {\n\t\t\treturn { data: null };\n\t\t}\n\t},\n\tcacheSet({ key, data }: { key?: string | null; data?: string | null }) {\n\t\ttry {\n\t\t\tif (typeof window !== \"undefined\" && window.localStorage && key != null) {\n\t\t\t\tif (data == null) {\n\t\t\t\t\twindow.localStorage.removeItem(key);\n\t\t\t\t} else {\n\t\t\t\t\twindow.localStorage.setItem(key, data);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {}\n\t\treturn {};\n\t},\n\trouterPush(route: Route) {\n\t\tnavigation.push(route);\n\t\treturn {};\n\t},\n\trouterPop() {\n\t\tnavigation.pop();\n\t\treturn {};\n\t},\n\trouterGetCurrent() {\n\t\treturn navigation.getCurrent();\n\t},\n\tsetNavigationBarData() {\n\t\treturn {};\n\t},\n\trouterPresentSheet({ path, params }: Route) {\n\t\tnavigation.presentSheet({\n\t\t\tpath: Array.from(path ?? []),\n\t\t\tparams: params ?? {},\n\t\t});\n\t\treturn {};\n\t},\n\trouterDismissSheet() {\n\t\tnavigation.dismissSheet();\n\t\treturn {};\n\t},\n\trouterGetCurrentSheet() {\n\t\treturn navigation.getCurrentSheet() ?? null;\n\t},\n\tdowngradeToWebView() {\n\t\treturn {};\n\t},\n\tgetHostAppDetails() {\n\t\treturn {\n\t\t\tbuild: \"web\",\n\t\t\tversion: \"0.0.0\",\n\t\t\tplatform: \"web\",\n\t\t\tbuildType: \"appstore\",\n\t\t};\n\t},\n\tsetScreenOrientationMode() {\n\t\treturn {};\n\t},\n};\n\nlet iframeModulePromise: Promise<typeof import(\"@whop/iframe\")> | null = null;\n\nasync function loadIframeModule() {\n\tif (!iframeModulePromise) {\n\t\tiframeModulePromise = import(\"@whop/iframe\");\n\t}\n\treturn await iframeModulePromise;\n}\n\nlet iframeSdk: ReturnType<typeof import(\"@whop/iframe\").createSdk> | null =\n\tnull;\n\nasync function loadIframeSdk() {\n\tif (!iframeSdk) {\n\t\tconst module = await loadIframeModule();\n\t\tiframeSdk = module.createSdk({\n\t\t\tappId: process.env.NEXT_PUBLIC_WHOP_APP_ID,\n\t\t});\n\t}\n\treturn iframeSdk;\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: <explanation>\ntype MakeAsync<T extends Record<string, any>> = {\n\t[K in keyof T]: (params: Parameters<T[K]>[0]) => Promise<ReturnType<T[K]>>;\n};\n\nconst asyncHandlers: MakeAsync<Pick<ExecAsyncApi, \"inAppPurchase\">> = {\n\tinAppPurchase: async ({ planId, id }) => {\n\t\tconst sdk = await loadIframeSdk();\n\t\tconst result = await sdk.inAppPurchase({ planId, id: id ?? undefined });\n\t\tif (result.status === \"ok\") {\n\t\t\treturn {\n\t\t\t\tsessionId: result.data.sessionId,\n\t\t\t\treceiptId: result.data.receiptId,\n\t\t\t};\n\t\t}\n\t\tthrow new Error(result.error);\n\t},\n};\n\nconst nativeWhopCoreStub = {\n\texecSync(name: string, paramsJson: string): FunctionCallResult {\n\t\ttry {\n\t\t\tconst params = paramsJson ? JSON.parse(paramsJson) : {};\n\t\t\tconst handler = syncHandlers[name as keyof typeof syncHandlers];\n\t\t\tif (!handler) return err(`Unknown sync method: ${name}`);\n\t\t\tconst result = handler(params);\n\t\t\treturn ok(result);\n\t\t} catch (e) {\n\t\t\treturn err(e instanceof Error ? e.message : \"Unknown error\");\n\t\t}\n\t},\n\tasync execAsync(\n\t\tname: string,\n\t\tparamsJson: string,\n\t): Promise<FunctionCallResult> {\n\t\ttry {\n\t\t\tconst params = paramsJson ? JSON.parse(paramsJson) : {};\n\t\t\tconst handler = (\n\t\t\t\tasyncHandlers as Record<string, (p: unknown) => Promise<unknown>>\n\t\t\t)[name];\n\t\t\tif (!handler) return err(`Unknown async method: ${name}`);\n\t\t\tconst result = await handler(params);\n\t\t\treturn ok(result);\n\t\t} catch (e) {\n\t\t\treturn err(e instanceof Error ? e.message : \"Unknown error\");\n\t\t}\n\t},\n};\n\nexport default nativeWhopCoreStub;\n","import nativeWhopCore from \"./native-whop-core\";\nimport type { PathParams } from \"./props\";\n\n// biome-ignore lint/complexity/noBannedTypes: allow here\ntype EmptyObject = {};\n\nexport interface ExecSyncApi {\n\tgetAppApiOrigin(params: EmptyObject): { apiOrigin: string };\n\tcacheGet(params: { key?: string | null }): { data?: string | null };\n\tcacheSet(params: { key?: string | null; data?: string | null }): EmptyObject;\n\trouterPush(params: PathParams): EmptyObject;\n\trouterPop(params: EmptyObject): EmptyObject;\n\trouterGetCurrent(params: EmptyObject): PathParams;\n\tsetNavigationBarData(params: {\n\t\ttitle?: string | null;\n\t\tdescription?: string | null;\n\t}): EmptyObject;\n\trouterPresentSheet(params: PathParams): EmptyObject;\n\trouterDismissSheet(params: EmptyObject): EmptyObject;\n\trouterGetCurrentSheet(params: EmptyObject): PathParams | null | undefined;\n\tdowngradeToWebView(params: EmptyObject): EmptyObject;\n\tgetHostAppDetails(params: EmptyObject): {\n\t\tbuild: string;\n\t\tversion: string;\n\t\tplatform: \"ios\" | \"android\" | \"web\";\n\t\tbuildType: \"appstore\" | \"testflight\" | \"debug\";\n\t};\n\tsetScreenOrientationMode(params: {\n\t\ttargetScreenOrientationMode: \"portrait\" | \"landscape\" | \"rotate\";\n\t}): EmptyObject;\n}\n\nexport interface ExecAsyncApi extends ExecSyncApi {\n\tinAppPurchase(params: {\n\t\tid?: string | null;\n\t\tplanId: string;\n\t}): {\n\t\tsessionId: string;\n\t\treceiptId: string;\n\t};\n}\n\nexport function __internal_execSync<F extends keyof ExecSyncApi>(\n\tname: F,\n\tparams: Parameters<ExecSyncApi[F]>[0],\n): ReturnType<ExecSyncApi[F]> {\n\tconst resultJson = nativeWhopCore.execSync(name, JSON.stringify(params));\n\tif (!resultJson.isOk) {\n\t\tthrow new Error(`Failed to execute ${name}: ${resultJson.errorMessage}`);\n\t}\n\n\treturn JSON.parse(resultJson.data || \"{}\") as ReturnType<ExecSyncApi[F]>;\n}\n\nexport async function __internal_execAsync<F extends keyof ExecAsyncApi>(\n\tname: F,\n\tparams: Parameters<ExecAsyncApi[F]>[0],\n): Promise<ReturnType<ExecAsyncApi[F]>> {\n\tconst resultJson = await nativeWhopCore.execAsync(\n\t\tname,\n\t\tJSON.stringify(params),\n\t);\n\n\tif (!resultJson.isOk) {\n\t\tthrow new Error(`Failed to execute ${name}: ${resultJson.errorMessage}`);\n\t}\n\n\treturn JSON.parse(resultJson.data || \"{}\") as ReturnType<ExecAsyncApi[F]>;\n}\n","/**\n * Web-safe wrapper for react-native-haptic-feedback.\n * - Lazily imports the native module only in native environments.\n * - Provides a no-op fallback on web to avoid runtime crashes.\n */\n\ntype HapticType =\n\t| \"selection\"\n\t| \"impactLight\"\n\t| \"impactMedium\"\n\t| \"impactHeavy\"\n\t| \"notificationSuccess\"\n\t| \"notificationWarning\"\n\t| \"notificationError\";\n\ntype HapticOptions = {\n\tenableVibrateFallback?: boolean;\n\tignoreAndroidSystemSettings?: boolean;\n};\n\n// Singleton holder for the native module once loaded\nlet nativeModule: {\n\ttrigger: (type: HapticType, options?: HapticOptions) => void;\n} | null = null;\nlet loadingPromise: Promise<void> | null = null;\n\nasync function ensureNativeLoaded(): Promise<void> {\n\t// If on web, skip loading entirely\n\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t// @ts-ignore - process may not be typed in RN web builds\n\tconst isWeb =\n\t\ttypeof document !== \"undefined\" && typeof window !== \"undefined\";\n\tif (isWeb) return;\n\n\tif (nativeModule || loadingPromise) {\n\t\treturn loadingPromise ?? Promise.resolve();\n\t}\n\n\tloadingPromise = import(\"react-native-haptic-feedback\")\n\t\t.then((mod) => {\n\t\t\tnativeModule = { trigger: mod.default.trigger };\n\t\t})\n\t\t.catch(() => {\n\t\t\t// Keep nativeModule null; fall back to noop\n\t\t})\n\t\t.finally(() => {\n\t\t\tloadingPromise = null;\n\t\t});\n\n\treturn loadingPromise;\n}\n\nconst HAPTIC_NOOP = {\n\ttrigger: (_type: HapticType, _options?: HapticOptions) => {\n\t\t// no-op on web\n\t},\n};\n\nconst Haptics = {\n\tasync trigger(type: HapticType, options?: HapticOptions): Promise<void> {\n\t\tawait ensureNativeLoaded();\n\t\tif (nativeModule) {\n\t\t\ttry {\n\t\t\t\tnativeModule.trigger(type, options);\n\t\t\t} catch {\n\t\t\t\t// ignore\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tHAPTIC_NOOP.trigger(type, options);\n\t},\n};\n\nexport default Haptics;\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA,OAAO,UAAU;AACjB,SAAS,YAAAA,iBAAgB;;;ACAzB,SAAS,2BAA2B;;;ACDpC,SAAS,gBAAgB;AAWzB,IAAM,qBAAN,MAA4B;AAAA,EACnB,cAAuC,oBAAI,IAAI;AAAA,EAC/C;AAAA,EAER,YAAY,OAAU;AACrB,SAAK,QAAQ;AAAA,EACd;AAAA,EAEA,SAAS,OAAU;AAClB,SAAK,QAAQ;AACb,eAAW,YAAY,KAAK,aAAa;AACxC,eAAS,KAAK;AAAA,IACf;AAAA,EACD;AAAA,EAEA,WAAW;AACV,WAAO,KAAK;AAAA,EACb;AAAA,EAEA,UAAU,UAA8B;AACvC,SAAK,YAAY,IAAI,QAAQ;AAC7B,WAAO,MAAM;AACZ,WAAK,YAAY,OAAO,QAAQ;AAAA,IACjC;AAAA,EACD;AACD;AAEA,IAAM,qBAAN,MAAyB;AAAA,EACjB,OAAO,IAAI,mBAA4B,CAAC,CAAC;AAAA,EACzC,QAAQ,IAAI,mBAAiC,IAAI;AAAA,EAExD,cAAc;AACb,SAAK,eAAe,KAAK,aAAa,KAAK,IAAI;AAC/C,SAAK,kBAAkB,KAAK,gBAAgB,KAAK,IAAI;AACrD,SAAK,kBAAkB,KAAK,gBAAgB,KAAK,IAAI;AACrD,SAAK,mBAAmB,KAAK,iBAAiB,KAAK,IA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A,QAAM,IAAI,MAAM,yBAAyBA,UAAS,EAAE,EAAE;AACvD;AAEA,IAAM,YAAY,aAAa;AAExB,IAAM,UAAU,IAAI,KAAK;AAAA,EAC/B,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,SAAS,IAAI,IAAI,kBAAkB,SAAS,EAAE;AAC/C,CAAC;;;ADtBD,wBAAc;;;AKqBd,IAAI,eAEO;AACX,IAAI,iBAAuC;AAE3C,eAAe,qBAAoC;AAIlD,QAAM,QACL,OAAO,aAAa,eAAe,OAAO,WAAW;AACtD,MAAI,MAAO;AAEX,MAAI,gBAAgB,gBAAgB;AACnC,WAAO,kBAAkB,QAAQ,QAAQ;AAAA,EAC1C;AAEA,mBAAiB,OAAO,8BAA8B,EACpD,KAAK,CAAC,QAAQ;AACd,mBAAe,EAAE,SAAS,IAAI,QAAQ,QAAQ;AAAA,EAC/C,CAAC,EACA,MAAM,MAAM;AAAA,EAEb,CAAC,EACA,QAAQ,MAAM;AACd,qBAAiB;AAAA,EAClB,CAAC;AAEF,SAAO;AACR;AAEA,IAAM,cAAc;AAAA,EACnB,SAAS,CAAC,OAAmB,aAA6B;AAAA,EAE1D;AACD;AAEA,IAAM,UAAU;AAAA,EACf,MAAM,QAAQ,MAAkB,SAAwC;AACvE,UAAM,mBAAmB;AACzB,QAAI,cAAc;AACjB,UAAI;AACH,qBAAa,QAAQ,MAAM,OAAO;AAAA,MACnC,QAAQ;AAAA,MAER;AACA;AAAA,IACD;AACA,gBAAY,QAAQ,MAAM,OAAO;AAAA,EAClC;AACD;AAEA,IAAO,kBAAQ;","names":["Platform","Platform"]}
|
|
1
|
+
{"version":3,"sources":["../../src/lib/index.ts","../../src/lib/client-sdk.ts","../../src/lib/native-whop-core.ts","../../src/lib/native-whop-core-stub.ts","../../src/lib/native-whop-core-wrapper.ts","../../src/lib/haptics.ts"],"sourcesContent":["export * from \"./client-sdk\";\nexport * from \"./native-whop-core-wrapper\";\nexport * from \"./props\";\nimport Haptics from \"./haptics\";\n\nexport { Haptics };\n","import Whop from \"@whop/sdk\";\nimport { Platform } from \"react-native\";\nimport { __internal_execSync } from \"./native-whop-core-wrapper\";\n\nfunction getAppOrigin() {\n\tif (Platform.OS === \"android\" || Platform.OS === \"ios\") {\n\t\treturn __internal_execSync(\"getAppApiOrigin\", {}).apiOrigin;\n\t}\n\n\tif (Platform.OS === \"web\" && typeof window !== \"undefined\") {\n\t\treturn window.location.origin;\n\t}\n\n\tthrow new Error(`Unsupported platform: ${Platform.OS}`);\n}\n\nconst appOrigin = getAppOrigin();\n\nexport const whopSdk = new Whop({\n\tapiKey: \"client\",\n\tappID: \"client\",\n\tbaseURL: new URL(\"/_whop/api/v1/\", appOrigin).href,\n});\n\nexport * from \"@whop/sdk\";\n","import type { TurboModule } from \"react-native\";\nimport { TurboModuleRegistry } from \"react-native\";\nimport stub from \"./native-whop-core-stub\";\n\nexport type FunctionCallResult = {\n\tisOk: boolean;\n\tdata: string | null;\n\terrorMessage: string | null;\n};\n\nexport interface Spec extends TurboModule {\n\texecSync(name: string, paramsJson: string): FunctionCallResult;\n\texecAsync(name: string, paramsJson: string): Promise<FunctionCallResult>;\n}\n\nfunction resolveNative(): Spec | null {\n\ttry {\n\t\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t\tconst registry: any = TurboModuleRegistry as any;\n\t\tconst get = registry?.getEnforcing ?? registry?.get;\n\t\tif (typeof get === \"function\") {\n\t\t\treturn get.call(registry, \"NativeWhopCore\") as Spec;\n\t\t}\n\t\treturn null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nconst native = resolveNative();\n\nexport default native ?? (stub as Spec);\n","import { Platform } from \"react-native\";\nimport type { ExecAsyncApi, ExecSyncApi } from \"./native-whop-core-wrapper\";\n\nexport type FunctionCallResult = {\n\tisOk: boolean;\n\tdata: string | null;\n\terrorMessage: string | null;\n};\n\ntype Route = { path: string[]; params: Record<string, string> };\n\nclass WhopCoreObservable<T> {\n\tprivate subscribers: Set<(value: T) => void> = new Set();\n\tprivate value: T;\n\n\tconstructor(value: T) {\n\t\tthis.value = value;\n\t}\n\n\tsetValue(value: T) {\n\t\tthis.value = value;\n\t\tfor (const callback of this.subscribers) {\n\t\t\tcallback(value);\n\t\t}\n\t}\n\n\tgetValue() {\n\t\treturn this.value;\n\t}\n\n\tsubscribe(callback: (value: T) => void) {\n\t\tthis.subscribers.add(callback);\n\t\treturn () => {\n\t\t\tthis.subscribers.delete(callback);\n\t\t};\n\t}\n}\n\nclass WhopCoreNavigation {\n\tpublic path = new WhopCoreObservable<Route[]>([]);\n\tpublic sheet = new WhopCoreObservable<Route | null>(null);\n\n\tconstructor() {\n\t\tthis.getFullStack = this.getFullStack.bind(this);\n\t\tthis.getCurrentSheet = this.getCurrentSheet.bind(this);\n\t\tthis.subscribeToPath = this.subscribeToPath.bind(this);\n\t\tthis.subscribeToSheet = this.subscribeToSheet.bind(this);\n\t}\n\n\tpush(route: Route) {\n\t\tif (this.getCurrent().path.join(\"/\") === route.path.join(\"/\")) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.path.setValue([...this.path.getValue(), route]);\n\t\tif (typeof window !== \"undefined\" && window.history) {\n\t\t\ttry {\n\t\t\t\tconst pathBits = route.path.join(\"/\");\n\t\t\t\tconst paramsBits = Object.entries(route.params)\n\t\t\t\t\t.map(([key, value]) => `${key}=${value}`)\n\t\t\t\t\t.join(\"&\");\n\t\t\t\twindow.history.pushState(\n\t\t\t\t\t{ route, index: this.path.getValue().length },\n\t\t\t\t\t\"\",\n\t\t\t\t\t`#${pathBits}?${paramsBits}`,\n\t\t\t\t);\n\t\t\t} catch {}\n\t\t}\n\t}\n\n\tpop() {\n\t\tif (typeof window !== \"undefined\" && window.history) {\n\t\t\ttry {\n\t\t\t\twindow.history.back();\n\t\t\t} catch {}\n\t\t}\n\t}\n\n\tgetFullStack() {\n\t\treturn this.path.getValue();\n\t}\n\n\tgetCurrent() {\n\t\treturn (\n\t\t\tthis.path.getValue()[this.path.getValue().length - 1] ?? {\n\t\t\t\tpath: [],\n\t\t\t\tparams: {},\n\t\t\t}\n\t\t);\n\t}\n\n\tpresentSheet(route: Route) {\n\t\tthis.sheet.setValue(route);\n\t}\n\n\tdismissSheet() {\n\t\tthis.sheet.setValue(null);\n\t}\n\n\tgetCurrentSheet() {\n\t\treturn this.sheet.getValue() ?? null;\n\t}\n\n\tsubscribeToPath(callback: (route: Route[]) => void) {\n\t\treturn this.path.subscribe(callback);\n\t}\n\n\tsubscribeToSheet(callback: (route: Route | null) => void) {\n\t\treturn this.sheet.subscribe(callback);\n\t}\n}\n\nexport type TWhopCoreNavigation = WhopCoreNavigation;\n\nconst navigation = new WhopCoreNavigation();\nif (typeof window !== \"undefined\" && Platform.OS === \"web\") {\n\t// biome-ignore lint/suspicious/noExplicitAny: <explanation>\n\t(window as any).whopCoreNavigation = navigation;\n\n\twindow.addEventListener(\"popstate\", (e) => {\n\t\tconst currentLength = navigation.path.getValue().length;\n\t\tif (!e.state) {\n\t\t\tnavigation.path.setValue(navigation.path.getValue().slice(0, -1));\n\t\t\treturn;\n\t\t}\n\t\tconst index = e.state.index;\n\t\tconst route = e.state.route;\n\t\tif (index < currentLength) {\n\t\t\tnavigation.path.setValue(navigation.path.getValue().slice(0, -1));\n\t\t} else {\n\t\t\tnavigation.path.setValue([...navigation.path.getValue(), route]);\n\t\t}\n\t});\n}\n\nfunction ok(data: unknown): FunctionCallResult {\n\treturn { isOk: true, data: JSON.stringify(data), errorMessage: null };\n}\n\nfunction err(message: string): FunctionCallResult {\n\treturn { isOk: false, data: null, errorMessage: message };\n}\n\nfunction getOrigin(): string {\n\tif (typeof window !== \"undefined\" && window.location) {\n\t\treturn window.location.origin;\n\t}\n\treturn \"\";\n}\n\nconst syncHandlers: ExecSyncApi = {\n\tgetAppApiOrigin() {\n\t\treturn { apiOrigin: getOrigin() };\n\t},\n\tcacheGet({ key }: { key?: string | null }) {\n\t\ttry {\n\t\t\tif (typeof window !== \"undefined\" && window.localStorage && key) {\n\t\t\t\treturn { data: window.localStorage.getItem(key) };\n\t\t\t}\n\t\t\treturn { data: null };\n\t\t} catch {\n\t\t\treturn { data: null };\n\t\t}\n\t},\n\tcacheSet({ key, data }: { key?: string | null; data?: string | null }) {\n\t\ttry {\n\t\t\tif (typeof window !== \"undefined\" && window.localStorage && key != null) {\n\t\t\t\tif (data == null) {\n\t\t\t\t\twindow.localStorage.removeItem(key);\n\t\t\t\t} else {\n\t\t\t\t\twindow.localStorage.setItem(key, data);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {}\n\t\treturn {};\n\t},\n\trouterPush(route) {\n\t\tif (route.origin) {\n\t\t\tconst path = `/${route.path.join(\"/\")}`;\n\t\t\tconst url = new URL(path, route.origin);\n\t\t\tfor (const [k, v] of Object.entries(route.params ?? {})) {\n\t\t\t\turl.searchParams.set(k, v);\n\t\t\t}\n\t\t\tloadIframeSdk().then((sdk) => sdk.openExternalUrl({ url: url.href }));\n\t\t} else {\n\t\t\tnavigation.push(route);\n\t\t}\n\t\treturn {};\n\t},\n\trouterPop() {\n\t\tnavigation.pop();\n\t\treturn {};\n\t},\n\trouterGetCurrent() {\n\t\treturn navigation.getCurrent();\n\t},\n\tsetNavigationBarData() {\n\t\treturn {};\n\t},\n\trouterPresentSheet({ path, params }: Route) {\n\t\tnavigation.presentSheet({\n\t\t\tpath: Array.from(path ?? []),\n\t\t\tparams: params ?? {},\n\t\t});\n\t\treturn {};\n\t},\n\trouterDismissSheet() {\n\t\tnavigation.dismissSheet();\n\t\treturn {};\n\t},\n\trouterGetCurrentSheet() {\n\t\treturn navigation.getCurrentSheet() ?? null;\n\t},\n\tdowngradeToWebView() {\n\t\treturn {};\n\t},\n\tgetHostAppDetails() {\n\t\treturn {\n\t\t\tbuild: \"web\",\n\t\t\tversion: \"0.0.0\",\n\t\t\tplatform: \"web\",\n\t\t\tbuildType: \"appstore\",\n\t\t};\n\t},\n\tsetScreenOrientationMode() {\n\t\treturn {};\n\t},\n};\n\nlet iframeModulePromise: Promise<typeof import(\"@whop/iframe\")> | null = null;\n\nasync function loadIframeModule() {\n\tif (!iframeModulePromise) {\n\t\tiframeModulePromise = import(\"@whop/iframe\");\n\t}\n\treturn await iframeModulePromise;\n}\n\nlet iframeSdk: ReturnType<typeof import(\"@whop/iframe\").createSdk> | null =\n\tnull;\n\nasync function loadIframeSdk() {\n\tif (!iframeSdk) {\n\t\tconst module = await loadIframeModule();\n\t\tiframeSdk = module.createSdk({\n\t\t\tappId: process.env.NEXT_PUBLIC_WHOP_APP_ID,\n\t\t\toverrideParentOrigins: [\"https://whop.com\", \"http://localhost:8004\"],\n\t\t});\n\t}\n\treturn iframeSdk;\n}\n\n// biome-ignore lint/suspicious/noExplicitAny: <explanation>\ntype MakeAsync<T extends Record<string, any>> = {\n\t[K in keyof T]: (params: Parameters<T[K]>[0]) => Promise<ReturnType<T[K]>>;\n};\n\nconst asyncHandlers: MakeAsync<Pick<ExecAsyncApi, \"inAppPurchase\">> = {\n\tinAppPurchase: async ({ planId, id }) => {\n\t\tconst sdk = await loadIframeSdk();\n\t\tconst result = await sdk.inAppPurchase({ planId, id: id ?? undefined });\n\t\tif (result.status === \"ok\") {\n\t\t\treturn {\n\t\t\t\tsessionId: result.data.sessionId,\n\t\t\t\treceiptId: result.data.receiptId,\n\t\t\t};\n\t\t}\n\t\tthrow new Error(result.error);\n\t},\n};\n\nconst nativeWhopCoreStub = {\n\texecSync(name: string, paramsJson: string): FunctionCallResult {\n\t\ttry {\n\t\t\tconst params = paramsJson ? JSON.parse(paramsJson) : {};\n\t\t\tconst handler = syncHandlers[name as keyof typeof syncHandlers];\n\t\t\tif (!handler) return err(`Unknown sync method: ${name}`);\n\t\t\tconst result = handler(params);\n\t\t\treturn ok(result);\n\t\t} catch (e) {\n\t\t\treturn err(e instanceof Error ? e.message : \"Unknown error\");\n\t\t}\n\t},\n\tasync execAsync(\n\t\tname: string,\n\t\tparamsJson: string,\n\t): Promise<FunctionCallResult> {\n\t\ttry {\n\t\t\tconst params = paramsJson ? JSON.parse(paramsJson) : {};\n\t\t\tconst handler = (\n\t\t\t\tasyncHandlers as Record<string, (p: unknown) => Promise<unknown>>\n\t\t\t)[name];\n\t\t\tif (!handler) return err(`Unknown async method: ${name}`);\n\t\t\tconst result = await handler(params);\n\t\t\treturn ok(result);\n\t\t} catch (e) {\n\t\t\treturn err(e instanceof Error ? e.message : \"Unknown error\");\n\t\t}\n\t},\n};\n\nexport default nativeWhopCoreStub;\n","import nativeWhopCore from \"./native-whop-core\";\nimport type { PathParams, PathParamsWithOrigin } from \"./props\";\n\n// biome-ignore lint/complexity/noBannedTypes: allow here\ntype EmptyObject = {};\n\nexport interface ExecSyncApi {\n\tgetAppApiOrigin(params: EmptyObject): { apiOrigin: string };\n\tcacheGet(params: { key?: string | null }): { data?: string | null };\n\tcacheSet(params: { key?: string | null; data?: string | null }): EmptyObject;\n\trouterPush(params: PathParamsWithOrigin): EmptyObject;\n\trouterPop(params: EmptyObject): EmptyObject;\n\trouterGetCurrent(params: EmptyObject): PathParams;\n\tsetNavigationBarData(params: {\n\t\ttitle?: string | null;\n\t\tdescription?: string | null;\n\t}): EmptyObject;\n\trouterPresentSheet(params: PathParams): EmptyObject;\n\trouterDismissSheet(params: EmptyObject): EmptyObject;\n\trouterGetCurrentSheet(params: EmptyObject): PathParams | null | undefined;\n\tdowngradeToWebView(params: EmptyObject): EmptyObject;\n\tgetHostAppDetails(params: EmptyObject): {\n\t\tbuild: string;\n\t\tversion: string;\n\t\tplatform: \"ios\" | \"android\" | \"web\";\n\t\tbuildType: \"appstore\" | \"testflight\" | \"debug\";\n\t};\n\tsetScreenOrientationMode(params: {\n\t\ttargetScreenOrientationMode: \"portrait\" | \"landscape\" | \"rotate\";\n\t}): EmptyObject;\n}\n\nexport interface ExecAsyncApi extends ExecSyncApi {\n\tinAppPurchase(params: { id?: string | null; planId: string }): {\n\t\tsessionId: string;\n\t\treceiptId: string;\n\t};\n}\n\nexport function __internal_execSync<F extends keyof ExecSyncApi>(\n\tname: F,\n\tparams: Parameters<ExecSyncApi[F]>[0],\n): ReturnType<ExecSyncApi[F]> {\n\tconst resultJson = nativeWhopCore.execSync(name, JSON.stringify(params));\n\tif (!resultJson.isOk) {\n\t\tthrow new Error(`Failed to execute ${name}: ${resultJson.errorMessage}`);\n\t}\n\n\treturn JSON.parse(resultJson.data || \"{}\") as ReturnType<ExecSyncApi[F]>;\n}\n\nexport async function __internal_execAsync<F extends keyof ExecAsyncApi>(\n\tname: F,\n\tparams: Parameters<ExecAsyncApi[F]>[0],\n): Promise<ReturnType<ExecAsyncApi[F]>> {\n\tconst resultJson = await nativeWhopCore.execAsync(\n\t\tname,\n\t\tJSON.stringify(params),\n\t);\n\n\tif (!resultJson.isOk) {\n\t\tthrow new Error(`Failed to execute ${name}: ${resultJson.errorMessage}`);\n\t}\n\n\treturn JSON.parse(resultJson.data || \"{}\") as ReturnType<ExecAsyncApi[F]>;\n}\n","/**\n * Web-safe wrapper for react-native-haptic-feedback.\n * - Lazily imports the native module only in native environments.\n * - Provides a no-op fallback on web to avoid runtime crashes.\n */\n\ntype HapticType =\n\t| \"selection\"\n\t| \"impactLight\"\n\t| \"impactMedium\"\n\t| \"impactHeavy\"\n\t| \"notificationSuccess\"\n\t| \"notificationWarning\"\n\t| \"notificationError\";\n\ntype HapticOptions = {\n\tenableVibrateFallback?: boolean;\n\tignoreAndroidSystemSettings?: boolean;\n};\n\n// Singleton holder for the native module once loaded\nlet nativeModule: {\n\ttrigger: (type: HapticType, options?: HapticOptions) => void;\n} | null = null;\nlet loadingPromise: Promise<void> | null = null;\n\nasync function ensureNativeLoaded(): Promise<void> {\n\t// If on web, skip loading entirely\n\t// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n\t// @ts-ignore - process may not be typed in RN web builds\n\tconst isWeb =\n\t\ttypeof document !== \"undefined\" && typeof window !== \"undefined\";\n\tif (isWeb) return;\n\n\tif (nativeModule || loadingPromise) {\n\t\treturn loadingPromise ?? Promise.resolve();\n\t}\n\n\tloadingPromise = import(\"react-native-haptic-feedback\")\n\t\t.then((mod) => {\n\t\t\tnativeModule = { trigger: mod.default.trigger };\n\t\t})\n\t\t.catch(() => {\n\t\t\t// Keep nativeModule null; fall back to noop\n\t\t})\n\t\t.finally(() => {\n\t\t\tloadingPromise = null;\n\t\t});\n\n\treturn loadingPromise;\n}\n\nconst HAPTIC_NOOP = {\n\ttrigger: (_type: HapticType, _options?: HapticOptions) => {\n\t\t// no-op on web\n\t},\n};\n\nconst Haptics = {\n\tasync trigger(type: HapticType, options?: HapticOptions): Promise<void> {\n\t\tawait ensureNativeLoaded();\n\t\tif (nativeModule) {\n\t\t\ttry {\n\t\t\t\tnativeModule.trigger(type, options);\n\t\t\t} catch {\n\t\t\t\t// ignore\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tHAPTIC_NOOP.trigger(type, options);\n\t},\n};\n\nexport default Haptics;\n"],"mappings":";;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA;AAAA;AAAA;AAAA;AAAA,OAAO,UAAU;AACjB,SAAS,YAAAA,iBAAgB;;;ACAzB,SAAS,2BAA2B;;;ACDpC,SAAS,gBAAgB;AAWzB,IAAM,qBAAN,MAA4B;AAAA,EACnB,cAAuC,oBAAI,IAAI;AAAA,EAC/C;AAAA,EAER,YAAY,OAAU;AACrB,SAAK,QAAQ;AAAA,EACd;AAAA,EAEA,SAAS,OAAU;AAClB,SAAK,QAAQ;AACb,eAAW,YAAY,KAAK,aAAa;AACxC,eAAS,KAAK;AAAA,IACf;AAAA,EACD;AAAA,EAEA,WAAW;AACV,WAAO,KAAK;AAAA,EACb;AAAA,EAEA,UAAU,UAA8B;AACvC,SAAK,YAAY,IAAI,QAAQ;AAC7B,WAAO,MAAM;AACZ,WAAK,YAAY,OAAO,QAAQ;AAAA,IACjC;AAAA,EACD;AACD;AAEA,IAAM,qBAAN,MAAyB;AAAA,EACjB,OAAO,IAAI,mBAA4B,CAAC,CAAC;AAAA,EACzC,QAAQ,IAAI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;AACd,qBAAiB;AAAA,EAClB,CAAC;AAEF,SAAO;AACR;AAEA,IAAM,cAAc;AAAA,EACnB,SAAS,CAAC,OAAmB,aAA6B;AAAA,EAE1D;AACD;AAEA,IAAM,UAAU;AAAA,EACf,MAAM,QAAQ,MAAkB,SAAwC;AACvE,UAAM,mBAAmB;AACzB,QAAI,cAAc;AACjB,UAAI;AACH,qBAAa,QAAQ,MAAM,OAAO;AAAA,MACnC,QAAQ;AAAA,MAER;AACA;AAAA,IACD;AACA,gBAAY,QAAQ,MAAM,OAAO;AAAA,EAClC;AACD;AAEA,IAAO,kBAAQ;","names":["Platform","Platform"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whop/react-native",
|
|
3
3
|
"description": "React Native SDK for building embedded apps on Whop",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.7",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/whopio/whop-sdk-ts",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@babel/runtime": "7.27.6",
|
|
46
46
|
"@react-native/babel-preset": "0.80.1",
|
|
47
47
|
"@react-native/metro-config": "0.80.1",
|
|
48
|
-
"@whop/sdk": "0.0.
|
|
48
|
+
"@whop/sdk": "0.0.13",
|
|
49
49
|
"dotenv": "16.5.0",
|
|
50
50
|
"esbuild": "0.25.9",
|
|
51
51
|
"events": "3.3.0",
|