PageSourceSearch

https://izodom.pl/wp-content/plugins/izodom-calculator-v2/assets/js/api-client.js?ver=0.6.0-1790032355

js izodom.pl collected 2026-10-07 14:52:44 UTC 2,374 bytes, 69 lines download raw bytes

1(function (root, factory) {
2  const api = factory();
3  if (typeof module === 'object' && module.exports) module.exports = api;
4  else root.IzoCalculatorApi = api;
5})(typeof globalThis !== 'undefined' ? globalThis : window, function () {
6  'use strict';
7
8  function create(config, fetchImpl, createIdempotencyKey) {
9    const base = String(config.apiBase || '').replace(/\/$/, '');
10
11    async function request(path, method, body) {
12      const headers = { Accept: 'application/json' };
13      if (method !== 'GET') {
14        headers['Content-Type'] = 'application/json';
15        headers['X-WP-Nonce'] = String(config.nonce || '');
16        headers['X-Idempotency-Key'] = createIdempotencyKey();
17      }
18
19      const response = await fetchImpl(base + path, {
20        method,
21        credentials: 'same-origin',
22        headers,
23        body: body === undefined ? undefined : JSON.stringify(body),
24      });
25      const data = await response.json().catch(() => ({}));
26
27      if (!response.ok) {
28        const error = new Error(data.message || 'Nie udało się połączyć z kalkulatorem.');
29        error.code = data.code || 'network_error';
30        throw error;
31      }
32
33      return data;
34    }
35
36    async function multipart(path, body) {
37      const headers = {
38        Accept: 'application/json',
39        'X-WP-Nonce': String(config.nonce || ''),
40        'X-Idempotency-Key': createIdempotencyKey(),
41      };
42      const response = await fetchImpl(base + path, {
43        method: 'POST',
44        credentials: 'same-origin',
45        headers,
46        body,
47      });
48      const data = await response.json().catch(() => ({}));
49
50      if (!response.ok) {
51        const error = new Error(data.message || 'Nie udało się połączyć z kalkulatorem.');
52        error.code = data.code || 'network_error';
53        throw error;
54      }
55
56      return data;
57    }
58
59    return {
60      init: payload => request('/quote/init', 'POST', payload),
61      verify: (challengeId, code) => request('/quote/verify', 'POST', { challengeId, code }),
62      get: token => request('/quote/' + encodeURIComponent(token), 'GET'),
63      recalculate: (token, params) => request('/quote/' + encodeURIComponent(token) + '/recalculate', 'POST', { params }),
64      submitProject: (token, formData) => multipart('/quote/' + encodeURIComponent(token) + '/project', formData),
65    };
66  }
67
68  return { create };
69});

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.