@dropins/storefront-order 0.1.0-alpha24 → 0.1.0-alpha26
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,2 +1,2 @@
|
|
|
1
|
-
export declare const STORE_CONFIG_QUERY = "\nquery STORE_CONFIG_QUERY {\n storeConfig {\n order_cancellation_enabled\n order_cancellation_reasons {\n description\n }\n
|
|
1
|
+
export declare const STORE_CONFIG_QUERY = "\nquery STORE_CONFIG_QUERY {\n storeConfig {\n order_cancellation_enabled\n order_cancellation_reasons {\n description\n }\n orders_invoices_credit_memos_display_price\n orders_invoices_credit_memos_display_shipping_amount\n orders_invoices_credit_memos_display_subtotal\n orders_invoices_credit_memos_display_grandtotal\n orders_invoices_credit_memos_display_full_summary\n orders_invoices_credit_memos_display_zero_tax\n }\n}\n";
|
|
2
2
|
//# sourceMappingURL=StoreConfigQuery.d.ts.map
|
package/chunks/getStoreConfig.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
/*! Copyright 2024 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{f as
|
|
3
|
+
import{f as o,h as s}from"./fetch-graphql.js";function i(e){return e?{orderCancellationEnabled:e.order_cancellation_enabled,orderCancellationReasons:e.order_cancellation_reasons,shoppingCartDisplayPrice:e.orders_invoices_credit_memos_display_price,shoppingOrdersDisplaySubtotal:e.orders_invoices_credit_memos_display_subtotal,shoppingOrdersDisplayShipping:e.orders_invoices_credit_memos_display_shipping_amount,shoppingOrdersDisplayGrandTotal:e.orders_invoices_credit_memos_display_grandtotal,shoppingOrdersDisplayFullSummary:e.orders_invoices_credit_memos_display_full_summary,shoppingOrdersDisplayZeroTax:e.orders_invoices_credit_memos_display_zero_tax}:null}const _=`
|
|
4
4
|
query STORE_CONFIG_QUERY {
|
|
5
5
|
storeConfig {
|
|
6
6
|
order_cancellation_enabled
|
|
7
7
|
order_cancellation_reasons {
|
|
8
8
|
description
|
|
9
9
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
shopping_cart_display_zero_tax
|
|
10
|
+
orders_invoices_credit_memos_display_price
|
|
11
|
+
orders_invoices_credit_memos_display_shipping_amount
|
|
12
|
+
orders_invoices_credit_memos_display_subtotal
|
|
13
|
+
orders_invoices_credit_memos_display_grandtotal
|
|
14
|
+
orders_invoices_credit_memos_display_full_summary
|
|
15
|
+
orders_invoices_credit_memos_display_zero_tax
|
|
17
16
|
}
|
|
18
17
|
}
|
|
19
|
-
`,
|
|
18
|
+
`,c=async()=>o(_,{method:"GET",cache:"force-cache"}).then(({errors:e,data:r})=>e?s(e):i(r.storeConfig));export{c as g};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! Copyright 2024 Adobe
|
|
2
2
|
All Rights Reserved. */
|
|
3
|
-
import{jsx as c,jsxs as N,Fragment as S}from"@dropins/tools/preact-jsx-runtime.js";import{Card as F,Header as P,Button as E,InLineAlert as G,Modal as V}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{f as K}from"../chunks/returnOrdersHelper.js";import{classes as y,Slot as q}from"@dropins/tools/lib.js";import{f as x}from"../chunks/formatDateToLocale.js";import{useState as O,useEffect as v,useCallback as H}from"@dropins/tools/preact-hooks.js";import{events as I}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{useMemo as W,useState as j}from"@dropins/tools/preact-compat.js";import{r as k}from"../chunks/redirectTo.js";import{O as J}from"../chunks/OrderCancelForm.js";import{useText as C,Text as $}from"@dropins/tools/i18n.js";import{r as z}from"../chunks/reorderItems.js";import{C as B}from"../chunks/OrderLoaders.js";import{G as Q}from"../chunks/getGuestOrder.graphql.js";import{f as X,h as Y}from"../chunks/fetch-graphql.js";import{b as Z}from"../chunks/transform-order-details.js";import{g as D}from"../chunks/getStoreConfig.js";import"../chunks/getFormValues.js";import"../chunks/requestGuestOrderCancel.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/convertCase.js";var _=(r=>(r.CANCEL="CANCEL",r.RETURN="RETURN",r.REORDER="REORDER",r))(_||{});const w={pending:"orderPending",shiping:"orderShipped",complete:"orderComplete",processing:"orderProcessing","on hold":"orderOnHold",canceled:"orderCanceled","suspected fraud":"orderSuspectedFraud","payment Review":"orderPaymentReview","order received":"orderReceived","guest order cancellation requested":"guestOrderCancellationRequested"},ee=({slots:r,title:t,status:n,orderData:e,routeCreateReturn:i,onError:s,routeOnSuccess:a})=>{var M,L,b;const l=!!(e!=null&&e.returnNumber),d=String(n).toLocaleLowerCase(),o=(M=e==null?void 0:e.returns)==null?void 0:M[0],m=(o==null?void 0:o.returnStatus)??"",p=(o==null?void 0:o.createdReturnAt)??"",g=C(`Order.OrderStatusContent.${w[d]}.title`),h=C(`Order.OrderStatusContent.${w[d]}.message`),R=C(`Order.OrderStatusContent.${w[d]}.messageWithoutDate`),u=C({title:`Order.OrderStatusContent.returnStatus.${K(m)}`,returnMessage:"Order.OrderStatusContent.returnMessage"});if(!n)return c("div",{});const f=e!=null&&e.orderStatusChangeDate?h==null?void 0:h.message.replace("{DATE}",e==null?void 0:e.orderStatusChangeDate):R.messageWithoutDate,A=((b=(L=u==null?void 0:u.returnMessage)==null?void 0:L.replace("{ORDER_CREATE_DATE}",x(e==null?void 0:e.orderDate)))==null?void 0:b.replace("{RETURN_CREATE_DATE}",x(p)))??"",T=l?t??u.title:t??g.title;return N(F,{className:"order-order-status-content",variant:"secondary",children:[c(P,{title:T}),N("div",{className:"order-order-status-content__wrapper",children:[c("div",{className:y(["order-order-status-content__wrapper-description",["order-order-status-content__wrapper-description--actions-slot",!!(r!=null&&r.OrderActions)]]),children:c("p",{children:l?A:f})}),c(re,{orderData:e,slots:r,routeCreateReturn:i,routeOnSuccess:a,onError:s})]})]})},te=({orderData:r})=>{const[t,n]=O(r),[e,i]=O(r==null?void 0:r.status);return v(()=>{const s=I.on("order/data",a=>{n(a),i(a.status)},{eager:!0});return()=>{s==null||s.off()}},[]),{orderStatus:e,order:t}},re=({className:r,orderData:t,slots:n,routeCreateReturn:e,routeOnSuccess:i,onError:s})=>{const a=C({cancel:"Order.OrderStatusContent.actions.cancel",createReturn:"Order.OrderStatusContent.actions.createReturn",createAnotherReturn:"Order.OrderStatusContent.actions.createAnotherReturn",reorder:"Order.OrderStatusContent.actions.reorder"}),l=W(()=>{const d=t==null?void 0:t.availableActions,o=!!(d!=null&&d.length),m=!!(t!=null&&t.returnNumber),p=()=>{k(e,{},t)};return c(S,{children:n!=null&&n.OrderActions?c(q,{"data-testid":"OrderActionsSlot",name:"OrderCanceledActions",slot:n==null?void 0:n.OrderActions,context:t}):c("div",{"data-testid":"availableActionsList",className:y(["order-order-actions__wrapper",["order-order-actions__wrapper--empty",!o]]),children:d==null?void 0:d.map(g=>{switch(g){case _.CANCEL:return c(S,{children:m?null:c(ce,{orderRef:(t==null?void 0:t.token)??
|
|
3
|
+
import{jsx as c,jsxs as N,Fragment as S}from"@dropins/tools/preact-jsx-runtime.js";import{Card as F,Header as P,Button as E,InLineAlert as G,Modal as V}from"@dropins/tools/components.js";import"../chunks/OrderCancel.js";import{f as K}from"../chunks/returnOrdersHelper.js";import{classes as y,Slot as q}from"@dropins/tools/lib.js";import{f as x}from"../chunks/formatDateToLocale.js";import{useState as O,useEffect as v,useCallback as H}from"@dropins/tools/preact-hooks.js";import{events as I}from"@dropins/tools/event-bus.js";import"@dropins/tools/preact.js";import{useMemo as W,useState as j}from"@dropins/tools/preact-compat.js";import{r as k}from"../chunks/redirectTo.js";import{O as J}from"../chunks/OrderCancelForm.js";import{useText as C,Text as $}from"@dropins/tools/i18n.js";import{r as z}from"../chunks/reorderItems.js";import{C as B}from"../chunks/OrderLoaders.js";import{G as Q}from"../chunks/getGuestOrder.graphql.js";import{f as X,h as Y}from"../chunks/fetch-graphql.js";import{b as Z}from"../chunks/transform-order-details.js";import{g as D}from"../chunks/getStoreConfig.js";import"../chunks/getFormValues.js";import"../chunks/requestGuestOrderCancel.js";import"../chunks/network-error.js";import"@dropins/tools/fetch-graphql.js";import"../chunks/convertCase.js";var _=(r=>(r.CANCEL="CANCEL",r.RETURN="RETURN",r.REORDER="REORDER",r))(_||{});const w={pending:"orderPending",shiping:"orderShipped",complete:"orderComplete",processing:"orderProcessing","on hold":"orderOnHold",canceled:"orderCanceled","suspected fraud":"orderSuspectedFraud","payment Review":"orderPaymentReview","order received":"orderReceived","guest order cancellation requested":"guestOrderCancellationRequested"},ee=({slots:r,title:t,status:n,orderData:e,routeCreateReturn:i,onError:s,routeOnSuccess:a})=>{var M,L,b;const l=!!(e!=null&&e.returnNumber),d=String(n).toLocaleLowerCase(),o=(M=e==null?void 0:e.returns)==null?void 0:M[0],m=(o==null?void 0:o.returnStatus)??"",p=(o==null?void 0:o.createdReturnAt)??"",g=C(`Order.OrderStatusContent.${w[d]}.title`),h=C(`Order.OrderStatusContent.${w[d]}.message`),R=C(`Order.OrderStatusContent.${w[d]}.messageWithoutDate`),u=C({title:`Order.OrderStatusContent.returnStatus.${K(m)}`,returnMessage:"Order.OrderStatusContent.returnMessage"});if(!n)return c("div",{});const f=e!=null&&e.orderStatusChangeDate?h==null?void 0:h.message.replace("{DATE}",e==null?void 0:e.orderStatusChangeDate):R.messageWithoutDate,A=((b=(L=u==null?void 0:u.returnMessage)==null?void 0:L.replace("{ORDER_CREATE_DATE}",x(e==null?void 0:e.orderDate)))==null?void 0:b.replace("{RETURN_CREATE_DATE}",x(p)))??"",T=l?t??u.title:t??g.title;return N(F,{className:"order-order-status-content",variant:"secondary",children:[c(P,{title:T}),N("div",{className:"order-order-status-content__wrapper",children:[c("div",{className:y(["order-order-status-content__wrapper-description",["order-order-status-content__wrapper-description--actions-slot",!!(r!=null&&r.OrderActions)]]),children:c("p",{children:l?A:f})}),c(re,{orderData:e,slots:r,routeCreateReturn:i,routeOnSuccess:a,onError:s})]})]})},te=({orderData:r})=>{const[t,n]=O(r),[e,i]=O(r==null?void 0:r.status);return v(()=>{const s=I.on("order/data",a=>{n(a),i(a.status)},{eager:!0});return()=>{s==null||s.off()}},[]),{orderStatus:e,order:t}},re=({className:r,orderData:t,slots:n,routeCreateReturn:e,routeOnSuccess:i,onError:s})=>{const a=C({cancel:"Order.OrderStatusContent.actions.cancel",createReturn:"Order.OrderStatusContent.actions.createReturn",createAnotherReturn:"Order.OrderStatusContent.actions.createAnotherReturn",reorder:"Order.OrderStatusContent.actions.reorder"}),l=W(()=>{const d=t==null?void 0:t.availableActions,o=!!(d!=null&&d.length),m=!!(t!=null&&t.returnNumber),p=()=>{k(e,{},t)};return c(S,{children:n!=null&&n.OrderActions?c(q,{"data-testid":"OrderActionsSlot",name:"OrderCanceledActions",slot:n==null?void 0:n.OrderActions,context:t}):c("div",{"data-testid":"availableActionsList",className:y(["order-order-actions__wrapper",["order-order-actions__wrapper--empty",!o]]),children:d==null?void 0:d.map(g=>{switch(g){case _.CANCEL:return c(S,{children:m?null:c(ce,{orderRef:(t==null?void 0:t.token)??(t==null?void 0:t.id)})});case _.RETURN:return c(E,{variant:"secondary",onClick:p,children:m?a.createAnotherReturn:a.createReturn});case _.REORDER:return c(S,{children:m?null:c(ie,{orderData:t,onError:s,routeOnSuccess:i,children:a.reorder})})}})})})},[s,t,i,e,n,a]);return c("div",{className:y(["order-order-actions",r]),children:l})},U=()=>{const[r,t]=O(null);return v(()=>{const n=sessionStorage.getItem("orderStoreConfig"),e=n?JSON.parse(n):null;e?t(e):D().then(i=>{i&&(sessionStorage.setItem("orderStoreConfig",JSON.stringify(i)),t(i))})},[]),r},ne=`
|
|
4
4
|
mutation CONFIRM_CANCEL_ORDER_MUTATION(
|
|
5
5
|
$orderId: ID!,
|
|
6
6
|
$confirmationKey: String!
|
|
@@ -4,7 +4,6 @@ export interface StoreConfigModel {
|
|
|
4
4
|
shoppingCartDisplayPrice: 1 | 2 | 3;
|
|
5
5
|
shoppingOrdersDisplayShipping: 1 | 2 | 3;
|
|
6
6
|
shoppingOrdersDisplaySubtotal: 1 | 2 | 3;
|
|
7
|
-
shoppingOrdersDisplayTaxGiftWrapping: string;
|
|
8
7
|
shoppingOrdersDisplayFullSummary: boolean;
|
|
9
8
|
shoppingOrdersDisplayGrandTotal: boolean;
|
|
10
9
|
shoppingOrdersDisplayZeroTax: boolean;
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name": "@dropins/storefront-order", "version": "0.1.0-
|
|
1
|
+
{"name": "@dropins/storefront-order", "version": "0.1.0-alpha26", "@dropins/elsie": "~0.35.0"}
|