{"product_id":"product-name-sku-esg-template-do-not-publish-flash-3","title":"Product Name SKU ESG (TEMPLATE - DO NOT PUBLISH - FLASH # 3) - DRAFT OR ARCHIVE STATUS ONLY","description":"\u003cp data-mce-fragment=\"1\"\u003e﻿﻿\u003cbr\u003e\u003c\/p\u003e\n\u003cp data-mce-fragment=\"1\"\u003e\u003cem\u003e\u003cstrong\u003eCovet\u003c\/strong\u003e\u003cstrong\u003e by Christos\u003cspan data-mce-fragment=\"1\"\u003e® \u003c\/span\u003eis not affiliated with the brand of the item shown in this online listing.  We guarantee this is an authentic item and the brand shown on this listing is a registered trademark of that specific brand.\u003c\/strong\u003e\u003c\/em\u003e\u003c\/p\u003e\n\u003cp\u003e\u003cstrong\u003eCovet by Christos\u003c\/strong\u003e\u003cem data-mce-fragment=\"1\"\u003e\u003cstrong data-mce-fragment=\"1\"\u003e\u003cspan data-mce-fragment=\"1\"\u003e® \u003c\/span\u003e\u003c\/strong\u003e\u003c\/em\u003eis a global luxury and vintage shopping network focused on building community and connection.  We are dedicated to providing our customers with the most highly sought after, authenticated pre-owned luxury items and we remain dedicated to the happiness of our customers.\u003c\/p\u003e\n\u003cp\u003eWe believe that authenticity is key in building long-lasting relationships with our customers, and as such, we make the following pledge:\u003c\/p\u003e\n\u003cul\u003e\n\u003cli\u003eWe guarantee authenticity of every single item sold on the Covet by Christos\u003cem data-mce-fragment=\"1\"\u003e\u003cstrong data-mce-fragment=\"1\"\u003e\u003cspan data-mce-fragment=\"1\"\u003e®\u003c\/span\u003e\u003c\/strong\u003e\u003c\/em\u003e platform or your money back.\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cul\u003e\n\u003cli\u003eWe commit to doing everything within our power to assure that each community member is able to make safe, secure, and authentic purchases on the CBC network.\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cul\u003e\n\u003cli\u003eWe stand behind our excellent customer service and your happiness is key to your experience. If you are not completely satisfied with your purchase made on the CBC network, we are committed to making things right.\u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003e\u003cem\u003e\u003cstrong\u003ePlease note all sales are final.\u003c\/strong\u003e\u003c\/em\u003e\u003cbr\u003e\u003c\/p\u003e\n\u003cscript\u003e\n\/\/ Reduces server calls if a product has a crazy number of images.\nconst MAX_IMAGES_COUNT = 6;\n\n\/\/ Extracts product handle from the product URL\nconst SHOPIFY_PRODUCT_URL_HANDLE_REGEX = \/\\\/products\\\/(.[\\w\\d-+]+)\/;\n\n\/\/ Sometimes image URLs miss the protocol at the beginning\n\/\/ E.g. '\/\/cdn.shopify.com\/s\/files\/...\/image.jpg'\nconst urlSanitizer = (url) =\u003e {\nif (typeof url === 'string') {\n  if (url.startsWith('\/\/')) return `https:${url}`;\n  else if (url.toLocaleLowerCase().startsWith('http')) return url;\n  else console.log(`Not a valid URL: ${url}`);\n} else console.log(`Not a valid URL: ${url}`);\nreturn null;\n};\n\n\/\/========== Shopify Ajax API Helper methods ===============\n\nconst storeApi = {};\n\nstoreApi.getProductByUrl = (url) =\u003e {\nconst handle = SHOPIFY_PRODUCT_URL_HANDLE_REGEX.exec(url);\ntry {\n  if (typeof handle[1] == 'string' \u0026\u0026 handle[1].length \u003e 0) {\n    return fetch('\/products\/' + handle[1] + '.js', {\n      method: 'GET',\n      headers: {\n        'Content-Type': 'application\/json',\n      },\n    }).then((resp) =\u003e resp.json());\n  }\n} catch (error) {\n  throw new Error(\n    'Cannot find the handle in the product URL: ' + url + '\/n' + error\n  );\n}\n};\n\nstoreApi.addToCart = (itemId) =\u003e\nfetch('\/cart\/add.js', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application\/json',\n  },\n  body: JSON.stringify({\n    items: [\n      {\n        quantity: 1,\n        id: itemId,\n      },\n    ],\n  }),\n}).then((resp) =\u003e resp.json());\n\nstoreApi.updateItemInCart = (itemId, quantity) =\u003e\nfetch('\/cart\/update.js', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application\/json',\n  },\n  body: JSON.stringify({\n    updates: {\n      [itemId]: quantity,\n    },\n  }),\n}).then((resp) =\u003e resp.json());\n\nstoreApi.getCartState = () =\u003e\nfetch('\/cart.js', {\n  method: 'GET',\n  headers: {\n    'Content-Type': 'application\/json',\n  },\n}).then((resp) =\u003e resp.json());\n\n\/\/=========== Bambuser onReady Handler =================\n\nwindow.onBambuserLiveShoppingReady = (player) =\u003e {\n\/\/ ---- Start of player configuration ----\nconst currency = document.cookie\n  .split('; ')\n  .find((row) =\u003e row.startsWith('cart_currency'));\n\nplayer.configure({\n  currency: (currency \u0026\u0026 currency.split('=')[1]) || 'USD',\n  locale: 'en-US',\n  buttons: {\n    dismiss: player.BUTTON.CLOSE,\n  },\n});\n\/\/ ---- End of player configuration ----\n\n\/\/ ---- Start of Cart Integrations ----\nplayer.on(player.EVENT.ADD_TO_CART, (addedItem, callback) =\u003e {\n  storeApi\n    .addToCart(addedItem.sku)\n    .then((res) =\u003e {\n      if (res.items) {\n        callback(true);\n        console.log('Item added succussfully!');\n      } else if (res.description \u0026\u0026 res.description.includes('sold out')) {\n        callback({ success: false, reason: 'out-of-stock' });\n      } else callback(false);\n    })\n    .catch((error) =\u003e {\n      callback(false);\n      console.error('Add to cart error! ', error);\n    });\n});\n\nplayer.on(player.EVENT.UPDATE_ITEM_IN_CART, (updatedItem, callback) =\u003e {\n  console.log(\n    `Cart updated! ${updatedItem.previousQuantity} --\u003e ${updatedItem.quantity}`\n  );\n  storeApi\n    .updateItemInCart(updatedItem.sku, updatedItem.quantity)\n    .then((res) =\u003e {\n      if (res.items) {\n        callback(true);\n        console.log('Item updated succussfully!');\n      } else callback(false);\n    })\n    .catch((error) =\u003e {\n      callback(false);\n      console.error('Error on updating item! ', error);\n    });\n});\n\nplayer.on(player.EVENT.SYNC_CART_STATE, () =\u003e {\n  \/\/ Use your method to check if the user has checkout\n  storeApi.getCartState().then((res) =\u003e {\n    if (res.item_count == 0) {\n      \/\/ Emptying the in-player cart\n      player.updateCart({\n        items: [],\n      });\n    }\n  });\n});\n\nplayer.on(player.EVENT.CHECKOUT, () =\u003e {\n  \/\/ Use the showCheckout() method to safely\n  \/\/ navigate the user to your checkout page\n  player.showCheckout(window.location.origin + '\/cart');\n});\n\/\/ ---- End of Cart Integrations ----\n\n\/\/ ---- Start of Product Hydration ----\nplayer.on(player.EVENT.PROVIDE_PRODUCT_DATA, (event) =\u003e {\n  \/\/ Iterates over all the products you have added to the show on the dashboard\n  event.products.forEach(({ ref: sku, id, url }) =\u003e {\n    try {\n      \/\/ Your method to fetch a product data\n      storeApi.getProductByUrl(url).then((item) =\u003e {\n        \/\/Uncomment the line below for testing\n        \/\/console.log(item);\n        player.updateProduct(id, (productFactory) =\u003e\n          productFactory.product((detailsFactory) =\u003e\n            detailsFactory\n              .name(item.title)\n              .sku(item.id)\n              .brandName(item.vendor)\n              .description(item.description)\n              .variations((variationFactory) =\u003e\n                item.variants.map((variation) =\u003e\n                  variationFactory()\n                    .attributes((attributeFactory) =\u003e\n                      attributeFactory.colorName(variation.title)\n                    )\n                    .imageUrls([\n                      \/\/ Adding the featured image of the chosen variation (if existed) at the beginning of the images array\n                      ...(variation.featured_image\n                        ? [variation.featured_image.src]\n                        : []),\n                      \/\/ Adding product imgaes\n                      ...item.images\n                        .slice(0, MAX_IMAGES_COUNT - 1)\n                        .map((url) =\u003e urlSanitizer(url))\n                        .filter((url) =\u003e typeof url === 'string'),\n                    ])\n                    .name(variation.title)\n                    .sku(item.id)\n                    .sizes((sizeFactory) =\u003e [\n                      sizeFactory()\n                        .name(variation.title)\n                        .sku(variation.id)\n                        .inStock(variation.available)\n                        .price((priceFactory) =\u003e\n                          priceFactory\n                            .original(variation.compare_at_price \/ 100)\n                            .current(variation.price \/ 100)\n                        ),\n                    ])\n                )\n              )\n          )\n        );\n      });\n    } catch (error) {\n      console.warn('CANNOT HYDRATE THE PRODUCT! \\n', error);\n    }\n  });\n});\n};\n\u003c\/script\u003e","brand":"ESG","offers":[{"title":"Default Title","offer_id":47721376645436,"sku":null,"price":0.0,"currency_code":"USD","in_stock":true}],"url":"https:\/\/invoices.covetbychristos.com\/products\/product-name-sku-esg-template-do-not-publish-flash-3","provider":"Covet By Christos","version":"1.0","type":"link"}