├── .dependabot
└── config.yml
├── .github
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── ISSUE_TEMPLATE.md
└── PULL_REQUEST_TEMPLATE.md
├── .gitignore
├── LICENSE.md
├── README.md
├── SECURITY.md
├── components
├── ClientRouter.js
└── ResourceList.js
├── next.config.js
├── package-lock.json
├── package.json
├── pages
├── _app.js
├── annotated-layout.js
├── edit-products.js
└── index.js
├── server.js
└── server
└── getSubscriptionUrl.js
/.dependabot/config.yml:
--------------------------------------------------------------------------------
1 | version: 1
2 | update_configs:
3 | # Keep package.json up to date as soon as
4 | # new versions are published to the npm registry
5 | - package_manager: "javascript"
6 | directory: "/"
7 | update_schedule: "weekly"
8 | default_reviewers:
9 | - "Shopify/platform-dev-tools-education"
10 | version_requirement_updates: "auto"
11 |
--------------------------------------------------------------------------------
/.github/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as
6 | contributors and maintainers pledge to making participation in our project and
7 | our community a harassment-free experience for everyone, regardless of age, body
8 | size, disability, ethnicity, gender identity and expression, level of experience,
9 | nationality, personal appearance, race, religion, or sexual identity and
10 | orientation.
11 |
12 | ## Our Standards
13 |
14 | Examples of behavior that contributes to creating a positive environment
15 | include:
16 |
17 | * Using welcoming and inclusive language
18 | * Being respectful of differing viewpoints and experiences
19 | * Gracefully accepting constructive criticism
20 | * Focusing on what is best for the community
21 | * Showing empathy towards other community members
22 |
23 | Examples of unacceptable behavior by participants include:
24 |
25 | * The use of sexualized language or imagery and unwelcome sexual attention or
26 | advances
27 | * Trolling, insulting/derogatory comments, and personal or political attacks
28 | * Public or private harassment
29 | * Publishing others' private information, such as a physical or electronic
30 | address, without explicit permission
31 | * Other conduct which could reasonably be considered inappropriate in a
32 | professional setting
33 |
34 | ## Our Responsibilities
35 |
36 | Project maintainers are responsible for clarifying the standards of acceptable
37 | behavior and are expected to take appropriate and fair corrective action in
38 | response to any instances of unacceptable behavior.
39 |
40 | Project maintainers have the right and responsibility to remove, edit, or
41 | reject comments, commits, code, wiki edits, issues, and other contributions
42 | that are not aligned to this Code of Conduct, or to ban temporarily or
43 | permanently any contributor for other behaviors that they deem inappropriate,
44 | threatening, offensive, or harmful.
45 |
46 | ## Scope
47 |
48 | This Code of Conduct applies both within project spaces and in public spaces
49 | when an individual is representing the project or its community. Examples of
50 | representing a project or community include using an official project e-mail
51 | address, posting via an official social media account, or acting as an appointed
52 | representative at an online or offline event. Representation of a project may be
53 | further defined and clarified by project maintainers.
54 |
55 | ## Enforcement
56 |
57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
58 | reported by contacting the project team at opensource@shopify.com. All
59 | complaints will be reviewed and investigated and will result in a response that
60 | is deemed necessary and appropriate to the circumstances. The project team is
61 | obligated to maintain confidentiality with regard to the reporter of an incident.
62 | Further details of specific enforcement policies may be posted separately.
63 |
64 | Project maintainers who do not follow or enforce the Code of Conduct in good
65 | faith may face temporary or permanent repercussions as determined by other
66 | members of the project's leadership.
67 |
68 | ## Attribution
69 |
70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct/
72 |
73 | [homepage]: https://www.contributor-covenant.org
74 |
--------------------------------------------------------------------------------
/.github/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # How to contribute
2 |
3 | ## Creating issues
4 |
5 | Before submitting issues, please have a quick look if there is an existing open issue [here](https://github.com/Shopify/shopify-demo-app-node-react/issues). If no related issue can be found, please open a new issue.
6 |
7 | Please limit issues to bug reports about existing tutorial content.
8 |
9 | If you are looking for information about how to do something not covered in this tutorial, or if you are looking for general support about creating Shopify apps, please post in the Shopify APIs & SDKs section of our Community forums:
10 |
11 | https://community.shopify.com/c/Shopify-APIs-SDKs/bd-p/shopify-apis-and-technology
12 |
13 | ## Opening pull requests
14 |
15 | This repo exists only to provide example code for the [Build a Shopify app with Node and React](https://developers.shopify.com/tutorials/build-a-shopify-app-with-node-and-react/) tutorial. Thank you for taking the time to submit a pull request, but we are not accepting contributions at this time, and all external PRs will be closed without merging.
16 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
8 |
9 | # Bug summary
10 |
11 | Write a short description of the bug here ↓
12 |
13 |
14 |
15 | ## Expected behavior
16 |
17 | What do you think should happen?
18 |
19 |
20 |
21 | ## Actual behavior
22 |
23 | What actually happens?
24 |
25 | Tip: include an error message (in a `` tag) if your issue is related to an error
26 |
27 |
28 |
29 | ## Steps to reproduce the problem
30 |
31 | 1.
32 | 1.
33 | 1.
34 |
35 | ## Reduced test case
36 |
37 | The best way to get your bug fixed is to provide a reduced test case.
38 |
39 |
40 |
41 | ## Specifications
42 |
43 | - Browser:
44 | - Device:
45 | - Operating System:
46 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | This repo exists only to provide example code for the [Build a Shopify app with Node and React](https://developers.shopify.com/tutorials/build-a-shopify-app-with-node-and-react/) tutorial. Thank you for taking the time to submit a pull request, but we are not accepting contributions at this time, and all external PRs will be closed without merging.
2 |
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .next
3 | .env
4 | npm-debug.log
5 | .prettierrc
6 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 Shopify
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # shopify-demo-app-node-react
2 | [](LICENSE.md)
3 |
4 | This repository is deprecated and has been replaced by [Shopify App Node](https://github.com/Shopify/shopify-app-node).
5 |
--------------------------------------------------------------------------------
/SECURITY.md:
--------------------------------------------------------------------------------
1 | # Security Policy
2 |
3 | ## Supported versions
4 |
5 | ### New features
6 |
7 | New features will only be added to the master branch and will not be made available in point releases.
8 |
9 | ### Bug fixes
10 |
11 | Only the latest release series will receive bug fixes. When enough bugs are fixed and its deemed worthy to release a new gem, this is the branch it happens from.
12 |
13 | ### Security issues
14 |
15 | Only the latest release series will receive patches and new versions in case of a security issue.
16 |
17 | ### Severe security issues
18 |
19 | For severe security issues we will provide new versions as above, and also the last major release series will receive patches and new versions. The classification of the security issue is judged by the core team.
20 |
21 | ### Unsupported Release Series
22 |
23 | When a release series is no longer supported, it's your own responsibility to deal with bugs and security issues. If you are not comfortable maintaining your own versions, you should upgrade to a supported version.
24 |
25 | ## Reporting a bug
26 |
27 | All security bugs in shopify repositories should be reported to [our hackerone program](https://hackerone.com/shopify)
28 | Shopify's whitehat program is our way to reward security researchers for finding serious security vulnerabilities in the In Scope properties listed at the bottom of this page, including our core application (all functionality associated with a Shopify store, particularly your-store.myshopify.com/admin) and certain ancillary applications.
29 |
30 | ## Disclosure Policy
31 |
32 | We look forward to working with all security researchers and strive to be respectful, always assume the best and treat others as peers. We expect the same in return from all participants. To achieve this, our team strives to:
33 |
34 | - Reply to all reports within one business day and triage within two business days (if applicable)
35 | - Be as transparent as possible, answering all inquires about our report decisions and adding hackers to duplicate HackerOne reports
36 | - Award bounties within a week of resolution (excluding extenuating circumstances)
37 | - Only close reports as N/A when the issue reported is included in Known Issues, Ineligible Vulnerabilities Types or lacks evidence of a vulnerability
38 |
39 | **The following rules must be followed in order for any rewards to be paid:**
40 |
41 | - You may only test against shops you have created which include your HackerOne YOURHANDLE @ wearehackerone.com registered email address.
42 | - You must not attempt to gain access to, or interact with, any shops other than those created by you.
43 | - The use of commercial scanners is prohibited (e.g., Nessus).
44 | - Rules for reporting must be followed.
45 | - Do not disclose any issues publicly before they have been resolved.
46 | - Shopify reserves the right to modify the rules for this program or deem any submissions invalid at any time. Shopify may cancel the whitehat program without notice at any time.
47 | - Contacting Shopify Support over chat, email or phone about your HackerOne report is not allowed. We may disqualify you from receiving a reward, or from participating in the program altogether.
48 | - You are not an employee of Shopify; employees should report bugs to the internal bug bounty program.
49 | - You hereby represent, warrant and covenant that any content you submit to Shopify is an original work of authorship and that you are legally entitled to grant the rights and privileges conveyed by these terms. You further represent, warrant and covenant that the consent of no other person or entity is or will be necessary for Shopify to use the submitted content.
50 | - By submitting content to Shopify, you irrevocably waive all moral rights which you may have in the content.
51 | - All content submitted by you to Shopify under this program is licensed under the MIT License.
52 | - You must report any discovered vulnerability to Shopify as soon as you have validated the vulnerability.
53 | - Failure to follow any of the foregoing rules will disqualify you from participating in this program.
54 |
55 | ** Please see our [Hackerone Profile](https://hackerone.com/shopify) for full details
56 |
57 | ## Receiving Security Updates
58 |
59 | To receive all general updates to vulnerabilities, please subscribe to our hackerone [Hacktivity](https://hackerone.com/shopify/hacktivity)
60 |
--------------------------------------------------------------------------------
/components/ClientRouter.js:
--------------------------------------------------------------------------------
1 | import { withRouter } from 'next/router';
2 | import {ClientRouter as AppBridgeClientRouter} from '@shopify/app-bridge-react';
3 |
4 | function ClientRouter(props) {
5 | const {router} = props;
6 | return ;
7 | };
8 |
9 | export default withRouter(ClientRouter);
10 |
--------------------------------------------------------------------------------
/components/ResourceList.js:
--------------------------------------------------------------------------------
1 | import gql from 'graphql-tag';
2 | import { Query } from 'react-apollo';
3 | import {
4 | Card,
5 | ResourceList,
6 | Stack,
7 | TextStyle,
8 | Thumbnail,
9 | } from '@shopify/polaris';
10 | import store from 'store-js';
11 | import { Redirect } from '@shopify/app-bridge/actions';
12 | import { Context } from '@shopify/app-bridge-react';
13 |
14 | const GET_PRODUCTS_BY_ID = gql`
15 | query getProducts($ids: [ID!]!) {
16 | nodes(ids: $ids) {
17 | ... on Product {
18 | title
19 | handle
20 | descriptionHtml
21 | id
22 | images(first: 1) {
23 | edges {
24 | node {
25 | originalSrc
26 | altText
27 | }
28 | }
29 | }
30 | variants(first: 1) {
31 | edges {
32 | node {
33 | price
34 | id
35 | }
36 | }
37 | }
38 | }
39 | }
40 | }
41 | `;
42 |
43 | class ResourceListWithProducts extends React.Component {
44 | static contextType = Context;
45 |
46 | render() {
47 | const app = this.context;
48 | const redirectToProduct = () => {
49 | const redirect = Redirect.create(app);
50 | redirect.dispatch(
51 | Redirect.Action.APP,
52 | '/edit-products',
53 | );
54 | };
55 |
56 | const twoWeeksFromNow = new Date(Date.now() + 12096e5).toDateString();
57 | return (
58 |
59 | {({ data, loading, error }) => {
60 | if (loading) { return