@zappie/foundations 0.4.0 → 0.6.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/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # @zappie/foundations
2
2
 
3
+ ## 0.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 9893d0c: Breaking: the site account client is removed. It was deprecated in the previous release because the shopper's Zappie account lives on the accounts portal and the API no longer serves its routes. Both packages take a minor bump because they are below 1.0.
8
+
9
+ `@zappie/sdk/account` no longer exports `createAccount`, `AccountClient`, `ScopeRequiredError`, `NotFoundError` or the account types. `@zappie/sdk/testing` no longer exports `mockAccountFetch`, `accountFixtures`, `MockAccountFixtures` or `MockAccountOptions`. The `@zappie/foundations/account` entry is removed with every part in it.
10
+
11
+ To link to the shopper's account, add `ZappieAccountLink` from `@zappie/foundations`, or build the address with `useZappieAccountUrl()`, `zappieAccountUrl(page)` or `accountsUrl()` from `@zappie/sdk/account`. These stay as they are.
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [9893d0c]
16
+ - Updated dependencies [546e44c]
17
+ - Updated dependencies [490c672]
18
+ - @zappie/sdk@0.6.0
19
+
20
+ ## 0.5.0
21
+
22
+ ### Minor Changes
23
+
24
+ - 6ea8744: The shopper's Zappie account, with their profile, saved cards, wallet and payments, lives on the Zappie accounts portal. A site keeps its orders, its store contact and one "Your Zappie account" row.
25
+
26
+ `@zappie/foundations` adds that row. `ZappieAccountLink` renders an unstyled link labelled "Your Zappie account" to the portal's `/account`, with a return link to the current page. `useZappieAccountUrl()` gives the same address for your own link, and `zappieAccountUrl(page)` builds it for any page. `zappieEnvironment(host)` picks the portal: `staging` for localhost and the loopback addresses, `*.workers.dev`, `*.zappie-sites.dev` and any host with `.stg.` in it, and `production` for every other host, including `<tag>.zappie.shop` and custom domains. `SignInOptions.scopes` no longer accepts `cards` or `payments:read`.
27
+
28
+ The kit's account page and the starter's account page show the row below "Your orders".
29
+
30
+ `createAccount` and its calls, `ScopeRequiredError`, `NotFoundError` and the account types in `@zappie/sdk/account`, `mockAccountFetch` and `accountFixtures` in `@zappie/sdk/testing`, and the parts in `@zappie/foundations/account` are deprecated and removed in the next minor release. The API is removing the routes they call. `accountsUrl` stays as it is.
31
+
32
+ ### Patch Changes
33
+
34
+ - Updated dependencies [6ea8744]
35
+ - @zappie/sdk@0.5.2
36
+
3
37
  ## 0.4.0
4
38
 
5
39
  ### Minor Changes
package/README.md CHANGED
@@ -34,7 +34,6 @@ Want ready-made, styled components instead? Copy them into your project from the
34
34
  | Import | For |
35
35
  | ------------------------------- | --------------------------------------------------------------- |
36
36
  | `@zappie/foundations` | Every part |
37
- | `@zappie/foundations/account` | Wallet, saved card, payment and receipt parts for account pages |
38
37
  | `@zappie/foundations/next` | Keeping overlays in step with Back and Forward in a Next.js app |
39
38
  | `@zappie/foundations/rich-text` | Sanitising and parsing merchant rich text before you render it |
40
39
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/account/index.tsx"],
4
- "mappings": ";AAAA,SAAS,kBAAkB;AAC3B,SAAS,YAA4B;AA2B9B,IAAM,4BAAN,cAAwC,MAAM;AAAA,EAEnD,cAAc;AACZ,UAAM,oEAAoE;AAF5E,SAAS,OAAO;AAGd,SAAK,OAAO;AAAA,EACd;AACF;AACA,eAAe,OAAO,UAAyC;AAC7D,QAAM,IAAI,0BAA0B;AACtC;AACA,eAAe,QAAQ,UAAoD;AACzE,QAAM,IAAI,0BAA0B;AACtC;AACA,IAAM,SAAS,WAGb,SAASA,QAAO,OAAO,KAAK;AAC5B,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,EAAE,QAAQ,QAAQ,iBAAiB;AAAA,IACnC,EAAE,cAAc,UAAU;AAAA,IAC1B;AAAA,EACF;AACF,CAAC;AACD,IAAM,UAAU,WAGd,SAASC,SAAQ,OAAO,KAAK;AAC7B,SAAO;AAAA,IACL;AAAA,IACA;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AAE,QAAQ,SAAS,UAAU,aAAa;",
5
5
  "names": ["SignIn", "SignOut"]
6
6
  }
