favesalon-embed 1.0.28 → 1.1.1

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.
Files changed (35) hide show
  1. package/dist/custom-elements/index.d.ts +6 -0
  2. package/dist/favesalon-embed/activate-form.entry.js +1 -1
  3. package/dist/favesalon-embed/buy-giftcard-form.entry.js +123 -262
  4. package/dist/favesalon-embed/buy-giftcard-verification.entry.js +13 -6
  5. package/dist/favesalon-embed/change-password-form.entry.js +1 -1
  6. package/dist/favesalon-embed/chat-box.entry.js +1 -1
  7. package/dist/favesalon-embed/chat-button.entry.js +1 -1
  8. package/dist/favesalon-embed/chat-form.entry.js +1 -1
  9. package/dist/favesalon-embed/chat-messages.entry.js +1 -1
  10. package/dist/favesalon-embed/chat-rooms.entry.js +1 -1
  11. package/dist/favesalon-embed/favesalon-embed.esm.js +1 -1
  12. package/dist/favesalon-embed/login-form.entry.js +1 -1
  13. package/dist/favesalon-embed/magensa-payment.entry.js +136 -0
  14. package/dist/favesalon-embed/register-form.entry.js +1 -1
  15. package/dist/favesalon-embed/reset-password-form.entry.js +1 -1
  16. package/dist/favesalon-embed/salon-info.entry.js +1 -1
  17. package/dist/favesalon-embed/salon-latest-reviews.entry.js +1 -1
  18. package/dist/favesalon-embed/salon-latest-styles.entry.js +1 -1
  19. package/dist/favesalon-embed/salon-locations.entry.js +1 -1
  20. package/dist/favesalon-embed/salon-lookbook.entry.js +1 -1
  21. package/dist/favesalon-embed/salon-reviews.entry.js +1 -1
  22. package/dist/favesalon-embed/salon-schedules.entry.js +1 -1
  23. package/dist/favesalon-embed/salon-services.entry.js +1 -1
  24. package/dist/favesalon-embed/salon-stylists.entry.js +1 -1
  25. package/dist/favesalon-embed/{services-392da128.js → services-48c99e41.js} +20 -5
  26. package/dist/favesalon-embed/style-detail.entry.js +1 -1
  27. package/dist/favesalon-embed/wizard-existing-user.entry.js +5 -2
  28. package/dist/favesalon-embed/wizard-new-user.entry.js +5 -2
  29. package/dist/types/components/buy-giftcard-form/buy-giftcard-form.d.ts +2 -5
  30. package/dist/types/components/buy-giftcard-verification/buy-giftcard-verification.d.ts +2 -2
  31. package/dist/types/components/magensa-payment/magensa-payment.d.ts +19 -0
  32. package/dist/types/components.d.ts +25 -0
  33. package/dist/types/services/services.d.ts +3 -0
  34. package/dist/types/types/giftcard.d.ts +2 -1
  35. package/package.json +1 -1
@@ -110,6 +110,12 @@ export const LoginForm: {
110
110
  new (): LoginForm;
111
111
  };
112
112
 
113
+ interface MagensaPayment extends Components.MagensaPayment, HTMLElement {}
114
+ export const MagensaPayment: {
115
+ prototype: MagensaPayment;
116
+ new (): MagensaPayment;
117
+ };
118
+
113
119
  interface NotifySounds extends Components.NotifySounds, HTMLElement {}
114
120
  export const NotifySounds: {
115
121
  prototype: NotifySounds;
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, h } from './index-888e99e3.js';
2
- import { H as HttpService, g as get_1 } from './services-392da128.js';
2
+ import { H as HttpService, g as get_1 } from './services-48c99e41.js';
3
3
  import { C as Colors } from './colors-ea36347a.js';
4
4
  import './_commonjsHelpers-9bc404fc.js';
5
5
 
@@ -1,14 +1,8 @@
1
1
  import { r as registerInstance, h } from './index-888e99e3.js';
2
2
  import { I as Inputmask } from './inputmask-afacb9e0.js';
3
- import { _ as _root, i as isSymbol_1, a as isObject_1, d as dayjs_min, b as dateFormat, c as dateTimeFormatAmPm, H as HttpService, g as get_1, s as shortDateFormat, e as getSalonImage, f as getSalonAddress } from './services-392da128.js';
4
- import { c as createCommonjsModule, g as getDefaultExportFromCjs } from './_commonjsHelpers-9bc404fc.js';
3
+ import { _ as _root, i as isSymbol_1, a as isObject_1, d as dayjs_min, b as dateFormat, H as HttpService, g as get_1, c as dateTimeFormatAmPm, s as shortDateFormat, e as getSalonImage, f as getSalonAddress } from './services-48c99e41.js';
5
4
  import { C as Colors } from './colors-ea36347a.js';
