@shopsbuilder/auth-sdk 1.1.0

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.
Files changed (84) hide show
  1. package/README.md +469 -0
  2. package/dist/README.md +469 -0
  3. package/dist/SaleorAccessTokenStorageHandler.d.mts +13 -0
  4. package/dist/SaleorAccessTokenStorageHandler.d.ts +13 -0
  5. package/dist/SaleorAccessTokenStorageHandler.js +50 -0
  6. package/dist/SaleorAccessTokenStorageHandler.mjs +8 -0
  7. package/dist/SaleorAuthClient.d.mts +52 -0
  8. package/dist/SaleorAuthClient.d.ts +52 -0
  9. package/dist/SaleorAuthClient.js +464 -0
  10. package/dist/SaleorAuthClient.mjs +13 -0
  11. package/dist/SaleorExternalAuth.d.mts +29 -0
  12. package/dist/SaleorExternalAuth.d.ts +29 -0
  13. package/dist/SaleorExternalAuth.js +198 -0
  14. package/dist/SaleorExternalAuth.mjs +12 -0
  15. package/dist/SaleorRefreshTokenStorageHandler.d.mts +24 -0
  16. package/dist/SaleorRefreshTokenStorageHandler.d.ts +24 -0
  17. package/dist/SaleorRefreshTokenStorageHandler.js +83 -0
  18. package/dist/SaleorRefreshTokenStorageHandler.mjs +12 -0
  19. package/dist/chunk-263DHBMK.mjs +56 -0
  20. package/dist/chunk-74GMXOK4.mjs +13 -0
  21. package/dist/chunk-77CRMKFX.mjs +12 -0
  22. package/dist/chunk-7JTFMRQS.mjs +105 -0
  23. package/dist/chunk-BRRF6LN3.mjs +224 -0
  24. package/dist/chunk-BZFBMGPG.mjs +25 -0
  25. package/dist/chunk-K5MTKW5C.mjs +16 -0
  26. package/dist/chunk-KLIEZ4V4.mjs +10 -0
  27. package/dist/chunk-NAQNA6DI.mjs +20 -0
  28. package/dist/chunk-Q3UFWDCC.mjs +38 -0
  29. package/dist/chunk-T35JF4IS.mjs +59 -0
  30. package/dist/chunk-UDLCOX6B.mjs +49 -0
  31. package/dist/chunk-WJVMUY3P.mjs +33 -0
  32. package/dist/graphql.d.mts +11 -0
  33. package/dist/graphql.d.ts +11 -0
  34. package/dist/graphql.js +40 -0
  35. package/dist/graphql.mjs +6 -0
  36. package/dist/index.d.mts +5 -0
  37. package/dist/index.d.ts +5 -0
  38. package/dist/index.js +524 -0
  39. package/dist/index.mjs +23 -0
  40. package/dist/mutations.d.mts +12 -0
  41. package/dist/mutations.d.ts +12 -0
  42. package/dist/mutations.js +145 -0
  43. package/dist/mutations.mjs +17 -0
  44. package/dist/next/handler.d.mts +9 -0
  45. package/dist/next/handler.d.ts +9 -0
  46. package/dist/next/handler.js +36 -0
  47. package/dist/next/handler.mjs +11 -0
  48. package/dist/next/index.d.mts +6 -0
  49. package/dist/next/index.d.ts +6 -0
  50. package/dist/next/index.js +38 -0
  51. package/dist/next/index.mjs +11 -0
  52. package/dist/next/server.d.mts +20 -0
  53. package/dist/next/server.d.ts +20 -0
  54. package/dist/next/server.js +79 -0
  55. package/dist/next/server.mjs +53 -0
  56. package/dist/react/SaleorAuthProvider.d.mts +10 -0
  57. package/dist/react/SaleorAuthProvider.d.ts +10 -0
  58. package/dist/react/SaleorAuthProvider.js +50 -0
  59. package/dist/react/SaleorAuthProvider.mjs +13 -0
  60. package/dist/react/context.d.mts +9 -0
  61. package/dist/react/context.d.ts +9 -0
  62. package/dist/react/context.js +46 -0
  63. package/dist/react/context.mjs +16 -0
  64. package/dist/react/index.d.mts +8 -0
  65. package/dist/react/index.d.ts +8 -0
  66. package/dist/react/index.js +291 -0
  67. package/dist/react/index.mjs +30 -0
  68. package/dist/react/useAuthChange.d.mts +8 -0
  69. package/dist/react/useAuthChange.d.ts +8 -0
  70. package/dist/react/useAuthChange.js +58 -0
  71. package/dist/react/useAuthChange.mjs +7 -0
  72. package/dist/react/useSaleorExternalAuth.d.mts +22 -0
  73. package/dist/react/useSaleorExternalAuth.d.ts +22 -0
  74. package/dist/react/useSaleorExternalAuth.js +227 -0
  75. package/dist/react/useSaleorExternalAuth.mjs +11 -0
  76. package/dist/types.d.mts +82 -0
  77. package/dist/types.d.ts +82 -0
  78. package/dist/types.js +34 -0
  79. package/dist/types.mjs +6 -0
  80. package/dist/utils.d.mts +28 -0
  81. package/dist/utils.d.ts +28 -0
  82. package/dist/utils.js +77 -0
  83. package/dist/utils.mjs +15 -0
  84. package/package.json +129 -0
