PageSourceSearch

https://login.commonsku.com/dist/react/PSReportApp.8d54f937.chunk.js

js commonsku.com collected 2026-10-02 03:14:21 UTC 46,143 bytes, 85 lines download raw bytes

1"use strict";(globalThis.__LOADABLE_LOADED_CHUNKS__=globalThis.__LOADABLE_LOADED_CHUNKS__||[]).push([[4215],{30305(e,t,n){n.r(t),n.d(t,{default:()=>de});var s=n(41594),a=n(98483),i=n(26926),r=n(73021),o=n(51904),l=n(28420),d=n(22224),c=n.n(d),p=n(3602),u=n(72361),h=n(93940),m=n(22078),_=n(26627),x=n(63988);const g=e=>{let{children:t}=e;const[n,a]=(0,s.useState)(!1);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(p.Button,{type:"button",size:"small",onClick:()=>{a(!n)},children:n?"Hide":"Show"}),n&&t]})},v=e=>{let{ps_company_code:t,promo_api_name:n,...a}=e;const i={csvErrors:[],rows:[],current:"",success:[],missing:[],errors:[]},[r,o]=(0,s.useState)(i);return(0,x.jsxs)(p.Popup,{"data-test-name":"PSCredentialUploadPopup",...a,style:{padding:"5px 25px"},title:"Upload PS Credentials",children:[(0,x.jsxs)("div",{children:[(0,x.jsx)("div",{children:"Only *.csv files will be accepted."}),(0,x.jsx)("div",{children:"CSV file must include header distributor_name, promostandards_id, promostandards_password"}),(0,x.jsx)("div",{children:"promostandards_account is optional"})]}),(0,x.jsx)(p.Dropzoned,{showDroppedFiles:!0,onDrop:async e=>{let t=[];const n=(0,d.filter)((0,d.flatten)(await Promise.all((0,d.map)(e,async e=>{const{data:n,errors:s}=await(0,_.a)(e);return t.push(s),(0,d.map)(n,e=>(0,d.mapValues)(e,e=>(0,d.trim)(e)))}))));o({...i,rows:n,csvErrors:(0,d.flatten)(t)})}}),!(0,d.isEmpty)(r.csvErrors)&&(0,x.jsxs)("div",{style:{marginTop:20},children:[(0,x.jsxs)(p.H3,{children:[r.csvErrors.length," Errors"]}),(0,x.jsx)(g,{children:(0,x.jsx)("pre",{style:{color:"red"},children:JSON.stringify(r.csvErrors,void 0,2)})})]}),(0,d.isEmpty)(r.csvErrors)&&!(0,d.isEmpty)(r.rows)&&(0,x.jsx)(p.Button,{type:"button",size:"small",onClick:async()=>{let e=[];const s=(0,d.filter)((0,d.flatten)(await Promise.all((0,d.map)((0,d.zip)(...(0,d.chunk)(r.rows,3)),n=>(0,m.xb)((0,d.filter)(n,e=>e&&-1===(0,d.findIndex)([e.promostandards_id,e.promostandards_password,e.distributor_name],d.isEmpty)),async n=>{o({...r,current:n.distributor_name});const s=await(0,h.CT)({company:t,username:n.promostandards_id,password:n.promostandards_password});if(await new Promise(e=>{setTimeout(e,300)}),!s.ErrorMessage)return{tenant_name:n.distributor_name,promo_api_account:n.promostandards_account,promo_api_username:n.promostandards_id,promo_api_password:n.promostandards_password};e.push({...s.ErrorMessage,distributor_name:n.distributor_name,promostandards_id:n.promostandards_id})})))));if((0,d.isEmpty)(s))o({...i,errors:e});else{const{json:t}=await(0,m.oD)("POST","promostandards-credential",{promo_api_name:n,credentials:(0,d.uniqBy)(s,"tenant_name")});o({...i,errors:[...e,...t.errors],success:[...t.created,...t.updated],missing:t.missing})}},children:"Upload"}),r.current&&(0,x.jsxs)("div",{children:["Processing: ",r.current]}),(0,x.jsxs)("div",{style:{marginTop:25},children:[(0,x.jsxs)(p.H3,{children:[r.success.length," rows uploaded."]}),!(0,d.isEmpty)(r.success)&&(0,x.jsx)(g,{children:(0,x.jsx)("pre",{children:JSON.stringify((0,d.map)(r.success,"tenant_name"))})})]}),!(0,d.isEmpty)(r.missing)&&(0,x.jsxs)("div",{style:{marginTop:25},children:[(0,x.jsxs)(p.H3,{children:[r.missing.length," distributor_name are not found in commonsku. "]}),(0,x.jsx)(g,{children:(0,x.jsx)("pre",{style:{color:"red"},children:JSON.stringify((0,d.map)(r.missing,"tenant_name"))})})]}),!(0,d.isEmpty)(r.errors)&&(0,x.jsxs)("div",{style:{marginTop:25},children:[(0,x.jsxs)(p.H3,{style:{color:"red"},children:[r.errors.length," Errors"]}),(0,x.jsx)(g,{children:(0,x.jsx)("pre",{style:{color:"red"},children:JSON.stringify(r.errors,void 0,2)})})]})]})};var y=n(58199),j=n(39913),b=n(30596),f=n(23652);const k="Product",C=[{code:k,label:"Product Data"},{code:"PPC",label:"Product Pricing and Configuration"}],w=["Blank","Decorated"],S=["USD","CAD"],P="Credentials are not present in the commonsku database. Contact the supplier to get PromoStandards credentials for commonsku.";function N(e,t){return!e||!t}function O(e){const t={};return Object.values(e||{}).forEach(e=>{if(!e.promo_api_name)return;const n=t[e.promo_api_name];n?(!n.ps_company_code&&e.ps_company_code&&(n.ps_company_code=String(e.ps_company_code).trim()),!n.commonsku_username&&e.commonsku_username&&(n.commonsku_username=e.commonsku_username,n.commonsku_password=e.commonsku_password||"")):t[e.promo_api_name]={promo_api_name:e.promo_api_name,ps_company_code:String(e.ps_company_code||"").trim(),commonsku_username:e.commonsku_username||"",commonsku_password:e.commonsku_password||"",label:e.division_name||e.supplier_name||e.display_name||e.promo_api_name}}),c().sortBy(Object.values(t),"label")}function E(e){return e?arguments.length>1&&void 0!==arguments[1]&&arguments[1]?e.test_url||e.live_url||"":e.live_url||e.test_url||"":""}function R(e){let{showXml:t,response:n,requestXml:s,responseXml:a}=e;return t?a||s?`--- request ---\n${s||""}\n\n--- response ---\n${a||""}`:"No SOAP XML captured.":n?JSON.stringify(n,null,2):"No response yet."}const T=f.default.div`
2  padding: 16px 24px 48px;
3  max-width: 1100px;
4`,D=f.default.div`
5  display: flex;
6  align-items: flex-start;
7  justify-content: space-between;
8  gap: 16px;
9  margin-bottom: 16px;
10`,A=f.default.p`
11  margin: 0;
12  font-size: 14px;
13  color: #555;
14  max-width: 720px;
15`,I=f.default.div`
16  display: flex;
17  flex-direction: column;
18  gap: 8px;
19  margin-bottom: 20px;
20  width: 100%;
21`,F=f.default.span`
22  font-weight: 400;
23  color: #888;
24  font-size: 13px;
25`,L=f.default.div`
26  display: flex;
27  align-items: center;
28  gap: 8px;
29  width: 100%;
30
31  &&& input {
32    flex: 1;
33    min-width: 0;
34    margin: 0;
35  }
36`,z=f.default.select`
37  &&& {
38    margin: 0;
39    height: 38px;
40    width: 100%;
41  }
42`,V=f.default.div`
43  display: flex;
44  align-items: center;
45  gap: 8px;
46  flex-wrap: wrap;
47`,q=(0,f.default)(z)`
48  &&& {
49    width: 100px;
50    max-width: 100%;
51    margin: 0;
52  }
53`,B=f.default.p`
54  margin: ${e=>e.$spaced?"0 0 12px":"4px 0 0"};
55  font-size: 12px;
56  color: #666;
57`,U=f.default.div`
58  display: flex;
59  justify-content: space-between;
60  align-items: center;
61  margin-bottom: 8px;
62`,$=f.default.pre`
63  max-height: 70vh;
64  overflow: auto;
65  background: #f6f8fa;
66  padding: 16px;
67  font-size: 12px;
68  line-height: 1.45;
69  white-space: pre-wrap;
70  word-break: break-word;
71  overflow-wrap: anywhere;
72  margin: 0;
73  border: 1px solid #e2e8ee;
74  border-radius: 4px;
75`,H=f.default.div`
76  text-align: center;
77  padding: 24px;
78`,M=f.default.div`
79  margin-bottom: 12px;
80`,X=(0,f.default)(p.H2)`
81  &&& {
82    margin: 0 0 8px;
83  }
84`;class J extends s.Component{constructor(e){super(e),this._credentialsRequestId=0,this._endpointRequestId=0,this.state={service_code:k,loadingCompanies:!1,loadingCredentials:!1,loadingCall:!1,loadingFobPoints:!1,product_id:"",part_id:"",fob_id:"",currency:"USD",configuration_type:"Blank",fob_point_choices:[],localization_country:"US",localization_language:"en",use_test_url:!1,api_name:"",ps_company_code:"",commonsku_username:"",commonsku_password:"",serviceEndpoint:null,response:null,error:"",meta:null,request_xml:"",response_xml:"",showXml:!1},c().bindAll(this,["handleChange","handleSelectSupplier","handleServiceChange","loadServiceEndpoint","loadOwnerCredentials","loadFobPoints","handleValidate","handleCopy"])}handleChange(e,t){this.setState({[e]:t})}isPricingService(){return"PPC"===this.state.service_code}getSelectedService(){return C.find(e=>e.code===this.state.service_code)||C[0]}handleServiceChange(e){this.setState({service_code:e,serviceEndpoint:null,response:null,meta:null,request_xml:"",response_xml:"",fob_id:"",fob_point_choices:[]},()=>{const e=String(this.state.ps_company_code||"").trim();e&&this.loadServiceEndpoint(e)})}handleSelectSupplier(e){const t=O(this.props.tenant_endpoints).find(t=>t.promo_api_name===e);t?this.setState({api_name:t.promo_api_name,ps_company_code:String(t.ps_company_code||"").trim(),commonsku_username:t.commonsku_username||"",commonsku_password:t.commonsku_password||"",serviceEndpoint:null,response:null,error:"",fob_id:"",fob_point_choices:[]},()=>{this.loadOwnerCredentials(t.promo_api_name)}):this.setState({api_name:"",ps_company_code:"",commonsku_username:"",commonsku_password:"",serviceEndpoint:null})}loadOwnerCredentials(e){if(!e)return;const t=++this._credentialsRequestId;this.setState({loadingCredentials:!0}
84),(0,m.oD)("POST","promo-standards",{action:"owner_credentials",admin_test:!0,api_name:e}).then(e=>{let{json:n}=e;if(t!==this._credentialsRequestId)return;const s=(null==n?void 0:n.credentials)||{},a=s.commonsku_username||"",i=s.commonsku_password||"",r=N(a,i)?P:null!=n&&n.error?String(n.error):"",o=String(s.ps_company_code||this.state.ps_company_code||"").trim();this.setState({loadingCredentials:!1,commonsku_username:a,commonsku_password:i,ps_company_code:o||this.state.ps_company_code,error:r},()=>{o?this.loadServiceEndpoint(o):r||this.setState({error:"No ps_company_code on this supplier — cannot look up endpoint."})})},e=>{let{json:n}=e;if(t!==this._credentialsRequestId)return;const s=(null==n?void 0:n.credentials)||{};this.setState({loadingCredentials:!1,commonsku_username:s.commonsku_username||"",commonsku_password:s.commonsku_password||"",error:(null==n?void 0:n.error)||P})})}async loadServiceEndpoint(e){if(!e)return;const t=++this._endpointRequestId,n=this.state.service_code;this.setState({loadingCompanies:!0});try{const{endpoint:s}=await async function(e,t){const n=String(e||"").trim();let s=null,a=null;if(""===n)return{company:null,endpoint:null};try{var i;const e=await(0,h.U_)({params:{code__in:n}}),r=Array.isArray(e)?e:(null==e?void 0:e.results)||[];s=c().find(r,e=>String(e.code||"").trim().toLowerCase()===n.toLowerCase())||r[0]||null;const o=((null===(i=s)||void 0===i?void 0:i.endpoints)||[]).filter(e=>e.code===t);o.length>0&&(a=c().maxBy(o,e=>e.version)||o[0])}catch(e){}return a||(a=await async function(e,t){try{const{json:n}=await(0,m.oD)("POST","promo-standards",{action:"directory_endpoint",admin_test:!0,ps_company_code:e,service_code:t});return(null==n?void 0:n.endpoint)||null}catch(e){var n;return(null==e||null===(n=e.json)||void 0===n?void 0:n.endpoint)||null}}(n,t)),{company:s,endpoint:a}}(e,n);if(t!==this._endpointRequestId)return;const a=s?"":`No endpoint found for company code "${e}".`;this.setState(e=>({loadingCompanies:!1,serviceEndpoint:s,error:a||(e.error===P?e.error:"")}))}catch(e){if(t!==this._endpointRequestId)return;this.setState({loadingCompanies:!1,serviceEndpoint:null,error:(null==e?void 0:e.message)||"Unable to load company endpoints from PromoStandards API."})}}loadFobPoints(){const{api_name:e,product_id:t,serviceEndpoint:n,localization_country:s,localization_language:a,use_test_url:i,commonsku_username:r,commonsku_password:o}=this.state;if(N(r,o))return void this.setState({error:P});if(!e||!t.trim()||!n)return void this.setState({error:"Select a supplier, enter a product ID, and wait for the endpoint to load."});const l=E(n,i);this.setState({loadingFobPoints:!0,error:"",fob_id:"",fob_point_choices:[]}),(0,m.oD)("POST","promo-standards",{action:"fob_points",admin_test:!0,api_name:e,product_id:t.trim(),endpoint_url:l,endpoint_version:n.version||"1.0.0",localization_country:s,localization_language:a}).then(e=>{var t,n;let{json:s}=e;const a=function(e){const t=null==e?void 0:e.fob_point_choices;return Array.isArray(t)?t:[]}(s);this.setState({loadingFobPoints:!1,fob_point_choices:a,fob_id:(null===(t=a[0])||void 0===t?void 0:t.fob_id)||"",error:(null==s?void 0:s.error)||(0===a.length?"No FOB points returned for this product.":""),request_xml:(null==s?void 0:s.request_xml)||"",response_xml:(null==s?void 0:s.response_xml)||"",meta:(null==s?void 0:s.meta)||null,response:null!==(n=null==s?void 0:s.fob_points)&&void 0!==n?n:null})},e=>{let{json:t}=e;this.setState({loadingFobPoints:!1,error:(null==t?void 0:t.error)||(null==t?void 0:t.message)||"Unable to load FOB points."})})}handleValidate(e){e&&e.preventDefault(),this.isPricingService()?this.handleValidatePricing(e):this.handleValidateProductData(e)}handleValidateProductData(e){e&&e.preventDefault();const{api_name:t,product_id:n,part_id:s,serviceEndpoint:a,localization_country:i,localization_language:r,use_test_url:o,commonsku_username:l,commonsku_password:d}=this.state;if(N(l,d))return void this.setState({error:P});if(!t||!n.trim()||!a)return void this.setState({error:"Select a supplier, enter a product ID, and wait for the endpoint to load."});const c=E(a,o);this.setState({loadingCall:!0,error:"",response:null,request_xml:"",response_xml:"",meta:null});const p={action:"product_data",admin_test:!0,api_name:t,product_id:n.trim(),endpoint_url:c,endpoint_version:a.version||"1.0.0",localization_country:i,localization_language:r};s.trim()&&(p.part_id=s.trim()),(0,m.oD)("POST","promo-standards",p).then(e=>{var t;let{json:n}=e;this.setState({loadingCall:!1,response:null!==(t=null==n?void 0:n.product)&&void 0!==t?t:null,error:(null==n?void 0:n.error)||"",request_xml:(null==n?void 0:n.request_xml)||"",response_xml:(null==n?void 0:n.response_xml)||"",meta:(null==n?void 0:n.meta)||null})},e=>{let{json:t}=e;this.setState({loadingCall:!1,error:(null==t?void 0:t.error)||(null==t?void 0:t.message)||"Validation call failed."})})}handleValidatePricing(e){e&&e.preventDefault();const{api_name:t,product_id:n,part_id:s,fob_id:a,currency:i,configuration_type:r,serviceEndpoint:o,localization_country:l,localization_language:d,use_test_url:c,commonsku_username:p,commonsku_password:u}=this.state;if(N(p,u))return void this.setState({error:P});if(!(t&&n.trim()&&a.trim()&&o))return void this.setState({error:"Select a supplier, enter product ID and FOB, then wait for the endpoint to load."});const h=E(o,c),_=s.trim();this.setState({loadingCall:!0,error:"",response:null,request_xml:"",response_xml:"",meta:null});const x={action:"pricing_configuration",admin_test:!0,api_name:t,product_id:n.trim(),fob_id:a.trim(),currency:i,configuration_type:r,endpoint_url:h,endpoint_version:o.version||"1.0.0",localization_country:l,localization_language:d};_&&(x.part_id=_),(0,m.oD)("POST","promo-standards",x).then(e=>{var t;let{json:n}=e;this.setState({loadingCall:!1,response:null!==(t=null==n?void 0:n.configuration)&&void 0!==t?t:null,error:(null==n?void 0:n.error)||"",request_xml:(null==n?void 0:n.request_xml)||"",response_xml:(null==n?void 0:n.response_xml)||"",meta:(null==n?void 0:n.meta)||null})},e=>{let{json:t}=e;this.setState({loadingCall:!1,error:(null==t?void 0:t.error)||(null==t?void 0:t.message)||"Validation call failed."})})}handleCopy(e){e&&navigator.clipboard&&navigator.clipboard.writeText(e)}renderCopyField(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(0,x.jsxs)(L,{"data-test-name":"PSProductValidatorPage.renderCopyField",children:[(0,x.jsx)(p.Input,{type:"text",readOnly:!0,value:e||""}),(0,x.jsx)(p.Button,{type:"button",size:"small",disabled:t||!e,onClick:()=>this.handleCopy(e),children:"Copy"})]})}render(){var e;const{onBack:t}=this.props,n=O(this.props.tenant_endpoints),s=this.isPricingService(),{service_code:a,api_name:i,product_id:r,part_id:o,fob_id:l,currency:d,configuration_type:c,fob_point_choices:u,localization_country:h,localization_language:m,use_test_url:_,commonsku_username:g,commonsku_password:v,serviceEndpoint:y,loadingCompanies:j,loadingCredentials:b,loadingCall:f,loadingFobPoints:k,response:P,error:L,meta:J,request_xml:W,response_xml:K,showXml:G}=this.state,Y=E(y,_),Q=f||!y||!r.trim()||N(g,v)||s&&!l.trim(),Z=k||f||!y||!r.trim()||N(g,v),ee=u.find(e=>e.fob_id===l),te=null!=ee&&null!==(e=ee.label)&&void 0!==e&&e.includes(" — ")?ee.label.split(" — ")[1]:"";return(0,x.jsxs)(T,{"data-test-name":"PSProductValidatorPage.render",children:[(0,x.jsxs)(D,{children:[(0,x.jsxs)("div",{children:[(0,x.jsx)(X,{children:"PromoStandards Product Validator"}),(0,x.jsxs)(A,{children:["For more details, use the"," ",(0,x.jsx)("a",{href:"https://promostandards.org/web-service-validator/",target:"_blank",rel:"noopener noreferrer",children:"PromoStandards Web Service Validator"}),"."]})]}),(0,x.jsx)(p.Button,{type:"button",secondary:!0,onClick:t,children:"Back to report"})]}),(0,x.jsxs)(p.Row,{children:[(0,x.jsx)(p.Col,{xs:!0,sm:6,padded:!0,children:(0,x.jsxs)(I,{children:[(0,x.jsx)(p.Label,{children:"Service"}),(0,x.jsx)(z,{value:a,onChange:e=>this.handleServiceChange(e.target.value),disabled:f||k,children:C.map(e=>(0,x.jsx)("option",{value:e.code,children:e.label},e.code))})]})}),(0,x.jsx)(p.Col,{xs:!0,sm:6,padded:!0,children:(0,x.jsxs)(I,{children:[(0,x.jsx)(p.Label,{children:"Supplier"}),(0,x.jsxs)(z,{value:i,onChange:e=>this.handleSelectSupplier(e.target.value),disabled:f||k,children:[(0,x.jsx)("option",{value:"",children:"Select…"}),n.map(e=>(0,x.jsxs)("option",{value:e.promo_api_name,children:[e.label," (",e.promo_api_name,")"]},e.promo_api_name))]})]})}),(0,x.jsx)(p.Col,{xs:!0,sm:3,padded:!0,children:(0,x.jsxs)(I,{children:[(0,x.jsxs)(p.Label,{children:["commonsku username"," ",b?(0,x.jsx)(F,{children:"(loading…)"}):null]}),this.renderCopyField(g)]})}),(0,x.jsx)(p.Col,{xs:!0,sm:3,padded:!0,children:(0,x.jsxs)(I,{children:[(0,x.jsx)(p.Label,{children:"commonsku password"}),this.renderCopyField(v)]})}),(0,x.jsx)(p.Col,{xs:!0,padded:!0,children:(0,x.jsxs)(I,{children:[(0,x.jsxs)(p.Label,{children:["Endpoint"," ",j?(0,x.jsx)(F,{children:"(loading…)"}):null]}),this.renderCopyField(Y,!Y),y?(0,x.jsxs)(B,{children:["Version ",y.version," · status ",y.status,y.source?` · source ${y.source}`:""," · ",(0,x.jsx)(p.LabeledCheckbox,{label:"use test URL",checked:_,onChange:()=>this.handleChange("use_test_url",!_)})]}):null]})}),(0,x.jsx)(p.Col,{xs:!0,sm:4,padded:!0,children:(0,x.jsxs)(I,{children:[(0,x.jsx)(p.Label,{children:"Product ID"}),(0,x.jsx)(p.Input,{type:"text",value:r,placeholder:"Supplier productId",onChange:e=>this.handleChange("product_id",e.target.value),onKeyDown:e=>{"Enter"===e.key&&this.handleValidate(e)},disabled:f||k})]})}),(0,x.jsx)(p.Col,{xs:!0,sm:4,padded:!0,children:(0,x.jsxs)(I,{children:[(0,x.jsxs)(p.Label,{children:["Part ID ",(0,x.jsx)(F,{children:"(optional)"})]}),(0,x.jsx)(p.Input,{type:"text",value:o,placeholder:"Supplier partId",onChange:e=>this.handleChange("part_id",e.target.value),onKeyDown:e=>{"Enter"===e.key&&this.handleValidate(e)},disabled:f||k})]})}),s?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(p.Col,{xs:!0,sm:2,padded:!0,children:(0,x.jsxs)(I,{children:[(0,x.jsx)(p.Label,{children:"Currency"}),(0,x.jsx)(z,{value:d,onChange:e=>this.handleChange("currency",e.target.value),disabled:f||k,children:S.map(e=>(0,x.jsx)("option",{value:e,children:e},e))})]})}),(0,x.jsx)(p.Col,{xs:!0,sm:2,padded:!0,children:(0,x.jsxs)(I,{children:[(0,x.jsx)(p.Label,{children:"Configuration"}),(0,x.jsx)(z,{value:c,onChange:e=>this.handleChange("configuration_type",e.target.value),disabled:f||k,children:w.map(e=>(0,x.jsx)("option",{value:e,children:e},e))})]})})]}):null,(0,x.jsx)(p.Col,{xs:!0,sm:2,padded:!0,children:(0,x.jsxs)(I,{children:[(0,x.jsx)(p.Label,{children:"Country"}),(0,x.jsx)(p.Input,{type:"text",value:h,onChange:e=>this.handleChange("localization_country",e.target.value),disabled:f||k})]})}),(0,x.jsx)(p.Col,{xs:!0,sm:2,padded:!0,children:(0,x.jsxs)(I,{children:[(0,x.jsx)(p.Label,{children:"Language"}),(0,x.jsx)(p.Input,{type:"text",value:m,onChange:e=>this.handleChange("localization_language",e.target.value),disabled:f||k})]})})]}),s?(0,x.jsx)(p.Row,{children:(0,x.jsx)(p.Col,{xs:!0,sm:3,padded:!0,children:(0,x.jsxs)(I,{children:[(0,x.jsxs)(p.Label,{children:["FOB",k?(0,x.jsx)(F,{children:" …"}):null]}
84),(0,x.jsxs)(V,{children:[(0,x.jsxs)(q,{value:l,onChange:e=>this.handleChange("fob_id",e.target.value),disabled:f||k||0===u.length,children:[(0,x.jsx)("option",{value:"",children:"—"}),u.map(e=>(0,x.jsx)("option",{value:e.fob_id,children:e.fob_id},e.fob_id))]}),(0,x.jsx)(p.Button,{type:"button",size:"small",secondary:!0,onClick:this.loadFobPoints,disabled:Z,children:k?"…":"Load"})]}),te?(0,x.jsx)(B,{children:te}):null]})})}):null,(0,x.jsx)(p.Row,{children:(0,x.jsx)(p.Col,{xs:!0,padded:!0,children:(0,x.jsx)(I,{children:(0,x.jsx)(p.Button,{type:"button",onClick:this.handleValidate,disabled:Q,children:f?"Validating…":"Validate"})})})}),L?(0,x.jsx)(M,{children:(0,x.jsx)(p.AlertNotification,{alertType:"error",children:L})}):null,J?(0,x.jsxs)(B,{$spaced:!0,children:["Endpoint: ",J.endpoint_url,J.endpoint_version?` · version ${J.endpoint_version}`:"",J.price_type?` · price type ${J.price_type}`:""]}):null,(0,x.jsxs)(U,{children:[(0,x.jsx)(p.Text,{as:"strong",children:"Response"}),(0,x.jsx)(p.LabeledCheckbox,{label:"show SOAP XML",checked:G,onChange:()=>this.handleChange("showXml",!G)})]}),f?(0,x.jsx)(H,{children:(0,x.jsx)(p.Loading,{})}):(0,x.jsx)($,{children:R({showXml:G,response:P,requestXml:W,responseXml:K})})]})}}const W=(0,a.Ng)(e=>({tenant_endpoints:e.entities.tenant_endpoints||{}}))(J),K=30;class G extends s.Component{constructor(e){super(e),this.state={view:"report",tab:"overview",tenant_id:"",supplier_id:"",endpoint_code:"",has_credentials:"",live:"",active:"",problem:"",feature_name:"",requested:""},this.state={...this.state,...this.getStateFromProps(e,this.state)},c().bindAll(this,["handleChangeFilter","handleClickTest","handleClickPage","handleReset","handleClickOverviewRow"])}componentDidMount(){this.syncCurrentPageEndpoints(this.state)}getStateFromProps(e,t){const n=Math.ceil(Object.values(e.tenant_endpoints).length/K),s=e.tenant_endpoints;return t={...t||this.state,tenant_endpoints:s,current_page:1,max_page:n,total_pages:c().range(1,n)},t={...t,...this.filterEndpoints(t)},{...t,current_page_endpoints:this.getPaginatedEndpoints(t)}}componentDidUpdate(e,t){let n=this.state;e!=this.props&&(n={...n,...this.getStateFromProps(this.props)});let{tenant_endpoints:s,current_page:a}=n;a==t.current_page&&s==t.tenant_endpoints||this.syncCurrentPageEndpoints(n)}async syncCurrentPageEndpoints(e){this.setState({loading:!0});const{current_page:t,tenant_endpoints:n}=e,s=this.getPaginatedEndpoints({current_page:t,tenant_endpoints:n});try{const t=await(0,h.U_)({fields:{name:null,code:null,endpoints:null},code__in:c().uniq(c().map(s,"ps_company_code"))}),n={};c().map(t,e=>{c().map(e.endpoints,t=>{c().set(n,[e.code,t.code,t.version],t.weekly_count+(c().get(n,[e.code,t.code,t.version])||0))})}),this.setState({...e,loading:!1,current_page_endpoints:c().map(s,e=>{const t=c().sum(c().values(c().get(n,[e.ps_company_code,e.endpoint_code])))||0;return{...e,weekly_count:(parseFloat(e.weekly_count)||0)+t}})})}catch(t){this.setState({...e,loading:!1})}}getPaginatedEndpoints(e){let{current_page:t,tenant_endpoints:n}=e;const s=t-1;return Object.values(n).slice(s*K,s*K+30)}handleReset(){this.setState({tenant_id:"",supplier_id:"",endpoint_code:"",has_credentials:"",live:"",active:"",problem:"",feature_name:"",requested:"",...this.getStateFromProps(this.props)})}calculatePageLimits(e,t){const n=e-4<1?1:e-4;let s;return s=1===+n&&5!==+e?e+8>t?t:e+8:e+4>t?t:e+4,[n,s]}calculatePageList(e,t){return c().range(...this.calculatePageLimits(e,t))}handleClickPage(e){const t={...this.state,current_page:e};this.setState({...t,current_page_endpoints:this.getPaginatedEndpoints(t)})}handleChangeFilter(e,t){let n={...this.state,[t]:e,current_page:1};"tab"===t?(n="overview"===e?{...n,tenant:"",endpoint_code:"",live:"",active:"",problem:""}:"supplier"===e?{...n,tenant:"",feature_name:"",has_credentials:""}:{...n,feature_name:""},this.setState({...n,loading:!0}),this.props.onCreateFetchPSEndpoints(e,n.supplier_id).then(()=>{this.setState({loading:!1})})):this.setState({...n,...this.filterEndpoints({...n,tenant_endpoints:this.props.tenant_endpoints})})}filterEndpoints(e){let{tenant_endpoints:t,tenant_id:n,supplier_id:s,endpoint_code:a,tab:i,live:r,active:o,problem:l,feature_name:d,requested:c,has_credentials:p,max_page:u,current_page:h}=e;const m={INV:"inventory_service",ODRSTAT:"order_status_service",OSN:"shipment_service",PO:"purchase_order_service"};return t=Object.values(t).filter(e=>""===n||e.tenant_id===n).filter(e=>""!==s&&"none"!==s?e.supplier_id===s:"none"===s?!e.promo_api_name:e.supplier_id==e.supplier_id).filter(e=>""===a||"overview"!==i&&e.endpoint_code===a||"overview"===i&&e[m[a]]>0).filter(e=>""===r||e.live===r).filter(e=>""===o||e.active===o).filter(e=>""===l||e.problem===l).filter(e=>""===d||e.feature_name===d).filter(e=>"yes"===c?parseInt(e.weekly_count)>0:"no"===c?0===parseInt(e.weekly_count):e.weekly_count==e.weekly_count),""!==p&&(t="overview"===i?"yes"===p?t.filter(e=>e.commonsku_username&&""!==e.commonsku_username):t.filter(e=>void 0===e.commonsku_username||""===e.commonsku_username||!e.commonsku_username):"supplier"===i?"yes"===p?t.filter(e=>-1!==["INV","CRE"].indexOf(e.endpoint_code)&&e.commonsku_username&&""!==e.commonsku_username):t.filter(e=>-1!==["INV","CRE"].indexOf(e.endpoint_code)&&(void 0===e.commonsku_username||""===e.commonsku_username||!e.commonsku_username)):"yes"===p?t.filter(e=>-1!==["INV","CRE"].indexOf(e.endpoint_code)&&e.commonsku_username&&""!==e.commonsku_username||-1!==["ODRSTAT","OSN"].indexOf(e.endpoint_code)&&e.promo_api_username&&""!==e.promo_api_username):t.filter(e=>-1!==["INV","CRE"].indexOf(e.endpoint_code)&&(void 0===e.commonsku_username||""===e.commonsku_username)||-1!==["ODRSTAT","OSN"].indexOf(e.endpoint_code)&&(void 0===e.promo_api_username||""===e.promo_api_username||!e.promo_api_username))),t="overview"===i?t.reduce((e,t)=>
84(e[t.division_id]=t,e),{}):"supplier"===i?t.reduce((e,t)=>(e[t.endpoint_id]=t,e),{}):t.reduce((e,t)=>(e[t.tenant_id+t.endpoint_id]=t,e),{}),u=Math.ceil(Object.values(t).length/K),{tenant_endpoints:t,max_page:u,show_pages:this.calculatePageList(h,u)}}handleClickOverviewRow(e){this.setState({supplier_id:e.supplier_id},function(){this.handleChangeFilter("supplier","tab")})}handleClickTest(e){"supplier"===this.state.tab&&-1!==["ODRSTAT","OSN"].indexOf(e.endpoint_code)?this.setState({supplier_id:e.supplier_id,endpoint_code:e.endpoint_code,has_credentials:"yes"},function(){this.handleChangeFilter("tenant-supplier","tab")}):this.props.onCreatePSTestPopup(e)}renderLoading(){return(0,x.jsx)("div",{"data-test-name":"PSReport.renderLoading",className:"row popup-content column",children:(0,x.jsx)("div",{className:"small-12 columns",children:(0,x.jsxs)("div",{className:"small-12 text-center",children:[(0,x.jsx)("br",{}),(0,x.jsx)("img",{src:"/images/gears.gif"}),(0,x.jsx)("br",{})]})})})}renderHeader(){const{header_style:e}=Y;return"overview"===this.state.tab?(0,x.jsxs)("tr",{"data-test-name":"PSReport.renderHeader",className:"cursor-default",children:[(0,x.jsx)("td",{width:"10%",style:e,className:"table-cell-sticky",children:"Supplier"}),(0,x.jsx)("td",{width:"10%",style:e,className:"table-cell-sticky",children:"Endpoint Owner"}),(0,x.jsx)("td",{width:"10%",style:e,className:"table-cell-sticky",children:"Feature"}),(0,x.jsx)("td",{width:"5%",style:e,className:"table-cell-sticky",children:"cs Cred."}),(0,x.jsx)("td",{width:"10%",style:e,className:"table-cell-sticky",children:"Tenant Cred. #"}),(0,x.jsx)("td",{width:"10%",style:e,className:"table-cell-sticky",children:"has INV"}),(0,x.jsx)("td",{width:"10%",style:e,className:"table-cell-sticky",children:"has ODRSTAT"}),(0,x.jsx)("td",{width:"10%",style:e,className:"table-cell-sticky",children:"has OSN"}),(0,x.jsx)("td",{width:"10%",style:e,className:"table-cell-sticky",children:"has PO"}),(0,x.jsx)("td",{width:"10%",style:e,className:"table-cell-sticky",children:"Credentials"})]}):"supplier"===this.state.tab?(0,x.jsxs)("tr",{"data-test-name":"PSReport.renderHeader",className:"cursor-default",children:[(0,x.jsx)("td",{width:"10%",style:e,className:"table-cell-sticky",children:"Supplier"}),-1!==["INV","CRE"].indexOf(this.state.endpoint_code)&&(0,x.jsx)("td",{width:"5%",style:e,className:"table-cell-sticky",children:"cs Cred."}),-1!==["ODRSTAT","OSN"].indexOf(this.state.endpoint_code)&&(0,x.jsx)("td",{width:"10%",style:e,className:"table-cell-sticky",children:"Tenant Cred. #"}),(0,x.jsx)("td",{width:"15%",style:e,className:"table-cell-sticky",children:"Endpoint Url"}),(0,x.jsx)("td",{width:"5%",style:e,className:"table-cell-sticky",children:"Type"}),(0,x.jsx)("td",{width:"5%",style:e,className:"table-cell-sticky",children:"Version"}),(0,x.jsx)("td",{width:"5%",style:e,className:"table-cell-sticky",children:"Active"}),(0,x.jsx)("td",{width:"5%",style:e,className:"table-cell-sticky",children:"Success"}),(0,x.jsx)("td",{width:"10%",style:e,className:"table-cell-sticky",children:"Note"}),(0,x.jsx)("td",{width:"10%",style:e,className:"table-cell-sticky",children:"Error"}),(0,x.jsx)("td",{width:"5%",style:e,className:"table-cell-sticky",children:"Weekly Count"}),(0,x.jsx)("td",{width:"5%",style:e,className:"table-cell-sticky",children:"Test"})]}):(0,x.jsxs)("tr",{"data-test-name":"PSReport.renderHeader",className:"cursor-default",children:[(0,x.jsx)("td",{width:"10%",style:e,className:"table-cell-sticky",children:"Tenant"}),(0,x.jsx)("td",{width:"10%",style:e,className:"table-cell-sticky",children:"Supplier"}),(0,x.jsx)("td",{width:"5%",style:e,className:"table-cell-sticky",children:"Tenant Cred."}),(0,x.jsx)("td",{width:"25%",style:e,className:"table-cell-sticky",children:"Endpoint Url"}),(0,x.jsx)("td",{width:"5%",style:e,className:"table-cell-sticky",children:"Type"}),(0,x.jsx)("td",{width:"5%",style:e,className:"table-cell-sticky",children:"Version"}),(0,x.jsx)("td",{width:"5%",style:e,className:"table-cell-sticky",children:"Active"}),(0,x.jsx)("td",{width:"5%",style:e,className:"table-cell-sticky",children:"Success"}),(0,x.jsx)("td",{width:"10%",style:e,className:"table-cell-sticky",children:"Error"}),(0,x.jsx)("td",{width:"5%",style:e,className:"table-cell-sticky",children:"Test"})]})}renderIcon(e,t){if("problem"===t){if("yes"===e)return(0,x.jsx)("img",{"data-test-name":"PSReport.renderIcon",src:"/images/unapproved.png"});if("no"===e)return(0,x.jsx)("img",{"data-test-name":"PSReport.renderIcon",src:"/images/approved.png"})}else{if("yes"===e)return(0,x.jsx)("img",{"data-test-name":"PSReport.renderIcon",src:"/images/approved.png"});if("no"===e)return(0,x.jsx)("img",{"data-test-name":"PSReport.renderIcon",src:"/images/unapproved.png"})}return e}renderRow(e){const{test_button_style:t}=Y,n=e.commonsku_username&&""!==e.commonsku_username?"yes":"no",s=e.promo_api_username&&""!==e.promo_api_username?"yes":"no";let a=!1;return"overview"!==this.state.tab&&(a=-1!==["INV"].indexOf(e.endpoint_code)&&"yes"===n||-1!==["ODRSTAT","OSN"].indexOf(e.endpoint_code)&&"supplier"===this.state.tab||-1!==["ODRSTAT","OSN"].indexOf(e.endpoint_code)&&"yes"===s&&"tenant-supplier"===this.state.tab),"overview"===this.state.tab?(0,x.jsxs)("tr",{"data-test-name":"PSReport.renderRow",onClick:t=>{t.preventDefault(),this.handleClickOverviewRow(e)},children:[(0,x.jsx)("td",{children:(0,x.jsx)("b",{children:(0,x.jsx)("a",{href:`/vendor.php?id=${e.supplier_id}&division_id=${e.division_id}`,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:e.supplier_name})})}),(0,x.jsx)("td",{children:(0,x.jsx)("b",{children:(0,x.jsx)("a",{href:`/vendor.php?id=${e.supplier_id}&division_id=${e.division_id}`,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:e.division_name})})}),(0,x.jsx)("td",{children:e.feature_name}),(0,x.jsx)("td",{children:this.renderIcon(n)}),(0,x.jsxs)("td",{children:[e.tenant_credentials_count," / ",this.props.full_tenants_count]}),(0,x.jsx)("td",{children:this.renderIcon(e.inventory_service>0?"yes":"no")}),(0,x.jsx)("td",{children:this.renderIcon(e.order_status_service>0?"yes":"no")}),(0,x.jsx)("td",{children:this.renderIcon(e.shipment_service>0?"yes":"no")}),(0,x.jsx)("td",{children:this.renderIcon(e.purchase_order_service>0?"yes":"no")}),(0,x.jsx)("td",{onClick:e=>e.stopPropagation(),children:e.promo_api_name&&(0,x.jsx)(p.Theme,{children:(0,x.jsx)(p.ShowPopup,{popup:t=>(0,x.jsx)(v,{"data-test-name":"PSReport.renderRow",...t,ps_company_code:e.ps_company_code,promo_api_name:e.promo_api_name}),render:e=>{let{onClick:t}=e;return(0,x.jsx)(p.Button,{"data-test-name":"PSReport.renderRow",type:"button",size:"small",onClick:t,children:"Upload"})}})})})]},e.division_id):"supplier"===this.state.tab?(0,x.jsxs)("tr",{"data-test-name":"PSReport.renderRow",onClick:t=>{t.preventDefault(),this.props.onCreateEditPSEndpointPopup(e)},children:[(0,x.jsxs)("td",{children:[(0,x.jsx)("b",{children:(0,x.jsx)("a",{href:`/vendor.php?id=${e.supplier_id}&division_id=${e.division_id}`,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:e.division_name})}),(0,x.jsx)("br",{}),e.supplier_name]}),-1!==["INV","CRE"].indexOf(this.state.endpoint_code)&&(0,x.jsx)("td",{children:this.renderIcon(n)}),-1!==["ODRSTAT","OSN"].indexOf(this.state.endpoint_code)&&(0,x.jsxs)("td",{children:[e.tenant_credentials_count," / ",this.props.full_tenants_count]}),(0,x.jsx)("td",{style:{wordBreak:"break-all"},children:(0,x.jsx)("b",{children:(0,x.jsx)("a",{href:e.endpoint_url,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:e.endpoint_url})})}),(0,x.jsx)("td",{children:e.endpoint_code}),(0,x.jsx)("td",{children:e.endpoint_version}),(0,x.jsx)("td",{children:this.renderIcon(e.active)}),(0,x.jsx)("td",{children:this.renderIcon(e.problem,"problem")}),(0,x.jsx)("td",{style:{wordBreak:"break-all"},children:e.note}),(0,x.jsx)("td",{style:{wordBreak:"break-all"},children:e.error}),(0,x.jsx)("td",{children:e.weekly_count}),(0,x.jsx)("td",{children:a?(0,x.jsx)("button",{className:"small button",style:t,onClick:t=>{t.preventDefault(),t.stopPropagation(),this.handleClickTest(e)},children:"Test"}):"Missing Credentials"})]},e.endpoint_id):(0,x.jsxs)("tr",{"data-test-name":"PSReport.renderRow",onClick:t=>{t.preventDefault(),this.props.onCreateEditPSEndpointPopup(e)},children:[(0,x.jsx)("td",{children:(0,x.jsx)("b",{children:e.tenant_name})}),(0,x.jsxs)("td",{children:[(0,x.jsx)("b",{children:(0,x.jsx)("a",{href:`/vendor.php?id=${e.supplier_id}&division_id=${e.division_id}`,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:e.division_name})}),(0,x.jsx)("br",{}),e.supplier_name]}),(0,x.jsx)("td",{children:-1!==["INV","CRE"].indexOf(e.endpoint_code)?"n/a":this.renderIcon(s)}),(0,x.jsx)("td",{style:{wordBreak:"break-all"},children:(0,x.jsx)("b",{children:(0,x.jsx)("a",{href:e.endpoint_url,target:"_blank",rel:"noopener noreferrer",onClick:e=>e.stopPropagation(),children:e.endpoint_url})})}),(0,x.jsx)("td",{children:e.endpoint_code}),(0,x.jsx)("td",{children:e.endpoint_version}),(0,x.jsx)("td",{children:this.renderIcon(e.active)}),(0,x.jsx)("td",{children:this.renderIcon(e.problem,"problem")}),(0,x.jsx)("td",{style:{wordBreak:"break-all"},children:e.error}),(0,x.jsx)("td",{children:a?(0,x.jsx)("button",{className:"small button",style:t,onClick:t=>{t.preventDefault(),t.stopPropagation(),this.handleClickTest(e)},children:"Test"}):"Missing Credentials"})]},e.tenant_id+e.endpoint_id)}renderNoRow(){return(0,x.jsx)("tr",{"data-test-name":"PSReport.renderNoRow",children:(0,x.jsx)("td",{colSpan:"12",children:"There are no endpoints available"})})}
84renderPageList(){const{page_list_container:e,page_button_style:t,page_button_active_style:n,page_between_style:s}=Y;return(0,x.jsx)("div",{"data-test-name":"PSReport.renderPageList",className:"row",style:e,children:(0,x.jsxs)("div",{className:"large-5 large-centered columns",children:[this.state.current_page>1?(0,x.jsx)("a",{style:t,onClick:e=>{e.preventDefault(),this.handleClickPage(this.state.current_page-1)},children:"PREV"},"prev"):null,-1===this.state.show_pages.indexOf(1)?(0,x.jsx)("a",{style:1===this.state.current_page?n:t,onClick:e=>{e.preventDefault(),this.handleClickPage(1)},children:1},1):null,-1===this.state.show_pages.indexOf(1)&&-1===this.state.show_pages.indexOf(2)&&Object.values(this.state.tenant_endpoints).length>K?(0,x.jsx)("span",{style:s,children:"..."}):null,this.state.show_pages.map(e=>(0,x.jsx)("a",{style:this.state.current_page===e?n:t,onClick:t=>{t.preventDefault(),this.handleClickPage(e)},children:e},e)),-1===this.state.show_pages.indexOf(this.state.max_page)&&-1===this.state.show_pages.indexOf(this.state.max_page-1)&&Object.values(this.state.tenant_endpoints).length>K?(0,x.jsx)("span",{style:s,children:"..."}):null,-1===this.state.show_pages.indexOf(this.state.max_page)&&1!==this.state.max_page?(0,x.jsx)("a",{style:this.state.current_page===this.state.max_page?n:t,onClick:e=>{e.preventDefault(),this.handleClickPage(this.state.max_page)},children:this.state.max_page},this.state.max_page):null,this.state.current_page<this.state.max_page?(0,x.jsx)("a",{style:t,onClick:e=>{e.preventDefault(),this.handleClickPage(this.state.current_page+1)},children:"NEXT"},"next"):null]})},"pages")}render(){const{summary_style:e,reset_style:t}=Y,{tenants:n,suppliers:s}=this.props,{current_page_endpoints:a}=this.state,i=[{key:"",value:"All"}].concat(n),r=[{key:"",value:"All"},{key:"none",value:"None"}].concat(s);if("validator"===this.state.view)return(0,x.jsx)("div",{"data-test-name":"PSReport.render",className:"main-content",children:(0,x.jsx)(W,{onBack:()=>this.setState({view:"report"})})});const o="overview"===this.state.tab?"small-12 medium-3 columns":"small-12 medium-4 columns";return(0,x.jsxs)("div",{"data-test-name":"PSReport.render",className:"main-content",children:[(0,x.jsx)("div",{className:"row full-width",children:(0,x.jsxs)("ul",{className:"tabs","data-tabs":!0,style:{background:"#EDF2F5",border:"none"},children:[(0,x.jsx)("li",{className:"tabs-title"+("overview"===this.state.tab?" is-active":""),children:(0,x.jsx)("a",{style:{fontSize:"14px"},onClick:e=>{e.preventDefault(),this.handleChangeFilter("overview","tab")},"aria-selected":"overview"===this.state.tab,children:"Overview"})}),(0,x.jsx)("li",{className:"tabs-title"+("supplier"===this.state.tab?" is-active":""),children:(0,x.jsx)("a",{style:{fontSize:"14px"},onClick:e=>{e.preventDefault(),this.handleChangeFilter("supplier","tab")},"aria-selected":"supplier"===this.state.tab,children:"Generic"})}),(0,x.jsx)("li",{className:"tabs-title"+("tenant-supplier"===this.state.tab?" is-active":""),style:"tenant-supplier"!==this.state.tab?{display:"none"}:null,children:(0,x.jsx)("a",{style:{fontSize:"14px"},onClick:e=>{e.preventDefault(),this.handleChangeFilter("tenant-supplier","tab")},"aria-selected":"tenant-supplier"===this.state.tab,children:"Tenants Specific"})}),(0,x.jsx)("button",{type:"button",className:"small button",onClick:e=>{e.preventDefault(),this.setState({view:"validator"})},style:{...t,marginRight:"8px"},children:"PS Product Validator"}),(0,x.jsx)("button",{type:"button",className:"small button",onClick:e=>{e.preventDefault(),this.handleReset()},style:t,children:"Reset"}),(0,x.jsxs)("li",{style:e,children:[(0,x.jsxs)("span",{children:[(0,x.jsx)("b",{children:"# of Suppliers on Promostandards: "}),s.length,"  "]}),(0,x.jsxs)("span",{children:["  ",(0,x.jsx)("b",{children:"# of Rows: "}),Object.values(this.state.tenant_endpoints).length]})]})]})}),(0,x.jsxs)("div",{className:"row collapse",style:{maxWidth:"initial",marginTop:"10px",fontSize:"14px"},children:["tenant-supplier"===this.state.tab?(0,x.jsx)(u.A,{className:o,placeholder:"Tenants",value:this.state.tenant_id,options:i,onChange:e=>this.handleChangeFilter(e,"tenant_id"),disabled:this.state.loading}):null,(0,x.jsx)(u.A,{className:o,placeholder:"Suppliers",value:this.state.supplier_id,options:r,onChange:e=>this.handleChangeFilter(e,"supplier_id"),disabled:this.state.loading}),(0,x.jsx)(u.A,{className:o,placeholder:"Type",value:this.state.endpoint_code,options:[{key:"",value:"All"},{key:"INV",value:"Inventory"},{key:"ODRSTAT",value:"Order Status"},{key:"OSN",value:"Order Shipment Notification"},{key:"PO",value:"Purchase Order"}],onChange:e=>this.handleChangeFilter(e,"endpoint_code"),disabled:this.state.loading}),"overview"===this.state.tab||"supplier"===this.state.tab&&-1!==["INV","CRE"].indexOf(this.state.endpoint_code)||"tenant-supplier"===this.state.tab?(0,x.jsx)(u.A,{className:o,placeholder:"overview"===this.state.tab||"supplier"===this.state.tab?"commonsku Credentials":"Tenant Credentials",value:this.state.has_credentials,options:[{key:"",value:"All"},{key:"yes",value:"Has Credentials"},{key:"no",value:"No Credentials"}],onChange:e=>this.handleChangeFilter(e,"has_credentials"),disabled:this.state.loading}
84):null,"supplier"===this.state.tab||"tenant-supplier"===this.state.tab?(0,x.jsx)(u.A,{className:o,placeholder:"Active",value:this.state.active,options:[{key:"",value:"All"},{key:"yes",value:"Active"},{key:"no",value:"Inactive"}],onChange:e=>this.handleChangeFilter(e,"active"),disabled:this.state.loading}):null,"supplier"===this.state.tab||"tenant-supplier"===this.state.tab?(0,x.jsx)(u.A,{className:o+" end",placeholder:"Success",value:this.state.problem,options:[{key:"",value:"All"},{key:"no",value:"Last Call Successful / Not Tested"},{key:"yes",value:"Last Call Not Successful"}],onChange:e=>this.handleChangeFilter(e,"problem"),disabled:this.state.loading}):null,"overview"===this.state.tab||"supplier"===this.state.tab?(0,x.jsx)(u.A,{className:o+" end",placeholder:"Feature",value:this.state.feature_name,options:[{key:"",value:"All"},{key:"COMMUNITYBASIC",value:"Community"},{key:"COMMUNITYPLUS",value:"Community+"},{key:"CONNECTEDBASIC",value:"Connected"},{key:"CONNECTEDPLUS",value:"Connected+"},{key:"CONNECTED",value:"Connected (Old)"},{key:"INSIGHTS",value:"Insights"},{key:"COLLABORATE",value:"Collaborate"},{key:"DORMANT",value:"Dormant"}],onChange:e=>this.handleChangeFilter(e,"feature_name"),disabled:this.state.loading}):null,"supplier"===this.state.tab?(0,x.jsx)(u.A,{className:o+" end",placeholder:"Requested",value:this.state.requested,options:[{key:"",value:"Any"},{key:"yes",value:"Has been requested this week"},{key:"no",value:"Not been requested this week"}],onChange:e=>this.handleChangeFilter(e,"requested"),disabled:this.state.loading}):null]}),this.state.loading?this.renderLoading():[(0,x.jsxs)("table",{style:{marginBottom:0,tableLayout:"fixed"},children:[(0,x.jsx)("thead",{style:{fontSize:"14px"},children:this.renderHeader()}),(0,x.jsx)("tbody",{style:{fontSize:"12px"},children:Object.values(this.state.tenant_endpoints).length>0?a.map(e=>this.renderRow(e)):this.renderNoRow()})]},"table"),Object.values(this.state.tenant_endpoints).length>0?this.renderPageList():null]]})}}const Y={header_style:{top:"68px",background:"#EDF2F5"},page_list_container:{marginBottom:"150px"},page_button_style:{background:"#edf2f4",border:"1px solid #c6dde4",borderRadius:"3px",color:"#5ba0b4",padding:"5px 4px 4px 4px",fontSize:"13px",cursor:"pointer",float:"left",minWidth:"27px",textAlign:"center"},page_button_active_style:{background:"#aaa",border:"1px solid #c6dde4",borderRadius:"3px",color:"#5ba0b4",padding:"5px 4px 4px 4px",fontSize:"13px",cursor:"pointer",float:"left",minWidth:"27px",textAlign:"center"},page_between_style:{float:"left",margin:"0 10px"},summary_style:{float:"right",margin:"10px",backgroundColor:"#DFF1FB",padding:"5px 20px"},reset_style:{margin:"12px 10px 0px 0px",float:"right"},test_button_style:{margin:0}},Q=(0,a.Ng)(e=>({tenant_endpoints:e.entities.tenant_endpoints,tenants:(0,b.fE)(e),suppliers:(0,b.jo)(e),full_tenants_count:e.entities.full_tenants_count}),e=>({onCreatePSTestPopup:t=>{e((0,j.ko)(t))},onCreateEditPSEndpointPopup:t=>{e((0,j.nT)(t))},onCreateFetchPSEndpoints:(t,n)=>e((0,y.EF)(t,n))}))(G);n(48982),n(46844),n(31128),n(75814);var Z=n(97598),ee=n(44356),te=n(67564),ne=void 0===ne?te.x.initialState:ne;const se=(e,t)=>{let n,s;return t.type===y.Az_?(n=t.payload.tenants,s=Object.values(n).map(e=>e.tenant_id),s):e},ae=(e,t)=>{let n,s,a,i;switch(t.type){case y.MrS:n=t.payload.endpoint_id,s=t.payload.endpoint,a=Object.assign({},e);for(let e in a)a.hasOwnProperty(e)&&a[e].endpoint_id===n&&(s.commonsku_username&&(a[e].commonsku_username=s.commonsku_username),s.commonsku_password&&(a[e].commonsku_password=s.commonsku_password),s.promo_api_username&&(a[e].promo_api_username=s.promo_api_username),s.promo_api_password&&(a[e].promo_api_password=s.promo_api_password),a[e].note=s.note,a[e].active=1==s.active?"yes":"no",a[e].problem=1==s.problem?"yes":"no",a[e].error=s.error,a[e].weekly_count=s.weekly_count);return a;case y.Az_:return i=t.payload.tenant_endpoints,i}return e},ie=(e,t)=>{let n;return t.type===y.Az_?(n=t.payload.tenants,n):e},re={display:Z.A,dropdowns:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ne.dropdowns,t=arguments.length>1?arguments[1]:void 0;return Object.assign({},e,{tenants:se(e.tenants,t)})},entities:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ne.entities,t=arguments.length>1?arguments[1]:void 0;return Object.assign({},e,{tenant_endpoints:ae(e.tenant_endpoints,t),tenants:ie(e.tenants,t),bookmarks:(0,ee.GP)(e.bookmarks,t),recent_orders:(0,ee.bp)(e.recent_orders,t),reminders:(0,ee.MN)(e.reminders,t),notifications:(0,ee.fr)(e.notifications,t),notification_count:(0,ee.bQ)(e.notification_count,t)})},identity:function(){return arguments.length>0&&void 0!==arguments[0]?arguments[0]:ne.identity}};var oe=n(64128);class le extends s.Component{render(){const{popups:e}=this.props;return(0,x.jsxs)("div",{"data-test-name":"PSReportApp.render",children:[(0,x.jsx)(r.A,{}),(0,x.jsx)(o.A,{popups:e,children:(0,x.jsx)(Q,{})}),(0,x.jsx)(l.A,{popups:e})]})}}const de=(0,oe.A)((0,a.Ng)((e,t)=>({identity:e.identity,popups:(0,i.ag)(e)}))(le),re,!0)},26627(e,t,n){n.d(t,{a:()=>r,l:()=>o});var s=n(21541),a=n.n(s),i=n(22224);const r=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(n=>{a().parse(e,{header:!0,skipEmptyLines:!0,complete:e=>{t.trim&&(e={...e,data:(0,i.map)(e.data,e=>(0,i.mapValues)(e,e=>(0,i.trim)(e)))}),n(e)},error:e=>{n({data:[],errors:[e]})}})})},o=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(await Promise.all((0,i.map)(e,async e=>await r(e,t)))).reduce((e,t)=>
84{let{data:n,errors:s}=e;return console.log({data:n,errors:s},t),{data:(0,i.concat)(n,t.data),errors:(0,i.concat)(s,t.errors)}},{data:[],errors:[]})}}}]);
85//# sourceMappingURL=PSReportApp.8d54f937.chunk.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.