Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
448 commits
Select commit Hold shift + click to select a range
3bc38b1
feat(magento) - graphQL queue estructured
aka-sacci-ccr Jun 13, 2024
d991a39
fix(cart): cart gen logic
aka-sacci-ccr Jun 13, 2024
d4a4d64
Merge branch 'magento' of github.com:deco-cx/apps into magento-cart-fix
aka-sacci-ccr Jun 13, 2024
ff0ee77
Merge pull request #657 from deco-cx/magento-cart-fix
aka-sacci-ccr Jun 13, 2024
58ab6cd
feat(magento): cart fallback
aka-sacci-ccr Jun 13, 2024
22295f6
fix(magento): addItem spread
aka-sacci-ccr Jun 13, 2024
25f7eff
Merge pull request #659 from deco-cx/magento-cart-error
aka-sacci-ccr Jun 14, 2024
2f80287
Merge branch 'magento' of github.com:deco-cx/apps into magento-pdp-gr…
aka-sacci-ccr Jun 14, 2024
3d25fb1
feat(magento): pdp typing
aka-sacci-ccr Jun 14, 2024
c14167d
fix(proxies) - x-forwarded-for on proxy
aka-sacci-ccr Jun 14, 2024
06bac79
fix(mangeto): proxies
aka-sacci-ccr Jun 14, 2024
406ba74
feat(magento): middleware added
aka-sacci-ccr Jun 14, 2024
bedb938
fix: add priceSpecification in transform and additionalProperty
gabrielMatosBoubee Jun 14, 2024
348f60e
fix(proxies): PHPSSID removed
aka-sacci-ccr Jun 14, 2024
66115eb
fix(magento): cookie fix
aka-sacci-ccr Jun 15, 2024
2119b8c
feat: form_key as unique value
carcara-gustavo Jun 15, 2024
b7c2179
Update transform.ts
aka-sacci-ccr Jun 15, 2024
c1d38d7
fix: resolve ascii chars in cookie
carcara-gustavo Jun 15, 2024
1207c78
fix: remove expires from form_key
carcara-gustavo Jun 15, 2024
748d73e
Merge pull request #661 from gabrielMatosBoubee/magento-pdp-graph-boubee
carcara-gustavo Jun 15, 2024
6439061
fix: form key expires and cookie ein creation
carcara-gustavo Jun 15, 2024
5cbe0c4
style: auto format code
carcara-gustavo Jun 15, 2024
e75e261
Merge branch 'magento' of github.com-carcara:deco-cx/apps into magent…
carcara-gustavo Jun 15, 2024
ff812ad
fix(magento): PDP graphql loader
aka-sacci-ccr Jun 15, 2024
64b2ab8
Merge branch 'magento' of github.com:deco-cx/apps into magento-fix-pr…
aka-sacci-ccr Jun 15, 2024
a374746
fix(magento): product url
aka-sacci-ccr Jun 15, 2024
51d1f89
Merge branch 'magento' of github.com:deco-cx/apps into magento-fix-pr…
aka-sacci-ccr Jun 15, 2024
16b1870
chore: create old version of addItem
carcara-gustavo Jun 16, 2024
3469b06
chore: auto format files
carcara-gustavo Jun 16, 2024
be4c86a
feat: communicate cart with Checkout
carcara-gustavo Jun 16, 2024
30241f6
style: auto format files
carcara-gustavo Jun 16, 2024
155e704
chore(magento): setSimulation await
aka-sacci-ccr Jun 17, 2024
13d1c67
Merge branch 'main' of github.com:deco-cx/apps into magento
aka-sacci-ccr Jun 17, 2024
5d6c389
chore(magento): log removed
aka-sacci-ccr Jun 17, 2024
4bc67b9
fix: adding api to add item after having cart id
JonasJesus42 Jun 19, 2024
aa1b847
fix: analytics magento (#670)
igorbrasileiro Jun 19, 2024
200fdce
chore(temp): putting it right away to understand the error that occur…
JonasJesus42 Jun 19, 2024
cc22bdf
fix(magento): props reordered
aka-sacci-ccr Jun 19, 2024
d75c070
fix(magento): API key to secret
aka-sacci-ccr Jun 19, 2024
841e1eb
fix(magento): proxies logic
aka-sacci-ccr Jun 19, 2024
6313069
Merge pull request #673 from deco-cx/magento-fix-proxies
aka-sacci-ccr Jun 19, 2024
9b6f63c
chore(temp): add log before trow error
JonasJesus42 Jun 20, 2024
363b8ce
Merge branch 'magento' of github.com:deco-cx/apps into magento
JonasJesus42 Jun 20, 2024
62e5b7a
fix: changing loading to false when errors occur
JonasJesus42 Jun 20, 2024
d16bffb
chore: logs tests
JonasJesus42 Jun 20, 2024
b31f254
chore: logs tests
JonasJesus42 Jun 20, 2024
3de937e
fix(magento) - added optional redirect
aka-sacci-ccr Jun 20, 2024
7cd3d61
Merge branch 'magento' of github.com:deco-cx/apps into magento-fix-re…
aka-sacci-ccr Jun 20, 2024
0018ed4
Merge pull request #676 from deco-cx/magento-fix-redirects
aka-sacci-ccr Jun 20, 2024
c558826
Merge branch 'main' into magento
JonasJesus42 Jun 20, 2024
90a522a
chore: logs tests
JonasJesus42 Jun 20, 2024
05b002a
chore: add trow error
JonasJesus42 Jun 20, 2024
55b020d
chore: testing different API to add item
JonasJesus42 Jun 20, 2024
3bb4092
chore: testing fatch to add item
JonasJesus42 Jun 20, 2024
758534e
chore: return response fetch
JonasJesus42 Jun 20, 2024
c1427da
chore: return response adminClient
JonasJesus42 Jun 20, 2024
062a7c2
fix(magento): redirects
aka-sacci-ccr Jun 20, 2024
d4afb7a
Merge branch 'magento' of github.com:deco-cx/apps into magento
aka-sacci-ccr Jun 20, 2024
dedab2a
feat: adding option to update cartId if checkout changes cartid
JonasJesus42 Jun 20, 2024
263d43f
fix: removing log and rollback additem code
JonasJesus42 Jun 20, 2024
b7a7f8a
fix: removing the if ( , ) and replacing it with &&
JonasJesus42 Jun 20, 2024
641d5e0
fix: add return next()
JonasJesus42 Jun 20, 2024
dfa0126
fix: validating undefined value problems
JonasJesus42 Jun 20, 2024
4c72d75
chore(temp): logs
JonasJesus42 Jun 21, 2024
aa036a3
fix: remove is logged in
JonasJesus42 Jun 21, 2024
15aac88
fix: add all cookies on headers
JonasJesus42 Jun 21, 2024
4a9fc49
chore: lint
JonasJesus42 Jun 21, 2024
2b8efe9
fix: remove quote_id on if
JonasJesus42 Jun 21, 2024
dda9e42
fix: chang for Number.isNaN
JonasJesus42 Jun 21, 2024
1f50791
chore: add logs on middleware
carcara-gustavo Jun 21, 2024
b2b8aaa
fix: treating null values
JonasJesus42 Jun 21, 2024
c9d0886
fix: treating null values
JonasJesus42 Jun 21, 2024
fe087e6
fix: add optional operator on canonical_url
JonasJesus42 Jun 21, 2024
334a084
fix: changed router /V1 to /granado/customer/section/load/?sections=c…
JonasJesus42 Jun 21, 2024
547d0b4
fix: add optional operator on products items name
JonasJesus42 Jun 21, 2024
c350a50
fix: solve intermitent bug on global sections
carcara-gustavo Jun 21, 2024
5979978
Merge branch 'magento' of github.com:deco-cx/apps into magento
carcara-gustavo Jun 21, 2024
680a455
fix: sintax bug
carcara-gustavo Jun 21, 2024
93516e3
add all proxies
carcara-gustavo Jun 21, 2024
a92e6cb
fix: set cookies only if there are no value
carcara-gustavo Jun 21, 2024
281be66
fix(magento): several fixes
aka-sacci-ccr Jun 21, 2024
7327cfa
feat: add priority high in cart cookie
carcara-gustavo Jun 21, 2024
2e4a54f
Merge branch 'magento' of github.com:deco-cx/apps into magento
carcara-gustavo Jun 21, 2024
23cf73e
Merge branch 'main' of github.com:deco-cx/apps into magento
carcara-gustavo Jun 21, 2024
5594e9d
fix: use always addItem flow
carcara-gustavo Jun 21, 2024
4740de7
chore: loggin cart on logger
aka-sacci-ccr Jun 22, 2024
1862e78
chore(temp): add logger cart loader
JonasJesus42 Jun 22, 2024
fd76a0f
Merge branch 'magento' of github.com:deco-cx/apps into magento
JonasJesus42 Jun 22, 2024
0c2485d
chore(temp): add logger cart loader
JonasJesus42 Jun 22, 2024
d1fd632
chore(temp): chang log error to info
JonasJesus42 Jun 22, 2024
8b4af89
chore: logging with info
aka-sacci-ccr Jun 22, 2024
6859a65
Merge branch 'magento' of github.com:deco-cx/apps into magento-fix-se…
aka-sacci-ccr Jun 22, 2024
a7d62af
fix: adding high priority to PHPSESSID cookies
JonasJesus42 Jun 22, 2024
29f66d9
feat(magento): cart images in gql
aka-sacci-ccr Jun 22, 2024
1fe1935
Merge pull request #678 from deco-cx/cookie-priority-high
JonasJesus42 Jun 22, 2024
68db6a9
fix: using parallelization and decreasing loops
JonasJesus42 Jun 22, 2024
6a57333
fix: changing the search from url_path to url_key
JonasJesus42 Jun 23, 2024
36fa306
fix: removing function with duplicate use in the same variable
JonasJesus42 Jun 23, 2024
d77f46f
Merge pull request #680 from deco-cx/get-category-url-key
JonasJesus42 Jun 23, 2024
f5761aa
Merge pull request #679 from deco-cx/optimizing-the-add-item
JonasJesus42 Jun 23, 2024
4f76c23
Merge branch 'magento' of github.com:deco-cx/apps into magento-poc-gr…
aka-sacci-ccr Jun 24, 2024
d4b9fb8
feat(magento): gql images in cart
aka-sacci-ccr Jun 24, 2024
33d2550
feat(magento): cart images stale
aka-sacci-ccr Jun 24, 2024
c9921b7
fix(magento): promise.all in totalizers
aka-sacci-ccr Jun 24, 2024
a627bc7
Merge pull request #682 from deco-cx/magento-poc-graphql-cart-images
aka-sacci-ccr Jun 24, 2024
8e17c01
feat(magento): idle action
aka-sacci-ccr Jun 24, 2024
a873b2c
fix(magento): PLP cache
aka-sacci-ccr Jun 25, 2024
54c077a
Merge branch 'main' of github.com:deco-cx/apps into magento
aka-sacci-ccr Jun 25, 2024
63292b8
Merge branch 'main' of github.com:deco-cx/apps into magento
aka-sacci-ccr Jun 25, 2024
08b4521
fix: add await (#664)
gabrielMatosBoubee Jun 25, 2024
207e295
fix(magento): plp url
aka-sacci-ccr Jun 26, 2024
29233a6
Merge pull request #684 from deco-cx/magento-fix-plp-url
aka-sacci-ccr Jun 26, 2024
77d305e
Merge branch 'main' of github.com:deco-cx/apps into magento
aka-sacci-ccr Jun 26, 2024
821ef5d
fix(magento): urlkey
aka-sacci-ccr Jun 26, 2024
a5eeed8
prop added
aka-sacci-ccr Jun 26, 2024
1bb38d2
Merge pull request #685 from deco-cx/magento-fix-urlkey
aka-sacci-ccr Jun 26, 2024
6336f7b
Merge branch 'magento' of github.com:deco-cx/apps into magento-option…
aka-sacci-ccr Jun 26, 2024
c47574d
feat(magento): return cart is optional in actions
aka-sacci-ccr Jun 26, 2024
c71f5d0
Merge branch 'main' of github.com:deco-cx/apps into magento
aka-sacci-ccr Jun 26, 2024
f40988e
Merge branch 'magento' of github.com:deco-cx/apps into magento-option…
aka-sacci-ccr Jun 26, 2024
52f2004
chrore(magento): cart after action blocked
aka-sacci-ccr Jun 26, 2024
5a3f049
fix(magento): pdp in uses only gql
aka-sacci-ccr Jun 27, 2024
84bbfa2
Merge pull request #688 from deco-cx/magento-fix-pdp-gql
aka-sacci-ccr Jun 27, 2024
ec71a40
feat(magento): onLoad refresh is optional
aka-sacci-ccr Jun 27, 2024
53c8444
Merge branch 'magento' of github.com:deco-cx/apps into magento-option…
aka-sacci-ccr Jun 27, 2024
e178bc0
quick fix
aka-sacci-ccr Jun 28, 2024
6ac6d73
fix(magento): dangerously name
aka-sacci-ccr Jun 28, 2024
5234070
Merge branch 'main' of github.com:deco-cx/apps into magento
aka-sacci-ccr Jun 28, 2024
982760e
Merge branch 'magento' of github.com:deco-cx/apps into magento-option…
aka-sacci-ccr Jun 28, 2024
d2c50be
Merge pull request #696 from deco-cx/magento-optional-cart-return
aka-sacci-ccr Jul 1, 2024
804e2a5
feat(magento): livelo added
aka-sacci-ccr Jul 2, 2024
c6dafb7
fix(magento): pdp extension logic
aka-sacci-ccr Jul 2, 2024
d7f0724
Merge branch 'main' of https://github.com/deco-cx/apps into magento
aka-sacci-ccr Jul 2, 2024
ec77d18
Merge branch 'magento' of https://github.com/deco-cx/apps into feat-m…
aka-sacci-ccr Jul 2, 2024
d20f382
fix(magento): extension fix
aka-sacci-ccr Jul 3, 2024
d672044
fix(magento): breacrumb pdp
aka-sacci-ccr Jul 3, 2024
9e8d039
Merge branch 'magento' of https://github.com/deco-cx/apps into feat-m…
aka-sacci-ccr Jul 3, 2024
00f58c2
fix(magento): createCartOnAddItem removed
aka-sacci-ccr Jul 3, 2024
1c5ad9e
Merge branch 'magento' of https://github.com/deco-cx/apps into feat-m…
aka-sacci-ccr Jul 3, 2024
09d09ea
Merge pull request #698 from deco-cx/feat-magento-livelo
aka-sacci-ccr Jul 4, 2024
ddbea98
Merge branch 'main' of https://github.com/deco-cx/apps into magento
aka-sacci-ccr Jul 4, 2024
ecad329
feat: disable wishlist
carcara-gustavo Jul 6, 2024
4653ef3
style: auto format
carcara-gustavo Jul 6, 2024
3ee7f21
chore: remove console.log
carcara-gustavo Jul 6, 2024
9028aa2
style: auto format
carcara-gustavo Jul 6, 2024
86fddab
feat: remove load call from setSimulation
carcara-gustavo Jul 6, 2024
d5489a1
chore: add log
carcara-gustavo Jul 6, 2024
c2c8c0b
chore: add log
carcara-gustavo Jul 6, 2024
6454ce7
chore: add headers
carcara-gustavo Jul 6, 2024
ebbe958
chore: try to get cookies
carcara-gustavo Jul 6, 2024
eeadf2e
chore: reset middleware
carcara-gustavo Jul 6, 2024
0bfa281
Merge branch 'magento' of https://github.com/deco-cx/apps into magent…
aka-sacci-ccr Jul 8, 2024
a507126
Merge pull request #672 from deco-cx/magento-fix-secret
aka-sacci-ccr Jul 8, 2024
e802844
log mangeto key in logger
aka-sacci-ccr Jul 8, 2024
9901f65
remove key loggin from magento
aka-sacci-ccr Jul 8, 2024
20e7cba
magento(fix): images on cart
aka-sacci-ccr Jul 8, 2024
92bcb5d
chore(magento): handleNonCachedImages
aka-sacci-ccr Jul 10, 2024
001a81b
feat(magento): cart extension
aka-sacci-ccr Jul 10, 2024
286f1d4
feat(magento): doc started
aka-sacci-ccr Jul 10, 2024
b506ac1
chore(magento): docs added
aka-sacci-ccr Jul 10, 2024
306b573
Merge pull request #708 from deco-cx/magento-doc
aka-sacci-ccr Jul 10, 2024
bae3a3d
Merge branch 'main' of https://github.com/deco-cx/apps into magento
aka-sacci-ccr Jul 10, 2024
811c72d
Merge branch 'magento' of https://github.com/deco-cx/apps into magent…
aka-sacci-ccr Jul 10, 2024
c0073d3
chore(magento): cart extension updated
aka-sacci-ccr Jul 10, 2024
a100a28
Merge pull request #707 from deco-cx/magento-extension-cart
aka-sacci-ccr Jul 10, 2024
1e5c5f0
fix(magento): sort option
aka-sacci-ccr Jul 10, 2024
95bc842
Merge branch 'main' of https://github.com/deco-cx/apps into magento
aka-sacci-ccr Jul 10, 2024
fcad203
Merge branch 'magento' of https://github.com/deco-cx/apps into magent…
aka-sacci-ccr Jul 10, 2024
92f36cc
fix: set cart_id as httpOnly
carcara-gustavo Jul 10, 2024
08212db
Merge branch 'magento' of github.com:deco-cx/apps into magento
carcara-gustavo Jul 10, 2024
8f13eb4
Merge branch 'magento' of https://github.com/deco-cx/apps into magent…
aka-sacci-ccr Jul 11, 2024
0ab00f5
Merge branch 'main' of https://github.com/deco-cx/apps into magento
aka-sacci-ccr Jul 11, 2024
ab3be7e
Merge branch 'magento' of https://github.com/deco-cx/apps into magent…
aka-sacci-ccr Jul 11, 2024
916ad95
chore(magento): cached images
aka-sacci-ccr Jul 11, 2024
2dfd29f
Merge pull request #705 from deco-cx/magento-fix-cart-imgs
aka-sacci-ccr Jul 11, 2024
4483789
fix(magento): remove hard coded
aka-sacci-ccr Jul 11, 2024
00cfd81
chore(magento): updated forms and remove non-used loaders
aka-sacci-ccr Jul 11, 2024
cbb08c8
chore(magento): docs updated
aka-sacci-ccr Jul 12, 2024
81eca84
Merge branch 'main' of https://github.com/deco-cx/apps into magento
aka-sacci-ccr Jul 15, 2024
e0b70d9
fix(magento): extension on cart
aka-sacci-ccr Jul 15, 2024
9002535
fix(magento): pdp extensions
aka-sacci-ccr Jul 16, 2024
c749eda
Merge branch 'main' of https://github.com/deco-cx/apps into magento
aka-sacci-ccr Jul 18, 2024
d810f8c
Merge branch 'magento' of https://github.com/deco-cx/apps into fix-ma…
aka-sacci-ccr Jul 18, 2024
9ed5b5c
Merge branch 'main' of https://github.com/deco-cx/apps into magento
aka-sacci-ccr Jul 23, 2024
87ca199
Merge branch 'magento' of https://github.com/deco-cx/apps into fix-ma…
aka-sacci-ccr Jul 23, 2024
bf22b63
Merge branch 'main' of github.com:deco-cx/apps into magento
aka-sacci-ccr Jul 25, 2024
79c0c46
Merge branch 'magento' of github.com:deco-cx/apps into fix-magento-ex…
aka-sacci-ccr Jul 25, 2024
26c8958
linting
aka-sacci-ccr Jul 25, 2024
61547b1
fix(magento): using invoke in extensions (pdp) + removed non used code
aka-sacci-ccr Jul 25, 2024
92c5757
feat(magento): extensions cached
aka-sacci-ccr Jul 25, 2024
851be32
chore(magento) - remove the old ways of extending
aka-sacci-ccr Jul 26, 2024
f24844d
Merge pull request #746 from deco-cx/fix-magento-extension-cache
aka-sacci-ccr Jul 26, 2024
7a1dbc9
chore(magento): docs updated
aka-sacci-ccr Jul 26, 2024
95fc62f
Merge branch 'main' of github.com:deco-cx/apps into magento
aka-sacci-ccr Jul 26, 2024
e9e1ad3
Merge branch 'main' of github.com:deco-cx/apps into magento
aka-sacci-ccr Aug 1, 2024
7efc594
feat(magento): site store header
aka-sacci-ccr Aug 1, 2024
6aa264d
fix(magento): fix in title
aka-sacci-ccr Aug 1, 2024
63bd5ae
remove middleware
carcara-gustavo Aug 15, 2024
58f886d
Merge branch 'main' of github.com:deco-cx/apps into magento
carcara-gustavo Aug 16, 2024
d4a4d09
add replaces on proxy
guitavano Aug 22, 2024
4e5cae5
fmt
guitavano Aug 22, 2024
bf38c84
feat: support deno 2.0
vitoUwu Oct 17, 2024
0d52e33
sync main
Dec 3, 2024
0e86a21
magento change product image query to search
IncognitaDev Dec 18, 2024
2eab4d3
magento cart authenticated
IncognitaDev Dec 19, 2024
577aa36
fix: wishlist actions
IncognitaDev Jan 8, 2025
72c4237
magento: add missing form_key in wishlist
IncognitaDev Jan 9, 2025
c221f56
fix: add referer header to fix user req
IncognitaDev Jan 24, 2025
5b4c881
fix: user loader
IncognitaDev Jan 24, 2025
6b00b80
feat: related product loader
IncognitaDev Feb 19, 2025
8adeb89
fix: magento category
IncognitaDev Feb 19, 2025
c7090fe
fix: remove wishlist missing header
IncognitaDev Feb 21, 2025
ffe62e6
fix: remove cookie set on magento authenticated cart
IncognitaDev Mar 4, 2025
57c4e1c
fix: add default value for custom fields on magento loaders
IncognitaDev Mar 4, 2025
afd6afc
fix: remove set-cookie delete from proxy
IncognitaDev Mar 18, 2025
a0e93d9
feat: add proxy scripts to magento
IncognitaDev Mar 20, 2025
df1d8b5
feat: add extra paths to redirect on magento
IncognitaDev Mar 27, 2025
ae2aa3c
fix: set cookie for apex domain
IncognitaDev Mar 27, 2025
050e865
wip: testing multivariate baseUrl
IncognitaDev Mar 31, 2025
0c858c3
fix: url pattern build to handle optional paths
IncognitaDev Apr 10, 2025
a19a629
fix: optional path ranking
IncognitaDev Apr 10, 2025
2a524c8
Merge branch 'optional-path-rank' into optional-paths
IncognitaDev Apr 10, 2025
cd2ab8f
Merge branch main into magento
IncognitaDev Apr 17, 2025
ed7a706
Merge branch 'optional-paths' into magento
IncognitaDev Apr 17, 2025
aee931c
fix: slug extraction for magento loaders
IncognitaDev Apr 17, 2025
8f4d14a
lint and type fixes
IncognitaDev Apr 17, 2025
a1479a3
fix: add url pattern search fallback
IncognitaDev Apr 29, 2025
ce3d492
change denopkg dependencies to jsdlvr
IncognitaDev May 6, 2025
85d965d
fix: add operationName to magento query to improve magento cache
IncognitaDev May 9, 2025
2e0c9c4
fix: remove syntaxError throw
IncognitaDev May 11, 2025
5179900
fix: type errors
IncognitaDev May 13, 2025
91250e4
Merge branch 'main' into magento
IncognitaDev May 13, 2025
af886e4
fix: remove authentication header from graphql
IncognitaDev May 13, 2025
1c9bb7c
feat: change baseUrl to Envoriment type
IncognitaDev May 14, 2025
8f677fc
fix addItem
guitavano May 15, 2025
0522ce2
Merge branch 'magento' of github.com:deco-cx/apps into magento
IncognitaDev May 15, 2025
ca00e8d
fix: verify valid cart on add
IncognitaDev May 15, 2025
a5b98a0
fix: change cart images api endpoint
IncognitaDev May 20, 2025
c7c5677
Merge branch 'main' of github.com:deco-cx/apps into magento
IncognitaDev May 20, 2025
21a0599
fix: update items missing required item ID
IncognitaDev May 20, 2025
dce76fe
Remove cache from detailsPage
matheusgr Jun 4, 2025
7a6cff6
get route type
guitavano Jun 5, 2025
7647606
remove magento
guitavano Jun 5, 2025
fe156be
avoid global scope vars
guitavano Jun 10, 2025
d7ce899
sync main
Oct 23, 2025
10da010
fmt
Oct 23, 2025
dd97fc1
Merge branch 'main' of github.com:deco-cx/apps into fix-magento
Oct 23, 2025
0bf931a
Merge branch 'main' of github.com:deco-cx/apps into fix-magento
Nov 14, 2025
852da95
Merge branch 'main' of github.com:deco-cx/apps into fix-magento
Nov 14, 2025
acab327
optimizemagento
guitavano Jan 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
166 changes: 139 additions & 27 deletions utils/graphql.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// deno-lint-ignore-file no-explicit-any
import { DecoRequestInit } from "./fetch.ts";
import { createHttpClient, HttpClientOptions } from "./http.ts";

const decoCacheArgLength = 55;

interface GraphqlClientOptions extends Omit<HttpClientOptions, "base"> {
endpoint: string;
}
Expand All @@ -10,24 +13,33 @@ interface GraphQLResponse<D> {
errors: unknown[];
}

type GraphQLAPI<D = unknown> = Record<string, {
response: GraphQLResponse<D>;
body: {
query: string;
variables?: Record<string, unknown>;
operationName?: string;
};
}>;
type GraphQLAPI<D = unknown> = Record<
string,
{
response: GraphQLResponse<D>;
body?: {
query: string;
variables?: Record<string, unknown>;
operationName?: string;
};
}
>;

interface GraphQLQueryProps<V> {
query: string;
fragments?: string[];
variables?: V;
operationName?: string;
}

export const gql = (query: TemplateStringsArray, ...fragments: string[]) =>
query.reduce((a, c, i) => `${a}${fragments[i - 1]}${c}`);

export const createGraphqlClient = (
{ endpoint, ...rest }: GraphqlClientOptions,
) => {
export const createGraphqlClient = ({
endpoint,
...rest
}: GraphqlClientOptions) => {
const url = new URL(endpoint);
const key = `POST ${url.pathname}`;

const defaultHeaders = new Headers(rest.headers);
defaultHeaders.set("content-type", "application/json");
defaultHeaders.set("accept", "application/json");
Expand All @@ -40,21 +52,24 @@ export const createGraphqlClient = (

return {
query: async <D, V>(
{ query = "", fragments = [], variables, operationName }: {
query: string;
fragments?: string[];
variables?: V;
operationName?: string;
},
init?: RequestInit,
{
query = "",
fragments = [],
variables,
operationName,
}: GraphQLQueryProps<V>,
init?: DecoRequestInit,
): Promise<D> => {
const { data, errors } = await http[key as any]({}, {
...init,
body: {
query: [query, ...fragments].join("\n"),
variables: variables as any,
operationName,
},
const { key, props } = getMethodAndProps<V>({
query,
fragments,
variables,
operationName,
url,
});
const { searchParams, body } = getParamsAndBody({ key, props, init });
const { data, errors } = await http[key as any](searchParams, {
...body,
}).then((res) => res.json());

Comment on lines 53 to 74
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

POST body may not be JSON‑stringified; init.body can override payload.

  • getParamsAndBody returns { body: props, ...init } for POST; if createHttpClient doesn’t stringify, requests may send [object Object] or fail.
  • Spreading ...init after body: props can replace the computed body.

Ensure JSON string body and keep props as the final body.

Apply:

-      const { searchParams, body } = getParamsAndBody({ key, props, init });
-      const { data, errors } = await http[key as any](searchParams, {
-        ...body,
-      }).then((res) => res.json());
+      const { searchParams, init: httpInit } = getParamsAndBody({ key, props, init });
+      const { data, errors } = await http[key as any](searchParams, httpInit)
+        .then((res) => res.json());

And update helper (see next comment).

Committable suggestion skipped: line range outside the PR's diff.

if (Array.isArray(errors) && errors.length > 0) {
Expand All @@ -65,3 +80,100 @@ export const createGraphqlClient = (
},
};
};

const getMethodAndProps = <V>({
query,
fragments,
url,
operationName,
variables,
}: GraphQLQueryProps<V> & { url: URL }) => {
const fullQuery = joinQueryArgs({
query,
fragments,
});
const stringfiedVariables = stringfyVariables<V>({ variables });
const minifiedQuery = minifyString(fullQuery);
const postMethodBool = isPostMethodRequired(
url.href,
minifiedQuery,
stringfiedVariables,
operationName,
);

const { key, executableQuery, executableVariables } = postMethodBool
? {
key: `POST ${url.pathname}`,
executableQuery: fullQuery,
executableVariables: variables,
}
: {
key: `GET ${url.pathname}`,
executableQuery: minifiedQuery,
executableVariables: stringfiedVariables,
};

return {
key,
props: {
query: executableQuery,
variables: executableVariables,
operationName,
},
};
};

const getParamsAndBody = ({
key,
props,
init,
}: ReturnType<typeof getMethodAndProps> & { init?: DecoRequestInit }) => {
if (key.startsWith("POST")) {
return { searchParams: {}, body: { body: props, ...init } };
}
return { searchParams: { ...props }, body: { ...init } };
};
Comment on lines +126 to +135
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Harden GET/POST param packing and avoid undefined values.

  • For POST, JSON‑stringify the payload and ensure it wins over init.body.
  • For GET, omit keys with undefined to avoid variables=undefined in the URL.

Apply:

-const getParamsAndBody = ({
+const getParamsAndBody = ({
   key,
   props,
   init,
 }: ReturnType<typeof getMethodAndProps> & { init?: DecoRequestInit }) => {
   if (key.startsWith("POST")) {
-    return { searchParams: {}, body: { body: props, ...init } };
+    const bodyJson = JSON.stringify(props);
+    return { searchParams: {}, init: { ...(init ?? {}), body: bodyJson } };
   }
-  return { searchParams: { ...props }, body: { ...init } };
+  const searchParams: Record<string, string> = {};
+  if (props.query) searchParams.query = props.query;
+  if (props.operationName) searchParams.operationName = props.operationName;
+  if (typeof props.variables === "string" && props.variables.length > 0) {
+    searchParams.variables = props.variables;
+  }
+  return { searchParams, init: { ...(init ?? {}) } };
 };

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In utils/graphql.ts around lines 126 to 135, harden the GET/POST param packing
by: for POST requests ensure the request body is a JSON string of props
(JSON.stringify(props)) and that this serialized payload takes precedence over
any init.body (i.e., set body: { body: JSON.stringify(props), ...init } but
ensure init.body is not used if props provided); for GET requests build
searchParams by copying props but filtering out keys whose values are undefined
so you don't produce query entries like variables=undefined (omit
undefined-valued keys before returning searchParams); keep the same return shape
({ searchParams, body }) and preserve other init fields.


const minifyString = (s: string): string => {
s = s.replace(
/\{([^{}]*)\}/g,
(_, p1) => `{${p1.replace(/\s+/g, " ").trim()}}`,
);
s = s
.replace(/[\r\n]+/g, " ")
.replace(/\s+/g, " ")
.replace(/\s*{\s*/g, "{")
.replace(/\s*}\s*/g, "}")
.replace(/\s*:\s*/g, ":")
.replace(/\s*\(\s*/g, "(")
.replace(/\s*\)\s*/g, ")");
return s.trim();
};

const joinQueryArgs = ({
query,
fragments = [],
}: Pick<GraphQLQueryProps<any>, "query" | "fragments">) =>
[query, ...fragments].join("\n");

const stringfyVariables = <V>({
variables,
}: Pick<GraphQLQueryProps<V>, "variables">) => JSON.stringify(variables);

const isPostMethodRequired = (
href: string,
query: string,
variables: string,
operationName?: string,
): boolean => {
if (query.startsWith("mutation")) {
return true;
}

const urlLength = `${href}?query=${encodeURI(query)}&variables=${
encodeURI(
variables,
)
}&operationname=${operationName}`;
return urlLength.length + decoCacheArgLength > 2000;
};
18 changes: 18 additions & 0 deletions website/components/Image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,20 @@ const optimizeVTEX = (opts: OptimizationOptions) => {
return src.href;
};

const optimizeMagento = (opts: OptimizationOptions) => {
const { originalSrc, width, height } = opts;

const url = new URL(originalSrc);
url.searchParams.set("width", `${width}`);
url.searchParams.set("height", `${height}`);
url.searchParams.set("canvas", `${width}:${height}`);
url.searchParams.set("optimize", "low");
url.searchParams.set("fit", opts.fit === "cover" ? "" : "bounds");

return url.href;
};
Comment on lines +104 to +115
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Handle optional height parameter to prevent malformed URLs.

Line 110 constructs the canvas parameter using ${width}:${height}, but height is optional in the OptimizationOptions interface. When height is undefined, this will produce a malformed parameter like "400:undefined".

Additionally, line 112 sets the fit parameter to an empty string when opts.fit === "cover". This creates a query parameter with an empty value (fit=), which may not be the intended behavior—consider omitting the parameter entirely or using a different value.

🔧 Proposed fix
 const optimizeMagento = (opts: OptimizationOptions) => {
   const { originalSrc, width, height } = opts;
 
   const url = new URL(originalSrc);
   url.searchParams.set("width", `${width}`);
-  url.searchParams.set("height", `${height}`);
-  url.searchParams.set("canvas", `${width}:${height}`);
+  if (height) {
+    url.searchParams.set("height", `${height}`);
+    url.searchParams.set("canvas", `${width}:${height}`);
+  }
   url.searchParams.set("optimize", "low");
-  url.searchParams.set("fit", opts.fit === "cover" ? "" : "bounds");
+  if (opts.fit !== "cover") {
+    url.searchParams.set("fit", "bounds");
+  }
 
   return url.href;
 };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const optimizeMagento = (opts: OptimizationOptions) => {
const { originalSrc, width, height } = opts;
const url = new URL(originalSrc);
url.searchParams.set("width", `${width}`);
url.searchParams.set("height", `${height}`);
url.searchParams.set("canvas", `${width}:${height}`);
url.searchParams.set("optimize", "low");
url.searchParams.set("fit", opts.fit === "cover" ? "" : "bounds");
return url.href;
};
const optimizeMagento = (opts: OptimizationOptions) => {
const { originalSrc, width, height } = opts;
const url = new URL(originalSrc);
url.searchParams.set("width", `${width}`);
if (height) {
url.searchParams.set("height", `${height}`);
url.searchParams.set("canvas", `${width}:${height}`);
}
url.searchParams.set("optimize", "low");
if (opts.fit !== "cover") {
url.searchParams.set("fit", "bounds");
}
return url.href;
};
🤖 Prompt for AI Agents
In @website/components/Image.tsx around lines 104 - 115, The optimizeMagento
function builds query params incorrectly when height is optional and when
fit==='cover'; change it so you only set the canvas param if height is present
(e.g., check typeof height === "number") to avoid "400:undefined", and for fit
avoid setting an empty value—only add url.searchParams.set("fit", "bounds") when
opts.fit !== "cover" (omit the fit param entirely for cover). Update the body of
optimizeMagento to conditionally add canvas and fit params using those checks.



export const getOptimizedMediaUrl = (opts: OptimizationOptions) => {
const { originalSrc, width, height, fit } = opts;

Expand All @@ -109,6 +123,10 @@ export const getOptimizedMediaUrl = (opts: OptimizationOptions) => {
}

if (!isImageOptmizationEnabled()) {
if (originalSrc.includes("media/catalog/product")) {
return optimizeMagento(opts);
}

if (originalSrc.startsWith("https://cdn.vnda.")) {
return optmizeVNDA(opts);
}
Expand Down
4 changes: 4 additions & 0 deletions website/components/OneDollarStats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ declare global {
}
}

export const trackerOriginal = `(function() {
"use strict";function g(t){let e={};return["utm_campaign","utm_source","utm_medium","utm_term","utm_content"].forEach(n=>{let o=t.get(n);o&&(e[n]=o)}),e}function p(t){if(!t)return;let e=t.split(";"),n={};for(let o of e){let r=o.split("=").map(s=>s.trim());r.length!==2||r[0]===""||r[1]===""||(n[r[0]]=r[1])}return Object.keys(n).length===0?void 0:n}window.stonks={event:y,view:S};var l=document.currentScript,h=l?.getAttribute("data-hash-routing")!==null,m={isLocalhost:/^localhost$|^127(\.[0-9]+){0,2}\.[0-9]+$|^\[::1?\]$/.test(location.hostname)||location.protocol==="file:",isHeadlessBrowser:!!(window._phantom||window.__nightmare||window.navigator.webdriver||window.Cypress)};async function w(t){let e=l?.getAttribute("data-url")||"https://collector.onedollarstats.com/events",n=new URL(location.href);n.search="","path"in t&&t.path&&(n.pathname=t.path);let o=n.href.replace(/\\/$/,""),r=t.referrer??void 0;if(!r){let i=new URL(location.href),c=document.referrer&&document.referrer!=="null"?document.referrer:void 0;if(c){let u=new URL(c);u.hostname!==i.hostname&&(r=u.href)}}let s={u:o,e:[{t:t.type,h,r,p:t.props}]};t.utm&&Object.keys(t.utm).length>0&&(s.qs=t.utm),!(navigator.sendBeacon!==void 0&&navigator.sendBeacon(e,JSON.stringify(s)))&&fetch(e,{body:JSON.stringify(s),headers:{"Content-Type":"application/json"},keepalive:!0,method:"POST"}).catch(i=>console.error("fetch() failed:"))}async function y(t,e,n){if(d())return;let o={};typeof e=="string"?(o.path=e,n&&(o.props=n)):typeof e=="object"&&(o.props=e);let r=o?.path||void 0;if(!r){let s=document.body?.getAttribute("data-s:path")||document.querySelector('meta[name="stonks-path"]')?.getAttribute("content");s&&(r=s)}w({type:t,props:o?.props,path:r})}function A(t){if(t.type==="auxclick"&&t.button!==1)return;let e=t.target,n=e.getAttribute("data-s:event");if(!n)return;let o=e.getAttribute("data-s:event-props"),r=o?p(o):void 0,s=e.getAttribute("data-s:event-path")||void 0;y(n,s,r)}async function S(t,e){let n={};typeof t=="string"?(n.path=t,e&&(n.props=e)):typeof t=="object"&&(n.props=t),b({path:n?.path,props:n?.props},!1)}async function b(t,e=!0){if(e&&d())return;let n=new URLSearchParams(location.search),o=g(n),r=t?.path||void 0;if(!r){let i=document.body?.getAttribute("data-s:path")||document.querySelector('meta[name="stonks-path"]')?.getAttribute("content");i&&(r=i)}let s=t.props||void 0;if(!s){let i=l?.getAttribute("data-props"),c=i?p(i)||{}:{},u=document.querySelectorAll("[data-s\\:view-props]");for(let v of Array.from(u)){let f=v.getAttribute("data-s:view-props");if(!f)continue;let P=p(f);Object.assign(c,P)}s=c}w({type:"PageView",props:Object.keys(s).length>0?s:void 0,path:r,utm:o})}async function a(){let t=document.querySelector('meta[name="stonks-collect"]')?.getAttribute("content"),e=document.body?.getAttribute("data-s:collect");if(t==="false"||e==="false"){a.lastPage=null;return}if(!(l?.getAttribute("data-autocollect")!=="false")&&t!=="true"&&e!=="true"){a.lastPage=null;return}if(!h&&a.lastPage===location.pathname){console.warn("Ignoring event PageView - pathname has not changed");return}if(d())return;a.lastPage=location.pathname;let o=l?.getAttribute("data-props"),r=o?p(o)||{}:{},s=document.querySelectorAll("[data-s\\:view-props]");for(let i of Array.from(s)){let c=i.getAttribute("data-s:view-props");if(!c)continue;let u=p(c);Object.assign(r,u)}b({props:Object.keys(r).length>0?r:void 0},!1)}(e=>e.lastPage=null)(a||={});function d(){return!!(m.isLocalhost&&l?.getAttribute("data-allow-localhost")!=="true"||m.isHeadlessBrowser)}if(window.history.pushState){let t=window.history.pushState;window.history.pushState=function(e,n,o){t.apply(this,[e,n,o]),window.requestAnimationFrame(()=>{a()})},window.addEventListener("popstate",()=>{window.requestAnimationFrame(()=>{a()})})}document.visibilityState!=="visible"?document.addEventListener("visibilitychange",()=>{!a.lastPage&&document.visibilityState==="visible"&&a()}):a();document.addEventListener("click",A);
})();`;

const oneDollarSnippet = () => {
// Flags and additional dimentions
const props: Record<string, string> = {};
Expand Down
28 changes: 28 additions & 0 deletions website/functions/requestToPathname.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import type { FunctionContext, LoaderFunction } from "@deco/deco";
import { RequestURLParam } from "./requestToParam.ts";

export interface Props {
/**
* @description Path name to remove from the URL - Stringfied regex. Example: "/product/" transform "/product/my-sku" in "my-sku". "/product/|/store" transform "/product/my-sku/store" in "my-sku"
* @format dynamic-options
*/
pathname?: string;
}

/**
* @title Get params from request pathname.
* @description Set a pathname to remove from url and extract a slug
*/
const requestToParam: LoaderFunction<
Props,
RequestURLParam,
FunctionContext
> = (req, ctx) => {
const url = new URL(req.url);
const regex = new RegExp("(" + ctx.state.$live.pathname + ")", "g");
return {
data: url.pathname.toString().replace(regex, ""),
};
};

export default requestToParam;
22 changes: 16 additions & 6 deletions website/handlers/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ const rankRoute = (pattern: string): number =>
pattern
.split("/")
.reduce((acc, routePart) => {
if (routePart.startsWith("}?")) {
if (routePart.includes("*")) {
return acc - 2;
}
return acc - 1;
}
if (routePart === "*") {
return acc;
}
Expand Down Expand Up @@ -79,17 +85,20 @@ export const router = (
}
for (const { pathTemplate: routePath, handler } of routes) {
const pattern = urlPatternCache[routePath] ??= (() => {
let url;
if (URL.canParse(routePath)) {
url = new URL(routePath);
} else {
url = new URL(routePath, "http://localhost:8000");
return new URLPattern(routePath);
}
const patternWithDefaultOrigin = new URLPattern(
routePath,
"http://localhost:8000",
);

return new URLPattern({
pathname: url.pathname,
...(url.search ? { search: url.search } : {}),
pathname: patternWithDefaultOrigin.pathname,
search: patternWithDefaultOrigin.search || "*",
});
})();

const res = pattern.exec(req.url);
const groups = res?.pathname.groups ?? {};
if (res !== null) {
Expand Down Expand Up @@ -151,6 +160,7 @@ const prepareRoutes = (audiences: Routes[], ctx: AppContext) => {
((highPriorityA ? HIGH_PRIORITY_ROUTE_RANK_BASE_VALUE : 0) +
rankRoute(routeStringA))
);

return {
routes: builtRoutes.map((route) => ({
pathTemplate: route[0],
Expand Down
2 changes: 2 additions & 0 deletions website/manifest.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import * as $$$$$$$$5 from "./flags/multivariate/message.ts";
import * as $$$$$$$$6 from "./flags/multivariate/page.ts";
import * as $$$$$$$$7 from "./flags/multivariate/section.ts";
import * as $0 from "./functions/requestToParam.ts";
import * as $1 from "./functions/requestToPathname.ts";
import * as $$$$0 from "./handlers/fresh.ts";
import * as $$$$1 from "./handlers/proxy.ts";
import * as $$$$2 from "./handlers/redirect.ts";
Expand Down Expand Up @@ -60,6 +61,7 @@ import * as $$$$$$5 from "./sections/Seo/SeoV2.tsx";
const manifest = {
"functions": {
"website/functions/requestToParam.ts": $0,
"website/functions/requestToPathname.ts": $1,
},
"loaders": {
"website/loaders/analyticsScript.ts": $$$0,
Expand Down