@23blocks/block-onboarding 1.0.3 → 1.0.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.
Files changed (72) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.esm.js +440 -0
  3. package/dist/src/index.d.ts +7 -0
  4. package/dist/src/index.d.ts.map +1 -0
  5. package/dist/src/lib/mappers/flow.mapper.d.ts +4 -0
  6. package/dist/src/lib/mappers/flow.mapper.d.ts.map +1 -0
  7. package/dist/{lib/mappers/index.js → src/lib/mappers/index.d.ts} +1 -2
  8. package/dist/src/lib/mappers/index.d.ts.map +1 -0
  9. package/dist/src/lib/mappers/onboarding.mapper.d.ts +4 -0
  10. package/dist/src/lib/mappers/onboarding.mapper.d.ts.map +1 -0
  11. package/dist/src/lib/mappers/user-identity.mapper.d.ts +4 -0
  12. package/dist/src/lib/mappers/user-identity.mapper.d.ts.map +1 -0
  13. package/dist/src/lib/mappers/user-journey.mapper.d.ts +4 -0
  14. package/dist/src/lib/mappers/user-journey.mapper.d.ts.map +1 -0
  15. package/dist/src/lib/mappers/utils.d.ts +45 -0
  16. package/dist/src/lib/mappers/utils.d.ts.map +1 -0
  17. package/dist/src/lib/onboarding.block.d.ts +15 -0
  18. package/dist/src/lib/onboarding.block.d.ts.map +1 -0
  19. package/dist/src/lib/services/flows.service.d.ts +14 -0
  20. package/dist/src/lib/services/flows.service.d.ts.map +1 -0
  21. package/dist/{lib/services/index.js → src/lib/services/index.d.ts} +1 -2
  22. package/dist/src/lib/services/index.d.ts.map +1 -0
  23. package/dist/src/lib/services/onboardings.service.d.ts +13 -0
  24. package/dist/src/lib/services/onboardings.service.d.ts.map +1 -0
  25. package/dist/src/lib/services/user-identities.service.d.ts +14 -0
  26. package/dist/src/lib/services/user-identities.service.d.ts.map +1 -0
  27. package/dist/src/lib/services/user-journeys.service.d.ts +19 -0
  28. package/dist/src/lib/services/user-journeys.service.d.ts.map +1 -0
  29. package/dist/src/lib/types/flow.d.ts +41 -0
  30. package/dist/src/lib/types/flow.d.ts.map +1 -0
  31. package/dist/{lib/types/index.js → src/lib/types/index.d.ts} +1 -2
  32. package/dist/src/lib/types/index.d.ts.map +1 -0
  33. package/dist/src/lib/types/onboarding.d.ts +35 -0
  34. package/dist/src/lib/types/onboarding.d.ts.map +1 -0
  35. package/dist/src/lib/types/user-identity.d.ts +32 -0
  36. package/dist/src/lib/types/user-identity.d.ts.map +1 -0
  37. package/dist/src/lib/types/user-journey.d.ts +35 -0
  38. package/dist/src/lib/types/user-journey.d.ts.map +1 -0
  39. package/package.json +10 -8
  40. package/dist/index.js +0 -7
  41. package/dist/index.js.map +0 -1
  42. package/dist/lib/mappers/flow.mapper.js +0 -21
  43. package/dist/lib/mappers/flow.mapper.js.map +0 -1
  44. package/dist/lib/mappers/index.js.map +0 -1
  45. package/dist/lib/mappers/onboarding.mapper.js +0 -19
  46. package/dist/lib/mappers/onboarding.mapper.js.map +0 -1
  47. package/dist/lib/mappers/user-identity.mapper.js +0 -20
  48. package/dist/lib/mappers/user-identity.mapper.js.map +0 -1
  49. package/dist/lib/mappers/user-journey.mapper.js +0 -22
  50. package/dist/lib/mappers/user-journey.mapper.js.map +0 -1
  51. package/dist/lib/mappers/utils.js +0 -117
  52. package/dist/lib/mappers/utils.js.map +0 -1
  53. package/dist/lib/onboarding.block.js +0 -22
  54. package/dist/lib/onboarding.block.js.map +0 -1
  55. package/dist/lib/services/flows.service.js +0 -67
  56. package/dist/lib/services/flows.service.js.map +0 -1
  57. package/dist/lib/services/index.js.map +0 -1
  58. package/dist/lib/services/onboardings.service.js +0 -59
  59. package/dist/lib/services/onboardings.service.js.map +0 -1
  60. package/dist/lib/services/user-identities.service.js +0 -59
  61. package/dist/lib/services/user-identities.service.js.map +0 -1
  62. package/dist/lib/services/user-journeys.service.js +0 -74
  63. package/dist/lib/services/user-journeys.service.js.map +0 -1
  64. package/dist/lib/types/flow.js +0 -3
  65. package/dist/lib/types/flow.js.map +0 -1
  66. package/dist/lib/types/index.js.map +0 -1
  67. package/dist/lib/types/onboarding.js +0 -3
  68. package/dist/lib/types/onboarding.js.map +0 -1
  69. package/dist/lib/types/user-identity.js +0 -3
  70. package/dist/lib/types/user-identity.js.map +0 -1
  71. package/dist/lib/types/user-journey.js +0 -3
  72. package/dist/lib/types/user-journey.js.map +0 -1
