{"version":3,"sources":["webpack:///1742452116000.wg-review-form-chunk.js","webpack:///D:/AzureDevops/vsts-agent-win-x64-2.202.1_06/_work/151/s/FrontEnd/src/views/widgets/reviewForm/js/reviewForm.js"],"names":["webpackJsonpUpdateBris","321","module","exports","__webpack_require__","$","_interopRequireWildcard","obj","__esModule","newObj","key","Object","prototype","hasOwnProperty","call","default","_classCallCheck","instance","Constructor","TypeError","defineProperty","value","ReviewForm","undefined","_createClass","defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","protoProps","staticProps","_utils","utils","_api","Api","WG","$loadingSpinner","$el","this","initFormValidationConstraints","This","$form","find","formValidation","form","submitForm","$wg","$error","$success","$submitBtn","addClass","reset","submitCall","then","resp","result","message","html","modal","attr","prop","writeBtn","document","querySelector","removeAttr","animate","scrollTop","removeClass","catch","error","endpoint","data","fields","serializeArray","field","productCode","callApi","Promise","reject"],"mappings":";AAAAA,wBAAwB,KAElBC,IACA,SAAUC,EAAQC,EAASC,GAEjC,cAC4B,SAASC,GAiBrC,QAASC,GAAwBC,GAAO,GAAIA,GAAOA,EAAIC,WAAc,MAAOD,EAAc,IAAIE,KAAa,IAAW,MAAPF,EAAe,IAAK,GAAIG,KAAOH,GAAWI,OAAOC,UAAUC,eAAeC,KAAKP,EAAKG,KAAMD,EAAOC,GAAOH,EAAIG,GAAgC,OAAtBD,GAAOM,QAAUR,EAAYE,EAElQ,QAASO,GAAgBC,EAAUC,GAAe,KAAMD,YAAoBC,IAAgB,KAAM,IAAIC,WAAU,qCAjBhHR,OAAOS,eAAejB,EAAS,cAC9BkB,OAAO,IAERlB,EAAQmB,eAAaC,EAErB,IAAIC,GAAe,WAAc,QAASC,GAAiBC,EAAQC,GAAS,IAAK,GAAIC,GAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CAAE,GAAIE,GAAaH,EAAMC,EAAIE,GAAWC,WAAaD,EAAWC,aAAc,EAAOD,EAAWE,cAAe,EAAU,SAAWF,KAAYA,EAAWG,UAAW,GAAMtB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ACTO,KAAK,sBACLO,WAAW,mBAGdjB,GAAOG,SA9DQ,aA8DaO,KAAKH,EAAKE,QAGvCV,GAAImB,SAASC,UAAW,GAAI,KAE5B9B,EAAgB+B,YAnEA,eAqEhBC,MAAM,SAASC,GACftB,EAAOG,SAtES,aAsEYO,KAAKY,GACjCjC,EAAgB+B,YAvEA,aAyEhBrB,EAAImB,SAASC,UAAW,GAAI,UD+B7B7D,IAAK,aACLW,MAAO,WC3BP,GAAM8B,GAAM9C,EAAEsC,KAAKD,KACbI,EAAQK,EAAIJ,KAAK,QACnB4B,EAAWxB,EAAIyB,KAAK,qBACpBC,EAAS/B,EAAMgC,iBACfF,IAEJ,KAAK,GAAIlE,KAAOmE,GAEf,GAAIA,EAAQ,CACX,GAAIE,GAAQF,EAAOnE,EACnBkE,GAAKG,EAAA,MAAiBA,EAAA,OAAkB,GAM1C,MAFAH,GAAKI,YAAc3E,EAAE8D,UAAUpB,KAAK,oBAAoB6B,KAAK,aAAe,GAEvEA,EAAKI,aAAmC,IAApBJ,EAAKI,YAEvBzC,EAAI0C,QAAQN,EAAUC,GAF2BM,QAAQC,OAAO,0EDiCvEzE,IAAK,QACLW,MAAO,WC5BP,GAAM8B,GAAM9C,EAAEsC,KAAKD,KAEfU,GADQD,EAAIJ,KAAK,QACRI,EAAIJ,KAAQP,EAAZ,UACTa,EAAWF,EAAIJ,KAAQP,EAAZ,WACXc,EAAaH,EAAIJ,KAAQP,EAAZ,YAGjBY,GAAOoB,YA3GU,aA2GcV,KAAK,IACpCT,EAASmB,YA5GQ,aA4GgBV,KAAK,IACtCR,EAAWkB,YA3GI,UA2GkBR,KAAK,YAAY,ODoC5C1C,OAEqBR,KAAKX,EAASC,EAAoB","file":"1742452116000.wg-review-form-chunk.js","sourcesContent":["webpackJsonpUpdateBris([59],{\n\n/***/ 321:\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function($) {\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports.ReviewForm = undefined;\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _utils = __webpack_require__(4);\n\nvar utils = _interopRequireWildcard(_utils);\n\nvar _api = __webpack_require__(144);\n\nvar Api = _interopRequireWildcard(_api);\n\nfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n// CONSTANTS are all caps.\nvar NS = 'ReviewForm';\nvar CLS = 'reviewForm';\nvar WG = '.' + CLS + '-';\nvar $loadingSpinner = $('.loading-spinner');\nvar CLS_ACTIVE = 'is-active';\nvar CLS_DISABLED = 'disabled';\nvar CLS_HIDE = 'd-none';\n\n// Import stuff here if you need to or even better to import them dynamically\n// for ex. of dynamic import check out src/scripts/loadWg/reviewForm.js using Webpack dynamic imports as chunks.\n// import $ from 'jquery'\n\nvar ReviewForm = exports.ReviewForm = function () {\n\tfunction ReviewForm($el) {\n\t\t_classCallCheck(this, ReviewForm);\n\n\t\t// $el is the widget node return by the loadReviewForm function\n\t\tthis.$el = $el;\n\t}\n\n\t_createClass(ReviewForm, [{\n\t\tkey: 'init',\n\t\tvalue: function init() {\n\t\t\tthis.initFormValidationConstraints();\n\t\t}\n\t}, {\n\t\tkey: 'initFormValidationConstraints',\n\t\tvalue: function initFormValidationConstraints() {\n\t\t\tvar This = this;\n\t\t\tvar $form = $(this.$el).find('form')[0];\n\t\t\tutils.formValidation($form, This);\n\t\t}\n\t}, {\n\t\tkey: 'formSuccessCallback',\n\t\tvalue: function formSuccessCallback(form) {\n\t\t\tthis.submitForm();\n\t\t}\n\t}, {\n\t\tkey: 'submitForm',\n\t\tvalue: function submitForm() {\n\t\t\tvar This = this;\n\t\t\tvar $wg = $(this.$el);\n\t\t\tvar $form = $wg.find('form');\n\t\t\tvar $error = $wg.find(WG + 'error');\n\t\t\tvar $success = $wg.find(WG + 'success');\n\t\t\tvar $submitBtn = $wg.find(WG + 'submitBtn');\n\n\t\t\t$loadingSpinner.addClass(CLS_ACTIVE);\n\t\t\tThis.reset();\n\n\t\t\tThis.submitCall().then(function (resp) {\n\t\t\t\tif (resp.result === 'SUCCESS') {\n\t\t\t\t\tif (resp.message) {\n\t\t\t\t\t\t$success.addClass(CLS_ACTIVE).html(resp.message);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$wg.modal('hide');\n\t\t\t\t\t}\n\n\t\t\t\t\t$submitBtn.attr('disabled', true).addClass(CLS_HIDE);\n\n\t\t\t\t\t$form.find('input, textarea').prop('disabled', true);\n\n\t\t\t\t\tvar writeBtn = document.querySelector(WG + 'writeBtn');\n\t\t\t\t\tif (writeBtn) {\n\t\t\t\t\t\t$(writeBtn).addClass('has-added').html('Pending moderation').removeAttr('data-toggle');\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t$error.addClass(CLS_ACTIVE).html(resp.message);\n\t\t\t\t}\n\n\t\t\t\t$wg.animate({ scrollTop: 0 }, 500);\n\n\t\t\t\t$loadingSpinner.removeClass(CLS_ACTIVE);\n\t\t\t}).catch(function (error) {\n\t\t\t\t$error.addClass(CLS_ACTIVE).html(error);\n\t\t\t\t$loadingSpinner.removeClass(CLS_ACTIVE);\n\n\t\t\t\t$wg.animate({ scrollTop: 0 }, 500);\n\t\t\t});\n\t\t}\n\t}, {\n\t\tkey: 'submitCall',\n\t\tvalue: function submitCall() {\n\t\t\tvar $wg = $(this.$el);\n\t\t\tvar $form = $wg.find('form');\n\t\t\tvar endpoint = $wg.data('addReviewEndpoint');\n\t\t\tvar fields = $form.serializeArray();\n\t\t\tvar data = {};\n\n\t\t\tfor (var key in fields) {\n\t\t\t\t// just putting an if here to remove lint errors\n\t\t\t\tif (fields) {\n\t\t\t\t\tvar field = fields[key];\n\t\t\t\t\tdata[field['name']] = field['value'] || '';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tdata.productCode = $(document).find('[data-item-code]').data('itemCode') || '';\n\n\t\t\tif (!data.productCode || data.productCode == '') return Promise.reject('There was a problem submitting this review. Please try again later.');\n\n\t\t\treturn Api.callApi(endpoint, data);\n\t\t}\n\t}, {\n\t\tkey: 'reset',\n\t\tvalue: function reset() {\n\t\t\tvar $wg = $(this.$el);\n\t\t\tvar $form = $wg.find('form');\n\t\t\tvar $error = $wg.find(WG + 'error');\n\t\t\tvar $success = $wg.find(WG + 'success');\n\t\t\tvar $submitBtn = $wg.find(WG + 'submitBtn');\n\n\t\t\t// $form.trigger('reset');\n\t\t\t$error.removeClass(CLS_ACTIVE).html('');\n\t\t\t$success.removeClass(CLS_ACTIVE).html('');\n\t\t\t$submitBtn.removeClass(CLS_HIDE).attr('disabled', false);\n\t\t}\n\n\t\t// Add more functions like on above here\n\n\t}]);\n\n\treturn ReviewForm;\n}();\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ })\n\n});\n\n\n// WEBPACK FOOTER //\n// 1742452116000.wg-review-form-chunk.js","// CONSTANTS are all caps.\nconst NS = 'ReviewForm';\nconst CLS = 'reviewForm';\nconst WG = '.' + CLS + '-';\nconst $loadingSpinner = $('.loading-spinner');\nconst CLS_ACTIVE = 'is-active';\nconst CLS_DISABLED = 'disabled';\nconst CLS_HIDE = 'd-none';\n\n// Import stuff here if you need to or even better to import them dynamically\n// for ex. of dynamic import check out src/scripts/loadWg/reviewForm.js using Webpack dynamic imports as chunks.\n// import $ from 'jquery'\n\nimport * as utils from '../../../../global/js/utils';\nimport * as Api from '../../../../global/js/api';\n\nexport class ReviewForm {\n\tconstructor($el) {\n\t\t// $el is the widget node return by the loadReviewForm function\n\t\tthis.$el = $el;\n\t}\n\n\tinit() {\n\t\tthis.initFormValidationConstraints();\n\t}\n\n\tinitFormValidationConstraints() {\n\t\tconst This = this;\n\t\tlet $form = $(this.$el).find('form')[0];\n\t\tutils.formValidation($form, This);\n\t}\n\n\tformSuccessCallback(form) {\n\t\tthis.submitForm();\n\t}\n\n\tsubmitForm() {\n\t\tconst This = this;\n\t\tconst $wg = $(this.$el);\n\t\tlet $form = $wg.find('form');\n\t\tlet $error = $wg.find(`${WG}error`);\n\t\tlet $success = $wg.find(`${WG}success`);\n\t\tlet $submitBtn = $wg.find(`${WG}submitBtn`);\n\n\t\t$loadingSpinner.addClass(CLS_ACTIVE);\n\t\tThis.reset();\n\n\t\tThis.submitCall().then(function(resp) {\n\t\t\tif (resp.result === 'SUCCESS') {\n\t\t\t\tif (resp.message) {\n\t\t\t\t\t$success.addClass(CLS_ACTIVE).html(resp.message);\n\t\t\t\t} else {\n\t\t\t\t\t$wg.modal('hide');\n\t\t\t\t}\n\n\t\t\t\t$submitBtn.attr('disabled', true).addClass(CLS_HIDE);\n\n\t\t\t\t$form.find('input, textarea').prop('disabled', true);\n\n\t\t\t\tlet writeBtn = document.querySelector(`${WG}writeBtn`);\n\t\t\t\tif (writeBtn) {\n\t\t\t\t\t$(writeBtn)\n\t\t\t\t\t\t.addClass('has-added')\n\t\t\t\t\t\t.html('Pending moderation')\n\t\t\t\t\t\t.removeAttr('data-toggle');\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t$error.addClass(CLS_ACTIVE).html(resp.message);\n\t\t\t}\n\n\t\t\t$wg.animate({scrollTop: 0}, 500);\n\n\t\t\t$loadingSpinner.removeClass(CLS_ACTIVE);\n\t\t})\n\t\t.catch(function(error) {\n\t\t\t$error.addClass(CLS_ACTIVE).html(error);\n\t\t\t$loadingSpinner.removeClass(CLS_ACTIVE);\n\n\t\t\t$wg.animate({scrollTop: 0}, 500);\n\t\t});\n\t}\n\n\tsubmitCall() {\n\t\tconst $wg = $(this.$el);\n\t\tconst $form = $wg.find('form');\n\t\tlet endpoint = $wg.data('addReviewEndpoint');\n\t\tlet fields = $form.serializeArray();\n\t\tlet data = {};\n\n\t\tfor (let key in fields) {\n\t\t\t// just putting an if here to remove lint errors\n\t\t\tif (fields) {\n\t\t\t\tlet field = fields[key];\n\t\t\t\tdata[field['name']] = field['value'] || '';\n\t\t\t}\n\t\t}\n\n\t\tdata.productCode = $(document).find('[data-item-code]').data('itemCode') || '';\n\n\t\tif (!data.productCode || data.productCode == '') return Promise.reject('There was a problem submitting this review. Please try again later.');\n\n\t\treturn Api.callApi(endpoint, data);\n\t}\n\n\treset() {\n\t\tconst $wg = $(this.$el);\n\t\tlet $form = $wg.find('form');\n\t\tlet $error = $wg.find(`${WG}error`);\n\t\tlet $success = $wg.find(`${WG}success`);\n\t\tlet $submitBtn = $wg.find(`${WG}submitBtn`);\n\n\t\t// $form.trigger('reset');\n\t\t$error.removeClass(CLS_ACTIVE).html('');\n\t\t$success.removeClass(CLS_ACTIVE).html('');\n\t\t$submitBtn.removeClass(CLS_HIDE).attr('disabled', false);\n\t}\n\n\t// Add more functions like on above here\n}\n\n\n\n// WEBPACK FOOTER //\n// D:/AzureDevops/vsts-agent-win-x64-2.202.1_06/_work/151/s/FrontEnd/src/views/widgets/reviewForm/js/reviewForm.js"],"sourceRoot":""}