@tap-payments/auth-jsconnect 2.0.34-test → 2.0.35-test

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.
@@ -44,7 +44,13 @@ export interface FeatureScreenStep {
44
44
  export declare enum SocialMediaTypes {
45
45
  WEB = "website",
46
46
  INSTAGRAM = "instagram",
47
- TWITTER = "twitter"
47
+ TWITTER = "twitter",
48
+ SOCIAL = "social",
49
+ PHYSICAL_STORE = "physical store",
50
+ CALL_CENTER = "call center",
51
+ APP = "app",
52
+ APPLE_STORE = "apple store",
53
+ PLAY_STORE = "play store"
48
54
  }
49
55
  export interface CustomerLocation {
50
56
  id: string;
@@ -3,6 +3,12 @@ export var SocialMediaTypes;
3
3
  SocialMediaTypes["WEB"] = "website";
4
4
  SocialMediaTypes["INSTAGRAM"] = "instagram";
5
5
  SocialMediaTypes["TWITTER"] = "twitter";
6
+ SocialMediaTypes["SOCIAL"] = "social";
7
+ SocialMediaTypes["PHYSICAL_STORE"] = "physical store";
8
+ SocialMediaTypes["CALL_CENTER"] = "call center";
9
+ SocialMediaTypes["APP"] = "app";
10
+ SocialMediaTypes["APPLE_STORE"] = "apple store";
11
+ SocialMediaTypes["PLAY_STORE"] = "play store";
6
12
  })(SocialMediaTypes || (SocialMediaTypes = {}));
7
13
  export var BusinessType;
