@aglyn/plugins-bookings 1.0.0-beta.218 → 1.0.0-beta.220
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/package.json +12 -12
- package/src/lib/components/book-meeting-action.d.ts +7 -4
- package/src/lib/components/book-meeting-action.js +5 -5
- package/src/lib/components/book-meeting-action.js.map +1 -1
- package/src/lib/components/booking.js +10 -10
- package/src/lib/components/booking.js.map +1 -1
- package/src/lib/components/bookings-console-page.js +17 -12
- package/src/lib/components/bookings-console-page.js.map +1 -1
- package/src/lib/model/booking-record.d.ts +74 -0
- package/src/lib/model/booking-record.js +131 -0
- package/src/lib/model/booking-record.js.map +1 -0
- package/src/lib/model/booking-time.d.ts +60 -0
- package/src/lib/model/booking-time.js +65 -0
- package/src/lib/model/booking-time.js.map +1 -0
- package/src/lib/model/bookings-record-routes.d.ts +46 -0
- package/src/lib/model/bookings-record-routes.js +63 -0
- package/src/lib/model/bookings-record-routes.js.map +1 -0
- package/src/lib/model/bookings-search-sources.d.ts +19 -0
- package/src/lib/model/bookings-search-sources.js +36 -0
- package/src/lib/model/bookings-search-sources.js.map +1 -0
- package/src/lib/model/bookings.d.ts +4 -4
- package/src/lib/model/bookings.js +3 -3
- package/src/lib/model/bookings.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/plugin.js +4 -0
- package/src/lib/plugin.js.map +1 -1
- package/src/lib/server/billing-webhook.js +18 -9
- package/src/lib/server/billing-webhook.js.map +1 -1
- package/src/lib/server/booking-crm.d.ts +40 -24
- package/src/lib/server/booking-crm.js +84 -26
- package/src/lib/server/booking-crm.js.map +1 -1
- package/src/lib/server/booking-time-zone.d.ts +32 -0
- package/src/lib/server/booking-time-zone.js +59 -0
- package/src/lib/server/booking-time-zone.js.map +1 -0
- package/src/lib/server.js +56 -45
- package/src/lib/server.js.map +1 -1
- package/src/lib/tenant-emails.d.ts +29 -0
- package/src/lib/tenant-emails.js +134 -0
- package/src/lib/tenant-emails.js.map +1 -0
- package/src/lib/testing/stand-in-crm-record-routes.d.ts +25 -0
- package/src/lib/testing/stand-in-crm-record-routes.js +46 -0
- package/src/lib/testing/stand-in-crm-record-routes.js.map +1 -0
- package/src/lib/testing/stand-in-tax-profile.d.ts +6 -1
- package/src/lib/testing/stand-in-tax-profile.js +5 -1
- package/src/lib/testing/stand-in-tax-profile.js.map +1 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2026 Aglyn LLC
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/ import { registerPluginRecordRoute } from "@aglyn/aglyn/plugin-manager/plugin-record-routes";
|
|
18
|
+
/**
|
|
19
|
+
* The CRM's `contact`, `lead` and `company` record routes (AGL-3080), stood in
|
|
20
|
+
* for this plugin's specs, which may not load the CRM. They answer what the
|
|
21
|
+
* CRM publishes — a record's page under the site's hub or the organization's,
|
|
22
|
+
* and the Contacts list opened on one address — and what it publishes is held
|
|
23
|
+
* in its own `crm-record-routes.spec.ts`. Registered under the owner's id,
|
|
24
|
+
* `crm`, so a spec asking what happens where it is not loaded unregisters it.
|
|
25
|
+
*/ export function standInCrmRecordRoutes() {
|
|
26
|
+
const hub = ({ orgSlug, host })=>host ? `/${orgSlug}/hosts/${host}/crm` : `/${orgSlug}/crm`;
|
|
27
|
+
const sectionRoute = (section)=>({
|
|
28
|
+
list: (context)=>`${hub(context)}/${section}`,
|
|
29
|
+
record: (context, id)=>`${hub(context)}/${section}/${encodeURIComponent(id)}`
|
|
30
|
+
});
|
|
31
|
+
registerPluginRecordRoute('contact', _extends({}, sectionRoute('contacts'), {
|
|
32
|
+
byEmail: (context, email)=>`${hub(context)}/contacts?${new URLSearchParams({
|
|
33
|
+
email
|
|
34
|
+
}).toString()}`
|
|
35
|
+
}), {
|
|
36
|
+
pluginId: 'crm'
|
|
37
|
+
});
|
|
38
|
+
registerPluginRecordRoute('lead', sectionRoute('leads'), {
|
|
39
|
+
pluginId: 'crm'
|
|
40
|
+
});
|
|
41
|
+
registerPluginRecordRoute('company', sectionRoute('companies'), {
|
|
42
|
+
pluginId: 'crm'
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
//# sourceMappingURL=stand-in-crm-record-routes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/bookings/src/lib/testing/stand-in-crm-record-routes.ts"],"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\nimport {\n registerPluginRecordRoute,\n type PluginRecordRoute,\n type PluginRecordRouteContext,\n} from '@aglyn/aglyn/plugin-manager/plugin-record-routes'\n\n/**\n * The CRM's `contact`, `lead` and `company` record routes (AGL-3080), stood in\n * for this plugin's specs, which may not load the CRM. They answer what the\n * CRM publishes — a record's page under the site's hub or the organization's,\n * and the Contacts list opened on one address — and what it publishes is held\n * in its own `crm-record-routes.spec.ts`. Registered under the owner's id,\n * `crm`, so a spec asking what happens where it is not loaded unregisters it.\n */\nexport function standInCrmRecordRoutes(): void {\n const hub = ({ orgSlug, host }: PluginRecordRouteContext) =>\n host ? `/${orgSlug}/hosts/${host}/crm` : `/${orgSlug}/crm`\n const sectionRoute = (section: string): PluginRecordRoute => ({\n list: (context) => `${hub(context)}/${section}`,\n record: (context, id) => `${hub(context)}/${section}/${encodeURIComponent(id)}`,\n })\n registerPluginRecordRoute(\n 'contact',\n {\n ...sectionRoute('contacts'),\n byEmail: (context, email) =>\n `${hub(context)}/contacts?${new URLSearchParams({ email }).toString()}`,\n },\n { pluginId: 'crm' },\n )\n registerPluginRecordRoute('lead', sectionRoute('leads'), { pluginId: 'crm' })\n registerPluginRecordRoute('company', sectionRoute('companies'), { pluginId: 'crm' })\n}\n"],"names":["registerPluginRecordRoute","standInCrmRecordRoutes","hub","orgSlug","host","sectionRoute","section","list","context","record","id","encodeURIComponent","byEmail","email","URLSearchParams","toString","pluginId"],"mappings":";AAAA;;;;;;;;;;;;;;;CAeC,GAED,SACEA,yBAAyB,QAGpB,mDAAkD;AAEzD;;;;;;;CAOC,GACD,OAAO,SAASC;IACd,MAAMC,MAAM,CAAC,EAAEC,OAAO,EAAEC,IAAI,EAA4B,GACtDA,OAAO,CAAC,CAAC,EAAED,QAAQ,OAAO,EAAEC,KAAK,IAAI,CAAC,GAAG,CAAC,CAAC,EAAED,QAAQ,IAAI,CAAC;IAC5D,MAAME,eAAe,CAACC,UAAwC,CAAA;YAC5DC,MAAM,CAACC,UAAY,GAAGN,IAAIM,SAAS,CAAC,EAAEF,SAAS;YAC/CG,QAAQ,CAACD,SAASE,KAAO,GAAGR,IAAIM,SAAS,CAAC,EAAEF,QAAQ,CAAC,EAAEK,mBAAmBD,KAAK;QACjF,CAAA;IACAV,0BACE,WACA,aACKK,aAAa;QAChBO,SAAS,CAACJ,SAASK,QACjB,GAAGX,IAAIM,SAAS,UAAU,EAAE,IAAIM,gBAAgB;gBAAED;YAAM,GAAGE,QAAQ,IAAI;QAE3E;QAAEC,UAAU;IAAM;IAEpBhB,0BAA0B,QAAQK,aAAa,UAAU;QAAEW,UAAU;IAAM;IAC3EhB,0BAA0B,WAAWK,aAAa,cAAc;QAAEW,UAAU;IAAM;AACpF"}
|
|
@@ -25,5 +25,10 @@
|
|
|
25
25
|
* charges and records what it is told. That the REAL owner answers the same,
|
|
26
26
|
* and is registered wherever a booking is priced or confirmed, is held where
|
|
27
27
|
* both plugins can be reached: `tax-profile-is-registered.spec.ts` in each app.
|
|
28
|
+
*
|
|
29
|
+
* `flatRate` is the owner's read of the merchant's rate for a kind of charge;
|
|
30
|
+
* a spec hands the rates its merchant set, and with none every rate is unset.
|
|
28
31
|
*/
|
|
29
|
-
export declare function standInTaxProfile(
|
|
32
|
+
export declare function standInTaxProfile(options?: {
|
|
33
|
+
flatRate?: (hostId: string, charge: string) => unknown;
|
|
34
|
+
}): void;
|
|
@@ -26,9 +26,13 @@ import { registerPluginTaxProfile } from "@aglyn/aglyn/plugin-manager/plugin-tax
|
|
|
26
26
|
* charges and records what it is told. That the REAL owner answers the same,
|
|
27
27
|
* and is registered wherever a booking is priced or confirmed, is held where
|
|
28
28
|
* both plugins can be reached: `tax-profile-is-registered.spec.ts` in each app.
|
|
29
|
-
|
|
29
|
+
*
|
|
30
|
+
* `flatRate` is the owner's read of the merchant's rate for a kind of charge;
|
|
31
|
+
* a spec hands the rates its merchant set, and with none every rate is unset.
|
|
32
|
+
*/ export function standInTaxProfile(options = {}) {
|
|
30
33
|
resetPluginServicesForTests();
|
|
31
34
|
registerPluginTaxProfile({
|
|
35
|
+
flatRate: async (hostId, charge)=>options.flatRate == null ? void 0 : options.flatRate.call(options, hostId, charge),
|
|
32
36
|
flatTax: (rate, chargeCents, fallbackLabel)=>{
|
|
33
37
|
const source = rate != null ? rate : {};
|
|
34
38
|
const pct = Number(source.pct);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/plugins/bookings/src/lib/testing/stand-in-tax-profile.ts"],"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\nimport { resetPluginServicesForTests } from '@aglyn/aglyn/plugin-manager/plugin-services'\nimport { registerPluginTaxProfile } from '@aglyn/aglyn/plugin-manager/plugin-tax-profile'\n\n/**\n * A plugin that owns the tenant's tax rule, standing in for the one that does.\n *\n * Bookings prices a charge by asking the tax-profile contract and imports no\n * storefront, so its specs stand an owner up the way the loader would. The\n * rule here is the contract's, as `plugin-tax-profile.ts` states it: exclusive,\n * rounded to the cent, and zero for a rate that is absent, not positive or\n * above a hundred. What these specs certify is that bookings ASKS the owner and\n * charges and records what it is told. That the REAL owner answers the same,\n * and is registered wherever a booking is priced or confirmed, is held where\n * both plugins can be reached: `tax-profile-is-registered.spec.ts` in each app.\n */\nexport function standInTaxProfile(): void {\n resetPluginServicesForTests()\n registerPluginTaxProfile(\n {\n flatTax: (rate, chargeCents, fallbackLabel) => {\n const source = (rate ?? {}) as { pct?: unknown; label?: unknown }\n const pct = Number(source.pct)\n const usable = Number.isFinite(pct) && pct > 0 && pct <= 100\n const taxCents = usable ? Math.round((chargeCents * pct) / 100) : 0\n if (!(taxCents > 0)) return { taxCents: 0, label: '', pct: 0 }\n return {\n taxCents,\n label: String(source.label || fallbackLabel).slice(0, 120),\n pct,\n }\n },\n // Read off the settled payment, never restated by the caller: automatic\n // when the processor computed it, manual when the caller added a line.\n taxModeOf: (settledPayment, manualTaxCents = 0) => {\n const source = settledPayment as {\n automatic_tax?: { enabled?: unknown }\n total_details?: { amount_tax?: unknown }\n } | null\n if (source?.automatic_tax?.enabled === true) {\n return Number(source.total_details?.amount_tax) > 0\n ? 'stripe-automatic'\n : 'none'\n }\n return manualTaxCents > 0 ? 'manual' : 'none'\n },\n },\n { pluginId: 'tax-owner' },\n )\n}\n"],"names":["resetPluginServicesForTests","registerPluginTaxProfile","standInTaxProfile","flatTax","rate","chargeCents","fallbackLabel","source","pct","Number","usable","isFinite","taxCents","Math","round","label","String","slice","taxModeOf","settledPayment","manualTaxCents","automatic_tax","enabled","total_details","amount_tax","pluginId"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,2BAA2B,QAAQ,8CAA6C;AACzF,SAASC,wBAAwB,QAAQ,iDAAgD;AAEzF
|
|
1
|
+
{"version":3,"sources":["../../../../../../../libs/plugins/bookings/src/lib/testing/stand-in-tax-profile.ts"],"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\nimport { resetPluginServicesForTests } from '@aglyn/aglyn/plugin-manager/plugin-services'\nimport { registerPluginTaxProfile } from '@aglyn/aglyn/plugin-manager/plugin-tax-profile'\n\n/**\n * A plugin that owns the tenant's tax rule, standing in for the one that does.\n *\n * Bookings prices a charge by asking the tax-profile contract and imports no\n * storefront, so its specs stand an owner up the way the loader would. The\n * rule here is the contract's, as `plugin-tax-profile.ts` states it: exclusive,\n * rounded to the cent, and zero for a rate that is absent, not positive or\n * above a hundred. What these specs certify is that bookings ASKS the owner and\n * charges and records what it is told. That the REAL owner answers the same,\n * and is registered wherever a booking is priced or confirmed, is held where\n * both plugins can be reached: `tax-profile-is-registered.spec.ts` in each app.\n *\n * `flatRate` is the owner's read of the merchant's rate for a kind of charge;\n * a spec hands the rates its merchant set, and with none every rate is unset.\n */\nexport function standInTaxProfile(\n options: { flatRate?: (hostId: string, charge: string) => unknown } = {},\n): void {\n resetPluginServicesForTests()\n registerPluginTaxProfile(\n {\n flatRate: async (hostId, charge) => options.flatRate?.(hostId, charge),\n flatTax: (rate, chargeCents, fallbackLabel) => {\n const source = (rate ?? {}) as { pct?: unknown; label?: unknown }\n const pct = Number(source.pct)\n const usable = Number.isFinite(pct) && pct > 0 && pct <= 100\n const taxCents = usable ? Math.round((chargeCents * pct) / 100) : 0\n if (!(taxCents > 0)) return { taxCents: 0, label: '', pct: 0 }\n return {\n taxCents,\n label: String(source.label || fallbackLabel).slice(0, 120),\n pct,\n }\n },\n // Read off the settled payment, never restated by the caller: automatic\n // when the processor computed it, manual when the caller added a line.\n taxModeOf: (settledPayment, manualTaxCents = 0) => {\n const source = settledPayment as {\n automatic_tax?: { enabled?: unknown }\n total_details?: { amount_tax?: unknown }\n } | null\n if (source?.automatic_tax?.enabled === true) {\n return Number(source.total_details?.amount_tax) > 0\n ? 'stripe-automatic'\n : 'none'\n }\n return manualTaxCents > 0 ? 'manual' : 'none'\n },\n },\n { pluginId: 'tax-owner' },\n )\n}\n"],"names":["resetPluginServicesForTests","registerPluginTaxProfile","standInTaxProfile","options","flatRate","hostId","charge","flatTax","rate","chargeCents","fallbackLabel","source","pct","Number","usable","isFinite","taxCents","Math","round","label","String","slice","taxModeOf","settledPayment","manualTaxCents","automatic_tax","enabled","total_details","amount_tax","pluginId"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED,SAASA,2BAA2B,QAAQ,8CAA6C;AACzF,SAASC,wBAAwB,QAAQ,iDAAgD;AAEzF;;;;;;;;;;;;;;CAcC,GACD,OAAO,SAASC,kBACdC,UAAsE,CAAC,CAAC;IAExEH;IACAC,yBACE;QACEG,UAAU,OAAOC,QAAQC,SAAWH,QAAQC,QAAQ,oBAAhBD,QAAQC,QAAQ,MAAhBD,SAAmBE,QAAQC;QAC/DC,SAAS,CAACC,MAAMC,aAAaC;YAC3B,MAAMC,SAAUH,eAAAA,OAAQ,CAAC;YACzB,MAAMI,MAAMC,OAAOF,OAAOC,GAAG;YAC7B,MAAME,SAASD,OAAOE,QAAQ,CAACH,QAAQA,MAAM,KAAKA,OAAO;YACzD,MAAMI,WAAWF,SAASG,KAAKC,KAAK,CAAC,AAACT,cAAcG,MAAO,OAAO;YAClE,IAAI,CAAEI,CAAAA,WAAW,CAAA,GAAI,OAAO;gBAAEA,UAAU;gBAAGG,OAAO;gBAAIP,KAAK;YAAE;YAC7D,OAAO;gBACLI;gBACAG,OAAOC,OAAOT,OAAOQ,KAAK,IAAIT,eAAeW,KAAK,CAAC,GAAG;gBACtDT;YACF;QACF;QACA,wEAAwE;QACxE,uEAAuE;QACvEU,WAAW,CAACC,gBAAgBC,iBAAiB,CAAC;gBAKxCb;YAJJ,MAAMA,SAASY;YAIf,IAAIZ,CAAAA,2BAAAA,wBAAAA,OAAQc,aAAa,qBAArBd,sBAAuBe,OAAO,MAAK,MAAM;oBAC7Bf;gBAAd,OAAOE,QAAOF,wBAAAA,OAAOgB,aAAa,qBAApBhB,sBAAsBiB,UAAU,IAAI,IAC9C,qBACA;YACN;YACA,OAAOJ,iBAAiB,IAAI,WAAW;QACzC;IACF,GACA;QAAEK,UAAU;IAAY;AAE5B"}
|