[{"data":1,"prerenderedAt":2340},["ShallowReactive",2],{"navigation_docs":3,"-docs-storefront-sdk-resources-assistant":357,"-docs-storefront-sdk-resources-assistant-surround":2335,"docs-site-config":2325},[4,74,135,139,161,195,273],{"title":5,"path":6,"stem":7,"children":8},"Assets API","\u002Fdocs\u002Fassets","docs\u002Fassets\u002Findex",[9,10,32,57],{"title":5,"path":6,"stem":7},{"title":11,"path":12,"stem":13,"children":14,"page":31},"Getting Started","\u002Fdocs\u002Fassets\u002Fgetting-started","docs\u002Fassets\u002F1.getting-started",[15,19,23,27],{"title":16,"path":17,"stem":18},"Base URL","\u002Fdocs\u002Fassets\u002Fgetting-started\u002Fbase-url","docs\u002Fassets\u002F1.getting-started\u002F1.base-url",{"title":20,"path":21,"stem":22},"Important Notes","\u002Fdocs\u002Fassets\u002Fgetting-started\u002Fimportant-notes","docs\u002Fassets\u002F1.getting-started\u002F2.important-notes",{"title":24,"path":25,"stem":26},"URL Format","\u002Fdocs\u002Fassets\u002Fgetting-started\u002Furl-format","docs\u002Fassets\u002F1.getting-started\u002F3.url-format",{"title":28,"path":29,"stem":30},"Custom Domains","\u002Fdocs\u002Fassets\u002Fgetting-started\u002Fcustom-domains","docs\u002Fassets\u002F1.getting-started\u002F4.custom-domains",false,{"title":33,"path":34,"stem":35,"children":36,"page":31},"Usage","\u002Fdocs\u002Fassets\u002Fusage","docs\u002Fassets\u002F2.usage",[37,41,45,49,53],{"title":38,"path":39,"stem":40},"Transforms","\u002Fdocs\u002Fassets\u002Fusage\u002Ftransforms","docs\u002Fassets\u002F2.usage\u002F1.transforms",{"title":42,"path":43,"stem":44},"Caching","\u002Fdocs\u002Fassets\u002Fusage\u002Fcaching","docs\u002Fassets\u002F2.usage\u002F2.caching",{"title":46,"path":47,"stem":48},"Recipes","\u002Fdocs\u002Fassets\u002Fusage\u002Frecipes","docs\u002Fassets\u002F2.usage\u002F3.recipes",{"title":50,"path":51,"stem":52},"Best Practices","\u002Fdocs\u002Fassets\u002Fusage\u002Fbest-practices","docs\u002Fassets\u002F2.usage\u002F4.best-practices",{"title":54,"path":55,"stem":56},"Reference","\u002Fdocs\u002Fassets\u002Fusage\u002Freference","docs\u002Fassets\u002F2.usage\u002F5.reference",{"title":58,"path":59,"stem":60,"children":61,"page":31},"Integration","\u002Fdocs\u002Fassets\u002Fintegration","docs\u002Fassets\u002F3.integration",[62,66,70],{"title":63,"path":64,"stem":65},"Nuxt","\u002Fdocs\u002Fassets\u002Fintegration\u002Fnuxt","docs\u002Fassets\u002F3.integration\u002F1.nuxt",{"title":67,"path":68,"stem":69},"Next.js","\u002Fdocs\u002Fassets\u002Fintegration\u002Fnextjs","docs\u002Fassets\u002F3.integration\u002F2.nextjs",{"title":71,"path":72,"stem":73},"Plain HTML","\u002Fdocs\u002Fassets\u002Fintegration\u002Fhtml","docs\u002Fassets\u002F3.integration\u002F3.html",{"title":75,"path":76,"stem":77,"children":78},"Avvyr CMS","\u002Fdocs\u002Fcms","docs\u002Fcms\u002Findex",[79,80,92,105,118,131],{"title":75,"path":76,"stem":77},{"title":11,"path":81,"stem":82,"children":83,"page":31},"\u002Fdocs\u002Fcms\u002Fgetting-started","docs\u002Fcms\u002F1.getting-started",[84,88],{"title":85,"path":86,"stem":87},"Quickstart","\u002Fdocs\u002Fcms\u002Fgetting-started\u002Fquickstart","docs\u002Fcms\u002F1.getting-started\u002F1.quickstart",{"title":89,"path":90,"stem":91},"Keys and access","\u002Fdocs\u002Fcms\u002Fgetting-started\u002Fkeys-and-access","docs\u002Fcms\u002F1.getting-started\u002F2.keys-and-access",{"title":93,"path":94,"stem":95,"children":96,"page":31},"Content Model","\u002Fdocs\u002Fcms\u002Fcontent-model","docs\u002Fcms\u002F2.content-model",[97,101],{"title":98,"path":99,"stem":100},"Types and fields","\u002Fdocs\u002Fcms\u002Fcontent-model\u002Ftypes-and-fields","docs\u002Fcms\u002F2.content-model\u002F1.types-and-fields",{"title":102,"path":103,"stem":104},"Entries and publishing","\u002Fdocs\u002Fcms\u002Fcontent-model\u002Fentries-and-publishing","docs\u002Fcms\u002F2.content-model\u002F2.entries-and-publishing",{"title":106,"path":107,"stem":108,"children":109,"page":31},"Delivery","\u002Fdocs\u002Fcms\u002Fdelivery","docs\u002Fcms\u002F3.delivery",[110,114],{"title":111,"path":112,"stem":113},"Delivery API","\u002Fdocs\u002Fcms\u002Fdelivery\u002Fdelivery-api","docs\u002Fcms\u002F3.delivery\u002F1.delivery-api",{"title":115,"path":116,"stem":117},"Preview and live editing","\u002Fdocs\u002Fcms\u002Fdelivery\u002Fpreview","docs\u002Fcms\u002F3.delivery\u002F2.preview",{"title":119,"path":120,"stem":121,"children":122,"page":31},"Frameworks","\u002Fdocs\u002Fcms\u002Fframeworks","docs\u002Fcms\u002F4.frameworks",[123,127],{"title":124,"path":125,"stem":126},"JavaScript client","\u002Fdocs\u002Fcms\u002Fframeworks\u002Fjavascript-client","docs\u002Fcms\u002F4.frameworks\u002F1.javascript-client",{"title":128,"path":129,"stem":130},"Nuxt layer","\u002Fdocs\u002Fcms\u002Fframeworks\u002Fnuxt","docs\u002Fcms\u002F4.frameworks\u002F2.nuxt",{"title":132,"path":133,"stem":134},"Management API","\u002Fdocs\u002Fcms\u002Fmanagement-api","docs\u002Fcms\u002F5.management-api",{"title":136,"path":137,"stem":138},"Early Access","\u002Fdocs\u002Fearly-access","docs\u002Fearly-access",{"title":140,"path":141,"stem":142,"children":143},"Events API","\u002Fdocs\u002Fevents","docs\u002Fevents\u002Findex",[144,145],{"title":140,"path":141,"stem":142},{"title":11,"path":146,"stem":147,"children":148,"page":31},"\u002Fdocs\u002Fevents\u002Fgetting-started","docs\u002Fevents\u002F1.getting-started",[149,153,157],{"title":150,"path":151,"stem":152},"Subscribing","\u002Fdocs\u002Fevents\u002Fgetting-started\u002Fsubscribing","docs\u002Fevents\u002F1.getting-started\u002F1.subscribing",{"title":154,"path":155,"stem":156},"Event Delivery","\u002Fdocs\u002Fevents\u002Fgetting-started\u002Fevent-delivery","docs\u002Fevents\u002F1.getting-started\u002F2.event-delivery",{"title":158,"path":159,"stem":160},"Event Reference","\u002Fdocs\u002Fevents\u002Fgetting-started\u002Fevent-reference","docs\u002Fevents\u002F1.getting-started\u002F3.event-reference",{"title":162,"path":163,"stem":164,"children":165},"Integrations API","\u002Fdocs\u002Fintegrations","docs\u002Fintegrations\u002Findex",[166,167],{"title":162,"path":163,"stem":164},{"title":11,"path":168,"stem":169,"children":170,"page":31},"\u002Fdocs\u002Fintegrations\u002Fgetting-started","docs\u002Fintegrations\u002F1.getting-started",[171,175,179,183,187,191],{"title":172,"path":173,"stem":174},"Why Use It?","\u002Fdocs\u002Fintegrations\u002Fgetting-started\u002Fwhy-integrations-api","docs\u002Fintegrations\u002F1.getting-started\u002F1.why-integrations-api",{"title":176,"path":177,"stem":178},"Use Cases","\u002Fdocs\u002Fintegrations\u002Fgetting-started\u002Fwho-is-it-for","docs\u002Fintegrations\u002F1.getting-started\u002F2.who-is-it-for",{"title":180,"path":181,"stem":182},"Pre-built Connectors","\u002Fdocs\u002Fintegrations\u002Fgetting-started\u002Fpre-built-integrations","docs\u002Fintegrations\u002F1.getting-started\u002F3.pre-built-integrations",{"title":184,"path":185,"stem":186},"Custom Inbound","\u002Fdocs\u002Fintegrations\u002Fgetting-started\u002Fcustom-inbound-api","docs\u002Fintegrations\u002F1.getting-started\u002F4.custom-inbound-api",{"title":188,"path":189,"stem":190},"Event Lifecycle","\u002Fdocs\u002Fintegrations\u002Fgetting-started\u002Fevent-lifecycle","docs\u002Fintegrations\u002F1.getting-started\u002F5.event-lifecycle",{"title":192,"path":193,"stem":194},"API Endpoints","\u002Fdocs\u002Fintegrations\u002Fgetting-started\u002Fmanagement-api-endpoints","docs\u002Fintegrations\u002F1.getting-started\u002F6.management-api-endpoints",{"title":196,"path":197,"stem":198,"children":199},"MCP Server","\u002Fdocs\u002Fmcp","docs\u002Fmcp\u002Findex",[200,201,225,234,244],{"title":196,"path":197,"stem":198},{"title":11,"path":202,"stem":203,"children":204,"page":31},"\u002Fdocs\u002Fmcp\u002Fgetting-started","docs\u002Fmcp\u002F1.getting-started",[205,209,213,217,221],{"title":206,"path":207,"stem":208},"Claude","\u002Fdocs\u002Fmcp\u002Fgetting-started\u002Fclaude","docs\u002Fmcp\u002F1.getting-started\u002F1.claude",{"title":210,"path":211,"stem":212},"Claude Code","\u002Fdocs\u002Fmcp\u002Fgetting-started\u002Fclaude-code","docs\u002Fmcp\u002F1.getting-started\u002F2.claude-code",{"title":214,"path":215,"stem":216},"VS Code","\u002Fdocs\u002Fmcp\u002Fgetting-started\u002Fvscode","docs\u002Fmcp\u002F1.getting-started\u002F3.vscode",{"title":218,"path":219,"stem":220},"Cursor","\u002Fdocs\u002Fmcp\u002Fgetting-started\u002Fcursor","docs\u002Fmcp\u002F1.getting-started\u002F4.cursor",{"title":222,"path":223,"stem":224},"Verify the connection","\u002Fdocs\u002Fmcp\u002Fgetting-started\u002Fverify","docs\u002Fmcp\u002F1.getting-started\u002F5.verify",{"title":226,"path":227,"stem":228,"children":229,"page":31},"Docs Server","\u002Fdocs\u002Fmcp\u002Fdocs-server","docs\u002Fmcp\u002F2.docs-server",[230],{"title":231,"path":232,"stem":233},"Docs server tools","\u002Fdocs\u002Fmcp\u002Fdocs-server\u002Ftools","docs\u002Fmcp\u002F2.docs-server\u002F1.tools",{"title":235,"path":236,"stem":237,"children":238},"API Server","\u002Fdocs\u002Fmcp\u002Fapi-server","docs\u002Fmcp\u002F3.api-server\u002Findex",[239,240],{"title":235,"path":236,"stem":237},{"title":241,"path":242,"stem":243},"Available tools","\u002Fdocs\u002Fmcp\u002Fapi-server\u002Ftools","docs\u002Fmcp\u002F3.api-server\u002F1.tools",{"title":245,"path":246,"stem":247,"children":248,"page":31},"Examples","\u002Fdocs\u002Fmcp\u002Fexamples","docs\u002Fmcp\u002F4.examples",[249,253,257,261,265,269],{"title":250,"path":251,"stem":252},"Exploring an API","\u002Fdocs\u002Fmcp\u002Fexamples\u002Fexploring-an-api","docs\u002Fmcp\u002F4.examples\u002F1.exploring-an-api",{"title":254,"path":255,"stem":256},"Building a Feature","\u002Fdocs\u002Fmcp\u002Fexamples\u002Fbuilding-a-feature","docs\u002Fmcp\u002F4.examples\u002F2.building-a-feature",{"title":258,"path":259,"stem":260},"Understanding Models","\u002Fdocs\u002Fmcp\u002Fexamples\u002Funderstanding-models","docs\u002Fmcp\u002F4.examples\u002F3.understanding-models",{"title":262,"path":263,"stem":264},"Code Review","\u002Fdocs\u002Fmcp\u002Fexamples\u002Fcode-review","docs\u002Fmcp\u002F4.examples\u002F4.code-review",{"title":266,"path":267,"stem":268},"Combining MCP Servers","\u002Fdocs\u002Fmcp\u002Fexamples\u002Fmulti-mcp","docs\u002Fmcp\u002F4.examples\u002F5.multi-mcp",{"title":270,"path":271,"stem":272},"Tips","\u002Fdocs\u002Fmcp\u002Fexamples\u002Ftips","docs\u002Fmcp\u002F4.examples\u002F6.tips",{"title":274,"path":275,"stem":276,"children":277,"page":31},"Storefront SDK","\u002Fdocs\u002Fstorefront-sdk","docs\u002Fstorefront-sdk",[278,290,323,338],{"title":11,"path":279,"stem":280,"children":281,"page":31},"\u002Fdocs\u002Fstorefront-sdk\u002Fgetting-started","docs\u002Fstorefront-sdk\u002F1.getting-started",[282,286],{"title":283,"path":284,"stem":285},"Installation","\u002Fdocs\u002Fstorefront-sdk\u002Fgetting-started\u002Finstallation","docs\u002Fstorefront-sdk\u002F1.getting-started\u002F1.installation",{"title":287,"path":288,"stem":289},"Configuration","\u002Fdocs\u002Fstorefront-sdk\u002Fgetting-started\u002Fconfiguration","docs\u002Fstorefront-sdk\u002F1.getting-started\u002F2.configuration",{"title":291,"path":292,"stem":293,"children":294,"page":31},"Resources","\u002Fdocs\u002Fstorefront-sdk\u002Fresources","docs\u002Fstorefront-sdk\u002F2.resources",[295,299,303,307,311,315,319],{"title":296,"path":297,"stem":298},"Products","\u002Fdocs\u002Fstorefront-sdk\u002Fresources\u002Fproducts","docs\u002Fstorefront-sdk\u002F2.resources\u002F1.products",{"title":300,"path":301,"stem":302},"Cart","\u002Fdocs\u002Fstorefront-sdk\u002Fresources\u002Fcart","docs\u002Fstorefront-sdk\u002F2.resources\u002F2.cart",{"title":304,"path":305,"stem":306},"Auth","\u002Fdocs\u002Fstorefront-sdk\u002Fresources\u002Fauth","docs\u002Fstorefront-sdk\u002F2.resources\u002F3.auth",{"title":308,"path":309,"stem":310},"Checkout & Shipping","\u002Fdocs\u002Fstorefront-sdk\u002Fresources\u002Fcheckout-shipping","docs\u002Fstorefront-sdk\u002F2.resources\u002F4.checkout-shipping",{"title":312,"path":313,"stem":314},"Orders, Returns & Reviews","\u002Fdocs\u002Fstorefront-sdk\u002Fresources\u002Forders-returns-reviews","docs\u002Fstorefront-sdk\u002F2.resources\u002F5.orders-returns-reviews",{"title":316,"path":317,"stem":318},"Customer assistant","\u002Fdocs\u002Fstorefront-sdk\u002Fresources\u002Fassistant","docs\u002Fstorefront-sdk\u002F2.resources\u002F6.assistant",{"title":320,"path":321,"stem":322},"Products in images","\u002Fdocs\u002Fstorefront-sdk\u002Fresources\u002Fproducts-in-images","docs\u002Fstorefront-sdk\u002F2.resources\u002F7.products-in-images",{"title":128,"path":324,"stem":325,"children":326,"page":31},"\u002Fdocs\u002Fstorefront-sdk\u002Fnuxt-layer","docs\u002Fstorefront-sdk\u002F3.nuxt-layer",[327,331,335],{"title":328,"path":329,"stem":330},"Overview","\u002Fdocs\u002Fstorefront-sdk\u002Fnuxt-layer\u002Foverview","docs\u002Fstorefront-sdk\u002F3.nuxt-layer\u002F1.overview",{"title":332,"path":333,"stem":334},"Composables","\u002Fdocs\u002Fstorefront-sdk\u002Fnuxt-layer\u002Fcomposables","docs\u002Fstorefront-sdk\u002F3.nuxt-layer\u002F2.composables",{"title":316,"path":336,"stem":337},"\u002Fdocs\u002Fstorefront-sdk\u002Fnuxt-layer\u002Fassistant","docs\u002Fstorefront-sdk\u002F3.nuxt-layer\u002F3.assistant",{"title":67,"path":339,"stem":340,"children":341,"page":31},"\u002Fdocs\u002Fstorefront-sdk\u002Fnextjs","docs\u002Fstorefront-sdk\u002F4.nextjs",[342,345,349,353],{"title":328,"path":343,"stem":344},"\u002Fdocs\u002Fstorefront-sdk\u002Fnextjs\u002Foverview","docs\u002Fstorefront-sdk\u002F4.nextjs\u002F1.overview",{"title":346,"path":347,"stem":348},"Hooks","\u002Fdocs\u002Fstorefront-sdk\u002Fnextjs\u002Fhooks","docs\u002Fstorefront-sdk\u002F4.nextjs\u002F2.hooks",{"title":350,"path":351,"stem":352},"Server helpers and proxy","\u002Fdocs\u002Fstorefront-sdk\u002Fnextjs\u002Fserver","docs\u002Fstorefront-sdk\u002F4.nextjs\u002F3.server",{"title":354,"path":355,"stem":356},"Components","\u002Fdocs\u002Fstorefront-sdk\u002Fnextjs\u002Fcomponents","docs\u002Fstorefront-sdk\u002F4.nextjs\u002F4.components",{"id":358,"title":316,"body":359,"description":2323,"extension":2324,"links":2325,"meta":2326,"navigation":764,"path":317,"seo":2333,"stem":318,"__hash__":2334},"docs\u002Fdocs\u002Fstorefront-sdk\u002F2.resources\u002F6.assistant.md",{"type":360,"value":361,"toc":2310},"minimark",[362,375,378,389,399,404,523,541,552,556,696,706,711,733,737,1139,1146,1222,1226,1316,1334,1340,1400,1413,1417,1430,1515,1698,1702,1709,1893,1950,1954,2052,2066,2070,2073,2188,2222,2226,2229,2306],[363,364,365,366,370,371,374],"p",{},"Access via ",[367,368,369],"code",{},"client.assistant",". Requires the ",[367,372,373],{},"storefront:assistant"," scope on the storefront key.",[363,376,377],{},"The shopper can be anonymous or signed in. When a customer token is set on the client it is sent along, and the assistant can then look up that customer's orders without asking for an order number.",[363,379,380,381,384,385,388],{},"A conversation is carried by a secret ",[367,382,383],{},"token"," returned when it is created. Keep it next to the conversation id (session storage is a good home) and pass both to every later call. Without the token the conversation cannot be read or continued, and a wrong token answers ",[367,386,387],{},"404 CONVERSATION_NOT_FOUND",".",[363,390,391,392,395,396,388],{},"On Nuxt, ",[367,393,394],{},"\u003CAvvyrAssistant \u002F>"," from the layer does all of this for you. See ",[397,398,316],"a",{"href":336},[400,401,403],"h2",{"id":402},"config","Config",[405,406,411],"pre",{"className":407,"code":408,"language":409,"meta":410,"style":410},"language-ts shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","const config = await client.assistant.getConfig({ locale: 'sv' })\n\u002F\u002F → {\n\u002F\u002F   enabled, name, greeting,\n\u002F\u002F   capabilities: { products, orderStatus, returns, claims, handover },\n\u002F\u002F   access: 'everyone' | 'signedIn',\n\u002F\u002F   suggestedQuestions: string[],   \u002F\u002F for the locale, plus those set for every language\n\u002F\u002F   attachments: { enabled },\n\u002F\u002F }\n","ts","",[367,412,413,477,484,490,496,502,511,517],{"__ignoreMap":410},[414,415,418,422,426,430,434,437,439,442,444,448,451,454,458,461,464,468,471,474],"span",{"class":416,"line":417},"line",1,[414,419,421],{"class":420},"spNyl","const",[414,423,425],{"class":424},"sTEyZ"," config ",[414,427,429],{"class":428},"sMK4o","=",[414,431,433],{"class":432},"s7zQu"," await",[414,435,436],{"class":424}," client",[414,438,388],{"class":428},[414,440,441],{"class":424},"assistant",[414,443,388],{"class":428},[414,445,447],{"class":446},"s2Zo4","getConfig",[414,449,450],{"class":424},"(",[414,452,453],{"class":428},"{",[414,455,457],{"class":456},"swJcz"," locale",[414,459,460],{"class":428},":",[414,462,463],{"class":428}," '",[414,465,467],{"class":466},"sfazB","sv",[414,469,470],{"class":428},"'",[414,472,473],{"class":428}," }",[414,475,476],{"class":424},")\n",[414,478,480],{"class":416,"line":479},2,[414,481,483],{"class":482},"sHwdD","\u002F\u002F → {\n",[414,485,487],{"class":416,"line":486},3,[414,488,489],{"class":482},"\u002F\u002F   enabled, name, greeting,\n",[414,491,493],{"class":416,"line":492},4,[414,494,495],{"class":482},"\u002F\u002F   capabilities: { products, orderStatus, returns, claims, handover },\n",[414,497,499],{"class":416,"line":498},5,[414,500,501],{"class":482},"\u002F\u002F   access: 'everyone' | 'signedIn',\n",[414,503,505,508],{"class":416,"line":504},6,[414,506,507],{"class":482},"\u002F\u002F   suggestedQuestions: string[],",[414,509,510],{"class":482},"   \u002F\u002F for the locale, plus those set for every language\n",[414,512,514],{"class":416,"line":513},7,[414,515,516],{"class":482},"\u002F\u002F   attachments: { enabled },\n",[414,518,520],{"class":416,"line":519},8,[414,521,522],{"class":482},"\u002F\u002F }\n",[363,524,525,526,529,530,533,534,537,538,388],{},"Show the chat only when ",[367,527,528],{},"enabled"," is true. ",[367,531,532],{},"greeting"," (may be empty) is meant as the first message in an empty chat. ",[367,535,536],{},"suggestedQuestions"," are one-tap questions for an empty chat, in the language passed as ",[367,539,540],{},"locale",[363,542,543,544,547,548,551],{},"With ",[367,545,546],{},"access: 'signedIn'"," only signed-in customers may chat: creating a conversation, sending and uploading answer ",[367,549,550],{},"401 SIGN_IN_REQUIRED"," without a customer token on the client. Show a sign-in prompt instead of the composer.",[400,553,555],{"id":554},"start-a-conversation","Start a conversation",[405,557,559],{"className":407,"code":558,"language":409,"meta":410,"style":410},"const { conversationId, token, conversation } = await client.assistant.createConversation({\n  locale: 'sv',                     \u002F\u002F optional\n  pageUrl: window.location.href,    \u002F\u002F optional, absolute http(s) URL\n  context: { productSku: 'CHAIR-01', pageType: 'product' }, \u002F\u002F optional\n})\n",[367,560,561,606,624,649,690],{"__ignoreMap":410},[414,562,563,565,568,571,574,577,579,582,585,588,590,592,594,596,598,601,603],{"class":416,"line":417},[414,564,421],{"class":420},[414,566,567],{"class":428}," {",[414,569,570],{"class":424}," conversationId",[414,572,573],{"class":428},",",[414,575,576],{"class":424}," token",[414,578,573],{"class":428},[414,580,581],{"class":424}," conversation ",[414,583,584],{"class":428},"}",[414,586,587],{"class":428}," =",[414,589,433],{"class":432},[414,591,436],{"class":424},[414,593,388],{"class":428},[414,595,441],{"class":424},[414,597,388],{"class":428},[414,599,600],{"class":446},"createConversation",[414,602,450],{"class":424},[414,604,605],{"class":428},"{\n",[414,607,608,611,613,615,617,619,621],{"class":416,"line":479},[414,609,610],{"class":456},"  locale",[414,612,460],{"class":428},[414,614,463],{"class":428},[414,616,467],{"class":466},[414,618,470],{"class":428},[414,620,573],{"class":428},[414,622,623],{"class":482},"                     \u002F\u002F optional\n",[414,625,626,629,631,634,636,639,641,644,646],{"class":416,"line":486},[414,627,628],{"class":456},"  pageUrl",[414,630,460],{"class":428},[414,632,633],{"class":424}," window",[414,635,388],{"class":428},[414,637,638],{"class":424},"location",[414,640,388],{"class":428},[414,642,643],{"class":424},"href",[414,645,573],{"class":428},[414,647,648],{"class":482},"    \u002F\u002F optional, absolute http(s) URL\n",[414,650,651,654,656,658,661,663,665,668,670,672,675,677,679,682,684,687],{"class":416,"line":492},[414,652,653],{"class":456},"  context",[414,655,460],{"class":428},[414,657,567],{"class":428},[414,659,660],{"class":456}," productSku",[414,662,460],{"class":428},[414,664,463],{"class":428},[414,666,667],{"class":466},"CHAIR-01",[414,669,470],{"class":428},[414,671,573],{"class":428},[414,673,674],{"class":456}," pageType",[414,676,460],{"class":428},[414,678,463],{"class":428},[414,680,681],{"class":466},"product",[414,683,470],{"class":428},[414,685,686],{"class":428}," },",[414,688,689],{"class":482}," \u002F\u002F optional\n",[414,691,692,694],{"class":416,"line":498},[414,693,584],{"class":428},[414,695,476],{"class":424},[363,697,698,699,702,703,705],{},"Create it when the shopper sends the first message, not when the chat opens, so that opening and closing creates nothing. Answers ",[367,700,701],{},"403 ASSISTANT_DISABLED"," when the shop has the assistant off and ",[367,704,550],{}," as above.",[707,708,710],"h3",{"id":709},"context","Context",[363,712,713,715,716,719,720,722,723,722,726,722,729,732],{},[367,714,709],{}," tells the assistant where the shopper is, so \"what are the measurements of this one?\" works on a product page. ",[367,717,718],{},"pageType"," is lowercase letters and dashes (",[367,721,681],{},", ",[367,724,725],{},"category",[367,727,728],{},"cart",[367,730,731],{},"checkout","); unknown or malformed values are dropped. Pass the current context with every message too (below): it follows the shopper when they move to another page.",[400,734,736],{"id":735},"send-a-message-and-stream-the-answer","Send a message and stream the answer",[405,738,740],{"className":407,"code":739,"language":409,"meta":410,"style":410},"const controller = new AbortController()\n\nconst result = await client.assistant.sendMessage(conversationId, token, 'Where is my order?', {\n  signal: controller.signal,\n  context: { productSku: 'CHAIR-01', pageType: 'product' }, \u002F\u002F optional\n  onEvent(event) {\n    switch (event.type) {\n      case 'delta':    append(event.content); break          \u002F\u002F a piece of the answer\n      case 'activity': showStatus(event.kind); break          \u002F\u002F a tool is running\n      case 'card':     showCard(event.card); break            \u002F\u002F products, an order, tracking\n      case 'proposal': showProposal(event.proposal); break    \u002F\u002F a return to confirm\n      case 'handover': \u002F* a person takes over *\u002F break\n      case 'queued':   \u002F* a person answers; the message was saved *\u002F break\n      case 'done':     \u002F* the turn is over: event.status *\u002F break\n      case 'error':    \u002F* event.errorCode, event.message *\u002F break\n    }\n  },\n})\n\u002F\u002F → { status, error, aborted }\n",[367,741,742,760,766,809,827,861,877,897,934,969,1003,1037,1057,1076,1095,1114,1120,1126,1133],{"__ignoreMap":410},[414,743,744,746,749,751,754,757],{"class":416,"line":417},[414,745,421],{"class":420},[414,747,748],{"class":424}," controller ",[414,750,429],{"class":428},[414,752,753],{"class":428}," new",[414,755,756],{"class":446}," AbortController",[414,758,759],{"class":424},"()\n",[414,761,762],{"class":416,"line":479},[414,763,765],{"emptyLinePlaceholder":764},true,"\n",[414,767,768,770,773,775,777,779,781,783,785,788,791,793,795,797,799,802,804,806],{"class":416,"line":486},[414,769,421],{"class":420},[414,771,772],{"class":424}," result ",[414,774,429],{"class":428},[414,776,433],{"class":432},[414,778,436],{"class":424},[414,780,388],{"class":428},[414,782,441],{"class":424},[414,784,388],{"class":428},[414,786,787],{"class":446},"sendMessage",[414,789,790],{"class":424},"(conversationId",[414,792,573],{"class":428},[414,794,576],{"class":424},[414,796,573],{"class":428},[414,798,463],{"class":428},[414,800,801],{"class":466},"Where is my order?",[414,803,470],{"class":428},[414,805,573],{"class":428},[414,807,808],{"class":428}," {\n",[414,810,811,814,816,819,821,824],{"class":416,"line":492},[414,812,813],{"class":456},"  signal",[414,815,460],{"class":428},[414,817,818],{"class":424}," controller",[414,820,388],{"class":428},[414,822,823],{"class":424},"signal",[414,825,826],{"class":428},",\n",[414,828,829,831,833,835,837,839,841,843,845,847,849,851,853,855,857,859],{"class":416,"line":498},[414,830,653],{"class":456},[414,832,460],{"class":428},[414,834,567],{"class":428},[414,836,660],{"class":456},[414,838,460],{"class":428},[414,840,463],{"class":428},[414,842,667],{"class":466},[414,844,470],{"class":428},[414,846,573],{"class":428},[414,848,674],{"class":456},[414,850,460],{"class":428},[414,852,463],{"class":428},[414,854,681],{"class":466},[414,856,470],{"class":428},[414,858,686],{"class":428},[414,860,689],{"class":482},[414,862,863,866,868,872,875],{"class":416,"line":504},[414,864,865],{"class":456},"  onEvent",[414,867,450],{"class":428},[414,869,871],{"class":870},"sHdIc","event",[414,873,874],{"class":428},")",[414,876,808],{"class":428},[414,878,879,882,885,887,889,892,895],{"class":416,"line":513},[414,880,881],{"class":432},"    switch",[414,883,884],{"class":456}," (",[414,886,871],{"class":424},[414,888,388],{"class":428},[414,890,891],{"class":424},"type",[414,893,894],{"class":456},") ",[414,896,605],{"class":428},[414,898,899,902,904,907,909,911,914,916,918,920,923,925,928,931],{"class":416,"line":519},[414,900,901],{"class":432},"      case",[414,903,463],{"class":428},[414,905,906],{"class":466},"delta",[414,908,470],{"class":428},[414,910,460],{"class":428},[414,912,913],{"class":446},"    append",[414,915,450],{"class":456},[414,917,871],{"class":424},[414,919,388],{"class":428},[414,921,922],{"class":424},"content",[414,924,874],{"class":456},[414,926,927],{"class":428},";",[414,929,930],{"class":432}," break",[414,932,933],{"class":482},"          \u002F\u002F a piece of the answer\n",[414,935,937,939,941,944,946,948,951,953,955,957,960,962,964,966],{"class":416,"line":936},9,[414,938,901],{"class":432},[414,940,463],{"class":428},[414,942,943],{"class":466},"activity",[414,945,470],{"class":428},[414,947,460],{"class":428},[414,949,950],{"class":446}," showStatus",[414,952,450],{"class":456},[414,954,871],{"class":424},[414,956,388],{"class":428},[414,958,959],{"class":424},"kind",[414,961,874],{"class":456},[414,963,927],{"class":428},[414,965,930],{"class":432},[414,967,968],{"class":482},"          \u002F\u002F a tool is running\n",[414,970,972,974,976,979,981,983,986,988,990,992,994,996,998,1000],{"class":416,"line":971},10,[414,973,901],{"class":432},[414,975,463],{"class":428},[414,977,978],{"class":466},"card",[414,980,470],{"class":428},[414,982,460],{"class":428},[414,984,985],{"class":446},"     showCard",[414,987,450],{"class":456},[414,989,871],{"class":424},[414,991,388],{"class":428},[414,993,978],{"class":424},[414,995,874],{"class":456},[414,997,927],{"class":428},[414,999,930],{"class":432},[414,1001,1002],{"class":482},"            \u002F\u002F products, an order, tracking\n",[414,1004,1006,1008,1010,1013,1015,1017,1020,1022,1024,1026,1028,1030,1032,1034],{"class":416,"line":1005},11,[414,1007,901],{"class":432},[414,1009,463],{"class":428},[414,1011,1012],{"class":466},"proposal",[414,1014,470],{"class":428},[414,1016,460],{"class":428},[414,1018,1019],{"class":446}," showProposal",[414,1021,450],{"class":456},[414,1023,871],{"class":424},[414,1025,388],{"class":428},[414,1027,1012],{"class":424},[414,1029,874],{"class":456},[414,1031,927],{"class":428},[414,1033,930],{"class":432},[414,1035,1036],{"class":482},"    \u002F\u002F a return to confirm\n",[414,1038,1040,1042,1044,1047,1049,1051,1054],{"class":416,"line":1039},12,[414,1041,901],{"class":432},[414,1043,463],{"class":428},[414,1045,1046],{"class":466},"handover",[414,1048,470],{"class":428},[414,1050,460],{"class":428},[414,1052,1053],{"class":482}," \u002F* a person takes over *\u002F",[414,1055,1056],{"class":432}," break\n",[414,1058,1060,1062,1064,1067,1069,1071,1074],{"class":416,"line":1059},13,[414,1061,901],{"class":432},[414,1063,463],{"class":428},[414,1065,1066],{"class":466},"queued",[414,1068,470],{"class":428},[414,1070,460],{"class":428},[414,1072,1073],{"class":482},"   \u002F* a person answers; the message was saved *\u002F",[414,1075,1056],{"class":432},[414,1077,1079,1081,1083,1086,1088,1090,1093],{"class":416,"line":1078},14,[414,1080,901],{"class":432},[414,1082,463],{"class":428},[414,1084,1085],{"class":466},"done",[414,1087,470],{"class":428},[414,1089,460],{"class":428},[414,1091,1092],{"class":482},"     \u002F* the turn is over: event.status *\u002F",[414,1094,1056],{"class":432},[414,1096,1098,1100,1102,1105,1107,1109,1112],{"class":416,"line":1097},15,[414,1099,901],{"class":432},[414,1101,463],{"class":428},[414,1103,1104],{"class":466},"error",[414,1106,470],{"class":428},[414,1108,460],{"class":428},[414,1110,1111],{"class":482},"    \u002F* event.errorCode, event.message *\u002F",[414,1113,1056],{"class":432},[414,1115,1117],{"class":416,"line":1116},16,[414,1118,1119],{"class":428},"    }\n",[414,1121,1123],{"class":416,"line":1122},17,[414,1124,1125],{"class":428},"  },\n",[414,1127,1129,1131],{"class":416,"line":1128},18,[414,1130,584],{"class":428},[414,1132,476],{"class":424},[414,1134,1136],{"class":416,"line":1135},19,[414,1137,1138],{"class":482},"\u002F\u002F → { status, error, aborted }\n",[363,1140,1141,1142,1145],{},"The answer is streamed as Server-Sent Events over a ",[367,1143,1144],{},"fetch"," POST, so it works in browsers and Node 18+. The client's request timeout covers only the wait for the response to start; once the answer streams it runs until the server ends it or you abort.",[1147,1148,1149,1157,1170,1180,1210,1219],"ul",{},[1150,1151,1152,1153,1156],"li",{},"Messages are at most 1000 characters (",[367,1154,1155],{},"400 MESSAGE_TOO_LONG",").",[1150,1158,1159,1160,1163,1164,1166,1167,388],{},"Errors before the stream starts (validation, a wrong token, rate limits) reject with ",[367,1161,1162],{},"StorefrontApiError",". A failure during the turn arrives as an ",[367,1165,1104],{}," event and in ",[367,1168,1169],{},"result.error",[1150,1171,1172,1175,1176,1179],{},[367,1173,1174],{},"controller.abort()"," stops the answer. The promise resolves with ",[367,1177,1178],{},"aborted: true","; the text received so far is yours to keep.",[1150,1181,1182,1185,1186,722,1189,722,1192,722,1195,722,1198,722,1201,722,1203,722,1206,1209],{},[367,1183,1184],{},"activity.kind"," is one of ",[367,1187,1188],{},"knowledge",[367,1190,1191],{},"products",[367,1193,1194],{},"verify",[367,1196,1197],{},"order",[367,1199,1200],{},"returns",[367,1202,1046],{},[367,1204,1205],{},"contact",[367,1207,1208],{},"working",". Map it to a short line in your own language, such as \"Fetching your order\".",[1150,1211,1212,1213,1215,1216,1218],{},"Text after an ",[367,1214,943],{}," belongs to a new message: the server stores the text before and after a tool call as separate messages. A ",[367,1217,978],{}," belongs to the message of the same round (the text just before the tool, or a message of its own when there was none), and text after a card is a new message.",[1150,1220,1221],{},"Streamed text has no message ids. Read the conversation afterwards when you need them.",[400,1223,1225],{"id":1224},"read-the-conversation","Read the conversation",[405,1227,1229],{"className":407,"code":1228,"language":409,"meta":410,"style":410},"const conversation = await client.assistant.getConversation(conversationId, token)\n\u002F\u002F → { id, status, messages, proposals, verifiedOrderNumber }\n\n\u002F\u002F Only messages newer than a time (the newest message's createdAt)\nconst fresh = await client.assistant.getConversation(conversationId, token, { after: lastCreatedAt })\n",[367,1230,1231,1259,1264,1268,1273],{"__ignoreMap":410},[414,1232,1233,1235,1237,1239,1241,1243,1245,1247,1249,1252,1254,1256],{"class":416,"line":417},[414,1234,421],{"class":420},[414,1236,581],{"class":424},[414,1238,429],{"class":428},[414,1240,433],{"class":432},[414,1242,436],{"class":424},[414,1244,388],{"class":428},[414,1246,441],{"class":424},[414,1248,388],{"class":428},[414,1250,1251],{"class":446},"getConversation",[414,1253,790],{"class":424},[414,1255,573],{"class":428},[414,1257,1258],{"class":424}," token)\n",[414,1260,1261],{"class":416,"line":479},[414,1262,1263],{"class":482},"\u002F\u002F → { id, status, messages, proposals, verifiedOrderNumber }\n",[414,1265,1266],{"class":416,"line":486},[414,1267,765],{"emptyLinePlaceholder":764},[414,1269,1270],{"class":416,"line":492},[414,1271,1272],{"class":482},"\u002F\u002F Only messages newer than a time (the newest message's createdAt)\n",[414,1274,1275,1277,1280,1282,1284,1286,1288,1290,1292,1294,1296,1298,1300,1302,1304,1307,1309,1312,1314],{"class":416,"line":498},[414,1276,421],{"class":420},[414,1278,1279],{"class":424}," fresh ",[414,1281,429],{"class":428},[414,1283,433],{"class":432},[414,1285,436],{"class":424},[414,1287,388],{"class":428},[414,1289,441],{"class":424},[414,1291,388],{"class":428},[414,1293,1251],{"class":446},[414,1295,790],{"class":424},[414,1297,573],{"class":428},[414,1299,576],{"class":424},[414,1301,573],{"class":428},[414,1303,567],{"class":428},[414,1305,1306],{"class":456}," after",[414,1308,460],{"class":428},[414,1310,1311],{"class":424}," lastCreatedAt ",[414,1313,584],{"class":428},[414,1315,476],{"class":424},[363,1317,1318,1319,1322,1323,1326,1327,1330,1331,1333],{},"Messages are ",[367,1320,1321],{},"{ id, role: 'user' | 'assistant' | 'staff', content, author, cards?, attachments?, createdAt }",". ",[367,1324,1325],{},"author"," is the staff member's name on ",[367,1328,1329],{},"staff"," messages. ",[367,1332,922],{}," can be empty: an assistant message may carry only cards, and a shopper's message only photos.",[363,1335,1336,1339],{},[367,1337,1338],{},"status"," says who answers:",[1341,1342,1343,1356],"table",{},[1344,1345,1346],"thead",{},[1347,1348,1349,1353],"tr",{},[1350,1351,1352],"th",{},"Status",[1350,1354,1355],{},"Meaning",[1357,1358,1359,1370,1380,1390],"tbody",{},[1347,1360,1361,1367],{},[1362,1363,1364],"td",{},[367,1365,1366],{},"bot",[1362,1368,1369],{},"The assistant answers",[1347,1371,1372,1377],{},[1362,1373,1374],{},[367,1375,1376],{},"waiting",[1362,1378,1379],{},"Handed over, waiting for a person",[1347,1381,1382,1387],{},[1362,1383,1384],{},[367,1385,1386],{},"human",[1362,1388,1389],{},"A person from the shop answers",[1347,1391,1392,1397],{},[1362,1393,1394],{},[367,1395,1396],{},"closed",[1362,1398,1399],{},"Ended by the shop, no new messages",[363,1401,1402,1403,1405,1406,1408,1409,1412],{},"While the status is ",[367,1404,1376],{}," or ",[367,1407,1386],{},", poll with ",[367,1410,1411],{},"after"," (every 4 seconds while the chat is open) to receive the staff's replies.",[400,1414,1416],{"id":1415},"cards","Cards",[363,1418,1419,1420,1422,1423,1426,1427,1429],{},"The assistant shows products, orders and deliveries as cards instead of writing prices and tracking numbers in its text. The server builds them from the shop's own data (with the same price visibility rules as the storefront); the model only picks what to show. They arrive as ",[367,1421,978],{}," events while streaming and in ",[367,1424,1425],{},"message.cards"," when the conversation is read. Switch on ",[367,1428,891],{}," and skip types you do not know.",[1341,1431,1432,1443],{},[1344,1433,1434],{},[1347,1435,1436,1440],{},[1350,1437,1438],{},[367,1439,891],{},[1350,1441,1442],{},"Fields",[1357,1444,1445,1475,1486,1502],{},[1347,1446,1447,1451],{},[1362,1448,1449],{},[367,1450,1191],{},[1362,1452,1453,1322,1456,1459,1460,1463,1464,1467,1468,1471,1472,1474],{},[367,1454,1455],{},"items[{ sku, name, imageUrl, price, listPrice, currency, url, rating }]",[367,1457,1458],{},"price"," is ",[367,1461,1462],{},"null"," when the shop shows prices only to signed-in customers; ",[367,1465,1466],{},"listPrice"," is set only when discounted; ",[367,1469,1470],{},"url"," comes from the shop's product URL template, or ",[367,1473,1462],{},". At most 6.",[1347,1476,1477,1481],{},[1362,1478,1479],{},[367,1480,1197],{},[1362,1482,1483],{},[367,1484,1485],{},"orderNumber, orderDate, paymentStatus, shipmentStatus, total, currency, lines[{ name, sku, quantity, returned, imageUrl }]",[1347,1487,1488,1493],{},[1362,1489,1490],{},[367,1491,1492],{},"tracking",[1362,1494,1495,1322,1498,1501],{},[367,1496,1497],{},"orderNumber, shipmentStatus, shipments[{ carrier, trackingNumber, trackingUrl, shippedDate, status }], deliveries[{ status, deliveryDate, carrier }]",[367,1499,1500],{},"trackingUrl"," is always http(s) when set.",[1347,1503,1504,1509],{},[1362,1505,1506],{},[367,1507,1508],{},"return",[1362,1510,1511,1514],{},[367,1512,1513],{},"returnNumber, returnType: 'return' | 'claim', lines[{ name, quantity }]",". Added to the assistant's reply after a confirmed proposal.",[405,1516,1518],{"className":407,"code":1517,"language":409,"meta":410,"style":410},"import type { AssistantCard } from '@avvyr\u002Fstorefront-sdk'\n\nfunction render(card: AssistantCard) {\n  switch (card.type) {\n    case 'products': return card.items.map((p) => p.name)\n    case 'tracking': return card.shipments.map((s) => s.trackingUrl)\n    \u002F\u002F ...\n  }\n}\n",[367,1519,1520,1546,1550,1571,1588,1638,1683,1688,1693],{"__ignoreMap":410},[414,1521,1522,1525,1528,1530,1533,1535,1538,1540,1543],{"class":416,"line":417},[414,1523,1524],{"class":432},"import",[414,1526,1527],{"class":432}," type",[414,1529,567],{"class":428},[414,1531,1532],{"class":424}," AssistantCard",[414,1534,473],{"class":428},[414,1536,1537],{"class":432}," from",[414,1539,463],{"class":428},[414,1541,1542],{"class":466},"@avvyr\u002Fstorefront-sdk",[414,1544,1545],{"class":428},"'\n",[414,1547,1548],{"class":416,"line":479},[414,1549,765],{"emptyLinePlaceholder":764},[414,1551,1552,1555,1558,1560,1562,1564,1567,1569],{"class":416,"line":486},[414,1553,1554],{"class":420},"function",[414,1556,1557],{"class":446}," render",[414,1559,450],{"class":428},[414,1561,978],{"class":870},[414,1563,460],{"class":428},[414,1565,1532],{"class":1566},"sBMFI",[414,1568,874],{"class":428},[414,1570,808],{"class":428},[414,1572,1573,1576,1578,1580,1582,1584,1586],{"class":416,"line":492},[414,1574,1575],{"class":432},"  switch",[414,1577,884],{"class":456},[414,1579,978],{"class":424},[414,1581,388],{"class":428},[414,1583,891],{"class":424},[414,1585,894],{"class":456},[414,1587,605],{"class":428},[414,1589,1590,1593,1595,1597,1599,1601,1604,1607,1609,1612,1614,1617,1619,1621,1623,1625,1628,1631,1633,1636],{"class":416,"line":498},[414,1591,1592],{"class":432},"    case",[414,1594,463],{"class":428},[414,1596,1191],{"class":466},[414,1598,470],{"class":428},[414,1600,460],{"class":428},[414,1602,1603],{"class":432}," return",[414,1605,1606],{"class":424}," card",[414,1608,388],{"class":428},[414,1610,1611],{"class":424},"items",[414,1613,388],{"class":428},[414,1615,1616],{"class":446},"map",[414,1618,450],{"class":456},[414,1620,450],{"class":428},[414,1622,363],{"class":870},[414,1624,874],{"class":428},[414,1626,1627],{"class":420}," =>",[414,1629,1630],{"class":424}," p",[414,1632,388],{"class":428},[414,1634,1635],{"class":424},"name",[414,1637,476],{"class":456},[414,1639,1640,1642,1644,1646,1648,1650,1652,1654,1656,1659,1661,1663,1665,1667,1670,1672,1674,1677,1679,1681],{"class":416,"line":504},[414,1641,1592],{"class":432},[414,1643,463],{"class":428},[414,1645,1492],{"class":466},[414,1647,470],{"class":428},[414,1649,460],{"class":428},[414,1651,1603],{"class":432},[414,1653,1606],{"class":424},[414,1655,388],{"class":428},[414,1657,1658],{"class":424},"shipments",[414,1660,388],{"class":428},[414,1662,1616],{"class":446},[414,1664,450],{"class":456},[414,1666,450],{"class":428},[414,1668,1669],{"class":870},"s",[414,1671,874],{"class":428},[414,1673,1627],{"class":420},[414,1675,1676],{"class":424}," s",[414,1678,388],{"class":428},[414,1680,1500],{"class":424},[414,1682,476],{"class":456},[414,1684,1685],{"class":416,"line":513},[414,1686,1687],{"class":482},"    \u002F\u002F ...\n",[414,1689,1690],{"class":416,"line":519},[414,1691,1692],{"class":428},"  }\n",[414,1694,1695],{"class":416,"line":936},[414,1696,1697],{"class":428},"}\n",[400,1699,1701],{"id":1700},"photos","Photos",[363,1703,1704,1705,1708],{},"When ",[367,1706,1707],{},"config.attachments.enabled"," is true the shopper may attach photos, for example of a damaged item. Upload them first, then send the message with their ids:",[405,1710,1712],{"className":407,"code":1711,"language":409,"meta":410,"style":410},"const input = document.querySelector\u003CHTMLInputElement>('input[type=file]')!\nconst { attachments } = await client.assistant.uploadAttachments(conversationId, token, [...input.files!])\n\u002F\u002F → [{ id, url, thumbnailUrl }]\n\nawait client.assistant.sendMessage(conversationId, token, '', {\n  attachmentIds: attachments.map((a) => a.id),\n  onEvent,\n})\n",[367,1713,1714,1754,1808,1813,1817,1847,1881,1887],{"__ignoreMap":410},[414,1715,1716,1718,1721,1723,1726,1728,1731,1734,1737,1740,1742,1744,1747,1749,1751],{"class":416,"line":417},[414,1717,421],{"class":420},[414,1719,1720],{"class":424}," input ",[414,1722,429],{"class":428},[414,1724,1725],{"class":424}," document",[414,1727,388],{"class":428},[414,1729,1730],{"class":446},"querySelector",[414,1732,1733],{"class":428},"\u003C",[414,1735,1736],{"class":1566},"HTMLInputElement",[414,1738,1739],{"class":428},">",[414,1741,450],{"class":424},[414,1743,470],{"class":428},[414,1745,1746],{"class":466},"input[type=file]",[414,1748,470],{"class":428},[414,1750,874],{"class":424},[414,1752,1753],{"class":428},"!\n",[414,1755,1756,1758,1760,1763,1765,1767,1769,1771,1773,1775,1777,1780,1782,1784,1786,1788,1791,1794,1797,1799,1802,1805],{"class":416,"line":479},[414,1757,421],{"class":420},[414,1759,567],{"class":428},[414,1761,1762],{"class":424}," attachments ",[414,1764,584],{"class":428},[414,1766,587],{"class":428},[414,1768,433],{"class":432},[414,1770,436],{"class":424},[414,1772,388],{"class":428},[414,1774,441],{"class":424},[414,1776,388],{"class":428},[414,1778,1779],{"class":446},"uploadAttachments",[414,1781,790],{"class":424},[414,1783,573],{"class":428},[414,1785,576],{"class":424},[414,1787,573],{"class":428},[414,1789,1790],{"class":424}," [",[414,1792,1793],{"class":428},"...",[414,1795,1796],{"class":424},"input",[414,1798,388],{"class":428},[414,1800,1801],{"class":424},"files",[414,1803,1804],{"class":428},"!",[414,1806,1807],{"class":424},"])\n",[414,1809,1810],{"class":416,"line":486},[414,1811,1812],{"class":482},"\u002F\u002F → [{ id, url, thumbnailUrl }]\n",[414,1814,1815],{"class":416,"line":492},[414,1816,765],{"emptyLinePlaceholder":764},[414,1818,1819,1822,1824,1826,1828,1830,1832,1834,1836,1838,1840,1843,1845],{"class":416,"line":498},[414,1820,1821],{"class":432},"await",[414,1823,436],{"class":424},[414,1825,388],{"class":428},[414,1827,441],{"class":424},[414,1829,388],{"class":428},[414,1831,787],{"class":446},[414,1833,790],{"class":424},[414,1835,573],{"class":428},[414,1837,576],{"class":424},[414,1839,573],{"class":428},[414,1841,1842],{"class":428}," ''",[414,1844,573],{"class":428},[414,1846,808],{"class":428},[414,1848,1849,1852,1854,1857,1859,1861,1863,1865,1867,1869,1871,1874,1876,1879],{"class":416,"line":504},[414,1850,1851],{"class":456},"  attachmentIds",[414,1853,460],{"class":428},[414,1855,1856],{"class":424}," attachments",[414,1858,388],{"class":428},[414,1860,1616],{"class":446},[414,1862,450],{"class":424},[414,1864,450],{"class":428},[414,1866,397],{"class":870},[414,1868,874],{"class":428},[414,1870,1627],{"class":420},[414,1872,1873],{"class":424}," a",[414,1875,388],{"class":428},[414,1877,1878],{"class":424},"id)",[414,1880,826],{"class":428},[414,1882,1883,1885],{"class":416,"line":513},[414,1884,865],{"class":424},[414,1886,826],{"class":428},[414,1888,1889,1891],{"class":416,"line":519},[414,1890,584],{"class":428},[414,1892,476],{"class":424},[1147,1894,1895,1912,1929,1936,1943],{},[1150,1896,1897,1898,722,1901,722,1904,1907,1908,1911],{},"jpeg, png or webp, at most 5 MB each, 3 per upload and per message, 6 per conversation (",[367,1899,1900],{},"422 UNSUPPORTED_FILE_TYPE",[367,1902,1903],{},"FILE_TOO_LARGE",[367,1905,1906],{},"TOO_MANY_ATTACHMENTS","; ",[367,1909,1910],{},"403 ATTACHMENTS_DISABLED"," when the shop has photos off). Check type and size before uploading to give the shopper a quicker answer.",[1150,1913,1914,1916,1917,1920,1921,1924,1925,1928],{},[367,1915,1801],{}," are ",[367,1918,1919],{},"File","s or plain ",[367,1922,1923],{},"Blob","s (Node 18+ too). A blob without a name is sent as ",[367,1926,1927],{},"photo-1.jpg"," and so on.",[1150,1930,1931,1932,1935],{},"With photos the message text may be empty. Without ",[367,1933,1934],{},"attachmentIds",", the message takes every photo uploaded since the last message.",[1150,1937,1938,1939,1942],{},"The server re-encodes the photos to webp without metadata. They show on the shopper's message as ",[367,1940,1941],{},"attachments[{ id, url, thumbnailUrl }]",". If the shopper approves a claim, the conversation's photos move to the return when the shop's return settings take attachments.",[1150,1944,1945,1946,1949],{},"The upload is a normal request and has the client's timeout (10 seconds by default). Raise ",[367,1947,1948],{},"timeout"," when creating the client if your shoppers upload large photos on slow connections.",[400,1951,1953],{"id":1952},"talk-to-a-human","Talk to a human",[405,1955,1957],{"className":407,"code":1956,"language":409,"meta":410,"style":410},"const conversation = await client.assistant.requestHandover(conversationId, token, {\n  name: 'Anna',              \u002F\u002F optional\n  email: 'anna@example.com', \u002F\u002F optional, lets the shop answer by e-mail\n  message: 'I need help with my delivery', \u002F\u002F optional\n})\n",[367,1958,1959,1990,2009,2028,2046],{"__ignoreMap":410},[414,1960,1961,1963,1965,1967,1969,1971,1973,1975,1977,1980,1982,1984,1986,1988],{"class":416,"line":417},[414,1962,421],{"class":420},[414,1964,581],{"class":424},[414,1966,429],{"class":428},[414,1968,433],{"class":432},[414,1970,436],{"class":424},[414,1972,388],{"class":428},[414,1974,441],{"class":424},[414,1976,388],{"class":428},[414,1978,1979],{"class":446},"requestHandover",[414,1981,790],{"class":424},[414,1983,573],{"class":428},[414,1985,576],{"class":424},[414,1987,573],{"class":428},[414,1989,808],{"class":428},[414,1991,1992,1995,1997,1999,2002,2004,2006],{"class":416,"line":479},[414,1993,1994],{"class":456},"  name",[414,1996,460],{"class":428},[414,1998,463],{"class":428},[414,2000,2001],{"class":466},"Anna",[414,2003,470],{"class":428},[414,2005,573],{"class":428},[414,2007,2008],{"class":482},"              \u002F\u002F optional\n",[414,2010,2011,2014,2016,2018,2021,2023,2025],{"class":416,"line":486},[414,2012,2013],{"class":456},"  email",[414,2015,460],{"class":428},[414,2017,463],{"class":428},[414,2019,2020],{"class":466},"anna@example.com",[414,2022,470],{"class":428},[414,2024,573],{"class":428},[414,2026,2027],{"class":482}," \u002F\u002F optional, lets the shop answer by e-mail\n",[414,2029,2030,2033,2035,2037,2040,2042,2044],{"class":416,"line":492},[414,2031,2032],{"class":456},"  message",[414,2034,460],{"class":428},[414,2036,463],{"class":428},[414,2038,2039],{"class":466},"I need help with my delivery",[414,2041,470],{"class":428},[414,2043,573],{"class":428},[414,2045,689],{"class":482},[414,2047,2048,2050],{"class":416,"line":498},[414,2049,584],{"class":428},[414,2051,476],{"class":424},[363,2053,2054,2055,2058,2059,2062,2063,2065],{},"Available when ",[367,2056,2057],{},"config.capabilities.handover"," is true (otherwise ",[367,2060,2061],{},"403 HANDOVER_DISABLED","). Calling it again while the conversation is already ",[367,2064,1376],{}," saves the contact details and message without a second handover.",[400,2067,2069],{"id":2068},"return-proposals","Return proposals",[363,2071,2072],{},"The assistant never creates a return on its own. It prepares a proposal and the shopper confirms it:",[405,2074,2076],{"className":407,"code":2075,"language":409,"meta":410,"style":410},"\u002F\u002F proposal.summary → { orderNumber, returnType: 'return' | 'claim', lines[{ name, quantity, reason }], claimTerms, customerMessage }\n\nawait client.assistant.confirmProposal(conversationId, token, proposal.id, {\n  termsAccepted: true, \u002F\u002F required when summary.claimTerms is set and the shopper ticked them\n})\n\u002F\u002F → { proposal, reply, conversation }\n\nawait client.assistant.rejectProposal(conversationId, token, proposal.id)\n\u002F\u002F → the proposal, status 'rejected'\n",[367,2077,2078,2083,2087,2122,2138,2144,2149,2153,2183],{"__ignoreMap":410},[414,2079,2080],{"class":416,"line":417},[414,2081,2082],{"class":482},"\u002F\u002F proposal.summary → { orderNumber, returnType: 'return' | 'claim', lines[{ name, quantity, reason }], claimTerms, customerMessage }\n",[414,2084,2085],{"class":416,"line":479},[414,2086,765],{"emptyLinePlaceholder":764},[414,2088,2089,2091,2093,2095,2097,2099,2102,2104,2106,2108,2110,2113,2115,2118,2120],{"class":416,"line":486},[414,2090,1821],{"class":432},[414,2092,436],{"class":424},[414,2094,388],{"class":428},[414,2096,441],{"class":424},[414,2098,388],{"class":428},[414,2100,2101],{"class":446},"confirmProposal",[414,2103,790],{"class":424},[414,2105,573],{"class":428},[414,2107,576],{"class":424},[414,2109,573],{"class":428},[414,2111,2112],{"class":424}," proposal",[414,2114,388],{"class":428},[414,2116,2117],{"class":424},"id",[414,2119,573],{"class":428},[414,2121,808],{"class":428},[414,2123,2124,2127,2129,2133,2135],{"class":416,"line":492},[414,2125,2126],{"class":456},"  termsAccepted",[414,2128,460],{"class":428},[414,2130,2132],{"class":2131},"sfNiH"," true",[414,2134,573],{"class":428},[414,2136,2137],{"class":482}," \u002F\u002F required when summary.claimTerms is set and the shopper ticked them\n",[414,2139,2140,2142],{"class":416,"line":498},[414,2141,584],{"class":428},[414,2143,476],{"class":424},[414,2145,2146],{"class":416,"line":504},[414,2147,2148],{"class":482},"\u002F\u002F → { proposal, reply, conversation }\n",[414,2150,2151],{"class":416,"line":513},[414,2152,765],{"emptyLinePlaceholder":764},[414,2154,2155,2157,2159,2161,2163,2165,2168,2170,2172,2174,2176,2178,2180],{"class":416,"line":519},[414,2156,1821],{"class":432},[414,2158,436],{"class":424},[414,2160,388],{"class":428},[414,2162,441],{"class":424},[414,2164,388],{"class":428},[414,2166,2167],{"class":446},"rejectProposal",[414,2169,790],{"class":424},[414,2171,573],{"class":428},[414,2173,576],{"class":424},[414,2175,573],{"class":428},[414,2177,2112],{"class":424},[414,2179,388],{"class":428},[414,2181,2182],{"class":424},"id)\n",[414,2184,2185],{"class":416,"line":936},[414,2186,2187],{"class":482},"\u002F\u002F → the proposal, status 'rejected'\n",[363,2189,2190,1459,2192,722,2195,722,2197,722,2200,1405,2203,2206,2207,2210,2211,2214,2215,2218,2219,388],{},[367,2191,1338],{},[367,2193,2194],{},"pending",[367,2196,1085],{},[367,2198,2199],{},"failed",[367,2201,2202],{},"rejected",[367,2204,2205],{},"expired",". A pending proposal expires at ",[367,2208,2209],{},"expiresAt"," (30 minutes), and a newer proposal replaces older pending ones. A confirmed proposal's ",[367,2212,2213],{},"result.returnNumber"," is the return's number. Confirming twice, or after expiry, answers ",[367,2216,2217],{},"409 PROPOSAL_NOT_PENDING"," \u002F ",[367,2220,2221],{},"PROPOSAL_EXPIRED",[400,2223,2225],{"id":2224},"reading-other-streams","Reading other streams",[363,2227,2228],{},"The SSE reader is exported for any streamed endpoint:",[405,2230,2232],{"className":407,"code":2231,"language":409,"meta":410,"style":410},"import { readSseStream, createSseReader } from '@avvyr\u002Fstorefront-sdk'\n\nawait readSseStream(response.body, (data) => console.log(JSON.parse(data)))\n",[367,2233,2234,2258,2262],{"__ignoreMap":410},[414,2235,2236,2238,2240,2243,2245,2248,2250,2252,2254,2256],{"class":416,"line":417},[414,2237,1524],{"class":432},[414,2239,567],{"class":428},[414,2241,2242],{"class":424}," readSseStream",[414,2244,573],{"class":428},[414,2246,2247],{"class":424}," createSseReader",[414,2249,473],{"class":428},[414,2251,1537],{"class":432},[414,2253,463],{"class":428},[414,2255,1542],{"class":466},[414,2257,1545],{"class":428},[414,2259,2260],{"class":416,"line":479},[414,2261,765],{"emptyLinePlaceholder":764},[414,2263,2264,2266,2268,2271,2273,2276,2278,2280,2283,2285,2287,2290,2292,2295,2298,2300,2303],{"class":416,"line":486},[414,2265,1821],{"class":432},[414,2267,2242],{"class":446},[414,2269,2270],{"class":424},"(response",[414,2272,388],{"class":428},[414,2274,2275],{"class":424},"body",[414,2277,573],{"class":428},[414,2279,884],{"class":428},[414,2281,2282],{"class":870},"data",[414,2284,874],{"class":428},[414,2286,1627],{"class":420},[414,2288,2289],{"class":424}," console",[414,2291,388],{"class":428},[414,2293,2294],{"class":446},"log",[414,2296,2297],{"class":424},"(JSON",[414,2299,388],{"class":428},[414,2301,2302],{"class":446},"parse",[414,2304,2305],{"class":424},"(data)))\n",[2307,2308,2309],"style",{},"html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sfNiH, html code.shiki .sfNiH{--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC}",{"title":410,"searchDepth":479,"depth":479,"links":2311},[2312,2313,2316,2317,2318,2319,2320,2321,2322],{"id":402,"depth":479,"text":403},{"id":554,"depth":479,"text":555,"children":2314},[2315],{"id":709,"depth":486,"text":710},{"id":735,"depth":479,"text":736},{"id":1224,"depth":479,"text":1225},{"id":1415,"depth":479,"text":1416},{"id":1700,"depth":479,"text":1701},{"id":1952,"depth":479,"text":1953},{"id":2068,"depth":479,"text":2069},{"id":2224,"depth":479,"text":2225},"The shop's chat. Conversations, streamed answers, cards, photos, return proposals and handover to staff","md",null,{"questions":2327},{"en":2328},[2329,2330,2331,2332],"How do I start a conversation and stream the answer?","How do I let the shopper attach photos?","How do I hand the conversation over to staff?","How do I confirm a return proposal?",{"title":316,"description":2323},"7qsFWmZWKTrOPVqtuPSpZRM-QVJDFkaq_fZhWGmKjoc",[2336,2338],{"title":312,"path":313,"stem":314,"description":2337,"children":-1},"Order history, self-service returns, and product reviews",{"title":320,"path":321,"stem":322,"description":2339,"children":-1},"Shoppable images. Hotspots that link the products shown in a photo",1793388941237]