8
14
  (function (BusinessType) {
@@ -24,6 +24,7 @@ export declare type IndividualFormValues = {
24
24
  };
25
25
  export declare type BrandFormValues = {
26
26
  brandName: string;
27
+ salesChannels: Array<SalesChannel>;
27
28
  links: {
28
29
  website: string;
29
30
  twitter: string;
@@ -141,7 +141,7 @@
141
141
  "signup_email_placeholder": "مثل g@example.com",
142
142
  "signup_enter_mobile": "رقم الجوال",
143
143
  "signup_generic_error": "حدث خطأ ما يرجى إعادة المحاولة لاحقاً",
144
- "signup_instagram_placeholder": "حساب انستجرام",
144
+ "signup_instagram_placeholder": "Enter your Instagram handle",
145
145
  "signup_invalid_iqama_id_format": "يجب أن تبدأ الإقامة بالرقم {{number}}",
146
146
  "signup_invalid_national_id": "الرجاء ادخال رقم هوية صحيح",
147
147
  "signup_invalid_national_id_format": "يجب أن تبدأ الهوية الوطنية بالرقم {{number}}",
@@ -149,9 +149,9 @@
149
149
  "signup_merchant_name_label": "الاسم بالكامل",
150
150
  "signup_merchant_name_placeholder": "الاسم بالكامل",
151
151
  "signup_select_country": "دولتك",
152
- "signup_twitter_placeholder": "حساب تويتر",
152
+ "signup_twitter_placeholder": "Enter your Twitter handle",
153
153
  "signup_user_not_exists_error": "المستخدم غير مسجل مع تاب",
154
- "signup_website_placeholder": "رابط الموقع",
154
+ "signup_website_placeholder": "Enter your website URL",
155
155
  "signup_welcoming": "مرحبا {{username}},",
156
156
  "signup_welcoming_hi": "مرحبا,",
157
157
  "start_with_number": "رقم الجوال يجب ان يبدا ب {{number}}",
@@ -244,5 +244,9 @@
244
244
  "reset_password_success_title": "لقد ارسلنا رسالة بريدية إليك",
245
245
  "reset_password_success_description": "تحقق من بريدك الإلكتروني لإعادة تعيين كلمة المرور الخاصة بك.",
246
246
  "license_name_label": "اسم الرخصة",
247
- "email_button_label": "تواصل مع البريد الإلكتروني"
247
+ "email_button_label": "تواصل مع البريد الإلكتروني",
248
+ "apple_store_placeholder": "Enter your app name (iOS)",
249
+ "play_store_placeholder": "Enter your app name (Google Play Store)",
250
+ "physical_store_placeholder": "Enter your store address or Google Map URL",
251
+ "call_center_placeholder": "Enter your Call Center number"
248
252
  }
@@ -150,7 +150,7 @@
150
150
  "signup_email_placeholder": "Your Email address",
151
151
  "signup_enter_mobile": "Your mobile number",
152
152
  "signup_generic_error": "Something went wrong! Please try again later.",
153
- "signup_instagram_placeholder": "mybusiness",
153
+ "signup_instagram_placeholder": "Enter your Instagram handle",
154
154
  "signup_invalid_iqama_id_format": "May you please verify the entered identification number. (Note - Saudi Iqama's start with {{number}})",
155
155
  "signup_invalid_national_id": "May you please verify the entered identification number",
156
156
  "signup_invalid_national_id_format": "May you please verify the entered identification number. (Note - Saudi national IDs start with {{number}})",
@@ -158,9 +158,9 @@
158
158
  "signup_merchant_name_label": "Full name",
159
159
  "signup_merchant_name_placeholder": "Full name",
160
160
  "signup_select_country": "Your country of business",
161
- "signup_twitter_placeholder": "mybusiness",
161
+ "signup_twitter_placeholder": "Enter your Twitter handle",
162
162
  "signup_user_not_exists_error": "May you please verify the entered user.",
163
- "signup_website_placeholder": "www.mybusiness.com",
163
+ "signup_website_placeholder": "Enter your website URL",
164
164
  "signup_welcoming": "Hello {{username}},",
165
165
  "signup_welcoming_hi": "Hello,",
166
166
  "start_with_number": "May you please verify the entered mobile. (Note - mobile numbers start with {{number}})",
@@ -264,5 +264,9 @@
264
264
  "reset_password_success_title": "We sent you an email",
265
265
  "reset_password_success_description": "Check your email to reset your password.",
266
266
  "license_name_label": "License Name",
267
- "email_button_label": "Continue with Email"
267
+ "email_button_label": "Continue with Email",
268
+ "apple_store_placeholder": "Enter your app name (iOS)",
269
+ "play_store_placeholder": "Enter your app name (Google Play Store)",
270
+ "physical_store_placeholder": "Enter your store address or Google Map URL",
271
+ "call_center_placeholder": "Enter your Call Center number"
268
272
  }
@@ -4,9 +4,10 @@ import { ToggleButtonGroupProps } from '../ToggleButtonGroup';
4
4
  import { ToggleButtonProps } from '../ToggleButton';
5
5
  export interface SocialMediaGroupProps extends ToggleButtonGroupProps {
6
6
  toggleButtonProps?: ToggleButtonProps;
7
+ showSocialMediaTypes?: Array<SocialMediaTypes>;
7
8
  }
8
9
  declare const _default: React.MemoExoticComponent<{
9
- ({ children, defaultValue, onChange, toggleButtonProps, ...rest }: SocialMediaGroupProps): JSX.Element;
10
+ ({ children, defaultValue, onChange, toggleButtonProps, showSocialMediaTypes, ...rest }: SocialMediaGroupProps): JSX.Element;
10
11
  defaultProps: {
11
12
  defaultValue: SocialMediaTypes;
12
13
  };
@@ -25,60 +25,53 @@ import * as React from 'react';
25
25
  import { styled } from '@mui/material/styles';
26
26
  import { ICONS_NAMES } from '../../constants';
27
27
  import { SocialMediaTypes } from '../../@types';
28
+ import Fade from '@mui/material/Fade';
28
29
  import ToggleButtonGroup from '../ToggleButtonGroup';
29
30
  import ToggleButton from '../ToggleButton';
30
31
  import Icon from '../Icon';
31
- var WebToggleButton = styled(ToggleButton, {
32
- shouldForwardProp: function (prop) { return prop !== 'isActive'; }
32
+ var SocialMediaButtonStyled = styled(ToggleButton, {
33
+ shouldForwardProp: function (prop) { return prop !== 'isActive' && prop !== 'isShow'; }
33
34
  })(function (_a) {
34
- var theme = _a.theme, isActive = _a.isActive;
35
+ var theme = _a.theme, isActive = _a.isActive, isShow = _a.isShow;
35
36
  return ({
36
- borderBottom: isActive ? "".concat(theme.spacing(0.25), " solid #3A4154") : 'none'
37
+ borderBottom: isActive ? "".concat(theme.spacing(0.1875), " solid #3478F6") : 'none',
38
+ display: isShow ? 'inherit' : 'none',
39
+ transition: 'display 0.3s'
37
40
  });
38
41
  });
39
- var TwitterToggleButton = styled(ToggleButton, {
40
- shouldForwardProp: function (prop) { return prop !== 'isActive'; }
41
- })(function (_a) {
42
- var theme = _a.theme, isActive = _a.isActive;
43
- return ({
44
- borderBottom: isActive ? "".concat(theme.spacing(0.25), " solid #1DA1F2") : 'none'
45
- });
46
- });
47
- var InstagramToggleButton = styled(ToggleButton, {
48
- shouldForwardProp: function (prop) { return prop !== 'isActive'; }
49
- })(function (_a) {
50
- var theme = _a.theme, isActive = _a.isActive;
51
- return ({
52
- borderBottom: isActive ? "".concat(theme.spacing(0.25), " solid #8A3AB9") : 'none'
53
- });
54
- });
55
- var WebTwitterIconStyled = styled(Icon)(function (_a) {
42
+ var ToggleIconStyled = styled(Icon)(function (_a) {
56
43
  var theme = _a.theme;
57
44
  return ({
58
- width: theme.spacing(5.5),
59
- height: theme.spacing(5.5)
60
- });
61
- });
62
- var InstagramIconStyled = styled(Icon, {
63
- shouldForwardProp: function (prop) { return prop !== 'isActive'; }
64
- })(function (_a) {
65
- var theme = _a.theme, isActive = _a.isActive;
66
- return ({
67
- width: isActive ? '100%' : theme.spacing(5.5),
68
- height: isActive ? '100%' : theme.spacing(5.5)
45
+ width: theme.spacing(2.5),
46
+ height: theme.spacing(2.5)
69
47
  });
70
48
  });
71
49
  var SocialMediaGroupComponent = function (_a) {
72
- var children = _a.children, defaultValue = _a.defaultValue, onChange = _a.onChange, toggleButtonProps = _a.toggleButtonProps, rest = __rest(_a, ["children", "defaultValue", "onChange", "toggleButtonProps"]);
50
+ var children = _a.children, defaultValue = _a.defaultValue, onChange = _a.onChange, toggleButtonProps = _a.toggleButtonProps, showSocialMediaTypes = _a.showSocialMediaTypes, rest = __rest(_a, ["children", "defaultValue", "onChange", "toggleButtonProps", "showSocialMediaTypes"]);
73
51
  var _b = React.useState(defaultValue), socialMediaType = _b[0], setSocialMediaType = _b[1];
74
52
  var isWebActive = socialMediaType === SocialMediaTypes.WEB;
75
53
  var isTwitterActive = socialMediaType === SocialMediaTypes.TWITTER;
76
54
  var isInstagramActive = socialMediaType === SocialMediaTypes.INSTAGRAM;
55
+ var isAppleStoreActive = socialMediaType === SocialMediaTypes.APPLE_STORE;
56
+ var isPlayStoreActive = socialMediaType === SocialMediaTypes.PLAY_STORE;
57
+ var isCallCenterActive = socialMediaType === SocialMediaTypes.CALL_CENTER;
58
+ var isPhysicalStoreActive = socialMediaType === SocialMediaTypes.PHYSICAL_STORE;
77
59
  var handleOnChange = function (event, value) {
78
60
  setSocialMediaType(value);
79
61
  onChange === null || onChange === void 0 ? void 0 : onChange(event, value);
80
62
  };
81
- return (_jsxs(ToggleButtonGroup, __assign({ value: socialMediaType, exclusive: true }, rest, { onChange: handleOnChange }, { children: [children, " ||", _jsx(WebToggleButton, __assign({ isActive: isWebActive }, toggleButtonProps, { value: SocialMediaTypes.WEB }, { children: _jsx(WebTwitterIconStyled, { src: isWebActive ? ICONS_NAMES.WEB_ACTIVE_ICON : ICONS_NAMES.WEB_ICON }) })), _jsx(TwitterToggleButton, __assign({ isActive: isTwitterActive }, toggleButtonProps, { value: SocialMediaTypes.TWITTER }, { children: _jsx(WebTwitterIconStyled, { src: isTwitterActive ? ICONS_NAMES.TWITTER_ACTIVE_ICON : ICONS_NAMES.TWITTER_ICON }) })), _jsx(InstagramToggleButton, __assign({ isActive: isInstagramActive }, toggleButtonProps, { value: SocialMediaTypes.INSTAGRAM }, { children: _jsx(InstagramIconStyled, { isActive: isInstagramActive, src: isInstagramActive ? ICONS_NAMES.INSTAGRAM_ACTIVE_ICON : ICONS_NAMES.INSTAGRAM_ICON }) }))] })));
63
+ React.useEffect(function () {
64
+ if (defaultValue !== socialMediaType)
65
+ setSocialMediaType(defaultValue);
66
+ }, [defaultValue]);
67
+ var isShowWeb = !!(showSocialMediaTypes === null || showSocialMediaTypes === void 0 ? void 0 : showSocialMediaTypes.find(function (icon) { return icon === SocialMediaTypes.WEB; }));
68
+ var isShowTwitter = !!(showSocialMediaTypes === null || showSocialMediaTypes === void 0 ? void 0 : showSocialMediaTypes.find(function (icon) { return icon === SocialMediaTypes.TWITTER || icon === SocialMediaTypes.SOCIAL; }));
69
+ var isShowInstagram = !!(showSocialMediaTypes === null || showSocialMediaTypes === void 0 ? void 0 : showSocialMediaTypes.find(function (icon) { return icon === SocialMediaTypes.INSTAGRAM || icon === SocialMediaTypes.SOCIAL; }));
70
+ var isShowAppleStore = !!(showSocialMediaTypes === null || showSocialMediaTypes === void 0 ? void 0 : showSocialMediaTypes.find(function (icon) { return icon === SocialMediaTypes.APPLE_STORE || icon === SocialMediaTypes.APP; }));
71
+ var isShowPlayStore = !!(showSocialMediaTypes === null || showSocialMediaTypes === void 0 ? void 0 : showSocialMediaTypes.find(function (icon) { return icon === SocialMediaTypes.PLAY_STORE || icon === SocialMediaTypes.APP; }));
72
+ var isShowCallCenter = !!(showSocialMediaTypes === null || showSocialMediaTypes === void 0 ? void 0 : showSocialMediaTypes.find(function (icon) { return icon === SocialMediaTypes.CALL_CENTER; }));
73
+ var isShowPhysicalStore = !!(showSocialMediaTypes === null || showSocialMediaTypes === void 0 ? void 0 : showSocialMediaTypes.find(function (icon) { return icon === SocialMediaTypes.PHYSICAL_STORE; }));
74
+ return (_jsxs(ToggleButtonGroup, __assign({ value: socialMediaType, exclusive: true }, rest, { onChange: handleOnChange }, { children: [children, " ||", _jsx(SocialMediaButtonStyled, __assign({ isShow: isShowWeb, isActive: isWebActive }, toggleButtonProps, { value: SocialMediaTypes.WEB }, { children: _jsx(Fade, __assign({ in: isShowWeb }, { children: _jsx(ToggleIconStyled, { src: isWebActive ? ICONS_NAMES.WEB_ACTIVE_ICON : ICONS_NAMES.WEB_ICON }) })) })), _jsx(SocialMediaButtonStyled, __assign({ isShow: isShowAppleStore, isActive: isAppleStoreActive }, toggleButtonProps, { value: SocialMediaTypes.APPLE_STORE }, { children: _jsx(Fade, __assign({ in: isShowAppleStore }, { children: _jsx(ToggleIconStyled, { src: isAppleStoreActive ? ICONS_NAMES.APP_APPLE_ACTIVE_ICON : ICONS_NAMES.APP_APPLE_ICON }) })) })), _jsx(SocialMediaButtonStyled, __assign({ isShow: isShowPlayStore, isActive: isPlayStoreActive }, toggleButtonProps, { value: SocialMediaTypes.PLAY_STORE }, { children: _jsx(Fade, __assign({ in: isShowPlayStore }, { children: _jsx(ToggleIconStyled, { src: isPlayStoreActive ? ICONS_NAMES.APP_ANDROID_ACTIVE_ICON : ICONS_NAMES.APP_ANDROID_ICON }) })) })), _jsx(SocialMediaButtonStyled, __assign({ isShow: isShowPhysicalStore, isActive: isPhysicalStoreActive }, toggleButtonProps, { value: SocialMediaTypes.PHYSICAL_STORE }, { children: _jsx(Fade, __assign({ in: isShowPhysicalStore }, { children: _jsx(ToggleIconStyled, { src: isPhysicalStoreActive ? ICONS_NAMES.PHYSICAL_STORE_ACTIVE_ICON : ICONS_NAMES.PHYSICAL_STORE_ICON }) })) })), _jsx(SocialMediaButtonStyled, __assign({ isShow: isShowTwitter, isActive: isTwitterActive }, toggleButtonProps, { value: SocialMediaTypes.TWITTER }, { children: _jsx(Fade, __assign({ in: isShowTwitter }, { children: _jsx(ToggleIconStyled, { src: isTwitterActive ? ICONS_NAMES.TWITTER_ACTIVE_ICON : ICONS_NAMES.TWITTER_ICON }) })) })), _jsx(SocialMediaButtonStyled, __assign({ isShow: isShowInstagram, isActive: isInstagramActive }, toggleButtonProps, { value: SocialMediaTypes.INSTAGRAM }, { children: _jsx(Fade, __assign({ in: isShowInstagram }, { children: _jsx(ToggleIconStyled, { src: isInstagramActive ? ICONS_NAMES.INSTAGRAM_ACTIVE_ICON : ICONS_NAMES.INSTAGRAM_ICON }) })) })), _jsx(SocialMediaButtonStyled, __assign({ isShow: isShowCallCenter, isActive: isCallCenterActive }, toggleButtonProps, { value: SocialMediaTypes.CALL_CENTER }, { children: _jsx(Fade, __assign({ in: isShowCallCenter }, { children: _jsx(ToggleIconStyled, { src: isCallCenterActive ? ICONS_NAMES.CALL_CENTER_ACTIVE_ICON : ICONS_NAMES.CALL_CENTER_ICON }) })) }))] })));
82
75
  };
83
76
  export default React.memo(SocialMediaGroupComponent);
84
77
  SocialMediaGroupComponent.defaultProps = {
@@ -20,11 +20,19 @@ export declare const ICONS_NAMES: {
20
20
  TWITTER_ICON: string;
21
21
  TWITTER_ACTIVE_ICON: string;
22
22
  INSTAGRAM_ICON: string;
23
+ INSTAGRAM_ACTIVE_ICON: string;
24
+ APP_APPLE_ICON: string;
25
+ APP_APPLE_ACTIVE_ICON: string;
26
+ APP_ANDROID_ICON: string;
27
+ APP_ANDROID_ACTIVE_ICON: string;
28
+ PHYSICAL_STORE_ICON: string;
29
+ PHYSICAL_STORE_ACTIVE_ICON: string;
30
+ CALL_CENTER_ICON: string;
31
+ CALL_CENTER_ACTIVE_ICON: string;
23
32
  FL_ICON: string;
24
33
  FL_ACTIVE_ICON: string;
25
34
  CR_ICON: string;
26
35
  CR_ACTIVE_ICON: string;
27
- INSTAGRAM_ACTIVE_ICON: string;
28
36
  TAP_LOGO_EN_ICON: string;
29
37
  TAP_LOGO_TEXT_AR: string;
30
38
  TAP_LOGO_TEXT_EN: string;
@@ -15,16 +15,24 @@ export var ICONS_NAMES = {
15
15
  DOWN_ARROW_ICON_DARK: ICONS_FULL_PATH + '/popup_arrow_dark' + ICONS_EXTENSION,
16
16
  CLEAR_ICON: ICONS_FULL_PATH + '/clear' + ICONS_EXTENSION,
17
17
  LOGO_ICON: ICONS_FULL_PATH + '/tap_logo_icon' + ICONS_EXTENSION,
18
- WEB_ICON: ICONS_FULL_PATH + '/web' + ICONS_EXTENSION,
19
- WEB_ACTIVE_ICON: ICONS_FULL_PATH + '/web-active' + ICONS_EXTENSION,
20
- TWITTER_ICON: ICONS_FULL_PATH + '/twitter' + ICONS_EXTENSION,
21
- TWITTER_ACTIVE_ICON: ICONS_FULL_PATH + '/twitter-active' + ICONS_EXTENSION,
22
- INSTAGRAM_ICON: ICONS_FULL_PATH + '/Insta' + ICONS_EXTENSION,
18
+ WEB_ICON: ICONS_FULL_PATH + '/website' + ICONS_EXTENSION,
19
+ WEB_ACTIVE_ICON: ICONS_FULL_PATH + '/website-active' + ICONS_EXTENSION,
20
+ TWITTER_ICON: ICONS_FULL_PATH + '/twitter-icon' + ICONS_EXTENSION,
21
+ TWITTER_ACTIVE_ICON: ICONS_FULL_PATH + '/twitter-active-icon' + ICONS_EXTENSION,
22
+ INSTAGRAM_ICON: ICONS_FULL_PATH + '/insta' + ICONS_EXTENSION,
23
+ INSTAGRAM_ACTIVE_ICON: ICONS_FULL_PATH + '/insta-active' + ICONS_EXTENSION,
24
+ APP_APPLE_ICON: ICONS_FULL_PATH + '/apple' + ICONS_EXTENSION,
25
+ APP_APPLE_ACTIVE_ICON: ICONS_FULL_PATH + '/apple-active' + ICONS_EXTENSION,
26
+ APP_ANDROID_ICON: ICONS_FULL_PATH + '/play-store' + ICONS_EXTENSION,
27
+ APP_ANDROID_ACTIVE_ICON: ICONS_FULL_PATH + '/play-store-active' + ICONS_EXTENSION,
28
+ PHYSICAL_STORE_ICON: ICONS_FULL_PATH + '/physical-store' + ICONS_EXTENSION,
29
+ PHYSICAL_STORE_ACTIVE_ICON: ICONS_FULL_PATH + '/physical-store-active' + ICONS_EXTENSION,
30
+ CALL_CENTER_ICON: ICONS_FULL_PATH + '/call-center' + ICONS_EXTENSION,
31
+ CALL_CENTER_ACTIVE_ICON: ICONS_FULL_PATH + '/call-center-active' + ICONS_EXTENSION,
23
32
  FL_ICON: ICONS_FULL_PATH + '/fl' + ICONS_EXTENSION,
24
33
  FL_ACTIVE_ICON: ICONS_FULL_PATH + '/fl_active' + ICONS_EXTENSION,
25
34
  CR_ICON: ICONS_FULL_PATH + '/cr' + ICONS_EXTENSION,
26
35
  CR_ACTIVE_ICON: ICONS_FULL_PATH + '/cr_active' + ICONS_EXTENSION,
27
- INSTAGRAM_ACTIVE_ICON: ICONS_FULL_PATH + '/Insta-active' + ICONS_EXTENSION,
28
36
  TAP_LOGO_EN_ICON: ICONS_FULL_PATH + '/tap-white-logo' + ICONS_EXTENSION,
29
37
  TAP_LOGO_TEXT_AR: ICONS_FULL_PATH + '/tap-white-text-ar' + ICONS_EXTENSION,
30
38
  TAP_LOGO_TEXT_EN: ICONS_FULL_PATH + '/tap-white-text-en' + ICONS_EXTENSION,
@@ -40,6 +40,7 @@ export declare const createLead: import("@reduxjs/toolkit").AsyncThunk<{
40
40
  stepName: string;
41
41
  }, {}>;
42
42
  export declare const retrieveBrandList: import("@reduxjs/toolkit").AsyncThunk<any, string, {}>;
43
+ export declare const retrieveChannels: import("@reduxjs/toolkit").AsyncThunk<any, void, {}>;
43
44
  export declare const updateLeadIndividual: import("@reduxjs/toolkit").AsyncThunk<{
44
45
  response: any;
45
46
  formData: IndividualFormValues;
@@ -207,7 +207,7 @@ export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkAp
207
207
  return [4, API.authService.verifyAuth(payload)];
208
208
  case 1:
209
209
  data = (_e.sent()).data;
210
- if (!!data.errors) return [3, 4];
210
+ if (!!data.errors) return [3, 5];
211
211
  (_d = (_c = settings.data.appConfig).onStepCompleted) === null || _d === void 0 ? void 0 : _d.call(_c, settings.data.activeScreen.name, { otp: params.otp });
212
212
  if (!(responseBody === null || responseBody === void 0 ? void 0 : responseBody.new_user)) return [3, 2];
213
213
  params_1 = {
@@ -215,9 +215,12 @@ export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkAp
215
215
  stepName: 'CONNECT_INDIVIDUAL_STEP'
216
216
  };
217
217
  thunkApi.dispatch(retrieveLead(params_1));
218
- return [3, 4];
218
+ return [3, 5];
219
219
  case 2: return [4, thunkApi.dispatch(retrieveBrandList(data === null || data === void 0 ? void 0 : data.individual_id))];
220
220
  case 3:
221
+ _e.sent();
222
+ return [4, thunkApi.dispatch(retrieveChannels())];
223
+ case 4:
221
224
  _e.sent();
222
225
  if (!(data === null || data === void 0 ? void 0 : data.lead_id)) {
223
226
  params_2 = {
@@ -229,8 +232,8 @@ export var verifyAuth = createAsyncThunk('verifyAuth', function (params, thunkAp
229
232
  else {
230
233
  thunkApi.dispatch(handleNextScreenStep('CONNECT_MERCHANT_INFO_STEP'));
231
234
  }
232
- _e.label = 4;
233
- case 4: return [2, { response: data, formData: params }];
235
+ _e.label = 5;
236
+ case 5: return [2, { response: data, formData: params }];
234
237
  }
235
238
  });
236
239
  }); });
@@ -282,6 +285,17 @@ export var retrieveBrandList = createAsyncThunk('retrieveBrandList', function (i
282
285
  }
283
286
  });
284
287
  }); });
288
+ export var retrieveChannels = createAsyncThunk('retrieveChannels', function () { return __awaiter(void 0, void 0, void 0, function () {
289
+ var data;
290
+ return __generator(this, function (_a) {
291
+ switch (_a.label) {
292
+ case 0: return [4, API.dataService.getChannelsOfServices()];
293
+ case 1:
294
+ data = (_a.sent()).data;
295
+ return [2, data];
296
+ }
297
+ });
298
+ }); });
285
299
  export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', function (params, thunkApi) { return __awaiter(void 0, void 0, void 0, function () {
286
300
  var _a, settings, connect, isAbsher, payload, data;
287
301
  var _b, _c, _d, _e, _f, _g;
@@ -316,6 +330,9 @@ export var updateLeadIndividual = createAsyncThunk('updateLeadIndividual', funct
316
330
  return [4, API.leadService.updateLead(payload)];
317
331
  case 1:
318
332
  data = _h.sent();
333
+ return [4, thunkApi.dispatch(retrieveChannels())];
334
+ case 2:
335
+ _h.sent();
319
336
  thunkApi.dispatch(handleNextScreenStep());
320
337
  (_g = (_f = settings.data.appConfig).onStepCompleted) === null || _g === void 0 ? void 0 : _g.call(_f, settings.data.activeScreen.name, params);
321
338
  return [2, { response: data, formData: params }];
@@ -470,6 +487,7 @@ var initialState = {
470
487
  },
471
488
  brandData: {
472
489
  brandName: '',
490
+ salesChannels: [],
473
491
  termAndConditionChecked: false,
474
492
  links: {
475
493
  website: '',
@@ -768,6 +786,42 @@ export var connectSlice = createSlice({
768
786
  .addCase(updateLeadSuccess.rejected, function (state, action) {
769
787
  state.loading = false;
770
788
  state.error = action.error.message;
789
+ })
790
+ .addCase(retrieveChannels.pending, function (state) {
791
+ state.error = null;
792
+ state.loading = true;
793
+ })
794
+ .addCase(retrieveChannels.fulfilled, function (state, action) {
795
+ var _a;
796
+ state.error = null;
797
+ state.loading = false;
798
+ var data = action.payload || {};
799
+ var description = (((_a = data === null || data === void 0 ? void 0 : data.errors) === null || _a === void 0 ? void 0 : _a[0]) || {}).description;
800
+ if (description) {
801
+ state.error = description;
802
+ return;
803
+ }
804
+ var channels = data || [];
805
+ state.data.brandData.responseBody = __assign(__assign({}, state.data.brandData.responseBody), { channelList: channels });
806
+ var selectedChannels = [];
807
+ var selectedBrandItem = (state.data.brandData || {}).selectedBrandItem;
808
+ var _b = selectedBrandItem || {}, website = _b.website, social = _b.social;
809
+ var isHasWebsite = (website === null || website === void 0 ? void 0 : website.length) > 0;
810
+ var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
811
+ var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
812
+ var websiteData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'website'; });
813
+ var socialData = channels === null || channels === void 0 ? void 0 : channels.find(function (c) { return c.name_en.toLocaleLowerCase() === 'social'; });
814
+ if (isHasWebsite && (isHasTwitter || isHasInstagram))
815
+ selectedChannels = [websiteData, socialData];
816
+ else if (isHasTwitter || isHasInstagram)
817
+ selectedChannels = [socialData];
818
+ else if (isHasWebsite)
819
+ selectedChannels = [websiteData];
820
+ state.data.brandData.salesChannels = selectedChannels;
821
+ })
822
+ .addCase(retrieveChannels.rejected, function (state, action) {
823
+ state.error = action.error.message;
824
+ state.loading = false;
771
825
  });
772
826
  }
773
827
  });
@@ -28,16 +28,18 @@ import BrandName from './BrandName';
28
28
  import SocialMedia from './SocialMedia';
29
29
  import TAC from './TAC';
30
30
  import BrandList from './BrandList';
31
+ import SalesChannels from './SalesChannels';
31
32
  var Merchant = function (_a) {
32
- var _b, _c, _d;
33
- var _e = React.useState(false), brandNameChecking = _e[0], setBrandNameChecking = _e[1];
34
- var _f = React.useState(ValidationOptions.NEW_USER), userType = _f[0], setUserType = _f[1];
35
- var _g = React.useState(false), listActive = _g[0], setListActive = _g[1];
36
- var _h = useAppSelector(connectSelector), data = _h.data, loading = _h.loading, error = _h.error;
33
+ var _b, _c;
34
+ var _d = React.useState(false), brandNameChecking = _d[0], setBrandNameChecking = _d[1];
35
+ var _e = React.useState(ValidationOptions.NEW_USER), userType = _e[0], setUserType = _e[1];
36
+ var _f = React.useState(false), listActive = _f[0], setListActive = _f[1];
37
+ var _g = useAppSelector(connectSelector), data = _g.data, loading = _g.loading, error = _g.error;
37
38
  var isNewUser = (_b = data.otpData.responseBody) === null || _b === void 0 ? void 0 : _b.new_user;
38
39
  var isAbsher = data.otpData.isAbsher;
39
- var brandList = ((_c = data.brandData.responseBody) === null || _c === void 0 ? void 0 : _c.brands) || [];
40
- var _j = data.brandData, brandName = _j.brandName, links = _j.links, selectedBrandItem = _j.selectedBrandItem, termAndConditionChecked = _j.termAndConditionChecked, responseBody = _j.responseBody;
40
+ var _h = data.brandData.responseBody || {}, brands = _h.brands, channelList = _h.channelList;
41
+ var brandList = brands || [];
42
+ var _j = data.brandData, brandName = _j.brandName, links = _j.links, selectedBrandItem = _j.selectedBrandItem, termAndConditionChecked = _j.termAndConditionChecked, responseBody = _j.responseBody, salesChannels = _j.salesChannels;
41
43
  var methods = useForm({
42
44
  resolver: yupResolver(MerchantValidationSchema(userType)),
43
45
  defaultValues: {
@@ -82,6 +84,7 @@ var Merchant = function (_a) {
82
84
  var sites = { website: '', twitter: '', instagram: '' };
83
85
  methods.setValue('brandName', '', { shouldValidate: true });
84
86
  methods.setValue('links', sites);
87
+ methods.setValue('salesChannels', []);
85
88
  }, 100);
86
89
  }
87
90
  if (isNewUser === false && (brandList === null || brandList === void 0 ? void 0 : brandList.length) > 0 && (formDataSelectedBrand === null || formDataSelectedBrand === void 0 ? void 0 : formDataSelectedBrand.id) !== 'other') {
@@ -92,18 +95,35 @@ var Merchant = function (_a) {
92
95
  var website = (_e = formDataSelectedBrand === null || formDataSelectedBrand === void 0 ? void 0 : formDataSelectedBrand.website) === null || _e === void 0 ? void 0 : _e.replaceAll(/(https|http):\/\//g, '');
93
96
  var sites_1 = __assign(__assign({}, links), { website: website, twitter: twitter, instagram: instagram });
94
97
  setTimeout(function () { return methods.setValue('links', sites_1, { shouldValidate: true }); }, 100);
98
+ var selectedChannels = (!!(channelList === null || channelList === void 0 ? void 0 : channelList[0]) && [channelList === null || channelList === void 0 ? void 0 : channelList[0]]) || [];
99
+ var _f = formDataSelectedBrand || {}, websiteUrl = _f.website, social = _f.social;
100
+ var isHasWebsite = (websiteUrl === null || websiteUrl === void 0 ? void 0 : websiteUrl.length) > 0;
101
+ var isHasTwitter = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('twitter.com'); });
102
+ var isHasInstagram = social === null || social === void 0 ? void 0 : social.find(function (s) { return s.includes('instagram.com'); });
103
+ var websiteData = channelList === null || channelList === void 0 ? void 0 : channelList.find(function (c) { return c.name_en.toLocaleLowerCase() === 'website'; });
104
+ var socialData = channelList === null || channelList === void 0 ? void 0 : channelList.find(function (c) { return c.name_en.toLocaleLowerCase() === 'social'; });
105
+ if (isHasWebsite && (isHasTwitter || isHasInstagram))
106
+ selectedChannels = [websiteData, socialData];
107
+ else if (isHasTwitter || isHasInstagram)
108
+ selectedChannels = [socialData];
109
+ else if (isHasWebsite)
110
+ selectedChannels = [websiteData];
111
+ methods.setValue('salesChannels', selectedChannels);
95
112
  }
96
113
  }, [formDataSelectedBrand, isNewUser]);
97
114
  React.useEffect(function () {
98
115
  if (!(formDataSelectedBrand === null || formDataSelectedBrand === void 0 ? void 0 : formDataSelectedBrand.id) && (selectedBrandItem === null || selectedBrandItem === void 0 ? void 0 : selectedBrandItem.id))
99
116
  methods.setValue('selectedBrandItem', selectedBrandItem, { shouldValidate: true });
100
117
  }, [selectedBrandItem]);
118
+ React.useEffect(function () {
119
+ methods.setValue('salesChannels', salesChannels);
120
+ }, [salesChannels]);
101
121
  var brandErrChecks = !methods.formState.isValid || !!methods.formState.errors.brandName || !!error;
102
- var disabled = brandErrChecks || brandNameChecking || ((_d = data.brandData.responseBody) === null || _d === void 0 ? void 0 : _d.response_code) === '5';
122
+ var disabled = brandErrChecks || brandNameChecking || ((_c = data.brandData.responseBody) === null || _c === void 0 ? void 0 : _c.response_code) === '5';
103
123
  var isBrandListAvailable = userType !== ValidationOptions.NEW_USER && brandList.length > 0;
104
124
  var askingForBrandInfo = userType === ValidationOptions.NEW_USER ||
105
125
  brandList.length === 0 ||
106
126
  userType === ValidationOptions.EXISTING_USER_WITH_OTHER_BRAND;
107
- return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { show: isBrandListAvailable, list: brandList, onListOpen: function () { return setListActive(true); }, onListClose: function () { return setListActive(false); } }), _jsx(BrandName, { show: !listActive && askingForBrandInfo, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(SocialMedia, { show: !listActive, isNewUser: isNewUser }), _jsx(TAC, { show: !listActive && askingForBrandInfo }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') })) }))] })) })) }));
127
+ return (_jsx(ScreenContainer, { children: _jsx(FormProvider, __assign({}, methods, { children: _jsxs(Form, __assign({ onSubmit: methods.handleSubmit(onSubmit) }, { children: [_jsx(BrandList, { show: isBrandListAvailable, list: brandList, onListOpen: function () { return setListActive(true); }, onListClose: function () { return setListActive(false); } }), _jsx(BrandName, { show: !listActive && askingForBrandInfo, brandNameChecking: brandNameChecking, fetchingBrandName: setBrandNameChecking }), _jsx(Collapse, __assign({ in: !listActive }, { children: _jsx(SalesChannels, {}) })), _jsx(SocialMedia, { show: !listActive, isNewUser: isNewUser }), _jsx(TAC, { show: !listActive && askingForBrandInfo }), _jsx(Collapse, __assign({ in: !listActive, timeout: 500 }, { children: _jsx(Button, __assign({ onBackClicked: function () { return onBack(); }, disabled: disabled, isAr: isAr, error: t(error || ''), loading: loading }, { children: t('next') })) }))] })) })) }));
108
128
  };
109
129
  export default React.memo(Merchant);
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export declare const MandatoryStyled: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
3
+ export declare const CollapseStyled: import("@emotion/styled").StyledComponent<import("../../../../components/Collapse").CollapseProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
4
+ declare const SalesChannels: () => JSX.Element;
5
+ export default SalesChannels;
@@ -0,0 +1,114 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
+ if (ar || !(i in from)) {
15
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
+ ar[i] = from[i];
17
+ }
18
+ }
19
+ return to.concat(ar || Array.prototype.slice.call(from));
20
+ };
21
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
22
+ import * as React from 'react';
23
+ import Box from '@mui/material/Box';
24
+ import { alpha, styled } from '@mui/material/styles';
25
+ import { useTranslation } from 'react-i18next';
26
+ import { useController, useFormContext } from 'react-hook-form';
27
+ import { useLanguage, useAppSelector, useAppDispatch } from '../../../../hooks';
28
+ import Text from '../../../../components/Text';
29
+ import { connectSelector, clearError } from '../../../app/connect/connectStore';
30
+ import CheckBox from '../../../../components/CheckBox';
31
+ import Warning from '../../../../components/Warning';
32
+ import Collapse from '../../../../components/Collapse';
33
+ import { ScreenContainer } from '../../../shared/Containers';
34
+ var InputLabelStyled = styled(Text)(function (_a) {
35
+ var theme = _a.theme;
36
+ return (__assign({ margin: theme.spacing(2.5, 2.5, 0.5, 2.5), color: alpha(theme.palette.text.primary, 0.4) }, theme.typography.caption));
37
+ });
38
+ var ContainerStyled = styled(Box)(function (_a) {
39
+ var theme = _a.theme;
40
+ return ({
41
+ display: 'flex',
42
+ flexDirection: 'row',
43
+ alignItems: 'center',
44
+ padding: theme.spacing(0, 0.5, 0, 0.5),
45
+ height: theme.spacing(3.625),
46
+ marginBlockEnd: theme.spacing(0.2)
47
+ });
48
+ });
49
+ var TextStyled = styled(Text)(function (_a) {
50
+ var theme = _a.theme;
51
+ return (__assign(__assign({ color: alpha(theme.palette.text.primary, 0.4), fontWeight: theme.typography.fontWeightLight, whiteSpace: 'pre' }, theme.typography.body2), { marginBlockStart: theme.spacing(1.75) }));
52
+ });
53
+ var CheckBoxStyled = styled(CheckBox)(function (_a) {
54
+ var theme = _a.theme;
55
+ return ({
56
+ marginInlineEnd: theme.spacing(-1),
57
+ '& .MuiSvgIcon-root': {
58
+ fontSize: 30
59
+ },
60
+ '&.Mui-checked': {
61
+ color: theme.palette.text.primary,
62
+ borderRadius: theme.spacing(2.5)
63
+ }
64
+ });
65
+ });
66
+ export var MandatoryStyled = styled('span')(function (_a) {
67
+ var theme = _a.theme;
68
+ return (__assign(__assign({ color: alpha(theme.palette.error.light, 0.4) }, theme.typography.h6), { fontWeight: theme.typography.fontWeightLight, verticalAlign: 'sub' }));
69
+ });
70
+ export var CollapseStyled = styled(Collapse)(function (_a) {
71
+ var theme = _a.theme;
72
+ return ({
73
+ marginBlockStart: theme.spacing(2)
74
+ });
75
+ });
76
+ var SalesChannels = function () {
77
+ var _a;
78
+ var _b = React.useState([]), channelsMenuList = _b[0], setChannelsMenuList = _b[1];
79
+ var t = useTranslation().t;
80
+ var isAr = useLanguage().isAr;
81
+ var _c = useFormContext(), control = _c.control, getValues = _c.getValues;
82
+ var dispatch = useAppDispatch();
83
+ var channelsControl = useController({ name: 'salesChannels', control: control });
84
+ var channelsChecked = channelsControl.field.value;
85
+ var warningMessage = (_a = channelsControl.fieldState.error) === null || _a === void 0 ? void 0 : _a.message;
86
+ var _d = useAppSelector(connectSelector), data = _d.data, error = _d.error;
87
+ var channelList = (data.brandData.responseBody || {}).channelList;
88
+ var salesChannels = (data.brandData || {}).salesChannels;
89
+ var formDataSelectedBrand = getValues('selectedBrandItem');
90
+ React.useEffect(function () {
91
+ if ((channelList === null || channelList === void 0 ? void 0 : channelList.length) > 0) {
92
+ setChannelsMenuList(channelList);
93
+ }
94
+ }, [channelList]);
95
+ var handleSalesChannelChange = function (event) {
96
+ var selected = channelsMenuList.find(function (channel) { return channel.id === event.target.id; });
97
+ var isExists = channelsChecked === null || channelsChecked === void 0 ? void 0 : channelsChecked.find(function (channel) { return channel.id === (selected === null || selected === void 0 ? void 0 : selected.id); });
98
+ if (isExists) {
99
+ var updatedIdList = channelsChecked === null || channelsChecked === void 0 ? void 0 : channelsChecked.filter(function (channel) { return channel.id !== (selected === null || selected === void 0 ? void 0 : selected.id); });
100
+ channelsControl.field.onChange(updatedIdList);
101
+ return;
102
+ }
103
+ channelsControl.field.onChange(__spreadArray(__spreadArray([], channelsChecked, true), [selected], false));
104
+ if (error)
105
+ dispatch(clearError());
106
+ };
107
+ var getSelectedChannelsFlag = function (item) {
108
+ if (channelsChecked)
109
+ return !!(channelsChecked === null || channelsChecked === void 0 ? void 0 : channelsChecked.find(function (channel) { return channel.id === (item === null || item === void 0 ? void 0 : item.id); }));
110
+ };
111
+ var selectedBrandIsOther = (formDataSelectedBrand === null || formDataSelectedBrand === void 0 ? void 0 : formDataSelectedBrand.id) === 'other';
112
+ return (_jsxs(ScreenContainer, { children: [_jsxs(InputLabelStyled, { children: [t('channel_of_service'), " ", _jsx(MandatoryStyled, { children: "*" })] }), (channelsMenuList || []).map(function (channel) { return (_jsxs(ContainerStyled, { children: [_jsx(CheckBoxStyled, { id: channel.id, disableRipple: true, disableFocusRipple: true, focusRipple: false, disabled: !selectedBrandIsOther && (salesChannels === null || salesChannels === void 0 ? void 0 : salesChannels.find(function (c) { return c.id === (channel === null || channel === void 0 ? void 0 : channel.id); })) ? true : false, checked: getSelectedChannelsFlag(channel), onChange: handleSalesChannelChange }), _jsxs(TextStyled, { children: [isAr ? channel.name_ar : channel.name_en, " "] })] }, channel.id)); }), _jsx(CollapseStyled, __assign({ in: !!warningMessage }, { children: _jsx(Warning, __assign({ warningType: 'alert' }, { children: t(warningMessage) })) }))] }));
113
+ };
114
+ export default SalesChannels;
@@ -9,7 +9,7 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
12
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import * as React from 'react';
14
14
  import { useTranslation } from 'react-i18next';
15
15
  import { useController, useFormContext } from 'react-hook-form';
@@ -37,8 +37,7 @@ var InputStyled = styled(Input)(function (_a) {
37
37
  padding: theme.spacing(0, 2, 0, 0),
38
38
  paddingInlineEnd: theme.spacing(2),
39
39
  input: {
40
- paddingInlineStart: theme.spacing(0),
41
- textTransform: 'lowercase'
40
+ paddingInlineStart: theme.spacing(0)
42
41
  }
43
42
  });
44
43
  });
