PageSourceSearch

https://www.contrado.fr/estore/sw-estore.js

js contrado.fr collected 2026-09-28 06:06:39 UTC 6,640 bytes, 204 lines download raw bytes

1importScripts('sw-common.js');
2
3
4
5
6
7/*****  Cache the Product 3D Model logic    **************/
8const static3dModelAssets = [
9    ["/GetProduct3DModel?objectName", 30 * 24 * 60 * 60]
10];
11const static3dModelCacheName = cacheNameVersionList.static3dModelCacheName.cacheName + cacheNameVersionList.static3dModelCacheName.version;
12
13static3dModelAssets.forEach((assest) => {
14
15    workbox.routing.registerRoute(
16        ({ request }) => { return assest.some(x => request.url.includes(x)) },
17        new workbox.strategies.CacheFirst({
18            cacheName: static3dModelCacheName,
19            plugins: [
20                new workbox.expiration.ExpirationPlugin({
21                    maxAgeSeconds: assest[1] // 1 Month
22                }),
23                new workbox.expiration.ExpirationPlugin({
24                    maxEntries: 10
25                }),
26            ],
27        })
28    );
29
30});
31/**********************************************************/
32
33
34
35
36/*****   font caching   **************/
37const fontCacheName = 'font-cache';
38const fontcache = [
39    [".woff2", 30 * 24 * 60 * 60],
40    [".woff", 30 * 24 * 60 * 60],
41    ["use.typekit.net", 30 * 24 * 60 * 60],
42    [".ttf", 30 * 24 * 60 * 60],
43    ["fonts.gstatic.com", 30 * 24 * 60 * 60],
44];
45
46fontcache.forEach((assest) => {
47
48
49    workbox.routing.registerRoute(
50        
51        ({ request }) => { return assest.some(x => request.url.includes(x)) },
52        new workbox.strategies.CacheFirst({
53            cacheName: fontCacheName,
54            plugins: [
55                new workbox.cacheableResponse.CacheableResponsePlugin({
56                    statuses: [0, 200]
57                }),
58                new workbox.expiration.ExpirationPlugin({
59                    maxAgeSeconds: assest[1] // 24 hours
60                }),
61            ],
62        })
63        );
64
65    });
66/**********************************************************/
67
68
69/*****   Dependency and Combres axd cache    **************/
70const composeStaticAssets = [
71    ["DependencyHandler.axd", 24 * 60 * 60],
72    ["combres.axd", 24 * 60 * 60],
73    ["webpackstatic", 24 * 60 * 60]
74];
75
76composeStaticAssets.forEach((assest) => {
77
78    workbox.routing.registerRoute(
79        ({ request }) => { return assest.some(x => request.url.includes(x)) },
80        new workbox.strategies.CacheFirst({
81            cacheName: composeStaticCacheName,
82            plugins: [
83                new workbox.cacheableResponse.CacheableResponsePlugin({
84                    statuses: [0, 200]
85                }),
86                new workbox.expiration.ExpirationPlugin({
87                    maxAgeSeconds: assest[1] // 24 hours
88                }),
89            ],
90        })
91    );
92});
93/**********************************************************/
94
95
96
97
98/*****  Image cache    **************/
99
100const staticLayerImagesCacheName = cacheNameVersionList.staticLayerImagesCacheName.cacheName + cacheNameVersionList.staticLayerImagesCacheName.version;
101workbox.routing.registerRoute(
102    new RegExp('^https://raven.*'),
103    new workbox.strategies.CacheFirst({
104        cacheName: staticLayerImagesCacheName,
105        plugins: [
106            new workbox.cacheableResponse.CacheableResponsePlugin({
107                statuses: [0, 200]
108            }),
109            {
110                cacheKeyWillBeUsed: async ({ request, mode, params, event, state }) => {
111                    const url = new URL(request.url);
112                    url.searchParams.delete('ver');
113                    return url.toString();
114                }
115            },
116            new workbox.expiration.ExpirationPlugin({
117                maxEntries: 50,
118                maxAgeSeconds: 30 * 24 * 60 * 60
119            }),
120        ]
121    }),
122);
123/**********************************************************/
124
125const apiList = [
126    "getproduct3dconfiguration?productId",
127    //"GetBodySizeChart?productId",
128    //"GetConversionChart?productId",
129    "getproductconfiguration?productId",
130    "/asset/getimages",
131    "GetBodySizeAndConversionChart?productId",
132];
133
134const apiCacheName = cacheNameVersionList.designAPICacheName.cacheName + cacheNameVersionList.designAPICacheName.version;
135workbox.routing.registerRoute(
136    ({ request }) => { return apiList.some(x => request.url.includes(x)) },
137    new workbox.strategies.StaleWhileRevalidate({
138        cacheName: apiCacheName,
139        plugins: [new workbox.broadcastUpdate.BroadcastUpdatePlugin()],
140    })
141);
142
143
144
145
146
147/*****   Estore Mobile Colibri caching   **************/
148const mobileColibriCacheName = cacheNameVersionList.mobileColibriCache.cacheName + cacheNameVersionList.mobileColibriCache.version;
149const colibrilibcache = [
150    ["libs", 24 * 60 * 60]
151];
152
153colibrilibcache.forEach((assest) => {
154
155
156    workbox.routing.registerRoute(
157
158        ({ request }) => { return assest.some(x => request.url.includes(x)) },
159        new workbox.strategies.CacheFirst({
160            cacheName: mobileColibriCacheName,
161            plugins: [
162                new workbox.cacheableResponse.CacheableResponsePlugin({
163                    statuses: [0, 200]
164                }),
165                new workbox.expiration.ExpirationPlugin({
166                    maxAgeSeconds: assest[1] // 24 hours
167                }),
168            ],
169        })
170    );
171
172});
173/**********************************************************/
174
175/***** Preview Image cache    **************/
176
177const designPreviewImagesapiList = [
178    "/estore/preview/finalpreview?productId",
179    "/estore/preview/FinalPreviewForEditDesign?productId"
180];
181
182const designPreviewImagesCacheName = cacheNameVersionList.designPreviewImagesCacheName.cacheName + cacheNameVersionList.designPreviewImagesCacheName.version;
183workbox.routing.registerRoute(
184    ({ request }) => { return designPreviewImagesapiList.some(x => request.url.includes(x)) },
185    new workbox.strategies.CacheFirst({
186        cacheName: designPreviewImagesCacheName,
187        plugins: [
188            new workbox.cacheableResponse.CacheableResponsePlugin({
189                statuses: [0, 200]
190            }),
191            {
192                cacheKeyWillBeUsed: async ({ request, mode, params, event, state }) => {
193                    const url = new URL(request.url);
194                    url.searchParams.delete('ver');
195                    return url.toString();
196                }
197            },
198            new workbox.expiration.ExpirationPlugin({
199                maxEntries: 25,
200            }),
201        ]
202    }),
203);
204/**********************************************************/

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.