@01.software/sdk 0.2.9-dev.260311.892250f → 0.2.9-dev.260311.bb95a4e

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/index.d.cts CHANGED
@@ -85,34 +85,14 @@ declare function isGoneError(error: unknown): error is GoneError;
85
85
  declare function isServiceUnavailableError(error: unknown): error is ServiceUnavailableError;
86
86
  declare function isUsageLimitError(error: unknown): error is UsageLimitError;
87
87
 
88
- type Environment = 'local' | 'development' | 'staging' | 'production';
89
- declare const API_URLS: Record<Environment, string>;
90
88
  /**
91
- * 환경에 맞는 API URL을 반환합니다.
92
- * 우선순위: baseUrl > environment > 환경변수 > 기본값(production)
89
+ * API URL을 반환합니다.
90
+ * 환경변수 SOFTWARE_API_URL 또는 NEXT_PUBLIC_SOFTWARE_API_URL로 오버라이드 가능.
91
+ * 빌드 시 버전에 따라 기본값 결정: dev 빌드 → api-dev, 정식 → api.01.software
93
92
  */
94
- declare function resolveApiUrl(config?: {
95
- baseUrl?: string;
96
- environment?: Environment;
97
- }): string;
93
+ declare function resolveApiUrl(): string;
98
94
  interface ClientBrowserConfig {
99
95
  clientKey: string;
100
- /**
101
- * API 환경 설정.
102
- * - 'local': localhost:3000
103
- * - 'development': dev.01.software
104
- * - 'staging': stg.01.software
105
- * - 'production': api.01.software
106
- *
107
- * baseUrl이 설정되면 이 값은 무시됩니다.
108
- * @default 'production'
109
- */
110
- environment?: Environment;
111
- /**
112
- * 커스텀 API URL. 설정 시 environment 값은 무시됩니다.
113
- * @example 'https://my-custom-api.example.com'
114
- */
115
- baseUrl?: string;
116
96
  /**
117
97
  * Customer authentication options.
118
98
  * Used to initialize CustomerAuth on BrowserClient.
@@ -1047,4 +1027,4 @@ declare function getVideoStreamUrl(playbackId: string): string;
1047
1027
  */
1048
1028
  declare function getVideoMp4Url(playbackId: string, resolution?: 'high' | 'medium' | 'low'): string;
1049
1029
 
1050
- export { API_URLS, type AddItemParams, ApiError, type ApiQueryOptions, type ApiQueryReactOptions, type ApplyDiscountParams, BaseApi, BrowserClient, BrowserClient as BrowserClientType, type CalculateShippingParams, type CalculateShippingResult, Cart, CartApi, type CartApiOptions, CartItem, type CheckoutParams, type ClearCartParams, type ClientBrowserConfig, type ClientMetadata, type ClientServerConfig, type ClientState, CollectionClient, type CollectionDetailQueryParams, CollectionHooks, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, ConfigError, type CreateExchangeParams, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, CustomerHooks, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, type DebugConfig, type DeepPartial, type Environment, type ErrorLogger, Exchange, type ExtractArrayType, Fulfillment, type GenerateMetadataOptions, type GetOrderParams, GoneError, NetworkError, Order, OrderApi, type OrderApiOptions, OrderProduct, type PaginationMeta, type PayloadFindResponse, type PayloadMutationResponse, Product, ProductApi, type ProductApiOptions, PublicCollection, QueryHooks, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveDiscountParams, type RemoveItemParams, type RetryConfig, Return, type ReturnWithRefundParams, SDKError, type ServerApiOptions, ServerClient, ServerClient as ServerClientType, ServiceUnavailableError, type StockCheckParams, type StockCheckResponse, type StockCheckResult, TimeoutError, Transaction, type UpdateExchangeParams, type UpdateFulfillmentParams, type UpdateItemParams, type UpdateOrderParams, type UpdateProfileData, type UpdateReturnParams, type UpdateTransactionParams, UsageLimitError, type ValidateDiscountParams, type ValidateDiscountResult, ValidationError, type VideoGifOptions, type VideoThumbnailOptions, collectionKeys, createBrowserClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, getVideoGif, getVideoMp4Url, getVideoStoryboard, getVideoStreamUrl, getVideoThumbnail, isApiError, isConfigError, isGoneError, isNetworkError, isSDKError, isServiceUnavailableError, isTimeoutError, isUsageLimitError, isValidationError, resolveApiUrl, resolveRelation };
1030
+ export { type AddItemParams, ApiError, type ApiQueryOptions, type ApiQueryReactOptions, type ApplyDiscountParams, BaseApi, BrowserClient, BrowserClient as BrowserClientType, type CalculateShippingParams, type CalculateShippingResult, Cart, CartApi, type CartApiOptions, CartItem, type CheckoutParams, type ClearCartParams, type ClientBrowserConfig, type ClientMetadata, type ClientServerConfig, type ClientState, CollectionClient, type CollectionDetailQueryParams, CollectionHooks, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, ConfigError, type CreateExchangeParams, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, CustomerHooks, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, type DebugConfig, type DeepPartial, type ErrorLogger, Exchange, type ExtractArrayType, Fulfillment, type GenerateMetadataOptions, type GetOrderParams, GoneError, NetworkError, Order, OrderApi, type OrderApiOptions, OrderProduct, type PaginationMeta, type PayloadFindResponse, type PayloadMutationResponse, Product, ProductApi, type ProductApiOptions, PublicCollection, QueryHooks, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveDiscountParams, type RemoveItemParams, type RetryConfig, Return, type ReturnWithRefundParams, SDKError, type ServerApiOptions, ServerClient, ServerClient as ServerClientType, ServiceUnavailableError, type StockCheckParams, type StockCheckResponse, type StockCheckResult, TimeoutError, Transaction, type UpdateExchangeParams, type UpdateFulfillmentParams, type UpdateItemParams, type UpdateOrderParams, type UpdateProfileData, type UpdateReturnParams, type UpdateTransactionParams, UsageLimitError, type ValidateDiscountParams, type ValidateDiscountResult, ValidationError, type VideoGifOptions, type VideoThumbnailOptions, collectionKeys, createBrowserClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, getVideoGif, getVideoMp4Url, getVideoStoryboard, getVideoStreamUrl, getVideoThumbnail, isApiError, isConfigError, isGoneError, isNetworkError, isSDKError, isServiceUnavailableError, isTimeoutError, isUsageLimitError, isValidationError, resolveApiUrl, resolveRelation };
package/dist/index.d.ts CHANGED
@@ -85,34 +85,14 @@ declare function isGoneError(error: unknown): error is GoneError;
85
85
  declare function isServiceUnavailableError(error: unknown): error is ServiceUnavailableError;
86
86
  declare function isUsageLimitError(error: unknown): error is UsageLimitError;
87
87
 
88
- type Environment = 'local' | 'development' | 'staging' | 'production';
89
- declare const API_URLS: Record<Environment, string>;
90
88
  /**
91
- * 환경에 맞는 API URL을 반환합니다.
92
- * 우선순위: baseUrl > environment > 환경변수 > 기본값(production)
89
+ * API URL을 반환합니다.
90
+ * 환경변수 SOFTWARE_API_URL 또는 NEXT_PUBLIC_SOFTWARE_API_URL로 오버라이드 가능.
91
+ * 빌드 시 버전에 따라 기본값 결정: dev 빌드 → api-dev, 정식 → api.01.software
93
92
  */
94
- declare function resolveApiUrl(config?: {
95
- baseUrl?: string;
96
- environment?: Environment;
97
- }): string;
93
+ declare function resolveApiUrl(): string;
98
94
  interface ClientBrowserConfig {
99
95
  clientKey: string;
100
- /**
101
- * API 환경 설정.
102
- * - 'local': localhost:3000
103
- * - 'development': dev.01.software
104
- * - 'staging': stg.01.software
105
- * - 'production': api.01.software
106
- *
107
- * baseUrl이 설정되면 이 값은 무시됩니다.
108
- * @default 'production'
109
- */
110
- environment?: Environment;
111
- /**
112
- * 커스텀 API URL. 설정 시 environment 값은 무시됩니다.
113
- * @example 'https://my-custom-api.example.com'
114
- */
115
- baseUrl?: string;
116
96
  /**
117
97
  * Customer authentication options.
118
98
  * Used to initialize CustomerAuth on BrowserClient.
@@ -1047,4 +1027,4 @@ declare function getVideoStreamUrl(playbackId: string): string;
1047
1027
  */
1048
1028
  declare function getVideoMp4Url(playbackId: string, resolution?: 'high' | 'medium' | 'low'): string;
1049
1029
 
1050
- export { API_URLS, type AddItemParams, ApiError, type ApiQueryOptions, type ApiQueryReactOptions, type ApplyDiscountParams, BaseApi, BrowserClient, BrowserClient as BrowserClientType, type CalculateShippingParams, type CalculateShippingResult, Cart, CartApi, type CartApiOptions, CartItem, type CheckoutParams, type ClearCartParams, type ClientBrowserConfig, type ClientMetadata, type ClientServerConfig, type ClientState, CollectionClient, type CollectionDetailQueryParams, CollectionHooks, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, ConfigError, type CreateExchangeParams, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, CustomerHooks, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, type DebugConfig, type DeepPartial, type Environment, type ErrorLogger, Exchange, type ExtractArrayType, Fulfillment, type GenerateMetadataOptions, type GetOrderParams, GoneError, NetworkError, Order, OrderApi, type OrderApiOptions, OrderProduct, type PaginationMeta, type PayloadFindResponse, type PayloadMutationResponse, Product, ProductApi, type ProductApiOptions, PublicCollection, QueryHooks, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveDiscountParams, type RemoveItemParams, type RetryConfig, Return, type ReturnWithRefundParams, SDKError, type ServerApiOptions, ServerClient, ServerClient as ServerClientType, ServiceUnavailableError, type StockCheckParams, type StockCheckResponse, type StockCheckResult, TimeoutError, Transaction, type UpdateExchangeParams, type UpdateFulfillmentParams, type UpdateItemParams, type UpdateOrderParams, type UpdateProfileData, type UpdateReturnParams, type UpdateTransactionParams, UsageLimitError, type ValidateDiscountParams, type ValidateDiscountResult, ValidationError, type VideoGifOptions, type VideoThumbnailOptions, collectionKeys, createBrowserClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, getVideoGif, getVideoMp4Url, getVideoStoryboard, getVideoStreamUrl, getVideoThumbnail, isApiError, isConfigError, isGoneError, isNetworkError, isSDKError, isServiceUnavailableError, isTimeoutError, isUsageLimitError, isValidationError, resolveApiUrl, resolveRelation };
1030
+ export { type AddItemParams, ApiError, type ApiQueryOptions, type ApiQueryReactOptions, type ApplyDiscountParams, BaseApi, BrowserClient, BrowserClient as BrowserClientType, type CalculateShippingParams, type CalculateShippingResult, Cart, CartApi, type CartApiOptions, CartItem, type CheckoutParams, type ClearCartParams, type ClientBrowserConfig, type ClientMetadata, type ClientServerConfig, type ClientState, CollectionClient, type CollectionDetailQueryParams, CollectionHooks, type CollectionInfiniteQueryParams, CollectionQueryBuilder, type CollectionQueryParams, CollectionType, ConfigError, type CreateExchangeParams, type CreateFulfillmentParams, type CreateOrderParams, type CreateReturnParams, CustomerAuth, type CustomerAuthOptions, type CustomerAuthResponse, CustomerHooks, type CustomerLoginData, type CustomerProfile, type CustomerRefreshResponse, type CustomerRegisterData, type DebugConfig, type DeepPartial, type ErrorLogger, Exchange, type ExtractArrayType, Fulfillment, type GenerateMetadataOptions, type GetOrderParams, GoneError, NetworkError, Order, OrderApi, type OrderApiOptions, OrderProduct, type PaginationMeta, type PayloadFindResponse, type PayloadMutationResponse, Product, ProductApi, type ProductApiOptions, PublicCollection, QueryHooks, type ReadOnlyQueryBuilder, type ReadOnlyQueryHooks, type RemoveDiscountParams, type RemoveItemParams, type RetryConfig, Return, type ReturnWithRefundParams, SDKError, type ServerApiOptions, ServerClient, ServerClient as ServerClientType, ServiceUnavailableError, type StockCheckParams, type StockCheckResponse, type StockCheckResult, TimeoutError, Transaction, type UpdateExchangeParams, type UpdateFulfillmentParams, type UpdateItemParams, type UpdateOrderParams, type UpdateProfileData, type UpdateReturnParams, type UpdateTransactionParams, UsageLimitError, type ValidateDiscountParams, type ValidateDiscountResult, ValidationError, type VideoGifOptions, type VideoThumbnailOptions, collectionKeys, createBrowserClient, createServerClient, customerKeys, formatOrderName, generateOrderNumber, getQueryClient, getVideoGif, getVideoMp4Url, getVideoStoryboard, getVideoStreamUrl, getVideoThumbnail, isApiError, isConfigError, isGoneError, isNetworkError, isSDKError, isServiceUnavailableError, isTimeoutError, isUsageLimitError, isValidationError, resolveApiUrl, resolveRelation };
package/dist/index.js CHANGED
@@ -251,24 +251,12 @@ var createTimeoutError = (message, details, userMessage, suggestion) => new Time
251
251
  var createUsageLimitError = (message, usage, details, userMessage, suggestion) => new UsageLimitError(message, usage, details, userMessage, suggestion);
252
252
 
253
253
  // src/core/client/types.ts
254
- var API_URLS = {
255
- local: "http://localhost:3000",
256
- development: "https://api-dev.01.software",
257
- staging: "https://api-stg.01.software",
258
- production: "https://api.01.software"
259
- };
260
- function resolveApiUrl(config) {
261
- if (config == null ? void 0 : config.baseUrl) {
262
- return config.baseUrl.replace(/\/$/, "");
263
- }
254
+ function resolveApiUrl() {
264
255
  const envUrl = process.env.SOFTWARE_API_URL || process.env.NEXT_PUBLIC_SOFTWARE_API_URL;
265
256
  if (envUrl) {
266
257
  return envUrl.replace(/\/$/, "");
267
258
  }
268
- if (config == null ? void 0 : config.environment) {
269
- return API_URLS[config.environment];
270
- }
271
- return API_URLS.production;
259
+ return "http://localhost:3000";
272
260
  }
273
261
 
274
262
  // src/core/internal/utils/http.ts
@@ -305,7 +293,7 @@ function httpFetch(url, options) {
305
293
  secretKey,
306
294
  customerToken,
307
295
  timeout = DEFAULT_TIMEOUT,
308
- baseUrl = API_URLS.production,
296
+ baseUrl = resolveApiUrl(),
309
297
  debug,
310
298
  retry,
311
299
  onUnauthorized
@@ -1866,7 +1854,7 @@ var BrowserClient = class {
1866
1854
  throw createConfigError("clientKey is required.");
1867
1855
  }
1868
1856
  this.config = __spreadValues({}, options);
1869
- this.baseUrl = resolveApiUrl(options);
1857
+ this.baseUrl = resolveApiUrl();
1870
1858
  const metadata = {
1871
1859
  timestamp: Date.now(),
1872
1860
  userAgent: typeof window !== "undefined" ? (_a = window.navigator) == null ? void 0 : _a.userAgent : "Node.js"
@@ -1927,7 +1915,7 @@ var ServerClient = class {
1927
1915
  throw createConfigError("secretKey is required.");
1928
1916
  }
1929
1917
  this.config = __spreadValues({}, options);
1930
- this.baseUrl = resolveApiUrl(options);
1918
+ this.baseUrl = resolveApiUrl();
1931
1919
  const metadata = {
1932
1920
  timestamp: Date.now(),
1933
1921
  userAgent: "Node.js"