@zappie/sdk 0.18.0 → 0.19.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 +14 -0
- package/dist/account/index.js +1 -5
- package/dist/account/index.js.map +1 -1
- package/dist/account/url.js +1 -23
- package/dist/account/url.js.map +1 -1
- package/dist/branches/index.js +1 -43
- package/dist/branches/index.js.map +1 -1
- package/dist/cart/branch.js +1 -82
- package/dist/cart/branch.js.map +1 -1
- package/dist/cart/errors.js +1 -12
- package/dist/cart/errors.js.map +1 -1
- package/dist/cart/held.js +1 -17
- package/dist/cart/held.js.map +1 -1
- package/dist/cart/index.js +1 -782
- package/dist/cart/index.js.map +1 -1
- package/dist/cart/item.js +1 -11
- package/dist/cart/item.js.map +1 -1
- package/dist/cart/preview.js +1 -31
- package/dist/cart/preview.js.map +1 -1
- package/dist/cart/price.js +1 -24
- package/dist/cart/price.js.map +1 -1
- package/dist/cart/quote-client.js +1 -107
- package/dist/cart/quote-client.js.map +1 -1
- package/dist/cart/quote-response.js +1 -214
- package/dist/cart/quote-response.js.map +1 -1
- package/dist/cart/reconcile.js +1 -107
- package/dist/cart/reconcile.js.map +1 -1
- package/dist/cart/source-menu.js +1 -20
- package/dist/cart/source-menu.js.map +1 -1
- package/dist/cart/storage.js +1 -175
- package/dist/cart/storage.js.map +1 -1
- package/dist/cart/validate.js +1 -270
- package/dist/cart/validate.js.map +1 -1
- package/dist/cart/wire.js +1 -42
- package/dist/cart/wire.js.map +1 -1
- package/dist/cart/working-set.js +1 -79
- package/dist/cart/working-set.js.map +1 -1
- package/dist/checkout/client.js +1 -116
- package/dist/checkout/client.js.map +1 -1
- package/dist/checkout/embed.js +1 -247
- package/dist/checkout/embed.js.map +1 -1
- package/dist/checkout/error.js +1 -19
- package/dist/checkout/error.js.map +1 -1
- package/dist/checkout/index.js +1 -12
- package/dist/checkout/index.js.map +1 -1
- package/dist/checkout/react.js +1 -45
- package/dist/checkout/react.js.map +1 -1
- package/dist/checkout/readiness.js +1 -35
- package/dist/checkout/readiness.js.map +1 -1
- package/dist/checkout/sdk.js +1 -8
- package/dist/checkout/sdk.js.map +1 -1
- package/dist/checkout/session.js +1 -57
- package/dist/checkout/session.js.map +1 -1
- package/dist/checkout-defaults/index.js +1 -205
- package/dist/checkout-defaults/index.js.map +1 -1
- package/dist/client.js +1 -255
- package/dist/client.js.map +1 -1
- package/dist/config/index.d.ts +5 -0
- package/dist/config/index.js +1 -12
- package/dist/config/index.js.map +1 -1
- package/dist/config.js +1 -27
- package/dist/config.js.map +1 -1
- package/dist/customer/client.js +1 -180
- package/dist/customer/client.js.map +1 -1
- package/dist/customer/error.js +1 -18
- package/dist/customer/error.js.map +1 -1
- package/dist/customer/index.js +1 -7
- package/dist/customer/index.js.map +1 -1
- package/dist/customer/navigation.js +1 -39
- package/dist/customer/navigation.js.map +1 -1
- package/dist/customer/react.js +1 -69
- package/dist/customer/react.js.map +1 -1
- package/dist/customer/reorder.js +1 -60
- package/dist/customer/reorder.js.map +1 -1
- package/dist/customer/request.js +1 -37
- package/dist/customer/request.js.map +1 -1
- package/dist/customer/watch-order.js +1 -79
- package/dist/customer/watch-order.js.map +1 -1
- package/dist/debug.js +1 -77
- package/dist/debug.js.map +1 -1
- package/dist/display/index.js +1 -30
- package/dist/display/index.js.map +1 -1
- package/dist/error-pages/art.js +1 -10
- package/dist/error-pages/art.js.map +1 -1
- package/dist/error-pages/index.js +2 -103
- package/dist/error-pages/index.js.map +1 -1
- package/dist/error-pages/react.js +1 -65
- package/dist/error-pages/react.js.map +1 -1
- package/dist/errors.js +1 -70
- package/dist/errors.js.map +1 -1
- package/dist/in-venue/bill.js +1 -69
- package/dist/in-venue/bill.js.map +1 -1
- package/dist/in-venue/client.js +1 -119
- package/dist/in-venue/client.js.map +1 -1
- package/dist/in-venue/error.js +1 -18
- package/dist/in-venue/error.js.map +1 -1
- package/dist/in-venue/index.js +1 -23
- package/dist/in-venue/index.js.map +1 -1
- package/dist/in-venue/react/bill-page.js +1 -350
- package/dist/in-venue/react/bill-page.js.map +1 -1
- package/dist/in-venue/react/in-venue-page.js +1 -102
- package/dist/in-venue/react/in-venue-page.js.map +1 -1
- package/dist/in-venue/react/order-panel.js +1 -283
- package/dist/in-venue/react/order-panel.js.map +1 -1
- package/dist/in-venue/react/pay-point-page.js +1 -50
- package/dist/in-venue/react/pay-point-page.js.map +1 -1
- package/dist/in-venue/react/shared.js +2 -171
- package/dist/in-venue/react/shared.js.map +1 -1
- package/dist/in-venue/react/table-menus-page.js +1 -151
- package/dist/in-venue/react/table-menus-page.js.map +1 -1
- package/dist/in-venue/react.js +1 -14
- package/dist/in-venue/react.js.map +1 -1
- package/dist/in-venue/table.js +1 -62
- package/dist/in-venue/table.js.map +1 -1
- package/dist/in-venue/watch.js +1 -82
- package/dist/in-venue/watch.js.map +1 -1
- package/dist/index.js +1 -31
- package/dist/index.js.map +1 -1
- package/dist/integrations/index.js +1 -78
- package/dist/integrations/index.js.map +1 -1
- package/dist/internal/abort.js +1 -28
- package/dist/internal/abort.js.map +1 -1
- package/dist/internal/cache.js +1 -141
- package/dist/internal/cache.js.map +1 -1
- package/dist/internal/customer-http.js +1 -75
- package/dist/internal/customer-http.js.map +1 -1
- package/dist/internal/emitter.js +1 -26
- package/dist/internal/emitter.js.map +1 -1
- package/dist/internal/image-widths.js +1 -5
- package/dist/internal/image-widths.js.map +1 -1
- package/dist/internal/money-math.js +1 -29
- package/dist/internal/money-math.js.map +1 -1
- package/dist/internal/perk-hold.js +1 -34
- package/dist/internal/perk-hold.js.map +1 -1
- package/dist/internal/remembered-address.js +1 -68
- package/dist/internal/remembered-address.js.map +1 -1
- package/dist/internal/return-path.js +1 -16
- package/dist/internal/return-path.js.map +1 -1
- package/dist/internal/service-url.js +1 -10
- package/dist/internal/service-url.js.map +1 -1
- package/dist/internal.js +1 -8
- package/dist/internal.js.map +1 -1
- package/dist/loyalty/cart.js +1 -55
- package/dist/loyalty/cart.js.map +1 -1
- package/dist/loyalty/client.js +1 -88
- package/dist/loyalty/client.js.map +1 -1
- package/dist/loyalty/index.js +1 -12
- package/dist/loyalty/index.js.map +1 -1
- package/dist/loyalty/react.js +1 -199
- package/dist/loyalty/react.js.map +1 -1
- package/dist/loyalty/release.js +1 -42
- package/dist/loyalty/release.js.map +1 -1
- package/dist/money.js +1 -46
- package/dist/money.js.map +1 -1
- package/dist/navigation/index.js +1 -55
- package/dist/navigation/index.js.map +1 -1
- package/dist/navigation/react.js +1 -17
- package/dist/navigation/react.js.map +1 -1
- package/dist/navigation-progress/index.js +1 -41
- package/dist/navigation-progress/index.js.map +1 -1
- package/dist/options/index.js +1 -103
- package/dist/options/index.js.map +1 -1
- package/dist/persist/catalogue.js +1 -205
- package/dist/persist/catalogue.js.map +1 -1
- package/dist/places/client.js +1 -96
- package/dist/places/client.js.map +1 -1
- package/dist/places/error.js +1 -18
- package/dist/places/error.js.map +1 -1
- package/dist/places/index.js +1 -7
- package/dist/places/index.js.map +1 -1
- package/dist/places/request.js +1 -39
- package/dist/places/request.js.map +1 -1
- package/dist/places/sdk.js +1 -9
- package/dist/places/sdk.js.map +1 -1
- package/dist/places/search.js +1 -79
- package/dist/places/search.js.map +1 -1
- package/dist/pricing/index.js +1 -80
- package/dist/pricing/index.js.map +1 -1
- package/dist/react/cart.js +1 -40
- package/dist/react/cart.js.map +1 -1
- package/dist/react/changes.js +1 -93
- package/dist/react/changes.js.map +1 -1
- package/dist/react/hooks.js +1 -90
- package/dist/react/hooks.js.map +1 -1
- package/dist/react/index.js +1 -19
- package/dist/react/index.js.map +1 -1
- package/dist/react/provider.js +1 -33
- package/dist/react/provider.js.map +1 -1
- package/dist/react/rollback.js +1 -89
- package/dist/react/rollback.js.map +1 -1
- package/dist/receipts/index.js +1 -48
- package/dist/receipts/index.js.map +1 -1
- package/dist/redirect/index.js +1 -30
- package/dist/redirect/index.js.map +1 -1
- package/dist/server/auth/crypto.js +1 -105
- package/dist/server/auth/crypto.js.map +1 -1
- package/dist/server/auth/jwt.js +1 -203
- package/dist/server/auth/jwt.js.map +1 -1
- package/dist/server/auth/session-store.js +1 -45
- package/dist/server/auth/session-store.js.map +1 -1
- package/dist/server/chosen-branch.js +1 -69
- package/dist/server/chosen-branch.js.map +1 -1
- package/dist/server/edge-cache.js +1 -394
- package/dist/server/edge-cache.js.map +1 -1
- package/dist/server/edge-snapshot.js +1 -199
- package/dist/server/edge-snapshot.js.map +1 -1
- package/dist/server/index.d.ts +5 -0
- package/dist/server/index.js +1 -113
- package/dist/server/index.js.map +1 -1
- package/dist/server/security.js +1 -135
- package/dist/server/security.js.map +1 -1
- package/dist/server/sign-in.js +1 -17
- package/dist/server/sign-in.js.map +1 -1
- package/dist/server/storefront-url/build-v1.js +1 -65
- package/dist/server/storefront-url/build-v1.js.map +1 -1
- package/dist/server/storefront-url/build-v2.js +1 -50
- package/dist/server/storefront-url/build-v2.js.map +1 -1
- package/dist/server/storefront-url/build.js +1 -18
- package/dist/server/storefront-url/build.js.map +1 -1
- package/dist/server/storefront-url/canonical.js +1 -35
- package/dist/server/storefront-url/canonical.js.map +1 -1
- package/dist/server/storefront-url/contract.js +1 -24
- package/dist/server/storefront-url/contract.js.map +1 -1
- package/dist/server/storefront-url/index.js +1 -15
- package/dist/server/storefront-url/index.js.map +1 -1
- package/dist/server/storefront-url/installation.js +1 -57
- package/dist/server/storefront-url/installation.js.map +1 -1
- package/dist/server/storefront-url/params.js +1 -88
- package/dist/server/storefront-url/params.js.map +1 -1
- package/dist/server/storefront-url/parse-v1.js +1 -137
- package/dist/server/storefront-url/parse-v1.js.map +1 -1
- package/dist/server/storefront-url/parse-v2.js +1 -84
- package/dist/server/storefront-url/parse-v2.js.map +1 -1
- package/dist/server/storefront-url/parse.js +1 -8
- package/dist/server/storefront-url/parse.js.map +1 -1
- package/dist/server/storefront-url/public-id.js +1 -7
- package/dist/server/storefront-url/public-id.js.map +1 -1
- package/dist/server/storefront-url/redirect.js +1 -43
- package/dist/server/storefront-url/redirect.js.map +1 -1
- package/dist/server/storefront-url/sign-in.js +1 -17
- package/dist/server/storefront-url/sign-in.js.map +1 -1
- package/dist/server/storefront-url/types.js +1 -55
- package/dist/server/storefront-url/types.js.map +1 -1
- package/dist/server/storefront-url/url.js +1 -73
- package/dist/server/storefront-url/url.js.map +1 -1
- package/dist/server/webhook.js +1 -95
- package/dist/server/webhook.js.map +1 -1
- package/dist/services/index.js +1 -18
- package/dist/services/index.js.map +1 -1
- package/dist/site-closed/index.js +1 -38
- package/dist/site-closed/index.js.map +1 -1
- package/dist/site-config/helpers.js +1 -58
- package/dist/site-config/helpers.js.map +1 -1
- package/dist/site-config/sections.js +1 -114
- package/dist/site-config/sections.js.map +1 -1
- package/dist/site-config/types.js +1 -31
- package/dist/site-config/types.js.map +1 -1
- package/dist/site-config/validate.js +1 -215
- package/dist/site-config/validate.js.map +1 -1
- package/dist/site-error/index.js +1 -32
- package/dist/site-error/index.js.map +1 -1
- package/dist/site-error/react.js +1 -14
- package/dist/site-error/react.js.map +1 -1
- package/dist/studio/index.js +1 -315
- package/dist/template/index.js +1 -88
- package/dist/template/index.js.map +1 -1
- package/dist/template/react.js +1 -111
- package/dist/template/react.js.map +1 -1
- package/dist/testing/index.js +1 -459
- package/dist/testing/loyalty.js +1 -109
- package/dist/testing/loyalty.js.map +1 -1
- package/dist/transport/category-page.js +1 -24
- package/dist/transport/category-page.js.map +1 -1
- package/dist/transport/mappers.js +1 -356
- package/dist/transport/mappers.js.map +1 -1
- package/dist/transport/presentation.js +1 -67
- package/dist/transport/presentation.js.map +1 -1
- package/dist/transport/quote-body.js +1 -23
- package/dist/transport/quote-body.js.map +1 -1
- package/dist/transport/rest.js +1 -327
- package/dist/transport/rest.js.map +1 -1
- package/dist/transport/search.js +1 -36
- package/dist/transport/search.js.map +1 -1
- package/dist/transport/selected-menu.js +1 -83
- package/dist/transport/selected-menu.js.map +1 -1
- package/dist/transport/store.js +1 -132
- package/dist/transport/store.js.map +1 -1
- package/dist/uploads/index.js +1 -36
- package/dist/uploads/index.js.map +1 -1
- package/dist/url/index.js +1 -15
- package/dist/url/index.js.map +1 -1
- package/dist/visits/index.js +1 -61
- package/dist/visits/index.js.map +1 -1
- package/dist/visits/page-views.js +1 -102
- package/dist/visits/page-views.js.map +1 -1
- package/dist/vite/index.js +3 -373
- package/package.json +1 -1
|
@@ -1,66 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { menuRoute } from "./contract.js";
|
|
3
|
-
import { publicInstallationPath } from "./installation.js";
|
|
4
|
-
import { v1Params } from "./params.js";
|
|
5
|
-
import "./types.js";
|
|
6
|
-
import { encode } from "./url.js";
|
|
7
|
-
var routePathV1 = (route, options = {}) => {
|
|
8
|
-
switch (route.type) {
|
|
9
|
-
case "order-menu":
|
|
10
|
-
return `/order/${encode(route.business)}${route.branch ? `/${encode(route.branch)}` : ""}${route.cataloguePath ? "/products" : ""}`;
|
|
11
|
-
case "item": {
|
|
12
|
-
const branch = route.branch ?? options.installation?.defaultBranch;
|
|
13
|
-
return branch ? `/order/${encode(route.business)}/${encode(branch)}/products/${encode(route.item)}` : `/order/${encode(route.business)}`;
|
|
14
|
-
}
|
|
15
|
-
case "cart":
|
|
16
|
-
case "checkout":
|
|
17
|
-
case "checkout-return":
|
|
18
|
-
case "sign-in":
|
|
19
|
-
return routePathV1(menuRoute(route), options);
|
|
20
|
-
case "content-page":
|
|
21
|
-
return `/order/${encode(route.business)}${route.branch ? `/${encode(route.branch)}` : ""}/pages/${encode(route.slug)}`;
|
|
22
|
-
case "dine-in":
|
|
23
|
-
return `/dine-in/${encode(route.order)}`;
|
|
24
|
-
case "pay-point":
|
|
25
|
-
return `/pay-point/${encode(route.payPoint)}`;
|
|
26
|
-
case "beacon":
|
|
27
|
-
return `/beacons/${encode(route.beacon)}`;
|
|
28
|
-
case "link":
|
|
29
|
-
return `/links/${encode(route.link)}`;
|
|
30
|
-
case "pay-session":
|
|
31
|
-
return `/pay/${encode(route.session)}`;
|
|
32
|
-
case "payment-step":
|
|
33
|
-
return `/payment/${encode(route.payment)}${route.step === "payment" ? "" : `/${route.step}`}`;
|
|
34
|
-
case "payment-card":
|
|
35
|
-
return `/payment/card/${encode(route.transaction)}`;
|
|
36
|
-
case "profile":
|
|
37
|
-
return `/profile/${route.page}${route.order ? `/${encode(route.order)}` : ""}`;
|
|
38
|
-
case "explore":
|
|
39
|
-
return route.home ? "/" : "/explore";
|
|
40
|
-
case "unknown":
|
|
41
|
-
return route.pathname || "/";
|
|
42
|
-
case "dine-in-menus":
|
|
43
|
-
return "/dine-in/menus";
|
|
44
|
-
case "self-service-menus":
|
|
45
|
-
return "/self-service/menus";
|
|
46
|
-
case "collect-payment":
|
|
47
|
-
case "reservation":
|
|
48
|
-
return `/${route.type}`;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
var buildV1 = (route, options = {}) => {
|
|
52
|
-
const internal = routePathV1(route, options);
|
|
53
|
-
const publicRoute = route.type === "item" && route.branch === void 0 && options.installation?.defaultBranch ? { ...route, branch: options.installation.defaultBranch } : route;
|
|
54
|
-
const pathname = publicInstallationPath(
|
|
55
|
-
internal,
|
|
56
|
-
publicRoute,
|
|
57
|
-
options.installation
|
|
58
|
-
);
|
|
59
|
-
const query = v1Params(route).toString();
|
|
60
|
-
return `${pathname}${query ? `?${query}` : ""}`;
|
|
61
|
-
};
|
|
62
|
-
export {
|
|
63
|
-
buildV1,
|
|
64
|
-
routePathV1
|
|
65
|
-
};
|
|
1
|
+
import{menuRoute}from"./contract.js";import{publicInstallationPath}from"./installation.js";import{v1Params}from"./params.js";import"./types.js";import{encode}from"./url.js";var routePathV1=(route,options={})=>{switch(route.type){case"order-menu":return`/order/${encode(route.business)}${route.branch?`/${encode(route.branch)}`:""}${route.cataloguePath?"/products":""}`;case"item":{const branch=route.branch??options.installation?.defaultBranch;return branch?`/order/${encode(route.business)}/${encode(branch)}/products/${encode(route.item)}`:`/order/${encode(route.business)}`}case"cart":case"checkout":case"checkout-return":case"sign-in":return routePathV1(menuRoute(route),options);case"content-page":return`/order/${encode(route.business)}${route.branch?`/${encode(route.branch)}`:""}/pages/${encode(route.slug)}`;case"dine-in":return`/dine-in/${encode(route.order)}`;case"pay-point":return`/pay-point/${encode(route.payPoint)}`;case"beacon":return`/beacons/${encode(route.beacon)}`;case"link":return`/links/${encode(route.link)}`;case"pay-session":return`/pay/${encode(route.session)}`;case"payment-step":return`/payment/${encode(route.payment)}${route.step==="payment"?"":`/${route.step}`}`;case"payment-card":return`/payment/card/${encode(route.transaction)}`;case"profile":return`/profile/${route.page}${route.order?`/${encode(route.order)}`:""}`;case"explore":return route.home?"/":"/explore";case"unknown":return route.pathname||"/";case"dine-in-menus":return"/dine-in/menus";case"self-service-menus":return"/self-service/menus";case"collect-payment":case"reservation":return`/${route.type}`}};var buildV1=(route,options={})=>{const internal=routePathV1(route,options);const publicRoute=route.type==="item"&&route.branch===void 0&&options.installation?.defaultBranch?{...route,branch:options.installation.defaultBranch}:route;const pathname=publicInstallationPath(internal,publicRoute,options.installation);const query=v1Params(route).toString();return`${pathname}${query?`?${query}`:""}`};export{buildV1,routePathV1};
|
|
66
2
|
//# sourceMappingURL=build-v1.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/server/storefront-url/build-v1.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAAA,OAAS,cAAiB,gBAC1B,OAAS,2BAA8B,oBACvC,OAAS,aAAgB,cACzB,MAAgE,aAChE,OAAS,WAAc,WAEhB,IAAM,YAAc,CACzB,MACA,QAAgC,CAAC,IACtB,CACX,OAAQ,MAAM,KAAM,CAClB,IAAK,aACH,MAAO,UAAU,OAAO,MAAM,QAAQ,CAAC,GAAG,MAAM,OAAS,IAAI,OAAO,MAAM,MAAM,CAAC,GAAK,EAAE,GAAG,MAAM,cAAgB,YAAc,EAAE,GACnI,IAAK,OAAQ,CACX,MAAM,OAAS,MAAM,QAAU,QAAQ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AM,SAAW,QACjB,QAAQ,cAAc,cAClB,CAAE,GAAG,MAAO,OAAQ,QAAQ,aAAa,aAAc,EACvD,MACN,MAAM,SAAW,uBACf,SACA,YACA,QAAQ,YACV,EACA,MAAM,MAAQ,SAAS,KAAK,EAAE,SAAS,EACvC,MAAO,GAAG,QAAQ,GAAG,MAAQ,IAAI,KAAK,GAAK,EAAE,EAC/C",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,51 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { buildV1 } from "./build-v1.js";
|
|
3
|
-
import { canonicalRoute } from "./canonical.js";
|
|
4
|
-
import { v2Params } from "./params.js";
|
|
5
|
-
import { categoryHash, publicId } from "./public-id.js";
|
|
6
|
-
import { encode } from "./url.js";
|
|
7
|
-
var profilePath = (route) => {
|
|
8
|
-
if (route.page === "orders") {
|
|
9
|
-
return `/orders${route.order ? `/${encode(publicId(route.order, "ord"))}` : ""}`;
|
|
10
|
-
}
|
|
11
|
-
if (route.page === "edit") {
|
|
12
|
-
return "/account";
|
|
13
|
-
}
|
|
14
|
-
const page = route.page === "add-store-credit" ? "store-credit" : route.page;
|
|
15
|
-
return `/account/${page}`;
|
|
16
|
-
};
|
|
17
|
-
var routePathV2 = (route) => {
|
|
18
|
-
switch (route.type) {
|
|
19
|
-
case "order-menu":
|
|
20
|
-
return "/";
|
|
21
|
-
case "item":
|
|
22
|
-
return `/item/${encode(publicId(route.item, "item"))}`;
|
|
23
|
-
case "cart":
|
|
24
|
-
return "/cart";
|
|
25
|
-
case "checkout":
|
|
26
|
-
return "/checkout";
|
|
27
|
-
case "checkout-return":
|
|
28
|
-
return "/checkout/return";
|
|
29
|
-
case "sign-in":
|
|
30
|
-
return "/sign-in";
|
|
31
|
-
case "content-page":
|
|
32
|
-
return `/pages/${encode(route.slug)}`;
|
|
33
|
-
case "profile":
|
|
34
|
-
return profilePath(route);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
var buildV2 = (route, options) => {
|
|
38
|
-
const installation = options.installation;
|
|
39
|
-
const canonical = canonicalRoute(route, installation);
|
|
40
|
-
if (!("business" in canonical) && canonical.type !== "profile") {
|
|
41
|
-
return buildV1(canonical, options);
|
|
42
|
-
}
|
|
43
|
-
const pathname = routePathV2(canonical);
|
|
44
|
-
const query = v2Params(canonical, installation).toString();
|
|
45
|
-
const hash = categoryHash(canonical.state.categoryId);
|
|
46
|
-
return `${pathname}${query ? `?${query}` : ""}${hash}`;
|
|
47
|
-
};
|
|
48
|
-
export {
|
|
49
|
-
buildV2
|
|
50
|
-
};
|
|
1
|
+
import{buildV1}from"./build-v1.js";import{canonicalRoute}from"./canonical.js";import{v2Params}from"./params.js";import{categoryHash,publicId}from"./public-id.js";import{encode}from"./url.js";var profilePath=route=>{if(route.page==="orders"){return`/orders${route.order?`/${encode(publicId(route.order,"ord"))}`:""}`}if(route.page==="edit"){return"/account"}const page=route.page==="add-store-credit"?"store-credit":route.page;return`/account/${page}`};var routePathV2=route=>{switch(route.type){case"order-menu":return"/";case"item":return`/item/${encode(publicId(route.item,"item"))}`;case"cart":return"/cart";case"checkout":return"/checkout";case"checkout-return":return"/checkout/return";case"sign-in":return"/sign-in";case"content-page":return`/pages/${encode(route.slug)}`;case"profile":return profilePath(route)}};var buildV2=(route,options)=>{const installation=options.installation;const canonical=canonicalRoute(route,installation);if(!("business"in canonical)&&canonical.type!=="profile"){return buildV1(canonical,options)}const pathname=routePathV2(canonical);const query=v2Params(canonical,installation).toString();const hash=categoryHash(canonical.state.categoryId);return`${pathname}${query?`?${query}`:""}${hash}`};export{buildV2};
|
|
51
2
|
//# sourceMappingURL=build-v2.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/server/storefront-url/build-v2.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAAA,OAAS,YAAe,gBACxB,OAAS,mBAAsB,iBAC/B,OAAS,aAAgB,cACzB,OAAS,aAAc,aAAgB,iBAMvC,OAAS,WAAc,WAEvB,IAAM,YAAe,OAAyD,CAC5E,GAAI,MAAM,OAAS,SAAU,CAC3B,MAAO,UAAU,MAAM,MAAQ,IAAI,OAAO,SAAS,MAAM,MAAO,KAAK,CAAC,CAAC,GAAK,EAAE,EAChF,CACA,GAAI,MAAM,OAAS,OAAQ,CACzB,MAAO,UACT,CACA,MAAM,KAAO,MAAM,OAAS,mBAAqB,eAAiB,MAAM,KACxE,MAAO,YAAY,IAAI,EACzB,EAEA,IAAM,YACJ,OACG,CACH,OAAQ,MAAM,KAAM,CAClB,IAAK,aACH,MAAO,IACT,IAAK,OACH,MAAO,SAAS,OAAO,SAAS,MAAM,KAAM,MAAM,CAAC,CAAC,GACtD,IAAK,OACH,MAAO,QACT,IAAK,WACH,MAAO,YACT,IAAK,kBACH,MAAO,mBACT,IAAK,UACH,MAAO,WACT,IAAK,eACH,MAAO,UAAU,OAAO,MAAM,IAAI,CAAC,GACrC,IAAK,UACH,OAAO,YAAY,KAAK,CAC5B,CACF,EAEO,IAAM,QAAU,CACrB,MACA,UACG,CACH,MAAM,aAAe,QAAQ,aAC7B,MAAM,UAAY,eAAe,MAAO,YAAY,EACpD,GAAI,EAAE,aAAc,YAAc,UAAU,OAAS,UAAW,CAC9D,OAAO,QAAQ,UAAW,OAAO,CACnC,CACA,MAAM,SAAW,YAAY,SAAS,EACtC,MAAM,MAAQ,SAAS,UAAW,YAAY,EAAE,SAAS,EACzD,MAAM,KAAO,aAAa,UAAU,MAAM,UAAU,EACpD,MAAO,GAAG,QAAQ,GAAG,MAAQ,IAAI,KAAK,GAAK,EAAE,GAAG,IAAI,EACtD",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { buildV1 } from "./build-v1.js";
|
|
3
|
-
import { buildV2 } from "./build-v2.js";
|
|
4
|
-
import { usesV2 } from "./contract.js";
|
|
5
|
-
var buildStorefrontUrl = (route, options = {}) => {
|
|
6
|
-
const value = usesV2(options) ? buildV2(route, options) : buildV1(route, options);
|
|
7
|
-
if (!options.origin) {
|
|
8
|
-
return value;
|
|
9
|
-
}
|
|
10
|
-
try {
|
|
11
|
-
return new URL(value, options.origin).toString();
|
|
12
|
-
} catch {
|
|
13
|
-
return value;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
export {
|
|
17
|
-
buildStorefrontUrl
|
|
18
|
-
};
|
|
1
|
+
import{buildV1}from"./build-v1.js";import{buildV2}from"./build-v2.js";import{usesV2}from"./contract.js";var buildStorefrontUrl=(route,options={})=>{const value=usesV2(options)?buildV2(route,options):buildV1(route,options);if(!options.origin){return value}try{return new URL(value,options.origin).toString()}catch{return value}};export{buildStorefrontUrl};
|
|
19
2
|
//# sourceMappingURL=build.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/server/storefront-url/build.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAAA,OAAS,YAAe,gBACxB,OAAS,YAAe,gBACxB,OAAS,WAAc,gBAWhB,IAAM,mBAAqB,CAChC,MACA,QAAgC,CAAC,IAC9B,CACH,MAAM,MAAQ,OAAO,OAAO,EACxB,QAAQ,MAAO,OAAO,EACtB,QAAQ,MAAO,OAAO,EAC1B,GAAI,CAAC,QAAQ,OAAQ,CACnB,OAAO,KACT,CACA,GAAI,CACF,OAAO,IAAI,IAAI,MAAO,QAAQ,MAAM,EAAE,SAAS,CACjD,MAAQ,CACN,OAAO,KACT,CACF",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,36 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { CART_MODAL, CHECKOUT_MODAL, SIGN_IN_MODALS } from "./contract.js";
|
|
3
|
-
import { signInFromOverlay } from "./sign-in.js";
|
|
4
|
-
import { ITEM_MODAL_PREFIX } from "./url.js";
|
|
5
|
-
var canonicalRoute = (route, installation) => {
|
|
6
|
-
if (route.type !== "order-menu") {
|
|
7
|
-
return route;
|
|
8
|
-
}
|
|
9
|
-
const { authModalId, modalId } = route.state;
|
|
10
|
-
if (authModalId && SIGN_IN_MODALS.includes(authModalId)) {
|
|
11
|
-
return signInFromOverlay(route, installation);
|
|
12
|
-
}
|
|
13
|
-
const common = {
|
|
14
|
-
business: route.business,
|
|
15
|
-
...route.branch !== void 0 ? { branch: route.branch } : {},
|
|
16
|
-
state: route.state
|
|
17
|
-
};
|
|
18
|
-
if (modalId?.startsWith(ITEM_MODAL_PREFIX)) {
|
|
19
|
-
return {
|
|
20
|
-
type: "item",
|
|
21
|
-
...common,
|
|
22
|
-
item: modalId.slice(ITEM_MODAL_PREFIX.length)
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
if (modalId === CART_MODAL || modalId === CHECKOUT_MODAL) {
|
|
26
|
-
return {
|
|
27
|
-
type: modalId === CART_MODAL ? "cart" : "checkout",
|
|
28
|
-
...common
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
return route;
|
|
32
|
-
};
|
|
33
|
-
export {
|
|
34
|
-
canonicalRoute
|
|
35
|
-
};
|
|
1
|
+
import{CART_MODAL,CHECKOUT_MODAL,SIGN_IN_MODALS}from"./contract.js";import{signInFromOverlay}from"./sign-in.js";import{ITEM_MODAL_PREFIX}from"./url.js";var canonicalRoute=(route,installation)=>{if(route.type!=="order-menu"){return route}const{authModalId,modalId}=route.state;if(authModalId&&SIGN_IN_MODALS.includes(authModalId)){return signInFromOverlay(route,installation)}const common={business:route.business,...route.branch!==void 0?{branch:route.branch}:{},state:route.state};if(modalId?.startsWith(ITEM_MODAL_PREFIX)){return{type:"item",...common,item:modalId.slice(ITEM_MODAL_PREFIX.length)}}if(modalId===CART_MODAL||modalId===CHECKOUT_MODAL){return{type:modalId===CART_MODAL?"cart":"checkout",...common}}return route};export{canonicalRoute};
|
|
36
2
|
//# sourceMappingURL=canonical.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/server/storefront-url/canonical.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAAA,OAAS,WAAY,eAAgB,mBAAsB,gBAC3D,OAAS,sBAAyB,eAElC,OAAS,sBAAyB,WAE3B,IAAM,eAAiB,CAC5B,MACA,eACoB,CACpB,GAAI,MAAM,OAAS,aAAc,CAC/B,OAAO,KACT,CACA,KAAM,CAAE,YAAa,OAAQ,EAAI,MAAM,MACvC,GAAI,aAAe,eAAe,SAAS,WAAW,EAAG,CACvD,OAAO,kBAAkB,MAAO,YAAY,CAC9C,CACA,MAAM,OAAS,CACb,SAAU,MAAM,SAChB,GAAI,MAAM,SAAW,OAAY,CAAE,OAAQ,MAAM,MAAO,EAAI,CAAC,EAC7D,MAAO,MAAM,KACf,EACA,GAAI,SAAS,WAAW,iBAAiB,EAAG,CAC1C,MAAO,CACL,KAAM,OACN,GAAG,OACH,KAAM,QAAQ,MAAM,kBAAkB,MAAM,CAC9C,CACF,CACA,GAAI,UAAY,YAAc,UAAY,eAAgB,CACxD,MAAO,CACL,KAAM,UAAY,WAAa,OAAS,WACxC,GAAG,MACL,CACF,CACA,OAAO,KACT",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,25 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var CART_MODAL = "review-menu";
|
|
3
|
-
var CHECKOUT_MODAL = "payment";
|
|
4
|
-
var SIGN_IN_MODAL = "send-otp";
|
|
5
|
-
var SIGN_IN_MODALS = [
|
|
6
|
-
SIGN_IN_MODAL,
|
|
7
|
-
"verify-otp",
|
|
8
|
-
"update-profile"
|
|
9
|
-
];
|
|
10
|
-
var usesV2 = (options) => options.contract !== "v1" && options.installation !== void 0;
|
|
11
|
-
var menuRoute = (route) => ({
|
|
12
|
-
type: "order-menu",
|
|
13
|
-
business: route.business,
|
|
14
|
-
...route.branch !== void 0 ? { branch: route.branch } : {},
|
|
15
|
-
state: route.state
|
|
16
|
-
});
|
|
17
|
-
export {
|
|
18
|
-
CART_MODAL,
|
|
19
|
-
CHECKOUT_MODAL,
|
|
20
|
-
SIGN_IN_MODAL,
|
|
21
|
-
SIGN_IN_MODALS,
|
|
22
|
-
menuRoute,
|
|
23
|
-
usesV2
|
|
24
|
-
};
|
|
1
|
+
var CART_MODAL="review-menu";var CHECKOUT_MODAL="payment";var SIGN_IN_MODAL="send-otp";var SIGN_IN_MODALS=[SIGN_IN_MODAL,"verify-otp","update-profile"];var usesV2=options=>options.contract!=="v1"&&options.installation!==void 0;var menuRoute=route=>({type:"order-menu",business:route.business,...route.branch!==void 0?{branch:route.branch}:{},state:route.state});export{CART_MODAL,CHECKOUT_MODAL,SIGN_IN_MODAL,SIGN_IN_MODALS,menuRoute,usesV2};
|
|
25
2
|
//# sourceMappingURL=contract.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/server/storefront-url/contract.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAMO,IAAM,WAAa,cACnB,IAAM,eAAiB,UACvB,IAAM,cAAgB,WACtB,IAAM,eAAoC,CAC/C,cACA,aACA,gBACF,EAEO,IAAM,OACX,SAEA,QAAQ,WAAa,MAAQ,QAAQ,eAAiB,OAEjD,IAAM,UACX,QAIsD,CACtD,KAAM,aACN,SAAU,MAAM,SAChB,GAAI,MAAM,SAAW,OAAY,CAAE,OAAQ,MAAM,MAAO,EAAI,CAAC,EAC7D,MAAO,MAAM,KACf",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { buildStorefrontUrl } from "./build.js";
|
|
3
|
-
import { parseStorefrontUrl } from "./parse.js";
|
|
4
|
-
import { storefrontRedirect } from "./redirect.js";
|
|
5
|
-
import {
|
|
6
|
-
STOREFRONT_QUERY_PARAMETERS,
|
|
7
|
-
STOREFRONT_V1_QUERY_PARAMETERS
|
|
8
|
-
} from "./types.js";
|
|
9
|
-
export {
|
|
10
|
-
STOREFRONT_QUERY_PARAMETERS,
|
|
11
|
-
STOREFRONT_V1_QUERY_PARAMETERS,
|
|
12
|
-
buildStorefrontUrl,
|
|
13
|
-
parseStorefrontUrl,
|
|
14
|
-
storefrontRedirect
|
|
15
|
-
};
|
|
1
|
+
import{buildStorefrontUrl}from"./build.js";import{parseStorefrontUrl}from"./parse.js";import{storefrontRedirect}from"./redirect.js";import{STOREFRONT_QUERY_PARAMETERS,STOREFRONT_V1_QUERY_PARAMETERS}from"./types.js";export{STOREFRONT_QUERY_PARAMETERS,STOREFRONT_V1_QUERY_PARAMETERS,buildStorefrontUrl,parseStorefrontUrl,storefrontRedirect};
|
|
16
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/server/storefront-url/index.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAAA,OAAS,uBAA0B,aACnC,OAAS,uBAA0B,aACnC,OAAS,uBAA0B,gBACnC,OACE,4BACA,mCAOK",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
|
@@ -1,58 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import "./types.js";
|
|
3
|
-
import { decode, encode } from "./url.js";
|
|
4
|
-
var normalizedPath = (pathname) => {
|
|
5
|
-
const trimmed = pathname.replace(/\/+$/, "");
|
|
6
|
-
return trimmed || "/";
|
|
7
|
-
};
|
|
8
|
-
var installationPath = (pathname, installation) => {
|
|
9
|
-
if (!installation) {
|
|
10
|
-
return pathname;
|
|
11
|
-
}
|
|
12
|
-
const business = `/order/${encode(installation.business)}`;
|
|
13
|
-
if (pathname === "/") {
|
|
14
|
-
return business;
|
|
15
|
-
}
|
|
16
|
-
if (pathname === "/order") {
|
|
17
|
-
return installation.defaultBranch ? `${business}/${encode(installation.defaultBranch)}` : business;
|
|
18
|
-
}
|
|
19
|
-
if (pathname.startsWith("/pages/")) {
|
|
20
|
-
return `${business}${pathname}`;
|
|
21
|
-
}
|
|
22
|
-
if (!pathname.startsWith("/order/") || pathname === business || pathname.startsWith(`${business}/`)) {
|
|
23
|
-
return pathname;
|
|
24
|
-
}
|
|
25
|
-
const suffix = pathname.slice("/order".length);
|
|
26
|
-
if (installation.defaultBranch && (suffix === "/products" || suffix.startsWith("/products/") || suffix.startsWith("/pages/"))) {
|
|
27
|
-
return `${business}/${encode(installation.defaultBranch)}${suffix}`;
|
|
28
|
-
}
|
|
29
|
-
return `${business}${suffix}`;
|
|
30
|
-
};
|
|
31
|
-
var publicInstallationPath = (pathname, route, installation) => {
|
|
32
|
-
if (!installation || !("business" in route)) {
|
|
33
|
-
return pathname;
|
|
34
|
-
}
|
|
35
|
-
if (route.business !== installation.business) {
|
|
36
|
-
return pathname;
|
|
37
|
-
}
|
|
38
|
-
if (route.type === "content-page" && !route.branch) {
|
|
39
|
-
return `/pages/${encode(route.slug)}`;
|
|
40
|
-
}
|
|
41
|
-
if (route.type === "order-menu" && !route.branch) {
|
|
42
|
-
return "/";
|
|
43
|
-
}
|
|
44
|
-
const branchPrefix = `/order/${encode(route.business)}/${encode(route.branch ?? "")}`;
|
|
45
|
-
const suffix = pathname.slice(branchPrefix.length);
|
|
46
|
-
if (route.branch === installation.defaultBranch) {
|
|
47
|
-
return `/order${suffix}`;
|
|
48
|
-
}
|
|
49
|
-
return `/order/${encode(route.branch ?? "")}${suffix}`;
|
|
50
|
-
};
|
|
51
|
-
var segment = (parts, index) => decode(parts[index] ?? "");
|
|
52
|
-
export {
|
|
53
|
-
installationPath,
|
|
54
|
-
normalizedPath,
|
|
55
|
-
publicInstallationPath,
|
|
56
|
-
segment
|
|
57
|
-
};
|
|
1
|
+
import"./types.js";import{decode,encode}from"./url.js";var normalizedPath=pathname=>{const trimmed=pathname.replace(/\/+$/,"");return trimmed||"/"};var installationPath=(pathname,installation)=>{if(!installation){return pathname}const business=`/order/${encode(installation.business)}`;if(pathname==="/"){return business}if(pathname==="/order"){return installation.defaultBranch?`${business}/${encode(installation.defaultBranch)}`:business}if(pathname.startsWith("/pages/")){return`${business}${pathname}`}if(!pathname.startsWith("/order/")||pathname===business||pathname.startsWith(`${business}/`)){return pathname}const suffix=pathname.slice("/order".length);if(installation.defaultBranch&&(suffix==="/products"||suffix.startsWith("/products/")||suffix.startsWith("/pages/"))){return`${business}/${encode(installation.defaultBranch)}${suffix}`}return`${business}${suffix}`};var publicInstallationPath=(pathname,route,installation)=>{if(!installation||!("business"in route)){return pathname}if(route.business!==installation.business){return pathname}if(route.type==="content-page"&&!route.branch){return`/pages/${encode(route.slug)}`}if(route.type==="order-menu"&&!route.branch){return"/"}const branchPrefix=`/order/${encode(route.business)}/${encode(route.branch??"")}`;const suffix=pathname.slice(branchPrefix.length);if(route.branch===installation.defaultBranch){return`/order${suffix}`}return`/order/${encode(route.branch??"")}${suffix}`};var segment=(parts,index)=>decode(parts[index]??"");export{installationPath,normalizedPath,publicInstallationPath,segment};
|
|
58
2
|
//# sourceMappingURL=installation.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/server/storefront-url/installation.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAAA,MAAkE,aAClE,OAAS,OAAQ,WAAc,WAExB,IAAM,eAAkB,UAAqB,CAClD,MAAM,QAAU,SAAS,QAAQ,OAAQ,EAAE,EAC3C,OAAO,SAAW,GACpB,EAEO,IAAM,iBAAmB,CAC9B,SACA,eACG,CACH,GAAI,CAAC,aAAc,CACjB,OAAO,QACT,CACA,MAAM,SAAW,UAAU,OAAO,aAAa,QAAQ,CAAC,GACxD,GAAI,WAAa,IAAK,CACpB,OAAO,QACT,CACA,GAAI,WAAa,SAAU,CACzB,OAAO,aAAa,cAChB,G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_MODAL, SIGN_IN_MODAL } from "./contract.js";
|
|
3
|
-
import { publicId } from "./public-id.js";
|
|
4
|
-
import { STATE_FIELDS } from "./url.js";
|
|
5
|
-
var stateParams = (route) => {
|
|
6
|
-
const params = new URLSearchParams(route.state.query);
|
|
7
|
-
const state = route.state;
|
|
8
|
-
for (const [key, field] of Object.entries(STATE_FIELDS)) {
|
|
9
|
-
const value = state[field];
|
|
10
|
-
if (value !== void 0) {
|
|
11
|
-
params.set(key, value);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
if (state.mode) {
|
|
15
|
-
params.set("pickup", String(state.mode === "pickup"));
|
|
16
|
-
}
|
|
17
|
-
return params;
|
|
18
|
-
};
|
|
19
|
-
var v1Params = (route) => {
|
|
20
|
-
const params = stateParams(route);
|
|
21
|
-
if (route.type === "item") {
|
|
22
|
-
params.delete("modal_id");
|
|
23
|
-
} else if (route.type === "cart") {
|
|
24
|
-
params.set("modal_id", CART_MODAL);
|
|
25
|
-
} else if (route.type === "checkout") {
|
|
26
|
-
params.set("modal_id", CHECKOUT_MODAL);
|
|
27
|
-
} else if (route.type === "sign-in") {
|
|
28
|
-
params.set("auth_modal_id", SIGN_IN_MODAL);
|
|
29
|
-
if (route.returnTo !== void 0) {
|
|
30
|
-
params.set("return", route.returnTo);
|
|
31
|
-
}
|
|
32
|
-
} else if (route.type === "checkout-return" && route.session !== void 0) {
|
|
33
|
-
params.set("session", route.session);
|
|
34
|
-
}
|
|
35
|
-
params.sort();
|
|
36
|
-
return params;
|
|
37
|
-
};
|
|
38
|
-
var v2Params = (route, installation) => {
|
|
39
|
-
const params = stateParams(route);
|
|
40
|
-
const menu = params.get("menu_id");
|
|
41
|
-
if (menu) {
|
|
42
|
-
params.set("menu", publicId(menu, "menu"));
|
|
43
|
-
}
|
|
44
|
-
for (const key of [
|
|
45
|
-
"menu_id",
|
|
46
|
-
"category_id",
|
|
47
|
-
"pickup",
|
|
48
|
-
"menu_layout",
|
|
49
|
-
"catalogue_search",
|
|
50
|
-
"catalogue_categories",
|
|
51
|
-
"template",
|
|
52
|
-
"catalog_rendering",
|
|
53
|
-
"prefetch",
|
|
54
|
-
"ws",
|
|
55
|
-
"env",
|
|
56
|
-
"business",
|
|
57
|
-
"business_tag",
|
|
58
|
-
"switched_branch",
|
|
59
|
-
"success",
|
|
60
|
-
"auto_scroll",
|
|
61
|
-
"preview",
|
|
62
|
-
"modal_id"
|
|
63
|
-
]) {
|
|
64
|
-
params.delete(key);
|
|
65
|
-
}
|
|
66
|
-
if ("business" in route) {
|
|
67
|
-
if (route.branch && route.branch !== installation.defaultBranch) {
|
|
68
|
-
params.set("branch", route.branch);
|
|
69
|
-
} else {
|
|
70
|
-
params.delete("branch");
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
if (route.type === "sign-in") {
|
|
74
|
-
params.delete("auth_modal_id");
|
|
75
|
-
if (route.returnTo !== void 0) {
|
|
76
|
-
params.set("return", route.returnTo);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
if (route.type === "checkout-return" && route.session !== void 0) {
|
|
80
|
-
params.set("session", route.session);
|
|
81
|
-
}
|
|
82
|
-
params.sort();
|
|
83
|
-
return params;
|
|
84
|
-
};
|
|
85
|
-
export {
|
|
86
|
-
v1Params,
|
|
87
|
-
v2Params
|
|
88
|
-
};
|
|
1
|
+
import{CART_MODAL,CHECKOUT_MODAL,SIGN_IN_MODAL}from"./contract.js";import{publicId}from"./public-id.js";import{STATE_FIELDS}from"./url.js";var stateParams=route=>{const params=new URLSearchParams(route.state.query);const state=route.state;for(const[key,field]of Object.entries(STATE_FIELDS)){const value=state[field];if(value!==void 0){params.set(key,value)}}if(state.mode){params.set("pickup",String(state.mode==="pickup"))}return params};var v1Params=route=>{const params=stateParams(route);if(route.type==="item"){params.delete("modal_id")}else if(route.type==="cart"){params.set("modal_id",CART_MODAL)}else if(route.type==="checkout"){params.set("modal_id",CHECKOUT_MODAL)}else if(route.type==="sign-in"){params.set("auth_modal_id",SIGN_IN_MODAL);if(route.returnTo!==void 0){params.set("return",route.returnTo)}}else if(route.type==="checkout-return"&&route.session!==void 0){params.set("session",route.session)}params.sort();return params};var v2Params=(route,installation)=>{const params=stateParams(route);const menu=params.get("menu_id");if(menu){params.set("menu",publicId(menu,"menu"))}for(const key of["menu_id","category_id","pickup","menu_layout","catalogue_search","catalogue_categories","template","catalog_rendering","prefetch","ws","env","business","business_tag","switched_branch","success","auto_scroll","preview","modal_id"]){params.delete(key)}if("business"in route){if(route.branch&&route.branch!==installation.defaultBranch){params.set("branch",route.branch)}else{params.delete("branch")}}if(route.type==="sign-in"){params.delete("auth_modal_id");if(route.returnTo!==void 0){params.set("return",route.returnTo)}}if(route.type==="checkout-return"&&route.session!==void 0){params.set("session",route.session)}params.sort();return params};export{v1Params,v2Params};
|
|
89
2
|
//# sourceMappingURL=params.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/server/storefront-url/params.ts"],
|
|
4
|
-
"mappings": "
|
|
4
|
+
"mappings": "AAAA,OAAS,WAAY,eAAgB,kBAAqB,gBAC1D,OAAS,aAAgB,iBAEzB,OAAS,iBAAoB,WAE7B,IAAM,YAAe,OAA2B,CAC9C,MAAM,OAAS,IAAI,gBAAgB,MAAM,MAAM,KAAK,EACpD,MAAM,MAAQ,MAAM,MACpB,SAAW,CAAC,IAAK,KAAK,IAAK,OAAO,QAAQ,YAAY,EAAG,CACvD,MAAM,MAAQ,MAAM,KAAK,EACzB,GAAI,QAAU,OAAW,CACvB,OAAO,IAAI,IAAK,KAAK,CACvB,CACF,CACA,GAAI,MAAM,KAAM,CACd,OAAO,IAAI,SAAU,OAAO,MAAM,OAAS,QAAQ,CAAC,CACtD,CACA,OAAO,MACT,EAEO,IAAM,SAAY,OAA2B,CAClD,MAAM,OAAS,YAAY,KAAK,EAChC,GAAI,MAAM,OAAS,OAAQ,CACzB,OAAO,OAAO,UAAU,CAC1B,S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