your-ai-workflow-firebase-os 1.14.70 → 1.14.71

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.
@@ -9,4 +9,4 @@ export interface ConfirmModalProps {
9
9
  isProcessing?: boolean;
10
10
  disableConfirm?: boolean;
11
11
  }
12
- export declare function ConfirmModal({ isOpen, title, message, confirmText, cancelText, onConfirm, onCancel, isProcessing, disableConfirm }: ConfirmModalProps): import("react/jsx-runtime").JSX.Element;
12
+ export declare function ConfirmModal({ isOpen, title, message, confirmText, cancelText, onConfirm, onCancel, isProcessing, disableConfirm }: ConfirmModalProps): import('react').ReactPortal | null;
@@ -19,6 +19,14 @@ export interface PopupProps {
19
19
  className?: string;
20
20
  children?: ReactNode;
21
21
  }
22
+ /**
23
+ * How many windows are open. A dialog that opens ABOVE one — `<ConfirmModal>`
24
+ * asking before a delete pressed inside a product's window — is already
25
+ * looking at a blurred page, so it tints rather than blurring a second full
26
+ * screen on top of the first. Two stacked `backdrop-blur-xl` layers over a
27
+ * grid of photographs is a frame the phone spends for nothing.
28
+ */
29
+ export declare function popupsOpen(): number;
22
30
  export declare function Popup({ open, onClose, title, sub, size, side, footer, busy, className, children, }: PopupProps): import('react').ReactPortal | null;
