@lookiero/checkout 12.16.0 → 12.17.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.
@@ -1,3 +1,9 @@
1
1
  Cypress.Commands.add("getByTestId", (selector, ...args) => cy.get(`[data-testid=${selector}]`, ...args));
2
2
 
3
3
  Cypress.Commands.add("shouldIncludePathInUrl", (path) => cy.url().should("include", path));
4
+
5
+ beforeEach(() => {
6
+ cy.intercept("GET", "/local-to-external-i18n/**", { fixture: "es-external-translations.json" }).as(
7
+ "external-translations",
8
+ );
9
+ });
package/cypress.config.ts CHANGED
@@ -1,8 +1,5 @@
1
1
  import { defineConfig } from "cypress";
2
2
 
3
- const webpack = require("webpack");
4
- const expoWebpackConfig = require("./webpack.config");
5
-
6
3
  export default defineConfig({
7
4
  projectId: "checkout",
8
5
  fixturesFolder: "cypress/fixtures",
@@ -13,30 +10,6 @@ export default defineConfig({
13
10
  defaultCommandTimeout: 10000,
14
11
 
15
12
  e2e: {
16
- async setupNodeEvents(on, config) {
17
- const webpackPreprocessor = require("@cypress/webpack-preprocessor");
18
- const webpackOptions = await expoWebpackConfig(
19
- {
20
- pwa: false,
21
- logger: {},
22
- mode: "development",
23
- https: false,
24
- },
25
- {},
26
- );
27
-
28
- on(
29
- "file:preprocessor",
30
- webpackPreprocessor({
31
- webpackOptions: {
32
- ...webpackOptions,
33
- plugins: [new webpack.DefinePlugin({ process: { env: {} } })],
34
- },
35
- }),
36
- );
37
-
38
- return config;
39
- },
40
13
  baseUrl: "http://localhost:19004/",
41
14
  specPattern: "cypress/integration/**/*.{js,jsx,ts,tsx}",
42
15
  },
@@ -44,7 +17,7 @@ export default defineConfig({
44
17
  component: {
45
18
  devServer: {
46
19
  framework: "react",
47
- bundler: "webpack",
20
+ bundler: "vite",
48
21
  },
49
22
  },
50
23
  });
@@ -1 +1,2 @@
1
+ import "@expo/metro-runtime";
1
2
  import "react-native-get-random-values";
package/dist/src/Expo.js CHANGED
@@ -1,3 +1,4 @@
1
+ import "@expo/metro-runtime";
1
2
  import { registerRootComponent } from "expo";
2
3
  import { enableLegacyWebImplementation } from "react-native-gesture-handler";
3
4
  import "react-native-get-random-values";
@@ -43,14 +43,18 @@ const sentryConfig = {
43
43
  const apiUrl = Platform.OS !== "web"
44
44
  ? "https://web2.sp.dev.aws.lookiero.es/checkout/api"
45
45
  : __DEV__
46
- ? "/local-to-dev"
46
+ ? process.env.EXPO_PUBLIC_CI
47
+ ? "/local-to-dev"
48
+ : "http://localhost:3004/local-to-dev"
47
49
  : "/checkout/api";
48
50
  const authToken = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjU2NTIwMjgsImV4cCI6MTc1NzMxOTgyNSwiZGlzcGxheU5hbWUiOiJUZXN0aW5nIiwiY291bnRyeV9jb2RlIjoiRVMiLCJhY2Nlc3NWaWEiOiJlbWFpbCIsInN1YnNjcmlwdGlvblN0YXJ0aW5nRGF0ZSI6IjIwMjQtMTEtMTgiLCJpbXBlcnNvbmF0ZWQiOmZhbHNlLCJ1dWlkIjoiOTQxM2ZlM2EtMDlmYy00MjY0LTkwNWUtMDQwYmI3YjRjYTc1IiwidHJhZGVuYW1lIjoiTE9PS0lFUk8iLCJpYXQiOjE3NTQ2NDE0MjV9.n9OBM8mV1HoEzwg1v60XSjcgFythcrBRty1mcpE7KDM";
49
51
  const getAuthToken = () => Promise.resolve(authToken);
50
52
  const externalTranslationsUrl = Platform.OS !== "web"
51
53
  ? "https://backend-for-user.dev.envs.lookiero.tech/api/v2/translations"
52
54
  : __DEV__
53
- ? "/local-to-external-i18n"
55
+ ? process.env.EXPO_PUBLIC_CI
56
+ ? "/local-to-external-i18n"
57
+ : "http://localhost:3004/local-to-external-i18n"
54
58
  : "/external-i18n";
55
59
  const translationProjectsByTradename = {
56
60
  [Tradename.LOOKIERO]: [["checkout"], ["inventory-catalog"]],
@@ -1 +1 @@
1
- export declare const VERSION = "12.16.0";
1
+ export declare const VERSION = "12.17.0";
@@ -1 +1 @@
1
- export const VERSION = "12.16.0";
1
+ export const VERSION = "12.17.0";
package/metro.config.js CHANGED
@@ -2,6 +2,10 @@
2
2
  const { getDefaultConfig } = require("expo/metro-config");
3
3
  const path = require('path');
4
4
 
5
+ const {
6
+ withSentryConfig
7
+ } = require("@sentry/react-native/metro");
8
+
5
9
  // Find the project and workspace directories
6
10
  const projectRoot = __dirname;
7
11
  // This can be replaced with `find-yarn-workspace-root`
@@ -19,4 +23,4 @@ config.resolver.nodeModulesPaths = [
19
23
 
20
24
  config.resolver.disableHierarchicalLookup = true;
21
25
 
22
- module.exports = config;
26
+ module.exports = withSentryConfig(config);
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "12.16.0",
3
+ "version": "12.17.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": "false",
7
7
  "scripts": {
8
- "dev": "sty-psp dev",
8
+ "dev": "sty-psp dev --server proxy-server.js",
9
9
  "build": "sty-psp build",
10
10
  "serve": "sty-psp serve",
11
11
  "format": "prettier --write .",
12
12
  "lint": "eslint --fix .",
13
13
  "test": "jest",
14
- "cypress": "METRO_PORT=8084 WEB_PORT=19004 start-server-and-test dev 19004 'cypress run'",
15
- "cypress:open": "METRO_PORT=8084 WEB_PORT=19004 start-server-and-test dev 19004 'cypress open'",
14
+ "cypress": "start-server-and-test 'sty-psp dev --port 19004' 19004 'cypress run'",
15
+ "cypress:open": "start-server-and-test 'sty-psp dev --port 19004' 19004 'cypress open'",
16
16
  "eas-build-pre-install": "./eas-hooks/eas-build-pre-install.sh",
17
17
  "eas-build-post-install": "sty-psp generate-version",
18
18
  "eas-build-on-success": "./eas-hooks/eas-build-on-success.sh",
@@ -22,28 +22,28 @@
22
22
  "@lookiero/messaging": "^8.1.1",
23
23
  "@lookiero/messaging-react": "^8.1.1",
24
24
  "@lookiero/sty-psp-ab-testing": "^0.3",
25
- "@lookiero/sty-psp-expo-config": "^1.0",
26
- "@lookiero/sty-psp-http": "^2.0",
25
+ "@lookiero/sty-psp-expo-config": "^1.1",
26
+ "@lookiero/sty-psp-http": "^2.1",
27
27
  "@lookiero/sty-psp-i18n": "^1.3",
28
28
  "@lookiero/sty-psp-locale": "^1.0",
29
- "@lookiero/sty-psp-logging": "^1.0",
30
- "@lookiero/sty-psp-notifications": "^2.7",
29
+ "@lookiero/sty-psp-logging": "^1.1",
30
+ "@lookiero/sty-psp-notifications": "^2.8",
31
31
  "@lookiero/sty-psp-react-native": "^1.0",
32
32
  "@lookiero/sty-psp-segment": "^0.1",
33
33
  "@lookiero/sty-psp-storage": "^0.2",
34
34
  "@lookiero/sty-psp-tracking": "^2.1",
35
- "@lookiero/sty-psp-ui-settings": "^1.0",
35
+ "@lookiero/sty-psp-ui-settings": "^1.1",
36
36
  "@lookiero/sty-psp-ui": "^2.6",
37
37
  "@lookiero/sty-psp-units": "^0.1",
38
38
  "@lookiero/sty-psp-uuid": "^0.2",
39
39
  "@lookiero/sty-sp-tradename": "^1.0",
40
+ "@sentry/react-native": "^6.20.0",
40
41
  "react-native-keyboard-aware-scroll-view": "^0.9.5",
41
42
  "react-native-svg": "15.8.0",
42
43
  "tiny-invariant": "^1.3.1"
43
44
  },
44
45
  "devDependencies": {
45
46
  "@config-plugins/detox": "^6.0.0",
46
- "@cypress/webpack-preprocessor": "^6.0.2",
47
47
  "@lookiero/eslint-config-sty-psp": "*",
48
48
  "@lookiero/event": "^0.3",
49
49
  "@lookiero/payments-front": "^7.0.0",
@@ -60,17 +60,14 @@
60
60
  "buffer": "5.6.0",
61
61
  "cypress": "^13.14.2",
62
62
  "detox": "^20.11.0",
63
- "expo-crypto": "~14.0.2",
63
+ "http-proxy-middleware": "^2.0.9",
64
64
  "jest-mock-extended": ">=3",
65
65
  "jest-when": ">=3",
66
66
  "metro": "^0.81.0",
67
67
  "react-native-gesture-handler": "~2.20.2",
68
68
  "react-native-get-random-values": "~1.11.0",
69
69
  "react-native-reanimated": "~3.16.1",
70
- "react-native-safe-area-context": "4.12.0",
71
- "webpack-bundle-analyzer": "^4.10.2",
72
- "webpack": "^5",
73
- "webpack-dev-server": "^4"
70
+ "react-native-safe-area-context": "4.12.0"
74
71
  },
75
72
  "peerDependencies": {
76
73
  "@gorhom/portal": ">=1.0",
@@ -0,0 +1,47 @@
1
+ const express = require('express');
2
+ const { createProxyMiddleware } = require('http-proxy-middleware');
3
+ const cors = require('cors');
4
+ const app = express();
5
+
6
+ app.use(cors());
7
+
8
+ const DEV_UAF_SP = "https://web2.sp.dev.aws.lookiero.es";
9
+ const DEV_BFU = "https://backend-for-user.dev.envs.lookiero.tech";
10
+ const PROD_UAF_PROXY = "https://lookiero.es";
11
+
12
+ app.use('/local-to-dev', createProxyMiddleware({
13
+ target: DEV_UAF_SP,
14
+ pathRewrite: { '^/local-to-dev': '/checkout/api' },
15
+ changeOrigin: true,
16
+ logLevel: 'debug',
17
+ }));
18
+
19
+ app.use('/local-to-prod', createProxyMiddleware({
20
+ target: PROD_UAF_PROXY,
21
+ pathRewrite: { '^/local-to-prod': '/checkout/api' },
22
+ changeOrigin: true,
23
+ logLevel: 'debug',
24
+ }));
25
+
26
+ app.use('/local-to-external-i18n', createProxyMiddleware({
27
+ target: DEV_BFU,
28
+ pathRewrite: { "^/local-to-external-i18n": "/api/v2/translations" },
29
+ changeOrigin: true,
30
+ logLevel: "debug",
31
+ }));
32
+
33
+ // Payments
34
+ app.use('/web', createProxyMiddleware({
35
+ target: DEV_UAF_SP,
36
+ changeOrigin: true,
37
+ }));
38
+
39
+ app.use('/graphql', createProxyMiddleware({
40
+ target: DEV_BFU,
41
+ changeOrigin: true,
42
+ }));
43
+
44
+ app.listen(3004, () => {
45
+ console.log('Proxy server running on http://localhost:3004');
46
+ });
47
+
package/src/Expo.tsx CHANGED
@@ -1,3 +1,4 @@
1
+ import "@expo/metro-runtime";
1
2
  import { registerRootComponent } from "expo";
2
3
  import { enableLegacyWebImplementation } from "react-native-gesture-handler";
3
4
  import "react-native-get-random-values";
package/src/ExpoRoot.tsx CHANGED
@@ -55,7 +55,9 @@ const apiUrl =
55
55
  Platform.OS !== "web"
56
56
  ? "https://web2.sp.dev.aws.lookiero.es/checkout/api"
57
57
  : __DEV__
58
- ? "/local-to-dev"
58
+ ? process.env.EXPO_PUBLIC_CI
59
+ ? "/local-to-dev"
60
+ : "http://localhost:3004/local-to-dev"
59
61
  : "/checkout/api";
60
62
  const authToken =
61
63
  "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjU2NTIwMjgsImV4cCI6MTc1NzMxOTgyNSwiZGlzcGxheU5hbWUiOiJUZXN0aW5nIiwiY291bnRyeV9jb2RlIjoiRVMiLCJhY2Nlc3NWaWEiOiJlbWFpbCIsInN1YnNjcmlwdGlvblN0YXJ0aW5nRGF0ZSI6IjIwMjQtMTEtMTgiLCJpbXBlcnNvbmF0ZWQiOmZhbHNlLCJ1dWlkIjoiOTQxM2ZlM2EtMDlmYy00MjY0LTkwNWUtMDQwYmI3YjRjYTc1IiwidHJhZGVuYW1lIjoiTE9PS0lFUk8iLCJpYXQiOjE3NTQ2NDE0MjV9.n9OBM8mV1HoEzwg1v60XSjcgFythcrBRty1mcpE7KDM";
@@ -65,7 +67,9 @@ const externalTranslationsUrl =
65
67
  Platform.OS !== "web"
66
68
  ? "https://backend-for-user.dev.envs.lookiero.tech/api/v2/translations"
67
69
  : __DEV__
68
- ? "/local-to-external-i18n"
70
+ ? process.env.EXPO_PUBLIC_CI
71
+ ? "/local-to-external-i18n"
72
+ : "http://localhost:3004/local-to-external-i18n"
69
73
  : "/external-i18n";
70
74
  const translationProjectsByTradename: Record<Tradename, [project: Project, filter?: string][]> = {
71
75
  [Tradename.LOOKIERO]: [["checkout"], ["inventory-catalog"]],
package/webpack.config.js DELETED
@@ -1,87 +0,0 @@
1
- const webpack = require("webpack");
2
- const createExpoWebpackConfigAsync = require("@expo/webpack-config");
3
- // const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
4
-
5
- const DEV_UAF_SP = "https://web2.sp.dev.aws.lookiero.es";
6
- const DEV_BFU = "https://backend-for-user.dev.envs.lookiero.tech";
7
- const PROD_UAF_PROXY = "https://lookiero.es";
8
-
9
- module.exports = async function (env, argv) {
10
- const config = await createExpoWebpackConfigAsync(
11
- {
12
- ...env,
13
- babel: {
14
- // dangerouslyAddModulePathsToTranspile: ["@sentry/react-native"],
15
- },
16
- },
17
- argv,
18
- );
19
-
20
- if (config.devServer) {
21
- config.devServer.proxy = {
22
- "/local-to-dev": {
23
- target: `${DEV_UAF_SP}/checkout/api`,
24
- pathRewrite: { ["^/local-to-dev"]: "" },
25
- secure: false,
26
- changeOrigin: true,
27
- logLevel: "debug",
28
- },
29
- "/local-to-prod": {
30
- target: `${PROD_UAF_PROXY}/checkout/api`,
31
- pathRewrite: { ["^/local-to-prod"]: "" },
32
- secure: false,
33
- changeOrigin: true,
34
- logLevel: "debug",
35
- },
36
- "/local-to-external-i18n": {
37
- target: `${DEV_BFU}/api/v2/translations`,
38
- pathRewrite: { ["^/local-to-external-i18n"]: "" },
39
- secure: false,
40
- changeOrigin: true,
41
- logLevel: "debug",
42
- },
43
- // Payments
44
- "/web": {
45
- target: DEV_UAF_SP,
46
- secure: false,
47
- changeOrigin: true,
48
- },
49
- // Web/Payments graphql
50
- "/graphql": {
51
- target: DEV_BFU,
52
- secure: false,
53
- changeOrigin: true,
54
- },
55
- };
56
- }
57
-
58
- // Add in missing process.env.EXPO_PUBLIC_<...> variables to the DefinePlugin
59
- const expoPublicEnvVars = Object.fromEntries(
60
- Object.entries(process.env)
61
- .filter(([key]) => key.startsWith("EXPO_PUBLIC_"))
62
- .map(([key, value]) => [key, JSON.stringify(value)]),
63
- );
64
-
65
- /**
66
- * This is required in order to resolve an Aurora introduced issue.
67
- * Without this config, expo won't start.
68
- */
69
- config.plugins = [
70
- ...(config.plugins || []),
71
- new webpack.DefinePlugin({ process: { env: expoPublicEnvVars } }),
72
- // new BundleAnalyzerPlugin({ path: 'web-report' })
73
- /**
74
- * https://github.com/webpack/changelog-v5/issues/10#issuecomment-615877593
75
- */
76
- new webpack.ProvidePlugin({ Buffer: ["buffer", "Buffer"] }),
77
- ];
78
-
79
- config.entry = "./src/Expo.tsx";
80
-
81
- config.resolve.fallback = {
82
- ...config.resolve.fallback,
83
- crypto: require.resolve('expo-crypto'),
84
- };
85
-
86
- return config;
87
- };