@zappie/foundations 0.2.2 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/index.d.ts +23 -3
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/status/contact.js +24 -1
- package/dist/status/contact.js.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @zappie/foundations
|
|
2
2
|
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- acc553a: The kit's account page and the starter's account page show a "Problem with a payment? Message Zappie" link, a WhatsApp link to Zappie support from `zappieSupportUrl`. The kit's account page takes an optional `store`, and the branch's `name`, to name them in the message. `zappieSupportUrl` takes a branch without a name, and parts left `undefined`, so it type-checks under `exactOptionalPropertyTypes`.
|
|
8
|
+
|
|
9
|
+
## 0.3.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- b884697: `zappieSupportUrl(context)` in `@zappie/foundations` builds a WhatsApp link to Zappie support for a shopper with a problem such as a payment. Its message starts with "Hi Zappie support," and names the store, the branch when the store has more than one, the order and the page, as the classic storefront does. `ZAPPIE_SUPPORT_WHATSAPP` in `@zappie/sdk/services` is the number it opens.
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [b884697]
|
|
18
|
+
- @zappie/sdk@0.4.0
|
|
19
|
+
|
|
3
20
|
## 0.2.2
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Presentation, SwipeDirection } from './overlay/engine.js';
|
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { HTMLAttributes, ReactNode, ComponentType, ReactElement, KeyboardEvent as KeyboardEvent$1, ImgHTMLAttributes, ChangeEvent, ClipboardEvent } from 'react';
|
|
5
5
|
import * as _zappie_sdk from '@zappie/sdk';
|
|
6
|
-
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, OpeningTime } from '@zappie/sdk';
|
|
6
|
+
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';
|
|
7
7
|
import { useCart } from '@zappie/sdk/react';
|
|
8
8
|
import { C as CloseOptions, O as OverlayQuery } from './history-BlytQinP.js';
|
|
9
9
|
import '@base-ui/react/dialog';
|
|
@@ -959,6 +959,26 @@ type ContactLink = {
|
|
|
959
959
|
* @returns The contact links in that order, or none.
|
|
960
960
|
*/
|
|
961
961
|
declare function contactLinks(branch: Pick<Branch$1, "phone" | "socialLinks">): ContactLink[];
|
|
962
|
+
/** What a message to Zappie support names. Each part is optional. */
|
|
963
|
+
type ZappieSupportContext = {
|
|
964
|
+
/** The store. The message names the branch only when the store has more than one. */
|
|
965
|
+
store?: Partial<Pick<Store, "name" | "slug" | "branches">> | undefined;
|
|
966
|
+
/** The shopper's branch. */
|
|
967
|
+
branch?: Partial<Pick<Branch$1, "name">> | undefined;
|
|
968
|
+
/** The reference of the order the shopper needs help with. */
|
|
969
|
+
order?: string | undefined;
|
|
970
|
+
/** The address of the page the shopper is on. */
|
|
971
|
+
page?: string | undefined;
|
|
972
|
+
};
|
|
973
|
+
/**
|
|
974
|
+
* A WhatsApp link to Zappie support, for a shopper with a problem such as a payment. The message
|
|
975
|
+
* starts with "Hi Zappie support," and names the store, branch, order and page it is given, so
|
|
976
|
+
* support can find them.
|
|
977
|
+
*
|
|
978
|
+
* @param context - The store, branch, order and page to name.
|
|
979
|
+
* @returns A `https://wa.me/` link to Zappie support with the message filled in.
|
|
980
|
+
*/
|
|
981
|
+
declare function zappieSupportUrl({ store, branch, order, page, }?: ZappieSupportContext): string;
|
|
962
982
|
|
|
963
983
|
/**
|
|
964
984
|
* Parse a zero-padded HH:mm or HH:mm:ss wall-clock value without applying a time zone.
|
|
@@ -1040,5 +1060,5 @@ declare const OpenStatus: react.ForwardRefExoticComponent<Omit<react.AllHTMLAttr
|
|
|
1040
1060
|
/** The installed @zappie/foundations version. */
|
|
1041
1061
|
declare const FOUNDATIONS_VERSION: string;
|
|
1042
1062
|
|
|
1043
|
-
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 };
|
|
1044
|
-
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 };
|
|
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 };
|
|
1064
|
+
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
|
@@ -18,7 +18,7 @@ import { Otp } from "./otp/input.js";
|
|
|
18
18
|
import { Overlay, useOverlay } from "./overlay/react.js";
|
|
19
19
|
import { PaymentMethods } from "./payment/methods.js";
|
|
20
20
|
import { createSearchIndex, Search } from "./search/index.js";
|
|
21
|
-
import { contactLinks } from "./status/contact.js";
|
|
21
|
+
import { contactLinks, zappieSupportUrl } from "./status/contact.js";
|
|
22
22
|
import {
|
|
23
23
|
canOrderAhead,
|
|
24
24
|
formatOpeningHours,
|
|
@@ -58,6 +58,7 @@ export {
|
|
|
58
58
|
scheduleSlots,
|
|
59
59
|
useControllableState,
|
|
60
60
|
useIntentPreload,
|
|
61
|
-
useOverlay
|
|
61
|
+
useOverlay,
|
|
62
|
+
zappieSupportUrl
|
|
62
63
|
};
|
|
63
64
|
//# 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,
|
|
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;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/status/contact.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/status/contact.ts
|
|
2
|
+
import { ZAPPIE_SUPPORT_WHATSAPP } from "@zappie/sdk/services";
|
|
2
3
|
function contactLinks(branch) {
|
|
3
4
|
const links = [];
|
|
4
5
|
const phone = branch.phone?.replace(/[^\d+]/g, "");
|
|
@@ -13,7 +14,29 @@ function contactLinks(branch) {
|
|
|
13
14
|
}
|
|
14
15
|
return links;
|
|
15
16
|
}
|
|
17
|
+
function zappieSupportUrl({
|
|
18
|
+
store,
|
|
19
|
+
branch,
|
|
20
|
+
order,
|
|
21
|
+
page
|
|
22
|
+
} = {}) {
|
|
23
|
+
const name = branch?.name;
|
|
24
|
+
const details = [
|
|
25
|
+
store?.name && `Business: ${store.name}${store.slug ? ` (@${store.slug})` : ""}`,
|
|
26
|
+
(store?.branches?.length ?? 0) > 1 && name && `Branch: ${name.charAt(0).toUpperCase()}${name.slice(1)}`,
|
|
27
|
+
order && `Order: ${order}`,
|
|
28
|
+
page && `Page: ${page}`
|
|
29
|
+
].filter(Boolean);
|
|
30
|
+
const message = [
|
|
31
|
+
"Hi Zappie support,",
|
|
32
|
+
...details.length ? ["", ...details] : [],
|
|
33
|
+
"",
|
|
34
|
+
"I need help with:"
|
|
35
|
+
].join("\n");
|
|
36
|
+
return `https://wa.me/${ZAPPIE_SUPPORT_WHATSAPP}?text=${encodeURIComponent(message)}`;
|
|
37
|
+
}
|
|
16
38
|
export {
|
|
17
|
-
contactLinks
|
|
39
|
+
contactLinks,
|
|
40
|
+
zappieSupportUrl
|
|
18
41
|
};
|
|
19
42
|
//# sourceMappingURL=contact.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/status/contact.ts"],
|
|
4
|
-
"mappings": ";
|
|
4
|
+
"mappings": ";AACA,SAAS,+BAA+B;AAcjC,SAAS,aACd,QACe;AACf,QAAM,QAAuB,CAAC;AAC9B,QAAM,QAAQ,OAAO,OAAO,QAAQ,WAAW,EAAE;AACjD,MAAI,SAAS,KAAK,KAAK,KAAK,GAAG;AAC7B,UAAM,KAAK,EAAE,MAAM,SAAS,OAAO,QAAQ,MAAM,OAAO,KAAK,GAAG,CAAC;AAAA,EACnE;AACA,QAAM,UAAU,OAAO,aAAa;AAAA,IAClC,CAAC,SAAS,KAAK,KAAK,YAAY,MAAM;AAAA,EACxC;AACA,MAAI,SAAS;AACX,UAAM,KAAK,EAAE,MAAM,WAAW,OAAO,kBAAkB,MAAM,QAAQ,IAAI,CAAC;AAAA,EAC5E;AACA,SAAO;AACT;AAsBO,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,IAA0B,CAAC,GAAW;AACpC,QAAM,OAAO,QAAQ;AACrB,QAAM,UAAU;AAAA,IACd,OAAO,QACL,aAAa,MAAM,IAAI,GAAG,MAAM,OAAO,MAAM,MAAM,IAAI,MAAM,EAAE;AAAA,KAChE,OAAO,UAAU,UAAU,KAAK,KAC/B,QACA,WAAW,KAAK,OAAO,CAAC,EAAE,YAAY,CAAC,GAAG,KAAK,MAAM,CAAC,CAAC;AAAA,IACzD,SAAS,UAAU,KAAK;AAAA,IACxB,QAAQ,SAAS,IAAI;AAAA,EACvB,EAAE,OAAO,OAAO;AAChB,QAAM,UAAU;AAAA,IACd;AAAA,IACA,GAAI,QAAQ,SAAS,CAAC,IAAI,GAAG,OAAO,IAAI,CAAC;AAAA,IACzC;AAAA,IACA;AAAA,EACF,EAAE,KAAK,IAAI;AACX,SAAO,iBAAiB,uBAAuB,SAAS,mBAAmB,OAAO,CAAC;AACrF;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zappie/foundations",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "UI-less React primitives for Zappie storefronts: behaviour, state and accessibility without styles.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@base-ui/react": "^1.9.0",
|
|
35
35
|
"@googlemaps/markerclusterer": "^2.6.2",
|
|
36
|
-
"@zappie/sdk": "^0.
|
|
36
|
+
"@zappie/sdk": "^0.4.0"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"react": "^18.2.0 || ^19.0.0",
|