Envie
ReferenceSDK

Generated types

Exhaustive type signatures for @getenvie/client, generated from the package's TSDoc — the curated reference starts at SDK.

Classes

Envie

Constructors

Constructor
new Envie(options?): Envie;
Parameters
options?

EnvieOptions = {}

Returns

Envie

Properties

private
readonly private: object;

Server-side surface. Every call needs a private key, so this throws in the browser rather than sending a request that would 401 — the mistake is using the wrong mode, and the error should say so.

Envie's own admin dashboard runs on exactly these methods.

activity
activity: (range) => Promise<ActivityDtoOutput>;
Parameters
range?

AnalyticsRange = "30d"

Returns

Promise<ActivityDtoOutput>

createExport
createExport: (format) => Promise<{
  jobId: string;
}>;
Parameters
format

"csv" | "json"

Returns

Promise<{ jobId: string; }>

createImport
createImport: (body) => Promise<{
  jobId: string;
}>;

Always run with dryRun: true first on a competitor export — the report tells you what would be skipped while it is still free to fix.

Parameters
body

CreateImportBodyDto

Returns

Promise<{ jobId: string; }>

createKey
createKey: (label) => Promise<CreateKeyResponseDtoOutput>;
Parameters
label

string

Returns

Promise<CreateKeyResponseDtoOutput>

createUploadTarget
createUploadTarget: (body) => Promise<UploadTargetDtoOutput>;

A presigned PUT plus the URL to hand back to createImport. The file goes browser → storage directly; it never passes through the API.

Parameters
body

UploadTargetBodyDto

Returns

Promise<UploadTargetDtoOutput>

createWebhook
createWebhook: (body) => Promise<CreateWebhookResponseDtoOutput>;

The response carries the signing secret. It is shown once and never again.

Parameters
body

CreateWebhookBodyDto

Returns

Promise<CreateWebhookResponseDtoOutput>

deleteWebhook
deleteWebhook: (id) => Promise<void>;
Parameters
id

string

Returns

Promise<void>

embedStatus
embedStatus: () => Promise<EmbedStatusDtoOutput>;

Reads the live theme; the API caches it for 5 minutes.

Returns

Promise<EmbedStatusDtoOutput>

export
export: (jobId) => Promise<TransferJobDtoOutput>;
Parameters
jobId

string

Returns

Promise<TransferJobDtoOutput>

exports
exports: (query) => Promise<TransferJobsDtoOutput>;
Parameters
query?
cursor?

string

limit?

number

Returns

Promise<TransferJobsDtoOutput>

import
import: (jobId) => Promise<TransferJobDtoOutput>;
Parameters
jobId

string

Returns

Promise<TransferJobDtoOutput>

keys
keys: () => Promise<ApiKeyDtoOutput[]>;

Never includes secrets — only createKey ever returns one.

Returns

Promise<ApiKeyDtoOutput[]>

list
list: (id) => Promise<ListDtoOutput>;
Parameters
id

string

Returns

Promise<ListDtoOutput>

lists
lists: (query) => Promise<ListsResponseDtoOutput>;
Parameters
query?
cursor?

string

customerId?

string

limit?

number

Returns

Promise<ListsResponseDtoOutput>

revokeKey
revokeKey: (id) => Promise<void>;
Parameters
id

string

Returns

Promise<void>

shop
shop: () => Promise<ShopDtoOutput>;
Returns

Promise<ShopDtoOutput>

testWebhook
testWebhook: (id) => Promise<void>;

Sends a signed ping to the endpoint so a merchant can verify wiring.

Parameters
id

string

Returns

Promise<void>

topProducts
topProducts: (range) => Promise<TopProductsDtoOutput>;
Parameters
range?

AnalyticsRange = "30d"

Returns

Promise<TopProductsDtoOutput>

updateSettings
updateSettings: (patch) => Promise<ShopSettingsDtoOutput>;

Patch, not replace: each admin page owns a slice of the settings, so a page sends what it changed and leaves the rest alone.

klaviyoKey is write-only — it is never returned, and null disconnects.

Parameters
patch

UpdateSettingsBodyDto

Returns

Promise<ShopSettingsDtoOutput>

webhooks
webhooks: () => Promise<WebhookDtoOutput[]>;
Returns

Promise<WebhookDtoOutput[]>

wishlist
readonly wishlist: object;
add
add: (input) => Promise<{
  addedAt: string;
  handle: string;
  id: string;
  productId: string;
  titleSnapshot: string | null;
  variantId: string | null;
}>;
Parameters
input

Omit<ToggleItemBodyDto, "anonymousId">

Returns

Promise<{ addedAt: string; handle: string; id: string; productId: string; titleSnapshot: string | null; variantId: string | null; }>

get
get: () => Promise<WishlistDtoOutput>;
Returns

Promise<WishlistDtoOutput>

remove
remove: (input) => Promise<void>;
Parameters
input

| { productId: string; variantId?: string; } | { itemId: string; }

Returns

Promise<void>

