@zappie/theme-base 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +64 -2
- package/dist/address.d.ts +32 -0
- package/dist/address.js +4 -0
- package/dist/address.js.map +1 -0
- package/dist/cart.d.ts +12 -0
- package/dist/cart.js +1140 -0
- package/dist/cart.js.map +1 -0
- package/dist/catalogue.d.ts +60 -0
- package/dist/catalogue.js +1389 -0
- package/dist/catalogue.js.map +1 -0
- package/dist/checkout.d.ts +36 -0
- package/dist/checkout.js +4 -0
- package/dist/checkout.js.map +1 -0
- package/dist/chunk-2MV6KU3R.js +352 -0
- package/dist/chunk-2MV6KU3R.js.map +1 -0
- package/dist/chunk-FB5DRCU7.js +146 -0
- package/dist/chunk-FB5DRCU7.js.map +1 -0
- package/dist/chunk-IG63ONID.js +139 -0
- package/dist/chunk-IG63ONID.js.map +1 -0
- package/dist/chunk-ILOCSCZL.js +217 -0
- package/dist/chunk-ILOCSCZL.js.map +1 -0
- package/dist/chunk-JFEI2OUZ.js +13 -0
- package/dist/chunk-JFEI2OUZ.js.map +1 -0
- package/dist/chunk-NTJONY3N.js +95 -0
- package/dist/chunk-NTJONY3N.js.map +1 -0
- package/dist/chunk-QWST2TA2.js +22 -0
- package/dist/chunk-QWST2TA2.js.map +1 -0
- package/dist/chunk-USSLDBDY.js +48 -0
- package/dist/chunk-USSLDBDY.js.map +1 -0
- package/dist/chunk-VIAJ27YC.js +59 -0
- package/dist/chunk-VIAJ27YC.js.map +1 -0
- package/dist/host-bridge.d.ts +100 -0
- package/dist/host-bridge.js +4 -0
- package/dist/host-bridge.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/item-frame.d.ts +20 -0
- package/dist/item-frame.js +5 -0
- package/dist/item-frame.js.map +1 -0
- package/dist/item.d.ts +20 -0
- package/dist/item.js +153 -0
- package/dist/item.js.map +1 -0
- package/dist/navigation.d.ts +64 -0
- package/dist/navigation.js +4 -0
- package/dist/navigation.js.map +1 -0
- package/dist/styles.css +842 -0
- package/package.json +73 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Zappie
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,65 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Base storefront theme
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Workstream 06, Stage A, PR 3: the cart now supports configured lines, quantity
|
|
4
|
+
changes, editing, removal, issue fixes, server-quoted totals and the existing
|
|
5
|
+
host payment flow. Empty and loading states use the same foundations overlay.
|
|
6
|
+
|
|
7
|
+
The adapter seeds the existing host pickup/delivery choice. Fulfilment, address,
|
|
8
|
+
schedule and promo editors follow in PR 4; a new delivery address cannot yet be
|
|
9
|
+
entered in this cart. Pickup provides the end-to-end payment test path.
|
|
10
|
+
|
|
11
|
+
The host basket owns initial lines during migration. `connectBasketBridge`
|
|
12
|
+
reconciles complete snapshots into the SDK and mirrors subsequent SDK edits
|
|
13
|
+
back into the same legacy storage bucket. Line identities, choices, notes and
|
|
14
|
+
unavailable-item issues survive. A private SDK import seam makes this atomic;
|
|
15
|
+
no backend API or public cart method changes. Scope changes detach the bridge.
|
|
16
|
+
|
|
17
|
+
`@zappie/theme-base/host-bridge` exposes the temporary provider contract for
|
|
18
|
+
payment, sign-in, customer details and address suggestions. The host checks a
|
|
19
|
+
current quote and synchronized basket, closes the cart through foundations,
|
|
20
|
+
waits for the URL change and cart unmount, and only then starts the existing
|
|
21
|
+
payment flow. Sign-in similarly releases the foundations modal before invoking
|
|
22
|
+
the host auth callback, which restores the cart after authentication.
|
|
23
|
+
Address lookup uses the existing host Places endpoint. Fulfilment must match
|
|
24
|
+
the current host branch and pickup/delivery bucket before checkout.
|
|
25
|
+
|
|
26
|
+
Use `pnpm dev` and open an existing test store with
|
|
27
|
+
`?template=base-next&modal_id=review-menu`. Below 1024px the cart is a full-height
|
|
28
|
+
swipeable drawer; from 1024px it is a centred dialog. Deep-link close retains
|
|
29
|
+
the store URL. All other storefront templates retain their existing cart.
|
|
30
|
+
|
|
31
|
+
`theme.json` copies the approved default-template tokens. Regenerate the scoped
|
|
32
|
+
CSS with `pnpm base-next:tokens`. Explicit `.dark` / `data-theme="dark"` choices
|
|
33
|
+
use dark tokens; the default ignores the operating-system preference.
|
|
34
|
+
|
|
35
|
+
The host adapters in `lib/templates/base-next` reuse the default catalogue,
|
|
36
|
+
manifest and SEO. This package imports only public commerce packages. The
|
|
37
|
+
host-side seam owns its provider and legacy template contract.
|
|
38
|
+
|
|
39
|
+
Registration is build-time gated: production serves base-next only with
|
|
40
|
+
`ZAPPIE_ENABLE_BASE_NEXT=1`. The generated registry contains static gated entries;
|
|
41
|
+
builds do not rewrite tracked files. Workspace themes never enter artifact
|
|
42
|
+
admission. The external-template development host keeps its existing cart.
|
|
43
|
+
|
|
44
|
+
`pnpm base-next:metrics` updates `docs/base-next-metrics.json`, preserving the
|
|
45
|
+
pre-migration baseline. Counts cover the explicit PRD legacy paths and all
|
|
46
|
+
non-test cart source. CSS totals include compiled tokens; legacy shared CSS
|
|
47
|
+
cannot be attributed to cart alone. These incremental metrics are not a claim of
|
|
48
|
+
full cart parity or a completed Stage A reduction.
|
|
49
|
+
|
|
50
|
+
The catalogue is exported from `@zappie/theme-base/catalogue`. A template wraps
|
|
51
|
+
it in `CatalogueNavigationProvider` from `@zappie/theme-base/navigation`, using
|
|
52
|
+
its own router implementation or the framework-independent
|
|
53
|
+
`createUrlNavigation()` default. Item links and URL state come from that
|
|
54
|
+
navigation context. `initialMenu` contains menus/categories and no items;
|
|
55
|
+
the supplied policy chooses eager or progressive reads. `orderAction` supplies
|
|
56
|
+
the Place/Schedule/View label. Search's controlled source performs bounded
|
|
57
|
+
reads, and themeClass reaches mobile overlay portals.
|
|
58
|
+
|
|
59
|
+
## Visit counting
|
|
60
|
+
|
|
61
|
+
A template app calls `countPage` from `@zappie/sdk/visits` after each route
|
|
62
|
+
change, with `enabled: false` in editors and previews. The base screens then
|
|
63
|
+
count successful item adds and cart opens, and attach the visit's source and
|
|
64
|
+
campaign to SDK checkout. The current Next app does not call `countPage`, so
|
|
65
|
+
these events remain disabled there.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { DeliveryAddress } from '@zappie/sdk';
|
|
3
|
+
import { PlacesClient } from '@zappie/sdk/places';
|
|
4
|
+
import { ComponentType, ReactNode } from 'react';
|
|
5
|
+
|
|
6
|
+
type AddressSuggestion = {
|
|
7
|
+
placeId: string;
|
|
8
|
+
address: string;
|
|
9
|
+
sessionToken?: string;
|
|
10
|
+
};
|
|
11
|
+
type AddressLookup = {
|
|
12
|
+
suggest(query: string): Promise<AddressSuggestion[]>;
|
|
13
|
+
reverse?(coordinates: {
|
|
14
|
+
lat: number;
|
|
15
|
+
lng: number;
|
|
16
|
+
}): Promise<DeliveryAddress>;
|
|
17
|
+
resolve?(address: DeliveryAddress, sessionToken?: string): Promise<DeliveryAddress>;
|
|
18
|
+
Map?: ComponentType<{
|
|
19
|
+
address: DeliveryAddress;
|
|
20
|
+
}>;
|
|
21
|
+
};
|
|
22
|
+
declare function AddressLookupProvider({ lookup, children, }: {
|
|
23
|
+
lookup: AddressLookup;
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
}): react_jsx_runtime.JSX.Element;
|
|
26
|
+
declare function useAddressLookup(): AddressLookup;
|
|
27
|
+
declare function createSdkAddressLookup({ places, branchId, }: {
|
|
28
|
+
places: PlacesClient;
|
|
29
|
+
branchId: string;
|
|
30
|
+
}): AddressLookup;
|
|
31
|
+
|
|
32
|
+
export { type AddressLookup, AddressLookupProvider, type AddressSuggestion, createSdkAddressLookup, useAddressLookup };
|
package/dist/address.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"address.js"}
|
package/dist/cart.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `themeClass` lets a template reuse this cart under its own design: the class
|
|
5
|
+
* is added to every overlay root, so the template's tokens (compiled under
|
|
6
|
+
* that class) and its own rules apply. Without it the cart uses the base theme.
|
|
7
|
+
*/
|
|
8
|
+
declare function CartReview({ themeClass }?: {
|
|
9
|
+
themeClass?: string;
|
|
10
|
+
}): react_jsx_runtime.JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { CartReview };
|