@lookiero/checkout 0.1.1

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 (202) hide show
  1. package/.eslintignore +7 -0
  2. package/.eslintrc +72 -0
  3. package/.expo-shared/assets.json +4 -0
  4. package/.github/CODEOWNERS +1 -0
  5. package/.github/actions/version/action.yaml +32 -0
  6. package/.github/dependabot.yaml +10 -0
  7. package/.github/workflows/build.yaml +71 -0
  8. package/.github/workflows/publish.yaml +52 -0
  9. package/.husky/pre-commit +4 -0
  10. package/.husky/prepare-commit-msg +26 -0
  11. package/.husky/prepush +12 -0
  12. package/.lintstagedrc.json +4 -0
  13. package/.nvmrc +1 -0
  14. package/.prettierignore +2 -0
  15. package/.prettierrc.json +6 -0
  16. package/@types/aurora-next.d.ts +1 -0
  17. package/README.md +19 -0
  18. package/app.config.js +4 -0
  19. package/app.json +31 -0
  20. package/assets/adaptive-icon.png +0 -0
  21. package/assets/favicon.png +0 -0
  22. package/assets/icon.png +0 -0
  23. package/assets/splash.png +0 -0
  24. package/babel.config.js +6 -0
  25. package/dist/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.d.ts +15 -0
  26. package/dist/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.js +6 -0
  27. package/dist/domain/checkoutBooking/model/checkoutBooking.d.ts +8 -0
  28. package/dist/domain/checkoutBooking/model/checkoutBooking.js +16 -0
  29. package/dist/domain/checkoutBooking/model/checkoutBookingBooked.d.ts +15 -0
  30. package/dist/domain/checkoutBooking/model/checkoutBookingBooked.js +6 -0
  31. package/dist/domain/checkoutBooking/model/checkoutBookings.d.ts +6 -0
  32. package/dist/domain/checkoutBooking/model/checkoutBookings.js +1 -0
  33. package/dist/domain/uiSetting/command/updateUiSetting.d.ts +14 -0
  34. package/dist/domain/uiSetting/command/updateUiSetting.js +9 -0
  35. package/dist/domain/uiSetting/model/uiSetting.d.ts +8 -0
  36. package/dist/domain/uiSetting/model/uiSetting.js +10 -0
  37. package/dist/domain/uiSetting/model/uiSettingUpdated.d.ts +13 -0
  38. package/dist/domain/uiSetting/model/uiSettingUpdated.js +6 -0
  39. package/dist/domain/uiSetting/model/uiSettings.d.ts +6 -0
  40. package/dist/domain/uiSetting/model/uiSettings.js +1 -0
  41. package/dist/index.d.ts +22 -0
  42. package/dist/index.js +13 -0
  43. package/dist/infrastructure/delivery/_mock/bootstrap.mock.d.ts +6 -0
  44. package/dist/infrastructure/delivery/_mock/bootstrap.mock.js +17 -0
  45. package/dist/infrastructure/delivery/_mock/checkout.mock.d.ts +9 -0
  46. package/dist/infrastructure/delivery/_mock/checkout.mock.js +45 -0
  47. package/dist/infrastructure/delivery/bootstrap.d.ts +10 -0
  48. package/dist/infrastructure/delivery/bootstrap.js +21 -0
  49. package/dist/infrastructure/delivery/http/fetchHttpClient.d.ts +14 -0
  50. package/dist/infrastructure/delivery/http/fetchHttpClient.js +18 -0
  51. package/dist/infrastructure/delivery/http/httpClient.d.ts +14 -0
  52. package/dist/infrastructure/delivery/http/httpClient.js +1 -0
  53. package/dist/infrastructure/domain/checkoutBooking/model/httpCheckoutBookings.d.ts +10 -0
  54. package/dist/infrastructure/domain/checkoutBooking/model/httpCheckoutBookings.js +19 -0
  55. package/dist/infrastructure/domain/react/useBookSizeReplaceableProductVariantsForCheckoutItem.d.ts +15 -0
  56. package/dist/infrastructure/domain/react/useBookSizeReplaceableProductVariantsForCheckoutItem.js +17 -0
  57. package/dist/infrastructure/domain/react/useUpdateUiSetting.d.ts +17 -0
  58. package/dist/infrastructure/domain/react/useUpdateUiSetting.js +16 -0
  59. package/dist/infrastructure/domain/uiSetting/model/storageUiSettings.d.ts +18 -0
  60. package/dist/infrastructure/domain/uiSetting/model/storageUiSettings.js +19 -0
  61. package/dist/infrastructure/persistence/asyncStorageStorage.d.ts +4 -0
  62. package/dist/infrastructure/persistence/asyncStorageStorage.js +6 -0
  63. package/dist/infrastructure/persistence/storage.d.ts +6 -0
  64. package/dist/infrastructure/persistence/storage.js +1 -0
  65. package/dist/infrastructure/persistence/uiSettingData.d.ts +5 -0
  66. package/dist/infrastructure/persistence/uiSettingData.js +1 -0
  67. package/dist/infrastructure/projection/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.d.ts +36 -0
  68. package/dist/infrastructure/projection/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.js +30 -0
  69. package/dist/infrastructure/projection/httpFirstAvailableCheckoutByCustomerIdView.d.ts +60 -0
  70. package/dist/infrastructure/projection/httpFirstAvailableCheckoutByCustomerIdView.js +54 -0
  71. package/dist/infrastructure/projection/httpIsCheckoutEnabledByCustomerIdView.d.ts +12 -0
  72. package/dist/infrastructure/projection/httpIsCheckoutEnabledByCustomerIdView.js +7 -0
  73. package/dist/infrastructure/projection/react/useViewBookedSizeReplaceableProductVariantsForCheckoutItem.d.ts +10 -0
  74. package/dist/infrastructure/projection/react/useViewBookedSizeReplaceableProductVariantsForCheckoutItem.js +8 -0
  75. package/dist/infrastructure/projection/react/useViewFirstAvailableCheckoutByCustomerId.d.ts +10 -0
  76. package/dist/infrastructure/projection/react/useViewFirstAvailableCheckoutByCustomerId.js +8 -0
  77. package/dist/infrastructure/projection/react/useViewIsCheckoutAccessibleByCustomerId.d.ts +10 -0
  78. package/dist/infrastructure/projection/react/useViewIsCheckoutAccessibleByCustomerId.js +8 -0
  79. package/dist/infrastructure/projection/react/useViewIsCheckoutIntroVisible.d.ts +3 -0
  80. package/dist/infrastructure/projection/react/useViewIsCheckoutIntroVisible.js +3 -0
  81. package/dist/infrastructure/projection/react/useViewUiSettingByKey.d.ts +10 -0
  82. package/dist/infrastructure/projection/react/useViewUiSettingByKey.js +8 -0
  83. package/dist/infrastructure/projection/storageUiSettingByKeyView.d.ts +13 -0
  84. package/dist/infrastructure/projection/storageUiSettingByKeyView.js +14 -0
  85. package/dist/infrastructure/ui/Root.d.ts +15 -0
  86. package/dist/infrastructure/ui/Root.js +25 -0
  87. package/dist/infrastructure/ui/components/atoms/spiner/Spinner.d.ts +3 -0
  88. package/dist/infrastructure/ui/components/atoms/spiner/Spinner.js +11 -0
  89. package/dist/infrastructure/ui/components/atoms/spiner/Spinner.style.d.ts +9 -0
  90. package/dist/infrastructure/ui/components/atoms/spiner/Spinner.style.js +10 -0
  91. package/dist/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.d.ts +8 -0
  92. package/dist/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.js +16 -0
  93. package/dist/infrastructure/ui/routing/CheckoutMiddleware.d.ts +7 -0
  94. package/dist/infrastructure/ui/routing/CheckoutMiddleware.js +34 -0
  95. package/dist/infrastructure/ui/routing/Routing.d.ts +7 -0
  96. package/dist/infrastructure/ui/routing/Routing.js +49 -0
  97. package/dist/infrastructure/ui/routing/router/Router.d.ts +1 -0
  98. package/dist/infrastructure/ui/routing/router/Router.js +1 -0
  99. package/dist/infrastructure/ui/routing/router/Router.native.d.ts +1 -0
  100. package/dist/infrastructure/ui/routing/router/Router.native.js +1 -0
  101. package/dist/infrastructure/ui/routing/routes.d.ts +6 -0
  102. package/dist/infrastructure/ui/routing/routes.js +7 -0
  103. package/dist/infrastructure/ui/test/render.d.ts +19 -0
  104. package/dist/infrastructure/ui/test/render.js +14 -0
  105. package/dist/infrastructure/ui/views/intro/Intro.d.ts +3 -0
  106. package/dist/infrastructure/ui/views/intro/Intro.js +20 -0
  107. package/dist/infrastructure/ui/views/item/Item.d.ts +3 -0
  108. package/dist/infrastructure/ui/views/item/Item.js +23 -0
  109. package/dist/infrastructure/ui/views/summary/Summary.d.ts +3 -0
  110. package/dist/infrastructure/ui/views/summary/Summary.js +20 -0
  111. package/dist/projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem.d.ts +43 -0
  112. package/dist/projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem.js +8 -0
  113. package/dist/projection/checkout/viewFirstAvailableCheckoutByCustomerId.d.ts +104 -0
  114. package/dist/projection/checkout/viewFirstAvailableCheckoutByCustomerId.js +43 -0
  115. package/dist/projection/checkout/viewIsCheckoutAccessibleByCustomerId.d.ts +16 -0
  116. package/dist/projection/checkout/viewIsCheckoutAccessibleByCustomerId.js +13 -0
  117. package/dist/projection/checkout/viewIsCheckoutEnabledByCustomerId.d.ts +23 -0
  118. package/dist/projection/checkout/viewIsCheckoutEnabledByCustomerId.js +8 -0
  119. package/dist/projection/uiSetting/viewUiSettingByKey.d.ts +28 -0
  120. package/dist/projection/uiSetting/viewUiSettingByKey.js +7 -0
  121. package/jest.config.js +9 -0
  122. package/jest.setup.js +3 -0
  123. package/package.json +75 -0
  124. package/src/Expo.tsx +59 -0
  125. package/src/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.test.ts +26 -0
  126. package/src/domain/checkoutBooking/command/bookSizeReplaceableProductVariantsForCheckoutItem.ts +27 -0
  127. package/src/domain/checkoutBooking/model/checkoutBooking.test.ts +30 -0
  128. package/src/domain/checkoutBooking/model/checkoutBooking.ts +31 -0
  129. package/src/domain/checkoutBooking/model/checkoutBookingBooked.test.ts +23 -0
  130. package/src/domain/checkoutBooking/model/checkoutBookingBooked.ts +23 -0
  131. package/src/domain/checkoutBooking/model/checkoutBookings.ts +6 -0
  132. package/src/domain/uiSetting/command/updateUiSetting.test.ts +19 -0
  133. package/src/domain/uiSetting/command/updateUiSetting.ts +23 -0
  134. package/src/domain/uiSetting/model/uiSetting.test.ts +26 -0
  135. package/src/domain/uiSetting/model/uiSetting.ts +22 -0
  136. package/src/domain/uiSetting/model/uiSettingUpdated.test.ts +17 -0
  137. package/src/domain/uiSetting/model/uiSettingUpdated.ts +19 -0
  138. package/src/domain/uiSetting/model/uiSettings.ts +6 -0
  139. package/src/index.ts +44 -0
  140. package/src/infrastructure/delivery/_mock/bootstrap.mock.ts +38 -0
  141. package/src/infrastructure/delivery/_mock/checkout.mock.ts +81 -0
  142. package/src/infrastructure/delivery/bootstrap.ts +42 -0
  143. package/src/infrastructure/delivery/http/fetchHttpClient.test.ts +51 -0
  144. package/src/infrastructure/delivery/http/fetchHttpClient.ts +41 -0
  145. package/src/infrastructure/delivery/http/httpClient.ts +18 -0
  146. package/src/infrastructure/domain/checkoutBooking/model/httpCheckoutBookings.test.ts +45 -0
  147. package/src/infrastructure/domain/checkoutBooking/model/httpCheckoutBookings.ts +32 -0
  148. package/src/infrastructure/domain/react/useBookSizeReplaceableProductVariantsForCheckoutItem.test.ts +38 -0
  149. package/src/infrastructure/domain/react/useBookSizeReplaceableProductVariantsForCheckoutItem.ts +44 -0
  150. package/src/infrastructure/domain/react/useUpdateUiSetting.test.ts +31 -0
  151. package/src/infrastructure/domain/react/useUpdateUiSetting.ts +43 -0
  152. package/src/infrastructure/domain/uiSetting/model/storageUiSettings.test.ts +50 -0
  153. package/src/infrastructure/domain/uiSetting/model/storageUiSettings.ts +50 -0
  154. package/src/infrastructure/persistence/asyncStorageStorage.ts +12 -0
  155. package/src/infrastructure/persistence/storage.ts +7 -0
  156. package/src/infrastructure/persistence/uiSettingData.ts +5 -0
  157. package/src/infrastructure/projection/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.test.ts +65 -0
  158. package/src/infrastructure/projection/httpBookedSizeReplaceableProductVariantsForCheckoutItemView.ts +102 -0
  159. package/src/infrastructure/projection/httpFirstAvailableCheckoutByCustomerIdView.test.ts +99 -0
  160. package/src/infrastructure/projection/httpFirstAvailableCheckoutByCustomerIdView.ts +128 -0
  161. package/src/infrastructure/projection/httpIsCheckoutEnabledByCustomerIdView.test.ts +32 -0
  162. package/src/infrastructure/projection/httpIsCheckoutEnabledByCustomerIdView.ts +27 -0
  163. package/src/infrastructure/projection/react/useViewBookedSizeReplaceableProductVariantsForCheckoutItem.test.ts +51 -0
  164. package/src/infrastructure/projection/react/useViewBookedSizeReplaceableProductVariantsForCheckoutItem.ts +25 -0
  165. package/src/infrastructure/projection/react/useViewFirstAvailableCheckoutByCustomerId.test.ts +28 -0
  166. package/src/infrastructure/projection/react/useViewFirstAvailableCheckoutByCustomerId.ts +22 -0
  167. package/src/infrastructure/projection/react/useViewIsCheckoutAccessibleByCustomerId.test.ts +44 -0
  168. package/src/infrastructure/projection/react/useViewIsCheckoutAccessibleByCustomerId.ts +24 -0
  169. package/src/infrastructure/projection/react/useViewIsCheckoutIntroVisible.ts +5 -0
  170. package/src/infrastructure/projection/react/useViewUiSettingByKey.test.ts +30 -0
  171. package/src/infrastructure/projection/react/useViewUiSettingByKey.ts +18 -0
  172. package/src/infrastructure/projection/storageUiSettingByKeyView.test.ts +32 -0
  173. package/src/infrastructure/projection/storageUiSettingByKeyView.ts +35 -0
  174. package/src/infrastructure/ui/Root.tsx +53 -0
  175. package/src/infrastructure/ui/components/atoms/spiner/Spinner.style.ts +12 -0
  176. package/src/infrastructure/ui/components/atoms/spiner/Spinner.tsx +35 -0
  177. package/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.test.tsx +70 -0
  178. package/src/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.tsx +31 -0
  179. package/src/infrastructure/ui/routing/CheckoutMiddleware.test.tsx +100 -0
  180. package/src/infrastructure/ui/routing/CheckoutMiddleware.tsx +52 -0
  181. package/src/infrastructure/ui/routing/Routing.tsx +64 -0
  182. package/src/infrastructure/ui/routing/router/Router.native.ts +1 -0
  183. package/src/infrastructure/ui/routing/router/Router.ts +1 -0
  184. package/src/infrastructure/ui/routing/routes.ts +6 -0
  185. package/src/infrastructure/ui/test/render.tsx +47 -0
  186. package/src/infrastructure/ui/views/intro/Intro.test.tsx +15 -0
  187. package/src/infrastructure/ui/views/intro/Intro.tsx +27 -0
  188. package/src/infrastructure/ui/views/item/Item.tsx +31 -0
  189. package/src/infrastructure/ui/views/summary/Summary.tsx +27 -0
  190. package/src/projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem.test.ts +40 -0
  191. package/src/projection/bookedSizeReplaceableProductVariants/viewBookedSizeReplaceableProductVariantsForCheckoutItem.ts +85 -0
  192. package/src/projection/checkout/viewFirstAvailableCheckoutByCustomerId.test.ts +22 -0
  193. package/src/projection/checkout/viewFirstAvailableCheckoutByCustomerId.ts +149 -0
  194. package/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.test.ts +54 -0
  195. package/src/projection/checkout/viewIsCheckoutAccessibleByCustomerId.ts +46 -0
  196. package/src/projection/checkout/viewIsCheckoutEnabledByCustomerId.test.ts +20 -0
  197. package/src/projection/checkout/viewIsCheckoutEnabledByCustomerId.ts +51 -0
  198. package/src/projection/uiSetting/viewUiSettingByKey.test.ts +22 -0
  199. package/src/projection/uiSetting/viewUiSettingByKey.ts +47 -0
  200. package/tsconfig.build.json +16 -0
  201. package/tsconfig.json +19 -0
  202. package/webpack.config.js +17 -0
