best-unit 0.0.44 → 0.0.45

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.
@@ -42,7 +42,7 @@
42
42
  padding: 4px;
43
43
  color: #999;
44
44
  font-size: 12px;
45
- `,c.onclick=()=>{document.body.removeChild(s)},s.appendChild(c)}document.body.appendChild(s),o!==0&&setTimeout(()=>{document.body.contains(s)&&document.body.removeChild(s)},o||3e3)}success(t){this.show("success",t)}error(t){this.show("error",t)}warning(t){this.show("warning",t)}info(t){this.show("info",t)}}const qe=new so;var Ae=(e=>(e.ZH="zh",e.EN="en",e))(Ae||{}),H=(e=>(e.WHITE="white",e.DARK="dark",e))(H||{});function ao(e={}){const{baseURL:t="/api",timeout:n=1e4,onError:r}=e,o=A.create({baseURL:t,timeout:n});return o.interceptors.request.use(i=>{const s=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}"),{token:a,locale:c}=s;return i.headers={...i.headers,Authorization:a,"x-locale":c===Ae.ZH?"zh-CN":"en-US"},i}),o.interceptors.response.use(i=>{if(i.data&&i.data.code===0)return i.data;const s=i.data?.msg||i.data?.message||"未知错误";return qe.error(s),r&&r(s,i),Promise.reject(i.data||{message:"未知错误"})},i=>{const s=i.response?.data?.msg||i.response?.data?.message||i.message||"网络请求失败";return qe.error(s),r&&r(s,i),Promise.reject(i)}),o}const Q=ao();function lo(){const e=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}");return Q.get("/balance",{params:{merchant_id:e.merchantId,biz_type:e.bizType,fund_balance_id:e.fundBalanceId}}).then(t=>{const n=t.data;return{totalAmount:n.total_amount||0,availableAmount:n.available_amount||0,frozenAmount:n.frozen_amount||0}})}const co=async()=>Q.get("/all-dicts",{}).then(e=>(sessionStorage.setItem("all_dicts",JSON.stringify(e.data)),e.data||{})),uo=async(e,t)=>Q.post("/oss/upload",e,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:n=>{if(n.total){const r=Math.round(n.loaded*100/n.total);t&&t(r)}}}).then(n=>n.data?.url||""),fo=async e=>{const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}"),n={merchant_id:Number(t.merchantId),biz_type:t.bizType,source_operator:String(t.userId),transfer_no:e.transferNo,transfer_channel:e.transferChannel,voucher_urls:e.voucherUrls};return Q.post("/offline/recharge/create",n,{})},po=async e=>{const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}");console.log(t,"fundUnitParams");const n={merchant_id:Number(t.merchantId),biz_type:t.bizType,source_operator:String(t.userId),amount:e.amount,currency:e.currency,recharge_channel:e.rechargeChannel,return_url:window.location.href};return Q.post("/online/recharge/create",n,{}).then(r=>r.data.redirect_url)},ho=async e=>Q.get("/calc-payment-amount",{params:e}).then(t=>t.data.payment_amount);function mo(e){co();const{merchant_id:t,biz_type:n,fund_balance_id:r,theme:o=H.WHITE,locale:i=Ae.ZH}=e,s="Bearer "+e.token;return sessionStorage.setItem("fund_unit_params",JSON.stringify({merchantId:t,bizType:n,fundBalanceId:r,token:s,theme:o,locale:i})),{token:s,merchantId:t,bizType:n,fundBalanceId:r,theme:o,locale:i}}const _o={"/api":{target:"https://fund.bestfulfill.tech/api/sdk",changeOrigin:!0,rewrite:e=>e.replace(/^\/api/,""),secure:!1}};function go({onClick:e,color:t,children:n}){const i=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE?{background:t||"#1890ff",color:"#fff",border:"none",borderRadius:6,padding:"8px 16px",cursor:"pointer",fontSize:16,fontWeight:600}:{background:t||"#00E8C6",color:"#fff",border:"none",borderRadius:6,padding:"8px 16px",cursor:"pointer",fontSize:16,fontWeight:600};return m("button",{style:i,onClick:e,type:"button",children:n})}const bo={余额详情:"余额详情",真实金额:"真实金额",冻结金额:"冻结金额",总可用:"总可用",暂无数据:"暂无数据","金额需在1到999999.99之间":"金额需在1到999999.99之间","充值 / 转账":"充值 / 转账",在线充值:"在线充值",线下转账:"线下转账",充值币种:"充值币种",充值金额:"充值金额",支付平台:"支付平台",请选择充值币种:"请选择充值币种",请输入充值金额:"请输入充值金额",请选择支付平台:"请选择支付平台","需要收取手续费,实际支付金额约为:":"需要收取手续费,实际支付金额约为:","提交失败,请重试":"提交失败,请重试","提交中...":"提交中...",去支付:"去支付",取消:"取消",关闭:"关闭",第三方支付平台:"第三方支付平台",交易ID:"交易ID",请输入转账交易ID:"请输入转账交易ID",上传文件:"上传文件",请上传转账凭证:"请上传转账凭证",离线充值创建成功:"离线充值创建成功","加载中...":"加载中...",错误:"错误",成功:"成功",必填:"必填","充值/转账":"充值/转账",切换为暗黑主题:"切换为暗黑主题",切换为白色主题:"切换为白色主题",点击或拖拽文件到此处上传:"点击或拖拽文件到此处上传","支持 JPG、PNG、PDF 格式,单个文件不超过 20MB,最多上传":"支持 JPG、PNG、PDF 格式,单个文件不超过 20MB,最多上传",个文件:"个文件","正在上传...":"正在上传...",已上传:"已上传",移除:"移除"};function yo(e){return bo[e]||e}const wo={余额详情:"Balance Details",真实金额:"Real Amount",冻结金额:"Frozen Amount",总可用:"Total Available",暂无数据:"No Data","金额需在1到999999.99之间":"Amount must be between 1 and 999999.99","充值 / 转账":"Recharge / Transfer",在线充值:"Online Recharge",线下转账:"Offline Transfer",充值币种:"Recharge Currency",充值金额:"Recharge Amount",支付平台:"Payment Platform",请选择充值币种:"Please select recharge currency",请输入充值金额:"Please enter recharge amount",请选择支付平台:"Please select payment platform","需要收取手续费,实际支付金额约为:":"requires a handling fee, the actual payment amount is approximately: ","提交失败,请重试":"Submit failed, please try again","提交中...":"Submitting...",去支付:"Go to Pay",取消:"Cancel",关闭:"Close",第三方支付平台:"Third-party Payment Platform",交易ID:"Transaction ID",请输入转账交易ID:"Please enter transfer transaction ID",上传文件:"Upload Files",请上传转账凭证:"Please upload transfer voucher",离线充值创建成功:"Offline recharge created successfully","加载中...":"Loading...",错误:"Error",成功:"Success",必填:"Required","充值/转账":"Recharge/Transfer",切换为暗黑主题:"Switch to Dark Theme",切换为白色主题:"Switch to Light Theme",点击或拖拽文件到此处上传:"Click or drag files here to upload","支持 JPG、PNG、PDF 格式,单个文件不超过 20MB,最多上传":"Supports JPG, PNG, PDF formats, single file not exceeding 20MB, maximum",个文件:"files can be uploaded","正在上传...":"Uploading...",已上传:"Uploaded",移除:"Remove"};function xo(e){return wo[e]||e}function Eo(){return JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").locale||Ae.ZH}function E(e){return Eo()==="zh"?yo(e):xo(e)}const We=({value:e,onChange:t,options:n,placeholder:r,style:o,error:i,disabled:s,dropdownStyle:a,className:c,dropdownClassName:u,children:f})=>{const[l,g]=N(!1),_=be(null),[h,b]=N(null),y=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE,w=y?{trigger:{background:s?"#f5f5f5":"#fff",color:s?"#bfbfbf":e?"#222":"#bfbfbf",border:i?"1px solid #ff4d4f":s?"1px solid #f0f0f0":"1px solid #d9d9d9"},dropdown:{background:"#fff",border:"1px solid #d9d9d9",color:"#222"},option:(x,R,k)=>({color:R?"#bfbfbf":x?"#1890ff":"#222",background:x?"#e6f7ff":k&&!R||R?"#f5f5f5":"#fff"}),placeholder:{color:"#bfbfbf"}}:{trigger:{background:"#23262F",color:s?"#666":e?"#fff":"#666",border:i?"1px solid #ff4d4f":"1px solid #23262F"},dropdown:{background:"#23262F",border:"1px solid #23262F",color:"#fff"},option:(x,R,k)=>({color:R?"#666":x?"#00E8C6":"#fff",background:x?"#23262F":k&&!R?"#333843":"#23262F"}),placeholder:{color:"#666"}};Ce(()=>{if(!l)return;const x=R=>{_.current&&!_.current.contains(R.target)&&g(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[l]);const v=n.find(x=>x.value===e);return m("div",{ref:_,className:c,style:{position:"relative",...o},children:[m("style",{children:`
45
+ `,c.onclick=()=>{document.body.removeChild(s)},s.appendChild(c)}document.body.appendChild(s),o!==0&&setTimeout(()=>{document.body.contains(s)&&document.body.removeChild(s)},o||3e3)}success(t){this.show("success",t)}error(t){this.show("error",t)}warning(t){this.show("warning",t)}info(t){this.show("info",t)}}const qe=new so;var Ae=(e=>(e.ZH="zh",e.EN="en",e))(Ae||{}),H=(e=>(e.WHITE="white",e.DARK="dark",e))(H||{});function ao(e={}){const{baseURL:t="/api",timeout:n=1e4,onError:r}=e,o=A.create({baseURL:t,timeout:n});return o.interceptors.request.use(i=>{const s=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}"),{token:a,locale:c}=s;return console.log(s,"fundUnitParams"),i.headers={...i.headers,Authorization:a,"x-locale":c===Ae.ZH?"zh-CN":"en-US"},i}),o.interceptors.response.use(i=>{if(i.data&&i.data.code===0)return i.data;const s=i.data?.msg||i.data?.message||"未知错误";return qe.error(s),r&&r(s,i),Promise.reject(i.data||{message:"未知错误"})},i=>{const s=i.response?.data?.msg||i.response?.data?.message||i.message||"网络请求失败";return qe.error(s),r&&r(s,i),Promise.reject(i)}),o}const Q=ao();function lo(){const e=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}");return Q.get("/balance",{params:{merchant_id:e.merchantId,biz_type:e.bizType,fund_balance_id:e.fundBalanceId}}).then(t=>{const n=t.data;return{totalAmount:n.total_amount||0,availableAmount:n.available_amount||0,frozenAmount:n.frozen_amount||0}})}const co=async()=>Q.get("/all-dicts",{}).then(e=>(sessionStorage.setItem("all_dicts",JSON.stringify(e.data)),e.data||{})),uo=async(e,t)=>Q.post("/oss/upload",e,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:n=>{if(n.total){const r=Math.round(n.loaded*100/n.total);t&&t(r)}}}).then(n=>n.data?.url||""),fo=async e=>{const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}"),n={merchant_id:Number(t.merchantId),biz_type:t.bizType,source_operator:String(t.userId),transfer_no:e.transferNo,transfer_channel:e.transferChannel,voucher_urls:e.voucherUrls};return Q.post("/offline/recharge/create",n,{})},po=async e=>{const t=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}");console.log(t,"fundUnitParams");const n={merchant_id:Number(t.merchantId),biz_type:t.bizType,source_operator:String(t.userId),amount:e.amount,currency:e.currency,recharge_channel:e.rechargeChannel,return_url:window.location.href};return Q.post("/online/recharge/create",n,{}).then(r=>r.data.redirect_url)},ho=async e=>Q.get("/calc-payment-amount",{params:e}).then(t=>t.data.payment_amount);function mo(e){co();const{merchant_id:t,biz_type:n,fund_balance_id:r,theme:o=H.WHITE,locale:i=Ae.ZH}=e,s="Bearer "+e.token;return sessionStorage.setItem("fund_unit_params",JSON.stringify({merchantId:t,bizType:n,fundBalanceId:r,token:s,theme:o,locale:i})),{token:s,merchantId:t,bizType:n,fundBalanceId:r,theme:o,locale:i}}const _o={"/api":{target:"https://fund.bestfulfill.tech/api/sdk",changeOrigin:!0,rewrite:e=>e.replace(/^\/api/,""),secure:!1}};function go({onClick:e,color:t,children:n}){const i=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE?{background:t||"#1890ff",color:"#fff",border:"none",borderRadius:6,padding:"8px 16px",cursor:"pointer",fontSize:16,fontWeight:600}:{background:t||"#00E8C6",color:"#fff",border:"none",borderRadius:6,padding:"8px 16px",cursor:"pointer",fontSize:16,fontWeight:600};return m("button",{style:i,onClick:e,type:"button",children:n})}const bo={余额详情:"余额详情",真实金额:"真实金额",冻结金额:"冻结金额",总可用:"总可用",暂无数据:"暂无数据","金额需在1到999999.99之间":"金额需在1到999999.99之间","充值 / 转账":"充值 / 转账",在线充值:"在线充值",线下转账:"线下转账",充值币种:"充值币种",充值金额:"充值金额",支付平台:"支付平台",请选择充值币种:"请选择充值币种",请输入充值金额:"请输入充值金额",请选择支付平台:"请选择支付平台","需要收取手续费,实际支付金额约为:":"需要收取手续费,实际支付金额约为:","提交失败,请重试":"提交失败,请重试","提交中...":"提交中...",去支付:"去支付",取消:"取消",关闭:"关闭",第三方支付平台:"第三方支付平台",交易ID:"交易ID",请输入转账交易ID:"请输入转账交易ID",上传文件:"上传文件",请上传转账凭证:"请上传转账凭证",离线充值创建成功:"离线充值创建成功","加载中...":"加载中...",错误:"错误",成功:"成功",必填:"必填","充值/转账":"充值/转账",切换为暗黑主题:"切换为暗黑主题",切换为白色主题:"切换为白色主题",点击或拖拽文件到此处上传:"点击或拖拽文件到此处上传","支持 JPG、PNG、PDF 格式,单个文件不超过 20MB,最多上传":"支持 JPG、PNG、PDF 格式,单个文件不超过 20MB,最多上传",个文件:"个文件","正在上传...":"正在上传...",已上传:"已上传",移除:"移除"};function yo(e){return bo[e]||e}const wo={余额详情:"Balance Details",真实金额:"Real Amount",冻结金额:"Frozen Amount",总可用:"Total Available",暂无数据:"No Data","金额需在1到999999.99之间":"Amount must be between 1 and 999999.99","充值 / 转账":"Recharge / Transfer",在线充值:"Online Recharge",线下转账:"Offline Transfer",充值币种:"Recharge Currency",充值金额:"Recharge Amount",支付平台:"Payment Platform",请选择充值币种:"Please select recharge currency",请输入充值金额:"Please enter recharge amount",请选择支付平台:"Please select payment platform","需要收取手续费,实际支付金额约为:":"requires a handling fee, the actual payment amount is approximately: ","提交失败,请重试":"Submit failed, please try again","提交中...":"Submitting...",去支付:"Go to Pay",取消:"Cancel",关闭:"Close",第三方支付平台:"Third-party Payment Platform",交易ID:"Transaction ID",请输入转账交易ID:"Please enter transfer transaction ID",上传文件:"Upload Files",请上传转账凭证:"Please upload transfer voucher",离线充值创建成功:"Offline recharge created successfully","加载中...":"Loading...",错误:"Error",成功:"Success",必填:"Required","充值/转账":"Recharge/Transfer",切换为暗黑主题:"Switch to Dark Theme",切换为白色主题:"Switch to Light Theme",点击或拖拽文件到此处上传:"Click or drag files here to upload","支持 JPG、PNG、PDF 格式,单个文件不超过 20MB,最多上传":"Supports JPG, PNG, PDF formats, single file not exceeding 20MB, maximum",个文件:"files can be uploaded","正在上传...":"Uploading...",已上传:"Uploaded",移除:"Remove"};function xo(e){return wo[e]||e}function Eo(){return JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").locale||Ae.ZH}function E(e){return Eo()==="zh"?yo(e):xo(e)}const We=({value:e,onChange:t,options:n,placeholder:r,style:o,error:i,disabled:s,dropdownStyle:a,className:c,dropdownClassName:u,children:f})=>{const[l,g]=N(!1),_=be(null),[h,b]=N(null),y=JSON.parse(sessionStorage.getItem("fund_unit_params")||"{}").theme===H.WHITE,w=y?{trigger:{background:s?"#f5f5f5":"#fff",color:s?"#bfbfbf":e?"#222":"#bfbfbf",border:i?"1px solid #ff4d4f":s?"1px solid #f0f0f0":"1px solid #d9d9d9"},dropdown:{background:"#fff",border:"1px solid #d9d9d9",color:"#222"},option:(x,R,k)=>({color:R?"#bfbfbf":x?"#1890ff":"#222",background:x?"#e6f7ff":k&&!R||R?"#f5f5f5":"#fff"}),placeholder:{color:"#bfbfbf"}}:{trigger:{background:"#23262F",color:s?"#666":e?"#fff":"#666",border:i?"1px solid #ff4d4f":"1px solid #23262F"},dropdown:{background:"#23262F",border:"1px solid #23262F",color:"#fff"},option:(x,R,k)=>({color:R?"#666":x?"#00E8C6":"#fff",background:x?"#23262F":k&&!R?"#333843":"#23262F"}),placeholder:{color:"#666"}};Ce(()=>{if(!l)return;const x=R=>{_.current&&!_.current.contains(R.target)&&g(!1)};return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[l]);const v=n.find(x=>x.value===e);return m("div",{ref:_,className:c,style:{position:"relative",...o},children:[m("style",{children:`
46
46
  .custom-select-dropdown {
47
47
  scrollbar-width: thin;
48
48
  scrollbar-color: #bfbfbf #f5f5f5;
package/dist/best-unit.js CHANGED
@@ -2192,7 +2192,7 @@ function io(e = {}) {
2192
2192
  const s = JSON.parse(
2193
2193
  sessionStorage.getItem("fund_unit_params") || "{}"
2194
2194
  ), { token: a, locale: c } = s;
2195
- return i.headers = {
2195
+ return console.log(s, "fundUnitParams"), i.headers = {
2196
2196
  ...i.headers,
2197
2197
  Authorization: a,
2198
2198
  "x-locale": c === Ae.ZH ? "zh-CN" : "en-US"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "best-unit",
3
3
  "private": false,
4
- "version": "0.0.44",
4
+ "version": "0.0.45",
5
5
  "type": "module",
6
6
  "main": "dist/best-unit.cjs",
7
7
  "module": "dist/best-unit.js",
@@ -24,6 +24,7 @@ export function createAxiosInstance(options: CreateAxiosOptions = {}) {
24
24
  sessionStorage.getItem("fund_unit_params") || "{}"
25
25
  );
26
26
  const { token, locale } = fundUnitParams;
27
+ console.log(fundUnitParams, "fundUnitParams");
27
28
  config.headers = {
28
29
  ...config.headers,
29
30
  Authorization: token,