@@ -58,23 +57,26 @@ var ClearIconStyled = styled(ClearIcon)(function (_a) {
58
57
  });
59
58
  });
60
59
  var SocialMedia = function (_a) {
61
- var _b, _c, _d, _e;
60
+ var _b, _c, _d, _e, _f, _g, _h, _j;
62
61
  var show = _a.show, sx = _a.sx, isNewUser = _a.isNewUser;
63
- var _f = React.useState(SocialMediaTypes.WEB), socialMediaType = _f[0], setSocialMediaType = _f[1];
62
+ var _k = React.useState(SocialMediaTypes.WEB), socialMediaType = _k[0], setSocialMediaType = _k[1];
63
+ var _l = React.useState([SocialMediaTypes.WEB]), selectedSocialMediaTypes = _l[0], setSelectedSocialMediaTypes = _l[1];
64
64
  var t = useTranslation().t;
65
- var _g = useFormContext(), control = _g.control, setValue = _g.setValue, watch = _g.watch;
65
+ var _m = useFormContext(), control = _m.control, setValue = _m.setValue, watch = _m.watch;
66
66
  var linksControl = useController({ control: control, name: 'links' });
67
67
  var links = linksControl.field.value;
68
68
  var brandName = watch('brandName');
69
+ var selectedChannels = watch('salesChannels');
69
70
  var data = useAppSelector(connectSelector).data;
70
71
  var brandList = ((_b = data.brandData.responseBody) === null || _b === void 0 ? void 0 : _b.brands) || [];
71
72
  var handleChange = function (_a) {
72
73
  var _b;
73
74
  var target = _a.target;
74
- linksControl.field.onChange(__assign(__assign({}, links), (_b = {}, _b[socialMediaType] = target.value, _b)));
75
+ linksControl.field.onChange(__assign(__assign({}, links), (_b = {}, _b[socialMediaType.replace(' ', '_')] = target.value, _b)));
75
76
  };
76
- var handleClear = function () {
77
+ var handleClear = function (e) {
77
78
  var _a;
79
+ e.stopPropagation();
78
80
  linksControl.field.onChange(__assign(__assign({}, links), (_a = {}, _a[socialMediaType] = '', _a)));
79
81
  };
80
82
  var handleBlueWebsite = function () {
@@ -103,15 +105,58 @@ var SocialMedia = function (_a) {
103
105
  setValue('links', __assign(__assign({}, links), { website: website }));
104
106
  }
105
107
  }, [brandName]);
108
+ React.useEffect(function () {
109
+ var _a, _b;
110
+ if ((selectedChannels === null || selectedChannels === void 0 ? void 0 : selectedChannels.length) > 0) {
111
+ setSelectedSocialMediaTypes(selectedChannels === null || selectedChannels === void 0 ? void 0 : selectedChannels.map(function (_a) {
112
+ var name_en = _a.name_en;
113
+ return name_en.toLocaleLowerCase();
114
+ }));
115
+ var hasSelectedMediaTypeAvailable = !!(selectedChannels === null || selectedChannels === void 0 ? void 0 : selectedChannels.find(function (_a) {
116
+ var name_en = _a.name_en;
117
+ if (socialMediaType === SocialMediaTypes.TWITTER || socialMediaType === SocialMediaTypes.INSTAGRAM)
118
+ return name_en.toLocaleLowerCase() === SocialMediaTypes.SOCIAL;
119
+ if (socialMediaType === SocialMediaTypes.APPLE_STORE || socialMediaType === SocialMediaTypes.PLAY_STORE)
120
+ return name_en.toLocaleLowerCase() === SocialMediaTypes.APP;
121
+ return name_en.toLocaleLowerCase() === socialMediaType;
122
+ }));
123
+ if (!hasSelectedMediaTypeAvailable) {
124
+ var type = (_b = (_a = selectedChannels === null || selectedChannels === void 0 ? void 0 : selectedChannels[0]) === null || _a === void 0 ? void 0 : _a.name_en) === null || _b === void 0 ? void 0 : _b.toLocaleLowerCase();
125
+ if (type === SocialMediaTypes.SOCIAL)
126
+ setSocialMediaType(SocialMediaTypes.TWITTER);
127
+ else if (type === SocialMediaTypes.APP)
128
+ setSocialMediaType(SocialMediaTypes.APPLE_STORE);
129
+ else
130
+ setSocialMediaType(type);
131
+ }
132
+ }
133
+ }, [selectedChannels]);
106
134
  var websiteValue = links.website || '';
107
135
  var twitterValue = links.twitter || '';
108
136
  var instagramValue = links.instagram || '';
137
+ var appleStoreValue = links.apple_store || '';
138
+ var playStoreValue = links.play_store || '';
139
+ var callCenterValue = links.call_center || '';
140
+ var physicalStoreValue = links.physical_store || '';
109
141
  var errors = linksControl.fieldState.error;
110
142
  var websiteError = (_c = errors === null || errors === void 0 ? void 0 : errors.website) === null || _c === void 0 ? void 0 : _c.message;
111
143
  var twitterError = (_d = errors === null || errors === void 0 ? void 0 : errors.twitter) === null || _d === void 0 ? void 0 : _d.message;
112
144
  var instagramError = (_e = errors === null || errors === void 0 ? void 0 : errors.instagram) === null || _e === void 0 ? void 0 : _e.message;
113
- return (_jsx(Collapse, __assign({ in: show }, { children: _jsxs(ScreenContainer, __assign({ sx: __assign({ mt: 3, mb: 3, direction: 'ltr' }, sx) }, { children: [_jsx(SocialMediaGroupStyled, { defaultValue: socialMediaType, exclusive: true, onChange: function (e, value) {
114
- setSocialMediaType(value);
115
- } }), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.WEB, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: websiteValue, onBlur: function () { return handleBlueWebsite(); }, startAdornment: _jsx(TextStyled, { children: "https://" }), placeholder: t('signup_website_placeholder'), warningType: 'alert', warningMessage: websiteError && t(websiteError), endAdornment: !websiteError && websiteValue ? _jsx(CheckIcon, {}) : websiteValue && _jsx(ClearIconStyled, { onClick: handleClear }) }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.TWITTER, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: twitterValue, startAdornment: _jsx(TextStyled, { children: "@" }), placeholder: t('signup_twitter_placeholder'), warningType: 'alert', warningMessage: twitterError && t(twitterError), endAdornment: !twitterError && twitterValue ? _jsx(CheckIcon, {}) : twitterValue && _jsx(ClearIconStyled, { onClick: handleClear }) }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.INSTAGRAM, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: instagramValue, startAdornment: _jsx(TextStyled, { children: "@" }), placeholder: t('signup_instagram_placeholder'), warningType: 'alert', warningMessage: instagramError && t(instagramError), endAdornment: !instagramError && instagramValue ? (_jsx(CheckIcon, {})) : (instagramValue && _jsx(ClearIconStyled, { onClick: handleClear })) }) }))] })) })));
145
+ var appleStoreError = (_f = errors === null || errors === void 0 ? void 0 : errors.apple_store) === null || _f === void 0 ? void 0 : _f.message;
146
+ var playStoreError = (_g = errors === null || errors === void 0 ? void 0 : errors.play_store) === null || _g === void 0 ? void 0 : _g.message;
147
+ var callCenterError = (_h = errors === null || errors === void 0 ? void 0 : errors.call_center) === null || _h === void 0 ? void 0 : _h.message;
148
+ var physicalStoreError = (_j = errors === null || errors === void 0 ? void 0 : errors.physical_store) === null || _j === void 0 ? void 0 : _j.message;
149
+ var hasWebsite = !!(selectedSocialMediaTypes === null || selectedSocialMediaTypes === void 0 ? void 0 : selectedSocialMediaTypes.find(function (s) { return s === SocialMediaTypes.WEB; }));
150
+ var hasSocial = !!(selectedSocialMediaTypes === null || selectedSocialMediaTypes === void 0 ? void 0 : selectedSocialMediaTypes.find(function (s) {
151
+ return s === SocialMediaTypes.TWITTER || s === SocialMediaTypes.INSTAGRAM || s === SocialMediaTypes.SOCIAL;
152
+ }));
153
+ var hasApp = !!(selectedSocialMediaTypes === null || selectedSocialMediaTypes === void 0 ? void 0 : selectedSocialMediaTypes.find(function (s) {
154
+ return s === SocialMediaTypes.APPLE_STORE || s === SocialMediaTypes.PLAY_STORE || s === SocialMediaTypes.APP;
155
+ }));
156
+ var hasCallCenter = !!(selectedSocialMediaTypes === null || selectedSocialMediaTypes === void 0 ? void 0 : selectedSocialMediaTypes.find(function (s) { return s === SocialMediaTypes.CALL_CENTER; }));
157
+ var hasPhysicalStore = !!(selectedSocialMediaTypes === null || selectedSocialMediaTypes === void 0 ? void 0 : selectedSocialMediaTypes.find(function (s) { return s === SocialMediaTypes.PHYSICAL_STORE; }));
158
+ return (_jsx(ScreenContainer, __assign({ sx: { mb: show && (selectedChannels === null || selectedChannels === void 0 ? void 0 : selectedChannels.length) === 0 ? 3 : 0 } }, { children: _jsx(Collapse, __assign({ in: show && (selectedChannels === null || selectedChannels === void 0 ? void 0 : selectedChannels.length) > 0, sx: { mb: (selectedChannels === null || selectedChannels === void 0 ? void 0 : selectedChannels.length) === 0 ? 3 : 0 } }, { children: _jsxs(ScreenContainer, __assign({ sx: __assign({ mt: 3, mb: 3, direction: 'ltr' }, sx) }, { children: [_jsx(SocialMediaGroupStyled, { defaultValue: socialMediaType, showSocialMediaTypes: selectedSocialMediaTypes, exclusive: true, onChange: function (e, value) {
159
+ setSocialMediaType(value);
160
+ } }), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.WEB && hasWebsite, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: websiteValue, onBlur: function () { return handleBlueWebsite(); }, startAdornment: _jsx(TextStyled, {}), placeholder: t('signup_website_placeholder'), warningType: 'alert', warningMessage: websiteError && t(websiteError), endAdornment: !websiteError && websiteValue ? _jsx(CheckIcon, {}) : websiteValue && _jsx(_Fragment, {}) }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.APPLE_STORE && hasApp, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: appleStoreValue, startAdornment: _jsx(TextStyled, {}), placeholder: t('apple_store_placeholder'), warningType: 'alert', warningMessage: appleStoreError && t(appleStoreError), endAdornment: !appleStoreError && appleStoreValue ? (_jsx(CheckIcon, {})) : (appleStoreValue && _jsx(ClearIconStyled, { onClick: handleClear })) }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.PLAY_STORE && hasApp, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: playStoreValue, startAdornment: _jsx(TextStyled, {}), placeholder: t('play_store_placeholder'), warningType: 'alert', warningMessage: playStoreError && t(playStoreError), endAdornment: !playStoreError && playStoreValue ? (_jsx(CheckIcon, {})) : (playStoreValue && _jsx(ClearIconStyled, { onClick: handleClear })) }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.PHYSICAL_STORE && hasPhysicalStore, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: physicalStoreValue, startAdornment: _jsx(TextStyled, {}), placeholder: t('physical_store_placeholder'), warningType: 'alert', warningMessage: physicalStoreError && t(physicalStoreError), endAdornment: !physicalStoreError && physicalStoreValue ? (_jsx(CheckIcon, {})) : (physicalStoreValue && _jsx(ClearIconStyled, { onClick: handleClear })) }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.TWITTER && hasSocial, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: twitterValue, startAdornment: _jsx(TextStyled, {}), placeholder: t('signup_twitter_placeholder'), warningType: 'alert', warningMessage: twitterError && t(twitterError), endAdornment: !twitterError && twitterValue ? (_jsx(CheckIcon, {})) : (twitterValue && _jsx(ClearIconStyled, { onClick: handleClear })) }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.INSTAGRAM && hasSocial, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: instagramValue, startAdornment: _jsx(TextStyled, {}), placeholder: t('signup_instagram_placeholder'), warningType: 'alert', warningMessage: instagramError && t(instagramError), endAdornment: !instagramError && instagramValue ? (_jsx(CheckIcon, {})) : (instagramValue && _jsx(ClearIconStyled, { onClick: handleClear })) }) })), _jsx(Collapse, __assign({ in: socialMediaType === SocialMediaTypes.CALL_CENTER && hasCallCenter, timeout: 300 }, { children: _jsx(InputStyled, { onChange: handleChange, value: callCenterValue, startAdornment: _jsx(TextStyled, {}), placeholder: t('call_center_placeholder'), warningType: 'alert', warningMessage: callCenterError && t(callCenterError), endAdornment: !callCenterError && callCenterValue ? (_jsx(CheckIcon, {})) : (callCenterValue && _jsx(ClearIconStyled, { onClick: handleClear })) }) }))] })) })) })));
116
161
  };
