nodebb-plugin-equipment-calendar 0.8.1 → 0.8.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/library.js +8 -16
- package/package.json +1 -1
- package/plugin.json +1 -2
package/library.js
CHANGED
|
@@ -161,11 +161,7 @@ async function createHelloAssoCheckoutIntent(settings, bookingId, reservations)
|
|
|
161
161
|
},
|
|
162
162
|
};
|
|
163
163
|
|
|
164
|
-
const token =
|
|
165
|
-
const clear = String(req.query.clear || '') === '1';
|
|
166
|
-
// force=1 skips in-memory cache and refresh_token; clear=1 wipes stored refresh token
|
|
167
|
-
haTokenCache = null;
|
|
168
|
-
await getHelloAssoAccessToken(settings, { force, clearStored: clear });
|
|
164
|
+
const token = await getHelloAssoAccessToken(settings);
|
|
169
165
|
const url = `https://api.helloasso.com/v5/organizations/${encodeURIComponent(org)}/checkout-intents`;
|
|
170
166
|
const resp = await fetchFn(url, {
|
|
171
167
|
method: 'POST',
|
|
@@ -186,11 +182,7 @@ async function createHelloAssoCheckoutIntent(settings, bookingId, reservations)
|
|
|
186
182
|
|
|
187
183
|
async function fetchHelloAssoCheckoutIntent(settings, checkoutIntentId) {
|
|
188
184
|
const org = String(settings.ha_organizationSlug || '').trim();
|
|
189
|
-
const token =
|
|
190
|
-
const clear = String(req.query.clear || '') === '1';
|
|
191
|
-
// force=1 skips in-memory cache and refresh_token; clear=1 wipes stored refresh token
|
|
192
|
-
haTokenCache = null;
|
|
193
|
-
await getHelloAssoAccessToken(settings, { force, clearStored: clear });
|
|
185
|
+
const token = await getHelloAssoAccessToken(settings);
|
|
194
186
|
const url = `https://api.helloasso.com/v5/organizations/${encodeURIComponent(org)}/checkout-intents/${encodeURIComponent(checkoutIntentId)}`;
|
|
195
187
|
const resp = await fetchFn(url, { headers: { authorization: `Bearer ${token}`, accept: 'application/json' } });
|
|
196
188
|
if (!resp.ok) {
|
|
@@ -230,11 +222,7 @@ async function fetchHelloAssoItems(settings) {
|
|
|
230
222
|
} catch (e) {}
|
|
231
223
|
}
|
|
232
224
|
|
|
233
|
-
const token =
|
|
234
|
-
const clear = String(req.query.clear || '') === '1';
|
|
235
|
-
// force=1 skips in-memory cache and refresh_token; clear=1 wipes stored refresh token
|
|
236
|
-
haTokenCache = null;
|
|
237
|
-
await getHelloAssoAccessToken(settings, { force, clearStored: clear });
|
|
225
|
+
const token = await getHelloAssoAccessToken(settings);
|
|
238
226
|
const url = `https://api.helloasso.com/v5/organizations/${encodeURIComponent(org)}/forms/${encodeURIComponent(formType)}/${encodeURIComponent(formSlug)}/items`;
|
|
239
227
|
const resp = await fetchFn(url, { headers: { authorization: `Bearer ${token}` } });
|
|
240
228
|
if (!resp.ok) {
|
|
@@ -806,6 +794,8 @@ async function handleHelloAssoTest(req, res) {
|
|
|
806
794
|
if (!isAdmin) return helpers.notAllowed(req, res);
|
|
807
795
|
|
|
808
796
|
const settings = await getSettings();
|
|
797
|
+
let sampleItems = [];
|
|
798
|
+
let hasSampleItems = false;
|
|
809
799
|
let ok = false;
|
|
810
800
|
let message = '';
|
|
811
801
|
let count = 0;
|
|
@@ -819,11 +809,12 @@ async function handleHelloAssoTest(req, res) {
|
|
|
819
809
|
const items = await fetchHelloAssoItems(settings);
|
|
820
810
|
const list = Array.isArray(items) ? items : (Array.isArray(items.data) ? items.data : []);
|
|
821
811
|
count = list.length;
|
|
822
|
-
|
|
812
|
+
sampleItems = list.slice(0, 10).map(it => ({
|
|
823
813
|
id: String(it.id || it.itemId || it.reference || it.slug || it.name || '').trim(),
|
|
824
814
|
name: String(it.name || it.label || it.title || '').trim(),
|
|
825
815
|
rawName: String(it.name || it.label || it.title || it.id || '').trim(),
|
|
826
816
|
}));
|
|
817
|
+
hasSampleItems = sampleItems && sampleItems.length > 0;
|
|
827
818
|
ok = true;
|
|
828
819
|
message = `OK: token valide. Items récupérés: ${count}.`;
|
|
829
820
|
} catch (e) {
|
|
@@ -838,6 +829,7 @@ async function handleHelloAssoTest(req, res) {
|
|
|
838
829
|
count,
|
|
839
830
|
settings,
|
|
840
831
|
sampleItems,
|
|
832
|
+
hasSampleItems,
|
|
841
833
|
hasSampleItems: sampleItems && sampleItems.length > 0,
|
|
842
834
|
});
|
|
843
835
|
}
|
package/package.json
CHANGED
package/plugin.json
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
"name": "Equipment Calendar",
|
|
4
4
|
"description": "Calendar-based equipment reservations with group approvals and HelloAsso payments.",
|
|
5
5
|
"url": "https://example.invalid",
|
|
6
|
-
"library": "./library.js",
|
|
7
6
|
"hooks": [
|
|
8
7
|
{
|
|
9
8
|
"hook": "static:app.load",
|
|
@@ -26,6 +25,6 @@
|
|
|
26
25
|
"scripts": [
|
|
27
26
|
"public/js/client.js"
|
|
28
27
|
],
|
|
29
|
-
"version": "0.4.
|
|
28
|
+
"version": "0.4.9",
|
|
30
29
|
"minver": "4.7.1"
|
|
31
30
|
}
|