1 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1556a59f-b2b9-51c7-8d82-8a0f3c2a7442")}catch(e){}}(); 3import{o as e}from"./rolldown-runtime-eil0g4P7.js";import{E as t,k as n,u as r,x as i}from"./vendor-react-core-UKDSgKSw.js";import{f as a,y as o}from"./vendor-redux-react-D3MzhJcL.js";import{l as s,t as c}from"./translateString-D_TSLNE2.js";import{h as l,m as u}from"./vendor-utils-moment-CjpK9LHH.js";import{X as d,u as f}from"./vendor-lodash-BIUAlFJ1.js";import{C as p,T as m,Z as h,c as g,p as _,pt as v,r as y,w as b,yt as x}from"./formatters-CuXB3buN.js";import{n as S}from"./translation-CbfJyhfk.js";import{t as C}from"./translateParseString-HJrsWBPA.js";import{t as w}from"./isEmpty-DYGy-S8C.js";import{t as T}from"./isNil-DtKxHWq_.js";import{j as E}from"./time-DyJwPnNZ.js";import{t as D}from"./Button-Dd3dauOe.js";import{l as O}from"./vendor-utils-common-DCV1iTIK.js";import{t as k}from"./Icon-DPuU7I9f.js";import{t as A}from"./omit-DITfSbuV.js";import{C as j,D as M,x as N}from"./parsers-CRylRWYE.js";import{t as P}from"./ButtonLink--70BeT8d.js";import{r as F,t as I}from"./FormGroupGridColumn-B-JKOM4N.js";import{t as L}from"./FormGroup-DERJkrgy.js";import{t as R}from"./useAppDispatch-dwoGHCCS.js";import{t as ee}from"./usePrevious-Br4RR03g.js";import{n as te}from"./policies-m9OTgzsj.js";import{t as ne}from"./useAppSelector-C_YifiT8.js";import{t as z}from"./marketplace-CHeVWvLC.js";import{i as re}from"./redirects-BWThyviI.js";import{$ as ie,G as ae,S as oe,Y as se,_ as ce,c as le,i as ue,o as de,p as fe,w as pe,y as B}from"./constants-BbKLRTCC.js";import{o as me}from"./constants-D8JIdUpm.js";import{t as he}from"./amp-CIZmCHjd.js";import{o as ge,s as _e}from"./sort-BN10kW4V.js";import{t as ve}from"./PaginationTrigger-C9doNXOw.js";import{t as ye}from"./Clickable-BSP2b5y0.js";import{f as be}from"./campaignReport-DuMiaAj4.js";import{h as xe}from"./index-BeFD4DOo.js";import{t as Se}from"./LoadingIndicator-DjRcsQjf.js";import{n as V,t as Ce}from"./Modal-B8wTt1lM.js";import{t as H}from"./useFetch-D64sJPDy.js";import{t as U}from"./Placeholder-B-rSeScP.js";import{n as we}from"./Table-DuwHqu6m.js";import{t as Te}from"./Tooltip-CtodnPpJ.js";import{c as Ee,o as De,r as Oe}from"./vendor-ui-forms-BXu2-GHx.js";import{t as ke}from"./EditorReadOnlyMode-llN9W3Kp.js";import{t as Ae}from"./NotificationBlock-C2NsBh1d.js";import{t as je}from"./HookFormTextField-Dtxf3Fvh.js";import{t as Me}from"./useSimpleForm-C__kPPwE.js";import{t as Ne}from"./useSegment-CxgtEL50.js";import{t as Pe}from"./SearchForm-Bu8eA6DY.js";import{t as Fe}from"./CustomCheckbox-Ds8O1MK0.js";import{t as Ie}from"./StopEventPropagation-D5Q4GpKy.js";import{t as Le}from"./CreatorAvatar-XvUBe_IU.js";import{t as Re}from"./HookFormSelectField-dUWToX_w.js";import{t as ze}from"./BackgroundContainerWithPlaceholder-3ChqK9l2.js";import{t as Be}from"./renderTag-C2h5oLg3.js";import{t as Ve}from"./ConfirmationModal-D5N-dquq.js";import{n as He,r as W}from"./useCurrencySign-CHCA8f2s.js";import{n as Ue,r as We}from"./connectCurrencySign-BLXv1S41.js";import{n as Ge}from"./CreatorWithDetails-sKVHPv15.js";import{C as Ke,a as qe,c as Je,d as Ye,f as Xe,g as Ze,i as Qe,l as $e,o as G,s as et,t as K,w as tt}from"./amp-DsEVnr_Y.js";import{t as nt}from"./addTableProps-vjdrA10y.js";import{t as rt}from"./Pagination-BgXQEA_B.js";import{t as it}from"./HookFormCheckboxGroupField-yGEKHhzm.js";import{t as at}from"./Sidebar-leV08SMp.js";import{t as ot}from"./useLazyLoading-ClESk0wj.js";import{t as st}from"./TableTabs-D6w-p5D4.js";import{t as ct}from"./encodeQuerySortParams-CZht5Pgr.js";import{t as lt}from"./FormSection-X3AkAQq6.js";import{t as ut}from"./ChartsPanel-DqdshSb6.js";import{s as dt}from"./ui-utils-DuPds_ih.js";import{t as ft}from"./actions-DfwY70KH.js";/* empty css */import{t as pt}from"./FilterWithSearch-D7RNGQIH.js";import{t as mt}from"./EmptyFiltersResults-CUvVQaWN.js";import{t as q}from"./renderAmountWithTitle-C9WRzl45.js";import{a as ht,i as gt,n as _t,r as vt}from"./SidebarBody-CIre4_Hl.js";import{n as yt,t as bt}from"./getAddCreatorsTitle-CKP54WQE.js";import{t as xt}from"./HookFormQuillEditorField-DxpL70_8.js";import{t as St}from"./useNotify-B1RF0w4i.js";import{c as Ct}from"./timeline-CiHcihoV.js";import{d as wt}from"./getSplittedTimestamps-CjaFMOAD.js";import{n as Tt}from"./utils-BjvhV79m.js";import{t as J}from"./context-D2sjcoY0.js";import{t as Y}from"./Timeline-DRBetV71.js";import{a as Et,n as Dt,o as Ot,r as kt,s as At,t as jt}from"./getEvents-C2-Fb35Y.js";import{t as Mt}from"./isSameId-Bl0vuOlO.js";import{i as Nt}from"./propTypes-k-JZ0pQa.js";import{t as Pt}from"./useProgramCurrencySign-BILnaMwu.js";import{t as Ft}from"./useCreatorsQuery-CzcjXGAv.js";
3import{l as It,n as Lt,r as Rt,t as zt}from"./amp-Ca2G2G2f.js";/* empty css */import{t as Bt}from"./tinyEditorUtils-DV5vPV2Z.js";import{t as Vt}from"./BulkMessagingTemplateModal-BWNvr4tS.js";var X=t(),{ORDER_STATUS_PENDING:Ht}=et,{ORDER_NUMBER:Ut,STATUS:Wt,DATE:Gt,TOTAL:Kt,CREATOR:qt,COMMISSIONS:Jt,COUPON:Yt,LINK:Xt,ACTIONS:Zt}=qe,Qt=e=>{let t=`${Math.abs(e)}d`,n=c(e<0?`passed`:`remains`);return(0,X.jsx)(`span`,{className:`fs-medium c-subdued p-l-2`,children:S(`{{days}} {{passedOrRemains}}`,{days:t,passedOrRemains:n},`${t} ${n}`)})},$t=({status:e,remind_days:t})=>{let{className:n,title:r}=Je[e]||{};return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`label label-${n}`,children:c(r)}),!!t&&Qt(t)]})},Z=nt([{id:Ut,title:G[Ut],noWrap:!0,renderValue:(e,{order:t})=>{let{number:n}=t||{};return n||(0,X.jsx)(x,{})}},{id:Wt,title:G[Wt],noWrap:!0,sortable:!0,renderValue:(e,{order:t})=>{let{status:n,remind_days:r}=t||{};return n?Je[n]?$t({status:n,remind_days:r}):(s(`No label for status "${n}"`,{status:n},`error`),null):null}},{id:Gt,title:G[Gt],noWrap:!0,sortable:!0,renderValue:(e,{order:t})=>{let{created_at:n}=t||{};return _({unix:E(n),optional:!0})}},{id:Kt,title:G[Kt],tooltip:C(`Total sales price per order (excluding taxes and shipping)`),noWrap:!0,textRight:!0,sortable:!0,renderValue:(e,{order:t},{isUseAdjustment:n})=>{let{sub_total:r,adjustment:i=0,currency:a}=t||{};return q({value:n?r-(i<0?Math.abs(i):i):r,valueFormatter:e=>g(e,W[a])})}},{id:Jt,title:G[Jt],tooltip:C(`Creator revenue from orders. Creator commission will be 0 if order is open`),noWrap:!0,textRight:!0,sortable:!0,renderValue:(e,{order:t})=>{let{commission:n,currency:r}=t||{};return q({value:n||null,valueFormatter:e=>g(e,W[r])})}},{id:qt,title:G[qt],noWrap:!0,renderValue:(e,{creator:t},{handleOpenSidebar:n})=>{let{avatar_image:r,name:i,id:a}=t||{};return dt({name:i,avatar_image:r,renderCustomName:()=>(0,X.jsx)(D,{type:`link`,isPlain:!0,onClick:n.bind(null,a),children:i})})}},{id:Yt,title:G[Yt],noWrap:!0,textCenter:!0,renderValue:(e,{order:t})=>{let{coupon:n}=e||{},{referrer_type:r}=t||{};return r===Xt?null:n}},{id:Zt,title:G[Zt],noWrap:!0,textCenter:!0,renderValue:(e,{order:t,link:n},{externalProps:{isAdmin:r,toggleIsArchived:i}={}})=>{let{referrer_type:a,status:o,id:s,is_archived:l}=t||{},{discount_code:u,url:d,short_url:f,name:p}=n||{},m=a===Yt,h=o===Ht&&r&&!l;return(0,X.jsx)(Ie,{children:(0,X.jsxs)(F,{v2:!0,verticalSpacing:`xs`,justify:`center`,align:`center`,children:[!m&&(0,X.jsx)(I,{vc:!0,children:(0,X.jsx)(M,{href:d||f,title:p||u||c(`Link to the products`),children:(0,X.jsx)(k,{styleType:`outline`,name:`ArrowTopRightOnSquare`})})}),h&&(0,X.jsx)(I,{vc:!0,children:(0,X.jsx)(Ve,{confirmProps:{submitAction:()=>i?.({order_id:Number(s)}),submitTitle:C(`Delete`),cancelTitle:C(`Cancel`),width:660,buttonProps:{type:`danger`}},title:C(`Delete Order`),description:C(`This order and its related records will be deleted and this action cannot be undone. Are you sure you want to delete this order?`),children:(0,X.jsx)(Te,{text:c(`Delete this order`),enabled:h,isInverse:!0,children:(0,X.jsx)(D,{type:`link`,isSecondary:!0,isIcon:!0,iconStyleType:`outline`,iconSize:`sm`,iconName:`Trash`})})})})]})})}}]),{ORDER_NUMBER:en,STATUS:tn,DATE:nn,TOTAL:rn,CREATOR:an,COMMISSIONS:on,CODE_LINK:sn}=qe,cn=nt([...Z.filter(({id:e})=>[en,tn].includes(e)),{id:nn,title:G[nn],noWrap:!0,sortable:!0,renderValue:(e,{order:t})=>{let{created_at:n}=t||{};return _({unix:n,optional:!0})}},...Z.filter(({id:e})=>[rn,on].includes(e)),{id:an,title:G[an],noWrap:!0,renderValue:(e,{creator:t,affiliate:n},{handleOpenSidebar:r})=>{if(t){let{avatar_image:e,name:n,id:i}=t;return(0,X.jsx)(Ge,{name:n,avatar_image:e,renderCustomName:()=>(0,X.jsx)(D,{type:`link`,isPlain:!0,onClick:r.bind(null,i),children:n})})}let{photo:i,title:a}=n||{};return(0,X.jsx)(Ge,{name:a,avatar_image:i})}},{id:sn,title:G[sn],noWrap:!0,textCenter:!0,renderValue:(e,{product:t})=>{let{short_link:n}=t||{},{link:r}=n||{};return r?(0,X.jsx)(Ie,{children:(0,X.jsx)(M,{href:r,title:c(`Link to the product`),rel:null,children:(0,X.jsx)(k,{styleType:`outline`,name:`ArrowTopRightOnSquare`})})}):null}}]),Q=e(n()),$=e(o()),{CREATED_AT:ln,USER_NAME:un,USER_EMAIL:dn,ORDER_SUBTOTAL:fn,COMMISSION:pn,COMMISSION_RATE:mn,ORDER_ADJUSTMENT:hn,ORDER_DISCOUNT_CODE:gn,RETURNED:_n}
3=gt,{TYPE_NO_COMMISSION:vn}=fe,{ORDER_STATUS_PENDING:yn}=et,bn=({order:e,currencySign:t,currencyLabel:n,isUseAdjustment:r,coupon:i,accepted:a,returned:o})=>{let{coupon:s}=i||{},{sub_total:l,commission:u,commission_type:d,commission_value:f,adjustment:m=0,status:h}=e||{},{quantity:_}=a||{},{products:v,quantity:y,price:b}=o||{},x=m<0,E=x?Math.abs(m):m,D=r?l-E:l,O=Tt({value:f,type:d,currencySign:t});return[{id:gn,isHidden:!s,title:C(`Discount Code(s)`),renderColumnInfo:()=>(0,X.jsx)(`td`,{className:`nowrap text-right`,children:(0,X.jsx)(`span`,{className:`c-subdued`,children:s})})},{id:hn,title:C(`Discount`),isHidden:!r||!_,isEmpty:T(E),renderColumnInfo:()=>(0,X.jsxs)(`td`,{className:`nowrap text-right`,children:[x&&(0,X.jsx)(`span`,{children:`-`}),q({value:+E,valueFormatter:e=>g(e,t),tagProps:{className:`font-bold`}}),` `,(0,X.jsx)(`span`,{className:`c-subdued`,children:n})]})},{id:_n,title:C(`Returned`),isHidden:w(v)||!_,isEmpty:T(b),renderColumnInfo:()=>(0,X.jsxs)(`td`,{className:`nowrap text-right`,children:[p(y,{one:`(1 ${c(`item`)})`,other:`(${S(`{{quantity}} items`,{quantity:y},`${y} items`)})`}),` `,q({value:+b,valueFormatter:e=>g(e,t),tagProps:{className:`font-bold`}}),` `,(0,X.jsx)(`span`,{className:`c-subdued`,children:n})]})},{id:fn,title:C(`Total`),isHidden:!_,isEmpty:T(D),renderColumnInfo:()=>(0,X.jsxs)(`td`,{className:`nowrap text-right`,children:[!!_&&p(_,{one:`(1 ${c(`item`)})`,other:`(${S(`{{quantity}} items`,{quantity:_},`${_} items`)})`}),` `,q({value:D,valueFormatter:e=>g(e,t),tagProps:{className:`font-bold`}}),` `,(0,X.jsx)(`span`,{className:`c-subdued`,children:n})]})},{id:pn,title:C(`Commission`),isHidden:!_,isEmpty:T(u)&&d!==vn,renderColumnInfo:()=>(0,X.jsxs)(`td`,{className:`nowrap text-right`,children:[q({value:u||0,valueFormatter:e=>g(e,t),tagProps:{className:`font-bold`}}),` `,(0,X.jsx)(`span`,{className:`c-subdued`,children:n})]})},{id:mn,title:C(`Commission Rate`),isHidden:!_||h===yn,isEmpty:T(f)&&d!==vn,renderColumnInfo:()=>(0,X.jsx)(`td`,{className:`nowrap text-right`,children:(0,X.jsx)(`span`,{className:`font-bold`,children:O})})}].filter(Boolean)},xn=e(f()),Sn=({attribute:{title:e,values:t}})=>(0,X.jsxs)(`li`,{className:`form-group-list__list-item`,children:[c(e),` `,(0,X.jsx)(`strong`,{className:`c-gray-900`,title:e,children:t.join(`, `)})]}),Cn=({id:e,imageUrl:t,title:n,category:r,sku:i,quantity:a,renderCaption:o,product_attributes:s=[]})=>{let[l,u]=(0,Q.useState)(!1),d=s.filter(({title:e,values:t})=>e&&!w(t)),f=!w(d);return(0,Q.useEffect)(()=>{f&&u(!1)},[f]),(0,X.jsx)(`li`,{className:`order-list__list-item`,children:(0,X.jsx)(`div`,{className:`order-list__item`,children:(0,X.jsxs)(`div`,{className:`order-list-body`,children:[(0,X.jsx)(`div`,{children:(0,X.jsx)(ze,{url:t,className:`order-list-body-figure __bordered __size-48`,emptyClassName:`__empty __size-48`,useImage:!0})}),(0,X.jsxs)(`div`,{className:`order-list-details`,children:[(0,X.jsxs)(`div`,{className:`order-list-details-header`,children:[(0,X.jsx)(`div`,{className:`order-list-details-header__title`,title:n,children:n}),(0,X.jsxs)(`div`,{className:`order-list-details-header__value`,children:[c(`Qty:`),` `,a]})]}),(0,X.jsxs)(`div`,{className:`order-list-details-main`,children:[(0,X.jsx)(L,{verticalSpacing:`12`,children:(0,X.jsxs)(`ul`,{className:`form-group-list fs-base`,children:[(0,X.jsxs)(`li`,{className:`form-group-list__list-item`,children:[c(`Category`),` `,(0,X.jsx)(`strong`,{className:`c-gray-900`,title:r,children:r})]}),(0,X.jsxs)(`li`,{className:`form-group-list__list-item`,children:[c(`SKU`),` `,(0,X.jsx)(`strong`,{className:`c-gray-900`,children:i})]}),l&&d?.map(e=>(0,X.jsx)(Sn,{attribute:e},e.id)),f&&(0,X.jsx)(`li`,{className:`form-group-list__list-item`,children:(0,X.jsxs)(D,{type:`plain`,legacy:!1,isPlain:!0,onClick:()=>u(!l),className:`__type-monochrome text-underline c-gray-900-i`,children:[l&&C(`Show Less`),!l&&C(`Show More`)]})})]})}),o()]})]})]})})},e)},wn=({products:e,title:t,currencySign:n})=>!w(e)&&(0,X.jsx)(lt,{className:`__vsps-lg`,headerClassName:`m-b-4`,withBorder:!0,title:t,children:(0,X.jsx)(`ul`,{className:`order-list`,children:e.map(({id:e,image_url:t,name:r,price:i,quantity:a,currency:o,...s},c)=>(0,X.jsx)(Cn,{id:e,imageUrl:t,title:r,quantity:a,renderCaption:()=>!(0,xn.default)(i)&&(0,X.jsx)(L,{verticalSpacing:`12`,children:(0,X.jsx)(`ul`,{className:`form-group-list __vsps-2`,children:(0,X.jsx)(`li`,{className:`form-group-list__list-item`,children:(0,X.jsxs)(F,{children:[(0,X.jsx)(I,{full:!0,children:(0,X.jsx)(`span`,{className:`fs-normal c-gray-900`,children:q({value:i,valueFormatter:e=>m(e,W[o]||n)})})}),(0,X.jsx)(I,{children:(0,X.jsx)(`strong`,{className:`fs-normal c-gray-900`,children:q({value:i*a,valueFormatter:e=>m(e,W[o]||n),tagProps:{className:`font-bold`}})})})]})})})}),...s},c))})}),Tn=({order:e,coupon:t,pending:n,currencySign:r,currencyLabel:i,isUseAdjustment:a=!1})=>{let{products:o,is_forced:s}=e||{};if(n)return(0,X.jsx)(_t,{});let{returned:l,accepted:u}=o?.reduce((e,t)=>
3{let{quantity:n=0,price:r=0,returned_quantity:i=0}=t,{returned:a,accepted:o}=e;i&&(e.returned={quantity:a.quantity+i,price:a.price+r*i,products:[...a.products,{...t,quantity:i}]});let s=n-i;return s&&(e.accepted={quantity:o.quantity+s,price:o.price+r,products:[...o.products,{...t,quantity:i?s:n}]}),e},{returned:{quantity:0,price:0,products:[]},accepted:{quantity:0,price:0,products:[]}})||{},{products:d,quantity:f}=l||{},{products:p}=u||{},m=bn({order:e,coupon:t,currencySign:r,currencyLabel:i,isUseAdjustment:a,accepted:u,returned:l});return(0,X.jsxs)(X.Fragment,{children:[!!s&&(0,X.jsx)(lt,{children:(0,X.jsx)(Ae,{type:`info`,description:C(`This order was updated based on the returns data submitted through our API.`)})}),(0,X.jsx)(wn,{products:p,currencySign:r,title:f?(0,X.jsxs)(`div`,{children:[(0,X.jsx)(k,{name:`CheckCircle`,className:`c-green-500`}),` `,(0,X.jsx)(`strong`,{className:`fs-normal`,children:c(`Item Accepted`)})]}):(0,X.jsx)(`strong`,{className:`fs-normal`,children:c(`Summary`)})}),(0,X.jsx)(wn,{products:d,currencySign:r,title:(0,X.jsxs)(`div`,{children:[(0,X.jsx)(k,{name:`XCircle`,className:`c-accent-orange`}),` `,(0,X.jsx)(`strong`,{className:`fs-normal`,children:c(`Items Returned`)})]})}),vt(m)]})};Tn.propTypes={pending:$.default.bool,currencySign:We,currencyLabel:Ue,isUseAdjustment:$.default.bool};var En={fetchOrderDetails:K.fetchOrderDetails},Dn=({children:e,fetchOrderDetails:t})=>{let{program:n}=(0,Q.useContext)(J),{use_adjustment:r}=n||{},[i,a]=(0,Q.useState)({}),o=e=>t=>{a(t),e()},{orderId:s,coupon:c}=i||{},{result:l,pending:u,error:d}=H({action:()=>t(i),updateProps:s,isFetch:!!s}),{order:f}=l||{},{status:p,number:m,currency:h,created_at:g}=f||{};return(0,X.jsx)(at,{className:`__type-right __type-order`,onStartClose:()=>a({}),renderCustomHeader:({onClose:e})=>(0,X.jsx)(ht,{pending:u,onClose:e,orderNumber:m,renderHeaderStatus:()=>p&&$t({status:p}),createdAt:E(g)}),renderBody:()=>d?(0,X.jsx)(`div`,{className:`c-error text-center`,children:d}):(0,X.jsx)(Tn,{coupon:c,order:f,pending:u,currencySign:W[h],currencyLabel:He[h],isUseAdjustment:r}),children:({handleOpenSidebar:t})=>e({handleOpenSidebar:o(t)})})};Dn.propTypes={children:$.default.func.isRequired,fetchOrderDetails:$.default.func.isRequired};var On=a(null,En)(Dn),kn=e=>e.map(({creator:{id:e,avatar_image:t,name:n}})=>({id:e,avatar_image:t,name:n})),An=({handleUpdateQuery:e,programId:t,query:n,isCreatorSidebar:r,disabled:i})=>{let{trackOverviewOrdersFilter:a}=It(),[o,s]=Ft({programId:t,query:n,handleUpdateQuery:e,creatorsKey:`creator_ids`}),{q:l}=n||{};return(0,X.jsxs)(`div`,{className:`discovery-campaign-table-filters`,children:[(0,X.jsxs)(F,{verticalSpacing:`xs`,wrap:!0,children:[(0,X.jsx)(I,{full:!0,children:(0,X.jsx)(Pe,{className:`size-full`,q:l,searchProp:`orderNumber`,onSearch:({orderNumber:t})=>e({q:t}),placeholder:C(`Search order by number`),disabled:i,segmentAction:a})}),!r&&(0,X.jsx)(I,{children:(0,X.jsx)(pt,{id:`AMPOrdersCreatorFilter`,action:({q:e,...n})=>K.fetchCreators({...n,query:e,sort_by:`SORT_BY_NAME`,sort_dir:`SORT_DIR_DESC`,skip:0,affiliateId:t}),mapOptionsData:kn,selectedData:o,getSelectedData:t=>{!w(t)&&l&&e({q:void 0}),s(t)},disabled:i,shouldResetSearchOnChange:!0,children:C(`Creator`)})})]}),!w(o)&&(0,X.jsx)(`div`,{className:`discovery-campaign-table-filters__applied-filters`,children:(0,X.jsx)(`ul`,{className:`form-tags __v2`,children:Be({id:`creators`,name:`${c(`Creator`)}: ${o.map(({name:e})=>e).join(`, `)}`,onClose:()=>s(void 0),withAvatar:!1})})})]})};An.propTypes={programId:$.default.number.isRequired,handleUpdateQuery:$.default.func.isRequired,isCreatorSidebar:$.default.bool,disabled:$.default.bool,query:Nt.isRequired};var jn=(0,Q.memo)(An),{ORDER_STATUS_TOTAL:Mn}=et,{COUPON:Nn}=qe,Pn=({columns:e=Z,programId:t,query:n,onQueryPush:r,handleOpenSidebar:i=void 0,isCreatorSidebar:a=!1,creatorId:o=void 0,action:s,...l})=>{let{program:u}=(0,Q.useContext)(J),{use_adjustment:d}=u||{},{trackOverviewOrdersStatuses:f}=It(),p=ne(te.adminAccess),{program:{coupons_allowed:m}}=(0,Q.useContext)(J),[h,g]=(0,Q.useState)(Mn),_=e=>{r({...e,skip:0})},v=e=>{r({skip:0}),g(e)},{skip:y,take:b,sort_dir:S,sort_by:T,date_from:E,date_to:D,creator_ids:O,q:k,source:A}=n,j=m?e:e.filter(({id:e})=>e!==Nn),{result:M,pending:N,error:P,action:F}=H({action:()=>s(ct({affiliateId:t,skip:y,take:b,sort_dir:S,sort_by:T,from_dt:E,to_dt:D,status:h===Mn?void 0:h,creator_ids:[...O||[],o].filter(
3Boolean),q:k,source:A,...p&&{show_archived:!0}})),withDispatch:!0,updateProps:[n,h,o],isFetch:E&&D}),{action:I}=H({action:(e,n)=>K.toggleOrderIsArchive({affiliate_id:Number(t),...n}),onSuccessCallback:F,withDispatch:!0,isFetch:!1}),L=M?.orders||[],R=M?.stats||{},ee=Number(M?.total||0),z=w(L)&&(k||O);return(0,X.jsxs)(`div`,{className:`discovery-campaign-table`,children:[(0,X.jsx)(st,{options:$e.map(({id:e,tab:t,title:n,tooltip:r,segmentId:i})=>({id:e,tooltip:r,segmentId:i,renderTitle:()=>{let e=R?.[t]?.count||0;return(0,X.jsxs)(X.Fragment,{children:[c(n),` `,(0,X.jsx)(`span`,{className:`tabs-simple__item-count`,children:e})]})}})),value:h,onFilterChange:v,segmentAction:f}),(0,X.jsx)(jn,{programId:t,handleUpdateQuery:_,query:n,isCreatorSidebar:a,disabled:P||N}),N&&(0,X.jsx)(Se,{className:`__absolute __centered m-t-0 m-b-0`}),(0,X.jsx)(`div`,{className:`scrollable-table`,children:(0,X.jsx)(`div`,{className:`scrollable-table__inner`,children:(0,X.jsx)(On,{children:({handleOpenSidebar:e})=>(0,X.jsx)(we,{tableClass:`table-plain __darkened-even-lines __with-top-border`,columns:z?[]:j,rows:L,error:P,renderEmptyText:z?(0,X.jsx)(`div`,{className:`p-t-5 p-b-5 m-b-5 m-t-5`,children:(0,X.jsx)(mt,{title:C(`No Orders found`),cancelButtonText:C(`View All Orders`),clearFilters:_,clearData:Qe})}):(0,X.jsx)(x,{children:C(`You don't have any orders`)}),onRowClick:({order:{id:n},coupon:r})=>e({affiliateId:t,orderId:n,coupon:r}),handleOpenSidebar:i,isUseAdjustment:d,sortParams:{direction:ge[S],orderBy:T},onSortParamsUpdate:({orderBy:e,direction:t})=>{r({sort_by:e,sort_dir:_e[t],skip:0})},externalProps:{isAdmin:p,toggleIsArchived:I},...l})})})}),(0,X.jsx)(rt,{isAffiliateStyle:!0,total:ee,offset:+y,limit:+b,onPageChange:e=>r({skip:e}),onLimitChange:e=>r({take:e,skip:0}),alwaysShow:!0})]})};Pn.propTypes={columns:$.default.arrayOf($.default.shape({})).isRequired,handleOpenSidebar:$.default.func.isRequired,programId:$.default.string.isRequired,creatorId:$.default.string,tableClass:$.default.string,isCreatorSidebar:$.default.bool,query:Nt.isRequired,onQueryPush:$.default.func.isRequired};var{MANAGER:Fn}=Ct,In=({participants:e,creatorName:t})=>{let n=Ot({participants:e,side:Fn}),{numberOfCreatorMessages:r}=Et({participants:e});return n?null:r?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`timeline-footer-info__title`,children:S(`Reply {{creatorName}} to Start Chat`,{creatorName:t},`Reply ${t} to Start Chat`)}),(0,X.jsx)(`div`,{className:`timeline-footer-info__description`,children:c(`If you replied, they will be able to start conversation and further chat with you.`)})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`timeline-footer-info__title`,children:[c(`Start Chat with`),` `,t]}),(0,X.jsx)(`div`,{className:`timeline-footer-info__description`,children:c(`You can initiate the first message with the creator. Until you reach out, their ability to communicate with you is limited.`)})]})},Ln=({programId:e,creatorId:t,creatorName:n,brandName:r,headerWithoutAvatar:i,description:a,imageURL:o,showInterlocutorAvatar:s,headerOptions:l,viewMode:u})=>{let d=ne(te.campaignsAccess),{fetchMessagesAction:f,createMessageAction:p,updateMessageAction:m,deleteMessageAction:h,markMessageAsReadAction:g,uploadFileAction:_,fetchMessageByIdAction:v,fetchParticipantsAction:y}=Dt({programId:e,creatorId:t}),b=(0,Q.useContext)(kt),{activeChat:x,onAddChatLastEvent:S,handleViewMessage:C}=b||{},w=(0,Q.useCallback)(e=>Mt(x?.id,e)||(x?.ids||[]).some(t=>Mt(t,e)),[x]);return!e||!t?null:(0,X.jsx)(Y,{fetchAction:f,fetchActionUpdateProps:[t,e],deleteAction:h,markAsReadAction:g,fetchMessageByIdAction:v,fetchParticipantsAction:y,chatsContextValue:b,verifyMessageByChatId:w,children:(0,X.jsxs)(Y.Main,{children:[(0,X.jsx)(Y.Header,{title:n,description:a,imageURL:o,headerOptions:l,withoutAvatar:i,renderHeaderInfo:()=>d?(0,X.jsxs)(N,{children:[`This chat is currently only for Affiliate programs. Campaign-related chats remain under the`,` `,(0,X.jsx)(P,{to:`${z.prefix}${z.campaigns.prefix}`,className:`underline-text-link __type-gray`,children:`Campaigns tab.`})]}):c(`This communication pertains only to the affiliate programs.`)}),(0,X.jsx)(Y.Body,{eventsMap:jt({creatorName:n,creatorId:t,brandName:r,programId:e}),showOwnerName:!0,showInterlocutorAvatar:s,onViewMessageCallback:C}),(0,X.jsx)(Y.Footer,{sendAction:p,updateAction:m,uploadAction:_,renderInfo:({participants:e})=>In({participants:e,creatorName:n}),onCreateMessageCallback:S,viewMode:u})]})})},{OVERVIEW:Rn,MESSAGES:zn}=se,{OVERVIEW:Bn,MESSAGES:Vn}=me,{AFFILIATE_TYPE_STOREFRONT:Hn}=ue,Un=({creatorStatus:e,programType:t,pinChatOption:n,programId:r,creatorId:i})=>[n,At({creatorStatus:e,affiliateId:r})&&{type:`link`,id:`back-to-creator`,title:C(`Back to Creator`),link:t===Hn?`${re.prefix}${re.creatorDetailsTab(r,i,Bn)}`:`${he.prefix}${he.creatorDetailsTab(r,i,Rn)}`,linkProps:{target:void 0},icon:{name:`Logout`}}
3].filter(Boolean),Wn=({programType:e,programId:t,params:n})=>{let r=e===Hn?`${re.prefix}${re.programTab(t,Vn)}`:`${he.prefix}${he.programTab(t,zn)}`;return[{type:`link`,id:`go-to-chat-detail`,title:C(`Go to Chat Detail`),link:r,linkProps:{target:void 0,state:n},icon:{name:`Login`}}]},{TYPE_NO_COMMISSION:Gn}=fe,Kn=({onOpenChange:e,selectedCreators:t,selected:n,successCallback:r})=>{let{program:i}=(0,Q.useContext)(J),{currencySign:a}=Pt(),{id:o,commission_tiers:s,commission_additional_enabled:l}=i||{},u=n===1,{commission_tier_id:d}=Object.values(t)[0]||{},f=u?{id:d,is_default:+d==0}:s[0],[p,m]=(0,Q.useState)(f),{id:h,is_default:g}=p||{},{id:_,is_default:v}=f||{},y=u?C(`Move to Commission Group`):S(`Move to Commission Group ({{selected}} creators)`,{selected:n},`Move to Commission Group (${n} creators)`),b=u&&(+h==+_||g&&v);return(0,X.jsx)(V,{onOpenChange:e,title:y,submitTitle:C(`Save`),submitAction:()=>K.addCreatorsCommission({affiliate_id:o,creator_ids:Object.keys(t),commission_tier_id:h}),onSubmitCallback:r,withDispatchSubmitAction:!0,closeAfterSubmit:!0,width:580,disabled:b,body:(0,X.jsx)(`ul`,{className:`forms-checkbox-list`,children:s.map(e=>{let{id:t,commission_type:n,commission_title:r,commission_value:i,commission_additional_value:o,is_default:s}=e,u=Tt({value:i||0,type:n,currencySign:a}),d=Tt({value:o||0,type:n,currencySign:a}),f=`${c(l?`Returning Customers`:`Commission Rate`)}: ${u}`,p=` · ${c(`New customers`)}: ${d}`;return(0,X.jsx)(`li`,{className:`forms-checkbox-list__list-item`,children:(0,X.jsxs)(Fe,{type:`radio`,onChange:()=>m(e),checked:+h==+t||g&&s,className:`__vt __flex`,selectorId:r,children:[r,(0,X.jsxs)(`div`,{className:`fs-small c-subdued`,children:[n===Gn&&u,n!==Gn&&(0,X.jsxs)(X.Fragment,{children:[f,l&&p]})]})]})},t)})})})},qn=({onOpenChange:e,count:t,successCallback:n,callableAction:r,callableSegmentAction:i,status:a})=>{let{trackEvent:o}=Ne();return(0,X.jsx)(V,{onOpenChange:e,title:p(t,{one:C(`Remove Creator`),other:C(`Remove Creators`)}),submitTitle:C(`Remove`),submitAction:()=>r(a),withDispatchSubmitAction:!0,closeAfterSubmit:!0,onSubmitCallback:()=>{o(i?.()),n?.()},width:580,body:()=>p(t,{one:C(`By removing the creator, the creator will no longer be visible in the Affiliate Program. Are you sure you want to remove the creator?`),other:C(`By removing the creators, the creators will no longer be visible in the Affiliate Program. Are you sure you want to remove the creators?`)}),buttonProps:{type:`danger`}})},{CREATOR_AFFILIATE_STATUS_INVITED_TO_JOIN:Jn}=B,Yn=({applicableCreatorsIds:e,successCallback:t,onOpenChange:n})=>{let r=R(),{formProps:i,formProps:{watch:a,formState:{isSubmitting:o}},handleSubmit:s}=Me({defaultValues:{affiliate:null,status:Jn},onSubmit:({affiliate:{id:t,title:n},status:i})=>{let a=K.updateCreators({ids:e,affiliateId:t,status:i,is_import:!0});return a.meta={...a.meta,apiResolvedMeta:yt({addingCreators:e,targetTitle:n})},r(a)},onSuccessCallback:()=>{n(!1),t?.()}}),c=a(`affiliate`),l=e.length,u=c?bt(l):C(`Add`);return(0,X.jsx)(V,{title:C(`Add Creators to Affiliate`),width:660,submitAction:s,submitTitle:u,pending:o,disabled:!c,onOpenChange:n,body:(0,X.jsxs)(Oe,{...i,children:[(0,X.jsx)(L,{verticalSpacing:`24`,children:(0,X.jsx)(it,{name:`status`,group:tt,type:`radio`,className:`__flex`,fieldProps:{required:!0,parseErrorMessage:!0}})}),(0,X.jsx)(L,{withoutSpace:!0,children:(0,X.jsx)(Re,{name:`affiliate`,popoverProps:{...be,autoSize:`width`},onFetchSuggestions:e=>r(ft.searchAffiliates({query:e})),clearable:!0,valueWholeObject:!0,placeholder:C(`Select Affiliate Program`),...Xe,fieldProps:{required:!0,parseErrorMessage:!0}})})]})})},{CREATOR_AFFILIATE_STATUS_INVITED_TO_JOIN:Xn}=B,{TO_REINVITE:Zn}=Ye,Qn=({programId:e,applicableCreatorsIds:t,isBulkSelectCreators:n,bulkCreatorsInfo:r,callableAction:i,successCallback:a,onOpenChange:o})=>{let s=R(),l=t.length,{result:u,pending:d}=H({action:()=>K.fetchCreatorsListInfo({affiliateId:e,creatorIds:t}),withDispatch:!0,isFetch:!!l}),{has_no_contacts:f=0}=u||{},{[Zn]:p=0,has_no_email_to_reinvite:m=0}=r||{},{formProps:h,formProps:{formState:{isSubmitting:g}},handleSubmit:_}=Me({defaultValues:{status:Xn},onSubmit:({status:e})=>s(i(e)),onSuccessCallback:()=>{o(!1),a?.()}}),v=n?+p-l:l,y=n?m-+f:+f,b=v-y;return(0,X.jsx)(V,{title:C(`Re-invite Creators`),width:660,submitAction:_,submitTitle:C(`Send`),pending:g,disabled:d,onOpenChange:o,body:(0,X.jsxs)(Oe,{...h,children:[y>0&&(0,X.jsx)(Ae,{description:S(`{{numberOfCreatorsWithoutEmail}} of {{numberOfCreators}} creator(s) have no contact information.`,{numberOfCreatorsWithoutEmail:y,numberOfCreators:v},`${y} of ${v} creator(s) have no contact information.`)}),(0,X.jsx)(L,{label:(0,X.jsx)(`strong`,{children:c(`Send Creator invitations to:`)}),labelVerticalSpacing:`8`,children:(0,X.jsx)(it,{name:`status`,group:tt,type:`radio`,className:`__flex`,fieldProps:{required:!0,parseErrorMessage:!0}})}),d?(0,X.jsx)(Se,{withoutMessages:!0,spinnerProps:{size:`nm`}}
3):(0,X.jsx)(L,{withoutSpace:!0,children:y>0?S(`Only {{numberOfCreatorsToInvite}} of {{numberOfCreators}} creator(s) will be added to the program. Are you sure you want to send the invitations?`,{numberOfCreatorsToInvite:b,numberOfCreators:v},`Only ${b} of ${v} creator(s) will be added to the program. Are you sure you want to send the invitations?`):S(`{{numberOfCreators}} creator(s) will be added to the program. Are you sure you want to send the invitations?`,{numberOfCreators:v},`${v} creator(s) will be added to the program. Are you sure you want to send the invitations?`)})]})})},$n=()=>(0,X.jsx)(`ul`,{className:`recipients-list`,children:Array.from({length:6}).map((e,t)=>(0,X.jsx)(`li`,{className:`recipients-list__list-item`,children:(0,X.jsx)(`div`,{className:`recipients-list__item`,children:(0,X.jsxs)(`div`,{className:`table-card-user m-l-0 __type-new`,children:[(0,X.jsx)(`div`,{className:`table-card-user__ava __vsps-8`,children:(0,X.jsx)(U,{type:`round`,width:32,height:32})}),(0,X.jsxs)(`div`,{className:`table-card-user-details`,children:[(0,X.jsx)(`div`,{className:`table-card-user-details__name`,children:(0,X.jsx)(U,{width:100,height:16})}),(0,X.jsx)(`div`,{className:`table-card-user-details__info`,children:(0,X.jsx)(`span`,{className:`fs-small`,children:(0,X.jsx)(U,{width:100,height:16})})})]})]})})},t))}),er=({applicableCreators:e=[],isBulkSelectCreators:t,creatorStatuses:n=void 0})=>{let[r,a]=(0,Q.useState)(Ze),[o,s]=(0,Q.useState)(e),{programId:c}=i(),l=(0,Q.useCallback)(e=>{a(t=>({...t,...e}))},[a]),{query:u,skip:d}=r,f=R(),{control:p}=Ee(),m=ct({...r,affiliateId:c,statuses:n}),{fields:g,append:_,remove:v}=De({control:p,name:`creator_ids`,keyName:`field_id`}),{fields:x,append:S,remove:T}=De({control:p,name:`excluded_ids`,keyName:`field_id`}),E=(0,Q.useMemo)(()=>g.map(({id:e})=>e),[g]),O=(0,Q.useMemo)(()=>x.map(({id:e})=>e),[x]),k=e=>{let t=e.filter(e=>E.includes(e.id)),n=e.filter(e=>!E.includes(e.id));return[...t,...n]},{pending:A,meta:j}=H({action:()=>f(K.fetchCreators(m)),onSuccessCallback:e=>{let t=e.map(({creator:e})=>e);if(u){s(k(t));return}let n=new Set(o.map(e=>e.id)),r=t.filter(e=>!n.has(e.id));s(e=>k([...e,...r]))},updateProps:r}),{total:M}=j||{},N=(0,Q.useCallback)((e,n)=>{let r=()=>{s(e=>{let t=e.splice(n,1)[0];return e.splice(E.length,0,t),e})},i=t?O.indexOf(e):E.indexOf(e);return E.includes(e)||t&&!O.includes(e)?{iconName:`X`,onClick:()=>{if(t){S({id:e,prevPosition:n});return}v(i),r()},title:``}:{iconName:`Plus`,onClick:()=>{if(t){T(i);return}_({id:e,prevPosition:n}),r()},title:C(`Add`)}},[E,_,S,O,t,v,T]),{onTrigger:P}=ot({pending:A}),F=(0,Q.useCallback)(()=>(0,X.jsxs)(`ul`,{className:`recipients-list`,children:[o?.map(({id:e,name:t,avatar_image:n,followers:r},i)=>{let{title:a,...o}=N(e,i);return(0,X.jsx)(`li`,{className:`recipients-list__list-item`,children:(0,X.jsx)(`div`,{className:`recipients-list__item`,children:(0,X.jsxs)(`div`,{className:`table-card-user m-l-0 __type-new`,children:[(0,X.jsx)(Le,{className:`table-card-user__ava __vsps-8`,image:n,placeholder:h(`name`)}),(0,X.jsxs)(`div`,{className:`table-card-user-details`,children:[(0,X.jsx)(`div`,{className:`table-card-user-details__name`,children:(0,X.jsx)(`strong`,{className:`fs-small`,children:t})}),(0,X.jsx)(`div`,{className:`table-card-user-details__info`,children:(0,X.jsx)(`span`,{className:`fs-small`,children:b(y(r)||0,{one:C(`Follower`),other:C(`Followers`)})})})]}),(0,X.jsx)(`div`,{className:`table-card-user-icon`,children:(0,X.jsx)(D,{type:`plain`,isMonochrome:!0,isIcon:!0,className:`__negative-sps`,...o,children:a})})]})})},e)}),!w(o)&&(0,X.jsx)(ve,{onQueryPush:l,skip:d,total:M,pending:A,placeholder:$n,onTrigger:P,customSkipCount:10})]}),[N,o,l,A,d,M]);return(0,X.jsx)(`div`,{className:`modal-grid__aside h-w-224`,children:(0,X.jsxs)(`div`,{className:`recipients-panel`,children:[(0,X.jsx)(`div`,{className:`recipients-panel__search`,children:(0,X.jsx)(Pe,{className:`size-full`,q:u,onSearch:({q:e})=>l({query:e,skip:0}),placeholder:C(`Add recipients`)})}),(0,X.jsx)(`div`,{className:`recipients-panel__list`,children:(0,X.jsx)(`ul`,{className:`recipients-list`,children:A?(0,X.jsx)($n,{}):(0,X.jsx)(F,{})})})]})})},tr=e(O()),nr={query:``,skip:0,take:10},rr=()=>(0,X.jsx)(X.Fragment,{children:Array.from({length:10}).map((e,t)=>(0,X.jsx)(`div`,{className:`templates-list__item`,children:(0,X.jsx)(U,{height:83})},t))}),ir=()=>(0,X.jsxs)(`div`,{className:`templates-panel`,children:[(0,X.jsx)(`div`,{className:`templates-panel__search`,children:(0,X.jsx)(U,{height:36})}),(0,X.jsx)(`div`,{className:`templates-panel__main`,children:(0,X.jsx)(`ul`,{className:`templates-list`,children:(0,X.jsx)(rr,{})})})]}),ar=({onOpenChange:e,onApplyTemplate:t})=>{let{programId:n}=i(),[r,a]=(0,Q.useState)(null),[o,s]=(0,Q.useState)(nr),[c,l]=(0,Q.useState)([]),u=(0,Q.useRef)({}),d=(0,Q.useCallback)(e=>{s(t=>({...t,...e}))},[s]),{skip:f,query:p}=o,m=ee(p),{pending:h,result:g}=H({action:()=>K.getBulkMessageTemplates({affiliate_id:n,query:p,...o}),onSuccessCallback:({templates:e})=>
3{if(p!==m){l(e);return}l(t=>[...t,...e])},withDispatch:!0,updateProps:o}),{templates:_,total:v=0}=g||{},{onTrigger:y}=ot({pending:h}),b=(0,Q.useCallback)(e=>{a(t=>t===e?null:e)},[a]);(0,Q.useEffect)(()=>{r&&u.current[r]&&u.current[r]?.focus()},[r]);let x=(0,Q.useCallback)(n=>{t(n),e(!1)},[t,e]),S=(0,Q.useCallback)(()=>(0,X.jsxs)(`div`,{className:`templates-panel`,children:[(0,X.jsx)(`div`,{className:`templates-panel__search`,children:(0,X.jsx)(Pe,{className:`size-full`,q:p,onSearch:({q:e})=>d({query:e,skip:0}),placeholder:C(`Search Template`)})}),(0,X.jsx)(`div`,{className:`templates-panel__main`,children:(0,X.jsxs)(`ul`,{className:`templates-list`,children:[!h&&c.map(e=>{let{name:t,text:n,id:i}=e;return(0,X.jsx)(`li`,{className:(0,tr.default)(`templates-list__item`,r===i&&`__is-expanded`),ref:e=>{u.current[i]=e},tabIndex:-1,children:(0,X.jsxs)(ye,{onClick:()=>b(i),children:[(0,X.jsx)(`div`,{className:`templates-list__item-title`,children:(0,X.jsxs)(F,{children:[(0,X.jsx)(I,{full:!0,children:t}),(0,X.jsx)(I,{fixed:!0,children:(0,X.jsx)(D,{type:`secondary`,legacy:!1,className:`__size-28 templates-list__item-action`,onClick:()=>x(e),children:C(`Apply Template`)})})]})}),(0,X.jsx)(`div`,{className:`templates-list__item-description`,children:(0,X.jsx)(ke,{value:n,sanitizedOptions:{FORBID_TAGS:[`img`]}})})]})},i)}),!w(_)&&(0,X.jsx)(ve,{onQueryPush:d,skip:f,total:+v,pending:h,placeholder:rr,onTrigger:y,customSkipCount:10})]})})]}),[r,x,b,d,y,h,p,f,_,c,v]),T=h&&w(c);return(0,X.jsx)(V,{onOpenChange:e,title:C(`Apply Template`),pending:h,headerClassName:`__size-md`,bodyInnerClassName:`p-0`,body:T?(0,X.jsx)(ir,{}):(0,X.jsx)(S,{}),width:660,hideFooter:!0})},or=({modalProps:e,children:t,...n})=>{let{ModalComponent:r,modalProps:i}=e||{},a=(0,Q.useMemo)(()=>({renderContent:e=>(0,X.jsx)(ar,{...e,...n})}),[n]);return e?(0,X.jsx)(r,{...i,...a,children:t}):(0,X.jsx)(Ce,{...a,selectorId:`apply-timeline-bulk-messaging-template`,children:t})},sr=()=>{let{program:e}=(0,Q.useContext)(J),{setValue:t,watch:n,control:r}=Ee(),i=({text:e,subject:n})=>{t(`subject`,n),t(`text`,e)},a=n(),{fields:o,remove:s,append:c}=De({control:r,name:`attachments`}),l=(e,t)=>{let n=o.findIndex(({title:e})=>e===t);n>=0&&s(n)},{action:u}=H({action:(e,t)=>K.uploadTimelineMessageFile(t),withDispatch:!0,isFetch:!1,useMultiple:!0});return(0,X.jsxs)(`div`,{className:`modal-grid__main`,children:[(0,X.jsx)(je,{name:`subject`,fieldProps:{label:C(`Subject (Optional)`),wrapperClassName:`m-b-4`},placeholder:C(`Add Subject`)}),(0,X.jsx)(xt,{name:`text`,fieldProps:{labelNote:(0,X.jsxs)(F,{children:[(0,X.jsx)(I,{children:(0,X.jsx)(or,{onApplyTemplate:i,children:(0,X.jsx)(j,{withoutPreventDefault:!0,children:C(`Apply Template`)})})}),(0,X.jsx)(I,{children:(0,X.jsx)(Vt,{template:a,mode:`save`,successCallback:i,children:(0,X.jsx)(j,{withoutPreventDefault:!0,children:C(`Save Template`)})})})]}),label:C(`Message`),wrapperClassName:w(o)&&C(`__no-space`)},customEditorProps:{upload:{onUpload:e=>{let{title:t,size:n,type:r,file:i}=e,a=new FormData;return a.append(`file`,i,t),a.append(`title`,t),a.append(`size`,String(n)),a.append(`type`,r),u(a)},onSuccessCallback:({data:e},t,n)=>{let{title:r,size:i,type:a}=n;return c({...e,title:r,size:i,type:a,original_filename:r,temporary_filename:r})},hasCustomFileUpload:!0},variables:{useAllVariables:!1,options:[`[affiliate_name]`,`[creator_first_name]`,`[creator_last_name]`,`[creator_full_name]`],variablesData:{affiliate:e}},variablesEmptyText:C(`will be inserted`)},hasPreview:!0,hasVariables:!0,hasFileUpload:!0,hasImageUpload:!1,textAreaClassName:`h-200`}),!w(o)&&(0,X.jsx)(`div`,{className:`timeline-form-comment-attachments`,children:(0,X.jsx)(wt,{attachments:o.map(({title:e,size:t,url:n})=>({filename:e,size:t,url:n})),onDelete:l})})]})}
3,cr={creator_ids:[],excluded_ids:[],subject:``,text:``,attachments:[]},{CREATOR_AFFILIATE_STATUS_ACTIVE:lr,CREATOR_AFFILIATE_STATUS_JOINED:ur}=B,dr=({onOpenChange:e,selectedCreators:t,applicableCreatorsIds:n,isBulkSelectCreators:a,count:o,successCallback:s})=>{let[c]=r(),{notify:l}=St(),u=R(),{programId:d}=i(),f=c.get(`statuses[0]`)?[c.get(`statuses[0]`)]:[ur,lr],p=(0,Q.useMemo)(()=>Object.entries(t).map(([e])=>{if(n.includes(String(e))){let{...n}=t[e].details;return n.id=Number(e),n}return null}).filter(Boolean),[n,t]),{formProps:m,handleSubmit:h}=Me({defaultValues:{...cr,creator_ids:n.map(e=>({id:Number(e)}))},onSubmit:({text:e,subject:t,creator_ids:n,excluded_ids:r,attachments:i})=>u(K.sendBulkMessage({affiliate_id:d,subject:t,text:e,attachments:i,...a?{excluded_ids:r.map(({id:e})=>e)}:{creator_ids:n.map(({id:e})=>e)},statuses:f})),onSuccessCallback:(e,t,{excluded_ids:n,creator_ids:r})=>{let i=p.length>r.length?p.length:r.length,c=a?o-n.length:`${i}/${r.length}`;s?.(),l({message:S(`Sending messages and emails to {{count}} creators`,{count:c},`Sending messages and emails to ${c} creators`)})}}),{watch:g}=m,_=g(`text`);return(0,X.jsx)(V,{onOpenChange:e,className:`__type-bulk-messaging`,body:(0,X.jsx)(Oe,{...m,children:(0,X.jsxs)(`div`,{className:`modal-grid h-430`,children:[(0,X.jsx)(er,{applicableCreators:p,isBulkSelectCreators:a,creatorStatuses:f}),(0,X.jsx)(sr,{})]})}),width:671,title:C(`Send Message`),bodyInnerClassName:`p-0`,submitAction:h,submitTitle:C(`Send`),disabled:Bt(_)})},{CREATOR_AFFILIATE_STATUS_INVITED_TO_JOIN:fr,CREATOR_AFFILIATE_STATUS_INVITED_TO_APPLY:pr,CREATOR_AFFILIATE_STATUS_APPLIED:mr,CREATOR_AFFILIATE_STATUS_ACTIVE:hr,CREATOR_AFFILIATE_STATUS_JOINED:gr,CREATOR_AFFILIATE_STATUS_DECLINED:_r,CREATOR_AFFILIATE_STATUS_ARCHIVED:vr,CREATOR_AFFILIATE_STATUS_REJOINED:yr,CREATOR_AFFILIATE_STATUS_DELETED:br}=B,{TO_APPROVE:xr,TO_DECLINE:Sr,TO_ARCHIVE:Cr,TO_UNARCHIVE:wr,TO_DELETE:Tr,TO_REINVITE:Er,TO_BULK_MESSAGING:Dr}=Ye,{TOTAL:Or}=Ke,{ARCHIVE:kr,APPROVE:Ar,UNARCHIVE:jr,DECLINE:Mr,DELETE:Nr,REINVITE:Pr,ADD_COMMISSION_TIER:Fr,SURVEY_RESULTS:Ir,ADD_TO_ANOTHER_AFFILIATE:Lr,TIMELINE_BULK_MESSAGING:Rr}=ce,zr=()=>({[Fr]:{type:`modal`,title:C(`Move to Commission Group`),getModalProps:e=>({selectorId:`add-commission-modal`,renderContent:({onOpenChange:t})=>(0,X.jsx)(Kn,{onOpenChange:t,...e})}),withoutCount:!0,show:({isAliExpressDataProgram:e,isSovrnDataProgram:t,isButtonDataProgram:n,isBulkSelectCreators:r,viewMode:i})=>!e&&!t&&!n&&!r&&!i},[Ir]:{type:`external-link`,title:C(`See Survey Results`),getExternalLink:({answerId:e,creatorSlug:t})=>`${window.location.origin}${z.prefix}${e?z.creatorWithSurveyAnswer(t,e):z.creatorSurveys(t)}`,show:({showSurvey:e,viewMode:t})=>e&&!t},[Lr]:{type:`modal`,title:C(`Add to Another Affiliate`),actionStatuses:Object.values(B),getModalProps:e=>({selectorId:`add-to-affiliate-modal`,renderContent:({onOpenChange:t})=>(0,X.jsx)(Yn,{onOpenChange:t,...e})}),show:({adminAccess:e,isBulkSelectCreators:t})=>e&&!t},[Ar]:{type:`action`,title:C(`Approve`),actionStatuses:de,tabsToAction:[Or,mr],status:gr,action:K.updateCreators,bulkAction:K.updateBulkCreators,field:xr,segmentAction:zt,show:({viewMode:e})=>!e},[Mr]:{type:`action`,title:C(`Decline`),actionStatuses:oe,tabsToAction:[Or,mr],status:_r,action:K.updateCreators,bulkAction:K.updateBulkCreators,field:Sr,segmentAction:Rt,show:({viewMode:e})=>!e},[kr]:{type:`action`,title:C(`Archive`),actionStatuses:le,tabsToAction:[pr,fr,gr,hr],status:vr,action:K.updateCreators,bulkAction:K.updateBulkCreators,field:Cr,segmentAction:Lt,show:({viewMode:e})=>!e},[jr]:{type:`action`,title:C(`Un-archive`),actionStatuses:ie,tabsToAction:[vr],status:yr,action:K.updateCreators,bulkAction:K.updateBulkCreators,field:wr,show:({viewMode:e})=>!e},[Pr]:{type:`modal`,title:C(`Re-invite`),actionStatuses:ae,tabsToAction:[Or,_r],field:Er,action:e=>K.updateCreators({...e,is_reinvite:!0}),bulkAction:e=>K.updateBulkCreators({...e,with_email:!0}),getModalProps:e=>({selectorId:`reinvite-creators-modal`,renderContent:({onOpenChange:t})=>(0,X.jsx)(Qn,{onOpenChange:t,...e})}),show:({viewMode:e})=>!e},[Nr]:{type:`modal`,title:C(`Remove`),warningTitle:!0,actionStatuses:pe,status:br,action:K.updateCreators,bulkAction:K.updateBulkCreators,field:Tr,getModalProps:e=>({selectorId:`delete-creators-modal`,renderContent:({onOpenChange:t})=>(0,X.jsx)(qn,{onOpenChange:t,...e})}),show:({viewMode:e})=>!e},[Rr]:{type:`modal`,title:C(`Send Message`),getModalProps:e=>({selectorId:`timeline-bulk-messaging-modal`,renderContent:({onOpenChange:t})=>(0,X.jsx)(dr,{onOpenChange:t,...e})}),field:Dr,actionStatuses:[gr,hr],show:({viewMode:e})=>!e}}),Br=({type:e,callableAction:t,callableSegmentAction:n,successCallback:r,pending:i,count:a,setHoverOptions:o,field:s,currentTitle:c,modalProps:l,status:u})=>{let{trackEvent:d}
3=Ne(),{action:f,pending:p}=H({action:()=>t(u),isFetch:!1,withDispatch:!0,onSuccessCallback:()=>{d(n?.()),r?.()}});return e===`modal`?(0,X.jsx)(Ce,{...l,children:(0,X.jsx)(D,{type:`secondary`,pending:p||i,onMouseEnter:()=>o?.({[s]:!0}),onMouseLeave:()=>o?.({[s]:!1}),disabled:!a,children:c})}):(0,X.jsx)(D,{type:`secondary`,pending:p||i,onMouseEnter:()=>o?.({[s]:!0}),onMouseLeave:()=>o?.({[s]:!1}),onClick:f,disabled:!a,children:c})},Vr=({actionName:e,setHoverOptions:t,programId:n,programTitle:r,programType:i,answerId:a,creatorSlug:o,selectedCreators:s,isBulkSelectCreators:l,bulkCreatorsInfo:u,bulkCreatorsInfoPending:d,creatorsFetchQuery:f,successCallback:p,isSingleAction:m=!1,type:h,title:g,warningTitle:_,actionStatuses:v,action:y,bulkAction:b,status:x,field:S,getExternalLink:C,getModalProps:T,segmentAction:E,withoutCount:D=!1})=>{let O=Object.keys(s),k=Object.entries(s).filter(([e,{status:t}])=>(v||[]).includes(t)).map(([e])=>e),j=O.length,M=k.length,N=+(l?(u?.[S]||0)-M:M),P=e=>l?b?.({...A(f,[`skip`,`take`,`performance_from_dt`,`performance_to_dt`,`sort_dir`,`sort_by`]),status:e,excluded_ids:k}):y?.({affiliateId:n,ids:k,status:e}),F=()=>E?.({selected:j,count:N,affiliate_id:n,affiliate_name:r,affiliate_type:i}),I=`${c(g)}${D?``:` (${N})`}`,L=T?.({programId:n,count:N,selected:j,selectedCreators:s,applicableCreatorsIds:k,isBulkSelectCreators:l,bulkCreatorsInfo:u,successCallback:p,callableAction:P,callableSegmentAction:F,status:x});return m?(0,X.jsx)(Br,{type:h,callableAction:P,callableSegmentAction:F,successCallback:p,pending:d,count:N,setHoverOptions:t,field:S,currentTitle:I,modalProps:L,status:x}):!w(v)&&!N?null:{type:h,id:e,renderTitle:()=>(0,X.jsx)(`span`,{className:(0,tr.default)(_&&`c-accent-red`),children:I}),action:P(x),externalLink:C?.({answerId:a,creatorSlug:o}),successCallback:p,getIsOptionHover:e=>t?.({[S]:e}),segmentAction:F,modalProps:L}},{COUPON:Hr}=qe,Ur=({action:e,programId:t,handleOpenSidebar:n=void 0,handleOpenOrders:r=void 0,columns:i=Z,query:a,onQueryPush:o,creatorId:s=void 0,...c})=>{let{program:l}=(0,Q.useContext)(J),{coupons_allowed:u,use_adjustment:d}=l||{},f=u?i:i.filter(({id:e})=>e!==Hr),p=ne(te.adminAccess),{skip:m,take:h,sort_dir:g,sort_by:_,date_from:v,date_to:y,creator_ids:b,q:S,source:T}=a,{result:E,pending:O,error:k,action:A}=H({action:()=>e(ct({affiliateId:t,skip:m,take:h,sort_dir:g,sort_by:_,from_dt:v,to_dt:y,creator_ids:[...b||[],s].filter(Boolean),q:S,source:T,...p&&{show_archived:!0}})),withDispatch:!0,updateProps:[a,s],isFetch:!!v&&!!y}),{action:j}=H({action:(e,{order_id:n})=>K.toggleOrderIsArchive({affiliate_id:Number(t),order_id:n}),onSuccessCallback:A,withDispatch:!0,isFetch:!1}),M=E?.orders||[],N=w(M)&&(S||b),P=e=>{o({...e,skip:0})};return(0,X.jsx)(`div`,{className:`charts-panels-list__list-item`,children:(0,X.jsx)(`div`,{className:`charts-panels-list__item`,children:(0,X.jsx)(ut,{title:C(`Recent Orders`),pending:O,error:k,footer:!w(M)&&(0,X.jsx)(`div`,{className:`campaign-overview-panel-footer__show-more`,children:(0,X.jsx)(D,{type:`link`,onClick:r,children:C(`View All`)})}),bodyClassName:!k&&`p-b-0`,children:(0,X.jsx)(`div`,{className:`scrollable-table scrollable-table--msps`,children:(0,X.jsx)(`div`,{className:`scrollable-table__inner`,children:(0,X.jsx)(On,{children:({handleOpenSidebar:e})=>(0,X.jsx)(we,{tableClass:`table-plain __darkened-even-lines __with-top-border __with-bottom-border table-plain--msps`,columns:N?[]:f,rows:M,error:k,renderEmptyText:N?(0,X.jsx)(`div`,{className:`p-t-5 p-b-5 m-b-5 m-t-5`,children:(0,X.jsx)(mt,{title:C(`No Orders found`),cancelButtonText:C(`View All Orders`),clearFilters:P,clearData:Qe})}):(0,X.jsx)(x,{children:C(`You don't have any orders`)}),onRowClick:({order:{id:n},coupon:r})=>e({affiliateId:t,orderId:n,coupon:r}),handleOpenSidebar:n,isUseAdjustment:d,sortParams:{direction:ge[g],orderBy:_},onSortParamsUpdate:({orderBy:e,direction:t})=>{o({sort_by:e,sort_dir:_e[t],skip:0})},externalProps:{isAdmin:p,toggleIsArchived:j},...c})})})})})})})};l();var Wr=e(d()),Gr=({programId:e,query:t,disabled:n,creatorId:r})=>{let i=R(),{pending:a,action:o}=H({action:()=>i(K.exportPayments({affiliateId:e,creatorId:r,query:t,filename:(0,Wr.default)(u().format(v))})),onSuccessCallback:xe,isFetch:!1});return(0,X.jsx)(`div`,{className:`btn-v2-group__item`,children:(0,X.jsx)(D,{type:`secondary`,isIconRight:!0,iconName:`Download`,disabled:n,pending:a,onClick:o,children:C(`Export CSV`)})})};export{Un as a,Pn as c,zr as i,cn as l,Ur as n,Wn as o,Vr as r,Ln as s,Gr as t,Z as u}; 4//# debugId=1556a59f-b2b9-51c7-8d82-8a0f3c2a7442
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.