117
162
  export default React.memo(SocialMedia);
@@ -7,49 +7,136 @@ export declare enum ValidationOptions {
7
7
  export declare const MerchantValidationSchema: (userType: ValidationOptions) => yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
8
8
  brandName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
9
9
  termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
10
+ salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
11
+ id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
12
+ name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
13
+ name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
14
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
15
+ id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
16
+ name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
17
+ name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
18
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
19
+ id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
20
+ name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
21
+ name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
22
+ }>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
23
+ id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
24
+ name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
25
+ name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
26
+ }>>[] | undefined>;
10
27
  links: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
11
28
  website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
12
29
  instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
13
30
  twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
31
+ apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
32
+ play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
33
+ call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
34
+ physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
14
35
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
15
36
  website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
16
37
  instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
17
38
  twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
39
+ apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
40
+ play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
41
+ call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
42
+ physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
18
43
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
19
44
  website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
20
45
  instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
21
46
  twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
47
+ apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
48
+ play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
49
+ call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
50
+ physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
22
51
  }>>>;
23
52
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
24
53
  brandName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
25
54
  termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
55
+ salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
56
+ id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
57
+ name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
58
+ name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
59
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
60
+ id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
61
+ name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
62
+ name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
63
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
64
+ id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
65
+ name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
66
+ name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
67
+ }>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
68
+ id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
69
+ name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
70
+ name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
71
+ }>>[] | undefined>;
26
72
  links: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
