DistributionsService
Use client.distributions to configure and publish hosted pass-enrollment experiences.
| Method | Purpose |
|---|---|
get(id) / create(data) / update(id, data) / delete(id) | Distribution lifecycle |
getByWorkspace(workspaceId, options?) | List workspace distributions |
getByProject(projectId, options?) | List project distributions |
getByTemplate(templateId, options) | List template distributions |
getByStatus(status, options) | Filter by status in a workspace |
getByPageAddress(address, { workspaceId }, options?) | Find a hosted page |
search(query, options) | Search a workspace |
publish(id) / unpublish(id) | Change publication status |
duplicate(id, options?) | Duplicate configuration |
getComplete(id) | Load related project, template, and workspace |
bulkUpdate(ids, data) | Update multiple distributions |
bulkPublish(ids) / bulkUnpublish(ids) | Change multiple statuses |
rotateApiToken(id) | Rotate the embedded-integration token |
list(), getByTemplate(), getByStatus(), and search() require options.filter.workspace_id._eq. getByPageAddress() requires workspaceFilter.workspaceId as its second argument.
typescript
const { data: publishedPage } = await client.distributions.getByPageAddress(
"coffee-rewards",
{ workspaceId: "workspace-uuid" },
);typescript
const { data: distribution } = await client.distributions.create({
workspace_id: "workspace-uuid",
project_id: "project-uuid",
pass_template_id: "template-uuid",
status: "draft",
page_address: "coffee-rewards",
});
await client.distributions.publish(distribution.id);For a partner-hosted browser form, use the standalone PublicDistributionService:
typescript
import { PublicDistributionService } from "@wallethero/sdk";
const embed = new PublicDistributionService({
apiUrl: "https://api.wallethero.app",
distributionToken: "wh_dist_...",
});
const result = await embed.enroll({
email: "[email protected]",
first_name: "Jane",
});