@ikas/storefront 4.0.0-alpha.29 → 4.0.0-alpha.3
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/package.json +13 -13
- package/src/analytics/analytics.ts +1 -2
- package/src/analytics/googleUniversal.ts +2 -12
- package/src/analytics/head/index.tsx +2 -1
- package/src/analytics/ikas.ts +0 -8
- package/src/components/checkout/components/address-form/index.tsx +1 -1
- package/src/components/checkout/components/form-item/index.tsx +11 -9
- package/src/components/checkout/components/phone-number-input/get-countries.ts +5 -37
- package/src/components/checkout/components/phone-number-input/index.tsx +10 -15
- package/src/components/checkout/components/phone-number-input/locale/en.ts +257 -0
- package/src/components/checkout/model.ts +11 -8
- package/src/components/checkout/modelMasterPass.ts +2 -2
- package/src/components/page/head.tsx +0 -12
- package/src/components/page/index.tsx +2 -4
- package/src/components/page-editor/model.ts +3 -16
- package/src/models/data/merchant-settings/index.ts +0 -6
- package/src/models/data/product/variant-type/index.ts +0 -2
- package/src/models/data/storefront/index.ts +0 -2
- package/src/models/ui/product-list/index.ts +6 -0
- package/src/models/ui/validator/form/raffle-form.ts +3 -16
- package/src/models/ui/validator/rules/index.ts +13 -14
- package/src/pages/checkout.tsx +1 -2
- package/src/pages/editor.tsx +2 -5
- package/src/store/cart/index.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ikas/storefront",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.3",
|
|
4
4
|
"description": "Storefront functionality for ikas storefront themes.",
|
|
5
5
|
"author": "Umut Ozan Yıldırım",
|
|
6
6
|
"license": "ISC",
|
|
@@ -24,18 +24,18 @@
|
|
|
24
24
|
"libphonenumber-js": "^1.10.6"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@ikas/storefront-api": "^4.0.0-alpha.
|
|
28
|
-
"@ikas/storefront-config": "^4.0.0-alpha.
|
|
29
|
-
"@ikas/storefront-model-functions": "^4.0.0-alpha.
|
|
30
|
-
"@ikas/storefront-models": "^4.0.0-alpha.
|
|
31
|
-
"@ikas/storefront-providers": "^4.0.0-alpha.
|
|
27
|
+
"@ikas/storefront-api": "^4.0.0-alpha.3",
|
|
28
|
+
"@ikas/storefront-config": "^4.0.0-alpha.3",
|
|
29
|
+
"@ikas/storefront-model-functions": "^4.0.0-alpha.3",
|
|
30
|
+
"@ikas/storefront-models": "^4.0.0-alpha.3",
|
|
31
|
+
"@ikas/storefront-providers": "^4.0.0-alpha.3",
|
|
32
32
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
33
33
|
"@rollup/plugin-json": "^4.1.0",
|
|
34
34
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
35
35
|
"@types/react-phone-number-input": "^3.0.10",
|
|
36
36
|
"mobx": "^6.1.3",
|
|
37
37
|
"mobx-react-lite": "^3.1.5",
|
|
38
|
-
"next": "
|
|
38
|
+
"next": "canary",
|
|
39
39
|
"prettier": "^2.2.1",
|
|
40
40
|
"react": "17.0.2",
|
|
41
41
|
"react-dom": "17.0.2",
|
|
@@ -52,14 +52,14 @@
|
|
|
52
52
|
"html-react-parser": "^1.4.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@ikas/storefront-api": "^4.0.0-alpha.
|
|
56
|
-
"@ikas/storefront-config": "^4.0.0-alpha.
|
|
57
|
-
"@ikas/storefront-model-functions": "^4.0.0-alpha.
|
|
58
|
-
"@ikas/storefront-models": "^4.0.0-alpha.
|
|
59
|
-
"@ikas/storefront-providers": "^4.0.0-alpha.
|
|
55
|
+
"@ikas/storefront-api": "^4.0.0-alpha.3",
|
|
56
|
+
"@ikas/storefront-config": "^4.0.0-alpha.3",
|
|
57
|
+
"@ikas/storefront-model-functions": "^4.0.0-alpha.3",
|
|
58
|
+
"@ikas/storefront-models": "^4.0.0-alpha.3",
|
|
59
|
+
"@ikas/storefront-providers": "^4.0.0-alpha.3",
|
|
60
60
|
"mobx": "^6.1.3",
|
|
61
61
|
"mobx-react-lite": "^3.1.5",
|
|
62
|
-
"next": "
|
|
62
|
+
"next": "canary",
|
|
63
63
|
"react": "17.0.2",
|
|
64
64
|
"react-dom": "17.0.2",
|
|
65
65
|
"lodash": "^4.17.20",
|
|
@@ -54,7 +54,6 @@ export class Analytics {
|
|
|
54
54
|
const customerInfo = await Analytics.getCustomerInfo();
|
|
55
55
|
|
|
56
56
|
GoogleTagManager.pageView(url);
|
|
57
|
-
GoogleUniversal.pageView(window.location.pathname);
|
|
58
57
|
IkasAnalytics.pageView(pageType);
|
|
59
58
|
|
|
60
59
|
tryForEach(Analytics.subscribers, (s) => {
|
|
@@ -195,7 +194,7 @@ export class Analytics {
|
|
|
195
194
|
try {
|
|
196
195
|
localStorage.removeItem(LS_BEGIN_CHECKOUT_KEY);
|
|
197
196
|
|
|
198
|
-
FacebookPixel.purchase(checkout,
|
|
197
|
+
FacebookPixel.purchase(checkout, checkout.orderNumber || "");
|
|
199
198
|
GoogleTagManager.purchase(checkout, checkout.orderNumber || "");
|
|
200
199
|
IkasAnalytics.orderSuccess(checkout);
|
|
201
200
|
GoogleAnalytics.purchase(checkout, checkout.orderNumber || "");
|
|
@@ -8,23 +8,12 @@ export class GoogleUniversal {
|
|
|
8
8
|
makeAutoObservable(this);
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
static pageView(url: string) {
|
|
12
|
-
try {
|
|
13
|
-
if (!isServer && (window as any).ga) {
|
|
14
|
-
(window as any).ga("set", "page", url);
|
|
15
|
-
(window as any).ga("send", "pageview");
|
|
16
|
-
}
|
|
17
|
-
return;
|
|
18
|
-
} catch (err) {
|
|
19
|
-
console.error(err);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
11
|
static productView(productDetail: IkasProduct) {
|
|
24
12
|
try {
|
|
25
13
|
if (!isServer && (window as any).ga) {
|
|
26
14
|
(window as any).ga("ec:addProduct", productToGUItem(productDetail));
|
|
27
15
|
(window as any).ga("ec:setAction", "detail");
|
|
16
|
+
(window as any).ga("send", "pageview");
|
|
28
17
|
}
|
|
29
18
|
return;
|
|
30
19
|
} catch (err) {
|
|
@@ -90,6 +79,7 @@ export class GoogleUniversal {
|
|
|
90
79
|
shipping: "" + checkout.shippingTotal,
|
|
91
80
|
coupon: checkout.couponCode,
|
|
92
81
|
});
|
|
82
|
+
(window as any).ga("send", "pageview");
|
|
93
83
|
}
|
|
94
84
|
return;
|
|
95
85
|
} catch (err) {
|
|
@@ -79,7 +79,8 @@ export const AnalyticsHead: React.FC<HeadProps> = observer(({ blockHTML }) => {
|
|
|
79
79
|
dangerouslySetInnerHTML={{
|
|
80
80
|
__html: `window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
|
|
81
81
|
ga('create', '${universalAnalyticsId}', 'auto');
|
|
82
|
-
ga('require', 'ec')
|
|
82
|
+
ga('require', 'ec');
|
|
83
|
+
ga('send', 'pageview');`,
|
|
83
84
|
}}
|
|
84
85
|
/>
|
|
85
86
|
<script
|
package/src/analytics/ikas.ts
CHANGED
|
@@ -181,10 +181,6 @@ export default class IkasAnalytics {
|
|
|
181
181
|
} else {
|
|
182
182
|
await this.createSessionId();
|
|
183
183
|
}
|
|
184
|
-
|
|
185
|
-
IkasStorefrontConfig.init({
|
|
186
|
-
sessionId: this.sessionId || "",
|
|
187
|
-
});
|
|
188
184
|
} catch (err) {
|
|
189
185
|
console.error(err);
|
|
190
186
|
}
|
|
@@ -200,10 +196,6 @@ export default class IkasAnalytics {
|
|
|
200
196
|
this.visitorId = Date.now() + "";
|
|
201
197
|
localStorage.setItem(this.VISITOR_ID_KEY, this.visitorId);
|
|
202
198
|
}
|
|
203
|
-
|
|
204
|
-
IkasStorefrontConfig.init({
|
|
205
|
-
visitorId: this.visitorId,
|
|
206
|
-
});
|
|
207
199
|
} catch (err) {
|
|
208
200
|
console.error(err);
|
|
209
201
|
}
|
|
@@ -315,7 +315,7 @@ const CityInput: React.FC<FormItemProps> = observer(({ vm }) => {
|
|
|
315
315
|
return (
|
|
316
316
|
<FormItem
|
|
317
317
|
type={FormItemType.TEXT}
|
|
318
|
-
autocomplete="address-
|
|
318
|
+
autocomplete="address-level3"
|
|
319
319
|
label={t("checkout-page:city")}
|
|
320
320
|
value={vm.city?.name || ""}
|
|
321
321
|
onChange={vm.onCityInputChange}
|
|
@@ -7,7 +7,6 @@ import styles from "./style.module.scss";
|
|
|
7
7
|
|
|
8
8
|
import { useTranslation } from "../../../../utils";
|
|
9
9
|
import ReactTooltip from "react-tooltip";
|
|
10
|
-
import { PhoneNumberInput } from "../phone-number-input";
|
|
11
10
|
|
|
12
11
|
export const FormItem: React.FC<Props> = observer((props) => {
|
|
13
12
|
const { t } = useTranslation();
|
|
@@ -109,14 +108,17 @@ export const FormItem: React.FC<Props> = observer((props) => {
|
|
|
109
108
|
/>
|
|
110
109
|
)}
|
|
111
110
|
{vm.type === FormItemType.TEL && (
|
|
112
|
-
<
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
111
|
+
<div></div>
|
|
112
|
+
// <PhoneInput
|
|
113
|
+
// key={props.currentCountryCode || "1"}
|
|
114
|
+
// disabled={vm.disabled}
|
|
115
|
+
// defaultCountry={props.currentCountryCode}
|
|
116
|
+
// placeholder={t("checkout-page:enterPhoneNumber")}
|
|
117
|
+
// value={vm.value ? vm.value : ""}
|
|
118
|
+
// onChange={vm.onPhoneChange}
|
|
119
|
+
// international={true}
|
|
120
|
+
// addInternationalOption={false}
|
|
121
|
+
// />
|
|
120
122
|
)}
|
|
121
123
|
{vm.type === FormItemType.TEXT_AREA && <TextArea vm={vm} />}
|
|
122
124
|
{vm.type === FormItemType.SELECT && (
|
|
@@ -1,50 +1,18 @@
|
|
|
1
|
-
import { IkasStorefrontConfig } from "@ikas/storefront-config";
|
|
2
1
|
import { CountryCode, getCountries as categories } from "libphonenumber-js";
|
|
3
2
|
import compareStrings from "./compare-strings";
|
|
4
3
|
|
|
5
|
-
|
|
4
|
+
import en from "./locale/en";
|
|
5
|
+
|
|
6
|
+
type CountryType = {
|
|
6
7
|
value: CountryCode;
|
|
7
8
|
label: string | undefined;
|
|
8
9
|
};
|
|
9
10
|
|
|
10
|
-
const
|
|
11
|
-
const languages = [
|
|
12
|
-
"de",
|
|
13
|
-
"el",
|
|
14
|
-
"en",
|
|
15
|
-
"es",
|
|
16
|
-
"fi",
|
|
17
|
-
"fr",
|
|
18
|
-
"it",
|
|
19
|
-
"nb",
|
|
20
|
-
"pl",
|
|
21
|
-
"pt-BR",
|
|
22
|
-
"pt",
|
|
23
|
-
"ru",
|
|
24
|
-
"sv",
|
|
25
|
-
"tr",
|
|
26
|
-
"ua",
|
|
27
|
-
"vi",
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
let locale = IkasStorefrontConfig.getCurrentLocale();
|
|
31
|
-
|
|
32
|
-
if (!languages.some((language) => language === locale)) {
|
|
33
|
-
locale = "en";
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return `https://cdn.myikas.com/sf/static/locale/country/${locale}.json`;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const getCountries = async (): Promise<CountryType[]> => {
|
|
40
|
-
const url = getUrl();
|
|
41
|
-
const response = await fetch(url);
|
|
42
|
-
const lang = await response.json();
|
|
43
|
-
|
|
11
|
+
const getCountries = (): CountryType[] => {
|
|
44
12
|
return categories()
|
|
45
13
|
.map((country) => ({
|
|
46
14
|
value: country,
|
|
47
|
-
label:
|
|
15
|
+
label: en[country],
|
|
48
16
|
}))
|
|
49
17
|
.sort((a, b) => compareStrings(a.label, b.label));
|
|
50
18
|
};
|
|
@@ -6,7 +6,8 @@ import parsePhoneNumber, {
|
|
|
6
6
|
getCountryCallingCode,
|
|
7
7
|
parseIncompletePhoneNumber,
|
|
8
8
|
} from "libphonenumber-js";
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
import getCountries from "./get-countries";
|
|
10
11
|
|
|
11
12
|
import styles from "./style.module.scss";
|
|
12
13
|
|
|
@@ -18,20 +19,17 @@ type Props = {
|
|
|
18
19
|
onChange: (value: string) => void;
|
|
19
20
|
};
|
|
20
21
|
|
|
21
|
-
const
|
|
22
|
+
const countries = getCountries();
|
|
22
23
|
|
|
23
24
|
export const PhoneNumberInput: React.FC<Props> = observer(
|
|
24
25
|
({ defaultCountry, disabled = false, placeholder, value, onChange }) => {
|
|
25
|
-
const [countries, setCountries] = React.useState<CountryType[]>([]);
|
|
26
26
|
const [activeCountry, setActiveCountry] = React.useState(
|
|
27
|
-
|
|
27
|
+
defaultCountry as CountryCode
|
|
28
28
|
);
|
|
29
29
|
const [formatedValue, setFormatedValue] = React.useState("");
|
|
30
30
|
|
|
31
31
|
React.useEffect(() => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
let countryCode = activeCountry;
|
|
32
|
+
let countryCode = (defaultCountry as CountryCode) || "TR";
|
|
35
33
|
|
|
36
34
|
if (value) {
|
|
37
35
|
const parsedPhoneNumber = parsePhoneNumber(value);
|
|
@@ -48,11 +46,6 @@ export const PhoneNumberInput: React.FC<Props> = observer(
|
|
|
48
46
|
setActiveCountry(countryCode);
|
|
49
47
|
}, []);
|
|
50
48
|
|
|
51
|
-
const fetchCountries = async () => {
|
|
52
|
-
const categories = await getCountries();
|
|
53
|
-
setCountries(categories);
|
|
54
|
-
};
|
|
55
|
-
|
|
56
49
|
const onValueChange = (event: React.ChangeEvent<HTMLInputElement>) => {
|
|
57
50
|
const phoneNumber = formatPhoneNumber(event.target.value);
|
|
58
51
|
setFormatedValue(phoneNumber);
|
|
@@ -83,7 +76,9 @@ export const PhoneNumberInput: React.FC<Props> = observer(
|
|
|
83
76
|
};
|
|
84
77
|
|
|
85
78
|
const getImageSrc = () => {
|
|
86
|
-
return `https://cdn.myikas.com/sf/assets/flags/3x2/${
|
|
79
|
+
return `https://cdn.myikas.com/sf/assets/flags/3x2/${
|
|
80
|
+
activeCountry || "TR"
|
|
81
|
+
}.svg`;
|
|
87
82
|
};
|
|
88
83
|
|
|
89
84
|
return (
|
|
@@ -93,14 +88,14 @@ export const PhoneNumberInput: React.FC<Props> = observer(
|
|
|
93
88
|
<div className={styles.Flag}>
|
|
94
89
|
<img
|
|
95
90
|
className={styles.FlagImage}
|
|
96
|
-
alt={activeCountry}
|
|
91
|
+
alt={activeCountry || ""}
|
|
97
92
|
src={getImageSrc()}
|
|
98
93
|
></img>
|
|
99
94
|
<div className={styles.Arrow}></div>
|
|
100
95
|
</div>
|
|
101
96
|
<select
|
|
102
97
|
className={styles.Select}
|
|
103
|
-
value={activeCountry}
|
|
98
|
+
value={activeCountry || ""}
|
|
104
99
|
onChange={onCountryChange}
|
|
105
100
|
disabled={disabled}
|
|
106
101
|
>
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
"AB": "Abkhazia",
|
|
3
|
+
"AC": "Ascension Island",
|
|
4
|
+
"AD": "Andorra",
|
|
5
|
+
"AE": "United Arab Emirates",
|
|
6
|
+
"AF": "Afghanistan",
|
|
7
|
+
"AG": "Antigua and Barbuda",
|
|
8
|
+
"AI": "Anguilla",
|
|
9
|
+
"AL": "Albania",
|
|
10
|
+
"AM": "Armenia",
|
|
11
|
+
"AO": "Angola",
|
|
12
|
+
"AQ": "Antarctica",
|
|
13
|
+
"AR": "Argentina",
|
|
14
|
+
"AS": "American Samoa",
|
|
15
|
+
"AT": "Austria",
|
|
16
|
+
"AU": "Australia",
|
|
17
|
+
"AW": "Aruba",
|
|
18
|
+
"AX": "Åland Islands",
|
|
19
|
+
"AZ": "Azerbaijan",
|
|
20
|
+
"BA": "Bosnia and Herzegovina",
|
|
21
|
+
"BB": "Barbados",
|
|
22
|
+
"BD": "Bangladesh",
|
|
23
|
+
"BE": "Belgium",
|
|
24
|
+
"BF": "Burkina Faso",
|
|
25
|
+
"BG": "Bulgaria",
|
|
26
|
+
"BH": "Bahrain",
|
|
27
|
+
"BI": "Burundi",
|
|
28
|
+
"BJ": "Benin",
|
|
29
|
+
"BL": "Saint Barthélemy",
|
|
30
|
+
"BM": "Bermuda",
|
|
31
|
+
"BN": "Brunei Darussalam",
|
|
32
|
+
"BO": "Bolivia",
|
|
33
|
+
"BQ": "Bonaire, Sint Eustatius and Saba",
|
|
34
|
+
"BR": "Brazil",
|
|
35
|
+
"BS": "Bahamas",
|
|
36
|
+
"BT": "Bhutan",
|
|
37
|
+
"BV": "Bouvet Island",
|
|
38
|
+
"BW": "Botswana",
|
|
39
|
+
"BY": "Belarus",
|
|
40
|
+
"BZ": "Belize",
|
|
41
|
+
"CA": "Canada",
|
|
42
|
+
"CC": "Cocos (Keeling) Islands",
|
|
43
|
+
"CD": "Congo, Democratic Republic of the",
|
|
44
|
+
"CF": "Central African Republic",
|
|
45
|
+
"CG": "Congo",
|
|
46
|
+
"CH": "Switzerland",
|
|
47
|
+
"CI": "Cote d'Ivoire",
|
|
48
|
+
"CK": "Cook Islands",
|
|
49
|
+
"CL": "Chile",
|
|
50
|
+
"CM": "Cameroon",
|
|
51
|
+
"CN": "China",
|
|
52
|
+
"CO": "Colombia",
|
|
53
|
+
"CR": "Costa Rica",
|
|
54
|
+
"CU": "Cuba",
|
|
55
|
+
"CV": "Cape Verde",
|
|
56
|
+
"CW": "Curaçao",
|
|
57
|
+
"CX": "Christmas Island",
|
|
58
|
+
"CY": "Cyprus",
|
|
59
|
+
"CZ": "Czech Republic",
|
|
60
|
+
"DE": "Germany",
|
|
61
|
+
"DJ": "Djibouti",
|
|
62
|
+
"DK": "Denmark",
|
|
63
|
+
"DM": "Dominica",
|
|
64
|
+
"DO": "Dominican Republic",
|
|
65
|
+
"DZ": "Algeria",
|
|
66
|
+
"EC": "Ecuador",
|
|
67
|
+
"EE": "Estonia",
|
|
68
|
+
"EG": "Egypt",
|
|
69
|
+
"EH": "Western Sahara",
|
|
70
|
+
"ER": "Eritrea",
|
|
71
|
+
"ES": "Spain",
|
|
72
|
+
"ET": "Ethiopia",
|
|
73
|
+
"FI": "Finland",
|
|
74
|
+
"FJ": "Fiji",
|
|
75
|
+
"FK": "Falkland Islands",
|
|
76
|
+
"FM": "Federated States of Micronesia",
|
|
77
|
+
"FO": "Faroe Islands",
|
|
78
|
+
"FR": "France",
|
|
79
|
+
"GA": "Gabon",
|
|
80
|
+
"GB": "United Kingdom",
|
|
81
|
+
"GD": "Grenada",
|
|
82
|
+
"GE": "Georgia",
|
|
83
|
+
"GF": "French Guiana",
|
|
84
|
+
"GG": "Guernsey",
|
|
85
|
+
"GH": "Ghana",
|
|
86
|
+
"GI": "Gibraltar",
|
|
87
|
+
"GL": "Greenland",
|
|
88
|
+
"GM": "Gambia",
|
|
89
|
+
"GN": "Guinea",
|
|
90
|
+
"GP": "Guadeloupe",
|
|
91
|
+
"GQ": "Equatorial Guinea",
|
|
92
|
+
"GR": "Greece",
|
|
93
|
+
"GS": "South Georgia and the South Sandwich Islands",
|
|
94
|
+
"GT": "Guatemala",
|
|
95
|
+
"GU": "Guam",
|
|
96
|
+
"GW": "Guinea-Bissau",
|
|
97
|
+
"GY": "Guyana",
|
|
98
|
+
"HK": "Hong Kong",
|
|
99
|
+
"HM": "Heard Island and McDonald Islands",
|
|
100
|
+
"HN": "Honduras",
|
|
101
|
+
"HR": "Croatia",
|
|
102
|
+
"HT": "Haiti",
|
|
103
|
+
"HU": "Hungary",
|
|
104
|
+
"ID": "Indonesia",
|
|
105
|
+
"IE": "Ireland",
|
|
106
|
+
"IL": "Israel",
|
|
107
|
+
"IM": "Isle of Man",
|
|
108
|
+
"IN": "India",
|
|
109
|
+
"IO": "British Indian Ocean Territory",
|
|
110
|
+
"IQ": "Iraq",
|
|
111
|
+
"IR": "Iran",
|
|
112
|
+
"IS": "Iceland",
|
|
113
|
+
"IT": "Italy",
|
|
114
|
+
"JE": "Jersey",
|
|
115
|
+
"JM": "Jamaica",
|
|
116
|
+
"JO": "Jordan",
|
|
117
|
+
"JP": "Japan",
|
|
118
|
+
"KE": "Kenya",
|
|
119
|
+
"KG": "Kyrgyzstan",
|
|
120
|
+
"KH": "Cambodia",
|
|
121
|
+
"KI": "Kiribati",
|
|
122
|
+
"KM": "Comoros",
|
|
123
|
+
"KN": "Saint Kitts and Nevis",
|
|
124
|
+
"KP": "North Korea",
|
|
125
|
+
"KR": "South Korea",
|
|
126
|
+
"KW": "Kuwait",
|
|
127
|
+
"KY": "Cayman Islands",
|
|
128
|
+
"KZ": "Kazakhstan",
|
|
129
|
+
"LA": "Laos",
|
|
130
|
+
"LB": "Lebanon",
|
|
131
|
+
"LC": "Saint Lucia",
|
|
132
|
+
"LI": "Liechtenstein",
|
|
133
|
+
"LK": "Sri Lanka",
|
|
134
|
+
"LR": "Liberia",
|
|
135
|
+
"LS": "Lesotho",
|
|
136
|
+
"LT": "Lithuania",
|
|
137
|
+
"LU": "Luxembourg",
|
|
138
|
+
"LV": "Latvia",
|
|
139
|
+
"LY": "Libya",
|
|
140
|
+
"MA": "Morocco",
|
|
141
|
+
"MC": "Monaco",
|
|
142
|
+
"MD": "Moldova",
|
|
143
|
+
"ME": "Montenegro",
|
|
144
|
+
"MF": "Saint Martin (French Part)",
|
|
145
|
+
"MG": "Madagascar",
|
|
146
|
+
"MH": "Marshall Islands",
|
|
147
|
+
"MK": "North Macedonia",
|
|
148
|
+
"ML": "Mali",
|
|
149
|
+
"MM": "Burma",
|
|
150
|
+
"MN": "Mongolia",
|
|
151
|
+
"MO": "Macao",
|
|
152
|
+
"MP": "Northern Mariana Islands",
|
|
153
|
+
"MQ": "Martinique",
|
|
154
|
+
"MR": "Mauritania",
|
|
155
|
+
"MS": "Montserrat",
|
|
156
|
+
"MT": "Malta",
|
|
157
|
+
"MU": "Mauritius",
|
|
158
|
+
"MV": "Maldives",
|
|
159
|
+
"MW": "Malawi",
|
|
160
|
+
"MX": "Mexico",
|
|
161
|
+
"MY": "Malaysia",
|
|
162
|
+
"MZ": "Mozambique",
|
|
163
|
+
"NA": "Namibia",
|
|
164
|
+
"NC": "New Caledonia",
|
|
165
|
+
"NE": "Niger",
|
|
166
|
+
"NF": "Norfolk Island",
|
|
167
|
+
"NG": "Nigeria",
|
|
168
|
+
"NI": "Nicaragua",
|
|
169
|
+
"NL": "Netherlands",
|
|
170
|
+
"NO": "Norway",
|
|
171
|
+
"NP": "Nepal",
|
|
172
|
+
"NR": "Nauru",
|
|
173
|
+
"NU": "Niue",
|
|
174
|
+
"NZ": "New Zealand",
|
|
175
|
+
"OM": "Oman",
|
|
176
|
+
"OS": "South Ossetia",
|
|
177
|
+
"PA": "Panama",
|
|
178
|
+
"PE": "Peru",
|
|
179
|
+
"PF": "French Polynesia",
|
|
180
|
+
"PG": "Papua New Guinea",
|
|
181
|
+
"PH": "Philippines",
|
|
182
|
+
"PK": "Pakistan",
|
|
183
|
+
"PL": "Poland",
|
|
184
|
+
"PM": "Saint Pierre and Miquelon",
|
|
185
|
+
"PN": "Pitcairn",
|
|
186
|
+
"PR": "Puerto Rico",
|
|
187
|
+
"PS": "Palestine",
|
|
188
|
+
"PT": "Portugal",
|
|
189
|
+
"PW": "Palau",
|
|
190
|
+
"PY": "Paraguay",
|
|
191
|
+
"QA": "Qatar",
|
|
192
|
+
"RE": "Reunion",
|
|
193
|
+
"RO": "Romania",
|
|
194
|
+
"RS": "Serbia",
|
|
195
|
+
"RU": "Russia",
|
|
196
|
+
"RW": "Rwanda",
|
|
197
|
+
"SA": "Saudi Arabia",
|
|
198
|
+
"SB": "Solomon Islands",
|
|
199
|
+
"SC": "Seychelles",
|
|
200
|
+
"SD": "Sudan",
|
|
201
|
+
"SE": "Sweden",
|
|
202
|
+
"SG": "Singapore",
|
|
203
|
+
"SH": "Saint Helena",
|
|
204
|
+
"SI": "Slovenia",
|
|
205
|
+
"SJ": "Svalbard and Jan Mayen",
|
|
206
|
+
"SK": "Slovakia",
|
|
207
|
+
"SL": "Sierra Leone",
|
|
208
|
+
"SM": "San Marino",
|
|
209
|
+
"SN": "Senegal",
|
|
210
|
+
"SO": "Somalia",
|
|
211
|
+
"SR": "Suriname",
|
|
212
|
+
"SS": "South Sudan",
|
|
213
|
+
"ST": "Sao Tome and Principe",
|
|
214
|
+
"SV": "El Salvador",
|
|
215
|
+
"SX": "Sint Maarten",
|
|
216
|
+
"SY": "Syria",
|
|
217
|
+
"SZ": "Swaziland",
|
|
218
|
+
"TA": "Tristan da Cunha",
|
|
219
|
+
"TC": "Turks and Caicos Islands",
|
|
220
|
+
"TD": "Chad",
|
|
221
|
+
"TF": "French Southern Territories",
|
|
222
|
+
"TG": "Togo",
|
|
223
|
+
"TH": "Thailand",
|
|
224
|
+
"TJ": "Tajikistan",
|
|
225
|
+
"TK": "Tokelau",
|
|
226
|
+
"TL": "Timor-Leste",
|
|
227
|
+
"TM": "Turkmenistan",
|
|
228
|
+
"TN": "Tunisia",
|
|
229
|
+
"TO": "Tonga",
|
|
230
|
+
"TR": "Turkey",
|
|
231
|
+
"TT": "Trinidad and Tobago",
|
|
232
|
+
"TV": "Tuvalu",
|
|
233
|
+
"TW": "Taiwan",
|
|
234
|
+
"TZ": "Tanzania",
|
|
235
|
+
"UA": "Ukraine",
|
|
236
|
+
"UG": "Uganda",
|
|
237
|
+
"UM": "United States Minor Outlying Islands",
|
|
238
|
+
"US": "United States",
|
|
239
|
+
"UY": "Uruguay",
|
|
240
|
+
"UZ": "Uzbekistan",
|
|
241
|
+
"VA": "Holy See (Vatican City State)",
|
|
242
|
+
"VC": "Saint Vincent and the Grenadines",
|
|
243
|
+
"VE": "Venezuela",
|
|
244
|
+
"VG": "Virgin Islands, British",
|
|
245
|
+
"VI": "Virgin Islands, U.S.",
|
|
246
|
+
"VN": "Vietnam",
|
|
247
|
+
"VU": "Vanuatu",
|
|
248
|
+
"WF": "Wallis and Futuna",
|
|
249
|
+
"WS": "Samoa",
|
|
250
|
+
"XK": "Kosovo",
|
|
251
|
+
"YE": "Yemen",
|
|
252
|
+
"YT": "Mayotte",
|
|
253
|
+
"ZA": "South Africa",
|
|
254
|
+
"ZM": "Zambia",
|
|
255
|
+
"ZW": "Zimbabwe",
|
|
256
|
+
"ZZ": "International"
|
|
257
|
+
}
|
|
@@ -53,6 +53,10 @@ import {
|
|
|
53
53
|
RetrieveInstallmentInfoQueryParams,
|
|
54
54
|
SaveCartInput,
|
|
55
55
|
} from "@ikas/storefront-api";
|
|
56
|
+
import { OrderAddressCountryInputData } from "@ikas/storefront-api/build/__api/models/OrderAddressCountryInput";
|
|
57
|
+
import { OrderAddressCityInputData } from "@ikas/storefront-api/build/__api/models/OrderAddressCityInput";
|
|
58
|
+
import { OrderAddressStateInputData } from "@ikas/storefront-api/build/__api/models/OrderAddressStateInput";
|
|
59
|
+
import { OrderAddressDistrictInputData } from "@ikas/storefront-api/build/__api/models/OrderAddressDistrictInput";
|
|
56
60
|
|
|
57
61
|
const NUMBER_ONLY_REGEX = /^\d+$/;
|
|
58
62
|
const MAX_CARD_NUMBER_LENGTH = 16;
|
|
@@ -440,10 +444,7 @@ export default class CheckoutViewModel {
|
|
|
440
444
|
input = await this.inStockDeliveryInputData(input);
|
|
441
445
|
}
|
|
442
446
|
|
|
443
|
-
if (
|
|
444
|
-
this.step === CheckoutStep.INFO ||
|
|
445
|
-
this.step === CheckoutStep.SHIPPING
|
|
446
|
-
) {
|
|
447
|
+
if (this.step === CheckoutStep.INFO) {
|
|
447
448
|
input.billingAddress = null;
|
|
448
449
|
}
|
|
449
450
|
|
|
@@ -479,11 +480,13 @@ export default class CheckoutViewModel {
|
|
|
479
480
|
inStoreLocation.address
|
|
480
481
|
) {
|
|
481
482
|
inputData.shippingAddress.country = inStoreLocation.address
|
|
482
|
-
.country as
|
|
483
|
-
inputData.shippingAddress.city = inStoreLocation.address
|
|
484
|
-
|
|
483
|
+
.country as OrderAddressCountryInputData;
|
|
484
|
+
inputData.shippingAddress.city = inStoreLocation.address
|
|
485
|
+
.city as OrderAddressCityInputData;
|
|
486
|
+
inputData.shippingAddress.state = inStoreLocation.address
|
|
487
|
+
.state as OrderAddressStateInputData;
|
|
485
488
|
inputData.shippingAddress.district = inStoreLocation.address
|
|
486
|
-
.district as
|
|
489
|
+
.district as OrderAddressDistrictInputData;
|
|
487
490
|
inputData.shippingAddress.postalCode = inStoreLocation.address.postalCode;
|
|
488
491
|
inputData.shippingAddress.addressLine1 =
|
|
489
492
|
inStoreLocation.address.address || "";
|
|
@@ -6,7 +6,7 @@ import { useTranslation } from "../../utils/i18n";
|
|
|
6
6
|
import { IkasBaseStore } from "../../store";
|
|
7
7
|
import { IkasCheckout, IkasPaymentGateway } from "../../models";
|
|
8
8
|
import { MasterPassOperationTypeEnum } from "@ikas/storefront-api";
|
|
9
|
-
import {
|
|
9
|
+
import { getMasterpassRequestToken } from "@ikas/storefront-api";
|
|
10
10
|
import { IkasStorefrontConfig } from "@ikas/storefront-config";
|
|
11
11
|
|
|
12
12
|
const isServer = typeof localStorage === "undefined";
|
|
@@ -437,7 +437,7 @@ export default class MasterPassModel {
|
|
|
437
437
|
operationType: MasterPassOperationTypeEnum;
|
|
438
438
|
phoneNumber: string;
|
|
439
439
|
}) => {
|
|
440
|
-
const response = await
|
|
440
|
+
const response = await getMasterpassRequestToken({
|
|
441
441
|
cartId,
|
|
442
442
|
paymentGatewayId,
|
|
443
443
|
operationType,
|
|
@@ -251,18 +251,6 @@ function createStoreSchema(merchantSettings: IkasMerchantSettings) {
|
|
|
251
251
|
logo: logo,
|
|
252
252
|
image: logo,
|
|
253
253
|
url: "https://" + IkasStorefrontConfig.getDomain(),
|
|
254
|
-
telephone: merchantSettings?.phone,
|
|
255
|
-
address: {
|
|
256
|
-
"@type": "PostalAddress",
|
|
257
|
-
streetAddress: merchantSettings.address?.addressLine1,
|
|
258
|
-
addressLocality: merchantSettings.address?.city?.name,
|
|
259
|
-
...(merchantSettings.address &&
|
|
260
|
-
merchantSettings.address.state && {
|
|
261
|
-
addressRegion: merchantSettings.address.state.code,
|
|
262
|
-
}),
|
|
263
|
-
postalCode: merchantSettings.address?.postalCode,
|
|
264
|
-
addressCountry: merchantSettings.address?.country?.code,
|
|
265
|
-
},
|
|
266
254
|
};
|
|
267
255
|
}
|
|
268
256
|
|
|
@@ -19,7 +19,6 @@ import { ThemeComponent } from "./ThemeComponent";
|
|
|
19
19
|
import { IkasBaseStore } from "../../store";
|
|
20
20
|
import { initIkasEvents } from "../../analytics/events";
|
|
21
21
|
import { IkasPageDataInit } from "../../page-data-init";
|
|
22
|
-
import { setAPIClientConfig } from "@ikas/storefront-api";
|
|
23
22
|
|
|
24
23
|
export type IkasPageProps = {
|
|
25
24
|
propValues: IkasPageComponentPropValue[];
|
|
@@ -56,16 +55,15 @@ export const IkasPage: React.FC<IkasPageProps> = observer(
|
|
|
56
55
|
productReviewSummary,
|
|
57
56
|
}) => {
|
|
58
57
|
const router = useRouter();
|
|
58
|
+
const store = IkasBaseStore.getInstance();
|
|
59
|
+
store.router = router;
|
|
59
60
|
|
|
60
61
|
IkasStorefrontConfig.init({
|
|
61
62
|
...configJson,
|
|
62
63
|
currentPageComponents: components,
|
|
63
64
|
});
|
|
64
65
|
IkasBaseStore.getInstance().router = router;
|
|
65
|
-
setAPIClientConfig();
|
|
66
66
|
|
|
67
|
-
const store = IkasBaseStore.getInstance();
|
|
68
|
-
store.router = router;
|
|
69
67
|
store.currentPageType = pageType;
|
|
70
68
|
|
|
71
69
|
const [isBrowser, setIsBrowser] = React.useState(false);
|
|
@@ -23,7 +23,6 @@ import HtmlMetaDataStore from "../../store/html-meta-data";
|
|
|
23
23
|
import BlogStore from "../../store/blog";
|
|
24
24
|
import RaffleStore from "../../store/raffle";
|
|
25
25
|
import ProductStore from "../../store/product";
|
|
26
|
-
import { setAPIClientConfig } from "@ikas/storefront-api";
|
|
27
26
|
|
|
28
27
|
const PACKAGE_VERSION = "2.0.20";
|
|
29
28
|
// import { version as PACKAGE_VERSION } from "../../../package.json";
|
|
@@ -461,8 +460,7 @@ export default class IkasPageEditorViewModel {
|
|
|
461
460
|
const pageDataProvider = new IkasPageDataProvider(
|
|
462
461
|
theme,
|
|
463
462
|
pageParams,
|
|
464
|
-
pageType
|
|
465
|
-
true
|
|
463
|
+
pageType
|
|
466
464
|
);
|
|
467
465
|
|
|
468
466
|
if (pageParams.blogId || pageParams.blogCategoryId) {
|
|
@@ -567,12 +565,7 @@ export default class IkasPageEditorViewModel {
|
|
|
567
565
|
translations: this.translations || {},
|
|
568
566
|
isEditor: true,
|
|
569
567
|
apiKey: data.apiKey,
|
|
570
|
-
apiUrl: data.apiUrl,
|
|
571
|
-
adminApiUrl: data.adminApiUrl,
|
|
572
|
-
cdnUrl: data.cdnUrl,
|
|
573
568
|
});
|
|
574
|
-
|
|
575
|
-
setAPIClientConfig();
|
|
576
569
|
}
|
|
577
570
|
|
|
578
571
|
// (window as any).editorApiKey = data.apiKey;
|
|
@@ -625,6 +618,8 @@ export default class IkasPageEditorViewModel {
|
|
|
625
618
|
await this.pageDataProvider.setLinkSlugs();
|
|
626
619
|
|
|
627
620
|
if (pageComponentPropValues) {
|
|
621
|
+
pageComponentPropValues.propValues[propName] = propValue;
|
|
622
|
+
|
|
628
623
|
if (prop.type === IkasThemeJsonComponentPropType.CUSTOM) {
|
|
629
624
|
IkasPageDataInit.initCustomDataPropValue(
|
|
630
625
|
prop,
|
|
@@ -655,12 +650,6 @@ export default class IkasPageEditorViewModel {
|
|
|
655
650
|
propValue,
|
|
656
651
|
pageComponentPropValues
|
|
657
652
|
);
|
|
658
|
-
} else if (prop.type === IkasThemeJsonComponentPropType.PRODUCT_LIST) {
|
|
659
|
-
IkasPageDataInit.initProductListPropValue(
|
|
660
|
-
prop,
|
|
661
|
-
propValue,
|
|
662
|
-
pageComponentPropValues
|
|
663
|
-
);
|
|
664
653
|
} else if (prop.type === IkasThemeJsonComponentPropType.CATEGORY) {
|
|
665
654
|
IkasPageDataInit.initCategoryPropValue(
|
|
666
655
|
prop,
|
|
@@ -700,8 +689,6 @@ export default class IkasPageEditorViewModel {
|
|
|
700
689
|
propValue,
|
|
701
690
|
pageComponentPropValues
|
|
702
691
|
);
|
|
703
|
-
} else {
|
|
704
|
-
pageComponentPropValues.propValues[propName] = propValue;
|
|
705
692
|
}
|
|
706
693
|
}
|
|
707
694
|
};
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IkasMerchantSettingsCurrencyFormat,
|
|
3
3
|
IkasMerchantSettings as IMerchantSettings,
|
|
4
|
-
IkasMerchantAddress,
|
|
5
4
|
} from "@ikas/storefront-models";
|
|
6
5
|
import { makeAutoObservable } from "mobx";
|
|
7
6
|
import { IkasImage } from "../image";
|
|
8
7
|
|
|
9
8
|
export class IkasMerchantSettings implements IMerchantSettings {
|
|
10
9
|
currencyFormats: IkasMerchantSettingsCurrencyFormat[] | null;
|
|
11
|
-
address: IkasMerchantAddress | null;
|
|
12
10
|
logoId: string | null;
|
|
13
11
|
merchantId: string;
|
|
14
12
|
merchantName: string;
|
|
15
|
-
phone: string | null;
|
|
16
13
|
|
|
17
14
|
// Extra
|
|
18
15
|
logo?: IkasImage | null;
|
|
@@ -22,9 +19,6 @@ export class IkasMerchantSettings implements IMerchantSettings {
|
|
|
22
19
|
this.logoId = data.logoId;
|
|
23
20
|
this.merchantId = data.merchantId;
|
|
24
21
|
this.merchantName = data.merchantName;
|
|
25
|
-
this.phone = data.phone || null;
|
|
26
|
-
this.address = data.address || null;
|
|
27
|
-
|
|
28
22
|
this.logo = data.logo ? new IkasImage(data.logo) : null;
|
|
29
23
|
|
|
30
24
|
makeAutoObservable(this);
|
|
@@ -3,12 +3,10 @@ import { IkasProductVariantType as IProductVariantType } from "@ikas/storefront-
|
|
|
3
3
|
import { makeAutoObservable } from "mobx";
|
|
4
4
|
|
|
5
5
|
export class IkasProductVariantType implements IProductVariantType {
|
|
6
|
-
order: number;
|
|
7
6
|
variantType: IkasVariantType;
|
|
8
7
|
variantValueIds: string[];
|
|
9
8
|
|
|
10
9
|
constructor(data: Partial<IkasProductVariantType>) {
|
|
11
|
-
this.order = data.order || 0;
|
|
12
10
|
this.variantType = data.variantType
|
|
13
11
|
? new IkasVariantType(data.variantType)
|
|
14
12
|
: new IkasVariantType();
|
|
@@ -20,7 +20,6 @@ export class IkasStorefront implements IStorefront {
|
|
|
20
20
|
analytics4Id: string | null;
|
|
21
21
|
universalAnalyticsId: string | null;
|
|
22
22
|
tiktokPixelId: string | null;
|
|
23
|
-
token: string | null;
|
|
24
23
|
|
|
25
24
|
localizations: IkasStorefrontLocalization[];
|
|
26
25
|
routings: IkasStorefrontRouting[];
|
|
@@ -41,7 +40,6 @@ export class IkasStorefront implements IStorefront {
|
|
|
41
40
|
this.analytics4Id = data.analytics4Id || null;
|
|
42
41
|
this.universalAnalyticsId = data.universalAnalyticsId || null;
|
|
43
42
|
this.tiktokPixelId = data.tiktokPixelId || null;
|
|
44
|
-
this.token = data.token || null;
|
|
45
43
|
|
|
46
44
|
// Sub Models
|
|
47
45
|
this.localizations = data.localizations
|
|
@@ -221,6 +221,12 @@ export class IkasProductList {
|
|
|
221
221
|
|
|
222
222
|
get filterQueryParams() {
|
|
223
223
|
const queryParams: Record<string, any> = {};
|
|
224
|
+
const _getQueryParams = this.getQueryParams();
|
|
225
|
+
if (_getQueryParams) {
|
|
226
|
+
_getQueryParams.forEach((value, key) => {
|
|
227
|
+
queryParams[key] = value;
|
|
228
|
+
});
|
|
229
|
+
}
|
|
224
230
|
|
|
225
231
|
this.filters?.forEach((f) => {
|
|
226
232
|
if (f.keyList.length) queryParams[f.key] = f.keyList;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { saveRaffleParticipant } from "@ikas/storefront-api";
|
|
2
2
|
import { action, computed, makeObservable, observable } from "mobx";
|
|
3
|
-
import { GraphQLError } from "graphql";
|
|
4
3
|
|
|
5
4
|
import { Validator } from "..";
|
|
6
5
|
import { IkasBaseStore } from "../../../../store";
|
|
@@ -238,11 +237,7 @@ export class RaffleForm {
|
|
|
238
237
|
}
|
|
239
238
|
|
|
240
239
|
async submit() {
|
|
241
|
-
const response:
|
|
242
|
-
isFormError: boolean;
|
|
243
|
-
isSuccess: boolean;
|
|
244
|
-
errors?: readonly GraphQLError[];
|
|
245
|
-
} = { isFormError: false, isSuccess: false };
|
|
240
|
+
const response = { isFormError: false, isSuccess: false };
|
|
246
241
|
const hasFormError = await this.validateAll();
|
|
247
242
|
if (hasFormError) {
|
|
248
243
|
response.isFormError = true;
|
|
@@ -251,7 +246,7 @@ export class RaffleForm {
|
|
|
251
246
|
|
|
252
247
|
try {
|
|
253
248
|
const selectedVariant = this.raffle.products[0].selectedVariant;
|
|
254
|
-
const
|
|
249
|
+
const isRaffleFormSuccess = await saveRaffleParticipant({
|
|
255
250
|
input: {
|
|
256
251
|
appliedProduct: {
|
|
257
252
|
productId: selectedVariant.productId,
|
|
@@ -269,20 +264,12 @@ export class RaffleForm {
|
|
|
269
264
|
},
|
|
270
265
|
});
|
|
271
266
|
|
|
272
|
-
if (
|
|
273
|
-
response.errors = saveRaffleParticipantResponse.graphQLErrors;
|
|
274
|
-
response.isSuccess = false;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
if (saveRaffleParticipantResponse.data) {
|
|
267
|
+
if (isRaffleFormSuccess) {
|
|
278
268
|
response.isSuccess = true;
|
|
279
269
|
}
|
|
280
270
|
|
|
281
271
|
return response;
|
|
282
272
|
} catch (error) {
|
|
283
|
-
if (error) {
|
|
284
|
-
response.errors = error;
|
|
285
|
-
}
|
|
286
273
|
return response;
|
|
287
274
|
}
|
|
288
275
|
}
|
|
@@ -183,16 +183,6 @@ export class EmailRule<T> extends ValidationRule<T> {
|
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
/**
|
|
187
|
-
* 1) start with plus(+) or digit
|
|
188
|
-
* 2) any digit or one char white space
|
|
189
|
-
* 3) end with digit
|
|
190
|
-
*
|
|
191
|
-
* For example:
|
|
192
|
-
* ✅ Valid +90535 555 5555
|
|
193
|
-
* ✅ valid 905355555555
|
|
194
|
-
* 🚫 Unvalid +90535 5 55 5555
|
|
195
|
-
*/
|
|
196
186
|
export class PhoneRule<T> extends ValidationRule<T> {
|
|
197
187
|
get errorMessage() {
|
|
198
188
|
if (!this.message) return "";
|
|
@@ -203,8 +193,10 @@ export class PhoneRule<T> extends ValidationRule<T> {
|
|
|
203
193
|
async run(): Promise<boolean> {
|
|
204
194
|
if (!this.value) return true;
|
|
205
195
|
|
|
206
|
-
const result = this.value.match(
|
|
207
|
-
return
|
|
196
|
+
const result = this.value.match(/\d/g);
|
|
197
|
+
return (
|
|
198
|
+
(!!result && result.length <= 11) || !!/^\+(\d{12})$/gm.test(this.value)
|
|
199
|
+
);
|
|
208
200
|
}
|
|
209
201
|
}
|
|
210
202
|
|
|
@@ -254,8 +246,15 @@ export class IdentityNumberRule<T> extends ValidationRule<T> {
|
|
|
254
246
|
TCSum = 0;
|
|
255
247
|
|
|
256
248
|
const incorrect = [
|
|
257
|
-
11111111110,
|
|
258
|
-
|
|
249
|
+
11111111110,
|
|
250
|
+
22222222220,
|
|
251
|
+
33333333330,
|
|
252
|
+
44444444440,
|
|
253
|
+
55555555550,
|
|
254
|
+
66666666660,
|
|
255
|
+
7777777770,
|
|
256
|
+
88888888880,
|
|
257
|
+
99999999990,
|
|
259
258
|
];
|
|
260
259
|
|
|
261
260
|
if (tcknString.length !== 11) return false;
|
package/src/pages/checkout.tsx
CHANGED
|
@@ -9,7 +9,7 @@ import IkasCheckoutPage, {
|
|
|
9
9
|
import { useRouter } from "next/router.js";
|
|
10
10
|
import { FullscreenLoading } from "../components/checkout/components/fullscreen-loading";
|
|
11
11
|
import { CheckoutStep } from "../components/checkout/model";
|
|
12
|
-
import { getCartById
|
|
12
|
+
import { getCartById } from "@ikas/storefront-api";
|
|
13
13
|
import { IkasStorefrontConfig } from "@ikas/storefront-config";
|
|
14
14
|
import { IkasBaseStore } from "..";
|
|
15
15
|
import { IkasCheckout, IkasCheckoutSettings } from "../models/data";
|
|
@@ -35,7 +35,6 @@ const CheckoutPage: React.FC<Props> = ({
|
|
|
35
35
|
const [checkout, setCheckout] = React.useState<IkasCheckout | undefined>();
|
|
36
36
|
|
|
37
37
|
IkasStorefrontConfig.init(configJson);
|
|
38
|
-
setAPIClientConfig();
|
|
39
38
|
|
|
40
39
|
React.useEffect(() => {
|
|
41
40
|
setCustomizationProps(customizationProps);
|
package/src/pages/editor.tsx
CHANGED
|
@@ -8,7 +8,7 @@ const IkasPageEditor = dynamic(
|
|
|
8
8
|
);
|
|
9
9
|
|
|
10
10
|
type Props = {
|
|
11
|
-
configJson
|
|
11
|
+
configJson: Record<string, any>;
|
|
12
12
|
components?: Record<string, any>;
|
|
13
13
|
};
|
|
14
14
|
|
|
@@ -19,12 +19,9 @@ export default class Page extends React.Component<Props> {
|
|
|
19
19
|
if (configJson) {
|
|
20
20
|
IkasStorefrontConfig.init({
|
|
21
21
|
...configJson,
|
|
22
|
+
currentPageComponents: components || {},
|
|
22
23
|
});
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
-
IkasStorefrontConfig.init({
|
|
26
|
-
currentPageComponents: components || {},
|
|
27
|
-
});
|
|
28
25
|
}
|
|
29
26
|
|
|
30
27
|
render() {
|
package/src/store/cart/index.ts
CHANGED
|
@@ -100,7 +100,7 @@ export class IkasCartStore {
|
|
|
100
100
|
|
|
101
101
|
product.productOptionSet?.initOptionValues();
|
|
102
102
|
|
|
103
|
-
return
|
|
103
|
+
return true;
|
|
104
104
|
} catch (err) {
|
|
105
105
|
console.log(err);
|
|
106
106
|
return false;
|
|
@@ -145,7 +145,7 @@ export class IkasCartStore {
|
|
|
145
145
|
Analytics.addToCart(item, quantity - oldQuantity, eventId, this.cart);
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
return
|
|
148
|
+
return true;
|
|
149
149
|
} catch (err) {
|
|
150
150
|
console.log(err);
|
|
151
151
|
return false;
|