@pontive/pontkit-core 1.43.0 → 1.44.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.
@@ -1,3 +1,4 @@
1
+ import { AccountBillingApi } from './account-billing';
1
2
  import { SessionChange } from './sdk';
2
3
  /**
3
4
  * # `AccountClient`: what the account widgets talk to (migration decision D9, tracker W-12)
@@ -235,8 +236,11 @@ export interface AccountMembersApi {
235
236
  */
236
237
  requestedScopes?(): string[];
237
238
  }
238
- /** The account widgets' client: the session part, plus the parts the settings and members widgets need. */
239
- export interface AccountClient extends AccountSessionApi, Partial<AccountProfileApi>, Partial<AccountMembersApi> {
239
+ /**
240
+ * The account widgets' client: the session part, plus the parts the settings, members and billing
241
+ * widgets need. The billing part is `account-billing.ts` (billing-svc docs/m17-design.md, Part 3).
242
+ */
243
+ export interface AccountClient extends AccountSessionApi, Partial<AccountProfileApi>, Partial<AccountMembersApi>, Partial<AccountBillingApi> {
240
244
  }
241
245
  /**
242
246
  * `pont:account-client`: the account widgets' client. Undefined until the provider has configured
@@ -313,7 +317,7 @@ export declare function managementBase(apiBaseUrl: string | undefined): string |
313
317
  * (`getManagementToken`, cached and coalesced by the SDK; carry-over §5). What the legacy
314
318
  * `src/service/http` did, as one object.
315
319
  */
316
- export declare class SdkAccountClient implements AccountSessionApi, AccountProfileApi, AccountMembersApi {
320
+ export declare class SdkAccountClient implements AccountSessionApi, AccountProfileApi, AccountMembersApi, AccountBillingApi {
317
321
  readonly sdk: AccountSdk;
318
322
  readonly apiBaseUrl: string;
319
323
  readonly appId: string | undefined;
@@ -321,6 +325,34 @@ export declare class SdkAccountClient implements AccountSessionApi, AccountProfi
321
325
  readonly scope: string | string[] | undefined;
322
326
  private readonly fetchImpl;
323
327
  constructor(options: AccountClientOptions);
328
+ readonly listBillingAccounts: AccountBillingApi["listBillingAccounts"];
329
+ readonly listMyContracts: AccountBillingApi["listMyContracts"];
330
+ readonly previewMyContractChange: AccountBillingApi["previewMyContractChange"];
331
+ readonly changeMyContract: AccountBillingApi["changeMyContract"];
332
+ readonly cancelMyContract: AccountBillingApi["cancelMyContract"];
333
+ readonly revokeMyContractCancellation: AccountBillingApi["revokeMyContractCancellation"];
334
+ readonly createMyCheckoutSession: AccountBillingApi["createMyCheckoutSession"];
335
+ readonly getMyCheckoutSession: AccountBillingApi["getMyCheckoutSession"];
336
+ readonly previewMyCheckout: AccountBillingApi["previewMyCheckout"];
337
+ readonly confirmMyCheckout: AccountBillingApi["confirmMyCheckout"];
338
+ readonly listMyInvoices: AccountBillingApi["listMyInvoices"];
339
+ readonly getMyInvoice: AccountBillingApi["getMyInvoice"];
340
+ readonly getMyInvoicePdf: AccountBillingApi["getMyInvoicePdf"];
341
+ readonly getMyUpcomingInvoice: AccountBillingApi["getMyUpcomingInvoice"];
342
+ readonly listMyCreditNotes: AccountBillingApi["listMyCreditNotes"];
343
+ readonly payMyInvoice: AccountBillingApi["payMyInvoice"];
344
+ readonly listMyPaymentMethods: AccountBillingApi["listMyPaymentMethods"];
345
+ readonly createMyPaymentMethodSession: AccountBillingApi["createMyPaymentMethodSession"];
346
+ readonly setMyDefaultPaymentMethod: AccountBillingApi["setMyDefaultPaymentMethod"];
347
+ readonly removeMyPaymentMethod: AccountBillingApi["removeMyPaymentMethod"];
348
+ readonly listMyPayments: AccountBillingApi["listMyPayments"];
349
+ readonly listMyBalances: AccountBillingApi["listMyBalances"];
350
+ readonly listMyLedgerEntries: AccountBillingApi["listMyLedgerEntries"];
351
+ readonly getMyUsage: AccountBillingApi["getMyUsage"];
352
+ readonly listMyEntitlements: AccountBillingApi["listMyEntitlements"];
353
+ readonly checkMyEntitlement: AccountBillingApi["checkMyEntitlement"];
354
+ /** One billing route with a management token (the billing scopes are only on it). */
355
+ private billingRequest;
324
356
  getUser(): SessionUser | null;
325
357
  getOrganization(): SessionOrganization | null;
326
358
  listMyOrganizations(): Promise<MyOrganization[]>;
@@ -351,5 +383,7 @@ export declare class SdkAccountClient implements AccountSessionApi, AccountProfi
351
383
  */
352
384
  private request;
353
385
  }
386
+ /** A fresh key for one create or mutate call (pontive-api-design-spec.md, Idempotency). */
387
+ export declare function idempotencyKey(): string;
354
388
  /** The default account client over `sdk`. */
355
389
  export declare function createAccountClient(options: AccountClientOptions): SdkAccountClient;
@@ -4,6 +4,7 @@ import { AccountClient } from './account-client';
4
4
  import { AuthState } from './contexts';
5
5
  import { AppSdkConfig, ProviderSdk } from './sdk';
6
6
  export * from './account-client';
7
+ export * from './account-billing';
7
8
  export * from './account-controller';
8
9
  export * from './account-user';
9
10
  export * from './contexts';
package/dist/styles.css CHANGED
@@ -9735,3 +9735,460 @@
9735
9735
  justify-content: flex-end;
9736
9736
  }
9737
9737
  }
