@01.software/sdk 0.16.0 → 0.18.0
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 +38 -24
- package/dist/{const-BLwHrFZ-.d.cts → const-_gW__LA1.d.ts} +3 -3
- package/dist/{const-RMD3ZVaS.d.ts → const-zEoxAfGX.d.cts} +3 -3
- package/dist/index.cjs +38 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -15
- package/dist/index.d.ts +6 -15
- package/dist/index.js +38 -23
- package/dist/index.js.map +1 -1
- package/dist/{payload-types-DRvL_bS2.d.cts → payload-types-Cwnj_qN4.d.cts} +840 -276
- package/dist/{payload-types-DRvL_bS2.d.ts → payload-types-Cwnj_qN4.d.ts} +840 -276
- package/dist/realtime.d.cts +2 -2
- package/dist/realtime.d.ts +2 -2
- package/dist/ui/form.d.cts +1 -1
- package/dist/ui/form.d.ts +1 -1
- package/dist/ui/video.d.cts +1 -1
- package/dist/ui/video.d.ts +1 -1
- package/dist/webhook-Ce9uNv5c.d.cts +58 -0
- package/dist/webhook-ger4JSeS.d.ts +58 -0
- package/dist/webhook.cjs +29 -1
- package/dist/webhook.cjs.map +1 -1
- package/dist/webhook.d.cts +3 -3
- package/dist/webhook.d.ts +3 -3
- package/dist/webhook.js +29 -1
- package/dist/webhook.js.map +1 -1
- package/package.json +1 -1
- package/dist/webhook-7_KR18M-.d.ts +0 -20
- package/dist/webhook-CIcWL95t.d.cts +0 -20
package/dist/index.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { O as Order, a as Cart, b as CartItem, P as Product, c as OrderItem$1, T as Transaction, d as Fulfillment, R as Return } from './payload-types-
|
|
2
|
-
export { D as Document, I as Image, e as Post, f as PostCategory, g as PostTag, h as ProductVariant, i as Tenant, V as Video } from './payload-types-
|
|
1
|
+
import { O as Order, a as Cart, b as CartItem, P as Product, c as OrderItem$1, T as Transaction, d as Fulfillment, R as Return } from './payload-types-Cwnj_qN4.cjs';
|
|
2
|
+
export { D as Document, I as Image, e as Post, f as PostCategory, g as PostTag, h as ProductVariant, i as Tenant, V as Video } from './payload-types-Cwnj_qN4.cjs';
|
|
3
3
|
import { Sort, Where } from 'payload';
|
|
4
4
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
5
5
|
import { QueryClient, InfiniteData } from '@tanstack/react-query';
|
|
6
6
|
import { Metadata } from 'next';
|
|
7
|
-
import { C as CollectionType } from './webhook-
|
|
8
|
-
export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions,
|
|
9
|
-
import { P as PublicCollection } from './const-
|
|
10
|
-
export { a as COLLECTIONS, C as Collection, I as INTERNAL_COLLECTIONS } from './const-
|
|
7
|
+
import { C as CollectionType } from './webhook-Ce9uNv5c.cjs';
|
|
8
|
+
export { d as CUSTOMER_PASSWORD_RESET_OPERATION, g as CustomerAuthWebhookEvent, h as CustomerAuthWebhookHandlers, e as CustomerPasswordResetWebhookData, f as CustomerPasswordResetWebhookEvent, a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, k as createCustomerAuthWebhookHandler, m as createTypedWebhookHandler, l as handleWebhook, j as isCustomerPasswordResetWebhookEvent, i as isValidWebhookEvent } from './webhook-Ce9uNv5c.cjs';
|
|
9
|
+
import { P as PublicCollection } from './const-zEoxAfGX.cjs';
|
|
10
|
+
export { a as COLLECTIONS, C as Collection, I as INTERNAL_COLLECTIONS } from './const-zEoxAfGX.cjs';
|
|
11
11
|
export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-D7HtUpqt.cjs';
|
|
12
12
|
export { b as IMAGE_SIZES, I as ImageData, a as ImagePalette, f as ImagePlaceholderOptions, d as getImageLqip, e as getImagePalette, h as getImagePlaceholderStyle, c as getImageSrcSet, g as getImageUrl } from './image-TT8lTsk5.cjs';
|
|
13
13
|
export { e as VideoGifOptions, V as VideoThumbnailOptions, a as getVideoGif, c as getVideoMp4Url, d as getVideoStoryboard, b as getVideoStreamUrl, g as getVideoThumbnail } from './video-DbLL8yuc.cjs';
|
|
@@ -668,7 +668,6 @@ interface CustomerProfile {
|
|
|
668
668
|
phone?: string | null;
|
|
669
669
|
authProvider?: 'local' | 'google' | 'apple' | 'kakao' | 'naver' | null;
|
|
670
670
|
isGuest?: boolean | null;
|
|
671
|
-
isEmailVerified?: boolean | null;
|
|
672
671
|
marketingConsent?: MarketingConsent | null;
|
|
673
672
|
metadata?: Record<string, unknown> | null;
|
|
674
673
|
groups?: string[];
|
|
@@ -681,8 +680,6 @@ interface CustomerRegisterData {
|
|
|
681
680
|
}
|
|
682
681
|
interface CustomerRegisterResponse {
|
|
683
682
|
customer: CustomerProfile;
|
|
684
|
-
/** True when tenant requires email verification. Token delivered via webhook. */
|
|
685
|
-
verificationRequired?: boolean;
|
|
686
683
|
}
|
|
687
684
|
interface CustomerLoginData {
|
|
688
685
|
email: string;
|
|
@@ -763,10 +760,6 @@ declare class CustomerAuth {
|
|
|
763
760
|
* Change the password of the currently authenticated customer
|
|
764
761
|
*/
|
|
765
762
|
changePassword(currentPassword: string, newPassword: string): Promise<void>;
|
|
766
|
-
/**
|
|
767
|
-
* Verify email using the verification token
|
|
768
|
-
*/
|
|
769
|
-
verifyEmail(token: string): Promise<void>;
|
|
770
763
|
/**
|
|
771
764
|
* Get the authenticated customer's orders with pagination and optional status filter
|
|
772
765
|
*/
|
|
@@ -1358,7 +1351,6 @@ declare class CustomerHooks {
|
|
|
1358
1351
|
token: string;
|
|
1359
1352
|
password: string;
|
|
1360
1353
|
}, unknown>;
|
|
1361
|
-
useCustomerVerifyEmail(options?: MutationCallbacks<void>): _tanstack_react_query.UseMutationResult<void, SDKError, string, unknown>;
|
|
1362
1354
|
useCustomerRefreshToken(options?: MutationCallbacks<CustomerRefreshResponse>): _tanstack_react_query.UseMutationResult<CustomerRefreshResponse, SDKError, unknown, unknown>;
|
|
1363
1355
|
useCustomerUpdateProfile(options?: MutationCallbacks<CustomerProfile>): _tanstack_react_query.UseMutationResult<CustomerProfile, SDKError, UpdateProfileData, unknown>;
|
|
1364
1356
|
useCustomerChangePassword(options?: MutationCallbacks<void>): _tanstack_react_query.UseMutationResult<void, SDKError, {
|
|
@@ -1403,7 +1395,6 @@ declare class QueryHooks extends CollectionHooks {
|
|
|
1403
1395
|
useCustomerLogout: CustomerHooks['useCustomerLogout'];
|
|
1404
1396
|
useCustomerForgotPassword: CustomerHooks['useCustomerForgotPassword'];
|
|
1405
1397
|
useCustomerResetPassword: CustomerHooks['useCustomerResetPassword'];
|
|
1406
|
-
useCustomerVerifyEmail: CustomerHooks['useCustomerVerifyEmail'];
|
|
1407
1398
|
useCustomerRefreshToken: CustomerHooks['useCustomerRefreshToken'];
|
|
1408
1399
|
useCustomerUpdateProfile: CustomerHooks['useCustomerUpdateProfile'];
|
|
1409
1400
|
useCustomerChangePassword: CustomerHooks['useCustomerChangePassword'];
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { O as Order, a as Cart, b as CartItem, P as Product, c as OrderItem$1, T as Transaction, d as Fulfillment, R as Return } from './payload-types-
|
|
2
|
-
export { D as Document, I as Image, e as Post, f as PostCategory, g as PostTag, h as ProductVariant, i as Tenant, V as Video } from './payload-types-
|
|
1
|
+
import { O as Order, a as Cart, b as CartItem, P as Product, c as OrderItem$1, T as Transaction, d as Fulfillment, R as Return } from './payload-types-Cwnj_qN4.js';
|
|
2
|
+
export { D as Document, I as Image, e as Post, f as PostCategory, g as PostTag, h as ProductVariant, i as Tenant, V as Video } from './payload-types-Cwnj_qN4.js';
|
|
3
3
|
import { Sort, Where } from 'payload';
|
|
4
4
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
5
5
|
import { QueryClient, InfiniteData } from '@tanstack/react-query';
|
|
6
6
|
import { Metadata } from 'next';
|
|
7
|
-
import { C as CollectionType } from './webhook-
|
|
8
|
-
export { a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions,
|
|
9
|
-
import { P as PublicCollection } from './const-
|
|
10
|
-
export { a as COLLECTIONS, C as Collection, I as INTERNAL_COLLECTIONS } from './const-
|
|
7
|
+
import { C as CollectionType } from './webhook-ger4JSeS.js';
|
|
8
|
+
export { d as CUSTOMER_PASSWORD_RESET_OPERATION, g as CustomerAuthWebhookEvent, h as CustomerAuthWebhookHandlers, e as CustomerPasswordResetWebhookData, f as CustomerPasswordResetWebhookEvent, a as WebhookEvent, b as WebhookHandler, W as WebhookOperation, c as WebhookOptions, k as createCustomerAuthWebhookHandler, m as createTypedWebhookHandler, l as handleWebhook, j as isCustomerPasswordResetWebhookEvent, i as isValidWebhookEvent } from './webhook-ger4JSeS.js';
|
|
9
|
+
import { P as PublicCollection } from './const-_gW__LA1.js';
|
|
10
|
+
export { a as COLLECTIONS, C as Collection, I as INTERNAL_COLLECTIONS } from './const-_gW__LA1.js';
|
|
11
11
|
export { a as RealtimeConnection, R as RealtimeEvent, b as RealtimeListener } from './realtime-D7HtUpqt.js';
|
|
12
12
|
export { b as IMAGE_SIZES, I as ImageData, a as ImagePalette, f as ImagePlaceholderOptions, d as getImageLqip, e as getImagePalette, h as getImagePlaceholderStyle, c as getImageSrcSet, g as getImageUrl } from './image-TT8lTsk5.js';
|
|
13
13
|
export { e as VideoGifOptions, V as VideoThumbnailOptions, a as getVideoGif, c as getVideoMp4Url, d as getVideoStoryboard, b as getVideoStreamUrl, g as getVideoThumbnail } from './video-DbLL8yuc.js';
|
|
@@ -668,7 +668,6 @@ interface CustomerProfile {
|
|
|
668
668
|
phone?: string | null;
|
|
669
669
|
authProvider?: 'local' | 'google' | 'apple' | 'kakao' | 'naver' | null;
|
|
670
670
|
isGuest?: boolean | null;
|
|
671
|
-
isEmailVerified?: boolean | null;
|
|
672
671
|
marketingConsent?: MarketingConsent | null;
|
|
673
672
|
metadata?: Record<string, unknown> | null;
|
|
674
673
|
groups?: string[];
|
|
@@ -681,8 +680,6 @@ interface CustomerRegisterData {
|
|
|
681
680
|
}
|
|
682
681
|
interface CustomerRegisterResponse {
|
|
683
682
|
customer: CustomerProfile;
|
|
684
|
-
/** True when tenant requires email verification. Token delivered via webhook. */
|
|
685
|
-
verificationRequired?: boolean;
|
|
686
683
|
}
|
|
687
684
|
interface CustomerLoginData {
|
|
688
685
|
email: string;
|
|
@@ -763,10 +760,6 @@ declare class CustomerAuth {
|
|
|
763
760
|
* Change the password of the currently authenticated customer
|
|
764
761
|
*/
|
|
765
762
|
changePassword(currentPassword: string, newPassword: string): Promise<void>;
|
|
766
|
-
/**
|
|
767
|
-
* Verify email using the verification token
|
|
768
|
-
*/
|
|
769
|
-
verifyEmail(token: string): Promise<void>;
|
|
770
763
|
/**
|
|
771
764
|
* Get the authenticated customer's orders with pagination and optional status filter
|
|
772
765
|
*/
|
|
@@ -1358,7 +1351,6 @@ declare class CustomerHooks {
|
|
|
1358
1351
|
token: string;
|
|
1359
1352
|
password: string;
|
|
1360
1353
|
}, unknown>;
|
|
1361
|
-
useCustomerVerifyEmail(options?: MutationCallbacks<void>): _tanstack_react_query.UseMutationResult<void, SDKError, string, unknown>;
|
|
1362
1354
|
useCustomerRefreshToken(options?: MutationCallbacks<CustomerRefreshResponse>): _tanstack_react_query.UseMutationResult<CustomerRefreshResponse, SDKError, unknown, unknown>;
|
|
1363
1355
|
useCustomerUpdateProfile(options?: MutationCallbacks<CustomerProfile>): _tanstack_react_query.UseMutationResult<CustomerProfile, SDKError, UpdateProfileData, unknown>;
|
|
1364
1356
|
useCustomerChangePassword(options?: MutationCallbacks<void>): _tanstack_react_query.UseMutationResult<void, SDKError, {
|
|
@@ -1403,7 +1395,6 @@ declare class QueryHooks extends CollectionHooks {
|
|
|
1403
1395
|
useCustomerLogout: CustomerHooks['useCustomerLogout'];
|
|
1404
1396
|
useCustomerForgotPassword: CustomerHooks['useCustomerForgotPassword'];
|
|
1405
1397
|
useCustomerResetPassword: CustomerHooks['useCustomerResetPassword'];
|
|
1406
|
-
useCustomerVerifyEmail: CustomerHooks['useCustomerVerifyEmail'];
|
|
1407
1398
|
useCustomerRefreshToken: CustomerHooks['useCustomerRefreshToken'];
|
|
1408
1399
|
useCustomerUpdateProfile: CustomerHooks['useCustomerUpdateProfile'];
|
|
1409
1400
|
useCustomerChangePassword: CustomerHooks['useCustomerChangePassword'];
|
package/dist/index.js
CHANGED
|
@@ -966,8 +966,6 @@ var INTERNAL_COLLECTIONS = [
|
|
|
966
966
|
"track-assets",
|
|
967
967
|
"audiences",
|
|
968
968
|
"email-logs",
|
|
969
|
-
"tenant-auth-settings",
|
|
970
|
-
"tenant-community-settings",
|
|
971
969
|
"api-usage",
|
|
972
970
|
"tenant-analytics-daily",
|
|
973
971
|
"analytics-event-schemas",
|
|
@@ -981,7 +979,8 @@ var INTERNAL_COLLECTIONS = [
|
|
|
981
979
|
"webhook-deliveries",
|
|
982
980
|
"audit-logs",
|
|
983
981
|
"plans",
|
|
984
|
-
"webhooks"
|
|
982
|
+
"webhooks",
|
|
983
|
+
"event-registrations"
|
|
985
984
|
];
|
|
986
985
|
var COLLECTIONS = [
|
|
987
986
|
"tenants",
|
|
@@ -1004,6 +1003,7 @@ var COLLECTIONS = [
|
|
|
1004
1003
|
"fulfillment-items",
|
|
1005
1004
|
"transactions",
|
|
1006
1005
|
"customers",
|
|
1006
|
+
"customer-profiles",
|
|
1007
1007
|
"customer-addresses",
|
|
1008
1008
|
"customer-groups",
|
|
1009
1009
|
"carts",
|
|
@@ -1053,7 +1053,12 @@ var COLLECTIONS = [
|
|
|
1053
1053
|
"bookmarks",
|
|
1054
1054
|
"thread-categories",
|
|
1055
1055
|
"reports",
|
|
1056
|
-
"community-bans"
|
|
1056
|
+
"community-bans",
|
|
1057
|
+
// Events
|
|
1058
|
+
"event-calendars",
|
|
1059
|
+
"events",
|
|
1060
|
+
"event-occurrences",
|
|
1061
|
+
"event-tags"
|
|
1057
1062
|
];
|
|
1058
1063
|
|
|
1059
1064
|
// src/core/api/parse-response.ts
|
|
@@ -1469,15 +1474,6 @@ var CustomerAuth = class {
|
|
|
1469
1474
|
body: JSON.stringify({ currentPassword, newPassword })
|
|
1470
1475
|
});
|
|
1471
1476
|
}
|
|
1472
|
-
/**
|
|
1473
|
-
* Verify email using the verification token
|
|
1474
|
-
*/
|
|
1475
|
-
async verifyEmail(token) {
|
|
1476
|
-
await this.requestJson("/api/customers/verify-email", {
|
|
1477
|
-
method: "POST",
|
|
1478
|
-
body: JSON.stringify({ token })
|
|
1479
|
-
});
|
|
1480
|
-
}
|
|
1481
1477
|
/**
|
|
1482
1478
|
* Get the authenticated customer's orders with pagination and optional status filter
|
|
1483
1479
|
*/
|
|
@@ -2215,14 +2211,6 @@ var CustomerHooks = class {
|
|
|
2215
2211
|
options
|
|
2216
2212
|
);
|
|
2217
2213
|
}
|
|
2218
|
-
useCustomerVerifyEmail(options) {
|
|
2219
|
-
return createMutation(
|
|
2220
|
-
(token) => this.ensureCustomerAuth().verifyEmail(token).then(() => {
|
|
2221
|
-
}),
|
|
2222
|
-
options,
|
|
2223
|
-
this.invalidateMe
|
|
2224
|
-
);
|
|
2225
|
-
}
|
|
2226
2214
|
useCustomerRefreshToken(options) {
|
|
2227
2215
|
return createMutation(
|
|
2228
2216
|
() => this.ensureCustomerAuth().refreshToken(),
|
|
@@ -2267,7 +2255,6 @@ var QueryHooks = class extends CollectionHooks {
|
|
|
2267
2255
|
this.useCustomerLogout = (...args) => this._customer.useCustomerLogout(...args);
|
|
2268
2256
|
this.useCustomerForgotPassword = (...args) => this._customer.useCustomerForgotPassword(...args);
|
|
2269
2257
|
this.useCustomerResetPassword = (...args) => this._customer.useCustomerResetPassword(...args);
|
|
2270
|
-
this.useCustomerVerifyEmail = (...args) => this._customer.useCustomerVerifyEmail(...args);
|
|
2271
2258
|
this.useCustomerRefreshToken = (...args) => this._customer.useCustomerRefreshToken(...args);
|
|
2272
2259
|
this.useCustomerUpdateProfile = (...args) => this._customer.useCustomerUpdateProfile(...args);
|
|
2273
2260
|
this.useCustomerChangePassword = (...args) => this._customer.useCustomerChangePassword(...args);
|
|
@@ -2651,7 +2638,32 @@ var RealtimeConnection = class {
|
|
|
2651
2638
|
function isValidWebhookEvent(data) {
|
|
2652
2639
|
if (typeof data !== "object" || data === null) return false;
|
|
2653
2640
|
const obj = data;
|
|
2654
|
-
return typeof obj.collection === "string" &&
|
|
2641
|
+
return typeof obj.collection === "string" && typeof obj.operation === "string" && obj.operation.length > 0 && typeof obj.data === "object" && obj.data !== null;
|
|
2642
|
+
}
|
|
2643
|
+
var CUSTOMER_PASSWORD_RESET_OPERATION = "password-reset";
|
|
2644
|
+
function isRecord(value) {
|
|
2645
|
+
return typeof value === "object" && value !== null;
|
|
2646
|
+
}
|
|
2647
|
+
function hasString(value, key) {
|
|
2648
|
+
return typeof value[key] === "string";
|
|
2649
|
+
}
|
|
2650
|
+
function hasStringOrNumber(value, key) {
|
|
2651
|
+
return typeof value[key] === "string" || typeof value[key] === "number";
|
|
2652
|
+
}
|
|
2653
|
+
function isCustomerPasswordResetWebhookEvent(event) {
|
|
2654
|
+
if (event.collection !== "customers" || event.operation !== CUSTOMER_PASSWORD_RESET_OPERATION || !isRecord(event.data)) {
|
|
2655
|
+
return false;
|
|
2656
|
+
}
|
|
2657
|
+
return hasStringOrNumber(event.data, "customerId") && hasString(event.data, "email") && hasString(event.data, "name") && hasString(event.data, "resetPasswordToken") && hasString(event.data, "resetPasswordExpiresAt");
|
|
2658
|
+
}
|
|
2659
|
+
function createCustomerAuthWebhookHandler(handlers) {
|
|
2660
|
+
return async (event) => {
|
|
2661
|
+
if (isCustomerPasswordResetWebhookEvent(event) && handlers.passwordReset) {
|
|
2662
|
+
await handlers.passwordReset(event.data, event);
|
|
2663
|
+
return;
|
|
2664
|
+
}
|
|
2665
|
+
await handlers.unhandled?.(event);
|
|
2666
|
+
};
|
|
2655
2667
|
}
|
|
2656
2668
|
async function verifySignature(payload, secret, signature) {
|
|
2657
2669
|
const encoder = new TextEncoder();
|
|
@@ -3243,6 +3255,7 @@ export {
|
|
|
3243
3255
|
AuthError,
|
|
3244
3256
|
BaseApi,
|
|
3245
3257
|
COLLECTIONS,
|
|
3258
|
+
CUSTOMER_PASSWORD_RESET_OPERATION,
|
|
3246
3259
|
CartApi,
|
|
3247
3260
|
Client,
|
|
3248
3261
|
CollectionClient,
|
|
@@ -3284,6 +3297,7 @@ export {
|
|
|
3284
3297
|
createAuthError,
|
|
3285
3298
|
createClient,
|
|
3286
3299
|
createConflictError,
|
|
3300
|
+
createCustomerAuthWebhookHandler,
|
|
3287
3301
|
createNotFoundError,
|
|
3288
3302
|
createPermissionError,
|
|
3289
3303
|
createRateLimitError,
|
|
@@ -3310,6 +3324,7 @@ export {
|
|
|
3310
3324
|
isAuthError,
|
|
3311
3325
|
isConfigError,
|
|
3312
3326
|
isConflictError,
|
|
3327
|
+
isCustomerPasswordResetWebhookEvent,
|
|
3313
3328
|
isGoneError,
|
|
3314
3329
|
isNetworkError,
|
|
3315
3330
|
isNotFoundError,
|