omni-sync-sdk 0.7.3 → 0.7.4

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
@@ -205,6 +205,78 @@ console.log(product.variants); // ProductVariant[] (for VARIABLE products)
205
205
  console.log(product.inventory); // { total, reserved, available }
206
206
  ```
207
207
 
208
+ #### Search Suggestions (Autocomplete)
209
+
210
+ Get search suggestions for building autocomplete/search-as-you-type UI:
211
+
212
+ ```typescript
213
+ import type { SearchSuggestions } from 'omni-sync-sdk';
214
+
215
+ // Basic autocomplete
216
+ const suggestions: SearchSuggestions = await omni.getSearchSuggestions('shirt');
217
+
218
+ console.log(suggestions.products);
219
+ // [{ id, name, image, basePrice, salePrice, type }]
220
+
221
+ console.log(suggestions.categories);
222
+ // [{ id, name, productCount }]
223
+
224
+ // With custom limit (default: 5, max: 10)
225
+ const suggestions = await omni.getSearchSuggestions('dress', 3);
226
+ ```
227
+
228
+ **Search covers:** name, sku, description, categories, tags, and brands.
229
+
230
+ **Example: Search Input with Suggestions**
231
+
232
+ ```typescript
233
+ function SearchInput() {
234
+ const [query, setQuery] = useState('');
235
+ const [suggestions, setSuggestions] = useState<SearchSuggestions | null>(null);
236
+
237
+ // Debounce search requests
238
+ useEffect(() => {
239
+ if (query.length < 2) {
240
+ setSuggestions(null);
241
+ return;
242
+ }
243
+
244
+ const timer = setTimeout(async () => {
245
+ const results = await omni.getSearchSuggestions(query, 5);
246
+ setSuggestions(results);
247
+ }, 300);
248
+
249
+ return () => clearTimeout(timer);
250
+ }, [query]);
251
+
252
+ return (
253
+ <div>
254
+ <input
255
+ value={query}
256
+ onChange={(e) => setQuery(e.target.value)}
257
+ placeholder="Search products..."
258
+ />
259
+ {suggestions && (
260
+ <div className="suggestions">
261
+ {suggestions.products.map((product) => (
262
+ <a key={product.id} href={`/products/${product.id}`}>
263
+ <img src={product.image || '/placeholder.png'} alt={product.name} />
264
+ <span>{product.name}</span>
265
+ <span>${product.basePrice}</span>
266
+ </a>
267
+ ))}
268
+ {suggestions.categories.map((category) => (
269
+ <a key={category.id} href={`/category/${category.id}`}>
270
+ {category.name} ({category.productCount} products)
271
+ </a>
272
+ ))}
273
+ </div>
274
+ )}
275
+ </div>
276
+ );
277
+ }
278
+ ```
279
+
208
280
  #### Product Type Definition
209
281
 
210
282
  ```typescript
package/dist/index.d.mts CHANGED
@@ -113,6 +113,32 @@ interface ProductQueryParams {
113
113
  sortBy?: 'name' | 'createdAt' | 'updatedAt' | 'basePrice';
114
114
  sortOrder?: 'asc' | 'desc';
115
115
  }
