@wix/web5-core 1.63.39 → 1.63.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -6,79 +6,103 @@ exports.resolveErrorTemplate = exports.DEFAULT_ERROR_TEMPLATES = void 0;
|
|
|
6
6
|
|
|
7
7
|
/** Icon identifiers for error templates — resolved to SVG components by the rendering component */
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* The eleven error types collapse into five states a shopper can act on
|
|
11
|
+
* (B2B-4615). Each state has one job, so each has one line and at most one
|
|
12
|
+
* action:
|
|
13
|
+
*
|
|
14
|
+
* A · No answer — llm-error-text, llm-empty-response
|
|
15
|
+
* B · Interrupted — 500, generic-network-error, timeout, streaming-error,
|
|
16
|
+
* history-load-error
|
|
17
|
+
* C · Fresh start — 403, 404
|
|
18
|
+
* D · Partial — partial-load
|
|
19
|
+
* E · Quota — 429
|
|
20
|
+
*
|
|
21
|
+
* `iconType` stays on every template that had one: the new design drops icons,
|
|
22
|
+
* but w5-client-circana and w5-client-feature-com still read the field and
|
|
23
|
+
* must keep the look they have.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
const retryButton = [{
|
|
27
|
+
text: 'Try again',
|
|
11
28
|
action: 'retry',
|
|
12
29
|
variant: 'cta'
|
|
13
|
-
}, {
|
|
14
|
-
text: 'Contact Us',
|
|
15
|
-
variant: 'link'
|
|
16
30
|
}];
|
|
31
|
+
|
|
32
|
+
/** A · No answer — nothing to retry, so it offers somewhere else to go. */
|
|
33
|
+
const noAnswerTemplate = {
|
|
34
|
+
title: "I can't help with that one \u2014 but I can help with these.",
|
|
35
|
+
showChips: true
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** B · Interrupted — the message is still there to send again. */
|
|
39
|
+
const interruptedTitle = "That didn't come through. Let's try again.";
|
|
40
|
+
|
|
41
|
+
/** C · Fresh start — the thread is gone; hand the conversation back. */
|
|
42
|
+
const freshStartTemplate = {
|
|
43
|
+
title: "We're starting fresh \u2014 earlier messages aren't saved.",
|
|
44
|
+
showChips: true,
|
|
45
|
+
chipsLabel: 'Ask anything to pick up again'
|
|
46
|
+
};
|
|
17
47
|
const DEFAULT_ERROR_TEMPLATES = exports.DEFAULT_ERROR_TEMPLATES = {
|
|
18
|
-
'conversation-llm-error-text':
|
|
19
|
-
|
|
20
|
-
showChips: true
|
|
21
|
-
},
|
|
22
|
-
'conversation-llm-empty-response': {
|
|
23
|
-
title: "I couldn't find information about what you asked.\nTry asking about a different topic.",
|
|
24
|
-
showChips: true
|
|
25
|
-
},
|
|
48
|
+
'conversation-llm-error-text': noAnswerTemplate,
|
|
49
|
+
'conversation-llm-empty-response': noAnswerTemplate,
|
|
26
50
|
'conversation-500': {
|
|
27
51
|
iconType: 'error-500',
|
|
28
|
-
title:
|
|
29
|
-
buttons:
|
|
52
|
+
title: interruptedTitle,
|
|
53
|
+
buttons: retryButton
|
|
30
54
|
},
|
|
31
55
|
'conversation-generic-network-error': {
|
|
32
56
|
iconType: 'timeout',
|
|
33
|
-
title:
|
|
34
|
-
buttons:
|
|
57
|
+
title: interruptedTitle,
|
|
58
|
+
buttons: retryButton
|
|
35
59
|
},
|
|
36
60
|
'conversation-timeout': {
|
|
37
61
|
iconType: 'timeout',
|
|
38
|
-
title:
|
|
39
|
-
buttons:
|
|
62
|
+
title: interruptedTitle,
|
|
63
|
+
buttons: retryButton
|
|
40
64
|
},
|
|
41
65
|
'conversation-streaming-error': {
|
|
42
66
|
iconType: 'streaming-error',
|
|
43
|
-
title:
|
|
44
|
-
buttons:
|
|
67
|
+
title: interruptedTitle,
|
|
68
|
+
buttons: retryButton
|
|
45
69
|
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
70
|
+
// Same state as the four above, deliberately not the same action: a history
|
|
71
|
+
// load fails before there is a last message, so `retry` has nothing to
|
|
72
|
+
// re-send and would sit there doing nothing.
|
|
73
|
+
'history-load-error': {
|
|
74
|
+
iconType: 'streaming-error',
|
|
75
|
+
title: interruptedTitle,
|
|
76
|
+
buttons: [{
|
|
77
|
+
text: 'Try again',
|
|
78
|
+
action: 'reload',
|
|
79
|
+
variant: 'cta'
|
|
80
|
+
}]
|
|
51
81
|
},
|
|
52
82
|
'conversation-403': {
|
|
53
83
|
iconType: 'forbidden',
|
|
54
|
-
|
|
55
|
-
showChips: true,
|
|
56
|
-
chipsLabel: 'Some ideas to get you started:'
|
|
84
|
+
...freshStartTemplate
|
|
57
85
|
},
|
|
58
|
-
'conversation-
|
|
59
|
-
iconType: '
|
|
60
|
-
|
|
61
|
-
buttons: [{
|
|
62
|
-
text: 'Contact Us',
|
|
63
|
-
variant: 'link'
|
|
64
|
-
}]
|
|
86
|
+
'conversation-404': {
|
|
87
|
+
iconType: 'not-found',
|
|
88
|
+
...freshStartTemplate
|
|
65
89
|
},
|
|
90
|
+
// D · Partial — an answer DID render; some of it is missing. This one is
|
|
91
|
+
// appended to the answer rather than replacing it.
|
|
66
92
|
'conversation-partial-load': {
|
|
67
93
|
iconType: 'partial-load',
|
|
68
|
-
title:
|
|
69
|
-
buttons: retryAndContactButtons
|
|
70
|
-
},
|
|
71
|
-
'history-load-error': {
|
|
72
|
-
iconType: 'streaming-error',
|
|
73
|
-
title: 'We couldn\u2019t load this conversation.',
|
|
94
|
+
title: "Some of this didn't load.",
|
|
74
95
|
buttons: [{
|
|
75
|
-
text: '
|
|
76
|
-
action: '
|
|
96
|
+
text: 'Reload',
|
|
97
|
+
action: 'reload',
|
|
77
98
|
variant: 'cta'
|
|
78
|
-
}, {
|
|
79
|
-
text: 'Contact Us',
|
|
80
|
-
variant: 'link'
|
|
81
99
|
}]
|
|
100
|
+
},
|
|
101
|
+
// E · Quota — waiting is the only fix, so the copy asks for time.
|
|
102
|
+
'conversation-429': {
|
|
103
|
+
iconType: 'quota-exceeded',
|
|
104
|
+
title: 'I need a minute to catch up. Try again shortly.',
|
|
105
|
+
buttons: retryButton
|
|
82
106
|
}
|
|
83
107
|
};
|
|
84
108
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["retryButton","text","action","variant","noAnswerTemplate","title","showChips","interruptedTitle","freshStartTemplate","chipsLabel","DEFAULT_ERROR_TEMPLATES","exports","iconType","buttons","resolveErrorTemplate","type","overrides","templates"],"sources":["../../../src/errors/errorTemplates.ts"],"sourcesContent":["import type { ConversationErrorType } from './conversationErrorTypes';\n\n/** Action identifiers for error template buttons — resolved to callbacks by the rendering component */\nexport type ErrorActionType = 'retry' | 'newConversation' | 'reload';\n\n/** Icon identifiers for error templates — resolved to SVG components by the rendering component */\nexport type ErrorIconType =\n | 'error-500'\n | 'timeout'\n | 'streaming-error'\n | 'not-found'\n | 'forbidden'\n | 'partial-load'\n | 'quota-exceeded';\n\nexport interface ErrorTemplateButton {\n text: string;\n /** URL for navigation (renders as a link) */\n href?: string;\n /** Action identifier — component resolves to a callback */\n action?: ErrorActionType;\n variant: 'cta' | 'link';\n}\n\nexport interface ErrorTemplate {\n title: string;\n subtitle?: string;\n /** Icon identifier — component resolves to an SVG */\n iconType?: ErrorIconType;\n buttons?: ErrorTemplateButton[];\n showChips?: boolean;\n chipsLabel?: string;\n}\n\nexport type ErrorTemplateOverrides = Partial<\n Record<ConversationErrorType, ErrorTemplate>\n>;\n\n/**\n * The eleven error types collapse into five states a shopper can act on\n * (B2B-4615). Each state has one job, so each has one line and at most one\n * action:\n *\n * A · No answer — llm-error-text, llm-empty-response\n * B · Interrupted — 500, generic-network-error, timeout, streaming-error,\n * history-load-error\n * C · Fresh start — 403, 404\n * D · Partial — partial-load\n * E · Quota — 429\n *\n * `iconType` stays on every template that had one: the new design drops icons,\n * but w5-client-circana and w5-client-feature-com still read the field and\n * must keep the look they have.\n */\n\nconst retryButton: ErrorTemplateButton[] = [\n { text: 'Try again', action: 'retry', variant: 'cta' },\n];\n\n/** A · No answer — nothing to retry, so it offers somewhere else to go. */\nconst noAnswerTemplate: ErrorTemplate = {\n title: \"I can't help with that one \\u2014 but I can help with these.\",\n showChips: true,\n};\n\n/** B · Interrupted — the message is still there to send again. */\nconst interruptedTitle = \"That didn't come through. Let's try again.\";\n\n/** C · Fresh start — the thread is gone; hand the conversation back. */\nconst freshStartTemplate: ErrorTemplate = {\n title: \"We're starting fresh \\u2014 earlier messages aren't saved.\",\n showChips: true,\n chipsLabel: 'Ask anything to pick up again',\n};\n\nexport const DEFAULT_ERROR_TEMPLATES: Record<\n ConversationErrorType,\n ErrorTemplate\n> = {\n 'conversation-llm-error-text': noAnswerTemplate,\n 'conversation-llm-empty-response': noAnswerTemplate,\n 'conversation-500': {\n iconType: 'error-500',\n title: interruptedTitle,\n buttons: retryButton,\n },\n 'conversation-generic-network-error': {\n iconType: 'timeout',\n title: interruptedTitle,\n buttons: retryButton,\n },\n 'conversation-timeout': {\n iconType: 'timeout',\n title: interruptedTitle,\n buttons: retryButton,\n },\n 'conversation-streaming-error': {\n iconType: 'streaming-error',\n title: interruptedTitle,\n buttons: retryButton,\n },\n // Same state as the four above, deliberately not the same action: a history\n // load fails before there is a last message, so `retry` has nothing to\n // re-send and would sit there doing nothing.\n 'history-load-error': {\n iconType: 'streaming-error',\n title: interruptedTitle,\n buttons: [{ text: 'Try again', action: 'reload', variant: 'cta' }],\n },\n 'conversation-403': { iconType: 'forbidden', ...freshStartTemplate },\n 'conversation-404': { iconType: 'not-found', ...freshStartTemplate },\n // D · Partial — an answer DID render; some of it is missing. This one is\n // appended to the answer rather than replacing it.\n 'conversation-partial-load': {\n iconType: 'partial-load',\n title: \"Some of this didn't load.\",\n buttons: [{ text: 'Reload', action: 'reload', variant: 'cta' }],\n },\n // E · Quota — waiting is the only fix, so the copy asks for time.\n 'conversation-429': {\n iconType: 'quota-exceeded',\n title: 'I need a minute to catch up. Try again shortly.',\n buttons: retryButton,\n },\n};\n\n/** Resolves the error template for a given type, merging client overrides on top of defaults */\nexport const resolveErrorTemplate = (\n type: string,\n overrides?: ErrorTemplateOverrides,\n): ErrorTemplate => {\n const templates = overrides\n ? { ...DEFAULT_ERROR_TEMPLATES, ...overrides }\n : DEFAULT_ERROR_TEMPLATES;\n return (\n templates[type as ConversationErrorType] ??\n templates['conversation-llm-error-text']\n );\n};\n"],"mappings":";;;;AAEA;;AAGA;;AAiCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,WAAkC,GAAG,CACzC;EAAEC,IAAI,EAAE,WAAW;EAAEC,MAAM,EAAE,OAAO;EAAEC,OAAO,EAAE;AAAM,CAAC,CACvD;;AAED;AACA,MAAMC,gBAA+B,GAAG;EACtCC,KAAK,EAAE,8DAA8D;EACrEC,SAAS,EAAE;AACb,CAAC;;AAED;AACA,MAAMC,gBAAgB,GAAG,4CAA4C;;AAErE;AACA,MAAMC,kBAAiC,GAAG;EACxCH,KAAK,EAAE,4DAA4D;EACnEC,SAAS,EAAE,IAAI;EACfG,UAAU,EAAE;AACd,CAAC;AAEM,MAAMC,uBAGZ,GAAAC,OAAA,CAAAD,uBAAA,GAAG;EACF,6BAA6B,EAAEN,gBAAgB;EAC/C,iCAAiC,EAAEA,gBAAgB;EACnD,kBAAkB,EAAE;IAClBQ,QAAQ,EAAE,WAAW;IACrBP,KAAK,EAAEE,gBAAgB;IACvBM,OAAO,EAAEb;EACX,CAAC;EACD,oCAAoC,EAAE;IACpCY,QAAQ,EAAE,SAAS;IACnBP,KAAK,EAAEE,gBAAgB;IACvBM,OAAO,EAAEb;EACX,CAAC;EACD,sBAAsB,EAAE;IACtBY,QAAQ,EAAE,SAAS;IACnBP,KAAK,EAAEE,gBAAgB;IACvBM,OAAO,EAAEb;EACX,CAAC;EACD,8BAA8B,EAAE;IAC9BY,QAAQ,EAAE,iBAAiB;IAC3BP,KAAK,EAAEE,gBAAgB;IACvBM,OAAO,EAAEb;EACX,CAAC;EACD;EACA;EACA;EACA,oBAAoB,EAAE;IACpBY,QAAQ,EAAE,iBAAiB;IAC3BP,KAAK,EAAEE,gBAAgB;IACvBM,OAAO,EAAE,CAAC;MAAEZ,IAAI,EAAE,WAAW;MAAEC,MAAM,EAAE,QAAQ;MAAEC,OAAO,EAAE;IAAM,CAAC;EACnE,CAAC;EACD,kBAAkB,EAAE;IAAES,QAAQ,EAAE,WAAW;IAAE,GAAGJ;EAAmB,CAAC;EACpE,kBAAkB,EAAE;IAAEI,QAAQ,EAAE,WAAW;IAAE,GAAGJ;EAAmB,CAAC;EACpE;EACA;EACA,2BAA2B,EAAE;IAC3BI,QAAQ,EAAE,cAAc;IACxBP,KAAK,EAAE,2BAA2B;IAClCQ,OAAO,EAAE,CAAC;MAAEZ,IAAI,EAAE,QAAQ;MAAEC,MAAM,EAAE,QAAQ;MAAEC,OAAO,EAAE;IAAM,CAAC;EAChE,CAAC;EACD;EACA,kBAAkB,EAAE;IAClBS,QAAQ,EAAE,gBAAgB;IAC1BP,KAAK,EAAE,iDAAiD;IACxDQ,OAAO,EAAEb;EACX;AACF,CAAC;;AAED;AACO,MAAMc,oBAAoB,GAAGA,CAClCC,IAAY,EACZC,SAAkC,KAChB;EAClB,MAAMC,SAAS,GAAGD,SAAS,GACvB;IAAE,GAAGN,uBAAuB;IAAE,GAAGM;EAAU,CAAC,GAC5CN,uBAAuB;EAC3B,OACEO,SAAS,CAACF,IAAI,CAA0B,IACxCE,SAAS,CAAC,6BAA6B,CAAC;AAE5C,CAAC;AAACN,OAAA,CAAAG,oBAAA,GAAAA,oBAAA","ignoreList":[]}
|
|
@@ -2,79 +2,103 @@
|
|
|
2
2
|
|
|
3
3
|
/** Icon identifiers for error templates — resolved to SVG components by the rendering component */
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The eleven error types collapse into five states a shopper can act on
|
|
7
|
+
* (B2B-4615). Each state has one job, so each has one line and at most one
|
|
8
|
+
* action:
|
|
9
|
+
*
|
|
10
|
+
* A · No answer — llm-error-text, llm-empty-response
|
|
11
|
+
* B · Interrupted — 500, generic-network-error, timeout, streaming-error,
|
|
12
|
+
* history-load-error
|
|
13
|
+
* C · Fresh start — 403, 404
|
|
14
|
+
* D · Partial — partial-load
|
|
15
|
+
* E · Quota — 429
|
|
16
|
+
*
|
|
17
|
+
* `iconType` stays on every template that had one: the new design drops icons,
|
|
18
|
+
* but w5-client-circana and w5-client-feature-com still read the field and
|
|
19
|
+
* must keep the look they have.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
const retryButton = [{
|
|
23
|
+
text: 'Try again',
|
|
7
24
|
action: 'retry',
|
|
8
25
|
variant: 'cta'
|
|
9
|
-
}, {
|
|
10
|
-
text: 'Contact Us',
|
|
11
|
-
variant: 'link'
|
|
12
26
|
}];
|
|
27
|
+
|
|
28
|
+
/** A · No answer — nothing to retry, so it offers somewhere else to go. */
|
|
29
|
+
const noAnswerTemplate = {
|
|
30
|
+
title: "I can't help with that one \u2014 but I can help with these.",
|
|
31
|
+
showChips: true
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** B · Interrupted — the message is still there to send again. */
|
|
35
|
+
const interruptedTitle = "That didn't come through. Let's try again.";
|
|
36
|
+
|
|
37
|
+
/** C · Fresh start — the thread is gone; hand the conversation back. */
|
|
38
|
+
const freshStartTemplate = {
|
|
39
|
+
title: "We're starting fresh \u2014 earlier messages aren't saved.",
|
|
40
|
+
showChips: true,
|
|
41
|
+
chipsLabel: 'Ask anything to pick up again'
|
|
42
|
+
};
|
|
13
43
|
export const DEFAULT_ERROR_TEMPLATES = {
|
|
14
|
-
'conversation-llm-error-text':
|
|
15
|
-
|
|
16
|
-
showChips: true
|
|
17
|
-
},
|
|
18
|
-
'conversation-llm-empty-response': {
|
|
19
|
-
title: "I couldn't find information about what you asked.\nTry asking about a different topic.",
|
|
20
|
-
showChips: true
|
|
21
|
-
},
|
|
44
|
+
'conversation-llm-error-text': noAnswerTemplate,
|
|
45
|
+
'conversation-llm-empty-response': noAnswerTemplate,
|
|
22
46
|
'conversation-500': {
|
|
23
47
|
iconType: 'error-500',
|
|
24
|
-
title:
|
|
25
|
-
buttons:
|
|
48
|
+
title: interruptedTitle,
|
|
49
|
+
buttons: retryButton
|
|
26
50
|
},
|
|
27
51
|
'conversation-generic-network-error': {
|
|
28
52
|
iconType: 'timeout',
|
|
29
|
-
title:
|
|
30
|
-
buttons:
|
|
53
|
+
title: interruptedTitle,
|
|
54
|
+
buttons: retryButton
|
|
31
55
|
},
|
|
32
56
|
'conversation-timeout': {
|
|
33
57
|
iconType: 'timeout',
|
|
34
|
-
title:
|
|
35
|
-
buttons:
|
|
58
|
+
title: interruptedTitle,
|
|
59
|
+
buttons: retryButton
|
|
36
60
|
},
|
|
37
61
|
'conversation-streaming-error': {
|
|
38
62
|
iconType: 'streaming-error',
|
|
39
|
-
title:
|
|
40
|
-
buttons:
|
|
63
|
+
title: interruptedTitle,
|
|
64
|
+
buttons: retryButton
|
|
41
65
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
66
|
+
// Same state as the four above, deliberately not the same action: a history
|
|
67
|
+
// load fails before there is a last message, so `retry` has nothing to
|
|
68
|
+
// re-send and would sit there doing nothing.
|
|
69
|
+
'history-load-error': {
|
|
70
|
+
iconType: 'streaming-error',
|
|
71
|
+
title: interruptedTitle,
|
|
72
|
+
buttons: [{
|
|
73
|
+
text: 'Try again',
|
|
74
|
+
action: 'reload',
|
|
75
|
+
variant: 'cta'
|
|
76
|
+
}]
|
|
47
77
|
},
|
|
48
78
|
'conversation-403': {
|
|
49
79
|
iconType: 'forbidden',
|
|
50
|
-
|
|
51
|
-
showChips: true,
|
|
52
|
-
chipsLabel: 'Some ideas to get you started:'
|
|
80
|
+
...freshStartTemplate
|
|
53
81
|
},
|
|
54
|
-
'conversation-
|
|
55
|
-
iconType: '
|
|
56
|
-
|
|
57
|
-
buttons: [{
|
|
58
|
-
text: 'Contact Us',
|
|
59
|
-
variant: 'link'
|
|
60
|
-
}]
|
|
82
|
+
'conversation-404': {
|
|
83
|
+
iconType: 'not-found',
|
|
84
|
+
...freshStartTemplate
|
|
61
85
|
},
|
|
86
|
+
// D · Partial — an answer DID render; some of it is missing. This one is
|
|
87
|
+
// appended to the answer rather than replacing it.
|
|
62
88
|
'conversation-partial-load': {
|
|
63
89
|
iconType: 'partial-load',
|
|
64
|
-
title:
|
|
65
|
-
buttons: retryAndContactButtons
|
|
66
|
-
},
|
|
67
|
-
'history-load-error': {
|
|
68
|
-
iconType: 'streaming-error',
|
|
69
|
-
title: 'We couldn\u2019t load this conversation.',
|
|
90
|
+
title: "Some of this didn't load.",
|
|
70
91
|
buttons: [{
|
|
71
|
-
text: '
|
|
72
|
-
action: '
|
|
92
|
+
text: 'Reload',
|
|
93
|
+
action: 'reload',
|
|
73
94
|
variant: 'cta'
|
|
74
|
-
}, {
|
|
75
|
-
text: 'Contact Us',
|
|
76
|
-
variant: 'link'
|
|
77
95
|
}]
|
|
96
|
+
},
|
|
97
|
+
// E · Quota — waiting is the only fix, so the copy asks for time.
|
|
98
|
+
'conversation-429': {
|
|
99
|
+
iconType: 'quota-exceeded',
|
|
100
|
+
title: 'I need a minute to catch up. Try again shortly.',
|
|
101
|
+
buttons: retryButton
|
|
78
102
|
}
|
|
79
103
|
};
|
|
80
104
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["retryButton","text","action","variant","noAnswerTemplate","title","showChips","interruptedTitle","freshStartTemplate","chipsLabel","DEFAULT_ERROR_TEMPLATES","iconType","buttons","resolveErrorTemplate","type","overrides","templates"],"sources":["../../../src/errors/errorTemplates.ts"],"sourcesContent":["import type { ConversationErrorType } from './conversationErrorTypes';\n\n/** Action identifiers for error template buttons — resolved to callbacks by the rendering component */\nexport type ErrorActionType = 'retry' | 'newConversation' | 'reload';\n\n/** Icon identifiers for error templates — resolved to SVG components by the rendering component */\nexport type ErrorIconType =\n | 'error-500'\n | 'timeout'\n | 'streaming-error'\n | 'not-found'\n | 'forbidden'\n | 'partial-load'\n | 'quota-exceeded';\n\nexport interface ErrorTemplateButton {\n text: string;\n /** URL for navigation (renders as a link) */\n href?: string;\n /** Action identifier — component resolves to a callback */\n action?: ErrorActionType;\n variant: 'cta' | 'link';\n}\n\nexport interface ErrorTemplate {\n title: string;\n subtitle?: string;\n /** Icon identifier — component resolves to an SVG */\n iconType?: ErrorIconType;\n buttons?: ErrorTemplateButton[];\n showChips?: boolean;\n chipsLabel?: string;\n}\n\nexport type ErrorTemplateOverrides = Partial<\n Record<ConversationErrorType, ErrorTemplate>\n>;\n\n/**\n * The eleven error types collapse into five states a shopper can act on\n * (B2B-4615). Each state has one job, so each has one line and at most one\n * action:\n *\n * A · No answer — llm-error-text, llm-empty-response\n * B · Interrupted — 500, generic-network-error, timeout, streaming-error,\n * history-load-error\n * C · Fresh start — 403, 404\n * D · Partial — partial-load\n * E · Quota — 429\n *\n * `iconType` stays on every template that had one: the new design drops icons,\n * but w5-client-circana and w5-client-feature-com still read the field and\n * must keep the look they have.\n */\n\nconst retryButton: ErrorTemplateButton[] = [\n { text: 'Try again', action: 'retry', variant: 'cta' },\n];\n\n/** A · No answer — nothing to retry, so it offers somewhere else to go. */\nconst noAnswerTemplate: ErrorTemplate = {\n title: \"I can't help with that one \\u2014 but I can help with these.\",\n showChips: true,\n};\n\n/** B · Interrupted — the message is still there to send again. */\nconst interruptedTitle = \"That didn't come through. Let's try again.\";\n\n/** C · Fresh start — the thread is gone; hand the conversation back. */\nconst freshStartTemplate: ErrorTemplate = {\n title: \"We're starting fresh \\u2014 earlier messages aren't saved.\",\n showChips: true,\n chipsLabel: 'Ask anything to pick up again',\n};\n\nexport const DEFAULT_ERROR_TEMPLATES: Record<\n ConversationErrorType,\n ErrorTemplate\n> = {\n 'conversation-llm-error-text': noAnswerTemplate,\n 'conversation-llm-empty-response': noAnswerTemplate,\n 'conversation-500': {\n iconType: 'error-500',\n title: interruptedTitle,\n buttons: retryButton,\n },\n 'conversation-generic-network-error': {\n iconType: 'timeout',\n title: interruptedTitle,\n buttons: retryButton,\n },\n 'conversation-timeout': {\n iconType: 'timeout',\n title: interruptedTitle,\n buttons: retryButton,\n },\n 'conversation-streaming-error': {\n iconType: 'streaming-error',\n title: interruptedTitle,\n buttons: retryButton,\n },\n // Same state as the four above, deliberately not the same action: a history\n // load fails before there is a last message, so `retry` has nothing to\n // re-send and would sit there doing nothing.\n 'history-load-error': {\n iconType: 'streaming-error',\n title: interruptedTitle,\n buttons: [{ text: 'Try again', action: 'reload', variant: 'cta' }],\n },\n 'conversation-403': { iconType: 'forbidden', ...freshStartTemplate },\n 'conversation-404': { iconType: 'not-found', ...freshStartTemplate },\n // D · Partial — an answer DID render; some of it is missing. This one is\n // appended to the answer rather than replacing it.\n 'conversation-partial-load': {\n iconType: 'partial-load',\n title: \"Some of this didn't load.\",\n buttons: [{ text: 'Reload', action: 'reload', variant: 'cta' }],\n },\n // E · Quota — waiting is the only fix, so the copy asks for time.\n 'conversation-429': {\n iconType: 'quota-exceeded',\n title: 'I need a minute to catch up. Try again shortly.',\n buttons: retryButton,\n },\n};\n\n/** Resolves the error template for a given type, merging client overrides on top of defaults */\nexport const resolveErrorTemplate = (\n type: string,\n overrides?: ErrorTemplateOverrides,\n): ErrorTemplate => {\n const templates = overrides\n ? { ...DEFAULT_ERROR_TEMPLATES, ...overrides }\n : DEFAULT_ERROR_TEMPLATES;\n return (\n templates[type as ConversationErrorType] ??\n templates['conversation-llm-error-text']\n );\n};\n"],"mappings":"AAEA;;AAGA;;AAiCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAMA,WAAkC,GAAG,CACzC;EAAEC,IAAI,EAAE,WAAW;EAAEC,MAAM,EAAE,OAAO;EAAEC,OAAO,EAAE;AAAM,CAAC,CACvD;;AAED;AACA,MAAMC,gBAA+B,GAAG;EACtCC,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AAEC,MAAM,EAAE,QAAQ;MAAEC,OAAO,EAAE;IAAM,CAAC;EAChE,CAAC;EACD;EACA,kBAAkB,EAAE;IAClBQ,QAAQ,EAAE,gBAAgB;IAC1BN,KAAK,EAAE,iDAAiD;IACxDO,OAAO,EAAEZ;EACX;AACF,CAAC;;AAED;AACA,OAAO,MAAMa,oBAAoB,GAAGA,CAClCC,IAAY,EACZC,SAAkC,KAChB;EAClB,MAAMC,SAAS,GAAGD,SAAS,GACvB;IAAE,GAAGL,uBAAuB;IAAE,GAAGK;EAAU,CAAC,GAC5CL,uBAAuB;EAC3B,OACEM,SAAS,CAACF,IAAI,CAA0B,IACxCE,SAAS,CAAC,6BAA6B,CAAC;AAE5C,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorTemplates.d.ts","sourceRoot":"","sources":["../../../src/errors/errorTemplates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEtE,uGAAuG;AACvG,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,iBAAiB,GAAG,QAAQ,CAAC;AAErE,mGAAmG;AACnG,MAAM,MAAM,aAAa,GACrB,WAAW,GACX,SAAS,GACT,iBAAiB,GACjB,WAAW,GACX,WAAW,GACX,cAAc,GACd,gBAAgB,CAAC;AAErB,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB,OAAO,EAAE,KAAK,GAAG,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qDAAqD;IACrD,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,OAAO,CAAC,EAAE,mBAAmB,EAAE,C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SACzB,MAAM,cACA,sBAAsB,KACjC,aAQF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/web5-core",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "1.63.
|
|
4
|
+
"version": "1.63.40",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "tsachis",
|
|
7
7
|
"email": "tsachis@wix.com"
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"wallaby": {
|
|
101
101
|
"autoDetect": true
|
|
102
102
|
},
|
|
103
|
-
"falconPackageHash": "
|
|
103
|
+
"falconPackageHash": "822781481f70a468191111623bc8e82e6c573c2980eddd65f4ec07c4"
|
|
104
104
|
}
|