@ztimson/momentum 0.52.2 → 0.52.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/client.d.ts +7 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/core.d.ts +1 -0
- package/dist/core.d.ts.map +1 -1
- package/dist/email.d.ts +5 -0
- package/dist/email.d.ts.map +1 -1
- package/dist/index.cjs +131 -61
- package/dist/index.mjs +131 -61
- package/dist/payments.d.ts +129 -23
- package/dist/payments.d.ts.map +1 -1
- package/dist/pdf.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/client.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export type Platform = 'windows' | 'android' | 'ios' | 'mac' | 'linux' | 'unknow
|
|
|
5
5
|
export declare class Client extends PathEventEmitter {
|
|
6
6
|
private api;
|
|
7
7
|
private readonly settings;
|
|
8
|
+
/** Check if iframed */
|
|
9
|
+
get iframe(): boolean;
|
|
8
10
|
/** Check if mobile device */
|
|
9
11
|
get mobile(): boolean;
|
|
10
12
|
private _notifications;
|
|
@@ -22,10 +24,13 @@ export declare class Client extends PathEventEmitter {
|
|
|
22
24
|
constructor(api: Api, settings: Settings);
|
|
23
25
|
/**
|
|
24
26
|
* Inject the client theme settings, meta tags & PWA prompt
|
|
25
|
-
* @param
|
|
27
|
+
* @param opts Injection options: reload - use cached settings or reload; pwa - disabled auto pwa prompt
|
|
26
28
|
* @return {Promise<void>} Resolves on completion
|
|
27
29
|
*/
|
|
28
|
-
|
|
30
|
+
init(opts?: {
|
|
31
|
+
reload?: boolean;
|
|
32
|
+
pwa?: boolean;
|
|
33
|
+
}): Promise<void>;
|
|
29
34
|
/**
|
|
30
35
|
* Create UI prompt for user to install as PWA
|
|
31
36
|
* @param platform Platform prompt, leave blank to auto-detect
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"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AAE,GAAG,EAAmB,QAAQ,EAAE,QAAQ;IAKjE;;;;OAIG;IACG,IAAI,CAAC,IAAI,GAAE;QAAC,MAAM,CAAC,EAAE,OAAO,CAAC;QAAC,GAAG,CAAC,EAAE,OAAO,CAAA;KAAM;IAyFvD;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,EAAE,SAAS,GAAG,KAAK;IAqItC;;;OAGG;IACG,mBAAmB,IAAI,OAAO,CAAC,IAAI,CAAC;IAa1C;;;OAGG;IACG,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;CAO3C"}
|
package/dist/core.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ export type Notification = {
|
|
|
27
27
|
/** Link to on activation */
|
|
28
28
|
link?: string;
|
|
29
29
|
};
|
|
30
|
+
export type Optional<T, O> = Omit<T, keyof O> & Pick<Partial<O>, keyof O>;
|
|
30
31
|
/** Recursive type for defining tree data */
|
|
31
32
|
export type TreeNode<T> = T & {
|
|
32
33
|
/** Name of node */
|
package/dist/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAEzC,qBAAqB;AACrB,MAAM,MAAM,IAAI,GAAG;IAClB,kBAAkB;IAClB,GAAG,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;IACnB,uBAAuB;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,wBAAwB;IACxB,YAAY,EAAE,IAAI,CAAC;IACnB,wBAAwB;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,yBAAyB;IACzB,YAAY,EAAE,IAAI,CAAC;CACnB,CAAA;AAED,8BAA8B;AAC9B,MAAM,MAAM,kBAAkB,GAAI,OAAO,GAAG,cAAc,GAAG,KAAK,GAAG,OAAO,CAAC;AAE7E,yBAAyB;AACzB,MAAM,MAAM,YAAY,GAAG;IAC1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CAAC;IACf,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,IAAI,CAAC,EAAE,MAAM,GAAG;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,GAAG,CAAA;KAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"email.d.ts","sourceRoot":"","sources":["../src/email.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAM,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAE1B,kBAAkB;AAClB,MAAM,MAAM,IAAI,GAAG;IAClB,2BAA2B;IAC3B,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACtB,uBAAuB;IACvB,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;IACd,uBAAuB;IACvB,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,IAAI,CAAC,EAAE,MAAM,GAAG;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,GAAG,CAAA;KAAC,CAAC;IAC/C,wBAAwB;IACxB,WAAW,CAAC,EAAE;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAC,EAAE,CAAA;CACnD,CAAA;AAED,kBAAkB;AAClB,qBAAa,KAAM,SAAQ,gBAAgB;IAC1C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAO;gBAEf,GAAG,EAAE,GAAG,GAAG,MAAM;IAK7B;;;;OAIG;IACH,IAAI,CAAC,KAAK,EAAE,IAAI;CAOhB"}
|
package/dist/index.cjs
CHANGED
|
@@ -575,6 +575,20 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
575
575
|
}
|
|
576
576
|
}
|
|
577
577
|
__publicField2(GatewayTimeoutError, "code", 504);
|
|
578
|
+
class HttpResponse extends Response {
|
|
579
|
+
constructor(resp, stream) {
|
|
580
|
+
super(stream, { headers: resp.headers, status: resp.status, statusText: resp.statusText });
|
|
581
|
+
__publicField2(this, "data");
|
|
582
|
+
__publicField2(this, "ok");
|
|
583
|
+
__publicField2(this, "redirected");
|
|
584
|
+
__publicField2(this, "type");
|
|
585
|
+
__publicField2(this, "url");
|
|
586
|
+
this.ok = resp.ok;
|
|
587
|
+
this.redirected = resp.redirected;
|
|
588
|
+
this.type = resp.type;
|
|
589
|
+
this.url = resp.url;
|
|
590
|
+
}
|
|
591
|
+
}
|
|
578
592
|
const _Http = class _Http2 {
|
|
579
593
|
constructor(defaults = {}) {
|
|
580
594
|
__publicField2(this, "interceptors", {});
|
|
@@ -646,13 +660,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
646
660
|
push();
|
|
647
661
|
}
|
|
648
662
|
});
|
|
649
|
-
resp
|
|
650
|
-
if (opts.decode
|
|
663
|
+
resp = new HttpResponse(resp, stream);
|
|
664
|
+
if (opts.decode !== false) {
|
|
651
665
|
const content = (_b = resp.headers.get("Content-Type")) == null ? void 0 : _b.toLowerCase();
|
|
652
|
-
if (content == null ? void 0 : content.includes("form")) resp.data = await resp.
|
|
653
|
-
else if (content == null ? void 0 : content.includes("json")) resp.data = await resp.
|
|
654
|
-
else if (content == null ? void 0 : content.includes("text")) resp.data = await resp.
|
|
655
|
-
else if (content == null ? void 0 : content.includes("application")) resp.data = await resp.
|
|
666
|
+
if (content == null ? void 0 : content.includes("form")) resp.data = await resp.formData();
|
|
667
|
+
else if (content == null ? void 0 : content.includes("json")) resp.data = await resp.json();
|
|
668
|
+
else if (content == null ? void 0 : content.includes("text")) resp.data = await resp.text();
|
|
669
|
+
else if (content == null ? void 0 : content.includes("application")) resp.data = await resp.blob();
|
|
656
670
|
}
|
|
657
671
|
if (resp.ok) res(resp);
|
|
658
672
|
else rej(resp);
|
|
@@ -1007,7 +1021,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1007
1021
|
if (this.pending[key] != null) return this.pending[key];
|
|
1008
1022
|
this.pending[key] = super.request(options).then((response) => {
|
|
1009
1023
|
this.emit(PES`api/response:${method}`, { request: options, response });
|
|
1010
|
-
return response.data;
|
|
1024
|
+
return options.decode === false ? response : response.data;
|
|
1011
1025
|
}).catch((err) => {
|
|
1012
1026
|
const e = (err == null ? void 0 : err.data) || err;
|
|
1013
1027
|
this.emit(PES`api/error:${method}`, { request: options, error: e });
|
|
@@ -1445,6 +1459,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1445
1459
|
this.settings = settings;
|
|
1446
1460
|
this.pushSubscription.then((resp) => this.notifications = !!resp);
|
|
1447
1461
|
}
|
|
1462
|
+
/** Check if iframed */
|
|
1463
|
+
get iframe() {
|
|
1464
|
+
return (parent == null ? void 0 : parent.location) != location;
|
|
1465
|
+
}
|
|
1448
1466
|
/** Check if mobile device */
|
|
1449
1467
|
get mobile() {
|
|
1450
1468
|
return ["android", "ios"].includes(this.platform);
|
|
@@ -1487,11 +1505,16 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1487
1505
|
}
|
|
1488
1506
|
/**
|
|
1489
1507
|
* Inject the client theme settings, meta tags & PWA prompt
|
|
1490
|
-
* @param
|
|
1508
|
+
* @param opts Injection options: reload - use cached settings or reload; pwa - disabled auto pwa prompt
|
|
1491
1509
|
* @return {Promise<void>} Resolves on completion
|
|
1492
1510
|
*/
|
|
1493
|
-
async
|
|
1511
|
+
async init(opts = {}) {
|
|
1494
1512
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1513
|
+
opts = {
|
|
1514
|
+
reload: void 0,
|
|
1515
|
+
pwa: true,
|
|
1516
|
+
...opts
|
|
1517
|
+
};
|
|
1495
1518
|
const meta = (key, name, value) => {
|
|
1496
1519
|
const exists = document.querySelector(`meta[${key}="${name}"]`);
|
|
1497
1520
|
if (value === void 0 || exists) return exists;
|
|
@@ -1500,9 +1523,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1500
1523
|
meta2.content = value;
|
|
1501
1524
|
document.head.append(meta2);
|
|
1502
1525
|
};
|
|
1503
|
-
if (!this.settings.cache.keys().length) reload = true;
|
|
1504
|
-
let settings = await (reload ? this.settings.all(false, true) : this.settings.cache);
|
|
1505
|
-
if (reload == null) this.settings.all(false, true).then(() => this.
|
|
1526
|
+
if (!this.settings.cache.keys().length) opts.reload = true;
|
|
1527
|
+
let settings = await (opts.reload ? this.settings.all(false, true) : this.settings.cache);
|
|
1528
|
+
if (opts.reload == null) this.settings.all(false, true).then(() => this.init({ reload: false }));
|
|
1506
1529
|
if (settings["title"]) document.querySelectorAll(".momentum-title").forEach((el) => el.innerText = settings["title"]);
|
|
1507
1530
|
if (settings["description"]) document.querySelectorAll(".momentum-description").forEach((el) => el.innerText = settings["description"]);
|
|
1508
1531
|
if (settings["version"]) document.querySelectorAll(".momentum-version").forEach((el) => el.innerText = settings["version"]);
|
|
@@ -1520,21 +1543,21 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1520
1543
|
meta("name", "twitter:title", settings["title"]);
|
|
1521
1544
|
meta("name", "twitter:description", settings["description"]);
|
|
1522
1545
|
meta("name", "twitter:image", `${settings["public_url"]}/favicon.png`);
|
|
1523
|
-
meta("name", "mobile-web-app-capable", "yes");
|
|
1524
|
-
meta("name", "apple-mobile-web-app-status-bar-style", "default");
|
|
1525
|
-
meta("name", "apple-mobile-web-app-title", settings["title"]);
|
|
1526
|
-
meta("name", "apple-touch-icon", `${settings["public_url"]}/favicon.png`);
|
|
1527
|
-
meta("name", "apple-touch-startup-image", `${settings["public_url"]}/favicon.png`);
|
|
1528
1546
|
if (settings["pwa"]) {
|
|
1547
|
+
meta("name", "mobile-web-app-capable", "yes");
|
|
1548
|
+
meta("name", "apple-mobile-web-app-status-bar-style", "default");
|
|
1549
|
+
meta("name", "apple-mobile-web-app-title", settings["title"]);
|
|
1550
|
+
meta("name", "apple-touch-icon", `${settings["public_url"]}/favicon.png`);
|
|
1551
|
+
meta("name", "apple-touch-startup-image", `${settings["public_url"]}/favicon.png`);
|
|
1529
1552
|
if (!document.querySelector('link[rel="manifest"]')) {
|
|
1530
1553
|
const link = document.createElement("link");
|
|
1531
1554
|
link.setAttribute("rel", "manifest");
|
|
1532
1555
|
link.setAttribute("href", this.settings.api.url + "/manifest.json");
|
|
1533
1556
|
document.head.append(link);
|
|
1534
1557
|
}
|
|
1535
|
-
setTimeout(() => {
|
|
1558
|
+
if (opts.pwa && !this.iframe && !this.pwa && this.mobile) setTimeout(() => {
|
|
1536
1559
|
const dismissed = !!localStorage.getItem("momentum:install-prompt");
|
|
1537
|
-
if (!dismissed
|
|
1560
|
+
if (!dismissed) this.pwaPrompt();
|
|
1538
1561
|
}, 6e4);
|
|
1539
1562
|
}
|
|
1540
1563
|
meta("name", "theme-color", (_a = settings["theme"]) == null ? void 0 : _a.background);
|
|
@@ -2008,8 +2031,9 @@ ${log}`;
|
|
|
2008
2031
|
constructor(api, opts = {}) {
|
|
2009
2032
|
super();
|
|
2010
2033
|
__publicField(this, "api");
|
|
2011
|
-
|
|
2034
|
+
/** Stripe object */
|
|
2012
2035
|
__publicField(this, "stripe");
|
|
2036
|
+
/** Public stripe token */
|
|
2013
2037
|
__publicField(this, "token");
|
|
2014
2038
|
this.opts = opts;
|
|
2015
2039
|
this.api = typeof api == "string" ? new Api(api) : api;
|
|
@@ -2018,43 +2042,86 @@ ${log}`;
|
|
|
2018
2042
|
...this.opts
|
|
2019
2043
|
};
|
|
2020
2044
|
}
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
invoice: opts == null ? void 0 : opts.invoice,
|
|
2027
|
-
extra: opts == null ? void 0 : opts.extra
|
|
2028
|
-
} });
|
|
2029
|
-
this.emit(PES`payments:c`, request.token);
|
|
2030
|
-
return request.token;
|
|
2031
|
-
}
|
|
2045
|
+
/**
|
|
2046
|
+
* Initialize stripe API
|
|
2047
|
+
* @return {Promise<any>} Returns stripe API
|
|
2048
|
+
* @private
|
|
2049
|
+
*/
|
|
2032
2050
|
async init() {
|
|
2033
|
-
|
|
2034
|
-
if (this.
|
|
2035
|
-
const
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
document.head.appendChild(
|
|
2040
|
-
});
|
|
2051
|
+
await new Promise((res) => {
|
|
2052
|
+
if (this.stripe) return res(window["Stripe"]);
|
|
2053
|
+
const stripeScript = document.createElement("script");
|
|
2054
|
+
stripeScript.src = "https://js.stripe.com/v3/";
|
|
2055
|
+
stripeScript.setAttribute("crossorigin", "anonymous");
|
|
2056
|
+
stripeScript.onload = () => res();
|
|
2057
|
+
document.head.appendChild(stripeScript);
|
|
2058
|
+
}).then(() => this.stripe = window["Stripe"]);
|
|
2041
2059
|
return this.stripe(this.token);
|
|
2042
2060
|
}
|
|
2061
|
+
/**
|
|
2062
|
+
* Create a stripe client secret to complete transaction
|
|
2063
|
+
* @param {string} id Transaction ID
|
|
2064
|
+
* @return {Promise<string>} Client secret
|
|
2065
|
+
* @private
|
|
2066
|
+
*/
|
|
2067
|
+
createSecret(id) {
|
|
2068
|
+
return this.api.request({ url: `/api/payments/init/${id || ""}`, method: "POST" }).then((resp) => resp.token);
|
|
2069
|
+
}
|
|
2070
|
+
/**
|
|
2071
|
+
* Create/Update a transaction
|
|
2072
|
+
* @param {Optional<Transaction, "subtotal" | "total">} transaction Transaction information
|
|
2073
|
+
* @return {Promise<string>} Completed translation information
|
|
2074
|
+
*/
|
|
2075
|
+
checkout(transaction) {
|
|
2076
|
+
return this.api.request({
|
|
2077
|
+
url: `/api/payments/transactions/${transaction._id || ""}`,
|
|
2078
|
+
method: transaction._id ? "PATCH" : "POST",
|
|
2079
|
+
body: transaction
|
|
2080
|
+
}).then((resp) => {
|
|
2081
|
+
this.emit(PES`payments:c`, resp);
|
|
2082
|
+
return resp;
|
|
2083
|
+
});
|
|
2084
|
+
}
|
|
2085
|
+
/**
|
|
2086
|
+
* Get translation history
|
|
2087
|
+
* @param {string} username Limit history to user
|
|
2088
|
+
* @return {Promise<Transaction[]>} List of translations
|
|
2089
|
+
*/
|
|
2043
2090
|
async history(username) {
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2091
|
+
return this.api.request({ url: `/api/payments/transactions/${username || ""}` }).then((resp) => {
|
|
2092
|
+
this.emit(PES`payments/${username}:r`, resp);
|
|
2093
|
+
return resp;
|
|
2094
|
+
});
|
|
2095
|
+
}
|
|
2096
|
+
/**
|
|
2097
|
+
* Send recipient transaction receipt or invoice
|
|
2098
|
+
* @param {string} id Translation ID
|
|
2099
|
+
* @return {Promise<void>} Returns once complete
|
|
2100
|
+
*/
|
|
2101
|
+
notify(id) {
|
|
2102
|
+
return this.api.request({ url: `/api/payments/notify/${id || ""}`, method: "POST" });
|
|
2047
2103
|
}
|
|
2048
|
-
|
|
2104
|
+
/**
|
|
2105
|
+
* Retrieve a list of available products
|
|
2106
|
+
* @param {string | number} id Limit to specific product
|
|
2107
|
+
* @return {Promise<any>} List of products or single product if ID is used
|
|
2108
|
+
*/
|
|
2109
|
+
products(id) {
|
|
2049
2110
|
return this.api.request({ url: `/api/payments/products/${id || ""}` }).then((resp) => {
|
|
2050
|
-
this.emit(PES`products/${id}:r`, resp);
|
|
2111
|
+
this.emit(PES`products/${id ?? ""}:r`, resp);
|
|
2051
2112
|
return resp;
|
|
2052
2113
|
});
|
|
2053
2114
|
}
|
|
2054
|
-
|
|
2055
|
-
|
|
2115
|
+
/**
|
|
2116
|
+
* Process payment programmatically
|
|
2117
|
+
* @param {string} id Transaction ID
|
|
2118
|
+
* @param {Card} card Credit card information
|
|
2119
|
+
* @return {Promise<any>} Stripe confirmation
|
|
2120
|
+
*/
|
|
2121
|
+
async payment(id, card) {
|
|
2122
|
+
const [client, secret] = await Promise.all([this.init(), this.createSecret(id)]);
|
|
2056
2123
|
return client.confirmPayment({
|
|
2057
|
-
clientSecret:
|
|
2124
|
+
clientSecret: secret,
|
|
2058
2125
|
confirmParams: {
|
|
2059
2126
|
payment_method: {
|
|
2060
2127
|
card: { ...card, details: void 0 },
|
|
@@ -2063,9 +2130,15 @@ ${log}`;
|
|
|
2063
2130
|
}
|
|
2064
2131
|
});
|
|
2065
2132
|
}
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2133
|
+
/**
|
|
2134
|
+
* Process payment using Stripe form
|
|
2135
|
+
* @param {string} id Transaction ID
|
|
2136
|
+
* @param {string} element DOM element to inject form into
|
|
2137
|
+
* @return {Promise<() => Promise<any>>} Callback to submit form
|
|
2138
|
+
*/
|
|
2139
|
+
async paymentForm(id, element) {
|
|
2140
|
+
const [client, secret] = await Promise.all([this.init(), this.createSecret(id)]);
|
|
2141
|
+
const form = client.elements({ clientSecret: secret });
|
|
2069
2142
|
form.create("payment").mount(element);
|
|
2070
2143
|
return (redirect = location.href) => client.confirmPayment({
|
|
2071
2144
|
elements: form,
|
|
@@ -2075,11 +2148,11 @@ ${log}`;
|
|
|
2075
2148
|
}
|
|
2076
2149
|
/**
|
|
2077
2150
|
* Complete payment via Momentum's payment page
|
|
2078
|
-
* @param {string}
|
|
2151
|
+
* @param {string} id Transaction ID
|
|
2079
2152
|
* @param {string} host Host origin attempting to login
|
|
2080
|
-
* @return {Promise<string>}
|
|
2153
|
+
* @return {Promise<string>} Translation ID on success
|
|
2081
2154
|
*/
|
|
2082
|
-
paymentRedirect(
|
|
2155
|
+
paymentRedirect(id, host = location.origin) {
|
|
2083
2156
|
return new Promise(async (res, rej) => {
|
|
2084
2157
|
var _a;
|
|
2085
2158
|
let origin = new URL(this.opts.paymentUrl).origin, done = false, listener, win;
|
|
@@ -2092,7 +2165,7 @@ ${log}`;
|
|
|
2092
2165
|
win.close();
|
|
2093
2166
|
res(data.response);
|
|
2094
2167
|
});
|
|
2095
|
-
win = window.open(encodeURI(`${(_a = this.opts) == null ? void 0 : _a.paymentUrl}?token=${
|
|
2168
|
+
win = window.open(encodeURI(`${(_a = this.opts) == null ? void 0 : _a.paymentUrl}?token=${id}&host=${host}`), "_blank");
|
|
2096
2169
|
if (!win) {
|
|
2097
2170
|
window.removeEventListener("message", listener);
|
|
2098
2171
|
return rej("Unable to open payment page");
|
|
@@ -2110,17 +2183,14 @@ ${log}`;
|
|
|
2110
2183
|
this.api = typeof api == "string" ? new Api(api) : api;
|
|
2111
2184
|
}
|
|
2112
2185
|
createPdf(body, options) {
|
|
2113
|
-
return this.api.request({ url: `/api/` + PES`pdf`, body: { ...body, options }
|
|
2114
|
-
const blob = await resp.blob();
|
|
2186
|
+
return this.api.request({ url: `/api/` + PES`pdf`, body: { ...body, options } }).then(async (resp) => {
|
|
2115
2187
|
if (options == null ? void 0 : options.download) {
|
|
2116
2188
|
let filename = (options == null ? void 0 : options.filename) || timestampFilename();
|
|
2117
2189
|
if (!filename.endsWith(".pdf")) filename += ".pdf";
|
|
2118
|
-
|
|
2119
|
-
downloadUrl(url, filename);
|
|
2120
|
-
URL.revokeObjectURL(url);
|
|
2190
|
+
downloadFile(resp, filename);
|
|
2121
2191
|
}
|
|
2122
|
-
this.emit(PES`pdf:c`,
|
|
2123
|
-
return
|
|
2192
|
+
this.emit(PES`pdf:c`, resp);
|
|
2193
|
+
return resp;
|
|
2124
2194
|
});
|
|
2125
2195
|
}
|
|
2126
2196
|
fromHtml(html, options = {}) {
|
package/dist/index.mjs
CHANGED
|
@@ -571,6 +571,20 @@ class GatewayTimeoutError extends CustomError {
|
|
|
571
571
|
}
|
|
572
572
|
}
|
|
573
573
|
__publicField2(GatewayTimeoutError, "code", 504);
|
|
574
|
+
class HttpResponse extends Response {
|
|
575
|
+
constructor(resp, stream) {
|
|
576
|
+
super(stream, { headers: resp.headers, status: resp.status, statusText: resp.statusText });
|
|
577
|
+
__publicField2(this, "data");
|
|
578
|
+
__publicField2(this, "ok");
|
|
579
|
+
__publicField2(this, "redirected");
|
|
580
|
+
__publicField2(this, "type");
|
|
581
|
+
__publicField2(this, "url");
|
|
582
|
+
this.ok = resp.ok;
|
|
583
|
+
this.redirected = resp.redirected;
|
|
584
|
+
this.type = resp.type;
|
|
585
|
+
this.url = resp.url;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
574
588
|
const _Http = class _Http2 {
|
|
575
589
|
constructor(defaults = {}) {
|
|
576
590
|
__publicField2(this, "interceptors", {});
|
|
@@ -642,13 +656,13 @@ const _Http = class _Http2 {
|
|
|
642
656
|
push();
|
|
643
657
|
}
|
|
644
658
|
});
|
|
645
|
-
resp
|
|
646
|
-
if (opts.decode
|
|
659
|
+
resp = new HttpResponse(resp, stream);
|
|
660
|
+
if (opts.decode !== false) {
|
|
647
661
|
const content = (_b = resp.headers.get("Content-Type")) == null ? void 0 : _b.toLowerCase();
|
|
648
|
-
if (content == null ? void 0 : content.includes("form")) resp.data = await resp.
|
|
649
|
-
else if (content == null ? void 0 : content.includes("json")) resp.data = await resp.
|
|
650
|
-
else if (content == null ? void 0 : content.includes("text")) resp.data = await resp.
|
|
651
|
-
else if (content == null ? void 0 : content.includes("application")) resp.data = await resp.
|
|
662
|
+
if (content == null ? void 0 : content.includes("form")) resp.data = await resp.formData();
|
|
663
|
+
else if (content == null ? void 0 : content.includes("json")) resp.data = await resp.json();
|
|
664
|
+
else if (content == null ? void 0 : content.includes("text")) resp.data = await resp.text();
|
|
665
|
+
else if (content == null ? void 0 : content.includes("application")) resp.data = await resp.blob();
|
|
652
666
|
}
|
|
653
667
|
if (resp.ok) res(resp);
|
|
654
668
|
else rej(resp);
|
|
@@ -1003,7 +1017,7 @@ class Api extends Http {
|
|
|
1003
1017
|
if (this.pending[key] != null) return this.pending[key];
|
|
1004
1018
|
this.pending[key] = super.request(options).then((response) => {
|
|
1005
1019
|
this.emit(PES`api/response:${method}`, { request: options, response });
|
|
1006
|
-
return response.data;
|
|
1020
|
+
return options.decode === false ? response : response.data;
|
|
1007
1021
|
}).catch((err) => {
|
|
1008
1022
|
const e = (err == null ? void 0 : err.data) || err;
|
|
1009
1023
|
this.emit(PES`api/error:${method}`, { request: options, error: e });
|
|
@@ -1441,6 +1455,10 @@ class Client extends PathEventEmitter {
|
|
|
1441
1455
|
this.settings = settings;
|
|
1442
1456
|
this.pushSubscription.then((resp) => this.notifications = !!resp);
|
|
1443
1457
|
}
|
|
1458
|
+
/** Check if iframed */
|
|
1459
|
+
get iframe() {
|
|
1460
|
+
return (parent == null ? void 0 : parent.location) != location;
|
|
1461
|
+
}
|
|
1444
1462
|
/** Check if mobile device */
|
|
1445
1463
|
get mobile() {
|
|
1446
1464
|
return ["android", "ios"].includes(this.platform);
|
|
@@ -1483,11 +1501,16 @@ class Client extends PathEventEmitter {
|
|
|
1483
1501
|
}
|
|
1484
1502
|
/**
|
|
1485
1503
|
* Inject the client theme settings, meta tags & PWA prompt
|
|
1486
|
-
* @param
|
|
1504
|
+
* @param opts Injection options: reload - use cached settings or reload; pwa - disabled auto pwa prompt
|
|
1487
1505
|
* @return {Promise<void>} Resolves on completion
|
|
1488
1506
|
*/
|
|
1489
|
-
async
|
|
1507
|
+
async init(opts = {}) {
|
|
1490
1508
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1509
|
+
opts = {
|
|
1510
|
+
reload: void 0,
|
|
1511
|
+
pwa: true,
|
|
1512
|
+
...opts
|
|
1513
|
+
};
|
|
1491
1514
|
const meta = (key, name, value) => {
|
|
1492
1515
|
const exists = document.querySelector(`meta[${key}="${name}"]`);
|
|
1493
1516
|
if (value === void 0 || exists) return exists;
|
|
@@ -1496,9 +1519,9 @@ class Client extends PathEventEmitter {
|
|
|
1496
1519
|
meta2.content = value;
|
|
1497
1520
|
document.head.append(meta2);
|
|
1498
1521
|
};
|
|
1499
|
-
if (!this.settings.cache.keys().length) reload = true;
|
|
1500
|
-
let settings = await (reload ? this.settings.all(false, true) : this.settings.cache);
|
|
1501
|
-
if (reload == null) this.settings.all(false, true).then(() => this.
|
|
1522
|
+
if (!this.settings.cache.keys().length) opts.reload = true;
|
|
1523
|
+
let settings = await (opts.reload ? this.settings.all(false, true) : this.settings.cache);
|
|
1524
|
+
if (opts.reload == null) this.settings.all(false, true).then(() => this.init({ reload: false }));
|
|
1502
1525
|
if (settings["title"]) document.querySelectorAll(".momentum-title").forEach((el) => el.innerText = settings["title"]);
|
|
1503
1526
|
if (settings["description"]) document.querySelectorAll(".momentum-description").forEach((el) => el.innerText = settings["description"]);
|
|
1504
1527
|
if (settings["version"]) document.querySelectorAll(".momentum-version").forEach((el) => el.innerText = settings["version"]);
|
|
@@ -1516,21 +1539,21 @@ class Client extends PathEventEmitter {
|
|
|
1516
1539
|
meta("name", "twitter:title", settings["title"]);
|
|
1517
1540
|
meta("name", "twitter:description", settings["description"]);
|
|
1518
1541
|
meta("name", "twitter:image", `${settings["public_url"]}/favicon.png`);
|
|
1519
|
-
meta("name", "mobile-web-app-capable", "yes");
|
|
1520
|
-
meta("name", "apple-mobile-web-app-status-bar-style", "default");
|
|
1521
|
-
meta("name", "apple-mobile-web-app-title", settings["title"]);
|
|
1522
|
-
meta("name", "apple-touch-icon", `${settings["public_url"]}/favicon.png`);
|
|
1523
|
-
meta("name", "apple-touch-startup-image", `${settings["public_url"]}/favicon.png`);
|
|
1524
1542
|
if (settings["pwa"]) {
|
|
1543
|
+
meta("name", "mobile-web-app-capable", "yes");
|
|
1544
|
+
meta("name", "apple-mobile-web-app-status-bar-style", "default");
|
|
1545
|
+
meta("name", "apple-mobile-web-app-title", settings["title"]);
|
|
1546
|
+
meta("name", "apple-touch-icon", `${settings["public_url"]}/favicon.png`);
|
|
1547
|
+
meta("name", "apple-touch-startup-image", `${settings["public_url"]}/favicon.png`);
|
|
1525
1548
|
if (!document.querySelector('link[rel="manifest"]')) {
|
|
1526
1549
|
const link = document.createElement("link");
|
|
1527
1550
|
link.setAttribute("rel", "manifest");
|
|
1528
1551
|
link.setAttribute("href", this.settings.api.url + "/manifest.json");
|
|
1529
1552
|
document.head.append(link);
|
|
1530
1553
|
}
|
|
1531
|
-
setTimeout(() => {
|
|
1554
|
+
if (opts.pwa && !this.iframe && !this.pwa && this.mobile) setTimeout(() => {
|
|
1532
1555
|
const dismissed = !!localStorage.getItem("momentum:install-prompt");
|
|
1533
|
-
if (!dismissed
|
|
1556
|
+
if (!dismissed) this.pwaPrompt();
|
|
1534
1557
|
}, 6e4);
|
|
1535
1558
|
}
|
|
1536
1559
|
meta("name", "theme-color", (_a = settings["theme"]) == null ? void 0 : _a.background);
|
|
@@ -2004,8 +2027,9 @@ class Payments extends PathEventEmitter {
|
|
|
2004
2027
|
constructor(api, opts = {}) {
|
|
2005
2028
|
super();
|
|
2006
2029
|
__publicField(this, "api");
|
|
2007
|
-
|
|
2030
|
+
/** Stripe object */
|
|
2008
2031
|
__publicField(this, "stripe");
|
|
2032
|
+
/** Public stripe token */
|
|
2009
2033
|
__publicField(this, "token");
|
|
2010
2034
|
this.opts = opts;
|
|
2011
2035
|
this.api = typeof api == "string" ? new Api(api) : api;
|
|
@@ -2014,43 +2038,86 @@ class Payments extends PathEventEmitter {
|
|
|
2014
2038
|
...this.opts
|
|
2015
2039
|
};
|
|
2016
2040
|
}
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
invoice: opts == null ? void 0 : opts.invoice,
|
|
2023
|
-
extra: opts == null ? void 0 : opts.extra
|
|
2024
|
-
} });
|
|
2025
|
-
this.emit(PES`payments:c`, request.token);
|
|
2026
|
-
return request.token;
|
|
2027
|
-
}
|
|
2041
|
+
/**
|
|
2042
|
+
* Initialize stripe API
|
|
2043
|
+
* @return {Promise<any>} Returns stripe API
|
|
2044
|
+
* @private
|
|
2045
|
+
*/
|
|
2028
2046
|
async init() {
|
|
2029
|
-
|
|
2030
|
-
if (this.
|
|
2031
|
-
const
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
document.head.appendChild(
|
|
2036
|
-
});
|
|
2047
|
+
await new Promise((res) => {
|
|
2048
|
+
if (this.stripe) return res(window["Stripe"]);
|
|
2049
|
+
const stripeScript = document.createElement("script");
|
|
2050
|
+
stripeScript.src = "https://js.stripe.com/v3/";
|
|
2051
|
+
stripeScript.setAttribute("crossorigin", "anonymous");
|
|
2052
|
+
stripeScript.onload = () => res();
|
|
2053
|
+
document.head.appendChild(stripeScript);
|
|
2054
|
+
}).then(() => this.stripe = window["Stripe"]);
|
|
2037
2055
|
return this.stripe(this.token);
|
|
2038
2056
|
}
|
|
2057
|
+
/**
|
|
2058
|
+
* Create a stripe client secret to complete transaction
|
|
2059
|
+
* @param {string} id Transaction ID
|
|
2060
|
+
* @return {Promise<string>} Client secret
|
|
2061
|
+
* @private
|
|
2062
|
+
*/
|
|
2063
|
+
createSecret(id) {
|
|
2064
|
+
return this.api.request({ url: `/api/payments/init/${id || ""}`, method: "POST" }).then((resp) => resp.token);
|
|
2065
|
+
}
|
|
2066
|
+
/**
|
|
2067
|
+
* Create/Update a transaction
|
|
2068
|
+
* @param {Optional<Transaction, "subtotal" | "total">} transaction Transaction information
|
|
2069
|
+
* @return {Promise<string>} Completed translation information
|
|
2070
|
+
*/
|
|
2071
|
+
checkout(transaction) {
|
|
2072
|
+
return this.api.request({
|
|
2073
|
+
url: `/api/payments/transactions/${transaction._id || ""}`,
|
|
2074
|
+
method: transaction._id ? "PATCH" : "POST",
|
|
2075
|
+
body: transaction
|
|
2076
|
+
}).then((resp) => {
|
|
2077
|
+
this.emit(PES`payments:c`, resp);
|
|
2078
|
+
return resp;
|
|
2079
|
+
});
|
|
2080
|
+
}
|
|
2081
|
+
/**
|
|
2082
|
+
* Get translation history
|
|
2083
|
+
* @param {string} username Limit history to user
|
|
2084
|
+
* @return {Promise<Transaction[]>} List of translations
|
|
2085
|
+
*/
|
|
2039
2086
|
async history(username) {
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2087
|
+
return this.api.request({ url: `/api/payments/transactions/${username || ""}` }).then((resp) => {
|
|
2088
|
+
this.emit(PES`payments/${username}:r`, resp);
|
|
2089
|
+
return resp;
|
|
2090
|
+
});
|
|
2091
|
+
}
|
|
2092
|
+
/**
|
|
2093
|
+
* Send recipient transaction receipt or invoice
|
|
2094
|
+
* @param {string} id Translation ID
|
|
2095
|
+
* @return {Promise<void>} Returns once complete
|
|
2096
|
+
*/
|
|
2097
|
+
notify(id) {
|
|
2098
|
+
return this.api.request({ url: `/api/payments/notify/${id || ""}`, method: "POST" });
|
|
2043
2099
|
}
|
|
2044
|
-
|
|
2100
|
+
/**
|
|
2101
|
+
* Retrieve a list of available products
|
|
2102
|
+
* @param {string | number} id Limit to specific product
|
|
2103
|
+
* @return {Promise<any>} List of products or single product if ID is used
|
|
2104
|
+
*/
|
|
2105
|
+
products(id) {
|
|
2045
2106
|
return this.api.request({ url: `/api/payments/products/${id || ""}` }).then((resp) => {
|
|
2046
|
-
this.emit(PES`products/${id}:r`, resp);
|
|
2107
|
+
this.emit(PES`products/${id ?? ""}:r`, resp);
|
|
2047
2108
|
return resp;
|
|
2048
2109
|
});
|
|
2049
2110
|
}
|
|
2050
|
-
|
|
2051
|
-
|
|
2111
|
+
/**
|
|
2112
|
+
* Process payment programmatically
|
|
2113
|
+
* @param {string} id Transaction ID
|
|
2114
|
+
* @param {Card} card Credit card information
|
|
2115
|
+
* @return {Promise<any>} Stripe confirmation
|
|
2116
|
+
*/
|
|
2117
|
+
async payment(id, card) {
|
|
2118
|
+
const [client, secret] = await Promise.all([this.init(), this.createSecret(id)]);
|
|
2052
2119
|
return client.confirmPayment({
|
|
2053
|
-
clientSecret:
|
|
2120
|
+
clientSecret: secret,
|
|
2054
2121
|
confirmParams: {
|
|
2055
2122
|
payment_method: {
|
|
2056
2123
|
card: { ...card, details: void 0 },
|
|
@@ -2059,9 +2126,15 @@ class Payments extends PathEventEmitter {
|
|
|
2059
2126
|
}
|
|
2060
2127
|
});
|
|
2061
2128
|
}
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2129
|
+
/**
|
|
2130
|
+
* Process payment using Stripe form
|
|
2131
|
+
* @param {string} id Transaction ID
|
|
2132
|
+
* @param {string} element DOM element to inject form into
|
|
2133
|
+
* @return {Promise<() => Promise<any>>} Callback to submit form
|
|
2134
|
+
*/
|
|
2135
|
+
async paymentForm(id, element) {
|
|
2136
|
+
const [client, secret] = await Promise.all([this.init(), this.createSecret(id)]);
|
|
2137
|
+
const form = client.elements({ clientSecret: secret });
|
|
2065
2138
|
form.create("payment").mount(element);
|
|
2066
2139
|
return (redirect = location.href) => client.confirmPayment({
|
|
2067
2140
|
elements: form,
|
|
@@ -2071,11 +2144,11 @@ class Payments extends PathEventEmitter {
|
|
|
2071
2144
|
}
|
|
2072
2145
|
/**
|
|
2073
2146
|
* Complete payment via Momentum's payment page
|
|
2074
|
-
* @param {string}
|
|
2147
|
+
* @param {string} id Transaction ID
|
|
2075
2148
|
* @param {string} host Host origin attempting to login
|
|
2076
|
-
* @return {Promise<string>}
|
|
2149
|
+
* @return {Promise<string>} Translation ID on success
|
|
2077
2150
|
*/
|
|
2078
|
-
paymentRedirect(
|
|
2151
|
+
paymentRedirect(id, host = location.origin) {
|
|
2079
2152
|
return new Promise(async (res, rej) => {
|
|
2080
2153
|
var _a;
|
|
2081
2154
|
let origin = new URL(this.opts.paymentUrl).origin, done = false, listener, win;
|
|
@@ -2088,7 +2161,7 @@ class Payments extends PathEventEmitter {
|
|
|
2088
2161
|
win.close();
|
|
2089
2162
|
res(data.response);
|
|
2090
2163
|
});
|
|
2091
|
-
win = window.open(encodeURI(`${(_a = this.opts) == null ? void 0 : _a.paymentUrl}?token=${
|
|
2164
|
+
win = window.open(encodeURI(`${(_a = this.opts) == null ? void 0 : _a.paymentUrl}?token=${id}&host=${host}`), "_blank");
|
|
2092
2165
|
if (!win) {
|
|
2093
2166
|
window.removeEventListener("message", listener);
|
|
2094
2167
|
return rej("Unable to open payment page");
|
|
@@ -2106,17 +2179,14 @@ class Pdf extends PathEventEmitter {
|
|
|
2106
2179
|
this.api = typeof api == "string" ? new Api(api) : api;
|
|
2107
2180
|
}
|
|
2108
2181
|
createPdf(body, options) {
|
|
2109
|
-
return this.api.request({ url: `/api/` + PES`pdf`, body: { ...body, options }
|
|
2110
|
-
const blob = await resp.blob();
|
|
2182
|
+
return this.api.request({ url: `/api/` + PES`pdf`, body: { ...body, options } }).then(async (resp) => {
|
|
2111
2183
|
if (options == null ? void 0 : options.download) {
|
|
2112
2184
|
let filename = (options == null ? void 0 : options.filename) || timestampFilename();
|
|
2113
2185
|
if (!filename.endsWith(".pdf")) filename += ".pdf";
|
|
2114
|
-
|
|
2115
|
-
downloadUrl(url, filename);
|
|
2116
|
-
URL.revokeObjectURL(url);
|
|
2186
|
+
downloadFile(resp, filename);
|
|
2117
2187
|
}
|
|
2118
|
-
this.emit(PES`pdf:c`,
|
|
2119
|
-
return
|
|
2188
|
+
this.emit(PES`pdf:c`, resp);
|
|
2189
|
+
return resp;
|
|
2120
2190
|
});
|
|
2121
2191
|
}
|
|
2122
2192
|
fromHtml(html, options = {}) {
|
package/dist/payments.d.ts
CHANGED
|
@@ -1,72 +1,178 @@
|
|
|
1
1
|
import { PathEventEmitter } from '@ztimson/utils';
|
|
2
2
|
import { Api } from './api';
|
|
3
3
|
import { Meta } from './core';
|
|
4
|
+
/** Creditcard information for payments */
|
|
4
5
|
export type Card = {
|
|
6
|
+
/** Creditcard number */
|
|
5
7
|
number: number | string;
|
|
8
|
+
/** Year card expires */
|
|
6
9
|
expYear: number | string;
|
|
10
|
+
/** Month card expires */
|
|
7
11
|
expMonth: number | string;
|
|
12
|
+
/** 3 digit security code */
|
|
8
13
|
csv: number | string;
|
|
14
|
+
/** Additional details for anti-fraud */
|
|
9
15
|
details?: {
|
|
16
|
+
/** Cardholder name */
|
|
10
17
|
name?: string;
|
|
18
|
+
/** Billing address */
|
|
11
19
|
address?: {
|
|
12
20
|
postal_code?: string;
|
|
13
21
|
};
|
|
14
22
|
};
|
|
15
23
|
};
|
|
16
|
-
|
|
24
|
+
/** Payment discounts */
|
|
25
|
+
export type Discount = Meta & {
|
|
26
|
+
/** Public discount code */
|
|
27
|
+
code: string;
|
|
28
|
+
/** Discount information */
|
|
29
|
+
description?: string;
|
|
30
|
+
/** Invalidate discount code */
|
|
31
|
+
expire?: Date;
|
|
32
|
+
/** Discount by fixed amount */
|
|
33
|
+
fixed?: number;
|
|
34
|
+
/** Limit the numer of uses */
|
|
35
|
+
limit?: number;
|
|
36
|
+
/** Discount by percentage */
|
|
37
|
+
percent?: number;
|
|
38
|
+
};
|
|
39
|
+
/** User financial status */
|
|
40
|
+
export type Finances = {
|
|
41
|
+
/** Username */
|
|
17
42
|
_id?: string;
|
|
18
|
-
|
|
43
|
+
/** Account balance */
|
|
19
44
|
balance: number;
|
|
45
|
+
/** Account subscriptions */
|
|
20
46
|
subscriptions: {
|
|
47
|
+
/** Product ID */
|
|
21
48
|
_id: string;
|
|
49
|
+
/** Date subscription started */
|
|
22
50
|
created: Date;
|
|
51
|
+
/** Number of days the subscription lasts */
|
|
23
52
|
interval: number;
|
|
24
53
|
}[];
|
|
25
54
|
};
|
|
55
|
+
/** Payment API options */
|
|
26
56
|
export type PaymentOptions = {
|
|
27
57
|
/** Path to payment page */
|
|
28
58
|
paymentUrl?: string;
|
|
29
59
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
60
|
+
/** Returned products */
|
|
61
|
+
export type Product = any & {
|
|
62
|
+
_id: number;
|
|
63
|
+
name: string;
|
|
64
|
+
cost: number;
|
|
65
|
+
subscription?: number;
|
|
66
|
+
socked: boolean;
|
|
67
|
+
};
|
|
68
|
+
/** Purchase options */
|
|
69
|
+
export type Transaction = Meta & {
|
|
33
70
|
/** Purchased items */
|
|
34
|
-
|
|
35
|
-
|
|
71
|
+
cart: {
|
|
72
|
+
/** Product ID number, 'balance' for credit or null if custom */
|
|
73
|
+
_id?: number | 'balance';
|
|
74
|
+
/** Product name or description */
|
|
36
75
|
name: string;
|
|
76
|
+
/** Number of units to purchase */
|
|
37
77
|
quantity: number;
|
|
38
|
-
|
|
78
|
+
/** Individual unit cost */
|
|
79
|
+
cost: number;
|
|
39
80
|
}[];
|
|
81
|
+
/** Apply credit (Infinity to use all credit) */
|
|
82
|
+
credit: number;
|
|
83
|
+
/** Apply discount */
|
|
84
|
+
discount?: Partial<Omit<Discount, keyof Meta | 'description' | 'expire' | 'limit'>>;
|
|
85
|
+
/** Completion method, null to send invoice (creditcard, cash, transfer, etc) */
|
|
86
|
+
method?: string | null;
|
|
87
|
+
/** Transaction notes */
|
|
88
|
+
notes?: string | null;
|
|
89
|
+
/** Recipient username or information */
|
|
90
|
+
recipient?: {
|
|
91
|
+
/** Billing address */
|
|
92
|
+
address?: string;
|
|
93
|
+
/** Delivery email */
|
|
94
|
+
email?: string;
|
|
95
|
+
/** Receipt name */
|
|
96
|
+
name?: string;
|
|
97
|
+
/** Account name */
|
|
98
|
+
username?: string;
|
|
99
|
+
};
|
|
40
100
|
/** Transaction total */
|
|
101
|
+
subtotal: number;
|
|
102
|
+
/** Tax percentage as float */
|
|
103
|
+
tax: number;
|
|
104
|
+
/** Transaction total (subtotal - discount - credit + tax) */
|
|
41
105
|
total: number;
|
|
42
|
-
/** Completion method (card, cash, etc) */
|
|
43
|
-
method?: string;
|
|
44
106
|
/** Stripe transaction */
|
|
45
107
|
tx?: any;
|
|
46
108
|
};
|
|
47
|
-
export type Purchase = {
|
|
48
|
-
target: 'balance' | string | number;
|
|
49
|
-
amount?: number;
|
|
50
|
-
};
|
|
51
109
|
export declare class Payments extends PathEventEmitter {
|
|
52
110
|
readonly opts: PaymentOptions;
|
|
53
111
|
private readonly api;
|
|
54
|
-
|
|
112
|
+
/** Stripe object */
|
|
55
113
|
stripe?: any;
|
|
114
|
+
/** Public stripe token */
|
|
56
115
|
token?: string;
|
|
57
116
|
constructor(api: Api | string, opts?: PaymentOptions);
|
|
58
|
-
|
|
117
|
+
/**
|
|
118
|
+
* Initialize stripe API
|
|
119
|
+
* @return {Promise<any>} Returns stripe API
|
|
120
|
+
* @private
|
|
121
|
+
*/
|
|
59
122
|
private init;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
123
|
+
/**
|
|
124
|
+
* Create a stripe client secret to complete transaction
|
|
125
|
+
* @param {string} id Transaction ID
|
|
126
|
+
* @return {Promise<string>} Client secret
|
|
127
|
+
* @private
|
|
128
|
+
*/
|
|
129
|
+
private createSecret;
|
|
130
|
+
/**
|
|
131
|
+
* Create/Update a transaction
|
|
132
|
+
* @param {Optional<Transaction, "subtotal" | "total">} transaction Transaction information
|
|
133
|
+
* @return {Promise<string>} Completed translation information
|
|
134
|
+
*/
|
|
135
|
+
checkout(transaction: Partial<Transaction> & {
|
|
136
|
+
recipient: string;
|
|
137
|
+
}): Promise<Transaction>;
|
|
138
|
+
/**
|
|
139
|
+
* Get translation history
|
|
140
|
+
* @param {string} username Limit history to user
|
|
141
|
+
* @return {Promise<Transaction[]>} List of translations
|
|
142
|
+
*/
|
|
143
|
+
history(username?: string): Promise<Transaction[]>;
|
|
144
|
+
/**
|
|
145
|
+
* Send recipient transaction receipt or invoice
|
|
146
|
+
* @param {string} id Translation ID
|
|
147
|
+
* @return {Promise<void>} Returns once complete
|
|
148
|
+
*/
|
|
149
|
+
notify(id: string): Promise<void>;
|
|
150
|
+
/**
|
|
151
|
+
* Retrieve a list of available products
|
|
152
|
+
* @param {string | number} id Limit to specific product
|
|
153
|
+
* @return {Promise<any>} List of products or single product if ID is used
|
|
154
|
+
*/
|
|
155
|
+
products<T = any>(id?: string): Promise<T[]>;
|
|
156
|
+
/**
|
|
157
|
+
* Process payment programmatically
|
|
158
|
+
* @param {string} id Transaction ID
|
|
159
|
+
* @param {Card} card Credit card information
|
|
160
|
+
* @return {Promise<any>} Stripe confirmation
|
|
161
|
+
*/
|
|
162
|
+
payment(id: string, card: Card): Promise<any>;
|
|
163
|
+
/**
|
|
164
|
+
* Process payment using Stripe form
|
|
165
|
+
* @param {string} id Transaction ID
|
|
166
|
+
* @param {string} element DOM element to inject form into
|
|
167
|
+
* @return {Promise<() => Promise<any>>} Callback to submit form
|
|
168
|
+
*/
|
|
169
|
+
paymentForm(id: string, element: string): Promise<() => Promise<any>>;
|
|
64
170
|
/**
|
|
65
171
|
* Complete payment via Momentum's payment page
|
|
66
|
-
* @param {string}
|
|
172
|
+
* @param {string} id Transaction ID
|
|
67
173
|
* @param {string} host Host origin attempting to login
|
|
68
|
-
* @return {Promise<string>}
|
|
174
|
+
* @return {Promise<string>} Translation ID on success
|
|
69
175
|
*/
|
|
70
|
-
paymentRedirect(
|
|
176
|
+
paymentRedirect(id: string, host?: string): Promise<string>;
|
|
71
177
|
}
|
|
72
178
|
//# sourceMappingURL=payments.d.ts.map
|
package/dist/payments.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["../src/payments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAM,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["../src/payments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAM,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,IAAI,EAAW,MAAM,QAAQ,CAAC;AAEtC,0CAA0C;AAC1C,MAAM,MAAM,IAAI,GAAG;IAClB,wBAAwB;IACxB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,wBAAwB;IACxB,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,yBAAyB;IACzB,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1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,CAAC,GAAG,CAAO;gBAEf,GAAG,EAAE,GAAG,GAAG,MAAM;IAK7B,OAAO,CAAC,SAAS;IAYjB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,UAAe;IAK/C,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,UAAe;IAKrE,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,UAAe;CAI7C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ztimson/momentum",
|
|
3
|
-
"version": "0.52.
|
|
3
|
+
"version": "0.52.4",
|
|
4
4
|
"description": "Client library for momentum",
|
|
5
5
|
"keywords": ["Momentum"],
|
|
6
6
|
"author": "Zak Timson <zaktimson@gmail.com>",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"postbuild": "node -e \"const fs=require('fs');fs.cpSync('dist/index.mjs','../server/public/momentum.mjs');fs.cpSync('dist/index.cjs','../server/public/momentum.js');fs.cpSync('dist/momentum.worker.js','../server/public/momentum.worker.js')\""
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@ztimson/utils": "0.23.
|
|
27
|
+
"@ztimson/utils": "0.23.12",
|
|
28
28
|
"var-persist": "^1.0.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|