@carlonicora/nextjs-jsonapi 2.2.1 → 2.2.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/{BlockNoteEditor-2LGNETXD.mjs → BlockNoteEditor-ADT6II2V.mjs} +5 -5
- package/dist/{BlockNoteEditor-EAEGUVFI.js → BlockNoteEditor-QTIDATPF.js} +20 -20
- package/dist/{BlockNoteEditor-EAEGUVFI.js.map → BlockNoteEditor-QTIDATPF.js.map} +1 -1
- package/dist/{JsonApiRequest-F5LBESSA.mjs → JsonApiRequest-3UWVIIFL.mjs} +2 -2
- package/dist/JsonApiRequest-QRU3IPIU.js +26 -0
- package/dist/{JsonApiRequest-YAPUG4ND.js.map → JsonApiRequest-QRU3IPIU.js.map} +1 -1
- package/dist/billing/index.js +467 -467
- package/dist/billing/index.js.map +1 -1
- package/dist/billing/index.mjs +82 -82
- package/dist/billing/index.mjs.map +1 -1
- package/dist/{chunk-B34NBMKV.mjs → chunk-7DJOQTNN.mjs} +3 -3
- package/dist/{chunk-R57FRJ6H.mjs → chunk-DLTMYGLR.mjs} +5 -5
- package/dist/{chunk-Z2CB63VG.mjs → chunk-E5YA5Z5X.mjs} +2 -2
- package/dist/chunk-E5YA5Z5X.mjs.map +1 -0
- package/dist/{chunk-4I2W336O.js → chunk-F3BPNQDB.js} +737 -737
- package/dist/{chunk-4I2W336O.js.map → chunk-F3BPNQDB.js.map} +1 -1
- package/dist/{chunk-QWCAOLBD.js → chunk-FPO4DLZN.js} +12 -12
- package/dist/{chunk-QWCAOLBD.js.map → chunk-FPO4DLZN.js.map} +1 -1
- package/dist/{chunk-DQJ5C5TV.js → chunk-KSU6CCW6.js} +30 -30
- package/dist/{chunk-DQJ5C5TV.js.map → chunk-KSU6CCW6.js.map} +1 -1
- package/dist/{chunk-BLKR2Q7F.js → chunk-LANOKEFZ.js} +9 -9
- package/dist/{chunk-BLKR2Q7F.js.map → chunk-LANOKEFZ.js.map} +1 -1
- package/dist/{chunk-OC7F4L7K.mjs → chunk-YEPE2HT6.mjs} +6 -6
- package/dist/client/index.js +5 -5
- package/dist/client/index.mjs +4 -4
- package/dist/components/index.js +5 -5
- package/dist/components/index.mjs +4 -4
- package/dist/contexts/index.js +5 -5
- package/dist/contexts/index.mjs +4 -4
- package/dist/core/index.js +3 -3
- package/dist/core/index.mjs +2 -2
- package/dist/features/help/index.js +38 -38
- package/dist/features/help/index.mjs +4 -4
- package/dist/features/tokenusage/index.js +72 -72
- package/dist/features/tokenusage/index.mjs +4 -4
- package/dist/index.js +4 -4
- package/dist/index.mjs +3 -3
- package/dist/server/index.js +12 -12
- package/dist/server/index.mjs +2 -2
- package/package.json +1 -1
- package/src/core/utils/__tests__/translateResponse.test.ts +64 -0
- package/src/core/utils/translateResponse.ts +4 -1
- package/src/features/billing/components/containers/BillingDashboardContainer.tsx +71 -68
- package/src/features/billing/stripe-price/components/forms/PriceEditor.tsx +3 -3
- package/src/features/billing/stripe-promotion-code/components/PromoCodeInput.tsx +2 -2
- package/src/features/billing/stripe-subscription/components/details/SubscriptionDetails.tsx +1 -1
- package/src/features/billing/stripe-subscription/components/forms/CancelSubscriptionDialog.tsx +1 -1
- package/src/features/billing/stripe-subscription/components/widgets/ProrationPreview.tsx +8 -8
- package/src/features/billing/stripe-subscription/components/wizards/WizardStepReview.tsx +5 -5
- package/dist/JsonApiRequest-YAPUG4ND.js +0 -26
- package/dist/chunk-Z2CB63VG.mjs.map +0 -1
- /package/dist/{BlockNoteEditor-2LGNETXD.mjs.map → BlockNoteEditor-ADT6II2V.mjs.map} +0 -0
- /package/dist/{JsonApiRequest-F5LBESSA.mjs.map → JsonApiRequest-3UWVIIFL.mjs.map} +0 -0
- /package/dist/{chunk-B34NBMKV.mjs.map → chunk-7DJOQTNN.mjs.map} +0 -0
- /package/dist/{chunk-R57FRJ6H.mjs.map → chunk-DLTMYGLR.mjs.map} +0 -0
- /package/dist/{chunk-OC7F4L7K.mjs.map → chunk-YEPE2HT6.mjs.map} +0 -0
|
@@ -169,13 +169,13 @@ async function translateResponse(params) {
|
|
|
169
169
|
response.ok = params.apiResponse.ok;
|
|
170
170
|
response.response = params.apiResponse.status;
|
|
171
171
|
if (!params.apiResponse.ok) {
|
|
172
|
-
response.error = _nullishCoalesce(_optionalChain([params, 'access', _ => _.apiResponse, 'optionalAccess', _2 => _2.data, 'optionalAccess', _3 => _3.message]), () => ( params.apiResponse.statusText));
|
|
172
|
+
response.error = _nullishCoalesce(_nullishCoalesce(_optionalChain([params, 'access', _ => _.apiResponse, 'optionalAccess', _2 => _2.data, 'optionalAccess', _3 => _3.message]), () => ( _optionalChain([params, 'access', _4 => _4.apiResponse, 'optionalAccess', _5 => _5.data, 'optionalAccess', _6 => _6.error]))), () => ( params.apiResponse.statusText));
|
|
173
173
|
response.raw = params.apiResponse.data;
|
|
174
174
|
return response;
|
|
175
175
|
}
|
|
176
176
|
if (params.apiResponse.status === 204) return response;
|
|
177
177
|
response.raw = params.apiResponse.data;
|
|
178
|
-
if (_optionalChain([params, 'access',
|
|
178
|
+
if (_optionalChain([params, 'access', _7 => _7.apiResponse, 'access', _8 => _8.data, 'optionalAccess', _9 => _9.meta])) {
|
|
179
179
|
response.meta = params.apiResponse.data.meta;
|
|
180
180
|
}
|
|
181
181
|
try {
|
|
@@ -284,7 +284,7 @@ async function makeRequest(params) {
|
|
|
284
284
|
}
|
|
285
285
|
_chunk7QVYU63Ejs.__name.call(void 0, makeRequest, "makeRequest");
|
|
286
286
|
function getApiUrl() {
|
|
287
|
-
if (_optionalChain([_staticConfig, 'optionalAccess',
|
|
287
|
+
if (_optionalChain([_staticConfig, 'optionalAccess', _10 => _10.apiUrl])) {
|
|
288
288
|
return _staticConfig.apiUrl;
|
|
289
289
|
}
|
|
290
290
|
const envUrl = process.env.NEXT_PUBLIC_API_URL;
|
|
@@ -295,7 +295,7 @@ function getApiUrl() {
|
|
|
295
295
|
}
|
|
296
296
|
_chunk7QVYU63Ejs.__name.call(void 0, getApiUrl, "getApiUrl");
|
|
297
297
|
function getAppUrl() {
|
|
298
|
-
if (_optionalChain([_staticConfig, 'optionalAccess',
|
|
298
|
+
if (_optionalChain([_staticConfig, 'optionalAccess', _11 => _11.appUrl])) {
|
|
299
299
|
return _staticConfig.appUrl;
|
|
300
300
|
}
|
|
301
301
|
const envUrl = process.env.NEXT_PUBLIC_ADDRESS;
|
|
@@ -308,11 +308,11 @@ function getAppUrl() {
|
|
|
308
308
|
}
|
|
309
309
|
_chunk7QVYU63Ejs.__name.call(void 0, getAppUrl, "getAppUrl");
|
|
310
310
|
function getTrackablePages() {
|
|
311
|
-
return _nullishCoalesce(_optionalChain([_staticConfig, 'optionalAccess',
|
|
311
|
+
return _nullishCoalesce(_optionalChain([_staticConfig, 'optionalAccess', _12 => _12.trackablePages]), () => ( []));
|
|
312
312
|
}
|
|
313
313
|
_chunk7QVYU63Ejs.__name.call(void 0, getTrackablePages, "getTrackablePages");
|
|
314
314
|
function runBootstrapper() {
|
|
315
|
-
if (_optionalChain([_staticConfig, 'optionalAccess',
|
|
315
|
+
if (_optionalChain([_staticConfig, 'optionalAccess', _13 => _13.bootstrapper])) {
|
|
316
316
|
_staticConfig.bootstrapper();
|
|
317
317
|
}
|
|
318
318
|
}
|
|
@@ -333,7 +333,7 @@ async function JsonApiGet(params) {
|
|
|
333
333
|
cache: params.classKey.cache,
|
|
334
334
|
companyId: params.companyId,
|
|
335
335
|
language: params.language,
|
|
336
|
-
additionalHeaders: _optionalChain([_staticConfig, 'optionalAccess',
|
|
336
|
+
additionalHeaders: _optionalChain([_staticConfig, 'optionalAccess', _14 => _14.additionalHeaders])
|
|
337
337
|
});
|
|
338
338
|
return translateResponse({
|
|
339
339
|
classKey: params.classKey,
|
|
@@ -368,7 +368,7 @@ async function JsonApiPost(params) {
|
|
|
368
368
|
files: params.files,
|
|
369
369
|
companyId: params.companyId,
|
|
370
370
|
language: params.language,
|
|
371
|
-
additionalHeaders: _optionalChain([_staticConfig, 'optionalAccess',
|
|
371
|
+
additionalHeaders: _optionalChain([_staticConfig, 'optionalAccess', _15 => _15.additionalHeaders])
|
|
372
372
|
});
|
|
373
373
|
return translateResponse({
|
|
374
374
|
classKey: _nullishCoalesce(params.responseType, () => ( params.classKey)),
|
|
@@ -395,7 +395,7 @@ async function JsonApiPut(params) {
|
|
|
395
395
|
files: params.files,
|
|
396
396
|
companyId: params.companyId,
|
|
397
397
|
language: params.language,
|
|
398
|
-
additionalHeaders: _optionalChain([_staticConfig, 'optionalAccess',
|
|
398
|
+
additionalHeaders: _optionalChain([_staticConfig, 'optionalAccess', _16 => _16.additionalHeaders])
|
|
399
399
|
});
|
|
400
400
|
return translateResponse({
|
|
401
401
|
classKey: _nullishCoalesce(params.responseType, () => ( params.classKey)),
|
|
@@ -422,7 +422,7 @@ async function JsonApiPatch(params) {
|
|
|
422
422
|
files: params.files,
|
|
423
423
|
companyId: params.companyId,
|
|
424
424
|
language: params.language,
|
|
425
|
-
additionalHeaders: _optionalChain([_staticConfig, 'optionalAccess',
|
|
425
|
+
additionalHeaders: _optionalChain([_staticConfig, 'optionalAccess', _17 => _17.additionalHeaders])
|
|
426
426
|
});
|
|
427
427
|
return translateResponse({
|
|
428
428
|
classKey: _nullishCoalesce(params.responseType, () => ( params.classKey)),
|
|
@@ -441,7 +441,7 @@ async function JsonApiDelete(params) {
|
|
|
441
441
|
token,
|
|
442
442
|
companyId: params.companyId,
|
|
443
443
|
language: params.language,
|
|
444
|
-
additionalHeaders: _optionalChain([_staticConfig, 'optionalAccess',
|
|
444
|
+
additionalHeaders: _optionalChain([_staticConfig, 'optionalAccess', _18 => _18.additionalHeaders])
|
|
445
445
|
});
|
|
446
446
|
return translateResponse({
|
|
447
447
|
classKey: _nullishCoalesce(params.responseType, () => ( params.classKey)),
|
|
@@ -473,4 +473,4 @@ _chunk7QVYU63Ejs.__name.call(void 0, JsonApiDelete, "JsonApiDelete");
|
|
|
473
473
|
|
|
474
474
|
|
|
475
475
|
exports.DataClassRegistry = DataClassRegistry; exports.JsonApiDataFactory = JsonApiDataFactory; exports.setBootstrapper = setBootstrapper; exports.getBootstrapper = getBootstrapper; exports.tryBootstrap = tryBootstrap; exports.hasBootstrapper = hasBootstrapper; exports.resetBootstrapStore = resetBootstrapStore; exports.translateData = translateData; exports.translateResponse = translateResponse; exports.configureJsonApi = configureJsonApi; exports.getApiUrl = getApiUrl; exports.getAppUrl = getAppUrl; exports.getTrackablePages = getTrackablePages; exports.buildUrl = buildUrl; exports.JsonApiGet = JsonApiGet; exports.JsonApiPost = JsonApiPost; exports.JsonApiPut = JsonApiPut; exports.JsonApiPatch = JsonApiPatch; exports.JsonApiDelete = JsonApiDelete;
|
|
476
|
-
//# sourceMappingURL=chunk-
|
|
476
|
+
//# sourceMappingURL=chunk-FPO4DLZN.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/chunk-QWCAOLBD.js","../src/core/registry/DataClassRegistry.ts","../src/core/factories/JsonApiDataFactory.ts","../src/core/registry/bootstrapStore.ts","../src/core/utils/translateResponse.ts","../src/unified/JsonApiRequest.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACA;ACDO,IAAM,kBAAA,YAAN,MAAwB;AAAA,EAH/B,OAG+B;AAAA,IAAA,qCAAA,IAAA,EAAA,mBAAA,CAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAK7B,4BAAe,KAAA,kBAAO,IAAI,GAAA,CAA0C,EAAA;AAAA,EAEpE,OAAc,mBAAA,CACZ,GAAA,EACA,gBAAA,EACM;AACN,IAAA,MAAM,SAAA,EAAW,GAAA,CAAI,IAAA;AACrB,IAAA,GAAA,CAAI,CAAC,IAAA,CAAK,IAAA,CAAK,GAAA,CAAI,QAAQ,CAAA,EAAG;AAC5B,MAAA,IAAA,CAAK,IAAA,CAAK,GAAA,CAAI,QAAA,EAAU,gBAAgB,CAAA;AAAA,IAC1C;AA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BD.js","sourcesContent":[null,"import { ApiDataInterface } from \"../interfaces/ApiDataInterface\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\n\nexport class DataClassRegistry {\n // Use Map with string key (module.name) for reliable lookup\n // String keys are stable across HMR and module re-evaluations\n // Note: WeakMap with object identity was tried but fails during Next.js navigation\n // because module re-evaluation creates new object instances with different identity\n private static _map = new Map<string, { new (): ApiDataInterface }>();\n\n public static registerObjectClass(\n key: ApiRequestDataTypeInterface,\n classConstructor: { new (): ApiDataInterface },\n ): void {\n const classKey = key.name;\n if (!this._map.has(classKey)) {\n this._map.set(classKey, classConstructor);\n }\n }\n\n public static get(classKey: ApiRequestDataTypeInterface): {\n new (): ApiDataInterface;\n } {\n const response = this._map.get(classKey.name);\n if (!response) {\n throw new Error(\n `Class not registered for key: ${typeof classKey === \"string\" ? classKey : classKey.name}. Ensure bootstrap() was called.`,\n );\n }\n\n return response;\n }\n\n /**\n * Get class constructor by JSON:API type name.\n * Used for polymorphic rehydration where the type is determined at runtime.\n */\n public static getByJsonApiType(typeName: string): { new (): ApiDataInterface } | undefined {\n return this._map.get(typeName);\n }\n\n /**\n * Bootstrap the registry with all modules.\n * This is a convenience method for apps to register all their modules at once.\n *\n * @param modules - An object with module definitions (like the app's Modules class)\n */\n public static bootstrap(modules: Record<string, ApiRequestDataTypeInterface>): void {\n Object.values(modules).forEach((module) => {\n if (module && module.model) {\n this.registerObjectClass(module, module.model);\n }\n });\n }\n\n /**\n * Clear all registered classes. Useful for testing.\n */\n public static clear(): void {\n this._map.clear();\n }\n}\n\n// Export alias for backward compatibility\nexport { DataClassRegistry as DataClass };\n","import { ApiDataInterface } from \"../interfaces/ApiDataInterface\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\nimport { DataClassRegistry } from \"../registry/DataClassRegistry\";\n\nexport class JsonApiDataFactory {\n public static create(classKey: ApiRequestDataTypeInterface, data: any): any {\n const factoryClass = DataClassRegistry.get(classKey);\n\n const instance = new factoryClass() as ApiDataInterface;\n const result = instance.createJsonApi(data);\n return result;\n }\n}\n","/**\n * Centralized bootstrap store accessible from ModuleRegistry.\n * This file has NO external dependencies to avoid circular imports.\n *\n * The bootstrap store allows ModuleRegistry to call the app's bootstrapper\n * when modules are accessed before bootstrap() was called, providing\n * self-healing behavior for module evaluation order issues.\n *\n * IMPORTANT: We use globalThis to persist state across HMR/Turbopack\n * module re-evaluations in development mode. Without this, the bootstrapper\n * reference would be lost when modules are hot-reloaded, causing\n * \"Module not registered\" errors during navigation.\n */\n\ntype BootstrapperFn = () => void;\n\n// Symbol key to avoid conflicts with other globals\nconst BOOTSTRAP_KEY = Symbol.for(\"nextjs-jsonapi:bootstrapper\");\nconst BOOTSTRAP_ATTEMPTED_KEY = Symbol.for(\"nextjs-jsonapi:bootstrapAttempted\");\n\n// Use globalThis to persist across HMR reloads\nconst globalStore = globalThis as unknown as {\n [BOOTSTRAP_KEY]?: BootstrapperFn | null;\n [BOOTSTRAP_ATTEMPTED_KEY]?: boolean;\n};\n\n// Initialize from global if not set\nif (globalStore[BOOTSTRAP_KEY] === undefined) {\n globalStore[BOOTSTRAP_KEY] = null;\n}\nif (globalStore[BOOTSTRAP_ATTEMPTED_KEY] === undefined) {\n globalStore[BOOTSTRAP_ATTEMPTED_KEY] = false;\n}\n\n// Getters/setters that use the global store\nfunction getBootstrapperInternal(): BootstrapperFn | null {\n return globalStore[BOOTSTRAP_KEY] ?? null;\n}\n\nfunction setBootstrapperInternal(fn: BootstrapperFn | null): void {\n globalStore[BOOTSTRAP_KEY] = fn;\n}\n\nfunction getBootstrapAttempted(): boolean {\n return globalStore[BOOTSTRAP_ATTEMPTED_KEY] ?? false;\n}\n\nfunction setBootstrapAttempted(value: boolean): void {\n globalStore[BOOTSTRAP_ATTEMPTED_KEY] = value;\n}\n\n/**\n * Register the bootstrapper function.\n * Called by configureJsonApi() from client/config, client/JsonApiClient, or unified/JsonApiRequest.\n */\nexport function setBootstrapper(fn: BootstrapperFn): void {\n setBootstrapperInternal(fn);\n}\n\n/**\n * Get the registered bootstrapper function.\n * Returns null if no bootstrapper has been registered.\n */\nexport function getBootstrapper(): BootstrapperFn | null {\n return getBootstrapperInternal();\n}\n\n/**\n * Attempt to run the bootstrapper if one is registered.\n * Returns true if bootstrapper was executed, false if not available.\n * Safe to call multiple times - bootstrapper is expected to be idempotent.\n */\nexport function tryBootstrap(): boolean {\n const bootstrapper = getBootstrapperInternal();\n const attempted = getBootstrapAttempted();\n\n if (attempted && !bootstrapper) {\n // Already tried and no bootstrapper available\n return false;\n }\n setBootstrapAttempted(true);\n\n if (bootstrapper) {\n bootstrapper();\n return true;\n }\n return false;\n}\n\n/**\n * Check if a bootstrapper has been registered.\n */\nexport function hasBootstrapper(): boolean {\n return getBootstrapperInternal() !== null;\n}\n\n/**\n * Reset the bootstrap store. Useful for testing.\n */\nexport function resetBootstrapStore(): void {\n setBootstrapperInternal(null);\n setBootstrapAttempted(false);\n}\n","import { ApiData } from \"../interfaces/ApiData\";\nimport { ApiDataInterface } from \"../interfaces/ApiDataInterface\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\nimport { ApiResponseInterface } from \"../interfaces/ApiResponseInterface\";\nimport { DataClassRegistry } from \"../registry/DataClassRegistry\";\n\n/**\n * Translates raw JSON:API data into typed objects.\n * Does not require API response metadata.\n */\nexport function translateData<T extends ApiDataInterface>(params: {\n classKey: ApiRequestDataTypeInterface;\n data: any;\n}): T | T[] {\n const factoryClass = DataClassRegistry.get(params.classKey);\n\n if (!factoryClass) {\n throw new Error(\n `Class not registered for key: ${typeof params.classKey === \"string\" ? params.classKey : params.classKey.name}`,\n );\n }\n\n const included: any = params.data.included ?? [];\n\n if (Array.isArray(params.data.data)) {\n const responseData: T[] = [];\n\n for (const data of params.data.data) {\n const object = new factoryClass();\n object.rehydrate({ jsonApi: data, included: included, allData: params.data.data });\n responseData.push(object as T);\n }\n\n return responseData as T[];\n } else {\n const responseData = new factoryClass();\n responseData.rehydrate({\n jsonApi: params.data.data,\n included: included,\n });\n\n return responseData as T;\n }\n}\n\n/**\n * Translates a full API response into a typed ApiResponseInterface.\n * Includes pagination support.\n */\nexport async function translateResponse<T extends ApiDataInterface>(params: {\n classKey: ApiRequestDataTypeInterface;\n apiResponse: ApiData;\n companyId?: string;\n language: string;\n paginationHandler?: (endpoint: string) => Promise<ApiResponseInterface>;\n}): Promise<ApiResponseInterface> {\n const response: ApiResponseInterface = {\n ok: true,\n response: 0,\n data: [],\n error: \"\",\n };\n\n const factoryClass = DataClassRegistry.get(params.classKey);\n\n if (!factoryClass) {\n throw new Error(\n `Class not registered for key: ${typeof params.classKey === \"string\" ? params.classKey : params.classKey.name}`,\n );\n }\n\n response.ok = params.apiResponse.ok;\n response.response = params.apiResponse.status;\n\n if (!params.apiResponse.ok) {\n response.error = params.apiResponse?.data?.message ?? params.apiResponse.statusText;\n response.raw = params.apiResponse.data;\n return response;\n }\n\n if (params.apiResponse.status === 204) return response;\n\n response.raw = params.apiResponse.data;\n\n // Extract meta from JSON:API response\n if (params.apiResponse.data?.meta) {\n response.meta = params.apiResponse.data.meta;\n }\n\n try {\n // Check if response is JSON:API formatted (has a 'data' property)\n // If not, return the raw response data directly (e.g., { url: \"...\" } or { clientSecret: \"...\" })\n if (\n params.apiResponse.data &&\n typeof params.apiResponse.data === \"object\" &&\n !Array.isArray(params.apiResponse.data) &&\n params.apiResponse.data.data === undefined\n ) {\n response.data = params.apiResponse.data;\n return response;\n }\n\n const included: any = params.apiResponse.data.included ?? [];\n\n if (params.apiResponse.data.links) {\n response.self = params.apiResponse.data.links.self;\n\n if (params.apiResponse.data.links.next && params.paginationHandler) {\n response.next = params.apiResponse.data.links.next;\n response.nextPage = async () => params.paginationHandler!(params.apiResponse.data.links.next);\n }\n\n if (params.apiResponse.data.links.prev && params.paginationHandler) {\n response.prev = params.apiResponse.data.links.prev;\n response.prevPage = async () => params.paginationHandler!(params.apiResponse.data.links.prev);\n }\n }\n\n if (Array.isArray(params.apiResponse.data.data)) {\n const responseData: T[] = [];\n\n for (const data of params.apiResponse.data.data) {\n const object = new factoryClass();\n object.rehydrate({ jsonApi: data, included: included, allData: params.apiResponse.data.data });\n responseData.push(object as T);\n }\n\n response.data = responseData;\n } else {\n const responseData = new factoryClass();\n responseData.rehydrate({\n jsonApi: params.apiResponse.data.data,\n included: included,\n });\n\n response.data = responseData;\n }\n } catch (e) {\n console.error(e);\n }\n\n return response;\n}\n","import { JsonApiDataFactory } from \"../core/factories/JsonApiDataFactory\";\nimport { ApiData } from \"../core/interfaces/ApiData\";\nimport { ApiRequestDataTypeInterface } from \"../core/interfaces/ApiRequestDataTypeInterface\";\nimport { ApiResponseInterface } from \"../core/interfaces/ApiResponseInterface\";\nimport { setBootstrapper } from \"../core/registry/bootstrapStore\";\nimport { translateResponse } from \"../core/utils/translateResponse\";\nimport { ModuleWithPermissions } from \"../permissions/types\";\n\n// Type definitions for dynamically imported functions (avoiding typeof import to prevent bundling)\ntype DirectFetchFn = (params: {\n method: string;\n url: string;\n token?: string;\n body?: any;\n files?: { [key: string]: File | Blob } | File | Blob;\n companyId?: string;\n language: string;\n additionalHeaders?: Record<string, string>;\n}) => Promise<ApiData>;\n\ntype ServerRequestFn = (params: {\n method: string;\n url: string;\n token?: string;\n cache?: string;\n body?: any;\n files?: { [key: string]: File | Blob } | File | Blob;\n companyId?: string;\n language: string;\n additionalHeaders?: Record<string, string>;\n}) => Promise<ApiData>;\n\ntype GetTokenFn = () => Promise<string | undefined>;\n\n// These will be dynamically imported based on environment\nlet _directFetch: DirectFetchFn;\nlet _serverRequest: ServerRequestFn;\nlet _getClientToken: GetTokenFn;\nlet _getServerToken: GetTokenFn;\n\n// Config storage for non-React contexts\nlet _staticConfig: {\n apiUrl: string;\n appUrl?: string;\n trackablePages?: ModuleWithPermissions[];\n bootstrapper?: () => void;\n additionalHeaders?: Record<string, string>;\n} | null = null;\n\n/**\n * Configure the JSON:API client for non-React contexts (e.g., server components).\n * For React contexts, use JsonApiProvider instead.\n */\nexport function configureJsonApi(config: {\n apiUrl: string;\n appUrl?: string;\n trackablePages?: ModuleWithPermissions[];\n bootstrapper?: () => void;\n additionalHeaders?: Record<string, string>;\n}): void {\n _staticConfig = config;\n // Register and call bootstrapper to register all modules\n if (config.bootstrapper) {\n setBootstrapper(config.bootstrapper);\n config.bootstrapper();\n }\n}\n\nasync function getToken(): Promise<string | undefined> {\n if (typeof window === \"undefined\") {\n // Server-side\n if (!_getServerToken) {\n const serverModule = await import(\"../server/token\");\n _getServerToken = serverModule.getServerToken;\n }\n return _getServerToken();\n } else {\n // Client-side\n if (!_getClientToken) {\n const clientModule = await import(\"../client/token\");\n _getClientToken = clientModule.getClientToken;\n }\n return _getClientToken();\n }\n}\n\nasync function makeRequest(params: {\n method: string;\n url: string;\n token?: string;\n cache?: string;\n body?: any;\n files?: { [key: string]: File | Blob } | File | Blob;\n companyId?: string;\n language: string;\n additionalHeaders?: Record<string, string>;\n}): Promise<ApiData> {\n if (typeof window !== \"undefined\") {\n // Client-side: use direct fetch\n if (!_directFetch) {\n const clientModule = await import(\"../client/request\");\n _directFetch = clientModule.directFetch;\n }\n return _directFetch({\n method: params.method,\n url: params.url,\n token: params.token,\n body: params.body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: params.additionalHeaders,\n });\n } else {\n // Server-side: use server request with caching\n if (!_serverRequest) {\n const serverModule = await import(\"../server/request\");\n _serverRequest = serverModule.serverRequest;\n }\n return _serverRequest({\n method: params.method,\n url: params.url,\n token: params.token,\n cache: params.cache,\n body: params.body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: params.additionalHeaders,\n });\n }\n}\n\nexport function getApiUrl(): string {\n if (_staticConfig?.apiUrl) {\n return _staticConfig.apiUrl;\n }\n // Fallback to environment variable\n const envUrl = process.env.NEXT_PUBLIC_API_URL;\n if (!envUrl) {\n throw new Error(\"API URL not configured. Use configureJsonApi() or set NEXT_PUBLIC_API_URL environment variable.\");\n }\n return envUrl;\n}\n\nexport function getAppUrl(): string {\n if (_staticConfig?.appUrl) {\n return _staticConfig.appUrl;\n }\n // Fallback to environment variable\n const envUrl = process.env.NEXT_PUBLIC_ADDRESS;\n if (!envUrl) {\n throw new Error(\n \"App URL not configured. Use configureJsonApi({ appUrl }) or set NEXT_PUBLIC_ADDRESS environment variable.\",\n );\n }\n return envUrl.trim().replace(/\\/+$/, \"\");\n}\n\nexport function getTrackablePages(): ModuleWithPermissions[] {\n return _staticConfig?.trackablePages ?? [];\n}\n\nfunction runBootstrapper(): void {\n if (_staticConfig?.bootstrapper) {\n _staticConfig.bootstrapper();\n }\n}\n\n/**\n * Resolve the final request URL for an endpoint.\n *\n * - `endpoint` starting with \"http\" is always passed through unchanged (existing behaviour).\n * - Otherwise, an explicit `baseUrl` (per-call override) takes precedence over the global\n * `getApiUrl()` resolution. Omitting `baseUrl` preserves today's behaviour exactly.\n */\nexport function buildUrl(endpoint: string, baseUrl?: string): string {\n if (endpoint.startsWith(\"http\")) return endpoint;\n const apiUrl = baseUrl ?? getApiUrl();\n return `${apiUrl}${endpoint}`;\n}\n\nexport async function JsonApiGet(params: {\n classKey: ApiRequestDataTypeInterface;\n endpoint: string;\n companyId?: string;\n language: string;\n token?: string;\n baseUrl?: string;\n}): Promise<ApiResponseInterface> {\n runBootstrapper();\n const token = params.token ?? (await getToken());\n\n const apiResponse = await makeRequest({\n method: \"GET\",\n url: buildUrl(params.endpoint, params.baseUrl),\n token,\n cache: params.classKey.cache,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _staticConfig?.additionalHeaders,\n });\n\n return translateResponse({\n classKey: params.classKey,\n apiResponse,\n companyId: params.companyId,\n language: params.language,\n paginationHandler: async (endpoint: string) =>\n JsonApiGet({\n classKey: params.classKey,\n endpoint,\n companyId: params.companyId,\n language: params.language,\n token: params.token,\n baseUrl: params.baseUrl,\n }),\n });\n}\n\nexport async function JsonApiPost(params: {\n classKey: ApiRequestDataTypeInterface;\n endpoint: string;\n companyId?: string;\n body?: any;\n overridesJsonApiCreation?: boolean;\n files?: { [key: string]: File | Blob } | File | Blob;\n language: string;\n responseType?: ApiRequestDataTypeInterface;\n token?: string;\n baseUrl?: string;\n}): Promise<ApiResponseInterface> {\n runBootstrapper();\n const token = params.token ?? (await getToken());\n\n let body = params.body;\n if (!body) {\n body = {};\n } else if (params.overridesJsonApiCreation !== true) {\n body = JsonApiDataFactory.create(params.classKey, body);\n }\n\n const apiResponse = await makeRequest({\n method: \"POST\",\n url: buildUrl(params.endpoint, params.baseUrl),\n token,\n body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _staticConfig?.additionalHeaders,\n });\n\n return translateResponse({\n classKey: params.responseType ?? params.classKey,\n apiResponse,\n companyId: params.companyId,\n language: params.language,\n });\n}\n\nexport async function JsonApiPut(params: {\n classKey: ApiRequestDataTypeInterface;\n endpoint: string;\n companyId?: string;\n body?: any;\n files?: { [key: string]: File | Blob } | File | Blob;\n language: string;\n responseType?: ApiRequestDataTypeInterface;\n token?: string;\n baseUrl?: string;\n}): Promise<ApiResponseInterface> {\n runBootstrapper();\n const token = params.token ?? (await getToken());\n\n let body = params.body;\n if (!body) {\n body = {};\n } else {\n body = JsonApiDataFactory.create(params.classKey, body);\n }\n\n const apiResponse = await makeRequest({\n method: \"PUT\",\n url: buildUrl(params.endpoint, params.baseUrl),\n token,\n body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _staticConfig?.additionalHeaders,\n });\n\n return translateResponse({\n classKey: params.responseType ?? params.classKey,\n apiResponse,\n companyId: params.companyId,\n language: params.language,\n });\n}\n\nexport async function JsonApiPatch(params: {\n classKey: ApiRequestDataTypeInterface;\n endpoint: string;\n companyId?: string;\n body?: any;\n files?: { [key: string]: File | Blob } | File | Blob;\n overridesJsonApiCreation?: boolean;\n responseType?: ApiRequestDataTypeInterface;\n language: string;\n token?: string;\n baseUrl?: string;\n}): Promise<ApiResponseInterface> {\n runBootstrapper();\n const token = params.token ?? (await getToken());\n\n let body = params.body;\n if (!body) {\n body = {};\n } else if (params.overridesJsonApiCreation !== true) {\n body = JsonApiDataFactory.create(params.classKey, body);\n }\n\n const apiResponse = await makeRequest({\n method: \"PATCH\",\n url: buildUrl(params.endpoint, params.baseUrl),\n token,\n body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _staticConfig?.additionalHeaders,\n });\n\n return translateResponse({\n classKey: params.responseType ?? params.classKey,\n apiResponse,\n companyId: params.companyId,\n language: params.language,\n });\n}\n\nexport async function JsonApiDelete(params: {\n classKey: ApiRequestDataTypeInterface;\n endpoint: string;\n companyId?: string;\n language: string;\n responseType?: ApiRequestDataTypeInterface;\n token?: string;\n baseUrl?: string;\n}): Promise<ApiResponseInterface> {\n runBootstrapper();\n const token = params.token ?? (await getToken());\n\n const apiResponse = await makeRequest({\n method: \"DELETE\",\n url: buildUrl(params.endpoint, params.baseUrl),\n token,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _staticConfig?.additionalHeaders,\n });\n\n return translateResponse({\n classKey: params.responseType ?? params.classKey,\n apiResponse,\n companyId: params.companyId,\n language: params.language,\n });\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/chunk-FPO4DLZN.js","../src/core/registry/DataClassRegistry.ts","../src/core/factories/JsonApiDataFactory.ts","../src/core/registry/bootstrapStore.ts","../src/core/utils/translateResponse.ts","../src/unified/JsonApiRequest.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACA;ACDO,IAAM,kBAAA,YAAN,MAAwB;AAAA,EAH/B,OAG+B;AAAA,IAAA,qCAAA,IAAA,EAAA,mBAAA,CAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAK7B,4BAAe,KAAA,kBAAO,IAAI,GAAA,CAA0C,EAAA;AAAA,EAEpE,OAAc,mBAAA,CACZ,GAAA,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AA;AAAyB,IAAA;AACiB,IAAA;AACxC,IAAA;AACkB,IAAA;AACD,EAAA;AAErB;AA3BsB;AL+GtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/nextjs-jsonapi/nextjs-jsonapi/dist/chunk-FPO4DLZN.js","sourcesContent":[null,"import { ApiDataInterface } from \"../interfaces/ApiDataInterface\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\n\nexport class DataClassRegistry {\n // Use Map with string key (module.name) for reliable lookup\n // String keys are stable across HMR and module re-evaluations\n // Note: WeakMap with object identity was tried but fails during Next.js navigation\n // because module re-evaluation creates new object instances with different identity\n private static _map = new Map<string, { new (): ApiDataInterface }>();\n\n public static registerObjectClass(\n key: ApiRequestDataTypeInterface,\n classConstructor: { new (): ApiDataInterface },\n ): void {\n const classKey = key.name;\n if (!this._map.has(classKey)) {\n this._map.set(classKey, classConstructor);\n }\n }\n\n public static get(classKey: ApiRequestDataTypeInterface): {\n new (): ApiDataInterface;\n } {\n const response = this._map.get(classKey.name);\n if (!response) {\n throw new Error(\n `Class not registered for key: ${typeof classKey === \"string\" ? classKey : classKey.name}. Ensure bootstrap() was called.`,\n );\n }\n\n return response;\n }\n\n /**\n * Get class constructor by JSON:API type name.\n * Used for polymorphic rehydration where the type is determined at runtime.\n */\n public static getByJsonApiType(typeName: string): { new (): ApiDataInterface } | undefined {\n return this._map.get(typeName);\n }\n\n /**\n * Bootstrap the registry with all modules.\n * This is a convenience method for apps to register all their modules at once.\n *\n * @param modules - An object with module definitions (like the app's Modules class)\n */\n public static bootstrap(modules: Record<string, ApiRequestDataTypeInterface>): void {\n Object.values(modules).forEach((module) => {\n if (module && module.model) {\n this.registerObjectClass(module, module.model);\n }\n });\n }\n\n /**\n * Clear all registered classes. Useful for testing.\n */\n public static clear(): void {\n this._map.clear();\n }\n}\n\n// Export alias for backward compatibility\nexport { DataClassRegistry as DataClass };\n","import { ApiDataInterface } from \"../interfaces/ApiDataInterface\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\nimport { DataClassRegistry } from \"../registry/DataClassRegistry\";\n\nexport class JsonApiDataFactory {\n public static create(classKey: ApiRequestDataTypeInterface, data: any): any {\n const factoryClass = DataClassRegistry.get(classKey);\n\n const instance = new factoryClass() as ApiDataInterface;\n const result = instance.createJsonApi(data);\n return result;\n }\n}\n","/**\n * Centralized bootstrap store accessible from ModuleRegistry.\n * This file has NO external dependencies to avoid circular imports.\n *\n * The bootstrap store allows ModuleRegistry to call the app's bootstrapper\n * when modules are accessed before bootstrap() was called, providing\n * self-healing behavior for module evaluation order issues.\n *\n * IMPORTANT: We use globalThis to persist state across HMR/Turbopack\n * module re-evaluations in development mode. Without this, the bootstrapper\n * reference would be lost when modules are hot-reloaded, causing\n * \"Module not registered\" errors during navigation.\n */\n\ntype BootstrapperFn = () => void;\n\n// Symbol key to avoid conflicts with other globals\nconst BOOTSTRAP_KEY = Symbol.for(\"nextjs-jsonapi:bootstrapper\");\nconst BOOTSTRAP_ATTEMPTED_KEY = Symbol.for(\"nextjs-jsonapi:bootstrapAttempted\");\n\n// Use globalThis to persist across HMR reloads\nconst globalStore = globalThis as unknown as {\n [BOOTSTRAP_KEY]?: BootstrapperFn | null;\n [BOOTSTRAP_ATTEMPTED_KEY]?: boolean;\n};\n\n// Initialize from global if not set\nif (globalStore[BOOTSTRAP_KEY] === undefined) {\n globalStore[BOOTSTRAP_KEY] = null;\n}\nif (globalStore[BOOTSTRAP_ATTEMPTED_KEY] === undefined) {\n globalStore[BOOTSTRAP_ATTEMPTED_KEY] = false;\n}\n\n// Getters/setters that use the global store\nfunction getBootstrapperInternal(): BootstrapperFn | null {\n return globalStore[BOOTSTRAP_KEY] ?? null;\n}\n\nfunction setBootstrapperInternal(fn: BootstrapperFn | null): void {\n globalStore[BOOTSTRAP_KEY] = fn;\n}\n\nfunction getBootstrapAttempted(): boolean {\n return globalStore[BOOTSTRAP_ATTEMPTED_KEY] ?? false;\n}\n\nfunction setBootstrapAttempted(value: boolean): void {\n globalStore[BOOTSTRAP_ATTEMPTED_KEY] = value;\n}\n\n/**\n * Register the bootstrapper function.\n * Called by configureJsonApi() from client/config, client/JsonApiClient, or unified/JsonApiRequest.\n */\nexport function setBootstrapper(fn: BootstrapperFn): void {\n setBootstrapperInternal(fn);\n}\n\n/**\n * Get the registered bootstrapper function.\n * Returns null if no bootstrapper has been registered.\n */\nexport function getBootstrapper(): BootstrapperFn | null {\n return getBootstrapperInternal();\n}\n\n/**\n * Attempt to run the bootstrapper if one is registered.\n * Returns true if bootstrapper was executed, false if not available.\n * Safe to call multiple times - bootstrapper is expected to be idempotent.\n */\nexport function tryBootstrap(): boolean {\n const bootstrapper = getBootstrapperInternal();\n const attempted = getBootstrapAttempted();\n\n if (attempted && !bootstrapper) {\n // Already tried and no bootstrapper available\n return false;\n }\n setBootstrapAttempted(true);\n\n if (bootstrapper) {\n bootstrapper();\n return true;\n }\n return false;\n}\n\n/**\n * Check if a bootstrapper has been registered.\n */\nexport function hasBootstrapper(): boolean {\n return getBootstrapperInternal() !== null;\n}\n\n/**\n * Reset the bootstrap store. Useful for testing.\n */\nexport function resetBootstrapStore(): void {\n setBootstrapperInternal(null);\n setBootstrapAttempted(false);\n}\n","import { ApiData } from \"../interfaces/ApiData\";\nimport { ApiDataInterface } from \"../interfaces/ApiDataInterface\";\nimport { ApiRequestDataTypeInterface } from \"../interfaces/ApiRequestDataTypeInterface\";\nimport { ApiResponseInterface } from \"../interfaces/ApiResponseInterface\";\nimport { DataClassRegistry } from \"../registry/DataClassRegistry\";\n\n/**\n * Translates raw JSON:API data into typed objects.\n * Does not require API response metadata.\n */\nexport function translateData<T extends ApiDataInterface>(params: {\n classKey: ApiRequestDataTypeInterface;\n data: any;\n}): T | T[] {\n const factoryClass = DataClassRegistry.get(params.classKey);\n\n if (!factoryClass) {\n throw new Error(\n `Class not registered for key: ${typeof params.classKey === \"string\" ? params.classKey : params.classKey.name}`,\n );\n }\n\n const included: any = params.data.included ?? [];\n\n if (Array.isArray(params.data.data)) {\n const responseData: T[] = [];\n\n for (const data of params.data.data) {\n const object = new factoryClass();\n object.rehydrate({ jsonApi: data, included: included, allData: params.data.data });\n responseData.push(object as T);\n }\n\n return responseData as T[];\n } else {\n const responseData = new factoryClass();\n responseData.rehydrate({\n jsonApi: params.data.data,\n included: included,\n });\n\n return responseData as T;\n }\n}\n\n/**\n * Translates a full API response into a typed ApiResponseInterface.\n * Includes pagination support.\n */\nexport async function translateResponse<T extends ApiDataInterface>(params: {\n classKey: ApiRequestDataTypeInterface;\n apiResponse: ApiData;\n companyId?: string;\n language: string;\n paginationHandler?: (endpoint: string) => Promise<ApiResponseInterface>;\n}): Promise<ApiResponseInterface> {\n const response: ApiResponseInterface = {\n ok: true,\n response: 0,\n data: [],\n error: \"\",\n };\n\n const factoryClass = DataClassRegistry.get(params.classKey);\n\n if (!factoryClass) {\n throw new Error(\n `Class not registered for key: ${typeof params.classKey === \"string\" ? params.classKey : params.classKey.name}`,\n );\n }\n\n response.ok = params.apiResponse.ok;\n response.response = params.apiResponse.status;\n\n if (!params.apiResponse.ok) {\n // `statusText` is empty over HTTP/2 (the reason phrase was removed from the protocol), so the\n // body is the only reliable source of error text. APIs in this stack use either key.\n response.error =\n params.apiResponse?.data?.message ?? params.apiResponse?.data?.error ?? params.apiResponse.statusText;\n response.raw = params.apiResponse.data;\n return response;\n }\n\n if (params.apiResponse.status === 204) return response;\n\n response.raw = params.apiResponse.data;\n\n // Extract meta from JSON:API response\n if (params.apiResponse.data?.meta) {\n response.meta = params.apiResponse.data.meta;\n }\n\n try {\n // Check if response is JSON:API formatted (has a 'data' property)\n // If not, return the raw response data directly (e.g., { url: \"...\" } or { clientSecret: \"...\" })\n if (\n params.apiResponse.data &&\n typeof params.apiResponse.data === \"object\" &&\n !Array.isArray(params.apiResponse.data) &&\n params.apiResponse.data.data === undefined\n ) {\n response.data = params.apiResponse.data;\n return response;\n }\n\n const included: any = params.apiResponse.data.included ?? [];\n\n if (params.apiResponse.data.links) {\n response.self = params.apiResponse.data.links.self;\n\n if (params.apiResponse.data.links.next && params.paginationHandler) {\n response.next = params.apiResponse.data.links.next;\n response.nextPage = async () => params.paginationHandler!(params.apiResponse.data.links.next);\n }\n\n if (params.apiResponse.data.links.prev && params.paginationHandler) {\n response.prev = params.apiResponse.data.links.prev;\n response.prevPage = async () => params.paginationHandler!(params.apiResponse.data.links.prev);\n }\n }\n\n if (Array.isArray(params.apiResponse.data.data)) {\n const responseData: T[] = [];\n\n for (const data of params.apiResponse.data.data) {\n const object = new factoryClass();\n object.rehydrate({ jsonApi: data, included: included, allData: params.apiResponse.data.data });\n responseData.push(object as T);\n }\n\n response.data = responseData;\n } else {\n const responseData = new factoryClass();\n responseData.rehydrate({\n jsonApi: params.apiResponse.data.data,\n included: included,\n });\n\n response.data = responseData;\n }\n } catch (e) {\n console.error(e);\n }\n\n return response;\n}\n","import { JsonApiDataFactory } from \"../core/factories/JsonApiDataFactory\";\nimport { ApiData } from \"../core/interfaces/ApiData\";\nimport { ApiRequestDataTypeInterface } from \"../core/interfaces/ApiRequestDataTypeInterface\";\nimport { ApiResponseInterface } from \"../core/interfaces/ApiResponseInterface\";\nimport { setBootstrapper } from \"../core/registry/bootstrapStore\";\nimport { translateResponse } from \"../core/utils/translateResponse\";\nimport { ModuleWithPermissions } from \"../permissions/types\";\n\n// Type definitions for dynamically imported functions (avoiding typeof import to prevent bundling)\ntype DirectFetchFn = (params: {\n method: string;\n url: string;\n token?: string;\n body?: any;\n files?: { [key: string]: File | Blob } | File | Blob;\n companyId?: string;\n language: string;\n additionalHeaders?: Record<string, string>;\n}) => Promise<ApiData>;\n\ntype ServerRequestFn = (params: {\n method: string;\n url: string;\n token?: string;\n cache?: string;\n body?: any;\n files?: { [key: string]: File | Blob } | File | Blob;\n companyId?: string;\n language: string;\n additionalHeaders?: Record<string, string>;\n}) => Promise<ApiData>;\n\ntype GetTokenFn = () => Promise<string | undefined>;\n\n// These will be dynamically imported based on environment\nlet _directFetch: DirectFetchFn;\nlet _serverRequest: ServerRequestFn;\nlet _getClientToken: GetTokenFn;\nlet _getServerToken: GetTokenFn;\n\n// Config storage for non-React contexts\nlet _staticConfig: {\n apiUrl: string;\n appUrl?: string;\n trackablePages?: ModuleWithPermissions[];\n bootstrapper?: () => void;\n additionalHeaders?: Record<string, string>;\n} | null = null;\n\n/**\n * Configure the JSON:API client for non-React contexts (e.g., server components).\n * For React contexts, use JsonApiProvider instead.\n */\nexport function configureJsonApi(config: {\n apiUrl: string;\n appUrl?: string;\n trackablePages?: ModuleWithPermissions[];\n bootstrapper?: () => void;\n additionalHeaders?: Record<string, string>;\n}): void {\n _staticConfig = config;\n // Register and call bootstrapper to register all modules\n if (config.bootstrapper) {\n setBootstrapper(config.bootstrapper);\n config.bootstrapper();\n }\n}\n\nasync function getToken(): Promise<string | undefined> {\n if (typeof window === \"undefined\") {\n // Server-side\n if (!_getServerToken) {\n const serverModule = await import(\"../server/token\");\n _getServerToken = serverModule.getServerToken;\n }\n return _getServerToken();\n } else {\n // Client-side\n if (!_getClientToken) {\n const clientModule = await import(\"../client/token\");\n _getClientToken = clientModule.getClientToken;\n }\n return _getClientToken();\n }\n}\n\nasync function makeRequest(params: {\n method: string;\n url: string;\n token?: string;\n cache?: string;\n body?: any;\n files?: { [key: string]: File | Blob } | File | Blob;\n companyId?: string;\n language: string;\n additionalHeaders?: Record<string, string>;\n}): Promise<ApiData> {\n if (typeof window !== \"undefined\") {\n // Client-side: use direct fetch\n if (!_directFetch) {\n const clientModule = await import(\"../client/request\");\n _directFetch = clientModule.directFetch;\n }\n return _directFetch({\n method: params.method,\n url: params.url,\n token: params.token,\n body: params.body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: params.additionalHeaders,\n });\n } else {\n // Server-side: use server request with caching\n if (!_serverRequest) {\n const serverModule = await import(\"../server/request\");\n _serverRequest = serverModule.serverRequest;\n }\n return _serverRequest({\n method: params.method,\n url: params.url,\n token: params.token,\n cache: params.cache,\n body: params.body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: params.additionalHeaders,\n });\n }\n}\n\nexport function getApiUrl(): string {\n if (_staticConfig?.apiUrl) {\n return _staticConfig.apiUrl;\n }\n // Fallback to environment variable\n const envUrl = process.env.NEXT_PUBLIC_API_URL;\n if (!envUrl) {\n throw new Error(\"API URL not configured. Use configureJsonApi() or set NEXT_PUBLIC_API_URL environment variable.\");\n }\n return envUrl;\n}\n\nexport function getAppUrl(): string {\n if (_staticConfig?.appUrl) {\n return _staticConfig.appUrl;\n }\n // Fallback to environment variable\n const envUrl = process.env.NEXT_PUBLIC_ADDRESS;\n if (!envUrl) {\n throw new Error(\n \"App URL not configured. Use configureJsonApi({ appUrl }) or set NEXT_PUBLIC_ADDRESS environment variable.\",\n );\n }\n return envUrl.trim().replace(/\\/+$/, \"\");\n}\n\nexport function getTrackablePages(): ModuleWithPermissions[] {\n return _staticConfig?.trackablePages ?? [];\n}\n\nfunction runBootstrapper(): void {\n if (_staticConfig?.bootstrapper) {\n _staticConfig.bootstrapper();\n }\n}\n\n/**\n * Resolve the final request URL for an endpoint.\n *\n * - `endpoint` starting with \"http\" is always passed through unchanged (existing behaviour).\n * - Otherwise, an explicit `baseUrl` (per-call override) takes precedence over the global\n * `getApiUrl()` resolution. Omitting `baseUrl` preserves today's behaviour exactly.\n */\nexport function buildUrl(endpoint: string, baseUrl?: string): string {\n if (endpoint.startsWith(\"http\")) return endpoint;\n const apiUrl = baseUrl ?? getApiUrl();\n return `${apiUrl}${endpoint}`;\n}\n\nexport async function JsonApiGet(params: {\n classKey: ApiRequestDataTypeInterface;\n endpoint: string;\n companyId?: string;\n language: string;\n token?: string;\n baseUrl?: string;\n}): Promise<ApiResponseInterface> {\n runBootstrapper();\n const token = params.token ?? (await getToken());\n\n const apiResponse = await makeRequest({\n method: \"GET\",\n url: buildUrl(params.endpoint, params.baseUrl),\n token,\n cache: params.classKey.cache,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _staticConfig?.additionalHeaders,\n });\n\n return translateResponse({\n classKey: params.classKey,\n apiResponse,\n companyId: params.companyId,\n language: params.language,\n paginationHandler: async (endpoint: string) =>\n JsonApiGet({\n classKey: params.classKey,\n endpoint,\n companyId: params.companyId,\n language: params.language,\n token: params.token,\n baseUrl: params.baseUrl,\n }),\n });\n}\n\nexport async function JsonApiPost(params: {\n classKey: ApiRequestDataTypeInterface;\n endpoint: string;\n companyId?: string;\n body?: any;\n overridesJsonApiCreation?: boolean;\n files?: { [key: string]: File | Blob } | File | Blob;\n language: string;\n responseType?: ApiRequestDataTypeInterface;\n token?: string;\n baseUrl?: string;\n}): Promise<ApiResponseInterface> {\n runBootstrapper();\n const token = params.token ?? (await getToken());\n\n let body = params.body;\n if (!body) {\n body = {};\n } else if (params.overridesJsonApiCreation !== true) {\n body = JsonApiDataFactory.create(params.classKey, body);\n }\n\n const apiResponse = await makeRequest({\n method: \"POST\",\n url: buildUrl(params.endpoint, params.baseUrl),\n token,\n body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _staticConfig?.additionalHeaders,\n });\n\n return translateResponse({\n classKey: params.responseType ?? params.classKey,\n apiResponse,\n companyId: params.companyId,\n language: params.language,\n });\n}\n\nexport async function JsonApiPut(params: {\n classKey: ApiRequestDataTypeInterface;\n endpoint: string;\n companyId?: string;\n body?: any;\n files?: { [key: string]: File | Blob } | File | Blob;\n language: string;\n responseType?: ApiRequestDataTypeInterface;\n token?: string;\n baseUrl?: string;\n}): Promise<ApiResponseInterface> {\n runBootstrapper();\n const token = params.token ?? (await getToken());\n\n let body = params.body;\n if (!body) {\n body = {};\n } else {\n body = JsonApiDataFactory.create(params.classKey, body);\n }\n\n const apiResponse = await makeRequest({\n method: \"PUT\",\n url: buildUrl(params.endpoint, params.baseUrl),\n token,\n body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _staticConfig?.additionalHeaders,\n });\n\n return translateResponse({\n classKey: params.responseType ?? params.classKey,\n apiResponse,\n companyId: params.companyId,\n language: params.language,\n });\n}\n\nexport async function JsonApiPatch(params: {\n classKey: ApiRequestDataTypeInterface;\n endpoint: string;\n companyId?: string;\n body?: any;\n files?: { [key: string]: File | Blob } | File | Blob;\n overridesJsonApiCreation?: boolean;\n responseType?: ApiRequestDataTypeInterface;\n language: string;\n token?: string;\n baseUrl?: string;\n}): Promise<ApiResponseInterface> {\n runBootstrapper();\n const token = params.token ?? (await getToken());\n\n let body = params.body;\n if (!body) {\n body = {};\n } else if (params.overridesJsonApiCreation !== true) {\n body = JsonApiDataFactory.create(params.classKey, body);\n }\n\n const apiResponse = await makeRequest({\n method: \"PATCH\",\n url: buildUrl(params.endpoint, params.baseUrl),\n token,\n body,\n files: params.files,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _staticConfig?.additionalHeaders,\n });\n\n return translateResponse({\n classKey: params.responseType ?? params.classKey,\n apiResponse,\n companyId: params.companyId,\n language: params.language,\n });\n}\n\nexport async function JsonApiDelete(params: {\n classKey: ApiRequestDataTypeInterface;\n endpoint: string;\n companyId?: string;\n language: string;\n responseType?: ApiRequestDataTypeInterface;\n token?: string;\n baseUrl?: string;\n}): Promise<ApiResponseInterface> {\n runBootstrapper();\n const token = params.token ?? (await getToken());\n\n const apiResponse = await makeRequest({\n method: \"DELETE\",\n url: buildUrl(params.endpoint, params.baseUrl),\n token,\n companyId: params.companyId,\n language: params.language,\n additionalHeaders: _staticConfig?.additionalHeaders,\n });\n\n return translateResponse({\n classKey: params.responseType ?? params.classKey,\n apiResponse,\n companyId: params.companyId,\n language: params.language,\n });\n}\n"]}
|
|
@@ -14,7 +14,7 @@ var _chunkIBS6NI7Djs = require('./chunk-IBS6NI7D.js');
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkFPO4DLZNjs = require('./chunk-FPO4DLZN.js');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
var _chunk7QVYU63Ejs = require('./chunk-7QVYU63E.js');
|
|
@@ -25,12 +25,12 @@ var RehydrationFactory = class {
|
|
|
25
25
|
_chunk7QVYU63Ejs.__name.call(void 0, this, "RehydrationFactory");
|
|
26
26
|
}
|
|
27
27
|
static rehydrate(classKey, data) {
|
|
28
|
-
const factoryClass =
|
|
28
|
+
const factoryClass = _chunkFPO4DLZNjs.DataClassRegistry.get(classKey);
|
|
29
29
|
const instance = new factoryClass();
|
|
30
30
|
return instance.rehydrate(data);
|
|
31
31
|
}
|
|
32
32
|
static rehydrateList(classKey, data) {
|
|
33
|
-
const factoryClass =
|
|
33
|
+
const factoryClass = _chunkFPO4DLZNjs.DataClassRegistry.get(classKey);
|
|
34
34
|
const response = data.map((item) => {
|
|
35
35
|
const instance = new factoryClass();
|
|
36
36
|
return instance.rehydrate(item);
|
|
@@ -335,7 +335,7 @@ var AbstractService = class {
|
|
|
335
335
|
* Make an API call with automatic environment detection and error handling.
|
|
336
336
|
*/
|
|
337
337
|
static async callApi(params) {
|
|
338
|
-
const { JsonApiGet: JsonApiGet2, JsonApiPost: JsonApiPost2, JsonApiPut, JsonApiPatch, JsonApiDelete: JsonApiDelete2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./JsonApiRequest-
|
|
338
|
+
const { JsonApiGet: JsonApiGet2, JsonApiPost: JsonApiPost2, JsonApiPut, JsonApiPatch, JsonApiDelete: JsonApiDelete2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./JsonApiRequest-QRU3IPIU.js")));
|
|
339
339
|
let apiResponse;
|
|
340
340
|
let language = "en";
|
|
341
341
|
if (typeof window === "undefined") {
|
|
@@ -436,7 +436,7 @@ var AbstractService = class {
|
|
|
436
436
|
* Make an API call and return both data and meta from the response.
|
|
437
437
|
*/
|
|
438
438
|
static async callApiWithMeta(params) {
|
|
439
|
-
const { JsonApiGet: JsonApiGet2, JsonApiPost: JsonApiPost2, JsonApiPut, JsonApiPatch, JsonApiDelete: JsonApiDelete2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./JsonApiRequest-
|
|
439
|
+
const { JsonApiGet: JsonApiGet2, JsonApiPost: JsonApiPost2, JsonApiPut, JsonApiPatch, JsonApiDelete: JsonApiDelete2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./JsonApiRequest-QRU3IPIU.js")));
|
|
440
440
|
let apiResponse;
|
|
441
441
|
let language = "en";
|
|
442
442
|
if (typeof window === "undefined") {
|
|
@@ -522,7 +522,7 @@ var AbstractService = class {
|
|
|
522
522
|
* Get raw JSON:API response data without deserialization.
|
|
523
523
|
*/
|
|
524
524
|
static async getRawData(params) {
|
|
525
|
-
const { JsonApiGet: JsonApiGet2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./JsonApiRequest-
|
|
525
|
+
const { JsonApiGet: JsonApiGet2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./JsonApiRequest-QRU3IPIU.js")));
|
|
526
526
|
let language = "en";
|
|
527
527
|
if (typeof window === "undefined") {
|
|
528
528
|
const { getLocale } = await Promise.resolve().then(() => _interopRequireWildcard(require("next-intl/server")));
|
|
@@ -558,7 +558,7 @@ var _clientConfig = null;
|
|
|
558
558
|
function configureClientJsonApi(config) {
|
|
559
559
|
_clientConfig = config;
|
|
560
560
|
if (config.bootstrapper) {
|
|
561
|
-
|
|
561
|
+
_chunkFPO4DLZNjs.setBootstrapper.call(void 0, config.bootstrapper);
|
|
562
562
|
config.bootstrapper();
|
|
563
563
|
}
|
|
564
564
|
}
|
|
@@ -616,7 +616,7 @@ async function ClientJsonApiGet(params) {
|
|
|
616
616
|
language: params.language,
|
|
617
617
|
additionalHeaders: _optionalChain([_clientConfig, 'optionalAccess', _26 => _26.additionalHeaders])
|
|
618
618
|
});
|
|
619
|
-
return
|
|
619
|
+
return _chunkFPO4DLZNjs.translateResponse.call(void 0, {
|
|
620
620
|
classKey: params.classKey,
|
|
621
621
|
apiResponse,
|
|
622
622
|
companyId: params.companyId,
|
|
@@ -638,7 +638,7 @@ async function ClientJsonApiPost(params) {
|
|
|
638
638
|
if (!body) {
|
|
639
639
|
body = {};
|
|
640
640
|
} else if (params.overridesJsonApiCreation !== true) {
|
|
641
|
-
body =
|
|
641
|
+
body = _chunkFPO4DLZNjs.JsonApiDataFactory.create(params.classKey, body);
|
|
642
642
|
}
|
|
643
643
|
const apiResponse = await _chunkIBS6NI7Djs.directFetch.call(void 0, {
|
|
644
644
|
method: "POST",
|
|
@@ -650,7 +650,7 @@ async function ClientJsonApiPost(params) {
|
|
|
650
650
|
language: params.language,
|
|
651
651
|
additionalHeaders: _optionalChain([_clientConfig, 'optionalAccess', _27 => _27.additionalHeaders])
|
|
652
652
|
});
|
|
653
|
-
return
|
|
653
|
+
return _chunkFPO4DLZNjs.translateResponse.call(void 0, {
|
|
654
654
|
classKey: _nullishCoalesce(params.responseType, () => ( params.classKey)),
|
|
655
655
|
apiResponse,
|
|
656
656
|
companyId: params.companyId,
|
|
@@ -665,7 +665,7 @@ async function ClientJsonApiPut(params) {
|
|
|
665
665
|
if (!body) {
|
|
666
666
|
body = {};
|
|
667
667
|
} else {
|
|
668
|
-
body =
|
|
668
|
+
body = _chunkFPO4DLZNjs.JsonApiDataFactory.create(params.classKey, body);
|
|
669
669
|
}
|
|
670
670
|
const apiResponse = await _chunkIBS6NI7Djs.directFetch.call(void 0, {
|
|
671
671
|
method: "PUT",
|
|
@@ -677,7 +677,7 @@ async function ClientJsonApiPut(params) {
|
|
|
677
677
|
language: params.language,
|
|
678
678
|
additionalHeaders: _optionalChain([_clientConfig, 'optionalAccess', _28 => _28.additionalHeaders])
|
|
679
679
|
});
|
|
680
|
-
return
|
|
680
|
+
return _chunkFPO4DLZNjs.translateResponse.call(void 0, {
|
|
681
681
|
classKey: _nullishCoalesce(params.responseType, () => ( params.classKey)),
|
|
682
682
|
apiResponse,
|
|
683
683
|
companyId: params.companyId,
|
|
@@ -692,7 +692,7 @@ async function ClientJsonApiPatch(params) {
|
|
|
692
692
|
if (!body) {
|
|
693
693
|
body = {};
|
|
694
694
|
} else if (params.overridesJsonApiCreation !== true) {
|
|
695
|
-
body =
|
|
695
|
+
body = _chunkFPO4DLZNjs.JsonApiDataFactory.create(params.classKey, body);
|
|
696
696
|
}
|
|
697
697
|
const apiResponse = await _chunkIBS6NI7Djs.directFetch.call(void 0, {
|
|
698
698
|
method: "PATCH",
|
|
@@ -704,7 +704,7 @@ async function ClientJsonApiPatch(params) {
|
|
|
704
704
|
language: params.language,
|
|
705
705
|
additionalHeaders: _optionalChain([_clientConfig, 'optionalAccess', _29 => _29.additionalHeaders])
|
|
706
706
|
});
|
|
707
|
-
return
|
|
707
|
+
return _chunkFPO4DLZNjs.translateResponse.call(void 0, {
|
|
708
708
|
classKey: _nullishCoalesce(params.responseType, () => ( params.classKey)),
|
|
709
709
|
apiResponse,
|
|
710
710
|
companyId: params.companyId,
|
|
@@ -723,7 +723,7 @@ async function ClientJsonApiDelete(params) {
|
|
|
723
723
|
language: params.language,
|
|
724
724
|
additionalHeaders: _optionalChain([_clientConfig, 'optionalAccess', _30 => _30.additionalHeaders])
|
|
725
725
|
});
|
|
726
|
-
return
|
|
726
|
+
return _chunkFPO4DLZNjs.translateResponse.call(void 0, {
|
|
727
727
|
classKey: _nullishCoalesce(params.responseType, () => ( params.classKey)),
|
|
728
728
|
apiResponse,
|
|
729
729
|
companyId: params.companyId,
|
|
@@ -935,7 +935,7 @@ var ModuleRegistrar = (_class2 = class {
|
|
|
935
935
|
}).map((key) => modulesClass[key]);
|
|
936
936
|
data.forEach((item) => {
|
|
937
937
|
if (item && item.model) {
|
|
938
|
-
|
|
938
|
+
_chunkFPO4DLZNjs.DataClassRegistry.registerObjectClass(item, item.model);
|
|
939
939
|
}
|
|
940
940
|
});
|
|
941
941
|
this._isBootstrapped = true;
|
|
@@ -945,7 +945,7 @@ var ModuleRegistrar = (_class2 = class {
|
|
|
945
945
|
*/
|
|
946
946
|
static reset() {
|
|
947
947
|
this._isBootstrapped = false;
|
|
948
|
-
|
|
948
|
+
_chunkFPO4DLZNjs.DataClassRegistry.clear();
|
|
949
949
|
}
|
|
950
950
|
}, _class2.__initStatic2(), _class2);
|
|
951
951
|
|
|
@@ -968,20 +968,20 @@ var ModuleRegistryClass = class {
|
|
|
968
968
|
get(name) {
|
|
969
969
|
let module = this._modules.get(name);
|
|
970
970
|
if (!module) {
|
|
971
|
-
const didBootstrap =
|
|
971
|
+
const didBootstrap = _chunkFPO4DLZNjs.tryBootstrap.call(void 0, );
|
|
972
972
|
if (didBootstrap) {
|
|
973
973
|
module = this._modules.get(name);
|
|
974
974
|
}
|
|
975
975
|
}
|
|
976
976
|
if (!module) {
|
|
977
|
-
const hint =
|
|
977
|
+
const hint = _chunkFPO4DLZNjs.hasBootstrapper.call(void 0, ) ? "Bootstrap was called but module still not found. Check module registration." : "No bootstrapper registered. Ensure configureJsonApi({ bootstrapper }) is called before accessing modules.";
|
|
978
978
|
throw new Error(`Module "${String(name)}" not registered. ${hint}`);
|
|
979
979
|
}
|
|
980
980
|
return module;
|
|
981
981
|
}
|
|
982
982
|
findByName(moduleName) {
|
|
983
983
|
if (this._modules.size === 0) {
|
|
984
|
-
|
|
984
|
+
_chunkFPO4DLZNjs.tryBootstrap.call(void 0, );
|
|
985
985
|
}
|
|
986
986
|
for (const module of this._modules.values()) {
|
|
987
987
|
if (module.name === moduleName) {
|
|
@@ -992,7 +992,7 @@ var ModuleRegistryClass = class {
|
|
|
992
992
|
}
|
|
993
993
|
getAllPageUrls() {
|
|
994
994
|
if (this._modules.size === 0) {
|
|
995
|
-
|
|
995
|
+
_chunkFPO4DLZNjs.tryBootstrap.call(void 0, );
|
|
996
996
|
}
|
|
997
997
|
const seen = /* @__PURE__ */ new Set();
|
|
998
998
|
const result = [];
|
|
@@ -1009,7 +1009,7 @@ var ModuleRegistryClass = class {
|
|
|
1009
1009
|
findByModelName(modelName) {
|
|
1010
1010
|
let module = this._modules.get(modelName);
|
|
1011
1011
|
if (!module) {
|
|
1012
|
-
const didBootstrap =
|
|
1012
|
+
const didBootstrap = _chunkFPO4DLZNjs.tryBootstrap.call(void 0, );
|
|
1013
1013
|
if (didBootstrap) {
|
|
1014
1014
|
module = this._modules.get(modelName);
|
|
1015
1015
|
}
|
|
@@ -1031,7 +1031,7 @@ var ModuleRegistryClass = class {
|
|
|
1031
1031
|
}
|
|
1032
1032
|
getAll() {
|
|
1033
1033
|
if (this._modules.size === 0) {
|
|
1034
|
-
|
|
1034
|
+
_chunkFPO4DLZNjs.tryBootstrap.call(void 0, );
|
|
1035
1035
|
}
|
|
1036
1036
|
return Array.from(this._modules.values());
|
|
1037
1037
|
}
|
|
@@ -2984,7 +2984,7 @@ var AuthService = class extends AbstractService {
|
|
|
2984
2984
|
}
|
|
2985
2985
|
static async login(params) {
|
|
2986
2986
|
const language = params.language || "en-US";
|
|
2987
|
-
const apiResponse = await
|
|
2987
|
+
const apiResponse = await _chunkFPO4DLZNjs.JsonApiPost.call(void 0, {
|
|
2988
2988
|
classKey: Modules.Auth,
|
|
2989
2989
|
endpoint: new EndpointCreator({ endpoint: Modules.Auth, id: "login" }).generate(),
|
|
2990
2990
|
body: { email: params.email, password: params.password },
|
|
@@ -3018,7 +3018,7 @@ var AuthService = class extends AbstractService {
|
|
|
3018
3018
|
}
|
|
3019
3019
|
static async logout(params) {
|
|
3020
3020
|
const language = _optionalChain([params, 'optionalAccess', _71 => _71.language]) || "en-US";
|
|
3021
|
-
await
|
|
3021
|
+
await _chunkFPO4DLZNjs.JsonApiDelete.call(void 0, {
|
|
3022
3022
|
classKey: Modules.Auth,
|
|
3023
3023
|
endpoint: new EndpointCreator({ endpoint: Modules.Auth }).generate(),
|
|
3024
3024
|
language
|
|
@@ -3030,7 +3030,7 @@ var AuthService = class extends AbstractService {
|
|
|
3030
3030
|
}
|
|
3031
3031
|
static async initialiseForgotPassword(params) {
|
|
3032
3032
|
const language = params.language || "en-US";
|
|
3033
|
-
const response = await
|
|
3033
|
+
const response = await _chunkFPO4DLZNjs.JsonApiPost.call(void 0, {
|
|
3034
3034
|
classKey: Modules.Auth,
|
|
3035
3035
|
endpoint: new EndpointCreator({ endpoint: Modules.Auth, id: "forgot" }).generate(),
|
|
3036
3036
|
body: { email: params.email },
|
|
@@ -3059,7 +3059,7 @@ var AuthService = class extends AbstractService {
|
|
|
3059
3059
|
}
|
|
3060
3060
|
static async validateCode(params) {
|
|
3061
3061
|
const language = params.language || "en-US";
|
|
3062
|
-
const apiResponse = await
|
|
3062
|
+
const apiResponse = await _chunkFPO4DLZNjs.JsonApiGet.call(void 0, {
|
|
3063
3063
|
classKey: Modules.Auth,
|
|
3064
3064
|
endpoint: new EndpointCreator({ endpoint: Modules.Auth, id: "validate", childEndpoint: params.code }).generate(),
|
|
3065
3065
|
language
|
|
@@ -3103,7 +3103,7 @@ var AuthService = class extends AbstractService {
|
|
|
3103
3103
|
}
|
|
3104
3104
|
static async completeOAuthRegistration(params) {
|
|
3105
3105
|
const endpoint = new EndpointCreator({ endpoint: Modules.Auth, id: "oauth", childEndpoint: "complete" });
|
|
3106
|
-
const response = await
|
|
3106
|
+
const response = await _chunkFPO4DLZNjs.JsonApiPost.call(void 0, {
|
|
3107
3107
|
classKey: Modules.Auth,
|
|
3108
3108
|
endpoint: endpoint.generate(),
|
|
3109
3109
|
body: params,
|
|
@@ -4866,7 +4866,7 @@ var StripePromotionCodeService = class {
|
|
|
4866
4866
|
* @returns Validation result with discount details if valid
|
|
4867
4867
|
*/
|
|
4868
4868
|
static async validatePromotionCode(params) {
|
|
4869
|
-
const response = await
|
|
4869
|
+
const response = await _chunkFPO4DLZNjs.JsonApiPost.call(void 0, {
|
|
4870
4870
|
classKey: Modules.StripePromotionCode,
|
|
4871
4871
|
endpoint: `${STRIPE_PROMOTION_CODE_ENDPOINT}/validate`,
|
|
4872
4872
|
body: {
|
|
@@ -8375,4 +8375,4 @@ var AuditLogModule = /* @__PURE__ */ _chunk7QVYU63Ejs.__name.call(void 0, (facto
|
|
|
8375
8375
|
|
|
8376
8376
|
|
|
8377
8377
|
exports.RehydrationFactory = RehydrationFactory; exports.AbstractApiData = AbstractApiData; exports.HttpMethod = HttpMethod; exports.getLastApiTotal = getLastApiTotal; exports.clearLastApiTotal = clearLastApiTotal; exports.getLastApiMeta = getLastApiMeta; exports.clearLastApiMeta = clearLastApiMeta; exports.setGlobalErrorHandler = setGlobalErrorHandler; exports.getGlobalErrorHandler = getGlobalErrorHandler; exports.AbstractService = AbstractService; exports.configureClientJsonApi = configureClientJsonApi; exports.getClientApiUrl = getClientApiUrl; exports.getClientAppUrl = getClientAppUrl; exports.getClientTrackablePages = getClientTrackablePages; exports.buildClientUrl = buildClientUrl; exports.ClientJsonApiGet = ClientJsonApiGet; exports.ClientJsonApiPost = ClientJsonApiPost; exports.ClientJsonApiPut = ClientJsonApiPut; exports.ClientJsonApiPatch = ClientJsonApiPatch; exports.ClientJsonApiDelete = ClientJsonApiDelete; exports.ClientHttpMethod = ClientHttpMethod; exports.setClientGlobalErrorHandler = setClientGlobalErrorHandler; exports.getClientGlobalErrorHandler = getClientGlobalErrorHandler; exports.ClientAbstractService = ClientAbstractService; exports.ModuleRegistrar = ModuleRegistrar; exports.ModuleRegistry = ModuleRegistry; exports.Modules = Modules; exports.EndpointCreator = EndpointCreator; exports.createJsonApiInclusion = createJsonApiInclusion; exports.rehydrate = rehydrate; exports.rehydrateList = rehydrateList; exports.cn = cn; exports.composeRefs = composeRefs; exports.useComposedRefs = useComposedRefs; exports.MOBILE_BREAKPOINT = MOBILE_BREAKPOINT; exports.VIEWPORT_COOKIE_NAME = VIEWPORT_COOKIE_NAME; exports.getViewportContext = getViewportContext; exports.measureViewport = measureViewport; exports.persistViewport = persistViewport; exports.subscribeViewport = subscribeViewport; exports.useIsMobile = useIsMobile; exports.formatLocalDate = formatLocalDate; exports.formatDate = formatDate; exports.exists = exists; exports.TableOptions = TableOptions; exports.getTableOptions = getTableOptions; exports.getTableComponents = getTableComponents; exports.userObjectSchema = userObjectSchema; exports.entityObjectSchema = entityObjectSchema; exports.getInitials = getInitials; exports.isRemoteImageSrc = isRemoteImageSrc; exports.validatePartitaIva = validatePartitaIva; exports.validateCodiceFiscale = validateCodiceFiscale; exports.validateItalianTaxCode = validateItalianTaxCode; exports.formatPartitaIva = formatPartitaIva; exports.formatCodiceFiscale = formatCodiceFiscale; exports.BlockNoteDiffUtil = BlockNoteDiffUtil; exports.BlockNoteWordDiffRendererUtil = BlockNoteWordDiffRendererUtil; exports.getIconByModule = getIconByModule; exports.getIcon = getIcon; exports.getIconByModuleName = getIconByModuleName; exports.getLucideIcon = getLucideIcon; exports.getLucideIconByModule = getLucideIconByModule; exports.getLucideIconByModuleName = getLucideIconByModuleName; exports.showToast = showToast; exports.showError = showError; exports.dismissToast = dismissToast; exports.showCustomToast = showCustomToast; exports.Action = Action; exports.checkPermissions = checkPermissions; exports.checkPermissionsFromServer = checkPermissionsFromServer; exports.getValueFromPath = getValueFromPath; exports.TotpAuthenticator = TotpAuthenticator; exports.TotpAuthenticatorModule = TotpAuthenticatorModule; exports.TotpSetup = TotpSetup; exports.TotpSetupModule = TotpSetupModule; exports.TotpVerify = TotpVerify; exports.TotpVerifyModule = TotpVerifyModule; exports.TotpVerifyLogin = TotpVerifyLogin; exports.TotpVerifyLoginModule = TotpVerifyLoginModule; exports.Passkey = Passkey; exports.PasskeyModule = PasskeyModule; exports.PasskeyRegistrationOptions = PasskeyRegistrationOptions; exports.PasskeyRegistrationOptionsModule = PasskeyRegistrationOptionsModule; exports.PasskeyRegistrationVerify = PasskeyRegistrationVerify; exports.PasskeyRegistrationVerifyModule = PasskeyRegistrationVerifyModule; exports.PasskeyRename = PasskeyRename; exports.PasskeyRenameModule = PasskeyRenameModule; exports.PasskeyVerifyLogin = PasskeyVerifyLogin; exports.PasskeyVerifyLoginModule = PasskeyVerifyLoginModule; exports.PasskeyAuthenticationOptions = PasskeyAuthenticationOptions; exports.PasskeyAuthenticationOptionsModule = PasskeyAuthenticationOptionsModule; exports.TwoFactorEnable = TwoFactorEnable; exports.TwoFactorEnableModule = TwoFactorEnableModule; exports.TwoFactorChallenge = TwoFactorChallenge; exports.TwoFactorChallengeModule = TwoFactorChallengeModule; exports.BackupCodeVerify = BackupCodeVerify; exports.BackupCodeVerifyModule = BackupCodeVerifyModule; exports.configureAuth = configureAuth; exports.getTokenHandler = getTokenHandler; exports.Auth = Auth; exports.AuthService = AuthService; exports.TwoFactorStatus = TwoFactorStatus; exports.TwoFactorService = TwoFactorService; exports.AuthComponent = AuthComponent; exports.AuthModule = AuthModule; exports.TwoFactorStatusModule = TwoFactorStatusModule; exports.BillingService = BillingService; exports.Billing = Billing; exports.BillingModule = BillingModule; exports.PaymentMethod = PaymentMethod; exports.StripeCustomer = StripeCustomer; exports.StripeCustomerService = StripeCustomerService; exports.StripeCustomerModule = StripeCustomerModule; exports.StripePaymentMethodModule = StripePaymentMethodModule; exports.StripeInvoice = StripeInvoice; exports.InvoiceStatus = InvoiceStatus; exports.StripeInvoiceService = StripeInvoiceService; exports.StripeInvoiceModule = StripeInvoiceModule; exports.StripePrice = StripePrice; exports.StripePriceService = StripePriceService; exports.StripePriceModule = StripePriceModule; exports.StripeProduct = StripeProduct; exports.StripeProductService = StripeProductService; exports.StripeProductModule = StripeProductModule; exports.StripeSubscription = StripeSubscription; exports.SubscriptionStatus = SubscriptionStatus; exports.StripeSubscriptionService = StripeSubscriptionService; exports.StripeSubscriptionModule = StripeSubscriptionModule; exports.StripeUsage = StripeUsage; exports.StripeUsageService = StripeUsageService; exports.StripeUsageModule = StripeUsageModule; exports.StripePromotionCodeService = StripePromotionCodeService; exports.StripePromotionCode = StripePromotionCode; exports.StripePromotionCodeModule = StripePromotionCodeModule; exports.Company = Company; exports.CompanyFields = CompanyFields; exports.CompanyService = CompanyService; exports.CompanyModule = CompanyModule; exports.Content = Content; exports.ContentFields = ContentFields; exports.ContentService = ContentService; exports.ContentModule = ContentModule; exports.HowTo = HowTo; exports.HowToModule = HowToModule; exports.HowToFields = HowToFields; exports.HowToService = HowToService; exports.Assistant = Assistant; exports.AssistantModule = AssistantModule; exports.AssistantMessage = AssistantMessage; exports.AssistantService = AssistantService; exports.AssistantMessageModule = AssistantMessageModule; exports.AssistantMessageService = AssistantMessageService; exports.AssistantAction = AssistantAction; exports.AssistantActionModule = AssistantActionModule; exports.AssistantActionService = AssistantActionService; exports.Chunk = Chunk; exports.ChunkModule = ChunkModule; exports.Feature = Feature; exports.FeatureService = FeatureService; exports.FeatureModule = FeatureModule; exports.Module = Module; exports.ModuleModule = ModuleModule; exports.Notification = Notification; exports.NotificationFields = NotificationFields; exports.NotificationService = NotificationService; exports.NotificationModule = NotificationModule; exports.Push = Push; exports.PushService = PushService; exports.PushModule = PushModule; exports.Role = Role; exports.RoleFields = RoleFields; exports.RoleService = RoleService; exports.RoleModule = RoleModule; exports.S3 = S3; exports.S3Module = S3Module; exports.S3Service = S3Service; exports.User = User; exports.UserFields = UserFields; exports.UserService = UserService; exports.AuthorModule = AuthorModule; exports.UserModule = UserModule; exports.OAuthClient = OAuthClient; exports.OAuthModule = OAuthModule; exports.OAuthService = OAuthService; exports.OAUTH_SCOPE_DISPLAY = OAUTH_SCOPE_DISPLAY; exports.AVAILABLE_OAUTH_SCOPES = AVAILABLE_OAUTH_SCOPES; exports.DEFAULT_GRANT_TYPES = DEFAULT_GRANT_TYPES; exports.Waitlist = Waitlist; exports.WaitlistService = WaitlistService; exports.WaitlistStats = WaitlistStats; exports.WaitlistModule = WaitlistModule; exports.WaitlistStatsModule = WaitlistStatsModule; exports.PermissionMapping = PermissionMapping; exports.ModulePaths = ModulePaths; exports.RbacMatrixModel = RbacMatrixModel; exports.PermissionMappingModule = PermissionMappingModule; exports.ModulePathsModule = ModulePathsModule; exports.RbacMatrixModule = RbacMatrixModule; exports.ReferralStats = ReferralStats; exports.ReferralService = ReferralService; exports.ReferralModule = ReferralModule; exports.ReferralStatsModule = ReferralStatsModule; exports.TokenUsageAdminBreakdown = TokenUsageAdminBreakdown; exports.TokenUsageAdminSummary = TokenUsageAdminSummary; exports.TokenUsageAdminTimeline = TokenUsageAdminTimeline; exports.TokenUsageAdminSummaryModule = TokenUsageAdminSummaryModule; exports.TokenUsageAdminTimelineModule = TokenUsageAdminTimelineModule; exports.TokenUsageAdminBreakdownModule = TokenUsageAdminBreakdownModule; exports.AuditLog = AuditLog; exports.AuditLogService = AuditLogService; exports.AuditLogModule = AuditLogModule;
|
|
8378
|
-
//# sourceMappingURL=chunk-
|
|
8378
|
+
//# sourceMappingURL=chunk-KSU6CCW6.js.map
|