@@ -0,0 +1,145 @@
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/mutations.ts
21
+ var mutations_exports = {};
22
+ __export(mutations_exports, {
23
+ ExternalAuthenticationURL: () => ExternalAuthenticationURL,
24
+ ExternalObtainAccessTokens: () => ExternalObtainAccessTokens,
25
+ PASSWORD_RESET: () => PASSWORD_RESET,
26
+ TOKEN_CREATE: () => TOKEN_CREATE,
27
+ TOKEN_REFRESH: () => TOKEN_REFRESH,
28
+ accountErrorFragment: () => accountErrorFragment
29
+ });
30
+ module.exports = __toCommonJS(mutations_exports);
31
+
32
+ // src/graphql.ts
33
+ var TypedDocumentString = class extends String {
34
+ constructor(value, __meta__) {
35
+ super(value);
36
+ this.value = value;
37
+ this.__meta__ = __meta__;
38
+ }
39
+ __apiType;
40
+ toString() {
41
+ return this.value;
42
+ }
43
+ };
44
+
45
+ // src/mutations.ts
46
+ var accountErrorFragment = (
47
+ /* graphql */
48
+ `
49
+ fragment AccountErrorFragment on AccountError {
50
+ code
51
+ field
52
+ message
53
+ }
54
+ `
55
+ );
56
+ var TOKEN_REFRESH = new TypedDocumentString(
57
+ /* graphql */
58
+ `
59
+ ${accountErrorFragment}
60
+ mutation refreshToken($refreshToken: String!) {
61
+ tokenRefresh(refreshToken: $refreshToken) {
62
+ token
63
+ errors {
64
+ ...AccountErrorFragment
65
+ }
66
+ }
67
+ }
68
+ `
69
+ );
70
+ var TOKEN_CREATE = new TypedDocumentString(
71
+ /* graphql */
72
+ `
73
+ mutation tokenCreate($email: String!, $password: String!) {
74
+ tokenCreate(email: $email, password: $password) {
75
+ token
76
+ refreshToken
77
+ errors {
78
+ message
79
+ field
80
+ code
81
+ }
82
+ }
83
+ }
84
+ `
85
+ );
86
+ var PASSWORD_RESET = new TypedDocumentString(
87
+ /* graphql */
88
+ `
89
+ mutation passwordReset($email: String!, $password: String!, $token: String!) {
90
+ setPassword(email: $email, password: $password, token: $token) {
91
+ token
92
+ refreshToken
93
+ errors {
94
+ message
95
+ field
96
+ code
97
+ }
98
+ }
99
+ }
100
+ `
101
+ );
102
+ var ExternalAuthenticationURL = new TypedDocumentString(
103
+ /* graphql */
104
+ `
105
+ mutation externalAuthenticationUrl($pluginId: String!, $input: JSONString!) {
106
+ externalAuthenticationUrl(pluginId: $pluginId, input: $input) {
107
+ authenticationData
108
+ errors {
109
+ code
110
+ field
111
+ message
112
+ }
113
+ }
114
+ }
115
+ `
116
+ );
117
+ var ExternalObtainAccessTokens = new TypedDocumentString(
118
+ /* graphql */
119
+ `
120
+ mutation AuthObtainAccessToken($pluginId: String!, $input: JSONString!) {
121
+ externalObtainAccessTokens(pluginId: $pluginId, input: $input) {
122
+ token
123
+ refreshToken
124
+ user {
125
+ id
126
+ email
127
+ }
128
+ errors {
129
+ field
130
+ code
131
+ message
132
+ }
133
+ }
134
+ }
135
+ `
136
+ );
137
+ // Annotate the CommonJS export names for ESM import in node:
138
+ 0 && (module.exports = {
139
+ ExternalAuthenticationURL,
140
+ ExternalObtainAccessTokens,
141
+ PASSWORD_RESET,
142
+ TOKEN_CREATE,
143
+ TOKEN_REFRESH,
144
+ accountErrorFragment
145
+ });
@@ -0,0 +1,17 @@
1
+ import {
2
+ ExternalAuthenticationURL,
3
+ ExternalObtainAccessTokens,
4
+ PASSWORD_RESET,
5
+ TOKEN_CREATE,
6
+ TOKEN_REFRESH,
7
+ accountErrorFragment
8
+ } from "./chunk-7JTFMRQS.mjs";
9
+ import "./chunk-K5MTKW5C.mjs";
10
+ export {
11
+ ExternalAuthenticationURL,
12
+ ExternalObtainAccessTokens,
13
+ PASSWORD_RESET,
14
+ TOKEN_CREATE,
15
+ TOKEN_REFRESH,
16
+ accountErrorFragment
17
+ };
@@ -0,0 +1,9 @@
1
+ import { NextApiRequest, NextApiResponse } from 'next';
2
+ import { SaleorExternalAuth } from '../SaleorExternalAuth.mjs';
3
+ import '../types.mjs';
4
+ import '../graphql.mjs';
5
+ import '@graphql-typed-document-node/core';
6
+
7
+ declare const createSaleorExternalAuthHandler: (auth: SaleorExternalAuth) => (req: NextApiRequest, res: NextApiResponse) => Promise<void>;
8
+
9
+ export { createSaleorExternalAuthHandler };
@@ -0,0 +1,9 @@
1
+ import { NextApiRequest, NextApiResponse } from 'next';
2
+ import { SaleorExternalAuth } from '../SaleorExternalAuth.js';
3
+ import '../types.js';
4
+ import '../graphql.js';
5
+ import '@graphql-typed-document-node/core';
6
+
7
+ declare const createSaleorExternalAuthHandler: (auth: SaleorExternalAuth) => (req: NextApiRequest, res: NextApiResponse) => Promise<void>;
8
+
9
+ export { createSaleorExternalAuthHandler };
@@ -0,0 +1,36 @@
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/next/handler.ts
21
+ var handler_exports = {};
22
+ __export(handler_exports, {
23
+ createSaleorExternalAuthHandler: () => createSaleorExternalAuthHandler
24
+ });
25
+ module.exports = __toCommonJS(handler_exports);
26
+ var import_cookie = require("cookie");
27
+ var createSaleorExternalAuthHandler = (auth) => async (req, res) => {
28
+ const { state, code } = req.query;
29
+ const { token } = await auth.obtainAccessToken({ state, code });
30
+ res.setHeader("Set-Cookie", (0, import_cookie.serialize)("token", token, { path: "/" }));
31
+ res.redirect("/");
32
+ };
33
+ // Annotate the CommonJS export names for ESM import in node:
34
+ 0 && (module.exports = {
35
+ createSaleorExternalAuthHandler
36
+ });
@@ -0,0 +1,11 @@
1
+ import {
2
+ createSaleorExternalAuthHandler
3
+ } from "../chunk-77CRMKFX.mjs";
4
+ import "../chunk-T35JF4IS.mjs";
5
+ import "../chunk-KLIEZ4V4.mjs";
6
+ import "../chunk-UDLCOX6B.mjs";
7
+ import "../chunk-7JTFMRQS.mjs";
8
+ import "../chunk-K5MTKW5C.mjs";
9
+ export {
10
+ createSaleorExternalAuthHandler
11
+ };
@@ -0,0 +1,6 @@
1
+ export { createSaleorExternalAuthHandler } from './handler.mjs';
2
+ import 'next';
3
+ import '../SaleorExternalAuth.mjs';
4
+ import '../types.mjs';
5
+ import '../graphql.mjs';
6
+ import '@graphql-typed-document-node/core';
@@ -0,0 +1,6 @@
1
+ export { createSaleorExternalAuthHandler } from './handler.js';
2
+ import 'next';
3
+ import '../SaleorExternalAuth.js';
4
+ import '../types.js';
5
+ import '../graphql.js';
6
+ import '@graphql-typed-document-node/core';
@@ -0,0 +1,38 @@
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/next/index.ts
21
+ var next_exports = {};
22
+ __export(next_exports, {
23
+ createSaleorExternalAuthHandler: () => createSaleorExternalAuthHandler
24
+ });
25
+ module.exports = __toCommonJS(next_exports);
26
+
27
+ // src/next/handler.ts
28
+ var import_cookie = require("cookie");
29
+ var createSaleorExternalAuthHandler = (auth) => async (req, res) => {
30
+ const { state, code } = req.query;
31
+ const { token } = await auth.obtainAccessToken({ state, code });
32
+ res.setHeader("Set-Cookie", (0, import_cookie.serialize)("token", token, { path: "/" }));
33
+ res.redirect("/");
34
+ };
35
+ // Annotate the CommonJS export names for ESM import in node:
36
+ 0 && (module.exports = {
37
+ createSaleorExternalAuthHandler
38
+ });
@@ -0,0 +1,11 @@
1
+ import {
2
+ createSaleorExternalAuthHandler
3
+ } from "../chunk-77CRMKFX.mjs";
4
+ import "../chunk-T35JF4IS.mjs";
5
+ import "../chunk-KLIEZ4V4.mjs";
6
+ import "../chunk-UDLCOX6B.mjs";
7
+ import "../chunk-7JTFMRQS.mjs";
8
+ import "../chunk-K5MTKW5C.mjs";
9
+ export {
10
+ createSaleorExternalAuthHandler
11
+ };
@@ -0,0 +1,20 @@
1
+ import { StorageRepository } from '../types.mjs';
2
+
3
+ /**
4
+ * Retrieves a synchronous storage repository for cookies in Next.js 13 or 14.
5
+ *
6
+ * This function should **not** be used if `cookies()` returns a Promise.
7
+ */
8
+ declare const getNextServerCookiesStorage: (options?: {
9
+ secure?: boolean;
10
+ }) => StorageRepository;
11
+ /**
12
+ * Retrieves an asynchronous storage repository for cookies in Next.js 15.
13
+ *
14
+ * This function should **only** be used if `cookies()` returns a Promise.
15
+ */
16
+ declare const getNextServerCookiesStorageAsync: (options?: {
17
+ secure?: boolean;
18
+ }) => Promise<StorageRepository>;
19
+
20
+ export { getNextServerCookiesStorage, getNextServerCookiesStorageAsync };
@@ -0,0 +1,20 @@
1
+ import { StorageRepository } from '../types.js';
2
+
3
+ /**
4
+ * Retrieves a synchronous storage repository for cookies in Next.js 13 or 14.
5
+ *
6
+ * This function should **not** be used if `cookies()` returns a Promise.
7
+ */
8
+ declare const getNextServerCookiesStorage: (options?: {
9
+ secure?: boolean;
10
+ }) => StorageRepository;
11
+ /**
12
+ * Retrieves an asynchronous storage repository for cookies in Next.js 15.
13
+ *
14
+ * This function should **only** be used if `cookies()` returns a Promise.
15
+ */
16
+ declare const getNextServerCookiesStorageAsync: (options?: {
17
+ secure?: boolean;
18
+ }) => Promise<StorageRepository>;
19
+
20
+ export { getNextServerCookiesStorage, getNextServerCookiesStorageAsync };
@@ -0,0 +1,79 @@
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/next/server.ts
21
+ var server_exports = {};
22
+ __export(server_exports, {
23
+ getNextServerCookiesStorage: () => getNextServerCookiesStorage,
24
+ getNextServerCookiesStorageAsync: () => getNextServerCookiesStorageAsync
25
+ });
26
+ module.exports = __toCommonJS(server_exports);
27
+ var import_headers = require("next/headers");
28
+ var nextStorageRepository = (options = {}, cookies2) => {
29
+ const secure = options.secure ?? true;
30
+ const cache = /* @__PURE__ */ new Map();
31
+ return {
32
+ getItem(key) {
33
+ return cache.get(key) ?? cookies2.get(key)?.value ?? null;
34
+ },
35
+ removeItem(key) {
36
+ cache.delete(key);
37
+ cookies2.delete(key);
38
+ },
39
+ setItem(key, value) {
40
+ try {
41
+ cache.set(key, value);
42
+ const expires = tryGetExpFromJwt(value);
43
+ cookies2.set(key, value, { httpOnly: true, sameSite: "lax", secure, expires });
44
+ } catch {
45
+ }
46
+ }
47
+ };
48
+ };
49
+ var getNextServerCookiesStorage = (options = {}) => {
50
+ const maybeCookiesPromise = (0, import_headers.cookies)();
51
+ if (maybeCookiesPromise instanceof Promise) {
52
+ throw Error("This function should not be used with async cookies!");
53
+ }
54
+ return nextStorageRepository(options, maybeCookiesPromise);
55
+ };
56
+ var getNextServerCookiesStorageAsync = async (options = {}) => {
57
+ const maybeCookiesPromise = (0, import_headers.cookies)();
58
+ if (!(maybeCookiesPromise instanceof Promise)) {
59
+ throw Error("This function should only be used with async cookies!");
60
+ }
61
+ const cookieStore = await maybeCookiesPromise;
62
+ return nextStorageRepository(options, cookieStore);
63
+ };
64
+ var tryGetExpFromJwt = (token) => {
65
+ try {
66
+ const exp = JSON.parse(atob(token.split(".")[1] ?? "")).exp;
67
+ const nowInSeconds = Date.now() / 1e3;
68
+ if (exp && typeof exp === "number" && exp > nowInSeconds) {
69
+ return new Date(exp * 1e3);
70
+ }
71
+ } catch {
72
+ }
73
+ return void 0;
74
+ };
75
+ // Annotate the CommonJS export names for ESM import in node:
76
+ 0 && (module.exports = {
77
+ getNextServerCookiesStorage,
78
+ getNextServerCookiesStorageAsync
79
+ });
@@ -0,0 +1,53 @@
1
+ // src/next/server.ts
2
+ import { cookies } from "next/headers";
3
+ var nextStorageRepository = (options = {}, cookies2) => {
4
+ const secure = options.secure ?? true;
5
+ const cache = /* @__PURE__ */ new Map();
6
+ return {
7
+ getItem(key) {
8
+ return cache.get(key) ?? cookies2.get(key)?.value ?? null;
9
+ },
10
+ removeItem(key) {
11
+ cache.delete(key);
12
+ cookies2.delete(key);
13
+ },
14
+ setItem(key, value) {
15
+ try {
16
+ cache.set(key, value);
17
+ const expires = tryGetExpFromJwt(value);
18
+ cookies2.set(key, value, { httpOnly: true, sameSite: "lax", secure, expires });
19
+ } catch {
20
+ }
21
+ }
22
+ };
23
+ };
24
+ var getNextServerCookiesStorage = (options = {}) => {
25
+ const maybeCookiesPromise = cookies();
26
+ if (maybeCookiesPromise instanceof Promise) {
27
+ throw Error("This function should not be used with async cookies!");
28
+ }
29
+ return nextStorageRepository(options, maybeCookiesPromise);
30
+ };
31
+ var getNextServerCookiesStorageAsync = async (options = {}) => {
32
+ const maybeCookiesPromise = cookies();
33
+ if (!(maybeCookiesPromise instanceof Promise)) {
34
+ throw Error("This function should only be used with async cookies!");
35
+ }
36
+ const cookieStore = await maybeCookiesPromise;
37
+ return nextStorageRepository(options, cookieStore);
38
+ };
39
+ var tryGetExpFromJwt = (token) => {
40
+ try {
41
+ const exp = JSON.parse(atob(token.split(".")[1] ?? "")).exp;
42
+ const nowInSeconds = Date.now() / 1e3;
43
+ if (exp && typeof exp === "number" && exp > nowInSeconds) {
44
+ return new Date(exp * 1e3);
45
+ }
46
+ } catch {
47
+ }
48
+ return void 0;
49
+ };
50
+ export {
51
+ getNextServerCookiesStorage,
52
+ getNextServerCookiesStorageAsync
53
+ };
@@ -0,0 +1,10 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { PropsWithChildren } from 'react';
3
+ import { SaleorAuthClient } from '../SaleorAuthClient.mjs';
4
+ import '../types.mjs';
5
+
6
+ declare const SaleorAuthProvider: ({ children, client }: PropsWithChildren<{
7
+ client: SaleorAuthClient;
8
+ }>) => react_jsx_runtime.JSX.Element;
9
+
10
+ export { SaleorAuthProvider };
@@ -0,0 +1,10 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { PropsWithChildren } from 'react';
3
+ import { SaleorAuthClient } from '../SaleorAuthClient.js';
4
+ import '../types.js';
5
+
6
+ declare const SaleorAuthProvider: ({ children, client }: PropsWithChildren<{
7
+ client: SaleorAuthClient;
8
+ }>) => react_jsx_runtime.JSX.Element;
9
+
10
+ export { SaleorAuthProvider };
@@ -0,0 +1,50 @@
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/react/SaleorAuthProvider.tsx
21
+ var SaleorAuthProvider_exports = {};
22
+ __export(SaleorAuthProvider_exports, {
23
+ SaleorAuthProvider: () => SaleorAuthProvider
24
+ });
25
+ module.exports = __toCommonJS(SaleorAuthProvider_exports);
26
+
27
+ // src/react/context.ts
28
+ var import_react = require("react");
29
+ var createSafeContext = () => {
30
+ const context = (0, import_react.createContext)(void 0);
31
+ function useSafeContext() {
32
+ const value = (0, import_react.useContext)(context);
33
+ if (value === void 0) {
34
+ throw new Error("useContext must be inside a Provider with a value");
35
+ }
36
+ return value;
37
+ }
38
+ return [useSafeContext, context.Provider];
39
+ };
40
+ var [useSaleorAuthContext, Provider] = createSafeContext();
41
+
42
+ // src/react/SaleorAuthProvider.tsx
43
+ var import_jsx_runtime = require("react/jsx-runtime");
44
+ var SaleorAuthProvider = ({ children, client }) => {
45
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider, { value: client, children });
46
+ };
47
+ // Annotate the CommonJS export names for ESM import in node:
48
+ 0 && (module.exports = {
49
+ SaleorAuthProvider
50
+ });
@@ -0,0 +1,13 @@
1
+ import {
2
+ SaleorAuthProvider
3
+ } from "../chunk-74GMXOK4.mjs";
4
+ import "../chunk-NAQNA6DI.mjs";
5
+ import "../chunk-BRRF6LN3.mjs";
6
+ import "../chunk-BZFBMGPG.mjs";
7
+ import "../chunk-263DHBMK.mjs";
8
+ import "../chunk-UDLCOX6B.mjs";
9
+ import "../chunk-7JTFMRQS.mjs";
10
+ import "../chunk-K5MTKW5C.mjs";
11
+ export {
12
+ SaleorAuthProvider
13
+ };
@@ -0,0 +1,9 @@
1
+ import * as react from 'react';
2
+ import { SaleorAuthClient } from '../SaleorAuthClient.mjs';
3
+ import '../types.mjs';
4
+
5
+ declare const createSafeContext: <TValue>() => readonly [() => TValue & ({} | null), react.Provider<TValue | undefined>];
6
+ declare const useSaleorAuthContext: () => SaleorAuthClient;
7
+ declare const Provider: react.Provider<SaleorAuthClient | undefined>;
8
+
9
+ export { Provider, createSafeContext, useSaleorAuthContext };
@@ -0,0 +1,9 @@
1
+ import * as react from 'react';
2
+ import { SaleorAuthClient } from '../SaleorAuthClient.js';
3
+ import '../types.js';
4
+
5
+ declare const createSafeContext: <TValue>() => readonly [() => TValue & ({} | null), react.Provider<TValue | undefined>];
6
+ declare const useSaleorAuthContext: () => SaleorAuthClient;
7
+ declare const Provider: react.Provider<SaleorAuthClient | undefined>;
8
+
9
+ export { Provider, createSafeContext, useSaleorAuthContext };
@@ -0,0 +1,46 @@
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/react/context.ts
21
+ var context_exports = {};
22
+ __export(context_exports, {
23
+ Provider: () => Provider,
24
+ createSafeContext: () => createSafeContext,
25
+ useSaleorAuthContext: () => useSaleorAuthContext
26
+ });
27
+ module.exports = __toCommonJS(context_exports);
28
+ var import_react = require("react");
29
+ var createSafeContext = () => {
30
+ const context = (0, import_react.createContext)(void 0);
31
+ function useSafeContext() {
32
+ const value = (0, import_react.useContext)(context);
33
+ if (value === void 0) {
34
+ throw new Error("useContext must be inside a Provider with a value");
35
+ }
36
+ return value;
37
+ }
38
+ return [useSafeContext, context.Provider];
39
+ };
40
+ var [useSaleorAuthContext, Provider] = createSafeContext();
41
+ // Annotate the CommonJS export names for ESM import in node:
42
+ 0 && (module.exports = {
43
+ Provider,
44
+ createSafeContext,
45
+ useSaleorAuthContext
46
+ });
@@ -0,0 +1,16 @@
1
+ import {
2
+ Provider,
3
+ createSafeContext,
4
+ useSaleorAuthContext
5
+ } from "../chunk-NAQNA6DI.mjs";
6
+ import "../chunk-BRRF6LN3.mjs";
7
+ import "../chunk-BZFBMGPG.mjs";
8
+ import "../chunk-263DHBMK.mjs";
9
+ import "../chunk-UDLCOX6B.mjs";
10
+ import "../chunk-7JTFMRQS.mjs";
11
+ import "../chunk-K5MTKW5C.mjs";
12
+ export {
13
+ Provider,
14
+ createSafeContext,
15
+ useSaleorAuthContext
16
+ };
@@ -0,0 +1,8 @@
1
+ export { SaleorAuthProvider } from './SaleorAuthProvider.mjs';
2
+ export { useAuthChange } from './useAuthChange.mjs';
3
+ export { Provider, createSafeContext, useSaleorAuthContext } from './context.mjs';
4
+ export { SaleorExternalAuthState, useSaleorExternalAuth } from './useSaleorExternalAuth.mjs';
5
+ import 'react/jsx-runtime';
6
+ import 'react';
7
+ import '../SaleorAuthClient.mjs';
8
+ import '../types.mjs';
@@ -0,0 +1,8 @@
1
+ export { SaleorAuthProvider } from './SaleorAuthProvider.js';
2
+ export { useAuthChange } from './useAuthChange.js';
3
+ export { Provider, createSafeContext, useSaleorAuthContext } from './context.js';
4
+ export { SaleorExternalAuthState, useSaleorExternalAuth } from './useSaleorExternalAuth.js';
5
+ import 'react/jsx-runtime';
6
+ import 'react';
7
+ import '../SaleorAuthClient.js';
8
+ import '../types.js';