27
73
  website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
28
74
  instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
29
75
  twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
76
+ apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
77
+ play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
78
+ call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
79
+ physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
30
80
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
31
81
  website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
32
82
  instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
33
83
  twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
84
+ apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
85
+ play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
86
+ call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
87
+ physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
34
88
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
35
89
  website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
36
90
  instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
37
91
  twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
92
+ apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
93
+ play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
94
+ call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
95
+ physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
38
96
  }>>>;
39
97
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
40
98
  brandName: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
41
99
  termAndConditionChecked: yup.BooleanSchema<boolean | undefined, import("yup/lib/types").AnyObject, boolean | undefined>;
100
+ salesChannels: import("yup/lib/array").RequiredArraySchema<yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
101
+ id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
102
+ name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
103
+ name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
104
+ }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
105
+ id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
106
+ name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
107
+ name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
108
+ }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
109
+ id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
110
+ name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
111
+ name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
112
+ }>>>, import("yup/lib/types").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
113
+ id: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
114
+ name_en: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
115
+ name_ar: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
116
+ }>>[] | undefined>;
42
117
  links: yup.ObjectSchema<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
43
118
  website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
44
119
  instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
45
120
  twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
121
+ apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
122
+ play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
123
+ call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
124
+ physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
46
125
  }>, import("yup/lib/object").AnyObject, import("yup/lib/object").TypeOfShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
