@bluepic/embed 0.6.10 → 0.6.12

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,9 @@ 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;
12624
+ private onClose?;
12622
12625
  constructor(elementOrSelector: string | HTMLElement, campaignId: number | string, opts?: {
12623
12626
  templateId?: string;
12624
12627
  initData?: {
@@ -12633,8 +12636,15 @@ export declare class BluepicEmbed extends EventTarget {
12633
12636
  customThemeVars?: Partial<z.infer<typeof EmbedV2.customStyleSchema>> | ThemeInput;
12634
12637
  bearerToken?: string;
12635
12638
  password?: string;
12639
+ /**
12640
+ * Show a close button in the editor's toolbar, right of Export, and call
12641
+ * this when it is pressed. Used by `openPopup` (the popup has no header).
12642
+ */
12643
+ onClose?: () => void;
12636
12644
  });
12637
12645
  private loadCampaign;
12646
+ /** Unmount the editor and free the element (e.g. when its popup closes). */
12647
+ destroy(): void;
12638
12648
  private mount;
12639
12649
  setVariable(key: string, value: unknown): void;
12640
12650
  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;