6
-
7
- var teConnect = createCommonjsModule(function (module, exports) {
8
- !function(e,t){"object"=='object'&&"object"=='object'?module.exports=t():"function"==typeof undefined&&undefined.amd?undefined([],t):"object"=='object'?exports["te-connect"]=t():e["te-connect"]=t();}(self,(()=>(()=>{var t={506:e=>{e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e};},926:e=>{function t(e,t,n,r,o,a,i){try{var s=e[a](i),c=s.value;}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(r,o);}e.exports=function(e){return function(){var n=this,r=arguments;return new Promise((function(o,a){var i=e.apply(n,r);function s(e){t(i,o,a,s,c,"next",e);}function c(e){t(i,o,a,s,c,"throw",e);}s(void 0);}))}};},575:e=>{e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")};},226:e=>{e.exports=function(e,t){var n=t.get(e);if(!n)throw new TypeError("attempted to get private field on non-instance");return n.get?n.get.call(e):n.value};},962:e=>{e.exports=function(e,t,n){var r=t.get(e);if(!r)throw new TypeError("attempted to set private field on non-instance");if(r.set)r.set.call(e,n);else {if(!r.writable)throw new TypeError("attempted to set read only private field");r.value=n;}return n};},913:e=>{function t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r);}}e.exports=function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e};},713:e=>{e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e};},754:e=>{function t(n){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},t(n)}e.exports=t;},205:(e,t,n)=>{var r=n(489);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t);};},479:(e,t,n)=>{var r=n(316);e.exports=function(e,t){if(null==e)return {};var n,o,a=r(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n]);}return a};},316:e=>{e.exports=function(e,t){if(null==e)return {};var n,r,o={},a=Object.keys(e);for(r=0;r<a.length;r++)n=a[r],t.indexOf(n)>=0||(o[n]=e[n]);return o};},585:(e,t,n)=>{var r=n(8),o=n(506);e.exports=function(e,t){return !t||"object"!==r(t)&&"function"!=typeof t?o(e):t};},489:e=>{function t(n,r){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(n,r)}e.exports=t;},8:e=>{function t(n){return "function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=t=function(e){return typeof e}:e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(n)}e.exports=t;},553:e=>{var t=function(e){"use strict";var t,n=Object.prototype,r=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",i=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"");}catch(e){c=function(e,t,n){return e[t]=n};}function u(e,t,n,r){var o=t&&t.prototype instanceof m?t:m,a=Object.create(o.prototype),i=new j(r||[]);return a._invoke=function(e,t,n){var r=p;return function(o,a){if(r===y)throw new Error("Generator is already running");if(r===d){if("throw"===o)throw a;return S()}for(n.method=o,n.arg=a;;){var i=n.delegate;if(i){var s=M(i,n);if(s){if(s===h)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===p)throw r=d,n.arg;n.dispatchException(n.arg);}else "return"===n.method&&n.abrupt("return",n.arg);r=y;var c=l(e,t,n);if("normal"===c.type){if(r=n.done?d:f,c.arg===h)continue;return {value:c.arg,done:n.done}}"throw"===c.type&&(r=d,n.method="throw",n.arg=c.arg);}}}(e,n,i),a}function l(e,t,n){try{return {type:"normal",arg:e.call(t,n)}}catch(e){return {type:"throw",arg:e}}}e.wrap=u;var p="suspendedStart",f="suspendedYield",y="executing",d="completed",h={};function m(){}function v(){}function g(){}var w={};w[a]=function(){return this};var b=Object.getPrototypeOf,P=b&&b(b(R([])));P&&P!==n&&r.call(P,a)&&(w=P);var E=g.prototype=m.prototype=Object.create(w);function k(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}));}));}function C(e,t){function n(o,a,i,s){var c=l(e[o],e,a);if("throw"!==c.type){var u=c.arg,p=u.value;return p&&"object"==typeof p&&r.call(p,"__await")?t.resolve(p.__await).then((function(e){n("next",e,i,s);}),(function(e){n("throw",e,i,s);})):t.resolve(p).then((function(e){u.value=e,i(u);}),(function(e){return n("throw",e,i,s)}))}s(c.arg);}var o;this._invoke=function(e,r){function a(){return new t((function(t,o){n(e,r,t,o);}))}return o=o?o.then(a,a):a()};}function M(e,n){var r=e.iterator[n.method];if(r===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,M(e,n),"throw"===n.method))return h;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method");}return h}var o=l(r,e.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,h;var a=o.arg;return a?a.done?(n[e.resultName]=a.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,h):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,h)}function L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t);}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t;}function j(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0);}function R(e){if(e){var n=e[a];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function n(){for(;++o<e.length;)if(r.call(e,o))return n.value=e[o],n.done=!1,n;return n.value=t,n.done=!0,n};return i.next=i}}return {next:S}}function S(){return {value:t,done:!0}}return v.prototype=E.constructor=g,g.constructor=v,v.displayName=c(g,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return !!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,g):(e.__proto__=g,c(e,s,"GeneratorFunction")),e.prototype=Object.create(E),e},e.awrap=function(e){return {__await:e}},k(C.prototype),C.prototype[i]=function(){return this},e.AsyncIterator=C,e.async=function(t,n,r,o,a){void 0===a&&(a=Promise);var i=new C(u(t,n,r,o),a);return e.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(E),c(E,s,"Generator"),E[a]=function(){return this},E.toString=function(){return "[object Generator]"},e.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},e.values=R,j.prototype={constructor:j,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(O),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t);},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function o(r,o){return s.type="throw",s.arg=e,n.next=r,o&&(n.method="next",n.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else {if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,h):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return "break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var o=r.arg;O(n);}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:R(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),h}},e}(e.exports);try{regeneratorRuntime=t;}catch(e){Function("r","regeneratorRuntime = r")(t);}},757:(e,t,n)=>{e.exports=n(553);}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var a=n[e]={exports:{}};return t[e](a,a.exports,r),a.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]});},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0});};var o={};return (()=>{"use strict";r.r(o),r.d(o,{createTEConnect:()=>$e});var t=r(479),n=r.n(t),a=r(926),i=r.n(a),s=r(757),c=r.n(s),u="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),l=new Uint8Array(16);function p(){if(!u)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return u(l)}const f=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,y=function(e){return "string"==typeof e&&f.test(e)};for(var d=[],h=0;h<256;++h)d.push((h+256).toString(16).substr(1));const m=function(e,t,n){var r=(e=e||{}).random||(e.rng||p)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var o=0;o<16;++o)t[n+o]=r[o];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(d[e[t+0]]+d[e[t+1]]+d[e[t+2]]+d[e[t+3]]+"-"+d[e[t+4]]+d[e[t+5]]+"-"+d[e[t+6]]+d[e[t+7]]+"-"+d[e[t+8]]+d[e[t+9]]+"-"+d[e[t+10]]+d[e[t+11]]+d[e[t+12]]+d[e[t+13]]+d[e[t+14]]+d[e[t+15]]).toLowerCase();if(!y(n))throw TypeError("Stringified UUID is invalid");return n}(r)};var v="https://svc4.magensa.net",g="".concat(v,"/TEConnect"),w="_tec-payment-evt-ele",b="hideZip",P="tecPaymentRequest",E={passive:!0},k=["total","currencyCode","countryCode","merchantCapabilities","supportedNetworks","storeDisplayName"],C=["allowedCardNetworks","transactionInfo","merchantName","gatewayId"],M=["apiVersion","apiVersionMinor","callbackIntents","offerInfo","emailRequired","shippingAddressRequired","shippingAddressParameters","shippingOptionRequired","shippingOptionParameters"],L=[].concat(M,["allowedPaymentMethods","existingPaymentMethodRequired","environment","paymentDataCallbacks","prefetchGooglePaymentData"]),O=["appleMerchantId","googleMerchantId"],j=["buttonColor","buttonType","buttonLocale","buttonSizeMode","buttonRootNode"],R="tec-payment-request-complete",S="tec-payment-method-selected",x="tec-payment-request-cancel",I="tec-payment-shipping-contact",T="tec-payment-shipping-method",_={baseRequest:{apiVersion:2,apiVersionMinor:0},allowedCardAuthMethods:["PAN_ONLY","CRYPTOGRAM_3DS"],baseCardPaymentMethod:{type:"CARD",parameters:{allowedAuthMethods:null,allowedCardNetworks:null}},tokenizationSpecification:{type:"PAYMENT_GATEWAY",parameters:null},merchantInfo:null,transactionInfo:null,environment:"TEST"},q=r(713),A=r.n(q),N=r(8),D=r.n(N),U="'te-connect' is designed for use within web applications.",F="DOM element provided is not the expected node.",G="Unable to recognize provided node",W="Node info object provided is not in recognized format.",z="Response from server has been altered. Refused response, please try again",V="Timeout: Response not received from TEConnect",B="'instanceDetails' object supplied to 'createPaymentToken' function is missing a required property:",Y="to the 'listenFor' function",K="Please supply a Payment Request object",J="Failed to locate TecPR event element. Please make sure TEConnect Payment Request button is mounted, and TEConnect elements are unaltered on the DOM.";function Z(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r);}return n}function $(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Z(Object(n),!0).forEach((function(t){A()(e,t,n[t]);})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Z(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t));}));}return e}function H(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return Q(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return "Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Q(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return {s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,i=!0,s=!1;return {s:function(){n=n.call(e);},n:function(){var e=n.next();return i=e.done,e},e:function(e){s=!0,a=e;},f:function(){try{i||null==n.return||n.return();}finally{if(s)throw a}}}}function Q(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var X=function(e){return "string"==typeof e&&""!==e},ee=function(e,t){return e?"string"!=typeof e.nodeName?new Error(G):"IFRAME"!==e.nodeName?new Error(F):!0!==t?te(e,"__teConnectSecureFrame","__te-connect-secure-window"):te(e,"__tecPrFrameName","__tec-pr-window"):new Error(G)},te=function(e,t,n){var r=e.name,o=e.id;return "string"==typeof r&&"string"==typeof o&&r===t&&o===n||new Error(F)},ne=function(e){return e?y(e)?void 0:new Error("formId is not valid"):new Error("formId not found")},re=function(e){if(!e)return {error:"Node info object not provided in 'createPayment' call."};if("object"!==D()(e))return {error:W};if(void 0===e.elements||void 0===e.formId)return {error:W};var t=ee(e.elements);if(t instanceof Error)return {error:t.message};var n=ne(e.formId);return n instanceof Error?{error:n.message}:e},oe=function(e){if("object"!==D()(e)||null===e)return {error:"'createPaymentToken' function requires an 'instanceDetails' object as a parameter"};var t=e.instanceId,n=e.formId,r=e.controllerRef;if(!X(t))return {error:"".concat(B," 'instanceId'")};if(!X(n))return {error:"".concat(B," 'formId'")};var o=ne(n);if(o instanceof Error)return {error:o.message};var a=ee(r,!0);return a instanceof Error?{error:a.message}:e},ae=function(e,t){if("object"!==D()(e))throw new Error(K);var n,r=H(t);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(void 0===e[o])throw new Error("'".concat(o,"' is a required property for a Payment Request object, but was found to be 'undefined'"))}}catch(e){r.e(e);}finally{r.f();}},ie=function(e,t){var n=_;n.merchantInfo={merchantName:e.merchantName,merchantId:t},n.baseCardPaymentMethod.parameters={allowedAuthMethods:e.allowedAuthMethods||n.allowedCardAuthMethods,allowedCardNetworks:e.allowedCardNetworks},n.transactionInfo=e.transactionInfo,n.tokenizationSpecification.parameters={gateway:"magensa",gatewayMerchantId:e.gatewayId};var r,o=H(L);try{for(o.s();!(r=o.n()).done;){var a=r.value;void 0!==e[a]&&(n[a]=e[a]);}}catch(e){o.e(e);}finally{o.f();}return n},se=function(e){var t=e.baseCardPaymentMethod,n=e.tokenizationSpecification,r=e.allowedPaymentMethods,o=[$($({},t),{},{tokenizationSpecification:n})];if(r&&r.length>0){var a,i=H(r);try{for(i.s();!(a=i.n()).done;){var s=a.value;o.push($($({},s),{},{tokenizationSpecification:n}));}}catch(e){i.e(e);}finally{i.f();}}return o},ce=function(e){var t,n=e.baseRequest,r=e.merchantInfo,o=e.transactionInfo,a=$($({},n),{},{allowedPaymentMethods:se(e),transactionInfo:o,merchantInfo:r}),i=H(M);try{for(i.s();!(t=i.n()).done;){var s=t.value;void 0!==e[s]&&(a[s]=e[s]);}}catch(e){i.e(e);}finally{i.f();}return a},ue=function(e,t){if("object"!==D()(e))throw new Error(K);var n={},r=t.appleMerchantId,o=t.googleMerchantId;return r&&(e.applePay?(ae(e.applePay,k),n.applePay=e.applePay):(ae(e,k),n.applePay=e)),o&&(e.googlePay?(ae(e.googlePay,C),n.googlePay=ie(e.googlePay,o)):(ae(e,C),n.googlePay=ie(e,o))),n},le=function(e){if(e){var t=e.closest("div");if(t)return t;var n=document.getElementsByClassName(w);if(n&&n.length>0)return n[0]}throw new Error(J)},pe=function(e){return function(t,n){var r=new CustomEvent(t,{detail:n});e.dispatchEvent(r);}},fe=function(e){if(e&&"object"===D()(e)){var t=e.errorType;if("string"==typeof t)switch(t){case"failure":return {error:"unknown",message:e.message};case"addressInvalid":return {error:"addressUnserviceable",message:e.message};default:return}}return {error:"unknown",message:""}},ye=function(e){var t,n=[],r=H(e);try{for(r.s();!(t=r.n()).done;){var o=t.value;if(o instanceof window.ApplePayError)n.push(o);else {var a=fe(o);void 0!==a&&n.push(new window.ApplePayError(a.error,"countryCode",a.message));}}}catch(o){r.e(o);}finally{r.f();}return n},de=function(e){if(e){if("string"==typeof e)return {status:"success"===e.toLowerCase()?ApplePaySession.STATUS_SUCCESS:ApplePaySession.STATUS_FAILURE};if(e&&"number"==typeof e.status){if(e.errors&&e.errors.length>0){var t=ye(e.errors);e.errors=t;}return e}}return console.error("[Token Exchange Connect Error]: Unrecognized completion result. Completing payment with failure."),{status:ApplePaySession.STATUS_FAILURE}},he=r(913),me=r.n(he),ve=r(575),ge=r.n(ve),we=r(506),be=r.n(we),Pe=r(205),Ee=r.n(Pe),ke=r(585),Ce=r.n(ke),Me=r(754),Le=r.n(Me),Oe=r(962),je=r.n(Oe),Re=r(226),Se=r.n(Re);function xe(e,t,n){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,n);}var Ie=new WeakMap,Te=new WeakMap,_e=new WeakMap,qe=new WeakMap,Ae=new WeakMap,Ne=new WeakMap,De=new WeakMap,Ue=new WeakMap,Fe=new WeakMap,Ge=new WeakMap,We=function(){function e(t,n){var r=this;ge()(this,e),xe(this,Ie,{writable:!0,value:void 0}),xe(this,Te,{writable:!0,value:void 0}),xe(this,_e,{writable:!0,value:void 0}),xe(this,qe,{writable:!0,value:void 0}),xe(this,Ae,{writable:!0,value:void 0}),xe(this,Ne,{writable:!0,value:void 0}),xe(this,De,{writable:!0,value:void 0}),xe(this,Ue,{writable:!0,value:void 0}),xe(this,Fe,{writable:!0,value:void 0}),xe(this,Ge,{writable:!0,value:void 0}),A()(this,"getGooglePayCanMakePayments",(function(e){!function(e){var t=document.getElementById("_google-pay-api");if(t)t.removeEventListener("load",e,E),t.addEventListener("load",e,E);else {var n=document.createElement("script");n.src="https://pay.google.com/gp/p/js/pay.js",n.async=!0,n.id="_google-pay-api",n.addEventListener("load",e,E),document.body.appendChild(n);}}((function(){if(!window.google)throw new Error("Google Pay API was loaded, but `window.google` is unavailable");var t,n,o;r.googlePayClient||(r.googlePayClient=new google.payments.api.PaymentsClient((o={environment:(t=e).environment,merchantInfo:t.merchantInfo},(n=t.paymentDataCallbacks)&&(o.paymentDataCallbacks=n),o))),r.googlePayClient.isReadyToPay(function(e){var t=e.baseRequest,n=e.baseCardPaymentMethod,r=e.allowedPaymentMethods,o=e.existingPaymentMethodRequired,a=[n];if(r&&r.length>0){var i,s=H(r);try{for(s.s();!(i=s.n()).done;){var c=i.value;a.push(c);}}catch(e){s.e(e);}finally{s.f();}}var u=$($({},t),{},{allowedPaymentMethods:a});return !0===o&&(u.existingPaymentMethodRequired=o),u}(e)).then((function(e){r.googleCanMakePaymentsResult=void 0!==e.paymentMethodPresent?e:e.result;})).catch((function(e){console.error(e),r.googleCanMakePaymentsResult=!1;}));}));})),A()(this,"applePayCanMakePayments",(function(e){window.ApplePaySession&&window.ApplePaySession.canMakePayments()?ApplePaySession.canMakePaymentsWithActiveCard(e).then((function(e){r.appleCanMakePaymentsResult=e;})).catch((function(e){console.error(e),r.appleCanMakePaymentsResult=!1;})):r.appleCanMakePaymentsResult=!1;})),je()(this,Ie,t),je()(this,Te,n);var o=n.appleMerchantId;n.googleMerchantId&&this.getGooglePayCanMakePayments(t.googlePay),o&&this.applePayCanMakePayments(o);}return me()(e,[{key:"paymentRequestObj",get:function(){return Se()(this,Ie)},set:function(e){je()(this,Ie,e);}},{key:"paymentRequestIds",get:function(){return Se()(this,Te)},set:function(e){je()(this,Te,e);}},{key:"googlePayClient",get:function(){return Se()(this,_e)},set:function(e){je()(this,_e,e);}},{key:"customerPaymentListener",get:function(){return Se()(this,qe)},set:function(e){je()(this,qe,e);}},{key:"customerCancelListener",get:function(){return Se()(this,Ae)},set:function(e){je()(this,Ae,e);}},{key:"paymentMethodListener",get:function(){return Se()(this,Ne)},set:function(e){je()(this,Ne,e);}},{key:"shippingContactListener",get:function(){return Se()(this,De)},set:function(e){je()(this,De,e);}},{key:"shippingMethodListener",get:function(){return Se()(this,Ue)},set:function(e){je()(this,Ue,e);}},{key:"googleCanMakePaymentsResult",get:function(){return Se()(this,Fe)},set:function(e){je()(this,Fe,e);}},{key:"appleCanMakePaymentsResult",get:function(){return Se()(this,Ge)},set:function(e){je()(this,Ge,e);}}]),e}(),ze=["tokenizationData"];function Ve(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r);}return n}function Be(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ve(Object(n),!0).forEach((function(t){A()(e,t,n[t]);})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ve(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t));}));}return e}var Ye=function(t){Ee()(s,t);var r,o,a=(r=s,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return !1;if(Reflect.construct.sham)return !1;if("function"==typeof Proxy)return !0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return !1}}(),function(){var e,t=Le()(r);if(o){var n=Le()(this).constructor;e=Reflect.construct(t,arguments,n);}else e=t.apply(this,arguments);return Ce()(this,e)});function s(t,r){var o;return ge()(this,s),o=a.call(this,t,r),A()(be()(o),"updatePaymentRequest",(function(e){var t=ue(e,o.paymentRequestIds);o.paymentRequestObj=t;})),A()(be()(o),"appleCanMakePayments",(function(){return new Promise((function(e){if("boolean"==typeof o.appleCanMakePaymentsResult)return e({applePay:o.appleCanMakePaymentsResult});var t=setTimeout((function(){void 0===o.appleCanMakePaymentsResult&&(o.appleCanMakePaymentsResult=!1);}),2e4);return e(function e(n){return new Promise((function(n){if("boolean"==typeof o.appleCanMakePaymentsResult)return clearTimeout(t),n({applePay:o.appleCanMakePaymentsResult});setTimeout((function(){return n(e())}),200);}))}())}))})),A()(be()(o),"googleCanMakePayments",(function(){return new Promise((function(e){if(void 0!==o.googleCanMakePaymentsResult)return e({googlePay:o.googleCanMakePaymentsResult});var t=setTimeout((function(){void 0===o.googleCanMakePaymentsResult&&(o.googleCanMakePaymentsResult=!1);}),2e4);return e(function e(n){return new Promise((function(n){void 0!==o.googleCanMakePaymentsResult?(clearTimeout(t),n({googlePay:o.googleCanMakePaymentsResult})):setTimeout((function(){return n(e())}),200);}))}())}))})),A()(be()(o),"canMakePayments",(function(e){return new Promise((function(e){var t=o.paymentRequestIds,n=t.appleMerchantId,r=t.googleMerchantId;if(n&&r){var a={};return o.appleCanMakePayments().then((function(e){return Object.assign(a,e)})).then((function(t){return o.googleCanMakePayments().then((function(n){return Object.assign(a,n),e(!1===t.applePay&&!1===n.googlePay?null:a)}))}))}return n?o.appleCanMakePayments().then((function(t){return e(!1===t.applePay?null:t)})):r?o.googleCanMakePayments().then((function(t){return e(!1===t.googlePay?null:t)})):void 0}))})),A()(be()(o),"listenFor",(function(t,n){var r=function(e,t){if("function"!=typeof t)throw new Error("Please supply a function as the listener argument ".concat(Y));if("string"!=typeof e)throw new Error("Please specify the event ".concat(Y));return {eventToLower:e.toLowerCase(),suppliedListener:t}}(t,n),a=r.eventToLower,i=r.suppliedListener,s=function(t){var n=t.detail;return n?i(n):e};switch(a){case"confirm-token":o.customerPaymentListener=s;break;case"cancel-transaction":o.customerCancelListener=s;break;case"payment-method-selection":o.paymentMethodListener=s;break;case"shipping-contact-update":o.shippingContactListener=s;break;case"shipping-method-update":o.shippingMethodListener=s;break;default:return}})),A()(be()(o),"createPaymentRequestToken",function(){var e=i()(c().mark((function e(t){var n,r,a,i,s,u,l,p,f,y,d,h,w,b,P,k,C;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=o.paymentRequestObj.applePay&&"number"==typeof o.paymentRequestObj.applePay.applePayVersion?o.paymentRequestObj.applePay.applePayVersion:3,r=new ApplePaySession(n,o.paymentRequestObj.applePay),a=o.paymentRequestObj.applePay.storeDisplayName,i=oe(t),s=i.instanceId,u=i.formId,l=i.controllerRef,p=i.error,f=le(l),y=pe(f),!p){e.next=8;break}return e.abrupt("return",y(R,{error:p}));case 8:return d=o.paymentRequestIds.appleMerchantId,h=m(),w=null,b=null,P=function(e){var t=e.validationURL;X(t)&&l.contentWindow.postMessage(JSON.stringify({type:"_create_payment_request_session",vUrl:t,iid:s,sessionSignature:h,prFormId:u,storeDisplayName:a,appleMerchantId:d}),g);},r.onvalidatemerchant=P,"function"==typeof o.customerCancelListener&&(f.removeEventListener(x,o.customerCancelListener,E),f.addEventListener(x,o.customerCancelListener,E)),r.oncancel=function(e){var t=e.sessionError;y(x,{sessionError:t}),f.removeEventListener(S,o.paymentMethodListener,E),f.removeEventListener(I,o.shippingContactListener,E),f.removeEventListener(T,o.shippingMethodListener,E),f.removeEventListener(x,o.customerCancelListener,E);},"function"==typeof o.paymentMethodListener&&(f.removeEventListener(S,o.paymentMethodListener,E),f.addEventListener(S,o.paymentMethodListener,E),r.onpaymentmethodselected=function(e){var t=e.paymentMethod;y(S,{paymentMethod:t,completePaymentMethodSelection:function(e){r.completePaymentMethodSelection(e);}});}),"function"==typeof o.shippingContactListener&&(f.removeEventListener(I,o.shippingContactListener,E),f.addEventListener(I,o.shippingContactListener,E),r.onshippingcontactselected=function(e){var t=e.shippingContact;y(I,{shippingContact:t,completeShippingContactSelection:function(e){if(!e)throw new Error("Please provide a 'shippingContactUpdate' object");if(e.errors&&e.errors.length>0){var t=e.errors,n=ye(t);e.errors=n;}r.completeShippingContactSelection(e);}});}),"function"==typeof o.shippingMethodListener&&(f.removeEventListener(T,o.shippingMethodListener,E),f.addEventListener(T,o.shippingMethodListener,E),r.onshippingmethodselected=function(e){var t=e.shippingMethod;y(T,{shippingMethod:t,completeShippingMethodSelection:function(e){r.completeShippingMethodSelection(e);}});}),k=function e(t){if(v===t.origin){var n=t.data;if(X(n)){var a=JSON.parse(n),i=a.type,c=a.sessionNonce,u=a.sessionObj,l=a.iid,p=a.error;if("_payment-requests-session-resp"===i&&l===s){if(c===h){if(clearTimeout(b),p&&(w={error:p},window.removeEventListener("message",e,E),"function"==typeof r.abort))return r.abort();r.completeMerchantValidation(u),r.onpaymentauthorized=function(e){f.removeEventListener(R,o.customerPaymentListener,E),f.addEventListener(R,o.customerPaymentListener,E),w={tokenDetails:{type:"applePay",token:e.payment.token},completePayment:function(e){var t=de(e);r.completePayment(t),f.removeEventListener(R,o.customerPaymentListener,E);}},f.removeEventListener(x,o.customerCancelListener,E),f.removeEventListener(S,o.paymentMethodListener,E),f.removeEventListener(I,o.shippingContactListener,E),f.removeEventListener(T,o.shippingMethodListener,E);};}else w={error:z};window.removeEventListener("message",e,E);}}}},b=setTimeout((function(){w||(w={error:V},window.removeEventListener("message",k,E));}),61e3),window.addEventListener("message",k,E),C=function e(t){return new Promise((function(t){return w?t(y(R,w)):setTimeout((function(){return t(e())}),400)}))},r.begin(),e.next=27,C();case 27:return e.abrupt("return",e.sent);case 28:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),A()(be()(o),"mountGoogleButton",(function(e,t){var r=t.eventRef,a=t.googlePayOptions,i=function(e){if(e&&e.className===w)return e;throw new Error(J)}(r),s=pe(i),c=document.getElementById(e);if(!c)throw new Error("Could not locate specified node. Please ensure the node is present on the DOM, and the id supplied is accurate and unique.");if(o.googlePayClient){var u=function(){return i.removeEventListener(R,o.customerPaymentListener,E),i.addEventListener(R,o.customerPaymentListener,E),o.googlePayClient.loadPaymentData(ce(o.paymentRequestObj.googlePay)).then((function(e){if(e&&e.paymentMethodData){var t=e.paymentMethodData,r=t.tokenizationData,a=n()(t,ze);"object"===D()(r)&&(s(R,{tokenDetails:{type:"googlePay",token:r.token,additionalData:Be(Be({},a),{},{tokenizationDataType:r.type})}}),i.removeEventListener(R,o.customerPaymentListener,E));}})).catch((function(e){s(R,{error:e.message||e.statusCode}),console.error(e),i.removeEventListener(R,o.customerPaymentListener,E);}))},l={allowedPaymentMethods:se(o.paymentRequestObj.googlePay)};if(a){var p=function(e){var t,n={},r=H(j);try{for(r.s();!(t=r.n()).done;){var o=t.value;e[o]&&(n[o]=e[o]);}}catch(e){r.e(e);}finally{r.f();}return n}(a);"function"==typeof a.preClick?l.onClick=function(){return a.preClick(),u()}:l.onClick=u,Object.assign(l,p);}else l.onClick=u;var f=o.googlePayClient.createButton(l);if(c.appendChild(f),!0===o.paymentRequestObj.googlePay.prefetchGooglePaymentData){var y=ce(o.paymentRequestObj.googlePay),d=y.transactionInfo&&y.transactionInfo.currencyCode||"USD";y.transactionInfo={totalPriceStatus:"NOT_CURRENTLY_KNOWN",currencyCode:d},o.googlePayClient.prefetchPaymentData();}}})),o}return me()(s)}(We);const Ke=Ye;var Je=me()((function e(t,n){ge()(this,e);var r=new Ke(t,n);this.createPaymentRequestToken=r.createPaymentRequestToken,this.canMakePayments=r.canMakePayments,this.listenFor=r.listenFor,this.updatePaymentRequest=r.updatePaymentRequest,this.mountGoogleButton=r.mountGoogleButton;})),Ze=["nonce","type"],$e=function(e,t){var r=function(e){var t={};if("object"===D()(e)){"boolean"==typeof e[b]&&(t[b]=e[b]);var n=e[P];if(n&&"object"===D()(n)){var r,o={},a=H(O);try{for(a.s();!(r=a.n()).done;){var i=r.value,s=n[i];X(s)&&(o[i]="".concat(s));}}catch(e){a.e(e);}finally{a.f();}var c=function(e){var t,n=0,r=H(O);try{for(r.s();!(t=r.n()).done;){var o=e[t.value];X(o)&&n++;}}catch(e){r.e(e);}finally{r.f();}if(0===n)throw new Error("'tecPaymentRequest' object was supplied, but was found to be empty. Please supply the id(s) for the desired payment request platform(s).");return e}(o);t[P]=c;}}return t}(t),o=r.hideZip,a=r.tecPaymentRequest,s=function(e){if(!e)throw new Error("".concat("Please provide a"," public key (pubKey) ").concat("to the 'createTEConnect' function"));if("string"!=typeof e)throw new Error("'pubKey' should be a string, but was found to be ".concat(D()(e)));return e}(e),u=m(),l=function(){if(!window)throw new Error("Unable to locate Window Interface. ".concat(U));if(!window.location)throw new Error("Unable to read 'location' property of Window Interface. ".concat(U));var e=window.location.origin;if(e)return e;throw new Error("Unable to read client's origin. ".concat(U))}(),p={};p.requestClient={instanceId:u,pubKey:s,requestOrigin:l};var f="".concat(g,"/?instanceId=").concat(u,"&pubKey=").concat(s,"&requestOrigin=").concat(btoa(l));return p.frameUrl="".concat(f,"&hideZip=").concat(!0===o?"true":"false"),a&&(p.prFrameUrl="".concat(f,"&enableTecPR=true"),p.paymentsRequestInterface=function(e){return function(t){var n=ue(t,e);return new Je(n,e)}}(a)),p.createPayment=function(){var e=i()(c().mark((function e(t,r){var o,a,i,s,u,l,p,f,y;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=re(t),a=o.elements,i=o.formId,!(s=o.error)){e.next=3;break}return e.abrupt("return",{error:s});case 3:return u=m(),l=null,p=null,f=function e(t){if(t.origin===v){var r=JSON.parse(t.data);if(r&&"token_exchange_response"===r.type){if(clearTimeout(p),void 0!==r.nonce){var o=r.nonce,a=(r.type,n()(r,Ze));l=o===u?a:{error:z};}else l=void 0!==r.error?{error:r.error}:{error:z};window.removeEventListener("message",e,E);}}},p=setTimeout((function(){l||(l={error:V},window.removeEventListener("message",f,E));}),61e3),window.addEventListener("message",f,E),a.contentWindow.postMessage(JSON.stringify({type:"create_card_payment",formId:i,nonce:u,billingZip:r||null}),g),y=function e(t){return new Promise((function(t){return l?t(l):setTimeout((function(){return t(e())}),400)}))},e.next=14,y();case 14:return e.abrupt("return",e.sent);case 15:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),p};})(),o})()));
9
- });
10
-
11
- const teConnect$1 = /*@__PURE__*/getDefaultExportFromCjs(teConnect);
5
+ import './_commonjsHelpers-9bc404fc.js';
12
6
 
