@geins/types 0.1.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/codegen.ts +49 -0
- package/dist/api-client/index.d.ts +23 -0
- package/dist/cms/contentArea.d.ts +50 -0
- package/dist/cms/index.d.ts +2 -0
- package/dist/cms/menu.d.ts +10 -0
- package/dist/common/channel.d.ts +4 -0
- package/dist/common/event.d.ts +39 -0
- package/dist/common/index.d.ts +21 -0
- package/dist/crm/auth.d.ts +152 -0
- package/dist/crm/index.d.ts +1 -0
- package/dist/generated/graphql.d.ts +3832 -0
- package/dist/generated/index.d.ts +1 -0
- package/dist/index.cjs +1257 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.esm.js +1257 -0
- package/dist/pim/brand.d.ts +19 -0
- package/dist/pim/filter.d.ts +31 -0
- package/dist/pim/index.d.ts +3 -0
- package/dist/pim/list.d.ts +31 -0
- package/dist/search/index.d.ts +1 -0
- package/dist/search/product.d.ts +11 -0
- package/package.json +28 -0
- package/rollup.config.js +18 -0
- package/src/api-client/index.ts +25 -0
- package/src/cms/contentArea.ts +59 -0
- package/src/cms/index.ts +2 -0
- package/src/cms/menu.ts +28 -0
- package/src/common/channel.ts +46 -0
- package/src/common/event.ts +43 -0
- package/src/common/index.ts +27 -0
- package/src/crm/auth.ts +177 -0
- package/src/crm/index.ts +2 -0
- package/src/crm/userOrders.ts +55 -0
- package/src/generated/graphql.ts +4103 -0
- package/src/generated/index.ts +1 -0
- package/src/index.ts +7 -0
- package/src/pim/brand.ts +21 -0
- package/src/pim/filter.ts +34 -0
- package/src/pim/index.ts +3 -0
- package/src/pim/list.ts +38 -0
- package/src/pim/product.ts +0 -0
- package/src/pim/shared.ts +14 -0
- package/src/search/index.ts +1 -0
- package/src/search/product.ts +12 -0
- package/tsconfig.json +18 -0
package/codegen.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { CodegenConfig } from '@graphql-codegen/cli';
|
|
2
|
+
const config: CodegenConfig = {
|
|
3
|
+
schema: '../../../schemas/schema-w-docblocks.graphql',
|
|
4
|
+
documents: [
|
|
5
|
+
'../core/src/graphql/**/*.gql',
|
|
6
|
+
'../cms/src/graphql/**/*.gql',
|
|
7
|
+
'../crm/src/graphql/**/*.gql',
|
|
8
|
+
],
|
|
9
|
+
generates: {
|
|
10
|
+
'src/generated/graphql.ts': {
|
|
11
|
+
plugins: ['typescript', 'typescript-operations', 'jsdoc'],
|
|
12
|
+
config: {
|
|
13
|
+
typesPrefix: 'Geins',
|
|
14
|
+
typesSuffix: 'Type',
|
|
15
|
+
addDocBlocks: true,
|
|
16
|
+
printFieldsOnNewLines: true,
|
|
17
|
+
declarationKind: 'interface',
|
|
18
|
+
skipTypename: true,
|
|
19
|
+
useTypeImports: true,
|
|
20
|
+
preResolveTypes: true,
|
|
21
|
+
flattenGeneratedTypes: true,
|
|
22
|
+
flattenGeneratedTypesIncludeFragments: true,
|
|
23
|
+
avoidOptionals: false,
|
|
24
|
+
allowUndefinedQueryVariables: true,
|
|
25
|
+
//globalNamespace: 'Geins',
|
|
26
|
+
//directiveArgumentAndInputFieldMappingTypeSuffix: 'DirectiveArgs',
|
|
27
|
+
extractAllFieldsToTypes: false,
|
|
28
|
+
omitOperationSuffix: true,
|
|
29
|
+
//operationResultSuffix: 'Result',
|
|
30
|
+
// namingConvention: 'change-case-all#camelCase',
|
|
31
|
+
enumPrefix: true,
|
|
32
|
+
enumSuffix: false,
|
|
33
|
+
scalars: {
|
|
34
|
+
ID: 'string | number',
|
|
35
|
+
Int: 'number',
|
|
36
|
+
Float: 'number',
|
|
37
|
+
Long: 'number',
|
|
38
|
+
String: 'string',
|
|
39
|
+
Boolean: 'boolean',
|
|
40
|
+
Guid: 'string',
|
|
41
|
+
DateTime: 'string',
|
|
42
|
+
Decimal: 'number',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export default config;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Endpoints for the current environment.
|
|
3
|
+
* - main: The main api endpoint used to query Geins.
|
|
4
|
+
* - auth: The auth endpoint.
|
|
5
|
+
* - authSign: The auth sign endpoint.
|
|
6
|
+
* - image: The base image url
|
|
7
|
+
*/
|
|
8
|
+
export interface GeinsEndpoints {
|
|
9
|
+
main: string;
|
|
10
|
+
auth: string;
|
|
11
|
+
authSign: string;
|
|
12
|
+
image: string;
|
|
13
|
+
}
|
|
14
|
+
export interface GeinsBaseApiVars {
|
|
15
|
+
channelId?: string | null;
|
|
16
|
+
marketId?: string | null;
|
|
17
|
+
languageId?: string | null;
|
|
18
|
+
}
|
|
19
|
+
export interface ManagementApiCredentials {
|
|
20
|
+
apiKey: string;
|
|
21
|
+
username: string;
|
|
22
|
+
password: string;
|
|
23
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { KeyValue } from '../common';
|
|
2
|
+
import { GeinsCustomerType } from '../generated';
|
|
3
|
+
import type { GeinsBaseApiVars } from '../api-client';
|
|
4
|
+
export interface ContentPageVariables extends BaseCmsVariables {
|
|
5
|
+
alias: string;
|
|
6
|
+
}
|
|
7
|
+
export interface ContentAreaVariables extends BaseCmsVariables {
|
|
8
|
+
areaName: string;
|
|
9
|
+
family: string;
|
|
10
|
+
}
|
|
11
|
+
export interface BaseCmsVariables extends GeinsBaseApiVars {
|
|
12
|
+
customerType?: GeinsCustomerType | null;
|
|
13
|
+
preview?: boolean | null;
|
|
14
|
+
filters?: Array<KeyValue> | null;
|
|
15
|
+
displaySetting?: string | null;
|
|
16
|
+
}
|
|
17
|
+
export interface ContentImageSizeType {
|
|
18
|
+
imageWidth: number;
|
|
19
|
+
imageHeight: number;
|
|
20
|
+
}
|
|
21
|
+
export interface ContentImageType {
|
|
22
|
+
fileName: string;
|
|
23
|
+
largestSize: ContentImageSizeType;
|
|
24
|
+
}
|
|
25
|
+
export interface ContentType {
|
|
26
|
+
id: string;
|
|
27
|
+
name: string;
|
|
28
|
+
sortOrder: number;
|
|
29
|
+
type: string;
|
|
30
|
+
size: string;
|
|
31
|
+
configuration: string;
|
|
32
|
+
images: ContentImageType[];
|
|
33
|
+
}
|
|
34
|
+
export interface ContentContainerType {
|
|
35
|
+
id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
sortOrder: number;
|
|
38
|
+
layout: string;
|
|
39
|
+
responsiveMode: string;
|
|
40
|
+
design: string;
|
|
41
|
+
content: ContentType[];
|
|
42
|
+
}
|
|
43
|
+
export interface ContentAreaType {
|
|
44
|
+
meta: any;
|
|
45
|
+
tags: string[];
|
|
46
|
+
containers: ContentContainerType[];
|
|
47
|
+
}
|
|
48
|
+
export interface ContentPageServiceResult {
|
|
49
|
+
contentArea: ContentAreaType;
|
|
50
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { GeinsBaseApiVars } from '../api-client';
|
|
2
|
+
import { GeinsMenuTypeType } from '../generated';
|
|
3
|
+
export interface MenuVariables extends GeinsBaseApiVars {
|
|
4
|
+
menuLocationId: string;
|
|
5
|
+
}
|
|
6
|
+
export interface MenuServiceResult {
|
|
7
|
+
data: {
|
|
8
|
+
getMenuAtLocation: GeinsMenuTypeType;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event message interface
|
|
3
|
+
* @interface
|
|
4
|
+
* @name GeinsEventMessage
|
|
5
|
+
* @property {string} subject - Event subject
|
|
6
|
+
* @property {any} payload - Event payload
|
|
7
|
+
* @property {boolean} [broadcast] - Broadcast event over windows and tabs
|
|
8
|
+
* @example
|
|
9
|
+
* {
|
|
10
|
+
* subject: 'USER_LOGIN',
|
|
11
|
+
* payload: {
|
|
12
|
+
* user: 'luke.skywalker@tatooine.com',
|
|
13
|
+
* },
|
|
14
|
+
* broadcast: true,
|
|
15
|
+
* }
|
|
16
|
+
*/
|
|
17
|
+
export interface GeinsEventMessage {
|
|
18
|
+
subject: string;
|
|
19
|
+
payload: any;
|
|
20
|
+
broadcast?: boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Event type
|
|
24
|
+
* Events emitted by the SDK to listen to
|
|
25
|
+
* @enum
|
|
26
|
+
* @name GeinsEventType
|
|
27
|
+
*/
|
|
28
|
+
export declare enum GeinsEventType {
|
|
29
|
+
USER = "USER",
|
|
30
|
+
USER_LOGIN = "USER_LOGIN",
|
|
31
|
+
USER_LOGOUT = "USER_LOGOUT",
|
|
32
|
+
USER_UPDATE = "USER_UPDATE",
|
|
33
|
+
USER_DELETE = "USER_DELETE",
|
|
34
|
+
CART = "CART",
|
|
35
|
+
CART_ADD = "CART_ADD",
|
|
36
|
+
CART_REMOVE = "CART_REMOVE",
|
|
37
|
+
CART_UPDATE = "CART_UPDATE",
|
|
38
|
+
CART_CLEAR = "CART_CLEAR"
|
|
39
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { GeinsChannelTypeType } from '../generated';
|
|
2
|
+
export * from './channel';
|
|
3
|
+
export * from './event';
|
|
4
|
+
export type Environment = 'prod' | 'qa' | 'dev';
|
|
5
|
+
export interface KeyValue {
|
|
6
|
+
key: string;
|
|
7
|
+
value: string;
|
|
8
|
+
}
|
|
9
|
+
export type GeinsSettings = {
|
|
10
|
+
apiKey: string;
|
|
11
|
+
accountName: string;
|
|
12
|
+
channel: string;
|
|
13
|
+
tld: string;
|
|
14
|
+
locale: string;
|
|
15
|
+
market: string;
|
|
16
|
+
environment?: Environment;
|
|
17
|
+
};
|
|
18
|
+
export interface GeinsChannelInterface {
|
|
19
|
+
current: () => Promise<GeinsChannelTypeType | undefined>;
|
|
20
|
+
all: () => Promise<GeinsChannelTypeType[] | undefined>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface representing the authentication credentials required for user login.
|
|
3
|
+
*/
|
|
4
|
+
export interface AuthCredentials {
|
|
5
|
+
/**
|
|
6
|
+
* The username of the user attempting to authenticate.
|
|
7
|
+
*/
|
|
8
|
+
username: string;
|
|
9
|
+
/**
|
|
10
|
+
* The password of the user attempting to authenticate.
|
|
11
|
+
*/
|
|
12
|
+
password: string;
|
|
13
|
+
/**
|
|
14
|
+
* The new password for the user, used when updating or resetting a password.
|
|
15
|
+
* This field is optional.
|
|
16
|
+
*/
|
|
17
|
+
newPassword?: string;
|
|
18
|
+
/**
|
|
19
|
+
* A boolean indicating whether the user should be remembered on this device.
|
|
20
|
+
* Defaults to `false` if not provided.
|
|
21
|
+
*/
|
|
22
|
+
rememberUser?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Interface representing the response from an authentication attempt.
|
|
26
|
+
*/
|
|
27
|
+
export interface AuthResponse {
|
|
28
|
+
/**
|
|
29
|
+
* A boolean indicating whether the authentication attempt was successful.
|
|
30
|
+
*/
|
|
31
|
+
succeeded: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* The authenticated user information, if the authentication was successful.
|
|
34
|
+
* This field is optional.
|
|
35
|
+
*/
|
|
36
|
+
user?: AuthUser;
|
|
37
|
+
/**
|
|
38
|
+
* The tokens provided upon successful authentication, used for session management.
|
|
39
|
+
* This field is optional.
|
|
40
|
+
*/
|
|
41
|
+
tokens?: AuthTokens;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Interface representing the authentication tokens used for session management.
|
|
45
|
+
*/
|
|
46
|
+
export interface AuthTokens {
|
|
47
|
+
/**
|
|
48
|
+
* The primary token used for authenticating subsequent API requests.
|
|
49
|
+
* This field is optional.
|
|
50
|
+
*/
|
|
51
|
+
token?: string;
|
|
52
|
+
/**
|
|
53
|
+
* The refresh token used to obtain a new primary token when the current one expires.
|
|
54
|
+
* This field is optional.
|
|
55
|
+
*/
|
|
56
|
+
refreshToken?: string;
|
|
57
|
+
/**
|
|
58
|
+
* The maximum age (in seconds) for the session before it expires.
|
|
59
|
+
* This field is optional.
|
|
60
|
+
*/
|
|
61
|
+
maxAge?: number;
|
|
62
|
+
/**
|
|
63
|
+
* A boolean indicating whether the token has already expired.
|
|
64
|
+
* This field is optional.
|
|
65
|
+
*/
|
|
66
|
+
expired?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* The expiration timestamp (in milliseconds since Unix epoch) of the token.
|
|
69
|
+
* This field is optional.
|
|
70
|
+
*/
|
|
71
|
+
expires?: number;
|
|
72
|
+
/**
|
|
73
|
+
* The number of seconds until the token expires.
|
|
74
|
+
* This field is optional.
|
|
75
|
+
*/
|
|
76
|
+
expiresIn?: number;
|
|
77
|
+
/**
|
|
78
|
+
* A boolean indicating whether the token is about to expire soon.
|
|
79
|
+
* This field is optional.
|
|
80
|
+
*/
|
|
81
|
+
expiresSoon?: boolean;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Interface representing the authenticated user information.
|
|
85
|
+
*/
|
|
86
|
+
export interface AuthUser {
|
|
87
|
+
/**
|
|
88
|
+
* A boolean indicating whether the user is authenticated.
|
|
89
|
+
* This field is optional.
|
|
90
|
+
*/
|
|
91
|
+
authenticated?: boolean;
|
|
92
|
+
/**
|
|
93
|
+
* The unique identifier of the authenticated user.
|
|
94
|
+
* This field is optional.
|
|
95
|
+
*/
|
|
96
|
+
userId?: string;
|
|
97
|
+
/**
|
|
98
|
+
* The username of the authenticated user.
|
|
99
|
+
* This field is optional.
|
|
100
|
+
*/
|
|
101
|
+
username?: string;
|
|
102
|
+
/**
|
|
103
|
+
* The type of customer (e.g., regular, premium) the authenticated user is.
|
|
104
|
+
* This field is optional.
|
|
105
|
+
*/
|
|
106
|
+
customerType?: string;
|
|
107
|
+
/**
|
|
108
|
+
* The discount percentage (if any) available to the authenticated user.
|
|
109
|
+
* This field is optional.
|
|
110
|
+
*/
|
|
111
|
+
memberDiscount?: string;
|
|
112
|
+
/**
|
|
113
|
+
* The type of membership (e.g., silver, gold) the authenticated user has.
|
|
114
|
+
* This field is optional.
|
|
115
|
+
*/
|
|
116
|
+
memberType?: string;
|
|
117
|
+
/**
|
|
118
|
+
* The unique identifier of the membership the authenticated user holds.
|
|
119
|
+
* This field is optional.
|
|
120
|
+
*/
|
|
121
|
+
memberId?: string;
|
|
122
|
+
}
|
|
123
|
+
export interface AuthUserToken {
|
|
124
|
+
maxAge: number;
|
|
125
|
+
token: string;
|
|
126
|
+
refreshToken: string;
|
|
127
|
+
}
|
|
128
|
+
export interface AuthSignature {
|
|
129
|
+
identity: string;
|
|
130
|
+
signature: string;
|
|
131
|
+
timestamp: string;
|
|
132
|
+
}
|
|
133
|
+
export declare enum AuthClientConnectionModes {
|
|
134
|
+
Proxy = "Proxy",
|
|
135
|
+
Direct = "Direct"
|
|
136
|
+
}
|
|
137
|
+
export type AuthClientConnectionMode = keyof typeof AuthClientConnectionModes;
|
|
138
|
+
/**
|
|
139
|
+
* Authentication settings used by the client.
|
|
140
|
+
*/
|
|
141
|
+
export interface AuthSettings {
|
|
142
|
+
/**
|
|
143
|
+
* The client connection mode used for authentication.
|
|
144
|
+
*/
|
|
145
|
+
clientConnectionMode: AuthClientConnectionMode;
|
|
146
|
+
/**
|
|
147
|
+
* The URL of the proxy server used for authentication.
|
|
148
|
+
* This field is optional.
|
|
149
|
+
* Defaults to `/api/auth` if not provided.
|
|
150
|
+
*/
|
|
151
|
+
proxyUrl?: string;
|
|
152
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './auth';
|