@bluepic/embed 0.6.10 → 0.6.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12619,6 +12619,8 @@ export declare class BluepicEmbed extends EventTarget {
12619
12619
  stripeEnv: Ref<"dev" | "prod", "dev" | "prod">;
12620
12620
  bxThemeStyleVars: Ref<Partial<z.infer<typeof EmbedV2.customStyleSchema>>>;
12621
12621
  id: string;
12622
+ private app?;
12623
+ private destroyed;
12622
12624
  constructor(elementOrSelector: string | HTMLElement, campaignId: number | string, opts?: {
12623
12625
  templateId?: string;
12624
12626
  initData?: {
@@ -12635,6 +12637,8 @@ export declare class BluepicEmbed extends EventTarget {
12635
12637
  password?: string;
12636
12638
  });
12637
12639
  private loadCampaign;
12640
+ /** Unmount the editor and free the element (e.g. when its popup closes). */
12641
+ destroy(): void;
12638
12642
  private mount;
12639
12643
  setVariable(key: string, value: unknown): void;
12640
12644
  setData(dataset: {
@@ -0,0 +1,40 @@
1
+ import { type PopupCreationOptions } from '../components/directives/usePopup';
2
+ import { BluepicEmbed } from './embed';
3
+ /**
4
+ * `Bluepic.openPopup(…)` — the campaign editor in a bx-popup on the HOST page.
5
+ *
6
+ * Built for "after ticket purchase": the ticket shop's confirmation page runs
7
+ * this with the buyer's data in the shop's own merge tags, and the visitor gets
8
+ * their design pre-filled without leaving the page:
9
+ *
10
+ * Bluepic.openPopup({
11
+ * campaignId: "3903425802407936",
12
+ * data: { NAME: "{{first_name}} {{last_name}}", COMPANY: "{{company}}" },
13
+ * });
14
+ *
15
+ * Nothing new underneath: the popup is the library's own `createPopup` (a
16
+ * `frame` by default), and its content is the SAME `BluepicEmbed` editor the
17
+ * `.bluepic-embed` snippet mounts. `data` is its `initData` — field values by
18
+ * binding key, exactly like `data-init-data`.
19
+ */
20
+ export type OpenPopupOptions = {
21
+ campaignId: number | string;
22
+ /** Open this template; default: the campaign's first. */
23
+ templateId?: string;
24
+ /** Pre-filled field values by binding key. */
25
+ data?: Record<string, unknown>;
26
+ theme?: 'light' | 'dark' | 'auto';
27
+ apiBaseUrl?: string;
28
+ stripeEnv?: 'dev' | 'prod';
29
+ /** Popup type of the library's popup system. Default `frame`. */
30
+ type?: PopupCreationOptions['type'];
31
+ title?: string;
32
+ /** Called after the popup closed. */
33
+ onClose?: () => void;
34
+ };
35
+ export type BluepicPopupHandle = {
36
+ close: () => void;
37
+ /** The editor, once mounted (it mounts with the popup). */
38
+ readonly embed: BluepicEmbed | undefined;
39
+ };
40
+ export declare function openPopup(options: OpenPopupOptions): BluepicPopupHandle;