Google analytics integration.

Sentry.io integration.
Vince integration.
Region-scoped consent (denied-by-default in EU/EEA/UK/CH, granted elsewhere, DPDP-friendly notice)
This commit is contained in:
2026-09-06 16:03:13 +00:00
parent 43c6fbe437
commit e0eb577e3e
37 changed files with 2059 additions and 274 deletions
+38 -16
View File
@@ -518,19 +518,29 @@ async function main() {
// one-off migration: gifting tab CTAs must keep users on mozimo.in,
// never bounce them out to the shopify domain
if (name === "gifting_tabs") {
const all = await authed(`/api/collections/${name}/records?perPage=100`);
const all = await authed(
`/api/collections/${name}/records?perPage=100`,
);
for (const rec of all.body.items ?? []) {
const url = rec.cta_url ?? "";
if (url.startsWith("https://shop.mozimo.in/")) {
const internal = url.replace("https://shop.mozimo.in", "");
const patched = await authed(`/api/collections/${name}/records/${rec.id}`, {
method: "PATCH",
body: JSON.stringify({ cta_url: internal }),
});
const patched = await authed(
`/api/collections/${name}/records/${rec.id}`,
{
method: "PATCH",
body: JSON.stringify({ cta_url: internal }),
},
);
if (patched.ok) {
console.log(`[pb-seed] migrated cta_url for "${rec.name}" -> ${internal}`);
console.log(
`[pb-seed] migrated cta_url for "${rec.name}" -> ${internal}`,
);
} else {
console.warn(`[pb-seed] cta migration failed for "${rec.name}":`, patched.status);
console.warn(
`[pb-seed] cta migration failed for "${rec.name}":`,
patched.status,
);
}
}
}
@@ -539,26 +549,34 @@ async function main() {
// migration: fill section copy that arrived after the record was seeded
// (only empty fields — anything edited in the admin is never overwritten)
if (name === "gifting_page") {
const rec = (await authed(`/api/collections/${name}/records?perPage=1`)).body.items?.[0];
const rec = (await authed(`/api/collections/${name}/records?perPage=1`))
.body.items?.[0];
if (rec) {
const patch = {};
for (const [k, v] of Object.entries(SEEDS[name][0] ?? {})) {
if (k !== "sort" && !rec[k]) patch[k] = v;
}
if (Object.keys(patch).length) {
const patched = await authed(`/api/collections/${name}/records/${rec.id}`, {
method: "PATCH",
body: JSON.stringify(patch),
});
const patched = await authed(
`/api/collections/${name}/records/${rec.id}`,
{
method: "PATCH",
body: JSON.stringify(patch),
},
);
if (patched.ok)
console.log(`[pb-seed] gifting_page: filled ${Object.keys(patch).length} empty field(s)`);
console.log(
`[pb-seed] gifting_page: filled ${Object.keys(patch).length} empty field(s)`,
);
}
}
}
// migration: make sure editorial rows/settings that shipped later exist
if (name === "collection_rows") {
const all = (await authed(`/api/collections/${name}/records?perPage=100`)).body.items ?? [];
const all =
(await authed(`/api/collections/${name}/records?perPage=100`)).body
.items ?? [];
for (const row of COLLECTION_ROWS) {
if (!all.some((r) => r.shopify_handle === row.shopify_handle)) {
const inserted = await authed(`/api/collections/${name}/records`, {
@@ -566,12 +584,16 @@ async function main() {
body: JSON.stringify(row),
});
if (inserted.ok)
console.log(`[pb-seed] collection_rows: added missing row "${row.name_override}"`);
console.log(
`[pb-seed] collection_rows: added missing row "${row.name_override}"`,
);
}
}
}
if (name === "site_settings") {
const all = (await authed(`/api/collections/${name}/records?perPage=100`)).body.items ?? [];
const all =
(await authed(`/api/collections/${name}/records?perPage=100`)).body
.items ?? [];
for (const setting of SITE_SETTINGS) {
if (!all.some((r) => r.key === setting.key)) {
const inserted = await authed(`/api/collections/${name}/records`, {