# JoyLoyaltyPage

> Source: https://devdocs.joy.so/joy-headless-api/sdk-reference/weaverse-hydrogen/root/namespaces/JoyLoyaltyPage/ · Last updated: 2026-11-24

## Interfaces

### LoyaltyPageBlockProps

#### Extends

- `HydrogenComponentProps`<[`LoyaltyPageLoaderData`](#loyaltypageloaderdata)>

#### Properties

##### children?

```ts
children?: Element[];
```

Rendered child component instances.

###### Inherited from

`HydrogenComponentProps.children`

##### className?

```ts
className?: string;
```

Optional CSS class passed through by the renderer.

###### Inherited from

`HydrogenComponentProps.className`

##### Component

```ts
Component: ForwardRefExoticComponent<any>;
```

The React component registered for the element.

###### Inherited from

`HydrogenComponentProps.Component`

##### data-wv-id

```ts
"data-wv-id": string;
```

The unique element identifier used in rendered markup.

###### Inherited from

`HydrogenComponentProps.data-wv-id`

##### data-wv-type

```ts
"data-wv-type": string;
```

The element type used in rendered markup.

###### Inherited from

`HydrogenComponentProps.data-wv-type`

##### loaderData?

```ts
loaderData?: LoyaltyPageLoaderData;
```

Result returned by the component's server-side loader.

###### Inherited from

`HydrogenComponentProps.loaderData`

##### sectionId

```ts
sectionId: string;
```

`'all'` (the whole page) or one section id — see SECTION_OPTIONS.

##### type

```ts
type: string;
```

The registered element type.

###### Inherited from

`HydrogenComponentProps.type`

***

### LoyaltyPageLoaderData

Loader payload — shop-level only. No customer field, by construction (D2).

#### Properties

##### apiUrl

```ts
apiUrl: string | null;
```

##### assetUrl?

```ts
assetUrl?: string | null;
```

Widget-core origin override (`JOY_WIDGET_ASSET_URL`) — the same env the
core-loader documents for pinning/self-hosting the CDN artifact. Null →
the default CDN.

##### data?

```ts
data?: JoyLoyaltyPageData;
```

Undefined when the env vars are missing — there was nothing to fetch with.

##### error?

```ts
error?: string;
```

##### shopDomain

```ts
shopDomain: string | null;
```

## Variables

### schema

```ts
const schema: SchemaType;
```

## Functions

### cartFromLoaderData()

```ts
function cartFromLoaderData(data): StorefrontCartProp | undefined;
```

A cart route loader's answer → the cart: the cart itself (skeleton) or `{cart, ...}` (Pilot).

#### Parameters

| Parameter | Type      |
| --------- | --------- |
| `data`    | `unknown` |

#### Returns

`StorefrontCartProp` | `undefined`

***

### default()

```ts
function default(props): Element;
```

#### Parameters

| Parameter | Type                                              |
| --------- | ------------------------------------------------- |
| `props`   | [`LoyaltyPageBlockProps`](#loyaltypageblockprops) |

#### Returns

`Element`

***

### loader()

```ts
function loader(__namedParameters): Promise<LoyaltyPageLoaderData>;
```

#### Parameters

| Parameter           | Type                  |
| ------------------- | --------------------- |
| `__namedParameters` | `ComponentLoaderArgs` |

#### Returns

`Promise`<[`LoyaltyPageLoaderData`](#loyaltypageloaderdata)>

***

### localeCartRoute()

```ts
function localeCartRoute(locale): string;
```

The cart action route for the current `($locale)` param — also where `go_to_cart` sends the shopper.
An optional `:locale?` segment also captures a plain path (`/loyalty-page` → `locale: 'loyalty-page'`),
so only a locale-shaped segment (`fr`, `en-ca`) becomes a prefix (NEW-02).

#### Parameters

| Parameter | Type                    |
| --------- | ----------------------- |
| `locale`  | `string` \| `undefined` |

#### Returns

`string`
