333 lines
15 KiB
JavaScript
333 lines
15 KiB
JavaScript
"use strict";
|
|
self["webpackHotUpdatedropship_store"]("main",{
|
|
|
|
/***/ "./.storybook/preview.js"
|
|
/*!*******************************!*\
|
|
!*** ./.storybook/preview.js ***!
|
|
\*******************************/
|
|
(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
|
|
__webpack_require__.r(__webpack_exports__);
|
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
/* harmony export */ });
|
|
/* harmony import */ var _styles_globals_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../styles/globals.css */ "./styles/globals.css");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "./node_modules/react/index.js");
|
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
|
|
/* harmony import */ var next_auth_react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! next-auth/react */ "./node_modules/next-auth/react/index.js");
|
|
/* harmony import */ var next_auth_react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(next_auth_react__WEBPACK_IMPORTED_MODULE_2__);
|
|
function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
|
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
|
|
|
|
|
|
var mockSession = {
|
|
user: {
|
|
name: "Story User",
|
|
email: "story@shiftedoffroad.com"
|
|
},
|
|
expires: "2099-01-01T00:00:00.000Z"
|
|
};
|
|
function installFetchMock() {
|
|
if (typeof globalThis.fetch === "function" && globalThis.fetch.__isStorybookMock) {
|
|
return;
|
|
}
|
|
var makeResponse = function makeResponse(data) {
|
|
var ok = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
var status = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ok ? 200 : 400;
|
|
return {
|
|
ok: ok,
|
|
status: status,
|
|
json: function () {
|
|
var _json = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
return _regenerator().w(function (_context) {
|
|
while (1) switch (_context.n) {
|
|
case 0:
|
|
return _context.a(2, data);
|
|
}
|
|
}, _callee);
|
|
}));
|
|
function json() {
|
|
return _json.apply(this, arguments);
|
|
}
|
|
return json;
|
|
}(),
|
|
text: function () {
|
|
var _text = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
return _regenerator().w(function (_context2) {
|
|
while (1) switch (_context2.n) {
|
|
case 0:
|
|
return _context2.a(2, JSON.stringify(data));
|
|
}
|
|
}, _callee2);
|
|
}));
|
|
function text() {
|
|
return _text.apply(this, arguments);
|
|
}
|
|
return text;
|
|
}()
|
|
};
|
|
};
|
|
var handler = /*#__PURE__*/function () {
|
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(input) {
|
|
var init,
|
|
url,
|
|
method,
|
|
_args3 = arguments;
|
|
return _regenerator().w(function (_context3) {
|
|
while (1) switch (_context3.n) {
|
|
case 0:
|
|
init = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {};
|
|
url = typeof input === "string" ? input : (input === null || input === void 0 ? void 0 : input.url) || "";
|
|
method = (init.method || "GET").toUpperCase();
|
|
if (!url.includes("/layout")) {
|
|
_context3.n = 2;
|
|
break;
|
|
}
|
|
if (!(method === "POST")) {
|
|
_context3.n = 1;
|
|
break;
|
|
}
|
|
return _context3.a(2, makeResponse({
|
|
ok: true
|
|
}));
|
|
case 1:
|
|
return _context3.a(2, makeResponse({
|
|
layout: {
|
|
hero: {
|
|
title: "Shifted Offroad",
|
|
subtitle: "Dialed for the trail."
|
|
},
|
|
sections: ["shopByVehicle", "categories", "trailReels"]
|
|
}
|
|
}));
|
|
case 2:
|
|
if (!url.includes("/api/printful/products")) {
|
|
_context3.n = 3;
|
|
break;
|
|
}
|
|
return _context3.a(2, makeResponse({
|
|
products: [{
|
|
id: "pf_1",
|
|
name: "Shifted Hoodie",
|
|
unitAmount: 4999,
|
|
currency: "usd",
|
|
thumbnailUrl: "/assets/sample-1.jpg",
|
|
variantId: "v_1"
|
|
}, {
|
|
id: "pf_2",
|
|
name: "Trail Cap",
|
|
unitAmount: 2999,
|
|
currency: "usd",
|
|
thumbnailUrl: "/assets/sample-2.jpg",
|
|
variantId: "v_2"
|
|
}]
|
|
}));
|
|
case 3:
|
|
if (!url.includes("/api/admin/products/list")) {
|
|
_context3.n = 4;
|
|
break;
|
|
}
|
|
return _context3.a(2, makeResponse({
|
|
products: [{
|
|
stripeProductId: "prod_1",
|
|
stripePriceId: "price_1",
|
|
name: "Lift Kit",
|
|
description: "2.5 inch lift kit",
|
|
unitAmount: 69900,
|
|
currency: "usd",
|
|
active: true
|
|
}]
|
|
}));
|
|
case 4:
|
|
if (!(url.includes("/api/admin/products/refresh") || url.includes("/api/admin/products/update"))) {
|
|
_context3.n = 5;
|
|
break;
|
|
}
|
|
return _context3.a(2, makeResponse({
|
|
ok: true
|
|
}));
|
|
case 5:
|
|
if (!url.includes("/api/connect/account/lookup")) {
|
|
_context3.n = 6;
|
|
break;
|
|
}
|
|
return _context3.a(2, makeResponse({
|
|
accountId: "acct_123"
|
|
}));
|
|
case 6:
|
|
if (!url.includes("/api/storefront/products")) {
|
|
_context3.n = 7;
|
|
break;
|
|
}
|
|
return _context3.a(2, makeResponse({
|
|
products: [{
|
|
stripeProductId: "prod_1",
|
|
stripePriceId: "price_1",
|
|
name: "Recovery Kit",
|
|
description: "Tow strap and shackles",
|
|
unitAmount: 12900,
|
|
currency: "usd"
|
|
}, {
|
|
stripeProductId: "prod_2",
|
|
stripePriceId: "price_2",
|
|
name: "LED Pods",
|
|
description: "High output pods",
|
|
unitAmount: 9900,
|
|
currency: "usd"
|
|
}]
|
|
}));
|
|
case 7:
|
|
if (!url.includes("/api/connect/products/get")) {
|
|
_context3.n = 8;
|
|
break;
|
|
}
|
|
return _context3.a(2, makeResponse({
|
|
product: {
|
|
id: "prod_123",
|
|
name: "Trail Bundle",
|
|
description: "Lighting + recovery essentials",
|
|
default_price: {
|
|
id: "price_123",
|
|
unit_amount: 19900,
|
|
currency: "usd"
|
|
}
|
|
}
|
|
}));
|
|
case 8:
|
|
if (!url.includes("/api/connect/payment-intent")) {
|
|
_context3.n = 9;
|
|
break;
|
|
}
|
|
return _context3.a(2, makeResponse({
|
|
clientSecret: "pi_mock_secret"
|
|
}));
|
|
case 9:
|
|
if (!url.includes("/api/connect/checkout")) {
|
|
_context3.n = 10;
|
|
break;
|
|
}
|
|
return _context3.a(2, makeResponse({
|
|
url: "/success"
|
|
}));
|
|
case 10:
|
|
if (!url.includes("/api/cart/get")) {
|
|
_context3.n = 11;
|
|
break;
|
|
}
|
|
return _context3.a(2, makeResponse({
|
|
cart: {
|
|
id: "cart_1",
|
|
items: [{
|
|
id: "item_1",
|
|
name: "Winch Plate",
|
|
unitAmount: 19900,
|
|
currency: "usd",
|
|
quantity: 1
|
|
}]
|
|
}
|
|
}));
|
|
case 11:
|
|
if (!(url.includes("/api/cart/add") || url.includes("/api/cart/update") || url.includes("/api/cart/remove"))) {
|
|
_context3.n = 12;
|
|
break;
|
|
}
|
|
return _context3.a(2, makeResponse({
|
|
ok: true
|
|
}));
|
|
case 12:
|
|
if (!url.includes("/api/cart/checkout")) {
|
|
_context3.n = 13;
|
|
break;
|
|
}
|
|
return _context3.a(2, makeResponse({
|
|
url: "/success"
|
|
}));
|
|
case 13:
|
|
if (!url.includes("/api/store/me")) {
|
|
_context3.n = 14;
|
|
break;
|
|
}
|
|
return _context3.a(2, makeResponse({
|
|
slug: "storeshifted",
|
|
stripeAccountId: "acct_123"
|
|
}));
|
|
case 14:
|
|
if (!url.includes("/api/connect/account/status")) {
|
|
_context3.n = 15;
|
|
break;
|
|
}
|
|
return _context3.a(2, makeResponse({
|
|
readyToProcessPayments: true,
|
|
onboardingComplete: true
|
|
}));
|
|
case 15:
|
|
if (!(url.includes("/api/connect/account/create") || url.includes("/api/connect/account/link") || url.includes("/api/connect/products/create") || url.includes("/api/connect/subscription/create") || url.includes("/api/connect/subscription/portal"))) {
|
|
_context3.n = 16;
|
|
break;
|
|
}
|
|
return _context3.a(2, makeResponse({
|
|
ok: true,
|
|
accountId: "acct_123",
|
|
url: "/connect"
|
|
}));
|
|
case 16:
|
|
if (!(url.includes("/api/auth/signup") || url.includes("/api/auth/signup-customer"))) {
|
|
_context3.n = 17;
|
|
break;
|
|
}
|
|
return _context3.a(2, makeResponse({
|
|
ok: true
|
|
}));
|
|
case 17:
|
|
if (!(url.includes("/api/printful/sync-products") && method === "POST")) {
|
|
_context3.n = 18;
|
|
break;
|
|
}
|
|
return _context3.a(2, makeResponse({
|
|
result: {
|
|
id: "sync_1"
|
|
}
|
|
}));
|
|
case 18:
|
|
return _context3.a(2, makeResponse({
|
|
error: "Unhandled mock endpoint"
|
|
}, false, 404));
|
|
}
|
|
}, _callee3);
|
|
}));
|
|
return function handler(_x) {
|
|
return _ref.apply(this, arguments);
|
|
};
|
|
}();
|
|
handler.__isStorybookMock = true;
|
|
globalThis.fetch = handler;
|
|
}
|
|
installFetchMock();
|
|
globalThis.__STORYBOOK_SEARCH_PARAMS__ = globalThis.__STORYBOOK_SEARCH_PARAMS__ || {};
|
|
var preview = {
|
|
decorators: [function (Story) {
|
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(next_auth_react__WEBPACK_IMPORTED_MODULE_2__.SessionProvider, {
|
|
session: mockSession
|
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_1___default().createElement(Story, null));
|
|
}],
|
|
parameters: {
|
|
actions: {
|
|
argTypesRegex: "^on[A-Z].*"
|
|
},
|
|
controls: {
|
|
matchers: {
|
|
color: /(background|color)$/i,
|
|
date: /Date$/
|
|
}
|
|
}
|
|
}
|
|
};
|
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (preview);
|
|
|
|
/***/ }
|
|
|
|
});
|
|
//# sourceMappingURL=main.c140d36e488f58319a93.hot-update.js.map
|