23
31
  export declare namespace Popup {
24
32
  var displayName: string;
@@ -8,7 +8,7 @@ export declare const offeredProviders: (settings: AuthMethodsSettings) => AuthMe
8
8
  * a method renamed on the Sign in screen is renamed here too.
9
9
  */
10
10
  export declare const shortWord: (method: AuthMethod) => string;
11
- export declare function SignInButtons({ settings, onSignedIn, disabled, returnTo, onPanelChange, signInHref, }: {
11
+ export declare function SignInButtons({ settings, onSignedIn, disabled, returnTo, onPanelChange, signInHref, sentTo, }: {
12
12
  settings: AuthMethodsSettings;
13
13
  /** Signed in and still on this page — where to now is the page's own business. */
14
14
  onSignedIn: () => void;
@@ -28,6 +28,15 @@ export declare function SignInButtons({ settings, onSignedIn, disabled, returnTo
28
28
  * needs a link to the one that signs in.
29
29
  */
30
30
  signInHref?: string;
31
+ /**
32
+ * An address a sign-in link has ALREADY gone to, before this card was ever
33
+ * drawn — a buyer sent here by View your order after paying as a guest
34
+ * (<CheckoutReturn>). The card opens on "Check your email", exactly as it
35
+ * would for somebody who had typed that address into "Email me a link"
36
+ * themselves: same panel, same Send it again, same way back to the buttons.
37
+ * Never the password form, which is a box they may never have had.
38
+ */
39
+ sentTo?: string;
31
40
  }): import("react/jsx-runtime").JSX.Element;
32
41
  /**
33
42
  * Somebody arriving on a link that did not bring their address with it.
@@ -13,7 +13,7 @@ export interface SwatchProps {
13
13
  /** What it is called — "Sand". Read out in place of the hex, and shown on hover. */
14
14
  name?: string;
15
15
  size?: keyof typeof SIZES;
16
- /** The one chosen: a ring in the page's own text colour round it. */
16
+ /** The one chosen: a frame in the page's own text colour, drawn inside the chip. */
17
17
  selected?: boolean;
18
18
  /**
19
19
  * Given, the chip is a button that chooses it; left out, it only shows.
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./chunk-CiTBaPhY.cjs`),t=require(`./verifiedAccount-D3OeaOBo.cjs`),n=require(`./aiModels-BIhoTNH0.cjs`),r=require(`./validate-DNb03HY3.cjs`);let i=require(`node:fs`);i=e.a(i,1);let a=require(`express`);a=e.a(a,1);let o=require(`node:crypto`),s=require(`stripe`);s=e.a(s,1);var c=`https://www.googleapis.com/robot/v1/metadata/x509/securetoken@system.gserviceaccount.com`,l=60;function u(e,t,n,r=Math.floor(Date.now()/1e3)){return n?e.alg===`RS256`?e.kid?t.aud===n?t.iss===`https://securetoken.google.com/${n}`?t.sub?t.sub.length>128?`Token subject is not a valid uid.`:typeof t.exp!=`number`||t.exp<=r?`Token has expired.`:typeof t.iat!=`number`||t.iat>r+l?`Token was issued in the future.`:null:`Token has no subject.`:`Token has the wrong issuer.`:`Token was issued for a different Firebase project.`:`Token has no key id.`:`Token is not signed with RS256.`:`The server does not know its Firebase project id.`}function d(e){return Buffer.from(e.replace(/-/g,`+`).replace(/_/g,`/`),`base64`)}function f(e){let t=String(e||``).split(`.`);if(t.length!==3)return null;try{return{header:JSON.parse(d(t[0]).toString(`utf8`)),claims:JSON.parse(d(t[1]).toString(`utf8`)),signed:`${t[0]}.${t[1]}`,signature:d(t[2])}}catch{return null}}var p=null;async function m(){if(p&&p.expiresAt>Date.now())return p.keys;let e=await fetch(c);if(!e.ok)throw Error(`Could not fetch Google signing keys (${e.status}).`);let t=await e.json(),n=/max-age=(\d+)/.exec(e.headers.get(`cache-control`)||``);return p={keys:t,expiresAt:Date.now()+(n?Number(n[1]):3600)*1e3},t}async function h(e,t){let n=f(e);if(!n)throw Error(`That is not a valid sign-in token.`);let r=u(n.header,n.claims,t);if(r)throw Error(r);let i=(await m())[n.header.kid];if(!i)throw Error(`Token was signed with a key Google no longer publishes.`);let a=(0,o.createVerify)(`RSA-SHA256`);if(a.update(n.signed),a.end(),!a.verify(i,n.signature))throw Error(`Token signature does not check out.`);return{uid:n.claims.sub,email:n.claims.email||null,emailVerified:!!n.claims.email_verified,signInProvider:n.claims.firebase?.sign_in_provider||null}}function g(){return(process.env.VITE_FIREBASE_PROJECT_ID||process.env.FIREBASE_PROJECT_ID||``).trim()}var _=`https://firestore.googleapis.com/v1`;function v(e){return e==null?null:`stringValue`in e?e.stringValue:`integerValue`in e?Number(e.integerValue):`doubleValue`in e?e.doubleValue:`booleanValue`in e?e.booleanValue:`timestampValue`in e?e.timestampValue:`nullValue`in e?null:`mapValue`in e?y(e.mapValue?.fields||{}):`arrayValue`in e?(e.arrayValue?.values||[]).map(v):null}function y(e){let t={};for(let[n,r]of Object.entries(e||{}))t[n]=v(r);return t}function ee(e,t){let n=`${e}/${t}`.split(`/`);if(n.length%2!=0)return`That is not a document path.`;for(let e of n)if(!e||e===`.`||e===`..`||!/^[A-Za-z0-9_.@~+-]+$/.test(e))return`That is not a document path.`;return null}async function b(e,t,n,r){let i=ee(t,n);if(i)throw Error(i);let a=`${_}/projects/${e}/databases/(default)/documents/${t}/${n}`,o=await fetch(a,{headers:r?{Authorization:`Bearer ${r}`}:{}});if(o.status===404)return null;if(o.status===403)throw Error(`You do not have permission to read that record.`);if(!o.ok)throw Error(`Firestore refused the read (${o.status}).`);return y((await o.json()).fields||{})}async function te(e,t,n){if(!/^[A-Za-z0-9_.@~+-]+$/.test(t)||t===`.`||t===`..`)throw Error(`That is not a collection.`);let r=`${_}/projects/${e}/databases/(default)/documents/${t}?pageSize=300`,i=await fetch(r,{headers:n?{Authorization:`Bearer ${n}`}:{}});if(i.status===403)throw Error(`You do not have permission to read those records.`);if(!i.ok)throw Error(`Firestore refused the read (${i.status}).`);return((await i.json()).documents||[]).map(e=>({id:String(e.name||``).split(`/`).pop()||``,data:y(e.fields||{})}))}var ne=[`email`,`Email`,`emailAddress`,`email_address`,`userEmail`,`contactEmail`,`submitterEmail`];function re(e){for(let t of ne){let n=e[t];if(typeof n==`string`&&n.includes(`@`))return n.trim()}return null}var ie=4320*60*1e3,ae=new Set([`user`,`users`,`free`,`guest`,`guests`,`internal`,`admin`,`admins`,`public`,`owner`,`team`,`member`,`members`,`none`,`role`,`roles`]),oe=e=>typeof e==`string`&&/^[a-z][a-z0-9]{1,23}$/.test(e)&&!ae.has(e),se=e=>(0,o.createHmac)(`sha256`,e).update(`your-ai-firebase plan roles v1`).digest(`hex`),ce=(e,t,n,r)=>(0,o.createHash)(`sha256`).update(`${e}:${t}:${n}:${r}`).digest(`hex`);function le(e){let t=new Map;for(let n of e){let e=Array.isArray(n?.plans)?n.plans:[];for(let n of e){let e=String(n?.roleId||``);if(oe(e))for(let r of[n?.monthly,n?.yearly])for(let n of[r?.priceId,r?.livePriceId]){let r=String(n||``).trim();r&&t.set(r,e)}}}return t}var ue=e=>le(e).size>0;function de(e,t,n){let r=null;for(let i of e){if(!i.active||!i.priceId)continue;let e=t.get(i.priceId);if(!e)continue;let a=typeof i.currentPeriodEnd==`number`?i.currentPeriodEnd*1e3:n,o=Math.round(Math.max(a,n)+ie);(!r||o>r.until)&&(r={role:e,until:o})}return r}var fe=`https://api.resend.com/emails`;function pe(){return(process.env.RESEND_API_KEY||``).trim()}function x(){return(process.env.EMAIL_FROM||``).trim()||`onboarding@resend.dev`}function me(){return(process.env.EMAIL_REPLY_TO||``).trim()||void 0}function S(){return(process.env.VITE_ADMIN_EMAILS||process.env.ADMIN_EMAILS||``).split(/[,\s]+/).map(e=>e.trim().toLowerCase()).filter(e=>e.includes(`@`))}var he={appName:``,logoUrl:``,appUrl:``,accent:`#7c3aed`,foreground:`#1e1b4b`,buttonText:``,buttonGradient:[],panelBg:``,panelBorder:``};function C(e,t){let n=String(e??``).trim();return/^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(n)?n:t}function ge(e){let t=String(e??``).trim();return t.length>2e3||/[\s"'<>]/.test(t)?``:/^https?:\/\/[^/]+/i.test(t)?t:``}function _e(e){return String(e??``).replace(/[\r\n\t<>]/g,` `).replace(/\s+/g,` `).trim().slice(0,60)}function ve(e){let t=e&&typeof e==`object`?e:{},n=Array.isArray(t.buttonGradient)?t.buttonGradient.map(e=>C(e,``)).filter(Boolean).slice(0,2):[];return{appName:_e(t.appName),logoUrl:ge(t.logoUrl),appUrl:ge(t.appUrl),accent:C(t.accent,he.accent),foreground:C(t.foreground,he.foreground),buttonText:C(t.buttonText,``),buttonGradient:n,panelBg:C(t.panelBg,``),panelBorder:C(t.panelBorder,``)}}function ye(e){let t=e.replace(`#`,``);if(t.length===3&&(t=t.split(``).map(e=>e+e).join(``)),t.length<6)return null;let n=parseInt(t.slice(0,6),16);return Number.isNaN(n)?null:[n>>16&255,n>>8&255,n&255]}function be(e,t,n=[255,255,255]){let r=ye(e);return r?`#`+r.map((e,r)=>Math.round(e+(n[r]-e)*t)).map(e=>e.toString(16).padStart(2,`0`)).join(``):e}function xe(e){let t=ye(e);return t?(.299*t[0]+.587*t[1]+.114*t[2])/255:1}function Se(e,t=`#1f2937`,n=`#ffffff`){return xe(e)>.6?t:n}function Ce(e){let t=e.accent,n=xe(e.foreground)>.55?he.foreground:e.foreground,r=e.buttonGradient[0]||be(t,.22,[0,0,0]),i=e.buttonGradient[1]||(e.buttonGradient[0]?e.buttonGradient[0]:t),a=e.panelBg||be(t,.94);return{accent:t,text:n,muted:`#6b7280`,faint:`#9ca3af`,g0:r,g1:i,btnFg:e.buttonText||Se(r),panelBg:a,panelBorder:e.panelBorder||(e.panelBg?be(e.panelBg,.12,[0,0,0]):be(t,.84)),hr:be(t,.88)}}var w={test:{audience:`admins`,look:`notification`,kicker:`Test`,subject:`Test email from {{appName}}`,title:`{{appName}} can send email`,opener:`{{appName}} can send email`,body:`This is a test. If you are reading it, the connection works and every email your app sends will look like this one.
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./chunk-CiTBaPhY.cjs`),t=require(`./verifiedAccount-D3OeaOBo.cjs`),n=require(`./aiModels-BIhoTNH0.cjs`),r=require(`./validate-L8QWFfBP.cjs`);let i=require(`node:fs`);i=e.a(i,1);let a=require(`express`);a=e.a(a,1);let o=require(`node:crypto`),s=require(`stripe`);s=e.a(s,1);var c=`https://www.googleapis.com/robot/v1/metadata/x509/securetoken@system.gserviceaccount.com`,l=60;function u(e,t,n,r=Math.floor(Date.now()/1e3)){return n?e.alg===`RS256`?e.kid?t.aud===n?t.iss===`https://securetoken.google.com/${n}`?t.sub?t.sub.length>128?`Token subject is not a valid uid.`:typeof t.exp!=`number`||t.exp<=r?`Token has expired.`:typeof t.iat!=`number`||t.iat>r+l?`Token was issued in the future.`:null:`Token has no subject.`:`Token has the wrong issuer.`:`Token was issued for a different Firebase project.`:`Token has no key id.`:`Token is not signed with RS256.`:`The server does not know its Firebase project id.`}function d(e){return Buffer.from(e.replace(/-/g,`+`).replace(/_/g,`/`),`base64`)}function f(e){let t=String(e||``).split(`.`);if(t.length!==3)return null;try{return{header:JSON.parse(d(t[0]).toString(`utf8`)),claims:JSON.parse(d(t[1]).toString(`utf8`)),signed:`${t[0]}.${t[1]}`,signature:d(t[2])}}catch{return null}}var p=null;async function m(){if(p&&p.expiresAt>Date.now())return p.keys;let e=await fetch(c);if(!e.ok)throw Error(`Could not fetch Google signing keys (${e.status}).`);let t=await e.json(),n=/max-age=(\d+)/.exec(e.headers.get(`cache-control`)||``);return p={keys:t,expiresAt:Date.now()+(n?Number(n[1]):3600)*1e3},t}async function h(e,t){let n=f(e);if(!n)throw Error(`That is not a valid sign-in token.`);let r=u(n.header,n.claims,t);if(r)throw Error(r);let i=(await m())[n.header.kid];if(!i)throw Error(`Token was signed with a key Google no longer publishes.`);let a=(0,o.createVerify)(`RSA-SHA256`);if(a.update(n.signed),a.end(),!a.verify(i,n.signature))throw Error(`Token signature does not check out.`);return{uid:n.claims.sub,email:n.claims.email||null,emailVerified:!!n.claims.email_verified,signInProvider:n.claims.firebase?.sign_in_provider||null}}function g(){return(process.env.VITE_FIREBASE_PROJECT_ID||process.env.FIREBASE_PROJECT_ID||``).trim()}var _=`https://firestore.googleapis.com/v1`;function v(e){return e==null?null:`stringValue`in e?e.stringValue:`integerValue`in e?Number(e.integerValue):`doubleValue`in e?e.doubleValue:`booleanValue`in e?e.booleanValue:`timestampValue`in e?e.timestampValue:`nullValue`in e?null:`mapValue`in e?y(e.mapValue?.fields||{}):`arrayValue`in e?(e.arrayValue?.values||[]).map(v):null}function y(e){let t={};for(let[n,r]of Object.entries(e||{}))t[n]=v(r);return t}function ee(e,t){let n=`${e}/${t}`.split(`/`);if(n.length%2!=0)return`That is not a document path.`;for(let e of n)if(!e||e===`.`||e===`..`||!/^[A-Za-z0-9_.@~+-]+$/.test(e))return`That is not a document path.`;return null}async function b(e,t,n,r){let i=ee(t,n);if(i)throw Error(i);let a=`${_}/projects/${e}/databases/(default)/documents/${t}/${n}`,o=await fetch(a,{headers:r?{Authorization:`Bearer ${r}`}:{}});if(o.status===404)return null;if(o.status===403)throw Error(`You do not have permission to read that record.`);if(!o.ok)throw Error(`Firestore refused the read (${o.status}).`);return y((await o.json()).fields||{})}async function te(e,t,n){if(!/^[A-Za-z0-9_.@~+-]+$/.test(t)||t===`.`||t===`..`)throw Error(`That is not a collection.`);let r=`${_}/projects/${e}/databases/(default)/documents/${t}?pageSize=300`,i=await fetch(r,{headers:n?{Authorization:`Bearer ${n}`}:{}});if(i.status===403)throw Error(`You do not have permission to read those records.`);if(!i.ok)throw Error(`Firestore refused the read (${i.status}).`);return((await i.json()).documents||[]).map(e=>({id:String(e.name||``).split(`/`).pop()||``,data:y(e.fields||{})}))}var ne=[`email`,`Email`,`emailAddress`,`email_address`,`userEmail`,`contactEmail`,`submitterEmail`];function re(e){for(let t of ne){let n=e[t];if(typeof n==`string`&&n.includes(`@`))return n.trim()}return null}var ie=4320*60*1e3,ae=new Set([`user`,`users`,`free`,`guest`,`guests`,`internal`,`admin`,`admins`,`public`,`owner`,`team`,`member`,`members`,`none`,`role`,`roles`]),oe=e=>typeof e==`string`&&/^[a-z][a-z0-9]{1,23}$/.test(e)&&!ae.has(e),se=e=>(0,o.createHmac)(`sha256`,e).update(`your-ai-firebase plan roles v1`).digest(`hex`),ce=(e,t,n,r)=>(0,o.createHash)(`sha256`).update(`${e}:${t}:${n}:${r}`).digest(`hex`);function le(e){let t=new Map;for(let n of e){let e=Array.isArray(n?.plans)?n.plans:[];for(let n of e){let e=String(n?.roleId||``);if(oe(e))for(let r of[n?.monthly,n?.yearly])for(let n of[r?.priceId,r?.livePriceId]){let r=String(n||``).trim();r&&t.set(r,e)}}}return t}var ue=e=>le(e).size>0;function de(e,t,n){let r=null;for(let i of e){if(!i.active||!i.priceId)continue;let e=t.get(i.priceId);if(!e)continue;let a=typeof i.currentPeriodEnd==`number`?i.currentPeriodEnd*1e3:n,o=Math.round(Math.max(a,n)+ie);(!r||o>r.until)&&(r={role:e,until:o})}return r}var fe=`https://api.resend.com/emails`;function pe(){return(process.env.RESEND_API_KEY||``).trim()}function x(){return(process.env.EMAIL_FROM||``).trim()||`onboarding@resend.dev`}function me(){return(process.env.EMAIL_REPLY_TO||``).trim()||void 0}function S(){return(process.env.VITE_ADMIN_EMAILS||process.env.ADMIN_EMAILS||``).split(/[,\s]+/).map(e=>e.trim().toLowerCase()).filter(e=>e.includes(`@`))}var he={appName:``,logoUrl:``,appUrl:``,accent:`#7c3aed`,foreground:`#1e1b4b`,buttonText:``,buttonGradient:[],panelBg:``,panelBorder:``};function C(e,t){let n=String(e??``).trim();return/^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(n)?n:t}function ge(e){let t=String(e??``).trim();return t.length>2e3||/[\s"'<>]/.test(t)?``:/^https?:\/\/[^/]+/i.test(t)?t:``}function _e(e){return String(e??``).replace(/[\r\n\t<>]/g,` `).replace(/\s+/g,` `).trim().slice(0,60)}function ve(e){let t=e&&typeof e==`object`?e:{},n=Array.isArray(t.buttonGradient)?t.buttonGradient.map(e=>C(e,``)).filter(Boolean).slice(0,2):[];return{appName:_e(t.appName),logoUrl:ge(t.logoUrl),appUrl:ge(t.appUrl),accent:C(t.accent,he.accent),foreground:C(t.foreground,he.foreground),buttonText:C(t.buttonText,``),buttonGradient:n,panelBg:C(t.panelBg,``),panelBorder:C(t.panelBorder,``)}}function ye(e){let t=e.replace(`#`,``);if(t.length===3&&(t=t.split(``).map(e=>e+e).join(``)),t.length<6)return null;let n=parseInt(t.slice(0,6),16);return Number.isNaN(n)?null:[n>>16&255,n>>8&255,n&255]}function be(e,t,n=[255,255,255]){let r=ye(e);return r?`#`+r.map((e,r)=>Math.round(e+(n[r]-e)*t)).map(e=>e.toString(16).padStart(2,`0`)).join(``):e}function xe(e){let t=ye(e);return t?(.299*t[0]+.587*t[1]+.114*t[2])/255:1}function Se(e,t=`#1f2937`,n=`#ffffff`){return xe(e)>.6?t:n}function Ce(e){let t=e.accent,n=xe(e.foreground)>.55?he.foreground:e.foreground,r=e.buttonGradient[0]||be(t,.22,[0,0,0]),i=e.buttonGradient[1]||(e.buttonGradient[0]?e.buttonGradient[0]:t),a=e.panelBg||be(t,.94);return{accent:t,text:n,muted:`#6b7280`,faint:`#9ca3af`,g0:r,g1:i,btnFg:e.buttonText||Se(r),panelBg:a,panelBorder:e.panelBorder||(e.panelBg?be(e.panelBg,.12,[0,0,0]):be(t,.84)),hr:be(t,.88)}}var w={test:{audience:`admins`,look:`notification`,kicker:`Test`,subject:`Test email from {{appName}}`,title:`{{appName}} can send email`,opener:`{{appName}} can send email`,body:`This is a test. If you are reading it, the connection works and every email your app sends will look like this one.
2
2
 
3
3
  Sent {{now}}.`,button:{label:`Open the app`},description:`Proves the connection works. Goes to the admin addresses.`},new_submission:{audience:`admins`,look:`notification`,kicker:`New form entry`,subject:`New {{formName}} submission`,title:`Someone filled in {{formName}}`,opener:`Someone filled in {{formName}}`,body:`{{summary}}`,facts:[[`Name`,`{{name}}`],[`Email`,`{{email}}`]],button:{label:`Open the inbox`,path:`/inbox`},description:`Lets you know someone filled in a form.`},submission_received:{audience:`record`,look:`text`,kicker:`Received`,subject:`We got your message`,title:`We got your message`,greeting:`Hi {{name}},`,body:`Thanks for getting in touch — we have your message and will come back to you shortly.
4
4
 
package/dist/server.es.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { S as e, c as t, h as n, t as r, u as i, w as a } from "./verifiedAccount-C1iCxopN.js";
2
2
  import { a as o, c as s, i as c, l, m as u, n as d, o as f, r as p, s as m, t as h, u as g } from "./aiModels-BHlEfuRJ.js";
3
- import { _, a as v, i as ee, p as te } from "./validate-BVDrQbzQ.js";
3
+ import { _, a as v, i as ee, p as te } from "./validate-C_iJKXDU.js";
4
4
  import * as ne from "node:fs";
5
5
  import y from "express";
6
6
  import { createHash as re, createHmac as ie, createVerify as ae } from "node:crypto";