authtara-sdk 1.1.6 → 1.1.8
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 +112 -1
- package/dist/index.d.ts +112 -1
- package/dist/index.js +33 -0
- package/dist/index.mjs +33 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -340,6 +340,113 @@ declare class MeteringModule {
|
|
|
340
340
|
recordUsage(params: RecordUsageParams): Promise<RecordUsageResult>;
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
+
/**
|
|
344
|
+
* Authtara SDK - Pricing Module
|
|
345
|
+
*
|
|
346
|
+
* Mengambil data pricing (products/plans/prices) dari aplikasi Anda.
|
|
347
|
+
* Data ini dapat ditampilkan di halaman pricing aplikasi.
|
|
348
|
+
*/
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Price data structure
|
|
352
|
+
*/
|
|
353
|
+
interface AppPrice {
|
|
354
|
+
id: string;
|
|
355
|
+
displayName: string | null;
|
|
356
|
+
amount: string;
|
|
357
|
+
currency: string;
|
|
358
|
+
billingCycle: 'MONTHLY' | 'YEARLY' | 'ONE_TIME';
|
|
359
|
+
isDefault: boolean;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Feature data in a plan
|
|
363
|
+
*/
|
|
364
|
+
interface AppPlanFeature {
|
|
365
|
+
id: string;
|
|
366
|
+
name: string;
|
|
367
|
+
slug: string;
|
|
368
|
+
description: string | null;
|
|
369
|
+
type: 'BOOLEAN' | 'QUANTITY' | 'METERED';
|
|
370
|
+
enabled: boolean;
|
|
371
|
+
quantity: number | null;
|
|
372
|
+
unlimited: boolean;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Plan data structure
|
|
376
|
+
*/
|
|
377
|
+
interface AppPlan {
|
|
378
|
+
id: string;
|
|
379
|
+
name: string;
|
|
380
|
+
slug: string;
|
|
381
|
+
description: string | null;
|
|
382
|
+
isPopular: boolean;
|
|
383
|
+
trialDays: number | null;
|
|
384
|
+
sortOrder: number;
|
|
385
|
+
prices: AppPrice[];
|
|
386
|
+
features: AppPlanFeature[];
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Feature definition (product-level)
|
|
390
|
+
*/
|
|
391
|
+
interface AppFeature {
|
|
392
|
+
id: string;
|
|
393
|
+
name: string;
|
|
394
|
+
slug: string;
|
|
395
|
+
description: string | null;
|
|
396
|
+
type: 'BOOLEAN' | 'QUANTITY' | 'METERED';
|
|
397
|
+
unitName: string | null;
|
|
398
|
+
unitNamePlural: string | null;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Complete pricing response
|
|
402
|
+
*/
|
|
403
|
+
interface AppPricingResult {
|
|
404
|
+
id: string;
|
|
405
|
+
name: string;
|
|
406
|
+
slug: string;
|
|
407
|
+
description: string | null;
|
|
408
|
+
plans: AppPlan[];
|
|
409
|
+
features: AppFeature[];
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Pricing Module
|
|
413
|
+
*
|
|
414
|
+
* Menyediakan fungsi untuk mengambil data pricing aplikasi Anda.
|
|
415
|
+
* Berguna untuk menampilkan halaman pricing di aplikasi.
|
|
416
|
+
*
|
|
417
|
+
* @example
|
|
418
|
+
* ```typescript
|
|
419
|
+
* const pricing = await ds.pricing.getAppPricing();
|
|
420
|
+
*
|
|
421
|
+
* if (pricing) {
|
|
422
|
+
* console.log('Plans:', pricing.plans);
|
|
423
|
+
* }
|
|
424
|
+
* ```
|
|
425
|
+
*/
|
|
426
|
+
declare class PricingModule {
|
|
427
|
+
private readonly httpClient;
|
|
428
|
+
constructor(httpClient: HttpClient);
|
|
429
|
+
/**
|
|
430
|
+
* Get your app's pricing data
|
|
431
|
+
*
|
|
432
|
+
* Returns approved product, plans, prices, and features.
|
|
433
|
+
*
|
|
434
|
+
* @returns AppPricingResult or null if no approved pricing
|
|
435
|
+
*
|
|
436
|
+
* @example
|
|
437
|
+
* ```typescript
|
|
438
|
+
* const pricing = await ds.pricing.getAppPricing();
|
|
439
|
+
*
|
|
440
|
+
* if (pricing) {
|
|
441
|
+
* pricing.plans.forEach(plan => {
|
|
442
|
+
* console.log(`${plan.name}: ${plan.prices[0]?.amount} ${plan.prices[0]?.currency}`);
|
|
443
|
+
* });
|
|
444
|
+
* }
|
|
445
|
+
* ```
|
|
446
|
+
*/
|
|
447
|
+
getAppPricing(): Promise<AppPricingResult | null>;
|
|
448
|
+
}
|
|
449
|
+
|
|
343
450
|
/**
|
|
344
451
|
* Authtara SDK - Custom Error Classes
|
|
345
452
|
*
|
|
@@ -469,6 +576,10 @@ declare class Authtara {
|
|
|
469
576
|
* Metering module untuk usage-based billing
|
|
470
577
|
*/
|
|
471
578
|
readonly metering: MeteringModule;
|
|
579
|
+
/**
|
|
580
|
+
* Pricing module untuk mengambil data pricing aplikasi
|
|
581
|
+
*/
|
|
582
|
+
readonly pricing: PricingModule;
|
|
472
583
|
/**
|
|
473
584
|
* Create new Authtara SDK instance
|
|
474
585
|
*
|
|
@@ -478,4 +589,4 @@ declare class Authtara {
|
|
|
478
589
|
constructor(config: AuthtaraConfig);
|
|
479
590
|
}
|
|
480
591
|
|
|
481
|
-
export { ApiError, Authtara, type AuthtaraConfig, AuthtaraError, type CheckEntitlementParams, ConfigurationError, EntitlementDeniedError, type EntitlementResult, type ExchangeResult, InvalidTokenError, type RecordUsageParams, type RecordUsageResult, type SessionVerifyResult, Authtara as default };
|
|
592
|
+
export { ApiError, type AppFeature, type AppPlan, type AppPlanFeature, type AppPrice, type AppPricingResult, Authtara, type AuthtaraConfig, AuthtaraError, type CheckEntitlementParams, ConfigurationError, EntitlementDeniedError, type EntitlementResult, type ExchangeResult, InvalidTokenError, type RecordUsageParams, type RecordUsageResult, type SessionVerifyResult, Authtara as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -340,6 +340,113 @@ declare class MeteringModule {
|
|
|
340
340
|
recordUsage(params: RecordUsageParams): Promise<RecordUsageResult>;
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
+
/**
|
|
344
|
+
* Authtara SDK - Pricing Module
|
|
345
|
+
*
|
|
346
|
+
* Mengambil data pricing (products/plans/prices) dari aplikasi Anda.
|
|
347
|
+
* Data ini dapat ditampilkan di halaman pricing aplikasi.
|
|
348
|
+
*/
|
|
349
|
+
|
|
350
|
+
/**
|
|
351
|
+
* Price data structure
|
|
352
|
+
*/
|
|
353
|
+
interface AppPrice {
|
|
354
|
+
id: string;
|
|
355
|
+
displayName: string | null;
|
|
356
|
+
amount: string;
|
|
357
|
+
currency: string;
|
|
358
|
+
billingCycle: 'MONTHLY' | 'YEARLY' | 'ONE_TIME';
|
|
359
|
+
isDefault: boolean;
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Feature data in a plan
|
|
363
|
+
*/
|
|
364
|
+
interface AppPlanFeature {
|
|
365
|
+
id: string;
|
|
366
|
+
name: string;
|
|
367
|
+
slug: string;
|
|
368
|
+
description: string | null;
|
|
369
|
+
type: 'BOOLEAN' | 'QUANTITY' | 'METERED';
|
|
370
|
+
enabled: boolean;
|
|
371
|
+
quantity: number | null;
|
|
372
|
+
unlimited: boolean;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Plan data structure
|
|
376
|
+
*/
|
|
377
|
+
interface AppPlan {
|
|
378
|
+
id: string;
|
|
379
|
+
name: string;
|
|
380
|
+
slug: string;
|
|
381
|
+
description: string | null;
|
|
382
|
+
isPopular: boolean;
|
|
383
|
+
trialDays: number | null;
|
|
384
|
+
sortOrder: number;
|
|
385
|
+
prices: AppPrice[];
|
|
386
|
+
features: AppPlanFeature[];
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Feature definition (product-level)
|
|
390
|
+
*/
|
|
391
|
+
interface AppFeature {
|
|
392
|
+
id: string;
|
|
393
|
+
name: string;
|
|
394
|
+
slug: string;
|
|
395
|
+
description: string | null;
|
|
396
|
+
type: 'BOOLEAN' | 'QUANTITY' | 'METERED';
|
|
397
|
+
unitName: string | null;
|
|
398
|
+
unitNamePlural: string | null;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Complete pricing response
|
|
402
|
+
*/
|
|
403
|
+
interface AppPricingResult {
|
|
404
|
+
id: string;
|
|
405
|
+
name: string;
|
|
406
|
+
slug: string;
|
|
407
|
+
description: string | null;
|
|
408
|
+
plans: AppPlan[];
|
|
409
|
+
features: AppFeature[];
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Pricing Module
|
|
413
|
+
*
|
|
414
|
+
* Menyediakan fungsi untuk mengambil data pricing aplikasi Anda.
|
|
415
|
+
* Berguna untuk menampilkan halaman pricing di aplikasi.
|
|
416
|
+
*
|
|
417
|
+
* @example
|
|
418
|
+
* ```typescript
|
|
419
|
+
* const pricing = await ds.pricing.getAppPricing();
|
|
420
|
+
*
|
|
421
|
+
* if (pricing) {
|
|
422
|
+
* console.log('Plans:', pricing.plans);
|
|
423
|
+
* }
|
|
424
|
+
* ```
|
|
425
|
+
*/
|
|
426
|
+
declare class PricingModule {
|
|
427
|
+
private readonly httpClient;
|
|
428
|
+
constructor(httpClient: HttpClient);
|
|
429
|
+
/**
|
|
430
|
+
* Get your app's pricing data
|
|
431
|
+
*
|
|
432
|
+
* Returns approved product, plans, prices, and features.
|
|
433
|
+
*
|
|
434
|
+
* @returns AppPricingResult or null if no approved pricing
|
|
435
|
+
*
|
|
436
|
+
* @example
|
|
437
|
+
* ```typescript
|
|
438
|
+
* const pricing = await ds.pricing.getAppPricing();
|
|
439
|
+
*
|
|
440
|
+
* if (pricing) {
|
|
441
|
+
* pricing.plans.forEach(plan => {
|
|
442
|
+
* console.log(`${plan.name}: ${plan.prices[0]?.amount} ${plan.prices[0]?.currency}`);
|
|
443
|
+
* });
|
|
444
|
+
* }
|
|
445
|
+
* ```
|
|
446
|
+
*/
|
|
447
|
+
getAppPricing(): Promise<AppPricingResult | null>;
|
|
448
|
+
}
|
|
449
|
+
|
|
343
450
|
/**
|
|
344
451
|
* Authtara SDK - Custom Error Classes
|
|
345
452
|
*
|
|
@@ -469,6 +576,10 @@ declare class Authtara {
|
|
|
469
576
|
* Metering module untuk usage-based billing
|
|
470
577
|
*/
|
|
471
578
|
readonly metering: MeteringModule;
|
|
579
|
+
/**
|
|
580
|
+
* Pricing module untuk mengambil data pricing aplikasi
|
|
581
|
+
*/
|
|
582
|
+
readonly pricing: PricingModule;
|
|
472
583
|
/**
|
|
473
584
|
* Create new Authtara SDK instance
|
|
474
585
|
*
|
|
@@ -478,4 +589,4 @@ declare class Authtara {
|
|
|
478
589
|
constructor(config: AuthtaraConfig);
|
|
479
590
|
}
|
|
480
591
|
|
|
481
|
-
export { ApiError, Authtara, type AuthtaraConfig, AuthtaraError, type CheckEntitlementParams, ConfigurationError, EntitlementDeniedError, type EntitlementResult, type ExchangeResult, InvalidTokenError, type RecordUsageParams, type RecordUsageResult, type SessionVerifyResult, Authtara as default };
|
|
592
|
+
export { ApiError, type AppFeature, type AppPlan, type AppPlanFeature, type AppPrice, type AppPricingResult, Authtara, type AuthtaraConfig, AuthtaraError, type CheckEntitlementParams, ConfigurationError, EntitlementDeniedError, type EntitlementResult, type ExchangeResult, InvalidTokenError, type RecordUsageParams, type RecordUsageResult, type SessionVerifyResult, Authtara as default };
|
package/dist/index.js
CHANGED
|
@@ -374,6 +374,38 @@ var MeteringModule = class {
|
|
|
374
374
|
}
|
|
375
375
|
};
|
|
376
376
|
|
|
377
|
+
// src/pricing/index.ts
|
|
378
|
+
var PricingModule = class {
|
|
379
|
+
constructor(httpClient) {
|
|
380
|
+
if (!httpClient) {
|
|
381
|
+
throw new ConfigurationError("httpClient is required for PricingModule");
|
|
382
|
+
}
|
|
383
|
+
this.httpClient = httpClient;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Get your app's pricing data
|
|
387
|
+
*
|
|
388
|
+
* Returns approved product, plans, prices, and features.
|
|
389
|
+
*
|
|
390
|
+
* @returns AppPricingResult or null if no approved pricing
|
|
391
|
+
*
|
|
392
|
+
* @example
|
|
393
|
+
* ```typescript
|
|
394
|
+
* const pricing = await ds.pricing.getAppPricing();
|
|
395
|
+
*
|
|
396
|
+
* if (pricing) {
|
|
397
|
+
* pricing.plans.forEach(plan => {
|
|
398
|
+
* console.log(`${plan.name}: ${plan.prices[0]?.amount} ${plan.prices[0]?.currency}`);
|
|
399
|
+
* });
|
|
400
|
+
* }
|
|
401
|
+
* ```
|
|
402
|
+
*/
|
|
403
|
+
async getAppPricing() {
|
|
404
|
+
const pricing = await this.httpClient.get("/api/v1/dev/pricing");
|
|
405
|
+
return pricing;
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
|
|
377
409
|
// src/index.ts
|
|
378
410
|
var Authtara = class {
|
|
379
411
|
/**
|
|
@@ -401,6 +433,7 @@ var Authtara = class {
|
|
|
401
433
|
this.auth = new AuthModule(config.appId, config.apiKey, httpClient);
|
|
402
434
|
this.billing = new BillingModule(httpClient);
|
|
403
435
|
this.metering = new MeteringModule(httpClient);
|
|
436
|
+
this.pricing = new PricingModule(httpClient);
|
|
404
437
|
}
|
|
405
438
|
};
|
|
406
439
|
var index_default = Authtara;
|
package/dist/index.mjs
CHANGED
|
@@ -342,6 +342,38 @@ var MeteringModule = class {
|
|
|
342
342
|
}
|
|
343
343
|
};
|
|
344
344
|
|
|
345
|
+
// src/pricing/index.ts
|
|
346
|
+
var PricingModule = class {
|
|
347
|
+
constructor(httpClient) {
|
|
348
|
+
if (!httpClient) {
|
|
349
|
+
throw new ConfigurationError("httpClient is required for PricingModule");
|
|
350
|
+
}
|
|
351
|
+
this.httpClient = httpClient;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Get your app's pricing data
|
|
355
|
+
*
|
|
356
|
+
* Returns approved product, plans, prices, and features.
|
|
357
|
+
*
|
|
358
|
+
* @returns AppPricingResult or null if no approved pricing
|
|
359
|
+
*
|
|
360
|
+
* @example
|
|
361
|
+
* ```typescript
|
|
362
|
+
* const pricing = await ds.pricing.getAppPricing();
|
|
363
|
+
*
|
|
364
|
+
* if (pricing) {
|
|
365
|
+
* pricing.plans.forEach(plan => {
|
|
366
|
+
* console.log(`${plan.name}: ${plan.prices[0]?.amount} ${plan.prices[0]?.currency}`);
|
|
367
|
+
* });
|
|
368
|
+
* }
|
|
369
|
+
* ```
|
|
370
|
+
*/
|
|
371
|
+
async getAppPricing() {
|
|
372
|
+
const pricing = await this.httpClient.get("/api/v1/dev/pricing");
|
|
373
|
+
return pricing;
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
|
|
345
377
|
// src/index.ts
|
|
346
378
|
var Authtara = class {
|
|
347
379
|
/**
|
|
@@ -369,6 +401,7 @@ var Authtara = class {
|
|
|
369
401
|
this.auth = new AuthModule(config.appId, config.apiKey, httpClient);
|
|
370
402
|
this.billing = new BillingModule(httpClient);
|
|
371
403
|
this.metering = new MeteringModule(httpClient);
|
|
404
|
+
this.pricing = new PricingModule(httpClient);
|
|
372
405
|
}
|
|
373
406
|
};
|
|
374
407
|
var index_default = Authtara;
|
package/package.json
CHANGED