@memberstack/dom 1.3.2 → 1.7.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/lib/constants/request.d.ts +10 -0
- package/lib/constants/request.js +15 -0
- package/lib/index.d.ts +7 -1
- package/lib/methods/client/index.d.ts +85 -0
- package/lib/methods/client/index.js +449 -0
- package/lib/methods/client/request.d.ts +17 -0
- package/lib/methods/client/request.js +105 -0
- package/lib/methods/client.d.ts +5 -0
- package/lib/methods/dom/methods.d.ts +1 -1
- package/lib/methods/dom/methods.js +27 -13
- package/lib/methods/index.d.ts +7 -1
- package/lib/methods/index.js +6 -0
- package/lib/types/index.d.ts +2 -0
- package/lib/types/index.js +14 -0
- package/lib/types/params.d.ts +120 -0
- package/lib/types/params.js +2 -0
- package/lib/types/payloads.d.ts +40 -0
- package/lib/types/payloads.js +2 -0
- package/lib/types/utils/payloads.d.ts +203 -0
- package/lib/types/utils/payloads.js +3 -0
- package/lib/utils/proxy.js +5 -1
- package/package.json +9 -5
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
declare type Domain = {
|
|
2
|
+
url: string;
|
|
3
|
+
verified: boolean;
|
|
4
|
+
};
|
|
5
|
+
export declare namespace Payload {
|
|
6
|
+
interface PaginatedResponse<T> {
|
|
7
|
+
hasNext: boolean;
|
|
8
|
+
endCursor: string | null;
|
|
9
|
+
totalCount: number;
|
|
10
|
+
data: T[];
|
|
11
|
+
}
|
|
12
|
+
interface Transforms {
|
|
13
|
+
Pagination: {
|
|
14
|
+
hasNext: boolean;
|
|
15
|
+
endCursor: string | null;
|
|
16
|
+
totalCount: number;
|
|
17
|
+
};
|
|
18
|
+
App: {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
domains?: Domain[];
|
|
22
|
+
plans: Transforms["Plan"][];
|
|
23
|
+
customFields: Transforms["CustomField"][];
|
|
24
|
+
};
|
|
25
|
+
RestrictedUrlGroup: {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
key: string;
|
|
29
|
+
redirect: string;
|
|
30
|
+
urls: {
|
|
31
|
+
url: string;
|
|
32
|
+
filter: string;
|
|
33
|
+
}[];
|
|
34
|
+
plans: {
|
|
35
|
+
id: string;
|
|
36
|
+
}[];
|
|
37
|
+
};
|
|
38
|
+
MemberAuth: {
|
|
39
|
+
tokens: {
|
|
40
|
+
accessToken: string;
|
|
41
|
+
expires: number;
|
|
42
|
+
type: "bearer";
|
|
43
|
+
};
|
|
44
|
+
member: Transforms["Member"];
|
|
45
|
+
payment: {
|
|
46
|
+
requirePayment: string[];
|
|
47
|
+
requireAuthentication: string[];
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
Member: {
|
|
51
|
+
id: string;
|
|
52
|
+
auth: {
|
|
53
|
+
email: string;
|
|
54
|
+
};
|
|
55
|
+
createdAt: string;
|
|
56
|
+
metaData: object;
|
|
57
|
+
customFields: object;
|
|
58
|
+
permissions: string[] | [];
|
|
59
|
+
planConnections: Transforms["MemberPlanConnection"][];
|
|
60
|
+
};
|
|
61
|
+
MemberReceipt: {
|
|
62
|
+
id: string;
|
|
63
|
+
amount: number;
|
|
64
|
+
url: string;
|
|
65
|
+
stripe?: {
|
|
66
|
+
url: string;
|
|
67
|
+
};
|
|
68
|
+
number: string;
|
|
69
|
+
purchase: string;
|
|
70
|
+
invoice: string;
|
|
71
|
+
createdAt: string;
|
|
72
|
+
currency: string;
|
|
73
|
+
};
|
|
74
|
+
MemberInvoices: PaginatedResponse<{
|
|
75
|
+
id: string;
|
|
76
|
+
status: string;
|
|
77
|
+
amount: number;
|
|
78
|
+
url: string;
|
|
79
|
+
description: string;
|
|
80
|
+
number: string;
|
|
81
|
+
purchase: string;
|
|
82
|
+
}>;
|
|
83
|
+
MemberReceipts: PaginatedResponse<{
|
|
84
|
+
id: string;
|
|
85
|
+
amount: string;
|
|
86
|
+
url: string;
|
|
87
|
+
number: string;
|
|
88
|
+
planConnection: string;
|
|
89
|
+
invoice: Transforms["MemberInvoice"];
|
|
90
|
+
}>;
|
|
91
|
+
MemberCard: {
|
|
92
|
+
id: string;
|
|
93
|
+
brand: string;
|
|
94
|
+
expMonth: string;
|
|
95
|
+
expYear: string;
|
|
96
|
+
last4: string;
|
|
97
|
+
default: boolean;
|
|
98
|
+
};
|
|
99
|
+
MemberInvoice: {
|
|
100
|
+
id: string;
|
|
101
|
+
status: string;
|
|
102
|
+
amount: number;
|
|
103
|
+
url: string;
|
|
104
|
+
description: string;
|
|
105
|
+
number: string;
|
|
106
|
+
planConnection: string;
|
|
107
|
+
createdAt: string;
|
|
108
|
+
currency: string;
|
|
109
|
+
};
|
|
110
|
+
Plan: {
|
|
111
|
+
id: string;
|
|
112
|
+
name: string;
|
|
113
|
+
description: string;
|
|
114
|
+
status: string;
|
|
115
|
+
redirects: {
|
|
116
|
+
afterLogin: string;
|
|
117
|
+
afterLogout: string;
|
|
118
|
+
afterSignup: string;
|
|
119
|
+
};
|
|
120
|
+
prices?: Transforms["Price"][] | [];
|
|
121
|
+
};
|
|
122
|
+
Price: {
|
|
123
|
+
id: string;
|
|
124
|
+
amount: string;
|
|
125
|
+
interval: {
|
|
126
|
+
type: string;
|
|
127
|
+
count: number;
|
|
128
|
+
};
|
|
129
|
+
name: string;
|
|
130
|
+
type: string;
|
|
131
|
+
status: string;
|
|
132
|
+
currency: string;
|
|
133
|
+
};
|
|
134
|
+
Permission: {
|
|
135
|
+
id: string;
|
|
136
|
+
name: string;
|
|
137
|
+
description: string;
|
|
138
|
+
};
|
|
139
|
+
PermissionGroup: {
|
|
140
|
+
id: string;
|
|
141
|
+
name: string;
|
|
142
|
+
permissions: Transforms["Permission"][];
|
|
143
|
+
};
|
|
144
|
+
CustomField: {
|
|
145
|
+
id: string;
|
|
146
|
+
key: string;
|
|
147
|
+
label: string;
|
|
148
|
+
plans: Transforms["Plan"][];
|
|
149
|
+
};
|
|
150
|
+
MemberPlanConnection: {
|
|
151
|
+
id: string;
|
|
152
|
+
active: boolean;
|
|
153
|
+
status: string;
|
|
154
|
+
planId: string;
|
|
155
|
+
type: string;
|
|
156
|
+
payment: {
|
|
157
|
+
amount: number;
|
|
158
|
+
currency: string;
|
|
159
|
+
status: string;
|
|
160
|
+
lastBillingDate: number | null;
|
|
161
|
+
nextBillingDate: number | null;
|
|
162
|
+
cancelAtDate: number | null;
|
|
163
|
+
lastInvoice: string | null;
|
|
164
|
+
lastReceipt: string | null;
|
|
165
|
+
card: string;
|
|
166
|
+
} | null;
|
|
167
|
+
};
|
|
168
|
+
Purchase: {
|
|
169
|
+
plan: string;
|
|
170
|
+
payment: {
|
|
171
|
+
requiresPayment: boolean;
|
|
172
|
+
requiresAuthentication: boolean;
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
AuthenticationClientSecret: string;
|
|
176
|
+
AuthProvider: {
|
|
177
|
+
clientId: string;
|
|
178
|
+
redirectUri: string;
|
|
179
|
+
authorizationEndpoint: string;
|
|
180
|
+
provider: string;
|
|
181
|
+
};
|
|
182
|
+
TotalCheckoutAmount: {
|
|
183
|
+
total: number;
|
|
184
|
+
subTotal: number;
|
|
185
|
+
currency: string;
|
|
186
|
+
setupFee?: {
|
|
187
|
+
enabled: boolean;
|
|
188
|
+
amount: number;
|
|
189
|
+
name: string;
|
|
190
|
+
};
|
|
191
|
+
freeTrial?: {
|
|
192
|
+
days: number;
|
|
193
|
+
enabled: boolean;
|
|
194
|
+
};
|
|
195
|
+
tax?: {
|
|
196
|
+
name: string;
|
|
197
|
+
percent: number;
|
|
198
|
+
description: string;
|
|
199
|
+
}[];
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
export {};
|
package/lib/utils/proxy.js
CHANGED
|
@@ -71,11 +71,15 @@ var handleResponse = function (fn, props) {
|
|
|
71
71
|
var result = fn.apply(void 0, __spreadArray([], __read(args), false));
|
|
72
72
|
if (result === null || result === void 0 ? void 0 : result.then) {
|
|
73
73
|
return result.then(function (res) {
|
|
74
|
-
var _a, _b, _c, _d;
|
|
74
|
+
var _a, _b, _c, _d, _e;
|
|
75
75
|
if ((_a = res === null || res === void 0 ? void 0 : res.data) === null || _a === void 0 ? void 0 : _a.member) {
|
|
76
76
|
(0, persistence_1.setPersistedMember)((_b = res.data) === null || _b === void 0 ? void 0 : _b.member, props.persistence);
|
|
77
77
|
}
|
|
78
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
|
+
}
|
|
79
83
|
(0, persistence_1.setPersistedMember)(res.data, props.persistence);
|
|
80
84
|
}
|
|
81
85
|
return res;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberstack/dom",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib/**/*"
|
|
@@ -8,13 +8,17 @@
|
|
|
8
8
|
"author": "Lydia Hallie",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@memberstack/client": "^1.
|
|
11
|
+
"@memberstack/client": "^1.7.0",
|
|
12
12
|
"js-cookie": "^3.0.1"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
15
|
"prepublishOnly": "npx tsc",
|
|
16
|
-
"watch": "tsc-watch
|
|
16
|
+
"watch": "tsc-watch",
|
|
17
|
+
"watch:dev": "tsc-watch --onSuccess 'yarn replace:vars:local'",
|
|
17
18
|
"clean": "rm -rf node_modules",
|
|
18
|
-
"replace:vars:local": "ts-node utils/replaceDynamicVars -development"
|
|
19
|
+
"replace:vars:local": "ts-node utils/replaceDynamicVars -development",
|
|
20
|
+
"deploy:latest": "npx np --tag latest --no-tests --any-branch",
|
|
21
|
+
"deploy:next": "npx np --tag next --no-tests --any-branch",
|
|
22
|
+
"build:local": "npx tsc"
|
|
19
23
|
}
|
|
20
|
-
}
|
|
24
|
+
}
|