Skip to content

Commit 505d5fb

Browse files
authored
Add toast api on standard api (#3077)
* Add toast api to standard api * add it back * remove from docs for now * Add changeset
1 parent ca23426 commit 505d5fb

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

.changeset/warm-pans-wash.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/ui-extensions': patch
3+
---
4+
5+
Add toast api on customer accounts standard api

packages/ui-extensions/src/surfaces/customer-account/api/shared.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,3 +652,10 @@ export interface TrackingConsentChangeResultError {
652652
*/
653653
message: string;
654654
}
655+
656+
export interface ToastApiResult {
657+
hide: () => void;
658+
}
659+
export interface ToastApi {
660+
show: (content: string) => ToastApiResult;
661+
}

packages/ui-extensions/src/surfaces/customer-account/api/standard-api/standard-api.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
Analytics,
1313
CustomerPrivacy,
1414
ApplyTrackingConsentChangeType,
15+
ToastApi,
1516
} from '../shared';
1617

1718
import type {ExtensionTarget} from '../../extension-targets';
@@ -101,6 +102,23 @@ export interface StandardApi<Target extends ExtensionTarget = ExtensionTarget> {
101102
*/
102103
ui: Ui;
103104

105+
/**
106+
* The Toast API displays a non-disruptive message that displays at the bottom
107+
* of the interface to provide quick, at-a-glance feedback on the outcome
108+
* of an action.
109+
*
110+
* How to use:
111+
*
112+
* - Use toasts to confirm successful actions.
113+
*
114+
* - Aim for two words.
115+
*
116+
* - Use noun + past tense verb format. For example, \`Changes saved\`.
117+
*
118+
* For errors, or information that needs to persist on the page, use a [banner](/docs/api/checkout-ui-extensions/unstable/components/feedback/banner) component.
119+
*/
120+
toast: ToastApi;
121+
104122
navigation: StandardExtensionNavigation;
105123

106124
/**

0 commit comments

Comments
 (0)