13
7
  /**
14
8
  * Gets the timestamp of the number of milliseconds that have elapsed since
@@ -319,13 +313,6 @@ function debounce(func, wait, options) {
319
313
 
320
314
  var debounce_1 = debounce;
321
315
 
322
- var teConnectJs = createCommonjsModule(function (module, exports) {
323
- !function(t,e){"object"=='object'&&"object"=='object'?module.exports=e():"function"==typeof undefined&&undefined.amd?undefined([],e):"object"=='object'?exports["te-connect-js"]=e():t["te-connect-js"]=e();}(self,(()=>(()=>{var t={713:t=>{t.exports=function(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t};}},e={};function n(o){var r=e[o];if(void 0!==r)return r.exports;var s=e[o]={exports:{}};return t[o](s,s.exports,n),s.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var o in e)n.o(e,o)&&!n.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]});},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0});};var o={};return (()=>{"use strict";n.r(o),n.d(o,{TeConnectJs:()=>b});var t=n(713),e=n.n(t);const r="https://svc4.magensa.net",s=`${r}/TEConnect`,i=["instanceId","pubKey","requestOrigin"],a="This usually means TEConnect was not loaded properly - or is unable to resolve the TEConnect URL.",c=`Reference to Card Entry element was not found. ${a}.`,l=`Id for TEConnect inputs was not found. ${a}.`,p="Error in 'mountTecPrButton'. Payment Request interface not found.",u="__te-connect-secure-window",d="__tec-pr-window",h={passive:!0},y={border:"none !important",margin:"0px !important",padding:"0px !important",width:"1px !important",minWidth:"100% !important",overflow:"hidden !important",display:"block !important",userSelect:"none !important",transform:"translateZ(0px) !important",height:"100%"},m={buttonLanguage:"en",buttonType:"plain",buttonStyle:"black"};function f(t,e){var n=document.createElement("iframe");return n.id=!0!==e?u:d,n.title=!0!==e?"TEConnect Secure Frame":"TEConnect Payment Requests Frame",n.name=!0!==e?"__teConnectSecureFrame":"__tecPrFrameName",n.width="100%",n.loading="lazy",n.allowPaymentRequest=!0,n.frameBorder="0",n.scrolling="no",n.setAttribute("allowtransparency","true"),n.src=t,!0!==e?function(t){for(var e=Object.keys(y),n=0;n<e.length;n++){var o=e[n];t.style[o]=y[o];}}(n):(n.width="0",n.height="0",n.style.position="absolute",n.style.left="-9000px",n.style.overflow="hidden",n.style.visibility="hidden"),n}function w(t){const e=document.getElementById(t);if(!e)throw new Error("Could not locate specified node. Please ensure the node is present on the DOM, and the id supplied is accurate and unique.");return e}class g{get clientStyles(){return this._clientStyles}set clientStyles(t){JSON.stringify(this.clientStyles)!==JSON.stringify(t)&&this.sendStyles(t),this._clientStyles=t;}get formId(){return this._formId}set formId(t){""!==t&&"object"==typeof this.clientStyles&&this.sendStyles(this.clientStyles),this._formId=t;}constructor(t){e()(this,"teConnect",void 0),e()(this,"listenerOptionsSupported",void 0),e()(this,"createTecPrTokenMethod",void 0),e()(this,"applePayBtnOptions",void 0),e()(this,"canMakePaymentsResult",void 0),e()(this,"mountGoogleBtnMethod",void 0),e()(this,"_clientStyles",void 0),e()(this,"_formId",void 0),e()(this,"sendStyles",(t=>{const e=document.getElementById(u);e&&e.contentWindow&&e.contentWindow.postMessage(JSON.stringify({type:"client_style_sheet",styles:t}),s);})),e()(this,"setStyles",(t=>{const e=function(t){if(t&&"object"==typeof t&&"function"==typeof t.hasOwnProperty&&(t.hasOwnProperty("boxes")||t.hasOwnProperty("base")))return t;throw new Error("Styles object provided is not in recognized format. Please refer to the Styles API docs for guidance on how to construct your custom styles object.")}(t);this.clientStyles=e;})),e()(this,"mountCardEntry",((t,e)=>{const n=w(t);e&&this.setStyles(e),this.attachTeFormListener();const o=f(this.teConnect.frameUrl);n.appendChild(o);})),e()(this,"createPayment",(async t=>{const e=document.getElementById(u);if(!e)throw new Error("Could not locate 'Card Entry'. Please ensure the node is present on the DOM ('mountCardEntry' was called prior to this call).");const n=(o=e,r=this.formId,o?r&&"string"==typeof r?"":l:c);var o,r;if(""!==n)return {error:n};const s={elements:e,formId:this.formId};return await this.teConnect.createPayment(s,t)})),e()(this,"createPaymentRequestToken",(async()=>{if("function"==typeof this.createTecPrTokenMethod){const t=document.getElementById(d);if(!t)throw new Error("Could not locate TEConnect Payment Request. Please ensure the nodes are present on the DOM.");if("string"!=typeof this.prFormId||this.prFormId.length<5)throw new Error(`[TEConnect Session Error]: ${l}`);try{await this.createTecPrTokenMethod({instanceId:this.teConnect.requestClient.instanceId,formId:this.prFormId,controllerRef:t});}catch(t){console.error("[TEConnect Session Error]: ",t);}}})),e()(this,"mountTecPrButton",((t,e)=>{if(this.canMakePaymentsResult){const{applePay:n,googlePay:o}=this.canMakePaymentsResult,r=function(){const t=document.createElement("div");return t.className="_tec-payment-evt-ele",t}();if(n){if(this.applePayBtnOptions=(t=>{if(t){const{applePayOptions:e}=t;if(e&&"object"==typeof e){const{buttonLanguage:t,buttonType:n,buttonStyle:o}=e,r=(t=>{if("string"!=typeof t)return "black";switch(t.toLowerCase()){case"black":default:return "black";case"white":return "white";case"white-outline":return "white-with-line"}})(o);return {buttonLanguage:t&&"string"==typeof t?`${t}`:m.buttonLanguage,buttonType:n&&"string"==typeof n?`${n}`:m.buttonType,buttonStyle:r}}}return m})(e||this.applePayBtnOptions),"function"!=typeof this.createTecPrTokenMethod||"string"!=typeof this.teConnect.prFrameUrl)throw new Error(p);{const e=w("string"==typeof t?t:t.applePayNode);this.attachTeFormListener();const n=function(t){const e=document.createElement("style");return e.innerHTML=`\n .apple-pay-button {\n display: inline-block;\n -webkit-appearance: -apple-pay-button;\n -apple-pay-button-type: ${t};\n }\n .apple-pay-button-black {\n -apple-pay-button-style: black;\n }\n .apple-pay-button-white {\n -apple-pay-button-style: white;\n }\n .apple-pay-button-white-with-line {\n -apple-pay-button-style: white-outline;\n }\n `,e}(this.applePayBtnOptions.buttonType);e.appendChild(n);const o=f(this.teConnect.prFrameUrl,!0);r.appendChild(o),e.appendChild(r);const s=function(t){let{buttonStyle:e,buttonLanguage:n}=t;const o=document.createElement("div");return o.id="te-connect-apple-pay-btn",o.classList.add("apple-pay-button","apple-pay-button-"+e),o.lang=n,o}(this.applePayBtnOptions);s.onclick=this.createPaymentRequestToken,e.appendChild(s),this.prFormId||(o.src=o.src);}}if(o){if("function"!=typeof this.mountGoogleBtnMethod)throw new Error(p);{const o="string"==typeof t?t:t.googlePayNode,s=w(o);n||s.appendChild(r);const i={instanceId:this.teConnect.requestClient.instanceId,eventRef:r};e&&e.googlePayOptions&&(i.googlePayOptions=e.googlePayOptions),this.mountGoogleBtnMethod(o,i);}}}})),e()(this,"canMakePayments",(t=>()=>new Promise((e=>t().then((t=>{this.canMakePaymentsResult=t,e(t);})))))),e()(this,"createTecPaymentRequest",(t=>{if("function"==typeof this.teConnect.paymentsRequestInterface){const{createPaymentRequestToken:e,canMakePayments:n,mountGoogleButton:o,...r}=this.teConnect.paymentsRequestInterface(t);return this.createTecPrTokenMethod=e,this.mountGoogleBtnMethod=o,{...r,canMakePayments:this.canMakePayments(n),mountTecPrButton:this.mountTecPrButton}}throw new Error("Please provide 'tecPaymentRequest' options to the 'createTEConnect' method, prior to creating a prInterface")})),this.teConnect=function(t){if(!t)throw new Error(NO_INSTANCE);if("object"!=typeof t.requestClient)throw new Error(INCOMPLETE_INSTANCE);const{requestClient:e}=t;if("function"!=typeof e.hasOwnProperty)throw new Error(INCOMPLETE_INSTANCE);for(const t of i)if(!e.hasOwnProperty(t))throw new Error(INCOMPLETE_INSTANCE);return t}(t),this.listenerOptionsSupported=function(){var t=!1;try{var e={get passive(){return t=!0,!1}};window.addEventListener("test",null,e),window.removeEventListener("test",null,e);}catch{t=!1;}return t}(),this.formIdListener=this.formIdListener.bind(this),this.attachTeFormListener=this.attachTeFormListener.bind(this),this.mountCardEntry=this.mountCardEntry.bind(this);}formIdListener(t){if(t.origin===r&&t.data&&"string"==typeof t.data){const{formId:e,prFormId:n}=JSON.parse(t.data);"string"==typeof e&&e.length>5&&(this.formId=e),"string"==typeof n&&n.length>5&&(this.prFormId=n);}}attachTeFormListener(){window.addEventListener("message",this.formIdListener,!this.listenerOptionsSupported||h),window.addEventListener("unload",(function(){window.removeEventListener("message",this.formIdListener,!this.listenerOptionsSupported||h);}),!this.listenerOptionsSupported||h);}}class b{constructor(t){const e=new g(t);this.createPayment=e.createPayment,this.setStyles=e.setStyles,this.mountCardEntry=e.mountCardEntry,this.createTecPaymentRequest=e.createTecPaymentRequest;}}})(),o})()));
324
- //# sourceMappingURL=te-connect-js.map
325
- });
326
-
327
- const teConnectJs$1 = /*@__PURE__*/getDefaultExportFromCjs(teConnectJs);
328
-
329
316
  const buyGiftcardFormCss = "buy-giftcard-form{display:block;width:100%}.buy-giftcard-form *{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}.buy-giftcard-form input[type=\"number\"]{padding:8px 16px 8px 28px !important}.fs-input--date::-webkit-calendar-picker-indicator{cursor:pointer;background-color:#f00;position:absolute;right:0;top:0;height:48px;width:48px}.buy-giftcard--terms p{margin:0}.buy-giftcard--terms p+p{margin-top:1em}.buy-giftcard--terms-actions button:hover{opacity:0.85}@media (max-width: 768px){.fs--form--actions{position:fixed;left:0;right:0;bottom:0;padding:16px;-moz-box-shadow:0px 0px 24px rgba(0, 0, 0, 0.25);-webkit-box-shadow:0px 0px 24px rgba(0, 0, 0, 0.25);box-shadow:0px 0px 24px rgba(0, 0, 0, 0.25)}}";
