@ecomiq/storefront 1.1.9 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -418
- package/bin/ecomiq.mjs +154 -0
- package/package.json +72 -94
- package/src/api-proxy.ts +194 -0
- package/src/auth/create-storefront-auth.ts +35 -0
- package/src/auth/ecomiq-oauth-password-client.ts +26 -0
- package/src/auth/ecomiq-oauth-password-constants.ts +26 -0
- package/src/auth/ecomiq-oauth-password-plugin.ts +299 -0
- package/src/auth/ecomiq-oauth-password-types.ts +25 -0
- package/src/auth/ecomiq-storefront-sign-in.ts +47 -0
- package/src/auth/env.ts +7 -0
- package/src/cart-session.ts +241 -0
- package/src/client.ts +48 -0
- package/src/codegen.mjs +603 -0
- package/src/components/checkout/cart-sync.ts +143 -0
- package/src/components/checkout/checkout-external-update-banner.tsx +15 -0
- package/src/components/checkout/checkout-form-controls.tsx +139 -0
- package/src/components/checkout/checkout-line-items.tsx +43 -0
- package/src/components/checkout/checkout-order-summary.tsx +156 -0
- package/src/components/checkout/checkout-payment-section.tsx +215 -0
- package/src/components/checkout/checkout-session-view.tsx +240 -0
- package/src/components/checkout/checkout-shipping-address-section.tsx +266 -0
- package/src/components/checkout/checkout-shipping-section.tsx +90 -0
- package/src/components/checkout/checkout-states.tsx +73 -0
- package/src/components/checkout/form-schema.ts +229 -0
- package/src/components/checkout/format.ts +27 -0
- package/src/components/checkout/index.ts +51 -0
- package/src/components/checkout/types.ts +43 -0
- package/src/components/checkout/use-checkout-geo.ts +50 -0
- package/src/components/checkout/use-checkout-session.ts +583 -0
- package/src/components/hero.tsx +291 -0
- package/src/config.d.ts +69 -0
- package/src/config.mjs +165 -0
- package/src/index.ts +274 -0
- package/src/link.tsx +2 -0
- package/src/pages/checkout.$checkoutId.tsx +60 -0
- package/src/pages/checkout.tsx +31 -0
- package/src/pages/thank-you.tsx +53 -0
- package/src/providers/auth.tsx +69 -0
- package/src/providers/cart.tsx +275 -0
- package/src/providers/ecomiq.ts +137 -0
- package/src/providers/index.ts +26 -0
- package/src/public-config.ts +44 -0
- package/src/review-submission.ts +89 -0
- package/src/runtime/context.ts +1 -0
- package/src/runtime/default-layout.tsx +80 -0
- package/src/runtime/head.ts +126 -0
- package/src/runtime/page.tsx +82 -0
- package/src/runtime/postcss-browser-stub.mjs +5 -0
- package/src/server-config-store.ts +26 -0
- package/src/server.ts +279 -0
- package/src/styles.css +76 -0
- package/src/ui/badge.tsx +32 -0
- package/src/ui/button.tsx +31 -0
- package/src/ui/card.tsx +31 -0
- package/src/ui/carousel.tsx +218 -0
- package/src/ui/cn.ts +6 -0
- package/src/ui/index.ts +8 -0
- package/src/ui/separator.tsx +6 -0
- package/src/ui/skeleton.tsx +6 -0
- package/src/ui/storefront-error.tsx +49 -0
- package/src/utils.ts +36 -0
- package/src/vite-inline.mjs +95 -0
- package/templates/__root.tsx +77 -0
- package/templates/router.tsx +19 -0
- package/dist/chunk-64GLOWMJ.js +0 -216
- package/dist/chunk-64GLOWMJ.js.map +0 -1
- package/dist/chunk-AKD5IDEB.js +0 -177
- package/dist/chunk-AKD5IDEB.js.map +0 -1
- package/dist/chunk-EFEVJJWF.js +0 -1345
- package/dist/chunk-EFEVJJWF.js.map +0 -1
- package/dist/chunk-NAJQB5DN.js +0 -155
- package/dist/chunk-NAJQB5DN.js.map +0 -1
- package/dist/chunk-OABDGTBI.js +0 -253
- package/dist/chunk-OABDGTBI.js.map +0 -1
- package/dist/chunk-Q4U5OEUT.js +0 -21
- package/dist/chunk-Q4U5OEUT.js.map +0 -1
- package/dist/chunk-S7CPZ4UE.js +0 -6
- package/dist/chunk-S7CPZ4UE.js.map +0 -1
- package/dist/chunks/client.css +0 -984
- package/dist/chunks/client.css.map +0 -1
- package/dist/chunks/client.d.ts +0 -10759
- package/dist/chunks/client.js +0 -5398
- package/dist/chunks/client.js.map +0 -1
- package/dist/chunks/config.d.ts +0 -31
- package/dist/chunks/config.js +0 -5
- package/dist/chunks/config.js.map +0 -1
- package/dist/chunks/core-public.d.ts +0 -130
- package/dist/chunks/core-public.js +0 -92
- package/dist/chunks/core-public.js.map +0 -1
- package/dist/chunks/server-nextjs.d.ts +0 -33
- package/dist/chunks/server-nextjs.js +0 -59
- package/dist/chunks/server-nextjs.js.map +0 -1
- package/dist/chunks/server-tanstack.d.ts +0 -22
- package/dist/chunks/server-tanstack.js +0 -40
- package/dist/chunks/server-tanstack.js.map +0 -1
- package/dist/collection-DU7gREXS.d.ts +0 -4062
- package/dist/ecomiq-oauth-password-plugin-B_gMdGuc.d.ts +0 -3631
- package/dist/ecomiq-shell-ui-SWIFLQVM.js +0 -8
- package/dist/ecomiq-shell-ui-SWIFLQVM.js.map +0 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.js +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.server.d.ts +0 -9
- package/dist/index.server.js +0 -8
- package/dist/index.server.js.map +0 -1
- package/dist/nextjs/api.d.ts +0 -45
- package/dist/nextjs/api.js +0 -32
- package/dist/nextjs/api.js.map +0 -1
- package/dist/nextjs/globals.css +0 -13
- package/dist/nextjs.d.ts +0 -2
- package/dist/nextjs.js +0 -2
- package/dist/nextjs.js.map +0 -1
- package/dist/nextjs.server.d.ts +0 -18
- package/dist/nextjs.server.js +0 -1
- package/dist/nextjs.server.js.map +0 -1
- package/dist/postcss.config.mjs +0 -6
- package/dist/react/checkout-page.css +0 -855
- package/dist/react/client.css +0 -984
- package/dist/react/payment-provider.css +0 -91
- package/dist/react/thank-you-page.css +0 -105
- package/dist/react.d.ts +0 -1
- package/dist/react.js +0 -2
- package/dist/react.js.map +0 -1
- package/dist/store-proxy-handler-CNzKlTFA.d.ts +0 -10
- package/dist/tanstack/api.d.ts +0 -41
- package/dist/tanstack/api.js +0 -30
- package/dist/tanstack/api.js.map +0 -1
- package/dist/tanstack.d.ts +0 -1
- package/dist/tanstack.js +0 -2
- package/dist/tanstack.js.map +0 -1
- package/dist/tanstack.server.d.ts +0 -18
- package/dist/tanstack.server.js +0 -1
- package/dist/tanstack.server.js.map +0 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export type { CheckoutContactForm, BillingChoice } from './types'
|
|
2
|
+
export { emptyCheckoutContact } from './types'
|
|
3
|
+
|
|
4
|
+
export {
|
|
5
|
+
buildCheckoutFormValidationSchema,
|
|
6
|
+
checkoutValidationInputFromContext,
|
|
7
|
+
firstInvalidFieldId,
|
|
8
|
+
focusCheckoutField,
|
|
9
|
+
mapZodIssuesToFieldErrors,
|
|
10
|
+
CHECKOUT_FIELD_IDS,
|
|
11
|
+
CHECKOUT_FIELD_FOCUS_ORDER,
|
|
12
|
+
type CheckoutFieldId,
|
|
13
|
+
type CheckoutFormValidationContext,
|
|
14
|
+
} from './form-schema'
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
areCartSignaturesEqual,
|
|
18
|
+
cartItemsSignature,
|
|
19
|
+
cartSessionSignature,
|
|
20
|
+
findCartReconciliationActions,
|
|
21
|
+
isCheckoutCartAlreadyPurchased,
|
|
22
|
+
methodUsesProviderCheckoutUi,
|
|
23
|
+
toSignatureItems,
|
|
24
|
+
type CartLineSignatureItem,
|
|
25
|
+
type CartReconcileAction,
|
|
26
|
+
} from './cart-sync'
|
|
27
|
+
|
|
28
|
+
export { formatMoney, paymentRedirectUrl, thankYouUrl, processingUrl } from './format'
|
|
29
|
+
export { useCheckoutSession } from './use-checkout-session'
|
|
30
|
+
export { useCheckoutGeo } from './use-checkout-geo'
|
|
31
|
+
|
|
32
|
+
export { CheckoutSessionView } from './checkout-session-view'
|
|
33
|
+
export { CheckoutShippingAddressSection } from './checkout-shipping-address-section'
|
|
34
|
+
export { CheckoutShippingSection } from './checkout-shipping-section'
|
|
35
|
+
export { CheckoutPaymentSection } from './checkout-payment-section'
|
|
36
|
+
export { CheckoutOrderSummary } from './checkout-order-summary'
|
|
37
|
+
export { CheckoutOrderBumps } from './checkout-line-items'
|
|
38
|
+
export { CheckoutExternalUpdateBanner } from './checkout-external-update-banner'
|
|
39
|
+
export {
|
|
40
|
+
CheckoutAlreadyPurchasedState,
|
|
41
|
+
CheckoutEmptyState,
|
|
42
|
+
CheckoutErrorState,
|
|
43
|
+
CheckoutLoadingState,
|
|
44
|
+
} from './checkout-states'
|
|
45
|
+
export {
|
|
46
|
+
CheckoutTextField,
|
|
47
|
+
CheckoutSelectField,
|
|
48
|
+
CheckoutPhoneField,
|
|
49
|
+
FieldError,
|
|
50
|
+
fieldClass,
|
|
51
|
+
} from './checkout-form-controls'
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export type CheckoutContactForm = {
|
|
2
|
+
email: string
|
|
3
|
+
firstName: string
|
|
4
|
+
lastName: string
|
|
5
|
+
company: string
|
|
6
|
+
address: string
|
|
7
|
+
address2: string
|
|
8
|
+
/** Distrito (nombre); en PE se sincroniza con districtName. */
|
|
9
|
+
city: string
|
|
10
|
+
/** Provincia/región (nombre). */
|
|
11
|
+
province: string
|
|
12
|
+
postalCode: string
|
|
13
|
+
phone: string
|
|
14
|
+
countryCode: string
|
|
15
|
+
departmentCode: string
|
|
16
|
+
departmentName: string
|
|
17
|
+
provinceCode: string
|
|
18
|
+
provinceName: string
|
|
19
|
+
districtCode: string
|
|
20
|
+
districtName: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type BillingChoice = 'same_as_shipping' | 'different'
|
|
24
|
+
|
|
25
|
+
export const emptyCheckoutContact = (countryCode = 'PE'): CheckoutContactForm => ({
|
|
26
|
+
email: '',
|
|
27
|
+
firstName: '',
|
|
28
|
+
lastName: '',
|
|
29
|
+
company: '',
|
|
30
|
+
address: '',
|
|
31
|
+
address2: '',
|
|
32
|
+
city: '',
|
|
33
|
+
province: '',
|
|
34
|
+
postalCode: '',
|
|
35
|
+
phone: '',
|
|
36
|
+
countryCode,
|
|
37
|
+
departmentCode: '',
|
|
38
|
+
departmentName: '',
|
|
39
|
+
provinceCode: '',
|
|
40
|
+
provinceName: '',
|
|
41
|
+
districtCode: '',
|
|
42
|
+
districtName: '',
|
|
43
|
+
})
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
2
|
+
import type { Country, Department, District, Province } from '@ecomiq/core'
|
|
3
|
+
import { serverApi } from '../../server'
|
|
4
|
+
|
|
5
|
+
/** Carga cascada geo INEI (PE) + países. */
|
|
6
|
+
export function useCheckoutGeo(countryCode: string, departmentCode: string, provinceCode: string) {
|
|
7
|
+
const [countries, setCountries] = useState<Country[]>([])
|
|
8
|
+
const [departments, setDepartments] = useState<Department[]>([])
|
|
9
|
+
const [provinces, setProvinces] = useState<Province[]>([])
|
|
10
|
+
const [districts, setDistricts] = useState<District[]>([])
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
void serverApi.getCountries().then(setCountries).catch(() => setCountries([]))
|
|
14
|
+
}, [])
|
|
15
|
+
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (countryCode.toUpperCase() !== 'PE') {
|
|
18
|
+
setDepartments([])
|
|
19
|
+
return
|
|
20
|
+
}
|
|
21
|
+
void serverApi
|
|
22
|
+
.getDepartments({ countryCode: 'PE' })
|
|
23
|
+
.then(setDepartments)
|
|
24
|
+
.catch(() => setDepartments([]))
|
|
25
|
+
}, [countryCode])
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (!departmentCode) {
|
|
29
|
+
setProvinces([])
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
void serverApi
|
|
33
|
+
.getProvinces({ countryCode: 'PE', departmentCode })
|
|
34
|
+
.then(setProvinces)
|
|
35
|
+
.catch(() => setProvinces([]))
|
|
36
|
+
}, [departmentCode])
|
|
37
|
+
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (!provinceCode) {
|
|
40
|
+
setDistricts([])
|
|
41
|
+
return
|
|
42
|
+
}
|
|
43
|
+
void serverApi
|
|
44
|
+
.getDistricts({ countryCode: 'PE', provinceCode })
|
|
45
|
+
.then(setDistricts)
|
|
46
|
+
.catch(() => setDistricts([]))
|
|
47
|
+
}, [provinceCode])
|
|
48
|
+
|
|
49
|
+
return { countries, departments, provinces, districts }
|
|
50
|
+
}
|