- 
                Notifications
    You must be signed in to change notification settings 
- Fork 5.5k
[Components] Paazl new components #18255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
  File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
        
          
          
            35 changes: 35 additions & 0 deletions
          
          35 
        
  components/paazl/actions/create-checkout-token/create-checkout-token.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import app from "../../paazl.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "paazl-create-checkout-token", | ||
| name: "Create Checkout Access Token", | ||
| description: "Returns an access token for a checkout session. This enables the Paazl checkout widget to access Paazl resources. [See the documentation](https://support.paazl.com/hc/en-us/articles/360008633973-REST-API-reference#/Checkout/createTokenUsingPOST)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| reference: { | ||
| propDefinition: [ | ||
| app, | ||
| "reference", | ||
| ], | ||
| description: "Your reference for the checkout session. If the reference value provided already exists, the existing session will be replaced with a new session.", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| app, | ||
| reference, | ||
| } = this; | ||
|  | ||
| const response = await app.createCheckoutToken({ | ||
| $, | ||
| data: { | ||
| reference, | ||
| }, | ||
| }); | ||
|  | ||
| $.export("$summary", "Successfully created checkout token"); | ||
| return response; | ||
| }, | ||
| }; | 
        
          
          
            196 changes: 196 additions & 0 deletions
          
          196 
        
  components/paazl/actions/create-shipment/create-shipment.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,196 @@ | ||
| import app from "../../paazl.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "paazl-create-shipment", | ||
| name: "Create Shipment For Order", | ||
| description: "Generates a shipment at the carrier for the shipping option specified in POST order. [See the documentation](https://support.paazl.com/hc/en-us/articles/360008633973-REST-API-reference#/Shipments/createShipmentUsingPOST)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| orderReference: { | ||
| propDefinition: [ | ||
| app, | ||
| "reference", | ||
| ], | ||
| }, | ||
| type: { | ||
| optional: false, | ||
| propDefinition: [ | ||
| app, | ||
| "labelType", | ||
| ], | ||
| }, | ||
| size: { | ||
| optional: false, | ||
| propDefinition: [ | ||
| app, | ||
| "labelSize", | ||
| ], | ||
| }, | ||
| quantity: { | ||
| propDefinition: [ | ||
| app, | ||
| "quantity", | ||
| ], | ||
| }, | ||
| enableParcels: { | ||
| propDefinition: [ | ||
| app, | ||
| "enableParcels", | ||
| ], | ||
| }, | ||
| parcelWeight: { | ||
| propDefinition: [ | ||
| app, | ||
| "parcelWeight", | ||
| ], | ||
| }, | ||
| parcelLength: { | ||
| propDefinition: [ | ||
| app, | ||
| "parcelLength", | ||
| ], | ||
| }, | ||
| parcelWidth: { | ||
| propDefinition: [ | ||
| app, | ||
| "parcelWidth", | ||
| ], | ||
| }, | ||
| parcelHeight: { | ||
| propDefinition: [ | ||
| app, | ||
| "parcelHeight", | ||
| ], | ||
| }, | ||
| parcelVolume: { | ||
| propDefinition: [ | ||
| app, | ||
| "parcelVolume", | ||
| ], | ||
| }, | ||
| parcelReference: { | ||
| propDefinition: [ | ||
| app, | ||
| "parcelReference", | ||
| ], | ||
| }, | ||
| parcelDescription: { | ||
| propDefinition: [ | ||
| app, | ||
| "parcelDescription", | ||
| ], | ||
| }, | ||
| parcelCodValue: { | ||
| propDefinition: [ | ||
| app, | ||
| "parcelCodValue", | ||
| ], | ||
| }, | ||
| parcelCodCurrency: { | ||
| propDefinition: [ | ||
| app, | ||
| "parcelCodCurrency", | ||
| ], | ||
| }, | ||
| parcelInsuredValue: { | ||
| propDefinition: [ | ||
| app, | ||
| "parcelInsuredValue", | ||
| ], | ||
| }, | ||
| parcelInsuredCurrency: { | ||
| propDefinition: [ | ||
| app, | ||
| "parcelInsuredCurrency", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| app, | ||
| orderReference, | ||
| type, | ||
| size, | ||
| quantity, | ||
| enableParcels, | ||
| parcelWeight, | ||
| parcelLength, | ||
| parcelWidth, | ||
| parcelHeight, | ||
| parcelVolume, | ||
| parcelReference, | ||
| parcelDescription, | ||
| parcelCodValue, | ||
| parcelCodCurrency, | ||
| parcelInsuredValue, | ||
| parcelInsuredCurrency, | ||
| } = this; | ||
|  | ||
| const response = await app.createShipment({ | ||
| $, | ||
| orderReference, | ||
| data: { | ||
| type, | ||
| size, | ||
| quantity, | ||
| ...(enableParcels && parcelWeight | ||
| ? { | ||
| parcels: [ | ||
| { | ||
| weight: parseFloat(parcelWeight), | ||
| ...(parcelLength && parcelWidth && parcelHeight | ||
| ? { | ||
| dimensions: { | ||
| length: parcelLength, | ||
| width: parcelWidth, | ||
| height: parcelHeight, | ||
| ...(parcelVolume | ||
| ? { | ||
| volume: parseFloat(parcelVolume), | ||
| } | ||
| : {} | ||
| ), | ||
| }, | ||
| } | ||
| : parcelVolume | ||
| ? { | ||
| dimensions: { | ||
| volume: parseFloat(parcelVolume), | ||
| }, | ||
| } | ||
| : {} | ||
| ), | ||
| reference: parcelReference, | ||
| description: parcelDescription, | ||
| ...(parcelCodValue | ||
| ? { | ||
| codValue: { | ||
| value: parseFloat(parcelCodValue), | ||
| currency: parcelCodCurrency || "EUR", | ||
| }, | ||
| } | ||
| : {} | ||
| ), | ||
| ...(parcelInsuredValue | ||
| ? { | ||
| insuredValue: { | ||
| value: parseFloat(parcelInsuredValue), | ||
| currency: parcelInsuredCurrency || "EUR", | ||
| }, | ||
| } | ||
| : {} | ||
| ), | ||
| }, | ||
| ], | ||
| } | ||
| : {} | ||
| ), | ||
| }, | ||
| }); | ||
|  | ||
| $.export("$summary", `Successfully created shipment for order: ${orderReference}`); | ||
| return response; | ||
| }, | ||
| }; | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import app from "../../paazl.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "paazl-delete-order", | ||
| name: "Delete Order", | ||
| description: "Deletes an order. [See the documentation](https://support.paazl.com/hc/en-us/articles/360008633973-REST-API-reference#/Order/saveOrderUsingPOST)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| reference: { | ||
| propDefinition: [ | ||
| app, | ||
| "reference", | ||
| ], | ||
| description: "Your reference for the order you want to delete", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| app, | ||
| reference, | ||
| } = this; | ||
|  | ||
| const response = await app.deleteOrder({ | ||
| $, | ||
| reference, | ||
| }); | ||
|  | ||
| $.export("$summary", `Successfully deleted order with reference: ${reference}`); | ||
| return response; | ||
| }, | ||
| }; | 
        
          
          
            35 changes: 35 additions & 0 deletions
          
          35 
        
  components/paazl/actions/get-checkout-session/get-checkout-session.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import app from "../../paazl.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "paazl-get-checkout-session", | ||