@@ -0,0 +1,19 @@
1
+ import type { Transport, PageResult } from '@23blocks/contracts';
2
+ import type { UserJourney, StartJourneyRequest, CompleteStepRequest, ListUserJourneysParams } from '../types/user-journey';
3
+ export interface UserJourneysService {
4
+ list(params?: ListUserJourneysParams): Promise<PageResult<UserJourney>>;
5
+ get(uniqueId: string): Promise<UserJourney>;
6
+ start(data: StartJourneyRequest): Promise<UserJourney>;
7
+ completeStep(uniqueId: string, data: CompleteStepRequest): Promise<UserJourney>;
8
+ abandon(uniqueId: string): Promise<UserJourney>;
9
+ getByUser(userUniqueId: string): Promise<UserJourney[]>;
10
+ getProgress(uniqueId: string): Promise<{
11
+ progress: number;
12
+ currentStep?: number;
13
+ completedSteps?: number[];
14
+ }>;
15
+ }
16
+ export declare function createUserJourneysService(transport: Transport, _config: {
17
+ appId: string;
18
+ }): UserJourneysService;
19
+ //# sourceMappingURL=user-journeys.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-journeys.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/services/user-journeys.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,KAAK,EACV,WAAW,EACX,mBAAmB,EACnB,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAG/B,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,MAAM,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;IACxE,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC5C,KAAK,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACvD,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAChF,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAChD,SAAS,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IACxD,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;CAC/G;AAED,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,mBAAmB,CA0E/G"}
@@ -0,0 +1,41 @@
1
+ import type { IdentityCore, EntityStatus } from '@23blocks/contracts';
2
+ export interface Flow extends IdentityCore {
3
+ onboardingUniqueId: string;
4
+ code: string;
5
+ name: string;
6
+ description?: string;
7
+ steps?: Record<string, unknown>[];
8
+ conditions?: Record<string, unknown>;
9
+ status: EntityStatus;
10
+ enabled: boolean;
11
+ payload?: Record<string, unknown>;
12
+ }
13
+ export interface CreateFlowRequest {
14
+ onboardingUniqueId: string;
15
+ code: string;
16
+ name: string;
17
+ description?: string;
18
+ steps?: Record<string, unknown>[];
19
+ conditions?: Record<string, unknown>;
20
+ payload?: Record<string, unknown>;
21
+ }
22
+ export interface UpdateFlowRequest {
23
+ name?: string;
24
+ description?: string;
25
+ steps?: Record<string, unknown>[];
26
+ conditions?: Record<string, unknown>;
27
+ enabled?: boolean;
28
+ status?: EntityStatus;
29
+ payload?: Record<string, unknown>;
30
+ }
31
+ export interface ListFlowsParams {
32
+ page?: number;
33
+ perPage?: number;
34
+ onboardingUniqueId?: string;
35
+ status?: EntityStatus;
36
+ enabled?: boolean;
37
+ search?: string;
38
+ sortBy?: string;
39
+ sortOrder?: 'asc' | 'desc';
40
+ }
41
+ //# sourceMappingURL=flow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/flow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEtE,MAAM,WAAW,IAAK,SAAQ,YAAY;IACxC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,iBAAiB;IAChC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CAC5B"}
@@ -2,5 +2,4 @@ export * from './onboarding';
2
2
  export * from './flow';
3
3
  export * from './user-journey';
4
4
  export * from './user-identity';
5
-
6
- //# sourceMappingURL=index.js.map
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,35 @@
1
+ import type { IdentityCore, EntityStatus } from '@23blocks/contracts';
2
+ export interface Onboarding extends IdentityCore {
3
+ code: string;
4
+ name: string;
5
+ description?: string;
6
+ steps?: Record<string, unknown>[];
7
+ status: EntityStatus;
8
+ enabled: boolean;
9
+ payload?: Record<string, unknown>;
10
+ }
11
+ export interface CreateOnboardingRequest {
12
+ code: string;
13
+ name: string;
14
+ description?: string;
15
+ steps?: Record<string, unknown>[];
16
+ payload?: Record<string, unknown>;
17
+ }
18
+ export interface UpdateOnboardingRequest {
19
+ name?: string;
20
+ description?: string;
21
+ steps?: Record<string, unknown>[];
22
+ enabled?: boolean;
23
+ status?: EntityStatus;
24
+ payload?: Record<string, unknown>;
25
+ }
26
+ export interface ListOnboardingsParams {
27
+ page?: number;
28
+ perPage?: number;
29
+ status?: EntityStatus;
30
+ enabled?: boolean;
31
+ search?: string;
32
+ sortBy?: string;
33
+ sortOrder?: 'asc' | 'desc';
34
+ }
35
+ //# sourceMappingURL=onboarding.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onboarding.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/onboarding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEtE,MAAM,WAAW,UAAW,SAAQ,YAAY;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAClC,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CAC5B"}
@@ -0,0 +1,32 @@
1
+ import type { IdentityCore, EntityStatus } from '@23blocks/contracts';
2
+ export interface UserIdentity extends IdentityCore {
3
+ userUniqueId: string;
4
+ identityType: string;
5
+ identityValue: string;
6
+ verified: boolean;
7
+ verifiedAt?: Date;
8
+ status: EntityStatus;
9
+ enabled: boolean;
10
+ payload?: Record<string, unknown>;
11
+ }
12
+ export interface CreateUserIdentityRequest {
13
+ userUniqueId: string;
14
+ identityType: string;
15
+ identityValue: string;
16
+ payload?: Record<string, unknown>;
17
+ }
18
+ export interface VerifyUserIdentityRequest {
19
+ verificationCode?: string;
20
+ verificationData?: Record<string, unknown>;
21
+ }
22
+ export interface ListUserIdentitiesParams {
23
+ page?: number;
24
+ perPage?: number;
25
+ userUniqueId?: string;
26
+ identityType?: string;
27
+ verified?: boolean;
28
+ status?: EntityStatus;
29
+ sortBy?: string;
30
+ sortOrder?: 'asc' | 'desc';
31
+ }
32
+ //# sourceMappingURL=user-identity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-identity.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/user-identity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEtE,MAAM,WAAW,YAAa,SAAQ,YAAY;IAChD,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,yBAAyB;IACxC,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,yBAAyB;IACxC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CAC5B"}
@@ -0,0 +1,35 @@
1
+ import type { IdentityCore } from '@23blocks/contracts';
2
+ export type UserJourneyStatus = 'active' | 'completed' | 'abandoned';
3
+ export interface UserJourney extends IdentityCore {
4
+ userUniqueId: string;
5
+ onboardingUniqueId: string;
6
+ flowUniqueId?: string;
7
+ currentStep?: number;
8
+ completedSteps?: number[];
9
+ progress?: number;
10
+ startedAt: Date;
11
+ completedAt?: Date;
12
+ status: UserJourneyStatus;
13
+ payload?: Record<string, unknown>;
14
+ }
15
+ export interface StartJourneyRequest {
16
+ userUniqueId: string;
17
+ onboardingUniqueId: string;
18
+ flowUniqueId?: string;
19
+ payload?: Record<string, unknown>;
20
+ }
21
+ export interface CompleteStepRequest {
22
+ stepNumber: number;
23
+ stepData?: Record<string, unknown>;
24
+ }
25
+ export interface ListUserJourneysParams {
26
+ page?: number;
27
+ perPage?: number;
28
+ userUniqueId?: string;
29
+ onboardingUniqueId?: string;
30
+ flowUniqueId?: string;
31
+ status?: UserJourneyStatus;
32
+ sortBy?: string;
33
+ sortOrder?: 'asc' | 'desc';
34
+ }
35
+ //# sourceMappingURL=user-journey.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-journey.d.ts","sourceRoot":"","sources":["../../../../src/lib/types/user-journey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,WAAW,GAAG,WAAW,CAAC;AAErE,MAAM,WAAW,WAAY,SAAQ,YAAY;IAC/C,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,IAAI,CAAC;IAChB,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CAC5B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@23blocks/block-onboarding",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Onboarding block for 23blocks SDK - user journeys, flows, and identity verification",
5
5
  "license": "MIT",
