@colabcommerce/elements 0.0.4 → 0.9.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.
- package/.pnp.cjs +16484 -0
- package/.pnp.loader.mjs +2126 -0
- package/.yarn/install-state.gz +0 -0
- package/.yarn/releases/yarn-4.12.0.cjs +942 -0
- package/.yarnrc.yml +1 -0
- package/README.md +60 -41
- package/cypress/fixtures/example.json +5 -0
- package/cypress/support/commands.js +25 -0
- package/cypress/support/component-index.html +15 -0
- package/cypress/support/component.js +26 -0
- package/cypress.config.js +10 -0
- package/eslint.config.js +32 -0
- package/index.html +13 -0
- package/package.json +91 -67
- package/playground/index.html +14 -0
- package/playground/main.jsx +36 -0
- package/public/vite.svg +1 -0
- package/src/App.css +0 -0
- package/src/App.jsx +65 -0
- package/src/components/CollapsibleStoreHours/index.jsx +269 -0
- package/src/components/HoursList/index.jsx +225 -0
- package/src/components/LeadForm/index.jsx +241 -0
- package/src/components/MessageDialog/index.jsx +169 -0
- package/src/components/QuoteForm/index.jsx +82 -0
- package/src/components/QuoteFormSearch/index.jsx +276 -0
- package/src/components/QuoteFormStoreList/index.jsx +65 -0
- package/src/components/QuoteFormStoreListItem/index.jsx +134 -0
- package/src/components/QuoteLeadForm/index.jsx +16 -0
- package/src/components/QuoteMap/index.jsx +96 -0
- package/src/components/QuoteMapMarker/index.jsx +56 -0
- package/src/components/StaticMap/index.jsx +24 -0
- package/src/components/Store/index.jsx +44 -0
- package/src/components/StoreContact/index.jsx +96 -0
- package/src/components/StoreInfo/index.jsx +50 -0
- package/src/components/StoreList/index.jsx +59 -0
- package/src/components/StoreListItem/index.jsx +99 -0
- package/src/components/StoreListItem/indexStoreListItem.cy.jsx +30 -0
- package/src/components/StoreListNoneFound/index.jsx +16 -0
- package/src/components/StoreLocator/index.jsx +43 -0
- package/src/components/StoreLocatorMap/index.jsx +93 -0
- package/src/components/StoreLocatorMapMarker/index.jsx +55 -0
- package/src/components/StoreLocatorMessageDialog/index.jsx +20 -0
- package/src/components/StoreLocatorSearch/index.jsx +316 -0
- package/src/components/StoreMap/index.jsx +30 -0
- package/src/components/StoreMeta/index.jsx +7 -0
- package/src/components/StoreProducts/index.jsx +112 -0
- package/src/components/ui/Badge/index.jsx +46 -0
- package/src/components/ui/Button/index.jsx +56 -0
- package/src/components/ui/Button/indexButton.cy.jsx +9 -0
- package/src/components/ui/Card/index.jsx +90 -0
- package/src/components/ui/Input/index.jsx +19 -0
- package/src/components/ui/Input/indexInput.cy.jsx +9 -0
- package/src/components/ui/LoadingPuff/index.jsx +10 -0
- package/src/components/ui/Panel/index.jsx +23 -0
- package/src/components/ui/PhoneNumberInput/index.jsx +17 -0
- package/src/contexts/quote-form.jsx +94 -0
- package/src/contexts/store-locator.jsx +83 -0
- package/src/contexts/store.jsx +59 -0
- package/src/contexts/translations.jsx +11 -0
- package/src/dist.css +229 -0
- package/src/entries/QuoteForm.js +2 -0
- package/src/entries/Store.js +2 -0
- package/src/entries/StoreLocator.js +2 -0
- package/src/entries/StoreLocatorProvider.js +2 -0
- package/src/entries/styles.js +2 -0
- package/src/entries/useStoreLocator.js +2 -0
- package/src/i18n/defaultResources.js +19 -0
- package/src/i18n/index.js +44 -0
- package/src/i18n/mergeResources.js +22 -0
- package/src/index.css +214 -0
- package/src/lib/addressComponentsToAddress.js +43 -0
- package/src/lib/productSchema.js +6 -0
- package/src/lib/useGeolocation.js +266 -0
- package/src/lib/useHours.js +205 -0
- package/src/lib/usePlacesAutocomplete.js +288 -0
- package/src/lib/useProductAvailability.js +38 -0
- package/src/lib/useRudderAnalytics.js +50 -0
- package/src/lib/useSearchResults.js +102 -0
- package/src/lib/useStoreLocatorConfig.js +50 -0
- package/src/lib/utils/cn.js +6 -0
- package/src/lib/utils/measure.js +31 -0
- package/src/locales/en/default.json +58 -0
- package/src/locales/es/default.json +58 -0
- package/src/locales/fr/default.json +58 -0
- package/src/locales/it/default.json +58 -0
- package/src/main.jsx +10 -0
- package/vite.config.js +60 -53
- package/dist/CartForm.js +0 -617
- package/dist/Container-CU_WrBOi.js +0 -22
- package/dist/Modal-DTBKy_6d.js +0 -863
- package/dist/ProductForm.js +0 -343
- package/dist/Retailer.js +0 -3637
- package/dist/StoreLocator.js +0 -797
- package/dist/addressComponentsToAddress-DCL-K8mn.js +0 -1932
- package/dist/browser-ponyfill-DcK7_cJB.js +0 -339
- package/dist/globals-B8-hYoIU.js +0 -8518
- package/dist/index-CqSfhXDd.js +0 -137
- package/dist/index-FM02Uq_P.js +0 -100
- package/dist/style.css +0 -1
package/.yarnrc.yml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
yarnPath: .yarn/releases/yarn-4.12.0.cjs
|
package/README.md
CHANGED
|
@@ -1,70 +1,89 @@
|
|
|
1
|
-
# Colab Elements
|
|
1
|
+
# Colab Commerce Elements
|
|
2
2
|
|
|
3
|
-
This
|
|
4
|
-
|
|
5
|
-
The API is the same as the standard Colab Commerce elements.
|
|
3
|
+
This library provides a set of foundational elements for customer facing Colab Commerce integrations. It supplies hooks and prebuilt elements.
|
|
6
4
|
|
|
7
5
|
## Installation
|
|
8
6
|
|
|
9
|
-
|
|
7
|
+
npm
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
npm install @colabocmmerce/elements
|
|
13
|
-
</pre>
|
|
9
|
+
`npm install @colabcommerce/elements`
|
|
14
10
|
|
|
15
|
-
|
|
11
|
+
yarn
|
|
16
12
|
|
|
17
|
-
|
|
18
|
-
yarn add @colabcommerce/lements
|
|
19
|
-
</pre>
|
|
13
|
+
`yarn add @colabcommerce/elements`
|
|
20
14
|
|
|
21
|
-
##
|
|
15
|
+
## Top Level Components
|
|
22
16
|
|
|
23
|
-
|
|
17
|
+
These components provide high level functionality and are prepackaged to get up and running as fast as possible.
|
|
18
|
+
Each component is self contained and able to be placed anywhere on a page.
|
|
24
19
|
|
|
25
|
-
|
|
20
|
+
### StoreLocator
|
|
26
21
|
|
|
27
|
-
|
|
28
|
-
import StoreLocator from '@colabcommerce/elements/StoreLocator';
|
|
29
|
-
import '@colabcommerce/elements/dist/index.css';
|
|
22
|
+
The `StoreLocator` is an out of the box store locator tool. It can be placed anywhere on a page.
|
|
30
23
|
|
|
31
|
-
|
|
32
|
-
</pre>
|
|
24
|
+
#### Usage
|
|
33
25
|
|
|
34
|
-
|
|
26
|
+
```js
|
|
27
|
+
import StoreLocator from '@colabcommerce/elements/StoreLocator'
|
|
28
|
+
import '@colabcommerce/elements/elements.css'
|
|
35
29
|
|
|
36
|
-
|
|
30
|
+
const MyStoreLocator = () => {
|
|
31
|
+
return <StoreLocator organizationId="YOUR_ORG_ID" locale="en" />
|
|
32
|
+
}
|
|
33
|
+
```
|
|
37
34
|
|
|
38
|
-
|
|
35
|
+
#### Props
|
|
39
36
|
|
|
40
|
-
|
|
37
|
+
| Prop | Type | Default |
|
|
38
|
+
| --------------- | ------- | ------- |
|
|
39
|
+
| organizationId | String | null
|
|
40
|
+
| locale | String | 'en'
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
### StoreDetails
|
|
43
43
|
|
|
44
|
-
####
|
|
44
|
+
#### Usage
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
```js
|
|
47
|
+
import Store from '@colabcommerce/elements/Store'
|
|
48
|
+
import '@colabcommerce/elements/elements.css'
|
|
47
49
|
|
|
48
|
-
|
|
50
|
+
const MyStoreLocator = () => {
|
|
51
|
+
return <Store id="STORE_ID" locale="en" />
|
|
52
|
+
}
|
|
53
|
+
```
|
|
49
54
|
|
|
50
|
-
|
|
55
|
+
#### Props
|
|
51
56
|
|
|
52
|
-
|
|
57
|
+
| Prop | Type | Default |
|
|
58
|
+
| --------------- | ------- | ------- |
|
|
59
|
+
| id | String | null
|
|
60
|
+
| locale | String | 'en'
|
|
53
61
|
|
|
54
|
-
<pre>
|
|
55
|
-
import Retailer from '@colabcommerce/elements/Retailer';
|
|
56
|
-
import '@colabcommerce/elements/dist/index.css';
|
|
57
62
|
|
|
58
|
-
|
|
59
|
-
</pre>
|
|
63
|
+
## Sub Components
|
|
60
64
|
|
|
61
|
-
|
|
65
|
+
These components are what the top level components are built on top of. You can use these individually but beware
|
|
66
|
+
as some of these components may require a context provider to be used.
|
|
62
67
|
|
|
63
|
-
|
|
68
|
+
## StoreLocatorProvider
|
|
64
69
|
|
|
65
|
-
The
|
|
70
|
+
The store locator provider is a context that provides a base store locator instance. Many of the `StoreLocator*` components depend on this
|
|
71
|
+
context to be provided.
|
|
66
72
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
An ISO string representing the locale of the user.
|
|
73
|
+
### Props
|
|
70
74
|
|
|
75
|
+
organizationID - The Colab org. to provide context for.
|
|
76
|
+
locale - String for the locale that the element should display translations for
|
|
77
|
+
baseUrl - Base url to build linking structure around
|
|
78
|
+
children
|
|
79
|
+
|
|
80
|
+
## TranslationsProvider
|
|
81
|
+
resources: {
|
|
82
|
+
en: {
|
|
83
|
+
default: {
|
|
84
|
+
message: "Howdy",
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
## Styling
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// ***********************************************
|
|
2
|
+
// This example commands.js shows you how to
|
|
3
|
+
// create various custom commands and overwrite
|
|
4
|
+
// existing commands.
|
|
5
|
+
//
|
|
6
|
+
// For more comprehensive examples of custom
|
|
7
|
+
// commands please read more here:
|
|
8
|
+
// https://on.cypress.io/custom-commands
|
|
9
|
+
// ***********************************************
|
|
10
|
+
//
|
|
11
|
+
//
|
|
12
|
+
// -- This is a parent command --
|
|
13
|
+
// Cypress.Commands.add('login', (email, password) => { ... })
|
|
14
|
+
//
|
|
15
|
+
//
|
|
16
|
+
// -- This is a child command --
|
|
17
|
+
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
|
|
18
|
+
//
|
|
19
|
+
//
|
|
20
|
+
// -- This is a dual command --
|
|
21
|
+
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
|
|
22
|
+
//
|
|
23
|
+
//
|
|
24
|
+
// -- This will overwrite an existing command --
|
|
25
|
+
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
7
|
+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
|
8
|
+
<title>Components App</title>
|
|
9
|
+
</head>
|
|
10
|
+
|
|
11
|
+
<body>
|
|
12
|
+
<div data-cy-root class="cc"></div>
|
|
13
|
+
</body>
|
|
14
|
+
|
|
15
|
+
</html>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// ***********************************************************
|
|
2
|
+
// This example support/component.js is processed and
|
|
3
|
+
// loaded automatically before your test files.
|
|
4
|
+
//
|
|
5
|
+
// This is a great place to put global configuration and
|
|
6
|
+
// behavior that modifies Cypress.
|
|
7
|
+
//
|
|
8
|
+
// You can change the location of this file or turn off
|
|
9
|
+
// automatically serving support files with the
|
|
10
|
+
// 'supportFile' configuration option.
|
|
11
|
+
//
|
|
12
|
+
// You can read more here:
|
|
13
|
+
// https://on.cypress.io/configuration
|
|
14
|
+
// ***********************************************************
|
|
15
|
+
|
|
16
|
+
// Import commands.js using ES2015 syntax:
|
|
17
|
+
import './commands'
|
|
18
|
+
|
|
19
|
+
import { mount } from 'cypress/react'
|
|
20
|
+
|
|
21
|
+
import '@fontsource/plus-jakarta-sans/latin.css'
|
|
22
|
+
import '@/index.css'
|
|
23
|
+
Cypress.Commands.add('mount', mount)
|
|
24
|
+
|
|
25
|
+
// Example use:
|
|
26
|
+
// cy.mount(<MyComponent />)
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// For more info, see https://github.com/storybookjs/eslint-plugin-storybook#configuration-flat-config-format
|
|
2
|
+
import storybook from "eslint-plugin-storybook";
|
|
3
|
+
|
|
4
|
+
import js from '@eslint/js'
|
|
5
|
+
import globals from 'globals'
|
|
6
|
+
import reactHooks from 'eslint-plugin-react-hooks'
|
|
7
|
+
import reactRefresh from 'eslint-plugin-react-refresh'
|
|
8
|
+
import { defineConfig, globalIgnores } from 'eslint/config'
|
|
9
|
+
|
|
10
|
+
export default defineConfig([
|
|
11
|
+
globalIgnores(['dist']),
|
|
12
|
+
{
|
|
13
|
+
files: ['**/*.{js,jsx}'],
|
|
14
|
+
extends: [
|
|
15
|
+
js.configs.recommended,
|
|
16
|
+
reactHooks.configs.flat.recommended,
|
|
17
|
+
reactRefresh.configs.vite,
|
|
18
|
+
],
|
|
19
|
+
languageOptions: {
|
|
20
|
+
ecmaVersion: 2020,
|
|
21
|
+
globals: globals.browser,
|
|
22
|
+
parserOptions: {
|
|
23
|
+
ecmaVersion: 'latest',
|
|
24
|
+
ecmaFeatures: { jsx: true },
|
|
25
|
+
sourceType: 'module',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
rules: {
|
|
29
|
+
'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
])
|
package/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>elements</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/main.jsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1,82 +1,106 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colabcommerce/elements",
|
|
3
|
-
"version": "0.0.4",
|
|
4
3
|
"license": "UNLICENSED",
|
|
4
|
+
"version": "0.9.1",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"exports": {
|
|
7
|
-
"./Retailer": "./dist/Retailer.js",
|
|
8
|
-
"./StoreLocator": "./dist/StoreLocator.js",
|
|
9
|
-
"./ProductForm": "./dist/ProductForm.js",
|
|
10
|
-
"./CartForm": "./dist/CartForm.js",
|
|
11
|
-
"./dist/*.css": "./dist/*.css"
|
|
12
|
-
},
|
|
13
|
-
"files": [
|
|
14
|
-
"dist"
|
|
15
|
-
],
|
|
16
|
-
"sideEffects": [
|
|
17
|
-
"*.css"
|
|
18
|
-
],
|
|
19
6
|
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"playground": "vite ./playground -c vite.config.js",
|
|
20
9
|
"build": "vite build",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"dev:storeLocator": "vite ./playground/StoreLocator -c vite.config.js",
|
|
24
|
-
"dev:retailer": "vite ./playground/Retailer -c vite.config.js",
|
|
25
|
-
"dev:cartForm": "vite ./playground/CartForm -c vite.config.js",
|
|
26
|
-
"dev:productForm": "DEBUG=vite:* vite ./playground/ProductForm -c vite.config.js",
|
|
10
|
+
"lint": "eslint .",
|
|
11
|
+
"preview": "vite preview",
|
|
27
12
|
"test": "vitest",
|
|
28
|
-
"
|
|
13
|
+
"cypress:open": "cypress open",
|
|
14
|
+
"cypress:run": "cypress run",
|
|
15
|
+
"i18n:pull": "i18nexus pull -k _oBNcssuWEgjubWZE9ZWsQ -p src/locales"
|
|
16
|
+
},
|
|
17
|
+
"exports": {
|
|
18
|
+
"./QuoteForm": "./dist/QuoteForm.js",
|
|
19
|
+
"./StoreLocator": "./dist/StoreLocator.js",
|
|
20
|
+
"./Store": "./dist/Store.js",
|
|
21
|
+
"./*.css": "./dist/*.css"
|
|
29
22
|
},
|
|
30
23
|
"peerDependencies": {
|
|
31
|
-
"react": "
|
|
32
|
-
"react-
|
|
24
|
+
"@radix-ui/react-collapsible": "^1.1.0",
|
|
25
|
+
"@radix-ui/react-popover": "^1.1.0",
|
|
26
|
+
"@radix-ui/react-scroll-area": "^1.2.0",
|
|
27
|
+
"@radix-ui/react-slot": "^1.2.0",
|
|
28
|
+
"i18next": "^25.0.0",
|
|
29
|
+
"luide-react": "^0.560.0",
|
|
30
|
+
"react": "^19.0.0",
|
|
31
|
+
"react-dom": "^19.0.0",
|
|
32
|
+
"react-i18next": "^16.0.0",
|
|
33
|
+
"tw-animate-css": "^1.0.0"
|
|
33
34
|
},
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"fast-glob": "^3.3.3",
|
|
42
|
-
"postcss": "^8",
|
|
43
|
-
"react": "^18.0.0",
|
|
44
|
-
"react-dom": "^18.0.0",
|
|
45
|
-
"rollup-plugin-postcss": "^4",
|
|
46
|
-
"sass": "^1",
|
|
47
|
-
"typescript": "^5",
|
|
48
|
-
"vite": "^5",
|
|
49
|
-
"vite-plugin-dts": "^4",
|
|
50
|
-
"vite-plugin-i18next-loader": "^3.1.2",
|
|
51
|
-
"vitest": "^3.2.4"
|
|
35
|
+
"peerDependenciesMeta": {
|
|
36
|
+
"i18next": {
|
|
37
|
+
"optional": true
|
|
38
|
+
},
|
|
39
|
+
"react-i18next": {
|
|
40
|
+
"optional": true
|
|
41
|
+
}
|
|
52
42
|
},
|
|
53
43
|
"dependencies": {
|
|
54
|
-
"@
|
|
55
|
-
"@
|
|
56
|
-
"@vis.gl/react-google-maps": "^1.
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"i18next-http-backend": "^3.0.2",
|
|
62
|
-
"lucide-react": "^0.542.0",
|
|
63
|
-
"qs": "^6.14.0",
|
|
64
|
-
"react-bootstrap": "^2.10.10",
|
|
44
|
+
"@fontsource/plus-jakarta-sans": "^5.2.8",
|
|
45
|
+
"@rudderstack/analytics-js": "^3.26.0",
|
|
46
|
+
"@vis.gl/react-google-maps": "^1.7.1",
|
|
47
|
+
"class-variance-authority": "^0.7.1",
|
|
48
|
+
"clsx": "^2.1.1",
|
|
49
|
+
"formik": "^2.4.9",
|
|
50
|
+
"libphonenumber-js": "^1.12.33",
|
|
65
51
|
"react-geocode": "^2.0.1",
|
|
66
|
-
"react-geolocated": "^4.
|
|
67
|
-
"react-
|
|
68
|
-
"react-
|
|
69
|
-
"react-
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
52
|
+
"react-geolocated": "^4.4.0",
|
|
53
|
+
"react-google-autocomplete": "^2.7.5",
|
|
54
|
+
"react-phone-number-input": "^3.4.14",
|
|
55
|
+
"react-places-autocomplete": "^7.3.0",
|
|
56
|
+
"tailwind-merge": "^3.4.0",
|
|
57
|
+
"yup": "^1.7.1"
|
|
58
|
+
},
|
|
59
|
+
"devDependencies": {
|
|
60
|
+
"@eslint/js": "^9.39.1",
|
|
61
|
+
"@radix-ui/react-collapsible": "^1.1.12",
|
|
62
|
+
"@radix-ui/react-popover": "^1.1.15",
|
|
63
|
+
"@radix-ui/react-scroll-area": "^1.2.10",
|
|
64
|
+
"@radix-ui/react-slot": "^1.2.4",
|
|
65
|
+
"@tailwindcss/vite": "^4.1.18",
|
|
66
|
+
"@types/react": "^19.2.5",
|
|
67
|
+
"@types/react-dom": "^19.2.3",
|
|
68
|
+
"@vitejs/plugin-react": "^5.1.1",
|
|
69
|
+
"@vitest/browser-playwright": "^4.0.16",
|
|
70
|
+
"@vitest/coverage-v8": "^4.0.16",
|
|
71
|
+
"autoprefixer": "^10.4.23",
|
|
72
|
+
"babel-plugin-react-compiler": "^1.0.0",
|
|
73
|
+
"cypress": "^15.8.1",
|
|
74
|
+
"eslint": "^9.39.1",
|
|
75
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
76
|
+
"eslint-plugin-react-refresh": "^0.4.24",
|
|
77
|
+
"globals": "^16.5.0",
|
|
78
|
+
"i18next": "^25.7.4",
|
|
79
|
+
"i18nexus-cli": "^3.8.2",
|
|
80
|
+
"lucide-react": "^0.562.0",
|
|
81
|
+
"playwright": "^1.57.0",
|
|
82
|
+
"postcss": "^8.5.6",
|
|
83
|
+
"prop-types": "^15.8.1",
|
|
84
|
+
"radix-ui": "^1.4.3",
|
|
85
|
+
"react": "^19.2.0",
|
|
86
|
+
"react-dom": "^19.2.0",
|
|
87
|
+
"react-i18next": "^16.5.1",
|
|
88
|
+
"tailwindcss": "^4.1.18",
|
|
89
|
+
"terser": "^5.44.1",
|
|
90
|
+
"tw-animate-css": "^1.4.0",
|
|
91
|
+
"vite": "^7.2.4",
|
|
92
|
+
"vitest": "^4.0.16"
|
|
93
|
+
},
|
|
94
|
+
"packageManager": "yarn@4.12.0",
|
|
95
|
+
"description": "This library provides a set of foundational elements for customer facing Colab Commerce integrations. It supplies hooks and prebuilt elements.",
|
|
96
|
+
"main": "cypress.config.js",
|
|
97
|
+
"author": "colabcommerce",
|
|
98
|
+
"repository": {
|
|
99
|
+
"type": "git",
|
|
100
|
+
"url": "git+https://github.com/TruRooms/elements.git"
|
|
101
|
+
},
|
|
102
|
+
"bugs": {
|
|
103
|
+
"url": "https://github.com/TruRooms/elements/issues"
|
|
78
104
|
},
|
|
79
|
-
"
|
|
80
|
-
"main": "vite.config.js",
|
|
81
|
-
"author": "colabcommerce"
|
|
105
|
+
"homepage": "https://github.com/TruRooms/elements#readme"
|
|
82
106
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<html style="font-size: 10px;">
|
|
2
|
+
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
6
|
+
<title>Playground</title>
|
|
7
|
+
</head>
|
|
8
|
+
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/main.jsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
|
|
14
|
+
</html>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import ReactDOM from "react-dom/client";
|
|
3
|
+
import CartForm from "../../src/components/CartForm"; // import from source, not dist
|
|
4
|
+
|
|
5
|
+
ReactDOM.createRoot(document.getElementById("root")).render(
|
|
6
|
+
<React.StrictMode>
|
|
7
|
+
<CartForm
|
|
8
|
+
id="b594100c-7a81-4114-a2fe-043ce7e69ae9"
|
|
9
|
+
products={[
|
|
10
|
+
{
|
|
11
|
+
"collection_id": "41080",
|
|
12
|
+
"options": [
|
|
13
|
+
{
|
|
14
|
+
"key": "Configuration",
|
|
15
|
+
"value": "41080-67/10/09/60/66"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"key": "Cover",
|
|
19
|
+
"value": "Classic Buff"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"key": "Category"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"key": "Quantity",
|
|
26
|
+
"value": 1
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"name": "Acacia",
|
|
30
|
+
"url": "https://www.palliser.com/acacia-41080-09",
|
|
31
|
+
"image": "https://www.palliser.com/media/catalog/product/a/c/acacia_sectionals_67_6h_09_10_66_41080_front_angle_plp.jpg"
|
|
32
|
+
}
|
|
33
|
+
]}
|
|
34
|
+
locale="en-US" />
|
|
35
|
+
</React.StrictMode>
|
|
36
|
+
);
|
package/public/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/src/App.css
ADDED
|
File without changes
|
package/src/App.jsx
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { Button } from '@/components/ui/Button'
|
|
3
|
+
import StoreLocatorSearch from './components/StoreLocatorSearch'
|
|
4
|
+
import StoreLocatorMap from './components/StoreLocatorMap'
|
|
5
|
+
import Input from '@/components/ui/Input'
|
|
6
|
+
import useGeolocation from '@/lib/useGeolocation'
|
|
7
|
+
import StoreList from './components/StoreList'
|
|
8
|
+
import useSearchResults from '@/lib/useSearchResults'
|
|
9
|
+
import { APIProvider } from '@vis.gl/react-google-maps'
|
|
10
|
+
import StoreInfo from '@/components/StoreInfo'
|
|
11
|
+
import StoreContact from '@/components/StoreContact'
|
|
12
|
+
import Store from '@/components/Store'
|
|
13
|
+
import StoreLocator from '@/components/StoreLocator'
|
|
14
|
+
import QuoteForm from '@/components/QuoteForm'
|
|
15
|
+
import '@fontsource/plus-jakarta-sans/latin.css'
|
|
16
|
+
import './App.css'
|
|
17
|
+
|
|
18
|
+
function App() {
|
|
19
|
+
const [showQuoteForm, setShowQuoteForm] = useState(true)
|
|
20
|
+
|
|
21
|
+
const products = [{
|
|
22
|
+
name: 'Juno',
|
|
23
|
+
sku: 'juno',
|
|
24
|
+
quantity: 2
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'Braxton',
|
|
28
|
+
sku: 'braxton',
|
|
29
|
+
quantity: 1
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
const handleClose = () => {
|
|
34
|
+
console.log('Quote form closed')
|
|
35
|
+
// Super hack, hide the form after close to simulate unmount
|
|
36
|
+
setShowQuoteForm(false)
|
|
37
|
+
// Timeout to show the form again
|
|
38
|
+
setTimeout(() => {
|
|
39
|
+
setShowQuoteForm(true)
|
|
40
|
+
}, 2000)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const handleSuccess = (values) => {
|
|
44
|
+
console.log('Quote form submitted successfully with values:', values)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<div className="cc">
|
|
49
|
+
{/* <StoreLocator organizationId="d58bcec2-0769-48ba-9c82-a234dcdc7073" locale="fr" /> */}
|
|
50
|
+
{/* <Store storeId="d10ede1f-0f2f-45e2-94d1-c5b387365302" /> */}
|
|
51
|
+
<div style={{ maxWidth: '600px', height: '100vh', margin: '0 auto' }}>
|
|
52
|
+
{showQuoteForm &&
|
|
53
|
+
<QuoteForm
|
|
54
|
+
organizationId="4f155976-8631-445a-b1b7-c8ccac28cca1"
|
|
55
|
+
products={products}
|
|
56
|
+
onClose={handleClose}
|
|
57
|
+
onSuccess={handleSuccess}
|
|
58
|
+
/>
|
|
59
|
+
}
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export default App
|