shoplazza-cli 1.0.11 → 1.0.13

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.
@@ -68,10 +68,25 @@ const requestAnalyticsIfNeeded = async () => {
68
68
  }
69
69
  };
70
70
 
71
+ const handleStoreUrl = (url) => {
72
+ const ERROR_MESSAGE =
73
+ 'Invalid store domain. Please provide the store domain in the following format: developer.myshoplaza.com';
74
+ try {
75
+ if (!url.includes('myshoplaza.com')) {
76
+ throw new Error(ERROR_MESSAGE);
77
+ }
78
+ !url.startsWith('https://') && (url = `https://${url}`);
79
+ return new URL(url).host;
80
+ } catch (error) {
81
+ log.error(chalk.red(`✗ ${ERROR_MESSAGE}`));
82
+ }
83
+ };
84
+
71
85
  const loginIntoStore = async (store) => {
72
86
  try {
73
87
  if (store) {
74
- await checkAndLogin(store);
88
+ const storeUrl = handleStoreUrl(store);
89
+ storeUrl && (await checkAndLogin(storeUrl));
75
90
  } else {
76
91
  const answers = await inquirer.prompt([
77
92
  {
@@ -81,15 +96,8 @@ const loginIntoStore = async (store) => {
81
96
  }
82
97
  ]);
83
98
  if (answers.store) {
84
- if (!answers.store.includes('myshoplaza.com')) {
85
- log.error(
86
- chalk.red(
87
- `✗ Invalid store provided ${answers.store}. Please provide the store in the following format: developer.myshoplaza.com`
88
- )
89
- );
90
- return;
91
- }
92
- await checkAndLogin(answers.store);
99
+ const storeUrl = handleStoreUrl(answers.store);
100
+ storeUrl && (await checkAndLogin(storeUrl));
93
101
  } else {
94
102
  log.error(chalk.red(`✗ Please input the store domain.`));
95
103
  return;
@@ -2,7 +2,7 @@ exports.SSO_AUTH_URL = 'https://sso.shoplazza.com';
2
2
  exports.ACCOUNT_URL = 'https://myaccount.shoplazza.com';
3
3
  exports.CLIENT_ID = '807525c9-dd77-4f4e-a738-d1e9d02c593d';
4
4
  exports.REDIRECT_URI = 'http://127.0.0.1:3456';
5
- exports.THEME_DIRS = ['assets', 'config', 'layout', 'locales', 'sections', 'snippets', 'templates'];
5
+ exports.THEME_DIRS = ['assets', 'config', 'layout', 'locales', 'sections','blocks' ,'snippets', 'templates'];
6
6
  exports.DEV_SSO_AUTH_URL = 'https://sso.dev.shoplazza.com';
7
7
  exports.DEV_ACCOUNT_URL = 'https://myaccount.dev.shoplazza.com';
8
8
  exports.DEV_CLIENT_ID = 'b630b285-e098-4c51-a7a4-d0240c9fc209';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shoplazza-cli",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "description": "",
5
5
  "main": "bin/shoplazza",
6
6
  "engines": {