330
317
 
331
318
  var DeliveryType;
@@ -339,27 +326,6 @@ var FormStep;
339
326
  FormStep["PaymentInfo"] = "Payment Info";
340
327
  FormStep["PaymentSucceed"] = "Payment Succeed";
341
328
  })(FormStep || (FormStep = {}));
342
- const customStyles = {
343
- base: {
344
- backgroundColor: 'rgba(255, 255, 255, 0)',
345
- wrapper: {
346
- backgroundColor: 'rgba(255, 255, 255, 0)',
347
- direction: 'column',
348
- margin: '0 -8px',
349
- padding: 0,
350
- },
351
- variants: {
352
- inputType: 'outlined',
353
- inputMargin: 'dense',
354
- },
355
- },
356
- boxes: {
357
- borderRadius: 4,
358
- textColor: Colors.TextColor,
359
- errorColor: Colors.Error03,
360
- width: '100%',
361
- },
362
- };
363
329
  const BuyGiftcardForm = class {
364
330
  constructor(hostRef) {
365
331
  registerInstance(this, hostRef);
@@ -433,7 +399,6 @@ const BuyGiftcardForm = class {
433
399
  },
434
400
  }]);
435
401
  this.step = FormStep.PaymentInfo;
436
- setTimeout(() => this.initMagensaPayment(), 350);
437
402
  }
