Initial commit — Performance West telecom compliance platform
Includes: API (Express/TypeScript), Astro site, Python workers, document generators, FCC compliance tools, Canada CRTC formation, Ansible infrastructure, and deployment scripts. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
commit
f8cd37ac8c
1823 changed files with 145167 additions and 0 deletions
99
scripts/workers/fix_campaigns.py
Normal file
99
scripts/workers/fix_campaigns.py
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
import requests, re, time
|
||||
|
||||
URL = "http://localhost:9100"
|
||||
s = requests.Session()
|
||||
s.auth = ("api", "6X1rKPea61N4rZ1S65Hx5zvqzbCj30F6nvEe9oVGH_Y")
|
||||
|
||||
# ── Fix remaining evasion phrases in campaigns 5 and 8 ──────────────────────
|
||||
for cid in [5, 8]:
|
||||
rb = s.get(URL + "/api/campaigns/" + str(cid), timeout=15)
|
||||
full = rb.json()["data"]
|
||||
body = full["body"]
|
||||
|
||||
body = body \
|
||||
.replace("Outside FCC jurisdiction.", "A second carrier identity, under Canadian telecom law.") \
|
||||
.replace("The FCC has no authority over a Canadian corporation.",
|
||||
"Canadian carriers are regulated by the CRTC under Canadian telecom law.") \
|
||||
.replace("Canadian CRTC entity \u2014 separate jurisdiction, clean slate",
|
||||
"Canadian CRTC entity \u2014 a second carrier identity") \
|
||||
.replace("Canadian CRTC entity \u2014 same +1, a separate regulatory framework",
|
||||
"Canadian CRTC entity \u2014 same +1 country code, CRTC-registered")
|
||||
|
||||
s.put(URL + "/api/campaigns/" + str(cid), json={
|
||||
"name": full["name"], "subject": full["subject"],
|
||||
"lists": [li["id"] for li in full.get("lists", [])],
|
||||
"type": full["type"], "content_type": full["content_type"], "body": body,
|
||||
}, timeout=15)
|
||||
print(f"Fixed [{cid}]")
|
||||
time.sleep(0.2)
|
||||
|
||||
# ── Rewrite process walkthrough emails (ISP 6/7 = id 11, CRTC 6/7 = id 17) ──
|
||||
|
||||
WE_HANDLE = (
|
||||
'<h2 style="margin:24px 0 10px;font-family:Arial,sans-serif;font-size:17px;font-weight:700;color:#1a2744;">'
|
||||
'Here is everything we handle.</h2>\n'
|
||||
'<ul style="margin:0 0 16px;padding-left:22px;font-family:Arial,sans-serif;font-size:15px;color:#2d3748;line-height:1.7;">\n'
|
||||
'<li style="margin-bottom:8px;">BC corporation incorporated \u2014 separate legal entity from your US company</li>\n'
|
||||
'<li style="margin-bottom:8px;">CRTC BITS registration filed and confirmed</li>\n'
|
||||
'<li style="margin-bottom:8px;">Canadian DID provisioned and configured</li>\n'
|
||||
'<li style="margin-bottom:8px;">Vancouver virtual registered office established</li>\n'
|
||||
'<li style="margin-bottom:8px;">.ca domain registered under your BC corporation number</li>\n'
|
||||
'<li style="margin-bottom:8px;">Email hosting provisioned \u2014 up to 14 addresses at your .ca domain</li>\n'
|
||||
'<li style="margin-bottom:8px;">Full corporate binder compiled and delivered digitally</li>\n'
|
||||
'<li style="margin-bottom:8px;">Canadian business banking referral sent</li>\n'
|
||||
'</ul>'
|
||||
)
|
||||
|
||||
YOU_DO = (
|
||||
'<h2 style="margin:24px 0 10px;font-family:Arial,sans-serif;font-size:17px;font-weight:700;color:#1a2744;">'
|
||||
'Here is everything you do.</h2>\n'
|
||||
'<ul style="margin:0 0 16px;padding-left:22px;font-family:Arial,sans-serif;font-size:15px;color:#2d3748;line-height:1.7;">\n'
|
||||
'<li style="margin-bottom:8px;">Review and eSign the BC incorporation articles (5 minutes)</li>\n'
|
||||
'<li style="margin-bottom:8px;">Choose your .ca domain via our client portal (5 minutes)</li>\n'
|
||||
'<li style="margin-bottom:8px;">Open your Canadian business bank account (remote, under 5 minutes)</li>\n'
|
||||
'</ul>'
|
||||
)
|
||||
|
||||
for cid in [11, 17]:
|
||||
rb = s.get(URL + "/api/campaigns/" + str(cid), timeout=15)
|
||||
full = rb.json()["data"]
|
||||
body = full["body"]
|
||||
original = body
|
||||
|
||||
# Replace week-by-week "what we handle" section
|
||||
body = re.sub(
|
||||
r'<h2[^>]*>(?:The \d+\u201310 week process|What we handle)[^<]*</h2>.*?</ul>',
|
||||
WE_HANDLE,
|
||||
body, flags=re.DOTALL
|
||||
)
|
||||
# Replace "what you do" section
|
||||
body = re.sub(
|
||||
r'<h2[^>]*>(?:Your time investment[^<]*|What you do)[^<]*</h2>.*?</ul>',
|
||||
YOU_DO,
|
||||
body, flags=re.DOTALL
|
||||
)
|
||||
# Fix header subheadline
|
||||
body = body.replace(
|
||||
"6\u201310 weeks.<br>About 30 minutes of your time.",
|
||||
"We handle everything.<br>About 30 minutes of your time."
|
||||
)
|
||||
# Fix subject
|
||||
new_subject = full["subject"].replace(
|
||||
"What 6\u201310 weeks of Canadian carrier setup actually looks like",
|
||||
"What we do, and what you do"
|
||||
).replace(
|
||||
"What 6 weeks of Canadian carrier setup actually looks like",
|
||||
"What we do, and what you do"
|
||||
)
|
||||
|
||||
s.put(URL + "/api/campaigns/" + str(cid), json={
|
||||
"name": full["name"], "subject": new_subject,
|
||||
"lists": [li["id"] for li in full.get("lists", [])],
|
||||
"type": full["type"], "content_type": full["content_type"], "body": body,
|
||||
}, timeout=15)
|
||||
changed = "changed" if body != original else "no regex match — check manually"
|
||||
print(f"Rewritten [{cid}] {full['name'][:55]} — {changed}")
|
||||
print(f" subject: {new_subject}")
|
||||
time.sleep(0.2)
|
||||
|
||||
print("\nDone.")
|
||||
Loading…
Add table
Add a link
Reference in a new issue