From 8ffdc6a5b1f8c768099f6a6a14fbd552684127e9 Mon Sep 17 00:00:00 2001 From: "soroush.asadi" Date: Fri, 12 Jun 2026 14:56:32 +0330 Subject: [PATCH] iap: per-release payment flavors (web=ZarinPal, bazaar, myket) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Payment provider is baked at build time via NEXT_PUBLIC_STORE and selected by storeBilling.getStore(). Add cross-env + flavor build scripts: npm run build:web | build:bazaar | build:myket # web bundle per flavor npm run cap:bazaar | cap:myket # build flavor + cap sync npm run aab:bazaar | aab:myket # signed AAB (bundleRelease) npm run apk:bazaar | apk:myket # release APK (assembleRelease) web → ZarinPal gateway, bazaar → Cafe Bazaar IAB (deep-link), myket → Myket IAB (native bridge). A plain native build with no flavor still falls back to bazaar. Co-Authored-By: Claude Opus 4.8 --- package-lock.json | 26 ++++++++++++++++++++++++++ package.json | 12 +++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index a9f3eba..4370cec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,6 +29,7 @@ "@types/node": "^20", "@types/react": "^19", "@types/react-dom": "^19", + "cross-env": "^10.1.0", "eslint": "^9", "eslint-config-next": "16.2.7", "playwright": "^1.60.0", @@ -396,6 +397,13 @@ "tslib": "^2.4.0" } }, + "node_modules/@epic-web/invariant": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@epic-web/invariant/-/invariant-1.0.0.tgz", + "integrity": "sha512-lrTPqgvfFQtR/eY/qkIzp98OGdNJu0m5ji3q/nJI8v3SXkRKEnWiOxMmbvcSoAIzv/cGiuvRy57k4suKQSAdwA==", + "dev": true, + "license": "MIT" + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.9.1", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz", @@ -3144,6 +3152,24 @@ "dev": true, "license": "MIT" }, + "node_modules/cross-env": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-10.1.0.tgz", + "integrity": "sha512-GsYosgnACZTADcmEyJctkJIoqAhHjttw7RsFrVoJNXbsWWqaq6Ym+7kZjq6mS45O0jij6vtiReppKQEtqWy6Dw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@epic-web/invariant": "^1.0.0", + "cross-spawn": "^7.0.6" + }, + "bin": { + "cross-env": "dist/bin/cross-env.js", + "cross-env-shell": "dist/bin/cross-env-shell.js" + }, + "engines": { + "node": ">=20" + } + }, "node_modules/cross-spawn": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", diff --git a/package.json b/package.json index ec1e193..68b5e2e 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,18 @@ "build": "next build", "start": "next start", "lint": "eslint", + "build:web": "cross-env NEXT_PUBLIC_STORE=web next build", + "build:bazaar": "cross-env NEXT_PUBLIC_STORE=bazaar next build", + "build:myket": "cross-env NEXT_PUBLIC_STORE=myket next build", "cap:sync": "next build && npx cap sync android", + "cap:bazaar": "npm run build:bazaar && npx cap sync android", + "cap:myket": "npm run build:myket && npx cap sync android", "android:open": "npx cap open android", - "android:apk": "npm run cap:sync && cd android && gradlew.bat assembleDebug" + "android:apk": "npm run cap:sync && cd android && gradlew.bat assembleDebug", + "aab:bazaar": "npm run cap:bazaar && cd android && gradlew.bat bundleRelease", + "aab:myket": "npm run cap:myket && cd android && gradlew.bat bundleRelease", + "apk:bazaar": "npm run cap:bazaar && cd android && gradlew.bat assembleRelease", + "apk:myket": "npm run cap:myket && cd android && gradlew.bat assembleRelease" }, "dependencies": { "@capacitor/app": "^8.1.0", @@ -33,6 +42,7 @@ "@types/node": "^20", "@types/react": "^19", "@types/react-dom": "^19", + "cross-env": "^10.1.0", "eslint": "^9", "eslint-config-next": "16.2.7", "playwright": "^1.60.0",