@owlmeans/web-payment 0.1.18-rc.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.
Files changed (88) hide show
  1. package/README.md +45 -0
  2. package/agent-meta/manifest.json +16 -0
  3. package/agent-meta/skills/web-payment/SKILL.md +48 -0
  4. package/build/@/components/ui/button.d.ts +10 -0
  5. package/build/@/components/ui/button.d.ts.map +1 -0
  6. package/build/@/components/ui/button.js +15 -0
  7. package/build/@/components/ui/button.js.map +1 -0
  8. package/build/@/components/ui/dialog.d.ts +11 -0
  9. package/build/@/components/ui/dialog.d.ts.map +1 -0
  10. package/build/@/components/ui/dialog.js +12 -0
  11. package/build/@/components/ui/dialog.js.map +1 -0
  12. package/build/@/components/ui/input.d.ts +3 -0
  13. package/build/@/components/ui/input.d.ts.map +1 -0
  14. package/build/@/components/ui/input.js +4 -0
  15. package/build/@/components/ui/input.js.map +1 -0
  16. package/build/@/components/ui/label.d.ts +4 -0
  17. package/build/@/components/ui/label.d.ts.map +1 -0
  18. package/build/@/components/ui/label.js +5 -0
  19. package/build/@/components/ui/label.js.map +1 -0
  20. package/build/@/lib/utils.d.ts +3 -0
  21. package/build/@/lib/utils.d.ts.map +1 -0
  22. package/build/@/lib/utils.js +4 -0
  23. package/build/@/lib/utils.js.map +1 -0
  24. package/build/amount.d.ts +5 -0
  25. package/build/amount.d.ts.map +1 -0
  26. package/build/amount.js +23 -0
  27. package/build/amount.js.map +1 -0
  28. package/build/dialog.d.ts +3 -0
  29. package/build/dialog.d.ts.map +1 -0
  30. package/build/dialog.js +43 -0
  31. package/build/dialog.js.map +1 -0
  32. package/build/hooks.d.ts +13 -0
  33. package/build/hooks.d.ts.map +1 -0
  34. package/build/hooks.js +48 -0
  35. package/build/hooks.js.map +1 -0
  36. package/build/i18n/be.json +1 -0
  37. package/build/i18n/de.json +1 -0
  38. package/build/i18n/en.json +1 -0
  39. package/build/i18n/es.json +1 -0
  40. package/build/i18n/pl.json +1 -0
  41. package/build/i18n/ru.json +1 -0
  42. package/build/i18n/uk.json +1 -0
  43. package/build/i18n.d.ts +2 -0
  44. package/build/i18n.d.ts.map +1 -0
  45. package/build/i18n.js +16 -0
  46. package/build/i18n.js.map +1 -0
  47. package/build/index.d.ts +7 -0
  48. package/build/index.d.ts.map +1 -0
  49. package/build/index.js +6 -0
  50. package/build/index.js.map +1 -0
  51. package/build/service.d.ts +6 -0
  52. package/build/service.d.ts.map +1 -0
  53. package/build/service.js +11 -0
  54. package/build/service.js.map +1 -0
  55. package/build/types.d.ts +10 -0
  56. package/build/types.d.ts.map +1 -0
  57. package/build/types.js +2 -0
  58. package/build/types.js.map +1 -0
  59. package/components.json +8 -0
  60. package/package.json +65 -0
  61. package/src/@/components/ui/button.tsx +20 -0
  62. package/src/@/components/ui/dialog.tsx +29 -0
  63. package/src/@/components/ui/input.tsx +12 -0
  64. package/src/@/components/ui/label.tsx +10 -0
  65. package/src/@/globals.css +1 -0
  66. package/src/@/lib/utils.ts +3 -0
  67. package/src/amount.ts +21 -0
  68. package/src/dialog.tsx +84 -0
  69. package/src/hooks.ts +56 -0
  70. package/src/i18n/be.json +1 -0
  71. package/src/i18n/de.json +1 -0
  72. package/src/i18n/en.json +1 -0
  73. package/src/i18n/es.json +1 -0
  74. package/src/i18n/pl.json +1 -0
  75. package/src/i18n/ru.json +1 -0
  76. package/src/i18n/uk.json +1 -0
  77. package/src/i18n.ts +16 -0
  78. package/src/index.ts +6 -0
  79. package/src/service.ts +11 -0
  80. package/src/types.ts +10 -0
  81. package/tests/amount.spec.ts +40 -0
  82. package/tests/context.ts +33 -0
  83. package/tests/dialog.spec.ts +66 -0
  84. package/tests/harness/index.html +5 -0
  85. package/tests/harness/mount.tsx +29 -0
  86. package/tests/i18n.spec.ts +21 -0
  87. package/tests/tsconfig.json +5 -0
  88. package/tsconfig.json +8 -0