438
403
  else {
439
404
  this.errorMessage = 'Please select a gift card style';
@@ -456,8 +421,97 @@ const BuyGiftcardForm = class {
456
421
  }]);
457
422
  }
458
423
  };
424
+ this.onPaymentSuccess = async (magensaQueueId) => {
425
+ this.isSubmitting = true;
426
+ this.errorMessage = null;
427
+ const recipientUserEmail = (this.recipientEmail || '').indexOf('@') > -1 ? this.recipientEmail : '';
428
+ const recipientUserPhone = (this.recipientEmail || '').indexOf('@') === -1 ? this.recipientEmail : '';
429
+ if (this.recipientFirstName && this.recipientLastName && (recipientUserEmail || recipientUserPhone)) {
430
+ try {
431
+ const { giftCardStyles } = this.giftCardSettings || {};
432
+ const selectedGiftCardStyle = this.selectedStyleId ? ((giftCardStyles || []).find(style => style.id === this.selectedStyleId) || {}).imageUrl : '';
433
+ const giftCardData = {
434
+ source: '',
435
+ amount: this.customAmount || this.selectedAmount || '1.00',
436
+ gift_card_style: selectedGiftCardStyle || '',
437
+ delivery_date: this.deliveryDate ? dayjs_min(this.deliveryDate).format(dateFormat) : dayjs_min().format(dateFormat),
438
+ promotion_code: '',
439
+ p_email: this.userInfo.email || '',
440
+ p_first_name: this.userInfo.firstName || '',
441
+ p_last_name: this.userInfo.lastName || '',
442
+ p_phone: this.userInfo.mobilePhone || '',
443
+ r_first_name: this.recipientFirstName || this.userInfo.firstName || '',
444
+ r_last_name: this.recipientLastName || this.userInfo.lastName || '',
445
+ r_email: recipientUserEmail || recipientUserPhone || this.userInfo.email || this.userInfo.mobilePhone || '',
446
+ r_message: this.recipientMessage || '',
447
+ billing_street: '',
448
+ billing_city: '',
449
+ billing_state: '',
450
+ billing_zip: '',
451
+ payment_valid: {
452
+ type: 'magensa',
453
+ magensa_queue: magensaQueueId,
454
+ },
455
+ };
456
+ this.trackingEvents = this.trackingEvents.concat([{
457
+ type: 'on_submit_gift_card',
458
+ data: {
459
+ giftCardData,
460
+ },
461
+ }]);
462
+ const response = await HttpService().onBuyGiftCard(this.salonInfo.id, giftCardData);
463
+ const { status, message } = (response.data || {});
464
+ if (status === true) {
465
+ this.trackingEvents = this.trackingEvents.concat([{
466
+ type: 'on_submit_succeed',
467
+ data: {
468
+ response,
469
+ },
470
+ }]);
471
+ await this.saveTrackingData();
472
+ this.step = FormStep.PaymentSucceed;
473
+ }
474
+ else {
475
+ this.errorMessage = message || `Something went wrong when sending your gift card`;
476
+ this.trackingEvents = this.trackingEvents.concat([{
477
+ type: 'on_submit_error',
478
+ data: {
479
+ error: this.errorMessage,
480
+ response,
481
+ },
482
+ }]);
483
+ await this.saveTrackingData();
484
+ }
485
+ }
486
+ catch (error) {
487
+ this.errorMessage = error.message || (error.error && error.error.message) || get_1(error, 'response.data.message') || `Something went wrong when sending your gift card`;
488
+ this.trackingEvents = this.trackingEvents.concat([{
489
+ type: 'on_submit_error',
490
+ data: {
491
+ error: this.errorMessage,
492
+ },
493
+ }]);
494
+ await this.saveTrackingData();
495
+ }
496
+ }
497
+ this.isSubmitting = false;
498
+ };
499
+ this.onPaymentError = async (error, response) => {
500
+ this.isSubmitting = true;
501
+ try {
502
+ this.trackingEvents = this.trackingEvents.concat([{
503
+ type: 'on_payment_error',
504
+ data: {
505
+ error,
506
+ response,
507
+ },
508
+ }]);
509
+ await this.saveTrackingData();
510
+ }
511
+ catch (e) { }
512
+ this.isSubmitting = false;
513
+ };
459
514
  this.salonId = undefined;
