PageSourceSearch

https://vasgallery.org.au/_s/assets/StripeExpressCheckout-CpEHQ5NI.js

js vasgallery.org.au collected 2026-10-02 10:02:52 UTC 6,051 bytes, 1 lines download raw bytes

1import{a as A}from"./handlerShim-BYTyRQMS.js";function E(e){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?E=function(t){return typeof t}:E=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},E(e)}var q="dahlia",M=function(t){return t===3?"v3":t},I="https://js.stripe.com",N="".concat(I,"/").concat(q,"/stripe.js"),$=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,J=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/;var V=function(t){return $.test(t)||J.test(t)},D=function(){for(var t=document.querySelectorAll('script[src^="'.concat(I,'"]')),r=0;r<t.length;r++){var i=t[r];if(V(i.src))return i}return null},L=function(t){var r="",i=document.createElement("script");i.src="".concat(N).concat(r);var n=document.head||document.body;if(!n)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return n.appendChild(i),i},G=function(t,r){!t||!t._registerWrapper||t._registerWrapper({name:"stripe-js",version:"9.9.0",startTime:r})},f=null,S=null,v=null,O=function(t){return function(r){t(new Error("Failed to load Stripe.js",{cause:r}))}},W=function(t,r){return function(){window.Stripe?t(window.Stripe):r(new Error("Stripe.js not available"))}},F=function(t){return f!==null?f:(f=new Promise(function(r,i){if(typeof window>"u"||typeof document>"u"){r(null);return}if(window.Stripe){r(window.Stripe);return}try{var n=D();if(!(n&&t)){if(!n)n=L(t);else if(n&&v!==null&&S!==null){var o;n.removeEventListener("load",v),n.removeEventListener("error",S),(o=n.parentNode)===null||o===void 0||o.removeChild(n),n=L(t)}}v=W(r,i),S=O(i),n.addEventListener("load",v),n.addEventListener("error",S)}catch(s){i(s);return}}),f.catch(function(r){return f=null,Promise.reject(r)}))},K=function(t,r,i){if(t===null)return null;var n=r[0];if(typeof n!="string")throw new Error("Expected publishable key to be of type string, got type ".concat(E(n)," instead."));var o=n.match(/^pk_test/),s=M(t.version),l=q;o&&s!==l&&console.warn("Stripe.js@".concat(s," was loaded on the page, but @stripe/stripe-js@").concat("9.9.0"," expected Stripe.js@").concat(l,". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));var y=t.apply(void 0,r);return G(y,i),y},h,T=!1,C=function(){return h||(h=F(null).catch(function(t){return h=null,Promise.reject(t)}),h)};Promise.resolve().then(function(){return C()}).catch(function(e){T||console.warn(e)});var X=function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];T=!0;var n=Date.now();return C().then(function(o){return K(o,r,n)})};function p(e,t){const r=e.querySelector(".stripe-express-message");r&&(r.innerText=t)}async function b(e,t){const r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw new Error(await r.text());return r.json()}function z(e){const t=e.billingDetails||e.shippingDetails||{},r=e.shippingAddress||e.address||t.address||e.shipping_address||{};return{address:r,shippingAddress:r,email:e.email||t.email||e.payerEmail||"",name:e.name||t.name||e.recipient||"",phone:e.phone||e.phoneNumber||t.phone||e.payerPhone||""}}function _(e){const t=e.shippingRate||e.selectedShippingRate||e.shippingOption||null;return t||(e.id?{id:e.id,amount:e.amount,displayName:e.displayName}:null)}function P(e){return e===1||e==="1"||e===!0}function B(e,t){const r=_(t);if(r&&typeof r=="object"&&"amount"in r)return parseInt(String(r.amount??"0"),10)||0;const i=typeof r=="string"?r:r&&typeof r=="object"&&"id"in r?String(r.id):"";return e.shippingRates.find(n=>n.id===i)?.amount??e.shippingRates[0]?.amount??0}function H(e,t){const{mergePaymentIntent:r,...i}=t;e.resolve(i)}async function Q(e,t){const r=t.mode==="cart"||e.dataset.mode==="cart",i=parseInt(e.dataset.productId??"0",10);let n=parseInt(e.dataset.amount??"0",10)*(t.qty||1),o="",s=e.dataset.ship!=="virtual";if(!t.payMethodUuid||!t.publicKey||!r&&i<1)return p(e,"Stripe Express Checkout is not configured."),{};if(r)try{const a=await b(`/~payment/stripe/express-cart-update/${t.payMethodUuid}`,{});n=a.amount,o=a.cartUuid||o,s=a.shippingAddressRequired??s}catch(a){return p(e,a instanceof Error?a.message:String(a)),{}}if(n<1)return p(e,"Stripe Express Checkout is not available for this cart."),{};const l=await X(t.publicKey),y=P(e.dataset.themeDark),x=P(e.dataset.maxColumns)?1:void 0,g=l.elements({amount:n,appearance:{theme:y?"night":"stripe"},currency:"aud",mode:"payment"}),m=g.create("expressCheckout",{layout:{overflow:"never",...x?{maxColumns:x}:{}}
1,shippingAddressRequired:s,emailRequired:!0,phoneNumberRequired:!0});let w=null;async function R(a){try{const u=r?`/~payment/stripe/express-cart-update/${t.payMethodUuid}`:`/~payment/stripe/express-shipping/${t.payMethodUuid}`,d=await b(u,{cartUuid:o,...r?{mode:"cart"}:{productId:i,qty:t.qty||1},...z(a),shippingRate:_(a)});o=d.cartUuid||o,g.update({amount:d.amount+B(d,a)}),H(a,d)}catch(u){p(e,u instanceof Error?u.message:String(u)),a.resolve({status:"invalid_shipping_address"})}}m.on("shippingaddresschange",R),m.on("shippingratechange",R),m.on("ready",()=>{e.querySelector(".stripe-express-checkout").classList.remove("loading")}),m.on("confirm",async a=>{const{error:u}=await g.submit();if(u){p(e,u.message);return}const{paymentFailed:d,...k}=a;try{const c=r?`/~payment/stripe/intent/${t.payMethodUuid}`:`/~payment/stripe/express-complete/${t.payMethodUuid}`;w=await b(c,{cartUuid:o,...r?{mode:"cart"}:{productId:i,qty:t.qty||1},confirm:k}),o=w.cartUuid||o}catch(c){d({message:c instanceof Error?c.message:String(c)}),p(e,c instanceof Error?c.message:String(c));return}const{error:j}=await l.confirmPayment({elements:g,clientSecret:w.clientSecret,confirmParams:{return_url:document.location.origin+`/~payment/stripe/process/${t.payMethodUuid}`}});if(j){p(e,j.message);return}});const U=e.querySelector(".stripe-express-checkout");return U&&m.mount(U),{}}const Z=A(e=>Q(e.el,e.data));export{Z as handler};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.