share
share: () => Promise<ShareResponseDtoOutput>;
Returns

Promise<ShareResponseDtoOutput>

shared
shared: (shareToken) => Promise<SharedListDtoOutput>;
Parameters
shareToken

string

Returns

Promise<SharedListDtoOutput>

toggle
toggle: (input) => Promise<ToggleItemResponseDtoOutput>;
Parameters
input

Omit<ToggleItemBodyDto, "anonymousId">

Returns

Promise<ToggleItemResponseDtoOutput>

Accessors

currentAnonymousId
Get Signature
get currentAnonymousId(): string | undefined;
Returns

string | undefined

Methods

getConfig()
getConfig(): Promise<ShopConfigDtoOutput>;
Returns

Promise<ShopConfigDtoOutput>

getWishlist()
getWishlist(): Promise<WishlistDtoOutput>;
Returns

Promise<WishlistDtoOutput>

identify()
identify(input?): Promise<ListDtoOutput>;

Merge the anonymous list into the customer's. Forbidden in public mode — a browser must not assert a customer id.

Parameters
input?
customerId?

string

Returns

Promise<ListDtoOutput>

identifyOnce()
identifyOnce(customerId): Promise<boolean>;

Merge on login, once per (browser, customer) — F3 AC1. Called for you when customerId is passed to createEnvie; the theme app embed reads it from Liquid's customer.id.

Never rejects: a failed merge must not take the buttons down with it. The marker is only written on success, so the next page view retries.

Parameters
customerId

string | number

Returns

Promise<boolean>

subscribe()
subscribe(listener): () => void;

Reactive snapshot shared with @getenvie/components.

Parameters
listener

(snapshot) => void

Returns

() => void


EnvieApiError

Thrown for every non-2xx response; carries the RFC 9457 problem body.

Extends

  • Error

Constructors

Constructor
new EnvieApiError(status, problem): EnvieApiError;
Parameters
status

number

problem

ProblemDetails

Returns

EnvieApiError

Overrides
Error.constructor

Properties

cause?
optional cause?: unknown;
Inherited from
Error.cause
message
message: string;
Inherited from
Error.message
name
name: string;
Inherited from
Error.name
problem
readonly problem: ProblemDetails;
stack?
optional stack?: string;
Inherited from
Error.stack
status
readonly status: number;

Type Aliases

Activity

type Activity = ActivityDtoOutput;

AnalyticsRange

type AnalyticsRange = "7d" | "30d" | "90d";

ApiKey

type ApiKey = ApiKeyDtoOutput;

CreatedKey

type CreatedKey = CreateKeyResponseDtoOutput;

CreatedWebhook

type CreatedWebhook = CreateWebhookResponseDtoOutput;

Carries the signing secret; only the create response ever does.


CreateImport

type CreateImport = CreateImportBodyDto;

CreateWebhook

type CreateWebhook = CreateWebhookBodyDto;

EmbedStatus

type EmbedStatus = EmbedStatusDtoOutput;

Whether the app embed is on in the merchant's live theme.


EnvieBridge

type EnvieBridge = object;

What @getenvie/components calls. Kept structural — no shared import.

Properties

getConfig
getConfig: () => Promise<EnvieConfig>;
Returns

Promise<EnvieConfig>

getWishlist
getWishlist: () => Promise<EnvieList>;
Returns

Promise<EnvieList>

share
share: () => Promise<ShareResult>;
Returns

Promise<ShareResult>

shared
shared: (shareToken) => Promise<SharedList>;
Parameters
shareToken

string

Returns

Promise<SharedList>

toggle
toggle: (input) => Promise<ToggleResult>;
Parameters
input

ToggleItemBodyDto

Returns

Promise<ToggleResult>


EnvieConfig

type EnvieConfig = ShopConfigDtoOutput;

EnvieItem

type EnvieItem = WishlistDtoOutput["items"][number];

EnvieList

type EnvieList = WishlistDtoOutput;

id and updatedAt are null until the shopper's first save — no list exists yet.


EnvieMergedList

type EnvieMergedList = ListDtoOutput;

After identify() a list always exists, so its id is non-null.


EnvieMode

type EnvieMode = "proxy" | "public" | "private";

EnvieOptions

type EnvieOptions = object;

Properties

anonymousId?
optional anonymousId?: string;

Explicit anonymous id. Defaults to a persisted envie:aid in browsers.

apiUrl?
optional apiUrl?: string;