460
- this.teConnect = undefined;
461
515
  this.isLoading = true;
462
516
  this.isSubmitting = undefined;
463
517
  this.errorMessage = undefined;
@@ -485,7 +539,6 @@ const BuyGiftcardForm = class {
485
539
  const promises = [
486
540
  this.fetchSalonInfo(),
487
541
  this.fetchGiftCardSettings(),
488
- this.fetchMagensaCredentials(),
489
542
  ];
490
543
  await Promise.all(promises);
491
544
  this.trackingEvents = this.trackingEvents.concat([{
@@ -525,18 +578,6 @@ const BuyGiftcardForm = class {
525
578
  catch (e) { }
526
579
  }
527
580
  ;
528
- async fetchMagensaCredentials() {
529
- try {
530
- this.magensaCredentials = await HttpService().fetchMagensaCredentials(Number(this.salonId));
531
- this.trackingEvents = this.trackingEvents.concat([{
532
- type: 'fetch_magensa_credentials',
533
- data: {
534
- magensaCredentials: this.magensaCredentials,
535
- },
536
- }]);
537
- }
538
- catch (e) { }
539
- }
540
581
  async fetchSalonInfo() {
541
582
  try {
542
583
  this.salonInfo = await HttpService().fetchSalonInfo(Number(this.salonId));
@@ -561,11 +602,6 @@ const BuyGiftcardForm = class {
561
602
  }
562
603
  catch (e) { }
563
604
  }
564
- initMagensaPayment() {
565
- const teInstance = teConnect.createTEConnect(this.magensaCredentials.token, { hideZip: true });
566
- this.teConnect = new teConnectJs.TeConnectJs(teInstance);
567
- this.teConnect.mountCardEntry('buy-giftcard--payment', customStyles);
568
- }
569
605
  renderPaymentOnlineDisabled() {
570
606
  return (h("div", { style: { paddingTop: '24px', textAlign: 'center' } }, h("div", { style: { fontSize: '24px', fontWeight: '700', lineHeight: '1.4' } }, "Online Gift Card is not available"), h("div", { style: { marginTop: '12px' } }, "Please call us for assistance or visit salon. Thanks!"), h("div", { style: { marginTop: '12px' } }, h("a", { rel: "noopener noreferrer", href: `tel:${this.salonInfo.businessPhone}` }, h("button", { type: "button", style: {
571
607
  backgroundColor: Colors.Secondary,
@@ -854,7 +890,12 @@ const BuyGiftcardForm = class {
854
890
  fontSize: '16px',
855
891
  borderRadius: '8px',
856
892
  width: '100%',
857
- } }))), h("div", { style: {
893
+ } }))), this.errorMessage && (h("div", { style: {
894
+ backgroundColor: Colors.Red01,
895
+ border: `1px solid ${Colors.Red02}`,
896
+ marginTop: '24px',
897
+ padding: '16px',
898
+ } }, this.errorMessage)), h("div", { style: {
858
899
  marginTop: '24px',
859
900
  textAlign: 'right',
860
901
  } }, h("button", { type: "button", style: {
@@ -868,228 +909,47 @@ const BuyGiftcardForm = class {
868
909
  paddingLeft: '24px',
869
910
  paddingRight: '24px',
870
911
  height: '48px',
871
- }, onClick: () => this.onSubmitGiftCardForm() }, "Next")), this.errorMessage && (h("div", { style: {
872
- backgroundColor: Colors.Red01,
873
- border: `1px solid ${Colors.Red02}`,
874
- marginBottom: '24px',
875
- marginTop: '24px',
876
- padding: '16px',
877
- } }, this.errorMessage))));
912
+ }, onClick: () => this.onSubmitGiftCardForm() }, "Next"))));
878
913
  }
