PageSourceSearch

https://www.shells.com/assets/PayPalPaymentForm-Bm_b5Eux.js

js shells.com collected 2026-10-03 22:59:43 UTC 7,647 bytes, 16 lines download raw bytes

vendor: 4,129 bytes, lines 1-16
1import{_ as K,u as L,k as y,z as M,O as N,B as V,a2 as Z,A as H,c as v,o as m,b as d,t as g,d as x,f as Q,E as $,aa as G}from"./index-DrluhU3h.js";/*!
2 * paypal-js v9.0.1 (2025-10-03T16:05:19.915Z)
3 * Copyright 2020-present, PayPal, Inc. All rights reserved.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */function J(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,a=Object.getOwnPropertySymbols(e);n<a.length;n++)t.indexOf(a[n])<0&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(r[a[n]]=e[a[n]]);return r}function R(e,t){var r=document.querySelector('script[src="'.concat(e,'"]'));if(r===null)return null;var a=F(e,t),n=r.cloneNode();if(delete n.dataset.uidAuto,Object.keys(n.dataset).length!==Object.keys(a.dataset).length)return null;var o=!0;return Object.keys(n.dataset).forEach(function(s){n.dataset[s]!==a.dataset[s]&&(o=!1)}),o?r:null}function X(e){var t=e.url,r=e.attributes,a=e.onSuccess,n=e.onError,o=F(t,r);o.onerror=n,o.onload=a,document.head.insertBefore(o,document.head.firstElementChild)}function Y(e){var t=e.sdkBaseUrl,r=e.environment,a=J(e,["sdkBaseUrl","environment"]),n=t||te(r),o=a,s=Object.keys(o).filter(function(l){return typeof o[l]<"u"&&o[l]!==null&&o[l]!==""}).reduce(function(l,i){var b=o[i].toString();return i=ee(i),i.substring(0,4)==="data"||i==="crossorigin"?l.attributes[i]=b:l.queryParams[i]=b,l},{queryParams:{},attributes:{}}),c=s.queryParams,u=s.attributes;return c["merchant-id"]&&c["merchant-id"].indexOf(",")!==-1&&(u["data-merchant-id"]=c["merchant-id"],c["merchant-id"]="*"),{url:"".concat(n,"?").concat(re(c)),attributes:u}}function ee(e){var t=function(r,a){return(a?"-":"")+r.toLowerCase()};return e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,t)}function re(e){var t="";return Object.keys(e).forEach(function(r){t.length!==0&&(t+="&"),t+=r+"="+e[r]}),t}function te(e){return e==="sandbox"?"https://www.sandbox.paypal.com/sdk/js":"https://www.paypal.com/sdk/js"}function F(e,t){t===void 0&&(t={});var r=document.createElement("script");return r.src=e,Object.keys(t).forEach(function(a){r.setAttribute(a,t[a]),a==="data-csp-nonce"&&r.setAttribute("nonce",t["data-csp-nonce"])}),r}function ae(e,t){if(t===void 0&&(t=Promise),W(e,t),typeof document>"u")return t.resolve(null);var r=Y(e),a=r.url,n=r.attributes,o=n["data-namespace"]||"paypal",s=z(o);return n["data-js-sdk-library"]||(n["data-js-sdk-library"]="paypal-js"),R(a,n)&&s?t.resolve(s):ne({url:a,attributes:n},t).then(function(){var c=z(o);if(c)return c;throw new Error("The window.".concat(o," global variable is not available."))})}function ne(e,t){t===void 0&&(t=Promise),W(e,t);var r=e.url,a=e.attributes;if(typeof r!="string"||r.length===0)throw new Error("Invalid url.");if(typeof a<"u"&&typeof a!="object")throw new Error("Expected attributes to be an object.");return new t(function(n,o){if(typeof document>"u")return n();X({url:r,attributes:a,onSuccess:function(){return n()},onError:function(){var s=new Error('The script "'.concat(r,'" failed to load. Check the HTTP status code and response body in DevTools to learn more.'));return o(s)}})})}function z(e){return window[e]}function W(e,t){if(typeof e!="object"||e===null)throw new Error("Expected an options object.");var r=e.environment;if(r&&r!=="production"&&r!=="sandbox")throw new Error('The `environment` option must be either "production" or "sandbox".');if(typeof t<"u"&&typeof t!="function")throw new Error("Expected PromisePonyfill to be a function.")}const oe={class:"paypal-payment-form"},se={key:0,class:"text-center py-8"}
16,ce={class:"text-neutral-600 dark:text-neutral-400"},ie={key:1,class:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-6"},le={class:"text-red-700 dark:text-red-300"},de={key:2},ue={class:"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-lg p-4 mb-4"},pe={class:"text-blue-700 dark:text-blue-300 text-sm"},fe={key:0,class:"text-center py-8"},ye={class:"text-neutral-600 dark:text-neutral-400"},be={__name:"PayPalPaymentForm",props:{orderId:{type:String,required:!0},paypalData:{type:Object,required:!0},paymentSession:{type:String,required:!1,default:null}},emits:["paymentSuccess","paymentError"],setup(e,{emit:t}){var k,O,P,j,B,I,C,D;const r=e,a=t,{t:n}=L(),o=y(null),s=y(!0),c=y(null),u=y(!1),l=y(null),i=y(null),b=(j=(P=(O=(k=r.paypalData)==null?void 0:k.fields)==null?void 0:O._internal_finalize)==null?void 0:P.attributes)==null?void 0:j.client_id,S=(D=(C=(I=(B=r.paypalData)==null?void 0:B.fields)==null?void 0:I.order_id)==null?void 0:C.attributes)==null?void 0:D.options;return M(async()=>{var E,p,T;if(!b||!S){c.value=n("order.errors.paypal_invalid_config")||"Invalid PayPal configuration",s.value=!1;return}try{if(l.value=await ae({clientId:b,currency:((T=(p=(E=S.purchase_units)==null?void 0:E[0])==null?void 0:p.amount)==null?void 0:T.currency_code)||"USD"}),!l.value)throw new Error("Failed to load PayPal SDK");if(await N(),s.value=!1,await N(),o.value&&l.value.Buttons)i.value=l.value.Buttons({style:{layout:"vertical",color:"gold",shape:"rect",label:"paypal"},createOrder:(h,w)=>w.order.create(S),onApprove:async h=>{var w,q,A,U;u.value=!0;try{const _={method:"Paypal",order_id:h.orderID};r.paymentSession&&(_.session=r.paymentSession);const f=await V.rest(`Order/${r.orderId}:process`,"POST",_);if(((q=(w=f==null?void 0:f.data)==null?void 0:w.order)==null?void 0:q.Status)==="completed"||((U=(A=f==null?void 0:f.data)==null?void 0:A.order)==null?void 0:U.Status)==="paid")a("paymentSuccess");else throw new Error(n("order.error_process_order"))}catch(_){a("paymentError",_.message||n("order.errors.paypal_payment_failed"))}finally{u.value=!1}},onCancel:()=>{a("paymentError",n("order.errors.paypal_canceled")||"Payment was cancelled")},onError:()=>{a("paymentError",n("order.errors.paypal_error")||"An error occurred during payment")}}),await i.value.render(o.value);else throw new Error("PayPal container not available")}catch(h){console.error("PayPal initialization error:",h),c.value=n("order.errors.paypal_load_failed")||"Failed to load PayPal. Please try again.",s.value=!1}}),Z(()=>{i.value&&typeof i.value.close=="function"&&i.value.close()}),H(()=>r.paypalData,()=>{},{deep:!0}),(E,p)=>(m(),v("div",oe,[s.value?(m(),v("div",se,[p[0]||(p[0]=d("div",{class:"inline-block w-8 h-8 border-4 border-accent-600/20 border-t-accent-600 rounded-full animate-spin mb-2"},null,-1)),d("p",ce,g(x(n)("order.loading_paypal")||"Loading PayPal..."),1)])):c.value?(m(),v("div",ie,[d("p",le,g(c.value),1)])):(m(),v("div",de,[d("div",ue,[d("p",pe,g(x(n)("order.paypal_info_desc")||"Pay securely with PayPal"),1)]),u.value?(m(),v("div",fe,[p[1]||(p[1]=d("div",{class:"inline-block w-8 h-8 border-4 border-accent-600/20 border-t-accent-600 rounded-full animate-spin mb-2"},null,-1)),d("p",ye,g(x(n)("order.processing_payment")||"Processing payment..."),1)])):Q("",!0),$(d("div",{ref_key:"paypalContainer",ref:o,class:"paypal-buttons-container"},null,512),[[G,!u.value]])]))]))}},me=K(be,[["__scopeId","data-v-7fde2123"]]);export{me as default};

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.