47
126
  website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
48
127
  instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
49
128
  twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
129
+ apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
130
+ play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
131
+ call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
132
+ physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
50
133
  }>>, import("yup/lib/object").AssertsShape<import("yup/lib/object").Assign<import("yup/lib/object").ObjectShape, {
51
134
  website: yup.StringSchema<string | undefined, import("yup/lib/types").AnyObject, string | undefined>;
52
135
  instagram: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
53
136
  twitter: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
137
+ apple_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
138
+ play_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
139
+ call_center: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
140
+ physical_store: yup.StringSchema<string | null | undefined, import("yup/lib/types").AnyObject, string | null | undefined>;
54
141
  }>>>;
55
142
  }>>>;
@@ -24,6 +24,15 @@ export var MerchantValidationSchema = function (userType) {
24
24
  })
25
25
  .required(''),
26
26
  termAndConditionChecked: yup.boolean().required().isTrue('check_terms_cond'),
27
+ salesChannels: yup
28
+ .array()
29
+ .min(1, 'choose_atleast_one_channel')
30
+ .of(yup.object().shape({
31
+ id: yup.string(),
32
+ name_en: yup.string(),
33
+ name_ar: yup.string()
34
+ }))
35
+ .required('choose_atleast_one_channel'),
27
36
  links: yup.object().shape({
28
37
  website: yup.string().when(['instagram', 'twitter'], function (instagram, twitter) {
29
38
  if (!instagram && !twitter) {
@@ -67,7 +76,31 @@ export var MerchantValidationSchema = function (userType) {
67
76
  else {
68
77
  return yup.string().optional();
69
78
  }
70
- })
79
+ }),
80
+ apple_store: yup
81
+ .string()
82
+ .nullable()
83
+ .transform(function (value) { return (!!value ? value : null); })
84
+ .min(2, 'enter_at_least_one')
85
+ .optional(),
86
+ play_store: yup
87
+ .string()
88
+ .nullable()
89
+ .transform(function (value) { return (!!value ? value : null); })
90
+ .min(2, 'enter_at_least_one')
91
+ .optional(),
92
+ call_center: yup
93
+ .string()
94
+ .nullable()
95
+ .transform(function (value) { return (!!value ? value : null); })
96
+ .min(2, 'enter_at_least_one')
97
+ .optional(),
98
+ physical_store: yup
99
+ .string()
100
+ .nullable()
101
+ .transform(function (value) { return (!!value ? value : null); })
102
+ .min(2, 'enter_at_least_one')
103
+ .optional()
71
104
  }, [
72
105
  ['instagram', 'website'],
73
106
  ['twitter', 'website'],
@@ -78,6 +111,15 @@ export var MerchantValidationSchema = function (userType) {
78
111
  return yup.object().shape({
79
112
  brandName: yup.string().optional(),
80
113
  termAndConditionChecked: yup.boolean().optional(),
114
+ salesChannels: yup
115
+ .array()
116
+ .min(1, 'choose_atleast_one_channel')
117
+ .of(yup.object().shape({
118
+ id: yup.string(),
119
+ name_en: yup.string(),
120
+ name_ar: yup.string()
121
+ }))
122
+ .required('choose_atleast_one_channel'),
81
123
  links: yup.object().shape({
82
124
  website: yup.string().when(['instagram', 'twitter'], function (instagram, twitter) {
83
125
  if (!instagram && !twitter) {
@@ -121,7 +163,31 @@ export var MerchantValidationSchema = function (userType) {
121
163
  else {
122
164
  return yup.string().optional();
123
165
  }
124
- })
166
+ }),
167
+ apple_store: yup
168
+ .string()
169
+ .nullable()
170
+ .transform(function (value) { return (!!value ? value : null); })
171
+ .min(2, 'enter_at_least_one')
172
+ .optional(),
173
+ play_store: yup
174
+ .string()
175
+ .nullable()
176
+ .transform(function (value) { return (!!value ? value : null); })
177
+ .min(2, 'enter_at_least_one')
178
+ .optional(),
179
+ call_center: yup
180
+ .string()
181
+ .nullable()
182
+ .transform(function (value) { return (!!value ? value : null); })
183
+ .min(2, 'enter_at_least_one')
184
+ .optional(),
185
+ physical_store: yup
186
+ .string()
187
+ .nullable()
188
+ .transform(function (value) { return (!!value ? value : null); })
189
+ .min(2, 'enter_at_least_one')
190
+ .optional()
125
191
  }, [
126
192
  ['instagram', 'website'],
127
193
  ['twitter', 'website'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tap-payments/auth-jsconnect",
3
- "version": "2.0.34-test",
3
+ "version": "2.0.35-test",
4
4
  "description": "connect library, auth",
5
5
  "private": false,
6
6
  "main": "build/index.js",