@01.software/sdk 0.4.3-dev.260324.6dc30aa → 0.5.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.
package/README.md CHANGED
@@ -15,19 +15,19 @@ pnpm add @01.software/sdk
15
15
 
16
16
  - Full TypeScript type inference
17
17
  - Browser and server environment support
18
- - React Query integration (both BrowserClient and ServerClient)
18
+ - React Query integration (both Client and ServerClient)
19
19
  - Mutation hooks (useCreate, useUpdate, useRemove) with automatic cache invalidation
20
20
  - Customer auth hooks (useCustomerMe, useCustomerLogin, etc.) with cache management
21
21
  - Automatic retry with exponential backoff (non-retryable: 401, 403, 404, 422)
22
22
  - Webhook handling with HMAC-SHA256 signature verification
23
23
  - Sub-path imports (`./auth`, `./webhook`, `./components`) for tree-shaking
24
- - Type-safe read-only `from()` for BrowserClient (compile-time write prevention)
24
+ - Type-safe read-only `from()` for Client (compile-time write prevention)
25
25
 
26
26
  ### Sub-path Imports
27
27
 
28
28
  ```typescript
29
29
  // Main entry - clients, query builder, hooks, utilities
30
- import { createBrowserClient, createServerClient } from '@01.software/sdk'
30
+ import { createClient, createServerClient } from '@01.software/sdk'
31
31
 
32
32
  // Auth only - JWT & API Key utilities (smaller bundle)
33
33
  import {
@@ -53,12 +53,12 @@ import { VideoPlayer } from '@01.software/sdk/ui/video'
53
53
 
54
54
  ## Getting Started
55
55
 
56
- ### Browser Client
56
+ ### Client
57
57
 
58
58
  ```typescript
59
- import { createBrowserClient } from '@01.software/sdk'
59
+ import { createClient } from '@01.software/sdk'
60
60
 