9738
+
9739
+ /* ../kit/checkout/checkout.css */
9740
+ /*
9741
+ * <pont-checkout>: a header, the package and frequency choice, the address, the first invoice
9742
+ * and the payment step. The recipes style the radio group, fields, inputs, buttons, badges,
9743
+ * alerts and spinner; here: the layout, the option cards, and the invoice summary that
9744
+ * <pont-billing-portal> shares (the [data-pont-billing-*] hooks). The Payment Element is Stripe's
9745
+ * iframe; its colours come from the tokens through Stripe's Appearance API, not from this file.
9746
+ */
9747
+ @layer pont.kit {
9748
+ pont-checkout {
9749
+ display: block;
9750
+ }
9751
+
9752
+ [data-pont-checkout-page] {
9753
+ display: flex;
9754
+ flex-direction: column;
9755
+ gap: 1.5rem;
9756
+ inline-size: var(--pont-ref-dimension-size-full);
9757
+ }
9758
+
9759
+ [data-pont-checkout-title] {
9760
+ margin: 0;
9761
+ font-size: var(--pont-ref-typography-size-xl);
9762
+ font-weight: var(--pont-ref-typography-weight-semibold);
9763
+ line-height: 1.3;
9764
+ }
9765
+
9766
+ [data-pont-checkout-subtitle] {
9767
+ margin: 0 0 0.75rem;
9768
+ font-size: var(--pont-ref-typography-size-base);
9769
+ font-weight: var(--pont-ref-typography-weight-semibold);
9770
+ }
9771
+
9772
+ [data-pont-checkout-form],
9773
+ [data-pont-checkout-address] {
9774
+ display: grid;
9775
+ gap: 1.25rem;
9776
+ }
9777
+
9778
+ [data-pont-checkout-legend] {
9779
+ margin-block-end: 0.75rem;
9780
+ font-size: var(--pont-ref-typography-size-sm);
9781
+ font-weight: var(--pont-ref-typography-weight-medium);
9782
+ }
9783
+
9784
+ [data-pont-checkout-packages] {
9785
+ display: grid;
9786
+ gap: 0.75rem;
9787
+ }
9788
+
9789
+ [data-pont-checkout-option] {
9790
+ display: flex;
9791
+ align-items: flex-start;
9792
+ gap: 0.75rem;
9793
+ padding: 1rem;
9794
+ border: 1px solid var(--pont-sem-color-border);
9795
+ border-radius: var(--pont-ref-radius-lg);
9796
+ }
9797
+
9798
+ [data-pont-checkout-option][data-selected] {
9799
+ border-color: var(--pont-sem-color-primary);
9800
+ }
9801
+
9802
+ [data-pont-checkout-option-label] {
9803
+ display: grid;
9804
+ gap: 0.25rem;
9805
+ flex: 1 1 auto;
9806
+ min-inline-size: 0;
9807
+ cursor: pointer;
9808
+ }
9809
+
9810
+ [data-pont-checkout-option-name] {
9811
+ font-weight: var(--pont-ref-typography-weight-semibold);
9812
+ }
9813
+
9814
+ [data-pont-checkout-option-tagline],
9815
+ [data-pont-checkout-period],
9816
+ [data-pont-checkout-trial],
9817
+ [data-pont-checkout-trial-note] {
9818
+ font-size: var(--pont-ref-typography-size-sm);
9819
+ color: var(--pont-sem-color-muted-fg);
9820
+ }
9821
+
9822
+ [data-pont-checkout-frequencies] {
9823
+ display: flex;
9824
+ flex-wrap: wrap;
9825
+ gap: 1rem;
9826
+ }
9827
+
9828
+ [data-pont-checkout-frequency] {
9829
+ display: inline-flex;
9830
+ align-items: center;
9831
+ gap: 0.5rem;
9832
+ }
9833
+
9834
+ [data-pont-checkout-review] {
9835
+ display: grid;
9836
+ gap: 1.5rem;
9837
+ }
9838
+
9839
+ [data-pont-checkout-chosen] {
9840
+ display: flex;
9841
+ flex-wrap: wrap;
9842
+ align-items: baseline;
9843
+ gap: 0.5rem;
9844
+ margin: 0 0 0.75rem;
9845
+ }
9846
+
9847
+ /* Stripe's iframe goes in here: no padding or border of ours, so it lays out as Stripe expects. */
9848
+ [data-pont-checkout-payment-element] {
9849
+ min-block-size: 3rem;
9850
+ margin-block-end: 1rem;
9851
+ }
9852
+
9853
+ [data-pont-checkout-actions] {
9854
+ display: flex;
9855
+ flex-wrap: wrap;
9856
+ justify-content: flex-end;
9857
+ gap: 0.5rem;
9858
+ }
9859
+
9860
+ [data-pont-checkout-problem] {
9861
+ display: flex;
9862
+ flex-direction: column;
9863
+ align-items: flex-start;
9864
+ gap: 1rem;
9865
+ }
9866
+
9867
+ [data-pont-checkout-loading],
9868
+ [data-pont-checkout-confirming],
9869
+ [data-pont-checkout-done] {
9870
+ display: flex;
9871
+ flex-direction: column;
9872
+ align-items: center;
9873
+ gap: 0.75rem;
9874
+ padding-block: 2.5rem;
9875
+ text-align: center;
9876
+ }
9877
+
9878
+ [data-pont-checkout-loading] > :is(pont-prim-spinner, [data-pont-spinner]),
9879
+ [data-pont-checkout-confirming] > :is(pont-prim-spinner, [data-pont-spinner]) {
9880
+ inline-size: 1.5rem;
9881
+ block-size: 1.5rem;
9882
+ }
9883
+
9884
+ [data-pont-checkout-confirming] p,
9885
+ [data-pont-checkout-done] p {
9886
+ margin: 0;
9887
+ }
9888
+
9889
+ [data-pont-checkout-done] svg {
9890
+ inline-size: 2rem;
9891
+ block-size: 2rem;
9892
+ color: var(--pont-sem-color-success);
9893
+ }
9894
+
9895
+ [data-pont-checkout-footer] {
9896
+ display: flex;
9897
+ justify-content: flex-end;
9898
+ }
9899
+
9900
+ /* Shared with <pont-billing-portal>: an invoice's lines and totals, amounts in tabular figures. */
9901
+ [data-pont-billing-amount] {
9902
+ font-variant-numeric: tabular-nums;
9903
+ white-space: nowrap;
9904
+ }
9905
+
9906
+ [data-pont-billing-invoice] {
9907
+ display: grid;
9908
+ gap: 0.75rem;
9909
+ font-size: var(--pont-ref-typography-size-sm);
9910
+ }
9911
+
9912
+ [data-pont-billing-lines] {
9913
+ display: grid;
9914
+ gap: 0.5rem;
9915
+ margin: 0;
9916
+ padding: 0;
9917
+ list-style: none;
9918
+ }
9919
+
9920
+ [data-pont-billing-line],
9921
+ [data-pont-billing-totals] > div {
9922
+ display: flex;
9923
+ justify-content: space-between;
9924
+ gap: 1rem;
9925
+ }
9926
+
9927
+ [data-pont-billing-line-description] {
9928
+ min-inline-size: 0;
9929
+ overflow-wrap: anywhere;
9930
+ }
9931
+
9932
+ [data-pont-billing-totals] {
9933
+ display: grid;
9934
+ gap: 0.375rem;
9935
+ margin: 0;
9936
+ padding-block-start: 0.75rem;
9937
+ border-block-start: 1px solid var(--pont-sem-color-border);
9938
+ }
9939
+
9940
+ [data-pont-billing-totals] dt {
9941
+ color: var(--pont-sem-color-muted-fg);
9942
+ }
9943
+
9944
+ [data-pont-billing-totals] dd {
9945
+ margin: 0;
9946
+ }
9947
+
9948
+ [data-pont-billing-due] {
9949
+ font-weight: var(--pont-ref-typography-weight-semibold);
9950
+ }
9951
+
9952
+ [data-pont-billing-due] dt {
9953
+ color: var(--pont-sem-color-fg);
9954
+ }
9955
+ }
9956
+
9957
+ /* ../kit/billing-portal/billing-portal.css */
9958
+ /*
9959
+ * <pont-billing-portal>: a header, the account picker, the recovery notice, and the Plan,
9960
+ * Invoices, Credit notes and Payment methods sections, each with its inline panel. The recipes
9961
+ * style the table, badges, buttons, radio group, fields, alerts and spinner; the invoice summary is
9962
+ * checkout.css's [data-pont-billing-*]. The Payment Element is Stripe's iframe, styled through
9963
+ * Stripe's Appearance API from the tokens.
9964
+ */
9965
+ @layer pont.kit {
9966
+ pont-billing-portal {
9967
+ display: block;
9968
+ }
9969
+
9970
+ [data-pont-billing-portal-page] {
9971
+ display: flex;
9972
+ flex-direction: column;
9973
+ gap: 1.5rem;
9974
+ inline-size: var(--pont-ref-dimension-size-full);
9975
+ }
9976
+
9977
+ [data-pont-billing-portal-header] {
9978
+ display: grid;
9979
+ gap: 0.25rem;
9980
+ }
9981
+
9982
+ [data-pont-billing-portal-title] {
9983
+ margin: 0;
9984
+ font-size: var(--pont-ref-typography-size-xl);
9985
+ font-weight: var(--pont-ref-typography-weight-semibold);
9986
+ line-height: 1.3;
9987
+ }
9988
+
9989
+ [data-pont-billing-portal-subtitle],
9990
+ [data-pont-billing-portal-muted] {
9991
+ margin: 0;
9992
+ font-size: var(--pont-ref-typography-size-sm);
9993
+ color: var(--pont-sem-color-muted-fg);
9994
+ }
9995
+
9996
+ [data-pont-billing-portal-account] {
9997
+ display: flex;
9998
+ flex-wrap: wrap;
9999
+ align-items: center;
10000
+ gap: 0.5rem;
10001
+ }
10002
+
10003
+ [data-pont-billing-portal-section] {
10004
+ display: grid;
10005
+ gap: 1rem;
10006
+ padding: 1.25rem;
10007
+ border: 1px solid var(--pont-sem-color-border);
10008
+ border-radius: var(--pont-ref-radius-lg);
10009
+ min-inline-size: 0;
10010
+ }
10011
+
10012
+ [data-pont-billing-portal-section-header] {
10013
+ display: flex;
10014
+ flex-wrap: wrap;
10015
+ align-items: center;
10016
+ justify-content: space-between;
10017
+ gap: 0.75rem;
10018
+ }
10019
+
10020
+ [data-pont-billing-portal-section-title] {
10021
+ margin: 0;
10022
+ font-size: var(--pont-ref-typography-size-base);
10023
+ font-weight: var(--pont-ref-typography-weight-semibold);
10024
+ }
10025
+
10026
+ [data-pont-billing-portal-section-actions],
10027
+ [data-pont-billing-portal-row-actions],
10028
+ [data-pont-billing-portal-panel-actions] {
10029
+ display: flex;
10030
+ flex-wrap: wrap;
10031
+ align-items: center;
10032
+ gap: 0.5rem;
10033
+ }
10034
+
10035
+ [data-pont-billing-portal-panel-actions] {
10036
+ justify-content: flex-end;
10037
+ }
10038
+
10039
+ [data-pont-billing-portal-plan] {
10040
+ display: grid;
10041
+ gap: 0.75rem;
10042
+ }
10043
+
10044
+ [data-pont-billing-portal-plan-name] {
10045
+ display: flex;
10046
+ flex-wrap: wrap;
10047
+ align-items: center;
10048
+ gap: 0.5rem;
10049
+ margin: 0;
10050
+ font-size: var(--pont-ref-typography-size-lg);
10051
+ font-weight: var(--pont-ref-typography-weight-semibold);
10052
+ }
10053
+
10054
+ [data-pont-billing-portal-facts] {
10055
+ display: grid;
10056
+ grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
10057
+ gap: 0.75rem 1.5rem;
10058
+ margin: 0;
10059
+ font-size: var(--pont-ref-typography-size-sm);
10060
+ }
10061
+
10062
+ [data-pont-billing-portal-facts] dt {
10063
+ color: var(--pont-sem-color-muted-fg);
10064
+ }
10065
+
10066
+ [data-pont-billing-portal-facts] dd {
10067
+ margin: 0;
10068
+ }
10069
+
10070
+ [data-pont-billing-portal-panel] {
10071
+ display: grid;
10072
+ gap: 1rem;
10073
+ padding: 1rem;
10074
+ border-radius: var(--pont-ref-radius-md);
10075
+ background: var(--pont-sem-color-muted);
10076
+ }
10077
+
10078
+ [data-pont-billing-portal-panel] p {
10079
+ margin: 0;
10080
+ }
10081
+
10082
+ [data-pont-billing-portal-panel-title] {
10083
+ margin: 0;
10084
+ font-size: var(--pont-ref-typography-size-sm);
10085
+ font-weight: var(--pont-ref-typography-weight-semibold);
10086
+ }
10087
+
10088
+ [data-pont-billing-portal-legend] {
10089
+ font-size: var(--pont-ref-typography-size-sm);
10090
+ font-weight: var(--pont-ref-typography-weight-medium);
10091
+ }
10092
+
10093
+ [data-pont-billing-portal-options] {
10094
+ display: grid;
10095
+ gap: 0.5rem;
10096
+ }
10097
+
10098
+ [data-pont-billing-portal-frequencies] {
10099
+ display: flex;
10100
+ flex-wrap: wrap;
10101
+ align-items: center;
10102
+ gap: 1rem;
10103
+ }
10104
+
10105
+ [data-pont-billing-portal-option],
10106
+ [data-pont-billing-portal-frequency] {
10107
+ display: flex;
10108
+ align-items: center;
10109
+ gap: 0.5rem;
10110
+ }
10111
+
10112
+ [data-pont-billing-portal-option] label {
10113
+ display: flex;
10114
+ flex-wrap: wrap;
10115
+ gap: 0.5rem;
10116
+ cursor: pointer;
10117
+ }
10118
+
10119
+ [data-pont-billing-portal-option-name],
10120
+ [data-pont-billing-portal-method-name] {
10121
+ font-weight: var(--pont-ref-typography-weight-medium);
10122
+ }
10123
+
10124
+ /* Stripe's iframe goes in here, with no box of ours. */
10125
+ [data-pont-billing-portal-payment-element] {
10126
+ min-block-size: 3rem;
10127
+ }
10128
+
10129
+ [data-pont-billing-portal-methods] {
10130
+ display: grid;
10131
+ gap: 0.5rem;
10132
+ margin: 0;
10133
+ padding: 0;
10134
+ list-style: none;
10135
+ }
10136
+
10137
+ [data-pont-billing-portal-methods] > li {
10138
+ display: flex;
10139
+ flex-wrap: wrap;
10140
+ align-items: center;
10141
+ justify-content: space-between;
10142
+ gap: 0.5rem;
10143
+ }
10144
+
10145
+ [data-pont-billing-portal-methods] > li > [data-pont-billing-portal-panel] {
10146
+ flex: 1 1 100%;
10147
+ }
10148
+
10149
+ [data-pont-billing-portal-method] {
10150
+ display: flex;
10151
+ flex-wrap: wrap;
10152
+ align-items: center;
10153
+ gap: 0.5rem;
10154
+ }
10155
+
10156
+ [data-pont-billing-portal-confirming] {
10157
+ display: flex;
10158
+ align-items: center;
10159
+ gap: 0.5rem;
10160
+ font-size: var(--pont-ref-typography-size-sm);
10161
+ }
10162
+
10163
+ [data-pont-billing-portal-sr] {
10164
+ position: absolute;
10165
+ inline-size: 1px;
10166
+ block-size: 1px;
10167
+ overflow: hidden;
10168
+ clip-path: inset(50%);
10169
+ white-space: nowrap;
10170
+ }
10171
+
10172
+ [data-pont-billing-portal-problem] {
10173
+ display: flex;
10174
+ flex-direction: column;
10175
+ align-items: flex-start;
10176
+ gap: 1rem;
10177
+ }
10178
+
10179
+ [data-pont-billing-portal-loading] {
10180
+ display: flex;
10181
+ justify-content: center;
10182
+ padding-block: 2.5rem;
10183
+ }
10184
+
10185
+ [data-pont-billing-portal-loading] > :is(pont-prim-spinner, [data-pont-spinner]) {
10186
+ inline-size: 1.5rem;
10187
+ block-size: 1.5rem;
10188
+ }
10189
+
10190
+ [data-pont-billing-portal-footer] {
10191
+ display: flex;
10192
+ justify-content: flex-end;
10193
+ }
10194
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pontive/pontkit-core",
3
- "version": "1.43.0",
3
+ "version": "1.44.0",
4
4
  "license": "MIT",
5
5
  "description": "A collection of core components for Pontive",
6
6
  "module": "dist/index.mjs",