@seatschart/react 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -0
- package/dist/SeatMapEmbed.d.ts +14 -0
- package/dist/SeatMapEmbed.d.ts.map +1 -0
- package/dist/SeatMapEmbed.js +15 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/useSeatHoldListener.d.ts +9 -0
- package/dist/useSeatHoldListener.d.ts.map +1 -0
- package/dist/useSeatHoldListener.js +20 -0
- package/package.json +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# @seatschart/react
|
|
2
|
+
|
|
3
|
+
React bindings for SeatsChart iframe embeds and checkout handoff.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @seatschart/react @seatschart/embed
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Seat map iframe
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { SeatMapEmbed } from "@seatschart/react";
|
|
15
|
+
|
|
16
|
+
export function CheckoutSeats({ jwt }: { jwt: string }) {
|
|
17
|
+
return (
|
|
18
|
+
<SeatMapEmbed
|
|
19
|
+
webBase="https://your-tenant.seatschart.com"
|
|
20
|
+
eventId="00000000-0000-0000-0000-000000000000"
|
|
21
|
+
parentOrigin="https://checkout.yourplatform.com"
|
|
22
|
+
token={jwt}
|
|
23
|
+
channel="web"
|
|
24
|
+
height={640}
|
|
25
|
+
/>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Hold listener hook
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { useSeatHoldListener } from "@seatschart/react";
|
|
34
|
+
|
|
35
|
+
useSeatHoldListener({
|
|
36
|
+
parentOrigin: "https://checkout.yourplatform.com",
|
|
37
|
+
onHeld(payload) {
|
|
38
|
+
router.push(`/pay?hold=${payload.holdToken}`);
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type SeatMapEmbedProps = {
|
|
2
|
+
webBase: string;
|
|
3
|
+
eventId: string;
|
|
4
|
+
parentOrigin: string;
|
|
5
|
+
token: string;
|
|
6
|
+
channel?: string;
|
|
7
|
+
title?: string;
|
|
8
|
+
height?: number;
|
|
9
|
+
className?: string;
|
|
10
|
+
allowFullscreen?: boolean;
|
|
11
|
+
};
|
|
12
|
+
/** Renders the SeatsChart WebGL viewer iframe with required embed query params. */
|
|
13
|
+
export declare function SeatMapEmbed({ webBase, eventId, parentOrigin, token, channel, title, height, className, allowFullscreen, }: SeatMapEmbedProps): React.ReactElement;
|
|
14
|
+
//# sourceMappingURL=SeatMapEmbed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SeatMapEmbed.d.ts","sourceRoot":"","sources":["../src/SeatMapEmbed.tsx"],"names":[],"mappings":"AAKA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,mFAAmF;AACnF,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,OAAO,EACP,YAAY,EACZ,KAAK,EACL,OAAO,EACP,KAAkB,EAClB,MAAY,EACZ,SAAS,EACT,eAAsB,GACvB,EAAE,iBAAiB,GAAG,KAAK,CAAC,YAAY,CAwBxC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { buildViewerEmbedUrl } from "@seatschart/embed";
|
|
5
|
+
/** Renders the SeatsChart WebGL viewer iframe with required embed query params. */
|
|
6
|
+
export function SeatMapEmbed({ webBase, eventId, parentOrigin, token, channel, title = "Seat map", height = 640, className, allowFullscreen = true, }) {
|
|
7
|
+
const src = useMemo(() => buildViewerEmbedUrl({
|
|
8
|
+
webBase,
|
|
9
|
+
eventId,
|
|
10
|
+
parentOrigin,
|
|
11
|
+
token,
|
|
12
|
+
channel,
|
|
13
|
+
}), [webBase, eventId, parentOrigin, token, channel]);
|
|
14
|
+
return (_jsx("iframe", { src: src, title: title, width: "100%", height: height, className: className, style: { border: 0, borderRadius: 12, display: "block" }, allow: allowFullscreen ? "fullscreen" : undefined }));
|
|
15
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,KAAK,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAChG,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type EmbedReservationPayload } from "@seatschart/embed";
|
|
2
|
+
export type UseSeatHoldListenerOptions = {
|
|
3
|
+
parentOrigin: string;
|
|
4
|
+
onHeld: (payload: EmbedReservationPayload) => void;
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
};
|
|
7
|
+
/** React hook for `SEATSCHART_RESERVATION_SUCCESS` (status `held`) on the parent page. */
|
|
8
|
+
export declare function useSeatHoldListener(options: UseSeatHoldListenerOptions): void;
|
|
9
|
+
//# sourceMappingURL=useSeatHoldListener.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSeatHoldListener.d.ts","sourceRoot":"","sources":["../src/useSeatHoldListener.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,mBAAmB,CAAC;AAE3B,MAAM,MAAM,0BAA0B,GAAG;IACvC,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,IAAI,CAAC;IACnD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,0FAA0F;AAC1F,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,IAAI,CAe7E"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
import { createSeatHoldListener, } from "@seatschart/embed";
|
|
4
|
+
/** React hook for `SEATSCHART_RESERVATION_SUCCESS` (status `held`) on the parent page. */
|
|
5
|
+
export function useSeatHoldListener(options) {
|
|
6
|
+
const { parentOrigin, onHeld, enabled = true } = options;
|
|
7
|
+
const onHeldRef = useRef(onHeld);
|
|
8
|
+
onHeldRef.current = onHeld;
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (!enabled)
|
|
11
|
+
return;
|
|
12
|
+
const origin = parentOrigin.trim();
|
|
13
|
+
if (origin === "")
|
|
14
|
+
return;
|
|
15
|
+
return createSeatHoldListener({
|
|
16
|
+
parentOrigin: origin,
|
|
17
|
+
onHeld: (payload) => onHeldRef.current(payload),
|
|
18
|
+
});
|
|
19
|
+
}, [parentOrigin, enabled]);
|
|
20
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@seatschart/react",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "React components and hooks for SeatsChart seat map embeds",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/seatschart/seatschart"
|
|
10
|
+
},
|
|
11
|
+
"main": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"README.md"
|
|
22
|
+
],
|
|
23
|
+
"keywords": [
|
|
24
|
+
"seatschart",
|
|
25
|
+
"seats",
|
|
26
|
+
"react",
|
|
27
|
+
"embed",
|
|
28
|
+
"ticketing"
|
|
29
|
+
],
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "tsc -p tsconfig.json",
|
|
35
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
36
|
+
"prepublishOnly": "bun run build"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"react": ">=18.0.0"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@seatschart/embed": "^0.1.0"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/react": "^19.2.14",
|
|
46
|
+
"typescript": "^5.9.3"
|
|
47
|
+
},
|
|
48
|
+
"sideEffects": false
|
|
49
|
+
}
|