bardd commited on
Commit
ecc5938
·
verified ·
1 Parent(s): 1e2c2ab

Deploy centerpay from octopus 62074071bceb

Browse files
DEPLOYMENT.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "source_repository": "farooquiowais/octopus",
3
- "github_commit": "39d63b6b28d64e3c9fa6e6ff27b22cee60d96bc2",
4
  "application": "centerpay",
5
  "files_sha256": {
6
  ".dockerignore": "2264c690ac1993f996cf38bbe8172ddad0a85977c9c0cd2a09a69ddfb0836ea2",
@@ -9,7 +9,8 @@
9
  "frontend/index.html": "d73cf835245a6d692323af1819af73ab20420d1776a07c411febdaee813787b4",
10
  "frontend/package-lock.json": "56414a2f225cff47fdd816abfc08e79272527d7bf72d4cccdbabb1c6deaea635",
11
  "frontend/package.json": "719c178e420b1fc4761893acb71e13eefed470bc35b913e20b99dad494930d08",
12
- "frontend/src/main.tsx": "df1d8707d318b1f58b3165e29b94df707c0b68150aae20b5f40cd16b0d0d317a",
 
13
  "frontend/src/styles.css": "e860cb6b4b37a7cd0adf0faeadebc199f9dbd3a065ccfd2455b2b657fc743572",
14
  "frontend/tsconfig.json": "cca3a7580f929ded28022c4115cf3cd0cbd90480f4784765128e54688b5dd75c",
15
  "frontend/vite.config.ts": "938abbdb4c4edd28c5d37ac83418cb27130a23ace301ff6679ac258369895c1c",
 
1
  {
2
  "source_repository": "farooquiowais/octopus",
3
+ "github_commit": "62074071bceb9a1fb97c97c13a36569f9fd8b4da",
4
  "application": "centerpay",
5
  "files_sha256": {
6
  ".dockerignore": "2264c690ac1993f996cf38bbe8172ddad0a85977c9c0cd2a09a69ddfb0836ea2",
 
9
  "frontend/index.html": "d73cf835245a6d692323af1819af73ab20420d1776a07c411febdaee813787b4",
10
  "frontend/package-lock.json": "56414a2f225cff47fdd816abfc08e79272527d7bf72d4cccdbabb1c6deaea635",
11
  "frontend/package.json": "719c178e420b1fc4761893acb71e13eefed470bc35b913e20b99dad494930d08",
12
+ "frontend/src/attribution.ts": "fa55ad4a5a5e09abf1e3d78566c261f1ecd8d2b3ec3800bde756bd410fdc38ab",
13
+ "frontend/src/main.tsx": "1a10e26c351f00404b0af53d0e76b43be8ab8cd784d50d510399cfbb70aebda9",
14
  "frontend/src/styles.css": "e860cb6b4b37a7cd0adf0faeadebc199f9dbd3a065ccfd2455b2b657fc743572",
15
  "frontend/tsconfig.json": "cca3a7580f929ded28022c4115cf3cd0cbd90480f4784765128e54688b5dd75c",
16
  "frontend/vite.config.ts": "938abbdb4c4edd28c5d37ac83418cb27130a23ace301ff6679ac258369895c1c",
frontend/src/attribution.ts ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /** Capture acquisition facts without saving verification or rehearsal capabilities. */
2
+ export function acquisitionAttribution(location: Location, referrer: string) {
3
+ const current = new URL(location.href);
4
+ const landing = new URL(current.origin + current.pathname);
5
+ for (const key of ['utm_source', 'utm_campaign', 'utm_medium', 'utm_content', 'utm_term', 'source', 'campaign']) {
6
+ const value = current.searchParams.get(key);
7
+ if (value) landing.searchParams.set(key, value);
8
+ }
9
+ return {
10
+ source: (current.searchParams.get('utm_source') || current.searchParams.get('source') || '').slice(0, 240) || null,
11
+ campaign: (current.searchParams.get('utm_campaign') || current.searchParams.get('campaign') || '').slice(0, 240) || null,
12
+ referrer: referrer.slice(0, 2048) || null,
13
+ landing_page: landing.href.slice(0, 2048),
14
+ };
15
+ }
frontend/src/main.tsx CHANGED
@@ -2,6 +2,7 @@ import {useEffect, useRef, useState} from 'react';
2
  import type {FormEvent, ReactNode} from 'react';
3
  import {createRoot} from 'react-dom/client';
4
  import './styles.css';
 
5
 
6
  type Provider = {provider_id: string; name: string; services: string[]; countries: string[]};
7
  type Recommendation = Provider & {coverage?: string};
@@ -78,6 +79,7 @@ export default function App() {
78
  return JSON.parse(sessionStorage.getItem('centerpay-rehearsal') || 'null');
79
  } catch { return null; }
80
  });
 
81
  const [form, setForm] = useState(initialForm);
82
  const [busy, setBusy] = useState('');
83
  const [error, setError] = useState('');
@@ -138,6 +140,7 @@ export default function App() {
138
  try {
139
  const result = await call('/api/enquiries', {
140
  ...form,
 
141
  ...(demoContext || {}),
142
  origin: demoContext ? 'demo' : 'genuine',
143
  idempotency_key: submissionKey.current,
 
2
  import type {FormEvent, ReactNode} from 'react';
3
  import {createRoot} from 'react-dom/client';
4
  import './styles.css';
5
+ import {acquisitionAttribution} from './attribution';
6
 
7
  type Provider = {provider_id: string; name: string; services: string[]; countries: string[]};
8
  type Recommendation = Provider & {coverage?: string};
 
79
  return JSON.parse(sessionStorage.getItem('centerpay-rehearsal') || 'null');
80
  } catch { return null; }
81
  });
82
+ const [attribution] = useState(() => acquisitionAttribution(window.location, document.referrer));
83
  const [form, setForm] = useState(initialForm);
84
  const [busy, setBusy] = useState('');
85
  const [error, setError] = useState('');
 
140
  try {
141
  const result = await call('/api/enquiries', {
142
  ...form,
143
+ ...attribution,
144
  ...(demoContext || {}),
145
  origin: demoContext ? 'demo' : 'genuine',
146
  idempotency_key: submissionKey.current,