@memberstack/dom 1.9.0 → 1.9.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.
Files changed (51) hide show
  1. package/lib/auth/index.d.ts +7 -0
  2. package/lib/auth/{persistence/methods.js → index.js} +15 -25
  3. package/lib/constants/endpoints.d.ts +3 -0
  4. package/lib/constants/{endpoint.js → endpoints.js} +1 -2
  5. package/lib/index.d.ts +41 -48
  6. package/lib/methods/dom/index.d.ts +0 -2
  7. package/lib/methods/dom/index.js +0 -12
  8. package/lib/methods/dom/main-dom.d.ts +12 -0
  9. package/lib/methods/dom/main-dom.js +4538 -0
  10. package/lib/methods/dom/methods.d.ts +2 -14
  11. package/lib/methods/dom/methods.js +26 -120
  12. package/lib/methods/index.d.ts +42 -61
  13. package/lib/methods/index.js +20 -72
  14. package/lib/methods/requests/index.d.ts +55 -0
  15. package/lib/methods/{client → requests}/index.js +237 -71
  16. package/lib/methods/{client/request.d.ts → requests/requests.d.ts} +11 -4
  17. package/lib/methods/{client/request.js → requests/requests.js} +30 -22
  18. package/lib/types/index.js +5 -1
  19. package/lib/types/params.d.ts +23 -0
  20. package/lib/types/payloads.d.ts +5 -0
  21. package/lib/types/utils/payloads.d.ts +19 -0
  22. package/lib/utils/cookies.d.ts +1 -1
  23. package/lib/utils/cookies.js +3 -3
  24. package/package.json +10 -4
  25. package/lib/auth/persistence/index.d.ts +0 -1
  26. package/lib/auth/persistence/index.js +0 -13
  27. package/lib/auth/persistence/local.d.ts +0 -5
  28. package/lib/auth/persistence/local.js +0 -20
  29. package/lib/auth/persistence/methods.d.ts +0 -13
  30. package/lib/auth/persistence/session.d.ts +0 -5
  31. package/lib/auth/persistence/session.js +0 -20
  32. package/lib/constants/cookies.d.ts +0 -3
  33. package/lib/constants/cookies.js +0 -7
  34. package/lib/constants/endpoint.d.ts +0 -4
  35. package/lib/constants/request.d.ts +0 -10
  36. package/lib/constants/request.js +0 -15
  37. package/lib/constants/storage.d.ts +0 -1
  38. package/lib/constants/storage.js +0 -4
  39. package/lib/constants/window.d.ts +0 -4
  40. package/lib/constants/window.js +0 -7
  41. package/lib/methods/client/index.d.ts +0 -85
  42. package/lib/methods/client.d.ts +0 -43
  43. package/lib/methods/client.js +0 -35
  44. package/lib/methods/dom/script.d.ts +0 -3
  45. package/lib/methods/dom/script.js +0 -50
  46. package/lib/utils/interceptor.d.ts +0 -4
  47. package/lib/utils/interceptor.js +0 -18
  48. package/lib/utils/logger.d.ts +0 -3
  49. package/lib/utils/logger.js +0 -51
  50. package/lib/utils/proxy.d.ts +0 -2
  51. package/lib/utils/proxy.js +0 -105
@@ -1,2 +0,0 @@
1
- declare const _default: (target: any, props: any) => any;
2
- export default _default;
@@ -1,105 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (_) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- var __read = (this && this.__read) || function (o, n) {
39
- var m = typeof Symbol === "function" && o[Symbol.iterator];
40
- if (!m) return o;
41
- var i = m.call(o), r, ar = [], e;
42
- try {
43
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
44
- }
45
- catch (error) { e = { error: error }; }
46
- finally {
47
- try {
48
- if (r && !r.done && (m = i["return"])) m.call(i);
49
- }
50
- finally { if (e) throw e.error; }
51
- }
52
- return ar;
53
- };
54
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
55
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
56
- if (ar || !(i in from)) {
57
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
58
- ar[i] = from[i];
59
- }
60
- }
61
- return to.concat(ar || Array.prototype.slice.call(from));
62
- };
63
- Object.defineProperty(exports, "__esModule", { value: true });
64
- var persistence_1 = require("../auth/persistence");
65
- var handleResponse = function (fn, props) {
66
- return function () {
67
- var args = [];
68
- for (var _i = 0; _i < arguments.length; _i++) {
69
- args[_i] = arguments[_i];
70
- }
71
- var result = fn.apply(void 0, __spreadArray([], __read(args), false));
72
- if (result === null || result === void 0 ? void 0 : result.then) {
73
- return result.then(function (res) {
74
- var _a, _b, _c, _d, _e;
75
- if ((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.member) {
76
- (0, persistence_1.setPersistedMember)((_b = res.data) === null || _b === void 0 ? void 0 : _b.member, props.persistence);
77
- }
78
- if ((_d = (_c = res === null || res === void 0 ? void 0 : res.data) === null || _c === void 0 ? void 0 : _c.id) === null || _d === void 0 ? void 0 : _d.startsWith("mem_")) {
79
- // added to prevent setting persisted member value with payload from logout response
80
- if (!((_e = res === null || res === void 0 ? void 0 : res.data) === null || _e === void 0 ? void 0 : _e.member)) {
81
- return res;
82
- }
83
- (0, persistence_1.setPersistedMember)(res.data, props.persistence);
84
- }
85
- return res;
86
- });
87
- }
88
- return result;
89
- };
90
- };
91
- var handler = function (props) { return ({
92
- get: function (target, prop, receiver) {
93
- var _this = this;
94
- if (prop === "getCurrentMember") {
95
- var persistedMember_1 = (0, persistence_1.getPersistedMember)(props.persistence);
96
- if (persistedMember_1) {
97
- return function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
98
- return [2 /*return*/, ({ data: persistedMember_1 })];
99
- }); }); };
100
- }
101
- }
102
- return handleResponse(Reflect.get(target, prop, receiver), props);
103
- },
104
- }); };
105
- exports.default = (function (target, props) { return new Proxy(target, handler(props)); });