omni-sync-sdk 0.7.4 → 0.7.5

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
@@ -1092,6 +1092,36 @@ var OmniSyncClient = class {
1092
1092
  email
1093
1093
  });
1094
1094
  }
1095
+ /**
1096
+ * Get the current logged-in customer's profile
1097
+ * Requires a customer token to be set via setCustomerToken()
1098
+ * Works in vibe-coded, storefront, and admin mode
1099
+ *
1100
+ * @example
1101
+ * ```typescript
1102
+ * // After login/register, set the token
1103
+ * omni.setCustomerToken(auth.token);
1104
+ *
1105
+ * // Then get the profile
1106
+ * const profile = await omni.getCustomerProfile();
1107
+ * console.log('Customer:', profile.email);
1108
+ * ```
1109
+ */
1110
+ async getCustomerProfile() {
1111
+ if (!this.customerToken) {
1112
+ throw new OmniSyncError("Customer token is required. Call setCustomerToken() first.", 401);
1113
+ }
1114
+ if (this.isVibeCodedMode()) {
1115
+ return this.vibeCodedRequest("GET", "/customers/me");
1116
+ }
1117
+ if (this.storeId && !this.apiKey) {
1118
+ return this.storefrontRequest("GET", "/customers/me");
1119
+ }
1120
+ throw new OmniSyncError(
1121
+ "getCustomerProfile() is not available in admin mode. Use getCustomer(id) instead.",
1122
+ 400
1123
+ );
1124
+ }
1095
1125
  /**
1096
1126
  * Get all addresses for a customer
1097
1127
  */
package/dist/index.mjs CHANGED
@@ -1067,6 +1067,36 @@ var OmniSyncClient = class {
1067
1067
  email
1068
1068
  });
1069
1069
  }
1070
+ /**
1071
+ * Get the current logged-in customer's profile
1072
+ * Requires a customer token to be set via setCustomerToken()
1073
+ * Works in vibe-coded, storefront, and admin mode
1074
+ *
1075
+ * @example
1076
+ * ```typescript
1077
+ * // After login/register, set the token
1078
+ * omni.setCustomerToken(auth.token);
1079
+ *
1080
+ * // Then get the profile
1081
+ * const profile = await omni.getCustomerProfile();
1082
+ * console.log('Customer:', profile.email);
1083
+ * ```
1084
+ */
1085
+ async getCustomerProfile() {
1086
+ if (!this.customerToken) {
1087
+ throw new OmniSyncError("Customer token is required. Call setCustomerToken() first.", 401);
1088
+ }
1089
+ if (this.isVibeCodedMode()) {
1090
+ return this.vibeCodedRequest("GET", "/customers/me");
1091
+ }
1092
+ if (this.storeId && !this.apiKey) {
1093
+ return this.storefrontRequest("GET", "/customers/me");
1094
+ }
1095
+ throw new OmniSyncError(
1096
+ "getCustomerProfile() is not available in admin mode. Use getCustomer(id) instead.",
1097
+ 400
1098
+ );
1099
+ }
1070
1100
  /**
1071
1101
  * Get all addresses for a customer
1072
1102
  */
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.5",
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",