marketplacepos 3.10.0 → 3.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/Marketplace/{chunk-SOPDRQWM.js → chunk-223SSA62.js} +1 -1
  2. package/Marketplace/{chunk-SHX3JAGT.js → chunk-2HHCA3NK.js} +1 -1
  3. package/Marketplace/{chunk-L6CJT6UC.js → chunk-2OVWEFCG.js} +1 -1
  4. package/Marketplace/{chunk-FA44W5LU.js → chunk-2TS2HEE6.js} +1 -1
  5. package/Marketplace/{chunk-GR5OKYJS.js → chunk-3ZPC3DOZ.js} +1 -1
  6. package/Marketplace/{chunk-7MM3ONJ5.js → chunk-4R2X6SN5.js} +1 -1
  7. package/Marketplace/{chunk-SQR4ZRTF.js → chunk-5VJQDJRJ.js} +1 -1
  8. package/Marketplace/{chunk-WOHUGR5B.js → chunk-6C4L2S7S.js} +1 -1
  9. package/Marketplace/{chunk-L7Q6GF26.js → chunk-6NGKE364.js} +1 -1
  10. package/Marketplace/{chunk-YILL4GKX.js → chunk-6ORTAB6O.js} +1 -1
  11. package/Marketplace/{chunk-4PF4YRRT.js → chunk-7C4NOK37.js} +1 -1
  12. package/Marketplace/{chunk-I5POPG3M.js → chunk-7RZLTDIS.js} +1 -1
  13. package/Marketplace/{chunk-PNLW4YVH.js → chunk-B6BTNEL5.js} +1 -1
  14. package/Marketplace/{chunk-VCLTTDX7.js → chunk-C6SMFVRJ.js} +1 -1
  15. package/Marketplace/{chunk-XLZ3ZJTK.js → chunk-CCMD33HH.js} +1 -1
  16. package/Marketplace/{chunk-4HJGWXQ3.js → chunk-CD5AKGA4.js} +1 -1
  17. package/Marketplace/{chunk-NN3SPEH5.js → chunk-DDXVCGNF.js} +1 -1
  18. package/Marketplace/{chunk-WKDJS327.js → chunk-DG6KCZ24.js} +1 -1
  19. package/Marketplace/{chunk-UW4B35JC.js → chunk-DITYFI3U.js} +1 -1
  20. package/Marketplace/{chunk-XDU5GZAR.js → chunk-EJMJP3AQ.js} +2 -2
  21. package/Marketplace/{chunk-FBXFQ4G2.js → chunk-FGIAQ42H.js} +9 -9
  22. package/Marketplace/{chunk-32LBRSCJ.js → chunk-G7RXTLDR.js} +1 -1
  23. package/Marketplace/{chunk-7KXQRJHI.js → chunk-GK4USVUZ.js} +1 -1
  24. package/Marketplace/{chunk-3KM6M3SV.js → chunk-GRHKW2KQ.js} +1 -1
  25. package/Marketplace/{chunk-POSHHHMT.js → chunk-H6M6M4LW.js} +1 -1
  26. package/Marketplace/{chunk-LAEELPPC.js → chunk-I2G5J34U.js} +1 -1
  27. package/Marketplace/{chunk-HT7RDS3I.js → chunk-JN7U2QOU.js} +1 -1
  28. package/Marketplace/{chunk-O3IHPLVP.js → chunk-L3QJXWW4.js} +1 -1
  29. package/Marketplace/{chunk-SQGOM2WU.js → chunk-LPSC67EP.js} +1 -1
  30. package/Marketplace/{chunk-NJM2XHQY.js → chunk-M4MZ4PBS.js} +1 -1
  31. package/Marketplace/{chunk-6NPWPFG3.js → chunk-MB5EFAFQ.js} +1 -1
  32. package/Marketplace/{chunk-FDI2UIO2.js → chunk-MFWCFDSI.js} +1 -1
  33. package/Marketplace/{chunk-PZX3AESM.js → chunk-MIITW5F3.js} +1 -1
  34. package/Marketplace/{chunk-KB7PR6DP.js → chunk-MQ5YF2EQ.js} +1 -1
  35. package/Marketplace/{chunk-ZRFFM47Q.js → chunk-NNZ2QIAF.js} +1 -1
  36. package/Marketplace/{chunk-6D7NMKRE.js → chunk-NX7MGO3M.js} +1 -1
  37. package/Marketplace/{chunk-ULR2QT4D.js → chunk-NZ5PGMTU.js} +1 -1
  38. package/Marketplace/chunk-OZAOB2RM.js +1 -0
  39. package/Marketplace/{chunk-7RTQ2IDL.js → chunk-PHYOU4H6.js} +1 -1
  40. package/Marketplace/{chunk-WCQU2HIE.js → chunk-PIKZDDIU.js} +2 -2
  41. package/Marketplace/chunk-POHGR6GW.js +5 -0
  42. package/Marketplace/{chunk-ECAAF5I6.js → chunk-RS4FBR2B.js} +1 -1
  43. package/Marketplace/{chunk-3SVOLAII.js → chunk-RTSSYFK3.js} +1 -1
  44. package/Marketplace/{chunk-KPPQNI2R.js → chunk-TZRTEOJA.js} +1 -1
  45. package/Marketplace/{chunk-ZMC2DAP2.js → chunk-UYBYAC3J.js} +1 -1
  46. package/Marketplace/{chunk-TBOHCD6E.js → chunk-UZO2VDKA.js} +1 -1
  47. package/Marketplace/chunk-V3BUL62F.js +1 -0
  48. package/Marketplace/{chunk-OV2NRCQ5.js → chunk-V6IO53G5.js} +1 -1
  49. package/Marketplace/{chunk-RUB4SQ54.js → chunk-VA2Y75VY.js} +1 -1
  50. package/Marketplace/{chunk-2WK2VI24.js → chunk-VGBWD4JQ.js} +1 -1
  51. package/Marketplace/{chunk-ORA63EP5.js → chunk-VWCDA6IC.js} +1 -1
  52. package/Marketplace/{chunk-JYZZ37SG.js → chunk-WKWDPKZH.js} +1 -1
  53. package/Marketplace/{chunk-35L7AOGR.js → chunk-WTRYN5E5.js} +1 -1
  54. package/Marketplace/{chunk-OZKNF6S2.js → chunk-XT3VATZ2.js} +1 -1
  55. package/Marketplace/{chunk-P3IVG6BD.js → chunk-Y3MMZORK.js} +1 -1
  56. package/Marketplace/{chunk-YGL3QYTJ.js → chunk-YBOYS5WI.js} +1 -1
  57. package/Marketplace/{chunk-BLMEJMMZ.js → chunk-Z24AOV6E.js} +1 -1
  58. package/Marketplace/index.html +2 -2
  59. package/Marketplace/main-2KHAM5PJ.js +1 -0
  60. package/Marketplace/{styles-SUQABHBL.css → styles-U2EKFDJI.css} +1 -1
  61. package/package.json +1 -1
  62. package/Marketplace/chunk-LBQ2LOYA.js +0 -1
  63. package/Marketplace/chunk-QTQ6GNKJ.js +0 -5
  64. package/Marketplace/chunk-SUMLYFC7.js +0 -1
  65. package/Marketplace/main-525IC5TZ.js +0 -1
  66. /package/Marketplace/{chunk-ZKZWHDGN.js → chunk-NNG6BZAM.js} +0 -0
  67. /package/Marketplace/{chunk-OOD7TLAL.js → chunk-ODLFLX6Z.js} +0 -0
  68. /package/Marketplace/{chunk-4RJDBICZ.js → chunk-SDNS6DZW.js} +0 -0
  69. /package/Marketplace/{polyfills-ZMM4NOHE.js → polyfills-OPLU3AGL.js} +0 -0
