feat: enhance iframe communication and caching mechanisms
Some checks failed
lotteryfront CI / build (push) Has been cancelled
Some checks failed
lotteryfront CI / build (push) Has been cancelled
- Improved the entry lifecycle management to prevent duplicate token requests and ensure smooth transitions. - Updated the `resolvePostMessageTargetOrigin` function to return null when no allowed origins are present, enhancing security. - Cached runtime origins to optimize performance and reduce unnecessary API calls. - Added a new error message for frozen lottery wallets in the player notifications.
This commit is contained in:
@@ -28,6 +28,9 @@ export function IframeBridge({ children }: { children: ReactNode }): ReactNode {
|
||||
(type: string, payload?: Record<string, unknown>): void => {
|
||||
if (typeof window === "undefined" || window.parent === window) return;
|
||||
|
||||
const targetOrigin = resolvePostMessageTargetOrigin();
|
||||
if (!targetOrigin) return;
|
||||
|
||||
window.parent.postMessage(
|
||||
{
|
||||
type: `LOTTERY_${type}`,
|
||||
@@ -35,7 +38,7 @@ export function IframeBridge({ children }: { children: ReactNode }): ReactNode {
|
||||
timestamp: Date.now(),
|
||||
source: "lottery-iframe",
|
||||
},
|
||||
resolvePostMessageTargetOrigin(),
|
||||
targetOrigin,
|
||||
);
|
||||
},
|
||||
[],
|
||||
|
||||
Reference in New Issue
Block a user