package/.eslintignore ADDED
@@ -0,0 +1,7 @@
1
+ node_modules
2
+ coverage
3
+ dist
4
+ *.ignored/
5
+ *.ignored.*
6
+ .hooks/*
7
+ .vscode/*
package/.eslintrc ADDED
@@ -0,0 +1,72 @@
1
+ {
2
+ "plugins": ["@typescript-eslint"],
3
+ "parser": "@typescript-eslint/parser",
4
+ "overrides": [
5
+ {
6
+ "files": ["*.ts", "*.tsx"],
7
+ "extends": [
8
+ "plugin:prettier/recommended",
9
+ "plugin:@typescript-eslint/recommended",
10
+ "plugin:react/recommended",
11
+ "plugin:react-hooks/recommended",
12
+ "plugin:react/jsx-runtime"
13
+ ]
14
+ }
15
+ ],
16
+ "settings": {
17
+ "react": {
18
+ "version": "detect"
19
+ }
20
+ },
21
+ "rules": {
22
+ "no-console": "off",
23
+ "no-var": "error",
24
+ "@typescript-eslint/no-unused-vars": "error",
25
+ "@typescript-eslint/no-explicit-any": "error",
26
+ "@typescript-eslint/no-empty-interface": [
27
+ "error",
28
+ {
29
+ "allowSingleExtends": true
30
+ }
31
+ ],
32
+ "@typescript-eslint/naming-convention": [
33
+ "error",
34
+ {
35
+ "selector": "default",
36
+ "format": ["camelCase"]
37
+ },
38
+ // PascalCase for Classes, Interfaces, Types, ...
39
+ {
40
+ "selector": "typeLike",
41
+ "format": ["PascalCase"]
42
+ },
43
+ {
44
+ "selector": "enumMember",
45
+ "format": ["UPPER_CASE"]
46
+ },
47
+ {
48
+ "selector": "variable",
49
+ "format": ["camelCase", "UPPER_CASE", "PascalCase"]
50
+ },
51
+ {
52
+ "selector": "parameter",
53
+ "format": ["camelCase", "PascalCase"]
54
+ },
55
+ // camelCase | snake_case | PascalCase for regular properties
56
+ {
57
+ "selector": "property",
58
+ "format": ["camelCase", "snake_case", "PascalCase"]
59
+ },
60
+ // properties with single or double leading-underscores will be camelCase (__html, _id, ...)
61
+ {
62
+ "selector": "property",
63
+ "format": ["camelCase"],
64
+ "prefix": ["__", "_"],
65
+ "filter": {
66
+ "regex": "^_+",
67
+ "match": true
68
+ }
69
+ }
70
+ ]
71
+ }
72
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "12bb71342c6255bbf50437ec8f4441c083f47cdb74bd89160c15e4f43e52a1cb": true,
3
+ "40b842e832070c58deac6aa9e08fa459302ee3f9da492c7e77d93d2fbf4a56fd": true
4
+ }
@@ -0,0 +1 @@
1
+ * @lookiero/squad-box
@@ -0,0 +1,32 @@
1
+ name: "Version Check"
2
+
3
+ inputs:
4
+ github-token:
5
+ required: true
6
+
7
+ outputs:
8
+ version:
9
+ description: "Defined version"
10
+ value: ${{ steps.set-version.outputs.version }}
11
+ is-publishable:
12
+ description: "Boolean determines when the new version is publishable or not"
13
+ value: ${{ steps.set-is-publishable.outputs.is-publishable }}
14
+
15
+ runs:
16
+ using: "composite"
17
+ steps:
18
+ - name: Check if checkout-front version has been updated
19
+ id: checkout-front-version-check
20
+ uses: EndBug/version-check@v1
21
+ with:
22
+ diff-search: true
23
+ file-name: package.json
24
+ token: ${{ inputs.github-token }}
25
+
26
+ - id: set-is-publishable
27
+ shell: bash
28
+ run: echo "::set-output name=is-publishable::${{ steps.checkout-front-version-check.outputs.changed == 'true' }}"
29
+
30
+ - id: set-version
31
+ shell: bash
32
+ run: echo "::set-output name=version::v${{ steps.checkout-front-version-check.outputs.version }}"
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: npm
4
+ directory: "/"
5
+ schedule:
6
+ interval: daily
7
+ open-pull-requests-limit: 5
8
+ assignees:
9
+ - benatespina
10
+ - mktoast
@@ -0,0 +1,71 @@
1
+ name: 🌀
2
+
3
+ on: [pull_request]
4
+
5
+ jobs:
6
+ lint:
7
+ name: 🛁 Linting
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - name: 🛑 Cancel Previous Runs
11
+ uses: styfle/cancel-workflow-action@0.9.1
12
+
13
+ - name: ⬇️ Checkout repo
14
+ uses: actions/checkout@v3
15
+
16
+ - name: ⎔ Setup node 14.19.3
17
+ uses: actions/setup-node@v3
18
+ with:
19
+ node-version: 14.19.3
20
+
21
+ - name: 📥 Download deps
22
+ shell: bash
23
+ run: npm install -g npm && npm ci --legacy-peer-deps
24
+ env:
25
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
26
+
27
+ - name: ⬣ ESLint
28
+ run: node_modules/.bin/eslint --max-warnings 0 --ext ts,tsx .
29
+ env:
30
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
31
+
32
+ - name: ʦ Prettier
33
+ run: node_modules/.bin/prettier --check "**/*.+(json|css|ts|tsx|md)"
34
+ env:
35
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
36
+
37
+ jest:
38
+ name: ⚡ Jest
39
+ runs-on: ubuntu-latest
40
+ strategy:
41
+ matrix:
42
+ node-version: [14.19.3, 16.x, 18.x, latest]
43
+ steps:
44
+ - name: 🛑 Cancel Previous Runs
45
+ uses: styfle/cancel-workflow-action@0.9.1
46
+
47
+ - name: ⬇️ Checkout repo
48
+ uses: actions/checkout@v3
49
+
50
+ - name: ⎔ Setup node ${{ matrix.node-version }}
51
+ uses: actions/setup-node@v3
52
+ with:
53
+ node-version: ${{ matrix.node-version }}
54
+
55
+ - name: 📥 Download deps
56
+ shell: bash
57
+ run: npm install -g npm && npm ci --legacy-peer-deps
58
+ env:
59
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
60
+
61
+ - name: ⚙️ Build
62
+ run: npm run build
63
+ env:
64
+ node-version: ${{ matrix.node-version }}
65
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
66
+
67
+ - name: ⚡ Jest
68
+ run: npm run test
69
+ env:
70
+ node-version: ${{ matrix.node-version }}
71
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -0,0 +1,52 @@
1
+ name: 📰
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+
8
+ jobs:
9
+ publish:
10
+ name: 🚀 Publish
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: 🛑 Cancel Previous Runs
14
+ uses: styfle/cancel-workflow-action@0.9.1
15
+
16
+ - name: ⬇️ Checkout repo
17
+ uses: actions/checkout@v3
18
+
19
+ - name: ⎔ Setup node 14.19.3
20
+ uses: actions/setup-node@v3
21
+ with:
22
+ node-version: 14.19.3
23
+
24
+ - name: 📥 Download deps
25
+ shell: bash
26
+ run: npm install -g npm && npm ci --legacy-peer-deps
27
+ env:
28
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
29
+
30
+ - name: ⚙️ Build
31
+ run: npm run build
32
+ env:
33
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
34
+
35
+ - name: 📝 Check Version
36
+ id: check-version
37
+ uses: ./.github/actions/version
38
+ with:
39
+ github-token: ${{ secrets.GITHUB_TOKEN }}
40
+
41
+ - name: 🐙 Publish Github release
42
+ if: steps.check-version.outputs.is-publishable == 'true'
43
+ uses: ncipollo/release-action@v1
44
+ with:
45
+ tag: ${{ steps.check-version.outputs.version }}
46
+ name: ${{ steps.check-version.outputs.version }}
47
+
48
+ - name: 🎉 Publish packages in NPM
49
+ if: steps.check-version.outputs.is-publishable == 'true'
50
+ run: npm run publish
51
+ env:
52
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env sh
2
+ . "$(dirname -- "$0")/_/husky.sh"
3
+
4
+ npx lint-staged
@@ -0,0 +1,26 @@
1
+ #!/bin/sh
2
+ #
3
+ # Automatically add branch name and branch description to every commit message except merge commit.
4
+ #
5
+
6
+ COMMIT_EDITMSG=$1
7
+
8
+ addBranchName() {
9
+ NAME=$(git rev-parse --abbrev-ref HEAD 2>/dev/null)
10
+ DESCRIPTION=$(git config branch."$NAME".description)
11
+ if [ ! -z "$NAME" ] && [ "$NAME" != "HEAD" ] ; then
12
+ echo "[$NAME]: $(cat $COMMIT_EDITMSG)" > $COMMIT_EDITMSG
13
+ if [ -n "$DESCRIPTION" ]
14
+ then
15
+ echo "" >> $COMMIT_EDITMSG
16
+ echo $DESCRIPTION >> $COMMIT_EDITMSG
17
+ fi
18
+ fi
19
+ }
20
+
21
+ IS_AMEND=$(ps -ocommand= -p $PPID | grep -e '--amend');
22
+ MERGE=$(cat $COMMIT_EDITMSG|grep -i 'merge'|wc -l)
23
+
24
+ if ! [ -n "$IS_AMEND" ] && [ $MERGE -eq 0 ] ; then
25
+ addBranchName
26
+ fi
package/.husky/prepush ADDED
@@ -0,0 +1,12 @@
1
+ #!/bin/bash
2
+
3
+ protected_branch='master'
4
+ current_branch=$(git rev-parse --abbrev-ref HEAD | sed -e 's,.*/\(.*\),\1,')
5
+
6
+ if [ $protected_branch = $current_branch ]
7
+ then
8
+ echo "Push master is not allowed"
9
+ exit 1 # push will not execute
10
+ else
11
+ exit 0 # push will execute
12
+ fi
@@ -0,0 +1,4 @@
1
+ {
2
+ "*.{ts,tsx}": ["eslint --fix", "prettier --write"],
3
+ "except": ["coverage"]
4
+ }
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ v14.19.3
@@ -0,0 +1,2 @@
1
+ dist
2
+ .expo
@@ -0,0 +1,6 @@
1
+ {
2
+ "semi": true,
3
+ "trailingComma": "all",
4
+ "printWidth": 120,
5
+ "tabWidth": 2
6
+ }
@@ -0,0 +1 @@
1
+ declare module "@lookiero/aurora-next";
package/README.md ADDED
@@ -0,0 +1,19 @@
1
+ <div align="center">
2
+ <h1>checkout-front</h1>
3
+ <h3>🧾 Frontend side of the Checkout</h3>
4
+ </div>
5
+
6
+ ## 💡 Prerequisites
7
+
8
+ - Node.js >= 14.19.3
9
+ - NPM >= 8
10
+
11
+ ## 🚀 Getting Started
12
+
13
+ This application is build over **Expo** so, the easiest way to install this library is through NPM.
14
+
15
+ ```shell
16
+ $ npm install --legacy-peer-deps
17
+ ```
18
+
19
+ > The --legacy-peer-deps flag is required because we need to resolve UAF's fixed dependencies like react-native and aurora
package/app.config.js ADDED
@@ -0,0 +1,4 @@
1
+ export default ({ config }) => ({
2
+ ...config,
3
+ entryPoint: "./src/Expo.tsx",
4
+ });
package/app.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "expo": {
3
+ "name": "checkout-front",
4
+ "slug": "checkout-front",
5
+ "version": "1.0.0",
6
+ "orientation": "portrait",
7
+ "icon": "./assets/icon.png",
8
+ "userInterfaceStyle": "light",
9
+ "splash": {
10
+ "image": "./assets/splash.png",
11
+ "resizeMode": "contain",
12
+ "backgroundColor": "#ffffff"
13
+ },
14
+ "updates": {
15
+ "fallbackToCacheTimeout": 0
16
+ },
17
+ "assetBundlePatterns": ["**/*"],
18
+ "ios": {
19
+ "supportsTablet": true
20
+ },
21
+ "android": {
22
+ "adaptiveIcon": {
23
+ "foregroundImage": "./assets/adaptive-icon.png",
24
+ "backgroundColor": "#FFFFFF"
25
+ }
26
+ },
27
+ "web": {
28
+ "favicon": "./assets/favicon.png"
29
+ }
30
+ }
31
+ }
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,6 @@
1
+ module.exports = function(api) {
2
+ api.cache(true);
3
+ return {
4
+ presets: ['babel-preset-expo'],
5
+ };
6
+ };
@@ -0,0 +1,15 @@
1
+ import { Command } from "@lookiero/messaging";
2
+ export declare const BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM = "book_size_replaceable_product_variants_for_checkout_item";
3
+ interface BookSizeReplaceableProductVariantsForCheckoutItemPayload {
4
+ readonly aggregateId: string;
5
+ readonly checkoutId: string;
6
+ readonly checkoutItemId: string;
7
+ readonly checkoutBookingId: string;
8
+ }
9
+ export interface BookSizeReplaceableProductVariantsForCheckoutItem extends Command<typeof BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM>, BookSizeReplaceableProductVariantsForCheckoutItemPayload {
10
+ }
11
+ interface BookSizeReplaceableProductVariantsForCheckoutItemFunction {
12
+ (payload: BookSizeReplaceableProductVariantsForCheckoutItemPayload): BookSizeReplaceableProductVariantsForCheckoutItem;
13
+ }
14
+ export declare const bookSizeReplaceableProductVariantsForCheckoutItem: BookSizeReplaceableProductVariantsForCheckoutItemFunction;
15
+ export {};
@@ -0,0 +1,6 @@
1
+ import { command } from "@lookiero/messaging";
2
+ export const BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM = "book_size_replaceable_product_variants_for_checkout_item";
3
+ export const bookSizeReplaceableProductVariantsForCheckoutItem = ({ aggregateId, ...payload }) => ({
4
+ ...command({ aggregateId, name: BOOK_SIZE_REPLACEABLE_PRODUCT_VARIANTS_FOR_CHECKOUT_ITEM }),
5
+ ...payload,
6
+ });
@@ -0,0 +1,8 @@
1
+ import { AggregateRoot, CommandHandlerFunction } from "@lookiero/messaging";
2
+ import { BookSizeReplaceableProductVariantsForCheckoutItem } from "../command/bookSizeReplaceableProductVariantsForCheckoutItem";
3
+ export interface CheckoutBooking extends AggregateRoot {
4
+ readonly checkoutId: string;
5
+ readonly checkoutItemId: string;
6
+ readonly checkoutBookingId: string;
7
+ }
8
+ export declare const bookSizeReplaceableProductVariantsForCheckoutItemHandler: CommandHandlerFunction<BookSizeReplaceableProductVariantsForCheckoutItem, CheckoutBooking>;
@@ -0,0 +1,16 @@
1
+ import { checkoutBookingBooked } from "./checkoutBookingBooked";
2
+ export const bookSizeReplaceableProductVariantsForCheckoutItemHandler = () => async ({ aggregateRoot, command }) => {
3
+ const { aggregateId, checkoutId, checkoutItemId, checkoutBookingId } = command;
4
+ return {
5
+ ...aggregateRoot,
6
+ checkoutId,
7
+ checkoutItemId,
8
+ checkoutBookingId,
9
+ domainEvents: checkoutBookingBooked({
10
+ aggregateId,
11
+ checkoutId,
12
+ checkoutItemId,
13
+ checkoutBookingId,
14
+ }),
15
+ };
16
+ };
@@ -0,0 +1,15 @@
1
+ import { DomainEvent } from "@lookiero/messaging";
2
+ export declare const CHECKOUT_BOOKING_BOOKED = "checkout_booking_booked";
3
+ interface CheckoutBookingBookedPayload {
4
+ readonly aggregateId: string;
5
+ readonly checkoutId: string;
6
+ readonly checkoutItemId: string;
7
+ readonly checkoutBookingId: string;
8
+ }
9
+ export interface CheckoutBookingBooked extends DomainEvent<typeof CHECKOUT_BOOKING_BOOKED>, CheckoutBookingBookedPayload {
10
+ }
11
+ interface CheckoutBookingBookedFunction {
12
+ (payload: CheckoutBookingBookedPayload): CheckoutBookingBooked;
13
+ }
14
+ export declare const checkoutBookingBooked: CheckoutBookingBookedFunction;
15
+ export {};
@@ -0,0 +1,6 @@
1
+ import { domainEvent } from "@lookiero/messaging";
2
+ export const CHECKOUT_BOOKING_BOOKED = "checkout_booking_booked";
3
+ export const checkoutBookingBooked = ({ aggregateId, ...payload }) => ({
4
+ ...domainEvent({ aggregateId, name: CHECKOUT_BOOKING_BOOKED }),
5
+ ...payload,
6
+ });
@@ -0,0 +1,6 @@
1
+ import { RepositoryGetFunction, RepositorySaveFunction } from "@lookiero/messaging";
2
+ import { CheckoutBooking } from "./checkoutBooking";
3
+ export interface CheckoutBookingsGetFunction extends RepositoryGetFunction<CheckoutBooking> {
4
+ }
5
+ export interface CheckoutBookingsSaveFunction extends RepositorySaveFunction<CheckoutBooking> {
6
+ }
@@ -0,0 +1,14 @@
1
+ import { Command } from "@lookiero/messaging";
2
+ export declare const UPDATE_UI_SETTING = "update_ui_setting";
3
+ interface UpdateUiSettingPayload {
4
+ readonly aggregateId: string;
5
+ readonly key: string;
6
+ readonly value: unknown;
7
+ }
8
+ export interface UpdateUiSetting extends Command<typeof UPDATE_UI_SETTING>, UpdateUiSettingPayload {
9
+ }
10
+ interface UpdateUiSettingFunction {
11
+ (payload: UpdateUiSettingPayload): UpdateUiSetting;
12
+ }
13
+ export declare const updateUiSetting: UpdateUiSettingFunction;
14
+ export {};
@@ -0,0 +1,9 @@
1
+ import { command } from "@lookiero/messaging";
2
+ export const UPDATE_UI_SETTING = "update_ui_setting";
3
+ export const updateUiSetting = ({ aggregateId, ...payload }) => ({
4
+ ...command({
5
+ aggregateId,
6
+ name: UPDATE_UI_SETTING,
7
+ }),
8
+ ...payload,
9
+ });
@@ -0,0 +1,8 @@
1
+ import { AggregateRoot } from "@lookiero/messaging";
2
+ import { CommandHandlerFunction } from "@lookiero/messaging/domain/model";
3
+ import { UpdateUiSetting } from "../command/updateUiSetting";
4
+ export interface UiSetting extends AggregateRoot {
5
+ readonly key: string;
6
+ readonly value: unknown;
7
+ }
8
+ export declare const updateUiSettingHandler: CommandHandlerFunction<UpdateUiSetting, UiSetting>;
@@ -0,0 +1,10 @@
1
+ import { uiSettingUpdated } from "./uiSettingUpdated";
2
+ export const updateUiSettingHandler = () => async ({ aggregateRoot, command }) => {
3
+ const { aggregateId, key, value } = command;
4
+ return {
5
+ ...aggregateRoot,
6
+ key,
7
+ value,
8
+ domainEvents: uiSettingUpdated({ aggregateId, key }),
9
+ };
10
+ };
@@ -0,0 +1,13 @@
1
+ import { DomainEvent } from "@lookiero/messaging";
2
+ export declare const UI_SETTING_UPDATED = "ui_setting_updated";
3
+ interface UiSettingUpdatedPayload {
4
+ readonly aggregateId: string;
5
+ readonly key: string;
6
+ }
7
+ export interface UiSettingUpdated extends DomainEvent<typeof UI_SETTING_UPDATED>, UiSettingUpdatedPayload {
8
+ }
9
+ interface UiSettingUpdatedFunction {
10
+ (payload: UiSettingUpdatedPayload): UiSettingUpdated;
11
+ }
12
+ export declare const uiSettingUpdated: UiSettingUpdatedFunction;
13
+ export {};
@@ -0,0 +1,6 @@
1
+ import { domainEvent } from "@lookiero/messaging";
2
+ export const UI_SETTING_UPDATED = "ui_setting_updated";
3
+ export const uiSettingUpdated = ({ aggregateId, key }) => ({
4
+ ...domainEvent({ aggregateId, name: UI_SETTING_UPDATED }),
5
+ key,
6
+ });
@@ -0,0 +1,6 @@
1
+ import { RepositoryGetFunction, RepositorySaveFunction } from "@lookiero/messaging";
2
+ import { UiSetting } from "./uiSetting";
3
+ export interface UiSettingGetFunction extends RepositoryGetFunction<UiSetting> {
4
+ }
5
+ export interface UiSettingSaveFunction extends RepositorySaveFunction<UiSetting> {
6
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,22 @@
1
+ import { FC } from "react";
2
+ import { RootProps } from "./infrastructure/ui/Root";
3
+ import { IsCheckoutAccessibleByCustomerIdProjection } from "./projection/checkout/viewIsCheckoutAccessibleByCustomerId";
4
+ interface IsCheckoutAccessibleFunctionArgs {
5
+ readonly customerId: string | undefined;
6
+ }
7
+ interface IsCheckoutAccessibleFunction {
8
+ (args: IsCheckoutAccessibleFunctionArgs): Promise<IsCheckoutAccessibleByCustomerIdProjection>;
9
+ }
10
+ interface BootstrapFunctionArgs {
11
+ readonly getAuthToken: () => string;
12
+ readonly apiUrl: string;
13
+ }
14
+ interface BootstrapFunctionReturn {
15
+ readonly Root: FC<RootProps>;
16
+ readonly isCheckoutAccessible: IsCheckoutAccessibleFunction;
17
+ }
18
+ interface BootstrapFunction {
19
+ (args: BootstrapFunctionArgs): BootstrapFunctionReturn;
20
+ }
21
+ declare const bootstrap: BootstrapFunction;
22
+ export { bootstrap };
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ import { bootstrap as checkoutBootstrap } from "./infrastructure/delivery/bootstrap";
2
+ import { root } from "./infrastructure/ui/Root";
3
+ import { viewIsCheckoutAccessibleByCustomerId, } from "./projection/checkout/viewIsCheckoutAccessibleByCustomerId";
4
+ const bootstrap = ({ apiUrl, getAuthToken }) => {
5
+ const { Component: Messaging, queryBus } = checkoutBootstrap({ apiUrl, getAuthToken });
6
+ const Root = root({ Messaging });
7
+ const isCheckoutAccessible = ({ customerId }) => queryBus(viewIsCheckoutAccessibleByCustomerId({ customerId }));
8
+ return {
9
+ Root,
10
+ isCheckoutAccessible,
11
+ };
12
+ };
13
+ export { bootstrap };
@@ -0,0 +1,6 @@
1
+ import { BuildBootstrapFunctionReturn } from "@lookiero/messaging-react";
2
+ interface BootstrapFunction {
3
+ (): BuildBootstrapFunctionReturn;
4
+ }
5
+ declare const bootstrap: BootstrapFunction;
6
+ export { bootstrap };
@@ -0,0 +1,17 @@
1
+ import { bootstrap as messagingBootstrap } from "@lookiero/messaging-react";
2
+ import { CheckoutItemStatus, viewFirstAvailableCheckoutByCustomerIdHandler, VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, } from "../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
3
+ import { viewIsCheckoutAccessibleByCustomerIdHandler, VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, } from "../../../projection/checkout/viewIsCheckoutAccessibleByCustomerId";
4
+ import { viewIsCheckoutEnabledByCustomerIdHandler, VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID, } from "../../../projection/checkout/viewIsCheckoutEnabledByCustomerId";
5
+ import { startedCheckoutWithItems } from "./checkout.mock";
6
+ const firstAvailableCheckoutByCustomerIdView = async () => startedCheckoutWithItems({ status: [CheckoutItemStatus.KEPT, CheckoutItemStatus.INITIAL] });
7
+ const isCheckoutEnabledByCustomerIdView = async () => true;
8
+ const bootstrap = () => messagingBootstrap({ id: "Checkout" })
9
+ .query(VIEW_FIRST_AVAILABLE_CHECKOUT_BY_CUSTOMER_ID, viewFirstAvailableCheckoutByCustomerIdHandler, {
10
+ view: firstAvailableCheckoutByCustomerIdView,
11
+ })
12
+ .query(VIEW_IS_CHECKOUT_ENABLED_BY_CUSTOMER_ID, viewIsCheckoutEnabledByCustomerIdHandler, {
13
+ view: isCheckoutEnabledByCustomerIdView,
14
+ })
15
+ .query(VIEW_IS_CHECKOUT_ACCESSIBLE_BY_CUSTOMER_ID, viewIsCheckoutAccessibleByCustomerIdHandler, {})
16
+ .build();
17
+ export { bootstrap };
@@ -0,0 +1,9 @@
1
+ import { CheckoutItemStatus, CheckoutProjection } from "../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
2
+ interface StartedCheckoutWithStatusFunctionArgs {
3
+ readonly status: CheckoutItemStatus[];
4
+ }
5
+ interface StartedCheckoutWithStatusFunction {
6
+ (args: StartedCheckoutWithStatusFunctionArgs): CheckoutProjection;
7
+ }
8
+ declare const startedCheckoutWithItems: StartedCheckoutWithStatusFunction;
9
+ export { startedCheckoutWithItems };