879
914
  renderPaymentSucceed() {
880
915
  return (h("div", { style: { paddingTop: '24px' } }, h("buy-giftcard-succeed", null)));
881
916
  }
882
- async createCardPayment() {
883
- try {
884
- const { error, token } = await this.teConnect.createPayment();
885
- if (!error && token) {
886
- this.trackingEvents = this.trackingEvents.concat([{
887
- type: 'on_create_card_token',
888
- data: {
889
- token,
890
- },
891
- }]);
892
- return Promise.resolve({ token });
893
- }
894
- this.trackingEvents = this.trackingEvents.concat([{
895
- type: 'on_create_card_token',
896
- data: {
897
- error,
898
- },
899
- }]);
900
- return Promise.reject({ message: error });
901
- }
902
- catch (response) {
903
- const errorMessage = response.error || 'Something went wrong when processing your card';
904
- this.trackingEvents = this.trackingEvents.concat([{
905
- type: 'on_create_card_token',
906
- data: {
907
- error: errorMessage,
908
- response,
909
- },
910
- }]);
911
- return Promise.reject({ message: errorMessage });
912
- }
913
- }
914
- /*
915
- private async processCardToken(Token: string | String) {
916
- const defaultErrorMessage = 'Something went wrong when creating payment transaction';
917
-
918
- try {
919
- const { MPPGv4WSFault, CustomerTransactionID, TransactionOutput } = await HttpService().magensaProcessToken(Number(this.salonId), {
920
- raw_data: [{
921
- Token,
922
- TransactionInput: {
923
- TransactionType: 1,
924
- ProcessorName: this.magensaCredentials.processorName,
925
- Amount: Number(this.customAmount || this.selectedAmount || 1).toFixed(2),
926
- },
927
- }],
928
- });
929
-
930
- if (!MPPGv4WSFault) {
931
- this.trackingEvents = this.trackingEvents.concat([{
932
- type: 'process_magensa_token_success',
933
- data: {
934
- transactionID: CustomerTransactionID,
935
- },
936
- }]);
937
- return Promise.resolve({ transactionID: CustomerTransactionID });
938
- }
939
-
940
- let message = MPPGv4WSFault && MPPGv4WSFault!.FaultReason;
941
- if (!message && TransactionOutput && TransactionOutput.TransactionMessage) {
942
- message = TransactionOutput.TransactionMessage;
943
- }
944
-
945
- this.trackingEvents = this.trackingEvents.concat([{
946
- type: 'process_magensa_token_error',
947
- data: {
948
- error: message || defaultErrorMessage,
949
- },
950
- }]);
951
- return Promise.reject({ message: message || defaultErrorMessage });
952
- } catch(res) {
953
- this.trackingEvents = this.trackingEvents.concat([{
954
- type: 'process_magensa_token_error',
955
- data: {
956
- error: res.error || defaultErrorMessage,
957
- },
958
- }]);
959
- return Promise.reject({ message: res.error || defaultErrorMessage });
960
- }
961
- }
962
- */
963
- async onSubmitPaymentForm() {
964
- this.isSubmitting = true;
965
- this.errorMessage = null;
966
- if (this.recipientFirstName && this.recipientLastName && this.recipientEmail) {
967
- try {
968
- const { token } = await this.createCardPayment();
969
- // const { transactionID } = await this.processCardToken(token);
970
- if (token) {
971
- const { giftCardStyles } = this.giftCardSettings || {};
972
- const selectedGiftCardStyle = this.selectedStyleId
973
- ? ((giftCardStyles || []).find(style => style.id === this.selectedStyleId) || {}).imageUrl : '';
974
- const recipientUserEmail = (this.recipientEmail || '').indexOf('@') > -1 ? this.recipientEmail : '';
975
- const recipientUserPhone = (this.recipientEmail || '').indexOf('@') === -1 ? this.recipientEmail : '';
976
- const giftCardData = {
977
- source: '',
978
- amount: this.customAmount || this.selectedAmount || '',
979
- gift_card_style: selectedGiftCardStyle || '',
980
- delivery_date: this.deliveryDate ? dayjs_min(this.deliveryDate).format(dateFormat) : dayjs_min().format(dateFormat),
981
- promotion_code: '',
982
- p_email: this.userInfo.email || '',
983
- p_first_name: this.userInfo.firstName || '',
984
- p_last_name: this.userInfo.lastName || '',
985
- p_phone: this.userInfo.mobilePhone || '',
986
- r_first_name: this.recipientFirstName || this.userInfo.firstName || '',
987
- r_last_name: this.recipientLastName || this.userInfo.lastName || '',
988
- r_email: recipientUserEmail || recipientUserPhone || this.userInfo.email || this.userInfo.mobilePhone || '',
989
- r_message: this.recipientMessage || '',
990
- billing_street: '',
991
- billing_city: '',
992
- billing_state: '',
993
- billing_zip: '',
994
- payment_valid: {
995
- type: 'magensa',
996
- magensa_token: token,
997
- },
998
- };
999
- this.trackingEvents = this.trackingEvents.concat([{
1000
- type: 'on_submit_gift_card',
1001
- data: {
1002
- giftCardData,
1003
- },
1004
- }]);
1005
- const response = await HttpService().onBuyGiftCard(this.salonInfo.id, giftCardData);
1006
- const { status, message } = (response.data || {});
1007
- if (status === true) {
1008
- this.trackingEvents = this.trackingEvents.concat([{
1009
- type: 'on_submit_succeed',
1010
- data: {
1011
- response,
1012
- },
1013
- }]);
1014
- await this.saveTrackingData();
1015
- this.step = FormStep.PaymentSucceed;
1016
- }
1017
- else {
1018
- this.errorMessage = message || `Something went wrong when sending your gift card`;
1019
- this.trackingEvents = this.trackingEvents.concat([{
1020
- type: 'on_submit_error',
1021
- data: {
1022
- error: this.errorMessage,
1023
- response,
1024
- },
1025
- }]);
1026
- await this.saveTrackingData();
1027
- }
1028
- }
1029
- else {
1030
- this.errorMessage = `Something went wrong with your credit card`;
1031
- this.trackingEvents = this.trackingEvents.concat([{
1032
- type: 'on_submit_error',
1033
- data: {
1034
- error: 'No card token',
1035
- },
1036
- }]);
1037
- await this.saveTrackingData();
1038
- }
1039
- }
1040
- catch (error) {
1041
- this.errorMessage = error.message || (error.error && error.error.message) || get_1(error, 'response.data.message') || `Something went wrong when sending your gift card`;
1042
- this.trackingEvents = this.trackingEvents.concat([{
1043
- type: 'on_submit_error',
1044
- data: {
1045
- error: this.errorMessage,
1046
- },
1047
- }]);
1048
- await this.saveTrackingData();
1049
- }
1050
- }
1051
- this.isSubmitting = false;
1052
- }
1053
917
  renderPaymentForm() {
1054
- return (h("div", null, h("div", { style: { fontSize: '16px' } }, "Amount: ", h("b", { style: {
918
+ const { isDuoPricingEnabled, paymentFeeRate } = this.giftCardSettings || {};
919
+ const paymentAmount = this.customAmount || this.selectedAmount;
920
+ const totalPaymentAmount = isDuoPricingEnabled && paymentFeeRate > 0
921
+ ? Number(Number(paymentAmount) + (Number(paymentAmount) * paymentFeeRate / 100)).toFixed(2)
922
+ : Number(paymentAmount).toFixed(2);
923
+ const totalPaymentFee = Number(Number(totalPaymentAmount) - Number(paymentAmount)).toFixed(2);
924
+ return (h("div", { class: "buy-giftcard-form" }, h("div", { style: {
925
+ backgroundColor: Colors.Gray01,
926
+ border: `1px solid ${Colors.Gray02}`,
927
+ borderRadius: '8px',
928
+ padding: '16px',
929
+ } }, h("div", { style: { fontSize: '16px' } }, "Delivery to: ", h("b", { style: {
1055
930
  fontSize: '18px',
1056
931
  fontWeight: '700',
1057
932
  marginLeft: '6px',
1058
- } }, "$", this.customAmount || this.selectedAmount)), h("div", { style: { fontSize: '16px', marginTop: '8px' } }, "Delivery to: ", h("b", { style: {
933
+ } }, this.recipientFirstName, " ", this.recipientLastName, " ", this.deliveryType === DeliveryType.Email ? `(${this.recipientEmail})` : this.recipientEmail)), h("div", { style: { fontSize: '16px', marginTop: '8px' } }, "When: ", h("b", { style: {
1059
934
  fontSize: '18px',
1060
935
  fontWeight: '700',
1061
936
  marginLeft: '6px',
1062
- } }, this.recipientFirstName, " ", this.recipientLastName, " (", this.recipientEmail, ")")), h("div", { style: { fontSize: '16px', marginTop: '8px' } }, "When: ", h("b", { style: {
937
+ } }, this.deliveryDate ? dayjs_min(this.deliveryDate).format(shortDateFormat) : 'Today')), totalPaymentAmount && Number(totalPaymentAmount) > 0 && (h("div", { style: { marginTop: '8px' } }, h("div", { style: { display: 'flex', alignItems: 'center' } }, h("div", { style: { minWidth: '180px' } }, "Gift card amount"), h("div", { style: { fontSize: '18px', fontWeight: '700', paddingLeft: '24px' } }, "$", Number(paymentAmount).toFixed(2))), Number(totalPaymentFee) > 0 && (h("div", { style: { display: 'flex', alignItems: 'center', marginTop: '8px' } }, h("div", { style: { minWidth: '180px' } }, "Convenience fee"), h("div", { style: { fontSize: '18px', fontWeight: '700', paddingLeft: '24px' } }, "$", totalPaymentFee))), h("div", { style: { display: 'flex', alignItems: 'center', marginTop: '8px' } }, h("div", { style: {
938
+ paddingTop: '8px',
939
+ minWidth: '180px',
940
+ } }, "Amount to be charged"), h("div", { style: {
941
+ borderTop: `2px dashed ${Colors.Black}`,
1063
942
  fontSize: '18px',
1064
943
  fontWeight: '700',
1065
- marginLeft: '6px',
1066
- } }, this.deliveryDate ? dayjs_min(this.deliveryDate).format(shortDateFormat) : 'Today')), h("div", { style: { fontSize: '18px', marginTop: '24px' } }, "Payment"), h("div", { style: { marginTop: '8px', marginLeft: '-6px' } }, h("credit-card-types", null)), h("div", { id: "buy-giftcard--payment", style: { height: '300px', maxWidth: '400px', marginTop: '24px' } }), h("div", { class: "fs--form--actions" }, this.errorMessage && (h("div", { style: {
1067
- color: Colors.Red03,
1068
- marginBottom: '16px',
1069
- } }, this.errorMessage)), h("button", { type: "button", disabled: this.isSubmitting, style: {
1070
- border: `1px solid ${Colors.Secondary}`,
1071
- backgroundColor: Colors.Secondary,
1072
- color: Colors.White,
1073
- borderRadius: '8px',
1074
- cursor: 'pointer',
1075
- fontSize: '16px',
1076
- fontWeight: '700',
1077
- paddingLeft: '24px',
1078
- paddingRight: '24px',
1079
- height: '44px',
1080
- width: '100%',
1081
- ...this.isSubmitting ? {
1082
- color: Colors.TextColor,
1083
- borderColor: Colors.Gray03,
1084
- backgroundColor: Colors.Gray03,
1085
- } : {},
1086
- }, onClick: () => this.onSubmitPaymentForm() }, this.isSubmitting ? 'Processing...' : 'Submit', " ", this.isSubmitting && (h("span", { style: { marginLeft: '4px' } }, h("icon-loading", null)))))));
944
+ marginLeft: '24px',
945
+ paddingTop: '8px',
946
+ } }, "$", totalPaymentAmount))))), h("div", { style: { marginTop: '32px' } }, h("magensa-payment", { isProcessing: this.isSubmitting, processingError: this.errorMessage, salonId: this.salonId, paymentAmount: totalPaymentAmount, onPaymentSuccess: this.onPaymentSuccess, onPaymentError: this.onPaymentError }))));
1087
947
  }
