@shopify/app-bridge-react 2.0.17 → 2.0.18
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.
- package/CHANGELOG.md +8 -0
- package/package.json +3 -3
- package/components/ClientRouter/ClientRouter.d.ts +0 -21
- package/components/ClientRouter/ClientRouter.js +0 -50
- package/components/ClientRouter/hook.d.ts +0 -10
- package/components/ClientRouter/hook.js +0 -20
- package/components/ClientRouter/index.d.ts +0 -3
- package/components/ClientRouter/index.js +0 -6
- package/components/ClientRouter/router.d.ts +0 -5
- package/components/ClientRouter/router.js +0 -11
- package/components/Loading/Loading.d.ts +0 -17
- package/components/Loading/Loading.js +0 -53
- package/components/Loading/index.d.ts +0 -2
- package/components/Loading/index.js +0 -7
- package/components/Modal/Modal.d.ts +0 -43
- package/components/Modal/Modal.js +0 -131
- package/components/Modal/ModalContent/ModalContent.d.ts +0 -22
- package/components/Modal/ModalContent/ModalContent.js +0 -59
- package/components/Modal/ModalContent/index.d.ts +0 -2
- package/components/Modal/ModalContent/index.js +0 -7
- package/components/Modal/index.d.ts +0 -4
- package/components/Modal/index.js +0 -9
- package/components/Provider/Provider.d.ts +0 -36
- package/components/Provider/Provider.js +0 -93
- package/components/Provider/index.d.ts +0 -3
- package/components/Provider/index.js +0 -7
- package/components/ResourcePicker/ResourcePicker.d.ts +0 -77
- package/components/ResourcePicker/ResourcePicker.js +0 -129
- package/components/ResourcePicker/index.d.ts +0 -3
- package/components/ResourcePicker/index.js +0 -7
- package/components/RoutePropagator/RoutePropagator.d.ts +0 -20
- package/components/RoutePropagator/RoutePropagator.js +0 -52
- package/components/RoutePropagator/globals.d.ts +0 -3
- package/components/RoutePropagator/globals.js +0 -15
- package/components/RoutePropagator/hook.d.ts +0 -10
- package/components/RoutePropagator/hook.js +0 -20
- package/components/RoutePropagator/index.d.ts +0 -3
- package/components/RoutePropagator/index.js +0 -6
- package/components/RoutePropagator/route-propagator.d.ts +0 -7
- package/components/RoutePropagator/route-propagator.js +0 -91
- package/components/TitleBar/TitleBar.d.ts +0 -38
- package/components/TitleBar/TitleBar.js +0 -78
- package/components/TitleBar/index.d.ts +0 -3
- package/components/TitleBar/index.js +0 -7
- package/components/Toast/Toast.d.ts +0 -31
- package/components/Toast/Toast.js +0 -57
- package/components/Toast/index.d.ts +0 -3
- package/components/Toast/index.js +0 -7
- package/components/index.d.ts +0 -8
- package/components/index.js +0 -27
- package/context.d.ts +0 -13
- package/context.js +0 -10
- package/index.d.ts +0 -3
- package/index.js +0 -17
- package/types.d.ts +0 -33
- package/types.js +0 -2
- package/umd/index.js +0 -14
- package/useAppBridge.d.ts +0 -1
- package/useAppBridge.js +0 -13
- package/utilities/transformers.d.ts +0 -19
- package/utilities/transformers.js +0 -86
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.0.18](https://github.com/Shopify/app-bridge/compare/v2.0.17...v2.0.18) (2022-03-15)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @shopify/app-bridge-react
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [2.0.17](https://github.com/Shopify/app-bridge/compare/v2.0.16...v2.0.17) (2022-03-10)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @shopify/app-bridge-react
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopify/app-bridge-react",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.18",
|
|
4
4
|
"types": "index.d.ts",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"unpkg": "umd/index.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
}
|
|
45
45
|
],
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@shopify/app-bridge": "^2.0.
|
|
47
|
+
"@shopify/app-bridge": "^2.0.18"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/react": "^17.0.38",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"react": "^16.0.0 || ^17.0.0"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "9d45b5643e94febbccc111e198db7fafe309c2a0"
|
|
58
58
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Unsubscribe } from '@shopify/app-bridge';
|
|
3
|
-
import { History } from './router';
|
|
4
|
-
export interface Props {
|
|
5
|
-
history: History;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* ClientRouter component
|
|
9
|
-
*
|
|
10
|
-
* @remarks
|
|
11
|
-
* React component which keeps the Shopify admin url in sync with the app url
|
|
12
|
-
*
|
|
13
|
-
* @public
|
|
14
|
-
*/
|
|
15
|
-
export default class ClientRouter extends React.Component<Props, never> {
|
|
16
|
-
static contextType: React.Context<import("../../context").IAppBridgeContext>;
|
|
17
|
-
unsubscribe?: Unsubscribe;
|
|
18
|
-
componentDidMount(): void;
|
|
19
|
-
componentWillUnmount(): void;
|
|
20
|
-
render(): null;
|
|
21
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
|
-
};
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
var react_1 = __importDefault(require("react"));
|
|
20
|
-
var context_1 = require("../../context");
|
|
21
|
-
var router_1 = require("./router");
|
|
22
|
-
/**
|
|
23
|
-
* ClientRouter component
|
|
24
|
-
*
|
|
25
|
-
* @remarks
|
|
26
|
-
* React component which keeps the Shopify admin url in sync with the app url
|
|
27
|
-
*
|
|
28
|
-
* @public
|
|
29
|
-
*/
|
|
30
|
-
var ClientRouter = /** @class */ (function (_super) {
|
|
31
|
-
__extends(ClientRouter, _super);
|
|
32
|
-
function ClientRouter() {
|
|
33
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
34
|
-
}
|
|
35
|
-
ClientRouter.prototype.componentDidMount = function () {
|
|
36
|
-
var history = this.props.history;
|
|
37
|
-
this.unsubscribe = router_1.handleRouteChange(this.context, history);
|
|
38
|
-
};
|
|
39
|
-
ClientRouter.prototype.componentWillUnmount = function () {
|
|
40
|
-
if (this.unsubscribe) {
|
|
41
|
-
this.unsubscribe();
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
ClientRouter.prototype.render = function () {
|
|
45
|
-
return null;
|
|
46
|
-
};
|
|
47
|
-
ClientRouter.contextType = context_1.AppBridgeContext;
|
|
48
|
-
return ClientRouter;
|
|
49
|
-
}(react_1.default.Component));
|
|
50
|
-
exports.default = ClientRouter;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var react_1 = require("react");
|
|
4
|
-
var useAppBridge_1 = require("../../useAppBridge");
|
|
5
|
-
var router_1 = require("./router");
|
|
6
|
-
/**
|
|
7
|
-
* useRoutePropagation
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
|
-
* A hook which keeps the Shopify admin url in sync with the app url
|
|
11
|
-
*
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
function useClientRouting(history) {
|
|
15
|
-
var app = useAppBridge_1.useAppBridge();
|
|
16
|
-
react_1.useEffect(function () {
|
|
17
|
-
return router_1.handleRouteChange(app, history);
|
|
18
|
-
}, [app, history]);
|
|
19
|
-
}
|
|
20
|
-
exports.default = useClientRouting;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var ClientRouter_1 = require("./ClientRouter");
|
|
4
|
-
Object.defineProperty(exports, "ClientRouter", { enumerable: true, get: function () { return ClientRouter_1.default; } });
|
|
5
|
-
var hook_1 = require("./hook");
|
|
6
|
-
Object.defineProperty(exports, "useClientRouting", { enumerable: true, get: function () { return hook_1.default; } });
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.handleRouteChange = void 0;
|
|
4
|
-
var actions_1 = require("@shopify/app-bridge/actions");
|
|
5
|
-
function handleRouteChange(app, history) {
|
|
6
|
-
return app.subscribe(actions_1.Redirect.Action.APP, function (_a) {
|
|
7
|
-
var path = _a.path;
|
|
8
|
-
history.replace(path);
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
exports.handleRouteChange = handleRouteChange;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* Loading component
|
|
4
|
-
*
|
|
5
|
-
* @remarks
|
|
6
|
-
* React component which wraps the Shopify App Bridge Loading action.
|
|
7
|
-
*
|
|
8
|
-
* @public
|
|
9
|
-
*/
|
|
10
|
-
declare class Loading extends React.Component {
|
|
11
|
-
static contextType: React.Context<import("../../context").IAppBridgeContext>;
|
|
12
|
-
private loading;
|
|
13
|
-
componentDidMount(): void;
|
|
14
|
-
componentWillUnmount(): void;
|
|
15
|
-
render(): null;
|
|
16
|
-
}
|
|
17
|
-
export default Loading;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
|
-
};
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
var react_1 = __importDefault(require("react"));
|
|
20
|
-
var actions_1 = require("@shopify/app-bridge/actions");
|
|
21
|
-
var context_1 = require("../../context");
|
|
22
|
-
/**
|
|
23
|
-
* Loading component
|
|
24
|
-
*
|
|
25
|
-
* @remarks
|
|
26
|
-
* React component which wraps the Shopify App Bridge Loading action.
|
|
27
|
-
*
|
|
28
|
-
* @public
|
|
29
|
-
*/
|
|
30
|
-
var Loading = /** @class */ (function (_super) {
|
|
31
|
-
__extends(Loading, _super);
|
|
32
|
-
function Loading() {
|
|
33
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
34
|
-
}
|
|
35
|
-
Loading.prototype.componentDidMount = function () {
|
|
36
|
-
var app = this.context;
|
|
37
|
-
this.loading = actions_1.Loading.create(app);
|
|
38
|
-
if (this.loading != null) {
|
|
39
|
-
this.loading.dispatch(actions_1.Loading.Action.START);
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
Loading.prototype.componentWillUnmount = function () {
|
|
43
|
-
if (this.loading != null) {
|
|
44
|
-
this.loading.dispatch(actions_1.Loading.Action.STOP);
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
Loading.prototype.render = function () {
|
|
48
|
-
return null;
|
|
49
|
-
};
|
|
50
|
-
Loading.contextType = context_1.AppBridgeContext;
|
|
51
|
-
return Loading;
|
|
52
|
-
}(react_1.default.Component));
|
|
53
|
-
exports.default = Loading;
|
|
@@ -1,7 +0,0 @@
|
|
|
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 Loading_1 = __importDefault(require("./Loading"));
|
|
7
|
-
exports.default = Loading_1.default;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Modal as AppBridgeModal } from '@shopify/app-bridge/actions';
|
|
3
|
-
import { ActionProps } from '../../types';
|
|
4
|
-
declare type Size = keyof typeof AppBridgeModal.Size;
|
|
5
|
-
export interface Props {
|
|
6
|
-
/** Whether the modal is open or not */
|
|
7
|
-
open: boolean;
|
|
8
|
-
/** The url that will be loaded as the content of the modal */
|
|
9
|
-
src?: string;
|
|
10
|
-
/** The content for the title of the modal */
|
|
11
|
-
title?: string;
|
|
12
|
-
/** Controls the size of the modal */
|
|
13
|
-
size?: Size;
|
|
14
|
-
/** Message to display inside modal */
|
|
15
|
-
message?: string;
|
|
16
|
-
/** Primary action */
|
|
17
|
-
primaryAction?: ActionProps;
|
|
18
|
-
/** Collection of secondary actions */
|
|
19
|
-
secondaryActions?: ActionProps[];
|
|
20
|
-
/** Callback when the modal is closed */
|
|
21
|
-
onClose?(): void;
|
|
22
|
-
/** Enable loading behaviour, when `true` bear in mind you will need to use `Modal Content` to dismiss the loading after the iframe page is fully loaded */
|
|
23
|
-
loading?: boolean;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Modal component
|
|
27
|
-
*
|
|
28
|
-
* @remarks
|
|
29
|
-
* React component which wraps the Shopify App Bridge Modal action.
|
|
30
|
-
*
|
|
31
|
-
* @public
|
|
32
|
-
*/
|
|
33
|
-
declare class Modal extends React.PureComponent<Props, never> {
|
|
34
|
-
static contextType: React.Context<import("../../context").IAppBridgeContext>;
|
|
35
|
-
private focusReturnPoint;
|
|
36
|
-
private modal;
|
|
37
|
-
componentDidMount(): void;
|
|
38
|
-
componentDidUpdate(prevProps: Props): void;
|
|
39
|
-
componentWillUnmount(): void;
|
|
40
|
-
render(): null;
|
|
41
|
-
private transformProps;
|
|
42
|
-
}
|
|
43
|
-
export default Modal;
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
var __assign = (this && this.__assign) || function () {
|
|
16
|
-
__assign = Object.assign || function(t) {
|
|
17
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
18
|
-
s = arguments[i];
|
|
19
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
20
|
-
t[p] = s[p];
|
|
21
|
-
}
|
|
22
|
-
return t;
|
|
23
|
-
};
|
|
24
|
-
return __assign.apply(this, arguments);
|
|
25
|
-
};
|
|
26
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
-
};
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
var react_1 = __importDefault(require("react"));
|
|
31
|
-
var actions_1 = require("@shopify/app-bridge/actions");
|
|
32
|
-
var transformers_1 = require("../../utilities/transformers");
|
|
33
|
-
var context_1 = require("../../context");
|
|
34
|
-
/**
|
|
35
|
-
* Modal component
|
|
36
|
-
*
|
|
37
|
-
* @remarks
|
|
38
|
-
* React component which wraps the Shopify App Bridge Modal action.
|
|
39
|
-
*
|
|
40
|
-
* @public
|
|
41
|
-
*/
|
|
42
|
-
var Modal = /** @class */ (function (_super) {
|
|
43
|
-
__extends(Modal, _super);
|
|
44
|
-
function Modal() {
|
|
45
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
46
|
-
_this.focusReturnPoint = null;
|
|
47
|
-
return _this;
|
|
48
|
-
}
|
|
49
|
-
Modal.prototype.componentDidMount = function () {
|
|
50
|
-
var _a = this.props, open = _a.open, onClose = _a.onClose;
|
|
51
|
-
var app = this.context;
|
|
52
|
-
this.modal = actions_1.Modal.create(app, this.transformProps());
|
|
53
|
-
if (onClose != null) {
|
|
54
|
-
this.modal.subscribe(actions_1.Modal.Action.CLOSE, onClose);
|
|
55
|
-
}
|
|
56
|
-
if (open) {
|
|
57
|
-
this.focusReturnPoint = document.activeElement;
|
|
58
|
-
this.modal.dispatch(actions_1.Modal.Action.OPEN);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
Modal.prototype.componentDidUpdate = function (prevProps) {
|
|
62
|
-
var _a = this.props, open = _a.open, onClose = _a.onClose;
|
|
63
|
-
var wasOpen = prevProps.open;
|
|
64
|
-
var transformedProps = this.transformProps(wasOpen);
|
|
65
|
-
this.modal.unsubscribe();
|
|
66
|
-
if (isIframeModal(transformedProps)) {
|
|
67
|
-
this.modal.set(transformedProps, open);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
this.modal.set(transformedProps, open);
|
|
71
|
-
}
|
|
72
|
-
if (onClose != null) {
|
|
73
|
-
this.modal.subscribe(actions_1.Modal.Action.CLOSE, onClose);
|
|
74
|
-
}
|
|
75
|
-
if (wasOpen !== open) {
|
|
76
|
-
if (open) {
|
|
77
|
-
this.modal.dispatch(actions_1.Modal.Action.OPEN);
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
this.modal.dispatch(actions_1.Modal.Action.CLOSE);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (!wasOpen && open) {
|
|
84
|
-
this.focusReturnPoint = document.activeElement;
|
|
85
|
-
}
|
|
86
|
-
else if (wasOpen &&
|
|
87
|
-
!open &&
|
|
88
|
-
this.focusReturnPoint != null &&
|
|
89
|
-
document.contains(this.focusReturnPoint)) {
|
|
90
|
-
this.focusReturnPoint.focus();
|
|
91
|
-
this.focusReturnPoint = null;
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
Modal.prototype.componentWillUnmount = function () {
|
|
95
|
-
this.modal.unsubscribe();
|
|
96
|
-
if (this.props.open) {
|
|
97
|
-
this.modal.dispatch(actions_1.Modal.Action.CLOSE);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
Modal.prototype.render = function () {
|
|
101
|
-
return null;
|
|
102
|
-
};
|
|
103
|
-
Modal.prototype.transformProps = function (wasOpen) {
|
|
104
|
-
var _a = this.props, title = _a.title, size = _a.size, message = _a.message, src = _a.src, primaryAction = _a.primaryAction, secondaryActions = _a.secondaryActions, loading = _a.loading;
|
|
105
|
-
var app = this.context;
|
|
106
|
-
var safeSize = size == null ? undefined : actions_1.Modal.Size[size];
|
|
107
|
-
var srcPayload = {};
|
|
108
|
-
if (src != null) {
|
|
109
|
-
if (src.match('^https?://')) {
|
|
110
|
-
srcPayload.url = src;
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
srcPayload.path = src;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return __assign(__assign({ title: title,
|
|
117
|
-
message: message, size: safeSize }, srcPayload), { footer: {
|
|
118
|
-
buttons: transformers_1.transformActions(app, {
|
|
119
|
-
primaryAction: primaryAction,
|
|
120
|
-
secondaryActions: secondaryActions,
|
|
121
|
-
}),
|
|
122
|
-
}, loading: wasOpen ? undefined : loading });
|
|
123
|
-
};
|
|
124
|
-
Modal.contextType = context_1.AppBridgeContext;
|
|
125
|
-
return Modal;
|
|
126
|
-
}(react_1.default.PureComponent));
|
|
127
|
-
function isIframeModal(options) {
|
|
128
|
-
return (typeof options.url === 'string' ||
|
|
129
|
-
typeof options.path === 'string');
|
|
130
|
-
}
|
|
131
|
-
exports.default = Modal;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export interface Props {
|
|
3
|
-
/** Show/Dismiss loading spinner */
|
|
4
|
-
loading: boolean;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* Modal Content component
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
|
-
* React component which wraps the Shopify App Bridge Modal Content action.
|
|
11
|
-
*
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
declare class ModalContent extends React.Component<Props> {
|
|
15
|
-
static contextType: React.Context<import("../../../context").IAppBridgeContext>;
|
|
16
|
-
private modalContent;
|
|
17
|
-
componentDidMount(): void;
|
|
18
|
-
componentDidUpdate(): void;
|
|
19
|
-
syncLoadingStatus(): void;
|
|
20
|
-
render(): null;
|
|
21
|
-
}
|
|
22
|
-
export default ModalContent;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
extendStatics(d, b);
|
|
11
|
-
function __() { this.constructor = d; }
|
|
12
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
|
-
};
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
var react_1 = __importDefault(require("react"));
|
|
20
|
-
var actions_1 = require("@shopify/app-bridge/actions");
|
|
21
|
-
var context_1 = require("../../../context");
|
|
22
|
-
/**
|
|
23
|
-
* Modal Content component
|
|
24
|
-
*
|
|
25
|
-
* @remarks
|
|
26
|
-
* React component which wraps the Shopify App Bridge Modal Content action.
|
|
27
|
-
*
|
|
28
|
-
* @public
|
|
29
|
-
*/
|
|
30
|
-
var ModalContent = /** @class */ (function (_super) {
|
|
31
|
-
__extends(ModalContent, _super);
|
|
32
|
-
function ModalContent() {
|
|
33
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
34
|
-
}
|
|
35
|
-
ModalContent.prototype.componentDidMount = function () {
|
|
36
|
-
var app = this.context;
|
|
37
|
-
this.modalContent = actions_1.ModalContent.create(app);
|
|
38
|
-
this.syncLoadingStatus();
|
|
39
|
-
};
|
|
40
|
-
ModalContent.prototype.componentDidUpdate = function () {
|
|
41
|
-
this.syncLoadingStatus();
|
|
42
|
-
};
|
|
43
|
-
ModalContent.prototype.syncLoadingStatus = function () {
|
|
44
|
-
if (!this.modalContent)
|
|
45
|
-
return;
|
|
46
|
-
if (this.props.loading) {
|
|
47
|
-
this.modalContent.loading();
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
this.modalContent.loaded();
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
ModalContent.prototype.render = function () {
|
|
54
|
-
return null;
|
|
55
|
-
};
|
|
56
|
-
ModalContent.contextType = context_1.AppBridgeContext;
|
|
57
|
-
return ModalContent;
|
|
58
|
-
}(react_1.default.Component));
|
|
59
|
-
exports.default = ModalContent;
|
|
@@ -1,7 +0,0 @@
|
|
|
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 ModalContent_1 = __importDefault(require("./ModalContent"));
|
|
7
|
-
exports.default = ModalContent_1.default;
|
|
@@ -1,9 +0,0 @@
|
|
|
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 Modal_1 = __importDefault(require("./Modal"));
|
|
7
|
-
var ModalContent_1 = require("./ModalContent");
|
|
8
|
-
Object.defineProperty(exports, "ModalContent", { enumerable: true, get: function () { return ModalContent_1.default; } });
|
|
9
|
-
exports.default = Modal_1.default;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DispatchActionHook } from '@shopify/app-bridge';
|
|
3
|
-
import { AppConfigV2 } from '@shopify/app-bridge/client';
|
|
4
|
-
/**
|
|
5
|
-
* Provider props
|
|
6
|
-
*
|
|
7
|
-
* @public
|
|
8
|
-
*/
|
|
9
|
-
export interface Props {
|
|
10
|
-
/** Application configuration */
|
|
11
|
-
config: AppConfigV2;
|
|
12
|
-
/** The child elements to render. */
|
|
13
|
-
children?: React.ReactNode;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Create an App Bridge client application from a config and pass it as the
|
|
17
|
-
* value to the context provider.
|
|
18
|
-
*
|
|
19
|
-
* @remarks
|
|
20
|
-
* You'll probably want something a little more robust than storing the current
|
|
21
|
-
* app instance in a module-level global.
|
|
22
|
-
*
|
|
23
|
-
* @public
|
|
24
|
-
*/
|
|
25
|
-
declare class Provider extends React.Component<Props> {
|
|
26
|
-
private app;
|
|
27
|
-
private get appInstance();
|
|
28
|
-
render(): JSX.Element;
|
|
29
|
-
}
|
|
30
|
-
export default Provider;
|
|
31
|
-
/**
|
|
32
|
-
* Augment actions with clientInterface metadata, identifying use of this library
|
|
33
|
-
*
|
|
34
|
-
* @internal
|
|
35
|
-
*/
|
|
36
|
-
export declare const setClientInterfaceHook: DispatchActionHook;
|