@@ -1,2 +1,2 @@
1
- import{a as Ie,b as Me}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.0/Marketplace/chunk-WKDJS327.js";import{a as De}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.0/Marketplace/chunk-LAEELPPC.js";import{g as xe}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.0/Marketplace/chunk-KPPQNI2R.js";import{d as be,e as Te}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.0/Marketplace/chunk-SOPDRQWM.js";import{d as ye,j as Se}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.0/Marketplace/chunk-XDU5GZAR.js";import{a as ge}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.0/Marketplace/chunk-L6CJT6UC.js";import{A as w,q as A,s as D,t as O,z as E}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.0/Marketplace/chunk-SQR4ZRTF.js";import{_ as ve}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.0/Marketplace/chunk-NN3SPEH5.js";import{b as Ce,h as F,k as L,u as _e}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.0/Marketplace/chunk-FDI2UIO2.js";import{b as p,c as _}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.0/Marketplace/chunk-7RTQ2IDL.js";import{$ as oe,$a as l,Aa as M,B as ne,Fb as R,Ga as s,Gb as q,H as ie,Ha as g,Hb as ce,K as ae,La as J,Ob as W,Pa as Y,Qa as d,Ra as se,T as G,V as j,Wa as u,_b as pe,aa as le,ab as r,ac as x,bb as C,bc as U,c as $,ca as K,cb as V,db as N,ea as y,fa as re,fb as k,fc as me,hc as he,ic as fe,ja as v,jb as f,ka as I,lb as h,n as ee,q as te,qb as z,rb as c,sb as S,tb as T,xc as ue,yb as de}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.0/Marketplace/chunk-FA44W5LU.js";function Pe(o,n){if(o&1&&(l(0,"mat-option",9)(1,"div",10),C(2,"img",11),l(3,"span"),c(4),r()()()),o&2){let i=n.$implicit;d("value",i.ID)("disabled",i.disabled),s(1),d("matTooltip",i.disabled?"Single Product Scan disabled for this type of Channel":null),s(1),d("src",i.Img,M),s(2),S(i.Name)}}function Ve(o,n){if(o&1){let i=k();l(0,"div",12)(1,"label",13),c(2,"Scan Type"),r(),l(3,"mat-radio-group",14),f("ngModelChange",function(e){v(i);let a=h();return I(a.filter.ScanFull=e)}),l(4,"mat-radio-button",15),c(5," Full (Include Inactive Products) "),r(),l(6,"mat-radio-button",16),c(7," Active "),r()()()}if(o&2){let i=h();s(3),d("ngModel",i.filter.ScanFull),s(1),d("value",!0),s(2),d("value",!1)}}function Ne(o,n){if(o&1){let i=k();l(0,"div",17)(1,"label",3),c(2),R(3,"date"),r(),l(4,"mat-radio-group",18),f("ngModelChange",function(e){v(i);let a=h();return I(a.filter.UpdatedProduct=e)}),l(5,"mat-radio-button",19),c(6," Scan All Products "),r(),l(7,"mat-radio-button",20),c(8),r()()()}if(o&2){let i=h();s(2),T(" Last Scan: ",ce(3,6,i.selectedChannel.LastSync,"dd MMMM yyyy HH:mm")," "),s(2),d("ngModel",i.filter.UpdatedProduct),s(1),d("value",!1),s(2),d("value",!0)("matTooltip",i.selectedChannel.TypeID==i.channelType.Tokopedia?"Use Tokopedia URL for mapping SKU between POS and Tokopedia":"Scan only products that have been updated since the last channel scan"),s(1),T(" ",i.selectedChannel.TypeID==i.channelType.Tokopedia?"Product Download By URL":"Scan Updated Products"," ")}}function Ue(o,n){if(o&1){let i=k();l(0,"div",17)(1,"label",3),c(2," Scan Option "),r(),l(3,"mat-radio-group",21),f("ngModelChange",function(e){v(i);let a=h();return I(a.filter.Async=e)}),l(4,"mat-radio-button",22),c(5," Asynchronous (Get Notified when Complete) "),r(),l(6,"mat-radio-button",23),c(7," Synchronous (Wait until Complete) "),r()()()}if(o&2){let i=h();s(3),d("ngModel",i.filter.Async),s(1),d("value",!0),s(2),d("value",!1)}}var at=(()=>{let n=class n{constructor(t,e,a){this.dialogRef=t,this.data=e,this.router=a,this.channelType=p,this.disabledChannelOption=!1,this.filter={ChannelID:_.GuidEMpty,ScanFull:!0,UpdatedProduct:!1,Async:!1},this.isSingleChannel=_.IsNotEmpty(e.isSingleChannel)?this.data.isSingleChannel:!1,this.disabledChannelOption=_.IsEmpty(e.disabledChannelOption)?!1:this.data.disabledChannelOption}ngOnInit(){this.initChannelOptions(),this.initFilter(),this.onSelectChannel(this.data?.filter?.ChannelID),this.initModalConfig()}initModalConfig(){this.modalConfig=new E,this.modalConfig.title="Scan Marketplace",this.modalConfig.bodyScrollable=!0}initFilter(){this.filter.ChannelID=this.data?.filter?.ChannelID,this.filter.ScanFull=!1}initChannelOptions(){this.channelOptions=JSON.parse(JSON.stringify(this.data.channelOptions)),this.isSingleChannel&&(this.channelOptions=this.channelOptions.map(t=>(t.disabled=!0,(t.TypeID==p.Tiktok||t.TypeID==p.Tokopedia||t.TypeID==p.Lazada||t.TypeID==p.WooCommerce)&&(t.disabled=!1),t)).sort(t=>t.disabled?1:-1))}onSelectChannel(t){let e=this.filterChannelById(t);this.selectedChannel=e,this.filter.Async=!0,this.iniHasScanUpdate(),this.setDefaultConfigUpdate()}setDefaultConfigUpdate(){this.filter.UpdatedProduct=!1,this.selectedChannel&&_.IsNotEmpty(this.selectedChannel.LastSync)&&(this.selectedChannel.TypeID==p.Shopee||this.selectedChannel.TypeID==p.Tiktok||this.selectedChannel.TypeID==p.Lazada)&&(this.filter.UpdatedProduct=!0)}iniHasScanUpdate(){this.selectedChannel?.TypeID!=p.WooCommerce&&this.selectedChannel?.TypeID!=p.KalCare&&this.selectedChannel?.TypeID!=p.None&&_.IsNotEmpty(this.selectedChannel?.LastSync)&&!this.isSingleChannel?this.hasScanUpdate=!0:this.hasScanUpdate=!1}filterChannelById(t){let e;return this.channelOptions&&(e=this.channelOptions.find(a=>a.ID==t)),e}submit(){this.selectedChannel.TypeID==p.Tokopedia&&this.filter.UpdatedProduct?this.router.navigate(["/menu/products/download/by-url"]).then(()=>{this.dialogRef.close()}):(this.beforeSubmit(),this.dialogRef.close(this.filter))}beforeSubmit(){this.filter.UpdatedProduct&&(this.filter.Async=!1)}isNotEmpty(t){return _.IsNotEmpty(t)}onClose(){this.dialogRef.close()}};n.\u0275fac=function(e){return new(e||n)(g(D),g(O),g(ue))},n.\u0275cmp=y({type:n,selectors:[["app-scan-dialog"]],decls:11,vars:8,consts:[[3,"dynamicValidated","config","onOk","onClose","onCancel"],["content",""],[1,"mx-4"],[1,"mb-2","fw-bold"],["appearance","outline",1,"w-100"],["name","channelid","placeholder","Channel",1,"mat-select-channel",3,"disabled","ngModel","ngModelChange"],["class","channel-option",3,"value","disabled",4,"ngFor","ngForOf"],["class","mt-4",4,"ngIf"],["class","mt-8",4,"ngIf"],[1,"channel-option",3,"value","disabled"],["matTooltipPosition","above","matTooltipClass","custom-width-tooltip",3,"matTooltip"],[2,"width","18px","margin-right","10px",3,"src"],[1,"mt-4"],[1,"mb-2","fw-bold","mt-3"],["name","scanType",1,"form-control","h-100","round",3,"ngModel","ngModelChange"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above","matTooltip","Full Scan Product",1,"me-5",3,"value"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above","matTooltip","Only Active Product",1,"me-5",3,"value"],[1,"mt-8"],["name","ScanFull",1,"form-control","h-100","round",2,"line-height","2",3,"ngModel","ngModelChange"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above","matTooltip","Scan product from beginning ( use this if you haven't scanned at all)",1,"me-5",3,"value"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above",1,"me-5",3,"value","matTooltip"],["name","Async",1,"form-control","h-100","round",2,"line-height","2",3,"ngModel","ngModelChange"],["matTooltipClass","custom-width-tooltip","matTooltip","Scan is running in the background, status will be visible in the notification menu","matTooltipPosition","above",1,"me-5",3,"value"],[1,"me-5",3,"value"]],template:function(e,a){e&1&&(l(0,"modal-material",0),f("onOk",function(){return a.submit()})("onClose",function(){return a.onClose()})("onCancel",function(){return a.onClose()}),l(1,"div",1)(2,"div",2)(3,"label",3),c(4,"Select a Channel"),r(),l(5,"mat-form-field",4)(6,"mat-select",5),f("ngModelChange",function(b){return a.filter.ChannelID=b})("ngModelChange",function(b){return a.onSelectChannel(b)}),u(7,Pe,5,5,"mat-option",6),r()(),u(8,Ve,8,3,"div",7)(9,Ne,9,9,"div",8)(10,Ue,8,3,"div",8),r()()()),e&2&&(d("dynamicValidated",a.isNotEmpty(a.filter.ChannelID))("config",a.modalConfig),s(6),d("disabled",a.disabledChannelOption)("ngModel",a.filter.ChannelID),s(1),d("ngForOf",a.channelOptions),s(1),d("ngIf",!a.isSingleChannel&&a.isNotEmpty(a.filter.ChannelID)),s(1),d("ngIf",a.hasScanUpdate),s(1),d("ngIf",!(a.filter!=null&&a.filter.UpdatedProduct)&&!a.isSingleChannel&&a.isNotEmpty(a.filter.ChannelID)))},dependencies:[x,U,F,L,Ie,Me,xe,De,ve,A,w,me],encapsulation:2});let o=n;return o})();var P=function(o){return o.Tokopedia="https://seller.tokopedia.com",o.Shoope="https://seller.shopee.co.id",o.Tiktok="https://seller-id.tiktok.com",o.WooCommerce="https://woocommerce.dealpos.app",o.Lazada="https://sellercenter.lazada.co.id",o}(P||{});function Fe(o,n){if(o&1&&(V(0),l(1,"tr")(2,"td",11),c(3),r(),l(4,"td",11),c(5),r(),l(6,"td",12)(7,"p",13),c(8,"Product Not in Channel!"),r()()(),N()),o&2){let i=h().$implicit;s(3),T(" ",i==null?null:i.Model,""),s(2),T(" ",i==null?null:i.Code,"")}}function Le(o,n){if(o&1&&(l(0,"td",11),c(1),r()),o&2){let i=h(3).$implicit;Y("rowspan",i.Channel.length),s(1),T(" ",i==null?null:i.Model,"")}}function Ae(o,n){if(o&1&&(l(0,"td",11),c(1),r()),o&2){let i=h(3).$implicit;Y("rowspan",i.Channel.length),s(1),T(" ",i==null?null:i.Code,"")}}var $e=o=>({"is-disabled":o});function Re(o,n){if(o&1&&(l(0,"tr"),u(1,Le,2,2,"td",14)(2,Ae,2,2,"td",14),l(3,"td",11)(4,"div",15)(5,"a",16),C(6,"img",17),r(),l(7,"div",18),c(8),r()()(),l(9,"td",11),c(10),R(11,"number"),r(),l(12,"td",19),c(13),R(14,"number"),r(),l(15,"td",19)(16,"a",20),C(17,"i",21),l(18,"span",22),c(19,"Edit"),r()()()()),o&2){let i=n.$implicit,t=n.index,e=h(3);s(1),d("ngIf",t==0),s(1),d("ngIf",t==0),s(3),d("href",i.Url,M)("title",i.Title),s(1),d("src",e.getChannelLogo(i.TypeID),M),s(1),d("matTooltip",(i==null||i.Name==null?null:i.Name.length)>55?i==null?null:i.Name:""),s(1),T(" ",i.Name," "),s(2),S(q(11,12,i.Price)),s(3),S(q(14,14,i.Inventory)),s(3),d("href",e.getHyperlinkSellerCenter(i),M)("ngClass",de(16,$e,i.TypeID==e.channelType.KalCare))("matTooltip",i.TypeID!=e.channelType.KalCare?"Edit this product in Seller Center, inventory changes must be done via DEALPOS":"")}}function Be(o,n){if(o&1&&u(0,Re,20,18,"tr",8),o&2){let i=h().$implicit;d("ngForOf",i==null?null:i.Channel)}}function je(o,n){if(o&1&&(V(0),u(1,Fe,9,2,"ng-container",9)(2,Be,1,1,"ng-template",null,10,W),N()),o&2){let i=n.$implicit,t=z(3);s(1),d("ngIf",!i.Channel||i.Channel.length<1)("ngIfElse",t)}}var mt=(()=>{let n=class n{constructor(t,e){this.data=t,this.dialogRef=e,this.channelType=p,this.variants=t.variants,this.title=t.title}ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig=new E,this.modalConfig.title=this.data.title,this.modalConfig.bodyScrollable=!0,this.modalConfig.hideCancel=!0,this.modalConfig.hideOk=!0}getChannelLogo(t){return _.getChannelLogoByTypeId(t)}getHyperlinkSellerCenter(t){let e="javascript:void(0)";switch(t.TypeID){case p.Shopee:e=`${P.Shoope}/portal/product/${t.ChannelItemID}`;break;case p.Tiktok:e=`${P.Tiktok}/product/edit/${t.ChannelItemID}`;break;case p.Tokopedia:e=`${P.Tokopedia}/edit-product/${t.ChannelItemID}`;break;case p.WooCommerce:e=`${P.WooCommerce}/wp-admin/post.php?post=${t.ChannelItemID}&action=edit`;break;case p.Lazada:e=`${P.Lazada}/apps/product/publish?productId=${t.ChannelItemID}`;break}return e}};n.\u0275fac=function(e){return new(e||n)(g(O),g(D))},n.\u0275cmp=y({type:n,selectors:[["app-modal-variant"]],decls:22,vars:2,consts:[[3,"config","onCancel"],["content",""],[1,"table"],[1,"sticky-top-thead","variant-modal"],[1,"text-start","sticky-top"],["matTooltip","Variant from POS",1,"fas","fa-info-circle","ms-1"],["matTooltip","Product and Variant from each Channel",1,"fas","fa-info-circle","ms-1"],[1,"text-start","sticky-top",2,"width","0%"],[4,"ngFor","ngForOf"],[4,"ngIf","ngIfElse"],["printChannelModal",""],[1,"text-start"],["colspan","3",1,"text-center"],[1,"my-auto"],["class","text-start",4,"ngIf"],[1,"d-flex"],["target","_blank",1,"me-1",3,"href","title"],[2,"width","20px","height","20px",3,"src"],[1,"text-ellipsis","ps-2",2,"max-width","18vw",3,"matTooltip"],[1,"text-center"],["target","_blank",1,"btn","btn-small","btn-light","px-4","py-2",3,"href","ngClass","matTooltip"],[1,"fa-solid","fa-pencil","me-2",2,"font-size","10px"],[1,"fs-6"]],template:function(e,a){e&1&&(l(0,"modal-material",0),f("onCancel",function(){return a.dialogRef.close()}),l(1,"div",1)(2,"table",2)(3,"thead",3)(4,"tr")(5,"th",4),c(6," VARIANT "),l(7,"sup"),C(8,"i",5),r()(),l(9,"th",4),c(10,"SKU"),r(),l(11,"th",4),c(12," PRODUCT "),l(13,"sup"),C(14,"i",6),r()(),l(15,"th",4),c(16,"PRICE"),r(),l(17,"th",7),c(18,"INVENTORY"),r(),C(19,"th",4),r()(),l(20,"tbody"),u(21,je,4,2,"ng-container",8),r()()()()),e&2&&(d("config",a.modalConfig),s(21),d("ngForOf",a.variants))},dependencies:[pe,x,U,A,w,he],styles:[".mat-dialog-title[_ngcontent-%COMP%]{margin-bottom:0%;margin-left:24px}.sticky-top-thead[_ngcontent-%COMP%] th.sticky-top[_ngcontent-%COMP%]{top:0}.table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr.sticky-top[_ngcontent-%COMP%]{border:none!important;border-bottom:1px solid!important}table[_ngcontent-%COMP%] > thead[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%]{border-top:none!important;border-left:none!important;border-right:none!important}.table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{background-color:#fff!important}.sticky-top-thead.variant-modal[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:last-child:after{border-right:0px!important}.sticky-top-thead.variant-modal[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:first-child:before{border-left:0px!important}.sticky-top-thead.variant-modal[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:before{border-top:0px}a.is-disabled[_ngcontent-%COMP%]{color:gray;cursor:default}a.is-disabled[_ngcontent-%COMP%]:hover{text-decoration:none}"]});let o=n;return o})();var H=class{constructor(){this._input$=new $,this._destroy$=new $,this._loading=!1,this._bufferSize=50,this.data=[]}onSearch(){this._input$.pipe(ie(200),ae(),te(n=>(n&&(n=n.toLowerCase()),this.filterData(n))),ne(n=>n!==void 0),j(this._destroy$)).subscribe(n=>{this._dataBuffer=n.slice(0,this._bufferSize)})}onClear(){this._dataBuffer=this._data.slice(0,this._bufferSize)}filterData(n){let i=-1,t;return this._data.filter(a=>(t=JSON.stringify(a).toLowerCase(),i=t.indexOf(n),i!==-1||n==null))}get input$(){return this._input$}get bufferData(){return this._dataBuffer}get loading(){return this._loading}set data(n){this._data=n||[],this._dataBuffer=this._data.slice(0,this._bufferSize),this.onSearch()}initSelectedValue(n,i){if(_.IsNotEmpty(n)){let t=this._data.filter(e=>e[i].toString().toLowerCase().indexOf(n)!==-1);this._dataBuffer=t.slice(0,this._bufferSize)}}set bufferSize(n){this._bufferSize=n}onScrollToEnd(){this.fetchMore()}fetchMore(){let n=this._dataBuffer.length,i=this._data.slice(n,this._bufferSize+n);this._loading=!0,setTimeout(()=>{this._loading=!1,this._dataBuffer=this._dataBuffer.concat(i)},200)}destroy(){this._destroy$.next(!0),this._destroy$.complete()}};var we=(()=>{let n=class n{set items(t){this.ngSelectInfiniteScroll.data=t,this.ngSelectInfiniteScroll.initSelectedValue(this.selected,this.bindValue)}get selected(){return this._selected}set selected(t){this._selected=t,this.ngSelectInfiniteScroll.initSelectedValue(this.selected,this.bindValue)}constructor(){this.width="100%",this.clearable=!0,this.disabled=!1,this.ngSelectInfiniteScroll=new H,this.selectedChange=new J,this.selectedLabel=new J}onSelectChange(t){t?(this.selectedChange.emit(t[this.bindValue]),this.selectedLabel.emit(t[this.bindLabel])):(this.selectedChange.emit(null),this.selectedLabel.emit(null))}};n.\u0275fac=function(e){return new(e||n)},n.\u0275cmp=y({type:n,selectors:[["ng-select-infinite"]],inputs:{placeholder:"placeholder",bindValue:"bindValue",bindLabel:"bindLabel",width:"width",clearable:"clearable",parent:"parent",disabled:"disabled",items:"items",selected:"selected"},outputs:{selectedChange:"selectedChange",selectedLabel:"selectedLabel"},decls:1,vars:12,consts:[[3,"disabled","virtualScroll","typeahead","items","bindLabel","bindValue","placeholder","ngModel","clearable","appendTo","clear","scrollToEnd","change"]],template:function(e,a){e&1&&(l(0,"ng-select",0),f("clear",function(){return a.ngSelectInfiniteScroll.onClear()})("scrollToEnd",function(){return a.ngSelectInfiniteScroll.onScrollToEnd()})("change",function(b){return a.onSelectChange(b)}),r()),e&2&&(se("width",a.width),d("disabled",a.disabled)("virtualScroll",!0)("typeahead",a.ngSelectInfiniteScroll.input$)("items",a.ngSelectInfiniteScroll.bufferData)("bindLabel",a.bindLabel)("bindValue",a.bindValue)("placeholder",a.placeholder)("ngModel",a.selected)("clearable",a.clearable)("appendTo",a.parent))},dependencies:[be,F,L]});let o=n;return o})(),Ot=(()=>{let n=class n{};n.\u0275fac=function(e){return new(e||n)},n.\u0275mod=re({type:n}),n.\u0275inj=le({imports:[fe,Te,_e]});let o=n;return o})();var ke=(()=>{let n=class n{constructor(t,e){this.LocalData=t,this.httpService=e}getCategoriesByTypeId(t,e){return this.LocalData.getCategoriesByChannelType(t).pipe(G(a=>a!=null?ee(a):this._getCategoriesByTypeID(t,e)))}_getCategoriesByTypeID(t,e){let a={TypeID:t,ID:e};return this.httpService.post("/api/Channel/getCategoriesByTypeID",a).pipe(G(m=>this.LocalData.saveCategoriesByChannelType(m,t)))}};n.\u0275fac=function(e){return new(e||n)(K(Se),K(ge))},n.\u0275prov=oe({token:n,factory:n.\u0275fac,providedIn:"root"});let o=n;return o})();function He(o,n){if(o&1){let i=k();V(0),l(1,"ng-select-infinite",16),f("selectedChange",function(e){v(i);let a=h().index,m=h();return I(m.onSelectCategory(e,a))}),r(),N()}if(o&2){let i=h().$implicit;s(1),d("items",i.Categories)("clearable",!1)}}function Ge(o,n){if(o&1&&(l(0,"div",17),C(1,"input",18),r()),o&2){let i=h().$implicit,t=h();d("matTooltip",t.channelType.WooCommerce==i.TypeID||t.channelType.Shopify==i.TypeID?"":"Product Category is Harcoded, Please Change Product Category in Seller Center"),s(1),d("placeholder",t.getChannelCategory(i.TypeID))}}function Ke(o,n){if(o&1){let i=k();V(0),l(1,"tr")(2,"td",9)(3,"input",10),f("ngModelChange",function(e){let m=v(i).$implicit;return I(m.Selected=e)})("ngModelChange",function(){v(i);let e=h();return I(e.onSelectChannel())}),r()(),l(4,"td")(5,"div",11),C(6,"img",12),l(7,"span",13),c(8),r()()(),l(9,"td"),u(10,He,2,2,"ng-container",14)(11,Ge,2,2,"ng-template",null,15,W),r()(),N()}if(o&2){let i=n.$implicit,t=z(12);s(3),d("ngModel",i.Selected),s(3),d("src",i==null?null:i.Img,M)("alt",i.Name),s(2),S(i.Name),s(2),d("ngIf",i.Categories.length>0)("ngIfElse",t)}}var Lt=(()=>{let n=class n{constructor(t,e,a,m){this.data=t,this.channelService=e,this.dialogRef=a,this.toastrService=m,this.channelOptions=[],this.uploadResponse=[],this.channelType=p,this.enableBtnOk=!1,this.destroy$=new $,this.uploadResponse=[],this.channels=this.data.channels,this.product=t.product}ngOnInit(){this.initModalConfig(),this.initChannelOptions(),this.initCategories()}initModalConfig(){this.modalConfig=new E,this.modalConfig.title=this.data.title,this.modalConfig.bodyScrollable=!0}initCategories(){this.filterChannelTypeId().forEach(e=>{this.channelService.getCategoriesByTypeId(e.channelType,e.channelId).pipe(j(this.destroy$)).subscribe(a=>{this.setCategoriesChannelOption(e.channelType,a)})})}setCategoriesChannelOption(t,e){this.channelOptions=this.channelOptions.map(a=>(a.TypeID==t&&(a.Categories=e),a))}initChannelOptions(){this.channelOptions=this.channels.map(t=>({Name:t.Name,Img:t.Img,ID:t.ID,Selected:!1,CategoryID:this.initDefaultChannelCategoryId(t.TypeID),TypeID:t.TypeID,Categories:[]}))}initDefaultChannelCategoryId(t){let e=0;switch(t){case p.Lazada:e=6509;break}return e}filterChannelTypeId(){return this.data.channels.map(e=>({channelType:e.TypeID,channelId:e.ID})).filter((e,a,m)=>m.findIndex(b=>e.channelType==b.channelType)==a).filter(e=>e.channelType==p.Tokopedia)}onSelectCategory(t,e){this.channelOptions[e].CategoryID=t,this.channelOptions[e].Selected=!0,this.onSelectChannel()}onSelectAllChannel(t){this.channelOptions=this.channelOptions.map(e=>(e.Selected=t,e)),this.enableBtnOk=t}onSelectChannel(){this.enableBtnOk=this.hasSelectedChannel()}hasSelectedChannel(){return this.channelOptions.findIndex(t=>t.Selected)!==-1}onClose(){this.dialogRef.close()}onSave(){if(!this.validateSelectedCategory()){this.toastrService.warning("Category is required","Warning!");return}let t=this.channelOptions.filter(e=>e.Selected).map(e=>({CategoryID:e.CategoryID,ChannelID:e.ID}));this.dialogRef.close(t)}validateSelectedCategory(){return this.channelOptions.filter(e=>e.Selected).filter(e=>e.TypeID==p.Tokopedia).findIndex(e=>e.CategoryID==0)==-1}getChannelCategory(t){let e;switch(t){case p.Shopee:e="Aksesoris Fashion";break;case p.Tiktok:e="Aksesoris Fashion - Aksesoris Pakaian";break;case p.WooCommerce:e=this.product?.Category?this.product?.Category:"Following the category in POS";break;case p.Lazada:e="Fashion Accessories / Women Accessories / Others";break;case p.Shopify:e=this.product?.Category?this.product?.Category:"Following the category in POS";break;default:e="Unavailable Category"}return e}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}};n.\u0275fac=function(e){return new(e||n)(g(O),g(ke),g(D),g(ye))},n.\u0275cmp=y({type:n,selectors:[["app-modal-uploadMultiple-product"]],decls:15,vars:3,consts:[[3,"dynamicValidated","config","onOk","onClose","onCancel"],["content",""],[1,"table"],[1,"text-center",2,"width","6%"],["type","checkbox",3,"change"],[2,"width","30%"],[1,"fs-6"],[2,"width","60%"],[4,"ngFor","ngForOf"],[1,"text-center"],["type","checkbox",3,"ngModel","ngModelChange"],[1,"d-flex","align-items-center"],[1,"channelLogo-md",3,"src","alt"],[1,"ms-3","fs-6"],[4,"ngIf","ngIfElse"],["EMPTY",""],["bindValue","Key","bindLabel","Value","width","100%","parent","body","position","top","placeholder","Select Category",3,"items","clearable","selectedChange"],["matTooltipPosition","above","matTooltipClass","custom-width-tooltip",3,"matTooltip"],["type","text","disabled","",1,"form-control","rounded",2,"height","40px",3,"placeholder"]],template:function(e,a){e&1&&(l(0,"modal-material",0),f("onOk",function(){return a.onSave()})("onClose",function(){return a.onClose()})("onCancel",function(){return a.onClose()}),l(1,"div",1)(2,"table",2)(3,"thead")(4,"tr")(5,"th",3)(6,"input",4),f("change",function(b){return a.onSelectAllChannel(b.target.checked)}),r()(),l(7,"th",5)(8,"span",6),c(9,"CHANNEL"),r()(),l(10,"th",7)(11,"span",6),c(12,"CATEGORY"),r()()()(),l(13,"tbody"),u(14,Ke,13,6,"ng-container",8),r()()()()),e&2&&(d("dynamicValidated",a.enableBtnOk)("config",a.modalConfig),s(14),d("ngForOf",a.channelOptions))},dependencies:[x,U,Ce,F,L,A,w,we],styles:[`input[type=checkbox]{width:15px;height:15px}table>thead>tr{border-top:none!important;border-left:none!important;border-right:none!important}
1
+ import{a as Ie,b as Me}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-DG6KCZ24.js";import{a as De}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-I2G5J34U.js";import{g as xe}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-TZRTEOJA.js";import{d as be,e as Te}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-223SSA62.js";import{d as ye,j as Se}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-EJMJP3AQ.js";import{a as ge}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-2OVWEFCG.js";import{A as w,q as A,s as D,t as O,z as E}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-5VJQDJRJ.js";import{_ as ve}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-DDXVCGNF.js";import{b as Ce,h as F,k as L,u as _e}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-MFWCFDSI.js";import{b as p,c as _}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-PHYOU4H6.js";import{$ as oe,$a as l,Aa as M,B as ne,Fb as R,Ga as s,Gb as q,H as ie,Ha as g,Hb as ce,K as ae,La as J,Ob as W,Pa as Y,Qa as d,Ra as se,T as G,V as j,Wa as u,_b as pe,aa as le,ab as r,ac as x,bb as C,bc as U,c as $,ca as K,cb as V,db as N,ea as y,fa as re,fb as k,fc as me,hc as he,ic as fe,ja as v,jb as f,ka as I,lb as h,n as ee,q as te,qb as z,rb as c,sb as S,tb as T,xc as ue,yb as de}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-2TS2HEE6.js";function Pe(o,n){if(o&1&&(l(0,"mat-option",9)(1,"div",10),C(2,"img",11),l(3,"span"),c(4),r()()()),o&2){let i=n.$implicit;d("value",i.ID)("disabled",i.disabled),s(1),d("matTooltip",i.disabled?"Single Product Scan disabled for this type of Channel":null),s(1),d("src",i.Img,M),s(2),S(i.Name)}}function Ve(o,n){if(o&1){let i=k();l(0,"div",12)(1,"label",13),c(2,"Scan Type"),r(),l(3,"mat-radio-group",14),f("ngModelChange",function(e){v(i);let a=h();return I(a.filter.ScanFull=e)}),l(4,"mat-radio-button",15),c(5," Full (Include Inactive Products) "),r(),l(6,"mat-radio-button",16),c(7," Active "),r()()()}if(o&2){let i=h();s(3),d("ngModel",i.filter.ScanFull),s(1),d("value",!0),s(2),d("value",!1)}}function Ne(o,n){if(o&1){let i=k();l(0,"div",17)(1,"label",3),c(2),R(3,"date"),r(),l(4,"mat-radio-group",18),f("ngModelChange",function(e){v(i);let a=h();return I(a.filter.UpdatedProduct=e)}),l(5,"mat-radio-button",19),c(6," Scan All Products "),r(),l(7,"mat-radio-button",20),c(8),r()()()}if(o&2){let i=h();s(2),T(" Last Scan: ",ce(3,6,i.selectedChannel.LastSync,"dd MMMM yyyy HH:mm")," "),s(2),d("ngModel",i.filter.UpdatedProduct),s(1),d("value",!1),s(2),d("value",!0)("matTooltip",i.selectedChannel.TypeID==i.channelType.Tokopedia?"Use Tokopedia URL for mapping SKU between POS and Tokopedia":"Scan only products that have been updated since the last channel scan"),s(1),T(" ",i.selectedChannel.TypeID==i.channelType.Tokopedia?"Product Download By URL":"Scan Updated Products"," ")}}function Ue(o,n){if(o&1){let i=k();l(0,"div",17)(1,"label",3),c(2," Scan Option "),r(),l(3,"mat-radio-group",21),f("ngModelChange",function(e){v(i);let a=h();return I(a.filter.Async=e)}),l(4,"mat-radio-button",22),c(5," Asynchronous (Get Notified when Complete) "),r(),l(6,"mat-radio-button",23),c(7," Synchronous (Wait until Complete) "),r()()()}if(o&2){let i=h();s(3),d("ngModel",i.filter.Async),s(1),d("value",!0),s(2),d("value",!1)}}var at=(()=>{let n=class n{constructor(t,e,a){this.dialogRef=t,this.data=e,this.router=a,this.channelType=p,this.disabledChannelOption=!1,this.filter={ChannelID:_.GuidEMpty,ScanFull:!0,UpdatedProduct:!1,Async:!1},this.isSingleChannel=_.IsNotEmpty(e.isSingleChannel)?this.data.isSingleChannel:!1,this.disabledChannelOption=_.IsEmpty(e.disabledChannelOption)?!1:this.data.disabledChannelOption}ngOnInit(){this.initChannelOptions(),this.initFilter(),this.onSelectChannel(this.data?.filter?.ChannelID),this.initModalConfig()}initModalConfig(){this.modalConfig=new E,this.modalConfig.title="Scan Marketplace",this.modalConfig.bodyScrollable=!0}initFilter(){this.filter.ChannelID=this.data?.filter?.ChannelID,this.filter.ScanFull=!1}initChannelOptions(){this.channelOptions=JSON.parse(JSON.stringify(this.data.channelOptions)),this.isSingleChannel&&(this.channelOptions=this.channelOptions.map(t=>(t.disabled=!0,(t.TypeID==p.Tiktok||t.TypeID==p.Tokopedia||t.TypeID==p.Lazada||t.TypeID==p.WooCommerce)&&(t.disabled=!1),t)).sort(t=>t.disabled?1:-1))}onSelectChannel(t){let e=this.filterChannelById(t);this.selectedChannel=e,this.filter.Async=!0,this.iniHasScanUpdate(),this.setDefaultConfigUpdate()}setDefaultConfigUpdate(){this.filter.UpdatedProduct=!1,this.selectedChannel&&_.IsNotEmpty(this.selectedChannel.LastSync)&&(this.selectedChannel.TypeID==p.Shopee||this.selectedChannel.TypeID==p.Tiktok||this.selectedChannel.TypeID==p.Lazada)&&(this.filter.UpdatedProduct=!0)}iniHasScanUpdate(){this.selectedChannel?.TypeID!=p.WooCommerce&&this.selectedChannel?.TypeID!=p.KalCare&&this.selectedChannel?.TypeID!=p.None&&_.IsNotEmpty(this.selectedChannel?.LastSync)&&!this.isSingleChannel?this.hasScanUpdate=!0:this.hasScanUpdate=!1}filterChannelById(t){let e;return this.channelOptions&&(e=this.channelOptions.find(a=>a.ID==t)),e}submit(){this.selectedChannel.TypeID==p.Tokopedia&&this.filter.UpdatedProduct?this.router.navigate(["/menu/products/download/by-url"]).then(()=>{this.dialogRef.close()}):(this.beforeSubmit(),this.dialogRef.close(this.filter))}beforeSubmit(){this.filter.UpdatedProduct&&(this.filter.Async=!1)}isNotEmpty(t){return _.IsNotEmpty(t)}onClose(){this.dialogRef.close()}};n.\u0275fac=function(e){return new(e||n)(g(D),g(O),g(ue))},n.\u0275cmp=y({type:n,selectors:[["app-scan-dialog"]],decls:11,vars:8,consts:[[3,"dynamicValidated","config","onOk","onClose","onCancel"],["content",""],[1,"mx-4"],[1,"mb-2","fw-bold"],["appearance","outline",1,"w-100"],["name","channelid","placeholder","Channel",1,"mat-select-channel",3,"disabled","ngModel","ngModelChange"],["class","channel-option",3,"value","disabled",4,"ngFor","ngForOf"],["class","mt-4",4,"ngIf"],["class","mt-8",4,"ngIf"],[1,"channel-option",3,"value","disabled"],["matTooltipPosition","above","matTooltipClass","custom-width-tooltip",3,"matTooltip"],[2,"width","18px","margin-right","10px",3,"src"],[1,"mt-4"],[1,"mb-2","fw-bold","mt-3"],["name","scanType",1,"form-control","h-100","round",3,"ngModel","ngModelChange"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above","matTooltip","Full Scan Product",1,"me-5",3,"value"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above","matTooltip","Only Active Product",1,"me-5",3,"value"],[1,"mt-8"],["name","ScanFull",1,"form-control","h-100","round",2,"line-height","2",3,"ngModel","ngModelChange"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above","matTooltip","Scan product from beginning ( use this if you haven't scanned at all)",1,"me-5",3,"value"],["matTooltipClass","custom-width-tooltip","matTooltipPosition","above",1,"me-5",3,"value","matTooltip"],["name","Async",1,"form-control","h-100","round",2,"line-height","2",3,"ngModel","ngModelChange"],["matTooltipClass","custom-width-tooltip","matTooltip","Scan is running in the background, status will be visible in the notification menu","matTooltipPosition","above",1,"me-5",3,"value"],[1,"me-5",3,"value"]],template:function(e,a){e&1&&(l(0,"modal-material",0),f("onOk",function(){return a.submit()})("onClose",function(){return a.onClose()})("onCancel",function(){return a.onClose()}),l(1,"div",1)(2,"div",2)(3,"label",3),c(4,"Select a Channel"),r(),l(5,"mat-form-field",4)(6,"mat-select",5),f("ngModelChange",function(b){return a.filter.ChannelID=b})("ngModelChange",function(b){return a.onSelectChannel(b)}),u(7,Pe,5,5,"mat-option",6),r()(),u(8,Ve,8,3,"div",7)(9,Ne,9,9,"div",8)(10,Ue,8,3,"div",8),r()()()),e&2&&(d("dynamicValidated",a.isNotEmpty(a.filter.ChannelID))("config",a.modalConfig),s(6),d("disabled",a.disabledChannelOption)("ngModel",a.filter.ChannelID),s(1),d("ngForOf",a.channelOptions),s(1),d("ngIf",!a.isSingleChannel&&a.isNotEmpty(a.filter.ChannelID)),s(1),d("ngIf",a.hasScanUpdate),s(1),d("ngIf",!(a.filter!=null&&a.filter.UpdatedProduct)&&!a.isSingleChannel&&a.isNotEmpty(a.filter.ChannelID)))},dependencies:[x,U,F,L,Ie,Me,xe,De,ve,A,w,me],encapsulation:2});let o=n;return o})();var P=function(o){return o.Tokopedia="https://seller.tokopedia.com",o.Shoope="https://seller.shopee.co.id",o.Tiktok="https://seller-id.tiktok.com",o.WooCommerce="https://woocommerce.dealpos.app",o.Lazada="https://sellercenter.lazada.co.id",o}(P||{});function Fe(o,n){if(o&1&&(V(0),l(1,"tr")(2,"td",11),c(3),r(),l(4,"td",11),c(5),r(),l(6,"td",12)(7,"p",13),c(8,"Product Not in Channel!"),r()()(),N()),o&2){let i=h().$implicit;s(3),T(" ",i==null?null:i.Model,""),s(2),T(" ",i==null?null:i.Code,"")}}function Le(o,n){if(o&1&&(l(0,"td",11),c(1),r()),o&2){let i=h(3).$implicit;Y("rowspan",i.Channel.length),s(1),T(" ",i==null?null:i.Model,"")}}function Ae(o,n){if(o&1&&(l(0,"td",11),c(1),r()),o&2){let i=h(3).$implicit;Y("rowspan",i.Channel.length),s(1),T(" ",i==null?null:i.Code,"")}}var $e=o=>({"is-disabled":o});function Re(o,n){if(o&1&&(l(0,"tr"),u(1,Le,2,2,"td",14)(2,Ae,2,2,"td",14),l(3,"td",11)(4,"div",15)(5,"a",16),C(6,"img",17),r(),l(7,"div",18),c(8),r()()(),l(9,"td",11),c(10),R(11,"number"),r(),l(12,"td",19),c(13),R(14,"number"),r(),l(15,"td",19)(16,"a",20),C(17,"i",21),l(18,"span",22),c(19,"Edit"),r()()()()),o&2){let i=n.$implicit,t=n.index,e=h(3);s(1),d("ngIf",t==0),s(1),d("ngIf",t==0),s(3),d("href",i.Url,M)("title",i.Title),s(1),d("src",e.getChannelLogo(i.TypeID),M),s(1),d("matTooltip",(i==null||i.Name==null?null:i.Name.length)>55?i==null?null:i.Name:""),s(1),T(" ",i.Name," "),s(2),S(q(11,12,i.Price)),s(3),S(q(14,14,i.Inventory)),s(3),d("href",e.getHyperlinkSellerCenter(i),M)("ngClass",de(16,$e,i.TypeID==e.channelType.KalCare))("matTooltip",i.TypeID!=e.channelType.KalCare?"Edit this product in Seller Center, inventory changes must be done via DEALPOS":"")}}function Be(o,n){if(o&1&&u(0,Re,20,18,"tr",8),o&2){let i=h().$implicit;d("ngForOf",i==null?null:i.Channel)}}function je(o,n){if(o&1&&(V(0),u(1,Fe,9,2,"ng-container",9)(2,Be,1,1,"ng-template",null,10,W),N()),o&2){let i=n.$implicit,t=z(3);s(1),d("ngIf",!i.Channel||i.Channel.length<1)("ngIfElse",t)}}var mt=(()=>{let n=class n{constructor(t,e){this.data=t,this.dialogRef=e,this.channelType=p,this.variants=t.variants,this.title=t.title}ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig=new E,this.modalConfig.title=this.data.title,this.modalConfig.bodyScrollable=!0,this.modalConfig.hideCancel=!0,this.modalConfig.hideOk=!0}getChannelLogo(t){return _.getChannelLogoByTypeId(t)}getHyperlinkSellerCenter(t){let e="javascript:void(0)";switch(t.TypeID){case p.Shopee:e=`${P.Shoope}/portal/product/${t.ChannelItemID}`;break;case p.Tiktok:e=`${P.Tiktok}/product/edit/${t.ChannelItemID}`;break;case p.Tokopedia:e=`${P.Tokopedia}/edit-product/${t.ChannelItemID}`;break;case p.WooCommerce:e=`${P.WooCommerce}/wp-admin/post.php?post=${t.ChannelItemID}&action=edit`;break;case p.Lazada:e=`${P.Lazada}/apps/product/publish?productId=${t.ChannelItemID}`;break}return e}};n.\u0275fac=function(e){return new(e||n)(g(O),g(D))},n.\u0275cmp=y({type:n,selectors:[["app-modal-variant"]],decls:22,vars:2,consts:[[3,"config","onCancel"],["content",""],[1,"table"],[1,"sticky-top-thead","variant-modal"],[1,"text-start","sticky-top"],["matTooltip","Variant from POS",1,"fas","fa-info-circle","ms-1"],["matTooltip","Product and Variant from each Channel",1,"fas","fa-info-circle","ms-1"],[1,"text-start","sticky-top",2,"width","0%"],[4,"ngFor","ngForOf"],[4,"ngIf","ngIfElse"],["printChannelModal",""],[1,"text-start"],["colspan","3",1,"text-center"],[1,"my-auto"],["class","text-start",4,"ngIf"],[1,"d-flex"],["target","_blank",1,"me-1",3,"href","title"],[2,"width","20px","height","20px",3,"src"],[1,"text-ellipsis","ps-2",2,"max-width","18vw",3,"matTooltip"],[1,"text-center"],["target","_blank",1,"btn","btn-small","btn-light","px-4","py-2",3,"href","ngClass","matTooltip"],[1,"fa-solid","fa-pencil","me-2",2,"font-size","10px"],[1,"fs-6"]],template:function(e,a){e&1&&(l(0,"modal-material",0),f("onCancel",function(){return a.dialogRef.close()}),l(1,"div",1)(2,"table",2)(3,"thead",3)(4,"tr")(5,"th",4),c(6," VARIANT "),l(7,"sup"),C(8,"i",5),r()(),l(9,"th",4),c(10,"SKU"),r(),l(11,"th",4),c(12," PRODUCT "),l(13,"sup"),C(14,"i",6),r()(),l(15,"th",4),c(16,"PRICE"),r(),l(17,"th",7),c(18,"INVENTORY"),r(),C(19,"th",4),r()(),l(20,"tbody"),u(21,je,4,2,"ng-container",8),r()()()()),e&2&&(d("config",a.modalConfig),s(21),d("ngForOf",a.variants))},dependencies:[pe,x,U,A,w,he],styles:[".mat-dialog-title[_ngcontent-%COMP%]{margin-bottom:0%;margin-left:24px}.sticky-top-thead[_ngcontent-%COMP%] th.sticky-top[_ngcontent-%COMP%]{top:0}.table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] tr.sticky-top[_ngcontent-%COMP%]{border:none!important;border-bottom:1px solid!important}table[_ngcontent-%COMP%] > thead[_ngcontent-%COMP%] > tr[_ngcontent-%COMP%]{border-top:none!important;border-left:none!important;border-right:none!important}.table[_ngcontent-%COMP%] thead[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{background-color:#fff!important}.sticky-top-thead.variant-modal[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:last-child:after{border-right:0px!important}.sticky-top-thead.variant-modal[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:first-child:before{border-left:0px!important}.sticky-top-thead.variant-modal[_ngcontent-%COMP%] th[_ngcontent-%COMP%]:before{border-top:0px}a.is-disabled[_ngcontent-%COMP%]{color:gray;cursor:default}a.is-disabled[_ngcontent-%COMP%]:hover{text-decoration:none}"]});let o=n;return o})();var H=class{constructor(){this._input$=new $,this._destroy$=new $,this._loading=!1,this._bufferSize=50,this.data=[]}onSearch(){this._input$.pipe(ie(200),ae(),te(n=>(n&&(n=n.toLowerCase()),this.filterData(n))),ne(n=>n!==void 0),j(this._destroy$)).subscribe(n=>{this._dataBuffer=n.slice(0,this._bufferSize)})}onClear(){this._dataBuffer=this._data.slice(0,this._bufferSize)}filterData(n){let i=-1,t;return this._data.filter(a=>(t=JSON.stringify(a).toLowerCase(),i=t.indexOf(n),i!==-1||n==null))}get input$(){return this._input$}get bufferData(){return this._dataBuffer}get loading(){return this._loading}set data(n){this._data=n||[],this._dataBuffer=this._data.slice(0,this._bufferSize),this.onSearch()}initSelectedValue(n,i){if(_.IsNotEmpty(n)){let t=this._data.filter(e=>e[i].toString().toLowerCase().indexOf(n)!==-1);this._dataBuffer=t.slice(0,this._bufferSize)}}set bufferSize(n){this._bufferSize=n}onScrollToEnd(){this.fetchMore()}fetchMore(){let n=this._dataBuffer.length,i=this._data.slice(n,this._bufferSize+n);this._loading=!0,setTimeout(()=>{this._loading=!1,this._dataBuffer=this._dataBuffer.concat(i)},200)}destroy(){this._destroy$.next(!0),this._destroy$.complete()}};var we=(()=>{let n=class n{set items(t){this.ngSelectInfiniteScroll.data=t,this.ngSelectInfiniteScroll.initSelectedValue(this.selected,this.bindValue)}get selected(){return this._selected}set selected(t){this._selected=t,this.ngSelectInfiniteScroll.initSelectedValue(this.selected,this.bindValue)}constructor(){this.width="100%",this.clearable=!0,this.disabled=!1,this.ngSelectInfiniteScroll=new H,this.selectedChange=new J,this.selectedLabel=new J}onSelectChange(t){t?(this.selectedChange.emit(t[this.bindValue]),this.selectedLabel.emit(t[this.bindLabel])):(this.selectedChange.emit(null),this.selectedLabel.emit(null))}};n.\u0275fac=function(e){return new(e||n)},n.\u0275cmp=y({type:n,selectors:[["ng-select-infinite"]],inputs:{placeholder:"placeholder",bindValue:"bindValue",bindLabel:"bindLabel",width:"width",clearable:"clearable",parent:"parent",disabled:"disabled",items:"items",selected:"selected"},outputs:{selectedChange:"selectedChange",selectedLabel:"selectedLabel"},decls:1,vars:12,consts:[[3,"disabled","virtualScroll","typeahead","items","bindLabel","bindValue","placeholder","ngModel","clearable","appendTo","clear","scrollToEnd","change"]],template:function(e,a){e&1&&(l(0,"ng-select",0),f("clear",function(){return a.ngSelectInfiniteScroll.onClear()})("scrollToEnd",function(){return a.ngSelectInfiniteScroll.onScrollToEnd()})("change",function(b){return a.onSelectChange(b)}),r()),e&2&&(se("width",a.width),d("disabled",a.disabled)("virtualScroll",!0)("typeahead",a.ngSelectInfiniteScroll.input$)("items",a.ngSelectInfiniteScroll.bufferData)("bindLabel",a.bindLabel)("bindValue",a.bindValue)("placeholder",a.placeholder)("ngModel",a.selected)("clearable",a.clearable)("appendTo",a.parent))},dependencies:[be,F,L]});let o=n;return o})(),Ot=(()=>{let n=class n{};n.\u0275fac=function(e){return new(e||n)},n.\u0275mod=re({type:n}),n.\u0275inj=le({imports:[fe,Te,_e]});let o=n;return o})();var ke=(()=>{let n=class n{constructor(t,e){this.LocalData=t,this.httpService=e}getCategoriesByTypeId(t,e){return this.LocalData.getCategoriesByChannelType(t).pipe(G(a=>a!=null?ee(a):this._getCategoriesByTypeID(t,e)))}_getCategoriesByTypeID(t,e){let a={TypeID:t,ID:e};return this.httpService.post("/api/Channel/getCategoriesByTypeID",a).pipe(G(m=>this.LocalData.saveCategoriesByChannelType(m,t)))}};n.\u0275fac=function(e){return new(e||n)(K(Se),K(ge))},n.\u0275prov=oe({token:n,factory:n.\u0275fac,providedIn:"root"});let o=n;return o})();function He(o,n){if(o&1){let i=k();V(0),l(1,"ng-select-infinite",16),f("selectedChange",function(e){v(i);let a=h().index,m=h();return I(m.onSelectCategory(e,a))}),r(),N()}if(o&2){let i=h().$implicit;s(1),d("items",i.Categories)("clearable",!1)}}function Ge(o,n){if(o&1&&(l(0,"div",17),C(1,"input",18),r()),o&2){let i=h().$implicit,t=h();d("matTooltip",t.channelType.WooCommerce==i.TypeID||t.channelType.Shopify==i.TypeID?"":"Product Category is Harcoded, Please Change Product Category in Seller Center"),s(1),d("placeholder",t.getChannelCategory(i.TypeID))}}function Ke(o,n){if(o&1){let i=k();V(0),l(1,"tr")(2,"td",9)(3,"input",10),f("ngModelChange",function(e){let m=v(i).$implicit;return I(m.Selected=e)})("ngModelChange",function(){v(i);let e=h();return I(e.onSelectChannel())}),r()(),l(4,"td")(5,"div",11),C(6,"img",12),l(7,"span",13),c(8),r()()(),l(9,"td"),u(10,He,2,2,"ng-container",14)(11,Ge,2,2,"ng-template",null,15,W),r()(),N()}if(o&2){let i=n.$implicit,t=z(12);s(3),d("ngModel",i.Selected),s(3),d("src",i==null?null:i.Img,M)("alt",i.Name),s(2),S(i.Name),s(2),d("ngIf",i.Categories.length>0)("ngIfElse",t)}}var Lt=(()=>{let n=class n{constructor(t,e,a,m){this.data=t,this.channelService=e,this.dialogRef=a,this.toastrService=m,this.channelOptions=[],this.uploadResponse=[],this.channelType=p,this.enableBtnOk=!1,this.destroy$=new $,this.uploadResponse=[],this.channels=this.data.channels,this.product=t.product}ngOnInit(){this.initModalConfig(),this.initChannelOptions(),this.initCategories()}initModalConfig(){this.modalConfig=new E,this.modalConfig.title=this.data.title,this.modalConfig.bodyScrollable=!0}initCategories(){this.filterChannelTypeId().forEach(e=>{this.channelService.getCategoriesByTypeId(e.channelType,e.channelId).pipe(j(this.destroy$)).subscribe(a=>{this.setCategoriesChannelOption(e.channelType,a)})})}setCategoriesChannelOption(t,e){this.channelOptions=this.channelOptions.map(a=>(a.TypeID==t&&(a.Categories=e),a))}initChannelOptions(){this.channelOptions=this.channels.map(t=>({Name:t.Name,Img:t.Img,ID:t.ID,Selected:!1,CategoryID:this.initDefaultChannelCategoryId(t.TypeID),TypeID:t.TypeID,Categories:[]}))}initDefaultChannelCategoryId(t){let e=0;switch(t){case p.Lazada:e=6509;break}return e}filterChannelTypeId(){return this.data.channels.map(e=>({channelType:e.TypeID,channelId:e.ID})).filter((e,a,m)=>m.findIndex(b=>e.channelType==b.channelType)==a).filter(e=>e.channelType==p.Tokopedia)}onSelectCategory(t,e){this.channelOptions[e].CategoryID=t,this.channelOptions[e].Selected=!0,this.onSelectChannel()}onSelectAllChannel(t){this.channelOptions=this.channelOptions.map(e=>(e.Selected=t,e)),this.enableBtnOk=t}onSelectChannel(){this.enableBtnOk=this.hasSelectedChannel()}hasSelectedChannel(){return this.channelOptions.findIndex(t=>t.Selected)!==-1}onClose(){this.dialogRef.close()}onSave(){if(!this.validateSelectedCategory()){this.toastrService.warning("Category is required","Warning!");return}let t=this.channelOptions.filter(e=>e.Selected).map(e=>({CategoryID:e.CategoryID,ChannelID:e.ID}));this.dialogRef.close(t)}validateSelectedCategory(){return this.channelOptions.filter(e=>e.Selected).filter(e=>e.TypeID==p.Tokopedia).findIndex(e=>e.CategoryID==0)==-1}getChannelCategory(t){let e;switch(t){case p.Shopee:e="Aksesoris Fashion";break;case p.Tiktok:e="Aksesoris Fashion - Aksesoris Pakaian";break;case p.WooCommerce:e=this.product?.Category?this.product?.Category:"Following the category in POS";break;case p.Lazada:e="Fashion Accessories / Women Accessories / Others";break;case p.Shopify:e=this.product?.Category?this.product?.Category:"Following the category in POS";break;default:e="Unavailable Category"}return e}ngOnDestroy(){this.destroy$.next(!0),this.destroy$.complete()}};n.\u0275fac=function(e){return new(e||n)(g(O),g(ke),g(D),g(ye))},n.\u0275cmp=y({type:n,selectors:[["app-modal-uploadMultiple-product"]],decls:15,vars:3,consts:[[3,"dynamicValidated","config","onOk","onClose","onCancel"],["content",""],[1,"table"],[1,"text-center",2,"width","6%"],["type","checkbox",3,"change"],[2,"width","30%"],[1,"fs-6"],[2,"width","60%"],[4,"ngFor","ngForOf"],[1,"text-center"],["type","checkbox",3,"ngModel","ngModelChange"],[1,"d-flex","align-items-center"],[1,"channelLogo-md",3,"src","alt"],[1,"ms-3","fs-6"],[4,"ngIf","ngIfElse"],["EMPTY",""],["bindValue","Key","bindLabel","Value","width","100%","parent","body","position","top","placeholder","Select Category",3,"items","clearable","selectedChange"],["matTooltipPosition","above","matTooltipClass","custom-width-tooltip",3,"matTooltip"],["type","text","disabled","",1,"form-control","rounded",2,"height","40px",3,"placeholder"]],template:function(e,a){e&1&&(l(0,"modal-material",0),f("onOk",function(){return a.onSave()})("onClose",function(){return a.onClose()})("onCancel",function(){return a.onClose()}),l(1,"div",1)(2,"table",2)(3,"thead")(4,"tr")(5,"th",3)(6,"input",4),f("change",function(b){return a.onSelectAllChannel(b.target.checked)}),r()(),l(7,"th",5)(8,"span",6),c(9,"CHANNEL"),r()(),l(10,"th",7)(11,"span",6),c(12,"CATEGORY"),r()()()(),l(13,"tbody"),u(14,Ke,13,6,"ng-container",8),r()()()()),e&2&&(d("dynamicValidated",a.enableBtnOk)("config",a.modalConfig),s(14),d("ngForOf",a.channelOptions))},dependencies:[x,U,Ce,F,L,A,w,we],styles:[`input[type=checkbox]{width:15px;height:15px}table>thead>tr{border-top:none!important;border-left:none!important;border-right:none!important}
2
2
  `],encapsulation:2});let o=n;return o})();function Je(o,n){if(o&1&&(l(0,"tr")(1,"td"),c(2),r(),l(3,"td"),c(4),r()()),o&2){let i=n.$implicit;s(2),S(i==null?null:i.Name),s(2),S(i==null?null:i.ChannelVariationSKU)}}var Bt=(()=>{let n=class n{constructor(t,e){this.data=t,this.dialogRef=e}ngOnInit(){this.initModalConfig()}initModalConfig(){this.modalConfig=new E,this.modalConfig.title=this.data?.title,this.modalConfig.hideOk=!0,this.modalConfig.hideCancel=!0}};n.\u0275fac=function(e){return new(e||n)(g(O),g(D))},n.\u0275cmp=y({type:n,selectors:[["app-modal-variants"]],decls:11,vars:2,consts:[[3,"config","onCancel"],["content",""],[1,"table"],[1,"thead-light"],[4,"ngFor","ngForOf"]],template:function(e,a){e&1&&(l(0,"modal-material",0),f("onCancel",function(){return a.dialogRef.close()}),l(1,"div",1)(2,"table",2)(3,"thead",3)(4,"tr")(5,"th"),c(6,"Variant"),r(),l(7,"th"),c(8,"SKU"),r()()(),l(9,"tbody"),u(10,Je,5,2,"tr",4),r()()()()),e&2&&(d("config",a.modalConfig),s(10),d("ngForOf",a.data.variants))},dependencies:[x,w],styles:[".mat-dialog-title[_ngcontent-%COMP%]{margin-bottom:0%;margin-left:24px}"]});let o=n;return o})();export{at as a,mt as b,Ot as c,Lt as d,Bt as e};
