Giftie
Greeting Card Builder SDK

Configuration

Configure the Greeting Card Builder modal, runtime, callbacks, and optional recording bridge.

Pass configuration to window.GreetingCardBuilder(config). Create one instance and reuse it.

Builder and iframe

FieldTypeDefaultBehavior
baseUrlstringloader script originBuilder origin. Required when the loader URL cannot be discovered.
hostOriginstringwindow.location.originTrusted host origin sent to the iframe. Required for opaque origins such as file: pages.
runtime'legacy' | 'yuzu''legacy'Selects /boot or /v2/boot. yuzuGcbEnabled: true in init data also selects Yuzu.
builderPathstringruntime routeOverrides the iframe path. Use only when Giftie supplies a custom route.
embedModestring'shopify'Builder embed mode sent in the iframe URL.
frameParamsRecord<string, string | number | boolean>noneAdds primitive query parameters to the iframe URL.
initDataobjectnoneInitial card data sent after the builder reports ready.
autoPreloadbooleanfalseCreates the iframe during an idle callback without opening the modal.

When the script is served separately from the builder, set baseUrl or set window.GIFTIE_GCB_BASE_URL before loading the script.

URL configuration is not a secret channel. Do not put access tokens, personal data, customer messages, or private order fields in frameParams.

FieldTypeDefaultBehavior
closeOnCompletebooleantrueCloses after onCardComplete unless set to false.
closeOnBackdropbooleanfalseAllows a click on the dialog backdrop to cancel and close.
ariaLabelstring'Greeting Card Builder'Accessible label for the modal dialog.
iframeTitlestring'Greeting Card Builder'Accessible iframe title.
modalPaddingCSS length'0'Padding around the iframe on desktop. Forced to 0 below 768 px.
borderRadiusCSS length'0'Iframe radius on desktop. Forced to 0 below 768 px.

Recording bridge

The card builder can ask the host to open Giftie's video/audio recording SDK.

FieldTypeDefaultBehavior
widgetLoaderUrlstringnoneRecording SDK loader URL. Required when the card can add video or audio and window.Giftie is not already present.
widgetBaseUrlstringnoneOptional recording widget base URL, assigned before loading its script.

The card SDK creates one recording instance lazily and returns a saved recording code to the card iframe. See onRecordingSaved below if the host also needs the recording result.

Callbacks

FieldSignatureWhen it runs
onOpen({ iframe, url }) => voidThe modal has opened.
onLoad({ iframe, url }) => voidThe iframe's browser load event fires.
onReady(data) => voidThe trusted iframe first reports gm/ready.
onInit(data) => voidThe SDK sends initialization data, including its generated requestId.
onInitApplied(data) => voidThe builder acknowledges that initialization was applied.
onCardComplete(data) => voidThe builder emits its completion payload.
onCancel(data) => voidEscape, backdrop, or builder cancellation occurs.
onClose({ reason }) => voidThe modal closes.
onAnalytics(data) => voidThe builder emits an analytics event.
onRecordingSaved(result) => voidThe nested recording widget saves video or audio.
onError(error) => voidThe loader reports a structured host-side error.

Callback exceptions are caught and logged so they do not break the SDK lifecycle. Returned promises are not awaited; catch asynchronous failures inside your callback.

Copyright © 2026