6
6
  "author": "23blocks <hello@23blocks.com>",
@@ -22,15 +22,15 @@
22
22
  "identity-verification"
23
23
  ],
24
24
  "type": "module",
25
- "main": "./dist/index.js",
26
- "module": "./dist/index.js",
25
+ "main": "./dist/index.esm.js",
26
+ "module": "./dist/index.esm.js",
27
27
  "types": "./dist/index.d.ts",
28
28
  "exports": {
29
29
  "./package.json": "./package.json",
30
30
  ".": {
31
31
  "types": "./dist/index.d.ts",
32
- "import": "./dist/index.js",
33
- "default": "./dist/index.js"
32
+ "import": "./dist/index.esm.js",
33
+ "default": "./dist/index.esm.js"
34
34
  }
35
35
  },
36
36
  "files": [
@@ -41,7 +41,7 @@
41
41
  "sourceRoot": "packages/block-onboarding/src",
42
42
  "targets": {
43
43
  "build": {
44
- "executor": "@nx/js:swc",
44
+ "executor": "@nx/rollup:rollup",
45
45
  "outputs": [
46
46
  "{options.outputPath}"
47
47
  ],
@@ -49,8 +49,10 @@
49
49
  "outputPath": "packages/block-onboarding/dist",
50
50
  "main": "packages/block-onboarding/src/index.ts",
51
51
  "tsConfig": "packages/block-onboarding/tsconfig.lib.json",
52
- "skipTypeCheck": true,
53
- "stripLeadingPaths": true
52
+ "compiler": "swc",
53
+ "format": [
54
+ "esm"
55
+ ]
54
56
  }
55
57
  }
56
58
  }