@@ -0,0 +1,39 @@
1
+ // src/account/zappie-account.tsx
2
+ import { accountsUrl } from "@zappie/sdk/account";
3
+ import { forwardRef, useEffect, useState } from "react";
4
+ import { part } from "../internal/slot.js";
5
+ var LOOPBACK = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]", "::1"]);
6
+ function zappieEnvironment(host) {
7
+ const name = host.trim().toLowerCase().replace(/\.$/, "");
8
+ return LOOPBACK.has(name) || name.endsWith(".localhost") || name.endsWith(".workers.dev") || name.endsWith(".zappie-sites.dev") || name.includes(".stg.") ? "staging" : "production";
9
+ }
10
+ function zappieAccountUrl(page) {
11
+ const back = new URL(page);
12
+ return accountsUrl("/account", zappieEnvironment(back.hostname), {
13
+ returnTo: back
14
+ });
15
+ }
16
+ function useZappieAccountUrl(returnTo) {
17
+ const [url, setUrl] = useState(() => accountsUrl("/account"));
18
+ useEffect(() => {
19
+ setUrl(zappieAccountUrl(new URL(returnTo ?? "", window.location.href)));
20
+ }, [returnTo]);
21
+ return url;
22
+ }
23
+ var ZappieAccountLink = forwardRef(function ZappieAccountLink2({ returnTo, ...props }, ref) {
24
+ const href = useZappieAccountUrl(returnTo);
25
+ return part(
26
+ "a",
27
+ { ...props, children: props.children ?? "Your Zappie account" },
28
+ { href },
29
+ { href, "data-zappie-account": "" },
30
+ ref
31
+ );
32
+ });
33
+ export {
34
+ ZappieAccountLink,
35
+ useZappieAccountUrl,
36
+ zappieAccountUrl,
37
+ zappieEnvironment
38
+ };
39
+ //# sourceMappingURL=zappie-account.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/account/zappie-account.tsx"],
4
+ "mappings": ";AAAA,SAAS,mBAAmB;AAE5B,SAAS,YAAY,WAAW,gBAAgB;AAChD,SAAS,YAA4B;AAErC,IAAM,WAAW,oBAAI,IAAI,CAAC,aAAa,aAAa,SAAS,KAAK,CAAC;AAU5D,SAAS,kBAAkB,MAAiC;AACjE,QAAM,OAAO,KAAK,KAAK,EAAE,YAAY,EAAE,QAAQ,OAAO,EAAE;AACxD,SAAO,SAAS,IAAI,IAAI,KACtB,KAAK,SAAS,YAAY,KAC1B,KAAK,SAAS,cAAc,KAC5B,KAAK,SAAS,mBAAmB,KACjC,KAAK,SAAS,OAAO,IACnB,YACA;AACN;AASO,SAAS,iBAAiB,MAA4B;AAC3D,QAAM,OAAO,IAAI,IAAI,IAAI;AACzB,SAAO,YAAY,YAAY,kBAAkB,KAAK,QAAQ,GAAG;AAAA,IAC/D,UAAU;AAAA,EACZ,CAAC;AACH;AAUO,SAAS,oBAAoB,UAA2B;AAG7D,QAAM,CAAC,KAAK,MAAM,IAAI,SAAS,MAAM,YAAY,UAAU,CAAC;AAC5D,YAAU,MAAM;AACd,WAAO,iBAAiB,IAAI,IAAI,YAAY,IAAI,OAAO,SAAS,IAAI,CAAC,CAAC;AAAA,EACxE,GAAG,CAAC,QAAQ,CAAC;AACb,SAAO;AACT;AAQO,IAAM,oBAAoB,WAM/B,SAASA,mBAAkB,EAAE,UAAU,GAAG,MAAM,GAAG,KAAK;AACxD,QAAM,OAAO,oBAAoB,QAAQ;AACzC,SAAO;AAAA,IACL;AAAA,IACA,EAAE,GAAG,OAAO,UAAU,MAAM,YAAY,sBAAsB;AAAA,IAC9D,EAAE,KAAK;AAAA,IACP,EAAE,MAAM,uBAAuB,GAAG;AAAA,IAClC;AAAA,EACF;AACF,CAAC;",
5
+ "names": ["ZappieAccountLink"]
6
+ }
@@ -0,0 +1,61 @@
1
+ import * as react from 'react';
2
+ import { AllHTMLAttributes, ReactNode, Ref } from 'react';
3
+ import { Dialog } from '@base-ui/react/dialog';
4
+
5
+ type PartOwnedAttributes = "children" | "defaultValue" | "value";
6
+ /**
7
+ * HTML attributes shared by foundation parts, with optional render-function children.
8
+ * Set asChild to merge the part props and ref into a single child element.
9
+ */
10
+ type PartProps<S = Record<string, never>> = Omit<AllHTMLAttributes<HTMLElement>, PartOwnedAttributes> & {
11
+ asChild?: boolean;
12
+ children?: ReactNode | ((state: S) => ReactNode);
13
+ };
14
+
15
+ type Presentation = "dialog" | "drawer" | "sheet";
16
+ type SwipeDirection = "up" | "down" | "left" | "right";
17
+ type SurfaceProps = {
18
+ open: boolean;
19
+ presentation: Presentation;
20
+ swipeDirection: SwipeDirection;
21
+ /** Ids the trigger points at; caller-supplied ids win. */
22
+ contentId: string;
23
+ titleId?: string | undefined;
24
+ trigger: {
25
+ current: HTMLElement | null;
26
+ };
27
+ onOpen: () => void;
28
+ onClose: () => void;
29
+ onEscape?: ((event: KeyboardEvent) => void) | undefined;
30
+ onInteractOutside?: ((event: Event) => void) | undefined;
31
+ forceMount?: true | undefined;
32
+ container?: HTMLElement | null | undefined;
33
+ state: unknown;
34
+ contentProps: PartProps<never>;
35
+ contentRef: Ref<HTMLElement>;
36
+ };
37
+ type Parts = {
38
+ Title: typeof Dialog.Title;
39
+ Close: typeof Dialog.Close;
40
+ };
41
+ declare function useEngineParts(): Parts;
42
+ declare function Surface(props: SurfaceProps & {
43
+ children?: ReactNode;
44
+ }): react.JSX.Element;
45
+ declare const EngineTitle: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, PartOwnedAttributes> & {
46
+ asChild?: boolean;
47
+ children?: ReactNode | ((state: unknown) => ReactNode);
48
+ } & {
49
+ id?: string | undefined;
50
+ state: unknown;
51
+ } & react.RefAttributes<HTMLElement>>;
52
+ declare const EngineClose: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, PartOwnedAttributes> & {
53
+ asChild?: boolean;
54
+ children?: ReactNode | ((state: unknown) => ReactNode);
55
+ } & {
56
+ id?: string | undefined;
57
+ state: unknown;
58
+ } & react.RefAttributes<HTMLElement>>;
59
+
60
+ export { EngineClose as E, EngineTitle as c, Surface as d, useEngineParts as u };
61
+ export type { PartOwnedAttributes as P, SwipeDirection as S, PartProps as a, Presentation as b, SurfaceProps as e };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
- import { P as PartOwnedAttributes, a as PartProps } from './slot-CHfqzPTd.js';
1
+ import { P as PartOwnedAttributes, a as PartProps } from './engine-D2iRshfW.js';
2
+ import { Presentation, SwipeDirection } from './overlay/engine.js';
2
3
  import * as react from 'react';