1088
948
  renderSalonInfo() {
1089
949
  const salonImageUrl = getSalonImage(this.salonInfo);
1090
950
  return (h("div", { style: {
1091
951
  backgroundColor: Colors.White,
1092
- border: `1px solid ${Colors.Gray03}`,
952
+ border: `1px solid ${Colors.Gray02}`,
1093
953
  borderRadius: '8px',
1094
954
  padding: '24px',
1095
955
  } }, h("div", { style: { display: 'flex' } }, salonImageUrl && (h("div", { style: { marginRight: '24px' } }, h("img", { src: salonImageUrl, alt: this.salonInfo.businessName, style: { maxWidth: '84px' } }))), h("div", { style: { flexGrow: '1', flexShrink: '1' } }, h("div", { style: {
@@ -1201,8 +1061,9 @@ const BuyGiftcardForm = class {
1201
1061
  color: Colors.Black,
1202
1062
  fontSize: '20px',
1203
1063
  fontWeight: '500',
1204
- } }, "Gift Card Terms"), h("div", { class: "buy-giftcard--terms", innerHTML: giftCardTerms, style: {
1064
+ } }, "Gift Card terms"), h("div", { class: "buy-giftcard--terms", innerHTML: giftCardTerms, style: {
1205
1065
  background: Colors.Gray01,
1066
+ border: `1px solid ${Colors.Gray02}`,
1206
1067
  borderRadius: '8px',
1207
1068
  fontSize: '16px',
1208
1069
  lineHeight: '1.5',