@duffel/components 3.1.2 → 3.1.3--prototype.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.
Files changed (62) hide show
  1. package/.circleci/config.yml +2 -2
  2. package/.github/ISSUE_TEMPLATE/bug_report.md +29 -0
  3. package/.prettierignore +5 -1
  4. package/.storybook/main.ts +1 -1
  5. package/.tool-versions +1 -1
  6. package/.vscode/extensions.json +7 -0
  7. package/.vscode/settings.json +10 -0
  8. package/.yarn/releases/yarn-4.0.1.cjs +893 -0
  9. package/.yarn/sdks/eslint/bin/eslint.js +20 -0
  10. package/.yarn/sdks/eslint/lib/api.js +20 -0
  11. package/.yarn/sdks/eslint/lib/unsupported-api.js +20 -0
  12. package/.yarn/sdks/eslint/package.json +14 -0
  13. package/.yarn/sdks/integrations.yml +5 -0
  14. package/.yarn/sdks/prettier/bin-prettier.js +20 -0
  15. package/.yarn/sdks/prettier/index.js +20 -0
  16. package/.yarn/sdks/prettier/package.json +7 -0
  17. package/.yarn/sdks/typescript/bin/tsc +20 -0
  18. package/.yarn/sdks/typescript/bin/tsserver +20 -0
  19. package/.yarn/sdks/typescript/lib/tsc.js +20 -0
  20. package/.yarn/sdks/typescript/lib/tsserver.js +225 -0
  21. package/.yarn/sdks/typescript/lib/tsserverlibrary.js +225 -0
  22. package/.yarn/sdks/typescript/lib/typescript.js +20 -0
  23. package/.yarn/sdks/typescript/package.json +10 -0
  24. package/.yarnrc.yml +3 -0
  25. package/README.md +4 -0
  26. package/jest.config.ts +1 -1
  27. package/package.json +83 -134
  28. package/react-dist/components/DuffelAncillaries/DuffelAncillariesCustomElement.d.ts +0 -1
  29. package/react-dist/components/DuffelPayments/DuffelPaymentsCustomElement.d.ts +0 -1
  30. package/react-dist/custom-elements.js +20 -17
  31. package/react-dist/custom-elements.js.map +4 -4
  32. package/react-dist/index.d.ts +0 -1
  33. package/react-dist/index.js +21 -47
  34. package/react-dist/index.js.map +4 -4
  35. package/react-dist/lib/logging.d.ts +1 -1
  36. package/scripts/build-and-publish.sh +42 -0
  37. package/scripts/generate-fixture.ts +2 -2
  38. package/scripts.tsconfig.json +1 -1
  39. package/src/components/PlacesLookup/PlacesLookup.tsx +2 -3
  40. package/src/examples/just-typescript/.yarn/install-state.gz +0 -0
  41. package/src/examples/just-typescript/package.json +2 -2
  42. package/src/examples/just-typescript/src/index.ts +1 -1
  43. package/src/examples/just-typescript/yarn.lock +467 -154
  44. package/src/examples/next/README.md +28 -0
  45. package/src/examples/next/next-env.d.ts +5 -0
  46. package/src/examples/next/next.config.js +4 -0
  47. package/src/examples/next/package.json +24 -0
  48. package/src/examples/next/src/app/DuffelComponents.tsx +40 -0
  49. package/src/examples/next/src/app/layout.tsx +18 -0
  50. package/src/examples/next/src/app/page.tsx +9 -0
  51. package/src/examples/next/tsconfig.json +27 -0
  52. package/src/examples/next/yarn.lock +257 -0
  53. package/src/examples/react-app/src/index.tsx +1 -1
  54. package/src/index.ts +0 -1
  55. package/src/lib/logging.ts +1 -1
  56. package/tsconfig.json +9 -3
  57. package/.github/workflows/autoapprove.yml +0 -18
  58. package/.github/workflows/release.yml +0 -89
  59. package/.husky/post-commit +0 -4
  60. package/.husky/pre-commit +0 -4
  61. package/.storybook/Storyshots.test.js +0 -3
  62. package/.storybook/__snapshots__/Storyshots.test.js.snap +0 -67984
@@ -43,4 +43,4 @@ declare function logGroup(groupName: string, messages: any[]): void;
43
43
  declare function logGroup(groupName: string, object: {
44
44
  [key: string]: any;
45
45
  }): void;
