PageSourceSearch

https://www.americaneagle.ae/scripts/appbuilder-client.js

js americaneagle.ae collected 2026-10-02 13:26:01 UTC 1,094 bytes, 46 lines download raw bytes

1import { getConfigValue } from './configs.js';
2
3// Fetch data by calling AppBuilder
4export async function getAppbuilderClient(
5  endpoint,
6  requestData = null,
7  method = 'POST',
8  token = '',
9  appid = '',
10) {
11  let response = null;
12  try {
13    const options = {
14      method,
15      headers: {
16        'Content-Type': 'application/json',
17        Store: await getConfigValue('commerce-store-view-code'),
18        'Alshaya-Channel': 'web',
19        ...(token ? { Authorization: `Bearer ${token}` } : {}),
20        ...(appid ? { appid } : {}),
21      },
22    };
23
24    if (requestData && (method === 'POST' || method === 'PUT')) {
25      options.body = JSON.stringify(requestData);
26    }
27
28    const baseUrl = await getConfigValue('commerce-base-endpoint');
29    const responseData = await fetch(
30      `${baseUrl}/${endpoint}`,
31      options,
32    );
33    response = await responseData.json();
34    if (responseData.data?.message) {
35      response.message = responseData.data.message;
36    }
37  } catch (err) {
38    console.error(err);
39  }
40
41  return {
42    response,
43  };
44}
45
46export default getAppbuilderClient;

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.