Public Access
Update upsell.html
This commit is contained in:
1 parent
62f92769a1
commit
575e3efece
1 file changed
+7
-4
+7
-4
@@ -390,7 +390,7 @@
|
|||||||
const currentIdx = PLAN_ORDER.indexOf(contractName);
|
const currentIdx = PLAN_ORDER.indexOf(contractName);
|
||||||
if (currentIdx === -1) return; // unknown plan – leave defaults
|
if (currentIdx === -1) return; // unknown plan – leave defaults
|
||||||
|
|
||||||
const badgeLabel = expires ? "✅ " + expires : "✅";
|
const badgeLabel = expires ? "✅ Expires " + expires : "✅";
|
||||||
|
|
||||||
PLAN_ORDER.forEach(function (plan, idx) {
|
PLAN_ORDER.forEach(function (plan, idx) {
|
||||||
var meta = PLAN_META[plan];
|
var meta = PLAN_META[plan];
|
||||||
@@ -432,12 +432,15 @@
|
|||||||
if (!res.ok) throw new Error("HTTP " + res.status);
|
if (!res.ok) throw new Error("HTTP " + res.status);
|
||||||
|
|
||||||
const payload = await res.json();
|
const payload = await res.json();
|
||||||
// Webhook returns: [{ "expires": "YYYY-MM-DD", "contractName": "Trial" }]
|
// Webhook returns: { "expires": "YYYY-MM-DD", "contractName": "Trial" }
|
||||||
|
// (tolerate an array wrapper and snake_case keys as well)
|
||||||
const record = Array.isArray(payload)
|
const record = Array.isArray(payload)
|
||||||
? payload[0]
|
? payload[0]
|
||||||
: payload;
|
: payload;
|
||||||
if (record && record.contract_name) {
|
const contractName =
|
||||||
applyPlanState(record.contract_name, record.expires);
|
record && (record.contractName || record.contract_name);
|
||||||
|
if (contractName) {
|
||||||
|
applyPlanState(contractName, record.expires);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Could not load contract data:", err);
|
console.error("Could not load contract data:", err);
|
||||||
|
|||||||
Reference in new issue
Block a user