create-disposabl-app 0.20.10 → 0.20.12

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/disposabl.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // ../cli/auth.ts
4
4
  import { lock } from "proper-lockfile";
5
5
  // ../cli/package.json
6
- var version = "0.20.10";
6
+ var version = "0.20.12";
7
7
  var package_default = {
8
8
  name: "@disposabl/cli",
9
9
  version,
package/dist/index.js CHANGED
@@ -1563,7 +1563,7 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
1563
1563
  import { Command, CommanderError } from "commander";
1564
1564
  import * as p2 from "@clack/prompts";
1565
1565
  // package.json
1566
- var version = "0.20.10";
1566
+ var version = "0.20.12";
1567
1567
 
1568
1568
  // ../cli/telemetry.ts
1569
1569
  var import_proper_lockfile2 = __toESM(require_proper_lockfile(), 1);
@@ -68,6 +68,8 @@ bun x "$EAS_CLI" env:pull --environment "$EAS_ENVIRONMENT" --path "$RUNNER_TEMP/
68
68
  bun -e '
69
69
  import {parseEnv} from "node:util";
70
70
  import {appendFileSync, readFileSync} from "node:fs";
71
+ import {productionAnalyticsEnabled} from "./scripts/production-analytics.mjs";
72
+ const effectiveEnv = {...process.env};
71
73
  for (const [key, value] of Object.entries(parseEnv(readFileSync(`${process.env.RUNNER_TEMP}/expo.env`, "utf8")))) {
72
74
  // Web and mobile use the same backend from this deployment.
73
75
  const backend = /^(?:EXPO_PUBLIC_|VITE_)?(CONVEX_(?:URL|SITE_URL))$/.exec(key);
@@ -77,12 +79,13 @@ bun -e '
77
79
  }
78
80
  if (/^(GITHUB_|RUNNER_|GH_|DISPOSABL_|ANDROID_|UPDATE_POLICY$|BUN_|CI$|NODE_OPTIONS$|PATH$|HOME$|SOURCE(_PATH)?$|CHANNEL$|PLATFORM$|RELEASE_PREFIX$|MACOS_|EAS_(ENVIRONMENT|CLI)$|EXPO_(TOKEN|PROJECT_ID|OWNER|SLUG|NO_DOTENV)$)/.test(key)) throw new Error(`Reserved EAS variable: ${key}`);
79
81
  if (key === "EXPO_PUBLIC_DISPOSABL_ANALYTICS_ENABLED") continue;
82
+ effectiveEnv[key] = value;
80
83
  const delimiter = crypto.randomUUID();
81
84
  appendFileSync(process.env.GITHUB_ENV, `${key}<<${delimiter}\n${value}\n${delimiter}\n`);
82
85
  }
83
86
  const site = JSON.parse(readFileSync("../web/site.json", "utf8"));
84
87
  const app = JSON.parse(readFileSync("../../disposabl.json", "utf8"));
85
- const enabled = process.env.CHANNEL === "production" && process.env.E2E_TELEMETRY_DISABLED !== "1" && app.features.includes("analytics") && !!(app.productionConvexSiteUrl || site.backendOrigin) && (app.productionConvexSiteUrl || site.backendOrigin) === process.env.CONVEX_SITE_URL;
88
+ const enabled = productionAnalyticsEnabled(process.env, app, site) && productionAnalyticsEnabled(effectiveEnv, app, site);
86
89
  appendFileSync(process.env.GITHUB_ENV, `EXPO_PUBLIC_DISPOSABL_ANALYTICS_ENABLED=${enabled}\n`);
87
90
  '
88
91
  ;;
@@ -0,0 +1,21 @@
1
+ // The product serves its Convex HTTP routes on the canonical site domain.
2
+ export function productionAnalyticsEnabled(env, app, site) {
3
+ const product = env.GH_REPO === "disposabl-dev/create-disposabl-app";
4
+ const backend = app.productionConvexSiteUrl || site.backendOrigin;
5
+ const matchesBackend = !!backend && backend === env.CONVEX_SITE_URL;
6
+ const matchesProductDomain =
7
+ product &&
8
+ !app.productionConvexSiteUrl &&
9
+ !!site.origin &&
10
+ site.origin === env.CONVEX_SITE_URL;
11
+ return (
12
+ env.GITHUB_ACTIONS === "true" &&
13
+ env.GITHUB_EVENT_NAME === "push" &&
14
+ env.GITHUB_REF === "refs/heads/main" &&
15
+ env.CHANNEL === "production" &&
16
+ env.E2E_TELEMETRY_DISABLED !== "1" &&
17
+ env.EXPO_PUBLIC_E2E !== "true" &&
18
+ app.features.includes("analytics") &&
19
+ (matchesBackend || matchesProductDomain)
20
+ );
21
+ }
@@ -1,8 +1,11 @@
1
+ process.env.EXPO_PUBLIC_REVENUECAT_IOS_APP_ID = "fixture-app";
2
+ process.env.EXPO_PUBLIC_REVENUECAT_IOS_TOPUP_PRODUCT = "coins";
1
3
  import { afterEach, expect, mock, test } from "bun:test";
