@chainrails/react 0.4.5 → 0.4.6
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/dist/PaymentModal/index.d.ts.map +1 -1
- package/dist/chainrails-sdk.es.js +6145 -5898
- package/dist/chainrails-sdk.es.mjs +6145 -5898
- package/dist/chainrails-sdk.umd.js +29 -38
- package/dist/hooks/usePaymentModal.d.ts +10 -2
- package/dist/hooks/usePaymentModal.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/sw.js +176 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/serviceWorker.d.ts +36 -0
- package/dist/utils/serviceWorker.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { Config } from "@wagmi/core";
|
|
2
|
+
type ClientInfo = {
|
|
3
|
+
logoUrl: string;
|
|
4
|
+
name: string;
|
|
5
|
+
paymasterEnabled: boolean;
|
|
6
|
+
};
|
|
2
7
|
interface usePaymentModalProps {
|
|
3
8
|
sessionToken: string | null;
|
|
4
9
|
amount?: string;
|
|
@@ -8,14 +13,17 @@ interface usePaymentModalProps {
|
|
|
8
13
|
}) => void;
|
|
9
14
|
farcasterMiniApp?: boolean;
|
|
10
15
|
wagmiConfig?: Config;
|
|
16
|
+
client?: ClientInfo;
|
|
11
17
|
}
|
|
12
|
-
export declare function usePaymentModal({ sessionToken: token, amount: _amount, onCancel, onSuccess, farcasterMiniApp, wagmiConfig, }: usePaymentModalProps): {
|
|
18
|
+
export declare function usePaymentModal({ sessionToken: token, amount: _amount, client: _client, onCancel, onSuccess, farcasterMiniApp, wagmiConfig, }: usePaymentModalProps): {
|
|
13
19
|
sessionToken: string | null;
|
|
14
|
-
updateSession: ({ sessionToken, amount, }: {
|
|
20
|
+
updateSession: ({ sessionToken, amount, client }: {
|
|
15
21
|
sessionToken: string;
|
|
16
22
|
amount?: string;
|
|
23
|
+
client?: ClientInfo;
|
|
17
24
|
}) => void;
|
|
18
25
|
amount: string | undefined;
|
|
26
|
+
client: ClientInfo | undefined;
|
|
19
27
|
isOpen: boolean;
|
|
20
28
|
open: () => void;
|
|
21
29
|
close: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePaymentModal.d.ts","sourceRoot":"","sources":["../../src/hooks/usePaymentModal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,UAAU,oBAAoB;IAC5B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC5D,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"usePaymentModal.d.ts","sourceRoot":"","sources":["../../src/hooks/usePaymentModal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,KAAK,UAAU,GAAG;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,UAAU,oBAAoB;IAC5B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC5D,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED,wBAAgB,eAAe,CAAC,EAC9B,YAAY,EAAE,KAAK,EACnB,MAAM,EAAE,OAAO,EACf,MAAM,EAAE,OAAO,EACf,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,WAAW,GACZ,EAAE,oBAAoB;;sDAMoC;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,UAAU,CAAA;KAAE;;;;;;0BApBjG;QAAE,eAAe,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI;qBAD1C,IAAI;;;EA0DtB"}
|
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.payment-modal-wrapper{position:fixed;inset:0;z-index:10000;height:100dvh;width:100vw;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);background-color:#0008;transition:all .2s ease-out}.payment-modal-wrapper.open{visibility:visible}.payment-modal-wrapper.closed{visibility:hidden;opacity:0;pointer-events:none}.payment-modal-wrapper.closed *{pointer-events:none!important}.payment-modal-wrapper.open iframe{transform:translateY(0);transform:scale(1)}.payment-modal-wrapper.closed iframe{transform:translateY(50vh);transform:scale(1)}.payment-modal-loader{position:absolute;inset:0;z-index:10000;display:grid;height:100%;width:100%;place-content:center}.payment-modal-loader-logo{animation:cr-pulse 1.5s ease-in-out infinite;transform:scale(0);filter:blur(4px);transition:all .3s cubic-bezier(.25,1,.5,1),filter .2s 1.75s ease-out,transform .2s 1.75s ease-out}@keyframes cr-pulse{0%,to{opacity:1}50%{opacity:.5}}@media
|
|
1
|
+
.payment-modal-wrapper{position:fixed;inset:0;z-index:10000;height:100dvh;width:100vw;-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);background-color:#0008;transition:all .2s ease-out}.payment-modal-wrapper.open{visibility:visible}.payment-modal-wrapper.closed{visibility:hidden;opacity:0;pointer-events:none}.payment-modal-wrapper.closed *{pointer-events:none!important}.payment-modal-wrapper.open iframe{transform:translateY(0);transform:scale(1)}.payment-modal-wrapper.closed iframe{transform:translateY(50vh);transform:scale(1)}.payment-modal-loader{position:absolute;inset:0;z-index:10000;display:grid;height:100%;width:100%;place-content:center}.payment-modal-loader-logo{animation:cr-pulse 1.5s ease-in-out infinite;transform:scale(0);filter:blur(4px);transition:all .3s cubic-bezier(.25,1,.5,1),filter .2s 1.75s ease-out,transform .2s 1.75s ease-out}@keyframes cr-pulse{0%,to{opacity:1}50%{opacity:.5}}@media(prefers-color-scheme:dark){.payment-modal-container{background:#141414!important;border-color:#202020!important}}.payment-modal-loader .icon{height:48px;width:48px;animation:cr-spin 1s linear infinite;fill:#2563eb;color:#475569}.payment-modal{position:absolute;bottom:0;left:0;right:0;z-index:10000;height:100%;width:100%;transition:all .3s cubic-bezier(.25,1,.5,1)}.payment-modal.visible{opacity:1}.payment-modal.invisible{opacity:0}@keyframes cr-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.payment-modal-loader-container{position:absolute;bottom:0;left:50%;transform:translate(-50%) scale(.8);width:100%;max-width:28.375rem;border-top-left-radius:1.5rem;border-top-right-radius:1.5rem;pointer-events:none;transform-origin:50% 100%;transition:all .3s cubic-bezier(.25,1,.5,1),opacity .2s 1s ease-out,transform .2s 1s ease-out;opacity:0}.payment-modal-loader.light-mode .payment-modal-loader-container .payment-modal-loader-logo{color:#171717}.payment-modal-loader.dark-mode .payment-modal-loader-container .payment-modal-loader-logo{color:#f0f0f0}.payment-modal-loader-container.light-mode{background:#f8f8f8}.payment-modal-loader-container.dark-mode{background:#141414}.payment-modal-loader-container.no-amount{height:361px}.payment-modal-loader-container.has-amount{height:453.84px}@media(min-width:48rem){.payment-modal-loader-container{bottom:3rem;border-bottom-left-radius:1.5rem;border-bottom-right-radius:1.5rem}.payment-modal-loader-container.no-amount{height:348.98px}.payment-modal-loader-container.has-amount{height:441.82px}}.payment-modal-wrapper.dark-mode .payment-modal-loader-container.dark-mode{background:#141414}.payment-modal-wrapper.light-mode .payment-modal-loader-container.light-mode{background:#f8f8f8}.payment-modal-loader-container.dark-mode .payment-modal-loader{color:#94a3b8}
|
package/dist/sw.js
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chainrails Service Worker
|
|
3
|
+
* Caches the Chainrails modal scripts and resources for faster loading
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const CACHE_NAME = "chainrails-modal-cache-v1.0.0";
|
|
7
|
+
|
|
8
|
+
// Chainrails origins to cache resources from
|
|
9
|
+
const CHAINRAILS_ORIGINS = [
|
|
10
|
+
"https://app.chainrails.io",
|
|
11
|
+
"https://chainrails-frontend-git-staging-horus-labs.vercel.app",
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
// URLs to cache on service worker installation
|
|
15
|
+
const PRECACHE_URLS = [
|
|
16
|
+
"/",
|
|
17
|
+
"/pay/",
|
|
18
|
+
"/deposit/",
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
// Install event - cache the base URLs
|
|
22
|
+
self.addEventListener("install", (event) => {
|
|
23
|
+
event.waitUntil(
|
|
24
|
+
caches.open(CACHE_NAME).then((cache) => {
|
|
25
|
+
// Cache base paths from both origins
|
|
26
|
+
const urlsToCache = [];
|
|
27
|
+
CHAINRAILS_ORIGINS.forEach((origin) => {
|
|
28
|
+
PRECACHE_URLS.forEach((path) => {
|
|
29
|
+
urlsToCache.push(`${origin}${path}`);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
console.log("[Chainrails SW] Caching URLs:", urlsToCache);
|
|
34
|
+
return cache.addAll(urlsToCache);
|
|
35
|
+
}).then(() => {
|
|
36
|
+
console.log("[Chainrails SW] Installed successfully");
|
|
37
|
+
return self.skipWaiting();
|
|
38
|
+
})
|
|
39
|
+
);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// Activate event - clean up old caches
|
|
43
|
+
self.addEventListener("activate", (event) => {
|
|
44
|
+
event.waitUntil(
|
|
45
|
+
caches.keys().then((cacheNames) => {
|
|
46
|
+
return Promise.all(
|
|
47
|
+
cacheNames
|
|
48
|
+
.filter((cacheName) => {
|
|
49
|
+
// Delete old caches that don't match the current version
|
|
50
|
+
return cacheName.startsWith("chainrails-modal-cache-") && cacheName !== CACHE_NAME;
|
|
51
|
+
})
|
|
52
|
+
.map((cacheName) => {
|
|
53
|
+
console.log("[Chainrails SW] Deleting old cache:", cacheName);
|
|
54
|
+
return caches.delete(cacheName);
|
|
55
|
+
})
|
|
56
|
+
);
|
|
57
|
+
}).then(() => {
|
|
58
|
+
console.log("[Chainrails SW] Activated successfully");
|
|
59
|
+
return self.clients.claim();
|
|
60
|
+
})
|
|
61
|
+
);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// Fetch event - serve from cache, fallback to network
|
|
65
|
+
self.addEventListener("fetch", (event) => {
|
|
66
|
+
const url = new URL(event.request.url);
|
|
67
|
+
|
|
68
|
+
// Only cache requests to Chainrails origins
|
|
69
|
+
const isChainrailsOrigin = CHAINRAILS_ORIGINS.some((origin) => {
|
|
70
|
+
try {
|
|
71
|
+
return url.origin === new URL(origin).origin;
|
|
72
|
+
} catch {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
if (!isChainrailsOrigin) {
|
|
78
|
+
// Not a Chainrails request, let it pass through
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Handle different request types
|
|
83
|
+
if (event.request.destination === "document" || event.request.destination === "iframe") {
|
|
84
|
+
// For HTML documents (the modal pages), use network-first strategy
|
|
85
|
+
// This ensures we get fresh content while still caching
|
|
86
|
+
event.respondWith(
|
|
87
|
+
fetch(event.request)
|
|
88
|
+
.then((response) => {
|
|
89
|
+
// Clone the response before caching
|
|
90
|
+
const responseClone = response.clone();
|
|
91
|
+
caches.open(CACHE_NAME).then((cache) => {
|
|
92
|
+
cache.put(event.request, responseClone);
|
|
93
|
+
});
|
|
94
|
+
return response;
|
|
95
|
+
})
|
|
96
|
+
.catch(() => {
|
|
97
|
+
// If network fails, try to serve from cache
|
|
98
|
+
return caches.match(event.request).then((cachedResponse) => {
|
|
99
|
+
if (cachedResponse) {
|
|
100
|
+
return cachedResponse;
|
|
101
|
+
}
|
|
102
|
+
// Return a fallback for HTML requests
|
|
103
|
+
return new Response(
|
|
104
|
+
"<html><body><h1>Chainrails Modal</h1><p>Loading...</p></body></html>",
|
|
105
|
+
{ headers: { "Content-Type": "text/html" } }
|
|
106
|
+
);
|
|
107
|
+
});
|
|
108
|
+
})
|
|
109
|
+
);
|
|
110
|
+
} else {
|
|
111
|
+
// For other resources (JS, CSS, images), use cache-first strategy
|
|
112
|
+
event.respondWith(
|
|
113
|
+
caches.match(event.request).then((cachedResponse) => {
|
|
114
|
+
if (cachedResponse) {
|
|
115
|
+
// Return cached response and update cache in background
|
|
116
|
+
event.waitUntil(
|
|
117
|
+
fetch(event.request).then((response) => {
|
|
118
|
+
caches.open(CACHE_NAME).then((cache) => {
|
|
119
|
+
cache.put(event.request, response);
|
|
120
|
+
});
|
|
121
|
+
}).catch(() => {
|
|
122
|
+
// Ignore network errors for background updates
|
|
123
|
+
})
|
|
124
|
+
);
|
|
125
|
+
return cachedResponse;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Not in cache, fetch from network
|
|
129
|
+
return fetch(event.request).then((response) => {
|
|
130
|
+
// Cache the new response
|
|
131
|
+
const responseClone = response.clone();
|
|
132
|
+
caches.open(CACHE_NAME).then((cache) => {
|
|
133
|
+
cache.put(event.request, responseClone);
|
|
134
|
+
});
|
|
135
|
+
return response;
|
|
136
|
+
});
|
|
137
|
+
})
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
// Handle messages from the main thread
|
|
143
|
+
self.addEventListener("message", (event) => {
|
|
144
|
+
if (event.data && event.data.type === "SKIP_WAITING") {
|
|
145
|
+
self.skipWaiting();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (event.data && event.data.type === "CACHE_URL") {
|
|
149
|
+
// Dynamically cache a specific URL
|
|
150
|
+
const { url } = event.data;
|
|
151
|
+
if (url) {
|
|
152
|
+
caches.open(CACHE_NAME).then((cache) => {
|
|
153
|
+
fetch(url).then((response) => {
|
|
154
|
+
cache.put(url, response);
|
|
155
|
+
console.log("[Chainrails SW] Dynamically cached:", url);
|
|
156
|
+
}).catch((err) => {
|
|
157
|
+
console.error("[Chainrails SW] Failed to cache URL:", url, err);
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (event.data && event.data.type === "CLEAR_CACHE") {
|
|
164
|
+
caches.delete(CACHE_NAME).then((success) => {
|
|
165
|
+
if (success) {
|
|
166
|
+
console.log("[Chainrails SW] Cache cleared");
|
|
167
|
+
// Notify all clients
|
|
168
|
+
self.clients.matchAll().then((clients) => {
|
|
169
|
+
clients.forEach((client) => {
|
|
170
|
+
client.postMessage({ type: "CACHE_CLEARED" });
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
});
|
package/dist/types/index.d.ts
CHANGED
|
@@ -4,6 +4,11 @@ export type PaymentModalStyles = {
|
|
|
4
4
|
accentColor?: string;
|
|
5
5
|
theme?: string;
|
|
6
6
|
};
|
|
7
|
+
export type ClientInfo = {
|
|
8
|
+
logoUrl: string;
|
|
9
|
+
name: string;
|
|
10
|
+
paymasterEnabled: boolean;
|
|
11
|
+
};
|
|
7
12
|
export type PaymentModalProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
8
13
|
sessionToken?: string | null;
|
|
9
14
|
amount?: string;
|
|
@@ -20,6 +25,7 @@ export type PaymentModalProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
20
25
|
}) => void;
|
|
21
26
|
farcasterMiniApp?: boolean;
|
|
22
27
|
wagmiConfig?: Config;
|
|
28
|
+
client?: ClientInfo;
|
|
23
29
|
};
|
|
24
30
|
export type FarcasterSendTransactionParams = {
|
|
25
31
|
to: `0x${string}`;
|
|
@@ -44,5 +50,6 @@ export type SessionAuthPayload = {
|
|
|
44
50
|
supportedChains?: number[];
|
|
45
51
|
};
|
|
46
52
|
css?: string;
|
|
53
|
+
client?: ClientInfo;
|
|
47
54
|
};
|
|
48
55
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG;IACrE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,aAAa,CAAC,EAAE,KAAK,EAAE,CAAC;IACxB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC5D,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,GAAG;IACrE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,aAAa,CAAC,EAAE,KAAK,EAAE,CAAC;IACxB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE;QAAE,eAAe,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC5D,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,EAAE,EAAE,KAAK,MAAM,EAAE,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,KAAK,MAAM,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,8BAA8B,CAAC;CACxC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,SAAS,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,KAAK,EAAE;QACL,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAC7B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;KAC5B,CAAC;IACF,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service Worker utilities for caching Chainrails modal scripts
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Check if service workers are supported in the current browser
|
|
6
|
+
*/
|
|
7
|
+
export declare function isServiceWorkerSupported(): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Register the Chainrails service worker
|
|
10
|
+
* @returns The registration object or null if registration fails
|
|
11
|
+
*/
|
|
12
|
+
export declare function registerServiceWorker(): Promise<ServiceWorkerRegistration | null>;
|
|
13
|
+
/**
|
|
14
|
+
* Unregister all service workers for Chainrails
|
|
15
|
+
*/
|
|
16
|
+
export declare function unregisterServiceWorkers(): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Precache the Chainrails modal URLs
|
|
19
|
+
* This is called by the service worker during installation
|
|
20
|
+
*/
|
|
21
|
+
export declare function getUrlsToCache(): string[];
|
|
22
|
+
/**
|
|
23
|
+
* Check if a request should be cached based on the URL
|
|
24
|
+
*/
|
|
25
|
+
export declare function shouldCache(url: string): boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Get the cache name for Chainrails
|
|
28
|
+
*/
|
|
29
|
+
export declare function getCacheName(): string;
|
|
30
|
+
export declare const CHAINRAILS_CONFIG: {
|
|
31
|
+
VERSION: string;
|
|
32
|
+
CACHE_NAME: string;
|
|
33
|
+
URLS_TO_CACHE: string[];
|
|
34
|
+
ORIGINS: string[];
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=serviceWorker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serviceWorker.d.ts","sourceRoot":"","sources":["../../src/utils/serviceWorker.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CAElD;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CA+BvF;AAED;;GAEG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,IAAI,CAAC,CAc9D;AAkBD;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,EAAE,CAWzC;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAGD,eAAO,MAAM,iBAAiB;;;;;CAK7B,CAAC"}
|