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 | exports.Toast = void 0;
|
7 | var react_1 = __importDefault(require("react"));
|
8 | var polaris_1 = require("@shopify/polaris");
|
9 | var react_compose_1 = __importDefault(require("@shopify/react-compose"));
|
10 | var toast_1 = require("../store/reducers/embeddedApp/toast");
|
11 | var withFeature_1 = __importDefault(require("../withFeature"));
|
12 |
|
13 |
|
14 |
|
15 |
|
16 | function Toast(props) {
|
17 | var actions = props.actions, content = props.store.content;
|
18 | return content ? (react_1.default.createElement(polaris_1.Toast, { error: content.error, duration: content.duration, onDismiss: handleToastDismiss, content: content.message })) : null;
|
19 | function handleToastDismiss() {
|
20 | if (!content) {
|
21 | return;
|
22 | }
|
23 | actions.clear({ id: content.id });
|
24 | actions.legacyClear({ id: content.id });
|
25 | }
|
26 | }
|
27 | exports.Toast = Toast;
|
28 |
|
29 |
|
30 |
|
31 |
|
32 | exports.default = react_compose_1.default(withFeature_1.default(toast_1.feature))(Toast);
|