2
4
  import { createElement } from "react";
3
5
  import { act, create } from "react-test-renderer";
4
6
  globalThis.IS_REACT_ACT_ENVIRONMENT = true;
5
7
  const listeners = new Set();
8
+ let topupReady = false;
6
9
  let starts = 0,
7
10
  stops = 0,
8
11
  country = "USA",
@@ -75,8 +78,8 @@ mock.module("../../../packages/disposabl-kit/mobile/billing/paywall", () => ({
75
78
  selectMonthlyOffering: () => ({}),
76
79
  }));
77
80
  mock.module("../../../packages/disposabl-kit/mobile/billing/topup", () => ({
78
- matchingTopupRoute: () => false,
79
- loadTopup: async () => null,
81
+ matchingTopupRoute: () => topupReady,
82
+ loadTopup: async () => (topupReady ? { identifier: "coins" } : null),
80
83
  }));
81
84
  const { useWebCheckout } =
82
85
  await import("../../../packages/disposabl-kit/mobile/billing/web-checkout");
@@ -104,6 +107,7 @@ async function change() {
104
107
  }
105
108
  afterEach(async () => {
106
109
  await act(async () => renderer?.unmount());
110
+ topupReady = false;
107
111
  starts = 0;
108
112
  stops = 0;
109
113
  country = "USA";
@@ -239,3 +243,35 @@ test("a queued callback from a removed subscription is ignored", async () => {
239
243
  queued();
240
244
  expect(changed).not.toHaveBeenCalled();
241
245
  });
246
+
247
+ test("US top-up uses its own handoff purchase selection", async () => {
248
+ topupReady = true;
249
+ await mount();
250
+ expect(result.topupAvailable).toBe(true);
251
+ let opened;
252
+ await act(async () => {
253
+ opened = await result.open("topup");
254
+ });
255
+ expect(opened).toBe(true);
256
+ expect(handoff).toHaveBeenCalledWith({ purchase: "topup" });
257
+ expect(openURL).toHaveBeenCalledWith(link.url);
258
+ expect(result.busy).toBe(false);
259
+ });
260
+
261
+ test("top-up rejects an unannounced non-US storefront before browser open", async () => {
262
+ topupReady = true;
263
+ await mount();
264
+ handoff.mockImplementationOnce(async () => {
265
+ country = "CAN";
266
+ return link;
267
+ });
268
+ let opened;
269
+ await act(async () => {
270
+ opened = await result.open("topup");
271
+ });
272
+ expect(handoff).toHaveBeenCalledTimes(1);
273
+ expect(opened).toBe(false);
274
+ expect(openURL).not.toHaveBeenCalled();
275
+ expect(result.topupAvailable).toBe(false);
276
+ expect(result.busy).toBe(false);
277
+ });
@@ -27,7 +27,16 @@ async function run(
27
27
  const dir = await mkdtemp(join(tmpdir(), "ios-ota-"));
28
28
  try {
29
29
  await mkdir(join(dir, "bin"));
30
- await mkdir(join(dir, "apps/mobile"), { recursive: true });
30
+ await mkdir(join(dir, "apps/mobile/scripts"), { recursive: true });
31
+ await writeFile(
32
+ join(dir, "apps/mobile/scripts/production-analytics.mjs"),
33
+ await readFile(
34
+ resolve(
35
+ import.meta.dirname,
36
+ "../../apps/mobile/scripts/production-analytics.mjs",
37
+ ),
38
+ ),
39
+ );
31
40
  await mkdir(join(dir, "apps/web"), { recursive: true });
32
41
  await writeFile(
33
42
  join(dir, "apps/mobile/eas.json"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-disposabl-app",
3
- "version": "0.20.10",
3
+ "version": "0.20.12",
4
4
  "description": "Create a Disposabl app",
5
5
  "type": "module",
6
6
  "license": "MIT",