@wix/astro 0.3.3 → 1.0.1
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/build/index.d.ts +5 -0
- package/build/index.js +124854 -0
- package/build/index.js.map +1 -0
- package/build/xdg-open +1267 -0
- package/build/yoga.wasm +0 -0
- package/build-runtime/auth.d.ts +5 -0
- package/build-runtime/auth.js +3557 -0
- package/package.json +37 -47
- package/runtime/entry.astro +26 -0
- package/src/directories.ts +10 -0
- package/src/env.d.ts +3 -0
- package/src/index.ts +217 -0
- package/src/middleware/auth.ts +115 -0
- package/src/plugins/patchGlobal.ts +20 -0
- package/src/utils/authStrategyAsyncLocalStorage.ts +6 -0
- package/src/utils/createProjectModel.ts +77 -0
- package/src/utils/generateAppManifest.ts +32 -0
- package/src/utils/isValidBackofficeComponent.ts +15 -0
- package/src/utils/loadExtension.ts +59 -0
- package/src/utils/sessionCookieJson.ts +9 -0
- package/src/utils/writeVirtualExtensionFiles.ts +54 -0
- package/tsconfig.json +8 -0
- package/tsup.config.mjs +28 -0
- package/README.md +0 -121
- package/dist/auth-context.d.ts +0 -5
- package/dist/auth-context.js +0 -2
- package/dist/client.d.ts +0 -15
- package/dist/client.js +0 -16
- package/dist/components/login-helpers/bi-header-generator.d.ts +0 -11
- package/dist/components/login-helpers/bi-header-generator.js +0 -17
- package/dist/components/login-helpers/iframeUtils.d.ts +0 -4
- package/dist/components/login-helpers/iframeUtils.js +0 -43
- package/dist/components/login-helpers/login-helpers.d.ts +0 -42
- package/dist/components/login-helpers/login-helpers.js +0 -119
- package/dist/components/login.astro +0 -873
- package/dist/entrypoints/server.d.ts +0 -13
- package/dist/entrypoints/server.js +0 -36
- package/dist/helpers/index.d.ts +0 -1
- package/dist/helpers/index.js +0 -1
- package/dist/index.d.ts +0 -5
- package/dist/index.js +0 -4
- package/dist/integration.d.ts +0 -22
- package/dist/integration.js +0 -233
- package/dist/loaders/blog.d.ts +0 -2
- package/dist/loaders/blog.js +0 -48
- package/dist/loaders/index.d.ts +0 -2
- package/dist/loaders/index.js +0 -2
- package/dist/middleware.d.ts +0 -2
- package/dist/middleware.js +0 -89
- package/dist/routes/auth/callback.d.ts +0 -3
- package/dist/routes/auth/callback.js +0 -52
- package/dist/routes/auth/constants.d.ts +0 -5
- package/dist/routes/auth/constants.js +0 -5
- package/dist/routes/auth/login.d.ts +0 -3
- package/dist/routes/auth/login.js +0 -26
- package/dist/routes/auth/logout-callback.d.ts +0 -3
- package/dist/routes/auth/logout-callback.js +0 -9
- package/dist/routes/auth/logout.d.ts +0 -3
- package/dist/routes/auth/logout.js +0 -10
- package/dist/routes/auth/runtime.d.ts +0 -5
- package/dist/routes/auth/runtime.js +0 -7
- package/dist/runtime-client.d.ts +0 -3
- package/dist/runtime-client.js +0 -4
- package/dist/runtime.client.d.ts +0 -2
- package/dist/runtime.client.js +0 -4
- package/dist/runtime.d.ts +0 -5
- package/dist/runtime.js +0 -12
- package/dist/runtime.server.d.ts +0 -2
- package/dist/runtime.server.js +0 -8
- package/dist/vite-plugins/sdk-context.d.ts +0 -4
- package/dist/vite-plugins/sdk-context.js +0 -67
package/dist/runtime.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { OAuthStrategy } from "@wix/sdk/auth/oauth2";
|
|
2
|
-
import type { WixClient } from "@wix/sdk";
|
|
3
|
-
import type { SiteSessionAuth } from "@wix/sdk/auth/site-session";
|
|
4
|
-
export declare function getAuth(): ReturnType<typeof OAuthStrategy>;
|
|
5
|
-
export declare function getWixClient(): WixClient<undefined, ReturnType<typeof SiteSessionAuth>>;
|
package/dist/runtime.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { authStrategyAsyncLocalStorage } from "./auth-context.js";
|
|
2
|
-
import { wixContext } from '@wix/sdk-context';
|
|
3
|
-
export function getAuth() {
|
|
4
|
-
const auth = authStrategyAsyncLocalStorage.getStore()?.auth;
|
|
5
|
-
if (!auth) {
|
|
6
|
-
throw new Error("No authentication strategy found in the current context");
|
|
7
|
-
}
|
|
8
|
-
return auth;
|
|
9
|
-
}
|
|
10
|
-
export function getWixClient() {
|
|
11
|
-
return wixContext['client'];
|
|
12
|
-
}
|
package/dist/runtime.server.d.ts
DELETED
package/dist/runtime.server.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { authStrategyAsyncLocalStorage } from "./auth-context.js";
|
|
2
|
-
export function getAuth() {
|
|
3
|
-
const auth = authStrategyAsyncLocalStorage.getStore()?.auth;
|
|
4
|
-
if (!auth) {
|
|
5
|
-
throw new Error("No authentication strategy found in the current context");
|
|
6
|
-
}
|
|
7
|
-
return auth;
|
|
8
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import buildResolver from "esm-resolve";
|
|
2
|
-
import { fileURLToPath } from "node:url";
|
|
3
|
-
import { loadEnv } from "vite";
|
|
4
|
-
export function wixSDKContext(opts) {
|
|
5
|
-
const virtualModuleId = '@wix/sdk-context';
|
|
6
|
-
const resolvedVirtualModuleId = '\0' + virtualModuleId;
|
|
7
|
-
return {
|
|
8
|
-
name: 'vite-plugin-sdk-context',
|
|
9
|
-
enforce: 'pre', // Ensure the plugin runs before Vite processes dependencies
|
|
10
|
-
config(_, { isSsrBuild }) {
|
|
11
|
-
if (isSsrBuild)
|
|
12
|
-
return; // Skip for server-side rendering
|
|
13
|
-
return {
|
|
14
|
-
optimizeDeps: {
|
|
15
|
-
exclude: [virtualModuleId], // Ensure the virtual module is not pre-bundled
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
},
|
|
19
|
-
resolveId(id, _, { ssr }) {
|
|
20
|
-
if (ssr)
|
|
21
|
-
return null; // Skip for server-side rendering
|
|
22
|
-
if (id === virtualModuleId) {
|
|
23
|
-
return resolvedVirtualModuleId;
|
|
24
|
-
}
|
|
25
|
-
return null;
|
|
26
|
-
},
|
|
27
|
-
load(id) {
|
|
28
|
-
if (id === resolvedVirtualModuleId) {
|
|
29
|
-
const aRequire = buildResolver(fileURLToPath(import.meta.url), {
|
|
30
|
-
resolveToAbsolute: true,
|
|
31
|
-
});
|
|
32
|
-
const userLoadedEnv = loadEnv(process.env["NODE_ENV"] ?? "development", process.cwd(), "");
|
|
33
|
-
const wixSDKResolved = aRequire("@wix/sdk/client");
|
|
34
|
-
const wixSDKAuthResolved = aRequire("@wix/sdk/auth/site-session");
|
|
35
|
-
return `import { createClient } from "${wixSDKResolved}";
|
|
36
|
-
import { SiteSessionAuth } from "${wixSDKAuthResolved}";
|
|
37
|
-
|
|
38
|
-
function getCookieAsJson(name) {
|
|
39
|
-
const cookies = document.cookie.split('; ');
|
|
40
|
-
const cookie = cookies.find(row => row.startsWith(\`\${name}=\`));
|
|
41
|
-
|
|
42
|
-
if (!cookie) return null;
|
|
43
|
-
|
|
44
|
-
try {
|
|
45
|
-
const jsonString = decodeURIComponent(cookie.split('=')[1]);
|
|
46
|
-
return JSON.parse(jsonString);
|
|
47
|
-
} catch (error) {
|
|
48
|
-
console.error('Error parsing cookie JSON:', error);
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export const wixContext = {
|
|
54
|
-
client: createClient({
|
|
55
|
-
auth: SiteSessionAuth({
|
|
56
|
-
clientId: ${JSON.stringify(userLoadedEnv["WIX_CLIENT_ID"])},
|
|
57
|
-
tokens: getCookieAsJson(${JSON.stringify(opts.sessionCookieName)})?.tokens,
|
|
58
|
-
}),
|
|
59
|
-
}),
|
|
60
|
-
clientId: ${JSON.stringify(userLoadedEnv["WIX_CLIENT_ID"])},
|
|
61
|
-
};
|
|
62
|
-
`;
|
|
63
|
-
}
|
|
64
|
-
return null;
|
|
65
|
-
},
|
|
66
|
-
};
|
|
67
|
-
}
|