116
+ /**
117
+ * Product suggestion for autocomplete
118
+ */
119
+ interface ProductSuggestion {
120
+ id: string;
121
+ name: string;
122
+ image: string | null;
123
+ basePrice: number;
124
+ salePrice?: number | null;
125
+ type: 'SIMPLE' | 'VARIABLE';
126
+ }
127
+ /**
128
+ * Category suggestion for autocomplete
129
+ */
130
+ interface CategorySuggestion {
131
+ id: string;
132
+ name: string;
133
+ productCount: number;
134
+ }
135
+ /**
136
+ * Search suggestions response (autocomplete)
137
+ */
138
+ interface SearchSuggestions {
139
+ products: ProductSuggestion[];
140
+ categories: CategorySuggestion[];
141
+ }
116
142
  interface PaginatedResponse<T> {
117
143
  data: T[];
118
144
  meta: {
@@ -1100,6 +1126,27 @@ declare class OmniSyncClient {
1100
1126
  * Works in vibe-coded, storefront (public), and admin mode
1101
1127
  */
1102
1128
  getProduct(productId: string): Promise<Product>;
1129
+ /**
1130
+ * Get search suggestions for autocomplete
1131
+ * Returns matching products and categories for quick search UI
1132
+ * Works in vibe-coded and storefront mode
1133
+ *
1134
+ * @param query - Search query (minimum 1 character)
1135
+ * @param limit - Maximum number of results (default 5, max 10)
1136
+ * @returns Products and categories matching the query
1137
+ *
1138
+ * @example
1139
+ * ```typescript
1140
+ * // Basic autocomplete
1141
+ * const suggestions = await omni.getSearchSuggestions('shirt');
1142
+ * console.log(suggestions.products); // [{ id, name, image, basePrice, type }]
1143
+ * console.log(suggestions.categories); // [{ id, name, productCount }]
1144
+ *
1145
+ * // With custom limit
1146
+ * const suggestions = await omni.getSearchSuggestions('dress', 3);
1147
+ * ```
1148
+ */
1149
+ getSearchSuggestions(query: string, limit?: number): Promise<SearchSuggestions>;
1103
1150
  /**
1104
1151
  * Create a new product
1105
1152
  */
@@ -1583,6 +1630,7 @@ declare class OmniSyncClient {
1583
1630
  getCustomerByEmail(email: string): Promise<Customer | null>;
1584
1631
  /**
1585
1632
  * Login an existing customer (returns JWT token)
1633
+ * Works in vibe-coded, storefront, and admin mode
1586
1634
  *
1587
1635
  * @example
1588
1636
  * ```typescript
@@ -1594,6 +1642,7 @@ declare class OmniSyncClient {
1594
1642
  loginCustomer(email: string, password: string): Promise<CustomerAuthResponse>;
1595
1643
  /**
1596
1644
  * Register a new customer with password (creates account)
1645
+ * Works in vibe-coded, storefront, and admin mode
1597
1646
  *
1598
1647
  * @example
1599
1648
  * ```typescript
@@ -1608,6 +1657,7 @@ declare class OmniSyncClient {
1608
1657
  registerCustomer(data: RegisterCustomerDto): Promise<CustomerAuthResponse>;
1609
1658
  /**
1610
1659
  * Request a password reset email for a customer
1660
+ * Works in vibe-coded, storefront, and admin mode
1611
1661
  */
1612
1662
  forgotPassword(email: string): Promise<{
1613
1663
  message: string;
@@ -2275,4 +2325,4 @@ declare function isWebhookEventType(event: WebhookEvent, type: WebhookEventType)
2275
2325
  */
2276
2326
  declare function createWebhookHandler(handlers: Partial<Record<WebhookEventType, (event: WebhookEvent) => Promise<void>>>): (payload: unknown) => Promise<void>;
2277
2327
 
2278
- export { type AddToCartDto, type AppliedDiscount, type ApplyCouponDto, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type Cart, type CartItem, type CartStatus, type Checkout, type CheckoutAddress, type CheckoutLineItem, type CheckoutStatus, type CompleteCheckoutResponse, type CompleteDraftDto, type ConnectorPlatform, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateCheckoutDto, type CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateGuestOrderDto, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerProfile, type CustomerQueryParams, type DraftLineItem, type EditInventoryDto, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type InventoryInfo, type InventorySyncStatus, type LocalCart, type LocalCartItem, type MergeCartsDto, type OmniSyncApiError, OmniSyncClient, type OmniSyncClientOptions, OmniSyncError, type Order, type OrderAddress, type OrderCustomer, type OrderItem, type OrderQueryParams, type OrderStatus, type PaginatedResponse, type PlatformCouponCapabilities, type Product, type ProductAttributeInput, type ProductImage, type ProductQueryParams, type ProductVariant, type PublishProductResponse, type ReconcileInventoryResponse, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type SelectShippingMethodDto, type SendInvoiceDto, type SetBillingAddressDto, type SetCheckoutCustomerDto, type SetShippingAddressDto, type SetShippingAddressResponse, type ShippingLine, type ShippingRate, type StoreInfo, type SyncJob, type UpdateAddressDto, type UpdateCartItemDto, type UpdateCouponDto, type UpdateCustomApiDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateInventoryDto, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateVariantDto, type UpdateVariantInventoryDto, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WebhookEvent, type WebhookEventType, createWebhookHandler, isCouponApplicableToProduct, isWebhookEventType, parseWebhookEvent, verifyWebhook };
2328
+ export { type AddToCartDto, type AppliedDiscount, type ApplyCouponDto, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type Cart, type CartItem, type CartStatus, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutLineItem, type CheckoutStatus, type CompleteCheckoutResponse, type CompleteDraftDto, type ConnectorPlatform, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateCheckoutDto, type CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateGuestOrderDto, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerProfile, type CustomerQueryParams, type DraftLineItem, type EditInventoryDto, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type InventoryInfo, type InventorySyncStatus, type LocalCart, type LocalCartItem, type MergeCartsDto, type OmniSyncApiError, OmniSyncClient, type OmniSyncClientOptions, OmniSyncError, type Order, type OrderAddress, type OrderCustomer, type OrderItem, type OrderQueryParams, type OrderStatus, type PaginatedResponse, type PlatformCouponCapabilities, type Product, type ProductAttributeInput, type ProductImage, type ProductQueryParams, type ProductSuggestion, type ProductVariant, type PublishProductResponse, type ReconcileInventoryResponse, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type SearchSuggestions, type SelectShippingMethodDto, type SendInvoiceDto, type SetBillingAddressDto, type SetCheckoutCustomerDto, type SetShippingAddressDto, type SetShippingAddressResponse, type ShippingLine, type ShippingRate, type StoreInfo, type SyncJob, type UpdateAddressDto, type UpdateCartItemDto, type UpdateCouponDto, type UpdateCustomApiDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateInventoryDto, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateVariantDto, type UpdateVariantInventoryDto, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WebhookEvent, type WebhookEventType, createWebhookHandler, isCouponApplicableToProduct, isWebhookEventType, parseWebhookEvent, verifyWebhook };
package/dist/index.d.ts CHANGED
@@ -113,6 +113,32 @@ interface ProductQueryParams {
113
113
  sortBy?: 'name' | 'createdAt' | 'updatedAt' | 'basePrice';
114
114
  sortOrder?: 'asc' | 'desc';
115
115
  }
116
+ /**
117
+ * Product suggestion for autocomplete
118
+ */
119
+ interface ProductSuggestion {
120
+ id: string;
121
+ name: string;
122
+ image: string | null;
123
+ basePrice: number;
124
+ salePrice?: number | null;
125
+ type: 'SIMPLE' | 'VARIABLE';
126
+ }
127
+ /**
128
+ * Category suggestion for autocomplete
129
+ */
130
+ interface CategorySuggestion {
131
+ id: string;
132
+ name: string;
133
+ productCount: number;
134
+ }
135
+ /**
136
+ * Search suggestions response (autocomplete)
137
+ */
138
+ interface SearchSuggestions {
139
+ products: ProductSuggestion[];
140
+ categories: CategorySuggestion[];
141
+ }
116
142
  interface PaginatedResponse<T> {
117
143
  data: T[];
118
144
  meta: {
@@ -1100,6 +1126,27 @@ declare class OmniSyncClient {
1100
1126
  * Works in vibe-coded, storefront (public), and admin mode
1101
1127
  */
1102
1128
  getProduct(productId: string): Promise<Product>;
1129
+ /**
1130
+ * Get search suggestions for autocomplete
1131
+ * Returns matching products and categories for quick search UI
1132
+ * Works in vibe-coded and storefront mode
1133
+ *
1134
+ * @param query - Search query (minimum 1 character)
1135
+ * @param limit - Maximum number of results (default 5, max 10)
1136
+ * @returns Products and categories matching the query
1137
+ *
1138
+ * @example
1139
+ * ```typescript
1140
+ * // Basic autocomplete
1141
+ * const suggestions = await omni.getSearchSuggestions('shirt');
1142
+ * console.log(suggestions.products); // [{ id, name, image, basePrice, type }]
1143
+ * console.log(suggestions.categories); // [{ id, name, productCount }]
1144
+ *
1145
+ * // With custom limit
1146
+ * const suggestions = await omni.getSearchSuggestions('dress', 3);
1147
+ * ```
1148
+ */
1149
+ getSearchSuggestions(query: string, limit?: number): Promise<SearchSuggestions>;
1103
1150
  /**
1104
1151
  * Create a new product
1105
1152
  */
@@ -1583,6 +1630,7 @@ declare class OmniSyncClient {
1583
1630
  getCustomerByEmail(email: string): Promise<Customer | null>;
1584
1631
  /**
1585
1632
  * Login an existing customer (returns JWT token)
1633
+ * Works in vibe-coded, storefront, and admin mode
1586
1634
  *
1587
1635
  * @example
1588
1636
  * ```typescript
@@ -1594,6 +1642,7 @@ declare class OmniSyncClient {
1594
1642
  loginCustomer(email: string, password: string): Promise<CustomerAuthResponse>;
1595
1643
  /**
1596
1644
  * Register a new customer with password (creates account)
1645
+ * Works in vibe-coded, storefront, and admin mode
1597
1646
  *
1598
1647
  * @example
1599
1648
  * ```typescript
@@ -1608,6 +1657,7 @@ declare class OmniSyncClient {
1608
1657
  registerCustomer(data: RegisterCustomerDto): Promise<CustomerAuthResponse>;
1609
1658
  /**
1610
1659
  * Request a password reset email for a customer
1660
+ * Works in vibe-coded, storefront, and admin mode
1611
1661
  */
1612
1662
  forgotPassword(email: string): Promise<{
1613
1663
  message: string;
@@ -2275,4 +2325,4 @@ declare function isWebhookEventType(event: WebhookEvent, type: WebhookEventType)
2275
2325
  */
2276
2326
  declare function createWebhookHandler(handlers: Partial<Record<WebhookEventType, (event: WebhookEvent) => Promise<void>>>): (payload: unknown) => Promise<void>;
2277
2327
 
2278
- export { type AddToCartDto, type AppliedDiscount, type ApplyCouponDto, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type Cart, type CartItem, type CartStatus, type Checkout, type CheckoutAddress, type CheckoutLineItem, type CheckoutStatus, type CompleteCheckoutResponse, type CompleteDraftDto, type ConnectorPlatform, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateCheckoutDto, type CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateGuestOrderDto, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerProfile, type CustomerQueryParams, type DraftLineItem, type EditInventoryDto, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type InventoryInfo, type InventorySyncStatus, type LocalCart, type LocalCartItem, type MergeCartsDto, type OmniSyncApiError, OmniSyncClient, type OmniSyncClientOptions, OmniSyncError, type Order, type OrderAddress, type OrderCustomer, type OrderItem, type OrderQueryParams, type OrderStatus, type PaginatedResponse, type PlatformCouponCapabilities, type Product, type ProductAttributeInput, type ProductImage, type ProductQueryParams, type ProductVariant, type PublishProductResponse, type ReconcileInventoryResponse, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type SelectShippingMethodDto, type SendInvoiceDto, type SetBillingAddressDto, type SetCheckoutCustomerDto, type SetShippingAddressDto, type SetShippingAddressResponse, type ShippingLine, type ShippingRate, type StoreInfo, type SyncJob, type UpdateAddressDto, type UpdateCartItemDto, type UpdateCouponDto, type UpdateCustomApiDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateInventoryDto, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateVariantDto, type UpdateVariantInventoryDto, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WebhookEvent, type WebhookEventType, createWebhookHandler, isCouponApplicableToProduct, isWebhookEventType, parseWebhookEvent, verifyWebhook };
2328
+ export { type AddToCartDto, type AppliedDiscount, type ApplyCouponDto, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type Cart, type CartItem, type CartStatus, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutLineItem, type CheckoutStatus, type CompleteCheckoutResponse, type CompleteDraftDto, type ConnectorPlatform, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateCheckoutDto, type CreateCouponDto, type CreateCustomApiDto, type CreateCustomerDto, type CreateGuestOrderDto, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateVariantDto, type CustomApiAuthType, type CustomApiConnectionStatus, type CustomApiCredentials, type CustomApiIntegration, type CustomApiSyncConfig, type CustomApiSyncDirection, type CustomApiTestResult, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerProfile, type CustomerQueryParams, type DraftLineItem, type EditInventoryDto, type FulfillOrderDto, type GuestCheckoutStartResponse, type GuestOrderResponse, type InventoryInfo, type InventorySyncStatus, type LocalCart, type LocalCartItem, type MergeCartsDto, type OmniSyncApiError, OmniSyncClient, type OmniSyncClientOptions, OmniSyncError, type Order, type OrderAddress, type OrderCustomer, type OrderItem, type OrderQueryParams, type OrderStatus, type PaginatedResponse, type PlatformCouponCapabilities, type Product, type ProductAttributeInput, type ProductImage, type ProductQueryParams, type ProductSuggestion, type ProductVariant, type PublishProductResponse, type ReconcileInventoryResponse, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type RegisterCustomerDto, type SearchSuggestions, type SelectShippingMethodDto, type SendInvoiceDto, type SetBillingAddressDto, type SetCheckoutCustomerDto, type SetShippingAddressDto, type SetShippingAddressResponse, type ShippingLine, type ShippingRate, type StoreInfo, type SyncJob, type UpdateAddressDto, type UpdateCartItemDto, type UpdateCouponDto, type UpdateCustomApiDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateInventoryDto, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateVariantDto, type UpdateVariantInventoryDto, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WebhookEvent, type WebhookEventType, createWebhookHandler, isCouponApplicableToProduct, isWebhookEventType, parseWebhookEvent, verifyWebhook };
package/dist/index.js CHANGED
@@ -354,6 +354,54 @@ var OmniSyncClient = class {
354
354
  }
355
355
  return this.adminRequest("GET", `/api/v1/products/${productId}`);
356
356
  }
357
+ /**
358
+ * Get search suggestions for autocomplete
359
+ * Returns matching products and categories for quick search UI
360
+ * Works in vibe-coded and storefront mode
361
+ *
362
+ * @param query - Search query (minimum 1 character)
363
+ * @param limit - Maximum number of results (default 5, max 10)
364
+ * @returns Products and categories matching the query
365
+ *
366
+ * @example
367
+ * ```typescript
368
+ * // Basic autocomplete
369
+ * const suggestions = await omni.getSearchSuggestions('shirt');
370
+ * console.log(suggestions.products); // [{ id, name, image, basePrice, type }]
371
+ * console.log(suggestions.categories); // [{ id, name, productCount }]
372
+ *
373
+ * // With custom limit
374
+ * const suggestions = await omni.getSearchSuggestions('dress', 3);
375
+ * ```
376
+ */
377
+ async getSearchSuggestions(query, limit) {
378
+ if (!query || query.trim().length === 0) {
379
+ return { products: [], categories: [] };
380
+ }
381
+ const queryParams = { q: query, limit };
382
+ if (this.isVibeCodedMode()) {
383
+ return this.vibeCodedRequest(
384
+ "GET",
385
+ "/search/suggestions",
386
+ void 0,
387
+ queryParams
388
+ );
389
+ }
390
+ if (this.storeId && !this.apiKey) {
391
+ return this.storefrontRequest(
392
+ "GET",
393
+ "/search/suggestions",
394
+ void 0,
395
+ queryParams
396
+ );
397
+ }
398
+ return this.adminRequest(
399
+ "GET",
400
+ "/api/v1/search/suggestions",
401
+ void 0,
402
+ queryParams
403
+ );
404
+ }
357
405
  /**
358
406
  * Create a new product
359
407
  */
@@ -975,6 +1023,7 @@ var OmniSyncClient = class {
975
1023
  }
976
1024
  /**
977
1025
  * Login an existing customer (returns JWT token)
1026
+ * Works in vibe-coded, storefront, and admin mode
978
1027
  *
979
1028
  * @example
980
1029
  * ```typescript
@@ -984,6 +1033,12 @@ var OmniSyncClient = class {
984
1033
  * ```
985
1034
  */
986
1035
  async loginCustomer(email, password) {
1036
+ if (this.isVibeCodedMode()) {
1037
+ return this.vibeCodedRequest("POST", "/customers/login", {
1038
+ email,
1039
+ password
1040
+ });
1041
+ }
987
1042
  if (this.storeId && !this.apiKey) {
988
1043
  return this.storefrontRequest("POST", "/customers/login", {
989
1044
  email,
@@ -997,6 +1052,7 @@ var OmniSyncClient = class {
997
1052
  }
998
1053
  /**
999
1054
  * Register a new customer with password (creates account)
1055
+ * Works in vibe-coded, storefront, and admin mode
1000
1056
  *
1001
1057
  * @example
1002
1058
  * ```typescript
@@ -1009,6 +1065,9 @@ var OmniSyncClient = class {
1009
1065
  * ```
1010
1066
  */
1011
1067
  async registerCustomer(data) {
1068
+ if (this.isVibeCodedMode()) {
1069
+ return this.vibeCodedRequest("POST", "/customers/register", data);
1070
+ }
1012
1071
  if (this.storeId && !this.apiKey) {
1013
1072
  return this.storefrontRequest("POST", "/customers/register", data);
1014
1073
  }
@@ -1016,8 +1075,14 @@ var OmniSyncClient = class {
1016
1075
  }
1017
1076
  /**
1018
1077
  * Request a password reset email for a customer
1078
+ * Works in vibe-coded, storefront, and admin mode
1019
1079
  */
1020
1080
  async forgotPassword(email) {
1081
+ if (this.isVibeCodedMode()) {
1082
+ return this.vibeCodedRequest("POST", "/customers/forgot-password", {
1083
+ email
1084
+ });
1085
+ }
1021
1086
  if (this.storeId && !this.apiKey) {
1022
1087
  return this.storefrontRequest("POST", "/customers/forgot-password", {
1023
1088
  email
package/dist/index.mjs CHANGED
@@ -329,6 +329,54 @@ var OmniSyncClient = class {
329
329
  }
330
330
  return this.adminRequest("GET", `/api/v1/products/${productId}`);
331
331
  }
332
+ /**
333
+ * Get search suggestions for autocomplete
334
+ * Returns matching products and categories for quick search UI
335
+ * Works in vibe-coded and storefront mode
336
+ *
337
+ * @param query - Search query (minimum 1 character)
338
+ * @param limit - Maximum number of results (default 5, max 10)
339
+ * @returns Products and categories matching the query
340
+ *
341
+ * @example
342
+ * ```typescript
343
+ * // Basic autocomplete
344
+ * const suggestions = await omni.getSearchSuggestions('shirt');
345
+ * console.log(suggestions.products); // [{ id, name, image, basePrice, type }]
346
+ * console.log(suggestions.categories); // [{ id, name, productCount }]
347
+ *
348
+ * // With custom limit
349
+ * const suggestions = await omni.getSearchSuggestions('dress', 3);
350
+ * ```
351
+ */
352
+ async getSearchSuggestions(query, limit) {
353
+ if (!query || query.trim().length === 0) {
354
+ return { products: [], categories: [] };
355
+ }
356
+ const queryParams = { q: query, limit };
357
+ if (this.isVibeCodedMode()) {
358
+ return this.vibeCodedRequest(
359
+ "GET",
360
+ "/search/suggestions",
361
+ void 0,
362
+ queryParams
363
+ );
364
+ }
365
+ if (this.storeId && !this.apiKey) {
366
+ return this.storefrontRequest(
367
+ "GET",
368
+ "/search/suggestions",
369
+ void 0,
370
+ queryParams
371
+ );
372
+ }
373
+ return this.adminRequest(
374
+ "GET",
375
+ "/api/v1/search/suggestions",
376
+ void 0,
377
+ queryParams
378
+ );
379
+ }
332
380
  /**
333
381
  * Create a new product
334
382
  */
@@ -950,6 +998,7 @@ var OmniSyncClient = class {
950
998
  }
951
999
  /**
952
1000
  * Login an existing customer (returns JWT token)
1001
+ * Works in vibe-coded, storefront, and admin mode
953
1002
  *
954
1003
  * @example
955
1004
  * ```typescript
@@ -959,6 +1008,12 @@ var OmniSyncClient = class {
959
1008
  * ```
960
1009
  */
961
1010
  async loginCustomer(email, password) {
1011
+ if (this.isVibeCodedMode()) {
1012
+ return this.vibeCodedRequest("POST", "/customers/login", {
1013
+ email,
1014
+ password
1015
+ });
1016
+ }
962
1017
  if (this.storeId && !this.apiKey) {
963
1018
  return this.storefrontRequest("POST", "/customers/login", {
964
1019
  email,
@@ -972,6 +1027,7 @@ var OmniSyncClient = class {
972
1027
  }
973
1028
  /**
974
1029
  * Register a new customer with password (creates account)
1030
+ * Works in vibe-coded, storefront, and admin mode
975
1031
  *
976
1032
  * @example
977
1033
  * ```typescript
@@ -984,6 +1040,9 @@ var OmniSyncClient = class {
984
1040
  * ```
985
1041
  */
986
1042
  async registerCustomer(data) {
1043
+ if (this.isVibeCodedMode()) {
1044
+ return this.vibeCodedRequest("POST", "/customers/register", data);
1045
+ }
987
1046
  if (this.storeId && !this.apiKey) {
988
1047
  return this.storefrontRequest("POST", "/customers/register", data);
989
1048
  }
@@ -991,8 +1050,14 @@ var OmniSyncClient = class {
991
1050
  }
992
1051
  /**
993
1052
  * Request a password reset email for a customer
1053
+ * Works in vibe-coded, storefront, and admin mode
994
1054
  */
995
1055
  async forgotPassword(email) {
1056
+ if (this.isVibeCodedMode()) {
1057
+ return this.vibeCodedRequest("POST", "/customers/forgot-password", {
1058
+ email
1059
+ });
1060
+ }
996
1061
  if (this.storeId && !this.apiKey) {
997
1062
  return this.storefrontRequest("POST", "/customers/forgot-password", {
998
1063
  email
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omni-sync-sdk",
3
- "version": "0.7.3",
3
+ "version": "0.7.4",
4
4
  "description": "Official SDK for building e-commerce storefronts with OmniSync Platform. Perfect for vibe-coded sites, AI-built stores (Cursor, Lovable, v0), and custom storefronts.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -16,6 +16,14 @@
16
16
  "dist",
17
17
  "README.md"
18
18
  ],
19
+ "scripts": {
20
+ "build": "tsup src/index.ts --format cjs,esm --dts",
21
+ "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
22
+ "lint": "eslint \"src/**/*.ts\"",
23
+ "test": "vitest run",
24
+ "test:watch": "vitest",
25
+ "prepublishOnly": "pnpm build"
26
+ },
19
27
  "keywords": [
20
28
  "omni-sync",
21
29
  "e-commerce",
@@ -64,12 +72,5 @@
64
72
  "typescript": {
65
73
  "optional": true
66
74
  }
67
- },
68
- "scripts": {
69
- "build": "tsup src/index.ts --format cjs,esm --dts",
70
- "dev": "tsup src/index.ts --format cjs,esm --dts --watch",
71
- "lint": "eslint \"src/**/*.ts\"",
72
- "test": "vitest run",
73
- "test:watch": "vitest"
74
75
  }
75
- }
76
+ }
package/LICENSE DELETED
File without changes