| name: "Get Checkout Session Data", | ||
| description: "Gets your reference for a checkout session. [See the documentation](https://support.paazl.com/hc/en-us/articles/360008633973-REST-API-reference#/Checkout/getCheckoutUsingGET)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| reference: { | ||
| propDefinition: [ | ||
| app, | ||
| "reference", | ||
| ], | ||
| description: "Your reference for the checkout session whose details you want to retrieve. The reference is the one you used when you created an access token with the token endpoint.", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| app, | ||
| reference, | ||
| } = this; | ||
|  | ||
| const response = await app.getCheckoutSession({ | ||
| $, | ||
| params: { | ||
| reference, | ||
| }, | ||
| }); | ||
|  | ||
| $.export("$summary", "Successfully retrieved checkout session data"); | ||
| return response; | ||
| }, | ||
| }; | 
        
          
          
            52 changes: 52 additions & 0 deletions
          
          52 
        
  components/paazl/actions/get-order-labels/get-order-labels.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import app from "../../paazl.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "paazl-get-order-labels", | ||
| name: "Get Order Shipping Labels", | ||
| description: "Retrieves an order's labels. [See the documentation](https://support.paazl.com/hc/en-us/articles/360008633973-REST-API-reference#/Shipments/getOrderLabelsUsingGet)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| orderReference: { | ||
| propDefinition: [ | ||
| app, | ||
| "reference", | ||
| ], | ||
| }, | ||
| type: { | ||
| propDefinition: [ | ||
| app, | ||
| "labelType", | ||
| ], | ||
| description: "Format of the labels", | ||
| }, | ||
| size: { | ||
| propDefinition: [ | ||
| app, | ||
| "labelSize", | ||
| ], | ||
| description: "Size of the labels", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| app, | ||
| orderReference, | ||
| type, | ||
| size, | ||
| } = this; | ||
|  | ||
| const response = await app.getOrderLabels({ | ||
| $, | ||
| orderReference, | ||
| params: { | ||
| type, | ||
| size, | ||
| }, | ||
| }); | ||
|  | ||
| $.export("$summary", `Successfully retrieved labels for order: ${orderReference}`); | ||
| return response; | ||
| }, | ||
| }; | 
        
          
          
            32 changes: 32 additions & 0 deletions
          
          32 
        
  components/paazl/actions/get-order-shipments/get-order-shipments.mjs
  
  
      
      
   
        
      
      
    
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| import app from "../../paazl.app.mjs"; | ||
|  | ||
| export default { | ||
| key: "paazl-get-order-shipments", | ||
| name: "Get Order Shipment Details", | ||
| description: "Retrieves an order's shipments details. [See the documentation](https://support.paazl.com/hc/en-us/articles/360008633973-REST-API-reference#/Shipments/getShipmentsUsingGET)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| orderReference: { | ||
| propDefinition: [ | ||
| app, | ||
| "reference", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| app, | ||
| orderReference, | ||
| } = this; | ||
|  | ||
| const response = await app.getOrderShipments({ | ||
| $, | ||
| orderReference, | ||
| }); | ||
|  | ||
| $.export("$summary", "Successfully retrieved shipment details for order"); | ||
| return response; | ||
| }, | ||
| }; | 
      
      Oops, something went wrong.
        
    
  
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.