3
4
  import { HTMLAttributes, ReactNode, ComponentType, ReactElement, KeyboardEvent as KeyboardEvent$1, ImgHTMLAttributes, ChangeEvent, ClipboardEvent } from 'react';
5
+ import { ZappieEnvironment } from '@zappie/sdk/services';
4
6
  import * as _zappie_sdk from '@zappie/sdk';
5
7
  import { Branch as Branch$1, CartLine, CartLineInput, CartIssue, CartFix, Quote, DeliveryAddress, MenuSchedule, CartFulfilment, OptionGroup as OptionGroup$1, Item, Money as Money$1, Choice as Choice$1, MoneyFormatOptions, PaymentMethodKind, Category, Menu, Store, OpeningTime } from '@zappie/sdk';
6
8
  import { useCart } from '@zappie/sdk/react';
7
- import { Presentation, SwipeDirection } from './overlay/engine.js';
8
9
  import { C as CloseOptions, O as OverlayQuery } from './history-BlytQinP.js';
9
10
  import '@base-ui/react/dialog';
10
11
 
@@ -22,7 +23,7 @@ type SignInOptions = {
22
23
  returnTo?: string;
23
24
  prompt?: "none" | "login";
24
25
  display?: "popup" | "redirect" | "auto";
25
- scopes?: ("openid" | "phone" | "profile" | "addresses" | "orders:read" | "offline_access" | "cart" | "wallet" | "cards" | "payments:read")[];
26
+ scopes?: ("openid" | "phone" | "profile" | "addresses" | "orders:read" | "offline_access" | "cart" | "wallet")[];
26
27
  };