@@ -0,0 +1 @@
1
+ import{a as h}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-GK4USVUZ.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-7C4NOK37.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-MIITW5F3.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-H6M6M4LW.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-V6IO53G5.js";import{b as u}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-GRHKW2KQ.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-TZRTEOJA.js";import{a as f}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-M4MZ4PBS.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-EJMJP3AQ.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-2OVWEFCG.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-2HHCA3NK.js";import{D as l}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-5VJQDJRJ.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-DDXVCGNF.js";import{u as d}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-MFWCFDSI.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-PHYOU4H6.js";import{Ac as m,aa as r,bb as c,ea as a,fa as i,ic as n,wc as s}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-2TS2HEE6.js";import"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-NNG6BZAM.js";var C=(()=>{let t=class t{constructor(){}};t.\u0275fac=function(e){return new(e||t)},t.\u0275cmp=a({type:t,selectors:[["app-report"]],decls:1,vars:0,template:function(e,O){e&1&&c(0,"router-outlet")},dependencies:[s],styles:["ul[_ngcontent-%COMP%] > li.dropdown-item[_ngcontent-%COMP%]{font-size:.6875rem!important}"]});let o=t;return o})();var y=[{path:"",component:C,children:[{path:"",redirectTo:"order",pathMatch:"full"},{path:"order",loadChildren:()=>import("https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-NX7MGO3M.js").then(o=>o.OrderModule),canActivate:[f]}]}],g=(()=>{let t=class t{};t.\u0275fac=function(e){return new(e||t)},t.\u0275mod=i({type:t}),t.\u0275inj=r({imports:[n,m.forChild(y)]});let o=t;return o})();var z=(()=>{let t=class t{};t.\u0275fac=function(e){return new(e||t)},t.\u0275mod=i({type:t}),t.\u0275inj=r({imports:[n,u,g,d,l,m,h]});let o=t;return o})();export{z as ReportModule};
@@ -1 +1 @@
1
- import{$ as y,A as z,E as F,I as H,Ja as Q,Jb as _,L as G,La as W,N as S,R as C,T as j,Va as X,X as V,aa as Y,ba as A,ca as d,d as g,da as P,fa as Z,ga as J,ia as q,m as f,n as c,q as v,s as p,t as I,w as M,xc as ee}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.0/Marketplace/chunk-FA44W5LU.js";import{a as m,b as O}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.0/Marketplace/chunk-ZKZWHDGN.js";var D={REMOVE:"remove",SHOW:"show"},ie=(()=>{let r=class r{constructor(){this.strategiesSource=new g({}),this.strategies$=this.strategiesSource.asObservable()}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})(),L=new A("USE_CONFIGURATION_STORE"),B=(()=>{let r=class r{constructor(e=!1,t){this.isolate=e,this.configurationStore=t,this.strategiesSource=this.isolate?new g({}):this.configurationStore.strategiesSource,this.strategies$=this.strategiesSource.asObservable(),this.onAuthorisedDefaultStrategy=this.isolate?void 0:this.configurationStore.onAuthorisedDefaultStrategy,this.onUnAuthorisedDefaultStrategy=this.isolate?void 0:this.configurationStore.onUnAuthorisedDefaultStrategy}setDefaultOnAuthorizedStrategy(e){this.isolate?this.onAuthorisedDefaultStrategy=this.getDefinedStrategy(e):(this.configurationStore.onAuthorisedDefaultStrategy=this.getDefinedStrategy(e),this.onAuthorisedDefaultStrategy=this.configurationStore.onAuthorisedDefaultStrategy)}setDefaultOnUnauthorizedStrategy(e){this.isolate?this.onUnAuthorisedDefaultStrategy=this.getDefinedStrategy(e):(this.configurationStore.onUnAuthorisedDefaultStrategy=this.getDefinedStrategy(e),this.onUnAuthorisedDefaultStrategy=this.configurationStore.onUnAuthorisedDefaultStrategy)}addPermissionStrategy(e,t){this.strategiesSource.value[e]=t}getStrategy(e){return this.strategiesSource.value[e]}getAllStrategies(){return this.strategiesSource.value}getDefinedStrategy(e){if(this.strategiesSource.value[e]||this.isPredefinedStrategy(e))return e;throw new Error(`No ' ${e} ' strategy is found please define one`)}isPredefinedStrategy(e){return e===D.SHOW||e===D.REMOVE}};r.\u0275fac=function(t){return new(t||r)(d(L),d(ie))},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})();function l(s){return typeof s=="function"}function K(s){if(Object.prototype.toString.call(s)!=="[object Object]")return!1;{let r=Object.getPrototypeOf(s);return r===null||r===Object.prototype}}function se(s){return!!s&&typeof s=="string"}function R(s){return typeof s=="boolean"}function ne(s){return Object.prototype.toString.call(s)==="[object Promise]"}function T(s){return Array.isArray(s)?s.length>0:!!s}function w(s){return se(s)?[s]:s}var re=(()=>{let r=class r{constructor(){this.permissionsSource=new g({}),this.permissions$=this.permissionsSource.asObservable()}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})(),$=new A("USE_PERMISSIONS_STORE"),E=(()=>{let r=class r{constructor(e=!1,t){this.isolate=e,this.permissionsStore=t,this.permissionsSource=this.isolate?new g({}):this.permissionsStore.permissionsSource,this.permissions$=this.permissionsSource.asObservable()}flushPermissions(){this.permissionsSource.next({})}hasPermission(e){return!e||Array.isArray(e)&&e.length===0?Promise.resolve(!0):(e=w(e),this.hasArrayPermission(e))}loadPermissions(e,t){let i=e.reduce((n,o)=>this.reducePermission(n,o,t),{});this.permissionsSource.next(i)}addPermission(e,t){if(Array.isArray(e)){let i=e.reduce((n,o)=>this.reducePermission(n,o,t),this.permissionsSource.value);this.permissionsSource.next(i)}else{let i=this.reducePermission(this.permissionsSource.value,e,t);this.permissionsSource.next(i)}}removePermission(e){let t=m({},this.permissionsSource.value);delete t[e],this.permissionsSource.next(t)}getPermission(e){return this.permissionsSource.value[e]}getPermissions(){return this.permissionsSource.value}reducePermission(e,t,i){return i&&l(i)?O(m({},e),{[t]:{name:t,validationFunction:i}}):O(m({},e),{[t]:{name:t}})}hasArrayPermission(e){let t=e.map(i=>{if(this.hasPermissionValidationFunction(i)){let n=this.permissionsSource.value[i].validationFunction,o=m({},this.permissionsSource.value);return c(null).pipe(v(()=>n(i,o)),j(h=>R(h)?c(h):h),F(()=>c(!1)))}return c(!!this.permissionsSource.value[i])});return f(t).pipe(I(),S(i=>i!==!1,!1),v(i=>i!==!1)).toPromise().then(i=>i)}hasPermissionValidationFunction(e){return!!this.permissionsSource.value[e]&&!!this.permissionsSource.value[e].validationFunction&&l(this.permissionsSource.value[e].validationFunction)}};r.\u0275fac=function(t){return new(t||r)(d($),d(re))},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})(),k=class{constructor(){this.rolesSource=new g({}),this.roles$=this.rolesSource.asObservable()}},N=new A("USE_ROLES_STORE"),b=(()=>{let r=class r{constructor(e=!1,t,i){this.isolate=e,this.rolesStore=t,this.permissionsService=i,this.rolesSource=this.isolate?new g({}):this.rolesStore.rolesSource,this.roles$=this.rolesSource.asObservable()}addRole(e,t){let i=O(m({},this.rolesSource.value),{[e]:{name:e,validationFunction:t}});this.rolesSource.next(i)}addRoleWithPermissions(e,t){this.permissionsService.addPermission(t),this.addRole(e,t)}addRoles(e){Object.keys(e).forEach((t,i)=>{this.addRole(t,e[t])})}addRolesWithPermissions(e){Object.keys(e).forEach((t,i)=>{this.addRoleWithPermissions(t,e[t])})}flushRoles(){this.rolesSource.next({})}flushRolesAndPermissions(){this.flushRoles(),this.permissionsService.flushPermissions()}removeRole(e){let t=m({},this.rolesSource.value);delete t[e],this.rolesSource.next(t)}getRoles(){return this.rolesSource.value}getRole(e){return this.rolesSource.value[e]}hasOnlyRoles(e){return!e||Array.isArray(e)&&e.length===0?Promise.resolve(!0):(e=w(e),Promise.all([this.hasRoleKey(e),this.hasRolePermission(this.rolesSource.value,e)]).then(([i,n])=>i||n))}hasRoleKey(e){let t=e.map(i=>{if(!!this.rolesSource.value[i]&&!!this.rolesSource.value[i].validationFunction&&l(this.rolesSource.value[i].validationFunction)&&!ne(this.rolesSource.value[i].validationFunction)){let o=this.rolesSource.value[i].validationFunction,h=m({},this.rolesSource.value);return c(null).pipe(v(()=>o(i,h)),j(x=>R(x)?c(x):x),F(()=>c(!1)))}return c(!1)});return f(t).pipe(I(),S(i=>i!==!1,!1),v(i=>i!==!1)).toPromise().then(i=>i)}hasRolePermission(e,t){return f(t).pipe(p(i=>e[i]&&Array.isArray(e[i].validationFunction)?f(e[i].validationFunction).pipe(p(n=>this.permissionsService.hasPermission(n)),G(n=>n===!0)):c(!1)),S(i=>i===!0,!1)).toPromise()}};r.\u0275fac=function(t){return new(t||r)(d(N),d(k),d(E))},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})(),Pe=(()=>{let r=class r{constructor(){this.permissionsAuthorized=new W,this.permissionsUnauthorized=new W,this.firstMergeUnusedRun=1,this.permissionsService=P(E),this.configurationService=P(B),this.rolesService=P(b),this.viewContainer=P(X),this.changeDetector=P(Q),this.templateRef=P(_)}ngOnInit(){this.viewContainer.clear(),this.initPermissionSubscription=this.validateExceptOnlyPermissions()}ngOnChanges(e){let t=e.ngxPermissionsOnly,i=e.ngxPermissionsExcept;if(t||i){if(t&&t.firstChange||i&&i.firstChange)return;z(this.permissionsService.permissions$,this.rolesService.roles$).pipe(C(this.firstMergeUnusedRun),H(1)).subscribe(()=>{if(T(this.ngxPermissionsExcept)){this.validateExceptAndOnlyPermissions();return}if(T(this.ngxPermissionsOnly)){this.validateOnlyPermissions();return}this.handleAuthorisedPermission(this.getAuthorisedTemplates())})}}ngOnDestroy(){this.initPermissionSubscription&&this.initPermissionSubscription.unsubscribe()}validateExceptOnlyPermissions(){return z(this.permissionsService.permissions$,this.rolesService.roles$).pipe(C(this.firstMergeUnusedRun)).subscribe(()=>{if(T(this.ngxPermissionsExcept)){this.validateExceptAndOnlyPermissions();return}if(T(this.ngxPermissionsOnly)){this.validateOnlyPermissions();return}this.handleAuthorisedPermission(this.getAuthorisedTemplates())})}validateExceptAndOnlyPermissions(){Promise.all([this.permissionsService.hasPermission(this.ngxPermissionsExcept),this.rolesService.hasOnlyRoles(this.ngxPermissionsExcept)]).then(([e,t])=>{if(e||t){this.handleUnauthorisedPermission(this.ngxPermissionsExceptElse||this.ngxPermissionsElse);return}if(this.ngxPermissionsOnly)throw!1;this.handleAuthorisedPermission(this.ngxPermissionsExceptThen||this.ngxPermissionsThen||this.templateRef)}).catch(()=>{this.ngxPermissionsOnly?this.validateOnlyPermissions():this.handleAuthorisedPermission(this.ngxPermissionsExceptThen||this.ngxPermissionsThen||this.templateRef)})}validateOnlyPermissions(){Promise.all([this.permissionsService.hasPermission(this.ngxPermissionsOnly),this.rolesService.hasOnlyRoles(this.ngxPermissionsOnly)]).then(([e,t])=>{e||t?this.handleAuthorisedPermission(this.ngxPermissionsOnlyThen||this.ngxPermissionsThen||this.templateRef):this.handleUnauthorisedPermission(this.ngxPermissionsOnlyElse||this.ngxPermissionsElse)}).catch(()=>{this.handleUnauthorisedPermission(this.ngxPermissionsOnlyElse||this.ngxPermissionsElse)})}handleUnauthorisedPermission(e){if(!(R(this.currentAuthorizedState)&&!this.currentAuthorizedState)){if(this.currentAuthorizedState=!1,this.permissionsUnauthorized.emit(),this.getUnAuthorizedStrategyInput()){this.applyStrategyAccordingToStrategyType(this.getUnAuthorizedStrategyInput());return}this.configurationService.onUnAuthorisedDefaultStrategy&&!this.elseBlockDefined()?this.applyStrategy(this.configurationService.onUnAuthorisedDefaultStrategy):this.showTemplateBlockInView(e)}}handleAuthorisedPermission(e){if(!(R(this.currentAuthorizedState)&&this.currentAuthorizedState)){if(this.currentAuthorizedState=!0,this.permissionsAuthorized.emit(),this.getAuthorizedStrategyInput()){this.applyStrategyAccordingToStrategyType(this.getAuthorizedStrategyInput());return}this.configurationService.onAuthorisedDefaultStrategy&&!this.thenBlockDefined()?this.applyStrategy(this.configurationService.onAuthorisedDefaultStrategy):this.showTemplateBlockInView(e)}}applyStrategyAccordingToStrategyType(e){if(se(e)){this.applyStrategy(e);return}if(l(e)){this.showTemplateBlockInView(this.templateRef),e(this.templateRef);return}}showTemplateBlockInView(e){this.viewContainer.clear(),e&&(this.viewContainer.createEmbeddedView(e),this.changeDetector.markForCheck())}getAuthorisedTemplates(){return this.ngxPermissionsOnlyThen||this.ngxPermissionsExceptThen||this.ngxPermissionsThen||this.templateRef}elseBlockDefined(){return!!this.ngxPermissionsExceptElse||!!this.ngxPermissionsElse}thenBlockDefined(){return!!this.ngxPermissionsExceptThen||!!this.ngxPermissionsThen}getAuthorizedStrategyInput(){return this.ngxPermissionsOnlyAuthorisedStrategy||this.ngxPermissionsExceptAuthorisedStrategy||this.ngxPermissionsAuthorisedStrategy}getUnAuthorizedStrategyInput(){return this.ngxPermissionsOnlyUnauthorisedStrategy||this.ngxPermissionsExceptUnauthorisedStrategy||this.ngxPermissionsUnauthorisedStrategy}applyStrategy(e){if(e===D.SHOW){this.showTemplateBlockInView(this.templateRef);return}if(e===D.REMOVE){this.viewContainer.clear();return}let t=this.configurationService.getStrategy(e);this.showTemplateBlockInView(this.templateRef),t(this.templateRef)}};r.\u0275fac=function(t){return new(t||r)},r.\u0275dir=J({type:r,selectors:[["","ngxPermissionsOnly",""],["","ngxPermissionsExcept",""]],inputs:{ngxPermissionsOnly:"ngxPermissionsOnly",ngxPermissionsOnlyThen:"ngxPermissionsOnlyThen",ngxPermissionsOnlyElse:"ngxPermissionsOnlyElse",ngxPermissionsExcept:"ngxPermissionsExcept",ngxPermissionsExceptElse:"ngxPermissionsExceptElse",ngxPermissionsExceptThen:"ngxPermissionsExceptThen",ngxPermissionsThen:"ngxPermissionsThen",ngxPermissionsElse:"ngxPermissionsElse",ngxPermissionsOnlyAuthorisedStrategy:"ngxPermissionsOnlyAuthorisedStrategy",ngxPermissionsOnlyUnauthorisedStrategy:"ngxPermissionsOnlyUnauthorisedStrategy",ngxPermissionsExceptUnauthorisedStrategy:"ngxPermissionsExceptUnauthorisedStrategy",ngxPermissionsExceptAuthorisedStrategy:"ngxPermissionsExceptAuthorisedStrategy",ngxPermissionsUnauthorisedStrategy:"ngxPermissionsUnauthorisedStrategy",ngxPermissionsAuthorisedStrategy:"ngxPermissionsAuthorisedStrategy"},outputs:{permissionsAuthorized:"permissionsAuthorized",permissionsUnauthorized:"permissionsUnauthorized"},features:[q]});let s=r;return s})(),oe="default";var te=(()=>{let r=class r{constructor(e,t,i){this.permissionsService=e,this.rolesService=t,this.router=i}canActivate(e,t){return this.hasPermissions(e,t)}canActivateChild(e,t){return this.hasPermissions(e,t)}canLoad(e){return this.hasPermissions(e)}canMatch(e){return this.hasPermissions(e)}hasPermissions(e,t){let i=e&&e.data?e.data.permissions:{},n=this.transformPermission(i,e,t);return this.isParameterAvailable(n.except)?this.passingExceptPermissionsValidation(n,e,t):this.isParameterAvailable(n.only)?this.passingOnlyPermissionsValidation(n,e,t):!0}transformPermission(e,t,i){let n=l(e.only)?e.only(t,i):w(e.only),o=l(e.except)?e.except(t,i):w(e.except),h=e.redirectTo;return{only:n,except:o,redirectTo:h}}isParameterAvailable(e){return!!e&&e.length>0}passingExceptPermissionsValidation(e,t,i){if(e.redirectTo&&(l(e.redirectTo)||K(e.redirectTo)&&!this.isRedirectionWithParameters(e.redirectTo))){let n="";return f(e.except).pipe(p(o=>M([this.permissionsService.hasPermission(o),this.rolesService.hasOnlyRoles(o)]).pipe(V(h=>{h.every(U=>U===!1)||(n=o)}))),S(o=>o.some(h=>h===!0),!1),p(o=>n?(this.handleRedirectOfFailedPermission(e,n,t,i),c(!1)):!o&&e.only?this.onlyRedirectCheck(e,t,i):c(!o))).toPromise()}return Promise.all([this.permissionsService.hasPermission(e.except),this.rolesService.hasOnlyRoles(e.except)]).then(([n,o])=>n||o?(e.redirectTo&&this.redirectToAnotherRoute(e.redirectTo,t,i),!1):e.only?this.checkOnlyPermissions(e,t,i):!0)}redirectToAnotherRoute(e,t,i,n){let o=l(e)?e(n,t,i):e;if(this.isRedirectionWithParameters(o)){o.navigationCommands=this.transformNavigationCommands(o.navigationCommands,t,i),o.navigationExtras=this.transformNavigationExtras(o.navigationExtras,t,i),this.router.navigate(o.navigationCommands,o.navigationExtras);return}Array.isArray(o)?this.router.navigate(o):this.router.navigate([o])}isRedirectionWithParameters(e){return K(e)&&(!!e.navigationCommands||!!e.navigationExtras)}transformNavigationCommands(e,t,i){return l(e)?e(t,i):e}transformNavigationExtras(e,t,i){return l(e)?e(t,i):e}onlyRedirectCheck(e,t,i){let n="";return f(e.only).pipe(p(o=>M([this.permissionsService.hasPermission(o),this.rolesService.hasOnlyRoles(o)]).pipe(V(h=>{h.every(U=>U===!1)&&(n=o)}))),S(o=>l(e.redirectTo)?o.some(h=>h===!0):o.every(h=>h===!1),!1),p(o=>l(e.redirectTo)?o?c(!0):(this.handleRedirectOfFailedPermission(e,n,t,i),c(!1)):(n&&this.handleRedirectOfFailedPermission(e,n,t,i),c(!o)))).toPromise()}handleRedirectOfFailedPermission(e,t,i,n){this.isFailedPermissionPropertyOfRedirectTo(e,t)?this.redirectToAnotherRoute(e.redirectTo[t],i,n,t):l(e.redirectTo)?this.redirectToAnotherRoute(e.redirectTo,i,n,t):this.redirectToAnotherRoute(e.redirectTo[oe],i,n,t)}isFailedPermissionPropertyOfRedirectTo(e,t){return!!e.redirectTo&&e.redirectTo[t]}checkOnlyPermissions(e,t,i){let n=m({},e);return Promise.all([this.permissionsService.hasPermission(n.only),this.rolesService.hasOnlyRoles(n.only)]).then(([o,h])=>o||h?!0:(n.redirectTo&&this.redirectToAnotherRoute(n.redirectTo,t,i),!1))}passingOnlyPermissionsValidation(e,t,i){return l(e.redirectTo)||K(e.redirectTo)&&!this.isRedirectionWithParameters(e.redirectTo)?this.onlyRedirectCheck(e,t,i):this.checkOnlyPermissions(e,t,i)}};r.\u0275fac=function(t){return new(t||r)(d(E),d(b),d(ee))},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})();var Se=(()=>{let r=class r{static forRoot(e={}){return{ngModule:r,providers:[re,k,ie,E,te,b,B,{provide:$,useValue:e.permissionsIsolate},{provide:N,useValue:e.rolesIsolate},{provide:L,useValue:e.configurationIsolate}]}}static forChild(e={}){return{ngModule:r,providers:[{provide:$,useValue:e.permissionsIsolate},{provide:N,useValue:e.rolesIsolate},{provide:L,useValue:e.configurationIsolate},B,E,b,te]}}};r.\u0275fac=function(t){return new(t||r)},r.\u0275mod=Z({type:r}),r.\u0275inj=Y({});let s=r;return s})();var u=function(s){return s.SHOOPE="https://res.cloudinary.com/pos/image/upload/v1598262220/icons/marketplace_icons/shopee.png",s.WOOCOMMERCE="https://res.cloudinary.com/pos/image/upload/w_50/v1632447439/icons/WooCommerce/woocommerce-icon.webp",s.TOKOPEDIA="https://res.cloudinary.com/pos/image/upload/v1598262221/icons/marketplace_icons/tokopedia.png",s.TIKTOK="https://res.cloudinary.com/pos/image/upload/w_30/v1645761611/icons/Marketplace%20logo/tiktok.png",s.LAZADA="https://res.cloudinary.com/pos/image/upload/v1680681836/icons/marketplace_icons/Lazadanew.png",s.KALCARE="https://res.cloudinary.com/pos/image/upload/v1654230268/icons/marketplace_icons/kalcare.png",s.SHOPIFY="https://res.cloudinary.com/pos/image/upload/v1707987435/icons/marketplace_icons/shopify.png",s}(u||{});var a=function(s){return s[s.Tokopedia=1]="Tokopedia",s[s.WooCommerce=2]="WooCommerce",s[s.None=3]="None",s[s.KalCare=4]="KalCare",s[s.Shopee=5]="Shopee",s[s.Tiktok=6]="Tiktok",s[s.Lazada=7]="Lazada",s[s.Shopify=8]="Shopify",s}(a||{});var De=(()=>{let r=class r{static IsNotEmpty(e){return e!=""&&e!=r.GuidEMpty&&e!=null&&e!=null}static IsEmpty(e){return e==""||e==null||e==null||e==r.GuidEMpty}static getChannelLogoByTypeId(e){let t;switch(e){case a.Tokopedia:t=u.TOKOPEDIA;break;case a.Shopee:t=u.SHOOPE;break;case a.WooCommerce:t=u.WOOCOMMERCE;break;case a.Lazada:t=u.LAZADA;break;case a.Tiktok:t=u.TIKTOK;break;case a.KalCare:t=u.KALCARE;break;case a.Shopify:t=u.SHOPIFY;break}return t}static getChannelLogoByName(e=""){e=e.toLowerCase();let t;switch(e){case"tokopedia":t=u.TOKOPEDIA;break;case"shoppe":t=u.SHOOPE;break;case"woocommerce":t=u.WOOCOMMERCE;break;case"tiktok":t=u.TIKTOK;break;case"lazada":t=u.LAZADA;break;case"kalCare":t=u.KALCARE;break}return t}static getChannelName(e){let t;switch(e){case a.Shopee:t="Shopee";break;case a.Tokopedia:t="Tokopedia";break;case a.Lazada:t="Lazada";break;case a.Tiktok:t="Tiktok";break;case a.WooCommerce:t="WooCommerce";break;case a.KalCare:t="WooCommerce";break}return t}static assignChannelLogo(e){return e=e.map(t=>(t.logo=this.getChannelLogoByTypeId(t.TypeID),t)),e}static getCssChannelColor(e){let t;switch(e){case a.Shopee:t="#ee4d2d";break;case a.Tokopedia:t="var(--G500,#03AC0E)";break;case a.Lazada:t="#FF00B2";break;case a.Tiktok:t="black";break;case a.WooCommerce:t="#674399";break;case a.KalCare:t="rgb(128, 188, 0)";break}return t}static getDaysDiff(e,t){var i=t.getTime()-e.getTime(),n=i/(1e3*60*60*24);return n}static addDays(e,t){let i=new Date(Number(e));return i.setDate(e.getDate()-t),i}static isValidDate(e){return e instanceof Date&&!isNaN(e)}static getImageInfo(e){return new Promise((t,i)=>{let n=new Image;n.src=e,n.decode().then(()=>{t({img:e,height:n.height,width:n.width})}).catch(()=>{i(new Error(`Image load error for ${e}`))})})}static formatTitleFromDate(e,t){let i=null,n=new Date(e),o=new Date(t);return n.getDate()!=o.getDate()&&(i="dd"),n.getMonth()!=o.getMonth()&&(i="dd MMM"),n.getFullYear()!=o.getFullYear()&&(i="dd MMM yyyy"),i}static openDownloadFile(e,t){var i=window.URL.createObjectURL(e),n=document.createElement("a");n.href=i,n.download=t,n.click()}static compare(e,t,i){return(e<t?-1:1)*(i?1:-1)}static isDateExpired(e){let t=new Date,i=!1;return e.getTime()<t.getTime()&&(i=!0),i}};r.GuidEMpty="00000000-0000-0000-0000-000000000000",r.MinDate="0001-01-01T00:00:00";let s=r;return s})();export{u as a,a as b,De as c,E as d,Pe as e,Se as f};
1
+ import{$ as y,A as z,E as F,I as H,Ja as Q,Jb as _,L as G,La as W,N as S,R as C,T as j,Va as X,X as V,aa as Y,ba as A,ca as d,d as g,da as P,fa as Z,ga as J,ia as q,m as f,n as c,q as v,s as p,t as I,w as M,xc as ee}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-2TS2HEE6.js";import{a as m,b as O}from"https://cdn.jsdelivr.net/npm/marketplacepos@3.10.2/Marketplace/chunk-NNG6BZAM.js";var D={REMOVE:"remove",SHOW:"show"},ie=(()=>{let r=class r{constructor(){this.strategiesSource=new g({}),this.strategies$=this.strategiesSource.asObservable()}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})(),L=new A("USE_CONFIGURATION_STORE"),B=(()=>{let r=class r{constructor(e=!1,t){this.isolate=e,this.configurationStore=t,this.strategiesSource=this.isolate?new g({}):this.configurationStore.strategiesSource,this.strategies$=this.strategiesSource.asObservable(),this.onAuthorisedDefaultStrategy=this.isolate?void 0:this.configurationStore.onAuthorisedDefaultStrategy,this.onUnAuthorisedDefaultStrategy=this.isolate?void 0:this.configurationStore.onUnAuthorisedDefaultStrategy}setDefaultOnAuthorizedStrategy(e){this.isolate?this.onAuthorisedDefaultStrategy=this.getDefinedStrategy(e):(this.configurationStore.onAuthorisedDefaultStrategy=this.getDefinedStrategy(e),this.onAuthorisedDefaultStrategy=this.configurationStore.onAuthorisedDefaultStrategy)}setDefaultOnUnauthorizedStrategy(e){this.isolate?this.onUnAuthorisedDefaultStrategy=this.getDefinedStrategy(e):(this.configurationStore.onUnAuthorisedDefaultStrategy=this.getDefinedStrategy(e),this.onUnAuthorisedDefaultStrategy=this.configurationStore.onUnAuthorisedDefaultStrategy)}addPermissionStrategy(e,t){this.strategiesSource.value[e]=t}getStrategy(e){return this.strategiesSource.value[e]}getAllStrategies(){return this.strategiesSource.value}getDefinedStrategy(e){if(this.strategiesSource.value[e]||this.isPredefinedStrategy(e))return e;throw new Error(`No ' ${e} ' strategy is found please define one`)}isPredefinedStrategy(e){return e===D.SHOW||e===D.REMOVE}};r.\u0275fac=function(t){return new(t||r)(d(L),d(ie))},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})();function l(s){return typeof s=="function"}function K(s){if(Object.prototype.toString.call(s)!=="[object Object]")return!1;{let r=Object.getPrototypeOf(s);return r===null||r===Object.prototype}}function se(s){return!!s&&typeof s=="string"}function R(s){return typeof s=="boolean"}function ne(s){return Object.prototype.toString.call(s)==="[object Promise]"}function T(s){return Array.isArray(s)?s.length>0:!!s}function w(s){return se(s)?[s]:s}var re=(()=>{let r=class r{constructor(){this.permissionsSource=new g({}),this.permissions$=this.permissionsSource.asObservable()}};r.\u0275fac=function(t){return new(t||r)},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})(),$=new A("USE_PERMISSIONS_STORE"),E=(()=>{let r=class r{constructor(e=!1,t){this.isolate=e,this.permissionsStore=t,this.permissionsSource=this.isolate?new g({}):this.permissionsStore.permissionsSource,this.permissions$=this.permissionsSource.asObservable()}flushPermissions(){this.permissionsSource.next({})}hasPermission(e){return!e||Array.isArray(e)&&e.length===0?Promise.resolve(!0):(e=w(e),this.hasArrayPermission(e))}loadPermissions(e,t){let i=e.reduce((n,o)=>this.reducePermission(n,o,t),{});this.permissionsSource.next(i)}addPermission(e,t){if(Array.isArray(e)){let i=e.reduce((n,o)=>this.reducePermission(n,o,t),this.permissionsSource.value);this.permissionsSource.next(i)}else{let i=this.reducePermission(this.permissionsSource.value,e,t);this.permissionsSource.next(i)}}removePermission(e){let t=m({},this.permissionsSource.value);delete t[e],this.permissionsSource.next(t)}getPermission(e){return this.permissionsSource.value[e]}getPermissions(){return this.permissionsSource.value}reducePermission(e,t,i){return i&&l(i)?O(m({},e),{[t]:{name:t,validationFunction:i}}):O(m({},e),{[t]:{name:t}})}hasArrayPermission(e){let t=e.map(i=>{if(this.hasPermissionValidationFunction(i)){let n=this.permissionsSource.value[i].validationFunction,o=m({},this.permissionsSource.value);return c(null).pipe(v(()=>n(i,o)),j(h=>R(h)?c(h):h),F(()=>c(!1)))}return c(!!this.permissionsSource.value[i])});return f(t).pipe(I(),S(i=>i!==!1,!1),v(i=>i!==!1)).toPromise().then(i=>i)}hasPermissionValidationFunction(e){return!!this.permissionsSource.value[e]&&!!this.permissionsSource.value[e].validationFunction&&l(this.permissionsSource.value[e].validationFunction)}};r.\u0275fac=function(t){return new(t||r)(d($),d(re))},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})(),k=class{constructor(){this.rolesSource=new g({}),this.roles$=this.rolesSource.asObservable()}},N=new A("USE_ROLES_STORE"),b=(()=>{let r=class r{constructor(e=!1,t,i){this.isolate=e,this.rolesStore=t,this.permissionsService=i,this.rolesSource=this.isolate?new g({}):this.rolesStore.rolesSource,this.roles$=this.rolesSource.asObservable()}addRole(e,t){let i=O(m({},this.rolesSource.value),{[e]:{name:e,validationFunction:t}});this.rolesSource.next(i)}addRoleWithPermissions(e,t){this.permissionsService.addPermission(t),this.addRole(e,t)}addRoles(e){Object.keys(e).forEach((t,i)=>{this.addRole(t,e[t])})}addRolesWithPermissions(e){Object.keys(e).forEach((t,i)=>{this.addRoleWithPermissions(t,e[t])})}flushRoles(){this.rolesSource.next({})}flushRolesAndPermissions(){this.flushRoles(),this.permissionsService.flushPermissions()}removeRole(e){let t=m({},this.rolesSource.value);delete t[e],this.rolesSource.next(t)}getRoles(){return this.rolesSource.value}getRole(e){return this.rolesSource.value[e]}hasOnlyRoles(e){return!e||Array.isArray(e)&&e.length===0?Promise.resolve(!0):(e=w(e),Promise.all([this.hasRoleKey(e),this.hasRolePermission(this.rolesSource.value,e)]).then(([i,n])=>i||n))}hasRoleKey(e){let t=e.map(i=>{if(!!this.rolesSource.value[i]&&!!this.rolesSource.value[i].validationFunction&&l(this.rolesSource.value[i].validationFunction)&&!ne(this.rolesSource.value[i].validationFunction)){let o=this.rolesSource.value[i].validationFunction,h=m({},this.rolesSource.value);return c(null).pipe(v(()=>o(i,h)),j(x=>R(x)?c(x):x),F(()=>c(!1)))}return c(!1)});return f(t).pipe(I(),S(i=>i!==!1,!1),v(i=>i!==!1)).toPromise().then(i=>i)}hasRolePermission(e,t){return f(t).pipe(p(i=>e[i]&&Array.isArray(e[i].validationFunction)?f(e[i].validationFunction).pipe(p(n=>this.permissionsService.hasPermission(n)),G(n=>n===!0)):c(!1)),S(i=>i===!0,!1)).toPromise()}};r.\u0275fac=function(t){return new(t||r)(d(N),d(k),d(E))},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})(),Pe=(()=>{let r=class r{constructor(){this.permissionsAuthorized=new W,this.permissionsUnauthorized=new W,this.firstMergeUnusedRun=1,this.permissionsService=P(E),this.configurationService=P(B),this.rolesService=P(b),this.viewContainer=P(X),this.changeDetector=P(Q),this.templateRef=P(_)}ngOnInit(){this.viewContainer.clear(),this.initPermissionSubscription=this.validateExceptOnlyPermissions()}ngOnChanges(e){let t=e.ngxPermissionsOnly,i=e.ngxPermissionsExcept;if(t||i){if(t&&t.firstChange||i&&i.firstChange)return;z(this.permissionsService.permissions$,this.rolesService.roles$).pipe(C(this.firstMergeUnusedRun),H(1)).subscribe(()=>{if(T(this.ngxPermissionsExcept)){this.validateExceptAndOnlyPermissions();return}if(T(this.ngxPermissionsOnly)){this.validateOnlyPermissions();return}this.handleAuthorisedPermission(this.getAuthorisedTemplates())})}}ngOnDestroy(){this.initPermissionSubscription&&this.initPermissionSubscription.unsubscribe()}validateExceptOnlyPermissions(){return z(this.permissionsService.permissions$,this.rolesService.roles$).pipe(C(this.firstMergeUnusedRun)).subscribe(()=>{if(T(this.ngxPermissionsExcept)){this.validateExceptAndOnlyPermissions();return}if(T(this.ngxPermissionsOnly)){this.validateOnlyPermissions();return}this.handleAuthorisedPermission(this.getAuthorisedTemplates())})}validateExceptAndOnlyPermissions(){Promise.all([this.permissionsService.hasPermission(this.ngxPermissionsExcept),this.rolesService.hasOnlyRoles(this.ngxPermissionsExcept)]).then(([e,t])=>{if(e||t){this.handleUnauthorisedPermission(this.ngxPermissionsExceptElse||this.ngxPermissionsElse);return}if(this.ngxPermissionsOnly)throw!1;this.handleAuthorisedPermission(this.ngxPermissionsExceptThen||this.ngxPermissionsThen||this.templateRef)}).catch(()=>{this.ngxPermissionsOnly?this.validateOnlyPermissions():this.handleAuthorisedPermission(this.ngxPermissionsExceptThen||this.ngxPermissionsThen||this.templateRef)})}validateOnlyPermissions(){Promise.all([this.permissionsService.hasPermission(this.ngxPermissionsOnly),this.rolesService.hasOnlyRoles(this.ngxPermissionsOnly)]).then(([e,t])=>{e||t?this.handleAuthorisedPermission(this.ngxPermissionsOnlyThen||this.ngxPermissionsThen||this.templateRef):this.handleUnauthorisedPermission(this.ngxPermissionsOnlyElse||this.ngxPermissionsElse)}).catch(()=>{this.handleUnauthorisedPermission(this.ngxPermissionsOnlyElse||this.ngxPermissionsElse)})}handleUnauthorisedPermission(e){if(!(R(this.currentAuthorizedState)&&!this.currentAuthorizedState)){if(this.currentAuthorizedState=!1,this.permissionsUnauthorized.emit(),this.getUnAuthorizedStrategyInput()){this.applyStrategyAccordingToStrategyType(this.getUnAuthorizedStrategyInput());return}this.configurationService.onUnAuthorisedDefaultStrategy&&!this.elseBlockDefined()?this.applyStrategy(this.configurationService.onUnAuthorisedDefaultStrategy):this.showTemplateBlockInView(e)}}handleAuthorisedPermission(e){if(!(R(this.currentAuthorizedState)&&this.currentAuthorizedState)){if(this.currentAuthorizedState=!0,this.permissionsAuthorized.emit(),this.getAuthorizedStrategyInput()){this.applyStrategyAccordingToStrategyType(this.getAuthorizedStrategyInput());return}this.configurationService.onAuthorisedDefaultStrategy&&!this.thenBlockDefined()?this.applyStrategy(this.configurationService.onAuthorisedDefaultStrategy):this.showTemplateBlockInView(e)}}applyStrategyAccordingToStrategyType(e){if(se(e)){this.applyStrategy(e);return}if(l(e)){this.showTemplateBlockInView(this.templateRef),e(this.templateRef);return}}showTemplateBlockInView(e){this.viewContainer.clear(),e&&(this.viewContainer.createEmbeddedView(e),this.changeDetector.markForCheck())}getAuthorisedTemplates(){return this.ngxPermissionsOnlyThen||this.ngxPermissionsExceptThen||this.ngxPermissionsThen||this.templateRef}elseBlockDefined(){return!!this.ngxPermissionsExceptElse||!!this.ngxPermissionsElse}thenBlockDefined(){return!!this.ngxPermissionsExceptThen||!!this.ngxPermissionsThen}getAuthorizedStrategyInput(){return this.ngxPermissionsOnlyAuthorisedStrategy||this.ngxPermissionsExceptAuthorisedStrategy||this.ngxPermissionsAuthorisedStrategy}getUnAuthorizedStrategyInput(){return this.ngxPermissionsOnlyUnauthorisedStrategy||this.ngxPermissionsExceptUnauthorisedStrategy||this.ngxPermissionsUnauthorisedStrategy}applyStrategy(e){if(e===D.SHOW){this.showTemplateBlockInView(this.templateRef);return}if(e===D.REMOVE){this.viewContainer.clear();return}let t=this.configurationService.getStrategy(e);this.showTemplateBlockInView(this.templateRef),t(this.templateRef)}};r.\u0275fac=function(t){return new(t||r)},r.\u0275dir=J({type:r,selectors:[["","ngxPermissionsOnly",""],["","ngxPermissionsExcept",""]],inputs:{ngxPermissionsOnly:"ngxPermissionsOnly",ngxPermissionsOnlyThen:"ngxPermissionsOnlyThen",ngxPermissionsOnlyElse:"ngxPermissionsOnlyElse",ngxPermissionsExcept:"ngxPermissionsExcept",ngxPermissionsExceptElse:"ngxPermissionsExceptElse",ngxPermissionsExceptThen:"ngxPermissionsExceptThen",ngxPermissionsThen:"ngxPermissionsThen",ngxPermissionsElse:"ngxPermissionsElse",ngxPermissionsOnlyAuthorisedStrategy:"ngxPermissionsOnlyAuthorisedStrategy",ngxPermissionsOnlyUnauthorisedStrategy:"ngxPermissionsOnlyUnauthorisedStrategy",ngxPermissionsExceptUnauthorisedStrategy:"ngxPermissionsExceptUnauthorisedStrategy",ngxPermissionsExceptAuthorisedStrategy:"ngxPermissionsExceptAuthorisedStrategy",ngxPermissionsUnauthorisedStrategy:"ngxPermissionsUnauthorisedStrategy",ngxPermissionsAuthorisedStrategy:"ngxPermissionsAuthorisedStrategy"},outputs:{permissionsAuthorized:"permissionsAuthorized",permissionsUnauthorized:"permissionsUnauthorized"},features:[q]});let s=r;return s})(),oe="default";var te=(()=>{let r=class r{constructor(e,t,i){this.permissionsService=e,this.rolesService=t,this.router=i}canActivate(e,t){return this.hasPermissions(e,t)}canActivateChild(e,t){return this.hasPermissions(e,t)}canLoad(e){return this.hasPermissions(e)}canMatch(e){return this.hasPermissions(e)}hasPermissions(e,t){let i=e&&e.data?e.data.permissions:{},n=this.transformPermission(i,e,t);return this.isParameterAvailable(n.except)?this.passingExceptPermissionsValidation(n,e,t):this.isParameterAvailable(n.only)?this.passingOnlyPermissionsValidation(n,e,t):!0}transformPermission(e,t,i){let n=l(e.only)?e.only(t,i):w(e.only),o=l(e.except)?e.except(t,i):w(e.except),h=e.redirectTo;return{only:n,except:o,redirectTo:h}}isParameterAvailable(e){return!!e&&e.length>0}passingExceptPermissionsValidation(e,t,i){if(e.redirectTo&&(l(e.redirectTo)||K(e.redirectTo)&&!this.isRedirectionWithParameters(e.redirectTo))){let n="";return f(e.except).pipe(p(o=>M([this.permissionsService.hasPermission(o),this.rolesService.hasOnlyRoles(o)]).pipe(V(h=>{h.every(U=>U===!1)||(n=o)}))),S(o=>o.some(h=>h===!0),!1),p(o=>n?(this.handleRedirectOfFailedPermission(e,n,t,i),c(!1)):!o&&e.only?this.onlyRedirectCheck(e,t,i):c(!o))).toPromise()}return Promise.all([this.permissionsService.hasPermission(e.except),this.rolesService.hasOnlyRoles(e.except)]).then(([n,o])=>n||o?(e.redirectTo&&this.redirectToAnotherRoute(e.redirectTo,t,i),!1):e.only?this.checkOnlyPermissions(e,t,i):!0)}redirectToAnotherRoute(e,t,i,n){let o=l(e)?e(n,t,i):e;if(this.isRedirectionWithParameters(o)){o.navigationCommands=this.transformNavigationCommands(o.navigationCommands,t,i),o.navigationExtras=this.transformNavigationExtras(o.navigationExtras,t,i),this.router.navigate(o.navigationCommands,o.navigationExtras);return}Array.isArray(o)?this.router.navigate(o):this.router.navigate([o])}isRedirectionWithParameters(e){return K(e)&&(!!e.navigationCommands||!!e.navigationExtras)}transformNavigationCommands(e,t,i){return l(e)?e(t,i):e}transformNavigationExtras(e,t,i){return l(e)?e(t,i):e}onlyRedirectCheck(e,t,i){let n="";return f(e.only).pipe(p(o=>M([this.permissionsService.hasPermission(o),this.rolesService.hasOnlyRoles(o)]).pipe(V(h=>{h.every(U=>U===!1)&&(n=o)}))),S(o=>l(e.redirectTo)?o.some(h=>h===!0):o.every(h=>h===!1),!1),p(o=>l(e.redirectTo)?o?c(!0):(this.handleRedirectOfFailedPermission(e,n,t,i),c(!1)):(n&&this.handleRedirectOfFailedPermission(e,n,t,i),c(!o)))).toPromise()}handleRedirectOfFailedPermission(e,t,i,n){this.isFailedPermissionPropertyOfRedirectTo(e,t)?this.redirectToAnotherRoute(e.redirectTo[t],i,n,t):l(e.redirectTo)?this.redirectToAnotherRoute(e.redirectTo,i,n,t):this.redirectToAnotherRoute(e.redirectTo[oe],i,n,t)}isFailedPermissionPropertyOfRedirectTo(e,t){return!!e.redirectTo&&e.redirectTo[t]}checkOnlyPermissions(e,t,i){let n=m({},e);return Promise.all([this.permissionsService.hasPermission(n.only),this.rolesService.hasOnlyRoles(n.only)]).then(([o,h])=>o||h?!0:(n.redirectTo&&this.redirectToAnotherRoute(n.redirectTo,t,i),!1))}passingOnlyPermissionsValidation(e,t,i){return l(e.redirectTo)||K(e.redirectTo)&&!this.isRedirectionWithParameters(e.redirectTo)?this.onlyRedirectCheck(e,t,i):this.checkOnlyPermissions(e,t,i)}};r.\u0275fac=function(t){return new(t||r)(d(E),d(b),d(ee))},r.\u0275prov=y({token:r,factory:r.\u0275fac});let s=r;return s})();var Se=(()=>{let r=class r{static forRoot(e={}){return{ngModule:r,providers:[re,k,ie,E,te,b,B,{provide:$,useValue:e.permissionsIsolate},{provide:N,useValue:e.rolesIsolate},{provide:L,useValue:e.configurationIsolate}]}}static forChild(e={}){return{ngModule:r,providers:[{provide:$,useValue:e.permissionsIsolate},{provide:N,useValue:e.rolesIsolate},{provide:L,useValue:e.configurationIsolate},B,E,b,te]}}};r.\u0275fac=function(t){return new(t||r)},r.\u0275mod=Z({type:r}),r.\u0275inj=Y({});let s=r;return s})();var u=function(s){return s.SHOOPE="https://res.cloudinary.com/pos/image/upload/v1598262220/icons/marketplace_icons/shopee.png",s.WOOCOMMERCE="https://res.cloudinary.com/pos/image/upload/w_50/v1632447439/icons/WooCommerce/woocommerce-icon.webp",s.TOKOPEDIA="https://res.cloudinary.com/pos/image/upload/v1598262221/icons/marketplace_icons/tokopedia.png",s.TIKTOK="https://res.cloudinary.com/pos/image/upload/w_30/v1645761611/icons/Marketplace%20logo/tiktok.png",s.LAZADA="https://res.cloudinary.com/pos/image/upload/v1680681836/icons/marketplace_icons/Lazadanew.png",s.KALCARE="https://res.cloudinary.com/pos/image/upload/v1654230268/icons/marketplace_icons/kalcare.png",s.SHOPIFY="https://res.cloudinary.com/pos/image/upload/v1707987435/icons/marketplace_icons/shopify.png",s}(u||{});var a=function(s){return s[s.Tokopedia=1]="Tokopedia",s[s.WooCommerce=2]="WooCommerce",s[s.None=3]="None",s[s.KalCare=4]="KalCare",s[s.Shopee=5]="Shopee",s[s.Tiktok=6]="Tiktok",s[s.Lazada=7]="Lazada",s[s.Shopify=8]="Shopify",s}(a||{});var De=(()=>{let r=class r{static IsNotEmpty(e){return e!=""&&e!=r.GuidEMpty&&e!=null&&e!=null}static IsEmpty(e){return e==""||e==null||e==null||e==r.GuidEMpty}static getChannelLogoByTypeId(e){let t;switch(e){case a.Tokopedia:t=u.TOKOPEDIA;break;case a.Shopee:t=u.SHOOPE;break;case a.WooCommerce:t=u.WOOCOMMERCE;break;case a.Lazada:t=u.LAZADA;break;case a.Tiktok:t=u.TIKTOK;break;case a.KalCare:t=u.KALCARE;break;case a.Shopify:t=u.SHOPIFY;break}return t}static getChannelLogoByName(e=""){e=e.toLowerCase();let t;switch(e){case"tokopedia":t=u.TOKOPEDIA;break;case"shoppe":t=u.SHOOPE;break;case"woocommerce":t=u.WOOCOMMERCE;break;case"tiktok":t=u.TIKTOK;break;case"lazada":t=u.LAZADA;break;case"kalCare":t=u.KALCARE;break}return t}static getChannelName(e){let t;switch(e){case a.Shopee:t="Shopee";break;case a.Tokopedia:t="Tokopedia";break;case a.Lazada:t="Lazada";break;case a.Tiktok:t="Tiktok";break;case a.WooCommerce:t="WooCommerce";break;case a.KalCare:t="WooCommerce";break}return t}static assignChannelLogo(e){return e=e.map(t=>(t.logo=this.getChannelLogoByTypeId(t.TypeID),t)),e}static getCssChannelColor(e){let t;switch(e){case a.Shopee:t="#ee4d2d";break;case a.Tokopedia:t="var(--G500,#03AC0E)";break;case a.Lazada:t="#FF00B2";break;case a.Tiktok:t="black";break;case a.WooCommerce:t="#674399";break;case a.KalCare:t="rgb(128, 188, 0)";break}return t}static getDaysDiff(e,t){var i=t.getTime()-e.getTime(),n=i/(1e3*60*60*24);return n}static addDays(e,t){let i=new Date(Number(e));return i.setDate(e.getDate()-t),i}static isValidDate(e){return e instanceof Date&&!isNaN(e)}static getImageInfo(e){return new Promise((t,i)=>{let n=new Image;n.src=e,n.decode().then(()=>{t({img:e,height:n.height,width:n.width})}).catch(()=>{i(new Error(`Image load error for ${e}`))})})}static formatTitleFromDate(e,t){let i=null,n=new Date(e),o=new Date(t);return n.getDate()!=o.getDate()&&(i="dd"),n.getMonth()!=o.getMonth()&&(i="dd MMM"),n.getFullYear()!=o.getFullYear()&&(i="dd MMM yyyy"),i}static openDownloadFile(e,t){var i=window.URL.createObjectURL(e),n=document.createElement("a");n.href=i,n.download=t,n.click()}static compare(e,t,i){return(e<t?-1:1)*(i?1:-1)}static isDateExpired(e){let t=new Date,i=!1;return e.getTime()<t.getTime()&&(i=!0),i}};r.GuidEMpty="00000000-0000-0000-0000-000000000000",r.MinDate="0001-01-01T00:00:00";let s=r;return s})();export{u as a,a as b,De as c,E as d,Pe as e,Se as f};