@ztimson/momentum 0.52.1 → 0.52.3
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/index.cjs +40 -21
- package/dist/index.mjs +40 -21
- package/dist/payments.d.ts +12 -2
- package/dist/payments.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":[],"mappings":"AAAA,OAAO,EAAe,gBAAgB,EAAM,MAAM,gBAAgB,CAAC;AACnE,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAA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C;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/index.cjs
CHANGED
|
@@ -842,7 +842,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
842
842
|
const parsedFind = makeArray(filter).map((pe) => new PathEvent(pe));
|
|
843
843
|
return parsedTarget.filter((t) => {
|
|
844
844
|
if (!t.fullPath && t.all) return true;
|
|
845
|
-
return !!parsedFind.find((f) => f.fullPath.startsWith(t.fullPath) && (f.all || t.all || t.methods.intersection(f.methods).length));
|
|
845
|
+
return !!parsedFind.find((f) => (t.fullPath.startsWith(f.fullPath) || f.fullPath.startsWith(t.fullPath)) && (f.all || t.all || t.methods.intersection(f.methods).length));
|
|
846
846
|
});
|
|
847
847
|
}
|
|
848
848
|
/**
|
|
@@ -1445,6 +1445,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1445
1445
|
this.settings = settings;
|
|
1446
1446
|
this.pushSubscription.then((resp) => this.notifications = !!resp);
|
|
1447
1447
|
}
|
|
1448
|
+
/** Check if iframed */
|
|
1449
|
+
get iframe() {
|
|
1450
|
+
return (parent == null ? void 0 : parent.location) != location;
|
|
1451
|
+
}
|
|
1448
1452
|
/** Check if mobile device */
|
|
1449
1453
|
get mobile() {
|
|
1450
1454
|
return ["android", "ios"].includes(this.platform);
|
|
@@ -1487,11 +1491,16 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1487
1491
|
}
|
|
1488
1492
|
/**
|
|
1489
1493
|
* Inject the client theme settings, meta tags & PWA prompt
|
|
1490
|
-
* @param
|
|
1494
|
+
* @param opts Injection options: reload - use cached settings or reload; pwa - disabled auto pwa prompt
|
|
1491
1495
|
* @return {Promise<void>} Resolves on completion
|
|
1492
1496
|
*/
|
|
1493
|
-
async
|
|
1497
|
+
async init(opts = {}) {
|
|
1494
1498
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1499
|
+
opts = {
|
|
1500
|
+
reload: void 0,
|
|
1501
|
+
pwa: true,
|
|
1502
|
+
...opts
|
|
1503
|
+
};
|
|
1495
1504
|
const meta = (key, name, value) => {
|
|
1496
1505
|
const exists = document.querySelector(`meta[${key}="${name}"]`);
|
|
1497
1506
|
if (value === void 0 || exists) return exists;
|
|
@@ -1500,18 +1509,13 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1500
1509
|
meta2.content = value;
|
|
1501
1510
|
document.head.append(meta2);
|
|
1502
1511
|
};
|
|
1503
|
-
|
|
1512
|
+
if (!this.settings.cache.keys().length) opts.reload = true;
|
|
1513
|
+
let settings = await (opts.reload ? this.settings.all(false, true) : this.settings.cache);
|
|
1514
|
+
if (opts.reload == null) this.settings.all(false, true).then(() => this.init({ reload: false }));
|
|
1504
1515
|
if (settings["title"]) document.querySelectorAll(".momentum-title").forEach((el) => el.innerText = settings["title"]);
|
|
1505
1516
|
if (settings["description"]) document.querySelectorAll(".momentum-description").forEach((el) => el.innerText = settings["description"]);
|
|
1506
1517
|
if (settings["version"]) document.querySelectorAll(".momentum-version").forEach((el) => el.innerText = settings["version"]);
|
|
1507
1518
|
if (settings["logo"]) document.querySelectorAll(".momentum-logo").forEach((el) => el.src = settings["logo"]);
|
|
1508
|
-
meta("name", "theme-color", (_a = settings["theme"]) == null ? void 0 : _a.background);
|
|
1509
|
-
document.body.classList.add(((_b = settings["theme"]) == null ? void 0 : _b.darkMode) ? "theme-dark" : "theme-light");
|
|
1510
|
-
document.body.classList.remove(((_c = settings["theme"]) == null ? void 0 : _c.darkMode) ? "theme-light" : "theme-dark");
|
|
1511
|
-
document.body.style.setProperty("--theme-backdrop", (_d = settings["theme"]) == null ? void 0 : _d.background);
|
|
1512
|
-
document.body.style.setProperty("--theme-primary", (_e = settings["theme"]) == null ? void 0 : _e.primary);
|
|
1513
|
-
document.body.style.setProperty("--theme-accent", (_f = settings["theme"]) == null ? void 0 : _f.accent);
|
|
1514
|
-
document.body.style.setProperty("--theme-contrast", blackOrWhite((_g = settings["theme"]) == null ? void 0 : _g.background));
|
|
1515
1519
|
meta("name", "description", settings["description"]);
|
|
1516
1520
|
meta("itemprop", "name", settings["title"]);
|
|
1517
1521
|
meta("itemprop", "description", settings["description"]);
|
|
@@ -1525,23 +1529,37 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1525
1529
|
meta("name", "twitter:title", settings["title"]);
|
|
1526
1530
|
meta("name", "twitter:description", settings["description"]);
|
|
1527
1531
|
meta("name", "twitter:image", `${settings["public_url"]}/favicon.png`);
|
|
1528
|
-
meta("name", "mobile-web-app-capable", "yes");
|
|
1529
|
-
meta("name", "apple-mobile-web-app-status-bar-style", "default");
|
|
1530
|
-
meta("name", "apple-mobile-web-app-title", settings["title"]);
|
|
1531
|
-
meta("name", "apple-touch-icon", `${settings["public_url"]}/favicon.png`);
|
|
1532
|
-
meta("name", "apple-touch-startup-image", `${settings["public_url"]}/favicon.png`);
|
|
1533
1532
|
if (settings["pwa"]) {
|
|
1533
|
+
meta("name", "mobile-web-app-capable", "yes");
|
|
1534
|
+
meta("name", "apple-mobile-web-app-status-bar-style", "default");
|
|
1535
|
+
meta("name", "apple-mobile-web-app-title", settings["title"]);
|
|
1536
|
+
meta("name", "apple-touch-icon", `${settings["public_url"]}/favicon.png`);
|
|
1537
|
+
meta("name", "apple-touch-startup-image", `${settings["public_url"]}/favicon.png`);
|
|
1534
1538
|
if (!document.querySelector('link[rel="manifest"]')) {
|
|
1535
1539
|
const link = document.createElement("link");
|
|
1536
1540
|
link.setAttribute("rel", "manifest");
|
|
1537
1541
|
link.setAttribute("href", this.settings.api.url + "/manifest.json");
|
|
1538
1542
|
document.head.append(link);
|
|
1539
1543
|
}
|
|
1540
|
-
setTimeout(() => {
|
|
1544
|
+
if (opts.pwa && !this.iframe && !this.pwa && this.mobile) setTimeout(() => {
|
|
1541
1545
|
const dismissed = !!localStorage.getItem("momentum:install-prompt");
|
|
1542
|
-
if (!dismissed
|
|
1546
|
+
if (!dismissed) this.pwaPrompt();
|
|
1543
1547
|
}, 6e4);
|
|
1544
1548
|
}
|
|
1549
|
+
meta("name", "theme-color", (_a = settings["theme"]) == null ? void 0 : _a.background);
|
|
1550
|
+
document.body.classList.add(((_b = settings["theme"]) == null ? void 0 : _b.darkMode) ? "theme-dark" : "theme-light");
|
|
1551
|
+
document.body.classList.remove(((_c = settings["theme"]) == null ? void 0 : _c.darkMode) ? "theme-light" : "theme-dark");
|
|
1552
|
+
const style = document.querySelector("style.momentum-theme") || document.createElement("style");
|
|
1553
|
+
style.classList.add("momentum-theme");
|
|
1554
|
+
style.innerHTML = `
|
|
1555
|
+
:root {
|
|
1556
|
+
--theme-backdrop: ${(_d = settings["theme"]) == null ? void 0 : _d.background} !important;
|
|
1557
|
+
--theme-primary: ${(_e = settings["theme"]) == null ? void 0 : _e.primary} !important;
|
|
1558
|
+
--theme-accent: ${(_f = settings["theme"]) == null ? void 0 : _f.accent} !important;
|
|
1559
|
+
--theme-contrast: ${blackOrWhite((_g = settings["theme"]) == null ? void 0 : _g.background)} !important;
|
|
1560
|
+
}
|
|
1561
|
+
`;
|
|
1562
|
+
if (!style.parentElement) document.head.append(style);
|
|
1545
1563
|
this.emit(PES`client/inject:c`, this.platform);
|
|
1546
1564
|
}
|
|
1547
1565
|
/**
|
|
@@ -2009,12 +2027,13 @@ ${log}`;
|
|
|
2009
2027
|
...this.opts
|
|
2010
2028
|
};
|
|
2011
2029
|
}
|
|
2012
|
-
async checkout(cart,
|
|
2030
|
+
async checkout(cart, opts = {}) {
|
|
2013
2031
|
if (!(cart == null ? void 0 : cart.length)) throw new Error("Please add items to cart`");
|
|
2014
2032
|
const request = await this.api.request({ url: "/api/payments", body: {
|
|
2015
2033
|
cart,
|
|
2016
|
-
|
|
2017
|
-
|
|
2034
|
+
recipient: opts == null ? void 0 : opts.recipient,
|
|
2035
|
+
invoice: opts == null ? void 0 : opts.invoice,
|
|
2036
|
+
extra: opts == null ? void 0 : opts.extra
|
|
2018
2037
|
} });
|
|
2019
2038
|
this.emit(PES`payments:c`, request.token);
|
|
2020
2039
|
return request.token;
|
package/dist/index.mjs
CHANGED
|
@@ -838,7 +838,7 @@ class PathEvent {
|
|
|
838
838
|
const parsedFind = makeArray(filter).map((pe) => new PathEvent(pe));
|
|
839
839
|
return parsedTarget.filter((t) => {
|
|
840
840
|
if (!t.fullPath && t.all) return true;
|
|
841
|
-
return !!parsedFind.find((f) => f.fullPath.startsWith(t.fullPath) && (f.all || t.all || t.methods.intersection(f.methods).length));
|
|
841
|
+
return !!parsedFind.find((f) => (t.fullPath.startsWith(f.fullPath) || f.fullPath.startsWith(t.fullPath)) && (f.all || t.all || t.methods.intersection(f.methods).length));
|
|
842
842
|
});
|
|
843
843
|
}
|
|
844
844
|
/**
|
|
@@ -1441,6 +1441,10 @@ class Client extends PathEventEmitter {
|
|
|
1441
1441
|
this.settings = settings;
|
|
1442
1442
|
this.pushSubscription.then((resp) => this.notifications = !!resp);
|
|
1443
1443
|
}
|
|
1444
|
+
/** Check if iframed */
|
|
1445
|
+
get iframe() {
|
|
1446
|
+
return (parent == null ? void 0 : parent.location) != location;
|
|
1447
|
+
}
|
|
1444
1448
|
/** Check if mobile device */
|
|
1445
1449
|
get mobile() {
|
|
1446
1450
|
return ["android", "ios"].includes(this.platform);
|
|
@@ -1483,11 +1487,16 @@ class Client extends PathEventEmitter {
|
|
|
1483
1487
|
}
|
|
1484
1488
|
/**
|
|
1485
1489
|
* Inject the client theme settings, meta tags & PWA prompt
|
|
1486
|
-
* @param
|
|
1490
|
+
* @param opts Injection options: reload - use cached settings or reload; pwa - disabled auto pwa prompt
|
|
1487
1491
|
* @return {Promise<void>} Resolves on completion
|
|
1488
1492
|
*/
|
|
1489
|
-
async
|
|
1493
|
+
async init(opts = {}) {
|
|
1490
1494
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1495
|
+
opts = {
|
|
1496
|
+
reload: void 0,
|
|
1497
|
+
pwa: true,
|
|
1498
|
+
...opts
|
|
1499
|
+
};
|
|
1491
1500
|
const meta = (key, name, value) => {
|
|
1492
1501
|
const exists = document.querySelector(`meta[${key}="${name}"]`);
|
|
1493
1502
|
if (value === void 0 || exists) return exists;
|
|
@@ -1496,18 +1505,13 @@ class Client extends PathEventEmitter {
|
|
|
1496
1505
|
meta2.content = value;
|
|
1497
1506
|
document.head.append(meta2);
|
|
1498
1507
|
};
|
|
1499
|
-
|
|
1508
|
+
if (!this.settings.cache.keys().length) opts.reload = true;
|
|
1509
|
+
let settings = await (opts.reload ? this.settings.all(false, true) : this.settings.cache);
|
|
1510
|
+
if (opts.reload == null) this.settings.all(false, true).then(() => this.init({ reload: false }));
|
|
1500
1511
|
if (settings["title"]) document.querySelectorAll(".momentum-title").forEach((el) => el.innerText = settings["title"]);
|
|
1501
1512
|
if (settings["description"]) document.querySelectorAll(".momentum-description").forEach((el) => el.innerText = settings["description"]);
|
|
1502
1513
|
if (settings["version"]) document.querySelectorAll(".momentum-version").forEach((el) => el.innerText = settings["version"]);
|
|
1503
1514
|
if (settings["logo"]) document.querySelectorAll(".momentum-logo").forEach((el) => el.src = settings["logo"]);
|
|
1504
|
-
meta("name", "theme-color", (_a = settings["theme"]) == null ? void 0 : _a.background);
|
|
1505
|
-
document.body.classList.add(((_b = settings["theme"]) == null ? void 0 : _b.darkMode) ? "theme-dark" : "theme-light");
|
|
1506
|
-
document.body.classList.remove(((_c = settings["theme"]) == null ? void 0 : _c.darkMode) ? "theme-light" : "theme-dark");
|
|
1507
|
-
document.body.style.setProperty("--theme-backdrop", (_d = settings["theme"]) == null ? void 0 : _d.background);
|
|
1508
|
-
document.body.style.setProperty("--theme-primary", (_e = settings["theme"]) == null ? void 0 : _e.primary);
|
|
1509
|
-
document.body.style.setProperty("--theme-accent", (_f = settings["theme"]) == null ? void 0 : _f.accent);
|
|
1510
|
-
document.body.style.setProperty("--theme-contrast", blackOrWhite((_g = settings["theme"]) == null ? void 0 : _g.background));
|
|
1511
1515
|
meta("name", "description", settings["description"]);
|
|
1512
1516
|
meta("itemprop", "name", settings["title"]);
|
|
1513
1517
|
meta("itemprop", "description", settings["description"]);
|
|
@@ -1521,23 +1525,37 @@ class Client extends PathEventEmitter {
|
|
|
1521
1525
|
meta("name", "twitter:title", settings["title"]);
|
|
1522
1526
|
meta("name", "twitter:description", settings["description"]);
|
|
1523
1527
|
meta("name", "twitter:image", `${settings["public_url"]}/favicon.png`);
|
|
1524
|
-
meta("name", "mobile-web-app-capable", "yes");
|
|
1525
|
-
meta("name", "apple-mobile-web-app-status-bar-style", "default");
|
|
1526
|
-
meta("name", "apple-mobile-web-app-title", settings["title"]);
|
|
1527
|
-
meta("name", "apple-touch-icon", `${settings["public_url"]}/favicon.png`);
|
|
1528
|
-
meta("name", "apple-touch-startup-image", `${settings["public_url"]}/favicon.png`);
|
|
1529
1528
|
if (settings["pwa"]) {
|
|
1529
|
+
meta("name", "mobile-web-app-capable", "yes");
|
|
1530
|
+
meta("name", "apple-mobile-web-app-status-bar-style", "default");
|
|
1531
|
+
meta("name", "apple-mobile-web-app-title", settings["title"]);
|
|
1532
|
+
meta("name", "apple-touch-icon", `${settings["public_url"]}/favicon.png`);
|
|
1533
|
+
meta("name", "apple-touch-startup-image", `${settings["public_url"]}/favicon.png`);
|
|
1530
1534
|
if (!document.querySelector('link[rel="manifest"]')) {
|
|
1531
1535
|
const link = document.createElement("link");
|
|
1532
1536
|
link.setAttribute("rel", "manifest");
|
|
1533
1537
|
link.setAttribute("href", this.settings.api.url + "/manifest.json");
|
|
1534
1538
|
document.head.append(link);
|
|
1535
1539
|
}
|
|
1536
|
-
setTimeout(() => {
|
|
1540
|
+
if (opts.pwa && !this.iframe && !this.pwa && this.mobile) setTimeout(() => {
|
|
1537
1541
|
const dismissed = !!localStorage.getItem("momentum:install-prompt");
|
|
1538
|
-
if (!dismissed
|
|
1542
|
+
if (!dismissed) this.pwaPrompt();
|
|
1539
1543
|
}, 6e4);
|
|
1540
1544
|
}
|
|
1545
|
+
meta("name", "theme-color", (_a = settings["theme"]) == null ? void 0 : _a.background);
|
|
1546
|
+
document.body.classList.add(((_b = settings["theme"]) == null ? void 0 : _b.darkMode) ? "theme-dark" : "theme-light");
|
|
1547
|
+
document.body.classList.remove(((_c = settings["theme"]) == null ? void 0 : _c.darkMode) ? "theme-light" : "theme-dark");
|
|
1548
|
+
const style = document.querySelector("style.momentum-theme") || document.createElement("style");
|
|
1549
|
+
style.classList.add("momentum-theme");
|
|
1550
|
+
style.innerHTML = `
|
|
1551
|
+
:root {
|
|
1552
|
+
--theme-backdrop: ${(_d = settings["theme"]) == null ? void 0 : _d.background} !important;
|
|
1553
|
+
--theme-primary: ${(_e = settings["theme"]) == null ? void 0 : _e.primary} !important;
|
|
1554
|
+
--theme-accent: ${(_f = settings["theme"]) == null ? void 0 : _f.accent} !important;
|
|
1555
|
+
--theme-contrast: ${blackOrWhite((_g = settings["theme"]) == null ? void 0 : _g.background)} !important;
|
|
1556
|
+
}
|
|
1557
|
+
`;
|
|
1558
|
+
if (!style.parentElement) document.head.append(style);
|
|
1541
1559
|
this.emit(PES`client/inject:c`, this.platform);
|
|
1542
1560
|
}
|
|
1543
1561
|
/**
|
|
@@ -2005,12 +2023,13 @@ class Payments extends PathEventEmitter {
|
|
|
2005
2023
|
...this.opts
|
|
2006
2024
|
};
|
|
2007
2025
|
}
|
|
2008
|
-
async checkout(cart,
|
|
2026
|
+
async checkout(cart, opts = {}) {
|
|
2009
2027
|
if (!(cart == null ? void 0 : cart.length)) throw new Error("Please add items to cart`");
|
|
2010
2028
|
const request = await this.api.request({ url: "/api/payments", body: {
|
|
2011
2029
|
cart,
|
|
2012
|
-
|
|
2013
|
-
|
|
2030
|
+
recipient: opts == null ? void 0 : opts.recipient,
|
|
2031
|
+
invoice: opts == null ? void 0 : opts.invoice,
|
|
2032
|
+
extra: opts == null ? void 0 : opts.extra
|
|
2014
2033
|
} });
|
|
2015
2034
|
this.emit(PES`payments:c`, request.token);
|
|
2016
2035
|
return request.token;
|
package/dist/payments.d.ts
CHANGED
|
@@ -13,13 +13,23 @@ export type Card = {
|
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
|
+
export type PaymentAccount = {
|
|
17
|
+
_id?: string;
|
|
18
|
+
username: string;
|
|
19
|
+
balance: number;
|
|
20
|
+
subscriptions: {
|
|
21
|
+
_id: string;
|
|
22
|
+
created: Date;
|
|
23
|
+
interval: number;
|
|
24
|
+
}[];
|
|
25
|
+
};
|
|
16
26
|
export type PaymentOptions = {
|
|
17
27
|
/** Path to payment page */
|
|
18
28
|
paymentUrl?: string;
|
|
19
29
|
};
|
|
20
30
|
export type PaymentTransaction = Meta & {
|
|
21
|
-
/**
|
|
22
|
-
|
|
31
|
+
/** Deliver to user/email */
|
|
32
|
+
recipient: string;
|
|
23
33
|
/** Purchased items */
|
|
24
34
|
receipt: {
|
|
25
35
|
_id: number | string;
|
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,EAAC,MAAM,QAAQ,CAAC;AAE5B,MAAM,MAAM,IAAI,GAAG;IAClB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC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AAC,KAAK,EAAE,MAAM,EAAE,IAAI,GAAE,MAAwB,GAAG,OAAO,CAAC,MAAM,CAAC;CAqB/E"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ztimson/momentum",
|
|
3
|
-
"version": "0.52.
|
|
3
|
+
"version": "0.52.3",
|
|
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.11",
|
|
28
28
|
"var-persist": "^1.0.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|