6 lines
83 KiB
Plaintext
6 lines
83 KiB
Plaintext
"use strict";
|
|
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=(new Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="1650c8f0-b3c5-558e-aaef-bb36a6088d13")}catch(e){}}();
|
|
(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[56],{876:(e,t,s)=>{s.d(t,{$F:()=>f,J9:()=>l,R7:()=>c,SA:()=>d,TK:()=>i,vI:()=>a,wV:()=>o,xS:()=>n});var r=s(18);const n=(0,r.ZP)("message deleted"),a=(0,r.ZP)("photo attached"),i={made:"as_buyer",received:"as_seller"},o=20,d={ACCEPT_OFFER:"A",CANCEL_OFFER:"C",DECLINE_OFFER:"D",MAKE_OFFER:"O",ACCEPT_QUOTE:"A",CANCEL_QUOTE:"C",DECLINE_QUOTE:"D",SEND_QUOTE:"OS"},c=["PROPOSE_REFUND_RESOLUTION","PROPOSE_EXCHANGE_RESOLUTION"],l=-1,f={CART_CTA_ADD_TO_CART:r.ZP`Add to cart`,CART_CTA_ADDED_TO_CART:r.ZP`Added to cart`,CART_CTA_UNKNOWN:null}},2458:(e,t,s)=>{function r(e,t,s){const r={name:e,type:t};return s&&(r.properties=s),{payload:{track:r},type:"Track/trackBatchedEvent"}}function n(e){return r("chat_searched","action",e)}function a(e){return r("mark_as_sold_button_tapped","action",e)}function i(e){return r("reserve_button_tapped","action",e)}function o(e){return r("response_button_tapped","action",e)}function d(e){return r("response_sent","action",e)}function c(e){return r("unreserve_button_tapped","action",e)}s.d(t,{$Z:()=>o,Ms:()=>n,g$:()=>a,gD:()=>i,sY:()=>c,yQ:()=>d})},2461:(e,t,s)=>{function r(e,t,s){const r={name:e,type:t};return s&&(r.properties=s),{payload:{track:r},type:"Track/trackBatchedEvent"}}function n(e){return r("chat_phishing_warning_viewed","action",e)}function a(e){return r("chat_phishing_warning_send_anyway","action",e)}function i(e){return r("chat_phishing_warning_dont_send","action",e)}s.d(t,{CV:()=>i,Q0:()=>a,ou:()=>n})},1975:(e,t,s)=>{s.d(t,{yx:()=>l});var r=s(6),n=s(4),a=s(16),i=s(7),o=s(71),d=s(41);const c="BuyTracking",l=(0,r.PH)(`${c}/firstBuyerActionCheck`);function*f(){const e=yield(0,n.Ys)(a.XM);(0,o.wf)("FIRST_BUYER_ACTION_COMPLETE",`${e?e.id:""}`)||(yield(0,n.gz)((0,d.S6)([{event:"first-buyer-action",eventCategory:"Buyer"}])),(0,o._4)("FIRST_BUYER_ACTION_COMPLETE",!0,`${e?e.id:""}`))}i.Z.register(c,(function*(){yield(0,n.ib)(l.type,f)}))},1974:(e,t,s)=>{s.d(t,{Bm:()=>I,Ec:()=>p,J7:()=>g,NC:()=>_,W:()=>m,XC:()=>E,f5:()=>y,rL:()=>h});var r=s(4),n=s(1027),a=s(1975),i=s(184),o=s(41),d=s(106),c=s(876),l=s(870),f=s(76),u=s(394);function*y(e){const t=yield(0,r.Ys)(l.k0,{offerID:e});t&&(yield(0,r.gz)((0,o.S6)([{browseCategoryId:`${t.product.collection?t.product.collection.cc_id:""}`},{productId:`${t.product?t.product.id:""}`},{isInstantBuyEnabled:t?.product?.smart_attributes?.is_mall??"false"}])))}function*g(e,t,s){if(e){const n=e.collection?e.collection.cc_id:"",a=n?yield(0,r.RE)(f.p6,"buyer_action",e):null;yield(0,r.RE)(u.wu,{event:"chat",eventAction:"make-offer",eventCategory:"Buyer",eventLabel:`${n}-${t}`}),yield(0,r.gz)((0,o.S6)([{event:"chat",eventAction:"make-offer",eventCategory:"Buyer",eventLabel:`${n}-${t}`},{...a?{eAlias:a}:{},conversation_id:`${s}`,eAction:"offer",eCategory:"Buyer",event:"buyerActionClick",itemPrice:e.price,listingCCId:`${e.collection?.cc_id}`,listingId:`${e.id}`}]))}}function*p(e,t,s){if(e){const n=e.collection?e.collection.cc_id:"";(0,u.wu)({eventAction:"start-chat",eventCategory:"Buyer",eventLabel:`${n}-${t}`});const d=yield(0,r.RE)(f.p6,"buyer_action",e);yield(0,r.gz)((0,o.S6)([{event:"chat",eventAction:"start-chat",eventCategory:"Buyer",eventLabel:`${n}`},{conversation_id:`${s}`,eAction:"chat",eCategory:"Buyer",event:"buyerActionClick",itemPrice:e.price,listingCCId:`${e.collection?.cc_id}`,listingId:`${e.id}`,...d?{eAlias:d}:{}}])),yield(0,r.gz)((0,a.yx)()),yield(0,r.gz)((0,i.bQ)({data:{name:"Contact",properties:{"Buyer User ID":t,Category:e.collection?.display_name??"","Category ID":`${e.collection?.id??""}`,"Contact Type":"Start chat",Instantbuy:e.is_mall?"true":"false","Product ID":`${e.id}`,"Product Title":e.title,Seller:e.seller?.username??"","Seller User ID":`${e.seller?.id??""}`}}}))}}function*m(e){const t=yield(0,r.Ys)(l.k0,{offerID:e});t&&(yield(0,r.RE)(u.wu,{event:"chat",eventAction:"accept-offer",eventCategory:"Seller",eventLabel:`${t.product.collection?t.product.collection.cc_id:""}-${t.user?t.user.id:""}`}),yield(0,r.gz)((0,o.S6)([{event:"chat",eventAction:"accept-offer",eventCategory:"Seller",eventLabel:`${t.product.collection?t.product.collection.cc_id:""}-${t.user?t.user.id:""}`}])))}function*_(e){const t=yield(0,r.Ys)(l.k0,{offerID:e});t&&(yield(0,r.RE)(u.wu,{event:"chat",eventAction:"cancel-offer",eventCategory:"Buyer",eventLabel:`${t.product.collection?t.product.collection.cc_id:""}-${t.user?t.user.id:""}`}),yield(0,r.gz)((0,o.S6)([{event:"chat",eventAction:"cancel-offer",eventCategory:"Buyer",eventLabel:`${t.product.collection?t.product.collection.cc_id:""}-${t.user?t.user.id:""}`}])))}function*h(e){const t=yield(0,r.Ys)(l.k0,{offerID:e});t&&(yield(0,r.RE)(u.wu,{event:"chat",eventAction:"decline-offer",eventCategory:"Seller",eventLabel:`${t.product.collection?t.product.collection.cc_id:""}-${t.user?t.user.id:""}`}),yield(0,r.gz)((0,o.S6)([{event:"chat",eventAction:"decline-offer",eventCategory:"Seller",eventLabel:`${t.product.collection?t.product.collection.cc_id:""}-${t.user?t.user.id:""}`}])))}function*E(e,t){yield(0,r.rM)(n.Sx,{name:"response_sent",properties:{...e.product.collection&&{cc_id:`${e.product.collection.cc_id}`},chat_mode:c.TK[e.offer_type],..."chat_image"===t.responseType?{num_image:`${t.numImage}`}:null,..."offer"===t.responseType?{offer_amount:t.offerPrice}:null,offer_id:`${e.id}`,other_user_id:`${e.user.id}`,product_id:`${e.product.id}`,response_type:t.responseType,source:t.source},type:"action"})}function*I(e,t,s){const n=yield(0,r.Ys)(l.k0,{offerID:e}),a=n?.product?.collection?.cc_id;if(n)if(n.chat_only){yield(0,r.rM)(E,n,{offerPrice:t,responseType:"offer",source:s}),yield(0,r.RE)(u.wu,{event:"chat",eventAction:"make-offer",eventCategory:"Buyer",eventLabel:`${a??""}-${n.user?n.user.id:""}`});const i=yield(0,r.Ys)(d.MO,{listingID:n.product.id}),c=yield(0,r.RE)(f.p6,"buyer_action",i);yield(0,r.gz)((0,o.S6)([{event:"chat",eventAction:"make-offer",eventCategory:"Buyer",eventLabel:`${a??""}-${n.user?n.user.id:""}`},{...c?{eAlias:c}:{},conversationId:`${e}`,eAction:"offer",eCategory:"Buyer",event:"buyerActionClick",itemPrice:n.product.price,listingCCId:`${n.product.collection?.cc_id}`,listingId:`${n.product.id}`,"userType-Buyer":"yes"}]))}else yield(0,r.RE)(u.wu,{event:"chat",eventAction:"make-subsequent-offer",eventCategory:"Buyer",eventLabel:`${a??""}-${n.user?n.user.id:""}`}),yield(0,r.gz)((0,o.S6)([{event:"chat",eventAction:"make-subsequent-offer",eventCategory:"Buyer",eventLabel:`${a??""}-${n.user?n.user.id:""}`,itemPrice:n.product.price}]))}},965:(e,t,s)=>{s.d(t,{NR:()=>h,UE:()=>u,QQ:()=>_,lx:()=>I,Sq:()=>E});var r=s(6),n=s(4),a=s(102),i=s(103);const o="OffersUnreadCount";var d=s(11),c=s(12),l=s(5),f=s(7);const u=(0,r.PH)(`${o}/offersUnreadCountGetRequest`),y=(0,r.oM)({initialState:{activityUnreadCount:void 0,unreadCount:void 0,unreadCountPending:!1},name:o,reducers:{offersUnreadCountGetFailure(e){e.unreadCountPending=!1},offersUnreadCountGetPending(e){e.unreadCountPending=!0},offersUnreadCountGetSuccess(e,t){e.unreadCount=t.payload.unreadCount,e.activityUnreadCount=t.payload.activityUnreadCount,e.unreadCountPending=!1},offersUnreadCountUpdate(e,t){e.unreadCount=(e.unreadCount?e.unreadCount:0)+t.payload.adjustment}}}),{offersUnreadCountGetFailure:g,offersUnreadCountGetPending:p,offersUnreadCountGetSuccess:m,offersUnreadCountUpdate:_}=y.actions;function*h(){yield(0,n.gz)(p());try{const e=yield(0,n.Ys)(c.c6,{experimentId:"new-activity-feed-ui"});let t={activityUnreadCount:0,unreadCount:0};if(e){const e=yield(0,n.RE)(i.S,(0,a.k9)());t={activityUnreadCount:e.activityUnreadCount,unreadCount:e.inboxUnreadCount}}else{const{data:e}=yield(0,n.RE)(d.U2,"me",{path:"/1.0/unread-counts",query:{type:"inbox"}});t={activityUnreadCount:0,unreadCount:e.inbox_unread_count}}return yield(0,n.gz)(m(t)),t.unreadCount}catch(e){return yield(0,n.gz)(g()),null}}function E(e){return e[o].unreadCount}function I(e){return e[o].activityUnreadCount}y.reducer,l.Z.register(o,y.reducer),f.Z.register(o,(function*(){yield(0,n.Fm)(u.type,h)}))},1028:(e,t,s)=>{s.d(t,{w4:()=>v,uz:()=>O,zK:()=>R,LE:()=>T,Ft:()=>C,pP:()=>b,J3:()=>q,Fg:()=>z,RS:()=>W,Ht:()=>j,GH:()=>Y,z:()=>B,RR:()=>N,E_:()=>H,Qi:()=>x,Wc:()=>K,m5:()=>k,iQ:()=>Z,yJ:()=>Q});var r=s(6),n=s(4),a=s(16),i=s(11),o=s(5),d=s(7),c=s(71),l=s(2458),f=s(907),u=s(877);const y="ChatSearch";var g=s(411);const p={recentSearchTerms:[],searchEntityLoadingMore:!1,searchEventId:null,searchOffers:{hasMore:!1,hitCount:0,offers:[]},searchOffersFailed:!1,searchOffersLoading:!1,searchOffersLoadingMore:!1,searchQuery:null,searchSummary:null,searchSummaryFailed:!1,searchSummaryLoading:!1},m=(0,r.oM)({initialState:p,name:y,reducers:{chatSearchSummaryGetFailure(e){e.searchSummaryFailed=!0,e.searchEntityLoadingMore=!1,e.searchSummaryLoading=!1},chatSearchSummaryGetPending(e,t){const{searchContext:s}=t.payload;e.searchEntityLoadingMore=!!s,e.searchSummary=s?e.searchSummary:null,e.searchSummaryFailed=!1,e.searchSummaryLoading=!s},chatSearchSummaryGetSuccess(e,t){const{searchEventId:s,searchQuery:r,searchSummary:n}=t.payload,{listingHits:a,messageHits:i,searchContext:o,userHits:d}=n;e.searchEntityLoadingMore=!1,e.searchSummaryLoading=!1,e.searchEventId=s,e.searchQuery=r;const c=(e?.searchSummary?.listingHits?.listingPreviews??[]).concat(a?.listingPreviews??[]),l=a?{hasMore:!!a?.hasMore,listingPreviews:c}:null,f=(e?.searchSummary?.messageHits?.messagePreviews??[]).concat(i?.messagePreviews??[]),u=i?{hasMore:!!i?.hasMore,messagePreviews:f}:null,y=(e?.searchSummary?.userHits?.userPreviews??[]).concat(d?.userPreviews??[]),g=d?{hasMore:!!d?.hasMore,userPreviews:y}:null;e.searchSummary={listingHits:l,messageHits:u,searchContext:o,userHits:g}},recentSearchTermsGetSuccess(e,t){e.recentSearchTerms=t.payload.recentSearchTerms},searchOffersGetFailure(e){e.searchOffersFailed=!0,e.searchOffersLoading=!1,e.searchOffersLoadingMore=!1},searchOffersGetPending(e,t){const{timestamp:s}=t.payload;e.searchOffersFailed=!1,e.searchOffersLoading=!s,e.searchOffersLoadingMore=!!s,e.searchOffers=s?e.searchOffers:p.searchOffers},searchOffersGetSuccess(e,t){const s=t.payload,r=(e.searchOffersLoadingMore?e.searchOffers.offers:[]).concat(s.offers);e.searchOffersFailed=!1,e.searchOffersLoading=!1,e.searchOffersLoadingMore=!1,e.searchOffers={hasMore:s.hasMore,hitCount:s.hitCount,offers:r}}}}),{chatSearchSummaryGetFailure:_,chatSearchSummaryGetPending:h,chatSearchSummaryGetSuccess:E,recentSearchTermsGetSuccess:I,searchOffersGetFailure:S,searchOffersGetPending:D,searchOffersGetSuccess:M}=(m.reducer,m.actions);o.Z.register(y,m.reducer);const v=(0,r.PH)(`${y}/chatSearchSummaryGet`),R=(0,r.PH)(`${y}/recentSearchTermsGet`),T=(0,r.PH)(`${y}/recentSearchTermsPut`),O=(0,r.PH)(`${y}/recentSearchTermsDelete`),C=(0,r.PH)(`${y}/searchMessagesGet`),b=(0,r.PH)(`${y}/searchOffersGet`);function L(e){return(0,c.wf)("CHAT_RECENT_SEARCH_TERMS",e)??[]}function*P(e){const t=yield(0,n.Ys)(a.XM);if(t)try{const e=L(`${t.id}`);yield(0,n.gz)(I({recentSearchTerms:e}))}catch(e){yield(0,n.gz)(I({recentSearchTerms:[]}))}}function*A(e){const t=yield(0,n.Ys)(a.XM);if(!t)return;const s=`${t.id}`;try{const e=yield(0,n.Ys)(G);if(!e)return;const t=L(s),r=new Set([...t]);r.has(e)&&r.delete(e),r.add(e);const a=[...r].slice(-f.c_);(0,c._4)("CHAT_RECENT_SEARCH_TERMS",a,s),yield(0,n.gz)(I({recentSearchTerms:a}))}catch(e){yield(0,n.gz)(I({recentSearchTerms:[]}))}}function*U(e){const{deleteAll:t,deleteSearchTerm:s}=e.payload,r=yield(0,n.Ys)(a.XM);if(!r)return;const i=`${r.id}`;try{if(t)(0,c._4)("CHAT_RECENT_SEARCH_TERMS",[],i),yield(0,n.gz)(I({recentSearchTerms:[]}));else if(s){const e=yield(0,n.Ys)(x)??[],t=new Set([...e]);if(t.has(s)){t.delete(s);const e=[...t];(0,c._4)("CHAT_RECENT_SEARCH_TERMS",e,i),yield(0,n.gz)(I({recentSearchTerms:e}))}}}catch(e){}}function*w(e){const{count:t,fromTimestamp:s,legacyOfferId:r,query:a}=e.payload;yield(0,n.gz)(D({timestamp:s}));try{const e=yield(0,n.RE)(i.v_,f.Vr,{data:{count:t,fromTimestamp:s,legacyOfferId:r,query:a},path:f.i0.SEARCH_MESSAGES}),o=(e?.hits??[]).map((e=>{const{createdAt:t,message:s,offer:r}=e;return{...r,latestMessage:s,latestMessageCreated:t}})),d={...e,offers:(0,u.F3)(o)};yield(0,n.gz)(M(d))}catch(e){yield(0,n.gz)(S())}}function*$(e){const{count:t,latestMessageCreated:s,listingIds:r,userIds:a}=e.payload,o=r?.length?r:[],d=a?.length?a:[];yield(0,n.gz)(D({timestamp:s}));try{const e=yield(0,n.RE)(i.v_,f.Vr,{data:{count:t,latestMessageCreated:s,listingIds:o,userIds:d},path:f.i0.SEARCH_OFFERS}),r={...e,offers:(0,u.F3)(e.offers)};yield(0,n.gz)(M(r))}catch(e){yield(0,n.gz)(S())}}function*F(e){const{count:t,searchContext:s,searchEntityType:r,searchQuery:a}=e.payload;yield(0,n.gz)(h({searchContext:s}));try{const e=yield(0,n.RE)(i.v_,f.Vr,{data:{count:t,searchContext:s,searchEntityType:r,searchQuery:a},path:f.i0.SEARCH_SUMMARY}),o=yield(0,n.Ys)(G);let d=yield(0,n.Ys)(Z);if(o!==a){const t=(e?.listingHits?.listingPreviews?.length??0)+(e?.messageHits?.messagePreviews?.length??0)+(e?.userHits?.userPreviews?.length??0);d=(0,g.Zs)(),yield(0,n.gz)((0,l.Ms)({num_results:t,search_id:d,source:a}))}yield(0,n.gz)(E({searchEventId:d,searchQuery:a,searchSummary:e}))}catch(e){yield(0,n.gz)(_())}}function x(e){return e[y]?.recentSearchTerms}function G(e){return e[y]?.searchQuery}function z(e){return e[y]?.searchSummaryLoading}function k(e){return e[y]?.searchEntityLoadingMore}function N(e){return e[y]?.searchOffersLoading}function H(e){return e[y]?.searchOffersLoadingMore}function B(e){return e[y]?.searchOffersFailed}function Y(e){return e[y]?.searchOffers}function q(e){return e[y]?.searchSummaryFailed}function W(e){return e[y]?.searchSummary?.listingHits}function j(e){return e[y]?.searchSummary?.messageHits}function Q(e){return e[y]?.searchSummary?.userHits}function K(e){return e[y]?.searchSummary?.searchContext}function Z(e){return e[y]?.searchEventId}d.Z.register(y,(function*(){yield(0,n.Fm)(R,P),yield(0,n.Fm)(T,A),yield(0,n.Fm)(O,U),yield(0,n.Fm)(v,F),yield(0,n.Fm)(b,$),yield(0,n.Fm)(C,w)}))},2459:(e,t,s)=>{s.d(t,{Fb:()=>n,ky:()=>a,vb:()=>r});const r={FAILED:2,OK:1,UNKNOWN:0},n=10,a=3},907:(e,t,s)=>{s.d(t,{As:()=>o,Dz:()=>d,Up:()=>a,Vr:()=>r,XI:()=>u,c_:()=>c,i0:()=>n,iY:()=>l,lv:()=>f,mp:()=>i});const r="chat-search",n={SEARCH_MESSAGES:"/chat/1.0/search/messages/",SEARCH_OFFERS:"/chat/1.0/search/offers/",SEARCH_SUMMARY:"/chat/1.0/search/summary/"},a=300,i=3,o=10,d=20,c=5,l=3,f={entityId:"entity_id",entityType:"entity_type",msgTs:"msg_ts",searchText:"search_text",seeAll:"see_all",showRecentSearch:"recent_search"},u={TYPE_ALL:"0",TYPE_LISTINGS:"1",TYPE_MESSAGES:"2",TYPE_USERS:"3"}},991:(e,t,s)=>{s.d(t,{$7:()=>o,Cj:()=>u,Dk:()=>O,KD:()=>c,MC:()=>D,Mg:()=>a,P0:()=>p,Pz:()=>m,WT:()=>f,Ww:()=>h,Xh:()=>E,YT:()=>S,Zj:()=>M,kg:()=>l,m$:()=>g,rH:()=>i,rJ:()=>I,t5:()=>R,tF:()=>T,vG:()=>_,w9:()=>y,zi:()=>d});var r=s(18),n=s(1071);const a="channel_handler_id",i=6e4,o=4e6,d="chat-message-",c=4e3,l=!1,f=400302,u=400108,y=2e4,g=15704928e5,p=30,m=10,_=300,h=2e3,E=/\[[^[\]]+\]\([^()]+\)/g,I=(0,r.ZP)("Unsupported message on Web version. To view this, open your Carousell mobile app."),S=new Set([n.CH.SYSTEM_MESSAGE,n.CH.SYSTEM_MESSAGE_CANCELLED_DISPUTE,n.CH.SYSTEM_MESSAGE_ESCALATED_DISPUTE,n.CH.SYSTEM_MESSAGE_NEW_DISPUTE,n.CH.SYSTEM_MESSAGE_REVIEWED_DISPUTE]),D=new Set([n.Wv.DEFAULT,n.Wv.MESSAGE]),M=new Set([...D,"IMAGE",n.Wv.BLOCKED]),v=new Set([n.Wv.ACCEPT_OFFER,n.Wv.ACCEPT_QUOTE,n.Wv.CANCEL_OFFER,n.Wv.CANCEL_QUOTE,n.Wv.DECLINE_OFFER,n.Wv.DECLINE_QUOTE,n.Wv.MAKE_OFFER,n.Wv.MESSAGE_CTA,n.Wv.PROPOSE_REFUND_RESOLUTION,n.Wv.PROPOSE_EXCHANGE_RESOLUTION,n.Wv.RESOLUTION_ACCEPTED,n.Wv.RESOLUTION_CANCELLED,n.Wv.RESOLUTION_DECLINED,n.Wv.SEND_QUOTE]),R=new Set([...M,...v,n.Wv.DELETED]),T=new Set([...R,...S]),O=new Set([n.gi.chat_feedback_good,n.gi.chat_feedback_bad,n.gi.check_insight,n.gi.deeplink,n.gi.delivery_detail,n.gi.leave_feedback,n.gi.order_detail,n.gi.order_request,n.gi.price_drop_boost,n.gi.seller_boost_apply,n.gi.seller_boost_not_available,n.gi.seller_boost_checkout_bumps,n.gi.confirmed_deal,n.gi.did_not_deal,n.gi.dispute_detail])},1128:(e,t,s)=>{s.d(t,{mx:()=>M,nU:()=>v,dy:()=>R,Aj:()=>L,Au:()=>T,Z7:()=>k,Bx:()=>Q,DY:()=>K});var r=s(6),n=s(4),a=s(16),i=s(11),o=s(5),d=s(7),c=s(71);const l="Chat";var f=s(1027),u=s(922),y=s(2459);const g="100100",p="100101",m="100102",_="100103";var h=s(2460),E=s(876),I=s(1974),S=s(105),D=s(411);const M=(0,r.PH)(`${l}/chatImageRetryRequest`),v=(0,r.PH)(`${l}/chatImagesSendRequest`),R=(0,r.PH)(`${l}/chatReplyTemplatesDisplayLoad`),T=(0,r.PH)(`${l}/chatReplyTemplatesGetRequest`),O=(0,r.PH)(`${l}/chatReplyTemplatesGetFailure`),C=(0,r.oM)({initialState:{displayReplyTemplates:!0,replyTemplates:{}},name:l,reducers:{chatReplyTemplatesDisplayLoaded(e,t){e.displayReplyTemplates=t.payload.display},chatReplyTemplatesDisplaySave(e,t){e.displayReplyTemplates=t.payload.display},chatReplyTemplatesGetPending(e,t){e.replyTemplates[t.payload.channelUrl]=null},chatReplyTemplatesGetSuccess(e,t){e.replyTemplates[t.payload.channelUrl]={sourceChatTime:t.payload.sourceChatTime,templates:t.payload.replyTemplates}}}}),{chatReplyTemplatesDisplayLoaded:b,chatReplyTemplatesDisplaySave:L,chatReplyTemplatesGetPending:P,chatReplyTemplatesGetSuccess:A}=C.actions;function*U(e){const{payload:{channel:t,failedMessageID:s,image:r,offer:a}}=e,i=(0,D.Zs)();yield(0,n.rM)(f.Sx,{name:"response_attempt",properties:{...a.id===E.J9?null:{offer_id:`${a.id}`},journey_id:i,num_image:"1",response_type:"image"},type:"action"}),yield(0,n.gz)((0,u.LN)({channelUrl:t.url,failedMessageID:s}));const o=yield(0,n.RE)(F,[r],i);if(null==o)return void(yield(0,n.gz)((0,u.uq)({channelUrl:t.url,pendingMessageID:s})));const d=yield(0,n.RE)(w,t.url,o,i);if(null==d)return void(yield(0,n.gz)((0,u.uq)({channelUrl:t.url,pendingMessageID:s})));if(yield(0,n.gz)((0,u._g)({channelUrl:t.url,encryptedUrl:d[0],pendingMessageID:s})),null==(yield(0,n.RE)(G,d[0],r.file,i)))return void(yield(0,n.gz)((0,u.uq)({channelUrl:t.url,pendingMessageID:s})));const{confirmationFailureUrls:c}=yield(0,n.RE)(z,t.url,d,i);c.includes(d[0])?yield(0,n.gz)((0,u.uq)({channelUrl:t.url,pendingMessageID:s})):yield(0,n.rM)(I.XC,a,{numImage:"1",responseType:"chat_image",source:"chat_screen"})}function*w(e,t,s){try{const{data:{images:s}}=yield(0,n.RE)(i.v_,"chat-send-images-meta",{data:{chatId:e,images:t}});return s.map((e=>e.encryptedUrl))}catch(e){return yield(0,n.rM)(f.RV,{attemptId:s,errorCode:_,failedCount:t.length,httpCode:e.statusCode}),null}}function*$(e){const{payload:{channel:t,images:s,offer:r}}=e,i=yield(0,n.Ys)(a.XM);if(!i)return;const o=(0,D.Zs)();yield(0,n.rM)(f.Sx,{name:"response_attempt",properties:{...r.id===E.J9?null:{offer_id:`${r.id}`},journey_id:o,num_image:`${s.length}`,response_type:"image"},type:"action"});const d=yield(0,n.RE)(h.Rr,s,t,i);yield(0,n.$6)(Object.keys(d).map((e=>(0,n.gz)((0,u.iA)({channelUrl:t.url,message:d[e]})))));const c=yield(0,n.RE)(F,s,o);if(null==c)return void(yield(0,n.$6)(Object.keys(d).map((e=>(0,n.gz)((0,u.pG)({channelUrl:t.url,pendingMessage:d[e]}))))));const l=yield(0,n.RE)(w,t.url,c,o);if(null==l)return void(yield(0,n.$6)(Object.keys(d).map((e=>(0,n.gz)((0,u.pG)({channelUrl:t.url,pendingMessage:d[e]}))))));yield(0,n.$6)(Object.keys(d).map(((e,s)=>(0,n.gz)((0,u._g)({channelUrl:t.url,encryptedUrl:l[s],pendingMessageID:e})))));const y=(0,h.LC)(d,l),g=l.map(((e,t)=>({encryptedUrl:e,file:s[t].file}))),{uploadFailureUrls:p,uploadSuccessUrls:m}=yield(0,n.RE)(x,g,o);yield(0,n.$6)(p.map((e=>(0,n.gz)((0,u.pG)({channelUrl:t.url,pendingMessage:y[e]})))));const{confirmationFailureUrls:_,confirmationSuccessUrls:S}=yield(0,n.RE)(z,t.url,m,o);yield(0,n.$6)(_.map((e=>(0,n.gz)((0,u.pG)({channelUrl:t.url,pendingMessage:y[e]}))))),yield(0,n.rM)(I.XC,r,{numImage:`${S.length}`,responseType:"chat_image",source:"chat_screen"})}function*F(e,t){try{return yield(0,n.$6)(e.map(((e,t)=>(0,n.RE)(h.sw,e.file,t))))}catch(s){return yield(0,n.rM)(f.RV,{attemptId:t,errorCode:g,failedCount:e.length,httpCode:s.statusCode}),null}}function*x(e,t){const s=yield(0,n.$6)(e.map((e=>(0,n.RE)(G,e.encryptedUrl,e.file,t)))),r=[],a=[];return s.forEach(((t,s)=>{null!=t?a.push(e[s].encryptedUrl):r.push(e[s].encryptedUrl)})),{uploadFailureUrls:r,uploadSuccessUrls:a}}function*G(e,t,s){try{return yield(0,n.RE)(i.v_,"upload",{data:{encryptedUrl:e},files:[{content:t,fieldName:"image"}]}),e}catch(e){return yield(0,n.rM)(f.RV,{attemptId:s,errorCode:p,failedCount:1,httpCode:e.statusCode}),null}}function*z(e,t,s){try{const{data:{images:r}}=yield(0,n.RE)(i.v_,"chat-confirm-image-uploads",{data:{chatId:e,encryptedUrls:t}}),a=[],o=[];return r.forEach((e=>{e.status===y.vb.OK?o.push(e.encryptedUrl):a.push(e.encryptedUrl)})),yield(0,n.rM)(f.RV,{attemptId:s,errorCode:m,failedCount:a.length,httpCode:"200"}),{confirmationFailureUrls:a,confirmationSuccessUrls:o}}catch(e){return yield(0,n.rM)(f.RV,{attemptId:s,errorCode:m,failedCount:t.length,httpCode:e.statusCode}),{confirmationFailureUrls:t,confirmationSuccessUrls:[]}}}function*k(e){const{payload:{message:t,offer:s}}=e,r=(0,h.L2)(t.raw.customType,s.offer_type);if(r){yield(0,n.gz)(P({channelUrl:t.raw.channelUrl}));try{const{data:e}=yield(0,n.RE)(i.U2,"chat-reply-templates",{query:{last_chat_message:t.raw.message,last_chat_message_time:t.raw.createdAt,last_chat_message_type:r,offer_id:`${s.id}`,product_id:`${s.product.id}`,sendbird_channel_url:t.raw.channelUrl}});yield(0,n.gz)(A({channelUrl:t.raw.channelUrl,replyTemplates:e.replySuggestions,sourceChatTime:t.raw.createdAt}))}catch(e){yield(0,n.gz)(O())}}}function*N(e){const t=yield(0,n.RE)(c.wf,"CHAT_REPLY_TEMPLATES_DISPLAY");null!=t&&(yield(0,n.gz)(b({display:t})))}function*H(e){yield(0,n.RE)(c._4,"CHAT_REPLY_TEMPLATES_DISPLAY",e.payload.display),e.payload.display?yield(0,n.gz)((0,S.LO)({snackbarID:"CHAT_REPLY_TEMPLATES_DISPLAYED"})):yield(0,n.gz)((0,S.LO)({snackbarID:"CHAT_REPLY_TEMPLATES_HIDDEN"}))}function*B(){yield(0,n.Fm)(M.type,U)}function*Y(){yield(0,n.Fm)(v.type,$)}function*q(){yield(0,n.Fm)(T.type,k)}function*W(){yield(0,n.Fm)(R.type,N)}function*j(){yield(0,n.Fm)(L.type,H)}function Q(e){return e[l].displayReplyTemplates}function K(e,t){return e[l].replyTemplates[t.channelUrl]}C.reducer,o.Z.register(l,C.reducer),d.Z.register(l,(function*(){yield(0,n.rM)(B),yield(0,n.rM)(Y),yield(0,n.rM)(q),yield(0,n.rM)(W),yield(0,n.rM)(j)}))},1027:(e,t,s)=>{s.d(t,{Bn:()=>u,n2:()=>y,bR:()=>g,Sx:()=>E,RV:()=>I});var r=s(6),n=s(4),a=s(876),i=s(5),o=s(7),d=s(33),c=s(1028),l=s(411);const f="ChatTracking",u=(0,r.PH)(`${f}/chatTrackingJourneyEnd`),y=(0,r.PH)(`${f}/chatTrackingJourneyStart`),g=(0,r.PH)(`${f}/chatTrackingTrackEvent`),p=(0,r.oM)({initialState:{journeyContext:null},name:f,reducers:{chatTrackingJourneyContextSave(e,t){e.journeyContext=t.payload.journeyContext}}}),{chatTrackingJourneyContextSave:m}=p.actions;function*_(){yield(0,n.gz)(m({journeyContext:null}))}function*h(e){const{offer:t,searchText:s}=e.payload,r=yield(0,n.Ys)(v);if(r&&function(e,t){const s=e.id===t.id,r=e.product.id===t.product.id,n=e.id===a.J9&&t.id!==a.J9;return(s||n)&&r}(r.offer,t))yield(0,n.gz)(m({journeyContext:{id:r.id,offer:t,startTime:r.startTime}}));else{const e=(0,l.Zs)();yield(0,n.gz)(m({journeyContext:{id:e,offer:t,startTime:(new Date).getTime()}}));const r={chat_mode:a.TK[t.offer_type],...t.id===a.J9?null:{offer_id:`${t.id}`},product_id:t.product.id};s&&(r.search_id=yield(0,n.Ys)(c.iQ)),yield(0,n.rM)(E,{name:"view_chat",properties:r,type:"screen"})}}function*E(e){const t=yield(0,n.Ys)(v);yield(0,n.gz)((0,d.Vh)({name:e.name,properties:{...t?{journey_id:t.id}:null,...e.properties},type:e.type}))}function*I(e){const{attemptId:t,errorCode:s,failedCount:r,httpCode:a}=e;r>0&&(yield(0,n.rM)(E,{name:"chat_error",properties:{context:"send_image",error_code:s,is_first_msg:!1,journey_id:t,num_image:`${r}`,type:"error",...a?{http_code:a}:null},type:"action"}))}function*S(){yield(0,n.ib)(u.type,_)}function*D(){yield(0,n.ib)(y.type,h)}function*M(){for(;;){const e=yield(0,n.qn)(g.type);yield(0,n.rM)(E,e.payload.trackData)}}function v(e){return e[f].journeyContext}p.reducer,i.Z.register(f,p.reducer),o.Z.register(f,(function*(){yield(0,n.rM)(S),yield(0,n.rM)(D),yield(0,n.rM)(M)}))},922:(e,t,s)=>{s.d(t,{BG:()=>Le,BR:()=>ge,DX:()=>x,Fe:()=>Ee,K$:()=>pe,LE:()=>xe,LN:()=>W,Ni:()=>Ie,S7:()=>Fe,SK:()=>ye,T5:()=>Se,_2:()=>he,_g:()=>re,aQ:()=>tt,bp:()=>ue,iA:()=>K,it:()=>Ve,jX:()=>Ge,pG:()=>Q,q9:()=>_e,td:()=>F,uq:()=>q,xB:()=>me});var r=s(6),n=s(67),a=s(4),i=s(16),o=s(11),d=s(12),c=s(5),l=s(15),f=s(7),u=s(102),y=s(17),g=s(2461),p=s(103),m=s(51),_=s(965),h=s(1974),E=s(105),I=s(991),S=s(877),D=s(1127),M=s(1071),v=s(1128),R=s(1027),T=s(870);const O=(0,r.oM)({initialState:{chats:{},restrictedRegex:[]},name:M.q5,reducers:{getRestrictedRegexSucces(e,t){e.restrictedRegex=t.payload},getRestrictedRegexfailure(e){e.restrictedRegex=[]},sendbirdChannelRefreshFailure(e,t){},sendbirdChannelRefreshPending(e){},sendbirdChannelRefreshSuccess(e,t){const{channel:s}=t.payload;e.chats[s.url]&&(e.chats[s.url].channel=s)},sendbirdChatActiveMessageSet(e,t){const{channelUrl:s,messageID:r,type:n}=t.payload;e.chats[s]&&(e.chats[s].activeMessageID=r,e.chats[s].activeMessageType=n)},sendbirdFailedMessageDelete(e,t){const{channelUrl:s,messageID:r}=t.payload,n=e.chats[s]?.unsentMessageIDs.indexOf(r);void 0!==n&&-1!==n&&(e.chats[s].unsentMessageIDs.splice(n,1),delete e.chats[s].unsentMessages[r])},sendbirdInitializeFailure(e,t){},sendbirdInitializePending(e){},sendbirdInitializeSuccess(e){},sendbirdMessageCTAFailure(e,t){L(e,t,!1)},sendbirdMessageCTAPending(e,t){L(e,t,!0)},sendbirdMessageCTASuccess(e,t){L(e,t,!1)},sendbirdMessageDelete(e,t){const{payload:{channelUrl:s,messageId:r}}=t;if(e.chats[s]&&e.chats[s].messages[r]&&"system"===e.chats[s].messages[r].extension.senderType){const t=e.chats[s].messageIDs;t.splice(t.indexOf(r),1),delete e.chats[s].messages[r]}},sendbirdMessageReceive(e,t){!function(e,t){const{channel:s,message:r}=t.payload,n=e.chats[s.url];if(!n)return void(e.chats[s.url]={activeMessageID:void 0,activeMessageType:void 0,anchorMsgTimestamp:void 0,channel:void 0,firstMessageListLoaded:!1,isMessagesTimestampBound:!1,isTyping:!1,messageIDs:[],messages:{},messagesByTimestamp:{},messagesGetError:void 0,messagesGetFailures:0,messagesGetPending:!1,shouldLoadMoreNext:!1,shouldLoadMorePrev:!0,unsentMessageIDs:[],unsentMessages:{},channel:s,messageIDs:[`${r.raw.messageId}`],messages:{[`${r.raw.messageId}`]:r}});if(n.messages[`${r.raw.messageId}`])return;let a;if("me"===r.extension.senderType&&r.extension.image&&null!=r.extension.parsedData.encrypted_url){const e=n.unsentMessageIDs.findIndex((e=>{const t=n.unsentMessages[e];return"me"===r.extension.senderType&&r.extension.parsedData.encrypted_url===t.extension.parsedData.encrypted_url}));if(-1!==e){const t=n.unsentMessageIDs.splice(e,1);a=n.unsentMessages[t[0]],delete n.unsentMessages[t[0]]}}n.messages[`${r.raw.messageId}`]={extension:{...r.extension},raw:r.raw},n.messagesByTimestamp[r.raw.createdAt]=Object.assign({},r),r.extension.image&&a?.extension.image&&(n.messages[`${r.raw.messageId}`].extension.image=a.extension.image,n.messagesByTimestamp[r.raw.createdAt].extension.image=a.extension.image),n.channel=C(s),"DELETED"===r.raw.customType&&(0,M.Z$)(r)?(n.messageIDs=n.messageIDs.map((e=>e===`${r.extension.parsedData.deleted_message_id}`?`${r.raw.messageId}`:e)),delete n.messages[`${r.extension.parsedData.deleted_message_id}`]):n.messageIDs=(0,D.FE)([`${r.raw.messageId}`],n.messageIDs,n.messages)}(e,t)},sendbirdMessageRetryFailure(e,t){const{channelUrl:s,pendingMessageID:r}=t.payload;e.chats[s].unsentMessages[r].extension.sendStatus="failed"},sendbirdMessageRetryPending(e,t){const{channelUrl:s,failedMessageID:r}=t.payload;e.chats[s].unsentMessages[r].extension.sendStatus="pending"},sendbirdMessageRetrySuccess(e,t){b(e,t)},sendbirdMessageSendBlocked(e,t){const{channelUrl:s,blockedMessage:r,err:n}=t.payload,a=e.chats[s];a.unsentMessages[`${r.raw.messageId}`]||a.unsentMessageIDs.push(`${r.raw.messageId}`),a.unsentMessages[`${r.raw.messageId}`]={extension:{...r.extension,blockReason:n,sendStatus:"blocked"},raw:r.raw}},sendbirdMessageSendFailure(e,t){const{channelUrl:s,pendingMessage:r}=t.payload,n=e.chats[s];n.unsentMessages[`${r.raw.messageId}`]||n.unsentMessageIDs.push(`${r.raw.messageId}`),n.unsentMessages[`${r.raw.messageId}`]={extension:{...r.extension,sendStatus:"failed"},raw:r.raw}},sendbirdMessageSendPending(e,t){const{payload:{channelUrl:s,message:r}}=t;e.chats[s].unsentMessageIDs.push(`${r.raw.messageId}`),e.chats[s].unsentMessages[`${r.raw.messageId}`]=r},sendbirdMessageSendSuccess(e,t){b(e,t)},sendbirdMessageUpdate(e,t){!function(e,t){const{channel:s,message:r}=t.payload,n=e.chats[s.url];if(!n)return e;const a=n.messages[`${r.raw.messageId}`];if(!a)return e;if((0,M.Z$)(a)&&(0,M.Z$)(r)){const e=a.extension.parsedData.content;r.extension.parsedData.content&&r.extension.parsedData.content.cta.forEach(((t,s)=>{e&&r.extension.parsedData.content&&"api"===e.cta[s].type&&"api"===r.extension.parsedData.content.cta[s].type&&(r.extension.parsedData.content.cta[s].pending=e.cta[s].pending)}))}n.channel=s,n.messages[`${r.raw.messageId}`]={extension:{...a.extension,...r.extension,parsedData:{...a.extension.parsedData,...r.extension.parsedData}},raw:r.raw}}(e,t)},sendbirdMessagesGetFailure(e,t){const{channelUrl:s,err:r}=t.payload;e.chats[s]?(e.chats[s].messagesGetError=r,e.chats[s].messagesGetFailures+=1,e.chats[s].messagesGetPending=!1):e.chats[s]={activeMessageID:void 0,activeMessageType:void 0,anchorMsgTimestamp:void 0,channel:void 0,firstMessageListLoaded:!1,isMessagesTimestampBound:!1,isTyping:!1,messageIDs:[],messages:{},messagesByTimestamp:{},messagesGetError:void 0,messagesGetFailures:0,messagesGetPending:!1,shouldLoadMoreNext:!1,shouldLoadMorePrev:!0,unsentMessageIDs:[],unsentMessages:{},messagesGetError:r,messagesGetFailures:1,messagesGetPending:!1}},sendbirdMessagesGetPending(e,t){const{channelUrl:s}=t.payload;e.chats[s]?(e.chats[s].messagesGetError=void 0,e.chats[s].messagesGetPending=!0):e.chats[s]={activeMessageID:void 0,activeMessageType:void 0,anchorMsgTimestamp:void 0,channel:void 0,firstMessageListLoaded:!1,isMessagesTimestampBound:!1,isTyping:!1,messageIDs:[],messages:{},messagesByTimestamp:{},messagesGetError:void 0,messagesGetFailures:0,messagesGetPending:!1,shouldLoadMoreNext:!1,shouldLoadMorePrev:!0,unsentMessageIDs:[],unsentMessages:{},messagesGetError:void 0,messagesGetPending:!0}},sendbirdMessagesGetSuccess(e,t){!function(e,t){const{channel:s,messages:r,shouldLoadMorePrev:n,shouldLoadMoreNext:a,timeInfo:i}=t.payload,o=e.chats[s.url];if(!o){const{messagesMap:t,messagesTimestampMap:o}=(0,D.Wk)(r);return void(e.chats[s.url]={activeMessageID:void 0,activeMessageType:void 0,anchorMsgTimestamp:void 0,channel:void 0,firstMessageListLoaded:!1,isMessagesTimestampBound:!1,isTyping:!1,messageIDs:[],messages:{},messagesByTimestamp:{},messagesGetError:void 0,messagesGetFailures:0,messagesGetPending:!1,shouldLoadMoreNext:!1,shouldLoadMorePrev:!0,unsentMessageIDs:[],unsentMessages:{},anchorMsgTimestamp:i?i.timestamp:void 0,channel:s,firstMessageListLoaded:!i,isMessagesTimestampBound:!!i,messageIDs:r.map((e=>`${e.raw.messageId}`)),messages:t,messagesByTimestamp:o,messagesGetError:void 0,messagesGetPending:!1,shouldLoadMoreNext:a,shouldLoadMorePrev:n})}const d=r.filter((e=>null==o.messages[`${e.raw.messageId}`]));let c=!0;(o.isMessagesTimestampBound&&!i||"around"===i?.fetchType)&&(c=!1);const l=c?o.messages:{},f=c?o.messagesByTimestamp:{},u=c?o.messageIDs:[],y=c?d:r,{messagesMap:g,messagesTimestampMap:p}=(0,D.Wk)(y),m={...l,...g},_={...f,...p};o.anchorMsgTimestamp="around"===i?.fetchType?i.timestamp:o.anchorMsgTimestamp,o.channel=s,o.firstMessageListLoaded=!i,o.isMessagesTimestampBound=!!i,o.messageIDs=(0,D.FE)(y.map((e=>`${e.raw.messageId}`)),u,m),o.messages=m,o.messagesByTimestamp=_,o.messagesGetError=void 0,o.messagesGetFailures=0,o.messagesGetPending=!1,o.shouldLoadMoreNext=a,o.shouldLoadMorePrev=n}(e,t)},sendbirdPendingImageUpdate(e,t){const{channelUrl:s,encryptedUrl:r,pendingMessageID:n}=t.payload;e.chats[s]?.unsentMessages[n]&&(e.chats[s].unsentMessages[n].extension.parsedData.encrypted_url=r)},sendbirdReadReceiptUpdate(e,t){const{channel:s}=t.payload;e.chats[s.url]&&(e.chats[s.url].channel=C(s),Object.keys(e.chats[s.url].messages).forEach((t=>{e.chats[s.url].messages[t].extension.read=0===s.getUnreadMemberCount(e.chats[s.url].messages[t].raw)})))},sendbirdSentMessageDeleteFailure(e,t){},sendbirdSentMessageDeletePending(e){},sendbirdSentMessageDeleteSuccess(e,t){const{payload:{channelUrl:s,messageID:r}}=t,n=e.chats[s]?.messages[r];n&&(delete n.extension.image,n.extension.parsedData.deleted_message_custom_type=n.raw.customType,n.raw.customType=M.Wv.DELETED)},sendbirdTokenGetFailure(e,t){},sendbirdTokenGetPending(e){},sendbirdTokenGetSuccess(e){},sendbirdTypingStatusUpdate(e,t){const{channel:s}=t.payload;e.chats[s.url]?(e.chats[s.url].channel=C(s),e.chats[s.url].isTyping=s.isTyping):e.chats[s.url]={activeMessageID:void 0,activeMessageType:void 0,anchorMsgTimestamp:void 0,channel:void 0,firstMessageListLoaded:!1,isMessagesTimestampBound:!1,isTyping:!1,messageIDs:[],messages:{},messagesByTimestamp:{},messagesGetError:void 0,messagesGetFailures:0,messagesGetPending:!1,shouldLoadMoreNext:!1,shouldLoadMorePrev:!0,unsentMessageIDs:[],unsentMessages:{},channel:s,isTyping:s.isTyping}}}});function C(e){return e.members?.forEach((e=>{e.connectionStatus="online",e.lastSeenAt=(new Date).getTime()})),e}function b(e,t){const{channelUrl:s,message:r,pendingMessageID:n}=t.payload,a=e.chats[s],i=r.raw.messageId;a.unsentMessageIDs=a.unsentMessageIDs.filter((e=>e!==n)),delete a.unsentMessages[n],a.messages[`${i}`]||(a.messages[`${i}`]=r,a.messageIDs=(0,D.FE)([`${r.raw.messageId}`],a.messageIDs,a.messages),a.messagesByTimestamp[r.raw.createdAt]=Object.assign({},r))}function L(e,t,s){const{channelUrl:r,ctaAction:n,messageID:a}=t.payload;if("system"!==e.chats[r]?.messages[a]?.extension.senderType){const t=e.chats[r].messages[a].extension;t.parsedData.content?.cta.forEach((e=>{"api"===n.type&&"api"===e.action.type&&"api"===e.type&&n.details.action_id===e.action.details.action_id&&(e.pending=s)}))}}O.reducer;const{getRestrictedRegexSucces:P,getRestrictedRegexfailure:A,sendbirdChannelRefreshFailure:U,sendbirdChannelRefreshPending:w,sendbirdChannelRefreshSuccess:$,sendbirdChatActiveMessageSet:F,sendbirdFailedMessageDelete:x,sendbirdInitializeFailure:G,sendbirdInitializePending:z,sendbirdInitializeSuccess:k,sendbirdMessageCTAFailure:N,sendbirdMessageCTAPending:H,sendbirdMessageCTASuccess:B,sendbirdMessageReceive:Y,sendbirdMessageRetryFailure:q,sendbirdMessageRetryPending:W,sendbirdMessageRetrySuccess:j,sendbirdMessageSendFailure:Q,sendbirdMessageSendPending:K,sendbirdMessageSendSuccess:Z,sendbirdMessageSendBlocked:X,sendbirdMessageUpdate:J,sendbirdMessageDelete:V,sendbirdMessagesGetFailure:ee,sendbirdMessagesGetPending:te,sendbirdMessagesGetSuccess:se,sendbirdPendingImageUpdate:re,sendbirdReadReceiptUpdate:ne,sendbirdSentMessageDeleteFailure:ae,sendbirdSentMessageDeletePending:ie,sendbirdSentMessageDeleteSuccess:oe,sendbirdTokenGetFailure:de,sendbirdTokenGetPending:ce,sendbirdTokenGetSuccess:le,sendbirdTypingStatusUpdate:fe}=O.actions;c.Z.register(M.q5,O.reducer);const ue=(0,r.PH)(`${M.q5}/sendbirdChannelRefreshAtIntervals`),ye=(0,r.PH)(`${M.q5}/sendbirdChannelRefreshAtIntervalsStop`),ge=(0,r.PH)(`${M.q5}/sendbirdInitializeRequest`),pe=(0,r.PH)(`${M.q5}/sendbirdMessageCTARequest`),me=(0,r.PH)(`${M.q5}/sendbirdMessagesGetRequest`),_e=(0,r.PH)(`${M.q5}/sendbirdMessageRetryRequest`),he=(0,r.PH)(`${M.q5}/sendbirdMessageSendRequest`),Ee=(0,r.PH)(`${M.q5}/sendbirdSentMessageDeleteRequest`),Ie=(0,r.PH)(`${M.q5}/sendbirdBlockedMessageSendRequest`),Se=(0,r.PH)(`${M.q5}/sendbirdTypingStatusSend`);function*De(e){const{channel:t}=e.payload;yield(0,a.gz)(w());try{const e=yield(0,a.RE)(D.y3,t);yield(0,a.gz)($({channel:e}))}catch(e){yield(0,a.gz)(U(e))}}function*Me(e){for(;;)yield(0,a.RE)(De,e),yield(0,a.gw)(I.rH)}function*ve(e){try{const{payload:{channel:t,message:s}}=e;yield(0,a.RE)(D.$Z,t,s.raw),yield(0,a.gz)(oe({channelUrl:t.url,messageID:`${s.raw.messageId}`})),yield(0,a.rM)(R.Sx,{name:"delete_msg_success",properties:{msg_id:`${s.raw.messageId}`,offer_id:`${JSON.parse(t.data??"{}").offer_id}`,source:I.MC.has(s.raw.customType)?"text":"image"},type:"action"})}catch(e){yield(0,a.gz)(ae(e)),yield(0,a.gz)((0,E.LO)({snackbarID:"SENDBIRD_SENT_MESSAGE_DELETE_ERROR"}))}}function*Re(e){const{payload:{channel:t,message:s,offer:r}}=e;yield(0,a.gz)(x({channelUrl:t.url,messageID:String(s.raw.messageId)})),yield(0,a.gz)(he({channel:t,messageText:s.raw.message??"",offer:r,skipModeration:!0}));const n=yield(0,a.Ys)(i.XM);if(n&&s.extension.blockReason?.code){const e=t.data?JSON.parse(t.data):null,r=e.buyer_id===n.id?"as_buyer":"as_seller";yield(0,a.gz)((0,g.Q0)({chat_mode:r,message_type:M.Ds[s.extension.blockReason.code],offer_id:e.offer_id}))}}function*Te(e){const{channelUrl:t,ctaAction:s,ctaFlowType:r,messageID:n,offerID:i}=e.payload;if("nav"===s.type){yield(0,a.RE)(R.Sx,{name:"chat_bot_cta_tapped",properties:{deeplink_url:s.details.url,flow_type:r,offer_id:i},type:"action"});let e=s.details.url;"carousell:"===new URL(s.details.url).protocol&&(e=(0,y.QW)(s.details.url)),yield(0,a.gz)((0,l.oT)(e))}else if("api"===s.type){yield(0,a.gz)(H({channelUrl:t,ctaAction:s,messageID:n}));try{yield(0,a.RE)(o.v_,"offer",{data:s.details,path:"/1.0/chat/action"}),yield(0,a.gz)(B({channelUrl:t,ctaAction:s,messageID:n}))}catch(e){yield(0,a.gz)((0,E.LO)({snackbarID:"SENDBIRD_MESSAGE_CTA_ERROR"})),yield(0,a.gz)(N({channelUrl:t,ctaAction:s,messageID:n}))}}}function*Oe(e){const{channel:t,message:s}=e,r=yield(0,a.Ys)(i.XM),n=yield(0,a.Ys)(l.Xt);if(!r||!n||!t.data)return;const o=`${JSON.parse(t.data).offer_id}`,d=yield(0,a.RE)(D.wv,t,s,`${r.id}`);if(null==d)return;let c=yield(0,a.Ys)(T.k0,{offerID:o});(c&&!d.extension.parsedData.refresh&&"system"!==d.extension.senderType||(c=yield(0,a.RE)(T.HB,(0,T.XL)({offerID:o})),c))&&((0,y.XB)(n.pathname)&&o!==(0,y.u0)(n.pathname)&&1===t.unreadMessageCount&&(yield(0,a.gz)((0,_.QQ)({adjustment:1}))),d.raw.createdAt>=new Date(c.latest_price_created).getTime()&&(yield(0,a.gz)((0,T.P)({channel:t,message:d,offerID:o}))),"other"===d.extension.senderType&&(yield(0,a.rM)(v.Z7,(0,v.Au)({message:d,offer:c}))),yield(0,a.gz)(Y({channel:t,message:d})))}function*Ce(e){const{channel:t,message:s}=e,r=yield(0,a.Ys)(i.XM);if(!r)return;const n=yield(0,a.RE)(D.wv,t,s,`${r.id}`);null!=n&&(yield(0,a.gz)(J({channel:t,message:n})))}function*be(e){const{channel:t,messageId:s}=e;(yield(0,a.Ys)(i.XM))&&(yield(0,a.gz)(V({channelUrl:t.url,messageId:s})))}function*Le(e){const{payload:{channelUrl:t,offerID:s,timeInfo:r}}=e,n=yield(0,a.Ys)(i.XM);if(!n)return null;yield(0,a.gz)(te({channelUrl:t}));try{let e={};const i=yield(0,a.Ys)(Ve,{channelUrl:t});if(r){const{fetchType:s,timestamp:n}=r;let i,o,d;switch(s){case"after":d=0,o=I.Pz,i=!1;break;case"before":d=I.Pz,o=0,i=!1;break;default:d=I.Pz,o=I.Pz,i=!0}e=yield(0,a.RE)(D.zf,t,{includeCurrentTimestamp:i,nextResultSize:o,prevResultSize:d,timestamp:n})}else{const s=!i?.firstMessageListLoaded;e=yield(0,a.RE)(D._U,t,s)}const{channel:o,messages:d}=e;let c,l,f=yield(0,a.$6)(d.map((e=>(0,a.RE)(D.wv,o,e,`${n.id}`))));if(f=f.filter((e=>null!=e)),r){const{fetchType:e}=r;"around"===e?l=c=d.length>=I.Pz:"before"===e?(l=d.length>=I.Pz,c=!!i?.shouldLoadMoreNext):(l=!!i?.shouldLoadMorePrev,c=d.length>=I.Pz)}else l=d.length===I.P0,c=!1;const u=yield(0,a.Ys)(T.k0,{offerID:s});if(u&&f.length>0){const e=f[f.length-1];c||"other"!==e.senderType||(yield(0,a.rM)(v.Z7,(0,v.Au)({message:e,offer:u})))}return yield(0,a.gz)(se({channel:o,messages:f,shouldLoadMoreNext:c,shouldLoadMorePrev:l,timeInfo:r})),f}catch(e){const i=yield(0,a.Ys)(Ve,{channelUrl:t}),o=yield(0,a.RE)(D.t3,`${n.id}`);return yield(0,a.rM)(R.Sx,{name:"sendbird_get_messages_error",properties:{attempt_no:i?i.messagesGetFailures+1:1,channel_url:t,code:e.code,method:r?"getMessagesByTimestamp":"getPreviousMessages",msgs_around_ts:r?JSON.stringify(r):"",offer_id:s,sendbird_connected:o},type:"action"}),yield(0,a.gz)(ee({channelUrl:t,err:e})),yield(0,a.gz)((0,E.LO)({snackbarID:"SENDBIRD_MESSAGES_GET_ERROR"})),null}}function*Pe(e){const{payload:{channel:t,failedMessageID:s,messageText:r,offer:n}}=e,o=yield(0,a.Ys)(i.XM);if(!o)return;const d=`${(t.data?JSON.parse(t.data):null).offer_id}`;yield(0,a.gz)(W({channelUrl:t.url,failedMessageID:s}));try{const e=yield(0,a.RE)(D.Dd,`${o.id}`,t,r,d);yield(0,a.rM)(h.XC,n,{responseType:"chat",source:"chat_screen"}),yield(0,a.gz)(j({channelUrl:t.url,message:e,pendingMessageID:s})),yield(0,a.gz)((0,T.P)({channel:t,message:e,offerID:d}))}catch(e){yield(0,a.gz)(q({channelUrl:t.url,pendingMessageID:s})),yield(0,a.gz)((0,E.LO)({snackbarID:"SENDBIRD_MESSAGE_SEND_ERROR"})),yield(0,a.rM)(R.Sx,{name:"chat_error",properties:{context:"send_text_msg",is_first_msg:!1,type:"error"},type:"action"})}}function*Ae(e,t){yield(0,a.gw)(I.vG),yield(0,a.gz)(K({channelUrl:e,message:t}))}function*Ue(){if(!(yield(0,a.Ys)(et)).length){const{blockedKeywordRegex:e}=yield(0,a.RE)(p.S,(0,u.oN)(),{});try{const t=e.map((e=>{const t=e.regexList.map((e=>new RegExp(e)));return{...e,regexList:t}}));yield(0,a.gz)(P(t))}catch(e){yield(0,a.gz)(A())}}}function*we(e){const{payload:{channel:t,messageText:s,offer:r,skipModeration:n=!1}}=e,o=yield(0,a.Ys)(i.XM);if(!o)return;const c=t.data?JSON.parse(t.data):null,l=`${c.offer_id}`,f=(0,D.SB)(`${o.id}`,o.profile.image_url,t.url,{customType:"MESSAGE",messageText:s}),u=yield(0,a.rM)(Ae,t.url,f),y=yield(0,a.Ys)((e=>(0,d.c6)(e,{experimentId:"ta-validate-chat-message"}))),p=yield(0,a.Ys)((e=>(0,d.c6)(e,{experimentId:"ta-2392-chat-moderation"})));try{if(!n&&y){yield(0,a.RE)(Ue);const e=yield(0,a.Ys)(et);let r=e;if(p){const t=["BLOCKED_KEYWORD_TYPE_MOBILE"];r=e.filter((e=>t.includes(e.type)))}for(let e=0;e<r.length;e++){const{message:n,regexList:i,type:d,showWarning:y,whitelistedWords:m}=r[e];for(let e=0;e<i.length;e++)if(i[e].test(s.toLowerCase())){if(!p&&"BLOCKED_KEYWORD_TYPE_LINK"===d&&(0,D.hG)(s.split(" "),i,m))continue;yield(0,a.al)(u),yield(0,a.gz)(X({blockedMessage:f,channelUrl:t.url,err:{code:d,message:n,showWarning:y}}));const e=c.buyer_id===o.id?"as_buyer":"as_seller";return void(yield(0,a.gz)((0,g.ou)({chat_mode:e,message_type:M.Ds[d],offer_id:l})))}}}const e=yield(0,a.RE)(D.Dd,`${o.id}`,t,s,l);yield(0,a.al)(u),yield(0,a.rM)(h.XC,r,{responseType:"chat",source:"chat_screen"});const i=yield(0,a.Ys)(Ve,{channelUrl:t.url});i?.shouldLoadMoreNext&&(yield(0,a.RE)(Le,me({channelUrl:t.url,offerID:l}))),yield(0,a.gz)(Z({channelUrl:t.url,message:e,pendingMessageID:`${f.raw.messageId}`})),yield(0,a.gz)((0,T.P)({channel:t,message:e,offerID:l}))}catch(e){yield(0,a.al)(u),yield(0,a.gz)(Q({channelUrl:t.url,err:e,pendingMessage:f})),yield(0,a.gz)((0,E.LO)({snackbarID:"SENDBIRD_MESSAGE_SEND_ERROR"})),yield(0,a.rM)(R.Sx,{name:"chat_error",properties:{context:"send_text_msg",is_first_msg:!1,type:"error"},type:"action"})}}function*$e(e,t){yield(0,a.gz)(z());const s=yield(0,a.RE)(D.X8,e,t);yield(0,a.Cs)(Be,s),yield(0,a.gz)(k())}function*Fe(e){const{payload:{userID:t}}=e;if(yield(0,a.RE)(D.t3,t))return!0;const s=yield(0,a.RE)(ke,!1);if(!s)return!1;try{yield(0,a.RE)($e,t,s)}catch(e){return I.WT===e.code||I.Cj===e.code?yield(0,a.RE)(ze,t):(yield(0,a.gz)(G(e)),yield(0,a.gz)((0,E.LO)({snackbarID:"SENDBIRD_INITIALIZE_ERROR"})),!1)}return!0}function*xe(e,t,s){const[r,n]=yield(0,a.$6)([(0,a.RE)(Fe,ge({userID:t})),(0,a.RE)(T.HB,(0,T.XL)({authUserId:t,offerID:e,options:{markAsRead:!0}}))]);if(!r||!n||!n.channel_url)return!1;const i=n.channel_url,o=yield(0,a.Ys)(Ve,{channelUrl:i});return!(!o?.firstMessageListLoaded||s)||null!=(yield(0,a.RE)(Le,me({channelUrl:i,offerID:e,timeInfo:s})))}function*Ge(e,t){const[s,r]=yield(0,a.$6)([(0,a.RE)(Fe,ge({userID:t})),(0,a.RE)((function*(){const t=yield(0,a.Ys)(m.JL,{journey:"listing",screenId:"screen_0"});if(t&&(t?.meta.default_value).id.toString()===e)return t.meta.default_value;const s=yield(0,a.RE)(m.ZV,Number(e));return null!=s&&null!=s.screens[0]&&"listing_details_screen"===s.screens[0].meta.screen_name?s.screens[0].meta.default_value:null}))]);if(!s||!r)return!1;if(r.offer)yield(0,a.gz)((0,l.oT)((0,y.xw)(`${r.offer.id}`)));else try{const{makeOfferType:t,uiRules:s,cart:n,is_checkout_flow_v2:i}=yield(0,a.RE)(T.D_,(0,T.p$)({listingID:e})),o={...(0,S.Wk)(r),...t?{make_offer_type:t}:null,...s?{ui_rules:s}:null,cart:n,is_checkout_flow_v2:i};yield(0,a.gz)((0,T.uo)({offerDraft:o}))}catch(e){return!1}return!0}function*ze(e){const t=yield(0,a.RE)(ke,!0);if(!t)return!1;try{yield(0,a.RE)($e,e,t)}catch(e){return yield(0,a.gz)(G(e)),!1}return!0}function*ke(e){yield(0,a.gz)(ce());try{const{data:t}=yield(0,a.RE)(o.U2,"api",{path:"/1.0/chat/token/",query:{...e?{refresh:"true"}:null}});return yield(0,a.gz)(le()),t.token}catch(e){return yield(0,a.gz)(de({message:"Failed to retrieve sendbird token",type:"SimpleError"})),yield(0,a.gz)((0,E.LO)({snackbarID:"SENDBIRD_INITIALIZE_ERROR"})),null}}function*Ne(e){const{channel:t}=e.payload;yield(0,a.RE)([t,t.startTyping]);const{endTyping:s,sendMessageRequest:r,startTyping:n}=yield(0,a.S3)({endTyping:(0,a.gw)(I.KD),sendMessageRequest:(0,a.qn)(he.type),startTyping:(0,a.RE)(He)});n?yield(0,a.RE)(Ne,e):(r||s)&&(yield(0,a.RE)([t,t.endTyping]))}function*He(){yield(0,a.gw)(I.Ww),yield(0,a.qn)(Se.type)}function*Be(e){for(;;)try{const t=yield(0,a.qn)(e);"MESSAGE_RECEIVE"===t.type?yield(0,a.rM)(Oe,t):"MESSAGE_UPDATE"===t.type?yield(0,a.rM)(Ce,t):"MESSAGE_DELETE"===t.type?yield(0,a.rM)(be,t):"TYPING_STATUS_UPDATE"===t.type?yield(0,a.gz)(fe({channel:t.channel})):"READ_RECEIPT_UPDATE"===t.type&&(yield(0,a.gz)(ne({channel:t.channel})))}catch(e){Sentry.captureMessage("Error listening to Sendbird events on sagaEventChannel")}}function*Ye(){let e;for(;;){const{refreshRequestAction:t}=yield(0,a.S3)({refreshRequestAction:(0,a.qn)(ue.type),refreshStopAction:(0,a.qn)(ye.type)});e&&(yield(0,a.al)(e)),t&&(e=yield(0,a.rM)(Me,t))}}function*qe(){yield(0,a.Fm)(ge.type,Fe)}function*We(){yield(0,a.ib)(pe.type,Te)}function*je(){yield(0,a.ib)(me.type,Le)}function*Qe(){yield(0,a.ib)(Ee.type,ve)}function*Ke(){yield(0,a.ib)(Ie.type,Re)}function*Ze(){yield(0,a.ib)(_e.type,Pe)}function*Xe(){yield(0,a.ib)(he.type,we)}function*Je(){for(;;){const e=yield(0,a.qn)(Se.type);yield(0,a.RE)(Ne,e)}}function Ve(e,t){return e.Sendbird.chats[t.channelUrl]}function et(e){return e.Sendbird.restrictedRegex}f.Z.register(M.q5,(function*(){yield(0,a.rM)(Ye),yield(0,a.rM)(Je),yield(0,a.rM)(qe),yield(0,a.rM)(Qe),yield(0,a.rM)(Ke),yield(0,a.rM)(We),yield(0,a.rM)(je),yield(0,a.rM)(Ze),yield(0,a.rM)(Xe)}));const tt=(0,n.P1)([Ve],(e=>{if(null==e)return;const t=e.messageIDs.slice().reverse().find(((t,s)=>{const r=e?e.messages[t]:void 0;return!!r&&r.extension.read&&"me"===r.extension.senderType})),s=[],r={urlToIndex:{},urls:[]};e.messageIDs.forEach((t=>{const n=e.messages[t];if(null!=n){s.push(n);const e=n.extension.image;e&&(r.urlToIndex[e.url]=r.urls.length,r.urls.push(e.url))}})),e.unsentMessageIDs.forEach((t=>{const n=e.unsentMessages[t];null!=n&&s.push(n);const a=n.extension.image;a&&(r.urlToIndex[a.url]=r.urls.length,r.urls.push(a.url))}));let n=null;return e.activeMessageID&&("sent"===e.activeMessageType?n=e.messages[e.activeMessageID]:"unsent"===e.activeMessageType&&(n=e.unsentMessages[e.activeMessageID])),{...e,activeMessage:n,images:r,lastReadMessageID:t,orderedMessages:s}}))},1071:(e,t,s)=>{s.d(t,{CH:()=>n,Ds:()=>d,Ew:()=>c,Wv:()=>a,Z$:()=>l,gi:()=>i,q5:()=>o,so:()=>r});let r=function(e){return e.generic="generic",e.off_platform_transaction="off_platform_transaction",e.phishing_risk="phishing_risk",e}({});var n={SYSTEM_MESSAGE:"SYSTEM_MESSAGE",SYSTEM_MESSAGE_CANCELLED_DISPUTE:"SYSTEM_MESSAGE_CANCELLED_DISPUTE",SYSTEM_MESSAGE_ESCALATED_DISPUTE:"SYSTEM_MESSAGE_ESCALATED_DISPUTE",SYSTEM_MESSAGE_NEW_DISPUTE:"SYSTEM_MESSAGE_NEW_DISPUTE",SYSTEM_MESSAGE_REVIEWED_DISPUTE:"SYSTEM_MESSAGE_REVIEWED_DISPUTE"},a={DEFAULT:"",ACCEPT_OFFER:"ACCEPT_OFFER",ACCEPT_QUOTE:"ACCEPT_QUOTE",CANCEL_OFFER:"CANCEL_OFFER",CANCEL_QUOTE:"CANCEL_QUOTE",DECLINE_OFFER:"DECLINE_OFFER",DECLINE_QUOTE:"DECLINE_QUOTE",DELETED:"DELETED",MAKE_OFFER:"MAKE_OFFER",MESSAGE:"MESSAGE",MESSAGE_CTA:"MESSAGE_CTA",PROPOSE_REFUND_RESOLUTION:"PROPOSE_REFUND_RESOLUTION",PROPOSE_EXCHANGE_RESOLUTION:"PROPOSE_EXCHANGE_RESOLUTION",RESOLUTION_ACCEPTED:"RESOLUTION_ACCEPTED",RESOLUTION_CANCELLED:"RESOLUTION_CANCELLED",RESOLUTION_DECLINED:"RESOLUTION_DECLINED",SEND_QUOTE:"SEND_QUOTE",BLOCKED:"BLOCKED"},i={chat_feedback_good:"chat_feedback_good",chat_feedback_bad:"chat_feedback_bad",check_insight:"check_insight",deeplink:"deeplink",delivery_detail:"delivery_detail",leave_feedback:"leave_feedback",order_detail:"order_detail",order_request:"order_request",price_drop_boost:"price_drop_boost",seller_boost_apply:"seller_boost_apply",seller_boost_not_available:"seller_boost_not_available",seller_boost_checkout_bumps:"seller_boost_checkout_bumps",confirmed_deal:"confirmed_deal",did_not_deal:"did_not_deal",dispute_detail:"dispute_detail"};const o="Sendbird",d={BLOCKED_KEYWORD_TYPE_EMAIL:"email",BLOCKED_KEYWORD_TYPE_LINK:"link",BLOCKED_KEYWORD_TYPE_MOBILE:"mobile",BLOCKED_KEYWORD_TYPE_UNKNOWN:"unknown"};function c(e){return"system"===e.extension.senderType}function l(e){return function(e){return"system"!==e.extension.senderType&&"IMAGE"!==e.raw.customType}(e)||function(e){return"IMAGE"===e.raw.customType}(e)}},870:(e,t,s)=>{s.d(t,{__:()=>Ee,KH:()=>De,HB:()=>Re,D_:()=>ze,TP:()=>Ce,SE:()=>be,wb:()=>Le,Jd:()=>Pe,uJ:()=>M,Mm:()=>R,Dg:()=>T,_D:()=>O,uo:()=>j,p$:()=>P,XL:()=>b,Jq:()=>L,Fv:()=>V,_R:()=>F,lm:()=>x,P:()=>G,lw:()=>z,l6:()=>k,zX:()=>v,BD:()=>U,e_:()=>C,G0:()=>w,RO:()=>$,k0:()=>nt,zR:()=>Ot,ez:()=>at,n2:()=>it,l:()=>ot,ou:()=>ut,lM:()=>yt,g1:()=>_t,uH:()=>St,S5:()=>Mt,GX:()=>ht});var r=s(6),n=s(67),a=s(4),i=s(16),o=s(421),d=s(11),c=s(5),l=s(15),f=s(7),u=s(17);const y="Offer";var g=s(1027),p=s(922),m=s(877),_=s(34),h=s(876),E=s(51),I=s(106),S=s(1974),D=s(105);const M=(0,r.PH)(`${y}/offerAcceptRequest`),v=(0,r.PH)(`${y}/offersArchiveRequest`),R=(0,r.PH)(`${y}/offerCancelRequest`),T=(0,r.PH)(`${y}/offerCreateRequest`),O=(0,r.PH)(`${y}/offerDeclineRequest`),C=(0,r.PH)(`${y}/offersDeleteRequest`),b=(0,r.PH)(`${y}/offerGetRequest`),L=(0,r.PH)(`${y}/offerLowballerConfigGetRequest`),P=(0,r.PH)(`${y}/offerGetMakeOfferTypeRequest`),A=(0,r.PH)(`${y}/offerLatestOrderGetRequest`),U=(0,r.PH)(`${y}/offersArchivedGetRequest`),w=(0,r.PH)(`${y}/offersForListingGetRequest`),$=(0,r.PH)(`${y}/offersGetRequest`),F=(0,r.PH)(`${y}/offerUnarchiveRequest`),x=(0,r.PH)(`${y}/offerUpdateRequest`),G=(0,r.PH)(`${y}/offerUpdateViaSendbirdDataRequest`),z=(0,r.PH)(`${y}/offerUserBlockRequest`),k=(0,r.PH)(`${y}/offerUserUnblockRequest`),N=(0,r.oM)({initialState:{archivedOfferIDs:void 0,archivedOffersPending:!1,archivedOffersShouldLoadMore:!1,listingOfferIDs:{},madeOfferIDs:void 0,madeOffersPending:!1,madeOffersShouldLoadMore:!1,offerIDs:void 0,offerLatestOrderGetPending:!1,offerPending:!1,offers:{},offersPending:!1,receivedOfferIDs:void 0,receivedOffersPending:!1,receivedOffersShouldLoadMore:!1,shouldLoadMore:!1,unreadOfferIDs:void 0,unreadOffersPending:!1,unreadOffersShouldLoadMore:!1},name:y,reducers:{offerAcceptSuccess(e,t){const{payload:{offerID:s}}=t;e.offers[s].state="A",H(e,s)},offerCancelSuccess(e,t){const{payload:{offerID:s}}=t;e.offers[s].state="C",H(e,s)},offerDeclineSuccess(e,t){const{payload:{offerID:s}}=t;e.offers[s].state="D",H(e,s)},offerDraftSaveToStore(e,t){const{payload:{offerDraft:s}}=t;e.offers[`${s.id}`]=s},offerDraftToLiveOffer(e,t){const{payload:{offerID:s}}=t;e.offerIDs=(0,m.wW)(e.offerIDs,s),delete e.offers[`${h.J9}`]},offerGetFailure(e,t){e.offerPending=!1},offerGetPending(e){e.offerPending=!0},offerGetSuccess(e,t){const{payload:{offer:s}}=t,r=e.offers[`${s.id}`];e.offerPending=!1,e.offers[`${s.id}`]=r?{...r,...s,product:{...r.product,...s.product},user:{...r.user,...s.user}}:s},offerLatestOrderGetFailure(e,t){e.offerLatestOrderGetPending=!1},offerLatestOrderGetPending(e){e.offerLatestOrderGetPending=!0},offerLatestOrderGetSuccess(e){e.offerLatestOrderGetPending=!1},offerLowballerConfigGetSuccess(e,t){e.lowballerConfig=t.payload.config},offerMarkAsRead(e,t){const{payload:{offerID:s}}=t;e.offers[s]&&(e.offers[s].unread_count=0),B(s,e.unreadOfferIDs)},offerUnarchiveSuccess(e,t){const{payload:{offerID:s}}=t;B(s,e.archivedOfferIDs),"made"===e.offers[s].offer_type&&(e.madeOfferIDs=(0,m.rU)(s,{offerIDs:e.madeOfferIDs,offers:e.offers,shouldLoadMore:e.madeOffersShouldLoadMore})),e.offerIDs=(0,m.rU)(s,{offerIDs:e.offerIDs,offers:e.offers,shouldLoadMore:e.shouldLoadMore}),e.offers[s].is_archived=!1,"received"===e.offers[s].offer_type&&(e.receivedOfferIDs=(0,m.rU)(s,{offerIDs:e.receivedOfferIDs,offers:e.offers,shouldLoadMore:e.receivedOffersShouldLoadMore}))},offerUpdateSuccess(e,t){const{payload:{offerID:s,price:r,priceFormatted:n}}=t;e.offers[s]&&(e.offers[s].chat_only=!1,e.offers[s].latest_price=r,e.offers[s].latest_price_formatted=n,e.offers[s].state="O")},offerUpdateViaSendbirdDataSuccess(e,t){const{payload:{channel:s,message:r,offerID:n}}=t,a=h.SA[r.raw.customType],i=new Date(r.raw.createdAt).toISOString();if("me"===r.extension.senderType||"other"===r.extension.senderType){const{currency_symbol:t,offer_amount:s}=r.extension.parsedData;t&&(e.offers[n].currency_symbol=t),s&&(e.offers[n].latest_price=`${s}`,e.offers[n].latest_price_formatted=(0,m.wx)(s))}e.offers[n].latest_price_created=i,e.offers[n].unread_count=s.unreadMessageCount,a?(e.offers[n].chat_only=!1,e.offers[n].state=a):r.extension.image?e.offers[n].latest_price_message=`<${h.vI}>`:"file"!==r.raw.messageType?"message"in r.raw&&(e.offers[n].latest_price_message=r.raw.message):e.offers[n].latest_price_message="",e.unreadOfferIDs=(0,m.wW)(e.unreadOfferIDs,n),H(e,n)},offerUserBlockSuccess(e,t){const{payload:{offerID:s}}=t;e.offers[s]&&e.offers[s].user&&(e.offers[s].user.blocked=!0)},offerUserUnblockSuccess(e,t){const{payload:{offerID:s}}=t;e.offers[s]&&e.offers[s].user&&(e.offers[s].user.blocked=!1)},offersArchiveSuccess(e,t){const{payload:{offerIDs:s}}=t;let r=e.archivedOfferIDs?e.archivedOfferIDs.slice():null;s.forEach((t=>{r=(0,m.rU)(t,{offerIDs:r,offers:e.offers,shouldLoadMore:e.archivedOffersShouldLoadMore}),e.offers[t]&&(e.offers[t].is_archived=!0)}));const n=new Set(s);e.archivedOfferIDs=r,e.madeOfferIDs=e.madeOfferIDs?e.madeOfferIDs.filter((e=>!n.has(e))):void 0,e.offerIDs=e.offerIDs?e.offerIDs.filter((e=>!n.has(e))):void 0,e.receivedOfferIDs=e.receivedOfferIDs?e.receivedOfferIDs.filter((e=>!n.has(e))):void 0,e.unreadOfferIDs=e.unreadOfferIDs?e.unreadOfferIDs.filter((e=>!n.has(e))):void 0},offersArchivedGetFailure(e,t){e.archivedOffersPending=!1},offersArchivedGetPending(e){e.archivedOffersPending=!0},offersArchivedGetSuccess(e,t){const{offers:s,shouldLoadMore:r}=t.payload,n=s.map((e=>`${e.id}`));e.archivedOfferIDs=e.archivedOfferIDs?e.archivedOfferIDs.concat(n):n,e.archivedOffersPending=!1,e.archivedOffersShouldLoadMore=r,s.forEach((t=>{const s=e.offers[`${t.id}`];e.offers[`${t.id}`]=s?{...s,...t}:t}))},offersDeleteSuccess(e,t){const{payload:{offerIDs:s}}=t;s.forEach((t=>{const s=e.offers[t];if(null!=s){const r=`${s.product.id}`;e.listingOfferIDs[r]&&B(t,e.listingOfferIDs[r].offerIDs),delete e.offers[t]}}));const r=new Set(s);e.archivedOfferIDs=e.archivedOfferIDs?e.archivedOfferIDs.filter((e=>!r.has(e))):void 0,e.madeOfferIDs=e.madeOfferIDs?e.madeOfferIDs.filter((e=>!r.has(e))):void 0,e.offerIDs=e.offerIDs?e.offerIDs.filter((e=>!r.has(e))):void 0,e.receivedOfferIDs=e.receivedOfferIDs?e.receivedOfferIDs.filter((e=>!r.has(e))):void 0,e.unreadOfferIDs=e.unreadOfferIDs?e.unreadOfferIDs.filter((e=>!r.has(e))):void 0},offersForListingGetFailure(e,t){const{listingID:s}=t.payload;e.listingOfferIDs[s].pending=!1},offersForListingGetPending(e,t){const{listingID:s}=t.payload;null==e.listingOfferIDs[s]?e.listingOfferIDs[s]={offerIDs:[],pending:!0,shouldLoadMore:!1}:e.listingOfferIDs[s].pending=!0},offersForListingGetSuccess(e,t){const{listingID:s,offers:r,shouldLoadMore:n}=t.payload,a=e.listingOfferIDs[s];e.listingOfferIDs[s].offerIDs=a.offerIDs.concat(r.map((e=>`${e.id}`))),e.listingOfferIDs[s].pending=!1,e.listingOfferIDs[s].shouldLoadMore=n,r.forEach((t=>{const s=e.offers[`${t.id}`];e.offers[`${t.id}`]=s?{...s,...t}:t}))},offersGetFailure(e,t){const{payload:s}=t;switch(s.type){case"all":return void(e.offersPending=!1);case"made":return void(e.madeOffersPending=!1);case"received":return void(e.receivedOffersPending=!1);case"unread":return void(e.unreadOffersPending=!1);default:return}},offersGetPending(e,t){const{payload:s}=t;switch(s.type){case"all":return void(e.offersPending=!0);case"made":return void(e.madeOffersPending=!0);case"received":return void(e.receivedOffersPending=!0);case"unread":return void(e.unreadOffersPending=!0);default:return}},offersGetSuccess(e,t){const{offers:s,shouldLoadMore:r,type:n}=t.payload,a=[];switch(s.forEach((t=>{const s=e.offers[`${t.id}`];e.offers[`${t.id}`]=s?{...s,...t,product:{...s.product,...t.product},user:{...s.user,...t.user}}:t,a.push(`${t.id}`)})),n){case"all":return e.offerIDs=[...e.offerIDs||[],...a],e.offersPending=!1,void(e.shouldLoadMore=r);case"made":return e.madeOfferIDs=[...e.madeOfferIDs||[],...a],e.madeOffersPending=!1,void(e.madeOffersShouldLoadMore=r);case"received":return e.receivedOfferIDs=[...e.receivedOfferIDs||[],...a],e.receivedOffersPending=!1,void(e.receivedOffersShouldLoadMore=r);case"unread":return e.unreadOfferIDs=[...e.unreadOfferIDs||[],...a],e.unreadOffersPending=!1,void(e.unreadOffersShouldLoadMore=r);default:return e}}}});function H(e,t){"made"===e.offers[t].offer_type?e.madeOfferIDs=(0,m.wW)(e.madeOfferIDs,t):"received"===e.offers[t].offer_type&&(e.receivedOfferIDs=(0,m.wW)(e.receivedOfferIDs,t)),B(t,e.archivedOfferIDs),e.offerIDs=(0,m.wW)(e.offerIDs,t)}function B(e,t){const s=t?.indexOf(e);void 0!==s&&-1!==s&&t?.splice(s,1)}const{offerAcceptSuccess:Y,offerCancelSuccess:q,offerDeclineSuccess:W,offerDraftSaveToStore:j,offerDraftToLiveOffer:Q,offerGetFailure:K,offerGetPending:Z,offerGetSuccess:X,offerLowballerConfigGetSuccess:J,offerMarkAsRead:V,offerUnarchiveSuccess:ee,offerUpdateSuccess:te,offerUpdateViaSendbirdDataSuccess:se,offerUserBlockSuccess:re,offerUserUnblockSuccess:ne,offersArchiveSuccess:ae,offersArchivedGetFailure:ie,offersArchivedGetPending:oe,offersArchivedGetSuccess:de,offersDeleteSuccess:ce,offersForListingGetFailure:le,offersForListingGetPending:fe,offersForListingGetSuccess:ue,offersGetFailure:ye,offersGetPending:ge,offersGetSuccess:pe,offerLatestOrderGetFailure:me,offerLatestOrderGetPending:_e,offerLatestOrderGetSuccess:he}=N.actions;function*Ee(e){const{payload:{offerID:t}}=e;try{yield(0,a.RE)(d.v_,"api-offer",{path:`/2.5/offer/${t}/accept/`}),yield(0,a.rM)(S.W,`${t}`),yield(0,a.gz)(Y({offerID:t}))}catch(e){yield(0,a.gz)((0,D.LO)({snackbarID:"OFFER_ACCEPT_ERROR"})),yield(0,a.rM)(g.Sx,{name:"chat_error",properties:{context:"accept_offer",type:"error"},type:"action"})}}function*Ie(e){let t=[];"offer_list"===e.payload.type?t=e.payload.offerIDs:"offer_detail"===e.payload.type&&(t=[e.payload.offerID]);try{if(yield(0,a.RE)(d.v_,"api-offer",{data:{offer_ids:t.join(",")},path:"/2.1/me/offers/archive/",useForm:!0}),yield(0,a.gz)(ae({offerIDs:t})),yield(0,a.gz)((0,D.LO)({snackbarID:"OFFERS_ARCHIVE_SUCCESS"})),"offer_list"===e.payload.type&&e.payload.options){const{options:s}=e.payload;if(s.loadNextOffers){const{latestPriceCreated:e,offersType:r}=s.loadNextOffers;yield(0,a.rM)(Ae,r,e,{count:t.length})}}}catch(t){"offer_detail"===e.payload.type?yield(0,a.gz)((0,D.LO)({snackbarID:"OFFER_ARCHIVE_ERROR"})):"offer_list"===e.payload.type&&(yield(0,a.gz)((0,D.LO)({snackbarID:"OFFERS_ARCHIVE_ERROR"})))}}function*Se(e){const{payload:{offerID:t}}=e;try{yield(0,a.RE)(d.v_,"api-offer",{path:`/2.1/offer/${t}/cancel/`}),yield(0,a.rM)(S.NC,t),yield(0,a.gz)(q({offerID:t}))}catch(e){yield(0,a.gz)((0,D.LO)({snackbarID:"OFFER_CANCEL_ERROR"})),yield(0,a.rM)(g.Sx,{name:"chat_error",properties:{context:"cancel_offer",type:"error"},type:"action"})}}function*De(e){const{type:t,listingID:s,...r}=e.payload;try{let n;if("inbox_image"===e.payload.type){const t={is_chat:!0};n=(yield(0,a.RE)(d.v_,"chat-image",{data:t,files:[{content:e.payload.file,fieldName:"image"}],path:`/2.1/product/${s}/offer/`,useForm:!0})).data.offer_id}else{const e={...r,is_chat:"inbox_message"===t};n=(yield(0,a.RE)(d.v_,"api-offer",{data:e,path:`/2.1/product/${s}/offer/`,useForm:!0})).data.offer_id}["inbox_image","inbox_message","inbox_offer_price"].includes(t)&&(yield(0,a.rM)(Te,n));const c=yield(0,a.Ys)(i.XM),l=yield(0,a.Ys)(I.MO,{listingID:parseInt(s,10)}),f=l?.collection?`${l.collection.cc_id}`:void 0;if("listing_offer_price"===e.payload.type||"inbox_offer_price"===e.payload.type){const t=e.payload.price;yield(0,a.rM)(g.Sx,{name:"offer_submitted",properties:{offer_amount:t,offer_id:`${n}`,product_id:`${s}`},type:"action"}),yield(0,a.rM)(g.Sx,{name:"response_sent",properties:{cc_id:f||"",offer_amount:t,offer_id:`${n}`,product_id:s,response_type:"offer",source:"listing_offer_price"===e.payload.type?"listing_screen":"chat_screen"},type:"action"}),yield(0,a.rM)(S.J7,l,`${c?c.id:""}`,n)}return yield(0,a.rM)(S.Ec,l,`${c?c.id:""}`,n),"inbox_message"!==e.payload.type&&"inbox_image"!==e.payload.type||(yield(0,a.rM)(g.Sx,{name:"response_sent",properties:{...f?{cc_id:f}:null,..."inbox_image"===e.payload.type?{num_image:"1",response_type:"chat_image"}:{response_type:"chat"},chat_mode:"as_buyer",offer_id:`${n}`,other_user_id:`${l?l.seller.id:""}`,product_id:`${l?l.id:""}`,source:"chat_screen"},type:"action"})),yield(0,a.gz)((0,o.dJ)()),n}catch(t){return yield(0,a.gz)((0,D.LO)({snackbarID:"OFFER_CREATE_ERROR"})),"listing_offer_price"===e.payload.type||"inbox_offer_price"===e.payload.type?yield(0,a.rM)(g.Sx,{name:"chat_error",properties:{context:"make_offer",is_first_msg:!0,type:"error"},type:"action"}):"inbox_message"===e.payload.type?yield(0,a.rM)(g.Sx,{name:"chat_error",properties:{context:"send_text_msg",is_first_msg:!0,type:"error"},type:"action"}):"inbox_image"===e.payload.type&&(yield(0,a.rM)(g.Sx,{name:"chat_error",properties:{context:"send_image",is_first_msg:!0,type:"error"},type:"action"})),null}}function*Me(e){const{payload:{offerID:t}}=e;try{yield(0,a.RE)(d.v_,"api-offer",{path:`/2.1/offer/${t}/decline/`}),yield(0,a.rM)(S.rL,`${t}`),yield(0,a.gz)(W({offerID:t}))}catch(e){yield(0,a.gz)((0,D.LO)({snackbarID:"OFFER_DECLINE_ERROR"})),yield(0,a.rM)(g.Sx,{name:"chat_error",properties:{context:"decline_offer",type:"error"},type:"action"})}}function*ve(e){let t=[];"offer_list"===e.payload.type?t=e.payload.offerIDs:"offer_detail"===e.payload.type&&(t=[e.payload.offerID]);try{if(yield(0,a.RE)(d.v_,"api-offer",{data:{offer_ids:t.join(",")},path:"/2.1/me/offers/delete/",useForm:!0}),yield(0,a.gz)(ce({offerIDs:t})),yield(0,a.gz)((0,D.LO)({snackbarID:"OFFERS_DELETE_SUCCESS"})),"offer_list"===e.payload.type&&e.payload.options){const{options:s}=e.payload;if(s.loadNextOffers){const{latestPriceCreated:e,offersType:r}=s.loadNextOffers;yield(0,a.rM)(Ae,r,e,{count:t.length})}}}catch(t){"offer_detail"===e.payload.type?yield(0,a.gz)((0,D.LO)({snackbarID:"OFFER_DELETE_ERROR"})):"offer_list"===e.payload.type&&(yield(0,a.gz)((0,D.LO)({snackbarID:"OFFERS_DELETE_ERROR"})))}}function*Re(e){const{payload:{offerID:t,options:s={markAsRead:!1},authUserId:r}}=e;yield(0,a.gz)(Z());try{if(t===`${h.J9}`)throw Sentry.captureMessage("executeOfferGet was called with a draft offer ID"),new Error("Invalid offer ID");const{data:e}=yield(0,a.RE)(d.U2,"api-offer",{path:`/2.7/offer/${t}/`,query:{fetch_dispute:1,...s.markAsRead?{mark_as_read:"true"}:null}}),n="made"===e.offer_type?r??"":String(e.user.id),i=yield(0,a.RE)(ke,A({buyerId:n,listingId:String(e.product.id),offerProduct:e.product}));if(i){const t={description:i.state_description,id:i.id,state_type:i.state_type};Object.assign(e,{order:t})}return yield(0,a.gz)(X({offer:e})),s.markAsRead&&(yield(0,a.rM)(S.f5,t)),e}catch(e){return yield(0,a.gz)(K({err:e})),yield(0,a.gz)((0,D.LO)({snackbarID:"OFFER_GET_ERROR"})),null}}function*Te(e){const t=yield(0,a.RE)(Re,b({offerID:e}));t?.channel_url&&(yield(0,a.RE)(p.BG,(0,p.xB)({channelUrl:t.channel_url,offerID:e})),yield(0,a.gz)(Q({offerID:e})),yield(0,a.gz)((0,l.sb)((0,u.xw)(e))))}function*Oe(e){const{payload:{offerID:t}}=e;try{yield(0,a.RE)(d.v_,"api-offer",{data:{offer_ids:t},path:"/2.1/me/offers/unarchive/",useForm:!0}),yield(0,a.gz)(ee({offerID:t}))}catch(e){yield(0,a.gz)((0,D.LO)({snackbarID:"OFFER_UNARCHIVE_ERROR"}))}}function*Ce(e){const{payload:{offerID:t,offerPrice:s,source:r}}=e;try{const{data:e}=yield(0,a.RE)(d.gz,"api-offer",{data:{price:s},path:`/2.1/offer/${t}/`,useForm:!0});yield(0,a.rM)(S.Bm,`${t}`,s,r),yield(0,a.gz)(te({offerID:`${t}`,price:e.price,priceFormatted:e.price_formatted}))}catch(e){yield(0,a.gz)((0,D.LO)({snackbarID:"OFFER_UPDATE_ERROR"})),yield(0,a.rM)(g.Sx,{name:"chat_error",properties:{context:"make_offer",is_first_msg:!1,type:"error"},type:"action"})}}function*be(e){const{payload:{latestPriceCreated:t,options:s={},type:r}}=e;yield(0,a.gz)(oe());const n=s.count?s.count:h.wV;try{const{data:e}=yield(0,a.RE)(d.U2,"api-offer",{path:"/2.7/me/archived-offers/",query:{count:n,latest_price_created:t,type:r}});return yield(0,a.gz)(de({offers:e,shouldLoadMore:e.length===n})),e}catch(e){return yield(0,a.gz)(ie({err:e})),yield(0,a.gz)((0,D.LO)({snackbarID:"OFFERS_GET_ERROR"})),null}}function*Le(e){const{payload:{latestPriceCreated:t,listingID:s,options:r={}}}=e;yield(0,a.gz)(fe({listingID:s}));const n=r.count?r.count:h.wV;try{const[e,r]=yield(0,a.$6)([(0,a.RE)(d.U2,"api-offer",{path:"/2.0/offers/",query:{count:n,latest_price_created:t,product_id:s}}),(0,a.RE)(I.Xu,Number(s))]);if(!r||!e.data)throw new Error("Failed to retrieve offers for listing");const i=(0,m.Lz)(e.data,r);return yield(0,a.gz)(ue({listingID:s,offers:i,shouldLoadMore:i.length===n})),i}catch(e){return yield(0,a.gz)(le({err:e,listingID:s})),null}}function*Pe(e){const{payload:{latestPriceCreated:t,options:s={},type:r}}=e;yield(0,a.gz)(ge({type:r}));const n=s.count?s.count:h.wV,i="unread"===r?"all":r;try{const{data:{offers:e}}=yield(0,a.RE)(d.U2,"offer",{path:"/1.0/me/",query:{count:n,is_unread:"unread"===r?"true":void 0,latest_price_created:t,type:i}}),s=yield(0,a.Ys)(mt);return e.forEach((e=>{const t=s[e.id];t?.order&&Object.assign(e,{order:t.order})})),yield(0,a.gz)(pe({offers:e,shouldLoadMore:e.length===n,type:r})),e}catch(e){return yield(0,a.gz)(ye({err:e,type:r})),yield(0,a.gz)((0,D.LO)({snackbarID:"OFFERS_GET_ERROR"})),null}}function*Ae(e,t,s={}){switch(e.type){case"inbox":yield(0,a.rM)(Pe,$({latestPriceCreated:t,options:s,type:"all"}));break;case"made":yield(0,a.rM)(Pe,$({latestPriceCreated:t,options:s,type:"made"}));break;case"received":yield(0,a.rM)(Pe,$({latestPriceCreated:t,options:s,type:"received"}));break;case"archived":yield(0,a.rM)(be,U({latestPriceCreated:t,options:s,type:"all"}));break;case"listing":yield(0,a.rM)(Le,w({latestPriceCreated:t,listingID:e.listingID,options:s}));break;case"unread":yield(0,a.rM)(Pe,$({latestPriceCreated:t,options:s,type:"unread"}))}}function*Ue(e){const{payload:{offerID:t,userID:s}}=e;try{yield(0,a.RE)(d.v_,"api-offer",{path:`/2.0/user/${s}/block/`}),yield(0,a.gz)(re({offerID:t}))}catch(e){yield(0,a.gz)((0,D.LO)({snackbarID:"OFFER_USER_BLOCK_ERROR"}))}}function*we(e){const{payload:{offerID:t,userID:s}}=e;try{yield(0,a.RE)(d.v_,"api-offer",{path:`/2.0/user/${s}/unblock/`}),yield(0,a.gz)(ne({offerID:t}))}catch(e){yield(0,a.gz)((0,D.LO)({snackbarID:"OFFER_USER_UNBLOCK_ERROR"}))}}function*$e(e){const{payload:{channel:t,message:s,offerID:r}}=e;try{h.R7.includes(s.raw.customType)&&(yield(0,a.RE)(Re,b({offerID:r}))),yield(0,a.gz)(se({channel:t,message:s,offerID:r}))}catch(e){}}function*Fe(){try{const e="development"!==_.$.runtimeEnv?"client-config/low_ballers_config.json":"client-config/test/low_ballers_config.json",{data:t}=yield(0,a.RE)(d.U2,"storage",{path:`/${e}`});return yield(0,a.gz)(J({config:t})),t}catch(e){}}let xe;function*Ge(){const e=yield(0,a.Ys)(at);if(null==e){null==xe&&(xe=yield(0,a.rM)(Fe));const e=yield(0,a.v_)(xe);return xe=null,e}return e}function*ze(e){const{payload:{listingID:t}}=e,{data:{make_offer_type:s,ui_rules:r,cart:n,is_checkout_flow_v2:i}}=yield(0,a.RE)(d.U2,"offer",{path:"/1.0/config/",query:{listing_id:t}});return{cart:n,is_checkout_flow_v2:i,makeOfferType:s,uiRules:r}}function*ke(e){yield(0,a.gz)(_e());try{const{payload:{buyerId:t,listingId:s,offerProduct:r}}=e,{caroupay:n,shipping_tw_711:i,deal_options:o}=r?.smart_attributes??{};let c=!1;if(r?.smart_attributes){const e=o?.toLocaleLowerCase().split(",")??[];c=[n,i].includes("true")||e.some((e=>"caroupay"===e||"shipping_tw_711"===e))}if(t&&s&&c){const{data:{order:e}}=yield(0,a.RE)(d.U2,"order",{path:"/2.0/order/latest/",query:{buyer_id:t,listing_id:s}});return yield(0,a.gz)(he()),e}throw new Error("Data offer: failed fetching getLatestOrderV2")}catch(e){yield(0,a.gz)(me({err:e}))}}function*Ne(){for(;;)yield(0,a.qn)(L.type),yield(0,a.RE)(Ge)}function*He(){yield(0,a.Fm)(M.type,Ee)}function*Be(){yield(0,a.Fm)(v.type,Ie)}function*Ye(){yield(0,a.Fm)(R.type,Se)}function*qe(){yield(0,a.Fm)(T.type,De)}function*We(){yield(0,a.Fm)(O.type,Me)}function*je(){yield(0,a.Fm)(C.type,ve)}function*Qe(){yield(0,a.Fm)(b.type,Re)}function*Ke(){yield(0,a.Fm)(U.type,be)}function*Ze(){yield(0,a.Fm)(w.type,Le)}function*Xe(){yield(0,a.Fm)($.type,Pe)}function*Je(){yield(0,a.Fm)(F.type,Oe)}function*Ve(){yield(0,a.Fm)(x.type,Ce)}function*et(){yield(0,a.Fm)(z.type,Ue)}function*tt(){yield(0,a.Fm)(k.type,we)}function*st(){yield(0,a.Fm)(G.type,$e)}function rt(e,t){if(null!=t)return t.reduce(((t,s)=>(e[s]&&t.push(e[s]),t)),[])}function nt(e,t){const{offerID:s}=t;return e[y].offers[s]}function at(e){return e[y].lowballerConfig}function it(e){return e[y].offerPending}N.reducer,c.Z.register(y,N.reducer),f.Z.register(y,(function*(){yield(0,a.rM)(Ne),yield(0,a.rM)(He),yield(0,a.rM)(Be),yield(0,a.rM)(Ye),yield(0,a.rM)(qe),yield(0,a.rM)(We),yield(0,a.rM)(je),yield(0,a.rM)(Qe),yield(0,a.rM)(Ke),yield(0,a.rM)(Ze),yield(0,a.rM)(Xe),yield(0,a.rM)(Je),yield(0,a.rM)(Ve),yield(0,a.rM)(et),yield(0,a.rM)(tt),yield(0,a.rM)(st)}));const ot=(0,n.P1)([mt,function(e){return e[y].archivedOfferIDs}],rt);function dt(e){return e[y].archivedOffersPending}function ct(e){return e[y].archivedOffersShouldLoadMore}function lt(e,t){return null!=e[y].listingOfferIDs[t.listingID]&&e[y].listingOfferIDs[t.listingID].pending}function ft(e,t){return null!=e[y].listingOfferIDs[t.listingID]&&e[y].listingOfferIDs[t.listingID].shouldLoadMore}const ut=(0,n.P1)([mt,function(e,t){if(null!=e[y].listingOfferIDs[t.listingID])return e[y].listingOfferIDs[t.listingID].offerIDs}],rt),yt=(0,n.P1)([mt,function(e){return e[y].madeOfferIDs}],rt);function gt(e){return e[y].madeOffersPending}function pt(e){return e[y].madeOffersShouldLoadMore}function mt(e){return e[y].offers}const _t=(0,n.P1)([mt,function(e){return e[y].offerIDs}],rt),ht=(0,n.P1)([mt,function(e){return e[y].unreadOfferIDs}],rt);function Et(e){return e[y].unreadOffersPending}function It(e){return e[y].unreadOffersShouldLoadMore}function St(e,t){switch(t.offersType.type){case"archived":{const t=ot(e);return{offerIDToIndex:(0,m.j_)(t),offers:t,offersPending:dt(e),shouldLoadMore:ct(e)}}case"listing":{const{listingID:s}=t.offersType,r=ut(e,{listingID:s});return{offerIDToIndex:(0,m.j_)(r),offers:r,offersPending:lt(e,{listingID:s}),shouldLoadMore:ft(e,{listingID:s})}}case"made":{const t=yt(e);return{offerIDToIndex:(0,m.j_)(t),offers:t,offersPending:gt(e),shouldLoadMore:pt(e)}}case"received":{const t=Mt(e);return{offerIDToIndex:(0,m.j_)(t),offers:t,offersPending:vt(e),shouldLoadMore:Rt(e)}}case"inbox":{const t=_t(e);return{offerIDToIndex:(0,m.j_)(t),offers:t,offersPending:Dt(e),shouldLoadMore:Tt(e)}}case"unread":{const t=ht(e);return{offerIDToIndex:(0,m.j_)(t),offers:t,offersPending:Et(e),shouldLoadMore:It(e)}}default:return{offerIDToIndex:{},offers:null,offersPending:null,shouldLoadMore:null}}}function Dt(e){return e[y].offersPending}const Mt=(0,n.P1)([mt,function(e){return e[y].receivedOfferIDs}],rt);function vt(e){return e[y].receivedOffersPending}function Rt(e){return e[y].receivedOffersShouldLoadMore}function Tt(e){return e[y].shouldLoadMore}function Ot(e,t){const{offerID:s}=t;if(!s)return!1;const r=nt(e,{offerID:s});if(!r)return!1;const n=!(s===`${h.J9}`||!r.product.smart_attributes||"true"!==r.product.smart_attributes.caroupay),a=(0,E.mz)(e),i=n||!!a,o=(0,m.lZ)(r),d="made"===r.offer_type;return i&&["awaiting","accepted","pending"].includes(o??"")&&d}},2460:(e,t,s)=>{s.d(t,{L2:()=>c,LC:()=>d,Rr:()=>o,sw:()=>l});var r=s(1329),n=s.n(r),a=s(1127),i=s(988);async function o(e,t,s){return(await Promise.all(e.map((async e=>{const r=await(0,i.I4)(e.dataUrl);return(0,a.SB)(`${s.id}`,s.profile.image_url,t.url,{customType:"IMAGE",dataUrl:e.dataUrl,dimensions:r})})))).reduce(((e,t)=>(e[`${t.raw.messageId}`]=t,e)),{})}function d(e,t){return Object.keys(e).reduce(((s,r,n)=>(s[t[n]]=e[r],s)),{})}function c(e,t){switch(e){case"MESSAGE":return"made"===t?"S":"B";case"ACCEPT_OFFER":return"A";case"CANCEL_OFFER":return"C";case"DECLINE_OFFER":return"D";case"MAKE_OFFER":return"O";default:return null}}async function l(e,t){const s=await function(e){const t=new FileReader;return new Promise(((s,r)=>{t.onload=()=>{const e=t.result;s(e)},t.onerror=()=>{r(new Error("Error parsing blob"))},t.readAsArrayBuffer(e)}))}(e);return{contentMd5:n().base64(s),contentType:e.type,fileSize:e.size,filename:`image_${t}.${e.type.split("/")[1]}`}}},877:(e,t,s)=>{s.d(t,{$g:()=>I,D2:()=>m,DI:()=>o,F3:()=>f,Lz:()=>l,Wk:()=>c,Zn:()=>S,dJ:()=>g,j_:()=>E,lZ:()=>h,mc:()=>y,qD:()=>D,rU:()=>p,v1:()=>_,wW:()=>d,wx:()=>u});var r=s(779),n=s(17),a=s(876),i=s(792);function o(e,t,s){const{price:r}=t,{exclude_product:n,enabled_countries:a,min_offer_percentage:i}=e,o=t.marketplace.country.code,d=t.collection?`${t.collection.id}`:void 0,c=new RegExp(n.price_regex);return!(n.price_lte.some((e=>e.countries.indexOf(o)>=0&&e.price>=parseFloat(r)))||!a.includes(o)||d&&n.categories?.includes(d)||c.test(r))&&(parseFloat(s)||0)<(parseFloat(r)||0)*i}function d(e,t){if(e)return-1===e.indexOf(t)?[t,...e]:[t,...e.filter((e=>e!==t))]}function c(e){return{channel_url:null,chat_only:!0,currency_symbol:e.currency_symbol,feedback_blackout_window_expires_at:null,has_accepted_offer:!1,has_both_reviewed:!1,id:a.J9,is_product_sold:!1,latest_price:"",latest_price_created:"",latest_price_formatted:"",latest_price_message:"",make_offer_type:"normal",offer_type:"made",order:null,product:{collection:e.collection?{cc_id:e.collection.cc_id,id:e.collection.id}:void 0,id:e.id,listing_url:e?.listing_url,marketplace:{country:{code:e.marketplace.country.code,id:e.marketplace.country.id,name:e.marketplace.country.name},id:e.marketplace.id,name:e.marketplace.name},original_price_formatted:e.original_price_formatted,price:e.price,price_formatted:e.price_formatted,primary_photo_url:e.photos.length>0?e.photos[0].image_url:"",smart_attributes:{fixed_price:e.smart_attributes?.fixed_price},status:e.status,title:e.title},state:"O",unread_count:0,user:{id:e.seller.id,is_suspended:!1,profile:{image_url:e.seller.profile.image_url,is_email_verified:!1,is_id_verified:!1,is_mobile_verified:!1},username:e.seller.username}}}function l(e,t){const s=function(e){return{collection:e.collection?{cc_id:e.collection.cc_id,id:e.collection.id}:void 0,id:e.id,marketplace:{country:{code:e.marketplace.country.code,id:e.marketplace.country.id,name:e.marketplace.country.name},id:e.marketplace.id,name:e.marketplace.name},price:e.price,price_formatted:e.price_formatted,primary_photo_url:e.photos.length>0?e.photos[0].image_url:"",status:e.status,title:e.title}}(t),r=[];return e.forEach((e=>{r.push({channel_url:e.channel_url,chat_limit_status:e.chat_limit_status,chat_only:e.chat_only,currency_symbol:e.currency_symbol,feedback_blackout_window_expires_at:void 0,has_accepted_offer:e.has_accepted_offer,has_both_reviewed:void 0,id:e.id,is_product_sold:e.is_product_sold,latest_price:e.latest_price,latest_price_created:e.latest_price_created,latest_price_formatted:e.latest_price_formatted,latest_price_message:e.latest_price_message,make_offer_type:e.make_offer_type,offer_type:e.offer_type,order:null,product:s,state:e.state,unread_count:void 0,user:e.buyer})})),r}function f(e){const t=[];return e.forEach((e=>{t.push({channel_url:e.channelUrl,chat_only:e.chatOnly,currency_symbol:e.currencySymbol,dispute:{latest_status:e.dispute?.latestStatus},id:e.legacyId,latest_price:String(e.latestPrice),latest_price_created:(0,r.z1)(e.latestMessageCreated),latest_price_formatted:e.latestPriceFormatted,latest_price_message:e.latestMessage,make_offer_type:e.makeOfferType,offer_type:e.offerType,order:{description:e.order?.stateDescription??"",state_type:e.order?.stateType??i.eZ.INITIAL},product:{primary_photo_url:e.listing.imageThumbnailUrl,status:e.listing.status,title:e.listing.title},state:e.state,unread_count:e.unreadCount,user:{id:e.user.id,is_suspended:e.user.isSuspended,profile:{image_url:e.user.imageThumbnailUrl,is_email_verified:e.user.isEmailVerified,is_id_verified:e.user.isIdVerified,is_mobile_verified:e.user.isMobileVerified},username:e.user.username}})})),t}function u(e){const[t,s]=e.toFixed(2).split(".");let r="",n=Number(t);for(;n>=1e3;){let e=`${Math.floor(n%1e3)}`;1===e.length?e=`00${e}`:2===e.length&&(e=`0${e}`),r=`,${e}${r}`,n=Math.floor(n/1e3)}return r=`${n}${r}`,`${r}${null==s||"00"===s?"":`.${s[0]?s[0]:0}${s[1]?s[1]:0}`}`}function y(e){return null!=e&&e.length>0?e[e.length-1].latest_price_created:(new Date).toISOString()}function g(e){return"archived"===e.type?"archived":"made"===e.type?"buying":"received"===e.type?"selling":"unread"===e.type?"unread":"all"}function p(e,t){const{offerIDs:s,offers:r,shouldLoadMore:n}=t;if(null==s)return s;if(0===s.length)return[e];const a=s.slice();return!n||r[e].latest_price_created>r[s[s.length-1]].latest_price_created?(a.push(e),a.sort(((e,t)=>new Date(r[t].latest_price_created).getTime()-new Date(r[e].latest_price_created).getTime()))):a}function m(e){return e.is_email_verified&&e.is_id_verified&&e.is_mobile_verified}function _(e){const t=e.product,s=t.smart_attributes;return!!(t&&"0"===t.price_formatted&&s&&s.is_free&&"true"===s.is_free)}function h(e){return"A"===e.state?"accepted":e.chat_only||["D","C"].includes(e.state)?"awaiting":"O"!==e.state&&"OS"!==e.state||e.chat_only?null:"pending"}function E(e){const t={};return e&&e.forEach(((e,s)=>{t[`${e.id}`]=s})),t}function I(e){return e.product.listing_url?(0,n.QW)(e.product.listing_url):(0,n.Wm)(e.product.title,e.product.id)}const S=e=>a.$F[e],D=e=>e.latest_price&&Number(e.latest_price)?Number(e.latest_price).toFixed(2):Number(e.product.price).toFixed(2)},1127:(e,t,s)=>{s.d(t,{$Z:()=>c,Dd:()=>I,Eo:()=>E,FE:()=>y,SB:()=>d,T0:()=>S,Wk:()=>g,X8:()=>p,_U:()=>f,hG:()=>D,t3:()=>m,wv:()=>_,y3:()=>h,zf:()=>u});var r=s(81),n=s(991),a=s(34),i=s(988);const o=function(){let e;const t={},r={};return{createQueryManager(e,s){t[e.url]=e.createPreviousMessageListQuery(s)},getQueryManager:e=>t[e],getSendbirdInstance:()=>new Promise((t=>{e?t(e):Promise.all([s.e(261),s.e(270)]).then(s.bind(s,2258)).then((({default:r,SendbirdChatOptions:i})=>{Promise.all([s.e(261),s.e(271)]).then(s.bind(s,1653)).then((({GroupChannelModule:s})=>{const o={appId:a.$.sendbird.app_id,modules:[new s],options:new i({websocketResponseTimeout:n.w9})};e=r.init(o),t(e)}))}))})),markChannelAsRead(e){!r[e.url]&&e.unreadMessageCount>0&&(r[e.url]=!0,e.markAsRead().then((()=>delete r[e.url])))}}}(),d=function(){let e=0;return function(t,s,r,n){return e+=1,"IMAGE"===n.customType?{extension:{image:{thumbnail:{url:n.dataUrl,...n.dimensions},url:n.dataUrl},parsedData:{},read:!1,sendStatus:"pending",senderType:"me"},raw:{channelUrl:r,createdAt:Date.now(),customType:"IMAGE",data:"",messageId:e,sender:{profileUrl:s,userId:t},url:n.dataUrl}}:{extension:{parsedData:{},read:!1,sendStatus:"pending",senderType:"me"},raw:{channelUrl:r,createdAt:Date.now(),customType:"MESSAGE",data:"",message:n.messageText,messageId:e,sender:{profileUrl:s,userId:t}}}}}();async function c(e,t){if("file"===t.messageType)await e.deleteMessage(t);else{if("user"!==t.messageType)throw"Failed to delete message. MessageType not match.";await e.deleteMessage(t)}}async function l(e){return(await o.getSendbirdInstance()).groupChannel.getChannel(e)}async function f(e,t){const s=await l(e);if(!o.getQueryManager(e)||t){const e={limit:n.P0,reverse:n.kg};o.createQueryManager(s,e)}return{channel:s,messages:await o.getQueryManager(e).load()}}async function u(e,t){const s=await l(e),{prevResultSize:r,nextResultSize:a,includeCurrentTimestamp:i,timestamp:o}=t,d={isInclusive:i,nextResultSize:a,prevResultSize:r,reverse:n.kg},c=await s.getMessagesByTimestamp(o,d);return{channel:s,messages:c}}function y(e,t,s){return 0===t.length?e:e.concat(t).sort(((e,t)=>s[e].raw.createdAt-s[t].raw.createdAt))}function g(e){const t={},s={};for(let r=0;r<e.length;r++){const n=e[r];t[`${n.raw.messageId}`]=n,s[n.raw.createdAt]=n}return{messagesMap:t,messagesTimestampMap:s}}async function p(e,t){const a=await o.getSendbirdInstance();await async function(e,t){return(await o.getSendbirdInstance()).connect(e,t)}(e,t);const i=new((await Promise.all([s.e(261),s.e(271)]).then(s.bind(s,1653))).GroupChannelHandler)({});return a.groupChannel.addGroupChannelHandler(n.Mg,i),async function(e){const t=await o.getSendbirdInstance();return(0,r.GG)((s=>(e.onMessageReceived=(e,t)=>{s({channel:e,message:t,type:"MESSAGE_RECEIVE"})},e.onMessageUpdated=(e,t)=>{s({channel:e,message:t,type:"MESSAGE_UPDATE"})},e.onMessageDeleted=(e,t)=>{s({channel:e,messageId:t.toString(),type:"MESSAGE_DELETE"})},e.onTypingStatusUpdated=e=>{s({channel:e,type:"TYPING_STATUS_UPDATE"})},e.onUnreadMemberStatusUpdated=e=>{s({channel:e,type:"READ_RECEIPT_UPDATE"})},t.groupChannel.removeAllGroupChannelHandlers)))}(i)}async function m(e){const t=await o.getSendbirdInstance();return"OPEN"===t.connectionState&&t.currentUser?.userId===e}async function _(e,t,s){if(!t.customType||!n.tF.has(t.customType))return Sentry.withScope((e=>{e.setExtra("messageId",`${t.messageId}`),Sentry.captureMessage("Received unknown message type")})),Promise.resolve(null);let r;try{r=JSON.parse(t.data??"")}catch(e){return Sentry.withScope((e=>{e.setExtra("messageId",`${t.messageId}`),e.setExtra("data",t.data??"undefined"),Sentry.captureMessage("Error parsing .data in Sendbird message")})),Promise.resolve(null)}const a={extension:{},raw:t};let o;if(a.extension.parsedData=r,a.extension.read=0===e.getUnreadMemberCount(t),r.offer_amount&&(r.offer_amount=parseFloat(r.offer_amount)),"url"in t&&["IMAGE","BLOCKED"].includes(t.customType)&&"file"===t.messageType?o=r.image_progressive_url||t.url:t.customType&&n.YT.has(t.customType)&&(o=r.image_progressive_url||r.url),o){const{thumbnail_height:e,thumbnail_url:t,thumbnail_width:s}=r;if(t&&s&&e)a.extension.image={thumbnail:{aspectRatio:parseFloat((s/e).toFixed(2)),height:e,url:t,width:s},url:o};else try{a.extension.image={thumbnail:{url:t||o,...await(0,i.I4)(t||o)},url:o}}catch(e){return Promise.resolve(null)}}if(a.extension.sendStatus="sent",n.t5.has(a.raw.customType)){const e=a;return r.content&&(r.content.cta=r.content.cta.map((e=>({...e,..."api"===e.action.type?{pending:!1}:null,type:e.action.type})))),e.raw.sender?.userId===s?e.extension.senderType="me":e.raw.sender?.userId!==s&&(e.extension.senderType="other"),Promise.resolve(e)}{const e=a;if(r.visibility&&("hidden"===r.visibility.status||!r.visibility.user_ids.includes(s)))return Promise.resolve(null);if(null!=r.ui_json)try{r.ui=JSON.parse(r.ui_json),r.ui.buttons&&(r.ui.buttons=r.ui.buttons.filter((e=>n.Dk.has(e.type))))}catch(e){Sentry.withScope((e=>{e.setExtra("messageId",`${t.messageId}`),e.setExtra("ui_json",r.ui_json),Sentry.captureMessage("Error parsing .ui_json in Sendbird message")}))}return e.extension.senderType="system",Promise.resolve(e)}}function h(e){return e.refresh()}function E(e){o.markChannelAsRead(e)}async function I(e,t,s,r){const n=await async function(e,t,s){const r={customType:"MESSAGE",data:JSON.stringify({offer_id:s,source:"web"}),message:t};return new Promise(((t,s)=>{e.sendUserMessage(r).onSucceeded((e=>{t(e)})).onFailed(((e,t)=>{s(e)}))}))}(t,s,r),a=await _(t,n,e);if(null==a)throw new Error("Invalid message");return a}function S(e,t){return e.members.find((e=>e.userId===t))}function D(e,t,s){const r=e.map((e=>e.toLowerCase())).filter((e=>t.find((t=>t.test(e)))));return!!r.length&&r.every((e=>s.map((e=>e.toLowerCase())).find((t=>e.includes(t)))))}}}]);
|
|
//# sourceMappingURL=https://mdev.llesuorac.com/872d9a325b1c9576132523bfac3e739f6f67875f/c7bc582a05486922.min.js.map
|
|
//# debugId=1650c8f0-b3c5-558e-aaef-bb36a6088d13
|