61
- const client = createBrowserClient({
61
+ const client = createClient({
62
62
  clientKey: process.env.NEXT_PUBLIC_SOFTWARE_CLIENT_KEY,
63
63
  })
64
64
 
@@ -102,7 +102,7 @@ await client.query.prefetchQuery({
102
102
  ### Client Configuration
103
103
 
104
104
  ```typescript
105
- const client = createBrowserClient({
105
+ const client = createClient({
106
106
  clientKey: string, // Required
107
107
  })
108
108
  ```
@@ -121,7 +121,7 @@ API URL은 환경변수로 오버라이드 가능합니다:
121
121
 
122
122
  Access collections via `client.from(collection)` method.
123
123
 
124
- > **Note:** `BrowserClient.from()` returns a `ReadOnlyQueryBuilder` (only `find`, `findById`, `count`, `findMetadata`, `findMetadataById`). Write operations (`create`, `update`, `remove`, `updateMany`, `removeMany`) are only available on `ServerClient.from()`.
124
+ > **Note:** `Client.from()` returns a `ReadOnlyQueryBuilder` (only `find`, `findById`, `count`, `findMetadata`, `findMetadataById`). Write operations (`create`, `update`, `remove`, `updateMany`, `removeMany`) are only available on `ServerClient.from()`.
125
125
 
126
126
  ```typescript
127
127
  // List query - returns PayloadFindResponse
@@ -218,7 +218,7 @@ interface PayloadMutationResponse<T> {
218
218
 
219
219
  ### React Query Hooks
220
220
 
221
- Read hooks are available on both `BrowserClient` and `ServerClient` via `client.query.*`. Mutation hooks (`useCreate`, `useUpdate`, `useRemove`) are only available on `ServerClient`.
221
+ Read hooks are available on both `Client` and `ServerClient` via `client.query.*`. Mutation hooks (`useCreate`, `useUpdate`, `useRemove`) are only available on `ServerClient`.
222
222
 
223
223
  ```typescript
224
224
  // List query
@@ -273,7 +273,7 @@ client.query.invalidateQueries('products')
273
273
  client.query.getQueryData('products', 'list', options)
274
274
  client.query.setQueryData('products', 'detail', id, data)
275
275
 
276
- // Customer auth hooks (BrowserClient only)
276
+ // Customer auth hooks (Client only)
277
277
  const { data: profile } = client.query.useCustomerMe()
278
278
  const { mutate: login } = client.query.useCustomerLogin()
279
279
  const { mutate: register } = client.query.useCustomerRegister()
@@ -295,10 +295,10 @@ client.query.setCustomerData(profile)
295
295
 
296
296
  ### Customer Auth
297
297
 
298
- Available on BrowserClient via `client.customer.*`.
298
+ Available on Client via `client.customer.*`.
299
299
 
300
300
  ```typescript
301
- const client = createBrowserClient({
301
+ const client = createClient({
302
302
  clientKey: process.env.NEXT_PUBLIC_SOFTWARE_CLIENT_KEY,
303
303
  customer: { persist: true },
304
304
  })
@@ -370,7 +370,7 @@ const { results, allAvailable } = await client.product.stockCheck({
370
370
 
371
371
  ### Cart API
372
372
 
373
- Available in both ServerClient and BrowserClient via `client.cart.*`.
373
+ Available in both ServerClient and Client via `client.cart.*`.
374
374
 
375
375
  ```typescript
376
376
  // Add item to cart
package/dist/index.cjs CHANGED
@@ -72,9 +72,9 @@ var src_exports = {};
72
72
  __export(src_exports, {
73
73
  ApiError: () => ApiError,
74
74
  BaseApi: () => BaseApi,
75
- BrowserClient: () => BrowserClient,
76
75
  COLLECTIONS: () => COLLECTIONS,
77
76
  CartApi: () => CartApi,
77
+ Client: () => Client,
78
78
  CollectionClient: () => CollectionClient,
79
79
  CollectionHooks: () => CollectionHooks,
80
80
  CollectionQueryBuilder: () => CollectionQueryBuilder,
@@ -96,7 +96,7 @@ __export(src_exports, {
96
96
  ValidationError: () => ValidationError,
97
97
  collectionKeys: () => collectionKeys,
98
98
  createApiKey: () => createApiKey,
99
- createBrowserClient: () => createBrowserClient,
99
+ createClient: () => createClient,
100
100
  createServerClient: () => createServerClient,
101
101
  createServerToken: () => createServerToken,
102
102
  createTypedWebhookHandler: () => createTypedWebhookHandler,
@@ -348,7 +348,7 @@ function resolveApiUrl() {
348
348
  return envUrl.replace(/\/$/, "");
349
349
  }
350
350
  }
351
- return "https://api-dev.01.software";
351
+ return "https://api.01.software";
352
352
  }
353
353
 
354
354
  // src/core/internal/utils/http.ts
@@ -1941,7 +1941,7 @@ var CustomerHooks = class {
1941
1941
  ensureCustomerAuth() {
1942
1942
  if (!this.customerAuth) {
1943
1943
  throw createConfigError(
1944
- "Customer hooks require BrowserClient. Use createBrowserClient() instead of createServerClient()."
1944
+ "Customer hooks require Client. Use createClient() instead of createServerClient()."
1945
1945
  );
1946
1946
  }
1947
1947
  return this.customerAuth;
@@ -2065,7 +2065,7 @@ var QueryHooks = class extends CollectionHooks {
2065
2065
  };
2066
2066
 
2067
2067
  // src/core/client/client.ts
2068
- var BrowserClient = class {
2068
+ var Client = class {
2069
2069
  constructor(options) {
2070
2070
  var _a;
2071
2071
  if (!options.clientKey) {
@@ -2122,8 +2122,8 @@ var BrowserClient = class {
2122
2122
  return __spreadValues({}, this.config);
2123
2123
  }
2124
2124
  };
2125
- function createBrowserClient(options) {
2126
- return new BrowserClient(options);
2125
+ function createClient(options) {
2126
+ return new Client(options);
2127
2127
  }
2128
2128
 
2129
2129
  // src/core/client/client.server.ts
@@ -2131,7 +2131,7 @@ var ServerClient = class {
2131
2131
  constructor(options) {
2132
2132
  if (typeof window !== "undefined") {
2133
2133
  throw createConfigError(
2134
- "ServerClient must not be used in a browser environment. This risks exposing your secretKey in client bundles. Use createBrowserClient() for browser code instead."
2134
+ "ServerClient must not be used in a browser environment. This risks exposing your secretKey in client bundles. Use createClient() for browser code instead."
2135
2135
  );
2136
2136
  }
2137
2137
  if (!options.clientKey) {