@commercelayer/cli-plugin-checkout
Advanced tools
Comparing version 3.0.4 to 3.1.0-beta.1
@@ -8,3 +8,2 @@ "use strict"; | ||
Object.defineProperty(exports, "Flags", { enumerable: true, get: function () { return core_1.Flags; } }); | ||
const chalk_1 = (0, tslib_1.__importDefault)(require("chalk")); | ||
const cli_core_1 = require("@commercelayer/cli-core"); | ||
@@ -25,3 +24,3 @@ const pkg = require('../package.json'); | ||
const err = error.first(); | ||
this.error(chalk_1.default.bgRed(`${err.title}: ${err.detail}`), { suggestions: ['Execute login to get access to the organization\'s resources'] }); | ||
this.error(cli_core_1.clColor.msg.error(`${err.title}: ${err.detail}`), { suggestions: ['Execute login to get access to the organization\'s resources'] }); | ||
} | ||
@@ -49,3 +48,3 @@ else | ||
else if (info.application.kind !== kind) | ||
this.error(`Invalid application kind: ${chalk_1.default.redBright(info.application.kind)}. Only ${chalk_1.default.cyanBright(kind)} access token can be used to generate a checkout URL`); | ||
this.error(`Invalid application kind: ${cli_core_1.clColor.msg.error(info.application.kind)}. Only ${cli_core_1.clColor.api.kind(kind)} access token can be used to generate a checkout URL`); | ||
return true; | ||
@@ -52,0 +51,0 @@ } |
@@ -6,4 +6,4 @@ "use strict"; | ||
const order_1 = (0, tslib_1.__importDefault)(require("./order")); | ||
const chalk_1 = (0, tslib_1.__importDefault)(require("chalk")); | ||
const url_1 = require("../../url"); | ||
const cli_core_1 = require("@commercelayer/cli-core"); | ||
class CheckoutIndex extends base_1.default { | ||
@@ -24,3 +24,3 @@ async run() { | ||
if (!flags.sku && !flags.bundle) | ||
this.error(`One of the options ${chalk_1.default.cyanBright('--order (-O)')}, ${chalk_1.default.cyanBright('--sku (-S)')} or ${chalk_1.default.cyanBright('--bundle (-B)')} is required`); | ||
this.error(`One of the options ${cli_core_1.clColor.cli.flag.cyanBright('--order (-O)')}, ${cli_core_1.clColor.cli.flag.cyanBright('--sku (-S)')} or ${cli_core_1.clColor.cli.flag.cyanBright('--bundle (-B)')} is required`); | ||
this.checkApplication(accessToken, 'sales_channel'); | ||
@@ -38,3 +38,3 @@ // Parse SKU and Bundle options | ||
if (!clSkus.some(cls => cls.code === li.sku_code)) | ||
this.error(`Inexistent ${this.itemName('sku')}: ${chalk_1.default.redBright(String(li.sku_code))}`); | ||
this.error(`Inexistent ${this.itemName('sku')}: ${cli_core_1.clColor.msg.error(String(li.sku_code))}`); | ||
}); | ||
@@ -46,3 +46,3 @@ // Check bundles existence | ||
if (!clBundles.some(clb => clb.code === li.bundle_code)) | ||
this.error(`Inexistent ${this.itemName('bundle')}: ${chalk_1.default.redBright(String(li.bundle_code))}`); | ||
this.error(`Inexistent ${this.itemName('bundle')}: ${cli_core_1.clColor.msg.error(String(li.bundle_code))}`); | ||
}); | ||
@@ -58,3 +58,3 @@ // Create order | ||
}); | ||
this.log(`\nCreated order ${chalk_1.default.bold(order.id)}`); | ||
this.log(`\nCreated order ${cli_core_1.clColor.api.id(order.id)}`); | ||
// Create line items | ||
@@ -67,3 +67,3 @@ const lis = []; | ||
const liCode = (['sku', 'skus'].includes(lic.item_type || '')) ? lic.sku_code : lic.bundle_code; | ||
this.log(`Created line item ${chalk_1.default.bold(lic.id)} for ${liName} ${chalk_1.default.italic(String(liCode))} and associated to order ${chalk_1.default.bold(order.id)}`); | ||
this.log(`Created line item ${cli_core_1.clColor.api.id(lic.id)} for ${liName} ${cli_core_1.clColor.cli.value.italic(String(liCode))} and associated to order ${cli_core_1.clColor.api.id(order.id)}`); | ||
}); | ||
@@ -75,4 +75,4 @@ if (lineItem) | ||
const checkoutUrl = (0, url_1.buildCheckoutUrl)(organization, order.id, accessToken); | ||
this.log(`\nCheckout URL for order ${chalk_1.default.yellowBright(order.id)}:\n`); | ||
this.log(chalk_1.default.cyanBright(checkoutUrl)); | ||
this.log(`\nCheckout URL for order ${cli_core_1.clColor.api.id(order.id)}:\n`); | ||
this.log(cli_core_1.clColor.cyanBright(checkoutUrl)); | ||
this.log(); | ||
@@ -91,7 +91,7 @@ if (flags.open) | ||
if (def.length > 2) | ||
this.error(`Invalid ${this.itemName(type)} option: ${chalk_1.default.redBright(item)}`); | ||
this.error(`Invalid ${this.itemName(type)} option: ${cli_core_1.clColor.msg.error(item)}`); | ||
const code = def[0]; | ||
const quantity = Number((def.length > 1) ? def[1] : 1); | ||
if (Number.isNaN(quantity) || (quantity < 0)) | ||
this.error(`Invalid ${this.itemName(type)} definition: ${chalk_1.default.redBright(item)}`); | ||
this.error(`Invalid ${this.itemName(type)} definition: ${cli_core_1.clColor.msg.error(item)}`); | ||
return { | ||
@@ -98,0 +98,0 @@ code, |
@@ -8,3 +8,2 @@ "use strict"; | ||
const url_1 = require("../../url"); | ||
const chalk_1 = (0, tslib_1.__importDefault)(require("chalk")); | ||
class CheckoutOrder extends base_1.default { | ||
@@ -21,4 +20,4 @@ async run() { | ||
const checkoutUrl = (0, url_1.buildCheckoutUrl)(organization, order.id, accessToken); | ||
this.log(`\nCheckout URL for order ${chalk_1.default.yellowBright(order.id)}:\n`); | ||
this.log(chalk_1.default.cyanBright(checkoutUrl)); | ||
this.log(`\nCheckout URL for order ${cli_core_1.clColor.api.id(order.id)}:\n`); | ||
this.log(cli_core_1.clColor.cyanBright(checkoutUrl)); | ||
this.log(); | ||
@@ -25,0 +24,0 @@ if (flags.open) |
@@ -1,1 +0,1 @@ | ||
{"version":"3.0.4","commands":{"checkout":{"id":"checkout","description":"create checkout URLs","pluginName":"@commercelayer/cli-plugin-checkout","pluginType":"core","aliases":[],"examples":["$ commercelayer checkout -O <order-id>","$ cl checkout -S <sku-code> -m <market-id> -c <coupon-code> -e <email-address>","$ cl checkout -S <sku-code-1> -S <sku-code-2> -m <market-id>"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"the slug of your organization","required":true},"domain":{"name":"domain","type":"option","char":"d","hidden":true,"required":false},"accessToken":{"name":"accessToken","type":"option","char":"a","hidden":false,"required":true},"open":{"name":"open","type":"boolean","description":"open checkout URL in default browser","allowNo":false},"order":{"name":"order","type":"option","char":"O","description":"an order id"},"sku":{"name":"sku","type":"option","char":"S","description":"an SKU code"},"bundle":{"name":"bundle","type":"option","char":"B","description":"a bundle code"},"market":{"name":"market","type":"option","char":"m","description":"a market number"},"coupon":{"name":"coupon","type":"option","char":"c","description":"a promo code"},"email":{"name":"email","type":"option","char":"e","description":"a customer email"}},"args":[]},"checkout:noc":{"id":"checkout:noc","pluginName":"@commercelayer/cli-plugin-checkout","pluginType":"core","hidden":true,"aliases":[],"flags":{},"args":[]},"checkout:order":{"id":"checkout:order","description":"create checkout URLs starting from an existing order","pluginName":"@commercelayer/cli-plugin-checkout","pluginType":"core","aliases":[],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"the slug of your organization","required":true},"domain":{"name":"domain","type":"option","char":"d","hidden":true,"required":false},"accessToken":{"name":"accessToken","type":"option","char":"a","hidden":false,"required":true},"open":{"name":"open","type":"boolean","description":"open checkout URL in default browser","allowNo":false}},"args":[{"name":"id","description":"unique id of the order","required":true}]}}} | ||
{"version":"3.1.0-beta.1","commands":{"checkout":{"id":"checkout","description":"create checkout URLs","pluginName":"@commercelayer/cli-plugin-checkout","pluginType":"core","aliases":[],"examples":["$ commercelayer checkout -O <order-id>","$ cl checkout -S <sku-code> -m <market-id> -c <coupon-code> -e <email-address>","$ cl checkout -S <sku-code-1> -S <sku-code-2> -m <market-id>"],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"the slug of your organization","required":true},"domain":{"name":"domain","type":"option","char":"d","hidden":true,"required":false},"accessToken":{"name":"accessToken","type":"option","char":"a","hidden":false,"required":true},"open":{"name":"open","type":"boolean","description":"open checkout URL in default browser","allowNo":false},"order":{"name":"order","type":"option","char":"O","description":"an order id"},"sku":{"name":"sku","type":"option","char":"S","description":"an SKU code"},"bundle":{"name":"bundle","type":"option","char":"B","description":"a bundle code"},"market":{"name":"market","type":"option","char":"m","description":"a market number"},"coupon":{"name":"coupon","type":"option","char":"c","description":"a promo code"},"email":{"name":"email","type":"option","char":"e","description":"a customer email"}},"args":[]},"checkout:noc":{"id":"checkout:noc","pluginName":"@commercelayer/cli-plugin-checkout","pluginType":"core","hidden":true,"aliases":[],"flags":{},"args":[]},"checkout:order":{"id":"checkout:order","description":"create checkout URLs starting from an existing order","pluginName":"@commercelayer/cli-plugin-checkout","pluginType":"core","aliases":[],"flags":{"organization":{"name":"organization","type":"option","char":"o","description":"the slug of your organization","required":true},"domain":{"name":"domain","type":"option","char":"d","hidden":true,"required":false},"accessToken":{"name":"accessToken","type":"option","char":"a","hidden":false,"required":true},"open":{"name":"open","type":"boolean","description":"open checkout URL in default browser","allowNo":false}},"args":[{"name":"id","description":"unique id of the order","required":true}]}}} |
{ | ||
"name": "@commercelayer/cli-plugin-checkout", | ||
"description": "Commerce Layer CLI Checkout plugin", | ||
"version": "3.0.4", | ||
"version": "3.1.0-beta.1", | ||
"author": "Pierluigi Viti <pierluigi@commercelayer.io>", | ||
@@ -9,4 +9,4 @@ "bugs": "https://github.com/commercelayer/commercelayer-cli-plugin-checkout/issues", | ||
"@oclif/dev-cli": "git+https://github.com/pviti/dev-cli.git", | ||
"@oclif/plugin-help": "^5.1.10", | ||
"@oclif/test": "^2.0.3", | ||
"@oclif/plugin-help": "^5.1.10", | ||
"@types/chai": "^4.2.22", | ||
@@ -73,7 +73,6 @@ "@types/jsonwebtoken": "^8.5.5", | ||
"dependencies": { | ||
"@commercelayer/cli-core": "^1.0.0", | ||
"@commercelayer/cli-core": "^1.3.6", | ||
"@commercelayer/js-auth": "^2.2.9", | ||
"@commercelayer/sdk": "^4.3.0", | ||
"@oclif/core": "^1.1.2", | ||
"chalk": "^4.1.2", | ||
"cli-ux": "^6.0.8", | ||
@@ -80,0 +79,0 @@ "tslib": "^2.3.1" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6
24271
378
1
- Removedchalk@^4.1.2