omni-sync-sdk 0.7.4 → 0.7.6

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.mts CHANGED
@@ -1662,6 +1662,29 @@ declare class OmniSyncClient {
1662
1662
  forgotPassword(email: string): Promise<{
1663
1663
  message: string;
1664
1664
  }>;
1665
+ /**
1666
+ * Get the current logged-in customer's profile
1667
+ * Requires a customer token to be set via setCustomerToken()
1668
+ * Works in vibe-coded, storefront, and admin mode
1669
+ *
1670
+ * @example
1671
+ * ```typescript
1672
+ * // After login/register, set the token
1673
+ * omni.setCustomerToken(auth.token);
1674
+ *
1675
+ * // Then get the profile
1676
+ * const profile = await omni.getCustomerProfile();
1677
+ * console.log('Customer:', profile.email);
1678
+ * ```
1679
+ */
1680
+ getCustomerProfile(): Promise<{
1681
+ id: string;
1682
+ email: string;
1683
+ firstName?: string;
1684
+ lastName?: string;
1685
+ phone?: string;
1686
+ emailVerified: boolean;
1687
+ }>;
1665
1688
  /**
1666
1689
  * Get all addresses for a customer
1667
1690
  */
package/dist/index.d.ts CHANGED
@@ -1662,6 +1662,29 @@ declare class OmniSyncClient {
1662
1662
  forgotPassword(email: string): Promise<{
1663
1663
  message: string;
1664
1664
  }>;
1665
+ /**
1666
+ * Get the current logged-in customer's profile
1667
+ * Requires a customer token to be set via setCustomerToken()
1668
+ * Works in vibe-coded, storefront, and admin mode
1669
+ *
1670
+ * @example
1671
+ * ```typescript
1672
+ * // After login/register, set the token
1673
+ * omni.setCustomerToken(auth.token);
1674
+ *
1675
+ * // Then get the profile
1676
+ * const profile = await omni.getCustomerProfile();
1677
+ * console.log('Customer:', profile.email);
1678
+ * ```
1679
+ */
1680
+ getCustomerProfile(): Promise<{
1681
+ id: string;
1682
+ email: string;
1683
+ firstName?: string;
1684
+ lastName?: string;
1685
+ phone?: string;
1686
+ emailVerified: boolean;
1687
+ }>;
1665
1688
  /**
1666
1689
  * Get all addresses for a customer
1667
1690
  */
package/dist/index.js CHANGED
@@ -190,6 +190,9 @@ var OmniSyncClient = class {
190
190
  "X-SDK-Version": "0.3.0",
191
191
  "ngrok-skip-browser-warning": "true"
192
192
  };
193
+ if (this.customerToken) {
194
+ headers["Authorization"] = `Bearer ${this.customerToken}`;
195
+ }
193
196
  const response = await fetch(url.toString(), {
194
197
  method,
195
198
  headers,
@@ -1092,6 +1095,36 @@ var OmniSyncClient = class {
1092
1095
  email
1093
1096
  });
1094
1097
  }
1098
+ /**
1099
+ * Get the current logged-in customer's profile
1100
+ * Requires a customer token to be set via setCustomerToken()
1101
+ * Works in vibe-coded, storefront, and admin mode
1102
+ *
1103
+ * @example
1104
+ * ```typescript
1105
+ * // After login/register, set the token
1106
+ * omni.setCustomerToken(auth.token);
1107
+ *
1108
+ * // Then get the profile
1109
+ * const profile = await omni.getCustomerProfile();
1110
+ * console.log('Customer:', profile.email);
1111
+ * ```
1112
+ */
1113
+ async getCustomerProfile() {
1114
+ if (!this.customerToken) {
1115
+ throw new OmniSyncError("Customer token is required. Call setCustomerToken() first.", 401);
1116
+ }
1117
+ if (this.isVibeCodedMode()) {
1118
+ return this.vibeCodedRequest("GET", "/customers/me");
1119
+ }
1120
+ if (this.storeId && !this.apiKey) {
1121
+ return this.storefrontRequest("GET", "/customers/me");
1122
+ }
1123
+ throw new OmniSyncError(
1124
+ "getCustomerProfile() is not available in admin mode. Use getCustomer(id) instead.",
1125
+ 400
1126
+ );
1127
+ }
1095
1128
  /**
1096
1129
  * Get all addresses for a customer
1097
1130
  */
package/dist/index.mjs CHANGED
@@ -165,6 +165,9 @@ var OmniSyncClient = class {
165
165
  "X-SDK-Version": "0.3.0",
166
166
  "ngrok-skip-browser-warning": "true"
167
167
  };
168
+ if (this.customerToken) {
169
+ headers["Authorization"] = `Bearer ${this.customerToken}`;
170
+ }
168
171
  const response = await fetch(url.toString(), {
169
172
  method,
170
173
  headers,
@@ -1067,6 +1070,36 @@ var OmniSyncClient = class {
1067
1070
  email
1068
1071
  });
1069
1072
  }
1073
+ /**
1074
+ * Get the current logged-in customer's profile
1075
+ * Requires a customer token to be set via setCustomerToken()
1076
+ * Works in vibe-coded, storefront, and admin mode
1077
+ *
1078
+ * @example
1079
+ * ```typescript
1080
+ * // After login/register, set the token
1081
+ * omni.setCustomerToken(auth.token);
1082
+ *
1083
+ * // Then get the profile
1084
+ * const profile = await omni.getCustomerProfile();
1085
+ * console.log('Customer:', profile.email);
1086
+ * ```
1087
+ */
1088
+ async getCustomerProfile() {
1089
+ if (!this.customerToken) {
1090
+ throw new OmniSyncError("Customer token is required. Call setCustomerToken() first.", 401);
1091
+ }
1092
+ if (this.isVibeCodedMode()) {
1093
+ return this.vibeCodedRequest("GET", "/customers/me");
1094
+ }
1095
+ if (this.storeId && !this.apiKey) {
1096
+ return this.storefrontRequest("GET", "/customers/me");
1097
+ }
1098
+ throw new OmniSyncError(
1099
+ "getCustomerProfile() is not available in admin mode. Use getCustomer(id) instead.",
1100
+ 400
1101
+ );
1102
+ }
1070
1103
  /**
1071
1104
  * Get all addresses for a customer
1072
1105
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "omni-sync-sdk",
3
- "version": "0.7.4",
3
+ "version": "0.7.6",
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",