@thefittingroom/sdk 0.0.1-alpha.10

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/.env.dev ADDED
@@ -0,0 +1,14 @@
1
+ <!-- firebase configs start -->
2
+ FIREBASE_API_KEY=AIzaSyDfjBWzpmzb-mhGN8VSURxzLg6nkzmKUD8
3
+ FIREBASE_AUTH_DOMAIN=fittingroom-dev-5d248.firebaseapp.com
4
+ FIREBASE_PROJECT_ID=fittingroom-dev-5d248
5
+ FIREBASE_STORAGE_BUCKET=fittingroom-dev-5d248.appspot.com
6
+ FIREBASE_MESSAGING_SENDER_ID=2298664147
7
+ FIREBASE_APP_ID=1:2298664147:web:340bda75cd5d25f3997026
8
+ FIREBASE_MEASUREMENT_ID=G-B7GDQ1Y9LL
9
+ <!-- firebase configs ends -->
10
+ API_ENDPOINT=https://tfr.dev.thefittingroom.xyz/v1
11
+ LANGUAGE_URL=https://assets.dev.thefittingroom.xyz/shop-sdk/${GITHUB_SHA_7}/languages
12
+ ASSETS_URL=https://assets.dev.thefittingroom.xyz/shop-sdk/assets
13
+ VTO_TIMEOUT_MS=120000
14
+ AVATAR_TIMEOUT_MS=120000
package/.env.example ADDED
@@ -0,0 +1,12 @@
1
+ FIREBASE_API_KEY
2
+ FIREBASE_AUTH_DOMAIN
3
+ FIREBASE_PROJECT_ID
4
+ FIREBASE_STORAGE_BUCKET
5
+ FIREBASE_MESSAGING_SENDER_ID
6
+ FIREBASE_APP_ID
7
+ FIREBASE_MEASUREMENT_ID
8
+ API_ENDPOINT
9
+ LANGUAGE_URL
10
+ ASSETS_URL
11
+ VTO_TIMEOUT_MS
12
+ AVATAR_TIMEOUT_MS
package/.env.prod ADDED
@@ -0,0 +1,14 @@
1
+ <!-- firebase configs start -->
2
+ FIREBASE_API_KEY=AIzaSyA3kQ6w1vkA9l9lgY0nNACVPXe-QmP5T1Y
3
+ FIREBASE_AUTH_DOMAIN=fittingroom-prod.firebaseapp.com
4
+ FIREBASE_PROJECT_ID=fittingroom-prod
5
+ FIREBASE_STORAGE_BUCKET=fittingroom-prod.appspot.com
6
+ FIREBASE_MESSAGING_SENDER_ID=965656825574
7
+ FIREBASE_APP_ID=1:965656825574:web:933493cddc73213bd43527
8
+ FIREBASE_MEASUREMENT_ID=G-XH9VV5N6EW
9
+ <!-- firebase configs ends -->
10
+ API_ENDPOINT=https://tfr.p.thefittingroom.xyz/v1
11
+ LANGUAGE_URL=https://assets.p.thefittingroom.xyz/shop-sdk/${GITHUB_REF}/languages
12
+ ASSETS_URL=https://assets.p.thefittingroom.xyz/shop-sdk/assets
13
+ VTO_TIMEOUT_MS=120000
14
+ AVATAR_TIMEOUT_MS=120000
@@ -0,0 +1,9 @@
1
+ import { FirebaseUser } from '../firebase/firebase-user';
2
+ export declare class Fetcher {
3
+ private static Fetch;
4
+ static Get(user: FirebaseUser, endpointPath: string): Promise<Response>;
5
+ static Post(user: FirebaseUser, endpointPath: string, body?: Record<string, any>): Promise<Response>;
6
+ static Put(user: FirebaseUser, endpointPath: string, body: Record<string, any>): Promise<Response>;
7
+ static Patch(user: FirebaseUser, endpointPath: string, body: Record<string, any>): Promise<Response>;
8
+ static Delete(user: FirebaseUser, endpointPath: string, body: Record<string, any>): Promise<Response>;
9
+ }
@@ -0,0 +1,155 @@
1
+ export interface BodyMeasurement {
2
+ avatar_id: number;
3
+ position: number;
4
+ value: number;
5
+ }
6
+ export interface Avatar {
7
+ BrandID: string;
8
+ HeightCM: string;
9
+ WeightKG: string;
10
+ Gender: string;
11
+ BodyType: string;
12
+ SkinToneHex: string;
13
+ SkinToneFac: string;
14
+ FrameCount: string;
15
+ Video?: any;
16
+ }
17
+ export interface UpdateAvatarWebhook {
18
+ waist: number;
19
+ hip: number;
20
+ bust: number;
21
+ under_bust: number;
22
+ right_hip_x: number;
23
+ right_hip_y: number;
24
+ right_hip_z: number;
25
+ left_hip_x: number;
26
+ left_hip_y: number;
27
+ left_hip_z: number;
28
+ right_waist_x: number;
29
+ right_waist_y: number;
30
+ right_waist_z: number;
31
+ left_waist_x: number;
32
+ left_waist_y: number;
33
+ left_waist_z: number;
34
+ right_shoulder_x: number;
35
+ right_shoulder_y: number;
36
+ right_shoulder_z: number;
37
+ left_shoulder_x: number;
38
+ left_shoulder_y: number;
39
+ left_shoulder_z: number;
40
+ frames_storage_path: string;
41
+ object_storage_path: string;
42
+ }
43
+ export interface Brand {
44
+ name: string;
45
+ business_number: string;
46
+ logo_storage_path: string;
47
+ country_code: string;
48
+ about: string;
49
+ why_tfr: string;
50
+ specialty: string;
51
+ phone_number: string;
52
+ }
53
+ export interface Collection {
54
+ external_id: string;
55
+ name: string;
56
+ description: string;
57
+ }
58
+ export interface PatchColorwaySizeAsset {
59
+ Sku: string;
60
+ }
61
+ export interface ColorwaySizeAsset {
62
+ Sku: string;
63
+ File?: any;
64
+ }
65
+ export interface UpdateColorwaySizeAssetWebhook {
66
+ avatar_id: number;
67
+ frames_storage_path: string;
68
+ frame_count: number;
69
+ }
70
+ export interface Invitation {
71
+ email: string;
72
+ first_name: string;
73
+ last_name: string;
74
+ brand_id: number;
75
+ }
76
+ export interface GarmentMeasurement {
77
+ garment_measurement_location: string;
78
+ value: number;
79
+ tolerance: number;
80
+ }
81
+ export interface Size {
82
+ size_value_id: number;
83
+ label: string;
84
+ garment_measurements: GarmentMeasurement[];
85
+ }
86
+ export interface Colorway {
87
+ name: string;
88
+ }
89
+ export interface Style {
90
+ brand_style_id: string;
91
+ collection_id?: number;
92
+ name: string;
93
+ description: string;
94
+ sale_type: string;
95
+ garment_category_id: number;
96
+ sizes: Size[];
97
+ colorways: Colorway[];
98
+ }
99
+ export interface StylePatch {
100
+ publish: boolean;
101
+ }
102
+ export interface User {
103
+ first_name: string;
104
+ last_name: string;
105
+ date_of_birth: string;
106
+ job: string;
107
+ }
108
+ export interface InvitedUser {
109
+ token: string;
110
+ password: string;
111
+ }
112
+ export interface Joint {
113
+ id: number;
114
+ name: string;
115
+ side: string;
116
+ x: number;
117
+ y: number;
118
+ z: number;
119
+ }
120
+ export interface Joints {
121
+ right_hip_x: number;
122
+ right_hip_y: number;
123
+ right_hip_z: number;
124
+ left_hip_x: number;
125
+ left_hip_y: number;
126
+ left_hip_z: number;
127
+ right_waist_x: number;
128
+ right_waist_y: number;
129
+ right_waist_z: number;
130
+ left_waist_x: number;
131
+ left_waist_y: number;
132
+ left_waist_z: number;
133
+ right_shoulder_x: number;
134
+ right_shoulder_y: number;
135
+ right_shoulder_z: number;
136
+ left_shoulder_x: number;
137
+ left_shoulder_y: number;
138
+ left_shoulder_z: number;
139
+ }
140
+ export interface FramesRequest {
141
+ user_id: string;
142
+ avatar_id: number;
143
+ gender: string;
144
+ garment_id: number;
145
+ colorway_id: number;
146
+ size_id: number;
147
+ avatar: string;
148
+ garment: string;
149
+ material: string;
150
+ textures: string;
151
+ hex_value: string;
152
+ color_value: number;
153
+ frame_count: number;
154
+ joints: Joints;
155
+ }
@@ -0,0 +1,119 @@
1
+ export interface BodyMeasurement {
2
+ id: number;
3
+ position: number;
4
+ value: number;
5
+ }
6
+ export interface Avatar {
7
+ id: number;
8
+ user_id?: string;
9
+ brand_id?: number;
10
+ recorded_video_storage_path?: string;
11
+ height_cm?: number;
12
+ weight_kg?: number;
13
+ gender?: string;
14
+ skin_tone_hex?: string;
15
+ skin_tone_fac?: number;
16
+ body_measurements?: BodyMeasurement[];
17
+ }
18
+ export interface Brand {
19
+ id: number;
20
+ name: string;
21
+ business_number: string;
22
+ logo_storage_path: string;
23
+ country_code: string;
24
+ about: string;
25
+ why_tfr: string;
26
+ specialty: string;
27
+ phone_number: string;
28
+ }
29
+ export interface Collection {
30
+ id: number;
31
+ brand_id: number;
32
+ external_id: string;
33
+ name: string;
34
+ description: string;
35
+ }
36
+ export interface ColorwaySizeAsset {
37
+ id: number;
38
+ sku: string;
39
+ size_id: number;
40
+ colorway_id: number;
41
+ folder_storage_path: string;
42
+ obj_file_name: string;
43
+ mtl_file_name: string;
44
+ texture_folder_name: string;
45
+ }
46
+ export interface ID {
47
+ id: number;
48
+ }
49
+ export interface UserID {
50
+ user_id: string;
51
+ }
52
+ export interface UpdatedAt {
53
+ updated_at: any;
54
+ }
55
+ export interface IsPublished {
56
+ is_published: boolean;
57
+ }
58
+ export interface Invitation {
59
+ email: string;
60
+ first_name: string;
61
+ last_name: string;
62
+ expires_at?: any;
63
+ }
64
+ export interface SizeRecommendationIDs {
65
+ recommended_size_id: number;
66
+ available_size_ids: number[];
67
+ }
68
+ export interface SizeRecommendation {
69
+ recommended_sizes: Size;
70
+ available_sizes: Size[];
71
+ }
72
+ export interface GarmentMeasurement {
73
+ id: number;
74
+ garment_measurement_location: string;
75
+ value: number;
76
+ tolerance: number;
77
+ }
78
+ export interface Size {
79
+ id: number;
80
+ size_value: SizeValue;
81
+ label?: string;
82
+ garment_measurements?: GarmentMeasurement[];
83
+ }
84
+ export interface SizeValue {
85
+ id: any;
86
+ size: string;
87
+ size_system: string;
88
+ }
89
+ export interface GarmentCategory {
90
+ id: number;
91
+ garment_category: string;
92
+ garment_subcategory: string;
93
+ }
94
+ export interface Colorway {
95
+ id: number;
96
+ name: string;
97
+ }
98
+ export interface Style {
99
+ id: number;
100
+ brand_id?: number;
101
+ brand_style_id: string;
102
+ collection_id: number;
103
+ name?: string;
104
+ description?: string;
105
+ sale_type?: string;
106
+ garment_category?: GarmentCategory;
107
+ sizes: Size[];
108
+ colorways: Colorway[];
109
+ is_published: boolean;
110
+ }
111
+ export interface User {
112
+ id: string;
113
+ brand_id: number;
114
+ first_name: string;
115
+ last_name: string;
116
+ email: string;
117
+ date_of_birth: any;
118
+ job: string;
119
+ }
@@ -0,0 +1,22 @@
1
+ import { Firebase } from '../firebase/firebase';
2
+ import * as types from '../types';
3
+ import { SizeRecommendation } from './responses';
4
+ export declare class TfrShop {
5
+ private readonly brandId;
6
+ private readonly firebase;
7
+ private static AVATAR_TIMEOUT;
8
+ constructor(brandId: string, firebase: Firebase);
9
+ get user(): import("../firebase/firebase-user").FirebaseUser;
10
+ get isLoggedIn(): boolean;
11
+ tryOn(colorwaySizeAssetSku: string): Promise<types.TryOnFrames>;
12
+ awaitAvatarCreated(): Promise<boolean>;
13
+ getRecommendedSize(brandStyleId: string): Promise<SizeRecommendation>;
14
+ getStyles(ids: number[], skus: string[]): Promise<Map<number, types.FirestoreStyle>>;
15
+ private awaitColorwaySizeAssetFrames;
16
+ private requestThenGetColorwaySizeAssetFrames;
17
+ private getColorwaySizeAssetFromSku;
18
+ private getColorwaySizeAssets;
19
+ private requestColorwaySizeAssetFrames;
20
+ private getColorwaySizeAssetFrames;
21
+ }
22
+ export declare const initShop: (brandId: string) => TfrShop;
@@ -0,0 +1 @@
1
+ export declare const TestImage: (url: string) => Promise<boolean>;
@@ -0,0 +1,2 @@
1
+ import { FirebaseError } from 'firebase/app';
2
+ export declare const getFirebaseError: (e: FirebaseError) => never;
@@ -0,0 +1,18 @@
1
+ import * as firebase from 'firebase/app';
2
+ import * as firebaseAuth from 'firebase/auth';
3
+ import { Firestore } from 'firebase/firestore';
4
+ export declare class FirebaseUser {
5
+ private readonly firestore;
6
+ private user;
7
+ private readonly auth;
8
+ constructor(firestore: Firestore, app: firebase.FirebaseApp);
9
+ get id(): string;
10
+ onInit(): Promise<void>;
11
+ setUser(user: firebaseAuth.User): void;
12
+ getToken(): Promise<string>;
13
+ getUserProfile(): Promise<import("@firebase/firestore").DocumentData>;
14
+ login(username: string, password: string): Promise<void>;
15
+ logout(): Promise<void>;
16
+ sendPasswordResetEmail(email: string): Promise<void>;
17
+ confirmPasswordReset(code: string, newPassword: string): Promise<void>;
18
+ }
@@ -0,0 +1,15 @@
1
+ import { DocumentData, QueryFieldFilterConstraint, QuerySnapshot } from 'firebase/firestore';
2
+ import { FirebaseUser } from './firebase-user';
3
+ export declare class Firebase {
4
+ user: FirebaseUser;
5
+ private static readonly App;
6
+ private readonly firestore;
7
+ constructor();
8
+ onInit(): Promise<void>;
9
+ query(collectionName: string, constraint: QueryFieldFilterConstraint): {
10
+ promise: Promise<QuerySnapshot<DocumentData>>;
11
+ unsubscribe: () => void;
12
+ };
13
+ getDocs(collectionName: string, constraints: QueryFieldFilterConstraint[]): Promise<QuerySnapshot<DocumentData>>;
14
+ private promisefyOnSnapshot;
15
+ }
@@ -0,0 +1 @@
1
+ export declare const asyncTry: <T>(promise: Promise<T>) => Promise<[Error, T] | [Error]>;
@@ -0,0 +1,28 @@
1
+ export interface ErrorResponse {
2
+ error: string;
3
+ }
4
+ export interface ErrorOutsideRecommendedSizes {
5
+ error: string;
6
+ recommended_size_id: number;
7
+ available_size_ids: number[];
8
+ }
9
+ export declare class NoFramesFoundError extends Error {
10
+ constructor();
11
+ }
12
+ export declare class RequestTimeoutError extends Error {
13
+ constructor();
14
+ }
15
+ export declare class UserNotLoggedInError extends Error {
16
+ constructor();
17
+ }
18
+ export declare class NoColorwaySizeAssetsFoundError extends Error {
19
+ constructor();
20
+ }
21
+ export declare class NoStylesFoundError extends Error {
22
+ constructor();
23
+ }
24
+ export declare class RecommendedAvailableSizesError extends Error {
25
+ recommended_size: string;
26
+ available_sizes: string[];
27
+ constructor(recommended_size: string, available_sizes: string[]);
28
+ }
@@ -0,0 +1,6 @@
1
+ export * as requests from './api/requests';
2
+ export * as responses from './api/responses';
3
+ export { initShop } from './api/shop';
4
+ export type { TfrShop } from './api/shop';
5
+ export * as Errors from './helpers/errors';
6
+ export * as types from './types';