Browse Source
Show the period when prompting for a domain purchase
master
Matheus Fernandes
8 years ago
No known key found for this signature in database
GPG Key ID: DD07CA4EA7B65C4F
3 changed files with
7 additions and
6 deletions
-
bin/domains/buy.js
-
lib/alias.js
-
lib/domains.js
|
|
@ -24,7 +24,7 @@ module.exports = async function({ domains, args, currentTeam, user }) { |
|
|
|
elapsed = stamp() |
|
|
|
let stopSpinner = wait(`Checking availability for ${nameParam}`) |
|
|
|
|
|
|
|
const price = await domains.price(name) |
|
|
|
const { price, period } = await domains.price(name) |
|
|
|
const available = await domains.status(name) |
|
|
|
|
|
|
|
stopSpinner() |
|
|
@ -34,10 +34,10 @@ module.exports = async function({ domains, args, currentTeam, user }) { |
|
|
|
`The domain ${nameParam} is ${italic('unavailable')}! ${elapsed()}` |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
const periodMsg = `${period}yr${period > 1 ? 's' : ''}, ` |
|
|
|
info(`The domain ${nameParam} is ${italic('available')}! ${elapsed()}`) |
|
|
|
const confirmation = await promptBool( |
|
|
|
`Buy now for ${bold(`$${price}`)} (${bold((currentTeam && currentTeam.slug) || user.username || user.email)})?` |
|
|
|
`Buy now for ${bold(`$${price}`)} (${bold(periodMsg + (currentTeam && currentTeam.slug) || user.username || user.email)})?` |
|
|
|
) |
|
|
|
|
|
|
|
eraseLines(1) |
|
|
|
|
|
@ -546,12 +546,13 @@ module.exports = class Alias extends Now { |
|
|
|
stopSpinner() |
|
|
|
|
|
|
|
if (canBePurchased) { |
|
|
|
const price = await pricePromise |
|
|
|
const { price, period } = await pricePromise |
|
|
|
const periodMsg = `${period}yr${period > 1 ? 's' : ''}, ` |
|
|
|
info( |
|
|
|
`The domain ${aliasParam} is ${chalk.bold('available for purchase')}! ${elapsed()}` |
|
|
|
) |
|
|
|
const confirmation = await promptBool( |
|
|
|
`Buy now for ${chalk.bold(`$${price}`)} (${chalk.bold((currentTeam && currentTeam.slug) || user.username || user.email)})?` |
|
|
|
`Buy now for ${chalk.bold(`$${price}`)} (${chalk.bold(periodMsg + (currentTeam && currentTeam.slug) || user.username || user.email)})?` |
|
|
|
) |
|
|
|
eraseLines(1) |
|
|
|
if (!confirmation) { |
|
|
|
|
|
@ -125,7 +125,7 @@ module.exports = class Domains extends Now { |
|
|
|
console.timeEnd(`> [debug] #${attempt} GET /domains/price?${query}`) |
|
|
|
} |
|
|
|
|
|
|
|
return json.price |
|
|
|
return json |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|