UNPKG

@revenuecat/purchases-ui-js

Version:

Web components for Paywalls. Powered by RevenueCat

93 lines (92 loc) 2.19 kB
export function createStack({ id, name, components, }) { return { type: "stack", id, name, components, size: { width: { type: "fit" }, height: { type: "fit" }, }, dimension: { type: "vertical", alignment: "leading", distribution: "start", }, background: null, background_color: null, badge: null, border: null, margin: { bottom: 0, leading: 0, top: 0, trailing: 0, }, padding: { bottom: 16, leading: 16, top: 16, trailing: 16, }, shadow: null, shape: { corners: { bottom_leading: 0, bottom_trailing: 0, top_leading: 0, top_trailing: 0, }, type: "rectangle", }, spacing: 16, }; } export function createPackageComponent({ id, name, package_id, is_selected_by_default, stackId, stackName, components, }) { return { type: "package", id, name, package_id, is_selected_by_default, stack: createStack({ id: stackId ?? `${package_id}-stack`, name: stackName ?? `${package_id}-stackname`, components, }), }; } export function createTextComponent({ id, name, textLid, }) { return { type: "text", id, name: name ?? id, text_lid: textLid, font_name: null, font_size: 14, font_weight: "regular", horizontal_alignment: "leading", color: { light: { type: "hex", value: "#000000", }, }, size: { width: { type: "fit" }, height: { type: "fit" }, }, padding: { bottom: 0, leading: 0, top: 0, trailing: 0, }, margin: { bottom: 0, leading: 0, top: 0, trailing: 0, }, }; }