@freemius/sdk 0.1.0 → 0.3.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 +193 -169
- package/dist/index.d.mts.map +1 -1
- package/dist/index.d.ts +193 -169
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -2
- package/dist/index.mjs +30 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -169,7 +169,7 @@ var WebhookError = class extends Error {
|
|
|
169
169
|
|
|
170
170
|
//#endregion
|
|
171
171
|
//#region package.json
|
|
172
|
-
var version = "0.
|
|
172
|
+
var version = "0.3.0";
|
|
173
173
|
|
|
174
174
|
//#endregion
|
|
175
175
|
//#region src/api/client.ts
|
|
@@ -480,6 +480,34 @@ var User = class extends ApiBase {
|
|
|
480
480
|
if (!this.isGoodResponse(response.response) || !response.data || !response.data) return null;
|
|
481
481
|
return response.data;
|
|
482
482
|
}
|
|
483
|
+
async retrieveHostedCustomerPortal(userId) {
|
|
484
|
+
const response = await this.client.POST(`/products/{product_id}/portal/login.json`, {
|
|
485
|
+
params: { path: { product_id: this.productId } },
|
|
486
|
+
body: { id: idToString(userId) }
|
|
487
|
+
});
|
|
488
|
+
if (!this.isGoodResponse(response.response) || !response.data) return null;
|
|
489
|
+
return response.data;
|
|
490
|
+
}
|
|
491
|
+
async retrieveHostedCustomerPortalByEmail(email) {
|
|
492
|
+
const response = await this.client.POST(`/products/{product_id}/portal/login.json`, {
|
|
493
|
+
params: { path: { product_id: this.productId } },
|
|
494
|
+
body: { email }
|
|
495
|
+
});
|
|
496
|
+
if (!this.isGoodResponse(response.response) || !response.data) return null;
|
|
497
|
+
return response.data;
|
|
498
|
+
}
|
|
499
|
+
async retrieveInvoice(userId, paymentId) {
|
|
500
|
+
const response = await this.client.GET(`/products/{product_id}/users/{user_id}/payments/{payment_id}/invoice.pdf`, {
|
|
501
|
+
params: { path: {
|
|
502
|
+
product_id: this.productId,
|
|
503
|
+
user_id: this.getIdForPath(userId),
|
|
504
|
+
payment_id: this.getIdForPath(paymentId)
|
|
505
|
+
} },
|
|
506
|
+
parseAs: "blob"
|
|
507
|
+
});
|
|
508
|
+
if (!this.isGoodResponse(response.response) || !response.data) return null;
|
|
509
|
+
return response.data;
|
|
510
|
+
}
|
|
483
511
|
};
|
|
484
512
|
|
|
485
513
|
//#endregion
|
|
@@ -556,7 +584,7 @@ function isTestServer() {
|
|
|
556
584
|
|
|
557
585
|
//#endregion
|
|
558
586
|
//#region src/services/ApiService.ts
|
|
559
|
-
const API_ENDPOINT_PRODUCTION = "https://api.freemius.com/v1/";
|
|
587
|
+
const API_ENDPOINT_PRODUCTION = "https://fast-api.freemius.com/v1/";
|
|
560
588
|
const API_ENDPOINT_TEST = "http://api.freemius-local.com:8080/v1/";
|
|
561
589
|
/**
|
|
562
590
|
* @todo - Add a proper user-agent string with SDK version.
|
package/dist/index.mjs
CHANGED
|
@@ -147,7 +147,7 @@ var WebhookError = class extends Error {
|
|
|
147
147
|
|
|
148
148
|
//#endregion
|
|
149
149
|
//#region package.json
|
|
150
|
-
var version = "0.
|
|
150
|
+
var version = "0.3.0";
|
|
151
151
|
|
|
152
152
|
//#endregion
|
|
153
153
|
//#region src/api/client.ts
|
|
@@ -458,6 +458,34 @@ var User = class extends ApiBase {
|
|
|
458
458
|
if (!this.isGoodResponse(response.response) || !response.data || !response.data) return null;
|
|
459
459
|
return response.data;
|
|
460
460
|
}
|
|
461
|
+
async retrieveHostedCustomerPortal(userId) {
|
|
462
|
+
const response = await this.client.POST(`/products/{product_id}/portal/login.json`, {
|
|
463
|
+
params: { path: { product_id: this.productId } },
|
|
464
|
+
body: { id: idToString(userId) }
|
|
465
|
+
});
|
|
466
|
+
if (!this.isGoodResponse(response.response) || !response.data) return null;
|
|
467
|
+
return response.data;
|
|
468
|
+
}
|
|
469
|
+
async retrieveHostedCustomerPortalByEmail(email) {
|
|
470
|
+
const response = await this.client.POST(`/products/{product_id}/portal/login.json`, {
|
|
471
|
+
params: { path: { product_id: this.productId } },
|
|
472
|
+
body: { email }
|
|
473
|
+
});
|
|
474
|
+
if (!this.isGoodResponse(response.response) || !response.data) return null;
|
|
475
|
+
return response.data;
|
|
476
|
+
}
|
|
477
|
+
async retrieveInvoice(userId, paymentId) {
|
|
478
|
+
const response = await this.client.GET(`/products/{product_id}/users/{user_id}/payments/{payment_id}/invoice.pdf`, {
|
|
479
|
+
params: { path: {
|
|
480
|
+
product_id: this.productId,
|
|
481
|
+
user_id: this.getIdForPath(userId),
|
|
482
|
+
payment_id: this.getIdForPath(paymentId)
|
|
483
|
+
} },
|
|
484
|
+
parseAs: "blob"
|
|
485
|
+
});
|
|
486
|
+
if (!this.isGoodResponse(response.response) || !response.data) return null;
|
|
487
|
+
return response.data;
|
|
488
|
+
}
|
|
461
489
|
};
|
|
462
490
|
|
|
463
491
|
//#endregion
|
|
@@ -534,7 +562,7 @@ function isTestServer() {
|
|
|
534
562
|
|
|
535
563
|
//#endregion
|
|
536
564
|
//#region src/services/ApiService.ts
|
|
537
|
-
const API_ENDPOINT_PRODUCTION = "https://api.freemius.com/v1/";
|
|
565
|
+
const API_ENDPOINT_PRODUCTION = "https://fast-api.freemius.com/v1/";
|
|
538
566
|
const API_ENDPOINT_TEST = "http://api.freemius-local.com:8080/v1/";
|
|
539
567
|
/**
|
|
540
568
|
* @todo - Add a proper user-agent string with SDK version.
|