27
28
  /**
28
29
  * An error from Account sign-in and sign-out when authentication is not configured.
@@ -63,6 +64,48 @@ declare const Account: {
63
64
  } & react.RefAttributes<HTMLElement>>;
64
65
  };
65
66
 
67
+ /**
68
+ * The Zappie environment a site's page belongs to. A test host is `staging`: localhost and the
69
+ * loopback addresses, `*.workers.dev`, `*.zappie-sites.dev` and any host with `.stg.` in it.
70
+ * Every other host is `production`, including `<tag>.zappie.shop` and custom domains.
71
+ *
72
+ * @param host - The page's host name, such as `location.hostname`.
73
+ * @returns `staging` for a test host, otherwise `production`.
74
+ */
75
+ declare function zappieEnvironment(host: string): ZappieEnvironment;
76
+ /**
77
+ * A link to the shopper's Zappie account on the accounts portal, for the environment of `page`,
78
+ * that brings them back to `page`.
79
+ *
80
+ * @param page - The absolute address of the page to come back to, such as `location.href`.
81
+ * @returns The portal's `/account` address with `page` as its return link.
82
+ */
83
+ declare function zappieAccountUrl(page: string | URL): string;
84
+ /**
85
+ * The address of the shopper's Zappie account for the current page: the accounts portal for this
86
+ * host's environment, with a return link to the page. Before the page mounts it is the production
87
+ * portal with no return link.
88
+ *
89
+ * @param returnTo - The page to come back to. Defaults to the current page.
90
+ * @returns The portal address.
91
+ */
92
+ declare function useZappieAccountUrl(returnTo?: string): string;
93
+ /**
94
+ * The "Your Zappie account" row: a link to the shopper's Zappie account on the accounts portal,
95
+ * where they manage their profile, saved cards, wallet and payments, with a return link to this
96
+ * page. It renders an unstyled `<a>`, so style it like the page's other rows. Its default label
97
+ * is "Your Zappie account".
98
+ */
99
+ declare const ZappieAccountLink: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, PartOwnedAttributes> & {
100
+ asChild?: boolean;
101
+ children?: react.ReactNode | ((state: {
102
+ href: string;
103
+ }) => react.ReactNode);
104
+ } & {
105
+ /** The page to come back to. Defaults to the current page. */
106
+ returnTo?: string;
107
+ } & react.RefAttributes<HTMLElement>>;
108
+
66
109
  type Coordinates = {
67
110
  lat: number;
68
111
  lng: number;
@@ -1060,5 +1103,5 @@ declare const OpenStatus: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttr
1060
1103
  /** The installed @zappie/foundations version. */
1061
1104
  declare const FOUNDATIONS_VERSION: string;
1062
1105
 
1063
- export { Account, AccountNotConfiguredError, Address, Branch, BranchMap, Cart, Choice, DeliveryMap, FOUNDATIONS_VERSION, Fulfilment, Image, ItemForm, Money, OpenStatus, OptionGroup, Otp, Overlay, PartProps, PaymentMethods, Quantity, Schedule, Search, Totals, canOrderAhead, contactLinks, createSearchIndex, deferred, formatOpeningHours, formatWallClock, getOpenStatus, parseWallClock, scheduleSlots, useControllableState, useIntentPreload, useOverlay, zappieSupportUrl };
1106
+ export { Account, AccountNotConfiguredError, Address, Branch, BranchMap, Cart, Choice, DeliveryMap, FOUNDATIONS_VERSION, Fulfilment, Image, ItemForm, Money, OpenStatus, OptionGroup, Otp, Overlay, PartProps, PaymentMethods, Quantity, Schedule, Search, Totals, ZappieAccountLink, canOrderAhead, contactLinks, createSearchIndex, deferred, formatOpeningHours, formatWallClock, getOpenStatus, parseWallClock, scheduleSlots, useControllableState, useIntentPreload, useOverlay, useZappieAccountUrl, zappieAccountUrl, zappieEnvironment, zappieSupportUrl };
1064
1107
  export type { ActiveGroup, AddressState, AddressSuggestion, BranchMapLoadErrorState, BranchMapProps, ContactLink, Customer, Deferred, DeferredIdleOptions, DeferredProps, DeliveryMapProps, ImageProps, IntentPreloadHandlers, ItemFormContext, ItemFormInvalidGroup, ItemFormProps, MapLoadErrorState, PaymentMethod, QuantityProps, QuantityState, ScheduleSlot, ScheduleState, SearchResult, SearchSource, SearchState, SignInOptions, TotalsState, ZappieSupportContext };
package/dist/index.js CHANGED
@@ -3,6 +3,12 @@
3
3
  // src/index.ts
4
4
  import { PACKAGE_VERSION } from "./version.js";
5
5
  import { Account, AccountNotConfiguredError } from "./account/index.js";
6
+ import {
7
+ useZappieAccountUrl,
8
+ ZappieAccountLink,
9
+ zappieAccountUrl,
10
+ zappieEnvironment
11
+ } from "./account/zappie-account.js";
6
12
  import { BranchMap, DeliveryMap } from "./branch-map/index.js";
7
13
  import { Cart, Totals } from "./cart/index.js";
8
14
  import { deferred, useIntentPreload } from "./deferred/index.js";
@@ -47,6 +53,7 @@ export {
47
53
  Schedule,
48
54
  Search,
49
55
  Totals,
56
+ ZappieAccountLink,
50
57
  canOrderAhead,
51
58
  contactLinks,
52
59
  createSearchIndex,
@@ -59,6 +66,9 @@ export {
59
66
  useControllableState,
60
67
  useIntentPreload,
61
68
  useOverlay,
69
+ useZappieAccountUrl,
70
+ zappieAccountUrl,
71
+ zappieEnvironment,
62
72
  zappieSupportUrl
63
73
  };
64
74
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "mappings": ";;;AACA,SAAS,uBAAuB;AAIhC,SAAS,SAAS,iCAAiC;AAEnD,SAAS,WAAW,mBAAmB;AAOvC,SAAS,MAAM,cAAc;AAE7B,SAAS,UAAU,wBAAwB;AAO3C,SAAS,eAAe;AAKxB,SAAS,cAAc;AACvB,SAAS,UAAU,qBAAqB;AAExC,SAAS,kBAAkB;AAE3B,SAAS,4BAA4B;AACrC,cAAc;AACd,SAAS,aAAa;AAEtB,SAAS,aAAa;AACtB,SAAS,WAAW;AACpB,SAAS,SAAS,kBAAkB;AACpC,SAAS,sBAAsB;AAE/B,SAAS,mBAAmB,cAAc;AAE1C,SAAS,cAAc,wBAAwB;AAE/C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,kBAAkB;AAjDpB,IAAM,sBAA8B;",
4
+ "mappings": ";;;AACA,SAAS,uBAAuB;AAIhC,SAAS,SAAS,iCAAiC;AAEnD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,WAAW,mBAAmB;AAOvC,SAAS,MAAM,cAAc;AAE7B,SAAS,UAAU,wBAAwB;AAO3C,SAAS,eAAe;AAKxB,SAAS,cAAc;AACvB,SAAS,UAAU,qBAAqB;AAExC,SAAS,kBAAkB;AAE3B,SAAS,4BAA4B;AACrC,cAAc;AACd,SAAS,aAAa;AAEtB,SAAS,aAAa;AACtB,SAAS,WAAW;AACpB,SAAS,SAAS,kBAAkB;AACpC,SAAS,sBAAsB;AAE/B,SAAS,mBAAmB,cAAc;AAE1C,SAAS,cAAc,wBAAwB;AAE/C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,kBAAkB;AAvDpB,IAAM,sBAA8B;",
5
5
  "names": []
6
6
  }
@@ -1,53 +1,3 @@
1
- import { P as PartOwnedAttributes } from '../slot-CHfqzPTd.js';
2
- import { PartProps } from '../index.js';
3
- import * as react from 'react';
4
- import { ReactNode, Ref } from 'react';
5
- import { Dialog } from '@base-ui/react/dialog';
6
-
7
- type Presentation = "dialog" | "drawer" | "sheet";
8
- type SwipeDirection = "up" | "down" | "left" | "right";
9
- type SurfaceProps = {
10
- open: boolean;
11
- presentation: Presentation;
12
- swipeDirection: SwipeDirection;
13
- /** Ids the trigger points at; caller-supplied ids win. */
14
- contentId: string;
15
- titleId?: string | undefined;
16
- trigger: {
17
- current: HTMLElement | null;
18
- };
19
- onOpen: () => void;
20
- onClose: () => void;
21
- onEscape?: ((event: KeyboardEvent) => void) | undefined;
22
- onInteractOutside?: ((event: Event) => void) | undefined;
23
- forceMount?: true | undefined;
24
- container?: HTMLElement | null | undefined;
25
- state: unknown;
26
- contentProps: PartProps<never>;
27
- contentRef: Ref<HTMLElement>;
28
- };
29
- type Parts = {
30
- Title: typeof Dialog.Title;
31
- Close: typeof Dialog.Close;
32
- };
33
- declare function useEngineParts(): Parts;
34
- declare function Surface(props: SurfaceProps & {
35
- children?: ReactNode;
36
- }): react.JSX.Element;
37
- declare const EngineTitle: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, PartOwnedAttributes> & {
38
- asChild?: boolean;
39
- children?: ReactNode | ((state: unknown) => ReactNode);
40
- } & {
41
- id?: string | undefined;
42
- state: unknown;
43
- } & react.RefAttributes<HTMLElement>>;
44
- declare const EngineClose: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, PartOwnedAttributes> & {
45
- asChild?: boolean;
46
- children?: ReactNode | ((state: unknown) => ReactNode);
47
- } & {
48
- id?: string | undefined;
49
- state: unknown;
50
- } & react.RefAttributes<HTMLElement>>;
51
-
52
- export { EngineClose, EngineTitle, Surface, useEngineParts };
53
- export type { Presentation, SurfaceProps, SwipeDirection };
1
+ export { E as EngineClose, c as EngineTitle, b as Presentation, d as Surface, e as SurfaceProps, S as SwipeDirection, u as useEngineParts } from '../engine-D2iRshfW.js';
2
+ import 'react';
3
+ import '@base-ui/react/dialog';
package/dist/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var PACKAGE_VERSION = true ? "0.4.0" : "0.0.0-development";
2
+ var PACKAGE_VERSION = true ? "0.6.0" : "0.0.0-development";
3
3
  export {
4
4
  PACKAGE_VERSION
5
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zappie/foundations",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "UI-less React primitives for Zappie storefronts: behaviour, state and accessibility without styles.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -9,10 +9,6 @@
9
9
  "types": "./dist/index.d.ts",
10
10
  "import": "./dist/index.js"
11
11
  },
12
- "./account": {
13
- "types": "./dist/account/parts.d.ts",
14
- "import": "./dist/account/parts.js"
15
- },
16
12
  "./next": {
17
13
  "types": "./dist/next.d.ts",
18
14
  "import": "./dist/next.js"
@@ -37,7 +33,7 @@
37
33
  "dependencies": {
38
34
  "@base-ui/react": "^1.9.0",
39
35
  "@googlemaps/markerclusterer": "^2.6.2",
40
- "@zappie/sdk": "^0.5.0"
36
+ "@zappie/sdk": "^0.6.0"
41
37
  },
42
38
  "peerDependencies": {
43
39
  "react": "^18.2.0 || ^19.0.0",
@@ -1,125 +0,0 @@
1
- import { P as PartOwnedAttributes } from '../slot-CHfqzPTd.js';
2
- import { PartProps } from '../index.js';
3
- import * as react from 'react';
4
- import { SavedCard, AccountClient, CustomerPayment, PaymentReceipt, AccountScope, Wallet } from '@zappie/sdk/account';
5
-
6
- /**
7
- * Where an account read stands. `scope_required` means the shopper's sign-in doesn't cover it yet,
8
- * and `not_found` that the card or payment isn't theirs.
9
- */
10
- type AccountReadStatus = "loading" | "ready" | "error" | "scope_required" | "not_found";
11
- /** An account read's status, its data once it has loaded, the error behind a failed read and a retry. */
12
- type AccountReadState<T> = {
13
- status: AccountReadStatus;
14
- data: T | undefined;
15
- error: unknown;
16
- retry: () => void;
17
- };
18
- /** The scope a ScopeRequiredError names, or undefined for any other value. */
19
- declare function missingScope(error: unknown): AccountScope | undefined;
20
- /**
21
- * Load the shopper's Zappie wallet and expose its balances, one per currency with naira first,
22
- * to your render function. The element's `data-state` is the read's status.
23
- */
24
- declare const Wallets: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, PartOwnedAttributes> & {
25
- asChild?: boolean;
26
- children?: react.ReactNode | ((state: AccountReadState<Wallet[]>) => react.ReactNode);
27
- } & {
28
- account: Pick<AccountClient, "wallets">;
29
- } & react.RefAttributes<HTMLElement>>;
30
- /** The saved cards read, and a remove that drops a card from the list once the API removes it. */
31
- type CardsState = AccountReadState<SavedCard[]> & {
32
- remove: (id: string) => Promise<void>;
33
- };
34
- /**
35
- * Load the shopper's saved cards and expose them to your render function with `remove`.
36
- * Pair `remove` with RemoveCard so the shopper confirms first.
37
- */
38
- declare const Cards: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, PartOwnedAttributes> & {
39
- asChild?: boolean;
40
- children?: react.ReactNode | ((state: CardsState) => react.ReactNode);
41
- } & {
42
- account: Pick<AccountClient, "cards" | "removeCard">;
43
- } & react.RefAttributes<HTMLElement>>;
44
- /** Whether the confirmation is open, the removal is running, and the error from a failed removal. */
45
- type RemoveCardState = {
46
- open: boolean;
47
- pending: boolean;
48
- error: unknown;
49
- };
50
- declare function RemoveRoot({ onRemove, onRemoved, ...props }: PartProps<RemoveCardState> & {
51
- /** Removes the card, such as `() => cards.remove(card.id)`. */
52
- onRemove: () => Promise<void>;
53
- onRemoved?: () => void;
54
- }): react.JSX.Element;
55
- /**
56
- * A two-step card removal. Trigger opens the confirmation and Confirm takes focus. Confirm and
57
- * Cancel render only while it is open, and Confirm runs `onRemove` once. A failed removal keeps it
58
- * open with the error. Cancel returns focus to Trigger.
59
- */
60
- declare const RemoveCard: {
61
- Root: typeof RemoveRoot;
62
- Trigger: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, PartOwnedAttributes> & {
63
- asChild?: boolean;
64
- children?: react.ReactNode | ((state: RemoveCardState) => react.ReactNode);
65
- } & react.RefAttributes<HTMLElement>>;
66
- Confirm: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, PartOwnedAttributes> & {
67
- asChild?: boolean;
68
- children?: react.ReactNode | ((state: RemoveCardState) => react.ReactNode);
69
- } & react.RefAttributes<HTMLElement>>;
70
- Cancel: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, PartOwnedAttributes> & {
71
- asChild?: boolean;
72
- children?: react.ReactNode | ((state: RemoveCardState) => react.ReactNode);
73
- } & react.RefAttributes<HTMLElement>>;
74
- };
75
- /** The payments read so far, newest first, and the next page. */
76
- type PaymentsState = AccountReadState<CustomerPayment[]> & {
77
- hasMore: boolean;
78
- loadingMore: boolean;
79
- loadMore: () => void;
80
- };
81
- /**
82
- * Load the shopper's payments at this business, newest first, and expose them to your render
83
- * function. `loadMore` appends the next page while `hasMore` is true.
84
- */
85
- declare const Payments: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, PartOwnedAttributes> & {
86
- asChild?: boolean;
87
- children?: react.ReactNode | ((state: PaymentsState) => react.ReactNode);
88
- } & {
89
- account: Pick<AccountClient, "payments">;
90
- /** Payments a page, from 1 to 50. Defaults to the API's 20. */
91
- limit?: number;
92
- } & react.RefAttributes<HTMLElement>>;
93
- /** The receipt read, and print, which opens the browser's print dialog. */
94
- type ReceiptState = AccountReadState<PaymentReceipt> & {
95
- print: () => void;
96
- };
97
- /**
98
- * Load one payment's receipt and expose it to your render function with `print`. A payment that
99
- * isn't the shopper's, or isn't at this business, reads as `not_found`.
100
- */
101
- declare const Receipt: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, PartOwnedAttributes> & {
102
- asChild?: boolean;
103
- children?: react.ReactNode | ((state: ReceiptState) => react.ReactNode);
104
- } & {
105
- account: Pick<AccountClient, "payment">;
106
- paymentId: string;
107
- } & react.RefAttributes<HTMLElement>>;
108
- /**
109
- * Offer to sign in again when an account read failed for a scope the shopper's sign-in doesn't
110
- * cover. It renders nothing for any other error. Its default label is "Sign in again to see this".
111
- */
112
- declare const ScopeMissing: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttributes<HTMLElement>, PartOwnedAttributes> & {
113
- asChild?: boolean;
114
- children?: react.ReactNode | ((state: {
115
- scope: AccountScope;
116
- }) => react.ReactNode);
117
- } & {
118
- /** The read's error, such as a part's `error` state. */
119
- error: unknown;
120
- /** Starts sign-in, such as `() => customer.signIn()`. */
121
- signIn: () => void;
122
- } & react.RefAttributes<HTMLElement>>;
123
-
124
- export { Cards, Payments, Receipt, RemoveCard, ScopeMissing, Wallets, missingScope };
125
- export type { AccountReadState, AccountReadStatus, CardsState, PaymentsState, ReceiptState, RemoveCardState };
@@ -1,271 +0,0 @@
1
- "use client";
2
-
3
- // src/account/parts.tsx
4
- import {
5
- createContext,
6
- forwardRef,
7
- useCallback,
8
- useContext,
9
- useEffect,
10
- useRef,
11
- useState
12
- } from "react";
13
- import { composeRefs, part } from "../internal/slot.js";
14
- import { jsx } from "react/jsx-runtime";
15
- function missingScope(error) {
16
- const value = error;
17
- return value?.apiCode === "scope_required" ? value.scope : void 0;
18
- }
19
- var statusOf = (error) => missingScope(error) ? "scope_required" : error?.status === 404 ? "not_found" : "error";
20
- function useRead(load, key) {
21
- const [state, setState] = useState({ status: "loading", data: void 0 });
22
- const [attempt, setAttempt] = useState(0);
23
- const latest = useRef(load);
24
- latest.current = load;
25
- useEffect(() => {
26
- let live = true;
27
- setState((current) => ({ status: "loading", data: current.data }));
28
- latest.current().then(
29
- (data) => {
30
- if (live) {
31
- setState({ status: "ready", data });
32
- }
33
- },
34
- (error) => {
35
- if (live) {
36
- setState({ status: statusOf(error), data: void 0, error });
37
- }
38
- }
39
- );
40
- return () => {
41
- live = false;
42
- };
43
- }, [key, attempt]);
44
- return {
45
- status: state.status,
46
- data: state.data,
47
- error: state.error,
48
- retry: useCallback(() => setAttempt((value) => value + 1), []),
49
- set: useCallback((data) => setState({ status: "ready", data }), [])
50
- };
51
- }
52
- var readAttributes = (status) => ({
53
- "data-state": status,
54
- "aria-busy": status === "loading" || void 0
55
- });
56
- var Wallets = forwardRef(function Wallets2({ account, ...props }, ref) {
57
- const { set: _set, ...state } = useRead(() => account.wallets(), account);
58
- return part("div", props, state, readAttributes(state.status), ref);
59
- });
60
- var Cards = forwardRef(function Cards2({ account, ...props }, ref) {
61
- const { set, ...read } = useRead(() => account.cards(), account);
62
- const cards = useRef(read.data);
63
- cards.current = read.data;
64
- const remove = useCallback(
65
- async (id) => {
66
- await account.removeCard(id);
67
- set((cards.current ?? []).filter((card) => card.id !== id));
68
- },
69
- [account, set]
70
- );
71
- const state = { ...read, remove };
72
- return part("div", props, state, readAttributes(state.status), ref);
73
- });
74
- var RemoveContext = createContext(null);
75
- var useRemove = (name) => {
76
- const context = useContext(RemoveContext);
77
- if (!context) {
78
- throw new Error(`RemoveCard.${name} requires RemoveCard.Root`);
79
- }
80
- return context;
81
- };
82
- function RemoveRoot({
83
- onRemove,
84
- onRemoved,
85
- ...props
86
- }) {
87
- const [state, setState] = useState({
88
- open: false,
89
- pending: false,
90
- error: void 0
91
- });
92
- const live = useRef(true);
93
- useEffect(() => {
94
- live.current = true;
95
- return () => {
96
- live.current = false;
97
- };
98
- }, []);
99
- const trigger = useRef(null);
100
- const wasOpen = useRef(false);
101
- useEffect(() => {
102
- if (wasOpen.current && !state.open) {
103
- trigger.current?.focus();
104
- }
105
- wasOpen.current = state.open;
106
- }, [state.open]);
107
- const value = {
108
- state,
109
- trigger,
110
- setOpen: (open) => setState(
111
- (current) => current.pending ? current : { open, pending: false, error: void 0 }
112
- ),
113
- confirm: () => {
114
- if (state.pending) {
115
- return;
116
- }
117
- setState({ open: true, pending: true, error: void 0 });
118
- onRemove().then(
119
- () => {
120
- if (live.current) {
121
- setState({ open: false, pending: false, error: void 0 });
122
- }
123
- onRemoved?.();
124
- },
125
- (error) => {
126
- if (live.current) {
127
- setState({ open: true, pending: false, error });
128
- }
129
- }
130
- );
131
- }
132
- };
133
- return /* @__PURE__ */ jsx(RemoveContext.Provider, { value, children: part("div", props, state, {
134
- role: "group",
135
- "data-state": state.open ? "open" : "closed"
136
- }) });
137
- }
138
- var RemoveTrigger = forwardRef(
139
- function RemoveTrigger2(props, ref) {
140
- const { state, setOpen, trigger } = useRemove("Trigger");
141
- return part(
142
- "button",
143
- props,
144
- state,
145
- {
146
- type: "button",
147
- "aria-expanded": state.open,
148
- onClick: () => setOpen(true)
149
- },
150
- composeRefs(ref, trigger)
151
- );
152
- }
153
- );
154
- var RemoveConfirm = forwardRef(
155
- function RemoveConfirm2(props, ref) {
156
- const { state, confirm } = useRemove("Confirm");
157
- const own = useRef(null);
158
- useEffect(() => {
159
- if (state.open) {
160
- own.current?.focus();
161
- }
162
- }, [state.open]);
163
- if (!state.open) {
164
- return null;
165
- }
166
- return part(
167
- "button",
168
- props,
169
- state,
170
- {
171
- type: "button",
172
- "aria-disabled": state.pending || void 0,
173
- "aria-busy": state.pending || void 0,
174
- onClick: confirm
175
- },
176
- composeRefs(ref, own)
177
- );
178
- }
179
- );
180
- var RemoveCancel = forwardRef(
181
- function RemoveCancel2(props, ref) {
182
- const { state, setOpen } = useRemove("Cancel");
183
- if (!state.open) {
184
- return null;
185
- }
186
- return part(
187
- "button",
188
- props,
189
- state,
190
- {
191
- type: "button",
192
- "aria-disabled": state.pending || void 0,
193
- onClick: () => setOpen(false)
194
- },
195
- ref
196
- );
197
- }
198
- );
199
- var RemoveCard = {
200
- Root: RemoveRoot,
201
- Trigger: RemoveTrigger,
202
- Confirm: RemoveConfirm,
203
- Cancel: RemoveCancel
204
- };
205
- var Payments = forwardRef(function Payments2({ account, limit, ...props }, ref) {
206
- const page = (cursor) => account.payments({
207
- ...limit !== void 0 ? { limit } : {},
208
- ...cursor !== void 0 ? { cursor } : {}
209
- });
210
- const [more, setMore] = useState({ payments: [], cursor: null, loading: false });
211
- const { set: _set, ...read } = useRead(async () => {
212
- const first = await page();
213
- setMore({ payments: [], cursor: first.next_cursor, loading: false });
214
- return first.payments;
215
- }, account);
216
- const loadMore = () => {
217
- const cursor = more.cursor;
218
- if (cursor === null || more.loading) {
219
- return;
220
- }
221
- setMore((current) => ({ ...current, loading: true }));
222
- page(cursor).then(
223
- (next) => setMore((current) => ({
224
- payments: [...current.payments, ...next.payments],
225
- cursor: next.next_cursor,
226
- loading: false
227
- })),
228
- (error) => setMore((current) => ({ ...current, loading: false, error }))
229
- );
230
- };
231
- const state = {
232
- ...read,
233
- data: read.data && [...read.data, ...more.payments],
234
- error: read.error ?? more.error,
235
- hasMore: more.cursor !== null,
236
- loadingMore: more.loading,
237
- loadMore
238
- };
239
- return part("div", props, state, readAttributes(state.status), ref);
240
- });
241
- var Receipt = forwardRef(function Receipt2({ account, paymentId, ...props }, ref) {
242
- const { set: _set, ...read } = useRead(
243
- () => account.payment(paymentId),
244
- `${paymentId}`
245
- );
246
- const state = { ...read, print: () => window.print() };
247
- return part("div", props, state, readAttributes(state.status), ref);
248
- });
249
- var ScopeMissing = forwardRef(function ScopeMissing2({ error, signIn, ...props }, ref) {
250
- const scope = missingScope(error);
251
- if (!scope) {
252
- return null;
253
- }
254
- return part(
255
- "button",
256
- { ...props, children: props.children ?? "Sign in again to see this" },
257
- { scope },
258
- { type: "button", "data-scope": scope, onClick: signIn },
259
- ref
260
- );
261
- });
262
- export {
263
- Cards,
264
- Payments,
265
- Receipt,
266
- RemoveCard,
267
- ScopeMissing,
268
- Wallets,
269
- missingScope
270
- };
271
- //# sourceMappingURL=parts.js.map
@@ -1,6 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/account/parts.tsx"],
4
- "mappings": ";;;AASA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa,YAA4B;AAsM9C;AApLG,SAAS,aAAa,OAA0C;AACrE,QAAM,QAAQ;AACd,SAAO,OAAO,YAAY,mBAAmB,MAAM,QAAQ;AAC7D;AAEA,IAAM,WAAW,CAAC,UAChB,aAAa,KAAK,IACd,mBACC,OAAuC,WAAW,MACjD,cACA;AAER,SAAS,QACP,MACA,KACkD;AAClD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAIvB,EAAE,QAAQ,WAAW,MAAM,OAAU,CAAC;AACzC,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,CAAC;AACxC,QAAM,SAAS,OAAO,IAAI;AAC1B,SAAO,UAAU;AACjB,YAAU,MAAM;AACd,QAAI,OAAO;AACX,aAAS,CAAC,aAAa,EAAE,QAAQ,WAAW,MAAM,QAAQ,KAAK,EAAE;AACjE,WAAO,QAAQ,EAAE;AAAA,MACf,CAAC,SAAS;AACR,YAAI,MAAM;AACR,mBAAS,EAAE,QAAQ,SAAS,KAAK,CAAC;AAAA,QACpC;AAAA,MACF;AAAA,MACA,CAAC,UAAmB;AAClB,YAAI,MAAM;AACR,mBAAS,EAAE,QAAQ,SAAS,KAAK,GAAG,MAAM,QAAW,MAAM,CAAC;AAAA,QAC9D;AAAA,MACF;AAAA,IACF;AACA,WAAO,MAAM;AACX,aAAO;AAAA,IACT;AAAA,EACF,GAAG,CAAC,KAAK,OAAO,CAAC;AACjB,SAAO;AAAA,IACL,QAAQ,MAAM;AAAA,IACd,MAAM,MAAM;AAAA,IACZ,OAAO,MAAM;AAAA,IACb,OAAO,YAAY,MAAM,WA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,OAAO,KAAK,SAAS,KAAK;AAAA,IAC1B,SAAS,KAAK,WAAW;AAAA,IACzB,aAAa,KAAK;AAAA,IAClB;AAAA,EACF;AACA,SAAO,KAAK,OAAO,OAAO,OAAO,eAAe,MAAM,MAAM,GAAG,GAAG;AACpE,CAAC;AAWM,IAAM,UAAU,WAMrB,SAASC,SAAQ,EAAE,SAAS,WAAW,GAAG,MAAM,GAAG,KAAK;AACxD,QAAM,EAAE,KAAK,MAAM,GAAG,KAAK,IAAI;AAAA,IAC7B,MAAM,QAAQ,QAAQ,SAAS;AAAA,IAC/B,GAAG,SAAS;AAAA,EACd;AACA,QAAM,QAAQ,EAAE,GAAG,MAAM,OAAO,MAAM,OAAO,MAAM,EAAE;AACrD,SAAO,KAAK,OAAO,OAAO,OAAO,eAAe,MAAM,MAAM,GAAG,GAAG;AACpE,CAAC;AAMM,IAAM,eAAe,WAQ1B,SAASC,cAAa,EAAE,OAAO,QAAQ,GAAG,MAAM,GAAG,KAAK;AACxD,QAAM,QAAQ,aAAa,KAAK;AAChC,MAAI,CAAC,OAAO;AACV,WAAO;AAAA,EACT;AACA,SAAO;AAAA,IACL;AAAA,IACA,EAAE,GAAG,OAAO,UAAU,MAAM,YAAY,4BAA4B;AAAA,IACpE,EAAE,MAAM;AAAA,IACR,EAAE,MAAM,UAAU,cAAc,OAAO,SAAS,OAAO;AAAA,IACvD;AAAA,EACF;AACF,CAAC;",
5
- "names": ["Wallets", "Cards", "RemoveTrigger", "RemoveConfirm", "RemoveCancel", "Payments", "Receipt", "ScopeMissing"]
6
- }
@@ -1,13 +0,0 @@
1
- import { AllHTMLAttributes, ReactNode } from 'react';
2
-
3
- type PartOwnedAttributes = "children" | "defaultValue" | "value";
4
- /**
5
- * HTML attributes shared by foundation parts, with optional render-function children.
6
- * Set asChild to merge the part props and ref into a single child element.
7
- */
8
- type PartProps<S = Record<string, never>> = Omit<AllHTMLAttributes<HTMLElement>, PartOwnedAttributes> & {
9
- asChild?: boolean;
10
- children?: ReactNode | ((state: S) => ReactNode);
11
- };
12
-
13
- export type { PartOwnedAttributes as P, PartProps as a };