clawfire 0.6.12 → 0.6.14

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/dev.js CHANGED
@@ -1830,6 +1830,24 @@ function generateDashboardHtml(options) {
1830
1830
  <div style="font-size:11px;color:#a3a3a3;margin-bottom:4px;">Live URL</div>
1831
1831
  <a id="deploy-hosting-link" href="#" target="_blank" style="color:#22c55e;font-family:monospace;font-size:14px;text-decoration:none;word-break:break-all;"></a>
1832
1832
  </div>
1833
+ <div id="deploy-billing-note" style="display:none;margin-top:10px;padding:14px;border-radius:8px;background:#1a1400;border:1px solid #f59e0b;">
1834
+ <div style="display:flex;align-items:center;gap:6px;margin-bottom:8px;">
1835
+ <span style="font-size:16px;">&#9888;&#65039;</span>
1836
+ <span style="font-weight:700;color:#fbbf24;font-size:14px;">Blaze Plan Required for API</span>
1837
+ </div>
1838
+ <div style="font-size:13px;color:#d4d4d4;line-height:1.6;">
1839
+ <div style="margin-bottom:6px;"><strong style="color:#fbbf24;">Current Plan:</strong> <span style="color:#ef4444;">Spark (Free)</span></div>
1840
+ <div style="margin-bottom:6px;"><strong style="color:#fbbf24;">Required Plan:</strong> <span style="color:#22c55e;">Blaze (Pay-as-you-go)</span></div>
1841
+ <div style="margin-bottom:10px;color:#a3a3a3;font-size:12px;">
1842
+ Static pages (HTML/CSS/JS) are deployed and working.<br>
1843
+ API routes (<code style="background:#2a2a2a;padding:2px 6px;border-radius:3px;color:#f97316;">/api/*</code>) require Cloud Functions, which need the Blaze plan.<br>
1844
+ Blaze plan has a generous free tier \u2014 you only pay for actual usage beyond free limits.
1845
+ </div>
1846
+ <a id="deploy-upgrade-link" href="#" target="_blank" style="display:inline-block;padding:8px 16px;background:#f59e0b;color:#000;border-radius:6px;font-size:13px;font-weight:700;text-decoration:none;">
1847
+ Upgrade to Blaze Plan &#8594;
1848
+ </a>
1849
+ </div>
1850
+ </div>
1833
1851
  </div>
1834
1852
  </div>
1835
1853
  </div>
@@ -2716,6 +2734,9 @@ function generateDashboardHtml(options) {
2716
2734
  status.style.cssText = 'display:block;margin-top:10px;font-size:13px;padding:10px 14px;border-radius:6px;background:#0a0a1a;border:1px solid #3b82f6;color:#3b82f6;';
2717
2735
  urlBox.style.display = 'none';
2718
2736
 
2737
+ var billingNote = document.getElementById('deploy-billing-note');
2738
+ billingNote.style.display = 'none';
2739
+
2719
2740
  fetch(API + '/__dev/deploy/hosting', { method: 'POST' })
2720
2741
  .then(function(r) { return r.json(); })
2721
2742
  .then(function(data) {
@@ -2728,9 +2749,22 @@ function generateDashboardHtml(options) {
2728
2749
  link.textContent = data.url;
2729
2750
  urlBox.style.display = 'block';
2730
2751
  }
2752
+ // Show Blaze plan notice if needed
2753
+ if (data.blazeRequired) {
2754
+ billingNote.style.display = 'block';
2755
+ if (data.upgradeUrl) {
2756
+ var upgradeLink = document.getElementById('deploy-upgrade-link');
2757
+ upgradeLink.href = data.upgradeUrl;
2758
+ }
2759
+ }
2731
2760
  } else {
2732
2761
  status.textContent = data.message;
2733
2762
  status.style.cssText = 'display:block;margin-top:10px;font-size:13px;padding:10px 14px;border-radius:6px;background:#1c0808;border:1px solid #ef4444;color:#ef4444;';
2763
+ // Check if error is about billing \u2014 show upgrade notice
2764
+ var errMsg = (data.message || '').toLowerCase();
2765
+ if (errMsg.indexOf('blaze') >= 0 || errMsg.indexOf('pay-as-you-go') >= 0 || errMsg.indexOf('upgrade') >= 0 || errMsg.indexOf('artifactregistry') >= 0) {
2766
+ billingNote.style.display = 'block';
2767
+ }
2734
2768
  }
2735
2769
  btn.disabled = false;
2736
2770
  btn.textContent = 'Deploy Hosting';
@@ -4978,14 +5012,57 @@ ${liveReloadScript}
4978
5012
  steps.push("Functions build failed \u2014 hosting only");
4979
5013
  }
4980
5014
  }
4981
- const targets = deployFunctions ? "hosting,functions" : "hosting";
4982
- console.log(` Deploying ${targets}...`);
4983
- const result = await this.firebaseSetup.deployHosting(targets);
5015
+ console.log(" Deploying hosting...");
5016
+ const hostingResult = await this.firebaseSetup.deployHosting("hosting");
5017
+ if (!hostingResult.success) {
5018
+ clearFirebaseStatusCache();
5019
+ sendJson({
5020
+ ...hostingResult,
5021
+ message: hostingResult.message + (steps.length > 0 ? ` (${steps.join(", ")})` : "")
5022
+ });
5023
+ return;
5024
+ }
5025
+ steps.push("Hosting deployed");
5026
+ let blazeRequired = false;
5027
+ let projectId = "";
5028
+ if (deployFunctions) {
5029
+ console.log(" Deploying functions...");
5030
+ const funcResult = await this.firebaseSetup.deployHosting("functions");
5031
+ if (funcResult.success) {
5032
+ console.log(` \x1B[32m\u2713\x1B[0m Functions deployed`);
5033
+ steps.push("Functions deployed");
5034
+ } else {
5035
+ const msg = funcResult.message.toLowerCase();
5036
+ if (msg.includes("blaze") || msg.includes("pay-as-you-go") || msg.includes("upgrade") || msg.includes("billing") || msg.includes("artifactregistry")) {
5037
+ blazeRequired = true;
5038
+ const state = this.firebaseSetup.loadState();
5039
+ projectId = state.projectId || firebaseConfig.projectId || "";
5040
+ console.log(" \x1B[33m\u26A0\x1B[0m Functions require Blaze (pay-as-you-go) plan");
5041
+ steps.push("Functions skipped (Blaze plan required)");
5042
+ } else {
5043
+ console.log(` \x1B[31m\u2717\x1B[0m Functions deploy failed: ${funcResult.message}`);
5044
+ steps.push("Functions deploy failed");
5045
+ }
5046
+ }
5047
+ }
4984
5048
  clearFirebaseStatusCache();
4985
- sendJson({
4986
- ...result,
4987
- message: result.message + (steps.length > 0 ? ` (${steps.join(", ")})` : "")
4988
- });
5049
+ const stepsStr = steps.length > 0 ? ` (${steps.join(", ")})` : "";
5050
+ if (blazeRequired) {
5051
+ const upgradeUrl = projectId ? `https://console.firebase.google.com/project/${projectId}/usage/details` : "https://console.firebase.google.com";
5052
+ sendJson({
5053
+ success: true,
5054
+ url: hostingResult.url,
5055
+ blazeRequired: true,
5056
+ upgradeUrl,
5057
+ message: `Hosting deployed successfully!${stepsStr}`,
5058
+ billingNote: `Static pages are live, but API routes (/api/*) require Cloud Functions which need the Blaze (pay-as-you-go) plan. Upgrade at: ${upgradeUrl}`
5059
+ });
5060
+ } else {
5061
+ sendJson({
5062
+ ...hostingResult,
5063
+ message: hostingResult.message + stepsStr
5064
+ });
5065
+ }
4989
5066
  } catch (err) {
4990
5067
  sendJson({ success: false, message: err instanceof Error ? err.message : "Failed" }, 500);
4991
5068
  }