MCPcopy Create free account
hub / github.com/Tron521/codex-console-temp / bindBillingEvents

Function bindBillingEvents

static/js/payment.js:1084–1157  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1082}
1083
1084function bindBillingEvents() {
1085 document.getElementById("parse-billing-btn")?.addEventListener("click", parseSingleBillingText);
1086 document.getElementById("parse-batch-btn")?.addEventListener("click", parseBatchBillingText);
1087 document.getElementById("clear-billing-btn")?.addEventListener("click", clearBillingText);
1088 document.getElementById("save-billing-template-btn")?.addEventListener("click", saveCurrentAsTemplate);
1089 document.getElementById("apply-billing-template-btn")?.addEventListener("click", applySelectedTemplate);
1090 document.getElementById("delete-billing-template-btn")?.addEventListener("click", deleteSelectedTemplate);
1091 document.getElementById("save-batch-template-btn")?.addEventListener("click", saveBatchProfilesAsTemplates);
1092 document.getElementById("billing-template-select")?.addEventListener("change", (event) => {
1093 const selectValue = event?.target?.value || "";
1094 if (!selectValue) {
1095 setInputValue("billing-template-name", "");
1096 return;
1097 }
1098 const selected = getBillingTemplates().find((tpl) => tpl.id === selectValue);
1099 if (selected) {
1100 setInputValue("billing-template-name", selected.name || "");
1101 }
1102 });
1103
1104 document.getElementById("billing-country-input")?.addEventListener("change", () => {
1105 onBillingCountryChanged();
1106 persistBillingProfileNonSensitive();
1107 setRandomBillingHint("");
1108 });
1109
1110 [
1111 "card-number-input",
1112 "card-expiry-input",
1113 "card-cvc-input",
1114 "billing-name-input",
1115 "billing-country-input",
1116 "billing-currency-input",
1117 "billing-line1-input",
1118 "billing-city-input",
1119 "billing-state-input",
1120 "billing-postal-input",
1121 ].forEach((id) => {
1122 const node = document.getElementById(id);
1123 node?.addEventListener("input", debounce(() => {
1124 persistBillingProfileNonSensitive();
1125 resetGenerateLinkButtonState();
1126 }, 200));
1127 node?.addEventListener("change", resetGenerateLinkButtonState);
1128 });
1129
1130 document.getElementById("card-expiry-input")?.addEventListener("input", (event) => {
1131 const el = event.target;
1132 if (!el) return;
1133 const next = normalizeExpiryInputForTyping(el.value);
1134 if (el.value !== next) {
1135 el.value = next;
1136 }
1137 });
1138
1139 document.getElementById("card-number-input")?.addEventListener("input", (event) => {
1140 const el = event.target;
1141 if (!el) return;

Callers 1

payment.jsFile · 0.85

Calls 8

setInputValueFunction · 0.85
getBillingTemplatesFunction · 0.85
onBillingCountryChangedFunction · 0.85
setRandomBillingHintFunction · 0.85
debounceFunction · 0.85

Tested by

no test coverage detected