@vue-storefront/next 7.0.0-next.3 → 7.0.0-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.cjs +223 -0
- package/dist/{client.d.ts → client.d.cts} +6 -7
- package/dist/client.d.mts +6 -7
- package/dist/client.mjs +180 -139
- package/dist/env-BFUtR_CT.mjs +97 -0
- package/dist/env-BxyAENtV.cjs +115 -0
- package/dist/index-BXYjHxeC.d.mts +250 -0
- package/dist/index-D1weTw7N.d.cts +250 -0
- package/dist/index.cjs +258 -0
- package/dist/{index.d.ts → index.d.cts} +18 -20
- package/dist/index.d.mts +18 -20
- package/dist/index.mjs +214 -131
- package/package.json +14 -14
- package/dist/chunk-NSPLXZD5.mjs +0 -84
- package/dist/client.js +0 -228
- package/dist/index.js +0 -238
- package/dist/types-FGnrBhjy.d.mts +0 -241
- package/dist/types-FGnrBhjy.d.ts +0 -241
package/dist/index.mjs
CHANGED
|
@@ -1,162 +1,245 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__async,
|
|
3
|
-
__spreadProps,
|
|
4
|
-
__spreadValues,
|
|
5
|
-
env
|
|
6
|
-
} from "./chunk-NSPLXZD5.mjs";
|
|
7
|
-
|
|
8
|
-
// src/logger/index.ts
|
|
1
|
+
import { n as _objectSpread2, t as env } from "./env-BFUtR_CT.mjs";
|
|
9
2
|
import { LoggerFactory, LoggerType } from "@alokai/connect/logger";
|
|
3
|
+
import { buildModule, defineGetConfigSwitcherHeader, initSDK, middlewareModule } from "@alokai/connect/sdk";
|
|
10
4
|
|
|
11
|
-
|
|
5
|
+
//#region src/logger/injectMetadata.ts
|
|
12
6
|
function injectMetadata(logger, externalData) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
return targetProp;
|
|
23
|
-
}
|
|
24
|
-
});
|
|
7
|
+
return new Proxy(logger, { get(target, prop) {
|
|
8
|
+
const targetProp = target[prop];
|
|
9
|
+
if (typeof targetProp === "function") return (...args) => {
|
|
10
|
+
const [logData, metadata] = args;
|
|
11
|
+
targetProp(logData, _objectSpread2(_objectSpread2({}, metadata), externalData));
|
|
12
|
+
};
|
|
13
|
+
return targetProp;
|
|
14
|
+
} });
|
|
25
15
|
}
|
|
26
16
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
alokai: {
|
|
32
|
-
context: "storefront"
|
|
33
|
-
}
|
|
34
|
-
});
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/logger/index.ts
|
|
19
|
+
const createLogger = (options) => {
|
|
20
|
+
return injectMetadata(LoggerFactory.create(LoggerType.ConsolaGcp, options), { alokai: { context: "storefront" } });
|
|
35
21
|
};
|
|
36
22
|
|
|
37
|
-
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/middleware.ts
|
|
25
|
+
/**
|
|
26
|
+
* Creates an Alokai middleware wrapper that adds pathname information to request headers.
|
|
27
|
+
* This is required for proper pathname handling during SSR in Next.js.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* // middleware.ts
|
|
32
|
+
* import { createAlokaiMiddleware } from '@alokai/next';
|
|
33
|
+
*
|
|
34
|
+
* export default createAlokaiMiddleware((request) => {
|
|
35
|
+
* // Your middleware logic here
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @param middleware - The Next.js middleware function to wrap
|
|
40
|
+
* @returns A wrapped middleware function that adds pathname to request headers
|
|
41
|
+
*/
|
|
38
42
|
function createAlokaiMiddleware(middleware) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
return (request) => {
|
|
44
|
+
const nextUrl = request.nextUrl.clone();
|
|
45
|
+
request.headers.append("x-pathname", nextUrl.pathname);
|
|
46
|
+
request.headers.append("x-search", nextUrl.search);
|
|
47
|
+
return middleware(request);
|
|
48
|
+
};
|
|
45
49
|
}
|
|
46
50
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
getProductDetails: { method: "GET" },
|
|
64
|
-
getProductReviews: { method: "GET" },
|
|
65
|
-
getProducts: { method: "GET" },
|
|
66
|
-
searchProducts: { method: "GET" }
|
|
67
|
-
}
|
|
68
|
-
}
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/sdk/helpers/defaultConfigs.ts
|
|
53
|
+
const defaultMethodsRequestConfig = {
|
|
54
|
+
unifiedCms: { middlewareModule: {
|
|
55
|
+
getEntries: { method: "GET" },
|
|
56
|
+
getPage: { method: "GET" }
|
|
57
|
+
} },
|
|
58
|
+
unifiedCommerce: { middlewareModule: {
|
|
59
|
+
getCategories: { method: "GET" },
|
|
60
|
+
getCategory: { method: "GET" },
|
|
61
|
+
getCurrencies: { method: "GET" },
|
|
62
|
+
getProductDetails: { method: "GET" },
|
|
63
|
+
getProductReviews: { method: "GET" },
|
|
64
|
+
getProducts: { method: "GET" },
|
|
65
|
+
searchProducts: { method: "GET" }
|
|
66
|
+
} }
|
|
69
67
|
};
|
|
70
68
|
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
//#endregion
|
|
70
|
+
//#region \0@oxc-project+runtime@0.107.0/helpers/asyncToGenerator.js
|
|
71
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
72
|
+
try {
|
|
73
|
+
var i = n[a](c), u = i.value;
|
|
74
|
+
} catch (n$1) {
|
|
75
|
+
e(n$1);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
i.done ? t(u) : Promise.resolve(u).then(r, o);
|
|
79
|
+
}
|
|
80
|
+
function _asyncToGenerator(n) {
|
|
81
|
+
return function() {
|
|
82
|
+
var t = this, e = arguments;
|
|
83
|
+
return new Promise(function(r, o) {
|
|
84
|
+
var a = n.apply(t, e);
|
|
85
|
+
function _next(n$1) {
|
|
86
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "next", n$1);
|
|
87
|
+
}
|
|
88
|
+
function _throw(n$1) {
|
|
89
|
+
asyncGeneratorStep(a, r, o, _next, _throw, "throw", n$1);
|
|
90
|
+
}
|
|
91
|
+
_next(void 0);
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/sdk/helpers/resolveDynamicContext.ts
|
|
98
|
+
const BLACKLISTED_HEADERS = new Set(["host"]);
|
|
73
99
|
function isAppRouterHeaders(headers) {
|
|
74
|
-
|
|
100
|
+
return !!headers && "entries" in headers;
|
|
75
101
|
}
|
|
76
102
|
function isFlatNextHeaders(headers) {
|
|
77
|
-
|
|
103
|
+
return !!headers && !("headers" in headers);
|
|
78
104
|
}
|
|
79
105
|
function normalizeRequestHeaders(requestHeaders) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
106
|
+
const { cookies, headers = {} } = isFlatNextHeaders(requestHeaders) ? {
|
|
107
|
+
cookies: void 0,
|
|
108
|
+
headers: requestHeaders
|
|
109
|
+
} : {
|
|
110
|
+
cookies: requestHeaders === null || requestHeaders === void 0 ? void 0 : requestHeaders.cookies,
|
|
111
|
+
headers: requestHeaders === null || requestHeaders === void 0 ? void 0 : requestHeaders.headers
|
|
112
|
+
};
|
|
113
|
+
const normalizedHeaders = isAppRouterHeaders(headers) ? Object.fromEntries(headers.entries()) : headers;
|
|
114
|
+
if (cookies) normalizedHeaders.cookie = cookies.toString();
|
|
115
|
+
return normalizedHeaders;
|
|
89
116
|
}
|
|
90
117
|
function resolveDynamicContext(context) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
([key]) => !BLACKLISTED_HEADERS.has(key)
|
|
101
|
-
)
|
|
102
|
-
);
|
|
103
|
-
if (context.getLocale) {
|
|
104
|
-
requestHeaders["x-alokai-locale"] = context.getLocale();
|
|
105
|
-
}
|
|
106
|
-
return requestHeaders;
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
});
|
|
118
|
+
return _objectSpread2(_objectSpread2({}, context), {}, { getRequestHeaders() {
|
|
119
|
+
return _asyncToGenerator(function* () {
|
|
120
|
+
var _context$getRequestHe;
|
|
121
|
+
const normalizedHeaders = normalizeRequestHeaders(yield (_context$getRequestHe = context.getRequestHeaders) === null || _context$getRequestHe === void 0 ? void 0 : _context$getRequestHe.call(context));
|
|
122
|
+
const requestHeaders = Object.fromEntries(Object.entries(normalizedHeaders).filter(([key]) => !BLACKLISTED_HEADERS.has(key)));
|
|
123
|
+
if (context.getLocale) requestHeaders["x-alokai-locale"] = context.getLocale();
|
|
124
|
+
return requestHeaders;
|
|
125
|
+
})();
|
|
126
|
+
} });
|
|
110
127
|
}
|
|
111
128
|
|
|
112
|
-
|
|
113
|
-
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region src/sdk/index.tsx
|
|
131
|
+
/**
|
|
132
|
+
* Creates an SDK for the given configuration definition.
|
|
133
|
+
* @param options - The options for creating the SDK.
|
|
134
|
+
* @param configDefinition - The configuration definition for the SDK.
|
|
135
|
+
* @returns An object containing the `getSdk` function.
|
|
136
|
+
* @example
|
|
137
|
+
* ```tsx
|
|
138
|
+
* import { contentfulModule } from "@vsf-enterprise/contentful-sdk";
|
|
139
|
+
* import { CreateSdkOptions, createSdk } from "@vue-storefront/next";
|
|
140
|
+
* import type { UnifiedApiEndpoints } from "../storefront-middleware/types";
|
|
141
|
+
*
|
|
142
|
+
* const options: CreateSdkOptions = {
|
|
143
|
+
* middleware: {
|
|
144
|
+
* apiUrl: "http://localhost:4000",
|
|
145
|
+
* ssrApiUrl: "http://localhost:4000",
|
|
146
|
+
* cdnCacheBustingId: "no-cache-busting-id-set",
|
|
147
|
+
* },
|
|
148
|
+
* multistore: {
|
|
149
|
+
* enabled: false,
|
|
150
|
+
* },
|
|
151
|
+
* };
|
|
152
|
+
*
|
|
153
|
+
* export const { getSdk, createSdkContext } = createSdk(
|
|
154
|
+
* options,
|
|
155
|
+
* ({ buildModule, middlewareModule, config, getRequestHeaders }) => ({
|
|
156
|
+
* unified: buildModule(middlewareModule<UnifiedApiEndpoints>, {
|
|
157
|
+
* apiUrl: config.apiUrl + "/commerce",
|
|
158
|
+
* ssrApiUrl: config.ssrApiUrl + "/commerce",
|
|
159
|
+
* cdnCacheBustingId: config.cdnCacheBustingId,
|
|
160
|
+
* defaultRequestConfig: {
|
|
161
|
+
* headers: getRequestHeaders(),
|
|
162
|
+
* },
|
|
163
|
+
* methodsRequestConfig: config.defaultMethodsRequestConfig.unifiedCommerce.middlewareModule,
|
|
164
|
+
* }),
|
|
165
|
+
* contentful: buildModule(contentfulModule, {
|
|
166
|
+
* apiUrl: config.apiUrl + "/cntf",
|
|
167
|
+
* ssrApiUrl: config.ssrApiUrl + "/cntf",
|
|
168
|
+
* }),
|
|
169
|
+
* }),
|
|
170
|
+
* );
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
114
173
|
function createSdk(options, configDefinition) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
return {
|
|
133
|
-
getSdk
|
|
134
|
-
};
|
|
174
|
+
function getSdk(dynamicContext = {}) {
|
|
175
|
+
var _options$middleware$c;
|
|
176
|
+
const { getRequestHeaders } = resolveDynamicContext(dynamicContext);
|
|
177
|
+
return initSDK(configDefinition({
|
|
178
|
+
buildModule,
|
|
179
|
+
config: {
|
|
180
|
+
apiUrl: options.middleware.apiUrl,
|
|
181
|
+
cdnCacheBustingId: (_options$middleware$c = options.middleware.cdnCacheBustingId) !== null && _options$middleware$c !== void 0 ? _options$middleware$c : "no-cache-busting-id-set",
|
|
182
|
+
defaultMethodsRequestConfig,
|
|
183
|
+
ssrApiUrl: options.middleware.ssrApiUrl
|
|
184
|
+
},
|
|
185
|
+
defaults: defaultMethodsRequestConfig,
|
|
186
|
+
getRequestHeaders,
|
|
187
|
+
middlewareModule
|
|
188
|
+
}));
|
|
189
|
+
}
|
|
190
|
+
return { getSdk };
|
|
135
191
|
}
|
|
136
192
|
function defineSdkConfig(config) {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
return buildModules(config);
|
|
193
|
+
if (typeof config === "function") return config;
|
|
194
|
+
return buildModules(config);
|
|
141
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* Helper function to resolve the SDK options based on the configuration.
|
|
198
|
+
*
|
|
199
|
+
* @privateRemarks
|
|
200
|
+
* For now this file only verifies the type of the input and simply returns it.
|
|
201
|
+
* However, in the future we might need it to perform true input resolution.
|
|
202
|
+
*
|
|
203
|
+
* @param input - The options for creating the SDK.
|
|
204
|
+
* @param options - The configuration object, that allows to customize the API Url creation on enabled multistore.
|
|
205
|
+
*
|
|
206
|
+
* @returns The resolved SDK options.
|
|
207
|
+
*/
|
|
142
208
|
function resolveSdkOptions(input, _options = {}) {
|
|
143
|
-
|
|
209
|
+
return input;
|
|
144
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* Defines an SDK module that can be used with defineSdkConfig.
|
|
213
|
+
* Each module is a function that takes the InjectedContext and returns a built module.
|
|
214
|
+
*
|
|
215
|
+
* @param moduleDefinition - A function that takes InjectedContext and returns a built module
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* ```tsx
|
|
219
|
+
* import { defineSdkModule } from '@vue-storefront/next';
|
|
220
|
+
* import type { UnifiedEndpoints } from 'storefront-middleware/types';
|
|
221
|
+
* import { getConfigSwitcherHeader } from './utils';
|
|
222
|
+
*
|
|
223
|
+
* export const unified = defineSdkModule(({ buildModule, config, getRequestHeaders, middlewareModule }) =>
|
|
224
|
+
* buildModule(middlewareModule<UnifiedEndpoints>, {
|
|
225
|
+
* apiUrl: `${config.apiUrl}/commerce/unified`,
|
|
226
|
+
* ssrApiUrl: `${config.ssrApiUrl}/commerce/unified`,
|
|
227
|
+
* cdnCacheBustingId: config.cdnCacheBustingId,
|
|
228
|
+
* defaultRequestConfig: {
|
|
229
|
+
* getConfigSwitcherHeader,
|
|
230
|
+
* headers: getRequestHeaders(),
|
|
231
|
+
* },
|
|
232
|
+
* methodsRequestConfig: config.defaultMethodsRequestConfig.unifiedCommerce.middlewareModule,
|
|
233
|
+
* }),
|
|
234
|
+
* );
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
145
237
|
function defineSdkModule(moduleDefinition) {
|
|
146
|
-
|
|
238
|
+
return moduleDefinition;
|
|
147
239
|
}
|
|
148
240
|
function buildModules(modules) {
|
|
149
|
-
|
|
150
|
-
Object.entries(modules).map(([key, module]) => [key, module(context)])
|
|
151
|
-
);
|
|
241
|
+
return (context) => Object.fromEntries(Object.entries(modules).map(([key, module]) => [key, module(context)]));
|
|
152
242
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
createSdk,
|
|
157
|
-
defineGetConfigSwitcherHeader,
|
|
158
|
-
defineSdkConfig,
|
|
159
|
-
defineSdkModule,
|
|
160
|
-
env,
|
|
161
|
-
resolveSdkOptions
|
|
162
|
-
};
|
|
243
|
+
|
|
244
|
+
//#endregion
|
|
245
|
+
export { createAlokaiMiddleware, createLogger, createSdk, defineGetConfigSwitcherHeader, defineSdkConfig, defineSdkModule, env, resolveSdkOptions };
|
package/package.json
CHANGED
|
@@ -2,24 +2,24 @@
|
|
|
2
2
|
"name": "@vue-storefront/next",
|
|
3
3
|
"description": "Alokai dedicated features for Next.js",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "7.0.0-next.
|
|
5
|
+
"version": "7.0.0-next.5",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
|
-
"types": "./dist/index.d.
|
|
8
|
+
"types": "./dist/index.d.mts",
|
|
9
9
|
"import": "./dist/index.mjs",
|
|
10
|
-
"require": "./dist/index.
|
|
10
|
+
"require": "./dist/index.cjs"
|
|
11
11
|
},
|
|
12
12
|
"./client": {
|
|
13
|
-
"types": "./dist/client.d.
|
|
14
|
-
"import": "./dist/client.
|
|
15
|
-
"require": "./dist/client.
|
|
13
|
+
"types": "./dist/client.d.mts",
|
|
14
|
+
"import": "./dist/client.mjs",
|
|
15
|
+
"require": "./dist/client.cjs"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
19
|
"dist"
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
|
-
"build": "
|
|
22
|
+
"build": "tsdown",
|
|
23
23
|
"lint": "eslint",
|
|
24
24
|
"lint:fix": "eslint --fix",
|
|
25
25
|
"format": "prettier --write .",
|
|
@@ -27,25 +27,25 @@
|
|
|
27
27
|
"version": "cp CHANGELOG.md ../../docs/enterprise/content/storefront/6.change-log/next.md"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@alokai/instrumentation-next-component": "1.0.1-next.
|
|
30
|
+
"@alokai/instrumentation-next-component": "1.0.1-next.1",
|
|
31
31
|
"zustand": "^4.5.4"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@alokai/connect": "^2.0.0-next.
|
|
35
|
-
"@types/react": "
|
|
36
|
-
"@types/react-dom": "
|
|
34
|
+
"@alokai/connect": "^2.0.0-next.3",
|
|
35
|
+
"@types/react": "^19",
|
|
36
|
+
"@types/react-dom": "^19",
|
|
37
37
|
"eslint": "9.23.0",
|
|
38
|
-
"next": "
|
|
38
|
+
"next": "^16",
|
|
39
39
|
"prettier": "3.3.2",
|
|
40
40
|
"react": "19.2.0",
|
|
41
41
|
"react-dom": "19.2.0",
|
|
42
42
|
"start-server-and-test": "^2.0.11",
|
|
43
|
-
"
|
|
43
|
+
"tsdown": "0.19.0",
|
|
44
44
|
"vitest": "2.1.9"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@alokai/connect": "^2.0.0-next.1",
|
|
48
|
-
"next": "^
|
|
48
|
+
"next": "^16.0.0",
|
|
49
49
|
"react": "^19.0.0"
|
|
50
50
|
},
|
|
51
51
|
"engines": {
|
package/dist/chunk-NSPLXZD5.mjs
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
-
var __spreadValues = (a, b) => {
|
|
9
|
-
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
12
|
-
if (__getOwnPropSymbols)
|
|
13
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
-
}
|
|
17
|
-
return a;
|
|
18
|
-
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
-
var __objRest = (source, exclude) => {
|
|
21
|
-
var target = {};
|
|
22
|
-
for (var prop in source)
|
|
23
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
-
target[prop] = source[prop];
|
|
25
|
-
if (source != null && __getOwnPropSymbols)
|
|
26
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
-
target[prop] = source[prop];
|
|
29
|
-
}
|
|
30
|
-
return target;
|
|
31
|
-
};
|
|
32
|
-
var __async = (__this, __arguments, generator) => {
|
|
33
|
-
return new Promise((resolve, reject) => {
|
|
34
|
-
var fulfilled = (value) => {
|
|
35
|
-
try {
|
|
36
|
-
step(generator.next(value));
|
|
37
|
-
} catch (e) {
|
|
38
|
-
reject(e);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
var rejected = (value) => {
|
|
42
|
-
try {
|
|
43
|
-
step(generator.throw(value));
|
|
44
|
-
} catch (e) {
|
|
45
|
-
reject(e);
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
49
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
// src/env/constants.ts
|
|
54
|
-
var PUBLIC_ENV_KEY = "__ALOKAI_ENV__";
|
|
55
|
-
|
|
56
|
-
// src/env/env.ts
|
|
57
|
-
function env(key) {
|
|
58
|
-
var _a;
|
|
59
|
-
if (typeof window === "undefined") {
|
|
60
|
-
return process.env[key];
|
|
61
|
-
}
|
|
62
|
-
return (_a = window[PUBLIC_ENV_KEY]) == null ? void 0 : _a[key];
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// src/env/get-public-env.ts
|
|
66
|
-
function getPublicEnv() {
|
|
67
|
-
const publicEnv = {};
|
|
68
|
-
for (const key in process.env) {
|
|
69
|
-
if (key.startsWith("NEXT_PUBLIC_")) {
|
|
70
|
-
publicEnv[key] = process.env[key];
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return publicEnv;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export {
|
|
77
|
-
__spreadValues,
|
|
78
|
-
__spreadProps,
|
|
79
|
-
__objRest,
|
|
80
|
-
__async,
|
|
81
|
-
PUBLIC_ENV_KEY,
|
|
82
|
-
getPublicEnv,
|
|
83
|
-
env
|
|
84
|
-
};
|