1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5074],{25074:(e,t,n)=>{n.r(t),n.d(t,{default:()=>h});var a=n(95155),o=n(12115),i=n(98500),s=n.n(i),r=n(73321),c=n(4642),d=n(42636),l=n(54944);function h(){let{agent:e}=(0,l.A)(),t=(0,r.usePathname)().startsWith("/setup"),[n,i]=(0,o.useState)({accounts:[],available:{}}),[h,_]=(0,o.useState)([]),[p,u]=(0,o.useState)(""),[m,g]=(0,o.useState)(!1),[f,y]=(0,o.useState)(!1),[b,w]=(0,o.useState)(""),[k,v]=(0,o.useState)(""),x=async()=>i(await (0,c.yh)("/api/v1/mailboxes"));async function T(e){y(!0),w(""),v("");try{await e(),await x()}catch(e){w((0,d.d)(e,"Could not update your mailbox."))}finally{y(!1)}}return((0,o.useEffect)(()=>{let e=!0;return Promise.all([(0,c.yh)("/api/v1/mailboxes"),(0,c.yh)("/api/v1/sites")]).then(([t,n])=>{if(!e)return;i(t),_(n.sites),u(n.sites[0]?.id??"");let a=new URLSearchParams(window.location.search).get("result");"connected"===a?v("Mailbox connected. New incoming messages will appear as tickets in Inbox."):a&&w("Mailbox authorization did not finish. Please try connecting again.")}).catch(t=>{e&&w((0,d.d)(t,"Could not load these settings. Refresh the page to try again."))}),()=>{e=!1}},[]),e&&"admin"!==e.role)?(0,a.jsx)("div",{className:"p-6",children:"Ask a workspace admin to connect a mailbox."}):(0,a.jsxs)("div",{className:`w-full space-y-5 ${t?"":"p-6"}`,children:[(0,a.jsxs)("header",{children:[!t&&(0,a.jsx)(s(),{href:"/settings/integrations",className:"text-sm text-muted-foreground",children:"Integrations"}),(0,a.jsx)("h1",{className:"mt-2 text-2xl font-semibold",children:"Connected mailboxes"}),(0,a.jsx)("p",{className:"mt-2 text-sm text-muted-foreground",children:"Answer Gmail and Outlook messages alongside chats and calls."})]}),b&&(0,a.jsx)("p",{role:"alert",className:"rounded-lg border border-destructive/30 p-3 text-sm text-destructive",children:b}),k&&(0,a.jsx)("p",{role:"status",className:"rounded-lg border p-3 text-sm",children:k}),(0,a.jsxs)("section",{className:"space-y-4 rounded-xl border p-5",children:[(0,a.jsx)("h2",{className:"font-semibold",children:"Connect a support mailbox"}),(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"New incoming mail becomes tickets. Replies are sent from your connected account. Message does not delete, archive or mark email as read. Attachments stay in your email app. Sync checks run about every 30 seconds; large backlogs take longer."}),(0,a.jsxs)("label",{className:"grid gap-1 text-sm",children:["Website",(0,a.jsx)("select",{value:p,disabled:f,onChange:e=>u(e.target.value),className:"rounded-md border bg-background p-2",children:h.map(e=>(0,a.jsx)("option",{value:e.id,children:e.name},e.id))})]}),!h.length&&(0,a.jsx)(s(),{href:"/setup",className:"text-sm underline",children:"Finish workspace setup first"}),(0,a.jsxs)("label",{className:"flex items-start gap-2 text-sm",children:[(0,a.jsx)("input",{type:"checkbox",checked:m,disabled:f,onChange:e=>g(e.target.checked),className:"mt-1"}),"I authorize Message to read this support mailbox and send replies. My workspace teammates with ticket access can see imported messages."]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-3",children:["gmail","outlook"].map(e=>(0,a.jsxs)("div",{children:[(0,a.jsxs)("button",{disabled:f||!m||!p||!n.available[e],className:"rounded-lg border px-4 py-2 text-sm font-medium disabled:opacity-40",onClick:()=>void T(async()=>{let n=new URL((await (0,c.yh)("/api/v1/mailboxes/connect",{provider:e,siteId:p,approvedMailboxAccess:!0,...t?{returnTo:"onboarding"}:{}})).url);if(!["https://accounts.google.com","https://login.microsoftonline.com"].includes(n.origin))throw Error("Authorization URL was refused.");window.location.assign(n.toString())}),children:["Connect ","gmail"===e?"Gmail":"Outlook"]}),!n.available[e]&&(0,a.jsx)("p",{className:"mt-1 text-xs text-muted-foreground",children:"Provider setup pending"})]},e))})]}),(0,a.jsxs)("section",{className:"space-y-3",children:[(0,a.jsx)("h2",{className:"font-semibold",children:"Your mailboxes"}),!n.accounts.length&&(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:"No mailboxes connected yet."}),n.accounts.map(e=>(0,a.jsxs)("article",{className:"space-y-3 rounded-xl border p-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"font-medium",children:e.address}),(0,a.jsxs)("p",{className:"text-sm text-muted-foreground",children:["gmail"===e.provider?"Gmail":"Outlook"," \xb7 ",e.status,e.lastSyncedAt?` \xb7 Last synced ${new Date(e.lastSyncedAt).toLocaleStr
1ing()}`:" \xb7 Waiting for first sync"]})]}),e.lastError&&(0,a.jsx)("p",{role:"alert",className:"text-sm text-destructive",children:e.lastError}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-3 text-sm",children:[(0,a.jsx)("button",{disabled:f||"active"!==e.status,className:"underline disabled:opacity-40",onClick:()=>void T(async()=>{await (0,c.yh)(`/api/v1/mailboxes/${e.id}/sync`,{}),v("Sync requested. Refresh to see the latest status.")}),children:"Sync now"}),(0,a.jsx)("button",{disabled:f,className:"underline",onClick:()=>void T(async()=>{await (0,c.yh)(`/api/v1/mailboxes/${e.id}`,{status:"active"===e.status?"paused":"active"},"PATCH")}),children:"active"===e.status?"Pause":"Resume"}),(0,a.jsx)("button",{disabled:f,className:"underline",onClick:()=>void T(async()=>{await (0,c.yh)(`/api/v1/mailboxes/${e.id}`,void 0,"DELETE"),v("Disconnected. Imported tickets remain available; new email and replies have stopped.")}),children:"Disconnect"}),(0,a.jsx)("button",{disabled:f,className:"underline",onClick:()=>void T(x),children:"Refresh status"})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground",children:"To renew permissions, use Connect above with the same account and website."})]},e.id))]})]})}},42636:(e,t,n)=>{n.d(t,{d:()=>s});let a={unauthorized:"Your session ended. Sign in again to continue.",forbidden:"Only a workspace admin can change this. Ask an admin to do it for you.",admin_required:"Only a workspace admin can change this. Ask an admin to do it for you.",admin_or_supervisor_required:"Admins and supervisors handle this. Ask one of them.",rate_limited:"Too many attempts in a row. Wait a minute, then try again.",too_many_attempts:"Too many attempts in a row. Wait a minute, then try again.",workspace_busy:"Another change is still finishing. Try again in a moment.",request_id_reused:"That request already went through. Refresh the page to see it.",not_found:"That item is no longer here. Refresh the page and try again.",invalid_body:"Some of the details look incomplete. Check the form and try again.",validation_error:"Some of the details look incomplete. Check the form and try again.",invalid_json:"Some of the details look incomplete. Check the form and try again.",invalid_settings:"Some settings are not valid. Check them and save again.",invalid_provider_settings:"Some settings are not valid. Check them and save again.",invalid_channel_settings:"Some channel settings are not valid. Check them and save again.",invalid_alert_settings:"Some alert settings are not valid. Check them and save again.",invalid_meta_settings:"Some settings are not valid. Check them and save again.",unsupported_config_field:"One of these settings is not available for this connection.",invalid_status:"That change is not available right now. Refresh the page and try again.",invalid_state:"That change is not available right now. Refresh the page and try again.",internal_error:"Something went wrong on our side. Try again in a moment.",create_failed:"That did not save. Try again in a moment.",update_failed:"That did not save. Try again in a moment.",insert_failed:"That did not save. Try again in a moment.",feature_locked:"Your current plan does not include this. Upgrade in Billing to turn it on.",ai_subscription_required:"This needs message AI on your plan. Add it in Billing to continue.",connection_limit_reached:"You have reached the connection limit for your plan. Remove one or upgrade to add more.",connection_limit:"You have reached the connection limit for your plan. Remove one or upgrade to add more.",connector_limit_reached:"You have reached the connection limit for your plan. Remove one or upgrade to add more.",connector_sync_limit:"This connection has synced as often as it can for now. Try again later.",site_limit_reached:"This workspace is already connected to another website. Each workspace covers one website; create another workspace for a different site.",tickets_not_enabled:"Turn on tickets for this workspace first, then try again.",invalid_credentials:"Those credentials did not work. Check them and try again.",invalid_access_token:"That access token did not work. Check it and try again.",invalid_bot_token:"That bot token did not work. Copy it again from the provider and retry.",read_only_token_required:"Use a read-only token for this connection.",token_belongs_to_another_account:"That token belongs to a different account. Use one from the account you want to connect.",key_revoked:"That connection key was revoked. Create a new one and try again.",key_revoked_or_site_unavailable:"That connection key was revoked or the site is offline. Create a new key and try again.",use_the_generated_connection_key:"Paste the connection key generated on this page.",expired_oauth_state:"The sign-in window expired. Start the connection again.",missing_oauth_cookie:"The sign-in window expired. Start the connection again.",identity_changed:"You signed in as a different account than the one connected. Use the original account or disconnect first.",access_changed:"Access for this connection changed. Reconnect it to continue.",connection_changed:"This connection changed while you were editing. Refresh the page and try again.",conversation_changed:"This conversation changed while you were editing. Refresh and try again.",active_connection_not_found:"This connection is no longer active. Reconnect it to continue.",connection_already_exists_use_your_connections:"This is already connected. Manage it under Your connections.",already_syncing_or_disconnected:"A sync is already running, or this connection was removed. Refresh the page.",connector_cursor_did_not_advance:"The sync stopped making progress. Try again, and reconnect if it keeps happening.",invalid_connection:"This connection is not set up correctly. Reconnect it and try again.",invalid_connector:"That connection type is not available.",unsupported_connector:"That connection type is not available.",activation_failed_check_provider_access:"We could not turn this on. Check that the account still has access, then try again.",account_already_connected_or_connection_limit:"That account is already connected, or you have reached your connection limit.",bot_already_connected_or_connection_limit:"That bot is already connected, or you have reached your connection limit.",channel_already_connected_or_limit_reached:"That channel is already connected, or you have reached your connection limit.",installation_already_connected_or_expired:"That install is already connected or has expired. Reopen the app from the platform.",installation_already_connected_or_site_unavailable:"That install is already connected or the site is offline.",installation_disconnected:"That install was removed. Reinstall the app to reconnect.",installation_not_found:"We could not find that install. Reinstall the app and try again.",installation_not_in_site:"That install belongs to a different website.",installation_not_in_workspace:"That install belongs to a different workspace.",select_an_installation:"Choose an install to connect.",reinstall_the_app:"Reinstall the app from the platform, then try again.",connection_link_expired_reopen_the_platform_app:"This connection link expired. Reopen the app from the platform.",site_not_found:"We could not find that website. Refresh the page and try again.",site_not_in_workspace:"That website belongs to a different workspace.",site_unavailable:"That website is not reachable right now. Check that it is online, then try again.",site_scope_required:"Choose a website for this connection first.",choose_message_site:"Cho
1ose a website for this connection first.",site_already_has_an_order_connection:"This website already has an order connection. Remove it first to add another.",https_origin_required:"Use a website address that starts with https://.",public_https_api_url_required:"Use a public address that starts with https://.",unsupported_website_provider:"That website platform is not supported yet.",invalid_website_installation:"This website install is not set up correctly. Reinstall and try again.",widget_install_failed_check_platform_permissions_and_retry:"We could not add the chat widget. Check the app's permissions on your platform, then try again.",widget_install_response_invalid:"Your platform sent an unexpected reply while adding the chat widget. Try again.",widget_registration_invalid:"Your platform sent an unexpected reply while adding the chat widget. Try again.",open_this_app_as_the_store_owner:"Open this app while signed in as the store owner.",open_this_app_as_the_wix_site_owner:"Open this app while signed in as the Wix site owner.",install_the_wix_app_first:"Install the message.com app on your Wix site first.",choose_products_or_bookings:"Choose products, bookings, or both to connect.",choose_products_or_pages:"Choose products, pages, or both to connect.",select_public_store_pages:"Choose at least one public store page.",select_public_text_fields:"Choose at least one public text field.",invalid_public_fields:"Choose only public text fields.",collection_not_in_site:"That collection is not part of this website.",collections_unavailable_check_cms_read_permission:"We could not read your collections. Check that the connection can read CMS content.",collection_fields_unavailable:"We could not read that collection's fields. Try again in a moment.",webflow_collection_access_unavailable:"We could not read your Webflow collections. Check the app's CMS permission.",github_text_file_required:"Choose a text or Markdown file from the repository.",invalid_github_repository:"We could not open that repository. Check the name and access, then try again.",squarespace_read_failed_check_products_read_permission:"We could not read your Squarespace products. Check the app's product permission.",shopify_read_scopes_or_query_failed:"We could not read your Shopify store. Reinstall the app to refresh its permissions.",squarespace_page_too_large:"That Squarespace page is too large to read. Choose fewer pages.",check_bot_token_and_business_permissions:"We could not connect. Check the bot token and the account's business permissions, then try again.",check_discord_bot_channel_and_message_content_permissions:"We could not connect. Check your bot token, channel ID and Message Content Intent, then try again.",check_meta_permissions_and_subscription:"We could not connect. Check the page permissions in Meta, then try again.",check_meta_token_account_and_permissions:"We could not connect. Check the token, the account, and its permissions in Meta.",meta_check_registration_and_permissions:"Meta did not accept this account. Check that the number is registered and the app has the permissions it asked for, then try again.",meta_account_authorization_failed:"Meta did not authorize this account. Connect again and approve every permission Meta asks for.",meta_authorization_failed:"Meta sign-in did not finish. Connect again and approve every permission Meta asks for.",meta_asset_not_authorized:"This page or account was not included when you signed in with Meta. Connect again and select it.",meta_consent_required:"Approve access in Meta, then try again.",meta_permissions_missing:"Some permissions were not granted in Meta. Connect again and approve all of them.",meta_phone_not_owned:"That phone number belongs to a different Meta business account.",meta_phone_registration_failed:"Meta could not register that phone number. Check its status in WhatsApp Manager, then try again.",meta_rate_limited:"Meta is limiting requests right now. Wait a few minutes, then try again.",meta_reconnect_or_check_permissions:"Reconnect this account, or check its permissions in Meta.",meta_reconnect_required:"This Meta connection expired. Reconnect it to continue.",meta_token_expired:"This Meta connection expired. Reconnect it to continue.",meta_token_expiry_missing:"Meta did not say how long this access lasts. Reconnect to refresh it.",meta_request_failed:"Meta did not respond as expected. Try again in a moment.",meta_subscription_failed:"Meta did not start sending messages for this account. Check its permissions, then try again.",meta_customer_setup_pending:"Meta connections are not open yet.",meta_too_many_pages_select_fewer_in_meta:"Too many pages were selected in Meta. Connect again and choose fewer.",verify_callback_in_meta_first:"Verify the callback URL in Meta first, then try again.",reconnect_using_business_login:"Reconnect with Facebook Login for Business to continue.",bot_has_another_webhook_disconnect_it_first:"That bot already sends messages to another service. Disconnect it there first.",same_bot_and_channel_required:"Use the same bot and channel that are already connected.",invalid_discord_connection:"This Discord connection is not set up correctly. Reconnect it.",invalid_discord_update:"Some Discord settings are not valid. Check them and save again.",use_provider_webhook_url:"Use the webhook URL shown on this page in y
1our provider's settings.",mail_oauth_not_configured:"Mailbox sign-in is not available right now. Try again later.",mailbox_consent_required:"Approve access to the mailbox, then try again.",mailbox_paused:"This mailbox is paused. Resume it, then try again.",valid_test_email_required:"Enter a valid email address for the test.",use_quickbooks_reconnect:"Use Reconnect on the QuickBooks card to refresh access.",bigcommerce_publisher_setup_pending:"BigCommerce connections are not open yet.",webflow_publisher_setup_pending:"Webflow connections are not open yet.",wix_publisher_setup_pending:"Wix connections are not open yet.",wix_not_configured:"Wix connections are not open yet.",wix_webhook_setup_pending:"Wix connections are not open yet.",webflow_required:"Connect Webflow first, then try again.",webflow_connection_failed_start_again_from_message:"The Webflow connection did not finish. Start again from this page.",bigcommerce_install_failed_reopen_from_apps:"The BigCommerce install did not finish. Reopen the app from your BigCommerce Apps page.",wix_token_invalid:"Wix did not accept the connection. Reinstall the app and try again."},o=/^[a-z][a-z0-9]*(?:[_.-][a-z0-9]+)+$/,i=/^(Request failed \(\d+\)|HTTP \d+|Bad server response|Unauthorized|Forbidden|Not Found|Internal Server Error|Bad Request|Failed to fetch|NetworkError|Load failed|(?:body|querystring|params|headers)[/ .])/i;function s(e,t="That did not go through. Try again in a moment.",n){let r=e&&"object"==typeof e?e:{},c="string"==typeof r.message?r.message:"string"==typeof e?e:"";if("NetworkError"===r.name||e instanceof TypeError&&/fetch|network|load failed/i.test(c))return"You appear to be offline. Check your connection and try again.";let d="number"==typeof r.status?r.status:null,l="string"==typeof r.code?r.code:null,h=c;if(r.body&&"object"==typeof r.body){let e=r.body;l=l??("string"==typeof e.error?e.error:null),h="string"==typeof e.message?e.message:""}let _=r.details&&"object"==typeof r.details?r.details:r.body&&"object"==typeof r.body?r.body:{};if((l??h)==="site_limit_reached"&&!n?.site_limit_reached){let e="string"==typeof _.connected_site?_.connected_site.trim():"";if(e)return`This workspace is already connected to ${e}. Each workspace covers one website; create another workspace for a different site.`}for(let e of[l,h]){if(!e)continue;let t=n?.[e]??a[e];if(t)return t}return!h||h===l||o.test(h)||i.test(h)?(null===d?null:401===d?a.unauthorized:403===d?a.forbidden:404===d?a.not_found:409===d?"Something changed while you were working. Refresh the page and try again.":429===d?a.rate_limited:d>=500?a.internal_error:null)??t:h}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.