@akinon/next 1.13.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/.editorconfig +7 -0
  2. package/.eslintrc.js +40 -40
  3. package/.prettierrc +13 -13
  4. package/CHANGELOG.md +19 -0
  5. package/api/auth.ts +231 -231
  6. package/api/cache.ts +44 -44
  7. package/api/client.ts +174 -174
  8. package/api/logout.ts +42 -42
  9. package/assets/styles/index.scss +28 -28
  10. package/bin/pz-check-dependencies.js +98 -98
  11. package/bin/pz-install-plugins.js +33 -33
  12. package/bin/pz-install-theme.js +58 -58
  13. package/bin/pz-postbuild.js +1 -1
  14. package/bin/pz-postdev.js +1 -1
  15. package/bin/pz-postinstall.js +6 -6
  16. package/bin/pz-poststart.js +1 -1
  17. package/bin/pz-prebuild.js +4 -4
  18. package/bin/pz-predev.js +4 -4
  19. package/bin/pz-prestart.js +1 -1
  20. package/bin/run-script.js +44 -44
  21. package/components/accordion.tsx +52 -0
  22. package/components/button.tsx +46 -0
  23. package/components/client-root.tsx +19 -19
  24. package/components/icon.tsx +18 -18
  25. package/components/image.tsx +133 -133
  26. package/components/index.ts +17 -1
  27. package/components/input.tsx +110 -0
  28. package/components/lazy-component.tsx +33 -33
  29. package/components/loader-spinner.tsx +23 -23
  30. package/components/mobile-app-toggler.tsx +26 -26
  31. package/components/oauth-login.tsx +24 -24
  32. package/components/plugin-module.tsx +11 -8
  33. package/components/price.tsx +55 -0
  34. package/components/pz-providers.tsx +24 -24
  35. package/components/pz-root.tsx +21 -21
  36. package/components/radio.tsx +18 -18
  37. package/components/react-portal.tsx +45 -45
  38. package/components/redirect-three-d/content/index.tsx +74 -74
  39. package/components/redirect-three-d/index.tsx +17 -17
  40. package/components/selected-payment-option-view.tsx +7 -0
  41. package/components/trans.tsx +39 -39
  42. package/data/client/account.ts +208 -208
  43. package/data/client/address.ts +107 -107
  44. package/data/client/api.ts +85 -84
  45. package/data/client/b2b.ts +106 -106
  46. package/data/client/basket.ts +82 -82
  47. package/data/client/checkout.ts +516 -479
  48. package/data/client/misc.ts +101 -101
  49. package/data/client/product.ts +89 -89
  50. package/data/client/user.ts +99 -99
  51. package/data/client/wishlist.ts +118 -88
  52. package/data/server/category.ts +132 -128
  53. package/data/server/flatpage.ts +21 -21
  54. package/data/server/form.ts +22 -22
  55. package/data/server/index.ts +10 -10
  56. package/data/server/landingpage.ts +24 -24
  57. package/data/server/list.ts +67 -62
  58. package/data/server/menu.ts +35 -35
  59. package/data/server/product.ts +86 -86
  60. package/data/server/seo.ts +48 -48
  61. package/data/server/special-page.ts +47 -47
  62. package/data/server/widget.ts +27 -27
  63. package/data/urls.ts +221 -210
  64. package/hocs/client/index.ts +1 -1
  65. package/hocs/client/with-segment-defaults.tsx +25 -25
  66. package/hocs/server/index.ts +1 -1
  67. package/hocs/server/with-segment-defaults.tsx +85 -85
  68. package/hooks/index.ts +10 -10
  69. package/hooks/use-captcha.tsx +76 -76
  70. package/hooks/use-common-product-attributes.ts +36 -36
  71. package/hooks/use-debounce.ts +20 -20
  72. package/hooks/use-localization.ts +78 -78
  73. package/hooks/use-media-query.ts +36 -36
  74. package/hooks/use-mobile-iframe-handler.ts +23 -23
  75. package/hooks/use-on-click-outside.tsx +28 -28
  76. package/hooks/use-payment-options.ts +12 -16
  77. package/hooks/use-router.ts +45 -45
  78. package/hooks/use-translation.ts +14 -14
  79. package/lib/cache.ts +215 -215
  80. package/localization/index.ts +5 -5
  81. package/localization/provider.tsx +58 -58
  82. package/middlewares/currency.ts +100 -100
  83. package/middlewares/default.ts +256 -256
  84. package/middlewares/index.ts +29 -29
  85. package/middlewares/locale.ts +68 -68
  86. package/middlewares/oauth-login.ts +79 -79
  87. package/middlewares/pretty-url.ts +104 -104
  88. package/middlewares/redirection-payment.ts +160 -160
  89. package/middlewares/three-d-redirection.ts +159 -159
  90. package/middlewares/url-redirection.ts +65 -65
  91. package/package.json +2 -2
  92. package/plugins.js +2 -1
  93. package/redux/hooks.ts +7 -7
  94. package/redux/middlewares/checkout.ts +265 -260
  95. package/redux/middlewares/index.ts +50 -50
  96. package/redux/reducers/checkout.ts +184 -171
  97. package/redux/reducers/config.ts +28 -28
  98. package/redux/reducers/header.ts +59 -59
  99. package/redux/reducers/index.ts +14 -14
  100. package/redux/reducers/root.ts +61 -61
  101. package/sentry/index.ts +27 -27
  102. package/tailwind/rtl.js +137 -137
  103. package/types/commerce/account.ts +64 -64
  104. package/types/commerce/address.ts +94 -94
  105. package/types/commerce/b2b.ts +117 -117
  106. package/types/commerce/basket.ts +43 -43
  107. package/types/commerce/category.ts +114 -114
  108. package/types/commerce/checkout.ts +143 -136
  109. package/types/commerce/flatpage.ts +7 -7
  110. package/types/commerce/form.ts +66 -66
  111. package/types/commerce/index.ts +12 -12
  112. package/types/commerce/landingpage.ts +7 -7
  113. package/types/commerce/misc.ts +127 -127
  114. package/types/commerce/order.ts +119 -119
  115. package/types/commerce/product.ts +109 -109
  116. package/types/commerce/widget.ts +28 -28
  117. package/types/gtm.ts +16 -16
  118. package/types/index.ts +274 -237
  119. package/types/metadata.ts +7 -7
  120. package/types/next-auth.d.ts +24 -24
  121. package/utils/app-fetch.ts +69 -69
  122. package/utils/deep-merge.js +24 -24
  123. package/utils/generate-commerce-search-params.ts +22 -22
  124. package/utils/get-currency.ts +29 -29
  125. package/utils/image-loader.ts +31 -31
  126. package/utils/index.ts +150 -150
  127. package/utils/localization.ts +29 -29
  128. package/utils/log.ts +138 -138
  129. package/utils/menu-generator.ts +27 -27
  130. package/utils/mobile-3d-iframe.ts +77 -77
  131. package/utils/server-translation.ts +57 -57
  132. package/utils/server-variables.ts +9 -9
  133. package/with-pz-config.js +94 -94
