@aglyn/plugins-commerce 1.31.0 → 1.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/package.json +13 -13
- package/src/lib/components/cart.js +35 -15
- package/src/lib/components/cart.js.map +1 -1
- package/src/lib/components/commerce-console-page.js +6 -0
- package/src/lib/components/commerce-console-page.js.map +1 -1
- package/src/lib/components/console/currencies-card.component.d.ts +21 -0
- package/src/lib/components/console/currencies-card.component.js +408 -0
- package/src/lib/components/console/currencies-card.component.js.map +1 -0
- package/src/lib/components/console/product-add-ons-fields.component.d.ts +13 -0
- package/src/lib/components/console/product-add-ons-fields.component.js +74 -2
- package/src/lib/components/console/product-add-ons-fields.component.js.map +1 -1
- package/src/lib/components/console/product-editor-dialog.component.js +42 -1
- package/src/lib/components/console/product-editor-dialog.component.js.map +1 -1
- package/src/lib/components/console/product-fixed-prices-fields.component.d.ts +25 -0
- package/src/lib/components/console/product-fixed-prices-fields.component.js +112 -0
- package/src/lib/components/console/product-fixed-prices-fields.component.js.map +1 -0
- package/src/lib/components/console/reservations-card.component.js +32 -15
- package/src/lib/components/console/reservations-card.component.js.map +1 -1
- package/src/lib/components/console/shipping-settings-card.component.js +337 -10
- package/src/lib/components/console/shipping-settings-card.component.js.map +1 -1
- package/src/lib/components/console/store-settings-card.component.js +1 -1
- package/src/lib/components/console/store-settings-card.component.js.map +1 -1
- package/src/lib/components/console/use-currency-setup.d.ts +20 -0
- package/src/lib/components/console/use-currency-setup.js +61 -0
- package/src/lib/components/console/use-currency-setup.js.map +1 -0
- package/src/lib/components/currency-selector.d.ts +36 -0
- package/src/lib/components/currency-selector.js +157 -0
- package/src/lib/components/currency-selector.js.map +1 -0
- package/src/lib/components/product-add-ons.d.ts +9 -1
- package/src/lib/components/product-add-ons.js +8 -4
- package/src/lib/components/product-add-ons.js.map +1 -1
- package/src/lib/components/product-choice-cards.d.ts +13 -1
- package/src/lib/components/product-choice-cards.js +5 -4
- package/src/lib/components/product-choice-cards.js.map +1 -1
- package/src/lib/components/product-detail.d.ts +8 -0
- package/src/lib/components/product-detail.js +38 -11
- package/src/lib/components/product-detail.js.map +1 -1
- package/src/lib/components/product-grid.d.ts +2 -0
- package/src/lib/components/product-grid.js +22 -9
- package/src/lib/components/product-grid.js.map +1 -1
- package/src/lib/components/related-products.js +6 -2
- package/src/lib/components/related-products.js.map +1 -1
- package/src/lib/components/shopper-currency.d.ts +108 -0
- package/src/lib/components/shopper-currency.js +262 -0
- package/src/lib/components/shopper-currency.js.map +1 -0
- package/src/lib/components/wishlist.js +7 -1
- package/src/lib/components/wishlist.js.map +1 -1
- package/src/lib/declarations.server.js +39 -0
- package/src/lib/declarations.server.js.map +1 -1
- package/src/lib/model/commerce-currency-setup.d.ts +79 -0
- package/src/lib/model/commerce-currency-setup.js +124 -0
- package/src/lib/model/commerce-currency-setup.js.map +1 -0
- package/src/lib/model/commerce-currency.d.ts +215 -0
- package/src/lib/model/commerce-currency.js +511 -0
- package/src/lib/model/commerce-currency.js.map +1 -0
- package/src/lib/model/commerce-orders.d.ts +17 -0
- package/src/lib/model/commerce-orders.js +10 -5
- package/src/lib/model/commerce-orders.js.map +1 -1
- package/src/lib/model/commerce-record-routes.js +26 -1
- package/src/lib/model/commerce-record-routes.js.map +1 -1
- package/src/lib/model/commerce-reservations.d.ts +6 -0
- package/src/lib/model/commerce-reservations.js.map +1 -1
- package/src/lib/model/commerce-shipping.d.ts +66 -11
- package/src/lib/model/commerce-shipping.js +91 -7
- package/src/lib/model/commerce-shipping.js.map +1 -1
- package/src/lib/model/commerce.d.ts +6 -0
- package/src/lib/model/commerce.js.map +1 -1
- package/src/lib/model/index.d.ts +2 -0
- package/src/lib/model/index.js +2 -0
- package/src/lib/model/index.js.map +1 -1
- package/src/lib/model/order-figures.js +9 -2
- package/src/lib/model/order-figures.js.map +1 -1
- package/src/lib/model/product-modifiers.d.ts +5 -0
- package/src/lib/model/product-modifiers.js.map +1 -1
- package/src/lib/model/store-setup-content.js +23 -2
- package/src/lib/model/store-setup-content.js.map +1 -1
- package/src/lib/server/billing-webhook.js +37 -24
- package/src/lib/server/billing-webhook.js.map +1 -1
- package/src/lib/server/carrier-shipping.d.ts +2 -0
- package/src/lib/server/carrier-shipping.js +8 -4
- package/src/lib/server/carrier-shipping.js.map +1 -1
- package/src/lib/server/cart-checkout.js +74 -13
- package/src/lib/server/cart-checkout.js.map +1 -1
- package/src/lib/server/cart.d.ts +12 -0
- package/src/lib/server/cart.js +50 -4
- package/src/lib/server/cart.js.map +1 -1
- package/src/lib/server/catalog.d.ts +5 -0
- package/src/lib/server/catalog.js +7 -0
- package/src/lib/server/catalog.js.map +1 -1
- package/src/lib/server/checkout.js +53 -12
- package/src/lib/server/checkout.js.map +1 -1
- package/src/lib/server/currency.d.ts +93 -0
- package/src/lib/server/currency.js +182 -0
- package/src/lib/server/currency.js.map +1 -0
- package/src/lib/server/order-notifications.js +4 -2
- package/src/lib/server/order-notifications.js.map +1 -1
- package/src/lib/server/product.d.ts +9 -0
- package/src/lib/server/product.js +12 -0
- package/src/lib/server/product.js.map +1 -1
- package/src/lib/server/refund.js +3 -3
- package/src/lib/server/refund.js.map +1 -1
- package/src/lib/server/site-chat-tools.d.ts +22 -0
- package/src/lib/server/site-chat-tools.js +369 -0
- package/src/lib/server/site-chat-tools.js.map +1 -0
- package/src/lib/server/site-chat-visitor.d.ts +24 -0
- package/src/lib/server/site-chat-visitor.js +39 -0
- package/src/lib/server/site-chat-visitor.js.map +1 -0
- package/src/lib/server/site-offers.d.ts +31 -0
- package/src/lib/server/site-offers.js +91 -0
- package/src/lib/server/site-offers.js.map +1 -0
- package/src/lib/server/stays-site-search.d.ts +20 -0
- package/src/lib/server/stays-site-search.js +78 -0
- package/src/lib/server/stays-site-search.js.map +1 -0
- package/src/lib/server.js +20 -0
- package/src/lib/server.js.map +1 -1
- package/src/lib/site-chat-tool-definitions.d.ts +26 -0
- package/src/lib/site-chat-tool-definitions.js +141 -0
- package/src/lib/site-chat-tool-definitions.js.map +1 -0
- package/src/lib/site.js +8 -0
- package/src/lib/site.js.map +1 -1
- package/src/lib/subprocessors.js +7 -0
- package/src/lib/subprocessors.js.map +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as CommerceModel from '../../model';
|
|
2
|
+
export interface ProductFixedPricesFieldsProps {
|
|
3
|
+
variants: readonly CommerceModel.ProductVariant[];
|
|
4
|
+
/** The store currency. */
|
|
5
|
+
base: string;
|
|
6
|
+
/** The other currencies the store sells in. */
|
|
7
|
+
currencies: readonly CommerceModel.StoreCurrency[];
|
|
8
|
+
rates: CommerceModel.FxRates | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* A variant's fixed price in one currency, as typed: blank clears it, so
|
|
11
|
+
* the price converts again.
|
|
12
|
+
*/
|
|
13
|
+
onPrice: (index: number, code: string, raw: string) => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Prices in other currencies (AGL-4248): for each variant, one field per
|
|
17
|
+
* currency the store sells in. A blank cell is converted from the
|
|
18
|
+
* variant's price at the day's rate, rounded the way the Currencies card
|
|
19
|
+
* says, and shows that figure as its placeholder; a typed one is charged as
|
|
20
|
+
* typed, the way Shopify Markets' fixed prices are.
|
|
21
|
+
*
|
|
22
|
+
* Fields keep what is typed until they are left (`defaultValue` + blur), so
|
|
23
|
+
* a keystroke redraws nothing else in the editor (AGL-3423).
|
|
24
|
+
*/
|
|
25
|
+
export declare const ProductFixedPricesFields: import("react").MemoExoticComponent<(props: ProductFixedPricesFieldsProps) => import("react").JSX.Element>;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2026 Aglyn LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/ 'use client';
|
|
17
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
18
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
import { Box, Stack, TextField, Typography } from "@mui/material";
|
|
20
|
+
import { memo, useState } from "react";
|
|
21
|
+
import * as CommerceModel from "../../model/index.js";
|
|
22
|
+
const DECIMAL = {
|
|
23
|
+
inputMode: 'decimal'
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Prices in other currencies (AGL-4248): for each variant, one field per
|
|
27
|
+
* currency the store sells in. A blank cell is converted from the
|
|
28
|
+
* variant's price at the day's rate, rounded the way the Currencies card
|
|
29
|
+
* says, and shows that figure as its placeholder; a typed one is charged as
|
|
30
|
+
* typed, the way Shopify Markets' fixed prices are.
|
|
31
|
+
*
|
|
32
|
+
* Fields keep what is typed until they are left (`defaultValue` + blur), so
|
|
33
|
+
* a keystroke redraws nothing else in the editor (AGL-3423).
|
|
34
|
+
*/ export const ProductFixedPricesFields = /*#__PURE__*/ memo(function ProductFixedPricesFields(props) {
|
|
35
|
+
const { variants, base, currencies, rates, onPrice } = props;
|
|
36
|
+
const [invalid, setInvalid] = useState({});
|
|
37
|
+
return /*#__PURE__*/ _jsxs(Box, {
|
|
38
|
+
children: [
|
|
39
|
+
/*#__PURE__*/ _jsx(Typography, {
|
|
40
|
+
variant: "caption",
|
|
41
|
+
color: "text.secondary",
|
|
42
|
+
component: "p",
|
|
43
|
+
sx: {
|
|
44
|
+
mb: 1
|
|
45
|
+
},
|
|
46
|
+
children: 'Optional. Leave a price blank to convert it automatically from the price above.'
|
|
47
|
+
}),
|
|
48
|
+
/*#__PURE__*/ _jsx(Stack, {
|
|
49
|
+
spacing: 1.5,
|
|
50
|
+
children: variants.map((variant, index)=>{
|
|
51
|
+
const label = CommerceModel.variantPriceLabel(variant);
|
|
52
|
+
return /*#__PURE__*/ _jsxs(Box, {
|
|
53
|
+
children: [
|
|
54
|
+
variants.length > 1 ? /*#__PURE__*/ _jsx(Typography, {
|
|
55
|
+
variant: "body2",
|
|
56
|
+
sx: {
|
|
57
|
+
mb: 0.5
|
|
58
|
+
},
|
|
59
|
+
children: label
|
|
60
|
+
}) : null,
|
|
61
|
+
/*#__PURE__*/ _jsx(Box, {
|
|
62
|
+
sx: {
|
|
63
|
+
display: 'grid',
|
|
64
|
+
gridTemplateColumns: {
|
|
65
|
+
xs: 'repeat(2, minmax(0, 1fr))',
|
|
66
|
+
sm: 'repeat(4, minmax(0, 1fr))'
|
|
67
|
+
},
|
|
68
|
+
gap: 1
|
|
69
|
+
},
|
|
70
|
+
children: currencies.map((entry)=>{
|
|
71
|
+
var _variant_fixedPrices;
|
|
72
|
+
const cellKey = `${variant.id}:${entry.code}`;
|
|
73
|
+
const fixed = (_variant_fixedPrices = variant.fixedPrices) == null ? void 0 : _variant_fixedPrices[entry.code];
|
|
74
|
+
const converted = CommerceModel.variantHasPrice(variant) ? CommerceModel.variantPriceMinor({
|
|
75
|
+
priceUsd: variant.priceUsd
|
|
76
|
+
}, base, entry, rates) : undefined;
|
|
77
|
+
return /*#__PURE__*/ _jsx(TextField, {
|
|
78
|
+
label: `Price (${entry.code})`,
|
|
79
|
+
defaultValue: fixed == null ? '' : String(fixed),
|
|
80
|
+
placeholder: CommerceModel.minorToInput(converted, entry.code),
|
|
81
|
+
onBlur: (event)=>{
|
|
82
|
+
const bad = CommerceModel.parseMajorInput(event.target.value) === null;
|
|
83
|
+
setInvalid((was)=>_extends({}, was, {
|
|
84
|
+
[cellKey]: bad
|
|
85
|
+
}));
|
|
86
|
+
if (!bad) onPrice(index, entry.code, event.target.value);
|
|
87
|
+
},
|
|
88
|
+
error: invalid[cellKey] === true,
|
|
89
|
+
helperText: invalid[cellKey] ? 'Not a price' : undefined,
|
|
90
|
+
size: "small",
|
|
91
|
+
slotProps: {
|
|
92
|
+
// A label always shows the placeholder (the converted
|
|
93
|
+
// price) rather than covering it.
|
|
94
|
+
inputLabel: {
|
|
95
|
+
shrink: true
|
|
96
|
+
},
|
|
97
|
+
htmlInput: _extends({}, DECIMAL, {
|
|
98
|
+
'aria-label': `Price in ${entry.code} — ${label}`
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
}, cellKey);
|
|
102
|
+
})
|
|
103
|
+
})
|
|
104
|
+
]
|
|
105
|
+
}, variant.id);
|
|
106
|
+
})
|
|
107
|
+
})
|
|
108
|
+
]
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
//# sourceMappingURL=product-fixed-prices-fields.component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../../libs/plugins/commerce/src/lib/components/console/product-fixed-prices-fields.component.tsx"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n'use client'\n\nimport { Box, Stack, TextField, Typography } from '@mui/material'\nimport { memo, useState } from 'react'\nimport * as CommerceModel from '../../model'\n\nexport interface ProductFixedPricesFieldsProps {\n variants: readonly CommerceModel.ProductVariant[]\n /** The store currency. */\n base: string\n /** The other currencies the store sells in. */\n currencies: readonly CommerceModel.StoreCurrency[]\n rates: CommerceModel.FxRates | undefined\n /**\n * A variant's fixed price in one currency, as typed: blank clears it, so\n * the price converts again.\n */\n onPrice: (index: number, code: string, raw: string) => void\n}\n\nconst DECIMAL = { inputMode: 'decimal' } as const\n\n/**\n * Prices in other currencies (AGL-4248): for each variant, one field per\n * currency the store sells in. A blank cell is converted from the\n * variant's price at the day's rate, rounded the way the Currencies card\n * says, and shows that figure as its placeholder; a typed one is charged as\n * typed, the way Shopify Markets' fixed prices are.\n *\n * Fields keep what is typed until they are left (`defaultValue` + blur), so\n * a keystroke redraws nothing else in the editor (AGL-3423).\n */\nexport const ProductFixedPricesFields = memo(function ProductFixedPricesFields(\n props: ProductFixedPricesFieldsProps,\n) {\n const { variants, base, currencies, rates, onPrice } = props\n const [invalid, setInvalid] = useState<Record<string, boolean>>({})\n return (\n <Box>\n <Typography variant=\"caption\" color=\"text.secondary\" component=\"p\" sx={{ mb: 1 }}>\n {'Optional. Leave a price blank to convert it automatically from the price above.'}\n </Typography>\n <Stack spacing={1.5}>\n {variants.map((variant, index) => {\n const label = CommerceModel.variantPriceLabel(variant)\n return (\n <Box key={variant.id}>\n {variants.length > 1 ? (\n <Typography variant=\"body2\" sx={{ mb: 0.5 }}>\n {label}\n </Typography>\n ) : null}\n <Box\n sx={{\n display: 'grid',\n gridTemplateColumns: { xs: 'repeat(2, minmax(0, 1fr))', sm: 'repeat(4, minmax(0, 1fr))' },\n gap: 1,\n }}\n >\n {currencies.map((entry) => {\n const cellKey = `${variant.id}:${entry.code}`\n const fixed = variant.fixedPrices?.[entry.code]\n const converted = CommerceModel.variantHasPrice(variant)\n ? CommerceModel.variantPriceMinor({ priceUsd: variant.priceUsd }, base, entry, rates)\n : undefined\n return (\n <TextField\n key={cellKey}\n label={`Price (${entry.code})`}\n defaultValue={fixed == null ? '' : String(fixed)}\n placeholder={CommerceModel.minorToInput(converted, entry.code)}\n onBlur={(event) => {\n const bad = CommerceModel.parseMajorInput(event.target.value) === null\n setInvalid((was) => ({ ...was, [cellKey]: bad }))\n if (!bad) onPrice(index, entry.code, event.target.value)\n }}\n error={invalid[cellKey] === true}\n helperText={invalid[cellKey] ? 'Not a price' : undefined}\n size=\"small\"\n slotProps={{\n // A label always shows the placeholder (the converted\n // price) rather than covering it.\n inputLabel: { shrink: true },\n htmlInput: { ...DECIMAL, 'aria-label': `Price in ${entry.code} — ${label}` },\n }}\n />\n )\n })}\n </Box>\n </Box>\n )\n })}\n </Stack>\n </Box>\n )\n})\n"],"names":["Box","Stack","TextField","Typography","memo","useState","CommerceModel","DECIMAL","inputMode","ProductFixedPricesFields","props","variants","base","currencies","rates","onPrice","invalid","setInvalid","variant","color","component","sx","mb","spacing","map","index","label","variantPriceLabel","length","display","gridTemplateColumns","xs","sm","gap","entry","cellKey","id","code","fixed","fixedPrices","converted","variantHasPrice","variantPriceMinor","priceUsd","undefined","defaultValue","String","placeholder","minorToInput","onBlur","event","bad","parseMajorInput","target","value","was","error","helperText","size","slotProps","inputLabel","shrink","htmlInput"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GACD;;;AAEA,SAASA,GAAG,EAAEC,KAAK,EAAEC,SAAS,EAAEC,UAAU,QAAQ,gBAAe;AACjE,SAASC,IAAI,EAAEC,QAAQ,QAAQ,QAAO;AACtC,YAAYC,mBAAmB,uBAAa;AAgB5C,MAAMC,UAAU;IAAEC,WAAW;AAAU;AAEvC;;;;;;;;;CASC,GACD,OAAO,MAAMC,yCAA2BL,KAAK,SAASK,yBACpDC,KAAoC;IAEpC,MAAM,EAAEC,QAAQ,EAAEC,IAAI,EAAEC,UAAU,EAAEC,KAAK,EAAEC,OAAO,EAAE,GAAGL;IACvD,MAAM,CAACM,SAASC,WAAW,GAAGZ,SAAkC,CAAC;IACjE,qBACE,MAACL;;0BACC,KAACG;gBAAWe,SAAQ;gBAAUC,OAAM;gBAAiBC,WAAU;gBAAIC,IAAI;oBAAEC,IAAI;gBAAE;0BAC5E;;0BAEH,KAACrB;gBAAMsB,SAAS;0BACbZ,SAASa,GAAG,CAAC,CAACN,SAASO;oBACtB,MAAMC,QAAQpB,cAAcqB,iBAAiB,CAACT;oBAC9C,qBACE,MAAClB;;4BACEW,SAASiB,MAAM,GAAG,kBACjB,KAACzB;gCAAWe,SAAQ;gCAAQG,IAAI;oCAAEC,IAAI;gCAAI;0CACvCI;iCAED;0CACJ,KAAC1B;gCACCqB,IAAI;oCACFQ,SAAS;oCACTC,qBAAqB;wCAAEC,IAAI;wCAA6BC,IAAI;oCAA4B;oCACxFC,KAAK;gCACP;0CAECpB,WAAWW,GAAG,CAAC,CAACU;wCAEDhB;oCADd,MAAMiB,UAAU,GAAGjB,QAAQkB,EAAE,CAAC,CAAC,EAAEF,MAAMG,IAAI,EAAE;oCAC7C,MAAMC,SAAQpB,uBAAAA,QAAQqB,WAAW,qBAAnBrB,oBAAqB,CAACgB,MAAMG,IAAI,CAAC;oCAC/C,MAAMG,YAAYlC,cAAcmC,eAAe,CAACvB,WAC5CZ,cAAcoC,iBAAiB,CAAC;wCAAEC,UAAUzB,QAAQyB,QAAQ;oCAAC,GAAG/B,MAAMsB,OAAOpB,SAC7E8B;oCACJ,qBACE,KAAC1C;wCAECwB,OAAO,CAAC,OAAO,EAAEQ,MAAMG,IAAI,CAAC,CAAC,CAAC;wCAC9BQ,cAAcP,SAAS,OAAO,KAAKQ,OAAOR;wCAC1CS,aAAazC,cAAc0C,YAAY,CAACR,WAAWN,MAAMG,IAAI;wCAC7DY,QAAQ,CAACC;4CACP,MAAMC,MAAM7C,cAAc8C,eAAe,CAACF,MAAMG,MAAM,CAACC,KAAK,MAAM;4CAClErC,WAAW,CAACsC,MAAS,aAAKA;oDAAK,CAACpB,QAAQ,EAAEgB;;4CAC1C,IAAI,CAACA,KAAKpC,QAAQU,OAAOS,MAAMG,IAAI,EAAEa,MAAMG,MAAM,CAACC,KAAK;wCACzD;wCACAE,OAAOxC,OAAO,CAACmB,QAAQ,KAAK;wCAC5BsB,YAAYzC,OAAO,CAACmB,QAAQ,GAAG,gBAAgBS;wCAC/Cc,MAAK;wCACLC,WAAW;4CACT,sDAAsD;4CACtD,kCAAkC;4CAClCC,YAAY;gDAAEC,QAAQ;4CAAK;4CAC3BC,WAAW,aAAKvD;gDAAS,cAAc,CAAC,SAAS,EAAE2B,MAAMG,IAAI,CAAC,GAAG,EAAEX,OAAO;;wCAC5E;uCAjBKS;gCAoBX;;;uBAzCMjB,QAAQkB,EAAE;gBA6CxB;;;;AAIR,GAAE"}
|
|
@@ -83,7 +83,7 @@ const nightLabel = (dayMs)=>new Date(dayMs).toLocaleDateString('en-US', {
|
|
|
83
83
|
* check-in/out, no-show, cancel, and walk-in creation. The storefront
|
|
84
84
|
* widget books against the same docs.
|
|
85
85
|
*/ export function ReservationsCard(props) {
|
|
86
|
-
var _payments_href, _payments_reason, _ref, _ref1, _ref2,
|
|
86
|
+
var _payments_href, _payments_reason, _ref, _ref1, _ref2, _ref3, _unitsProblem, _ref4, _ref5, _fewLeftAtProblem, _ref6, _ref7, _ref8, _ref9, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16;
|
|
87
87
|
var _resourceDraft_name;
|
|
88
88
|
const { hostId, canManage = true, canWalkIn = true } = props;
|
|
89
89
|
// The permissions this member lacks here, named, for the line under the
|
|
@@ -238,6 +238,13 @@ const nightLabel = (dayMs)=>new Date(dayMs).toLocaleDateString('en-US', {
|
|
|
238
238
|
fewLeftAt: CommerceModel.resourceFewLeftAt({
|
|
239
239
|
fewLeftAt
|
|
240
240
|
})
|
|
241
|
+
} : {}, 'pagePath' in seeded ? {
|
|
242
|
+
pagePath: (()=>{
|
|
243
|
+
var _fields_pagePath;
|
|
244
|
+
const text = String((_fields_pagePath = fields.pagePath) != null ? _fields_pagePath : '').trim().split(/[?#]/)[0];
|
|
245
|
+
if (!text || text.startsWith('//')) return '';
|
|
246
|
+
return text.startsWith('/') ? text : `/${text}`;
|
|
247
|
+
})()
|
|
241
248
|
} : {});
|
|
242
249
|
/**
|
|
243
250
|
* Refuse an EDIT whose seed the server never confirmed (AGL-1358).
|
|
@@ -724,6 +731,16 @@ const nightLabel = (dayMs)=>new Date(dayMs).toLocaleDateString('en-US', {
|
|
|
724
731
|
},
|
|
725
732
|
placeholder: "Lakeside cabin"
|
|
726
733
|
}),
|
|
734
|
+
/*#__PURE__*/ _jsx(TextField, {
|
|
735
|
+
label: "Page on your site",
|
|
736
|
+
value: (_ref2 = resourceDraft == null ? void 0 : resourceDraft.pagePath) != null ? _ref2 : '',
|
|
737
|
+
onChange: (event)=>setResourceDraft((prev)=>prev ? _extends({}, prev, {
|
|
738
|
+
pagePath: event.target.value.slice(0, 300)
|
|
739
|
+
}) : prev),
|
|
740
|
+
size: "small",
|
|
741
|
+
placeholder: "/cabins/lakeside",
|
|
742
|
+
helperText: "The page that holds this stay's booking widget. Site search links there."
|
|
743
|
+
}),
|
|
727
744
|
/*#__PURE__*/ _jsxs(Stack, {
|
|
728
745
|
direction: "row",
|
|
729
746
|
spacing: 1,
|
|
@@ -731,7 +748,7 @@ const nightLabel = (dayMs)=>new Date(dayMs).toLocaleDateString('en-US', {
|
|
|
731
748
|
/*#__PURE__*/ _jsx(TextField, {
|
|
732
749
|
label: "Spots or units available",
|
|
733
750
|
placeholder: "1",
|
|
734
|
-
value: (
|
|
751
|
+
value: (_ref3 = resourceDraft == null ? void 0 : resourceDraft.units) != null ? _ref3 : '',
|
|
735
752
|
onChange: (event)=>setResourceDraft((prev)=>prev ? _extends({}, prev, {
|
|
736
753
|
units: event.target.value.replace(/\D/g, '') === '' ? undefined : Number(event.target.value.replace(/\D/g, ''))
|
|
737
754
|
}) : prev),
|
|
@@ -747,7 +764,7 @@ const nightLabel = (dayMs)=>new Date(dayMs).toLocaleDateString('en-US', {
|
|
|
747
764
|
}),
|
|
748
765
|
/*#__PURE__*/ _jsx(TextField, {
|
|
749
766
|
label: "Sleeps",
|
|
750
|
-
value: (
|
|
767
|
+
value: (_ref4 = resourceDraft == null ? void 0 : resourceDraft.capacity) != null ? _ref4 : '',
|
|
751
768
|
onChange: (event)=>setResourceDraft((prev)=>prev ? _extends({}, prev, {
|
|
752
769
|
capacity: Math.round(Number(event.target.value)) || undefined
|
|
753
770
|
}) : prev),
|
|
@@ -765,7 +782,7 @@ const nightLabel = (dayMs)=>new Date(dayMs).toLocaleDateString('en-US', {
|
|
|
765
782
|
CommerceModel.resourceUnits(resourceDraft) > 1 ? /*#__PURE__*/ _jsx(TextField, {
|
|
766
783
|
label: "Show “Only N left” at",
|
|
767
784
|
placeholder: String(CommerceModel.FEW_UNITS_LEFT),
|
|
768
|
-
value: (
|
|
785
|
+
value: (_ref5 = resourceDraft == null ? void 0 : resourceDraft.fewLeftAt) != null ? _ref5 : '',
|
|
769
786
|
onChange: (event)=>setResourceDraft((prev)=>prev ? _extends({}, prev, {
|
|
770
787
|
fewLeftAt: event.target.value.replace(/\D/g, '') === '' ? undefined : Number(event.target.value.replace(/\D/g, ''))
|
|
771
788
|
}) : prev),
|
|
@@ -806,7 +823,7 @@ const nightLabel = (dayMs)=>new Date(dayMs).toLocaleDateString('en-US', {
|
|
|
806
823
|
children: [
|
|
807
824
|
/*#__PURE__*/ _jsx(TextField, {
|
|
808
825
|
label: "Nightly rate ($)",
|
|
809
|
-
value: (
|
|
826
|
+
value: (_ref6 = resourceDraft == null ? void 0 : resourceDraft.nightlyRateUsd) != null ? _ref6 : '',
|
|
810
827
|
onChange: (event)=>setResourceDraft((prev)=>prev ? _extends({}, prev, {
|
|
811
828
|
nightlyRateUsd: Number(event.target.value) || 0
|
|
812
829
|
}) : prev),
|
|
@@ -820,7 +837,7 @@ const nightLabel = (dayMs)=>new Date(dayMs).toLocaleDateString('en-US', {
|
|
|
820
837
|
/*#__PURE__*/ _jsx(TextField, {
|
|
821
838
|
label: "Weekend ×",
|
|
822
839
|
placeholder: "1",
|
|
823
|
-
value: (
|
|
840
|
+
value: (_ref7 = resourceDraft == null ? void 0 : resourceDraft.weekendMultiplier) != null ? _ref7 : '',
|
|
824
841
|
onChange: (event)=>setResourceDraft((prev)=>prev ? _extends({}, prev, {
|
|
825
842
|
weekendMultiplier: Number(event.target.value) || undefined
|
|
826
843
|
}) : prev),
|
|
@@ -839,7 +856,7 @@ const nightLabel = (dayMs)=>new Date(dayMs).toLocaleDateString('en-US', {
|
|
|
839
856
|
children: [
|
|
840
857
|
/*#__PURE__*/ _jsx(TextField, {
|
|
841
858
|
label: "Min nights",
|
|
842
|
-
value: (
|
|
859
|
+
value: (_ref8 = resourceDraft == null ? void 0 : resourceDraft.minNights) != null ? _ref8 : '',
|
|
843
860
|
onChange: (event)=>setResourceDraft((prev)=>prev ? _extends({}, prev, {
|
|
844
861
|
minNights: Math.round(Number(event.target.value)) || undefined
|
|
845
862
|
}) : prev),
|
|
@@ -853,7 +870,7 @@ const nightLabel = (dayMs)=>new Date(dayMs).toLocaleDateString('en-US', {
|
|
|
853
870
|
/*#__PURE__*/ _jsx(TextField, {
|
|
854
871
|
label: "Deposit %",
|
|
855
872
|
placeholder: "100 = pay in full",
|
|
856
|
-
value: (
|
|
873
|
+
value: (_ref9 = resourceDraft == null ? void 0 : resourceDraft.depositPct) != null ? _ref9 : '',
|
|
857
874
|
onChange: (event)=>setResourceDraft((prev)=>prev ? _extends({}, prev, {
|
|
858
875
|
depositPct: Math.round(Number(event.target.value)) || undefined
|
|
859
876
|
}) : prev),
|
|
@@ -866,7 +883,7 @@ const nightLabel = (dayMs)=>new Date(dayMs).toLocaleDateString('en-US', {
|
|
|
866
883
|
}),
|
|
867
884
|
/*#__PURE__*/ _jsx(TextField, {
|
|
868
885
|
label: "Free cancel (hrs)",
|
|
869
|
-
value: (
|
|
886
|
+
value: (_ref10 = resourceDraft == null ? void 0 : resourceDraft.cancellationHours) != null ? _ref10 : '',
|
|
870
887
|
onChange: (event)=>setResourceDraft((prev)=>prev ? _extends({}, prev, {
|
|
871
888
|
cancellationHours: Math.round(Number(event.target.value)) || undefined
|
|
872
889
|
}) : prev),
|
|
@@ -899,7 +916,7 @@ const nightLabel = (dayMs)=>new Date(dayMs).toLocaleDateString('en-US', {
|
|
|
899
916
|
/*#__PURE__*/ _jsx(Button, {
|
|
900
917
|
variant: "contained",
|
|
901
918
|
color: "primary",
|
|
902
|
-
disabled: !(resourceDraft == null ? void 0 : (_resourceDraft_name = resourceDraft.name) == null ? void 0 : _resourceDraft_name.trim()) || !(((
|
|
919
|
+
disabled: !(resourceDraft == null ? void 0 : (_resourceDraft_name = resourceDraft.name) == null ? void 0 : _resourceDraft_name.trim()) || !(((_ref11 = resourceDraft == null ? void 0 : resourceDraft.nightlyRateUsd) != null ? _ref11 : 0) > 0) || Boolean(unitsProblem(resourceDraft == null ? void 0 : resourceDraft.units)) || Boolean(fewLeftAtProblem(resourceDraft == null ? void 0 : resourceDraft.fewLeftAt)) || resourceHeld.saving,
|
|
903
920
|
onClick: resourceHeld.press,
|
|
904
921
|
children: heldSaveLabel(resourceHeld, 'Save')
|
|
905
922
|
})
|
|
@@ -925,7 +942,7 @@ const nightLabel = (dayMs)=>new Date(dayMs).toLocaleDateString('en-US', {
|
|
|
925
942
|
children: [
|
|
926
943
|
/*#__PURE__*/ _jsx(TextField, {
|
|
927
944
|
label: "Resource",
|
|
928
|
-
value: (
|
|
945
|
+
value: (_ref12 = walkIn == null ? void 0 : walkIn.resourceId) != null ? _ref12 : '',
|
|
929
946
|
onChange: (event)=>setWalkIn((prev)=>prev ? _extends({}, prev, {
|
|
930
947
|
resourceId: event.target.value
|
|
931
948
|
}) : prev),
|
|
@@ -946,7 +963,7 @@ const nightLabel = (dayMs)=>new Date(dayMs).toLocaleDateString('en-US', {
|
|
|
946
963
|
/*#__PURE__*/ _jsx(TextField, {
|
|
947
964
|
label: "Check-in",
|
|
948
965
|
type: "date",
|
|
949
|
-
value: (
|
|
966
|
+
value: (_ref13 = walkIn == null ? void 0 : walkIn.checkIn) != null ? _ref13 : '',
|
|
950
967
|
onChange: (event)=>setWalkIn((prev)=>prev ? _extends({}, prev, {
|
|
951
968
|
checkIn: event.target.value
|
|
952
969
|
}) : prev),
|
|
@@ -961,7 +978,7 @@ const nightLabel = (dayMs)=>new Date(dayMs).toLocaleDateString('en-US', {
|
|
|
961
978
|
/*#__PURE__*/ _jsx(TextField, {
|
|
962
979
|
label: "Check-out",
|
|
963
980
|
type: "date",
|
|
964
|
-
value: (
|
|
981
|
+
value: (_ref14 = walkIn == null ? void 0 : walkIn.checkOut) != null ? _ref14 : '',
|
|
965
982
|
onChange: (event)=>setWalkIn((prev)=>prev ? _extends({}, prev, {
|
|
966
983
|
checkOut: event.target.value
|
|
967
984
|
}) : prev),
|
|
@@ -977,7 +994,7 @@ const nightLabel = (dayMs)=>new Date(dayMs).toLocaleDateString('en-US', {
|
|
|
977
994
|
}),
|
|
978
995
|
/*#__PURE__*/ _jsx(TextField, {
|
|
979
996
|
label: "Guest name",
|
|
980
|
-
value: (
|
|
997
|
+
value: (_ref15 = walkIn == null ? void 0 : walkIn.guestName) != null ? _ref15 : '',
|
|
981
998
|
onChange: (event)=>setWalkIn((prev)=>prev ? _extends({}, prev, {
|
|
982
999
|
guestName: event.target.value
|
|
983
1000
|
}) : prev),
|
|
@@ -985,7 +1002,7 @@ const nightLabel = (dayMs)=>new Date(dayMs).toLocaleDateString('en-US', {
|
|
|
985
1002
|
}),
|
|
986
1003
|
/*#__PURE__*/ _jsx(TextField, {
|
|
987
1004
|
label: "Guests",
|
|
988
|
-
value: (
|
|
1005
|
+
value: (_ref16 = walkIn == null ? void 0 : walkIn.guests) != null ? _ref16 : '',
|
|
989
1006
|
onChange: (event)=>setWalkIn((prev)=>prev ? _extends({}, prev, {
|
|
990
1007
|
guests: event.target.value.replace(/\D/g, '')
|
|
991
1008
|
}) : prev),
|