naystack 1.7.39 → 1.7.40

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.
@@ -34,7 +34,6 @@ __export(client_exports, {
34
34
  AuthApply: () => AuthApply,
35
35
  AuthWrapper: () => AuthWrapper,
36
36
  TokenContext: () => TokenContext,
37
- getInstagramAuthorizationURL: () => getInstagramAuthorizationURL,
38
37
  useAuthFetch: () => useAuthFetch,
39
38
  useLogin: () => useLogin,
40
39
  useLogout: () => useLogout,
@@ -200,17 +199,11 @@ function useLogout() {
200
199
  [setToken]
201
200
  );
202
201
  }
203
-
204
- // src/auth/instagram/client.ts
205
- var getInstagramAuthorizationURL = (token) => `https://www.instagram.com/oauth/authorize?client_id=${getEnv(
206
- "NEXT_PUBLIC_INSTAGRAM_CLIENT_ID" /* NEXT_PUBLIC_INSTAGRAM_CLIENT_ID */
207
- )}&response_type=code&enable_fb_login=0&force_authentication=1&scope=instagram_business_basic&state=${token}&redirect_uri=${getEnv("NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT" /* NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT */)}`;
208
202
  // Annotate the CommonJS export names for ESM import in node:
209
203
  0 && (module.exports = {
210
204
  AuthApply,
211
205
  AuthWrapper,
212
206
  TokenContext,
213
- getInstagramAuthorizationURL,
214
207
  useAuthFetch,
215
208
  useLogin,
216
209
  useLogout,
@@ -1,3 +1,2 @@
1
1
  export { AuthApply, AuthWrapper, AuthWrapperProps, TokenContext, useAuthFetch, useLogin, useLogout, useSetToken, useSignUp, useToken } from './email/client.mjs';
2
- export { getInstagramAuthorizationURL } from './instagram/client.mjs';
3
2
  import 'react';
@@ -1,3 +1,2 @@
1
1
  export { AuthApply, AuthWrapper, AuthWrapperProps, TokenContext, useAuthFetch, useLogin, useLogout, useSetToken, useSignUp, useToken } from './email/client.js';
2
- export { getInstagramAuthorizationURL } from './instagram/client.js';
3
2
  import 'react';
@@ -162,16 +162,10 @@ function useLogout() {
162
162
  [setToken]
163
163
  );
164
164
  }
165
-
166
- // src/auth/instagram/client.ts
167
- var getInstagramAuthorizationURL = (token) => `https://www.instagram.com/oauth/authorize?client_id=${getEnv(
168
- "NEXT_PUBLIC_INSTAGRAM_CLIENT_ID" /* NEXT_PUBLIC_INSTAGRAM_CLIENT_ID */
169
- )}&response_type=code&enable_fb_login=0&force_authentication=1&scope=instagram_business_basic&state=${token}&redirect_uri=${getEnv("NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT" /* NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT */)}`;
170
165
  export {
171
166
  AuthApply,
172
167
  AuthWrapper,
173
168
  TokenContext,
174
- getInstagramAuthorizationURL,
175
169
  useAuthFetch,
176
170
  useLogin,
177
171
  useLogout,
@@ -34,6 +34,7 @@ __export(auth_exports, {
34
34
  AuthWrapper: () => AuthWrapper,
35
35
  checkAuthStatus: () => checkAuthStatus,
36
36
  getContext: () => getContext,
37
+ getInstagramAuthorizationURL: () => getInstagramAuthorizationURL,
37
38
  getRefreshToken: () => getRefreshToken,
38
39
  getRefreshedInstagramAccessToken: () => getRefreshedInstagramAccessToken,
39
40
  getTokenizedResponse: () => getTokenizedResponse,
@@ -610,6 +611,9 @@ async function getLongLivedToken(code, redirectURL, clientId, clientSecret) {
610
611
  }
611
612
  }
612
613
  }
614
+ var getInstagramAuthorizationURL = (token) => `https://www.instagram.com/oauth/authorize?client_id=${getEnv(
615
+ "NEXT_PUBLIC_INSTAGRAM_CLIENT_ID" /* NEXT_PUBLIC_INSTAGRAM_CLIENT_ID */
616
+ )}&response_type=code&enable_fb_login=0&force_authentication=1&scope=instagram_business_basic&state=${token}&redirect_uri=${getEnv("NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT" /* NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT */)}`;
613
617
 
614
618
  // src/socials/instagram/utils.ts
615
619
  function getInstagramURL(token, path, params) {
@@ -689,6 +693,7 @@ async function getRefreshToken() {
689
693
  AuthWrapper,
690
694
  checkAuthStatus,
691
695
  getContext,
696
+ getInstagramAuthorizationURL,
692
697
  getRefreshToken,
693
698
  getRefreshedInstagramAccessToken,
694
699
  getTokenizedResponse,
@@ -5,7 +5,7 @@ export { getRefreshToken } from './utils/token.mjs';
5
5
  export { AuthFetch, AuthWrapper } from './email/next.mjs';
6
6
  export { checkAuthStatus, getTokenizedResponse } from './email/token.mjs';
7
7
  export { getContext } from './email/utils.mjs';
8
- export { getRefreshedInstagramAccessToken } from './instagram/utils.mjs';
8
+ export { getInstagramAuthorizationURL, getRefreshedInstagramAccessToken } from './instagram/utils.mjs';
9
9
  import 'next/server';
10
10
  import './email/types.mjs';
11
11
  import './types.mjs';
@@ -5,7 +5,7 @@ export { getRefreshToken } from './utils/token.js';
5
5
  export { AuthFetch, AuthWrapper } from './email/next.js';
6
6
  export { checkAuthStatus, getTokenizedResponse } from './email/token.js';
7
7
  export { getContext } from './email/utils.js';
8
- export { getRefreshedInstagramAccessToken } from './instagram/utils.js';
8
+ export { getInstagramAuthorizationURL, getRefreshedInstagramAccessToken } from './instagram/utils.js';
9
9
  import 'next/server';
10
10
  import './email/types.js';
11
11
  import './types.js';
@@ -569,6 +569,9 @@ async function getLongLivedToken(code, redirectURL, clientId, clientSecret) {
569
569
  }
570
570
  }
571
571
  }
572
+ var getInstagramAuthorizationURL = (token) => `https://www.instagram.com/oauth/authorize?client_id=${getEnv(
573
+ "NEXT_PUBLIC_INSTAGRAM_CLIENT_ID" /* NEXT_PUBLIC_INSTAGRAM_CLIENT_ID */
574
+ )}&response_type=code&enable_fb_login=0&force_authentication=1&scope=instagram_business_basic&state=${token}&redirect_uri=${getEnv("NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT" /* NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT */)}`;
572
575
 
573
576
  // src/socials/instagram/utils.ts
574
577
  function getInstagramURL(token, path, params) {
@@ -647,6 +650,7 @@ export {
647
650
  AuthWrapper,
648
651
  checkAuthStatus,
649
652
  getContext,
653
+ getInstagramAuthorizationURL,
650
654
  getRefreshToken,
651
655
  getRefreshedInstagramAccessToken,
652
656
  getTokenizedResponse,
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/auth/instagram/index.ts
21
21
  var instagram_exports = {};
22
22
  __export(instagram_exports, {
23
+ getInstagramAuthorizationURL: () => getInstagramAuthorizationURL,
23
24
  getRefreshedInstagramAccessToken: () => getRefreshedInstagramAccessToken,
24
25
  setupInstagramAuth: () => setupInstagramAuth
25
26
  });
@@ -135,6 +136,9 @@ async function getLongLivedToken(code, redirectURL, clientId, clientSecret) {
135
136
  }
136
137
  }
137
138
  }
139
+ var getInstagramAuthorizationURL = (token) => `https://www.instagram.com/oauth/authorize?client_id=${getEnv(
140
+ "NEXT_PUBLIC_INSTAGRAM_CLIENT_ID" /* NEXT_PUBLIC_INSTAGRAM_CLIENT_ID */
141
+ )}&response_type=code&enable_fb_login=0&force_authentication=1&scope=instagram_business_basic&state=${token}&redirect_uri=${getEnv("NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT" /* NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT */)}`;
138
142
 
139
143
  // src/socials/instagram/utils.ts
140
144
  function getInstagramURL(token, path, params) {
@@ -203,6 +207,7 @@ function setupInstagramAuth(props) {
203
207
  }
204
208
  // Annotate the CommonJS export names for ESM import in node:
205
209
  0 && (module.exports = {
210
+ getInstagramAuthorizationURL,
206
211
  getRefreshedInstagramAccessToken,
207
212
  setupInstagramAuth
208
213
  });
@@ -1,5 +1,5 @@
1
1
  import * as next_server from 'next/server';
2
- export { getRefreshedInstagramAccessToken } from './utils.mjs';
2
+ export { getInstagramAuthorizationURL, getRefreshedInstagramAccessToken } from './utils.mjs';
3
3
  import { InstagramUser } from '../../socials/instagram/types.mjs';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import * as next_server from 'next/server';
2
- export { getRefreshedInstagramAccessToken } from './utils.js';
2
+ export { getInstagramAuthorizationURL, getRefreshedInstagramAccessToken } from './utils.js';
3
3
  import { InstagramUser } from '../../socials/instagram/types.js';
4
4
 
5
5
  /**
@@ -108,6 +108,9 @@ async function getLongLivedToken(code, redirectURL, clientId, clientSecret) {
108
108
  }
109
109
  }
110
110
  }
111
+ var getInstagramAuthorizationURL = (token) => `https://www.instagram.com/oauth/authorize?client_id=${getEnv(
112
+ "NEXT_PUBLIC_INSTAGRAM_CLIENT_ID" /* NEXT_PUBLIC_INSTAGRAM_CLIENT_ID */
113
+ )}&response_type=code&enable_fb_login=0&force_authentication=1&scope=instagram_business_basic&state=${token}&redirect_uri=${getEnv("NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT" /* NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT */)}`;
111
114
 
112
115
  // src/socials/instagram/utils.ts
113
116
  function getInstagramURL(token, path, params) {
@@ -175,6 +178,7 @@ function setupInstagramAuth(props) {
175
178
  };
176
179
  }
177
180
  export {
181
+ getInstagramAuthorizationURL,
178
182
  getRefreshedInstagramAccessToken,
179
183
  setupInstagramAuth
180
184
  };
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/auth/instagram/utils.ts
21
21
  var utils_exports = {};
22
22
  __export(utils_exports, {
23
+ getInstagramAuthorizationURL: () => getInstagramAuthorizationURL,
23
24
  getLongLivedToken: () => getLongLivedToken,
24
25
  getRefreshedInstagramAccessToken: () => getRefreshedInstagramAccessToken
25
26
  });
@@ -111,8 +112,12 @@ async function getLongLivedToken(code, redirectURL, clientId, clientSecret) {
111
112
  }
112
113
  }
113
114
  }
115
+ var getInstagramAuthorizationURL = (token) => `https://www.instagram.com/oauth/authorize?client_id=${getEnv(
116
+ "NEXT_PUBLIC_INSTAGRAM_CLIENT_ID" /* NEXT_PUBLIC_INSTAGRAM_CLIENT_ID */
117
+ )}&response_type=code&enable_fb_login=0&force_authentication=1&scope=instagram_business_basic&state=${token}&redirect_uri=${getEnv("NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT" /* NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT */)}`;
114
118
  // Annotate the CommonJS export names for ESM import in node:
115
119
  0 && (module.exports = {
120
+ getInstagramAuthorizationURL,
116
121
  getLongLivedToken,
117
122
  getRefreshedInstagramAccessToken
118
123
  });
@@ -16,5 +16,27 @@ declare function getLongLivedToken(code: string, redirectURL: string, clientId:
16
16
  accessToken: string;
17
17
  userId: string;
18
18
  } | undefined>;
19
+ /**
20
+ * Builds the Instagram OAuth authorization URL for the given state token.
21
+ * The state token is passed back by Instagram after authorization and is used to link
22
+ * the Instagram account to the logged-in user.
23
+ *
24
+ * Reads `NEXT_PUBLIC_INSTAGRAM_CLIENT_ID` and `NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT` from the environment.
25
+ *
26
+ * @param token - The state token to embed in the authorization URL (typically the user's session or access token).
27
+ * @returns The full Instagram OAuth authorization URL.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * import { getInstagramAuthorizationURL } from "naystack/auth/instagram/client";
32
+ *
33
+ * const url = getInstagramAuthorizationURL(userAccessToken);
34
+ * // => "https://www.instagram.com/oauth/authorize?client_id=...&state=...&redirect_uri=..."
35
+ * window.location.href = url;
36
+ * ```
37
+ *
38
+ * @category Auth
39
+ */
40
+ declare const getInstagramAuthorizationURL: (token: string) => string;
19
41
 
