{"version":3,"sources":["webpack:///./src/components/accountDetailsComponent/accountDataTabs/payments/StorePolicyControls.vue?c3ce","webpack:///./src/components/accountDetailsComponent/accountDataTabs/payments/StorePolicyControls.vue?4cc7","webpack:///./src/components/accountDetailsComponent/accountDataTabs/payments/StorePolicyControls.vue?b912","webpack:///./src/components/accountDetailsComponent/accountDataTabs/payments/StorePolicyControls.vue","webpack:///./node_modules/core-js/modules/es.regexp.flags.js","webpack:///./src/Model/forms/types.ts","webpack:///./src/validators/sessions/validators.ts","webpack:///./src/components/accountDetailsComponent/accountDataTabs/payments/StorePolicyControls.vue?eb5e"],"names":["render","_vm","this","_h","$createElement","_c","_self","staticClass","style","showLoadingSpinner","attrs","NotificationBoxType","Danger","scopedSlots","_u","key","fn","proxy","_v","_s","fetchFailedErrorMessage","ref","handleSubmit","on","$event","preventDefault","saveStorePolicy","policySwitchLabel","enabledProviderVid","enabled","disableSwitch","policyUrlLabel","urlRules","getUrlValidationMode","errors","invalid","validated","directives","name","rawName","value","expression","class","domProps","target","composing","url","saveFailed","saveFailedErrorMessage","_e","translatedLoadingToProgressButtonState","isValidForProgressButton","buttonPolicySave","staticRenderFns","Payments","accountId","Number","APP_UTILITIES","getCookie","screenText","ScreenText","urlMaxLength","required_if","values","regex","urlRegex","max","length","extend","message","getScreenText","replace","registerValidators","paymentsModule","fetchStorePolicy","resetUrlInput","then","formObserverRef","resetEnabledInput","initialValue","enabledProviderRef","validateSilent","reset","urlProviderRef","flags","VeeValidateProviderMode","Eager","Passive","validate","isSavingStorePolicy","valid","changed","canSave","payload","didSaveStorePolicyFail","showToastMessage","policySavedSuccess","ToastType","Success","onSaveFailed","buttonState","isFetchingStorePolicy","storePolicy","didFetchStorePolicyFail","Vue","tslib_1","Ref","Watch","Component","components","NotificationBox","ProgressButton","ToggleSwitch","ValidationObserver","ValidationProvider","component","DESCRIPTORS","objectDefinePropertyModule","regExpFlags","UNSUPPORTED_Y","f","RegExp","prototype","configurable","get","FormValidationError","priceGreaterThanZeroWithTaxRateValidator","price","taxRate","registerPriceRequiredValidator","required","requiredField","registerPriceMinValueValidator","min_value","registerPriceGreaterThanZeroWithTaxRateValidator","params"],"mappings":"uHAAA,IAAIA,EAAS,WAAa,IAAIC,EAAIC,KAASC,EAAGF,EAAIG,eAAmBC,EAAGJ,EAAIK,MAAMD,IAAIF,EAAG,OAAOE,EAAG,MAAM,CAACE,YAAY,yBAAyB,CAACF,EAAG,MAAM,CAACE,YAAY,kBAAkBC,MAAM,CAAG,WAAcP,EAAIQ,mBAAqB,UAAY,UAAYC,MAAM,CAAC,aAAa,GAAG,cAAc,qBAAqBL,EAAG,MAAM,CAACG,MAAM,CAAG,WAAcP,EAAIQ,mBAAqB,SAAW,WAAaC,MAAM,CAAC,cAAc,wBAAwB,CAAET,EAAe,YAAE,CAACI,EAAG,MAAM,CAACE,YAAY,mBAAmBG,MAAM,CAAC,cAAc,0CAA0C,CAACL,EAAG,kBAAkB,CAACK,MAAM,CAAC,KAAOT,EAAIU,oBAAoBC,QAAQC,YAAYZ,EAAIa,GAAG,CAAC,CAACC,IAAI,OAAOC,GAAG,WAAW,MAAO,CAACX,EAAG,IAAI,CAACE,YAAY,gCAAgCU,OAAM,GAAM,CAACF,IAAI,UAAUC,GAAG,WAAW,MAAO,CAACX,EAAG,OAAO,CAACJ,EAAIiB,GAAGjB,EAAIkB,GAAGlB,EAAImB,8BAA8BH,OAAM,IAAO,MAAK,EAAM,cAAc,IAAI,CAACZ,EAAG,qBAAqB,CAACgB,IAAI,kBAAkBR,YAAYZ,EAAIa,GAAG,CAAC,CAACC,IAAI,UAAUC,GAAG,SAASK,GACz9B,IAAIC,EAAeD,EAAIC,aACvB,MAAO,CAACjB,EAAG,OAAO,CAACkB,GAAG,CAAC,OAAS,SAASC,GAAgC,OAAxBA,EAAOC,iBAAwBH,EAAarB,EAAIyB,oBAAoB,CAACrB,EAAG,MAAM,CAACE,YAAY,4EAA4E,CAACF,EAAG,QAAQ,CAACK,MAAM,CAAC,IAAM,g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BACAC,0BACAC,0BACAC,8BAIiB5D,WC/I+a,I,wBCQhc6D,EAAY,eACd,EACAnH,EACAqD,GACA,EACA,KACA,WACA,MAIa,aAAA8D,E,8BCnBf,IAAIC,EAAc,EAAQ,QACtBC,EAA6B,EAAQ,QACrCC,EAAc,EAAQ,QACtBC,EAAgB,EAAQ,QAAsCA,cAI9DH,IAA8B,KAAd,KAAKhC,OAAgBmC,IACvCF,EAA2BG,EAAEC,OAAOC,UAAW,QAAS,CACtDC,cAAc,EACdC,IAAKN,K,oCCVF,IAAKO,EAsBAxC,EAtBZ,6EAAYwC,GACRA,8BACAA,oBACAA,oBACAA,kCACAA,sBACAA,gCACAA,0BAPJ,CAAYA,MAAmB,KAsB/B,SAAYxC,GACRA,6BACAA,uBACAA,iBACAA,mBAJJ,CAAYA,MAAuB,M,k0BClB5B,IAAMpB,EAAmB,iGAEnB6D,EAAmE,SAACC,EAAe,GAAoC,IAAlCC,EAAO,EAAPA,QAChG,OAAc,IAAVD,IAAiBC,GAMjB,SAAUC,EAA+B5D,GAC7CD,eAAO,iBAAkB,EAAF,GAClB8D,OAAQ,CACX7D,aAIE,SAAU8D,EAAc9D,GAC5BD,eAAO,iBAAkB,EAAF,GAClB8D,OAAQ,CACX7D,aAKE,SAAU+D,EAA+B/D,GAC7CD,eAAO,kBAAmB,EAAF,GACnBiE,OAAS,CACZhE,aAIE,SAAUiE,EAAiDjE,GAC/DD,eAAO,wCAAyC,CAC9CmE,OAAQ,CAAC,WACT/C,SAAUsC,EACVzD,c,kCCvCJ,W","file":"js/chunk-83805224.be68e3a4ed1592dde3a2.1725496708077.min.js","sourcesContent":["var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"store-policy-controls\"},[_c('div',{staticClass:\"loading-spinner\",style:({ 'visibility': _vm.showLoadingSpinner ? 'visible' : 'hidden' }),attrs:{\"uk-spinner\":\"\",\"data-testid\":\"loading-spinner\"}}),_c('div',{style:({ 'visibility': _vm.showLoadingSpinner ? 'hidden' : 'visible' }),attrs:{\"data-testid\":\"policy-form-wrapper\"}},[(_vm.fetchFailed)?[_c('div',{staticClass:\"uk-margin-bottom\",attrs:{\"data-testid\":\"fetch-failed-notification-box-wrapper\"}},[_c('NotificationBox',{attrs:{\"type\":_vm.NotificationBoxType.Danger},scopedSlots:_vm._u([{key:\"icon\",fn:function(){return [_c('i',{staticClass:\"fas fa-exclamation-circle\"})]},proxy:true},{key:\"message\",fn:function(){return [_c('span',[_vm._v(_vm._s(_vm.fetchFailedErrorMessage))])]},proxy:true}],null,false,375450187)})],1)]:[_c('ValidationObserver',{ref:\"formObserverRef\",scopedSlots:_vm._u([{key:\"default\",fn:function(ref){\nvar handleSubmit = ref.handleSubmit;\nreturn [_c('form',{on:{\"submit\":function($event){$event.preventDefault();return handleSubmit(_vm.saveStorePolicy)}}},[_c('div',{staticClass:\"uk-flex uk-flex-middle uk-flex-between uk-margin-bottom switch-container\"},[_c('label',{attrs:{\"for\":\"enabledSwitch\",\"data-testid\":\"policy-switch-label\"}},[_vm._v(\" \"+_vm._s(_vm.policySwitchLabel)+\" \")]),_c('ValidationProvider',{ref:\"enabledProviderRef\",attrs:{\"vid\":_vm.enabledProviderVid}},[_c('ToggleSwitch',{attrs:{\"id\":\"enabledSwitch\",\"value\":_vm.enabled,\"disabled\":_vm.disableSwitch},on:{\"update:value\":function($event){_vm.enabled=$event}}})],1)],1),_c('div',{style:({ 'visibility': !_vm.showLoadingSpinner && _vm.enabled ? 'visible' : 'hidden' }),attrs:{\"data-testid\":\"policy-url-controls\"}},[_c('div',{staticClass:\"form-group uk-margin-bottom\"},[_c('label',{attrs:{\"for\":\"url\",\"data-testid\":\"policy-url-label\"}},[_vm._v(\" \"+_vm._s(_vm.policyUrlLabel)),_c('span',{staticClass:\"asterisk\"},[_vm._v(\"*\")])]),_c('ValidationProvider',{ref:\"urlProviderRef\",attrs:{\"rules\":_vm.urlRules,\"mode\":_vm.getUrlValidationMode()},scopedSlots:_vm._u([{key:\"default\",fn:function(ref){\nvar errors = ref.errors;\nvar invalid = ref.invalid;\nvar validated = ref.validated;\nreturn [_c('input',{directives:[{name:\"model\",rawName:\"v-model\",value:(_vm.url),expression:\"url\"}],staticClass:\"uk-width-1\",class:{ 'outline-red': validated && invalid },attrs:{\"id\":\"url\",\"placeholder\":\"https://example.com/return-policy\",\"data-testid\":\"policy-url-input\"},domProps:{\"value\":(_vm.url)},on:{\"input\":function($event){if($event.target.composing){ return; }_vm.url=$event.target.value}}}),_c('span',{staticClass:\"form-field-error\",style:({ 'visibility': validated && invalid ? 'visible' : 'hidden' }),attrs:{\"data-testid\":\"policy-url-error\"}},[_vm._v(\" \"+_vm._s(errors[0])+\" \")])]}}],null,true)})],1),(_vm.enabled && _vm.saveFailed)?_c('div',{staticClass:\"uk-margin-bottom\",attrs:{\"data-testid\":\"save-failed-notification-box-wrapper\"}},[_c('NotificationBox',{attrs:{\"type\":_vm.NotificationBoxType.Danger},scopedSlots:_vm._u([{key:\"icon\",fn:function(){return [_c('i',{staticClass:\"fas fa-exclamation-circle\"})]},proxy:true},{key:\"message\",fn:function(){return [_c('span',[_vm._v(_vm._s(_vm.saveFailedErrorMessage))])]},proxy:true}],null,true)})],1):_vm._e(),_c('ProgressButton',{attrs:{\"apiResponseCode\":_vm.translatedLoadingToProgressButtonState,\"isValidation\":_vm.isValidForProgressButton,\"disableTransition\":!_vm.enabled,\"buttonIndex\":\"policy-url-save-button\",\"buttonText\":_vm.buttonPolicySave,\"updateProgress\":true,\"data-testid\":\"policy-save-btn\"}})],1)])]}}])})]],2)])}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nimport { ScreenText } from '@/lang/ScreenText';\nimport { Component, Ref, Vue, Watch } from 'vue-property-decorator';\nimport ToggleSwitch from '@/commoncomponents/ToggleSwitch.vue';\nimport { ValidationObserver, ValidationProvider, extend } from 'vee-validate';\nimport { urlRegex } from '@/validators/sessions/validators';\nimport { max, regex, required_if } from 'vee-validate/dist/rules';\nimport { VeeValidateProviderMode } from '@/Model/forms/types';\nimport { ProviderInstance } from 'vee-validate/dist/types/types';\nimport ProgressButton from '@/commoncomponents/progressButton/progressButton.vue';\nimport paymentsModule from '@/store/modules/Payments/module';\nimport { AddUpdateStorePolicyPayload, StorePolicy } from '@/Model/payments/types';\nimport APP_UTILITIES from '@/utilities/commonFunctions';\nimport NotificationBox from '@/commoncomponents/NotificationBox.vue';\nimport { NotificationBoxType } from '@/Model/notificationBox/types';\nimport { ToastType } from '@/Model/toastType';\n\n@Component({\n components: {\n NotificationBox,\n ProgressButton,\n ToggleSwitch,\n ValidationObserver,\n ValidationProvider\n }\n})\n\nexport default class Payments extends Vue {\n @Ref('enabledProviderRef') readonly enabledProviderRef?: ProviderInstance;\n @Ref('urlProviderRef') readonly urlProviderRef?: ProviderInstance;\n @Ref('formObserverRef') readonly formObserverRef?: InstanceType;\n\n private readonly accountId = Number(APP_UTILITIES.getCookie('accountId')) || 0;\n private readonly screenText = new ScreenText();\n readonly enabledProviderVid = 'enabledProvider';\n readonly urlMaxLength = 2083;\n readonly urlRules: Record = {\n required_if: { target: this.enabledProviderVid, values: ['true'] },\n regex: urlRegex,\n max: { length: this.urlMaxLength }\n };\n readonly NotificationBoxType = NotificationBoxType;\n\n isValidForProgressButton = true;\n\n enabled = false;\n url = '';\n\n get policySwitchLabel(): string {\n return this.screenText.getScreenText('POLICY_SWITCH_LABEL');\n }\n\n get policyUrlLabel(): string {\n return this.screenText.getScreenText('POLICY_URL_LABEL');\n }\n\n get buttonPolicySave(): string {\n return this.screenText.getScreenText('BTN_POLICY_SAVE');\n }\n\n get policySavedSuccess(): string {\n return this.screenText.getScreenText('POLICY_SAVED_SUCCESS');\n }\n\n get translatedLoadingToProgressButtonState(): number {\n let buttonState = 0;\n\n if (!paymentsModule.isSavingStorePolicy && !paymentsModule.didSaveStorePolicyFail) {\n buttonState = 200;\n }\n else if (!paymentsModule.isSavingStorePolicy && paymentsModule.didSaveStorePolicyFail) {\n buttonState = 400;\n }\n\n return buttonState;\n }\n\n get showLoadingSpinner(): boolean {\n return paymentsModule.isFetchingStorePolicy;\n }\n\n get disableSwitch(): boolean {\n return paymentsModule.isFetchingStorePolicy || paymentsModule.isSavingStorePolicy;\n }\n\n get initialValue(): StorePolicy {\n return paymentsModule.storePolicy;\n }\n\n get fetchFailed(): boolean {\n return paymentsModule.didFetchStorePolicyFail;\n }\n\n get fetchFailedErrorMessage(): string {\n return this.screenText.getScreenText('POLICY_FETCH_FAILED');\n }\n\n get saveFailed(): boolean {\n return paymentsModule.didSaveStorePolicyFail;\n }\n\n get saveFailedErrorMessage(): string {\n return this.screenText.getScreenText('POLICY_SAVED_FAILED');\n }\n\n private registerValidators() {\n extend('required_if', {\n ...required_if,\n message: this.screenText.getScreenText('POLICY_URL_ERROR')\n });\n extend('regex', {\n ...regex,\n message: this.screenText.getScreenText('POLICY_URL_ERROR')\n });\n extend('max', {\n ...max,\n message: this.screenText.getScreenText('CHAR_LIMIT_MAXIMUM').replace('{length}', `${this.urlMaxLength}`)\n });\n }\n\n created() {\n this.registerValidators();\n paymentsModule.fetchStorePolicy(this.accountId);\n }\n\n @Watch('enabled')\n onEnabledChanged(enabled: boolean) {\n if (!enabled && !this.saveFailed) {\n this.resetUrlInput().then(() => {\n this.formObserverRef && this.formObserverRef.handleSubmit(this.saveStorePolicy);\n });\n }\n }\n\n @Watch('initialValue')\n onInitialValueChanged() {\n this.resetEnabledInput();\n this.resetUrlInput();\n }\n\n private async resetEnabledInput() {\n this.enabled = this.initialValue.enabled;\n if (this.enabledProviderRef) {\n await this.enabledProviderRef.validateSilent();\n this.enabledProviderRef.reset();\n }\n }\n\n private async resetUrlInput() {\n this.url = this.initialValue.url;\n if (this.urlProviderRef) {\n await this.urlProviderRef.validateSilent();\n this.urlProviderRef.reset();\n }\n }\n\n getUrlValidationMode(): VeeValidateProviderMode {\n return this.urlProviderRef && this.urlProviderRef.flags.validated ? VeeValidateProviderMode.Eager : VeeValidateProviderMode.Passive;\n }\n\n private async canSave(): Promise {\n if (this.formObserverRef) {\n await this.formObserverRef.validate();\n }\n\n return !paymentsModule.isSavingStorePolicy\n && !!this.formObserverRef\n && this.formObserverRef.flags.valid\n && this.formObserverRef.flags.changed;\n }\n\n private async onSaveFailed() {\n // Reset enabled state if user tried to disable it (since disabling automatically saves and save button/error get hidden)\n if (!this.enabled && this.initialValue.enabled) {\n await this.resetEnabledInput();\n }\n }\n\n async saveStorePolicy() {\n if (!await this.canSave()) {\n return;\n }\n\n // We only need to update this state if the button is visible (policy = enabled)\n if (this.enabled) {\n this.isValidForProgressButton = false;\n }\n\n const payload: AddUpdateStorePolicyPayload = {\n accountId: this.accountId,\n enabled: this.enabled,\n url: this.url\n };\n\n await paymentsModule.saveStorePolicy(payload);\n\n // We only need to update this state if the button is visible (policy = enabled)\n if (this.enabled) {\n this.isValidForProgressButton = true;\n }\n\n if (!paymentsModule.didSaveStorePolicyFail) {\n APP_UTILITIES.showToastMessage(this.policySavedSuccess, ToastType.Success);\n } else {\n await this.onSaveFailed();\n }\n }\n\n}\n","import mod from \"-!../../../../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../../../../node_modules/thread-loader/dist/cjs.js!../../../../../node_modules/babel-loader/lib/index.js!../../../../../node_modules/ts-loader/index.js??ref--13-3!../../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./StorePolicyControls.vue?vue&type=script&lang=ts&\"; export default mod; export * from \"-!../../../../../node_modules/cache-loader/dist/cjs.js??ref--13-0!../../../../../node_modules/thread-loader/dist/cjs.js!../../../../../node_modules/babel-loader/lib/index.js!../../../../../node_modules/ts-loader/index.js??ref--13-3!../../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./StorePolicyControls.vue?vue&type=script&lang=ts&\"","import { render, staticRenderFns } from \"./StorePolicyControls.vue?vue&type=template&id=36b9d7e2&scoped=true&\"\nimport script from \"./StorePolicyControls.vue?vue&type=script&lang=ts&\"\nexport * from \"./StorePolicyControls.vue?vue&type=script&lang=ts&\"\nimport style0 from \"./StorePolicyControls.vue?vue&type=style&index=0&id=36b9d7e2&lang=less&scoped=true&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"36b9d7e2\",\n null\n \n)\n\nexport default component.exports","var DESCRIPTORS = require('../internals/descriptors');\nvar objectDefinePropertyModule = require('../internals/object-define-property');\nvar regExpFlags = require('../internals/regexp-flags');\nvar UNSUPPORTED_Y = require('../internals/regexp-sticky-helpers').UNSUPPORTED_Y;\n\n// `RegExp.prototype.flags` getter\n// https://tc39.github.io/ecma262/#sec-get-regexp.prototype.flags\nif (DESCRIPTORS && (/./g.flags != 'g' || UNSUPPORTED_Y)) {\n objectDefinePropertyModule.f(RegExp.prototype, 'flags', {\n configurable: true,\n get: regExpFlags\n });\n}\n","export enum FormValidationError {\n REQUIRED,\n MIN,\n MAX,\n MAX_LENGTH,\n TYPE,\n DUPLICATE,\n FORMAT\n}\n\nexport interface FormValidation {\n changes: boolean;\n dirty: boolean;\n error: FormValidationError | null;\n errorMessage: string;\n valid: boolean;\n}\n\nexport type FormFieldValidation = {\n [Property in keyof T]: FormValidation\n};\n\nexport enum VeeValidateProviderMode {\n Aggressive = 'aggressive',\n Passive = 'passive',\n Lazy = 'lazy',\n Eager = 'eager'\n}","import { extend } from 'vee-validate';\nimport { required, min_value } from 'vee-validate/dist/rules';\nimport { ValidationRuleFunction } from 'vee-validate/dist/types/types';\n\nexport const urlRegex: RegExp = /^(https?:\\/\\/)?(w{3})?[-a-z0-9@:%._+~#=]{1,256}\\.[a-z0-9()]{1,6}\\b([-a-z0-9()@:%_+.~#?&/=]*)$/i;\n\nexport const priceGreaterThanZeroWithTaxRateValidator: ValidationRuleFunction = (price: number, { taxRate }: Record) => {\n if (price === 0 && !!taxRate) {\n return false;\n }\n return true;\n};\n\nexport function registerPriceRequiredValidator(message: string) {\n extend('price_required', {\n ...required,\n message\n });\n}\n\nexport function requiredField(message: string) {\n extend('field_required', {\n ...required,\n message\n });\n}\n\n\nexport function registerPriceMinValueValidator(message: string) {\n extend('price_min_value', {\n ...min_value,\n message\n });\n}\n\nexport function registerPriceGreaterThanZeroWithTaxRateValidator(message: string) {\n extend('price_greater_than_zero_with_tax_rate', {\n params: ['taxRate'],\n validate: priceGreaterThanZeroWithTaxRateValidator,\n message\n });\n}","export * from \"-!../../../../../node_modules/mini-css-extract-plugin/dist/loader.js??ref--10-oneOf-1-0!../../../../../node_modules/css-loader/dist/cjs.js??ref--10-oneOf-1-1!../../../../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../../../../node_modules/postcss-loader/src/index.js??ref--10-oneOf-1-2!../../../../../node_modules/less-loader/dist/cjs.js??ref--10-oneOf-1-3!../../../../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../../../../node_modules/vue-loader/lib/index.js??vue-loader-options!./StorePolicyControls.vue?vue&type=style&index=0&id=36b9d7e2&lang=less&scoped=true&\""],"sourceRoot":""}