@akinon/next 1.45.0-rc.0 → 1.45.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 (47) hide show
  1. package/CHANGELOG.md +4 -240
  2. package/api/client.ts +9 -33
  3. package/assets/styles/index.scss +26 -50
  4. package/components/input.tsx +7 -21
  5. package/components/link.tsx +13 -17
  6. package/components/pagination.tsx +2 -1
  7. package/components/price.tsx +4 -11
  8. package/components/selected-payment-option-view.tsx +38 -26
  9. package/data/client/account.ts +9 -10
  10. package/data/client/address.ts +8 -32
  11. package/data/client/api.ts +1 -1
  12. package/data/client/checkout.ts +4 -47
  13. package/data/server/category.ts +2 -2
  14. package/data/server/list.ts +2 -2
  15. package/data/server/product.ts +13 -15
  16. package/data/server/special-page.ts +2 -2
  17. package/data/urls.ts +1 -5
  18. package/hooks/index.ts +1 -2
  19. package/hooks/use-payment-options.ts +1 -2
  20. package/lib/cache.ts +6 -18
  21. package/middlewares/default.ts +2 -50
  22. package/middlewares/locale.ts +30 -32
  23. package/middlewares/pretty-url.ts +0 -4
  24. package/middlewares/url-redirection.ts +0 -4
  25. package/package.json +4 -5
  26. package/plugins.d.ts +0 -1
  27. package/redux/middlewares/checkout.ts +11 -70
  28. package/redux/reducers/checkout.ts +5 -24
  29. package/redux/reducers/config.ts +0 -2
  30. package/types/commerce/account.ts +0 -1
  31. package/types/commerce/address.ts +1 -1
  32. package/types/commerce/checkout.ts +0 -30
  33. package/types/commerce/misc.ts +0 -2
  34. package/types/commerce/order.ts +0 -12
  35. package/types/index.ts +2 -28
  36. package/utils/app-fetch.ts +1 -1
  37. package/utils/generate-commerce-search-params.ts +2 -6
  38. package/utils/index.ts +6 -27
  39. package/utils/menu-generator.ts +2 -2
  40. package/utils/server-translation.ts +1 -5
  41. package/with-pz-config.js +1 -11
  42. package/assets/styles/index.css +0 -49
  43. package/assets/styles/index.css.map +0 -1
  44. package/hooks/use-message-listener.ts +0 -24
  45. package/lib/cache-handler.mjs +0 -33
  46. package/routes/pretty-url.tsx +0 -194
  47. package/utils/redirection-iframe.ts +0 -85
@@ -16,10 +16,8 @@ import {
16
16
  setPreOrder,
17
17
  setRetailStores,
18
18
  setShippingOptions,
19
- setDataSourceShippingOptions,
20
19
  setShippingStepCompleted,
21
- setCreditPaymentOptions,
22
- setAttributeBasedShippingOptions
20
+ setCreditPaymentOptions
23
21
  } from '../../redux/reducers/checkout';
24
22
  import { RootState, TypedDispatch } from 'redux/store';
25
23
  import { checkoutApi } from '../../data/client/checkout';
@@ -28,11 +26,10 @@ import { getCookie, setCookie } from '../../utils';
28
26
  import settings from 'settings';
29
27
  import { LocaleUrlStrategy } from '../../localization';
30
28
  import { showMobile3dIframe } from '../../utils/mobile-3d-iframe';
31
- import { showRedirectionIframe } from '../../utils/redirection-iframe';
32
29
 