20
- export { getLongLivedToken, getRefreshedInstagramAccessToken };
42
+ export { getInstagramAuthorizationURL, getLongLivedToken, getRefreshedInstagramAccessToken };
@@ -16,5 +16,27 @@ declare function getLongLivedToken(code: string, redirectURL: string, clientId:
16
16
  accessToken: string;
17
17
  userId: string;
18
18
  } | undefined>;
19
+ /**
20
+ * Builds the Instagram OAuth authorization URL for the given state token.
21
+ * The state token is passed back by Instagram after authorization and is used to link
22
+ * the Instagram account to the logged-in user.
23
+ *
24
+ * Reads `NEXT_PUBLIC_INSTAGRAM_CLIENT_ID` and `NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT` from the environment.
25
+ *
26
+ * @param token - The state token to embed in the authorization URL (typically the user's session or access token).
27
+ * @returns The full Instagram OAuth authorization URL.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * import { getInstagramAuthorizationURL } from "naystack/auth/instagram/client";
32
+ *
33
+ * const url = getInstagramAuthorizationURL(userAccessToken);
34
+ * // => "https://www.instagram.com/oauth/authorize?client_id=...&state=...&redirect_uri=..."
35
+ * window.location.href = url;
36
+ * ```
37
+ *
38
+ * @category Auth
39
+ */
40
+ declare const getInstagramAuthorizationURL: (token: string) => string;
19
41
 