@@ -1,94 +1,94 @@
1
- export enum AddressType {
2
- individual = 'false',
3
- company = 'true'
4
- }
5
-
6
- export type AddressFormType = {
7
- type: string;
8
- is_corporate: AddressType;
9
- title: string;
10
- first_name: string;
11
- last_name: string;
12
- phone_number: string;
13
- country: string;
14
- city: string;
15
- township: string;
16
- district: string;
17
- line: string;
18
- postcode: string;
19
- company_name?: string;
20
- tax_no?: number;
21
- tax_office?: string;
22
- e_bill_taxpayer?: boolean;
23
- country_code?: string;
24
- };
25
-
26
- export type Country = {
27
- code: string;
28
- is_active: boolean;
29
- name: string;
30
- pk: number;
31
- translations: string | null;
32
- };
33
-
34
- export type City = {
35
- country: Country;
36
- is_active: boolean;
37
- name: string;
38
- pk: number;
39
- postcode: number;
40
- priority: null;
41
- translations: string | null;
42
- };
43
-
44
- export type Township = {
45
- city: City;
46
- is_active: boolean;
47
- name: string;
48
- pk: number;
49
- postcode: number;
50
- };
51
-
52
- export type District = {
53
- city: number;
54
- is_active: boolean;
55
- name: string;
56
- pk: number;
57
- postcode: number;
58
- township: number;
59
- };
60
-
61
- export interface Address {
62
- address_type: string;
63
- city: City;
64
- company_name: string;
65
- country: Country;
66
- district: District;
67
- e_bill_taxpayer: boolean;
68
- email: string;
69
- extra_field: null;
70
- first_name: string;
71
- hash_data: string;
72
- identity_number: number | null;
73
- is_corporate: 'true' | 'false';
74
- last_name: string;
75
- line: string;
76
- notes: string | null;
77
- phone_number: string;
78
- pk: number;
79
- postcode: string;
80
- primary: boolean;
81
- remote_id: null;
82
- retail_store: null;
83
- tax_no: string;
84
- tax_office: string;
85
- title: string;
86
- township: Township;
87
- user: { pk: number };
88
- latitude: string;
89
- longitude: string;
90
- name: string;
91
- address: string;
92
- fax_phone_number: string;
93
- image: string;
94
- }
1
+ export enum AddressType {
2
+ individual = 'false',
3
+ company = 'true'
4
+ }
5
+
6
+ export type AddressFormType = {
7
+ type: string;
8
+ is_corporate: AddressType;
9
+ title: string;
10
+ first_name: string;
11
+ last_name: string;
12
+ phone_number: string;
13
+ country: string;
14
+ city: string;
15
+ township: string;
16
+ district: string;
17
+ line: string;
18
+ postcode: string;
19
+ company_name?: string;
20
+ tax_no?: number;
21
+ tax_office?: string;
22
+ e_bill_taxpayer?: boolean;
23
+ country_code?: string;
24
+ };
25
+
26
+ export type Country = {
27
+ code: string;
28
+ is_active: boolean;
29
+ name: string;
30
+ pk: number;
31
+ translations: string | null;
32
+ };
33
+
34
+ export type City = {
35
+ country: Country;
36
+ is_active: boolean;
37
+ name: string;
38
+ pk: number;
39
+ postcode: number;
40
+ priority: null;
41
+ translations: string | null;
42
+ };
43
+
44
+ export type Township = {
45
+ city: City;
46
+ is_active: boolean;
47
+ name: string;
48
+ pk: number;
49
+ postcode: number;
50
+ };
51
+
52
+ export type District = {
53
+ city: number;
54
+ is_active: boolean;
55
+ name: string;
56
+ pk: number;
57
+ postcode: number;
58
+ township: number;
59
+ };
60
+
61
+ export interface Address {
62
+ address_type: string;
63
+ city: City;
64
+ company_name: string;
65
+ country: Country;
66
+ district: District;
67
+ e_bill_taxpayer: boolean;
68
+ email: string;
69
+ extra_field: null;
70
+ first_name: string;
71
+ hash_data: string;
72
+ identity_number: number | null;
73
+ is_corporate: 'true' | 'false';
74
+ last_name: string;
75
+ line: string;
76
+ notes: string | null;
77
+ phone_number: string;
78
+ pk: number;
79
+ postcode: string;
80
+ primary: boolean;
81
+ remote_id: null;
82
+ retail_store: null;
83
+ tax_no: string;
84
+ tax_office: string;
85
+ title: string;
86
+ township: Township;
87
+ user: { pk: number };
88
+ latitude: string;
89
+ longitude: string;
90
+ name: string;
91
+ address: string;
92
+ fax_phone_number: string;
93
+ image: string;
94
+ }
@@ -1,117 +1,117 @@
1
- import { Product } from './product';
2
-
3
- export type Division = {
4
- id: number;
5
- name: string;
6
- division_type: string;
7
- parent: number;
8
- erp_code: string;
9
- country_id: number;
10
- city_id: number;
11
- township_id: number;
12
- district_id: number;
13
- address: string;
14
- phone_number: string;
15
- fax_number: string;
16
- is_active: true;
17
- latitude: null;
18
- longitude: null;
19
- monthly_order_limit: string;
20
- current_balance: string;
21
- current_balance_last_update: null | string;
22
- extra_data: object;
23
- };
24
-
25
- export interface ProductB2b extends Product {
26
- sku: string;
27
- name: string;
28
- price: string;
29
- base_code: string;
30
- asorti: string;
31
- category: string;
32
- currency: string;
33
- variants: {
34
- [key: string]: any;
35
- };
36
- product_image: string;
37
- }
38
-
39
- export type BasketResponse = {
40
- id: number;
41
- total_amount: string;
42
- total_quantity: number;
43
- basket_items: [
44
- {
45
- total_amount: string;
46
- price: string;
47
- quantity: number;
48
- divisions: BasketItemDivision[];
49
- product: ProductB2b;
50
- product_remote_id: number;
51
- }
52
- ];
53
- };
54
-
55
- export interface QuotationErrorType {
56
- data: {
57
- non_field_errors: string[];
58
- };
59
- }
60
-
61
- export interface BasketItemDivision {
62
- id: number;
63
- name: string;
64
- erp_code: string;
65
- quantity: number;
66
- }
67
-
68
- export type BasketItemType = {
69
- total_amount: string;
70
- price: string;
71
- quantity: number;
72
- divisions: BasketItemDivision[];
73
- product: ProductB2b;
74
- product_remote_id: number;
75
- }
76
-
77
- export type BasketParams = {
78
- division: string;
79
- product_remote_id: string;
80
- quantity: string;
81
- };
82
-
83
- export type SaveBasketParams = {
84
- name: string;
85
- };
86
-
87
- export type CreateQuotationParams = {
88
- name: string;
89
- };
90
-
91
- export type UpdateProductParams = {
92
- product_remote_id: number;
93
- division: number;
94
- quantity: number
95
- };
96
-
97
- export type DeleteProductParams = {
98
- product_remote_id: number;
99
- };
100
-
101
- export type LoadBasketParams = {
102
- id: number;
103
- };
104
-
105
- export interface GetResponse<T> {
106
- count: number;
107
- next: null;
108
- previous: null;
109
- results: T[];
110
- }
111
-
112
- export type DraftResponse = {
113
- id: number;
114
- name: string;
115
- total_amount: number;
116
- total_quantity: number;
117
- };
1
+ import { Product } from './product';
2
+
3
+ export type Division = {
4
+ id: number;
5
+ name: string;
6
+ division_type: string;
7
+ parent: number;
8
+ erp_code: string;
9
+ country_id: number;
10
+ city_id: number;
11
+ township_id: number;
12
+ district_id: number;
13
+ address: string;
14
+ phone_number: string;
15
+ fax_number: string;
16
+ is_active: true;
17
+ latitude: null;
18
+ longitude: null;
19
+ monthly_order_limit: string;
20
+ current_balance: string;
21
+ current_balance_last_update: null | string;
22
+ extra_data: object;
23
+ };
24
+
25
+ export interface ProductB2b extends Product {
26
+ sku: string;
27
+ name: string;
28
+ price: string;
29
+ base_code: string;
30
+ asorti: string;
31
+ category: string;
32
+ currency: string;
33
+ variants: {
34
+ [key: string]: any;
35
+ };
36
+ product_image: string;
37
+ }
38
+
39
+ export type BasketResponse = {
40
+ id: number;
41
+ total_amount: string;
42
+ total_quantity: number;
43
+ basket_items: [
44
+ {
45
+ total_amount: string;
46
+ price: string;
47
+ quantity: number;
48
+ divisions: BasketItemDivision[];
49
+ product: ProductB2b;
50
+ product_remote_id: number;
51
+ }
52
+ ];
53
+ };
54
+
55
+ export interface QuotationErrorType {
56
+ data: {
57
+ non_field_errors: string[];
58
+ };
59
+ }
60
+
61
+ export interface BasketItemDivision {
62
+ id: number;
63
+ name: string;
64
+ erp_code: string;
65
+ quantity: number;
66
+ }
67
+
68
+ export type BasketItemType = {
69
+ total_amount: string;
70
+ price: string;
71
+ quantity: number;
72
+ divisions: BasketItemDivision[];
73
+ product: ProductB2b;
74
+ product_remote_id: number;
75
+ }
76
+
77
+ export type BasketParams = {
78
+ division: string;
79
+ product_remote_id: string;
80
+ quantity: string;
81
+ };
82
+
83
+ export type SaveBasketParams = {
84
+ name: string;
85
+ };
86
+
87
+ export type CreateQuotationParams = {
88
+ name: string;
89
+ };
90
+
91
+ export type UpdateProductParams = {
92
+ product_remote_id: number;
93
+ division: number;
94
+ quantity: number
95
+ };
96
+
97
+ export type DeleteProductParams = {
98
+ product_remote_id: number;
99
+ };
100
+
101
+ export type LoadBasketParams = {
102
+ id: number;
103
+ };
104
+
105
+ export interface GetResponse<T> {
106
+ count: number;
107
+ next: null;
108
+ previous: null;
109
+ results: T[];
110
+ }
111
+
112
+ export type DraftResponse = {
113
+ id: number;
114
+ name: string;
115
+ total_amount: number;
116
+ total_quantity: number;
117
+ };
@@ -1,43 +1,43 @@
1
- import { Discount, UpsellDetail } from './misc';
2
- import { Product } from './product';
3
-
4
- export interface Basket {
5
- segment: { pk: number; price_list: number; stock_list: number };
6
- unavailable_basket_products: any[];
7
- upsell_details: UpsellDetail[];
8
- voucher_code: string | null;
9
- total_amount: string;
10
- total_quantity: number;
11
- basketitem_set: BasketItem[];
12
- created_date: string;
13
- discounts: Discount[];
14
- modified_date: string;
15
- pk: number;
16
- total_discount_amount: string;
17
- total_product_amount: string;
18
- upsell_messages: any[];
19
- }
20
-
21
- export interface BasketItem {
22
- attributes: object;
23
- attributes_kwargs: object;
24
- discount_amount: string;
25
- offer_badges: {
26
- description: string;
27
- discount: string;
28
- }[];
29
- parent: any | null;
30
- price: string;
31
- retail_price: string;
32
- stock: number;
33
- id: number;
34
- quantity: number;
35
- product: Product;
36
- currency_type: string;
37
- currency_type_label: string;
38
- image: string;
39
- shipping_discount: string;
40
- tax_rate: string;
41
- total_amount: string;
42
- unit_price: string;
43
- }
1
+ import { Discount, UpsellDetail } from './misc';
2
+ import { Product } from './product';
3
+
4
+ export interface Basket {
5
+ segment: { pk: number; price_list: number; stock_list: number };
6
+ unavailable_basket_products: any[];
7
+ upsell_details: UpsellDetail[];
8
+ voucher_code: string | null;
9
+ total_amount: string;
10
+ total_quantity: number;
11
+ basketitem_set: BasketItem[];
12
+ created_date: string;
13
+ discounts: Discount[];
14
+ modified_date: string;
15
+ pk: number;
16
+ total_discount_amount: string;
17
+ total_product_amount: string;
18
+ upsell_messages: any[];
19
+ }
20
+
21
+ export interface BasketItem {
22
+ attributes: object;
23
+ attributes_kwargs: object;
24
+ discount_amount: string;
25
+ offer_badges: {
26
+ description: string;
27
+ discount: string;
28
+ }[];
29
+ parent: any | null;
30
+ price: string;
31
+ retail_price: string;
32
+ stock: number;
33
+ id: number;
34
+ quantity: number;
35
+ product: Product;
36
+ currency_type: string;
37
+ currency_type_label: string;
38
+ image: string;
39
+ shipping_discount: string;
40
+ tax_rate: string;
41
+ total_amount: string;
42
+ unit_price: string;
43
+ }