UNPKG

@beamimpact/web-sdk

Version:

The Beam SDK enables brands to connect with their customers over shared values, not transactional discounts, to build stronger loyalty. Our integration achieves this by allowing customers to (a) choose a nonprofit where the brand will donate part of their

3 lines (2 loc) 2.44 kB
import{B as v,N as m}from"./beam-errors-P-Lu07Ce.esm.js";import{logger as p}from"../utils/logger.esm.js";var E="1.48.0",N={"@lit/react":"1.0.0","@lukeed/uuid":"2.0.0","@shoelace-style/shoelace":"2.15.0",lit:"2.6.1","lodash-es":"4.17.21","lucide-static":"0.292.0"};async function w(s,o){const c={method:"GET",...o,headers:{"Content-Type":"application/json",Accept:"application/json","X-Beam-Client":"WebSDK","X-Beam-Client-Version":E,...o?.headers},preflightContinue:!0,mode:o?.mode||"cors",body:o?.body!=null?o.body:void 0};let i;try{i=await fetch(s,c)}catch(e){const a=new v(`Network call failed (${c?.method.toUpperCase()} ${s})`);throw a.cause=e,p.error(a,s),a}let r,n;try{n=await i.text(),n&&(r=JSON.parse(n))}catch(e){let a=e;throw e instanceof SyntaxError&&(a=new m(i,r,`Response invalid. Expected JSON. Received: "${n}"`),a.cause=e),p.error(a),a}if(!i.ok){const e=new m(i,r,"Response was not OK");throw p.error(e),e}return r}const u="https://api.beamimpact.com",C="https://production.beamimpactlogs.com",O={en:"en",fr:"fr",de:"de",es:"es",it:"it",pl:"pl"},T={select_nonprofit:"select-nonprofit",redeem_transaction:"redeem-transaction",impact_overview:"impact-overview",community_impact:"community-impact",cumulative_impact:"cumulative-impact",product_details_page:"product-details-page",subscription_management:"subscription-management",subscription_impact:"subscription-impact",select_subscription_nonprofit:"select-subscription-nonprofit",social_share:"social-share"},t=(s,o,c)=>({[s]:async function({headers:i={},baseUrl:r=u,apiRoot:n="/api/v3",pathParams:e={},queryParams:a={},requestBody:d}){const h=Object.entries(e).reduce((S,[y,_])=>S.replace(`{${y}}`,_),s),f=JSON.parse(JSON.stringify(a)),l=new URLSearchParams(f).toString(),b=r+n+h+(l&&`?${l}`),g={headers:i,method:o,body:JSON.stringify(d)};return w(b,g)}})[s],U=t("/impact","get"),A=t("/chain/{chainId}/cumulativeImpact","get"),D=t("/selectNonprofit","post"),L=t("/transaction","post"),P=t("/transaction/{transactionId}","put"),R=t("/cart","post"),k=t("/chain/findEligibleNonprofitsForCart","post"),x=t("/logs","post"),B=t("/experimentSession","post"),I=t("/subscriptions/updateSubscriptionNonprofit","post"),J=t("/subscriptions/findOrCreateSubscription","post"),F=t("/productDetailsPage","get");export{u as D,O as S,T as W,C as a,R as b,x as c,N as d,B as e,k as f,U as g,J as h,D as i,P as j,A as k,F as l,L as p,I as u}; //# sourceMappingURL=routes-Dmf2ZNnZ.esm.js.map