Skip to content

Commit

Permalink
Merge pull request #10 from Kazuki-tam/feature/return-add
Browse files Browse the repository at this point in the history
Feature/return add
  • Loading branch information
Kazuki-tam authored Jan 14, 2023
2 parents 3601a73 + 66ce0f6 commit 19a1f87
Show file tree
Hide file tree
Showing 14 changed files with 1,634 additions and 80 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
shopify-email-notification is a template repository for email notifications.
This template makes it easy to customize notification files at local.

Note: This project is still in development.🧑🏻‍💻

## Status

[![Release (latest by date)](https://img.shields.io/github/v/release/Kazuki-tam/shopify-email-notification)](https://github.com/Kazuki-tam/shopify-email-notification/releases/tag/v0.0.1)
Expand All @@ -23,7 +21,7 @@ shopify-email-notification is a template repository for email notifications.
- Built in useful commands

## Requirements
- [Node v16+](https://nodejs.org/en/)
- [Node v16.17.0 or higher](https://nodejs.org/en/)
- [Shopify store](https://shopify.dev/themes/tools/development-stores#create-a-development-store-for-a-client)

## Main dependencies
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "shopify-email-notification",
"version": "0.0.3",
"version": "0.0.4",
"description": "shopify-email-notification is a template repository for email notifications.",
"author": "Kazuki Yonemoto (https://dev.to/tim_yone)",
"license": "MIT",
Expand Down Expand Up @@ -58,8 +58,9 @@
"returns": "npm-run-all --parallel 'returns:*'",
"returns:returnCreated": "FLAG=return_created ts-node tasks/opener",
"returns:returnLabelNotification": "FLAG=return_label_notification ts-node tasks/opener",
"staffOrderNotifications": "npm-run-all --parallel 'staffOrderNotifications:*'",
"staffOrderNotifications:new_order_notification": "FLAG=new_order_notification ts-node tasks/opener",
"returns:returnRequested": "FLAG=return_requested ts-node tasks/opener",
"returns:returnApproved": "FLAG=return_approved ts-node tasks/opener",
"returns:returnDeclined": "FLAG=return_declined ts-node tasks/opener",
"postInstall": "typesync"
},
"devDependencies": {
Expand Down
5 changes: 5 additions & 0 deletions server/constants/emailEnv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ const emailEnv = {
{
shopify_label: 'shopify_label',
tracking_url: '/',
carrier_name: "Sample",
tracking_number: 123456,
return_label: {
public_file_url: "/"
}
},
],
},
Expand Down
34 changes: 20 additions & 14 deletions server/constants/linkList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ const linkList = [
{
category: 'orders',
title_en: 'Abandoned POS checkout',
title_ja: 'POSでのカゴ落ち',
title_ja: 'POSでのチェックアウト離脱',
path: '/orders/buy-online',
},
{
category: 'orders',
title_en: 'Abandoned checkout',
title_ja: 'カゴ落ち',
title_ja: 'チェックアウト離脱',
path: '/orders/abandoned-checkout-notification',
},
{
Expand Down Expand Up @@ -140,7 +140,7 @@ const linkList = [
{
category: 'local_pickup',
title_en: 'Picked up',
title_ja: '店舗受け取り済み',
title_ja: '店頭受取済み',
path: '/local-pickup/pickup-receipt',
},
{
Expand Down Expand Up @@ -181,27 +181,33 @@ const linkList = [
},
{
category: 'returns',
title_en: 'Return instructions with label/tracking',
title_ja: 'ラベル/追跡情報が付いた返品',
title_en: 'Return label/tracking for a return',
title_ja: '返品の返品用ラベル/追跡品',
path: '/returns/return-created',
},
{
category: 'returns',
title_en: 'Return label only',
title_ja: '返品用ラベルのみ',
title_en: 'Return label for an order',
title_ja: '注文の返品用ラベル',
path: '/returns/return-label-notification',
},
{
category: 'returns',
title_en: 'Return label only',
title_ja: '返品用ラベルのみ',
path: '/returns/return-label-notification',
title_en: 'Return request confirmation',
title_ja: '返品リクエストの確認',
path: '/returns/return_requested',
},
{
category: 'staff_order_notifications',
title_en: 'New order',
title_ja: '新しい注文',
path: '/staff-order-notifications/new-order-notification',
category: 'returns',
title_en: 'Return request approved',
title_ja: '返品リクエストが承認されました',
path: '/returns/return_approved',
},
{
category: 'returns',
title_en: 'Return request declined',
title_ja: '返品リクエストが拒否されました',
path: '/returns/return_declined',
},
];

Expand Down
14 changes: 7 additions & 7 deletions server/routes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ const emailMarketingList = linkList.filter(
(item) => item.category === 'email_marketing',
);
const returnsList = linkList.filter((item) => item.category === 'returns');
const staffOrderNotificationsList = linkList.filter(
(item) => item.category === 'staff_order_notifications',
);
// const staffOrderNotificationsList = linkList.filter(
// (item) => item.category === 'staff_order_notifications',
// );
const listObject = {
ordersList: ordersList,
shippingList: shippingList,
Expand All @@ -27,7 +27,7 @@ const listObject = {
customerList: customerList,
emailMarketingList: emailMarketingList,
returnsList: returnsList,
staffOrderNotificationsList: staffOrderNotificationsList,
// staffOrderNotificationsList: staffOrderNotificationsList,
};

router.get('/', (_req, res) => {
Expand Down Expand Up @@ -78,8 +78,8 @@ router.get('/shipping/:name', (req, res) => {
});

// Staff order notifications
router.get('/staff-order-notifications/:name', (req, res) => {
res.render(req.params.name, emailEnv);
});
// router.get('/staff-order-notifications/:name', (req, res) => {
// res.render(req.params.name, emailEnv);
// });

export { router };
11 changes: 8 additions & 3 deletions tasks/opener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,14 @@ const openUrl = () => {
if (FLAG === 'return_label_notification') {
targetUrl = `${ADMIN_URL}email_templates/return_label_notification/edit`
}
// Staff order notifications
if (FLAG === 'new_order_notification') {
targetUrl = `${ADMIN_URL}email_templates/new_order_notification/edit`
if (FLAG === 'return_requested') {
targetUrl = `${ADMIN_URL}email_templates/return_requested/edit`
}
if (FLAG === 'return_approved') {
targetUrl = `${ADMIN_URL}email_templates/return_approved/edit`
}
if (FLAG === 'return_declined') {
targetUrl = `${ADMIN_URL}email_templates/return_declined/edit`
}
// Open a URL
console.log(`Open: ${blue}${targetUrl}${reset}`);
Expand Down
Loading

0 comments on commit 19a1f87

Please sign in to comment.