PageSourceSearch

https://www.thetreeapp.org/business/assets/js/modules/config.js

js thetreeapp.org collected 2026-09-24 11:11:24 UTC 4,108 bytes, 109 lines download raw bytes

1const environments = {
2    prod: {
3        isProd: true,
4        backend_url: "https://b2b-api.thetreeapp.org/v1",
5        stripe_key:
6            "pk_live_51ILnbIH9ShFA6pQw004NJdKbDM6uOSjRZaq4MnUECy6ff6wRJgWszanZmeD4TRnUdE9WUePQJE6sVcWnJ1c1LQfE00GZmvbpDr",
7        turnstile_key: "0x4AAAAAAAzMFm_wTU73GV8c",
8    },
9    // develop = dev API + test keys, for develop/deploy-preview/local hosts.
10    // (formerly named `staging` — renamed since the staging host now uses
11    // `environments.prod`, matching web-lib: staging runs prod data.)
12    develop: {
13        isProd: false,
14        backend_url: "https://b2b-api-staging.thetreeapp.org/v1",
15        stripe_key:
16            "pk_test_51LuBcJIutu1zmpcrOXNPubsYfaC1AFgzlpPXtk8NIYBTu6tHGyKxlbimYB5vJSvgONJkCN6SHdOEH7kgnpBxlvAb00CopK7lg6",
17        turnstile_key: "1x00000000000000000000AA",
18    },
19}
20
21function setEnv() {
22  const hostname = window.location.hostname
23  const rootDomain = hostname.split(".").slice(-2).join(".")
24
25    if (rootDomain === "thetreeapp.org") {
26        return environments.prod;
27    }
28
29    // staging runs prod data on a non-prod URL: prod API + live keys
30    // (matches web-lib's `environments.staging`; stagingGuard.js prompts on
31    // every non-thetreeapp.org host this function routes to prod data).
32    if (hostname.startsWith("staging--")) {
33        return environments.prod
34    }
35
36    if (rootDomain === "localhost" || hostname.startsWith("192.168")) {
37        return environments.develop
38    }
39
40    // Netlify deploy-permalink hosts (a fixed URL for one specific deploy —
41    // used for production and staging deploy previews) look like
42    // `<20+ hex-char deploy-id>--<site>.netlify.app`. These are still built
43    // from a production/staging context, so keep them on prod data.
44    if (/^[0-9a-f]{20,}--/.test(hostname)) {
45        return environments.prod
46    }
47
48    // Any other `<name>--<site>.netlify.app` host is a NAMED branch deploy
49    // (develop--, feat-env--, ...) or a deploy preview (deploy-preview-123--)
50    // — these match web-lib's branch-deploy/deploy-preview contexts, which
51    // both bake PUBLIC_STAGE=develop. No unknown branch host may silently
52    // fall through to prod data + live Stripe, so default to develop here
53    // (and for any other unrecognised host shape).
54    return environments.develop
55}
56const {backend_url, stripe_key, turnstile_key, isProd} = setEnv()
57
58const currencySymbolMap = {'gbp': '£', 'eur': '€', 'usd': '$'}
59const passwordRegex = new RegExp("^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[\\[\\]\!\”\#\$\%\&\'\(\)\*\+\,\-\.\/\:\;\<\=\>\?\@\\\\\^\_\`\{\|\}\~])(?=.{8,})");
60const stripeFormsAppearance = {
61  theme: 'stripe',
62
63  variables: {
64    colorPrimary: '#14A800',
65    colorBackground: '#FFFFFF',
66    colorIcon: '#3D3D3D',
67    colorText: '#3D3D3D',
68    colorTextSecondary: '#3D3D3D',
69    fontFamily: 'Roboto, Open Sans, Segoe UI, sans-serif',
70    fontSizeBase: '15px'
71  },
72
73  rules: {
74    '.Input': {
75      color: '#3D3D3D'
76    },
77    '.TermsText': {
78      color:  '#14A800'
79    },
80    '.Tab:hover': {
81      color: '#3D3D3D'
82    },
83  }
84};
85
86// from https://docs.google.com/spreadsheets/d/1WfOEOm-gQxhT5Vpq5Y1id3lPu2MfvbEdSyCm8XmO4K0/edit#gid=0
87const treeImpact = {
88  'co2_absorbed': 0.109,
89  'workdays_created': 0.01,
90  'land_reforested': 6.67
91}
92
93const transactionTypesMapping = {
94  'direct-deal': 'one-off',
95  'one-off': 'one-off',
96  'monthly-subscription': 'recurring',
97  'usage-based-subscription': 'automatic'
98}
99
100export { backend_url, currencySymbolMap, isProd, passwordRegex, stripe_key, stripeFormsAppearance, transactionTypesMapping, treeImpact, turnstile_key };
101export const ACCESS_TOKEN_NAME = "access_token";
102export const REFRESH_TOKEN_NAME = "refresh_token";
103export const IMPACT_SLUG_NAME = "impact-slug";
104export const LOGGED_IN_NAME = "logged_in";
105// Mirror of IS_LOGGED_IN_KEY in packages/web-lib/src/config/config.ts.
106// Only flips on explicit auth boundaries (login / verifyEmail set;
107// removeTokens clears) — not on silent refresh-token rotation.
108export const IS_LOGGED_IN_KEY = "isLoggedIn";
109export const MONTH_MS = 30 * 24 * 60 * 60 * 1000;

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.