package/dist/index.js DELETED
@@ -1,7 +0,0 @@
1
- // Block factory and metadata
2
- export { createOnboardingBlock, onboardingBlockMetadata } from './lib/onboarding.block';
3
- export { createOnboardingsService, createFlowsService, createUserJourneysService, createUserIdentitiesService } from './lib/services';
4
- // Mappers (for advanced use cases)
5
- export { onboardingMapper, flowMapper, userJourneyMapper, userIdentityMapper } from './lib/mappers';
6
-
7
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["// Block factory and metadata\nexport { createOnboardingBlock, onboardingBlockMetadata } from './lib/onboarding.block';\nexport type { OnboardingBlock, OnboardingBlockConfig } from './lib/onboarding.block';\n\n// Types\nexport type {\n // Onboarding types\n Onboarding,\n CreateOnboardingRequest,\n UpdateOnboardingRequest,\n ListOnboardingsParams,\n // Flow types\n Flow,\n CreateFlowRequest,\n UpdateFlowRequest,\n ListFlowsParams,\n // User Journey types\n UserJourney,\n UserJourneyStatus,\n StartJourneyRequest,\n CompleteStepRequest,\n ListUserJourneysParams,\n // User Identity types\n UserIdentity,\n CreateUserIdentityRequest,\n VerifyUserIdentityRequest,\n ListUserIdentitiesParams,\n} from './lib/types';\n\n// Services\nexport type {\n OnboardingsService,\n FlowsService,\n UserJourneysService,\n UserIdentitiesService,\n} from './lib/services';\n\nexport {\n createOnboardingsService,\n createFlowsService,\n createUserJourneysService,\n createUserIdentitiesService,\n} from './lib/services';\n\n// Mappers (for advanced use cases)\nexport {\n onboardingMapper,\n flowMapper,\n userJourneyMapper,\n userIdentityMapper,\n} from './lib/mappers';\n"],"names":["createOnboardingBlock","onboardingBlockMetadata","createOnboardingsService","createFlowsService","createUserJourneysService","createUserIdentitiesService","onboardingMapper","flowMapper","userJourneyMapper","userIdentityMapper"],"rangeMappings":";;;;","mappings":"AAAA,6BAA6B;AAC7B,SAASA,qBAAqB,EAAEC,uBAAuB,QAAQ,yBAAyB;AAoCxF,SACEC,wBAAwB,EACxBC,kBAAkB,EAClBC,yBAAyB,EACzBC,2BAA2B,QACtB,iBAAiB;AAExB,mCAAmC;AACnC,SACEC,gBAAgB,EAChBC,UAAU,EACVC,iBAAiB,EACjBC,kBAAkB,QACb,gBAAgB"}
@@ -1,21 +0,0 @@
1
- import { parseString, parseDate, parseBoolean, parseStatus, parseObjectArray, parseObject } from './utils';
2
- export const flowMapper = {
3
- type: 'Flow',
4
- map: (resource)=>({
5
- id: resource.id,
6
- uniqueId: parseString(resource.attributes['unique_id']) || resource.id,
7
- createdAt: parseDate(resource.attributes['created_at']) || new Date(),
8
- updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
9
- onboardingUniqueId: parseString(resource.attributes['onboarding_unique_id']) || '',
10
- code: parseString(resource.attributes['code']) || '',
11
- name: parseString(resource.attributes['name']) || '',
12
- description: parseString(resource.attributes['description']),
13
- steps: parseObjectArray(resource.attributes['steps']),
14
- conditions: parseObject(resource.attributes['conditions']),
15
- status: parseStatus(resource.attributes['status']),
16
- enabled: parseBoolean(resource.attributes['enabled']),
17
- payload: resource.attributes['payload']
18
- })
19
- };
20
-
21
- //# sourceMappingURL=flow.mapper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/lib/mappers/flow.mapper.ts"],"sourcesContent":["import type { ResourceMapper } from '@23blocks/jsonapi-codec';\nimport type { Flow } from '../types/flow';\nimport { parseString, parseDate, parseBoolean, parseStatus, parseObjectArray, parseObject } from './utils';\n\nexport const flowMapper: ResourceMapper<Flow> = {\n type: 'Flow',\n map: (resource) => ({\n id: resource.id,\n uniqueId: parseString(resource.attributes['unique_id']) || resource.id,\n createdAt: parseDate(resource.attributes['created_at']) || new Date(),\n updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),\n\n onboardingUniqueId: parseString(resource.attributes['onboarding_unique_id']) || '',\n code: parseString(resource.attributes['code']) || '',\n name: parseString(resource.attributes['name']) || '',\n description: parseString(resource.attributes['description']),\n steps: parseObjectArray(resource.attributes['steps']),\n conditions: parseObject(resource.attributes['conditions']),\n status: parseStatus(resource.attributes['status']),\n enabled: parseBoolean(resource.attributes['enabled']),\n payload: resource.attributes['payload'] as Record<string, unknown> | undefined,\n }),\n};\n"],"names":["parseString","parseDate","parseBoolean","parseStatus","parseObjectArray","parseObject","flowMapper","type","map","resource","id","uniqueId","attributes","createdAt","Date","updatedAt","onboardingUniqueId","code","name","description","steps","conditions","status","enabled","payload"],"rangeMappings":";;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,WAAW,EAAEC,SAAS,EAAEC,YAAY,EAAEC,WAAW,EAAEC,gBAAgB,EAAEC,WAAW,QAAQ,UAAU;AAE3G,OAAO,MAAMC,aAAmC;IAC9CC,MAAM;IACNC,KAAK,CAACC,WAAc,CAAA;YAClBC,IAAID,SAASC,EAAE;YACfC,UAAUX,YAAYS,SAASG,UAAU,CAAC,YAAY,KAAKH,SAASC,EAAE;YACtEG,WAAWZ,UAAUQ,SAASG,UAAU,CAAC,aAAa,KAAK,IAAIE;YAC/DC,WAAWd,UAAUQ,SAASG,UAAU,CAAC,aAAa,KAAK,IAAIE;YAE/DE,oBAAoBhB,YAAYS,SAASG,UAAU,CAAC,uBAAuB,KAAK;YAChFK,MAAMjB,YAAYS,SAASG,UAAU,CAAC,OAAO,KAAK;YAClDM,MAAMlB,YAAYS,SAASG,UAAU,CAAC,OAAO,KAAK;YAClDO,aAAanB,YAAYS,SAASG,UAAU,CAAC,cAAc;YAC3DQ,OAAOhB,iBAAiBK,SAASG,UAAU,CAAC,QAAQ;YACpDS,YAAYhB,YAAYI,SAASG,UAAU,CAAC,aAAa;YACzDU,QAAQnB,YAAYM,SAASG,UAAU,CAAC,SAAS;YACjDW,SAASrB,aAAaO,SAASG,UAAU,CAAC,UAAU;YACpDY,SAASf,SAASG,UAAU,CAAC,UAAU;QACzC,CAAA;AACF,EAAE"}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/lib/mappers/index.ts"],"sourcesContent":["export * from './onboarding.mapper';\nexport * from './flow.mapper';\nexport * from './user-journey.mapper';\nexport * from './user-identity.mapper';\nexport * from './utils';\n"],"names":[],"rangeMappings":";;;;","mappings":"AAAA,cAAc,sBAAsB;AACpC,cAAc,gBAAgB;AAC9B,cAAc,wBAAwB;AACtC,cAAc,yBAAyB;AACvC,cAAc,UAAU"}
@@ -1,19 +0,0 @@
1
- import { parseString, parseDate, parseBoolean, parseStatus, parseObjectArray } from './utils';
2
- export const onboardingMapper = {
3
- type: 'Onboarding',
4
- map: (resource)=>({
5
- id: resource.id,
6
- uniqueId: parseString(resource.attributes['unique_id']) || resource.id,
7
- createdAt: parseDate(resource.attributes['created_at']) || new Date(),
8
- updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
9
- code: parseString(resource.attributes['code']) || '',
10
- name: parseString(resource.attributes['name']) || '',
11
- description: parseString(resource.attributes['description']),
12
- steps: parseObjectArray(resource.attributes['steps']),
13
- status: parseStatus(resource.attributes['status']),
14
- enabled: parseBoolean(resource.attributes['enabled']),
15
- payload: resource.attributes['payload']
16
- })
17
- };
18
-
19
- //# sourceMappingURL=onboarding.mapper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/lib/mappers/onboarding.mapper.ts"],"sourcesContent":["import type { ResourceMapper } from '@23blocks/jsonapi-codec';\nimport type { Onboarding } from '../types/onboarding';\nimport { parseString, parseDate, parseBoolean, parseStatus, parseObjectArray } from './utils';\n\nexport const onboardingMapper: ResourceMapper<Onboarding> = {\n type: 'Onboarding',\n map: (resource) => ({\n id: resource.id,\n uniqueId: parseString(resource.attributes['unique_id']) || resource.id,\n createdAt: parseDate(resource.attributes['created_at']) || new Date(),\n updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),\n\n code: parseString(resource.attributes['code']) || '',\n name: parseString(resource.attributes['name']) || '',\n description: parseString(resource.attributes['description']),\n steps: parseObjectArray(resource.attributes['steps']),\n status: parseStatus(resource.attributes['status']),\n enabled: parseBoolean(resource.attributes['enabled']),\n payload: resource.attributes['payload'] as Record<string, unknown> | undefined,\n }),\n};\n"],"names":["parseString","parseDate","parseBoolean","parseStatus","parseObjectArray","onboardingMapper","type","map","resource","id","uniqueId","attributes","createdAt","Date","updatedAt","code","name","description","steps","status","enabled","payload"],"rangeMappings":";;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,WAAW,EAAEC,SAAS,EAAEC,YAAY,EAAEC,WAAW,EAAEC,gBAAgB,QAAQ,UAAU;AAE9F,OAAO,MAAMC,mBAA+C;IAC1DC,MAAM;IACNC,KAAK,CAACC,WAAc,CAAA;YAClBC,IAAID,SAASC,EAAE;YACfC,UAAUV,YAAYQ,SAASG,UAAU,CAAC,YAAY,KAAKH,SAASC,EAAE;YACtEG,WAAWX,UAAUO,SAASG,UAAU,CAAC,aAAa,KAAK,IAAIE;YAC/DC,WAAWb,UAAUO,SAASG,UAAU,CAAC,aAAa,KAAK,IAAIE;YAE/DE,MAAMf,YAAYQ,SAASG,UAAU,CAAC,OAAO,KAAK;YAClDK,MAAMhB,YAAYQ,SAASG,UAAU,CAAC,OAAO,KAAK;YAClDM,aAAajB,YAAYQ,SAASG,UAAU,CAAC,cAAc;YAC3DO,OAAOd,iBAAiBI,SAASG,UAAU,CAAC,QAAQ;YACpDQ,QAAQhB,YAAYK,SAASG,UAAU,CAAC,SAAS;YACjDS,SAASlB,aAAaM,SAASG,UAAU,CAAC,UAAU;YACpDU,SAASb,SAASG,UAAU,CAAC,UAAU;QACzC,CAAA;AACF,EAAE"}
@@ -1,20 +0,0 @@
1
- import { parseString, parseDate, parseBoolean, parseStatus } from './utils';
2
- export const userIdentityMapper = {
3
- type: 'UserIdentity',
4
- map: (resource)=>({
5
- id: resource.id,
6
- uniqueId: parseString(resource.attributes['unique_id']) || resource.id,
7
- createdAt: parseDate(resource.attributes['created_at']) || new Date(),
8
- updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
9
- userUniqueId: parseString(resource.attributes['user_unique_id']) || '',
10
- identityType: parseString(resource.attributes['identity_type']) || '',
11
- identityValue: parseString(resource.attributes['identity_value']) || '',
12
- verified: parseBoolean(resource.attributes['verified']),
13
- verifiedAt: parseDate(resource.attributes['verified_at']),
14
- status: parseStatus(resource.attributes['status']),
15
- enabled: parseBoolean(resource.attributes['enabled']),
16
- payload: resource.attributes['payload']
17
- })
18
- };
19
-
20
- //# sourceMappingURL=user-identity.mapper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/lib/mappers/user-identity.mapper.ts"],"sourcesContent":["import type { ResourceMapper } from '@23blocks/jsonapi-codec';\nimport type { UserIdentity } from '../types/user-identity';\nimport { parseString, parseDate, parseBoolean, parseStatus } from './utils';\n\nexport const userIdentityMapper: ResourceMapper<UserIdentity> = {\n type: 'UserIdentity',\n map: (resource) => ({\n id: resource.id,\n uniqueId: parseString(resource.attributes['unique_id']) || resource.id,\n createdAt: parseDate(resource.attributes['created_at']) || new Date(),\n updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),\n\n userUniqueId: parseString(resource.attributes['user_unique_id']) || '',\n identityType: parseString(resource.attributes['identity_type']) || '',\n identityValue: parseString(resource.attributes['identity_value']) || '',\n verified: parseBoolean(resource.attributes['verified']),\n verifiedAt: parseDate(resource.attributes['verified_at']),\n status: parseStatus(resource.attributes['status']),\n enabled: parseBoolean(resource.attributes['enabled']),\n payload: resource.attributes['payload'] as Record<string, unknown> | undefined,\n }),\n};\n"],"names":["parseString","parseDate","parseBoolean","parseStatus","userIdentityMapper","type","map","resource","id","uniqueId","attributes","createdAt","Date","updatedAt","userUniqueId","identityType","identityValue","verified","verifiedAt","status","enabled","payload"],"rangeMappings":";;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,WAAW,EAAEC,SAAS,EAAEC,YAAY,EAAEC,WAAW,QAAQ,UAAU;AAE5E,OAAO,MAAMC,qBAAmD;IAC9DC,MAAM;IACNC,KAAK,CAACC,WAAc,CAAA;YAClBC,IAAID,SAASC,EAAE;YACfC,UAAUT,YAAYO,SAASG,UAAU,CAAC,YAAY,KAAKH,SAASC,EAAE;YACtEG,WAAWV,UAAUM,SAASG,UAAU,CAAC,aAAa,KAAK,IAAIE;YAC/DC,WAAWZ,UAAUM,SAASG,UAAU,CAAC,aAAa,KAAK,IAAIE;YAE/DE,cAAcd,YAAYO,SAASG,UAAU,CAAC,iBAAiB,KAAK;YACpEK,cAAcf,YAAYO,SAASG,UAAU,CAAC,gBAAgB,KAAK;YACnEM,eAAehB,YAAYO,SAASG,UAAU,CAAC,iBAAiB,KAAK;YACrEO,UAAUf,aAAaK,SAASG,UAAU,CAAC,WAAW;YACtDQ,YAAYjB,UAAUM,SAASG,UAAU,CAAC,cAAc;YACxDS,QAAQhB,YAAYI,SAASG,UAAU,CAAC,SAAS;YACjDU,SAASlB,aAAaK,SAASG,UAAU,CAAC,UAAU;YACpDW,SAASd,SAASG,UAAU,CAAC,UAAU;QACzC,CAAA;AACF,EAAE"}
@@ -1,22 +0,0 @@
1
- import { parseString, parseDate, parseOptionalNumber, parseNumberArray, parseJourneyStatus } from './utils';
2
- export const userJourneyMapper = {
3
- type: 'UserJourney',
4
- map: (resource)=>({
5
- id: resource.id,
6
- uniqueId: parseString(resource.attributes['unique_id']) || resource.id,
7
- createdAt: parseDate(resource.attributes['created_at']) || new Date(),
8
- updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),
9
- userUniqueId: parseString(resource.attributes['user_unique_id']) || '',
10
- onboardingUniqueId: parseString(resource.attributes['onboarding_unique_id']) || '',
11
- flowUniqueId: parseString(resource.attributes['flow_unique_id']),
12
- currentStep: parseOptionalNumber(resource.attributes['current_step']),
13
- completedSteps: parseNumberArray(resource.attributes['completed_steps']),
14
- progress: parseOptionalNumber(resource.attributes['progress']),
15
- startedAt: parseDate(resource.attributes['started_at']) || new Date(),
16
- completedAt: parseDate(resource.attributes['completed_at']),
17
- status: parseJourneyStatus(resource.attributes['status']),
18
- payload: resource.attributes['payload']
19
- })
20
- };
21
-
22
- //# sourceMappingURL=user-journey.mapper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/lib/mappers/user-journey.mapper.ts"],"sourcesContent":["import type { ResourceMapper } from '@23blocks/jsonapi-codec';\nimport type { UserJourney } from '../types/user-journey';\nimport { parseString, parseDate, parseOptionalNumber, parseNumberArray, parseJourneyStatus } from './utils';\n\nexport const userJourneyMapper: ResourceMapper<UserJourney> = {\n type: 'UserJourney',\n map: (resource) => ({\n id: resource.id,\n uniqueId: parseString(resource.attributes['unique_id']) || resource.id,\n createdAt: parseDate(resource.attributes['created_at']) || new Date(),\n updatedAt: parseDate(resource.attributes['updated_at']) || new Date(),\n\n userUniqueId: parseString(resource.attributes['user_unique_id']) || '',\n onboardingUniqueId: parseString(resource.attributes['onboarding_unique_id']) || '',\n flowUniqueId: parseString(resource.attributes['flow_unique_id']),\n currentStep: parseOptionalNumber(resource.attributes['current_step']),\n completedSteps: parseNumberArray(resource.attributes['completed_steps']),\n progress: parseOptionalNumber(resource.attributes['progress']),\n startedAt: parseDate(resource.attributes['started_at']) || new Date(),\n completedAt: parseDate(resource.attributes['completed_at']),\n status: parseJourneyStatus(resource.attributes['status']),\n payload: resource.attributes['payload'] as Record<string, unknown> | undefined,\n }),\n};\n"],"names":["parseString","parseDate","parseOptionalNumber","parseNumberArray","parseJourneyStatus","userJourneyMapper","type","map","resource","id","uniqueId","attributes","createdAt","Date","updatedAt","userUniqueId","onboardingUniqueId","flowUniqueId","currentStep","completedSteps","progress","startedAt","completedAt","status","payload"],"rangeMappings":";;;;;;;;;;;;;;;;;;;","mappings":"AAEA,SAASA,WAAW,EAAEC,SAAS,EAAEC,mBAAmB,EAAEC,gBAAgB,EAAEC,kBAAkB,QAAQ,UAAU;AAE5G,OAAO,MAAMC,oBAAiD;IAC5DC,MAAM;IACNC,KAAK,CAACC,WAAc,CAAA;YAClBC,IAAID,SAASC,EAAE;YACfC,UAAUV,YAAYQ,SAASG,UAAU,CAAC,YAAY,KAAKH,SAASC,EAAE;YACtEG,WAAWX,UAAUO,SAASG,UAAU,CAAC,aAAa,KAAK,IAAIE;YAC/DC,WAAWb,UAAUO,SAASG,UAAU,CAAC,aAAa,KAAK,IAAIE;YAE/DE,cAAcf,YAAYQ,SAASG,UAAU,CAAC,iBAAiB,KAAK;YACpEK,oBAAoBhB,YAAYQ,SAASG,UAAU,CAAC,uBAAuB,KAAK;YAChFM,cAAcjB,YAAYQ,SAASG,UAAU,CAAC,iBAAiB;YAC/DO,aAAahB,oBAAoBM,SAASG,UAAU,CAAC,eAAe;YACpEQ,gBAAgBhB,iBAAiBK,SAASG,UAAU,CAAC,kBAAkB;YACvES,UAAUlB,oBAAoBM,SAASG,UAAU,CAAC,WAAW;YAC7DU,WAAWpB,UAAUO,SAASG,UAAU,CAAC,aAAa,KAAK,IAAIE;YAC/DS,aAAarB,UAAUO,SAASG,UAAU,CAAC,eAAe;YAC1DY,QAAQnB,mBAAmBI,SAASG,UAAU,CAAC,SAAS;YACxDa,SAAShB,SAASG,UAAU,CAAC,UAAU;QACzC,CAAA;AACF,EAAE"}
@@ -1,117 +0,0 @@
1
- /**
2
- * Parse a string value, returning undefined for empty/undefined
3
- */ export function parseString(value) {
4
- if (value === null || value === undefined) {
5
- return undefined;
6
- }
7
- const str = String(value);
8
- return str.length > 0 ? str : undefined;
9
- }
10
- /**
11
- * Parse a date value
12
- */ export function parseDate(value) {
13
- if (value === null || value === undefined) {
14
- return undefined;
15
- }
16
- if (value instanceof Date) {
17
- return value;
18
- }
19
- if (typeof value === 'string' || typeof value === 'number') {
20
- const date = new Date(value);
21
- return isNaN(date.getTime()) ? undefined : date;
22
- }
23
- return undefined;
24
- }
25
- /**
26
- * Parse a boolean value
27
- */ export function parseBoolean(value) {
28
- if (typeof value === 'boolean') {
29
- return value;
30
- }
31
- if (value === 'true' || value === '1' || value === 1) {
32
- return true;
33
- }
34
- return false;
35
- }
36
- /**
37
- * Parse an array of strings
38
- */ export function parseStringArray(value) {
39
- if (value === null || value === undefined) {
40
- return undefined;
41
- }
42
- if (Array.isArray(value)) {
43
- return value.map(String);
44
- }
45
- return undefined;
46
- }
47
- /**
48
- * Parse a number value
49
- */ export function parseNumber(value) {
50
- if (value === null || value === undefined) {
51
- return 0;
52
- }
53
- const num = Number(value);
54
- return isNaN(num) ? 0 : num;
55
- }
56
- /**
57
- * Parse an optional number value
58
- */ export function parseOptionalNumber(value) {
59
- if (value === null || value === undefined) {
60
- return undefined;
61
- }
62
- const num = Number(value);
63
- return isNaN(num) ? undefined : num;
64
- }
65
- /**
66
- * Parse entity status
67
- */ export function parseStatus(value) {
68
- const status = parseString(value);
69
- if (status === 'active' || status === 'inactive' || status === 'pending' || status === 'archived' || status === 'deleted') {
70
- return status;
71
- }
72
- return 'active';
73
- }
74
- /**
75
- * Parse user journey status
76
- */ export function parseJourneyStatus(value) {
77
- const status = parseString(value);
78
- if (status === 'active' || status === 'completed' || status === 'abandoned') {
79
- return status;
80
- }
81
- return 'active';
82
- }
83
- /**
84
- * Parse array of numbers
85
- */ export function parseNumberArray(value) {
86
- if (value === null || value === undefined) {
87
- return undefined;
88
- }
89
- if (Array.isArray(value)) {
90
- return value.map(Number).filter((num)=>!isNaN(num));
91
- }
92
- return undefined;
93
- }
94
- /**
95
- * Parse array of objects
96
- */ export function parseObjectArray(value) {
97
- if (value === null || value === undefined) {
98
- return undefined;
99
- }
100
- if (Array.isArray(value)) {
101
- return value;
102
- }
103
- return undefined;
104
- }
105
- /**
106
- * Parse object
107
- */ export function parseObject(value) {
108
- if (value === null || value === undefined) {
109
- return undefined;
110
- }
111
- if (typeof value === 'object' && !Array.isArray(value)) {
112
- return value;
113
- }
114
- return undefined;
115
- }
116
-
117
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/lib/mappers/utils.ts"],"sourcesContent":["/**\n * Parse a string value, returning undefined for empty/undefined\n */\nexport function parseString(value: unknown): string | undefined {\n if (value === null || value === undefined) {\n return undefined;\n }\n const str = String(value);\n return str.length > 0 ? str : undefined;\n}\n\n/**\n * Parse a date value\n */\nexport function parseDate(value: unknown): Date | undefined {\n if (value === null || value === undefined) {\n return undefined;\n }\n\n if (value instanceof Date) {\n return value;\n }\n\n if (typeof value === 'string' || typeof value === 'number') {\n const date = new Date(value);\n return isNaN(date.getTime()) ? undefined : date;\n }\n\n return undefined;\n}\n\n/**\n * Parse a boolean value\n */\nexport function parseBoolean(value: unknown): boolean {\n if (typeof value === 'boolean') {\n return value;\n }\n if (value === 'true' || value === '1' || value === 1) {\n return true;\n }\n return false;\n}\n\n/**\n * Parse an array of strings\n */\nexport function parseStringArray(value: unknown): string[] | undefined {\n if (value === null || value === undefined) {\n return undefined;\n }\n if (Array.isArray(value)) {\n return value.map(String);\n }\n return undefined;\n}\n\n/**\n * Parse a number value\n */\nexport function parseNumber(value: unknown): number {\n if (value === null || value === undefined) {\n return 0;\n }\n const num = Number(value);\n return isNaN(num) ? 0 : num;\n}\n\n/**\n * Parse an optional number value\n */\nexport function parseOptionalNumber(value: unknown): number | undefined {\n if (value === null || value === undefined) {\n return undefined;\n }\n const num = Number(value);\n return isNaN(num) ? undefined : num;\n}\n\n/**\n * Parse entity status\n */\nexport function parseStatus(value: unknown): 'active' | 'inactive' | 'pending' | 'archived' | 'deleted' {\n const status = parseString(value);\n if (status === 'active' || status === 'inactive' || status === 'pending' || status === 'archived' || status === 'deleted') {\n return status;\n }\n return 'active';\n}\n\n/**\n * Parse user journey status\n */\nexport function parseJourneyStatus(value: unknown): 'active' | 'completed' | 'abandoned' {\n const status = parseString(value);\n if (status === 'active' || status === 'completed' || status === 'abandoned') {\n return status;\n }\n return 'active';\n}\n\n/**\n * Parse array of numbers\n */\nexport function parseNumberArray(value: unknown): number[] | undefined {\n if (value === null || value === undefined) {\n return undefined;\n }\n if (Array.isArray(value)) {\n return value.map(Number).filter(num => !isNaN(num));\n }\n return undefined;\n}\n\n/**\n * Parse array of objects\n */\nexport function parseObjectArray(value: unknown): Record<string, unknown>[] | undefined {\n if (value === null || value === undefined) {\n return undefined;\n }\n if (Array.isArray(value)) {\n return value as Record<string, unknown>[];\n }\n return undefined;\n}\n\n/**\n * Parse object\n */\nexport function parseObject(value: unknown): Record<string, unknown> | undefined {\n if (value === null || value === undefined) {\n return undefined;\n }\n if (typeof value === 'object' && !Array.isArray(value)) {\n return value as Record<string, unknown>;\n }\n return undefined;\n}\n"],"names":["parseString","value","undefined","str","String","length","parseDate","Date","date","isNaN","getTime","parseBoolean","parseStringArray","Array","isArray","map","parseNumber","num","Number","parseOptionalNumber","parseStatus","status","parseJourneyStatus","parseNumberArray","filter","parseObjectArray","parseObject"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA;;CAEC,GACD,OAAO,SAASA,YAAYC,KAAc;IACxC,IAAIA,UAAU,QAAQA,UAAUC,WAAW;QACzC,OAAOA;IACT;IACA,MAAMC,MAAMC,OAAOH;IACnB,OAAOE,IAAIE,MAAM,GAAG,IAAIF,MAAMD;AAChC;AAEA;;CAEC,GACD,OAAO,SAASI,UAAUL,KAAc;IACtC,IAAIA,UAAU,QAAQA,UAAUC,WAAW;QACzC,OAAOA;IACT;IAEA,IAAID,iBAAiBM,MAAM;QACzB,OAAON;IACT;IAEA,IAAI,OAAOA,UAAU,YAAY,OAAOA,UAAU,UAAU;QAC1D,MAAMO,OAAO,IAAID,KAAKN;QACtB,OAAOQ,MAAMD,KAAKE,OAAO,MAAMR,YAAYM;IAC7C;IAEA,OAAON;AACT;AAEA;;CAEC,GACD,OAAO,SAASS,aAAaV,KAAc;IACzC,IAAI,OAAOA,UAAU,WAAW;QAC9B,OAAOA;IACT;IACA,IAAIA,UAAU,UAAUA,UAAU,OAAOA,UAAU,GAAG;QACpD,OAAO;IACT;IACA,OAAO;AACT;AAEA;;CAEC,GACD,OAAO,SAASW,iBAAiBX,KAAc;IAC7C,IAAIA,UAAU,QAAQA,UAAUC,WAAW;QACzC,OAAOA;IACT;IACA,IAAIW,MAAMC,OAAO,CAACb,QAAQ;QACxB,OAAOA,MAAMc,GAAG,CAACX;IACnB;IACA,OAAOF;AACT;AAEA;;CAEC,GACD,OAAO,SAASc,YAAYf,KAAc;IACxC,IAAIA,UAAU,QAAQA,UAAUC,WAAW;QACzC,OAAO;IACT;IACA,MAAMe,MAAMC,OAAOjB;IACnB,OAAOQ,MAAMQ,OAAO,IAAIA;AAC1B;AAEA;;CAEC,GACD,OAAO,SAASE,oBAAoBlB,KAAc;IAChD,IAAIA,UAAU,QAAQA,UAAUC,WAAW;QACzC,OAAOA;IACT;IACA,MAAMe,MAAMC,OAAOjB;IACnB,OAAOQ,MAAMQ,OAAOf,YAAYe;AAClC;AAEA;;CAEC,GACD,OAAO,SAASG,YAAYnB,KAAc;IACxC,MAAMoB,SAASrB,YAAYC;IAC3B,IAAIoB,WAAW,YAAYA,WAAW,cAAcA,WAAW,aAAaA,WAAW,cAAcA,WAAW,WAAW;QACzH,OAAOA;IACT;IACA,OAAO;AACT;AAEA;;CAEC,GACD,OAAO,SAASC,mBAAmBrB,KAAc;IAC/C,MAAMoB,SAASrB,YAAYC;IAC3B,IAAIoB,WAAW,YAAYA,WAAW,eAAeA,WAAW,aAAa;QAC3E,OAAOA;IACT;IACA,OAAO;AACT;AAEA;;CAEC,GACD,OAAO,SAASE,iBAAiBtB,KAAc;IAC7C,IAAIA,UAAU,QAAQA,UAAUC,WAAW;QACzC,OAAOA;IACT;IACA,IAAIW,MAAMC,OAAO,CAACb,QAAQ;QACxB,OAAOA,MAAMc,GAAG,CAACG,QAAQM,MAAM,CAACP,CAAAA,MAAO,CAACR,MAAMQ;IAChD;IACA,OAAOf;AACT;AAEA;;CAEC,GACD,OAAO,SAASuB,iBAAiBxB,KAAc;IAC7C,IAAIA,UAAU,QAAQA,UAAUC,WAAW;QACzC,OAAOA;IACT;IACA,IAAIW,MAAMC,OAAO,CAACb,QAAQ;QACxB,OAAOA;IACT;IACA,OAAOC;AACT;AAEA;;CAEC,GACD,OAAO,SAASwB,YAAYzB,KAAc;IACxC,IAAIA,UAAU,QAAQA,UAAUC,WAAW;QACzC,OAAOA;IACT;IACA,IAAI,OAAOD,UAAU,YAAY,CAACY,MAAMC,OAAO,CAACb,QAAQ;QACtD,OAAOA;IACT;IACA,OAAOC;AACT"}
@@ -1,22 +0,0 @@
1
- import { createOnboardingsService, createFlowsService, createUserJourneysService, createUserIdentitiesService } from './services';
2
- export function createOnboardingBlock(transport, config) {
3
- return {
4
- onboardings: createOnboardingsService(transport, config),
5
- flows: createFlowsService(transport, config),
6
- userJourneys: createUserJourneysService(transport, config),
7
- userIdentities: createUserIdentitiesService(transport, config)
8
- };
9
- }
10
- export const onboardingBlockMetadata = {
11
- name: 'onboarding',
12
- version: '0.1.0',
13
- description: 'User onboarding, flows, journeys, and identity verification',
14
- resourceTypes: [
15
- 'Onboarding',
16
- 'Flow',
17
- 'UserJourney',
18
- 'UserIdentity'
19
- ]
20
- };
21
-
22
- //# sourceMappingURL=onboarding.block.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/lib/onboarding.block.ts"],"sourcesContent":["import type { Transport, BlockConfig, BlockMetadata } from '@23blocks/contracts';\nimport {\n createOnboardingsService,\n createFlowsService,\n createUserJourneysService,\n createUserIdentitiesService,\n type OnboardingsService,\n type FlowsService,\n type UserJourneysService,\n type UserIdentitiesService,\n} from './services';\n\nexport interface OnboardingBlockConfig extends BlockConfig {\n appId: string;\n tenantId?: string;\n}\n\nexport interface OnboardingBlock {\n onboardings: OnboardingsService;\n flows: FlowsService;\n userJourneys: UserJourneysService;\n userIdentities: UserIdentitiesService;\n}\n\nexport function createOnboardingBlock(\n transport: Transport,\n config: OnboardingBlockConfig\n): OnboardingBlock {\n return {\n onboardings: createOnboardingsService(transport, config),\n flows: createFlowsService(transport, config),\n userJourneys: createUserJourneysService(transport, config),\n userIdentities: createUserIdentitiesService(transport, config),\n };\n}\n\nexport const onboardingBlockMetadata: BlockMetadata = {\n name: 'onboarding',\n version: '0.1.0',\n description: 'User onboarding, flows, journeys, and identity verification',\n resourceTypes: [\n 'Onboarding',\n 'Flow',\n 'UserJourney',\n 'UserIdentity',\n ],\n};\n"],"names":["createOnboardingsService","createFlowsService","createUserJourneysService","createUserIdentitiesService","createOnboardingBlock","transport","config","onboardings","flows","userJourneys","userIdentities","onboardingBlockMetadata","name","version","description","resourceTypes"],"rangeMappings":";;;;;;;;;;;;;;;;;;;","mappings":"AACA,SACEA,wBAAwB,EACxBC,kBAAkB,EAClBC,yBAAyB,EACzBC,2BAA2B,QAKtB,aAAa;AAcpB,OAAO,SAASC,sBACdC,SAAoB,EACpBC,MAA6B;IAE7B,OAAO;QACLC,aAAaP,yBAAyBK,WAAWC;QACjDE,OAAOP,mBAAmBI,WAAWC;QACrCG,cAAcP,0BAA0BG,WAAWC;QACnDI,gBAAgBP,4BAA4BE,WAAWC;IACzD;AACF;AAEA,OAAO,MAAMK,0BAAyC;IACpDC,MAAM;IACNC,SAAS;IACTC,aAAa;IACbC,eAAe;QACb;QACA;QACA;QACA;KACD;AACH,EAAE"}
@@ -1,67 +0,0 @@
1
- import { decodeOne, decodeMany, decodePageResult } from '@23blocks/jsonapi-codec';
2
- import { flowMapper } from '../mappers/flow.mapper';
3
- export function createFlowsService(transport, _config) {
4
- return {
5
- async list (params) {
6
- const queryParams = {};
7
- if (params == null ? void 0 : params.page) queryParams['page'] = String(params.page);
8
- if (params == null ? void 0 : params.perPage) queryParams['records'] = String(params.perPage);
9
- if (params == null ? void 0 : params.onboardingUniqueId) queryParams['onboarding_unique_id'] = params.onboardingUniqueId;
10
- if (params == null ? void 0 : params.status) queryParams['status'] = params.status;
11
- if ((params == null ? void 0 : params.enabled) !== undefined) queryParams['enabled'] = String(params.enabled);
12
- if (params == null ? void 0 : params.search) queryParams['search'] = params.search;
13
- if (params == null ? void 0 : params.sortBy) queryParams['sort'] = params.sortOrder === 'desc' ? `-${params.sortBy}` : params.sortBy;
14
- const response = await transport.get('/flows', {
15
- params: queryParams
16
- });
17
- return decodePageResult(response, flowMapper);
18
- },
19
- async get (uniqueId) {
20
- const response = await transport.get(`/flows/${uniqueId}`);
21
- return decodeOne(response, flowMapper);
22
- },
23
- async create (data) {
24
- const response = await transport.post('/flows', {
25
- data: {
26
- type: 'Flow',
27
- attributes: {
28
- onboarding_unique_id: data.onboardingUniqueId,
29
- code: data.code,
30
- name: data.name,
31
- description: data.description,
32
- steps: data.steps,
33
- conditions: data.conditions,
34
- payload: data.payload
35
- }
36
- }
37
- });
38
- return decodeOne(response, flowMapper);
39
- },
40
- async update (uniqueId, data) {
41
- const response = await transport.put(`/flows/${uniqueId}`, {
42
- data: {
43
- type: 'Flow',
44
- attributes: {
45
- name: data.name,
46
- description: data.description,
47
- steps: data.steps,
48
- conditions: data.conditions,
49
- enabled: data.enabled,
50
- status: data.status,
51
- payload: data.payload
52
- }
53
- }
54
- });
55
- return decodeOne(response, flowMapper);
56
- },
57
- async delete (uniqueId) {
58
- await transport.delete(`/flows/${uniqueId}`);
59
- },
60
- async listByOnboarding (onboardingUniqueId) {
61
- const response = await transport.get(`/onboardings/${onboardingUniqueId}/flows`);
62
- return decodeMany(response, flowMapper);
63
- }
64
- };
65
- }
66
-
67
- //# sourceMappingURL=flows.service.js.map