@vendure/admin-ui-plugin 2.0.0-next.4 → 2.0.0-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/admin-ui/239.68785500c3346bfc.js +2 -0
- package/lib/admin-ui/239.68785500c3346bfc.js.map +1 -0
- package/lib/admin-ui/26.f714c21768111b4f.js +2 -0
- package/lib/admin-ui/{26.477d6446134d960e.js.map → 26.f714c21768111b4f.js.map} +1 -1
- package/lib/admin-ui/316.f5c3548835a302f3.js +2 -0
- package/lib/admin-ui/{316.07f9c805e4c95dc8.js.map → 316.f5c3548835a302f3.js.map} +1 -1
- package/lib/admin-ui/356.1033de258e918a70.js +2 -0
- package/lib/admin-ui/{356.3a6951fe80b5a001.js.map → 356.1033de258e918a70.js.map} +1 -1
- package/lib/admin-ui/504.3098353022d84cc3.js +2 -0
- package/lib/admin-ui/504.3098353022d84cc3.js.map +1 -0
- package/lib/admin-ui/600.e304581e252828a2.js +2 -0
- package/lib/admin-ui/{600.8f0165a8d1255cd0.js.map → 600.e304581e252828a2.js.map} +1 -1
- package/lib/admin-ui/625.01c97949f67d7dbf.js +2 -0
- package/lib/admin-ui/{625.adebc6a7222bde82.js.map → 625.01c97949f67d7dbf.js.map} +1 -1
- package/lib/admin-ui/849.6af354bbc8b876dc.js +2 -0
- package/lib/admin-ui/{849.e407e92bd9a7f25a.js.map → 849.6af354bbc8b876dc.js.map} +1 -1
- package/lib/admin-ui/i18n-messages/cs.json +8 -0
- package/lib/admin-ui/i18n-messages/de.json +8 -0
- package/lib/admin-ui/i18n-messages/en.json +8 -0
- package/lib/admin-ui/i18n-messages/es.json +8 -0
- package/lib/admin-ui/i18n-messages/fr.json +8 -0
- package/lib/admin-ui/i18n-messages/it.json +8 -0
- package/lib/admin-ui/i18n-messages/pl.json +8 -0
- package/lib/admin-ui/i18n-messages/pt_BR.json +8 -0
- package/lib/admin-ui/i18n-messages/pt_PT.json +8 -0
- package/lib/admin-ui/i18n-messages/ru.json +8 -0
- package/lib/admin-ui/i18n-messages/uk.json +8 -0
- package/lib/admin-ui/i18n-messages/zh_Hans.json +8 -0
- package/lib/admin-ui/i18n-messages/zh_Hant.json +8 -0
- package/lib/admin-ui/index.html +1 -1
- package/lib/admin-ui/main.0d861a880b32646d.js +2757 -0
- package/lib/admin-ui/main.0d861a880b32646d.js.map +1 -0
- package/lib/admin-ui/{runtime.fd9e61c13b055601.js → runtime.6864d94d589dbb0c.js} +2 -2
- package/lib/admin-ui/{runtime.fd9e61c13b055601.js.map → runtime.6864d94d589dbb0c.js.map} +1 -1
- package/package.json +4 -4
- package/lib/admin-ui/239.a68e402e10b798f1.js +0 -2
- package/lib/admin-ui/239.a68e402e10b798f1.js.map +0 -1
- package/lib/admin-ui/26.477d6446134d960e.js +0 -2
- package/lib/admin-ui/316.07f9c805e4c95dc8.js +0 -2
- package/lib/admin-ui/349.bf78d0411766ae60.js +0 -2
- package/lib/admin-ui/349.bf78d0411766ae60.js.map +0 -1
- package/lib/admin-ui/356.3a6951fe80b5a001.js +0 -2
- package/lib/admin-ui/600.8f0165a8d1255cd0.js +0 -2
- package/lib/admin-ui/625.adebc6a7222bde82.js +0 -2
- package/lib/admin-ui/849.e407e92bd9a7f25a.js +0 -2
- package/lib/admin-ui/main.4fea565739b4142c.js +0 -2757
- package/lib/admin-ui/main.4fea565739b4142c.js.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(()=>{"use strict";var e,v={},m={};function r(e){var n=m[e];if(void 0!==n)return n.exports;var t=m[e]={id:e,loaded:!1,exports:{}};return v[e].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}r.m=v,e=[],r.O=(n,t,f,d)=>{if(!t){var a=1/0;for(i=0;i<e.length;i++){for(var[t,f,d]=e[i],
|
|
2
|
-
//# sourceMappingURL=runtime.
|
|
1
|
+
(()=>{"use strict";var e,v={},m={};function r(e){var n=m[e];if(void 0!==n)return n.exports;var t=m[e]={id:e,loaded:!1,exports:{}};return v[e].call(t.exports,t,t.exports,r),t.loaded=!0,t.exports}r.m=v,e=[],r.O=(n,t,f,d)=>{if(!t){var a=1/0;for(i=0;i<e.length;i++){for(var[t,f,d]=e[i],l=!0,o=0;o<t.length;o++)(!1&d||a>=d)&&Object.keys(r.O).every(p=>r.O[p](t[o]))?t.splice(o--,1):(l=!1,d<a&&(a=d));if(l){e.splice(i--,1);var c=f();void 0!==c&&(n=c)}}return n}d=d||0;for(var i=e.length;i>0&&e[i-1][2]>d;i--)e[i]=e[i-1];e[i]=[t,f,d]},r.n=e=>{var n=e&&e.__esModule?()=>e.default:()=>e;return r.d(n,{a:n}),n},r.d=(e,n)=>{for(var t in n)r.o(n,t)&&!r.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce((n,t)=>(r.f[t](e,n),n),[])),r.u=e=>(592===e?"common":e)+"."+{26:"f714c21768111b4f",165:"6aeb6ecf722558ee",239:"68785500c3346bfc",316:"f5c3548835a302f3",356:"1033de258e918a70",504:"3098353022d84cc3",592:"8d822adf80a60465",600:"e304581e252828a2",625:"01c97949f67d7dbf",849:"6af354bbc8b876dc"}[e]+".js",r.miniCssF=e=>{},r.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),(()=>{var e={},n="vendure-admin:";r.l=(t,f,d,i)=>{if(e[t])e[t].push(f);else{var a,l;if(void 0!==d)for(var o=document.getElementsByTagName("script"),c=0;c<o.length;c++){var u=o[c];if(u.getAttribute("src")==t||u.getAttribute("data-webpack")==n+d){a=u;break}}a||(l=!0,(a=document.createElement("script")).type="module",a.charset="utf-8",a.timeout=120,r.nc&&a.setAttribute("nonce",r.nc),a.setAttribute("data-webpack",n+d),a.src=r.tu(t)),e[t]=[f];var s=(g,p)=>{a.onerror=a.onload=null,clearTimeout(b);var _=e[t];if(delete e[t],a.parentNode&&a.parentNode.removeChild(a),_&&_.forEach(h=>h(p)),g)return g(p)},b=setTimeout(s.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=s.bind(null,a.onerror),a.onload=s.bind(null,a.onload),l&&document.head.appendChild(a)}}})(),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),(()=>{var e;r.tt=()=>(void 0===e&&(e={createScriptURL:n=>n},"undefined"!=typeof trustedTypes&&trustedTypes.createPolicy&&(e=trustedTypes.createPolicy("angular#bundler",e))),e)})(),r.tu=e=>r.tt().createScriptURL(e),r.p="",(()=>{var e={666:0};r.f.j=(f,d)=>{var i=r.o(e,f)?e[f]:void 0;if(0!==i)if(i)d.push(i[2]);else if(666!=f){var a=new Promise((u,s)=>i=e[f]=[u,s]);d.push(i[2]=a);var l=r.p+r.u(f),o=new Error;r.l(l,u=>{if(r.o(e,f)&&(0!==(i=e[f])&&(e[f]=void 0),i)){var s=u&&("load"===u.type?"missing":u.type),b=u&&u.target&&u.target.src;o.message="Loading chunk "+f+" failed.\n("+s+": "+b+")",o.name="ChunkLoadError",o.type=s,o.request=b,i[1](o)}},"chunk-"+f,f)}else e[f]=0},r.O.j=f=>0===e[f];var n=(f,d)=>{var o,c,[i,a,l]=d,u=0;if(i.some(b=>0!==e[b])){for(o in a)r.o(a,o)&&(r.m[o]=a[o]);if(l)var s=l(r)}for(f&&f(d);u<i.length;u++)c=i[u],r.o(e,c)&&e[c]&&e[c][0](),e[c]=0;return r.O(s)},t=self.webpackChunkvendure_admin=self.webpackChunkvendure_admin||[];t.forEach(n.bind(null,0)),t.push=n.bind(null,t.push.bind(t))})()})();
|
|
2
|
+
//# sourceMappingURL=runtime.6864d94d589dbb0c.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"mappings":"uBAAAA,OCCAC,KAGA,cAEA,WACA,cACA,iBAGA,YACAC,KACAC,UACAC,YAIA,0CAGAC,YAGAA,UAIAC,MD5BAN,KACAM,gBACA,OAOA,IADAC,MACA,QAAiBC,WAAqBA,KAGtC,QAFAH,YACAI,KACAC,IAAkBA,WAAqBA,MACvC,oDACAL,iBAEAI,KACAE,YAGA,MACAX,gBACA,eACA,cAGA,SAvBAW,OACA,mBAA+BH,iBAAwCA,gBACvER,cEJAM,QACA,sBACA,cACA,MACA,cAAiCC,MACjCK,GCLAN,YACA,eACAA,qBACAO,2BAAyCC,0BCJzCR,OAGAA,OACAS,4CACAT,YACAM,GACE,KCNFN,QAEA,yBAA6D,sOAAyPN,SCFtTM,iBCDAA,2DCAA,SACAM,mBAEAN,gBACA,QAAuBN,iBAAvB,CACA,QACA,cAEA,QADAU,0CACAM,IAAiBA,WAAoBA,KACrC,WACA,kEAAmGT,IAAY,OAG/GA,IACAE,MACAF,oCACAU,cACAV,kBACAA,cACAD,MACAC,6BAEAA,mCACAA,eAEAP,SACA,cAEAO,wBACAW,gBACA,WAIA,UAHAlB,KACAO,0CACAY,sBACAC,eAGAC,iCAAmEJ,0BAAiC,MACpGV,iCACAA,+BACAE,sCCvCAH,QACA,gDACAO,4CAAuDS,iBAEvDT,sCAAgDS,YCLhDhB,UACAN,WACAA,4BACAA,SCHA,MACAM,eAEA,QACAN,GACAuB,sBAEA,8DACAvB,mDAGAA,OCXAM,kCCAAA,aCKA,OACA,OAGAA,cAEA,2BACA,SAGA,KACAK,qBAEA,QAEA,uCACAA,eAGA,iBAEAD,YAgBAJ,MAfAkB,IACA,cAEA,KADAhB,UACAR,aACAQ,IACA,4CACAa,4BACAX,wDACAA,wBACAA,SACAA,YACAF,UAIA,mBACMR,QAaNM,kBAGA,cACA,IAGAI,KAHAF,SAGAgB,IACA,wBACA,WACAlB,WACAA,aAGA,gBAGA,IADAmB,QACMD,WAAqBA,IAC3BR,OACAV,gBACAN,UAEAA,OAEA,eAGAK,oEACAA,0BACAA","names":["e","m","id","loaded","exports","t","r","a","i","c","o","d","n","Object","enumerable","Promise","l","type","clearTimeout","_","g","p","value","createScriptURL","u","f"],"sources":["webpack/runtime/chunk loaded","webpack/bootstrap","webpack/runtime/compat get default export","webpack/runtime/define property getters","webpack/runtime/ensure chunk","webpack/runtime/get javascript chunk filename","webpack/runtime/get mini-css chunk filename","webpack/runtime/hasOwnProperty shorthand","webpack/runtime/load script","webpack/runtime/make namespace object","webpack/runtime/node module decorator","webpack/runtime/trusted types policy","webpack/runtime/trusted types script url","webpack/runtime/publicPath","webpack/runtime/jsonp chunk loading"],"sourcesContent":["var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar [chunkIds, fn, priority] = deferred[i];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\tloaded: false,\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Flag the module as loaded\n\tmodule.loaded = true;\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = (chunkId) => {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn \"\" + (chunkId === 592 ? \"common\" : chunkId) + \".\" + {\"26\":\"477d6446134d960e\",\"165\":\"6aeb6ecf722558ee\",\"239\":\"a68e402e10b798f1\",\"316\":\"07f9c805e4c95dc8\",\"349\":\"bf78d0411766ae60\",\"356\":\"3a6951fe80b5a001\",\"592\":\"8d822adf80a60465\",\"600\":\"8f0165a8d1255cd0\",\"625\":\"adebc6a7222bde82\",\"849\":\"e407e92bd9a7f25a\"}[chunkId] + \".js\";\n};","// This function allow to reference async chunks\n__webpack_require__.miniCssF = (chunkId) => {\n\t// return url for filenames based on template\n\treturn undefined;\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","var inProgress = {};\nvar dataWebpackPrefix = \"vendure-admin:\";\n// loadScript function to load a script via script tag\n__webpack_require__.l = (url, done, key, chunkId) => {\n\tif(inProgress[url]) { inProgress[url].push(done); return; }\n\tvar script, needAttach;\n\tif(key !== undefined) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tfor(var i = 0; i < scripts.length; i++) {\n\t\t\tvar s = scripts[i];\n\t\t\tif(s.getAttribute(\"src\") == url || s.getAttribute(\"data-webpack\") == dataWebpackPrefix + key) { script = s; break; }\n\t\t}\n\t}\n\tif(!script) {\n\t\tneedAttach = true;\n\t\tscript = document.createElement('script');\n\t\tscript.type = \"module\";\n\t\tscript.charset = 'utf-8';\n\t\tscript.timeout = 120;\n\t\tif (__webpack_require__.nc) {\n\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n\t\t}\n\t\tscript.setAttribute(\"data-webpack\", dataWebpackPrefix + key);\n\t\tscript.src = __webpack_require__.tu(url);\n\t}\n\tinProgress[url] = [done];\n\tvar onScriptComplete = (prev, event) => {\n\t\t// avoid mem leaks in IE.\n\t\tscript.onerror = script.onload = null;\n\t\tclearTimeout(timeout);\n\t\tvar doneFns = inProgress[url];\n\t\tdelete inProgress[url];\n\t\tscript.parentNode && script.parentNode.removeChild(script);\n\t\tdoneFns && doneFns.forEach((fn) => (fn(event)));\n\t\tif(prev) return prev(event);\n\t}\n\t;\n\tvar timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);\n\tscript.onerror = onScriptComplete.bind(null, script.onerror);\n\tscript.onload = onScriptComplete.bind(null, script.onload);\n\tneedAttach && document.head.appendChild(script);\n};","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.nmd = (module) => {\n\tmodule.paths = [];\n\tif (!module.children) module.children = [];\n\treturn module;\n};","var policy;\n__webpack_require__.tt = () => {\n\t// Create Trusted Type policy if Trusted Types are available and the policy doesn't exist yet.\n\tif (policy === undefined) {\n\t\tpolicy = {\n\t\t\tcreateScriptURL: (url) => (url)\n\t\t};\n\t\tif (typeof trustedTypes !== \"undefined\" && trustedTypes.createPolicy) {\n\t\t\tpolicy = trustedTypes.createPolicy(\"angular#bundler\", policy);\n\t\t}\n\t}\n\treturn policy;\n};","__webpack_require__.tu = (url) => (__webpack_require__.tt().createScriptURL(url));","__webpack_require__.p = \"\";","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t666: 0\n};\n\n__webpack_require__.f.j = (chunkId, promises) => {\n\t\t// JSONP chunk loading for javascript\n\t\tvar installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;\n\t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n\t\t\t// a Promise means \"currently loading\".\n\t\t\tif(installedChunkData) {\n\t\t\t\tpromises.push(installedChunkData[2]);\n\t\t\t} else {\n\t\t\t\tif(666 != chunkId) {\n\t\t\t\t\t// setup Promise in chunk cache\n\t\t\t\t\tvar promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));\n\t\t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n\t\t\t\t\t// start chunk loading\n\t\t\t\t\tvar url = __webpack_require__.p + __webpack_require__.u(chunkId);\n\t\t\t\t\t// create error before stack unwound to get useful stacktrace later\n\t\t\t\t\tvar error = new Error();\n\t\t\t\t\tvar loadingEnded = (event) => {\n\t\t\t\t\t\tif(__webpack_require__.o(installedChunks, chunkId)) {\n\t\t\t\t\t\t\tinstalledChunkData = installedChunks[chunkId];\n\t\t\t\t\t\t\tif(installedChunkData !== 0) installedChunks[chunkId] = undefined;\n\t\t\t\t\t\t\tif(installedChunkData) {\n\t\t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n\t\t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n\t\t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n\t\t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n\t\t\t\t\t\t\t\terror.type = errorType;\n\t\t\t\t\t\t\t\terror.request = realSrc;\n\t\t\t\t\t\t\t\tinstalledChunkData[1](error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\t__webpack_require__.l(url, loadingEnded, \"chunk-\" + chunkId, chunkId);\n\t\t\t\t} else installedChunks[chunkId] = 0;\n\t\t\t}\n\t\t}\n};\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkvendure_admin\"] = self[\"webpackChunkvendure_admin\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));"],"sourceRoot":"webpack:///","file":"runtime.fd9e61c13b055601.js"}
|
|
1
|
+
{"version":3,"mappings":"uBAAAA,OCCAC,KAGA,cAEA,WACA,cACA,iBAGA,YACAC,KACAC,UACAC,YAIA,0CAGAC,YAGAA,UAIAC,MD5BAN,KACAM,gBACA,OAOA,IADAC,MACA,QAAiBC,WAAqBA,KAGtC,QAFAH,YACAI,KACAC,IAAkBA,WAAqBA,MACvC,oDACAL,iBAEAI,KACAE,YAGA,MACAX,gBACA,eACA,cAGA,SAvBAW,OACA,mBAA+BH,iBAAwCA,gBACvER,cEJAM,QACA,sBACA,cACA,MACA,cAAiCC,MACjCK,GCLAN,YACA,eACAA,qBACAO,2BAAyCC,0BCJzCR,OAGAA,OACAS,4CACAT,YACAM,GACE,KCNFN,QAEA,yBAA6D,sOAAyPN,SCFtTM,iBCDAA,2DCAA,SACAM,mBAEAN,gBACA,QAAuBN,iBAAvB,CACA,QACA,cAEA,QADAU,0CACAM,IAAiBA,WAAoBA,KACrC,WACA,kEAAmGT,IAAY,OAG/GA,IACAE,MACAF,oCACAU,cACAV,kBACAA,cACAD,MACAC,6BAEAA,mCACAA,eAEAP,SACA,cAEAO,wBACAW,gBACA,WAIA,UAHAlB,KACAO,0CACAY,sBACAC,eAGAC,iCAAmEJ,0BAAiC,MACpGV,iCACAA,+BACAE,sCCvCAH,QACA,gDACAO,4CAAuDS,iBAEvDT,sCAAgDS,YCLhDhB,UACAN,WACAA,4BACAA,SCHA,MACAM,eAEA,QACAN,GACAuB,sBAEA,8DACAvB,mDAGAA,OCXAM,kCCAAA,aCKA,OACA,OAGAA,cAEA,2BACA,SAGA,KACAK,qBAEA,QAEA,uCACAA,eAGA,iBAEAD,YAgBAJ,MAfAkB,IACA,cAEA,KADAhB,UACAR,aACAQ,IACA,4CACAa,4BACAX,wDACAA,wBACAA,SACAA,YACAF,UAIA,mBACMR,QAaNM,kBAGA,cACA,IAGAI,KAHAF,SAGAgB,IACA,wBACA,WACAlB,WACAA,aAGA,gBAGA,IADAmB,QACMD,WAAqBA,IAC3BR,OACAV,gBACAN,UAEAA,OAEA,eAGAK,oEACAA,0BACAA","names":["e","m","id","loaded","exports","t","r","a","i","l","o","d","n","Object","enumerable","Promise","c","type","clearTimeout","_","g","b","value","createScriptURL","u","f"],"sources":["webpack/runtime/chunk loaded","webpack/bootstrap","webpack/runtime/compat get default export","webpack/runtime/define property getters","webpack/runtime/ensure chunk","webpack/runtime/get javascript chunk filename","webpack/runtime/get mini-css chunk filename","webpack/runtime/hasOwnProperty shorthand","webpack/runtime/load script","webpack/runtime/make namespace object","webpack/runtime/node module decorator","webpack/runtime/trusted types policy","webpack/runtime/trusted types script url","webpack/runtime/publicPath","webpack/runtime/jsonp chunk loading"],"sourcesContent":["var deferred = [];\n__webpack_require__.O = (result, chunkIds, fn, priority) => {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar [chunkIds, fn, priority] = deferred[i];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\tloaded: false,\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Flag the module as loaded\n\tmodule.loaded = true;\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = (chunkId) => {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks\n__webpack_require__.u = (chunkId) => {\n\t// return url for filenames based on template\n\treturn \"\" + (chunkId === 592 ? \"common\" : chunkId) + \".\" + {\"26\":\"f714c21768111b4f\",\"165\":\"6aeb6ecf722558ee\",\"239\":\"68785500c3346bfc\",\"316\":\"f5c3548835a302f3\",\"356\":\"1033de258e918a70\",\"504\":\"3098353022d84cc3\",\"592\":\"8d822adf80a60465\",\"600\":\"e304581e252828a2\",\"625\":\"01c97949f67d7dbf\",\"849\":\"6af354bbc8b876dc\"}[chunkId] + \".js\";\n};","// This function allow to reference async chunks\n__webpack_require__.miniCssF = (chunkId) => {\n\t// return url for filenames based on template\n\treturn undefined;\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","var inProgress = {};\nvar dataWebpackPrefix = \"vendure-admin:\";\n// loadScript function to load a script via script tag\n__webpack_require__.l = (url, done, key, chunkId) => {\n\tif(inProgress[url]) { inProgress[url].push(done); return; }\n\tvar script, needAttach;\n\tif(key !== undefined) {\n\t\tvar scripts = document.getElementsByTagName(\"script\");\n\t\tfor(var i = 0; i < scripts.length; i++) {\n\t\t\tvar s = scripts[i];\n\t\t\tif(s.getAttribute(\"src\") == url || s.getAttribute(\"data-webpack\") == dataWebpackPrefix + key) { script = s; break; }\n\t\t}\n\t}\n\tif(!script) {\n\t\tneedAttach = true;\n\t\tscript = document.createElement('script');\n\t\tscript.type = \"module\";\n\t\tscript.charset = 'utf-8';\n\t\tscript.timeout = 120;\n\t\tif (__webpack_require__.nc) {\n\t\t\tscript.setAttribute(\"nonce\", __webpack_require__.nc);\n\t\t}\n\t\tscript.setAttribute(\"data-webpack\", dataWebpackPrefix + key);\n\t\tscript.src = __webpack_require__.tu(url);\n\t}\n\tinProgress[url] = [done];\n\tvar onScriptComplete = (prev, event) => {\n\t\t// avoid mem leaks in IE.\n\t\tscript.onerror = script.onload = null;\n\t\tclearTimeout(timeout);\n\t\tvar doneFns = inProgress[url];\n\t\tdelete inProgress[url];\n\t\tscript.parentNode && script.parentNode.removeChild(script);\n\t\tdoneFns && doneFns.forEach((fn) => (fn(event)));\n\t\tif(prev) return prev(event);\n\t}\n\t;\n\tvar timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);\n\tscript.onerror = onScriptComplete.bind(null, script.onerror);\n\tscript.onload = onScriptComplete.bind(null, script.onload);\n\tneedAttach && document.head.appendChild(script);\n};","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.nmd = (module) => {\n\tmodule.paths = [];\n\tif (!module.children) module.children = [];\n\treturn module;\n};","var policy;\n__webpack_require__.tt = () => {\n\t// Create Trusted Type policy if Trusted Types are available and the policy doesn't exist yet.\n\tif (policy === undefined) {\n\t\tpolicy = {\n\t\t\tcreateScriptURL: (url) => (url)\n\t\t};\n\t\tif (typeof trustedTypes !== \"undefined\" && trustedTypes.createPolicy) {\n\t\t\tpolicy = trustedTypes.createPolicy(\"angular#bundler\", policy);\n\t\t}\n\t}\n\treturn policy;\n};","__webpack_require__.tu = (url) => (__webpack_require__.tt().createScriptURL(url));","__webpack_require__.p = \"\";","// no baseURI\n\n// object to store loaded and loading chunks\n// undefined = chunk not loaded, null = chunk preloaded/prefetched\n// [resolve, reject, Promise] = chunk loading, 0 = chunk loaded\nvar installedChunks = {\n\t666: 0\n};\n\n__webpack_require__.f.j = (chunkId, promises) => {\n\t\t// JSONP chunk loading for javascript\n\t\tvar installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;\n\t\tif(installedChunkData !== 0) { // 0 means \"already installed\".\n\n\t\t\t// a Promise means \"currently loading\".\n\t\t\tif(installedChunkData) {\n\t\t\t\tpromises.push(installedChunkData[2]);\n\t\t\t} else {\n\t\t\t\tif(666 != chunkId) {\n\t\t\t\t\t// setup Promise in chunk cache\n\t\t\t\t\tvar promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));\n\t\t\t\t\tpromises.push(installedChunkData[2] = promise);\n\n\t\t\t\t\t// start chunk loading\n\t\t\t\t\tvar url = __webpack_require__.p + __webpack_require__.u(chunkId);\n\t\t\t\t\t// create error before stack unwound to get useful stacktrace later\n\t\t\t\t\tvar error = new Error();\n\t\t\t\t\tvar loadingEnded = (event) => {\n\t\t\t\t\t\tif(__webpack_require__.o(installedChunks, chunkId)) {\n\t\t\t\t\t\t\tinstalledChunkData = installedChunks[chunkId];\n\t\t\t\t\t\t\tif(installedChunkData !== 0) installedChunks[chunkId] = undefined;\n\t\t\t\t\t\t\tif(installedChunkData) {\n\t\t\t\t\t\t\t\tvar errorType = event && (event.type === 'load' ? 'missing' : event.type);\n\t\t\t\t\t\t\t\tvar realSrc = event && event.target && event.target.src;\n\t\t\t\t\t\t\t\terror.message = 'Loading chunk ' + chunkId + ' failed.\\n(' + errorType + ': ' + realSrc + ')';\n\t\t\t\t\t\t\t\terror.name = 'ChunkLoadError';\n\t\t\t\t\t\t\t\terror.type = errorType;\n\t\t\t\t\t\t\t\terror.request = realSrc;\n\t\t\t\t\t\t\t\tinstalledChunkData[1](error);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\t__webpack_require__.l(url, loadingEnded, \"chunk-\" + chunkId, chunkId);\n\t\t\t\t} else installedChunks[chunkId] = 0;\n\t\t\t}\n\t\t}\n};\n\n// no prefetching\n\n// no preloaded\n\n// no HMR\n\n// no HMR manifest\n\n__webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);\n\n// install a JSONP callback for chunk loading\nvar webpackJsonpCallback = (parentChunkLoadingFunction, data) => {\n\tvar [chunkIds, moreModules, runtime] = data;\n\t// add \"moreModules\" to the modules object,\n\t// then flag all \"chunkIds\" as loaded and fire callback\n\tvar moduleId, chunkId, i = 0;\n\tif(chunkIds.some((id) => (installedChunks[id] !== 0))) {\n\t\tfor(moduleId in moreModules) {\n\t\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t\t}\n\t\t}\n\t\tif(runtime) var result = runtime(__webpack_require__);\n\t}\n\tif(parentChunkLoadingFunction) parentChunkLoadingFunction(data);\n\tfor(;i < chunkIds.length; i++) {\n\t\tchunkId = chunkIds[i];\n\t\tif(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {\n\t\t\tinstalledChunks[chunkId][0]();\n\t\t}\n\t\tinstalledChunks[chunkId] = 0;\n\t}\n\treturn __webpack_require__.O(result);\n}\n\nvar chunkLoadingGlobal = self[\"webpackChunkvendure_admin\"] = self[\"webpackChunkvendure_admin\"] || [];\nchunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));\nchunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));"],"sourceRoot":"webpack:///","file":"runtime.6864d94d589dbb0c.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vendure/admin-ui-plugin",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.5",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/express": "^4.17.8",
|
|
23
23
|
"@types/fs-extra": "^9.0.1",
|
|
24
|
-
"@vendure/common": "^2.0.0-next.
|
|
25
|
-
"@vendure/core": "^2.0.0-next.
|
|
24
|
+
"@vendure/common": "^2.0.0-next.5",
|
|
25
|
+
"@vendure/core": "^2.0.0-next.5",
|
|
26
26
|
"express": "^4.17.1",
|
|
27
27
|
"rimraf": "^3.0.2",
|
|
28
28
|
"typescript": "4.5.5"
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"fs-extra": "^10.0.0"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "0e4db8b73f2004e52c50bed3bd3b068acf4f7105"
|
|
34
34
|
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunkvendure_admin=self.webpackChunkvendure_admin||[]).push([[239],{9239:(Zo,x,r)=>{r.r(x),r.d(x,{MarketingModule:()=>Z,PromotionDetailComponent:()=>h,PromotionListComponent:()=>v,PromotionResolver:()=>g,marketingRoutes:()=>N,promotionBreadcrumb:()=>Q});var c=r(587),l=r(8270),d=r(279),I=r(9295),k=r(9525),o=r(3184),u=r(9720),f=r(7346),q=r(3146),P=r(9416),A=r(2748),y=r(7890),T=r(8276),C=r(6362),Y=r(4652),w=r(6852),j=r(837),M=r(2505),S=r(8931),F=r(735),L=r(1519),U=r(8854),J=r(5111),D=r(7514),O=r(7388);const $=function(){return["enabled"]};function E(e,t){if(1&e&&(o.TgZ(0,"clr-toggle-wrapper"),o._UZ(1,"input",25),o.TgZ(2,"label"),o._uU(3),o.ALo(4,"translate"),o.qZA()()),2&e){const n=o.oxw();o.xp6(1),o.Q6J("formControl",n.detailForm.get(o.DdM(4,$))),o.xp6(2),o.Oqu(o.lcZ(4,2,"common.enabled"))}}function B(e,t){if(1&e){const n=o.EpF();o.TgZ(0,"button",26),o.NdJ("click",function(){return o.CHM(n),o.oxw().create()}),o._uU(1),o.ALo(2,"translate"),o.qZA()}if(2&e){const n=o.oxw();o.Q6J("disabled",!n.saveButtonEnabled()),o.xp6(1),o.hij(" ",o.lcZ(2,2,"common.create")," ")}}function H(e,t){if(1&e){const n=o.EpF();o.TgZ(0,"button",26),o.NdJ("click",function(){return o.CHM(n),o.oxw(2).save()}),o._uU(1),o.ALo(2,"translate"),o.qZA()}if(2&e){const n=o.oxw(2);o.Q6J("disabled",!n.saveButtonEnabled()),o.xp6(1),o.hij(" ",o.lcZ(2,2,"common.update")," ")}}function G(e,t){1&e&&o.YNc(0,H,3,4,"button",27),2&e&&o.Q6J("vdrIfPermissions","UpdatePromotion")}function V(e,t){if(1&e&&(o.TgZ(0,"section",28)(1,"label"),o._uU(2),o.ALo(3,"translate"),o.qZA(),o._UZ(4,"vdr-tabbed-custom-fields",29),o.ALo(5,"hasPermission"),o.qZA()),2&e){const n=o.oxw();o.xp6(2),o.Oqu(o.lcZ(3,4,"common.custom-fields")),o.xp6(2),o.Q6J("customFields",n.customFields)("customFieldsFormGroup",n.detailForm.get("customFields"))("readonly",!o.lcZ(5,6,"UpdatePromotion"))}}function R(e,t){if(1&e){const n=o.EpF();o.ynx(0),o.TgZ(1,"vdr-configurable-input",30),o.NdJ("remove",function(a){return o.CHM(n),o.oxw().removeCondition(a)}),o.ALo(2,"hasPermission"),o.qZA(),o.BQk()}if(2&e){const n=t.$implicit,i=t.index,a=o.oxw();o.xp6(1),o.Q6J("readonly",!o.lcZ(2,4,"UpdatePromotion"))("operation",n)("operationDefinition",a.getConditionDefinition(n))("formControlName",i)}}function z(e,t){if(1&e){const n=o.EpF();o.TgZ(0,"button",35),o.NdJ("click",function(){const s=o.CHM(n).$implicit;return o.oxw(2).addCondition(s)}),o._uU(1),o.qZA()}if(2&e){const n=t.$implicit;o.xp6(1),o.hij(" ",n.description," ")}}function K(e,t){if(1&e&&(o.TgZ(0,"vdr-dropdown")(1,"button",31),o._UZ(2,"clr-icon",32),o._uU(3),o.ALo(4,"translate"),o.qZA(),o.TgZ(5,"vdr-dropdown-menu",33),o.YNc(6,z,2,1,"button",34),o.qZA()()),2&e){const n=o.oxw();o.xp6(3),o.hij(" ",o.lcZ(4,2,"marketing.add-condition")," "),o.xp6(3),o.Q6J("ngForOf",n.getAvailableConditions())}}function W(e,t){if(1&e){const n=o.EpF();o.TgZ(0,"vdr-configurable-input",36),o.NdJ("remove",function(a){return o.CHM(n),o.oxw().removeAction(a)}),o.ALo(1,"hasPermission"),o.qZA()}if(2&e){const n=t.$implicit,i=t.index,a=o.oxw();o.Q6J("operation",n)("readonly",!o.lcZ(1,4,"UpdatePromotion"))("operationDefinition",a.getActionDefinition(n))("formControlName",i)}}function X(e,t){if(1&e){const n=o.EpF();o.TgZ(0,"button",35),o.NdJ("click",function(){const s=o.CHM(n).$implicit;return o.oxw(2).addAction(s)}),o._uU(1),o.qZA()}if(2&e){const n=t.$implicit;o.xp6(1),o.hij(" ",n.description," ")}}function oo(e,t){if(1&e&&(o.TgZ(0,"vdr-dropdown")(1,"button",31),o._UZ(2,"clr-icon",32),o._uU(3),o.ALo(4,"translate"),o.qZA(),o.TgZ(5,"vdr-dropdown-menu",33),o.YNc(6,X,2,1,"button",34),o.qZA()()),2&e){const n=o.oxw();o.xp6(3),o.hij(" ",o.lcZ(4,2,"marketing.add-action")," "),o.xp6(3),o.Q6J("ngForOf",n.getAvailableActions())}}class h extends d.UT_{constructor(t,n,i,a,s,m,p){super(n,t,i,s),this.changeDetector=a,this.dataService=s,this.formBuilder=m,this.notificationService=p,this.conditions=[],this.actions=[],this.allConditions=[],this.allActions=[],this.customFields=this.getCustomFieldConfig("Promotion"),this.detailForm=this.formBuilder.group({name:["",c.kI.required],enabled:!0,couponCode:null,perCustomerUsageLimit:null,startsAt:null,endsAt:null,conditions:this.formBuilder.array([]),actions:this.formBuilder.array([]),customFields:this.formBuilder.group(this.customFields.reduce((_,b)=>Object.assign(Object.assign({},_),{[b.name]:""}),{}))})}ngOnInit(){this.init(),this.promotion$=this.entity$,this.dataService.promotion.getPromotionActionsAndConditions().single$.subscribe(t=>{this.allActions=t.promotionActions,this.allConditions=t.promotionConditions,this.changeDetector.markForCheck()})}ngOnDestroy(){this.destroy()}getAvailableConditions(){return this.allConditions.filter(t=>!this.conditions.find(n=>n.code===t.code))}getConditionDefinition(t){return this.allConditions.find(n=>n.code===t.code)}getAvailableActions(){return this.allActions.filter(t=>!this.actions.find(n=>n.code===t.code))}getActionDefinition(t){return this.allActions.find(n=>n.code===t.code)}saveButtonEnabled(){return this.detailForm.dirty&&this.detailForm.valid&&(0!==this.conditions.length||this.detailForm.value.couponCode)&&0!==this.actions.length}addCondition(t){this.addOperation("conditions",t),this.detailForm.markAsDirty()}addAction(t){this.addOperation("actions",t),this.detailForm.markAsDirty()}removeCondition(t){this.removeOperation("conditions",t),this.detailForm.markAsDirty()}removeAction(t){this.removeOperation("actions",t),this.detailForm.markAsDirty()}formArrayOf(t){return this.detailForm.get(t)}create(){if(!this.detailForm.dirty)return;const t=this.detailForm.value,n={name:t.name,enabled:!0,couponCode:t.couponCode,perCustomerUsageLimit:t.perCustomerUsageLimit,startsAt:t.startsAt,endsAt:t.endsAt,conditions:this.mapOperationsToInputs(this.conditions,t.conditions),actions:this.mapOperationsToInputs(this.actions,t.actions),customFields:t.customFields};this.dataService.promotion.createPromotion(n).subscribe(({createPromotion:i})=>{switch(i.__typename){case"Promotion":this.notificationService.success((0,l.J)("common.notify-create-success"),{entity:"Promotion"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck(),this.router.navigate(["../",i.id],{relativeTo:this.route});break;case"MissingConditionsError":this.notificationService.error(i.message)}},i=>{this.notificationService.error((0,l.J)("common.notify-create-error"),{entity:"Promotion"})})}save(){if(!this.detailForm.dirty)return;const t=this.detailForm.value;this.promotion$.pipe((0,I.q)(1),(0,k.z)(n=>{const i={id:n.id,name:t.name,enabled:t.enabled,couponCode:t.couponCode,perCustomerUsageLimit:t.perCustomerUsageLimit,startsAt:t.startsAt,endsAt:t.endsAt,conditions:this.mapOperationsToInputs(this.conditions,t.conditions),actions:this.mapOperationsToInputs(this.actions,t.actions),customFields:t.customFields};return this.dataService.promotion.updatePromotion(i)})).subscribe(n=>{this.notificationService.success((0,l.J)("common.notify-update-success"),{entity:"Promotion"}),this.detailForm.markAsPristine(),this.changeDetector.markForCheck()},n=>{this.notificationService.error((0,l.J)("common.notify-update-error"),{entity:"Promotion"})})}setFormValues(t,n){this.detailForm.patchValue({name:t.name,enabled:t.enabled,couponCode:t.couponCode,perCustomerUsageLimit:t.perCustomerUsageLimit,startsAt:t.startsAt,endsAt:t.endsAt}),t.conditions.forEach(i=>{this.addOperation("conditions",i)}),t.actions.forEach(i=>this.addOperation("actions",i)),this.customFields.length&&this.setCustomFieldFormValues(this.customFields,this.detailForm.get("customFields"),t)}mapOperationsToInputs(t,n){return t.map((i,a)=>({code:i.code,arguments:Object.values(n[a].args).map((s,m)=>({name:i.args[m].name,value:(0,d.qrw)(s)}))}))}addOperation(t,n){const i=this.formArrayOf(t),a="conditions"===t?this.conditions:this.actions;if(-1===i.value.findIndex(m=>m.code===n.code)){const m=n.args.reduce((p,_)=>{var b;return Object.assign(Object.assign({},p),{[_.name]:null!==(b=(0,d.sux)(_.value))&&void 0!==b?b:this.getDefaultArgValue(t,n,_.name)})},{});i.push(this.formBuilder.control({code:n.code,args:m})),a.push({code:n.code,args:n.args.map(p=>({name:p.name,value:(0,d.sux)(p.value)}))})}}getDefaultArgValue(t,n,i){const a="conditions"===t?this.allConditions.find(s=>s.code===n.code):this.allActions.find(s=>s.code===n.code);if(a){const s=a.args.find(m=>m.name===i);if(s)return(0,d.NWQ)(s)}throw new Error('Could not determine default value for "argName"')}removeOperation(t,n){const i=this.formArrayOf(t),a="conditions"===t?this.conditions:this.actions,s=i.value.findIndex(m=>m.code===n.code);-1!==s&&(i.removeAt(s),a.splice(s,1))}}h.\u0275fac=function(t){return new(t||h)(o.Y36(u.F0),o.Y36(u.gz),o.Y36(d.iHG),o.Y36(o.sBO),o.Y36(d.DoR),o.Y36(c.qu),o.Y36(d.gqp))},h.\u0275cmp=o.Xpm({type:h,selectors:[["vdr-promotion-detail"]],features:[o.qOj],decls:48,vars:46,consts:[[1,"flex","clr-align-items-center"],[3,"entity"],[4,"vdrIfPermissions"],["locationId","promotion-detail"],["class","btn btn-primary",3,"disabled","click",4,"ngIf","ngIfElse"],["updateButton",""],[1,"form",3,"formGroup"],["for","name",3,"label"],["id","name","type","text","formControlName","name",3,"readonly"],["for","startsAt",3,"label"],["formControlName","startsAt"],["for","endsAt",3,"label"],["formControlName","endsAt"],["for","couponCode",3,"label"],["id","couponCode","type","text","formControlName","couponCode",3,"readonly"],["for","perCustomerUsageLimit",3,"label"],["id","perCustomerUsageLimit","type","number","min","1","max","999","formControlName","perCustomerUsageLimit",3,"readonly"],["formGroupName","customFields",4,"ngIf"],["locationId","promotion-detail",3,"entity$","detailForm"],[1,"clr-row"],["formArrayName","conditions",1,"clr-col"],[1,"clr-control-label"],[4,"ngFor","ngForOf"],["formArrayName","actions",1,"clr-col"],[3,"operation","readonly","operationDefinition","formControlName","remove",4,"ngFor","ngForOf"],["type","checkbox","clrToggle","","name","enabled",3,"formControl"],[1,"btn","btn-primary",3,"disabled","click"],["class","btn btn-primary",3,"disabled","click",4,"vdrIfPermissions"],["formGroupName","customFields"],["entityName","Promotion",3,"customFields","customFieldsFormGroup","readonly"],[3,"readonly","operation","operationDefinition","formControlName","remove"],["vdrDropdownTrigger","",1,"btn","btn-outline"],["shape","plus"],["vdrPosition","bottom-left"],["type","button","vdrDropdownItem","",3,"click",4,"ngFor","ngForOf"],["type","button","vdrDropdownItem","",3,"click"],[3,"operation","readonly","operationDefinition","formControlName","remove"]],template:function(t,n){if(1&t&&(o.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left")(2,"div",0),o._UZ(3,"vdr-entity-info",1),o.ALo(4,"async"),o.YNc(5,E,5,5,"clr-toggle-wrapper",2),o.qZA()(),o.TgZ(6,"vdr-ab-right"),o._UZ(7,"vdr-action-bar-items",3),o.YNc(8,B,3,4,"button",4),o.ALo(9,"async"),o.YNc(10,G,1,1,"ng-template",null,5,o.W1O),o.qZA()(),o.TgZ(12,"form",6)(13,"vdr-form-field",7),o.ALo(14,"translate"),o._UZ(15,"input",8),o.ALo(16,"hasPermission"),o.qZA(),o.TgZ(17,"vdr-form-field",9),o.ALo(18,"translate"),o._UZ(19,"vdr-datetime-picker",10),o.qZA(),o.TgZ(20,"vdr-form-field",11),o.ALo(21,"translate"),o._UZ(22,"vdr-datetime-picker",12),o.qZA(),o.TgZ(23,"vdr-form-field",13),o.ALo(24,"translate"),o._UZ(25,"input",14),o.ALo(26,"hasPermission"),o.qZA(),o.TgZ(27,"vdr-form-field",15),o.ALo(28,"translate"),o._UZ(29,"input",16),o.ALo(30,"hasPermission"),o.qZA(),o.YNc(31,V,6,8,"section",17),o._UZ(32,"vdr-custom-detail-component-host",18),o.TgZ(33,"div",19)(34,"div",20)(35,"label",21),o._uU(36),o.ALo(37,"translate"),o.qZA(),o.YNc(38,R,3,6,"ng-container",22),o.TgZ(39,"div"),o.YNc(40,K,7,4,"vdr-dropdown",2),o.qZA()(),o.TgZ(41,"div",23)(42,"label",21),o._uU(43),o.ALo(44,"translate"),o.qZA(),o.YNc(45,W,2,6,"vdr-configurable-input",24),o.TgZ(46,"div"),o.YNc(47,oo,7,4,"vdr-dropdown",2),o.qZA()()()()),2&t){const i=o.MAs(11);o.xp6(3),o.Q6J("entity",o.lcZ(4,22,n.entity$)),o.xp6(2),o.Q6J("vdrIfPermissions","UpdatePromotion"),o.xp6(3),o.Q6J("ngIf",o.lcZ(9,24,n.isNew$))("ngIfElse",i),o.xp6(4),o.Q6J("formGroup",n.detailForm),o.xp6(1),o.Q6J("label",o.lcZ(14,26,"common.name")),o.xp6(2),o.Q6J("readonly",!o.lcZ(16,28,"UpdatePromotion")),o.xp6(2),o.Q6J("label",o.lcZ(18,30,"marketing.starts-at")),o.xp6(3),o.Q6J("label",o.lcZ(21,32,"marketing.ends-at")),o.xp6(3),o.Q6J("label",o.lcZ(24,34,"marketing.coupon-code")),o.xp6(2),o.Q6J("readonly",!o.lcZ(26,36,"UpdatePromotion")),o.xp6(2),o.Q6J("label",o.lcZ(28,38,"marketing.per-customer-limit")),o.xp6(2),o.Q6J("readonly",!o.lcZ(30,40,"UpdatePromotion")),o.xp6(2),o.Q6J("ngIf",n.customFields.length),o.xp6(1),o.Q6J("entity$",n.entity$)("detailForm",n.detailForm),o.xp6(4),o.Oqu(o.lcZ(37,42,"marketing.conditions")),o.xp6(2),o.Q6J("ngForOf",n.conditions),o.xp6(2),o.Q6J("vdrIfPermissions","UpdatePromotion"),o.xp6(3),o.Oqu(o.lcZ(44,44,"marketing.actions")),o.xp6(2),o.Q6J("ngForOf",n.actions),o.xp6(2),o.Q6J("vdrIfPermissions","UpdatePromotion")}},directives:[f.Kk,f.BN,q.V,P.H,A.PEh,y.y,c.Wl,A.KKC,c.JJ,c.oH,A.MgK,f.mz,T.W,C.O5,c._Y,c.JL,c.sg,Y.h,c.Fj,c.u,w.I,c.qQ,c.Fd,c.wV,c.x0,j.y,M.C,c.CE,C.sg,S.q,F.J,L.U,A.qvL,U.N,J.H],pipes:[C.Ov,D.X$,O.j],styles:[""],changeDetection:0});var to=r(6646),no=r(591),eo=r(1989),io=r(8951),ro=r(2673),ao=r(365),so=r(901),co=r(4447),mo=r(8899),lo=r(2651);const po=function(){return["./create"]};function uo(e,t){1&e&&(o.TgZ(0,"a",6),o._UZ(1,"clr-icon",7),o._uU(2),o.ALo(3,"translate"),o.qZA()),2&e&&(o.Q6J("routerLink",o.DdM(4,po)),o.xp6(2),o.hij(" ",o.lcZ(3,2,"marketing.create-new-promotion")," "))}function go(e,t){if(1&e&&(o.TgZ(0,"vdr-chip"),o._uU(1),o.qZA()),2&e){const n=o.oxw().item;o.xp6(1),o.hij(" ",n.couponCode," ")}}function fo(e,t){1&e&&(o.TgZ(0,"vdr-chip"),o._uU(1),o.ALo(2,"translate"),o.qZA()),2&e&&(o.xp6(1),o.Oqu(o.lcZ(2,1,"common.disabled")))}const ho=function(e){return["./",e]};function vo(e,t){if(1&e){const n=o.EpF();o.TgZ(0,"td",8),o._uU(1),o.qZA(),o.TgZ(2,"td",8),o.YNc(3,go,2,1,"vdr-chip",9),o.qZA(),o.TgZ(4,"td",8),o._uU(5),o.ALo(6,"localeDate"),o.qZA(),o.TgZ(7,"td",8),o._uU(8),o.ALo(9,"localeDate"),o.qZA(),o.TgZ(10,"td",10),o.YNc(11,fo,3,3,"vdr-chip",9),o.qZA(),o.TgZ(12,"td",11),o._UZ(13,"vdr-table-row-action",12),o.ALo(14,"translate"),o.qZA(),o.TgZ(15,"td",11)(16,"vdr-dropdown")(17,"button",13),o._uU(18),o.ALo(19,"translate"),o._UZ(20,"clr-icon",14),o.qZA(),o.TgZ(21,"vdr-dropdown-menu",15)(22,"button",16),o.NdJ("click",function(){const s=o.CHM(n).item;return o.oxw().deletePromotion(s.id)}),o.ALo(23,"hasPermission"),o._UZ(24,"clr-icon",17),o._uU(25),o.ALo(26,"translate"),o.qZA()()()()}if(2&e){const n=t.item;o.xp6(1),o.Oqu(n.name),o.xp6(2),o.Q6J("ngIf",n.couponCode),o.xp6(2),o.Oqu(o.xi3(6,10,n.startsAt,"longDate")),o.xp6(3),o.Oqu(o.xi3(9,13,n.endsAt,"longDate")),o.xp6(3),o.Q6J("ngIf",!n.enabled),o.xp6(2),o.Q6J("label",o.lcZ(14,16,"common.edit"))("linkTo",o.VKq(24,ho,n.id)),o.xp6(5),o.hij(" ",o.lcZ(19,18,"common.actions")," "),o.xp6(4),o.Q6J("disabled",!o.lcZ(23,20,"DeletePromotion")),o.xp6(3),o.hij(" ",o.lcZ(26,22,"common.delete")," ")}}class v extends d.t7C{constructor(t,n,i,a,s){super(n,i),this.dataService=t,this.notificationService=a,this.modalService=s,this.searchForm=new c.cw({name:new c.NI(""),couponCode:new c.NI("")}),super.setQueryFn((...m)=>this.dataService.promotion.getPromotions(...m).refetchOnChannelChange(),m=>m.promotions,(m,p)=>this.createQueryOptions(m,p,this.searchForm.value))}ngOnInit(){super.ngOnInit(),(0,to.T)(this.searchForm.valueChanges.pipe((0,eo.b)(250)),this.route.queryParamMap).pipe((0,io.R)(this.destroy$)).subscribe(t=>{t.params||this.setPageNumber(1),this.refresh()})}deletePromotion(t){this.modalService.dialog({title:(0,l.J)("catalog.confirm-delete-promotion"),buttons:[{type:"secondary",label:(0,l.J)("common.cancel")},{type:"danger",label:(0,l.J)("common.delete"),returnValue:!0}]}).pipe((0,ro.w)(n=>n?this.dataService.promotion.deletePromotion(t):no.E)).subscribe(()=>{this.notificationService.success((0,l.J)("common.notify-delete-success"),{entity:"Promotion"}),this.refresh()},n=>{this.notificationService.error((0,l.J)("common.notify-delete-error"),{entity:"Promotion"})})}createQueryOptions(t,n,i){const a={};return i.couponCode&&(a.couponCode={contains:i.couponCode}),i.name&&(a.name={contains:i.name}),{options:{skip:t,take:n,filter:a}}}}v.\u0275fac=function(t){return new(t||v)(o.Y36(d.DoR),o.Y36(u.F0),o.Y36(u.gz),o.Y36(d.gqp),o.Y36(d.Z7U))},v.\u0275cmp=o.Xpm({type:v,selectors:[["vdr-promotion-list"]],features:[o.qOj],decls:31,vars:32,consts:[[1,"search-form",3,"formGroup"],["type","text","formControlName","name",1,"search-input",3,"placeholder"],["type","text","formControlName","couponCode",1,"search-input",3,"placeholder"],["locationId","promotion-list"],["class","btn btn-primary",3,"routerLink",4,"vdrIfPermissions"],[3,"items","itemsPerPage","totalItems","currentPage","pageChange","itemsPerPageChange"],[1,"btn","btn-primary",3,"routerLink"],["shape","plus"],[1,"left","align-middle"],[4,"ngIf"],[1,"align-middle"],[1,"right","align-middle"],["iconShape","edit",3,"label","linkTo"],["type","button","vdrDropdownTrigger","",1,"btn","btn-link","btn-sm"],["shape","caret down"],["vdrPosition","bottom-right"],["type","button","vdrDropdownItem","",1,"delete-button",3,"disabled","click"],["shape","trash",1,"is-danger"]],template:function(t,n){1&t&&(o.TgZ(0,"vdr-action-bar")(1,"vdr-ab-left")(2,"form",0),o._UZ(3,"input",1),o.ALo(4,"translate"),o._UZ(5,"input",2),o.ALo(6,"translate"),o.qZA()(),o.TgZ(7,"vdr-ab-right"),o._UZ(8,"vdr-action-bar-items",3),o.YNc(9,uo,4,5,"a",4),o.qZA()(),o.TgZ(10,"vdr-data-table",5),o.NdJ("pageChange",function(a){return n.setPageNumber(a)})("itemsPerPageChange",function(a){return n.setItemsPerPage(a)}),o.ALo(11,"async"),o.ALo(12,"async"),o.ALo(13,"async"),o.ALo(14,"async"),o.TgZ(15,"vdr-dt-column"),o._uU(16),o.ALo(17,"translate"),o.qZA(),o.TgZ(18,"vdr-dt-column"),o._uU(19),o.ALo(20,"translate"),o.qZA(),o.TgZ(21,"vdr-dt-column"),o._uU(22),o.ALo(23,"translate"),o.qZA(),o.TgZ(24,"vdr-dt-column"),o._uU(25),o.ALo(26,"translate"),o.qZA(),o._UZ(27,"vdr-dt-column")(28,"vdr-dt-column")(29,"vdr-dt-column"),o.YNc(30,vo,27,26,"ng-template"),o.qZA()),2&t&&(o.xp6(2),o.Q6J("formGroup",n.searchForm),o.xp6(1),o.Q6J("placeholder",o.lcZ(4,12,"marketing.search-by-name")),o.xp6(2),o.Q6J("placeholder",o.lcZ(6,14,"marketing.search-by-coupon-code")),o.xp6(4),o.Q6J("vdrIfPermissions","CreatePromotion"),o.xp6(1),o.Q6J("items",o.lcZ(11,16,n.items$))("itemsPerPage",o.lcZ(12,18,n.itemsPerPage$))("totalItems",o.lcZ(13,20,n.totalItems$))("currentPage",o.lcZ(14,22,n.currentPage$)),o.xp6(6),o.Oqu(o.lcZ(17,24,"common.name")),o.xp6(3),o.Oqu(o.lcZ(20,26,"marketing.coupon-code")),o.xp6(3),o.Oqu(o.lcZ(23,28,"marketing.starts-at")),o.xp6(3),o.Oqu(o.lcZ(26,30,"marketing.ends-at")))},directives:[f.Kk,f.BN,c._Y,c.JL,c.sg,y.y,c.Fj,c.JJ,c.u,f.mz,T.W,P.H,u.yS,A.qvL,ao.Q,so.E,C.O5,co.Y,mo.v,F.J,L.U,U.N,J.H],pipes:[D.X$,C.Ov,lo.H,O.j],styles:[".search-form[_ngcontent-%COMP%]{padding:0}.search-input[_ngcontent-%COMP%]{margin:6px 8px 0 0;min-width:200px}"],changeDetection:0});class g extends d.p_9{constructor(t,n){super(t,{__typename:"Promotion",id:"",createdAt:"",updatedAt:"",name:"",enabled:!1,conditions:[],actions:[]},i=>n.promotion.getPromotion(i).mapStream(a=>a.promotion))}}g.\u0275fac=function(t){return new(t||g)(o.LFG(u.F0),o.LFG(d.DoR))},g.\u0275prov=o.Yz7({token:g,factory:g.\u0275fac,providedIn:"root"});const N=[{path:"promotions",component:v,data:{breadcrumb:(0,l.J)("breadcrumb.promotions")}},{path:"promotions/:id",component:h,resolve:(0,d.Po4)(g),canDeactivate:[d.TSp],data:{breadcrumb:Q}}];function Q(e,t){return(0,d.YWC)({entity:e.entity,id:t.id,breadcrumbKey:"breadcrumb.promotions",getName:n=>n.name,route:"promotions"})}class Z{}Z.\u0275fac=function(t){return new(t||Z)},Z.\u0275mod=o.oAB({type:Z}),Z.\u0275inj=o.cJS({imports:[[d.m81,u.Bz.forChild(N)]]})}}]);
|
|
2
|
-
//# sourceMappingURL=239.a68e402e10b798f1.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":"ilBAIYA,8BACIA,oBACAA,iBAAOA,8BAAkCA,gCADOA,2DACzCA,qFAOfA,qBAGIA,iDAASC,WAGTD,8BACJA,gCAHIA,yCAEAA,4FAGAA,qBAEIA,kDAASE,SAITF,8BACJA,iCAHIA,yCAEAA,yEANJA,gCAGKA,qEA0CbA,sBAAkE,WACvDA,8BAAwCA,QAC/CA,gEAMJA,8BAPWA,kDAGHA,8CAA6B,yDAA7BA,CAA6B,mFAe7BA,SACIA,qCACIA,mDAAUG,8CAKbH,QACLA,wDALQA,yDAAiD,cAAjDA,CAAiD,kDAAjDA,CAAiD,8DAc7CA,qBAIIA,2DAASA,EAATI,OAASC,kBAETL,SACJA,oCADIA,gEAZZA,wBAAoD,eAE5CA,uBACAA,8BACJA,QACAA,gCACIA,2BAQJA,gCAXIA,6DAI0BA,8FAatCA,qCAEIA,mDAAUM,2CAKbN,wDAJGA,qBAAoB,yCAApBA,CAAoB,+CAApBA,CAAoB,8DAYZA,qBAIIA,2DAASA,EAATI,OAASG,eAETP,SACJA,oCADIA,iEAZZA,wBAAoD,eAE5CA,uBACAA,8BACJA,QACAA,gCACIA,2BAQJA,gCAXIA,0DAIuBA,mDCvGxC,gBACKQ,MAYRC,YACIC,EACAC,EACAC,EACQC,EACEC,EACFC,EACAC,GAERC,MAAMN,EAAOD,EAAQE,EAAqBE,GALlCI,sBACEA,mBACFA,mBACAA,2BAbZA,gBAAsC,GACtCA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BAAeA,gCAA+BA,QAC9CA,0BAAeA,gCAAyCA,QACxDA,0BAAeA,gCAAuCA,QACtDA,0BAAeA,gCAAqCA,QACpDA,0BAA+B,mBAA/BA,CAA+B,oBAG/BA,iCAwCJA,eAjFkCA,yCAIlBA,qEAMAA,4EAQJA,qDASRA,8CAAwB,4CAAxBA,CAAwB,wCAAxBA,CAAwB,2CAOTA,2CACAA,qDACAA,mDACAA,qVE7BZ,gBAAgCQ,MACnCC,YAAYC,EAAgBC,GACxBM,MACIP,EACA,CACIgE,WAAY,YACZO,GAAI,GACJqD,UAAW,GACXC,UAAW,GACX/G,KAAM,GACNE,SAAS,EACTK,WAAY,GACZE,QAAS,IAEbrB,GAAMD,EAAYgC,UAAU6F,aAAa5H,GAAI6H,UAAU5H,GAAQA,EAAK8B,mDAdnE+F,GAAiB1I,qDAAjB0I,EAAiBC,QAAjBD,EAAiB,qBAFd,SCKT,MAAME,EAA2B,CACpC,CACIC,KAAM,aACNC,UAAWT,EACXU,KAAM,CACFC,cAAYrB,KAAE,2BAGtB,CACIkB,KAAM,iBACNC,UAAWtC,EACXyC,WAASzI,OAAkBkI,GAC3BQ,cAAe,CAAC1I,OAChBuI,KAAM,CACFC,WAAYG,KAKjB,WAA6BC,EAAW1I,GAC3C,SAAOF,OAAoC,CACvCqE,OAAQuE,EAAKvE,OACbI,GAAIvE,EAAOuE,GACXoE,cAAe,wBACfC,QAAS3I,GAAaA,EAAUa,KAChC2D,MAAO,eC1BR,+CAAMoE,4DAHA,CAAC/I,MAAcgJ,cAAsBZ","names":["o","create","save","removeCondition","oxw","addCondition","removeAction","addAction","d","constructor","t","n","i","a","s","m","p","super","this","customFields","getCustomFieldConfig","detailForm","formBuilder","group","name","c","enabled","couponCode","perCustomerUsageLimit","startsAt","endsAt","conditions","array","actions","reduce","_","b","Object","ngOnInit","init","promotion$","entity$","dataService","promotion","getPromotionActionsAndConditions","single$","subscribe","allActions","promotionActions","allConditions","promotionConditions","changeDetector","markForCheck","ngOnDestroy","destroy","getAvailableConditions","filter","find","code","getConditionDefinition","getAvailableActions","getActionDefinition","saveButtonEnabled","dirty","valid","length","value","addOperation","markAsDirty","removeOperation","formArrayOf","get","mapOperationsToInputs","createPromotion","__typename","notificationService","success","entity","markAsPristine","router","navigate","id","relativeTo","route","error","message","pipe","I","updatePromotion","setFormValues","patchValue","forEach","setCustomFieldFormValues","map","arguments","values","args","findIndex","getDefaultArgValue","push","control","Error","removeAt","splice","h","selectors","deletePromotion","setQueryFn","getPromotions","refetchOnChannelChange","promotions","createQueryOptions","searchForm","to","valueChanges","queryParamMap","destroy$","params","setPageNumber","refresh","modalService","dialog","title","l","buttons","type","label","returnValue","no","contains","options","skip","take","v","createdAt","updatedAt","getPromotion","mapStream","g","factory","N","path","component","data","breadcrumb","resolve","canDeactivate","Q","e","breadcrumbKey","getName","Z","u"],"sources":["./src/lib/marketing/src/components/promotion-detail/promotion-detail.component.html","./src/lib/marketing/src/components/promotion-detail/promotion-detail.component.ts","./src/lib/marketing/src/components/promotion-list/promotion-list.component.html","./src/lib/marketing/src/components/promotion-list/promotion-list.component.ts","./src/lib/marketing/src/providers/routing/promotion-resolver.ts","./src/lib/marketing/src/marketing.routes.ts","./src/lib/marketing/src/marketing.module.ts"],"sourcesContent":["<vdr-action-bar>\r\n <vdr-ab-left>\r\n <div class=\"flex clr-align-items-center\">\r\n <vdr-entity-info [entity]=\"entity$ | async\"></vdr-entity-info>\r\n <clr-toggle-wrapper *vdrIfPermissions=\"'UpdatePromotion'\">\r\n <input type=\"checkbox\" clrToggle name=\"enabled\" [formControl]=\"detailForm.get(['enabled'])\" />\r\n <label>{{ 'common.enabled' | translate }}</label>\r\n </clr-toggle-wrapper>\r\n </div>\r\n </vdr-ab-left>\r\n\r\n <vdr-ab-right>\r\n <vdr-action-bar-items locationId=\"promotion-detail\"></vdr-action-bar-items>\r\n <button\r\n class=\"btn btn-primary\"\r\n *ngIf=\"isNew$ | async; else updateButton\"\r\n (click)=\"create()\"\r\n [disabled]=\"!saveButtonEnabled()\"\r\n >\r\n {{ 'common.create' | translate }}\r\n </button>\r\n <ng-template #updateButton>\r\n <button\r\n class=\"btn btn-primary\"\r\n (click)=\"save()\"\r\n *vdrIfPermissions=\"'UpdatePromotion'\"\r\n [disabled]=\"!saveButtonEnabled()\"\r\n >\r\n {{ 'common.update' | translate }}\r\n </button>\r\n </ng-template>\r\n </vdr-ab-right>\r\n</vdr-action-bar>\r\n\r\n<form class=\"form\" [formGroup]=\"detailForm\">\r\n <vdr-form-field [label]=\"'common.name' | translate\" for=\"name\">\r\n <input\r\n id=\"name\"\r\n [readonly]=\"!('UpdatePromotion' | hasPermission)\"\r\n type=\"text\"\r\n formControlName=\"name\"\r\n />\r\n </vdr-form-field>\r\n <vdr-form-field [label]=\"'marketing.starts-at' | translate\" for=\"startsAt\">\r\n <vdr-datetime-picker formControlName=\"startsAt\"></vdr-datetime-picker>\r\n </vdr-form-field>\r\n <vdr-form-field [label]=\"'marketing.ends-at' | translate\" for=\"endsAt\">\r\n <vdr-datetime-picker formControlName=\"endsAt\"></vdr-datetime-picker>\r\n </vdr-form-field>\r\n <vdr-form-field [label]=\"'marketing.coupon-code' | translate\" for=\"couponCode\">\r\n <input\r\n id=\"couponCode\"\r\n [readonly]=\"!('UpdatePromotion' | hasPermission)\"\r\n type=\"text\"\r\n formControlName=\"couponCode\"\r\n />\r\n </vdr-form-field>\r\n <vdr-form-field [label]=\"'marketing.per-customer-limit' | translate\" for=\"perCustomerUsageLimit\">\r\n <input\r\n id=\"perCustomerUsageLimit\"\r\n [readonly]=\"!('UpdatePromotion' | hasPermission)\"\r\n type=\"number\"\r\n min=\"1\"\r\n max=\"999\"\r\n formControlName=\"perCustomerUsageLimit\"\r\n />\r\n </vdr-form-field>\r\n <section formGroupName=\"customFields\" *ngIf=\"customFields.length\">\r\n <label>{{ 'common.custom-fields' | translate }}</label>\r\n <vdr-tabbed-custom-fields\r\n entityName=\"Promotion\"\r\n [customFields]=\"customFields\"\r\n [customFieldsFormGroup]=\"detailForm.get('customFields')\"\r\n [readonly]=\"!('UpdatePromotion' | hasPermission)\"\r\n ></vdr-tabbed-custom-fields>\r\n </section>\r\n\r\n <vdr-custom-detail-component-host\r\n locationId=\"promotion-detail\"\r\n [entity$]=\"entity$\"\r\n [detailForm]=\"detailForm\"\r\n ></vdr-custom-detail-component-host>\r\n\r\n <div class=\"clr-row\">\r\n <div class=\"clr-col\" formArrayName=\"conditions\">\r\n <label class=\"clr-control-label\">{{ 'marketing.conditions' | translate }}</label>\r\n <ng-container *ngFor=\"let condition of conditions; index as i\">\r\n <vdr-configurable-input\r\n (remove)=\"removeCondition($event)\"\r\n [readonly]=\"!('UpdatePromotion' | hasPermission)\"\r\n [operation]=\"condition\"\r\n [operationDefinition]=\"getConditionDefinition(condition)\"\r\n [formControlName]=\"i\"\r\n ></vdr-configurable-input>\r\n </ng-container>\r\n\r\n <div>\r\n <vdr-dropdown *vdrIfPermissions=\"'UpdatePromotion'\">\r\n <button class=\"btn btn-outline\" vdrDropdownTrigger>\r\n <clr-icon shape=\"plus\"></clr-icon>\r\n {{ 'marketing.add-condition' | translate }}\r\n </button>\r\n <vdr-dropdown-menu vdrPosition=\"bottom-left\">\r\n <button\r\n *ngFor=\"let condition of getAvailableConditions()\"\r\n type=\"button\"\r\n vdrDropdownItem\r\n (click)=\"addCondition(condition)\"\r\n >\r\n {{ condition.description }}\r\n </button>\r\n </vdr-dropdown-menu>\r\n </vdr-dropdown>\r\n </div>\r\n </div>\r\n <div class=\"clr-col\" formArrayName=\"actions\">\r\n <label class=\"clr-control-label\">{{ 'marketing.actions' | translate }}</label>\r\n <vdr-configurable-input\r\n *ngFor=\"let action of actions; index as i\"\r\n (remove)=\"removeAction($event)\"\r\n [operation]=\"action\"\r\n [readonly]=\"!('UpdatePromotion' | hasPermission)\"\r\n [operationDefinition]=\"getActionDefinition(action)\"\r\n [formControlName]=\"i\"\r\n ></vdr-configurable-input>\r\n <div>\r\n <vdr-dropdown *vdrIfPermissions=\"'UpdatePromotion'\">\r\n <button class=\"btn btn-outline\" vdrDropdownTrigger>\r\n <clr-icon shape=\"plus\"></clr-icon>\r\n {{ 'marketing.add-action' | translate }}\r\n </button>\r\n <vdr-dropdown-menu vdrPosition=\"bottom-left\">\r\n <button\r\n *ngFor=\"let action of getAvailableActions()\"\r\n type=\"button\"\r\n vdrDropdownItem\r\n (click)=\"addAction(action)\"\r\n >\r\n {{ action.description }}\r\n </button>\r\n </vdr-dropdown-menu>\r\n </vdr-dropdown>\r\n </div>\r\n </div>\r\n </div>\r\n</form>\r\n","import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, OnInit } from '@angular/core';\r\nimport { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\nimport { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';\r\nimport {\r\n BaseDetailComponent,\r\n ConfigurableOperation,\r\n ConfigurableOperationDefinition,\r\n ConfigurableOperationInput,\r\n CreatePromotionInput,\r\n CustomFieldConfig,\r\n DataService,\r\n encodeConfigArgValue,\r\n getConfigArgValue,\r\n getDefaultConfigArgValue,\r\n LanguageCode,\r\n NotificationService,\r\n PromotionFragment,\r\n ServerConfigService,\r\n UpdatePromotionInput,\r\n} from '@vendure/admin-ui/core';\r\nimport { Observable } from 'rxjs';\r\nimport { mergeMap, take } from 'rxjs/operators';\r\n\r\n@Component({\r\n selector: 'vdr-promotion-detail',\r\n templateUrl: './promotion-detail.component.html',\r\n styleUrls: ['./promotion-detail.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class PromotionDetailComponent\r\n extends BaseDetailComponent<PromotionFragment>\r\n implements OnInit, OnDestroy\r\n{\r\n promotion$: Observable<PromotionFragment>;\r\n detailForm: FormGroup;\r\n customFields: CustomFieldConfig[];\r\n conditions: ConfigurableOperation[] = [];\r\n actions: ConfigurableOperation[] = [];\r\n\r\n private allConditions: ConfigurableOperationDefinition[] = [];\r\n private allActions: ConfigurableOperationDefinition[] = [];\r\n\r\n constructor(\r\n router: Router,\r\n route: ActivatedRoute,\r\n serverConfigService: ServerConfigService,\r\n private changeDetector: ChangeDetectorRef,\r\n protected dataService: DataService,\r\n private formBuilder: FormBuilder,\r\n private notificationService: NotificationService,\r\n ) {\r\n super(route, router, serverConfigService, dataService);\r\n this.customFields = this.getCustomFieldConfig('Promotion');\r\n this.detailForm = this.formBuilder.group({\r\n name: ['', Validators.required],\r\n enabled: true,\r\n couponCode: null,\r\n perCustomerUsageLimit: null,\r\n startsAt: null,\r\n endsAt: null,\r\n conditions: this.formBuilder.array([]),\r\n actions: this.formBuilder.array([]),\r\n customFields: this.formBuilder.group(\r\n this.customFields.reduce((hash, field) => ({ ...hash, [field.name]: '' }), {}),\r\n ),\r\n });\r\n }\r\n\r\n ngOnInit() {\r\n this.init();\r\n this.promotion$ = this.entity$;\r\n this.dataService.promotion.getPromotionActionsAndConditions().single$.subscribe(data => {\r\n this.allActions = data.promotionActions;\r\n this.allConditions = data.promotionConditions;\r\n this.changeDetector.markForCheck();\r\n });\r\n }\r\n\r\n ngOnDestroy() {\r\n this.destroy();\r\n }\r\n\r\n getAvailableConditions(): ConfigurableOperationDefinition[] {\r\n return this.allConditions.filter(o => !this.conditions.find(c => c.code === o.code));\r\n }\r\n\r\n getConditionDefinition(condition: ConfigurableOperation): ConfigurableOperationDefinition | undefined {\r\n return this.allConditions.find(c => c.code === condition.code);\r\n }\r\n\r\n getAvailableActions(): ConfigurableOperationDefinition[] {\r\n return this.allActions.filter(o => !this.actions.find(a => a.code === o.code));\r\n }\r\n\r\n getActionDefinition(action: ConfigurableOperation): ConfigurableOperationDefinition | undefined {\r\n return this.allActions.find(c => c.code === action.code);\r\n }\r\n\r\n saveButtonEnabled(): boolean {\r\n return (\r\n this.detailForm.dirty &&\r\n this.detailForm.valid &&\r\n (this.conditions.length !== 0 || this.detailForm.value.couponCode) &&\r\n this.actions.length !== 0\r\n );\r\n }\r\n\r\n addCondition(condition: ConfigurableOperation) {\r\n this.addOperation('conditions', condition);\r\n this.detailForm.markAsDirty();\r\n }\r\n\r\n addAction(action: ConfigurableOperation) {\r\n this.addOperation('actions', action);\r\n this.detailForm.markAsDirty();\r\n }\r\n\r\n removeCondition(condition: ConfigurableOperation) {\r\n this.removeOperation('conditions', condition);\r\n this.detailForm.markAsDirty();\r\n }\r\n\r\n removeAction(action: ConfigurableOperation) {\r\n this.removeOperation('actions', action);\r\n this.detailForm.markAsDirty();\r\n }\r\n\r\n formArrayOf(key: 'conditions' | 'actions'): FormArray {\r\n return this.detailForm.get(key) as FormArray;\r\n }\r\n\r\n create() {\r\n if (!this.detailForm.dirty) {\r\n return;\r\n }\r\n const formValue = this.detailForm.value;\r\n const input: CreatePromotionInput = {\r\n name: formValue.name,\r\n enabled: true,\r\n couponCode: formValue.couponCode,\r\n perCustomerUsageLimit: formValue.perCustomerUsageLimit,\r\n startsAt: formValue.startsAt,\r\n endsAt: formValue.endsAt,\r\n conditions: this.mapOperationsToInputs(this.conditions, formValue.conditions),\r\n actions: this.mapOperationsToInputs(this.actions, formValue.actions),\r\n customFields: formValue.customFields,\r\n };\r\n this.dataService.promotion.createPromotion(input).subscribe(\r\n ({ createPromotion }) => {\r\n switch (createPromotion.__typename) {\r\n case 'Promotion':\r\n this.notificationService.success(_('common.notify-create-success'), {\r\n entity: 'Promotion',\r\n });\r\n this.detailForm.markAsPristine();\r\n this.changeDetector.markForCheck();\r\n this.router.navigate(['../', createPromotion.id], { relativeTo: this.route });\r\n break;\r\n case 'MissingConditionsError':\r\n this.notificationService.error(createPromotion.message);\r\n break;\r\n }\r\n },\r\n err => {\r\n this.notificationService.error(_('common.notify-create-error'), {\r\n entity: 'Promotion',\r\n });\r\n },\r\n );\r\n }\r\n\r\n save() {\r\n if (!this.detailForm.dirty) {\r\n return;\r\n }\r\n const formValue = this.detailForm.value;\r\n this.promotion$\r\n .pipe(\r\n take(1),\r\n mergeMap(promotion => {\r\n const input: UpdatePromotionInput = {\r\n id: promotion.id,\r\n name: formValue.name,\r\n enabled: formValue.enabled,\r\n couponCode: formValue.couponCode,\r\n perCustomerUsageLimit: formValue.perCustomerUsageLimit,\r\n startsAt: formValue.startsAt,\r\n endsAt: formValue.endsAt,\r\n conditions: this.mapOperationsToInputs(this.conditions, formValue.conditions),\r\n actions: this.mapOperationsToInputs(this.actions, formValue.actions),\r\n customFields: formValue.customFields,\r\n };\r\n return this.dataService.promotion.updatePromotion(input);\r\n }),\r\n )\r\n .subscribe(\r\n data => {\r\n this.notificationService.success(_('common.notify-update-success'), {\r\n entity: 'Promotion',\r\n });\r\n this.detailForm.markAsPristine();\r\n this.changeDetector.markForCheck();\r\n },\r\n err => {\r\n this.notificationService.error(_('common.notify-update-error'), {\r\n entity: 'Promotion',\r\n });\r\n },\r\n );\r\n }\r\n\r\n /**\r\n * Update the form values when the entity changes.\r\n */\r\n protected setFormValues(entity: PromotionFragment, languageCode: LanguageCode): void {\r\n this.detailForm.patchValue({\r\n name: entity.name,\r\n enabled: entity.enabled,\r\n couponCode: entity.couponCode,\r\n perCustomerUsageLimit: entity.perCustomerUsageLimit,\r\n startsAt: entity.startsAt,\r\n endsAt: entity.endsAt,\r\n });\r\n entity.conditions.forEach(o => {\r\n this.addOperation('conditions', o);\r\n });\r\n entity.actions.forEach(o => this.addOperation('actions', o));\r\n if (this.customFields.length) {\r\n this.setCustomFieldFormValues(this.customFields, this.detailForm.get('customFields'), entity);\r\n }\r\n }\r\n\r\n /**\r\n * Maps an array of conditions or actions to the input format expected by the GraphQL API.\r\n */\r\n private mapOperationsToInputs(\r\n operations: ConfigurableOperation[],\r\n formValueOperations: any,\r\n ): ConfigurableOperationInput[] {\r\n return operations.map((o, i) => {\r\n return {\r\n code: o.code,\r\n arguments: Object.values<any>(formValueOperations[i].args).map((value, j) => ({\r\n name: o.args[j].name,\r\n value: encodeConfigArgValue(value),\r\n })),\r\n };\r\n });\r\n }\r\n\r\n /**\r\n * Adds a new condition or action to the promotion.\r\n */\r\n private addOperation(key: 'conditions' | 'actions', operation: ConfigurableOperation) {\r\n const operationsArray = this.formArrayOf(key);\r\n const collection = key === 'conditions' ? this.conditions : this.actions;\r\n const index = operationsArray.value.findIndex(o => o.code === operation.code);\r\n if (index === -1) {\r\n const argsHash = operation.args.reduce(\r\n (output, arg) => ({\r\n ...output,\r\n [arg.name]:\r\n getConfigArgValue(arg.value) ?? this.getDefaultArgValue(key, operation, arg.name),\r\n }),\r\n {},\r\n );\r\n operationsArray.push(\r\n this.formBuilder.control({\r\n code: operation.code,\r\n args: argsHash,\r\n }),\r\n );\r\n collection.push({\r\n code: operation.code,\r\n args: operation.args.map(a => ({ name: a.name, value: getConfigArgValue(a.value) })),\r\n });\r\n }\r\n }\r\n\r\n private getDefaultArgValue(\r\n key: 'conditions' | 'actions',\r\n operation: ConfigurableOperation,\r\n argName: string,\r\n ) {\r\n const def =\r\n key === 'conditions'\r\n ? this.allConditions.find(c => c.code === operation.code)\r\n : this.allActions.find(a => a.code === operation.code);\r\n if (def) {\r\n const argDef = def.args.find(a => a.name === argName);\r\n if (argDef) {\r\n return getDefaultConfigArgValue(argDef);\r\n }\r\n }\r\n throw new Error(`Could not determine default value for \"argName\"`);\r\n }\r\n\r\n /**\r\n * Removes a condition or action from the promotion.\r\n */\r\n private removeOperation(key: 'conditions' | 'actions', operation: ConfigurableOperation) {\r\n const operationsArray = this.formArrayOf(key);\r\n const collection = key === 'conditions' ? this.conditions : this.actions;\r\n const index = operationsArray.value.findIndex(o => o.code === operation.code);\r\n if (index !== -1) {\r\n operationsArray.removeAt(index);\r\n collection.splice(index, 1);\r\n }\r\n }\r\n}\r\n","<vdr-action-bar>\r\n <vdr-ab-left>\r\n <form class=\"search-form\" [formGroup]=\"searchForm\">\r\n <input\r\n type=\"text\"\r\n formControlName=\"name\"\r\n [placeholder]=\"'marketing.search-by-name' | translate\"\r\n class=\"search-input\"\r\n />\r\n <input\r\n type=\"text\"\r\n formControlName=\"couponCode\"\r\n [placeholder]=\"'marketing.search-by-coupon-code' | translate\"\r\n class=\"search-input\"\r\n />\r\n </form>\r\n </vdr-ab-left>\r\n <vdr-ab-right>\r\n <vdr-action-bar-items locationId=\"promotion-list\"></vdr-action-bar-items>\r\n <a class=\"btn btn-primary\"\r\n *vdrIfPermissions=\"'CreatePromotion'\"\r\n [routerLink]=\"['./create']\">\r\n <clr-icon shape=\"plus\"></clr-icon>\r\n {{ 'marketing.create-new-promotion' | translate }}\r\n </a>\r\n </vdr-ab-right>\r\n</vdr-action-bar>\r\n\r\n<vdr-data-table\r\n [items]=\"items$ | async\"\r\n [itemsPerPage]=\"itemsPerPage$ | async\"\r\n [totalItems]=\"totalItems$ | async\"\r\n [currentPage]=\"currentPage$ | async\"\r\n (pageChange)=\"setPageNumber($event)\"\r\n (itemsPerPageChange)=\"setItemsPerPage($event)\"\r\n>\r\n <vdr-dt-column>{{ 'common.name' | translate }}</vdr-dt-column>\r\n <vdr-dt-column>{{ 'marketing.coupon-code' | translate }}</vdr-dt-column>\r\n <vdr-dt-column>{{ 'marketing.starts-at' | translate }}</vdr-dt-column>\r\n <vdr-dt-column>{{ 'marketing.ends-at' | translate }}</vdr-dt-column>\r\n <vdr-dt-column></vdr-dt-column>\r\n <vdr-dt-column></vdr-dt-column>\r\n <vdr-dt-column></vdr-dt-column>\r\n <ng-template let-promotion=\"item\">\r\n <td class=\"left align-middle\">{{ promotion.name }}</td>\r\n <td class=\"left align-middle\">\r\n <vdr-chip *ngIf=\"promotion.couponCode\">\r\n {{ promotion.couponCode }}\r\n </vdr-chip>\r\n </td>\r\n <td class=\"left align-middle\">{{ promotion.startsAt | localeDate: 'longDate' }}</td>\r\n <td class=\"left align-middle\">{{ promotion.endsAt | localeDate: 'longDate' }}</td>\r\n <td class=\"align-middle\">\r\n <vdr-chip *ngIf=\"!promotion.enabled\">{{ 'common.disabled' | translate }}</vdr-chip>\r\n </td>\r\n <td class=\"right align-middle\">\r\n <vdr-table-row-action\r\n iconShape=\"edit\"\r\n [label]=\"'common.edit' | translate\"\r\n [linkTo]=\"['./', promotion.id]\"\r\n ></vdr-table-row-action>\r\n </td>\r\n <td class=\"right align-middle\">\r\n <vdr-dropdown>\r\n <button type=\"button\" class=\"btn btn-link btn-sm\" vdrDropdownTrigger>\r\n {{ 'common.actions' | translate }}\r\n <clr-icon shape=\"caret down\"></clr-icon>\r\n </button>\r\n <vdr-dropdown-menu vdrPosition=\"bottom-right\">\r\n <button\r\n type=\"button\"\r\n class=\"delete-button\"\r\n (click)=\"deletePromotion(promotion.id)\"\r\n [disabled]=\"!('DeletePromotion' | hasPermission)\"\r\n vdrDropdownItem\r\n >\r\n <clr-icon shape=\"trash\" class=\"is-danger\"></clr-icon>\r\n {{ 'common.delete' | translate }}\r\n </button>\r\n </vdr-dropdown-menu>\r\n </vdr-dropdown>\r\n </td>\r\n </ng-template>\r\n</vdr-data-table>\r\n","import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';\r\nimport { FormControl, FormGroup } from '@angular/forms';\r\nimport { ActivatedRoute, Router } from '@angular/router';\r\nimport { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';\r\nimport {\r\n BaseListComponent,\r\n DataService,\r\n GetPromotionListQuery,\r\n ItemOf,\r\n ModalService,\r\n NotificationService,\r\n PromotionFilterParameter,\r\n PromotionListOptions,\r\n} from '@vendure/admin-ui/core';\r\nimport { EMPTY, merge } from 'rxjs';\r\nimport { debounceTime, switchMap, takeUntil } from 'rxjs/operators';\r\n\r\nexport type PromotionSearchForm = {\r\n name: string;\r\n couponCode: string;\r\n};\r\n\r\n@Component({\r\n selector: 'vdr-promotion-list',\r\n templateUrl: './promotion-list.component.html',\r\n styleUrls: ['./promotion-list.component.scss'],\r\n changeDetection: ChangeDetectionStrategy.OnPush,\r\n})\r\nexport class PromotionListComponent\r\n extends BaseListComponent<GetPromotionListQuery, ItemOf<GetPromotionListQuery, 'promotions'>>\r\n implements OnInit\r\n{\r\n searchForm = new FormGroup({\r\n name: new FormControl(''),\r\n couponCode: new FormControl(''),\r\n });\r\n\r\n constructor(\r\n private dataService: DataService,\r\n router: Router,\r\n route: ActivatedRoute,\r\n private notificationService: NotificationService,\r\n private modalService: ModalService,\r\n ) {\r\n super(router, route);\r\n super.setQueryFn(\r\n (...args: any[]) => this.dataService.promotion.getPromotions(...args).refetchOnChannelChange(),\r\n data => data.promotions,\r\n (skip, take) => this.createQueryOptions(skip, take, this.searchForm.value),\r\n );\r\n }\r\n\r\n ngOnInit(): void {\r\n super.ngOnInit();\r\n\r\n merge(this.searchForm.valueChanges.pipe(debounceTime(250)), this.route.queryParamMap)\r\n .pipe(takeUntil(this.destroy$))\r\n .subscribe(val => {\r\n if (!val.params) {\r\n this.setPageNumber(1);\r\n }\r\n this.refresh();\r\n });\r\n }\r\n\r\n deletePromotion(promotionId: string) {\r\n this.modalService\r\n .dialog({\r\n title: _('catalog.confirm-delete-promotion'),\r\n buttons: [\r\n { type: 'secondary', label: _('common.cancel') },\r\n { type: 'danger', label: _('common.delete'), returnValue: true },\r\n ],\r\n })\r\n .pipe(\r\n switchMap(response =>\r\n response ? this.dataService.promotion.deletePromotion(promotionId) : EMPTY,\r\n ),\r\n )\r\n .subscribe(\r\n () => {\r\n this.notificationService.success(_('common.notify-delete-success'), {\r\n entity: 'Promotion',\r\n });\r\n this.refresh();\r\n },\r\n err => {\r\n this.notificationService.error(_('common.notify-delete-error'), {\r\n entity: 'Promotion',\r\n });\r\n },\r\n );\r\n }\r\n\r\n private createQueryOptions(\r\n skip: number,\r\n take: number,\r\n searchForm: PromotionSearchForm,\r\n ): { options: PromotionListOptions } {\r\n const filter: PromotionFilterParameter = {};\r\n\r\n if (searchForm.couponCode) {\r\n filter.couponCode = { contains: searchForm.couponCode };\r\n }\r\n\r\n if (searchForm.name) {\r\n filter.name = { contains: searchForm.name };\r\n }\r\n\r\n return {\r\n options: {\r\n skip,\r\n take,\r\n filter,\r\n },\r\n };\r\n }\r\n}\r\n","import { Injectable } from '@angular/core';\r\nimport { Router } from '@angular/router';\r\nimport { BaseEntityResolver, DataService, PromotionFragment } from '@vendure/admin-ui/core';\r\n\r\n/**\r\n * Resolves the id from the path into a Customer entity.\r\n */\r\n@Injectable({\r\n providedIn: 'root',\r\n})\r\nexport class PromotionResolver extends BaseEntityResolver<PromotionFragment> {\r\n constructor(router: Router, dataService: DataService) {\r\n super(\r\n router,\r\n {\r\n __typename: 'Promotion',\r\n id: '',\r\n createdAt: '',\r\n updatedAt: '',\r\n name: '',\r\n enabled: false,\r\n conditions: [],\r\n actions: [],\r\n },\r\n id => dataService.promotion.getPromotion(id).mapStream(data => data.promotion),\r\n );\r\n }\r\n}\r\n","import { Route } from '@angular/router';\r\nimport { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';\r\nimport {\r\n CanDeactivateDetailGuard,\r\n createResolveData,\r\n detailBreadcrumb,\r\n PromotionFragment,\r\n} from '@vendure/admin-ui/core';\r\n\r\nimport { PromotionDetailComponent } from './components/promotion-detail/promotion-detail.component';\r\nimport { PromotionListComponent } from './components/promotion-list/promotion-list.component';\r\nimport { PromotionResolver } from './providers/routing/promotion-resolver';\r\n\r\nexport const marketingRoutes: Route[] = [\r\n {\r\n path: 'promotions',\r\n component: PromotionListComponent,\r\n data: {\r\n breadcrumb: _('breadcrumb.promotions'),\r\n },\r\n },\r\n {\r\n path: 'promotions/:id',\r\n component: PromotionDetailComponent,\r\n resolve: createResolveData(PromotionResolver),\r\n canDeactivate: [CanDeactivateDetailGuard],\r\n data: {\r\n breadcrumb: promotionBreadcrumb,\r\n },\r\n },\r\n];\r\n\r\nexport function promotionBreadcrumb(data: any, params: any) {\r\n return detailBreadcrumb<PromotionFragment>({\r\n entity: data.entity,\r\n id: params.id,\r\n breadcrumbKey: 'breadcrumb.promotions',\r\n getName: promotion => promotion.name,\r\n route: 'promotions',\r\n });\r\n}\r\n","import { NgModule } from '@angular/core';\r\nimport { RouterModule } from '@angular/router';\r\nimport { SharedModule } from '@vendure/admin-ui/core';\r\n\r\nimport { PromotionDetailComponent } from './components/promotion-detail/promotion-detail.component';\r\nimport { PromotionListComponent } from './components/promotion-list/promotion-list.component';\r\nimport { marketingRoutes } from './marketing.routes';\r\n\r\n@NgModule({\r\n imports: [SharedModule, RouterModule.forChild(marketingRoutes)],\r\n declarations: [PromotionListComponent, PromotionDetailComponent],\r\n})\r\nexport class MarketingModule {}\r\n"],"sourceRoot":"webpack:///","file":"239.a68e402e10b798f1.js"}
|