@wayke-se/ecom-web 1.4.7-beta.6 → 1.4.7-beta.7
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/dist/index.d.ts +4 -0
- package/dist/index.js +4 -4
- package/dist/index.js.map +2 -2
- package/dist/index.mjs +4 -4
- package/dist/index.mjs.map +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -408,6 +408,7 @@ declare module '@wayke-se/ecom-web/src/Components/BankId/BankIdSign' {
|
|
|
408
408
|
finalizing?: boolean;
|
|
409
409
|
readonly onStart: (method: AuthMethod) => void;
|
|
410
410
|
readonly onAbort: () => void;
|
|
411
|
+
readonly onSameDeviceClick?: () => void;
|
|
411
412
|
}
|
|
412
413
|
class BankIdSign extends HtmlNode {
|
|
413
414
|
private readonly props;
|
|
@@ -442,6 +443,7 @@ declare module '@wayke-se/ecom-web/src/Components/BankId/BankIdSignSameDevice' {
|
|
|
442
443
|
interface BankIdSignSameDeviceProps {
|
|
443
444
|
readonly autoLaunchUrl?: string;
|
|
444
445
|
readonly errorMessage?: string;
|
|
446
|
+
onClick?: () => void;
|
|
445
447
|
}
|
|
446
448
|
class BankIdSignSameDevice extends HtmlNode {
|
|
447
449
|
private readonly props;
|
|
@@ -2082,6 +2084,7 @@ declare module '@wayke-se/ecom-web/src/Views/Main/Confirmation/VerifyByBankId' {
|
|
|
2082
2084
|
private readonly props;
|
|
2083
2085
|
private bankidStatusInterval?;
|
|
2084
2086
|
private bankidQrCodeInterval?;
|
|
2087
|
+
private focusTimeout?;
|
|
2085
2088
|
private view;
|
|
2086
2089
|
private contexts;
|
|
2087
2090
|
private ageError;
|
|
@@ -2095,6 +2098,7 @@ declare module '@wayke-se/ecom-web/src/Views/Main/Confirmation/VerifyByBankId' {
|
|
|
2095
2098
|
private removeWindowEvents;
|
|
2096
2099
|
private clearIntervals;
|
|
2097
2100
|
private onFocus;
|
|
2101
|
+
private onSameDeviceClick;
|
|
2098
2102
|
private setBankidRequestRef;
|
|
2099
2103
|
private clearBankidRequestRef;
|
|
2100
2104
|
private acceptCreditAssessment;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";(()=>{var Uc=Object.create;var zo=Object.defineProperty;var Fc=Object.getOwnPropertyDescriptor;var Vc=Object.getOwnPropertyNames;var Gc=Object.getPrototypeOf,qc=Object.prototype.hasOwnProperty;var f=(o=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(o,{get:(i,e)=>(typeof require<"u"?require:i)[e]}):o)(function(o){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+o+'" is not supported')});var Wc=(o,i,e,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let s of Vc(i))!qc.call(o,s)&&s!==e&&zo(o,s,{get:()=>i[s],enumerable:!(t=Fc(i,s))||t.enumerable});return o};var Yc=(o,i,e)=>(e=o!=null?Uc(Gc(o)):{},Wc(i||!o||!o.__esModule?zo(e,"default",{value:o,enumerable:!0}):e,o));var Mc=f("@wayke-se/ecom");var Jo={name:"@wayke-se/ecom-web",version:"1.4.7-beta.
|
|
1
|
+
"use strict";(()=>{var Uc=Object.create;var zo=Object.defineProperty;var Fc=Object.getOwnPropertyDescriptor;var Vc=Object.getOwnPropertyNames;var Gc=Object.getPrototypeOf,qc=Object.prototype.hasOwnProperty;var f=(o=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(o,{get:(i,e)=>(typeof require<"u"?require:i)[e]}):o)(function(o){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+o+'" is not supported')});var Wc=(o,i,e,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let s of Vc(i))!qc.call(o,s)&&s!==e&&zo(o,s,{get:()=>i[s],enumerable:!(t=Fc(i,s))||t.enumerable});return o};var Yc=(o,i,e)=>(e=o!=null?Uc(Gc(o)):{},Wc(i||!o||!o.__esModule?zo(e,"default",{value:o,enumerable:!0}):e,o));var Mc=f("@wayke-se/ecom");var Jo={name:"@wayke-se/ecom-web",version:"1.4.7-beta.7",description:"Wayke Ecom Web",module:"dist/index.mjs",main:"dist/index.js",types:"dist/index.d.ts",homepage:"https://github.com/wayke-se/wayke-ecom-web",scripts:{start:"node ./esbuild/start.js",cl:"node ./esbuild/cl.js",build:"npm run clean && node ./esbuild/lib.js && node ./esbuild/cdn.js",clean:"rimraf build && rimraf dist && rimraf dist-cdn",test:"npm run lint && npm run typecheck",typecheck:"tsc -noEmit","typecheck:watch":"tsc -noEmit -watch",lint:"eslint --ext .ts,.js 'src'","lint:fix":"eslint --ext .ts,.js 'src' --fix",stylelint:"stylelint '**/*.scss'",prepare:"husky install"},author:"Wayke",license:"ISC",devDependencies:{"@types/marked":"^4.0.3","@types/node":"^17.0.18","@types/object-path":"^0.11.1","@types/sanitize-html":"^2.6.2","@typescript-eslint/eslint-plugin":"^5.12.0","@typescript-eslint/parser":"^5.12.0",esbuild:"^0.15.8","esbuild-sass-plugin":"^2.2.3",eslint:"^8.9.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0",husky:"^8.0.1","npm-dts":"^1.3.11",prettier:"^2.5.1",rimraf:"^4.1.3",stylelint:"^15.2.0","stylelint-config-prettier-scss":"^0.0.1","stylelint-config-standard-scss":"^7.0.1",typescript:"^4.5.5"},dependencies:{"@wayke-se/ecom":"^4.2.0-beta.1",marked:"^4.0.16","object-path":"^0.11.8",redux:"^4.1.2","sanitize-html":"^2.7.0"},files:["dist"]};var Ii=f("redux");var Ae=f("@wayke-se/ecom");var st=(o,i)=>o!==void 0&&i!==void 0?JSON.stringify(o).localeCompare(JSON.stringify(i))===0:o===i;var Se=o=>({costs:o.getCosts(),fees:o.getFees(),interests:o.getInterests(),durationSpec:o.getDurationSpec(),downPaymentSpec:o.getDownPaymentSpec(),residualValueSpec:o.getResidualValueSpec(),totalResidualValue:o.getTotalResidualValue(),publicURL:o.getPublicURL(),shouldUseCreditScoring:o.shouldUseCreditScoring(),financialProductCode:o.getFinancialProductCode(),price:o.getPrice(),creditAmount:o.getCreditAmount(),hasPrivacyPolicy:o.hasPrivacyPolicy(),privacyPolicyUrl:o.getPrivacyPolicyUrl()}),Xo=o=>({status:o.getStatus(),hasPendingSigning:o.hasPendingSigning(),hintCode:o.getHintCode(),signingMessage:o.getSigningMessage(),shouldRenewSigning:o.shouldRenewSigning(),isSigned:o.isSigned(),address:void 0,pendingScoring:o.hasPendingScoring(),isScored:o.isScored(),hasScoringError:o.hasScoringError(),scoringId:o.getScoringId(),recommendation:o.getRecommendation(),decision:o.getDecision(),isAccepted:o.isAccepted()}),Me=o=>({orderVehicle:o.getOrderVehicle(),accessories:o.getAccessories(),requiresDealerSelection:o.requiresDealerSelection(),dealerSites:o.getDealerSites(),paymentOptions:o.getPaymentOptions().map(e=>({...e,loanDetails:e.loanDetails?Se(e.loanDetails):void 0})),deliveryOptions:o.getDeliveryOptions(),insuranceOption:o.getInsuranceOption(),orderConditions:o.getOrderConditions(),orderReturnConditions:o.getOrderReturnConditions(),conditionsPdfUri:o.getConditionsPdfUri(),contactInformation:o.getContactInformation(),allowsTradeIn:o.allowsTradeIn(),isUnavailable:o.isUnavailable(),isPaymentRequired:o.isPaymentRequired()}),Zo=o=>({vehicle:o.getVehicle()});var ot="RESET",ei=o=>i=>i({type:ot,id:o}),it="SET_ORDER",xe=(o,i)=>e=>e({type:it,order:o,vehicle:i}),nt="SET_ID",ti=o=>i=>i({type:nt,id:o}),at="SET_CONTACT_EMAIL_AND_PHONE",si=o=>i=>i({type:at,value:o}),rt="SET_SOCIAL_ID_AND_ADDRESS",oi=(o,i,e)=>t=>t({type:rt,socialId:o,address:i,lastStage:e}),ct="SET_HOME_DELIVERY",ii=(o,i)=>e=>e({type:ct,homeDelivery:o,lastStage:i}),lt="SET_DEALER",ni=(o,i)=>e=>e({type:lt,dealer:o,lastStage:i}),dt="INIT_TRADE_IN",ai=o=>i=>i({type:dt,lastStage:o}),mt="SET_TRADE_IN",Ne=(o,i,e)=>t=>t({type:mt,lastStage:o,tradeIn:i,tradeInVehicle:e}),pt="SET_FINANCIAL",ri=(o,i)=>e=>e({type:pt,paymentType:o,lastStage:i}),ut="SET_PAYMENT_LOOKUP_RESPONSE",ci=o=>i=>i({type:ut,paymentLookupResponse:Se(o)}),ht="SET_DRIVING_DISTANCE",li=o=>i=>i({type:ht,drivingDistance:o}),kt="COMPLETE_STAGE",Z=o=>i=>i({type:kt,lastStage:o}),yt="SET_OR_REMOVE_INSURANCE",le=o=>i=>i({type:yt,insurance:o}),vt="SET_OR_REMOVE_INSURANCE_ADDONS",di=(o,i)=>e=>e({type:vt,insurance:o,insuranceAddons:i}),Et="SET_OR_REMOVE_FREE_INSURANCE",mi=o=>i=>i({type:Et,freeInsurance:o}),It="SET_OR_REMOVE_ACCESSORY",pi=o=>i=>i({type:It,accessory:o}),ft="GO_TO",M=(o,i,e)=>t=>t({type:ft,view:o,index:i,subStage:e}),_t="SET_STAGES",ui=o=>i=>i({type:_t,stages:o}),gt="SET_CREATED_ORDER_ID",hi=(o,i)=>e=>e({type:gt,id:o,payment:i}),wt="SET_CREDIT_ASSESSMENT_RESPONSE",de=(o,i)=>e=>e({type:wt,caseId:o,creditAssessmentResponse:i}),St="SET_STATE",ki=o=>i=>i({type:St,state:o});var jc={};var yi={view:"preview",stage:1,subStage:1},vi={id:"",topNavigation:{...yi},navigation:{...yi},customer:{email:"",phone:"",givenName:"",surname:"",socialId:""},homeDelivery:!1,accessories:[],drivingDistance:Ae.DrivingDistance.Between0And1000,...jc},ne=(o,i)=>i?{view:"summary",stage:1,subStage:1}:{view:"main",stage:o+1,subStage:1},ae=(o,i)=>i.view==="main"?o.stage<i.stage?i:v.topNavigation:{...o,stage:o.stage+1},Nt=o=>o&&o?.length===1&&o?.[0].type===Ae.PaymentType.Cash?Ae.PaymentType.Cash:void 0,v,At,Qc=(o=vi,i)=>{let e,t;switch(v={...o},i.type){case ot:return{...vi,id:i.id};case _t:return{...v,stages:i.stages};case nt:return{...v,id:i.id};case it:return{...o,order:i.order,paymentType:Nt(i.order?.paymentOptions),vehicle:{...i.order.orderVehicle,...i.vehicle||{}}};case at:let s={...v,customer:{...o.customer,email:i.value.email,phone:i.value.phone},navigation:{view:"main",stage:o.navigation.stage,subStage:2}};return delete s.wantTradeIn,delete s.tradeIn,delete s.tradeInVehicle,s.paymentType=Nt(o.order?.paymentOptions),delete s.paymentLookupResponse,delete s.insurance,delete s.insuranceAddOns,delete s.freeInsurance,delete s.dealer,s.accessories=[],s;case rt:return e=ne(v.navigation.stage,i.lastStage),t=ae(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,address:i.address,customer:{...o.customer,socialId:i.socialId}},v;case lt:return e=ne(o.navigation.stage,i.lastStage),t={...e},v={...o,navigation:e,topNavigation:t,dealer:i.dealer},delete v.wantTradeIn,delete v.tradeIn,delete v.tradeInVehicle,v.paymentType=Nt(o.order?.paymentOptions),delete v.paymentLookupResponse,delete v.insurance,delete v.insuranceAddOns,delete v.freeInsurance,v.accessories=[],v;case ct:return e=ne(o.navigation.stage,i.lastStage),t=ae(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,homeDelivery:i.homeDelivery},v;case dt:return e={view:"main",stage:o.navigation.stage,subStage:1},t=ae(v.topNavigation,e),v={...o,navigation:e,wantTradeIn:!0,topNavigation:t,tradeIn:o.tradeIn||{registrationNumber:"",mileage:"",description:""}},v;case mt:return e=ne(o.navigation.stage,i.lastStage),t=ae(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,wantTradeIn:!!i.tradeIn,tradeIn:i.tradeIn,tradeInVehicle:i.tradeInVehicle},v;case pt:return e=ne(o.navigation.stage,i.lastStage),t=ae(v.topNavigation,e),{...v,navigation:e,topNavigation:t,paymentType:i.paymentType};case ut:return{...v,paymentLookupResponse:i.paymentLookupResponse};case ht:return{...v,drivingDistance:i.drivingDistance};case kt:return e=ne(o.navigation.stage,i.lastStage),t=ae(v.topNavigation,e),v={...o,navigation:e,topNavigation:t},v;case vt:return v.insurance=i.insurance,v.insuranceAddOns={insurance:i.insurance.name,addOns:i.insuranceAddons},v;case yt:return st(v.insurance,i.insurance)?v.insurance=void 0:v.insurance=i.insurance,v.insuranceAddOns?.insurance&&(v.insuranceAddOns=void 0),v;case Et:return st(v.freeInsurance,i.freeInsurance)?v.freeInsurance=void 0:v.freeInsurance=i.freeInsurance,v;case It:return At=v.accessories.findIndex(n=>n.id===i.accessory.id),v.accessories=[...v.accessories],At>-1?v.accessories.splice(At,1):v.accessories.push(i.accessory),{...v,accessories:[...v.accessories]};case ft:return{...o,navigation:{view:i.view,stage:i.index||1,subStage:i.subStage||1}};case gt:return i.payment?e={view:"main",stage:o.navigation.stage,subStage:2}:e=ne(o.navigation.stage,!0),t=ae(v.topNavigation,e),v={...o,navigation:e,topNavigation:t,createdOrderId:i.id,payment:i.payment},v;case wt:return{...v,caseId:i.caseId,creditAssessmentResponse:i.creditAssessmentResponse};case St:return{...i.state};default:return o}},Ei=Qc;var fi=()=>(0,Ii.createStore)(Ei);var Pe=(o,i)=>{if(!i)return o;let e=new URL(o);return`${i}${e.pathname}`};var zc=o=>o.toString().replace(/\s/g,""),Jc=(o,i)=>{if(!i)return o;let e=Math.pow(10,i);return(Math.round(o*e)/e).toFixed(i)},k=(o,i)=>{if(o===void 0)return"???";let e=Jc(o,i?.decimals!==void 0?i.decimals:0);return`${i?.prefix?`${i.prefix}`:""}${zc(e).replace(/\B(?=(\d{3})+(?!\d))/g," ")}${i?.postfix?` ${i.postfix}`:""}`},Xc=(o,i)=>{let e=o.split(" "),t=i.split(" ").map(s=>s.toLowerCase());return e.filter(s=>!t.includes(s.toLowerCase())).join(" ")},me=o=>{if(!!o)return Xc(o.shortDescription||"",o.title||"")};var Zc=({vehicle:o,order:i,meta:e,cdnMedia:t})=>{let s=o?.imageUrls,n=o?.title,a=k(o?.price||NaN),l=i?.contactInformation?.name;return`
|
|
2
2
|
<div class="waykeecom-product-card">
|
|
3
3
|
${s?.length?`
|
|
4
4
|
<div class="waykeecom-product-card__media">
|
|
@@ -643,7 +643,7 @@
|
|
|
643
643
|
</div>
|
|
644
644
|
</div>
|
|
645
645
|
<div class="waykeecom-stack waykeecom-stack--4">${C()}</div>
|
|
646
|
-
`,new fe(this.node,{title:"\xD6ppna BankID",disabled:!e,onClick:()=>window.open(e,"_blank"),htmlNodesettings:{htmlTag:"div",className:"waykeecom-stack waykeecom-stack--4"}})}},wn=ks;var Sn="bankid-start-node",Rl="bankid-start",An="bankid-abort",Nn=`${An}-node`,ys="bankid-auth-method-node",vs=class extends r{constructor(e,t){super(e);this.props=t,setTimeout(()=>{Ie()?this.props.onStart(G.AuthMethod.SameDevice):this.props.onStart(G.AuthMethod.QrCode)},1),this.render(),V()}update(e,t){switch(this.props.errorMessage=void 0,this.props.method=e,e){case G.AuthMethod.QrCode:this.props.autoLaunchUrl=void 0,this.props.qrCode=t||this.props.qrCode;break;case G.AuthMethod.SameDevice:this.props.qrCode=void 0,this.props.autoLaunchUrl=t||this.props.autoLaunchUrl;break;default:break}this.render()}setErrorMessage(e){this.props.errorMessage=e,this.render()}setInfo(e){e!==this.props.info&&(this.props.info=e,this.render())}setTitle(e){e!==this.props.title&&(this.props.title=e,this.render())}setDescription(e){e!==this.props.description&&(this.props.description=e,this.render())}setFinalizing(e){e!==this.props.finalizing&&(this.props.finalizing=e,this.render())}render(){let{qrCode:e,autoLaunchUrl:t,method:s,errorMessage:n,descriptionQrCode:a,descriptionSameDevice:l,info:c,title:m,description:u,finalizing:p,onStart:h,onAbort:y}=this.props,g=m||(s===G.AuthMethod.QrCode?"\xD6ppna BankID och scanna QR-koden":"Skriv in din s\xE4kerhetskod i BankID-appen"),S=u||(s===G.AuthMethod.QrCode?a:l);if(this.node.innerHTML=`
|
|
646
|
+
`,new fe(this.node,{title:"\xD6ppna BankID",disabled:!e,onClick:()=>{window.open(e,"_blank"),this.props.onClick&&this.props.onClick()},htmlNodesettings:{htmlTag:"div",className:"waykeecom-stack waykeecom-stack--4"}})}},wn=ks;var Sn="bankid-start-node",Rl="bankid-start",An="bankid-abort",Nn=`${An}-node`,ys="bankid-auth-method-node",vs=class extends r{constructor(e,t){super(e);this.props=t,setTimeout(()=>{Ie()?this.props.onStart(G.AuthMethod.SameDevice):this.props.onStart(G.AuthMethod.QrCode)},1),this.render(),V()}update(e,t){switch(this.props.errorMessage=void 0,this.props.method=e,e){case G.AuthMethod.QrCode:this.props.autoLaunchUrl=void 0,this.props.qrCode=t||this.props.qrCode;break;case G.AuthMethod.SameDevice:this.props.qrCode=void 0,this.props.autoLaunchUrl=t||this.props.autoLaunchUrl;break;default:break}this.render()}setErrorMessage(e){this.props.errorMessage=e,this.render()}setInfo(e){e!==this.props.info&&(this.props.info=e,this.render())}setTitle(e){e!==this.props.title&&(this.props.title=e,this.render())}setDescription(e){e!==this.props.description&&(this.props.description=e,this.render())}setFinalizing(e){e!==this.props.finalizing&&(this.props.finalizing=e,this.render())}render(){let{qrCode:e,autoLaunchUrl:t,method:s,errorMessage:n,descriptionQrCode:a,descriptionSameDevice:l,info:c,title:m,description:u,finalizing:p,onStart:h,onAbort:y}=this.props,g=m||(s===G.AuthMethod.QrCode?"\xD6ppna BankID och scanna QR-koden":"Skriv in din s\xE4kerhetskod i BankID-appen"),S=u||(s===G.AuthMethod.QrCode?a:l);if(this.node.innerHTML=`
|
|
647
647
|
<div class="waykeecom-text waykeecom-text--align-center">
|
|
648
648
|
<div class="waykeecom-stack waykeecom-stack--4" id="">
|
|
649
649
|
<h4 class="waykeecom-heading waykeecom-heading--4">${g}</h4>
|
|
@@ -663,7 +663,7 @@
|
|
|
663
663
|
<div class="waykeecom-stack waykeecom-stack--2" id="${Nn}"></div>
|
|
664
664
|
</div>
|
|
665
665
|
</div>
|
|
666
|
-
`,!p){s===G.AuthMethod.SameDevice?new wn(this.node.querySelector(`#${ys}`),{autoLaunchUrl:t,errorMessage:n}):s===G.AuthMethod.QrCode&&new gn(this.node.querySelector(`#${ys}`),{qrCode:e,errorMessage:n});let R=s===G.AuthMethod.SameDevice?"Mitt BankID \xE4r p\xE5 en annan enhet":"\xD6ppna BankID p\xE5 den h\xE4r enheten";new F(this.node.querySelector(`#${Sn}`),{title:R,id:Rl,onClick:()=>h(s===G.AuthMethod.SameDevice?G.AuthMethod.QrCode:G.AuthMethod.SameDevice)})}new F(this.node.querySelector(`#${Nn}`),{title:"Avbryt",id:An,onClick:()=>y()})}},ze=vs;var Es=class extends r{constructor(e,t){super(e);this.props=t,this.render()}render(){this.node.innerHTML=`
|
|
666
|
+
`,!p){s===G.AuthMethod.SameDevice?new wn(this.node.querySelector(`#${ys}`),{autoLaunchUrl:t,errorMessage:n,onClick:()=>this.props?.onSameDeviceClick?.()}):s===G.AuthMethod.QrCode&&new gn(this.node.querySelector(`#${ys}`),{qrCode:e,errorMessage:n});let R=s===G.AuthMethod.SameDevice?"Mitt BankID \xE4r p\xE5 en annan enhet":"\xD6ppna BankID p\xE5 den h\xE4r enheten";new F(this.node.querySelector(`#${Sn}`),{title:R,id:Rl,onClick:()=>h(s===G.AuthMethod.SameDevice?G.AuthMethod.QrCode:G.AuthMethod.SameDevice)})}new F(this.node.querySelector(`#${Nn}`),{title:"Avbryt",id:An,onClick:()=>y()})}},ze=vs;var Es=class extends r{constructor(e,t){super(e);this.props=t,this.render()}render(){this.node.innerHTML=`
|
|
667
667
|
<div class="waykeecom-disclaimer">
|
|
668
668
|
<div class="waykeecom-disclaimer__text">
|
|
669
669
|
${this.props.text}
|
|
@@ -1489,7 +1489,7 @@
|
|
|
1489
1489
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1490
1490
|
<div id="payment-menu" style="padding: 24px;border: 1px solid #ececeb;"></div>
|
|
1491
1491
|
</div>
|
|
1492
|
-
`}},Xr=vo;var q=f("@wayke-se/ecom");var Eo=f("@wayke-se/ecom"),Zr=o=>{let i=Eo.bankid.newAuthRequest().withMethod(o).build();return Eo.bankid.auth(i)};var Io=f("@wayke-se/ecom"),fo=o=>{let i=Io.bankid.newCollectRequest().withOrderRef(o).build();return Io.bankid.collect(i)};var L=f("@wayke-se/ecom"),ec=o=>{let i=o.getState();if(!i.address)throw"Missing address";if(!i.paymentType)throw"Missing paymentType";if(!i.vehicle)throw"Missing vehicle";let e=L.customers.newCustomer().withAddress(i.address).withPersonalNumber(i.customer.socialId).withEmail(i.customer.email).withPhoneNumber(i.customer.phone).build(),t=L.orders.newPayment().withType(i.paymentType);if(i.paymentType===L.PaymentType.Loan){let m=i.order?.paymentOptions.find(S=>S.type===L.PaymentType.Loan),u=i.paymentLookupResponse||m?.loanDetails,p=u?.durationSpec.current,h=u?.downPaymentSpec.current,y=u?.residualValueSpec?.current,g=i.order?.paymentOptions.find(S=>S.type===L.PaymentType.Loan)?.externalId;if(t.withDuration(p).withDownPayment(Math.round(h)),y&&t.withResidualValue(y),g&&t.withExternalId(g),i.creditAssessmentResponse){let S=i.creditAssessmentResponse.scoringId,R=i.creditAssessmentResponse.recommendation,H=i.creditAssessmentResponse.decision,Y=u?.financialProductCode;if(!S||!R||!H||!Y)throw"Missing credit assessment data";let B=L.orders.newCreditAssessment().withScoreId(S).withFinancialProductCode(Y).withRecommendation(R).withDecision(H).build();t.withCreditAssessment(B)}}let s=t.build(),n=new URLSearchParams(window.location.search);n.set("wayke-ecom-web-id",i.id);let a=`${window.location.origin}${window.location.pathname}?${n.toString()}${window.location.hash}`;n.set("wayke-ecom-web-payment","true");let l=`${window.location.origin}${window.location.pathname}?${n.toString()}${window.location.hash}`,c=L.orders.newCreateRequest().forVehicle(i.id).withCustomer(e).withPayment(s).withUrls(a,l).withDeliveryType(i.homeDelivery?L.DeliveryType.Delivery:L.DeliveryType.Pickup);if(i.insurance){let m=L.orders.newInsurance().withDrivingDistance(i.drivingDistance);i.insuranceAddOns?.addOns.length&&i.insuranceAddOns.insurance===i.insurance.name&&m.withAddOns(i.insuranceAddOns.addOns.map(p=>p.name));let u=m.build();c.withInsurance(u)}else i.freeInsurance&&c.withInsurance({});if(i.accessories.length&&c.withAccessories(i.accessories),i.tradeIn&&i.tradeInVehicle&&i.tradeIn.condition){let m=L.vehicles.newVehicleTrade().forVehicle(i.tradeIn.registrationNumber).withMileage(parseInt(i.tradeIn.mileage,10)).withCondition(i.tradeIn.condition).withComment(i.tradeIn.description).build();c.withTradeIn(m)}return L.orders.create(c.build())};var tc=f("@wayke-se/ecom"),sc=o=>tc.creditAssessment.accept(o);var _o=f("@wayke-se/ecom"),oc=o=>{let i=_o.bankid.newQrCodeRequest().withOrderRef(o).build();return _o.bankid.qrcode(i)};var cc="confirm-conditions",ic=`${cc}-node`,nc="bankid-start-node",ad="bankid-start",ac="address-disclaimer-policy-node",rc="address-disclaimer-reservation-node",go=class extends r{constructor(e,t){super(e,{htmlTag:"div",className:"waykeecom-stack waykeecom-stack--2"});this.view=1;this.contexts={};this.ageError=!1;this.requestError=!1;this.socialIdNotMatchingError=!1;this.notAvailable=!1;this.confirmConditions=!1;this.bankidRequestRef=void 0;this.bankidStatus=async e=>{try{let t=await fo(e);this.handleBankidStatusResponse(t,q.AuthMethod.QrCode)}catch{this.clearIntervals(),this.contexts.bankId?.setErrorMessage("Det gick inte att h\xE4mta status kring nuvanrade BankId signering.")}};this.qrCode=async e=>{try{let s=(await oc(e)).getQrCode();this.contexts.bankId?.update(q.AuthMethod.QrCode,s)}catch{this.clearIntervals(),this.contexts.bankId?.setErrorMessage("Det gick inte att h\xE4mta ny QR-kod f\xF6r BankId signering.")}};this.props=t,this.ageError=!1,this.render()}addWindowEvents(){this.removeWindowEvents(),window.addEventListener("focus",()=>this.onFocus())}removeWindowEvents(){window.removeEventListener("focus",()=>this.onFocus())}clearIntervals(){clearInterval(this.bankidQrCodeInterval),clearInterval(this.bankidStatusInterval)}async onFocus(){
|
|
1492
|
+
`}},Xr=vo;var q=f("@wayke-se/ecom");var Eo=f("@wayke-se/ecom"),Zr=o=>{let i=Eo.bankid.newAuthRequest().withMethod(o).build();return Eo.bankid.auth(i)};var Io=f("@wayke-se/ecom"),fo=o=>{let i=Io.bankid.newCollectRequest().withOrderRef(o).build();return Io.bankid.collect(i)};var L=f("@wayke-se/ecom"),ec=o=>{let i=o.getState();if(!i.address)throw"Missing address";if(!i.paymentType)throw"Missing paymentType";if(!i.vehicle)throw"Missing vehicle";let e=L.customers.newCustomer().withAddress(i.address).withPersonalNumber(i.customer.socialId).withEmail(i.customer.email).withPhoneNumber(i.customer.phone).build(),t=L.orders.newPayment().withType(i.paymentType);if(i.paymentType===L.PaymentType.Loan){let m=i.order?.paymentOptions.find(S=>S.type===L.PaymentType.Loan),u=i.paymentLookupResponse||m?.loanDetails,p=u?.durationSpec.current,h=u?.downPaymentSpec.current,y=u?.residualValueSpec?.current,g=i.order?.paymentOptions.find(S=>S.type===L.PaymentType.Loan)?.externalId;if(t.withDuration(p).withDownPayment(Math.round(h)),y&&t.withResidualValue(y),g&&t.withExternalId(g),i.creditAssessmentResponse){let S=i.creditAssessmentResponse.scoringId,R=i.creditAssessmentResponse.recommendation,H=i.creditAssessmentResponse.decision,Y=u?.financialProductCode;if(!S||!R||!H||!Y)throw"Missing credit assessment data";let B=L.orders.newCreditAssessment().withScoreId(S).withFinancialProductCode(Y).withRecommendation(R).withDecision(H).build();t.withCreditAssessment(B)}}let s=t.build(),n=new URLSearchParams(window.location.search);n.set("wayke-ecom-web-id",i.id);let a=`${window.location.origin}${window.location.pathname}?${n.toString()}${window.location.hash}`;n.set("wayke-ecom-web-payment","true");let l=`${window.location.origin}${window.location.pathname}?${n.toString()}${window.location.hash}`,c=L.orders.newCreateRequest().forVehicle(i.id).withCustomer(e).withPayment(s).withUrls(a,l).withDeliveryType(i.homeDelivery?L.DeliveryType.Delivery:L.DeliveryType.Pickup);if(i.insurance){let m=L.orders.newInsurance().withDrivingDistance(i.drivingDistance);i.insuranceAddOns?.addOns.length&&i.insuranceAddOns.insurance===i.insurance.name&&m.withAddOns(i.insuranceAddOns.addOns.map(p=>p.name));let u=m.build();c.withInsurance(u)}else i.freeInsurance&&c.withInsurance({});if(i.accessories.length&&c.withAccessories(i.accessories),i.tradeIn&&i.tradeInVehicle&&i.tradeIn.condition){let m=L.vehicles.newVehicleTrade().forVehicle(i.tradeIn.registrationNumber).withMileage(parseInt(i.tradeIn.mileage,10)).withCondition(i.tradeIn.condition).withComment(i.tradeIn.description).build();c.withTradeIn(m)}return L.orders.create(c.build())};var tc=f("@wayke-se/ecom"),sc=o=>tc.creditAssessment.accept(o);var _o=f("@wayke-se/ecom"),oc=o=>{let i=_o.bankid.newQrCodeRequest().withOrderRef(o).build();return _o.bankid.qrcode(i)};var cc="confirm-conditions",ic=`${cc}-node`,nc="bankid-start-node",ad="bankid-start",ac="address-disclaimer-policy-node",rc="address-disclaimer-reservation-node",go=class extends r{constructor(e,t){super(e,{htmlTag:"div",className:"waykeecom-stack waykeecom-stack--2"});this.view=1;this.contexts={};this.ageError=!1;this.requestError=!1;this.socialIdNotMatchingError=!1;this.notAvailable=!1;this.confirmConditions=!1;this.bankidRequestRef=void 0;this.bankidStatus=async e=>{try{let t=await fo(e);this.handleBankidStatusResponse(t,q.AuthMethod.QrCode)}catch{this.clearIntervals(),this.contexts.bankId?.setErrorMessage("Det gick inte att h\xE4mta status kring nuvanrade BankId signering.")}};this.qrCode=async e=>{try{let s=(await oc(e)).getQrCode();this.contexts.bankId?.update(q.AuthMethod.QrCode,s)}catch{this.clearIntervals(),this.contexts.bankId?.setErrorMessage("Det gick inte att h\xE4mta ny QR-kod f\xF6r BankId signering.")}};this.props=t,this.ageError=!1,this.render()}addWindowEvents(){this.removeWindowEvents(),window.addEventListener("focus",()=>this.onFocus())}removeWindowEvents(){window.removeEventListener("focus",()=>this.onFocus())}clearIntervals(){clearInterval(this.bankidQrCodeInterval),clearInterval(this.bankidStatusInterval)}async onFocus(){clearTimeout(this.focusTimeout),this.focusTimeout=setTimeout(async()=>{if(this.bankidRequestRef?.method===q.AuthMethod.SameDevice)try{let e=await fo(this.bankidRequestRef.reference);this.handleBankidStatusResponse(e,this.bankidRequestRef.method)}catch{this.clearIntervals(),this.contexts.bankId?.setErrorMessage("Det gick inte att h\xE4mta status kring nuvanrade BankId signering.")}},500)}onSameDeviceClick(){this.addWindowEvents()}setBankidRequestRef(e,t){this.bankidRequestRef={reference:e,method:t}}clearBankidRequestRef(){this.bankidRequestRef=void 0}async acceptCreditAssessment(){let{caseId:e}=this.props.store.getState();if(e)try{d("MAIN","CONFIRMATION_ACCEPT_CREDIT_ASSESSMENT_REQUEST","CONFIRMATION"),await sc(e),d("MAIN","CONFIRMATION_ACCEPT_CREDIT_ASSESSMENT_SUCCEEDED","CONFIRMATION")}catch{d("MAIN","CONFIRMATION_ACCEPT_CREDIT_ASSESSMENT_FAILED","CONFIRMATION")}}async onCreateOrder(){let{store:e}=this.props;this.notAvailable=!1,this.requestError=!1;try{d("MAIN","CONFIRMATION_CREATE_ORDER_REQUESTED","CONFIRMATION");let{order:t}=e.getState(),s=await ec(e);d("MAIN","CONFIRMATION_CREATE_ORDER_SUCCEEDED","CONFIRMATION"),t?.isPaymentRequired&&O();let a=s.getPayment();hi(s.getOrderNumber(),a)(e.dispatch),this.acceptCreditAssessment()}catch(t){let s=t;this.view=1,d("MAIN","CONFIRMATION_CREATE_ORDER_FAILED","CONFIRMATION"),s.message==="The vehicle is not available for purchase"?(this.requestError=!1,this.notAvailable=!0):(this.notAvailable=!1,this.requestError=!0),O(),this.render()}}async handleBankidStatusResponse(e,t){if(e.isCompleted()){this.removeWindowEvents(),this.clearBankidRequestRef(),this.clearIntervals();let s=e.getAddress(),n=e.getPersonalNumber();if(s&&n){let a=this.props.store.getState();if(D.requiredSsnOver18(n)){if(a.customer.socialId!==n){d("MAIN",t===q.AuthMethod.SameDevice?"CONFIRMATION_BANKID_STATUS_SAME_DEVICE_SUCCEEDED_SSN_MISSMATCH":"CONFIRMATION_BANKID_STATUS_QR_SUCCEEDED_SSN_MISSMATCH","CONFIRMATION"),this.view=1,this.socialIdNotMatchingError=!0,O(),this.render();return}}else{d("MAIN",t===q.AuthMethod.SameDevice?"CONFIRMATION_BANKID_STATUS_SAME_DEVICE_SUCCEEDED_NOT_OVER_18":"CONFIRMATION_BANKID_STATUS_QR_SUCCEEDED_NOT_OVER_18","CONFIRMATION"),this.view=1,this.ageError=!0,O(),this.render();return}d("MAIN",t===q.AuthMethod.SameDevice?"CONFIRMATION_BANKID_STATUS_SAME_DEVICE_SUCCEEDED":"CONFIRMATION_BANKID_STATUS_QR_SUCCEEDED","CONFIRMATION"),this.contexts.bankId?.setDescription("Verifiering klar, ordern skapas nu..."),await this.onCreateOrder()}}}async startBankidSameDevice(e,t,s=!1){s||d("MAIN","CONFIRMATION_BANKID_STATUS_SAME_DEVICE_REQUESTED","CONFIRMATION");try{this.setBankidRequestRef(t,q.AuthMethod.SameDevice);let n=e.getAutoLaunchUrl();this.contexts.bankId?.update(q.AuthMethod.SameDevice,n)}catch(n){this.removeWindowEvents(),this.clearBankidRequestRef();let a=n;this.contexts.bankId?.setErrorMessage(`Error: ${a.message}`)}}async startBankidWithQr(e,t=!1){t||d("MAIN","CONFIRMATION_BANKID_STATUS_QR_REQUESTED","CONFIRMATION"),this.bankidStatusInterval=setInterval(()=>{this.bankidStatus(e)},2e3),Le("bankidStatusInterval",this.bankidStatusInterval),this.qrCode(e),this.bankidQrCodeInterval=setInterval(async()=>{this.qrCode(e)},1e3),Le("bankidQrCodeInterval",this.bankidQrCodeInterval)}async onStartBankIdAuth(e,t=!1){this.clearIntervals();try{t||d("MAIN","CONFIRMATION_BANKID_INIT_REQUESTED","CONFIRMATION"),this.contexts.bankId?.update(e),this.contexts.buttonLinkToggle?.disabled(!0);let s=await Zr(e);t||d("MAIN","CONFIRMATION_BANKID_INIT_SUCCEEDED","CONFIRMATION");let n=s.getOrderRef();e===q.AuthMethod.QrCode?this.startBankidWithQr(n,t):this.startBankidSameDevice(s,n,t)}catch{d("MAIN","CONFIRMATION_BANKID_INIT_FAILED","CONFIRMATION"),this.contexts.bankId?.setErrorMessage("Det gick tyv\xE4rr inte att initiera BankId. V\xE4nligen f\xF6rs\xF6k igen.")}finally{this.contexts.buttonLinkToggle?.disabled(!1)}}onAbort(){this.clearBankidRequestRef(),this.removeWindowEvents(),this.clearIntervals(),d("MAIN","CONFIRMATION_BANKID_ABORTED","CONFIRMATION"),this.view=1,O(),this.render()}onCheckbox(e){let t=e.currentTarget;this.confirmConditions=t.checked,this.contexts.confirmConditions?.checked(this.confirmConditions),this.contexts.startBankid?.disabled(!this.confirmConditions)}render(){let e=Ie(),{navigation:t,order:s,insurance:n}=this.props.store.getState();if(this.view===2)this.contexts.bankId=new ze(j(),{method:e?q.AuthMethod.SameDevice:q.AuthMethod.QrCode,descriptionQrCode:"F\xF6r att verifiera din identitet, starta din BankID applikation p\xE5 din andra enhet.",descriptionSameDevice:"F\xF6r att verifiera din identitet, starta din BankID-applikation.",onAbort:()=>this.onAbort(),onStart:a=>this.onStartBankIdAuth(a),onSameDeviceClick:()=>this.onSameDeviceClick()});else{let a=s?.contactInformation?.name,l=s?.conditionsPdfUri,c="https://www.wayke.se/trygghet-naer-det-kommer-till-dina-personuppgifter";this.node.innerHTML=`
|
|
1493
1493
|
<div class="waykeecom-stack waykeecom-stack--3">
|
|
1494
1494
|
<h4 class="waykeecom-heading waykeecom-heading--4">Strax klart!</h4>
|
|
1495
1495
|
<div class="waykeecom-content">
|