useSendContextToAgent",["Arbiter","BizAIWebAgentContextAwareFeatureV3Mutation","BizAIWebAgentTypes.flow","BizAIWebAgentUserContextInfoXDEvent","CometRelay","react","useBizAIAgentSendProactiveMessageTrigger","useBizAIWebAgentAppContext","useBizAIWebAgentLogger","useBizAIWebAgentSharedState"],(function(t,n,r,o,a,i,l){"use strict";var e,s=e||(e=o("react")),u=s.useEffect,c=s.useState;function d(e){var t=e.accessToken,n=e.conversationFBID,a=e.conversationToken,i=e.instanceID,l=e.pageID,s=e.threadMessagesConnectionID,d=c(!1),m=d[0],p=d[1],_=c(""),f=_[0],g=_[1],h=c(null),y=h[0],C=h[1],b=c(null),v=b[0],S=b[1],R=c(0),L=R[0],E=R[1],k=c(""),I=k[0],T=k[1],D=c(""),x=D[0],$=D[1],P=r("useBizAIWebAgentLogger")({url:I}),N=P.logFalcoEvent,M=o("CometRelay").useMutation(o("BizAIWebAgentContextAwareFeatureV3Mutation").BizAIWebAgentContextAwareFeatureV3Mutation),w=M[0],A=o("useBizAIWebAgentAppContext").useBizAIWebAgentAppContext(),F=A.pageType,O=A.setPageType,B=o("useBizAIWebAgentSharedState").useBizAIWebAgentSharedState(),W=B.state.expansionState;return u(function(){m||n==null||a==null||W!==o("BizAIWebAgentTypes.flow").PluginExpansionState.FULLY_EXPANDED||I===""||y==null&&v==null||s==null||(N({event:"send_shopify_product_info_to_llm",eventState:"attempt",logMessage:"Sending Shopify product INFO to LLM"}),w({onCompleted:function(){p(!0),N({event:"send_shopify_product_info_to_llm",eventState:"success",logMessage:"Successfully send Shopify product INFO to LLM"})},onError:function(t){N({errorMessage:t.message,errorStack:t.stack,event:"send_shopify_product_info_to_llm",eventState:"failure",logMessage:"Failed to send Shopify product info"})},variables:{connections:[s],input:{access_token:{sensitive_string_value:t},ai_chat_plugin_instance_id:i.toString(),context:{page_type:o("useBizAIAgentSendProactiveMessageTrigger").pageTypeToGql(F),product_name:f,shopify_product_id:y,shopify_product_variant_id:v,timestamp:Date.now(),url:I},conversation_id:n.toString(),conversation_token:{sensitive_string_value:a},feature_type:"PRODUCT_INFO",page_id:l.toString()}}}))},[a,n,i,l,w,F,m,N,f,y,v,I,W,t,s]),u(function(){var e=r("Arbiter").subscribe(o("BizAIWebAgentUserContextInfoXDEvent").bizAIWebAgentSendUserContextInfo.getReadFromIframeEventName(),function(e,t){var n,r,o,a;g((n=t.product_title)!=null?n:""),C(t.product_id),S(t.variant_id),E(Date.now()),T((r=t.url)!=null?r:""),$((o=t.previous_session_url)!=null?o:""),O((a=t.page_type)!=null?a:"unknown")});return function(){return r("Arbiter").unsubscribe(e)}},[O]),{previousSessionUrl:x,productName:f,shopifyProductID:y,shopifyProductVariantID:v,timestamp:L,url:I}}l.default=d}),98);
-----
useSendAddToCartEventToAgent",["BizAIWebAgentAddToCartContextXDEvent","BizAIWebAgentContextAwareFeatureV3Mutation","BizAIWebAgentUserContext.react","CometRelay","qpl","useBizAIAgentXDEventListener","useBizAIWebAgentLogger","useBizAIWebAgentRelayStoreUpdaters","uuidv4"],(function(t,n,r,o,a,i,l){"use strict";function e(e){var t=e.accessToken,n=e.conversationFBID,a=e.conversationToken,i=e.instanceID,l=e.pageID,s=e.pageUrl,u=e.threadMessagesConnectionID,c=o("BizAIWebAgentUserContext.react").useBizAIWebAgentUserContext(),d=c.url,m=r("useBizAIWebAgentLogger")({url:d}),p=m.logFalcoEvent,_=m.logQPLEndEvent,f=m.logQPLEndEventFailure,g=m.logQPLMarkerPoint,h=m.logQPLMarkerStartForJoin,y=o("CometRelay").useMutation(o("BizAIWebAgentContextAwareFeatureV3Mutation").BizAIWebAgentContextAwareFeatureV3Mutation),C=y[0],b=r("useBizAIWebAgentRelayStoreUpdaters")(),v=b.createMessageInThread;r("useBizAIAgentXDEventListener")(o("BizAIWebAgentAddToCartContextXDEvent").bizAIWebAgentAddToCartContextEvent,function(e){if(!(n==null||a==null||u==null||e.success===!1)){var o=e.join_id;p({event:"send_product_add_to_cart_event_to_agent",eventState:"attempt",logMessage:"Sending product ATC event to agent"}),h(r("qpl")._(318966159,"139"),o),g(r("qpl")._(318966159,"139"),"start_send_product_atc_event_to_agent"),C({onCompleted:function(t){var e,n;p({event:"send_product_add_to_cart_event_to_agent",eventState:"success",logMessage:"Successfully sent product ATC event to agent"}),g(r("qpl")._(318966159,"139"),"send_product_atc_event_to_agent_mutation_complete");var o=(e=t.xfb_biz_ai_web_agent_context_aware_feature)==null||(e=e.proactive_agent_response)==null?void 0:e.static_response,a=(n=t.xfb_biz_ai_web_agent_context_aware_feature)==null||(n=n.proactive_agent_response)==null?void 0:n.static_response_composed_text;a!=null&&a.length>0&&(v({composedText:a,messageID:r("uuidv4")(),state:"OVERALL_DONE",text:o!=null?o:"",userType:"ASSISTANT"}),g(r("qpl")._(318966159,"139"),"created_message_in_thread"),_(r("qpl")._(318966159,"139")))},onError:function(t){p({errorMessage:t.message,errorStack:t.stack,event:"send_product_add_to_cart_event_to_agent",eventState:"failure",logMessage:"Failed to send product ATC event to agent"}),g(r("qpl")._(318966159,"139"),"send_product_atc_event_to_agent_mutation_failed"),f(r("qpl")._(318966159,"139"))},variables:{connections:[u],input:{access_token:{sensitive_string_value:t},ai_chat_plugin_instance_id:i.toString(),context:{checkout_url:e.checkout_url,join_id:o,timestamp:Date.now(),url:s},conversation_id:n.toString(),conversation_token:{sensitive_string_value:a},feature_type:"ADD_TO_CART",page_id:l.toString()}}})}})}l.default=e}),98);
-----
useBizAIAgentSendProactiveMessageTrigger",["fbt","BizAIGlobalTracerIDUtils","BizAIWebAgentContextAwareFeatureV3Mutation","BizAIWebAgentRenderMessageRequestXDEvent","BizAIWebAgentSpecialMessageIDs","CometRelay","justknobx","react","useBizAIAgentXDEventListener","useBizAIWebAgentLogger","useBizAIWebAgentRelayStoreUpdaters","useSaveProactiveMessage","useSendProactiveMessage","uuidv4"],(function(t,n,r,o,a,i,l,s){"use strict";var e,u=e||(e=o("react")),c=u.useCallback,d=u.useState,m=r("justknobx")._("5263"),p=s._(/*BTDS*/"What are you looking for today?").toString();function _(e,t){var n,r=(n=t.xfb_biz_ai_web_agent_context_aware_feature)==null||(n=n.proactive_agent_response)==null?void 0:n.static_response;return e==="home"?r!=null?r:p:r}function f(e){var t;return(t=e.xfb_biz_ai_web_agent_context_aware_feature)==null||(t=t.proactive_agent_response)==null?void 0:t.static_response_composed_text}function g(e){switch(e){case"home":return"HOME";case"cart":return"CART";case"product":return"PRODUCT";case"collection":return"COLLECTION";case"checkout":return"CHECKOUT";case"search":return"SEARCH";case"pages":return"PAGES";case"account":return"ACCOUNT";case"unknown":return"UNKNOWN";case"jest_e2e_test":return"JEST_E2E_TEST"}}function h(e){var t=e.accessToken,n=e.conversationFBID,a=e.conversationToken,i=e.faqPillType,l=e.instanceID,s=e.pageID,u=e.pageType,h=e.productName,y=e.shopifyProductID,C=e.shopifyProductVariantID,b=e.shouldEnableAgentResponseOnDwell,v=e.threadMessagesConnectionID,S=e.url,R=o("useSendProactiveMessage").useSendProactiveMessage(),L=R.sendProactiveMessage,E=r("useBizAIWebAgentRelayStoreUpdaters")(),k=E.createMessageInThread,I=E.deleteAgentMessageFromThread,T=r("useBizAIWebAgentLogger")({url:S}),D=T.logAnalyticsFalcoEvent,x=d({}),$=x[0],P=x[1],N=c(function(e,t){P(function(n){var r,o=_(t,e),a=f(e);return o==null||o===""?n:babelHelpers.extends({},n,(r={},r[o]=a,r))})},[P]),M=r("useSaveProactiveMessage")(),w=M.saveProactiveMessage,A=o("CometRelay").useMutation(o("BizAIWebAgentContextAwareFeatureV3Mutation").BizAIWebAgentContextAwareFeatureV3Mutation),F=A[0];r("useBizAIAgentXDEventListener")(o("BizAIWebAgentRenderMessageRequestXDEvent").bizAIWebAgentRenderMessageRequest,function(e){var t=$[e.static_text],n=o("BizAIGlobalTracerIDUtils").makeGlobalTracerID();k({composedText:t!=null?t:void 0,messageID:r("uuidv4")(),state:"OVERALL_DONE",text:e.static_text,userType:"ASSISTANT"}),D({apiName:"stream_www_message_to_client",eventName:"api_success",eventType:"api_call",extraInfo:{isProactiveMessage:"true",traceId:n},messageTraceId:n,surface:"thread_view"}),w(e.static_text,S,n),I(o("BizAIWebAgentSpecialMessageIDs").BAIWA_WELCOME_MESSAGE_ID)});var O=c(function(){var e=Date.now();D({apiName:"proactive_message_trigger",component:"proactive_message_handler",eventName:"api_attempt",eventType:"api_call",surface:"react_app_logic_function"});var r=function(n){var t=Date.now()-e,r=Math.max(0,m-t);D({apiName:"send_proactive_message_after_minimum_time",component:"proactive_message_handler",eventName:"api_attempt",eventType:"api_call",extraInfo:{isGenerative:String(b),remainingTime:r.toString(),totalTime:(t+r).toString()},surface:"react_app_logic_function"}),r>0?window.setTimeout(function(){L({messageText:n})},r):L({messageText:n})},o=u==="product"&&i==="product";b&&(o||u==="jest_e2e_test")&&n!=null&&a!=null&&v!=null?(D({apiName:"proactive_message_gql",component:"proactive_message_handler",eventName:"api_attempt",eventType:"api_call",surface:"react_app_logic_function"}),F({onCompleted:function(t){var e=_(u,t);e!=null&&e!==""&&(N(t,u),r(e))},onError:function(){},variables:{connections:[v],input:{access_token:{sensitive_string_value:t},ai_chat_plugin_instance_id:l.toString(),context:{page_type:g(u),product_name:h,shopify_product_id:y,shopify_product_variant_id:C,timestamp:Date.now(),url:S},conversation_id:n.toString(),conversation_token:{sensitive_string_value:a},feature_type:"PROACTIVE_MESSAGING",page_id:s.toString()}}})):r(p)},[b,n,a,i,D,F,v,t,l,u,h,y,C,S,s,N,L]);return O}l.pageTypeToGql=g,l.useProactiveMessageTrigger=h}),226);
-----
BizAIWebAgentContextAwareFeatureV3Mutation",["BizAIWebAgentContextAwareFeatureV3Mutation.graphql"],(function(t,n,r,o,a,i,l){"use strict";var e,s=e!==void 0?e:e=n("BizAIWebAgentContextAwareFeatureV3Mutation.graphql");l.BizAIWebAgentContextAwareFeatureV3Mutation=s}),98);
-----
BizAIWebAgentContextAwareFeatureV3Mutation_facebookRelayOperation",[],(function(t,n,r,o,a,i){a.exports="24549449681397284"}),null);
-----