46
- export { initializeLogger, logGroup, log };
46
+ export { initializeLogger, log, logGroup };
@@ -0,0 +1,42 @@
1
+ if [[ "$@" == *"--help"* ]]; then
2
+ echo ""
3
+ echo "Builds and publishes the package to npm and CDN."
4
+ echo ""
5
+ echo "Usage:"
6
+ echo " build-and-publish.sh [--dry-run] [--help]"
7
+ echo ""
8
+ echo "Options:"
9
+ echo " ‣ --help Show this help message"
10
+ echo " ‣ --dry-run Build and test, but do not publish"
11
+ echo ""
12
+
13
+ exit 0
14
+ fi
15
+
16
+ # Cleanup the old builds:
17
+ rm -rf ./cdn-dist
18
+ rm -rf ./react-dist
19
+
20
+ # Build for distribution
21
+
22
+ ## For those that rely on <script></script>
23
+ node config/esbuild.cdn.config.js
24
+
25
+ ## For those that rely on `npm i`
26
+ node config/esbuild.react.config.js
27
+
28
+ ## For those that use typescript
29
+ tsc --project tsconfig.json
30
+
31
+ # Only upload to CDN and publish to npm if it's not a dry run
32
+ if [[ "$@" != *"--dry-run"* ]]; then
33
+ # Upload css, js and fixtures to CDN
34
+ bash ./scripts/upload-to-cdn.sh
35
+
36
+ # Publish to npm with tag
37
+ npm publish --tag igorp1-prototype
38
+ else
39
+ echo ""
40
+ echo "Dry run. @duffel/components not published."
41
+ echo ""
42
+ fi
@@ -24,7 +24,7 @@ const duffelHeaders = {
24
24
  Authorization: `Bearer ${DUFFEL_API_TOKEN}`,
25
25
  };
26
26
 
27
- export const makeMockDateInTheFuture = (daysAhead) => {
27
+ export const makeMockDateInTheFuture = (daysAhead: number) => {
28
28
  const now = new Date(Date.now());
29
29
  now.setDate(now.getDate() + daysAhead);
30
30
  return now;
@@ -137,7 +137,7 @@ const main = async () => {
137
137
  );
138
138
  if (VERBOSE) {
139
139
  const airlines = new Set(
140
- offerRequest.offers.map((offer) => offer.owner.iata_code)
140
+ offerRequest.offers.map((offer: Offer) => offer.owner.iata_code)
141
141
  );
142
142
  log(
143
143
  `Received ${withPlural(
@@ -2,7 +2,7 @@
2
2
  "compilerOptions": {
3
3
  "target": "es2021",
4
4
  "module": "commonjs",
5
- "outDir": "dist",
5
+ "outDir": "scripts-tsconfig-dist",
6
6
  "strict": true,
7
7
  "esModuleInterop": true,
8
8
  "forceConsistentCasingInFileNames": true
@@ -1,6 +1,5 @@
1
1
  import Fuse from "fuse.js";
2
2
  import { debounce } from "lodash";
3
- import fetch from "node-fetch";
4
3
  import React from "react";
5
4
  import { Icon } from "../shared/Icon";
6
5
 
@@ -61,8 +60,8 @@ export const PlacesLookup: React.FC<PlacesLookupProps> = ({
61
60
 
62
61
  React.useEffect(() => {
63
62
  fetch(DATA_SOURCE)
64
- .then((response) => response.json())
65
- .then((data) =>
63
+ .then((response: Response) => response.json())
64
+ .then((data: string[]) =>
66
65
  setLookupData(
67
66
  new Fuse<Place>(mapDataRowsIntoObjects(data), {
68
67
  threshold: 0.2,
@@ -6,9 +6,9 @@
6
6
  "build": "esbuild src/index.ts --bundle --outfile=dist/index.js"
7
7
  },
8
8
  "dependencies": {
9
+ "@duffel/components": "3.1.3--prototype.2",
9
10
  "@types/node": "20.2.5",
10
- "typescript": "5.0.4",
11
- "duffel-components": "../../../../duffel-components/react-dist"
11
+ "typescript": "5.0.4"
12
12
  },
13
13
  "devDependencies": {
14
14
  "esbuild": "^0.17.19"
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  onDuffelAncillariesPayloadReady,
3
3
  renderDuffelAncillariesCustomElement,
4
- } from "duffel-components/custom-elements";
4
+ } from "@duffel/components";
5
5
 
6
6
  window.onload = () => {
7
7
  renderDuffelAncillariesCustomElement({