33
30
  interface CheckoutResult {
34
31
  payload: {
35
- errors?: Record<string, string[]>;
32
+ errors?: any;
36
33
  pre_order?: PreOrder;
37
34
  context_list?: CheckoutContext[];
38
35
  };
@@ -76,10 +73,8 @@ export const preOrderMiddleware: Middleware = ({
76
73
  deliveryOptions,
77
74
  addressList: addresses,
78
75
  shippingOptions,
79
- dataSourceShippingOptions,
80
76
  paymentOptions,
81
- installmentOptions,
82
- attributeBasedShippingOptions
77
+ installmentOptions
83
78
  } = getState().checkout;
84
79
  const { endpoints: apiEndpoints } = checkoutApi;
85
80
 
@@ -130,40 +125,6 @@ export const preOrderMiddleware: Middleware = ({
130
125
  dispatch(apiEndpoints.setShippingOption.initiate(shippingOptions[0].pk));
131
126
  }
132
127
 
133
- if (
134
- dataSourceShippingOptions.length > 0 &&
135
- !preOrder.data_source_shipping_options
136
- ) {
137
- const selectedDataSourceShippingOptionsPks =
138
- dataSourceShippingOptions.map(
139
- (opt) => opt.data_source_shipping_options[0].pk
140
- );
141
-
142
- dispatch(
143
- apiEndpoints.setDataSourceShippingOptions.initiate(
144
- selectedDataSourceShippingOptionsPks
145
- )
146
- );
147
- }
148
-
149
- if (
150
- Object.keys(attributeBasedShippingOptions).length > 0 &&
151
- !preOrder.attribute_based_shipping_options
152
- ) {
153
- const initialSelectedOptions: Record<string, number> = Object.fromEntries(
154
- Object.entries(attributeBasedShippingOptions).map(([key, options]) => [
155
- key,
156
- options[0].pk
157
- ])
158
- );
159
-
160
- dispatch(
161
- apiEndpoints.setAttributeBasedShippingOptions.initiate(
162
- initialSelectedOptions
163
- )
164
- );
165
- }
166
-
167
128
  if (!preOrder.payment_option && paymentOptions.length > 0) {
168
129
  dispatch(apiEndpoints.setPaymentOption.initiate(paymentOptions[0].pk));
169
130
  }
@@ -202,7 +163,6 @@ export const contextListMiddleware: Middleware = ({
202
163
  if (result?.payload?.context_list) {
203
164
  result.payload.context_list.forEach((context) => {
204
165
  const redirectUrl = context.page_context.redirect_url;
205
- const isIframe = context.page_context.is_frame ?? false;
206
166
 
207
167
  if (redirectUrl) {
208
168
  const currentLocale = getCookie('pz-locale');
@@ -221,19 +181,16 @@ export const contextListMiddleware: Middleware = ({
221
181
  }
222
182
 
223
183
  const urlObj = new URL(url, window.location.origin);
224
- const isMobileDevice =
225
- isMobileApp ||
226
- /iPad|iPhone|iPod|Android/i.test(navigator.userAgent);
227
- const isIframePaymentOptionExcluded =
228
- !settings.checkout?.iframeExcludedPaymentOptions?.includes(
229
- result.payload?.pre_order?.payment_option?.slug
230
- );
231
184
  urlObj.searchParams.set('t', new Date().getTime().toString());
232
185
 
233
- if (isMobileDevice && !isIframePaymentOptionExcluded) {
186
+ if (
187
+ (isMobileApp ||
188
+ /iPad|iPhone|iPod|Android/i.test(navigator.userAgent)) &&
189
+ !settings.checkout?.iframeExcludedPaymentOptions?.includes(
190
+ result.payload?.pre_order?.payment_option?.slug
191
+ )
192
+ ) {
234
193
  showMobile3dIframe(urlObj.toString());
235
- } else if (isIframe && !isIframePaymentOptionExcluded) {
236
- showRedirectionIframe(urlObj.toString());
237
194
  } else {
238
195
  window.location.href = urlObj.toString();
239
196
  }
@@ -263,28 +220,12 @@ export const contextListMiddleware: Middleware = ({
263
220
  dispatch(setShippingOptions(context.page_context.shipping_options));
264
221
  }
265
222
 
266
- if (context.page_context.data_sources) {
267
- dispatch(
268
- setDataSourceShippingOptions(context.page_context.data_sources)
269
- );
270
- }
271
-
272
- if (context.page_context.attribute_based_shipping_options) {
273
- dispatch(
274
- setAttributeBasedShippingOptions(
275
- context.page_context.attribute_based_shipping_options
276
- )
277
- );
278
- }
279
-
280
223
  if (context.page_context.payment_options) {
281
224
  dispatch(setPaymentOptions(context.page_context.payment_options));
282
225
  }
283
226
 
284
227
  if (context.page_context.credit_payment_options) {
285
- dispatch(
286
- setCreditPaymentOptions(context.page_context.credit_payment_options)
287
- );
228
+ dispatch(setCreditPaymentOptions(context.page_context.credit_payment_options));
288
229
  }
289
230
 
290
231
  if (context.page_context.payment_choices) {
@@ -14,13 +14,12 @@ import {
14
14
  CheckoutCreditPaymentOption,
15
15
  PreOrder,
16
16
  RetailStore,
17
- ShippingOption,
18
- DataSource,
19
- AttributeBasedShippingOption
17
+ ShippingOption
20
18
  } from '../../types';
21
19
 
22
20
  export interface CheckoutState {
23
- errors: Record<string, string[]>;
21
+ // TODO: Add types
22
+ errors: any;
24
23
  hasGiftBox: boolean;
25
24
  canGuestPurchase: boolean;
26
25
  steps: {
@@ -38,7 +37,6 @@ export interface CheckoutState {
38
37
  addressList: Address[];
39
38
  deliveryOptions: DeliveryOption[];
40
39
  shippingOptions: ShippingOption[];
41
- dataSourceShippingOptions: DataSource[];
42
40
  paymentOptions: PaymentOption[];
43
41
  creditPaymentOptions: CheckoutCreditPaymentOption[];
44
42
  selectedCreditPaymentPk: number;
@@ -49,8 +47,6 @@ export interface CheckoutState {
49
47
  selectedBankAccountPk: number;
50
48
  loyaltyBalance?: string;
51
49
  retailStores: RetailStore[];
52
- attributeBasedShippingOptions: AttributeBasedShippingOption[];
53
- selectedShippingOptions: Record<string, number>;
54
50
  }
55
51
 
56
52
  const initialState: CheckoutState = {
@@ -72,7 +68,6 @@ const initialState: CheckoutState = {
72
68
  addressList: [],
73
69
  deliveryOptions: [],
74
70
  shippingOptions: [],
75
- dataSourceShippingOptions: [],
76
71
  paymentOptions: [],
77
72
  creditPaymentOptions: [],
78
73
  selectedCreditPaymentPk: null,
@@ -81,9 +76,7 @@ const initialState: CheckoutState = {
81
76
  installmentOptions: [],
82
77
  bankAccounts: [],
83
78
  selectedBankAccountPk: null,
84
- retailStores: [],
85
- attributeBasedShippingOptions: [],
86
- selectedShippingOptions: {}
79
+ retailStores: []
87
80
  };
88
81
 
89
82
  const checkoutSlice = createSlice({
@@ -129,9 +122,6 @@ const checkoutSlice = createSlice({
129
122
  setShippingOptions(state, { payload }) {
130
123
  state.shippingOptions = payload;
131
124
  },
132
- setDataSourceShippingOptions(state, { payload }) {
133
- state.dataSourceShippingOptions = payload;
134
- },
135
125
  setPaymentOptions(state, { payload }) {
136
126
  state.paymentOptions = payload;
137
127
  },
@@ -161,12 +151,6 @@ const checkoutSlice = createSlice({
161
151
  },
162
152
  setRetailStores(state, { payload }) {
163
153
  state.retailStores = payload;
164
- },
165
- setAttributeBasedShippingOptions(state, { payload }) {
166
- state.attributeBasedShippingOptions = payload;
167
- },
168
- setSelectedShippingOptions: (state, { payload }) => {
169
- state.selectedShippingOptions = payload;
170
154
  }
171
155
  }
172
156
  });
@@ -185,7 +169,6 @@ export const {
185
169
  setAddressList,
186
170
  setDeliveryOptions,
187
171
  setShippingOptions,
188
- setDataSourceShippingOptions,
189
172
  setPaymentOptions,
190
173
  setCreditPaymentOptions,
191
174
  setSelectedCreditPaymentPk,
@@ -195,9 +178,7 @@ export const {
195
178
  setBankAccounts,
196
179
  setSelectedBankAccountPk,
197
180
  setLoyaltyBalance,
198
- setRetailStores,
199
- setAttributeBasedShippingOptions,
200
- setSelectedShippingOptions
181
+ setRetailStores
201
182
  } = checkoutSlice.actions;
202
183
 
203
184
  export default checkoutSlice.reducer;
@@ -6,8 +6,6 @@ import { Config } from '../../types';
6
6
  const initialState: Config = {
7
7
  user_phone_regex: '^(05)\\d{9}$',
8
8
  user_phone_format: '05999999999',
9
- user_post_code_regex: '^\\d{5}$',
10
- user_post_code_format: '99999',
11
9
  country: {
12
10
  pk: 1,
13
11
  name: 'Türkiye',
@@ -61,5 +61,4 @@ export type ContactFormType = {
61
61
  order?: string;
62
62
  country_code?: string;
63
63
  order_needed?: boolean;
64
- file?: FileList
65
64
  };
@@ -17,7 +17,7 @@ export type AddressFormType = {
17
17
  line: string;
18
18
  postcode: string;
19
19
  company_name?: string;
20
- tax_no?: string;
20
+ tax_no?: number;
21
21
  tax_office?: string;
22
22
  e_bill_taxpayer?: boolean;
23
23
  country_code?: string;
@@ -33,23 +33,6 @@ export interface ShippingOption {
33
33
  slug: string;
34
34
  }
35
35
 
36
- export interface DataSource {
37
- pk: number;
38
- name: string;
39
- data_source_shipping_options: DataSourceShippingOption[];
40
- }
41
-
42
- export interface DataSourceShippingOption {
43
- pk: number;
44
- shipping_amount: string;
45
- shipping_option_name: string;
46
- shipping_option_logo: string | null;
47
- data_source: {
48
- pk: number;
49
- title: string | null;
50
- };
51
- }
52
-
53
36
  export interface CheckoutAddressType {
54
37
  label: string;
55
38
  text: string;
@@ -95,8 +78,6 @@ export interface PreOrder {
95
78
  retail_store?: RetailStore;
96
79
  gift_box?: GiftBox;
97
80
  credit_payment_option?: CheckoutCreditPaymentOption;
98
- data_source_shipping_options: any;
99
- attribute_based_shipping_options?: AttributeBasedShippingOption[];
100
81
  }
101
82
 
102
83
  export interface GuestLoginFormParams {
@@ -136,7 +117,6 @@ export interface CheckoutContext {
136
117
  redirect_url?: string;
137
118
  context_data?: any;
138
119
  balance?: string;
139
- attribute_based_shipping_options?: AttributeBasedShippingOption[];
140
120
  [key: string]: any;
141
121
  };
142
122
  }
@@ -162,13 +142,3 @@ export interface BankAccount {
162
142
  pk: number;
163
143
  sort_order: number;
164
144
  }
165
-
166
- export interface AttributeBasedShippingOption {
167
- pk: number;
168
- shipping_amount: string | null;
169
- shipping_option_name: string | null;
170
- shipping_option_logo: string | null;
171
- attribute_value: string | null;
172
- attribute_key: string;
173
- [key: string]: any;
174
- }
@@ -2,8 +2,6 @@ import { District } from './address';
2
2
  export interface Config {
3
3
  user_phone_regex: string;
4
4
  user_phone_format: string;
5
- user_post_code_regex: string;
6
- user_post_code_format: string;
7
5
  country: {
8
6
  pk: number;
9
7
  name: string;
@@ -52,10 +52,6 @@ export interface OrderItem {
52
52
  quantity: string;
53
53
  unit_price: string;
54
54
  total_amount: string;
55
- attributes: {
56
- gift_note: string;
57
- [key: string]: any;
58
- };
59
55
  }
60
56
 
61
57
  export interface Order {
@@ -109,14 +105,6 @@ export interface Order {
109
105
  shipping_option: number;
110
106
  tracking_number: string;
111
107
  tracking_url: string;
112
- [key: string]: any;
113
- bank: {
114
- pk: number;
115
- name: string;
116
- slug: string;
117
- logo: string;
118
- [key: string]: any;
119
- };
120
108
  }
121
109
 
122
110
  export interface Quotations {
package/types/index.ts CHANGED
@@ -2,7 +2,7 @@ import { LocaleUrlStrategy } from '../localization';
2
2
  import { PzNextRequest } from '../middlewares';
3
3
  import { Control, FieldError } from 'react-hook-form';
4
4
  import { ReactNode } from 'react';
5
- import { UsePaginationType } from '../hooks/use-pagination';
5
+
6
6
  declare global {
7
7
  interface Window {
8
8
  // we did it like this because declare types needs to be identical, if not it will fail
@@ -68,17 +68,9 @@ export interface Currency {
68
68
  * @see https://en.wikipedia.org/wiki/ISO_4217
69
69
  */
70
70
  code: string;
71
- /**
72
- * Number of decimal places to display.
73
- *
74
- * @example
75
- * decimalScale: 3
76
- */
77
- decimalScale?: number;
78
71
  }
79
72
 
80
73
  export interface Settings {
81
- usePrettyUrlRoute?: boolean;
82
74
  commerceUrl: string;
83
75
  redis: {
84
76
  defaultExpirationTime: number;
@@ -224,7 +216,7 @@ export type Translations = { [key: string]: object };
224
216
 
225
217
  export interface PageProps<T = any> {
226
218
  params: T;
227
- searchParams: { [key: string]: string | string[] | undefined };
219
+ searchParams: URLSearchParams;
228
220
  }
229
221
 
230
222
  export interface LayoutProps<T = any> extends PageProps<T> {
@@ -291,21 +283,3 @@ export interface AccordionProps {
291
283
  export interface PluginModuleComponentProps {
292
284
  settings?: Record<string, any>;
293
285
  }
294
-
295
- export interface PaginationProps {
296
- total: number | undefined;
297
- limit?: number | undefined;
298
- currentPage: number | undefined;
299
- numberOfPages?: number | undefined;
300
- containerClassName?: string;
301
- moreButtonClassName?: string;
302
- prevClassName?: string;
303
- nextClassName?: string;
304
- pageClassName?: string;
305
- threshold?: number | undefined;
306
- delta?: number | undefined;
307
- render?: (pagination: UsePaginationType) => ReactNode;
308
- type?: 'infinite' | 'list' | 'more';
309
- onPageChange?: (page: number) => void;
310
- direction?: 'next' | 'prev';
311
- }
@@ -41,7 +41,7 @@ const appFetch = async <T>(
41
41
  };
42
42
 
43
43
  init.next = {
44
- revalidate: Settings.usePrettyUrlRoute ? 0 : 60
44
+ revalidate: 60
45
45
  };
46
46
 
47
47
  logger.debug(`FETCH START ${url}`, { requestURL, init, ip });
@@ -1,15 +1,11 @@
1
1
  import logger from './log';
2
2
 
3
- export const generateCommerceSearchParams = (searchParams?: {
4
- [key: string]: string | string[] | undefined;
5
- }) => {
3
+ export const generateCommerceSearchParams = (searchParams?: URLSearchParams) => {
6
4
  if (!searchParams) {
7
5
  return null;
8
6
  }
9
7
 
10
- const urlSerchParams = new URLSearchParams(
11
- searchParams as Record<string, string>
12
- );
8
+ const urlSerchParams = new URLSearchParams(searchParams);
13
9
 
14
10
  Object.entries(searchParams).forEach(([key, value]) => {
15
11
  if (typeof value === 'object') {
package/utils/index.ts CHANGED
@@ -63,33 +63,18 @@ export function getTranslateFn(path: string, translations: any) {
63
63
 
64
64
  export function buildClientRequestUrl(
65
65
  path: string,
66
- options?: ClientRequestOptions & { cache?: boolean }
66
+ options?: ClientRequestOptions
67
67
  ) {
68
68
  let url = `/api/client${path}`;
69
69
 
70
- let hasQuery = url.includes('?');
71
-
72
70
  if (options) {
73
- const { cache, ...otherOptions } = options;
74
-
75
- if (Object.keys(otherOptions).length > 0) {
76
- if (hasQuery) {
77
- url += '&';
78
- } else {
79
- url += '?';
80
- hasQuery = true;
81
- }
82
- url += `options=${encodeURIComponent(JSON.stringify(otherOptions))}`;
71
+ if (url.includes('?')) {
72
+ url += '&';
73
+ } else {
74
+ url += '?';
83
75
  }
84
76
 
85
- if (cache === false) {
86
- if (hasQuery) {
87
- url += '&';
88
- } else {
89
- url += '?';
90
- }
91
- url += `t=${Date.now()}`;
92
- }
77
+ url += `options=${encodeURIComponent(JSON.stringify(options))}`;
93
78
  }
94
79
 
95
80
  return url;
@@ -117,12 +102,6 @@ export function buildCDNUrl(url: string, config?: CDNOptions) {
117
102
  ''
118
103
  );
119
104
 
120
- const noOptionFileExtension = url?.split('.').pop()?.toLowerCase() ?? '';
121
-
122
- if (noOptionFileExtension === 'svg' || noOptionFileExtension === 'gif') {
123
- return url;
124
- }
125
-
126
105
  let options = '';
127
106
 
128
107
  if (config) {
@@ -13,8 +13,8 @@ export const menuGenerator = (arr: MenuItemType[]) => {
13
13
  });
14
14
 
15
15
  Object.values(data).forEach((item) => {
16
- if (item.parent_pk) {
17
- data[item.parent_pk].children.push(item);
16
+ if (item.parent) {
17
+ data[item.parent.pk].children.push(item);
18
18
  } else {
19
19
  tree.push(item);
20
20
  }
@@ -5,10 +5,10 @@ import { getTranslateFn } from '../utils';
5
5
  import { Translations } from '../types';
6
6
  import settings from 'settings';
7
7
  import logger from './log';
8
- import { unstable_cache } from 'next/cache';
9
8
 
10
9
  export const translations: Translations = {};
11
10
 
11
+ // TODO: Read translations from cache
12
12
  export async function getTranslations(locale_: string) {
13
13
  try {
14
14
  const locale = settings.localization.locales.find(
@@ -52,10 +52,6 @@ export async function getTranslations(locale_: string) {
52
52
  return translations;
53
53
  }
54
54
 
55
- export const getCachedTranslations = unstable_cache(async (locale: string) =>
56
- getTranslations(locale)
57
- );
58
-
59
55
  export function t(path: string) {
60
56
  return getTranslateFn(path, translations);
61
57
  }
package/with-pz-config.js CHANGED
@@ -8,7 +8,6 @@ const defaultConfig = {
8
8
  transpilePackages: ['@akinon/next', ...pzPlugins.map((p) => `@akinon/${p}`)],
9
9
  skipTrailingSlashRedirect: true,
10
10
  poweredByHeader: false,
11
- cacheMaxMemorySize: 0,
12
11
  env: {
13
12
  NEXT_PUBLIC_SENTRY_DSN: process.env.SENTRY_DSN
14
13
  },
@@ -66,12 +65,7 @@ const defaultConfig = {
66
65
  }
67
66
  };
68
67
 
69
- const withPzConfig = (
70
- myNextConfig = {},
71
- options = {
72
- useCacheHandler: false
73
- }
74
- ) => {
68
+ const withPzConfig = (myNextConfig = {}) => {
75
69
  let extendedConfig = deepMerge({}, defaultConfig, myNextConfig);
76
70
 
77
71
  const originalPzHeadersFunction = defaultConfig.headers;
@@ -97,10 +91,6 @@ const withPzConfig = (
97
91
  return [...pzRewrites, ...myRewrites];
98
92
  };
99
93
 
100
- if (options.useCacheHandler && process.env.CACHE_HOST) {
101
- extendedConfig.cacheHandler = require.resolve('./lib/cache-handler.mjs');
102
- }
103
-
104
94
  return extendedConfig;
105
95
  };
106
96
 
@@ -1,49 +0,0 @@
1
- .checkout-payment-iframe-wrapper {
2
- position: fixed;
3
- top: 0;
4
- left: 0;
5
- width: 100%;
6
- height: 100%;
7
- border: none;
8
- z-index: 1000;
9
- background-color: white;
10
- }
11
- .checkout-payment-iframe-wrapper iframe {
12
- width: 100%;
13
- height: 100%;
14
- border: none;
15
- background-color: white;
16
- }
17
- .checkout-payment-iframe-wrapper .close-button {
18
- position: fixed;
19
- top: 16px;
20
- right: 16px;
21
- width: 32px;
22
- height: 32px;
23
- display: flex;
24
- align-items: center;
25
- justify-content: center;
26
- z-index: 1001;
27
- }
28
-
29
- .checkout-payment-redirection-iframe-wrapper {
30
- width: 100%;
31
- position: relative;
32
- }
33
- .checkout-payment-redirection-iframe-wrapper iframe {
34
- width: 100%;
35
- height: 100%;
36
- border: none;
37
- background-color: white;
38
- }
39
- .checkout-payment-redirection-iframe-wrapper .close-button {
40
- position: absolute;
41
- top: 16px;
42
- right: 16px;
43
- width: 32px;
44
- height: 32px;
45
- display: flex;
46
- align-items: center;
47
- justify-content: center;
48
- z-index: 1001;
49
- }/*# sourceMappingURL=index.css.map */
@@ -1 +0,0 @@
1
- {"version":3,"sources":["index.scss","index.css"],"names":[],"mappings":"AAAA;EACE,eAAA;EACA,MAAA;EACA,OAAA;EACA,WAAA;EACA,YAAA;EACA,YAAA;EACA,aAAA;EACA,uBAAA;ACCF;ADCE;EACE,WAAA;EACA,YAAA;EACA,YAAA;EACA,uBAAA;ACCJ;ADEE;EACE,eAAA;EACA,SAAA;EACA,WAAA;EACA,WAAA;EACA,YAAA;EACA,aAAA;EACA,mBAAA;EACA,uBAAA;EACA,aAAA;ACAJ;;ADIA;EACE,WAAA;EACA,kBAAA;ACDF;ADGE;EACE,WAAA;EACA,YAAA;EACA,YAAA;EACA,uBAAA;ACDJ;ADIE;EACE,kBAAA;EACA,SAAA;EACA,WAAA;EACA,WAAA;EACA,YAAA;EACA,aAAA;EACA,mBAAA;EACA,uBAAA;EACA,aAAA;ACFJ","file":"index.css"}
@@ -1,24 +0,0 @@
1
- import { useEffect } from 'react';
2
-
3
- export const useMessageListener = () => {
4
- useEffect(() => {
5
- const handleMessage = (event: MessageEvent) => {
6
- if (event.origin !== window.location.origin) {
7
- return;
8
- }
9
-
10
- if (event.data && typeof event.data === 'string') {
11
- const messageData = JSON.parse(event.data);
12
- if (messageData?.url) {
13
- window.location.href = messageData.url;
14
- }
15
- }
16
- };
17
-
18
- window.addEventListener('message', handleMessage);
19
-
20
- return () => {
21
- window.removeEventListener('message', handleMessage);
22
- };
23
- }, []);
24
- };
@@ -1,33 +0,0 @@
1
- import { CacheHandler } from '@neshca/cache-handler';
2
- import createLruHandler from '@neshca/cache-handler/local-lru';
3
- import createRedisHandler from '@neshca/cache-handler/redis-stack';
4
- import { createClient } from 'redis';
5
-
6
- CacheHandler.onCreation(async () => {
7
- const redisUrl = `redis://${process.env.CACHE_HOST}:${
8
- process.env.CACHE_PORT
9
- }/${process.env.CACHE_BUCKET ?? '0'}`;
10
-
11
- const client = createClient({
12
- url: redisUrl
13
- });
14
-
15
- client.on('error', (error) => {
16
- console.error('Redis client error', { redisUrl, error });
17
- });
18
-
19
- await client.connect();
20
-
21
- const redisHandler = await createRedisHandler({
22
- client,
23
- timeoutMs: 5000
24
- });
25
-
26
- const localHandler = createLruHandler();
27
-
28
- return {
29
- handlers: [redisHandler, localHandler]
30
- };
31
- });
32
-
33
- export default CacheHandler;