cleo-dev 0.1.3 → 0.1.4
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.
- package/dist/cli.js +24 -9
- package/dist/index.js +23 -8
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -55718,7 +55718,7 @@ var {
|
|
|
55718
55718
|
} = import_index.default;
|
|
55719
55719
|
|
|
55720
55720
|
// package.json
|
|
55721
|
-
var version = "0.1.
|
|
55721
|
+
var version = "0.1.4";
|
|
55722
55722
|
|
|
55723
55723
|
// src/commands/init.ts
|
|
55724
55724
|
init_cjs_shims();
|
|
@@ -131403,14 +131403,29 @@ async function startDevServer(options) {
|
|
|
131403
131403
|
const { name: name16, email: email5 } = req.body || {};
|
|
131404
131404
|
debug.log(`[Autumn Sync] Syncing customer ${userId.slice(0, 10)}... name: ${name16}, email: ${email5}`);
|
|
131405
131405
|
try {
|
|
131406
|
-
|
|
131407
|
-
|
|
131408
|
-
|
|
131409
|
-
|
|
131410
|
-
|
|
131411
|
-
|
|
131412
|
-
|
|
131413
|
-
|
|
131406
|
+
let customerExists = false;
|
|
131407
|
+
let hasProducts = false;
|
|
131408
|
+
try {
|
|
131409
|
+
const customer = await Autumn.customers.get(userId);
|
|
131410
|
+
customerExists = !!customer.data;
|
|
131411
|
+
hasProducts = customer.data?.products?.some(
|
|
131412
|
+
(p) => p.status === "active" || p.status === "scheduled"
|
|
131413
|
+
) ?? false;
|
|
131414
|
+
debug.log(`[Autumn Sync] Customer exists: ${customerExists}, has products: ${hasProducts}`);
|
|
131415
|
+
} catch {
|
|
131416
|
+
debug.log(`[Autumn Sync] Customer doesn't exist yet`);
|
|
131417
|
+
}
|
|
131418
|
+
if (!customerExists || !hasProducts) {
|
|
131419
|
+
debug.log(`[Autumn Sync] Attaching free plan for new customer`);
|
|
131420
|
+
await Autumn.attach({
|
|
131421
|
+
customer_id: userId,
|
|
131422
|
+
product_id: "free",
|
|
131423
|
+
customer_data: {
|
|
131424
|
+
...name16 && { name: name16 },
|
|
131425
|
+
...email5 && { email: email5 }
|
|
131426
|
+
}
|
|
131427
|
+
});
|
|
131428
|
+
}
|
|
131414
131429
|
if (name16 || email5) {
|
|
131415
131430
|
try {
|
|
131416
131431
|
await Autumn.customers.update(userId, {
|
package/dist/index.js
CHANGED
|
@@ -123010,14 +123010,29 @@ async function startDevServer(options) {
|
|
|
123010
123010
|
const { name: name16, email: email5 } = req.body || {};
|
|
123011
123011
|
debug.log(`[Autumn Sync] Syncing customer ${userId.slice(0, 10)}... name: ${name16}, email: ${email5}`);
|
|
123012
123012
|
try {
|
|
123013
|
-
|
|
123014
|
-
|
|
123015
|
-
|
|
123016
|
-
|
|
123017
|
-
|
|
123018
|
-
|
|
123019
|
-
|
|
123020
|
-
|
|
123013
|
+
let customerExists = false;
|
|
123014
|
+
let hasProducts = false;
|
|
123015
|
+
try {
|
|
123016
|
+
const customer = await Autumn.customers.get(userId);
|
|
123017
|
+
customerExists = !!customer.data;
|
|
123018
|
+
hasProducts = customer.data?.products?.some(
|
|
123019
|
+
(p) => p.status === "active" || p.status === "scheduled"
|
|
123020
|
+
) ?? false;
|
|
123021
|
+
debug.log(`[Autumn Sync] Customer exists: ${customerExists}, has products: ${hasProducts}`);
|
|
123022
|
+
} catch {
|
|
123023
|
+
debug.log(`[Autumn Sync] Customer doesn't exist yet`);
|
|
123024
|
+
}
|
|
123025
|
+
if (!customerExists || !hasProducts) {
|
|
123026
|
+
debug.log(`[Autumn Sync] Attaching free plan for new customer`);
|
|
123027
|
+
await Autumn.attach({
|
|
123028
|
+
customer_id: userId,
|
|
123029
|
+
product_id: "free",
|
|
123030
|
+
customer_data: {
|
|
123031
|
+
...name16 && { name: name16 },
|
|
123032
|
+
...email5 && { email: email5 }
|
|
123033
|
+
}
|
|
123034
|
+
});
|
|
123035
|
+
}
|
|
123021
123036
|
if (name16 || email5) {
|
|
123022
123037
|
try {
|
|
123023
123038
|
await Autumn.customers.update(userId, {
|