@rechargeapps/storefront-client 0.8.0 → 0.9.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/dist/index.d.ts CHANGED
@@ -563,8 +563,6 @@ declare function applyDiscount(session: Session, id: number | string, applyReque
563
563
  declare function removeDiscount(session: Session, id: number | string): Promise<Charge>;
564
564
  declare function skipCharge(session: Session, id: number | string): Promise<Charge>;
565
565
  declare function unskipCharge(session: Session, id: number | string): Promise<Charge>;
566
- /** The charge processing route can be used to process Charges that are in a queued or error status. */
567
- declare function processCharge(session: Session, id: number | string): Promise<Charge>;
568
566
 
569
567
  declare type Method = 'get' | 'post' | 'put' | 'delete';
570
568
  declare type Request = <T>(method: Method, url: string, options?: RequestOptions) => Promise<T>;
@@ -955,14 +953,14 @@ interface StorefrontOptions {
955
953
  environment: StorefrontEnvironment;
956
954
  }
957
955
 
958
- declare function getProduct(externalProductId: string | number): Promise<CDNProduct>;
959
- declare function getStoreSettings(): Promise<CDNStoreSettings>;
960
- declare function getWidgetSettings(): Promise<CDNWidgetSettings>;
961
- declare function getProductsAndSettings(): Promise<CDNProductsAndSettings>;
962
- declare function getProducts(): Promise<CDNProductKeyObject[]>;
963
- declare function getProductAndSettings(externalProductId: string | number): Promise<CDNProductAndSettings>;
964
- declare function getBundleSettings(externalProductId: string | number): Promise<CDNBundleSettings | null | undefined>;
965
- declare function resetCache(): Promise<void>;
956
+ declare function getCDNProduct(externalProductId: string | number): Promise<CDNProduct>;
957
+ declare function getCDNStoreSettings(): Promise<CDNStoreSettings>;
958
+ declare function getCDNWidgetSettings(): Promise<CDNWidgetSettings>;
959
+ declare function getCDNProductsAndSettings(): Promise<CDNProductsAndSettings>;
960
+ declare function getCDNProducts(): Promise<CDNProductKeyObject[]>;
961
+ declare function getCDNProductAndSettings(externalProductId: string | number): Promise<CDNProductAndSettings>;
962
+ declare function getCDNBundleSettings(externalProductId: string | number): Promise<CDNBundleSettings | null | undefined>;
963
+ declare function resetCDNCache(): Promise<void>;
966
964
 
967
965
  declare function getBundleId(bundle: Bundle): Promise<string>;
968
966
  declare function validateBundle(bundle: Bundle): Promise<boolean>;
@@ -1087,6 +1085,73 @@ declare function deleteOnetime(session: Session, id: string | number): Promise<v
1087
1085
  declare function getOrder(session: Session, id: string | number): Promise<Order>;
1088
1086
  declare function listOrders(session: Session, query?: OrderListParams): Promise<OrdersResponse>;
1089
1087
 
1088
+ interface ChannelSettings {
1089
+ api: {
1090
+ display: boolean;
1091
+ };
1092
+ checkout_page: {
1093
+ display: boolean;
1094
+ };
1095
+ customer_portal: {
1096
+ display: boolean;
1097
+ };
1098
+ merchant_portal: {
1099
+ display: boolean;
1100
+ };
1101
+ }
1102
+ interface SubscriptionPreferences {
1103
+ charge_interval_frequency: number;
1104
+ cutoff_day_of_month: null | number;
1105
+ cutoff_day_of_week: null | number;
1106
+ expire_after_specific_number_of_charges: null | number;
1107
+ interval_unit: 'day' | 'week' | 'month';
1108
+ order_day_of_month: number;
1109
+ order_day_of_week: null | number;
1110
+ order_interval_frequency: number;
1111
+ }
1112
+ declare type PlanType = 'subscription' | 'prepaid' | 'onetime';
1113
+ interface Plan {
1114
+ /** Unique numeric identifier for the Plan. */
1115
+ id: number;
1116
+ /** An object containing the availability of the plan through various supported channels. */
1117
+ channel_settings: ChannelSettings;
1118
+ /** The time the plan was created. */
1119
+ created_at: IsoDateString;
1120
+ /** If deleted, the time the plan was deleted. */
1121
+ deleted_at: IsoDateString;
1122
+ /** The discount amount applied to the product price when purchased through this Plan. All Plans for a product must have the same discount amount. */
1123
+ discount_amount: string;
1124
+ /** Used in combination with discount amount to determine the discount applied on a product price when purchased through this Plan. */
1125
+ discount_type: 'percentage';
1126
+ /** An object containing the product id as it appears in external platforms. */
1127
+ external_product_id: ExternalId;
1128
+ /** The number indicating the order which the plan will be in a list of related plans. */
1129
+ sort_order: number;
1130
+ /** An object containing the various subscription preferences associated with this plan. */
1131
+ subscription_preferences: SubscriptionPreferences;
1132
+ /** The title of the plan. All Plans for a product must have the same title. */
1133
+ title: string;
1134
+ /** The type of the plan. Products with a prepaid plan cannot have plans of other types. */
1135
+ type: PlanType;
1136
+ /** The time the plan was last updated. */
1137
+ updated_at: IsoDateString;
1138
+ }
1139
+ interface PlansResponse {
1140
+ next_cursor: null | string;
1141
+ previous_cursor: null | string;
1142
+ plans: Plan[];
1143
+ }
1144
+ declare type PlanSortBy = 'id-asc' | 'id-desc' | 'updated_at-asc' | 'updated_at-desc';
1145
+ interface PlanListParams extends ListParams<PlanSortBy> {
1146
+ external_product_id?: string;
1147
+ updated_at_max?: IsoDateString;
1148
+ updated_at_min?: IsoDateString;
1149
+ type?: PlanType;
1150
+ }
1151
+
1152
+ declare function getPlan(session: Session, id: string | number): Promise<Plan>;
1153
+ declare function listPlans(session: Session, query?: PlanListParams): Promise<PlansResponse>;
1154
+
1090
1155
  interface Subscription {
1091
1156
  /** Unique numeric identifier for the subscription. */
1092
1157
  id: number;
@@ -1284,4 +1349,4 @@ declare const api: {
1284
1349
  };
1285
1350
  declare function initRecharge(opt?: InitOptions): void;
1286
1351
 
1287
- export { Bundle, BundleSelection, BundleTranslations, CDNBaseWidgetSettings, CDNBundleLayoutSettings, CDNBundleSettings, CDNBundleStep, CDNBundleStepOption, CDNBundleVariant, CDNBundleVariantOptionSource, CDNBundleVariantSelectionDefault, CDNPrices, CDNProduct, CDNProductAndSettings, CDNProductKeyObject, CDNProductOption, CDNProductOptionValue, CDNProductRaw, CDNProductResource, CDNProductsAndSettings, CDNProductsAndSettingsResource, CDNSellingPlan, CDNSellingPlanAllocations, CDNSellingPlanGroup, CDNStoreSettings, CDNSubscriptionOption, CDNVariant, CDNVariantOptionValue, CDNWidgetSettings, CDNWidgetSettingsRaw, CDNWidgetSettingsResource, CRUDRequestOptions, FirstOption, GetRequestOptions, InitOptions, IntervalUnit, Method, PriceAdjustmentsType, Request, RequestHeaders, RequestOptions, RequestOptionsHeaders, StorefrontEnvironment, StorefrontOptions, StorefrontPurchaseOption, Translations, WidgetIconColor, WidgetTemplateType, activateMembership, activateSubscription, api, applyDiscount, cancelMembership, cancelSubscription, createAddress, createOnetime, createSubscription, deleteAddress, deleteOnetime, getAddress, getBundleId, getBundleSettings, getCharge, getCustomer, getDeliverySchedule, getMembership, getOnetime, getOrder, getProduct, getProductAndSettings, getProducts, getProductsAndSettings, getStoreSettings, getSubscription, getWidgetSettings, initRecharge, listAddresses, listCharges, listMemberships, listOnetimes, listOrders, listSubscriptions, loginShopifyApi, loginShopifyAppProxy, mergeAddresses, processCharge, removeDiscount, resetCache, skipCharge, skipFutureCharge, unskipCharge, updateAddress, updateCustomer, updateOnetime, updateSubscription, updateSubscriptionAddress, updateSubscriptionChargeDate, validateBundle };
1352
+ export { Bundle, BundleSelection, BundleTranslations, CDNBaseWidgetSettings, CDNBundleLayoutSettings, CDNBundleSettings, CDNBundleStep, CDNBundleStepOption, CDNBundleVariant, CDNBundleVariantOptionSource, CDNBundleVariantSelectionDefault, CDNPrices, CDNProduct, CDNProductAndSettings, CDNProductKeyObject, CDNProductOption, CDNProductOptionValue, CDNProductRaw, CDNProductResource, CDNProductsAndSettings, CDNProductsAndSettingsResource, CDNSellingPlan, CDNSellingPlanAllocations, CDNSellingPlanGroup, CDNStoreSettings, CDNSubscriptionOption, CDNVariant, CDNVariantOptionValue, CDNWidgetSettings, CDNWidgetSettingsRaw, CDNWidgetSettingsResource, CRUDRequestOptions, FirstOption, GetRequestOptions, InitOptions, IntervalUnit, Method, PriceAdjustmentsType, Request, RequestHeaders, RequestOptions, RequestOptionsHeaders, StorefrontEnvironment, StorefrontOptions, StorefrontPurchaseOption, Translations, WidgetIconColor, WidgetTemplateType, activateMembership, activateSubscription, api, applyDiscount, cancelMembership, cancelSubscription, createAddress, createOnetime, createSubscription, deleteAddress, deleteOnetime, getAddress, getBundleId, getCDNBundleSettings, getCDNProduct, getCDNProductAndSettings, getCDNProducts, getCDNProductsAndSettings, getCDNStoreSettings, getCDNWidgetSettings, getCharge, getCustomer, getDeliverySchedule, getMembership, getOnetime, getOrder, getPlan, getSubscription, initRecharge, listAddresses, listCharges, listMemberships, listOnetimes, listOrders, listPlans, listSubscriptions, loginShopifyApi, loginShopifyAppProxy, mergeAddresses, removeDiscount, resetCDNCache, skipCharge, skipFutureCharge, unskipCharge, updateAddress, updateCustomer, updateOnetime, updateSubscription, updateSubscriptionAddress, updateSubscriptionChargeDate, validateBundle };