1 | "use strict";
|
2 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
3 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
4 | };
|
5 | Object.defineProperty(exports, "__esModule", { value: true });
|
6 | var react_1 = __importDefault(require("react"));
|
7 | var polaris_1 = require("@shopify/polaris");
|
8 | var react_compose_1 = __importDefault(require("@shopify/react-compose"));
|
9 | var toast_1 = require("../store/reducers/embeddedApp/toast");
|
10 | var withFeature_1 = __importDefault(require("../withFeature"));
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | function Toast(props) {
|
16 | var actions = props.actions, content = props.store.content;
|
17 | return content ? (react_1.default.createElement(polaris_1.Toast, { error: content.error, duration: content.duration, onDismiss: handleToastDismiss, content: content.message })) : null;
|
18 | function handleToastDismiss() {
|
19 | if (!content) {
|
20 | return;
|
21 | }
|
22 | actions.clear({ id: content.id });
|
23 | actions.legacyClear({ id: content.id });
|
24 | }
|
25 | }
|
26 | exports.Toast = Toast;
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | exports.default = react_compose_1.default(withFeature_1.default(toast_1.feature))(Toast);
|