omni-sync-sdk 0.7.8 → 0.7.9
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 +18 -6
- package/dist/index.d.ts +18 -6
- package/dist/index.js +52 -18
- package/dist/index.mjs +52 -18
- package/package.json +10 -9
- package/LICENSE +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -1670,31 +1670,43 @@ declare class OmniSyncClient {
|
|
|
1670
1670
|
}>;
|
|
1671
1671
|
/**
|
|
1672
1672
|
* Verify customer email with a verification code
|
|
1673
|
-
* Requires a customer token to be set via setCustomerToken()
|
|
1674
1673
|
* Only available in vibe-coded mode
|
|
1675
1674
|
*
|
|
1675
|
+
* @param code - The 6-digit verification code from the email
|
|
1676
|
+
* @param token - Optional customer token. If not provided, uses the token set via setCustomerToken()
|
|
1677
|
+
*
|
|
1676
1678
|
* @example
|
|
1677
1679
|
* ```typescript
|
|
1678
|
-
* //
|
|
1680
|
+
* // Option 1: Pass token directly (recommended for verification flow)
|
|
1681
|
+
* const auth = await omni.registerCustomer({...});
|
|
1682
|
+
* if (auth.requiresVerification) {
|
|
1683
|
+
* const result = await omni.verifyEmail('123456', auth.token);
|
|
1684
|
+
* }
|
|
1685
|
+
*
|
|
1686
|
+
* // Option 2: Use setCustomerToken first
|
|
1679
1687
|
* omni.setCustomerToken(auth.token);
|
|
1680
1688
|
* const result = await omni.verifyEmail('123456');
|
|
1681
|
-
* console.log(result.verified); // true
|
|
1682
1689
|
* ```
|
|
1683
1690
|
*/
|
|
1684
|
-
verifyEmail(code: string): Promise<EmailVerificationResponse>;
|
|
1691
|
+
verifyEmail(code: string, token?: string): Promise<EmailVerificationResponse>;
|
|
1685
1692
|
/**
|
|
1686
1693
|
* Resend verification email
|
|
1687
|
-
* Requires a customer token to be set via setCustomerToken()
|
|
1688
1694
|
* Only available in vibe-coded mode
|
|
1689
1695
|
* Rate limited to 3 requests per hour
|
|
1690
1696
|
*
|
|
1697
|
+
* @param token - Optional customer token. If not provided, uses the token set via setCustomerToken()
|
|
1698
|
+
*
|
|
1691
1699
|
* @example
|
|
1692
1700
|
* ```typescript
|
|
1701
|
+
* // Option 1: Pass token directly
|
|
1702
|
+
* await omni.resendVerificationEmail(auth.token);
|
|
1703
|
+
*
|
|
1704
|
+
* // Option 2: Use setCustomerToken first
|
|
1693
1705
|
* omni.setCustomerToken(auth.token);
|
|
1694
1706
|
* await omni.resendVerificationEmail();
|
|
1695
1707
|
* ```
|
|
1696
1708
|
*/
|
|
1697
|
-
resendVerificationEmail(): Promise<{
|
|
1709
|
+
resendVerificationEmail(token?: string): Promise<{
|
|
1698
1710
|
message: string;
|
|
1699
1711
|
}>;
|
|
1700
1712
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1670,31 +1670,43 @@ declare class OmniSyncClient {
|
|
|
1670
1670
|
}>;
|
|
1671
1671
|
/**
|
|
1672
1672
|
* Verify customer email with a verification code
|
|
1673
|
-
* Requires a customer token to be set via setCustomerToken()
|
|
1674
1673
|
* Only available in vibe-coded mode
|
|
1675
1674
|
*
|
|
1675
|
+
* @param code - The 6-digit verification code from the email
|
|
1676
|
+
* @param token - Optional customer token. If not provided, uses the token set via setCustomerToken()
|
|
1677
|
+
*
|
|
1676
1678
|
* @example
|
|
1677
1679
|
* ```typescript
|
|
1678
|
-
* //
|
|
1680
|
+
* // Option 1: Pass token directly (recommended for verification flow)
|
|
1681
|
+
* const auth = await omni.registerCustomer({...});
|
|
1682
|
+
* if (auth.requiresVerification) {
|
|
1683
|
+
* const result = await omni.verifyEmail('123456', auth.token);
|
|
1684
|
+
* }
|
|
1685
|
+
*
|
|
1686
|
+
* // Option 2: Use setCustomerToken first
|
|
1679
1687
|
* omni.setCustomerToken(auth.token);
|
|
1680
1688
|
* const result = await omni.verifyEmail('123456');
|
|
1681
|
-
* console.log(result.verified); // true
|
|
1682
1689
|
* ```
|
|
1683
1690
|
*/
|
|
1684
|
-
verifyEmail(code: string): Promise<EmailVerificationResponse>;
|
|
1691
|
+
verifyEmail(code: string, token?: string): Promise<EmailVerificationResponse>;
|
|
1685
1692
|
/**
|
|
1686
1693
|
* Resend verification email
|
|
1687
|
-
* Requires a customer token to be set via setCustomerToken()
|
|
1688
1694
|
* Only available in vibe-coded mode
|
|
1689
1695
|
* Rate limited to 3 requests per hour
|
|
1690
1696
|
*
|
|
1697
|
+
* @param token - Optional customer token. If not provided, uses the token set via setCustomerToken()
|
|
1698
|
+
*
|
|
1691
1699
|
* @example
|
|
1692
1700
|
* ```typescript
|
|
1701
|
+
* // Option 1: Pass token directly
|
|
1702
|
+
* await omni.resendVerificationEmail(auth.token);
|
|
1703
|
+
*
|
|
1704
|
+
* // Option 2: Use setCustomerToken first
|
|
1693
1705
|
* omni.setCustomerToken(auth.token);
|
|
1694
1706
|
* await omni.resendVerificationEmail();
|
|
1695
1707
|
* ```
|
|
1696
1708
|
*/
|
|
1697
|
-
resendVerificationEmail(): Promise<{
|
|
1709
|
+
resendVerificationEmail(token?: string): Promise<{
|
|
1698
1710
|
message: string;
|
|
1699
1711
|
}>;
|
|
1700
1712
|
/**
|
package/dist/index.js
CHANGED
|
@@ -1097,48 +1097,82 @@ var OmniSyncClient = class {
|
|
|
1097
1097
|
}
|
|
1098
1098
|
/**
|
|
1099
1099
|
* Verify customer email with a verification code
|
|
1100
|
-
* Requires a customer token to be set via setCustomerToken()
|
|
1101
1100
|
* Only available in vibe-coded mode
|
|
1102
1101
|
*
|
|
1102
|
+
* @param code - The 6-digit verification code from the email
|
|
1103
|
+
* @param token - Optional customer token. If not provided, uses the token set via setCustomerToken()
|
|
1104
|
+
*
|
|
1103
1105
|
* @example
|
|
1104
1106
|
* ```typescript
|
|
1105
|
-
* //
|
|
1107
|
+
* // Option 1: Pass token directly (recommended for verification flow)
|
|
1108
|
+
* const auth = await omni.registerCustomer({...});
|
|
1109
|
+
* if (auth.requiresVerification) {
|
|
1110
|
+
* const result = await omni.verifyEmail('123456', auth.token);
|
|
1111
|
+
* }
|
|
1112
|
+
*
|
|
1113
|
+
* // Option 2: Use setCustomerToken first
|
|
1106
1114
|
* omni.setCustomerToken(auth.token);
|
|
1107
1115
|
* const result = await omni.verifyEmail('123456');
|
|
1108
|
-
* console.log(result.verified); // true
|
|
1109
1116
|
* ```
|
|
1110
1117
|
*/
|
|
1111
|
-
async verifyEmail(code) {
|
|
1112
|
-
|
|
1113
|
-
|
|
1118
|
+
async verifyEmail(code, token) {
|
|
1119
|
+
const effectiveToken = token || this.customerToken;
|
|
1120
|
+
if (!effectiveToken) {
|
|
1121
|
+
throw new OmniSyncError("Customer token is required. Pass token parameter or call setCustomerToken() first.", 401);
|
|
1114
1122
|
}
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1123
|
+
const originalToken = this.customerToken;
|
|
1124
|
+
if (token) {
|
|
1125
|
+
this.customerToken = token;
|
|
1126
|
+
}
|
|
1127
|
+
try {
|
|
1128
|
+
if (this.isVibeCodedMode()) {
|
|
1129
|
+
return await this.vibeCodedRequest("POST", "/customers/verify-email", {
|
|
1130
|
+
code
|
|
1131
|
+
});
|
|
1132
|
+
}
|
|
1133
|
+
throw new OmniSyncError("verifyEmail is only available in vibe-coded mode", 400);
|
|
1134
|
+
} finally {
|
|
1135
|
+
if (token) {
|
|
1136
|
+
this.customerToken = originalToken;
|
|
1137
|
+
}
|
|
1119
1138
|
}
|
|
1120
|
-
throw new OmniSyncError("verifyEmail is only available in vibe-coded mode", 400);
|
|
1121
1139
|
}
|
|
1122
1140
|
/**
|
|
1123
1141
|
* Resend verification email
|
|
1124
|
-
* Requires a customer token to be set via setCustomerToken()
|
|
1125
1142
|
* Only available in vibe-coded mode
|
|
1126
1143
|
* Rate limited to 3 requests per hour
|
|
1127
1144
|
*
|
|
1145
|
+
* @param token - Optional customer token. If not provided, uses the token set via setCustomerToken()
|
|
1146
|
+
*
|
|
1128
1147
|
* @example
|
|
1129
1148
|
* ```typescript
|
|
1149
|
+
* // Option 1: Pass token directly
|
|
1150
|
+
* await omni.resendVerificationEmail(auth.token);
|
|
1151
|
+
*
|
|
1152
|
+
* // Option 2: Use setCustomerToken first
|
|
1130
1153
|
* omni.setCustomerToken(auth.token);
|
|
1131
1154
|
* await omni.resendVerificationEmail();
|
|
1132
1155
|
* ```
|
|
1133
1156
|
*/
|
|
1134
|
-
async resendVerificationEmail() {
|
|
1135
|
-
|
|
1136
|
-
|
|
1157
|
+
async resendVerificationEmail(token) {
|
|
1158
|
+
const effectiveToken = token || this.customerToken;
|
|
1159
|
+
if (!effectiveToken) {
|
|
1160
|
+
throw new OmniSyncError("Customer token is required. Pass token parameter or call setCustomerToken() first.", 401);
|
|
1137
1161
|
}
|
|
1138
|
-
|
|
1139
|
-
|
|
1162
|
+
const originalToken = this.customerToken;
|
|
1163
|
+
if (token) {
|
|
1164
|
+
this.customerToken = token;
|
|
1165
|
+
}
|
|
1166
|
+
try {
|
|
1167
|
+
if (this.isVibeCodedMode()) {
|
|
1168
|
+
return await this.vibeCodedRequest("POST", "/customers/resend-verification");
|
|
1169
|
+
}
|
|
1170
|
+
throw new OmniSyncError("resendVerificationEmail is only available in vibe-coded mode", 400);
|
|
1171
|
+
} finally {
|
|
1172
|
+
if (token) {
|
|
1173
|
+
this.customerToken = originalToken;
|
|
1174
|
+
}
|
|
1140
1175
|
}
|
|
1141
|
-
throw new OmniSyncError("resendVerificationEmail is only available in vibe-coded mode", 400);
|
|
1142
1176
|
}
|
|
1143
1177
|
/**
|
|
1144
1178
|
* Get the current logged-in customer's profile
|
package/dist/index.mjs
CHANGED
|
@@ -1072,48 +1072,82 @@ var OmniSyncClient = class {
|
|
|
1072
1072
|
}
|
|
1073
1073
|
/**
|
|
1074
1074
|
* Verify customer email with a verification code
|
|
1075
|
-
* Requires a customer token to be set via setCustomerToken()
|
|
1076
1075
|
* Only available in vibe-coded mode
|
|
1077
1076
|
*
|
|
1077
|
+
* @param code - The 6-digit verification code from the email
|
|
1078
|
+
* @param token - Optional customer token. If not provided, uses the token set via setCustomerToken()
|
|
1079
|
+
*
|
|
1078
1080
|
* @example
|
|
1079
1081
|
* ```typescript
|
|
1080
|
-
* //
|
|
1082
|
+
* // Option 1: Pass token directly (recommended for verification flow)
|
|
1083
|
+
* const auth = await omni.registerCustomer({...});
|
|
1084
|
+
* if (auth.requiresVerification) {
|
|
1085
|
+
* const result = await omni.verifyEmail('123456', auth.token);
|
|
1086
|
+
* }
|
|
1087
|
+
*
|
|
1088
|
+
* // Option 2: Use setCustomerToken first
|
|
1081
1089
|
* omni.setCustomerToken(auth.token);
|
|
1082
1090
|
* const result = await omni.verifyEmail('123456');
|
|
1083
|
-
* console.log(result.verified); // true
|
|
1084
1091
|
* ```
|
|
1085
1092
|
*/
|
|
1086
|
-
async verifyEmail(code) {
|
|
1087
|
-
|
|
1088
|
-
|
|
1093
|
+
async verifyEmail(code, token) {
|
|
1094
|
+
const effectiveToken = token || this.customerToken;
|
|
1095
|
+
if (!effectiveToken) {
|
|
1096
|
+
throw new OmniSyncError("Customer token is required. Pass token parameter or call setCustomerToken() first.", 401);
|
|
1089
1097
|
}
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1098
|
+
const originalToken = this.customerToken;
|
|
1099
|
+
if (token) {
|
|
1100
|
+
this.customerToken = token;
|
|
1101
|
+
}
|
|
1102
|
+
try {
|
|
1103
|
+
if (this.isVibeCodedMode()) {
|
|
1104
|
+
return await this.vibeCodedRequest("POST", "/customers/verify-email", {
|
|
1105
|
+
code
|
|
1106
|
+
});
|
|
1107
|
+
}
|
|
1108
|
+
throw new OmniSyncError("verifyEmail is only available in vibe-coded mode", 400);
|
|
1109
|
+
} finally {
|
|
1110
|
+
if (token) {
|
|
1111
|
+
this.customerToken = originalToken;
|
|
1112
|
+
}
|
|
1094
1113
|
}
|
|
1095
|
-
throw new OmniSyncError("verifyEmail is only available in vibe-coded mode", 400);
|
|
1096
1114
|
}
|
|
1097
1115
|
/**
|
|
1098
1116
|
* Resend verification email
|
|
1099
|
-
* Requires a customer token to be set via setCustomerToken()
|
|
1100
1117
|
* Only available in vibe-coded mode
|
|
1101
1118
|
* Rate limited to 3 requests per hour
|
|
1102
1119
|
*
|
|
1120
|
+
* @param token - Optional customer token. If not provided, uses the token set via setCustomerToken()
|
|
1121
|
+
*
|
|
1103
1122
|
* @example
|
|
1104
1123
|
* ```typescript
|
|
1124
|
+
* // Option 1: Pass token directly
|
|
1125
|
+
* await omni.resendVerificationEmail(auth.token);
|
|
1126
|
+
*
|
|
1127
|
+
* // Option 2: Use setCustomerToken first
|
|
1105
1128
|
* omni.setCustomerToken(auth.token);
|
|
1106
1129
|
* await omni.resendVerificationEmail();
|
|
1107
1130
|
* ```
|
|
1108
1131
|
*/
|
|
1109
|
-
async resendVerificationEmail() {
|
|
1110
|
-
|
|
1111
|
-
|
|
1132
|
+
async resendVerificationEmail(token) {
|
|
1133
|
+
const effectiveToken = token || this.customerToken;
|
|
1134
|
+
if (!effectiveToken) {
|
|
1135
|
+
throw new OmniSyncError("Customer token is required. Pass token parameter or call setCustomerToken() first.", 401);
|
|
1112
1136
|
}
|
|
1113
|
-
|
|
1114
|
-
|
|
1137
|
+
const originalToken = this.customerToken;
|
|
1138
|
+
if (token) {
|
|
1139
|
+
this.customerToken = token;
|
|
1140
|
+
}
|
|
1141
|
+
try {
|
|
1142
|
+
if (this.isVibeCodedMode()) {
|
|
1143
|
+
return await this.vibeCodedRequest("POST", "/customers/resend-verification");
|
|
1144
|
+
}
|
|
1145
|
+
throw new OmniSyncError("resendVerificationEmail is only available in vibe-coded mode", 400);
|
|
1146
|
+
} finally {
|
|
1147
|
+
if (token) {
|
|
1148
|
+
this.customerToken = originalToken;
|
|
1149
|
+
}
|
|
1115
1150
|
}
|
|
1116
|
-
throw new OmniSyncError("resendVerificationEmail is only available in vibe-coded mode", 400);
|
|
1117
1151
|
}
|
|
1118
1152
|
/**
|
|
1119
1153
|
* Get the current logged-in customer's profile
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omni-sync-sdk",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.9",
|
|
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
|