@gofynd/fdk-client-javascript 0.1.35
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/.github/workflows/on_create_release.yml +23 -0
- package/.github/workflows/on_merge_main.yml +38 -0
- package/.github/workflows/on_pull_request.yml +35 -0
- package/.prettierrc +5 -0
- package/LICENSE +21 -0
- package/README.md +118 -0
- package/application.d.ts +3 -0
- package/application.js +6 -0
- package/common.d.ts +4 -0
- package/common.js +9 -0
- package/documentation/application/CART.md +7290 -0
- package/documentation/application/CATALOG.md +9570 -0
- package/documentation/application/COMMON.md +448 -0
- package/documentation/application/COMMUNICATION.md +463 -0
- package/documentation/application/CONFIGURATION.md +2902 -0
- package/documentation/application/CONTENT.md +3350 -0
- package/documentation/application/FILESTORAGE.md +491 -0
- package/documentation/application/LEAD.md +1891 -0
- package/documentation/application/LOGISTIC.md +439 -0
- package/documentation/application/ORDER.md +3428 -0
- package/documentation/application/PAYMENT.md +5035 -0
- package/documentation/application/POSCART.md +7889 -0
- package/documentation/application/README.md +21 -0
- package/documentation/application/REWARDS.md +714 -0
- package/documentation/application/SHARE.md +729 -0
- package/documentation/application/THEME.md +5796 -0
- package/documentation/application/USER.md +4326 -0
- package/documentation/platform/ANALYTICS.md +1150 -0
- package/documentation/platform/AUDITTRAIL.md +572 -0
- package/documentation/platform/BILLING.md +2396 -0
- package/documentation/platform/CART.md +5539 -0
- package/documentation/platform/CATALOG.md +21624 -0
- package/documentation/platform/COMMON.md +448 -0
- package/documentation/platform/COMMUNICATION.md +5714 -0
- package/documentation/platform/COMPANYPROFILE.md +2141 -0
- package/documentation/platform/CONFIGURATION.md +7335 -0
- package/documentation/platform/CONTENT.md +8989 -0
- package/documentation/platform/DISCOUNT.md +773 -0
- package/documentation/platform/FILESTORAGE.md +994 -0
- package/documentation/platform/INVENTORY.md +1775 -0
- package/documentation/platform/LEAD.md +4736 -0
- package/documentation/platform/ORDER.md +3764 -0
- package/documentation/platform/PARTNER.md +216 -0
- package/documentation/platform/PAYMENT.md +3444 -0
- package/documentation/platform/README.md +27 -0
- package/documentation/platform/REWARDS.md +871 -0
- package/documentation/platform/SHARE.md +602 -0
- package/documentation/platform/THEME.md +35725 -0
- package/documentation/platform/USER.md +2305 -0
- package/documentation/platform/WEBHOOK.md +587 -0
- package/documentation/public/CONFIGURATION.md +448 -0
- package/documentation/public/INVENTORY.md +686 -0
- package/documentation/public/WEBHOOK.md +348 -0
- package/index.d.ts +10 -0
- package/index.js +18 -0
- package/jest.config.d.ts +4 -0
- package/jest.config.js +6 -0
- package/package.json +35 -0
- package/platform.d.ts +3 -0
- package/platform.js +6 -0
- package/public.d.ts +3 -0
- package/public.js +6 -0
- package/sdk/application/ApplicationAPIClient.d.ts +11 -0
- package/sdk/application/ApplicationAPIClient.js +44 -0
- package/sdk/application/ApplicationClient.d.ts +40 -0
- package/sdk/application/ApplicationClient.js +84 -0
- package/sdk/application/ApplicationConfig.d.ts +19 -0
- package/sdk/application/ApplicationConfig.js +55 -0
- package/sdk/application/ApplicationModels.d.ts +826 -0
- package/sdk/application/ApplicationModels.js +10474 -0
- package/sdk/application/client/CartApplicationClient.d.ts +432 -0
- package/sdk/application/client/CartApplicationClient.js +1066 -0
- package/sdk/application/client/CatalogApplicationClient.d.ts +694 -0
- package/sdk/application/client/CatalogApplicationClient.js +1629 -0
- package/sdk/application/client/CommonApplicationClient.d.ts +38 -0
- package/sdk/application/client/CommonApplicationClient.js +105 -0
- package/sdk/application/client/CommunicationApplicationClient.d.ts +39 -0
- package/sdk/application/client/CommunicationApplicationClient.js +131 -0
- package/sdk/application/client/ConfigurationApplicationClient.d.ts +210 -0
- package/sdk/application/client/ConfigurationApplicationClient.js +649 -0
- package/sdk/application/client/ContentApplicationClient.d.ts +256 -0
- package/sdk/application/client/ContentApplicationClient.js +785 -0
- package/sdk/application/client/FileStorageApplicationClient.d.ts +88 -0
- package/sdk/application/client/FileStorageApplicationClient.js +214 -0
- package/sdk/application/client/LeadApplicationClient.d.ts +90 -0
- package/sdk/application/client/LeadApplicationClient.js +264 -0
- package/sdk/application/client/LogisticApplicationClient.d.ts +42 -0
- package/sdk/application/client/LogisticApplicationClient.js +128 -0
- package/sdk/application/client/OrderApplicationClient.d.ts +190 -0
- package/sdk/application/client/OrderApplicationClient.js +479 -0
- package/sdk/application/client/PaymentApplicationClient.d.ts +454 -0
- package/sdk/application/client/PaymentApplicationClient.js +1378 -0
- package/sdk/application/client/PosCartApplicationClient.d.ts +449 -0
- package/sdk/application/client/PosCartApplicationClient.js +1123 -0
- package/sdk/application/client/RewardsApplicationClient.d.ts +93 -0
- package/sdk/application/client/RewardsApplicationClient.js +293 -0
- package/sdk/application/client/ShareApplicationClient.d.ts +87 -0
- package/sdk/application/client/ShareApplicationClient.js +268 -0
- package/sdk/application/client/ThemeApplicationClient.d.ts +52 -0
- package/sdk/application/client/ThemeApplicationClient.js +161 -0
- package/sdk/application/client/UserApplicationClient.d.ts +446 -0
- package/sdk/application/client/UserApplicationClient.js +1275 -0
- package/sdk/application/constructUrl.d.ts +5 -0
- package/sdk/application/constructUrl.js +13 -0
- package/sdk/application/index.d.ts +2 -0
- package/sdk/application/index.js +4 -0
- package/sdk/application/models/CartValidator.d.ts +29 -0
- package/sdk/application/models/CartValidator.js +223 -0
- package/sdk/application/models/CatalogValidator.d.ts +33 -0
- package/sdk/application/models/CatalogValidator.js +233 -0
- package/sdk/application/models/CommonValidator.d.ts +5 -0
- package/sdk/application/models/CommonValidator.js +18 -0
- package/sdk/application/models/CommunicationValidator.d.ts +6 -0
- package/sdk/application/models/CommunicationValidator.js +20 -0
- package/sdk/application/models/ConfigurationValidator.d.ts +19 -0
- package/sdk/application/models/ConfigurationValidator.js +88 -0
- package/sdk/application/models/ContentValidator.d.ts +22 -0
- package/sdk/application/models/ContentValidator.js +106 -0
- package/sdk/application/models/FileStorageValidator.d.ts +6 -0
- package/sdk/application/models/FileStorageValidator.js +24 -0
- package/sdk/application/models/LeadValidator.d.ts +10 -0
- package/sdk/application/models/LeadValidator.js +48 -0
- package/sdk/application/models/LogisticValidator.d.ts +6 -0
- package/sdk/application/models/LogisticValidator.js +22 -0
- package/sdk/application/models/OrderValidator.d.ts +15 -0
- package/sdk/application/models/OrderValidator.js +87 -0
- package/sdk/application/models/PaymentValidator.d.ts +40 -0
- package/sdk/application/models/PaymentValidator.js +235 -0
- package/sdk/application/models/PosCartValidator.d.ts +30 -0
- package/sdk/application/models/PosCartValidator.js +232 -0
- package/sdk/application/models/RewardsValidator.d.ts +10 -0
- package/sdk/application/models/RewardsValidator.js +43 -0
- package/sdk/application/models/ShareValidator.d.ts +10 -0
- package/sdk/application/models/ShareValidator.js +44 -0
- package/sdk/application/models/ThemeValidator.d.ts +7 -0
- package/sdk/application/models/ThemeValidator.js +27 -0
- package/sdk/application/models/UserValidator.d.ts +38 -0
- package/sdk/application/models/UserValidator.js +233 -0
- package/sdk/common/AxiosHelper.d.ts +1 -0
- package/sdk/common/AxiosHelper.js +141 -0
- package/sdk/common/Constant.d.ts +294 -0
- package/sdk/common/Constant.js +332 -0
- package/sdk/common/FDKError.d.ts +26 -0
- package/sdk/common/FDKError.js +51 -0
- package/sdk/common/Logger.d.ts +2 -0
- package/sdk/common/Logger.js +85 -0
- package/sdk/common/Paginator.d.ts +16 -0
- package/sdk/common/Paginator.js +26 -0
- package/sdk/common/RequestSigner.d.ts +1 -0
- package/sdk/common/RequestSigner.js +306 -0
- package/sdk/common/Utility.d.ts +9 -0
- package/sdk/common/Utility.js +86 -0
- package/sdk/common/utils.d.ts +14 -0
- package/sdk/common/utils.js +165 -0
- package/sdk/platform/OAuthClient.d.ts +26 -0
- package/sdk/platform/OAuthClient.js +221 -0
- package/sdk/platform/PlatformAPIClient.d.ts +12 -0
- package/sdk/platform/PlatformAPIClient.js +43 -0
- package/sdk/platform/PlatformApplicationClient.d.ts +24398 -0
- package/sdk/platform/PlatformApplicationClient.js +23185 -0
- package/sdk/platform/PlatformApplicationModels.d.ts +333 -0
- package/sdk/platform/PlatformApplicationModels.js +21262 -0
- package/sdk/platform/PlatformClient.d.ts +9535 -0
- package/sdk/platform/PlatformClient.js +12336 -0
- package/sdk/platform/PlatformConfig.d.ts +29 -0
- package/sdk/platform/PlatformConfig.js +36 -0
- package/sdk/platform/PlatformModels.d.ts +1396 -0
- package/sdk/platform/PlatformModels.js +19222 -0
- package/sdk/platform/client/AnalyticsPlatformClient.d.ts +84 -0
- package/sdk/platform/client/AnalyticsPlatformClient.js +215 -0
- package/sdk/platform/client/AuditTrailPlatformClient.d.ts +38 -0
- package/sdk/platform/client/AuditTrailPlatformClient.js +133 -0
- package/sdk/platform/client/BillingPlatformClient.d.ts +109 -0
- package/sdk/platform/client/BillingPlatformClient.js +381 -0
- package/sdk/platform/client/CatalogPlatformClient.d.ts +806 -0
- package/sdk/platform/client/CatalogPlatformClient.js +2462 -0
- package/sdk/platform/client/CommonPlatformClient.d.ts +30 -0
- package/sdk/platform/client/CommonPlatformClient.js +84 -0
- package/sdk/platform/client/CommunicationPlatformClient.d.ts +26 -0
- package/sdk/platform/client/CommunicationPlatformClient.js +72 -0
- package/sdk/platform/client/CompanyProfilePlatformClient.d.ts +182 -0
- package/sdk/platform/client/CompanyProfilePlatformClient.js +540 -0
- package/sdk/platform/client/ConfigurationPlatformClient.d.ts +277 -0
- package/sdk/platform/client/ConfigurationPlatformClient.js +806 -0
- package/sdk/platform/client/DiscountPlatformClient.d.ts +118 -0
- package/sdk/platform/client/DiscountPlatformClient.js +364 -0
- package/sdk/platform/client/FileStoragePlatformClient.d.ts +111 -0
- package/sdk/platform/client/FileStoragePlatformClient.js +268 -0
- package/sdk/platform/client/InventoryPlatformClient.d.ts +125 -0
- package/sdk/platform/client/InventoryPlatformClient.js +409 -0
- package/sdk/platform/client/LeadPlatformClient.d.ts +150 -0
- package/sdk/platform/client/LeadPlatformClient.js +439 -0
- package/sdk/platform/client/OrderPlatformClient.d.ts +190 -0
- package/sdk/platform/client/OrderPlatformClient.js +521 -0
- package/sdk/platform/client/PaymentPlatformClient.d.ts +98 -0
- package/sdk/platform/client/PaymentPlatformClient.js +331 -0
- package/sdk/platform/client/WebhookPlatformClient.d.ts +64 -0
- package/sdk/platform/client/WebhookPlatformClient.js +207 -0
- package/sdk/platform/index.d.ts +2 -0
- package/sdk/platform/index.js +4 -0
- package/sdk/platform/models/AnalyticsValidator.d.ts +7 -0
- package/sdk/platform/models/AnalyticsValidator.js +36 -0
- package/sdk/platform/models/AuditTrailValidator.d.ts +7 -0
- package/sdk/platform/models/AuditTrailValidator.js +26 -0
- package/sdk/platform/models/BillingValidator.d.ts +15 -0
- package/sdk/platform/models/BillingValidator.js +72 -0
- package/sdk/platform/models/CartValidator.d.ts +0 -0
- package/sdk/platform/models/CartValidator.js +0 -0
- package/sdk/platform/models/CatalogValidator.d.ts +74 -0
- package/sdk/platform/models/CatalogValidator.js +484 -0
- package/sdk/platform/models/CommonValidator.d.ts +5 -0
- package/sdk/platform/models/CommonValidator.js +18 -0
- package/sdk/platform/models/CommunicationValidator.d.ts +4 -0
- package/sdk/platform/models/CommunicationValidator.js +11 -0
- package/sdk/platform/models/CompanyProfileValidator.d.ts +17 -0
- package/sdk/platform/models/CompanyProfileValidator.js +93 -0
- package/sdk/platform/models/ConfigurationValidator.d.ts +21 -0
- package/sdk/platform/models/ConfigurationValidator.js +134 -0
- package/sdk/platform/models/ContentValidator.d.ts +0 -0
- package/sdk/platform/models/ContentValidator.js +0 -0
- package/sdk/platform/models/DiscountValidator.d.ts +13 -0
- package/sdk/platform/models/DiscountValidator.js +75 -0
- package/sdk/platform/models/FileStorageValidator.d.ts +9 -0
- package/sdk/platform/models/FileStorageValidator.js +44 -0
- package/sdk/platform/models/InventoryValidator.d.ts +15 -0
- package/sdk/platform/models/InventoryValidator.js +81 -0
- package/sdk/platform/models/LeadValidator.d.ts +14 -0
- package/sdk/platform/models/LeadValidator.js +78 -0
- package/sdk/platform/models/OrderValidator.d.ts +14 -0
- package/sdk/platform/models/OrderValidator.js +110 -0
- package/sdk/platform/models/PartnerValidator.d.ts +0 -0
- package/sdk/platform/models/PartnerValidator.js +0 -0
- package/sdk/platform/models/PaymentValidator.d.ts +13 -0
- package/sdk/platform/models/PaymentValidator.js +65 -0
- package/sdk/platform/models/RewardsValidator.d.ts +0 -0
- package/sdk/platform/models/RewardsValidator.js +0 -0
- package/sdk/platform/models/ShareValidator.d.ts +0 -0
- package/sdk/platform/models/ShareValidator.js +0 -0
- package/sdk/platform/models/ThemeValidator.d.ts +0 -0
- package/sdk/platform/models/ThemeValidator.js +0 -0
- package/sdk/platform/models/UserValidator.d.ts +0 -0
- package/sdk/platform/models/UserValidator.js +0 -0
- package/sdk/platform/models/WebhookValidator.d.ts +9 -0
- package/sdk/platform/models/WebhookValidator.js +42 -0
- package/sdk/public/PublicAPIClient.d.ts +11 -0
- package/sdk/public/PublicAPIClient.js +38 -0
- package/sdk/public/PublicClient.d.ts +12 -0
- package/sdk/public/PublicClient.js +24 -0
- package/sdk/public/PublicConfig.d.ts +10 -0
- package/sdk/public/PublicConfig.js +12 -0
- package/sdk/public/PublicModels.d.ts +50 -0
- package/sdk/public/PublicModels.js +712 -0
- package/sdk/public/client/ConfigurationPublicClient.d.ts +38 -0
- package/sdk/public/client/ConfigurationPublicClient.js +102 -0
- package/sdk/public/client/InventoryPublicClient.d.ts +81 -0
- package/sdk/public/client/InventoryPublicClient.js +239 -0
- package/sdk/public/client/WebhookPublicClient.d.ts +28 -0
- package/sdk/public/client/WebhookPublicClient.js +92 -0
- package/sdk/public/constructUrl.d.ts +5 -0
- package/sdk/public/constructUrl.js +13 -0
- package/sdk/public/index.d.ts +2 -0
- package/sdk/public/index.js +4 -0
- package/sdk/public/models/ConfigurationValidator.d.ts +5 -0
- package/sdk/public/models/ConfigurationValidator.js +18 -0
- package/sdk/public/models/InventoryValidator.d.ts +9 -0
- package/sdk/public/models/InventoryValidator.js +43 -0
- package/sdk/public/models/WebhookValidator.d.ts +5 -0
- package/sdk/public/models/WebhookValidator.js +14 -0
- package/tests/application/catalog.spec.js +47 -0
- package/tests/common/action-url.spec.js +35 -0
- package/tests/common/schema/action-url.json +163 -0
- package/tests/common/schema/url-action.json +667 -0
- package/tests/common/url-action.spec.js +48 -0
- package/tests/helpers/cookie.helper.js +31 -0
- package/tests/helpers/oauth.helper.js +43 -0
- package/tests/platform/catalog.spec.js +49 -0
- package/tests/public/location.spec.js +39 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
const Joi = require("joi");
|
|
2
|
+
const { Validator } = require("../ApplicationModels");
|
|
3
|
+
class UserValidator {
|
|
4
|
+
static loginWithFacebook() {
|
|
5
|
+
return Joi.object({
|
|
6
|
+
platform: Joi.string().allow(""),
|
|
7
|
+
body: Validator.OAuthRequestSchema().required(),
|
|
8
|
+
}).required();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
static loginWithGoogle() {
|
|
12
|
+
return Joi.object({
|
|
13
|
+
platform: Joi.string().allow(""),
|
|
14
|
+
body: Validator.OAuthRequestSchema().required(),
|
|
15
|
+
}).required();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static loginWithGoogleAndroid() {
|
|
19
|
+
return Joi.object({
|
|
20
|
+
platform: Joi.string().allow(""),
|
|
21
|
+
body: Validator.OAuthRequestSchema().required(),
|
|
22
|
+
}).required();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static loginWithGoogleIOS() {
|
|
26
|
+
return Joi.object({
|
|
27
|
+
platform: Joi.string().allow(""),
|
|
28
|
+
body: Validator.OAuthRequestSchema().required(),
|
|
29
|
+
}).required();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
static loginWithAppleIOS() {
|
|
33
|
+
return Joi.object({
|
|
34
|
+
platform: Joi.string().allow(""),
|
|
35
|
+
body: Validator.OAuthRequestAppleSchema().required(),
|
|
36
|
+
}).required();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
static loginWithOTP() {
|
|
40
|
+
return Joi.object({
|
|
41
|
+
platform: Joi.string().allow(""),
|
|
42
|
+
body: Validator.SendOtpRequestSchema().required(),
|
|
43
|
+
}).required();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static loginWithEmailAndPassword() {
|
|
47
|
+
return Joi.object({
|
|
48
|
+
body: Validator.PasswordLoginRequestSchema().required(),
|
|
49
|
+
}).required();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static sendResetPasswordEmail() {
|
|
53
|
+
return Joi.object({
|
|
54
|
+
platform: Joi.string().allow(""),
|
|
55
|
+
body: Validator.SendResetPasswordEmailRequestSchema().required(),
|
|
56
|
+
}).required();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
static sendResetPasswordMobile() {
|
|
60
|
+
return Joi.object({
|
|
61
|
+
platform: Joi.string().allow(""),
|
|
62
|
+
body: Validator.SendResetPasswordMobileRequestSchema().required(),
|
|
63
|
+
}).required();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static forgotPassword() {
|
|
67
|
+
return Joi.object({
|
|
68
|
+
body: Validator.ForgotPasswordRequestSchema().required(),
|
|
69
|
+
}).required();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
static sendResetToken() {
|
|
73
|
+
return Joi.object({
|
|
74
|
+
body: Validator.CodeRequestBodySchema().required(),
|
|
75
|
+
}).required();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
static loginWithToken() {
|
|
79
|
+
return Joi.object({
|
|
80
|
+
body: Validator.TokenRequestBodySchema().required(),
|
|
81
|
+
}).required();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
static registerWithForm() {
|
|
85
|
+
return Joi.object({
|
|
86
|
+
platform: Joi.string().allow(""),
|
|
87
|
+
body: Validator.FormRegisterRequestSchema().required(),
|
|
88
|
+
}).required();
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
static verifyEmail() {
|
|
92
|
+
return Joi.object({
|
|
93
|
+
body: Validator.CodeRequestBodySchema().required(),
|
|
94
|
+
}).required();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
static verifyMobile() {
|
|
98
|
+
return Joi.object({
|
|
99
|
+
body: Validator.CodeRequestBodySchema().required(),
|
|
100
|
+
}).required();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
static hasPassword() {
|
|
104
|
+
return Joi.object({});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
static updatePassword() {
|
|
108
|
+
return Joi.object({
|
|
109
|
+
body: Validator.UpdatePasswordRequestSchema().required(),
|
|
110
|
+
}).required();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
static deleteUser() {
|
|
114
|
+
return Joi.object({
|
|
115
|
+
body: Validator.DeleteApplicationUserRequestSchema().required(),
|
|
116
|
+
}).required();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
static logout() {
|
|
120
|
+
return Joi.object({});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
static sendOTPOnMobile() {
|
|
124
|
+
return Joi.object({
|
|
125
|
+
platform: Joi.string().allow(""),
|
|
126
|
+
body: Validator.SendMobileOtpRequestSchema().required(),
|
|
127
|
+
}).required();
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
static verifyMobileOTP() {
|
|
131
|
+
return Joi.object({
|
|
132
|
+
platform: Joi.string().allow(""),
|
|
133
|
+
body: Validator.VerifyOtpRequestSchema().required(),
|
|
134
|
+
}).required();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
static sendOTPOnEmail() {
|
|
138
|
+
return Joi.object({
|
|
139
|
+
platform: Joi.string().allow(""),
|
|
140
|
+
body: Validator.SendEmailOtpRequestSchema().required(),
|
|
141
|
+
}).required();
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
static verifyEmailOTP() {
|
|
145
|
+
return Joi.object({
|
|
146
|
+
platform: Joi.string().allow(""),
|
|
147
|
+
body: Validator.VerifyEmailOtpRequestSchema().required(),
|
|
148
|
+
}).required();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
static getLoggedInUser() {
|
|
152
|
+
return Joi.object({});
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
static getListOfActiveSessions() {
|
|
156
|
+
return Joi.object({});
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
static getPlatformConfig() {
|
|
160
|
+
return Joi.object({
|
|
161
|
+
name: Joi.string().allow(""),
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
static updateProfile() {
|
|
166
|
+
return Joi.object({
|
|
167
|
+
platform: Joi.string().allow(""),
|
|
168
|
+
body: Validator.EditProfileRequestSchema().required(),
|
|
169
|
+
}).required();
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
static addMobileNumber() {
|
|
173
|
+
return Joi.object({
|
|
174
|
+
platform: Joi.string().allow(""),
|
|
175
|
+
body: Validator.EditMobileRequestSchema().required(),
|
|
176
|
+
}).required();
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
static deleteMobileNumber() {
|
|
180
|
+
return Joi.object({
|
|
181
|
+
platform: Joi.string().allow(""),
|
|
182
|
+
active: Joi.boolean().required(),
|
|
183
|
+
primary: Joi.boolean().required(),
|
|
184
|
+
verified: Joi.boolean().required(),
|
|
185
|
+
countryCode: Joi.string().allow("").required(),
|
|
186
|
+
phone: Joi.string().allow("").required(),
|
|
187
|
+
}).required();
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
static setMobileNumberAsPrimary() {
|
|
191
|
+
return Joi.object({
|
|
192
|
+
body: Validator.SendVerificationLinkMobileRequestSchema().required(),
|
|
193
|
+
}).required();
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
static sendVerificationLinkToMobile() {
|
|
197
|
+
return Joi.object({
|
|
198
|
+
platform: Joi.string().allow(""),
|
|
199
|
+
body: Validator.SendVerificationLinkMobileRequestSchema().required(),
|
|
200
|
+
}).required();
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
static addEmail() {
|
|
204
|
+
return Joi.object({
|
|
205
|
+
platform: Joi.string().allow(""),
|
|
206
|
+
body: Validator.EditEmailRequestSchema().required(),
|
|
207
|
+
}).required();
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
static deleteEmail() {
|
|
211
|
+
return Joi.object({
|
|
212
|
+
platform: Joi.string().allow(""),
|
|
213
|
+
active: Joi.boolean().required(),
|
|
214
|
+
primary: Joi.boolean().required(),
|
|
215
|
+
verified: Joi.boolean().required(),
|
|
216
|
+
email: Joi.string().allow("").required(),
|
|
217
|
+
}).required();
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
static setEmailAsPrimary() {
|
|
221
|
+
return Joi.object({
|
|
222
|
+
body: Validator.EditEmailRequestSchema().required(),
|
|
223
|
+
}).required();
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
static sendVerificationLinkToEmail() {
|
|
227
|
+
return Joi.object({
|
|
228
|
+
platform: Joi.string().allow(""),
|
|
229
|
+
body: Validator.EditEmailRequestSchema().required(),
|
|
230
|
+
}).required();
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
module.exports = UserValidator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const fdkAxios: any;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
const combineURLs = require("axios/lib/helpers/combineURLs");
|
|
2
|
+
const isAbsoluteURL = require("axios/lib/helpers/isAbsoluteURL");
|
|
3
|
+
const axios = require("axios");
|
|
4
|
+
const querystring = require("query-string");
|
|
5
|
+
const { sign } = require("./RequestSigner");
|
|
6
|
+
const { FDKServerResponseError } = require("./FDKError");
|
|
7
|
+
const { Logger } = require("./Logger");
|
|
8
|
+
axios.defaults.withCredentials = true;
|
|
9
|
+
|
|
10
|
+
function getTransformer(config) {
|
|
11
|
+
const { transformRequest } = config;
|
|
12
|
+
|
|
13
|
+
if (transformRequest) {
|
|
14
|
+
if (typeof transformRequest === "function") {
|
|
15
|
+
return transformRequest;
|
|
16
|
+
} else if (transformRequest.length) {
|
|
17
|
+
return transformRequest[0];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
throw new Error(
|
|
22
|
+
"Could not get default transformRequest function from Axios defaults"
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function requestInterceptorFn() {
|
|
27
|
+
return (config) => {
|
|
28
|
+
if (!config.url) {
|
|
29
|
+
throw new Error(
|
|
30
|
+
"No URL present in request config, unable to sign request"
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
let url = config.url;
|
|
35
|
+
if (config.baseURL && !isAbsoluteURL(config.url)) {
|
|
36
|
+
url = combineURLs(config.baseURL, config.url);
|
|
37
|
+
}
|
|
38
|
+
const { host, pathname, search } = new URL(url);
|
|
39
|
+
const { data, headers, method, params } = config;
|
|
40
|
+
headers["x-fp-sdk-version"] = "0.1.35";
|
|
41
|
+
let querySearchObj = querystring.parse(search);
|
|
42
|
+
querySearchObj = { ...querySearchObj, ...params };
|
|
43
|
+
let queryParam = "";
|
|
44
|
+
if (querySearchObj && Object.keys(querySearchObj).length) {
|
|
45
|
+
if (querystring.stringify(querySearchObj).trim() !== "") {
|
|
46
|
+
queryParam = `?${querystring.stringify(querySearchObj)}`;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
let transformedData;
|
|
50
|
+
if (method != "get") {
|
|
51
|
+
const transformRequest = getTransformer(config);
|
|
52
|
+
transformedData = transformRequest(data, headers);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Remove all the default Axios headers
|
|
56
|
+
const {
|
|
57
|
+
common,
|
|
58
|
+
delete: _delete, // 'delete' is a reserved word
|
|
59
|
+
get,
|
|
60
|
+
head,
|
|
61
|
+
post,
|
|
62
|
+
put,
|
|
63
|
+
patch,
|
|
64
|
+
...headersToSign
|
|
65
|
+
} = headers;
|
|
66
|
+
|
|
67
|
+
const signingOptions = {
|
|
68
|
+
method: method && method.toUpperCase(),
|
|
69
|
+
host: host,
|
|
70
|
+
path: pathname + search + queryParam,
|
|
71
|
+
body: transformedData,
|
|
72
|
+
headers: headersToSign,
|
|
73
|
+
};
|
|
74
|
+
sign(signingOptions);
|
|
75
|
+
|
|
76
|
+
config.headers["x-fp-date"] = signingOptions.headers["x-fp-date"];
|
|
77
|
+
config.headers["x-fp-signature"] = signingOptions.headers["x-fp-signature"];
|
|
78
|
+
// config.headers["fp-sdk-version"] = version;
|
|
79
|
+
Logger({
|
|
80
|
+
level: "DEBUG",
|
|
81
|
+
type: "REQUEST",
|
|
82
|
+
message: config,
|
|
83
|
+
url: config.url,
|
|
84
|
+
headers: config.headers,
|
|
85
|
+
body: signingOptions.body,
|
|
86
|
+
});
|
|
87
|
+
return config;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
const fdkAxios = axios.create({
|
|
91
|
+
paramsSerializer: (params) => {
|
|
92
|
+
return querystring.stringify(params);
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
fdkAxios.interceptors.request.use(requestInterceptorFn());
|
|
97
|
+
fdkAxios.interceptors.response.use(
|
|
98
|
+
function (response) {
|
|
99
|
+
if (response.config.method == "head") {
|
|
100
|
+
return response.headers;
|
|
101
|
+
}
|
|
102
|
+
Logger({
|
|
103
|
+
level: "DEBUG",
|
|
104
|
+
type: "RESPONSE",
|
|
105
|
+
message: response.config,
|
|
106
|
+
url: response.config.url,
|
|
107
|
+
response: response.data,
|
|
108
|
+
});
|
|
109
|
+
return response.data; // IF 2XX then return response.data only
|
|
110
|
+
},
|
|
111
|
+
function (error) {
|
|
112
|
+
if (error.response) {
|
|
113
|
+
// Request made and server responded
|
|
114
|
+
Logger({ level: "ERROR", message: error });
|
|
115
|
+
throw new FDKServerResponseError(
|
|
116
|
+
error.response.data.message || error.message,
|
|
117
|
+
error.response.data.stack || error.stack,
|
|
118
|
+
error.response.statusText,
|
|
119
|
+
error.response.status,
|
|
120
|
+
error.response.data
|
|
121
|
+
);
|
|
122
|
+
} else if (error.request) {
|
|
123
|
+
// The request was made but no error.response was received
|
|
124
|
+
Logger({ level: "ERROR", message: error });
|
|
125
|
+
throw new FDKServerResponseError(
|
|
126
|
+
error.message,
|
|
127
|
+
error.stack,
|
|
128
|
+
error.code,
|
|
129
|
+
error.code
|
|
130
|
+
);
|
|
131
|
+
} else {
|
|
132
|
+
// Something happened in setting up the request that triggered an Error
|
|
133
|
+
Logger({ level: "ERROR", message: error });
|
|
134
|
+
throw new FDKServerResponseError(error.message, error.stack);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
|
|
139
|
+
module.exports = {
|
|
140
|
+
fdkAxios,
|
|
141
|
+
};
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
export namespace AVAILABLE_PAGE_TYPE {
|
|
2
|
+
const ABOUT_US: string;
|
|
3
|
+
const ADDRESSES: string;
|
|
4
|
+
const BLOG: string;
|
|
5
|
+
const BRANDS: string;
|
|
6
|
+
const CARDS: string;
|
|
7
|
+
const CART: string;
|
|
8
|
+
const CATEGORIES: string;
|
|
9
|
+
const BRAND: string;
|
|
10
|
+
const CATEGORY: string;
|
|
11
|
+
const COLLECTION: string;
|
|
12
|
+
const COLLECTIONS: string;
|
|
13
|
+
const CONTACT_US: string;
|
|
14
|
+
const EXTERNAL: string;
|
|
15
|
+
const FAQ: string;
|
|
16
|
+
const FRESHCHAT: string;
|
|
17
|
+
const HOME: string;
|
|
18
|
+
const NOTIFICATION_SETTINGS: string;
|
|
19
|
+
const ORDERS: string;
|
|
20
|
+
const PAGE: string;
|
|
21
|
+
const POLICY: string;
|
|
22
|
+
const PRODUCT: string;
|
|
23
|
+
const PRODUCT_REVIEWS: string;
|
|
24
|
+
const ADD_PRODUCT_REVIEW: string;
|
|
25
|
+
const PRODUCT_REQUEST: string;
|
|
26
|
+
const PRODUCTS: string;
|
|
27
|
+
const PROFILE: string;
|
|
28
|
+
const PROFILE_BASIC: string;
|
|
29
|
+
const PROFILE_COMPANY: string;
|
|
30
|
+
const PROFILE_EMAILS: string;
|
|
31
|
+
const PROFILE_PHONES: string;
|
|
32
|
+
const RATE_US: string;
|
|
33
|
+
const REFER_EARN: string;
|
|
34
|
+
const SETTINGS: string;
|
|
35
|
+
const SHARED_CART: string;
|
|
36
|
+
const TNC: string;
|
|
37
|
+
const TRACK_ORDER: string;
|
|
38
|
+
const WISHLIST: string;
|
|
39
|
+
const SECTIONS: string;
|
|
40
|
+
const FORM: string;
|
|
41
|
+
const CART_DELIVERY: string;
|
|
42
|
+
const CART_PAYMENT: string;
|
|
43
|
+
const CART_REVIEW: string;
|
|
44
|
+
const LOGIN: string;
|
|
45
|
+
const REGISTER: string;
|
|
46
|
+
const SHIPPING_POLICY: string;
|
|
47
|
+
const RETURN_POLICY: string;
|
|
48
|
+
}
|
|
49
|
+
export const NAVIGATORS: {
|
|
50
|
+
"about-us": {
|
|
51
|
+
name: string;
|
|
52
|
+
link: string;
|
|
53
|
+
};
|
|
54
|
+
addresses: {
|
|
55
|
+
name: string;
|
|
56
|
+
link: string;
|
|
57
|
+
};
|
|
58
|
+
blog: {
|
|
59
|
+
name: string;
|
|
60
|
+
link: string;
|
|
61
|
+
params: {
|
|
62
|
+
key: string;
|
|
63
|
+
required: boolean;
|
|
64
|
+
}[];
|
|
65
|
+
};
|
|
66
|
+
brands: {
|
|
67
|
+
name: string;
|
|
68
|
+
link: string;
|
|
69
|
+
params: {
|
|
70
|
+
key: string;
|
|
71
|
+
required: boolean;
|
|
72
|
+
}[];
|
|
73
|
+
};
|
|
74
|
+
cards: {
|
|
75
|
+
name: string;
|
|
76
|
+
link: string;
|
|
77
|
+
};
|
|
78
|
+
cart: {
|
|
79
|
+
name: string;
|
|
80
|
+
link: string;
|
|
81
|
+
};
|
|
82
|
+
categories: {
|
|
83
|
+
name: string;
|
|
84
|
+
link: string;
|
|
85
|
+
params: {
|
|
86
|
+
key: string;
|
|
87
|
+
required: boolean;
|
|
88
|
+
}[];
|
|
89
|
+
};
|
|
90
|
+
brand: {
|
|
91
|
+
name: string;
|
|
92
|
+
link: string;
|
|
93
|
+
params: {
|
|
94
|
+
key: string;
|
|
95
|
+
required: boolean;
|
|
96
|
+
}[];
|
|
97
|
+
};
|
|
98
|
+
category: {
|
|
99
|
+
name: string;
|
|
100
|
+
link: string;
|
|
101
|
+
params: {
|
|
102
|
+
key: string;
|
|
103
|
+
required: boolean;
|
|
104
|
+
}[];
|
|
105
|
+
};
|
|
106
|
+
collection: {
|
|
107
|
+
name: string;
|
|
108
|
+
link: string;
|
|
109
|
+
params: {
|
|
110
|
+
key: string;
|
|
111
|
+
required: boolean;
|
|
112
|
+
}[];
|
|
113
|
+
};
|
|
114
|
+
collections: {
|
|
115
|
+
name: string;
|
|
116
|
+
link: string;
|
|
117
|
+
};
|
|
118
|
+
"contact-us": {
|
|
119
|
+
name: string;
|
|
120
|
+
link: string;
|
|
121
|
+
};
|
|
122
|
+
external: {
|
|
123
|
+
name: string;
|
|
124
|
+
link: string;
|
|
125
|
+
query: {
|
|
126
|
+
key: string;
|
|
127
|
+
required: boolean;
|
|
128
|
+
}[];
|
|
129
|
+
};
|
|
130
|
+
faq: {
|
|
131
|
+
name: string;
|
|
132
|
+
link: string;
|
|
133
|
+
};
|
|
134
|
+
freshchat: {
|
|
135
|
+
name: string;
|
|
136
|
+
link: string;
|
|
137
|
+
};
|
|
138
|
+
home: {
|
|
139
|
+
name: string;
|
|
140
|
+
link: string;
|
|
141
|
+
};
|
|
142
|
+
"notification-settings": {
|
|
143
|
+
name: string;
|
|
144
|
+
link: string;
|
|
145
|
+
};
|
|
146
|
+
orders: {
|
|
147
|
+
name: string;
|
|
148
|
+
link: string;
|
|
149
|
+
};
|
|
150
|
+
page: {
|
|
151
|
+
name: string;
|
|
152
|
+
link: string;
|
|
153
|
+
params: {
|
|
154
|
+
key: string;
|
|
155
|
+
required: boolean;
|
|
156
|
+
}[];
|
|
157
|
+
};
|
|
158
|
+
policy: {
|
|
159
|
+
name: string;
|
|
160
|
+
link: string;
|
|
161
|
+
};
|
|
162
|
+
product: {
|
|
163
|
+
name: string;
|
|
164
|
+
link: string;
|
|
165
|
+
params: {
|
|
166
|
+
key: string;
|
|
167
|
+
required: boolean;
|
|
168
|
+
}[];
|
|
169
|
+
};
|
|
170
|
+
"product-reviews": {
|
|
171
|
+
name: string;
|
|
172
|
+
link: string;
|
|
173
|
+
params: {
|
|
174
|
+
key: string;
|
|
175
|
+
required: boolean;
|
|
176
|
+
}[];
|
|
177
|
+
};
|
|
178
|
+
"add-product-review": {
|
|
179
|
+
name: string;
|
|
180
|
+
link: string;
|
|
181
|
+
params: {
|
|
182
|
+
key: string;
|
|
183
|
+
required: boolean;
|
|
184
|
+
}[];
|
|
185
|
+
};
|
|
186
|
+
"product-request": {
|
|
187
|
+
name: string;
|
|
188
|
+
link: string;
|
|
189
|
+
};
|
|
190
|
+
products: {
|
|
191
|
+
name: string;
|
|
192
|
+
link: string;
|
|
193
|
+
};
|
|
194
|
+
profile: {
|
|
195
|
+
name: string;
|
|
196
|
+
link: string;
|
|
197
|
+
};
|
|
198
|
+
"profile-basic": {
|
|
199
|
+
name: string;
|
|
200
|
+
link: string;
|
|
201
|
+
};
|
|
202
|
+
"profile-company": {
|
|
203
|
+
name: string;
|
|
204
|
+
link: string;
|
|
205
|
+
};
|
|
206
|
+
"profile-emails": {
|
|
207
|
+
name: string;
|
|
208
|
+
link: string;
|
|
209
|
+
};
|
|
210
|
+
"profile-phones": {
|
|
211
|
+
name: string;
|
|
212
|
+
link: string;
|
|
213
|
+
};
|
|
214
|
+
"rate-us": {
|
|
215
|
+
name: string;
|
|
216
|
+
link: string;
|
|
217
|
+
};
|
|
218
|
+
"refer-earn": {
|
|
219
|
+
name: string;
|
|
220
|
+
link: string;
|
|
221
|
+
};
|
|
222
|
+
settings: {
|
|
223
|
+
name: string;
|
|
224
|
+
link: string;
|
|
225
|
+
};
|
|
226
|
+
"shared-cart": {
|
|
227
|
+
name: string;
|
|
228
|
+
link: string;
|
|
229
|
+
params: {
|
|
230
|
+
key: string;
|
|
231
|
+
required: boolean;
|
|
232
|
+
}[];
|
|
233
|
+
};
|
|
234
|
+
tnc: {
|
|
235
|
+
name: string;
|
|
236
|
+
link: string;
|
|
237
|
+
};
|
|
238
|
+
"track-order": {
|
|
239
|
+
name: string;
|
|
240
|
+
link: string;
|
|
241
|
+
params: {
|
|
242
|
+
key: string;
|
|
243
|
+
required: boolean;
|
|
244
|
+
}[];
|
|
245
|
+
};
|
|
246
|
+
wishlist: {
|
|
247
|
+
name: string;
|
|
248
|
+
link: string;
|
|
249
|
+
};
|
|
250
|
+
sections: {
|
|
251
|
+
name: string;
|
|
252
|
+
link: string;
|
|
253
|
+
params: {
|
|
254
|
+
key: string;
|
|
255
|
+
required: boolean;
|
|
256
|
+
}[];
|
|
257
|
+
};
|
|
258
|
+
form: {
|
|
259
|
+
name: string;
|
|
260
|
+
link: string;
|
|
261
|
+
params: {
|
|
262
|
+
key: string;
|
|
263
|
+
required: boolean;
|
|
264
|
+
}[];
|
|
265
|
+
};
|
|
266
|
+
"cart-delivery": {
|
|
267
|
+
name: string;
|
|
268
|
+
link: string;
|
|
269
|
+
};
|
|
270
|
+
"cart-payment": {
|
|
271
|
+
name: string;
|
|
272
|
+
link: string;
|
|
273
|
+
};
|
|
274
|
+
"cart-review": {
|
|
275
|
+
name: string;
|
|
276
|
+
link: string;
|
|
277
|
+
};
|
|
278
|
+
login: {
|
|
279
|
+
name: string;
|
|
280
|
+
link: string;
|
|
281
|
+
};
|
|
282
|
+
register: {
|
|
283
|
+
name: string;
|
|
284
|
+
link: string;
|
|
285
|
+
};
|
|
286
|
+
"shipping-policy": {
|
|
287
|
+
name: string;
|
|
288
|
+
link: string;
|
|
289
|
+
};
|
|
290
|
+
"return-policy": {
|
|
291
|
+
name: string;
|
|
292
|
+
link: string;
|
|
293
|
+
};
|
|
294
|
+
};
|