@maizzle/framework
Version:
Maizzle is a framework that helps you quickly build HTML emails with Tailwind CSS.
26 lines (25 loc) • 821 B
JavaScript
import { RenderContextKey } from "./renderContext.js";
import { defu as defu$1 } from "defu";
import { inject } from "vue";
//#region src/composables/useUrlQuery.ts
/**
* Append query parameters to URLs in the current email template — same
* as `config.url.query`, scoped to one SFC. Common use: per-template
* UTM parameters or campaign tracking.
*
* Usage in SFC <script setup>:
* ```ts
* useUrlQuery({ utm_source: 'maizzle', utm_campaign: 'newsletter' })
* ```
*
* Pass `_options` alongside the params to tweak which tags/attributes
* receive them (see `UrlQueryOptions`).
*/
function useUrlQuery(value) {
const ctx = inject(RenderContextKey);
if (!ctx) return;
ctx.sfcConfig = defu$1({ url: { query: value } }, ctx.sfcConfig ?? {});
}
//#endregion
export { useUrlQuery };
//# sourceMappingURL=useUrlQuery.js.map