package/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # @owlmeans/web-payment
2
+
3
+ Public React payment hooks and an amount-checkout dialog for OwlMeans applications. Entrypoint
4
+ hooks accept protocol-bound `RegisteredEntrypoint` values. The dialog consumes shadcn primitives
5
+ through the application's `@/components/ui/*` aliases and uses semantic theme tokens only.
6
+
7
+ Add this package's source to Tailwind v4 scanning when consuming source directly:
8
+
9
+ ```css
10
+ @source "../../node_modules/@owlmeans/web-payment/src";
11
+ ```
12
+
13
+ ```tsx
14
+ const { checkout, pending } = useCheckout()
15
+
16
+ <AmountCheckoutDialog
17
+ open={open}
18
+ onOpenChange={setOpen}
19
+ policy={balance.topUpPolicy}
20
+ pending={pending}
21
+ onConfirm={amountMinor => checkout(ctx.entrypoint(account.topUp), {
22
+ body: { amountMinor },
23
+ })}
24
+ />
25
+ ```
26
+
27
+ Checkout redirects the current window by default; pass `useCheckout('_blank')` only when a new tab
28
+ is intentional. The dialog uses the consumer's `@/components/ui/*` primitives, semantic theme
29
+ tokens, integer minor units, and the packaged seven-language `web-payment` resource.
30
+
31
+ <!-- owlmeans:agent-guidance:start -->
32
+ ## Agent guidance
33
+
34
+ This package ships embedded agent skills under `agent-meta/`. After installing your
35
+ `@owlmeans/*` packages, run the OwlMeans agent-skills installer to place them into
36
+ your project's skill store (`.agents/skills/`):
37
+
38
+ ```sh
39
+ npx @owlmeans/agent-skills@^0.1.18-rc.16
40
+ ```
41
+
42
+ The embedded files are version-matched to this package release. Do not edit them
43
+ directly — they are regenerated on each publish. To contribute guidance edits,
44
+ open a PR against the source monorepo.
45
+ <!-- owlmeans:agent-guidance:end -->
@@ -0,0 +1,16 @@
1
+ {
2
+ "schemaVersion": 2,
3
+ "package": "@owlmeans/web-payment",
4
+ "version": "0.1.18-rc.0",
5
+ "generatedAt": "2026-09-12T12:32:46.377Z",
6
+ "canonicalRepo": "https://github.com/owlmeans/common",
7
+ "entries": [
8
+ {
9
+ "kind": "skill",
10
+ "name": "web-payment",
11
+ "category": "package-specific",
12
+ "file": "skills/web-payment/SKILL.md",
13
+ "canonicalPath": ".agents/skills/web-payment/SKILL.md"
14
+ }
15
+ ]
16
+ }
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: web-payment
3
+ description: Public React payment UI for OwlMeans web apps — protocol-bound checkout/balance hooks, same-window redirects, entitlement helpers and the themed AmountCheckoutDialog. Use when building payment UI with @owlmeans/web-payment.
4
+ user-invocable: false
5
+ ---
6
+ <!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
7
+
8
+ # @owlmeans/web-payment
9
+
10
+ Public MIT web package paired with `@owlmeans/server-payment`. It incorporates checkout, balance,
11
+ entitlement and shallow-auth helpers over the underlying `@owlmeans/client-payment` service.
12
+
13
+ Hooks accept `RegisteredEntrypoint<Request, Response>` values. Pass `ctx.entrypoint(protocol)`;
14
+ never weaken a protocol to a home-grown callable type or recover its I/O with a generic. Checkout
15
+ arguments use the protocol's `CallArguments`, so a required body cannot be omitted by the hook.
16
+
17
+ ```typescript
18
+ const { checkout, pending } = useCheckout() // same-window by default
19
+ await checkout(ctx.entrypoint(account.topUp), { body: { amountMinor } })
20
+ ```
21
+
22
+ `useCheckout('_blank')` is the explicit new-tab variant. `openCheckout(url)` defaults to
23
+ `window.location.assign`; both are inert when no DOM exists. `usePaymentBalance` polls one protocol,
24
+ `useEntitlements` extracts its list, and `useEntitlement` uses the shared payment predicate. `null`
25
+ means not known and must render paid controls disabled.
26
+
27
+ ## AmountCheckoutDialog
28
+
29
+ The dialog takes `{ open, onOpenChange, policy, pending, onConfirm }`. It keeps integer minor units,
30
+ accepts locale decimal separators and at most two decimals, shows configured presets plus custom
31
+ input, and reports below/above-bound errors without clamping. Confirmation is disabled when invalid
32
+ or pending.
33
+
34
+ It shows net credit value, processing adjustment and pre-tax subtotal from `chargeAmountMinor`, plus
35
+ the note that Stripe calculates applicable tax. The policy maximum bounds net credit, not the
36
+ adjusted or tax-inclusive debit.
37
+
38
+ The component imports the consuming app's shadcn primitives from
39
+ `@/components/ui/{dialog,input,label,button}` and uses semantic theme tokens. The package carries
40
+ standalone copies under `src/@` only so its own build/tests resolve the same alias contract. A
41
+ Tailwind v4 consumer scanning package source adds:
42
+
43
+ ```css
44
+ @source "../../node_modules/@owlmeans/web-payment/src";
45
+ ```
46
+
47
+ All visible strings live in the `web-payment` library resource and must stay present in all seven
48
+ languages: `en pl ru be uk es de`.
@@ -0,0 +1,10 @@
1
+ import * as React from 'react';
2
+ import { type VariantProps } from 'class-variance-authority';
3
+ declare const buttonVariants: (props?: ({
4
+ variant?: "default" | "outline" | null | undefined;
5
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
+ export declare const Button: ({ className, variant, asChild, ...props }: React.ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
7
+ asChild?: boolean;
8
+ }) => React.JSX.Element;
9
+ export {};
10
+ //# sourceMappingURL=button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../../src/@/components/ui/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAGjE,QAAA,MAAM,cAAc;;8EAQnB,CAAA;AAED,eAAO,MAAM,MAAM,8CACnB,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,YAAY,CAAC,OAAO,cAAc,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,sBAG3F,CAAA"}
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Slot } from '@radix-ui/react-slot';
3
+ import { cva } from 'class-variance-authority';
4
+ import { cn } from '@/lib/utils';
5
+ const buttonVariants = cva('inline-flex h-9 shrink-0 cursor-pointer items-center justify-center gap-2 rounded-md px-4 py-2 text-sm font-medium transition-all outline-none disabled:pointer-events-none disabled:opacity-50 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]', { variants: {
6
+ variant: {
7
+ default: 'bg-primary text-primary-foreground shadow-xs hover:bg-primary/90',
8
+ outline: 'border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground',
9
+ },
10
+ }, defaultVariants: { variant: 'default' } });
11
+ export const Button = ({ className, variant, asChild = false, ...props }) => {
12
+ const Component = asChild ? Slot : 'button';
13
+ return _jsx(Component, { className: cn(buttonVariants({ variant, className })), ...props });
14
+ };
15
+ //# sourceMappingURL=button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.js","sourceRoot":"","sources":["../../../../src/@/components/ui/button.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAEhC,MAAM,cAAc,GAAG,GAAG,CACxB,+QAA+Q,EAC/Q,EAAE,QAAQ,EAAE;QACV,OAAO,EAAE;YACP,OAAO,EAAE,kEAAkE;YAC3E,OAAO,EAAE,6EAA6E;SACvF;KACF,EAAE,eAAe,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,CAC7C,CAAA;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,GAAG,KAAK,EAAE,GAAG,KAAK,EACsB,EAAE,EAAE;IAC9F,MAAM,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAA;IAC3C,OAAO,KAAC,SAAS,IAAC,SAAS,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC,KAAM,KAAK,GAAI,CAAA;AACxF,CAAC,CAAA"}
@@ -0,0 +1,11 @@
1
+ import * as React from 'react';
2
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
3
+ export declare const Dialog: (props: React.ComponentProps<typeof DialogPrimitive.Root>) => React.JSX.Element;
4
+ export declare const DialogContent: ({ className, children, closeLabel, ...props }: React.ComponentProps<typeof DialogPrimitive.Content> & {
5
+ closeLabel?: string;
6
+ }) => React.JSX.Element;
7
+ export declare const DialogHeader: ({ className, ...props }: React.ComponentProps<'div'>) => React.JSX.Element;
8
+ export declare const DialogFooter: ({ className, ...props }: React.ComponentProps<'div'>) => React.JSX.Element;
9
+ export declare const DialogTitle: ({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Title>) => React.JSX.Element;
10
+ export declare const DialogDescription: ({ className, ...props }: React.ComponentProps<typeof DialogPrimitive.Description>) => React.JSX.Element;
11
+ //# sourceMappingURL=dialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../../src/@/components/ui/dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AAGzD,eAAO,MAAM,MAAM,UAAW,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,IAAI,CAAC,sBAAwC,CAAA;AAIvH,eAAO,MAAM,aAAa,kDAC1B,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,OAAO,CAAC,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,sBAW/D,CAAA;AACf,eAAO,MAAM,YAAY,4BAA6B,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,sBACa,CAAA;AAC9F,eAAO,MAAM,YAAY,4BAA6B,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,sBACuB,CAAA;AACxG,eAAO,MAAM,WAAW,4BAA6B,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,KAAK,CAAC,sBACD,CAAA;AACtG,eAAO,MAAM,iBAAiB,4BAA6B,KAAK,CAAC,cAAc,CAAC,OAAO,eAAe,CAAC,WAAW,CAAC,sBACZ,CAAA"}
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import * as DialogPrimitive from '@radix-ui/react-dialog';
3
+ import { cn } from '@/lib/utils';
4
+ export const Dialog = (props) => _jsx(DialogPrimitive.Root, { ...props });
5
+ const DialogPortal = (props) => _jsx(DialogPrimitive.Portal, { ...props });
6
+ const DialogOverlay = ({ className, ...props }) => _jsx(DialogPrimitive.Overlay, { className: cn('fixed inset-0 z-50 bg-black/50', className), ...props });
7
+ export const DialogContent = ({ className, children, closeLabel = 'Close', ...props }) => _jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { className: cn('bg-background fixed left-1/2 top-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg border p-6 shadow-lg sm:max-w-lg', className), ...props, children: [children, _jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-xs opacity-70 hover:opacity-100 focus-visible:ring-2 focus-visible:ring-ring", children: [_jsx("span", { "aria-hidden": "true", children: "\u00D7" }), _jsx("span", { className: "sr-only", children: closeLabel })] })] })] });
8
+ export const DialogHeader = ({ className, ...props }) => _jsx("div", { className: cn('flex flex-col gap-2 text-center sm:text-left', className), ...props });
9
+ export const DialogFooter = ({ className, ...props }) => _jsx("div", { className: cn('flex flex-col-reverse gap-2 sm:flex-row sm:justify-end', className), ...props });
10
+ export const DialogTitle = ({ className, ...props }) => _jsx(DialogPrimitive.Title, { className: cn('text-lg font-semibold leading-none', className), ...props });
11
+ export const DialogDescription = ({ className, ...props }) => _jsx(DialogPrimitive.Description, { className: cn('text-muted-foreground text-sm', className), ...props });
12
+ //# sourceMappingURL=dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../../../src/@/components/ui/dialog.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,eAAe,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAEhC,MAAM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,EAAE,SAAS,EAAE,GAAG,KAAK,EAAsD,EAAE,EAAE,CACzG,KAAC,eAAe,CAAC,KAAK,IAAC,SAAS,EAAE,EAAE,CAAC,oCAAoC,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CAAA;AACtG,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAA4D,EAAE,EAAE,CACrH,KAAC,eAAe,CAAC,WAAW,IAAC,SAAS,EAAE,EAAE,CAAC,+BAA+B,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CAAA"}
@@ -0,0 +1,3 @@
1
+ import * as React from 'react';
2
+ export declare const Input: ({ className, type, ...props }: React.ComponentProps<'input'>) => React.JSX.Element;
3
+ //# sourceMappingURL=input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../../../src/@/components/ui/input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,eAAO,MAAM,KAAK,kCAAmC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,sBAQhF,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from '@/lib/utils';
3
+ export const Input = ({ className, type, ...props }) => _jsx("input", { type: type, "data-slot": "input", className: cn('border-input bg-background placeholder:text-muted-foreground flex h-9 w-full min-w-0 rounded-md border px-3 py-1 text-base shadow-xs outline-none transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50 md:text-sm', 'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:border-destructive aria-invalid:ring-destructive/20', className), ...props });
4
+ //# sourceMappingURL=input.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input.js","sourceRoot":"","sources":["../../../../src/@/components/ui/input.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAEhC,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,KAAK,EAAiC,EAAE,EAAE,CAAC,gBACrF,IAAI,EAAE,IAAI,eAAY,OAAO,EAC7B,SAAS,EAAE,EAAE,CACX,6OAA6O,EAC7O,gJAAgJ,EAChJ,SAAS,CACV,KACG,KAAK,GACT,CAAA"}
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import * as LabelPrimitive from '@radix-ui/react-label';
3
+ export declare const Label: ({ className, ...props }: React.ComponentProps<typeof LabelPrimitive.Root>) => React.JSX.Element;
4
+ //# sourceMappingURL=label.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../../../src/@/components/ui/label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAA;AAGvD,eAAO,MAAM,KAAK,4BAA6B,KAAK,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,IAAI,CAAC,sBAK3F,CAAA"}
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as LabelPrimitive from '@radix-ui/react-label';
3
+ import { cn } from '@/lib/utils';
4
+ export const Label = ({ className, ...props }) => _jsx(LabelPrimitive.Root, { "data-slot": "label", className: cn('flex items-center gap-2 text-sm leading-none font-medium select-none peer-disabled:opacity-50', className), ...props });
5
+ //# sourceMappingURL=label.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"label.js","sourceRoot":"","sources":["../../../../src/@/components/ui/label.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAEhC,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAoD,EAAE,EAAE,CACjG,KAAC,cAAc,CAAC,IAAI,iBACR,OAAO,EACjB,SAAS,EAAE,EAAE,CAAC,+FAA+F,EAAE,SAAS,CAAC,KACrH,KAAK,GACT,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { type ClassValue } from 'clsx';
2
+ export declare const cn: (...inputs: ClassValue[]) => string;
3
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/@/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAE,MAAM,MAAM,CAAA;AAE5C,eAAO,MAAM,EAAE,cAAe,UAAU,EAAE,WAA0B,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { clsx } from 'clsx';
2
+ import { twMerge } from 'tailwind-merge';
3
+ export const cn = (...inputs) => twMerge(clsx(inputs));
4
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/@/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAmB,MAAM,MAAM,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AACxC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAoB,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAA"}
@@ -0,0 +1,5 @@
1
+ export declare const decimalSeparator: (locale: string) => string;
2
+ /** Parse a locale decimal directly to cents; floating-point rounding never enters the path. */
3
+ export declare const parseAmountMinor: (input: string, locale: string) => number | null;
4
+ export declare const inputAmount: (amountMinor: number, locale: string) => string;
5
+ //# sourceMappingURL=amount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"amount.d.ts","sourceRoot":"","sources":["../src/amount.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,WAAY,MAAM,KAAG,MACuB,CAAA;AAEzE,+FAA+F;AAC/F,eAAO,MAAM,gBAAgB,UAAW,MAAM,UAAU,MAAM,KAAG,MAAM,GAAG,IASzE,CAAA;AAED,eAAO,MAAM,WAAW,gBAAiB,MAAM,UAAU,MAAM,KAAG,MAKjE,CAAA"}
@@ -0,0 +1,23 @@
1
+ export const decimalSeparator = (locale) => new Intl.NumberFormat(locale)
2
+ .formatToParts(1.1).find(part => part.type === 'decimal')?.value ?? '.';
3
+ /** Parse a locale decimal directly to cents; floating-point rounding never enters the path. */
4
+ export const parseAmountMinor = (input, locale) => {
5
+ const separator = decimalSeparator(locale);
6
+ let normalized = input.trim().replace(/[\s\u00a0]/g, '');
7
+ if (separator === ',')
8
+ normalized = normalized.replace(',', '.');
9
+ else if (!normalized.includes('.') && normalized.includes(','))
10
+ normalized = normalized.replace(',', '.');
11
+ if (!/^\d+(?:\.\d{0,2})?$/.test(normalized))
12
+ return null;
13
+ const [whole, decimal = ''] = normalized.split('.');
14
+ const value = Number(whole) * 100 + Number(decimal.padEnd(2, '0'));
15
+ return Number.isSafeInteger(value) ? value : null;
16
+ };
17
+ export const inputAmount = (amountMinor, locale) => {
18
+ const separator = decimalSeparator(locale);
19
+ const whole = Math.floor(amountMinor / 100);
20
+ const cents = String(amountMinor % 100).padStart(2, '0');
21
+ return `${whole}${separator}${cents}`;
22
+ };
23
+ //# sourceMappingURL=amount.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"amount.js","sourceRoot":"","sources":["../src/amount.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC;KACtF,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC,EAAE,KAAK,IAAI,GAAG,CAAA;AAEzE,+FAA+F;AAC/F,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC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O,GAAG,KAAK,GAAG,SAAS,GAAG,KAAK,EAAE,CAAA;AACvC,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { AmountCheckoutDialogProps } from './types.js';
2
+ export declare const AmountCheckoutDialog: ({ open, onOpenChange, policy, pending, onConfirm, }: AmountCheckoutDialogProps) => import("react").JSX.Element;
3
+ //# sourceMappingURL=dialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../src/dialog.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAA;AAM3D,eAAO,MAAM,oBAAoB,wDAE9B,yBAAyB,gCAiE3B,CAAA"}
@@ -0,0 +1,43 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useMemo, useState } from 'react';
3
+ import { useI18nLib, useLanguage } from '@owlmeans/client-i18n';
4
+ import { assertCheckoutAmount, chargeAmountMinor } from '@owlmeans/payment';
5
+ import { Button } from '@/components/ui/button';
6
+ import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from '@/components/ui/dialog';
7
+ import { Input } from '@/components/ui/input';
8
+ import { Label } from '@/components/ui/label';
9
+ import { inputAmount, parseAmountMinor } from './amount.js';
10
+ const money = (minor, currency, locale) => new Intl.NumberFormat(locale, {
11
+ style: 'currency', currency: currency.toUpperCase(), minimumFractionDigits: 2,
12
+ }).format(minor / 100);
13
+ export const AmountCheckoutDialog = ({ open, onOpenChange, policy, pending = false, onConfirm, }) => {
14
+ const t = useI18nLib('web-payment', 'amount-checkout');
15
+ const [locale] = useLanguage();
16
+ const [value, setValue] = useState(() => inputAmount(policy.defaultMinor, locale));
17
+ useEffect(() => {
18
+ if (open)
19
+ setValue(inputAmount(policy.defaultMinor, locale));
20
+ }, [open, policy.defaultMinor, locale]);
21
+ const amountMinor = useMemo(() => parseAmountMinor(value, locale), [value, locale]);
22
+ const error = amountMinor == null
23
+ ? t('invalid')
24
+ : amountMinor < policy.minimumMinor
25
+ ? t('below', { amount: money(policy.minimumMinor, policy.currency, locale) })
26
+ : amountMinor > policy.maximumMinor
27
+ ? t('above', { amount: money(policy.maximumMinor, policy.currency, locale) })
28
+ : null;
29
+ const valid = error == null && amountMinor != null;
30
+ const chargeMinor = valid ? chargeAmountMinor(amountMinor, policy) : 0;
31
+ const adjustmentMinor = valid && amountMinor != null ? chargeMinor - amountMinor : 0;
32
+ const submit = async () => {
33
+ if (amountMinor == null || !valid || pending)
34
+ return;
35
+ assertCheckoutAmount(policy, amountMinor);
36
+ await onConfirm(amountMinor);
37
+ };
38
+ return _jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { closeLabel: t('close'), children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: t('title') }), _jsx(DialogDescription, { children: t('description') })] }), _jsxs("div", { className: "grid gap-5", children: [_jsx("div", { className: "grid grid-cols-2 gap-2 sm:grid-cols-4", "aria-label": t('presets'), children: policy.presetsMinor.map(preset => _jsx(Button, { type: "button", variant: preset === amountMinor ? 'default' : 'outline', disabled: pending, onClick: () => setValue(inputAmount(preset, locale)), children: money(preset, policy.currency, locale) }, preset)) }), _jsxs("div", { className: "grid gap-2", children: [_jsx(Label, { htmlFor: "payment-amount", children: t('custom') }), _jsx(Input, { id: "payment-amount", inputMode: "decimal", autoComplete: "off", value: value, disabled: pending, "aria-invalid": error != null, "aria-describedby": "payment-amount-help", onChange: event => setValue(event.target.value) }), _jsx("p", { id: "payment-amount-help", className: error == null ? 'text-muted-foreground text-xs' : 'text-destructive text-xs', children: error ?? t('bounds', {
39
+ minimum: money(policy.minimumMinor, policy.currency, locale),
40
+ maximum: money(policy.maximumMinor, policy.currency, locale),
41
+ }) })] }), _jsxs("dl", { className: "grid grid-cols-[1fr_auto] gap-x-4 gap-y-2 rounded-lg border bg-muted/30 p-4 text-sm", children: [_jsx("dt", { className: "text-muted-foreground", children: t('credits') }), _jsx("dd", { children: valid && amountMinor != null ? money(amountMinor, policy.currency, locale) : '—' }), _jsx("dt", { className: "text-muted-foreground", children: t('adjustment') }), _jsx("dd", { children: valid ? money(adjustmentMinor, policy.currency, locale) : '—' }), _jsx("dt", { className: "font-medium", children: t('subtotal') }), _jsx("dd", { className: "font-medium", children: valid ? money(chargeMinor, policy.currency, locale) : '—' })] }), _jsx("p", { className: "text-muted-foreground text-xs", children: t('tax-note') })] }), _jsxs(DialogFooter, { children: [_jsx(Button, { type: "button", variant: "outline", disabled: pending, onClick: () => onOpenChange(false), children: t('cancel') }), _jsx(Button, { type: "button", disabled: !valid || pending, onClick: () => void submit(), children: pending ? t('pending') : t('continue') })] })] }) });
42
+ };
43
+ //# sourceMappingURL=dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog.js","sourceRoot":"","sources":["../src/dialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACpD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EACL,MAAM,EAAE,aAAa,EAAE,iBAAiB,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,GAClF,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAC7C,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AAG3D,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,QAAgB,EAAE,MAAc,EAAU,EAAE,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;IACvG,KAA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AM,CAAC,CAAC,CAAC,CAAC,GAAG,GAAM,EACpJ,aAAI,SAAS,EAAC,uBAAuB,YAAE,CAAC,CAAC,YAAY,CAAC,GAAM,EAAA,uBAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,eAAe,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,GAAM,EACpI,aAAI,SAAS,EAAC,aAAa,YAAE,CAAC,CAAC,UAAU,CAAC,GAAM,EAAA,aAAI,SAAS,EAAC,aAAa,YAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,GAAM,IACzI,EACL,YAAG,SAAS,EAAC,+BAA+B,YAAE,CAAC,CAAC,UAAU,CAAC,GAAK,IAC5D,EACN,MAAC,YAAY,eACX,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAC,SAAS,EAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,YAAG,CAAC,CAAC,QAAQ,CAAC,GAAU,EACrH,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,QAAQ,EAAE,CAAC,KAAK,IAAI,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,MAAM,EAAE,YAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAU,IACrH,IACD,GACT,CAAA;AACX,CAAC,CAAA"}
@@ -0,0 +1,13 @@
1
+ import type { CallArguments, RegisteredEntrypoint, RequestShape } from '@owlmeans/entrypoint';
2
+ import { type CheckoutTarget } from './service.js';
3
+ import type { CheckoutResult } from './types.js';
4
+ export declare const useCheckout: (target?: CheckoutTarget) => {
5
+ checkout: <Request extends RequestShape>(entry: RegisteredEntrypoint<Request, CheckoutResult>, ...request: CallArguments<Request>) => Promise<CheckoutResult | null>;
6
+ pending: boolean;
7
+ };
8
+ export declare const usePaymentBalance: <T>(entry: RegisteredEntrypoint<{}, T>, intervalMs?: number, deps?: unknown[]) => T | null;
9
+ export declare const useEntitlements: <T extends {
10
+ entitlements?: string[];
11
+ }>(entry: RegisteredEntrypoint<{}, T>, intervalMs?: number, deps?: unknown[]) => string[] | null;
12
+ export declare const useEntitlement: (list: string[] | null, param: string) => boolean;
13
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAE7F,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEhD,eAAO,MAAM,WAAW,YAAY,cAAc;eAEZ,OAAO,SAAS,YAAY,SACvD,oBAAoB,CAAC,OAAO,EAAE,cAAc,CAAC,cAAc,aAAa,CAAC,OAAO,CAAC,KACvF,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;;CASlC,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,CAAC,SAC1B,oBAAoB,CAAC,EAAE,EAAE,CAAC,CAAC,eAAc,MAAM,SAAiB,OAAO,EAAE,KAC/E,CAAC,GAAG,IAkBN,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS;IAAE,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,SAC5D,oBAAoB,CAAC,EAAE,EAAE,CAAC,CAAC,eAAc,MAAM,SAAiB,OAAO,EAAE,KAC/E,MAAM,EAAE,GAAG,IAAwE,CAAA;AAEtF,eAAO,MAAM,cAAc,SAAU,MAAM,EAAE,GAAG,IAAI,SAAS,MAAM,KAAG,OAQrE,CAAA"}
package/build/hooks.js ADDED
@@ -0,0 +1,48 @@
1
+ import { useCallback, useEffect, useRef, useState } from 'react';
2
+ import { hasEntitlement } from '@owlmeans/payment';
3
+ import { openCheckout } from './service.js';
4
+ export const useCheckout = (target = '_self') => {
5
+ const [pending, setPending] = useState(false);
6
+ const checkout = useCallback(async (entry, ...request) => {
7
+ setPending(true);
8
+ try {
9
+ const result = await entry.call(...request);
10
+ if (result?.url != null)
11
+ openCheckout(result.url, target);
12
+ return result ?? null;
13
+ }
14
+ finally {
15
+ setPending(false);
16
+ }
17
+ }, [target]);
18
+ return { checkout, pending };
19
+ };
20
+ export const usePaymentBalance = (entry, intervalMs = 60_000, deps = []) => {
21
+ const [balance, setBalance] = useState(null);
22
+ const entryRef = useRef(entry);
23
+ entryRef.current = entry;
24
+ useEffect(() => {
25
+ let active = true;
26
+ const load = async () => {
27
+ try {
28
+ const value = await entryRef.current.call();
29
+ if (active)
30
+ setBalance(value);
31
+ }
32
+ catch { /* explicit actions own their errors */ }
33
+ };
34
+ void load();
35
+ const ticker = setInterval(load, intervalMs);
36
+ return () => { active = false; clearInterval(ticker); };
37
+ // eslint-disable-next-line react-hooks/exhaustive-deps
38
+ }, [intervalMs, ...deps]);
39
+ return balance;
40
+ };
41
+ export const useEntitlements = (entry, intervalMs = 60_000, deps = []) => usePaymentBalance(entry, intervalMs, deps)?.entitlements ?? null;
42
+ export const useEntitlement = (list, param) => list != null && hasEntitlement(list.map(item => {
43
+ const colon = item.indexOf(':');
44
+ return colon >= 0
45
+ ? { scope: item.slice(0, colon), permissions: { [item.slice(colon + 1)]: true } }
46
+ : { scope: '', permissions: { [item]: true } };
47
+ }), param);
48
+ //# sourceMappingURL=hooks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.js","sourceRoot":"","sources":["../src/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,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AE,EAAE,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,CAAA;AAClD,CAAC,CAAC,EACF,KAAK,CACN,CAAA"}
@@ -0,0 +1 @@
1
+ { "amount-checkout": { "title": "Папоўніць крэдыты", "description": "Выберыце чысты кошт крэдытаў для арганізацыі.", "presets": "Гатовыя сумы", "custom": "Свая сума", "invalid": "Увядзіце карэктную суму, не больш за два знакі пасля коскі.", "below": "Мінімальная сума — {{amount}}.", "above": "Максімальная сума — {{amount}}.", "bounds": "Выберыце суму ад {{minimum}} да {{maximum}}.", "credits": "Кошт крэдытаў", "adjustment": "Карэкціроўка апрацоўкі", "subtotal": "Сума да падатку", "tax-note": "Stripe разлічыць падатак падчас аплаты.", "cancel": "Скасаваць", "continue": "Перайсці ў Stripe", "pending": "Адкрываем аплату…", "close": "Закрыць" } }
@@ -0,0 +1 @@
1
+ { "amount-checkout": { "title": "Guthaben aufladen", "description": "Wähle den Nettowert des Guthabens für deine Organisation.", "presets": "Vorgegebene Beträge", "custom": "Eigener Betrag", "invalid": "Gib einen gültigen Betrag mit höchstens zwei Dezimalstellen ein.", "below": "Der Mindestbetrag ist {{amount}}.", "above": "Der Höchstbetrag ist {{amount}}.", "bounds": "Wähle zwischen {{minimum}} und {{maximum}}.", "credits": "Guthabenwert", "adjustment": "Verarbeitungsaufschlag", "subtotal": "Zwischensumme vor Steuern", "tax-note": "Stripe berechnet anwendbare Steuern beim Bezahlen.", "cancel": "Abbrechen", "continue": "Weiter zu Stripe", "pending": "Zahlung wird geöffnet…", "close": "Schließen" } }
@@ -0,0 +1 @@
1
+ { "amount-checkout": { "title": "Add credits", "description": "Choose the net credit value to add to your organization.", "presets": "Preset amounts", "custom": "Custom amount", "invalid": "Enter a valid amount with no more than two decimal places.", "below": "The minimum amount is {{amount}}.", "above": "The maximum amount is {{amount}}.", "bounds": "Choose between {{minimum}} and {{maximum}}.", "credits": "Credit value", "adjustment": "Processing adjustment", "subtotal": "Pre-tax subtotal", "tax-note": "Stripe calculates any applicable tax at checkout.", "cancel": "Cancel", "continue": "Continue to Stripe", "pending": "Opening checkout…", "close": "Close" } }
@@ -0,0 +1 @@
1
+ { "amount-checkout": { "title": "Añadir créditos", "description": "Elige el valor neto de créditos para tu organización.", "presets": "Importes predefinidos", "custom": "Importe personalizado", "invalid": "Introduce un importe válido con un máximo de dos decimales.", "below": "El importe mínimo es {{amount}}.", "above": "El importe máximo es {{amount}}.", "bounds": "Elige entre {{minimum}} y {{maximum}}.", "credits": "Valor de los créditos", "adjustment": "Ajuste de procesamiento", "subtotal": "Subtotal antes de impuestos", "tax-note": "Stripe calcula los impuestos aplicables al pagar.", "cancel": "Cancelar", "continue": "Continuar a Stripe", "pending": "Abriendo el pago…", "close": "Cerrar" } }
@@ -0,0 +1 @@
1
+ { "amount-checkout": { "title": "Dodaj kredyty", "description": "Wybierz wartość netto kredytów dla organizacji.", "presets": "Kwoty sugerowane", "custom": "Własna kwota", "invalid": "Wpisz prawidłową kwotę z maksymalnie dwoma miejscami dziesiętnymi.", "below": "Minimalna kwota to {{amount}}.", "above": "Maksymalna kwota to {{amount}}.", "bounds": "Wybierz od {{minimum}} do {{maximum}}.", "credits": "Wartość kredytów", "adjustment": "Korekta przetwarzania", "subtotal": "Suma przed podatkiem", "tax-note": "Stripe obliczy należny podatek podczas płatności.", "cancel": "Anuluj", "continue": "Przejdź do Stripe", "pending": "Otwieranie płatności…", "close": "Zamknij" } }
@@ -0,0 +1 @@
1
+ { "amount-checkout": { "title": "Пополнить кредиты", "description": "Выберите чистую стоимость кредитов для организации.", "presets": "Готовые суммы", "custom": "Своя сумма", "invalid": "Введите корректную сумму, не более двух знаков после запятой.", "below": "Минимальная сумма — {{amount}}.", "above": "Максимальная сумма — {{amount}}.", "bounds": "Выберите сумму от {{minimum}} до {{maximum}}.", "credits": "Стоимость кредитов", "adjustment": "Корректировка обработки", "subtotal": "Сумма до налога", "tax-note": "Stripe рассчитает применимый налог при оплате.", "cancel": "Отмена", "continue": "Перейти в Stripe", "pending": "Открываем оплату…", "close": "Закрыть" } }
@@ -0,0 +1 @@
1
+ { "amount-checkout": { "title": "Поповнити кредити", "description": "Виберіть чисту вартість кредитів для організації.", "presets": "Готові суми", "custom": "Власна сума", "invalid": "Введіть коректну суму, не більше двох знаків після коми.", "below": "Мінімальна сума — {{amount}}.", "above": "Максимальна сума — {{amount}}.", "bounds": "Виберіть суму від {{minimum}} до {{maximum}}.", "credits": "Вартість кредитів", "adjustment": "Коригування обробки", "subtotal": "Сума до податку", "tax-note": "Stripe розрахує застосовний податок під час оплати.", "cancel": "Скасувати", "continue": "Перейти до Stripe", "pending": "Відкриваємо оплату…", "close": "Закрити" } }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=i18n.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":""}
package/build/i18n.js ADDED
@@ -0,0 +1,16 @@
1
+ import { addI18nLib } from '@owlmeans/i18n';
2
+ import en from './i18n/en.json' with { type: 'json' };
3
+ import pl from './i18n/pl.json' with { type: 'json' };
4
+ import ru from './i18n/ru.json' with { type: 'json' };
5
+ import be from './i18n/be.json' with { type: 'json' };
6
+ import uk from './i18n/uk.json' with { type: 'json' };
7
+ import es from './i18n/es.json' with { type: 'json' };
8
+ import de from './i18n/de.json' with { type: 'json' };
9
+ addI18nLib('en', 'web-payment', en);
10
+ addI18nLib('pl', 'web-payment', pl);
11
+ addI18nLib('ru', 'web-payment', ru);
12
+ addI18nLib('be', 'web-payment', be);
13
+ addI18nLib('uk', 'web-payment', uk);
14
+ addI18nLib('es', 'web-payment', es);
15
+ addI18nLib('de', 'web-payment', de);
16
+ //# sourceMappingURL=i18n.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n.js","sourceRoot":"","sources":["../src/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,MAAM,gBAAgB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AACrD,OAAO,EAAE,MAAM,gBAAgB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AACrD,OAAO,EAAE,MAAM,gBAAgB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AACrD,OAAO,EAAE,MAAM,gBAAgB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AACrD,OAAO,EAAE,MAAM,gBAAgB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AACrD,OAAO,EAAE,MAAM,gBAAgB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AACrD,OAAO,EAAE,MAAM,gBAAgB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAA;AAErD,UAAU,CAAC,IAAI,EAAE,aAAa,EAAE,EAAE,CAAC,CAAA;AACnC,UAAU,CAAC,IAAI,EAAE,aAAa,EAAE,EAAE,CAAC,CAAA;AACnC,UAAU,CAAC,IAAI,EAAE,aAAa,EAAE,EAAE,CAAC,CAAA;AACnC,UAAU,CAAC,IAAI,EAAE,aAAa,EAAE,EAAE,CAAC,CAAA;AACnC,UAAU,CAAC,IAAI,EAAE,aAAa,EAAE,EAAE,CAAC,CAAA;AACnC,UAAU,CAAC,IAAI,EAAE,aAAa,EAAE,EAAE,CAAC,CAAA;AACnC,UAAU,CAAC,IAAI,EAAE,aAAa,EAAE,EAAE,CAAC,CAAA"}
@@ -0,0 +1,7 @@
1
+ import './i18n.js';
2
+ export type * from './types.js';
3
+ export * from './service.js';
4
+ export * from './hooks.js';
5
+ export * from './amount.js';
6
+ export * from './dialog.js';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,CAAA;AAClB,mBAAmB,YAAY,CAAA;AAC/B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA"}
package/build/index.js ADDED
@@ -0,0 +1,6 @@
1
+ import './i18n.js';
2
+ export * from './service.js';
3
+ export * from './hooks.js';
4
+ export * from './amount.js';
5
+ export * from './dialog.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,CAAA;AAElB,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA"}
@@ -0,0 +1,6 @@
1
+ export type CheckoutTarget = '_self' | '_blank';
2
+ /** Same-window by default so browser return/cancel state stays in one application tab. */
3
+ export declare const openCheckout: (url: string, target?: CheckoutTarget) => void;
4
+ export { makePaymentService, appendPaymentService } from '@owlmeans/client-payment';
5
+ export type { PaymentService } from '@owlmeans/client-payment';
6
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,QAAQ,CAAA;AAE/C,0FAA0F;AAC1F,eAAO,MAAM,YAAY,QAAS,MAAM,WAAU,cAAc,KAAa,IAI5E,CAAA;AAED,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA;AACnF,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA"}
@@ -0,0 +1,11 @@
1
+ /** Same-window by default so browser return/cancel state stays in one application tab. */
2
+ export const openCheckout = (url, target = '_self') => {
3
+ if (typeof window === 'undefined' || url === '')
4
+ return;
5
+ if (target === '_self')
6
+ window.location.assign(url);
7
+ else
8
+ window.open(url, target, 'noopener,noreferrer');
9
+ };
10
+ export { makePaymentService, appendPaymentService } from '@owlmeans/client-payment';
11
+ //# sourceMappingURL=service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAEA,0FAA0F;AAC1F,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,GAAW,EAAE,MAAM,GAAmB,OAAO,EAAQ,EAAE;IAClF,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,GAAG,KAAK,EAAE;QAAE,OAAM;IACvD,IAAI,MAAM,KAAK,OAAO;QAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;;QAC9C,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,qBAAqB,CAAC,CAAA;AACtD,CAAC,CAAA;AAED,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAA"}
@@ -0,0 +1,10 @@
1
+ import type { AmountCheckoutPolicy, CreateCheckoutResponse } from '@owlmeans/payment';
2
+ export type CheckoutResult = CreateCheckoutResponse;
3
+ export interface AmountCheckoutDialogProps {
4
+ open: boolean;
5
+ onOpenChange: (open: boolean) => void;
6
+ policy: AmountCheckoutPolicy;
7
+ pending?: boolean;
8
+ onConfirm: (amountMinor: number) => Promise<void> | void;
9
+ }
10
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAErF,MAAM,MAAM,cAAc,GAAG,sBAAsB,CAAA;AACnD,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,MAAM,EAAE,oBAAoB,CAAA;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;CACzD"}
package/build/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "https://ui.shadcn.com/schema.json",
3
+ "style": "new-york",
4
+ "rsc": false,
5
+ "tsx": true,
6
+ "tailwind": { "config": "", "css": "src/@/globals.css", "baseColor": "neutral", "cssVariables": true, "prefix": "" },
7
+ "aliases": { "components": "@/components", "ui": "@/components/ui", "utils": "@/lib/utils", "lib": "@/lib", "hooks": "@/hooks" }
8
+ }