Override the API origin (default https://api.getenvie.com).

customerId?
optional customerId?: string | number | null;

The logged-in customer, when there is one. Triggers a one-shot merge of this browser's anonymous list into theirs. Ignored in public mode, where a browser may not assert a customer id. Accepts the number Liquid emits for customer.id.

fetch?
optional fetch?: typeof globalThis.fetch;

Inject a fetch implementation (tests, Hydrogen loaders).

mode?
optional mode?: EnvieMode;

proxy (default) — served from the shop domain, requests go through the Shopify app proxy and are signed by Shopify. public — headless browser, anonymous scope only. private — server-side only; can act as a customer.

proxyBase?
optional proxyBase?: string;

Override the proxy base (default /apps/envie).

publicKey?
optional publicKey?: string;

public mode: browser-safe env_pk_….

retries?
optional retries?: number;

Retries for idempotent requests. Default 2.

secretKey?
optional secretKey?: string;

private mode: server-only env_sk_…. NEVER ship this to a browser.

shop?
optional shop?: string;

Required for public/private.


EnvieSnapshot

type EnvieSnapshot = object;

Properties

config
config: EnvieConfig | null;
count
count: number;
items
items: EnvieItem[];
ready
ready: boolean;

ImportSource

type ImportSource = CreateImportBodyDto["source"];

ListsPage

type ListsPage = ListsResponseDtoOutput;

ProblemDetails

type ProblemDetails = object;

Properties

detail?
optional detail?: string;
errors?
optional errors?: object[];
message
message: string;
path
path: string;
status
status: number;
title
title: string;
type
type: string;

SharedList

type SharedList = SharedListDtoOutput;

ShareResult

type ShareResult = ShareResponseDtoOutput;

ShopSettings

type ShopSettings = ShopSettingsDtoOutput;

ShopSummary

type ShopSummary = ShopDtoOutput;

ToggleItemBodyDto

type ToggleItemBodyDto = object;

Properties

anonymousId?
optional anonymousId?: string;

UUIDv4 minted by the SDK. An opaque capability, never an identity.

handle
handle: string;

Product handle. Required — storefronts fetch presentation data with it.

productId
productId: string | number;
variantId?
optional variantId?: string | number;

ToggleResult

type ToggleResult = ToggleItemResponseDtoOutput;

TopProducts

type TopProducts = TopProductsDtoOutput;

TransferJob

type TransferJob = TransferJobDtoOutput;

TransferJobsPage

type TransferJobsPage = TransferJobsDtoOutput;

UpdateSettings

type UpdateSettings = UpdateSettingsBodyDto;

UploadTarget

type UploadTarget = UploadTargetDtoOutput;

UploadTargetInput

type UploadTargetInput = UploadTargetBodyDto;

Webhook

type Webhook = WebhookDtoOutput;

Functions

createEnvie()

function createEnvie(options?): Envie;
const envie = createEnvie();                                     // Liquid (proxy)
const envie = createEnvie({ mode: "public", shop, publicKey });   // headless browser
const envie = createEnvie({ mode: "private", shop, secretKey });  // server

Parameters

options?

EnvieOptions = {}

Returns

Envie

On this page

ClassesEnvieConstructorsConstructorParametersoptions?ReturnsPropertiesprivateactivityParametersrange?ReturnscreateExportParametersformatReturnscreateImportParametersbodyReturnscreateKeyParameterslabelReturnscreateUploadTargetParametersbodyReturnscreateWebhookParametersbodyReturnsdeleteWebhookParametersidReturnsembedStatusReturnsexportParametersjobIdReturnsexportsParametersquery?cursor?limit?ReturnsimportParametersjobIdReturnskeysReturnslistParametersidReturnslistsParametersquery?cursor?customerId?limit?ReturnsrevokeKeyParametersidReturnsshopReturnstestWebhookParametersidReturnstopProductsParametersrange?ReturnsupdateSettingsParameterspatchReturnswebhooksReturnswishlistaddParametersinputReturnsgetReturnsremoveParametersinputReturnsshareReturnssharedParametersshareTokenReturnstoggleParametersinputReturnsAccessorscurrentAnonymousIdGet SignatureReturnsMethodsgetConfig()ReturnsgetWishlist()Returnsidentify()Parametersinput?customerId?ReturnsidentifyOnce()ParameterscustomerIdReturnssubscribe()ParameterslistenerReturnsEnvieApiErrorExtendsConstructorsConstructorParametersstatusproblemReturnsOverridesPropertiescause?Inherited frommessageInherited fromnameInherited fromproblemstack?Inherited fromstatusType AliasesActivityAnalyticsRangeApiKeyCreatedKeyCreatedWebhookCreateImportCreateWebhookEmbedStatusEnvieBridgePropertiesgetConfigReturnsgetWishlistReturnsshareReturnssharedParametersshareTokenReturnstoggleParametersinputReturnsEnvieConfigEnvieItemEnvieListEnvieMergedListEnvieModeEnvieOptionsPropertiesanonymousId?apiUrl?customerId?fetch?mode?proxyBase?publicKey?retries?secretKey?shop?EnvieSnapshotPropertiesconfigcountitemsreadyImportSourceListsPageProblemDetailsPropertiesdetail?errors?messagepathstatustitletypeSharedListShareResultShopSettingsShopSummaryToggleItemBodyDtoPropertiesanonymousId?handleproductIdvariantId?ToggleResultTopProductsTransferJobTransferJobsPageUpdateSettingsUploadTargetUploadTargetInputWebhookFunctionscreateEnvie()Parametersoptions?Returns