recur-tw 0.21.2 → 0.21.3

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/dist/index.d.cts CHANGED
@@ -718,7 +718,7 @@ interface RecurContextValue {
718
718
  * ```tsx
719
719
  * const { redirectToCheckout } = useRecur();
720
720
  * await redirectToCheckout({
721
- * productId: 'prod_xxx',
721
+ * productId: 'cmfxq8n2a0001l8yz3k5p9t7d',
722
722
  * successUrl: `${window.location.origin}/success`,
723
723
  * cancelUrl: `${window.location.origin}/cancel`,
724
724
  * });
@@ -735,9 +735,9 @@ interface RecurContextValue {
735
735
  * ```tsx
736
736
  * const { createCheckoutSession } = useRecur();
737
737
  * const session = await createCheckoutSession({
738
- * productId: 'prod_xxx',
739
- * successUrl: '/success',
740
- * cancelUrl: '/cancel',
738
+ * productId: 'cmfxq8n2a0001l8yz3k5p9t7d',
739
+ * successUrl: `${window.location.origin}/success`,
740
+ * cancelUrl: `${window.location.origin}/cancel`,
741
741
  * });
742
742
  * window.open(session.url, '_blank');
743
743
  * ```
@@ -870,7 +870,7 @@ interface Entitlement {
870
870
  product: string;
871
871
  /**
872
872
  * Product ID
873
- * @example 'prod_abc123'
873
+ * @example 'cmfxq8n2a0001l8yz3k5p9t7d'
874
874
  */
875
875
  productId: string;
876
876
  /**
@@ -938,7 +938,7 @@ type CheckTarget = string | {
938
938
  interface CheckOptions {
939
939
  /**
940
940
  * Product slug or ID to check access for
941
- * @example 'pro-plan' or 'prod_abc123'
941
+ * @example 'pro-plan' (slug) or 'cmfxq8n2a0001l8yz3k5p9t7d' (CUID id)
942
942
  */
943
943
  product: string;
944
944
  }
@@ -1092,7 +1092,7 @@ interface UseCustomerResult {
1092
1092
  * Call this after checkout to update permissions
1093
1093
  *
1094
1094
  * @example
1095
- * await checkout({ productId: 'prod_xxx' });
1095
+ * await checkout({ productId: 'cmfxq8n2a0001l8yz3k5p9t7d' });
1096
1096
  * await refetch(); // Update entitlements
1097
1097
  */
1098
1098
  refetch: () => Promise<void>;
@@ -1124,6 +1124,7 @@ declare class RecurPaymentForm extends HTMLElement {
1124
1124
  private _couponCode;
1125
1125
  private _couponLoading;
1126
1126
  private _couponError;
1127
+ private _submitState;
1127
1128
  private _appliedCoupon;
1128
1129
  constructor();
1129
1130
  connectedCallback(): void;
@@ -1136,6 +1137,13 @@ declare class RecurPaymentForm extends HTMLElement {
1136
1137
  private render;
1137
1138
  private renderShadowDOM;
1138
1139
  private renderLightDOM;
1140
+ /**
1141
+ * Fill the stylesheet lit deliberately leaves empty.
1142
+ *
1143
+ * Safe precisely because the template interpolates nothing into that
1144
+ * element: there are no marker nodes inside it to eject.
1145
+ */
1146
+ private applyStyles;
1139
1147
  private getCustomStyles;
1140
1148
  private updateCustomStyles;
1141
1149
  private isTestMode;
@@ -1149,14 +1157,6 @@ declare class RecurPaymentForm extends HTMLElement {
1149
1157
  private handleCouponInputChange;
1150
1158
  private handleCouponKeydown;
1151
1159
  private updateApplyButtonState;
1152
- private updateCouponSectionDOM;
1153
- private getCouponTriggerHTML;
1154
- private getCouponInputHTML;
1155
- private getCouponAppliedHTML;
1156
- private bindCouponTriggerEvents;
1157
- private bindCouponInputEvents;
1158
- private bindCouponAppliedEvents;
1159
- private updateOrderSummaryDOM;
1160
1160
  private applyCoupon;
1161
1161
  private removeCoupon;
1162
1162
  /**
@@ -1186,11 +1186,17 @@ declare class RecurPaymentForm extends HTMLElement {
1186
1186
  */
1187
1187
  private isCardVerificationMode;
1188
1188
  private getSubmitLabel;
1189
- /** Sync the verification notice + submit label with the current amount. */
1190
- private updateVerificationUI;
1191
1189
  private renderCardFields;
1192
1190
  private hideCardSkeletons;
1193
1191
  private renderActions;
1192
+ /**
1193
+ * The submit button's content belongs to lit like everything else in the light
1194
+ * DOM: writing it by hand detaches the label lit renders into, and a later
1195
+ * full render (test-card banner, einvoice change) then either throws or keeps
1196
+ * updating a node nobody can see. The button's `disabled` and `loading` class
1197
+ * stay imperative — the template sets them statically, so lit never rewrites them.
1198
+ */
1199
+ private renderSubmitContent;
1194
1200
  initializePayment(sdkToken: string, environment: 'SANDBOX' | 'PRODUCTION'): Promise<UniPaymentInstance | null>;
1195
1201
  private setupFormSubmission;
1196
1202
  private setButtonLoading;
@@ -1734,7 +1740,7 @@ interface PromoCodeInputProps {
1734
1740
  * promo={promo}
1735
1741
  * unstyled
1736
1742
  * className="flex flex-col gap-1"
1737
- * inputClassName="border rounded px-3 py-2 uppercase"
1743
+ * inputClassName="border rounded px-3 py-2"
1738
1744
  * buttonClassName="bg-blue-500 text-white px-4 py-2 rounded"
1739
1745
  * messageClassName="text-sm"
1740
1746
  * />
package/dist/index.d.ts CHANGED
@@ -718,7 +718,7 @@ interface RecurContextValue {
718
718
  * ```tsx
719
719
  * const { redirectToCheckout } = useRecur();
720
720
  * await redirectToCheckout({
721
- * productId: 'prod_xxx',
721
+ * productId: 'cmfxq8n2a0001l8yz3k5p9t7d',
722
722
  * successUrl: `${window.location.origin}/success`,
723
723
  * cancelUrl: `${window.location.origin}/cancel`,
724
724
  * });
@@ -735,9 +735,9 @@ interface RecurContextValue {
735
735
  * ```tsx
736
736
  * const { createCheckoutSession } = useRecur();
737
737
  * const session = await createCheckoutSession({
738
- * productId: 'prod_xxx',
739
- * successUrl: '/success',
740
- * cancelUrl: '/cancel',
738
+ * productId: 'cmfxq8n2a0001l8yz3k5p9t7d',
739
+ * successUrl: `${window.location.origin}/success`,
740
+ * cancelUrl: `${window.location.origin}/cancel`,
741
741
  * });
742
742
  * window.open(session.url, '_blank');
743
743
  * ```
@@ -870,7 +870,7 @@ interface Entitlement {
870
870
  product: string;
871
871
  /**
872
872
  * Product ID
873
- * @example 'prod_abc123'
873
+ * @example 'cmfxq8n2a0001l8yz3k5p9t7d'
874
874
  */
875
875
  productId: string;
876
876
  /**
@@ -938,7 +938,7 @@ type CheckTarget = string | {
938
938
  interface CheckOptions {
939
939
  /**
940
940
  * Product slug or ID to check access for
941
- * @example 'pro-plan' or 'prod_abc123'
941
+ * @example 'pro-plan' (slug) or 'cmfxq8n2a0001l8yz3k5p9t7d' (CUID id)
942
942
  */
943
943
  product: string;
944
944
  }
@@ -1092,7 +1092,7 @@ interface UseCustomerResult {
1092
1092
  * Call this after checkout to update permissions
1093
1093
  *
1094
1094
  * @example
1095
- * await checkout({ productId: 'prod_xxx' });
1095
+ * await checkout({ productId: 'cmfxq8n2a0001l8yz3k5p9t7d' });
1096
1096
  * await refetch(); // Update entitlements
1097
1097
  */
1098
1098
  refetch: () => Promise<void>;
@@ -1124,6 +1124,7 @@ declare class RecurPaymentForm extends HTMLElement {
1124
1124
  private _couponCode;
1125
1125
  private _couponLoading;
1126
1126
  private _couponError;
1127
+ private _submitState;
1127
1128
  private _appliedCoupon;
1128
1129
  constructor();
1129
1130
  connectedCallback(): void;
@@ -1136,6 +1137,13 @@ declare class RecurPaymentForm extends HTMLElement {
1136
1137
  private render;
1137
1138
  private renderShadowDOM;
1138
1139
  private renderLightDOM;
1140
+ /**
1141
+ * Fill the stylesheet lit deliberately leaves empty.
1142
+ *
1143
+ * Safe precisely because the template interpolates nothing into that
1144
+ * element: there are no marker nodes inside it to eject.
1145
+ */
1146
+ private applyStyles;
1139
1147
  private getCustomStyles;
1140
1148
  private updateCustomStyles;
1141
1149
  private isTestMode;
@@ -1149,14 +1157,6 @@ declare class RecurPaymentForm extends HTMLElement {
1149
1157
  private handleCouponInputChange;
1150
1158
  private handleCouponKeydown;
1151
1159
  private updateApplyButtonState;
1152
- private updateCouponSectionDOM;
1153
- private getCouponTriggerHTML;
1154
- private getCouponInputHTML;
1155
- private getCouponAppliedHTML;
1156
- private bindCouponTriggerEvents;
1157
- private bindCouponInputEvents;
1158
- private bindCouponAppliedEvents;
1159
- private updateOrderSummaryDOM;
1160
1160
  private applyCoupon;
1161
1161
  private removeCoupon;
1162
1162
  /**
@@ -1186,11 +1186,17 @@ declare class RecurPaymentForm extends HTMLElement {
1186
1186
  */
1187
1187
  private isCardVerificationMode;
1188
1188
  private getSubmitLabel;
1189
- /** Sync the verification notice + submit label with the current amount. */
1190
- private updateVerificationUI;
1191
1189
  private renderCardFields;
1192
1190
  private hideCardSkeletons;
1193
1191
  private renderActions;
1192
+ /**
1193
+ * The submit button's content belongs to lit like everything else in the light
1194
+ * DOM: writing it by hand detaches the label lit renders into, and a later
1195
+ * full render (test-card banner, einvoice change) then either throws or keeps
1196
+ * updating a node nobody can see. The button's `disabled` and `loading` class
1197
+ * stay imperative — the template sets them statically, so lit never rewrites them.
1198
+ */
1199
+ private renderSubmitContent;
1194
1200
  initializePayment(sdkToken: string, environment: 'SANDBOX' | 'PRODUCTION'): Promise<UniPaymentInstance | null>;
1195
1201
  private setupFormSubmission;
1196
1202
  private setButtonLoading;
@@ -1734,7 +1740,7 @@ interface PromoCodeInputProps {
1734
1740
  * promo={promo}
1735
1741
  * unstyled
1736
1742
  * className="flex flex-col gap-1"
1737
- * inputClassName="border rounded px-3 py-2 uppercase"
1743
+ * inputClassName="border rounded px-3 py-2"
1738
1744
  * buttonClassName="bg-blue-500 text-white px-4 py-2 rounded"
1739
1745
  * messageClassName="text-sm"
1740
1746
  * />