bitsnap-react 1.9.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -7
- package/dist/CartProvider-ONIOELW5.mjs +2 -0
- package/dist/CartProvider-Q3CIVK5K.js +2 -0
- package/dist/CartProvider-Q3CIVK5K.js.map +1 -0
- package/dist/analytics.d.mts +22 -5
- package/dist/analytics.d.ts +22 -5
- package/dist/analytics.js +1 -1
- package/dist/analytics.js.map +1 -1
- package/dist/analytics.mjs +1 -1
- package/dist/catalog.d.mts +1 -1
- package/dist/catalog.d.ts +1 -1
- package/dist/catalog.js +1 -1
- package/dist/catalog.js.map +1 -1
- package/dist/catalog.mjs +1 -1
- package/dist/chunk-7RGH57QG.js +2 -0
- package/dist/chunk-7RGH57QG.js.map +1 -0
- package/dist/chunk-ADYVTMGH.mjs +2 -0
- package/dist/chunk-ADYVTMGH.mjs.map +1 -0
- package/dist/{chunk-FHDFLSPW.js → chunk-ASNUY3EU.js} +2 -2
- package/dist/chunk-ASNUY3EU.js.map +1 -0
- package/dist/{chunk-HKVMSMDF.mjs → chunk-C5Q7DGCD.mjs} +2 -2
- package/dist/{chunk-LJWS6ZRJ.mjs → chunk-C5RMHUOG.mjs} +2 -2
- package/dist/{chunk-KG6RU37U.js → chunk-CUQ2PNCJ.js} +3 -3
- package/dist/chunk-CUQ2PNCJ.js.map +1 -0
- package/dist/{chunk-VXB7LA4E.js → chunk-ELGNOAH4.js} +2 -2
- package/dist/chunk-ELGNOAH4.js.map +1 -0
- package/dist/chunk-EZWH6BB2.mjs +2 -0
- package/dist/chunk-EZWH6BB2.mjs.map +1 -0
- package/dist/{chunk-SLLBTQTW.mjs → chunk-GPNALARZ.mjs} +2 -2
- package/dist/chunk-GT3OH55Y.js +2 -0
- package/dist/chunk-GT3OH55Y.js.map +1 -0
- package/dist/{chunk-SZ256RCC.mjs → chunk-H3YP2QPV.mjs} +2 -2
- package/dist/chunk-HG4YOJWE.mjs +4 -0
- package/dist/chunk-HG4YOJWE.mjs.map +1 -0
- package/dist/chunk-JSDGZ4NY.js.map +1 -1
- package/dist/chunk-KOYBZORL.js.map +1 -1
- package/dist/{chunk-VM6JEJFZ.js → chunk-PUYK4YHE.js} +2 -2
- package/dist/chunk-PUYK4YHE.js.map +1 -0
- package/dist/chunk-T57337WD.mjs +2 -0
- package/dist/chunk-T57337WD.mjs.map +1 -0
- package/dist/{chunk-3IMJALBX.js → chunk-VQQBBSK2.js} +2 -2
- package/dist/chunk-VQQBBSK2.js.map +1 -0
- package/dist/chunk-XIHGWNTS.js +2 -0
- package/dist/chunk-XIHGWNTS.js.map +1 -0
- package/dist/{chunk-GN63ITLA.mjs → chunk-XQ43IC4M.mjs} +2 -2
- package/dist/{chunk-V4U2PTKN.js → chunk-YFETPEI6.js} +2 -2
- package/dist/chunk-YFETPEI6.js.map +1 -0
- package/dist/consent.d.mts +7 -0
- package/dist/consent.d.ts +7 -0
- package/dist/consent.js +29 -15
- package/dist/consent.js.map +1 -1
- package/dist/consent.mjs +29 -15
- package/dist/consent.mjs.map +1 -1
- package/dist/course.d.mts +2 -2
- package/dist/course.d.ts +2 -2
- package/dist/course.js +1 -1
- package/dist/course.js.map +1 -1
- package/dist/course.mjs +1 -1
- package/dist/course.mjs.map +1 -1
- package/dist/embed/analytics.js +1 -1
- package/dist/embed/consent.js +27 -13
- package/dist/errors.js.map +1 -1
- package/dist/index.d.mts +40 -8
- package/dist/index.d.ts +40 -8
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/{instrument-C_abZLHk.d.ts → instrument-CmxK7S4T.d.mts} +22 -5
- package/dist/{instrument-C_abZLHk.d.mts → instrument-CmxK7S4T.d.ts} +22 -5
- package/dist/internal.js.map +1 -1
- package/dist/methods-C5HWYPPN.mjs +2 -0
- package/dist/methods-CHNMFVFV.js +2 -0
- package/dist/methods-CHNMFVFV.js.map +1 -0
- package/dist/models.js.map +1 -1
- package/dist/returns.d.mts +1 -1
- package/dist/returns.d.ts +1 -1
- package/dist/returns.js +1 -1
- package/dist/returns.js.map +1 -1
- package/dist/returns.mjs +1 -1
- package/dist/{types-D_WnqwR_.d.mts → types-BnVWLcoB.d.mts} +1 -1
- package/dist/{types-BaqLJYuq.d.ts → types-i-IuN4Im.d.ts} +1 -1
- package/package.json +2 -2
- package/dist/CartProvider-XWTLBIZ5.js +0 -2
- package/dist/CartProvider-XWTLBIZ5.js.map +0 -1
- package/dist/CartProvider-ZURLJNBW.mjs +0 -2
- package/dist/chunk-3IMJALBX.js.map +0 -1
- package/dist/chunk-3UHPJ6NK.js +0 -2
- package/dist/chunk-3UHPJ6NK.js.map +0 -1
- package/dist/chunk-CO2P4FR5.js +0 -2
- package/dist/chunk-CO2P4FR5.js.map +0 -1
- package/dist/chunk-E6QVQEGZ.mjs +0 -2
- package/dist/chunk-E6QVQEGZ.mjs.map +0 -1
- package/dist/chunk-FHDFLSPW.js.map +0 -1
- package/dist/chunk-KG6RU37U.js.map +0 -1
- package/dist/chunk-LZE2E4TE.mjs +0 -4
- package/dist/chunk-LZE2E4TE.mjs.map +0 -1
- package/dist/chunk-QZJGNLCZ.js +0 -2
- package/dist/chunk-QZJGNLCZ.js.map +0 -1
- package/dist/chunk-RA452LXZ.mjs +0 -2
- package/dist/chunk-RA452LXZ.mjs.map +0 -1
- package/dist/chunk-V4U2PTKN.js.map +0 -1
- package/dist/chunk-VM6JEJFZ.js.map +0 -1
- package/dist/chunk-VXB7LA4E.js.map +0 -1
- package/dist/chunk-XVQKEGPO.mjs +0 -2
- package/dist/chunk-XVQKEGPO.mjs.map +0 -1
- package/dist/methods-CYARZTYL.mjs +0 -2
- package/dist/methods-DAPEWVI6.js +0 -2
- package/dist/methods-DAPEWVI6.js.map +0 -1
- /package/dist/{CartProvider-ZURLJNBW.mjs.map → CartProvider-ONIOELW5.mjs.map} +0 -0
- /package/dist/{chunk-HKVMSMDF.mjs.map → chunk-C5Q7DGCD.mjs.map} +0 -0
- /package/dist/{chunk-LJWS6ZRJ.mjs.map → chunk-C5RMHUOG.mjs.map} +0 -0
- /package/dist/{chunk-SLLBTQTW.mjs.map → chunk-GPNALARZ.mjs.map} +0 -0
- /package/dist/{chunk-SZ256RCC.mjs.map → chunk-H3YP2QPV.mjs.map} +0 -0
- /package/dist/{chunk-GN63ITLA.mjs.map → chunk-XQ43IC4M.mjs.map} +0 -0
- /package/dist/{methods-CYARZTYL.mjs.map → methods-C5HWYPPN.mjs.map} +0 -0
package/dist/embed/analytics.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var BitsnapAnalyticsEmbed=(()=>{var K=Object.defineProperty;var He=Object.getOwnPropertyDescriptor;var De=Object.getOwnPropertyNames;var Ke=Object.prototype.hasOwnProperty;var ze=(e,t)=>{for(var r in t)K(e,r,{get:t[r],enumerable:!0})},qe=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of De(t))!Ke.call(e,s)&&s!==r&&K(e,s,{get:()=>t[s],enumerable:!(n=He(t,s))||n.enumerable});return e};var Ye=e=>qe(K({},"__esModule",{value:!0}),e);var wt={};ze(wt,{dashboardRoute:()=>je,init:()=>Ve});var c={maxBatchEvents:50,maxBodyBytes:65536,maxPropsChars:4096,maxPropString:200,maxPropArray:50,host:253,path:512,referrerHost:253,utm:100,refCode:64,id:64,sdk:64,pageId:32,region:64,osBrowser:32,tsSkewMs:864e5},Ge=["storefront_events","app_events","business_events"],Fe=["live","test"],We=["storefront","sdk_react","script","server","dashboard"],Ze=["hosted","custom_domain","embed","api","panel"],q=["shop","catalog","product","cart","checkout","payment","panel","course","custom_page","order","returns","app","other"];var Xe={storefront_events:["storefront","sdk_react","script"],app_events:["dashboard"],business_events:["server"]},C={value_minor:"number",currency:"string"},be={page_view:{landing:"boolean"},product_list_viewed:{list_id:"string?",item_count:"number"},product_impression:{list_id:"string?",product_ids:"string[]",positions:"number[]"},product_clicked:{list_id:"string?",position:"number?"},product_view:{price_minor:"number",currency:"string",availability:"enum:in_stock|out_of_stock|preorder"},variant_selected:{},add_to_cart:{qty:"number",...C},remove_from_cart:{qty:"number",...C},cart_opened:{item_count:"number",...C},checkout_started:{item_count:"number",checkout_type:"enum:single|cart|link",...C},checkout_step_completed:{step:"enum:contact|delivery|invoice|consents"},checkout_validation_error:{field:"string",rule:"string"},coupon_applied:{coupon_id:"string"},coupon_rejected:{coupon_id:"string?",reason:"string"},delivery_method_selected:{method:"string"},payment_method_selected:{gateway:"string",method:"string"},payment_submitted:{gateway:"string",method:"string"},apple_pay_clicked:{},apple_pay_result:{outcome:"enum:success|fail|cancel"},payment_returned:{gateway:"string",method:"string?",outcome:"enum:success|fail|cancel|pending",error_code:"string?"},availability_signup:{},panel_login:{},panel_order_viewed:{},panel_download:{},return_started:{},return_submitted:{reason_code:"string",item_count:"number"},course_opened:{course_id:"string"},lesson_started:{course_id:"string",lesson_id:"string",position:"number"},lesson_completed:{course_id:"string",lesson_id:"string",position:"number"},video_progress:{course_id:"string",lesson_id:"string",milestone:"number"},test_submitted:{course_id:"string",lesson_id:"string",score_bucket:"enum:0-24|25-49|50-74|75-99|100"},lesson_rated:{course_id:"string",lesson_id:"string",rating:"number"},consent_updated:{consent_id:"string",action:"enum:accept_all|reject_all|custom|withdraw",analytics:"boolean",marketing:"boolean",preferences:"boolean",banner_version:"number"}},ve={app_page_view:{route:"string",previous_route:"string?"},insight_shown:{insight_type:"string",rank:"number",category:"string"},insight_clicked:{insight_type:"string",rank:"number",category:"string"},insight_dismissed:{insight_type:"string",rank:"number",category:"string"},checklist_step_viewed:{step:"string"},checklist_step_completed:{step:"string"},gateway_connect_started:{gateway:"string",step:"string?"},gateway_connect_completed:{gateway:"string",step:"string?"},gateway_connect_failed:{gateway:"string",step:"string?",error_code:"string?"},domain_connect_started:{},domain_connect_verified:{},domain_connect_failed:{error_code:"string?"},product_created:{product_type:"string?"},product_published:{product_type:"string?"},product_editor_section_opened:{section:"string"},feature_enabled:{feature:"string"},stats_viewed:{tab:"string"},stats_filter_changed:{tab:"string",filter:"string"},report_exported:{report:"string",format:"string?"},search_performed:{result_count:"number"},error_shown:{code:"string",route:"string"},help_opened:{topic:"string?"},ai_assistant_used:{topic:"string?"},member_invited:{role:"string"}},I={gateway:"string?",method:"string?",value_minor:"number?",currency:"string?"},S={subscription_id:"string?",value_minor:"number?",currency:"string?"},Ee={transaction_created:I,transaction_success:I,transaction_failure:{...I,error_code:"string?"},transaction_expired:I,transaction_charge:I,subscription_created:S,subscription_paused:S,subscription_resumed:S,subscription_updated:S,subscription_deleted:S,subscription_charge_paid:S,subscription_charge_failed:{...S,error_code:"string?"},subscription_past_due:S,subscription_canceled:S,access_expires_in_3_days:{},access_expired:{},cart_recovery:{value_minor:"number?",currency:"string?"},testimonial_email_send:{},testimonial_fulfilled:{},partner_commission_earned:{partner_id:"string",commission_minor:"number",currency:"string"},checkout_session_created:{item_count:"number",checkout_type:"enum:single|cart|link",gateway:"string?",...C},order_paid:{gateway:"string",method:"string?",item_count:"number?",visitor_day:"string?",items:"line_items?",...C},refund_issued:{gateway:"string?",reason:"string?",...C},return_requested:{item_count:"number",reason_code:"string?"},automation_run_completed:{automation_id:"string",status:"string",trigger:"string?"},notification_sent:{medium:"string",template:"string?"},notification_failed:{medium:"string",template:"string?",error_code:"string?"},recovery_email_sent:{step:"number?"},recovery_link_clicked:{},api_request:{endpoint:"string",client:"string?",status:"number",latency_bucket:"enum:lt_50|lt_200|lt_1000|gte_1000",sample_rate:"number"}};var Qe={...be,...ve,...Ee},Je={storefront_events:Object.keys(be),app_events:Object.keys(ve),business_events:Object.keys(Ee)},ke=Object.fromEntries(Ge.flatMap(e=>Je[e].map(t=>[t,e])));function Se(e){return typeof e=="string"&&Object.hasOwn(ke,e)}var Ct=365*24*60*60;function we(e){let t=e.startsWith("pk_")?e.slice(3):e;return/^[A-Za-z0-9]{1,32}$/.test(t)?t:null}var et=/^([a-z][a-z0-9-]{0,39})@(\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.+-]{1,20})?)$/;function Te(e){if(!e||e.length>c.sdk)return null;let t=et.exec(e);return t?{package:t[1],version:t[2]}:null}var $=c.utm;function R(e,t){if(e==null)return null;let r=e.trim();return r.length===0||r.includes("@")?null:r.slice(0,t)}function O(e){let r=e.split("/").map(n=>n.includes("@")||n.includes("%40")?":email":/^[A-Za-z0-9_-]{24,}$/.test(n)?":token":n).join("/")||"/";return(r.startsWith("/")?r:`/${r}`).slice(0,c.path)}function Y(e,t){let r;try{r=new URL(e,t)}catch{return null}if(r.protocol!=="https:"&&r.protocol!=="http:")return null;let n=r.searchParams;return{host:r.hostname.toLowerCase().slice(0,c.host),path:O(r.pathname),utm_source:R(n.get("utm_source"),$),utm_medium:R(n.get("utm_medium"),$),utm_campaign:R(n.get("utm_campaign"),$),utm_content:R(n.get("utm_content"),$),utm_term:R(n.get("utm_term"),$),ref_code:R(n.get("ref"),c.refCode)}}var tt=/^[A-Za-z0-9_-]{1,64}$/;function Ce(e){if(!e)return null;try{let t=new URL(e);return t.protocol!=="https:"&&t.protocol!=="http:"?null:t.hostname.toLowerCase().slice(0,c.referrerHost)}catch{return null}}var Pt=new TextEncoder;var nt=/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,rt=/^[A-Za-z0-9_-]{8,32}$/,st=/[^\s@]+@[^\s@]+\.[A-Za-z]{2,}\b/;function j(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ot(e,t,r){let n=e[t];return n==null?null:typeof n!="string"?`bad_${t}`:n.length>r?`too_long_${t}`:null}function it(e,t){let n=e.endsWith("?")?e.slice(0,-1):e;if(n.startsWith("enum:"))return typeof t=="string"&&n.slice(5).split("|").includes(t);switch(n){case"string":return typeof t=="string"&&t.length<=c.maxPropString;case"number":return typeof t=="number"&&Number.isFinite(t);case"boolean":return typeof t=="boolean";case"string[]":return Array.isArray(t)&&t.length<=c.maxPropArray&&t.every(s=>typeof s=="string"&&s.length<=c.maxPropString);case"number[]":return Array.isArray(t)&&t.length<=c.maxPropArray&&t.every(s=>typeof s=="number"&&Number.isFinite(s));case"line_items":return Array.isArray(t)&&t.length<=c.maxPropArray&&t.every(s=>j(s)&&typeof s.product_id=="string"&&tt.test(s.product_id)&&he(s.qty)&&he(s.value_minor));default:return!1}}function he(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function at(e){return Te(e)!==null?!1:st.test(e)}function z(e){return typeof e=="string"?at(e):Array.isArray(e)?e.some(z):j(e)?Object.values(e).some(z):!1}function G(e,t){if(!Se(e))return{ok:!1,reason:"unknown_event"};let r=Qe[e];if(!r)return{ok:!1,reason:"unknown_event"};if(!j(t))return{ok:!1,reason:"bad_props"};let n={};for(let[s,u]of Object.entries(r)){let l=t[s];if(l==null){if(!u.endsWith("?"))return{ok:!1,reason:`props_missing_${s}`};continue}if(!it(u,l))return{ok:!1,reason:`props_bad_${s}`};if(z(l))return{ok:!1,reason:`props_pii_${s}`};n[s]=u.startsWith("line_items")&&Array.isArray(l)?l.map(f=>({product_id:f.product_id,qty:f.qty,value_minor:f.value_minor})):l}return JSON.stringify(n).length>c.maxPropsChars?{ok:!1,reason:"props_too_large"}:{ok:!0,props:n}}function Pe(e,t={}){var f;let r=(f=t.from)!=null?f:"browser",n=g=>({ok:!1,reason:g});if(!j(e))return n("not_object");if(typeof e.event_id!="string"||!nt.test(e.event_id))return n("bad_event_id");if(!Se(e.event))return n("unknown_event");let s=ke[e.event];if(r==="browser"){if(s==="business_events")return n("server_only_event");if(e.event==="consent_updated")return n("consent_via_consent_endpoint")}if(typeof e.ts!="number"||!Number.isInteger(e.ts)||e.ts<=0||e.ts>4e12)return n("bad_ts");if(e.schema_version!==1)return n("bad_schema_version");if(!Fe.includes(e.env))return n("bad_env");if(!We.includes(e.source))return n("bad_source");if(!Xe[s].includes(e.source))return n("source_not_allowed_for_event");if(!Ze.includes(e.channel))return n("bad_channel");if(e.sdk!=null&&(typeof e.sdk!="string"||Te(e.sdk)===null))return n("bad_sdk");if(e.page_id!=null&&(typeof e.page_id!="string"||!rt.test(e.page_id)))return n("bad_page_id");if(e.page_type!=null&&!q.includes(e.page_type))return n("bad_page_type");if(r==="browser"){if(typeof e.host!="string"||e.host.length===0)return n("bad_host");if(typeof e.path!="string"||!e.path.startsWith("/"))return n("bad_path")}if(typeof e.path=="string"&&e.path.includes("?"))return n("path_has_query");if(typeof e.path=="string"&&e.path.includes("#"))return n("path_has_fragment");let u=[["host",c.host],["path",c.path],["referrer_host",c.referrerHost],["utm_source",c.utm],["utm_medium",c.utm],["utm_campaign",c.utm],["utm_content",c.utm],["utm_term",c.utm],["ref_code",c.refCode],["product_id",c.id],["variant_id",c.id],["order_ref",c.id]];for(let[g,y]of u){let T=ot(e,g,y);if(T)return n(T)}if(e.visitor_id!=null&&(typeof e.visitor_id!="string"||!/^[A-Za-z0-9_-]{22}$/.test(e.visitor_id)))return n("bad_visitor_id");let l=G(e.event,e.props);return l.ok?{ok:!0}:n(l.reason)}var Ne="1.9.0";var ut="https://collect.bitsnap.pl",lt=5e3,pt=20,Ae=32*1024,dt=60*1024,xe=/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function Re(e){return typeof TextEncoder=="function"?new TextEncoder().encode(e).length:unescape(encodeURIComponent(e)).length}var L={track(){},page(){},flush(){},setEnabled(){},onEvent:()=>()=>{},configure(){},destroy(){}};function Ie(e){let t=new Uint8Array(e),r=typeof crypto!="undefined"?crypto:void 0;if(r&&typeof r.getRandomValues=="function")r.getRandomValues(t);else for(let n=0;n<e;n++)t[n]=Math.floor(Math.random()*256);return t}function _t(e=Date.now()){let t=Ie(16),r=e;for(let s=5;s>=0;s--)t[s]=r%256,r=Math.floor(r/256);t[6]=t[6]&15|112,t[8]=t[8]&63|128;let n=Array.from(t,s=>s.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}var Oe="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function ft(){return Array.from(Ie(16),e=>Oe[e%Oe.length]).join("")}function $e(e){return typeof e=="string"&&q.includes(e)}function gt(e,t,r=!1){let n=Re(JSON.stringify({k:e,events:[]})),s=[],u=[],l=n,f=()=>{u.length>0&&s.push({body:JSON.stringify({k:e,events:u}),bytes:l,count:u.length}),u=[],l=n};for(let g of t){let y=Re(JSON.stringify(g));n+y>Ae||((u.length>=c.maxBatchEvents||l+y+(u.length>0?1:0)>Ae)&&f(),l+=y+(u.length>0?1:0),u.push(g))}if(f(),r){let g=0,y=s.length;for(;y>0&&g+s[y-1].bytes<=dt;)g+=s[y-1].bytes,y--;s=s.slice(y)}return s}function Le(e){try{return typeof window=="undefined"||typeof document=="undefined"?L:mt(e,window)}catch{return L}}function mt(e,t){var ne,re,se,oe;let r=we((ne=e.projectKey)!=null?ne:""),n=!!e.debug,s=(...o)=>{n&&console.warn("[bitsnap analytics]",...o)};if(!r)return s("invalid projectKey, tracking is off"),L;let u=r,l=o=>`${(o||ut).replace(/\/+$/,"")}/e`,f=l(e.endpoint),g=(re=e.source)!=null?re:"sdk_react",y=(se=e.channel)!=null?se:"embed",T=`bitsnap-react@${Ne}`,w=ft(),a=Y(t.location.href),P=(oe=e.env)!=null?oe:"live";if(!e.env)try{new URLSearchParams(t.location.search).has("test")&&(P="test")}catch{}let U=Ce(document.referrer),_=e.enabled!==!1,h=null,b=0,p=[],d=null,v=new Set;e.onEvent&&v.add(e.onEvent);let k=[],E,N=!0;function F(){var m;let o=t.BitsnapConsent;!o||o===E||(E=o,N=!o.ready,(m=o.ready)==null||m.then(()=>{E===o&&(N=!0,X())},()=>{E===o&&(N=!0)}))}function W(){F();try{if(!E)return!1;let o=E.get();return!!E.denied&&E.denied("analytics")||!!o&&o.c.analytics===!1}catch{return!1}}function Z(o){v.forEach(m=>{try{m(o)}catch{}})}function X(){if(W())p=[],k=[],B();else{if(N&&k.length>0){let o=k;k=[],o.forEach(Z)}p.length>0&&A()}}function Q(){if(!_)return!1;let o=t.navigator;return o&&(o.globalPrivacyControl===!0||o.webdriver===!0)?!1:!W()}function B(){d!==null&&clearTimeout(d),d=null}function Ue(){var o;d===null&&(d=setTimeout(()=>{d=null,A()},lt),(o=d.unref)==null||o.call(d))}function Me(o){try{if(typeof fetch=="function"){fetch(f,{method:"POST",body:o,keepalive:!0,credentials:"omit",headers:{"Content-Type":"text/plain"}}).catch(()=>{});return}}catch{}try{let m=t.navigator;m&&typeof m.sendBeacon=="function"&&m.sendBeacon(f,new Blob([o],{type:"text/plain"}))}catch{}}function A(o=!1){try{if(B(),p.length===0)return;if(!Q()){p=[];return}if(!N)return;let m=p;p=[],gt(u,m,o).forEach(i=>Me(i.body))}catch{}}function J(o,m,i){var ae,ce,ue,le,pe,de,_e,fe,ge,me,ye;if(!Q())return;let M=G(o,m);if(!M.ok){s("dropped",o,M.reason);return}let x=Y(t.location.href),H={event_id:i!=null&&i.event_id&&xe.test(i.event_id)?i.event_id:_t(),event:o,ts:Date.now(),schema_version:1,env:P,source:g,channel:y,sdk:T,page_id:w,page_type:(i==null?void 0:i.page_type)!==void 0?i.page_type:h,host:(ae=x==null?void 0:x.host)!=null?ae:null,path:i!=null&&i.path?O(i.path.split(/[?#]/)[0]):(ce=x==null?void 0:x.path)!=null?ce:null,referrer_host:U,utm_source:(ue=a==null?void 0:a.utm_source)!=null?ue:null,utm_medium:(le=a==null?void 0:a.utm_medium)!=null?le:null,utm_campaign:(pe=a==null?void 0:a.utm_campaign)!=null?pe:null,utm_content:(de=a==null?void 0:a.utm_content)!=null?de:null,utm_term:(_e=a==null?void 0:a.utm_term)!=null?_e:null,ref_code:(fe=a==null?void 0:a.ref_code)!=null?fe:null,product_id:(ge=i==null?void 0:i.product_id)!=null?ge:null,variant_id:(me=i==null?void 0:i.variant_id)!=null?me:null,order_ref:(ye=i==null?void 0:i.order_ref)!=null?ye:null,props:M.props};i!=null&&i.event_id&&!xe.test(i.event_id)&&s("ignored invalid event_id",o),g==="dashboard"&&e.visitorId&&(H.visitor_id=e.visitorId);let ie=Pe(H);if(!ie.ok){s("dropped",o,ie.reason);return}let D=H;N?Z(D):k.push(D),p.push(D),p.length>=pt?A():Ue()}let ee=()=>A(!0),te=()=>{document.visibilityState==="hidden"&&A(!0)},V=()=>X();return t.addEventListener("pagehide",ee),document.addEventListener("visibilitychange",te),t.addEventListener("bitsnap:consent",V),t.addEventListener("bitsnap:consent:ready",V),F(),{track(o,m,i){try{J(o,m,i)}catch{}},page(o,m){try{o!==void 0&&(h=o),J("page_view",{landing:b++===0},m)}catch{}},flush:()=>A(),setEnabled(o){_=!!o,_||(p=[],k=[],B())},configure(o){try{(o.env==="live"||o.env==="test")&&(P=o.env),typeof o.endpoint=="string"&&o.endpoint&&(f=l(o.endpoint))}catch{}},onEvent(o){return v.add(o),()=>void v.delete(o)},destroy(){p=[],k=[],B(),v.clear(),t.removeEventListener("pagehide",ee),document.removeEventListener("visibilitychange",te),t.removeEventListener("bitsnap:consent",V),t.removeEventListener("bitsnap:consent:ready",V)}}}var yt=["storefront","dashboard","script"],ht=["hosted","custom_domain","embed","panel"],bt=/^[A-Za-z0-9_-]{22}$/;function Be(e,t,r){return e.includes(t)?t:r}function Ve(e){try{if(typeof window=="undefined")return;let t=window.bitsnap;if(t!=null&&t.loaded)return t;let r=_=>(e==null?void 0:e.getAttribute(`data-${_}`))||void 0,n=r("env"),s=Be(yt,r("source"),"script"),u=Be(ht,r("channel"),"embed"),l=s==="dashboard",f=r("visitor-id"),g=r("project")?Le({projectKey:r("project"),env:n==="live"||n==="test"?n:void 0,endpoint:r("endpoint"),source:s,channel:u,visitorId:l&&f&&bt.test(f)?f:void 0}):L,y=r("route-template"),T=r("page-type"),w=$e(T)?T:void 0,a;if(l){let _=w!=null?w:"app",h;a={track:(b,p,d)=>{var v;return g.track(b,p,{...d,page_type:(v=d==null?void 0:d.page_type)!=null?v:_})},page:(b,p)=>{var v,k,E;let d=O(((k=(v=p==null?void 0:p.path)!=null?v:y)!=null?k:je(location.pathname)).split(/[?#]/)[0]);g.track("app_page_view",h&&h!==d?{route:d,previous_route:h}:{route:d},{...p,page_type:(E=b!=null?b:p==null?void 0:p.page_type)!=null?E:_,path:d}),h=d},loaded:!0}}else a={track:(_,h,b)=>g.track(_,h,b),page:(_,h)=>g.page(_!=null?_:w,h),loaded:!0};let P=_=>{try{let[h,...b]=Array.prototype.slice.call(_);(h==="track"||h==="page")&&a[h](...b)}catch{}},U=Array.isArray(t==null?void 0:t.q)?t.q:[];return window.bitsnap=a,U.forEach(P),a.q={push(..._){return _.forEach(P),0}},r("auto")!=="off"&&(a.page(w),St(()=>a.page(w))),a}catch{return}}var vt=new Set(["products","orders","customers","coupons","discounts","projects","users","members","invoices","returns","carts","subscriptions","pages","posts","courses","lessons","notifications","automations","webhooks","integrations","themes","newsletters","campaigns","forms","categories","collections","variants","tags","reviews","templates","payments","shipping","tests","partners"]),Et=new Set(["new","create","add","edit","import","export","list","settings","stats","overview","all","archive","archived","drafts","preview","duplicate","bulk","search"]),kt=/^[A-Za-z0-9_]{3,24}$/;function je(e){let t=O(e).split("/");return t.map((r,n)=>{var u;if(!r||r.startsWith(":"))return r;if(/\d/.test(r))return":id";let s=(u=t[n-1])==null?void 0:u.toLowerCase();return s&&vt.has(s)&&!Et.has(r.toLowerCase())&&kt.test(r)?":id":r}).join("/")}function St(e){let t=location.pathname,r=()=>{try{if(location.pathname===t)return;t=location.pathname,e()}catch{}};for(let n of["pushState","replaceState"]){let s=history[n];history[n]=function(...u){let l=s.apply(this,u);return r(),l}}window.addEventListener("popstate",r)}typeof document!="undefined"&&Ve(document.currentScript);return Ye(wt);})();
|
|
1
|
+
"use strict";var BitsnapAnalyticsEmbed=(()=>{var F=Object.defineProperty;var tt=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var rt=Object.prototype.hasOwnProperty;var ot=(e,t)=>{for(var n in t)F(e,n,{get:t[n],enumerable:!0})},it=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of nt(t))!rt.call(e,o)&&o!==n&&F(e,o,{get:()=>t[o],enumerable:!(r=tt(t,o))||r.enumerable});return e};var st=e=>it(F({},"__esModule",{value:!0}),e);var Kt={};ot(Kt,{dashboardRoute:()=>Je,init:()=>Xe});var l={maxBatchEvents:50,maxBodyBytes:65536,maxPropsChars:4096,maxPropString:200,maxPropArray:50,host:253,path:512,referrerHost:253,utm:100,refCode:64,id:64,sdk:64,pageId:32,region:64,osBrowser:32,tsSkewMs:864e5},at=["storefront_events","app_events","business_events"],ct=["live","test"],ut=["storefront","sdk_react","script","server","dashboard"],lt=["hosted","custom_domain","embed","api","panel"],J=["shop","catalog","product","cart","checkout","payment","panel","course","custom_page","order","returns","app","other"];var pt={storefront_events:["storefront","sdk_react","script"],app_events:["dashboard"],business_events:["server"]},A={value_minor:"number",currency:"string"},$e={page_view:{landing:"boolean"},product_list_viewed:{list_id:"string?",item_count:"number"},product_impression:{list_id:"string?",product_ids:"string[]",positions:"number[]"},product_clicked:{list_id:"string?",position:"number?"},product_view:{price_minor:"number",currency:"string",availability:"enum:in_stock|out_of_stock|preorder"},variant_selected:{},add_to_cart:{qty:"number",...A},remove_from_cart:{qty:"number",...A},cart_opened:{item_count:"number",...A},checkout_started:{item_count:"number",checkout_type:"enum:single|cart|link",...A},checkout_step_completed:{step:"enum:contact|delivery|invoice|consents"},checkout_validation_error:{field:"string",rule:"string"},coupon_applied:{coupon_id:"string"},coupon_rejected:{coupon_id:"string?",reason:"string"},delivery_method_selected:{method:"string"},payment_method_selected:{gateway:"string",method:"string"},payment_submitted:{gateway:"string",method:"string"},apple_pay_clicked:{},apple_pay_result:{outcome:"enum:success|fail|cancel"},payment_returned:{gateway:"string",method:"string?",outcome:"enum:success|fail|cancel|pending",error_code:"string?"},availability_signup:{},panel_login:{},panel_order_viewed:{},panel_download:{},return_started:{},return_submitted:{reason_code:"string",item_count:"number"},course_opened:{course_id:"string"},lesson_started:{course_id:"string",lesson_id:"string",position:"number"},lesson_completed:{course_id:"string",lesson_id:"string",position:"number"},video_progress:{course_id:"string",lesson_id:"string",milestone:"number"},test_submitted:{course_id:"string",lesson_id:"string",score_bucket:"enum:0-24|25-49|50-74|75-99|100"},lesson_rated:{course_id:"string",lesson_id:"string",rating:"number"},consent_updated:{consent_id:"string",action:"enum:accept_all|reject_all|custom|withdraw",analytics:"boolean",marketing:"boolean",preferences:"boolean",banner_version:"number"}},Ie={app_page_view:{route:"string",previous_route:"string?"},insight_shown:{insight_type:"string",rank:"number",category:"string"},insight_clicked:{insight_type:"string",rank:"number",category:"string"},insight_dismissed:{insight_type:"string",rank:"number",category:"string"},checklist_step_viewed:{step:"string"},checklist_step_completed:{step:"string"},gateway_connect_started:{gateway:"string",step:"string?"},gateway_connect_completed:{gateway:"string",step:"string?"},gateway_connect_failed:{gateway:"string",step:"string?",error_code:"string?"},domain_connect_started:{},domain_connect_verified:{},domain_connect_failed:{error_code:"string?"},product_created:{product_type:"string?"},product_published:{product_type:"string?"},product_editor_section_opened:{section:"string"},feature_enabled:{feature:"string"},stats_viewed:{tab:"string"},stats_filter_changed:{tab:"string",filter:"string"},report_exported:{report:"string",format:"string?"},search_performed:{result_count:"number"},error_shown:{code:"string",route:"string"},help_opened:{topic:"string?"},ai_assistant_used:{topic:"string?"},member_invited:{role:"string"}},R={gateway:"string?",method:"string?",value_minor:"number?",currency:"string?"},C={subscription_id:"string?",value_minor:"number?",currency:"string?"},Oe={transaction_created:R,transaction_success:R,transaction_failure:{...R,error_code:"string?"},transaction_expired:R,transaction_charge:R,subscription_created:C,subscription_paused:C,subscription_resumed:C,subscription_updated:C,subscription_deleted:C,subscription_charge_paid:C,subscription_charge_failed:{...C,error_code:"string?"},subscription_past_due:C,subscription_canceled:C,access_expires_in_3_days:{},access_expired:{},cart_recovery:{value_minor:"number?",currency:"string?"},testimonial_email_send:{},testimonial_fulfilled:{},partner_commission_earned:{partner_id:"string",commission_minor:"number",currency:"string"},checkout_session_created:{item_count:"number",checkout_type:"enum:single|cart|link",gateway:"string?",...A},order_paid:{gateway:"string",method:"string?",item_count:"number?",visitor_day:"string?",items:"line_items?",...A},refund_issued:{gateway:"string?",reason:"string?",...A},return_requested:{item_count:"number",reason_code:"string?"},automation_run_completed:{automation_id:"string",status:"string",trigger:"string?"},notification_sent:{medium:"string",template:"string?"},notification_failed:{medium:"string",template:"string?",error_code:"string?"},recovery_email_sent:{step:"number?"},recovery_link_clicked:{},api_request:{endpoint:"string",client:"string?",status:"number",latency_bucket:"enum:lt_50|lt_200|lt_1000|gte_1000",sample_rate:"number"}};var dt={...$e,...Ie,...Oe},ft={storefront_events:Object.keys($e),app_events:Object.keys(Ie),business_events:Object.keys(Oe)},Re=Object.fromEntries(at.flatMap(e=>ft[e].map(t=>[t,e])));function Ve(e){return typeof e=="string"&&Object.hasOwn(Re,e)}var qt=365*24*60*60;function Q(e){let t=e.startsWith("pk_")?e.slice(3):e;return/^[A-Za-z0-9]{1,32}$/.test(t)?t:null}var gt=/^([a-z][a-z0-9-]{0,39})@(\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.+-]{1,20})?)$/;function Le(e){if(!e||e.length>l.sdk)return null;let t=gt.exec(e);return t?{package:t[1],version:t[2]}:null}var V=l.utm;function I(e,t){if(e==null)return null;let n=e.trim();return n.length===0||n.includes("@")?null:n.slice(0,t)}function O(e){let n=e.split("/").map(r=>r.includes("@")||r.includes("%40")?":email":/^[A-Za-z0-9_-]{24,}$/.test(r)?":token":r).join("/")||"/";return(n.startsWith("/")?n:`/${n}`).slice(0,l.path)}function ee(e,t){let n;try{n=new URL(e,t)}catch{return null}if(n.protocol!=="https:"&&n.protocol!=="http:")return null;let r=n.searchParams;return{host:n.hostname.toLowerCase().slice(0,l.host),path:O(n.pathname),utm_source:I(r.get("utm_source"),V),utm_medium:I(r.get("utm_medium"),V),utm_campaign:I(r.get("utm_campaign"),V),utm_content:I(r.get("utm_content"),V),utm_term:I(r.get("utm_term"),V),ref_code:I(r.get("ref"),l.refCode)}}var mt=/^[A-Za-z0-9_-]{1,64}$/;function Be(e){if(!e)return null;try{let t=new URL(e);return t.protocol!=="https:"&&t.protocol!=="http:"?null:t.hostname.toLowerCase().slice(0,l.referrerHost)}catch{return null}}var Gt=new TextEncoder;function j(e){return`bs_vid_${e}`}var _t=/^[A-Za-z0-9_-]{22}$/;var yt=/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,ht=/^[A-Za-z0-9_-]{8,32}$/,bt=/[^\s@]+@[^\s@]+\.[A-Za-z]{2,}\b/;function H(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function vt(e,t,n){let r=e[t];return r==null?null:typeof r!="string"?`bad_${t}`:r.length>n?`too_long_${t}`:null}function Et(e,t){let r=e.endsWith("?")?e.slice(0,-1):e;if(r.startsWith("enum:"))return typeof t=="string"&&r.slice(5).split("|").includes(t);switch(r){case"string":return typeof t=="string"&&t.length<=l.maxPropString;case"number":return typeof t=="number"&&Number.isFinite(t);case"boolean":return typeof t=="boolean";case"string[]":return Array.isArray(t)&&t.length<=l.maxPropArray&&t.every(o=>typeof o=="string"&&o.length<=l.maxPropString);case"number[]":return Array.isArray(t)&&t.length<=l.maxPropArray&&t.every(o=>typeof o=="number"&&Number.isFinite(o));case"line_items":return Array.isArray(t)&&t.length<=l.maxPropArray&&t.every(o=>H(o)&&typeof o.product_id=="string"&&mt.test(o.product_id)&&Ne(o.qty)&&Ne(o.value_minor));default:return!1}}function Ne(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}function kt(e){return Le(e)!==null?!1:bt.test(e)}function X(e){return typeof e=="string"?kt(e):Array.isArray(e)?e.some(X):H(e)?Object.values(e).some(X):!1}function te(e,t){if(!Ve(e))return{ok:!1,reason:"unknown_event"};let n=dt[e];if(!n)return{ok:!1,reason:"unknown_event"};if(!H(t))return{ok:!1,reason:"bad_props"};let r={};for(let[o,s]of Object.entries(n)){let c=t[o];if(c==null){if(!s.endsWith("?"))return{ok:!1,reason:`props_missing_${o}`};continue}if(!Et(s,c))return{ok:!1,reason:`props_bad_${o}`};if(X(c))return{ok:!1,reason:`props_pii_${o}`};r[o]=s.startsWith("line_items")&&Array.isArray(c)?c.map(d=>({product_id:d.product_id,qty:d.qty,value_minor:d.value_minor})):c}return JSON.stringify(r).length>l.maxPropsChars?{ok:!1,reason:"props_too_large"}:{ok:!0,props:r}}function De(e,t={}){var d;let n=(d=t.from)!=null?d:"browser",r=g=>({ok:!1,reason:g});if(!H(e))return r("not_object");if(typeof e.event_id!="string"||!yt.test(e.event_id))return r("bad_event_id");if(!Ve(e.event))return r("unknown_event");let o=Re[e.event];if(n==="browser"){if(o==="business_events")return r("server_only_event");if(e.event==="consent_updated")return r("consent_via_consent_endpoint")}if(typeof e.ts!="number"||!Number.isInteger(e.ts)||e.ts<=0||e.ts>4e12)return r("bad_ts");if(e.schema_version!==1)return r("bad_schema_version");if(!ct.includes(e.env))return r("bad_env");if(!ut.includes(e.source))return r("bad_source");if(!pt[o].includes(e.source))return r("source_not_allowed_for_event");if(!lt.includes(e.channel))return r("bad_channel");if(e.sdk!=null&&(typeof e.sdk!="string"||Le(e.sdk)===null))return r("bad_sdk");if(e.page_id!=null&&(typeof e.page_id!="string"||!ht.test(e.page_id)))return r("bad_page_id");if(e.page_type!=null&&!J.includes(e.page_type))return r("bad_page_type");if(n==="browser"){if(typeof e.host!="string"||e.host.length===0)return r("bad_host");if(typeof e.path!="string"||!e.path.startsWith("/"))return r("bad_path")}if(typeof e.path=="string"&&e.path.includes("?"))return r("path_has_query");if(typeof e.path=="string"&&e.path.includes("#"))return r("path_has_fragment");let s=[["host",l.host],["path",l.path],["referrer_host",l.referrerHost],["utm_source",l.utm],["utm_medium",l.utm],["utm_campaign",l.utm],["utm_content",l.utm],["utm_term",l.utm],["ref_code",l.refCode],["product_id",l.id],["variant_id",l.id],["order_ref",l.id]];for(let[g,y]of s){let T=vt(e,g,y);if(T)return r(T)}if(e.visitor_id!=null&&(typeof e.visitor_id!="string"||!/^[A-Za-z0-9_-]{22}$/.test(e.visitor_id)))return r("bad_visitor_id");if(e.client_id!=null&&(typeof e.client_id!="string"||!_t.test(e.client_id)))return r("bad_client_id");let c=te(e.event,e.props);return c.ok?{ok:!0}:r(c.reason)}var Me="1.11.0";var ne=Symbol.for("bitsnap.pageViews");function St(e){var n;let t=e;return(n=t[ne])!=null?n:t[ne]={path:null,starters:new Set,watching:!1}}function Ct(e,t){let n=()=>{try{t()}catch{}};for(let r of["pushState","replaceState"]){let o=e.history[r];e.history[r]=function(...s){let c=o.apply(this,s);return n(),c}}e.addEventListener("popstate",n)}function re(e,t=window){try{let n=St(t),r=()=>e();n.watching||(n.watching=!0,Ct(t,()=>{var c,d;let s=t.location.pathname;s===n.path||n.starters.size===0||(n.path=s,(d=(c=n.starters.values().next()).value)==null||d.call(c))})),n.starters.add(r);let o=t.location.pathname;return o!==n.path&&(n.path=o,r()),()=>void n.starters.delete(r)}catch{return()=>{}}}function L(e){let t=new Uint8Array(e),n=typeof crypto!="undefined"?crypto:void 0;if(n&&typeof n.getRandomValues=="function")n.getRandomValues(t);else for(let r=0;r<e;r++)t[r]=Math.floor(Math.random()*256);return t}function oe(e){if(!e||/^[\d.]+$/.test(e)||e.includes(":"))return[];let t=e.split("."),n=[];for(let r=0;r<=t.length-2;r++)n.push(t.slice(r).join("."));return n}var wt=390*24*60*60,Tt=/^[A-Za-z0-9_-]{22}$/;function z(e){return e.BitsnapConsent}function xt(e,t){for(let n of e.cookie.split(";")){let r=n.indexOf("=");if(r!==-1&&n.slice(0,r).trim()===t)return n.slice(r+1).trim()}return null}function At(e){let t=e.toLowerCase();return t==="bitsnap.pl"||t.endsWith(".bitsnap.pl")}function ie(e,t){try{let n=z(e);if(!n)return!1;if(n.scope==="project")return n.projectKey===t;let r=At(e.location.hostname);return n.scope==="global"?!r:!1}catch{return!1}}function se(e,t){var n,r;try{return((r=(n=z(e))==null?void 0:n.get())==null?void 0:r.c.analytics)===!0&&ie(e,t)}catch{return!1}}function Ue(){let e="";return L(16).forEach(t=>e+=String.fromCharCode(t)),btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function je(e,t){try{return xt(e,j(t))}catch{return null}}function K(e,t){let n=je(e,t);return n!==null&&Tt.test(n)?n:null}function He(e,t,n){try{let r=e.document,o=`${j(t)}=${n}; Max-Age=${wt}; Path=/; SameSite=Lax`+(e.location.protocol==="https:"?"; Secure":"");for(let s of oe(e.location.hostname).reverse())if(r.cookie=`${o}; Domain=${s}`,K(r,t)===n)return;r.cookie=o}catch{}}function ze(e,t){try{let n=e.document;if(je(n,t)===null)return;let r=`${j(t)}=; Max-Age=0; Path=/; SameSite=Lax`+(e.location.protocol==="https:"?"; Secure":"");n.cookie=r;for(let o of oe(e.location.hostname))n.cookie=`${r}; Domain=${o}`}catch{}}function ae(e,t){try{let n=e.navigator;return(n==null?void 0:n.globalPrivacyControl)===!0||(n==null?void 0:n.webdriver)===!0?null:se(e,t)?K(e.document,t):null}catch{return null}}var Nt="https://collect.bitsnap.pl",$t=5e3,It=20,Ke=32*1024,Ot=60*1024,We=/^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;function qe(e){return typeof TextEncoder=="function"?new TextEncoder().encode(e).length:unescape(encodeURIComponent(e)).length}var B={track(){},page(){},clientId:()=>null,flush(){},setEnabled(){},onEvent:()=>()=>{},configure(){},destroy(){}};function Rt(e=Date.now()){let t=L(16),n=e;for(let o=5;o>=0;o--)t[o]=n%256,n=Math.floor(n/256);t[6]=t[6]&15|112,t[8]=t[8]&63|128;let r=Array.from(t,o=>o.toString(16).padStart(2,"0")).join("");return`${r.slice(0,8)}-${r.slice(8,12)}-${r.slice(12,16)}-${r.slice(16,20)}-${r.slice(20)}`}var Ge="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";function Vt(){return Array.from(L(16),e=>Ge[e%Ge.length]).join("")}function Ye(e){return typeof e=="string"&&J.includes(e)}function Lt(e,t,n=!1){let r=qe(JSON.stringify({k:e,events:[]})),o=[],s=[],c=r,d=()=>{s.length>0&&o.push({body:JSON.stringify({k:e,events:s}),bytes:c,count:s.length}),s=[],c=r};for(let g of t){let y=qe(JSON.stringify(g));r+y>Ke||((s.length>=l.maxBatchEvents||c+y+(s.length>0?1:0)>Ke)&&d(),c+=y+(s.length>0?1:0),s.push(g))}if(d(),n){let g=0,y=o.length;for(;y>0&&g+o[y-1].bytes<=Ot;)g+=o[y-1].bytes,y--;o=o.slice(y)}return o}function Ze(e){try{return typeof window=="undefined"||typeof document=="undefined"?B:Bt(e,window)}catch{return B}}function Bt(e,t){var ge,me,_e,ye;let n=Q((ge=e.projectKey)!=null?ge:""),r=!!e.debug,o=(...i)=>{r&&console.warn("[bitsnap analytics]",...i)};if(!n)return o("invalid projectKey, tracking is off"),B;let s=n,c=i=>`${(i||Nt).replace(/\/+$/,"")}/e`,d=c(e.endpoint),g=(me=e.source)!=null?me:"sdk_react",y=(_e=e.channel)!=null?_e:"embed",T=`bitsnap-react@${Me}`,S=Vt(),u=ee(t.location.href),P=(ye=e.env)!=null?ye:"live";if(!e.env)try{new URLSearchParams(t.location.search).has("test")&&(P="test")}catch{}let W=Be(document.referrer),m=e.enabled!==!1,h=null,v=0,p=[],f=null,E=new Set;e.onEvent&&E.add(e.onEvent);let k=[],b,w=!0;function q(){var _;let i=z(t);!i||i===b||(b=i,w=!i.ready,(_=i.ready)==null||_.then(()=>{b===i&&(w=!0,le())},()=>{b===i&&(w=!0)}))}function ce(){q();try{if(!b)return!1;let i=b.get();return!!b.denied&&b.denied("analytics")||!!i&&i.c.analytics===!1}catch{return!1}}function ue(i){E.forEach(_=>{try{_(i)}catch{}})}function G(i){try{if(q(),!b||!ie(t,s))return;se(t,s)?D()&&K(t.document,s)===null&&He(t,s,Ue()):i&&ze(t,s)}catch{}}function le(){if(G(!0),ce())p=[],k=[],M();else{if(w&&k.length>0){let i=k;k=[],i.forEach(ue)}p.length>0&&N()}}function D(){if(!m)return!1;let i=t.navigator;return i&&(i.globalPrivacyControl===!0||i.webdriver===!0)?!1:!ce()}function M(){f!==null&&clearTimeout(f),f=null}function Qe(){var i;f===null&&(f=setTimeout(()=>{f=null,N()},$t),(i=f.unref)==null||i.call(f))}function et(i){try{if(typeof fetch=="function"){fetch(d,{method:"POST",body:i,keepalive:!0,credentials:"omit",headers:{"Content-Type":"text/plain"}}).catch(()=>{});return}}catch{}try{let _=t.navigator;_&&typeof _.sendBeacon=="function"&&_.sendBeacon(d,new Blob([i],{type:"text/plain"}))}catch{}}function N(i=!1){try{if(M(),p.length===0)return;if(!D()){p=[];return}if(!w)return;G(w);let _=ae(t,s),a=_?p.map(x=>({...x,client_id:_})):p;p=[],Lt(s,a,i).forEach(x=>et(x.body))}catch{}}function pe(i,_,a){var be,ve,Ee,ke,Se,Ce,we,Te,xe,Ae,Pe;if(!D())return;let x=te(i,_);if(!x.ok){o("dropped",i,x.reason);return}let $=ee(t.location.href),Y={event_id:a!=null&&a.event_id&&We.test(a.event_id)?a.event_id:Rt(),event:i,ts:Date.now(),schema_version:1,env:P,source:g,channel:y,sdk:T,page_id:S,page_type:(a==null?void 0:a.page_type)!==void 0?a.page_type:h,host:(be=$==null?void 0:$.host)!=null?be:null,path:a!=null&&a.path?O(a.path.split(/[?#]/)[0]):(ve=$==null?void 0:$.path)!=null?ve:null,referrer_host:W,utm_source:(Ee=u==null?void 0:u.utm_source)!=null?Ee:null,utm_medium:(ke=u==null?void 0:u.utm_medium)!=null?ke:null,utm_campaign:(Se=u==null?void 0:u.utm_campaign)!=null?Se:null,utm_content:(Ce=u==null?void 0:u.utm_content)!=null?Ce:null,utm_term:(we=u==null?void 0:u.utm_term)!=null?we:null,ref_code:(Te=u==null?void 0:u.ref_code)!=null?Te:null,product_id:(xe=a==null?void 0:a.product_id)!=null?xe:null,variant_id:(Ae=a==null?void 0:a.variant_id)!=null?Ae:null,order_ref:(Pe=a==null?void 0:a.order_ref)!=null?Pe:null,props:x.props};a!=null&&a.event_id&&!We.test(a.event_id)&&o("ignored invalid event_id",i),g==="dashboard"&&e.visitorId&&(Y.visitor_id=e.visitorId);let he=De(Y);if(!he.ok){o("dropped",i,he.reason);return}let Z=Y;w?ue(Z):k.push(Z),p.push(Z),p.length>=It?N():Qe()}let de=()=>N(!0),fe=()=>{document.visibilityState==="hidden"&&N(!0)},U=()=>le();return t.addEventListener("pagehide",de),document.addEventListener("visibilitychange",fe),t.addEventListener("bitsnap:consent",U),t.addEventListener("bitsnap:consent:ready",U),q(),G(w),{track(i,_,a){try{pe(i,_,a)}catch{}},page(i,_){try{i!==void 0&&(h=i),pe("page_view",{landing:v++===0},_)}catch{}},clientId(i){try{return i!==void 0&&Q(i)!==s?null:D()?ae(t,s):null}catch{return null}},flush:()=>N(),setEnabled(i){m=!!i,m||(p=[],k=[],M())},configure(i){try{(i.env==="live"||i.env==="test")&&(P=i.env),typeof i.endpoint=="string"&&i.endpoint&&(d=c(i.endpoint))}catch{}},onEvent(i){return E.add(i),()=>void E.delete(i)},destroy(){p=[],k=[],M(),E.clear(),t.removeEventListener("pagehide",de),document.removeEventListener("visibilitychange",fe),t.removeEventListener("bitsnap:consent",U),t.removeEventListener("bitsnap:consent:ready",U)}}}var Dt=["storefront","dashboard","script"],Mt=["hosted","custom_domain","embed","panel"],Ut=/^[A-Za-z0-9_-]{22}$/;function Fe(e,t,n){return e.includes(t)?t:n}function Xe(e){try{if(typeof window=="undefined")return;let t=window.bitsnap;if(t!=null&&t.loaded)return t;let n=m=>(e==null?void 0:e.getAttribute(`data-${m}`))||void 0,r=n("env"),o=Fe(Dt,n("source"),"script"),s=Fe(Mt,n("channel"),"embed"),c=o==="dashboard",d=n("visitor-id"),g=n("project")?Ze({projectKey:n("project"),env:r==="live"||r==="test"?r:void 0,endpoint:n("endpoint"),source:o,channel:s,visitorId:c&&d&&Ut.test(d)?d:void 0}):B,y=n("route-template"),T=n("page-type"),S=Ye(T)?T:void 0,u;if(c){let m=S!=null?S:"app",h;u={track:(v,p,f)=>{var E;return g.track(v,p,{...f,page_type:(E=f==null?void 0:f.page_type)!=null?E:m})},page:(v,p)=>{var E,k,b;let f=O(((k=(E=p==null?void 0:p.path)!=null?E:y)!=null?k:Je(location.pathname)).split(/[?#]/)[0]);g.track("app_page_view",h&&h!==f?{route:f,previous_route:h}:{route:f},{...p,page_type:(b=v!=null?v:p==null?void 0:p.page_type)!=null?b:m,path:f}),h=f},loaded:!0}}else u={track:(m,h,v)=>g.track(m,h,v),page:(m,h)=>g.page(m!==void 0?m:S,h),loaded:!0};let P=m=>{try{let[h,...v]=Array.prototype.slice.call(m);(h==="track"||h==="page")&&u[h](...v)}catch{}},W=Array.isArray(t==null?void 0:t.q)?t.q:[];return window.bitsnap=u,W.forEach(P),u.q={push(...m){return m.forEach(P),0}},n("auto")!=="off"&&re(()=>u.page(S!=null?S:null)),u}catch{return}}var jt=new Set(["products","orders","customers","coupons","discounts","projects","users","members","invoices","returns","carts","subscriptions","pages","posts","courses","lessons","notifications","automations","webhooks","integrations","themes","newsletters","campaigns","forms","categories","collections","variants","tags","reviews","templates","payments","shipping","tests","partners"]),Ht=new Set(["new","create","add","edit","import","export","list","settings","stats","overview","all","archive","archived","drafts","preview","duplicate","bulk","search"]),zt=/^[A-Za-z0-9_]{3,24}$/;function Je(e){let t=O(e).split("/");return t.map((n,r)=>{var s;if(!n||n.startsWith(":"))return n;if(/\d/.test(n))return":id";let o=(s=t[r-1])==null?void 0:s.toLowerCase();return o&&jt.has(o)&&!Ht.has(n.toLowerCase())&&zt.test(n)?":id":n}).join("/")}typeof document!="undefined"&&Xe(document.currentScript);return st(Kt);})();
|
package/dist/embed/consent.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var BitsnapConsentEmbed=(()=>{var F=Object.defineProperty;var Le=Object.getOwnPropertyDescriptor;var Ne=Object.getOwnPropertyNames;var Oe=Object.prototype.hasOwnProperty;var je=(e,t)=>{for(var n in t)F(e,n,{get:t[n],enumerable:!0})},Me=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let d of Ne(t))!Oe.call(e,d)&&d!==n&&F(e,d,{get:()=>t[d],enumerable:!(r=Le(t,d))||r.enumerable});return e};var Re=e=>Me(F({},"__esModule",{value:!0}),e);var dt={};je(dt,{init:()=>Te,readScriptOptions:()=>Ae});var $e={maxBatchEvents:50,maxBodyBytes:65536,maxPropsChars:4096,maxPropString:200,maxPropArray:50,host:253,path:512,referrerHost:253,utm:100,refCode:64,id:64,sdk:64,pageId:32,region:64,osBrowser:32,tsSkewMs:864e5},ze=["storefront_events","app_events","business_events"];var j={value_minor:"number",currency:"string"},Q={page_view:{landing:"boolean"},product_list_viewed:{list_id:"string?",item_count:"number"},product_impression:{list_id:"string?",product_ids:"string[]",positions:"number[]"},product_clicked:{list_id:"string?",position:"number?"},product_view:{price_minor:"number",currency:"string",availability:"enum:in_stock|out_of_stock|preorder"},variant_selected:{},add_to_cart:{qty:"number",...j},remove_from_cart:{qty:"number",...j},cart_opened:{item_count:"number",...j},checkout_started:{item_count:"number",checkout_type:"enum:single|cart|link",...j},checkout_step_completed:{step:"enum:contact|delivery|invoice|consents"},checkout_validation_error:{field:"string",rule:"string"},coupon_applied:{coupon_id:"string"},coupon_rejected:{coupon_id:"string?",reason:"string"},delivery_method_selected:{method:"string"},payment_method_selected:{gateway:"string",method:"string"},payment_submitted:{gateway:"string",method:"string"},apple_pay_clicked:{},apple_pay_result:{outcome:"enum:success|fail|cancel"},payment_returned:{gateway:"string",method:"string?",outcome:"enum:success|fail|cancel|pending",error_code:"string?"},availability_signup:{},panel_login:{},panel_order_viewed:{},panel_download:{},return_started:{},return_submitted:{reason_code:"string",item_count:"number"},course_opened:{course_id:"string"},lesson_started:{course_id:"string",lesson_id:"string",position:"number"},lesson_completed:{course_id:"string",lesson_id:"string",position:"number"},video_progress:{course_id:"string",lesson_id:"string",milestone:"number"},test_submitted:{course_id:"string",lesson_id:"string",score_bucket:"enum:0-24|25-49|50-74|75-99|100"},lesson_rated:{course_id:"string",lesson_id:"string",rating:"number"},consent_updated:{consent_id:"string",action:"enum:accept_all|reject_all|custom|withdraw",analytics:"boolean",marketing:"boolean",preferences:"boolean",banner_version:"number"}},ee={app_page_view:{route:"string",previous_route:"string?"},insight_shown:{insight_type:"string",rank:"number",category:"string"},insight_clicked:{insight_type:"string",rank:"number",category:"string"},insight_dismissed:{insight_type:"string",rank:"number",category:"string"},checklist_step_viewed:{step:"string"},checklist_step_completed:{step:"string"},gateway_connect_started:{gateway:"string",step:"string?"},gateway_connect_completed:{gateway:"string",step:"string?"},gateway_connect_failed:{gateway:"string",step:"string?",error_code:"string?"},domain_connect_started:{},domain_connect_verified:{},domain_connect_failed:{error_code:"string?"},product_created:{product_type:"string?"},product_published:{product_type:"string?"},product_editor_section_opened:{section:"string"},feature_enabled:{feature:"string"},stats_viewed:{tab:"string"},stats_filter_changed:{tab:"string",filter:"string"},report_exported:{report:"string",format:"string?"},search_performed:{result_count:"number"},error_shown:{code:"string",route:"string"},help_opened:{topic:"string?"},ai_assistant_used:{topic:"string?"},member_invited:{role:"string"}},H={gateway:"string?",method:"string?",value_minor:"number?",currency:"string?"},T={subscription_id:"string?",value_minor:"number?",currency:"string?"},te={transaction_created:H,transaction_success:H,transaction_failure:{...H,error_code:"string?"},transaction_expired:H,transaction_charge:H,subscription_created:T,subscription_paused:T,subscription_resumed:T,subscription_updated:T,subscription_deleted:T,subscription_charge_paid:T,subscription_charge_failed:{...T,error_code:"string?"},subscription_past_due:T,subscription_canceled:T,access_expires_in_3_days:{},access_expired:{},cart_recovery:{value_minor:"number?",currency:"string?"},testimonial_email_send:{},testimonial_fulfilled:{},partner_commission_earned:{partner_id:"string",commission_minor:"number",currency:"string"},checkout_session_created:{item_count:"number",checkout_type:"enum:single|cart|link",gateway:"string?",...j},order_paid:{gateway:"string",method:"string?",item_count:"number?",visitor_day:"string?",items:"line_items?",...j},refund_issued:{gateway:"string?",reason:"string?",...j},return_requested:{item_count:"number",reason_code:"string?"},automation_run_completed:{automation_id:"string",status:"string",trigger:"string?"},notification_sent:{medium:"string",template:"string?"},notification_failed:{medium:"string",template:"string?",error_code:"string?"},recovery_email_sent:{step:"number?"},recovery_link_clicked:{},api_request:{endpoint:"string",client:"string?",status:"number",latency_bucket:"enum:lt_50|lt_200|lt_1000|gte_1000",sample_rate:"number"}};var gt={...Q,...ee,...te},Ue={storefront_events:Object.keys(Q),app_events:Object.keys(ee),business_events:Object.keys(te)},mt=Object.fromEntries(ze.flatMap(e=>Ue[e].map(t=>[t,e])));var yt=365*24*60*60;function ne(e){let t=e.startsWith("pk_")?e.slice(3):e;return/^[A-Za-z0-9]{1,32}$/.test(t)?t:null}var bt=$e.utm;var ht=new TextEncoder;var S=["analytics","marketing","preferences"];var Ie='script[type="text/plain"][data-bitsnap-consent]:not([data-bitsnap-queued])',De="iframe[data-bitsnap-consent][data-src]",oe=(e,t)=>S.includes(t!=null?t:"")&&e[t];function He(e){return new Promise(t=>{e.addEventListener("load",()=>t(),{once:!0}),e.addEventListener("error",()=>t(),{once:!0})})}function re(e,t){var a;let n=e.createElement("script");for(let{name:l,value:g}of Array.from(t.attributes))l==="type"||l==="data-bitsnap-queued"||(l==="data-type"?g==="module"&&n.setAttribute("type","module"):l==="data-src"?n.setAttribute("src",g):n.setAttribute(l,g));t.nonce&&(n.nonce=t.nonce);let r=n.hasAttribute("src");r?t.hasAttribute("async")||(n.async=!1):n.text=t.text;let d=r?He(n):void 0;return(a=t.parentNode)==null||a.replaceChild(n,t),d}function ie(e,t){let n=0;try{let r=null,d=[];e.querySelectorAll(Ie).forEach(a=>{if(!oe(t,a.getAttribute("data-bitsnap-consent")))return;n++;let l=!a.hasAttribute("data-src")&&!a.hasAttribute("src");if(r||l&&d.length>0){a.setAttribute("data-bitsnap-queued",""),r=(r!=null?r:Promise.all(d).then(()=>{})).then(()=>{try{return re(e,a)}catch{}}),d=[];return}let g=re(e,a);g&&d.push(g)}),e.querySelectorAll(De).forEach(a=>{if(!oe(t,a.getAttribute("data-bitsnap-consent")))return;let l=a.getAttribute("data-src");l&&a.getAttribute("src")!==l&&(a.setAttribute("src",l),a.removeAttribute("data-src"),n++)})}catch{}return n}var se="https://bitsnap.pl",ae="https://collect.bitsnap.pl";function Be(){return{version:1,theme:"auto",position:"bottom",categories:{analytics:!0,marketing:!0,preferences:!1},services:[],poweredBy:!0}}var Ke=["auto","light","dark"],Ve=["bottom","bottom-left","bottom-right"],We=/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;function Z(e){return typeof e=="string"&&We.test(e.trim())?e.trim():void 0}function Ge(e){if(typeof e!="string")return;let t=e.trim();return/^(?:https?:\/\/|\/(?!\/)|#|\?)/i.test(t)?t:void 0}function qe(e){if(!Array.isArray(e))return[];let t=[];for(let n of e)n&&typeof n.name=="string"&&S.includes(n.category)&&t.push({name:n.name,category:n.category,cookies:Array.isArray(n.cookies)?n.cookies.filter(r=>typeof r=="string"):void 0});return t}function X(...e){let t=Be();for(let n of e){if(!n||typeof n!="object")continue;typeof n.version=="number"&&n.version>=0&&(t.version=Math.floor(n.version)),Ke.includes(n.theme)&&(t.theme=n.theme),Ve.includes(n.position)&&(t.position=n.position);let r=Z(n.accentColor);r&&(t.accentColor=r);let d=Ge(n.privacyPolicyUrl);if(d&&(t.privacyPolicyUrl=d),n.categories&&typeof n.categories=="object")for(let a of S)typeof n.categories[a]=="boolean"&&(t.categories[a]=n.categories[a]);n.services!==void 0&&(t.services=qe(n.services)),n.texts&&typeof n.texts=="object"&&(t.texts=n.texts)}return t}function ce(e){let t=(e!=null?e:"").split(",").map(n=>n.trim());return{analytics:t.includes("analytics"),marketing:t.includes("marketing"),preferences:t.includes("preferences")}}async function le(e,t,n=3e3){if(typeof fetch!="function")return null;let r=typeof AbortController=="function"?new AbortController:void 0,d=setTimeout(()=>r==null?void 0:r.abort(),n);try{let a=await fetch(`${e.replace(/\/+$/,"")}/api/consent/config?key=${encodeURIComponent(t)}`,{signal:r==null?void 0:r.signal,credentials:"omit"});if(!a.ok)return null;let l=await a.json();if(!l||typeof l!="object")return null;let g=l.config&&typeof l.config=="object"?l.config:null,y=l.enabled!==!1;return g||!y?{enabled:y,config:g}:null}catch{return null}finally{clearTimeout(d)}}var ue="bitsnap_consent";function pe(e,t){return t==="project"&&e?`${ue}_${e.replace(/[^A-Za-z0-9_-]/g,"_")}`:ue}function Ye(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Fe(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");return atob(t+"=".repeat((4-t.length%4)%4))}function Ze(e){return Ye(JSON.stringify({v:1,id:e.id,ts:e.ts,bv:e.bv,c:e.c}))}function Xe(e){try{let t=JSON.parse(Fe(e));return!t||t.v!==1||typeof t.id!="string"||t.id===""||typeof t.ts!="number"||typeof t.bv!="number"||!t.c||typeof t.c.analytics!="boolean"||typeof t.c.marketing!="boolean"||typeof t.c.preferences!="boolean"?null:{id:t.id,ts:t.ts,bv:t.bv,c:{analytics:t.c.analytics,marketing:t.c.marketing,preferences:t.c.preferences}}}catch{return null}}function Je(e,t,n){return`${e}=${Ze(t)}; Max-Age=31536000; Path=/; SameSite=Lax`+(n?"; Secure":"")}function Qe(e){return e.split(";").map(t=>t.split("=")[0].trim()).filter(Boolean)}function et(e,t){for(let n of e.split(";")){let r=n.indexOf("=");if(r!==-1&&n.slice(0,r).trim()===t)return Xe(n.slice(r+1).trim())}return null}function de(){try{if(typeof crypto!="undefined"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}let e="";for(let t=0;t<32;t++)e+=Math.floor(Math.random()*16).toString(16);return e}function fe(e,t){try{return et(e.cookie,t)}catch{return null}}function ge(e,t,n){var r;try{e.cookie=Je(t,n,((r=e.location)==null?void 0:r.protocol)==="https:")}catch{}}function me(e,t){try{e.cookie=`${t}=; Max-Age=0; Path=/; SameSite=Lax`}catch{}}function tt(e){if(!e||/^[\d.]+$/.test(e)||e.includes(":"))return[];let t=e.split("."),n=[];for(let r=0;r<=t.length-2;r++)n.push(t.slice(r).join("."));return n}function J(e,t,n){var r,d;try{let a=t.filter(f=>n.includes(f.category)).flatMap(f=>{var p;return(p=f.cookies)!=null?p:[]});if(a.length===0)return;let l=Qe(e.cookie),g=new Set;for(let f of a)if(f.endsWith("*")){let p=f.slice(0,-1);for(let h of l)h.startsWith(p)&&g.add(h)}else g.add(f);let y=tt((d=(r=e.location)==null?void 0:r.hostname)!=null?d:"");for(let f of g){let p=`${encodeURIComponent(f)}=; Max-Age=0; Path=/`;e.cookie=p;for(let h of y)e.cookie=`${p}; Domain=${h}`,e.cookie=`${p}; Domain=.${h}`}}catch{}}var nt={ad_storage:"denied",ad_user_data:"denied",ad_personalization:"denied",analytics_storage:"denied",functionality_storage:"denied",personalization_storage:"denied",security_storage:"granted",wait_for_update:500},$=e=>e?"granted":"denied";function ot(e){return{analytics_storage:$(e.analytics),ad_storage:$(e.marketing),ad_user_data:$(e.marketing),ad_personalization:$(e.marketing),functionality_storage:$(e.preferences),personalization_storage:$(e.preferences)}}function rt(e,t){return t==="off"?!1:t==="on"||typeof e.gtag=="function"||Array.isArray(e.dataLayer)}function it(e){if(typeof e.gtag=="function")return e.gtag;let t=e.dataLayer=e.dataLayer||[],n=function(){t.push(arguments)};return e.gtag=n,n}function ye(e,t){if(!rt(e,t))return null;let n=it(e);return{setDefault:()=>n("consent","default",{...nt}),update:r=>n("consent","update",ot(r))}}var st={pl:{title:"Szanujemy Twoj\u0105 prywatno\u015B\u0107",description:"U\u017Cywamy plik\xF3w cookie, aby strona dzia\u0142a\u0142a poprawnie. Za Twoj\u0105 zgod\u0105 wykorzystujemy je te\u017C do statystyk, personalizacji i reklam. Mo\u017Cesz zaakceptowa\u0107 wszystkie, odrzuci\u0107 wszystkie albo wybra\u0107, na co si\u0119 zgadzasz.",acceptAll:"Akceptuj wszystkie",rejectAll:"Odrzu\u0107 wszystkie",settings:"Ustawienia",save:"Zapisz wyb\xF3r",close:"Zamknij",necessaryTitle:"Niezb\u0119dne",necessaryDescription:"Potrzebne do dzia\u0142ania strony: koszyk, zapami\u0119tanie Twojego wyboru, bezpiecze\u0144stwo. Nie mo\u017Cna ich wy\u0142\u0105czy\u0107.",analyticsTitle:"Statystyki",analyticsDescription:"Pomagaj\u0105 nam zrozumie\u0107, jak odwiedzaj\u0105cy korzystaj\u0105 ze strony, \u017Ceby\u015Bmy mogli j\u0105 ulepsza\u0107.",marketingTitle:"Marketing",marketingDescription:"Pozwalaj\u0105 mierzy\u0107 skuteczno\u015B\u0107 reklam i pokazywa\u0107 Ci oferty dopasowane do zainteresowa\u0144.",preferencesTitle:"Preferencje",preferencesDescription:"Zapami\u0119tuj\u0105 Twoje ustawienia, na przyk\u0142ad j\u0119zyk czy wygl\u0105d strony.",poweredBy:"Powered by"},en:{title:"We value your privacy",description:"We use cookies to make this site work. With your consent we also use them for statistics, personalization and ads. You can accept all, reject all, or choose what you agree to.",acceptAll:"Accept all",rejectAll:"Reject all",settings:"Settings",save:"Save choices",close:"Close",necessaryTitle:"Necessary",necessaryDescription:"Needed for the site to work: the cart, remembering your choice, security. They cannot be turned off.",analyticsTitle:"Analytics",analyticsDescription:"Help us understand how visitors use the site, so we can improve it.",marketingTitle:"Marketing",marketingDescription:"Measure how well ads work and show you offers that match your interests.",preferencesTitle:"Preferences",preferencesDescription:"Remember your settings, such as language or how the site looks.",poweredBy:"Powered by"}},be={pl:{privacy:"Polityka prywatno\u015Bci",services:"Us\u0142ugi",always:"Zawsze aktywne"},en:{privacy:"Privacy policy",services:"Services",always:"Always on"}};function he(e,t){return e==="pl"||e==="en"?e:/^pl\b/i.test(t!=null?t:"")?"pl":"en"}function _e(e,t){let n={...st[e]},r=t==null?void 0:t[e];if(r)for(let d of Object.keys(n)){let a=r[d];typeof a=="string"&&a.trim()!==""&&(n[d]=a)}return n}function at(e){let t=e.replace("#","");t.length===3&&(t=t.replace(/./g,"$&$&"));let n=parseInt(t,16);return[n>>16&255,n>>8&255,n&255]}function Ce(e){let[t,n,r]=at(e).map(d=>{let a=d/255;return a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4)});return .2126*t+.7152*n+.0722*r}function q(e,t){let[n,r]=[Ce(e),Ce(t)].sort((d,a)=>a-d);return(n+.05)/(r+.05)}function xe(e){return q(e,"#ffffff")>=q(e,"#111111")?"#ffffff":"#111111"}var Y={light:{bg:"#ffffff",fg:"#14171c",muted:"#495260",border:"#c9ced6",off:"#6b7280",thumb:"#ffffff",accent:"#1d4ed8",onAccent:"#ffffff",link:"#1d4ed8"},dark:{bg:"#171a20",fg:"#f1f3f6",muted:"#b7beca",border:"#3a404b",off:"#8b93a1",thumb:"#171a20",accent:"#8ab4ff",onAccent:"#0b1220",link:"#9dc0ff"}},ve=e=>`--bg:${e.bg};--fg:${e.fg};--muted:${e.muted};--border:${e.border};--off:${e.off};--thumb:${e.thumb};--accent:${e.accent};--on-accent:${e.onAccent};--link:${e.link};--focus:${e.accent}`,ke=`
|
|
1
|
+
"use strict";var BitsnapConsentEmbed=(()=>{var F=Object.defineProperty;var Ne=Object.getOwnPropertyDescriptor;var Le=Object.getOwnPropertyNames;var Oe=Object.prototype.hasOwnProperty;var je=(e,t)=>{for(var n in t)F(e,n,{get:t[n],enumerable:!0})},$e=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let d of Le(t))!Oe.call(e,d)&&d!==n&&F(e,d,{get:()=>t[d],enumerable:!(r=Ne(t,d))||r.enumerable});return e};var Re=e=>$e(F({},"__esModule",{value:!0}),e);var dt={};je(dt,{init:()=>Te,readScriptOptions:()=>Ae});var Me={maxBatchEvents:50,maxBodyBytes:65536,maxPropsChars:4096,maxPropString:200,maxPropArray:50,host:253,path:512,referrerHost:253,utm:100,refCode:64,id:64,sdk:64,pageId:32,region:64,osBrowser:32,tsSkewMs:864e5},ze=["storefront_events","app_events","business_events"];var j={value_minor:"number",currency:"string"},Q={page_view:{landing:"boolean"},product_list_viewed:{list_id:"string?",item_count:"number"},product_impression:{list_id:"string?",product_ids:"string[]",positions:"number[]"},product_clicked:{list_id:"string?",position:"number?"},product_view:{price_minor:"number",currency:"string",availability:"enum:in_stock|out_of_stock|preorder"},variant_selected:{},add_to_cart:{qty:"number",...j},remove_from_cart:{qty:"number",...j},cart_opened:{item_count:"number",...j},checkout_started:{item_count:"number",checkout_type:"enum:single|cart|link",...j},checkout_step_completed:{step:"enum:contact|delivery|invoice|consents"},checkout_validation_error:{field:"string",rule:"string"},coupon_applied:{coupon_id:"string"},coupon_rejected:{coupon_id:"string?",reason:"string"},delivery_method_selected:{method:"string"},payment_method_selected:{gateway:"string",method:"string"},payment_submitted:{gateway:"string",method:"string"},apple_pay_clicked:{},apple_pay_result:{outcome:"enum:success|fail|cancel"},payment_returned:{gateway:"string",method:"string?",outcome:"enum:success|fail|cancel|pending",error_code:"string?"},availability_signup:{},panel_login:{},panel_order_viewed:{},panel_download:{},return_started:{},return_submitted:{reason_code:"string",item_count:"number"},course_opened:{course_id:"string"},lesson_started:{course_id:"string",lesson_id:"string",position:"number"},lesson_completed:{course_id:"string",lesson_id:"string",position:"number"},video_progress:{course_id:"string",lesson_id:"string",milestone:"number"},test_submitted:{course_id:"string",lesson_id:"string",score_bucket:"enum:0-24|25-49|50-74|75-99|100"},lesson_rated:{course_id:"string",lesson_id:"string",rating:"number"},consent_updated:{consent_id:"string",action:"enum:accept_all|reject_all|custom|withdraw",analytics:"boolean",marketing:"boolean",preferences:"boolean",banner_version:"number"}},ee={app_page_view:{route:"string",previous_route:"string?"},insight_shown:{insight_type:"string",rank:"number",category:"string"},insight_clicked:{insight_type:"string",rank:"number",category:"string"},insight_dismissed:{insight_type:"string",rank:"number",category:"string"},checklist_step_viewed:{step:"string"},checklist_step_completed:{step:"string"},gateway_connect_started:{gateway:"string",step:"string?"},gateway_connect_completed:{gateway:"string",step:"string?"},gateway_connect_failed:{gateway:"string",step:"string?",error_code:"string?"},domain_connect_started:{},domain_connect_verified:{},domain_connect_failed:{error_code:"string?"},product_created:{product_type:"string?"},product_published:{product_type:"string?"},product_editor_section_opened:{section:"string"},feature_enabled:{feature:"string"},stats_viewed:{tab:"string"},stats_filter_changed:{tab:"string",filter:"string"},report_exported:{report:"string",format:"string?"},search_performed:{result_count:"number"},error_shown:{code:"string",route:"string"},help_opened:{topic:"string?"},ai_assistant_used:{topic:"string?"},member_invited:{role:"string"}},H={gateway:"string?",method:"string?",value_minor:"number?",currency:"string?"},T={subscription_id:"string?",value_minor:"number?",currency:"string?"},te={transaction_created:H,transaction_success:H,transaction_failure:{...H,error_code:"string?"},transaction_expired:H,transaction_charge:H,subscription_created:T,subscription_paused:T,subscription_resumed:T,subscription_updated:T,subscription_deleted:T,subscription_charge_paid:T,subscription_charge_failed:{...T,error_code:"string?"},subscription_past_due:T,subscription_canceled:T,access_expires_in_3_days:{},access_expired:{},cart_recovery:{value_minor:"number?",currency:"string?"},testimonial_email_send:{},testimonial_fulfilled:{},partner_commission_earned:{partner_id:"string",commission_minor:"number",currency:"string"},checkout_session_created:{item_count:"number",checkout_type:"enum:single|cart|link",gateway:"string?",...j},order_paid:{gateway:"string",method:"string?",item_count:"number?",visitor_day:"string?",items:"line_items?",...j},refund_issued:{gateway:"string?",reason:"string?",...j},return_requested:{item_count:"number",reason_code:"string?"},automation_run_completed:{automation_id:"string",status:"string",trigger:"string?"},notification_sent:{medium:"string",template:"string?"},notification_failed:{medium:"string",template:"string?",error_code:"string?"},recovery_email_sent:{step:"number?"},recovery_link_clicked:{},api_request:{endpoint:"string",client:"string?",status:"number",latency_bucket:"enum:lt_50|lt_200|lt_1000|gte_1000",sample_rate:"number"}};var gt={...Q,...ee,...te},Ue={storefront_events:Object.keys(Q),app_events:Object.keys(ee),business_events:Object.keys(te)},mt=Object.fromEntries(ze.flatMap(e=>Ue[e].map(t=>[t,e])));var yt=365*24*60*60;function ne(e){let t=e.startsWith("pk_")?e.slice(3):e;return/^[A-Za-z0-9]{1,32}$/.test(t)?t:null}var bt=Me.utm;var ht=new TextEncoder;var S=["analytics","marketing","preferences"];var Ie='script[type="text/plain"][data-bitsnap-consent]:not([data-bitsnap-queued])',De="iframe[data-bitsnap-consent][data-src]",oe=(e,t)=>S.includes(t!=null?t:"")&&e[t];function He(e){return new Promise(t=>{e.addEventListener("load",()=>t(),{once:!0}),e.addEventListener("error",()=>t(),{once:!0})})}function re(e,t){var a;let n=e.createElement("script");for(let{name:c,value:g}of Array.from(t.attributes))c==="type"||c==="data-bitsnap-queued"||(c==="data-type"?g==="module"&&n.setAttribute("type","module"):c==="data-src"?n.setAttribute("src",g):n.setAttribute(c,g));t.nonce&&(n.nonce=t.nonce);let r=n.hasAttribute("src");r?t.hasAttribute("async")||(n.async=!1):n.text=t.text;let d=r?He(n):void 0;return(a=t.parentNode)==null||a.replaceChild(n,t),d}function ie(e,t){let n=0;try{let r=null,d=[];e.querySelectorAll(Ie).forEach(a=>{if(!oe(t,a.getAttribute("data-bitsnap-consent")))return;n++;let c=!a.hasAttribute("data-src")&&!a.hasAttribute("src");if(r||c&&d.length>0){a.setAttribute("data-bitsnap-queued",""),r=(r!=null?r:Promise.all(d).then(()=>{})).then(()=>{try{return re(e,a)}catch{}}),d=[];return}let g=re(e,a);g&&d.push(g)}),e.querySelectorAll(De).forEach(a=>{if(!oe(t,a.getAttribute("data-bitsnap-consent")))return;let c=a.getAttribute("data-src");c&&a.getAttribute("src")!==c&&(a.setAttribute("src",c),a.removeAttribute("data-src"),n++)})}catch{}return n}var se="https://bitsnap.pl",ae="https://collect.bitsnap.pl";function Be(){return{version:1,theme:"auto",position:"bottom",categories:{analytics:!0,marketing:!0,preferences:!1},services:[],poweredBy:!0}}var Ke=["auto","light","dark"],Ve=["bottom","bottom-left","bottom-right"],We=/^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;function Z(e){return typeof e=="string"&&We.test(e.trim())?e.trim():void 0}function Ge(e){if(typeof e!="string")return;let t=e.trim();return/^(?:https?:\/\/|\/(?!\/)|#|\?)/i.test(t)?t:void 0}function qe(e){if(!Array.isArray(e))return[];let t=[];for(let n of e)n&&typeof n.name=="string"&&S.includes(n.category)&&t.push({name:n.name,category:n.category,cookies:Array.isArray(n.cookies)?n.cookies.filter(r=>typeof r=="string"):void 0});return t}function X(...e){let t=Be();for(let n of e){if(!n||typeof n!="object")continue;typeof n.version=="number"&&n.version>=0&&(t.version=Math.floor(n.version)),Ke.includes(n.theme)&&(t.theme=n.theme),Ve.includes(n.position)&&(t.position=n.position);let r=Z(n.accentColor);r&&(t.accentColor=r);let d=Ge(n.privacyPolicyUrl);if(d&&(t.privacyPolicyUrl=d),n.categories&&typeof n.categories=="object")for(let a of S)typeof n.categories[a]=="boolean"&&(t.categories[a]=n.categories[a]);n.services!==void 0&&(t.services=qe(n.services)),n.texts&&typeof n.texts=="object"&&(t.texts=n.texts)}return t}function ce(e){let t=(e!=null?e:"").split(",").map(n=>n.trim());return{analytics:t.includes("analytics"),marketing:t.includes("marketing"),preferences:t.includes("preferences")}}async function le(e,t,n=3e3){if(typeof fetch!="function")return null;let r=typeof AbortController=="function"?new AbortController:void 0,d=setTimeout(()=>r==null?void 0:r.abort(),n);try{let a=await fetch(`${e.replace(/\/+$/,"")}/api/consent/config?key=${encodeURIComponent(t)}`,{signal:r==null?void 0:r.signal,credentials:"omit"});if(!a.ok)return null;let c=await a.json();if(!c||typeof c!="object")return null;let g=c.config&&typeof c.config=="object"?c.config:null,y=c.enabled!==!1;return g||!y?{enabled:y,config:g}:null}catch{return null}finally{clearTimeout(d)}}var ue="bitsnap_consent";function pe(e,t){return t==="project"&&e?`${ue}_${e.replace(/[^A-Za-z0-9_-]/g,"_")}`:ue}function Ye(e){return btoa(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Fe(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");return atob(t+"=".repeat((4-t.length%4)%4))}function Ze(e){return Ye(JSON.stringify({v:1,id:e.id,ts:e.ts,bv:e.bv,c:e.c}))}function Xe(e){try{let t=JSON.parse(Fe(e));return!t||t.v!==1||typeof t.id!="string"||t.id===""||typeof t.ts!="number"||typeof t.bv!="number"||!t.c||typeof t.c.analytics!="boolean"||typeof t.c.marketing!="boolean"||typeof t.c.preferences!="boolean"?null:{id:t.id,ts:t.ts,bv:t.bv,c:{analytics:t.c.analytics,marketing:t.c.marketing,preferences:t.c.preferences}}}catch{return null}}function Je(e,t,n){return`${e}=${Ze(t)}; Max-Age=31536000; Path=/; SameSite=Lax`+(n?"; Secure":"")}function Qe(e){return e.split(";").map(t=>t.split("=")[0].trim()).filter(Boolean)}function et(e,t){for(let n of e.split(";")){let r=n.indexOf("=");if(r!==-1&&n.slice(0,r).trim()===t)return Xe(n.slice(r+1).trim())}return null}function de(){try{if(typeof crypto!="undefined"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch{}let e="";for(let t=0;t<32;t++)e+=Math.floor(Math.random()*16).toString(16);return e}function fe(e,t){try{return et(e.cookie,t)}catch{return null}}function ge(e,t,n){var r;try{e.cookie=Je(t,n,((r=e.location)==null?void 0:r.protocol)==="https:")}catch{}}function me(e,t){try{e.cookie=`${t}=; Max-Age=0; Path=/; SameSite=Lax`}catch{}}function tt(e){if(!e||/^[\d.]+$/.test(e)||e.includes(":"))return[];let t=e.split("."),n=[];for(let r=0;r<=t.length-2;r++)n.push(t.slice(r).join("."));return n}function J(e,t,n){var r,d;try{let a=t.filter(f=>n.includes(f.category)).flatMap(f=>{var p;return(p=f.cookies)!=null?p:[]});if(a.length===0)return;let c=Qe(e.cookie),g=new Set;for(let f of a)if(f.endsWith("*")){let p=f.slice(0,-1);for(let h of c)h.startsWith(p)&&g.add(h)}else g.add(f);let y=tt((d=(r=e.location)==null?void 0:r.hostname)!=null?d:"");for(let f of g){let p=`${encodeURIComponent(f)}=; Max-Age=0; Path=/`;e.cookie=p;for(let h of y)e.cookie=`${p}; Domain=${h}`,e.cookie=`${p}; Domain=.${h}`}}catch{}}var nt={ad_storage:"denied",ad_user_data:"denied",ad_personalization:"denied",analytics_storage:"denied",functionality_storage:"denied",personalization_storage:"denied",security_storage:"granted",wait_for_update:500},M=e=>e?"granted":"denied";function ot(e){return{analytics_storage:M(e.analytics),ad_storage:M(e.marketing),ad_user_data:M(e.marketing),ad_personalization:M(e.marketing),functionality_storage:M(e.preferences),personalization_storage:M(e.preferences)}}function rt(e,t){return t==="off"?!1:t==="on"||typeof e.gtag=="function"||Array.isArray(e.dataLayer)}function it(e){if(typeof e.gtag=="function")return e.gtag;let t=e.dataLayer=e.dataLayer||[],n=function(){t.push(arguments)};return e.gtag=n,n}function ye(e,t){if(!rt(e,t))return null;let n=it(e);return{setDefault:()=>n("consent","default",{...nt}),update:r=>n("consent","update",ot(r))}}var st={pl:{title:"Szanujemy Twoj\u0105 prywatno\u015B\u0107",description:"U\u017Cywamy plik\xF3w cookie, aby strona dzia\u0142a\u0142a poprawnie. Za Twoj\u0105 zgod\u0105 wykorzystujemy je te\u017C do statystyk, personalizacji i reklam. Mo\u017Cesz zaakceptowa\u0107 wszystkie, odrzuci\u0107 wszystkie albo wybra\u0107, na co si\u0119 zgadzasz.",acceptAll:"Akceptuj wszystkie",rejectAll:"Odrzu\u0107 wszystkie",settings:"Ustawienia",save:"Zapisz wyb\xF3r",close:"Zamknij",necessaryTitle:"Niezb\u0119dne",necessaryDescription:"Potrzebne do dzia\u0142ania strony: koszyk, zapami\u0119tanie Twojego wyboru, bezpiecze\u0144stwo. Nie mo\u017Cna ich wy\u0142\u0105czy\u0107.",analyticsTitle:"Statystyki",analyticsDescription:"Pomagaj\u0105 nam zrozumie\u0107, jak odwiedzaj\u0105cy korzystaj\u0105 ze strony, \u017Ceby\u015Bmy mogli j\u0105 ulepsza\u0107.",marketingTitle:"Marketing",marketingDescription:"Pozwalaj\u0105 mierzy\u0107 skuteczno\u015B\u0107 reklam i pokazywa\u0107 Ci oferty dopasowane do zainteresowa\u0144.",preferencesTitle:"Preferencje",preferencesDescription:"Zapami\u0119tuj\u0105 Twoje ustawienia, na przyk\u0142ad j\u0119zyk czy wygl\u0105d strony.",poweredBy:"Powered by"},en:{title:"We value your privacy",description:"We use cookies to make this site work. With your consent we also use them for statistics, personalization and ads. You can accept all, reject all, or choose what you agree to.",acceptAll:"Accept all",rejectAll:"Reject all",settings:"Settings",save:"Save choices",close:"Close",necessaryTitle:"Necessary",necessaryDescription:"Needed for the site to work: the cart, remembering your choice, security. They cannot be turned off.",analyticsTitle:"Analytics",analyticsDescription:"Help us understand how visitors use the site, so we can improve it.",marketingTitle:"Marketing",marketingDescription:"Measure how well ads work and show you offers that match your interests.",preferencesTitle:"Preferences",preferencesDescription:"Remember your settings, such as language or how the site looks.",poweredBy:"Powered by"}},be={pl:{privacy:"Polityka prywatno\u015Bci",services:"Us\u0142ugi",always:"Zawsze aktywne"},en:{privacy:"Privacy policy",services:"Services",always:"Always on"}};function he(e,t){return e==="pl"||e==="en"?e:/^pl\b/i.test(t!=null?t:"")?"pl":"en"}function _e(e,t){let n={...st[e]},r=t==null?void 0:t[e];if(r)for(let d of Object.keys(n)){let a=r[d];typeof a=="string"&&a.trim()!==""&&(n[d]=a)}return n}function at(e){let t=e.replace("#","");t.length===3&&(t=t.replace(/./g,"$&$&"));let n=parseInt(t,16);return[n>>16&255,n>>8&255,n&255]}function xe(e){let[t,n,r]=at(e).map(d=>{let a=d/255;return a<=.03928?a/12.92:Math.pow((a+.055)/1.055,2.4)});return .2126*t+.7152*n+.0722*r}function q(e,t){let[n,r]=[xe(e),xe(t)].sort((d,a)=>a-d);return(n+.05)/(r+.05)}function Ce(e){return q(e,"#ffffff")>=q(e,"#111111")?"#ffffff":"#111111"}var Y={light:{bg:"#ffffff",fg:"#14171c",muted:"#495260",border:"#c9ced6",off:"#6b7280",thumb:"#ffffff",accent:"#1d4ed8",onAccent:"#ffffff",link:"#1d4ed8"},dark:{bg:"#171a20",fg:"#f1f3f6",muted:"#b7beca",border:"#3a404b",off:"#8b93a1",thumb:"#171a20",accent:"#8ab4ff",onAccent:"#0b1220",link:"#9dc0ff"}},ve=e=>`--bg:${e.bg};--fg:${e.fg};--muted:${e.muted};--border:${e.border};--off:${e.off};--thumb:${e.thumb};--accent:${e.accent};--on-accent:${e.onAccent};--link:${e.link};--focus:${e.accent}`,ke=`
|
|
2
2
|
:host{all:initial}
|
|
3
3
|
*{box-sizing:border-box}
|
|
4
4
|
[hidden]{display:none!important}
|
|
@@ -6,10 +6,15 @@
|
|
|
6
6
|
.root[data-theme=dark]{${ve(Y.dark)};color-scheme:dark}
|
|
7
7
|
button,input{font:inherit;color:inherit}
|
|
8
8
|
.banner,.overlay{pointer-events:auto}
|
|
9
|
-
|
|
10
|
-
.
|
|
11
|
-
.bottom
|
|
12
|
-
.
|
|
9
|
+
::selection{background:color-mix(in srgb,var(--accent) 24%,transparent)}
|
|
10
|
+
.banner{position:absolute;background:var(--bg);color:var(--fg);max-height:92vh;overflow:auto;outline:none;animation:in .22s ease-out}
|
|
11
|
+
.bottom{left:0;right:0;bottom:0;border-top:1px solid var(--border);box-shadow:0 -8px 28px rgba(15,23,42,.08);padding:20px 24px calc(20px + env(safe-area-inset-bottom,0px))}
|
|
12
|
+
.root[data-theme=dark] .bottom{box-shadow:0 -8px 28px rgba(0,0,0,.4)}
|
|
13
|
+
.bottom .inner{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"text actions" "foot actions";gap:4px 40px;align-items:center;max-width:1120px;margin:0 auto}
|
|
14
|
+
.bottom .text{max-width:68ch}
|
|
15
|
+
.bottom .btn,.bottom .link-btn{flex:0 0 auto}
|
|
16
|
+
.card{bottom:16px;width:min(400px,calc(100vw - 32px));border:1px solid var(--border);border-radius:14px;padding:20px;box-shadow:0 12px 32px rgba(15,23,42,.14)}
|
|
17
|
+
.root[data-theme=dark] .card{box-shadow:0 12px 32px rgba(0,0,0,.45)}
|
|
13
18
|
.bottom-left{left:16px}
|
|
14
19
|
.bottom-right{right:16px}
|
|
15
20
|
.card .inner{display:flex;flex-direction:column;gap:16px}
|
|
@@ -17,15 +22,19 @@ button,input{font:inherit;color:inherit}
|
|
|
17
22
|
.actions{grid-area:actions;display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:flex-end}
|
|
18
23
|
.card .actions{justify-content:stretch}
|
|
19
24
|
.foot{grid-area:foot}
|
|
20
|
-
.title{font-size:
|
|
21
|
-
.desc{margin:0;color:var(--muted)}
|
|
22
|
-
.desc a
|
|
23
|
-
.btn{min-height:44px;padding:0 20px;border
|
|
24
|
-
.btn
|
|
25
|
-
.
|
|
25
|
+
.title{font-size:17px;font-weight:650;line-height:1.35;letter-spacing:-.01em;text-wrap:balance;margin:0 0 6px}
|
|
26
|
+
.desc{margin:0;color:var(--muted);line-height:1.55;text-wrap:pretty}
|
|
27
|
+
.desc a{color:var(--link);text-decoration:underline;text-underline-offset:3px}
|
|
28
|
+
.btn,.link-btn{min-height:44px;padding:0 20px;border-radius:10px;font-weight:600;cursor:pointer;white-space:nowrap;transition:background-color .12s ease-out,filter .12s ease-out,border-color .12s ease-out}
|
|
29
|
+
.btn{border:2px solid var(--accent);background:var(--accent);color:var(--on-accent);flex:1 1 150px}
|
|
30
|
+
.btn:hover{filter:brightness(.93)}
|
|
31
|
+
.btn:active{filter:brightness(.87)}
|
|
32
|
+
.link-btn{border:1px solid var(--border);background:transparent;color:var(--fg);text-decoration:none}
|
|
33
|
+
.link-btn:hover{background:color-mix(in srgb,var(--fg) 6%,transparent)}
|
|
34
|
+
.link-btn:active{background:color-mix(in srgb,var(--fg) 10%,transparent)}
|
|
26
35
|
.card .link-btn{flex:1 1 100%}
|
|
27
36
|
button:focus-visible,a:focus-visible,.dialog:focus-visible{outline:2px solid var(--focus);outline-offset:2px}
|
|
28
|
-
.foot{font-size:12px;color:var(--muted);padding-top:
|
|
37
|
+
.foot{font-size:12px;color:var(--muted);padding-top:8px}
|
|
29
38
|
.foot a{color:var(--muted);text-decoration:none;display:inline-flex;align-items:center;gap:5px;vertical-align:middle}
|
|
30
39
|
.foot a:hover{text-decoration:underline}
|
|
31
40
|
.foot b{color:var(--fg);font-weight:700;letter-spacing:-.01em}
|
|
@@ -57,10 +66,15 @@ input:focus-visible+.track{outline:2px solid var(--focus);outline-offset:2px}
|
|
|
57
66
|
.d-foot .actions{justify-content:stretch}
|
|
58
67
|
@keyframes in{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}
|
|
59
68
|
@keyframes fade{from{opacity:0}to{opacity:1}}
|
|
69
|
+
@media(max-width:960px){
|
|
70
|
+
.bottom .inner{grid-template-columns:minmax(0,1fr);grid-template-areas:"text" "actions" "foot";gap:14px}
|
|
71
|
+
.bottom .actions{justify-content:flex-start}
|
|
72
|
+
}
|
|
60
73
|
@media(max-width:640px){
|
|
61
74
|
.bottom{padding:16px 16px calc(16px + env(safe-area-inset-bottom,0px))}
|
|
62
75
|
.bottom .inner{grid-template-columns:1fr;grid-template-areas:"text" "actions" "foot";gap:12px}
|
|
63
76
|
.bottom .actions{justify-content:stretch}
|
|
77
|
+
.bottom .btn{flex:1 1 130px}
|
|
64
78
|
.bottom .link-btn{flex:1 1 100%}
|
|
65
79
|
.card{left:8px;right:8px;bottom:8px;width:auto}
|
|
66
80
|
.overlay{align-items:flex-end;padding:0}
|
|
@@ -71,4 +85,4 @@ input:focus-visible+.track{outline:2px solid var(--focus);outline-offset:2px}
|
|
|
71
85
|
.btn{flex-basis:130px;padding:0 12px}
|
|
72
86
|
}
|
|
73
87
|
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important}}
|
|
74
|
-
`.replace(/\n/g,"");var ct='<svg width="14" height="14" viewBox="0 0 16 16" aria-hidden="true"><rect width="16" height="16" rx="4" fill="currentColor" style="color:var(--fg)"/><circle cx="8" cy="8" r="3" fill="var(--bg)"/></svg>',lt='<svg width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"><path d="M3 3l10 10M13 3L3 13" stroke="currentColor" stroke-width="2" stroke-linecap="round" fill="none"/></svg>',ut="button:not([disabled]),input:not([disabled]),a[href]";function we(e){let{doc:t,config:n,texts:r,locale:d}=e,a=be[d],l=null,g=null,y,f,p,h,b,x="none",C=null,v=null,R=new Map;function u(o,i={},...c){let m=t.createElement(o);for(let _ of Object.keys(i))_==="class"?m.className=i[_]:m.setAttribute(_,i[_]);for(let _ of c)m.append(_);return m}function k(o,i,c){let m=u("button",{type:"button",class:o},i);return m.addEventListener("click",c),m}function z(){var i,c;let o=u("a",{href:`https://bitsnap.pl/?utm_source=consent_banner&utm_medium=referral&utm_content=${encodeURIComponent((c=(i=t.location)==null?void 0:i.hostname)!=null?c:"")}`,target:"_blank",rel:"noopener"});return o.append(r.poweredBy+" "),o.insertAdjacentHTML("beforeend",ct),o.append(u("b",{},"bitsnap")),u("div",{class:"foot"},o)}function w(){let o=u("p",{class:"desc",id:"d"},r.description);return n.privacyPolicyUrl&&o.append(" ",u("a",{href:n.privacyPolicyUrl,target:"_blank",rel:"noopener"},a.privacy)),o}function L(){b=k("link-btn",r.settings,()=>D()),f=u("div",{class:`banner ${n.position==="bottom"?"bottom":`card ${n.position}`}`,role:"region","aria-live":"polite","aria-labelledby":"t","aria-describedby":"d",tabindex:"-1"},u("div",{class:"inner"},u("div",{class:"text"},u("div",{class:"title",id:"t"},r.title),w()),u("div",{class:"actions"},k("btn",r.acceptAll,e.onAcceptAll),k("btn",r.rejectAll,e.onRejectAll),b),z()))}function U(o){let i=n.services.filter(_=>_.category===o),c=u("input",{type:"checkbox",role:"switch","aria-labelledby":`l-${o}`,"aria-describedby":`p-${o}`});o==="necessary"?(c.checked=!0,c.disabled=!0):R.set(o,c);let m=u("div",{class:"cat"},u("div",{class:"row"},u("span",{class:"cat-title",id:`l-${o}`},r[`${o}Title`]),u("span",{style:"display:flex;align-items:center"},...o==="necessary"?[u("span",{class:"always"},a.always)]:[],u("label",{class:"switch"},c,u("span",{class:"track"})))),u("p",{id:`p-${o}`},r[`${o}Description`]));return i.length>0&&m.append(u("p",{class:"svc"},u("b",{},`${a.services}: `),i.map(_=>_.name).join(", "))),m}function B(){let o=u("button",{type:"button",class:"x","aria-label":r.close});o.insertAdjacentHTML("beforeend",lt),o.addEventListener("click",()=>O());let i=u("div",{class:"d-body"},U("necessary"));for(let c of S)n.categories[c]&&i.append(U(c));h=u("div",{class:"dialog",role:"dialog","aria-modal":"true","aria-labelledby":"st",tabindex:"-1"},u("div",{class:"d-head"},u("div",{class:"title",id:"st"},r.settings),o),i,u("div",{class:"d-foot"},u("div",{class:"actions"},k("btn",r.save,()=>e.onSave(K())),k("btn",r.acceptAll,e.onAcceptAll),k("btn",r.rejectAll,e.onRejectAll)),z())),p=u("div",{class:"overlay"},h),p.addEventListener("mousedown",c=>{c.target===p&&O()})}function K(){let o={analytics:!1,marketing:!1,preferences:!1};return R.forEach((i,c)=>o[c]=i.checked),o}function E(){let o=n.theme==="dark"||n.theme==="auto"&&!!(v!=null&&v.matches);y.setAttribute("data-theme",o?"dark":"light"),V(o)}function V(o){let i=n.accentColor;if(i){if(o&&q(i,Y.dark.bg)<3){for(let c of["--accent","--focus","--on-accent"])y.style.removeProperty(c);return}y.style.setProperty("--accent",i),y.style.setProperty("--focus",i),y.style.setProperty("--on-accent",xe(i))}}function I(){var o,i;l||(l=u("div",{id:"bitsnap-consent","data-bitsnap-consent-host":""}),g=l.attachShadow({mode:"open"}),g.append(u("style",{},ke)),y=u("div",{class:"root",lang:d}),L(),B(),f.hidden=!0,p.hidden=!0,y.append(f,p),g.append(y),typeof((o=t.defaultView)==null?void 0:o.matchMedia)=="function"&&(v=t.defaultView.matchMedia("(prefers-color-scheme: dark)"),(i=v.addEventListener)==null||i.call(v,"change",E)),E(),t.body.append(l))}function P(){return Array.from(h.querySelectorAll(ut))}function N(o){if(x!=="settings")return;if(o.key==="Escape"){o.preventDefault(),O();return}if(o.key!=="Tab")return;let i=P();if(i.length===0)return;let c=g==null?void 0:g.activeElement,m=i[0],_=i[i.length-1],A=!c||!h.contains(c);o.shiftKey&&(A||c===m||c===h)?(o.preventDefault(),_.focus()):!o.shiftKey&&(A||c===_)&&(o.preventDefault(),m.focus())}function W(o=!1){try{I(),x="banner",t.removeEventListener("keydown",N,!0),p.hidden=!0,f.hidden=!1,o&&f.focus({preventScroll:!0})}catch{}}function D(){try{if(I(),x!=="settings"){let i=t.activeElement;C=i&&i!==l&&i!==t.body?i:null}let o=e.getChoices();R.forEach((i,c)=>i.checked=!!(o!=null&&o[c])),x="settings",f.hidden=!0,p.hidden=!1,t.addEventListener("keydown",N,!0),h.focus({preventScroll:!0})}catch{}}function O(){var o;x==="settings"&&(t.removeEventListener("keydown",N,!0),p.hidden=!0,e.hasChoice()?(x="none",(o=C==null?void 0:C.focus)==null||o.call(C,{preventScroll:!0})):(x="banner",f.hidden=!1,b.focus({preventScroll:!0})))}function G(){var i;if(!l)return;t.removeEventListener("keydown",N,!0);let o=x==="settings";x="none",f.hidden=!0,p.hidden=!0,o&&((i=C==null?void 0:C.focus)==null||i.call(C,{preventScroll:!0}))}function s(){var o;t.removeEventListener("keydown",N,!0),(o=v==null?void 0:v.removeEventListener)==null||o.call(v,"change",E),l==null||l.remove(),l=null,g=null,x="none"}return{showBanner:W,showSettings:D,hide:G,destroy:s}}var M=()=>({analytics:!1,marketing:!1,preferences:!1}),Ee=e=>e&&{id:e.id,ts:e.ts,bv:e.bv,c:{...e.c}};function Se(e={}){let t=typeof window!="undefined"?window:void 0,n=t==null?void 0:t.document,r=new Set,d=e.apiHost||se,a=e.collectHost||ae,l=e.projectKey?ne(e.projectKey):null,g=pe(l!=null?l:void 0,e.scope),y=!!e.preview,f=X(z()),p=null,h=null,b=null,x=!1,C=!1,v,R=[],u=t&&!y?w(()=>ye(t,e.gcm),null):null;w(()=>u==null?void 0:u.setDefault(),void 0);let k=n&&!y?fe(n,g):null;function z(s){let o={...e.config};return e.theme&&(o.theme=e.theme),e.position&&(o.position=e.position),e.privacyPolicyUrl&&(o.privacyPolicyUrl=e.privacyPolicyUrl),{...s,...o}}function w(s,o){try{return s()}catch{return o}}function L(s){let o=M();for(let i of S)o[i]=!!(s!=null&&s[i])&&f.categories[i];return o}function U(s){r.forEach(o=>w(()=>o({...s,c:{...s.c}}),void 0)),w(()=>{t==null||t.dispatchEvent(new t.CustomEvent("bitsnap:consent",{detail:{...s,c:{...s.c}}}))},void 0)}function B(s,o){y||!l||typeof fetch!="function"||w(()=>{var c,m;let i=JSON.stringify({k:l,consent_id:o.id,action:s,c:o.c,bv:o.bv,host:(m=(c=t==null?void 0:t.location)==null?void 0:c.hostname)!=null?m:"",ts:o.ts});fetch(`${a.replace(/\/+$/,"")}/consent`,{method:"POST",keepalive:!0,credentials:"omit",body:i}).catch(()=>{})},void 0)}function K(s){return S.filter(o=>s[o]&&f.categories[o])}function E(s,o){var A;if(!n||C)return;if(y){b==null||b.hide();return}let i=p!=null?p:h,c=i?K(i.c).filter(Pe=>!s[Pe]):[],m=c.length>0?"withdraw":o,_={id:(A=i==null?void 0:i.id)!=null?A:de(),ts:Math.floor(Date.now()/1e3),bv:f.version,c:s};ge(n,g,_),p=_,h=null,V(_.c),c.length>0&&J(n,f.services,c),b==null||b.hide(),U({..._,action:m}),B(m,_),c.length>0&&e.reloadOnWithdraw&&I()}function V(s){w(()=>u==null?void 0:u.update(s),void 0),n&&ie(n,s)}function I(){setTimeout(()=>w(()=>t==null?void 0:t.location.reload(),void 0),50)}function P(){var s;if(!n||!x||C)return null;if(!b){let o=he(e.locale,(s=t==null?void 0:t.navigator)==null?void 0:s.language);b=we({doc:n,config:f,locale:o,texts:N(_e(o,f.texts)),getChoices:()=>{var i;return(i=p==null?void 0:p.c)!=null?i:null},hasChoice:()=>p!==null,onAcceptAll:()=>E(L({analytics:!0,marketing:!0,preferences:!0}),"accept_all"),onRejectAll:()=>E(M(),"reject_all"),onSave:i=>E(L(i),"custom")})}return b}function N(s){var c,m;let o=(c=e.title)==null?void 0:c.trim(),i=(m=e.description)==null?void 0:m.trim();return{...s,...o&&{title:o},...i&&{description:i}}}function W(s){var i;let o=s.target;(i=o==null?void 0:o.closest)!=null&&i.call(o,"[data-bitsnap-consent-open]")&&(s.preventDefault(),G.open())}let D=(async()=>{var m,_;if(!n||!t)return null;let s=l&&!y?await le(d,l):null;if(C)return null;let o=s!=null&&s.config?void 0:e.categories;if(f=X(s==null?void 0:s.config,o?{categories:{...M(),...o}}:void 0,z()),n.readyState==="loading"&&await new Promise(A=>n.addEventListener("DOMContentLoaded",()=>A(),{once:!0})),C)return null;x=!0,n.addEventListener("click",W),v=()=>n.removeEventListener("click",W);let i=!l||(s==null?void 0:s.config)!=null,c=(s==null?void 0:s.enabled)===!1;return y?(m=P())==null||m.showBanner():k&&(c||!i||k.bv===f.version)?(p=k,V(L(p.c))):(k&&(h=k),c||(_=P())==null||_.showBanner()),R.splice(0).forEach(A=>w(A,void 0)),w(()=>t.dispatchEvent(new t.CustomEvent("bitsnap:consent:ready")),void 0),Ee(p)})().catch(()=>null);function O(s){x?s():R.push(s)}let G={get:()=>Ee(p),denied:s=>{var o;return((o=p!=null?p:h)==null?void 0:o.c[s])===!1},on(s,o){return s!=="change"||typeof o!="function"?()=>{}:(r.add(o),()=>void r.delete(o))},open(){var s;x?(s=P())==null||s.showSettings():D.then(()=>{var o;return(o=P())==null?void 0:o.showSettings()})},close(){b==null||b.hide()},accept:s=>O(()=>E(L(s),"custom")),acceptAll:()=>O(()=>E(L({analytics:!0,marketing:!0,preferences:!0}),"accept_all")),rejectAll:()=>O(()=>E(M(),"reject_all")),reset(){var i,c,m;if(!n||C)return;if(y){(i=P())==null||i.showBanner();return}let s=p!=null?p:h,o=s?K(s.c):[];me(n,g),p=null,h=s,w(()=>u==null?void 0:u.update(M()),void 0),o.length>0&&J(n,f.services,o),U({id:(c=s==null?void 0:s.id)!=null?c:"",ts:Math.floor(Date.now()/1e3),bv:f.version,c:M(),action:"reset"}),s&&o.length>0&&B("withdraw",{id:s.id,ts:Math.floor(Date.now()/1e3),bv:f.version,c:M()}),(m=P())==null||m.showBanner(!0),o.length>0&&e.reloadOnWithdraw&&I()},ready:D,destroy(){C=!0,v==null||v(),b==null||b.destroy(),b=null,r.clear()}};return pt(G)}function pt(e){let t={...e};for(let n of Object.keys(e)){let r=e[n];typeof r=="function"&&(t[n]=(...d)=>{try{return r(...d)}catch{return n==="get"?null:n==="on"?()=>{}:void 0}})}return t}function Ae(e){var h,b;let t=x=>(e==null?void 0:e.getAttribute(`data-${x}`))||void 0,n={projectKey:t("project"),apiHost:t("api-host"),collectHost:t("collect-host"),privacyPolicyUrl:t("privacy-url"),reloadOnWithdraw:t("reload-on-withdraw")==="true"},r=t("theme");(r==="auto"||r==="light"||r==="dark")&&(n.theme=r);let d=t("locale");(d==="auto"||d==="pl"||d==="en")&&(n.locale=d);let a=t("position");(a==="bottom"||a==="bottom-left"||a==="bottom-right")&&(n.position=a),t("scope")==="project"&&(n.scope="project");let l=t("gcm");(l==="on"||l==="off")&&(n.gcm=l);let g=t("categories");g!==void 0&&(n.categories=ce(g));let y=Z(t("accent"));y&&(n.config={accentColor:y}),t("preview")==="on"&&(n.preview=!0);let f=(h=t("title"))==null?void 0:h.trim();f&&(n.title=f);let p=(b=t("description"))==null?void 0:b.trim();return p&&(n.description=p),n}function Te(e){try{if(typeof window=="undefined")return;if(window.BitsnapConsent)return window.BitsnapConsent;let t=Se(Ae(e));return window.BitsnapConsent=t,t}catch{return}}typeof document!="undefined"&&Te(document.currentScript);return Re(dt);})();
|
|
88
|
+
`.replace(/\n/g,"");var ct='<svg width="14" height="14" viewBox="0 0 16 16" aria-hidden="true"><rect width="16" height="16" rx="4" fill="currentColor" style="color:var(--fg)"/><circle cx="8" cy="8" r="3" fill="var(--bg)"/></svg>',lt='<svg width="16" height="16" viewBox="0 0 16 16" aria-hidden="true"><path d="M3 3l10 10M13 3L3 13" stroke="currentColor" stroke-width="2" stroke-linecap="round" fill="none"/></svg>',ut="button:not([disabled]),input:not([disabled]),a[href]";function we(e){let{doc:t,config:n,texts:r,locale:d}=e,a=be[d],c=null,g=null,y,f,p,h,b,C="none",x=null,v=null,R=new Map;function u(o,i={},...l){let m=t.createElement(o);for(let _ of Object.keys(i))_==="class"?m.className=i[_]:m.setAttribute(_,i[_]);for(let _ of l)m.append(_);return m}function k(o,i,l){let m=u("button",{type:"button",class:o},i);return m.addEventListener("click",l),m}function z(){var i,l;let o=u("a",{href:`https://bitsnap.pl/?utm_source=consent_banner&utm_medium=referral&utm_content=${encodeURIComponent((l=(i=t.location)==null?void 0:i.hostname)!=null?l:"")}`,target:"_blank",rel:"noopener"});return o.append(r.poweredBy+" "),o.insertAdjacentHTML("beforeend",ct),o.append(u("b",{},"bitsnap")),u("div",{class:"foot"},o)}function w(){let o=u("p",{class:"desc",id:"d"},r.description);return n.privacyPolicyUrl&&o.append(" ",u("a",{href:n.privacyPolicyUrl,target:"_blank",rel:"noopener"},a.privacy)),o}function N(){b=k("link-btn",r.settings,()=>D()),f=u("div",{class:`banner ${n.position==="bottom"?"bottom":`card ${n.position}`}`,role:"region","aria-live":"polite","aria-labelledby":"t","aria-describedby":"d",tabindex:"-1"},u("div",{class:"inner"},u("div",{class:"text"},u("div",{class:"title",id:"t"},r.title),w()),u("div",{class:"actions"},k("btn",r.acceptAll,e.onAcceptAll),k("btn",r.rejectAll,e.onRejectAll),b),z()))}function U(o){let i=n.services.filter(_=>_.category===o),l=u("input",{type:"checkbox",role:"switch","aria-labelledby":`l-${o}`,"aria-describedby":`p-${o}`});o==="necessary"?(l.checked=!0,l.disabled=!0):R.set(o,l);let m=u("div",{class:"cat"},u("div",{class:"row"},u("span",{class:"cat-title",id:`l-${o}`},r[`${o}Title`]),u("span",{style:"display:flex;align-items:center"},...o==="necessary"?[u("span",{class:"always"},a.always)]:[],u("label",{class:"switch"},l,u("span",{class:"track"})))),u("p",{id:`p-${o}`},r[`${o}Description`]));return i.length>0&&m.append(u("p",{class:"svc"},u("b",{},`${a.services}: `),i.map(_=>_.name).join(", "))),m}function B(){let o=u("button",{type:"button",class:"x","aria-label":r.close});o.insertAdjacentHTML("beforeend",lt),o.addEventListener("click",()=>O());let i=u("div",{class:"d-body"},U("necessary"));for(let l of S)n.categories[l]&&i.append(U(l));h=u("div",{class:"dialog",role:"dialog","aria-modal":"true","aria-labelledby":"st",tabindex:"-1"},u("div",{class:"d-head"},u("div",{class:"title",id:"st"},r.settings),o),i,u("div",{class:"d-foot"},u("div",{class:"actions"},k("btn",r.save,()=>e.onSave(K())),k("btn",r.acceptAll,e.onAcceptAll),k("btn",r.rejectAll,e.onRejectAll)),z())),p=u("div",{class:"overlay"},h),p.addEventListener("mousedown",l=>{l.target===p&&O()})}function K(){let o={analytics:!1,marketing:!1,preferences:!1};return R.forEach((i,l)=>o[l]=i.checked),o}function E(){let o=n.theme==="dark"||n.theme==="auto"&&!!(v!=null&&v.matches);y.setAttribute("data-theme",o?"dark":"light"),V(o)}function V(o){let i=n.accentColor;if(i){if(o&&q(i,Y.dark.bg)<3){for(let l of["--accent","--focus","--on-accent"])y.style.removeProperty(l);return}y.style.setProperty("--accent",i),y.style.setProperty("--focus",i),y.style.setProperty("--on-accent",Ce(i))}}function I(){var o,i;c||(c=u("div",{id:"bitsnap-consent","data-bitsnap-consent-host":""}),g=c.attachShadow({mode:"open"}),g.append(u("style",{},ke)),y=u("div",{class:"root",lang:d}),N(),B(),f.hidden=!0,p.hidden=!0,y.append(f,p),g.append(y),typeof((o=t.defaultView)==null?void 0:o.matchMedia)=="function"&&(v=t.defaultView.matchMedia("(prefers-color-scheme: dark)"),(i=v.addEventListener)==null||i.call(v,"change",E)),E(),t.body.append(c))}function P(){return Array.from(h.querySelectorAll(ut))}function L(o){if(C!=="settings")return;if(o.key==="Escape"){o.preventDefault(),O();return}if(o.key!=="Tab")return;let i=P();if(i.length===0)return;let l=g==null?void 0:g.activeElement,m=i[0],_=i[i.length-1],A=!l||!h.contains(l);o.shiftKey&&(A||l===m||l===h)?(o.preventDefault(),_.focus()):!o.shiftKey&&(A||l===_)&&(o.preventDefault(),m.focus())}function W(o=!1){try{I(),C="banner",t.removeEventListener("keydown",L,!0),p.hidden=!0,f.hidden=!1,o&&f.focus({preventScroll:!0})}catch{}}function D(){try{if(I(),C!=="settings"){let i=t.activeElement;x=i&&i!==c&&i!==t.body?i:null}let o=e.getChoices();R.forEach((i,l)=>i.checked=!!(o!=null&&o[l])),C="settings",f.hidden=!0,p.hidden=!1,t.addEventListener("keydown",L,!0),h.focus({preventScroll:!0})}catch{}}function O(){var o;C==="settings"&&(t.removeEventListener("keydown",L,!0),p.hidden=!0,e.hasChoice()?(C="none",(o=x==null?void 0:x.focus)==null||o.call(x,{preventScroll:!0})):(C="banner",f.hidden=!1,b.focus({preventScroll:!0})))}function G(){var i;if(!c)return;t.removeEventListener("keydown",L,!0);let o=C==="settings";C="none",f.hidden=!0,p.hidden=!0,o&&((i=x==null?void 0:x.focus)==null||i.call(x,{preventScroll:!0}))}function s(){var o;t.removeEventListener("keydown",L,!0),(o=v==null?void 0:v.removeEventListener)==null||o.call(v,"change",E),c==null||c.remove(),c=null,g=null,C="none"}return{showBanner:W,showSettings:D,hide:G,destroy:s}}var $=()=>({analytics:!1,marketing:!1,preferences:!1}),Ee=e=>e&&{id:e.id,ts:e.ts,bv:e.bv,c:{...e.c}};function Se(e={}){let t=typeof window!="undefined"?window:void 0,n=t==null?void 0:t.document,r=new Set,d=e.apiHost||se,a=e.collectHost||ae,c=e.projectKey?ne(e.projectKey):null,g=pe(c!=null?c:void 0,e.scope),y=!!e.preview,f=X(z()),p=null,h=null,b=null,C=!1,x=!1,v,R=[],u=t&&!y?w(()=>ye(t,e.gcm),null):null;w(()=>u==null?void 0:u.setDefault(),void 0);let k=n&&!y?fe(n,g):null;function z(s){let o={...e.config};return e.theme&&(o.theme=e.theme),e.position&&(o.position=e.position),e.privacyPolicyUrl&&(o.privacyPolicyUrl=e.privacyPolicyUrl),{...s,...o}}function w(s,o){try{return s()}catch{return o}}function N(s){let o=$();for(let i of S)o[i]=!!(s!=null&&s[i])&&f.categories[i];return o}function U(s){r.forEach(o=>w(()=>o({...s,c:{...s.c}}),void 0)),w(()=>{t==null||t.dispatchEvent(new t.CustomEvent("bitsnap:consent",{detail:{...s,c:{...s.c}}}))},void 0)}function B(s,o){y||!c||typeof fetch!="function"||w(()=>{var l,m;let i=JSON.stringify({k:c,consent_id:o.id,action:s,c:o.c,bv:o.bv,host:(m=(l=t==null?void 0:t.location)==null?void 0:l.hostname)!=null?m:"",ts:o.ts});fetch(`${a.replace(/\/+$/,"")}/consent`,{method:"POST",keepalive:!0,credentials:"omit",body:i}).catch(()=>{})},void 0)}function K(s){return S.filter(o=>s[o]&&f.categories[o])}function E(s,o){var A;if(!n||x)return;if(y){b==null||b.hide();return}let i=p!=null?p:h,l=i?K(i.c).filter(Pe=>!s[Pe]):[],m=l.length>0?"withdraw":o,_={id:(A=i==null?void 0:i.id)!=null?A:de(),ts:Math.floor(Date.now()/1e3),bv:f.version,c:s};ge(n,g,_),p=_,h=null,V(_.c),l.length>0&&J(n,f.services,l),b==null||b.hide(),U({..._,action:m}),B(m,_),l.length>0&&e.reloadOnWithdraw&&I()}function V(s){w(()=>u==null?void 0:u.update(s),void 0),n&&ie(n,s)}function I(){setTimeout(()=>w(()=>t==null?void 0:t.location.reload(),void 0),50)}function P(){var s;if(!n||!C||x)return null;if(!b){let o=he(e.locale,(s=t==null?void 0:t.navigator)==null?void 0:s.language);b=we({doc:n,config:f,locale:o,texts:L(_e(o,f.texts)),getChoices:()=>{var i;return(i=p==null?void 0:p.c)!=null?i:null},hasChoice:()=>p!==null,onAcceptAll:()=>E(N({analytics:!0,marketing:!0,preferences:!0}),"accept_all"),onRejectAll:()=>E($(),"reject_all"),onSave:i=>E(N(i),"custom")})}return b}function L(s){var l,m;let o=(l=e.title)==null?void 0:l.trim(),i=(m=e.description)==null?void 0:m.trim();return{...s,...o&&{title:o},...i&&{description:i}}}function W(s){var i;let o=s.target;(i=o==null?void 0:o.closest)!=null&&i.call(o,"[data-bitsnap-consent-open]")&&(s.preventDefault(),G.open())}let D=(async()=>{var m,_;if(!n||!t)return null;let s=c&&!y?await le(d,c):null;if(x)return null;let o=s!=null&&s.config?void 0:e.categories;if(f=X(s==null?void 0:s.config,o?{categories:{...$(),...o}}:void 0,z()),n.readyState==="loading"&&await new Promise(A=>n.addEventListener("DOMContentLoaded",()=>A(),{once:!0})),x)return null;C=!0,n.addEventListener("click",W),v=()=>n.removeEventListener("click",W);let i=!c||(s==null?void 0:s.config)!=null,l=(s==null?void 0:s.enabled)===!1;return y?(m=P())==null||m.showBanner():k&&(l||!i||k.bv===f.version)?(p=k,V(N(p.c))):(k&&(h=k),l||(_=P())==null||_.showBanner()),R.splice(0).forEach(A=>w(A,void 0)),w(()=>t.dispatchEvent(new t.CustomEvent("bitsnap:consent:ready")),void 0),Ee(p)})().catch(()=>null);function O(s){C?s():R.push(s)}let G={scope:e.scope==="project"&&c?"project":"global",projectKey:c,get:()=>Ee(p),denied:s=>{var o;return((o=p!=null?p:h)==null?void 0:o.c[s])===!1},on(s,o){return s!=="change"||typeof o!="function"?()=>{}:(r.add(o),()=>void r.delete(o))},open(){var s;C?(s=P())==null||s.showSettings():D.then(()=>{var o;return(o=P())==null?void 0:o.showSettings()})},close(){b==null||b.hide()},accept:s=>O(()=>E(N(s),"custom")),acceptAll:()=>O(()=>E(N({analytics:!0,marketing:!0,preferences:!0}),"accept_all")),rejectAll:()=>O(()=>E($(),"reject_all")),reset(){var i,l,m;if(!n||x)return;if(y){(i=P())==null||i.showBanner();return}let s=p!=null?p:h,o=s?K(s.c):[];me(n,g),p=null,h=s,w(()=>u==null?void 0:u.update($()),void 0),o.length>0&&J(n,f.services,o),U({id:(l=s==null?void 0:s.id)!=null?l:"",ts:Math.floor(Date.now()/1e3),bv:f.version,c:$(),action:"reset"}),s&&o.length>0&&B("withdraw",{id:s.id,ts:Math.floor(Date.now()/1e3),bv:f.version,c:$()}),(m=P())==null||m.showBanner(!0),o.length>0&&e.reloadOnWithdraw&&I()},ready:D,destroy(){x=!0,v==null||v(),b==null||b.destroy(),b=null,r.clear()}};return pt(G)}function pt(e){let t={...e};for(let n of Object.keys(e)){let r=e[n];typeof r=="function"&&(t[n]=(...d)=>{try{return r(...d)}catch{return n==="get"?null:n==="on"?()=>{}:void 0}})}return t}function Ae(e){var h,b;let t=C=>(e==null?void 0:e.getAttribute(`data-${C}`))||void 0,n={projectKey:t("project"),apiHost:t("api-host"),collectHost:t("collect-host"),privacyPolicyUrl:t("privacy-url"),reloadOnWithdraw:t("reload-on-withdraw")==="true"},r=t("theme");(r==="auto"||r==="light"||r==="dark")&&(n.theme=r);let d=t("locale");(d==="auto"||d==="pl"||d==="en")&&(n.locale=d);let a=t("position");(a==="bottom"||a==="bottom-left"||a==="bottom-right")&&(n.position=a),t("scope")==="project"&&(n.scope="project");let c=t("gcm");(c==="on"||c==="off")&&(n.gcm=c);let g=t("categories");g!==void 0&&(n.categories=ce(g));let y=Z(t("accent"));y&&(n.config={accentColor:y}),t("preview")==="on"&&(n.preview=!0);let f=(h=t("title"))==null?void 0:h.trim();f&&(n.title=f);let p=(b=t("description"))==null?void 0:b.trim();return p&&(n.description=p),n}function Te(e){try{if(typeof window=="undefined")return;if(window.BitsnapConsent)return window.BitsnapConsent;let t=Se(Ae(e));return window.BitsnapConsent=t,t}catch{return}}typeof document!="undefined"&&Te(document.currentScript);return Re(dt);})();
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/emems
|
|
1
|
+
{"version":3,"sources":["/home/emems/web/bitsnap/bitsnap/bitsnap-react/dist/errors.js","../src/errors.ts"],"names":["require_errors","__commonJSMin"],"mappings":"AAAA,+HAAkC,ICAlCA,CAAAA,CAAAC,gCAAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,SAAA,UAAA,CAAA,CAAA,CAAA","file":"/home/emems/web/bitsnap/bitsnap/bitsnap-react/dist/errors.js","sourcesContent":[null,""]}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { A as AnalyticsOption, l as Instrument } from './instrument-
|
|
2
|
+
import { A as AnalyticsOption, l as Instrument } from './instrument-CmxK7S4T.mjs';
|
|
3
3
|
import { S as SlotAppearance, A as AppearanceElements } from './appearance-core-Dt2grZdl.mjs';
|
|
4
4
|
export { PRODUCT_LIST_SLOT_NAMES, ProductList, ProductListAppearance, ProductListAppearanceElements, ProductListAppearanceTokens, ProductListData, ProductListItemContext, ProductListProps, ProductListSlotAppearance, ProductListSlotName, ProductListTextKey, ProductListTexts, ProductListTheme, PublicListProduct, UseProductsOptions, UseProductsResult, formatProductPrice, useProducts } from './catalog.mjs';
|
|
5
5
|
export { BitsnapReturns, BitsnapReturnsProps, BitsnapReturnsProvider, BitsnapReturnsProviderProps, CreateReturnInput, Environment, LegacyCreateReturnInput, LegacyReturnsTexts, LegacyReturnsTheme, ReturnsAppearanceProvider, ReturnsChallenge, ReturnsCodeStep, ReturnsCodeStepProps, ReturnsConfirmation, ReturnsConfirmationProps, ReturnsEmailStep, ReturnsEmailStepProps, ReturnsEnvironment, ReturnsEnvironmentInput, ReturnsMyReturnDetail, ReturnsMyReturnDetailProps, ReturnsMyReturnsList, ReturnsMyReturnsListProps, ReturnsOrderDetail, ReturnsOrderDetailProps, ReturnsOrderList, ReturnsOrderListProps, ReturnsProvider, ReturnsProviderProps, ReturnsResult, ReturnsResultProps, ReturnsSessionStatus, ReturnsTextsInput, SelectedReturnLine, UseCreateReturnResult, UseMyReturnResult, UseMyReturnsResult, UseReturnOrdersResult, UseReturnSessionResult, UseReturnableOrderResult, useCreateReturn, useMyReturn, useMyReturns, useReturnOrders, useReturnSession, useReturnableOrder, useReturnsAppearance, useReturnsSlot, useReturnsText } from './returns.mjs';
|
|
6
6
|
export { b as RETURNS_SLOT_NAMES, R as ReturnsAppearance, c as ReturnsAppearanceElements, d as ReturnsAppearanceTokens, e as ReturnsSlotAppearance, f as ReturnsSlotName, h as ReturnsTextKey, a as ReturnsTexts, g as ReturnsTheme } from './texts-tQtAGJCT.mjs';
|
|
7
7
|
import { ReactNode } from 'react';
|
|
8
8
|
import z__default from 'zod';
|
|
9
|
-
import { P as PanelProps, G as GetThemeOutput } from './types-
|
|
10
|
-
export { a as PanelLoginProps, b as PanelScreen, c as PanelSearchParamsType } from './types-
|
|
9
|
+
import { P as PanelProps, G as GetThemeOutput } from './types-BnVWLcoB.mjs';
|
|
10
|
+
export { a as PanelLoginProps, b as PanelScreen, c as PanelSearchParamsType } from './types-BnVWLcoB.mjs';
|
|
11
11
|
import './models.mjs';
|
|
12
12
|
import '@bufbuild/protobuf/wkt';
|
|
13
13
|
import '@bufbuild/protobuf';
|
|
@@ -131,6 +131,20 @@ type CheckoutTexts = {
|
|
|
131
131
|
nextStep: string;
|
|
132
132
|
/** Error shown when some products are out of stock. */
|
|
133
133
|
unavailableProducts: string;
|
|
134
|
+
/** Error shown when the checkout fails and the server gave no reason. */
|
|
135
|
+
checkoutFailed: string;
|
|
136
|
+
/** Error shown when the shop has no payment gateway connected. */
|
|
137
|
+
noPaymentGateway: string;
|
|
138
|
+
/** Error shown when the payment gateway of the shop is not set up. */
|
|
139
|
+
gatewayNotConfigured: string;
|
|
140
|
+
/** Error shown when delivery of the shop is not set up. */
|
|
141
|
+
shippingNotConfigured: string;
|
|
142
|
+
/** Error shown when the cart mixes subscriptions with one-time products. */
|
|
143
|
+
mixedRecurring: string;
|
|
144
|
+
/** Error shown when the cart currency cannot be paid in. */
|
|
145
|
+
currencyUnsupported: string;
|
|
146
|
+
/** Error shown when a price changed after the product was added. */
|
|
147
|
+
priceChanged: string;
|
|
134
148
|
};
|
|
135
149
|
|
|
136
150
|
type BitsnapCartProps = {
|
|
@@ -454,16 +468,34 @@ declare namespace Bitsnap {
|
|
|
454
468
|
declare function createPaymentURL(request: LinkRequest): Promise<Err | {
|
|
455
469
|
url: string;
|
|
456
470
|
}>;
|
|
471
|
+
/**
|
|
472
|
+
* What `createCheckout` resolves to. A failed response is an `Err` that also
|
|
473
|
+
* has `status: "error"`, so `result.status === "ok"` narrows to the success.
|
|
474
|
+
*/
|
|
475
|
+
type CreateCheckoutResult = {
|
|
476
|
+
status: "ok";
|
|
477
|
+
redirectURL: string;
|
|
478
|
+
} | (Err & {
|
|
479
|
+
status: "error";
|
|
480
|
+
});
|
|
457
481
|
declare function createCheckout(request: LinkRequest & {
|
|
458
482
|
apiKey?: string;
|
|
459
483
|
testMode?: boolean;
|
|
460
|
-
}): Promise<
|
|
461
|
-
status: string;
|
|
462
|
-
redirectURL: string;
|
|
463
|
-
}>;
|
|
484
|
+
}): Promise<CreateCheckoutResult>;
|
|
464
485
|
declare function getReferenceIfPossible(): string | undefined;
|
|
465
486
|
declare function injectReferenceToRequestIfNeeded(request: LinkRequest): LinkRequest;
|
|
466
487
|
|
|
488
|
+
/** Code of an Err that carries the ids of unavailable products in `data`. */
|
|
489
|
+
declare const ITEM_IDS_NOT_FOUND = "item-ids-not-found";
|
|
490
|
+
/**
|
|
491
|
+
* `data` of a buy Err that is not `item-ids-not-found`. `itemIds` is set when
|
|
492
|
+
* the backend listed products under a code other than "not available".
|
|
493
|
+
*/
|
|
494
|
+
type BuyErrorData = {
|
|
495
|
+
message?: string;
|
|
496
|
+
itemIds?: string[];
|
|
497
|
+
};
|
|
498
|
+
|
|
467
499
|
declare const PanelLogin: ({ analytics, }?: {
|
|
468
500
|
analytics?: AnalyticsOption;
|
|
469
501
|
}) => react_jsx_runtime.JSX.Element;
|
|
@@ -516,4 +548,4 @@ declare function persistReturnURL(returnURL: string | null): void;
|
|
|
516
548
|
declare function readPersistedReturnURL(): string | null;
|
|
517
549
|
declare function buildAccessTokenRedirect(returnURL: string, accessToken: string): string;
|
|
518
550
|
|
|
519
|
-
export { AnalyticsOption, Wrapper$2 as ApplePayButton, type Props$3 as ApplePayButtonProps, Bitsnap, type BitsnapCartProps, BitsnapCart as BitsnapCheckout, CHECKOUT_SLOT_NAMES, type CheckoutAppearance, type CheckoutAppearanceElements, type CheckoutAppearanceTokens, type CheckoutSlotAppearance, type CheckoutSlotName, type CheckoutTexts, type CheckoutTheme, type ComponentClassNames, type CustomizationTexts, GetThemeOutput, Wrapper$1 as GooglePayButton, type Props$2 as GooglePayButtonProps, type LinkRequest, type NotificationGroup, Wrapper as NotificationsComponent, type Props$1 as NotificationsComponentProps, type NotificationsComponentPublicProps, PanelPage as Panel, type PanelConfig, PanelLogin, PanelProps, PanelProvider, type PublicNotificationGroup, PublicOrderPage, buildAccessTokenRedirect, createCheckout, createPaymentURL, getAllowedReturnOrigins, getLocale, getPanelConfig, getReferenceIfPossible, getReturnURLFromSearch, injectReferenceToRequestIfNeeded, persistReturnURL, readPersistedReturnURL, setAllowedReturnOrigins, setCustomHost, setHost, setLocale, setLoginURL, setPanelConfig, setProjectID as setPanelProjectID, setProjectID$1 as setProjectID, setTheme, usePanelConfig };
|
|
551
|
+
export { AnalyticsOption, Wrapper$2 as ApplePayButton, type Props$3 as ApplePayButtonProps, Bitsnap, type BitsnapCartProps, BitsnapCart as BitsnapCheckout, type BuyErrorData, CHECKOUT_SLOT_NAMES, type CheckoutAppearance, type CheckoutAppearanceElements, type CheckoutAppearanceTokens, type CheckoutSlotAppearance, type CheckoutSlotName, type CheckoutTexts, type CheckoutTheme, type ComponentClassNames, type CreateCheckoutResult, type CustomizationTexts, GetThemeOutput, Wrapper$1 as GooglePayButton, type Props$2 as GooglePayButtonProps, ITEM_IDS_NOT_FOUND, type LinkRequest, type NotificationGroup, Wrapper as NotificationsComponent, type Props$1 as NotificationsComponentProps, type NotificationsComponentPublicProps, PanelPage as Panel, type PanelConfig, PanelLogin, PanelProps, PanelProvider, type PublicNotificationGroup, PublicOrderPage, buildAccessTokenRedirect, createCheckout, createPaymentURL, getAllowedReturnOrigins, getLocale, getPanelConfig, getReferenceIfPossible, getReturnURLFromSearch, injectReferenceToRequestIfNeeded, persistReturnURL, readPersistedReturnURL, setAllowedReturnOrigins, setCustomHost, setHost, setLocale, setLoginURL, setPanelConfig, setProjectID as setPanelProjectID, setProjectID$1 as setProjectID, setTheme, usePanelConfig };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { A as AnalyticsOption, l as Instrument } from './instrument-
|
|
2
|
+
import { A as AnalyticsOption, l as Instrument } from './instrument-CmxK7S4T.js';
|
|
3
3
|
import { S as SlotAppearance, A as AppearanceElements } from './appearance-core-Dt2grZdl.js';
|
|
4
4
|
export { PRODUCT_LIST_SLOT_NAMES, ProductList, ProductListAppearance, ProductListAppearanceElements, ProductListAppearanceTokens, ProductListData, ProductListItemContext, ProductListProps, ProductListSlotAppearance, ProductListSlotName, ProductListTextKey, ProductListTexts, ProductListTheme, PublicListProduct, UseProductsOptions, UseProductsResult, formatProductPrice, useProducts } from './catalog.js';
|
|
5
5
|
export { BitsnapReturns, BitsnapReturnsProps, BitsnapReturnsProvider, BitsnapReturnsProviderProps, CreateReturnInput, Environment, LegacyCreateReturnInput, LegacyReturnsTexts, LegacyReturnsTheme, ReturnsAppearanceProvider, ReturnsChallenge, ReturnsCodeStep, ReturnsCodeStepProps, ReturnsConfirmation, ReturnsConfirmationProps, ReturnsEmailStep, ReturnsEmailStepProps, ReturnsEnvironment, ReturnsEnvironmentInput, ReturnsMyReturnDetail, ReturnsMyReturnDetailProps, ReturnsMyReturnsList, ReturnsMyReturnsListProps, ReturnsOrderDetail, ReturnsOrderDetailProps, ReturnsOrderList, ReturnsOrderListProps, ReturnsProvider, ReturnsProviderProps, ReturnsResult, ReturnsResultProps, ReturnsSessionStatus, ReturnsTextsInput, SelectedReturnLine, UseCreateReturnResult, UseMyReturnResult, UseMyReturnsResult, UseReturnOrdersResult, UseReturnSessionResult, UseReturnableOrderResult, useCreateReturn, useMyReturn, useMyReturns, useReturnOrders, useReturnSession, useReturnableOrder, useReturnsAppearance, useReturnsSlot, useReturnsText } from './returns.js';
|
|
6
6
|
export { b as RETURNS_SLOT_NAMES, R as ReturnsAppearance, c as ReturnsAppearanceElements, d as ReturnsAppearanceTokens, e as ReturnsSlotAppearance, f as ReturnsSlotName, h as ReturnsTextKey, a as ReturnsTexts, g as ReturnsTheme } from './texts-CIEFbJTN.js';
|
|
7
7
|
import { ReactNode } from 'react';
|
|
8
8
|
import z__default from 'zod';
|
|
9
|
-
import { P as PanelProps, G as GetThemeOutput } from './types-
|
|
10
|
-
export { a as PanelLoginProps, b as PanelScreen, c as PanelSearchParamsType } from './types-
|
|
9
|
+
import { P as PanelProps, G as GetThemeOutput } from './types-i-IuN4Im.js';
|
|
10
|
+
export { a as PanelLoginProps, b as PanelScreen, c as PanelSearchParamsType } from './types-i-IuN4Im.js';
|
|
11
11
|
import './models.js';
|
|
12
12
|
import '@bufbuild/protobuf/wkt';
|
|
13
13
|
import '@bufbuild/protobuf';
|
|
@@ -131,6 +131,20 @@ type CheckoutTexts = {
|
|
|
131
131
|
nextStep: string;
|
|
132
132
|
/** Error shown when some products are out of stock. */
|
|
133
133
|
unavailableProducts: string;
|
|
134
|
+
/** Error shown when the checkout fails and the server gave no reason. */
|
|
135
|
+
checkoutFailed: string;
|
|
136
|
+
/** Error shown when the shop has no payment gateway connected. */
|
|
137
|
+
noPaymentGateway: string;
|
|
138
|
+
/** Error shown when the payment gateway of the shop is not set up. */
|
|
139
|
+
gatewayNotConfigured: string;
|
|
140
|
+
/** Error shown when delivery of the shop is not set up. */
|
|
141
|
+
shippingNotConfigured: string;
|
|
142
|
+
/** Error shown when the cart mixes subscriptions with one-time products. */
|
|
143
|
+
mixedRecurring: string;
|
|
144
|
+
/** Error shown when the cart currency cannot be paid in. */
|
|
145
|
+
currencyUnsupported: string;
|
|
146
|
+
/** Error shown when a price changed after the product was added. */
|
|
147
|
+
priceChanged: string;
|
|
134
148
|
};
|
|
135
149
|
|
|
136
150
|
type BitsnapCartProps = {
|
|
@@ -454,16 +468,34 @@ declare namespace Bitsnap {
|
|
|
454
468
|
declare function createPaymentURL(request: LinkRequest): Promise<Err | {
|
|
455
469
|
url: string;
|
|
456
470
|
}>;
|
|
471
|
+
/**
|
|
472
|
+
* What `createCheckout` resolves to. A failed response is an `Err` that also
|
|
473
|
+
* has `status: "error"`, so `result.status === "ok"` narrows to the success.
|
|
474
|
+
*/
|
|
475
|
+
type CreateCheckoutResult = {
|
|
476
|
+
status: "ok";
|
|
477
|
+
redirectURL: string;
|
|
478
|
+
} | (Err & {
|
|
479
|
+
status: "error";
|
|
480
|
+
});
|
|
457
481
|
declare function createCheckout(request: LinkRequest & {
|
|
458
482
|
apiKey?: string;
|
|
459
483
|
testMode?: boolean;
|
|
460
|
-
}): Promise<
|
|
461
|
-
status: string;
|
|
462
|
-
redirectURL: string;
|
|
463
|
-
}>;
|
|
484
|
+
}): Promise<CreateCheckoutResult>;
|
|
464
485
|
declare function getReferenceIfPossible(): string | undefined;
|
|
465
486
|
declare function injectReferenceToRequestIfNeeded(request: LinkRequest): LinkRequest;
|
|
466
487
|
|
|
488
|
+
/** Code of an Err that carries the ids of unavailable products in `data`. */
|
|
489
|
+
declare const ITEM_IDS_NOT_FOUND = "item-ids-not-found";
|
|
490
|
+
/**
|
|
491
|
+
* `data` of a buy Err that is not `item-ids-not-found`. `itemIds` is set when
|
|
492
|
+
* the backend listed products under a code other than "not available".
|
|
493
|
+
*/
|
|
494
|
+
type BuyErrorData = {
|
|
495
|
+
message?: string;
|
|
496
|
+
itemIds?: string[];
|
|
497
|
+
};
|
|
498
|
+
|
|
467
499
|
declare const PanelLogin: ({ analytics, }?: {
|
|
468
500
|
analytics?: AnalyticsOption;
|
|
469
501
|
}) => react_jsx_runtime.JSX.Element;
|
|
@@ -516,4 +548,4 @@ declare function persistReturnURL(returnURL: string | null): void;
|
|
|
516
548
|
declare function readPersistedReturnURL(): string | null;
|
|
517
549
|
declare function buildAccessTokenRedirect(returnURL: string, accessToken: string): string;
|
|
518
550
|
|
|
519
|
-
export { AnalyticsOption, Wrapper$2 as ApplePayButton, type Props$3 as ApplePayButtonProps, Bitsnap, type BitsnapCartProps, BitsnapCart as BitsnapCheckout, CHECKOUT_SLOT_NAMES, type CheckoutAppearance, type CheckoutAppearanceElements, type CheckoutAppearanceTokens, type CheckoutSlotAppearance, type CheckoutSlotName, type CheckoutTexts, type CheckoutTheme, type ComponentClassNames, type CustomizationTexts, GetThemeOutput, Wrapper$1 as GooglePayButton, type Props$2 as GooglePayButtonProps, type LinkRequest, type NotificationGroup, Wrapper as NotificationsComponent, type Props$1 as NotificationsComponentProps, type NotificationsComponentPublicProps, PanelPage as Panel, type PanelConfig, PanelLogin, PanelProps, PanelProvider, type PublicNotificationGroup, PublicOrderPage, buildAccessTokenRedirect, createCheckout, createPaymentURL, getAllowedReturnOrigins, getLocale, getPanelConfig, getReferenceIfPossible, getReturnURLFromSearch, injectReferenceToRequestIfNeeded, persistReturnURL, readPersistedReturnURL, setAllowedReturnOrigins, setCustomHost, setHost, setLocale, setLoginURL, setPanelConfig, setProjectID as setPanelProjectID, setProjectID$1 as setProjectID, setTheme, usePanelConfig };
|
|
551
|
+
export { AnalyticsOption, Wrapper$2 as ApplePayButton, type Props$3 as ApplePayButtonProps, Bitsnap, type BitsnapCartProps, BitsnapCart as BitsnapCheckout, type BuyErrorData, CHECKOUT_SLOT_NAMES, type CheckoutAppearance, type CheckoutAppearanceElements, type CheckoutAppearanceTokens, type CheckoutSlotAppearance, type CheckoutSlotName, type CheckoutTexts, type CheckoutTheme, type ComponentClassNames, type CreateCheckoutResult, type CustomizationTexts, GetThemeOutput, Wrapper$1 as GooglePayButton, type Props$2 as GooglePayButtonProps, ITEM_IDS_NOT_FOUND, type LinkRequest, type NotificationGroup, Wrapper as NotificationsComponent, type Props$1 as NotificationsComponentProps, type NotificationsComponentPublicProps, PanelPage as Panel, type PanelConfig, PanelLogin, PanelProps, PanelProvider, type PublicNotificationGroup, PublicOrderPage, buildAccessTokenRedirect, createCheckout, createPaymentURL, getAllowedReturnOrigins, getLocale, getPanelConfig, getReferenceIfPossible, getReturnURLFromSearch, injectReferenceToRequestIfNeeded, persistReturnURL, readPersistedReturnURL, setAllowedReturnOrigins, setCustomHost, setHost, setLocale, setLoginURL, setPanelConfig, setProjectID as setPanelProjectID, setProjectID$1 as setProjectID, setTheme, usePanelConfig };
|