@moneymq/better-auth 0.7.0 → 0.9.0

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/index.d.mts CHANGED
@@ -27,9 +27,9 @@ interface UsageMetric {
27
27
  */
28
28
  name: string;
29
29
  /**
30
- * MoneyMQ price ID for this metric
30
+ * MoneyMQ product ID for this metric
31
31
  */
32
- priceId: string;
32
+ productId: string;
33
33
  /**
34
34
  * Human-readable display name
35
35
  */
@@ -254,8 +254,8 @@ interface CreateCheckoutParams {
254
254
  * usage: {
255
255
  * enabled: true,
256
256
  * metrics: [
257
- * { name: 'api_calls', priceId: 'price_xxx', unit: 'requests' },
258
- * { name: 'storage', priceId: 'price_yyy', unit: 'GB' },
257
+ * { name: 'api_calls', productId: 'api-calls-metered', unit: 'requests' },
258
+ * { name: 'storage', productId: 'storage-metered', unit: 'GB' },
259
259
  * ],
260
260
  * },
261
261
  * }),
@@ -340,7 +340,7 @@ declare const moneymq: (options: MoneyMQPluginOptions) => {
340
340
  url: string;
341
341
  sessionId: string;
342
342
  lineItems: {
343
- price: string;
343
+ productId: string;
344
344
  quantity: number;
345
345
  }[];
346
346
  totalRecords: number;
@@ -349,14 +349,17 @@ declare const moneymq: (options: MoneyMQPluginOptions) => {
349
349
  method: "POST";
350
350
  body: z.ZodObject<{
351
351
  lineItems: z.ZodArray<z.ZodObject<{
352
- price: z.ZodString;
353
- quantity: z.ZodNumber;
352
+ productId: z.ZodString;
353
+ experimentId: z.ZodOptional<z.ZodString>;
354
+ quantity: z.ZodOptional<z.ZodNumber>;
354
355
  }, "strip", z.ZodTypeAny, {
355
- quantity: number;
356
- price: string;
356
+ productId: string;
357
+ quantity?: number | undefined;
358
+ experimentId?: string | undefined;
357
359
  }, {
358
- quantity: number;
359
- price: string;
360
+ productId: string;
361
+ quantity?: number | undefined;
362
+ experimentId?: string | undefined;
360
363
  }>, "many">;
361
364
  successUrl: z.ZodString;
362
365
  cancelUrl: z.ZodString;
@@ -365,16 +368,18 @@ declare const moneymq: (options: MoneyMQPluginOptions) => {
365
368
  successUrl: string;
366
369
  cancelUrl: string;
367
370
  lineItems: {
368
- quantity: number;
369
- price: string;
371
+ productId: string;
372
+ quantity?: number | undefined;
373
+ experimentId?: string | undefined;
370
374
  }[];
371
375
  metadata?: Record<string, string> | undefined;
372
376
  }, {
373
377
  successUrl: string;
374
378
  cancelUrl: string;
375
379
  lineItems: {
376
- quantity: number;
377
- price: string;
380
+ productId: string;
381
+ quantity?: number | undefined;
382
+ experimentId?: string | undefined;
378
383
  }[];
379
384
  metadata?: Record<string, string> | undefined;
380
385
  }>;
package/dist/index.d.ts CHANGED
@@ -27,9 +27,9 @@ interface UsageMetric {
27
27
  */
28
28
  name: string;
29
29
  /**
30
- * MoneyMQ price ID for this metric
30
+ * MoneyMQ product ID for this metric
31
31
  */
32
- priceId: string;
32
+ productId: string;
33
33
  /**
34
34
  * Human-readable display name
35
35
  */
@@ -254,8 +254,8 @@ interface CreateCheckoutParams {
254
254
  * usage: {
255
255
  * enabled: true,
256
256
  * metrics: [
257
- * { name: 'api_calls', priceId: 'price_xxx', unit: 'requests' },
258
- * { name: 'storage', priceId: 'price_yyy', unit: 'GB' },
257
+ * { name: 'api_calls', productId: 'api-calls-metered', unit: 'requests' },
258
+ * { name: 'storage', productId: 'storage-metered', unit: 'GB' },
259
259
  * ],
260
260
  * },
261
261
  * }),
@@ -340,7 +340,7 @@ declare const moneymq: (options: MoneyMQPluginOptions) => {
340
340
  url: string;
341
341
  sessionId: string;
342
342
  lineItems: {
343
- price: string;
343
+ productId: string;
344
344
  quantity: number;
345
345
  }[];
346
346
  totalRecords: number;
@@ -349,14 +349,17 @@ declare const moneymq: (options: MoneyMQPluginOptions) => {
349
349
  method: "POST";
350
350
  body: z.ZodObject<{
351
351
  lineItems: z.ZodArray<z.ZodObject<{
352
- price: z.ZodString;
353
- quantity: z.ZodNumber;
352
+ productId: z.ZodString;
353
+ experimentId: z.ZodOptional<z.ZodString>;
354
+ quantity: z.ZodOptional<z.ZodNumber>;
354
355
  }, "strip", z.ZodTypeAny, {
355
- quantity: number;
356
- price: string;
356
+ productId: string;
357
+ quantity?: number | undefined;
358
+ experimentId?: string | undefined;
357
359
  }, {
358
- quantity: number;
359
- price: string;
360
+ productId: string;
361
+ quantity?: number | undefined;
362
+ experimentId?: string | undefined;
360
363
  }>, "many">;
361
364
  successUrl: z.ZodString;
362
365
  cancelUrl: z.ZodString;
@@ -365,16 +368,18 @@ declare const moneymq: (options: MoneyMQPluginOptions) => {
365
368
  successUrl: string;
366
369
  cancelUrl: string;
367
370
  lineItems: {
368
- quantity: number;
369
- price: string;
371
+ productId: string;
372
+ quantity?: number | undefined;
373
+ experimentId?: string | undefined;
370
374
  }[];
371
375
  metadata?: Record<string, string> | undefined;
372
376
  }, {
373
377
  successUrl: string;
374
378
  cancelUrl: string;
375
379
  lineItems: {
376
- quantity: number;
377
- price: string;
380
+ productId: string;
381
+ quantity?: number | undefined;
382
+ experimentId?: string | undefined;
378
383
  }[];
379
384
  metadata?: Record<string, string> | undefined;
380
385
  }>;
package/dist/index.js CHANGED
@@ -4316,7 +4316,7 @@ var moneymq = (options) => {
4316
4316
  if (!metricTotals[record.metric]) {
4317
4317
  metricTotals[record.metric] = {
4318
4318
  quantity: 0,
4319
- priceId: metricConfig.priceId,
4319
+ productId: metricConfig.productId,
4320
4320
  recordIds: []
4321
4321
  };
4322
4322
  }
@@ -4334,7 +4334,7 @@ var moneymq = (options) => {
4334
4334
  metricTotals[record.metric].recordIds.push(record.id);
4335
4335
  }
4336
4336
  const lineItems = Object.values(metricTotals).map((m) => ({
4337
- price: m.priceId,
4337
+ productId: m.productId,
4338
4338
  quantity: Math.ceil(m.quantity)
4339
4339
  }));
4340
4340
  const allRecordIds = Object.values(metricTotals).flatMap((m) => m.recordIds);
@@ -4365,8 +4365,9 @@ var moneymq = (options) => {
4365
4365
  body: z.object({
4366
4366
  lineItems: z.array(
4367
4367
  z.object({
4368
- price: z.string(),
4369
- quantity: z.number().positive()
4368
+ productId: z.string(),
4369
+ experimentId: z.string().optional(),
4370
+ quantity: z.number().positive().optional()
4370
4371
  })
4371
4372
  ),
4372
4373
  successUrl: z.string(),