@acmekit/js-sdk 2.13.1
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/admin/api-key.d.ts +164 -0
- package/dist/admin/api-key.d.ts.map +1 -0
- package/dist/admin/api-key.js +202 -0
- package/dist/admin/api-key.js.map +1 -0
- package/dist/admin/campaign.d.ts +164 -0
- package/dist/admin/campaign.d.ts.map +1 -0
- package/dist/admin/campaign.js +196 -0
- package/dist/admin/campaign.js.map +1 -0
- package/dist/admin/claim.d.ts +558 -0
- package/dist/admin/claim.d.ts.map +1 -0
- package/dist/admin/claim.js +693 -0
- package/dist/admin/claim.js.map +1 -0
- package/dist/admin/currency.d.ts +95 -0
- package/dist/admin/currency.d.ts.map +1 -0
- package/dist/admin/currency.js +104 -0
- package/dist/admin/currency.js.map +1 -0
- package/dist/admin/customer-group.d.ts +170 -0
- package/dist/admin/customer-group.d.ts.map +1 -0
- package/dist/admin/customer-group.js +206 -0
- package/dist/admin/customer-group.js.map +1 -0
- package/dist/admin/customer.d.ts +264 -0
- package/dist/admin/customer.d.ts.map +1 -0
- package/dist/admin/customer.js +323 -0
- package/dist/admin/customer.js.map +1 -0
- package/dist/admin/draft-order.d.ts +430 -0
- package/dist/admin/draft-order.d.ts.map +1 -0
- package/dist/admin/draft-order.js +547 -0
- package/dist/admin/draft-order.js.map +1 -0
- package/dist/admin/exchange.d.ts +487 -0
- package/dist/admin/exchange.d.ts.map +1 -0
- package/dist/admin/exchange.js +602 -0
- package/dist/admin/exchange.js.map +1 -0
- package/dist/admin/fulfillment-provider.d.ts +78 -0
- package/dist/admin/fulfillment-provider.d.ts.map +1 -0
- package/dist/admin/fulfillment-provider.js +88 -0
- package/dist/admin/fulfillment-provider.js.map +1 -0
- package/dist/admin/fulfillment-set.d.ts +141 -0
- package/dist/admin/fulfillment-set.d.ts.map +1 -0
- package/dist/admin/fulfillment-set.js +170 -0
- package/dist/admin/fulfillment-set.js.map +1 -0
- package/dist/admin/fulfillment.d.ts +91 -0
- package/dist/admin/fulfillment.d.ts.map +1 -0
- package/dist/admin/fulfillment.js +111 -0
- package/dist/admin/fulfillment.js.map +1 -0
- package/dist/admin/index.d.ts +247 -0
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/admin/index.js +108 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/admin/inventory-item.d.ts +320 -0
- package/dist/admin/inventory-item.d.ts.map +1 -0
- package/dist/admin/inventory-item.js +384 -0
- package/dist/admin/inventory-item.js.map +1 -0
- package/dist/admin/invite.d.ts +182 -0
- package/dist/admin/invite.d.ts.map +1 -0
- package/dist/admin/invite.js +211 -0
- package/dist/admin/invite.js.map +1 -0
- package/dist/admin/locale.d.ts +95 -0
- package/dist/admin/locale.d.ts.map +1 -0
- package/dist/admin/locale.js +104 -0
- package/dist/admin/locale.js.map +1 -0
- package/dist/admin/notification.d.ts +96 -0
- package/dist/admin/notification.d.ts.map +1 -0
- package/dist/admin/notification.js +107 -0
- package/dist/admin/notification.js.map +1 -0
- package/dist/admin/order-edit.d.ts +189 -0
- package/dist/admin/order-edit.d.ts.map +1 -0
- package/dist/admin/order-edit.js +240 -0
- package/dist/admin/order-edit.js.map +1 -0
- package/dist/admin/order.d.ts +452 -0
- package/dist/admin/order.d.ts.map +1 -0
- package/dist/admin/order.js +560 -0
- package/dist/admin/order.js.map +1 -0
- package/dist/admin/payment-collection.d.ts +72 -0
- package/dist/admin/payment-collection.d.ts.map +1 -0
- package/dist/admin/payment-collection.js +90 -0
- package/dist/admin/payment-collection.js.map +1 -0
- package/dist/admin/payment.d.ts +180 -0
- package/dist/admin/payment.d.ts.map +1 -0
- package/dist/admin/payment.js +208 -0
- package/dist/admin/payment.js.map +1 -0
- package/dist/admin/plugin.d.ts +27 -0
- package/dist/admin/plugin.d.ts.map +1 -0
- package/dist/admin/plugin.js +31 -0
- package/dist/admin/plugin.js.map +1 -0
- package/dist/admin/price-list.d.ts +234 -0
- package/dist/admin/price-list.d.ts.map +1 -0
- package/dist/admin/price-list.js +284 -0
- package/dist/admin/price-list.js.map +1 -0
- package/dist/admin/price-preference.d.ts +152 -0
- package/dist/admin/price-preference.d.ts.map +1 -0
- package/dist/admin/price-preference.js +182 -0
- package/dist/admin/price-preference.js.map +1 -0
- package/dist/admin/product-category.d.ts +170 -0
- package/dist/admin/product-category.d.ts.map +1 -0
- package/dist/admin/product-category.js +205 -0
- package/dist/admin/product-category.js.map +1 -0
- package/dist/admin/product-collection.d.ts +169 -0
- package/dist/admin/product-collection.d.ts.map +1 -0
- package/dist/admin/product-collection.js +203 -0
- package/dist/admin/product-collection.js.map +1 -0
- package/dist/admin/product-tag.d.ts +149 -0
- package/dist/admin/product-tag.d.ts.map +1 -0
- package/dist/admin/product-tag.js +177 -0
- package/dist/admin/product-tag.js.map +1 -0
- package/dist/admin/product-type.d.ts +150 -0
- package/dist/admin/product-type.d.ts.map +1 -0
- package/dist/admin/product-type.js +178 -0
- package/dist/admin/product-type.js.map +1 -0
- package/dist/admin/product-variant.d.ts +62 -0
- package/dist/admin/product-variant.d.ts.map +1 -0
- package/dist/admin/product-variant.js +66 -0
- package/dist/admin/product-variant.js.map +1 -0
- package/dist/admin/product.d.ts +740 -0
- package/dist/admin/product.d.ts.map +1 -0
- package/dist/admin/product.js +948 -0
- package/dist/admin/product.js.map +1 -0
- package/dist/admin/promotion.d.ts +310 -0
- package/dist/admin/promotion.d.ts.map +1 -0
- package/dist/admin/promotion.js +374 -0
- package/dist/admin/promotion.js.map +1 -0
- package/dist/admin/refund-reasons.d.ts +163 -0
- package/dist/admin/refund-reasons.d.ts.map +1 -0
- package/dist/admin/refund-reasons.js +192 -0
- package/dist/admin/refund-reasons.js.map +1 -0
- package/dist/admin/region.d.ts +152 -0
- package/dist/admin/region.d.ts.map +1 -0
- package/dist/admin/region.js +180 -0
- package/dist/admin/region.js.map +1 -0
- package/dist/admin/reservation.d.ts +154 -0
- package/dist/admin/reservation.d.ts.map +1 -0
- package/dist/admin/reservation.js +182 -0
- package/dist/admin/reservation.js.map +1 -0
- package/dist/admin/return-reason.d.ts +154 -0
- package/dist/admin/return-reason.d.ts.map +1 -0
- package/dist/admin/return-reason.js +183 -0
- package/dist/admin/return-reason.js.map +1 -0
- package/dist/admin/return.d.ts +558 -0
- package/dist/admin/return.d.ts.map +1 -0
- package/dist/admin/return.js +700 -0
- package/dist/admin/return.js.map +1 -0
- package/dist/admin/sales-channel.d.ts +196 -0
- package/dist/admin/sales-channel.d.ts.map +1 -0
- package/dist/admin/sales-channel.js +238 -0
- package/dist/admin/sales-channel.js.map +1 -0
- package/dist/admin/shipping-option-type.d.ts +152 -0
- package/dist/admin/shipping-option-type.d.ts.map +1 -0
- package/dist/admin/shipping-option-type.js +180 -0
- package/dist/admin/shipping-option-type.js.map +1 -0
- package/dist/admin/shipping-option.d.ts +171 -0
- package/dist/admin/shipping-option.d.ts.map +1 -0
- package/dist/admin/shipping-option.js +207 -0
- package/dist/admin/shipping-option.js.map +1 -0
- package/dist/admin/shipping-profile.d.ts +151 -0
- package/dist/admin/shipping-profile.d.ts.map +1 -0
- package/dist/admin/shipping-profile.js +181 -0
- package/dist/admin/shipping-profile.js.map +1 -0
- package/dist/admin/stock-location.d.ts +212 -0
- package/dist/admin/stock-location.d.ts.map +1 -0
- package/dist/admin/stock-location.js +260 -0
- package/dist/admin/stock-location.js.map +1 -0
- package/dist/admin/store.d.ts +116 -0
- package/dist/admin/store.d.ts.map +1 -0
- package/dist/admin/store.js +134 -0
- package/dist/admin/store.js.map +1 -0
- package/dist/admin/tax-provider.d.ts +64 -0
- package/dist/admin/tax-provider.d.ts.map +1 -0
- package/dist/admin/tax-provider.js +70 -0
- package/dist/admin/tax-provider.js.map +1 -0
- package/dist/admin/tax-rate.d.ts +155 -0
- package/dist/admin/tax-rate.d.ts.map +1 -0
- package/dist/admin/tax-rate.js +186 -0
- package/dist/admin/tax-rate.js.map +1 -0
- package/dist/admin/tax-region.d.ts +165 -0
- package/dist/admin/tax-region.d.ts.map +1 -0
- package/dist/admin/tax-region.js +196 -0
- package/dist/admin/tax-region.js.map +1 -0
- package/dist/admin/translation.d.ts +253 -0
- package/dist/admin/translation.d.ts.map +1 -0
- package/dist/admin/translation.js +284 -0
- package/dist/admin/translation.js.map +1 -0
- package/dist/admin/upload.d.ts +97 -0
- package/dist/admin/upload.d.ts.map +1 -0
- package/dist/admin/upload.js +139 -0
- package/dist/admin/upload.js.map +1 -0
- package/dist/admin/user.d.ts +166 -0
- package/dist/admin/user.d.ts.map +1 -0
- package/dist/admin/user.js +192 -0
- package/dist/admin/user.js.map +1 -0
- package/dist/admin/views.d.ts +54 -0
- package/dist/admin/views.d.ts.map +1 -0
- package/dist/admin/views.js +96 -0
- package/dist/admin/views.js.map +1 -0
- package/dist/admin/workflow-execution.d.ts +78 -0
- package/dist/admin/workflow-execution.d.ts.map +1 -0
- package/dist/admin/workflow-execution.js +86 -0
- package/dist/admin/workflow-execution.js.map +1 -0
- package/dist/auth/index.d.ts +264 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +318 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/client.d.ts +65 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +315 -0
- package/dist/client.js.map +1 -0
- package/dist/esm/admin/api-key.d.ts +164 -0
- package/dist/esm/admin/api-key.d.ts.map +1 -0
- package/dist/esm/admin/api-key.js +221 -0
- package/dist/esm/admin/api-key.js.map +1 -0
- package/dist/esm/admin/campaign.d.ts +164 -0
- package/dist/esm/admin/campaign.d.ts.map +1 -0
- package/dist/esm/admin/campaign.js +213 -0
- package/dist/esm/admin/campaign.js.map +1 -0
- package/dist/esm/admin/claim.d.ts +558 -0
- package/dist/esm/admin/claim.d.ts.map +1 -0
- package/dist/esm/admin/claim.js +740 -0
- package/dist/esm/admin/claim.js.map +1 -0
- package/dist/esm/admin/currency.d.ts +95 -0
- package/dist/esm/admin/currency.d.ts.map +1 -0
- package/dist/esm/admin/currency.js +113 -0
- package/dist/esm/admin/currency.js.map +1 -0
- package/dist/esm/admin/customer-group.d.ts +170 -0
- package/dist/esm/admin/customer-group.d.ts.map +1 -0
- package/dist/esm/admin/customer-group.js +223 -0
- package/dist/esm/admin/customer-group.js.map +1 -0
- package/dist/esm/admin/customer.d.ts +264 -0
- package/dist/esm/admin/customer.d.ts.map +1 -0
- package/dist/esm/admin/customer.js +350 -0
- package/dist/esm/admin/customer.js.map +1 -0
- package/dist/esm/admin/draft-order.d.ts +430 -0
- package/dist/esm/admin/draft-order.d.ts.map +1 -0
- package/dist/esm/admin/draft-order.js +594 -0
- package/dist/esm/admin/draft-order.js.map +1 -0
- package/dist/esm/admin/exchange.d.ts +487 -0
- package/dist/esm/admin/exchange.d.ts.map +1 -0
- package/dist/esm/admin/exchange.js +643 -0
- package/dist/esm/admin/exchange.js.map +1 -0
- package/dist/esm/admin/fulfillment-provider.d.ts +78 -0
- package/dist/esm/admin/fulfillment-provider.d.ts.map +1 -0
- package/dist/esm/admin/fulfillment-provider.js +97 -0
- package/dist/esm/admin/fulfillment-provider.js.map +1 -0
- package/dist/esm/admin/fulfillment-set.d.ts +141 -0
- package/dist/esm/admin/fulfillment-set.d.ts.map +1 -0
- package/dist/esm/admin/fulfillment-set.js +185 -0
- package/dist/esm/admin/fulfillment-set.js.map +1 -0
- package/dist/esm/admin/fulfillment.d.ts +91 -0
- package/dist/esm/admin/fulfillment.d.ts.map +1 -0
- package/dist/esm/admin/fulfillment.js +122 -0
- package/dist/esm/admin/fulfillment.js.map +1 -0
- package/dist/esm/admin/index.d.ts +247 -0
- package/dist/esm/admin/index.d.ts.map +1 -0
- package/dist/esm/admin/index.js +101 -0
- package/dist/esm/admin/index.js.map +1 -0
- package/dist/esm/admin/inventory-item.d.ts +320 -0
- package/dist/esm/admin/inventory-item.d.ts.map +1 -0
- package/dist/esm/admin/inventory-item.js +411 -0
- package/dist/esm/admin/inventory-item.js.map +1 -0
- package/dist/esm/admin/invite.d.ts +182 -0
- package/dist/esm/admin/invite.d.ts.map +1 -0
- package/dist/esm/admin/invite.js +239 -0
- package/dist/esm/admin/invite.js.map +1 -0
- package/dist/esm/admin/locale.d.ts +95 -0
- package/dist/esm/admin/locale.d.ts.map +1 -0
- package/dist/esm/admin/locale.js +113 -0
- package/dist/esm/admin/locale.js.map +1 -0
- package/dist/esm/admin/notification.d.ts +96 -0
- package/dist/esm/admin/notification.d.ts.map +1 -0
- package/dist/esm/admin/notification.js +116 -0
- package/dist/esm/admin/notification.js.map +1 -0
- package/dist/esm/admin/order-edit.d.ts +189 -0
- package/dist/esm/admin/order-edit.d.ts.map +1 -0
- package/dist/esm/admin/order-edit.js +261 -0
- package/dist/esm/admin/order-edit.js.map +1 -0
- package/dist/esm/admin/order.d.ts +452 -0
- package/dist/esm/admin/order.d.ts.map +1 -0
- package/dist/esm/admin/order.js +603 -0
- package/dist/esm/admin/order.js.map +1 -0
- package/dist/esm/admin/payment-collection.d.ts +72 -0
- package/dist/esm/admin/payment-collection.d.ts.map +1 -0
- package/dist/esm/admin/payment-collection.js +101 -0
- package/dist/esm/admin/payment-collection.js.map +1 -0
- package/dist/esm/admin/payment.d.ts +180 -0
- package/dist/esm/admin/payment.d.ts.map +1 -0
- package/dist/esm/admin/payment.js +223 -0
- package/dist/esm/admin/payment.js.map +1 -0
- package/dist/esm/admin/plugin.d.ts +27 -0
- package/dist/esm/admin/plugin.d.ts.map +1 -0
- package/dist/esm/admin/plugin.js +38 -0
- package/dist/esm/admin/plugin.js.map +1 -0
- package/dist/esm/admin/price-list.d.ts +234 -0
- package/dist/esm/admin/price-list.d.ts.map +1 -0
- package/dist/esm/admin/price-list.js +305 -0
- package/dist/esm/admin/price-list.js.map +1 -0
- package/dist/esm/admin/price-preference.d.ts +152 -0
- package/dist/esm/admin/price-preference.d.ts.map +1 -0
- package/dist/esm/admin/price-preference.js +197 -0
- package/dist/esm/admin/price-preference.js.map +1 -0
- package/dist/esm/admin/product-category.d.ts +170 -0
- package/dist/esm/admin/product-category.d.ts.map +1 -0
- package/dist/esm/admin/product-category.js +222 -0
- package/dist/esm/admin/product-category.js.map +1 -0
- package/dist/esm/admin/product-collection.d.ts +169 -0
- package/dist/esm/admin/product-collection.d.ts.map +1 -0
- package/dist/esm/admin/product-collection.js +220 -0
- package/dist/esm/admin/product-collection.js.map +1 -0
- package/dist/esm/admin/product-tag.d.ts +149 -0
- package/dist/esm/admin/product-tag.d.ts.map +1 -0
- package/dist/esm/admin/product-tag.js +192 -0
- package/dist/esm/admin/product-tag.js.map +1 -0
- package/dist/esm/admin/product-type.d.ts +150 -0
- package/dist/esm/admin/product-type.d.ts.map +1 -0
- package/dist/esm/admin/product-type.js +193 -0
- package/dist/esm/admin/product-type.js.map +1 -0
- package/dist/esm/admin/product-variant.d.ts +62 -0
- package/dist/esm/admin/product-variant.d.ts.map +1 -0
- package/dist/esm/admin/product-variant.js +73 -0
- package/dist/esm/admin/product-variant.js.map +1 -0
- package/dist/esm/admin/product.d.ts +740 -0
- package/dist/esm/admin/product.d.ts.map +1 -0
- package/dist/esm/admin/product.js +995 -0
- package/dist/esm/admin/product.js.map +1 -0
- package/dist/esm/admin/promotion.d.ts +310 -0
- package/dist/esm/admin/promotion.d.ts.map +1 -0
- package/dist/esm/admin/promotion.js +401 -0
- package/dist/esm/admin/promotion.js.map +1 -0
- package/dist/esm/admin/refund-reasons.d.ts +163 -0
- package/dist/esm/admin/refund-reasons.d.ts.map +1 -0
- package/dist/esm/admin/refund-reasons.js +207 -0
- package/dist/esm/admin/refund-reasons.js.map +1 -0
- package/dist/esm/admin/region.d.ts +152 -0
- package/dist/esm/admin/region.d.ts.map +1 -0
- package/dist/esm/admin/region.js +195 -0
- package/dist/esm/admin/region.js.map +1 -0
- package/dist/esm/admin/reservation.d.ts +154 -0
- package/dist/esm/admin/reservation.d.ts.map +1 -0
- package/dist/esm/admin/reservation.js +199 -0
- package/dist/esm/admin/reservation.js.map +1 -0
- package/dist/esm/admin/return-reason.d.ts +154 -0
- package/dist/esm/admin/return-reason.d.ts.map +1 -0
- package/dist/esm/admin/return-reason.js +198 -0
- package/dist/esm/admin/return-reason.js.map +1 -0
- package/dist/esm/admin/return.d.ts +558 -0
- package/dist/esm/admin/return.d.ts.map +1 -0
- package/dist/esm/admin/return.js +749 -0
- package/dist/esm/admin/return.js.map +1 -0
- package/dist/esm/admin/sales-channel.d.ts +196 -0
- package/dist/esm/admin/sales-channel.d.ts.map +1 -0
- package/dist/esm/admin/sales-channel.js +257 -0
- package/dist/esm/admin/sales-channel.js.map +1 -0
- package/dist/esm/admin/shipping-option-type.d.ts +152 -0
- package/dist/esm/admin/shipping-option-type.d.ts.map +1 -0
- package/dist/esm/admin/shipping-option-type.js +195 -0
- package/dist/esm/admin/shipping-option-type.js.map +1 -0
- package/dist/esm/admin/shipping-option.d.ts +171 -0
- package/dist/esm/admin/shipping-option.d.ts.map +1 -0
- package/dist/esm/admin/shipping-option.js +224 -0
- package/dist/esm/admin/shipping-option.js.map +1 -0
- package/dist/esm/admin/shipping-profile.d.ts +151 -0
- package/dist/esm/admin/shipping-profile.d.ts.map +1 -0
- package/dist/esm/admin/shipping-profile.js +196 -0
- package/dist/esm/admin/shipping-profile.js.map +1 -0
- package/dist/esm/admin/stock-location.d.ts +212 -0
- package/dist/esm/admin/stock-location.d.ts.map +1 -0
- package/dist/esm/admin/stock-location.js +281 -0
- package/dist/esm/admin/stock-location.js.map +1 -0
- package/dist/esm/admin/store.d.ts +116 -0
- package/dist/esm/admin/store.d.ts.map +1 -0
- package/dist/esm/admin/store.js +145 -0
- package/dist/esm/admin/store.js.map +1 -0
- package/dist/esm/admin/tax-provider.d.ts +64 -0
- package/dist/esm/admin/tax-provider.d.ts.map +1 -0
- package/dist/esm/admin/tax-provider.js +77 -0
- package/dist/esm/admin/tax-provider.js.map +1 -0
- package/dist/esm/admin/tax-rate.d.ts +155 -0
- package/dist/esm/admin/tax-rate.d.ts.map +1 -0
- package/dist/esm/admin/tax-rate.js +201 -0
- package/dist/esm/admin/tax-rate.js.map +1 -0
- package/dist/esm/admin/tax-region.d.ts +165 -0
- package/dist/esm/admin/tax-region.d.ts.map +1 -0
- package/dist/esm/admin/tax-region.js +211 -0
- package/dist/esm/admin/tax-region.js.map +1 -0
- package/dist/esm/admin/translation.d.ts +253 -0
- package/dist/esm/admin/translation.d.ts.map +1 -0
- package/dist/esm/admin/translation.js +301 -0
- package/dist/esm/admin/translation.js.map +1 -0
- package/dist/esm/admin/upload.d.ts +97 -0
- package/dist/esm/admin/upload.d.ts.map +1 -0
- package/dist/esm/admin/upload.js +150 -0
- package/dist/esm/admin/upload.js.map +1 -0
- package/dist/esm/admin/user.d.ts +166 -0
- package/dist/esm/admin/user.d.ts.map +1 -0
- package/dist/esm/admin/user.js +207 -0
- package/dist/esm/admin/user.js.map +1 -0
- package/dist/esm/admin/views.d.ts +54 -0
- package/dist/esm/admin/views.d.ts.map +1 -0
- package/dist/esm/admin/views.js +117 -0
- package/dist/esm/admin/views.js.map +1 -0
- package/dist/esm/admin/workflow-execution.d.ts +78 -0
- package/dist/esm/admin/workflow-execution.d.ts.map +1 -0
- package/dist/esm/admin/workflow-execution.js +95 -0
- package/dist/esm/admin/workflow-execution.js.map +1 -0
- package/dist/esm/auth/index.d.ts +264 -0
- package/dist/esm/auth/index.d.ts.map +1 -0
- package/dist/esm/auth/index.js +325 -0
- package/dist/esm/auth/index.js.map +1 -0
- package/dist/esm/client.d.ts +65 -0
- package/dist/esm/client.d.ts.map +1 -0
- package/dist/esm/client.js +317 -0
- package/dist/esm/client.js.map +1 -0
- package/dist/esm/index.d.ts +21 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +24 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/store/index.d.ts +1200 -0
- package/dist/esm/store/index.d.ts.map +1 -0
- package/dist/esm/store/index.js +1425 -0
- package/dist/esm/store/index.js.map +1 -0
- package/dist/esm/types.d.ts +60 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -0
- package/dist/store/index.d.ts +1200 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +1419 -0
- package/dist/store/index.js.map +1 -0
- package/dist/types.d.ts +60 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
export class Auth {
|
|
11
|
+
constructor(client, config) {
|
|
12
|
+
/**
|
|
13
|
+
* This method is used to retrieve a registration JWT token for a user, customer, or custom actor type. It sends a request to the
|
|
14
|
+
* [Retrieve Registration Token API route](https://docs.acmekit.com/api/store#auth_postactor_typeauth_provider_register).
|
|
15
|
+
*
|
|
16
|
+
* Then, it stores the returned token and passes it in the header of subsequent requests. So, you can call the
|
|
17
|
+
* [store.customer.create](https://docs.acmekit.com/resources/references/js-sdk/store/customer#create) method,
|
|
18
|
+
* for example, after calling this method.
|
|
19
|
+
*
|
|
20
|
+
* Learn more in the [JS SDK Authentication](https://docs.acmekit.com/resources/js-sdk/auth/overview) guide.
|
|
21
|
+
*
|
|
22
|
+
* @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
|
|
23
|
+
* @param method - The authentication provider to use. For example, `emailpass` or `google`.
|
|
24
|
+
* @param payload - The data to pass in the request's body for authentication. When using the `emailpass` provider,
|
|
25
|
+
* you pass the email and password.
|
|
26
|
+
* @returns The JWT token used for registration later.
|
|
27
|
+
*
|
|
28
|
+
* @tags auth
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* await sdk.auth.register(
|
|
32
|
+
* "customer",
|
|
33
|
+
* "emailpass",
|
|
34
|
+
* {
|
|
35
|
+
* email: "customer@gmail.com",
|
|
36
|
+
* password: "supersecret"
|
|
37
|
+
* }
|
|
38
|
+
* )
|
|
39
|
+
*
|
|
40
|
+
* // all subsequent requests will use the token in the header
|
|
41
|
+
* const { customer } = await sdk.store.customer.create({
|
|
42
|
+
* email: "customer@gmail.com",
|
|
43
|
+
* password: "supersecret"
|
|
44
|
+
* })
|
|
45
|
+
*/
|
|
46
|
+
this.register = (actor, method, payload) => __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
const { token } = yield this.client.fetch(`/auth/${actor}/${method}/register`, {
|
|
48
|
+
method: "POST",
|
|
49
|
+
body: payload,
|
|
50
|
+
});
|
|
51
|
+
this.client.setToken(token);
|
|
52
|
+
return token;
|
|
53
|
+
});
|
|
54
|
+
/**
|
|
55
|
+
* This method retrieves the JWT authenticated token for an admin user, customer, or custom
|
|
56
|
+
* actor type. It sends a request to the [Authenticate API Route](https://docs.acmekit.com/api/admin#auth_postactor_typeauth_provider).
|
|
57
|
+
*
|
|
58
|
+
* ### Third-Party Authentication
|
|
59
|
+
*
|
|
60
|
+
* If the API route returns a `location` property, it means that the authentication requires additional steps,
|
|
61
|
+
* typically in a third-party service. The `location` property is returned so that you
|
|
62
|
+
* can redirect the user to the appropriate page.
|
|
63
|
+
*
|
|
64
|
+
* :::note
|
|
65
|
+
*
|
|
66
|
+
* For an example of implementing third-party authentication, refer to the
|
|
67
|
+
* [Third-Party Login in Storefront](https://docs.acmekit.com/resources/storefront-development/customers/third-party-login) guide.
|
|
68
|
+
*
|
|
69
|
+
* :::
|
|
70
|
+
*
|
|
71
|
+
* ### Session Authentication
|
|
72
|
+
*
|
|
73
|
+
* If the `auth.type` of the SDK is set to `session`, this method will also send a request to the
|
|
74
|
+
* [Set Authentication Session API route](https://docs.acmekit.com/api/admin#auth_postsession).
|
|
75
|
+
*
|
|
76
|
+
* Learn more in the [JS SDK Authentication](https://docs.acmekit.com/resources/js-sdk/auth/overview) guide.
|
|
77
|
+
*
|
|
78
|
+
* ### Automatic Authentication
|
|
79
|
+
*
|
|
80
|
+
* If the authentication was successful, subsequent requests using the SDK will automatically have the necessary authentication headers / session
|
|
81
|
+
* set, based on your JS SDK authentication configurations.
|
|
82
|
+
*
|
|
83
|
+
* Learn more in the [JS SDK Authentication](https://docs.acmekit.com/resources/js-sdk/auth/overview) guide.
|
|
84
|
+
*
|
|
85
|
+
* @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
|
|
86
|
+
* @param method - The authentication provider to use. For example, `emailpass` or `google`.
|
|
87
|
+
* @param payload - The data to pass in the request's body for authentication. When using the `emailpass` provider,
|
|
88
|
+
* you pass the email and password.
|
|
89
|
+
* @returns The authentication JWT token
|
|
90
|
+
*
|
|
91
|
+
* @tags auth
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* const result = await sdk.auth.login(
|
|
95
|
+
* "customer",
|
|
96
|
+
* "emailpass",
|
|
97
|
+
* {
|
|
98
|
+
* email: "customer@gmail.com",
|
|
99
|
+
* password: "supersecret"
|
|
100
|
+
* }
|
|
101
|
+
* )
|
|
102
|
+
*
|
|
103
|
+
* if (typeof result !== "string") {
|
|
104
|
+
* alert("Authentication requires additional steps")
|
|
105
|
+
* // replace with the redirect logic of your application
|
|
106
|
+
* window.location.href = result.location
|
|
107
|
+
* return
|
|
108
|
+
* }
|
|
109
|
+
*
|
|
110
|
+
* // customer is now authenticated
|
|
111
|
+
* // all subsequent requests will use the token in the header
|
|
112
|
+
* const { customer } = await sdk.store.customer.retrieve()
|
|
113
|
+
*/
|
|
114
|
+
this.login = (actor, method, payload) => __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
// There will either be token or location returned from the backend.
|
|
116
|
+
const { token, location } = yield this.client.fetch(`/auth/${actor}/${method}`, {
|
|
117
|
+
method: "POST",
|
|
118
|
+
body: payload,
|
|
119
|
+
});
|
|
120
|
+
// In the case of an oauth login, we return the redirect location to the caller.
|
|
121
|
+
// They can decide if they do an immediate redirect or put it in an <a> tag.
|
|
122
|
+
if (location) {
|
|
123
|
+
return { location };
|
|
124
|
+
}
|
|
125
|
+
yield this.setToken_(token);
|
|
126
|
+
return token;
|
|
127
|
+
});
|
|
128
|
+
/**
|
|
129
|
+
* This method is used to validate an Oauth callback from a third-party service, such as Google, for an admin user, customer, or custom actor types.
|
|
130
|
+
* It sends a request to the [Validate Authentication Callback](https://docs.acmekit.com/api/admin#auth_postactor_typeauth_providercallback).
|
|
131
|
+
*
|
|
132
|
+
* The method stores the returned token and passes it in the header of subsequent requests. So, you can call the
|
|
133
|
+
* [store.customer.create](https://docs.acmekit.com/resources/references/js-sdk/store/customer#create) or {@link refresh} methods,
|
|
134
|
+
* for example, after calling this method.
|
|
135
|
+
*
|
|
136
|
+
* Learn more in the [JS SDK Authentication](https://docs.acmekit.com/resources/js-sdk/auth/overview) guide.
|
|
137
|
+
*
|
|
138
|
+
* @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
|
|
139
|
+
* @param method - The authentication provider to use. For example, `google`.
|
|
140
|
+
* @param query - The query parameters from the Oauth callback, which should be passed to the API route. This includes query parameters like
|
|
141
|
+
* `code` and `state`.
|
|
142
|
+
* @returns The authentication JWT token
|
|
143
|
+
*
|
|
144
|
+
* @tags auth
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* await sdk.auth.callback(
|
|
148
|
+
* "customer",
|
|
149
|
+
* "google",
|
|
150
|
+
* {
|
|
151
|
+
* code: "123",
|
|
152
|
+
* state: "456"
|
|
153
|
+
* }
|
|
154
|
+
* )
|
|
155
|
+
*
|
|
156
|
+
* // all subsequent requests will use the token in the header
|
|
157
|
+
* const { customer } = await sdk.store.customer.create({
|
|
158
|
+
* email: "customer@gmail.com",
|
|
159
|
+
* password: "supersecret"
|
|
160
|
+
* })
|
|
161
|
+
*
|
|
162
|
+
* @privateRemarks
|
|
163
|
+
* The callback expects all query parameters from the Oauth callback to be passed to
|
|
164
|
+
* the backend, and the provider is in charge of parsing and validating them
|
|
165
|
+
*/
|
|
166
|
+
this.callback = (actor, method, query) => __awaiter(this, void 0, void 0, function* () {
|
|
167
|
+
const { token } = yield this.client.fetch(`/auth/${actor}/${method}/callback`, {
|
|
168
|
+
method: "GET",
|
|
169
|
+
query,
|
|
170
|
+
});
|
|
171
|
+
yield this.setToken_(token);
|
|
172
|
+
return token;
|
|
173
|
+
});
|
|
174
|
+
/**
|
|
175
|
+
* This method refreshes a JWT authentication token, which is useful after validating the Oauth callback
|
|
176
|
+
* with {@link callback}. It sends a request to the [Refresh Authentication Token API route](https://docs.acmekit.com/api/admin#auth_postadminauthtokenrefresh).
|
|
177
|
+
*
|
|
178
|
+
* The method stores the returned token and passes it in the header of subsequent requests. So, you can call other
|
|
179
|
+
* methods that require authentication after calling this method.
|
|
180
|
+
*
|
|
181
|
+
* Learn more in the [JS SDK Authentication](https://docs.acmekit.com/resources/js-sdk/auth/overview) guide.
|
|
182
|
+
*
|
|
183
|
+
* For an example of implementing third-party authentication, refer to the
|
|
184
|
+
* [Third-Party Login in Storefront](https://docs.acmekit.com/resources/storefront-development/customers/third-party-login) guide.
|
|
185
|
+
*
|
|
186
|
+
* @param headers - Headers to pass in the request
|
|
187
|
+
*
|
|
188
|
+
* @returns The refreshed JWT authentication token.
|
|
189
|
+
*
|
|
190
|
+
* @tags auth
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* const token = await sdk.auth.refresh()
|
|
194
|
+
*
|
|
195
|
+
* // all subsequent requests will use the token in the header
|
|
196
|
+
* const { customer } = await sdk.store.customer.retrieve()
|
|
197
|
+
*/
|
|
198
|
+
this.refresh = (headers) => __awaiter(this, void 0, void 0, function* () {
|
|
199
|
+
const { token } = yield this.client.fetch("/auth/token/refresh", {
|
|
200
|
+
method: "POST",
|
|
201
|
+
headers,
|
|
202
|
+
});
|
|
203
|
+
// Putting the token in session after refreshing is only useful when the new token has updated info (eg. actor_id).
|
|
204
|
+
// Ideally we don't use the full JWT in session as key, but just store a pseudorandom key that keeps the rest of the auth context as value.
|
|
205
|
+
yield this.setToken_(token);
|
|
206
|
+
return token;
|
|
207
|
+
});
|
|
208
|
+
/**
|
|
209
|
+
* This method logs out the currently authenticated user based on your JS SDK authentication configurations.
|
|
210
|
+
*
|
|
211
|
+
* If the `auth.type` of the SDK is set to `session`, this method will also send a request to the
|
|
212
|
+
* [Delete Authentication Session API route](https://docs.acmekit.com/api/admin#auth_deletesession).
|
|
213
|
+
*
|
|
214
|
+
* The method also clears any stored tokens or sessions, based on your JS SDK authentication configurations.
|
|
215
|
+
*
|
|
216
|
+
* Learn more in the [JS SDK Authentication](https://docs.acmekit.com/resources/js-sdk/auth/overview) guide.
|
|
217
|
+
*
|
|
218
|
+
* @tags auth
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* await sdk.auth.logout()
|
|
222
|
+
*
|
|
223
|
+
* // user is now logged out
|
|
224
|
+
* // you can't send any requests that require authentication
|
|
225
|
+
*/
|
|
226
|
+
this.logout = () => __awaiter(this, void 0, void 0, function* () {
|
|
227
|
+
var _a, _b;
|
|
228
|
+
if (((_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.auth) === null || _b === void 0 ? void 0 : _b.type) === "session") {
|
|
229
|
+
yield this.client.fetch("/auth/session", {
|
|
230
|
+
method: "DELETE",
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
this.client.clearToken();
|
|
234
|
+
});
|
|
235
|
+
/**
|
|
236
|
+
* This method requests a reset password token for an admin user, customer, or custom actor type.
|
|
237
|
+
* It sends a request to the [Generate Reset Password Token API route](https://docs.acmekit.com/api/admin#auth_postactor_typeauth_providerresetpassword).
|
|
238
|
+
*
|
|
239
|
+
* To reset the password later using the token delivered to the user, use the {@link updateProvider} method.
|
|
240
|
+
*
|
|
241
|
+
* Related guide: [How to allow customers to reset their passwords in a storefront](https://docs.acmekit.com/resources/storefront-development/customers/reset-password).
|
|
242
|
+
*
|
|
243
|
+
* @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
|
|
244
|
+
* @param provider - The authentication provider to use. For example, `emailpass`.
|
|
245
|
+
* @param body - The data required to identify the user.
|
|
246
|
+
*
|
|
247
|
+
* @tags auth
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* sdk.auth.resetPassword(
|
|
251
|
+
* "customer",
|
|
252
|
+
* "emailpass",
|
|
253
|
+
* {
|
|
254
|
+
* identifier: "customer@gmail.com"
|
|
255
|
+
* }
|
|
256
|
+
* )
|
|
257
|
+
* .then(() => {
|
|
258
|
+
* // user receives token
|
|
259
|
+
* })
|
|
260
|
+
*/
|
|
261
|
+
this.resetPassword = (actor, provider, body) => __awaiter(this, void 0, void 0, function* () {
|
|
262
|
+
yield this.client.fetch(`/auth/${actor}/${provider}/reset-password`, {
|
|
263
|
+
method: "POST",
|
|
264
|
+
body,
|
|
265
|
+
headers: { accept: "text/plain" }, // 201 Created response
|
|
266
|
+
});
|
|
267
|
+
});
|
|
268
|
+
/**
|
|
269
|
+
* This method is used to update user-related data authentication data.
|
|
270
|
+
*
|
|
271
|
+
* More specifically, use this method when updating the password of an admin user, customer, or
|
|
272
|
+
* custom actor type after requesting to reset their password with {@link resetPassword}.
|
|
273
|
+
*
|
|
274
|
+
* This method sends a request to [this API route](https://docs.acmekit.com/api/admin#auth_postactor_typeauth_providerupdate).
|
|
275
|
+
*
|
|
276
|
+
* Related guide: [How to allow customers to reset their passwords in a storefront](https://docs.acmekit.com/resources/storefront-development/customers/reset-password).
|
|
277
|
+
*
|
|
278
|
+
* @param actor - The actor type. For example, `user` for admin user, or `customer` for customer.
|
|
279
|
+
* @param provider - The authentication provider to use. For example, `emailpass`.
|
|
280
|
+
* @param body - The data necessary to update the user's authentication data. When resetting the user's password,
|
|
281
|
+
* send the `password` property.
|
|
282
|
+
*
|
|
283
|
+
* @tags auth
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* sdk.auth.updateProvider(
|
|
287
|
+
* "customer",
|
|
288
|
+
* "emailpass",
|
|
289
|
+
* {
|
|
290
|
+
* password: "supersecret"
|
|
291
|
+
* },
|
|
292
|
+
* token
|
|
293
|
+
* )
|
|
294
|
+
* .then(() => {
|
|
295
|
+
* // password updated
|
|
296
|
+
* })
|
|
297
|
+
*/
|
|
298
|
+
this.updateProvider = (actor, provider, body, token) => __awaiter(this, void 0, void 0, function* () {
|
|
299
|
+
yield this.client.fetch(`/auth/${actor}/${provider}/update`, {
|
|
300
|
+
method: "POST",
|
|
301
|
+
body,
|
|
302
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
303
|
+
});
|
|
304
|
+
});
|
|
305
|
+
/**
|
|
306
|
+
* @ignore
|
|
307
|
+
*/
|
|
308
|
+
this.setToken_ = (token) => __awaiter(this, void 0, void 0, function* () {
|
|
309
|
+
var _a, _b;
|
|
310
|
+
// By default we just set the token in the configured storage, if configured to use sessions we convert it into session storage instead.
|
|
311
|
+
if (((_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.auth) === null || _b === void 0 ? void 0 : _b.type) === "session") {
|
|
312
|
+
yield this.client.fetch("/auth/session", {
|
|
313
|
+
method: "POST",
|
|
314
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
this.client.setToken(token);
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
this.client = client;
|
|
322
|
+
this.config = config;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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AAY,EAAE,EAAE,uBAAuB;aAC3D,CAAC,CAAA;QACJ,CAAC,CAAA,CAAA;QAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WA6BG;QACH,mBAAc,GAAG,CACf,KAAa,EACb,QAAgB,EAChB,IAAmC,EACnC,KAAa,EACb,EAAE;YACF,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,KAAK,IAAI,QAAQ,SAAS,EAAE;gBAC3D,MAAM,EAAE,MAAM;gBACd,IAAI;gBACJ,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,KAAK,EAAE,EAAE;aAC9C,CAAC,CAAA;QACJ,CAAC,CAAA,CAAA;QAED;;WAEG;QACK,cAAS,GAAG,CAAO,KAAa,EAAE,EAAE;;YAC1C,wIAAwI;YACxI,IAAI,CAAA,MAAA,MAAA,IAAI,CAAC,MAAM,0CAAE,IAAI,0CAAE,IAAI,MAAK,SAAS,EAAE,CAAC;gBAC1C,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,EAAE;oBACvC,MAAM,EAAE,MAAM;oBACd,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,KAAK,EAAE,EAAE;iBAC9C,CAAC,CAAA;YACJ,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;YAC7B,CAAC;QACH,CAAC,CAAA,CAAA;QAhXC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;CA+WF"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { ClientFetch, Config, FetchArgs, FetchInput, FetchStreamResponse } from "./types";
|
|
2
|
+
export declare const PUBLISHABLE_KEY_HEADER = "x-publishable-api-key";
|
|
3
|
+
export declare const LOCALE_STORAGE_KEY = "acmekit_locale";
|
|
4
|
+
export declare class FetchError extends Error {
|
|
5
|
+
status: number | undefined;
|
|
6
|
+
statusText: string | undefined;
|
|
7
|
+
constructor(message: string, statusText?: string, status?: number);
|
|
8
|
+
}
|
|
9
|
+
export declare class Client {
|
|
10
|
+
fetch_: ClientFetch;
|
|
11
|
+
private config;
|
|
12
|
+
private logger;
|
|
13
|
+
private DEFAULT_JWT_STORAGE_KEY;
|
|
14
|
+
private token;
|
|
15
|
+
private locale_;
|
|
16
|
+
get locale(): string;
|
|
17
|
+
constructor(config: Config);
|
|
18
|
+
setLocale(locale: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* `fetch` closely follows (and uses under the hood) the native `fetch` API. There are, however, few key differences:
|
|
21
|
+
* - Non 2xx statuses throw a `FetchError` with the status code as the `status` property, rather than resolving the promise
|
|
22
|
+
* - You can pass `body` and `query` as objects, and they will be encoded and stringified.
|
|
23
|
+
* - The response gets parsed as JSON if the `accept` header is set to `application/json`, otherwise the raw Response object is returned
|
|
24
|
+
*
|
|
25
|
+
* Since the response is dynamically determined, we cannot know if it is JSON or not. Therefore, it is important to pass `Response` as the return type
|
|
26
|
+
*
|
|
27
|
+
* @param input: FetchInput
|
|
28
|
+
* @param init: FetchArgs
|
|
29
|
+
* @returns Promise<T>
|
|
30
|
+
*/
|
|
31
|
+
fetch<T extends any>(input: FetchInput, init?: FetchArgs): Promise<T>;
|
|
32
|
+
/**
|
|
33
|
+
* `fetchStream` is a helper method to deal with server-sent events. It returns an object with a stream and an abort function.
|
|
34
|
+
* It follows a very similar interface to `fetch`, with the return value being an async generator.
|
|
35
|
+
* The stream is an async generator that yields `ServerSentEventMessage` objects, which contains the event name, stringified data, and few other properties.
|
|
36
|
+
* The caller is responsible for handling `disconnect` events and aborting the stream. The caller is also responsible for parsing the data field.
|
|
37
|
+
*
|
|
38
|
+
* @param input: FetchInput
|
|
39
|
+
* @param init: FetchArgs
|
|
40
|
+
* @returns FetchStreamResponse
|
|
41
|
+
*/
|
|
42
|
+
fetchStream(input: FetchInput, init?: FetchArgs): Promise<FetchStreamResponse>;
|
|
43
|
+
setToken(token: string): Promise<void>;
|
|
44
|
+
getToken(): Promise<string | null | undefined>;
|
|
45
|
+
clearToken(): Promise<void>;
|
|
46
|
+
protected clearToken_(): Promise<void>;
|
|
47
|
+
protected initClient(): ClientFetch;
|
|
48
|
+
protected getApiKeyHeader_: () => {
|
|
49
|
+
Authorization: string;
|
|
50
|
+
} | {};
|
|
51
|
+
protected getPublishableKeyHeader_: () => {
|
|
52
|
+
[PUBLISHABLE_KEY_HEADER]: string;
|
|
53
|
+
} | {};
|
|
54
|
+
protected getJwtHeader_(): Promise<{
|
|
55
|
+
Authorization: string;
|
|
56
|
+
} | {}>;
|
|
57
|
+
protected setToken_(token: string): Promise<void>;
|
|
58
|
+
protected getToken_(): Promise<string | null | undefined>;
|
|
59
|
+
protected getTokenStorageInfo_: () => {
|
|
60
|
+
storageMethod: "session" | "local" | "memory" | "custom" | "nostore";
|
|
61
|
+
storageKey: string;
|
|
62
|
+
};
|
|
63
|
+
protected throwError_(message: string): void;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,WAAW,EACX,MAAM,EACN,SAAS,EACT,UAAU,EACV,mBAAmB,EAEpB,MAAM,SAAS,CAAA;AAEhB,eAAO,MAAM,sBAAsB,0BAA0B,CAAA;AAC7D,eAAO,MAAM,kBAAkB,mBAAmB,CAAA;AAoFlD,qBAAa,UAAW,SAAQ,KAAK;IACnC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;gBAElB,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;CAKlE;AAED,qBAAa,MAAM;IACV,MAAM,EAAE,WAAW,CAAA;IAC1B,OAAO,CAAC,MAAM,CAAQ;IACtB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