Headless API
SDK reference
hydrogen
csp

csp

Interfaces

JoyCspDirectives

Properties

connectSrc
connectSrc: string[];
fontSrc
fontSrc: string[];
imgSrc
imgSrc: string[];
scriptSrc
scriptSrc: string[];
styleSrc
styleSrc: string[];

Variables

JOY_API_ORIGIN

const JOY_API_ORIGIN: "https://api.joy.so" = 'https://api.joy.so';

Default Joy Headless API origin.


JOY_CDN_ORIGIN

const JOY_CDN_ORIGIN: "https://api.joy.so" = 'https://api.joy.so';

Default origin serving the widget core widget-v4/**. Hosting serves it from api.joy.so — static.joy.so/widget-v4/** is not published — so it currently equals JOY_API_ORIGIN.


JOY_CSP_DIRECTIVES

const JOY_CSP_DIRECTIVES: JoyCspDirectives;

The directives for Joy's default hosted CDN + API.

Functions

joyCspDirectives()

function joyCspDirectives(opts?): JoyCspDirectives;

Derive directives from the actual asset/API URLs a merchant configured, for setups that don't use Joy's default api.joy.so host (widget core + API). Falls back to the defaults for any URL that is omitted or unparseable.

Parameters

ParameterType
opts?{ apiUrl?: string; assetUrl?: string; }
opts.apiUrl?string
opts.assetUrl?string

Returns

JoyCspDirectives