20
- export { getLongLivedToken, getRefreshedInstagramAccessToken };
42
+ export { getInstagramAuthorizationURL, getLongLivedToken, getRefreshedInstagramAccessToken };
@@ -84,7 +84,11 @@ async function getLongLivedToken(code, redirectURL, clientId, clientSecret) {
84
84
  }
85
85
  }
86
86
  }
87
+ var getInstagramAuthorizationURL = (token) => `https://www.instagram.com/oauth/authorize?client_id=${getEnv(
88
+ "NEXT_PUBLIC_INSTAGRAM_CLIENT_ID" /* NEXT_PUBLIC_INSTAGRAM_CLIENT_ID */
89
+ )}&response_type=code&enable_fb_login=0&force_authentication=1&scope=instagram_business_basic&state=${token}&redirect_uri=${getEnv("NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT" /* NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT */)}`;
87
90
  export {
91
+ getInstagramAuthorizationURL,
88
92
  getLongLivedToken,
89
93
  getRefreshedInstagramAccessToken
90
94
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "naystack",
3
- "version": "1.7.39",
3
+ "version": "1.7.40",
4
4
  "description": "A stack built with Next + GraphQL + S3 + Auth",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -1,84 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/auth/instagram/client.ts
21
- var client_exports = {};
22
- __export(client_exports, {
23
- getInstagramAuthorizationURL: () => getInstagramAuthorizationURL
24
- });
25
- module.exports = __toCommonJS(client_exports);
26
-
27
- // src/env.ts
28
- var EXTRA_ENV = globalThis.__NAYSTACK_ENV__ || (globalThis.__NAYSTACK_ENV__ = {});
29
- var getEnvValue = (key) => {
30
- switch (key) {
31
- case "NEXT_PUBLIC_GRAPHQL_ENDPOINT" /* NEXT_PUBLIC_GRAPHQL_ENDPOINT */:
32
- return process.env.NEXT_PUBLIC_GRAPHQL_ENDPOINT || EXTRA_ENV.GRAPHQL_ENDPOINT;
33
- case "NEXT_PUBLIC_EMAIL_AUTH_ENDPOINT" /* NEXT_PUBLIC_EMAIL_AUTH_ENDPOINT */:
34
- return process.env.NEXT_PUBLIC_EMAIL_AUTH_ENDPOINT || EXTRA_ENV.EMAIL_AUTH_ENDPOINT;
35
- case "NEXT_PUBLIC_GOOGLE_AUTH_ENDPOINT" /* NEXT_PUBLIC_GOOGLE_AUTH_ENDPOINT */:
36
- return process.env.NEXT_PUBLIC_GOOGLE_AUTH_ENDPOINT || EXTRA_ENV.GOOGLE_AUTH_ENDPOINT;
37
- case "NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT" /* NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT */:
38
- return process.env.NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT || EXTRA_ENV.INSTAGRAM_AUTH_ENDPOINT;
39
- case "NEXT_PUBLIC_FILE_ENDPOINT" /* NEXT_PUBLIC_FILE_ENDPOINT */:
40
- return process.env.NEXT_PUBLIC_FILE_ENDPOINT || EXTRA_ENV.FILE_ENDPOINT;
41
- case "NEXT_PUBLIC_BASE_URL" /* NEXT_PUBLIC_BASE_URL */:
42
- return process.env.NEXT_PUBLIC_BASE_URL || EXTRA_ENV.BASE_URL;
43
- case "REFRESH_KEY" /* REFRESH_KEY */:
44
- return process.env.REFRESH_KEY;
45
- case "SIGNING_KEY" /* SIGNING_KEY */:
46
- return process.env.SIGNING_KEY;
47
- case "INSTAGRAM_CLIENT_SECRET" /* INSTAGRAM_CLIENT_SECRET */:
48
- return process.env.INSTAGRAM_CLIENT_SECRET;
49
- case "NEXT_PUBLIC_INSTAGRAM_CLIENT_ID" /* NEXT_PUBLIC_INSTAGRAM_CLIENT_ID */:
50
- return process.env.NEXT_PUBLIC_INSTAGRAM_CLIENT_ID;
51
- case "GOOGLE_CLIENT_SECRET" /* GOOGLE_CLIENT_SECRET */:
52
- return process.env.GOOGLE_CLIENT_SECRET;
53
- case "GOOGLE_CLIENT_ID" /* GOOGLE_CLIENT_ID */:
54
- return process.env.GOOGLE_CLIENT_ID;
55
- case "TURNSTILE_KEY" /* TURNSTILE_KEY */:
56
- return process.env.TURNSTILE_KEY;
57
- case "S3_ACCESS_KEY_ID" /* S3_ACCESS_KEY_ID */:
58
- return process.env.S3_ACCESS_KEY_ID;
59
- case "S3_ACCESS_KEY_SECRET" /* S3_ACCESS_KEY_SECRET */:
60
- return process.env.S3_ACCESS_KEY_SECRET;
61
- case "S3_REGION" /* S3_REGION */:
62
- return process.env.S3_REGION;
63
- case "S3_BUCKET" /* S3_BUCKET */:
64
- return process.env.S3_BUCKET;
65
- case "NODE_ENV" /* NODE_ENV */:
66
- return process.env.NODE_ENV;
67
- default:
68
- return process.env[key];
69
- }
70
- };
71
- function getEnv(key, skipCheck) {
72
- const value = getEnvValue(key);
73
- if (!skipCheck && !value) throw new Error(`${key} is not defined`);
74
- return value;
75
- }
76
-
77
- // src/auth/instagram/client.ts
78
- var getInstagramAuthorizationURL = (token) => `https://www.instagram.com/oauth/authorize?client_id=${getEnv(
79
- "NEXT_PUBLIC_INSTAGRAM_CLIENT_ID" /* NEXT_PUBLIC_INSTAGRAM_CLIENT_ID */
80
- )}&response_type=code&enable_fb_login=0&force_authentication=1&scope=instagram_business_basic&state=${token}&redirect_uri=${getEnv("NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT" /* NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT */)}`;
81
- // Annotate the CommonJS export names for ESM import in node:
82
- 0 && (module.exports = {
83
- getInstagramAuthorizationURL
84
- });
@@ -1,24 +0,0 @@
1
- /**
2
- * Builds the Instagram OAuth authorization URL for the given state token.
3
- * The state token is passed back by Instagram after authorization and is used to link
4
- * the Instagram account to the logged-in user.
5
- *
6
- * Reads `NEXT_PUBLIC_INSTAGRAM_CLIENT_ID` and `NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT` from the environment.
7
- *
8
- * @param token - The state token to embed in the authorization URL (typically the user's session or access token).
9
- * @returns The full Instagram OAuth authorization URL.
10
- *
11
- * @example
12
- * ```ts
13
- * import { getInstagramAuthorizationURL } from "naystack/auth/instagram/client";
14
- *
15
- * const url = getInstagramAuthorizationURL(userAccessToken);
16
- * // => "https://www.instagram.com/oauth/authorize?client_id=...&state=...&redirect_uri=..."
17
- * window.location.href = url;
18
- * ```
19
- *
20
- * @category Auth
21
- */
22
- declare const getInstagramAuthorizationURL: (token: string) => string;
23
-
24
- export { getInstagramAuthorizationURL };
@@ -1,24 +0,0 @@
1
- /**
2
- * Builds the Instagram OAuth authorization URL for the given state token.
3
- * The state token is passed back by Instagram after authorization and is used to link
4
- * the Instagram account to the logged-in user.
5
- *
6
- * Reads `NEXT_PUBLIC_INSTAGRAM_CLIENT_ID` and `NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT` from the environment.
7
- *
8
- * @param token - The state token to embed in the authorization URL (typically the user's session or access token).
9
- * @returns The full Instagram OAuth authorization URL.
10
- *
11
- * @example
12
- * ```ts
13
- * import { getInstagramAuthorizationURL } from "naystack/auth/instagram/client";
14
- *
15
- * const url = getInstagramAuthorizationURL(userAccessToken);
16
- * // => "https://www.instagram.com/oauth/authorize?client_id=...&state=...&redirect_uri=..."
17
- * window.location.href = url;
18
- * ```
19
- *
20
- * @category Auth
21
- */
22
- declare const getInstagramAuthorizationURL: (token: string) => string;
23
-
24
- export { getInstagramAuthorizationURL };
@@ -1,57 +0,0 @@
1
- // src/env.ts
2
- var EXTRA_ENV = globalThis.__NAYSTACK_ENV__ || (globalThis.__NAYSTACK_ENV__ = {});
3
- var getEnvValue = (key) => {
4
- switch (key) {
5
- case "NEXT_PUBLIC_GRAPHQL_ENDPOINT" /* NEXT_PUBLIC_GRAPHQL_ENDPOINT */:
6
- return process.env.NEXT_PUBLIC_GRAPHQL_ENDPOINT || EXTRA_ENV.GRAPHQL_ENDPOINT;
7
- case "NEXT_PUBLIC_EMAIL_AUTH_ENDPOINT" /* NEXT_PUBLIC_EMAIL_AUTH_ENDPOINT */:
8
- return process.env.NEXT_PUBLIC_EMAIL_AUTH_ENDPOINT || EXTRA_ENV.EMAIL_AUTH_ENDPOINT;
9
- case "NEXT_PUBLIC_GOOGLE_AUTH_ENDPOINT" /* NEXT_PUBLIC_GOOGLE_AUTH_ENDPOINT */:
10
- return process.env.NEXT_PUBLIC_GOOGLE_AUTH_ENDPOINT || EXTRA_ENV.GOOGLE_AUTH_ENDPOINT;
11
- case "NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT" /* NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT */:
12
- return process.env.NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT || EXTRA_ENV.INSTAGRAM_AUTH_ENDPOINT;
13
- case "NEXT_PUBLIC_FILE_ENDPOINT" /* NEXT_PUBLIC_FILE_ENDPOINT */:
14
- return process.env.NEXT_PUBLIC_FILE_ENDPOINT || EXTRA_ENV.FILE_ENDPOINT;
15
- case "NEXT_PUBLIC_BASE_URL" /* NEXT_PUBLIC_BASE_URL */:
16
- return process.env.NEXT_PUBLIC_BASE_URL || EXTRA_ENV.BASE_URL;
17
- case "REFRESH_KEY" /* REFRESH_KEY */:
18
- return process.env.REFRESH_KEY;
19
- case "SIGNING_KEY" /* SIGNING_KEY */:
20
- return process.env.SIGNING_KEY;
21
- case "INSTAGRAM_CLIENT_SECRET" /* INSTAGRAM_CLIENT_SECRET */:
22
- return process.env.INSTAGRAM_CLIENT_SECRET;
23
- case "NEXT_PUBLIC_INSTAGRAM_CLIENT_ID" /* NEXT_PUBLIC_INSTAGRAM_CLIENT_ID */:
24
- return process.env.NEXT_PUBLIC_INSTAGRAM_CLIENT_ID;
25
- case "GOOGLE_CLIENT_SECRET" /* GOOGLE_CLIENT_SECRET */:
26
- return process.env.GOOGLE_CLIENT_SECRET;
27
- case "GOOGLE_CLIENT_ID" /* GOOGLE_CLIENT_ID */:
28
- return process.env.GOOGLE_CLIENT_ID;
29
- case "TURNSTILE_KEY" /* TURNSTILE_KEY */:
30
- return process.env.TURNSTILE_KEY;
31
- case "S3_ACCESS_KEY_ID" /* S3_ACCESS_KEY_ID */:
32
- return process.env.S3_ACCESS_KEY_ID;
33
- case "S3_ACCESS_KEY_SECRET" /* S3_ACCESS_KEY_SECRET */:
34
- return process.env.S3_ACCESS_KEY_SECRET;
35
- case "S3_REGION" /* S3_REGION */:
36
- return process.env.S3_REGION;
37
- case "S3_BUCKET" /* S3_BUCKET */:
38
- return process.env.S3_BUCKET;
39
- case "NODE_ENV" /* NODE_ENV */:
40
- return process.env.NODE_ENV;
41
- default:
42
- return process.env[key];
43
- }
44
- };
45
- function getEnv(key, skipCheck) {
46
- const value = getEnvValue(key);
47
- if (!skipCheck && !value) throw new Error(`${key} is not defined`);
48
- return value;
49
- }
50
-
51
- // src/auth/instagram/client.ts
52
- var getInstagramAuthorizationURL = (token) => `https://www.instagram.com/oauth/authorize?client_id=${getEnv(
53
- "NEXT_PUBLIC_INSTAGRAM_CLIENT_ID" /* NEXT_PUBLIC_INSTAGRAM_CLIENT_ID */
54
- )}&response_type=code&enable_fb_login=0&force_authentication=1&scope=instagram_business_basic&state=${token}&redirect_uri=${getEnv("NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT" /* NEXT_PUBLIC_INSTAGRAM_AUTH_ENDPOINT */)}`;
55
- export {
56
- getInstagramAuthorizationURL
57
- };