PageSourceSearch

https://dominicanosenbasket.com/wp-content/plugins/website-chat-button-kommo-integration/script.js?ver=1.3.3

js dominicanosenbasket.com collected 2026-10-03 02:33:08 UTC 1,941 bytes, 92 lines download raw bytes

1function json(url) {
2  return fetch(url).then((res) => res.json());
3}
4
5const WOO_CONFIG = {
6  COOKIE_EXPIRATION_DAYS: 365,
7  WOO_CART_HASH: "woocommerce_cart_hash",
8  AMO_LIVECHAT_ID: "amo-livechat-id",
9  INTEGRATION_BASE_URL: "https://woocom.kommo.com",
10};
11
12function isWooCom() {
13  return (
14    window.wcSettings !== undefined ||
15    window.wc_checkout_params !== undefined ||
16    window.wc_order_attribution !== undefined ||
17    window.wc_add_to_cart_params !== undefined ||
18    window.woocommerce_params !== undefined
19  );
20}
21
22function getLiveChatId() {
23  const userId = Cookies.get(WOO_CONFIG.AMO_LIVECHAT_ID);
24
25  if (userId) {
26    return userId;
27  }
28
29  const newUserId = crypto.randomUUID();
30
31  Cookies.set(WOO_CONFIG.AMO_LIVECHAT_ID, newUserId, {
32    expires: WOO_CONFIG.COOKIE_EXPIRATION_DAYS,
33  });
34
35  return newUserId;
36}
37
38/**
39 * @param {String} userId
40 * @param {String|null} cartHash
41 */
42function setMetaFromWooCom(userId, cartHash) {
43  if (window?.wcSettings?.checkoutData?.order_key !== undefined) {
44    // Add postfix to cart hash.
45    cartHash += `_${wcSettings.checkoutData.order_key}`;
46
47    const data = {
48      cart_hash: cartHash,
49      user_id: userId,
50    };
51
52    jQuery.ajax(`${WOO_CONFIG.INTEGRATION_BASE_URL}/woo/livechat-link`, {
53      method: "POST",
54      data,
55      dataType: "json",
56    });
57  }
58
59  crm_plugin.setMeta({
60    contact: {
61      custom_fields: [
62        {
63          code: "WOO_CART_HASH",
64          values: [
65            {
66              value: cartHash,
67            },
68          ],
69        },
70        {
71          code: "WOO_USER_ID",
72          values: [
73            {
74              value: userId,
75            },
76          ],
77        },
78      ],
79    },
80  });
81}
82
83jQuery(document).ready(function () {
84  switch (true) {
85    case isWooCom():
86      const cartHash = Cookies.get(WOO_CONFIG.WOO_CART_HASH);
87      const userId = getLiveChatId();
88
89      setMetaFromWooCom(userId, cartHash);
90      break;
91  }
92});

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.